DBA Data[Home] [Help]

APPS.PSB_WS_ACCT2 SQL Statements

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

Line: 9

  SELECT account_position_set_id,
         effective_start_date,
         effective_end_date
  FROM   psb_set_relations_v
  WHERE  account_or_position_type = 'A'
  AND    budget_group_id          = budgetgroup_id ;
Line: 19

  SELECT budget_group_id,
         num_proposed_years
  FROM   psb_budget_groups
  WHERE  budget_group_type    = 'R'
  AND    effective_start_date <= PSB_WS_ACCT1.g_startdate_pp
  AND    ( effective_end_date is null or effective_end_date >=
           PSB_WS_ACCT1.g_enddate_cy )
  START  WITH budget_group_id      = budgetgroup_id
  CONNECT BY prior budget_group_id = parent_budget_group_id;
Line: 211

    select purch_encumbrance_type_id, req_encumbrance_type_id
      from financials_system_parameters;
Line: 220

  l_Start_date_tbl.delete;
Line: 221

  l_end_date_tbl.delete;
Line: 222

  l_period_amount_tbl.delete;
Line: 226

  l_fwd_bal_amt_tbl.delete;
Line: 910

    SELECT code_combination_id
    FROM psb_budget_accounts
    WHERE account_position_set_id = AcctsetId;
Line: 1147

	        SELECT 'TRUE', start_date_active, end_date_active
		INTO lt_valid_ccid, lt_start_date_active, lt_end_date_active
		FROM gl_code_combinations
		WHERE code_combination_id = l_ccids.ccid(l_ccid_index)
		AND enabled_flag = 'Y'
		AND detail_budgeting_allowed_flag = 'Y';
Line: 1180

	  GL_CODE_COMBINATIONS_PKG.Select_Columns
	  ( X_code_combination_id => l_ccids.ccid(l_ccid_index) ,
	    X_account_type        => l_account_type             ,
	    X_template_id         => l_template_id              ) ;
Line: 1688

 |                     PROCEDURE Update_CY_Estimates                         |
 +===========================================================================*/
--
-- This API updates CY estimates amounts. It copies actuals from CY Actual
-- balances upto GL cutoff date and then spreads 'CY Estimates - CY Actuals'
-- over post GL cutoff periods.
--
PROCEDURE Update_CY_Estimates
( p_return_status       OUT  NOCOPY  VARCHAR2,
  p_worksheet_id        IN           NUMBER,
  p_service_package_id  IN           NUMBER,
  p_rounding_factor     IN           NUMBER,
  p_start_stage_seq     IN           NUMBER,
  p_budget_group_id     IN           NUMBER,
  p_stage_set_id        IN           NUMBER,
  p_budget_year_id      IN           NUMBER,
  p_ccid                IN           NUMBER,
  p_currency_code       IN           VARCHAR2
)
IS
  --
  l_return_status       VARCHAR2(1);
Line: 1727

    SELECT ytd_amount,
           period1_amount,  period2_amount,  period3_amount,  period4_amount,
           period5_amount,  period6_amount,  period7_amount,  period8_amount,
           period9_amount,  period10_amount, period11_amount, period12_amount,
           period13_amount, period14_amount, period15_amount, period16_amount,
           period17_amount, period18_amount, period19_amount, period20_amount,
           period21_amount, period22_amount, period23_amount, period24_amount,
           period25_amount, period26_amount, period27_amount, period28_amount,
           period29_amount, period30_amount, period31_amount, period32_amount,
           period33_amount, period34_amount, period35_amount, period36_amount,
           period37_amount, period38_amount, period39_amount, period40_amount,
           period41_amount, period42_amount, period43_amount, period44_amount,
           period45_amount, period46_amount, period47_amount, period48_amount,
           period49_amount, period50_amount, period51_amount, period52_amount,
           period53_amount, period54_amount, period55_amount, period56_amount,
           period57_amount, period58_amount, period59_amount, period60_amount
      FROM PSB_WS_ACCOUNT_LINES a
     WHERE template_id IS NULL
       AND position_line_id IS NULL
       AND currency_code = p_currency_code
       AND p_start_stage_seq BETWEEN start_stage_seq AND current_stage_seq
       AND balance_type = 'A'
       AND EXISTS
          (SELECT 1
             FROM PSB_WS_LINES b
            WHERE b.account_line_id = a.account_line_id
              AND b.worksheet_id = p_worksheet_id)
       AND stage_set_id        = p_stage_set_id
       AND service_package_id  = p_service_package_id
       AND budget_year_id      = p_budget_year_id
       AND budget_group_id     = p_budget_group_id
       AND code_combination_id = p_ccid;
Line: 1761

    SELECT code_combination_id,ytd_amount,
           period1_amount, period2_amount, period3_amount, period4_amount,
           period5_amount, period6_amount, period7_amount, period8_amount,
           period9_amount, period10_amount, period11_amount, period12_amount,
           period13_amount, period14_amount, period15_amount, period16_amount,
           period17_amount, period18_amount, period19_amount, period20_amount,
           period21_amount, period22_amount, period23_amount, period24_amount,
           period25_amount, period26_amount, period27_amount, period28_amount,
           period29_amount, period30_amount, period31_amount, period32_amount,
           period33_amount, period34_amount, period35_amount, period36_amount,
           period37_amount, period38_amount, period39_amount, period40_amount,
           period41_amount, period42_amount, period43_amount, period44_amount,
           period45_amount, period46_amount, period47_amount, period48_amount,
           period49_amount, period50_amount, period51_amount, period52_amount,
           period53_amount, period54_amount, period55_amount, period56_amount,
           period57_amount, period58_amount, period59_amount, period60_amount
      FROM PSB_WS_ACCOUNT_LINES a
     WHERE template_id IS NULL
       AND position_line_id IS NULL
       AND currency_code = p_currency_code
       AND p_start_stage_seq BETWEEN start_stage_seq AND current_stage_seq
       AND balance_type = 'E'
       AND EXISTS
          (SELECT 1
             FROM PSB_WS_LINES b
            WHERE b.account_line_id = a.account_line_id
              AND b.worksheet_id = p_worksheet_id)
       AND stage_set_id        = p_stage_set_id
       AND service_package_id  = p_service_package_id
       AND budget_year_id      = p_budget_year_id
       AND budget_group_id     = p_budget_group_id
       AND code_combination_id = p_ccid;
Line: 2393

      p_update_cy_estimate => 'Y'
      /* bug end 3996052 */
    ) ;
Line: 2419

                                'Update_CY_Estimates') ;
Line: 2422

END Update_CY_Estimates ;
Line: 2427

 |                     PROCEDURE Update_GL_Balances                          |
 +===========================================================================*/
--
-- API updates CY actuals and budget from GL. It also updated CY estimates as
-- per GL cut off date.
--
PROCEDURE Update_GL_Balances
( p_api_version       IN   NUMBER,
  p_validation_level  IN   NUMBER := FND_API.G_VALID_LEVEL_NONE,
  p_return_status     OUT  NOCOPY  VARCHAR2,
  p_worksheet_id      IN   NUMBER
)
IS
  --
  l_api_name          CONSTANT VARCHAR2(30)     := 'Update_GL_Balances';
Line: 2498

  SELECT a.code_combination_id, b.start_date_active, b.end_date_active
  FROM   psb_budget_accounts  a,
         gl_code_combinations b
  WHERE  a.account_position_set_id = c_account_set_id
  /* Bug 3692601 Start */
  AND b.detail_budgeting_allowed_flag = 'Y'
  /* Bug 3692601 End */
  AND    b.code_combination_id     = a.code_combination_id
  AND    b.enabled_flag            = 'Y' ;
Line: 2511

  SELECT '1'
  FROM   dual
  WHERE  EXISTS
         ( SELECT 1
           FROM   psb_budget_accounts
           WHERE  code_combination_id     = c_code_combination_id
           AND    account_position_set_id = l_ps_set_id ) ;
Line: 2533

    SELECT NVL(budget_by_position, 'N')  budget_by_position,
           stage_set_id                 ,
           current_stage_seq            ,
           budget_version_id            ,
           flex_mapping_set_id          ,
           gl_budget_set_id             ,
           gl_cutoff_period             ,
           include_stat_balance         ,
           include_translated_balance   ,
           include_adjustment_periods   ,
           rounding_factor              ,
           budget_group_id              ,
           budget_calendar_id           ,
           include_gl_commit_balance    ,
           include_gl_oblig_balance     ,
           include_gl_other_balance
    FROM   psb_worksheets_v
    WHERE  worksheet_id = p_worksheet_id
  )
  LOOP
    l_budget_by_position        := l_ws_rec.budget_by_position;
Line: 2615

    SELECT a.service_package_id
    FROM   psb_service_packages a,
           psb_worksheets_v     b
    WHERE  a.base_service_package = 'Y'
    AND    ( a.global_worksheet_id = b.worksheet_id
             OR
             a.global_worksheet_id = b.global_worksheet_id
           )
    AND    b.worksheet_id = p_worksheet_id
  )
  LOOP
    l_service_package_id := l_sp_rec.service_package_id;
Line: 2632

    SELECT NVL(set_of_books_id, root_set_of_books_id)           set_of_books_id,
           NVL(currency_code, root_currency_code)               currency_code,
           NVL(chart_of_accounts_id, root_chart_of_accounts_id) flex_code,
           ps_account_position_set_id
    FROM   psb_budget_groups_v
    WHERE  budget_group_id = l_budget_group_id
  )
  LOOP
    l_set_of_books_id := l_bg_rec.set_of_books_id;
Line: 2649

    SELECT name, enable_budgetary_control_flag
    FROM   gl_sets_of_books
    WHERE  set_of_books_id = l_set_of_books_id
  )
  LOOP
    l_set_of_books_name := l_sob_rec.name;
Line: 2875

	  GL_CODE_COMBINATIONS_PKG.Select_Columns
	  ( X_code_combination_id => l_ccids.ccid(l_ccid_index) ,
	    X_account_type        => l_account_type             ,
	    X_template_id         => l_template_id              ) ;
Line: 2918

                g_alloc_periods.DELETE;
Line: 3037

                  Update_CY_Estimates
                  ( p_return_status      => l_return_status,
                    p_worksheet_id       => p_worksheet_id,
                    p_service_package_id => l_service_package_id,
                    p_rounding_factor    => l_rounding_factor,
                    p_start_stage_seq    => l_current_stage_seq,
                    p_budget_group_id    => c_BudGrp_Rec.budget_group_id,
                    p_stage_set_id       => l_stage_set_id,
                    p_budget_year_id     =>
                      PSB_WS_ACCT1.g_budget_years(l_year_index).budget_year_id,
                    p_ccid               => l_ccids.ccid(l_ccid_index),
                    p_currency_code      => l_func_currency
                  ) ;
Line: 3164

END Update_GL_Balances;
Line: 3198

    select nvl(a.ytd_amount, 0) YTD_Amount
      from PSB_WS_ACCOUNT_LINES a
     where a.code_combination_id = l_mapped_ccid
       and a.currency_code = p_currency_code
       and a.balance_type = p_balance_type
       and a.service_package_id = p_service_package_id
       and a.end_stage_seq is null
       and a.template_id is null
       and exists
	  (select 1
	     from PSB_WORKSHEETS b,
		  PSB_BUDGET_PERIODS c
	    where b.worksheet_id = p_worksheet_id
	      and a.stage_set_id = b.stage_set_id
	      and b.current_stage_seq between a.start_stage_seq and a.current_stage_seq
	      and c.budget_calendar_id = p_budget_calendar_id
	      and a.budget_year_id = c.budget_period_id
	      and c.budget_period_type = 'Y'
	      and c.budget_year_type_id = p_budget_year_type_id)
       and exists
	  (select 1
	     from PSB_WS_LINES
	    where account_line_id = a.account_line_id
	      and worksheet_id = p_worksheet_id);
Line: 3226

    select sum(nvl(a.ytd_amount, 0)) YTD_Amount
      from PSB_WORKSHEETS b,
	   PSB_WS_LINES d,
	   PSB_WS_ACCOUNT_LINES a,
	   PSB_BUDGET_PERIODS c
     where b.worksheet_id = p_worksheet_id
       and d.worksheet_id = b.worksheet_id
       and d.account_line_id = a.account_line_id
       and a.code_combination_id = l_mapped_ccid
       and a.balance_type = p_balance_type
       and a.currency_code = p_currency_code
       and a.service_package_id = p_service_package_id
       and a.end_stage_seq is null
       and a.template_id is null
       and a.stage_set_id = b.stage_set_id
       and b.current_stage_seq between a.start_stage_seq and a.current_stage_seq
       and c.budget_calendar_id = p_budget_calendar_id
       and a.budget_year_id = c.budget_period_id
       and c.budget_period_type = 'Y'
       and c.budget_year_type_id = p_budget_year_type_id;              */
Line: 3264

  FOR l_budget_period_rec IN (select budget_period_id
       						  from psb_budget_periods
       						  where budget_calendar_id = p_budget_calendar_id
                              and budget_period_type = 'Y'
                              and parent_budget_period_id is null
                              and budget_year_type_id = p_budget_year_type_id)
  LOOP
    l_budget_year_id := l_budget_period_rec.budget_period_id;
Line: 3275

  SELECT
    SUM(NVL(A.YTD_AMOUNT, 0)) YTD_AMOUNT
  INTO
    l_ytd_amount
  FROM
    PSB_WS_LINES WSL
  , PSB_WS_ACCOUNT_LINES A
  WHERE A.CODE_COMBINATION_ID = l_mapped_ccid
  AND   A.BUDGET_YEAR_ID = l_budget_year_id
  AND   A.SERVICE_PACKAGE_ID = p_service_package_id
  AND   A.BALANCE_TYPE = p_balance_type
  AND   A.CURRENCY_CODE = p_currency_code
  AND   A.END_STAGE_SEQ IS NULL
  AND   A.TEMPLATE_ID IS NULL
  AND   A.STAGE_SET_ID = p_stage_set_id
  AND   p_current_stage_seq
  BETWEEN A.START_STAGE_SEQ AND A.CURRENT_STAGE_SEQ
  AND   WSL.WORKSHEET_ID = p_worksheet_id
  AND   WSL.ACCOUNT_LINE_ID = A.ACCOUNT_LINE_ID;
Line: 3332

    select step_number,
	   prefix_operator,
	   budget_year_type_id,
	   balance_type,
	   segment1, segment2, segment3,
	   segment4, segment5, segment6,
	   segment7, segment8, segment9,
	   segment10, segment11, segment12,
	   segment13, segment14, segment15,
	   segment16, segment17, segment18,
	   segment19, segment20, segment21,
	   segment22, segment23, segment24,
	   segment25, segment26, segment27,
	   segment28, segment29, segment30,
	   currency_code,
	   nvl(amount, 0) amount,
	   postfix_operator
      from PSB_PARAMETER_FORMULAS
     where parameter_id = p_parameter_id
     order by step_number;
Line: 3988

    select 'Exists'
      from PSB_ENTITY a
     where entity_id = p_parameter_id
       and exists
	  (select 1
	     from PSB_SET_RELATIONS b,
		  PSB_BUDGET_ACCOUNTS c
	    where b.account_position_set_id = c.account_position_set_id
	      and b.parameter_id = p_parameter_id
	      and c.code_combination_id = p_ccid)
       and a.entity_subtype = 'ACCOUNT'
       and (((a.effective_start_date <= p_year_end_date)
	 and (a.effective_end_date is null))
	 or ((a.effective_start_date between p_year_start_date and p_year_end_date)
	  or (a.effective_end_date between p_year_start_date and p_year_end_date)
	  or ((effective_start_date < p_year_start_date)
	  and (effective_end_date > p_year_end_date))));
Line: 4071

    select a.budget_group_id, a.budget_calendar_id, a.flex_mapping_set_id,
	   a.budget_by_position, nvl(b.chart_of_accounts_id, b.root_chart_of_accounts_id) chart_of_accounts_id,
           a.gl_cutoff_period,
	   /* bug no 4256345 */
           a.stage_set_id,
           a.current_stage_seq
           /* bug no 4256345 */
      from PSB_WORKSHEETS_V a,
	   PSB_BUDGET_GROUPS_V b
     where a.worksheet_id = p_worksheet_id
       and b.budget_group_id = a.budget_group_id;
Line: 4084

    select name,
	   currency_code,
	   effective_start_date,
	   effective_end_date,
	   parameter_compound_annually
      from PSB_ENTITY
     where entity_id = p_parameter_id
       and entity_subtype = 'ACCOUNT';
Line: 4097

    select b.account_line_id,
           b.code_combination_id,
           b.service_package_id,
           b.budget_group_id,
           b.budget_year_id,
           b.currency_code,
	   c.start_date,
           c.end_date,
           b.note_id,
           d.year_category_type,
           c.name -- Bug#4571412
      FROM PSB_WS_LINES a,
           PSB_WS_ACCOUNT_LINES b,
           PSB_BUDGET_PERIODS c,
           PSB_BUDGET_YEAR_TYPES d
     WHERE a.worksheet_id        = p_worksheet_id
       AND b.account_line_id     = a.account_line_id
       AND b.end_stage_seq is null
       AND b.balance_type        = 'E'
       AND b.template_id is null
       AND c.budget_period_id    = b.budget_year_id
       AND c.budget_year_type_id = d.budget_year_type_id
       AND c.budget_period_type  = 'Y'
  ORDER BY b.code_combination_id,
           b.budget_year_id;
Line: 4415

    select nvl(allocrule_set_id, global_allocrule_set_id) allocrule_set_id,
	   flex_mapping_set_id,
	   parameter_set_id,
	   budget_calendar_id,
	   rounding_factor,
	   gl_cutoff_period,
	   num_years_to_allocate,
	   budget_by_position
      from PSB_WORKSHEETS_V
     where worksheet_id = p_worksheet_id;
Line: 4428

    select nvl(currency_code, root_currency_code) currency_code,
	   nvl(chart_of_accounts_id, root_chart_of_accounts_id) chart_of_accounts_id
      from PSB_BUDGET_GROUPS_V
     where budget_group_id = p_budget_group_id;
Line: 4441

    select parameter_id,
           name,
           priority,
           currency_code,
           effective_start_date,
           parameter_compound_annually
      from PSB_PARAMETER_ASSIGNMENTS_V a
     where exists
           (select 1
            from   PSB_SET_RELATIONS b,
                   PSB_BUDGET_ACCOUNTS c
            where  b.account_position_set_id = c.account_position_set_id
                   and b.parameter_id = a.parameter_id
                   and c.code_combination_id = p_ccid
           )
           and parameter_type = 'ACCOUNT'
           and ( ( effective_start_date
                   <= nvl(p_ccid_end_period, Year_End_Date)
                   and effective_end_date is null
                 )
                 or ( ( effective_start_date
                        between nvl(p_ccid_start_period, Year_Start_Date)
                        and nvl(p_ccid_end_period, Year_End_Date)
                      )
                      or
                      ( effective_end_date
                        between nvl(p_ccid_start_period, Year_Start_Date)
                        and nvl(p_ccid_end_period, Year_End_Date)
                      )
                      or
                      ( effective_start_date
                        < nvl(p_ccid_start_period, Year_Start_Date)
                      and
                      effective_end_date
                      > nvl(p_ccid_end_period, Year_End_Date)
                    )
                 )
               )
           and ( ( effective_start_date <= Year_End_Date
                   and effective_end_date is null)
                 or
                 ( ( effective_start_date
                     between Year_Start_Date and Year_End_Date
                   )
                   or ( effective_end_date
                        between Year_Start_Date and Year_End_Date
                      )
                   or ( effective_start_date < Year_Start_Date
                        and effective_end_date > Year_End_Date
                      )
                 )
               )
           and parameter_set_id = l_parameter_set_id
     order by effective_start_date, priority;
Line: 4548

      SELECT DECODE(global_worksheet_flag, 'Y', worksheet_id,
                    global_worksheet_id) global_worksheet_id
           INTO
             l_global_worksheet_id
      FROM   psb_worksheets
      WHERE  worksheet_id = p_worksheet_id;
Line: 4555

      SELECT gl_cutoff_period,
             allocrule_set_id allocrule_set_id,
             budget_calendar_id,
             rounding_factor,
             flex_mapping_set_id,
             parameter_set_id,
             num_years_to_allocate,
             budget_by_position
           INTO
             l_gl_cutoff_period,
             l_allocrule_set_id,
             l_budget_calendar_id,
             l_rounding_factor,
             l_flex_mapping_set_id,
             l_parameter_set_id,
             l_num_years_to_allocate,
             l_budget_by_position
      FROM   psb_worksheets
      WHERE  worksheet_id = l_global_worksheet_id;
Line: 5447

  l_ccid_insert            BOOLEAN;
Line: 5470

    l_ccid_insert := FALSE;
Line: 5588

	      l_ccid_insert := TRUE;
Line: 5599

	    l_ccid_insert := TRUE;
Line: 5612

    if l_ccid_insert then

      g_num_sortccids := g_num_sortccids + 1;
Line: 5720

    select pea.entity_id as allocrule_id,
           pe.budget_year_type_id,
           pe.balance_type
      from PSB_ENTITY_ASSIGNMENT pea, PSB_ENTITY pe
     where pe.entity_type = 'ALLOCRULE'
           and pe.entity_id = pea.entity_id
           and exists
               (select 1
                  from PSB_SET_RELATIONS b,
                       PSB_BUDGET_ACCOUNTS c
                 where b.account_position_set_id = c.account_position_set_id
                       and b.allocation_rule_id = pea.entity_id
                       and c.code_combination_id = p_ccid)
           and pe.entity_subtype = 'ACCOUNT'
           and pe.allocation_type = NVL(p_allocation_type,allocation_type)
           and (((pea.effective_start_date <= p_effective_end_date)
                 and (pea.effective_end_date is null))
                or ((pea.effective_start_date
                     between p_effective_start_date
                             and p_effective_end_date)
                    or (pea.effective_end_date
                        between p_effective_start_date
                                and p_effective_end_date)
                    or ((pea.effective_start_date < p_effective_start_date)
                    and (pea.effective_end_date > p_effective_end_date))))
           and pea.entity_set_id = p_allocrule_set_id
     order by pea.effective_start_date,
              pea.priority;
Line: 5751

    select period_num,
	   percent
      from PSB_ALLOCRULE_PERCENTS
     where number_of_periods = Num_Periods
       and allocation_rule_id = AllocRule_ID
     order by period_num;
Line: 5760

    SELECT year_category_type
      FROM PSB_BUDGET_YEAR_TYPES
     WHERE budget_year_type_id = p_budget_year_type_id;
Line: 5974

	sql_alloc := 'select ';
Line: 5989

			  '(select 1 ' ||
			     'from PSB_WS_LINES ' ||
			    'where account_line_id = a.account_line_id ' ||
			      'and worksheet_id = ' || p_worksheet_id || ') ' ||
		      'and exists ' ||
			  '(select 1 ' ||
			     'from PSB_BUDGET_PERIODS b ' ||
			    'where b.budget_calendar_id = ' || p_budget_calendar_id || ' ' ||
			      'and b.budget_year_type_id = ' || c_AllocRule_Rec.budget_year_type_id || ' ' ||
			      'and a.budget_year_id = b.budget_period_id)';
Line: 6165

    select period1_amount, period2_amount, period3_amount, period4_amount,
	   period5_amount, period6_amount, period7_amount, period8_amount,
	   period9_amount, period10_amount, period11_amount, period12_amount,
	   period13_amount, period14_amount, period15_amount, period16_amount,
	   period17_amount, period18_amount, period19_amount, period20_amount,
	   period21_amount, period22_amount, period23_amount, period24_amount,
	   period25_amount, period26_amount, period27_amount, period28_amount,
	   period29_amount, period30_amount, period31_amount, period32_amount,
	   period33_amount, period34_amount, period35_amount, period36_amount,
	   period37_amount, period38_amount, period39_amount, period40_amount,
	   period41_amount, period42_amount, period43_amount, period44_amount,
	   period45_amount, period46_amount, period47_amount, period48_amount,
	   period49_amount, period50_amount, period51_amount, period52_amount,
	   period53_amount, period54_amount, period55_amount, period56_amount,
	   period57_amount, period58_amount, period59_amount, period60_amount,
/* Bug No 2354918 Start */
	   budget_year_id
/* Bug No 2354918 End */
      from PSB_WS_ACCOUNT_LINES
     where account_line_id = p_account_line_id;
Line: 7656

PROCEDURE Insert_Summary_Accounts
( p_return_status       OUT  NOCOPY  VARCHAR2,
  p_worksheet_id        IN   NUMBER,
  p_rounding_factor     IN   NUMBER,
  p_stage_set_id        IN   NUMBER,
  p_current_stage_seq   IN   NUMBER,
  p_set_of_books_id     IN   NUMBER,
  p_flex_code           IN   NUMBER,
  p_budget_group_id     IN   NUMBER,
  p_budget_calendar_id  IN   NUMBER
) IS

  first_time            BOOLEAN;
Line: 7697

  l_api_name       CONSTANT  VARCHAR2(30) := 'Insert_Summary_Accounts';
Line: 7708

    select a.summary_code_combination_id,
	   a.template_id,
	   b.service_package_id,
	   b.start_stage_seq,
	   b.budget_year_id,
	   b.currency_code,
	   b.balance_type,
	   sum(nvl(b.annual_fte, 0)) annual_fte,
	   sum(nvl(b.ytd_amount, 0)) ytd_amount,
	   sum(nvl(b.period1_amount, 0)) p1_amt,
	   sum(nvl(b.period2_amount, 0)) p2_amt,
	   sum(nvl(b.period3_amount, 0)) p3_amt,
	   sum(nvl(b.period4_amount, 0)) p4_amt,
	   sum(nvl(b.period5_amount, 0)) p5_amt,
	   sum(nvl(b.period6_amount, 0)) p6_amt,
	   sum(nvl(b.period7_amount, 0)) p7_amt,
	   sum(nvl(b.period8_amount, 0)) p8_amt,
	   sum(nvl(b.period9_amount, 0)) p9_amt,
	   sum(nvl(b.period10_amount, 0)) p10_amt,
	   sum(nvl(b.period11_amount, 0)) p11_amt,
	   sum(nvl(b.period12_amount, 0)) p12_amt
      from GL_ACCOUNT_HIERARCHIES a,
	   PSB_WS_ACCOUNT_LINES b,
	   PSB_SUMMARY_TEMPLATES c
     where a.detail_code_combination_id = b.code_combination_id
       and a.template_id = c.template_id
       and a.ledger_id       = p_set_of_books_id
       and p_current_stage_seq between b.start_stage_seq and b.current_stage_seq
       and b.template_id is null
       and c.set_of_books_id = p_set_of_books_id
       and exists
	  (select 1
	     from PSB_BUDGET_GROUPS f
	    where f.budget_group_id = b.budget_group_id
	      and (f.budget_group_id = p_budget_group_id or f.root_budget_group_id = p_budget_group_id))
       and exists
	  (select 1
	     from PSB_WS_LINES
	    where account_line_id = b.account_line_id
	      and worksheet_id = p_worksheet_id)
       and exists
	  (select 1
	     from PSB_BUDGET_PERIODS d
	    where d.budget_calendar_id = p_budget_calendar_id
	      and d.budget_period_type = 'Y'
	      and d.start_date >= c.effective_start_date
	      and b.budget_year_id = d.budget_period_id)
     group by a.summary_code_combination_id,
	      a.template_id,
	      b.service_package_id,
	      b.start_stage_seq,
	      b.budget_year_id,
	      b.currency_code,
	      b.balance_type;
