I've started using Ledger for my small business accounting, and I'm loving it! I keep track of how each customer was referred to me - yelp, a facebook ad, or whatever. I'd like to be able to generate reports showing the sources of my income. I can see two ways to do it, and I wonder if anyone has thoughts on pros or cons, or has their own way of doing this.
Method #1: Automatic virtual transactions
= expr (payee == 'Alice')
(Income:Source:Yelp) 1.00
= expr (payee == 'Bob')
(Income:Source:Facebook) 1.00
= expr (payee == 'Charlie')
(Income:Source:Facebook) 1.00
I can then report on how much money I've made through various marketing channels by simply running: ledger balance Income:Source
This method feels clunky. It's redundant, verbose, and a little hard to read. But it's pretty easy to copy and paste it, and I only have to do it once per payee.
Method #2: Account directives
account Income:Source:Yelp
payee ^Alice$
account Income:Source:Facebook
payee ^Bob$
payee ^Charlie$
5/15 Alice
Income:Unknown $100.00
Assets:Checking
This method requires me to add ":Unknown" to every transaction, though I could use use an account alias to make this a little cleaner if I want. This approach works when I'm only tracking one piece of information for each payee. If, say, I also wanted to track income by each customer's zip code, I'd have to use the automated transaction approach, which lets me use multiple virtual transactions and even set tags for each matching transaction.
One problem with both of these methods require me to type the payee exactly the same way every time. If I want Ledger to check me, I also have to create a "payee" directive for each customer, adding more redundancy.
payee Alice
= expr (payee == 'Alice')
(Income:Source:Yelp) 1.00
One solution is to create a simple text file with Payee, Source pairs, and write a simple script that automatically generates a ledger file which can be included in my main journal.
How have other people addressed this situation?
- Josh