Bug 264009 - Loan interest not accounted for in forecast calculations. Causes incorrect forecast for loan accounts.
Summary: Loan interest not accounted for in forecast calculations. Causes incorrect fo...
Status: CONFIRMED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 4.6.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-22 21:15 UTC by Graham Watson
Modified: 2017-10-02 22:08 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshots (27.02 KB, application/x-gzip)
2011-01-22 21:56 UTC, Graham Watson
Details
kmymoney test file (5.27 KB, application/x-kmymoney)
2017-08-13 20:05 UTC, Ralf Habacker
Details
Sequence diagram (59.28 KB, image/jpeg)
2017-10-02 17:01 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Watson 2011-01-22 21:15:46 UTC
Version:           4.5 (using KDE 4.5.5) 
OS:                Linux

The balance forecast reports, and the forecast report on the home page, both incorrectly predict the balance for loans with an interest rate.

This doesn't only happen with 100% interest loans, but that seems to be the most obvious way to demonstrate it.

This is quite a major bug, since it creates a drastically incorrect net worth forecast, rendering using KMM unusable to do predictions or financial planning with.

Reproducible: Always

Steps to Reproduce:
To reproduce, create a loan with an final balloon amount equal to the initial amount. This should mean that the scheduled transaction is split as 100% interest, 0% principal. Now go to the 'All accounts forecast by month' report, or look at the 90-day forecast on the home page to view the forecast.

Actual Results:  
Both reports show the balance as decreasing.

Expected Results:  
Since the interest is equal to the scheduled payment, you would expect the balance to remain the same on a monthly basis.

OS: Linux (x86_64) release 2.6.35-24-generic
Compiler: cc
Running Gnome under Ubuntu 10.10.
Comment 1 Graham Watson 2011-01-22 21:31:08 UTC
Addition - I just realised that the 'All accounts forecast by month' report is a custom one that I have created. You can recreate this report by making a new report as follows:

Columns - Monthly
Rows - Assets & Liabilities
Detail - Top level
Date Range - Next 12 months
Comment 2 Graham Watson 2011-01-22 21:56:18 UTC
Created attachment 56335 [details]
Screenshots

Interestingly, if I go to the 'Loan Information' report, I see these loans report as having 0% interest, which is not true.

I've attached 3 screenshots. One shows the interest rates as set in the account editor, another shows the loan information report, and the other shows the incorrect forecast for the loan balance.

I have edited the images to blank out any private details, but otherwise they are as shown in KMM.
Comment 3 Graham Watson 2011-04-26 00:14:27 UTC
Bump.

Can anyone confirm this, or confirm when a fix is due please?
Comment 4 Alvaro Soliverez 2012-04-28 21:04:51 UTC
This is probably still relevant in 4.6.0
Comment 5 Cristian Oneț 2014-09-24 07:38:01 UTC
If it's still relevant I'm marking it as confirmed.
Comment 6 Ralf Habacker 2017-08-13 20:05:53 UTC
Created attachment 107264 [details]
kmymoney test file
Comment 7 Ralf Habacker 2017-08-16 19:44:51 UTC
Git commit 9ab64ddd0f700699454cc5cfb7b79df8c97304c1 by Ralf Habacker.
Committed on 16/08/2017 at 19:44.
Pushed by habacker into branch '4.8'.

Add qDebug operators for several kmymoney related classes

This makes it easier to find complex bugs by outputting the
internal state instead of inspecting the variables one by
one in the debugger.

To use for example on a transaction it could be called as

qDebug() << transaction;

where transaction is an instance of class MyMoneyTransaction.

M  +12   -0    kmymoney/mymoney/mymoneykeyvaluecontainer.cpp
M  +1    -0    kmymoney/mymoney/mymoneykeyvaluecontainer.h
M  +12   -0    kmymoney/mymoney/mymoneymoney.cpp
M  +5    -0    kmymoney/mymoney/mymoneymoney.h
M  +8    -0    kmymoney/mymoney/mymoneyobject.cpp
M  +1    -0    kmymoney/mymoney/mymoneyobject.h
M  +4    -4    kmymoney/mymoney/mymoneyreport.cpp
M  +28   -0    kmymoney/mymoney/mymoneysplit.cpp
M  +1    -0    kmymoney/mymoney/mymoneysplit.h
M  +24   -0    kmymoney/mymoney/mymoneytransaction.cpp
M  +1    -1    kmymoney/mymoney/mymoneytransaction.h

https://commits.kde.org/kmymoney/9ab64ddd0f700699454cc5cfb7b79df8c97304c1
Comment 8 Ralf Habacker 2017-10-02 16:46:33 UTC
The case corresponds to an interim lending without amortization, which occurs after a time of e.g. 10 years by an approved building loan or similar.

It looks that the recent algorithm does not support this kind of loan calculation.
I see two solutions for this issue: 
1. display a message box that interim lending without amortization not support yet or 
2. extend the algorithm to support interim lending without amortization
Comment 9 Ralf Habacker 2017-10-02 17:01:33 UTC
Created attachment 108131 [details]
Sequence diagram

If someone want to look into the implementation I appended a related sequence diagram. With the current knowledge the issue seems to be located in 16: calculateForecast() or below.
Comment 10 Jack 2017-10-02 20:37:28 UTC
Although this is a rather old bug, and I think your second solution is preferable in the long term, it should wait until after release of 5.0, in which case your first option could be included in 5.0 (and 4.6.2 if it is a simple patch.)
Comment 11 Ralf Habacker 2017-10-02 22:08:30 UTC
Just for the record: With 4.8.1 the error displayed in 'LoanInfoReport' seems to be gone, remaining is the forecast view in the overview tab and the forecast report.