mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug #529494: Fix wrong fractional precision in register with multi-currency transactions
This patch replaces the function gnc_split_value_print_info, which returns the print info for the currency of the split's transaction, with a new function, gnc_split_register_print_info, which returns the print info for the split register's default account. That way the amounts displayed in the register use the fraction of the register's account, rather than the fraction of the transaction's currency. Patch by Daniel Harding. BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17656 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
60c32fd16b
commit
0c5e9709d9
@ -1161,18 +1161,6 @@ gnc_split_amount_print_info (Split *split, gboolean use_symbol)
|
||||
return gnc_account_print_info (xaccSplitGetAccount (split), use_symbol);
|
||||
}
|
||||
|
||||
GNCPrintAmountInfo
|
||||
gnc_split_value_print_info (Split *split, gboolean use_symbol)
|
||||
{
|
||||
Transaction *trans;
|
||||
|
||||
if (!split) return gnc_default_print_info (use_symbol);
|
||||
|
||||
trans = xaccSplitGetParent (split);
|
||||
|
||||
return gnc_commodity_print_info (xaccTransGetCurrency (trans), use_symbol);
|
||||
}
|
||||
|
||||
static GNCPrintAmountInfo
|
||||
gnc_default_print_info_helper (int decplaces)
|
||||
{
|
||||
|
@ -283,8 +283,6 @@ GNCPrintAmountInfo gnc_account_print_info (const Account *account,
|
||||
|
||||
GNCPrintAmountInfo gnc_split_amount_print_info (Split *split,
|
||||
gboolean use_symbol);
|
||||
GNCPrintAmountInfo gnc_split_value_print_info (Split *split,
|
||||
gboolean use_symbol);
|
||||
|
||||
GNCPrintAmountInfo gnc_share_print_info_places (int decplaces);
|
||||
GNCPrintAmountInfo gnc_default_share_print_info (void);
|
||||
|
@ -1061,6 +1061,12 @@ gnc_split_register_get_memo_help (VirtualLocation virt_loc,
|
||||
return g_strdup (help);
|
||||
}
|
||||
|
||||
static GNCPrintAmountInfo gnc_split_register_print_info (SplitRegister *reg)
|
||||
{
|
||||
return gnc_account_print_info (gnc_split_register_get_default_account (reg),
|
||||
FALSE);
|
||||
}
|
||||
|
||||
static const char *
|
||||
gnc_split_register_get_balance_entry (VirtualLocation virt_loc,
|
||||
gboolean translate,
|
||||
@ -1098,7 +1104,7 @@ gnc_split_register_get_balance_entry (VirtualLocation virt_loc,
|
||||
balance = gnc_numeric_neg (balance);
|
||||
}
|
||||
|
||||
return xaccPrintAmount (balance, gnc_split_value_print_info (split, FALSE));
|
||||
return xaccPrintAmount (balance, gnc_split_register_print_info (reg));
|
||||
}
|
||||
|
||||
static const char *
|
||||
@ -1452,8 +1458,7 @@ gnc_split_register_get_debcred_entry (VirtualLocation virt_loc,
|
||||
GNC_RND_ROUND);
|
||||
}
|
||||
|
||||
return xaccPrintAmount (imbalance,
|
||||
gnc_split_value_print_info (split, FALSE));
|
||||
return xaccPrintAmount (imbalance, gnc_split_register_print_info (reg));
|
||||
}
|
||||
|
||||
{
|
||||
@ -1496,7 +1501,7 @@ gnc_split_register_get_debcred_entry (VirtualLocation virt_loc,
|
||||
|
||||
amount = gnc_numeric_abs (amount);
|
||||
|
||||
return xaccPrintAmount (amount, gnc_split_value_print_info (split, FALSE));
|
||||
return xaccPrintAmount (amount, gnc_split_register_print_info (reg));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1862,8 +1867,7 @@ gnc_template_register_get_debcred_entry (VirtualLocation virt_loc,
|
||||
amount = gnc_numeric_abs (amount);
|
||||
|
||||
/* FIXME: This should be fixed to be correct for the "fake" account. */
|
||||
return xaccPrintAmount( amount,
|
||||
gnc_split_value_print_info( split, FALSE ) );
|
||||
return xaccPrintAmount (amount, gnc_split_register_print_info (reg));
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user