Searchable customer/supplier selectors in reports options (if set in company prefs).
authorJanusz Dobrowolski <janusz@frontaccouting.eu>
Tue, 1 Mar 2011 15:42:12 +0000 (16:42 +0100)
committerJanusz Dobrowolski <janusz@frontaccouting.eu>
Tue, 1 Mar 2011 15:42:12 +0000 (16:42 +0100)
reporting/includes/reports_classes.inc
reporting/rep101.php
reporting/rep102.php
reporting/rep108.php
reporting/rep201.php
reporting/rep202.php
reporting/rep203.php
reporting/rep204.php
reporting/rep304.php

index 2faf00ae63bbb8ab73cc079464499032e852e22b..f9d49d788ff02e834a8cf82a18847885c1aaabd5 100644 (file)
@@ -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 .= "<a href='"
                                .$_SERVER['PHP_SELF']."?Class=$class_id'"
-                               ." style='font-weight:". ($_REQUEST['Class'] == $class_id ? 'bold' : 'normal')."'"
+                               ." style='font-weight:". ($cur_class == $class_id ? 'bold' : 'normal')."'"
                                ." class='repclass_link' id='".'class'.$class_id."'"
                                ."$acc[1]>$acc[0]</a> <br>";
 
-                       $style = $class_id==$_REQUEST['Class'] ? '' : "style='display:none'";
+                       $style = $class_id==$cur_class ? '' : "style='display:none'";
                        $st_reports .= "<table class='repclass' id='TAB_" . $class_id ."' $style cellpadding=0 cellspacing=0 border=0 width='100%'><tr><td><b>" . _("Reports For Class: ") . "&nbsp;$name</b></td></tr>\n";
                        foreach($this->ar_reports[$class_id] as $rep_id => $report)
                        {
                                $acc = access_string($report->name);
                                $st_reports .= "<tr><td><a class='repopts_link'"
-                                       ." href='".$_SERVER['PHP_SELF']."?Class=$class_id&rep_id=$report->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]</a><tr><td>\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 = "<table><tr><td>\n"
                                                . "<form method='POST' action='$action' target='_blank'>\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).'<br><br>';
                                        $st_params .= $this->getOptions($report->get_controls(), $report->id);
-                                       $st_params .= "\n</form></td></tr></table>\n";
+                                       $st_params .= "\n<input type=hidden name='Class' value=".$cur_class.">"
+                                               ."\n</form></td></tr></table>\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];
index dc027b5ad54e394e48769d76aab17ac07ffe29ea..3f1ece787898c3784891b58ce565764c19c7afbe 100644 (file)
@@ -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");
index 04a55faebea09157ff21fec6d1d998803e841c27..8bd7714ade3d191063e92b355165488b71d4e526 100644 (file)
@@ -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");
index 0247f7cc3539ef3ec2e95ff9c0900d7080e138ba..b78f5596d57c0576b953c5f4b845b7e3a6c34da7 100644 (file)
@@ -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";
index 1c1ee43839ef40cc80b831805a6d3a0222a61af6..79cd401f1dbeab815384eb73017412762447e841 100644 (file)
@@ -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");
index 2eb27559689efe240c53f395c0a60089ea79f773..08a266519af828d753cec24fe9f9759ed9b35143 100644 (file)
@@ -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");
index e6f00ce8c5b46ec372be7e9ac2797e75a21593d0..7ca090d9d043fef8cfa88aad3550104cdb889b38 100644 (file)
@@ -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";
index 61034d3516ac1e86d3d20df493cc8c3f5f2eb04e..21624cf489481b56811fff5291f4c426b4082212 100644 (file)
@@ -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);
index ac59e881f3f35c25ec0f5c55d8d24a2477a97506..a84e53d2babddb8b92da6e10d8816fbbf4756834 100644 (file)
@@ -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']);