Last active
January 30, 2021 17:51
-
-
Save ranafaraz/9b2ac0fdc35896f10dfa625cc4bd77e4 to your computer and use it in GitHub Desktop.
This query is used to fetch total and utilized budget against a specific charge head and financial year, using a callout applied on C_Charge_ID. Note: InvoiceLine is being used as Ledger and budget is available in GL Fund. #iDempiere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Static values were replaced by dynamic Form values in the Callout. | |
SELECT | |
f.amt AS Total_Budget, | |
( | |
SELECT SUM | |
( linetotalamt ) | |
FROM | |
( adempiere.c_invoiceline ledger INNER JOIN adempiere.c_invoice lgi ON ( ( ledger.c_invoice_id = lgi.c_invoice_id ) ) ) | |
WHERE | |
ledger.ad_org_id = 1000001 | |
AND ledger.c_charge_id = 1000068 | |
AND lgi.gl_budget_id = ( SELECT gl_budget_id FROM c_invoice WHERE c_invoice_id = 1000075 ) | |
) AS Utilized_Budget | |
FROM | |
( gl_fund f INNER JOIN vwcharge vc ON ( ( vc.c_charge_id = 1000068 ) ) ) | |
WHERE | |
f.isactive = 'Y' | |
AND f.ad_org_id = 1000001 | |
AND f.c_elementvalue_id = vc.account_id | |
AND f.gl_budget_id = ( SELECT gl_budget_id FROM c_invoice WHERE c_invoice_id = 1000075 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment