mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
David Hampton's QIF import patch.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6534 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
307f25954c
commit
94bc37e4e7
@ -1271,6 +1271,22 @@ children to this account.")
|
||||
'((<gnc:Book*> book))
|
||||
"Create a new account group.")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:account-group-begin-edit
|
||||
'<gw:void>
|
||||
"xaccAccountGroupBeginEdit"
|
||||
'((<gnc:AccountGroup*> g))
|
||||
"Open an account group for editing.")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:account-group-commit-edit
|
||||
'<gw:void>
|
||||
"xaccAccountGroupCommitEdit"
|
||||
'((<gnc:AccountGroup*> g))
|
||||
"Commit all changes to an account group.")
|
||||
|
||||
(gw:wrap-function
|
||||
mod
|
||||
'gnc:account-group-destroy
|
||||
|
@ -995,7 +995,9 @@ gnc_ui_qif_import_accounts_prepare_cb(GnomeDruidPage * page,
|
||||
gpointer user_data) {
|
||||
QIFImportWindow * wind = user_data;
|
||||
|
||||
gnc_set_busy_cursor(NULL, TRUE);
|
||||
update_accounts_page(wind);
|
||||
gnc_unset_busy_cursor(NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -1009,7 +1011,9 @@ gnc_ui_qif_import_categories_prepare_cb(GnomeDruidPage * page,
|
||||
gpointer user_data) {
|
||||
QIFImportWindow * wind = user_data;
|
||||
|
||||
gnc_set_busy_cursor(NULL, TRUE);
|
||||
update_categories_page(wind);
|
||||
gnc_unset_busy_cursor(NULL);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
@ -1022,7 +1026,9 @@ gnc_ui_qif_import_memo_prepare_cb(GnomeDruidPage * page,
|
||||
gpointer user_data) {
|
||||
QIFImportWindow * wind = user_data;
|
||||
|
||||
gnc_set_busy_cursor(NULL, TRUE);
|
||||
update_memo_page(wind);
|
||||
gnc_unset_busy_cursor(NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -1045,6 +1051,7 @@ gnc_ui_qif_import_convert(QIFImportWindow * wind) {
|
||||
GList * pageptr;
|
||||
Transaction * gnc_xtn;
|
||||
Split * gnc_split;
|
||||
gnc_commodity * old_commodity;
|
||||
|
||||
char * mnemonic = NULL;
|
||||
const char * namespace = NULL;
|
||||
@ -1072,8 +1079,12 @@ gnc_ui_qif_import_convert(QIFImportWindow * wind) {
|
||||
gnc_commodity_set_fullname(page->commodity, fullname);
|
||||
gnc_commodity_set_mnemonic(page->commodity, mnemonic);
|
||||
|
||||
old_commodity = page->commodity;
|
||||
page->commodity = gnc_commodity_table_insert(gnc_get_current_commodities(),
|
||||
page->commodity);
|
||||
if (old_commodity != page->commodity) {
|
||||
scm_hash_remove_x(wind->stock_hash, gh_str02scm(fullname));
|
||||
}
|
||||
}
|
||||
|
||||
/* call a scheme function to do the work. The return value is an
|
||||
@ -1241,6 +1252,7 @@ gnc_ui_qif_import_currency_next_cb(GnomeDruidPage * page,
|
||||
SCM update_stock = gh_eval_str("qif-import:update-stock-hash");
|
||||
int show_matches;
|
||||
|
||||
gnc_set_busy_cursor(NULL, TRUE);
|
||||
scm_unprotect_object(wind->new_stocks);
|
||||
wind->new_stocks = gh_call3(update_stock, wind->stock_hash,
|
||||
wind->ticker_map, wind->acct_map_info);
|
||||
@ -1256,7 +1268,6 @@ gnc_ui_qif_import_currency_next_cb(GnomeDruidPage * page,
|
||||
gnome_druid_set_page(GNOME_DRUID(wind->druid),
|
||||
GNOME_DRUID_PAGE(wind->commodity_pages->data));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
/* it's time to import the accounts. */
|
||||
@ -1277,8 +1288,10 @@ gnc_ui_qif_import_currency_next_cb(GnomeDruidPage * page,
|
||||
gnome_druid_set_page(GNOME_DRUID(wind->druid),
|
||||
get_named_page(wind, "end_page"));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gnc_unset_busy_cursor(NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -1395,6 +1408,7 @@ gnc_ui_qif_import_commodity_prepare_cb(GnomeDruidPage * page,
|
||||
}
|
||||
|
||||
/* insert new pages, one for each stock */
|
||||
gnc_set_busy_cursor(NULL, TRUE);
|
||||
stocks = wind->new_stocks;
|
||||
while(!gh_null_p(stocks) && (stocks != SCM_BOOL_F)) {
|
||||
comm_ptr_token = gh_call2(hash_ref, wind->stock_hash, gh_car(stocks));
|
||||
@ -1417,6 +1431,7 @@ gnc_ui_qif_import_commodity_prepare_cb(GnomeDruidPage * page,
|
||||
stocks = gh_cdr(stocks);
|
||||
gtk_widget_show_all(new_page->page);
|
||||
}
|
||||
gnc_unset_busy_cursor(NULL);
|
||||
|
||||
gnc_druid_set_colors (GNOME_DRUID (wind->druid));
|
||||
}
|
||||
|
@ -248,7 +248,7 @@
|
||||
|
||||
((rtrncap rtrncapx)
|
||||
(set! qif-account
|
||||
(default-capital-return-acct from-acct))
|
||||
(default-capital-return-acct from-acct stock-acct))
|
||||
(set! qif-account-types (list GNC-INCOME-TYPE)))
|
||||
|
||||
((shrsin shrsout)
|
||||
|
@ -216,13 +216,7 @@
|
||||
;;(write current-xtn) (newline)
|
||||
(set! current-xtn (make-qif-xtn))
|
||||
(set! current-split #f)
|
||||
(set! default-split (make-qif-split))
|
||||
(if progress-dialog
|
||||
(begin
|
||||
(gnc:progress-dialog-set-value
|
||||
progress-dialog
|
||||
(* 100 (/ bytes-read file-size)))
|
||||
(gnc:progress-dialog-update progress-dialog))))))
|
||||
(set! default-split (make-qif-split)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Class transactions
|
||||
@ -361,6 +355,14 @@
|
||||
return-val
|
||||
(list #f "File does not appear to be a QIF file."))
|
||||
(set! heinous-error #t))))))
|
||||
|
||||
;; update the progress bar for each line read
|
||||
(if progress-dialog
|
||||
(begin
|
||||
(gnc:progress-dialog-set-value
|
||||
progress-dialog
|
||||
(* 100 (/ bytes-read file-size)))
|
||||
(gnc:progress-dialog-update progress-dialog)))
|
||||
|
||||
;; this is if we read a normal (non-null, non-eof) line...
|
||||
(if (not heinous-error)
|
||||
|
@ -7,7 +7,7 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-module (gnucash import-export qif-import))
|
||||
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
|
||||
(use-modules (gnucash main) (g-wrapped gw-gnc)) ;; FIXME: delete after we finish modularizing.
|
||||
(use-modules (g-wrapped gw-runtime))
|
||||
(use-modules (gnucash gnc-module))
|
||||
(use-modules (ice-9 slib))
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; qif-parse.scm
|
||||
;;; routines to parse values and dates in QIF files.
|
||||
;;;
|
||||
@ -236,6 +236,10 @@
|
||||
'reinvsh)
|
||||
((reminder erinnerg)
|
||||
'reminder)
|
||||
((rtrncap)
|
||||
'rtrncap)
|
||||
((rtrncapx)
|
||||
'rtrncapx)
|
||||
((sell verkauf) ;; verkaufen
|
||||
'sell)
|
||||
((sellx verkaufx)
|
||||
|
@ -922,7 +922,7 @@
|
||||
(default-margin-interest-acct from-acct)))
|
||||
((rtrncap rtrncapx)
|
||||
(set! far-acct-name
|
||||
(default-return-capital-acct from-acct)))
|
||||
(default-capital-return-acct from-acct security)))
|
||||
((div divx reinvdiv)
|
||||
(set! far-acct-name
|
||||
(default-dividend-acct from-acct security)))
|
||||
|
@ -127,7 +127,7 @@
|
||||
(cons (default-margin-interest-acct from-acct) 'brokerage)))
|
||||
((rtrncap rtrncapx)
|
||||
(set! far-acct
|
||||
(cons (default-return-capital-acct from-acct) 'brokerage)))
|
||||
(cons (default-capital-return-acct from-acct) 'brokerage)))
|
||||
((div divx reinvdiv)
|
||||
(set! far-acct
|
||||
(cons (default-dividend-acct from-acct security) 'brokerage)))
|
||||
|
Loading…
Reference in New Issue
Block a user