2002-10-01 Christian Stimming <stimming@tuhh.de>

* src/import-export/hbci/gnc-hbci-actions.c: More work and fixes
	for balance/transaction retrieval.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7256 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2002-09-30 23:59:34 +00:00
parent 3809799b0f
commit b671df5bf6
5 changed files with 50 additions and 22 deletions

View File

@ -1,3 +1,8 @@
2002-10-01 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/gnc-hbci-actions.c: More work and fixes
for balance/transaction retrieval.
2002-09-30 Derek Atkins <derek@ihtfp.com>
* get (alpha) qif-io-core to load again and "make check" to
start working (sort-of). Still needs more work.

View File

@ -166,7 +166,13 @@ gnc_hbci_trans (GtkWidget *parent,
/* FIXME: Replace "EUR" by account-dependent string here. */
printf("Got value as %s .\n",
HBCI_Value_toReadableString (HBCI_Transaction_value (trans)));
if (HBCI_Value_getValue (HBCI_Transaction_value (trans)) == 0.0) {
printf("Oops, value is zero. Cancelling HBCI job.\n");
gtk_widget_destroy (GTK_WIDGET (dialog));
HBCI_Transaction_delete (trans);
return NULL;
}
{
/* Create a Do-Transaction (Transfer) job. */
HBCI_OutboxJobTransfer *transfer_job;
@ -185,7 +191,7 @@ gnc_hbci_trans (GtkWidget *parent,
if (interactor)
GNCInteractor_show (interactor);
/*HBCI_Hbci_setDebugLevel(1);*/
HBCI_Hbci_setDebugLevel(1);
err = HBCI_API_executeQueue (api, TRUE);
g_assert (err);
if (!HBCI_Error_isOk(err)) {
@ -199,7 +205,8 @@ gnc_hbci_trans (GtkWidget *parent,
HBCI_Error_delete (err);
gnc_hbci_debug_outboxjob (job);
gtk_widget_destroy (GTK_WIDGET (dialog));
return trans;
HBCI_Transaction_delete (trans);
return NULL;
}
/*HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE);*/
HBCI_Error_delete (err);

View File

@ -103,7 +103,7 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
if (interactor)
GNCInteractor_show (interactor);
HBCI_Hbci_setDebugLevel(0);
HBCI_Hbci_setDebugLevel(1);
err = HBCI_API_executeQueue (api, TRUE);
g_assert (err);
if (!HBCI_Error_isOk(err)) {
@ -130,6 +130,23 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
int choose1;
Timespec ts1, ts2;
/*const HBCI_AccountBalance *accBal =
HBCI_OutboxJobGetBalance_getBalance(balance_job);
const HBCI_Balance *notedBal =
HBCI_AccountBalance_notedBalance(accBal);
const HBCI_Balance *bookedBal =
HBCI_AccountBalance_bookedBalance(accBal);
const HBCI_Value *resultvalue =
HBCI_Balance_value(notedBal);
printf("Noted balance: %s for account no. %s.\n",
HBCI_Value_toReadableString(resultvalue), // this ought to be free'd
HBCI_Account_accountId (h_acc));
resultvalue = HBCI_Balance_value(bookedBal);
printf("Booked balance: %s for account no. %s \n",
HBCI_Value_toReadableString(resultvalue),
HBCI_Account_accountId (h_acc));*/
acc_bal = HBCI_OutboxJobGetBalance_getBalance (balance_job);
bal1 = HBCI_AccountBalance_notedBalance (acc_bal);
bal2 = HBCI_AccountBalance_bookedBalance (acc_bal);
@ -146,7 +163,7 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
val = HBCI_Balance_value (choose1 ? bal1 : bal2);
gnc_verify_dialog(TRUE,
"Result of HBCI job: \nAccount %s balance is %f.",
"Result of HBCI job: \nAccount %s balance is %f\n.",
(choose1 ? "noted" : "booked"),
HBCI_Value_getValue (val));
}
@ -230,7 +247,7 @@ gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc)
if (interactor)
GNCInteractor_show (interactor);
HBCI_Hbci_setDebugLevel(0);
HBCI_Hbci_setDebugLevel(1);
err = HBCI_API_executeQueue (api, TRUE);
g_assert (err);
if (!HBCI_Error_isOk(err)) {
@ -262,7 +279,7 @@ gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc)
}
/* list_HBCI_Transaction_foreach callback */
static void *trans_list_cb (const HBCI_Transaction *trans, void *user_data)
{
time_t current_time;
@ -288,9 +305,9 @@ static void *trans_list_cb (const HBCI_Transaction *trans, void *user_data)
/* Date / Time */
xaccTransSetDateSecs(transaction,
HBCI_Date_to_time_t (HBCI_Transaction_date (trans)));
xaccTransSetDatePostedSecs(transaction,
/*xaccTransSetDatePostedSecs(transaction,
HBCI_Date_to_time_t
(HBCI_Transaction_valutaDate (trans)));
(HBCI_Transaction_valutaDate (trans)));*/
current_time = time(NULL);
xaccTransSetDateEnteredSecs(transaction, mktime(localtime(&current_time)));
@ -306,10 +323,10 @@ static void *trans_list_cb (const HBCI_Transaction *trans, void *user_data)
xaccTransAppendSplit(transaction, split);
xaccAccountInsertSplit(gnc_acc, split);
gnc_amount = double_to_gnc_numeric(HBCI_Value_getValue
(HBCI_Transaction_value (trans)),
xaccAccountGetCommoditySCU(gnc_acc),
GNC_RND_ROUND);
gnc_amount = double_to_gnc_numeric
(HBCI_Value_getValue (HBCI_Transaction_value (trans)),
xaccAccountGetCommoditySCU(gnc_acc),
GNC_RND_ROUND);
xaccSplitSetBaseValue(split, gnc_amount, xaccAccountGetCommodity(gnc_acc));
/* Also put the ofx transaction name in the splits memo field, or
@ -391,9 +408,8 @@ gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc)
amount = double_to_gnc_numeric
(HBCI_Value_getValue (HBCI_Transaction_value (trans)),
100, GNC_RND_ROUND);
/* FIXME: This '100' must go away and instead some function of
* the account's currency has to be used here. */
xaccAccountGetCommoditySCU(gnc_acc),
GNC_RND_ROUND);
description = g_strdup_printf("HBCI to %s",
HBCI_Transaction_otherAccountId (trans));

View File

@ -7,12 +7,12 @@
(define (add-hbci-menu-items)
(gnc:add-extension
(gnc:make-menu (N_ "HBCI") (list gnc:window-name-main (N_ "_Tools") "")))
(gnc:make-menu (N_ "HBCI") (list gnc:window-name-main "_Tools" "")))
(gnc:add-extension
(gnc:make-menu-item (N_ "HBCI Setup")
(N_ "HBCI Setup")
(list gnc:window-name-main (N_ "_Tools") (N_ "HBCI") "")
(list gnc:window-name-main "_Tools" "HBCI" "")
(lambda ()
(gnc:hbci-initial-setup))))

View File

@ -470,8 +470,8 @@ string and 'directories' must be a list of strings."
;; add the menu option to edit style sheets
(gnc:add-extension
(gnc:make-menu-item
(_ "_Style Sheets...")
(_ "Edit report style sheets.")
(N_ "_Style Sheets...")
(N_ "Edit report style sheets.")
(list gnc:window-name-main "Edit" "_Preferences...")
(lambda ()
(gnc:style-sheet-dialog-open))))
@ -479,8 +479,8 @@ string and 'directories' must be a list of strings."
;; the Welcome to GnuCash-1.6 extravaganza
(gnc:add-extension
(gnc:make-menu-item
(_ "Welcome Extravaganza")
(_ "Welcome-to-GnuCash screen")
(N_ "Welcome Extravaganza")
(N_ "Welcome-to-GnuCash screen")
(list gnc:window-name-main gnc:menuname-reports gnc:menuname-utility "")
(lambda ()
(gnc:main-window-open-report (gnc:make-welcome-report) #f))))