From 9b1b5c83a37376d2076334952db1d1f739a26d1c Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Tue, 1 Mar 2011 16:42:12 +0100 Subject: [PATCH] Searchable customer/supplier selectors in reports options (if set in company prefs). --- reporting/includes/reports_classes.inc | 40 +++++++++++++------------- reporting/rep101.php | 4 +-- reporting/rep102.php | 4 +-- reporting/rep108.php | 2 +- reporting/rep201.php | 4 +-- reporting/rep202.php | 4 +-- reporting/rep203.php | 4 +-- reporting/rep204.php | 4 +-- reporting/rep304.php | 6 ++-- 9 files changed, 36 insertions(+), 36 deletions(-) diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc index 2faf00ae..f9d49d78 100644 --- a/reporting/includes/reports_classes.inc +++ b/reporting/includes/reports_classes.inc @@ -49,6 +49,10 @@ class BoxReports { global $path_to_root, $pdf_debug, $Ajax; + if (find_submit('Rep') != -1) { + include($path_to_root.'/reporting/prn_redirect.php'); + return; + } $temp = array_values($this->ar_classes); $display_class = $class==null ? $temp[0] : $this->ar_classes[$class]; @@ -59,6 +63,8 @@ class BoxReports if (isset($_GET['Class'])) set_focus('class'.$_GET['Class']); + $cur_class = $_REQUEST['Class']; + foreach($this->ar_classes as $class_id => $name) { if (!isset($this->ar_reports[$class_id])) @@ -67,36 +73,36 @@ class BoxReports $acc = access_string($name); $st_classes .= "$acc[0]
"; - $style = $class_id==$_REQUEST['Class'] ? '' : "style='display:none'"; + $style = $class_id==$cur_class ? '' : "style='display:none'"; $st_reports .= "\n"; foreach($this->ar_reports[$class_id] as $rep_id => $report) { $acc = access_string($report->name); $st_reports .= "
" . _("Reports For Class: ") . " $name
id'" - ." style='font-weight:". (@$_GET['rep_id'] == $report->id ? 'bold' : 'normal')."'" + ." href='".$_SERVER['PHP_SELF']."?Class=$class_id&REP_ID=$report->id'" + ." style='font-weight:". (@$_REQUEST['REP_ID'] == $report->id ? 'bold' : 'normal')."'" ." id='".$id = default_focus()."'" ."$acc[1]>$acc[0]
\n"; - if (@$_REQUEST['rep_id'] == $report->id) { + if (@$_REQUEST['REP_ID'] == $report->id) { $Ajax->activate($id); } - if (isset($_REQUEST['rep_id']) && $_REQUEST['rep_id']==$report->id) { - - $action = $path_to_root.'/reporting/prn_redirect.php'; - + if (isset($_REQUEST['REP_ID']) && $_REQUEST['REP_ID']==$report->id) { + // parameters form + $action = $_SERVER['PHP_SELF']; $st_params = "
\n" . "
\n"; $st_params .= submit('Rep'.$report->id, _("Display: ") . access_string($report->name, true), false, '', $pdf_debug ? false : 'default process') . hidden('REP_ID', $report->id, false).'

'; $st_params .= $this->getOptions($report->get_controls(), $report->id); - $st_params .= "\n
\n"; + $st_params .= "\n" + ."\n
\n"; set_focus('Rep'.$report->id); $Ajax->addUpdate(true, 'rep_form', $st_params); } @@ -281,23 +287,17 @@ class BoxReports case 'CUSTOMERS': $sql = "SELECT debtor_no, name FROM ".TB_PREF."debtors_master"; if ($type == 'CUSTOMERS_NO_FILTER') - return combo_input($name, '', $sql, 'debtor_no', 'name',array('spec_option'=>_("No Customer Filter"),'spec_id'=>ALL_NUMERIC)); -// FIX allitems numeric! -// return customer_list($name, null, _("No Customer Filter")); + return customer_list($name, null, _("No Customer Filter")); else - return combo_input($name, '', $sql, 'debtor_no', 'name', null); -// return customer_list($name); + return customer_list($name); case 'SUPPLIERS_NO_FILTER': case 'SUPPLIERS': $sql = "SELECT supplier_id, supp_name FROM ".TB_PREF."suppliers"; if ($type == 'SUPPLIERS_NO_FILTER') - return combo_input($name, '', $sql, 'supplier_id', 'supp_name',array('spec_option'=>_("No Supplier Filter"),'spec_id'=>ALL_NUMERIC)); -// FIX allitems numeric! -// return supplier_list($name, null, _("No Supplier Filter")); + return supplier_list($name, null, _("No Supplier Filter")); else - return combo_input($name, '', $sql, 'supplier_id', 'supp_name', null); -// return supplier_list($name); + return supplier_list($name); case 'INVOICE': $IV = $type_shortcuts[ST_SALESINVOICE]; diff --git a/reporting/rep101.php b/reporting/rep101.php index dc027b5a..3f1ece78 100644 --- a/reporting/rep101.php +++ b/reporting/rep101.php @@ -108,7 +108,7 @@ function print_customer_balances() else include_once($path_to_root . "/reporting/includes/pdf_report.inc"); - if ($fromcust == ALL_NUMERIC) + if ($fromcust == ALL_TEXT) $cust = _('All'); else $cust = get_customer_name($fromcust); @@ -146,7 +146,7 @@ function print_customer_balances() $grandtotal = array(0,0,0,0); $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master "; - if ($fromcust != ALL_NUMERIC) + if ($fromcust != ALL_TEXT) $sql .= "WHERE debtor_no=".db_escape($fromcust); $sql .= " ORDER BY name"; $result = db_query($sql, "The customers could not be retrieved"); diff --git a/reporting/rep102.php b/reporting/rep102.php index 04a55fae..8bd7714a 100644 --- a/reporting/rep102.php +++ b/reporting/rep102.php @@ -84,7 +84,7 @@ function print_aged_customer_analysis() $pg = new graph(); } - if ($fromcust == ALL_NUMERIC) + if ($fromcust == ALL_TEXT) $from = _('All'); else $from = get_customer_name($fromcust); @@ -135,7 +135,7 @@ function print_aged_customer_analysis() $total = array(0,0,0,0, 0); $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master"; - if ($fromcust != ALL_NUMERIC) + if ($fromcust != ALL_TEXT) $sql .= " WHERE debtor_no=".db_escape($fromcust); $sql .= " ORDER BY name"; $result = db_query($sql, "The customers could not be retrieved"); diff --git a/reporting/rep108.php b/reporting/rep108.php index 0247f7cc..b78f5596 100644 --- a/reporting/rep108.php +++ b/reporting/rep108.php @@ -89,7 +89,7 @@ function print_statements() } $sql = "SELECT debtor_no, name AS DebtorName, address, tax_id, curr_code, curdate() AS tran_date FROM ".TB_PREF."debtors_master"; - if ($customer != ALL_NUMERIC) + if ($customer != ALL_TEXT) $sql .= " WHERE debtor_no = ".db_escape($customer); else $sql .= " ORDER by name"; diff --git a/reporting/rep201.php b/reporting/rep201.php index 1c1ee438..79cd401f 100644 --- a/reporting/rep201.php +++ b/reporting/rep201.php @@ -96,7 +96,7 @@ function print_supplier_balances() else include_once($path_to_root . "/reporting/includes/pdf_report.inc"); - if ($fromsupp == ALL_NUMERIC) + if ($fromsupp == ALL_TEXT) $supp = _('All'); else $supp = get_supplier_name($fromsupp); @@ -136,7 +136,7 @@ function print_supplier_balances() $grandtotal = array(0,0,0,0); $sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers"; - if ($fromsupp != ALL_NUMERIC) + if ($fromsupp != ALL_TEXT) $sql .= " WHERE supplier_id=".db_escape($fromsupp); $sql .= " ORDER BY supp_name"; $result = db_query($sql, "The customers could not be retrieved"); diff --git a/reporting/rep202.php b/reporting/rep202.php index 2eb27559..08a26651 100644 --- a/reporting/rep202.php +++ b/reporting/rep202.php @@ -86,7 +86,7 @@ function print_aged_supplier_analysis() $pg = new graph(); } - if ($fromsupp == ALL_NUMERIC) + if ($fromsupp == ALL_TEXT) $from = _('All'); else $from = get_supplier_name($fromsupp); @@ -145,7 +145,7 @@ function print_aged_supplier_analysis() $pastdue2 = _('Over') . " " . $PastDueDays2 . " " . _('Days'); $sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers"; - if ($fromsupp != ALL_NUMERIC) + if ($fromsupp != ALL_TEXT) $sql .= " WHERE supplier_id=".db_escape($fromsupp); $sql .= " ORDER BY supp_name"; $result = db_query($sql, "The suppliers could not be retrieved"); diff --git a/reporting/rep203.php b/reporting/rep203.php index e6f00ce8..7ca090d9 100644 --- a/reporting/rep203.php +++ b/reporting/rep203.php @@ -68,7 +68,7 @@ function print_payment_report() else include_once($path_to_root . "/reporting/includes/pdf_report.inc"); - if ($fromsupp == ALL_NUMERIC) + if ($fromsupp == ALL_TEXT) $from = _('All'); else $from = get_supplier_name($fromsupp); @@ -110,7 +110,7 @@ function print_payment_report() $sql = "SELECT supplier_id, supp_name AS name, curr_code, ".TB_PREF."payment_terms.terms FROM ".TB_PREF."suppliers, ".TB_PREF."payment_terms WHERE "; - if ($fromsupp != ALL_NUMERIC) + if ($fromsupp != ALL_TEXT) $sql .= "supplier_id=".db_escape($fromsupp)." AND "; $sql .= "".TB_PREF."suppliers.payment_terms = ".TB_PREF."payment_terms.terms_indicator ORDER BY supp_name"; diff --git a/reporting/rep204.php b/reporting/rep204.php index 61034d35..21624cf4 100644 --- a/reporting/rep204.php +++ b/reporting/rep204.php @@ -49,7 +49,7 @@ function getTransactions($fromsupp) AND ".TB_PREF."grn_items.po_detail_item = ".TB_PREF."purch_order_details.po_detail_item AND qty_recd-quantity_inv <>0 "; - if ($fromsupp != ALL_NUMERIC) + if ($fromsupp != ALL_TEXT) $sql .= "AND ".TB_PREF."grn_batch.supplier_id =".db_escape($fromsupp)." "; $sql .= "ORDER BY ".TB_PREF."grn_batch.supplier_id, ".TB_PREF."grn_batch.id"; @@ -71,7 +71,7 @@ function print_outstanding_GRN() else include_once($path_to_root . "/reporting/includes/pdf_report.inc"); - if ($fromsupp == ALL_NUMERIC) + if ($fromsupp == ALL_TEXT) $from = _('All'); else $from = get_supplier_name($fromsupp); diff --git a/reporting/rep304.php b/reporting/rep304.php index ac59e881..a84e53d2 100644 --- a/reporting/rep304.php +++ b/reporting/rep304.php @@ -104,7 +104,7 @@ function print_inventory_sales() else $loc = get_location_name($location); - if ($fromcust == ALL_NUMERIC) + if ($fromcust == ALL_TEXT) $fromc = _('All'); else $fromc = get_customer_name($fromcust); @@ -112,7 +112,7 @@ function print_inventory_sales() $cols = array(0, 75, 175, 250, 300, 375, 450, 515); $headers = array(_('Category'), _('Description'), _('Customer'), _('Qty'), _('Sales'), _('Cost'), _('Contribution')); - if ($fromcust != ALL_NUMERIC) + if ($fromcust != ALL_TEXT) $headers[2] = ''; $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right'); @@ -163,7 +163,7 @@ function print_inventory_sales() $rep->NewLine(); $rep->fontSize -= 2; $rep->TextCol(0, 1, $trans['stock_id']); - if ($fromcust == ALL_NUMERIC) + if ($fromcust == ALL_TEXT) { $rep->TextCol(1, 2, $trans['description'].($trans['inactive']==1 ? " ("._("Inactive").")" : ""), -1); $rep->TextCol(2, 3, $trans['debtor_name']); -- 2.30.2