Negative Stock Handling should be prior to add_stock_move
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 11 Jul 2011 09:37:38 +0000 (11:37 +0200)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 11 Jul 2011 09:37:38 +0000 (11:37 +0200)
manufacturing/includes/db/work_orders_quick_db.inc

index e91797ba17ef89edafa0d97f12b28352491d0b1c..9b869d0a1b935d6a94372450e139c3d02c110084 100644 (file)
@@ -83,6 +83,12 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type,
        }
 
        // -------------------------------------------------------------------------
+       
+       //Negative Stock Handling First; Prior to add_stock_move
+       if ($cost_adjust)
+               adjust_deliveries($stock_id, get_standard_cost($stock_id), $date_);
+               
+       // -------------------------------------------------------------------------    
 
        // insert a +ve stock move for the item being manufactured
        add_stock_move(ST_WORKORDER, $stock_id, $woid,  $loc_code, $date_,
@@ -91,12 +97,6 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type,
        // -------------------------------------------------------------------------
 
        work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, 0, $costs, $cr_acc, $labour, $cr_lab_acc);
-
-       // -------------------------------------------------------------------------
-       
-       //Negative Stock Handling
-       if ($cost_adjust)
-               adjust_deliveries($stock_id, get_standard_cost($stock_id), $date_);
                
        //--------------------------------------------------------------------------