DBA Data[Home] [Help]

APPS.PA_PROGRESS_UTILS SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 51

    select ppev1.element_version_id
      into x_task_version_id
      from pa_proj_element_versions ppev1,
           pa_proj_element_versions ppev2,
           pa_proj_elem_ver_structure ppevs,
           pa_structure_types pst,
           pa_proj_structure_types ppst
     where ppevs.project_id = p_project_id
       and ppevs.latest_eff_published_flag = 'Y'
       and ppevs.element_version_id = ppev1.parent_structure_version_id
       and ppevs.element_version_id = ppev2.element_version_id
       and ppev2.proj_element_id = ppst.proj_element_id
       and ppst.structure_type_id = pst.structure_type_id
       and pst.structure_type_class_code = 'WORKPLAN'
       and ppev1.proj_element_id = p_task_id
       and ppev1.object_type = 'PA_TASKS';
Line: 78

    select 'Y'
      into x_record_exists
      from pa_percent_completes
     where object_version_id = p_element_version_id
       and object_type = p_object_type
       and published_flag = 'Y'
       and project_id = p_project_id; -- Fixed bug # 3688901
Line: 96

    select ppevs.element_version_id
      into x_structure_version_id
      from pa_proj_elem_ver_structure ppevs,
           pa_proj_element_versions ppev,
           pa_structure_types pst,
           pa_proj_structure_types ppst
     where ppevs.project_id = p_project_id
       and ppevs.latest_eff_published_flag = 'Y'
       and ppevs.element_version_id = ppev.element_version_id
       and ppev.proj_element_id = ppst.proj_element_id
       and ppst.structure_type_id = pst.structure_type_id
       and pst.structure_type_class_code = 'WORKPLAN';
Line: 120

    select 'Y'
      into x_val
     from pa_project_parties
    where project_id = p_project_id
      and resource_source_id = l_person_id
      and project_role_id = 1
      and trunc(sysdate) between trunc(start_date_active) and trunc(nvl(end_date_active,sysdate)); ----- Project Manager
Line: 141

    select percent_complete_id
      into l_percent_complete_id
     from pa_percent_completes
    where project_id = p_project_id
      and task_id = p_task_id
      and current_flag = 'N'
      and published_flag = 'N';
Line: 156

PROCEDURE UPDATE_TASK_PROG_REQ_DATE(p_commit        in varchar2 := FND_API.G_TRUE,
                                  p_object_id      in number,
                                  p_object_type    in varchar2,
                                  x_return_status  out NOCOPY varchar2, --File.Sql.39 bug 4440895
                                  x_msg_count      out NOCOPY number, --File.Sql.39 bug 4440895
                                  x_msg_data       out NOCOPY varchar2) IS --File.Sql.39 bug 4440895
  CURSOR get_setup_info
  IS SELECT
         object_id, object_type,  reporting_cycle_id,
         next_reporting_date, record_version_number,
         initial_progress_status, final_progress_status,
         rollup_progress_status, object_page_layout_id
     FROM pa_object_page_layouts popl
     WHERE
         page_type_code = 'TPR'
     AND page_id = -99
     AND object_id = p_object_id
     AND object_type = p_object_type;
Line: 204

             pa_progress_report_pkg.update_object_page_layout_row
             (
              p_object_id                 => l_OBJECT_ID ,
              p_object_Type               => l_OBJECT_TYPE ,
              p_page_id                   => -99 ,
              p_page_type_code            => 'TPR' ,
              p_approval_required         => null ,
              p_reporting_cycle_id        => l_report_cycle_id ,
              p_reporting_offset_days     => null,
              p_next_reporting_date       => x_next_reporting_date ,
              p_reminder_days             => null ,
              p_reminder_days_type        => null ,
              p_initial_progress_status   => l_initial_progress_status,
              p_final_progress_status     => l_final_progress_status,
              p_rollup_progress_status    => l_rollup_progress_status,
              P_REPORT_TYPE_ID            => null,
              P_APPROVER_SOURCE_ID        => null,
              P_APPROVER_SOURCE_TYPE      => null,
              P_EFFECTIVE_FROM            => null,
              P_EFFECTIVE_TO              => null,
              p_object_page_layout_id     => l_object_page_layout_id,
              p_record_version_number     => l_record_version_number,
              x_return_status             => x_return_status ,
              x_msg_count                 => x_msg_count,
              x_msg_data                  => x_msg_data
              );
Line: 243

                     ,p_procedure_name  => 'UPDATE_TASK_PROG_REQ_DATE'
             ,p_error_text => x_msg_data );
Line: 247

END UPDATE_TASK_PROG_REQ_DATE;
Line: 265

  SELECT next_reporting_date, reporting_cycle_id, report_offset_days
  INTO l_reporting_date, l_cycle_id, l_offset_days
  FROM pa_object_page_layouts
  WHERE object_id = p_project_id
    AND object_type = 'PA_PROJECTS'
    AND page_type_code = 'TPR';
Line: 285

        UPDATE pa_object_page_layouts
            SET next_reporting_date = l_reporting_date
            WHERE object_id = p_project_id
            AND object_type = 'PA_PROJECTS'
            AND page_type_code = 'TPR';
Line: 314

    select 'Y'
      into x_record_exists
      from pa_percent_completes
     where project_id = p_project_id
       and task_id = decode(p_task_id,0,task_id,p_task_id)
       and published_flag = 'Y';
Line: 334

        select  completed_percentage
    from    pa_percent_completes
    where   project_id = l_project_id
    and task_id = l_task_id
    and published_flag = 'Y'
    and structure_type = 'WORKPLAN'
    and date_computed  < l_as_of_date
    and object_type = 'PA_TASKS'
    order by date_computed desc;*/
Line: 346

   select nvl(completed_percentage,eff_rollup_percent_comp)
     from pa_progress_rollup
    where project_id = l_project_id
    and object_id = l_task_id
    and object_type in ('PA_STRUCTURES', 'PA_TASKS')
    and structure_Type = 'WORKPLAN'
    and structure_version_id is null
    and as_of_date < l_as_of_date
    order by as_of_date desc;
Line: 357

    /*select completed_percentage
      into prior_pc
      from pa_percent_completes
     where project_id = p_project_id
       and task_id = p_task_id
       and published_flag = 'Y'
       and structure_type = 'WORKPLAN' -- FPM Dev CR 3
       and date_computed <= p_as_of_date;*/
Line: 394

    SELECT project_id
     FROM pa_proj_elements
    WHERE proj_element_id = p_task_id;
Line: 402

    SELECT /*+ INDEX(pa_percent_completes PA_PERCENT_COMPLETES_N3)*/ date_computed --Added hint for 15876400
      FROM pa_percent_completes
     WHERE object_id = decode(p_object_id, null, p_task_id, p_object_id)
       AND project_id = c_project_id
       and object_type = p_object_type
       AND current_flag = 'Y'
       AND published_flag = 'Y'
       AND structure_type = p_structure_type
       AND NVL(task_id, -1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_task_id, NVL(task_id, -1)), NVL(p_task_id,p_object_id)) /* Amit : Modified for IB4 Progress CR. */
       AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
	   ;
Line: 468

  PA_PROGRESS_UTILS.l_return_date.delete;
Line: 581

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = X_Project_ID
        AND object_id = x_object_id
        AND object_type = x_object_type
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND structure_type = x_structure_type
    AND NVL(task_id,-1) = DECODE(X_Object_type, 'PA_DELIVERABLES', NVL(X_proj_element_id, NVL(task_id,-1)), NVL(X_proj_element_id, X_Object_id))
    ;
Line: 596

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = X_Project_ID
        AND object_id = x_object_id
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND object_type = x_object_type
        AND structure_type = X_structure_type
    AND task_id = NVL(X_proj_element_id,x_object_id)
    ;
Line: 609

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = X_Project_ID
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND ((object_type = 'PA_ASSIGNMENTS' and object_id = x_object_id)
             or (object_type = 'PA_TASKS' and object_id = X_proj_element_id))
        AND structure_type = X_structure_type
    AND task_id = X_proj_element_id
    ;
Line: 624

          SELECT por.object_id_from2
          FROM pa_object_relationships por
          WHERE
          por.object_type_to = 'PA_DELIVERABLES'
      AND por.relationship_subtype IN  ('STRUCTURE_TO_DELIVERABLE', 'TASK_TO_DELIVERABLE')
      AND por.relationship_type = 'A'
      AND por.object_id_to2 = c_del_elem_id
      ;
Line: 636

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = X_Project_ID
        AND object_id = x_object_id
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND object_type = 'PA_DELIVERABLES'
        AND structure_type = X_structure_type
    AND NVL(task_id, -1) = NVL(X_proj_element_id, NVL(task_id, -1))
    ;
Line: 649

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = X_Project_ID
        AND ((object_id = x_object_id and object_type = 'PA_DELIVERABLES') or
            (object_id = c_task_id and object_type = 'PA_TASKS'))
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND structure_type = X_structure_type
        ;
Line: 663

     SELECT start_date, completion_date
       from pa_projects_all
      where project_id = x_project_id;
Line: 670

   SELECT max(as_of_date)
   FROM pa_progress_rollup
   where project_id = X_Project_ID
   and object_type IN ('PA_TASKS', 'PA_STRUCTURES')
   and object_id = x_object_id
   and structure_type = 'WORKPLAN'
   and structure_version_id is null;
Line: 681

   Select Billing_Cycle_Type, Billing_Value1
   From    PA_Billing_Cycles
   Where   Billing_Cycle_ID = X_Billing_Cycle_ID;
Line: 789

        select PA_PERCENT_COMPLETES_S.nextval
        into l_return_ppc_id
        from dual;
Line: 827

  SELECT trunc(p_as_of_date) FROM DUAL
  MINUS
  SELECT
    trunc(as_of_date)
     FROM PA_PROG_AS_OF_DATES
     WHERE project_id = p_project_id
--       AND proj_element_id = p_object_id
       AND object_id = p_object_id
       AND object_type = p_object_type
       AND rownum < 11;*/
Line: 841

  SELECT trunc(p_as_of_date) FROM DUAL
  MINUS
  SELECT PA_PROGRESS_UTILS.AS_OF_DATE(ppe.project_id,  ppe.proj_element_id, ppp.progress_cycle_id, ppe.object_type, 'WORKPLAN', p_proj_element_id/* Amit : Modified for IB4 Progress CR. */) as_of_date
  from  pa_project_statuses po, pa_proj_progress_attr ppp, pa_proj_elements ppe -- Bug 4535784 Changed from pa_resource_types to pa_project_statuses
  where ppe.project_id = ppp.project_id(+)
  AND ppp.structure_type (+) = 'WORKPLAN'
  and ppe.project_id= p_project_id
  and ppe.proj_element_id = p_object_id
  and ppe.object_type = p_object_type
  and ((ppe.object_type in ('PA_TASKS', 'PA_STRUCTURES') and rownum <61) or (ppe.object_type = 'PA_DELIVERABLES' and rownum <11)) -- Bug 4535784
  --and rownum <11
  ;
Line: 859

  SELECT trunc(p_as_of_date) FROM DUAL
  MINUS
  SELECT PA_PROGRESS_UTILS.AS_OF_DATE(ppe.project_id,  ppe.resource_list_member_id, ppp.progress_cycle_id, 'PA_ASSIGNMENTS', 'WORKPLAN', p_proj_element_id/* Amit : Modified for IB4 Progress CR. */) as_of_date
  from  pa_resource_types po, pa_proj_progress_attr ppp, PA_TASK_ASSIGNMENTS_V ppe
  where ppe.project_id = ppp.project_id(+)
  AND ppp.structure_type (+) = 'WORKPLAN'
  and ppe.project_id= p_project_id
  and ppe.resource_list_member_id = p_object_id /* Modified for IB4 Progress CR. */
  and ppe.task_id = p_proj_element_id /* Amit : Modified for IB4 Progress CR. */
  AND NVL(ppe.cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
  and rownum <11;
Line: 913

   SELECT PLANNED_WORK_QUANTITY,
          WQ_ACTUAL_ENTRY_CODE
     FROM pa_latest_proj_task_prog_v
    WHERE task_id = p_task_id;
Line: 922

    SELECT WQ_PLANNED_QUANTITY
      FROM pa_proj_elements ppe,
           pa_proj_element_versions ppev,
           pa_proj_elem_ver_schedule ppevsh
     WHERE ppe.project_id = ppev.project_id
       AND ppe.proj_element_id = p_task_id
       AND ppev.proj_element_id = ppe.proj_element_id
       AND ppev.element_version_id = ppevsh.element_version_id
       AND ppev.project_id = ppevsh.project_id
       AND ppev.parent_structure_version_id = PA_PROJ_ELEMENTS_UTILS.latest_published_ver_id(ppe.project_id, 'WORKPLAN');
Line: 935

    SELECT nvl(ppe.WQ_ACTUAL_ENTRY_CODE,ptt.ACTUAL_WQ_ENTRY_CODE)
     FROM pa_proj_elements ppe, pa_task_types ptt
    WHERE ppe.type_id = ptt.task_type_id(+)
      AND ptt.object_type = 'PA_TASKS' /* bug 3279978 FP M Enhancement */
      AND ppe.proj_element_id = p_task_id ;
Line: 1011

    SELECT project_id
     FROM pa_proj_elements
    WHERE proj_element_id = p_task_id;
Line: 1019

    SELECT EFF_ROLLUP_PROG_STAT_CODE,
           pps.project_status_name,
           ESTIMATED_REMAINING_EFFORT,
           BASE_PERCENT_COMPLETE, EFF_ROLLUP_PERCENT_COMP,
           ESTIMATED_START_DATE, ESTIMATED_FINISH_DATE,
           ACTUAL_START_DATE, ACTUAL_FINISH_DATE,
           pps.status_icon_ind, pps.status_icon_active_ind
      FROM pa_progress_rollup ppr, pa_project_statuses pps
     WHERE object_id = p_task_id
       AND project_id = l_project_id
       AND ppr.eff_rollup_prog_stat_code = pps.project_status_code(+)
       AND as_of_date = ( SELECT max( as_of_date ) from pa_progress_rollup
                            WHERE object_id = p_task_id and as_of_date <= p_as_of_date
                             AND project_id = l_project_id );
Line: 1067

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = p_Project_ID
        AND object_id = decode(p_object_id, null, p_task_id, p_object_id) -- This is done to avoid any impact of parameter additions
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND object_type = p_object_type
        AND structure_type = p_structure_type
    AND NVL(task_id, -1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_task_id, NVL(task_id, -1)), NVL(p_task_id,p_object_id))
    ;
Line: 1082

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = p_Project_ID
        AND object_id = decode(p_object_id, null, p_task_id, p_object_id)
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND object_type = p_object_type
        AND structure_type = p_structure_type
    AND task_id = NVL(p_task_id,p_object_id)
	AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
    ;
Line: 1096

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = p_Project_ID
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND object_type IN ('PA_ASSIGNMENTS' ,'PA_TASKS')
        AND structure_type = p_structure_type
    AND task_id = p_task_id
    ;
Line: 1108

          SELECT por.object_id_from2
          FROM pa_object_relationships por
          WHERE
          por.object_type_to = 'PA_DELIVERABLES'
      AND por.relationship_subtype IN  ('STRUCTURE_TO_DELIVERABLE', 'TASK_TO_DELIVERABLE')
      AND por.relationship_type = 'A'
      AND por.object_id_to2 = c_del_elem_id
      ;
Line: 1120

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = p_Project_ID
        AND ((c_task_id IS NULL AND object_id =p_object_id) OR (c_task_id IS NOT NULL AND object_id IN (c_task_id, p_object_id)))
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND object_type IN ('PA_DELIVERABLES' ,'PA_TASKS')
        AND structure_type = p_structure_type
    AND NVL(task_id, -1) = NVL(p_task_id, NVL(task_id, -1))
    ;
Line: 1134

     SELECT progress_cycle_id
       FROM pa_proj_progress_attr
      WHERE project_id = p_project_id
      AND structure_type = p_structure_type;
Line: 1141

   SELECT start_date, completion_date
     FROM pa_projects_all
    WHERE project_id = p_project_id;
Line: 1156

  Select Billing_Cycle_Type, Billing_Value1
  From    PA_Billing_Cycles
  Where   Billing_Cycle_ID = l_progress_cycle_id;
Line: 1263

   SELECT start_date, completion_date
     FROM pa_projects_all
    WHERE project_id = p_project_id;
Line: 1271

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = p_Project_ID
--        AND object_id    = p_task_id
        AND object_id    = decode(p_object_id, null, p_task_id, p_object_id) -- This is Done to avoid the impact
        AND object_type = p_object_type
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND structure_type = p_structure_type
    AND NVL(task_id, -1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_task_id, NVL(task_id, -1)), NVL(p_task_id,p_object_id))
    --and task_id = p_task_id
    ;
Line: 1288

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = p_Project_ID
        AND object_id = decode(p_object_id, null, p_task_id, p_object_id)
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND object_type = p_object_type
        AND structure_type = p_structure_type
    AND task_id = NVL(p_task_id,p_object_id)
	AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
    ;
Line: 1302

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = p_Project_ID
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND ((object_type = 'PA_ASSIGNMENTS' and object_id = p_object_id AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1)) --Added for CBS phase 2 16200605
             or (object_type = 'PA_TASKS' and object_id = p_task_id))
        AND structure_type = p_structure_type
        AND task_id = p_task_id
        ;
Line: 1315

          SELECT por.object_id_from2
          FROM pa_object_relationships por
          WHERE
          por.object_type_to = 'PA_DELIVERABLES'
      AND por.relationship_subtype IN  ('STRUCTURE_TO_DELIVERABLE', 'TASK_TO_DELIVERABLE')
      AND por.relationship_type = 'A'
      AND por.object_id_to2 = c_del_elem_id
      ;
Line: 1327

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = p_Project_ID
        AND object_id = p_object_id
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND object_type = 'PA_DELIVERABLES'
        AND structure_type = p_structure_type
        AND NVL(task_id, -1) = NVL(p_task_id, NVL(task_id, -1))
        ;
Line: 1340

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = p_Project_ID
        AND ((object_id = p_object_id and object_type = 'PA_DELIVERABLES') or
            (object_id = p_task_id and object_type = 'PA_TASKS'))
        AND current_flag = 'Y'
        AND published_flag = 'Y'
        AND structure_type = p_structure_type
        ;
Line: 1351

     SELECT max( date_computed )
       FROM pa_percent_completes
      WHERE project_id = p_Project_ID
--        AND object_id    = p_task_id
        AND object_id    = decode(p_object_id, null, p_task_id, p_object_id) -- This is Done to avoid the impact
        AND object_type = p_object_type
        AND current_flag = 'N'
        AND published_flag = 'N'
        AND structure_type = p_structure_type
		AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
        AND NVL(task_id, -1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_task_id, NVL(task_id, -1)), NVL(p_task_id,p_object_id)) /* Amit : Modified for IB4 Progress CR. */
    --and task_id = p_task_id /* Modified for IB4 Progress CR. */;
Line: 1367

     SELECT progress_cycle_id
       FROM pa_proj_progress_attr
      WHERE project_id = p_project_id
      AND structure_type = p_structure_type;
Line: 1379

  Select Billing_Cycle_Type, Billing_Value1
  From    PA_Billing_Cycles
  Where   Billing_Cycle_ID = l_progress_cycle_id;
Line: 1546

    SELECT /*+ INDEX(pa_percent_completes PA_PERCENT_COMPLETES_N3)*/ decode( published_flag, 'Y', 'PUBLISHED', 'N', 'WORKING' ) --Added hint for 15876400
      FROM pa_percent_completes
     WHERE object_id = nvl(p_object_id, p_task_id) /* Modified for IB4 Progress CR. */
       AND object_type = p_object_type
       AND project_id  = p_project_id
       AND date_computed = p_as_of_date
       AND structure_type = p_structure_type
       and NVL(task_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_task_id,NVL(task_id,-1)),NVL(p_task_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
        AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1)  --Added for 16200605
	   order by published_flag;  --bug 4185364
Line: 1577

     SELECT percent_complete_id
       FROM pa_percent_completes
      WHERE object_type = p_object_type
        AND object_id = p_object_id
        AND project_id = p_project_id
--        AND object_version_id = p_object_version_id
        AND date_computed = p_as_of_date
        AND structure_type = p_structure_type
        and NVL(task_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_task_id,NVL(task_id,-1)),NVL(p_task_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
    --and task_id = nvl(p_task_id, p_object_id)  /* Modified for IB4 Progress CR. */
         AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1)  --Added for 16200605
	   order by published_flag  --bug 4185364
       ;
Line: 1620

     SELECT progress_rollup_id, record_version_number
       FROM pa_progress_rollup
      WHERE object_type = p_object_type
        AND object_id = p_object_id
        AND project_id = p_project_id
--        AND object_version_id = p_object_version_id
        AND as_of_date = p_as_of_date
        AND structure_type = p_structure_type
        AND structure_version_id is null
    and ((p_action = 'SAVE' AND current_flag = 'W') OR (p_action = 'PUBLISH' AND current_flag IN ('Y', 'N'))) -- Bug 3879461
        and NVL(proj_element_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
		AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1); --Added for 16200605
Line: 1637

     SELECT progress_rollup_id, record_version_number
       FROM pa_progress_rollup
      WHERE object_type = p_object_type
        AND object_id = p_object_id
        AND project_id = p_project_id
        AND structure_type = p_structure_type
        AND structure_version_id = p_structure_version_id
        and NVL(proj_element_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
    --and proj_element_id = nvl(p_proj_element_id,p_object_id) /* Modified for IB4 Progress CR. */;
Line: 1672

    SELECT project_id
     FROM pa_proj_elements
    WHERE proj_element_id = p_task_id;
Line: 1680

      SELECT 'X'
        FROM pa_percent_completes
       WHERE object_id = p_task_id
         AND project_id = c_project_id;
Line: 1716

     SELECT cumulative_work_quantity
       FROM pa_progress_rollup
      WHERE project_id = p_project_id
        AND object_id = p_object_id
        AND object_type = p_object_type
    AND structure_type = 'WORKPLAN'
    AND structure_version_id is null
        AND as_of_date = ( SELECT max( as_of_date )
                             FROM pa_progress_rollup
                            WHERE project_id = p_project_id
                              AND object_id = p_object_id
                              AND object_type = p_object_type
                              AND as_of_date < p_as_of_date
                  AND structure_type = 'WORKPLAN'
                  AND structure_version_id is null
                  );
Line: 1748

    SELECT NVL( wq_planned_quantity, 0 )
      FROM pa_proj_elem_ver_schedule
     WHERE project_id = p_project_id
       AND proj_element_id = p_object_id
       AND element_version_id = p_object_version_id;
Line: 1783

         UPDATE pa_proj_elements
            SET progress_outdated_flag = 'N'
           WHERE proj_element_id = l_proj_element_id;
Line: 1788

         UPDATE pa_proj_elements ppe
            SET progress_outdated_flag = 'N'
          WHERE proj_element_id = ( SELECT proj_element_id
                                      FROM pa_proj_structure_types ppst
                                     WHERE ppst.structure_type_id = 1      --WORKPLAN
                                       AND ppst.proj_element_id = ppe.proj_element_id )
            AND project_id = p_project_id;
Line: 1798

        UPDATE pa_proj_elements
           SET progress_outdated_flag = 'N'
        WHERE proj_element_id in ( SELECT proj_element_id
                                     FROM pa_proj_element_versions
                                     WHERE project_id = p_project_id
                                       AND parent_structure_version_id = p_structure_version_id
                                       AND object_type in ( 'PA_STRUCTURES', 'PA_TASKS' )  )
        AND object_type in ( 'PA_STRUCTURES', 'PA_TASKS' )
        AND project_id = p_project_id
        ;
Line: 1838

      SELECT
        WQ_ENABLE_FLAG,
        REMAIN_EFFORT_ENABLE_FLAG,
        PERCENT_COMP_ENABLE_FLAG,
        task_weight_basis_code,
        ALLOW_COLLAB_PROG_ENTRY,
        ALLOW_PHY_PRCNT_CMP_OVERRIDES
       FROM pa_proj_progress_attr
       WHERE project_id = p_project_id
         AND structure_type = p_structure_type;
Line: 1901

      SELECT WQ_ACTUAL_ENTRY_CODE, WQ_ENABLED_FLAG,
             EFFORT_ENABLED_FLAG, BASE_PERCENT_COMP_DERIV_CODE,
             PERCENT_COMP_ENABLED_FLAG, PROG_ENTRY_ENABLE_FLAG
        FROM PA_LATEST_proj_TASK_PROG_V
       WHERE project_id = p_project_id
         AND task_id = p_object_id
         AND object_type = p_object_type
         ;
Line: 1915

      SELECT
        nvl(ppe.WQ_ACTUAL_ENTRY_CODE,ptt.ACTUAL_WQ_ENTRY_CODE),
        decode(ppe.object_type,'PA_STRUCTURES',pppa.WQ_ENABLE_FLAG,
               decode(ptt.WQ_ENABLE_FLAG, 'Y', decode(pppa.WQ_ENABLE_FLAG, 'Y', 'Y', 'N'), 'N')),
        decode(ppe.object_type,'PA_STRUCTURES',pppa.REMAIN_EFFORT_ENABLE_FLAG,
               decode(ptt.REMAIN_EFFORT_ENABLE_FLAG, 'Y', decode(pppa.REMAIN_EFFORT_ENABLE_FLAG, 'Y', 'Y', 'N'), 'N')),
        NVL( ppe.base_percent_comp_deriv_code, ptt.base_percent_comp_deriv_code),
        decode(ppe.object_type,'PA_STRUCTURES',pppa.PERCENT_COMP_ENABLE_FLAG,
               decode(ptt.PERCENT_COMP_ENABLE_FLAG, 'Y', decode(pppa.PERCENT_COMP_ENABLE_FLAG, 'Y', 'Y','N'), 'N')),
        decode(ppe.object_type,'PA_TASKS',ptt.PROG_ENTRY_ENABLE_FLAG,'Y'),
        pppa.ALLOW_COLLAB_PROG_ENTRY,
        pppa.ALLOW_PHY_PRCNT_CMP_OVERRIDES,
        pppa.TASK_WEIGHT_BASIS_CODE
       FROM pa_proj_elements ppe, pa_task_types ptt, pa_proj_progress_attr pppa, pa_proj_elem_ver_structure ppvs, pa_proj_structure_types ppst
       WHERE ppe.project_id = p_project_id
         AND ppe.proj_element_id = p_object_id
         AND ppe.object_type = p_object_type
         AND ppe.type_id = ptt.task_type_id(+)
         AND ppvs.project_id = pppa.project_id(+)
         AND pppa.structure_type = p_structure_type
         AND ppe.project_id = ppvs.project_id
         AND ppvs.latest_eff_published_flag = 'Y'
         AND ppvs.proj_element_id = pppa.object_id(+)
         AND ppvs.proj_element_id = ppst.proj_element_id
         AND ptt.object_type(+) = 'PA_TASKS'  /* bug 3279978 FP M Enhancement */ --bug 4330450 added outer join
         AND ppst.structure_type_id =1;
Line: 2007

      SELECT 'X'
        FROM pa_percent_completes
       WHERE project_id = p_project_id
         AND object_id = decode(nvl(p_object_id,0),0,object_id,p_object_id)
         AND object_type = 'PA_STRUCTURES'
         AND task_id = 0;
Line: 2034

 SELECT 'X'
   FROM pa_percent_completes
  WHERE project_id = p_project_id
    AND object_id = decode(nvl(p_object_id,0),0,object_id,p_object_id)
    AND object_type = 'PA_STRUCTURES'
    AND task_id = 0;
Line: 2043

     SELECT 'X'
       FROM pa_percent_completes
      WHERE project_id = p_project_id
        AND object_id = decode(nvl(p_object_id,0),0,object_id,p_object_id)
        AND object_type = 'PA_STRUCTURES'
        AND task_id = 0
        AND STRUCTURE_TYPE = p_structure_type;
Line: 2100

      SELECT /*+ INDEX(pa_percent_completes PA_PERCENT_COMPLETES_N3)*/ date_computed --Added hint for 15876400
        FROM pa_percent_completes
       WHERE project_id = p_project_id
         AND object_id = nvl(p_object_id, p_task_id)  /* Modified for IB4 Progress CR. */
         AND object_type = p_object_type
     AND structure_type = 'WORKPLAN' -- FPM Dev CR 3
         AND published_flag = 'N'
         AND current_flag = 'N'
         and NVL(task_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_task_id,NVL(task_id,-1)),NVL(p_task_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
		 AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1)  --Added for CBS phase 2 16200605
	 and trunc(date_computed) <= trunc(p_as_of_date); --bug 4185364
Line: 2127

  select 'X' from pa_percent_completes
  where ( progress_status_code = p_status_code
  or status_code = p_status_code)
  AND rownum <= 1;
Line: 2134

   select 'X' from pa_progress_rollup
   where ( progress_status_code = p_status_code
   or base_progress_status_code = p_status_code
   or eff_rollup_prog_stat_code = p_status_code)
   AND rownum <= 1;
Line: 2142

 select 'X' from pa_proj_elements
 where status_code = p_status_code
   AND rownum <= 1;
Line: 2148

 select 'X' from pa_proj_elem_ver_structure
 where status_code = p_status_code
  AND rownum <= 1;
Line: 2154

 select 'X' from pa_task_types
 where ( initial_status_code = p_status_code
 or initial_progress_status_code = p_status_code)
 AND object_type = 'PA_TASKS' /* bug 3279978 FP M Enhancement */
 AND rownum <= 1;
Line: 2221

    SELECT project_id
     FROM pa_proj_elements
    WHERE proj_element_id = p_task_id;
Line: 2229

    SELECT MAX( date_computed )
      FROM pa_percent_completes
     WHERE object_id = p_task_id
       AND project_id = c_project_id
       AND date_computed < p_as_of_Date
    ;
Line: 2257

      SELECT ppe.status_code
        FROM pa_object_relationships por,
             pa_proj_element_versions ppev,
             pa_proj_elements ppe,
             pa_project_statuses pps
       WHERE object_id_to1 = p_object_version_id
         AND ppev.element_version_id = por.object_id_from1
         AND ppev.proj_element_id = ppe.proj_element_id
         AND ppev.object_type = ppe.object_type
         AND ppe.object_type = 'PA_TASKS'
         AND ppe.status_code = pps.project_status_code
         AND pps.project_system_status_code = 'ON_HOLD';
Line: 2292

     SELECT status_code
       FROM pa_proj_elements
      WHERE proj_element_id = p_object_id
        AND project_id      = p_project_id
        AND object_type = p_object_type;
Line: 2314

     SELECT project_system_status_code
       FROM pa_project_statuses pps   -----, fnd_lookup_values flv
      WHERE project_status_code = p_status_code
        AND status_type = decode(p_object_type, 'PA_TASKS', 'TASK', 'PA_DELIVERABLES', 'DELIVERABLE');
Line: 2330

Function is_cycle_ok_to_delete(p_progress_cycle_id  IN  NUMBER) return
varchar2
IS
   cursor prog_cycle is
   select 'N'
    from pa_proj_progress_attr
   where progress_cycle_id = p_progress_cycle_id
   and structure_type = 'WORKPLAN';-- FPM Dev CR 3
Line: 2352

End is_cycle_ok_to_delete;
Line: 2362

select nvl(max(percent_complete_id),-99)
            into l_ppc_id
            from pa_percent_completes
           where project_id = p_project_id
             and object_id = p_object_id
             and object_type = p_object_type
             and date_computed <= p_as_of_date;
Line: 2390

           select max(as_of_date)
             into l_rollup_date
             from pa_progress_rollup
            where project_id = p_project_id
              and object_id = p_object_id
              and object_type = p_object_type
          and structure_type = p_structure_type -- FPM Dev CR 3
              and as_of_date <= p_as_of_date
          and ((p_structure_version_id is null AND structure_version_id is null) OR (p_structure_version_id is not null AND structure_version_id = p_structure_version_id)) -- FPM Dev CR 4
          ;
Line: 2401

           select max(as_of_date)
             into l_rollup_date
             from pa_progress_rollup
            where project_id = p_project_id
              and object_id = p_object_id
              and object_type = p_object_type
              and structure_type = p_structure_type -- FPM Dev CR 3
              and trunc(as_of_date) = (select max(trunc(date_computed))
                                       from pa_percent_completes
                                      where project_id = p_project_id
                                        and object_id = p_object_id
                                        and object_type = p_object_type
                        and structure_type = p_structure_type -- FPM Dev CR 3
                                        and published_flag = 'Y'
                                        and date_computed <= p_as_of_date);
Line: 2420

           select /*+ INDEX(pa_progress_rollup PA_PROGRESS_ROLLUP_U2)*/ max(as_of_date) -- For Bug 9595490
             into l_rollup_date
             from pa_progress_rollup
            where project_id = p_project_id
              and object_id = p_object_id
              and object_type = p_object_type
          and structure_type = p_structure_type
              and as_of_date <= p_as_of_date
          and ((p_structure_version_id is null AND structure_version_id is null) OR (p_structure_version_id is not null AND structure_version_id = p_structure_version_id))
              AND current_flag <> 'W'   -- Bug 3879461
--        and as_of_date not in (select trunc(date_computed)
--                       from pa_percent_completes
--                                      where project_id = p_project_id
--                                        and object_id = p_object_id
--                                        and object_type = p_object_type
--                      and structure_type = p_structure_type
--                                        and published_flag = 'N'
--                                        and date_computed <= p_as_of_date
--                  and NVL(proj_element_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES'
-- , NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */

-- Begin fix for Bug # 4243074.

-- For Bug 9595490 Modified "and NVL(proj_element_id,-1) =" to   "and proj_element_id ="
and proj_element_id = DECODE(p_structure_type, 'FINANCIAL'
                             , DECODE(p_object_type, 'PA_STRUCTURES'
                                           , 0
                                       --bug 4250623, for deliverable dont compare with p_proj_element_id as it may not be associated with task
                                       --, (DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id))))
                                       , (DECODE(p_object_type, 'PA_DELIVERABLES', NVL(proj_element_id,-1),NVL(p_proj_element_id, p_object_id))))
                             --bug 4250623, for deliverable dont compare with p_proj_element_id as it may not be associated with task
                             --,(DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id))))
                             ,(DECODE(p_object_type, 'PA_DELIVERABLES', NVL(proj_element_id,-1),NVL(p_proj_element_id, p_object_id))))

-- End fix for Bug # 4243074.

                    --and task_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
--                                     )

--              and NVL(proj_element_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
-- Commented out to fix Bug # 4243074.

          --and proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
          ;
Line: 2474

   select wq_enable_flag
     into l_wq_enable_flag
     from pa_proj_progress_attr
    where project_id = p_project_id
      and object_Type = 'PA_STRUCTURES'
      and structure_type = 'WORKPLAN' -- FPM Dev CR 3
      ;
Line: 2499

  select percent_complete_id
    from pa_percent_completes
   where project_id = p_project_id
     and object_id = p_object_id
     and object_type = p_object_type
     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
     and published_flag = 'Y'
     and current_flag = 'Y';
Line: 2530

      X_last_update_login => fnd_global.login_id);
Line: 2556

  SELECT ppe.manager_person_id
  FROM pa_proj_elements PPE,
       pa_proj_element_versions PPEV
  WHERE ppev.element_version_id = c_element_version_id
  AND ppev.proj_element_id = ppe.proj_element_id;
Line: 2564

  SELECT rel.object_id_from1
  FROM pa_object_relationships rel
  WHERE rel.object_id_to1 = c_element_version_id
  AND rel.object_type_to = 'PA_TASKS'
  AND rel.relationship_type = 'S'
  AND rel.object_type_from = 'PA_TASKS';
Line: 2573

  SELECT ppev.element_version_id
  FROM pa_proj_element_versions ppev
  WHERE ppev.proj_element_id = c_proj_element_id
  AND ppev.parent_structure_version_id = c_parent_structure_version_id;
Line: 2580

  SELECT ppevs.element_version_id
  FROM pa_proj_elem_ver_structure ppevs
  WHERE ppevs.project_id = p_project_id
  AND ppevs.latest_eff_published_flag = 'Y';
Line: 2641

     Select ppa.task_weight_basis_code
     From   pa_proj_progress_attr ppa,pa_proj_structure_types pst,pa_structure_types st
     Where  ppa.project_id  = c_project_id
     And    ppa.object_type = 'PA_STRUCTURES'
     And ppa.structure_type = p_structure_type -- FPM Dev CR 3
     And    ppa.object_id   = pst.proj_element_id
        And    st.structure_type = 'WORKPLAN'
     And    st.structure_type_id = pst.structure_type_id;
Line: 2673

        select status_code
        into l_status_code
        from pa_proj_elements
        where project_id = p_project_id
        and proj_element_id = p_proj_element_id
        and object_type = p_object_type;
Line: 2689

            select ptt.prog_entry_enable_flag
            into l_return_value
            from pa_proj_elements ppe, pa_task_types ptt
            where ppe.type_id = ptt.task_type_id(+)
            and ppe.project_id = p_project_id
            and ppe.proj_element_id = p_proj_element_id;
Line: 2722

        select percent_comp_enable_flag,allow_phy_prcnt_cmp_overrides
        from pa_proj_progress_attr
        where project_id = p_project_id
        and structure_type = p_structure_type;
Line: 2761

    SELECT min(date_computed)
      FROM pa_percent_completes
     WHERE object_id = p_object_id
       AND project_id = p_project_id
       and object_type = p_object_type
       AND structure_type = p_structure_type
       and NVL(task_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_task_id,NVL(task_id,-1)),NVL(p_task_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
       --and task_id = nvl(p_task_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 2809

   SELECT 'x'
   FROM pa_proj_elements ppe,
    pa_object_relationships por,
    pa_task_types ttype
   WHERE
              ppe.object_type = 'PA_TASKS'
          and ppe.proj_element_id = por.object_id_from2
          and por.object_type_from = 'PA_TASKS'
          and por.object_type_to = 'PA_DELIVERABLES'
          and por.relationship_type = 'A'
          and por.relationship_subtype = 'TASK_TO_DELIVERABLE'
          and nvl(ppe.base_percent_comp_deriv_code,ttype.base_percent_comp_deriv_code)='DELIVERABLE'
      and ppe.proj_element_id = p_object_id
      and ppe.type_id = ttype.task_type_id;
Line: 2847

    SELECT NVL( EQPMT_ACT_EFFORT_TO_DATE, 0 ) + NVL( PPL_ACT_EFFORT_TO_DATE, 0 ) + nvl(oth_quantity_to_date,0)
     FROM pa_progress_rollup
    WHERE  project_id = p_project_id
     AND   object_id  = p_object_id
     --Commented by rtarway for BUG 3835474
     /*AND   as_of_date = ( SELECT max(as_of_date)
                           from pa_progress_rollup
                          WHERE as_of_date < p_as_of_date
                           AND  project_id = p_project_id
                           AND object_id  = p_object_id
                           AND object_type = p_object_type
                           AND structure_type = p_structure_type
                           and NVL(proj_element_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id)) /* Amit : Modified for IB4 Progress CR.
                   --and proj_element_id = nvl(p_proj_element_id, p_object_id)  Modified for IB4 Progress CR.
                       )*/
     --Added by rtarway for BUG 3835474
     AND   as_of_date = ( SELECT max(as_of_date)
                           from pa_progress_rollup ppr2
                          WHERE ppr2.as_of_date <= p_as_of_date
                           AND  ppr2.project_id = p_project_id
                           AND ppr2.object_id  = p_object_id
                           AND ppr2.object_type = p_object_type
                           AND ppr2.structure_type = p_structure_type
               AND ppr2.current_flag <> 'W'   -- Bug 3879461
               AND ppr2.structure_version_id is null   -- Bug 3879461
                           and NVL(ppr2.proj_element_id,-1)
                           = DECODE(p_object_type, 'PA_DELIVERABLES',
                                    NVL(p_proj_element_id,
                                        NVL(ppr2.proj_element_id,-1)),
                                    NVL(p_proj_element_id, p_object_id)
                                   ) /* Amit : Modified for IB4 Progress CR. */
--                           AND NOT EXISTS
--                           (
--                      SELECT 'X' FROM pa_percent_completes ppc
--                      WHERE ppc.date_computed = ppr2.as_of_date
--                      AND   ppc.project_id = p_project_id
--                      AND   ppc.object_id  = p_object_id
--                      AND   ppc.object_type = p_object_type
--                      AND   ppc.structure_type = p_structure_type
--                      AND   ppc.published_flag = 'N'
--                           )
                      )
     AND   object_type = p_object_type
     AND structure_type = p_structure_type
     AND current_flag <> 'W'   -- Bug 3879461
     AND structure_version_id is null   -- Bug 3879461
     and NVL(proj_element_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
     --and proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
    ;
Line: 2917

    SELECT (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)+nvl(ppr.eqpmt_act_cost_to_date_tc,0))
     FROM pa_progress_rollup ppr
    WHERE  ppr.project_id = p_project_id
     AND   ppr.object_id  = p_object_id
     AND   ppr.as_of_date = ( SELECT max(as_of_date)
                           from pa_progress_rollup ppr2
                          WHERE ppr2.as_of_date < p_as_of_date
                           AND  ppr2.project_id = p_project_id
                           AND ppr2.object_id  = p_object_id
                           AND ppr2.object_type = p_object_type
                           AND ppr2.structure_type = p_structure_type
               AND ppr2.current_flag <> 'W'   -- Bug 3879461
               AND ppr2.structure_version_id is null   -- Bug 3879461
                       and NVL(proj_element_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
                       --and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                       )
     AND   ppr.object_type = p_object_type
     AND ppr.structure_type = p_structure_type
     AND ppr.current_flag <> 'W'   -- Bug 3879461
     AND ppr.structure_version_id is null   -- Bug 3879461
     and NVL(proj_element_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
     --and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 3000

SELECT org_id from pa_implementations;
Line: 3009

SELECT ppa.project_currency_code,
    ppfo.project_cost_rate_type,
    ppfo.project_cost_rate_date_type,
    ppfo.project_cost_rate_date,
    ppa.projfunc_currency_code,
    ppfo.projfunc_cost_rate_type,
    ppfo.projfunc_cost_rate_date_type,
    ppfo.projfunc_cost_rate_date,
    ppfo.proj_fp_options_id
FROM pa_projects_all ppa,
    pa_proj_fp_options ppfo
WHERE ppa.project_id = p_project_id
and ppfo.fin_plan_type_id = (select fin_plan_type_id
            from pa_fin_plan_types_b
               where use_for_workplan_flag = 'Y')
and ppfo.project_id = p_project_id
and ppfo.fin_plan_option_level_code = 'PLAN_TYPE';
Line: 3030

SELECT resource_assignment_id,
       start_date,
       end_date,
       project_cost_rate_type,
       project_cost_rate_date_type,
       project_cost_rate_date,
       project_cost_exchange_rate,
       projfunc_cost_rate_type,
       projfunc_cost_rate_date_type,
       projfunc_cost_rate_date,
       projfunc_cost_exchange_rate
FROM pa_budget_lines
where budget_version_id = c_budget_version_id
and resource_assignment_id = c_res_assignment_id
and c_as_of_date between start_date and end_date
and txn_currency_code = c_txn_curr_code;
Line: 3049

SELECT c.projfunc_cost_exchange_rate
  ,c.project_cost_exchange_rate
FROM pa_fp_txn_currencies c
WHERE c.proj_fp_options_id = c_proj_fp_options_id
AND   c.txn_currency_code = c_txn_curr_code ;
Line: 3058

SELECT gsb.period_set_name
    ,gsb.accounted_period_type
    ,pia.pa_period_type
    ,decode(pbv.version_type,
        'COST',ppfo.cost_time_phased_code,
        'REVENUE',ppfo.revenue_time_phased_code,
         ppfo.all_time_phased_code) time_phase_code
FROM gl_sets_of_books           gsb
    ,pa_implementations_all pia
    ,pa_projects_all        ppa
    ,pa_budget_versions     pbv
    ,pa_proj_fp_options     ppfo
WHERE ppa.project_id        = pbv.project_id
AND pbv.budget_version_id = ppfo.fin_plan_version_id
--AND nvl(ppa.org_id,-99)   = nvl(pia.org_id,-99)  R12: Bug 4363092:
AND ppa.org_id   = pia.org_id
AND gsb.set_of_books_id   = pia.set_of_books_id
AND pbv.budget_version_id = c_budget_version_id;
Line: 3080

SELECT START_DATE, END_DATE, PERIOD_NAME
FROM gl_periods gp
WHERE gp.period_set_name  = c_period_set_name
AND gp.period_type      = decode(c_time_phase_code,'G',c_accounted_period_type,'P',c_pa_period_type)
AND gp.adjustment_period_flag = 'N'
AND gp.start_date  <= c_as_of_date
AND gp.end_date   >= c_as_of_date
ORDER BY gp.start_date;
Line: 3681

            select (nvl(ppr.oth_act_cost_to_date_pc,0)+nvl(ppr.ppl_act_cost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_pc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_cost_pc,0)+nvl(ppr.subprj_eqpmt_act_cost_pc,0))
            into l_actual_cost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_pa_period_name = p_period_name
            and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id IS NULL   --bug 3802177
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                     and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_pa_period_name = ppr.prog_pa_period_name
                     and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
             );
Line: 3707

            select (nvl(ppr.oth_act_cost_to_date_pc,0)+nvl(ppr.ppl_act_cost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_pc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_cost_pc,0)+nvl(ppr.subprj_eqpmt_act_cost_pc,0))
                  into l_prev_period_actual_cost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
               and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
                   and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                                     and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_pa_period_name = p_period_name
                             and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 3738

            select (nvl(ppr.oth_act_cost_to_date_pc,0)+nvl(ppr.ppl_act_cost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_pc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_cost_pc,0)+nvl(ppr.subprj_eqpmt_act_cost_pc,0))
            into l_actual_cost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_gl_period_name = p_period_name
            and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
                and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_gl_period_name = ppr.prog_gl_period_name
                     and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 3763

            select (nvl(ppr.oth_act_cost_to_date_pc,0)+nvl(ppr.ppl_act_cost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_pc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_cost_pc,0)+nvl(ppr.subprj_eqpmt_act_cost_pc,0))
                  into l_prev_period_actual_cost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
       and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_gl_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 3793

                select (nvl(ppr.oth_act_cost_to_date_pc,0)+nvl(ppr.ppl_act_cost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_pc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_cost_pc,0)+nvl(ppr.subprj_eqpmt_act_cost_pc,0))
                into l_actual_cost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                --and ppr.object_version_id = p_object_version_id
            and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
                and ppr.as_of_date = p_as_of_date
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 3808

           select (nvl(ppr.oth_act_cost_to_date_pc,0)+nvl(ppr.ppl_act_cost_to_date_pc,0)
                    +nvl(ppr.eqpmt_act_cost_to_date_pc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
                    +nvl(ppr.subprj_ppl_act_cost_pc,0)+nvl(ppr.subprj_eqpmt_act_cost_pc,0))
           into l_actual_cost
           from pa_progress_rollup ppr
          where ppr.project_id = p_project_id
            and ppr.object_id = p_object_id
            and ppr.structure_version_id = p_structure_version_id
            and structure_type = 'WORKPLAN'
        and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 3828

            select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0))
            into l_actual_cost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_pa_period_name = p_period_name
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_pa_period_name = ppr.prog_pa_period_name
            and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 3853

            select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0))
                  into l_prev_period_actual_cost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
       and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_pa_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 3885

            select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0))
            into l_actual_cost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_gl_period_name = p_period_name
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_gl_period_name = ppr.prog_gl_period_name
            and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 3910

            select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0))
                  into l_prev_period_actual_cost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
       and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_gl_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 3940

                select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0))
                into l_actual_cost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.object_version_id = p_object_version_id
            and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
                and ppr.as_of_date = p_as_of_date
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 3955

               select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)
                        +nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)
                        +nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0))
                into l_actual_cost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.object_version_id = p_object_version_id
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id = p_structure_version_id
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 3974

            select (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_fc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0))
            into l_actual_cost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_pa_period_name = p_period_name
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_pa_period_name = ppr.prog_pa_period_name
            and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 3999

            select (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_fc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0))
                  into l_prev_period_actual_cost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
       and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_pa_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 4030

            select (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_fc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0))
            into l_actual_cost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_gl_period_name = p_period_name
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_gl_period_name = ppr.prog_gl_period_name
            and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 4055

            select (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_fc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0))
                  into l_prev_period_actual_cost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
       and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_gl_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 4085

                select (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_cost_to_date_fc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0))
                into l_actual_cost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.object_version_id = p_object_version_id
            and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
                and ppr.as_of_date = p_as_of_date
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 4101

                select (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)
                        +nvl(ppr.eqpmt_act_cost_to_date_fc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
                        +nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0))
                into l_actual_cost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.object_version_id = p_object_version_id
                and structure_type = 'WORKPLAN'
                and ppr.structure_version_id = p_structure_version_id
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 4143

            select (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0))
            into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_pa_period_name = p_period_name
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_pa_period_name = ppr.prog_pa_period_name
            and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 4168

            select (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0))
                  into l_prev_period_actual_rawcost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
       and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_pa_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 4199

            select (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0))
            into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_gl_period_name = p_period_name
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_gl_period_name = ppr.prog_gl_period_name
            and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 4224

            select (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0))
                  into l_prev_period_actual_rawcost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
       and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_gl_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 4254

                select (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0))
                into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                --and ppr.object_version_id = p_object_version_id
            and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
                and ppr.as_of_date = p_as_of_date
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 4269

                select (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)
                        +nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)
                        +nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0))
                into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.object_version_id = p_object_version_id
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id = p_structure_version_id
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 4288

            select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0))
            into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_pa_period_name = p_period_name
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_pa_period_name = ppr.prog_pa_period_name
            and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 4313

            select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0))
                  into l_prev_period_actual_rawcost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
       and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_pa_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 4345

            select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0))
            into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_gl_period_name = p_period_name
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_gl_period_name = ppr.prog_gl_period_name
            and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 4370

            select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0))
                  into l_prev_period_actual_rawcost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
       and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_gl_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 4400

                select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0))
                into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.object_version_id = p_object_version_id
            and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
                and ppr.as_of_date = p_as_of_date
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 4415

                select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
                        +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
                        +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0))
                into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.object_version_id = p_object_version_id
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id = p_structure_version_id
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 4434

            select (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0))
            into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_pa_period_name = p_period_name
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr.structure_version_id IS NULL   --bug 3802177
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                  and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_pa_period_name = ppr.prog_pa_period_name
            and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 4459

            select (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0))
                  into l_prev_period_actual_rawcost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
       and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
                            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                                     and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_pa_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 4490

            select (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0))
            into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_gl_period_name = p_period_name
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id IS NULL   --bug 3802177
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                     and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_gl_period_name = ppr.prog_gl_period_name
            and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 4515

            select (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0))
                  into l_prev_period_actual_rawcost
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
       and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                                     and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_gl_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 4545

                select (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0))
                into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.object_version_id = p_object_version_id
            and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id IS NULL   --bug 3802177
                and ppr.as_of_date = p_as_of_date
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 4560

               select (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)
                        +nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)
                        +nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0))
                into l_actual_rawcost
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.object_version_id = p_object_version_id
                and structure_type = 'WORKPLAN'
                and ppr.structure_version_id = p_structure_version_id
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 4598

                select (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)+nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)+nvl(ppr.oth_quantity_to_date,0))
                into l_actual_effort
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_pa_period_name = p_period_name
                and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id IS NULL   --bug 3802177
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                     and ppr2.structure_version_id IS NULL   --bug 3802177
                                     and ppr2.prog_pa_period_name = ppr.prog_pa_period_name
                         and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 4621

                select (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)+nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)+nvl(ppr.oth_quantity_to_date,0))
                  into l_prev_period_actual_effort
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
               and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
                          and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                                     and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_pa_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 4652

                select (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)+nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)+nvl(ppr.oth_quantity_to_date,0))
                into l_actual_effort
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and prog_gl_period_name = p_period_name
            and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id IS NULL   --bug 3802177
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                and ppr.as_of_date = (select max(as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = ppr.project_id
                                     and ppr2.object_id = ppr.object_id
                                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr2.structure_version_id IS NULL   --bug 3802177
                             and ppr2.prog_gl_period_name = ppr.prog_gl_period_name --maansari6/15 bug 3694031
            and ppr2.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */);
Line: 4675

                select (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)+nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)+nvl(ppr.oth_quantity_to_date,0))
                  into l_prev_period_actual_effort
                  from pa_progress_rollup ppr
                 where ppr.project_id = p_project_id
                   and ppr.object_id = p_object_id
                   and ppr.structure_type = 'WORKPLAN'
                   and ppr.structure_version_id IS NULL
               and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                   and ppr.as_of_date = ( select max(ppr1.as_of_date)
                                 from pa_progress_rollup ppr1
                                where ppr1.project_id = ppr.project_id
                                  and ppr1.object_id = ppr.object_id
                                  and ppr1.structure_type = 'WORKPLAN'
                                  and ppr1.structure_version_id IS NULL   --bug 3802177
                            and ppr1.proj_element_id = ppr.proj_element_id /* Modified for IB4 Progress CR. */
                                  and as_of_date < ( select min(as_of_date)
                                                   from pa_progress_rollup ppr2
                                                   where ppr2.project_id = ppr1.project_id
                                                     and ppr2.object_id = ppr1.object_id
                                                     and structure_type = 'WORKPLAN'
                                                     and ppr2.structure_version_id IS NULL   --bug 3802177
                                                     and ppr2.prog_gl_period_name = p_period_name
            and ppr2.proj_element_id = ppr1.proj_element_id /* Modified for IB4 Progress CR. */
                                                ));
Line: 4705

                select (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)+nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)+nvl(ppr.oth_quantity_to_date,0))
                into l_actual_effort
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.object_version_id = p_object_version_id
            and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id IS NULL   --bug 3802177
                and ppr.as_of_date = p_as_of_date
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 4719

               select (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)+nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)+nvl(ppr.oth_quantity_to_date,0))
                into l_actual_effort
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.object_version_id = p_object_version_id
             and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id = p_structure_version_id
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 4750

                 select (nvl(ppr.oth_act_cost_to_date_pc,0)+nvl(ppr.ppl_act_cost_to_date_pc,0)
                     +nvl(ppr.eqpmt_act_cost_to_date_pc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
                     +nvl(ppr.subprj_ppl_act_cost_pc,0)+nvl(ppr.subprj_eqpmt_act_cost_pc,0)) act_cost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                        and ppr.structure_version_id is null -- Bug 3764224
                and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and current_flag = 'Y'
				AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
                ;
Line: 4764

                 select (nvl(ppr.oth_act_cost_to_date_pc,0)+nvl(ppr.ppl_act_cost_to_date_pc,0)
                     +nvl(ppr.eqpmt_act_cost_to_date_pc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
                     +nvl(ppr.subprj_ppl_act_cost_pc,0)+nvl(ppr.subprj_eqpmt_act_cost_pc,0)) act_cost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id is null -- Bug 3764224
                and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and ppr.current_flag= 'W'
				AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
                ;
Line: 4810

         select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)+nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)+nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0)) act_cost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
         and structure_type = 'WORKPLAN' -- FPM Dev CR 3
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                                     -- and ppr2.object_version_id = p_object_version_id
                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                     and ppr2.as_of_date > p_as_of_date
    and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR. );
Line: 4830

         select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)+nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)+nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0)) act_cost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppr.structure_version_id is null -- Bug 3764224
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     and ppr2.structure_version_id is null -- Bug 3764224
                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date < p_as_of_date);
Line: 4848

        select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)+nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)+nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0)) act_cost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppr.structure_version_id is null -- Bug 3764224
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     and ppr2.structure_version_id is null -- Bug 3764224
                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date >= p_as_of_date);
Line: 4870

                 select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)
                     +nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)
                     +nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0)) act_cost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
				AND NVL(ppr.cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
                -- and ppr.object_version_id = p_object_version_id
                and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                        and ppr.structure_version_id is null -- Bug 3764224
                and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and current_flag = 'Y'
                ;
Line: 4885

                 select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)
                     +nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)
                     +nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0)) act_cost_to_date
                from pa_progress_rollup ppr
        -- Bug 3879461 : No need to have percent complete table join now we can directly check current_flag as W
--                    ,pa_percent_completes ppc
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
				AND NVL(ppr.cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
                -- and ppr.object_version_id = p_object_version_id
                and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id is null -- Bug 3764224
                and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
--                and ppr.object_id = ppc.object_id
--                and ppr.as_of_date = ppc.date_computed
--                and ppr.percent_complete_id = ppc.percent_complete_id
--                and ppr.project_id = ppc.project_id
--                and ppr.proj_element_id=ppc.task_id
--                and ppr.structure_type = ppc.structure_type
--                and ppc.current_flag= 'N'
--                and ppc.published_flag = 'N'
                  and ppr.current_flag= 'W'
                ;
Line: 4919

        select (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)+nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)+nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0))
                into l_act_cost_pub
                from pa_progress_rollup ppr,pa_percent_completes ppc
                where ppr.project_id = ppc.project_id
            and ppr.object_id = ppc.object_id
            and ppr.object_version_id = ppc.object_version_id
            and ppr.as_of_date = ppc.date_computed (+)
        and ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
            and ppr.percent_complete_id = ppc.percent_complete_id
         and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
         and ppr.structure_type = ppc.structure_type(+) -- FPM Dev CR 3
        and ppr.proj_element_id = ppc.task_id (+) -- Modified for IB4 Progress CR.
                and ppr.as_of_date = (select max(ppc2.date_computed)
                                     from pa_percent_completes ppc2
                                     where ppc2.project_id = p_project_id
                                     and ppc2.object_id = p_object_id
                                     -- and ppc2.object_version_id = p_object_version_id
                     and ppc2.published_flag = 'Y'
                     and ppc2.current_flag = 'Y'
                         and ppc2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppc2.task_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
                     );
Line: 4997

     SELECT  (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)+nvl(ppr.eqpmt_act_cost_to_date_tc,0)
                     +nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)+nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0)) act_bur_cost_tc,
         (nvl(ppr.oth_act_cost_to_date_pc,0)+nvl(ppr.ppl_act_cost_to_date_pc,0)+nvl(ppr.eqpmt_act_cost_to_date_pc,0)
                     +nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)+nvl(ppr.subprj_ppl_act_cost_pc,0)+nvl(ppr.subprj_eqpmt_act_cost_pc,0)) act_bur_cost_pc,
         (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)+nvl(ppr.eqpmt_act_cost_to_date_fc,0)
                     +nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)+nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0)) act_bur_cost_fc,
         (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)+nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)
                     +nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)+nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0)) act_raw_cost_tc,
         (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)+nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)
                     +nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)+nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0)) act_raw_cost_pc,
         (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)+nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)
                     +nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)+nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0)) act_raw_cost_fc,
         (nvl(ppr.oth_etc_cost_tc,0)+nvl(ppr.ppl_etc_cost_tc,0)+nvl(ppr.eqpmt_etc_cost_tc,0)
                     +nvl(ppr.subprj_oth_etc_cost_tc,0)+nvl(ppr.subprj_ppl_etc_cost_tc,0)+nvl(ppr.subprj_eqpmt_etc_cost_tc,0)) etc_bur_cost_tc,
         (nvl(ppr.oth_etc_cost_pc,0)+nvl(ppr.ppl_etc_cost_pc,0)+nvl(ppr.eqpmt_etc_cost_pc,0)
                     +nvl(ppr.subprj_oth_etc_cost_pc,0)+nvl(ppr.subprj_ppl_etc_cost_pc,0)+nvl(ppr.subprj_eqpmt_etc_cost_pc,0)) etc_bur_cost_pc,
         (nvl(ppr.oth_etc_cost_fc,0)+nvl(ppr.ppl_etc_cost_fc,0)+nvl(ppr.eqpmt_etc_cost_fc,0)
                     +nvl(ppr.subprj_oth_etc_cost_fc,0)+nvl(ppr.subprj_ppl_etc_cost_fc,0)+nvl(ppr.subprj_eqpmt_etc_cost_fc,0)) etc_bur_cost_fc,
         (nvl(ppr.oth_etc_rawcost_tc,0)+nvl(ppr.ppl_etc_rawcost_tc,0)+nvl(ppr.eqpmt_etc_rawcost_tc,0)
                     +nvl(ppr.subprj_oth_etc_rawcost_tc,0)+nvl(ppr.subprj_ppl_etc_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_etc_rawcost_tc,0)) etc_raw_cost_tc,
         (nvl(ppr.oth_etc_rawcost_pc,0)+nvl(ppr.ppl_etc_rawcost_pc,0)+nvl(ppr.eqpmt_etc_rawcost_pc,0)
                     +nvl(ppr.subprj_oth_etc_rawcost_pc,0)+nvl(ppr.subprj_ppl_etc_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_etc_rawcost_pc,0)) etc_raw_cost_pc,
         (nvl(ppr.oth_etc_rawcost_fc,0)+nvl(ppr.ppl_etc_rawcost_fc,0)+nvl(ppr.eqpmt_etc_rawcost_fc,0)
                     +nvl(ppr.subprj_oth_etc_rawcost_fc,0)+nvl(ppr.subprj_ppl_etc_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_etc_rawcost_fc,0)) etc_raw_cost_fc,
         (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0))--+nvl(ppr.oth_quantity_to_date,0))Oth quantity is not required as it can be in diffrent UOM
                     +nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0) act_effort,
         (nvl(ppr.estimated_remaining_effort,0)+nvl(ppr.eqpmt_etc_effort,0))--+nvl(ppr.oth_etc_quantity,0))Oth quantity is not required as it can be in diffrent UOM
                     +nvl(ppr.subprj_ppl_etc_effort,0)+nvl(ppr.subprj_eqpmt_etc_effort,0) etc_effort
                FROM pa_progress_rollup ppr
                WHERE ppr.project_id = p_project_id
                AND ppr.object_id = p_object_id
        AND ppr.object_type = p_object_type
                AND ppr.structure_version_id = p_structure_version_id
            AND ppr.structure_type = 'WORKPLAN'
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 5034

     SELECT  (nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)+nvl(ppr.eqpmt_act_cost_to_date_tc,0)
                     +nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)+nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0)) act_bur_cost_tc,
         (nvl(ppr.oth_act_cost_to_date_pc,0)+nvl(ppr.ppl_act_cost_to_date_pc,0)+nvl(ppr.eqpmt_act_cost_to_date_pc,0)
                     +nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)+nvl(ppr.subprj_ppl_act_cost_pc,0)+nvl(ppr.subprj_eqpmt_act_cost_pc,0)) act_bur_cost_pc,
         (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)+nvl(ppr.eqpmt_act_cost_to_date_fc,0)
                     +nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)+nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0)) act_bur_cost_fc,
         (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)+nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)
                     +nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)+nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0)) act_raw_cost_tc,
         (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)+nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)
                     +nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)+nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0)) act_raw_cost_pc,
         (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)+nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)
                     +nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)+nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0)) act_raw_cost_fc,
         (nvl(ppr.oth_etc_cost_tc,0)+nvl(ppr.ppl_etc_cost_tc,0)+nvl(ppr.eqpmt_etc_cost_tc,0)
                     +nvl(ppr.subprj_oth_etc_cost_tc,0)+nvl(ppr.subprj_ppl_etc_cost_tc,0)+nvl(ppr.subprj_eqpmt_etc_cost_tc,0)) etc_bur_cost_tc,
         (nvl(ppr.oth_etc_cost_pc,0)+nvl(ppr.ppl_etc_cost_pc,0)+nvl(ppr.eqpmt_etc_cost_pc,0)
                     +nvl(ppr.subprj_oth_etc_cost_pc,0)+nvl(ppr.subprj_ppl_etc_cost_pc,0)+nvl(ppr.subprj_eqpmt_etc_cost_pc,0)) etc_bur_cost_pc,
         (nvl(ppr.oth_etc_cost_fc,0)+nvl(ppr.ppl_etc_cost_fc,0)+nvl(ppr.eqpmt_etc_cost_fc,0)
                     +nvl(ppr.subprj_oth_etc_cost_fc,0)+nvl(ppr.subprj_ppl_etc_cost_fc,0)+nvl(ppr.subprj_eqpmt_etc_cost_fc,0)) etc_bur_cost_fc,
         (nvl(ppr.oth_etc_rawcost_tc,0)+nvl(ppr.ppl_etc_rawcost_tc,0)+nvl(ppr.eqpmt_etc_rawcost_tc,0)
                     +nvl(ppr.subprj_oth_etc_rawcost_tc,0)+nvl(ppr.subprj_ppl_etc_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_etc_rawcost_tc,0)) etc_raw_cost_tc,
         (nvl(ppr.oth_etc_rawcost_pc,0)+nvl(ppr.ppl_etc_rawcost_pc,0)+nvl(ppr.eqpmt_etc_rawcost_pc,0)
                     +nvl(ppr.subprj_oth_etc_rawcost_pc,0)+nvl(ppr.subprj_ppl_etc_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_etc_rawcost_pc,0)) etc_raw_cost_pc,
         (nvl(ppr.oth_etc_rawcost_fc,0)+nvl(ppr.ppl_etc_rawcost_fc,0)+nvl(ppr.eqpmt_etc_rawcost_fc,0)
                     +nvl(ppr.subprj_oth_etc_rawcost_fc,0)+nvl(ppr.subprj_ppl_etc_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_etc_rawcost_fc,0)) etc_raw_cost_fc,
         (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0))--+nvl(ppr.oth_quantity_to_date,0))Oth quantity is not required as it can be in diffrent UOM
                     +nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0) act_effort,
         (nvl(ppr.estimated_remaining_effort,0)+nvl(ppr.eqpmt_etc_effort,0))--+nvl(ppr.oth_etc_quantity,0))Oth quantity is not required as it can be in diffrent UOM
                     +nvl(ppr.subprj_ppl_etc_effort,0)+nvl(ppr.subprj_eqpmt_etc_effort,0) etc_effort
                FROM pa_progress_rollup ppr
                WHERE ppr.project_id = p_project_id
                AND ppr.object_id = p_object_id
        AND ppr.object_type = p_object_type
                AND ppr.structure_version_id is null
            AND ppr.structure_type = 'WORKPLAN'
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
            AND ppr.current_flag <> 'W'   -- Bug 3879461
        AND trunc(as_of_date) = (
                SELECT trunc(max(as_of_date))
                FROM pa_progress_rollup ppr2
                        WHERE ppr2.project_id = p_project_id
                AND ppr2.object_id = p_object_id
                AND ppr2.object_type = p_object_type
                AND ppr2.structure_version_id is null
                AND ppr2.structure_type = 'WORKPLAN'
                AND as_of_date <= p_as_of_date
                    AND ppr2.current_flag <> 'W'   -- Bug 3879461
                            and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
            );
Line: 5184

         select (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)+nvl(ppr.eqpmt_act_cost_to_date_fc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)+nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0)) act_cost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
         and structure_type = 'WORKPLAN' -- FPM Dev CR 3
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id)  --Modified for IB4 Progress CR.
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                                     -- and ppr2.object_version_id = p_object_version_id
                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                     and ppr2.as_of_date > p_as_of_date
        and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR. );
Line: 5203

         select (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)+nvl(ppr.eqpmt_act_cost_to_date_fc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)+nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0)) act_cost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppr.structure_version_id is null -- Bug 3764224
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     and ppr2.structure_version_id is null -- Bug 3764224
                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date < p_as_of_date);
Line: 5221

         select (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)+nvl(ppr.eqpmt_act_cost_to_date_fc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)+nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0)) act_cost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppr.structure_version_id is null -- Bug 3764224
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     and ppr2.structure_version_id is null -- Bug 3764224
                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date >= p_as_of_date);
Line: 5247

        select (nvl(ppr.oth_act_cost_to_date_fc,0)+nvl(ppr.ppl_act_cost_to_date_fc,0)+nvl(ppr.eqpmt_act_cost_to_date_fc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)+nvl(ppr.subprj_ppl_act_cost_fc,0)+nvl(ppr.subprj_eqpmt_act_cost_fc,0))
                into l_act_cost_pub
                from pa_progress_rollup ppr,pa_percent_completes ppc
                where ppr.project_id = ppc.project_id
            and ppr.object_id = ppc.object_id
            and ppr.object_version_id = ppc.object_version_id
            and ppr.as_of_date = ppc.date_computed (+)
        and ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
            and ppr.percent_complete_id = ppc.percent_complete_id
         and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
         and ppr.structure_type = ppc.structure_type(+) -- FPM Dev CR 3
        and ppr.proj_element_id = ppc.task_id (+) -- Modified for IB4 Progress CR.
                and ppr.as_of_date = (select max(ppc2.date_computed)
                                     from pa_percent_completes ppc2
                                     where ppc2.project_id = p_project_id
                                     and ppc2.object_id = p_object_id
                                     -- and ppc2.object_version_id = p_object_version_id
                     and ppc2.published_flag = 'Y'
                     and ppc2.current_flag = 'Y'
                         and ppc2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppc2.task_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
                     );
Line: 5310

         select (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)+nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)+nvl(ppr.oth_quantity_to_date,0)) act_effort_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
         and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                                     -- and ppr2.object_version_id = p_object_version_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                     and ppr2.as_of_date > p_as_of_date);
Line: 5326

         select (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)+nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)+nvl(ppr.oth_quantity_to_date,0)) act_effort_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
                and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id is null -- Bug 3764224
                and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and current_flag = 'Y'
                ;
Line: 5337

                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     and ppr2.structure_version_id is null -- Bug 3764224
                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date <= p_as_of_date);
Line: 5348

         select (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)+nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)+nvl(ppr.oth_quantity_to_date,0)) act_effort_to_date
                from pa_progress_rollup ppr
              -- Bug 3879461 : Now percent complete join is not required. current_flag = W can be used
--                    ,pa_percent_completes ppc
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
                and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
            and ppr.structure_version_id is null -- Bug 3764224
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
--                and ppr.object_id = ppc.object_id
--                and ppr.as_of_date = ppc.date_computed
--                and ppr.percent_complete_id = ppc.percent_complete_id
--                and ppr.project_id = ppc.project_id
--                and ppr.proj_element_id=ppc.task_id
--                and ppr.structure_type = ppc.structure_type
--                and ppc.current_flag= 'N'
--                and ppc.published_flag = 'N'
                and ppr.current_flag= 'W'
                ;
Line: 5369

                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                     and ppr2.structure_version_id is null -- Bug 3764224
                                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date > p_as_of_date);
Line: 5410

        select (nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)+nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)+nvl(ppr.oth_quantity_to_date,0))
                into l_act_effort_pub
                from pa_progress_rollup ppr,pa_percent_completes ppc
                where ppr.project_id = ppc.project_id
            and ppr.object_id = ppc.object_id
            and ppr.object_version_id = ppc.object_version_id
            and ppr.as_of_date = ppc.date_computed (+)
        and ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.percent_complete_id = ppc.percent_complete_id
         and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
         and ppr.structure_type = ppc.structure_type (+) -- FPM Dev CR 3
                and ppr.as_of_date = (select max(ppc2.date_computed)
                                     from pa_percent_completes ppc2
                                     where ppc2.project_id = p_project_id
                                     and ppc2.object_id = p_object_id
                                     -- and ppc2.object_version_id = p_object_version_id
                     and ppc2.published_flag = 'Y'
                     and ppc2.current_flag = 'Y'
                     and ppc2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     );
Line: 5485

        select 'N'
        from pa_proj_elem_ver_structure ppevs
        where ppevs.project_id = p_project_id
        and ppevs.element_version_id = p_structure_version_id
        and ppevs.date_prog_applied_on_wver < (select max(l_update_date)
                                              from (
                                              select max(last_update_date) l_update_date
                                              from pa_progress_rollup ppr
                                              where ppr.project_id = p_project_id
                                              and object_type in ('PA_ASSIGNMENTS','PA_DELIVERABLES')
                                              and structure_type = 'WORKPLAN'
                                              and current_flag = 'Y'
                                              and ppr.structure_version_id is null
                                              union
                                              select max(last_update_date) l_update_date
                                              from pa_percent_completes
                                              where project_id = p_project_id
                                              and structure_type = 'WORKPLAN'
                                              and published_flag = 'Y'));
Line: 5506

        select 'N'
        from pa_proj_elem_ver_structure ppevs
        where ppevs.project_id = p_project_id
        and ppevs.element_version_id = p_structure_version_id
        and ppevs.date_prog_applied_on_wver is null
        and exists (select '1'
                      from pa_progress_rollup ppr
                     where ppr.project_id = p_project_id
                      and object_type in ('PA_ASSIGNMENTS','PA_DELIVERABLES')
                      and structure_type = 'WORKPLAN'
                      and current_flag = 'Y'
                      and ppr.structure_version_id is null
                    union
                    select '1'
                      from pa_percent_completes
                     where project_id = p_project_id
                      and structure_type = 'WORKPLAN'
                      and published_flag = 'Y');     */
Line: 5528

        l_last_update_date                     DATE;
Line: 5545

	SELECT date_prog_applied_on_wver
        INTO   l_date_prog_applied_on_wver
        FROM   pa_proj_elem_ver_structure ppevs
        WHERE  ppevs.project_id = p_project_id
        AND    ppevs.element_version_id = p_structure_version_id;
Line: 5556

		SELECT
			MAX(ppr.last_update_date)
			INTO   l_last_update_date
			FROM   pa_progress_rollup ppr
			WHERE  ppr.project_id = p_project_id
			AND    ppr.object_type in ('PA_ASSIGNMENTS','PA_DELIVERABLES')
			AND    ppr.structure_type = 'WORKPLAN'
			AND    ppr.current_flag = 'Y'
			AND    ppr.structure_version_id is null;
Line: 5566

	          SELECT
			MAX(ppr.last_update_date)
			INTO   l_last_update_date
			FROM   pa_progress_rollup ppr, pa_proj_elem_ver_structure ppevs
			WHERE  ppr.project_id = p_project_id
			AND    ppr.object_id = ppevs.PROJ_ELEMENT_ID
			AND    ppr.object_type ='PA_STRUCTURES'
			AND    ppr.structure_type = 'WORKPLAN'
			AND    ppr.PROJ_ELEMENT_ID = ppevs.PROJ_ELEMENT_ID
			AND    ppr.current_flag = 'Y'
			AND    ppr.structure_version_id is null
			AND    ppevs.project_id = ppr.project_id
			AND    ppevs.element_version_id = p_structure_version_id;
Line: 5582

            IF l_date_prog_applied_on_wver >= NVL(l_last_update_date,l_date_prog_applied_on_wver) THEN
		If nvl(l_program_flag,'N') = 'Y' then
			SELECT MAX(last_update_date)
			INTO   l_last_update_date
			FROM   pa_percent_completes ppr
			WHERE  project_id = p_project_id
			AND    structure_type = 'WORKPLAN'
			AND    published_flag = 'Y'
			AND    current_flag = 'Y';
Line: 5593

                IF l_date_prog_applied_on_wver < NVL(l_last_update_date,l_date_prog_applied_on_wver) THEN

                    l_return_value := 'N';
Line: 5608

                SELECT 'N'
                INTO   l_return_value
                FROM   DUAL
                WHERE  EXISTS (  SELECT '1'
                                 FROM   pa_progress_rollup ppr
                                 WHERE  ppr.project_id = p_project_id
                                 AND    object_type in ('PA_ASSIGNMENTS','PA_DELIVERABLES')
                                 AND    structure_type = 'WORKPLAN'
                                 AND    current_flag = 'Y'
                                 AND    ppr.structure_version_id IS NULL);
Line: 5628

                    SELECT 'N'
                    INTO   l_return_value
                    FROM   DUAL
                    WHERE  EXISTS (  SELECT '1'
                                     FROM   pa_percent_completes
                                     WHERE  project_id = p_project_id
                                     AND    structure_type = 'WORKPLAN'
                                     AND    published_flag = 'Y');
Line: 5698

                SELECT
        /*+ INDEX(pji_fm_xbs_accum_tmp1 pji_fm_xbs_accum_tmp1_n1)*/ -- Fix for Bug # 4162534.
    decode(p_task_weight_method, 'EFFORT',nvl(LABOR_HOURS,0)+nvl(EQUIPMENT_HOURS,0), PRJ_BRDN_COST)
                INTO  l_value
                FROM PJI_FM_XBS_ACCUM_TMP1
                WHERE project_id = p_project_id
                AND project_element_id = p_proj_element_id
                AND PLAN_VERSION_ID = l_plan_version_id
        AND txn_currency_code is null    --bug no. 3646988
                AND res_list_member_id is null;
Line: 5721

        /*SELECT decode(p_task_weight_method, 'EFFORT',nvl(BASE_LABOR_HOURS,nvl(LABOR_HOURS,0))+
                                                             nvl(BASE_EQUIP_HOURS,nvl(EQUIPMENT_HOURS,0)),
                                                     NVL(PRJ_BASE_BRDN_COST,nvl(PRJ_BRDN_COST,0)))  --if base is not avilable then select the published planned. bug 3781922*/
                -- Bug 4493105 : Added p_program_flag decode
        SELECT
        /*+ INDEX(pji_fm_xbs_accum_tmp1 pji_fm_xbs_accum_tmp1_n1)*/ -- Fix for Bug # 4162534.
               decode(p_task_weight_method, 'EFFORT', decode(p_program_flag, 'N',    nvl(P_BASE_LBR_HOURS, nvl(P_LPB_LBR_HOURS, nvl(P_LBR_HOURS,0)))+
                                                                                     nvl(P_BASE_EQP_HOURS, nvl(P_LPB_EQP_HOURS, nvl(P_EQP_HOURS,0))),
                                                     nvl(BASE_LABOR_HOURS, nvl(LPB_LABOR_HOURS, nvl(LABOR_HOURS,0)))+
                                                                                 nvl(BASE_EQUIP_HOURS, nvl(LPB_EQUIP_HOURS, nvl(EQUIPMENT_HOURS,0)))
                                 ),
                                                     decode(p_program_flag, 'N',NVL(P_BASE_BRDN_COST, nvl(P_LPB_BRDN_COST, nvl(P_BRDN_COST,0)))
                                                       ,NVL(PRJ_BASE_BRDN_COST, nvl(PRJ_LPB_BRDN_COST, nvl(PRJ_BRDN_COST,0)))
                                   )
             )  --if base is not avilable then select the published planned. bug 3781922
                INTO  l_value
                FROM PJI_FM_XBS_ACCUM_TMP1
                WHERE project_id = p_project_id
                AND struct_version_id = p_structure_version_id
                AND project_element_id = p_proj_element_id
                AND txn_currency_code is null    --bug no. 3646988
                AND res_list_member_id is null;
Line: 5746

                SELECT
        /*+ INDEX(pji_fm_xbs_accum_tmp1 pji_fm_xbs_accum_tmp1_n1)*/ -- Fix for Bug # 4162534.
    decode(p_task_weight_method, 'EFFORT',decode(p_program_flag,'N',nvl(P_LBR_HOURS,0)+nvl(P_EQP_HOURS,0)
                                                                  ,nvl(LABOR_HOURS,0)+nvl(EQUIPMENT_HOURS,0))
                               , decode(p_program_flag,'N',P_BRDN_COST,PRJ_BRDN_COST))
                INTO  l_value
                FROM PJI_FM_XBS_ACCUM_TMP1
                WHERE project_id = p_project_id
                AND struct_version_id = p_structure_version_id
                AND project_element_id = p_proj_element_id
        AND txn_currency_code is null    --bug no. 3646988
                AND res_list_member_id is null;
Line: 5784

    SELECT min(trunc(last_update_date))
      FROM pa_percent_completes
     WHERE object_id = p_object_id
       AND project_id = p_project_id
       and object_type = p_object_type
       AND published_flag = 'Y'
       AND structure_type = p_structure_type
       and NVL(task_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_task_id,NVL(task_id,-1)),NVL(p_task_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
       --and task_id = nvl(p_task_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 5819

    SELECT max(trunc(last_update_date))
      FROM pa_percent_completes
     WHERE object_id = p_object_id
       AND project_id = p_project_id
       and object_type = p_object_type
       AND published_flag = 'Y'
       AND structure_type = p_structure_type
       and NVL(task_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_task_id,NVL(task_id,-1)),NVL(p_task_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
       AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
	   ;
Line: 5848

    select max(date_computed)
    from pa_percent_completes ppc
    where ppc.project_id = p_project_id
    and ppc.structure_type = p_structure_type;
Line: 5873

    select 'Y'
    from pa_progress_rollup ppr
    where ppr.project_id = p_project_id
    and ppr.object_id = p_object_id
    and ppr.object_type = p_object_type
    and ppr.structure_type = p_structure_type
    and ppr.structure_version_id is null -- FPM Dev CR 7
        and NVL(proj_element_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
    --and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
    ;
Line: 5885

        select 'Y'
        from pa_progress_rollup ppr
        where ppr.project_id = p_project_id
        and ppr.object_id = p_object_id
        and ppr.object_type = p_object_type
        and ppr.structure_type = p_structure_type
        and ppr.structure_version_id is null -- FPM Dev CR 7
        and NVL(proj_element_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
        and current_flag in ('Y','N');
Line: 5933

  SELECT org_id INTO l_Org_ID FROM PA_Implementations;
Line: 5954

  SELECT org_id INTO l_Org_ID FROM PA_Implementations;
Line: 5999

      Select decode( p_calling_context, 'PROGRESS', NVL(EFF_ROLLUP_PERCENT_COMP,completed_percentage),
                                        'FINANCIAL_PLANNING',
                          decode(p_structure_type, 'FINANCIAL',  NVL(completed_percentage,EFF_ROLLUP_PERCENT_COMP)
                                                              ,  NVL(completed_percentage,BASE_PERCENT_COMPLETE)))
      From   PA_Progress_Rollup
      Where  Project_ID     = P_Project_ID
      AND    Object_ID      = P_Proj_Element_ID
      AND    Object_Type        = p_object_type
      AND    current_flag       <> 'W'     --bug 3879461
      AND    As_Of_Date     = ( select max(As_Of_Date) from pa_progress_rollup
                                    where  Project_ID         = P_Project_ID
                                      AND    Object_ID          = P_Proj_Element_ID
                                      AND    Object_Type        = p_object_type
                                      AND    structure_version_id IS NULL
                                      AND    current_flag       <> 'W'     --bug 3879461
                                      AND    Structure_type     = p_structure_type
                                      AND   as_of_date <= p_as_of_date
                                   )
      AND    structure_version_id IS NULL
      AND    Structure_type = p_structure_type;
Line: 6025

      Select decode( p_calling_context, 'PROGRESS', NVL(EFF_ROLLUP_PERCENT_COMP,completed_percentage),
                                        'FINANCIAL_PLANNING',
                          decode(p_structure_type, 'FINANCIAL',  NVL(completed_percentage,EFF_ROLLUP_PERCENT_COMP)
                                                              ,  NVL(completed_percentage,BASE_PERCENT_COMPLETE)))
      From   PA_Progress_Rollup
      Where  Project_ID         = P_Project_ID
      AND    Object_Type        = p_object_type
      AND    current_flag       <> 'W'     --bug 3879461
      AND    As_Of_Date         = ( select max(As_Of_Date) from pa_progress_rollup
                                    where  Project_ID         = P_Project_ID
                                      AND    Object_Type        = p_object_type
                                      AND    structure_version_id IS NULL
                                      AND    current_flag       <> 'W'     --bug 3879461
                                      AND    Structure_type     = p_structure_type
                                      AND   as_of_date <= p_as_of_date
                                   )

      AND    structure_version_id IS NULL
      AND    Structure_type     = p_structure_type;
Line: 6051

      Select decode( p_calling_context, 'PROGRESS', NVL(EFF_ROLLUP_PERCENT_COMP,completed_percentage),
                                        'FINANCIAL_PLANNING',
                          decode(p_structure_type, 'FINANCIAL',  NVL(completed_percentage,EFF_ROLLUP_PERCENT_COMP)
                                                              ,  NVL(completed_percentage,BASE_PERCENT_COMPLETE)))
      From   PA_Progress_Rollup
      Where  Project_ID         = P_Project_ID
      AND    Object_ID          = P_Proj_Element_ID
      AND    Object_Type        = p_object_type
      AND    current_flag       = 'W'     --bug 3879461
      AND    As_Of_Date         = ( select max(As_Of_Date) from pa_progress_rollup
                                    where  Project_ID         = P_Project_ID
                                      AND    Object_ID          = P_Proj_Element_ID
                                      AND    Object_Type        = p_object_type
                                      AND    structure_version_id IS NULL
                                      AND    current_flag       = 'W'     --bug 3879461
                                      AND    Structure_type     = p_structure_type
                                      AND   as_of_date <= p_as_of_date
                                   )
      AND    structure_version_id IS NULL
      AND    Structure_type     = p_structure_type;
Line: 6077

      Select decode( p_calling_context, 'PROGRESS', NVL(EFF_ROLLUP_PERCENT_COMP,completed_percentage),
                                        'FINANCIAL_PLANNING',
                          decode(p_structure_type, 'FINANCIAL',  NVL(completed_percentage,EFF_ROLLUP_PERCENT_COMP)
                                                              ,  NVL(completed_percentage,BASE_PERCENT_COMPLETE)))
      From   PA_Progress_Rollup
      Where  Project_ID         = P_Project_ID
      AND    Object_Type        = p_object_type
      AND    current_flag       = 'W'     --bug 3879461
      AND    As_Of_Date         = ( select max(As_Of_Date) from pa_progress_rollup
                                    where  Project_ID         = P_Project_ID
                                      AND    Object_Type        = p_object_type
                                      AND    structure_version_id IS NULL
                                      AND    current_flag       = 'W'     --bug 3879461
                                      AND    Structure_type     = p_structure_type
                                      AND   as_of_date <= p_as_of_date
                                   )

      AND    structure_version_id IS NULL
      AND    Structure_type     = p_structure_type;
Line: 6106

      Select decode( p_calling_context, 'PROGRESS', NVL(EFF_ROLLUP_PERCENT_COMP,completed_percentage),
                                        'FINANCIAL_PLANNING',
                          decode(p_structure_type, 'FINANCIAL',  NVL(completed_percentage,EFF_ROLLUP_PERCENT_COMP)
                                                          ,  NVL(completed_percentage,BASE_PERCENT_COMPLETE)))
      From   PA_Progress_Rollup
      Where  Project_ID         = P_Project_ID
      AND    Object_ID          = P_Proj_Element_ID
      AND    Object_Type        = p_object_type
      --AND    As_Of_Date         = p_As_Of_Date
      AND    structure_version_id = p_structure_version_id
      AND    Structure_type     = p_structure_type;
Line: 6124

      Select decode( p_calling_context, 'PROGRESS', NVL(EFF_ROLLUP_PERCENT_COMP,completed_percentage),
                                        'FINANCIAL_PLANNING',
                          decode(p_structure_type, 'FINANCIAL',  NVL(completed_percentage,EFF_ROLLUP_PERCENT_COMP)
                                                              ,  NVL(completed_percentage,BASE_PERCENT_COMPLETE)))
      From   PA_Progress_Rollup
      Where  Project_ID         = P_Project_ID
      AND    Object_Type        = p_object_type
      --AND    As_Of_Date         = p_As_Of_Date
      AND    structure_version_id = p_structure_version_id
      AND    Structure_type     = p_structure_type;
Line: 6238

      SELECT scheduled_start_date, scheduled_finish_date
      from pa_proj_elem_ver_schedule ppevs
      where project_id=p_project_id
       and element_version_id=p_task_version_id
       ;
Line: 6249

      select parent_structure_version_id
      from pa_proj_element_versions
      where project_id = p_project_id
      and proj_element_id =     p_proj_element_id
      and element_version_id = p_task_version_id
      ;
Line: 6263

    select baseline_start_date, baseline_finish_date
    from pa_proj_elements
    where project_id = p_project_id
    and proj_element_id = p_proj_element_id;
Line: 6274

      SELECT project_currency_code from pa_projects_all where project_id=p_project_id;
Line: 6283

  Select TASK_WEIGHT_BASIS_CODE
  INTO   l_TASK_WEIGHT_BASIS_CODE
  From   pa_proj_progress_attr
  Where  Project_ID     = p_project_id
  AND    Structure_type = p_structure_type;
Line: 6425

      /*select
      scheduled_start_date+((scheduled_finish_date-scheduled_start_date)/l_SCH_Performance_Index)
      into x_Sch_At_Completion
      from pa_proj_elem_ver_schedule
       where project_id = p_project_id
      and proj_element_id = p_proj_element_id
      and element_version_id = p_task_version_id;
Line: 6504

    Select MIN(Estimated_Start_Date), MAX(Estimated_Finish_Date), MIN(Actual_Start_Date), MAX(Actual_Finish_Date)
    FROM   PA_Progress_Rollup
    Where  Project_ID       = P_Project_ID
    AND    Proj_Element_ID  = P_Proj_Element_ID
    AND    Object_Type      = 'PA_ASSIGNMENTS'
    AND    As_Of_Date       = p_As_Of_Date
    AND    Structure_type   = p_structure_type;
Line: 6546

    select remain_effort_enable_flag
    into l_return_value
    from pa_proj_progress_attr
    where project_id = p_project_id
    and structure_type = p_structure_type;
Line: 6577

    select pppa.task_weight_basis_code
    from pa_proj_progress_attr pppa
    where pppa.project_id = p_project_id
    and pppa.structure_type = p_structure_type;
Line: 6583

    select
        /*+ INDEX(pji_fm_xbs_accum_tmp1 pji_fm_xbs_accum_tmp1_n1)*/ -- Fix for Bug # 4162534.
        nvl(pfxat.BASE_LABOR_HOURS,pfxat.labor_hours) labor_hours
           ,nvl(pfxat.BASE_EQUIP_HOURS,pfxat.equipment_hours) equipment_hours
           ,nvl(pfxat.PRJ_BASE_BRDN_COST,pfxat.prj_brdn_cost) prj_brdn_cost
    from pji_fm_xbs_accum_tmp1 pfxat
    where pfxat.struct_version_id = p_structure_version_id
    and pfxat.project_id = p_project_id
    and pfxat.project_element_id = p_proj_element_id
    and pfxat.plan_version_id > 0
    AND pfxat.txn_currency_code is null    --bug no. 3646988
    and pfxat.calendar_type  = 'A';
Line: 6602

      SELECT project_currency_code from pa_projects_all where project_id=p_project_id;
Line: 6610

        select ppe.baseline_start_date, ppe.baseline_finish_date
        from pa_proj_elements ppe
        where ppe.project_id = p_project_id
        and ppe.proj_element_id = p_proj_element_id;
Line: 6616

        select ppevs.scheduled_start_date, ppevs.scheduled_finish_date
        from pa_proj_elem_ver_schedule ppevs
        where ppevs.project_id = p_project_id
        and ppevs.proj_element_id = p_proj_element_id
        and ppevs.element_version_id = (select ppev.element_version_id
                                        from pa_proj_element_versions ppev
                                        where ppev.project_id = p_project_id
                                        and ppev.proj_element_id = p_proj_element_id
                                        and ppev.parent_structure_version_id = p_structure_version_id);
Line: 6863

    select max(date_computed)
    into l_return_date
    from pa_percent_completes ppc
    where ppc.project_id = p_project_id
    and ppc.structure_type = p_structure_type
    and ppc.object_id = p_object_id
    and ppc.object_type = p_object_type
    and ppc.task_id = nvl(p_task_id, p_object_id) /* Modified for IB4 Progress CR. */;
Line: 6879

      SELECT resource_list_id
        FROM pa_resource_list_members
       WHERE resource_list_member_id = p_resource_list_member_id ;
Line: 6899

CURSOR cur_rollupdate
IS
           select max(as_of_date)
             from pa_progress_rollup
            where project_id = p_project_id
              and object_id = p_object_id
              and object_type = p_object_type
          and structure_type = p_structure_type -- FPM Dev CR 4
          and ((p_structure_version_id is null AND structure_version_id is null) OR (p_structure_version_id is not null AND structure_version_id = p_structure_version_id)) -- FPM Dev CR 4

--              and NVL(proj_element_id,-1) = DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id)) /* Amit : Modified for IB4 Progress CR. */
--  Commented out to fix Bug # 4243074.

-- Begin fix for Bug # 4243074.

and NVL(proj_element_id,-1) = DECODE(p_structure_type, 'FINANCIAL'
                                                     , DECODE(p_object_type, 'PA_STRUCTURES'
                                                                           , 0
                                                                           , (DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id))))
                                                     ,(DECODE(p_object_type, 'PA_DELIVERABLES', NVL(p_proj_element_id,NVL(proj_element_id,-1)),NVL(p_proj_element_id, p_object_id))))

-- End fix for Bug # 4243074.

          and current_flag <> 'W' -- Bug 3879461
         -- and proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
          ;
Line: 6927

   OPEN cur_rollupdate;
Line: 6928

   FETCH cur_rollupdate INTO l_rollup_date;
Line: 6929

   CLOSE cur_rollupdate;
Line: 7001

  SELECT count(*) FROM pa_task_asgmts_v
  WHERE project_id = p_project_id
  AND   task_id  = p_task_id
  AND   structure_version_id = p_structure_version_id
  AND   ta_display_flag = 'Y';
Line: 7008

  SELECT resource_class_code FROM pa_task_asgmts_v
  WHERE project_id = p_project_id
  AND   task_id  = p_task_id
  AND   structure_version_id = p_structure_version_id
  AND   ta_display_flag = 'Y';
Line: 7015

  SELECT resource_class_code, ta_display_flag FROM pa_task_asgmts_v
  WHERE project_id = p_project_id
  AND   task_id  = p_task_id
  AND   resource_list_member_id = p_object_id
  AND   structure_version_id = p_structure_version_id;
Line: 7133

select cumulative_work_quantity, ppl_act_cost_to_date_pc, eqpmt_act_cost_to_date_pc, oth_act_cost_to_date_pc,
ppl_act_cost_to_date_fc, eqpmt_act_cost_to_date_fc, oth_act_cost_to_date_fc, ppl_act_effort_to_date,
eqpmt_act_effort_to_date, ppl_act_cost_to_date_tc, eqpmt_act_cost_to_date_tc, oth_act_cost_to_date_tc,
txn_currency_code, ppl_act_rawcost_to_date_pc, eqpmt_act_rawcost_to_date_pc, oth_act_rawcost_to_date_pc,
ppl_act_rawcost_to_date_fc, eqpmt_act_rawcost_to_date_fc, oth_act_rawcost_to_date_fc,
ppl_act_rawcost_to_date_tc, eqpmt_act_rawcost_to_date_tc, oth_act_rawcost_to_date_tc, oth_quantity_to_date
from pa_progress_rollup ppr1
where ppr1.project_id = p_project_id
and ppr1.object_id = p_object_id
and ppr1.structure_version_id is null
AND ppr1.current_flag <> 'W'   -- Bug 3879461
and ppr1.as_of_date = ( SELECT max(ppr2.as_of_date)
                     from pa_progress_rollup ppr2
                    WHERE ppr2.as_of_date <= p_as_of_date
                      AND ppr2.object_id = p_object_id
                      AND ppr2.project_id = p_project_id
                      and ppr2.structure_type = 'WORKPLAN'
                      AND ppr2.current_flag <> 'W'   -- Bug 3879461
                      and ppr2.structure_version_id is null
                   )
and ppr1.structure_type = 'WORKPLAN'
;
Line: 7157

select cumulative_work_quantity, ppl_act_cost_to_date_pc, eqpmt_act_cost_to_date_pc, oth_act_cost_to_date_pc,
ppl_act_cost_to_date_fc, eqpmt_act_cost_to_date_fc, oth_act_cost_to_date_fc, ppl_act_effort_to_date,
eqpmt_act_effort_to_date, ppl_act_cost_to_date_tc, eqpmt_act_cost_to_date_tc, oth_act_cost_to_date_tc,
txn_currency_code, ppl_act_rawcost_to_date_pc, eqpmt_act_rawcost_to_date_pc, oth_act_rawcost_to_date_pc,
ppl_act_rawcost_to_date_fc, eqpmt_act_rawcost_to_date_fc, oth_act_rawcost_to_date_fc,
ppl_act_rawcost_to_date_tc, eqpmt_act_rawcost_to_date_tc, oth_act_rawcost_to_date_tc, oth_quantity_to_date
from pa_progress_rollup ppr1
where ppr1.project_id = p_project_id
and ppr1.object_id = p_object_id
and ppr1.proj_element_id = p_proj_element_id
and ppr1.structure_version_id is null
AND ppr1.current_flag <> 'W'   -- Bug 3879461
and ppr1.as_of_date = ( SELECT max(ppr2.as_of_date)
                     from pa_progress_rollup ppr2
                    WHERE ppr2.as_of_date <= p_as_of_date
                      AND ppr2.object_id = p_object_id
              AND ppr2.proj_element_id = p_proj_element_id
                      AND ppr2.project_id = p_project_id
                      and ppr2.structure_type = 'WORKPLAN'
                      AND ppr2.current_flag <> 'W'   -- Bug 3879461
                      and ppr2.structure_version_id is null
                   )
and ppr1.structure_type = 'WORKPLAN'
;
Line: 7185

select wq_uom_code
from pa_proj_elements
where project_id = p_project_id
and proj_element_id = p_proj_element_id;
Line: 7191

select proj_element_id
from pa_proj_element_versions
where element_version_id = p_element_version_id;
Line: 7196

select wq_planned_quantity
from pa_proj_elem_ver_schedule
where project_id = p_project_id
and element_version_id = p_element_version_id;
Line: 7203

select cumulative_work_quantity, ppl_act_cost_to_date_pc, eqpmt_act_cost_to_date_pc, oth_act_cost_to_date_pc,
ppl_act_cost_to_date_fc, eqpmt_act_cost_to_date_fc, oth_act_cost_to_date_fc, ppl_act_effort_to_date,
eqpmt_act_effort_to_date
from pa_progress_rollup ppr1
where ppr1.project_id = p_project_id
and ppr1.object_type = 'PA_STRUCTURES'
and ppr1.structure_version_id is null
AND ppr1.current_flag <> 'W'   -- Bug 3879461
and ppr1.as_of_date = ( SELECT max(ppr2.as_of_date)
                     from pa_progress_rollup ppr2
                    WHERE ppr2.as_of_date <= p_as_of_date
                      AND ppr2.object_type = 'PA_STRUCTURES'
                      AND ppr2.project_id = p_project_id
                      and ppr2.structure_type = 'WORKPLAN'
                      and ppr2.structure_version_id is null
                      AND ppr2.current_flag <> 'W'   -- Bug 3879461
                   )
and ppr1.structure_type = 'WORKPLAN'
;
Line: 7226

select ppev.element_version_id
from pa_proj_element_versions ppev
where ppev.project_id = c_project_id
and ppev.proj_element_id = c_wp_task_id
and ppev.parent_structure_version_id = c_wp_str_ver_id;
Line: 7406

    select element_version_id
    from pa_proj_element_versions
    where project_id = p_project_id
    and proj_element_id = p_proj_element_id
    and parent_structure_version_id = p_structure_version_id;
Line: 7413

    select object_id_from1
        from pa_object_relationships
        where relationship_type='M'
        and object_type_from='PA_TASKS'
        and object_type_to='PA_TASKS'
        and object_id_to1 = p_fin_task_ver_id;
Line: 7421

    select structure_sharing_code
    from pa_projects_all
    where project_id = p_project_id;
Line: 7471

    SELECT NVL( ESTIMATED_REMAINING_EFFORT, 0 ) + NVL( EQPMT_ETC_EFFORT, 0 )
     FROM pa_progress_rollup
    WHERE  project_id = p_project_id
     AND   object_id  = p_object_id
     and proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
     --Commented by rtarway for BUG 3835474
     /*AND   as_of_date = ( SELECT max(as_of_date)
                           from pa_progress_rollup
                          WHERE as_of_date < p_as_of_date
                           AND  project_id = p_project_id
                           AND object_id  = p_object_id
                           AND object_type = p_object_type
                           AND structure_type = p_structure_type
        and proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR.
                       )*/
     --Added by rtarway for BUG 3835474
     AND   as_of_date = ( SELECT max(as_of_date)
                           from pa_progress_rollup ppr2
                          WHERE ppr2.as_of_date <= p_as_of_date
                           AND  ppr2.project_id = p_project_id
                           AND ppr2.object_id  = p_object_id
                           AND ppr2.object_type = p_object_type
                           AND ppr2.structure_type = p_structure_type
                           AND ppr2.structure_version_id is null -- Bug 3879461
                   and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR.*/
                           AND ppr2.current_flag <> 'W'   -- Bug 3879461
--                           AND NOT EXISTS (
--                      SELECT 'X' FROM pa_percent_completes ppc
--                      WHERE ppc.date_computed = ppr2.as_of_date
--                      AND   ppc.project_id = p_project_id
--                      AND   ppc.object_id  = p_object_id
--                      AND   ppc.object_type = p_object_type
--                      AND   ppc.structure_type = p_structure_type
--                      AND   ppc.published_flag = 'N'
--                    )
                       )
     AND   object_type = p_object_type
     AND structure_type = p_structure_type
     AND structure_version_id is null -- Bug 3879461
     AND current_flag <> 'W'   -- Bug 3879461
    ;
Line: 7534

    SELECT (nvl(ppr.oth_etc_cost_tc,0)+nvl(ppr.ppl_etc_cost_tc,0)+nvl(ppr.eqpmt_etc_cost_tc,0))
     FROM pa_progress_rollup ppr
    WHERE  ppr.project_id = p_project_id
     AND   ppr.object_id  = p_object_id
     and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
     AND   ppr.as_of_date = ( SELECT max(as_of_date)
                           from pa_progress_rollup ppr2
                          WHERE ppr2.as_of_date < p_as_of_date
                           AND  ppr2.project_id = p_project_id
                           AND ppr2.object_id  = p_object_id
                           AND ppr2.object_type = p_object_type
                           AND ppr2.structure_type = p_structure_type
               AND ppr2.structure_version_id is null -- Bug 3879461
                          AND ppr2.current_flag <> 'W'   -- Bug 3879461
                        and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                       )
     AND   ppr.object_type = p_object_type
     AND ppr.structure_type = p_structure_type
     AND ppr.structure_version_id is null -- Bug 3879461
     AND ppr.current_flag <> 'W'   -- Bug 3879461

     ;
Line: 7592

    SELECT (nvl(ppr.oth_etc_rawcost_tc,0)+nvl(ppr.ppl_etc_rawcost_tc,0)+nvl(ppr.eqpmt_etc_rawcost_tc,0)) etc_txn_raw_rawcost_last_subm
    ,(nvl(ppr.oth_etc_rawcost_pc,0)+nvl(ppr.ppl_etc_rawcost_pc,0)+nvl(ppr.eqpmt_etc_rawcost_pc,0)) etc_prj_raw_rawcost_last_subm
    ,(nvl(ppr.oth_etc_rawcost_fc,0)+nvl(ppr.ppl_etc_rawcost_fc,0)+nvl(ppr.eqpmt_etc_rawcost_fc,0)) etc_pfc_raw_rawcost_last_subm
        ,(nvl(ppr.oth_etc_cost_tc,0)+nvl(ppr.ppl_etc_cost_tc,0)+nvl(ppr.eqpmt_etc_cost_tc,0)) etc_txn_bur_cost_last_subm
    ,(nvl(ppr.oth_etc_cost_pc,0)+nvl(ppr.ppl_etc_cost_pc,0)+nvl(ppr.eqpmt_etc_cost_pc,0)) etc_prj_bur_cost_last_subm
    ,(nvl(ppr.oth_etc_cost_fc,0)+nvl(ppr.ppl_etc_cost_fc,0)+nvl(ppr.eqpmt_etc_cost_fc,0)) etc_pfc_bur_cost_last_subm
    , (NVL( ESTIMATED_REMAINING_EFFORT, 0 ) + NVL( EQPMT_ETC_EFFORT, 0 )) etc_effort_last_subm
     FROM pa_progress_rollup ppr
    WHERE  ppr.project_id = p_project_id
     AND   ppr.object_id  = p_object_id
     and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id)
     --Commented by rtarway for BUG 3835474
     --AND   ppr.as_of_date = ( SELECT max(as_of_date)
     --                      from pa_progress_rollup ppr2
     --                     WHERE ppr2.as_of_date < p_as_of_date
     --                      AND  ppr2.project_id = p_project_id
     --                      AND ppr2.object_id  = p_object_id
     --                      AND ppr2.object_type = p_object_type
     --                      AND ppr2.structure_type = p_structure_type
    --and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
     --                  )
     --Added by rtarway for BUG 3835474
     AND   ppr.as_of_date = ( SELECT max(as_of_date)
                           from pa_progress_rollup ppr2
                          WHERE ppr2.as_of_date <= p_as_of_date
                           AND  ppr2.project_id = p_project_id
                           AND ppr2.object_id  = p_object_id
                           AND ppr2.object_type = p_object_type
                           AND ppr2.structure_type = p_structure_type
                           AND ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id)
               AND ppr2.structure_version_id is null -- Bug 3879461
                           AND ppr2.current_flag <> 'W'   -- Bug 3879461
--                            AND NOT EXISTS
--                                (
--                                  SELECT 'X' FROM pa_percent_completes ppc
--                                  WHERE ppc.date_computed = ppr2.as_of_date
--                                  AND   ppc.project_id = p_project_id
--                                  AND   ppc.object_id  = p_object_id
--                                  AND   ppc.object_type = p_object_type
--                                  AND   ppc.structure_type = p_structure_type
--                                  AND   ppc.published_flag = 'N'
--                                )
                           )
     AND ppr.object_type = p_object_type
     AND ppr.structure_type = p_structure_type
     AND ppr.structure_version_id is null -- Bug 3879461
     AND ppr.current_flag <> 'W'   -- Bug 3879461

     ;
Line: 7682

    SELECT
     decode( p_resource_class_code, 'PEOPLE', ppr.ppl_etc_rawcost_tc
                                   ,'EQUIPMENT', ppr.eqpmt_etc_rawcost_tc
                                   ,ppr.oth_etc_rawcost_tc )  etc_txn_raw_rawcost_last_subm
    ,decode(p_resource_class_code, 'PEOPLE', ppr.ppl_etc_rawcost_pc
                                  ,'EQUIPMENT', ppr.eqpmt_etc_rawcost_pc
                                  , ppr.oth_etc_rawcost_pc ) etc_prj_raw_rawcost_last_subm
    ,decode(p_resource_class_code, 'PEOPLE', ppr.ppl_etc_rawcost_fc
                                  ,'EQUIPMENT', ppr.eqpmt_etc_rawcost_fc
                                  ,ppr.oth_etc_rawcost_fc) etc_pfc_raw_rawcost_last_subm
    ,decode(p_resource_class_code, 'PEOPLE', ppr.ppl_etc_cost_tc
                                  ,'EQUIPMENT', ppr.eqpmt_etc_cost_tc
                                  ,ppr.oth_etc_cost_tc ) etc_txn_bur_cost_last_subm
    ,decode(p_resource_class_code, 'PEOPLE', ppr.ppl_etc_cost_pc
                                  ,'EQUIPMENT', ppr.eqpmt_etc_cost_pc
                  ,ppr.oth_etc_cost_pc ) etc_prj_bur_cost_last_subm
    ,decode(p_resource_class_code, 'PEOPLE', ppr.ppl_etc_cost_fc
                                  ,'EQUIPMENT', ppr.eqpmt_etc_cost_fc
                                  ,ppr.oth_etc_cost_fc ) etc_pfc_bur_cost_last_subm
    ,decode(p_resource_class_code, 'PEOPLE', ESTIMATED_REMAINING_EFFORT
                                  ,'EQUIPMENT', EQPMT_ETC_EFFORT
                  , ppr.OTH_ETC_QUANTITY) etc_effort_last_subm
     FROM pa_progress_rollup ppr
    WHERE  ppr.project_id = p_project_id
     AND   ppr.object_id  = p_object_id
     and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
     AND   ppr.as_of_date = ( SELECT max(as_of_date)
                           from pa_progress_rollup ppr2
                          WHERE ppr2.as_of_date <= p_as_of_date--Added eqaulity condition, 4091457, rtarway
                           AND  ppr2.project_id = p_project_id
                           AND ppr2.object_id  = p_object_id
                           AND ppr2.object_type = p_object_type
                           AND ppr2.structure_type = p_structure_type
                           AND ppr2.structure_version_id is null -- Bug 3879461
                           AND ppr2.current_flag <> 'W'   -- Bug 3879461
                           and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) /* Modified for IB4 Progress CR. */
                       )
     AND ppr.object_type = p_object_type
     AND ppr.structure_type = p_structure_type
     AND ppr.structure_version_id is null -- Bug 3879461
     AND ppr.current_flag <> 'W'   -- Bug 3879461
	 AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
     ;
Line: 7825

         select (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0))
            act_rawcost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
         and structure_type = 'WORKPLAN' -- FPM Dev CR 3
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id)-- Modified for IB4 Progress CR.
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                                     -- and ppr2.object_version_id = p_object_version_id
                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                     and ppr2.as_of_date > p_as_of_date
    and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id)); --Modified for IB4 Progress CR. );
Line: 7847

         select (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0))
            act_rawcost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppr.structure_version_id is null -- Bug 3764224
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     and ppr2.structure_version_id is null -- Bug 3764224
                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date < p_as_of_date);
Line: 7868

         select (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0))
            act_rawcost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppr.structure_version_id is null -- Bug 3764224
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     and ppr2.structure_version_id is null -- Bug 3764224
                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date >= p_as_of_date);
Line: 7897

        select (nvl(ppr.oth_act_rawcost_to_date_pc,0)+nvl(ppr.ppl_act_rawcost_to_date_pc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_pc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_PC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_pc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_pc,0))
                into l_act_rawcost_pub
                from pa_progress_rollup ppr,pa_percent_completes ppc
                where ppr.project_id = ppc.project_id
            and ppr.object_id = ppc.object_id
            and ppr.object_version_id = ppc.object_version_id
            and ppr.as_of_date = ppc.date_computed (+)
        and ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
            and ppr.percent_complete_id = ppc.percent_complete_id
         and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
         and ppr.structure_type = ppc.structure_type(+) -- FPM Dev CR 3
        and ppr.proj_element_id = ppc.task_id (+) -- Modified for IB4 Progress CR.
                and ppr.as_of_date = (select max(ppc2.date_computed)
                                     from pa_percent_completes ppc2
                                     where ppc2.project_id = p_project_id
                                     and ppc2.object_id = p_object_id
                                     -- and ppc2.object_version_id = p_object_version_id
                     and ppc2.published_flag = 'Y'
                     and ppc2.current_flag = 'Y'
                         and ppc2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppc2.task_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
                     );
Line: 7965

         select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0)) act_rawcost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
         and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                                     -- and ppr2.object_version_id = p_object_version_id
                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                     and ppr2.as_of_date > p_as_of_date);
Line: 7986

              select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
                     +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
                     +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0)) act_rawcost_to_date
                from pa_progress_rollup ppr,pa_percent_completes ppc
                where ppr.project_id = ppc.project_id
                and ppr.object_id = ppc.object_id
                and ppr.as_of_date = ppc.date_computed
                and ppr.project_id = p_project_id
            and ppr.object_id = p_object_id
        and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
            and ppr.percent_complete_id = ppc.percent_complete_id
                and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
            and ppr.structure_type = ppc.structure_type (+) -- FPM Dev CR 3
        and ppr.proj_element_id = ppc.task_id (+) -- Modified for IB4 Progress CR.
            and ppc.current_flag = 'N'
            and ppc.published_flag = 'N'
            ;
Line: 8007

         select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
                     +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
                     +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0)) act_rawcost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
                and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.structure_version_id is null -- Bug 3764224
                and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and current_flag = 'Y'
				AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
                ;
Line: 8023

         select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
                     +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
                     +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0)) act_rawcost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppr.structure_version_id is null -- Bug 3764224
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     and ppr2.structure_version_id is null -- Bug 3764224
                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date < p_as_of_date);
Line: 8045

         select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
                     +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
                     +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0)) act_rawcost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppr.structure_version_id is null -- Bug 3764224
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     and ppr2.structure_version_id is null -- Bug 3764224
                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date >= p_as_of_date);
Line: 8066

         select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
                     +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
                     +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0)) act_rawcost_to_date
                from pa_progress_rollup ppr
             -- Bug 3879461 : percemnt compete join is not required. current_flag = W is sufficient
--                    ,pa_percent_completes ppc
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
                and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
            and ppr.structure_version_id is null -- Bug 3764224
                and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
--               and ppr.object_id = ppc.object_id
--               and ppr.as_of_date = ppc.date_computed
--                and ppr.percent_complete_id = ppc.percent_complete_id
--                and ppr.project_id = ppc.project_id
--                and ppr.proj_element_id=ppc.task_id
--                and ppr.structure_type = ppc.structure_type
--                and ppc.current_flag= 'N'
--                and ppc.published_flag = 'N'
                and ppr.current_flag= 'W'
				AND NVL(cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
                ;
Line: 8101

        select (nvl(ppr.oth_act_rawcost_to_date_tc,0)+nvl(ppr.ppl_act_rawcost_to_date_tc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_tc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_tc,0))
                into l_act_rawcost_pub
                from pa_progress_rollup ppr,pa_percent_completes ppc
                where ppr.project_id = ppc.project_id
            and ppr.object_id = ppc.object_id
            and ppr.object_version_id = ppc.object_version_id
            and ppr.as_of_date = ppc.date_computed (+)
        and ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.percent_complete_id = ppc.percent_complete_id
         and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
         and ppr.structure_type = ppc.structure_type(+) -- FPM Dev CR 3
                and ppr.as_of_date = (select max(ppc2.date_computed)
                                     from pa_percent_completes ppc2
                                     where ppc2.project_id = p_project_id
                                     and ppc2.object_id = p_object_id
                                      -- and ppc2.object_version_id = p_object_version_id
                     and ppc2.published_flag = 'Y'
                     and ppc2.current_flag = 'Y'
                         and ppc2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     );
Line: 8190

         select (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0)) act_rawcost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
         and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                                     -- and ppr2.object_version_id = p_object_version_id
                     and structure_type = 'WORKPLAN' -- FPM Dev CR 3
                                     and ppr2.as_of_date > p_as_of_date
    and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR. );
Line: 8211

         select (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0)) act_rawcost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppr.structure_version_id is null -- Bug 3764224
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     and ppr2.structure_version_id is null -- Bug 3764224
                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date < p_as_of_date);
Line: 8231

         select (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0)) act_rawcost_to_date
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
            and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppr.structure_version_id is null -- Bug 3764224
            and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                     from pa_progress_rollup ppr2
                                     where ppr2.project_id = p_project_id
                                     and ppr2.object_id = p_object_id
                     and ppr2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
                     and ppr2.structure_version_id is null -- Bug 3764224
                     and ppr2.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Bug 3764224
                                     and ppr2.as_of_date >= p_as_of_date);
Line: 8261

        select (nvl(ppr.oth_act_rawcost_to_date_fc,0)+nvl(ppr.ppl_act_rawcost_to_date_fc,0)
            +nvl(ppr.eqpmt_act_rawcost_to_date_fc,0)+nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_FC,0)
            +nvl(ppr.subprj_ppl_act_rawcost_fc,0)+nvl(ppr.subprj_eqpmt_act_rawcost_fc,0))
                into l_act_rawcost_pub
                from pa_progress_rollup ppr,pa_percent_completes ppc
                where ppr.project_id = ppc.project_id
            and ppr.object_id = ppc.object_id
            and ppr.object_version_id = ppc.object_version_id
            and ppr.as_of_date = ppc.date_computed (+)
        and ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                -- and ppr.object_version_id = p_object_version_id
    and ppr.proj_element_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
            and ppr.percent_complete_id = ppc.percent_complete_id
         and ppr.structure_type = 'WORKPLAN' -- FPM Dev CR 3
         and ppr.structure_type = ppc.structure_type(+) -- FPM Dev CR 3
        and ppr.proj_element_id = ppc.task_id (+) -- Modified for IB4 Progress CR.
                and ppr.as_of_date = (select max(ppc2.date_computed)
                                     from pa_percent_completes ppc2
                                     where ppc2.project_id = p_project_id
                                     and ppc2.object_id = p_object_id
                                     -- and ppc2.object_version_id = p_object_version_id
                     and ppc2.published_flag = 'Y'
                     and ppc2.current_flag = 'Y'
                         and ppc2.structure_type = 'WORKPLAN' -- FPM Dev CR 3
        and ppc2.task_id = nvl(p_proj_element_id, p_object_id) -- Modified for IB4 Progress CR.
                     );
Line: 8524

    SELECT resource_assignment_id
     FROM pa_task_assignments_v
    WHERE structure_version_id = c_structure_version_id
      AND task_id              = c_task_id
      AND resource_list_member_id = c_resource_list_member_id
     ;
Line: 8534

   SELECT NVL(TXN_COST_RATE_OVERRIDE,TXN_STANDARD_COST_RATE) -- Bug 3951555, Added nvl and TXN_STANDARD_COST_RATE
      , nvl(BURDEN_COST_RATE_OVERRIDE, BURDEN_COST_RATE) -- Bug 3951555, Added nvl and BURDEN_COST_RATE
     FROM pa_budget_lines
    WHERE budget_version_id = c_budget_version_id
      AND resource_assignment_id = c_resource_assignment_id
      AND TXN_CURRENCY_CODE = p_currency_code
      AND p_as_of_date BETWEEN start_date and end_date
  ;
Line: 8545

  IS                                                                                  SELECT TXN_RAW_COST_RATE_OVERRIDE, TXN_BURDEN_COST_RATE_OVERRIDE
     FROM pa_resource_asgn_curr                                                        WHERE budget_version_id = c_budget_version_id
      AND resource_assignment_id = c_resource_assignment_id                              AND TXN_CURRENCY_CODE = p_currency_code;
Line: 8560

  SELECT pra.person_id,
        pra.resource_class_code,
        pra.expenditure_type,
        pra.rate_expenditure_type,
        pra.RATE_EXPENDITURE_ORG_ID,
        pra.non_labor_resource,
        pra.organization_id,
        pra.bom_resource_id,
        pra.inventory_item_id,
        pra.mfc_cost_type_id,
        pra.item_category_id,
        pra.job_id,
        pra.unit_of_measure,
        pra.rate_based_flag,
        pra.resource_assignment_id,
        rlm.alias
  FROM pa_resource_assignments pra,  ----pa_task_assignments_v  4871809
       pa_budget_versions pbv,
       pa_resource_list_members rlm
  WHERE pbv.project_structure_version_id  = c_structure_version_id
  AND pbv.budget_version_id = pra.budget_version_id
  AND pra.task_id           = c_task_id
  AND pra.resource_list_member_id   = c_resource_list_member_id
  AND pra.project_id        = c_project_id
  AND pra.resource_list_member_id = rlm.resource_list_member_id
    ;
Line: 8592

     select BURDEN_AMT_DISPLAY_METHOD
     from pa_project_types_all
     where PROJECT_TYPE = p_project_type;
Line: 8929

        /* Select the project Type */
        SELECT project_type, carrying_out_organization_id
        INTO   l_project_type, l_carrying_out_org_id
        FROM   pa_projects_all
        WHERE  project_id = p_project_id;
Line: 8936

    /* Select the resource name  TO BE CHECKED
    BEGIN
        SELECT resource_alias
        INTO   l_resource_alias
        FROM   pa_task_assignments_v
        WHERE  resource_list_member_id = l_BOM_resource_id
        AND project_id = p_project_id; -- Modifications for Bug # 3688902.
Line: 8953

         SELECT task_id
         INTO   l_task_id
         FROM   pa_task_assignments_v
         WHERE  resource_list_member_id = l_res_list_memb_id_tbl(i)
         AND project_id = p_project_id ;
Line: 8994

        SELECT use_planning_rates_flag,res_class_raw_cost_sch_id INTO l_use_planning_rates_flag, l_pl_res_class_raw_cost_sch_id
        FROM pa_proj_fp_options
        WHERE fin_plan_version_id = l_plan_version_id
        AND project_id = p_project_id;
Line: 9631

                SELECT 'Y'
                FROM PA_PERCENT_COMPLETES
        WHERE object_id = p_dlv_proj_elt_id
                  AND object_type = 'PA_DELIVERABLES'
                  AND project_id  = p_project_id
                  AND structure_type = 'WORKPLAN'
                  AND published_flag = 'Y';
Line: 10002

     select ppr.completed_percentage
     from pa_progress_rollup ppr
     where ppr.project_id = p_project_id
     and ppr.object_id = p_object_id
     and ppr.structure_type = 'WORKPLAN'
     and ppr.structure_version_id is null
     and ppr.object_type = p_object_type
     and ppr.current_flag <> 'W' -- Bug 3879461
     and ppr.as_of_date =
     (
          select max(ppr2.as_of_date)
          from pa_progress_rollup ppr2
          where ppr2.project_id = p_project_id
          and ppr2.object_id = p_object_id
          and ppr2.structure_type = 'WORKPLAN'
          and ppr2.structure_version_id is null
          and ppr.object_type = p_object_type
          and ppr2.as_of_date <= p_as_of_date
          and ppr2.current_flag = 'Y'
     );
Line: 10047

select scheduled_start_date
from pa_proj_elem_ver_schedule ppevs
where ppevs.project_id = p_project_id
and  ppevs.proj_element_id = p_proj_element_id
and ppevs.element_version_id = (select ppev.element_version_id
                from pa_proj_element_versions ppev
                where ppev.project_id = p_project_id
                and ppev.proj_element_id = p_proj_element_id
                and ppev.object_type = p_object_type
                and ppev.parent_structure_version_id = p_str_ver_id);
Line: 10059

select scheduled_finish_date
from pa_proj_elem_ver_schedule ppevs
where ppevs.project_id = p_project_id
and  ppevs.proj_element_id = p_proj_element_id
and ppevs.element_version_id = (select ppev.element_version_id
                                from pa_proj_element_versions ppev
                                where ppev.project_id = p_project_id
                                and ppev.proj_element_id = p_proj_element_id
                                and ppev.object_type = p_object_type
                                and ppev.parent_structure_version_id = p_str_ver_id);
Line: 10136

    SELECT
    ra.resource_assignment_id,
    substrb(pe.element_number,1,30), -- Bug 4348814 : Added substr
    substrb(pe.name,1,30), -- Bug 4348814 : Added substr
    substrb(rlm.alias,1,40), -- Bug 4348814 : Added substr
    bl.txn_currency_code,
    pr.txn_currency_code
    FROM
    pa_proj_element_versions pev,
    pa_proj_elements pe,
    pa_resource_assignments ra,
    pa_resource_list_members rlm,
    pa_budget_lines bl,
    pa_progress_rollup pr
    WHERE
    pev.parent_structure_version_id = p_struct_ver_id AND
    pe.proj_element_id = pev.proj_element_id AND
    ra.wbs_element_version_id = pev.element_version_id AND
    rlm.resource_list_member_id = ra.resource_list_member_id AND
    bl.resource_assignment_id = ra.resource_assignment_id AND
    pr.project_id = ra.project_id AND
    pr.object_id = ra.resource_list_member_id AND
    pr.object_type = 'PA_ASSIGNMENTS' AND
    pr.structure_type = 'WORKPLAN' AND
    pr.proj_element_id = ra.task_id AND
    pr.current_flag = 'Y' AND
    pr.structure_version_id IS NULL AND
    bl.txn_currency_code <> pr.txn_currency_code
    GROUP BY
    ra.resource_assignment_id,
    pe.element_number,
    pe.name,
    rlm.alias,
    bl.txn_currency_code,
    pr.txn_currency_code;
Line: 10259

PROCEDURE check_prog_for_update_asgmts
(
    p_task_assignment_tbl IN  PA_TASK_ASSIGNMENT_UTILS.l_resource_rec_tbl_type,
    x_return_status       OUT NOCOPY VARCHAR2 --File.Sql.39 bug 4440895
)

IS

CURSOR get_all_parameters IS
    SELECT
    ra.resource_assignment_id,
    ra.resource_list_member_id,
    rat.resource_list_member_id,
    pr.txn_currency_code,
    rat.override_currency_code,
    ra.project_role_id,
    rat.project_role_id,
    ra.total_plan_quantity,
    rat.total_quantity,
    decode(ra.resource_class_code, 'PEOPLE', pr.ppl_act_effort_to_date,
                                   'EQUIPMENT', pr.eqpmt_act_effort_to_date ,pr.oth_quantity_to_date),
    pr.actual_finish_date,
    ra.schedule_start_date,
    ra.schedule_end_date,
    rat.schedule_start_date,
    rat.schedule_end_date,
    decode(pr.structure_version_id, NULL, 'Y', 'N')
    FROM
    pa_res_asgmts_temp rat,
    pa_resource_assignments ra,
    pa_proj_element_versions pev,
    pa_progress_rollup pr
    WHERE
    ra.resource_assignment_id = rat.resource_assignment_id AND
    pev.element_version_id = ra.wbs_element_version_id AND
    pr.project_id = ra.project_id AND
    pr.object_id = ra.resource_list_member_id AND
    pr.object_type = 'PA_ASSIGNMENTS' AND
    pr.structure_type = 'WORKPLAN' AND
    pr.proj_element_id = ra.task_id AND
    pr.current_flag = 'Y' AND
    (pr.structure_version_id IS NULL OR pr.structure_version_id = pev.parent_structure_version_id);
Line: 10331

    SELECT to_number(value)
    INTO   l_db_block_size
    FROM   v$parameter
    WHERE  name = 'db_block_size';
Line: 10365

        DELETE pa_res_asgmts_temp;
Line: 10367

            INSERT INTO pa_res_asgmts_temp VALUES
                (l_res_asgmt_id_tbl(j), l_new_rlm_id_tbl(j), l_override_cur_tbl(j), l_new_project_role_id_tbl(j),
                l_new_total_qty_tbl(j), l_new_sched_start_date_tbl(j), l_new_sched_finish_date_tbl(j));
Line: 10504

END check_prog_for_update_asgmts;
Line: 10537

    select planned_bur_cost_proj_cur
    from pa_task_asgmts_v
    where project_id = p_project_id
    and task_id = p_task_id
    and structure_version_id = p_structure_version_id
    and resource_list_member_id = p_resource_list_mem_id;
Line: 10546

     select pra.total_project_burdened_cost as planned_bur_cost_proj_cur
     , pra.resource_assignment_id -- Bug 4372462
     , pra.budget_version_id -- Bug 4372462
       FROM pa_resource_assignments pra,
            PA_PROJ_ELEMENT_VERSIONS PPEV
      where pra.resource_list_member_id = p_resource_list_mem_id
        and pra.task_id = p_task_id
        AND PPEV.PROJECT_ID = p_project_id
        AND PPEV.PARENT_STRUCTURE_VERSION_ID = p_structure_version_id
        AND pra.TASK_ID = PPEV.PROJ_ELEMENT_ID
        AND pra.wbs_element_version_id = ppev.element_version_id;
Line: 10980

   select next_progress_update_date
     into l_prog_act_summ_date
     from pa_proj_progress_attr
    where project_id = p_project_id
      and object_type = 'PA_STRUCTURES'
      and structure_type = 'WORKPLAN';
Line: 10991

      select as_of_date
        into l_prog_act_summ_date
        from pa_progress_rollup
       where project_id = p_project_id
         and object_type = 'PA_STRUCTURES'
         and structure_type = 'WORKPLAN'
         and structure_version_id is null
         and current_flag = 'Y';
Line: 11079

FUNCTION check_prog_exists_and_delete(
 p_project_id       NUMBER
 ,p_task_id     NUMBER
 ,p_object_type     VARCHAR2 := 'PA_TASKS'
 ,p_object_id       NUMBER   := null
 ,p_structure_type  VARCHAR2 := 'WORKPLAN'
 ,p_delete_progress_flag    VARCHAR2 := 'Y' -- Fix for Bug # 4140984.
 ,p_cbs_element_id   NUMBER := null -- Added for CBS phase 2 16598322

) RETURN VARCHAR2 IS

  CURSOR cur_ppc_assgn(c_object_id NUMBER, c_task_id NUMBER, c_object_type VARCHAR2
               , c_project_id NUMBER, c_structure_type VARCHAR2)
  IS
     SELECT 'Y'
     FROM pa_percent_completes ppc
     WHERE ppc.object_id = c_object_id
     AND ppc.task_id = c_task_id
     AND ppc.object_type = c_object_type
     AND ppc.project_id  = c_project_id
     AND ppc.structure_type = c_structure_type
     AND ppc.published_flag = 'Y'
	 AND NVL(ppc.cbs_element_id,-1) = NVL(p_cbs_element_id,-1) ; --Added for CBS phase 2 16598322
Line: 11106

    SELECT /*+ INDEX(PA_PROGRESS_ROLLUP PA_PROGRESS_ROLLUP_N3)*/ 'Y' --Added hint for 15876400
    FROM pa_progress_rollup ppr
    WHERE ppr.object_id = c_object_id
    AND ppr.proj_element_id = c_task_id
    AND ppr.object_type = c_object_type
    AND ppr.project_id  = c_project_id
    AND ppr.structure_type = p_structure_type
	AND NVL(ppr.cbs_element_id,-1) = NVL(p_cbs_element_id,-1)  --Added for CBS phase 2 16598322
    AND (((nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)
       +nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)
           + nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0)) <> 0 ) -- 4417665 : making it <> 0 rather than >0
     OR
         ((nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)
       +nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)) <> 0) -- 4417665 : making it <> 0 rather than >0
     OR
     ((nvl(ppr.oth_etc_cost_tc,0)+nvl(ppr.ppl_etc_cost_tc,0)
       +nvl(ppr.eqpmt_etc_cost_tc,0)+nvl(ppr.subprj_oth_etc_cost_tc,0)
           +nvl(ppr.subprj_ppl_etc_cost_tc,0) +nvl(ppr.subprj_eqpmt_etc_cost_tc,0)) > 0)
     OR
     ((nvl(ppr.estimated_remaining_effort,0)+nvl(ppr.eqpmt_etc_effort,0)
       +nvl(ppr.subprj_ppl_etc_effort,0)+nvl(ppr.subprj_eqpmt_etc_effort,0)) > 0))
     AND ppr.current_flag in ('Y', 'W')
     AND ppr.structure_version_id is null;
Line: 11133

     SELECT 'Y'
     FROM pa_percent_completes ppc
     WHERE ppc.task_id = c_task_id
     AND ppc.object_type = c_object_type
     AND ppc.project_id  = c_project_id
     AND ppc.structure_type = c_structure_type
     AND ppc.published_flag = 'Y';
Line: 11144

    SELECT /*+ INDEX(PA_PROGRESS_ROLLUP PA_PROGRESS_ROLLUP_N3)*/ 'Y' --Added hint for 15876400
    FROM pa_progress_rollup ppr
    WHERE ppr.proj_element_id = c_task_id
    AND ppr.object_type = c_object_type
    AND ppr.project_id  = c_project_id
    AND ppr.structure_type = p_structure_type
    AND (((nvl(ppr.oth_act_cost_to_date_tc,0)+nvl(ppr.ppl_act_cost_to_date_tc,0)
           +nvl(ppr.eqpmt_act_cost_to_date_tc,0)+nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)
           + nvl(ppr.subprj_ppl_act_cost_tc,0)+nvl(ppr.subprj_eqpmt_act_cost_tc,0)) <> 0 ) ---- 4417665 : making it <> 0 rather than >0
         OR
         ((nvl(ppr.ppl_act_effort_to_date,0)+nvl(ppr.eqpmt_act_effort_to_date,0)
           +nvl(ppr.subprj_ppl_act_effort,0)+nvl(ppr.subprj_eqpmt_act_effort,0)) <> 0) -- 4417665 : making it <> 0 rather than >0
         OR
         ((nvl(ppr.oth_etc_cost_tc,0)+nvl(ppr.ppl_etc_cost_tc,0)
           +nvl(ppr.eqpmt_etc_cost_tc,0)+nvl(ppr.subprj_oth_etc_cost_tc,0)
           +nvl(ppr.subprj_ppl_etc_cost_tc,0) +nvl(ppr.subprj_eqpmt_etc_cost_tc,0)) > 0)
         OR
         ((nvl(ppr.estimated_remaining_effort,0)+nvl(ppr.eqpmt_etc_effort,0)
           +nvl(ppr.subprj_ppl_etc_effort,0)+nvl(ppr.subprj_eqpmt_etc_effort,0)) > 0))
     AND ppr.current_flag in ('Y', 'W')
     AND ppr.structure_version_id is null;
Line: 11204

        if ((l_return_value = 'N') and (p_delete_progress_flag = 'Y')) then -- fix for Bug # 4140984.

            DELETE FROM pa_progress_rollup ppr
            WHERE ppr.object_id = p_object_id
            AND ppr.proj_element_id = p_task_id
                AND ppr.object_type = p_object_type
                AND ppr.project_id  = p_project_id
				AND NVL(ppr.cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16598322
                AND ppr.structure_type = p_structure_type;
Line: 11247

                if ((l_return_value = 'N') and (p_delete_progress_flag = 'Y')) then -- Fix for Bug # 4140984.
                        DELETE /*+ INDEX(PA_PROGRESS_ROLLUP PA_PROGRESS_ROLLUP_N3)*/ FROM pa_progress_rollup ppr --Added hint for 15876400
                        WHERE ppr.proj_element_id = p_task_id
            AND ppr.object_type = 'PA_ASSIGNMENTS'
                        AND ppr.project_id  = p_project_id
                        AND ppr.structure_type = p_structure_type;
Line: 11260

END check_prog_exists_and_delete;
Line: 11583

             SELECT NVL(SUM(NVL(pbl.txn_raw_cost,0)-NVL(pbl.txn_init_raw_cost,0)),0),
                    NVL(SUM(NVL(pbl.txn_burdened_cost,0)-NVL(pbl.txn_init_burdened_cost,0)),0),
                    NVL(SUM(NVL(pbl.project_raw_cost,0)-NVL(pbl.project_init_raw_cost,0)),0),
                    NVL(SUM(NVL(pbl.project_burdened_cost,0)-NVL(pbl.project_init_burdened_cost,0)),0),
                    NVL(SUM(NVL(pbl.raw_cost,0)-NVL(pbl.init_raw_cost,0)),0),
                    NVL(SUM(NVL(pbl.burdened_cost,0)-NVL(pbl.init_burdened_cost,0)),0)
             INTO   x_rawcost_tc,
                    x_brdncost_tc,
                    x_rawcost_pc,
                    x_brdncost_pc,
                    x_rawcost_fc,
                    x_brdncost_fc
             FROM   pa_budget_lines pbl,
                    pa_resource_assignments pra
             WHERE  pra.budget_version_id=p_budget_version_id
             AND    pra.project_id=p_project_id
             AND    pra.task_id=p_task_id
             AND    pra.resource_list_member_id=p_resource_list_mem_id
			 and 	NVL(pra.cbs_element_id,-1)=NVL(p_cbs_element_id,-1)-- added for 16895485
             AND    pbl.resource_assignment_id=pra.resource_assignment_id
             AND    pbl.txn_currency_code=p_txn_currency_code;
Line: 11659

   SELECT asgn.resource_assignment_id resource_assignment_id
        , asgn.task_version_id task_version_id
        , 'PA_ASSIGNMENTS' object_type
        , asgn.resource_class_code resource_class_code
        , asgn.rate_based_flag rate_based_flag
        , decode(asgn.rate_based_flag,'Y','EFFORT','N','COST') assignment_type
    , ppr.PPL_ACT_EFFORT_TO_DATE + ppr.EQPMT_ACT_EFFORT_TO_DATE total_act_effort_to_date
    , ppr.EQPMT_ETC_EFFORT + ppr.estimated_remaining_effort total_etc_effort
    , ppr.OTH_ACT_COST_TO_DATE_TC + ppr.PPL_ACT_COST_TO_DATE_TC + ppr.EQPMT_ACT_COST_TO_DATE_TC total_act_cost_to_date_tc
        , ppr.OTH_ACT_COST_TO_DATE_PC + ppr.PPL_ACT_COST_TO_DATE_PC + ppr.EQPMT_ACT_COST_TO_DATE_PC total_act_cost_to_date_pc
        , ppr.OTH_ACT_COST_TO_DATE_FC + ppr.PPL_ACT_COST_TO_DATE_FC + ppr.EQPMT_ACT_COST_TO_DATE_FC total_act_cost_to_date_fc
        , ppr.OTH_ETC_COST_TC + ppr.PPL_ETC_COST_TC + ppr.EQPMT_ETC_COST_TC total_etc_cost_tc
        , ppr.OTH_ETC_COST_PC + ppr.PPL_ETC_COST_PC + ppr.EQPMT_ETC_COST_PC total_etc_cost_pc
        , ppr.OTH_ETC_COST_FC + ppr.PPL_ETC_COST_FC + ppr.EQPMT_ETC_COST_FC total_etc_cost_fc

    , decode(c_task_per_comp_deriv_method,'EFFORT'
                , ( nvl(ppr.PPL_ACT_EFFORT_TO_DATE,0)
                     + nvl(ppr.EQPMT_ACT_EFFORT_TO_DATE,0))
                , ( nvl(ppr.OTH_ACT_COST_TO_DATE_PC,0)
                     + nvl(ppr.PPL_ACT_COST_TO_DATE_PC,0)
                     + nvl(ppr.EQPMT_ACT_COST_TO_DATE_PC,0))) earned_value
        , decode(c_wp_rollup_method, 'COST'
                 , nvl(ppr.OTH_ACT_COST_TO_DATE_PC,0)
                   + nvl(ppr.PPL_ACT_COST_TO_DATE_PC,0)
                               + nvl(ppr.EQPMT_ACT_COST_TO_DATE_PC,0)
                   + nvl(ppr.OTH_ETC_COST_PC,0)
                   + nvl(ppr.PPL_ETC_COST_PC,0)
                           + nvl(ppr.EQPMT_ETC_COST_PC,0)
                 , 'EFFORT'
                 , decode(rate_based_flag,'N', 0,
                         nvl(ppr.PPL_ACT_EFFORT_TO_DATE,0)
                         + nvl(ppr.EQPMT_ACT_EFFORT_TO_DATE,0)
                         + nvl(ppr.EQPMT_ETC_EFFORT,0)
                         + nvl(ppr.estimated_remaining_effort,0)), 0) bac_value_in_rollup_method
        , decode(c_task_per_comp_deriv_method,'EFFORT'
                 , ( NVL( decode( asgn.rate_based_flag, 'Y',
                                  decode( asgn.resource_class_code,
                                         'PEOPLE', nvl(ppr.PPL_ACT_EFFORT_TO_DATE,0)
                               + nvl(ppr.estimated_remaining_effort,
                                                   decode(sign(nvl(asgn.planned_quantity,0)
                                    -nvl(ppr.PPL_ACT_EFFORT_TO_DATE,0)), -1, 0,
                                                 nvl( asgn.planned_quantity-ppr.PPL_ACT_EFFORT_TO_DATE,0))),
                                          'EQUIPMENT', nvl(ppr.EQPMT_ACT_EFFORT_TO_DATE,0)
                               + nvl(ppr.EQPMT_ETC_EFFORT,
                                                     decode(sign(nvl(asgn.planned_quantity,0)
                                 -nvl(ppr.EQPMT_ACT_EFFORT_TO_DATE,0)), -1, 0,
                                                 nvl( asgn.planned_quantity-ppr.EQPMT_ACT_EFFORT_TO_DATE,0)))),0),0)
                                   ),
                                 ( NVL( decode( asgn.resource_class_code,
                                       'FINANCIAL_ELEMENTS',
                                         nvl(ppr.OTH_ACT_COST_TO_DATE_PC,0) + nvl(ppr.OTH_ETC_COST_PC,
                                            decode(sign(nvl(asgn.planned_bur_cost_proj_cur,0)
                            -nvl(ppr.OTH_ACT_COST_TO_DATE_PC,0)), -1, 0,
                                                 nvl(asgn.planned_bur_cost_proj_cur-ppr.OTH_ACT_COST_TO_DATE_PC,0))),
                                       'MATERIAL_ITEMS',
                                         nvl(ppr.OTH_ACT_COST_TO_DATE_PC,0) + nvl(ppr.OTH_ETC_COST_PC,
                                            decode(sign(nvl(asgn.planned_bur_cost_proj_cur,0)
                           -nvl(ppr.OTH_ACT_COST_TO_DATE_PC,0)), -1, 0,
                                                 nvl( asgn.planned_bur_cost_proj_cur-ppr.OTH_ACT_COST_TO_DATE_PC,0))),
                                       'PEOPLE',
                                        nvl(ppr.PPL_ACT_COST_TO_DATE_PC,0) + nvl(ppr.PPL_ETC_COST_PC,
                                         decode(sign(nvl(asgn.planned_bur_cost_proj_cur,0)
                        -nvl(ppr.PPL_ACT_COST_TO_DATE_PC,0)), -1, 0,
                                                nvl(asgn.planned_bur_cost_proj_cur-ppr.PPL_ACT_COST_TO_DATE_PC,0))),
                                       'EQUIPMENT',
                                        nvl(ppr.EQPMT_ACT_COST_TO_DATE_PC,0) + nvl(ppr.EQPMT_ETC_COST_PC,
                                         decode(sign(nvl(asgn.planned_bur_cost_proj_cur,0)
                        -nvl(ppr.EQPMT_ACT_COST_TO_DATE_PC,0)), -1, 0,
                                                nvl(asgn.planned_bur_cost_proj_cur-ppr.EQPMT_ACT_COST_TO_DATE_PC,0)))),
                                    nvl(asgn.planned_bur_cost_proj_cur,0)
                                    ))) bac_value_in_task_deriv
   FROM
           pa_task_asgmts_v  asgn
           , pa_progress_rollup ppr
   WHERE asgn.task_version_id = c_task_ver_id
         AND asgn.project_id = p_project_id  ---4871809
         AND asgn.task_id = p_proj_element_id
         AND asgn.ta_display_flag = 'Y'
         AND asgn.project_id = ppr.project_id
         AND asgn.RESOURCE_LIST_MEMBER_ID = ppr.object_id
         AND asgn.task_id = ppr.proj_element_id
         AND ppr.object_type = 'PA_ASSIGNMENTS'
         AND ppr.as_of_date = pa_progress_utils.get_max_rollup_asofdate(asgn.project_id
                       ,asgn.RESOURCE_LIST_MEMBER_ID, 'PA_ASSIGNMENTS'
                       ,c_as_of_date,asgn.task_version_id, c_structure_type
                       , decode(c_published_structure, 'Y', null, c_structure_version_id), asgn.task_id)
         AND ppr.current_flag <> 'W'
         AND ppr.structure_type = c_structure_type
         AND ((c_published_structure = 'Y' AND ppr.structure_version_id is null)
               OR (c_published_structure = 'N'
                   AND ppr.structure_version_id = c_structure_version_id))
   UNION ALL
   SELECT asgn.resource_assignment_id resource_assignment_id
          , asgn.task_version_id task_version_id
          , 'PA_ASSIGNMENTS' object_type
          , asgn.resource_class_code resource_class_code
          , asgn.rate_based_flag rate_based_flag
          , decode(asgn.rate_based_flag,'Y','EFFORT','N','COST') assignment_type
          , to_number(null) total_act_effort_to_date
          , to_number(null) total_etc_effort
          , to_number(null) total_act_cost_to_date_tc
          , to_number(null) total_act_cost_to_date_pc
          , to_number(null) total_act_cost_to_date_fc
          , to_number(null) total_etc_cost_tc
          , to_number(null) total_etc_cost_pc
          , to_number(null) total_etc_cost_fc
          , to_number(null) earned_value
          , to_number(null) bac_value_in_rollup_method
          , decode(c_task_per_comp_deriv_method,'EFFORT',
                   decode(asgn.rate_based_flag,'Y',
                          decode(asgn.resource_class_code,'PEOPLE'
                                 , asgn.planned_quantity, 'EQUIPMENT'
                             , asgn.planned_quantity, 0),0)
                                ,asgn.planned_bur_cost_proj_cur) bac_value_in_task_deriv
    FROM
          pa_task_asgmts_v  asgn
    WHERE asgn.task_version_id = c_task_ver_id
          AND  asgn.project_id = p_project_id  ---4871809
          AND  asgn.task_id = p_proj_element_id
          AND  pa_progress_utils.get_max_rollup_asofdate(asgn.project_id
                                        , asgn.RESOURCE_LIST_MEMBER_ID
                                , 'PA_ASSIGNMENTS',c_as_of_date
                                ,asgn.task_version_id
                                , c_structure_type
                                , decode(c_published_structure, 'Y', null
                                 , c_structure_version_id)
                            , asgn.task_id) IS NULL
          AND asgn.ta_display_flag = 'Y';
Line: 11790

   SELECT decode(status.project_system_status_code, 'STRUCTURE_PUBLISHED', 'Y', 'N')
   FROM pa_proj_elem_ver_structure str
   , pa_project_statuses status
   where str.element_version_id = c_structure_version_id
   AND str.project_id = c_project_id
   AND str.status_code = status.project_status_code;
Line: 11804

   SELECT max(as_of_date)
   FROM pa_progress_rollup
   WHERE project_id = c_project_id
   AND object_id = c_object_id
   AND object_type = c_object_type
   AND structure_type = c_structure_type
   AND ((c_published_structure = 'Y' AND structure_version_id is null)
         OR (c_published_structure = 'N'
             AND structure_version_id = c_structure_version_id)
         OR (c_structure_type = 'FINANCIAL' AND structure_version_id is null)    /* Bug#6485646 */
        )
   AND current_flag <> 'W'
   AND as_of_date <= c_as_of_date;
Line: 11823

   SELECT max(as_of_date)
   FROM pa_progress_rollup ppr, pa_proj_element_versions ppev -- Bug # 4658185.
   WHERE ppr.project_id = c_project_id
   AND ppr.object_id = c_object_id
   AND ppr.object_type = c_object_type
   AND ppr.structure_type = c_structure_type
   AND ppr.project_id = ppev.project_id  -- Bug # 4658185.
   AND ppr.object_id = ppev.proj_element_id  -- Bug # 4658185.
   AND ppr.object_version_id = ppev.element_version_id  -- Bug # 4658185.
   AND ppev.parent_structure_version_id = c_structure_version_id  -- Bug # 4658185.
   AND ((c_published_structure = 'Y' AND ppr.structure_version_id is null)
             OR (c_published_structure = 'N'
                     AND ppr.structure_version_id = c_structure_version_id))
   AND ppr.current_flag <> 'W';
Line: 11846

    SELECT nvl(ppr.completed_percentage,decode(nvl(c_program_flag,'Y'),'Y', ppr.eff_rollup_percent_comp, ppr.base_percent_complete))
    -- 4392189 : Program Reporting Changes - Phase 2 : Added Decode above
    FROM pa_progress_rollup ppr
    WHERE ppr.project_id = c_project_id
    and ppr.object_id = c_object_id
    and ppr.object_type = c_object_type
    and ppr.structure_type = c_structure_type
    and ((c_published_structure = 'Y' AND structure_version_id is null)
         OR (c_published_structure = 'N'
             AND structure_version_id = c_structure_version_id)
         OR (c_structure_type = 'FINANCIAL' AND structure_version_id is null)    /* Bug#6485646 */
             )
    and current_flag <> 'W'
    and ppr.as_of_date = c_as_of_date;
Line: 11864

    SELECT decode(elem.base_percent_comp_deriv_code, null
                  , ttype.base_percent_comp_deriv_code,'^'
                  ,ttype.base_percent_comp_deriv_code,elem.base_percent_comp_deriv_code)
    FROM pa_proj_elements elem
         , pa_task_types ttype
    where elem.proj_element_id = c_task_id
    AND elem.project_id = c_project_id
    AND elem.object_type =c_object_type
    AND elem.type_id = ttype.task_type_id;
Line: 11878

    SELECT task_weight_basis_code
    from pa_proj_progress_attr pppa
    where pppa.project_id = c_project_id
    AND pppa.object_id = c_task_id
    AND pppa.structure_type = c_structure_type
    and pppa.object_type = c_object_type;
Line: 12012

                select structure_sharing_Code
                from pa_projects_all
                where project_id=p_project_id;
Line: 12023

         select (nvl(ppr.ppl_act_effort_to_date,0)
             +nvl(ppr.eqpmt_act_effort_to_date,0)
             +nvl(ppr.subprj_ppl_act_effort,0)
             +nvl(ppr.subprj_eqpmt_act_effort,0)
             +nvl(ppr.oth_quantity_to_date,0)) act_effort_prev_asofdate
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.structure_type = 'WORKPLAN'
        and ppr.proj_element_id = p_proj_element_id
			and nvl(ppr.cbs_element_id,-1) = nvl(p_cbs_element_id,-1) --16820685
        and ppr.structure_version_id is null
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                      from pa_progress_rollup ppr2
                                      where ppr2.project_id = p_project_id
                                      and ppr2.object_id = p_object_id
                      and ppr2.structure_type = 'WORKPLAN'
                      and ppr2.proj_element_id = p_proj_element_id
                      and ppr2.structure_version_id is null
					  and nvl(ppr2.cbs_element_id,-1) = nvl(p_cbs_element_id,-1) --16820685
                      and ppr2.current_flag <> 'W' -- Fix for Bug # 4249286.
                                   -- Fix for Bug # 4185974.
                      and ppr2.as_of_date < l_as_of_date); -- Fix for Bug # 4185974.
Line: 12052

        select (nvl(ppr.oth_act_cost_to_date_tc,0)
            +nvl(ppr.ppl_act_cost_to_date_tc,0)
                        +nvl(ppr.eqpmt_act_cost_to_date_tc,0)
            +nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_TC,0)
                        +nvl(ppr.subprj_ppl_act_cost_tc,0)
            +nvl(ppr.subprj_eqpmt_act_cost_tc,0)) act_bur_cost_tc_prev_asofdate
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.structure_type = 'WORKPLAN'
        and ppr.proj_element_id = p_proj_element_id
			and nvl(ppr.cbs_element_id,-1) = nvl(p_cbs_element_id,-1) --16820685
        and ppr.structure_version_id is null
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                      from pa_progress_rollup ppr2
                                      where ppr2.project_id = p_project_id
                                      and ppr2.object_id = p_object_id
                      and ppr2.structure_type = 'WORKPLAN'
                      and ppr2.proj_element_id = p_proj_element_id
                      and ppr2.structure_version_id is null
					   and nvl(ppr2.cbs_element_id,-1) = nvl(p_cbs_element_id,-1) --16820685
                      and ppr2.current_flag <> 'W' -- Fix for Bug # 4249286.
                                  -- Fix for Bug # 4185974.
                      and ppr2.as_of_date < l_as_of_date); -- Fix for Bug # 4185974.
Line: 12080

                 select (nvl(ppr.oth_act_cost_to_date_pc,0)
             +nvl(ppr.ppl_act_cost_to_date_pc,0)
                         +nvl(ppr.eqpmt_act_cost_to_date_pc,0)
             +nvl(ppr.SUBPRJ_OTH_ACT_COST_TO_DT_FC,0)
                         +nvl(ppr.subprj_ppl_act_cost_pc,0)
             +nvl(ppr.subprj_eqpmt_act_cost_pc,0)) act_bur_cost_pc_prev_asofdate
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.structure_type = 'WORKPLAN'
                and ppr.proj_element_id = p_proj_element_id
				and nvl(ppr.cbs_element_id,-1) = nvl(p_cbs_element_id,-1) --16820685
                and ppr.structure_version_id is null
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                      from pa_progress_rollup ppr2
                                      where ppr2.project_id = p_project_id
                                      and ppr2.object_id = p_object_id
                                      and ppr2.structure_type = 'WORKPLAN'
                                      and ppr2.proj_element_id = p_proj_element_id
									   and nvl(ppr2.cbs_element_id,-1) = nvl(p_cbs_element_id,-1) --16820685
                                      and ppr2.structure_version_id is null
                      and ppr2.current_flag <> 'W' -- Fix for Bug # 4249286.
                                   -- Fix for Bug # 4185974.
                      and ppr2.as_of_date < l_as_of_date); -- Fix for Bug # 4185974.
Line: 12109

         select (nvl(ppr.oth_act_rawcost_to_date_tc,0)
             +nvl(ppr.ppl_act_rawcost_to_date_tc,0)
                         +nvl(ppr.eqpmt_act_rawcost_to_date_tc,0)
             +nvl(ppr.SPJ_OTH_ACT_RAWCOST_TO_DT_TC,0)
                         +nvl(ppr.subprj_ppl_act_rawcost_tc,0)
             +nvl(ppr.subprj_eqpmt_act_rawcost_tc,0)) act_raw_cost_tc_prev_asofdate
                from pa_progress_rollup ppr
                where ppr.project_id = p_project_id
                and ppr.object_id = p_object_id
                and ppr.structure_type = 'WORKPLAN'
                and ppr.proj_element_id = p_proj_element_id
				and nvl(ppr.cbs_element_id,-1) = nvl(p_cbs_element_id,-1) --16820685
                and ppr.structure_version_id is null
                and ppr.as_of_date = (select max(ppr2.as_of_date)
                                      from pa_progress_rollup ppr2
                                      where ppr2.project_id = p_project_id
                                      and ppr2.object_id = p_object_id
                                      and ppr2.structure_type = 'WORKPLAN'
                                      and ppr2.proj_element_id = p_proj_element_id
									   and nvl(ppr2.cbs_element_id,-1) = nvl(p_cbs_element_id,-1) --16820685
                                      and ppr2.structure_version_id is null
                      and ppr2.current_flag <> 'W' -- Fix for Bug # 4249286.
                                  -- Fix for Bug # 4185974.
                      and ppr2.as_of_date < l_as_of_date); -- Fix for Bug # 4185974.
Line: 12409

select nvl(ppl_act_effort_to_date,0) asgn_act_eff
    ,nvl(ppl_act_cost_to_date_pc,0) asgn_act_cost
    ,nvl(estimated_remaining_effort,0) asgn_etc_eff
    ,nvl(ppl_etc_cost_pc,0) agn_etc_cost
from pa_progress_rollup ppr
where ppr.project_id = p_project_id
and ppr.proj_element_id = p_proj_element_id
and ppr.structure_type = 'WORKPLAN'
and ppr.structure_version_id is null
and ppr.object_type = 'PA_ASSIGNMENTS'
and ppr.current_flag = p_current_flag
and ppr.as_of_date = p_as_of_date;
Line: 12522

select progress_rollup_id
            FROM pa_progress_rollup
           WHERE project_id = p_project_id
             AND object_id = p_object_id
             AND decode(p_chk_task,'Y',proj_element_id,p_task_id) = p_task_id
             AND object_type = p_object_type
             AND structure_type = 'WORKPLAN'
             AND structure_version_id is null
             AND as_of_date <= p_as_of_date
             AND current_flag = 'W'
			  and nvl(cbs_element_id,-1) = nvl(p_cbs_element_id,-1) ;
Line: 12536

select progress_rollup_id
  from pa_progress_rollup ppr
 WHERE ppr.project_id = p_project_id
   AND ppr.object_id = p_object_id
   AND decode(p_chk_task,'Y',ppr.proj_element_id,p_task_id) = p_task_id
   AND ppr.object_type = p_object_Type
   AND ppr.structure_type = 'WORKPLAN'
   AND ppr.structure_version_id is null
   and  nvl(ppr.cbs_element_id,-1) = nvl(p_cbs_element_id,-1)  --16820685
   AND ppr.as_of_date = (select max(as_of_date)
                      from pa_progress_rollup
                     where project_id = p_project_id
                       AND object_id = p_object_id
                       AND decode(p_chk_task,'Y',proj_element_id,p_task_id) = p_task_id
                       AND object_type = p_object_Type
                       AND structure_type = 'WORKPLAN'
                       AND structure_version_id is null
					    and nvl(cbs_element_id,-1) = nvl(p_cbs_element_id,-1) --16820685
                       AND as_of_Date <= p_as_of_date);
Line: 12584

  select current_flag
    FROM pa_progress_rollup
   WHERE project_id = p_project_id
     AND object_id = p_object_id
     AND object_type = p_object_type
     AND decode(p_chk_task,'Y',proj_element_id,nvl(p_task_id,-99)) = nvl(p_task_id,-99)
     AND structure_type = 'WORKPLAN'
     AND structure_version_id is null
     AND current_flag in ('W','Y')
   order by current_flag asc;
Line: 12610

	select 'Y'
	from
	pa_resource_assignments pra,
	pa_progress_rollup ppr
	where pra.ta_display_flag = 'N'
			and pra.wbs_element_version_id = p_element_ver_id
			and pra.project_id = p_project_id
			and ppr.project_id = p_project_id
			and ppr.object_type = 'PA_ASSIGNMENTS'
			and ppr.object_id = pra.resource_list_member_id
			and ppr.structure_type = 'WORKPLAN'
			and ppr.structure_version_id is null
			and ppr.proj_element_id = p_proj_element_id
			and rownum = 1;
