config.php
config_db.php
!index.php
+/gl/inquiry/accounts_list.php
$path_to_root="..";
include($path_to_root . "/includes/session.inc");
-page(_($help_context = "System and General GL Setup"));
+$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+ $js .= get_js_open_window(900, 500);
+
+page(_($help_context = "System and General GL Setup"), false, false, "", $js);
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
If not defined $comp_path/%s/backup/ is used.
*/
// $backup_path = dirname(__FILE__).'/company/%s/backup/';
+
+/*
+ Optional popup search enabled if this is true.
+ $max_rows_in_search = 10 is used for maximum rows in search
+*/
+ $use_popup_search = true;
+ $max_rows_in_search = 10;
--- /dev/null
+<?php
+/**********************************************************************
+ Page for searching GL account list and select it to GL account
+ selection in page that has GL account dropdown list.
+***********************************************************************/
+$page_security = "SA_GLACCOUNT";
+$path_to_root = "../..";
+include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/includes/ui.inc");
+
+$js = get_js_select_combo_item();
+
+page(_($help_context = "GL Accounts"), true, false, "", $js);
+
+if (isset($SysPrefs->max_rows_in_search))
+ $limit = $SysPrefs->max_rows_in_search;
+else
+ $limit = 10;
+
+// Activate Ajax on form submit
+if(get_post("search")) {
+ $Ajax->activate("account_tbl");
+}
+
+// BEGIN: Filter form. Use query string so the client_id will not disappear
+// after ajax form post.
+start_form(false, false, $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']);
+
+start_table(TABLESTYLE_NOBORDER);
+
+start_row();
+
+text_cells(_("Description"), "description");
+submit_cells("search", _("Search"), "", _("Search GL accounts"), "default");
+
+end_row();
+
+end_table();
+
+end_form();
+// END: Filter form
+
+// BEGIN: Account list
+div_start("account_tbl");
+
+start_table(TABLESTYLE);
+
+$th = array("", _("Account Code"), _("Description"), _("Category"));
+
+table_header($th);
+
+// Query based on function gl_all_accounts_list in includes/ui/ui_lists.inc.
+$sql = "SELECT chart.account_code, chart.account_name, type.name
+ FROM ".TB_PREF."chart_master chart,".TB_PREF."chart_types type
+ WHERE chart.account_type=type.id
+ AND (
+ chart.account_code LIKE " . db_escape("%" . get_post("description"). "%") . " OR
+ chart.account_name LIKE " . db_escape("%" . get_post("description"). "%") . " OR
+ chart.account_code LIKE " . db_escape("%" . get_post("description"). "%") . "
+ )
+ ORDER BY chart.account_code LIMIT 0, $limit"; // We only display 10 items.
+$result = db_query($sql, "Failed in retreiving GL account list.");
+
+$k = 0; //row colour counter
+$name = $_GET["client_id"];
+while ($myrow = db_fetch_assoc($result)) {
+ alt_table_row_color($k);
+ $value = $myrow['account_code'];
+ ahref_cell(_("Select"), 'javascript:void(0)', '', 'selectComboItem(window.opener.document, "'.$name.'", "'.$value.'")');
+ label_cell($myrow["account_code"]);
+ label_cell($myrow["account_name"]);
+ label_cell($myrow["name"]);
+ end_row();
+}
+
+end_table(1);
+
+div_end();
+// END: Account list
+
+end_page(true);
\ No newline at end of file
$path_to_root = "../..";
include($path_to_root . "/includes/session.inc");
-page(_($help_context = "Chart of Accounts"));
+$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+ $js .= get_js_open_window(900, 500);
+
+page(_($help_context = "Chart of Accounts"), false, false, "", $js);
include($path_to_root . "/includes/ui.inc");
include($path_to_root . "/gl/includes/gl_db.inc");
if (!$this->time_zone)
$this->time_zone = 'Europe/Berlin';
+
+ if (!isset($this->use_popup_search))
+ $this->use_popup_search = false;
ini_set('date.timezone', $this->time_zone);
}
global $path_to_root;
if (basename($icon) === $icon) // standard icons does not contain path separator
$icon = "$path_to_root/themes/".user_theme()."/images/$icon";
- return "<img src='$icon' width='12' height='12' border='0'".($title ? " title='$title'" : "")." >\n";
+ return "<img src='$icon' style='vertical-align:middle;width:12px;height:12px;border:0;'".($title ? " title='$title'" : "")." >\n";
}
function button($name, $value, $title=false, $icon=false, $aspect='')
."</a>", $parms);
}
+function ahref($label, $href, $target="", $onclick="") {
+ echo "<a href='$href' target='$target' onclick='$onclick'>$label</a>";
+}
+
+function ahref_cell($label, $href, $target="", $onclick="") {
+ echo "<td align='center'> ";
+ ahref($label, $href, $target, $onclick);
+ echo " </td>";
+}
// Options are merged with defaults.
function combo_input($name, $selected_id, $sql, $valfield, $namefield,
- $options=null)
+ $options=null, $type=null)
{
-global $Ajax;
+global $Ajax, $path_to_root, $SysPrefs ;
$opts = array( // default options
'where'=> array(), // additional constraints
$_POST[$name] = $multi ? $selected_id : $selected_id[0];
- $selector = "<select autocomplete='off' ".($multi ? "multiple" : '')
+ if ($SysPrefs->use_popup_search)
+ $selector = "<select id='$name' autocomplete='off' ".($multi ? "multiple" : '')
+ . ($opts['height']!==false ? ' size="'.$opts['height'].'"' : '')
+ . "$disabled name='$name".($multi ? '[]':'')."' class='$class' title='"
+ . $opts['sel_hint']."' $rel>".$selector."</select>\n";
+ else
+ $selector = "<select autocomplete='off' ".($multi ? "multiple" : '')
. ($opts['height']!==false ? ' size="'.$opts['height'].'"' : '')
. "$disabled name='$name".($multi ? '[]':'')."' class='$class' title='"
. $opts['sel_hint']."' $rel>".$selector."</select>\n";
-
if ($by_id && ($search_box != false || $opts['editable']) ) {
// on first display show selector list
if (isset($_POST[$search_box]) && $opts['editable'] && $edit) {
}
default_focus(($search_box && $by_id) ? $search_box : $name);
+ if ($SysPrefs->use_popup_search)
+ {
+ $img = "";
+ $img_title = "";
+ $link = "";
+ $id = $name;
+ if ($SysPrefs->use_popup_windows) {
+ //_vd("type= $type");
+ switch (strtolower($type)) {
+ case "stock":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=all&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "stock_manufactured":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=manufactured&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "stock_purchased":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=purchasable&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "stock_sales":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=sales&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "stock_costable":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=costable&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "kits":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=kits&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "assets":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=assets&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "customer":
+ $link = $path_to_root . "/sales/inquiry/customers_list.php?popup=1&client_id=" . $id;
+ $img_title = _("Search customers");
+ break;
+ case "branch":
+ $link = $path_to_root . "/sales/inquiry/customer_branches_list.php?popup=1&client_id=" . $id . "#customer_id";
+ $img_title = _("Search branches");
+ break;
+ case "supplier":
+ $link = $path_to_root . "/purchasing/inquiry/suppliers_list.php?popup=1&client_id=" . $id;
+ $img_title = _("Search suppliers");
+ break;
+ case "account":
+ $link = $path_to_root . "/gl/inquiry/accounts_list.php?popup=1&client_id=" . $id;
+ $img_title = _("Search GL accounts");
+ break;
+ }
+ }
+
+ if ($link !=="") {
+ $theme = user_theme();
+ $img = '<img src="'.$path_to_root.'/themes/'.$theme.'/images/'.ICON_VIEW.
+ '" style="vertical-align:middle;width:12px;height:12px;border:0;" onclick="javascript:lookupWindow("'.
+ $link.'", "");" title="' . $img_title . '" style="cursor:pointer;" />';
+ }
+ }
+
if ($opts['editlink'])
$selector .= ' '.$opts['editlink'];
- if ($search_box && $opts['cells'])
- $str = ($edit_entry!='' ? "<td>$edit_entry</td>" : '')."<td>$selector</td>";
+ if ($SysPrefs->use_popup_search)
+ {
+ if ($search_box && $opts['cells'])
+ $str = ($edit_entry!='' ? "<td>$edit_entry</td>" : '')."<td>$selector$img</td>";
+ else
+ $str = $edit_entry.$selector.$img;
+ }
else
- $str = $edit_entry.$selector;
+ {
+ if ($search_box && $opts['cells'])
+ $str = ($edit_entry!='' ? "<td>$edit_entry</td>" : '')."<td>$selector</td>";
+ else
+ $str = $edit_entry.$selector;
+ }
return $str;
}
_('Select supplier'),
'show_inactive'=>$all,
'editlink' => $editkey ? add_edit_combo('supplier') : false
- ));
+ ), "supplier");
return $ret;
}
_('Select customer'),
'show_inactive' => $show_inactive,
'editlink' => $editkey ? add_edit_combo('customer') : false
- ) );
+ ), "customer" );
return $ret;
}
'select_submit'=> $submit_on_change,
'sel_hint' => _('Select customer branch'),
'editlink' => $editkey ? add_edit_combo('branch') : false
- ) );
+ ), "branch" );
return $ret;
}
//------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
function stock_items_list($name, $selected_id=null, $all_option=false,
- $submit_on_change=false, $opts=array(), $editkey = false)
+ $submit_on_change=false, $opts=array(), $editkey = false, $type = "stock")
{
-
$sql = "SELECT stock_id, s.description, c.description, s.inactive, s.editable
FROM ".TB_PREF."stock_master s,".TB_PREF."stock_category c WHERE s.category_id=c.category_id";
if ($editkey)
set_editor('item', $name, $editkey);
+ if (isset($opts['fixed_asset']) && $opts['fixed_asset'])
+ $type = 'assets';
$ret = combo_input($name, $selected_id, $sql, 'stock_id', 's.description',
array_merge(
array(
'editlink' => $editkey ? add_edit_combo('item') : false,
'editable' => false,
'max' => 255
- ), $opts) );
+ ), $opts), $type );
return $ret;
}
'order' => array('c.description','i.item_code'),
'editable' => 30,
'max' => 255
- ), $opts) );
+ ), $opts), $type == 'kits' ? $type : "stock_sales" );
}
function sales_items_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false, $editkey=false)
$all_option=false, $submit_on_change=false)
{
return stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("mb_flag= 'M'")));
+ array('where'=>array("mb_flag= 'M'")), false, "stock_manufactured");
}
function stock_manufactured_items_list_cells($label, $name, $selected_id=null,
$all_option=false, $submit_on_change=false)
{
return stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("mb_flag!='D'")));
+ array('where'=>array("mb_flag!='D'")), false, "stock_costable");
}
function stock_costable_items_list_cells($label, $name, $selected_id=null,
if ($label != null)
echo "<td>$label</td>\n";
echo stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("mb_flag!='D'"), 'cells'=>true));
+ array('where'=>array("mb_flag!='D'"), 'cells'=>true), false, "stock_costable");
}
//------------------------------------------------------------------------------------
{
return stock_items_list($name, $selected_id, $all_option, $submit_on_change,
array('where'=>array("NOT no_purchase"),
- 'show_inactive'=>$all), $editkey);
+ 'show_inactive'=>$all), $editkey, "stock_purchased");
}
//
// This helper is used in PO/GRN/PI entry and supports editable descriptions.
'async' => false,
'category' => 2,
'show_inactive' => $all
- ) );
+ ), "account" );
}
function _format_account($row)
. " var top = (screen.height - $height) / 2;\n"
. " return window.open(url, title, 'width=$width,height=$height,left='+left+',top='+top+',screenX='+left+',screenY='+top+',status=no,scrollbars=yes');\n"
. "}\n";
+ $js .= get_js_lookup_window();
+ return $js;
+}
+
+function get_js_lookup_window() {
+ $js = "function lookupWindow(url, title) {
+ var u = url.split('#');
+ if (u.length == 2) {
+ var element = document.getElementById(u[1]);
+ var options = element.options;
+ url = u[0] + '&' + u[1] + '=' + options[element.selectedIndex].value;
+ }
+ openWindow(url, title);
+ }";
+ return $js;
+}
+
+function get_js_select_combo_item() {
+ $js = "function selectComboItem(doc, client_id, value){
+ var element = doc.getElementById(client_id);
+ var options = element.options;
+ for (var i = 0, optionsLength = options.length; i < optionsLength; i++) {
+ if (options[i].value == value) {
+ element.selectedIndex = i;
+ element.onchange();
+ }
+ }
+ window.close();
+ }";
+ return $js;
+}
+/* for space search option */
+function get_js_set_combo_item() {
+ $js = "function setComboItem(doc, client_id, value, text){
+ var element = doc.getElementById(client_id);
+ var options = element.options;
+ options.length = 0;
+ var option = doc.createElement('option');
+ option.value = value;
+ option.text = text;
+ element.add(option, 0);
+ element.selectedIndex = 0;
+ element.onchange();
+ window.close();
+ }";
return $js;
}
--- /dev/null
+<?php
+/**********************************************************************
+ Page for searching item list and select it to item selection
+ in sales order and purchase order.
+***********************************************************************/
+$page_security = "SA_ITEM";
+$path_to_root = "../..";
+include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/includes/ui.inc");
+
+$mode = get_company_pref('no_item_list');
+if ($mode != 0)
+ $js = get_js_set_combo_item();
+else
+ $js = get_js_select_combo_item();
+
+page(_($help_context = "Items"), true, false, "", $js);
+
+if (isset($SysPrefs->max_rows_in_search))
+ $limit = $SysPrefs->max_rows_in_search;
+else
+ $limit = 10;
+
+// Activate Ajax on form submit
+if(get_post("search")) {
+ $Ajax->activate("item_tbl");
+}
+
+// BEGIN: Filter form. Use query string so the client_id will not disappear
+// after ajax form post.
+start_form(false, false, $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']);
+
+start_table(TABLESTYLE_NOBORDER);
+
+start_row();
+
+text_cells(_("Description"), "description");
+submit_cells("search", _("Search"), "", _("Search items"), "default");
+
+end_row();
+
+end_table();
+
+end_form();
+// END: Filter form
+
+// BEGIN: Link to add new item
+// hyperlink_params($path_to_root . "/inventory/manage/items.php", _("Add new"), "popup=1");
+// END: Link to add new item
+
+// BEGIN: Item list
+div_start("item_tbl");
+
+start_table(TABLESTYLE);
+
+$th = array("", _("Item Code"), _("Description"), _("Category"));
+
+table_header($th);
+
+// Query based on function sales_items_list in includes/ui/ui_lists.inc.
+$sql = "SELECT COUNT(i.item_code) AS kit, i.item_code, i.description, c.description category
+ FROM
+ ".TB_PREF."stock_master s,
+ ".TB_PREF."item_codes i
+ LEFT JOIN
+ ".TB_PREF."stock_category c
+ ON i.category_id=c.category_id
+ WHERE i.stock_id=s.stock_id
+ AND !i.inactive AND !s.inactive
+ AND ( i.item_code LIKE " . db_escape("%" . get_post("description"). "%") . " OR
+ i.description LIKE " . db_escape("%" . get_post("description"). "%") . " OR
+ c.description LIKE " . db_escape("%" . get_post("description"). "%") . ") ";
+
+$type = "";
+if (isset($_GET['type'])) {
+ $type = $_GET['type'];
+}
+//_vd("type = $type");
+switch ($type) {
+ case "sales":
+ $sql .= " AND !s.no_sale AND mb_flag != 'F'";
+ break;
+ case "manufactured":
+ $sql .= " AND mb_flag = 'M'";
+ break;
+ case "purchasable":
+ $sql .= " AND NOT no_purchase AND mb_flag != 'F' AND i.item_code=i.stock_id";
+ break;
+ case "costable":
+ $sql .= " AND mb_flag != 'D' AND mb_flag != 'F' AND i.item_code=i.stock_id";
+ break;
+ case "assets":
+ $sql .= " AND mb_flag = 'F'";
+ break;
+ case "kits":
+ $sql .= " AND !i.is_foreign AND i.item_code!=i.stock_id AND mb_flag != 'F'";
+ break;
+ case "all":
+ $sql .= " AND mb_flag != 'F' AND i.item_code=i.stock_id";
+ // NOTHING TO DO.
+ break;
+}
+
+$sql .= " GROUP BY i.item_code ORDER BY i.description LIMIT 0, $limit"; // We only display 10 items.
+//_vd($sql);
+$result = db_query($sql, "Failed in retreiving item list.");
+
+$k = 0; //row colour counter
+$name = $_GET["client_id"];
+while ($myrow = db_fetch_assoc($result)) {
+ alt_table_row_color($k);
+ $value = $myrow['item_code'];
+ if ($mode != 0) {
+ $text = $myrow['description'];
+ ahref_cell(_("Select"), 'javascript:void(0)', '', 'setComboItem(window.opener.document, "'.$name.'", "'.$value.'", "'.$text.'")');
+ }
+ else {
+ ahref_cell(_("Select"), 'javascript:void(0)', '', 'selectComboItem(window.opener.document, "'.$name.'", "'.$value.'")');
+ }
+ label_cell($myrow["item_code"]);
+ label_cell($myrow["description"]);
+ label_cell($myrow["category"]);
+ end_row();
+}
+
+end_table(1);
+
+div_end();
+// END: Item list
+
+end_page(true);
$path_to_root = "../..";
include_once($path_to_root . "/includes/session.inc");
-page(_($help_context = "Inventory Item Status"), isset($_GET['stock_id']));
+$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+ $js .= get_js_open_window(900, 500);
if (isset($_GET['stock_id']))
$_POST['stock_id'] = $_GET['stock_id'];
+page(_($help_context = "Inventory Item Status"), isset($_GET['stock_id']), false, "", $js);
+
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/data_checks.inc");
$help_context = "Item Categories";
}
-page(_($help_context));
+$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+ $js .= get_js_open_window(900, 500);
+
+page(_($help_context), false, false, "", $js);
include_once($path_to_root . "/includes/ui.inc");
$path_to_root = "../..";
include_once($path_to_root . "/includes/session.inc");
-page(_($help_context = "Foreign Item Codes"));
+$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+ $js .= get_js_open_window(900, 500);
+
+page(_($help_context = "Foreign Item Codes"), false, false, "", $js);
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
$path_to_root = "../..";
include_once($path_to_root . "/includes/session.inc");
-page(_($help_context = "Sales Kits & Alias Codes"));
+$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+ $js .= get_js_open_window(900, 500);
+
+page(_($help_context = "Sales Kits & Alias Codes"), false, false, "", $js);
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/data_checks.inc");
include_once($path_to_root . "/inventory/includes/inventory_db.inc");
-page(_($help_context = "Inventory Item Sales prices"));
+$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+ $js .= get_js_open_window(900, 500);
+page(_($help_context = "Inventory Item Sales prices"), false, false, "", $js);
//---------------------------------------------------------------------------------------------------
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/data_checks.inc");
-page(_($help_context = "Supplier Purchasing Data"));
+$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+ $js .= get_js_open_window(900, 500);
+page(_($help_context = "Supplier Purchasing Data"), false, false, "", $js);
check_db_has_purchasable_items(_("There are no purchasable inventory items defined in the system."));
check_db_has_suppliers(_("There are no suppliers defined in the system."));
include_once($path_to_root . "/includes/data_checks.inc");
include_once($path_to_root . "/inventory/includes/inventory_db.inc");
-page(_($help_context = "Reorder Levels"));
+$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+ $js .= get_js_open_window(900, 500);
+page(_($help_context = "Reorder Levels"), false, false, "", $js);
check_db_has_costable_items(_("There are no inventory items defined in the system (Purchased or manufactured items)."));
--- /dev/null
+<?php
+/**********************************************************************
+ Page for searching item list and select it to item selection
+ in sales order and purchase order.
+***********************************************************************/
+$page_security = "SA_PURCHASEORDER";
+$path_to_root = "../..";
+include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/includes/ui.inc");
+
+$mode = get_company_pref('no_supplier_list');
+if ($mode != 0)
+ $js = get_js_set_combo_item();
+else
+ $js = get_js_select_combo_item();
+
+page(_($help_context = "Suppliers"), true, false, "", $js);
+
+if (isset($SysPrefs->max_rows_in_search))
+ $limit = $SysPrefs->max_rows_in_search;
+else
+ $limit = 10;
+
+// Activate Ajax on form submit
+if(get_post("search")) {
+ $Ajax->activate("supplier_tbl");
+}
+
+// BEGIN: Filter form. Use query string so the client_id will not disappear
+// after ajax form post.
+start_form(false, false, $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']);
+
+start_table(TABLESTYLE_NOBORDER);
+
+start_row();
+
+text_cells(_("Supplier"), "supplier");
+submit_cells("search", _("Search"), "", _("Search suppliers"), "default");
+
+end_row();
+
+end_table();
+
+end_form();
+// END: Filter form
+
+// BEGIN: Link to add new supplier
+// hyperlink_params($path_to_root . "/purchasing/manage/suppliers.php", _("Add new"), "popup=1");
+// END: Link to add new supplier
+
+// BEGIN: Supplier list
+div_start("supplier_tbl");
+
+start_table(TABLESTYLE);
+
+$th = array("", _("Supplier"), _("Short Name"), _("Address"), _("Tax ID"));
+
+table_header($th);
+
+// Query based on function supplier_list in includes/ui/ui_lists.inc.
+$sql = "SELECT supplier_id, supp_name, supp_ref, address, gst_no FROM ".TB_PREF."suppliers
+ WHERE (supp_name LIKE " . db_escape("%" . get_post("supplier"). "%") . " OR
+ supp_ref LIKE " . db_escape("%" . get_post("supplier"). "%") . " OR
+ address LIKE " . db_escape("%" . get_post("supplier"). "%") . " OR
+ gst_no LIKE " . db_escape("%" . get_post("supplier"). "%") . ")
+ ORDER BY supp_name LIMIT 0, $limit"; // We only display 10 items.
+$result = db_query($sql, "Failed in retreiving supplier list.");
+
+$k = 0; //row colour counter
+$name = $_GET["client_id"];
+while ($myrow = db_fetch_assoc($result)) {
+ alt_table_row_color($k);
+ $value = $myrow['supplier_id'];
+ if ($mode != 0) {
+ $text = $myrow['supp_name'];
+ ahref_cell(_("Select"), 'javascript:void(0)', '', 'setComboItem(window.opener.document, "'.$name.'", "'.$value.'", "'.$text.'")');
+ }
+ else {
+ ahref_cell(_("Select"), 'javascript:void(0)', '', 'selectComboItem(window.opener.document, "'.$name.'", "'.$value.'")');
+ }
+ label_cell($myrow["supp_name"]);
+ label_cell($myrow["supp_ref"]);
+ label_cell($myrow["address"]);
+ label_cell($myrow["gst_no"]);
+ end_row();
+}
+
+end_table(1);
+
+div_end();
+// END: Supplier list
+
+end_page(true);
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/reporting/includes/reports_classes.inc");
$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+ $js .= get_js_open_window(900, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
--- /dev/null
+<?php
+/**********************************************************************
+ Page for searching item list and select it to item selection
+ in sales order and purchase order.
+***********************************************************************/
+$page_security = "SA_SALESORDER";
+$path_to_root = "../..";
+include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/includes/ui.inc");
+
+$js = get_js_select_combo_item();
+
+if (isset($SysPrefs->max_rows_in_search))
+ $limit = $SysPrefs->max_rows_in_search;
+else
+ $limit = 10;
+
+page(_($help_context = "Customer Branches"), true, false, "", $js);
+
+// Activate Ajax on form submit
+if(get_post("search")) {
+ $Ajax->activate("customer_branch_tbl");
+}
+
+// BEGIN: Filter form. Use query string so the client_id will not disappear
+// after ajax form post.
+start_form(false, false, $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']);
+
+start_table(TABLESTYLE_NOBORDER);
+
+start_row();
+
+text_cells(_("Branch"), "branch");
+submit_cells("search", _("Search"), "", _("Search branches"), "default");
+
+end_row();
+
+end_table();
+
+end_form();
+// END: Filter form
+
+// BEGIN: Link to add new customer branch
+// hyperlink_params($path_to_root . "/sales/manage/customer_branches.php", _("Add new"), "debtor_no=" . strip_tags($_GET["SelectedBranch"]) . "&popup=1");
+// END: Link to add new customer branch
+
+// BEGIN: Customer branches list
+div_start("customer_branch_tbl");
+
+start_table(TABLESTYLE);
+
+$th = array("", _("Ref"), _("Branch"), _("Contact"), _("Phone"));
+
+table_header($th);
+
+// Query based on function get_sql_for_customer_branches in includes/db/branches_db.inc.
+$sql = "SELECT
+ b.branch_code,
+ b.branch_ref,
+ b.br_name,
+ p.name as contact_name,
+ p.phone
+ FROM ".TB_PREF."cust_branch b
+ LEFT JOIN ".TB_PREF."crm_contacts c
+ ON c.entity_id=b.branch_code AND c.type='cust_branch' AND c.action='general'
+ LEFT JOIN ".TB_PREF."crm_persons p
+ on c.person_id=p.id
+ WHERE b.debtor_no = ".db_escape($_GET["customer_id"])."
+ AND b.br_name LIKE " . db_escape("%" . get_post("branch"). "%") . "
+ ORDER BY b.br_name LIMIT 0, $limit"; // We only display 10 items.
+
+$result = db_query($sql, "Failed in retreiving branches list.");
+
+$k = 0; //row colour counter
+$name = $_GET["client_id"];
+while ($myrow = db_fetch_assoc($result))
+{
+ alt_table_row_color($k);
+ $value = $myrow['branch_code'];
+ ahref_cell(_("Select"), 'javascript:void(0)', '', 'selectComboItem(window.opener.document, "'.$name.'", "'.$value.'")');
+ label_cell($myrow["branch_ref"]);
+ label_cell($myrow["br_name"]);
+ label_cell($myrow["contact_name"]);
+ label_cell($myrow["phone"]);
+ end_row();
+}
+
+end_table(1);
+
+div_end();
+// END: Customer list
+
+end_page(true);
--- /dev/null
+<?php
+/**********************************************************************
+ Page for searching item list and select it to item selection
+ in sales order and purchase order.
+***********************************************************************/
+$page_security = "SA_SALESORDER";
+$path_to_root = "../..";
+include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/includes/ui.inc");
+
+$mode = get_company_pref('no_customer_list');
+if ($mode != 0)
+ $js = get_js_set_combo_item();
+else
+ $js = get_js_select_combo_item();
+
+page(_($help_context = "Customers"), true, false, "", $js);
+
+if (isset($SysPrefs->max_rows_in_search))
+ $limit = $SysPrefs->max_rows_in_search;
+else
+ $limit = 10;
+
+// Activate Ajax on form submit
+if(get_post("search")) {
+ $Ajax->activate("customer_tbl");
+}
+
+// BEGIN: Filter form. Use query string so the client_id will not disappear
+// after ajax form post.
+start_form(false, false, $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']);
+
+start_table(TABLESTYLE_NOBORDER);
+
+start_row();
+
+text_cells(_("Customer"), "customer");
+submit_cells("search", _("Search"), "", _("Search customers"), "default");
+
+end_row();
+
+end_table();
+
+end_form();
+// END: Filter form
+
+// BEGIN: Link to add new customer
+// hyperlink_params($path_to_root . "/sales/manage/customers.php", _("Add new"), "popup=1");
+// END: Link to add new customer
+
+// BEGIN: Customer list
+div_start("customer_tbl");
+
+start_table(TABLESTYLE);
+
+$th = array("", _("Customer"), _("Short Name"), _("Address"), _("Tax ID"));
+
+table_header($th);
+
+// Query based on function customer_list in includes/ui/ui_lists.inc.
+
+$sql = "SELECT debtor_no, name, debtor_ref, address, tax_id FROM ".TB_PREF."debtors_master
+ WHERE ( name LIKE " . db_escape("%" . get_post("customer"). "%") . " OR
+ debtor_ref LIKE " . db_escape("%" . get_post("customer"). "%") . " OR
+ address LIKE " . db_escape("%" . get_post("customer"). "%") . " OR
+ tax_id LIKE " . db_escape("%" . get_post("customer") . "%").")
+ ORDER BY name LIMIT 0, $limit"; // We only display 10 items.
+$result = db_query($sql, "Failed in retreiving customer list.");
+
+$k = 0; //row colour counter
+$name = $_GET["client_id"];
+while ($myrow = db_fetch_assoc($result)) {
+ alt_table_row_color($k);
+ $value = $myrow['debtor_no'];
+ if ($mode != 0) {
+ $text = $myrow['name'];
+ ahref_cell(_("Select"), 'javascript:void(0)', '', 'setComboItem(window.opener.document, "'.$name.'", "'.$value.'", "'.$text.'")');
+ }
+ else {
+ ahref_cell(_("Select"), 'javascript:void(0)', '', 'selectComboItem(window.opener.document, "'.$name.'", "'.$value.'")');
+ }
+ label_cell($myrow["name"]);
+ label_cell($myrow["debtor_ref"]);
+ label_cell($myrow["address"]);
+ label_cell($myrow["tax_id"]);
+ end_row();
+}
+
+end_table(1);
+
+div_end();
+// END: Customer list
+
+end_page(true);
include($path_to_root . "/includes/db_pager.inc");
include($path_to_root . "/includes/session.inc");
-page(_($help_context = "Customer Branches"), @$_REQUEST['popup']);
+$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+ $js .= get_js_open_window(900, 500);
+
+page(_($help_context = "Customer Branches"), @$_REQUEST['popup'], false, "", $js);
include($path_to_root . "/includes/ui.inc");
include($path_to_root . "/includes/ui/contacts_view.inc");