When voiding Inventory Adjustment transaction, the costs are not getting adjusted.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 28 Feb 2011 15:44:00 +0000 (16:44 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 28 Feb 2011 15:44:00 +0000 (16:44 +0100)
[0000587] Converted currencies are not rounded when using Funds transfers

CHANGELOG.txt
gl/includes/db/gl_db_bank_trans.inc
inventory/includes/db/items_adjust_db.inc

index 7bcae749662b1eba60c62c7cec3fcdbb5185194b..32d8e4be020d4e096c06cc6671259a1b26aebe28 100644 (file)
@@ -22,6 +22,10 @@ $ -> Affected files
 28-Feb-2011 Joe Hunt
 # [0000583] Unique Reference check fails when running manual Revaluation of Currency 
 $ /includes/references.inc
+# When voiding Inventory Adjustment transaction, the costs are not getting adjusted.
+$ /inventory/includes/db/items_adjust_db.inc
+# [0000587] Converted currencies are not rounded when using Funds transfers 
+$ /gl/includes/db/gl_db_bank_trans.inc
 
 21-Feb-2011 Janusz Dobrowolski
 ! Hiden warning in open_basedir/save_mode on rate retrieval.
index 90dc8c4afd40d2522d96e2042475e87b271b1ee7..a0aab62eac8a9e39ce21279d072f39361acfe4f9 100644 (file)
@@ -32,7 +32,7 @@ function add_bank_trans($type, $trans_no, $bank_act, $ref, $date_,
        }
        else
                $amount_bank = $amount;
-
+       $amount_bank = round2($amount_bank, user_price_dec());  
 
        // Also store the rate to the home
        //$BankToHomeCurrencyRate = get_exchange_rate_to_home_currency($bank_account_currency, $date_);
index 5274584d13a35b4748d60cda53d5cce691cb8d9c..f3c8c9d2be303aef54915208e0223acae26c3a57 100644 (file)
@@ -51,6 +51,14 @@ function add_stock_adjustment($items, $location, $date_, $type, $increase, $refe
 function void_stock_adjustment($type_no)
 {
        hook_db_prevoid(ST_INVADJUST, $type_no);
+
+    //Average the cost while voiding
+    $adjustment_items = get_stock_adjustment_items($type_no);
+    while ($adjustment = db_fetch($adjustment_items))
+    {
+        update_average_material_cost(0, $adjustment['stock_id'],
+            $adjustment['standard_cost'], -$adjustment['qty'], sql2date($adjustment['tran_date']));
+    }
        void_gl_trans(ST_INVADJUST, $type_no);
        void_stock_move(ST_INVADJUST, $type_no);
 }