From: Joe Hunt Date: Tue, 2 Sep 2008 22:24:49 +0000 (+0000) Subject: Bug [0000043] Inventory Adjustment Session doesn't update standard cost X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=2931968b383abd56395befea73e8ae0455d3964d;p=textcart.git Bug [0000043] Inventory Adjustment Session doesn't update standard cost Bug [0000044]Standard Cost error on credit note --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 388f1a3..b796eaa 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,13 @@ Legend: ! -> Note $ -> Affected files +03-Sep-2008 Joe Hunt +# Bug [0000043] Inventory Adjustment Session doesn't update standard cost +# Bug [0000044]Standard Cost error on credit note +$ /inventory/includes/db/items_adjust_db.inc + /purchasing/includes/db/grn_db.inc + /purchasing/includes/invoice_db.inc + 02-Sep-2008 Joe Hunt # Bug when selecting report, List of Journal Entries, by type. Nothing selected. $ /reporting/includes/reports_classes.inc diff --git a/inventory/includes/db/items_adjust_db.inc b/inventory/includes/db/items_adjust_db.inc index bab75ba..bd85f6c 100644 --- a/inventory/includes/db/items_adjust_db.inc +++ b/inventory/includes/db/items_adjust_db.inc @@ -74,6 +74,7 @@ function add_stock_adjustment_item($adj_id, $stock_id, $location, $date_, $type, add_gl_trans_std_cost(systypes::inventory_adjustment(), $adj_id, $date_, $stock_gl_codes['inventory_account'], 0, 0, $memo_, ($standard_cost * $quantity)); } + update_average_material_cost(null, $stock_id, $standard_cost, $quantity, $date_); } //------------------------------------------------------------------------------------------------------------- diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index 756c972..8bd47b4 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -4,7 +4,10 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, $adj_only=false) { - $currency = get_supplier_currency($supplier); + if ($supplier != null) + $currency = get_supplier_currency($supplier); + else + $currency = null; if ($currency != null) $price_in_home_currency = to_home_currency($price, $currency, $date); else diff --git a/purchasing/includes/db/invoice_db.inc b/purchasing/includes/db/invoice_db.inc index 014e5ce..a743106 100644 --- a/purchasing/includes/db/invoice_db.inc +++ b/purchasing/includes/db/invoice_db.inc @@ -170,6 +170,8 @@ function add_supp_invoice($supp_trans) // do not receive as ref because we chang if (!$supp_trans->is_invoice) { $entered_grn->this_quantity_inv = -$entered_grn->this_quantity_inv; + update_average_material_cost($supp_trans->supplier_id, $entered_grn->item_code, + $entered_grn->chg_price, $entered_grn->this_quantity_inv, $date_); } $line_taxfree = $entered_grn->taxfree_charge_price($supp_trans->tax_group_id); @@ -184,7 +186,7 @@ function add_supp_invoice($supp_trans) // do not receive as ref because we chang $entered_grn->this_quantity_inv * $line_taxfree, $supp_trans->supplier_id); // -------------- if price changed since po received. 16 Aug 2008 Joe Hunt $old_price = $old[0]; - if ($old_price != $entered_grn->chg_price) // price-change, so update + if ($supp_trans->is_invoice && $old_price != $entered_grn->chg_price) // price-change, so update { $diff = $entered_grn->chg_price - $old_price; $old_date = sql2date($old[1]);