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.
-
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).
-
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).
-
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.
-
Apart from withholding Taxes, sometimes University have to deduct other amounts against Invoices i.e.
- Security
- Percentage of Security
- Penalty
- Percentage of Penalty
- Other Charges
- 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:
- WH_GST_BaseAmt (GST Base Amount)
- Field Group: Deduction
- Read Only = Checked
- X Position = 1
- Colspan = 1
- WH_GST_IT_Base (Base Amount of Income Tax on amount having GST)
- Field Group: Deduction
- X Position = 1
- Colspan = 1
- Technical –> Callout: org.compiere.model.CalloutInvoice.calc_GST_IT
- WH_PST_BaseAmt (Base Amount of PST)
- Field Group: Deduction
- Read Only = Checked
- X Position = 1
- Colspan = 1
- WH_IncomeTax_BaseAmt (Base Amount of Income Tax on amont having PST)
- Field Group: Deduction
- X Position = 1
- Colspan = 1
- Technical –> Callout: org.compiere.model.CalloutInvoice.customWithholding
- WH_Security_BaseAmt (Security Base Amount)
- Field Group: Deduction
- X Position = 1
- Colspan = 1
- WH_Penalty_BaseAmt (Base Amount of Penalty)
- Field Group: Deduction
- X Position = 1
- Colspan = 1
- WH_Other_BaseAmt (Base Amount of Other Charges)
- Field Group: Deduction
- X Position = 1
- Colspan = 1
Percentages
- WH_GST_Percent
- Field Group: Deduction
- ReadOnly = Checked
- X Position = 3
- Colspan = 1
- Default Logic = 20
- Same Line = Checked
- WH_GST_IT_Percent
- Field Group: Deduction
- ReadOnly = Checked
- X Position = 3
- Colspan = 1
- Default Logic = 4.5
- Same Line = Checked
- WH_PST_Percent
- Field Group: Deduction
- ReadOnly = Checked
- X Position = 3
- Default Logic = 16
- Colspan = 1
- Same Line = Checked
- WH_IncomeTax_Percent
- Field Group: Deduction
- ReadOnly = Checked
- X Position = 3
- Colspan = 1
- Same Line = Checked
- WH_Security_Percent
- Field Group: Deduction
- X Position = 3
- Colspan = 1
- Same Line = Checked
- Technical –> Callout: org.compiere.model.CalloutInvoice.security
- WH_Penalty_Percent
- Field Group: Deduction
- X Position = 3
- Colspan = 1
- Same Line = Checked
- Technical –> Callout: org.compiere.model.CalloutInvoice.penalty
- WH_Other_Percent
- Field Group: Deduction
- X Position = 3
- Colspan = 1
- Same Line = Checked
- Technical –> Callout: org.compiere.model.CalloutInvoice.other_charge
Total Withheld/Deducted Amount
- WH_GST
- Field Group: Deduction
- ReadOnly = Checked
- X Position = 5
- Colspan = 1
- Same Line = Checked
- WH_GST_IT
- Field Group: Deduction
- ReadOnly = Checked
- X Position = 5
- Colspan = 1
- Same Line = Checked
- WH_PST
- Field Group: Deduction
- ReadOnly = Checked
- X Position = 5
- Colspan = 1
- Same Line = Checked
- WH_IncomeTax
- Field Group: Deduction
- ReadOnly = Checked
- X Position = 5
- Colspan = 1
- Same Line = Checked
- WH_Security
- Field Group: Deduction
- ReadOnly = Checked
- X Position = 5
- Colspan = 1
- Same Line = Checked
- Penalty
- Field Group: Deduction
- ReadOnly = Checked
- X Position = 5
- Colspan = 1
- Same Line = Checked
- Other_Charge
- Field Group: Deduction
- ReadOnly = Checked
- X Position = 5
- Colspan = 1
- Same Line = Checked
To Calculate Deduction:
- TotalDeduction
- Field Group: Status
- ReadOnly = Checked
- Colspan = 2
- X Position = 4
Create these Taxes and replace IDs in Code, respectively:
- GST –> C_Tax_ID=1000009
- PST Filer –> C_Tax_ID=1000010
- PST Non-Filer –> C_Tax_ID=1000014
- GST/PST Filer –> C_Tax_ID=1000015
- GST/PST Non-Filer –> C_Tax_ID=1000016
Read Only Logics:
- Price: @C_Tax_ID@=1000015| @C_Tax_ID@=1000016
- WH_GST_IT_Base: @C_Tax_ID@!1000015 & @C_Tax_ID@!1000016 | @WH_GST_IT_Base@>0
- WH_IncomeTax_BaseAmt: @C_Tax_ID@!1000015 & @C_Tax_ID@!1000016 | @WH_GST_IT_Base@=0 | @WH_IncomeTax_BaseAmt@>0
- WH_Security_BaseAmt: @WH_Security_BaseAmt@>0 | @WH_Security_Percent@>0 | @WH_Security@>0
- WH_Security_Percent: @WH_Security_Percent@>0 | @WH_Security@>0
- WH_Penalty_BaseAmt: @WH_Penalty_BaseAmt@>0 | @WH_Penalty_Percent@>0 | @Penalty@>0
- WH_Penalty_Percent: @WH_Penalty_Percent@>0 | @Penalty@>0
- WH_Other_BaseAmt: @WH_Other_BaseAmt@>0 | @WH_Other_Percent@>0 | @Other_Charge@>0
- 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.