Tutorial: Accounting basics and further study
Here we'll give a quick hledger-oriented intro to some useful accounting concepts, using the journal file created in Tutorial: hledger add. Also we'll discuss account hierarchy in hledger. At the end, there's a collection of useful links to learn more.
Debits and Credits
Double-entry bookkeeping traditionally names movements of money as "debits" or "credits". As an error-checking mechanism, the debits must exactly balance the credits, both within each individual transaction and over all transactions.
Signed numbers
hledger and most other plain text accounting tools use positive and negative sign instead of the debit and credit labels. This is essentially the same system, but most people find it easier to learn than the debit/credit terminology. Positive numbers are debits, negative numbers are credits, and within each transaction (and over all transactions) the sum of amounts must be zero.
As a consequence in hledger and similar PTA tools, it's common for reports to show equity, liability, and revenue (income) balances as negative numbers. (Some hledger reports/options can show them as positive for readability.)
Here is Ledger's discussion of this.
Assets, Liabilities and Equity
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.
Revenue and Expenses
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).
Chart of Accounts
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
where assets
, revenue
and 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
A digression: subaccounts in hledger
With hledger, tree structure is implied by writing account names like ACCOUNT:SUBACCOUNT
.
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.
The accounts
command will list all accounts posted to:
$ hledger accounts
assets:cash
assets:checking
expenses:food
expenses:supplies
and 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
Conversely, the 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 --flat
:
$ 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
Accounting links
General
- 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
- principlesofaccounting.com
- 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
- Finances 2: Guide nice PTA-applicable intro from this mac/iphone app. Recommended.
- Solarpunk
Video
- Accounting course by Prof. Krug 2011
- Khan Academy: Accounting and financial statements
- Tea Leaves' Double-Entry Bookkeeping and Counting Like It's 1479 playlists. Warning, these are not in good didactic order, so pick and choose. Eg :
Theory
- 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
- Momentum accounting and triple-entry bookkeeping
- Essence of Accounting "A logical description of the record to report process: accounting, reporting, auditing, analysis", Charles Hoffman 2020
History
- 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
- Etymological observations on some accounting terms