mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add detection of account type to handle balance sign
This commit is contained in:
parent
9bc722f601
commit
07cbd936c6
@ -1131,14 +1131,27 @@ void gnc_file_ofx_import (GtkWindow *parent)
|
|||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
if (account)
|
if (account)
|
||||||
{
|
{
|
||||||
// Grab the balance value and date from the statement and open a reconcile window for this account.
|
if (statement->ledger_balance_valid)
|
||||||
gnc_numeric value = double_to_gnc_numeric (-statement->ledger_balance, xaccAccountGetCommoditySCU (account), GNC_HOW_RND_ROUND_HALF_UP);
|
{
|
||||||
recnWindowWithBalance (GTK_WIDGET (parent),
|
// The balance needs to be corrected for credit-card and loan accounts.
|
||||||
account,
|
float sign = 1;
|
||||||
value,
|
switch(xaccAccountGetType (account))
|
||||||
statement->ledger_balance_date);
|
{
|
||||||
|
case ACCT_TYPE_CREDIT:
|
||||||
|
case ACCT_TYPE_LIABILITY:
|
||||||
|
sign = -1;
|
||||||
|
default:
|
||||||
|
sign = 1;
|
||||||
|
}
|
||||||
|
// Grab the balance value and date from the statement and open a reconcile window for this account.
|
||||||
|
gnc_numeric value = double_to_gnc_numeric (sign*statement->ledger_balance, xaccAccountGetCommoditySCU (account), GNC_HOW_RND_ROUND_HALF_UP);
|
||||||
|
recnWindowWithBalance (GTK_WIDGET (parent),
|
||||||
|
account,
|
||||||
|
value,
|
||||||
|
statement->ledger_balance_date);
|
||||||
|
}
|
||||||
|
g_free (statement);
|
||||||
}
|
}
|
||||||
g_free (statement);
|
|
||||||
}
|
}
|
||||||
g_free (selected_filename);
|
g_free (selected_filename);
|
||||||
g_slist_free (info.statement);
|
g_slist_free (info.statement);
|
||||||
|
Loading…
Reference in New Issue
Block a user