$bo_policy = 1; } $newdelivery = $dn->trans_no == 0; if ($newdelivery) { new_doc_date($dn->document_date); } $delivery_no = $dn->write($bo_policy); if ($delivery_no == -1) { display_error(_("The entered reference is already in use.")); set_focus('ref'); } else { processing_end(); if ($newdelivery) { meta_forward($_SERVER['PHP_SELF'], "AddedID={$delivery_no}"); } else { meta_forward($_SERVER['PHP_SELF'], "UpdatedID={$delivery_no}"); } } } if (isset($_POST['Update']) || isset($_POST['_Location_update']) || isset($_POST['qty']) || isset($_POST['process_delivery'])) { $Ajax->activate('Items'); } //------------------------------------------------------------------------------ start_form(); hidden('cart_id'); start_table(TABLESTYLE2, "width=90%", 5); echo "<tr><td>"; // outer table start_table(TABLESTYLE, "width=100%"); start_row(); label_cells(_("Customer"), $_SESSION['Items']->customer_name, "class='tableheader2'");
function handle_delete() { global $selected_id; if ($selected_id == "") { return; } delete_exchange_rate($selected_id); meta_forward($_SERVER['PHP_SELF']); }
function handle_submit() { if (!check_data()) { return; } $trans = add_exchange_variation_all($_POST['date'], $_POST['ref'], $_POST['memo_']); meta_forward($_SERVER['PHP_SELF'], "AddedID=" . $trans[0] . "&JE=" . $trans[1]); //clear_data(); }
function handle_delete($todate) { global $selected_id; if (!check_can_delete($todate)) { return; } //only delete if used in neither customer or supplier, comp prefs, bank trans accounts delete_fiscalyear($selected_id); meta_forward($_SERVER['PHP_SELF']); }
/*end of the loop through the array of allocations made */ update_debtor_trans_allocation($_SESSION['alloc']->type, $_SESSION['alloc']->trans_no, $total_allocated); commit_transaction(); clear_allocations(); } //-------------------------------------------------------------------------------- if (isset($_POST['Process'])) { if (check_data()) { handle_process(); $_POST['Cancel'] = 1; } } //-------------------------------------------------------------------------------- if (isset($_POST['Cancel'])) { clear_allocations(); meta_forward($path_to_root . "/sales/allocations/customer_allocation_main.php"); exit; } //-------------------------------------------------------------------------------- function get_allocations_for_transaction($type, $trans_no) { clear_allocations(); $debtor = get_customer_trans($trans_no, $type); $_SESSION['alloc'] = new allocation($trans_no, $type, $debtor["debtor_no"], $debtor["DebtorName"], $debtor["Total"], sql2date($debtor["tran_date"])); /* Now populate the array of possible (and previous actual) allocations for this customer */ /*First get the transactions that have outstanding balances ie Total-alloc >0 */ $trans_items = get_allocatable_to_cust_transactions($_SESSION['alloc']->person_id); while ($myrow = db_fetch($trans_items)) { $_SESSION['alloc']->add_item($myrow["type"], $myrow["trans_no"], sql2date($myrow["tran_date"]), sql2date($myrow["due_date"]), $myrow["Total"], $myrow["alloc"], 0); // this allocation }
function handle_cancel_order() { global $path_to_root, $Ajax; if ($_SESSION['Items']->trans_type == ST_CUSTDELIVERY) { display_notification(_("Direct delivery entry has been cancelled as requested."), 1); submenu_option(_("Enter a New Sales Delivery"), "/sales/sales_order_entry.php?NewDelivery=1"); } elseif ($_SESSION['Items']->trans_type == ST_SALESINVOICE) { display_notification(_("Direct invoice entry has been cancelled as requested."), 1); submenu_option(_("Enter a New Sales Invoice"), "/sales/sales_order_entry.php?NewInvoice=1"); } elseif ($_SESSION['Items']->trans_type == ST_SALESQUOTE) { if ($_SESSION['Items']->trans_no != 0) { delete_sales_order(key($_SESSION['Items']->trans_no), $_SESSION['Items']->trans_type); } display_notification(_("This sales quotation has been cancelled as requested."), 1); submenu_option(_("Enter a New Sales Quotation"), "/sales/sales_order_entry.php?NewQuotation=Yes"); } else { // sales order if ($_SESSION['Items']->trans_no != 0) { $order_no = key($_SESSION['Items']->trans_no); if (sales_order_has_deliveries($order_no)) { close_sales_order($order_no); display_notification(_("Undelivered part of order has been cancelled as requested."), 1); submenu_option(_("Select Another Sales Order for Edition"), "/sales/inquiry/sales_orders_view.php?type=" . ST_SALESORDER); } else { delete_sales_order(key($_SESSION['Items']->trans_no), $_SESSION['Items']->trans_type); display_notification(_("This sales order has been cancelled as requested."), 1); submenu_option(_("Enter a New Sales Order"), "/sales/sales_order_entry.php?NewOrder=Yes"); } } else { processing_end(); meta_forward($path_to_root . '/index.php', 'application=orders'); } } processing_end(); display_footer_exit(); }
} //---------------------------------------------------------------------------------------------- if (isset($_POST['_customer_id_button'])) { // unset($_POST['branch_id']); $Ajax->activate('BranchID'); } //---------------------------------------------------------------------------------------------- if (get_post('AddPaymentItem') && can_process()) { new_doc_date($_POST['DateBanked']); $new_pmt = !$_SESSION['alloc']->trans_no; //Chaitanya : 13-OCT-2011 - To support Edit feature $payment_no = write_customer_payment($_SESSION['alloc']->trans_no, $_POST['customer_id'], $_POST['BranchID'], $_POST['bank_account'], $_POST['DateBanked'], $_POST['ref'], input_num('amount'), input_num('discount'), $_POST['memo_'], 0, input_num('charge'), input_num('bank_amount', input_num('amount'))); $_SESSION['alloc']->trans_no = $payment_no; $_SESSION['alloc']->write(); unset($_SESSION['alloc']); meta_forward($_SERVER['PHP_SELF'], $new_pmt ? "AddedID={$payment_no}" : "UpdatedID={$payment_no}"); } //---------------------------------------------------------------------------------------------- function read_customer_data() { global $Refs; $myrow = get_customer_habit($_POST['customer_id']); $_POST['HoldAccount'] = $myrow["dissallow_invoices"]; $_POST['pymt_discount'] = $myrow["pymt_discount"]; //Chaitanya : 13-OCT-2011 - To support Edit feature //If page is called first time and New entry fetch the nex reference number if (!$_SESSION['alloc']->trans_no && !isset($_POST['charge'])) { $_POST['ref'] = $Refs->get_next(ST_CUSTPAYMENT); } } //----------------------------------------------------------------------------------------------
function handle_delete() { global $comp_path, $def_coy, $db_connections, $comp_subdirs; $id = $_GET['id']; $err = remove_connection($id); if ($err == 0) { display_error(tr("Error removing Database: ") . $dbase . tr(", please remove it manuallly")); } if ($def_coy == $id) { $def_coy = 0; } $error = write_config_db(); if ($error == -1) { display_error(tr("Cannot open the configuration file - ") . $path_to_root . "/config_db.php"); } else { if ($error == -2) { display_error(tr("Cannot write to the configuration file - ") . $path_to_root . "/config_db.php"); } else { if ($error == -3) { display_error(tr("The configuration file ") . $path_to_root . "/config_db.php" . tr(" is not writable. Change its permissions so it is, then re-run the operation.")); } } } if ($error != 0) { return; } $cdir = $comp_path . '/' . $id; flush_dir($cdir); if (!rmdir($cdir)) { display_error(tr("Cannot remove company data directory ") . $cdir); return; } meta_forward($_SERVER['PHP_SELF']); }
function handle_add_deposit() { new_doc_date($_POST['DatePaid']); $trans_no = add_bank_transfer($_POST['FromBankAccount'], $_POST['ToBankAccount'], $_POST['DatePaid'], input_num('amount'), $_POST['ref'], $_POST['memo_'], input_num('charge'), input_num('target_amount')); meta_forward($_SERVER['PHP_SELF'], "AddedID={$trans_no}"); }
// PREVENT DELETES IF DEPENDENT RECORDS IN 'debtor_trans' $sql = "SELECT COUNT(*) FROM debtor_trans WHERE branch_code='" . $_POST['branch_code'] . "' AND debtor_no = '" . $_POST['customer_id'] . "'"; $result = db_query($sql, "could not query debtortrans"); $myrow = db_fetch_row($result); if ($myrow[0] > 0) { display_error(tr("Cannot delete this branch because customer transactions have been created to this branch.")); } else { $sql = "SELECT COUNT(*) FROM sales_orders WHERE branch_code='" . $_POST['branch_code'] . "' AND debtor_no = '" . $_POST['customer_id'] . "'"; $result = db_query($sql, "could not query sales orders"); $myrow = db_fetch_row($result); if ($myrow[0] > 0) { display_error(tr("Cannot delete this branch because sales orders exist for it. Purge old sales orders first.")); } else { $sql = "DELETE FROM cust_branch WHERE branch_code='" . $_POST['branch_code'] . "' AND debtor_no='" . $_POST['customer_id'] . "'"; db_query($sql, "could not delete branch"); meta_forward($_SERVER['PHP_SELF'], "debtor_no=" . $_POST['customer_id']); } } //end ifs to test if the branch can be deleted } start_form(); echo "<center>" . tr("Select a customer: ") . " "; customer_list('customer_id', null, false, true); echo "</center><br><br>"; check_branches(); // we always want to have a branch (if possible) $num_branches = db_customer_has_branches($_POST['customer_id']); if ($num_branches) { $sql = "SELECT debtors_master.name, cust_branch.*, salesman.salesman_name," . "areas.description, tax_groups.name AS tax_group_name " . "FROM cust_branch, debtors_master, areas, salesman, tax_groups " . "WHERE cust_branch.debtor_no=debtors_master.debtor_no " . "AND cust_branch.tax_group_id=tax_groups.id " . "AND cust_branch.area=areas.area_code " . "AND cust_branch.salesman=salesman.salesman_code " . "AND cust_branch.debtor_no = '" . $_POST['customer_id'] . "'"; $result = db_query($sql, "could not get customer branches"); start_table("{$table_style} width=60%");
function process_receive_po() { global $path_to_root, $Ajax; if (!can_process()) { return; } if (check_po_changed()) { display_error(_("This order has been changed or invoiced since this delivery was started to be actioned. Processing halted. To enter a delivery against this purchase order, it must be re-selected and re-read again to update the changes made by the other user.")); hyperlink_no_params("{$path_to_root}/purchasing/inquiry/po_search.php", _("Select a different purchase order for receiving goods against")); hyperlink_params("{$path_to_root}/purchasing/po_receive_items.php", _("Re-Read the updated purchase order for receiving goods against"), "PONumber=" . $_SESSION['PO']->order_no); unset($_SESSION['PO']->line_items); unset($_SESSION['PO']); unset($_POST['ProcessGoodsReceived']); $Ajax->activate('_page_body'); display_footer_exit(); } $grn =& $_SESSION['PO']; $grn->orig_order_date = $_POST['DefaultReceivedDate']; $grn->reference = $_POST['ref']; $grn->Location = $_POST['Location']; $grn->ex_rate = input_num('_ex_rate', null); $grn_no = add_grn($grn); new_doc_date($_POST['DefaultReceivedDate']); unset($_SESSION['PO']->line_items); unset($_SESSION['PO']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$grn_no}"); }
if (work_order_has_productions($selected_id) || work_order_has_issues($selected_id) || work_order_has_payments($selected_id)) { display_error(_("This work order cannot be deleted because it has already been processed.")); $cancel_delete = true; } if ($cancel_delete == false) { //ie not cancelled the delete as a result of above tests // delete the actual work order delete_work_order($selected_id); meta_forward($_SERVER['PHP_SELF'], "DeletedID={$selected_id}"); } } //------------------------------------------------------------------------------------- if (isset($_POST['close'])) { // update the closed flag in the work order close_work_order($selected_id); meta_forward($_SERVER['PHP_SELF'], "ClosedID={$selected_id}"); } //------------------------------------------------------------------------------------- if (get_post('_type_update')) { $Ajax->activate('_page_body'); } //------------------------------------------------------------------------------------- start_form(); start_table(TABLESTYLE2); $existing_comments = ""; $dec = 0; if (isset($selected_id)) { $myrow = get_work_order($selected_id); if (strlen($myrow[0]) == 0) { echo _("The order number sent is not valid."); safe_exit();
if (isset($_POST['Process']) && !check_trans()) { begin_transaction(); $_SESSION['pay_items'] =& $_SESSION['pay_items']; $new = $_SESSION['pay_items']->order_id == 0; add_new_exchange_rate(get_bank_account_currency(get_post('bank_account')), get_post('date_'), input_num('_ex_rate')); $trans = write_bank_transaction($_SESSION['pay_items']->trans_type, $_SESSION['pay_items']->order_id, $_POST['bank_account'], $_SESSION['pay_items'], $_POST['date_'], $_POST['PayType'], $_POST['person_id'], get_post('PersonDetailID'), $_POST['ref'], $_POST['memo_'], true, input_num('settled_amount', null)); $trans_type = $trans[0]; $trans_no = $trans[1]; new_doc_date($_POST['date_']); $_SESSION['pay_items']->clear_items(); unset($_SESSION['pay_items']); commit_transaction(); if ($new) { meta_forward($_SERVER['PHP_SELF'], $trans_type == ST_BANKPAYMENT ? "AddedID={$trans_no}" : "AddedDep={$trans_no}"); } else { meta_forward($_SERVER['PHP_SELF'], $trans_type == ST_BANKPAYMENT ? "UpdatedID={$trans_no}" : "UpdatedDep={$trans_no}"); } } //----------------------------------------------------------------------------------------------- function check_item_data() { if (!check_num('amount', 0)) { display_error(_("The amount entered is not a valid number or is less than zero.")); set_focus('amount'); return false; } if (isset($_POST['_ex_rate']) && input_num('_ex_rate') <= 0) { display_error(_("The exchange rate cannot be zero or a negative number.")); set_focus('_ex_rate'); return false; }
set_focus('discount'); return false; } return true; } //---------------------------------------------------------------------------------------------- // validate inputs if (isset($_POST['AddPaymentItem'])) { if (!can_process()) { unset($_POST['AddPaymentItem']); } } //---------------------------------------------------------------------------------------------- if (isset($_POST['AddPaymentItem'])) { $payment_no = write_customer_payment(0, $_POST['customer_id'], $_POST['BranchID'], $_POST['bank_account'], $_POST['DateBanked'], $_POST['ReceiptType'], $_POST['ref'], input_num('amount'), input_num('discount'), $_POST['memo_']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$payment_no}"); } //---------------------------------------------------------------------------------------------- function read_customer_data() { $sql = "SELECT debtors_master.pymt_discount,\n\t\tcredit_status.dissallow_invoices\n\t\tFROM debtors_master, credit_status\n\t\tWHERE debtors_master.credit_status = credit_status.id\n\t\t\tAND debtors_master.debtor_no = '" . $_POST['customer_id'] . "'"; $result = db_query($sql, "could not query customers"); $myrow = db_fetch($result); $_POST['HoldAccount'] = $myrow["dissallow_invoices"]; $_POST['pymt_discount'] = $myrow["pymt_discount"]; $_POST['ref'] = references::get_next(12); } //------------------------------------------------------------------------------------------------- function display_item_form() { global $table_style2;
} return $input_error == 0; } //----------------------------------------------------------------------------- if (isset($_POST['ProcessCredit']) && can_process()) { if ($_POST['CreditType'] == "WriteOff" && (!isset($_POST['WriteOffGLCode']) || $_POST['WriteOffGLCode'] == '')) { display_note(tr("For credit notes created to write off the stock, a general ledger account is required to be selected."), 1, 0); display_note(tr("Please select an account to write the cost of the stock off to, then click on Process again."), 1, 0); exit; } if (!isset($_POST['WriteOffGLCode'])) { $_POST['WriteOffGLCode'] = 0; } $credit_no = $_SESSION['Items']->write($_POST['WriteOffGLCode']); processing_end(); meta_forward($_SERVER['PHP_SELF'], "AddedID={$credit_no}"); } /*end of process credit note */ //----------------------------------------------------------------------------- function check_item_data() { if (!check_num('qty', 0)) { display_error(tr("The quantity must be greater than zero.")); set_focus('qty'); return false; } if (!check_num('price', 0)) { display_error(tr("The entered price is negative or invalid.")); set_focus('price'); return false; }
if (isset($_POST['process_invoice']) && check_data()) { $newinvoice = $_SESSION['Items']->trans_no == 0; copy_to_cart(); if ($newinvoice) { new_doc_date($_SESSION['Items']->document_date); } $invoice_no = $_SESSION['Items']->write(); if ($invoice_no == -1) { display_error(_("The entered reference is already in use.")); set_focus('ref'); } else { processing_end(); if ($newinvoice) { meta_forward($_SERVER['PHP_SELF'], "AddedID={$invoice_no}"); } else { meta_forward($_SERVER['PHP_SELF'], "UpdatedID={$invoice_no}"); } } } if (list_updated('payment')) { $order =& $_SESSION['Items']; $order->payment = get_post('payment'); $order->payment_terms = get_payment_terms($order->payment); $order->due_date = get_invoice_duedate($order->payment, $order->document_date); if ($order->payment_terms['cash_sale']) { $_POST['Location'] = $order->Location = $order->pos['pos_location']; $order->location_name = $order->pos['location_name']; } } // find delivery spans for batch invoice display $dspans = array();
function handle_add_payment() { $supp_currency = get_supplier_currency($_POST['supplier_id']); $bank_currency = get_bank_account_currency($_POST['bank_account']); $comp_currency = get_company_currency(); if ($comp_currency != $bank_currency && $bank_currency != $supp_currency) { $rate = 0; } else { $rate = input_num('_ex_rate'); } $payment_id = add_supp_payment($_POST['supplier_id'], $_POST['DatePaid'], $_POST['bank_account'], input_num('amount'), input_num('discount'), $_POST['ref'], $_POST['memo_'], $rate, input_num('charge')); new_doc_date($_POST['DatePaid']); $_SESSION['alloc']->trans_no = $payment_id; $_SESSION['alloc']->write(); //unset($_POST['supplier_id']); unset($_POST['bank_account']); unset($_POST['DatePaid']); unset($_POST['currency']); unset($_POST['memo_']); unset($_POST['amount']); unset($_POST['discount']); unset($_POST['ProcessSuppPayment']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$payment_id}&supplier_id=" . $_POST['supplier_id']); }
return false; } $failed_item = $_SESSION['issue_items']->check_qoh($_POST['Location'], $_POST['date_'], !$_POST['IssueType']); if ($failed_item != -1) { display_error(_("The issue cannot be processed because it would cause negative inventory balance for marked items as of document date or later.")); return false; } return true; } if (isset($_POST['Process']) && can_process()) { // if failed, returns a stockID $failed_data = add_work_order_issue($_SESSION['issue_items']->order_id, $_POST['ref'], $_POST['IssueType'], $_SESSION['issue_items']->line_items, $_POST['Location'], $_POST['WorkCentre'], $_POST['date_'], $_POST['memo_']); if ($failed_data != null) { display_error(_("The process cannot be completed because there is an insufficient total quantity for a component.") . "<br>" . _("Component is :") . $failed_data[0] . "<br>" . _("From location :") . $failed_data[1] . "<br>"); } else { meta_forward($_SERVER['PHP_SELF'], "AddedID=" . $_SESSION['issue_items']->order_id); } } /*end of process credit note */ //----------------------------------------------------------------------------------------------- function check_item_data() { if (input_num('qty') == 0 || !check_num('qty', 0)) { display_error(_("The quantity entered is negative or invalid.")); set_focus('qty'); return false; } if (!check_num('std_cost', 0)) { display_error(_("The entered standard cost is negative or invalid.")); set_focus('std_cost'); return false;
if ($low_stock) { display_error(_("The transfer cannot be processed because it would cause negative inventory balance in source location for marked items as of document date or later.")); $input_error = 1; } } if ($input_error == 1) { unset($_POST['Process']); } } //------------------------------------------------------------------------------- if (isset($_POST['Process'])) { $trans_no = add_stock_transfer($_SESSION['transfer_items']->line_items, $_POST['FromStockLocation'], $_POST['ToStockLocation'], $_POST['AdjDate'], $_POST['type'], $_POST['ref'], $_POST['memo_']); new_doc_date($_POST['AdjDate']); $_SESSION['transfer_items']->clear_items(); unset($_SESSION['transfer_items']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$trans_no}"); } /*end of process credit note */ //----------------------------------------------------------------------------------------------- function check_item_data() { if (!check_num('qty', 0)) { display_error(_("The quantity entered must be a positive number.")); set_focus('qty'); return false; } return true; } //----------------------------------------------------------------------------------------------- function handle_update_item() {
if ($use_popup_windows) { $js = get_js_open_window(900, 500); } page(_($help_context = "Install Charts of Accounts"), false, false, '', $js); include_once $path_to_root . "/includes/date_functions.inc"; include_once $path_to_root . "/admin/db/company_db.inc"; include_once $path_to_root . "/admin/db/maintenance_db.inc"; include_once $path_to_root . "/includes/ui.inc"; //--------------------------------------------------------------------------------------------- if ($id = find_submit('Delete', false)) { $extensions = get_company_extensions(); if ($extensions[$id]['type'] == 'chart' && uninstall_package($extensions[$id]['package'])) { unset($extensions[$id]); if (update_extensions($extensions)) { display_notification(_("Selected chart has been successfully deleted")); meta_forward($_SERVER['PHP_SELF']); } } } if ($id = find_submit('Update', false)) { install_extension($id); } //--------------------------------------------------------------------------------------------- start_form(true); div_start('ext_tbl'); start_table(TABLESTYLE); $th = array(_("Chart"), _("Installed"), _("Available"), _("Encoding"), "", ""); table_header($th); $k = 0; $mods = get_charts_list(); foreach ($mods as $pkg_name => $ext) {
$comp_currency = get_company_currency(); if ($comp_currency != $bank_currency && $bank_currency != $cust_currency) { $rate = 0; } else { $rate = input_num('_ex_rate'); } new_doc_date($_POST['DateBanked']); //Chaitanya : 13-OCT-2011 - To support Edit feature $payment_no = write_customer_payment($_SESSION['alloc']->trans_no, $_POST['customer_id'], $_POST['BranchID'], $_POST['bank_account'], $_POST['DateBanked'], $_POST['ref'], input_num('amount'), input_num('discount'), $_POST['memo_'], $rate, input_num('charge')); $_SESSION['alloc']->trans_no = $payment_no; $_SESSION['alloc']->write(); unset($_POST); unset($_SESSION); //Chaitanya : 13-OCT-2011 - To support Edit feature //meta_forward($_SERVER['PHP_SELF'], "AddedID=$payment_no"); meta_forward($_SERVER['PHP_SELF'], !$_SESSION['alloc']->trans_no ? "AddedID={$payment_no}" : "UpdatedID={$payment_no}"); } //---------------------------------------------------------------------------------------------- function read_customer_data() { global $Refs; $myrow = get_customer_habit($_POST['customer_id']); $_POST['HoldAccount'] = $myrow["dissallow_invoices"]; $_POST['pymt_discount'] = $myrow["pymt_discount"]; //Chaitanya : 13-OCT-2011 - To support Edit feature //If page is called first time and New entry fetch the nex reference number if (!$_SESSION['alloc']->trans_no && !isset($_POST['charge'])) { $_POST['ref'] = $Refs->get_next(ST_CUSTPAYMENT); } } //----------------------------------------------------------------------------------------------
unset($_POST['empl_id']); unset($_POST['empl_name']); unset($_POST['gross_salary']); } if (isset($_POST['submit'])) { if (strlen(trim($_POST['empl_name'])) == 0) { display_error(_("The employee name cannot be empty.")); set_focus('empl_name'); return false; } if (isset($_POST['empl_id'])) { $empl_id = update_employee($_POST['empl_id'], $_POST['empl_name'], $_POST['pre_address'], $_POST['per_address'], $_POST['date_of_birth'], $_POST['age'], $_POST['mobile_phone'], $_POST['email'], $_POST['grade'], $_POST['department'], $_POST['designation'], $_POST['gross_salary'], $_POST['date_of_join']); meta_forward($_SERVER['PHP_SELF'], "Updated=yes&selected_id={$empl_id}"); } else { $empl_id = add_employee($_POST['empl_name'], $_POST['pre_address'], $_POST['per_address'], $_POST['date_of_birth'], $_POST['age'], $_POST['mobile_phone'], $_POST['email'], $_POST['grade'], $_POST['department'], $_POST['designation'], $_POST['gross_salary'], $_POST['date_of_join']); meta_forward($_SERVER['PHP_SELF'], "Added=yes&selected_id={$empl_id}"); } } start_form(); if (db_has_employees()) { start_table(TABLESTYLE_NOBORDER); start_row(); hrm_year_list(_("Year:"), 'year', null); hrm_months_list(_("Month:"), 'month', null); employee_list_cells(_("Select an Employee: "), 'selected_id', null, _('New Employee'), true, check_value('show_inactive')); $new_item = get_post('selected_id') == ''; end_row(); end_table(); if (get_post('_show_inactive_update')) { $Ajax->activate('selected_id'); set_focus('selected_id');
function handle_commit_order() { $cart =& $_SESSION['PO']; if (can_commit()) { copy_to_cart(); if ($cart->trans_type != ST_PURCHORDER) { // for direct grn/invoice set same dates for lines as for whole document foreach ($cart->line_items as $line_no => $line) { $cart->line_items[$line_no]->req_del_date = $cart->orig_order_date; } } if ($cart->order_no == 0) { // new po/grn/invoice /*its a new order to be inserted */ $ref = $cart->reference; if ($cart->trans_type != ST_PURCHORDER) { $cart->reference = 'auto'; begin_transaction(); // all db changes as single transaction for direct document } $order_no = add_po($cart); new_doc_date($cart->orig_order_date); $cart->order_no = $order_no; if ($cart->trans_type == ST_PURCHORDER) { unset($_SESSION['PO']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$order_no}"); } //Direct GRN if ($cart->trans_type == ST_SUPPRECEIVE) { $cart->reference = $ref; } if ($cart->trans_type != ST_SUPPINVOICE) { $cart->Comments = $cart->reference; } //grn does not hold supp_ref foreach ($cart->line_items as $key => $line) { $cart->line_items[$key]->receive_qty = $line->quantity; } $grn_no = add_grn($cart); if ($cart->trans_type == ST_SUPPRECEIVE) { commit_transaction(); // save PO+GRN unset($_SESSION['PO']); meta_forward($_SERVER['PHP_SELF'], "AddedGRN={$grn_no}"); } // Direct Purchase Invoice $inv = new supp_trans(ST_SUPPINVOICE); $inv->Comments = $cart->Comments; $inv->supplier_id = $cart->supplier_id; $inv->tran_date = $cart->orig_order_date; $inv->due_date = $cart->due_date; $inv->reference = $ref; $inv->supp_reference = $cart->supp_ref; $inv->tax_included = $cart->tax_included; $supp = get_supplier($cart->supplier_id); $inv->tax_group_id = $supp['tax_group_id']; $inv->ov_amount = $inv->ov_gst = $inv->ov_discount = 0; $total = 0; foreach ($cart->line_items as $key => $line) { $inv->add_grn_to_trans($line->grn_item_id, $line->po_detail_rec, $line->stock_id, $line->item_description, $line->receive_qty, 0, $line->receive_qty, $line->price, $line->price, true, get_standard_cost($line->stock_id), ''); $inv->ov_amount += round2($line->receive_qty * $line->price, user_price_dec()); } $inv->tax_overrides = $cart->tax_overrides; if (!$inv->tax_included) { $taxes = $inv->get_taxes($inv->tax_group_id, 0, false); foreach ($taxes as $taxitem) { $total += isset($taxitem['Override']) ? $taxitem['Override'] : $taxitem['Value']; } } $inv->ex_rate = $cart->ex_rate; $inv_no = add_supp_invoice($inv); commit_transaction(); // save PO+GRN+PI // FIXME payment for cash terms. (Needs cash account selection) unset($_SESSION['PO']); meta_forward($_SERVER['PHP_SELF'], "AddedPI={$inv_no}"); } else { // order modification $order_no = update_po($cart); unset($_SESSION['PO']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$order_no}&Updated=1"); } } }
if ($del_branch != $branch) { $del_count = 0; break; } } $selected[] = $delivery; $del_count++; } } if (!$del_count) { display_error(_('For batch invoicing you should select at least one delivery. All items must be dispatched to the same customer branch.')); } else { $_SESSION['DeliveryBatch'] = $selected; meta_forward($path_to_root . '/sales/customer_invoice.php', 'BatchInvoice=Yes'); } } //----------------------------------------------------------------------------------- if (get_post('_DeliveryNumber_changed')) { $disable = get_post('DeliveryNumber') !== ''; $Ajax->addDisable(true, 'DeliveryAfterDate', $disable); $Ajax->addDisable(true, 'DeliveryToDate', $disable); $Ajax->addDisable(true, 'StockLocation', $disable); $Ajax->addDisable(true, '_SelectStockFromList_edit', $disable); $Ajax->addDisable(true, 'SelectStockFromList', $disable); // if search is not empty rewrite table if ($disable) { $Ajax->addFocus(true, 'DeliveryNumber'); } else { $Ajax->addFocus(true, 'DeliveryAfterDate');
function handle_commit_invoice() { copy_to_trans($_SESSION['supp_trans']); if (!check_data()) { return; } $invoice_no = add_supp_invoice($_SESSION['supp_trans']); $_SESSION['supp_trans']->clear_items(); unset($_SESSION['supp_trans']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$invoice_no}"); }
} } return true; } //-------------------------------------------------------------------------------------------------- if ((isset($_POST['Process']) || isset($_POST['ProcessAndClose'])) && can_process() == true) { $close_wo = 0; if (isset($_POST['ProcessAndClose']) && $_POST['ProcessAndClose'] != "") { $close_wo = 1; } // if unassembling, negate quantity if ($_POST['ProductionType'] == 0) { $_POST['quantity'] = -$_POST['quantity']; } $id = work_order_produce($_POST['selected_id'], $_POST['ref'], input_num('quantity'), $_POST['date_'], $_POST['memo_'], $close_wo); meta_forward($_SERVER['PHP_SELF'], "AddedID=" . $_POST['selected_id'] . "&date=" . $_POST['date_']); } //------------------------------------------------------------------------------------- display_wo_details($_POST['selected_id']); //------------------------------------------------------------------------------------- start_form(); hidden('selected_id', $_POST['selected_id']); //hidden('WOReqQuantity', $_POST['WOReqQuantity']); $dec = get_qty_dec($wo_details["stock_id"]); if (!isset($_POST['quantity']) || $_POST['quantity'] == '') { $_POST['quantity'] = qty_format(max($wo_details["units_reqd"] - $wo_details["units_issued"], 0), $wo_details["stock_id"], $dec); } start_table(TABLESTYLE2); br(); ref_row(_("Reference:"), 'ref', '', $Refs->get_next(29)); if (!isset($_POST['ProductionType'])) {
function handle_commit_order() { copy_to_po(); if (can_commit()) { if ($_SESSION['PO']->order_no == 0) { /*its a new order to be inserted */ $order_no = add_po($_SESSION['PO']); unset($_SESSION['PO']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$order_no}"); } else { /*its an existing order need to update the old order info */ $order_no = update_po($_SESSION['PO']); unset($_SESSION['PO']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$order_no}&Updated=1"); } } }
function process_receive_po() { global $path_to_root; if (!can_process()) { return; } if (check_po_changed()) { echo "<br> " . tr("This order has been changed or invoiced since this delivery was started to be actioned. Processing halted. To enter a delivery against this purchase order, it must be re-selected and re-read again to update the changes made by the other user.") . "<BR>"; echo "<center><a href='{$path_to_root}/purchasing/inquiry/po_search.php?" . SID . "'>" . tr("Select a different purchase order for receiving goods against") . "</a></center>"; echo "<center><a href='{$path_to_root}/po_receive_items.php?" . SID . "PONumber=" . $_SESSION['PO']->OrderNumber . "'>" . tr("Re-Read the updated purchase order for receiving goods against") . "</a></center>"; unset($_SESSION['PO']->line_items); unset($_SESSION['PO']); unset($_POST['ProcessGoodsReceived']); exit; } $grn = add_grn($_SESSION['PO'], $_POST['DefaultReceivedDate'], $_POST['ref'], $_POST['Location']); unset($_SESSION['PO']->line_items); unset($_SESSION['PO']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$grn}"); }
} } return true; } //-------------------------------------------------------------------------------------------------- if (isset($_POST['Process']) || isset($_POST['ProcessAndClose']) && can_process() == true) { $close_wo = 0; if (isset($_POST['ProcessAndClose']) && $_POST['ProcessAndClose'] != "") { $close_wo = 1; } // if unassembling, negate quantity if ($_POST['ProductionType'] == 0) { $_POST['quantity'] = -$_POST['quantity']; } $id = work_order_produce($_POST['selected_id'], $_POST['ref'], $_POST['quantity'], $_POST['date_'], $_POST['memo_'], $close_wo); meta_forward($_SERVER['PHP_SELF'], "AddedID={$id}"); } //------------------------------------------------------------------------------------- display_wo_details($_POST['selected_id']); //------------------------------------------------------------------------------------- start_form(); hidden('selected_id', $_POST['selected_id']); //hidden('WOReqQuantity', $_POST['WOReqQuantity']); if (!isset($_POST['quantity']) || $_POST['quantity'] == '') { $_POST['quantity'] = max($wo_details["units_reqd"] - $wo_details["units_issued"], 0); } start_table(); ref_row(tr("Reference:"), 'ref', references::get_next(29)); if (!isset($_POST['ProductionType'])) { $_POST['ProductionType'] = 1; }
function handle_add_payment() { $payment_id = write_supp_payment(0, $_POST['supplier_id'], $_POST['bank_account'], $_POST['DatePaid'], $_POST['ref'], input_num('amount'), input_num('discount'), $_POST['memo_'], input_num('charge'), input_num('bank_amount', input_num('amount'))); new_doc_date($_POST['DatePaid']); $_SESSION['alloc']->trans_no = $payment_id; $_SESSION['alloc']->date_ = $_POST['DatePaid']; $_SESSION['alloc']->write(); unset($_POST['bank_account']); unset($_POST['DatePaid']); unset($_POST['currency']); unset($_POST['memo_']); unset($_POST['amount']); unset($_POST['discount']); unset($_POST['ProcessSuppPayment']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$payment_id}&supplier_id=" . $_POST['supplier_id']); }