X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=manufacturing%2Fincludes%2Fdb%2Fwork_order_produce_items_db.inc;h=6676549cafa82f62717bc17b686a7848ed6fe3df;hb=4a66afcbed7fb883d00c1a6a807497ccfd181378;hp=8c3f8d073898da2fe1c3013ef36dbe15216def49;hpb=46d3debec422c5ad5ee99c4acfe42bfa60308afb;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 8c3f8d07..6676549c 100644 --- a/manufacturing/includes/db/work_order_produce_items_db.inc +++ b/manufacturing/includes/db/work_order_produce_items_db.inc @@ -1,5 +1,14 @@ . +***********************************************************************/ function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo) { begin_transaction(); @@ -22,24 +31,30 @@ function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo) $date = date2sql($date_); $sql = "INSERT INTO ".TB_PREF."wo_manufacture (workorder_id, reference, quantity, date_) - VALUES ($woid, ".db_quote($ref).", $quantity, '$date')"; + VALUES ($woid, ".db_escape($ref).", $quantity, '$date')"; db_query($sql,"A work order manufacture could not be added"); $id = db_insert_id(); + // ------------------------------------------------------------------------- + + work_order_quick_costs($woid, $details["stock_id"], $quantity, $date_, true); + + // ------------------------------------------------------------------------- // insert a +ve stock move for the item being manufactured // negative means "unproduce" or unassemble add_stock_move(29, $details["stock_id"], $id, $details["loc_code"], $date_, $memo_, $quantity, 0); - // update wo quantity and close wo if requested work_order_update_finished_quantity($woid, $quantity, $close_wo); + if ($memo_) add_comments(29, $id, $date_, $memo_); - references::save_last($ref, 29); + references::save(29, $id, $ref); + add_audit_trail(29, $id, $date_, _("Production.")); commit_transaction(); }