function handle_new_order() { if (isset($_SESSION['transfer_items'])) { $_SESSION['transfer_items']->clear_items(); unset($_SESSION['transfer_items']); } $_SESSION['transfer_items'] = new items_cart(ST_LOCTRANSFER); $_POST['AdjDate'] = new_doc_date(); if (!is_date_in_fiscalyear($_POST['AdjDate'])) { $_POST['AdjDate'] = end_fiscalyear(); } $_SESSION['transfer_items']->tran_date = $_POST['AdjDate']; }
function handle_new_order() { if (isset($_SESSION['transfer_items'])) { $_SESSION['transfer_items']->clear_items(); unset($_SESSION['transfer_items']); } session_register("transfer_items"); $_SESSION['transfer_items'] = new items_cart(); $_POST['AdjDate'] = Today(); if (!is_date_in_fiscalyear($_POST['AdjDate'])) { $_POST['AdjDate'] = end_fiscalyear(); } $_SESSION['transfer_items']->tran_date = $_POST['AdjDate']; }
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(); }
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(); }
function create_cart($type, $trans_no) { global $Refs; if (isset($_SESSION['pay_items'])) { unset($_SESSION['pay_items']); } $cart = new items_cart($type); $cart->order_id = $trans_no; if ($trans_no) { $bank_trans = db_fetch(get_bank_trans($type, $trans_no)); $_POST['bank_account'] = $bank_trans["bank_act"]; $_POST['PayType'] = $bank_trans["person_type_id"]; if ($bank_trans["person_type_id"] == PT_CUSTOMER) { $trans = get_customer_trans($trans_no, $type); $_POST['person_id'] = $trans["debtor_no"]; $_POST['PersonDetailID'] = $trans["branch_code"]; } elseif ($bank_trans["person_type_id"] == PT_SUPPLIER) { $trans = get_supp_trans($trans_no, $type); $_POST['person_id'] = $trans["supplier_id"]; } elseif ($bank_trans["person_type_id"] == PT_MISC) { $_POST['person_id'] = $bank_trans["person_id"]; } elseif ($bank_trans["person_type_id"] == PT_QUICKENTRY) { $_POST['person_id'] = $bank_trans["person_id"]; } else { $_POST['person_id'] = $bank_trans["person_id"]; } $cart->memo_ = get_comments_string($type, $trans_no); $cart->tran_date = sql2date($bank_trans['trans_date']); $cart->reference = $Refs->get($type, $trans_no); $cart->original_amount = $bank_trans['amount']; $result = get_gl_trans($type, $trans_no); if ($result) { while ($row = db_fetch($result)) { if (is_bank_account($row['account'])) { // date exchange rate is currenly not stored in bank transaction, // so we have to restore it from original gl amounts $ex_rate = $bank_trans['amount'] / $row['amount']; } else { $date = $row['tran_date']; $cart->add_gl_item($row['account'], $row['dimension_id'], $row['dimension2_id'], $row['amount'], $row['memo_']); } } } // apply exchange rate foreach ($cart->gl_items as $line_no => $line) { $cart->gl_items[$line_no]->amount *= $ex_rate; } } else { $cart->reference = $Refs->get_next($cart->trans_type); $cart->tran_date = new_doc_date(); if (!is_date_in_fiscalyear($cart->tran_date)) { $cart->tran_date = end_fiscalyear(); } } $_POST['memo_'] = $cart->memo_; $_POST['ref'] = $cart->reference; $_POST['date_'] = $cart->tran_date; $_SESSION['pay_items'] =& $cart; }
start_row(); if (!isset($_POST['Location'])) { $_POST['Location'] = $_SESSION['Items']->Location; } label_cell(_("Delivery From"), "class='tableheader2'"); locations_list_cells(null, 'Location', null, false, true); if (!isset($_POST['ship_via'])) { $_POST['ship_via'] = $_SESSION['Items']->ship_via; } label_cell(_("Shipping Company"), "class='tableheader2'"); shippers_list_cells(null, 'ship_via', $_POST['ship_via']); // set this up here cuz it's used to calc qoh if (!isset($_POST['DispatchDate']) || !is_date($_POST['DispatchDate'])) { $_POST['DispatchDate'] = new_doc_date(); if (!is_date_in_fiscalyear($_POST['DispatchDate'])) { $_POST['DispatchDate'] = end_fiscalyear(); } } date_cells(_("Date"), 'DispatchDate', '', $_SESSION['Items']->trans_no == 0, 0, 0, 0, "class='tableheader2'"); end_row(); end_table(); echo "</td><td>"; // outer table start_table(TABLESTYLE, "width=90%"); if (!isset($_POST['due_date']) || !is_date($_POST['due_date'])) { $_POST['due_date'] = get_invoice_duedate($_SESSION['Items']->payment, $_POST['DispatchDate']); } text_cells(_("Delivery #"), 'custom_num', '', null, "class='tableheader2'"); //moodlearning customer_credit_row($_SESSION['Items']->customer_id, $_SESSION['Items']->credit, "class='tableheader2'"); // 2010-09-03 Joe Hunt
} } } 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")); display_footer_exit(); } elseif (isset($_GET['UpdatedID'])) { $payment_no = $_GET['UpdatedID']; display_notification_centered(_("The customer payment has been successfully updated.")); submenu_print(_("&Print This Receipt"), ST_CUSTPAYMENT, $payment_no . "-" . ST_CUSTPAYMENT, 'prtopt');
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')) { $Ajax->activate('alloc_tbl'); } //---------------------------------------------------------------------------------------- if (!isset($_POST['bank_account'])) { // first page call
display_notification_centered(_("This work order has been closed. There can be no more issues against it.") . " #{$id}"); safe_exit(); } //--------------------------------------------------------------------------------------- function safe_exit() { global $path_to_root; hyperlink_no_params("", _("Enter a new work order")); hyperlink_no_params("search_work_orders.php", _("Select an existing work order")); display_footer_exit(); } //------------------------------------------------------------------------------------- if (!isset($_POST['date_'])) { $_POST['date_'] = new_doc_date(); if (!is_date_in_fiscalyear($_POST['date_'])) { $_POST['date_'] = end_fiscalyear(); } } function can_process() { global $selected_id, $SysPrefs, $Refs; if (!isset($selected_id)) { if (!$Refs->is_valid($_POST['wo_ref'])) { display_error(_("You must enter a reference.")); set_focus('wo_ref'); return false; } if (!is_new_reference($_POST['wo_ref'], ST_WORKORDER)) { display_error(_("The entered reference is already in use.")); set_focus('wo_ref'); return false;
function create_cart($type = 0, $trans_no = 0) { global $Refs; if (isset($_SESSION['journal_items'])) { unset($_SESSION['journal_items']); } $cart = new items_cart($type); $cart->order_id = $trans_no; if ($trans_no) { $result = get_gl_trans($type, $trans_no); if ($result) { while ($row = db_fetch($result)) { if ($row['amount'] == 0) { continue; } $date = $row['tran_date']; $cart->add_gl_item($row['account'], $row['dimension_id'], $row['dimension2_id'], $row['amount'], $row['memo_']); } } $cart->memo_ = get_comments_string($type, $trans_no); $cart->tran_date = sql2date($date); $cart->reference = $Refs->get($type, $trans_no); $_POST['ref_original'] = $cart->reference; // Store for comparison when updating } else { $cart->reference = $Refs->get_next(0); $cart->tran_date = new_doc_date(); if (!is_date_in_fiscalyear($cart->tran_date)) { $cart->tran_date = end_fiscalyear(); } $_POST['ref_original'] = -1; } $_POST['memo_'] = $cart->memo_; $_POST['ref'] = $cart->reference; $_POST['date_'] = $cart->tran_date; $_SESSION['journal_items'] =& $cart; }
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>"; }
$_POST['dimension_id'] = $_SESSION['Items']->dimension_id; dimensions_list_cells(null, 'dimension_id', null, true, ' ', false, 1, false); } else { hidden('dimension_id', 0); } end_row(); start_row(); if (!isset($_POST['ship_via'])) { $_POST['ship_via'] = $_SESSION['Items']->ship_via; } label_cell(_("Shipping Company"), "class='tableheader2'"); shippers_list_cells(null, 'ship_via', $_POST['ship_via']); if (!isset($_POST['InvoiceDate']) || !is_date($_POST['InvoiceDate'])) { $_POST['InvoiceDate'] = new_doc_date(); if (!is_date_in_fiscalyear($_POST['InvoiceDate'])) { $_POST['InvoiceDate'] = end_fiscalyear(); } } date_cells(_("Date"), 'InvoiceDate', '', $_SESSION['Items']->trans_no == 0, 0, 0, 0, "class='tableheader2'", true); if (!isset($_POST['due_date']) || !is_date($_POST['due_date'])) { $_POST['due_date'] = get_invoice_duedate($_SESSION['Items']->payment, $_POST['InvoiceDate']); } date_cells(_("Due Date"), 'due_date', '', null, 0, 0, 0, "class='tableheader2'"); /* if ($dim > 1) label_cells(_("Dimension"). " 2", get_dimension_string($_SESSION['Items']->dimension2_id), "class='tableheader2'"); else if ($dim > 0) label_cell(" ", "colspan=2"); */ if ($dim > 1) { label_cell(_("Dimension") . " 2:", "class='tableheader2'");
function create_cart($type = 0, $trans_no = 0) { global $Refs; if (isset($_SESSION['disbursement_items'])) { unset($_SESSION['disbursement_items']); } $cart = new items_cart($type); $cart->order_id = $trans_no; if ($trans_no) { $result = get_gl_trans($type, $trans_no); $_POST['PayType'] = $res["person_type_id"]; if ($res["person_type_id"] == PT_CUSTOMER) { $trans = get_customer_trans($trans_no, $type); $_POST['person_id'] = $trans["debtor_no"]; $_POST['PersonDetailID'] = $trans["branch_code"]; } elseif ($res["person_type_id"] == PT_SUPPLIER) { $trans = get_supp_trans($trans_no, $type); $_POST['person_id'] = $trans["supplier_id"]; } elseif ($res["person_type_id"] == PT_MISC) { $_POST['person_id'] = $res["person_id"]; } elseif ($res["person_type_id"] == PT_QUICKENTRY) { $_POST['person_id'] = $res["person_id"]; } else { $_POST['person_id'] = $res["person_id"]; } if ($result) { while ($row = db_fetch($result)) { if ($row['amount'] == 0) { continue; } $date = $row['tran_date']; $cart->add_gl_item($row['account'], $row['dimension_id'], $row['dimension2_id'], $row['amount'], $row['memo_']); } } $cart->memo_ = get_comments_string($type, $trans_no); $cart->tran_date = sql2date($date); if ($type == ST_DISBURSEMENT) { $voucher_type = 'Check Voucher'; $cart->reference = $Refs->get(ST_DISBURSEMENT, $trans_no); } if ($type == ST_SUPPAYMENT) { $cart->reference = $Refs->get_next(ST_DISBURSEMENT); } $_POST['ref_original'] = $cart->reference; // Store for comparison when updating } else { $cart->reference = $Refs->get_next(ST_DISBURSEMENT); $cart->tran_date = new_doc_date(); if (!is_date_in_fiscalyear($cart->tran_date)) { $cart->tran_date = end_fiscalyear(); } $_POST['ref_original'] = -1; } $_POST['memo_'] = $cart->memo_; $_POST['ref'] = $cart->reference; $_POST['date_'] = $cart->tran_date; $_POST['cv_no'] = $cart->custom_no; /**========MOODLEARNING=======*/ $_POST['address'] = $cart->address; $_POST['check_num'] = $cart->check_num; $_POST['PayType'] = $cart->person_id; $_POST['person_id'] = $cart->person_detail_id; $_POST['settled_amount'] = $cart->settled_amount; $_SESSION['disbursement_items'] =& $cart; }