function create_recurrent_invoices($customer_id, $branch_id, $order_no, $tmpl_no, $date, $from, $to)
{
    global $Refs;
    $doc = new Cart(ST_SALESORDER, array($order_no));
    get_customer_details_to_order($doc, $customer_id, $branch_id);
    $doc->trans_type = ST_SALESORDER;
    $doc->trans_no = 0;
    $doc->document_date = $date;
    $doc->due_date = get_invoice_duedate($doc->payment, $doc->document_date);
    $doc->reference = $Refs->get_next($doc->trans_type);
    if ($doc->Comments != "") {
        $doc->Comments .= "\n";
    }
    $doc->Comments .= sprintf(_("Recurrent Invoice covers period %s - %s."), $from, add_days($to, -1));
    foreach ($doc->line_items as $line_no => $item) {
        $line =& $doc->line_items[$line_no];
        $line->price = get_price($line->stock_id, $doc->customer_currency, $doc->sales_type, $doc->price_factor, $doc->document_date);
    }
    $cart = $doc;
    $cart->trans_type = ST_SALESINVOICE;
    $cart->reference = $Refs->get_next($cart->trans_type);
    $invno = $cart->write(1);
    if ($invno == -1) {
        display_error(_("The entered reference is already in use."));
        display_footer_exit();
    }
    update_last_sent_recurrent_invoice($tmpl_no, $to);
    return $invno;
}
Ejemplo n.º 2
0
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();
}
Ejemplo n.º 3
0
function safe_exit()
{
    global $path_to_root;
    hyperlink_no_params("", _("Enter a &new dimension"));
    echo "<br>";
    hyperlink_no_params($path_to_root . "/dimensions/inquiry/search_dimensions.php", _("&Select an existing dimension"));
    display_footer_exit();
}
Ejemplo n.º 4
0
check_db_has_suppliers(tr("There are no suppliers defined in the system."));
check_db_has_purchasable_items(tr("There are no purchasable inventory items defined in the system."));
//---------------------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $order_no = $_GET['AddedID'];
    $trans_type = systypes::po();
    if (!isset($_GET['Updated'])) {
        display_notification_centered(tr("Purchase Order has been entered"));
    } else {
        display_notification_centered(tr("Purchase Order has been updated") . " #{$order_no}");
    }
    display_note(get_trans_view_str($trans_type, $order_no, tr("View this order")));
    hyperlink_params($path_to_root . "/purchasing/po_receive_items.php", tr("Receive Items on this Purchase Order"), "PONumber={$order_no}");
    hyperlink_params($_SERVER['PHP_SELF'], tr("Enter Another Purchase Order"), "NewOrder=yes");
    hyperlink_no_params($path_to_root . "/purchasing/inquiry/po_search.php", tr("Select An Outstanding Purchase Order"));
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
function copy_to_po()
{
    $_SESSION['PO']->supplier_id = $_POST['supplier_id'];
    $_SESSION['PO']->orig_order_date = $_POST['OrderDate'];
    $_SESSION['PO']->reference = $_POST['ref'];
    $_SESSION['PO']->requisition_no = $_POST['Requisition'];
    $_SESSION['PO']->Comments = $_POST['Comments'];
    $_SESSION['PO']->Location = $_POST['StkLocation'];
    $_SESSION['PO']->delivery_address = $_POST['delivery_address'];
}
//--------------------------------------------------------------------------------------------------
function copy_from_po()
{
Ejemplo n.º 5
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();
}
Ejemplo n.º 6
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}");
}