8 include('includes/session.inc');
9 $title = _('Stock Re-Order Level Maintenance');
10 include('includes/header.inc');
12 if (isset($_GET['StockID'])){
13 $StockID = trim(strtoupper($_GET['StockID']));
14 } elseif (isset($_POST['StockID'])){
15 $StockID = trim(strtoupper($_POST['StockID']));
19 echo "<A HREF='" . $rootpath . '/SelectProduct.php?' . SID
. "'>" . _('Back to Items') . '</A><BR>';
21 $result = DB_query("SELECT description, units FROM stockmaster WHERE stockid='$StockID'", $db);
22 $myrow = DB_fetch_row($result);
24 echo '<BR><FONT COLOR=BLUE SIZE=3><B>' . $StockID . ' - ' . $myrow[0] . '</B> (' . _('In Units of') . ' ' . $myrow[1] . ')</FONT>';
25 echo "<FORM ACTION='" . $_SERVER['PHP_SELF'] . "?" . SID
. "' METHOD=POST>";
26 echo _('Stock Code') . ":<INPUT TYPE=TEXT NAME='StockID' SIZE=21 VALUE='$StockID' MAXLENGTH=20>";
27 echo " <INPUT TYPE=SUBMIT NAME='Show' VALUE='" . _('Show Re-Order Levels') . "'><HR>";
29 $sql = "SELECT locstock.loccode,
30 locations.locationname,
35 WHERE locstock.loccode=locations.loccode
36 AND locstock.stockid = '" . $StockID . "'
37 ORDER BY locstock.loccode";
39 $ErrMsg = _('The stock held at each location cannot be retrieved because');
40 $DbgMsg = _('The SQL that failed was');
42 $LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
44 echo "<CENTER><TABLE CELLPADDING=2 BORDER=2>";
47 <TD CLASS='tableheader'>" . _('Location') . "</TD>
48 <TD CLASS='tableheader'>" . _('Quantity On Hand') . "</TD>
49 <TD CLASS='tableheader'>" . _('Re-Order Level') . "</TD>
54 $k=0; //row colour counter
56 while ($myrow=DB_fetch_array($LocStockResult)) {
59 echo "<TR BGCOLOR='#CCCCCC'>";
62 echo "<TR BGCOLOR='#EEEEEE'>";
66 if (isset($_POST['UpdateData']) AND is_numeric($_POST[$myrow['loccode']]) AND $_POST[$myrow['loccode']]>0){
68 $myrow['reorderlevel'] = $_POST[$myrow['loccode']];
69 $sql = 'UPDATE locstock SET reorderlevel = ' . $_POST[$myrow['loccode']] . "
70 WHERE stockid = '" . $StockID . "'
71 AND loccode = '" . $myrow['loccode'] ."'";
72 $UpdateReorderLevel = DB_query($sql, $db);
77 <TD ALIGN=RIGHT>%s</TD>
78 <TD><INPUT TYPE=TEXT NAME=%s MAXLENGTH=10 SIZE=10 VALUE=%s></TD>",
79 $myrow['locationname'],
80 number_format($myrow['quantity']),
82 $myrow['reorderlevel']);
88 //end of page full new headings if
92 echo "</TABLE><INPUT TYPE=SUBMIT NAME='UpdateData' VALUE='" . _('Update') . "'><HR>";
93 echo "<A HREF='$rootpath/StockMovements.php?" . SID
. "&StockID=$StockID'>" . _('Show Stock Movements') . '</A>';
94 echo "<BR><A HREF='$rootpath/StockUsage.php?" . SID
. "&StockID=$StockID'>" . _('Show Stock Usage') . '</A>';
95 echo "<BR><A HREF='$rootpath/SelectSalesOrder.php?" . SID
. "&SelectedStockItem=$StockID'>" . _('Search Outstanding Sales Orders') . '</A>';
96 echo "<BR><A HREF='$rootpath/SelectCompletedOrder.php?" . SID
. "&SelectedStockItem=$StockID'>" . _('Search Completed Sales Orders') . '</A>';
99 include('includes/footer.inc');