+ $cart->memo_ = sprintf(_("Cost was %s changed to %s x quantity on hand of %s"),
+ number_format2($last_cost, 2), number_format2($new_cost), $qoh);
+
+ $cart->add_gl_item($stock_gl_code["adjustment_account"],
+ $stock_gl_code["dimension_id"], $stock_gl_code["dimension2_id"], -$value_of_change);
+ $cart->add_gl_item($stock_gl_code["inventory_account"], 0, 0, $value_of_change);
+
+ write_journal_entries($cart);
+ change_stock_moves_std_cost($stock_id, $date_, $new_cost - $last_cost);
+ }
+ }
+
+ if ($update_no != -1)
+ add_audit_trail(ST_COSTUPDATE, $update_no, $date_);