GL Trial Balance for PTD

2
select gsb.name sob_name ,glb.currency_code ,glb.period_name ,ffv.attribute1 condi_code ,glcc.segment2 account ,ffv.description description ,lk1.meaning account_type --,glcc.segment1||'.'||glcc.segment2||'.'||glcc.segment3||'.'|| --glcc.segment4||'.'||glcc.segment5||'.'||glcc.segment6 accounting_flexfield ,nvl(begin_balance_dr,0) - nvl(begin_balance_cr,0) opening_balance ,nvl(period_net_dr,0) total_debits ,nvl(period_net_cr,0) total_credits ,nvl(period_net_dr,0) - nvl(period_net_cr,0) + nvl(begin_balance_dr,0) - nvl(begin_balance_cr,0) closing_balance from gl_balances glb ,gl_code_combinations glcc ,fnd_flex_values_vl ffv

description

TRIALBALANCE PTD DOCUMENT

Transcript of GL Trial Balance for PTD

select

gsb.name sob_name

,glb.currency_code

,glb.period_name

,ffv.attribute1 condi_code

,glcc.segment2 account

,ffv.description description

,lk1.meaning account_type

--,glcc.segment1||'.'||glcc.segment2||'.'||glcc.segment3||'.'||

--glcc.segment4||'.'||glcc.segment5||'.'||glcc.segment6 accounting_flexfield

,nvl(begin_balance_dr,0) - nvl(begin_balance_cr,0) opening_balance

,nvl(period_net_dr,0) total_debits

,nvl(period_net_cr,0) total_credits

,nvl(period_net_dr,0) - nvl(period_net_cr,0) + nvl(begin_balance_dr,0) - nvl(begin_balance_cr,0) closing_balance

from

gl_balances glb

,gl_code_combinations glcc

,fnd_flex_values_vl ffv

,fnd_flex_value_sets ffvs

,fnd_lookups lk1

,gl_sets_of_books gsb

where glb.actual_flag = 'A'

and (glb.translated_flag != 'R' or glb.translated_flag is null)

and glb.code_combination_id = glcc.code_combination_id

and glcc.chart_of_accounts_id = gsb.chart_of_accounts_id

and glb.SET_OF_BOOKS_ID = gsb.SET_OF_BOOKS_ID

and glcc.template_id is null

and lk1.lookup_type = 'ACCOUNT_TYPE'

and lk1.lookup_code = glcc.account_type

and (nvl(begin_balance_dr,0) - nvl(begin_balance_cr,0) +

nvl(period_net_dr,0) - nvl(period_net_cr,0) +

nvl(period_net_dr,0) - nvl(period_net_cr,0) + nvl(begin_balance_dr,0) - nvl(begin_balance_cr,0)

)!=0

and ffv.flex_value_set_id=ffvs.flex_value_set_id

--and ffvs.flex_value_set_name='MPP_ACCOUNT'

and ffv.flex_value=glcc.segment2

order by glcc.segment2