Thanks Peter and John.
This one will work for countries where the tax year == the calendar year,
regardless of the year:
= /^Expenses:Tax/ and not %Tax-Year and expr commodity == 'EUR' or commodity == 'USD'
; Tax-Year:: (format_date(effective_date or date, "%Y"))
Unfortunately, despite John's help on IRC, I couldn't figure out how to do
this for countries where the tax year differes. So I'll go with Peter's
solution:
= /^Expenses:Tax/ and not %Tax-Year and expr commodity == 'GBP' and date >= [2014-04-06] && date < [2015-04-06]
; Tax-Year: 2014-15
= /^Expenses:Tax/ and not %Tax-Year and expr commodity == 'GBP' and date >= [2015-04-06] && date < [2016-04-06]
; Tax-Year: 2015-16
(Note that this doesn't work if there's an effective_date that is in a
different tax year as date; I tried to use:
(effective_date or date) >= [2013-04-06]
but that gives an error.)
With John's help, I came up with the following:
= /^Expenses:Tax/ and not %Tax-Year and expr commodity == 'GBP' and effective_date or date < [April 6]
; Tax-Year:: str(int(format_date(effective_date or date, "%Y")) - 1) + "-" + (format_date(effective_date or date, "%g")))
= /^Expenses:Tax/ and not %Tax-Year and expr commodity == 'GBP' and effective_date or date >= [April 6]
; Tax-Year:: (format_date(effective_date or date, "%Y")) + "-" + str(int(format_date(effective_date or date, "%g")) + 1))
but the problem is that [April 6] uses the current year and not the year of
the transaction.
* Peter Keen <
peter...@bugsplat.info> [2015-08-04 16:27]: