Transaction references extended with parametrized patterns, added check_reference...
[fa-stable.git] / sales / includes / db / sales_invoice_db.inc
index c944c6bf656ed47976380ea1bc199d7f47cd0534..4028233e78f11f97818b4fffeb57f8917bcd44b8 100644 (file)
@@ -195,7 +195,9 @@ function write_sales_invoice(&$invoice)
                        $discount = 0; // $invoice->cash_discount*$amount;
                        $pmtno = write_customer_payment(0, $invoice->customer_id, 
                                $invoice->Branch, $invoice->pos['pos_account'], $date_,
-                               $Refs->get_next(ST_CUSTPAYMENT), $amount-$discount, $discount,
+                               $Refs->get_next(ST_CUSTPAYMENT, null, array('customer' => $invoice->customer_id,
+                                       'branch' => $invoice->Branch, 'date' => $date_)),
+                               $amount-$discount, $discount,
                                _('Cash invoice').' '.$invoice_no);
                        add_cust_allocation($amount, ST_CUSTPAYMENT, $pmtno, ST_SALESINVOICE, $invoice_no, $invoice->customer_id, $date_);