Bug 398982 - Opening Balances in forecast are wrong
Summary: Opening Balances in forecast are wrong
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Unclassified
Component: general (show other bugs)
Version: 5.0.1
Platform: Kubuntu Packages Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
: 414075 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-09-23 09:37 UTC by shorty365
Modified: 2019-11-13 15:04 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.0.8


Attachments
Example of wrong opening balances (manipulated because of privacy) (28.64 KB, application/pdf)
2018-10-05 13:58 UTC, shorty365
Details
Report on equity forecast (30.81 KB, image/png)
2019-07-12 07:39 UTC, Stefan Vater
Details
patch for bug (1.23 KB, patch)
2019-10-01 11:16 UTC, Stefan Vater
Details
new patch for bug (2.04 KB, patch)
2019-10-03 05:59 UTC, Stefan Vater
Details
a new version of the patch (1.86 KB, patch)
2019-10-05 13:33 UTC, Stefan Vater
Details

Note You need to log in before you can comment on or make changes to this bug.
Description shorty365 2018-09-23 09:37:47 UTC
SUMMARY
Yesterday I migrated from Kubuntu 16.04 (KMymoney 4.8.2) to Kubuntu 18.04 (Kmymoney 5.0.2?). I used my already filled datebase and at first looks every thing looks OK. However on the forecast screens and reports the Opening Balance is mingled. For the Debts the signs(+ and -) for the amounts got switched. On Liable side amounts for Investment-accounts are wrong. I cannot explain the amounts on the Investment-accounts.

STEPS TO REPRODUCE
1. Migrate with an existing database from Kmymoney 4.8.2 to Kmymoney 5.0.1 in Kubuntu.
2. Open the Reports and select one of the forecast reports.
3. You see the mentioned errors in the column Opening Balances, the errors also show in the nett worth forecast on the startscreen in Kmymoney

EXPECTED RESULT


ACTUAL RESULT


SOFTWARE VERSIONS
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 shorty365 2018-10-05 13:58:23 UTC
Created attachment 115430 [details]
Example of wrong opening balances (manipulated because of privacy)
Comment 2 Stefan Vater 2019-07-12 07:39:40 UTC
Created attachment 121480 [details]
Report on equity forecast

I can still see the wrong forecast behavior in Kmm 5.0.5. It is the same on the Overview page, as well as in the reports. The problem is that in the opening the number of shares is not converted into their value, while it is converted into their value for the forecasted days.
Comment 3 Stefan Vater 2019-10-01 11:16:47 UTC
Created attachment 122961 [details]
patch for bug

Hi,

I looked a bit into the code and came up with the attached patch. It works for me, but I must say that this is my first patch for any kde application, so please don't blame me for not following any guidlines. I hope it helps.
Comment 4 Stefan Vater 2019-10-02 08:32:16 UTC
I found out that there is still a problem with liability accounts which are added with the wrong sign in the opening Balance. Actually, what date should the opening balance hold? Should it be really shown in the forecase?
Comment 5 Stefan Vater 2019-10-03 05:59:18 UTC
Created attachment 122984 [details]
new patch for bug

I further investigated the problem with the wrong sign of the liabilities, and came up with another patch, which fixes also this problem.
Comment 6 Thomas Baumgart 2019-10-03 11:33:33 UTC
Changing the sign breaks a testcase. Did you run 'make test'? BTW, I just verified that the testcase is correct. Running 'make test' produces 'bin/report-03.csv' which shows the data.

The opening balance is constructed by 3 transactions

 - a withdrawal from the checking account at 14.00
 - a withdrawal from the credit card at 88.01
 - a withdrawal from the credit card at 133.22

Remember, that the balance of liabilities is shown with reverse sign in reports.
Comment 7 Stefan Vater 2019-10-05 13:33:08 UTC
Created attachment 123033 [details]
a new version of the patch

No, I did not know about "make test" and how to use it. So now I changed my patch in that it only changes sign of liabilities for the forecast. This does not break the testcase. I have the impression that there is something funny going on with the liabilities in the forecast, but at least my patch seems to work. What do you think?
Comment 8 Thomas Baumgart 2019-10-06 16:55:22 UTC
Git commit 83dd7a0d14b9700ca2632bafb8aba4c522d68685 by Thomas Baumgart.
Committed on 06/10/2019 at 16:52.
Pushed by tbaumgart into branch '5.0'.

Show value of opening balance for investments

The current implementation did only show the number of shares which
needs to be multiplied by the price to gain the value.
FIXED-IN: 5.0.8

M  +5    -0    kmymoney/plugins/views/reports/core/pivottable.cpp

https://commits.kde.org/kmymoney/83dd7a0d14b9700ca2632bafb8aba4c522d68685
Comment 9 Thomas Baumgart 2019-11-13 15:04:59 UTC
*** Bug 414075 has been marked as a duplicate of this bug. ***