X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep309.php;h=67f4a07c35333ab18d937ad24834ee8231365b74;hb=5d8f36d15260bfd9215315935af86b7d96065489;hp=f52dc22aa2cbd4a39c7e9bad6c28e4cdb156f32e;hpb=6b30619eff8469a679e7c18a19b6df7091417128;p=fa-stable.git diff --git a/reporting/rep309.php b/reporting/rep309.php index f52dc22a..67f4a07c 100644 --- a/reporting/rep309.php +++ b/reporting/rep309.php @@ -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, @@ -51,7 +51,7 @@ function getTransactions($category, $from, $to) AND trans.tran_date<='$to' AND line.quantity<>0 AND item.mb_flag <>'F' - AND line.debtor_trans_type = ".ST_SALESINVOICE; + AND (line.debtor_trans_type = ".ST_SALESINVOICE." OR line.debtor_trans_type = ".ST_CUSTCREDIT.")"; if ($category != 0) $sql .= " AND item.category_id = ".db_escape($category); $sql .= " GROUP BY item.category_id,