- add_stock_move(systypes::work_order(), $bom_item["component"], $woid,
- $bom_item["loc_code"], $date_, $wo_ref, -$item_quantity, 0);
+ // Chaitanya: Updated to record price and cost as std_cost for work order issued item
+ $UnitCost = get_standard_cost($bom_item["component"]);
+ add_stock_move(ST_WORKORDER, $bom_item["component"], $woid,
+ $bom_item["loc_code"], $date_, $wo_ref, -$item_quantity, $UnitCost, 0, 1, $UnitCost);
+ }
+
+ // -------------------------------------------------------------------------
+ //Negative Stock Handling
+ $qoh = get_qoh_on_date($stock_id);
+ $cost_adjust = false;
+ if ($qoh < 0)
+ {
+ if ($qoh + $units_reqd >= 0)
+ $cost_adjust = true;