Rerun of /gl/includes/db/gl_db_trans.inc and /reporting/rep709.php.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 7 Apr 2012 14:31:46 +0000 (16:31 +0200)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 7 Apr 2012 14:31:46 +0000 (16:31 +0200)
gl/includes/db/gl_db_trans.inc
reporting/rep709.php

index 2802c793d007e2e1dbda81932b6032b069b75e1a..0134776b39de6a5dc32f19c786a8f1e5dc80f5af 100644 (file)
@@ -443,12 +443,12 @@ function get_tax_summary($from, $to)
                                        ." || (trans_type=".ST_JOURNAL ." AND amount<0)"
                                        ." || trans_type=".ST_CUSTCREDIT.", amount*ex_rate,0)) payable,
 
-                               SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
+                               SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE." || trans_type=".ST_JOURNAL.",-1,1)*
                                IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE
                                        ." || (trans_type=".ST_JOURNAL ." AND amount<0)"
                                        ." || trans_type=".ST_CUSTCREDIT.", 0, net_amount*ex_rate)) net_input,
 
-                               SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
+                               SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE." || trans_type=".ST_JOURNAL.",-1,1)*
                                IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE
                                        ." || (trans_type=".ST_JOURNAL ." AND amount<0)"
                                        ." || trans_type=".ST_CUSTCREDIT.", 0, amount*ex_rate)) collectible,
index 54b1a9007ef824d014de5ddab25e935d52201f15..21646d78d0e77b92cb6c7f9421238c9a5e6a2314 100644 (file)
@@ -152,8 +152,12 @@ function print_tax_report()
                        }
                }
                if ($trans['trans_type']==ST_JOURNAL && $trans['amount']<0) {
-                       $taxes[$trans['tax_type_id']]['taxout'] -= $trans['amount'];
-                       $taxes[$trans['tax_type_id']]['out'] -= $trans['net_amount'];
+                       $taxes[$trans['tax_type_id']]['taxin'] += $trans['amount'];
+                       $taxes[$trans['tax_type_id']]['in'] += $trans['net_amount'];
+               }
+               elseif ($trans['trans_type']==ST_JOURNAL && $trans['amount']>=0) {
+                       $taxes[$trans['tax_type_id']]['taxout'] += $trans['amount'];
+                       $taxes[$trans['tax_type_id']]['out'] += $trans['net_amount'];
                }
                elseif (in_array($trans['trans_type'], array(ST_BANKDEPOSIT,ST_SALESINVOICE,ST_CUSTCREDIT))) {
                        $taxes[$trans['tax_type_id']]['taxout'] += $trans['amount'];