When entering a supplier credit note against a GRN that initially caused a Cost adjustment the system sets the stockmaster.materialcost field incorrectly.
This line in SupplierCredit.php is the same as the SupplierInvoice.php program and it should be multiplied by -1. All other gltrans are created correctly.
PHP Code:
$CostIncrement = ($PurchPriceVar - $WriteOffToVariances) / $TotalQuantityOnHand;
So if you have an item that has a material cost of 1.00 and you enter an invoice that lowers the average cost by .05 you will get a statement like
Code:
UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost,
materialcost=materialcost+-0.05
WHERE stockid='Item#'
And if you enter a Credit you will get the SAME UPDATE statement and the materialcost field will end up being .90.