diff --git a/src/scm/qif-import/qif-file.scm b/src/scm/qif-import/qif-file.scm index 5da61062e6..e0cbf19703 100644 --- a/src/scm/qif-import/qif-file.scm +++ b/src/scm/qif-import/qif-file.scm @@ -154,6 +154,7 @@ ;; S : split category ((#\S) (set! current-split (make-qif-split)) + (set! default-split #f) (qif-split:set-category! current-split value) (qif-xtn:set-splits! current-xtn @@ -192,6 +193,7 @@ (if (qif-xtn:date current-xtn) (qif-file:add-xtn! self current-xtn)) (set! current-xtn (make-qif-xtn)) + (set! current-split #f) (set! default-split (make-qif-split))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -310,14 +312,13 @@ ;; and this is if we read a null or eof line (if (and (not heinous-error) (not (eof-object? line))) - (line-loop)))))) + (line-loop)))))) ;; now reverse the transaction list so xtns are in the same order that ;; they were in the file. This is important in a few cases. (qif-file:set-xtns! self (reverse (qif-file:xtns self))) return-val)) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; qif-file:process-opening-balance-xtn self xtn ;; @@ -395,6 +396,7 @@ (display elt)) lst)))))) (set! start-time (gettimeofday)) + (and ;; fields of categories. (check-and-parse-field @@ -470,7 +472,7 @@ set-error) ;; this one's a little tricky... it checks and sets all the - ;; split amounts for the transaction together. + ;; split amounts for the transaction together. (check-and-parse-field qif-xtn:split-amounts qif-xtn:set-split-amounts! qif-parse:check-number-formats '(decimal comma) diff --git a/src/scm/qif-import/qif-to-gnc.scm b/src/scm/qif-import/qif-to-gnc.scm index 6d681c49b8..6ad5c6d556 100644 --- a/src/scm/qif-import/qif-to-gnc.scm +++ b/src/scm/qif-import/qif-to-gnc.scm @@ -579,11 +579,9 @@ (done #f)) (if bank-xtn? - (let ((near (qif-xtn:from-acct xtn))) - (set! far-acct-name (qif-split:category split)) - (if near - (set! near-acct-name near) - (set! near-acct-name (qif-file:default-account qif-file)))) + (begin + (set! near-acct-name (qif-xtn:from-acct xtn)) + (set! far-acct-name (qif-split:category split))) (let ((qif-accts (qif-split:accounts-affected split xtn)) @@ -596,11 +594,14 @@ ;; transactions to match up. Quicken thinks the near ;; and far accounts are different than we do. (case action - ((intincx divx cglongx cgshortx miscincx miscexpx) + ((intincx divx cglongx cgshortx miscincx miscexpx sellx) (set! amount (- amount)) (set! near-acct-name (qif-xtn:from-acct xtn)) (set! far-acct-name (qif-split:category split))) - ((xout sellx) + ((buyx) + (set! near-acct-name (qif-xtn:from-acct xtn)) + (set! far-acct-name (qif-split:category split))) + ((xout) (set! amount (- amount))))) (set! amount (- amount commission)))) @@ -619,7 +620,7 @@ (set! done #t))) ;; iterate with the next split (if (and (not done) - (not (null? (cdr splits)))) + (not (null? (cdr splits)))) (split-loop (cdr splits))))) ;; iterate with the next transaction @@ -774,6 +775,8 @@ (length (qif-xtn:splits other-xtn))) (qif-xtn:mark-split xtn split) (qif-xtn:mark-split other-xtn other-split)))))) + + (define (qif-xtn:mark-split xtn split) (qif-split:set-mark! split #t)