From: <Ex...@us...> - 2012-02-15 04:46:25
|
Revision: 4899 http://web-erp.svn.sourceforge.net/web-erp/?rev=4899&view=rev Author: ExsonQu Date: 2012-02-15 04:46:19 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Fix bug that missing GLtrans records while directly input stock Code while do stock adjustment and round amount for gltrans and add EnsureGLEntriesBalance check. Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-02-14 20:40:12 UTC (rev 4898) +++ trunk/StockAdjustments.php 2012-02-15 04:46:19 UTC (rev 4899) @@ -49,6 +49,36 @@ $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID'])); $StockID = trim(mb_strtoupper($_POST['StockID'])); } + //Get item data + $result = DB_query("SELECT description, + controlled, + serialised, + decimalplaces, + perishable + FROM stockmaster + WHERE stockid=' " . $_SESSION['Adjustment']->StockID . "'",$db); + $myrow = DB_fetch_array($result); + $_SESSION['Adjustment']->ItemDescription = $myrow['description']; + $_SESSION['Adjustment']->Controlled = $myrow['controlled']; + $_SESSION['Adjustment']->Serialised = $myrow['serialised']; + $_SESSION['Adjustment']->DecimalPlaces = $myrow['decimalplaces']; + DB_free_result($result); + + $sql="SELECT materialcost, + labourcost, + overheadcost, + units, + decimalplaces + FROM stockmaster + WHERE stockid='".$_SESSION['Adjustment']->StockID . "'"; + + $result=DB_query($sql, $db); + $myrow=DB_fetch_array($result); + $_SESSION['Adjustment']->PartUnit=$myrow['units']; + $_SESSION['Adjustment']->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; + $DecimalPlaces = $myrow['decimalplaces']; + DB_free_result($result); + $_SESSION['Adjustment']->tag = $_POST['tag']; $_SESSION['Adjustment']->Narrative = $_POST['Narrative']; $_SESSION['Adjustment']->StockLocation = $_POST['StockLocation']; @@ -272,7 +302,7 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['adjglact'] . "', - '" . $_SESSION['Adjustment']->StandardCost * -($_SESSION['Adjustment']->Quantity) . "', + '" . round($_SESSION['Adjustment']->StandardCost * -($_SESSION['Adjustment']->Quantity), $_SESSION['CompanyRecord']['decimalplaces']) . "', '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', '" . $_SESSION['Adjustment']->tag . "' @@ -295,7 +325,7 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', - '" . $_SESSION['Adjustment']->StandardCost * $_SESSION['Adjustment']->Quantity . "', + '" . round($_SESSION['Adjustment']->StandardCost * $_SESSION['Adjustment']->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . "', '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', '" . $_SESSION['Adjustment']->tag . "' )"; @@ -304,6 +334,8 @@ $DbgMsg = _('The following SQL to insert the GL entries was used'); $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); } + + EnsureGLEntriesBalance(17, $AdjustmentNumber,$db); $Result = DB_Txn_Commit($db); @@ -334,7 +366,6 @@ $StockID = $_SESSION['Adjustment']->StockID; $Controlled = $_SESSION['Adjustment']->Controlled; $Quantity = $_SESSION['Adjustment']->Quantity; - $sql="SELECT materialcost, labourcost, overheadcost, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |