print_sales_summary_report();
-function getTaxTransactions($from, $to)
+function getTaxTransactions($from, $to, $tax_id)
{
$fromdate = date2sql($from);
$todate = date2sql($to);
FROM ".TB_PREF."debtor_trans dt\r
LEFT JOIN ".TB_PREF."debtors_master d ON d.debtor_no=dt.debtor_no\r
LEFT JOIN ".TB_PREF."trans_tax_details t ON (t.trans_type=dt.type AND t.trans_no=dt.trans_no)\r
- WHERE (dt.type=".ST_SALESINVOICE." OR dt.type=".ST_CUSTCREDIT.")\r
- AND dt.tran_date >=".db_escape($fromdate)." AND dt.tran_date<=".db_escape($todate)."\r
+ WHERE (dt.type=".ST_SALESINVOICE." OR dt.type=".ST_CUSTCREDIT.") ";\r
+ if ($tax_id)\r
+ $sql .= "AND tax_id<>'' ";\r
+ $sql .= "AND dt.tran_date >=".db_escape($fromdate)." AND dt.tran_date<=".db_escape($todate)."\r
GROUP BY d.debtor_no, d.name, d.tax_id ORDER BY d.name"; \r
return db_query($sql,"No transactions were returned");
}
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
- $comments = $_POST['PARAM_2'];
- $destination = $_POST['PARAM_3'];
+ $tax_id = $_POST['PARAM_2'];\r
+ $comments = $_POST['PARAM_3'];
+ $destination = $_POST['PARAM_4'];
+ if ($tax_id == 0)\r
+ $tid = _('No');\r
+ else\r
+ $tid = _('Yes');\r
+\r
if ($destination)
include_once($path_to_root . "/reporting/includes/excel_report.inc");
$rep = new FrontReport(_('Sales Summary Report'), "SalesSummaryReport", user_pagesize());
$params = array( 0 => $comments,
- 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to));
+ 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to),
+ 2 => array( 'text' => _('Tax Id Only'),'from' => $tid,'to' => ''));
$cols = array(0, 130, 180, 270, 350, 500);\r
$totalnet = 0.0;
$totaltax = 0.0;
- $transactions = getTaxTransactions($from, $to);
+ $transactions = getTaxTransactions($from, $to, $tax_id);
\r
$rep->TextCol(0, 4, _("Values in domestic currency"));\r
$rep->NewLine(2);\r
$reports->addReport(RC_CUSTOMER, 114, _('Sales &Summary Report'),
array( _('Start Date') => 'DATEBEGINTAX',
_('End Date') => 'DATEENDTAX',
+ _('Tax Id Only') => 'YES_NO',
_('Comments') => 'TEXTBOX',
_('Destination') => 'DESTINATION'));
$reports->addReport(RC_CUSTOMER, 104, _('&Price Listing'),