config.php
config_db.php
!index.php
-/gl/inquiry/accounts_list.php
} else
return false;
}
+
+function get_chart_accounts_search($like)
+{
+ global $SysPrefs;
+
+ if (isset($SysPrefs->max_rows_in_search))
+ $limit = $SysPrefs->max_rows_in_search;
+ else
+ $limit = 10;
+
+
+ $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_name LIKE " . db_escape("%" . $like. "%") . " OR
+ chart.account_code LIKE " . db_escape("%" . $like. "%") . "
+ )
+ ORDER BY chart.account_code LIMIT 0,".(int)($limit); // We only display 10 items.
+ return db_query($sql, "Failed in retreiving GL account list.");
+}
$path_to_root = "../..";
include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/ui.inc");
+include_once($path_to_root . "/gl/includes/db/gl_db_accounts.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
+// 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']);
end_table();
end_form();
-// END: Filter form
-// BEGIN: Account list
div_start("account_tbl");
start_table(TABLESTYLE);
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_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
+$k = 0;
$name = $_GET["client_id"];
+
+$result = get_chart_accounts_search(get_post("description"));
while ($myrow = db_fetch_assoc($result)) {
alt_table_row_color($k);
$value = $myrow['account_code'];
end_table(1);
div_end();
-// END: Account list
-
-end_page(true);
\ No newline at end of file
+end_page(true);
$msg = $err; break;
}
}
- if ($msg == '') {
+ if ($msg == '') {
$kits = get_where_used($stock_id);
$num_kits = db_num_rows($kits);
}
return $msg;
}
+
+function get_items_search($description, $type)
+{
+ global $SysPrefs;
+
+ $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("%" . $description. "%") . " OR
+ i.description LIKE " . db_escape("%" . get_post("description"). "%") . " OR
+ c.description LIKE " . db_escape("%" . get_post("description"). "%") . ") ";
+
+ 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 "component":
+ $parent = $_GET['parent'];
+ $sql .= " AND i.item_code=i.stock_id AND i.stock_id <> '$parent' 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";
+ break;
+ }
+
+ if (isset($SysPrefs->max_rows_in_search))
+ $limit = $SysPrefs->max_rows_in_search;
+ else
+ $limit = 10;
+
+ $sql .= " GROUP BY i.item_code ORDER BY i.description LIMIT 0,".(int)($limit);
+
+ return db_query($sql, "Failed in retreiving item list.");
+}
+
$path_to_root = "../..";
include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/ui.inc");
+include_once($path_to_root . "/inventory/includes/db/items_db.inc");
$mode = get_company_pref('no_item_list');
if ($mode != 0)
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);
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'];
-}
-
-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 "component":
- $parent = $_GET['parent'];
- $sql .= " AND i.item_code=i.stock_id AND i.stock_id <> '$parent' 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.
-
-$result = db_query($sql, "Failed in retreiving item list.");
-
-$k = 0; //row colour counter
+$k = 0;
$name = $_GET["client_id"];
-while ($myrow = db_fetch_assoc($result)) {
+$result = get_items_search(get_post("description"), @$_GET['type']);
+
+while ($myrow = db_fetch_assoc($result))
+{
alt_table_row_color($k);
$value = $myrow['item_code'];
if ($mode != 0) {
end_table(1);
div_end();
-// END: Item list
-
end_page(true);
return $myrow[0];
}
+function get_suppliers_search($supplier)
+{
+ global $SysPrefs;
+
+ if (isset($SysPrefs->max_rows_in_search))
+ $limit = $SysPrefs->max_rows_in_search;
+ else
+ $limit = 10;
+
+ $sql = "SELECT supplier_id, supp_name, supp_ref, address, gst_no
+ FROM ".TB_PREF."suppliers
+ WHERE (supp_name LIKE " . db_escape("%" . $supplier. "%") . " OR
+ supp_ref LIKE " . db_escape("%" . $supplier. "%") . " OR
+ address LIKE " . db_escape("%" . $supplier. "%") . " OR
+ gst_no LIKE " . db_escape("%" . $supplier. "%") . ")
+ ORDER BY supp_name LIMIT 0,".(int)($limit);
+
+ return db_query($sql, "Failed in retreiving supplier list.");
+}
+
$path_to_root = "../..";
include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/ui.inc");
+include_once($path_to_root . "/purchasing/includes/db/suppliers_db.inc");
$mode = get_company_pref('no_supplier_list');
if ($mode != 0)
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);
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);
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
+$k = 0;
$name = $_GET["client_id"];
+$result = get_suppliers_search(get_post("supplier"));
while ($myrow = db_fetch_assoc($result)) {
alt_table_row_color($k);
$value = $myrow['supplier_id'];
}
end_table(1);
-
div_end();
-// END: Supplier list
-
end_page(true);
return db_fetch($result);
}
+function get_branches_search($customer, $branch)
+{
+ global $SysPrefs;
+
+ if (isset($SysPrefs->max_rows_in_search))
+ $limit = $SysPrefs->max_rows_in_search;
+ else
+ $limit = 10;
+
+ $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($customer)."
+ AND b.br_name LIKE " . db_escape("%" . $branch. "%") . "
+ ORDER BY b.br_name LIMIT 0,".(int)($limit);
+
+ return db_query($sql, "Failed in retreiving branches list.");
+}
+
return $myrow[0];
}
+function get_customers_search($customer)
+{
+ global $SysPrefs;
+
+ if (isset($SysPrefs->max_rows_in_search))
+ $limit = $SysPrefs->max_rows_in_search;
+ else
+ $limit = 10;
+
+ $sql = "SELECT debtor_no, name, debtor_ref, address, tax_id FROM ".TB_PREF."debtors_master
+ WHERE ( name LIKE " . db_escape("%" . $customer. "%") . " OR
+ debtor_ref LIKE " . db_escape("%" . $customer. "%") . " OR
+ address LIKE " . db_escape("%" . $customer. "%") . " OR
+ tax_id LIKE " . db_escape("%" . $customer. "%").")
+ ORDER BY name LIMIT 0,".(int)($limit);
+
+ return db_query($sql, "Failed in retreiving customer list.");
+}
$path_to_root = "../..";
include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/ui.inc");
+include_once($path_to_root . "/sales/includes/db/branches_db.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);
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
+$k = 0;
$name = $_GET["client_id"];
+$result = get_branches_search($_GET["customer_id"], get_post("branch"));
while ($myrow = db_fetch_assoc($result))
{
alt_table_row_color($k);
end_table(1);
div_end();
-// END: Customer list
-
end_page(true);
$path_to_root = "../..";
include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/ui.inc");
+include_once($path_to_root . "/sales/includes/db/customers_db.inc");
$mode = get_company_pref('no_customer_list');
if ($mode != 0)
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);
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);
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
+$k = 0;
$name = $_GET["client_id"];
+$result = get_customers_search(get_post("customer"));
while ($myrow = db_fetch_assoc($result)) {
alt_table_row_color($k);
$value = $myrow['debtor_no'];
end_table(1);
div_end();
-// END: Customer list
end_page(true);