Data type for commodity-value needed

Christian Stimming stimming@uclink.berkeley.edu
Wed, 24 Jan 2001 14:12:30 -0800


-----BEGIN PGP SIGNED MESSAGE-----

Hi Bill,

While I was writing the report code for displaying the commodity (aka 
currency) with the accounts balance, I realized that maybe we need a new 
data type to represent that: A type which represents a gnc:numeric value 
and its corresponding gnc:commodity.

If you calculate the balance of a whole tree of accounts (which might have 
heaps of different commodities), you end up with a list of such 
commodity-value pairs. This is done with a commodity-collector (formerly 
known as currency-collector, patch was posted two hours ago). 

In the account summary only one number per top-level account is displayed, 
so I pick the commodity-value whose commodity matches the one of the 
top-level account. Now the big question comes: How do I get HTML code from 
here on? The best solution would be to just plug the commodity-value 
directly into the html generation code. But this requires the 
commodity-value pairs to be of some special datatype so that they can be 
recognized. Do you think we should create such a type? If yes, where?

Right now the conversion is done with a wrapper to the xaccPrintAmount 
function. This returns a string which is then passed to the html 
generation code, but I agree that this is precisely the kind of ad-hoc 
formatting that we want to get rid of.

Christian

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBOm9TTmXAi+BfhivFAQFe3wQAoPds3DJy69gq7/gN4WpqfQwmhVUxKYJL
hlWaR9Saeyc5Kc+Y0L7DEfkyOvB0LuFEI29zM+pNoK+uppAfW5W6Qk4LyXFnfSA0
AEkZHX9JhPFaJ/m4gatR830xw52N0RSjjBdxTUNcI5SfIQq+fR9uYcz6VBFpghYD
cFI3fj5LvSA=
=6e/c
-----END PGP SIGNATURE-----