Merged changes from main trunk up to 2.2.5
[fa-stable.git] / reporting / rep709.php
index 4baf0105841b9e4e4b91416a7c8446ab4258f03e..3fc4c6375673372cf19974563a047c1fb5625ee0 100644 (file)
@@ -143,7 +143,11 @@ function print_tax_report()
                                $rep->Header();
                        }
                }
-               if (in_array($trans['trans_type'], array(ST_BANKDEPOSIT,ST_SALESINVOICE,ST_CUSTCREDIT))) {
+               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'];
+               }
+               elseif (in_array($trans['trans_type'], array(ST_BANKDEPOSIT,ST_SALESINVOICE,ST_CUSTCREDIT))) {
                        $taxes[$trans['tax_type_id']]['taxout'] += $trans['amount'];
                        $taxes[$trans['tax_type_id']]['out'] += $trans['net_amount'];
                } else {