Chart of accounts

kljohann edited this page Jun 20, 2012 · 20 revisions

I'm experimenting with something like this personally, it works, but it's an imperfect solution to a poorly-defined problem

Note: A way of pre-declaring accounts has been introduced since this page was written. See New feature: pre-declaring accounts, payees, commodities and tags.

; Chart of Accounts file, to be !included.
; this is intended to represent a full CofA, to populate hledger-web-add drop-downs 
; and tab-completions, and as a sane place for accounts metadata and starting balances.
; It is also hoped that a function will be developed to constrain data entry to these accounts. 
; balances must be non-zero, in order to be seen by hledger-web (and?)
2011/01/01 Chart of Accounts  ; including notes and starting balances
    assets                        1
    assets:cash                   17.00 ; otherwise known as my left-front pocket
    assets:PCF:chequing           28000 ; acct#:23456789
; interest_annual:2% on balances over 3k
    assets:RBC:chequing           1 ; account closed ?
    expenses:insurance:home       100 ;StateFarm
    expenses:telcom:Bell          700 ; acct#:416-123-4567
    expenses:telcom:ISP           1 ; acct#:9876543
    expenses:telcom:djp-wind      1; cel phone service
    expenses:utils:hydro          1
    income:djp:dp_services        -1
    income:leanna:lc_pay            -100
    liabilities:SecureCap         -40000
; name:Secure Capitalist Home Improvement Loan
    liabilities:Mortgage         -160000 ; acct#:1726354
; Imaginary Mortgage Group inc.
; interest_annual:3.75% ; fixed until:2015-04-01
    liabilities:CIBC:DP_line      -12000
    liabilities:CapOne:MC         -100
; interst_annual:7.4%
    liabilities:parking tickets   -320
    liabilities:personal:betty    -1200
    assets:home:resale_value      360000 ; estimate

; this is not a complete CofA, by a long stretch

Currently, I use (something like) this as an !include d file, and I was almost surprised that is (mostly) works as intended. It is imperfect in that it is treated as a regular transaction, and is by definition related to every other transaction, so is seen in most listings, where it ought to be un-seen, most of the time. That it's entries must be non-zero is annoying, and that is is balancing with the equity account probably has implications I only dimly understand, but makes sense for many starting-balances. It looks suspiciously like the budget data files under ~monthly and ~annual, and while I don't currently use those budget functions, it would be interesting to consider fusing the budget amounts and equity transfers in with the Chart of Accounts, in a single file, an almost perfect snapshot of your financial context.

I intend to fully flesh out my version to include all the metada I might ever want about each account, including real-world co-ordinates, like contact information, account details, filesystem uri, associated information files, account threshholds, associated interest-rates.. the works, consolidated in a text-file where I keep my accounting data, how convenient!

Down the road all of this metada may be made available to any other report-types, where more detail about the actual account is wanted.

If this sort of thing were adopted for main-stream use, I could see it being applied to other data.ledger files with an

!accounts ./myCofA.ledger 

(instead of an !include) and/or in-line under a block-designator like


It would be good to be able to attach a CofA.ledger file from the command-line, or set it as an environment-variable.