Master bug in class supp_trans get_items_total. Minor bug in gl_db_trans.inc
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 9 Oct 2010 23:21:45 +0000 (23:21 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 9 Oct 2010 23:21:45 +0000 (23:21 +0000)
Wrong tax report and wrong supp trans/gl records with gl item lines.

CHANGELOG.txt
gl/includes/db/gl_db_trans.inc
purchasing/includes/supp_trans_class.inc

index 0da137c4981d97c69c3537e783b2e0c3dd0edbc2..eca8006cbdd9b797a71e9355f685e08b95e1ea42 100644 (file)
@@ -19,6 +19,12 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+10-Oct-2010 Joe Hunt
+# Master bug in class supp_trans get_items_total. Minor bug in gl_db_trans.inc
+  Wrong tax report and wrong supp trans/gl records with gl item lines.
+$ /purchasing/includes/supp_trans_class.inc
+  /gl/includes/db/gl_db_trans.inc
+
 06-Oct-2010 Jusz Dobrowolski
 # Fixed gettext for extension links.
 $ /reporting/includes/reports_classes.inc
index e64169676bd0bee655a8e5c7dfd4c96af020f0b4..96963d4307c8843f20de81eecb3ebb5a4bc6c458 100644 (file)
@@ -337,7 +337,8 @@ function add_gl_tax_details($gl_code, $trans_type, $trans_no, $amount, $ex_rate,
        if(!$tax_type) return;  // $gl_code is not tax account
        
        $tax = get_tax_type($tax_type);
-       if ($gl_code == $tax['sales_gl_code']) 
+       //if ($gl_code == $tax['sales_gl_code'])
+       if ($trans_type == ST_SALESINVOICE || $trans_type == ST_CUSTDELIVERY || $trans_type == ST_CUSTCREDIT)
                $amount = -$amount;
        // we have to restore net amount as we cannot know the base amount
        if ($tax['rate'] == 0) {
index 293b59a725b11ff69f6a1816b0aef186e83b6cbf..0647b96fd4e6eeec682da5f3791f9719845efe38 100644 (file)
@@ -164,12 +164,12 @@ class supp_trans
                foreach ($this->grn_items as $ln_itm)
                        $total += round($ln_itm->this_quantity_inv * $ln_itm->chg_price, user_price_dec());
 
-               return $total;
-
                foreach ($this->gl_codes as $gl_line)
-               {
-                       $total += $gl_line->amount;
+               {   //////// 2010-10-10 Joe Hunt
+                       if (!is_tax_account($gl_line->gl_code))
+                               $total += $gl_line->amount;
                }
+               return $total;
        }
 } /* end of class defintion */