|
; Journal syntax compatible with: hledger, ledger |
|
; Examples tested with: hledger 0.23.98 (should be easily adaptable) |
|
|
|
; "Asset subaccounts, balanced virtual transactions" |
|
|
|
; "Envelopes" (funds allocated for a certain purpose) are represented |
|
; by virtual subaccounts under an asset account, eg checking: |
|
|
|
2014/10/01 * opening balances |
|
equity:opening balances |
|
assets:bank:checking $1000 |
|
assets:cash:wallet $100 |
|
|
|
2014/10/01 * save for food this month |
|
[assets:bank:checking] $-100 |
|
[assets:bank:checking:reserve:food] |
|
|
|
; The total balance of checking is still correct, but we can see some of it |
|
; has been allocated: |
|
; $ hledger bal assets |
|
; $1000 assets:bank:checking |
|
; $100 reserve:food |
|
; -------------------- |
|
; $1000 |
|
; $ hledger bal assets --flat |
|
; $900 assets:bank:checking |
|
; $100 assets:bank:checking:reserve:food |
|
; -------------------- |
|
; $1000 |
|
; To hide the envelopes and see only real-world accounts, add -R (or real:1). |
|
; (we could use depth:3, but -R will be more thorough eg in register reports): |
|
; $ hledger bal assets --flat -R |
|
; $1000 assets:bank:checking |
|
; -------------------- |
|
; $1000 |
|
|
|
; Withdrawing from the reserve is done as a distinct step, keeping |
|
; virtual and real transfers separate and balanced so that reports |
|
; remain correct with or without -R. |
|
|
|
2014/10/04 * buy food, using food reserve |
|
; virtual transaction, withdrawing from reserve |
|
[assets:bank:checking:reserve:food] $-50 |
|
[assets:bank:checking] $50 |
|
; real transaction, paying for food |
|
assets:bank:checking $-50 |
|
expenses:food:groceries $50 |
|
|
|
; Envelopes live in a specific asset account, but what if you spend |
|
; from a different asset account ? We make a corresponding withdrawal |
|
; from the envelope to its parent account, just as above. The result |
|
; is some additional unallocated funds in checking. (So, the non-reserve |
|
; checking balance is no longer exactly the total unallocated balance - |
|
; to get that we'd have to consider the cash balance as well). |
|
|
|
2014/10/09 * buy food with cash, and update reserve |
|
expenses:food:groceries $20 |
|
assets:cash:wallet $-20 |
|
; reduce food reserve accordingly |
|
[assets:bank:checking:reserve:food] $-20 |
|
[assets:bank:checking] $20 |
|
|
|
; The status now: |
|
; $ hledger bal assets --flat |
|
; $920 assets:bank:checking |
|
; $30 assets:bank:checking:reserve:food |
|
; $80 assets:cash:wallet |
|
; -------------------- |
|
; $1030 |
|
; Real-world transactions: |
|
; $ hledger reg assets real:1 |
|
; 2014/10/01 opening balances assets:bank:checking $1000 $1000 |
|
; assets:cash:wallet $100 $1100 |
|
; 2014/10/04 buy food, using f.. assets:bank:checking $-50 $1050 |
|
; 2014/10/09 buy food with cas.. assets:cash:wallet $-20 $1030 |
|
; Virtual transactions for budgetting: |
|
; $ hledger reg assets real:0 |
|
; 2014/10/01 save for food thi.. [as:bank:checking] $-100 $-100 |
|
; [as:ba:ch:re:food] $100 0 |
|
; 2014/10/04 buy food, using f.. [as:ba:ch:re:food] $-50 $-50 |
|
; [as:bank:checking] $50 0 |
|
; 2014/10/09 buy food with cas.. [as:ba:ch:re:food] $-20 $-20 |
|
; [as:bank:checking] $20 0 |
This ultisnips snippet reduces the burden of multiple entries for the envelope system
snippet c "Credit Transaction" b
${6:Expenses} $ ${7:0.00}
${9:Liabilities:Visa} $ -$7
${1:
!v strftime("%Y")
}-${2:!v strftime("%m")
}-${3:!v strftime("%d")
} ${4:*} ${5:Payee}[${8:Budget Account}] $-$7
[${10:Budget:Monthly:Visa}] $$7
$0
endsnippet