From: <ex...@us...> - 2014-02-15 02:12:51
|
Revision: 6576 http://sourceforge.net/p/web-erp/reponame/6576 Author: exsonqu Date: 2014-02-15 02:12:46 +0000 (Sat, 15 Feb 2014) Log Message: ----------- 15/2/14 Exson: Make perishable control available in WorkOrderReceive.php. Modified Paths: -------------- trunk/WorkOrderReceive.php Modified: trunk/WorkOrderReceive.php =================================================================== --- trunk/WorkOrderReceive.php 2014-02-14 23:29:14 UTC (rev 6575) +++ trunk/WorkOrderReceive.php 2014-02-15 02:12:46 UTC (rev 6576) @@ -63,6 +63,7 @@ stockmaster.serialised, stockmaster.decimalplaces, stockmaster.units, + stockmaster.perishable, woitems.qtyreqd, woitems.qtyrecd, woitems.stdcost, @@ -112,6 +113,13 @@ } } } //end of lot/batch control + + if (!empty($_POST['ExpiryDate'])){ + if(!is_date($_POST['ExpiryDate'])){ + $InputError = true; + prnMsg(_('The Expiry Date should be in date format'),'error'); + } + } } else { //not controlled - an easy one! if (!is_numeric(filter_number_format($_POST['Qty']))){ $InputError=true; @@ -510,6 +518,23 @@ '" . $_POST['SerialNo' . $i] . "', 1, '" . $QualityText . "')"; + // Store expiry date for perishable product + if(!empty($_POST['ExpiryDate'])){ + + $SQL = "INSERT INTO stockserialitems(stockid, + loccode, + serialno, + quantity, + qualitytext, + expirationdate) + VALUES ('" . $_POST['StockID'] . "', + '" . $_POST['IntoLocation'] . "', + '" . $_POST['SerialNo' . $i] . "', + 1, + '" . $QualityText . "', + '" . FormatDateForSQL($_POST['ExpiryDate']) . "')"; + } + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock item records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -580,6 +605,23 @@ '" . $_POST['BatchRef' . $i] . "', '" . filter_number_format($_POST['Qty'.$i]) . "', '" . $_POST['QualityText'] . "')"; + //If it's a perishable product, add expiry date + + if(!empty($_POST['ExpiryDate'])){ + + $SQL = "INSERT INTO stockserialitems (stockid, + loccode, + serialno, + quantity, + qualitytext, + expirationdate) + VALUES ('" . $_POST['StockID'] . "', + '" . $_POST['IntoLocation'] . "', + '" . $_POST['BatchRef' . $i] . "', + '" . filter_number_format($_POST['Qty'.$i]) . "', + '" . $_POST['QualityText'] . "', + '" . FormatDateForSQL($_POST['ExpiryDate']) . "')"; + } } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock item records was used'); @@ -727,6 +769,7 @@ stockmaster.serialised, stockmaster.decimalplaces, stockmaster.units, + stockmaster.perishable, woitems.qtyreqd, woitems.qtyrecd, woitems.stdcost, @@ -785,8 +828,16 @@ </tr> <tr> <td>' . _('Date Received') . ':</td> - <td>' . Date($_SESSION['DefaultDateFormat']) . '</td> - <td>' . _('Received Into') . ':</td> + <td>' . Date($_SESSION['DefaultDateFormat']) . '</td>'; + //add expiry date for perishable product + if($WORow['perishable']==1){ + echo '<td>' . _('Expiry Date') . ':<td> + <td><input type="text" name="ExpiryDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" + required /> + </td>'; + } + + echo '<td>' . _('Received Into') . ':</td> <td><select name="IntoLocation">'; |