DBA Data[Home] [Help]

APPS.PA_BUDGET_UTILS SQL Statements

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

Line: 33

     select bv.budget_version_id
     into   x_budget_version_id
     from   pa_budget_versions bv , pa_budget_types bt
     where  bv.project_id = x_project_id
     and    bv.budget_type_code = x_budget_type_code
     and    bv.budget_status_code in ('W', 'S')
     and    bv.budget_type_code = bt.budget_type_code
     and    nvl(bt.plan_type,'BUDGET') = 'BUDGET';
Line: 91

     select bv.budget_version_id
     into   x_budget_version_id
     from   pa_budget_versions bv, pa_budget_types bt
     where  bv.project_id = x_project_id
     and    bv.budget_type_code = x_budget_type_code
     and    bv.current_flag = 'Y'
     and    bv.budget_type_code = bt.budget_type_code
     and    nvl(bt.plan_type,'BUDGET') = 'BUDGET';
Line: 133

     select bv.budget_version_id
     into   x_budget_version_id
     from   pa_budget_versions bv, pa_budget_types bt
     where  bv.project_id = x_project_id
     and    bv.budget_type_code = x_budget_type_code
     and    bv.current_original_flag = 'Y'
     and    bv.budget_type_code = bt.budget_type_code
     and    nvl(bt.plan_type,'BUDGET') = 'BUDGET';
Line: 220

    select resource_list_id
    into   x_resource_list_id
        from   pa_budget_versions
        where  budget_version_id = x_baselined_version_id;
Line: 231

    select budget_amount_code
    into   x_budget_amount_code
    from   pa_budget_types
    where  budget_type_code = x_budget_type_code;
Line: 241

       select t.allow_cost_budget_entry_flag,
          t.cost_budget_resource_list_id
       into   x_allow_budget_entry_flag,
          x_resource_list_id
       from   pa_project_types t,
          pa_projects p
       where  p.project_id = x_project_id
       and    p.project_type = t.project_type;
Line: 252

       select t.allow_rev_budget_entry_flag,
          t.rev_budget_resource_list_id
       into   x_allow_budget_entry_flag,
          x_resource_list_id
       from   pa_project_types t,
          pa_projects p
       where  p.project_id = x_project_id
       and    p.project_type = t.project_type;
Line: 308

     select budget_amount_code
     into   x_budget_amount_code
     from   pa_budget_types
     where  budget_type_code = x_budget_type_code;
Line: 318

        select t.allow_cost_budget_entry_flag,
               t.cost_budget_entry_method_code
        into   x_allow_budget_entry_flag,
               x_budget_entry_method_code
        from   pa_project_types t,
           pa_projects p
        where  p.project_id = x_project_id
        and    p.project_type = t.project_type;
Line: 329

        select t.allow_rev_budget_entry_flag,
               t.rev_budget_entry_method_code
        into   x_allow_budget_entry_flag,
               x_budget_entry_method_code
        from   pa_project_types t,
           pa_projects p
        where  p.project_id = x_project_id
        and    p.project_type = t.project_type;
Line: 370

     select budget_type_code
     into   x_budget_type_code
     from   pa_budget_types
     where  budget_type = x_budget_type;
Line: 392

     select budget_entry_method_code
     into   x_budget_entry_method_code
     from   pa_budget_entry_methods
     where  budget_entry_method = x_budget_entry_method;
Line: 414

     select lookup_code
     into   x_change_reason_code
     from   pa_lookups
     where  lookup_type = 'BUDGET CHANGE REASON'
     and    meaning = x_meaning;
Line: 523

            select 1
            into   dummy
            from   dual
            where  exists
           (select 1
            from   pa_budget_versions bv, pa_budget_types bt
            where  bv.project_id = x_project_id
                and    bv.budget_type_code is NOT NULL  -- This must be specified for r11.5.7 Budgets Model
                and    bv.budget_type_code = bt.budget_type_code
                and    nvl(bt.plan_type,'BUDGET') = 'BUDGET');
Line: 555

            select 1
            into   dummy
            from   dual
            where  exists
           (select 1
            from   pa_budget_versions bv
                where  bv.project_id = x_project_id
                and    bv.fin_plan_type_id is NOT NULL  -- Specified for FP Model
                and    nvl(bv.wp_version_flag,'N') = 'N'  -- (Added for Patchset M,Tracking Bug No - 3354518)
                );
Line: 580

            select 1
            into   dummy
            from   dual
            where  exists
           (select 1
            from   pa_budget_versions bv, pa_budget_types bt
            where  bv.project_id = x_project_id
        and    bv.budget_type_code = x_budget_type_code
                and    bv.budget_type_code = bt.budget_type_code
                and    nvl(bt.plan_type,'BUDGET') = 'BUDGET');
Line: 605

                    select 1
                    into   dummy
                    from   dual
                    where  exists
                (select 1
                 from   pa_budget_versions bv
                     where  bv.project_id = x_project_id
                     and    bv.fin_plan_type_id = x_fin_plan_type_id
                     and    bv.version_type = nvl(x_version_type, bv.version_type)
                    );
