Add active debtors table.
This commit is contained in:
parent
ef73cecec5
commit
1eb93de083
2 changed files with 41 additions and 8 deletions
|
@ -331,7 +331,9 @@ NOTIFICATIONS-SOURCES=notifications.scm brmember.import.scm \
|
|||
util-mail.import.scm util-dict-list.import.scm \
|
||||
members-payments.import.scm util-format.import.scm \
|
||||
brmember-format.import.scm configuration.import.scm \
|
||||
util-time.import.scm members-fees.import.scm
|
||||
util-time.import.scm members-fees.import.scm mbase.import.scm \
|
||||
members-print.import.scm table.import.scm \
|
||||
bank-account.import.scm
|
||||
|
||||
notifications.o: notifications.import.scm
|
||||
notifications.import.scm: $(NOTIFICATIONS-SOURCES)
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
(import scheme
|
||||
(chicken base)
|
||||
(chicken format)
|
||||
(chicken string)
|
||||
brmember
|
||||
util-mail
|
||||
util-dict-list
|
||||
|
@ -48,7 +49,8 @@
|
|||
members-fees
|
||||
mbase
|
||||
members-print
|
||||
table)
|
||||
table
|
||||
bank-account)
|
||||
|
||||
;; Prints email to the console
|
||||
(define (print-notification-email em)
|
||||
|
@ -131,9 +133,38 @@
|
|||
(append
|
||||
(list ""
|
||||
"Unpaired transactions:")
|
||||
(unpaired-table mb #:border-style 'ascii)))))
|
||||
(unpaired-table mb #:border-style 'ascii))))
|
||||
(debtors (members-to-notify mb 1))
|
||||
(debtors-lst
|
||||
(if (null? debtors)
|
||||
'()
|
||||
(append
|
||||
(list ""
|
||||
"Active debtors:")
|
||||
(table->list
|
||||
(cons (list "Id" "Member" "Type" "Balance" "Last payment")
|
||||
(map (lambda (mr)
|
||||
(list (brmember-id mr)
|
||||
(brmember-nick mr)
|
||||
(if (brmember-student? mr)
|
||||
'student
|
||||
'normal)
|
||||
(format "\t~A" (member-total-balance mr))
|
||||
(let* ((payments (brmember-payments mr))
|
||||
(tr (if (null? payments)
|
||||
#f
|
||||
(car (reverse payments)))))
|
||||
(if tr
|
||||
(bank-transaction-date tr)
|
||||
"-"))
|
||||
))
|
||||
debtors))
|
||||
#:border-style 'ascii
|
||||
#:col-border #t
|
||||
#:row0-border #t)))))
|
||||
(append income-lst
|
||||
unpaired-lst)))
|
||||
unpaired-lst
|
||||
debtors-lst)))
|
||||
|
||||
;; Creates the summary email structure
|
||||
(define (make-summary-email mb)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue