Note:
This article significantly target scenarios of Islamia University of Bahawalpur. 
However, reader can use it to implement his/her own ideas. I'm writing it so that any developer from IUB
can make any technical ammendents.
There is another announcement that you may not like:
This Call out or calculator has nothing to do with the accounting of iDempiere but I'm using Jasper Reports
to manage deductions per Invoice Line.

Scenario:

There are 3 different types of Account Payable invoices that University deals with.

  1. An invoice having 17% GST Tax of Total Amount. Univeristy, being a Withholding Agent, will withhold 20% of 17% GST and 4.5% of Total Amount as Income Tax (Filer/Non-Filer).
  2. An invoice having 16% PST of Total Amount. Univeristy, being a Withholding Agent, will withhold 16% PST of total amount and 10% Income Tax (if the vendor is a Filer) or 20% Income Tax (if the vendor is Non-Filer).
  3. An invoice having 17% GST and 16%PST both but the Base Amount for both the taxes is different. It means, GST will be applied on the total amount of Goods/Items and PST will be applied on Total Amount of Services rendered. Therefore, Income Tax will also be applied accordingly. 4.5% Income Tax (Filer/Non-Filer) on the Total Amount of Goods/Items and 10% or 20% of Income Tax on Total Amount of Services rendered, where the vendor is whether a filer or non-filer, respectively.
  4. Apart from withholding Taxes, sometimes University have to deduct other amounts against Invoices i.e.
    1. Security
    2. Percentage of Security
    3. Penalty
    4. Percentage of Penalty
    5. Other Charges
    6. Percentage of Other Charges

How I created Withholding Calculator for IUB within iDempiere:

I have used Invoice Lines Window available in Invoice (Vendor) Window to calculate deductions per invoice. First I created following fileds into the window, with Field Group Deduction.
Base Tax Amount:
  1. WH_GST_BaseAmt (GST Base Amount)
    1. Field Group: Deduction
    2. Read Only = Checked
    3. X Position = 1
    4. Colspan = 1
  2. WH_GST_IT_Base (Base Amount of Income Tax on amount having GST)
    1. Field Group: Deduction
    2. X Position = 1
    3. Colspan = 1
    4. Technical –> Callout: org.compiere.model.CalloutInvoice.calc_GST_IT
  3. WH_PST_BaseAmt (Base Amount of PST)
    1. Field Group: Deduction
    2. Read Only = Checked
    3. X Position = 1
    4. Colspan = 1
  4. WH_IncomeTax_BaseAmt (Base Amount of Income Tax on amont having PST)
    1. Field Group: Deduction
    2. X Position = 1
    3. Colspan = 1
    4. Technical –> Callout: org.compiere.model.CalloutInvoice.customWithholding
  5. WH_Security_BaseAmt (Security Base Amount)
    1. Field Group: Deduction
    2. X Position = 1
    3. Colspan = 1
  6. WH_Penalty_BaseAmt (Base Amount of Penalty)
    1. Field Group: Deduction
    2. X Position = 1
    3. Colspan = 1
  7. WH_Other_BaseAmt (Base Amount of Other Charges)
    1. Field Group: Deduction
    2. X Position = 1
    3. Colspan = 1
Percentages
  1. WH_GST_Percent
    1. Field Group: Deduction
    2. ReadOnly = Checked
    3. X Position = 3
    4. Colspan = 1
    5. Default Logic = 20
    6. Same Line = Checked
  2. WH_GST_IT_Percent
    1. Field Group: Deduction
    2. ReadOnly = Checked
    3. X Position = 3
    4. Colspan = 1
    5. Default Logic = 4.5
    6. Same Line = Checked
  3. WH_PST_Percent
    1. Field Group: Deduction
    2. ReadOnly = Checked
    3. X Position = 3
    4. Default Logic = 16
    5. Colspan = 1
    6. Same Line = Checked
  4. WH_IncomeTax_Percent
    1. Field Group: Deduction
    2. ReadOnly = Checked
    3. X Position = 3
    4. Colspan = 1
    5. Same Line = Checked
  5. WH_Security_Percent
    1. Field Group: Deduction
    2. X Position = 3
    3. Colspan = 1
    4. Same Line = Checked
    5. Technical –> Callout: org.compiere.model.CalloutInvoice.security
  6. WH_Penalty_Percent
    1. Field Group: Deduction
    2. X Position = 3
    3. Colspan = 1
    4. Same Line = Checked
    5. Technical –> Callout: org.compiere.model.CalloutInvoice.penalty
  7. WH_Other_Percent
    1. Field Group: Deduction
    2. X Position = 3
    3. Colspan = 1
    4. Same Line = Checked
    5. Technical –> Callout: org.compiere.model.CalloutInvoice.other_charge