Line: 630

            select 1
            into   dummy
            from   dual
            where  exists
           (select 1
            from   pa_budget_versions bv, pa_budget_types bt
            where  bv.project_id = x_project_id
        and    bv.budget_type_code = x_budget_type_code
                and    bv.budget_type_code = bt.budget_type_code
                and    nvl(bt.plan_type,'BUDGET') = 'BUDGET');
Line: 655

            select 1
            into   dummy
            from   dual
            where  exists
        (select 1
         from   pa_budget_versions bv
             where  bv.project_id = x_project_id
             and    bv.fin_plan_type_id = x_fin_plan_type_id
             and    bv.version_type = nvl(x_version_type, bv.version_type)
            );
Line: 708

                    select 1
                    into   dummy
                    from   dual
                    where  exists
                (select 1
                 from   pa_budget_versions bv
                     where  bv.project_id = x_project_id
                     and    bv.approved_cost_plan_type_flag = 'Y'
                     and    bv.current_flag = 'Y'
                    );
Line: 724

                    select 1
                    into   dummy
                    from   dual
                    where  exists
                (select 1
                 from   pa_budget_versions bv
                     where  bv.project_id = x_project_id
                     and    bv.approved_rev_plan_type_flag = 'Y'
                     and    bv.current_flag = 'Y'
                    );
Line: 754

                    select 1
                    into   dummy
                    from   dual
                    where  exists
                (select 1
                 from   pa_budget_versions bv
                     where  bv.project_id = x_project_id
                     and    bv.fin_plan_type_id = x_fin_plan_type_id
                     and    bv.version_type  = nvl(x_version_type, bv.version_type)
                     and    bv.approved_cost_plan_type_flag = 'Y'
                     and    bV.current_flag = 'Y'
                    );
Line: 770

                    select 1
                    into   dummy
                    from   dual
                    where  exists
                (select 1
                 from   pa_budget_versions bv
                     where  bv.project_id = x_project_id
                     and    bv.fin_plan_type_id = x_fin_plan_type_id
                     and    bv.version_type  = nvl(x_version_type, bv.version_type)
                     and    bv.approved_rev_plan_type_flag = 'Y'
                     and    bV.current_flag = 'Y'
                    );
Line: 804

                  select 1
                  into   dummy
                  from   dual
                  where  exists
              (select 1
               from   pa_budget_versions bv, pa_budget_types bt
               where  bv.project_id = x_project_id
           and    bv.budget_type_code = x_budget_type_code
                   and    bv.budget_type_code = bt.budget_type_code
                   and    nvl(bt.plan_type,'BUDGET') = 'BUDGET'
                   and    bV.current_flag = 'Y'
                  );
Line: 830

                    select 1
                    into   dummy
                    from   dual
                    where  exists
                (select 1
                 from   pa_budget_versions bv
                     where  bv.project_id = x_project_id
                     and    bv.fin_plan_type_id = x_fin_plan_type_id
                     and    bv.version_type = nvl(x_version_type, bv.version_type)
                     and    bV.current_flag = 'Y'
                    );
Line: 949

            select 1
            into   dummy
            from   dual
            where  exists
           (select 1
            from   pa_budget_versions bv
                       , pa_budget_types bt
                       , pa_resource_assignments a
            where  a.task_id = x_task_id
        and    bv.budget_version_id = a.budget_version_id
                and    bv.budget_type_code is NOT NULL  -- This must be specified for r11.5.7 Budgets Model
                and    bv.budget_type_code = bt.budget_type_code
                and    nvl(bt.plan_type,'BUDGET') = 'BUDGET'
               );
Line: 985

            select 1
            into   dummy
            from   dual
            where  exists
           (select 1
            from   pa_budget_versions bv
                       , pa_resource_assignments a
            where  a.task_id = x_task_id
        and    bv.budget_version_id = a.budget_version_id
                and    bv.fin_plan_type_id is NOT NULL  -- Specified for FP Model
                and    nvl(bv.wp_version_flag,'N') = 'N'  -- (Added for Patchset M,Tracking Bug No - 3354518)
                );
Line: 1013

            select 1
            into   dummy
            from   dual
            where  exists
           (select 1
            from   pa_budget_versions bv
                       , pa_budget_types bt
                       , pa_resource_assignments a
            where  a.task_id = x_task_id
        and    bv.budget_version_id = a.budget_version_id
        and    bv.budget_type_code = x_budget_type_code
                and    bv.budget_type_code = bt.budget_type_code
                and    nvl(bt.plan_type,'BUDGET') = 'BUDGET'
                );
Line: 1042

                    select 1
                    into   dummy
                    from   dual
                    where  exists
                (select 1
                 from   pa_budget_versions bv
                            , pa_resource_assignments a
                 where  a.task_id = x_task_id
             and    bv.budget_version_id = a.budget_version_id
                     and    bv.fin_plan_type_id = x_fin_plan_type_id
                     and    bv.version_type = nvl(x_version_type, bv.version_type)
                    );
Line: 1069

            select 1
            into   dummy
            from   dual
            where  exists
           (select 1
            from   pa_budget_versions bv
                       , pa_budget_types bt
                       , pa_resource_assignments a
            where  a.task_id = x_task_id
        and    bv.budget_version_id = a.budget_version_id
        and    bv.budget_type_code = x_budget_type_code
                and    bv.budget_type_code = bt.budget_type_code
                and    nvl(bt.plan_type,'BUDGET') = 'BUDGET'
                );
Line: 1098

            select 1
            into   dummy
            from   dual
            where  exists
        (select 1
         from   pa_budget_versions bv
                    , pa_resource_assignments a
         where  a.task_id = x_task_id
         and    bv.budget_version_id = a.budget_version_id
             and    bv.fin_plan_type_id = x_fin_plan_type_id
             and    bv.version_type = nvl(x_version_type, bv.version_type)
            );
Line: 1150

                    select 1
                    into   dummy
                    from   dual
                    where  exists
                (select 1
                 from   pa_budget_versions bv
                    , pa_tasks t
                    , pa_resource_assignments a
                 where  a.budget_version_id = bv.budget_version_id
                     and    a.task_id = t.task_id
             and    t.top_task_id = x_task_id
                     and    bv.approved_cost_plan_type_flag = 'Y'
                     and    bv.current_flag = 'Y'
                    );
Line: 1168

                    select 1
                    into   dummy
                    from   dual
                    where  exists
                (select 1
                 from   pa_budget_versions bv
                    , pa_tasks t
                    , pa_resource_assignments a
                 where  a.budget_version_id = bv.budget_version_id
                     and    a.task_id = t.task_id
             and    t.top_task_id = x_task_id
                     and    bv.approved_rev_plan_type_flag = 'Y'
                     and    bv.current_flag = 'Y'
                    );
Line: 1204

           * the following select to avoid full index scan on PA_PROJ_ELEM_VER_SCHEDULE_N1
           */
                    select 1
                    into   dummy
                    from   dual
                    where  exists
                          (select 1
                           from   pa_budget_versions bv
                                 ,pa_tasks t      --Bug 4176059: Performance Fix: FP.M -B12: re-used pa_tasks
                           --     , pa_struct_task_wbs_v t -- Adding for FP.M, Tracking Bug No - 3354518.
                                 ,pa_resource_assignments a
                           where  a.budget_version_id = bv.budget_version_id
                           and    a.task_id = t.task_id
                           and    t.top_task_id = x_task_id
                           and    bv.fin_plan_type_id = x_fin_plan_type_id
                           and    bv.version_type  = nvl(x_version_type, bv.version_type)
                           and    bv.approved_cost_plan_type_flag = 'Y'
                           and    bV.current_flag = 'Y'
                    );
Line: 1231

           * the following select to avoid full index scan on PA_PROJ_ELEM_VER_SCHEDULE_N1
           */
                    select 1
                    into   dummy
                    from   dual
                    where  exists
                           (select 1
                            from   pa_budget_versions bv
                                  ,pa_tasks t   -- Bug 4176059: Performance Fix: FP.M -B12: re-used pa_tasks
                            --, pa_struct_task_wbs_v t -- Adding for FP.M, Tracking Bug No - 3354518.
                                  ,pa_resource_assignments a
                            where  a.budget_version_id = bv.budget_version_id
                            and    a.task_id = t.task_id
                            and    t.top_task_id = x_task_id
                            and    bv.fin_plan_type_id = x_fin_plan_type_id
                            and    bv.version_type  = nvl(x_version_type, bv.version_type)
                            and    bv.approved_rev_plan_type_flag = 'Y'
                            and    bV.current_flag = 'Y'
                    );
Line: 1272

                  select 1
                  into   dummy
                  from   dual
                  where  exists
              (select 1
               from   pa_budget_versions bv
                          , pa_budget_types bt
                  , pa_tasks t
                  , pa_resource_assignments a
               where  a.budget_version_id = bv.budget_version_id
                   and    a.task_id = t.task_id
           and    t.top_task_id = x_task_id
           and    bv.budget_type_code = x_budget_type_code
                   and    bv.budget_type_code = bt.budget_type_code
                   and    nvl(bt.plan_type,'BUDGET') = 'BUDGET'
                   and    bv.current_flag = 'Y'
                  );
Line: 1306

           * the following select to avoid full index scan on PA_PROJ_ELEM_VER_SCHEDULE_N1
           */

                    select 1
                    into   dummy
                    from   dual
                    where  exists
                          (select 1
                           from   pa_budget_versions bv
                                 ,pa_tasks t     -- Bug 4176059: Performance Fix: FP.M -B12: re-used pa_tasks
                                 --, pa_struct_task_wbs_v t -- Adding for FP.M, Tracking Bug No - 3354518.
                                 ,pa_resource_assignments a
                           where  a.budget_version_id = bv.budget_version_id
                           and    a.task_id = t.task_id
                           and    t.top_task_id = x_task_id
                           and    bv.fin_plan_type_id = x_fin_plan_type_id
                           and    bv.version_type = nvl(x_version_type, bv.version_type)
                           and    bv.current_flag = 'Y'
                    );
Line: 1387

    Select migration_code
      into l_migration_code
      from pa_resource_list_members
     where resource_list_member_id = x_resource_list_member_id;
Line: 1401

        select 1
        into   dummy
        from   sys.dual
        where  exists
           (select 1
            from   pa_resource_list_members m,
               pa_resource_assignments a
            where  m.parent_member_id = x_resource_list_member_id
        and    m.resource_list_member_id = a.resource_list_member_id
        and    a.budget_version_id = x_budget_version_id
        and    a.task_id = x_task_id);
Line: 1414

        select 1
        into   dummy
        from   sys.dual
        where  exists
           (select 1
            from   pa_resource_assignments a
            where  a.budget_version_id = x_budget_version_id
        and    a.task_id = x_task_id
                and    a.resource_list_member_id = x_parent_member_id);
Line: 1477

    SELECT nvl(SUM(nvl(b.raw_cost,0)), 0),
       nvl(SUM(nvl(b.burdened_cost,0)), 0),
       nvl(SUM(nvl(b.labor_quantity,0)), 0),
           nvl(SUM(nvl(b.revenue,0)), 0)
    INTO   raw_cost,
       burdened_cost,
       labor_qty,
           revenue_amount
    FROM   pa_budget_versions b
    WHERE  b.project_id = x_project_id
    AND    b.budget_type_code = x_budget_type
    AND    b.budget_status_code = decode(budget_status, 'B', 'B',
                    b.budget_status_code)
    AND   NOT (budget_status = 'O' and b.budget_status_code = 'B')
    AND    b.current_flag||'' = nvl(current_flag, b.current_flag)
    AND    b.current_original_flag =
        nvl(original_flag, b.current_original_flag);
Line: 1542

    SELECT nvl(SUM(nvl(l.raw_cost,0)), 0),
       nvl(SUM(nvl(l.burdened_cost,0)), 0),
       nvl(SUM(decode(a.track_as_labor_flag,'Y',nvl(l.quantity,0),0)), 0),
           nvl(SUM(nvl(l.revenue,0)), 0)
    INTO   raw_cost,
       burdened_cost,
       labor_qty,
           revenue_amount
    FROM   pa_budget_lines l,
       pa_resource_assignments a,
       pa_tasks t,
       pa_budget_versions v
    WHERE  v.project_id = x_project_id
    AND    v.budget_type_code = x_budget_type
    AND    v.budget_status_code = decode(budget_status, 'B', 'B',
                                                v.budget_status_code)
    and NOT (budget_status = 'O' and v.budget_status_code = 'B')
    and    v.current_flag||'' = nvl(current_flag, v.current_flag)
    and    a.budget_version_id = v.budget_version_id
    and    a.project_id = v.project_id
    and    t.project_id = x_project_id
    and    t.task_id = a.task_id
    and    x_task_id in (t.top_task_id, t.task_id)
    and    v.current_original_flag =
                        nvl(original_flag, v.current_original_flag)
    AND    l.resource_assignment_id = a.resource_assignment_id;
Line: 1578

  procedure delete_draft (x_budget_version_id   in     number,
                  x_err_code            in out NOCOPY number, --File.Sql.39 bug 4440895
                  x_err_stage           in out NOCOPY varchar2, --File.Sql.39 bug 4440895
                  x_err_stack           in out NOCOPY varchar2) --File.Sql.39 bug 4440895
  is
     old_stack varchar2(630);
Line: 1593

     x_err_stack := x_err_stack || '->delete_draft';
Line: 1599

     select v.project_id,
        v.budget_type_code,
        la.resource_list_assignment_id
     into   x_project_id,
        x_budget_type_code,
        x_resource_list_assgmt_id
     from   pa_resource_list_assignments la,
        pa_budget_versions v
     where  v.budget_version_id = x_budget_version_id
     and    v.project_id = la.project_id
     and    v.resource_list_id = la.resource_list_id;
Line: 1611

/* Never delete resource list assignment if it is baselined
     -- if there is a baselined version, then do not delete resource assignment

     pa_budget_utils.get_baselined_version_id(x_project_id,
                          x_budget_type_code,
                          x_baselined_version_id,
                          x_err_code,
                          x_err_stage,
                          x_err_stack);
Line: 1629

        x_err_stage := 'delete resource assignment <'
               || to_char(x_resource_list_assgmt_id) || '><'
               || x_budget_type_code || '>';
Line: 1634

        pa_res_list_assignments.delete_rl_uses(x_resource_list_assgmt_id,
               x_budget_type_code,
               x_err_code,
               x_err_stage,
               x_err_stack);
Line: 1649

     x_err_stage := 'delete budget lines <' || to_char(x_budget_version_id)
            || '>';
Line: 1652

     for bl_rec in (select rowid
            from   pa_budget_lines
                where  resource_assignment_id in
                   (select resource_assignment_id
                    from   pa_resource_assignments
                    where  budget_version_id = x_budget_version_id))
     loop
         pa_budget_lines_v_pkg.delete_row(x_rowid    => bl_rec.rowid);
Line: 1667

     x_err_stage := 'delete budget version <' || to_char(x_budget_version_id)
            || '>';
Line: 1670

     delete pa_budget_versions
     where  budget_version_id = x_budget_version_id;
Line: 1673

     fnd_attached_documents2_pkg.delete_attachments('PA_BUDGET_VERSIONS',
                                                     x_budget_version_id,
                                                     null, null, null, null,
                                                     'Y') ;
Line: 1683

  end delete_draft;
Line: 1752

  x_last_update_login number;
Line: 1771

     x_last_update_login := FND_GLOBAL.LOGIN_ID;
Line: 1809

    select resource_list_id
    into   x_baselined_resource_list_id
        from   pa_budget_versions
        where  budget_version_id = x_baselined_version_id;
Line: 1860

           pa_debug.g_err_stage:= 'Calling delete_draft';
Line: 1863

    pa_budget_utils.delete_draft(old_draft_version_id,
                    x_err_code,
                    x_err_stage,
                    x_err_stack);
Line: 1868

           pa_debug.g_err_stage:= 'After call to delete_draft';
Line: 1920

     SELECT pa_budget_versions_s.nextval
     INTO   x_budget_version_id
     FROM   dual;
Line: 1923

     insert into pa_budget_versions(
            budget_version_id,
            project_id,
            budget_type_code,
            version_number,
            budget_status_code,
            last_update_date,
            last_updated_by,
            creation_date,
            created_by,
            last_update_login,
            current_flag,
            original_flag,
            current_original_flag,
            resource_accumulated_flag,
            resource_list_id,
            version_name,
            budget_entry_method_code,
            baselined_by_person_id,
            baselined_date,
            change_reason_code,
            labor_quantity,
            labor_unit_of_measure,
            raw_cost,
            burdened_cost,
            revenue,
            description,
            attribute_category,
            attribute1,
            attribute2,
            attribute3,
            attribute4,
            attribute5,
            attribute6,
            attribute7,
            attribute8,
            attribute9,
            attribute10,
            attribute11,
            attribute12,
            attribute13,
            attribute14,
            attribute15,
        pm_product_code,
        pm_budget_reference,
        wf_status_code,
            approved_cost_plan_type_flag,
            approved_rev_plan_type_flag
     )
         select
            x_budget_version_id,
            x_project_id,
            x_budget_type_code,
            1,
            'W',
            SYSDATE,
            x_created_by,
            SYSDATE,
            x_created_by,
            x_last_update_login,
            'N',
            'N',
            'N',
            'N',
            x_resource_list_id,
            x_version_name,
            x_budget_entry_method_code,
            NULL,
            NULL,
            x_change_reason_code,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL,
            x_description,
            x_attribute_category,
            x_attribute1,
            x_attribute2,
            x_attribute3,
            x_attribute4,
            x_attribute5,
            x_attribute6,
            x_attribute7,
            x_attribute8,
            x_attribute9,
            x_attribute10,
            x_attribute11,
            x_attribute12,
            x_attribute13,
            x_attribute14,
            x_attribute15,
        x_pm_product_code,
        x_pm_budget_reference,
        NULL,
            decode(x_budget_type_code,'AC','Y','N'),
            decode(x_budget_type_code,'AR','Y','N')
    from sys.dual;
Line: 2126

    x_last_update_login  number;
Line: 2130

    select budget_type_code
    from pa_budget_versions
    where budget_version_id = x_budget_version_id;
Line: 2172

     x_last_update_login := FND_GLOBAL.LOGIN_ID;
Line: 2184

    select resource_assignment_id
    into   x_resource_assignment_id
    from   pa_resource_assignments
    where  budget_version_id = x_budget_version_id
    and    project_id = x_project_id
    and    NVL(task_id, 0) = NVL(x_task_id, 0)
    and    resource_list_member_id = x_resource_list_member_id
	AND   NVL(CBS_ELEMENT_ID,-1)=NVL(X_CBS_ELEMENT_ID,-1); --Bug 16604257
Line: 2211

          select pa_resource_assignments_s.nextval
          into   x_resource_assignment_id
          from   sys.dual;
Line: 2221

              insert into pa_resource_assignments
                 (resource_assignment_id,
                  budget_version_id,
                  project_id,
                  task_id,
                  resource_list_member_id,
				  CBS_ELEMENT_ID,
                  last_update_date,
                  last_updated_by,
                  creation_date,
                  created_by,
                  last_update_login,
                  unit_of_measure,
                  track_as_labor_flag,
              project_assignment_id, --added the cloumn for bug 2446041
                      RESOURCE_ASSIGNMENT_TYPE)
                 values ( x_resource_assignment_id,
                    x_budget_version_id,
                    x_project_id,
                    x_task_id,
                    x_resource_list_member_id,
					X_CBS_ELEMENT_ID,--Bug 16604257
                    SYSDATE,
                    x_created_by,
                    SYSDATE,
                    x_created_by,
                    x_last_update_login,
                    x_unit_of_measure,
                    x_track_as_labor_flag,
            -1,                       --added the cloumn for bug 2446041
                        'USER_ENTERED');
Line: 2333

       SELECT pa_budget_lines_s.nextval
         INTO l_budget_line_id
         FROM DUAL;
Line: 2342

     insert into pa_budget_lines
           (budget_line_id,                 /* FPB2 */
                budget_version_id,              /* FPB2 */
                resource_assignment_id,
            start_date,
        last_update_date,
                last_updated_by,
                creation_date,
                created_by,
                last_update_login,
            end_date,
            period_name,
            quantity,
            raw_cost,
            burdened_cost,
            revenue,
                change_reason_code,
                description,
                attribute_category,
                attribute1,
                attribute2,
                attribute3,
                attribute4,
                attribute5,
                attribute6,
                attribute7,
                attribute8,
                attribute9,
                attribute10,
                attribute11,
                attribute12,
                attribute13,
                attribute14,
                attribute15,
        pm_product_code,
        pm_budget_line_reference,
        quantity_source,
        raw_cost_source,
        burdened_cost_source,
        revenue_source,
                projfunc_currency_code,
                project_currency_code,
                txn_currency_code
                )
             values (
                l_budget_line_id,      /* FPB2 */
                x_budget_version_id,   /* FPB2 */
        x_resource_assignment_id,
            x_start_date,
        SYSDATE,
                x_created_by,
                SYSDATE,
                x_created_by,
                x_last_update_login,
            x_end_date,
            x_period_name,
            x_quantity,
            pa_currency.round_currency_amt(x_raw_cost),
            pa_currency.round_currency_amt(x_burdened_cost),
            pa_currency.round_currency_amt(x_revenue),
                x_change_reason_code,
            x_description,
                x_attribute_category,
                x_attribute1,
                x_attribute2,
                x_attribute3,
                x_attribute4,
                x_attribute5,
                x_attribute6,
                x_attribute7,
                x_attribute8,
                x_attribute9,
                x_attribute10,
                x_attribute11,
                x_attribute12,
                x_attribute13,
                x_attribute14,
                x_attribute15,
        x_pm_product_code,
        x_pm_budget_line_reference,
        x_quantity_source,
        x_raw_cost_source,
        x_burdened_cost_source,
        x_revenue_source,
                l_Projfunc_currency_code,
                l_Project_currency_code,
                l_txn_currency_code
                 );
Line: 2464

                                          p_action         => PA_MRC_FINPLAN.G_ACTION_INSERT,
                                          x_return_status  => l_return_status,
                                          x_msg_count      => l_msg_count,
                                          x_msg_data       => l_msg_data);
Line: 2537

     x_last_update_login number;
Line: 2551

     x_last_update_login := FND_GLOBAL.LOGIN_ID;
Line: 2562

     update pa_budget_versions v
     set    (labor_quantity,
             labor_unit_of_measure,
             raw_cost,
             burdened_cost,
             revenue,
             last_update_date,
             last_updated_by,
             last_update_login
            )
     =
    (select sum(nvl(to_number(decode(a.track_as_labor_flag,
                              'Y', l.quantity, NULL)),0)),
--             decode(a.track_as_labor_flag, 'Y', a.unit_of_measure, NULL),
            'HOURS',       -- V4 uses HOURS as the only labor unit
            pa_currency.round_currency_amt(sum(nvl(l.raw_cost, 0))),
            pa_currency.round_currency_amt(sum(nvl(l.burdened_cost, 0))),
            pa_currency.round_currency_amt(sum(nvl(l.revenue, 0))),
            SYSDATE,
            x_created_by,
            x_last_update_login
     from   pa_resource_assignments a,
            pa_budget_lines l
     where  a.budget_version_id = x_budget_version_id /*Bug 4198840: Perf:Included this join*/
     and    a.budget_version_id = v.budget_version_id
     and    a.resource_assignment_id = l.resource_assignment_id
    )
    where  budget_version_id = x_budget_version_id;
Line: 2592

         pa_debug.g_err_stage:= 'After update';
Line: 2777

    select 1
    into   l_dummy
    from   sys.dual
    where  exists
           (select 1
        from   pa_resource_assignments
        where  budget_version_id = p_draft_version_id);
Line: 2826

           select 'T'
           into   l_entry_level_code
           from   sys.dual
       where  exists
             (select 1
              from   pa_resource_assignments
              where  budget_version_id = p_draft_version_id
           -- and    task_id is not null);
