include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc");
include_once($path_to_root . "/includes/banking.inc");
+include_once($path_to_root . "/includes/inventory.inc");
include_once($path_to_root . "/includes/date_functions.inc");
-include_once($path_to_root . "/includes/db/inventory_db.inc");
include_once($path_to_root . "/includes/db/allocations_db.inc");
include_once($path_to_root . "/purchasing/includes/db/supp_trans_db.inc");
$inv_no = add_supp_invoice($inv);
if ($cart->cash_account) {
- $pmt_no = write_supp_payment(0, $inv->supplier_id, $cart->cash_account, $inv->tran_date, $Refs->get_next(ST_SUPPAYMENT),
+ $pmt_no = write_supp_payment(0, $inv->supplier_id, $cart->cash_account, $inv->tran_date, $Refs->get_next(ST_SUPPAYMENT, null, $inv->tran_date),
$total, 0, _('Payment for:').$inv->supp_reference .' ('.$type_shortcuts[ST_SUPPINVOICE].$inv_no.')');
add_supp_allocation($total, ST_SUPPAYMENT, $pmt_no, ST_SUPPINVOICE, $inv_no, $inv->supplier_id, $inv->tran_date);
update_supp_trans_allocation(ST_SUPPINVOICE, $inv_no, $inv->supplier_id);