Problems testing the sign of a commodity collector.

Michael McKay michael.mckay at sympatico.ca
Mon Jan 26 09:31:24 EST 2009


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:cedayiv at gmail.com] 
Sent: January-26-09 4:09 AM
To: michael.mckay at 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.




More information about the gnucash-devel mailing list