LCO Withholding - Foreign Currency

196 views
Skip to first unread message

Muhammad Rizwan Anwar

unread,
Nov 25, 2015, 8:54:39 AM11/25/15
to iDempiere

Dear Community

 

I am using LCO Withholding in iDempiere 2.1 (Daily). My WithHoling Calc setting set to "is calc on payment". But when I receive payment against invoice that use foreign currency(Euro), system does not convert with holding amount to accounting schema's currency(USD).

 

My test case is as follow:

·         Accounting Schema Currency is USD

·         Currency Used for Transaction is Euro

·         Rate is 1.249 (Euro to USD)

 

 

Post Invoice (Customer): Currency is Euro, Grand Total:100, Withholding Amount = 10 (WHT rate is 10%)

Posting of invoice is and it is OK:

Trade Revenue (credited)

 

124.90

Accounts Receivable (debited)

124.90

 

 

 

 

Create payment 90 Euro, allocate against above invoice WHT Amount is 10

Posting of payment is as follow and it’s also OK:

Checking In-Transfer (debited)

112.41

 

Checking Unallocated Receipts (credited)

 

112.41

 

 

 

Posting of allocation is as follow and it is Not OK: 

Checking Unallocated Receipts (debited)

112.41

 

Accounts Receivable – Trade (credited)

 

124.90

Tax due

10.00

 

 

As you noticed Tax due amount 10.00 is wrong it should be 12.49

 

What is wrong here? Please guide me

 

Thank you

 

Rizwan Anwar

Eduardo Gil

unread,
Nov 25, 2015, 5:32:16 PM11/25/15
to iDempiere
Hi rizwan.

Some time ago i had the same problem and my solution (is not the best by the way) was edit the query in file LCO_ValidatorWH and modifying the method accountingForInvoiceWithholdingOnPayment to force the convertion to venezuelan currency 


			String sql = 
					  "SELECT i.C_Tax_ID,NVL(SUM(i.TaxBaseAmt),0) AS TaxBaseAmt, NVL(SUM(i.TaxAmt),0) AS TaxAmt, " +
					  "COALESCE(SUM( currencyconvert(i.TaxBaseAmt,ci.c_currency_id, 205, " +
					  "i.dateacct, ci.c_conversiontype_id, i.ad_client_id, i.ad_org_id) ),0) AS TaxBaseAmtVE, " +
					  "COALESCE(SUM(currencyconvert(i.TaxAmt ,ci.c_currency_id, 205, " +
					  "i.dateacct, ci.c_conversiontype_id, i.ad_client_id, i.ad_org_id)),0) AS TaxAmtVE, t.Name, t.Rate, t.IsSalesTax "
					 + " FROM LCO_InvoiceWithholding i, C_Tax t, C_Invoice ci "
					+ " WHERE i.C_Invoice_ID = ? AND " +
							 "i.IsCalcOnPayment = 'Y' AND " +
							 "i.IsActive = 'Y' AND " +
							 "i.Processed = 'Y' AND " +
							 "i.C_AllocationLine_ID = ? AND " +
							 "i.C_Tax_ID = t.C_Tax_ID AND " +
							 "i.C_Invoice_ID = ci.C_Invoice_ID "
					+ "GROUP BY i.C_Tax_ID, t.Name, t.Rate, t.IsSalesTax ";

Maybe with this guide you can implement a better and general solution for you.

Regards,

sidhar...@sodtechnologies.com

unread,
Dec 1, 2015, 12:47:44 AM12/1/15
to iDempiere
Hi Rizwan,

  I'm trying to add LCO with holding with Idempiere 2.1, but it's not installing it properly (Able to add in Idempiere 1.x without any issues) and showing the following error stack. 
  As you have already deployed the same with 2.1, it ll be a great help if you can provide me a solution for this issue.

