|
From: <ex...@us...> - 2016-07-27 10:10:06
|
Revision: 7576
http://sourceforge.net/p/web-erp/reponame/7576
Author: exsonqu
Date: 2016-07-27 10:10:03 +0000 (Wed, 27 Jul 2016)
Log Message:
-----------
27/07/16 Exson: Add cost update date for material cost in WorkOrderCosting.php and WorkOrderIssue.php
Modified Paths:
--------------
trunk/WorkOrderCosting.php
trunk/WorkOrderIssue.php
trunk/doc/Change.log
Modified: trunk/WorkOrderCosting.php
===================================================================
--- trunk/WorkOrderCosting.php 2016-07-27 09:27:05 UTC (rev 7575)
+++ trunk/WorkOrderCosting.php 2016-07-27 10:10:03 UTC (rev 7576)
@@ -413,14 +413,18 @@
$Result = DB_query($SQL,$ErrMsg,$DbgMsg,true);
}
+ if ($TotalOnHand>0) {//to avoid negative quantity make cost data abnormal
+ $NewCost = $WORow['currcost'] +(-$TotalVariance * $ShareProportion *$ProportionOnHand)/$TotalOnHand;
+ } else {
+ $NewCost = $WORow['currcost'];
+ }
- $NewCost = $WORow['currcost'] +(-$TotalVariance * $ShareProportion *$ProportionOnHand)/$TotalOnHand;
-
$SQL = "UPDATE stockmaster SET
materialcost='" . $NewCost . "',
labourcost=0,
overheadcost=0,
- lastcost='" . $WORow['currcost'] . "'
+ lastcost='" . $WORow['currcost'] . "',
+ lastcostupdate = '" . Date('Y-m-d') . "'
WHERE stockid='" . $WORow['stockid'] . "'";
$ErrMsg = _('The cost details for the stock item could not be updated because');
@@ -515,9 +519,9 @@
} // end loop around the items on the work order
$CloseWOResult =DB_query("UPDATE workorders SET closed=1, closecomments = '". $_POST['CloseComments'] ."' WHERE wo='" .$_POST['WO'] . "'",
- _('Could not update the work order to closed because:'),
- _('The SQL used to close the work order was:'),
- true);
+ _('Could not update the work order to closed because:'),
+ _('The SQL used to close the work order was:'),
+ true);
$DeleteAnyWOSerialNos = DB_query("DELETE FROM woserialnos WHERE wo='" . $_POST['WO'] . "'",
_('Could not delete the predefined work order serial numbers'),
_('The SQL used to delete the predefined serial numbers was:'),
@@ -550,7 +554,6 @@
echo '<tr>
<td colspan="9">
-
<div class="centre">
<textarea ' . $ReadOnly . ' style="width:100%" rows="5" cols="80" name="CloseComments" >' . $_POST['CloseComments'] . '</textarea>
</div>
Modified: trunk/WorkOrderIssue.php
===================================================================
--- trunk/WorkOrderIssue.php 2016-07-27 09:27:05 UTC (rev 7575)
+++ trunk/WorkOrderIssue.php 2016-07-27 10:10:03 UTC (rev 7576)
@@ -87,10 +87,10 @@
$Result = DB_query($SQL);
$IssueItemRow = DB_fetch_array($Result);
//now lets get the decimalplaces needed
- if ($IssueItemRow['decimalplaces'] <=4) {
+ if ($IssueItemRow['decimalplaces'] <=3) {
$VarianceAllowed = 0.0001;
} else {
- $VarianceAllowed = pow(10,-$IssueItemRow['decimalplaces']);
+ $VarianceAllowed = pow(10,-(1+$IssueItemRow['decimalplaces']));
}
$QuantityIssued =0;
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2016-07-27 09:27:05 UTC (rev 7575)
+++ trunk/doc/Change.log 2016-07-27 10:10:03 UTC (rev 7576)
@@ -1,4 +1,6 @@
webERP Change Log
+
+27/07/16 Exson: Add cost update date for material cost in WorkOrderCosting.php and WorkOrderIssue.php.
27/07/16 Exson: Fixed the typo in Credit_Invoice.php introduced in previous update.
27/07/16 Exson: Fixed the divided by zero error when discount is 100% in SelectOrderItems.php.
27/07/16 Exson: Add error proof to avoid a blank credit note issued without any items credited or freight charge input in Credit_Invoice.php.
|