X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep106.php;h=4aac08ab275ad665a614d3e960c9e44c51daae63;hb=ddadb47f2620ce6902ad4694ce6512568862ba05;hp=71fa3474d0a91f60aa2c616442054e87b1f3c669;hpb=a5242af68e65661edb7175412444dce536a7f311;p=fa-stable.git diff --git a/reporting/rep106.php b/reporting/rep106.php index 71fa3474..4aac08ab 100644 --- a/reporting/rep106.php +++ b/reporting/rep106.php @@ -9,12 +9,12 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -$page_security = 2; +$page_security = 'SA_SALESMANREP'; // ---------------------------------------------------------------- // $ Revision: 2.0 $ // Creator: Joe Hunt // date_: 2005-05-19 -// Title: Order Status List +// Title: Salesman Report // ---------------------------------------------------------------- $path_to_root=".."; @@ -26,7 +26,6 @@ include_once($path_to_root . "/inventory/includes/db/items_category_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_salesman_list(); //---------------------------------------------------------------------------------------------------- @@ -46,7 +45,7 @@ function GetSalesmanTrans($from, $to) AND ".TB_PREF."sales_orders.branch_code=".TB_PREF."cust_branch.branch_code AND ".TB_PREF."cust_branch.salesman=".TB_PREF."salesman.salesman_code AND ".TB_PREF."debtor_trans.debtor_no=".TB_PREF."debtors_master.debtor_no - AND (".TB_PREF."debtor_trans.type=10 OR ".TB_PREF."debtor_trans.type=11) + AND (".TB_PREF."debtor_trans.type=".ST_SALESINVOICE." OR ".TB_PREF."debtor_trans.type=".ST_CUSTCREDIT.") AND ".TB_PREF."debtor_trans.tran_date>='$fromdate' AND ".TB_PREF."debtor_trans.tran_date<='$todate' ORDER BY ".TB_PREF."salesman.salesman_code, ".TB_PREF."debtor_trans.tran_date"; @@ -60,19 +59,22 @@ function print_salesman_list() { global $path_to_root; - include_once($path_to_root . "/reporting/includes/pdf_report.inc"); - $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $summary = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; + $destination = $_POST['PARAM_4']; + if ($destination) + include_once($path_to_root . "/reporting/includes/excel_report.inc"); + else + include_once($path_to_root . "/reporting/includes/pdf_report.inc"); if ($summary == 0) $sum = _("No"); else $sum = _("Yes"); - $dec = user_qty_dec(); + $dec = user_price_dec(); $cols = array(0, 60, 150, 220, 325, 385, 450, 515); @@ -91,7 +93,7 @@ function print_salesman_list() $cols2 = $cols; $aligns2 = $aligns; - $rep = new FrontReport(_('Salesman Listing'), "SalesmanListing.pdf", user_pagesize()); + $rep = new FrontReport(_('Salesman Listing'), "SalesmanListing", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2); @@ -116,17 +118,16 @@ function print_salesman_list() $rep->Line($rep->row - 8); $rep->NewLine(2); $rep->TextCol(0, 3, _('Total')); - $rep->TextCol(5, 6, number_format2($subtotal, $dec)); - $rep->TextCol(6, 7, number_format2($subprov, $dec)); + $rep->AmountCol(5, 6, $subtotal, $dec); + $rep->AmountCol(6, 7, $subprov, $dec); $rep->Line($rep->row - 4); $rep->NewLine(2); - //$rep->Line($rep->row); } $rep->TextCol(0, 2, $myrow['salesman_code']." ".$myrow['salesman_name']); $rep->TextCol(2, 3, $myrow['salesman_phone']); $rep->TextCol(3, 4, $myrow['salesman_email']); $rep->TextCol(4, 5, number_format2($myrow['provision'], user_percent_dec()) ." %"); - $rep->TextCol(5, 6, number_format2($myrow['break_pt'], $dec)); + $rep->AmountCol(5, 6, $myrow['break_pt'], $dec); $rep->TextCol(6, 7, number_format2($myrow['provision2'], user_percent_dec()) ." %"); $rep->NewLine(2); $salesman = $myrow['salesman_code']; @@ -135,7 +136,6 @@ function print_salesman_list() $subtotal = 0; $subprov = 0; } - $date = sql2date($myrow['tran_date']); $rate = $myrow['rate']; $amt = $myrow['InvoiceTotal'] * $rate; if ($subprov > $myrow['break_pt'] && $myrow['provision2'] != 0) @@ -148,9 +148,9 @@ function print_salesman_list() $rep->TextCol(1, 2, $myrow['DebtorName']); $rep->TextCol(2, 3, $myrow['br_name']); $rep->TextCol(3, 4, $myrow['contact_name']); - $rep->TextCol(4, 5, $date); - $rep->TextCol(5, 6, number_format2($amt, $dec)); - $rep->TextCol(6, 7, number_format2($prov, $dec)); + $rep->DateCol(4, 5, $myrow['tran_date'], true); + $rep->AmountCol(5, 6, $amt, $dec); + $rep->AmountCol(6, 7, $prov, $dec); $rep->NewLine(); if ($rep->row < $rep->bottomMargin + (2 * $rep->lineHeight)) { @@ -166,20 +166,20 @@ function print_salesman_list() $rep->Line($rep->row - 4); $rep->NewLine(2); $rep->TextCol(0, 3, _('Total')); - $rep->TextCol(5, 6, number_format2($subtotal, $dec)); - $rep->TextCol(6, 7, number_format2($subprov, $dec)); + $rep->AmountCol(5, 6, $subtotal, $dec); + $rep->AmountCol(6, 7, $subprov, $dec); $rep->Line($rep->row - 4); $rep->NewLine(2); - //$rep->Line($rep->row); $total += $subtotal; $provtotal += $subprov; } $rep->fontSize += 2; $rep->TextCol(0, 3, _('Grand Total')); $rep->fontSize -= 2; - $rep->TextCol(5, 6, number_format2($total, $dec)); - $rep->TextCol(6, 7, number_format2($provtotal, $dec)); + $rep->AmountCol(5, 6, $total, $dec); + $rep->AmountCol(6, 7, $provtotal, $dec); $rep->Line($rep->row - 4); + $rep->NewLine(); $rep->End(); }