I recently started using ledger(1) for accounting and managing finances.
One of the main things I wanted to have was to be able to record invoices as they were sent and then later record payments as they were actually paid. You can do this a couple of different ways, the most obvious is to have a different account for each client:
2019/08/03=2019/08/13 Invoice
Assets:Receivable:ACME Inc 5000 GBP
Income:Contracting
2019/08/08=2019/08/15 Invoice
Assets:Receivable:Oceanic Airlines 8000 USD @ 0.80 GBP
Income:Contracting
2019/08/13 Invoice Paid
Assets:Checking 5000 GBP
Assets:Receivable:ACME Inc
2019/08/15 Invoice Paid
Assets:Checking 4000 USD @ 0.80 GBP
Assets:Receivable:Oceanic Airlines
And then running a simple balance report (making sure we display only in GBP):
$ ledger -f contracting.ledger bal Receivable -X GBP
3200 GBP Assets:Receivable:Oceanic Airlines
This is a good enough solution, but I feel like the balance report becomes overly complex if you have many different clients who are unpaid.
There is an interesting option for grouping transactions by tag and
preserving this extra metadata without creating new accounts for every
different client. --pivot TAG
is used for this, see the example
below:
2019/08/03=2019/08/13 Invoice
; Client: ACME Inc.
Assets:Receivable 5000 GBP
Income:Contracting
2019/08/08=2019/08/15 Invoice
; Client: Oceanic Airlines
Assets:Receivable 8000 USD @ 0.80 GBP
Income:Contracting
2019/08/13 Invoice Paid
; Client: ACME Inc.
Assets:Checking 5000 GBP
Assets:Receivable
2019/08/15 Invoice Paid
; Client: Oceanic Airlines
Assets:Checking 4000 USD @ 0.80 GBP
Assets:Receivable
And now using the --pivot
option:
$ ledger -f contracting.ledger bal Receivable --pivot Client
3200 GBP Client:Oceanic Airlines:Assets:Receivable
I prefer the second type for tracking who the invoices were to and who has paid. I think it is also possible to add extra metadata such as the invoice number so you could track down exactly which invoices are still due to be paid, though I haven't looked into this yet.