Line: 2857

    select nvl(revenue,0)  -- Bug 3142016
    into   l_budget_total
    from   pa_budget_versions
    where  budget_version_id = p_draft_version_id;
Line: 3111

       select 'Y'
       into l_dual_bdgt_cntrl_flag
       from dual
       where exists
             (select 1
              from pa_budgetary_control_options a
              where project_id = p_project_id
                and external_budget_code = 'CC'
                and bdgt_cntrl_flag = 'Y')
         and exists
             (select 1
              from pa_budgetary_control_options b
              where project_id = p_project_id
                and external_budget_code = 'GL'
                and bdgt_cntrl_flag = 'Y');
Line: 3132

       SELECT budget_version_id
       INTO l_CC_Budget_Version_id
       FROM pa_budget_versions bv
       WHERE project_id = p_project_id
         AND BUDGET_STATUS_CODE = 'S'
         AND budget_type_code =
                (SELECT budget_type_code
                 FROM pa_budgetary_control_options pbco
                 WHERE pbco.budget_type_code = bv.budget_type_code
                   AND pbco.project_id = bv.project_id
                   AND pbco.bdgt_cntrl_flag = 'Y'
                   AND pbco.external_budget_code = 'CC');
Line: 3255

     SELECT budget_type_code
     INTO   l_budget_type_code
     FROM   pa_budget_versions
     WHERE  budget_version_id = p_draft_version_id
     AND    budget_status_code = 'S';
Line: 3261

     SELECT budget_version_id, version_number
     INTo   l_baseline_version_id, l_baseline_version_number
     FROM   pa_budget_versions
     WHERE  budget_type_code = l_budget_type_code
     AND    project_id = p_project_id
     AND    budget_status_code = 'B'
     AND    current_flag = 'Y';
Line: 3302

                 SELECT budget_version_id
                 INTo   l_pre_baseline_version_id
                 FROM   pa_budget_versions pb
                 WHERE  pb.budget_type_code = l_budget_type_code
                 AND    pb.project_id = p_project_id
                 AND    pb.budget_status_code='B'
                 AND    pb.version_number = (l_baseline_version_number - 1);
Line: 3314

     PA_CLIENT_EXT_FV_BUDGET_INT.INSERT_BUDGET_LINES
     (p_project_id                    => p_project_id
     ,p_pre_baselined_version_id      => l_pre_baseline_version_id
     ,p_baselined_budget_version_id   => l_baseline_version_id
     ,x_rejection_code                => l_rejection_code
     ,x_interface_status              => l_interface_status);
Line: 3389

            Select budget_type_code
            into   l_budget_type_code
            from pa_budget_versions
            where budget_version_id = p_draft_version_id;
Line: 3397

          SELECT budget_version_id, version_number
          INTo   l_baseline_version_id, l_baseline_version_number
          FROM   pa_budget_versions
          WHERE  budget_type_code = l_budget_type_code
          AND    project_id = p_project_id
          AND    budget_status_code='B'
          AND    current_flag = 'Y';
Line: 3406

                 SELECT budget_version_id
                 INTo   l_pre_baseline_version_id
                 FROM   pa_budget_versions pb
                 WHERE  pb.budget_type_code = l_budget_type_code
                 AND    pb.project_id = p_project_id
                 AND    pb.budget_status_code = 'B'
                 AND    pb.version_number = (l_baseline_version_number - 1);
Line: 3419

          PA_CLIENT_EXT_FV_BUDGET_INT.INSERT_BUDGET_LINES
          (p_project_id                    => p_project_id
          ,p_pre_baselined_version_id      => l_pre_baseline_version_id
          ,p_baselined_budget_version_id   => l_baseline_version_id
          ,x_rejection_code                => l_rejection_code
          ,x_interface_status              => l_interface_status) ;
Line: 3467

              Select meaning
              into l_rejection_reason
              from pa_lookups
              where lookup_code = l_rejection_code
              and lookup_type = 'PA_BUD_INTERFACE_REJ_CODE';
Line: 3536

   select 'P'
   from dual
   where x_task_id is null
     union
   select 'T'
   from pa_tasks
   where x_task_id is not null
   and   task_id = x_task_id
   and   parent_task_id is null
      union
   select 'M'
   from pa_tasks
   where x_task_id is not null
   and   task_id = x_task_id
   and   parent_task_id is not null
   and   exists (select 'X'
                 from pa_tasks
                 where parent_task_id = x_task_id)
      union
   select 'L'
   from dual
   where x_task_id is not null
   and   not exists (select 'X'
                     from pa_tasks
                     where parent_task_id = x_task_id);
Line: 3564

   select labor_quantity,
          raw_cost,
          burdened_cost,
          revenue
   from   pa_budget_versions
   where  v_rollup_flag = 'P'                    -- Project Level
   and    budget_version_id = x_budget_version_id;
