Compute the commodity scu from the ledger invoice (#300042).

This way the SCU is no longer hard-coded into the business ledger.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14545 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2006-07-20 01:14:55 +00:00
parent 894d2ee6c3
commit c9b30b2cf9

View File

@ -627,6 +627,7 @@ gnc_entry_ledger_compute_value (GncEntryLedger *ledger,
gboolean taxable, taxincluded; gboolean taxable, taxincluded;
GncTaxTable *table; GncTaxTable *table;
GList *taxes = NULL; GList *taxes = NULL;
int denom = 100;
gnc_entry_ledger_get_numeric (ledger, ENTRY_QTY_CELL, &qty); gnc_entry_ledger_get_numeric (ledger, ENTRY_QTY_CELL, &qty);
gnc_entry_ledger_get_numeric (ledger, ENTRY_PRIC_CELL, &price); gnc_entry_ledger_get_numeric (ledger, ENTRY_PRIC_CELL, &price);
@ -670,9 +671,15 @@ gnc_entry_ledger_compute_value (GncEntryLedger *ledger,
table = NULL; 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, gncEntryComputeValue (qty, price, (taxable ? table : NULL), taxincluded,
discount, disc_type, disc_how, discount, disc_type, disc_how, denom,
100, /* XXX -- compute a real denominator */
value, NULL, &taxes); value, NULL, &taxes);
/* return the tax value */ /* return the tax value */