<ROOT>
 <APPS_INITIALIZE_DATA>
  <USER_NAME>ENGINATICS</USER_NAME>
  <RESPONSIBILITY_KEY>SYSTEM_ADMINISTRATOR</RESPONSIBILITY_KEY>
  <APPLICATION_SHORT_NAME>SYSADMIN</APPLICATION_SHORT_NAME>
 </APPS_INITIALIZE_DATA>
<REPORTS>
<!-- loader xml for Enginatics Blitz Report: ECC Projects, Projects Costing: Transactions, SQL1 -->
 <REPORTS_ROW>
  <GUID>EEE75CEB4ABB6AD8E05362FB09051F8B</GUID>
  <SQL_TEXT>select
x.*
from
(
select * from (select /*+ push_pred(ei) */
record_type,
ecc_spec_id,
tmp.expenditure_item_id,&apos;N&apos; IS_WORKTYPE_BILLABLE_ENABLED
,tmp.expenditure_id,
tmp.project_id,
project_name,
project_number,
user_project_type,
project_type_class_code,
tmp.project_type,
project_manager,
project_start_date,
project_completion_date,
project_organization,
project_status_name,
project_status,
project_budget,
task_plan_capitalizable,
task_non_plan_capitalize,
proj_plan_capitalize,
proj_non_plan_capitalize,
tmp.proj_capitalizable,
tmp.proj_non_capitalizable,
actual_capitalizable,
actual_non_capitalizable,
actual_yet_to_capitalizable,
project_revenue_budget,
proj_grouping_method,
proj_grp_supplier_invoice,
proj_asset_cost_alloc_mhd,
proj_enbl_burden_cost_acc,
current_pa_period,
current_gl_period,
current_reporting_pa_period,
tmp.projfunc_currency_code,
tmp.number_of_assets,
tmp.proj_capitalized_cost,
(proj_capitalizable-proj_capitalized_cost)proj_cip_cost,
tmp.task_id,
tmp.task_number,
tmp.task_name,
tmp.top_task_id,
tmp.top_task_name,
tmp.top_task_number,
tmp.task_start_date,
tmp.task_finish_date,
tmp.task_manager,
tmp.task_organization,
tmp.task_burden_schedule,
tmp.project_burden_schedule,
tmp.task_billable_flag,
tmp.task_work_type,
tmp.expenditure_item_date,
tmp.expenditure_week_ending_date,
tmp.expenditure_type,
tmp.expenditure_category,
tmp.expenditure_type_class,
tmp.incurred_by_person_id,
tmp.employee_name,
tmp.employee_number,
tmp.location_code,
tmp.job_id,
tmp.job_name,
tmp.incurred_by_organization_id,
tmp.override_to_organization_id,
tmp.expenditure_organization_id,
tmp.expenditure_org_name,
tmp.non_labor_resource,
tmp.system_linkage_function,
tmp.transaction_source_code,
nvl (tmp.transaction_source,&apos;Projects&apos;) transaction_source,
tmp.orig_transaction_ref,
tmp.expenditure_group,
tmp.ei_pend_burden_dist,
decode(tmp.ei_pend_burden_dist, &apos;Y&apos;, 1, 0) ei_pend_burden_dist_count,
tmp.ei_group_unreleased,
decode(tmp.ei_group_unreleased, &apos;Y&apos;, 1, 0) ei_group_unreleased_count,
tmp.ei_cost_exception,
decode(tmp.ei_cost_exception, &apos;Y&apos;, 1, 0) ei_cost_exception_count,
tmp.ei_uncosted,
decode(tmp.ei_uncosted, &apos;Y&apos;, 1, 0) ei_uncosted_count,
tmp.ei_costed,
decode(tmp.ei_costed, &apos;Y&apos;, 1, 0) ei_costed_count,
tmp.ei_costed_value,
tmp.quantity,
tmp.burden_cost,
tmp.ei_labor_cost,
tmp.ei_non_labor_cost,
tmp.unit_of_measure,
tmp.unit_of_measure_m,
tmp.raw_cost,
tmp.raw_cost_rate,
tmp.cost_distributed_flag,
tmp.cost_distributed,
tmp.cost_dist_rejection_code,
tmp.revenue_distributed,
tmp.revenue_distributed_flag,
tmp.billed,
tmp.billable_flag,
tmp.billable,
tmp.bill_hold_flag,
tmp.bill_hold,
tmp.billed_cost,
tmp.billable_unbilled_cost,
tmp.billable_onhold_cost,
tmp.bill_billable_cost,
tmp.bill_nonbilable_flag,
tmp.bill_nonbilable_cost,
tmp.bill_billhold_cost,
tmp.bill_billed_flag,
tmp.bill_billed_cost,
tmp.bill_not_billed_flag,
tmp.bill_not_billed_cost,
tmp.ei_work_burden_cost,
tmp.burdened_cost,
tmp.burdened_cost_rate,
tmp.denom_currency_code,
tmp.denom_raw_cost,
tmp.denom_burdened_cost,
tmp.acct_currency_code,
tmp.acct_rate_type,
tmp.acct_rate_date,
tmp.acct_exchange_rate,
tmp.acct_raw_cost,
tmp.acct_burdened_cost,
cip_cost,
tmp.project_currency_code,
tmp.project_raw_cost,
tmp.project_burdened_cost,
tmp.cost_bur_distributed_flag,
tmp.capitalizable_flag,
tmp.capitalizable,
tmp.asset_line_generated,
(decode(project_type_class_code,&apos;CAPITAL&apos;,decode(capitalizable_flag,&apos;N&apos;,tmp.cdl_amount,0),0))non_capitalizable_cost,
(decode(project_type_class_code,&apos;CAPITAL&apos;,decode(capitalizable_flag,&apos;Y&apos;,tmp.cdl_amount,0),0))capitalizable_cost,
(decode(project_type_class_code,&apos;CAPITAL&apos;,decode(capitalized_flag,&apos;Y&apos;,tmp.cdl_amount,0),0))capitalized_cost,
tmp.capitalized_flag,
tmp.capitalized,
tmp.capitalizable_cap_hold_flag,
tmp.capitalizable_cap_hold,
tmp.adjusted_expenditure_item_id,
tmp.net_zero_adjustment_flag,
tmp.net_zero_adjustment,
tmp.transferred_from_exp_item_id,
tmp.transferred_item_flag,
tmp.cc_cross_charge_code,
tmp.cc_cross_charge_type,
tmp.cc_bl_distributed_code,
tmp.org_id,
tmp.vendor_id,
tmp.vendor_name,
tmp.document_header_id,
tmp.document_distribution_id,
tmp.document_line_number,
tmp.document_payment_id,
tmp.document_type,
tmp.document_distribution_type,
tmp.Operating_Unit,
tmp.capital_cost_code_amt,
tmp.line_num,
tmp.line_type_code,
tmp.line_type,
tmp.reversed_flag,
tmp.transfer_status_code,
tmp.pa_date,
tmp.gl_date,
tmp.recvr_pa_date,
tmp.recvr_gl_date,
tmp.pa_period_name,
tmp.gl_period_name,
tmp.recvr_pa_period_name,
tmp.recvr_gl_period_name,
tmp.acct_event_id,
tmp.amount,
tmp.cdl_burdened_cost,
tmp.cdl_amount,
tmp.cdl_acct_status,
tmp.bl_acct_status,
tmp.exp_group_status_code,
tmp.exp_group_status,
tmp.expenditure_status,
tmp.precosting_status_code,
tmp.precosting_status,
asset_name,
tmp.work_type,
po_number,
po_line_number,
receipt_number,
receipt_line_number,
invoice_no,
invoice_line_number,
po_distribution_line_number,
invoice_distribution_line_no,
debit_account,
credit_account,
accounting_source,
transfer_status,
tmp.provider_le_name,
tmp.receiver_le_name,
tmp.receiver_operating_unit,
tmp.transfer_price,
tmp.labot_tp_sch_name,
tmp.non_labor_tp_sch_name,
accounting_status_code,
project_sla_acc_status,
sla_gl_acc_status,
pre_accounting_status,
tmp.project_exchange_rate,
tmp.project_rate_date,
tmp.project_rate_type,
tmp.revenue_accrued,
tmp.burden_schedule,
tmp.transfer_rejection_reason,
tmp.cc_rejection_reason,
alert_type,
alert_text,
cost_identifier,
pa_utils.get_lookup_values(&apos;COST_TYPE_DESC&apos;, cost_identifier, tmp.language) cost_identifier_desc,
unaccounted,
(decode(tmp.unaccounted,&apos;Unaccounted&apos;,&apos;Y&apos;,null))ei_unaccounted,
(decode(tmp.unaccounted,&apos;Unaccounted&apos;,1,0))ei_unaccounted_count,
(decode(tmp.unaccounted,&apos;Unaccounted&apos;,tmp.raw_cost,null))ei_unaccounted_cost,
accounting_exception,
project_accounted,
sla_accounted,
gl_accounted,
(decode(nvl(tmp.project_accounted,&apos;N&apos;),&apos;Y&apos;,tmp.amount,0))project_accounted_cost,
(decode(nvl(tmp.sla_accounted,&apos;N&apos;),&apos;Y&apos;,tmp.amount,0))sla_accounted_cost,
(decode(nvl(tmp.gl_accounted,&apos;N&apos;),&apos;Y&apos;,tmp.amount,0))gl_accounted_cost,
ei_account_exception,
(decode(nvl(tmp.ei_account_exception,&apos;N&apos;),&apos;Y&apos;,tmp.amount,0))ei_account_exception_cost,
ei_accounted,
(decode(nvl(tmp.ei_accounted,&apos;N&apos;),&apos;Y&apos;,tmp.amount,0))ei_accounted_cost,
sla_acct_code,
language,
NVL(tmp.sla_gl_acc_status,tmp.project_sla_acc_status) exp_accounting_stage,
( SELECT
nvl( pa_utils.get_lookup_values ( &apos;PA_EI_ACCOUNTING_STATUS&apos;,(CASE
WHEN(xea.gl_transfer_status_code = &apos;Y&apos;
OR nvl(tmp.historical_flag, &apos;Y&apos;) = &apos;Y&apos;) THEN &apos;GL&apos;
WHEN xea.gl_transfer_status_code &lt;&gt; &apos;Y&apos;
AND cdl.is_ei_final_accounted = &apos;Y&apos; THEN &apos;PGL&apos; /* Bug 30749534 */
END), tmp.language),
pa_utils.get_lookup_values(&apos;PA_EI_ACCOUNTING_STATUS&apos;,(CASE
WHEN  DECODE(cdl.transfer_status_code, &apos;X&apos;, &apos;PSLA&apos;, &apos;R&apos;, &apos;PSLA&apos;, &apos;P&apos;, &apos;PSLA&apos;, &apos;A&apos;, DECODE(cdl.is_ei_final_accounted, &apos;N&apos;, &apos;PSLA&apos;, &apos;SLA&apos;)) = &apos;PSLA&apos;
THEN &apos;PSLA&apos;
WHEN cdl.transfer_status_code NOT IN( &apos;V&apos;, &apos;G&apos;) THEN &apos;SLA&apos;
END), tmp.language)
)
FROM
/* Commented for Bug#30749534
(
SELECT
        cd.*
    FROM
        (
            SELECT
                c.expenditure_item_id,
                c.transfer_status_code,
                c.acct_event_id,
                c.line_num
            FROM
                pa_cost_dist_lines_v c
            WHERE
                c.line_type IN (
                    &apos;D&apos;
                )
                AND c.creation_date &gt;= &apos;12-DEC-21&apos;
				and (c.expenditure_item_id, c.line_num) in
				(select expenditure_item_id, max(line_num)
				from  pa_cost_dist_lines_v b
				where creation_date &gt;=&apos;12-DEC-21&apos;
				and line_type = &apos;D&apos;
				group by b.expenditure_item_id
				)
        ) cd
) cdl,
*/
/* Added Bug#30749534 */
(
select /*+ index (pecca pa_ecc_cost_cdl_account_n2) */
pecca.expenditure_item_id,
pecca.transfer_status_code,
pecca.acct_event_id,
pecca.line_num,
pecca.is_ei_final_accounted,
pecca.project_id,
pecca.task_id
from pa_ecc_cost_cdl_account pecca
where pecca.line_type = &apos;D&apos;
) cdl,
xla_ae_headers xea
WHERE
tmp.cost_distributed_flag = &apos;Y&apos;
AND cdl.expenditure_item_id = tmp.expenditure_item_id
and cdl.acct_event_id is not null
AND xea.balance_type_code (+) = &apos;A&apos;
AND xea.application_id (+) = 275
AND cdl.acct_event_id = xea.event_id(+)
AND tmp.set_of_books_id = xea.ledger_id(+)
/* Added for Bug#30749534 */
AND cdl.project_id = tmp.project_id
AND cdl.task_id = tmp.task_id
) acct_status_tot_bur,
decode(project_type_class_code, &apos;CAPITAL&apos;,
   (select case when cdl.transfer_status_code IN(&apos;P&apos;, &apos;A&apos;, &apos;V&apos;, &apos;T&apos;, &apos;R&apos;, &apos;G&apos;, &apos;B&apos;)
    AND(cdl.line_type = tmp.derive_tot_burden_flag
        OR cdl.line_type = DECODE(tmp.derive_tot_burden_flag, &apos;R&apos;, &apos;I&apos;, tmp.derive_tot_burden_flag)
       )
    AND( (cdl.line_type = &apos;I&apos;
        AND cdl.transfer_status_code = &apos;G&apos;)
       OR cdl.line_type IN(&apos;R&apos;, &apos;D&apos;)
        AND cdl.transfer_status_code IN(&apos;P&apos;, &apos;V&apos;, &apos;A&apos;, &apos;B&apos;)
       )
    AND cdl.billable_flag = &apos;Y&apos;
    and pa_utils.iseifinalaccounted(tmp.expenditure_item_id, cdl.line_num) = &apos;N&apos;
   then decode(tmp.capital_cost_type_code,&apos;R&apos;,nvl(cdl.amount, 0),&apos;B&apos;,nvl(cdl.burdened_cost, cdl.amount),nvl(cdl.amount, 0))
   else 0
   end
   from
           (
               SELECT
                   cd.*
               FROM
                   (
                       SELECT
                           c.expenditure_item_id,
                           c.transfer_status_code,
                           c.acct_event_id,
                           c.line_num,
                           c.amount,
                           c.burdened_cost,
                           c.billable_flag,
                           c.line_type
                       FROM
                           pa_cost_dist_lines_v c
                       WHERE c.creation_date &gt;= &apos;12-DEC-21&apos;
                           AND ( c.expenditure_item_id,
                                 c.line_num ) IN (
                               SELECT
                                   expenditure_item_id,
                                   MAX(line_num)
                               FROM
                                   pa_cost_dist_lines_v b
                               WHERE
                                   creation_date &gt;= &apos;12-DEC-21&apos;
                                   AND line_type in (&apos;R&apos;,&apos;D&apos;)
                               GROUP BY
                                   b.expenditure_item_id, b.line_type
                           )
                   ) cd
           ) cdl where cdl.line_type = tmp.DERIVE_TOT_BURDEN_FLAG and cdl.expenditure_item_id = tmp.expenditure_item_id)
           , 0) pending_final_accounting,
decode(project_type_class_code, &apos;CAPITAL&apos;,
   (select case when cdl.transfer_status_code IN(&apos;P&apos;, &apos;A&apos;, &apos;V&apos;, &apos;T&apos;, &apos;R&apos;, &apos;G&apos;, &apos;B&apos;)
    AND(cdl.line_type = tmp.derive_tot_burden_flag
        OR cdl.line_type = DECODE(tmp.derive_tot_burden_flag, &apos;R&apos;, &apos;I&apos;, tmp.derive_tot_burden_flag)
       )
    AND( (cdl.line_type = &apos;I&apos;
        AND cdl.transfer_status_code = &apos;G&apos;)
       OR cdl.line_type IN(&apos;R&apos;, &apos;D&apos;)
        AND cdl.transfer_status_code IN(&apos;P&apos;, &apos;V&apos;, &apos;A&apos;, &apos;B&apos;)
       )
    AND cdl.billable_flag = &apos;Y&apos;
	AND tmp.capitalized_flag = &apos;N&apos;
    and pa_utils.iseifinalaccounted(tmp.expenditure_item_id, cdl.line_num) = &apos;Y&apos;
   then decode(tmp.capital_cost_type_code,&apos;R&apos;,nvl(cdl.amount, 0),&apos;B&apos;,nvl(cdl.burdened_cost, cdl.amount),nvl(cdl.amount, 0))
   else 0
   end
   from
           (
               SELECT
                   cd.*
               FROM
                   (
                       SELECT
                           c.expenditure_item_id,
                           c.transfer_status_code,
                           c.acct_event_id,
                           c.line_num,
                           c.amount,
                           c.burdened_cost,
                           c.billable_flag,
                           c.line_type
                       FROM
                           pa_cost_dist_lines_v c
                       WHERE c.creation_date &gt;= &apos;12-DEC-21&apos;
                           AND ( c.expenditure_item_id,
                                 c.line_num ) IN (
                               SELECT
                                   expenditure_item_id,
                                   MAX(line_num)
                               FROM
                                   pa_cost_dist_lines_v b
                               WHERE
                                   creation_date &gt;= &apos;12-DEC-21&apos;
                                   AND line_type in (&apos;R&apos;,&apos;D&apos;)
                               GROUP BY
                                   b.expenditure_item_id, b.line_type
                           )
                   ) cd
           ) cdl where cdl.line_type = tmp.DERIVE_TOT_BURDEN_FLAG and cdl.expenditure_item_id = tmp.expenditure_item_id)
           , 0) proj_cost_pend_al_gen,
tmp.asset_asgn_exists_code,
DECODE(project_type_class_code, &apos;CAPITAL&apos;, pa_utils.get_lookup_values(&apos;PA_ASSET_ASG_LEVEL&apos;, tmp.asset_asgn_exists_code, tmp.language)) asset_assignment_exists,
tmp.grouped_task_id,
DECODE(project_type_class_code, &apos;CAPITAL&apos;, decode(tmp.grouped_task_id,-9999,NULL,(select task_number from pa_tasks where task_id = tmp.grouped_task_id))) grouped_task_number,
DECODE(project_type_class_code, &apos;CAPITAL&apos;, decode(tmp.grouped_task_id,-9999,NULL,(select task_name from pa_tasks where task_id = tmp.grouped_task_id))) grouped_task_name,
tmp.rate_source_id,  /* V6 */
tmp.discount_percentage,
tmp.rate_disc_reason_code,
pa_utils.get_lookup_values(&apos;RATE AND DISCOUNT REASON&apos;, tmp.rate_disc_reason_code, tmp.language) rate_discount_reason,
tmp.bill_markup_percentage,
tmp.bill_group,
tmp.projfunc_bill_amount,
tmp.bill_amount,
tmp.bill_rate,
tmp.revenue_hold_flag,
pa_utils.get_lookup_values(&apos;YES_NO&apos;, tmp.revenue_hold_flag, tmp.language) revenue_hold,
tmp.accrual_rate,
tmp.inventory_item_id,
tmp.inventory_item,
-9999 event_id,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; and (tmp.billed_flag = &apos;Y&apos; or tmp.revenue_distributed = &apos;Y&apos;)
     then &apos;EI-&apos;||tmp.expenditure_item_id else &apos;-9999&apos; end ei_ev_reference,
tmp.funding_task_id,
tmp.funding_task_name,
tmp.funding_task_number,
decode(tmp.billing_project_id, null, &apos;N&apos;, &apos;Y&apos;) billproj_display_flag,
bill_chart_period_name,
display_planrev_chart,
display_totexp_chart,
billed_flag,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; THEN
  case when tmp.billable_flag = &apos;N&apos; then &apos;NOBILL&apos;
      when tmp.cost_distributed_flag = &apos;N&apos; THEN &apos;UCST&apos;
     when tmp.cost_distributed_flag = &apos;Y&apos; THEN
     case
       when tmp.rev_dist_rejection_code is NULL and tmp.revenue_distributed in (&apos;N&apos;, &apos;P&apos;)
	        THEN &apos;GENREV&apos;
	   when tmp.rev_dist_rejection_code is NOT NULL and tmp.revenue_distributed in (&apos;N&apos;, &apos;P&apos;)
	        THEN &apos;REVREJ&apos;
       when ((tmp.inv_gen_rejection_code is NULL or (tmp.inv_gen_rejection_code = &apos;N&apos; and tmp.billed_flag = &apos;N&apos;))
            and (tmp.revenue_distributed = &apos;Y&apos; AND tmp.billable_flag = &apos;Y&apos;))
			THEN &apos;GENINV&apos;
	   when (tmp.inv_gen_rejection_code is NOT NULL and tmp.inv_gen_rejection_code &lt;&gt; &apos;N&apos; and tmp.revenue_distributed = &apos;Y&apos;)
	        THEN &apos;INVREJ&apos;
       when tmp.billable_flag = &apos;Y&apos; AND tmp.INVOICE_METHOD = &apos;WORK&apos; AND tmp.billed_flag = &apos;Y&apos;
	        THEN &apos;BILLED&apos;
	   else NULL
     end
  else NULL
  end
else NULL
end wip_status_code,
pa_utils.get_lookup_values(&apos;PA_BILL_ECC_WIP_STATUS&apos;,
		case when tmp.project_type_class_code = &apos;CONTRACT&apos; THEN
		  case when tmp.billable_flag = &apos;N&apos; then &apos;NOBILL&apos;
		     when tmp.cost_distributed_flag = &apos;N&apos; THEN &apos;UCST&apos;
			 when tmp.cost_distributed_flag = &apos;Y&apos; THEN
			 case
			   when tmp.rev_dist_rejection_code is NULL and tmp.revenue_distributed in (&apos;N&apos;, &apos;P&apos;)
			        THEN &apos;GENREV&apos;
			   when tmp.rev_dist_rejection_code is NOT NULL and tmp.revenue_distributed in (&apos;N&apos;, &apos;P&apos;)
			        THEN &apos;REVREJ&apos;
			   when ((tmp.inv_gen_rejection_code is NULL or (tmp.inv_gen_rejection_code = &apos;N&apos; and tmp.billed_flag = &apos;N&apos;))
			        and (tmp.revenue_distributed = &apos;Y&apos; AND tmp.billable_flag = &apos;Y&apos;))
					THEN &apos;GENINV&apos;
			   when (tmp.inv_gen_rejection_code is NOT NULL and tmp.inv_gen_rejection_code &lt;&gt; &apos;N&apos; and tmp.revenue_distributed = &apos;Y&apos;)
			        THEN &apos;INVREJ&apos;
			   when tmp.billable_flag = &apos;Y&apos; AND tmp.INVOICE_METHOD = &apos;WORK&apos; AND tmp.billed_flag = &apos;Y&apos;
			        THEN &apos;BILLED&apos;
			   else NULL
			 end
		  else NULL
		  end
		else NULL
		end
 , tmp.language) wip_status,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.billed_flag = &apos;Y&apos; and tmp.billable_flag = &apos;Y&apos; THEN
     tmp.billdb_pfc_bill_amount else 0 end billable_billed_pfc_amt,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.billed_flag = &apos;N&apos; and tmp.billable_flag = &apos;Y&apos; THEN
     tmp.billdb_pfc_bill_amount else 0 end billable_nonbilled_pfc_amt,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.cost_distributed_flag = &apos;Y&apos; and tmp.billable_flag = &apos;Y&apos; THEN
      tmp.billdb_pfc_bill_amount else 0 end billable_pfc_amt,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.projfunc_bill_amount is not null then &apos;N&apos; else &apos;Y&apos; end derived_bill_amt_flag,
tmp.billdb_pfc_bill_amount,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.revenue_hold_flag &lt;&gt; &apos;N&apos;
     then tmp.billdb_pfc_bill_amount else 0 end ei_revenue_hold_amt,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.rev_dist_rejection_code is not null
     and tmp.revenue_distributed in (&apos;N&apos;, &apos;P&apos;) and tmp.revenue_hold_flag = &apos;N&apos;
     then tmp.billdb_pfc_bill_amount else 0 end ei_rev_dist_rej_amt,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.inv_gen_rejection_code is not null
     and tmp.inv_gen_rejection_code &lt;&gt; &apos;N&apos; and tmp.revenue_distributed = &apos;Y&apos; and tmp.bill_hold_flag = &apos;N&apos;
     then tmp.billdb_pfc_bill_amount else 0 end ei_inv_gen_rej_amt,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.rev_dist_rejection_code is NULL
     and tmp.revenue_distributed in (&apos;N&apos;, &apos;P&apos;) and tmp.revenue_hold_flag = &apos;N&apos;
     then tmp.billdb_pfc_bill_amount else 0 end ei_pend_gen_rev_amt,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.inv_gen_rejection_code is NULL and tmp.revenue_distributed = &apos;Y&apos;
     and tmp.billable_flag = &apos;Y&apos; and tmp.bill_hold_flag = &apos;N&apos; then tmp.billdb_pfc_bill_amount else 0 end ei_pend_gen_inv_amt,
case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.billable_flag = &apos;Y&apos; and nvl(tmp.bill_hold_flag, &apos;N&apos;) = &apos;Y&apos; then tmp.billdb_pfc_bill_amount else 0 end ei_bill_hold_amt,
    0 evt_revenue_hold_amt,
	0 evt_rev_dist_rej_amt,
	0 evt_inv_gen_rej_amt,
	0 evt_pend_gen_rev_amt,
	0 evt_pend_gen_inv_amt,
	0 evt_bill_hold_amt,
	0 evt_pfc_rev_derived_amt,
     tmp.project_id||&apos;:&apos;||tmp.funding_task_id||&apos;:&apos;||
               case when tmp.project_type_class_code = &apos;CONTRACT&apos; and (tmp.billed_flag = &apos;Y&apos; or tmp.revenue_distributed = &apos;Y&apos;)
                then &apos;EI-&apos;||tmp.expenditure_item_id else &apos;-9999&apos; end DS_ASSOC_PRJ_TSK_EE_ATTR,
     tmp.project_id||&apos;:&apos;||tmp.funding_task_id||&apos;:&apos;||
               case when tmp.project_type_class_code = &apos;CONTRACT&apos; and (tmp.billed_flag = &apos;Y&apos; or tmp.revenue_distributed = &apos;Y&apos;)
                then &apos;EI-&apos;||tmp.expenditure_item_id else &apos;-9999&apos; end ||&apos;:&apos;||bill_gl_period_name DS_ASSOC_PRJ_TSK_EE_PER_ATTR,
     tmp.project_id||&apos;:&apos;||tmp.funding_task_id||&apos;:&apos;||bill_gl_period_name DS_ASSOC_PRJ_TSK_PER_ATTR,
     case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.billable_flag = &apos;Y&apos; and tmp.revenue_distributed &lt;&gt; &apos;N&apos;
	 and nvl(tmp.bill_hold_flag, &apos;N&apos;) = &apos;N&apos; and tmp.billed_flag &lt;&gt; &apos;Y&apos; then tmp.billdb_pfc_bill_amount else 0 end ei_ready_to_bill_amt,
	 case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.billable_flag = &apos;Y&apos; and tmp.revenue_distributed = &apos;N&apos;
	 and nvl(tmp.bill_hold_flag, &apos;N&apos;) = &apos;N&apos; then tmp.billdb_pfc_bill_amount else 0 end ei_unaccrued_amt,
	 pa_ecc_bill_load_pkg.get_three_quarter_flag(tmp.set_of_books_id, tmp.bill_gl_period_name) period_disp_flag,
	 gl_period_start_date,
	 case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.cost_distributed_flag = &apos;Y&apos; and tmp.billable_flag = &apos;Y&apos;
	 and tmp.revenue_distributed &lt;&gt; &apos;N&apos; and nvl(tmp.bill_hold_flag, &apos;N&apos;) = &apos;N&apos; and tmp.billed_flag &lt;&gt; &apos;Y&apos;
	 then &apos;Y&apos; else &apos;N&apos; end ready_to_bill_flag,
	 case when tmp.project_type_class_code = &apos;CONTRACT&apos; and tmp.cost_distributed_flag = &apos;Y&apos; and tmp.billable_flag = &apos;Y&apos;
	 and tmp.revenue_distributed = &apos;N&apos; and nvl(tmp.bill_hold_flag, &apos;N&apos;) = &apos;N&apos; then &apos;Y&apos; else &apos;N&apos; end ei_unaccrued_flag

 , dfv2.* 
from
(
SELECT DISTINCT /*+ push_pred(ei) */
&apos;PROJ_DS_EICDL&apos; record_type,
&apos;PROJ-&apos;
|| TO_CHAR(ei.expenditure_item_id) ecc_spec_id,
ei.expenditure_item_id,
ei.expenditure_id,
ei.project_id,
ei.project_name,
ei.project_number,
ei.project_type user_project_type,
ei.project_type_class_code ,
ei.CAPITAL_COST_TYPE_CODE,
pa_utils.get_lookup_values(&apos;PROJECT TYPE CLASS&apos;, ei.project_type_class_code, ei.language) project_type,
ei.DERIVE_TOT_BURDEN_FLAG,
ei.project_manager,
ei.project_start_date,
ei.project_completion_date,
ei.project_organization,
ei.task_burden_schedule,
ei.project_burden_schedule,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,ei.task_billable_flag,ei.language) task_billable_flag,
ei.task_work_type,
ei.project_status_name,
ei.project_status,
(SELECT
        nvl(SUM(DECODE(ei.capital_cost_type_code, &apos;R&apos;, nvl(pbl.raw_cost, 0), nvl(pbl.burdened_cost, 0
        ))), 0)
    FROM
        pa_budget_versions pbv,
        pa_budget_lines pbl,
        pa_resource_assignments pra,
        pa_budget_types pbt
    WHERE
        pbv.project_id = ei.project_id
        AND pbv.budget_type_code = pbt.budget_type_code
        AND pbt.budget_amount_code = &apos;C&apos;
        AND pbv.budget_status_code = &apos;B&apos;
        AND pbv.current_flag = &apos;Y&apos;
        AND pra.budget_version_id = pbv.budget_version_id
        AND pra.project_id = pbv.project_id
        AND pbl.budget_version_id = pra.budget_version_id
        AND pbl.resource_assignment_id = pra.resource_assignment_id
) project_budget,
(SELECT
        (decode(project_type_class_code,&apos;CAPITAL&apos;,nvl(SUM(DECODE(ei.capital_cost_type_code, &apos;R&apos;, nvl(pbl.raw_cost, 0), nvl(pbl.burdened_cost, 0
        ))), 0),0))
    FROM
        pa_budget_versions pbv,
        pa_budget_lines pbl,
        pa_resource_assignments pra,
        pa_budget_types pbt
    WHERE
        pbv.project_id = ei.project_id
		AND pra.task_id = ei.task_id
		AND ei.task_billable_flag = &apos;Y&apos;
        AND pbv.budget_type_code = pbt.budget_type_code
        AND pbt.budget_amount_code = &apos;C&apos;
        AND pbv.budget_status_code = &apos;B&apos;
        AND pbv.current_flag = &apos;Y&apos;
        AND pra.budget_version_id = pbv.budget_version_id
        AND pra.project_id = pbv.project_id
        AND pbl.budget_version_id = pra.budget_version_id
        AND pbl.resource_assignment_id = pra.resource_assignment_id
) task_plan_capitalizable,
(SELECT
        (decode(project_type_class_code,&apos;CAPITAL&apos;,nvl(SUM(DECODE(ei.capital_cost_type_code, &apos;R&apos;, nvl(pbl.raw_cost, 0), nvl(pbl.burdened_cost, 0
        ))), 0),0))
    FROM
        pa_budget_versions pbv,
        pa_budget_lines pbl,
        pa_resource_assignments pra,
        pa_budget_types pbt
    WHERE
        pbv.project_id = ei.project_id
		AND pra.task_id = ei.task_id
		AND ei.task_billable_flag = &apos;N&apos;
        AND pbv.budget_type_code = pbt.budget_type_code
        AND pbt.budget_amount_code = &apos;C&apos;
        AND pbv.budget_status_code = &apos;B&apos;
        AND pbv.current_flag = &apos;Y&apos;
        AND pra.budget_version_id = pbv.budget_version_id
        AND pra.project_id = pbv.project_id
        AND pbl.budget_version_id = pra.budget_version_id
        AND pbl.resource_assignment_id = pra.resource_assignment_id
) task_non_plan_capitalize,
(
(SELECT
        (decode(project_type_class_code,&apos;CAPITAL&apos;,nvl(SUM(DECODE(ei.capital_cost_type_code, &apos;R&apos;, nvl(pbl.raw_cost, 0), nvl(pbl.burdened_cost, 0
        ))), 0),0))
    FROM
        pa_budget_versions pbv,
        pa_budget_lines pbl,
        pa_resource_assignments pra,
        pa_budget_types pbt,
		pa_budget_entry_methods bem
    WHERE
        pbv.project_id = ei.project_id
        AND pbv.budget_type_code = pbt.budget_type_code
        AND pbt.budget_amount_code = &apos;C&apos;
        AND pbv.budget_status_code = &apos;B&apos;
        AND pbv.current_flag = &apos;Y&apos;
        AND pbv.budget_entry_method_code = bem.budget_entry_method_code
        and bem.entry_level_code = &apos;P&apos;
        AND pra.budget_version_id = pbv.budget_version_id
        AND pra.project_id = pbv.project_id
        AND pbl.budget_version_id = pra.budget_version_id
        AND pbl.resource_assignment_id = pra.resource_assignment_id)
	+
(SELECT
        (decode(project_type_class_code,&apos;CAPITAL&apos;,nvl(SUM(DECODE(ei.capital_cost_type_code, &apos;R&apos;, nvl(pbl.raw_cost, 0), nvl(pbl.burdened_cost, 0
        ))), 0),0))
    FROM
        pa_budget_versions pbv,
        pa_budget_lines pbl,
        pa_resource_assignments pra,
        pa_budget_types pbt,
		pa_budget_entry_methods bem,
        pa_tasks pt
    WHERE
        pbv.project_id = ei.project_id
		AND pra.task_id = pt.task_id
		AND pt.billable_flag = &apos;Y&apos;
        AND pbv.budget_type_code = pbt.budget_type_code
        AND pbt.budget_amount_code = &apos;C&apos;
        AND pbv.budget_status_code = &apos;B&apos;
        AND pbv.current_flag = &apos;Y&apos;
        AND pbv.budget_entry_method_code = bem.budget_entry_method_code
        and bem.entry_level_code in ( &apos;M&apos;, &apos;L&apos;, &apos;T&apos;)
        AND pra.budget_version_id = pbv.budget_version_id
        AND pra.project_id = pbv.project_id
        AND pbl.budget_version_id = pra.budget_version_id
        AND pbl.resource_assignment_id = pra.resource_assignment_id)
) proj_plan_capitalize,
(
SELECT
        (decode(project_type_class_code,&apos;CAPITAL&apos;,nvl(SUM(DECODE(ei.capital_cost_type_code, &apos;R&apos;, nvl(pbl.raw_cost, 0), nvl(pbl.burdened_cost, 0
        ))), 0),0))
    FROM
        pa_budget_versions pbv,
        pa_budget_lines pbl,
        pa_resource_assignments pra,
        pa_budget_types pbt,
		pa_budget_entry_methods bem,
        pa_tasks pt
    WHERE
        pbv.project_id = ei.project_id
		AND pra.task_id = pt.task_id
		AND pt.billable_flag = &apos;N&apos;
        AND pbv.budget_type_code = pbt.budget_type_code
        AND pbt.budget_amount_code = &apos;C&apos;
        AND pbv.budget_status_code = &apos;B&apos;
        AND pbv.current_flag = &apos;Y&apos;
        AND pbv.budget_entry_method_code = bem.budget_entry_method_code
        and bem.entry_level_code in ( &apos;M&apos;, &apos;L&apos;, &apos;T&apos;)
        AND pra.budget_version_id = pbv.budget_version_id
        AND pra.project_id = pbv.project_id
        AND pbl.budget_version_id = pra.budget_version_id
        AND pbl.resource_assignment_id = pra.resource_assignment_id
) proj_non_plan_capitalize,
     DECODE(project_type_class_code, &apos;CAPITAL&apos;, nvl(
        (SELECT
            SUM(DECODE(ei.capital_cost_type_code, &apos;R&apos;, nvl(paie.raw_cost, 0), nvl(paie.burden_cost, 0) ))
        FROM
            pa_expenditure_items_all paie
        WHERE
            paie.project_id = ei.project_id
			AND paie.billable_flag = &apos;Y&apos;
            AND paie.creation_date &gt;= &apos;12-DEC-21&apos;
    ),0), 0)  proj_capitalizable,
     DECODE(project_type_class_code, &apos;CAPITAL&apos;, nvl(
        (SELECT
            SUM(DECODE(ei.capital_cost_type_code, &apos;R&apos;, nvl(paie.raw_cost, 0), nvl(paie.burden_cost, 0) ))
        FROM
            pa_expenditure_items_all paie
        WHERE
            paie.project_id = ei.project_id
			AND paie.billable_flag = &apos;N&apos;
            AND paie.creation_date &gt;= &apos;12-DEC-21&apos;
    ),0), 0)  proj_non_capitalizable,
(decode(project_type_class_code,&apos;CAPITAL&apos;,decode(ei.capitalizable_flag,&apos;Y&apos;,(nvl(DECODE(ei.capital_cost_type_code, &apos;R&apos;, nvl(ei.raw_cost, 0), nvl(ei.burdened_cost, 0
        )), 0)),0),0))actual_capitalizable,
(decode(project_type_class_code,&apos;CAPITAL&apos;,decode(ei.capitalizable_flag,&apos;N&apos;,(nvl(DECODE(ei.capital_cost_type_code, &apos;R&apos;, nvl(ei.raw_cost, 0), nvl(ei.burdened_cost, 0
        )), 0)),0),0))actual_non_capitalizable,
( DECODE(project_type_class_code, &apos;CAPITAL&apos;, DECODE(ei.capitalizable_flag, &apos;Y&apos;,decode(ei.capitalized_flag,&apos;N&apos;,(nvl(DECODE(ei.capital_cost_type_code
, &apos;R&apos;, nvl(ei.raw_cost, 0), nvl(ei.burdened_cost, 0)), 0)),0), 0), 0) ) actual_yet_to_capitalizable,
(SELECT
        SUM(nvl(pbl.revenue,0))
    FROM
        pa_budget_versions pbv,
        pa_budget_lines pbl,
        pa_resource_assignments pra,
        pa_budget_types pbt
    WHERE
        pbv.project_id = ei.project_id
        AND pbv.budget_type_code = pbt.budget_type_code
        AND pbt.budget_amount_code = &apos;R&apos;
        AND pbv.budget_status_code = &apos;B&apos;
        AND pbv.current_flag = &apos;Y&apos;
        AND pra.budget_version_id = pbv.budget_version_id
        AND pra.project_id = pbv.project_id
        AND pbl.budget_version_id = pra.budget_version_id
        AND pbl.resource_assignment_id = pra.resource_assignment_id
)project_revenue_budget,
ei.proj_grouping_method,
ei.proj_grp_supplier_invoice,
ei.proj_asset_cost_alloc_mhd,
pa_utils.get_lookup_values(&apos;YES_NO&apos;, ei.total_burden_flag, ei.language) proj_enbl_burden_cost_acc,
(SELECT per.period_name FROM pa_periods_all per
 where start_date in
         (select max(start_date) from pa_periods_all per1
          where per1.status in (&apos;O&apos;,&apos;F&apos;)
          and per1.org_id = ei.org_id)
      and per.org_id = ei.org_id) current_pa_period,
(SELECT per.gl_period_name FROM pa_periods_all per
 where start_date in
         (select max(start_date) from pa_periods_all per1
          where per1.status in (&apos;O&apos;,&apos;F&apos;)
          and per1.org_id = ei.org_id)
      and per.org_id = ei.org_id) current_gl_period,
(select per.period_name from pa_periods_all per where ei.org_id = per.org_id
 		AND per.current_pa_period_flag = &apos;Y&apos;) current_reporting_pa_period, /* Bug#31692951 */
ei.projfunc_currency_code,
(decode(project_type_class_code,&apos;CAPITAL&apos;,(select count( project_asset_id ) from pa_project_assets_all ppaa where ppaa.project_id = ei.project_id),0)) number_of_assets,
(decode(project_type_class_code,&apos;CAPITAL&apos;,nvl((select sum( current_asset_cost ) from pa_project_asset_lines_all ppal where ppal.project_id = ei.project_id and ppal.transfer_status_code = &apos;T&apos;
                            		AND EXISTS(  SELECT   1
                     FROM pa_expenditure_items_all peia,pa_project_asset_line_Details ppald
                     WHERE peia.expenditure_item_id = ppald.expenditure_item_id
                     and  ppal.project_asset_line_detail_id = ppald.project_asset_line_detail_id
				     and peia.project_id = ei.project_id
                     AND peia.creation_date &gt;= &apos;12-DEC-21&apos;
                  )),0),0)) proj_capitalized_cost,
ei.task_id,
ei.task_number,
ei.task_name,
ei.top_task_id,
ei.top_task_name,
ei.top_task_number,
ei.task_start_date,
ei.task_finish_date,
ei.task_manager,
ei.task_organization,
ei.expenditure_item_date,
ei.expenditure_ending_date expenditure_week_ending_date,
ei.expenditure_type,
ei.expenditure_category,
ei.expenditure_type_class,
ei.incurred_by_person_id,
ei.employee_name,
ei.employee_number,
ei.location_code,
ei.job_id,
ei.job_name,
ei.incurred_by_organization_id,
ei.override_to_organization_id,
ei.expenditure_organization_id,
ei.expenditure_org_name,
ei.non_labor_resource,
ei.system_linkage_function,
ei.transaction_source transaction_source_code,
ei.user_transaction_source transaction_source,
ei.orig_transaction_reference orig_transaction_ref,
ei.expenditure_group,
(CASE
WHEN ei.cost_distributed_flag = &apos;Y&apos;
     AND ei.cost_burden_distributed_flag = &apos;N&apos; THEN &apos;Y&apos;
ELSE null
END)ei_pend_burden_dist,
( CASE
    WHEN ei.expenditure_group_status_code IN (
        &apos;UPDATE_RELEASED&apos;,
        &apos;RELEASED&apos;
    ) THEN null
    ELSE &apos;Y&apos;
END ) ei_group_unreleased,
(case when ei.cost_dist_rejection_code is not null then &apos;Y&apos; else null end) ei_cost_exception,
(case when ei.expenditure_group_status_code IN (
        &apos;UPDATE_RELEASED&apos;,
        &apos;RELEASED&apos;
    ) AND ei.cost_distributed_flag = &apos;N&apos; then &apos;Y&apos; else null end) ei_uncosted,
DECODE(ei.cost_distributed_flag, &apos;Y&apos;, &apos;Y&apos;, null) ei_costed,
DECODE(ei.cost_distributed_flag, &apos;Y&apos;, nvl(ei.burden_cost, 0), 0) ei_costed_value,
ei.quantity,
decode(ei.cost_distributed_flag,&apos;Y&apos;,ei.burden_cost,0) burden_cost,
( CASE
    WHEN ei.system_linkage_function IN (
        &apos;OT&apos;,
        &apos;ST&apos;
    ) THEN nvl(ei.burden_cost, 0)
    ELSE 0
END ) ei_labor_cost,
( CASE
    WHEN ei.system_linkage_function IN (
        &apos;OT&apos;,
        &apos;ST&apos;
    ) THEN 0
    ELSE nvl(ei.burden_cost, 0)
END ) ei_non_labor_cost,
ei.unit_of_measure,
ei.unit_of_measure_m,
decode(ei.cost_distributed_flag,&apos;Y&apos;,ei.raw_cost,0) raw_cost,
decode(ei.cost_distributed_flag,&apos;Y&apos;,ei.raw_cost_rate,0) raw_cost_rate,
ei.cost_distributed_flag cost_distributed_flag,
pa_utils.get_lookup_values(&apos;YES_NO&apos;, ei.cost_distributed_flag, ei.language) cost_distributed,
pa_funds_control_utils.get_cost_rejection_reason(NVL(ei.cost_dist_rejection_code,ei.IND_COST_DIST_REJECTION_CODE),NULL) cost_dist_rejection_code,
decode(ei.project_type_class_code ,&apos;INDIRECT&apos;,NULL,&apos;CAPITAL&apos;,NULL,NVL(ei.revenue_distributed_flag,ei.capitalized_flag)) revenue_distributed,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,decode(ei.project_type_class_code ,&apos;INDIRECT&apos;,NULL,&apos;CAPITAL&apos;,NULL,NVL(ei.revenue_distributed_flag,ei.capitalized_flag)), ei.language) revenue_distributed_flag,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,(CASE WHEN ei.project_type_class_code = &apos;CONTRACT&apos; AND bill_amount IS NOT NULL THEN &apos;Y&apos;
WHEN ei.project_type_class_code = &apos;CONTRACT&apos; AND bill_amount IS NULL THEN &apos;N&apos;
ELSE NULL END), ei.language) billed,
ei.billable_flag  billable_flag,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,ei.billable_flag,ei.language)  billable,
ei.bill_hold_flag ,
pa_utils.get_lookup_values(&apos;BILLING HOLD&apos;,ei.bill_hold_flag,ei.language) bill_hold,
( CASE
WHEN ei.billable_flag = &apos;Y&apos;
AND ei.bill_amount IS NOT NULL
AND nvl(ei.net_zero_adjustment_flag, &apos;N&apos;) = &apos;N&apos;
AND ei.INVOICE_METHOD = &apos;WORK&apos;
AND ei.cost_distributed_flag = &apos;Y&apos; THEN ei.bill_amount
ELSE 0
END ) billed_cost,
( CASE
WHEN ei.billable_flag = &apos;Y&apos;
AND ei.bill_amount IS NULL
AND nvl(ei.net_zero_adjustment_flag, &apos;N&apos;) = &apos;N&apos;
AND ei.INVOICE_METHOD = &apos;WORK&apos;
AND ei.cost_distributed_flag = &apos;Y&apos; THEN ei.BURDEN_COST
ELSE 0
END ) billable_unbilled_cost,
( CASE
WHEN ei.billable_flag = &apos;Y&apos;
AND ei.bill_amount IS NULL
AND ei.bill_hold_flag = &apos;Y&apos;
AND nvl(ei.net_zero_adjustment_flag, &apos;N&apos;) = &apos;N&apos;
AND ei.INVOICE_METHOD = &apos;WORK&apos;
AND ei.cost_distributed_flag = &apos;Y&apos; THEN ei.BURDEN_COST
ELSE 0
END ) billable_onhold_cost,
case when ei.cost_distributed_flag = &apos;Y&apos; and ei.project_type_class_code = &apos;CONTRACT&apos; then ei.bill_billable_cost else 0 end bill_billable_cost,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,ei.bill_nonbilable_flag,ei.language) bill_nonbilable_flag,
case when ei.cost_distributed_flag = &apos;Y&apos; and ei.project_type_class_code = &apos;CONTRACT&apos; then ei.bill_nonbilable_cost else 0 end bill_nonbilable_cost,
ei.bill_billhold_cost,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,ei.bill_billed_flag,ei.language) bill_billed_flag,
ei.bill_billed_cost,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,ei.bill_not_billed_flag,ei.language) bill_not_billed_flag,
ei.bill_not_billed_cost,
(case when ei.project_type_class_code = &apos;CONTRACT&apos; AND ei.billable_flag = &apos;Y&apos; AND ei.bill_amount IS NULL AND ei.cost_distributed_flag = &apos;Y&apos; AND ei.invoice_method = &apos;WORK&apos; then ei.burden_cost else 0 end)ei_work_burden_cost,
decode(ei.cost_distributed_flag,&apos;Y&apos;,ei.burdened_cost,0) burdened_cost,
decode(ei.cost_distributed_flag,&apos;Y&apos;,ei.burdened_cost_rate,0) burdened_cost_rate,
ei.denom_currency_code,
decode(ei.cost_distributed_flag,&apos;Y&apos;,ei.denom_raw_cost,0) denom_raw_cost,
decode(ei.cost_distributed_flag,&apos;Y&apos;,ei.denom_burdened_cost,0) denom_burdened_cost,
ei.acct_currency_code,
ei.acct_rate_type,
ei.acct_rate_date,
ei.acct_exchange_rate,
decode(ei.cost_distributed_flag,&apos;Y&apos;,ei.acct_raw_cost,0) acct_raw_cost,
decode(ei.cost_distributed_flag,&apos;Y&apos;,ei.acct_burdened_cost,0) acct_burdened_cost,
( DECODE(ei.capitalizable_flag, &apos;Y&apos;, DECODE(ei.capitalized_flag, &apos;N&apos;, ei.BURDEN_COST, 0), 0) - DECODE(
ei.capitalized_flag, &apos;Y&apos;, ei.BURDEN_COST, 0) - DECODE(ei.capitalizable_flag, &apos;N&apos;, ei.BURDEN_COST
, 0) ) cip_cost,
ei.project_currency_code,
decode(ei.cost_distributed_flag,&apos;Y&apos;,ei.project_raw_cost,0) project_raw_cost,
decode(ei.cost_distributed_flag,&apos;Y&apos;,ei.project_burdened_cost,0) project_burdened_cost,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,ei.cost_burden_distributed_flag,ei.language) cost_bur_distributed_flag,
ei.capitalizable_flag,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,ei.capitalizable_flag,ei.language) capitalizable,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,ei.asset_line_generated,ei.language) asset_line_generated,
ei.capitalized_flag,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,ei.capitalized_flag,ei.language) capitalized,
ei.bill_hold_flag capitalizable_cap_hold_flag,
decode(ei.project_type_class_code,&apos;CAPITAL&apos;,pa_utils.get_lookup_values(&apos;YES_NO&apos;,ei.bill_hold_flag,ei.language)) capitalizable_cap_hold,
ei.adjusted_expenditure_item_id,
ei.net_zero_adjustment_flag ,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,ei.net_zero_adjustment_flag,ei.language) net_zero_adjustment,
ei.transferred_from_exp_item_id,
ei.transferred_item_flag,
pa_utils.get_lookup_values(&apos;CC_CROSS_CHARGE_CODE&apos;, ei.cc_cross_charge_code, ei.language) cc_cross_charge_code,
pa_utils.get_lookup_values(&apos;CC_CROSS_CHARGE_TYPE&apos;, ei.cc_cross_charge_type, ei.language) cc_cross_charge_type,
pa_utils.get_lookup_values(&apos;CC_PROCESSED_CODE&apos;, ei.cc_bl_distributed_code, ei.language) cc_bl_distributed_code,
ei.org_id,
ei.vendor_id,
decode (ei.vendor_id, null, null, (
SELECT
vendor_name
FROM
ap_suppliers
WHERE
vendor_id = ei.vendor_id
)) vendor_name, /* Bug#30749534 */
ei.document_header_id,
ei.document_distribution_id,
ei.document_line_number,
ei.document_payment_id,
ei.document_type,
ei.document_distribution_type,
ei.prvdr_org_name Operating_Unit,
decode(ei.cost_distributed_flag,&apos;Y&apos;,DECODE(ei.capital_cost_type_code, &apos;R&apos;, ei.raw_cost, DECODE(ei.cost_burden_distributed_flag,&apos;Y&apos;, ei.BURDEN_COST,0)),0) capital_cost_code_amt,
cdl.line_num,
cdl.line_type line_type_code,
pa_utils.get_lookup_values(&apos;COST DISTRIBUTION LINE TYPE&apos;, cdl.line_type, ei.language) line_type,
cdl.reversed_flag,
cdl.transfer_status_code transfer_status_code,
cdl.pa_date,
cdl.gl_date,
cdl.recvr_pa_date,
cdl.recvr_gl_date,
cdl.pa_period_name,
cdl.gl_period_name,
cdl.recvr_pa_period_name,
cdl.recvr_gl_period_name,
cdl.acct_event_id,
decode(ei.cost_distributed_flag,&apos;Y&apos;,cdl.amount,0) amount,
decode(ei.cost_distributed_flag,&apos;Y&apos;,cdl.burdened_cost,0) cdl_burdened_cost,
decode(ei.cost_distributed_flag,&apos;Y&apos;,DECODE(ei.capital_cost_type_code, &apos;R&apos;, cdl.AMOUNT, NVL(cdl.BURDENED_COST,cdl.AMOUNT)),0) cdl_amount,
pa_utils.get_lookup_values(&apos;YES_NO&apos;,cdl.is_ei_final_accounted,ei.language) cdl_acct_status, /* Bug#30749534 */
/* pa_utils.get_lookup_values(&apos;PA_XLA_TRANSFER_STATUS&apos;,(SELECT
DECODE(xe.process_status_code, &apos;P&apos;, &apos;A&apos;, &apos;U&apos;, &apos;P&apos;, &apos;I&apos;, &apos;R&apos;) FROM xla_events xe, pa_cc_dist_lines_all cc
WHERE
xe.application_id = 275
AND xe.event_id = cc.acct_event_id
AND cc.expenditure_item_id = ei.expenditure_item_id
AND cc.line_num = cdl.line_num
AND ei.cc_bl_distributed_code = &apos;Y&apos;),ei.language) bl_acct_status,
*/ /* Bug#30749534 */
NULL bl_acct_status,
ei.expenditure_group_status_code exp_group_status_code,
pa_utils.get_lookup_values(&apos;EXPENDITURE GROUP STATUS&apos;, ei.expenditure_group_status_code, ei.language) exp_group_status,
ei.expenditure_status_code EXPENDITURE_STATUS,
( CASE
WHEN ei.cost_dist_rejection_code IS NOT NULL THEN &apos;CE&apos;
WHEN ei.cost_distributed_flag = &apos;N&apos; AND ei.expenditure_group_status_code not in (&apos;RELEASED&apos;,&apos;UPDATE_RELEASED&apos;) THEN &apos;UR&apos;
WHEN ei.cost_distributed_flag = &apos;N&apos; THEN &apos;UCST&apos;
WHEN ei.cost_distributed_flag = &apos;Y&apos; AND (cdl.transfer_status_code IN (&apos;X&apos;,&apos;R&apos;) OR xla.process_status_code = &apos;I&apos;) THEN &apos;CAE&apos;
WHEN ei.cost_distributed_flag = &apos;Y&apos; AND cdl.is_ei_final_accounted = &apos;Y&apos; THEN &apos;ACCT&apos;
WHEN ei.cost_distributed_flag = &apos;Y&apos; THEN &apos;CST&apos;
ELSE NULL
END ) precosting_status_code,
( CASE
WHEN ei.cost_dist_rejection_code IS NOT NULL THEN pa_utils.get_lookup_values(&apos;PA_EI_COSTING_STATUS&apos;,&apos;CE&apos;, ei.LANGUAGE)
WHEN ei.cost_distributed_flag = &apos;N&apos; AND ei.expenditure_group_status_code not in  (&apos;RELEASED&apos;, &apos;UPDATE_RELEASED&apos;) THEN pa_utils.get_lookup_values(&apos;PA_EI_COSTING_STATUS&apos;,&apos;UR&apos;, ei.LANGUAGE)
WHEN ei.cost_distributed_flag = &apos;N&apos; THEN pa_utils.get_lookup_values(&apos;PA_EI_COSTING_STATUS&apos;,&apos;UCST&apos;, ei.LANGUAGE)
WHEN ei.cost_distributed_flag = &apos;Y&apos; AND (cdl.transfer_status_code IN (&apos;X&apos;,&apos;R&apos;) OR xla.process_status_code = &apos;I&apos;) THEN pa_utils.get_lookup_values(&apos;PA_EI_COSTING_STATUS&apos;,&apos;CAE&apos;, ei.LANGUAGE)
WHEN ei.cost_distributed_flag = &apos;Y&apos; AND cdl.is_ei_final_accounted = &apos;Y&apos; THEN pa_utils.get_lookup_values(&apos;PA_EI_COSTING_STATUS&apos;,&apos;ACCT&apos;, ei.LANGUAGE)
WHEN ei.cost_distributed_flag = &apos;Y&apos; THEN pa_utils.get_lookup_values(&apos;PA_EI_COSTING_STATUS&apos;,&apos;CST&apos;, ei.LANGUAGE)
ELSE NULL
END ) precosting_status,
NULL asset_name,
ei.work_type_name WORK_TYPE,
(CASE WHEN ei.transaction_source LIKE &apos;PO%&apos; THEN NVL(EI.receipt_po_number,ei.po_number)
WHEN ei.transaction_source LIKE &apos;AP%&apos; THEN ei.matched_po_number
ELSE NULL
END
) po_number,
(CASE WHEN ei.transaction_source LIKE &apos;PO%&apos; THEN nvl(ei.receipt_po_line_num,ei.po_line_number)
WHEN ei.transaction_source LIKE &apos;AP%&apos; THEN ei.matched_po_line_number
ELSE NULL
END
) po_line_number,
(CASE WHEN ei.transaction_source LIKE &apos;PO%&apos; THEN ei.receipt_number
WHEN ei.transaction_source LIKE &apos;AP%&apos; THEN ei.matched_receipt_num
ELSE NULL
END) receipt_number,
(CASE WHEN ei.transaction_source LIKE &apos;PO%&apos; THEN ei.receipt_line_number
WHEN ei.transaction_source LIKE &apos;AP%&apos; THEN ei.matched_receipt_line_num
ELSE NULL
END) receipt_line_number,
ei.invoice_no,
ei.invoice_line_number,
(
CASE WHEN ei.transaction_source LIKE &apos;PO%&apos; THEN EI.po_distribution_line_num
WHEN ei.transaction_source LIKE &apos;AP%&apos; THEN ei.matched_po_dist_line_num
ELSE NULL
END
) po_distribution_line_number,
ei.invoice_distribution_line_num invoice_distribution_line_no,
(
SELECT
concatenated_segments
FROM
gl_code_combinations_kfv
WHERE
code_combination_id = cdl.dr_code_combination_id
) debit_account,
(
SELECT
concatenated_segments
FROM
gl_code_combinations_kfv
WHERE
code_combination_id = cdl.cr_code_combination_id
) credit_account,
(CASE
WHEN pa_xla_interface_pkg.get_source(ei.transaction_source, ei.document_payment_id) = &apos;PA&apos; and cdl.transfer_status_code in (&apos;V&apos;,&apos;A&apos;) THEN &apos;Projects Accounting&apos;
WHEN pa_xla_interface_pkg.get_source(ei.transaction_source, ei.document_payment_id) = &apos;RCV&apos; and cdl.transfer_status_code in (&apos;V&apos;,&apos;A&apos;) THEN &apos;Purchasing&apos;
WHEN pa_xla_interface_pkg.get_source(ei.transaction_source, ei.document_payment_id) = &apos;AP_PAY&apos; and cdl.transfer_status_code in (&apos;V&apos;,&apos;A&apos;) THEN &apos;Payables&apos;
WHEN pa_xla_interface_pkg.get_source(ei.transaction_source, ei.document_payment_id) = &apos;AP_INV&apos; and cdl.transfer_status_code in (&apos;V&apos;,&apos;A&apos;) THEN &apos;Payables&apos;
WHEN pa_xla_interface_pkg.get_source(ei.transaction_source, ei.document_payment_id) = &apos;INV&apos; and cdl.transfer_status_code in (&apos;V&apos;,&apos;A&apos;) THEN &apos;Inventory&apos;
WHEN pa_xla_interface_pkg.get_source(ei.transaction_source, ei.document_payment_id) = &apos;WIP&apos; and cdl.transfer_status_code in (&apos;V&apos;,&apos;A&apos;) THEN &apos;Work In Progress&apos;
ELSE NULL
END) accounting_source,
(pa_utils.get_lookup_values(&apos;TRANSFER STATUS&apos;, cdl.transfer_status_code, ei.language)) transfer_status,
ei.provider_le_name,
ei.receiver_le_name,
(
SELECT
name
FROM
hr_all_organization_units
WHERE
organization_id IN (
SELECT
to_number(org_information2)
FROM
hr_organization_information
WHERE
organization_id = ei.cc_recvr_organization_id
AND org_information_context = &apos;Operating Unit Information&apos;
)
) receiver_operating_unit,
ei.acct_transfer_price transfer_price,
/* Bug#30749534
(
SELECT
name
FROM
pa_cc_tp_schedules tps
WHERE
tps.tp_schedule_id = ei.labot_tp_sch_id
) labot_tp_sch_name,
(
SELECT
name
FROM
pa_cc_tp_schedules tps
WHERE
tps.tp_schedule_id = ei.non_labor_tp_sch_id
) non_labor_tp_sch_name,
*/
NULL labot_tp_sch_name,
NULL non_labor_tp_sch_name,
(CASE WHEN (cdl.transfer_status_code = &apos;A&apos; AND xla.gl_transfer_status_code = &apos;Y&apos; OR nvl(ei.historical_flag, &apos;Y&apos;) = &apos;Y&apos;)  THEN &apos;GL&apos;
WHEN  cdl.transfer_status_code = &apos;A&apos; AND xla.gl_transfer_status_code &lt;&gt; &apos;Y&apos; THEN &apos;PGL&apos;
WHEN  cdl.transfer_status_code = &apos;A&apos; AND /* pa_xla_interface_pkg.get_post_acc_sla_ccid(cdl.acct_event_id, cdl.transfer_status_code, ei.transaction_source
, nvl(ei.historical_flag, &apos;Y&apos;), cdl.expenditure_item_id, cdl.line_num, cdl.line_type, cdl.dr_code_combination_id
, &apos;DEBIT&apos;, ei.set_of_books_id) IS NOT NULL */ cdl.is_ei_final_accounted = &apos;Y&apos; THEN &apos;SLA&apos;
WHEN ( cdl.transfer_status_code IN (&apos;R&apos;,&apos;X&apos;) OR xla.process_status_code IN (&apos;I&apos;,&apos;U&apos;)) THEN &apos;PSLA&apos;
END) accounting_status_code,
pa_utils.get_lookup_values(&apos;PA_EI_ACCOUNTING_STATUS&apos;,(CASE WHEN  decode(cdl.transfer_status_code,&apos;X&apos;,&apos;PSLA&apos;,&apos;R&apos;,&apos;PSLA&apos;,&apos;P&apos;,&apos;PSLA&apos;,&apos;A&apos;,
DECODE(/* pa_xla_interface_pkg.get_post_acc_sla_ccid(cdl.acct_event_id, cdl.transfer_status_code, ei.transaction_source
, nvl(ei.historical_flag, &apos;Y&apos;), cdl.expenditure_item_id, cdl.line_num, cdl.line_type, cdl.dr_code_combination_id
, &apos;DEBIT&apos;, ei.set_of_books_id),NULL, */ cdl.is_ei_final_accounted, &apos;N&apos;,&apos;PSLA&apos;,&apos;SLA&apos;)) = &apos;PSLA&apos;
THEN &apos;PSLA&apos;
WHEN cdl.transfer_status_code NOT IN (&apos;V&apos;,&apos;G&apos;) THEN &apos;SLA&apos;
END),ei.language ) project_sla_acc_status,
pa_utils.get_lookup_values(&apos;PA_EI_ACCOUNTING_STATUS&apos;,(CASE WHEN ( xla.gl_transfer_status_code = &apos;Y&apos; OR nvl(ei.historical_flag, &apos;Y&apos;)= &apos;Y&apos;) THEN &apos;GL&apos;
WHEN xla.gl_transfer_status_code &lt;&gt; &apos;Y&apos;
AND /* pa_xla_interface_pkg.get_post_acc_sla_ccid(cdl.acct_event_id, cdl.transfer_status_code, ei.transaction_source
, nvl(ei.historical_flag, &apos;Y&apos;), cdl.expenditure_item_id, cdl.line_num, cdl.line_type, cdl.dr_code_combination_id
, &apos;DEBIT&apos;, ei.set_of_books_id) IS NOT NULL */ cdl.is_ei_final_accounted = &apos;Y&apos; THEN &apos;PGL&apos;
END),ei.language ) sla_gl_acc_status,
( CASE
  WHEN  (cdl.transfer_status_code IN (&apos;X&apos;,&apos;R&apos;) OR xla.process_status_code = &apos;I&apos;)
  THEN pa_utils.get_lookup_values(&apos;PA_EI_COSTING_STATUS&apos;,&apos;CAE&apos;,ei.language )
  WHEN  cdl.transfer_status_code = &apos;A&apos;
  THEN pa_utils.get_lookup_values(&apos;PA_EI_ACCOUNTING_STATUS&apos;,&apos;PA&apos; ,ei.language )
  ELSE NULL
  END) pre_accounting_status,
ei.project_exchange_rate,
ei.project_rate_date,
ei.project_rate_type,
ei.accrued_revenue REVENUE_ACCRUED,
ei.burden_schedule,
pa_utils.get_lookup_values(&apos;TRANSFER REJECTION CODE&apos;, cdl.transfer_rejection_reason, ei.language) transfer_rejection_reason,
/* (select pa_utils.get_lookup_values(&apos;CC_REJECTION_CODE&apos;, cc.transfer_rejection_code, ei.language)  from pa_cc_dist_lines_all cc
where cc.expenditure_item_id = cdl.expenditure_item_id
AND cc.line_num = cdl.line_num
AND transfer_rejection_code is not null) cc_rejection_reason, */ /* Bug#30749534 */
NULL cc_rejection_reason,
(CASE
WHEN ei.cost_dist_rejection_code IS NOT NULL
THEN ei.cost_dist_rejection_code
WHEN ei.ind_cost_dist_rejection_code IS NOT NULL
THEN ei.ind_cost_dist_rejection_code
WHEN ei.cc_rejection_code IS NOT NULL
THEN ei.cc_rejection_code
WHEN cdl.transfer_rejection_reason IS NOT NULL
THEN cdl.transfer_status_code
WHEN xla.process_status_code = &apos;I&apos;
THEN to_char(xla.message_number)
WHEN ei.project_type_class_code = &apos;CONTRACT&apos; AND ei.inv_gen_rejection_code IS NOT NULL AND ei.inv_gen_rejection_code &lt;&gt; &apos;N&apos;
THEN ei.inv_gen_rejection_code
WHEN ei.project_type_class_code = &apos;CONTRACT&apos; AND ei.rev_dist_rejection_code IS NOT NULL
THEN ei.rev_dist_rejection_code
END) alert_type,
(CASE
WHEN ei.cost_dist_rejection_code IS NOT NULL
THEN nvl( pa_utils.get_lookup_values(&apos;COST DIST REJECTION CODE&apos;, ei.cost_dist_rejection_code, ei.language) ,
pa_utils.get_lookup_values(&apos;FC_RESULT_CODE&apos;, ei.cost_dist_rejection_code, ei.language) )
WHEN ei.ind_cost_dist_rejection_code IS NOT NULL
THEN pa_utils.get_lookup_values(&apos;IND COST DIST REJECTION CODE&apos;, ei.ind_cost_dist_rejection_code, ei.language)
WHEN ei.cc_rejection_code IS NOT NULL
THEN pa_utils.get_lookup_values(&apos;CC_REJECTION_CODE&apos;, ei.cc_rejection_code, ei.language)
WHEN cdl.transfer_rejection_reason IS NOT NULL
THEN cdl.transfer_rejection_reason
WHEN xla.process_status_code = &apos;I&apos;
THEN xla.encoded_msg
WHEN ei.project_type_class_code = &apos;CONTRACT&apos; AND ei.inv_gen_rejection_code IS NOT NULL AND ei.inv_gen_rejection_code &lt;&gt; &apos;N&apos;
THEN pa_utils.get_lookup_values(&apos;REVENUE DIST REJECTION CODE&apos;, ei.inv_gen_rejection_code, ei.language)
WHEN ei.project_type_class_code = &apos;CONTRACT&apos; AND ei.rev_dist_rejection_code IS NOT NULL
THEN pa_utils.get_lookup_values(&apos;REVENUE DIST REJECTION CODE&apos;, ei.rev_dist_rejection_code, ei.language)
END) alert_text,
decode(ei.system_linkage_function,&apos;ST&apos;,&apos;L&apos;,&apos;OT&apos;,&apos;L&apos;,&apos;NL&apos;) cost_identifier,
decode(cdl.transfer_status_code,&apos;R&apos;,&apos;Unaccounted&apos;,&apos;X&apos;,&apos;Unaccounted&apos;,&apos;P&apos;,&apos;Unaccounted&apos;,null) unaccounted,
decode(cdl.transfer_status_code,&apos;R&apos;,&apos;AccountingException&apos;,&apos;X&apos;,&apos;AccountingException&apos;,decode(xla.process_status_code,&apos;I&apos;,&apos;AccountingException&apos;,null)) accounting_exception,
( CASE
WHEN cdl.transfer_status_code = &apos;A&apos;
THEN &apos;Y&apos;
ELSE null
END ) project_accounted,
( CASE
WHEN cdl.transfer_status_code = &apos;A&apos;
AND /* pa_xla_interface_pkg.get_post_acc_sla_ccid(cdl.acct_event_id, cdl.transfer_status_code, ei.transaction_source
, nvl(ei.historical_flag, &apos;Y&apos;), cdl.expenditure_item_id, cdl.line_num, cdl.line_type, cdl.dr_code_combination_id
, &apos;DEBIT&apos;, ei.set_of_books_id) IS NOT NULL */
cdl.is_ei_final_accounted = &apos;Y&apos;
THEN &apos;Y&apos;
ELSE null
END ) sla_accounted,
( CASE
WHEN xla.gl_transfer_status_code = &apos;Y&apos;
THEN &apos;Y&apos;
ELSE null
END ) gl_accounted,
(case WHEN (cdl.transfer_status_code IN (&apos;X&apos;,&apos;R&apos;) OR xla.process_status_code = &apos;I&apos;) then &apos;Y&apos; else null end) ei_account_exception,
(case WHEN cdl.is_ei_final_accounted = &apos;Y&apos; THEN &apos;Y&apos; else null end) ei_accounted,
pa_xla_interface_pkg.get_post_acc_sla_ccid
(
cdl.acct_event_id,
cdl.transfer_status_code,
ei.transaction_source,
nvl(ei.historical_flag, &apos;Y&apos;),
decode(pa_xla_interface_pkg.get_source(ei.transaction_source,ei.document_payment_id),
&apos;PA&apos;, cdl.expenditure_item_id,
&apos;AP_PAY&apos;, cdl.system_reference5,
&apos;AP_INV&apos;, ei.document_distribution_id,
&apos;RCV&apos;, cdl.system_reference5,
&apos;INV&apos;, cdl.system_reference5,
&apos;WIP&apos;, cdl.system_reference5),
decode(pa_xla_interface_pkg.get_source(ei.transaction_source,ei.document_payment_id),
&apos;PA&apos;, cdl.line_num,
&apos;AP_PAY&apos;, ei.document_distribution_id,
&apos;AP_INV&apos;, NULL,
&apos;RCV&apos;, NULL,
&apos;INV&apos;, NULL,
&apos;WIP&apos;, NULL),
cdl.line_type,
cdl.dr_code_combination_id,
&apos;DEBIT&apos;,
ei.set_of_books_id
) sla_acct_code,
ei.historical_flag,
ei.set_of_books_id,
DECODE(project_type_class_code, &apos;CAPITAL&apos;, pa_ecc_cost_proj_pkg.get_task_asset_asmt_lvl(ei.project_id, ei.task_id)) asset_asgn_exists_code,
DECODE(project_type_class_code, &apos;CAPITAL&apos;, nvl(pa_utils.get_group_level_task_id(ei.task_id, ei.top_task_id, ei.project_id), -9999)) grouped_task_id,
language,
ei.rate_source_id, /* V6 */
ei.discount_percentage,
ei.rate_disc_reason_code,
ei.bill_markup_percentage,
ei.bill_group,
ei.bill_amount,
ei.bill_rate,
ei.revenue_hold_flag,
ei.accrual_rate,
ei.inventory_item_id,
ei.inventory_item,
ei.invoice_method,
case ei.project_level_funding_flag when &apos;Y&apos; then 0 else ei.top_task_id end funding_task_id,
case ei.project_level_funding_flag when &apos;Y&apos; then NULL else ei.top_task_name end funding_task_name,
case ei.project_level_funding_flag when &apos;Y&apos; then NULL else ei.top_task_number end funding_task_number,
ei.inv_gen_rejection_code,
ei.rev_dist_rejection_code,
eligible_bill_proj.project_id billing_project_id,
bill_gl_period.bill_period_name bill_chart_period_name,
bill_gl_period.period_name bill_gl_period_name,
bill_gl_period.start_date  gl_period_start_date,
case when bill_gl_period.display_ctr between -3 and 0 then &apos;Y&apos; else &apos;N&apos; end display_planrev_chart,
case when bill_gl_period.display_ctr between -3 and 3 then &apos;Y&apos; else &apos;N&apos; end display_totexp_chart,
ei.projfunc_bill_amount,
nvl(case when ei.project_type_class_code = &apos;CONTRACT&apos; then
      (select &apos;Y&apos; from dual where exists (select pcrdl.expenditure_item_id
	     from pa_cust_rev_dist_lines_all pcrdl
		 where ei.expenditure_item_id = pcrdl.expenditure_item_id
		 and pcrdl.draft_invoice_num is not null
		 group by pcrdl.expenditure_item_id
		 having sum(nvl(pcrdl.bill_trans_bill_amount, 0)) &lt;&gt; 0))
else null end, &apos;N&apos;) billed_flag,
case when ei.projfunc_bill_amount is not NULL and ei.projfunc_bill_amount &lt;&gt; 0 then ei.projfunc_bill_amount
     when (ei.project_type_class_code = &apos;CONTRACT&apos; AND ei.cost_distributed_flag = &apos;Y&apos; AND ei.billable_flag = &apos;Y&apos;
	       AND (ei.projfunc_bill_amount is NULL or ei.projfunc_bill_amount = 0))
	      THEN PA_ECC_BILL_LOAD_PKG.get_bill_amount(&apos;EI&apos;,ei.expenditure_item_id)
else null end billdb_pfc_bill_amount
FROM
pa_exp_item_mls_v ei,
(
    SELECT
        ppa.project_id,
        ppa.name       project_name,
        ppa.segment1   project_number,
        ppa.org_id,
        ppa.project_type,
        nvl(ppa.project_level_funding_flag, &apos;N&apos;) project_level_funding_flag,
        ppa.multi_currency_billing_flag
    FROM
        pa_projects_all           ppa,
        pa_project_statuses       ps,
        pa_project_types_all      ppta,
        pa_budget_versions        pbv,
        pa_budget_types           pbt,
        pa_budget_entry_methods   pabem,
        pa_implementations_all    pia
    WHERE
        pia.org_id = ppa.org_id
        AND ppta.project_type = ppa.project_type
        AND ppta.org_id = ppa.org_id
        AND ppta.direct_flag = &apos;Y&apos; /* CONTRACT PROJECT */
        AND ppta.project_type_class_code = &apos;CONTRACT&apos;
        AND nvl(ppta.cc_prvdr_flag, &apos;N&apos;) &lt;&gt; &apos;Y&apos; /* NOT TO INCLUDE INTERCOMPANY PROJECTS */
        AND ppa.project_status_code = ps.project_status_code
        AND ps.project_system_status_code NOT IN (&apos;CLOSED&apos;,&apos;PENDING_CLOSE&apos;,&apos;PENDING_PURGE&apos;,&apos;PARTIALLY_PURGED&apos;,&apos;PURGED&apos;)
        AND ppa.template_flag = &apos;N&apos;
        /* AND ppa.revenue_accrual_method IN (&apos;WORK&apos;,&apos;EVENT&apos;)
        AND ppa.invoice_method IN (&apos;WORK&apos;,&apos;EVENT&apos;) */
        AND (ppa.revenue_accrual_method IN (&apos;WORK&apos;) OR ppa.invoice_method IN (&apos;WORK&apos;))
        AND pbv.project_id = ppa.project_id
        AND pbv.budget_status_code = &apos;B&apos;
        AND pbv.current_flag = &apos;Y&apos;
        AND pbv.budget_type_code = &apos;AR&apos; /* APPROVED REVENUE BUDGET HARD CHECK? */
        AND pbv.budget_type_code = pbt.budget_type_code
        AND pabem.budget_entry_method_code = pbv.budget_entry_method_code
		AND PABEM.TIME_PHASED_TYPE_CODE = &apos;G&apos; /* BY GL PERIOD */
        AND pabem.entry_level_code IN (&apos;P&apos;,&apos;T&apos;)
) eligible_bill_proj,
(select org_id, set_of_books_id, period_year||&apos;-&apos;||lpad(period_num, 2, 0) bill_period_name, period_name, closing_status, start_date, end_date,
        period_year, period_num, quarter_num, rnum, currper, (rnum-perval) display_ctr
from (
select org_id, set_of_books_id, period_name, closing_status, start_date, end_date, period_year, period_num, quarter_num, currper, rnum,
       sum((case when currper = &apos;CR&apos; then rnum else 0 end)) over (partition by org_id, set_of_books_id) perval from
       (
select pia.org_id, pia.set_of_books_id, gps.period_name, gps.closing_status, gps.start_date, gps.end_date, gps.period_year, gps.period_num, gps.quarter_num
       ,case when sysdate between start_date and end_date then &apos;CR&apos; else &apos;NA&apos; end currper
       ,row_number() over(partition by pia.org_id, pia.set_of_books_id order by gps.period_year desc, gps.period_num desc) rnum
from   gl_period_statuses gps, pa_implementations_all pia
where  gps.set_of_books_id = pia.set_of_books_id
and    gps.adjustment_period_flag = &apos;N&apos;
and    gps.application_id = 101
)
)
) bill_gl_period,
/* where rnum-perval between -3 and 3) bill_gl_period, */
/*
(
select expenditure_item_id from pa_cust_rev_dist_lines_all pcrdl
where  creation_date &gt;=  to_date(|| g_ecc_last_load_date ||)
and    pcrdl.draft_invoice_num is not null
group by pcrdl.expenditure_item_id
having sum(nvl(pcrdl.bill_trans_bill_amount, 0)) &lt;&gt; 0
) check_ei_billed,
*/
/* Bug#30749534
(
SELECT
cd.*
FROM
(
    SELECT
        c.*
    FROM
        pa_cost_distribution_lines_all c
    WHERE
        c.line_type = &apos;R&apos;
        AND c.creation_date &gt;= &apos;12-DEC-21&apos;
        AND ( c.expenditure_item_id,
              c.line_num ) IN (
            SELECT
                expenditure_item_id,
                max(line_num)
            FROM
                pa_cost_distribution_lines_all b
            WHERE
                creation_date &gt;= &apos;12-DEC-21&apos;
                AND line_type = &apos;R&apos;
            GROUP BY
                b.expenditure_item_id
        )
) cd
) cdl,
*/
(
select * from pa_ecc_cost_cdl_account peccact where line_type = &apos;R&apos;
) cdl,
/* Bug#30749534
(
SELECT
xe.event_id,
xe.application_id,
xeh.gl_transfer_status_code,
xeh.accounting_entry_status_code,
xeh.ledger_id,
xae_ledger_id,
nvl(xe.process_status_code, &apos;UP&apos;) process_status_code,
message_number,
encoded_msg
FROM
xla_events xe,
xla_ae_headers xeh,
(
SELECT
event_id,
xae_ledger_id,
message_number message_number,
encoded_msg encoded_msg
FROM
(
SELECT
event_id,
xae_ledger_id,
ltrim(sys_connect_by_path(message_number, &apos;|&apos;), &apos;|&apos;) AS message_number,
ltrim(sys_connect_by_path(encoded_msg, &apos;|&apos;), &apos;|&apos;) AS encoded_msg
FROM
(
SELECT
event_id,
xae.ledger_id xae_ledger_id,
message_number,
encoded_msg,
ROW_NUMBER() OVER(
PARTITION BY event_id
ORDER BY
message_number
) AS rn
FROM
xla_accounting_errors xae,
gl_ledgers gl
WHERE
xae.application_id = 275
AND xae.event_id IS NOT NULL
and xae.ledger_id = gl.ledger_id
and gl.LEDGER_CATEGORY_CODE = &apos;PRIMARY&apos;
)
WHERE
CONNECT_BY_ISLEAF = 1
CONNECT BY event_id = PRIOR event_id
AND xae_ledger_id = PRIOR xae_ledger_id
AND rn = PRIOR rn + 1 START WITH rn = 1
)
) xae
WHERE
xe.application_id = 275
AND xe.event_id = xeh.event_id
AND xe.application_id = xeh.application_id
AND xeh.event_id = xae.event_id(+)
AND xeh.ledger_id = xae.xae_ledger_id(+)
) xla
*/
/* Added for Bug#30749534 */
(
SELECT
xe.event_id,
xe.application_id,
xeh.gl_transfer_status_code,
xeh.accounting_entry_status_code,
xeh.ledger_id,
nvl(xe.process_status_code, &apos;UP&apos;) process_status_code,
message_number,
encoded_msg
FROM
xla_events xe,
xla_ae_headers xeh,
(
SELECT
event_id, message_number, encoded_msg
FROM
(
SELECT
event_id,
message_number,
encoded_msg,
ROW_NUMBER() OVER(
PARTITION BY event_id
ORDER BY
message_number
) AS rn
FROM
xla_accounting_errors xae,
gl_ledgers gl
WHERE
xae.application_id = 275
AND xae.event_id IS NOT NULL
and xae.ledger_id = gl.ledger_id
and gl.LEDGER_CATEGORY_CODE = &apos;PRIMARY&apos;
)
WHERE rn = 1
) xae
WHERE
xe.application_id = 275
AND xe.event_id = xeh.event_id
AND xe.application_id = xeh.application_id
AND xe.event_id = xae.event_id(+)
) xla
WHERE
ei.expenditure_item_id = cdl.expenditure_item_id (+)
AND ei.project_type &lt;&gt; &apos;AWARD_PROJECT&apos;
AND ei.set_of_books_id = nvl(xla.ledger_id, ei.set_of_books_id)
AND cdl.acct_event_id = xla.event_id (+)
AND ei.project_id = cdl.project_id (+)
AND ei.task_id = cdl.task_id (+)
AND ei.creation_date &gt;= &apos;12-DEC-21&apos;
AND eligible_bill_proj.project_id (+) = ei.project_id
AND ei.org_id = bill_gl_period.org_id (+)
AND ei.expenditure_item_date between bill_gl_period.start_date (+) and bill_gl_period.end_date (+)
/* AND ei.expenditure_item_id = check_ei_billed.expenditure_item_id (+) */
AND ei.language in (&apos;US&apos;)
) tmp,
pa_expenditure_items_all peia,
pa_tasks pt , (select &quot;ROW_ID&quot; &quot;&apos;PA_COST_EIDFF_ROW_ID&apos;&quot;,&quot;CONTEXT_VALUE&quot; &quot;&apos;PA_COST_EIDFF_CONTEXT_VALUE&apos;&quot;,&quot;ITEM_NUMBER&quot; &quot;&apos;PA_COST_EIDFF_ITEM_NUMBER&apos;&quot;,&quot;SERIAL_NUMBER&quot; &quot;&apos;PA_COST_EIDFF_SERIAL_NUMBER&apos;&quot;,&quot;CATEGORY&quot; &quot;&apos;PA_COST_EIDFF_CATEGORY&apos;&quot;,&quot;LOCATION&quot; &quot;&apos;PA_COST_EIDFF_LOCATION&apos;&quot;,&quot;PRODUCT&quot; &quot;&apos;PA_COST_EIDFF_PRODUCT&apos;&quot;,&quot;CONCATENATED_SEGMENTS&quot; &quot;&apos;PA_COST_EIDFF_CONCATENATED_SEGMENTS&apos;&quot; from ( select ROWID &quot;ROW_ID&quot;,ATTRIBUTE_CATEGORY &quot;CONTEXT_VALUE&quot;,ATTRIBUTE6 &quot;ITEM_NUMBER&quot;,ATTRIBUTE7 &quot;SERIAL_NUMBER&quot;,ATTRIBUTE8 &quot;CATEGORY&quot;,ATTRIBUTE9 &quot;LOCATION&quot;,ATTRIBUTE10 &quot;PRODUCT&quot;,ATTRIBUTE6||&apos;.&apos;||ATTRIBUTE7||&apos;.&apos;||ATTRIBUTE8||&apos;.&apos;||ATTRIBUTE9||&apos;.&apos;||ATTRIBUTE10 &quot;CONCATENATED_SEGMENTS&quot; from PA_EXPENDITURE_ITEMS_ALL )) dfv2
where tmp.expenditure_item_id = peia.expenditure_item_id (+)
and tmp.task_id = pt.task_id(+)
 AND peia.rowid = dfv2.&quot;&apos;PA_COST_EIDFF_ROW_ID&apos;&quot;(+)
)
PIVOT (
MAX ( project_type ) AS project_type,
MAX (project_organization) As project_organization,
MAX (task_organization) AS task_organization,
MAX ( expenditure_org_name ) AS expenditure_org_name,
MAX (proj_grouping_method) as proj_grouping_method,
MAX (proj_grp_supplier_invoice) as proj_grp_supplier_invoice,
MAX (proj_asset_cost_alloc_mhd) as proj_asset_cost_alloc_mhd,
MAX ( proj_enbl_burden_cost_acc ) AS proj_enbl_burden_cost_acc,
MAX ( cost_distributed ) AS cost_distributed,
MAX ( revenue_distributed_flag ) AS revenue_distributed_flag,
MAX ( exp_group_status ) AS exp_group_status,
MAX ( cc_cross_charge_code ) AS cc_cross_charge_code,
MAX ( cc_cross_charge_type ) AS cc_cross_charge_type,
MAX ( cc_bl_distributed_code ) AS cc_bl_distributed_code,
MAX ( line_type ) AS line_type,
MAX ( transfer_status ) AS transfer_status,
MAX ( project_status ) AS project_status,
MAX( cc_rejection_reason) AS cc_rejection_reason,
MAX( billable) AS billable,
MAX( bill_hold) AS bill_hold,
MAX( task_billable_flag ) AS task_billable_flag,
MAX( task_work_type ) AS task_work_type,
MAX( bill_nonbilable_flag) AS bill_nonbilable_flag,
MAX( bill_billed_flag) AS bill_billed_flag,
MAX( bill_not_billed_flag) AS bill_not_billed_flag,
MAX( capitalizable) AS capitalizable,
MAX( asset_line_generated ) AS asset_line_generated,
MAX( capitalized) AS capitalized,
MAX( capitalizable_cap_hold) AS capitalizable_cap_hold,
MAX( net_Zero_adjustment) AS net_Zero_adjustment,
MAX( billed) AS billed,
MAX( cost_bur_distributed_flag) AS cost_bur_distributed_flag,
MAX( bl_acct_status) AS bl_acct_status,
MAX( cdl_acct_status) AS cdl_acct_status,
MAX( project_sla_acc_status) AS project_sla_acc_status,
MAX( sla_gl_acc_status) AS sla_gl_acc_status,
MAX( pre_accounting_status) AS pre_accounting_status,
MAX( transfer_rejection_reason) AS transfer_rejection_reason,
MAX( alert_text) AS alert_text,
MAX( precosting_status) AS precosting_status,
MAX( user_project_type) AS user_project_type,
MAX( exp_accounting_stage) AS exp_accounting_stage,
MAX( acct_status_tot_bur) AS acct_status_tot_bur,
MAX( Operating_Unit) AS Operating_Unit,
MAX( asset_assignment_exists) AS asset_assignment_exists,
MAX(rate_discount_reason) AS rate_discount_reason,
MAX(revenue_hold) AS revenue_hold,
MAX(WIP_STATUS) AS wip_status,
MAX(cost_identifier_desc) AS cost_identifier_desc
FOR language IN ( &apos;US&apos; &quot;US&quot; ))
) x
where
2=2</SQL_TEXT>
  <ENABLED>Y</ENABLED>
  <REPORT_TRANSLATIONS>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>AR</LANGUAGE>
    <REPORT_NAME>ECC المشروعات, تحديد تكلفة المشروعات: الحركات, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: مجموعة البيانات للمعلومات الخاصة ببنود المصروفات
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>D</LANGUAGE>
    <REPORT_NAME>ECC Projects, Projektkosten: Transaktionen, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: DatenSet mit Informationen über Aufwandsposten
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>E</LANGUAGE>
    <REPORT_NAME>ECC Projects, Costes de Proyectos: Transacciones, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: Juego de datos para información sobre conceptos de gasto
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>F</LANGUAGE>
    <REPORT_NAME>ECC Projects, Projects Costing : Mouvements, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: Jeu de données pour informations sur dépenses
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>I</LANGUAGE>
    <REPORT_NAME>ECC Projects, Determinaz. costi progetti: transazioni, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: Serie di dati per informazioni relative alle voci di spesa
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>JA</LANGUAGE>
    <REPORT_NAME>ECC Projects, プロジェクト原価計算: 取引, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: 支出項目に関する情報のデータ・セット
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>KO</LANGUAGE>
    <REPORT_NAME>ECC 프로젝트, 프로젝트 원가 계산: 거래, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: 비용 항목 정보에 대한 데이터 세트
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>RU</LANGUAGE>
    <REPORT_NAME>ECC Проекты, Projects Costing: транзакции, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: Набор данных о статьях расхода
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>S</LANGUAGE>
    <REPORT_NAME>ECC Projekt, Projektuppföljning: Transaktioner, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: Datauppsättning för information om utgiftsposter
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>TR</LANGUAGE>
    <REPORT_NAME>ECC Projeler, Proje Maliyetlendirme: İşlemler, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: Gider kalemleri hakkındaki bilgiler için veri kümesi
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
    <REPORT_NAME>ECC Projects, Projects Costing: Transactions, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: Data set for information about expenditure items
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>ZHS</LANGUAGE>
    <REPORT_NAME>ECC Projects, 项目成本计算：事务处理, SQL1</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Description: 支出项相关信息的数据集
Dataset Key: pa-ds-cost-eicdl
Query Procedure: PA_ECC_COST_PROJ_PKG.LOAD_FULL_EICDL_DATA
Security Procedure: PA_ECC_DATASECURITY_PKG.GetFilterAttributeValues</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
  </REPORT_TRANSLATIONS>
  <CATEGORY_ASSIGNMENTS>
   <CATEGORY_ASSIGNMENTS_ROW>
    <CATEGORY>Enterprise Command Center</CATEGORY>
   </CATEGORY_ASSIGNMENTS_ROW>
  </CATEGORY_ASSIGNMENTS>
  <ANCHORS>
  </ANCHORS>
  <PARAMETERS>
  </PARAMETERS>
  <PARAMETER_DEPENDENCIES>
  </PARAMETER_DEPENDENCIES>
  <TEMPLATES>
  </TEMPLATES>
  <DEFAULT_TEMPLATES>
  </DEFAULT_TEMPLATES>
  <UPLOAD_COLUMNS>
  </UPLOAD_COLUMNS>
  <UPLOAD_PARAMETERS>
  </UPLOAD_PARAMETERS>
  <UPLOAD_SQLS>
  </UPLOAD_SQLS>
  <UPLOAD_DEPENDENCIES>
  </UPLOAD_DEPENDENCIES>
 </REPORTS_ROW>
</REPORTS>
</ROOT>
