r15842 - gnucash/trunk/src/gnome - Bug#348364: (Emulating price-cell, ) we need to ensure the denominator of the amount is in the SCU of the account's commodity (so gnc-ui-util.c:is_decimal_fraction() on the remainder denom for fractional values will be a "decimal").

Josh Sled jsled at cvs.gnucash.org
Fri Apr 6 16:00:05 EDT 2007


Author: jsled
Date: 2007-04-06 16:00:04 -0400 (Fri, 06 Apr 2007)
New Revision: 15842
Trac: http://svn.gnucash.org/trac/changeset/15842

Modified:
   gnucash/trunk/src/gnome/druid-hierarchy.c
Log:
Bug#348364: (Emulating price-cell,) we need to ensure the denominator of the amount is in the SCU of the account's commodity (so gnc-ui-util.c:is_decimal_fraction() on the remainder denom for fractional values will be a "decimal").


Modified: gnucash/trunk/src/gnome/druid-hierarchy.c
===================================================================
--- gnucash/trunk/src/gnome/druid-hierarchy.c	2007-04-06 17:24:11 UTC (rev 15841)
+++ gnucash/trunk/src/gnome/druid-hierarchy.c	2007-04-06 20:00:04 UTC (rev 15842)
@@ -753,6 +753,15 @@
 	  amount = gnc_numeric_zero();
 	  g_object_set (G_OBJECT(cell), "text", "", NULL);
 	}
+    /* Bug#348364: Emulating price-cell, we need to ensure the denominator of
+     * the amount is in the SCU of the account's commodity (so
+     * gnc-ui-util.c:is_decimal_fraction() on the remainder denom for
+     * fractional values will be a "decimal").
+     */
+    {
+        int account_cmdty_fraction = xaccAccountGetCommoditySCU(account);
+        amount = gnc_numeric_convert(amount, account_cmdty_fraction, GNC_RND_ROUND);
+    }
 	set_final_balance (data->balance_hash, account, amount);
 	qof_event_gen ((QofEntity*)account, QOF_EVENT_MODIFY, NULL);
 }



More information about the gnucash-changes mailing list