Bug 283842 - If I add today a past operation in a different unit than the principal, the amount calculated uses the present unit value, and not that of the specific date
Summary: If I add today a past operation in a different unit than the principal, the a...
Status: RESOLVED FIXED
Alias: None
Product: skrooge
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Stephane MANKOWSKI
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-12 08:05 UTC by Olivier Kes
Modified: 2011-10-17 07:16 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Kes 2011-10-12 08:05:50 UTC
Version:           unspecified (using Devel) 
OS:                Linux

Example:
* Today, ZARCHF is about 0.12
* 10th of January 2011, it was about 0.14

When I add today an operation for the 10th of January, of -100ZAR, the calculated amount value shows 11.54CHF. This uses the unit value of today,instead of January.

It's problematic when importing operations (as I'm trying to get my simple spreadsheet values of the year into skrooge).

Reproducible: Always

Steps to Reproduce:
- Have a unit with a different value today than in the past
- create an operation in this unit, in the past

Actual Results:  
Value of present is used

Expected Results:  
Value of past should be used
Comment 1 Stephane MANKOWSKI 2011-10-12 08:36:31 UTC
This is the expected result else totals will be wrong.
So, we don't want to change this behavior.

Do you know that you can display operations in the entered unit too. (See contextual menu on the header of the table).
Comment 2 Olivier Kes 2011-10-12 08:42:48 UTC
Thanks for your answer.

What do you mean totals will be wrong?
Is Skrooge always using the last unit value in date? It doesn't make much sense to me.
Comment 3 Stephane MANKOWSKI 2011-10-12 09:12:38 UTC
Just an example:
You have an account with 100 ZARCHF           (current rate 1 ZARCHF = 1 EURO)
You buy something for 10 ZARCHF               (current rate 1 ZARCHF = 2 EURO)

INITIAL TOTAL = 100 ZARCHF = 100 EURO
                -10 ZARCHF = -20 EURO
NEW TOTAL     =  90 ZARCHF = 80 EURO (This value is wrong). 
The result should be 180 EURO. 

So, all amounts must be computed with the same rate.
Comment 4 Olivier Kes 2011-10-12 09:38:21 UTC
In the example you gave, the account is in ZARCHF (by the way, I said ZARCHF because that's the internet code to get the value of ZAR in CHF), and you buy something in ZARCHF. I'm not sure why the conversion to EURO is necessary.
 
In my case, I've got my account in CHF (swiss francs), and by something in ZAR (South African Rands), while being abroad. This is what happens:

Day 0: I've got a Swiss account, with say 1000 CHF.

Day 1: I buy something for 100 ZAR when 1CHF =  5 ZAR
Day 2: I buy something for 100 ZAR when 1CHF = 10 ZAR

What actually happens is:

INITIAL TOTAL = 100 CHF
- Day0          -10 CHF (100ZAR, with 1CHF = 10ZAR) wrong: value of day1 for day0
- Day1          -10 CHF (100ZAR, with 1CHF = 10ZAR)
NEW TOTAL:       80 CHF  ← wrong value

To my mind, what should happen is:

INITIAL TOTAL = 100 CHF
- Day0          -20 CHF (100ZAR, when 1CHF = 5ZAR)
- Day1          -10 CHF (100ZAR, when 1CHF = 10ZAR)
NEW TOTAL:       70 CHF

Am I using Skrooge in a wrong way?
Comment 5 Stephane MANKOWSKI 2011-10-12 09:55:28 UTC
Yes, you are using it in the wrong way ;-)

If your account is in CHF, you have to enter your operations in CHF.
In Skrooge 1.0.0, you should have a warning message if you try to create an operation with an unit not appropriate. The automatic conversion is proposed.

Skrooge authorizes this kind of creation mainly for shares.
Than you can have an EURO account with for example an operation with 10 IBM (where IBM is the unit corresponding to the share of IBM).
Comment 6 Olivier Kes 2011-10-12 10:04:41 UTC
Mystery solved :)

Too bad, I thought it would be convenient, when abroad.
So how do you use when abroad? Use your calculator? Put an aproximative value and check with the bank reports when back?

Skrooge 1.0.0 does give me the warning, but no automatic conversion is proposed.
Comment 7 Stephane MANKOWSKI 2011-10-12 11:02:44 UTC
(In reply to comment #6)
> Mystery solved :)
> 
> Too bad, I thought it would be convenient, when abroad.
> So how do you use when abroad? Use your calculator? Put an approximative value
> and check with the bank reports when back?

I put an approximative value (because I don't know exactly the rate used by the bank), I adjust the value later.

> 
> Skrooge 1.0.0 does give me the warning, but no automatic conversion is
> proposed.

I will do it
Comment 8 Olivier Kes 2011-10-12 11:20:43 UTC
Thanks :)
Comment 9 Stephane MANKOWSKI 2011-10-17 07:16:01 UTC
Git commit 3b62b8da0436654326b9ed6c8ebf2480406b0a40 by Stephane Mankowski.
Committed on 17/10/2011 at 09:15.
Pushed by smankowski into branch 'Feature'.

BUG: 283842: If I add today a past operation in a different unit than the principal, the amount calculated uses the present unit value, and not that of the specific date

M  +1    -0    CHANGELOG

http://commits.kde.org/skrooge/3b62b8da0436654326b9ed6c8ebf2480406b0a40