Statement of Account SQL Query

select
jh.default_effective_date,
jh.period_name,
jh.je_source,
jh.doc_sequence_id,
jh.doc_sequence_value,
jh.status,
cc.concatenated_segments account_combination,
nvl(jl.accounted_dr,0) DR,
nvl(jl.accounted_cr,0) CR,
nvl(jl.accounted_dr,0)-nvl(jl.accounted_cr,0) Balance

from
gl_je_headers jh,
gl_je_lines jl,
gl_code_combinations_kfv cc

where
jh.je_header_id=jl.je_header_id
and cc.code_combination_id=jl.code_combination_id
and cc.segment4=nvl(:p_sector,cc.segment4)
and jh.status='P'
and jh.actual_flag='A'
and jh.default_effective_date between nvl(:p_from_date,jh.default_effective_date)
and nvl(:p_to_date,jh.default_effective_date)

No comments:

Post a Comment