Calculate total credit with current month restriction in place.

This commit is contained in:
Dominik Pantůček 2023-05-11 16:49:42 +02:00
parent cbd17399e3
commit d5ac70b95a
2 changed files with 10 additions and 2 deletions

View file

@ -84,7 +84,7 @@
(*members-directory* dir))
(-month (YYYY-MM) "Specify current month"
(-normal-month- #f)
(*current-month* (string->month YYYY-MM)))
(*current-month* (string->cal-month YYYY-MM)))
(-tstyle (style) "Use given table style: debug, ascii, unicode"
(*table-border-style* (string->symbol style)))
(-apikey (fname) "File with Fio API keys"

View file

@ -163,7 +163,15 @@
;; Total credit manually recorded in member record
(define (member-credit-total mr)
(let* ((credit (brmember-info mr 'credit '()))
(let* ((credit (filter (lambda (cr)
(let* ((cmon (cadr cr))
(mon (if cmon
(cal-ensure-month cmon)
#f)))
(if mon
(cal-month<=? mon (*current-month*))
#t)))
(brmember-info mr 'credit '())))
(amounts (map car credit)))
(foldl + 0 amounts)))