Rerun Items Summary Report fix
[fa-stable.git] / reporting / rep309.php
index 172034243c92ee8550c5924c608624e48b571131..2e3dfa6707028d4a24bacd98cbe05d5e6afba5c9 100644 (file)
@@ -38,7 +38,7 @@ function getTransactions($category, $from, $to)
                        item.stock_id,
                        item.description,
                        line.unit_price * trans.rate AS unit_price,
-                       SUM(line.quantity) as quantity
+                       SUM(IF(line.debtor_trans_type = ".ST_CUSTCREDIT.", -line.quantity, line.quantity)) AS quantity
                FROM ".TB_PREF."stock_master item,
                        ".TB_PREF."stock_category category,
                        ".TB_PREF."debtor_trans trans,