Sub-ledgers for relations
3 min read

Sub-ledgers for relations

Sub-ledgers for relations
Photo by Robert Anasch / Unsplash

In the last issue, we saw how ledger accounts categorize a company's assets, liabilities, revenue, and expenses. By using the correct ledger account in journal entries, you automatically create the right insights into the performance of the business. We also need to have sub-ledgers for some situations to get even more insight. That's the topic for this week's issue.

In previous examples, we have seen the journal entries for a sale:

╭──────────────────────────────────────────────────┬───────┬────────╮
│ Ledger account                                   │ Debit │ Credit │
├──────────────────────────────────────────────────┼───────┼────────┤
│ balance_sheet.current_assets.accounts_receivable │ 100.0 │    0.0 │
│ profit_loss.revenue.consultancy                  │   0.0 │  100.0 │
├──────────────────────────────────────────────────┼───────┼────────┤
│                                                  │ 100.0 │  100.0 │
╰──────────────────────────────────────────────────┴───────┴────────╯
Journal entries for a sales invoice

We'll focus on the accounts receivable row. The assets are increased by $100 because we expect a payment from the debtor. The $100 is visible in the accounts receivable balance on the balance sheet. With our business doing well, there will soon be many accounts receivable bookings. How do we keep track of the customers we expect money from? Time to introduce you to sub-ledgers!

Keeping track of debtors and creditors

The company's ledger paints a picture of the whole company. The sub-ledger paints a picture of a subset of the company, more specifically about a particular debtor or creditor. I'll call debtors and creditors relations from now on because you can handle them the same.

We create a sub-ledger by adding an extra column relation to our journal entries.

╭──────────────────────────────────────────────────┬──────────┬───────┬────────╮
│ Ledger account                                   │ Relation │ Debit │ Credit │
├──────────────────────────────────────────────────┼──────────┼───────┼────────┤
│ balance_sheet.current_assets.accounts_receivable │ b4134    │ 100.0 │    0.0 │
│ profit_loss.revenue.consultancy                  │          │   0.0 │  100.0 │
├──────────────────────────────────────────────────┼──────────┼───────┼────────┤
│                                                  │          │ 100.0 │  100.0 │
╰──────────────────────────────────────────────────┴──────────┴───────┴────────╯

Now we can also get the accounts receivable balance for a specific relation. For example, with an SQL query:

SELECT relation, SUM(debit-credit) FROM journal_entries
  WHERE ledger_account = 'accounts_receivable'
  GROUP BY relation;
    

This query effectively creates a simple debtor report. A debtor report is used in accounting to see which debtors the company has.

Payments for relations

When we receive payments from a relation, we create journal entries with the correct relation. The balance for all accounts receivables and the specific relation is updated.

╭──────────────────────────────────────────────────┬──────────┬───────┬────────╮
│ Ledger account                                   │ Relation │ Debit │ Credit │
├──────────────────────────────────────────────────┼──────────┼───────┼────────┤
│ balance_sheet.current_assets.accounts_receivable │ b4134    │ 100.0 │    0.0 │
│ balance_sheet.current_assets.bank_account        │          │   0.0 │  100.0 │
├──────────────────────────────────────────────────┼──────────┼───────┼────────┤
│                                                  │          │ 100.0 │  100.0 │
╰──────────────────────────────────────────────────┴──────────┴───────┴────────╯

You can imagine this sub-ledger system becomes especially powerful when not all payments match. The debtor or creditor balance reports over all the invoices and payments. Having a balance for the relation makes it possible to settle amounts between different invoices.

Lastly, you might wonder why don't we create a ledger account for each relation. The reason is primarily due to a large number of company relations. At Moneybird, we have nearly 100.000 debtors. Adding a ledger account for each debtor would create massive balance sheet reports. A sub-ledger is much easier to deal with when the numbers grow.

Sub-ledgers as an external ledger

External ledgers deserve a separate issue on their own. For now, I want to point out how a sub-ledger can also create reports for a relation. For example, your bank maintains a sub-ledger for your bank accounts. Each deposit and withdrawal links to your sub-ledger. When you request an overview of transactions or display the balance, you effectively look at your sub-ledger.

This concludes this week's issue. We now have covered most basics of double-entry accounting, starting with an introduction and the ledger account tree. External ledgers are the topic of next week's issue. Subscribe to receive the example in your mailbox when it is published!

📬
I'd love to hear from you! Let me know what you think or if you have questions. Do you already use double-entry accounting? Are you going to use it in the future? Please shoot me an e-mail at edwin@winno.nl.