AVG matr price again again
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 27 Jun 2009 17:44:09 +0000 (17:44 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 27 Jun 2009 17:44:09 +0000 (17:44 +0000)
purchasing/includes/db/invoice_db.inc

index e55fd1df2abf8bc4aa0c2f00f2954bebcb4d5619..a7a7cba45e0cb210d0ef7a648cc5a90061b4b708 100644 (file)
@@ -405,6 +405,8 @@ function void_supp_invoice($type, $type_no)
 {
        begin_transaction();
 
+       $trans = get_supp_trans($type_no, $type);
+
        void_bank_trans($type, $type_no, true);
 
        void_gl_trans($type, $type_no, true);
@@ -447,7 +449,7 @@ function void_supp_invoice($type, $type_no)
                        }
                        else
                        {
-                                       $diff = get_diff_in_home_currency($grn["supplier_id"], $old_date, $old_date_, $old[2], 
+                                       $diff = get_diff_in_home_currency($grn["supplier_id"], $old_date, sql2date($trans['tran_date']), $old[2], 
                                                $details_row["FullUnitPrice"]);
                                        // Only adjust the avg for the diff
                                        $mat_cost = update_average_material_cost(null, $details_row["stock_id"],