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); } if ($use_date_picker) { $js .= get_js_date_picker(); } page(_($help_context = "Customer Allocation Inquiry"), false, false, "", $js); if (isset($_GET['customer_id'])) { $_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)
} } unset($inv); } else { display_error(_("Invalid sales invoice number.")); } } } if (list_updated('BranchID')) { // when branch is selected via external editor also customer can change $br = get_branch(get_post('BranchID')); $_POST['customer_id'] = $br['debtor_no']; $Ajax->activate('customer_id'); } if (!isset($_POST['customer_id'])) { $_POST['customer_id'] = get_global_customer(false); } if (!isset($_POST['DateBanked'])) { $_POST['DateBanked'] = new_doc_date(); if (!is_date_in_fiscalyear($_POST['DateBanked'])) { $_POST['DateBanked'] = end_fiscalyear(); } } if (isset($_GET['AddedID'])) { $payment_no = $_GET['AddedID']; display_notification_centered(_("The customer payment has been successfully entered.")); submenu_print(_("&Print This Receipt"), ST_CUSTPAYMENT, $payment_no . "-" . ST_CUSTPAYMENT, 'prtopt'); display_note(get_gl_view_str(ST_CUSTPAYMENT, $payment_no, _("&View the GL Journal Entries for this Customer Payment"))); // hyperlink_params($path_to_root . "/sales/allocations/customer_allocate.php", _("&Allocate this Customer Payment"), "trans_no=$payment_no&trans_type=12"); hyperlink_no_params($path_to_root . "/sales/inquiry/customer_allocation_inquiry.php?customer_id=", _("Select Another &Customer Transaction for Payment")); hyperlink_no_params($path_to_root . "/sales/customer_payments.php", _("Enter Another &Customer Payment"));
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>"; }
} unset($inv); } else { display_error(_("Invalid sales invoice number.")); } } } if (list_updated('BranchID')) { // when branch is selected via external editor also customer can change $br = get_branch(get_post('BranchID')); $_POST['customer_id'] = $br['debtor_no']; $_SESSION['alloc']->person_id = $br['debtor_no']; $Ajax->activate('customer_id'); } if (!isset($_POST['customer_id'])) { $_SESSION['alloc']->person_id = $_POST['customer_id'] = get_global_customer(false); $_SESSION['alloc']->read(); } if (!isset($_POST['DateBanked'])) { $_POST['DateBanked'] = new_doc_date(); if (!is_date_in_fiscalyear($_POST['DateBanked'])) { $_POST['DateBanked'] = end_fiscalyear(); } } if (isset($_GET['AddedID'])) { $payment_no = $_GET['AddedID']; display_notification_centered(_("The customer payment has been successfully entered.")); submenu_print(_("&Print This Receipt"), ST_CUSTPAYMENT, $payment_no . "-" . ST_CUSTPAYMENT, 'prtopt'); submenu_view(_("&View this Customer Payment"), ST_CUSTPAYMENT, $payment_no); submenu_option(_("Enter Another &Customer Payment"), "/sales/customer_payments.php"); submenu_option(_("Enter Other &Deposit"), "/gl/gl_bank.php?NewDeposit=Yes");
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: ") . " "; 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(); }