$unit_cost = $total_cost/($product['units_issued']+$quantity);
+ // first update material cost
+ update_material_cost($product['stock_id'], $product['units_issued']+$quantity, $unit_cost, $date_);
+
add_stock_move(ST_WORKORDER, $product["stock_id"], $woid,
$product["loc_code"], $date_, $ref, $product['units_issued']+$quantity, $unit_cost);
-
- update_material_cost($product['stock_id'], $product['units_issued']+$quantity, $unit_cost, $date_);
}
if ($memo)
return;
// deduct the quantity of this production from the parent work order
- work_order_update_finished_quantity($prod["workorder_id"], -$prod["quantity"], false);
+ work_order_update_finished_quantity($prod["workorder_id"], -$prod["quantity"]);
// clear the production record
$sql = "UPDATE ".TB_PREF."wo_manufacture SET quantity=0 WHERE id=".db_escape($type_no);