mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[report-utilities] compact gnc:get-account-period-rolledup-budget-value
This commit is contained in:
parent
1808703354
commit
512dd7c73c
@ -980,18 +980,10 @@
|
|||||||
;; Return value:
|
;; Return value:
|
||||||
;; budget value to use for account for specified period.
|
;; budget value to use for account for specified period.
|
||||||
(define (budget-account-sum budget children period)
|
(define (budget-account-sum budget children period)
|
||||||
(let* ((sum
|
(apply + (map
|
||||||
(cond
|
(lambda (child)
|
||||||
((null? children) (gnc-numeric-zero))
|
(gnc:get-account-period-rolledup-budget-value budget child period))
|
||||||
(else
|
children)))
|
||||||
(gnc-numeric-add
|
|
||||||
(gnc:get-account-period-rolledup-budget-value budget (car children) period)
|
|
||||||
(budget-account-sum budget (cdr children) period)
|
|
||||||
GNC-DENOM-AUTO GNC-RND-ROUND))
|
|
||||||
)
|
|
||||||
))
|
|
||||||
sum)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; Calculate the value to use for the budget of an account for a specific period.
|
;; Calculate the value to use for the budget of an account for a specific period.
|
||||||
;; - If the account has a budget value set for the period, use it
|
;; - If the account has a budget value set for the period, use it
|
||||||
@ -1007,14 +999,11 @@
|
|||||||
;; sum of all budgets for list of children for specified period.
|
;; sum of all budgets for list of children for specified period.
|
||||||
(define (gnc:get-account-period-rolledup-budget-value budget acct period)
|
(define (gnc:get-account-period-rolledup-budget-value budget acct period)
|
||||||
(let* ((bgt-set? (gnc-budget-is-account-period-value-set budget acct period))
|
(let* ((bgt-set? (gnc-budget-is-account-period-value-set budget acct period))
|
||||||
(children (gnc-account-get-children acct))
|
(children (gnc-account-get-children acct)))
|
||||||
(amount (cond
|
(cond
|
||||||
(bgt-set? (gnc-budget-get-account-period-value budget acct period))
|
(bgt-set? (gnc-budget-get-account-period-value budget acct period))
|
||||||
((not (null? children)) (budget-account-sum budget children period))
|
((not (null? children)) (budget-account-sum budget children period))
|
||||||
(else (gnc-numeric-zero)))
|
(else 0))))
|
||||||
))
|
|
||||||
amount)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; Sums rolled-up budget values for a single account from start-period (inclusive) to
|
;; Sums rolled-up budget values for a single account from start-period (inclusive) to
|
||||||
;; end-period (exclusive).
|
;; end-period (exclusive).
|
||||||
|
Loading…
Reference in New Issue
Block a user