function customer_search_page($data = array())
{
    global $tpl;
    if (customer_recognize($data['surname'])) {
        return 0;
    }
    $tpl->set_waiter_template_file('standard');
    $tmp = navbar_empty('orders.php');
    $tpl->assign('navbar', $tmp);
    $tmp = '';
    $tmp .= customer_search_form();
    $tmp .= '
	<a href="orders.php?command=customer_insert_form">' . ucfirst(phr('INSERT_NEW')) . '</a><br>
	';
    $tmp .= customer_list($data['surname']);
    $tpl->assign('content', $tmp);
    return 0;
}
Example #2
0
/**
 * 客服列表
 */
function action_list()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    /* 模板赋值 */
    $smarty->assign('full_page', 1);
    $smarty->assign('ur_here', $_LANG['customer_list']);
    $smarty->assign('action_link', array('href' => 'customer.php?act=add', 'text' => $_LANG['add_customer']));
    $result = customer_list();
    $smarty->assign('customer_list', $result['item']);
    $smarty->assign('filter', $result['filter']);
    $smarty->assign('record_count', $result['record_count']);
    $smarty->assign('page_count', $result['page_count']);
    $sort_flag = sort_flag($result['filter']);
    $smarty->assign($sort_flag['tag'], $sort_flag['img']);
    /* 显示客服列表页面 */
    assign_query_info();
    $smarty->display('customer_list.htm');
}
Example #3
0
        $sql = "SELECT COUNT(*) FROM sales_orders WHERE branch_code='" . $_POST['branch_code'] . "' AND debtor_no = '" . $_POST['customer_id'] . "'";
        $result = db_query($sql, "could not query sales orders");
        $myrow = db_fetch_row($result);
        if ($myrow[0] > 0) {
            display_error(tr("Cannot delete this branch because sales orders exist for it. Purge old sales orders first."));
        } else {
            $sql = "DELETE FROM cust_branch WHERE branch_code='" . $_POST['branch_code'] . "' AND debtor_no='" . $_POST['customer_id'] . "'";
            db_query($sql, "could not delete branch");
            meta_forward($_SERVER['PHP_SELF'], "debtor_no=" . $_POST['customer_id']);
        }
    }
    //end ifs to test if the branch can be deleted
}
start_form();
echo "<center>" . tr("Select a customer: ") . "&nbsp;&nbsp;";
customer_list('customer_id', null, false, true);
echo "</center><br><br>";
check_branches();
// we always want to have a branch (if possible)
$num_branches = db_customer_has_branches($_POST['customer_id']);
if ($num_branches) {
    $sql = "SELECT debtors_master.name, cust_branch.*, salesman.salesman_name," . "areas.description, tax_groups.name AS tax_group_name " . "FROM cust_branch, debtors_master, areas, salesman, tax_groups " . "WHERE cust_branch.debtor_no=debtors_master.debtor_no " . "AND cust_branch.tax_group_id=tax_groups.id " . "AND cust_branch.area=areas.area_code " . "AND cust_branch.salesman=salesman.salesman_code " . "AND cust_branch.debtor_no = '" . $_POST['customer_id'] . "'";
    $result = db_query($sql, "could not get customer branches");
    start_table("{$table_style} width=60%");
    $th = array(tr("Name"), tr("Contact"), tr("Sales Person"), tr("Area"), tr("Phone No"), tr("Fax No"), tr("E-mail"), tr("Tax Group"), "", "");
    table_header($th);
    while ($myrow = db_fetch($result)) {
        start_row();
        label_cell($myrow["br_name"]);
        label_cell($myrow["contact_name"]);
        label_cell($myrow["salesman_name"]);
include_once $path_to_root . "/includes/session.inc";
include_once $path_to_root . "/sales/includes/sales_ui.inc";
include_once $path_to_root . "/sales/includes/sales_db.inc";
$js = "";
if ($use_popup_windows) {
    $js .= get_js_open_window(900, 500);
}
page(_($help_context = "Customer Allocations"), false, false, "", $js);
//--------------------------------------------------------------------------------
start_form();
/* show all outstanding receipts and credits to be allocated */
if (!isset($_POST['customer_id'])) {
    $_POST['customer_id'] = get_global_customer();
}
echo "<center>" . _("Select a customer: ") . "&nbsp;&nbsp;";
echo customer_list('customer_id', $_POST['customer_id'], true, true);
echo "<br>";
check(_("Show Settled Items:"), 'ShowSettled', null, true);
echo "</center><br><br>";
set_global_customer($_POST['customer_id']);
if (isset($_POST['customer_id']) && $_POST['customer_id'] == ALL_TEXT) {
    unset($_POST['customer_id']);
}
/*if (isset($_POST['customer_id'])) {
		$custCurr = get_customer_currency($_POST['customer_id']);
		if (!is_company_currency($custCurr))
			echo _("Customer Currency:") . $custCurr;
	}*/
$settled = false;
if (check_value('ShowSettled')) {
    $settled = true;
function display_allocatable_transactions()
{
    global $table_style, $path_to_root;
    start_form();
    /* show all outstanding receipts and credits to be allocated */
    /*Clear any previous allocation records */
    if (isset($_SESSION['alloc'])) {
        unset($_SESSION['alloc']->allocs);
        unset($_SESSION['alloc']);
    }
    if (!isset($_POST['customer_id'])) {
        $_POST['customer_id'] = get_global_customer();
    }
    echo "<center>" . tr("Select a customer: ") . "&nbsp;&nbsp;";
    customer_list('customer_id', $_POST['customer_id'], true, true);
    echo "<br>";
    check(tr("Show Settled Items:"), 'ShowSettled', null, true);
    echo "</center><br><br>";
    set_global_customer($_POST['customer_id']);
    if (isset($_POST['customer_id']) && $_POST['customer_id'] == reserved_words::get_all()) {
        unset($_POST['customer_id']);
    }
    /*if (isset($_POST['customer_id'])) {
    		$custCurr = get_customer_currency($_POST['customer_id']);
    		if (!is_company_currency($custCurr))
    			echo tr("Customer Currency:") . $custCurr;
    	}*/
    $settled = false;
    if (check_value('ShowSettled')) {
        $settled = true;
    }
    $customer_id = null;
    if (isset($_POST['customer_id'])) {
        $customer_id = $_POST['customer_id'];
    }
    $trans_items = get_allocatable_from_cust_transactions($customer_id, $settled);
    start_table($table_style);
    if (!isset($_POST['customer_id'])) {
        $th = array(tr("Transaction Type"), tr("#"), tr("Reference"), tr("Date"), tr("Customer"), tr("Currency"), tr("Total"), tr("Left To Allocate"), "");
    } else {
        $th = array(tr("Transaction Type"), tr("#"), tr("Reference"), tr("Date"), tr("Total"), tr("Left To Allocate"), "");
    }
    table_header($th);
    $k = 0;
    //row colour counter
    $has_settled_items = false;
    while ($myrow = db_fetch($trans_items)) {
        if ($myrow["settled"] == 1) {
            start_row("class='settledbg'");
            $has_settled_items = true;
        } else {
            alt_table_row_color($k);
        }
        label_cell(systypes::name($myrow["type"]));
        label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"]));
        label_cell($myrow["reference"]);
        label_cell(sql2date($myrow["tran_date"]));
        if (!isset($_POST['customer_id'])) {
            label_cell($myrow["DebtorName"]);
            label_cell($myrow["curr_code"]);
        }
        amount_cell($myrow["Total"]);
        amount_cell($myrow["Total"] - $myrow["alloc"]);
        if ($myrow["Total"] - $myrow["alloc"] != 0.0) {
            label_cell("<a href='{$path_to_root}/sales/allocations/customer_allocate.php?trans_no=" . $myrow["trans_no"] . "&trans_type=" . $myrow["type"] . "'>" . tr("Allocate") . "</a>");
        } else {
            label_cell("");
        }
        end_row();
    }
    end_table();
    if ($has_settled_items) {
        display_note(tr("Marked items are settled."), 0, 1, "class='settledfg'");
    }
    if (db_num_rows($trans_items) == 0) {
        display_note(tr("There are no allocations to be done."), 1, 2);
    }
    end_form();
}
 function customer_list_row($label, $name, $selected_id = null, $all_option = false, $submit_on_change = false, $show_inactive = false, $editkey = false)
 {
     global $path_to_root;
     View::get()->layoutHintRow();
     $controlAsString = customer_list($name, $selected_id, $all_option, $submit_on_change, $show_inactive, $editkey);
     View::get()->addControl(View::controlFromRenderedString(View::CONTROL_COMBO, $label, $controlAsString));
 }