2003-01-25 Christian Stimming <stimming@tuhh.de>

* src/import-export/hbci/gnc-hbci-getbalance.c: Fix HBCI problem
	with negative account balances.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7883 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2003-01-25 11:52:25 +00:00
parent 1a5c80e4ed
commit c25ecebe8b
2 changed files with 25 additions and 11 deletions

View File

@ -1,5 +1,8 @@
2003-01-25 Christian Stimming <stimming@tuhh.de> 2003-01-25 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/gnc-hbci-getbalance.c: Fix HBCI problem
with negative account balances.
* src/engine/Scrub.c (xaccTransScrubImbalance): Fix rounding of * src/engine/Scrub.c (xaccTransScrubImbalance): Fix rounding of
the imbalance amount, #104343. the imbalance amount, #104343.

View File

@ -112,6 +112,7 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
const HBCI_Value *noted_val, *booked_val; const HBCI_Value *noted_val, *booked_val;
time_t noted_tt, booked_tt; time_t noted_tt, booked_tt;
char *noted_str, *booked_str; char *noted_str, *booked_str;
gboolean noted_debit, booked_debit;
gboolean dialogres; gboolean dialogres;
acc_bal = HBCI_OutboxJobGetBalance_getBalance (balance_job); acc_bal = HBCI_OutboxJobGetBalance_getBalance (balance_job);
@ -120,19 +121,23 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
noted_tt = HBCI_DateTime_to_time_t (HBCI_Balance_date (noted_bal), noted_tt = HBCI_DateTime_to_time_t (HBCI_Balance_date (noted_bal),
HBCI_Balance_time (noted_bal)); HBCI_Balance_time (noted_bal));
noted_val = HBCI_Balance_value (noted_bal); noted_val = HBCI_Balance_value (noted_bal);
noted_debit = HBCI_Balance_isDebit (noted_bal);
noted_str = HBCI_Value_toReadableString (noted_val); noted_str = HBCI_Value_toReadableString (noted_val);
booked_bal = HBCI_AccountBalance_bookedBalance (acc_bal); booked_bal = HBCI_AccountBalance_bookedBalance (acc_bal);
booked_tt = HBCI_DateTime_to_time_t (HBCI_Balance_date (booked_bal), booked_tt = HBCI_DateTime_to_time_t (HBCI_Balance_date (booked_bal),
HBCI_Balance_time (booked_bal)); HBCI_Balance_time (booked_bal));
booked_val = HBCI_Balance_value (booked_bal); booked_val = HBCI_Balance_value (booked_bal);
booked_debit = HBCI_Balance_isDebit (booked_bal);
booked_str = HBCI_Value_toReadableString (booked_val); booked_str = HBCI_Value_toReadableString (booked_val);
printf("Noted balance: %s for account no. %s at date %s", printf("Noted balance: %s%s for account no. %s at date %s",
(noted_debit ? "-" : ""),
noted_str, noted_str,
HBCI_Account_accountId (h_acc), HBCI_Account_accountId (h_acc),
ctime(&noted_tt)); ctime(&noted_tt));
printf("Booked balance: %s for account no. %s at date %s", printf("Booked balance: %s%s for account no. %s at date %s",
(booked_debit ? "-" : ""),
booked_str, booked_str,
HBCI_Account_accountId (h_acc), HBCI_Account_accountId (h_acc),
ctime(&booked_tt)); ctime(&booked_tt));
@ -161,8 +166,9 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
TRUE, TRUE,
/* Translators: %s is the amount. */ /* Translators: %s is the amount. */
_("Result of HBCI job: \n" _("Result of HBCI job: \n"
"Account booked balance is %s\n" "Account booked balance is %s%s\n"
"Reconcile account now?"), "Reconcile account now?"),
(booked_debit ? "-" : ""),
booked_str); booked_str);
} }
@ -171,15 +177,20 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
GNCInteractor_hide (interactor); GNCInteractor_hide (interactor);
if (dialogres) if (dialogres)
recnWindowWithBalance (parent, {
gnc_acc, gnc_numeric abs_value =
double_to_gnc_numeric double_to_gnc_numeric (HBCI_Value_getValue (booked_val),
(HBCI_Value_getValue (booked_val), xaccAccountGetCommoditySCU(gnc_acc),
xaccAccountGetCommoditySCU(gnc_acc), GNC_RND_ROUND);
GNC_RND_ROUND), recnWindowWithBalance (parent,
booked_tt); gnc_acc,
HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE); (booked_debit
? gnc_numeric_neg (abs_value)
: abs_value),
booked_tt);
}
HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE);
} }
} }
} }