SEVERE: importXML:
java.lang.NumberFormatException: For input string: "IsWithholding"
 at java.lang.NumberFormatException.forInputString(Unknown Source)
 at java.lang.Integer.parseInt(Unknown Source)
 at java.lang.Integer.<init>(Unknown Source)
 at org.adempiere.pipo2.PoFiller.setInteger(PoFiller.java:112)
 at org.adempiere.pipo2.PoFiller.autoFill(PoFiller.java:275)
 at org.adempiere.pipo2.handler.ColumnElementHandler.startElement(ColumnElementHandler.java:73)
 at org.adempiere.pipo2.PackInHandler.processElement(PackInHandler.java:226)
 at org.adempiere.pipo2.PackInHandler.processElement(PackInHandler.java:234)
 at org.adempiere.pipo2.PackInHandler.endElement(PackInHandler.java:303)
 at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
 at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
 at javax.xml.parsers.SAXParser.parse(Unknown Source)
 at org.adempiere.pipo2.PackIn.importXML(PackIn.java:168)
 at org.adempiere.pipo2.PackIn.importXML(PackIn.java:131)
 at org.adempiere.pipo2.PackInProcess.doIt(PackInProcess.java:132)
 at org.compiere.process.SvrProcess.process(SvrProcess.java:198)
 at org.compiere.process.SvrProcess.startProcess(SvrProcess.java:144)
 at org.adempiere.util.ProcessUtil.startJavaProcess(ProcessUtil.java:172)
 at org.compiere.apps.AbstractProcessCtl.startProcess(AbstractProcessCtl.java:466)
 at org.compiere.apps.AbstractProcessCtl.run(AbstractProcessCtl.java:234)
 at org.adempiere.webui.apps.WProcessCtl.process(WProcessCtl.java:170)
 at org.adempiere.webui.apps.AbstractProcessDialog$ProcessDialogRunnable.doRun(AbstractProcessDialog.java:631)
 at org.adempiere.util.ContextRunnable.run(ContextRunnable.java:38)
 at org.adempiere.webui.apps.DesktopRunnable.run(DesktopRunnable.java:40)
 at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
 at java.util.concurrent.FutureTask.run(Unknown Source)
 at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
 at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)

Nov 30, 2015 6:04:06 PM org.adempiere.pipo2.PackIn importXML
SEVERE: importXML:
java.lang.RuntimeException: For input string: "IsWithholding"
 at org.adempiere.pipo2.PackIn.importXML(PackIn.java:179)
 at org.adempiere.pipo2.PackIn.importXML(PackIn.java:131)
 at org.adempiere.pipo2.PackInProcess.doIt(PackInProcess.java:132)
 at org.compiere.process.SvrProcess.process(SvrProcess.java:198)
 at org.compiere.process.SvrProcess.startProcess(SvrProcess.java:144)
 at org.adempiere.util.ProcessUtil.startJavaProcess(ProcessUtil.java:172)
 at org.compiere.apps.AbstractProcessCtl.startProcess(AbstractProcessCtl.java:466)
 at org.compiere.apps.AbstractProcessCtl.run(AbstractProcessCtl.java:234)
 at org.adempiere.webui.apps.WProcessCtl.process(WProcessCtl.java:170)
 at org.adempiere.webui.apps.AbstractProcessDialog$ProcessDialogRunnable.doRun(AbstractProcessDialog.java:631)
 at org.adempiere.util.ContextRunnable.run(ContextRunnable.java:38)
 at org.adempiere.webui.apps.DesktopRunnable.run(DesktopRunnable.java:40)
 at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
 at java.util.concurrent.FutureTask.run(Unknown Source)
 at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
 at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NumberFormatException: For input string: "IsWithholding"
 at java.lang.NumberFormatException.forInputString(Unknown Source)
 at java.lang.Integer.parseInt(Unknown Source)
 at java.lang.Integer.<init>(Unknown Source)
 at org.adempiere.pipo2.PoFiller.setInteger(PoFiller.java:112)
 at org.adempiere.pipo2.PoFiller.autoFill(PoFiller.java:275)
 at org.adempiere.pipo2.handler.ColumnElementHandler.startElement(ColumnElementHandler.java:73)
 at org.adempiere.pipo2.PackInHandler.processElement(PackInHandler.java:226)
 at org.adempiere.pipo2.PackInHandler.processElement(PackInHandler.java:234)
 at org.adempiere.pipo2.PackInHandler.endElement(PackInHandler.java:303)
 at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
 at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
 at javax.xml.parsers.SAXParser.parse(Unknown Source)
 at org.adempiere.pipo2.PackIn.importXML(PackIn.java:168)
 ... 19 more


Thank You,
  Sidharth

Muhammad Rizwan Anwar

unread,
Dec 2, 2015, 7:20:10 AM12/2/15
to iDempiere
Dear Sidharth

Hope you fine.

I never found any error while Installing LCO withholding in any iDempiere version. (did not try for V3.0)
Furthermore i don't have idea about technical issues involve (sorry for that)

Please mention the way to install this plug-in - OSGI Console or 2 Pack? Hope some technical person will guide you in proper way.

thank you

sidhar...@sodtechnologies.com

unread,
Dec 3, 2015, 12:39:20 AM12/3/15
to iDempiere

    Hi Rizwan,

    I'm fine, thank you.
   
    I tried all the possible ways to install plugin in Idempiere 2.1
    (i) LCO plugin code and idempiere 2.1 code
    (ii) LCO Plugin jar and Idempiere 2.1 code using felix console
    (iii) LCO plugin 2 pack  using pack in
   
     Any way for the time being i installed it using Idempiere 1.x build and Idempiere 2.1 database and it worked, then changed the code to 2.1.

   Regards,
         Sidharth

Muhammad Rizwan Anwar

unread,
Dec 3, 2015, 3:03:25 AM12/3/15
to iDempiere
Dear Eduardo Gil.

Thanks for your attention and code material.

Sorry for replying late as i was busy to test other solution (Thai withholding). Thai withholding also don't convert foreign currency to local currency at payment level. I don't know why developers of these localization didn't consider it.

However iDempiere is great Application. It always provides you solutions in one and another way. How we cater problem (recording withholding taxes at payment level in local currency)? We select invoices of foreign currencies on the payment tab while receiving payments and manually mention withholding amounts in local currency. System posts all entries in well manner. Thanks iDempiere and community for all the solutions.

regards,

Rizwan

iqbal muhammad

unread,
Jul 1, 2016, 4:36:15 AM7/1/16
to iDempiere
Hi Rizwan,

How about Payment for AP Payment (not AR Receipt)? 

We have problem as follows : In Payment window, after selecting Invoice in foreign currency whose withholding amount, Write-off Amount's value still remains 0. So we change it manually and posting of Payment is OK. But not with the View Allocation posting, Tax credit AR amount is not converted into base currency. I attached view allocation's posting in attachment.

Could you explain more about your solution "manually mention withholding amounts in local currency"?

Thanks for your help.

Regards,
Iqbal
wht posting.jpg

Muhammad Rizwan Anwar

unread,
Jul 11, 2016, 4:22:30 AM7/11/16
to iDempiere
I could not understand your situation. Can you please share the detail how you want to account for withholding?

iqbal muhammad

unread,
Jul 13, 2016, 6:02:10 AM7/13/16
to iDempiere
Hi Rizwan,

My test case is as follow:
  • Accounting Schema Currency is USD
  • Currency Used for Transaction is IDR
  • 1 USD = 10.000 IDR
  • WHT Rate 12%
  • We're using org.globalqss.idempiere.LCO.withholdings_3.1.0.v20160505-0453.jar

Invoice (Vendor) : Total = 10.000 IDR, and WHT Amount = 1.200 IDR


As you noticed Tax Credit amount is wrong, it should be 0.12. My conclusion is WHT uses wrong currency USD (based curr.), not IDR (foreign curr.), so that it uses wrong rate 1, instead of 10.000.


In fact, my case is similar with yours, except that mine is AP while yours is AR. When you said in your case "As you noticed Tax due amount 10.00 is wrong it should be 12.49", I guess it is caused by WHT uses USD not Euro in its posting.


So my question is how can we set WHT to use foreign currency in its posting?


Thanks for your help, Rizwan.


Regards,

Iqbal


wht1.JPG

Muhammad Rizwan Anwar

unread,
Jul 13, 2016, 1:06:53 PM7/13/16
to iDempiere
Hi Iqbal,

Yes you are write, WHT plugin not use (convert) foreign currency to local currency.

What I presume WHT is always apply on local party payments by any government not to foreign parties. Correct me if I am wrong.

Solution in your and mine case is simple:
  • Record your paid amount of foreign currency' invoices (the net amount you paid to vendor / the net amount received by customer) in foreign currency.
  • To record WHT select foreign currency' invoices on main tab of the payment window and change the currency to local currency on that payment record ($ in your case).
  • Go to WHT tab of the payment window reset calculation for your withholding manually
  • Please note in this case no amount will be mentioned in PayAmount Field - mention WHT amount in WritOff field.
I hope this will work for you as it works for us.

Regards,

Rizwan
Reply all
Reply to author
Forward
0 new messages