From: <Ex...@us...> - 2012-03-22 13:01:33
|
Revision: 5135 http://web-erp.svn.sourceforge.net/web-erp/?rev=5135&view=rev Author: ExsonQu Date: 2012-03-22 13:01:24 +0000 (Thu, 22 Mar 2012) Log Message: ----------- 22/3/2012 Exson: Fixed no control of accumulated quantity of the same item during transferring which lead to negative quantity of stock in StockLocTransfer.php reported by Rong. Modified Paths: -------------- trunk/StockLocTransfer.php Modified: trunk/StockLocTransfer.php =================================================================== --- trunk/StockLocTransfer.php 2012-03-22 12:36:15 UTC (rev 5134) +++ trunk/StockLocTransfer.php 2012-03-22 13:01:24 UTC (rev 5135) @@ -96,6 +96,7 @@ unset($_POST['StockQTY' . $i]); } } + $StockIDAccQty = array(); //set an array to hold all items' quantity for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ if (isset($_POST['Delete' . $i])){ //check box to delete the item is set unset($_POST['StockID' . $i]); @@ -136,6 +137,18 @@ $_POST['LinesCounter'] -= 10; } } + // Check the accumulated quantity for each item + if(isset($StockIDAccQty[$_POST['StockID'.$i]])){ + $StockIDAccQty[$_POST['StockID'.$i]] += filter_number_format($_POST['StockQTY' . $i]); + if($myrow[0] < $StockIDAccQty[$_POST['StockID'.$i]]){ + $InputError = True; + $ErrorMessage .=_('The part code entered of'). ' ' . $_POST['StockID'.$i] . ' '._('does not have enough stock available for transter due to accumulated quantity is over quantity on hand.').'<br />'; + $_POST['LinesCounter'] -= 10; + } + }else{ + $StockIDAccQty[$_POST['StockID'.$i]] = filter_number_format($_POST['StockQTY' . $i]); + } //end of accumulated check + DB_free_result( $result ); $TotalItems++; } @@ -337,4 +350,4 @@ </div>'; include('includes/footer.inc'); } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |