You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Eriks Dobelis (JIRA)" <ji...@apache.org> on 2006/08/17 22:07:13 UTC

[jira] Created: (OFBIZ-164) rateProductTaxCalcForDisplay returns incorrect priceWithTax

rateProductTaxCalcForDisplay returns incorrect priceWithTax
-----------------------------------------------------------

                 Key: OFBIZ-164
                 URL: http://issues.apache.org/jira/browse/OFBIZ-164
             Project: OFBiz (The Open for Business Project)
          Issue Type: Bug
          Components: accounting
            Reporter: Eriks Dobelis


priceWithTax from rateProductTaxCalcForDisplay is returned incorrectly as the total tax. This is a simple diff that solves it.

Index: applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
===================================================================
--- applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (revision 431541)
+++ applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (working copy)
@@ -108,7 +108,7 @@
                     taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage"));
                     BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount");
                     taxTotal = taxTotal.add(adjAmount);
-                    priceWithTax = priceWithTax.add(adjAmount);
+                    priceWithTax = priceWithTax.add(adjAmount.divide(quantity));
                     Debug.logInfo("For productId [" + productId + "] added [" + adjAmount + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module);
                 }
             }


-- 
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

        

[jira] Commented: (OFBIZ-164) rateProductTaxCalcForDisplay returns incorrect priceWithTax

Posted by "Eriks Dobelis (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-164?page=comments#action_12428929 ] 
            
Eriks Dobelis commented on OFBIZ-164:
-------------------------------------

This is version using arithmetic.properties. I looked through the code and found almost no examples of its usage.

> rateProductTaxCalcForDisplay returns incorrect priceWithTax
> -----------------------------------------------------------
>
>                 Key: OFBIZ-164
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-164
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Bug
>          Components: accounting
>            Reporter: Eriks Dobelis
>         Attachments: tax.diff
>
>
> priceWithTax from rateProductTaxCalcForDisplay is returned incorrectly as the total tax. This is a simple diff that solves it.
> Index: applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
> ===================================================================
> --- applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (revision 431541)
> +++ applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (working copy)
> @@ -108,7 +108,7 @@
>                      taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage"));
>                      BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount");
>                      taxTotal = taxTotal.add(adjAmount);
> -                    priceWithTax = priceWithTax.add(adjAmount);
> +                    priceWithTax = priceWithTax.add(adjAmount.divide(quantity));
>                      Debug.logInfo("For productId [" + productId + "] added [" + adjAmount + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module);
>                  }
>              }

-- 
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

        

[jira] Commented: (OFBIZ-164) rateProductTaxCalcForDisplay returns incorrect priceWithTax

Posted by "Eriks Dobelis (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-164?page=comments#action_12429750 ] 
            
Eriks Dobelis commented on OFBIZ-164:
-------------------------------------

Could somebody, please, review and comment the attached diff file? And if it is fine commit it into SVN.

> rateProductTaxCalcForDisplay returns incorrect priceWithTax
> -----------------------------------------------------------
>
>                 Key: OFBIZ-164
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-164
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Bug
>          Components: accounting
>            Reporter: Eriks Dobelis
>         Attachments: tax.diff
>
>
> priceWithTax from rateProductTaxCalcForDisplay is returned incorrectly as the total tax. This is a simple diff that solves it.
> Index: applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
> ===================================================================
> --- applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (revision 431541)
> +++ applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (working copy)
> @@ -108,7 +108,7 @@
>                      taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage"));
>                      BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount");
>                      taxTotal = taxTotal.add(adjAmount);
> -                    priceWithTax = priceWithTax.add(adjAmount);
> +                    priceWithTax = priceWithTax.add(adjAmount.divide(quantity));
>                      Debug.logInfo("For productId [" + productId + "] added [" + adjAmount + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module);
>                  }
>              }

-- 
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

        

[jira] Commented: (OFBIZ-164) rateProductTaxCalcForDisplay returns incorrect priceWithTax

Posted by "Eriks Dobelis (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-164?page=comments#action_12428823 ] 
            
Eriks Dobelis commented on OFBIZ-164:
-------------------------------------

This is better as it performs necessary rounding.

Index: applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
===================================================================
--- applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (revision 431541)
+++ applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (working copy)
@@ -108,7 +108,7 @@
                     taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage"));
                     BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount");
                     taxTotal = taxTotal.add(adjAmount);
-                    priceWithTax = priceWithTax.add(adjAmount);
+                    priceWithTax = priceWithTax.add(adjAmount.divide(quantity,3,BigDecimal.ROUND_CEILING));
                     Debug.logInfo("For productId [" + productId + "] added [" + adjAmount + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module);
                 }
             }


> rateProductTaxCalcForDisplay returns incorrect priceWithTax
> -----------------------------------------------------------
>
>                 Key: OFBIZ-164
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-164
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Bug
>          Components: accounting
>            Reporter: Eriks Dobelis
>
> priceWithTax from rateProductTaxCalcForDisplay is returned incorrectly as the total tax. This is a simple diff that solves it.
> Index: applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
> ===================================================================
> --- applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (revision 431541)
> +++ applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (working copy)
> @@ -108,7 +108,7 @@
>                      taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage"));
>                      BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount");
>                      taxTotal = taxTotal.add(adjAmount);
> -                    priceWithTax = priceWithTax.add(adjAmount);
> +                    priceWithTax = priceWithTax.add(adjAmount.divide(quantity));
>                      Debug.logInfo("For productId [" + productId + "] added [" + adjAmount + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module);
>                  }
>              }

-- 
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

        

[jira] Assigned: (OFBIZ-164) rateProductTaxCalcForDisplay returns incorrect priceWithTax

Posted by "David E. Jones (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/OFBIZ-164?page=all ]

David E. Jones reassigned OFBIZ-164:
------------------------------------

    Assignee: David E. Jones

> rateProductTaxCalcForDisplay returns incorrect priceWithTax
> -----------------------------------------------------------
>
>                 Key: OFBIZ-164
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-164
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Bug
>          Components: accounting
>            Reporter: Eriks Dobelis
>         Assigned To: David E. Jones
>         Attachments: tax.diff
>
>
> priceWithTax from rateProductTaxCalcForDisplay is returned incorrectly as the total tax. This is a simple diff that solves it.
> Index: applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
> ===================================================================
> --- applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (revision 431541)
> +++ applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (working copy)
> @@ -108,7 +108,7 @@
>                      taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage"));
>                      BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount");
>                      taxTotal = taxTotal.add(adjAmount);
> -                    priceWithTax = priceWithTax.add(adjAmount);
> +                    priceWithTax = priceWithTax.add(adjAmount.divide(quantity));
>                      Debug.logInfo("For productId [" + productId + "] added [" + adjAmount + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module);
>                  }
>              }

-- 
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

        

[jira] Commented: (OFBIZ-164) rateProductTaxCalcForDisplay returns incorrect priceWithTax

Posted by "Si Chen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OFBIZ-164?page=comments#action_12428824 ] 
            
Si Chen commented on OFBIZ-164:
-------------------------------

Erik,

We have an arithmetic.properties file in applications/accounting/config/

I think it is better to use the rounding properties in that file rather than directly inline like this.

I know some existing code may not be doing that, but it's nice to start doing things the right way whenever possible.

Also, would you mind sending in patch files rather than just pasting in the comments section?



> rateProductTaxCalcForDisplay returns incorrect priceWithTax
> -----------------------------------------------------------
>
>                 Key: OFBIZ-164
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-164
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Bug
>          Components: accounting
>            Reporter: Eriks Dobelis
>
> priceWithTax from rateProductTaxCalcForDisplay is returned incorrectly as the total tax. This is a simple diff that solves it.
> Index: applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
> ===================================================================
> --- applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (revision 431541)
> +++ applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (working copy)
> @@ -108,7 +108,7 @@
>                      taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage"));
>                      BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount");
>                      taxTotal = taxTotal.add(adjAmount);
> -                    priceWithTax = priceWithTax.add(adjAmount);
> +                    priceWithTax = priceWithTax.add(adjAmount.divide(quantity));
>                      Debug.logInfo("For productId [" + productId + "] added [" + adjAmount + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module);
>                  }
>              }

-- 
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

        

[jira] Updated: (OFBIZ-164) rateProductTaxCalcForDisplay returns incorrect priceWithTax

Posted by "Eriks Dobelis (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/OFBIZ-164?page=all ]

Eriks Dobelis updated OFBIZ-164:
--------------------------------

    Attachment: tax.diff

> rateProductTaxCalcForDisplay returns incorrect priceWithTax
> -----------------------------------------------------------
>
>                 Key: OFBIZ-164
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-164
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Bug
>          Components: accounting
>            Reporter: Eriks Dobelis
>         Attachments: tax.diff
>
>
> priceWithTax from rateProductTaxCalcForDisplay is returned incorrectly as the total tax. This is a simple diff that solves it.
> Index: applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
> ===================================================================
> --- applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (revision 431541)
> +++ applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (working copy)
> @@ -108,7 +108,7 @@
>                      taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage"));
>                      BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount");
>                      taxTotal = taxTotal.add(adjAmount);
> -                    priceWithTax = priceWithTax.add(adjAmount);
> +                    priceWithTax = priceWithTax.add(adjAmount.divide(quantity));
>                      Debug.logInfo("For productId [" + productId + "] added [" + adjAmount + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module);
>                  }
>              }

-- 
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

        

[jira] Closed: (OFBIZ-164) rateProductTaxCalcForDisplay returns incorrect priceWithTax

Posted by "David E. Jones (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/OFBIZ-164?page=all ]

David E. Jones closed OFBIZ-164.
--------------------------------

    Fix Version/s: SVN trunk
       Resolution: Fixed

Thanks for your work on this Eriks. The changes for OFBIZ-113 and OFBIZ-164 plus a couple of small changes are in SVN rev 437453. You can see the commit log for details.

> rateProductTaxCalcForDisplay returns incorrect priceWithTax
> -----------------------------------------------------------
>
>                 Key: OFBIZ-164
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-164
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Bug
>          Components: accounting
>            Reporter: Eriks Dobelis
>         Assigned To: David E. Jones
>             Fix For: SVN trunk
>
>         Attachments: tax.diff
>
>
> priceWithTax from rateProductTaxCalcForDisplay is returned incorrectly as the total tax. This is a simple diff that solves it.
> Index: applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
> ===================================================================
> --- applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (revision 431541)
> +++ applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java      (working copy)
> @@ -108,7 +108,7 @@
>                      taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage"));
>                      BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount");
>                      taxTotal = taxTotal.add(adjAmount);
> -                    priceWithTax = priceWithTax.add(adjAmount);
> +                    priceWithTax = priceWithTax.add(adjAmount.divide(quantity));
>                      Debug.logInfo("For productId [" + productId + "] added [" + adjAmount + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module);
>                  }
>              }

-- 
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