Pie chart reports

Greg Hewgill greg@hewgill.com
Thu, 21 Jun 2001 08:36:22 -0500


I've just started using gnucash 1.6 (migration from Money 95). I've been
running the reports and have found some odd discrepancies. In particular, in
the expenses piechart (account-piecharts.scm), even expense accounts that have
a negative balance over the requested time interval show up as pie slices.
That's just not right. :)

In particular, I have an expense account where I entered some money that I
loaned to a friend a while ago. As he repaid me over time, I have entered
offsetting transactions so once he's done, the account balance will be zero.
However, if I run a report for just the last couple of months (so my initial
payment to him is not included), I get his repayments to me showing up as
"expenses" in the pie chart.

So, I gave myself a crash course in Scheme in order to read the report code,
and found:

              (set! combined
                  (sort (filter (lambda (pair) (not (= 0.0 (car pair))))
                                (traverse-accounts
                                 1 topl-accounts))
                        (lambda (a b) (> (car a) (car b)))))

Fair enough, that excludes accounts whose balance is zero. I changed the filter
condition to:

                  (sort (filter (lambda (pair) (< 0.0 (car pair)))

However, this still didn't exclude the negative-balance account. That's as far
as I got last night with the analysis of this problem, but I'm guessing that
the gnc:account-get-comm-balance-interval function called from profit-fn is
somehow returning the absolute value of the account balance. Does this sound
plausible?

On a related note, is there a way to force gnucash to reload the scheme code
for a report without exiting gnucash entirely? With a startup time approaching
two minutes, this doesn't lend itself well to a quick debug-test cycle. :)

Greg Hewgill