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 GL account list and select it to GL account
14 selection in pages that have GL account dropdown lists.
15 Author: bogeyman2007 from Discussion Forum. Modified by Joe Hunt
16 ***********************************************************************/
17 $page_security = "SA_GLACCOUNT";
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 . "/gl/includes/db/gl_db_accounts.inc");
23 $js = get_js_select_combo_item();
25 page(_($help_context = "GL Accounts"), true, false, "", $js);
27 if(get_post("search")) {
28 $Ajax->activate("account_tbl");
31 // Filter form. Use query string so the client_id will not disappear
32 // after ajax form post.
33 start_form(false, false, $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']);
35 start_table(TABLESTYLE_NOBORDER);
39 text_cells(_("Description"), "description");
40 submit_cells("search", _("Search"), "", _("Search GL accounts"), "default");
48 div_start("account_tbl");
50 start_table(TABLESTYLE);
52 $th = array("", _("Account Code"), _("Description"), _("Category"));
57 $name = $_GET["client_id"];
58 $skip = $_GET["skip"];
60 $result = get_chart_accounts_search(get_post("description"), $skip);
61 while ($myrow = db_fetch_assoc($result)) {
62 alt_table_row_color($k);
63 $value = $myrow['account_code'];
64 ahref_cell(_("Select"), 'javascript:void(0)', '', 'selectComboItem(window.opener.document, "'.$name.'", "'.$value.'")');
65 label_cell($myrow["account_code"]);
66 label_cell($myrow["account_name"]);
67 label_cell($myrow["name"]);