mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[budget-income-statement] compact functions
This commit is contained in:
@@ -303,24 +303,13 @@
|
|||||||
(gnc:lookup-option
|
(gnc:lookup-option
|
||||||
(gnc:report-options report-obj) pagename optname)))
|
(gnc:report-options report-obj) pagename optname)))
|
||||||
|
|
||||||
(define
|
(define (get-assoc-account-balances-budget
|
||||||
(get-assoc-account-balances-budget
|
budget accountlist period-start period-end get-balance-fn)
|
||||||
budget
|
|
||||||
accountlist
|
|
||||||
period-start
|
|
||||||
period-end
|
|
||||||
get-balance-fn)
|
|
||||||
(gnc:get-assoc-account-balances
|
(gnc:get-assoc-account-balances
|
||||||
accountlist
|
accountlist (lambda (account)
|
||||||
(lambda (account)
|
(get-balance-fn budget account period-start period-end))))
|
||||||
(get-balance-fn budget account period-start period-end))))
|
|
||||||
|
|
||||||
(define
|
(define (get-budget-account-budget-balance budget account period-start period-end)
|
||||||
(get-budget-account-budget-balance
|
|
||||||
budget
|
|
||||||
account
|
|
||||||
period-start
|
|
||||||
period-end)
|
|
||||||
(gnc:budget-account-get-net budget account period-start period-end))
|
(gnc:budget-account-get-net budget account period-start period-end))
|
||||||
|
|
||||||
(gnc:report-starting reportname)
|
(gnc:report-starting reportname)
|
||||||
@@ -429,9 +418,7 @@
|
|||||||
signed-balance report-commodity exchange-fn)))))
|
signed-balance report-commodity exchange-fn)))))
|
||||||
(label (if neg? (or neg-label pos-label) pos-label))
|
(label (if neg? (or neg-label pos-label) pos-label))
|
||||||
(balance (if neg?
|
(balance (if neg?
|
||||||
(let ((bal (gnc:make-commodity-collector)))
|
(gnc:collector- signed-balance)
|
||||||
(bal 'minusmerge signed-balance #f)
|
|
||||||
bal)
|
|
||||||
signed-balance))
|
signed-balance))
|
||||||
)
|
)
|
||||||
(gnc:html-table-add-labeled-amount-line!
|
(gnc:html-table-add-labeled-amount-line!
|
||||||
@@ -530,20 +517,16 @@
|
|||||||
amount report-commodity exchange-fn)))))
|
amount report-commodity exchange-fn)))))
|
||||||
(label (if neg? (or neg-label pos-label) pos-label))
|
(label (if neg? (or neg-label pos-label) pos-label))
|
||||||
(pos-bal (if neg?
|
(pos-bal (if neg?
|
||||||
(let ((bal (gnc:make-commodity-collector)))
|
(gnc:collector- amount)
|
||||||
(bal 'minusmerge amount #f)
|
|
||||||
bal)
|
|
||||||
amount))
|
amount))
|
||||||
(bal (gnc:sum-collector-commodity
|
(bal (gnc:sum-collector-commodity
|
||||||
pos-bal report-commodity exchange-fn))
|
pos-bal report-commodity exchange-fn))
|
||||||
(balance
|
(balance
|
||||||
(or (and (gnc:uniform-commodity? pos-bal report-commodity)
|
(cond
|
||||||
bal)
|
((gnc:uniform-commodity? pos-bal report-commodity) bal)
|
||||||
(and show-fcur?
|
(show-fcur? (gnc-commodity-table pos-bal report-commodity
|
||||||
(gnc-commodity-table
|
exchange-fn))
|
||||||
pos-bal report-commodity exchange-fn))
|
(else bal)))
|
||||||
bal
|
|
||||||
))
|
|
||||||
(column (or col 0))
|
(column (or col 0))
|
||||||
)
|
)
|
||||||
(gnc:html-table-add-labeled-amount-line!
|
(gnc:html-table-add-labeled-amount-line!
|
||||||
@@ -553,10 +536,8 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
(gnc:report-percent-done 5)
|
(gnc:report-percent-done 5)
|
||||||
|
|
||||||
|
|
||||||
;; Pre-fetch expense account balances.
|
;; Pre-fetch expense account balances.
|
||||||
(set! expense-account-balances
|
(set! expense-account-balances
|
||||||
(get-assoc-account-balances-budget
|
(get-assoc-account-balances-budget
|
||||||
@@ -575,10 +556,8 @@
|
|||||||
(lambda (account start-date end-date)
|
(lambda (account start-date end-date)
|
||||||
(gnc:select-assoc-account-balance expense-account-balances account)))
|
(gnc:select-assoc-account-balance expense-account-balances account)))
|
||||||
|
|
||||||
|
|
||||||
(gnc:report-percent-done 10)
|
(gnc:report-percent-done 10)
|
||||||
|
|
||||||
|
|
||||||
;; Pre-fetch revenue account balances.
|
;; Pre-fetch revenue account balances.
|
||||||
(set! revenue-account-balances
|
(set! revenue-account-balances
|
||||||
(get-assoc-account-balances-budget
|
(get-assoc-account-balances-budget
|
||||||
@@ -599,15 +578,11 @@
|
|||||||
(gnc:commodity-collector-get-negated
|
(gnc:commodity-collector-get-negated
|
||||||
(gnc:select-assoc-account-balance revenue-account-balances account))))
|
(gnc:select-assoc-account-balance revenue-account-balances account))))
|
||||||
|
|
||||||
|
|
||||||
(gnc:report-percent-done 20)
|
(gnc:report-percent-done 20)
|
||||||
|
|
||||||
|
|
||||||
;; calculate net income
|
;; calculate net income
|
||||||
(set! net-income (gnc:make-commodity-collector))
|
(set! net-income
|
||||||
(net-income 'merge revenue-total #f)
|
(gnc:collector- revenue-total expense-total))
|
||||||
(net-income 'minusmerge expense-total #f)
|
|
||||||
|
|
||||||
|
|
||||||
(gnc:report-percent-done 30)
|
(gnc:report-percent-done 30)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user