com.konakart.util
Class TaxUtils

java.lang.Object
  extended by com.konakart.util.TaxUtils

public class TaxUtils
extends java.lang.Object

Utility methods for calculating tax


Field Summary
protected static org.apache.commons.logging.Log log
          the log
static int TAX_ON_TOTAL
          Quantity rule
static int TAX_PER_ITEM
          Quantity rule
 
Constructor Summary
TaxUtils()
           
 
Method Summary
static java.math.BigDecimal getTaxAmount(java.math.BigDecimal taxRate, java.math.BigDecimal cost, int quantity, int scale, int rule)
          Calculates the tax for one or more items
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
the log


TAX_ON_TOTAL

public static final int TAX_ON_TOTAL
Quantity rule

See Also:
Constant Field Values

TAX_PER_ITEM

public static final int TAX_PER_ITEM
Quantity rule

See Also:
Constant Field Values
Constructor Detail

TaxUtils

public TaxUtils()
Method Detail

getTaxAmount

public static java.math.BigDecimal getTaxAmount(java.math.BigDecimal taxRate,
                                                java.math.BigDecimal cost,
                                                int quantity,
                                                int scale,
                                                int rule)
Calculates the tax for one or more items

Parameters:
taxRate - tax rate as a percentage
cost - cost of a single item
quantity - Number of items
scale - This is the scale used for the precision of the calculations. It is contained in the ADMIN_CURRENCY_DECIMAL_PLACES configuration variable.
rule - The rule to be used which should be either TAX_PER_ITEM or TAX_ON_TOTAL.
    • TaxUtils.TAX_PER_ITEM : The tax is calculated for a single item, to the number of decimal places defined by scale. Then this value is multiplied by the quantity.
      TaxUtils.TAX_ON_TOTAL : The tax is calculated for the total amount (single item cost x quantity).
  • Returns:
    Returns the tax amount


    Copyright © 2011 DS Data Systems UK Ltd.