X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fincludes%2Fdb%2Fgrn_db.inc;h=4d85cc9fc8f9c8cd710c7e58d64f9884aabe02b5;hb=107a22ab168c1102f3f534a22cd5b8290331f17d;hp=f5bbf4ac8a0e993004cc085621eb97fafaefcd6c;hpb=83fb88b589117b11041f8508cee54d070c93e756;p=fa-stable.git diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index f5bbf4ac..4d85cc9f 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -12,11 +12,6 @@ //------------------- update average material cost ------------------------------------------ Joe Hunt Mar-03-2008 function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, $adj_only=false) { - //Handle if inventory will become negative - //8-OCT-2011 : Skip negative inventory adjustment for case of adjust_only - if (is_inventory_item($stock_id) && !$adj_only) - handle_negative_inventory($stock_id, $qty, $price, $date); - // probably this function should be optimized // passing transaction cart as argument. This would // save a couple of db calls like get_supplier() @@ -40,6 +35,11 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, $price_in_home_currency = $price; $price_in_home_currency_ = $price_in_home_currency; + + //Handle if inventory will become negative + //8-OCT-2011 : Skip negative inventory adjustment for case of adjust_only + if (is_inventory_item($stock_id) && !$adj_only) + handle_negative_inventory($stock_id, $qty, $price_in_home_currency, $date); $sql = "SELECT mb_flag, material_cost, labour_cost, overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id=".db_escape($stock_id); $result = db_query($sql);