I've come across an interesting pattern in a lot of my Ledger files,
that of a "Transfer" account.  The general concept is that a Transfer
account should balance to zero, and if it doesn't balance to zero,
something is amiss - a transaction has been lost, or has yet to be
recorded.

Two examples where this is useful:

1. I tend to have a lot of files generated elsewhere and converted
from OFX/CSV.  If you moved money from a checking account to savings,
and are also auto-converting both accounts with a OFX/CSV -> Ledger
tool, you'd end up with two nearly identical entries like this, one
from each converted file.

2012/01/01 Transfer from Checking to Savings
 Assets:Savings  $100
 Assets:Checking

Having two records of the same transaction would cause your accounts
not to balance.  One response would be to delete one of the
transactions, but that's a manual step that would need to be done
every time, or automatically deleted (which could be failure prone).

Using the Transfer account pattern, you'd tweak your CSV > ledger
conversion to generate the following records:

2012/01/01 Transfer from Checking to Savings
 ; Generated from Checking account CSV > ledger
 Transfers:Checking_Savings  $100
 Assets:Checking

2012/01/01 Transfer from Checking to Savings
 ; Generated from Savings account CSV > ledger
 Assets:Savings  $100
 Transfers:Checking_Savings

This has several upsides

 - No manual tweaking after a CSV > ledger conversion.
 - You can immediately know where any transfer went wrong (and which
account didn't register it)
 - When everything has cleared, the balance in the Transfer account is
zero so it doesn't appear in any balance reports

2. As a business, you can get paid in many different ways, and there
often is a gap between recieving a check or credit card payment.  In
my case, I do the following to track payments through the entire
process:

2012/01/01 Invoice
 Company:Assets:Accounts Receivable $200
 Customer:Invoice:Labor  -$200

2012/01/01 Check #1000
 Company:Assets:Accounts Receivable  -$200
 Company:Assets:Checking Deposits  $200
 Customer:Equity  -$200
 Customer:Payments:Check  $200

2012/01/02 Deposit Checks at Bank
 Company:Accounts:Checking  $200
 Company:Assets:Checking Deposits - $200

In this example, I'm using the Transfer pattern twice, once to
maintain a list of Accounts Receivable, and another time to balance
Checks after their received, but before they've cleared the bank.
As with before, once everything has been paid in full, these accounts
balance to zero, so they don't clutter the final output of balance
queries.

I hope someone else finds this useful - it's a very simple pattern
that has greatly helped me develop better, easier to work with Ledger
workflows.

- Zack

Reply via email to