psdi.app.common

Class Taxes

  • java.lang.Object
    • psdi.app.common.Taxes


  • public class Taxes
    extends java.lang.Object
    This common class provide methods for tax calculations
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      int NUMBEROFTAXCODES
      constant to indicate number of taxcodes, currently, there are 5.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Taxes(MboRemote mbo) 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      double calculateTax(double linecost, java.lang.String taxCode, int whichTax)
      This method calculates and returns the tax amount for a taxcode.
      int findTypeCode(java.lang.String thisAttrName)
      method to parse a string that may look like, ex, "tax1code","tax2code", thru "tax5code" return an integer to incidicate the typecode of this tax?code.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NUMBEROFTAXCODES

        public int NUMBEROFTAXCODES
        constant to indicate number of taxcodes, currently, there are 5.
    • Constructor Detail

    • Method Detail

      • calculateTax

        public double calculateTax(double linecost,
                                   java.lang.String taxCode,
                                   int whichTax)
                            throws MXException,
                                   java.rmi.RemoteException
        This method calculates and returns the tax amount for a taxcode. This is a common calulation for many objects such as POLINE, PRLINE, QUOTATIONLINE, MATRECTRANS, and SERVRECTRANS. This method assumes the knowledge of the database column names as "tax1","tax2","tax3","tax4","tax5" of each mbo. Another option: Caller can pass an array of 5 tax values instead of passing the mbo? linecost: the current line cost taxCode: the current taxCode value. There are five taxcodes. tax1code,tax2code,tax3code,tax4code,tax5code. whichTax: integer: valid values are 1 - 5. Examples: 1 corresponds to tax1code, 2 corresponds to tax2code, etc. 1 implies a typecode of '1' - table TAXTYPE, 2 implies a typecode of '2' - table TAXTYPE, etc. For Example, if you are trying to calculate TAX2, whichTax will be 2. Rules: 1. Get Tax Rate for current tax code: FinancialService has a method to return the tax rate for current tax code/type code. 2. Calculate the new Line Cost: Tax 1: the current linecost. Tax 2: the current linecost + tax 1 if TAXTYPE.INCLUDETAX1 = 'Y' where typecode='2' Tax 3: the current linecost + tax 2 if TAXTYPE.INCLUDETAX2 = 'Y' where TAXTYPE.typecode='3' + tax 1 if TAXTYPE.INCLUDETAX1 = 'Y' where TAXTYPE.typecode='3' Tax 4: the current linecost + tax 3 if TAXTYPE.INCLUDETAX3 = 'Y' where TAXTYPE.typecode='4' + tax 2 if TAXTYPE.INCLUDETAX2 = 'Y' where TAXTYPE.typecode='4' + tax 1 if TAXTYPE.INCLUDETAX1 = 'Y' where TAXTYPE.typecode='4' Tax 5: the current linecost + tax 4 if TAXTYPE.INCLUDETAX4 = 'Y' where TAXTYPE.typecode='5' + tax 3 if TAXTYPE.INCLUDETAX3 = 'Y' where TAXTYPE.typecode='5' + tax 2 if TAXTYPE.INCLUDETAX2 = 'Y' where TAXTYPE.typecode='5' + tax 1 if TAXTYPE.INCLUDETAX1 = 'Y' where TAXTYPE.typecode='5' 3. Return (the calculated line cost) * (the current tax rate/100)
        Parameters:
        linecost -
        taxCode -
        whichTax -
        Throws:
        MXException
        java.rmi.RemoteException
      • findTypeCode

        public int findTypeCode(java.lang.String thisAttrName)
                         throws MXException,
                                java.rmi.RemoteException
        method to parse a string that may look like, ex, "tax1code","tax2code", thru "tax5code" return an integer to incidicate the typecode of this tax?code.
        Throws:
        MXException
        java.rmi.RemoteException