mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* src/register/ledger-core/split-register-model.c:
* src/register/ledger-core/split-register-model-save.c: Fix a few rounding errors when computing conversion rates. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7594 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
* src/register/ledger-core/split-register-model-save.c -- fix a bug
|
||||
updating two-split multi-currency transactions from the basic ledger.
|
||||
|
||||
* src/register/ledger-core/split-register-model.c:
|
||||
* src/register/ledger-core/split-register-model-save.c:
|
||||
Fix a few rounding errors when computing conversion rates.
|
||||
|
||||
2002-12-02 Chris Lyttle <chris@wilddev.net>
|
||||
|
||||
* src/doc/Makefile.am: fix for failure when building rpm
|
||||
|
||||
@@ -405,13 +405,21 @@ gnc_split_register_save_debcred_cell (BasicCell * bcell,
|
||||
* 'value' by dividing by the convrate in order to set the value.
|
||||
*/
|
||||
|
||||
convrate = xaccSplitGetAmount (sd->split);
|
||||
value = xaccSplitGetValue (sd->split);
|
||||
if (! gnc_numeric_zero_p (value))
|
||||
oldconvrate = gnc_numeric_div (convrate, value, GNC_DENOM_LCD, GNC_RND_ROUND);
|
||||
else
|
||||
oldconvrate = gnc_numeric_create (100,100);
|
||||
/* First, compute the "old" conversion rate -- use the RATE_CELL if it
|
||||
* exists -- if not, then compute from the old amount/value
|
||||
*/
|
||||
oldconvrate = gnc_split_register_get_rate_cell (reg, RATE_CELL);
|
||||
if (gnc_numeric_zero_p (oldconvrate)) {
|
||||
convrate = xaccSplitGetAmount (sd->split);
|
||||
value = xaccSplitGetValue (sd->split);
|
||||
|
||||
if (! gnc_numeric_zero_p (value))
|
||||
oldconvrate = gnc_numeric_div (convrate, value, GNC_DENOM_AUTO, GNC_DENOM_REDUCE);
|
||||
else
|
||||
oldconvrate = gnc_numeric_create (100,100);
|
||||
}
|
||||
|
||||
/* Now compute/set the split value */
|
||||
acc = gnc_split_register_get_default_account (reg);
|
||||
if (gnc_split_register_needs_conv_rate (sd->trans, acc)) {
|
||||
gnc_commodity *curr;
|
||||
|
||||
@@ -916,7 +916,7 @@ gnc_split_register_get_rate_entry (VirtualLocation virt_loc,
|
||||
if (gnc_numeric_zero_p (value))
|
||||
return "";
|
||||
|
||||
convrate = gnc_numeric_div (amount, value, GNC_DENOM_LCD, GNC_RND_ROUND);
|
||||
convrate = gnc_numeric_div (amount, value, GNC_DENOM_AUTO, GNC_DENOM_REDUCE);
|
||||
|
||||
return xaccPrintAmount (convrate, gnc_split_value_print_info (split, FALSE));
|
||||
}
|
||||
@@ -1328,7 +1328,7 @@ gnc_split_register_get_conv_rate (Transaction *txn, Account *acc)
|
||||
|
||||
amount = xaccSplitGetAmount (s);
|
||||
value = xaccSplitGetValue (s);
|
||||
convrate = gnc_numeric_div (amount, value, GNC_DENOM_AUTO, GNC_DENOM_LCD);
|
||||
convrate = gnc_numeric_div (amount, value, GNC_DENOM_AUTO, GNC_DENOM_REDUCE);
|
||||
return convrate;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user