Skip to content

Instantly share code, notes, and snippets.

@ranafaraz
Created March 11, 2021 19:58
Show Gist options
  • Save ranafaraz/d8447eca4c740cf76e89b062d3cf2b5b to your computer and use it in GitHub Desktop.
Save ranafaraz/d8447eca4c740cf76e89b062d3cf2b5b to your computer and use it in GitHub Desktop.
This query will get the allocated budget against A09 - Expenditure on Acquiring of Physical Assets; A12 - Civil Works; A13 - Repair and Maintenance
SELECT
SUM(f.amt) AS allocated_budget
FROM
adempiere.gl_fund f
INNER JOIN adempiere.gl_budget b ON (( b.gl_budget_id = f.gl_budget_id ))
INNER JOIN adempiere.vwchart vwc ON (( vwc.c_elementvalue_id = f.c_elementvalue_id ))
WHERE
f.isactive = 'Y'
AND
f.ad_client_id = 1000000
AND
b.isactive = 'Y'
AND
b.ad_client_id = 1000000
AND
b.isprimary = 'Y'
AND
b.budgetstatus = 'A'
AND
vwc.minorheadvalue = 'A09'
OR
vwc.minorheadvalue = 'A12'
OR
vwc.minorheadvalue = 'A13'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment