Generate total balance for member.
This commit is contained in:
parent
d092275797
commit
76ff48329a
3 changed files with 22 additions and 7 deletions
|
@ -66,6 +66,7 @@
|
|||
member-record-add-payment
|
||||
member-payments
|
||||
member-balance
|
||||
member-total-balance
|
||||
|
||||
member-record-tests!
|
||||
)
|
||||
|
@ -350,6 +351,15 @@
|
|||
(define (member-balance mr)
|
||||
(dict-ref mr 'balance (make-dict)))
|
||||
|
||||
;; Computes total member balance from credit, fees and payment
|
||||
;; information
|
||||
(define (member-total-balance mr)
|
||||
(let* ((bal (member-balance mr))
|
||||
(fees (dict-ref bal 'fees 0))
|
||||
(credit (dict-ref bal 'credit 0))
|
||||
(payment (dict-ref bal 'payment)))
|
||||
(- (+ credit payment) fees)))
|
||||
|
||||
;; Self-tests
|
||||
(define (member-record-tests!)
|
||||
(run-tests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue