The following change accompanies the patch to purchasing/includes/db/invoice_db.inc to handle supplier credit notes for the same situation as described in my previous post:

From eccfe6f4ef698d433fedceeefb1064f839555cfb Mon Sep 17 00:00:00 2001
From: Jim Cunning <jim@herzmantrust.com>
Date: Tue, 20 Aug 2024 13:55:13 -0700
Subject: [PATCH 2/2] purchasing/includes/db/invoice_db.inc:  Change to
 properly credit bank account on supplier credit note.  Part of the previous
 commit to permit bank account debit on cogs accounts that are also bank
 accounts.

---
 purchasing/includes/db/invoice_db.inc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/purchasing/includes/db/invoice_db.inc b/purchasing/includes/db/invoice_db.inc
index 63cad4e4..8505a74f 100644
--- a/purchasing/includes/db/invoice_db.inc
+++ b/purchasing/includes/db/invoice_db.inc
@@ -289,6 +289,14 @@ function add_supp_invoice(&$supp_trans)
                                ($supplier["purchase_account"] ? $supplier["purchase_account"] : $stock_gl_code["cogs_account"]));
                        $total += add_gl_trans_supplier($trans_type, $invoice_id, $date_, $iv_act,
                                $dim, $dim2, $taxfree_line, $supp_trans->supplier_id);
