mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[report-system] deprecate (gnc:account-get-total-flow)
This function is only used in equity-statement.scm -- best move it there and deprecate the exported function.
This commit is contained in:
parent
83f48352b1
commit
145779866c
@ -723,7 +723,7 @@
|
||||
(export gnc:monetaries-add)
|
||||
(export gnc:account-get-trans-type-balance-interval)
|
||||
(export gnc:account-get-trans-type-balance-interval-with-closing)
|
||||
(export gnc:account-get-total-flow)
|
||||
(export gnc:account-get-total-flow) ;deprecated
|
||||
(export gnc:account-get-pos-trans-total-interval)
|
||||
(export gnc:account-get-trans-type-splits-interval)
|
||||
(export gnc:double-col) ;deprecated
|
||||
|
@ -731,6 +731,8 @@ flawed. see report-utilities.scm. please update reports.")
|
||||
;; returns a commodity collector
|
||||
;; does NOT do currency exchanges
|
||||
(define (gnc:account-get-total-flow direction target-account-list from-date to-date)
|
||||
(issue-deprecation-warning
|
||||
"(gnc:account-get-total-flow) is deprecated.")
|
||||
(let ((total-flow (gnc:make-commodity-collector)))
|
||||
(for-each
|
||||
(lambda (target-account)
|
||||
|
@ -432,22 +432,6 @@
|
||||
44
|
||||
(gnc:accounts-count-splits (list expense income)))
|
||||
|
||||
(test-equal "gnc:account-get-total-flow 'in"
|
||||
'(("GBP" . 14) ("USD" . 2544))
|
||||
(collector->list
|
||||
(gnc:account-get-total-flow 'in
|
||||
(list bank)
|
||||
(gnc-dmy2time64 15 01 1970)
|
||||
(gnc-dmy2time64 01 01 2001))))
|
||||
|
||||
(test-equal "gnc:account-get-total-flow 'out"
|
||||
'(("USD" . -296))
|
||||
(collector->list
|
||||
(gnc:account-get-total-flow 'out
|
||||
(list bank)
|
||||
(gnc-dmy2time64 15 01 1970)
|
||||
(gnc-dmy2time64 01 01 2001))))
|
||||
|
||||
(let ((account-balances (gnc:get-assoc-account-balances
|
||||
(list bank gbp-bank)
|
||||
(lambda (acct)
|
||||
|
@ -181,6 +181,24 @@
|
||||
|
||||
options))
|
||||
|
||||
(define (account-get-total-flow direction target-account-list from-date to-date)
|
||||
(let ((total-flow (gnc:make-commodity-collector)))
|
||||
(for-each
|
||||
(lambda (target-account)
|
||||
(for-each
|
||||
(lambda (target-account-split)
|
||||
(let* ((transaction (xaccSplitGetParent target-account-split))
|
||||
(split-value (xaccSplitGetAmount target-account-split)))
|
||||
(if (and (<= from-date (xaccTransGetDate transaction) to-date)
|
||||
(or (and (eq? direction 'in)
|
||||
(positive? split-value))
|
||||
(and (eq? direction 'out)
|
||||
(negative? split-value))))
|
||||
(total-flow 'add (xaccTransGetCurrency transaction) split-value))))
|
||||
(xaccAccountGetSplitList target-account)))
|
||||
target-account-list)
|
||||
total-flow))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; equity-statement-renderer
|
||||
;; set up the document and add the table
|
||||
@ -542,7 +560,7 @@
|
||||
(net-investment 'minusmerge neg-pre-closing-equity #f);; > 0
|
||||
(net-investment 'merge neg-start-equity-balance #f) ;; net increase
|
||||
|
||||
(set! withdrawals (gnc:account-get-total-flow 'in equity-accounts start-date end-date))
|
||||
(set! withdrawals (account-get-total-flow 'in equity-accounts start-date end-date))
|
||||
|
||||
(set! investments (gnc:make-commodity-collector))
|
||||
(investments 'merge net-investment #f)
|
||||
|
Loading…
Reference in New Issue
Block a user