mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[qif-to-gnc] use (ice-9 match), and compact functions
This commit is contained in:
parent
11689e2a4d
commit
ec99c00714
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
(use-modules (srfi srfi-13))
|
(use-modules (srfi srfi-13))
|
||||||
|
(use-modules (ice-9 match))
|
||||||
(use-modules (gnucash import-export string))
|
(use-modules (gnucash import-export string))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@ -513,12 +514,10 @@
|
|||||||
;; Look for the transaction status (QIF "C" line). When it exists, apply
|
;; Look for the transaction status (QIF "C" line). When it exists, apply
|
||||||
;; the cleared (c) or reconciled (y) status to the split. Otherwise, apply
|
;; the cleared (c) or reconciled (y) status to the split. Otherwise, apply
|
||||||
;; user preference.
|
;; user preference.
|
||||||
(if (eq? qif-cleared 'cleared)
|
(case qif-cleared
|
||||||
(xaccSplitSetReconcile gnc-near-split #\c)
|
((cleared) (xaccSplitSetReconcile gnc-near-split #\c))
|
||||||
(if (eq? qif-cleared 'reconciled)
|
((reconciled) (xaccSplitSetReconcile gnc-near-split #\y))
|
||||||
(xaccSplitSetReconcile gnc-near-split #\y)
|
(else (xaccSplitSetReconcile gnc-near-split transaction-status-pref)))
|
||||||
;; Apply user preference by default.
|
|
||||||
(xaccSplitSetReconcile gnc-near-split transaction-status-pref)))
|
|
||||||
|
|
||||||
(if (not qif-security)
|
(if (not qif-security)
|
||||||
(begin
|
(begin
|
||||||
@ -595,11 +594,9 @@
|
|||||||
(set! far-acct (hash-ref gnc-acct-hash far-acct-name))
|
(set! far-acct (hash-ref gnc-acct-hash far-acct-name))
|
||||||
|
|
||||||
;; set the reconcile status.
|
;; set the reconcile status.
|
||||||
(let ((cleared (qif-split:matching-cleared qif-split)))
|
(case (qif-split:matching-cleared qif-split)
|
||||||
(if (eq? 'cleared cleared)
|
((cleared) (xaccSplitSetReconcile gnc-far-split #\c))
|
||||||
(xaccSplitSetReconcile gnc-far-split #\c))
|
((reconciled) (xaccSplitSetReconcile gnc-far-split #\y)))
|
||||||
(if (eq? 'reconciled cleared)
|
|
||||||
(xaccSplitSetReconcile gnc-far-split #\y)))
|
|
||||||
|
|
||||||
;; finally, plug the split into the account
|
;; finally, plug the split into the account
|
||||||
(xaccSplitSetAccount gnc-far-split far-acct)
|
(xaccSplitSetAccount gnc-far-split far-acct)
|
||||||
@ -762,12 +759,9 @@
|
|||||||
(xaccSplitSetValue gnc-near-split (n- split-amt))
|
(xaccSplitSetValue gnc-near-split (n- split-amt))
|
||||||
(xaccSplitSetValue gnc-far-split split-amt))))
|
(xaccSplitSetValue gnc-far-split split-amt))))
|
||||||
|
|
||||||
(let ((cleared (qif-split:matching-cleared
|
(case (qif-split:matching-cleared (car (qif-xtn:splits qif-xtn)))
|
||||||
(car (qif-xtn:splits qif-xtn)))))
|
((cleared) (xaccSplitSetReconcile gnc-far-split #\c))
|
||||||
(if (eq? 'cleared cleared)
|
((reconciled) (xaccSplitSetReconcile gnc-far-split #\y)))
|
||||||
(xaccSplitSetReconcile gnc-far-split #\c))
|
|
||||||
(if (eq? 'reconciled cleared)
|
|
||||||
(xaccSplitSetReconcile gnc-far-split #\y)))
|
|
||||||
|
|
||||||
(if qif-commission-acct
|
(if qif-commission-acct
|
||||||
(let* ((commission-acct-info
|
(let* ((commission-acct-info
|
||||||
@ -957,14 +951,9 @@
|
|||||||
(this-group-amt (gnc-numeric-zero))
|
(this-group-amt (gnc-numeric-zero))
|
||||||
(how #f)
|
(how #f)
|
||||||
(date-matches
|
(date-matches
|
||||||
(let ((self-date (qif-xtn:date xtn)))
|
(match (cons date (qif-xtn:date xtn))
|
||||||
(and (pair? self-date)
|
(((a b c) . (a b c)) #t)
|
||||||
(pair? date)
|
(_ #f)))
|
||||||
(eq? (length self-date) 3)
|
|
||||||
(eq? (length date) 3)
|
|
||||||
(= (car self-date) (car date))
|
|
||||||
(= (cadr self-date) (cadr date))
|
|
||||||
(= (caddr self-date) (caddr date)))))
|
|
||||||
(n- (lambda (n) (gnc-numeric-neg n)))
|
(n- (lambda (n) (gnc-numeric-neg n)))
|
||||||
(nsub (lambda (a b) (gnc-numeric-sub a b 0 GNC-DENOM-LCD)))
|
(nsub (lambda (a b) (gnc-numeric-sub a b 0 GNC-DENOM-LCD)))
|
||||||
(n+ (lambda (a b) (gnc-numeric-add a b 0 GNC-DENOM-LCD)))
|
(n+ (lambda (a b) (gnc-numeric-add a b 0 GNC-DENOM-LCD)))
|
||||||
|
Loading…
Reference in New Issue
Block a user