Skip to content

Instantly share code, notes, and snippets.

@ranafaraz
Created March 11, 2021 19:12
Show Gist options
  • Save ranafaraz/23487e7dc37537c2f30f365fec7e3298 to your computer and use it in GitHub Desktop.
Save ranafaraz/23487e7dc37537c2f30f365fec7e3298 to your computer and use it in GitHub Desktop.
Query to get withholdings in iDempiere
SELECT
wh.documentno AS wh_docno,
i.documentno AS invioce_docno,
(SELECT t.name FROM adempiere.c_tax t WHERE t.c_tax_id = wh.c_tax_id) AS tax,
(SELECT wt.name FROM adempiere.lco_withholdingtype wt WHERE wt.lco_withholdingtype_id = wh.lco_withholdingtype_id) AS wh_type,
wh.wh_other_baseamt as base_amt,
wh.wh_other_percent as wh_percent,
wh.other_charge as deducted_amt,
wh.description
FROM
((adempiere.f_withholding wh
INNER JOIN adempiere.c_invoice i ON (( i.c_invoice_id = wh.c_invoice_id )))
INNER JOIN adempiere.gl_budget b ON (( b.gl_budget_id = i.gl_budget_id )))
WHERE
wh.isactive = 'Y'
AND
wh.ad_client_id = 1000000
AND
b.ad_client_id = 1000000
AND
b.isactive = 'Y'
AND
b.isprimary = 'Y'
AND
b.budgetstatus = 'A'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment