Rerun of Sales Summary Report
[fa-stable.git] / reporting / rep114.php
index 96f743e76834c5920f3bfcac8b6b83513070d847..11735980d452c48f8e829415ee158b109db00995 100644 (file)
@@ -34,7 +34,7 @@ function getTaxTransactions($from, $to, $tax_id)
        $todate = date2sql($to);
 \r
        $sql = "SELECT d.debtor_no, d.name AS cust_name, d.tax_id, 
-               CASE WHEN net_amount IS NULL THEN 
+               CASE WHEN net_amount IS NULL OR amount=0 THEN 
                        SUM(CASE WHEN dt.type=".ST_CUSTCREDIT." THEN (ov_amount+ov_freight+ov_discount)*-1 
                        ELSE (ov_amount+ov_freight+ov_discount) END *dt.rate) ELSE 
                        SUM(CASE WHEN dt.type=".ST_CUSTCREDIT." THEN -net_amount ELSE net_amount END *ex_rate) END AS total,