A few minor fixes to get the tax report and inquiry right and syncronized
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 29 Jan 2009 22:24:19 +0000 (22:24 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 29 Jan 2009 22:24:19 +0000 (22:24 +0000)
CHANGELOG.txt
gl/includes/db/gl_db_trans.inc
gl/inquiry/tax_inquiry.php
reporting/rep709.php

index c857206c9a0333908cb93e5ba00eb9225a2811be..ffaa6a6431ffc4e15cfe3bfda3611674d6ca8fe9 100644 (file)
@@ -19,6 +19,16 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+29-Jan-2009 Joe Hunt
+# A few minor fixes to get the tax report and inquiry right and syncronized
+$ /gl/includes/db/gl_db_trans.inc
+  /gl/inquiry/tax_inquiry.php
+  /reporting/rep709.php
+# Missing parameter to add_trans_tax_details
+$ /sales/includes/db/sales_credit_db.inc
+  /sales/includes/db/sales_delivery_db.inc
+  /sales/includes/db/sales_invoice_db.inc
+  
 29-Jan-2009 Janusz Dobrowolski
 # Changes related to rewrite and optimalization of tax registration
 $ /gl/includes/db/gl_db_bank_trans.inc
index 8aaa76fb8e0281947b59ee698dc20acaa630937d..0e2d0b42a8b43ec92eb3116046af379c0eba9aa3 100644 (file)
@@ -287,13 +287,13 @@ function get_tax_summary($from, $to)
 
        $sql = "SELECT 
                                SUM(IF( trans_type=1 || trans_type=11 || trans_type=20,-1,1)*
-                               IF(trans_type=0 || trans_type=2 || trans_type=10 || trans_type=11, -net_amount*ex_rate,0)) net_input,
+                               IF(trans_type=0 || trans_type=2 || trans_type=10 || trans_type=11, net_amount*ex_rate,0)) net_input,
                                SUM(IF( trans_type=1 || trans_type=11 || trans_type=20,-1,1)*
-                               IF(trans_type=0 || trans_type=2 || trans_type=10 || trans_type=11, -amount*ex_rate,0)) payable,
+                               IF(trans_type=0 || trans_type=2 || trans_type=10 || trans_type=11, amount*ex_rate,0)) collectible,
                                SUM(IF( trans_type=1 || trans_type=11 || trans_type=20,-1,1)*
                                IF(trans_type=0 || trans_type=2 || trans_type=10 || trans_type=11, 0, net_amount*ex_rate)) net_output,
                                SUM(IF( trans_type=1 || trans_type=11 || trans_type=20,-1,1)*
-                               IF(trans_type=0 || trans_type=2 || trans_type=10 || trans_type=11, 0, amount*ex_rate)) collectible,
+                               IF(trans_type=0 || trans_type=2 || trans_type=10 || trans_type=11, 0, amount*ex_rate)) payable,
                                taxrec.rate,
                                ttype.id,
                                ttype.name
index b7ca2de3f8b99602232294d9c99174c0efe26174..a1bafbd989b4d1882ed50e6155ceaa34dbe7e24c 100644 (file)
@@ -101,7 +101,7 @@ function show_results()
 
                $payable = $tx['payable'];
                $collectible = $tx['collectible'];
-               $net = $collectible - $payable;
+               $net = $collectible + $payable;
                $total += $net;
                alt_table_row_color($k);
                label_cell($tx['name'] . " " . $tx['rate'] . "%");
index 1a5663eef9fa901f1eaecaafdf88ea68a04fe022..213d90a749f0cb2f7aada2c1643ed5be73b9d0db 100644 (file)
@@ -149,10 +149,9 @@ function print_tax_report()
                        $taxes[$trans['tax_type_id']]['taxout'] += $trans['amount'];
                        $taxes[$trans['tax_type_id']]['out'] += $trans['net_amount'];
                } else {
-                       $taxes[$trans['tax_type_id']]['taxin'] -= $trans['amount'];
-                       $taxes[$trans['tax_type_id']]['in'] -= $trans['net_amount'];
+                       $taxes[$trans['tax_type_id']]['taxin'] += $trans['amount'];
+                       $taxes[$trans['tax_type_id']]['in'] += $trans['net_amount'];
                }
-               
                $totalnet += $trans['net_amount'];
                $totaltax += $trans['amount'];
        }
@@ -181,8 +180,8 @@ function print_tax_report()
                $rep->TextCol(2, 3,number_format2($sum['taxout'], $dec));
                $rep->TextCol(3, 4, number_format2($sum['in'], $dec));
                $rep->TextCol(4, 5,number_format2($sum['taxin'], $dec)); 
-               $rep->TextCol(5, 6, number_format2($sum['taxout']-$sum['taxin'], $dec));
-               $taxtotal += $sum['taxout']-$sum['taxin'];
+               $rep->TextCol(5, 6, number_format2($sum['taxout']+$sum['taxin'], $dec));
+               $taxtotal += $sum['taxout']+$sum['taxin'];
                $rep->NewLine();
        }