cesar...@gmail.com writes:
> Justin St-Amant <
jstam...@gmail.com> writes:
>
>> Is there a way to refer to the tail-end of the matched account
>> in an automated transaction, using a variable such as
>> '$account_base' or similar? The ledger manual has a section
>> that shows how to refer to the matching posting's account, by
>> using '$account', but that expands to the full account name,
>> rather than just the end.
I read the same article, and this is one reason that I don't use
very fine-grained "envelopes". Instead, I have just three budget
categories: Fixed (stuff I have no choice about whether or how
much to pay, like rent and utilities), Discretionary (stuff I have
choices about, like groceries or restaurants) and Savings. I find
this system more useful for budgeting than putting every
individual kind of expense in its own account/"envelope".
To implement this system, I use a regexp matching specific Expense
accounts to trigger automatic transactions that should go under
Fixed or Savings. Then, every other transaction in Expenses gets
deducted from the Discretionary budget category. My setup looks
like this:
= expr 'account =~
/expenses:(Rent|Utilities|Medical|Phone|Financial||Taxes)/'
; :FIXED: [assets:Budget:Fixed] -1.0
[assets:Checking] 1.0
= expr 'account =~ /expenses/ and not has_tag("FIXED") and not
(account =~ /Reimbursable/)'
; :DISCRETIONARY: [assets:Budget:Discretionary] -1.0
[assets:Checking] 1.0
= expr 'account =~ /assets:(Retirement|Emergency)/ and
has_tag("contribution")'
; :SAVINGS: [assets:Budget:Savings] (cost * -1.0)
[assets:Checking] (cost * 1.0)
I then use the tags in these automated transactions to produce a
custom balance report for my budget:
$ ledger balance budget -e 'next month'
will show how much is remaining in each assets:Budget account for
the month.
Hope that helps!
--
Best,
Richard