From: <ex...@us...> - 2016-09-04 06:02:27
|
Revision: 7609 http://sourceforge.net/p/web-erp/reponame/7609 Author: exsonqu Date: 2016-09-04 06:02:25 +0000 (Sun, 04 Sep 2016) Log Message: ----------- 04/09/16 Exson: Fixed the bug that work order location will be wrong when user select location which is not user's default location. Modified Paths: -------------- trunk/WorkOrderEntry.php Modified: trunk/WorkOrderEntry.php =================================================================== --- trunk/WorkOrderEntry.php 2016-09-04 01:37:10 UTC (rev 7608) +++ trunk/WorkOrderEntry.php 2016-09-04 06:02:25 UTC (rev 7609) @@ -279,7 +279,8 @@ if ($InputError==false){ - $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost + $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost, + bom.loccode FROM stockmaster INNER JOIN bom ON stockmaster.stockid=bom.component @@ -315,7 +316,7 @@ $result = DB_query($SQL,$ErrMsg); //Recursively insert real component requirements - see includes/SQL_CommonFunctions.in for function WoRealRequirements - WoRealRequirements($db, $_POST['WO'], $_POST['StockLocation'], $NewItem); + WoRealRequirements($db, $_POST['WO'], $CostRow['loccode'], $NewItem); $result = DB_Txn_Commit(); @@ -382,11 +383,11 @@ } if ($_POST['RecdQty'.$i]==0 AND (!isset($_POST['HasWOSerialNos'.$i]) OR $_POST['HasWOSerialNos'.$i]==false)){ /* can only change location cost if QtyRecd=0 */ - $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost + $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost,bom.loccode FROM stockmaster INNER JOIN bom ON stockmaster.stockid=bom.component WHERE bom.parent='" . $_POST['OutputItem'.$i] . "' - AND bom.loccode='" . $_POST['StockLocation'] . "' + AND bom.loccode=(SELECT loccode FROM workorders WHERE wo='" . $_POST['WO'] . "') AND bom.effectiveafter<='" . Date('Y-m-d') . "' AND bom.effectiveto>='" . Date('Y-m-d') . "'"); $CostRow = DB_fetch_array($CostResult); |