コード例 #1
0
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();
}
コード例 #2
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;
    }
}