r14545 - gnucash/trunk - Compute the commodity scu from the ledger invoice (#300042).

Derek Atkins warlord at cvs.gnucash.org
Wed Jul 19 21:15:01 EDT 2006


Author: warlord
Date: 2006-07-19 21:14:55 -0400 (Wed, 19 Jul 2006)
New Revision: 14545
Trac: http://svn.gnucash.org/trac/changeset/14545

Modified:
   gnucash/trunk/
   gnucash/trunk/src/business/business-ledger/gncEntryLedger.c
Log:
Compute the commodity scu from the ledger invoice (#300042).
This way the SCU is no longer hard-coded into the business ledger.



Property changes on: gnucash/trunk
___________________________________________________________________
Name: svk:merge
   - d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:12883
   + d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:12906

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedger.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedger.c	2006-07-19 16:03:05 UTC (rev 14544)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedger.c	2006-07-20 01:14:55 UTC (rev 14545)
@@ -627,6 +627,7 @@
   gboolean taxable, taxincluded;
   GncTaxTable *table;
   GList *taxes = NULL;
+  int denom = 100;
 
   gnc_entry_ledger_get_numeric (ledger, ENTRY_QTY_CELL, &qty);
   gnc_entry_ledger_get_numeric (ledger, ENTRY_PRIC_CELL, &price);
@@ -670,9 +671,15 @@
     table = NULL;
   }
 
+  if (ledger->invoice)
+  {
+    gnc_commodity *currency = gncInvoiceGetCurrency(ledger->invoice);
+    if (currency)
+      denom = gnc_commodity_get_fraction(currency);
+  }
+
   gncEntryComputeValue (qty, price, (taxable ? table : NULL), taxincluded,
-			discount, disc_type, disc_how,
-			100,  /* XXX -- compute a real denominator */
+			discount, disc_type, disc_how, denom,
 			value, NULL, &taxes);
 
   /* return the tax value */



More information about the gnucash-changes mailing list