-function process_invoice($invoicing=false)
-{
- if ($invoicing)
- {
- read_sales_order($_SESSION['Items']->order_no, $_SESSION['Items'], true);
- $duedate = get_invoice_duedate($_SESSION['Items']->customer_id, $_SESSION['Items']->delivery_date);
- $invoice_no = add_sales_invoice($_SESSION['Items'],
- $_SESSION['Items']->delivery_date, $duedate, $_SESSION['Items']->order_no,
- $_SESSION['Items']->tax_group_id, $_SESSION['Items']->freight_cost,
- $_SESSION['Items']->Location, $_SESSION['Items']->ship_via,
- $_SESSION['Items']->default_sales_type, references::get_next(10),
- $_SESSION['Items']->memo_, 0);
- }
- else
- {
-
- if (!check_data())
- return;
-
- if (!check_order_changed())
- order_changed_error();
-
- if (!check_qoh())
- return;
-
- if ($_POST['bo_policy'])
- $bo_policy = 0;
- else
- $bo_policy = 1;
-
- $invoice_no = add_sales_invoice($_SESSION['Items'],
- $_POST['DispatchDate'], $_POST['due_date'], $_SESSION['ProcessingOrder'],
- $_POST['tax_group_id'], $_POST['ChargeFreightCost'], $_POST['Location'],
- $_POST['ship_via'], $_POST['sales_type_id'], $_POST['ref'],
- $_POST['InvoiceText'], $bo_policy);
- unset($_SESSION['ProcessingOrder']);