From ed453e5a0c01ad53a49625e94846a4c2e1456a28 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Thu, 29 Jan 2009 22:24:19 +0000 Subject: [PATCH] A few minor fixes to get the tax report and inquiry right and syncronized --- CHANGELOG.txt | 10 ++++++++++ gl/includes/db/gl_db_trans.inc | 6 +++--- gl/inquiry/tax_inquiry.php | 2 +- reporting/rep709.php | 9 ++++----- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c857206c..ffaa6a64 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/gl/includes/db/gl_db_trans.inc b/gl/includes/db/gl_db_trans.inc index 8aaa76fb..0e2d0b42 100644 --- a/gl/includes/db/gl_db_trans.inc +++ b/gl/includes/db/gl_db_trans.inc @@ -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 diff --git a/gl/inquiry/tax_inquiry.php b/gl/inquiry/tax_inquiry.php index b7ca2de3..a1bafbd9 100644 --- a/gl/inquiry/tax_inquiry.php +++ b/gl/inquiry/tax_inquiry.php @@ -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'] . "%"); diff --git a/reporting/rep709.php b/reporting/rep709.php index 1a5663ee..213d90a7 100644 --- a/reporting/rep709.php +++ b/reporting/rep709.php @@ -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(); } -- 2.30.2