Use balance struct and move it to member-print-table.

This commit is contained in:
Dominik Pantůček 2023-04-02 19:02:32 +02:00
parent f9eb053c9a
commit 952fd03f16
2 changed files with 12 additions and 12 deletions

View file

@ -169,17 +169,7 @@ 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 ()
(print-member-table mr) (print-member-table mr)
(let* ((fees (member-fees-total mr))
(credit (member-credit-total mr))
(payments (member-payments-total mr))
(balance (- (+ credit payments) fees)))
(print "Total fees: " fees)
(print "Total credit: " credit)
(print "Total payments: " payments)
(print "Balance: " balance)
))
(print-members-base-table MB)) (print-members-base-table MB))
(newline)) (newline))
((print-stats) ((print-stats)

View file

@ -147,7 +147,17 @@
(member-calendar->table mr)) (member-calendar->table mr))
) )
#:row0-border #t #:row0-border #t
#:col-border #t))) #:col-border #t))
(let* ((balance (member-balance mr))
(fees (dict-ref balance 'fees))
(credit (dict-ref balance 'credit))
(payment (dict-ref balance 'payment))
(total (- (+ credit payment) fees)))
(print "Total fees: " fees)
(print "Total credit: " credit)
(print "Total payments: " payment)
(print "Balance: " total)
))
;; Nicely prints the member source with any errors recorded. ;; Nicely prints the member source with any errors recorded.
(define (print-member-source mr) (define (print-member-source mr)