예제 #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
    $js .= get_js_open_window(900, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
add_js_file('payalloc.js');
page(_($help_context = "Supplier Payment Entry"), false, false, "", $js);
if (isset($_GET['supplier_id'])) {
    $_POST['supplier_id'] = $_GET['supplier_id'];
}
//----------------------------------------------------------------------------------------
check_db_has_suppliers(_("There are no suppliers defined in the system."));
check_db_has_bank_accounts(_("There are no bank accounts defined in the system."));
//----------------------------------------------------------------------------------------
if (!isset($_POST['supplier_id'])) {
    $_POST['supplier_id'] = get_global_supplier(false);
}
if (!isset($_POST['DatePaid'])) {
    $_POST['DatePaid'] = new_doc_date();
    if (!is_date_in_fiscalyear($_POST['DatePaid'])) {
        $_POST['DatePaid'] = end_fiscalyear();
    }
}
if (isset($_POST['_DatePaid_changed'])) {
    $Ajax->activate('_ex_rate');
}
if (list_updated('supplier_id')) {
    $_POST['amount'] = price_format(0);
    $_SESSION['alloc']->person_id = get_post('supplier_id');
    $Ajax->activate('amount');
} elseif (list_updated('bank_account')) {
예제 #3
0
}
if (isset($_GET['supplier_id'])) {
    $_POST['supplier_id'] = $_GET['supplier_id'];
}
if (isset($_GET['FromDate'])) {
    $_POST['TransAfterDate'] = $_GET['FromDate'];
}
if (isset($_GET['ToDate'])) {
    $_POST['TransToDate'] = $_GET['ToDate'];
}
//------------------------------------------------------------------------------------------------
if (!@$_GET['popup']) {
    start_form();
}
if (!isset($_POST['supplier_id'])) {
    $_POST['supplier_id'] = get_global_supplier();
}
start_table(TABLESTYLE_NOBORDER);
start_row();
if (!@$_GET['popup']) {
    supplier_list_cells(_("Select a supplier:"), 'supplier_id', null, true, false, false, !@$_GET['popup']);
}
date_cells(_("From:"), 'TransAfterDate', '', null, -30);
date_cells(_("To:"), 'TransToDate');
supp_transactions_list_cell("filterType", null, true);
submit_cells('RefreshInquiry', _("Search"), '', _('Refresh Inquiry'), 'default');
end_row();
end_table();
set_global_supplier($_POST['supplier_id']);
//------------------------------------------------------------------------------------------------
function display_supplier_summary($supplier_record)
예제 #4
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['supplier_id'])) {
        $_POST['supplier_id'] = get_global_supplier();
    }
    echo "<center>" . tr("Select a Supplier: ") . "&nbsp;&nbsp;";
    supplier_list('supplier_id', $_POST['supplier_id'], true, true);
    echo "<br>";
    check(tr("Show Settled Items:"), 'ShowSettled', null, true);
    echo "</center><br><br>";
    set_global_supplier($_POST['supplier_id']);
    if (isset($_POST['supplier_id']) && $_POST['supplier_id'] == reserved_words::get_all()) {
        unset($_POST['supplier_id']);
    }
    $settled = false;
    if (check_value('ShowSettled')) {
        $settled = true;
    }
    $supplier_id = null;
    if (isset($_POST['supplier_id'])) {
        $supplier_id = $_POST['supplier_id'];
    }
    $trans_items = get_allocatable_from_supp_transactions($supplier_id, $settled);
    start_table($table_style);
    if (!isset($_POST['supplier_id'])) {
        $th = array(tr("Transaction Type"), tr("#"), tr("Reference"), tr("Date"), tr("Supplier"), 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['supplier_id'])) {
            label_cell($myrow["supp_name"]);
            label_cell($myrow["curr_code"]);
        }
        amount_cell(-$myrow["Total"]);
        amount_cell(-$myrow["Total"] - $myrow["alloc"]);
        label_cell("<a href='{$path_to_root}/purchasing/allocations/supplier_allocate.php?trans_no=" . $myrow["trans_no"] . "&trans_type=" . $myrow["type"] . "'>" . tr("Allocate") . "</a>");
        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();
}