The accounting quest: Ledger
Ledger takes an interesting approach to the problem in a couple of ways. One is that it is a purely command-line program; there is no graphical interface of any type. The other is that Ledger does not actually maintain any sort of database of accounting data; instead, it reads that data from a plain-text file that the user manages separately. The result is a system that is quite powerful in some ways while falling short in others.
The file format is relatively simple; entries span multiple lines, with all but the first being indented. An example shipped with the program looks like this:
2004/05/27 Book Store Expenses:Books $20.00 Liabilities:MasterCard
This transaction took place in a book store, where $20 was moved from the Liabilities:MasterCard account to Expenses:Books. The final line lacks a dollar value, so Ledger fills it in to make the transaction balance; more complex split transactions would require explicit values for each account involved. The transaction above has not been reconciled; otherwise there would be an asterisk between the date and the description fields.
Other types of entries are possible. There is a mechanism for adding "period entries," describing transactions that happen at regular intervals. These entries are not really a form of recurring transaction—ledger seems to lack support for those. Instead, period entries are used to describe budgets that can be compared against actual income and expenses. "Automated transactions" are also supported, but those aren't recurring transactions either; they are a mechanism to add splits automatically to other transactions. The syntax for both types is terse and arguably obscure (period entries start with a "~", for example); it can take a little while to understand everything that can appear in the ledger file.
What has been described thus far doesn't involve the Ledger program at
all; this file must be created and maintained via some other mechanism. In
many cases, that mechanism will be a text editor; inevitably, there is an
Emacs mode to make things easier. For those who want a more graphical
experience, Ledger can read (uncompressed) GnuCash files, but there are a
couple of caveats. One is that the Ledger developer (John Wiegley seems to
do almost all the work on Ledger)
is somewhat unenthusiastic about this approach; the manual asks: "why
would anyone use a Gnome-centric, multi-megabyte behemoth to edit their
data, and only a one megabyte binary to query it?
" The other is
that this support appears to be lacking from the in-development 3.0
release. So, while using GnuCash works for now, it's not clear that it
will continue to work in the future.
One could also imagine various automated mechanisms for generating the file from other data sources. Ledger itself never modifies the file; it is simply a consumer of the data contained therein.
As consumers go, it's a powerful one. There is a fairly long list of reports that can be generated. As one might expect, Ledger supports a complex command-line interface that can be used to filter transactions and control the format of the resulting report. The syntax is (once again) terse, but, given time, a suitably motivated user can create almost any sort of text-oriented report one might like. Pie chart aficionados will be disappointed at the outset; there is no graphical output from Ledger. With a bit of work, though, one can get Ledger output into a tool like Gnuplot and produce all kinds of pretty charts.
In summary, Ledger isn't really an accounting system; it's a report-generation utility designed to work with a specific text file format. There are both advantages and disadvantages to its approach. On the up side, Ledger could be an ideal solution for relatively small operations where the people involved are happy to use command-line utilities and do some scripting to make the pieces of a full business hold together. The plain-text ledger file is ideal for anybody wanting to use a tool like Git to track changes over time (or to merge changes done by more than one user). The tool is fast, lightweight, and will never imprison one's accounting data in a black-box binary data file.
On the other hand, it is hard to imagine scaling Ledger even to a business the size of LWN, much less something larger. The tool has clearly been written with speed in mind; it can process a file with many thousands of transactions quickly. But the file itself can only become unwieldy, especially if there are many sources of data feeding into it. Plain-text files lose some of their appeal when they get to be tens or hundreds of thousands of lines in length.
Ledger also lacks features that a typical small-business accounting program would be expected to support. These include:
- Invoicing. One can certainly enter information about an invoice as an
accounts receivable entry, but there is nothing tying it to the actual
invoice sent to a customer. Anybody wanting standard invoice formats,
summaries of outstanding invoices, or per-customer reports will have
to implement them separately.
- Check printing. Yes, it is still necessary to write checks at times.
- Integration with bank accounts. That said, LWN has to do its own
processing of files from banks before feeding the data into QuickBooks
now, so things would not necessarily change a lot in a move to Ledger.
- Recurring transactions. Again, one can certainly script such things,
but it must be done separately.
- Tracking of contractors and creation of tax data (and, in the US, 1099
forms).
- Easy execution of routine tasks like account reconciliation. Ledger can certainly provide a register view showing unreconciled items, but the editing of those items must be done elsewhere (in that big text file).
The other problem with a tool like Ledger is that it can complicate dealings with one's accountant, assuming said accountant is not comfortable with command-line tools. Generating the basic reports that an accountant would want to see will not be that hard. But a good accountant will want to dig through the entries to be sure that everything makes sense and, perhaps, add a journal entry or two to straighten them out. Ledger makes that level of interaction impossible for most accountants, and that will complicate life for many businesses trying to use it.
The bottom line, so to speak, is that Ledger is probably not the solution
to LWN's accounting problems, though it might work quite well for simpler
businesses with fewer customers, transactions, and accounts. For us, there
are too many pieces that would have to be added, some of which would be
less than straightforward. So the quest continues; stay tuned.
Posted Jun 14, 2012 15:48 UTC (Thu)
by joey (guest, #328)
[Link]
Posted Jun 14, 2012 15:51 UTC (Thu)
by bronson (subscriber, #4806)
[Link]
I'd guess the problem is not so much the storage format, but the interface onto it? If someone were to write an accountant-friendly front-end, would that take care of your file format concerns?
(of course this doesn't affect the other missing bits like invoicing, bank accounts, recurring transactions, etc..)
Posted Jun 14, 2012 16:39 UTC (Thu)
by bkuhn (subscriber, #58642)
[Link] (1 responses)
Jon, I've been meaning to get in touch with you about this, but hadn't had a chance. Conservancy is using Ledger for all its accounting and we have some of the same needs that LWN has. Since we're already invested in Ledger, we're going to build up systems with it and around it to do some of things that you need. I know you probably need to pursue a more immediate solution for LWN, but I'd love to be in touch if you're willing to think about Ledger as a solution going forward. Conservancy is committed to finding a way to improve Ledger in the directions you suggest.
Posted Jun 14, 2012 19:27 UTC (Thu)
by tbm (subscriber, #7049)
[Link]
Posted Jun 14, 2012 19:21 UTC (Thu)
by tbm (subscriber, #7049)
[Link] (1 responses)
As a user of ledger, I wanted to add some comments:
Posted Jun 19, 2012 22:39 UTC (Tue)
by eternaleye (guest, #67051)
[Link]
main.dat
main.dat includes global/*.dat, and then by-date/*.dat.
by-date contains 2012/ and 2012.dat (and another such pair for each year, when I've finished entering older years), which includes by-date/2012/*.dat (which are monthly).
accounts.dat is all of the accounts I deal with, and defaults.dat is for stuff like setting the default currency.
That puts a nice limit on the size of each file, and I find it superior to dividing things up based on accounts because that can be icky when entries involve multiple accounts. In order to classify entries, I just use tags. It also makes importing from a monthly CSV even easier, since it can just go in its own file.
Posted Jun 14, 2012 21:59 UTC (Thu)
by bronson (subscriber, #4806)
[Link] (1 responses)
Posted Jun 17, 2012 20:51 UTC (Sun)
by bronson (subscriber, #4806)
[Link]
The accounting quest: Ledger
The accounting quest: Ledger
Jon, we should be in touch about this as Conservancy wants to improve ledger in ways LWN needs.
Those interested should check out Bradley's (bkuhn) recent posting to the ledger mailing list about this.
Conservancy and ledger
The accounting quest: Ledger
The accounting quest: Ledger
global
global/00-defaults.dat
global/01-accounts.dat
by-date
by-date/2012
by-date/2012/2012-01.dat
by-date/2012/2012-02.dat
by-date/2012/2012-03.dat
by-date/2012/2012-04.dat
by-date/2012/2012-05.dat
by-date/2012/2012-06.dat
by-date/2012.dat
The accounting quest: Ledger
The accounting quest: Ledger