Prepare for balances in totals table.
This commit is contained in:
parent
8f0d5acf0a
commit
606a208237
5 changed files with 40 additions and 21 deletions
|
@ -39,7 +39,10 @@
|
|||
bank-account
|
||||
member-record
|
||||
members-base
|
||||
bank-fio)
|
||||
bank-fio
|
||||
|
||||
dictionary
|
||||
member-fees)
|
||||
|
||||
;; Merges bank account statement into members payment keys. The
|
||||
;; payment key will be a list of transactions.
|
||||
|
@ -77,11 +80,20 @@
|
|||
(if apikeys-file
|
||||
(let* ((accounts (load-accounts
|
||||
(load-accounts-list apikeys-file))))
|
||||
(foldl members-payments-process-bank
|
||||
mb
|
||||
accounts))
|
||||
(map member-add-balances
|
||||
(foldl members-payments-process-bank
|
||||
mb
|
||||
accounts)))
|
||||
mb))
|
||||
|
||||
;; Adds all balances
|
||||
(define (member-add-balances mr)
|
||||
(dict-set mr
|
||||
'balances
|
||||
(make-dict `((fees . ,(member-fees-total mr))
|
||||
(credit . ,(member-credit-total mr))
|
||||
(balance . ,(member-payments-total mr))))))
|
||||
|
||||
;; Total amount paid
|
||||
(define (member-payments-total mr)
|
||||
(foldl + 0 (map bank-transaction-amount
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue