From: <ex...@us...> - 2013-08-14 09:22:46
|
Revision: 6204 http://sourceforge.net/p/web-erp/reponame/6204 Author: exsonqu Date: 2013-08-14 09:22:43 +0000 (Wed, 14 Aug 2013) Log Message: ----------- 14/8/2013 Exson: fixed the in_array() warning in WorkOrderIssue.php and make it html5 compatible. Modified Paths: -------------- trunk/WorkOrderIssue.php Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2013-08-14 09:03:59 UTC (rev 6203) +++ trunk/WorkOrderIssue.php 2013-08-14 09:22:43 UTC (rev 6204) @@ -808,7 +808,7 @@ echo '<tr> <td><select name="SerialNos[]" multiple="multiple">'; while ($SerialNoRow = DB_fetch_array($SerialNoResult)){ - if (in_array($SerialNoRow['serialno'],$_POST['SerialNos'])){ + if (isset($_POST['SerialNos']) and in_array($SerialNoRow['serialno'],$_POST['SerialNos'])){ echo '<option selected="selected" value="' . $SerialNoRow['serialno'] . '">' . $SerialNoRow['serialno'] . '</option>'; } else { echo '<option value="' . $SerialNoRow['serialno'] . '">' . $SerialNoRow['serialno'] . '</option>'; @@ -827,7 +827,7 @@ for ($i=0;$i<15;$i++){ echo '<tr> <td><input type="text" name="BatchRef' . $i .'" title="' . _('Enter a batch/roll reference being used with this work order') . '" /></td> - <td><input type="number" title="' . _('Enter the quantity of this batch/roll to issue to the work order') . '" name="Qty' . $i .'" value="0" /></td></tr>'; + <td><input class="number" title="' . _('Enter the quantity of this batch/roll to issue to the work order') . '" name="Qty' . $i .'" value="0" /></td></tr>'; } echo '<input type="hidden" name="IssueItem" value="' . $_POST['IssueItem'] . '" />'; echo '<tr> @@ -848,4 +848,4 @@ </form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> |
From: <ex...@us...> - 2014-03-23 12:43:18
|
Revision: 6631 http://sourceforge.net/p/web-erp/reponame/6631 Author: exsonqu Date: 2014-03-23 12:43:12 +0000 (Sun, 23 Mar 2014) Log Message: ----------- 23/03/14 Exson: Fixed the bug that the search results shows only limited to DisplayRecordsMax which does not make sense due to pagination in WorkOrderIssue.php. Modified Paths: -------------- trunk/WorkOrderIssue.php Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2014-03-23 04:23:24 UTC (rev 6630) +++ trunk/WorkOrderIssue.php 2014-03-23 12:43:12 UTC (rev 6631) @@ -463,8 +463,6 @@ } } - $SQL = $SQL . " LIMIT " . $_SESSION['DisplayRecordsMax']; - $ErrMsg = _('There is a problem selecting the part records to display because'); $DbgMsg = _('The SQL used to get the part selection was'); $SearchResult = DB_query($SQL,$db,$ErrMsg, $DbgMsg); |
From: <ex...@us...> - 2014-03-23 14:58:16
|
Revision: 6633 http://sourceforge.net/p/web-erp/reponame/6633 Author: exsonqu Date: 2014-03-23 14:58:12 +0000 (Sun, 23 Mar 2014) Log Message: ----------- 23/03/14 Exson: Fixed the no defined variable bugs in WorkOrderIssue.php. Reported by Tim. Modified Paths: -------------- trunk/WorkOrderIssue.php Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2014-03-23 12:44:33 UTC (rev 6632) +++ trunk/WorkOrderIssue.php 2014-03-23 14:58:12 UTC (rev 6633) @@ -624,8 +624,7 @@ WHERE stockmoves.type=28 AND reference='" . $_POST['WO'] . "' GROUP BY stockid",$db); while($myrow = DB_fetch_array($IssuedAlreadyResult)){ - $IssuedMaterials[$myrow['stockid']]['description'] = $myrow['description']; - $IssuedMaterials[$myrow['stockid']]['total'] = $myrow['total']; + $IssuedMaterials[$myrow['stockid']] = $myrow['total']; } while ($RequirementsRow = DB_fetch_array($RequirmentsResult)){ @@ -639,21 +638,21 @@ <td class="notavailable">' .$RequirementsRow['stockid'] . ' - ' . $RequirementsRow['description'] . '</td>'; } if (isset($IssuedMaterials[$RequirementsRow['stockid']])){ - $IssuedAlreadyRow = $IssuedMaterials[$RequirementsRow['total']]; + $IssuedAlreadyRow = $IssuedMaterials[$RequirementsRow['stockid']]; unset($IssuedMaterials[$RequirementsRow['stockid']]); } else { $IssuedAlreadyRow = 0; } echo '<td class="number">' . locale_number_format($RequirementsRow['quantityrequired'],$RequirementsRow['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($IssuedAlreadyRow[0],$RequirementsRow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($IssuedAlreadyRow,$RequirementsRow['decimalplaces']) . '</td> </tr>'; } /* now to deal with those addtional issues of items not in BOM */ if (count($IssuedMaterials)>0){ $IssuedStocks = implode("','",array_keys($IssuedMaterials)); $sql = "SELECT stockid, - descrption, + description, decimalplaces FROM stockmaster WHERE stockid in ('" . $IssuedStocks . "')"; @@ -664,7 +663,7 @@ <td><input type="submit" name="IssueItem" value="' . $myrow['stockid'] . '" /></td> <td>' . $myrow['stockid'] . ' - ' . $myrow['description'] . '</td> <td class="number">0</td> - <td class="number">' . locale_number_format($IssuedMaterials[$myrow['stockid']]['total'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($IssuedMaterials[$myrow['stockid']],$myrow['decimalplaces']) . '</td> </tr>'; } |
From: <ex...@us...> - 2015-03-13 02:30:15
|
Revision: 7221 http://sourceforge.net/p/web-erp/reponame/7221 Author: exsonqu Date: 2015-03-13 02:30:07 +0000 (Fri, 13 Mar 2015) Log Message: ----------- 13/03/15 Exson: Make Labor type allowed by category select in WorkOrderIssue.php. Modified Paths: -------------- trunk/WorkOrderIssue.php Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2015-03-12 01:04:06 UTC (rev 7220) +++ trunk/WorkOrderIssue.php 2015-03-13 02:30:07 UTC (rev 7221) @@ -77,7 +77,7 @@ $InputError=true; } $QuantityIssued =0; - if (is_array($_POST['SerialNos'])){ //then we are issuing a serialised item + if (isset($_POST['SerialNos']) AND is_array($_POST['SerialNos'])){ //then we are issuing a serialised item $QuantityIssued = count($_POST['SerialNos']); // the total quantity issued as 1 per serial no } elseif (isset($_POST['Qty'])){ //then its a plain non-controlled item $QuantityIssued = filter_number_format($_POST['Qty']); @@ -705,7 +705,7 @@ $SQL="SELECT categoryid, categorydescription FROM stockcategory - WHERE stocktype='F' OR stocktype='D' + WHERE stocktype='F' OR stocktype='D' OR stocktype='L' ORDER BY categorydescription"; $result1 = DB_query($SQL); @@ -902,4 +902,4 @@ </form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> |
From: <ex...@us...> - 2016-01-07 10:15:36
|
Revision: 7437 http://sourceforge.net/p/web-erp/reponame/7437 Author: exsonqu Date: 2016-01-07 10:15:33 +0000 (Thu, 07 Jan 2016) Log Message: ----------- 01/07/16 Exson: Fixed the lot control items negative not allowed problem and fix the data storage caused precision error which make material issuing is impossible under some situation in WorkOrderIssue.php. Modified Paths: -------------- trunk/WorkOrderIssue.php Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2016-01-04 00:16:55 UTC (rev 7436) +++ trunk/WorkOrderIssue.php 2016-01-07 10:15:33 UTC (rev 7437) @@ -76,20 +76,43 @@ prnMsg(_('The work order is closed - no more materials or components can be issued to it.'),'error'); $InputError=true; } + //Need to get the current standard cost for the item being issued + $SQL = "SELECT materialcost+labourcost+overheadcost AS cost, + controlled, + serialised, + decimalplaces, + mbflag + FROM stockmaster + WHERE stockid='" .$_POST['IssueItem'] . "'"; + $Result = DB_query($SQL); + $IssueItemRow = DB_fetch_array($Result); + //now lets get the decimalplaces needed + if ($IssueItemRow['decimalplaces'] <=4) { + $VarianceAllowed = 0.0001; + } else { + $VarianceAllowed = pow(10,-$IssueItemRow['decimalplaces']); + } + $QuantityIssued =0; if (isset($_POST['SerialNos']) AND is_array($_POST['SerialNos'])){ //then we are issuing a serialised item $QuantityIssued = count($_POST['SerialNos']); // the total quantity issued as 1 per serial no } elseif (isset($_POST['Qty'])){ //then its a plain non-controlled item $QuantityIssued = filter_number_format($_POST['Qty']); } else { //it must be a batch/lot controlled item - for ($i=0;$i<15;$i++){ - if (mb_strlen($_POST['Qty'.$i])>0){ + if (!isset($_POST['LotCounter']) OR !is_numeric($_POST['LotCounter'])) { + $InputError = true; + prnMsg(_('The line counter is not set up or not numeric, please ask administrator for help'),'error'); + include('include/footer.inc'); + exit; + } + for ($i=0;$i<$_POST['LotCounter'];$i++){ + if (mb_strlen($_POST['Qty'.$i])>0 AND $_POST['Qty'.$i] != 0){ if (!is_numeric(filter_number_format($_POST['Qty'.$i]))){ $InputError=1; } else { $QuantityIssued += filter_number_format($_POST['Qty'.$i]); - if ($_SESSION['ProhibitNegativeStock']==1 and $_POST['BatchRef'.$i] > "") { + if ($_SESSION['ProhibitNegativeStock']==1 AND $_POST['BatchRef'.$i] > "" AND $_POST['Qty' . $i]>0) { $SQL = "SELECT quantity from stockserialitems WHERE (stockid= '" . $_POST['IssueItem'] . "') AND (loccode = '" . $_POST['FromLocation'] . "') AND (serialno = '" . $_POST['BatchRef'.$i] . "')"; @@ -101,7 +124,7 @@ } else { $CheckLotRow = DB_fetch_row($Result); - if ($CheckLotRow[0]<$_POST['Qty'.$i]){ + if (($_POST['Qty'.$i]-$CheckLotRow[0])>$VarianceAllowed){ $InputError = true; prnMsg(_('This issue cannot be processed because the system parameter is set to prohibit negative stock and this issue would result in this batch going into negative. Please correct the stock first before attempting another issue'),'error'); } @@ -113,16 +136,8 @@ }//end for the 15 fields available for batch/lot entry }//end batch/lot controlled item - //Need to get the current standard cost for the item being issued - $SQL = "SELECT materialcost+labourcost+overheadcost AS cost, - controlled, - serialised, - mbflag - FROM stockmaster - WHERE stockid='" .$_POST['IssueItem'] . "'"; - $Result = DB_query($SQL); - $IssueItemRow = DB_fetch_array($Result); + if ($IssueItemRow['cost']==0){ prnMsg(_('The item being issued has a zero cost. The issue will still be processed '),'warn'); } @@ -136,7 +151,7 @@ AND loccode ='" . $_POST['FromLocation'] . "'"; $CheckNegResult = DB_query($SQL); $CheckNegRow = DB_fetch_row($CheckNegResult); - if ($CheckNegRow[0]<$QuantityIssued){ + if (($QuantityIssued-$CheckNegRow[0])>$VarianceAllowed){ $InputError = true; prnMsg(_('This issue cannot be processed because the system parameter is set to prohibit negative stock and this issue would result in stock going into negative. Please correct the stock first before attempting another issue'),'error'); } @@ -167,6 +182,9 @@ if (DB_num_rows($Result)==1){ $LocQtyRow = DB_fetch_row($Result); $NewQtyOnHand = ($LocQtyRow[0] - $QuantityIssued); + if ($NewQtyOnHand < $VarianceAllowed) { + $NewQtyOnHand = 0; + } } else { /*There must actually be some error this should never happen */ $NewQtyOnHand = 0; @@ -254,7 +272,7 @@ } //end for all of the potential serialised entries in the multi select box } else { //the item is just batch/lot controlled not serialised /*the form for entry of batch controlled items is only 15 possible fields */ - for($i=0;$i<15;$i++){ + for($i=0;$i<$_POST['LotCounter'];$i++){ /* We need to add the StockSerialItem record and The StockSerialMoves as well */ //need to test if the batch/lot exists first already @@ -269,12 +287,16 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); $AlreadyExistsRow = DB_fetch_row($Result); - if ($AlreadyExistsRow[0]>0){ - $SQL = "UPDATE stockserialitems SET quantity = quantity - " . $_POST['Qty' . $i] . " + if ($AlreadyExistsRow[0]>0 AND $_POST['Qty'.$i] != 0){ + $SQL = "UPDATE stockserialitems SET quantity = CASE + WHEN abs(quantity -" . $_POST['Qty' . $i] . ")<" . $VarianceAllowed . " + THEN 0 + ELSE quantity - " . $_POST['Qty' . $i] . " + END WHERE stockid='" . $_POST['IssueItem'] . "' AND loccode = '" . $_POST['FromLocation'] . "' AND serialno = '" . $_POST['BatchRef' .$i] . "'"; - } else { + } elseif ($_POST['Qty'.$i] != 0) { $SQL = "INSERT INTO stockserialitems (stockid, loccode, serialno, @@ -294,7 +316,8 @@ /** end of handle stockserialitems records */ /** now insert the serial stock movement **/ - $SQL = "INSERT INTO stockserialmoves (stockmoveno, + if ($_POST['Qty'.$i]!=0) { + $SQL = "INSERT INTO stockserialmoves (stockmoveno, stockid, serialno, moveqty) @@ -302,9 +325,10 @@ '" . $_POST['IssueItem'] . "', '" . $_POST['BatchRef'.$i] . "', '" . filter_number_format($_POST['Qty'.$i])*-1 . "')"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); - $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); - $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); + $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); + $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); + } }//non blank BundleRef } //end for all 15 of the potential batch/lot fields received } //end of the batch controlled stuff @@ -382,7 +406,7 @@ unset($_POST['FromLocation']); unset($_POST['Process']); unset($_POST['SerialNos']); - for ($i=0;$i<15;$i++){ + for ($i=0;$i<$_POST['LotCounter'];$i++){ unset($_POST['BatchRef'.$i]); unset($_POST['Qty'.$i]); } @@ -878,10 +902,40 @@ echo '<tr> <th colspan="2">' . _('Batch/Lots Issued') . '</th> </tr>'; - for ($i=0;$i<15;$i++){ + $LotNoSQL = "SELECT serialno,quantity + FROM stockserialitems + WHERE stockid='" . $_POST['IssueItem'] . "' + AND loccode='" . $_POST['FromLocation'] . "' + AND quantity > 0"; + $ErrMsg = _('Failed to retrieve lot No'); + $LotResult = DB_query($LotNoSQL,$ErrMsg); + if (DB_num_rows($LotResult)>0) { + $i = 0; + while($LotRow = DB_fetch_array($LotResult)) { + echo '<tr> + <td><input type="text" name="BatchRef' . $i .'" title="' . _('Enter a batch/roll reference being used with this work order') . '" value="' . $LotRow['serialno'] . '" /></td> + <td><input class="number" title="' . _('Enter the quantity of this batch/roll to issue to the work order') . '" name="Qty' . $i .'" placeholder="' . $LotRow['quantity'] . '" /></td> + </tr>'; + $i++; + } + echo '<input type="hidden" name="LotCounter" value="' . $i . '" />'; + } else { echo '<tr> - <td><input type="text" name="BatchRef' . $i .'" title="' . _('Enter a batch/roll reference being used with this work order') . '" /></td> - <td><input class="number" title="' . _('Enter the quantity of this batch/roll to issue to the work order') . '" name="Qty' . $i .'" value="0" /></td></tr>'; + <td>' . _('There are no serial numbers at this location to issue') . '</td> + </tr>'; + echo '<tr> + <td colspan="2"><div class="centre"><input type="submit" name="Retry" value="' . _('Reselect Location or Issued Item') . '" /></td> + </tr>'; + $i=0; + echo '<tr> + <td colspan="4">' . _('You may need to receive (input negative quantity) some items whose serial no has never existed by following') . '</td> + </tr>'; + echo '<tr> + <td colspan="2">' . _('Lot No') .': <input type="text" name="BatchRef' . $i .'" title="' . _('Enter a batch/roll reference being used with this work order') . '" value="" /> + <td colspan="2">' . _('Quantity') . ': <input class="number" title="' . _('Enter the quantity of this batch/roll to issue to the work order') . '" name="Qty' . $i .'" /></td> + </tr>'; + $i++; + echo '<input type="hidden" name="LotCounter" value="' . $i . '" />'; } echo '<input type="hidden" name="IssueItem" value="' . $_POST['IssueItem'] . '" />'; echo '<tr> |