Here we'll give a quick hledger-oriented intro to some useful accounting concepts (continuing with the journal file from Easy workflow #1: hledger add). Also we'll discuss account hierarchy in hledger. At the end, there's a collection of useful links to learn more.
Conventional double-entry accounting uses a system of debits and credits to ensure that, in every transaction, total debits equal total credits. However, hledger and other ledger-likes instead use positive and negative numbers and ensure that, in every transaction, the sum of all amounts is zero. This has the same result, but in hledger equity, liabilities, and revenue are conventionally negative numbers.
In what follows we use the general accounting system of debits and credits. Within hledger the accounting equations will be the same, except that equity, liabilities, and revenues will have the opposite sign.
Accounting describes the status of a business, person or other entity at any point in time in terms of three amounts:
- Assets - Things owned
- Liabilities - Things owed
- Equity - The amount invested by owners/shareholders
The foundation of double-entry accounting is the accounting equation, which says Equity is always equal to Assets minus Liabilities (or, Net Assets).
This is also written as: Assets = Liabilities + Equity. Another way to say it: what the entity owns is funded either by debt or by the capital provided by its owners.
These three are called the Balance Sheet accounts. Their balances summarise the overall financial status at some point in time.
Two more amounts are used to describe changes in the above during a given period:
- Revenue - Money flowing in
- Expenses - Money flowing out
You may be accustomed to using the word Income instead Revenue. That's fine, just remember that Income is sometimes used to mean Net Income, which is Revenue - Expenses.
These two are called the Income Statement accounts. The balances they accumulate during some period of time indicate the inflows and outflows during that period (which will affect the Assets and Liabilities balances).
Five numbers do not give a lot of detail. If you want to know what portion of expenses went to buy food, you could add up just the transactions with (say) "supermarket" in their description. You know how to do this with hledger:
$ hledger register desc:supermarket expenses 2015/05/25 trip to the super.. expenses $10 $10
But descriptions are irregular, and as you can see we missed the $5 purchase on the following day.
Instead, the major "top-level" accounts above are subdivided into subaccounts which can be used
in transactions, thereby categorising them in a more structured way.
If needed, these subaccounts can be subdivided further.
This tree of accounts is called the Chart of Accounts. Here's a simple example
expenses each have a few subaccounts:
assets checking cash liabilities equity revenue business income gifts received expenses food rent supplies
In some organisations and accounting systems (eg, QuickBooks), the tree structure is de-emphasised, so the above is represented more like:
Account name Account type ------------------------------- checking ASSET cash ASSET business income REVENUE gifts received REVENUE food EXPENSE rent EXPENSE supplies EXPENSE
In others, the tree structure is encoded as decimal account numbers, something like this:
1000 assets 1100 checking 1200 cash 2000 liabilities 3000 equity 4000 revenue 4100 business income 4200 gifts received 5000 expenses 5100 food 5200 rent 5300 supplies
With hledger, tree structure is implied by writing account names like
Try it: edit your journal file and change the account names like so:
$ cat ~/.hledger.journal 2015/05/25 trip to the supermarket expenses:supplies $10 assets:checking $-10 2015/05/26 forgot the bread expenses:food $5 assets:cash
hledger will infer the chart of accounts from these names.
accounts command will list all accounts posted to:
$ hledger accounts assets:cash assets:checking expenses:food expenses:supplies
accounts --tree will show the tree structure, indenting subaccounts below their parents (and eliding the common part of their names):
assets cash checking expenses food supplies
balance command shows the tree structure by default:
$ hledger balance $-15 assets $-5 cash $-10 checking $15 expenses $5 food $10 supplies -------------------- 0
As you can see, the balance reported for parent accounts includes the balances of any subaccounts (it would also include any postings to the parent account itself.)
To see full account names in a flat list, use
$ hledger balance --flat $-5 assets:cash $-10 assets:checking $5 expenses:food $10 expenses:supplies -------------------- 0
hledger accepts whatever account names you choose, so you can use as much or as little account hierarchy as you need. Most users have at least two levels of accounts. You can limit the amount of detail in a balance report by hiding accounts below a certain depth:
$ hledger balance --depth 1 $-15 assets $15 expenses -------------------- 0
- Wikipedia: Accounting, Bookkeeping, Double-entry bookkeeping system, General journal etc.
- Accounting For Dragons why you should know accounting
- Cliffs Notes: Accounting Principles I, Accounting Principles II
- Bean Counter - tutorials, such as So, you want to learn Bookkeeping!. This has been recommended on the ledger list and on HN.
- Accounting Coach
- Accounting Basics
- Guru 99 Accounting Tutorials
- Double Entry Bookkeeping discussion by software developers at the WikiWikiWeb
- Winning Financially is Simple and other good episodes from the YNAB Podcast
- Back to the Stone Age: Low-Tech Expense Tracking Get Rich Slowly
- Track Every Penny You Spend Get Rich Slowly
- I’ve Tracked My Expenses — Now What? Get Rich Slowly
- A Slow-Tech Approach to Tracking Spending
- Your Financial Network Map
- The Accountancy Model and The Accountancy Model Examples - two free books by Tim Riley
- Gnucash and double entry accounting - double entry accounting introduction with examples
- Accounting for Computer Scientists
- Tutorial on multiple currency accounting by Peter Selinger
- Financial Statements: A Beginner's Guide
- Algebraic Models for Accounting Systems - recommended on twitter
- On Double-Entry Bookkeeping: The Mathematical Treatment David Ellerman 2014, http://www.ellerman.org/double-entry-bookkeeping
- Essence of Accounting "A logical description of the record to report process: accounting, reporting, auditing, analysis", Charles Hoffman 2020
- History of Accounting, Wikipedia
- From accounting to negative numbers: A signal contribution of medieval India to mathematics, Accounting Historians Journal 1998
- The Vanished Grandeur of Accounting & discussion, Boston Globe
- How the world's first accountants counted on cuneiform, BBC News
- The Significance of Ancient Mesopotamia in Accounting History
- Mesopotamian Tablet Collection, Spurlock Museum
- Ledger Art