Bug 295533 - Balance column sums different currencies without converting on reports with unchecked "convert to base currency"
Summary: Balance column sums different currencies without converting on reports with u...
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-08 14:25 UTC by Tristan Grimaux
Modified: 2012-05-06 01:15 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
This patch contains a test case for this problem which can be committed once the bug is fixed (6.70 KB, patch)
2012-03-08 19:32 UTC, Cristian Oneț
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tristan Grimaux 2012-03-08 14:25:24 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2 Iceweasel/10.0.2
Build Identifier: 

When creating a report that should express accounts of different currencies in their original values, transfers between them are messed in the balance column.


Reproducible: Always

Steps to Reproduce:
1. on a new file create 2 accounts with different currencies. I used dolllars and south african dollars
2. on account "local" add 2 expenditures: 1000 yesterday and 2000 today.
3. on account "foreigner" add a deposit of 1000 for today
4. Now a transfer of 1000 from account "foreigner" to local for 1000. It's 132 dollars as of today
5. Now go to Reports and choose Transactions by account
6. Customize reports by unchecking "convert values to base currency"
Actual Results:  
Local
yesterday   Spent                               -1000               -1000
today         Transfer from foreigner    ZAR 999.94     ZAR -0.06
today         Spent                               -20000           -2,000.06
today         Closing Balance                                        -2,867.20

Foreigner
today        Deposit                                 ZAR 994.94    ZAR 994.94
today        Transfer to local                    ZAR -994.94   ZAR 0
today Closing balance                      0


Expected Results:  
Local
yesterday   Spent                               -1000               -1000
today         Transfer from foreigner    ZAR 1000.00     -867.20
today         Spent                               -20000           -2,867.20
today         Closing Balance                                        -2,867.20

Foreigner
today        Deposit                                 ZAR 1000.00    ZAR 1000.00
today        Transfer to local                    ZAR -1000.00   ZAR 0
today Closing balance                      0


On one line of the report balance column is expressed in foreign currency and calculated in dollars. The next line expresses the balance in local currency but i keeps calculating the numbers as if they where plain.
Comment 1 Cristian Oneț 2012-03-08 19:32:06 UTC
Created attachment 69387 [details]
This patch contains a test case for this problem which can be committed once the bug is fixed

I couldn't fix the problem - reports code is too complex for me but I came up with a test case for it to make it easier to develop a fix.
Comment 2 Alvaro Soliverez 2012-04-30 22:38:08 UTC
The problem with both comments above is that the report by account should show all transactions in the currency of that account.
So, transaction in local account will be in local currency, and transactions in foreign account will be in foreign account.
The test is wrong in that regard, too.
I'm working on this. It's not an easy fix though.
Comment 3 Alvaro Soliverez 2012-05-06 01:15:59 UTC
Git commit 9fc583d3db4fe2c16448790d7ee17145fbe8bd2f by Alvaro Soliverez.
Committed on 01/05/2012 at 00:33.
Pushed by asoliverez into branch 'master'.

Multi-currency transaction reports: each individual should be shown in
its own currency, not the one of the main split.
Fixed the display of currency for those cases when the currency is
different from the base currency.
Added test for Transaction by Account report with multiple currencies,
contributed by Cristian Onet.

There might be some more fixing to do, as it's one of the most complex
reports.
Related: bug 297437
REVIEW:104774

M  +18   -10   kmymoney/reports/querytable.cpp
M  +79   -0    kmymoney/reports/querytabletest.cpp
M  +1    -0    kmymoney/reports/querytabletest.h

http://commits.kde.org/kmymoney/9fc583d3db4fe2c16448790d7ee17145fbe8bd2f