Use JendaSAP compatibility layer for transaction pairing.
This commit is contained in:
parent
067f5eba62
commit
af408439dd
3 changed files with 15 additions and 6 deletions
|
@ -212,7 +212,7 @@ bank-fio.import.scm: $(BANK-FIO-SOURCES)
|
|||
|
||||
MEMBERS-PAYMENTS-SOURCES=members-payments.scm bank-account.import.scm \
|
||||
dictionary.import.scm member-fees.import.scm \
|
||||
period.import.scm
|
||||
period.import.scm configuration.import.scm
|
||||
|
||||
members-payments.o: members-payments.import.scm
|
||||
members-payments.import.scm: $(MEMBERS-PAYMENTS-SOURCES)
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
*current-month*
|
||||
*member-suspend-max-months*
|
||||
*members-directory*
|
||||
*jendasap-compat*
|
||||
)
|
||||
|
||||
(import scheme
|
||||
|
|
|
@ -48,7 +48,8 @@
|
|||
bank-fio
|
||||
dictionary
|
||||
member-fees
|
||||
period)
|
||||
period
|
||||
configuration)
|
||||
|
||||
;; Exchange rates
|
||||
(define exchange-rates-lookup-table
|
||||
|
@ -64,8 +65,10 @@
|
|||
(if (equal? (bank-transaction-type transaction) "Poplatek")
|
||||
#f
|
||||
(let* ((varsym-id0
|
||||
(if (*jendasap-compat*) ;; JendaSAP - whole string
|
||||
(bank-transaction-varsym transaction)
|
||||
(string->number
|
||||
(bank-transaction-varsym transaction)))
|
||||
(bank-transaction-varsym transaction))))
|
||||
(varsym-id
|
||||
(or varsym-id0
|
||||
(let* ((msg (bank-transaction-message transaction))
|
||||
|
@ -76,6 +79,12 @@
|
|||
(string->number vs)))))
|
||||
varsym-id)))
|
||||
|
||||
;; Special comparator with JendaSAP hack
|
||||
(define (compare-member-id member-id bank-varsym)
|
||||
(if (*jendasap-compat*)
|
||||
(equal? bank-varsym (number->string member-id))
|
||||
(eq? member-id bank-varsym)))
|
||||
|
||||
;; Merges bank account statement into members payment keys. The
|
||||
;; payment key will be a list of transactions.
|
||||
(define (members-payments-process-bank mb ba)
|
||||
|
@ -87,8 +96,7 @@
|
|||
(varsym-id (transaction-extract-member-id transaction)))
|
||||
(loop (members-base-update mb
|
||||
(lambda (mr)
|
||||
(eq? (member-id mr)
|
||||
varsym-id))
|
||||
(compare-member-id (member-id mr) varsym-id))
|
||||
(lambda (mr)
|
||||
(member-record-add-payment mr transaction)))
|
||||
(cdr transactions))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue