X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fincludes%2Fdb%2Fgrn_db.inc;h=756c972fecb5d3f59b6daa7e378999430b263e56;hb=171074993d8f6768cde0626697abd6b4eab732a6;hp=bb24300a945808e279d98b897c43f1dec77c66f4;hpb=eeb82d4707125d5d98916ec846d0d83b605af8b2;p=fa-stable.git diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index bb24300a..756c972f 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -13,7 +13,12 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, $result = db_query($sql); $myrow = db_fetch($result); $material_cost = $myrow['material_cost']; - $qoh = get_qoh_on_date($stock_id, null, $date); + if ($adj_only) + $exclude = 13; + else + $exclude = 0; + $qoh = get_qoh_on_date($stock_id, null, $date, $exclude); + if ($qoh + $qty <= 0) $material_cost = 0; else @@ -69,7 +74,6 @@ function add_grn(&$po, $date_, $reference, $location) $order_line->standard_cost, $order_line->receive_qty, $order_line->price); /* Update location stock records - NB a po cannot be entered for a service/kit parts */ - add_stock_move(25, $order_line->stock_id, $grn, $location, $date_, "", $order_line->receive_qty, $order_line->standard_cost, $po->supplier_id, 1, $order_line->price);