mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Herbert Thoma's EURO patch.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2254 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -104,7 +104,7 @@ double gnc_convert_to_euro(const char *currency, double value)
|
||||
|
||||
if(result == NULL)
|
||||
{
|
||||
return value;
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -126,7 +126,7 @@ double gnc_convert_from_euro(const char *currency, double value)
|
||||
|
||||
if(result == NULL)
|
||||
{
|
||||
return value;
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -677,7 +677,8 @@ gnc_ui_get_account_field_value_string(Account *account, int field)
|
||||
{
|
||||
double balance = gnc_ui_account_get_balance(account, FALSE);
|
||||
|
||||
return xaccPrintAmount(balance, PRTSYM | PRTSEP, NULL);
|
||||
return xaccPrintAmount(balance, PRTSYM | PRTSEP,
|
||||
xaccAccountGetCurrency(account));
|
||||
}
|
||||
break;
|
||||
case ACCOUNT_BALANCE_EURO :
|
||||
@@ -693,7 +694,8 @@ gnc_ui_get_account_field_value_string(Account *account, int field)
|
||||
{
|
||||
double balance = gnc_ui_account_get_balance(account, TRUE);
|
||||
|
||||
return xaccPrintAmount(balance, PRTSYM | PRTSEP, NULL);
|
||||
return xaccPrintAmount(balance, PRTSYM | PRTSEP,
|
||||
xaccAccountGetCurrency(account));
|
||||
}
|
||||
break;
|
||||
case ACCOUNT_TOTAL_EURO :
|
||||
|
||||
@@ -670,6 +670,7 @@ gnc_euro_change(void *data)
|
||||
{
|
||||
gnc_ui_refresh_statusbar();
|
||||
gnc_configure_account_tree(data);
|
||||
gnc_group_ui_refresh(gncGetCurrentGroup());
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "dialog-find-transactions.h"
|
||||
#include "gnc-dateedit.h"
|
||||
#include "util.h"
|
||||
#include "EuroUtils.h"
|
||||
|
||||
|
||||
typedef struct _RegDateWindow RegDateWindow;
|
||||
@@ -1661,11 +1662,19 @@ regRefresh(xaccLedgerDisplay *ledger)
|
||||
{
|
||||
RegWindow *regData = (RegWindow *) (ledger->gui_hook);
|
||||
int print_flags = PRTSYM | PRTSEP;
|
||||
gboolean euro = gnc_lookup_boolean_option("International",
|
||||
"Enable EURO support",
|
||||
FALSE);
|
||||
char *currency = xaccAccountGetCurrency(ledger->leader);
|
||||
|
||||
/* no EURO converson, if account is already EURO or no EURO currency */
|
||||
euro = euro && strncasecmp("EUR", currency, 3) && gnc_is_euro_currency(currency);
|
||||
|
||||
xaccSRLoadXferCells(ledger->ledger, ledger->leader);
|
||||
|
||||
if (regData->window != NULL)
|
||||
{
|
||||
char string[256];
|
||||
gboolean reverse = gnc_reverse_balance(ledger->leader);
|
||||
double amount;
|
||||
|
||||
@@ -1675,9 +1684,18 @@ regRefresh(xaccLedgerDisplay *ledger)
|
||||
if (reverse)
|
||||
amount = -amount;
|
||||
|
||||
xaccSPrintAmount(string, amount, print_flags, currency);
|
||||
if(euro)
|
||||
{
|
||||
strcat(string, " / ");
|
||||
xaccSPrintAmount(string + strlen(string),
|
||||
gnc_convert_to_euro(currency, amount),
|
||||
print_flags | PRTEUR, NULL);
|
||||
}
|
||||
|
||||
gnc_set_label_color(regData->balance_label, amount);
|
||||
gtk_label_set_text(GTK_LABEL(regData->balance_label),
|
||||
xaccPrintAmount(amount, print_flags, NULL));
|
||||
string);
|
||||
}
|
||||
|
||||
if (regData->cleared_label != NULL)
|
||||
@@ -1686,9 +1704,18 @@ regRefresh(xaccLedgerDisplay *ledger)
|
||||
if (reverse)
|
||||
amount = -amount;
|
||||
|
||||
xaccSPrintAmount(string, amount, print_flags, currency);
|
||||
if(euro)
|
||||
{
|
||||
strcat(string, " / ");
|
||||
xaccSPrintAmount(string + strlen(string),
|
||||
gnc_convert_to_euro(currency, amount),
|
||||
print_flags | PRTEUR, NULL);
|
||||
}
|
||||
|
||||
gnc_set_label_color(regData->cleared_label, amount);
|
||||
gtk_label_set_text(GTK_LABEL(regData->cleared_label),
|
||||
xaccPrintAmount(amount, print_flags, NULL));
|
||||
string);
|
||||
}
|
||||
|
||||
gnc_reg_set_window_name(regData);
|
||||
|
||||
Reference in New Issue
Block a user