$disp_order = $result['disp_order']; // build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('m.id', 'i.sku', 'm.wo_title'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' where ' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\''; } else { $search = ''; } $field_list = array('m.id', 'm.wo_num', 'm.priority', 'm.wo_title', 'i.sku', 'm.qty', 'm.sku_id', 'm.post_date', 'm.closed', 'm.close_date'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " \n\t from " . TABLE_WO_JOURNAL_MAIN . " m inner join " . TABLE_INVENTORY . " i on m.sku_id = i.id" . $search . " order by {$disp_order}, m.closed, m.id DESC"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('wo_main'); define('PAGE_TITLE', BOX_WORK_ORDERS_MODULE); $include_template = 'template_main.php'; break; }
} if ($f2 && $contactID) { $criteria[] = "p.vendor_id = " . $contactID; } // limit to preferred vendor flag // build search filter string $search = sizeof($criteria) > 0 ? ' where ' . implode(' and ', $criteria) : ''; $field_list = array('a.id as id', 'a.sku as sku', 'inactive', 'inventory_type', 'quantity_on_hand', 'quantity_on_order', 'description_short'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS DISTINCT " . implode(', ', $field_list) . " from " . TABLE_INVENTORY . " a LEFT OUTER JOIN " . TABLE_INVENTORY_PURCHASE . " p on a.sku = p.sku " . $search . " order by {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('inv_popup'); // check for auto close (if auto fill is turned on and only one result is found, the data will already be there) $auto_close = INVENTORY_AUTO_FILL && $query_result->RecordCount() == 1 && $_REQUEST['list'] == 1 ? true : false; $auto_close = false; // disable until all modules that use this function are ajax compliant $include_header = false; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', INV_POPUP_WINDOW_TITLE);
$disp_order = $result['disp_order']; // build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('rma_num', 'purchase_invoice_id', 'caller_name', 'caller_telephone1'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' where ' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\''; } else { $search = ''; } $field_list = array('id', 'rma_num', 'purchase_invoice_id', 'status', 'caller_name', 'creation_date', 'closed_date', 'attachments'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_RMA . $search . " order by {$disp_order}, rma_num"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save(); define('PAGE_TITLE', BOX_RMA_MAINTAIN); $include_template = 'template_main.php'; break; }
$disp_order = $result['disp_order']; // build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('task_name', 'description'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' where ' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\''; } else { $search = ''; } $field_list = array('id', 'task_name', 'description'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select " . implode(', ', $field_list) . " from " . TABLE_WO_TASK . $search . " order by {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('wo_poptask'); $include_header = false; $include_footer = false; $include_template = 'template_main.php'; define('PAGE_TITLE', WO_POPUP_TASK_WINDOW_TITLE);
$result->MoveNext(); } // build the list for the page selected $search = ''; if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('sheet_name', 'revision'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' AND (' . implode(" LIKE %'{$_REQUEST['search_text']}%' or ", $search_fields) . " like '%{$_REQUEST['search_text']}%')"; } $field_list = array('id', 'inactive', 'sheet_name', 'revision', 'effective_date', 'expiration_date', 'default_sheet'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "SELECT SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " FROM " . TABLE_PRICE_SHEETS . " WHERE type='{$type}' {$search} ORDER BY {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('inv_prices'); $include_template = 'template_main.php'; define('PAGE_TITLE', $type == 'v' ? BOX_PURCHASE_PRICE_SHEETS : BOX_SALES_PRICE_SHEETS); }
} // inactive flag // build search filter string $search = sizeof($criteria) > 0 ? ' where ' . implode(' and ', $criteria) : ''; $field_list = array('m.id', 'm.inactive', 'm.wo_title', 'i.sku', 'm.sku_id', 'm.description', 'm.revision', 'm.revision_date'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " \n\t from " . TABLE_WO_MAIN . " m inner join " . TABLE_INVENTORY . " i on m.sku_id = i.id" . $search . " order by {$disp_order}, m.revision DESC"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('wo_build'); // build highest rev level list, reset results $rev_list = array(); while (!$query_result->EOF) { $rev_list[$query_result->fields['wo_title']] = max($query_result->fields['revision'], $rev_list[$query_result->fields['wo_title']]); $query_result->MoveNext(); } $query_result->Move(0); $query_result->MoveNext(); define('PAGE_TITLE', BOX_WORK_ORDERS_BUILDER); $include_template = 'template_main.php'; break; }
$disp_order = $result['disp_order']; // build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('bill_primary_name', 'bill_contact', 'bill_address1', 'bill_address2', 'bill_city_town', 'bill_postal_code', 'purchase_invoice_id', 'total_amount'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } $field_list = array('m.id', 'm.bill_acct_id', 'm.bill_primary_name', 'm.purchase_invoice_id', 'm.post_date', 'm.total_amount', 'm.store_id'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " \n\tfrom " . TABLE_JOURNAL_MAIN . " m inner join " . TABLE_CONTACTS . " a on m.bill_acct_id = a.id\n\twhere a.type = '" . (ACCOUNT_TYPE == 'v' ? 'v' : 'c') . "' \n\tand m.journal_id = " . JOURNAL_ID . $period_filter . $search . " order by {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('pb_pop_bills'); $include_header = false; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', constant('ORD_TEXT_' . JOURNAL_ID . '_' . strtoupper(ACCOUNT_TYPE) . '_WINDOW_TITLE'));
// build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('bill_primary_name', 'purchase_invoice_id', 'purch_order_id', 'store_id'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } $field_list = array('id', 'journal_id', 'post_date', 'purchase_invoice_id', 'purch_order_id', 'so_po_ref_id', 'store_id', 'closed', 'waiting', 'bill_primary_name', 'total_amount', 'currencies_code', 'currencies_value'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_JOURNAL_MAIN . " \n where journal_id = " . JOURNAL_ID . $period_filter . $search . " order by {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } $cal_date = array('name' => 'searchdate', 'form' => 'pos_mgr', 'fieldname' => 'search_date', 'imagename' => 'btn_date_1', 'default' => isset($date) ? gen_locale_date($date) : '', 'params' => array('align' => 'left')); history_save('pb_pop_orders'); $include_header = false; $include_footer = false; $include_template = 'template_main.php'; define('PAGE_TITLE', GEN_HEADING_PLEASE_SELECT);
$field_list = array('a.id as id', 'a.sku as sku', 'inactive', 'inventory_type', 'description_short', 'full_price', 'quantity_on_hand', 'quantity_on_order', 'quantity_on_sales_order', 'quantity_on_allocation', 'last_journal_date'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "SELECT SQL_CALC_FOUND_ROWS DISTINCT " . implode(', ', $field_list) . " from " . TABLE_INVENTORY . " a LEFT JOIN " . TABLE_INVENTORY_PURCHASE . " p on a.sku = p.sku " . $search . " order by {$disp_order} "; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('inventory'); //building array's for filter dropdown selection $i = 0; $result = $db->Execute("SELECT * FROM " . TABLE_EXTRA_FIELDS . " WHERE module_id = 'inventory' AND use_in_inventory_filter = '1' ORDER BY description ASC"); $FirstValue = 'var FirstValue = new Array();' . chr(10); $FirstId = 'var FirstId = new Array();' . chr(10); $SecondField = 'var SecondField = new Array();' . chr(10); $SecondFieldValue = 'var SecondFieldValue = new Array();' . chr(10); $SecondFieldId = 'var SecondFieldId = new Array();' . chr(10); while (!$result->EOF) { if (in_array($result->fields['field_name'], array('vendor_id', 'description_purchase', 'item_cost', 'purch_package_quantity', 'purch_taxable', 'price_sheet_v'))) { $append = 'p.'; } else { $append = 'a.'; } $FirstValue .= 'FirstValue[' . $i . '] = "' . $result->fields['description'] . '";' . chr(10);
$disp_order = $result['disp_order']; // build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('admin_name', 'admin_email', 'display_name'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } $field_list = array('admin_id', 'inactive', 'display_name', 'admin_name', 'admin_email'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_USERS . " where \n\t is_role = '1'" . $search . " order by {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('roles'); $include_template = 'template_main.php'; define('PAGE_TITLE', BOX_HEADING_ROLES); }
$disp_order = $result['disp_order']; // build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('i.sku', 'm.purchase_invoice_id', 'i.debit_amount', 'i.credit_amount', 'i.description'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } $field_list = array('m.id', 'm.purchase_invoice_id', 'm.post_date', 'm.store_id', 'i.description', 'i.qty'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " \n\tfrom " . TABLE_JOURNAL_MAIN . " m left join " . TABLE_JOURNAL_ITEM . " i on m.id = i.ref_id \n\twhere i.gl_type = 'asy' and m.journal_id = 14" . $period_filter . $search . " order by {$disp_order}, m.id"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('inv_pop_assy'); $include_header = false; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', GEN_HEADING_PLEASE_SELECT);
if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } if ($_REQUEST['store_id']) { $search .= " and store_id = '{$_REQUEST['store_id']}' "; } // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_JOURNAL_MAIN . " \n\twhere journal_id = " . JOURNAL_ID . $period_filter . $search . " order by {$disp_order}, purchase_invoice_id DESC"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('pb' . JOURNAL_ID); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', sprintf(BOX_STATUS_MGR, $page_title));
$result = build_search_sql($gl_acct_fields, $_SESSION['search_gl_acct_id'], $_SESSION['search_gl_acct_from'], $_SESSION['search_gl_acct_to']); if ($result) { $criteria[] = $result; } $main_fields = array('m.id'); $result = build_search_sql($main_fields, $_SESSION['search_main_id'], $_SESSION['search_main_from'], $_SESSION['search_main_to']); if ($result) { $criteria[] = $result; } $date_prefs = array('fieldname' => 'm.post_date', 'params' => $_SESSION['search_date_id'] . ':' . $_SESSION['search_date_from'] . ':' . $_SESSION['search_date_to']); $temp = gen_build_sql_date($date_prefs['params'], $date_prefs['fieldname']); if ($temp['sql']) { $criteria[] = '(' . $temp['sql'] . ')'; } $crit = $criteria ? " where " . implode(' and ', $criteria) : ''; $query_raw = "select SQL_CALC_FOUND_ROWS distinct m.id, m.journal_id, m.post_date, m.description, m.total_amount, \n\tm.purchase_invoice_id, m.bill_primary_name, m.bill_acct_id \n\tfrom " . TABLE_JOURNAL_MAIN . " m inner join " . TABLE_JOURNAL_ITEM . " i \n\ton m.id = i.ref_id " . $crit . " order by {$disp_order}"; //echo 'sql = '; print_r($query_raw); echo '<br>'; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('pb_search'); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; // include display template (required) define('PAGE_TITLE', HEADING_TITLE_SEARCH_INFORMATION);
} $period_filter = $acct_period == 'all' ? '' : ' and period = ' . $acct_period; if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('purchase_invoice_id', 'total_amount'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } $field_list = array('id', 'post_date', 'purchase_invoice_id', 'total_amount', 'store_id'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_JOURNAL_MAIN . " \n\twhere journal_id = 2" . $period_filter . $search . " order by {$disp_order}, id"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('pb_pop_journal'); $include_header = false; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', GL_ENTRY_TITLE);
// build the list for the page selected if ($acct_period == 'all') { $period_filter = ''; } else { $periods = $db->Execute("select * from " . TABLE_ACCOUNTING_PERIODS . " where period = {$acct_period}"); $start_date = $periods->fields['start_date']; $end_date = $periods->fields['end_date']; $period_filter = " and DATE_FORMAT(lp.date_added,'%Y-%m-%d' ) BETWEEN '{$start_date}' AND '{$end_date}' "; } if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('short_name'); // hook for inserting new search fields to the query criteria. $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } $query_raw = "select SQL_CALC_FOUND_ROWS lp.*, c.short_name, c.contact_last, c.contact_first, c.first_date \n from " . TABLE_CONTACTS . " c, linkpoint_api lp \n where c.id = lp.customer_id {$search} {$period_filter} order by {$disp_order} "; $customers = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('linkpoint'); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', BOX_BANKING_LINK_POINT_CC_REVIEW);
$list_header = $result['html_code']; $disp_order = $result['disp_order']; // build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('admin_name', 'admin_email', 'display_name'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } $field_list = array('admin_id', 'inactive', 'display_name', 'admin_name', 'admin_email'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_USERS . " where is_role = '0'" . $search . " order by {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('users'); $include_template = 'template_main.php'; define('PAGE_TITLE', BOX_HEADING_USERS); }
<?php // save_data.php // Loads historical data from the controller and stores it in the database // uses the controller address, database, username and password from include.php // written by Russell Jorgensen require_once 'include.php'; date_default_timezone_set('Australia/Brisbane'); if (isset($_REQUEST["save"])) { history_save($controller, $db_serv, $db_user, $db_pass, $db); } if (isset($_REQUEST["history"])) { // if ($_REQUEST["history"] == "") history_get($db_serv, $db_user, $db_pass, $db); } // else // history_get($db_serv, $db_user, $db_pass, $db, $_REQUEST["history"]); if (isset($_REQUEST["live"])) { live_get($controller); } if (isset($_REQUEST["r"])) { if ($_REQUEST["r"] == "r1") { relay_set($controller, "r1"); } if ($_REQUEST["r"] == "r2") { relay_set($controller, "r2"); } } /// /// Code Functions. ///
$search_fields = array('i.sku', 'm.purchase_invoice_id', 'i.debit_amount', 'i.credit_amount', 'i.description', 'i.gl_account'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $filters[] = '(' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } $field_list = array('m.id', 'm.purchase_invoice_id', 'm.post_date', 'm.store_id', 'm.bill_acct_id', 'sum(i.qty) as qty', 'i.sku', 'count(i.sku) as sku_cnt', 'i.description'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $filters[] = "i.gl_type = 'adj'"; $filters[] = 'm.journal_id = 16'; $filters[] = $adj_type == 'xfr' ? 'm.so_po_ref_id <> 0 AND i.qty < 0' : 'm.so_po_ref_id = 0'; //if ($adj_type == 'xfr') $filters[] = 'm.bill_acct_id > 0'; // only pull the first record $query_raw = "SELECT SQL_CALC_FOUND_ROWS DISTINCT " . implode(', ', $field_list) . " \n\tFROM " . TABLE_JOURNAL_MAIN . " m JOIN " . TABLE_JOURNAL_ITEM . " i ON m.id = i.ref_id \n\tWHERE " . implode(' AND ', $filters) . " GROUP BY m.id ORDER BY {$disp_order}, m.id"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('inv_pop_adj'); $include_header = false; $include_footer = false; $include_template = 'template_main.php'; define('PAGE_TITLE', GEN_HEADING_PLEASE_SELECT);
$result = html_heading_bar($heading_array); $list_header = $result['html_code']; $disp_order = $result['disp_order']; // build the list for the page selected $search = ''; if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('sku', 'description_short', 'description_sales', 'description_purchase'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' where ' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\''; } $field_list = array('id', 'sku', 'inactive', 'description_short', 'lead_time', 'item_cost', 'full_price', 'minimum_stock_level', 'reorder_quantity'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_INVENTORY . $search . " order by {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('inv_bulk'); $include_template = 'template_main.php'; define('PAGE_TITLE', INV_BULK_SKU_ENTRY_TITLE);
$search_fields = array('bill_primary_name', 'purchase_invoice_id', 'purch_order_id', 'bill_postal_code', 'ship_primary_name', 'total_amount'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } } $field_list = array('id', 'post_date', 'shipper_code', 'purchase_invoice_id', 'total_amount', 'bill_primary_name', 'journal_id', 'currencies_code', 'currencies_value', 'total_amount as new_total_amount'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_JOURNAL_MAIN . " \n\t\twhere journal_id in (19,21) {$period_filter} {$search} order by {$disp_order}, purchase_invoice_id DESC"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('pos_mgr'); $cal_date = array('name' => 'searchdate', 'form' => 'pos_mgr', 'fieldname' => 'search_date', 'imagename' => 'btn_date_1', 'default' => isset($date) ? gen_locale_date($date) : '', 'params' => array('align' => 'left')); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', BOX_POS_MGR);
$disp_order = $result['disp_order']; // build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('asset_id', 'serial_number', 'description_short', 'description_long'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' where ' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\''; } else { $search = ''; } $field_list = array('id', 'asset_id', 'asset_type', 'purch_cond', 'inactive', 'serial_number', 'description_short', 'acquisition_date', 'terminal_date', 'attachments'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_ASSETS . " {$search} order by {$disp_order}, asset_id"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('assets'); define('PAGE_TITLE', BOX_ASSET_MODULE); $include_template = 'template_main.php'; break; }
$disp_order = $result['disp_order']; // build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('task_name', 'description', 'ref_doc', 'ref_spec'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' where ' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\''; } else { $search = ''; } $field_list = array('id', 'task_name', 'description', 'ref_doc', 'ref_spec', 'dept_id', 'mfg', 'qa', 'data_entry'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_WO_TASK . $search . " order by {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('wo_tasks'); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', BOX_WORK_ORDERS_MODULE_TASK);
// build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('c.short_name', 'a.primary_name', 'a.contact', 'a.telephone1', 'a.telephone2', 'a.address1', 'a.address2', 'a.city_town', 'a.postal_code', 'c.account_number'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } $field_list = array('a.address_id', 'c.id', 'a.ref_id', 'a.type', 'a.primary_name', 'a.contact', 'a.address1', 'a.address2', 'a.city_town', 'a.state_province', 'a.postal_code', 'a.country_code', 'c.short_name', 'a.telephone1', 'a.email', 'c.first_date', 'c.last_update', 'c.gl_type_account', 'c.special_terms', 'c.last_date_1', 'c.last_date_2', 'c.inactive'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " \n\tfrom " . TABLE_CONTACTS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.id = a.ref_id \n\twhere a.type = '" . $account_type . "m'" . $search . " order by {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('contacts_popup'); $include_header = false; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', ACT_POPUP_WINDOW_TITLE);
$field_list = array('c.id', 'c.inactive', 'c.short_name', 'c.contact_first', 'c.contact_last', 'a.telephone1', 'c.attachments', 'c.first_date', 'c.last_update', 'c.last_date_1', 'c.last_date_2', 'a.primary_name', 'a.address1', 'a.city_town', 'a.state_province', 'a.postal_code'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " \n\t\t\tfrom " . TABLE_CONTACTS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.id = a.ref_id " . $search . " order by {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('contacts' . $type); $include_template = 'template_main.php'; // include display template (required) switch ($type) { default: define('PAGE_TITLE', constant('ACT_' . strtoupper($type) . '_HEADING_TITLE')); break; case 'b': define('PAGE_TITLE', sprintf(BOX_STATUS_MGR, TEXT_BRANCHES)); break; case 'c': define('PAGE_TITLE', sprintf(BOX_STATUS_MGR, TEXT_CUSTOMER)); break; case 'e': define('PAGE_TITLE', sprintf(BOX_STATUS_MGR, TEXT_EMPLOYEE)); break;
$disp_order = $result['disp_order']; // build the list for the page selected if (isset($_REQUEST['search_text']) && $_REQUEST['search_text'] != '') { $search_fields = array('c.short_name', 'm.bill_primary_name', 'm.bill_contact', 'm.bill_address1', 'm.bill_address2', 'm.bill_city_town', 'm.bill_postal_code', 'm.purchase_invoice_id'); // hook for inserting new search fields to the query criteria. if (is_array($extra_search_fields)) { $search_fields = array_merge($search_fields, $extra_search_fields); } $search = ' and (' . implode(' like \'%' . $_REQUEST['search_text'] . '%\' or ', $search_fields) . ' like \'%' . $_REQUEST['search_text'] . '%\')'; } else { $search = ''; } $field_list = array('m.bill_acct_id', 'm.bill_primary_name', 'm.bill_city_town', 'm.bill_state_province', 'm.bill_postal_code', 'sum(m.total_amount) as ztotal_amount'); // hook to add new fields to the query return results if (is_array($extra_query_list_fields) > 0) { $field_list = array_merge($field_list, $extra_query_list_fields); } $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " \n\tfrom " . TABLE_JOURNAL_MAIN . " m inner join " . TABLE_CONTACTS . " c on m.bill_acct_id = c.id\n\twhere c.type = '" . (ACCOUNT_TYPE == 'v' ? 'v' : 'c') . "' \n\tand m.journal_id in " . (ACCOUNT_TYPE == 'v' ? '(6, 7)' : '(12, 13)') . " and m.closed = '0'" . $search . " \n\tgroup by m.bill_acct_id order by {$disp_order}"; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); if ($query_split->current_page_number != $_REQUEST['list']) { // if here, go last was selected, now we know # pages, requery to get results $_REQUEST['list'] = $query_split->current_page_number; $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS); $query_split = new splitPageResults($_REQUEST['list'], ''); } history_save('pb_pop_contacts'); $include_header = false; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', constant('ORD_TEXT_' . JOURNAL_ID . '_' . strtoupper(ACCOUNT_TYPE) . '_WINDOW_TITLE'));