Unify fees and payments.
This commit is contained in:
parent
b489483229
commit
a10e724629
3 changed files with 37 additions and 2 deletions
|
@ -269,7 +269,10 @@
|
||||||
(print "Current month: " (cal-month->string (*current-month*)))
|
(print "Current month: " (cal-month->string (*current-month*)))
|
||||||
(newline)
|
(newline)
|
||||||
(if mr
|
(if mr
|
||||||
(print-member-table mr)
|
(let ()
|
||||||
|
(print-member-table mr)
|
||||||
|
(brmember-balance-history mr)
|
||||||
|
)
|
||||||
(print-members-base-table MB))
|
(print-members-base-table MB))
|
||||||
(newline))
|
(newline))
|
||||||
((print-stats)
|
((print-stats)
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
member-credit-total
|
member-credit-total
|
||||||
member-calendar->table
|
member-calendar->table
|
||||||
members-summary
|
members-summary
|
||||||
|
member-calendar-entry->fee
|
||||||
)
|
)
|
||||||
|
|
||||||
(import scheme
|
(import scheme
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
|
|
||||||
member-to-notify?
|
member-to-notify?
|
||||||
members-to-notify
|
members-to-notify
|
||||||
|
|
||||||
|
brmember-balance-history
|
||||||
)
|
)
|
||||||
|
|
||||||
(import scheme
|
(import scheme
|
||||||
|
@ -56,7 +58,8 @@
|
||||||
cal-period
|
cal-period
|
||||||
configuration
|
configuration
|
||||||
progress
|
progress
|
||||||
specification)
|
specification
|
||||||
|
cal-day)
|
||||||
|
|
||||||
;; Transaction types to ignore
|
;; Transaction types to ignore
|
||||||
(define ignored-transaction-types
|
(define ignored-transaction-types
|
||||||
|
@ -237,4 +240,32 @@
|
||||||
(lambda (mr)
|
(lambda (mr)
|
||||||
(member-to-notify? mr months))))
|
(member-to-notify? mr months))))
|
||||||
|
|
||||||
|
;; Converts fee prescription to transactions usable in balance
|
||||||
|
;; history
|
||||||
|
(define (calendar->balance-history mc)
|
||||||
|
(map (lambda (mce)
|
||||||
|
(list (cal-ensure-day (car mce))
|
||||||
|
(member-calendar-entry->fee mce)
|
||||||
|
"CZK"
|
||||||
|
(cadr mce)))
|
||||||
|
mc))
|
||||||
|
|
||||||
|
;; Converts bank transactions to transactions usable in balance
|
||||||
|
;; history
|
||||||
|
(define (transactions->balance-history bts)
|
||||||
|
(map (lambda (bt)
|
||||||
|
(list (parse-cal-day/month (bank-transaction-date bt))
|
||||||
|
(bank-transaction-amount bt)
|
||||||
|
(bank-transaction-currency bt)
|
||||||
|
(bank-transaction-message bt)))
|
||||||
|
bts))
|
||||||
|
|
||||||
|
;; Returns a single credit/debit list of payments and fees calendar
|
||||||
|
(define (brmember-balance-history mr)
|
||||||
|
(let ((mcal (calendar->balance-history (member-calendar mr)))
|
||||||
|
(pmts (transactions->balance-history (brmember-payments mr))))
|
||||||
|
(print mcal)
|
||||||
|
(print pmts)
|
||||||
|
'()))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue