SELECT
null FLEX_DATA_ALL,
icd.balance_type BALANCE_TYPE,
icd.encumbrance_type
BDGT_OR_ECMBR,
icd.period_name PERIOD,
icd.budget_name FUNDING_BUDGET,
icd.amount_type AMOUNT_TYPE,
nvl( icd.cc_func_dr_amt, 0 ) -
nvl( icd.cc_func_cr_amt, 0 )
AMOUNT,
nvl( icd.funds_available_amt, 0 )
FUNDS_AVAILABLE,
icd.status_code_meaning STATUS,
icd.result_code_meaning RESULT_DESCRIPTION,
gll.meaning PRINT_REPORT,
fnd_flex_xml_publisher_apis.process_kff_combination_1('flex_field_all', 'SQLGL', 'GL#', GCC.CHART_OF_ACCOUNTS_ID, NULL, GCC.CODE_COMBINATION_ID, 'ALL', 'Y', 'VALUE') FLEX_FIELD_ALL
FROM
gl_lookups gll,
gl_code_combinations gcc,
igc_cbc_dr_v icd
WHERE
icd.cc_header_id = :P_HEADER_ID
and (:P_PRINT_REPORT = 'ALL'
or ( (icd.cbc_result_code between 'P20' and 'P29')
or (icd.cbc_result_code like 'F%') ) )
and gcc.code_combination_id = icd.code_combination_id
and gll.lookup_type (+) = 'PRINT SELECTION'
and gll.lookup_code (+) = :P_PRINT_REPORT
ORDER BY
DECODE( nvl( substr( icd.cbc_result_code, 0, 1 ), 'N' ) ,
'F', 1,
'F' ,
'P', DECODE( substr( icd.cbc_result_code, 0, 2 ),
'P2', 3,
'P1', 5,
7 ),
'P', DECODE( substr(
icd.cbc_result_code, 0, 2),
'P2', 4,
'P1', 6,
8 ),
'N', 9 ),
period_name |