- global $debug;
-
- /*Now need to check that the order details are the same as they were when
- they were read into the Items array.
- If they've changed then someone else may have invoiced them -
- as modified for bug pointed out by Sherif 1-7-03*/
-
- $sql = "SELECT stk_code, quantity, qty_invoiced FROM ".TB_PREF."sales_order_details WHERE
- quantity - qty_invoiced > 0
- AND order_no = " . $_SESSION['ProcessingOrder'];
-
- $result = db_query($sql,"retreive sales order details");
-
- if (db_num_rows($result) != count($_SESSION['Items']->line_items))
- {
-
- /*there should be the same number of items returned from this query as there are lines on the invoice -
- if not then someone has already invoiced or credited some lines */
- if ($debug == 1)
- {
- display_note($sql, 1, 0);
- display_note("No rows returned by sql:" . db_num_rows($result), 1, 0);
- display_note("Count of items in the session " . count($_SESSION['Items']->line_items), 1, 0);
- }
-
- return false;
+ $cart = &$_SESSION['Items'];
+ $cart->ship_via = $_POST['ship_via'];
+ $cart->freight_cost = input_num('ChargeFreightCost');
+ $cart->document_date = $_POST['InvoiceDate'];
+ $cart->due_date = $_POST['due_date'];
+ if ($cart->pos['cash_sale'] || $cart->pos['credit_sale']) {
+ $cart->payment = $_POST['payment'];
+ $cart->payment_terms = get_payment_terms($_POST['payment']);