X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=manufacturing%2Fincludes%2Fdb%2Fwork_order_produce_items_db.inc;h=cdbd81c0a500d1448aac12ca1c70b09923758919;hb=6ca1979dd3d94414a18958346bcb39b984f7a544;hp=44c93b864d0392bf07dc5bca3562e4e70e4caf7b;hpb=95ff74b5722826544743a01daf527aa3c9efe11a;p=fa-stable.git diff --git a/manufacturing/includes/db/work_order_produce_items_db.inc b/manufacturing/includes/db/work_order_produce_items_db.inc index 44c93b86..cdbd81c0 100644 --- a/manufacturing/includes/db/work_order_produce_items_db.inc +++ b/manufacturing/includes/db/work_order_produce_items_db.inc @@ -81,10 +81,11 @@ function work_order_produce($woid, $ref, $quantity, $date_, $memo, $close_wo) $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) @@ -160,7 +161,7 @@ function void_work_order_produce($type_no) 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);