qif patch

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2467 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-06-14 04:08:38 +00:00
parent 765f8ea987
commit a293c1bf94
2 changed files with 16 additions and 11 deletions

View File

@ -154,6 +154,7 @@
;; S : split category ;; S : split category
((#\S) ((#\S)
(set! current-split (make-qif-split)) (set! current-split (make-qif-split))
(set! default-split #f)
(qif-split:set-category! current-split value) (qif-split:set-category! current-split value)
(qif-xtn:set-splits! (qif-xtn:set-splits!
current-xtn current-xtn
@ -192,6 +193,7 @@
(if (qif-xtn:date current-xtn) (if (qif-xtn:date current-xtn)
(qif-file:add-xtn! self current-xtn)) (qif-file:add-xtn! self current-xtn))
(set! current-xtn (make-qif-xtn)) (set! current-xtn (make-qif-xtn))
(set! current-split #f)
(set! default-split (make-qif-split))))) (set! default-split (make-qif-split)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -310,14 +312,13 @@
;; and this is if we read a null or eof line ;; and this is if we read a null or eof line
(if (and (not heinous-error) (if (and (not heinous-error)
(not (eof-object? line))) (not (eof-object? line)))
(line-loop)))))) (line-loop))))))
;; now reverse the transaction list so xtns are in the same order that ;; 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. ;; they were in the file. This is important in a few cases.
(qif-file:set-xtns! self (reverse (qif-file:xtns self))) (qif-file:set-xtns! self (reverse (qif-file:xtns self)))
return-val)) return-val))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; qif-file:process-opening-balance-xtn self xtn ;; qif-file:process-opening-balance-xtn self xtn
;; ;;
@ -395,6 +396,7 @@
(display elt)) (display elt))
lst)))))) lst))))))
(set! start-time (gettimeofday)) (set! start-time (gettimeofday))
(and (and
;; fields of categories. ;; fields of categories.
(check-and-parse-field (check-and-parse-field
@ -470,7 +472,7 @@
set-error) set-error)
;; this one's a little tricky... it checks and sets all the ;; 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 (check-and-parse-field
qif-xtn:split-amounts qif-xtn:set-split-amounts! qif-xtn:split-amounts qif-xtn:set-split-amounts!
qif-parse:check-number-formats '(decimal comma) qif-parse:check-number-formats '(decimal comma)

View File

@ -579,11 +579,9 @@
(done #f)) (done #f))
(if bank-xtn? (if bank-xtn?
(let ((near (qif-xtn:from-acct xtn))) (begin
(set! far-acct-name (qif-split:category split)) (set! near-acct-name (qif-xtn:from-acct xtn))
(if near (set! far-acct-name (qif-split:category split)))
(set! near-acct-name near)
(set! near-acct-name (qif-file:default-account qif-file))))
(let ((qif-accts (let ((qif-accts
(qif-split:accounts-affected split xtn)) (qif-split:accounts-affected split xtn))
@ -596,11 +594,14 @@
;; transactions to match up. Quicken thinks the near ;; transactions to match up. Quicken thinks the near
;; and far accounts are different than we do. ;; and far accounts are different than we do.
(case action (case action
((intincx divx cglongx cgshortx miscincx miscexpx) ((intincx divx cglongx cgshortx miscincx miscexpx sellx)
(set! amount (- amount)) (set! amount (- amount))
(set! near-acct-name (qif-xtn:from-acct xtn)) (set! near-acct-name (qif-xtn:from-acct xtn))
(set! far-acct-name (qif-split:category split))) (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)))))
(set! amount (- amount commission)))) (set! amount (- amount commission))))
@ -619,7 +620,7 @@
(set! done #t))) (set! done #t)))
;; iterate with the next split ;; iterate with the next split
(if (and (not done) (if (and (not done)
(not (null? (cdr splits)))) (not (null? (cdr splits))))
(split-loop (cdr splits))))) (split-loop (cdr splits)))))
;; iterate with the next transaction ;; iterate with the next transaction
@ -774,6 +775,8 @@
(length (qif-xtn:splits other-xtn))) (length (qif-xtn:splits other-xtn)))
(qif-xtn:mark-split xtn split) (qif-xtn:mark-split xtn split)
(qif-xtn:mark-split other-xtn other-split)))))) (qif-xtn:mark-split other-xtn other-split))))))
(define (qif-xtn:mark-split xtn split) (define (qif-xtn:mark-split xtn split)
(qif-split:set-mark! split #t) (qif-split:set-mark! split #t)