[
http://issues.apache.org/jira/browse/OFBIZ-405?page=comments#action_12460311 ]
Si Chen commented on OFBIZ-405:
-------------------------------
This patch looks OK, except for a couple of modifications which we'll make for
you:
1. You should use the pre-defined ZERO instead of your own BigDecimal("0")
2. When using BigDecimal during additions, do not round down to decimals
immediately. Round down to decimals+1 during intermediate looping and then
round down to decimals after you are done. This means that:
invoiceTaxTotal = invoiceTaxTotal.add(
amount.multiply(quantity)).setScale(decimals,rounding);
should be:
invoiceTaxTotal = invoiceTaxTotal.add(
amount.multiply(quantity)).setScale(decimals+1, rounding);
Then you should have a
invoiceTaxTotal = invoiceTaxTotal.setScale(decimals, rounding)
Otherwise, you will have a problem where these two values
1.08423465
1.08358239
would be rounded to 1.08 and 1.08 and added to 1.16 instead of being rounded to
1.084 and 1.083 and added to 1.17.
> Showing invoice total with and without tax
> ------------------------------------------
>
> Key: OFBIZ-405
> URL: http://issues.apache.org/jira/browse/OFBIZ-405
> Project: OFBiz (The Open for Business Project)
> Issue Type: Improvement
> Components: accounting
> Reporter: Eriks Dobelis
> Assigned To: Si Chen
> Priority: Minor
> Attachments: invoicenotax.diff
>
>
> This is one more from the series of making invoice usable for countries using
> VAT. Of course this might be used by others too.
> Attached diff adds a line in the invoice showing total without tax (i.e.
> currently without amount of items of Invoice Sales Tax type) and the
> corresponding function to calculate that.
> From my understanding by using this (together with previous diffs on showing
> Tax ID in the invoice), the invoice becomes usable in EU countries.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira