Compute total fees.

This commit is contained in:
Dominik Pantůček 2023-03-27 22:10:15 +02:00
parent 1a35c65f1d
commit 6c2a6ca4d2
2 changed files with 24 additions and 5 deletions

View file

@ -135,15 +135,19 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
(print "Current month: " (month->string (*current-month*))) (print "Current month: " (month->string (*current-month*)))
(newline) (newline)
(if mr (if mr
(let () (let* ((mc (member-calendar mr))
(fees (member-calendar->fees mc)))
(print-member-table mr) (print-member-table mr)
(print (table->string (cons (list "" 1 2 3 4 5 6 7 8 9 10 11 12) (print (table->string (cons (list "" 1 2 3 4 5 6 7 8 9 10 11 12)
(member-calendar->years-table (member-calendar mr))) (member-calendar->years-table mc))
#:table-border #t #:table-border #t
#:row-border #t #:row-border #t
#:col-border #t #:col-border #t
#:ansi #t #:ansi #t
))) ))
;; (print fees)
(print "Total fees: " (foldl + 0 fees))
)
(print-members-base-table MB)) (print-members-base-table MB))
(newline)) (newline))
((print-stats) ((print-stats)

View file

@ -88,6 +88,20 @@
" ") ; Nonexistent - should not happen " ") ; Nonexistent - should not happen
" ")) ; Nonexistent " ")) ; Nonexistent
;; Converts the entry into the fee
(define (member-calendar-entry->fee e)
(if e
(if (member 'existing (cadr e))
(if (member 'suspended (cadr e))
0 ; Suspended
(if (member 'destroyed (cadr e))
0 ; Destroyed
(if (member 'student (cadr e))
250 ; Student
500))) ; Normal
0) ; Nonexistent - should not happen
0)) ; Nonexistent
;; Converts the calendar into a table where rows represent years and ;; Converts the calendar into a table where rows represent years and
;; contain the year in the first cell and 12 cells for months after ;; contain the year in the first cell and 12 cells for months after
;; it. ;; it.
@ -111,7 +125,8 @@
row)))) row))))
rows)))))) rows))))))
(define (member-calendar->fees mr) ;; Converts the whole calendar into a list of amounts (fees)
#f) (define (member-calendar->fees mc)
(map member-calendar-entry->fee mc))
) )