示例#1
0
function display_controls()
{
    global $table_style2;
    start_form(false, true);
    if (!isset($_POST['supplier_id'])) {
        $_POST['supplier_id'] = get_global_supplier(false);
    }
    if (!isset($_POST['DatePaid'])) {
        $_POST['DatePaid'] = Today();
        if (!is_date_in_fiscalyear($_POST['DatePaid'])) {
            $_POST['DatePaid'] = end_fiscalyear();
        }
    }
    start_table($table_style2, 5, 7);
    echo "<tr><td valign=top>";
    // outer table
    echo "<table>";
    bank_accounts_list_row(tr("From Bank Account:"), 'bank_account', null, true);
    amount_row(tr("Amount of Payment:"), 'amount');
    amount_row(tr("Amount of Discount:"), 'discount');
    date_row(tr("Date Paid") . ":", 'DatePaid');
    echo "</table>";
    echo "</td><td valign=top class='tableseparator'>";
    // outer table
    echo "<table>";
    supplier_list_row(tr("Payment To:"), 'supplier_id', null, false, true);
    set_global_supplier($_POST['supplier_id']);
    $supplier_currency = get_supplier_currency($_POST['supplier_id']);
    $bank_currency = get_bank_account_currency($_POST['bank_account']);
    if ($bank_currency != $supplier_currency) {
        exchange_rate_display($bank_currency, $supplier_currency, $_POST['DatePaid']);
    }
    bank_trans_types_list_row(tr("Payment Type:"), 'PaymentType', null);
    ref_row(tr("Reference:"), 'ref', references::get_next(22));
    text_row(tr("Memo:"), 'memo_', null, 52, 50);
    echo "</table>";
    echo "</td></tr>";
    end_table(1);
    // outer table
    submit_center('ProcessSuppPayment', tr("Enter Payment"));
    if ($bank_currency != $supplier_currency) {
        display_note(tr("The amount and discount are in the bank account's currency."), 2, 0);
    }
    end_form();
}
示例#2
0
    meta_forward($_SERVER['PHP_SELF'], "AddedID={$payment_id}&supplier_id=" . $_POST['supplier_id']);
}
//----------------------------------------------------------------------------------------
if (isset($_POST['ProcessSuppPayment'])) {
    /*First off  check for valid inputs */
    if (check_inputs() == true) {
        handle_add_payment();
        end_page();
        exit;
    }
}
//----------------------------------------------------------------------------------------
start_form();
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);
    $_POST['suppliers_uom'] = $myrow["suppliers_uom"];
    $_POST['supplier_description'] = $myrow["supplier_description"];
    $_POST['conversion_factor'] = maxprec_format($myrow["conversion_factor"]);
}
br();
hidden('selected_id', $selected_id);
if (@$_GET['popup']) {
    hidden('_tabs_sel', get_post('_tabs_sel'));
    hidden('popup', @$_GET['popup']);
}
start_table(TABLESTYLE2);
if ($Mode == 'Edit') {
    hidden('supplier_id');
    label_row(_("Supplier:"), $supp_name);
} else {
    supplier_list_row(_("Supplier:"), 'supplier_id', null, false, true);
    $_POST['price'] = $_POST['suppliers_uom'] = $_POST['conversion_factor'] = $_POST['supplier_description'] = "";
}
amount_row(_("Price:"), 'price', null, '', get_supplier_currency($selected_id), $dec2);
text_row(_("Suppliers Unit of Measure:"), 'suppliers_uom', null, 50, 51);
if (!isset($_POST['conversion_factor']) || $_POST['conversion_factor'] == "") {
    $_POST['conversion_factor'] = maxprec_format(1);
}
amount_row(_("Conversion Factor (to our UOM):"), 'conversion_factor', maxprec_format($_POST['conversion_factor']), null, null, 'max');
text_row(_("Supplier's Code or Description:"), 'supplier_description', null, 50, 51);
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
if (!@$_GET['popup']) {
    end_form();
    end_page(@$_GET['popup'], false, false);
}
}
payment_person_types_list_row($payment ? _("Pay To:") : _("From:"), 'PayType', $_POST['PayType'], true);
switch ($_POST['PayType']) {
    case PT_MISC:
        text_row_ex($payment ? _("To the Order of:") : _("Name:"), 'person_id', 40, 50);
        textarea_row(_("Address:"), 'address', '', 40, 3);
        //moodlearning
        break;
        //case PT_WORKORDER :
        //	workorders_list_row(_("Work Order:"), 'person_id', null);
        //	break;
    //case PT_WORKORDER :
    //	workorders_list_row(_("Work Order:"), 'person_id', null);
    //	break;
    case PT_SUPPLIER:
        supplier_list_row(_("Supplier:"), 'person_id', null, false, true, false, true);
        break;
    case PT_CUSTOMER:
        customer_list_row(_("Customer:"), 'person_id', null, false, true, false, true);
        if (db_customer_has_branches($_POST['person_id'])) {
            customer_branches_list_row(_("Branch:"), $_POST['person_id'], 'PersonDetailID', null, false, true, true, true);
        } else {
            $_POST['PersonDetailID'] = ANY_NUMERIC;
            hidden('PersonDetailID');
        }
        $trans = get_customer_habit($_POST['person_id']);
        // take care of customers on hold
        if ($trans['dissallow_invoices'] != 0) {
            if ($payment) {
                $customer_error = true;
                display_error(_("This customer account is on hold."));