Exemplo n.º 1
0
function create_cart($type, $trans_no)
{
    global $Refs;
    if (!$_SESSION['SysPrefs']->db_ok) {
        // create_cart is called before page() where the check is done
        return;
    }
    processing_start();
    if (isset($_GET['NewQuoteToSalesOrder'])) {
        $trans_no = $_GET['NewQuoteToSalesOrder'];
        $doc = new Cart(ST_SALESQUOTE, $trans_no, true);
        $doc->Comments = _("Sales Quotation") . " # " . $trans_no;
        $_SESSION['Items'] = $doc;
    } elseif ($type != ST_SALESORDER && $type != ST_SALESQUOTE && $trans_no != 0) {
        // this is template
        $doc = new Cart(ST_SALESORDER, array($trans_no));
        $doc->trans_type = $type;
        $doc->trans_no = 0;
        $doc->document_date = new_doc_date();
        if ($type == ST_SALESINVOICE) {
            $doc->due_date = get_invoice_duedate($doc->payment, $doc->document_date);
            $doc->pos = get_sales_point(user_pos());
        } else {
            $doc->due_date = $doc->document_date;
        }
        $doc->reference = $Refs->get_next($doc->trans_type);
        //$doc->Comments='';
        foreach ($doc->line_items as $line_no => $line) {
            $doc->line_items[$line_no]->qty_done = 0;
        }
        $_SESSION['Items'] = $doc;
    } else {
        $_SESSION['Items'] = new Cart($type, array($trans_no));
    }
    copy_from_cart();
}
Exemplo n.º 2
0
    if ($ord->count_items() == 0) {
        hyperlink_params($path_to_root . "/sales/inquiry/sales_orders_view.php", _("Select a different sales order to delivery"), "OutstandingOnly=1");
        die("<br><b>" . _("This order has no items. There is nothing to delivery.") . "</b>");
    }
    // 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');
    }
}
Exemplo n.º 3
0
function create_cart($type, $trans_no)
{
    processing_start();
    $doc_type = $type;
    if ($type != 30 && $trans_no != 0) {
        // this is template
        $doc_type = 30;
        $doc = new Cart(30, array($trans_no));
        $doc->trans_type = $type;
        $doc->trans_no = 0;
        if ($type == 10) {
            $doc->due_date = get_invoice_duedate($doc->customer_id, $doc->document_date);
        } else {
            $doc->due_date = $doc->document_date = Today();
        }
        $doc->reference = references::get_next($doc->trans_type);
        $doc->Comments = '';
        foreach ($doc->line_items as $line_no => $line) {
            $doc->line_items[$line_no]->qty_done = 0;
        }
        $_SESSION['Items'] = $doc;
    } else {
        $_SESSION['Items'] = new Cart($type, array($trans_no));
    }
    copy_from_cart();
}