X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep309.php;h=67f4a07c35333ab18d937ad24834ee8231365b74;hb=13fae1ba1d78cff66e326a006be2f538dd404248;hp=bf6aebd4549b422145b418645ecd13cd811bef6e;hpb=e868f1d18a2641df7633d5ab97887ffa6b3bde7a;p=fa-stable.git diff --git a/reporting/rep309.php b/reporting/rep309.php index bf6aebd4..67f4a07c 100644 --- a/reporting/rep309.php +++ b/reporting/rep309.php @@ -37,8 +37,8 @@ function getTransactions($category, $from, $to) category.description AS cat_description, item.stock_id, item.description, - line.unit_price, - SUM(line.quantity) as quantity + line.unit_price * trans.rate AS unit_price, + 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, @@ -103,7 +104,7 @@ function print_inventory_sales() 1 => array('text' => _('Period'),'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => '')); - $rep = new FrontReport(_('Sales Summary Report, Detailed'), "SalesSummaryDetailedReport", user_pagesize(), 9, $orientation); + $rep = new FrontReport(_('Item Sales Summary Report'), "ItemSalesSummaryReport", user_pagesize(), 9, $orientation); if ($orientation == 'L') recalculate_cols($cols); @@ -113,8 +114,6 @@ function print_inventory_sales() $res = getTransactions($category, $from, $to); $total = $grandtotal = 0.0; - $total1 = $grandtotal1 = 0.0; - $total2 = $grandtotal2 = 0.0; $catt = ''; while ($trans=db_fetch($res)) { @@ -128,7 +127,7 @@ function print_inventory_sales() $rep->Line($rep->row - 2); $rep->NewLine(); $rep->NewLine(); - $total = $total1 = $total2 = 0.0; + $total = 0.0; } $rep->TextCol(0, 1, $trans['category_id']); $rep->TextCol(1, 7, $trans['cat_description']); @@ -163,4 +162,3 @@ function print_inventory_sales() $rep->End(); } -?> \ No newline at end of file