I have this function that takes a list of accounts and returns a ((acct.<result of gnc:account-get-comm...>) (acct.<blah>) (acct.<blah>) ...)
(define (calculate-balances accts start-date end-date)
(if (not (null? accts))
(cons (cons (car accts) (if start-date
(gnc:account-get-comm-balance-interval(car accts) start-date end-date #f)
(gnc:account-get-comm-balance-at-date (car accts) end-date #f)))
(calculate-balances (cdr accts) start-date end-date))
'()
)
)
I am displaying the contents of that return with:
(for-each
(lambda (x)
(if x (begin
(display (list (car x) (gnc:sum-collector-commodity (cdr x) report-commodity exchange-fn)))
(newline)
)
)
)
balance-table)
where balance-table is the result of the above function.
here is a snip of the output:
(#<swig-pointer Account * 84ea4f0> #<<gnc-monetary> commodity: #<swig-pointer gnc_commodity * 84cf3b8> amount: #<<gnc-numeric> num: 2729720 denom: 100>>)
(#<swig-pointer Account * 84ea5e8> #<<gnc-monetary> commodity: #<swig-pointer gnc_commodity * 84cf3b8> amount: #<<gnc-numeric> num: 275300 denom: 100>>)
(#<swig-pointer Account * 84ea6e0> #<<gnc-monetary> commodity: #<swig-pointer gnc_commodity * 84cf3b8> amount: #<<gnc-numeric> num: 2280000 denom: 100>>)
(#<swig-pointer Account * 84ed020> #<<gnc-monetary> commodity: #<swig-pointer gnc_commodity * 84cf3b8> amount: #<<gnc-numeric> num: 174420 denom: 100>>)
where the first line is the parent account. note that it is the recursive balance (parent and its children), but my understanding is that the call to gnc:account-get-comm-balance... above with the last parameter at #f should *NOT* return the recursive balance. what am I missing.