Found the solution. The following seems to work.

          ;; Add the net income / net loss line.
          (add-subtotal-line my-table 
            (if (gnc-numeric-negative-p
                  (gnc:gnc-monetary-amount
                    (gnc:sum-collector-commodity 
                      net-income report-commodity exchange-fn)))
              (string-append (_ "Net loss") period-for)
              (string-append (_ "Net income") period-for)
            )  
            #f net-income)


Thanks.

From: Charles Day [mailto:ceda...@gmail.com] 
Sent: January-26-09 4:09 AM
To: michael.mc...@sympatico.ca
Subject: Re: Problems testing the sign of a commodity collector.

...

Shouldn't the argument to gnc-numeric-negative-p be a gnc_numeric type
rather than a commodity collector? The commodity collector (net-income) will
be full of amounts in various currencies; it seems like you'd have to sum
them all all up into the reporting currency first before checking the sign.


_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to