Skip to content

Commit 0766392

Browse files
committed
Update the lastcostupdate field on cost update
Fixes #743 Files changed in commit: SupplierCredit.php SupplierInvoice.php
1 parent 262d961 commit 0766392

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

SupplierCredit.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -939,13 +939,16 @@
939939
$CostIncrement = ($PurchPriceVar - $WriteOffToVariances) / $TotalQuantityOnHand;
940940

941941
$SQL = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost,
942-
materialcost=materialcost-" . $CostIncrement . "
942+
materialcost=materialcost-" . $CostIncrement . ",
943+
lastcostupdate=CURRENT_DATE
943944
WHERE stockid='" . $EnteredGRN->ItemCode . "'";
944945

945946
$Result = DB_query($SQL, $ErrMsg, '', true);
946947
} else {
947948
$SQL = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost,
948-
materialcost=" . ($EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate) . " WHERE stockid='" . $EnteredGRN->ItemCode . "'";
949+
materialcost=" . ($EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate) . ",
950+
lastcostupdate=CURRENT_DATE
951+
WHERE stockid='" . $EnteredGRN->ItemCode . "'";
949952
$Result = DB_query($SQL, $ErrMsg, '', true);
950953
}
951954
/* End of Weighted Average Costing Code */

SupplierInvoice.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,15 +1694,16 @@
16941694

16951695
$SQL = "UPDATE stockmaster
16961696
SET lastcost=materialcost+overheadcost+labourcost,
1697-
materialcost=materialcost+" . $CostIncrement . "
1697+
materialcost=materialcost+" . $CostIncrement . ", lastcostupdate = CURRENT_DATE
16981698
WHERE stockid='" . $EnteredGRN->ItemCode . "'";
16991699
$Result = DB_query($SQL, $ErrMsg, '', true);
17001700
}
17011701
else {
17021702
/* if stock is negative then update the cost to this cost */
17031703
$SQL = "UPDATE stockmaster
17041704
SET lastcost=materialcost+overheadcost+labourcost,
1705-
materialcost='" . $ActualCost . "'
1705+
materialcost='" . $ActualCost . "',
1706+
lastcostupdate = CURRENT_DATE
17061707
WHERE stockid='" . $EnteredGRN->ItemCode . "'";
17071708
$Result = DB_query($SQL, $ErrMsg, '', true);
17081709
}

0 commit comments

Comments
 (0)