コード例 #1
0
function display_item_form()
{
    global $table_style2;
    start_table($table_style2, 5, 7);
    echo "<tr><td valign=top>";
    // outer table
    echo "<table>";
    if (!isset($_POST['customer_id'])) {
        $_POST['customer_id'] = get_global_customer(false);
    }
    if (!isset($_POST['DateBanked'])) {
        $_POST['DateBanked'] = Today();
        if (!is_date_in_fiscalyear($_POST['DateBanked'])) {
            $_POST['DateBanked'] = end_fiscalyear();
        }
    }
    customer_list_row(tr("From Customer:"), 'customer_id', null, false, true);
    if (db_customer_has_branches($_POST['customer_id'])) {
        customer_branches_list_row(tr("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true);
    } else {
        hidden('BranchID', reserved_words::get_any_numeric());
    }
    read_customer_data();
    set_global_customer($_POST['customer_id']);
    if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) {
        echo "</table></table>";
        display_note(tr("This customer account is on hold."), 0, 0, "class='redfb'");
    } else {
        $display_discount_percent = percent_format($_POST['pymt_discount'] * 100) . "%";
        amount_row(tr("Amount:"), 'amount');
        amount_row(tr("Amount of Discount:"), 'discount');
        label_row(tr("Customer prompt payment discount :"), $display_discount_percent);
        date_row(tr("Date of Deposit:"), 'DateBanked');
        echo "</table>";
        echo "</td><td valign=top class='tableseparator'>";
        // outer table
        echo "<table>";
        bank_accounts_list_row(tr("Into Bank Account:"), 'bank_account', null, true);
        $cust_currency = get_customer_currency($_POST['customer_id']);
        $bank_currency = get_bank_account_currency($_POST['bank_account']);
        if ($cust_currency != $bank_currency) {
            exchange_rate_display($cust_currency, $bank_currency, $_POST['DateBanked']);
        }
        bank_trans_types_list_row(tr("Type:"), 'ReceiptType', null);
        text_row(tr("Reference:"), 'ref', null, 20, 40);
        textarea_row(tr("Memo:"), 'memo_', null, 22, 4);
        echo "</table>";
        echo "</td></tr>";
        end_table();
        // outer table
        if ($cust_currency != $bank_currency) {
            display_note(tr("Amount and discount are in customer's currency."));
        }
        echo "<br>";
        submit_center('AddPaymentItem', tr("Add Payment"));
    }
    echo "<br>";
}
コード例 #2
0
    $_POST['customer_id'] = $_GET['customer_id'];
}
//------------------------------------------------------------------------------------------------
if (!isset($_POST['customer_id'])) {
    $_POST['customer_id'] = get_global_customer();
}
start_form();
start_table(TABLESTYLE_NOBORDER);
start_row();
customer_list_cells(_("Select a customer: "), 'customer_id', $_POST['customer_id'], true);
date_cells(_("from:"), 'TransAfterDate', '', null, -30);
date_cells(_("to:"), 'TransToDate', '', null, 1);
cust_allocations_list_cells(_("Type:"), 'filterType', null);
check_cells(" " . _("show settled:"), 'showSettled', null);
submit_cells('RefreshInquiry', _("Search"), '', _('Refresh Inquiry'), 'default');
set_global_customer($_POST['customer_id']);
end_row();
end_table();
//------------------------------------------------------------------------------------------------
function check_overdue($row)
{
    return $row['OverDue'] == 1 && abs($row["TotalAmount"]) - $row["Allocated"] != 0;
}
function order_link($row)
{
    return $row['order_'] > 0 ? get_customer_trans_view_str(ST_SALESORDER, $row['order_']) : "";
}
function systype_name($dummy, $type)
{
    global $systypes_array;
    return $systypes_array[$type];
コード例 #3
0
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();
}