mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 734183 - Set all of the denominators correctly on the currency values.
This commit is contained in:
parent
56af86c0a2
commit
b465fef9ac
@ -520,7 +520,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
|||||||
GncInvoice *invoice;
|
GncInvoice *invoice;
|
||||||
GncEntry *entry;
|
GncEntry *entry;
|
||||||
gint day, month, year;
|
gint day, month, year;
|
||||||
gnc_numeric n;
|
gnc_numeric value;
|
||||||
GncOwner *owner;
|
GncOwner *owner;
|
||||||
Account *acc;
|
Account *acc;
|
||||||
enum update {YES = GTK_RESPONSE_YES, NO = GTK_RESPONSE_NO} update;
|
enum update {YES = GTK_RESPONSE_YES, NO = GTK_RESPONSE_NO} update;
|
||||||
@ -528,7 +528,9 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
|||||||
Timespec today;
|
Timespec today;
|
||||||
InvoiceWindow *iw;
|
InvoiceWindow *iw;
|
||||||
gchar *new_id = NULL;
|
gchar *new_id = NULL;
|
||||||
|
gint64 denom;
|
||||||
|
gnc_commodity *currency;
|
||||||
|
|
||||||
// these arguments are needed
|
// these arguments are needed
|
||||||
g_return_if_fail (store && book);
|
g_return_if_fail (store && book);
|
||||||
// logic of this function only works for bills or invoices
|
// logic of this function only works for bills or invoices
|
||||||
@ -693,6 +695,9 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
|||||||
|
|
||||||
// add entry to invoice/bill
|
// add entry to invoice/bill
|
||||||
entry = gncEntryCreate (book);
|
entry = gncEntryCreate (book);
|
||||||
|
gncEntryBeginEdit(entry);
|
||||||
|
currency = gncInvoiceGetCurrency(invoice);
|
||||||
|
if (currency) denom = gnc_commodity_get_fraction(currency);
|
||||||
// FIXME: Must check for the return value of qof_scan_date!
|
// FIXME: Must check for the return value of qof_scan_date!
|
||||||
qof_scan_date (date, &day, &month, &year);
|
qof_scan_date (date, &day, &month, &year);
|
||||||
{
|
{
|
||||||
@ -705,42 +710,39 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
|||||||
gncEntrySetDescription (entry, desc);
|
gncEntrySetDescription (entry, desc);
|
||||||
gncEntrySetAction (entry, action);
|
gncEntrySetAction (entry, action);
|
||||||
|
|
||||||
n = gnc_numeric_zero ();
|
gnc_exp_parser_parse (quantity, &value, NULL);
|
||||||
gnc_exp_parser_parse (quantity, &n, NULL);
|
gncEntrySetQuantity (entry, value);
|
||||||
gncEntrySetQuantity (entry, n);
|
|
||||||
acc = gnc_account_lookup_for_register (gnc_get_current_root_account (),
|
acc = gnc_account_lookup_for_register (gnc_get_current_root_account (),
|
||||||
account);
|
account);
|
||||||
|
|
||||||
if (g_ascii_strcasecmp (type, "BILL") == 0)
|
if (g_ascii_strcasecmp (type, "BILL") == 0)
|
||||||
{
|
{
|
||||||
gncEntrySetBillAccount (entry, acc);
|
gncEntrySetBillAccount (entry, acc);
|
||||||
n = gnc_numeric_zero ();
|
gnc_exp_parser_parse (price, &value, NULL);
|
||||||
gnc_exp_parser_parse (price, &n, NULL);
|
value = gnc_numeric_convert (value, denom, GNC_HOW_RND_NEVER);
|
||||||
gncEntrySetBillPrice (entry, n);
|
gncEntrySetBillPrice (entry, value);
|
||||||
gncEntrySetBillTaxable (entry, text2bool (taxable));
|
gncEntrySetBillTaxable (entry, text2bool (taxable));
|
||||||
gncEntrySetBillTaxIncluded (entry, text2bool (taxincluded));
|
gncEntrySetBillTaxIncluded (entry, text2bool (taxincluded));
|
||||||
gncEntrySetBillTaxTable (entry,
|
gncEntrySetBillTaxTable (entry, gncTaxTableLookupByName (book, tax_table));
|
||||||
gncTaxTableLookupByName (book, tax_table));
|
gncEntryCommitEdit(entry);
|
||||||
n = gnc_numeric_zero ();
|
|
||||||
gnc_exp_parser_parse (discount, &n, NULL);
|
|
||||||
gncBillAddEntry (invoice, entry);
|
gncBillAddEntry (invoice, entry);
|
||||||
}
|
}
|
||||||
else if (g_ascii_strcasecmp (type, "INVOICE") == 0)
|
else if (g_ascii_strcasecmp (type, "INVOICE") == 0)
|
||||||
{
|
{
|
||||||
gncEntrySetNotes (entry, notes);
|
gncEntrySetNotes (entry, notes);
|
||||||
gncEntrySetInvAccount (entry, acc);
|
gncEntrySetInvAccount (entry, acc);
|
||||||
n = gnc_numeric_zero ();
|
gnc_exp_parser_parse (price, &value, NULL);
|
||||||
gnc_exp_parser_parse (price, &n, NULL);
|
value = gnc_numeric_convert (value, denom, GNC_HOW_RND_NEVER);
|
||||||
gncEntrySetInvPrice (entry, n);
|
gncEntrySetInvPrice (entry, value);
|
||||||
gncEntrySetInvTaxable (entry, text2bool (taxable));
|
gncEntrySetInvTaxable (entry, text2bool (taxable));
|
||||||
gncEntrySetInvTaxIncluded (entry, text2bool (taxincluded));
|
gncEntrySetInvTaxIncluded (entry, text2bool (taxincluded));
|
||||||
gncEntrySetInvTaxTable (entry,
|
gncEntrySetInvTaxTable (entry, gncTaxTableLookupByName (book, tax_table));
|
||||||
gncTaxTableLookupByName (book, tax_table));
|
gnc_exp_parser_parse (discount, &value, NULL);
|
||||||
n = gnc_numeric_zero ();
|
value = gnc_numeric_convert (value, denom, GNC_HOW_RND_NEVER);
|
||||||
gnc_exp_parser_parse (discount, &n, NULL);
|
gncEntrySetInvDiscount (entry, value);
|
||||||
gncEntrySetInvDiscount (entry, n);
|
|
||||||
gncEntrySetInvDiscountType (entry, text2disc_type (disc_type));
|
gncEntrySetInvDiscountType (entry, text2disc_type (disc_type));
|
||||||
gncEntrySetInvDiscountHow (entry, text2disc_how (disc_how));
|
gncEntrySetInvDiscountHow (entry, text2disc_how (disc_how));
|
||||||
|
gncEntryCommitEdit(entry);
|
||||||
gncInvoiceAddEntry (invoice, entry);
|
gncInvoiceAddEntry (invoice, entry);
|
||||||
}
|
}
|
||||||
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter);
|
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter);
|
||||||
|
Loading…
Reference in New Issue
Block a user