DBA Data[Home] [Help]

APPS.FA_WHATIF_DEPRN_PKG SQL Statements

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

Line: 149

    select cp.period_name period_name
         , cp.period_num period_num
         , fy.fiscal_year fiscal_year
    from   fa_fiscal_year fy
         , fa_calendar_periods cp
    where  fy.fiscal_year_name = fa_cache_pkg.fazcbc_record.fiscal_year_name
    and    cp.calendar_type = fa_cache_pkg.fazcbc_record.deprn_calendar
    and    cp.start_date between fy.start_date and fy.end_date
    and    l_st_period_counter <= fy.fiscal_year * fa_cache_pkg.fazcct_record.NUMBER_PER_FISCAL_YEAR + cp.PERIOD_NUM
    and l_ed_period_counter >= fy.fiscal_year * fa_cache_pkg.fazcct_record.NUMBER_PER_FISCAL_YEAR + cp.PERIOD_NUM
    order by fiscal_year, period_num;
Line: 173

      select sysdate into h_current_time from dual;
Line: 187

               SELECT decode (mt.rate_source_rule,
                                    'CALCULATED', bk.prorate_date,
                                    'FORMULA',    bk.prorate_date,
                                    'TABLE',      bk.deprn_start_date,
                                    'FLAT',       decode (mt.deprn_basis_rule,
                                                            'COST',  bk.prorate_date,
                                                             'NBV',  bk.deprn_start_date),
                                    'PROD',       bk.date_placed_in_service),
                      to_number (to_char (bk.prorate_date, 'J')),
                      to_number (to_char (bk.date_placed_in_service, 'J')),
                      to_number (to_char (bk.deprn_start_date, 'J')),
                      decode(mt.rate_source_rule, 'FLAT', bk.life_in_months,
                                                          nvl(bk.life_in_months, 0)),
                      bk.recoverable_cost,
                      bk.adjusted_cost,
                      bk.cost,
                      nvl(bk.reval_amortization_basis, 0),
                      bk.rate_adjustment_factor,
                      nvl(bk.adjusted_rate, 0),
                      bk.ceiling_name,
                      bk.bonus_rule,
                      nvl (bk.production_capacity, 0),
                      nvl (bk.adjusted_capacity, 0),
                      mt.method_code,
                      ad.asset_number,
                      nvl (bk.adjusted_recoverable_cost, bk.recoverable_cost),
                      bk.salvage_value,
                      bk.period_counter_life_complete,
                      bk.adjustment_required_status,
                      bk.annual_deprn_rounding_flag,
                      bk.itc_amount_id,
                      bk.itc_basis,
                      ceilt.ceiling_type,
                      nvl(bk.formula_factor, 1),
                      nvl(bk.short_fiscal_year_flag, 'NO'),
                      bk.conversion_date,
                      bk.original_deprn_start_date,
                      bk.prorate_date
                    , ad.asset_type
               INTO   h_dpr_date,
                      dpr_in.prorate_jdate,
                      dpr_in.jdate_in_service,
                      dpr_in.deprn_start_jdate,
                      dpr_in.life,
                      dpr_in.rec_cost,
                      dpr_in.adj_cost,
                      h_current_cost,
                      dpr_in.reval_amo_basis,
                      dpr_in.rate_adj_factor,
                      dpr_in.adj_rate,
                      dpr_in.ceil_name,
                      dpr_in.bonus_rule,
                      dpr_in.capacity,
                      dpr_in.adj_capacity,
                      dpr_in.method_code,
                      dpr_in.asset_num,
                      dpr_in.adj_rec_cost,
                      dpr_in.salvage_value,
                      dpr_in.pc_life_end,
                      l_adjustment_required_status,
                      dpr_in.deprn_rounding_flag,
                      h_itc_amount_id,
                      h_itc_basis,
                      h_ceiling_Type,
                      dpr_in.formula_factor,
                      dpr_in.short_fiscal_year_flag,
                      dpr_in.conversion_date,
                      dpr_in.orig_deprn_start_date,
                      dpr_in.prorate_date
                    , dpr_in.asset_type
               FROM   fa_ceiling_types ceilt,
                      fa_methods mt,
                      fa_category_books cb,
                      fa_books bk,
                      fa_additions_b ad
               WHERE  cb.book_type_code = X_book
               AND    ad.asset_category_id = cb.category_id
               AND    ceilt.ceiling_name(+) = bk.ceiling_name
               AND    mt.method_code = bk.deprn_method_code
               AND    bk.book_type_code = X_book
               AND    bk.asset_id = X_asset_id
               AND    bk.transaction_header_id_out is null
               AND    nvl (mt.life_in_months, -9999) = nvl (bk.life_in_months, -9999)
               AND    ad.asset_id = bk.asset_id;
Line: 274

               SELECT decode (mt.rate_source_rule,
                                    'CALCULATED', bk.prorate_date,
                                    'FORMULA',    bk.prorate_date,
                                    'TABLE',      bk.deprn_start_date,
                                    'FLAT',       decode (mt.deprn_basis_rule,
                                                            'COST',  bk.prorate_date,
                                                             'NBV',  bk.deprn_start_date),
                                    'PROD',       bk.date_placed_in_service),
                      to_number (to_char (bk.prorate_date, 'J')),
                      to_number (to_char (bk.date_placed_in_service, 'J')),
                      to_number (to_char (bk.deprn_start_date, 'J')),
                      decode(mt.rate_source_rule, 'FLAT', bk.life_in_months,
                                                          nvl(bk.life_in_months, 0)),
                      bk.recoverable_cost,
                      bk.adjusted_cost,
                      bk.cost,
                      nvl(bk.reval_amortization_basis, 0),
                      bk.rate_adjustment_factor,
                      nvl(bk.adjusted_rate, 0),
                      bk.ceiling_name,
                      bk.bonus_rule,
                      nvl (bk.production_capacity, 0),
                      nvl (bk.adjusted_capacity, 0),
                      mt.method_code,
                      ad.asset_number,
                      nvl (bk.adjusted_recoverable_cost, bk.recoverable_cost),
                      bk.salvage_value,
                      bk.period_counter_life_complete,
                      bk.adjustment_required_status,
                      bk.annual_deprn_rounding_flag,
                      bk.itc_amount_id,
                      bk.itc_basis,
                      ceilt.ceiling_type,
                      nvl(bk.formula_factor, 1),
                      nvl(bk.short_fiscal_year_flag, 'NO'),
                      bk.conversion_date,
                      bk.original_deprn_start_date,
                      bk.prorate_date
                    , ad.asset_type
               INTO   h_dpr_date,
                      dpr_in.prorate_jdate,
                      dpr_in.jdate_in_service,
                      dpr_in.deprn_start_jdate,
                      dpr_in.life,
                      dpr_in.rec_cost,
                      dpr_in.adj_cost,
                      h_current_cost,
                      dpr_in.reval_amo_basis,
                      dpr_in.rate_adj_factor,
                      dpr_in.adj_rate,
                      dpr_in.ceil_name,
                      dpr_in.bonus_rule,
                      dpr_in.capacity,
                      dpr_in.adj_capacity,
                      dpr_in.method_code,
                      dpr_in.asset_num,
                      dpr_in.adj_rec_cost,
                      dpr_in.salvage_value,
                      dpr_in.pc_life_end,
                      l_adjustment_required_status,
                      dpr_in.deprn_rounding_flag,
                      h_itc_amount_id,
                      h_itc_basis,
                      h_ceiling_Type,
                      dpr_in.formula_factor,
                      dpr_in.short_fiscal_year_flag,
                      dpr_in.conversion_date,
                      dpr_in.orig_deprn_start_date,
                      dpr_in.prorate_date
                    , dpr_in.asset_type
               FROM   fa_ceiling_types ceilt,
                      fa_methods mt,
                      fa_category_books cb,
                      fa_books_mrc_v bk,
                      fa_additions_b ad
               WHERE  cb.book_type_code = X_book
               AND    ad.asset_category_id = cb.category_id
               AND    ceilt.ceiling_name(+) = bk.ceiling_name
               AND    mt.method_code = bk.deprn_method_code
               AND    bk.book_type_code = X_book
               AND    bk.asset_id = X_asset_id
               AND    bk.transaction_header_id_out is null
               AND    nvl (mt.life_in_months, -9999) = nvl (bk.life_in_months, -9999)
               AND    ad.asset_id = bk.asset_id;
Line: 373

         SELECT cbd.life_in_months,
      	     cbd.deprn_method,
      	     cbd.prorate_convention_code,
      	     cbd.adjusted_rate,
                cbd.bonus_rule,
      	     cbd.ceiling_name
         INTO   dpr_in.life,
                dpr_in.method_code,
                h_prorate_conv,
                dpr_in.adj_rate,
                dpr_in.bonus_rule,
                dpr_in.ceil_name
         FROM   FA_CATEGORY_BOOK_DEFAULTS cbd
         WHERE  cbd.book_type_code = X_book
         AND    cbd.category_id = X_category_id
         AND    X_dpis BETWEEN CBD.START_DPIS AND
                               NVL(CBD.END_DPIS,TO_DATE('31-12-4712','DD-MM-YYYY'));
Line: 399

         SELECT to_number(to_char(conv.prorate_date,'J'))
         INTO   dpr_in.prorate_jdate
         FROM   fa_conventions conv
         WHERE  conv.prorate_convention_code = h_prorate_conv
         AND    X_dpis between conv.start_date and conv.end_date;
Line: 517

          select category_id, units, asset_type
          into fin_info.category_id, fin_info.units, fin_info.asset_type
          from fa_asset_history
          where asset_id = X_asset_id and date_ineffective is null;
Line: 581

             select count(*) into h_count from fa_methods
             where method_code = X_method_code
             and rate_source_rule in ('TABLE','CALCULATED','FORMULA')
             and rownum < 2;
Line: 655

             select prorate_date into fin_info.prorate_date
             from fa_conventions
             where prorate_convention_code = X_prorate_conv
             and fin_info.date_placed_in_svc between start_date and end_date;
Line: 757

             select least(fin_info.cost - fin_info.salvage_value,
                          nvl(ce.limit, fin_info.cost - fin_info.salvage_value))
             into   fin_info.rec_cost
             from   fa_ceilings ce
             where  ce.ceiling_name = fin_info.ceiling_name
             and    fin_info.date_placed_in_svc
                            between ce.start_date
                                and nvl(ce.end_date, fin_info.date_placed_in_svc);
Line: 768

             select least(fin_info.cost - fin_info.salvage_value -
                        h_itc_basis * ir.basis_reduction_rate,
                        nvl(ce.limit, fin_info.cost - fin_info.salvage_value -
                                      h_itc_basis * ir.basis_reduction_rate))
             into   fin_info.rec_cost
             from   fa_ceilings ce, fa_itc_rates ir
             where  ir.itc_amount_id = h_itc_amount_id
             and    ce.ceiling_name = fin_info.ceiling_name
             and    fin_info.date_placed_in_svc
                            between ce.start_date
                                and nvl(ce.end_date, fin_info.date_placed_in_svc);
Line: 782

             select fin_info.cost - fin_info.salvage_value -
                                     h_itc_basis * ir.basis_reduction_rate
             into   fin_info.rec_cost
             from   fa_itc_rates ir
             where  ir.itc_amount_id = h_itc_amount_id;
Line: 811

          SELECT CBD.USE_DEPRN_LIMITS_FLAG
               , CBD.ALLOWED_DEPRN_LIMIT
               , CBD.SPECIAL_DEPRN_LIMIT_AMOUNT
          INTO   h_use_deprn_limits_flag
               , h_allowed_deprn_limit
               , h_allowed_deprn_limit_amt
          FROM   FA_ADDITIONS_B FAD
               , FA_CATEGORY_BOOK_DEFAULTS CBD
          WHERE  FAD.ASSET_ID = fin_info.asset_id
          AND    CBD.CATEGORY_ID = FAD.ASSET_CATEGORY_ID
          AND    CBD.BOOK_TYPE_CODE = fin_info.book
          AND    fin_info.date_placed_in_svc
                             BETWEEN CBD.START_DPIS
                                 AND NVL(CBD.END_DPIS,TO_DATE('31-12-4712','DD-MM-YYYY'));
Line: 1078

       select cp.period_num
            , fy.fiscal_year
            , cp.start_date
       into   h_start_per_num
            , h_start_per_fy
            , l_cp_start_date
       from fa_calendar_periods cp, fa_fiscal_year fy
       where cp.period_name = X_start_per
       and cp.calendar_type = h_calendar_type
       and cp.start_date >= fy.start_date
       and cp.end_date <= fy.end_date
       and fy.fiscal_year_name = h_fy_name;
Line: 1341

    dpr_arr.delete;
Line: 1356

      g_deprn.delete;
Line: 1374

      g_deprn.delete;
Line: 1389

function whatif_insert_itf (
	X_asset_id	in number,
	X_book		in varchar2,
	X_request_id	in number,
	X_num_pers	in number,
	X_acct_struct   in number,
	X_key_struct	in number,
	X_cat_struct	in number,
	X_loc_struct	in number,
	X_precision	in number,
	X_user_id	in number,
	X_login_id	in number,
        X_last_asset    in boolean default false,
	retcode	 out nocopy number,
	errbuf	 out nocopy varchar2) return boolean is

h_dist_book		fa_book_controls.distribution_source_book%TYPE;
Line: 1460

  Select distribution_source_book
  From fa_book_controls
  Where book_type_code = X_book;
Line: 1466

   select dh.units_assigned, dh.code_combination_id, dh.location_id,
   emp.employee_number, emp.full_name
   from fa_distribution_history dh, per_all_people_f emp
   where emp.person_id (+) = dh.assigned_to
   and  trunc(sysdate) between emp.effective_start_date(+) and emp.effective_end_date(+)
   and dh.book_type_code = h_dist_book
   and dh.asset_id = X_asset_id
   and dh.date_ineffective is null;
Line: 1487

  select description, tag_number, serial_number, asset_number,
	asset_key_ccid, current_units, asset_category_id
  into h_description, h_tag_number, h_serial_number, h_asset_number,
	h_asset_key_id, h_total_units, h_category_id
  from fa_additions
  where asset_id = X_asset_id;
Line: 1500

     select cost, prorate_convention_code, deprn_method_code,
   	life_in_months, basic_rate, adjusted_rate, salvage_value, bonus_rule,
           date_placed_in_service
     into h_current_cost, h_current_prorate_conv, h_current_method,
   	h_current_life, h_current_basic_rate, h_current_adjusted_rate,
   	h_current_salvage_value, h_current_bonus_rule,
           h_current_dpis
     from fa_books
     where asset_id = X_asset_id
     and book_type_code = X_book
     and transaction_header_id_out is null;
Line: 1514

     select cost, prorate_convention_code, deprn_method_code,
           life_in_months, basic_rate, adjusted_rate, salvage_value, bonus_rule,
           date_placed_in_service
     into h_current_cost, h_current_prorate_conv, h_current_method,
           h_current_life, h_current_basic_rate, h_current_adjusted_rate,
           h_current_salvage_value, h_current_bonus_rule,
           h_current_dpis
     from fa_books_mrc_v
     where asset_id = X_asset_id
     and book_type_code = X_book
     and transaction_header_id_out is null;
Line: 1618

      select currency_code
      into h_currency
      from gl_sets_of_books
      where set_of_books_id = FARX_C_WD.sob_id;
Line: 1677

      h_mesg_name := 'FA_SHARED_INSERT_FAIL';
Line: 1705

      t_last_update_date(i)       := sysdate;
Line: 1706

      t_last_updated_by(i)        := X_user_id;
Line: 1707

      t_last_update_login(i)      := X_login_id;
Line: 1735

     INSERT INTO FA_WHATIF_ITF(
                   request_id
                 , book_type_code
                 , asset_id
                 , asset_number
                 , description
                 , tag_number
                 , serial_number
                 , period_name
                 , fiscal_year
                 , expense_acct
                 , location
                 , units
                 , employee_name
                 , employee_number
                 , asset_key
                 , current_cost
                 , current_prorate_conv
                 , current_method
                 , current_life
                 , current_basic_rate
                 , current_adjusted_rate
                 , current_salvage_value
                 , depreciation
                 , new_depreciation
                 , created_by
                 , creation_date
                 , last_update_date
                 , last_updated_by
                 , last_update_login
                 , date_placed_in_service
                 , category
                 , accumulated_deprn
                 , bonus_depreciation
                 , new_bonus_depreciation
                 , current_bonus_rule
                 , period_num
                 , currency_code)
          VALUES(  t_request_id(j)
                 , t_book_type_code(j)
                 , t_asset_id(j)
                 , t_asset_number(j)
                 , t_description(j)
                 , t_tag_number(j)
                 , t_serial_number(j)
                 , t_period_name(j)
                 , t_fiscal_year(j)
                 , t_expense_acct(j)
                 , t_location(j)
                 , t_units(j)
                 , t_employee_name(j)
                 , t_employee_number(j)
                 , t_asset_key(j)
                 , t_current_cost(j)
                 , t_current_prorate_conv(j)
                 , t_current_method(j)
                 , t_current_life(j)
                 , t_current_basic_rate(j)
                 , t_current_adjusted_rate(j)
                 , t_current_salvage_value(j)
                 , t_depreciation(j)
                 , t_new_depreciation(j)
                 , t_created_by(j)
                 , t_creation_date(j)
                 , t_last_update_date(j)
                 , t_last_updated_by(j)
                 , t_last_update_login(j)
                 , t_date_placed_in_service(j)
                 , t_category(j)
                 , t_accumulated_deprn(j)
                 , t_bonus_depreciation(j)
                 , t_new_bonus_depreciation(j)
                 , t_current_bonus_rule(j)
                 , t_period_num(j)
                 , t_currency_code(j));
Line: 1812

     t_request_id.delete;
Line: 1813

     t_book_type_code.delete;
Line: 1814

     t_asset_id.delete;
Line: 1815

     t_asset_number.delete;
Line: 1816

     t_description.delete;
Line: 1817

     t_tag_number.delete;
Line: 1818

     t_serial_number.delete;
Line: 1819

     t_period_name.delete;
Line: 1820

     t_fiscal_year.delete;
Line: 1821

     t_expense_acct.delete;
Line: 1822

     t_location.delete;
Line: 1823

     t_units.delete;
Line: 1824

     t_employee_name.delete;
Line: 1825

     t_employee_number.delete;
Line: 1826

     t_asset_key.delete;
Line: 1827

     t_current_cost.delete;
Line: 1828

     t_current_prorate_conv.delete;
Line: 1829

     t_current_method.delete;
Line: 1830

     t_current_life.delete;
Line: 1831

     t_current_basic_rate.delete;
Line: 1832

     t_current_adjusted_rate.delete;
Line: 1833

     t_current_salvage_value.delete;
Line: 1834

     t_depreciation.delete;
Line: 1835

     t_new_depreciation.delete;
Line: 1836

     t_created_by.delete;
Line: 1837

     t_creation_date.delete;
Line: 1838

     t_last_update_date.delete;
Line: 1839

     t_last_updated_by.delete;
Line: 1840

     t_last_update_login.delete;
Line: 1841

     t_date_placed_in_service.delete;
Line: 1842

     t_category.delete;
Line: 1843

     t_accumulated_deprn.delete;
Line: 1844

     t_bonus_depreciation.delete;
Line: 1845

     t_new_bonus_depreciation.delete;
Line: 1846

     t_current_bonus_rule.delete;
Line: 1847

     t_period_num.delete;
Line: 1848

     t_currency_code.delete;
Line: 1870

	g_deprn.delete;
Line: 1872

	if h_mesg_name = 'FA_SHARED_INSERT_FAIL' then
          fnd_message.set_token('TABLE','FA_WHATIF_ITF',FALSE);
Line: 1889

end whatif_insert_itf;