Skip to content

Instantly share code, notes, and snippets.

@rolfschr
Created December 21, 2015 14:21
Show Gist options
  • Save rolfschr/46ae069d15c062e2d5c0 to your computer and use it in GitHub Desktop.
Save rolfschr/46ae069d15c062e2d5c0 to your computer and use it in GitHub Desktop.
; I live together with a flatmate. He transfers me some $ every month to cover
; for the rent & utilities. I pay the bills for all flatmates. Hence, the total
; amount of money I transfer to say the electricity company is not what I spent
; myself on electricity. The automated transaction below splits up the money I
; receive from my flatmate into the different accounts.
= expr account =~ /Expenses:Utilities:Phone/
; Make it look like paying $15 less when paying for the phone bill.
Expenses:Utilities:Phone $-15
Receivables:Flatmates $15
= expr account =~ /Expenses:Utilities:Electricity/
; Make it look like paying 50% less.
Expenses:Utilities:Electricity -0.5
Receivables:Flatmates 0.5
= expr account =~ /Expenses:Rent/ and payee =~ /Scrooge/
; Only deduct when paying money to that specific landlord.
; Use '$account' as a placeholder to not repeat the account's name.
$account $-150
Receivables:Flatmates $150
; Here come the real transactions ...
2042/01/15 * John Doe
; Here I received the money from my flatmate.
Receivables:Flatmates $-205
Assets:Checking
2042/01/23 * Mr. Scrooge
; Paying the rent to the landlord.
Expenses:Rent $300
Assets:Checking
2042/01/25 * TalkTalkTalk Inc.
; Paying the phone bill.
Expenses:Utilities:Phone $30
Assets:Checking
2042/01/31 * HamsterWheel Ltd.
; Paying for electricity.
Expenses:Utilities:Electricity $80
Assets:Checking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment