1. GL Balances
-------------------------------------
-- 2nd check with and without zero --
--------------------
select gb.PERIOD_NAME, sum(nvl(gb.begin_balance_dr,0)-nvl(gb.begin_balance_cr,0)) opening_bal,
sum(nvl(gb.period_net_dr,0) - nvl(gb.period_net_cr,0)) period_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))) sisterconcernloan
from gl_balances gb,
gl_code_combinations_kfv gcc, gl_period_statuses ap --, gl_je_lines jl
where gb.code_combination_id = gcc.code_combination_id
and gb.ledger_id = 2021
and gb.actual_flag = 'A'
and gb.currency_code = 'BDT'
and gcc.segment6 in -- ('126502','216500') --
(select headid from xxprg_bsreport where headname = 'SisterConcernLoan')
and gb.PERIOD_NAME = ap.PERIOD_NAME and ap.APPLICATION_ID=101 and ap.PERIOD_NAME not like 'Adj%' and ap.EFFECTIVE_PERIOD_NUM>=20170005
-- and (nvl(gb.begin_balance_dr,0)-nvl(gb.begin_balance_cr,0) + (nvl(gb.period_net_dr,0) - nvl(gb.period_net_cr,0))) <>0
group by ap.PERIOD_YEAR, ap.PERIOD_NUM, gb.PERIOD_NAME --, gcc.segment6, gcc.segment7
order by ap.PERIOD_YEAR desc, ap.PERIOD_NUM desc, gb.PERIOD_NAME --, gcc.segment6, gcc.segment7
-------------------------------------
-- 2nd check with and without zero --
--------------------
select gb.PERIOD_NAME, sum(nvl(gb.begin_balance_dr,0)-nvl(gb.begin_balance_cr,0)) opening_bal,
sum(nvl(gb.period_net_dr,0) - nvl(gb.period_net_cr,0)) period_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))) sisterconcernloan
from gl_balances gb,
gl_code_combinations_kfv gcc, gl_period_statuses ap --, gl_je_lines jl
where gb.code_combination_id = gcc.code_combination_id
and gb.ledger_id = 2021
and gb.actual_flag = 'A'
and gb.currency_code = 'BDT'
and gcc.segment6 in -- ('126502','216500') --
(select headid from xxprg_bsreport where headname = 'SisterConcernLoan')
and gb.PERIOD_NAME = ap.PERIOD_NAME and ap.APPLICATION_ID=101 and ap.PERIOD_NAME not like 'Adj%' and ap.EFFECTIVE_PERIOD_NUM>=20170005
-- and (nvl(gb.begin_balance_dr,0)-nvl(gb.begin_balance_cr,0) + (nvl(gb.period_net_dr,0) - nvl(gb.period_net_cr,0))) <>0
group by ap.PERIOD_YEAR, ap.PERIOD_NUM, gb.PERIOD_NAME --, gcc.segment6, gcc.segment7
order by ap.PERIOD_YEAR desc, ap.PERIOD_NUM desc, gb.PERIOD_NAME --, gcc.segment6, gcc.segment7
No comments:
Post a Comment