2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 /**********************************************************************
13 Page for searching customer list and select it to customer selection
14 in pages that have the supplier dropdown lists.
15 Author: bogeyman2007 from Discussion Forum. Modified by Joe Hunt
16 ***********************************************************************/
17 $page_security = "SA_SALESORDER";
18 $path_to_root = "../..";
19 include_once($path_to_root . "/includes/session.inc");
20 include_once($path_to_root . "/includes/ui.inc");
21 include_once($path_to_root . "/sales/includes/db/customers_db.inc");
23 $mode = get_company_pref('no_customer_list');
25 $js = get_js_set_combo_item();
27 $js = get_js_select_combo_item();
29 page(_($help_context = "Customers"), true, false, "", $js);
31 if(get_post("search")) {
32 $Ajax->activate("customer_tbl");
35 start_form(false, false, $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']);
37 start_table(TABLESTYLE_NOBORDER);
41 text_cells(_("Customer"), "customer");
42 submit_cells("search", _("Search"), "", _("Search customers"), "default");
50 div_start("customer_tbl");
52 start_table(TABLESTYLE);
54 $th = array("", _("Customer"), _("Short Name"), _("Address"), _("Tax ID"));
59 $name = $_GET["client_id"];
60 $result = get_customers_search(get_post("customer"));
61 while ($myrow = db_fetch_assoc($result)) {
62 alt_table_row_color($k);
63 $value = $myrow['debtor_no'];
65 $text = $myrow['name'];
66 ahref_cell(_("Select"), 'javascript:void(0)', '', 'setComboItem(window.opener.document, "'.$name.'", "'.$value.'", "'.$text.'")');
69 ahref_cell(_("Select"), 'javascript:void(0)', '', 'selectComboItem(window.opener.document, "'.$name.'", "'.$value.'")');
71 label_cell($myrow["name"]);
72 label_cell($myrow["debtor_ref"]);
73 label_cell($myrow["address"]);
74 label_cell($myrow["tax_id"]);