X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fdb%2Fpayment_db.inc;h=e1147b1c856465ed1643e32f475a12bb6ed56596;hb=45e45a854c40a7a2f9cc8f11e07a259c6923babd;hp=74054b06965669e886c5e6389b6fa44a6286a4cd;hpb=f12dbe7523bb1abc6cd69b009ef8f0be838f5348;p=fa-stable.git diff --git a/sales/includes/db/payment_db.inc b/sales/includes/db/payment_db.inc index 74054b06..e1147b1c 100644 --- a/sales/includes/db/payment_db.inc +++ b/sales/includes/db/payment_db.inc @@ -3,7 +3,7 @@ Write/update customer payment. */ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_account, - $date_, $receipt_type, $ref, $amount, $discount, $memo_) + $date_, $ref, $amount, $discount, $memo_) { begin_transaction(); @@ -12,6 +12,8 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou $payment_no = write_customer_trans(12, $trans_no, $customer_id, $branch_id, $date_, $ref, $amount, $discount); + $bank_gl_account = get_bank_gl_account($bank_account); + if ($trans_no != 0) { delete_comments(12, $trans_no); void_bank_trans(12, $trans_no, true); @@ -21,7 +23,7 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou /* Bank account entry first */ add_gl_trans_customer(12, $payment_no, $date_, - $bank_account, 0, 0, $amount, $customer_id, + $bank_gl_account, 0, 0, $amount, $customer_id, "Cannot insert a GL transaction for the bank account debit"); if ($branch_id != reserved_words::get_any_numeric()) { @@ -52,7 +54,7 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou /*now enter the bank_trans entry */ add_bank_trans(12, $payment_no, $bank_account, $ref, - $date_, $receipt_type, $amount, payment_person_types::customer(), $customer_id, + $date_, $amount, payment_person_types::customer(), $customer_id, get_customer_currency($customer_id)); add_comments(12, $payment_no, $date_, $memo_);