Bug 499180 - Incorrect output in column "Amount" and "Balance for report "Investment Transactions"
Summary: Incorrect output in column "Amount" and "Balance for report "Investment Trans...
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: reports (other bugs)
Version First Reported In: 5.1.90
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-27 04:18 UTC by Ralf Habacker
Modified: 2025-02-20 17:18 UTC (History)
0 users

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


Attachments
test file (12.20 KB, text/xml)
2025-01-27 04:18 UTC, Ralf Habacker
Details
Screenshot showing the issue (132.22 KB, image/png)
2025-01-27 04:18 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2025-01-27 04:18:19 UTC
Created attachment 177706 [details]
test file

STEPS TO REPRODUCE
1. download kmymoney from https://cdn.kde.org/ci-builds/office/kmymoney/master/
2. start kmymoney 
3. load attached test file
4. Open report "Investment Transactions (Customized)"
4. Inspect report

OBSERVED RESULT
In the lines "... market value" the value is displayed in the column "Balance" 
In the lines "Total... " and "Grand .." the values are displayed in the column "Amount" 

EXPECTED RESULT
In the lines "... market value" the value should be displayed in the column "Amount" as it is not included in the balance calculation
In the lines "Total... " and "Grand .." the values should be displayed in the column "Balance" as they are included in the balance calculation

SOFTWARE/OS VERSIONS
Operating System: openSUSE Leap 15.6
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12
Comment 1 Ralf Habacker 2025-01-27 04:18:39 UTC
Created attachment 177707 [details]
Screenshot showing the issue
Comment 2 Ralf Habacker 2025-01-27 04:59:34 UTC
Comment on attachment 177707 [details]
Screenshot showing the issue

On closer examination of this topic, I wonder whether the market values belong in the transaction report at all? 

In the normal transaction report, the opening and closing balance is shown at this point, which corresponds to the actual balance of the account at that time. However, the market values are not real values in the account.

And the other thing is: Are the totals an “amount” or a “balance”? I would say a balance, so they belong in the balance column
Comment 3 Ralf Habacker 2025-01-27 18:53:16 UTC
(In reply to Ralf Habacker from comment #2)
> Comment on attachment 177707 [details]
> Screenshot showing the issue
> 
When comparing with a report created from a kmymoney binary build of the previous major version https://bugs.kde.org/attachment.cgi?id=177725, it turns out that the confusion in 5.x is caused by the change of sign in the “Balance” column. 

4.8.5
Initial market value              0
Transfer to investment 1000
End market value          1400

This account balance is comprehensible

5.x
Initial market value                 0
Transfer to investment   -1000
End market value              1400

This not
Comment 4 Ralf Habacker 2025-02-20 12:35:38 UTC
Comment on attachment 177707 [details]
Screenshot showing the issue

As it turned out, the content of the balance column is not displayed correctly, which is why this screenshot is inappropriate and has been removed.
Comment 5 Bug Janitor Service 2025-02-20 12:38:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/office/kmymoney/-/merge_requests/261
Comment 6 Ralf Habacker 2025-02-20 17:17:57 UTC
Git commit fdbf8d63f570324a7ec13baa968188eb31e54135 by Ralf Habacker.
Committed on 20/02/2025 at 12:32.
Pushed by habacker into branch 'master'.

In querytable-test write also kmymoney test files

By loading these file into kmymoney a visual inspection
is now also possible.

M  +29   -0    kmymoney/plugins/views/reports/core/tests/querytable-test.cpp

https://invent.kde.org/office/kmymoney/-/commit/fdbf8d63f570324a7ec13baa968188eb31e54135
Comment 7 Ralf Habacker 2025-02-20 17:17:59 UTC
Git commit 0a334f7e2fd41a8f84eee3d17dc8c82770ec23ff by Ralf Habacker.
Committed on 20/02/2025 at 12:32.
Pushed by habacker into branch 'master'.

Adjust expected return values for investment transaction report test case

M  +17   -17   kmymoney/plugins/views/reports/core/tests/data/test-investment-report-querytable-Investment-Transactions-_Customized_.csv

https://invent.kde.org/office/kmymoney/-/commit/0a334f7e2fd41a8f84eee3d17dc8c82770ec23ff
Comment 8 Ralf Habacker 2025-02-20 17:18:05 UTC
Git commit 8a9fe45acdb28d901dc4fa5e6814e6b2b1383d43 by Ralf Habacker.
Committed on 20/02/2025 at 12:32.
Pushed by habacker into branch 'master'.

Revert incorrect handling of investment transactions

The reason 'switch over from stock split to asset split because
amount in stock split doesn't take fees/interests into account' is
incorrect as fees/interest are transfered from the brokerage account
to the assigned fee/interest account and are not visible in the
investment account.
FIXED-IN:5.2

M  +0    -41   kmymoney/plugins/views/reports/core/querytable.cpp

https://invent.kde.org/office/kmymoney/-/commit/8a9fe45acdb28d901dc4fa5e6814e6b2b1383d43
Comment 9 Ralf Habacker 2025-02-20 17:18:08 UTC
Git commit 291dd8594d03e19ad7f5b6bf9b9a42a0b3d94f96 by Ralf Habacker.
Committed on 20/02/2025 at 12:32.
Pushed by habacker into branch 'master'.

Also in querytable-test fix expected values in investment transaction report

M  +28   -33   kmymoney/plugins/views/reports/core/tests/querytable-test.cpp

https://invent.kde.org/office/kmymoney/-/commit/291dd8594d03e19ad7f5b6bf9b9a42a0b3d94f96