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 \
|
MEMBERS-PAYMENTS-SOURCES=members-payments.scm bank-account.import.scm \
|
||||||
dictionary.import.scm member-fees.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.o: members-payments.import.scm
|
||||||
members-payments.import.scm: $(MEMBERS-PAYMENTS-SOURCES)
|
members-payments.import.scm: $(MEMBERS-PAYMENTS-SOURCES)
|
||||||
|
|
|
@ -49,7 +49,9 @@
|
||||||
dictionary
|
dictionary
|
||||||
member-fees
|
member-fees
|
||||||
period
|
period
|
||||||
configuration)
|
configuration
|
||||||
|
utils
|
||||||
|
month)
|
||||||
|
|
||||||
;; Exchange rates
|
;; Exchange rates
|
||||||
(define exchange-rates-lookup-table
|
(define exchange-rates-lookup-table
|
||||||
|
@ -152,14 +154,20 @@
|
||||||
|
|
||||||
;; Total amount paid - calculated from payments
|
;; Total amount paid - calculated from payments
|
||||||
(define (member-payments-total mr)
|
(define (member-payments-total mr)
|
||||||
(foldl + 0 (map (lambda (tr)
|
(foldl + 0
|
||||||
(let ((amount (bank-transaction-amount tr))
|
(map (lambda (tr)
|
||||||
(currency (bank-transaction-currency tr)))
|
(let ((amount (bank-transaction-amount tr))
|
||||||
(case currency
|
(currency (bank-transaction-currency tr)))
|
||||||
((CZK) amount)
|
(case currency
|
||||||
((EUR) (* amount (lookup-eur-rate)))
|
((CZK) amount)
|
||||||
(else 0))))
|
((EUR) (* amount (lookup-eur-rate)))
|
||||||
(member-payments mr))))
|
(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>?
|
||||||
month-diff
|
month-diff
|
||||||
month-add
|
month-add
|
||||||
|
iso-date->month
|
||||||
month-tests!
|
month-tests!
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue