Void a Transaction: fixed GRN voiding.
[fa-stable.git] / purchasing / includes / purchasing_db.inc
index 5aa8be944b32b883f3e61a74803a47e1132fa292..983085769894f972b327eda71eae97da4fc9dc34 100644 (file)
 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");
@@ -211,7 +211,7 @@ function add_direct_supp_trans($cart)
        $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);