SELECT bal.code_combination_id code_combination_id
,segment1 fund
,segment2 org
,segment3 project
,segment4 account
,segment5 location
,DECODE( account_type, 'A','Asset'
,'C','Budgetary (CR)'
,'D','Budgetary (DR)'
,'E','Expense'
,'L','Liability'
,'O','Owners equity'
,'R','Revenue'
,account_type) account_type
,period_name period_abbr
,LAST_DAY( TO_DATE( period_name, 'MON-RR')) period_date
,DECODE( account_type, 'R', -1,
DECODE( segment4, '1000', -1,
DECODE( segment4, '2000', -1,
DECODE( segment4, '3000', -1,
DECODE( segment4, '4000', -1,
+1))))) xyz
,SUM( DECODE( actual_flag, 'B',
NVL( period_net_dr, 0) - NVL( period_net_cr, 0),
0)) period_net_budget_bal
,SUM( DECODE( actual_flag, 'A',
NVL( period_net_dr, 0) - NVL( period_net_cr, 0),
0)) PERIOD_NET_ACTUAL_BALANCE
,SUM( DECODE( actual_flag, 'E', DECODE( encumbrance_type, 'Invoice',
NVL( period_net_dr, 0) - NVL( period_net_cr, 0),
0), 0)) period_net_invoice_encumb
,SUM( DECODE( actual_flag, 'A',
NVL( begin_balance_dr, 0) + NVL( period_net_dr, 0)
- NVL( begin_balance_cr, 0) - NVL( period_net_cr, 0),
0)) current_gl_balance
,SUM( DECODE( actual_flag, 'E', DECODE( encumbrance_type, 'Invoice',
nvl( begin_balance_dr, 0) + nvl( period_net_dr, 0)
- nvl( begin_balance_cr, 0) - nvl( period_net_cr, 0),
0), 0)) invoice_encumbrance
,period_year
FROM gl_balances bal
,gl_encumbrance_types get
,gl_code_combinations gcc
WHERE bal.encumbrance_type_id = get.encumbrance_type_id(+)
AND bal.code_combination_id = gcc.code_combination_id
GROUP BY bal.code_combination_id
,segment1
,segment2
,segment3
,segment4
,segment5
,account_type
,period_name
,period_year
;
Good
ReplyDeleteGood
ReplyDeleteThank6 for sharing info.
ReplyDeleteVery informative, appreciated team on blog Maintainance.
ReplyDeleteExcellent work.
ReplyDeleteWow
ReplyDeleteInformative
ReplyDelete