From: Joe Date: Fri, 12 Sep 2014 06:18:10 +0000 (+0200) Subject: CItem Cost Update will also regulate the stock moves standard cost to mirror correct GL. X-Git-Tag: 2.3-final~115 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=84ebe8b3ebc1fc3e6508d75a4f39ce4a868b0b14;p=fa-stable.git CItem Cost Update will also regulate the stock moves standard cost to mirror correct GL. --- diff --git a/inventory/includes/db/items_trans_db.inc b/inventory/includes/db/items_trans_db.inc index a7591dd3..d1e06ea2 100644 --- a/inventory/includes/db/items_trans_db.inc +++ b/inventory/includes/db/items_trans_db.inc @@ -64,6 +64,7 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co add_gl_trans_std_cost(ST_COSTUPDATE, $update_no, $date_, $stock_gl_code["inventory_account"], 0, 0, $memo_, $value_of_change); + change_stock_moves_std_cost($stock_id, $date_, $new_cost - $last_cost); } } @@ -76,4 +77,11 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co //------------------------------------------------------------------------------------------------------------- +function change_stock_moves_std_cost($stock_id, $date, $diff_cost) +{ + $date = date2sql($date); + $sql = "UPDATE ".TB_PREF."stock_moves SET standard_cost = standard_cost + ".db_escape($diff_cost). " WHERE stock_id = " + . db_escape($stock_id)." AND tran_date <= '$date' AND qty <> 0 AND standard_cost > 0.001 AND type <> ".ST_LOCTRANSFER; + db_query($sql,"The stock moves cost details for the inventory item could not be updated"); +} ?> \ No newline at end of file