Bug 441023 - Tax report shows items that are not tax related
Summary: Tax report shows items that are not tax related
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: reports (show other bugs)
Version: 5.1.1
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
: 432733 464905 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-08-15 23:30 UTC by John Zoetebier
Modified: 2023-12-17 17:16 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.2


Attachments
Screenshot report (183.07 KB, image/jpeg)
2021-08-15 23:30 UTC, John Zoetebier
Details
XML data file demonstrating the error of non-tax categories on tax report (23.32 KB, application/xml)
2023-03-02 01:05 UTC, Jack
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Zoetebier 2021-08-15 23:30:40 UTC
Created attachment 140759 [details]
Screenshot report

SUMMARY
The tax report starts with items that are not tax related. This was not an issue in KMyMoney 5.0.5

STEPS TO REPRODUCE
1.Open tax report (title GST Report)
2. 
3. 

OBSERVED RESULT
The report starts with items that are not tax related, for example gifts.
This bug seems to have been introduced after version 5.0.5

EXPECTED RESULT
Tax report should only show tax related items.
For example category gifts has checkbox "Include on Tax Reports" unselected.

SOFTWARE/OS VERSIONS
Windows: 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
This bug was not present till KMyMoney version 5.0.5
Comment 1 Jack 2023-02-28 21:55:11 UTC
*** Bug 464905 has been marked as a duplicate of this bug. ***
Comment 2 Jack 2023-02-28 21:55:29 UTC
*** Bug 432733 has been marked as a duplicate of this bug. ***
Comment 3 Jack 2023-02-28 22:01:20 UTC
Copied from Bug 464905:
I found that all of these transactions are split transactions. All sub splits are categorized and categories are NOT marked "Include on Tax Report" Also reproduced on Linux Mint 21.1 with v 5.1.2.  went back to windows v 4.8.4 and was as expected

Copied from Bug 432733:
Report lists at top totals for split transactions having all split categories as not tax flagged
I have no categories with "Include on tax reports" selected but nevertheless all the default tax reports list some transactions, all of which are split category transactions.

My own observations:
All non-tax items showing up on a tax report by category are in the first two categories shows.  The first is "" (i.e., a missing/blank category).  The second shows up as "*** UNASSIGNED ***".  I do not find that all such transactions shown are split, and while in some cases, a different split is from a tax marked category, most are not.  I'm still working at creating a very small test data file which shows the problem.
Comment 4 Jack 2023-02-28 22:21:03 UTC
removed duplicate as blocker
Comment 5 Jack 2023-03-02 01:05:50 UTC
Created attachment 156904 [details]
XML data file demonstrating the error of non-tax categories on tax report

I'm attaching a relatively small (25K) xml data file which shows the problem.  I have not been able to make one from scratch, so this is a modified reduced version of one I already had.  Both the tax reports by category (this year and last year) show transactions listed without a category.  None of those transactions has any split in the single category (OtherGroups) listed as tax related.
Comment 6 Jack 2023-03-05 19:43:09 UTC
In the attached file, the report Tax Transactions This Year includes two transaction.  The one on 1/4/23 T000000000000000016 has three splits: one for the Checking Account A000001, and two for Categories: Memberships (A000015) and Donations (A000033) none of which are marked for including in Tax Reports.  The other transaction T000000000000000017 belongs, as one split is for Category A000016 OtherGroups, which IS marked as for Tax Reports.
As far as I can tell, the problem is that MyMoneyTransactionFilter::matchingSplits (in myoneytransactionfilter.cpp) is returning 1 for T000000000000000016 where I think it should return 0.  I don't yet understand the code well enough to be sure, but I think the problem is somewhere towards the end of that function, where it seems to think it needs to return at least one split.  I also haven't figured out where in that function it deals with the "tax categories only" setting in the filter.
Comment 7 Thomas Baumgart 2023-12-17 17:16:07 UTC
Git commit 58c91c26add5c0761fa04c6066c333c5dec70cab by Thomas Baumgart.
Committed on 17/12/2023 at 18:15.
Pushed by tbaumgart into branch 'master'.

Don't include non-tax related transactions in tax report
FIXED-IN: 5.2

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

https://invent.kde.org/office/kmymoney/-/commit/58c91c26add5c0761fa04c6066c333c5dec70cab