I noticed the field standard cost is always 0 in Stock Adjustments.
Here is a fix to the code in StockAdjustments.php.
Code:
$SQL = "INSERT INTO stockmoves (stockid,
type,
transno,
loccode,
trandate,
prd,
reference,
qty,
newqoh,
standardcost) //add this line
VALUES (
'" . $_SESSION['Adjustment' . $identifier]->StockID . "',
17,
'" . $AdjustmentNumber . "',
'" . $_SESSION['Adjustment' . $identifier]->StockLocation . "',
'" . $SQLAdjustmentDate . "',
'" . $PeriodNo . "',
'" . $_SESSION['Adjustment' . $identifier]->Narrative ."',
'" . $_SESSION['Adjustment' . $identifier]->Quantity . "',
'" . ($QtyOnHandPrior + $_SESSION['Adjustment' . $identifier]->Quantity) . "',
'" . $_SESSION['Adjustment' . $identifier]->StandardCost . "' //add this line
)";
Also, here is a query to show those stockmoves that need to be updated by using he standard cost ast the time from the gltrans record (Either via a script or manually)
SELECT stockmoves.stockid, description, qty, transno, amount, stockmaster.materialcost, ABS( amount / qty ) AS estcost, stockmoves.standardcost, gltrans.narrative
FROM `stockmoves`
INNER JOIN stockmaster ON stockmaster.stockid = stockmoves.stockid
INNER JOIN gltrans ON gltrans.type = stockmoves.type
AND gltrans.typeno = stockmoves.transno
WHERE standardcost =0
AND stockmoves.type =17
AND amount IS NOT NULL
AND amount <0;