Line: 12653

  select /*+ index(PFXAF PJI_FP_XBS_ACCUM_F_N1) */ time_id.proj_element_id proj_element_id -- Fix for Bug # 14169654.
       ,time_id.as_of_date as_of_date
       ,sum(pfxaf.labor_hrs) labor_hours
       ,sum(pfxaf.equipment_hours) equipment_hours
       ,sum(pfxaf.brdn_cost) prj_brdn_cost
    from   pji_fp_xbs_accum_f pfxaf,
           pa_budget_versions pbv,
           (
            select prog_date.proj_element_id proj_element_id,
            prog_date.as_of_date as_of_date,
            ptcpv.cal_period_id cal_period_id,
            ptcpv.name period_name,
            ptcpv.start_date pstart_date,
            ptcpv.end_date pend_date
            from
            PJI_TIME_CAL_PERIOD_V ptcpv,
             (
               select ppv.proj_element_id proj_element_id,
                      nvl(p_as_of_date,(ppr.as_of_date)) as_of_date
               from pa_progress_rollup ppr,
                      pa_proj_element_versions ppv
                where ppv.parent_structure_version_id=p_structure_version_id
                  and ppv.project_id=p_project_id
                and ppv.proj_element_id=p_proj_element_id
                and ppr.object_id (+) =ppv.proj_element_id
                and ppr.object_version_id (+) =ppv.element_version_id
                and ppr.project_id (+) = ppv.project_id
                and ppr.structure_version_id (+) = ppv.parent_structure_version_id
                and ppr.structure_type (+) = 'WORKPLAN'
                and ppr.current_flag (+) = 'Y'
             )prog_date
             where ptcpv.calendar_id=p_cal_id
            -- and ptcpv.start_date <= prog_date.as_of_date
             and ptcpv.end_date <= prog_date.as_of_date
           )time_id
    where  pfxaf.project_id=p_project_id
    and    pfxaf.project_id=pbv.project_id
    and    pbv.project_structure_version_id=p_baseline_struc_id
    and    pbv.budget_version_id=pfxaf.plan_version_id
    and    pfxaf.project_element_id=time_id.proj_element_id
    and    pfxaf.wbs_rollup_flag='N'
    and    pfxaf.rbs_aggr_level='T'
    and    pfxaf.prg_rollup_flag='N'
    and    pfxaf.period_type_id=32
    and    pfxaf.calendar_type=p_cal_type
    and    pfxaf.time_id=time_id.cal_period_id
    group by time_id.proj_element_id
       ,time_id.as_of_date ;
Line: 12704

  select /*+ index(PFXAF PJI_FP_XBS_ACCUM_F_N1) */ pfxaf.project_element_id proj_element_id -- Fix for Bug # 14169654.
       ,time_id.pstart_date pstart_date
       ,time_id.pend_date pend_date
       ,time_id.as_of_date as_of_date
       ,pfxaf.labor_hrs labor_hours
       ,pfxaf.equipment_hours equipment_hours
       ,pfxaf.brdn_cost prj_brdn_cost
    from   pji_fp_xbs_accum_f pfxaf,
           pa_budget_versions pbv,
           (
            select prog_date.proj_element_id proj_element_id,
            prog_date.as_of_date as_of_date,
            ptcpv.cal_period_id cal_period_id,
            ptcpv.name period_name,
            ptcpv.start_date pstart_date,
            ptcpv.end_date pend_date
            from
            PJI_TIME_CAL_PERIOD_V ptcpv,
             (
               select ppv.proj_element_id proj_element_id,
                      nvl(p_as_of_date,(ppr.as_of_date)) as_of_date
               from pa_progress_rollup ppr,
                      pa_proj_element_versions ppv
                where ppv.parent_structure_version_id=p_structure_version_id
                  and ppv.project_id=p_project_id
                and ppv.proj_element_id=p_proj_element_id
                and ppr.object_id (+) =ppv.proj_element_id
                and ppr.object_version_id (+) =ppv.element_version_id
                and ppr.project_id (+) = ppv.project_id
                and ppr.structure_version_id (+) = ppv.parent_structure_version_id
                and ppr.structure_type (+) = 'WORKPLAN'
                and ppr.current_flag (+) = 'Y'
             )prog_date
             where ptcpv.calendar_id=p_cal_id
             and ptcpv.start_date <= prog_date.as_of_date
             and ptcpv.end_date >prog_date.as_of_date
           )time_id
    where  pfxaf.project_id=p_project_id
    and    pfxaf.project_id=pbv.project_id
    and    pbv.project_structure_version_id=p_baseline_struc_id
    and    pbv.budget_version_id=pfxaf.plan_version_id
    and    pfxaf.project_element_id=time_id.proj_element_id
    and    pfxaf.wbs_rollup_flag='N'
    and    pfxaf.rbs_aggr_level='T'
    and    pfxaf.prg_rollup_flag='N'
    and    pfxaf.period_type_id=32
    and    pfxaf.calendar_type=p_cal_type
    and    pfxaf.time_id=time_id.cal_period_id
    ;
Line: 12760

  select /*+ index(PFXAF PJI_FP_XBS_ACCUM_F_N1) */ time_id.proj_element_id proj_element_id -- Fix for Bug # 14169654.
       ,time_id.as_of_date as_of_date
       ,sum(pfxaf.labor_hrs) labor_hours
       ,sum(pfxaf.equipment_hours) equipment_hours
       ,sum(pfxaf.brdn_cost) prj_brdn_cost
    from   pji_fp_xbs_accum_f pfxaf,
           pa_budget_versions pbv,
           (
            select prog_date.proj_element_id proj_element_id,
            prog_date.as_of_date as_of_date,
            ptcpv.cal_period_id cal_period_id,
            ptcpv.name period_name,
            ptcpv.start_date pstart_date,
            ptcpv.end_date pend_date
            from
            PJI_TIME_CAL_PERIOD_V ptcpv,
             (
               select ppv.proj_element_id proj_element_id,
                      nvl(p_as_of_date,(ppr.as_of_date)) as_of_date
               from pa_progress_rollup ppr,
                      pa_proj_element_versions ppv
                where ppv.parent_structure_version_id=p_structure_version_id
                  and ppv.project_id=p_project_id
                and ppv.proj_element_id=p_proj_element_id
                and ppr.object_id (+) =ppv.proj_element_id
                and ppr.object_version_id (+) =ppv.element_version_id
                and ppr.project_id (+) = ppv.project_id
                and ppr.structure_version_id (+) IS NULL
                and ppr.structure_type (+) = 'WORKPLAN'
                and ppr.current_flag (+) ='Y'
              --group by ppv.proj_element_id
             )prog_date
             where ptcpv.calendar_id=p_cal_id
            -- and ptcpv.start_date <= prog_date.as_of_date
             and ptcpv.end_date <= prog_date.as_of_date
           )time_id
    where  pfxaf.project_id=p_project_id
    and    pfxaf.project_id=pbv.project_id
    and    pbv.project_structure_version_id=p_baseline_struc_id
    and    pbv.budget_version_id=pfxaf.plan_version_id
    and    pfxaf.project_element_id=time_id.proj_element_id
    and    pfxaf.wbs_rollup_flag='N'
    and    pfxaf.rbs_aggr_level='T'
    and    pfxaf.prg_rollup_flag='N'
    and    pfxaf.period_type_id=32
    and    pfxaf.calendar_type=p_cal_type
    and    pfxaf.time_id=time_id.cal_period_id
    group by time_id.proj_element_id
       ,time_id.as_of_date ;
Line: 12812

  select /*+ index(PFXAF PJI_FP_XBS_ACCUM_F_N1) */ pfxaf.project_element_id proj_element_id -- Fix for Bug # 14169654.
       ,time_id.pstart_date pstart_date
       ,time_id.pend_date pend_date
       ,time_id.as_of_date as_of_date
       ,pfxaf.labor_hrs labor_hours
       ,pfxaf.equipment_hours equipment_hours
       ,pfxaf.brdn_cost prj_brdn_cost
    from   pji_fp_xbs_accum_f pfxaf,
           pa_budget_versions pbv,
           (
            select prog_date.proj_element_id proj_element_id,
            prog_date.as_of_date as_of_date,
            ptcpv.cal_period_id cal_period_id,
            ptcpv.name period_name,
            ptcpv.start_date pstart_date,
            ptcpv.end_date pend_date
            from
            PJI_TIME_CAL_PERIOD_V ptcpv,
             (
               select ppv.proj_element_id proj_element_id,
                      nvl(p_as_of_date,(ppr.as_of_date)) as_of_date
               from pa_progress_rollup ppr,
                      pa_proj_element_versions ppv
                where ppv.parent_structure_version_id=p_structure_version_id
                  and ppv.project_id=p_project_id
                and ppv.proj_element_id=p_proj_element_id
                and ppr.object_id (+) =ppv.proj_element_id
                and ppr.object_version_id (+) =ppv.element_version_id
                and ppr.project_id (+) = ppv.project_id
                and ppr.structure_version_id (+) IS NULL
                and ppr.structure_type (+) = 'WORKPLAN'
                and ppr.current_flag (+) = 'Y'
              --group by ppv.proj_element_id
             )prog_date
             where ptcpv.calendar_id=p_cal_id
             and ptcpv.start_date <= prog_date.as_of_date
             and ptcpv.end_date >prog_date.as_of_date
           )time_id
    where  pfxaf.project_id=p_project_id
    and    pfxaf.project_id=pbv.project_id
    and    pbv.project_structure_version_id=p_baseline_struc_id
    and    pbv.budget_version_id=pfxaf.plan_version_id
    and    pfxaf.project_element_id=time_id.proj_element_id
    and    pfxaf.wbs_rollup_flag='N'
    and    pfxaf.rbs_aggr_level='T'
    and    pfxaf.prg_rollup_flag='N'
    and    pfxaf.period_type_id=32
    and    pfxaf.calendar_type=p_cal_type
    and    pfxaf.time_id=time_id.cal_period_id
    ;
Line: 12870

  select /*+ index(PFXAF PJI_FP_XBS_ACCUM_F_N1) */ time_id.proj_element_id proj_element_id -- Fix for Bug # 14169654.
       ,time_id.as_of_date as_of_date
       ,sum(pfxaf.labor_hrs) labor_hours
       ,sum(pfxaf.equipment_hours) equipment_hours
       ,sum(pfxaf.brdn_cost) prj_brdn_cost
    from   pji_fp_xbs_accum_f pfxaf,
           pa_budget_versions pbv,
           (
            select prog_date.proj_element_id proj_element_id,
            prog_date.as_of_date as_of_date,
            ptcpv.cal_period_id cal_period_id,
            ptcpv.name period_name,
            ptcpv.start_date pstart_date,
            ptcpv.end_date pend_date
            from
            PJI_TIME_CAL_PERIOD_V ptcpv,
             (
               select ppv.proj_element_id proj_element_id,
                      max(ppv.parent_structure_version_id) parent_structure_id,
                      nvl(p_as_of_date,max(ppr.as_of_date)) as_of_date
               from pa_progress_rollup ppr,
                      pa_proj_element_versions ppv
                where ppv.parent_structure_version_id<=p_structure_version_id
                  and ppv.project_id=p_project_id
                and ppv.proj_element_id=p_proj_element_id
                and ppr.object_id (+) =ppv.proj_element_id
                and ppr.object_version_id (+) =ppv.element_version_id
                and ppr.project_id (+) = ppv.project_id
                and ppr.structure_version_id (+) IS NULL
                and ppr.structure_type (+) = 'WORKPLAN'
                and ppr.current_flag (+) <> 'W'
              group by ppv.proj_element_id
             )prog_date
             where ptcpv.calendar_id=p_cal_id
            -- and ptcpv.start_date <= prog_date.as_of_date
             and ptcpv.end_date <= prog_date.as_of_date
           )time_id
    where  pfxaf.project_id=p_project_id
    and    pfxaf.project_id=pbv.project_id
    and    pbv.project_structure_version_id=p_baseline_struc_id
    and    pbv.budget_version_id=pfxaf.plan_version_id
    and    pfxaf.project_element_id=time_id.proj_element_id
    and    pfxaf.wbs_rollup_flag='N'
    and    pfxaf.rbs_aggr_level='T'
    and    pfxaf.prg_rollup_flag='N'
    and    pfxaf.period_type_id=32
    and    pfxaf.calendar_type=p_cal_type
    and    pfxaf.time_id=time_id.cal_period_id
    group by time_id.proj_element_id
       ,time_id.as_of_date ;
Line: 12923

  select /*+ index(PFXAF PJI_FP_XBS_ACCUM_F_N1) */ pfxaf.project_element_id proj_element_id -- Fix for Bug # 14169654.
       ,time_id.pstart_date pstart_date
       ,time_id.pend_date pend_date
       ,time_id.as_of_date as_of_date
       ,pfxaf.labor_hrs labor_hours
       ,pfxaf.equipment_hours equipment_hours
       ,pfxaf.brdn_cost prj_brdn_cost
    from   pji_fp_xbs_accum_f pfxaf,
           pa_budget_versions pbv,
           (
            select prog_date.proj_element_id proj_element_id,
            prog_date.as_of_date as_of_date,
            ptcpv.cal_period_id cal_period_id,
            ptcpv.name period_name,
            ptcpv.start_date pstart_date,
            ptcpv.end_date pend_date
            from
            PJI_TIME_CAL_PERIOD_V ptcpv,
             (
               select ppv.proj_element_id proj_element_id,
                      max(ppv.parent_structure_version_id) parent_structure_id,
                      nvl(p_as_of_date,max(ppr.as_of_date)) as_of_date
               from pa_progress_rollup ppr,
                      pa_proj_element_versions ppv
                where ppv.parent_structure_version_id<=p_structure_version_id
                  and ppv.project_id=p_project_id
                and ppv.proj_element_id=p_proj_element_id
                and ppr.object_id (+) =ppv.proj_element_id
                and ppr.object_version_id (+) =ppv.element_version_id
                and ppr.project_id (+) = ppv.project_id
                and ppr.structure_version_id (+) IS NULL
                and ppr.structure_type (+) = 'WORKPLAN'
                and ppr.current_flag (+) <> 'W'
              group by ppv.proj_element_id
             )prog_date
             where ptcpv.calendar_id=p_cal_id
             and ptcpv.start_date <= prog_date.as_of_date
             and ptcpv.end_date >prog_date.as_of_date
           )time_id
    where  pfxaf.project_id=p_project_id
    and    pfxaf.project_id=pbv.project_id
    and    pbv.project_structure_version_id=p_baseline_struc_id
    and    pbv.budget_version_id=pfxaf.plan_version_id
    and    pfxaf.project_element_id=time_id.proj_element_id
    and    pfxaf.wbs_rollup_flag='N'
    and    pfxaf.rbs_aggr_level='T'
    and    pfxaf.prg_rollup_flag='N'
    and    pfxaf.period_type_id=32
    and    pfxaf.calendar_type=p_cal_type
    and    pfxaf.time_id=time_id.cal_period_id
    ;
Line: 12977

  select ppev1.proj_element_id proj_element_id,
         ppev2.proj_element_id parent_task_id,
         ppev1.wbs_level,
         nvl(ppe.baseline_start_date,ppevs.scheduled_start_date) sch_start_date,
         nvl(ppe.baseline_finish_date,ppevs.scheduled_finish_date) sch_end_date
  from pa_proj_element_versions ppev1,
           pa_proj_element_versions ppev2,
       pa_object_relationships por,
           pa_proj_elements ppe,
           pa_proj_elem_ver_schedule ppevs
  where ppev1.parent_structure_version_id = p_structure_version_id
  and  ppev1.proj_element_id=ppe.proj_element_id
  and  nvl(ppe.link_task_flag,'N') = 'N'
  and  ppev1.element_version_id=ppevs.element_version_id
  and    ppev1.element_version_id = por.object_id_to1
  and  ppev2.element_version_id = por.object_id_from1
  and  por.relationship_type = 'S'
  and  por.object_type_to = 'PA_TASKS'
  and  ppe.object_type = 'PA_TASKS'
  order by  ppev1.wbs_level desc;
Line: 12999

  select 'Y'
    from pa_proj_elem_ver_structure
   where project_id = p_project_id
     and element_version_id = p_structure_version_id
     and status_code = 'STRUCTURE_PUBLISHED';
Line: 13021

  l_bcws_hash_tbl.delete();
Line: 13048

  SELECT ppfo.cost_time_phased_code INTO l_cal_type
  FROM pa_proj_fp_options ppfo, pa_budget_versions pbv
  WHERE pbv.project_id=p_project_id
  AND   pbv.project_structure_version_id=p_structure_version_id
  AND   pbv.budget_version_id=ppfo.fin_plan_version_id
  AND   ppfo.fin_plan_option_level_code='PLAN_VERSION';
Line: 13063

    SELECT ftcn.calendar_id INTO l_cal_id
    FROM PA_time_cal_name ftcn,  /* Modified for bug 12979524 */
         pa_projects_all ppa,
         pa_implementations_all pia,
         gl_sets_of_books gsb
    WHERE ppa.project_id=p_project_id
    AND   ppa.org_id=pia.org_id
    AND   pia.set_of_books_id=gsb.set_of_books_id
    AND   gsb.period_set_name=ftcn.period_set_name
    AND   gsb.accounted_period_type=ftcn.period_type;
Line: 13074

    SELECT ftcn.calendar_id INTO l_cal_id
    FROM pa_time_cal_name ftcn,  /* Modified for bug 12979524 */
         pa_projects_all ppa,
         pa_implementations_all pia
    WHERE ppa.project_id=p_project_id
    AND   ppa.org_id=pia.org_id
    AND   pia.period_set_name=ftcn.period_set_name
    AND   pia.pa_period_type=ftcn.period_type;
Line: 13299

    SELECT  as_of_date FROM (
    SELECT  ppe.project_id project_id,
            PA_PROGRESS_UTILS.AS_OF_DATE(ppe.project_id, ppe.proj_element_id, ppp.progress_cycle_id, ppe.object_type) as_of_date ,
            ppe.object_type object_type
    FROM    --pa_project_statuses po, --removed for bug 13687289
            pa_proj_progress_attr ppp,
            pa_proj_elements ppe
    WHERE   ppe.project_id         = ppp.project_id(+)
    AND ppp.structure_type (+) = 'WORKPLAN'
    AND ppe.project_id         = p_project_id
    AND ppe.proj_element_id    = p_proj_element_id
    AND ppe.object_type        = p_object_type
    AND ((ppe.object_type     IN ('PA_TASKS', 'PA_STRUCTURES')
    AND rownum                 <61)
     OR (ppe.object_type       = 'PA_DELIVERABLES'
    AND rownum                 <11))
    MINUS
    SELECT  to_number(p_project_id) project_id,
            to_date(NULL) as_of_date,
            TO_CHAR(p_object_type) object_type
    FROM    dual
    )
    WHERE ROWNUM = 1;
Line: 13347

 	   * This will be used in Team Member Home page > Update Progress >
 	   * Assignments tab view to get the actual effort this period
 	   * value. The logic in this method is similar to the one used in
 	   * pa_tasks_assigns_progress_v to derive actual effort to this period.
 	   */
 	 FUNCTION get_assgn_act_effort_period (p_as_of_date        IN     DATE
 	                                      ,p_project_id        IN     NUMBER
 	                                      ,p_object_id         IN     NUMBER
 	                                      ,p_object_version_id IN     NUMBER
 	                                                             ,p_proj_element_id   IN     NUMBER := null
																 ,p_cbs_element_id   NUMBER := null ) -- Added for CBS phase 2 16200605
 return NUMBER
 	 IS
 	         l_act_effort_period                NUMBER := NULL;
Line: 13365

 	 select decode(ptav.resource_class_code, 'PEOPLE', ppr.PPL_ACT_EFFORT_TO_DATE, 'EQUIPMENT', ppr.EQPMT_ACT_EFFORT_TO_DATE,
 	  ppr.oth_quantity_to_date)
 	  from pa_progress_rollup ppr,
 	       pa_task_asgmts_v ptav
 	  where  ptav.project_id = p_project_id
 	  and ptav.task_id = p_proj_element_id
 	  and ptav.project_id = ppr.project_id
 	  and ptav.resource_list_member_id = ppr.object_id
 	  and ptav.task_id = ppr.proj_element_id
 	  and ptav.task_version_id = p_object_version_id
 	  and ppr.proj_element_id = p_proj_element_id
 	  and 'PA_ASSIGNMENTS' = ppr.object_type
 	  and ppr.project_id = p_project_id
 	  and ppr.object_id = p_object_id
	  AND NVL(ppr.cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
 	  and trunc(ppr.as_of_date) = trunc(p_as_of_date)
 	  and ppr.structure_type = 'WORKPLAN'
 	  and ppr.structure_version_id IS NULL
 	  and (nvl(ppr.current_flag,'N') = 'W' or (ppr.current_flag IN ('Y', 'N')
 	  and not exists (select 1 from pa_progress_rollup ppc1 where ppc1.project_id = p_project_id
 	      and ppc1.object_id = ptav.resource_list_member_id
		  AND NVL(ppc1.cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
 	      and ppc1.proj_element_id = ptav.task_id and ppc1.object_Type = 'PA_ASSIGNMENTS'
 	      and ppc1.structure_type = 'WORKPLAN'
 	      and ppc1.as_of_date <= pa_progress_utils.get_prog_asofdate() and ppc1.structure_version_id is null
 	      and ppc1.current_flag = 'W')));
Line: 13394

 	          select (nvl(ppr.ppl_act_effort_to_date,0)
 	                  +nvl(ppr.eqpmt_act_effort_to_date,0)
 	                  +nvl(ppr.subprj_ppl_act_effort,0)
 	                  +nvl(ppr.subprj_eqpmt_act_effort,0)
 	                  +nvl(ppr.oth_quantity_to_date,0)) act_effort_prev_asofdate
 	         from pa_progress_rollup ppr
 	         where ppr.project_id = p_project_id
 	         and ppr.object_id = p_object_id
			 AND NVL(ppr.cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
 	         and ppr.structure_type = 'WORKPLAN'
 	         and ppr.proj_element_id = p_proj_element_id
 	         and ppr.structure_version_id is null
 	         and ppr.as_of_date = (select max(ppr2.as_of_date)
 	                               from pa_progress_rollup ppr2
 	                               where ppr2.project_id = p_project_id
 	                               and ppr2.object_id = p_object_id
								   AND NVL(ppr2.cbs_element_id,-1) = NVL(p_cbs_element_id,-1) --Added for CBS phase 2 16200605
 	                               and ppr2.structure_type = 'WORKPLAN'
 	                               and ppr2.proj_element_id = p_proj_element_id
 	                               and ppr2.structure_version_id is null
 	                               and ppr2.current_flag <> 'W'
 	                               and ppr2.as_of_date < p_as_of_date);