projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added two new helpers date_comp, sql_date_comp.
[fa-stable.git]
/
manufacturing
/
includes
/
db
/
work_orders_quick_db.inc
diff --git
a/manufacturing/includes/db/work_orders_quick_db.inc
b/manufacturing/includes/db/work_orders_quick_db.inc
index 5654caeb3d70ad07c38a6e616a98b0a5b2c42844..1ce76932a61ee06994b454edd6ae8dcdc9117460 100644
(file)
--- a/
manufacturing/includes/db/work_orders_quick_db.inc
+++ b/
manufacturing/includes/db/work_orders_quick_db.inc
@@
-66,10
+66,25
@@
function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type,
db_query($sql, "The work order requirements could not be added");
// insert a -ve stock move for each item
db_query($sql, "The work order requirements could not be added");
// insert a -ve stock move for each item
+ $UnitCost = get_standard_cost($bom_item["component"]);
add_stock_move(ST_WORKORDER, $bom_item["component"], $woid,
add_stock_move(ST_WORKORDER, $bom_item["component"], $woid,
- $bom_item["loc_code"], $date_, $wo_ref, -$item_quantity,
0
);
+ $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;
+ }
+
+ //Negative Stock Handling First; Prior to add_stock_move
+ if ($cost_adjust)
+ adjust_deliveries($stock_id, get_standard_cost($stock_id), $date_);
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
@@
-123,6
+138,7
@@
function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced
$memo, -$bom_cost);
}
$memo, -$bom_cost);
}
+ $item_accounts = get_stock_gl_code($stock_id);
if ($advanced)
{
$wo = get_work_order($woid);
if ($advanced)
{
$wo = get_work_order($woid);
@@
-151,7
+167,6
@@
function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced
} else { // only for quick
// credit additional costs
} else { // only for quick
// credit additional costs
- $item_accounts = get_stock_gl_code($stock_id);
if ($costs != 0.0)
{
if ($costs != 0.0)
{
@@
-175,4
+190,3
@@
function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
-?>
\ No newline at end of file