X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep309.php;h=67f4a07c35333ab18d937ad24834ee8231365b74;hb=268a54dcfd08aff7113bc3afe8b784f36db2d0d4;hp=b9c90bc46a7b0866ccc0a84fd793a6fc0e8e3da0;hpb=a9d55e1c13cbd6a6305b9322ec8621a06516f9f3;p=fa-stable.git diff --git a/reporting/rep309.php b/reporting/rep309.php index b9c90bc4..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, @@ -50,7 +50,8 @@ function getTransactions($category, $from, $to) AND trans.tran_date>='$from' AND trans.tran_date<='$to' AND line.quantity<>0 - AND line.debtor_trans_type = ".ST_SALESINVOICE; + AND item.mb_flag <>'F' + 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,