If you’ve ever owned a business, you’ve probably got a little experience with accounting. At the bare minimum you’re probably familiar with expenses, and income. As I dive more and more down the rabbit hole of programming, I find I want more and more to maintain data in a text file vs some overly complicated database. I was surprised to recently find an awesome tool for doing just that. Sometimes simple is best, let me explain.

Accounting basics

First I need to explain a bit of the basics. In the accounting world, double entry accounting is pretty much standard practice for business. This includes small business, but most people may not see that “side” of it. Double entry accounting (or book keeping) has been seen in history, dating back to the end of the 13th century, LONG before computers existed. Checkout This Wikipedia article on Double-entry-bookkeeping if your into these sorts of things.

The basic idea is you have two columns. A credit and a debit. Each entry in the journal must balance to zero. So you credit one account, and debit another. It’s far simplier than it sounds. The idea is at the end of your reporting period, be it a month, year or whatever. You can add all the debits and credits and see that your books are indeed balanced.

Take this simple example

Account Credit Debit
Checking $200
Advertising $200

Most people think of an “account” as a bank account, credit card account, or something else. In double entry accounting an account can be those, but more often, it’s simple a place you categorize money to. So you can have an expense account, an income account (or several), etc.

But, this isn’t an accounting lesson. I highly recommend you look up some good accounting principals.

My frustrations with accounting software

My biggest frustration with accounting software, you know the big name players, is their method of taking something so simple and making it so complex. The simple In/Out, Credit/Debit philsophy turns into a black hole of data. Combine that with the price tag that comes with such software and now with subscription models of the software, I was quite annoyed.

So for the last few years, I’ve used Quickbooks as my accounting program. I’ll admit, I didn’t use the invoicing features or anything of that sort, but we maintained our accounts in Quickbooks. The price, kept rising. Finally, as I was wrapping things up towards the end of this year, I had to go through and check a few things that were not entered correctly. I suddenly realized how many steps are involved with some tasks. For instance, I like to go through and make sure I’ve gotten a list of transactions correct from say a merchant account. So I pull a csv from the merchant account and go down the register in Quickbooks, and click, click, click. Usually it’s click the transaction, click the reconcile button to mark it reconciled, save. Now I know this isn’t too painful, but it just seems unnecessary to me, and tedious.

Maybe I’m lazy, maybe I’m missing the point but this really made me feel like this process took longer than it needed to.

I’ll also add that I’ve used GNU Cash, with similar thoughts. It’s quick and easier but still seems like more than a simple accounting program needs to be. Don’t get me wrong though, both have their use cases.

So what is plain text accounting?

Well, quite simply, it’s this

2015/10/12 Gas station
    Expenses:Auto:Gas         $10.00
    Liabilities:MasterCard   $-10.00

This is quite simply 1 transaction. It’s as simple as that. Oh and reconciling, like above, is pretty easy too.

2015/10/12 * Gas station
    Expenses:Auto:Gas         $10.00
    Liabilities:MasterCard   $-10.00

You can also do split transactions fairly easy too, say for instance multiple purchases

2015/10/12 Gas station
    Expenses:Auto:Gas         $10.00
    Expenses:Misc.             $15.00
    Liabilities:MasterCard   $-25.00

And the best part, everything is text. So version control is as easy as git.

Need to see how much you owe on the above account?

ledger -f ledger.dat bal MasterCard

Ledger-Cli

I could go on and on but I think you get the point. I really like this solution. It’s simple, and simple just works. They were doing the very same stuff in the 13th century and now we have the benfit of version control and a magical box (that’s how I’m sure someone from the 13th centure would see a computer) to check it all and do the math for us.

There are a bunch of ports of ledger for various reasons. So far I’ve only found the need to work with just ledger. It’s a powerful cli that includes many capabilities including multiple currencies, commodities, cryto currencies…. Really you could use it to account for straws if you wanted to, it’s currency independent.

Checkout Ledger-Cli

Extensibility Pyledger

I’ll admit I haven’t dove into building reports directly with ledger, but that’s mostly because I found ledger-pyreport to be pretty useful. I’d still like to do some of my own reports, but ledger-pyreport has made it dead simple to make some quick reports on my finances, even my business finances.

Ledger-pyreport is a flask app that can run on anything that’ll run python (Linux, Windows (with some setup), and Mac). It provides a local web app that has a host of report options including a trial balance, balance sheet, income statement, cash flows, and general ledger. You can also compare different periods and set your own dates. It’s a pretty basic interface, but I prefer the kiss method anyway, it keeps things clean, organized and not so bloated. Best of all reports are FAST!

Summary

Overall ledger-cli is useful, pyledger expands on it quite a bit, but isn’t required unless you want nice printable reports. I highly recommend checking out some of the below sites with a wealth of information on plain text accounting in general.

Ledger-Cli

Plain Text Accounting

ledger-pyreport