Changed license type to GPLv3 in top of files
[fa-stable.git] / reporting / rep709.php
index 842a7663bba036645499a316720e9d4b2f359732..668021b2fa8adc40c050b2e542ecb5e2ed56b238 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 /**********************************************************************
     Copyright (C) FrontAccounting, LLC.
-       Released under the terms of the GNU Affero General Public License,
-       AGPL, as published by the Free Software Foundation, either version 
-       of the License, or (at your option) any later version.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-    See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
 $page_security = 2;
 // ----------------------------------------------------------------
@@ -48,6 +48,7 @@ function getTaxTransactions($from, $to)
                LEFT JOIN ".TB_PREF."cust_branch as branch ON dtrans.branch_code=branch.branch_code,
                ".TB_PREF."sys_types stype
                WHERE taxrec.trans_type=stype.type_id
+                       AND (taxrec.amount != 0 OR taxrec.net_amount != 0)
                        AND taxrec.trans_type != 13
                        AND taxrec.tran_date >= '$fromdate'
                        AND taxrec.tran_date <= '$todate'
@@ -144,14 +145,13 @@ function print_tax_report()
                                $rep->Header();
                        }
                }
-               if ($trans['net_amount'] > 0) {
+               if (in_array($trans['trans_type'], array(0,2,10,11))) {
                        $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'];
        }
@@ -180,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();
        }