Line: 3574

   select SUM(DECODE(a.TRACK_AS_LABOR_FLAG,'Y',NVL(l.QUANTITY,0),0)),
          SUM(NVL(l.RAW_COST,0)),
          SUM(NVL(l.BURDENED_COST,0)),
          SUM(NVL(l.REVENUE,0))
   from pa_tasks t,
        pa_budget_lines l ,
        pa_resource_assignments a
   where v_rollup_flag = 'T'                      -- Top Task Level
   and   a.budget_version_id = x_budget_version_id
   and   a.task_id = t.task_id
   and   t.top_task_id  = x_task_id
   and   a.resource_assignment_id = l.resource_assignment_id
   and   NVL(a.RESOURCE_ASSIGNMENT_TYPE,'USER_ENTERED') = 'USER_ENTERED';
Line: 3590

   select SUM(DECODE(a.TRACK_AS_LABOR_FLAG,'Y',NVL(l.QUANTITY,0),0)),
          SUM(NVL(l.RAW_COST,0)),
          SUM(NVL(l.BURDENED_COST,0)),
          SUM(NVL(l.REVENUE,0))
   from pa_budget_lines l,
        pa_resource_assignments a
   where v_rollup_flag = 'M'                      -- Middle Task Level
   and   a.budget_version_id = x_budget_version_id
   and   a.task_id in (select task_id
                      from pa_tasks
                      start with task_id = x_task_id
                      connect by prior task_id = parent_task_id)
   and   a.resource_assignment_id = l.resource_assignment_id
   and   NVL(a.RESOURCE_ASSIGNMENT_TYPE,'USER_ENTERED') = 'USER_ENTERED';
Line: 3607

   select SUM(DECODE(a.TRACK_AS_LABOR_FLAG,'Y',NVL(l.QUANTITY,0),0)),
          SUM(NVL(l.RAW_COST,0)),
          SUM(NVL(l.BURDENED_COST,0)),
          SUM(NVL(l.REVENUE,0))
   from pa_budget_lines l,
        pa_resource_assignments a
   where v_rollup_flag = 'L'                      -- Lowest Task Level
   and   a.budget_version_id = x_budget_version_id
   and   a.task_id = x_task_id
   and   a.resource_assignment_id = l.resource_assignment_id
   and   NVL(a.RESOURCE_ASSIGNMENT_TYPE, 'USER_ENTERED') = 'USER_ENTERED';
Line: 3699

   select currency_uom_flag
   from pa_currency_uom_v
   where uom_code = x_uom_code;
Line: 3728

   select budget_amount_code
   from pa_budget_types
   where budget_type_code = x_budget_type_code;
Line: 3809

      SELECT b.approved_cost_plan_type_flag, b.approved_rev_plan_type_flag
      INTO   l_cost_flag, l_rev_flag
      FROM   pa_budget_versions b
      WHERE  b.budget_version_id  = p_budget_version_id;
Line: 3911

          SELECT projfunc_currency_code
                 , project_currency_code
                 , projfunc_currency_code
          INTO pa_budget_utils.G_projfunc_currency_code
               , pa_budget_utils.G_project_currency_code
               , pa_budget_utils.G_txn_currency_code
          FROM    pa_projects_all
          WHERE project_id = p_project_id;
Line: 4013

            SELECT 'Y'
            INTO   l_dummy
            FROM   dual
            WHERE  EXISTS (select '1'
                         from pa_budget_versions v
                         where v.project_id = p_project_id
                         and   v.budget_type_code IN ('AC','AR')
                         );
Line: 4046

               SELECT o.fin_plan_type_id, v.version_type
               INTO   l_ac_plan_type_id, l_ac_version_type
               FROM   pa_proj_fp_options o
                      , pa_budget_versions v
               WHERE  o.fin_plan_version_id = v.budget_version_id
               AND    v.approved_cost_plan_type_flag = 'Y'
               AND    v.current_flag = 'Y'
               AND    v.project_id = p_project_id;
Line: 4066

               SELECT o.fin_plan_type_id, v.version_type
               INTO   l_ar_plan_type_id, l_ar_version_type
               FROM   pa_proj_fp_options o
               , pa_budget_versions v
               WHERE  o.fin_plan_version_id = v.budget_version_id
               AND    v.approved_rev_plan_type_flag = 'Y'
               AND    v.current_flag = 'Y'
               AND    v.project_id = p_project_id;
Line: 4155

        SELECT 1
          INTO dummy
          FROM dual
         WHERE EXISTS( SELECT 1
                         FROM pa_budget_versions pbv,
                              pa_resource_lists  prl
                        WHERE (pbv.budget_type_code = 'AR' OR -- old model
                               pbv.budget_type_code IS NULL AND
                               approved_rev_plan_type_flag = 'Y') -- new model
                          AND pbv.ci_id is null -- filter change order versions
                          AND pbv.resource_list_id = prl.resource_list_id
                          AND prl.uncategorized_flag <> 'Y'
                          AND pbv.project_id = x_project_id );
Line: 4238

        SELECT org_id
        INTO   l_org_id
        FROM   pa_projects_all
        WHERE  project_id = p_project_id;