Line: 7769

    select distinct a.budget_group_id
      from PSB_WS_ACCOUNT_LINES a,
	   GL_ACCOUNT_HIERARCHIES b
     where p_current_stage_seq between a.start_stage_seq and a.current_stage_seq
       and a.code_combination_id = b.detail_code_combination_id
       and a.budget_year_id = YearID
       /*For Bug No : 2586618 Start*/
       and a.template_id is null
       and exists (select 1
		     from PSB_WS_LINES
		    where account_line_id = a.account_line_id
		      and worksheet_id = p_worksheet_id)
       /*For Bug No : 2586618 End*/
       and b.summary_code_combination_id = SumCCID
       and b.template_id = TemplateID;
Line: 7842

	sql_sumbgroup := 'select parent_budget_group_id, ' ||
				'root_budget_group ' ||
			   'from psb_budget_groups ' ||
			  'where budget_group_id = :budget_group_id';
Line: 8017

END Insert_Summary_Accounts;
Line: 8057

    select budget_group_id,
	   stage_set_id,
	   current_stage_seq,
	   budget_calendar_id,
	   rounding_factor
      from PSB_WORKSHEETS
     where worksheet_id = p_worksheet_id;
Line: 8066

    select nvl(set_of_books_id, root_set_of_books_id) set_of_books_id,
	   nvl(chart_of_accounts_id, root_chart_of_accounts_id) chart_of_accounts_id
      from PSB_BUDGET_GROUPS_V
     where budget_group_id = l_budget_group_id;
Line: 8086

  PSB_WORKSHEET.Delete_Summary_Lines
     (p_api_version => 1.0,
      p_return_status => l_return_status,
      p_worksheet_id => p_worksheet_id);
Line: 8155

  Insert_Summary_Accounts
	(p_worksheet_id => p_worksheet_id,
	 p_rounding_factor => l_rounding_factor,
	 p_stage_set_id => l_stage_set_id,
	 p_current_stage_seq => l_current_stage_seq,
	 p_set_of_books_id => l_set_of_books_id,
	 p_flex_code => l_flex_code,
	 p_budget_group_id => l_budget_group_id,
	 p_budget_calendar_id => l_budget_calendar_id,
	 p_return_status => l_return_status);
Line: 8212

  SELECT code_combination_id
  FROM  psb_budget_accounts a,
        psb_set_relations r,
        psb_gl_budgets b,
        psb_gl_budget_sets c
  WHERE c.gl_budget_set_id  = p_gl_budget_set_id
  AND   c.gl_budget_set_id = b.gl_budget_set_id
  AND   b.gl_budget_id = r.gl_budget_id
  AND   r.account_position_set_id = a.account_position_set_id;
Line: 8233

    g_ws_gl_budget_set_ccids.delete;
Line: 8238

    l_ws_gl_budget_set_ccids.DELETE;