Preliminary payments filtering in member-payments.
This commit is contained in:
parent
f3fef71026
commit
ba62b905fd
3 changed files with 20 additions and 10 deletions
|
@ -212,7 +212,8 @@ 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 configuration.import.scm
|
||||
period.import.scm configuration.import.scm utils.import.scm \
|
||||
month.import.scm
|
||||
|
||||
members-payments.o: members-payments.import.scm
|
||||
members-payments.import.scm: $(MEMBERS-PAYMENTS-SOURCES)
|
||||
|
|
|
@ -49,7 +49,9 @@
|
|||
dictionary
|
||||
member-fees
|
||||
period
|
||||
configuration)
|
||||
configuration
|
||||
utils
|
||||
month)
|
||||
|
||||
;; Exchange rates
|
||||
(define exchange-rates-lookup-table
|
||||
|
@ -152,14 +154,20 @@
|
|||
|
||||
;; Total amount paid - calculated from payments
|
||||
(define (member-payments-total mr)
|
||||
(foldl + 0 (map (lambda (tr)
|
||||
(let ((amount (bank-transaction-amount tr))
|
||||
(currency (bank-transaction-currency tr)))
|
||||
(case currency
|
||||
((CZK) amount)
|
||||
((EUR) (* amount (lookup-eur-rate)))
|
||||
(else 0))))
|
||||
(member-payments mr))))
|
||||
(foldl + 0
|
||||
(map (lambda (tr)
|
||||
(let ((amount (bank-transaction-amount tr))
|
||||
(currency (bank-transaction-currency tr)))
|
||||
(case currency
|
||||
((CZK) amount)
|
||||
((EUR) (* amount (lookup-eur-rate)))
|
||||
(else 0))))
|
||||
(filter
|
||||
(lambda (tr)
|
||||
(let* ((isodate (bank-transaction-date tr))
|
||||
(month (iso-date->month isodate)))
|
||||
(month<=? month (*current-month*))))
|
||||
(member-payments mr)))))
|
||||
|
||||
|
||||
)
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
month>?
|
||||
month-diff
|
||||
month-add
|
||||
iso-date->month
|
||||
month-tests!
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue