Пример #1
0
function handle_submit()
{
    global $path_to_root;
    if (!can_process()) {
        return;
    }
    if (!isset($_POST['New'])) {
        $sql = "UPDATE debtors_master SET name=" . db_escape($_POST['CustName']) . ", \n\t\t\taddress=" . db_escape($_POST['address']) . ", \n\t\t\ttax_id=" . db_escape($_POST['tax_id']) . ", \n\t\t\tcurr_code=" . db_escape($_POST['curr_code']) . ", \n\t\t\temail=" . db_escape($_POST['email']) . ", \n\t\t\tdimension_id=" . db_escape($_POST['dimension_id']) . ", \n\t\t\tdimension2_id=" . db_escape($_POST['dimension2_id']) . ", \n            credit_status=" . db_escape($_POST['credit_status']) . ", \n            payment_terms=" . db_escape($_POST['payment_terms']) . ", \n            discount=" . input_num('discount') / 100 . ", \n            pymt_discount=" . input_num('pymt_discount') / 100 . ", \n            credit_limit=" . input_num('credit_limit') . ", \n            sales_type = " . db_escape($_POST['sales_type']) . " \n            WHERE debtor_no = '" . $_POST['customer_id'] . "'";
        db_query($sql, "The customer could not be updated");
        display_notification(tr("Customer has been updated."));
        clear_fields();
    } else {
        //it is a new customer
        begin_transaction();
        $sql = "INSERT INTO debtors_master (name, address, tax_id, email, dimension_id, dimension2_id,  \n\t\t\tcurr_code, credit_status, payment_terms, discount, pymt_discount,credit_limit, \n\t\t\tsales_type) VALUES (" . db_escape($_POST['CustName']) . ", " . db_escape($_POST['address']) . ", " . db_escape($_POST['tax_id']) . "," . db_escape($_POST['email']) . ", " . db_escape($_POST['dimension_id']) . ", " . db_escape($_POST['dimension2_id']) . ", " . db_escape($_POST['curr_code']) . ", \n\t\t\t" . db_escape($_POST['credit_status']) . ", " . db_escape($_POST['payment_terms']) . ", " . input_num('discount') / 100 . ", \n\t\t\t" . input_num('pymt_discount') / 100 . ", " . input_num('credit_limit') . ", " . db_escape($_POST['sales_type']) . ")";
        db_query($sql, "The customer could not be added");
        $new_customer_id = db_insert_id();
        commit_transaction();
        display_notification(tr("A new customer has been added."));
        hyperlink_params($path_to_root . "/sales/manage/customer_branches.php", tr("Add branches for this customer"), "debtor_no={$new_customer_id}");
        clear_fields();
    }
}
Пример #2
0
    $selected_id = $_POST['selected_id'];
}
//---------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $id = $_GET['AddedID'];
    $stype = ST_WORKORDER;
    display_notification_centered(_("The work order been added."));
    display_note(get_trans_view_str($stype, $id, _("View this Work Order")), 0, 1);
    if ($_GET['type'] != WO_ADVANCED) {
        include_once $path_to_root . "/reporting/includes/reporting.inc";
        submenu_print(_("&Print This Work Order"), ST_WORKORDER, $id, 'prtopt');
        submenu_print(_("&Email This Work Order"), ST_WORKORDER, $id, null, 1);
        display_note(get_gl_view_str($stype, $id, _("View the GL Journal Entries for this Work Order")), 1);
        $ar = array('PARAM_0' => $_GET['date'], 'PARAM_1' => $_GET['date'], 'PARAM_2' => $stype, 'PARAM_3' => '', 'PARAM_4' => isset($def_print_orientation) && $def_print_orientation == 1 ? 1 : 0);
        display_note(print_link(_("Print the GL Journal Entries for this Work Order"), 702, $ar), 1);
        hyperlink_params("{$path_to_root}/admin/attachments.php", _("Add an Attachment"), "filterType={$stype}&trans_no={$id}");
    }
    safe_exit();
}
//---------------------------------------------------------------------------------------
if (isset($_GET['UpdatedID'])) {
    $id = $_GET['UpdatedID'];
    display_notification_centered(_("The work order been updated."));
    safe_exit();
}
//---------------------------------------------------------------------------------------
if (isset($_GET['DeletedID'])) {
    $id = $_GET['DeletedID'];
    display_notification_centered(_("Work order has been deleted."));
    safe_exit();
}
Пример #3
0
    $_SESSION['page_title'] = sprintf(tr("Modifying Customer Credit Note #%d"), $_GET['ModifyCredit']);
    handle_new_credit($_GET['ModifyCredit']);
    $help_page_title = tr("Modifying Customer Credit Note");
}
page($_SESSION['page_title'], false, false, "", $js);
//-----------------------------------------------------------------------------
check_db_has_stock_items(tr("There are no items defined in the system."));
check_db_has_customer_branches(tr("There are no customers, or there are no customers with branches. Please define customers and customer branches."));
//-----------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $credit_no = $_GET['AddedID'];
    $trans_type = 11;
    display_notification_centered(sprintf(tr("Credit Note # %d has been processed"), $credit_no));
    display_note(get_customer_trans_view_str($trans_type, $credit_no, tr("View this credit note")), 0, 1);
    display_note(get_gl_view_str($trans_type, $credit_no, tr("View the GL Journal Entries for this Credit Note")));
    hyperlink_params($_SERVER['PHP_SELF'], tr("Enter Another Credit Note"), "NewCredit=yes");
    display_footer_exit();
}
//--------------------------------------------------------------------------------
function line_start_focus()
{
    set_focus(get_company_pref('no_supplier_list') ? 'stock_id_edit' : 'StockID2');
}
//-----------------------------------------------------------------------------
function copy_to_cn()
{
    $_SESSION['Items']->Comments = $_POST['CreditText'];
    $_SESSION['Items']->document_date = $_POST['OrderDate'];
    $_SESSION['Items']->freight_cost = input_num('ChargeFreightCost');
    $_SESSION['Items']->Location = $_POST["Location"];
    $_SESSION['Items']->sales_type = $_POST['sales_type_id'];
Пример #4
0
    display_footer_exit();
} elseif (isset($_GET['UpdatedID'])) {
    $trans_no = $_GET['UpdatedID'];
    $trans_type = ST_JOURNAL;
    display_notification_centered(_("Journal entry has been updated") . " #{$trans_no}");
    display_note(get_gl_view_str($trans_type, $trans_no, _("&View this Journal Entry")));
    hyperlink_no_params($path_to_root . "/gl/inquiry/journal_inquiry.php", _("Return to Journal &Inquiry"));
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
if (isset($_GET['NewJournal'])) {
    create_cart(0, 0);
} elseif (isset($_GET['ModifyGL'])) {
    if (!isset($_GET['trans_type']) || $_GET['trans_type'] != 0) {
        display_error(_("You can edit directly only journal entries created via Journal Entry page."));
        hyperlink_params("{$path_to_root}/gl/gl_journal.php", _("Entry &New Journal Entry"), "NewJournal=Yes");
        display_footer_exit();
    }
    create_cart($_GET['trans_type'], $_GET['trans_no']);
}
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) {
Пример #5
0
    $js .= get_js_open_window(900, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(tr("Customer Payment Entry"), false, false, "", $js);
//----------------------------------------------------------------------------------------------
check_db_has_customers(tr("There are no customers defined in the system."));
check_db_has_bank_accounts(tr("There are no bank accounts defined in the system."));
check_db_has_bank_trans_types(tr("There are no bank payment types defined in the system."));
//----------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $payment_no = $_GET['AddedID'];
    display_notification_centered(tr("The customer payment has been successfully entered."));
    display_note(get_gl_view_str(12, $payment_no, tr("View the GL Journal Entries for this Customer Payment")));
    hyperlink_params($path_to_root . "/sales/allocations/customer_allocate.php", tr("Allocate this Customer Payment"), "trans_no={$payment_no}&trans_type=12");
    hyperlink_no_params($path_to_root . "/sales/customer_payments.php", tr("Enter Another Customer Payment"));
    br(1);
    end_page();
    exit;
}
//----------------------------------------------------------------------------------------------
function can_process()
{
    if (!isset($_POST['DateBanked']) || !is_date($_POST['DateBanked'])) {
        display_error(tr("The entered date is invalid. Please enter a valid date for the payment."));
        set_focus('DateBanked');
        return false;
    } elseif (!is_date_in_fiscalyear($_POST['DateBanked'])) {
        display_error(tr("The entered date is not in fiscal year."));
        set_focus('DateBanked');
Пример #6
0
            display_notification("{$pr} Prices items added or updated for " . $_POST['sales_type_id']);
        }
    } else {
        display_error("No CSV file selected");
    }
}
if ($action == 'import') {
    echo 'Import';
} else {
    hyperlink_params($_SERVER['PHP_SELF'], _("Import"), "action=import", false);
}
echo ' | ';
if ($action == 'export') {
    echo 'Export';
} else {
    hyperlink_params($_SERVER['PHP_SELF'], _("Export"), "action=export", false);
}
echo "<br><br>";
if ($action == 'import') {
    start_form(true);
    start_table(TABLESTYLE2, "width=40%");
    table_section_title("Default GL Accounts");
    $company_record = get_company_prefs();
    if (!isset($_POST['inventory_account']) || $_POST['inventory_account'] == "") {
        $_POST['inventory_account'] = $company_record["default_inventory_act"];
    }
    if (!isset($_POST['cogs_account']) || $_POST['cogs_account'] == "") {
        $_POST['cogs_account'] = $company_record["default_cogs_act"];
    }
    if (!isset($_POST['sales_account']) || $_POST['sales_account'] == "") {
        $_POST['sales_account'] = $company_record["default_inv_sales_act"];
Пример #7
0
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(tr("Enter Supplier Invoice"), false, false, "", $js);
//----------------------------------------------------------------------------------------
check_db_has_suppliers(tr("There are no suppliers defined in the system."));
//---------------------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $invoice_no = $_GET['AddedID'];
    $trans_type = 20;
    echo "<center>";
    display_notification_centered(tr("Supplier invoice has been processed."));
    display_note(get_trans_view_str($trans_type, $invoice_no, tr("View this Invoice")));
    display_note(get_gl_view_str($trans_type, $invoice_no, tr("View the GL Journal Entries for this Invoice")), 1);
    hyperlink_params($_SERVER['PHP_SELF'], tr("Enter Another Invoice"), "New=1");
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
if (isset($_GET['New'])) {
    if (isset($_SESSION['supp_trans'])) {
        unset($_SESSION['supp_trans']->grn_items);
        unset($_SESSION['supp_trans']->gl_codes);
        unset($_SESSION['supp_trans']);
    }
    //session_register("SuppInv");
    session_register("supp_trans");
    $_SESSION['supp_trans'] = new supp_trans();
    $_SESSION['supp_trans']->is_invoice = true;
}
//--------------------------------------------------------------------------------------------------
Пример #8
0
    // Adjust Shipping Charge based upon previous deliveries TAM
    adjust_shipping_charge($ord, $_GET['OrderNumber']);
    $_SESSION['Items'] = $ord;
    copy_from_cart();
} elseif (isset($_GET['ModifyDelivery']) && $_GET['ModifyDelivery'] > 0) {
    $_SESSION['Items'] = new Cart(ST_CUSTDELIVERY, $_GET['ModifyDelivery']);
    if ($_SESSION['Items']->count_items() == 0) {
        hyperlink_params($path_to_root . "/sales/inquiry/customer_inquiry.php", _("Select a different delivery"), "OutstandingOnly=1");
        echo "<br><center><b>" . _("This delivery has all items invoiced. There is nothing to modify.") . "</center></b>";
        display_footer_exit();
    }
    copy_from_cart();
} elseif (!processing_active()) {
    /* This page can only be called with an order number for invoicing*/
    display_error(_("This page can only be opened if an order or delivery note has been selected. Please select it first."));
    hyperlink_params("{$path_to_root}/sales/inquiry/sales_orders_view.php", _("Select a Sales Order to Delivery"), "OutstandingOnly=1");
    end_page();
    exit;
} else {
    check_edit_conflicts();
    if (!check_quantities()) {
        display_error(_("Selected quantity cannot be less than quantity invoiced nor more than quantity\tnot dispatched on sales order."));
    } elseif (!check_num('ChargeFreightCost', 0)) {
        display_error(_("Freight cost cannot be less than zero"));
        set_focus('ChargeFreightCost');
    }
}
//-----------------------------------------------------------------------------
function check_data()
{
    global $Refs, $SysPrefs;
Пример #9
0
end_form();
//--------------------------------------------------------------------------------------------------
if (isset($_POST['stock_id'])) {
    //Parent Item selected so display bom or edit component
    $selected_parent = $_POST['stock_id'];
    if (isset($selected_parent) && isset($_POST['Submit'])) {
        if (isset($selected_component)) {
            on_submit($selected_parent, $selected_component);
        } else {
            on_submit($selected_parent);
        }
    }
    //--------------------------------------------------------------------------------------
    display_bom_items($selected_parent);
    if (isset($selected_parent) && isset($selected_component)) {
        hyperlink_params($_SERVER['PHP_SELF'], tr("Add a new Component"), "NewItem={$selected_parent}");
    }
    //--------------------------------------------------------------------------------------
    start_form(false, true, $_SERVER['PHP_SELF'] . "?" . SID . "NewItem=" . $selected_parent);
    start_table($table_style2);
    if (isset($selected_component)) {
        //editing a selected component from the link to the line item
        $sql = "SELECT bom.*,stock_master.description FROM bom,stock_master\n\t\t\tWHERE id='{$selected_component}'\n\t\t\tAND stock_master.stock_id=bom.component";
        $result = db_query($sql, "could not get bom");
        $myrow = db_fetch($result);
        $_POST['loc_code'] = $myrow["loc_code"];
        $_POST['workcentre_added'] = $myrow["workcentre_added"];
        $_POST['quantity'] = qty_format($myrow["quantity"]);
        hidden('selected_parent', $selected_parent);
        hidden('selected_component', $selected_component);
        label_row(tr("Component:"), $myrow["component"] . " - " . $myrow["description"]);
Пример #10
0
if ($action == 'show') {
    echo 'Configuration';
} else {
    hyperlink_params($_SERVER['PHP_SELF'], _("Configuration"), "action=show", false);
}
echo '&nbsp;|&nbsp;';
if ($action == 'cimport') {
    echo 'Customer Import';
} else {
    hyperlink_params($_SERVER['PHP_SELF'], _("&Customer Import"), "action=cimport", false);
}
echo '&nbsp;|&nbsp;';
if ($action == 'oimport') {
    echo 'Order Import';
} else {
    hyperlink_params($_SERVER['PHP_SELF'], _("&Order Import"), "action=oimport", false);
}
echo '&nbsp;|&nbsp;';
if ($action == 'show') {
    start_form(true);
    start_table(TABLESTYLE2, "width=40%");
    $th = array("Function", "Description");
    table_header($th);
    $k = 0;
    alt_table_row_color($k);
    label_cell("Table Status");
    if ($found) {
        $table_st = "Found";
    } else {
        $table_st = "<font color=red>Not Found</font>";
    }
Пример #11
0
        $stock_id = $_POST['NewStockID'];
        delete_item($stock_id);
        meta_forward($_SERVER['PHP_SELF']);
    }
}
//------------------------------------------------------------------------------------
start_form(true);
if (db_has_stock_items()) {
    start_table("class='tablestyle_noborder'");
    start_row();
    stock_items_list_cells(tr("Select an item:"), 'stock_id', null, null, null, null, 1);
    submit_cells('SelectStockItem', tr("Edit Item"));
    end_row();
    end_table();
}
hyperlink_params($_SERVER['PHP_SELF'], tr("Enter a new item"), "New=1");
echo "<br>";
start_table("{$table_style2} width=40%");
table_section_title(tr("Item"));
//------------------------------------------------------------------------------------
$id = "";
// no stock item for image load
if (!isset($_POST['NewStockID']) || isset($_POST['New'])) {
    /*If the page was called without $_POST['NewStockID'] passed to page then assume a new item is to be entered show a form with a part Code field other wise the form showing the fields with the existing entries against the part will show for editing with only a hidden stock_id field. New is set to flag that the page may have called itself and still be entering a new part, in which case the page needs to know not to go looking up details for an existing part*/
    hidden('New', 'Yes');
    text_row(tr("Item Code:"), 'NewStockID', null, 21, 20);
    $company_record = get_company_prefs();
    if (!isset($_POST['inventory_account']) || $_POST['inventory_account'] == "") {
        $_POST['inventory_account'] = $company_record["default_inventory_act"];
    }
    if (!isset($_POST['cogs_account']) || $_POST['cogs_account'] == "") {
Пример #12
0
}
if ($action == 'pcheck') {
    start_form(true);
    start_table("{$table_style2} width=40%");
    table_section_title("Price Check Options");
    $company_record = get_company_prefs();
    currencies_list_row("Customer Currency:", 'currency', get_company_pref("curr_default"));
    sales_types_list_row("Sales Type:", 'sales_type', null);
    end_table(1);
    hidden('action', 'p_check');
    submit_center('pcheck', "Check osC Prices");
    if ($num_price_errors == 0) {
        display_notification("No Pricing Errors Found");
    }
    end_form();
    hyperlink_params($_SERVER['PHP_SELF'], _("Refresh"), "action=pcheck");
    end_page();
}
if ($action == 'pupdate') {
    start_form(true);
    start_table("{$table_style2} width=40%");
    table_section_title("Update Price Options");
    $company_record = get_company_prefs();
    currencies_list_row("Customer Currency:", 'currency', get_company_pref("curr_default"));
    sales_types_list_row("Sales Type:", 'sales_type', null);
    end_table(1);
    hidden('action', 'p_update');
    submit_center('pupdate', "Update osC Prices");
    if ($num_price_errors > 0) {
        display_notification("There were {$num_price_errors} prices updated");
    }
Пример #13
0
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Work Order Additional Costs"), false, false, "", $js);
if (isset($_GET['trans_no']) && $_GET['trans_no'] != "") {
    $_POST['selected_id'] = $_GET['trans_no'];
}
//--------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $id = $_GET['AddedID'];
    $stype = ST_WORKORDER;
    display_notification(_("The additional cost has been entered."));
    display_note(get_trans_view_str($stype, $id, _("View this Work Order")));
    display_note(get_gl_view_str($stype, $id, _("View the GL Journal Entries for this Work Order")), 1);
    hyperlink_params("work_order_costs.php", _("Enter another additional cost."), "trans_no={$id}");
    hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process"));
    br();
    end_page();
    exit;
}
//--------------------------------------------------------------------------------------------------
$wo_details = get_work_order($_POST['selected_id']);
if (strlen($wo_details[0]) == 0) {
    display_error(_("The order number sent is not valid."));
    exit;
}
//--------------------------------------------------------------------------------------------------
function can_process()
{
    global $wo_details;
Пример #14
0
}
page(tr("Supplier Payment Entry"), false, false, "", $js);
if (isset($_GET['supplier_id'])) {
    $_POST['supplier_id'] = $_GET['supplier_id'];
}
//----------------------------------------------------------------------------------------
check_db_has_suppliers(tr("There are no suppliers defined in the system."));
check_db_has_bank_accounts(tr("There are no bank accounts defined in the system."));
check_db_has_bank_trans_types(tr("There are no bank payment types defined in the system."));
//----------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $payment_id = $_GET['AddedID'];
    display_notification_centered(tr("Payment has been sucessfully entered"));
    display_note(get_gl_view_str(22, $payment_id, tr("View the GL Journal Entries for this Payment")));
    hyperlink_params($path_to_root . "/purchasing/allocations/supplier_allocate.php", tr("Allocate this Payment"), "trans_no={$payment_id}&trans_type=22");
    hyperlink_params($_SERVER['PHP_SELF'], tr("Enter another supplier payment"), "supplier_id=" . $_POST['supplier_id']);
    display_footer_exit();
}
//----------------------------------------------------------------------------------------
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();
        }
Пример #15
0
        meta_forward($_SERVER['PHP_SELF']);
    }
    //end if Delete supplier
}
start_form();
if (db_has_suppliers()) {
    start_table("", 3);
    start_row();
    supplier_list_cells(tr("Select a supplier: "), 'supplier_id', null);
    submit_cells('SelectSupplier', tr("Edit Supplier"));
    end_row();
    end_table();
} else {
    hidden('supplier_id', $_POST['supplier_id']);
}
hyperlink_params($_SERVER['PHP_SELF'], tr("Enter a new supplier"), "New=1");
echo "<br>";
//start_table("class='tablestyle2'", 0, 3);
start_table("class='tablestyle'", 3);
table_section_title(tr("Supplier"));
if (isset($_POST['supplier_id']) && !isset($_POST['New'])) {
    //SupplierID exists - either passed when calling the form or from the form itself
    $myrow = get_supplier($_POST['supplier_id']);
    $_POST['supp_name'] = $myrow["supp_name"];
    $_POST['address'] = $myrow["address"];
    $_POST['email'] = $myrow["email"];
    $_POST['bank_account'] = $myrow["bank_account"];
    $_POST['dimension_id'] = $myrow["dimension_id"];
    $_POST['dimension2_id'] = $myrow["dimension2_id"];
    $_POST['curr_code'] = $myrow["curr_code"];
    $_POST['payment_terms'] = $myrow["payment_terms"];
Пример #16
0
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}");
}
Пример #17
0
        label_cell($myrow["description"]);
        label_cell($myrow["phone"]);
        label_cell($myrow["fax"]);
        label_cell("<a href=mailto:" . $myrow["email"] . ">" . $myrow["email"] . "</a>");
        label_cell($myrow["tax_group_name"]);
        edit_link_cell("debtor_no=" . $_POST['customer_id'] . "&SelectedBranch=" . $myrow["branch_code"]);
        delete_link_cell("debtor_no=" . $_POST['customer_id'] . "&SelectedBranch=" . $myrow["branch_code"] . "&delete=yes");
        end_row();
    }
    end_table();
    //END WHILE LIST LOOP
} else {
    display_note(tr("The selected customer does not have any branches. Please create at least one branch."));
}
if ($_POST['customer_id'] != "" && $_POST['branch_code'] != '') {
    hyperlink_params($_SERVER['PHP_SELF'], tr("New Customer Branch"), "debtor_no=" . $_POST['customer_id']);
}
echo "<br>";
start_table("{$table_style2} width=60%", 5);
echo "<tr valign=top><td>";
// outer table
echo "<table>";
//editing an existing branch
$sql = "SELECT * FROM cust_branch WHERE branch_code='" . $_POST['branch_code'] . "' AND debtor_no='" . $_POST['customer_id'] . "'";
$result = db_query($sql, "check failed");
$myrow = db_fetch($result);
$_POST['branch_code'] = $myrow["branch_code"];
$_POST['br_name'] = $myrow["br_name"];
$_POST['br_address'] = $myrow["br_address"];
$_POST['br_post_address'] = $myrow["br_post_address"];
$_POST['contact_name'] = $myrow["contact_name"];
Пример #18
0
            }
            unset($inv);
        } else {
            display_error(_("Invalid purchase invoice number."));
        }
    }
}
if (isset($_GET['AddedID'])) {
    $payment_id = $_GET['AddedID'];
    display_notification_centered(_("Payment has been sucessfully entered"));
    submenu_print(_("&Print This Remittance"), ST_SUPPAYMENT, $payment_id . "-" . ST_SUPPAYMENT, 'prtopt');
    submenu_print(_("&Email This Remittance"), ST_SUPPAYMENT, $payment_id . "-" . ST_SUPPAYMENT, null, 1);
    display_note(get_gl_view_str(ST_SUPPAYMENT, $payment_id, _("View the GL &Journal Entries for this Payment")));
    hyperlink_no_params($path_to_root . "/purchasing/inquiry/supplier_allocation_inquiry.php?supplier_id=", _("Select Another &Supplier Transaction for Payment"));
    //    hyperlink_params($path_to_root . "/purchasing/allocations/supplier_allocate.php", _("&Allocate this Payment"), "trans_no=$payment_id&trans_type=22");
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another Supplier &Payment"), "supplier_id=" . $_POST['supplier_id']);
    display_footer_exit();
}
//----------------------------------------------------------------------------------------
function check_inputs()
{
    global $Refs;
    if (!get_post('supplier_id')) {
        display_error(_("There is no supplier selected."));
        set_focus('supplier_id');
        return false;
    }
    if ($_POST['amount'] == "") {
        $_POST['amount'] = price_format(0);
    }
    if (!check_num('amount', 0)) {
Пример #19
0
if (isset($_GET['AddedDep'])) {
    $trans_no = $_GET['AddedDep'];
    $trans_type = ST_BANKDEPOSIT;
    display_notification_centered(sprintf(_("Deposit %d has been entered"), $trans_no));
    display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Postings for this Deposit")));
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another Deposit"), "NewDeposit=yes");
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter A Payment"), "NewPayment=yes");
    display_footer_exit();
}
if (isset($_GET['UpdatedDep'])) {
    $trans_no = $_GET['UpdatedDep'];
    $trans_type = ST_BANKDEPOSIT;
    display_notification_centered(sprintf(_("Deposit %d has been modified"), $trans_no));
    display_note(get_gl_view_str($trans_type, $trans_no, _("&View the GL Postings for this Deposit")));
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another &Deposit"), "NewDeposit=yes");
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter A &Payment"), "NewPayment=yes");
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
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"];
Пример #20
0
    $sources =& $_SESSION['Items']->src_docs;
    unset($sources[$_GET['RemoveDN']]);
}
//-----------------------------------------------------------------------------
if (isset($_GET['DeliveryNumber']) && $_GET['DeliveryNumber'] > 0 || isset($_GET['BatchInvoice'])) {
    processing_start();
    if (isset($_GET['BatchInvoice'])) {
        $src = $_SESSION['DeliveryBatch'];
        unset($_SESSION['DeliveryBatch']);
    } else {
        $src = array($_GET['DeliveryNumber']);
    }
    /*read in all the selected deliveries into the Items cart  */
    $dn = new Cart(ST_CUSTDELIVERY, $src, true);
    if ($dn->count_items() == 0) {
        hyperlink_params($path_to_root . "/sales/inquiry/sales_deliveries_view.php", _("Select a different delivery to invoice"), "OutstandingOnly=1");
        die("<br><b>" . _("There are no delivered items with a quantity left to invoice. There is nothing left to invoice.") . "</b>");
    }
    $_SESSION['Items'] = $dn;
    copy_from_cart();
} elseif (isset($_GET['ModifyInvoice']) && $_GET['ModifyInvoice'] > 0) {
    if (get_sales_parent_numbers(ST_SALESINVOICE, $_GET['ModifyInvoice']) == 0) {
        // 1.xx compatibility hack
        echo "<center><br><b>" . _("There are no delivery notes for this invoice.<br>\n\t\tMost likely this invoice was created in Front Accounting version prior to 2.0\n\t\tand therefore can not be modified.") . "</b></center>";
        display_footer_exit();
    }
    processing_start();
    $_SESSION['Items'] = new Cart(ST_SALESINVOICE, $_GET['ModifyInvoice']);
    if ($_SESSION['Items']->count_items() == 0) {
        echo "<center><br><b>" . _("All quantities on this invoice has been credited. There is nothing to modify on this invoice") . "</b></center>";
        display_footer_exit();
Пример #21
0
function handle_cancel_po()
{
    global $path_to_root;
    //need to check that not already dispatched or invoiced by the supplier
    if ($_SESSION['PO']->order_no != 0 && $_SESSION['PO']->any_already_received() == 1) {
        display_error(tr("This order cannot be cancelled because some of it has already been received.") . "<br>" . tr("The line item quantities may be modified to quantities more than already received. prices cannot be altered for lines that have already been received and quantities cannot be reduced below the quantity already received."));
        return;
    }
    if ($_SESSION['PO']->order_no != 0) {
        delete_po($_SESSION['PO']->order_no);
    }
    $_SESSION['PO']->clear_items();
    $_SESSION['PO'] = new purch_order();
    display_note(tr("This purchase order has been cancelled."), 0, 1);
    hyperlink_params($path_to_root . "/purchasing/po_entry_items.php", tr("Enter a new purchase order"), "NewOrder=Yes");
    echo "<br>";
    end_page();
    exit;
}
Пример #22
0
function handle_cancel_order()
{
    global $path_to_root;
    if ($_POST['CancelOrder'] != "") {
        if ($_SESSION['Items']->trans_type == 13) {
            display_note(tr("Direct delivery entry has been cancelled as requested."), 1);
            hyperlink_params($path_to_root . "/sales/sales_order_entry.php", tr("Enter a New Sales Delivery"), SID . "&NewDelivery=0");
        } elseif ($_SESSION['Items']->trans_type == 10) {
            display_note(tr("Direct invoice entry has been cancelled as requested."), 1);
            hyperlink_params($path_to_root . "/sales/sales_order_entry.php", tr("Enter a New Sales Delivery"), SID . "&NewDelivery=0");
        } else {
            if ($_SESSION['Items']->trans_no != 0) {
                if (sales_order_has_deliveries(key($_SESSION['Items']->trans_no))) {
                    display_error(tr("This order cannot be cancelled because some of it has already been invoiced or dispatched. However, the line item quantities may be modified."));
                } else {
                    delete_sales_order(key($_SESSION['Items']->trans_no));
                }
            }
            display_note(tr("This sales order has been cancelled as requested."), 1);
            hyperlink_params($path_to_root . "/sales/sales_order_entry.php", tr("Enter a New Sales Order"), SID . "&NewOrder=Yes");
        }
        processing_end();
        br(1);
        end_page();
        exit;
    }
}