SELECT a.ledger_id,
c.segment1||'.'||c.segment2||'.'||c.segment3||'.'||c.segment4||'.'||c.segment5 acct,
a.je_source,
a.je_category,
SUM (Nvl (b.accounted_dr, 0) - Nvl (b.accounted_cr, 0)) amt
FROM gl_je_headers a,
gl_je_lines b,
gl_code_combinations c
WHERE a.je_header_id = b.je_header_id
AND b.code_combination_id = c.code_combination_id
AND a.status = 'P'
AND a.period_name = 'Mar-19'
AND c.segment1||'.'||c.segment2||'.'||c.segment3||'.'||c.segment4||'.'||c.segment5 = :p_account_segment
AND a.ledger_id = :p_ledger_id
GROUP BY a.ledger_id,
c.segment1||'.'||c.segment2||'.'||c.segment3||'.'||c.segment4||'.'||c.segment5,
a.je_source,
a.je_category;
(or)
SELECT Nvl (period_net_dr, 0) - Nvl (period_net_cr, 0)
FROM gl_balances GLB,
gl_code_combinations GCC,
gl_ledgers gl
WHERE GLB.actual_flag = 'A'
AND GLB.period_name = 'Mar-19'
AND GLB.currency_code = 'INR'
AND glb.code_combination_id = gcc.code_combination_id
AND glb.ledger_id = gl.ledger_id
AND gl.ledger_category_code = 'PRIMARY'
AND GCC.segment1
||'.'
||GCC.segment2
||'.'
||GCC.segment3
||'.'
||GCC.segment4
||'.'
||GCC.segment5 = '1561.R111001.999999.99999.999';
No comments:
Post a Comment