GL Account Balance
GL Account Balance:
The below SQL gets the beginning balance and ending balance of the specified GL Account for a giver ledger and period.
SELECT gcc.concatenated_segments Code_combination,
SUM(NVL(gb.begin_balance_dr,0)-NVL(gb.begin_balance_cr,0)) beginning_bal,
SUM(NVL(gb.begin_balance_dr,0)-NVL(gb.begin_balance_cr,0) +
(NVL(gb.period_net_Dr,0) - NVL(gb.period_net_cr,0))) end_bal
FROM gl_balances gb,
gl_code_combinations_kfv gcc
WHERE gb.code_combination_id = gcc.code_combination_id
AND gcc.CONCATENATED_SEGMENTS= '01-000-1110-0000-000' --Enter GL Account
AND gb.ledger_id = 1 -- Enter the Ledger
AND gb.Actual_flag = 'A'
AND gb.period_name = 'Dec-13' --Enter the Period
AND gb.currency_code = (SELECT currency_code FROM gl_ledgers
WHERE ledger_id = gb.ledger_id)
GROUP BY gcc.concatenated_segments;
No comments:
Post a Comment