ledger.org 8.7 KB

Accounting Concepts

Double Entry Accounting

Ledger is a double entry accounting system. This means ledger is like the law of thermodymnics. No energy is ever lost or destroyed. In the same way no money is ever lost or destroyed. So in ledger to say that you made $500 from your paycheck, your boss gave you $-500 dollars.

The ultimate aim of ledger

#+BEGIN_SRC ledger 2015/11/25 Paycheck Assets:Checking $25.00 Income:Salary $-25.00 #+END_SRC

The ultimate goal is ledger is to show you how much money you can spend.

Most older folks you a checkbook journal to record their withdraws from their checking account. Ledger is a general journal. It records additions and subtractions (credits and debits).

Making Transactions

Transactions happens when you money either leaves your bank account or enters your bank account. There are several possible initials characters that Ledger must see when reading a transaction.

  • Date
  • DATE[=EDATE] [*|!] [] DESC

If * follows the date, then it means that the trasaction has cleared. If ! follows the date, it means that the transaction is pending.

The next line that follows must be ACCOUNT AMOUNT [; NOTE]

  • =
  • An automated transaction
  • ~
  • A periodic transaction.
  • ; # % | * are all comments
  • 'indented ;'
  • If a comment is indented inside a transaction, it is parsed as persistent. This lets you tag certain types of transactions.

Some examples


2017/05/10 ! bought groceries
    Expenses:Groceries   $35
    Assets:Bank account

Notice that the date is formatted as YEAR/MM/DD.

This is a pending transaction. You swiped your card, but your bank has not released the funds yet.


2017/05/10 * bought DVD
    Expenses:Entertainment  $5
    Assets:Bank account

Commands

This is a complete transaction. I swiped my card, and the bank has let go of my funds. You can get an overview of your transactions via this ledger command:

It primarily shows you your transactions.


ledger -f <ledger file> balance

It's also probably a good idea to set up some default ledger accounts. This way, ledger will warn you if one of your transactions contain a misspelling. Perhaps you could have some accounts like so:


account Expenses:Cash
    alias envelopes

account Expenses:Insurance
    alias insurance

account Expenses:Tithe

account Expenses:Groceries
    alias groceries

account Expenses:Auto:Gas
    alias gas

account Expenses:Date
    alias date

account Expenses:Tithe
    alias tithe

account Expenses:Rent
    alias rent

account Expenses:Electric
    alias electric

bucket Assets:Bank Account

If you also use the "--strict option" and you accidentally spell "Expenses:bank accout", Ledger will warn you that you've made a mistake.


ledger balance -f budget.ledger

You can also get a detailed report of your monthly expenses:


ledger -M register -f budget.ledger

This output can look a bit too much. What if you only want to see what you spent on Rent last month? You could do this:


ledger --strict -f budget.ledger Expenses:Rent

You can also limit transactions to after a begin date


ledger --strict -f budget.ledger -b '2018/06/01'

I can have ledger schedule transactions like my paycheck

info:ledger-mode#Transactions that occur on specific dates

vocab

  • journals
  • This is a record of all money transactions. This essentially is what ledger tries to provide.
  • credits
  • Credits are deposits or additions. This is money going to an account.
  • debit
  • Debits are subtractions or withdraws from accounts.
  • payee
  • This is the person or company that money goes to. If you have a withdraw (subtraction) from your bank account, you usually put that money somewhere or to someone. That somewhere (or someone) is the payee.
  • checkbook journal
  • This is a journal describing all of the withdrawls from your checking account.
  • accounts
  • Generally, people think of accounts as bank accounts. Or places that one can store money. Ledger defines accounts as any place that money can go to. So, your electric bill is considered an account, because your money goes to pay your electric bill.

Stuff Ledger Can Do

If I make a mistake and I need to add a dummy transaction: 5.10.3

5.22 automatic transactions

5.22.7 tithing

7.2.4 combine ledger with emacs org-mode

Archive old Records

Transactions can have tags.

I can use no-web or tangle


2018/07/05 * Dinner and a movie
      Expenses:Entertainment   $30
      Assets:Bank Account
      ; :SILLYTAG:

Tags can also have values


2018/03/01 * lost bet on the baseball game
    Expenses:Gambling     $20
    Assets:Bank Account   $20
    ; Jeff is smarter than me.  He bet $0.
    ; JEFF:0

journaling

  • alias
  • alias Dining=Expenses:Entertainment:Dining alias BMovie=Expenses:Entertainment:Bought Movie
  • assert
  • throw an error if something is not met while Ledger runs through this file assert
  • bucket
  • Make one account the default account to balence my checkbook with. IE, everytime that I make a transaction, I have to have 2 transactions. So when I buy a movie, the first transaction is a debit on my bank. The second transaction gives the same amount of money to walmart. Instead of writing

2011/01/27 Book Store Expenses:Books $20.00 Assets:Checking $-20.00

2011/12/01 Sale Expenses:Entertainment:Date $ 30.00 Assets:Checking $-30.00

I write

2011/01/27 Book Store Expenses:Books $20.00

2011/12/01 Sale Expenses:Entertainment:Date $ 30.00

And ledger is smart enough to know what I mean.

  • capture

Capture is amazing. It lets you replace any regexp with an account name. It's like alias on steroids

capture Expenses:Debt:"College Loan" Debt

Now any time I write Debt as an occount, ledger know I'm referring to Expenses:Debt:"College Loan"

  • define

Let's me define expressions for future use.

For example, let's say that my rent is currently $500 a month.

define rent=$500

2015/05/01 Rent Expenses:Rent rent

If sometime later rent changes I can just update the cost of rent

define rent=$600

You can also use define variables like

(rent*2)

  • include
  • Include a stated file as if it were part of the current file. This lets you break up your ledger files into multiple files. You can break them up by month for example
  • apply tag
  • Let's you apply a certain type of tag for all of the following transactions until and =end apply tag= is found.

apply tag hastag apply tag nestedtag: true

2011/01/25 Tom's Used Cars Expenses:Auto $ 5,500.00 ; :nobudget: Assets:Checking

2011/01/27 Book Store Expenses:Books $20.00 Liabilities:MasterCard

end apply tag

2011/12/01 Sale Assets:Checking:Business $ 30.00 Income:Sales

end apply tag

is the equivalent of:

2011/01/25 Tom's Used Cars ; :hastag: ; nestedtag: true Expenses:Auto $ 5,500.00 ; :nobudget: Assets:Checking

2011/01/27 Book Store ; :hastag: ; nestedtag: true Expenses:Books $20.00 Liabilities:MasterCard

2011/12/01 Sale ; :hastag: Assets:Checking:Business $ 30.00 Income:Sales

How to make a monthly/yearly budget 9.1

  • year
  • This lets you specify a year for all the following transactions that don't specify one

I just need to set a periodic transaction at the top of my ledger file.


; there are my monthly expenses
~ Monthly
    rent                        $1000
    Expenses:Auto:Gas           $80
    Expenses:Groceries          $500
    Expenses:Tithe              $100
    Expenses:Debt               $200
    Expenses:Electric           $100
    Assets