# Plaintext accounting :hledger: is cool Accounting is ancient as hell. Even the cavemen knew how to keep their books. Do you tho? ## Keep it simple [Plaintext accounting](https://plaintextaccounting.org/) is literally what it sounds like - a method to keep your records in the simplest and cleanest text form possible. I've been using plaintext accounting for more than half a year already and it's been an incredible quality of life improvement. ## Software The go-to solution in the plaintext accounting world is [Ledger](https://www.ledger-cli.org/). There's also his Haskell brother - [Hledger](https://hledger.org), which actually I am using. Hledger uses so-called double-entry accounting system. Your plaintext journal file contains records in the form of transactions. A transaction is simply a transfer from one account to another. Here's what example transaction looks like: ```bash 2022-09-28 Pizza expenses:food:delivery 22.90 B assets:bank:bgpb ``` Basically this means: "**22.90 BYN** went from my bank account to the account of my expenses" Simple, isn't it? I'm not gonna dive deep into details - there's an *amazing* [documentation](https://hledger.org), guides, recipes and tons of other stuff on using Hledger. ## My few tricks using Hledger Instead, here I'm gonna show you how Hledger can actually improve your life (besides countless amounts of reports of all sorts that help you analyze your expenses and adapt accordingly). ### Tracking expenses from the phone Since the journal is a plaintext file - it's never been easier. Just use [Syncthing](https://syncthing.net)! When it comes to conveniently editing the file, I personally use [cone](https://play.google.com/store/apps/details?id=info.tangential.cone). It doesn't allow you to view reports and other fancy stuff, because it doesn't need to. It's just a tool for you to enter the transactions that happened during the day, so that you can analyze them later. ### Tracking debts with friends If you hang out with your friends often, you know that tracking debts is a pretty nasty thing: > I paid for pizza, you brought some beer, that guy already owes me $20, I owe another guy etc... This can get really messy real quick. On top of that, usually you pay about equal amounts of money each time, e.g: >You bought the beer last time, now it's my turn. This keeps the actual debt between you close to zero, without needing to physically transfer any money. And in case it exceeds some amount (say 10 bucks), you actually do the transfer. But how can you be sure it's close to 0? You'd have to remember every payment happened before, which is incredibly dumb. Just offload this task to Hledger! Imagine this situation: We've been on a party with Bob and Alice, and I paid for food and drinks **81 BYN** from my bank account (it's always simpler to pay with one check and than sort out the story later). I know that my part here was around **30 BYN**. After the party Alice pays me her part - **40 BYN** in cash. But the other guy - Bob - does not! He has no money today, so we'll just remember that now he owes me his part. Here's how this transaction would look in Hledger. ```bash 2022-09-25 Party assets:bank:bgpb -81.00 B expenses:parties 30.00 B assets:cash 40.00 B assets:receivable:bob ``` Notice that in this transaction I don't even need to calculate Bob's expenses. Since the transaction has 0 sum, we can deduct his part: `-81 + 30 + 40 + x = 0`, therefore `x = 11`. Let's now verify that, running `hledger balance bob`: ```bash 11.00 B assets:receivable:bob -5.00 B liabilities:debt:bob -------------------- 6.00 B ``` Hmm, what a surprise! Turns out, I already owe him **5 BYN** for the burger yesterday. Without Hledger I could easily forget about it. Now I know that he owes me **6 BYN**. And he doesn't even need to transfer it, he'll just pay next time, and I'll be the one who owes. ### It's OK to skip sometimes In the August I completely ditched my accounting (for no actual reason other than my laziness). Is it the end of the world? No. Let's see how hard it is to comeback. ```bash 2022-09-01 Epic come back! assets:bank:bgpb = 100 B expenses ``` Yes! As easy as that. I just take the current balance on my account (say **100 BYN**), and whatever is the difference between this number and my balance at the end of July - goes into the expenses. That's it. The only thing I lose by not tracking the entire month is *granularity* - I don't know what types of expenses were there anymore, and can't analyze them in-depth. But at least I know my total expenses for the August, which is often what actually matters.