+
+                       // if gl account is a bank account, also post credit there
+                       $bank = is_bank_account($iv_act);
+                       if ($bank != 0)
+                       {
+                               add_bank_trans($trans_type, $invoice_id, $bank, $ref, $date_,
+                                  $taxfree_line, PT_SUPPLIER, $supp_trans->supplier_id);
+                       }
                }
        else
        {
-- 
Jim Cunning <jim@herzmantrust.com>

I can see that I was unsuccessful attaching the git patch file to my previous comment.  I will try using code:

From d2b1aa14589aa5e2cbbf8b388c8b027a90a96e91 Mon Sep 17 00:00:00 2001
From: Jim Cunning <jim@herzmantrust.com>
Date: Sun, 18 Aug 2024 16:46:36 -0700
Subject: [PATCH] purchasing/includes/db/invoice_db.inc:  Changes to allow
 debiting a cogs account that is also a bank account.  Makes sense only when
 the account is a credit-type account used for recording credit card purchases
 and the invoice being processed is to pay the accumulated credit card charges
 with a printed check. This function is not needed if the credit card bank
 account is paid via bank transfers only.

---
 purchasing/includes/db/invoice_db.inc | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/purchasing/includes/db/invoice_db.inc b/purchasing/includes/db/invoice_db.inc
index a0043279..63cad4e4 100644
--- a/purchasing/includes/db/invoice_db.inc
+++ b/purchasing/includes/db/invoice_db.inc
@@ -132,6 +132,7 @@ function add_supp_invoice(&$supp_trans)
        $trans_no = $supp_trans->trans_no;
        $trans_type = $supp_trans->trans_type;
        $supplier = get_supplier($supp_trans->supplier_id);
+       $ref = $supp_trans->reference;
     $dim = !empty($supp_trans->dimension) ? $supp_trans->dimension :
         ($supplier['dimension_id'] ? $supplier['dimension_id'] : 0);
     $dim2 = !empty($supp_trans->dimension2) ? $supp_trans->dimension2 :
@@ -305,8 +306,18 @@ function add_supp_invoice(&$supp_trans)
 
                        $old_date = sql2date($old[1]);
                        if (!is_inventory_item($entered_grn->item_code))
+                       {
                                $total += add_gl_trans_supplier($trans_type, $invoice_id, $date_, $iv_act,
                                        $dim, $dim2, $taxfree_line, $supp_trans->supplier_id);
+
+                               // if gl account is a bank account, also post debit there
+                               $bank = is_bank_account($iv_act);
+                               if ($bank != 0)
+                               {
+                                       add_bank_trans($trans_type, $invoice_id, $bank, $ref, $date_,
+                                          $taxfree_line, PT_SUPPLIER, $supp_trans->supplier_id);
+                               }
+                       }
                        else
                        {
                                $ex_rate = get_exchange_rate_from_home_currency($supp_trans->currency, $old_date);
-- 
Jim Cunning <jim@herzmantrust.com>

I have spent the last few weeks looking on and off to see how to implement the behavior I was looking for.  I have come up with what I think works, and appears to be safe.  I have run a number of tests of the scenario I originally described using the Test company data from Release 2.4.18, including using different currencies.  I am satisfied that my changes work for my purposes and am offering them to you for review.  I hope this an appropriate medium to submit my proposed changes.  Please see the attached git patch file.

Jim Cunning

Oops, I see that you were writing to me the same time I was responding to your post of about 8 hours earlier.  I didn't see that until I reviewed the whole sequence.

I think what you're suggesting is what I have been doing up to now.  I was doing bank transfers to debit the CC account and credit the checking account.  But then I wasn't able to then print a check to pay the credit card company for the collected charges by my suppliers. 

I could make my credit card company also a supplier, create and pay an invoice for them, and print a check for that payment.  But then if I had also done a bank transfer, I would have two credits to my checking account for the same amount. 

Another issue is what would the AP account for the CC payment if not the checking account?  I suppose the CC invoice payment could credit and debit the same account just to get the supplier balances right and keep the checking account correct, but that seems silly and could raise red flags with an auditor (not really an issue for me, but possibly for other companies).

Yes, I came that conclusion too, after studying the code for the last couple of days--never having looked at any of it beyond the check print module.  I did not realize initially that bank accounts were separate from GL accounts, and that there wasn't always a one-to-one relationship between a bank account and GL account. I can't think of a use-case where that makes sense, but since it's in the code, there must be one.

It seems to me that the underlying COGS account for this case should only be a credit-type account, as it would make no sense for a supplier invoice to debit a checking or savings account.  There are bank transfers and journal entries for that.

Since this is something I want to be able to do--have a credit account that I can reconcile, and be able to print a check to pay the bill--I was considering trying to fix it myself (supplier invoices and payments of all types, supplier credits, and voiding transactions).  I would be interested to see how tricky a fix might be.

I decided to try a simpler, step by step approach to investigate where my problem lay, so I used the demo company data. It seems that the problem is in the Bank Account Inquiry.  Please refer to the attached description of my findings.

Thanks,

Thank you for your response:

FrontAccounting 2.4.18

Please refer to the annotated file attached.

Thank you.

I have been using FA for several years. One of the accounts I have is a CURRENT LIABILITY bank account in which I collect the credit card purchases of my business.  In the past I have simply used the Bank Transfer function to move the credit balance of the credit card account to my checking account  and then initiating an online bank transfer to pay the credit card company. 

I now need to write a check and would like to pay the credit card bill.  To do this
1.  I created a Supplier (the CC company) and set the Purchase Account to the Credit card liability account, and the Accounts Payable to accounts payable. 
2. I expected that creating an invoice for this Supplier would create a debit to the credit card account and a credit to accounts payable. Looking at the journal entries seemed to confirm my desired result.
3.  I then entered a supplier payment, selecting the checking account to pay the bill.  Again, the journal entries confirm what I expected to see.
4.  A Bank Account Inquiry on the checking account shows the payment reducing (crediting) the account balance, but an inquiry on the liability bank account does not show the debit to that account, even though the journal entry shows that it should.
5.  I am able to select printing a check from the payment made in #3 above.
6.  A Supplier Balance Report correctly shows the expected charges, credits and allocations.

Everything appears to work as I hoped except for the liability account. How can I get the liability account correctly updated?

I am familiar with quick entries and use them for various journal entries, etc.  What I do not know is what the "balance based" checkbox does and see nothing in the WIKI that explains it.

I cannot find an documentation on how to use a balance-based quick journal entry.  There is a check-box for a line in the journal entry, but no explanation of what that does.  Could someone please give some guidance, or direct me to some documentation?  Thanks.