+ update_average_material_cost(null, $stock_id, $standard_cost, $quantity, $date_);
+
+ if (is_fixed_asset($mb_flag)) {
+ $sql = "UPDATE ".TB_PREF."stock_master SET inactive=1
+ WHERE stock_id=".db_escape($stock_id);
+ db_query($sql,"The inactive flag for the fixed asset could not be updated");
+ }
+
+ add_stock_move(ST_INVADJUST, $stock_id, $adj_id, $location,
+ $date_, $reference, $quantity, $standard_cost);
+
+ $inv_value = $standard_cost * $quantity;
+ $adj_value = $standard_cost * -($quantity);
+
+ if (is_fixed_asset($mb_flag)) {
+ // get the initial value of the fixed assset.
+ $row = get_fixed_asset_move($stock_id, ST_SUPPRECEIVE);
+ $inv_value = $row['price'] * $quantity;
+ $adj_value = (-($row['price']) + $standard_cost) * $quantity;
+ }
+
+ if ($standard_cost > 0 || is_fixed_asset($mb_flag))