mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
A more detailed revision of gncEntry and gncInvoice related rounding
First change is to ensure gncEntry rounding is consistent. Internally calculated values in the entry are never rounded. Consumers of gncEntry's calculated values can request them either rounded or not. Next use a pragmatical approach for calculating values on invoices based on the entry values: do the rounding such that we never create an unbalanced transaction while posting That means - round each entry's net value before summing them in net total - accumulate all tax totals on invoice level per tax account before rounding and round before before summing them in a global tax total Hopefully this will catch a few more rounding issues in this area. A complete solution can only offered if we allow users to manually correct tax entries. This requires changes to user interface and data format so that's not going to happen in gnucash 3.x.
This commit is contained in:
@@ -936,7 +936,7 @@ GList *gncAccountValueAdd (GList *list, Account *acc, gnc_numeric value)
|
||||
if (res->account == acc)
|
||||
{
|
||||
res->value = gnc_numeric_add (res->value, value, GNC_DENOM_AUTO,
|
||||
GNC_HOW_DENOM_LCD);
|
||||
GNC_HOW_DENOM_REDUCE | GNC_HOW_RND_ROUND_HALF_UP);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -970,7 +970,7 @@ gnc_numeric gncAccountValueTotal (GList *list)
|
||||
for ( ; list ; list = list->next)
|
||||
{
|
||||
GncAccountValue *val = list->data;
|
||||
total = gnc_numeric_add (total, val->value, GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD);
|
||||
total = gnc_numeric_add (total, val->value, GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE | GNC_HOW_RND_ROUND_HALF_UP);
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user