Hi
I am trying to setup an automated transaction that will allow me to
manually add a simple transaction for a mortgage payment and the automated
transaction will split it out to add an expense for the interest and reduce
the liability with the remainder. Everything works for the first month, but
after than, accessing account("Liabilities:Home Mortgage").total in the
automated transaction seems to be giving an incorrect value.
Here is a demo file:
define mortgage_interest_rate = 4.0 / 100 / 12
define mortgage_interest() = (-account("Liabilities:Home
Mortgage").total)*mortgage_interest_rate)
define mortgage_principal_addition(payment_amount) = payment_amount -
mortgage_interest()
= Expenses:Mortgage
Expenses:Interest:Mortgage Interest (mortgage_interest())
Liabilities:Home Mortgage
(mortgage_principal_addition(amount))
Expenses:Mortgage (-amount)
# Opening balances
2012/08/01 Initial mortgage liability
Equity:Opening Balances £100000.00
Liabilities:Home Mortgage
# Mortgage payments
2012/09/01 Mortgage payment
Expenses:Mortgage £1000
Assets:Checking
2012/10/01 mortgage payment
Expenses:mortgage £1000
Assets:checking
2012/11/01 mortgage payment
Expenses:mortgage £1000
Assets:checking
2012/12/01 mortgage payment
Expenses:mortgage £1000
Assets:checking
2013/01/01 mortgage payment
Expenses:mortgage £1000
Assets:checking
Then running the command 'ledger reg interest' gives the output:
12-Sep-01 Mortgage payment ..In:Mortgage Interest £333.33
£333.33
12-Oct-01 mortgage payment ..In:Mortgage Interest £666.67
£1000.00
12-Nov-01 mortgage payment ..In:Mortgage Interest £1000.00
£2000.00
12-Dec-01 mortgage payment ..In:Mortgage Interest £1333.33
£3333.33
13-Jan-01 mortgage payment ..In:Mortgage Interest £1666.67
£5000.00
As you can see, the first month appears correct but the values should go
down slowly over time because the liability is going down. Calling
'account("Liabilities:Home Mortgage").total' in the automated transaction
seems to be returning £100000 in the first transaction (correctly) but in
the second and third transactions returns £200000 then £300000 etc.
Is what I am trying to do possible?
Thanks in advance.
MF