Thursday 13 June 2013

PA to GL Burden Cost

/* Formatted on 6/13/2013 3:15:28 PM (QP5 v5.114.809.3010) */
SELECT   jb.je_batch_id,
         jb.name Batch_Name,
         jb.description Batch_Description,
         jh.je_header_id,
         jes.user_je_source_name Journal_Source,
         jec.user_je_category_name Journal_Category,
         jh.period_name Journal_Period,
         jh.name Journal_Name,
         jh.description Journal_Description,
         jh.currency_code Journal_Currency,
         DECODE (
            jh.status,
            'P',
            'Posted',
            'U',
            'Unposted',
            'F',
            'Error7 - Showing invalid journal entry lines or no journal entry lines',
            'K',
            'Error10 - Showing unbalanced intercompany journal entry',
            'Z',
            'Error7 - Showing invalid journal entry lines or no journal entry lines',
            'Unknown'
         )
            Journal_Status,
         DECODE (jh.actual_flag,
                 'A',
                 'Actual',
                 'B',
                 'Budget',
                 'E',
                 'Encumbrance')
            Journal_Type,
         jh.posted_date Journal_Posted_Date,
         jh.creation_date Journal_Creation_Date,
         jh.accrual_rev_effective_date,
         jh.accrual_rev_period_name,
         jh.accrual_rev_status,
         jh.accrual_rev_je_header_id,
         jh.reversed_je_header_id,
         jh.currency_conversion_rate Journal_Curr_Conv_Rate,
         jh.currency_conversion_type Journal_Curr_Conv_Type,
         jh.currency_conversion_date Journal_Curr_Conv_Date,
         jh.external_reference Journal_external_Ref,
         jl.je_line_num Journal_Line_Num,
         jl.effective_date Journal_Effective_Date,
         jl.entered_dr Journal_Entered_DR,
         jl.entered_cr Journal_Entered_CR,
         jl.accounted_dr Journal_Accounted_DR,
         jl.accounted_cr Journal_Accounted_CR,
         jl.description Journal_line_Description,
         jl.reference_1 Project_Batch,
         jl.reference_2 Code_Combination_Id,
         jl.reference_3 Project_Line_Type,
         jl.reference_6,
         jl.gl_sl_link_id,
         jl.gl_sl_link_table,
         gcc.code_combination_id gl_account_cc_id,
         gcc.concatenated_segments GL_Account_String,
         gcc.segment1 GL#segment1,
         gcc.segment2 GL#segment2,
         gcc.segment3 GL#segment3,
         gcc.segment4 GL#segment4,
         gcc.segment5 GL#segment5,
         gcc.segment6 GL#segment6,
         gcc.segment7 GL#segment7,
         gcc.segment8 GL#segment8,                        
         pacd.expenditure_item_id,
         pacd.line_num,
         pacd.burdened_cost,
         pacd.amount,
         pacd.quantity,
         pacd.pa_date,
         pacd.gl_date,
         pacd.dr_code_combination_id,
         pacd.cr_code_combination_id,
         pacd.project_id,
         pacd.task_id,
         pap.name Project_Name,
         pap.segment1 Project_Number,
         pap.project_type,
         pap.project_status_code,
         pap.description Project_description,
         pap.start_date Project_Start_date,
         pap.completion_date Project_completion_date,
         pap.closed_date Project_closed_date,
         pat.task_number,
         pat.description Task_description,
         pat.task_name,
         pec.expenditure_comment pa_expenditure_comment,
         ael.accounted_dr sla_line_accounted_dr,
         ael.accounted_cr sla_line_accounted_cr,
         ael.entered_dr sla_line_entered_dr,
         ael.entered_cr sla_line_entered_cr,
         xdl.unrounded_entered_cr sla_dist_entered_cr,
         xdl.unrounded_entered_dr sla_dist_entered_dr,
         xdl.unrounded_accounted_cr sla_dist_accounted_cr,
         xdl.unrounded_accounted_dr sla_dist_accounted_dr
  FROM   xla_distribution_links xdl,
         xla_ae_headers aeh,
         xla_ae_lines ael,
         gl_import_references gir,
         gl_je_batches jb,
         gl_je_headers jh,
         gl_je_lines jl,
         gl_je_sources jes,
         gl_je_categories jec,
         gl_code_combinations_kfv gcc,
         pa_cost_distribution_lines_all pacd,
         pa_expenditure_comments pec,
         pa_projects_all pap,
         pa_tasks pat
 WHERE       xdl.application_id = 275
         AND xdl.event_id = gir.reference_6
         AND jb.je_batch_id = jh.je_batch_id
         AND gir.je_header_id = jh.je_header_id
         AND jh.je_header_id = jl.je_header_id
         AND gir.je_line_num = jl.je_line_num
         AND jh.je_source = jes.je_source_name
         AND jh.je_category = jec.je_category_name
         AND gir.gl_sl_link_id = ael.gl_sl_link_id(+)
         AND gir.gl_sl_link_table = ael.gl_sl_link_table(+)
         AND ael.ae_line_num = xdl.ae_line_num(+)
         AND ael.ae_header_id = xdl.ae_header_id(+)
         AND ael.ae_header_id = aeh.ae_header_id(+)
         AND pacd.acct_event_id = xdl.event_id
         AND pacd.expenditure_item_id = xdl.source_distribution_id_num_1
         AND pacd.line_num = xdl.source_distribution_id_num_2
         AND pacd.dr_Code_combination_id = gcc.code_combination_id
         AND pec.expenditure_item_id(+) = pacd.expenditure_item_id
         AND pacd.project_id = pap.project_id
         AND pacd.task_id = pat.task_id
         AND jh.je_source = 'Project Accounting'
         AND jh.je_category = 'Burden Cost'

No comments:

Post a Comment