Bug 734183

Mike Evans mikee at saxicola.co.uk
Wed Aug 6 05:25:12 EDT 2014


Hi All

I'm having a little trouble tracking this down, (some of) the code for creating an entry with discount is shown below:

	entry = gncEntryCreate (book);
	gncEntryBeginEdit(entry);
// More code here...
	gnc_exp_parser_parse (discount, &n, NULL);
	gncEntrySetInvDiscount (entry, n);
        gncEntrySetInvDiscountType (entry, text2disc_type (disc_type));
        gncEntrySetInvDiscountHow (entry, text2disc_how (disc_how));
        gncEntryCommitEdit(entry);
	n = gncEntryGetDocDiscountValue (entry, FALSE, TRUE, FALSE);
        DEBUG( "Discount Value: %.2f\n",gnc_numeric_to_double(n));
        gncInvoiceAddEntry (invoice, entry);

Having set the Discount, How and Type, the DEBUG line outputs -  Discount Value: 0.000000 it should be the actual calculated discount.

Why isn't the discount being set. calculated?  Is there a step I've missed? 
 
Looking through gnc_entry_ledger_save_cells(...) in gncEntryLedgerModel.c I can't see anything else that needs to be done to set the required values.

Code is in: src/plugins/bi_import/dialoc-bi-import.c

Mike

-- 
Anti NSA?  Use PGP.
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x00CDB13500D7AB53  


More information about the gnucash-devel mailing list