mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[budget] compact calc-user-period
This commit is contained in:
parent
c8625ab5fb
commit
cd496cbe3c
@ -601,23 +601,15 @@
|
|||||||
#f))))))
|
#f))))))
|
||||||
;; Maps type of user selected period to concrete period number, if
|
;; Maps type of user selected period to concrete period number, if
|
||||||
;; user not selected to use range false is returned
|
;; user not selected to use range false is returned
|
||||||
(define (calc-user-period budget
|
(define (calc-user-period budget use-ranges? period-type period-exact-val)
|
||||||
use-ranges? period-type period-exact-val)
|
(and use-ranges?
|
||||||
(if (not use-ranges?)
|
(case period-type
|
||||||
#f
|
((first) 0)
|
||||||
(cond
|
((last) (1- (gnc-budget-get-num-periods budget)))
|
||||||
((eq? 'first period-type) 0)
|
((manual) (1- period-exact-val))
|
||||||
((eq? 'last period-type) (- (gnc-budget-get-num-periods budget) 1))
|
((previous) (find-period-relative-to-current budget 1-))
|
||||||
((eq? 'manual period-type) (- period-exact-val 1))
|
((current) (find-period-relative-to-current budget identity))
|
||||||
((eq? 'previous period-type)
|
((next) (find-period-relative-to-current budget 1+)))))
|
||||||
(find-period-relative-to-current budget (lambda (period)
|
|
||||||
(- period 1))))
|
|
||||||
((eq? 'current period-type)
|
|
||||||
(find-period-relative-to-current budget (lambda (period)
|
|
||||||
period)))
|
|
||||||
((eq? 'next period-type)
|
|
||||||
(find-period-relative-to-current budget (lambda (period)
|
|
||||||
(+ period 1)))))))
|
|
||||||
;; Performs calculation of periods list. If list element is a list
|
;; Performs calculation of periods list. If list element is a list
|
||||||
;; itself, it means that elements of this sublist should be
|
;; itself, it means that elements of this sublist should be
|
||||||
;; presented as summed value. If user required a total column
|
;; presented as summed value. If user required a total column
|
||||||
|
Loading…
Reference in New Issue
Block a user