From: <ex...@us...> - 2013-12-23 06:46:50
|
Revision: 6512 http://sourceforge.net/p/web-erp/reponame/6512 Author: exsonqu Date: 2013-12-23 06:46:46 +0000 (Mon, 23 Dec 2013) Log Message: ----------- 23/12/13 Exson: Fixed the controlled items cannot be removed due to the negative operator is modified and balance of a serial no is wrong due negative operator is missing during credit controlled items by KEYED method. Other input method has not be inspected. Modified Paths: -------------- trunk/includes/Add_SerialItems.php trunk/includes/InputSerialItemsExisting.php Modified: trunk/includes/Add_SerialItems.php =================================================================== --- trunk/includes/Add_SerialItems.php 2013-12-23 02:11:30 UTC (rev 6511) +++ trunk/includes/Add_SerialItems.php 2013-12-23 06:46:46 UTC (rev 6512) @@ -37,8 +37,8 @@ $AddThisBundle = true; } } - if ($AddThisBundle==true){ - $LineItem->SerialItems[$_POST['SerialNo' . $i]] = new SerialItem ($_POST['SerialNo' . $i], ($InOutModifier>0?1:-1) * filter_number_format($_POST['Qty' . $i])); + if ($AddThisBundle==true){//the $InOutModifier should not appeared here. Otherwise, the users cannot remove the quantity but add it. + $LineItem->SerialItems[$_POST['SerialNo' . $i]] = new SerialItem ($_POST['SerialNo' . $i], ($InOutModifier>0?1:1) * filter_number_format($_POST['Qty' . $i])); } } /*end if ExistingBundleQty >0 */ else { @@ -345,4 +345,4 @@ if (isset($_GET['Delete'])){ unset($LineItem->SerialItems[$_GET['Delete']]); } -?> \ No newline at end of file +?> Modified: trunk/includes/InputSerialItemsExisting.php =================================================================== --- trunk/includes/InputSerialItemsExisting.php 2013-12-23 02:11:30 UTC (rev 6511) +++ trunk/includes/InputSerialItemsExisting.php 2013-12-23 06:46:46 UTC (rev 6512) @@ -45,10 +45,11 @@ $ItemsAvailable++; } } else { + if ( !array_key_exists($myrow['serialno'], $AllSerials) OR ($myrow['quantity'] - $AllSerials[$myrow['serialno']] >= 0) ) { - - $RecvQty = $myrow['quantity'] - $AllSerials[$myrow['serialno']]; + //Use the $InOutModifier to ajust the negative or postive direction of the quantity. Otherwise the calculated quantity is wrong. + $RecvQty = $myrow['quantity'] - $InOutModifier*$AllSerials[$myrow['serialno']]; echo '<option value="' . $myrow['serialno'] . '/|/'. $RecvQty .'">' . $myrow['serialno'].' - ' . _('Qty left'). ': ' . $RecvQty . '</option>'; $ItemsAvailable += $RecvQty; } @@ -65,4 +66,4 @@ echo '<td>' . prnMsg( _('There does not appear to be any of') . ' ' . $StockID . ' ' . _('left in'). ' '. $LocationOut , 'warn') . '</td>'; } echo '</tr></table>'; -} \ No newline at end of file +} |