mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Avoid trying to represent "forever-ago" with a timepair.
Instead, call gnc:accountlist-get-comm-balance-at-date when we really just want the balance at one date. This fixes the retained-earnings calculation on the balance sheet report. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13790 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
54374be00d
commit
e048e7e7f7
@ -585,6 +585,7 @@
|
||||
(export gnc:account-get-comm-balance-interval)
|
||||
(export gnc:group-get-comm-balance-interval)
|
||||
(export gnc:accountlist-get-comm-balance-interval)
|
||||
(export gnc:accountlist-get-comm-balance-at-date)
|
||||
(export gnc:query-set-match-non-voids-only!)
|
||||
(export gnc:query-set-match-voids-only!)
|
||||
(export gnc:split-voided?)
|
||||
|
@ -645,6 +645,15 @@
|
||||
accountlist)
|
||||
collector))
|
||||
|
||||
(define (gnc:accountlist-get-comm-balance-at-date accountlist date)
|
||||
(let ((collector (gnc:make-commodity-collector)))
|
||||
(for-each (lambda (account)
|
||||
(gnc:commodity-collector-merge
|
||||
collector (gnc:account-get-comm-balance-at-date
|
||||
account date #f)))
|
||||
accountlist)
|
||||
collector))
|
||||
|
||||
;; utility function - ensure that a query matches only non-voids. Destructive.
|
||||
(define (gnc:query-set-match-non-voids-only! query book)
|
||||
(let ((temp-query (gnc:malloc-query)))
|
||||
|
@ -277,7 +277,6 @@
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(define forever-ago (cons 0 0))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
@ -481,9 +480,8 @@
|
||||
(gnc:report-percent-done 12)
|
||||
;; sum any retained earnings
|
||||
(set! neg-retained-earnings
|
||||
(gnc:accountlist-get-comm-balance-interval
|
||||
income-expense-accounts
|
||||
forever-ago date-tp))
|
||||
(gnc:accountlist-get-comm-balance-at-date
|
||||
income-expense-accounts date-tp))
|
||||
(set! retained-earnings (gnc:make-commodity-collector))
|
||||
(retained-earnings 'minusmerge
|
||||
neg-retained-earnings
|
||||
|
@ -193,7 +193,6 @@
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(define forever-ago (cons 0 0))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
@ -440,13 +439,11 @@
|
||||
|
||||
;; start and end retained earnings (income - expenses)
|
||||
(set! neg-pre-start-retained-earnings
|
||||
(gnc:accountlist-get-comm-balance-interval
|
||||
income-expense-accounts
|
||||
forever-ago start-date-tp)) ; OK
|
||||
(gnc:accountlist-get-comm-balance-at-date
|
||||
income-expense-accounts start-date-tp)) ; OK
|
||||
(set! neg-pre-end-retained-earnings
|
||||
(gnc:accountlist-get-comm-balance-interval
|
||||
income-expense-accounts
|
||||
forever-ago end-date-tp)) ; OK
|
||||
(gnc:accountlist-get-comm-balance-at-date
|
||||
income-expense-accounts end-date-tp)) ; OK
|
||||
;; neg-pre-end-retained-earnings is not used to calculate
|
||||
;; profit but is used to calculate unrealized gains
|
||||
|
||||
|
@ -287,7 +287,6 @@
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(define forever-ago (cons 0 0))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user