Exemplo n.º 1
0
function gl_payment_controls()
{
    global $Refs;
    $home_currency = get_company_currency();
    start_form();
    start_outer_table(TABLESTYLE2);
    table_section(1);
    bank_accounts_list_row(_("From Account:"), 'FromBankAccount', null, true);
    bank_balance_row($_POST['FromBankAccount']);
    bank_accounts_list_row(_("To Account:"), 'ToBankAccount', null, true);
    if (!isset($_POST['DatePaid'])) {
        // init page
        $_POST['DatePaid'] = new_doc_date();
        if (!is_date_in_fiscalyear($_POST['DatePaid'])) {
            $_POST['DatePaid'] = end_fiscalyear();
        }
    }
    date_row(_("Transfer Date:"), 'DatePaid', '', true, 0, 0, 0, null, true);
    ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKTRANSFER));
    table_section(2);
    $from_currency = get_bank_account_currency($_POST['FromBankAccount']);
    $to_currency = get_bank_account_currency($_POST['ToBankAccount']);
    if ($from_currency != "" && $to_currency != "" && $from_currency != $to_currency) {
        amount_row(_("Amount:"), 'amount', null, null, $from_currency);
        amount_row(_("Bank Charge:"), 'charge', null, null, $from_currency);
        amount_row(_("Incoming Amount:"), 'target_amount', null, '', $to_currency, 2);
    } else {
        amount_row(_("Amount:"), 'amount');
        amount_row(_("Bank Charge:"), 'charge');
    }
    textarea_row(_("Memo:"), 'memo_', null, 40, 4);
    end_outer_table(1);
    // outer table
    submit_center('AddPayment', _("Enter Transfer"), true, '', 'default');
    end_form();
}
Exemplo n.º 2
0
start_outer_table(TABLESTYLE2, "width='60%'", 5);
table_section(1);
supplier_list_row(_("Payment To:"), 'supplier_id', null, false, true);
if (list_updated('supplier_id') || list_updated('bank_account')) {
    $_SESSION['alloc']->read();
    $_POST['memo_'] = $_POST['amount'] = '';
    $Ajax->activate('alloc_tbl');
}
set_global_supplier($_POST['supplier_id']);
if (!list_updated('bank_account') && !get_post('__ex_rate_changed')) {
    $_POST['bank_account'] = get_default_supplier_bank_account($_POST['supplier_id']);
} else {
    $_POST['amount'] = price_format(0);
}
bank_accounts_list_row(_("From Bank Account:"), 'bank_account', null, true);
bank_balance_row($_POST['bank_account']);
table_section(2);
date_row(_("Date Paid") . ":", 'DatePaid', '', true, 0, 0, 0, null, true);
ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_SUPPAYMENT));
table_section(3);
$comp_currency = get_company_currency();
$supplier_currency = $_SESSION['alloc']->set_person($_POST['supplier_id'], PT_SUPPLIER);
if (!$supplier_currency) {
    $supplier_currency = $comp_currency;
}
$_SESSION['alloc']->currency = $bank_currency = get_bank_account_currency($_POST['bank_account']);
if ($bank_currency != $supplier_currency) {
    amount_row(_("Bank Amount:"), 'bank_amount', null, '', $bank_currency);
}
amount_row(_("Bank Charge:"), 'charge', null, '', $bank_currency);
end_outer_table(1);