forked from timschofield/webERP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReprintGRN.php
111 lines (102 loc) · 3.76 KB
/
ReprintGRN.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
include('includes/session.php');
$Title=_('Reprint a GRN');
$ViewTopic = 'Inventory';
$BookMark = '';
include('includes/header.php');
echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" title="' . $Title . '" alt="" />' . ' ' . $Title . '</p>';
if (!isset($_POST['PONumber'])) {
$_POST['PONumber']='';
}
echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<fieldset>
<legend>' . _('Select a purchase order') . '</legend>
<field>
<label for="PONumber">' . _('Enter a Purchase Order Number') . '</label>
' . '<input type="text" name="PONumber" class="number" size="7" value="'.$_POST['PONumber'].'" />
</field>
</fieldset>
<div class="centre">
<input type="submit" name="Show" value="' . _('Show GRNs') . '" />
</div>
</form>';
if (isset($_POST['Show'])) {
if ($_POST['PONumber']=='') {
echo '<br />';
prnMsg( _('You must enter a purchase order number in the box above'), 'warn');
include('includes/footer.php');
exit;
}
$SQL="SELECT count(orderno)
FROM purchorders
WHERE orderno='" . $_POST['PONumber'] ."'";
$Result=DB_query($SQL);
$MyRow=DB_fetch_row($Result);
if ($MyRow[0]==0) {
echo '<br />';
prnMsg( _('This purchase order does not exist on the system. Please try again.'), 'warn');
include('includes/footer.php');
exit;
}
$SQL="SELECT grnbatch,
grns.grnno,
grns.podetailitem,
grns.itemcode,
grns.itemdescription,
grns.deliverydate,
grns.qtyrecd,
suppinvstogrn.suppinv,
suppliers.suppname,
stockmaster.decimalplaces
FROM grns INNER JOIN suppliers
ON grns.supplierid=suppliers.supplierid
LEFT JOIN suppinvstogrn ON grns.grnno=suppinvstogrn.grnno
INNER JOIN purchorderdetails
ON grns.podetailitem=purchorderdetails.podetailitem
INNER JOIN purchorders on purchorders.orderno=purchorderdetails.orderno
INNER JOIN locationusers ON locationusers.loccode=purchorders.intostocklocation AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1
LEFT JOIN stockmaster
ON grns.itemcode=stockmaster.stockid
WHERE purchorderdetails.orderno='" . $_POST['PONumber'] ."'";
$Result=DB_query($SQL);
if (DB_num_rows($Result)==0) {
echo '<br />';
prnMsg( _('There are no GRNs for this purchase order that can be reprinted.'), 'warn');
include('includes/footer.php');
exit;
}
echo '<br />
<table class="selection">
<tr>
<th colspan="8"><h3>' . _('GRNs for Purchase Order No') .' ' . $_POST['PONumber'] . '</h3></th>
</tr>
<tr>
<th>' . _('Supplier') . '</th>
<th>' . _('PO Order line') . '</th>
<th>' . _('GRN Number') . '</th>
<th>' . _('Item Code') . '</th>
<th>' . _('Item Description') . '</th>
<th>' . _('Delivery Date') . '</th>
<th>' . _('Quantity Received') . '</th>
<th>' . _('Invoice No') . '</th>
<th>' . _('Action') . '</th>
</tr>';
while ($MyRow=DB_fetch_array($Result)) {
echo '<tr class="striped_row">
<td>' . $MyRow['suppname'] . '</td>
<td class="number">' . $MyRow['podetailitem'] . '</td>
<td class="number">' . $MyRow['grnbatch'] . '</td>
<td>' . $MyRow['itemcode'] . '</td>
<td>' . $MyRow['itemdescription'] . '</td>
<td>' . $MyRow['deliverydate'] . '</td>
<td class="number">' . locale_number_format($MyRow['qtyrecd'], $MyRow['decimalplaces']) . '</td>
<td>' . $MyRow['suppinv'] . '</td>
<td><a href="PDFGrn.php?GRNNo=' . $MyRow['grnbatch'] .'&PONo=' . $_POST['PONumber'] . '">' . _('Reprint GRN ') . '</a>
<a href="PDFQALabel.php?GRNNo=' . $MyRow['grnbatch'] .'&PONo=' . $_POST['PONumber'] . '">' . _('Reprint Labels') . '</a></td>
</tr>';
}
echo '</table>';
}
include('includes/footer.php');
?>