Total Withheld/Deducted Amount
  1. WH_GST
    1. Field Group: Deduction
    2. ReadOnly = Checked
    3. X Position = 5
    4. Colspan = 1
    5. Same Line = Checked
  2. WH_GST_IT
    1. Field Group: Deduction
    2. ReadOnly = Checked
    3. X Position = 5
    4. Colspan = 1
    5. Same Line = Checked
  3. WH_PST
    1. Field Group: Deduction
    2. ReadOnly = Checked
    3. X Position = 5
    4. Colspan = 1
    5. Same Line = Checked
  4. WH_IncomeTax
    1. Field Group: Deduction
    2. ReadOnly = Checked
    3. X Position = 5
    4. Colspan = 1
    5. Same Line = Checked
  5. WH_Security
    1. Field Group: Deduction
    2. ReadOnly = Checked
    3. X Position = 5
    4. Colspan = 1
    5. Same Line = Checked
  6. Penalty
    1. Field Group: Deduction
    2. ReadOnly = Checked
    3. X Position = 5
    4. Colspan = 1
    5. Same Line = Checked
  7. Other_Charge
    1. Field Group: Deduction
    2. ReadOnly = Checked
    3. X Position = 5
    4. Colspan = 1
    5. Same Line = Checked
To Calculate Deduction:
  1. TotalDeduction
    1. Field Group: Status
    2. ReadOnly = Checked
    3. Colspan = 2
    4. X Position = 4
Create these Taxes and replace IDs in Code, respectively:
  1. GST –> C_Tax_ID=1000009
  2. PST Filer –> C_Tax_ID=1000010
  3. PST Non-Filer –> C_Tax_ID=1000014
  4. GST/PST Filer –> C_Tax_ID=1000015
  5. GST/PST Non-Filer –> C_Tax_ID=1000016
Read Only Logics:
  1. Price: @C_Tax_ID@=1000015| @C_Tax_ID@=1000016
  2. WH_GST_IT_Base: @C_Tax_ID@!1000015 & @C_Tax_ID@!1000016 | @WH_GST_IT_Base@>0
  3. WH_IncomeTax_BaseAmt: @C_Tax_ID@!1000015 & @C_Tax_ID@!1000016 | @WH_GST_IT_Base@=0 | @WH_IncomeTax_BaseAmt@>0
  4. WH_Security_BaseAmt: @WH_Security_BaseAmt@>0 | @WH_Security_Percent@>0 | @WH_Security@>0
  5. WH_Security_Percent: @WH_Security_Percent@>0 | @WH_Security@>0
  6. WH_Penalty_BaseAmt: @WH_Penalty_BaseAmt@>0 | @WH_Penalty_Percent@>0 | @Penalty@>0
  7. WH_Penalty_Percent: @WH_Penalty_Percent@>0 | @Penalty@>0
  8. WH_Other_BaseAmt:  @WH_Other_BaseAmt@>0 | @WH_Other_Percent@>0 | @Other_Charge@>0
  9. WH_Other_Percent:  @WH_Other_Percent@>0 | @Other_Charge@>0

Now create these callouts in CalloutInvoice.java:

Note: Read the comments in the code, carefully. They’ll guide you, where to place the code.

 

Your Withholding Calculator will be ready to be used.

Tags:

Leave a Reply