- processing_start();
-
- $_SESSION['Items'] = new Cart(ST_SALESORDER, $order_no, ST_SALESINVOICE);
- $_SESSION['Items']->order_no = $order_no;
- $_SESSION['Items']->src_docs = array($order_no);
- $_SESSION['Items']->trans_no = 0;
- $_SESSION['Items']->trans_type = ST_SALESINVOICE;
- $_SESSION['Items']->prepayments = $payments;
- // prepayment invoice has all line quantities as stated on order.
-// foreach($_SESSION['Items']->line_items as &$line)
-// {
-// $line->src_id = $line_id;
-// $line->qty_dispatched = $line->quantity;
-// }
-// unset($line);
- $_SESSION['Items']->update_payments();
-
-// $_SESSION['Items']->alloc = $this_amount;
- copy_from_cart();
+ $order_no = $payments[0]['trans_no_to'];
+ }
+ else {
+ $order_no = $_GET['InvoicePrepayments'];
+ }
+ processing_start();
+
+ $_SESSION['Items'] = new cart(ST_SALESORDER, $order_no, ST_SALESINVOICE);
+ $_SESSION['Items']->order_no = $order_no;
+ $_SESSION['Items']->src_docs = array($order_no);
+ $_SESSION['Items']->trans_no = 0;
+ $_SESSION['Items']->trans_type = ST_SALESINVOICE;
+
+ $_SESSION['Items']->update_payments();
+
+ copy_from_cart();