mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[balance-forecast] adjust sx accumulator until report from-date
this commit will initialize the sx accumulator by adding all instantiated sx amounts, from the earliest split posted-date among the selected accounts, until the report start-date.
This commit is contained in:
parent
a4d76177fb
commit
1ade6fe6b4
@ -145,6 +145,21 @@
|
||||
(balances #f)
|
||||
)
|
||||
|
||||
;; initialize the SX balance accumulator with the instantiated SX
|
||||
;; amounts starting from the earliest split date in the list of
|
||||
;; accounts up to the report start date.
|
||||
(let* ((account-dates (map (compose xaccTransGetDate xaccSplitGetParent car)
|
||||
(filter pair? (map xaccAccountGetSplitList accounts))))
|
||||
(earliest (and (pair? account-dates) (apply min account-dates)))
|
||||
(sx-hash (if earliest
|
||||
(gnc-sx-all-instantiate-cashflow-all earliest from-date)
|
||||
(make-hash-table))))
|
||||
(for-each
|
||||
(lambda (account)
|
||||
(accum 'add (xaccAccountGetCommodity account)
|
||||
(hash-ref sx-hash (gncAccountGetGUID account) 0)))
|
||||
accounts))
|
||||
|
||||
; Calculate balances
|
||||
(set! balances
|
||||
(map (lambda (date) (let* (
|
||||
|
Loading…
Reference in New Issue
Block a user