DBA Data[Home] [Help]

APPS.FA_TRACK_MEMBER_PVT SQL Statements

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

Line: 37

                      P_update_override_status     in boolean, -- default ture,
                      P_period_of_addition         in varchar2, -- default NULL,
                      P_transaction_date_entered   in date, -- default null,
                      P_mode                       in varchar2, -- default NULL,
                      P_mrc_sob_type_code          in varchar2, -- default 'N',
                      X_new_deprn_amount           out nocopy number,
                      X_new_bonus_amount           out nocopy number,
		      p_log_level_rec      IN     FA_API_TYPES.log_level_rec_type default null)
  return number is

-- variables for the input and output parameters
x_counter               number;
Line: 74

  select 1
    from FA_TRACK_MEMBERS
   where group_asset_id = P_group_asset_id
     and period_counter = h_period_counter - 1
     and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 82

  select period_counter
    from fa_deprn_periods
   where book_type_code=P_book_type_code
     and fiscal_year=P_fiscal_year
     and period_num=P_period_counter;
Line: 89

  select period_counter
    from fa_mc_deprn_periods
   where book_type_code=P_book_type_code
     and fiscal_year=P_fiscal_year
     and period_num=P_period_counter
     and set_of_books_id = h_set_of_books_id;
Line: 122

    select deprn_calendar into h_deprn_calendar
      from fa_book_controls
     where book_type_code=P_Book_Type_code;
Line: 142

    select deprn_calendar into h_deprn_calendar
      from fa_book_controls
     where book_type_code=P_Book_Type_code;
Line: 173

                  P_update_override_status => P_update_override_status,
                  P_mrc_sob_type_code    => p_mrc_sob_type_code,
                  P_mode                 => P_mode,
                  X_new_deprn_amount     => X_new_deprn_amount,
                  X_new_bonus_amount     => X_new_bonus_amount,
		  p_log_level_rec => p_log_level_rec) then
      raise main_err;
Line: 214

    delete fa_track_members;
Line: 247

                  P_update_override_status     in boolean, -- default true,
                  P_mrc_sob_type_code          in varchar2, -- default 'N',
                  P_mode                       in varchar2, -- default NULL,
                  X_new_deprn_amount           out nocopy number,
                  X_new_bonus_amount           out nocopy number,
		  p_log_level_rec      IN     FA_API_TYPES.log_level_rec_type default null)
  return boolean is

-- variables for the input and output parameters
h_book_type_code      varchar2(15);
Line: 366

   select bk.asset_id,
          bk.cost,
	  decode(h_excl_sv,'N',bk.adjusted_cost,bk.adjusted_cost+bk.salvage_value) adjusted_cost,
          bk.salvage_value,
	  bk.recoverable_cost,
	  bk.adjusted_recoverable_cost,
          bk.period_counter_fully_retired,
          bk.period_counter_fully_reserved,
          bk.eofy_reserve,
          nvl(ds.period_counter,0) period_counter,
	  nvl(ds.deprn_reserve,0) deprn_reserve,
	  nvl(ds.ytd_deprn,0) ytd_deprn,
	  nvl(ds.bonus_deprn_reserve,0) bonus_deprn_reserve,
	  nvl(ds.bonus_ytd_deprn,0) bonus_ytd_deprn
     from fa_books bk,
	  fa_deprn_summary ds,
	  fa_additions_b ad
    where bk.group_asset_id = h_group_asset_id
      and bk.book_type_code = h_book_type_code
      and bk.date_ineffective is null
      and bk.depreciate_flag = 'YES'
      and ds.book_type_code = h_book_type_code
      and ds.asset_id = bk.asset_id
      and ds.period_counter =
            (select max(ds1.period_counter)
               from fa_deprn_summary ds1
              where ds1.book_type_code = h_book_type_code
                and ds1.asset_id = bk.asset_id
                and ds1.period_counter <= h_period_counter - 1)
      and ad.asset_id = bk.asset_id
      and ad.asset_type = 'CAPITALIZED'
    order by ad.asset_number;
Line: 403

    select nvl(sum(decode(aj.adjustment_type, 'RESERVE',decode(aj.debit_credit_flag, 'DR', -1, 1),
                                           'EXPENSE',decode(aj.debit_credit_flag, 'CR', -1, 1))* aj.adjustment_amount), 0)
    from   fa_adjustments aj
    where  aj.asset_id = c_asset_id
    and    aj.book_type_code = h_book_type_code
    and    aj.period_counter_created = h_period_counter
    and    aj.adjustment_type in ('RESERVE',  'EXPENSE');
Line: 413

    select nvl(sum(decode(aj.adjustment_type, 'RESERVE',decode(aj.debit_credit_flag, 'DR', -1, 1),
                                           'EXPENSE',decode(aj.debit_credit_flag, 'CR', -1, 1))* aj.adjustment_amount), 0)
    from   fa_adjustments_mrc_v aj
    where  aj.asset_id = c_asset_id
    and    aj.book_type_code = h_book_type_code
    and    aj.period_counter_created = h_period_counter
    and    aj.adjustment_type in ('RESERVE',  'EXPENSE');
Line: 422

   select bk.asset_id,
          bk.cost,
	  decode(h_excl_sv,'N',bk.adjusted_cost,bk.adjusted_cost+bk.salvage_value) adjusted_cost,
          bk.salvage_value,
	  bk.recoverable_cost,
	  bk.adjusted_recoverable_cost,
          bk.period_counter_fully_retired,
          bk.period_counter_fully_reserved,
          bk.eofy_reserve,
          nvl(ds.period_counter,0) period_counter,
	  nvl(ds.deprn_reserve,0) deprn_reserve,
	  nvl(ds.ytd_deprn,0) ytd_deprn,
	  nvl(ds.bonus_deprn_reserve,0) bonus_deprn_reserve,
	  nvl(ds.bonus_ytd_deprn,0) bonus_ytd_deprn
     from fa_mc_books bk,
	  fa_mc_deprn_summary ds,
	  fa_additions_b ad
    where bk.group_asset_id = h_group_asset_id
      and bk.book_type_code = h_book_type_code
      and bk.date_ineffective is null
      and bk.depreciate_flag = 'YES'
      and bk.set_of_books_id = h_set_of_books_id
      and ds.book_type_code = h_book_type_code
      and ds.asset_id = bk.asset_id
      and ds.period_counter =
            (select max(ds1.period_counter)
               from fa_mc_deprn_summary ds1
              where ds1.book_type_code = h_book_type_code
                and ds1.asset_id = bk.asset_id
                and ds1.set_of_books_id = h_set_of_books_id
                and ds1.period_counter <= h_period_counter - 1)
      and ds.set_of_books_id(+) = h_set_of_books_id
      and ad.asset_id = bk.asset_id
      and ad.asset_type = 'CAPITALIZED'
    order by ad.asset_number;
Line: 460

   select sum(bk.cost),
	  decode(h_excl_sv,'N',sum(bk.adjusted_cost),sum(bk.adjusted_cost+bk.salvage_value)),
	  sum(bk.recoverable_cost)
     from fa_books bk,
          fa_additions_b ad
    where bk.group_asset_id = h_group_asset_id
      and bk.date_ineffective is null
      and bk.depreciate_flag = 'YES'
      and bk.book_type_code = h_book_type_code
      and ad.asset_id = bk.asset_id
      and ad.asset_type='CAPITALIZED';
Line: 473

   select sum(bk.cost),
	  decode(h_excl_sv,'N',sum(bk.adjusted_cost),sum(bk.adjusted_cost+bk.salvage_value)),
	  sum(bk.recoverable_cost)
     from fa_mc_books bk,
          fa_additions_b ad
    where bk.group_asset_id = h_group_asset_id
      and bk.date_ineffective is null
      and bk.book_type_code = h_book_type_code
      and bk.set_of_books_id = h_set_of_books_id
      and bk.depreciate_flag = 'YES'
      and ad.asset_id = bk.asset_id
      and ad.asset_type = 'CAPITALIZED';
Line: 488

   select sum(bk.cost),
	  decode(h_excl_sv,'N',sum(bk.adjusted_cost),sum(bk.adjusted_cost+bk.salvage_value)),
	  sum(bk.recoverable_cost)
     from fa_books bk,
          fa_additions_b ad
    where bk.group_asset_id = h_group_asset_id
      and bk.date_ineffective is null
      and bk.period_counter_fully_retired is null
      and bk.book_type_code = h_book_type_code
      and bk.depreciate_flag = 'YES'
      and ad.asset_id = bk.asset_id
      and ad.asset_type = 'CAPITALIZED';
Line: 502

   select sum(bk.cost),
	  decode(h_excl_sv,'N',sum(bk.adjusted_cost),sum(bk.adjusted_cost+bk.salvage_value)),
	  sum(bk.recoverable_cost)
     from fa_mc_books bk,
          fa_additions_b ad
    where bk.group_asset_id = h_group_asset_id
      and bk.date_ineffective is null
      and bk.period_counter_fully_retired is null
      and bk.book_type_code = h_book_type_code
      and bk.set_of_books_id = h_set_of_books_id
      and bk.depreciate_flag = 'YES'
      and ad.asset_id = bk.asset_id
      and ad.asset_type = 'CAPITALIZED';
Line: 518

   select sum(bk.cost),
	  decode(h_excl_sv,'N',sum(bk.adjusted_cost),sum(bk.adjusted_cost+bk.salvage_value)),
	  sum(bk.recoverable_cost)
     from fa_books bk,
          fa_additions_b ad
    where bk.group_asset_id = h_group_asset_id
      and bk.date_ineffective is null
      and bk.period_counter_fully_reserved is null
      and bk.book_type_code = h_book_type_code
      and bk.depreciate_flag = 'YES'
      and ad.asset_id = bk.asset_id
      and ad.asset_type = 'CAPITALIZED';
Line: 532

   select sum(bk.cost),
	  decode(h_excl_sv,'N',sum(bk.adjusted_cost),sum(bk.adjusted_cost+bk.salvage_value)),
	  sum(bk.recoverable_cost)
     from fa_mc_books bk,
          fa_additions_b ad
    where bk.group_asset_id = h_group_asset_id
      and bk.date_ineffective is null
      and bk.period_counter_fully_reserved is null
      and bk.book_type_code = h_book_type_code
      and bk.set_of_books_id = h_set_of_books_id
      and bk.depreciate_flag = 'YES'
      and ad.asset_id = bk.asset_id
      and ad.asset_type = 'CAPITALIZED';
Line: 548

   select sum(bk.cost),
	  decode(h_excl_sv,'N',sum(bk.adjusted_cost),sum(bk.adjusted_cost+bk.salvage_value)),
	  sum(bk.recoverable_cost)
     from fa_books bk,
          fa_additions_b ad
    where bk.group_asset_id = h_group_asset_id
      and bk.date_ineffective is null
      and bk.period_counter_fully_retired is null
      and bk.period_counter_fully_reserved is null
      and bk.book_type_code = h_book_type_code
      and bk.depreciate_flag = 'YES'
      and ad.asset_id = bk.asset_id
      and ad.asset_type = 'CAPITALIZED';
Line: 563

   select sum(bk.cost),
	  decode(h_excl_sv,'N',sum(bk.adjusted_cost),sum(bk.adjusted_cost+bk.salvage_value)),
	  sum(bk.recoverable_cost)
     from fa_mc_books bk,
          fa_additions_b ad
    where bk.group_asset_id = h_group_asset_id
      and bk.date_ineffective is null
      and bk.period_counter_fully_retired is null
      and bk.period_counter_fully_reserved is null
      and bk.book_type_code = h_book_type_code
      and bk.set_of_books_id = h_set_of_books_id
      and bk.depreciate_flag = 'YES'
      and ad.asset_id = bk.asset_id
      and ad.asset_type = 'CAPITALIZED';
Line: 580

  select 'Y'
    from fa_track_members
   where group_asset_id=h_group_asset_id
     and member_asset_id=h_member_asset_id
     and period_counter=h_period_counter
     and (fully_reserved_flag is not null
          or
          fully_retired_flag is not null)
     and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 592

  select tr.member_asset_id,
         tr.cost,
	 tr.allocation_basis,
         nvl(tr.override_flag,'N') override_flag,
         bk.adjusted_recoverable_cost,
	 bk.recoverable_cost,
         bk.salvage_value,
	 ds.deprn_reserve,
	 ds.ytd_deprn,
	 ds.bonus_deprn_reserve,
	 ds.bonus_ytd_deprn
    from fa_track_members tr,
	 fa_books	  bk,
	 fa_deprn_summary ds,
         fa_deprn_periods dp,
	 fa_additions_b   ad
   where tr.group_asset_id = h_group_asset_id
     and tr.period_counter = h_period_counter
     and tr.fiscal_year = h_fiscal_year
     and nvl(tr.set_of_books_id,-99) = nvl(h_set_of_books_id,-99)
     and nvl(tr.fully_reserved_flag,'N') <> 'Y'
--     and nvl(tr.override_flag,'N') <> 'Y'
     and bk.book_type_code = h_book_type_code
     and bk.asset_id = tr.member_asset_id
     and bk.date_effective <= nvl(dp.period_close_date,sysdate)
     and nvl(bk.date_ineffective,sysdate) >= nvl(dp.period_close_date,sysdate)
     and dp.book_type_code = bk.book_type_code
     and dp.period_counter = h_period_counter
     and ds.book_type_code = bk.book_type_code
     and ds.period_counter = h_period_counter - 1
     and ds.asset_id = bk.asset_id
     and ad.asset_id = bk.asset_id
   order by ad.asset_number;
Line: 627

  select tr.member_asset_id,
         tr.cost,
	 tr.allocation_basis,
         nvl(tr.override_flag,'N') override_flag,
         bk.adjusted_recoverable_cost,
	 bk.recoverable_cost,
         bk.salvage_value,
	 ds.deprn_reserve,
	 ds.ytd_deprn,
	 ds.bonus_deprn_reserve,
	 ds.bonus_ytd_deprn
    from fa_track_members tr,
	 fa_mc_books	  bk,
	 fa_mc_deprn_summary ds,
         fa_mc_deprn_periods dp,
	 fa_additions_b   ad
   where tr.group_asset_id = h_group_asset_id
     and tr.period_counter = h_period_counter
     and tr.fiscal_year = h_fiscal_year
     and nvl(tr.set_of_books_id,-99) = nvl(h_set_of_books_id,-99)
     and nvl(tr.fully_reserved_flag,'N') <> 'Y'
--     and nvl(tr.override_flag,'N') <> 'Y'
     and bk.book_type_code = h_book_type_code
     and bk.asset_id = tr.member_asset_id
     and bk.set_of_books_id = h_set_of_books_id
     and bk.date_effective <= nvl(dp.period_close_date,sysdate)
     and nvl(bk.date_ineffective,sysdate) >= nvl(dp.period_close_date,sysdate)
     and dp.book_type_code = bk.book_type_code
     and dp.period_counter = h_period_counter
     and dp.set_of_books_id = h_set_of_books_id
     and ds.book_type_code = bk.book_type_code
     and ds.period_counter = h_period_counter - 1
     and ds.asset_id = bk.asset_id
     and ds.set_of_books_id = h_set_of_books_id
     and ad.asset_id = bk.asset_id
   order by ad.asset_number;
Line: 666

  select decode(h_excl_sv,'N',bk.adjusted_cost,bk.adjusted_cost+bk.salvage_value) adjusted_cost,
         bk.recoverable_cost recoverable_cost
    from fa_books bk
   where bk.book_type_code=h_book_type_code
     and bk.asset_id = h_group_asset_id
     and bk.date_ineffective is null;
Line: 674

  select decode(h_excl_sv,'N',bk.adjusted_cost,bk.adjusted_cost+bk.salvage_value) adjusted_cost,
         bk.recoverable_cost recoverable_cost
    from fa_mc_books bk
   where bk.book_type_code=h_book_type_code
     and bk.asset_id = h_group_asset_id
     and bk.date_ineffective is null
     and bk.set_of_books_id = h_set_of_books_id;
Line: 684

  select period_num
    from fa_deprn_periods
   where book_type_code = h_book_type_code
     and period_counter = p_period_counter;
Line: 690

  select period_num
    from fa_mc_deprn_periods
   where book_type_code = h_book_type_code
     and period_counter = p_period_counter
     and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 698

   select sum(decode(adj.adjustment_type,'EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_adjustments adj,
 	  fa_transaction_headers th1,
	  fa_transaction_headers th2
    where adj.transaction_header_id = th1.transaction_header_id
      and adj.asset_id = h_group_asset_id
      and adj.book_type_code = h_book_type_code
      and adj.period_counter_adjusted = h_period_counter
      and th1.asset_id = adj.asset_id
      and th1.member_transaction_header_id = th2.transaction_header_id
      and th2.asset_id = nvl(p_member_asset_id,th2.asset_id);
Line: 718

   select sum(decode(adj.adjustment_type,'EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_mc_adjustments adj,
 	  fa_transaction_headers th1,
	  fa_transaction_headers th2
    where adj.transaction_header_id = th1.transaction_header_id
      and adj.asset_id = h_group_asset_id
      and adj.book_type_code = h_book_type_code
      and adj.period_counter_adjusted = h_period_counter
      and adj.set_of_books_id = h_set_of_books_id
      and th1.asset_id = adj.asset_id
      and th1.member_transaction_header_id = th2.transaction_header_id
      and th2.asset_id = nvl(p_member_asset_id,th2.asset_id);
Line: 740

  select member_asset_id
    from fa_track_members
   where group_asset_id = P_group_asset_id
     and period_counter = P_period_counter
     and fiscal_year = P_fiscal_year
     and (nvl(fully_reserved_flag,'N') = 'Y' or nvl(override_flag,'N') = 'Y');
Line: 749

   select sum(decode(adj.adjustment_type,'EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_adjustments adj,
 	  fa_transaction_headers th1,
	  fa_transaction_headers th2
    where adj.transaction_header_id = th1.transaction_header_id
      and adj.asset_id = h_group_asset_id
      and adj.book_type_code = h_book_type_code
      and adj.period_counter_adjusted = h_period_counter
      and th1.asset_id = adj.asset_id
      and th1.member_transaction_header_id = th2.transaction_header_id
      and th2.asset_id = h_unplanned_member_asset
      and th2.transaction_type_code = 'ADJUSTMENT'
      and th2.transaction_key in ('UA','UE');
Line: 767

   select sum(decode(adj.adjustment_type,'EXPENSE',
		     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_adjustments adj,
          fa_transaction_headers th
    where adj.book_type_code = h_book_type_code
      and adj.asset_id = h_unplanned_member_asset
      and adj.period_counter_adjusted = h_period_counter
      and adj.transaction_header_id = th.transaction_header_id
      and th.transaction_type_code = 'ADJUSTMENT'
      and th.transaction_key in ('UA','UE');
Line: 781

   select sum(decode(adj.adjustment_type,'EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_mc_adjustments adj,
 	  fa_transaction_headers th1,
	  fa_transaction_headers th2
    where adj.transaction_header_id = th1.transaction_header_id
      and adj.asset_id = h_group_asset_id
      and adj.book_type_code = h_book_type_code
      and adj.period_counter_adjusted = h_period_counter
      and adj.set_of_books_id = h_set_of_books_id
      and th1.asset_id = adj.asset_id
      and th1.member_transaction_header_id = th2.transaction_header_id
      and th2.asset_id = h_unplanned_member_asset
      and th2.transaction_type_code = 'ADJUSTMENT'
      and th2.transaction_key in ('UA','UE');
Line: 800

   select sum(decode(adj.adjustment_type,'EXPENSE',
		     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_mc_adjustments adj,
          fa_transaction_headers th
    where adj.book_type_code = h_book_type_code
      and adj.asset_id = h_member_asset_id
      and adj.set_of_books_id = h_set_of_books_id
      and adj.period_counter_adjusted = h_period_counter
      and adj.transaction_header_id = th.transaction_header_id
      and th.transaction_type_code = 'ADJUSTMENT'
      and th.transaction_key in ('UA','UE');
Line: 816

  select member_asset_id
    from fa_track_members
   where group_asset_id = P_group_asset_id
     and period_counter = P_period_counter
     and fiscal_year = P_fiscal_year
     and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 826

  select db.rule_name
  from   fa_deprn_basis_rules db
       , fa_methods mt
       , fa_books bk
  where  db.deprn_basis_rule_id = mt.deprn_basis_rule_id
  and    mt.method_code = bk.deprn_method_code
  and    nvl(mt.life_in_months, -99) = nvl(bk.life_in_months, -99)
  and    bk.book_type_code = h_book_type_code
  and    bk.asset_id = P_group_asset_id
  and    bk.transaction_header_id_out is null;
Line: 1301

                                      P_update_override_status => P_update_override_status,
                                      PX_difference_deprn_amount => h_difference_deprn_amount,
                                      PX_difference_bonus_amount => h_difference_bonus_amount,
                                      X_system_deprn_amount => h_system_deprn_amount,
                                      X_system_bonus_amount => h_system_bonus_amount,
                                      X_track_member_out => l_track_member_out,
                                      P_mrc_sob_type_code => P_mrc_sob_type_code,
                                      P_mode => P_mode,
                                      P_rec_cost_for_odda => h_rec_cost_for_odda,
                                      P_sv_for_odda => h_sv_for_odda,
				      p_log_level_rec     => p_log_level_rec) then
                  raise allocate_err;
Line: 1354

		                  'Updated current period row into p_track_member_table', '***', p_log_level_rec);
Line: 1458

               select fiscal_year into h_ds_fy
                 from fa_deprn_periods
                where book_type_code = h_book_type_code
                  and period_counter = mem.period_counter;
Line: 1529

                                      P_update_override_status => P_update_override_status,
                                      PX_difference_deprn_amount => h_difference_deprn_amount,
                                      PX_difference_bonus_amount => h_difference_bonus_amount,
                                      X_system_deprn_amount => h_system_deprn_amount,
                                      X_system_bonus_amount => h_system_bonus_amount,
                                      X_track_member_out => l_track_member_out,
                                      P_mrc_sob_type_code => 'P',
                                      P_mode => P_mode,
                                      P_rec_cost_for_odda => h_rec_cost_for_odda,
                                      P_sv_for_odda => h_sv_for_odda,
				      p_log_level_rec             => p_log_level_rec) then
                  raise allocate_err;
Line: 1554

                  update fa_books                                                                               -- ENERGY
                  set    adjusted_cost = adjusted_cost - nvl(l_track_member_out.allocated_deprn_amount, 0)      -- ENERGY
                  where transaction_header_id_out is null                                                       -- ENERGY
                  and   asset_id = mem.asset_id                                                                 -- ENERGY
                  and   book_type_code = h_book_type_code;                                                      -- ENERGY
Line: 1608

               select fiscal_year into h_ds_fy
                 from fa_mc_deprn_periods
                where book_type_code = h_book_type_code
                  and period_counter = mem.period_counter
                  and set_of_books_id = h_set_of_books_id;
Line: 1677

                                   P_update_override_status => P_update_override_status,
                                   PX_difference_deprn_amount => h_difference_deprn_amount,
                                   PX_difference_bonus_amount => h_difference_bonus_amount,
                                   X_system_deprn_amount => h_system_deprn_amount,
                                   X_system_bonus_amount => h_system_bonus_amount,
                                   X_track_member_out => l_track_member_out,
                                   P_mrc_sob_type_code => 'R',
                                   P_mode => P_mode,
                                   P_rec_cost_for_odda => h_rec_cost_for_odda,
                                   P_sv_for_odda => h_sv_for_odda,
				   p_log_level_rec  => p_log_level_rec) then
                  raise allocate_err;
Line: 1703

                  update fa_books_mrc_v                                                                         -- ENERGY
                  set    adjusted_cost = adjusted_cost - nvl(l_track_member_out.allocated_deprn_amount, 0)      -- ENERGY
                  where transaction_header_id_out is null                                                       -- ENERGY
                  and   asset_id = mem.asset_id                                                                 -- ENERGY
                  and   book_type_code = h_book_type_code;                                                      -- ENERGY
Line: 1744

         select nvl(sum(system_deprn_amount),0),
                nvl(sum(system_bonus_amount),0)
           into x_sum_of_deprn_amount,x_sum_of_bonus_amount
           from fa_track_members
           where group_asset_id = P_group_asset_id
            and member_asset_id <> l_track_member_in.member_asset_id
            and period_counter = P_period_counter
            and fiscal_year    = P_fiscal_year
            and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 1757

            select fully_reserved_flag
            into   x_fully_reserved_flag
            from   fa_track_members
            where  group_asset_id = P_group_asset_id
            and    member_asset_id = l_track_member_in.member_asset_id
            and    period_counter = P_period_counter
            and    fiscal_year    = P_fiscal_year
            and    nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 1924

         fa_debug_pkg.add(l_calling_fn,'+++ Just before update table or PL/SQL table +++', P_mode, p_log_level_rec);
Line: 1951

                             'In final asset rounding, Updated following row into p_track_member_table',
                             l_last_asset_index, p_log_level_rec);
Line: 1961

           fa_debug_pkg.add(l_calling_fn, 'before update ', '1', p_log_level_rec);
Line: 1970

        update FA_TRACK_MEMBERS
           set allocated_deprn_amount = x_allocated_deprn_amount,
               allocated_bonus_amount = x_allocated_bonus_amount,
               fully_reserved_flag = x_fully_reserved_flag,
               system_deprn_amount = h_system_deprn_amount,
               system_bonus_amount = h_system_bonus_amount,
               deprn_reserve = h_deprn_reserve,
               ytd_deprn = h_ytd_deprn,
               bonus_deprn_reserve = h_bonus_deprn_reserve,
               bonus_ytd_deprn = h_bonus_ytd_deprn
         where group_asset_id = P_group_asset_id
           and member_asset_id = h_member_asset_id
           and period_counter = P_period_counter
           and fiscal_year = P_fiscal_year
           and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 2014

     select sum(decode(nvl(P_subtraction_flag,'N'),'N',
                decode(nvl(override_flag,'N'),'Y',system_deprn_amount,allocated_deprn_amount), -- Periodic Case
                system_deprn_amount)), -- Subtraction Case
            sum(decode(nvl(P_subtraction_flag,'N'),'N',
                decode(nvl(override_flag,'N'),'Y',system_bonus_amount,allocated_bonus_amount), -- Periodic Case
                system_bonus_amount)) -- Subtraction Case
       into x_total_allocated_deprn_amount,x_total_allocated_bonus_amount
       from fa_track_members
      where group_asset_id = P_group_asset_id
        and period_counter = P_period_counter
        and fiscal_year = P_fiscal_year
        and nvl(set_of_books_id,-99) = h_set_of_books_id;
Line: 2083

            select nvl(sum(decode(nvl(P_subtraction_flag,'N'),'N',
                       decode(nvl(fully_reserved_flag,'N'),'Y',
                                                allocated_deprn_amount,
                                                system_deprn_amount), -- Normal Case
                       system_deprn_amount)), -- Subtraction Case
                       0),
                   nvl(sum(decode(nvl(P_subtraction_flag,'N'),'N',
                      decode(nvl(fully_reserved_flag,'N'),'Y',
                                                allocated_bonus_amount,
                                                system_bonus_amount), -- Normal Case
                       system_deprn_amount)), -- Subtraction Case
                       0)
              into h_fixed_deprn_amount,h_fixed_bonus_amount
              from fa_track_members
             where group_asset_id = P_group_asset_id
               and period_counter = P_period_counter
               and fiscal_year = P_fiscal_year
               and (nvl(fully_reserved_flag,'N') = 'Y' or nvl(override_flag,'N') = 'Y');
Line: 2163

            Select nvl(sum(allocation_basis),0) into h_total_allocation_basis
              from fa_track_members
             where group_asset_id = P_group_asset_id
               and period_counter = P_period_counter
               and fiscal_year = P_fiscal_year
               and nvl(fully_reserved_flag,'N') <> 'Y'
               and nvl(override_flag,'N') <> 'Y';
Line: 2232

                                           P_update_override_status => P_update_override_status,
                                           P_member_override_flag => h_member_override_flag,
                                           PX_difference_deprn_amount => h_difference_deprn_amount,
                                           PX_difference_bonus_amount => h_difference_bonus_amount,
                                           X_system_deprn_amount => h_system_deprn_amount,
                                           X_system_bonus_amount => h_system_bonus_amount,
                                           X_track_member_out => l_track_member_out,
                                           P_mrc_sob_type_code => 'P',
                                           P_mode => P_mode,
                                           P_rec_cost_for_odda => h_rec_cost_for_odda,
                                           P_sv_for_odda => h_sv_for_odda,
					   p_log_level_rec             => p_log_level_rec) then
                        raise allocate_err;
Line: 2264

                                         'In reallocation logic, Updated following row into p_track_member_table',
                                         l_processed_number, p_log_level_rec);
Line: 2343

                                         P_update_override_status => P_update_override_status,
                                         P_member_override_flag => h_member_override_flag,
                                         PX_difference_deprn_amount => h_difference_deprn_amount,
                                         PX_difference_bonus_amount => h_difference_bonus_amount,
                                         X_system_deprn_amount => h_system_deprn_amount,
                                         X_system_bonus_amount => h_system_bonus_amount,
                                         X_track_member_out => l_track_member_out,
                                         P_mrc_sob_type_code => 'P',
                                         P_mode => P_mode,
                                         P_rec_cost_for_odda => h_rec_cost_for_odda,
                                         P_sv_for_odda => h_sv_for_odda,
					 p_log_level_rec             => p_log_level_rec) then
                     raise allocate_err;
Line: 2429

                                         P_update_override_status => P_update_override_status,
                                         P_member_override_flag => h_member_override_flag,
                                         PX_difference_deprn_amount => h_difference_deprn_amount,
                                         PX_difference_bonus_amount => h_difference_bonus_amount,
                                         X_system_deprn_amount => h_system_deprn_amount,
                                         X_system_bonus_amount => h_system_bonus_amount,
                                         X_track_member_out => l_track_member_out,
                                         P_mrc_sob_type_code => 'R',
                                         P_mode => P_mode,
                                         P_rec_cost_for_odda => h_rec_cost_for_odda,
                                         P_sv_for_odda => h_sv_for_odda,
					 p_log_level_rec             => p_log_level_rec) then
                     raise allocate_err;
Line: 2486

               select nvl(sum(system_deprn_amount),0),nvl(sum(system_bonus_amount),0)
                 into x_sum_of_deprn_amount,x_sum_of_bonus_amount
                 from fa_track_members
                where group_asset_id = P_group_asset_id
                  and member_asset_id <> l_track_member_in.member_asset_id
                  and period_counter = P_period_counter
                  and fiscal_year    = P_fiscal_year
                  and nvl(fully_reserved_flag,'N') <> 'Y'
                  and nvl(override_flag,'N') <> 'Y'
                  and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 2599

               fa_debug_pkg.add(l_calling_fn,'+++ Just before update table or PL/SQL table (Realloc) +++', P_mode, p_log_level_rec);
Line: 2625

           fa_debug_pkg.add(l_calling_fn, 'before update ', '2', p_log_level_rec);
Line: 2633

               update FA_TRACK_MEMBERS
                  set allocated_deprn_amount = x_allocated_deprn_amount,
                      allocated_bonus_amount = x_allocated_bonus_amount,
                      fully_reserved_flag = x_fully_reserved_flag,
                      system_deprn_amount = h_system_deprn_amount,
                      system_bonus_amount = h_system_bonus_amount,
                      deprn_reserve = h_deprn_reserve,
                      ytd_deprn = h_ytd_deprn,
                      bonus_deprn_reserve = h_bonus_deprn_reserve,
                      bonus_ytd_deprn = h_bonus_ytd_deprn
                where group_asset_id = P_group_asset_id
                  and member_asset_id = h_member_asset_id
                  and period_counter = P_period_counter
                  and fiscal_year = P_fiscal_year
                  and  nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 2670

         select sum(allocated_deprn_amount),sum(allocated_bonus_amount)
           into x_total_allocated_deprn_amount,x_total_allocated_bonus_amount
           from fa_track_members
          where group_asset_id = P_group_asset_id
            and period_counter = P_period_counter
            and fiscal_year    = P_fiscal_year
            and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 2714

            select sum(allocated_deprn_amount),sum(allocated_bonus_amount)
              into x_total_allocated_deprn_amount,x_total_allocated_bonus_amount
              from fa_track_members
             where group_asset_id = P_group_asset_id
               and period_counter = P_period_counter
               and fiscal_year    = P_fiscal_year
               and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 2809

               fa_debug_pkg.add(l_calling_fn, 'Inserted new row into p_track_member_table',
	                     l_processed_number, p_log_level_rec);
Line: 2846

               UPDATE FA_BOOKS_SUMMARY
                  SET DEPRN_AMOUNT = h_unplanned_expense + DEPRN_AMOUNT,
                      YTD_DEPRN = h_unplanned_expense + YTD_DEPRN
                WHERE BOOK_TYPE_CODE = h_book_type_code
                  AND PERIOD_COUNTER = h_period_counter
                  AND ASSET_ID = h_unplanned_member_asset;
Line: 2853

               UPDATE FA_BOOKS_SUMMARY_MRC_V
                  SET DEPRN_AMOUNT = h_unplanned_expense + DEPRN_AMOUNT,
                      YTD_DEPRN = h_unplanned_expense + YTD_DEPRN
                WHERE BOOK_TYPE_CODE = h_book_type_code
                  AND PERIOD_COUNTER = h_period_counter
                  AND ASSET_ID = h_unplanned_member_asset;
Line: 3014

                         P_update_override_status    in boolean, -- default true,
                         P_member_override_flag      in varchar2, -- default null,
                         PX_difference_deprn_amount  in out nocopy number,
                         PX_difference_bonus_amount  in out nocopy number,
                         X_system_deprn_amount       out nocopy number,
                         X_system_bonus_amount       out nocopy number,
                         X_track_member_out          out nocopy track_member_struct,
                         P_mrc_sob_type_code         in varchar2, -- default 'N',
                         P_mode                      in Varchar2,
                         P_rec_cost_for_odda         in number,
                         P_sv_for_odda               in number,
			 p_log_level_rec      IN     FA_API_TYPES.log_level_rec_type default null)
  return boolean is

-- variables
x_calc_done                  varchar2(1);
Line: 3086

allocation_main_update_err exception;
Line: 3090

 select 1
   from fa_track_members
  where group_asset_id = h_group_asset_id
    and member_asset_id = h_member_asset_id
    and period_counter = h_period_counter
    and fiscal_year = h_fiscal_year
    and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 3100

  select period_num
    from fa_deprn_periods
   where book_type_code = P_book_type_code
     and period_counter = p_per_counter;
Line: 3106

  select period_num
    from fa_mc_deprn_periods
   where book_type_code = P_book_type_code
     and period_counter = p_per_counter
     and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 3114

   select sum(decode(adj.adjustment_type,'EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_adjustments adj,
 	  fa_transaction_headers th1,
	  fa_transaction_headers th2
    where adj.transaction_header_id = th1.transaction_header_id
      and adj.asset_id = p_group_asset_id
      and adj.book_type_code = p_book_type_code
      and adj.period_counter_adjusted = p_period_counter
      and th1.asset_id = adj.asset_id
      and th1.member_transaction_header_id = th2.transaction_header_id
      and th2.asset_id = nvl(p_member_asset_id,th2.asset_id);
Line: 3135

   select sum(decode(adj.adjustment_type,'EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_mc_adjustments adj,
 	  fa_transaction_headers th1,
	  fa_transaction_headers th2
    where adj.transaction_header_id = th1.transaction_header_id
      and adj.asset_id = p_group_asset_id
      and adj.book_type_code = p_book_type_code
      and adj.period_counter_adjusted = p_period_counter
      and adj.set_of_books_id = h_set_of_books_id
      and th1.asset_id = adj.asset_id
      and th1.member_transaction_header_id = th2.transaction_header_id
      and th2.asset_id = nvl(p_member_asset_id,th2.asset_id);
Line: 3307

                              p_update_override_status => P_update_override_status,
                              p_mrc_sob_type_code => P_mrc_sob_type_code,
                              p_recoverable_cost => P_rec_cost_for_odda,
                              p_salvage_value => P_sv_for_odda,
			      p_log_level_rec => p_log_level_rec) then
                rollback to member_override;
Line: 3411

            raise allocation_main_update_err;
Line: 3503

       fa_debug_pkg.add('allocation_main','insert/update check', x_dummy, p_log_level_rec);
Line: 3510

       Insert into FA_TRACK_MEMBERS(group_asset_id,
                                member_asset_id,
                                period_counter,
                                fiscal_year,
                                set_of_books_id,
                                allocation_basis,
                                total_allocation_basis,
                                allocated_deprn_amount,
                                allocated_bonus_amount,
                                fully_reserved_flag,
                                system_deprn_amount,
                                system_bonus_amount,
                                cost,
                                adjusted_cost,
                                salvage_value,
                                recoverable_cost,
                                adjusted_recoverable_cost,
                                override_flag,
                                deprn_reserve,
                                ytd_deprn,
                                bonus_deprn_reserve,
                                bonus_ytd_deprn,
                                deprn_override_flag)
          values
              (h_group_asset_id,
               h_member_asset_id,
               h_period_counter,
               h_fiscal_year,
               h_set_of_books_id,
               h_allocation_basis,
               h_total_allocation_basis,
               nvl(x_allocated_deprn_amount, 0), --bug6923135
               nvl(x_allocated_bonus_amount, 0), --bug6923135
               x_fully_reserved_flag,
               nvl(X_system_deprn_amount, 0), --bug6923135
               nvl(X_system_bonus_amount, 0), --bug6923135
               h_cost,
               h_adjusted_cost,
               h_salvage_value,
               h_recoverable_cost,
               h_adjusted_recoverable_cost,
               x_override_flag,
               x_deprn_reserve,
               x_ytd_deprn,
               x_bonus_deprn_reserve,
               x_bonus_ytd_deprn,
               h_deprn_override);
Line: 3557

     else -- Need to update
       if nvl(P_member_override_flag,'N') <> 'Y' then
         Update FA_TRACK_MEMBERS
            set allocation_basis = h_allocation_basis,
                total_allocation_basis = h_total_allocation_basis,
                allocated_deprn_amount = x_allocated_deprn_amount,
                allocated_bonus_amount = x_allocated_bonus_amount,
                fully_reserved_flag = x_fully_reserved_flag,
                system_deprn_amount = x_system_deprn_amount,
                system_bonus_amount = x_system_bonus_amount,
                deprn_reserve = x_deprn_reserve,
                ytd_deprn = x_ytd_deprn,
                bonus_deprn_reserve = x_bonus_deprn_reserve,
                bonus_ytd_deprn = x_bonus_ytd_deprn
          where group_asset_id = h_group_asset_id
            and member_asset_id = h_member_asset_id
            and period_counter = h_period_counter
            and fiscal_year = h_fiscal_year
            and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 3577

         Update FA_TRACK_MEMBERS
            set system_deprn_amount = x_system_deprn_amount,
                system_bonus_amount = x_system_bonus_amount
          where group_asset_id = h_group_asset_id
            and member_asset_id = h_member_asset_id
            and period_counter = h_period_counter
            and fiscal_year = h_fiscal_year
            and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 3637

  when allocation_main_update_err then
    rollback to member_override;
Line: 3640

                                 name => 'FA_CANNOT_UPDATE_OVERRIDE',
				 p_log_level_rec             => p_log_level_rec);
Line: 3669

FUNCTION update_deprn_basis(p_group_rule_in          in fa_std_types.fa_deprn_rule_in_struct,
                            p_apply_reduction_flag   in varchar2, -- default NULL,
                            p_mode                   in varchar2,
			    p_log_level_rec      IN     FA_API_TYPES.log_level_rec_type default null) -- default NULL)
  return boolean is

--* Structure to call Deprn Basis Rule
fa_rule_in      fa_std_types.fa_deprn_rule_in_struct;
Line: 3739

h_memory_update_status  varchar2(3);
Line: 3768

l_calling_fn            varchar2(40) := 'fa_track_member_pvt.update_deprn_basis';
Line: 3774

  select bk.group_asset_id group_asset_id,
         bk.asset_id       member_asset_id,
         bk.cost           cost,
         bk.salvage_value  salvage_value,
         bk.recoverable_cost recoverable_cost,
         bk.adjusted_cost  adjusted_cost,
         bk.adjusted_recoverable_cost adjusted_recoverable_cost,
         bk.period_counter_fully_retired fully_retired_flag,
         bk.period_counter_fully_reserved fully_reserved_flag,
         bk.eofy_reserve    bk_eofy_reserve,
         bk.eofy_adj_cost  eofy_adj_cost,
         ds.period_counter ds_period_counter,
         ds.deprn_reserve  ds_deprn_reserve,
         ds.ytd_deprn      ds_ytd_deprn,
         ds.bonus_deprn_reserve ds_bonus_deprn_reserve,
         ds.bonus_ytd_deprn ds_bonus_ytd_deprn,
         temp.deprn_reserve temp_deprn_reserve,
         temp.ytd_deprn     temp_ytd_deprn,
         temp.bonus_deprn_reserve temp_bonus_deprn_reserve,
         temp.bonus_ytd_deprn temp_bonus_ytd_deprn,
         temp.prior_year_reserve temp_prior_year_reserve,
         temp.eofy_recoverable_cost temp_eofy_recoverable_cost,
         temp.eop_recoverable_cost temp_eop_recoverable_cost,
         temp.eofy_salvage_value temp_eofy_salvage_value,
         temp.eop_salvage_value  temp_eop_salvage_value
    from fa_books bk,
         fa_deprn_summary ds,
         fa_track_members temp
   where bk.book_type_code = h_book_type_code
     and bk.group_asset_id = h_group_asset_id
     and bk.date_ineffective is null
     and ds.book_type_code = bk.book_type_code
     and ds.asset_id = bk.asset_id
     and (ds.period_counter =
          (select max(ds1.period_counter)
             from fa_deprn_summary ds1
            where ds1.book_type_code=h_book_type_code
              and ds1.asset_id=bk.asset_id
              and ds1.period_counter <= h_period_counter - 1)
         or
          ds.period_counter = nvl(bk.period_counter_fully_reserved,-99))
     and temp.member_asset_id (+) = bk.asset_id
     and temp.period_counter (+) = h_period_counter
     and temp.fiscal_year (+) = h_fiscal_year
     and temp.set_of_books_id (+) = nvl(h_set_of_books_id,-99);
Line: 3821

  select bk.group_asset_id group_asset_id,
         bk.asset_id       member_asset_id,
         bk.cost           cost,
         bk.salvage_value  salvage_value,
         bk.recoverable_cost recoverable_cost,
         bk.adjusted_cost  adjusted_cost,
         bk.adjusted_recoverable_cost adjusted_recoverable_cost,
         bk.period_counter_fully_retired fully_retired_flag,
         bk.period_counter_fully_reserved fully_reserved_flag,
         bk.eofy_reserve    bk_eofy_reserve,
         bk.eofy_adj_cost  eofy_adj_cost,
         ds.period_counter ds_period_counter,
         ds.deprn_reserve  ds_deprn_reserve,
         ds.ytd_deprn      ds_ytd_deprn,
         ds.bonus_deprn_reserve ds_bonus_deprn_reserve,
         ds.bonus_ytd_deprn ds_bonus_ytd_deprn,
         temp.deprn_reserve temp_deprn_reserve,
         temp.ytd_deprn     temp_ytd_deprn,
         temp.bonus_deprn_reserve temp_bonus_deprn_reserve,
         temp.bonus_ytd_deprn temp_bonus_ytd_deprn,
         temp.prior_year_reserve temp_prior_year_reserve,
         temp.eofy_recoverable_cost temp_eofy_recoverable_cost,
         temp.eop_recoverable_cost temp_eop_recoverable_cost,
         temp.eofy_salvage_value temp_eofy_salvage_value,
         temp.eop_salvage_value  temp_eop_salvage_value
    from fa_mc_books bk,
         fa_mc_deprn_summary ds,
         fa_track_members temp
   where bk.book_type_code = h_book_type_code
     and bk.group_asset_id = h_group_asset_id
     and bk.date_ineffective is null
     and bk.set_of_books_id = h_set_of_books_id
     and ds.book_type_code = bk.book_type_code
     and ds.asset_id = bk.asset_id
--     and ds.period_counter = h_period_counter - 1
     and (ds.period_counter =
          (select max(ds1.period_counter)
             from fa_mc_deprn_summary ds1
            where ds1.book_type_code=h_book_type_code
              and ds1.asset_id=bk.asset_id
              and ds1.set_of_books_id = h_set_of_books_id
              and ds1.period_counter <= h_period_counter - 1)
         or
          ds.period_counter = nvl(bk.period_counter_fully_reserved,-99))
     and ds.set_of_books_id = h_set_of_books_id
     and temp.member_asset_id (+) = bk.asset_id
     and temp.period_counter (+) = h_period_counter
     and temp.fiscal_year (+) = h_fiscal_year
     and nvl(temp.set_of_books_id (+),-99) = nvl(h_set_of_books_id,-99);
Line: 3873

  select temp.cost,
         temp.salvage_value,
         temp.recoverable_cost,
         temp.adjusted_cost,
         temp.adjusted_recoverable_cost
    from fa_track_members temp
   where temp.group_asset_id = h_group_asset_id
     and temp.member_asset_id = h_member_asset_id
     and temp.period_counter = h_period_counter
     and nvl(temp.set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 3886

 select 1
   from fa_track_members
  where group_asset_id = h_group_asset_id
    and member_asset_id = h_member_asset_id
    and period_counter = h_period_counter
    and fiscal_year = h_fiscal_year
    and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 3897

   select sum(decode(adj.adjustment_type,'EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_adjustments adj,
 	  fa_transaction_headers th1,
	  fa_transaction_headers th2
    where adj.transaction_header_id = th1.transaction_header_id
      and adj.asset_id = h_group_asset_id
      and adj.book_type_code = h_book_type_code
      and adj.period_counter_adjusted = h_period_counter
      and th1.asset_id = adj.asset_id
      and th1.member_transaction_header_id = th2.transaction_header_id
      and th2.asset_id = h_member_asset_id;
Line: 3917

   select sum(decode(adj.adjustment_type,'EXPENSE',
		     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_adjustments adj
    where adj.book_type_code = h_book_type_code
      and adj.asset_id = h_member_asset_id
      and adj.period_counter_adjusted = h_period_counter;
Line: 3932

   select sum(decode(adj.adjustment_type,'EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_mc_adjustments adj,
 	  fa_transaction_headers th1,
	  fa_transaction_headers th2
    where adj.transaction_header_id = th1.transaction_header_id
      and adj.asset_id = h_group_asset_id
      and adj.book_type_code = h_book_type_code
      and adj.period_counter_adjusted = h_period_counter
      and adj.set_of_books_id = h_set_of_books_id
      and th1.asset_id = adj.asset_id
      and th1.member_transaction_header_id = th2.transaction_header_id
      and th2.asset_id = h_member_asset_id;
Line: 3953

   select sum(decode(adj.adjustment_type,'EXPENSE',
		     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_mc_adjustments adj
    where adj.book_type_code = h_book_type_code
      and adj.asset_id = h_member_asset_id
      and adj.set_of_books_id = h_set_of_books_id
      and adj.period_counter_adjusted = h_period_counter;
Line: 3969

           select new_bk.cost - old_bk.cost,
                  decode(new_bk.salvage_type,'AMT',
                         decode(old_bk.salvage_type,'AMT', new_bk.salvage_value - old_bk.salvage_value,
                                                           new_bk.salvage_value)),
                  decode(new_bk.deprn_limit_type,'AMT',
                         decode(old_bk.deprn_limit_type,'AMT',
                                new_bk.adjusted_recoverable_cost - old_bk.adjusted_recoverable_cost,
                                new_bk.adjusted_recoverable_cost)),
                  new_bk.salvage_type,
                  decode(new_bk.salvage_type,'PCT',new_bk.percent_salvage_value),
                  new_bk.deprn_limit_type,
                  decode(new_bk.deprn_limit_type,'PCT',new_bk.allowed_deprn_limit)
             from fa_books new_bk,
                  fa_books old_bk
            where new_bk.book_type_code = p_group_rule_in.book_type_code
              and new_bk.asset_id = h_member_asset_id
              and new_bk.transaction_header_id_in = h_adj_member_trans_header_id
              and old_bk.book_type_code = new_bk.book_type_code
              and old_bk.asset_id = new_bk.asset_id
              and old_bk.transaction_header_id_out = new_bk.transaction_header_id_in;
Line: 3991

           select new_bk.cost - old_bk.cost,
                  decode(new_bk.salvage_type,'AMT',
                         decode(old_bk.salvage_type,'AMT', new_bk.salvage_value - old_bk.salvage_value,
                                                           new_bk.salvage_value)),
                  decode(new_bk.deprn_limit_type,'AMT',
                         decode(old_bk.deprn_limit_type,'AMT',
                                new_bk.adjusted_recoverable_cost - old_bk.adjusted_recoverable_cost,
                                new_bk.adjusted_recoverable_cost)),
                  new_bk.salvage_type,
                  decode(new_bk.salvage_type,'PCT',new_bk.percent_salvage_value),
                  new_bk.deprn_limit_type,
                  decode(new_bk.deprn_limit_type,'PCT',new_bk.allowed_deprn_limit)
             from fa_mc_books new_bk,
                  fa_mc_books old_bk
            where new_bk.book_type_code = p_group_rule_in.book_type_code
              and new_bk.asset_id = h_member_asset_id
              and new_bk.transaction_header_id_in = h_adj_member_trans_header_id
              and new_bk.set_of_books_id = h_set_of_books_id
              and old_bk.book_type_code = new_bk.book_type_code
              and old_bk.asset_id = new_bk.asset_id
              and old_bk.transaction_header_id_out = new_bk.transaction_header_id_in
              and old_bk.set_of_books_id = h_set_of_books_id;
Line: 4017

   select sum(decode(adj.adjustment_type,'RESERVE',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS RESERVE',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),
	  nvl(sum(decode(adj.adjustment_type,'PROCEEDS CLR',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),0) -
	  nvl(sum(decode(adj.adjustment_type,'REMOVALCOST CLR',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),0)
     from fa_adjustments adj,
 	  fa_transaction_headers th1,
	  fa_transaction_headers th2
    where adj.transaction_header_id = th1.transaction_header_id
      and adj.asset_id = h_group_asset_id
      and adj.book_type_code = h_book_type_code
      and adj.period_counter_adjusted = h_period_counter
      and th1.asset_id = adj.asset_id
      and th1.member_transaction_header_id = th2.transaction_header_id
      and th2.asset_id = h_member_asset_id
      and th2.transaction_header_id <> nvl(h_adj_member_trans_header_id,0);
Line: 4048

   select sum(decode(adj.adjustment_type,'RESERVE',
                     decode(adj.debit_credit_flag,
                     'CR',adj.adjustment_amount,
                     'DR', -1 * adj.adjustment_amount))),
          sum(decode(adj.adjustment_type,'BONUS RESERVE',
                     decode(adj.debit_credit_flag,
                     'CR',adj.adjustment_amount,
                     'DR', -1 * adj.adjustment_amount))),
          nvl(sum(decode(adj.adjustment_type,'PROCEEDS CLR',
                     decode(adj.debit_credit_flag,
                     'DR',adj.adjustment_amount,
                     'CR', -1 * adj.adjustment_amount))),0) -
          nvl(sum(decode(adj.adjustment_type,'REMOVALCOST CLR',
                     decode(adj.debit_credit_flag,
                     'CR',adj.adjustment_amount,
                     'DR', -1 * adj.adjustment_amount))),0)
     from fa_adjustments adj,
          fa_transaction_headers th1
    where adj.transaction_header_id = th1.transaction_header_id
      and adj.asset_id = h_member_asset_id
      and adj.book_type_code = h_book_type_code
      and adj.period_counter_adjusted = h_period_counter
      and th1.asset_id = adj.asset_id
      and th1.transaction_header_id <> nvl(h_adj_member_trans_header_id,0);
Line: 4077

   select sum(decode(adj.adjustment_type,'RESERVE',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS RESERVE',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),
	  nvl(sum(decode(adj.adjustment_type,'PROCEEDS CLR',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),0) -
	  nvl(sum(decode(adj.adjustment_type,'REMOVALCOST CLR',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),0)
     from fa_adjustments adj
    where adj.book_type_code = h_book_type_code
      and adj.asset_id = h_member_asset_id
      and adj.period_counter_adjusted = h_period_counter
      and nvl(adj.track_member_flag, 'N') = 'N';   -- ENERGY
Line: 4101

   select sum(decode(adj.adjustment_type,'RESERVE',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS RESERVE',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),
	  nvl(sum(decode(adj.adjustment_type,'PROCEEDS CLR',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),0) +
	  nvl(sum(decode(adj.adjustment_type,'REMOVALCOST CLR',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),0)
     from fa_mc_adjustments adj,
 	  fa_transaction_headers th1,
	  fa_transaction_headers th2
    where adj.transaction_header_id = th1.transaction_header_id
      and adj.asset_id = h_group_asset_id
      and adj.book_type_code = h_book_type_code
      and adj.period_counter_adjusted = h_period_counter
      and adj.set_of_books_id = h_set_of_books_id
      and th1.asset_id = adj.asset_id
      and th1.member_transaction_header_id = th2.transaction_header_id
      and th2.asset_id = h_member_asset_id
      and th2.transaction_header_id <> nvl(h_adj_member_trans_header_id,0);
Line: 4131

   select sum(decode(adj.adjustment_type,'RESERVE',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS RESERVE',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),
	  nvl(sum(decode(adj.adjustment_type,'PROCEEDS CLR',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),0) +
	  nvl(sum(decode(adj.adjustment_type,'REMOVALCOST CLR',
	      	     decode(adj.debit_credit_flag,
		     'CR',adj.adjustment_amount,
		     'DR', -1 * adj.adjustment_amount))),0)
     from fa_mc_adjustments adj
    where adj.book_type_code = h_book_type_code
      and adj.asset_id = h_member_asset_id
      and adj.set_of_books_id = h_set_of_books_id
      and adj.period_counter_adjusted = h_period_counter
      and nvl(adj.track_member_flag, 'N') = 'N';   -- ENERGY
Line: 4155

   select ad.asset_type
     from fa_transaction_headers th,
          fa_additions_b ad
    where th.transaction_header_id = p_group_rule_in.adj_transaction_header_id
      and ad.asset_id = th.asset_id;
Line: 4162

   select new_bk.cost,
          new_bk.salvage_value,
          new_bk.adjusted_recoverable_cost,
          new_bk.salvage_type,
          new_bk.percent_salvage_value,
          new_bk.deprn_limit_type,
          new_bk.allowed_deprn_limit
     from fa_books new_bk
    where new_bk.book_type_code = p_group_rule_in.book_type_code
      and new_bk.asset_id = h_member_asset_id
      and new_bk.transaction_header_id_in = h_adj_member_trans_header_id;
Line: 4175

   select new_bk.cost,
          new_bk.salvage_value,
          new_bk.adjusted_recoverable_cost,
          new_bk.salvage_type,
          new_bk.percent_salvage_value,
          new_bk.deprn_limit_type,
          new_bk.allowed_deprn_limit
     from fa_mc_books new_bk
    where new_bk.book_type_code = p_group_rule_in.book_type_code
      and new_bk.asset_id = h_member_asset_id
      and new_bk.transaction_header_id_in = h_adj_member_trans_header_id
      and new_bk.set_of_books_id = h_set_of_books_id;
Line: 4189

  select exclude_fully_rsv_flag
    from fa_books
   where book_type_code = h_book_type_code
     and asset_id = h_group_asset_id
     and date_ineffective is null;
Line: 4196

  select exclude_fully_rsv_flag
    from fa_books_mrc_v
   where book_type_code = h_book_type_code
     and asset_id = h_group_asset_id
     and date_ineffective is null;
Line: 4207

    fa_debug_pkg.add(l_calling_fn, '+++ Update Depreciable Basis for member assets +++', '+++', p_log_level_rec);
Line: 4298

          select asset_id,transaction_type_code,transaction_key,nvl(amortization_start_date,transaction_date_entered)
            into h_asset_id,h_transaction_type_code,h_transaction_key,l_transaction_date_entered
            from fa_transaction_headers
           where transaction_header_id = h_adj_member_trans_header_id;
Line: 4305

          select fiscal_year_name, deprn_calendar
            into h_fiscal_year_name,h_calendar_type
            from fa_book_controls
           where book_type_code=h_book_type_code;
Line: 4310

          select fiscal_year into h_trans_fiscal_year
            from fa_fiscal_year
           where fiscal_year_name = h_fiscal_year_name
             and start_date <= l_transaction_date_entered
             and end_date >= l_transaction_date_entered;
Line: 4316

          select period_num into h_trans_period_num
            from fa_calendar_periods
           where calendar_type = h_calendar_type
             and start_date <= l_transaction_date_entered
             and end_date >= l_transaction_date_entered;
Line: 4437

              select recognize_gain_loss,nvl(eofy_reserve,0),(-1)*nvl(reserve_retired,0)
                into h_recognize_gain_loss,h_adj_eofy_reserve,h_reserve_retired
                from fa_retirements
               where transaction_header_id_in = h_adj_member_trans_header_id;
Line: 4443

              select recognize_gain_loss,nvl(eofy_reserve,0),(-1)*nvl(reserve_retired,0)
                into h_recognize_gain_loss,h_adj_eofy_reserve,h_reserve_retired
                from fa_mc_retirements
               where transaction_header_id_in = h_adj_member_trans_header_id
                 and set_of_books_id = h_set_of_books_id;
Line: 4556

        select asset_type into x_asset_type
          from fa_additions_b
         where asset_id = l_track_member.member_asset_id;
Line: 4659

           fa_debug_pkg.add(l_calling_fn, '++ Finally updated p_track_member_table ', i, p_log_level_rec);
Line: 4673

         fa_debug_pkg.add(l_calling_fn, 'period_Counter to be updated', (h_period_counter + 1), p_log_level_rec);
Line: 4734

        select asset_type into x_asset_type
          from fa_additions_b
         where asset_id = h_member_asset_id;
Line: 4849

           fa_debug_pkg.add(l_calling_fn, 'update_deprn:h_new_eofy_reserve', h_new_eofy_reserve, p_log_level_rec);
Line: 4883

              fa_debug_pkg.add(l_calling_fn, 'Updated fully reserved member asset', h_member_asset_id, p_log_level_rec);
Line: 4897

   else -- Regular Mode: Periodic Update after depreciation

     if p_group_rule_in.mrc_sob_type_code <> 'R' then

      For member in ALL_MEMBERS loop

         h_member_asset_id := member.member_asset_id;
Line: 4924

              select asset_id,transaction_type_code
                into h_asset_id,h_transaction_type_code
                from fa_transaction_headers
               where transaction_header_id = h_adj_member_trans_header_id;
Line: 4941

         select asset_type into x_asset_type
           from fa_additions_b
          where asset_id = member.member_asset_id;
Line: 5020

            select fiscal_year into h_ds_fy
              from fa_deprn_periods
             where book_type_code = h_book_type_code
               and period_counter = member.ds_period_counter;
Line: 5105

            fa_debug_pkg.add(l_calling_fn, '++ update FA_BOOKS for ',member.member_asset_id, p_log_level_rec);
Line: 5111

         update fa_books
            set adjusted_cost = fa_rule_out.new_adjusted_cost,
                eofy_adj_cost = h_eofy_adj_cost,
                eofy_reserve = h_new_eofy_reserve,
                eop_adj_cost = h_eop_adj_cost,
                prior_eofy_reserve = h_prior_eofy_reserve,
                adjustment_required_status='NONE'
          where book_type_code = p_group_rule_in.book_type_code
            and asset_id = member.member_asset_id
            and date_ineffective is null;
Line: 5149

              select asset_id,transaction_type_code
                into h_asset_id,h_transaction_type_code
                from fa_transaction_headers
               where transaction_header_id = h_adj_member_trans_header_id;
Line: 5166

         select asset_type into x_asset_type
           from fa_additions_b
          where asset_id = member.member_asset_id;
Line: 5230

            select fiscal_year into h_ds_fy
              from fa_deprn_periods
             where book_type_code = h_book_type_code
               and period_counter = member.ds_period_counter;
Line: 5312

            fa_debug_pkg.add(l_calling_fn, '++ update FA_BOOKS for ',member.member_asset_id, p_log_level_rec);
Line: 5318

         update fa_mc_books
            set adjusted_cost = fa_rule_out.new_adjusted_cost,
                eofy_adj_cost = h_eofy_adj_cost,
                eofy_reserve = h_new_eofy_reserve,
                eop_adj_cost = h_eop_adj_cost,
                prior_eofy_reserve = h_prior_eofy_reserve
          where book_type_code = p_group_rule_in.book_type_code
            and asset_id = member.member_asset_id
            and date_ineffective is null
            and set_of_books_id = h_set_of_books_id;
Line: 5349

end update_deprn_basis;
Line: 5400

  select member_asset_id,
         allocated_deprn_amount,
         fully_reserved_flag
    from fa_track_members
   where group_asset_id = p_group_asset_id
     and period_counter = p_period_counter
     and fiscal_year = p_fiscal_year
     and nvl(set_of_books_id,-99) = nvl(h_set_of_books_id,-99);
Line: 5452

    select fa_transaction_headers_s.nextval
      into p_transaction_header_id
      from dual;
Line: 5456

      FA_TRANSACTION_HEADERS_PKG.Insert_Row
                      (X_Rowid                          => l_rowid,
                       X_Transaction_Header_Id          => p_transaction_header_id,
                       X_Book_Type_Code                 => p_asset_hdr_rec.book_type_code,
                       X_Asset_Id                       => p_asset_hdr_rec.asset_id,
                       X_Transaction_Type_Code          => 'ADJUSTMENT',
                       X_Transaction_Date_Entered       => p_transaction_date_entered,
                       X_Date_Effective                 => sysdate,
                       X_Last_Update_Date               => sysdate,
                       X_Last_Updated_By                => -1,
                       X_Transaction_Name               => NULL,
                       X_Invoice_Transaction_Id         => NULL,
                       X_Source_Transaction_Header_Id   => NULL,
                       X_Mass_Reference_Id              => NULL,
                       X_Last_Update_Login              => -1,
                       X_Transaction_Subtype            => 'AMORTIZED',
                       X_Attribute1                     => null,
                       X_Attribute2                     => null,
                       X_Attribute3                     => null,
                       X_Attribute4                     => null,
                       X_Attribute5                     => null,
                       X_Attribute6                     => null,
                       X_Attribute7                     => null,
                       X_Attribute8                     => null,
                       X_Attribute9                     => null,
                       X_Attribute10                    => null,
                       X_Attribute11                    => null,
                       X_Attribute12                    => null,
                       X_Attribute13                    => null,
                       X_Attribute14                    => null,
                       X_Attribute15                    => null,
                       X_Attribute_Category_Code        => null,
                       X_Transaction_Key                => l_transaction_key,
                       X_Amortization_Start_Date        => NULL,
                       X_Calling_Interface              => null,
                       X_Mass_Transaction_ID            => null,
                       X_Return_Status                  => l_status,
                       X_Calling_Fn                     => 'fa_track_member_pvt.ins_dd_adj',
		       p_log_level_rec => p_log_level_rec
                      );
Line: 5523

             fa_books_pkg.insert_row
                     (X_Rowid                        => l_rowid,
                      X_Book_Type_Code               => p_asset_hdr_rec.book_type_code,
                      X_Asset_Id                     => p_asset_hdr_rec.asset_id,
                      X_Date_Placed_In_Service       => x_asset_fin_rec.date_placed_in_service,
                      X_Date_Effective               => sysdate,
                      X_Deprn_Start_Date             => x_asset_fin_rec.deprn_start_date,
                      X_Deprn_Method_Code            => x_asset_fin_rec.deprn_method_code,
                      X_Life_In_Months               => x_asset_fin_rec.life_in_months,
                      X_Rate_Adjustment_Factor       => x_asset_fin_rec.rate_adjustment_factor,
                      X_Adjusted_Cost                => x_asset_fin_rec.adjusted_cost,
                      X_Cost                         => x_asset_fin_rec.cost,
                      X_Original_Cost                => x_asset_fin_rec.original_cost,
                      X_Salvage_Value                => x_asset_fin_rec.salvage_value,
                      X_Prorate_Convention_Code      => x_asset_fin_rec.prorate_convention_code,
                      X_Prorate_Date                 => x_asset_fin_rec.prorate_date,
                      X_Cost_Change_Flag             => x_asset_fin_rec.cost_change_flag,
                      X_Adjustment_Required_Status   => x_asset_fin_rec.adjustment_required_status,
                      X_Capitalize_Flag              => x_asset_fin_rec.capitalize_flag,
                      X_Retirement_Pending_Flag      => x_asset_fin_rec.retirement_pending_flag,
                      X_Depreciate_Flag              => x_asset_fin_rec.depreciate_flag,
                      X_Last_Update_Date             => sysdate,
                      X_Last_Updated_By              => -1,
                      X_Date_Ineffective             => NULL,
                      X_Transaction_Header_Id_In     => p_transaction_header_id,
                      X_Transaction_Header_Id_Out    => NULL,
                      X_Itc_Amount_Id                => x_asset_fin_rec.itc_amount_id,
                      X_Itc_Amount                   => x_asset_fin_rec.itc_amount,
                      X_Retirement_Id                => x_asset_fin_rec.retirement_id,
                      X_Tax_Request_Id               => x_asset_fin_rec.tax_request_id,
                      X_Itc_Basis                    => x_asset_fin_rec.itc_basis,
                      X_Basic_Rate                   => x_asset_fin_rec.basic_rate,
                      X_Adjusted_Rate                => x_asset_fin_rec.adjusted_rate,
                      X_Bonus_Rule                   => x_asset_fin_rec.bonus_rule,
                      X_Ceiling_Name                 => x_asset_fin_rec.ceiling_name,
                      X_Recoverable_Cost             => x_asset_fin_rec.recoverable_cost,
                      X_Last_Update_Login            => -1,
                      X_Adjusted_Capacity            => x_asset_fin_rec.adjusted_capacity,
                      X_Fully_Rsvd_Revals_Counter    => x_asset_fin_rec.fully_rsvd_revals_counter,
                      X_Idled_Flag                   => x_asset_fin_rec.idled_flag,
                      X_Period_Counter_Capitalized   => x_asset_fin_rec.period_counter_capitalized,
                      X_PC_Fully_Reserved            => x_asset_fin_rec.period_counter_fully_reserved,
                      X_Period_Counter_Fully_Retired => x_asset_fin_rec.period_counter_fully_retired,
                      X_Production_Capacity          => x_asset_fin_rec.production_capacity,
                      X_Reval_Amortization_Basis     => x_asset_fin_rec.reval_amortization_basis,
                      X_Reval_Ceiling                => x_asset_fin_rec.reval_ceiling,
                      X_Unit_Of_Measure              => x_asset_fin_rec.unit_of_measure,
                      X_Unrevalued_Cost              => x_asset_fin_rec.unrevalued_cost,
                      X_Annual_Deprn_Rounding_Flag   => 'ADJ',
                      X_Percent_Salvage_Value        => x_asset_fin_rec.percent_salvage_value,
                      X_Allowed_Deprn_Limit          => x_asset_fin_rec.allowed_deprn_limit,
                      X_Allowed_Deprn_Limit_Amount   => x_asset_fin_rec.allowed_deprn_limit_amount,
                      X_Period_Counter_Life_Complete => x_asset_fin_rec.period_counter_life_complete,
                      X_Adjusted_Recoverable_Cost    => x_asset_fin_rec.adjusted_recoverable_cost,
                      X_Short_Fiscal_Year_Flag       => x_asset_fin_rec.short_fiscal_year_flag,
                      X_Conversion_Date              => x_asset_fin_rec.conversion_date,
                      X_Orig_Deprn_Start_Date        => x_asset_fin_rec.orig_deprn_start_date,
                      X_Remaining_Life1              => x_asset_fin_rec.remaining_life1,
                      X_Remaining_Life2              => x_asset_fin_rec.remaining_life2,
                      X_Old_Adj_Cost                 => x_asset_fin_rec.old_adjusted_cost,
                      X_Formula_Factor               => x_asset_fin_rec.formula_factor,
                      X_gf_Attribute1                => x_asset_fin_rec.global_attribute1,
                      X_gf_Attribute2                => x_asset_fin_rec.global_attribute2,
                      X_gf_Attribute3                => x_asset_fin_rec.global_attribute3,
                      X_gf_Attribute4                => x_asset_fin_rec.global_attribute4,
                      X_gf_Attribute5                => x_asset_fin_rec.global_attribute5,
                      X_gf_Attribute6                => x_asset_fin_rec.global_attribute6,
                      X_gf_Attribute7                => x_asset_fin_rec.global_attribute7,
                      X_gf_Attribute8                => x_asset_fin_rec.global_attribute8,
                      X_gf_Attribute9                => x_asset_fin_rec.global_attribute9,
                      X_gf_Attribute10               => x_asset_fin_rec.global_attribute10,
                      X_gf_Attribute11               => x_asset_fin_rec.global_attribute11,
                      X_gf_Attribute12               => x_asset_fin_rec.global_attribute12,
                      X_gf_Attribute13               => x_asset_fin_rec.global_attribute13,
                      X_gf_Attribute14               => x_asset_fin_rec.global_attribute14,
                      X_gf_Attribute15               => x_asset_fin_rec.global_attribute15,
                      X_gf_Attribute16               => x_asset_fin_rec.global_attribute16,
                      X_gf_Attribute17               => x_asset_fin_rec.global_attribute17,
                      X_gf_Attribute18               => x_asset_fin_rec.global_attribute18,
                      X_gf_Attribute19               => x_asset_fin_rec.global_attribute19,
                      X_gf_Attribute20               => x_asset_fin_rec.global_attribute20,
                      X_global_attribute_category    => x_asset_fin_rec.global_attribute_category,
                      X_group_asset_id               => x_asset_fin_rec.group_asset_id,
                      X_salvage_type                 => x_asset_fin_rec.salvage_type,
                      X_deprn_limit_type             => x_asset_fin_rec.deprn_limit_type,
                      X_over_depreciate_option       => x_asset_fin_rec.over_depreciate_option,
                      X_super_group_id               => x_asset_fin_rec.super_group_id,
                      X_reduction_rate               => x_asset_fin_rec.reduction_rate,
                      X_reduce_addition_flag         => x_asset_fin_rec.reduce_addition_flag,
                      X_reduce_adjustment_flag       => x_asset_fin_rec.reduce_adjustment_flag,
                      X_reduce_retirement_flag       => x_asset_fin_rec.reduce_retirement_flag,
                      X_recognize_gain_loss          => x_asset_fin_rec.recognize_gain_loss,
                      X_recapture_reserve_flag       => x_asset_fin_rec.recapture_reserve_flag,
                      X_limit_proceeds_flag          => x_asset_fin_rec.limit_proceeds_flag,
                      X_terminal_gain_loss           => x_asset_fin_rec.terminal_gain_loss,
                      X_tracking_method              => x_asset_fin_rec.tracking_method,
                      X_allocate_to_fully_rsv_flag   => x_asset_fin_rec.allocate_to_fully_rsv_flag,
                      X_allocate_to_fully_ret_flag   => x_asset_fin_rec.allocate_to_fully_ret_flag,
                      X_exclude_fully_rsv_flag       => x_asset_fin_rec.exclude_fully_rsv_flag,
                      X_excess_allocation_option     => x_asset_fin_rec.excess_allocation_option,
                      X_depreciation_option          => x_asset_fin_rec.depreciation_option,
                      X_member_rollup_flag           => x_asset_fin_rec.member_rollup_flag,
                      X_ytd_proceeds                 => x_asset_fin_rec.ytd_proceeds,
                      X_ltd_proceeds                 => x_asset_fin_rec.ltd_proceeds,
                      X_eofy_reserve                 => x_asset_fin_rec.eofy_reserve,
                      X_cip_cost                     => x_asset_fin_rec.cip_cost,
                      X_terminal_gain_loss_amount    => x_asset_fin_rec.terminal_gain_loss_amount,
                      X_ltd_cost_of_removal          => x_asset_fin_rec.ltd_cost_of_removal,
                      X_exclude_proceeds_from_basis  => x_asset_fin_rec.exclude_proceeds_from_basis,
                      X_retirement_deprn_option      => x_asset_fin_rec.retirement_deprn_option,
                      X_terminal_gain_loss_flag      => x_asset_fin_rec.terminal_gain_loss_flag,
                      X_mrc_sob_type_code            => p_mrc_sob_type_code,
                      X_Return_Status                => l_status,
                      X_Calling_Fn                   => 'fa_track_member_pvt.ins_dd_adj',
		      p_log_level_rec => p_log_level_rec
               );
Line: 5656

             l_adj.selection_mode           := FA_ADJUST_TYPE_PKG.FA_AJ_ACTIVE;
Line: 5657

             l_adj.selection_thid           := 0;
Line: 5658

             l_adj.selection_retid          := 0;
Line: 5660

             l_adj.last_update_date         := sysdate;
Line: 5698

              select sum(nvl(deprn_adjustment_amount, 0))
                into l_deprn_adjustment_amount
                from fa_deprn_detail_mrc_v
               where asset_id       = p_asset_hdr_rec.asset_id
                 and book_type_code = p_asset_hdr_rec.book_type_code;
Line: 5706

             select sum(nvl(deprn_adjustment_amount, 0))
               into l_deprn_adjustment_amount
               from fa_deprn_detail
              where asset_id       = p_asset_hdr_rec.asset_id
                and book_type_code = p_asset_hdr_rec.book_type_code;
Line: 5741

           FA_DEPRN_SUMMARY_PKG.Update_Row
                      (X_Book_Type_Code                 => p_asset_hdr_rec.book_type_code,
                       X_Asset_Id                       => p_asset_hdr_rec.asset_id,
                       X_Ytd_Deprn                      => l_asset_deprn_rec.ytd_deprn,
                       X_Deprn_Reserve                  => l_asset_deprn_rec.deprn_reserve,
                       X_Period_Counter                 => p_period_counter - 1,
                       X_mrc_sob_type_code              => p_mrc_sob_type_code,
                       X_Calling_Fn                     => 'fa_track_member_pvt.ins_dd_adj',
		       p_log_level_rec => p_log_level_rec
                      );
Line: 5871

      select mth.asset_id
      from   fa_transaction_headers mth
--           , fa_transaction_headers gth
--      where  gth.transaction_header_id = p_transaction_header_id
--      and    mth.transaction_header_id = gth.member_transaction_header_id;
Line: 5881

  select nvl(calendar_period_close_date,sysdate)
    from fa_deprn_periods
   where book_type_code = h_book_type_code
     and period_counter = h_loop_period_counter;
Line: 5887

  select nvl(calendar_period_close_date,sysdate)
    from fa_mc_deprn_periods
   where book_type_code = h_book_type_code
     and period_counter = h_loop_period_counter
     and set_of_books_id = h_set_of_books_id;
Line: 5895

  select nvl(amortization_start_date,transaction_date_entered), asset_id, transaction_type_code
    from fa_transaction_headers
   where book_type_code = h_book_type_code
     and transaction_header_id = p_transaction_header_id;
Line: 5902

  select bk.asset_id
    from fa_books  bk,
         fa_additions_b ad
   where bk.book_type_code = h_book_type_code
     and bk.group_asset_id = h_group_asset_id
     and bk.date_placed_in_service <= h_date
     and bk.depreciate_flag = 'YES'
     and bk.date_ineffective is null
     and ad.asset_id = bk.asset_id
     and ad.asset_type = 'CAPITALIZED'
     and bk.asset_id = nvl(l_member_asset_id, bk.asset_id)
   order by ad.asset_number;
Line: 5916

  select bk.asset_id
    from fa_mc_books  bk,
         fa_additions_b ad
   where bk.book_type_code = h_book_type_code
     and bk.group_asset_id = h_group_asset_id
     and bk.set_of_books_id = h_set_of_books_id
     and bk.date_placed_in_service <= h_date
     and bk.depreciate_flag = 'YES'
     and bk.date_ineffective is null
     and bk.set_of_books_id = h_set_of_books_id
     and ad.asset_id = bk.asset_id
     and ad.asset_type = 'CAPITALIZED'
   order by ad.asset_number;
Line: 5932

  select bk.cost,
         bk.adjusted_cost,
         bk.recoverable_cost,
         bk.salvage_value,
         bk.adjusted_recoverable_cost,
         bk.period_counter_fully_reserved,
         bk.period_counter_fully_retired,
         decode(ds.deprn_source_code,'BOOKS',ds.deprn_reserve - ds.ytd_deprn,
                decode(dp1.fiscal_year,h_fiscal_year,ds.deprn_reserve - ds.ytd_deprn,
                       ds.deprn_reserve)), -- bk.eofy_reserve,
         ds.deprn_reserve,
         decode(dp1.fiscal_year,h_fiscal_year,ds.ytd_deprn,0),
         ds.bonus_deprn_reserve,
         decode(dp1.fiscal_year,h_fiscal_year,ds.bonus_ytd_deprn,0),
         dp1.fiscal_year
    from fa_books  bk,
         fa_deprn_periods dp,
         fa_deprn_periods dp1,
         fa_deprn_summary ds,
         fa_additions_b ad
   where dp.book_type_code = h_book_type_code
     and dp.period_counter = h_loop_period_counter
     and bk.book_type_code = dp.book_type_code
     and bk.asset_id = p_member_asset_id
     and (bk.transaction_header_id_out = p_transaction_header_id or
          bk.transaction_header_id_out = h_last_trans_id or
         (bk.date_ineffective is null and
          bk.transaction_header_id_in <> nvl(p_transaction_header_id,-1) and
          not exists (select 'y'
                        from fa_books bk1
                       where bk1.book_type_code = bk.book_type_code
                         and bk1.asset_id = bk.asset_id
                         and bk1.transaction_header_id_out = nvl(p_transaction_header_id,-1))))
     and bk.depreciate_flag = 'YES'
     and ds.book_type_code = bk.book_type_code
     and ds.period_counter =
         (select min(period_counter)
            from fa_deprn_summary ds1
           where ds1.book_type_code = h_book_type_code
             and ds1.asset_id = bk.asset_id
             and ds1.period_counter >= h_period_counter - 1)
     and ds.asset_id = bk.asset_id
     and dp1.book_type_code = h_book_type_code
     and dp1.period_counter = ds.period_counter
     and ad.asset_id = bk.asset_id
     and ad.asset_type = 'CAPITALIZED'
   order by ad.asset_number;
Line: 5981

  select bk.cost,
         bk.adjusted_cost,
         bk.recoverable_cost,
         bk.salvage_value,
         bk.adjusted_recoverable_cost,
         bk.period_counter_fully_reserved,
         bk.period_counter_fully_retired,
         decode(ds.deprn_source_code,'BOOKS',ds.deprn_reserve - ds.ytd_deprn,
                decode(dp1.fiscal_year,h_fiscal_year,ds.deprn_reserve - ds.ytd_deprn,
                ds.deprn_reserve)), -- bk.eofy_reserve,
         ds.deprn_reserve,
         decode(dp1.fiscal_year,h_fiscal_year,ds.ytd_deprn,0),
         ds.bonus_deprn_reserve,
         decode(dp1.fiscal_year,h_fiscal_year,ds.bonus_ytd_deprn,0),
         dp1.fiscal_year
    from fa_mc_books  bk,
         fa_mc_deprn_periods dp,
         fa_mc_deprn_periods dp1,
         fa_mc_deprn_summary ds,
         fa_additions_b ad
   where dp.book_type_code = h_book_type_code
     and dp.period_counter = h_loop_period_counter
     and dp.set_of_books_id = h_set_of_books_id
     and bk.book_type_code = dp.book_type_code
     and bk.asset_id = p_member_asset_id
     and bk.set_of_books_id = h_set_of_books_id
     and (bk.transaction_header_id_out = p_transaction_header_id or
         bk.transaction_header_id_out = h_last_trans_id or
         (bk.date_ineffective is null and
          bk.transaction_header_id_in <> nvl(p_transaction_header_id,-1) and
          not exists (select 'y'
                        from fa_books_mrc_v bk1
                       where bk1.book_type_code = bk.book_type_code
                         and bk1.asset_id = bk.asset_id
                         and bk1.transaction_header_id_out = nvl(p_transaction_header_id,-1))))
     and bk.depreciate_flag = 'YES'
     and ds.book_type_code = bk.book_type_code
     and ds.period_counter =
         (select min(period_counter)
            from fa_mc_deprn_summary ds1
           where ds1.book_type_code = h_book_type_code
             and ds1.asset_id = bk.asset_id
             and ds1.period_counter >= h_period_counter - 1)
     and ds.set_of_books_id = h_set_of_books_id
     and ds.asset_id = bk.asset_id
     and dp1.book_type_code = h_book_type_code
     and dp1.period_counter = ds.period_counter
     and dp1.set_of_books_id = h_set_of_books_id
     and ad.asset_id = bk.asset_id
     and ad.asset_type = 'CAPITALIZED'
   order by ad.asset_number;
Line: 6035

  select bk.cost,
         bk.adjusted_cost,
         bk.recoverable_cost,
         bk.salvage_value,
         bk.adjusted_recoverable_cost,
         bk.period_counter_fully_reserved,
         bk.period_counter_fully_retired,
         decode(ds.deprn_source_code,'BOOKS',ds.deprn_reserve - ds.ytd_deprn,
                decode(dp.fiscal_year,h_fiscal_year,ds.deprn_reserve - ds.ytd_deprn,
                       ds.deprn_reserve)), -- bk.eofy_reserve,
         ds.deprn_reserve,
         ds.ytd_deprn,
         ds.bonus_deprn_reserve,
         ds.bonus_ytd_deprn,
         dp.fiscal_year
    from fa_books  bk,
         fa_deprn_periods dp,
         fa_deprn_summary ds,
         fa_additions_b ad
   where dp.book_type_code = h_book_type_code
     and dp.period_counter = h_loop_period_counter
     and bk.book_type_code = dp.book_type_code
     and bk.asset_id = p_member_asset_id
     and bk.date_ineffective is null
     and bk.depreciate_flag = 'YES'
     and ds.book_type_code = bk.book_type_code
     and ds.period_counter =
         (select min(period_counter)
            from fa_deprn_summary ds1
           where ds1.book_type_code = h_book_type_code
             and ds1.asset_id = bk.asset_id
             and ds1.period_counter >= h_period_counter - 1)
     and ds.asset_id = bk.asset_id
     and ad.asset_id = bk.asset_id
     and ad.asset_type = 'CAPITALIZED'
   order by ad.asset_number;
Line: 6073

  select bk.cost,
         bk.adjusted_cost,
         bk.recoverable_cost,
         bk.salvage_value,
         bk.adjusted_recoverable_cost,
         bk.period_counter_fully_reserved,
         bk.period_counter_fully_retired,
         decode(ds.deprn_source_code,'BOOKS',ds.deprn_reserve - ds.ytd_deprn,
                decode(dp.fiscal_year,h_fiscal_year,ds.deprn_reserve - ds.ytd_deprn,
                       ds.deprn_reserve)), -- bk.eofy_reserve,
         ds.deprn_reserve,
         ds.ytd_deprn,
         ds.bonus_deprn_reserve,
         ds.bonus_ytd_deprn,
         dp.fiscal_year
    from fa_mc_books  bk,
         fa_mc_deprn_periods dp,
         fa_mc_deprn_summary ds,
         fa_additions_b ad
   where dp.book_type_code = h_book_type_code
     and dp.period_counter = h_loop_period_counter
     and dp.set_of_books_id = h_set_of_books_id
     and bk.book_type_code = dp.book_type_code
     and bk.asset_id = p_member_asset_id
     and bk.set_of_books_id = h_set_of_books_id
     and bk.date_ineffective is null
     and bk.depreciate_flag = 'YES'
     and ds.book_type_code = bk.book_type_code
     and ds.period_counter =
         (select min(period_counter)
            from fa_mc_deprn_summary ds1
           where ds1.book_type_code = h_book_type_code
             and ds1.asset_id = bk.asset_id
             and ds1.period_counter >= h_period_counter - 1)
     and ds.set_of_books_id = h_set_of_books_id
     and ds.asset_id = bk.asset_id
     and ad.asset_id = bk.asset_id
     and ad.asset_type = 'CAPITALIZED'
   order by ad.asset_number;
Line: 6114

  select bk.recoverable_cost,
         bk.salvage_value
    from fa_books  bk,
         fa_deprn_periods dp
   where bk.book_type_code = h_book_type_code
     and bk.group_asset_id = h_member_asset_id
     and bk.date_effective <= nvl(dp.period_close_date,sysdate)
     and nvl(bk.date_ineffective,sysdate) >= nvl(dp.period_close_date,sysdate)
     and dp.book_type_code = bk.book_type_code
     and dp.fiscal_year = h_fiscal_year - 1
     and dp.period_num = (select max(period_num) from fa_deprn_periods dp1
                           where dp1.book_type_code = h_book_type_code
                             and dp1.fiscal_year = h_fiscal_year - 1);
Line: 6129

  select bk.recoverable_cost,
         bk.salvage_value
    from fa_mc_books  bk,
         fa_mc_deprn_periods dp
   where bk.book_type_code = h_book_type_code
     and bk.group_asset_id = h_member_asset_id
     and bk.set_of_books_id = h_set_of_books_id
     and bk.date_effective <= nvl(dp.period_close_date,sysdate)
     and nvl(bk.date_ineffective,sysdate) >= nvl(dp.period_close_date,sysdate)
     and dp.book_type_code = bk.book_type_code
     and dp.fiscal_year = h_fiscal_year - 1
     and dp.period_num = (select max(period_num) from fa_mc_deprn_periods dp1
                           where dp1.book_type_code = h_book_type_code
                             and dp1.fiscal_year = h_fiscal_year - 1
                             and dp1.set_of_books_id = h_set_of_books_id)
     and dp.set_of_books_id = h_set_of_books_id;
Line: 6147

  select period_counter + 1
    from fa_deprn_periods
   where book_type_code = h_book_type_code
     and fiscal_year = h_loop_end_year
     and period_num = h_loop_end_period;
Line: 6154

  select period_counter + 1
    from fa_mc_deprn_periods
   where book_type_code = h_book_type_code
     and fiscal_year = h_loop_end_year
     and period_num = h_loop_end_period
     and set_of_books_id = h_set_of_books_id;
Line: 6163

  select sum(nvl(ret.reserve_retired,0) - nvl(ret.eofy_reserve,0))
    from fa_retirements ret
   where ret.book_type_code = h_book_type_code
     and ret.asset_id = h_member_asset_id
     and exists
         (select th1.transaction_header_id
            from fa_transaction_headers th1,
                 fa_deprn_periods dp1,
                 fa_deprn_periods dp3
           where th1.asset_id = ret.asset_id
             and dp1.book_type_code = h_book_type_code
             and dp1.fiscal_year =
                 (select dp2.fiscal_year
                    from fa_deprn_periods dp2
                   where dp2.book_type_code = dp1.book_type_code
                     and dp2.period_Counter = h_period_counter - 1)
             and dp1.period_num = 1
             and dp3.book_type_code = dp1.book_type_code
             and dp3.period_counter = h_period_counter - 1
             and nvl(th1.amortization_start_date,th1.transaction_date_entered) >= dp1.calendar_period_open_date
             and nvl(th1.amortization_start_date,th1.transaction_date_entered) <= dp3.calendar_period_close_date
             and th1.transaction_type_code in ('PARTIAL RETIREMENT','FULL RETIREMENT')
             and th1.transaction_header_id = ret.transaction_header_id_in);
Line: 6188

  select sum(nvl(ret.reserve_retired,0) - nvl(ret.eofy_reserve,0))
    from fa_mc_retirements ret
   where ret.book_type_code = h_book_type_code
     and ret.asset_id = h_member_asset_id
     and ret.set_of_books_id = h_set_of_books_id
     and exists
         (select th1.transaction_header_id
            from fa_transaction_headers th1,
                 fa_deprn_periods dp1,
                 fa_deprn_periods dp3
           where th1.asset_id = ret.asset_id
             and dp1.book_type_code = h_book_type_code
             and dp1.fiscal_year =
                 (select dp2.fiscal_year
                    from fa_deprn_periods dp2
                   where dp2.book_type_code = dp1.book_type_code
                     and dp2.period_Counter = h_period_counter - 1)
             and dp1.period_num = 1
             and dp3.book_type_code = dp1.book_type_code
             and dp3.period_counter = h_period_counter - 1
             and nvl(th1.amortization_start_date,th1.transaction_date_entered) >= dp1.calendar_period_open_date
             and nvl(th1.amortization_start_date,th1.transaction_date_entered) <= dp3.calendar_period_close_date
             and th1.transaction_type_code in ('PARTIAL RETIREMENT','FULL RETIREMENT')
             and th1.transaction_header_id = ret.transaction_header_id_in);
Line: 6214

   select sum(decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))
     from fa_adjustments adj
    where adj.book_type_code = h_book_type_code
      and adj.asset_id = h_member_asset_id
      and adj.adjustment_type = 'RESERVE'
      and adj.source_type_code = 'ADJUSTMENT'
      and nvl(adj.track_member_flag, 'N') = 'N' -- ENERGY
      and adj.period_counter_adjusted in
         (select dp2.period_counter
            from fa_deprn_periods dp1,
                 fa_deprn_periods dp2
           where dp1.book_type_code = adj.book_type_code
             and dp1.period_counter = h_period_counter - 1
             and dp2.book_type_code = dp1.book_type_code
             and dp2.fiscal_year = dp1.fiscal_year
             and dp2.period_counter <= dp1.period_counter);
Line: 6234

   select sum(decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))
     from fa_mc_adjustments adj
    where adj.book_type_code = h_book_type_code
      and adj.asset_id = h_member_asset_id
      and adj.adjustment_type = 'RESERVE'
      and adj.source_type_code = 'ADJUSTMENT'
      and adj.set_of_books_id = h_set_of_books_id
      and nvl(adj.track_member_flag, 'N') = 'N'    -- ENERGY
      and adj.period_counter_adjusted in
         (select dp2.period_counter
            from fa_mc_deprn_periods dp1,
                 fa_mc_deprn_periods dp2
           where dp1.book_type_code = adj.book_type_code
             and dp1.period_counter = h_period_counter - 1
             and dp1.set_of_books_id = h_set_of_books_id
             and dp2.book_type_code = dp1.book_type_code
             and dp2.fiscal_year = dp1.fiscal_year
             and dp2.set_of_books_id = h_set_of_books_id
             and dp2.period_counter <= dp1.period_counter);
Line: 6257

   select ds.deprn_reserve,
          ds.ytd_deprn
     from fa_deprn_summary ds
    where ds.book_type_code=h_book_type_code
      and ds.asset_id=h_member_asset_id
      and ds.deprn_source_code='BOOKS';
Line: 6265

   select ds.deprn_reserve,
          ds.ytd_deprn
     from fa_mc_deprn_summary ds
    where ds.book_type_code=h_book_type_code
      and ds.asset_id=h_member_asset_id
      and ds.deprn_source_code='BOOKS'
      and ds.set_of_books_id=h_set_of_books_id;
Line: 6274

  select nvl(amortization_start_date,transaction_date_entered)
    from fa_transaction_headers
   where transaction_type_code = 'ADDITION'
     and asset_id = h_member_asset_id;
Line: 6281

  select TH.TRANSACTION_HEADER_ID
    from FA_TRANSACTION_HEADERS TH,
         FA_TRANSACTION_HEADERS TH1,
         FA_CALENDAR_PERIODS DP,
         FA_FISCAL_YEAR FY
   where DP.calendar_type = fa_cache_pkg.fazcbc_record.deprn_calendar
     and FY.fiscal_year_name = fa_cache_pkg.fazcbc_record.fiscal_year_name
     and TH.asset_id = p_member_asset_id
     and TH.transaction_type_code not in ('TRANSFER OUT', 'TRANSFER IN', 'TRANSFER', 'TRANSFER IN/VOID',
                                          'RECLASS', 'UNIT ADJUSTMENT','REINSTATEMENT')
     and nvl(TH.amortization_start_date,TH.transaction_date_entered) between DP.start_date and DP.end_date
     and DP.start_date >= FY.start_date
     and DP.end_date <= FY.end_date
     and TH1.transaction_header_id = p_trans_id
     and nvl(TH1.amortization_start_date,TH1.transaction_date_entered) between DP.start_date and DP.end_date
     and nvl(TH.amortization_start_date,TH.transaction_date_entered) <= nvl(TH1.amortization_start_date,TH1.transaction_date_entered)
order by nvl(TH.amortization_start_date,TH.transaction_date_entered), TH.transaction_header_id desc;
Line: 6355

    select deprn_method_code,life_in_months
      into h_method_code,h_life_in_months
      from fa_books
     where book_type_code = h_book_type_code
       and asset_id = h_group_asset_id
       and date_ineffective is null;
Line: 6388

   select DP.end_date into h_transaction_date
     from FA_FISCAL_YEAR FY,
          FA_CALENDAR_PERIODS DP
    where DP.calendar_type = fa_cache_pkg.fazcbc_record.deprn_calendar
      and DP.period_num = p_period_counter - p_fiscal_year*h_perd_per_fiscal_year
      and FY.fiscal_year_name = fa_cache_pkg.fazcbc_record.fiscal_year_name
      and FY.fiscal_year = p_fiscal_year
      and DP.start_date >= FY.start_date
      and DP.end_date <= FY.end_date;
Line: 6623

    select deprn_method_code,life_in_months
      into h_method_code,h_life_in_months
      from fa_mc_books
     where book_type_code = h_book_type_code
       and asset_id = h_group_asset_id
       and date_ineffective is null
       and set_of_books_id = h_set_of_books_id;
Line: 6657

   select DP.end_date into h_transaction_date
     from FA_FISCAL_YEAR FY,
          FA_CALENDAR_PERIODS DP
    where DP.calendar_type = fa_cache_pkg.fazcbc_record.deprn_calendar
      and DP.period_num = p_period_counter - p_fiscal_year*h_perd_per_fiscal_year
      and FY.fiscal_year_name = fa_cache_pkg.fazcbc_record.fiscal_year_name
      and FY.fiscal_year = p_fiscal_year
      and DP.start_date >= FY.start_date
      and DP.end_date <= FY.end_date;
Line: 6985

  select TH.TRANSACTION_HEADER_ID
    from FA_TRANSACTION_HEADERS TH,
         FA_FISCAL_YEAR FY,
         FA_CALENDAR_PERIODS DP
   where DP.calendar_type = h_calendar_type
     and DP.period_num = p_period_num
     and FY.fiscal_year_name = h_fiscal_year_name
     and FY.fiscal_year = p_fiscal_year
     and TH.asset_id = p_member_asset_id
     and TH.transaction_type_code not in ('TRANSFER OUT', 'TRANSFER IN', 'TRANSFER', 'TRANSFER IN/VOID',
                                          'RECLASS', 'UNIT ADJUSTMENT','REINSTATEMENT')
     and nvl(th.amortization_start_date,TH.transaction_date_entered) <= DP.end_date
     and DP.start_date >= FY.start_date
     and DP.end_date <= FY.end_date
order by nvl(th.amortization_start_date,TH.transaction_date_entered), TH.transaction_header_id asc;
Line: 7003

  select BK_IN.COST - nvl(BK_OUT.COST,0) delta_cost,
         BK_IN.RECOVERABLE_COST - nvl(BK_OUT.RECOVERABLE_COST,0) delta_rec_cost,
         BK_IN.DEPRN_LIMIT_TYPE new_limit_type,
         BK_OUT.DEPRN_LIMIT_TYPE old_limit_type,
         BK_IN.ALLOWED_DEPRN_LIMIT new_deprn_limit,
         BK_IN.ALLOWED_DEPRN_LIMIT_AMOUNT new_deprn_limit_amount,
         BK_IN.DEPRECIATE_FLAG depreciate_flag
    from FA_BOOKS BK_IN,
         FA_BOOKS BK_OUT
   where BK_IN.book_type_code = h_book_type_code
     and BK_IN.asset_id = h_member_asset_id
     and BK_IN.transaction_header_id_in = p_transaction_header_id
     and BK_OUT.book_type_code(+) = BK_IN.book_type_code
     and BK_OUT.asset_id(+) = BK_IN.asset_id
     and BK_OUT.transaction_header_id_out(+) = BK_IN.transaction_header_id_in;
Line: 7020

  select BK_IN.COST - nvl(BK_OUT.COST,0) delta_cost,
         BK_IN.RECOVERABLE_COST - nvl(BK_OUT.RECOVERABLE_COST,0) delta_rec_cost,
         BK_IN.DEPRN_LIMIT_TYPE new_limit_type,
         BK_OUT.DEPRN_LIMIT_TYPE old_limit_type,
         BK_IN.ALLOWED_DEPRN_LIMIT new_deprn_limit,
         BK_IN.ALLOWED_DEPRN_LIMIT_AMOUNT old_deprn_limit,
         BK_IN.DEPRECIATE_FLAG depreciate_flag
    from FA_BOOKS_MRC_V BK_IN,
         FA_BOOKS_MRC_V BK_OUT
   where BK_IN.book_type_code = h_book_type_code
     and BK_IN.asset_id = h_member_asset_id
     and BK_IN.transaction_header_id_in = p_transaction_header_id
     and BK_OUT.book_type_code(+) = BK_IN.book_type_code
     and BK_OUT.asset_id(+) = BK_IN.asset_id
     and BK_OUT.transaction_header_id_out(+) = BK_IN.transaction_header_id_in;
Line: 7038

select distinct bk.asset_id member_asset_id, ad.asset_number
  from fa_books bk,
       fa_additions_b ad
 where bk.book_type_code = h_book_type_code
   and bk.group_asset_id = h_group_asset_id
   and bk.depreciate_flag = 'YES'
   and exists
         (select TH1.TRANSACTION_HEADER_ID
            from FA_TRANSACTION_HEADERS TH1,
                 FA_CALENDAR_PERIODS DP1,
                 FA_FISCAL_YEAR FY
           where TH1.book_type_code = BK.book_type_code
             and DP1.calendar_type = h_calendar_type
             and DP1.period_num = p_period_num
             and FY.fiscal_year_name = h_fiscal_year_name
             and FY.fiscal_year = p_fiscal_year
             and nvl(TH1.amortization_start_date,TH1.transaction_date_entered) <= DP1.end_date
             and DP1.end_date <= FY.end_date
             and BK.TRANSACTION_HEADER_ID_IN = TH1.TRANSACTION_HEADER_ID)
   and ad.asset_id = bk.asset_id
   and ad.asset_type = 'CAPITALIZED'
   order by ad.asset_number asc;
Line: 7062

select distinct bk.asset_id member_asset_id, ad.asset_number
  from fa_books_mrc_v bk,
       fa_additions_b ad
 where bk.book_type_code = h_book_type_code
   and bk.group_asset_id = h_group_asset_id
   and bk.depreciate_flag = 'YES'
   and exists
         (select TH1.TRANSACTION_HEADER_ID
            from FA_TRANSACTION_HEADERS TH1,
                 FA_CALENDAR_PERIODS DP1,
                 FA_FISCAL_YEAR FY
           where TH1.book_type_code = BK.book_type_code
             and DP1.calendar_type = h_calendar_type
             and DP1.period_num = p_period_num
             and FY.fiscal_year_name = h_fiscal_year_name
             and FY.fiscal_year = p_fiscal_year
             and nvl(TH1.amortization_start_date,TH1.transaction_date_entered) <= DP1.end_date
             and DP1.end_date <= FY.end_date
             and BK.TRANSACTION_HEADER_ID_IN = TH1.TRANSACTION_HEADER_ID)
   and ad.asset_id = bk.asset_id
   and ad.asset_type = 'CAPITALIZED'
   order by ad.asset_number asc;
Line: 7086

  select BK_IN.group_asset_id
    from fa_books BK_IN
   where BK_IN.book_type_code = h_book_type_code
     and BK_IN.asset_id = p_member_asset_id
     and BK_IN.transaction_header_id_in = p_thid;
Line: 7093

  select BK_IN.group_asset_id
    from fa_books_mrc_v BK_IN
   where BK_IN.book_type_code = h_book_type_code
     and BK_IN.asset_id = p_member_asset_id
     and BK_IN.transaction_header_id_in = p_thid;
Line: 7100

  select deprn_source_code,
         ytd_deprn,
         deprn_reserve
    from fa_deprn_summary
   where book_type_code = h_book_type_code
     and asset_id = p_asset_id
     and period_counter = p_period_counter;
Line: 7109

  select deprn_source_code,
         ytd_deprn,
         deprn_reserve
    from fa_deprn_summary_mrc_v
   where book_type_code = h_book_type_code
     and asset_id = p_asset_id
     and period_counter = p_period_counter;
Line: 7125

p_track_member_table.delete;
Line: 7144

select fiscal_year_name, deprn_calendar
  into h_fiscal_year_name,h_calendar_type
  from fa_book_controls
 where book_type_code = h_book_type_code;
Line: 7392

     select ASSET_TYPE
       into fa_rule_in.asset_type
       from fa_additions_b
      where asset_id = h_member_asset_id;
Line: 7632

     select ASSET_TYPE
       into fa_rule_in.asset_type
       from fa_additions_b
      where asset_id = h_member_asset_id;
Line: 7732

FUNCTION update_member_books(p_trans_rec          in FA_API_TYPES.trans_rec_type,
                             p_asset_hdr_rec      in FA_API_TYPES.asset_hdr_rec_type,
                             p_dpr_in             in FA_STD_TYPES.dpr_struct,
                             p_mrc_sob_type_code  in varchar2,
			     p_log_level_rec      IN     FA_API_TYPES.log_level_rec_type default null) -- default 'N'
  return boolean is

--* Host related variables
h_book_type_code        varchar2(15);
Line: 7751

l_calling_fn            varchar2(45) := 'fa_track_member_pvt.update_member_books';
Line: 7752

update_member_err           exception;
Line: 7758

      select mth.asset_id
      from   fa_transaction_headers mth
      where  mth.transaction_header_id = p_trans_rec.member_transaction_header_id;
Line: 7764

  select period_counter
    from fa_deprn_periods
   where book_type_code = h_book_type_code
     and fiscal_year = h_fiscal_year
     and period_num = h_period_num;
Line: 7771

  select period_counter
    from fa_mc_deprn_periods
   where book_type_code = h_book_type_code
     and fiscal_year = h_fiscal_year
     and period_num = h_period_num
     and set_of_books_id = h_set_of_books_id;
Line: 7780

  select bk.asset_id,
         bk.group_asset_id
    from fa_books bk
   where bk.book_type_code = h_book_type_code
     and bk.group_asset_id = h_group_asset_id
     and bk.date_ineffective is null
     and bk.depreciate_flag = 'YES'
     and bk.asset_id = nvl(l_member_asset_id, bk.asset_id)
   order by asset_id;
Line: 7791

  select bk.asset_id,
         bk.group_asset_id
    from fa_books_mrc_v bk
   where bk.book_type_code = h_book_type_code
     and bk.group_asset_id = h_group_asset_id
     and bk.date_ineffective is null
     and bk.depreciate_flag = 'YES'
   order by asset_id;
Line: 7803

   fa_debug_pkg.add('fa_track_member_pvt', '*** update_member_books Started', '***', p_log_level_rec);
Line: 7853

  For update_member in ALL_MEMBERS loop

    h_member_asset_id := update_member.asset_id;
Line: 7894

           Update FA_BOOKS set adjusted_cost = h_adjusted_cost,
                               eofy_reserve = h_eofy_reserve,
                               last_update_date = sysdate,
                               last_updated_by = -1
                         where book_type_code = h_book_type_code
                           and asset_id = h_member_asset_id
                           and group_asset_id = h_group_asset_id
                           and date_ineffective is null;
Line: 7911

  For update_member in ALL_MEMBERS_MRC loop

    h_member_asset_id := update_member.asset_id;
Line: 7952

           Update FA_BOOKS_MRC_V set adjusted_cost = h_adjusted_cost,
                                     eofy_reserve = h_eofy_reserve,
                                     last_update_date = sysdate,
                                     last_updated_by = -1
                               where book_type_code = h_book_type_code
                                 and asset_id = h_member_asset_id
                                 and group_asset_id = h_group_asset_id
                                 and date_ineffective is null;
Line: 7972

  when update_member_err then
    fa_srvr_msg.add_message (calling_fn => l_calling_fn,
                          p_log_level_rec             => p_log_level_rec);
Line: 7981

end update_member_books;
Line: 8020

  select period_counter
    from fa_deprn_periods
   where book_type_code = h_book_type_code
     and fiscal_year = h_fiscal_year
     and period_num = h_period_num;
Line: 8027

  select period_counter
    from fa_mc_deprn_periods
   where book_type_code = h_book_type_code
     and fiscal_year = h_fiscal_year
     and period_num = h_period_num
     and set_of_books_id = h_set_of_books_id;
Line: 8073

  p_track_member_eofy_table.delete;
Line: 8075

    fa_debug_pkg.add(l_calling_fn, 'p_track_member_eofy_table is deleted', 1, p_log_level_rec);
Line: 8326

  select FY.fiscal_year,
         DP.period_num
    from fa_fiscal_year FY,
         fa_calendar_periods DP
   where FY.fiscal_year_name = h_fiscal_year_name
     and DP.calendar_type = h_deprn_calendar
     and DP.end_date <= FY.end_date
     and p_date >= DP.start_date
     and p_date <= DP.end_date
     and p_date >= FY.start_date
     and p_date <= FY.end_date;
Line: 8340

  select distinct BK.ASSET_ID, AD.asset_number
    from FA_BOOKS BK,
         FA_ADDITIONS_B AD
   where BK.book_type_code = h_book_type_code
     and BK.group_asset_id = h_group_asset_id
     and exists
         (select TH1.TRANSACTION_HEADER_ID
            from FA_TRANSACTION_HEADERS TH1,
                 FA_CALENDAR_PERIODS DP1,
                 FA_FISCAL_YEAR FY
           where TH1.book_type_code = BK.book_type_code
             and DP1.calendar_type = h_deprn_calendar
             and DP1.period_num = p_period_num
             and FY.fiscal_year_name = h_fiscal_year_name
             and FY.fiscal_year = p_fiscal_year
             and nvl(TH1.amortization_start_date,TH1.transaction_date_entered) <= DP1.end_date
             and DP1.start_date >= FY.start_date
             and DP1.end_date <= FY.end_date
             and BK.TRANSACTION_HEADER_ID_IN = TH1.TRANSACTION_HEADER_ID)
     and AD.asset_id = BK.asset_id
     and AD.asset_type = 'CAPITALIZED'
     order by AD.asset_number asc;
Line: 8364

  select distinct BK.ASSET_ID, AD.asset_number
    from FA_BOOKS_MRC_V BK,
         FA_ADDITIONS_B AD
   where BK.book_type_code = h_book_type_code
     and BK.group_asset_id = h_group_asset_id
     and exists
         (select TH1.TRANSACTION_HEADER_ID
            from FA_TRANSACTION_HEADERS TH1,
                 FA_CALENDAR_PERIODS DP1,
                 FA_FISCAL_YEAR FY
           where TH1.book_type_code = BK.book_type_code
             and DP1.calendar_type = h_deprn_calendar
             and DP1.period_num = p_period_num
             and FY.fiscal_year_name = h_fiscal_year_name
             and FY.fiscal_year = p_fiscal_year
             and nvl(TH1.amortization_start_date,TH1.transaction_date_entered) <= DP1.end_date
             and DP1.start_date >= FY.start_date
             and DP1.end_date <= FY.end_date
             and TH1.TRANSACTION_HEADER_ID = BK.TRANSACTION_HEADER_ID_IN)
     and AD.asset_id = BK.asset_id
     and AD.asset_type = 'CAPITALIZED'
     order by AD.asset_number asc;
Line: 8389

  select max(BK1.transaction_header_id_in)
    from FA_BOOKS BK1
   where BK1.book_type_code = h_book_type_code
     and BK1.asset_id = p_member_asset_id
     and BK1.group_asset_id = h_group_asset_id
     and exists
         (select TH1.TRANSACTION_HEADER_ID
            from FA_TRANSACTION_HEADERS TH1,
                 FA_CALENDAR_PERIODS DP1,
                 FA_FISCAL_YEAR FY
           where TH1.book_type_code = BK1.book_type_code
             and TH1.asset_id = BK1.asset_id
             and DP1.calendar_type = h_deprn_calendar
             and DP1.period_num = p_period_num
             and FY.fiscal_year_name = h_fiscal_year_name
             and FY.fiscal_year = p_fiscal_year
             and nvl(TH1.amortization_start_date,TH1.transaction_date_entered) <= DP1.end_date
             and DP1.start_date >= FY.start_date
             and DP1.end_date <= FY.end_date
             and BK1.TRANSACTION_HEADER_ID_IN = TH1.TRANSACTION_HEADER_ID);
Line: 8411

  select max(BK1.transaction_header_id_in)
    from FA_BOOKS BK1
   where BK1.book_type_code = h_book_type_code
     and BK1.asset_id = p_member_asset_id
     and BK1.group_asset_id <> h_group_asset_id
     and exists
         (select TH1.TRANSACTION_HEADER_ID
            from FA_TRANSACTION_HEADERS TH1,
                 FA_CALENDAR_PERIODS DP1,
                 FA_FISCAL_YEAR FY
           where TH1.book_type_code = BK1.book_type_code
             and TH1.asset_id = BK1.asset_id
             and DP1.calendar_type = h_deprn_calendar
             and DP1.period_num = p_period_num
             and FY.fiscal_year_name = h_fiscal_year_name
             and FY.fiscal_year = p_fiscal_year
             and nvl(TH1.amortization_start_date,TH1.transaction_date_entered) <= DP1.end_date
             and DP1.start_date >= FY.start_date
             and DP1.end_date <= FY.end_date
             and BK1.TRANSACTION_HEADER_ID_IN = TH1.TRANSACTION_HEADER_ID);
Line: 8433

  select max(BK1.transaction_header_id_in)
    from FA_BOOKS_MRC_V BK1
   where BK1.book_type_code = h_book_type_code
     and BK1.asset_id = p_member_asset_id
     and BK1.group_asset_id = h_group_asset_id
     and exists
         (select TH1.TRANSACTION_HEADER_ID
            from FA_TRANSACTION_HEADERS TH1,
                 FA_CALENDAR_PERIODS DP1,
                 FA_FISCAL_YEAR FY
           where TH1.book_type_code = BK1.book_type_code
             and TH1.asset_id = BK1.asset_id
             and DP1.calendar_type = h_deprn_calendar
             and DP1.period_num = p_period_num
             and FY.fiscal_year_name = h_fiscal_year_name
             and FY.fiscal_year = p_fiscal_year
             and nvl(TH1.amortization_start_date,TH1.transaction_date_entered) <= DP1.end_date
             and DP1.start_date >= FY.start_date
             and DP1.end_date <= FY.end_date
             and BK1.TRANSACTION_HEADER_ID_IN = TH1.TRANSACTION_HEADER_ID);
Line: 8455

  select max(BK1.transaction_header_id_in)
    from FA_BOOKS_MRC_V BK1
   where BK1.book_type_code = h_book_type_code
     and BK1.asset_id = p_member_asset_id
     and BK1.group_asset_id <> h_group_asset_id
     and exists
         (select TH1.TRANSACTION_HEADER_ID
            from FA_TRANSACTION_HEADERS TH1,
                 FA_CALENDAR_PERIODS DP1,
                 FA_FISCAL_YEAR FY
           where TH1.book_type_code = BK1.book_type_code
             and TH1.asset_id = BK1.asset_id
             and DP1.calendar_type = h_deprn_calendar
             and DP1.period_num = p_period_num
             and FY.fiscal_year_name = h_fiscal_year_name
             and FY.fiscal_year = p_fiscal_year
             and nvl(TH1.amortization_start_date,TH1.transaction_date_entered) <= DP1.end_date
             and DP1.start_date >= FY.start_date
             and DP1.end_date <= FY.end_date
             and BK1.TRANSACTION_HEADER_ID_IN = TH1.TRANSACTION_HEADER_ID);
Line: 8478

  select bk.allocate_to_fully_ret_flag,
         bk.allocate_to_fully_rsv_flag,
         bk.period_counter_fully_retired,
         bk.period_counter_fully_reserved
    from fa_books bk
   where bk.book_type_code = h_book_type_code
     and bk.asset_id = p_asset_id
     and bk.date_ineffective is null;
Line: 8488

  select bk.allocate_to_fully_ret_flag,
         bk.allocate_to_fully_rsv_flag,
         bk.period_counter_fully_retired,
         bk.period_counter_fully_reserved
    from fa_books_mrc_v bk
   where bk.book_type_code = h_book_type_code
     and bk.asset_id = p_asset_id
     and bk.date_ineffective is null;
Line: 8499

  select TH.TRANSACTION_HEADER_ID, TH.TRANSACTION_TYPE_CODE
    from FA_TRANSACTION_HEADERS TH,
         FA_CALENDAR_PERIODS DP,
         FA_FISCAL_YEAR FY
   where DP.calendar_type = h_deprn_calendar
     and DP.period_num = p_period_num
     and FY.fiscal_year_name = h_fiscal_year_name
     and FY.fiscal_year = p_fiscal_year
     and TH.asset_id = p_member_asset_id
     and TH.transaction_type_code not in ('TRANSFER OUT', 'TRANSFER IN', 'TRANSFER', 'TRANSFER IN/VOID',
--toru
--                                          'RECLASS', 'UNIT ADJUSTMENT','REINSTATEMENT')
                                         'RECLASS', 'UNIT ADJUSTMENT')
     and nvl(TH.amortization_start_date,TH.transaction_date_entered) between DP.start_date and DP.end_date
     and DP.start_date >= FY.start_date
     and DP.end_date <= FY.end_date
order by nvl(TH.amortization_start_date,TH.transaction_date_entered), TH.transaction_header_id asc;
Line: 8519

  select BK_IN.COST - nvl(BK_OUT.COST,0) delta_cost,
         BK_IN.RECOVERABLE_COST - nvl(BK_OUT.RECOVERABLE_COST,0) delta_rec_cost,
         BK_IN.DEPRN_LIMIT_TYPE new_limit_type,
         BK_OUT.DEPRN_LIMIT_TYPE old_limit_type,
         BK_IN.ALLOWED_DEPRN_LIMIT new_deprn_limit,
         BK_IN.ALLOWED_DEPRN_LIMIT_AMOUNT new_deprn_limit_amount,
         BK_IN.DEPRECIATE_FLAG depreciate_flag,
         BK_IN.group_asset_id group_asset_id,
         BK_IN.period_counter_fully_retired period_counter_fully_retired
    from FA_BOOKS BK_IN,
         FA_BOOKS BK_OUT
   where BK_IN.book_type_code = h_book_type_code
     and BK_IN.group_asset_id = h_group_asset_id
     and BK_IN.asset_id = h_member_asset_id
     and BK_IN.transaction_header_id_in = p_transaction_header_id
     and BK_OUT.book_type_code(+) = BK_IN.book_type_code
     and BK_OUT.group_asset_id(+) = BK_IN.group_Asset_id
     and BK_OUT.asset_id(+) = BK_IN.asset_id
     and BK_OUT.transaction_header_id_out(+) = BK_IN.transaction_header_id_in;
Line: 8540

  select BK_IN.COST - nvl(BK_OUT.COST,0) delta_cost,
         BK_IN.RECOVERABLE_COST - nvl(BK_OUT.RECOVERABLE_COST,0) delta_rec_cost,
         BK_IN.DEPRN_LIMIT_TYPE new_limit_type,
         BK_OUT.DEPRN_LIMIT_TYPE old_limit_type,
         BK_IN.ALLOWED_DEPRN_LIMIT new_deprn_limit,
         BK_IN.ALLOWED_DEPRN_LIMIT_AMOUNT old_deprn_limit,
         BK_IN.DEPRECIATE_FLAG depreciate_flag,
         BK_IN.group_Asset_id group_asset_id,
         BK_IN.period_counter_fully_retired period_counter_fully_retired
    from FA_BOOKS_MRC_V BK_IN,
         FA_BOOKS_MRC_V BK_OUT
   where BK_IN.book_type_code = h_book_type_code
     and BK_IN.group_asset_id = h_group_asset_id
     and BK_IN.asset_id = h_member_asset_id
     and BK_IN.transaction_header_id_in = p_transaction_header_id
     and BK_OUT.book_type_code(+) = BK_IN.book_type_code
     and BK_OUT.group_asset_id(+) = BK_IN.group_Asset_id
     and BK_OUT.asset_id(+) = BK_IN.asset_id
     and BK_OUT.transaction_header_id_out(+) = BK_IN.transaction_header_id_in;
Line: 8562

  select recognize_gain_loss,
         nvl(eofy_reserve,0),
         (-1)*nvl(reserve_retired,0)
    from fa_retirements
   where transaction_header_id_in = p_thid;
Line: 8569

  select recognize_gain_loss,
         nvl(eofy_reserve,0),
         (-1)*nvl(reserve_retired,0)
    from fa_retirements_mrc_v
   where transaction_header_id_in = p_thid;
Line: 8577

  select recognize_gain_loss,
         nvl(eofy_reserve,0),
         nvl(reserve_retired,0)
    from fa_retirements
   where transaction_header_id_out = p_thid;
Line: 8584

  select recognize_gain_loss,
         nvl(eofy_reserve,0),
         nvl(reserve_retired,0)
    from fa_retirements_mrc_v
   where transaction_header_id_out = p_thid;
Line: 8592

  select deprn_source_code,
         ytd_deprn,
         deprn_reserve
    from fa_deprn_summary
   where book_type_code = h_book_type_code
     and asset_id = p_asset_id
     and period_counter = p_period_counter;
Line: 8601

  select deprn_source_code,
         ytd_deprn,
         deprn_reserve
    from fa_deprn_summary_mrc_v
   where book_type_code = h_book_type_code
     and asset_id = p_asset_id
     and period_counter = p_period_counter;
Line: 8611

   select sum(decode(adj.adjustment_type,'EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_adjustments adj
    where adj.asset_id = h_group_asset_id
      and adj.book_type_code = h_book_type_code
      and adj.period_counter_adjusted = p_period_counter;
Line: 8625

   select sum(decode(adj.adjustment_type,'EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))),
	  sum(decode(adj.adjustment_type,'BONUS EXPENSE',
	      	     decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount)))
     from fa_adjustments_mrc_v adj
    where adj.asset_id = h_group_asset_id
      and adj.book_type_code = h_book_type_code
      and adj.period_counter_adjusted = p_period_counter;
Line: 8640

  select FISCAL_YEAR,
         PERIOD_NUM,
         CALENDAR_PERIOD_OPEN_DATE,
         CALENDAR_PERIOD_CLOSE_DATE,
         COST,
         SALVAGE_VALUE,
         RECOVERABLE_COST,
         ADJUSTED_RECOVERABLE_COST,
         ADJUSTED_COST,
         DEPRN_METHOD_CODE,
         LIFE_IN_MONTHS,
         BONUS_RULE,
         DEPRN_AMOUNT,
         YTD_DEPRN,
         DEPRN_RESERVE,
         BONUS_DEPRN_AMOUNT,
         BONUS_YTD_DEPRN,
         BONUS_DEPRN_RESERVE,
         DEPRN_OVERRIDE_FLAG,
--         EOFY_RECOVERABLE_COST,
--         EOFY_SALVAGE_VALULE,
         EOFY_RESERVE,
         SYSTEM_DEPRN_AMOUNT,
         SYSTEM_BONUS_DEPRN_AMOUNT
    from FA_BOOKS_SUMMARY
   where book_type_code = h_book_type_code
     and asset_id = h_group_asset_id
     and period_counter = p_period_counter;
Line: 8670

  select FISCAL_YEAR,
         PERIOD_NUM,
         CALENDAR_PERIOD_OPEN_DATE,
         CALENDAR_PERIOD_CLOSE_DATE,
         COST,
         SALVAGE_VALUE,
         RECOVERABLE_COST,
         ADJUSTED_RECOVERABLE_COST,
         ADJUSTED_COST,
         DEPRN_METHOD_CODE,
         LIFE_IN_MONTHS,
         BONUS_RULE,
         DEPRN_AMOUNT,
         YTD_DEPRN,
         DEPRN_RESERVE,
         BONUS_DEPRN_AMOUNT,
         BONUS_YTD_DEPRN,
         BONUS_DEPRN_RESERVE,
         DEPRN_OVERRIDE_FLAG,
--         EOFY_RECOVERABLE_COST,
--         EOFY_SALVAGE_VALULE,
         EOFY_RESERVE,
         SYSTEM_DEPRN_AMOUNT,
         SYSTEM_BONUS_DEPRN_AMOUNT
    from FA_BOOKS_SUMMARY_MRC_V
   where book_type_code = h_book_type_code
     and asset_id = h_group_asset_id
     and period_counter = p_period_counter;
Line: 8700

  select sum(nvl(SYSTEM_DEPRN_AMOUNT,0)),
         sum(nvl(SYSTEM_BONUS_DEPRN_AMOUNT,0))
    from FA_BOOKS_SUMMARY
   where book_type_code = h_book_type_code
     and asset_id = h_group_asset_id
     and fiscal_year = p_fiscal_year
     and period_counter <= p_period_counter_end;
Line: 8709

  select sum(nvl(SYSTEM_DEPRN_AMOUNT,0)),
         sum(nvl(SYSTEM_BONUS_DEPRN_AMOUNT,0))
    from FA_BOOKS_SUMMARY_MRC_V
   where book_type_code = h_book_type_code
     and asset_id = h_group_asset_id
     and fiscal_year = p_fiscal_year
     and period_counter <= p_period_counter_end;
Line: 8719

  select SALVAGE_VALUE,
         RECOVERABLE_COST
    from FA_BOOKS_SUMMARY
   where book_type_code = h_book_type_code
     and asset_id = h_group_asset_id
     and fiscal_year = p_fiscal_year
     and period_num = p_period_num;
Line: 8728

  select SALVAGE_VALUE,
         RECOVERABLE_COST
    from FA_BOOKS_SUMMARY_MRC_V
   where book_type_code = h_book_type_code
     and asset_id = h_group_asset_id
     and fiscal_year = p_fiscal_year
     and period_num = p_period_num;
Line: 8738

  select COST,
         SALVAGE_VALUE,
         RECOVERABLE_COST,
         ADJUSTED_COST,
         ADJUSTED_RECOVERABLE_COST,
         DEPRN_RESERVE,
         BONUS_DEPRN_RESERVE,
         YTD_DEPRN,
         BONUS_YTD_DEPRN,
         EOFY_RESERVE
    from FA_BOOKS_SUMMARY
   where book_type_code = h_book_type_code
     and group_asset_id = h_group_asset_id
     and period_counter = h_processing_period_counter -1
     and asset_id = h_member_asset_id;
Line: 8755

  select COST,
         SALVAGE_VALUE,
         RECOVERABLE_COST,
         ADJUSTED_COST,
         ADJUSTED_RECOVERABLE_COST,
         DEPRN_RESERVE,
         BONUS_DEPRN_RESERVE,
         YTD_DEPRN,
         BONUS_YTD_DEPRN,
         EOFY_RESERVE
    from FA_BOOKS_SUMMARY_MRC_V
   where book_type_code = h_book_type_code
     and group_asset_id = h_group_asset_id
     and period_counter = h_processing_period_counter -1
     and asset_id = h_member_asset_id;
Line: 8773

  select BK_IN.group_asset_id group_asset_id
    from FA_BOOKS BK_IN,
         FA_BOOKS BK_OUT
   where BK_IN.book_type_code = h_book_type_code
     and BK_IN.asset_id = h_member_asset_id
     and BK_IN.transaction_header_id_in = p_transaction_header_id
     and BK_OUT.book_type_code(+) = BK_IN.book_type_code
     and BK_OUT.group_asset_id(+) = h_group_Asset_id
     and BK_OUT.asset_id(+) = BK_IN.asset_id
     and BK_OUT.transaction_header_id_out(+) = BK_IN.transaction_header_id_in;
Line: 8785

  select BK_IN.group_Asset_id group_asset_id
    from FA_BOOKS_MRC_V BK_IN,
         FA_BOOKS_MRC_V BK_OUT
   where BK_IN.book_type_code = h_book_type_code
     and BK_IN.asset_id = h_member_asset_id
     and BK_IN.transaction_header_id_in = p_transaction_header_id
     and BK_OUT.book_type_code(+) = BK_IN.book_type_code
     and BK_OUT.group_asset_id(+) = h_group_Asset_id
     and BK_OUT.asset_id(+) = BK_IN.asset_id
     and BK_OUT.transaction_header_id_out(+) = BK_IN.transaction_header_id_in;
Line: 8813

   select deprn_calendar, fiscal_year_name
   into   h_deprn_calendar, h_fiscal_year_name
   from   fa_book_controls
   where  book_type_code = h_book_type_code;
Line: 8888

      select period_counter
        into h_cur_period_Counter
        from fa_deprn_periods
       where book_type_Code = h_book_type_code
         and period_close_date is null;
Line: 8894

      select exclude_fully_rsv_flag,recognize_gain_loss
        into h_exclude_fully_rsv_flag,h_group_recognize_gain_loss
        from fa_books
       where book_type_code = h_book_type_code
         and asset_id = h_group_asset_id
         and date_ineffective is null;
Line: 8906

      select period_counter
        into h_cur_period_Counter
        from fa_deprn_periods_mrc_v
       where book_type_Code = h_book_type_code
         and period_close_date is null;
Line: 8912

      select exclude_fully_rsv_flag,recognize_gain_loss
        into h_exclude_fully_rsv_flag,h_group_recognize_gain_loss
        from fa_books_mrc_v
       where book_type_code = h_book_type_code
         and asset_id = h_group_asset_id
         and date_ineffective is null;
Line: 9607

           select ASSET_TYPE
             into fa_rule_in.asset_type
             from fa_additions_b
            where asset_id = h_member_asset_id;
Line: 10042

           select ASSET_TYPE
             into fa_rule_in.asset_type
             from fa_additions_b
            where asset_id = h_member_asset_id;
Line: 10249

                 fa_debug_pkg.add(l_calling_fn, 'Updated fully reserved member asset',
                                                     p_track_member_table(t).member_asset_id, p_log_level_rec);
Line: 10323

     select asset_id
       from fa_transaction_headers
      where transaction_header_id = p_trans_rec.member_transaction_header_id;
Line: 10329

     select period_counter, fiscal_year, period_num
       from fa_deprn_periods
      where book_type_code = h_book_type_code
        and period_close_date is null;
Line: 10335

     select period_counter, fiscal_year, period_num
       from fa_deprn_periods_mrc_v
      where book_type_code = h_book_type_code
        and period_close_date is null;
Line: 10341

     select ds1.deprn_reserve,ds1.ytd_deprn,dp1.fiscal_year
       from fa_deprn_summary ds1,
            fa_deprn_periods dp1
      where ds1.book_type_code = h_book_type_code
        and ds1.asset_id = h_member_asset_id
        and dp1.book_type_code = ds1.book_type_Code
        and dp1.period_counter = ds1.period_counter
        and ds1.period_counter =
            (select max(period_counter)
               from fa_deprn_summary ds2
              where ds2.book_type_code = h_book_type_code
                and ds2.asset_id = h_member_asset_id
                and period_counter <= h_period_counter);
Line: 10356

     select ds1.deprn_reserve,ds1.ytd_deprn,dp1.fiscal_year
       from fa_deprn_summary_mrc_v ds1,
            fa_deprn_periods_mrc_v dp1
      where ds1.book_type_code = h_book_type_code
        and ds1.asset_id = h_member_asset_id
        and dp1.book_type_code = ds1.book_type_Code
        and dp1.period_counter = ds1.period_counter
        and ds1.period_counter =
            (select max(period_counter)
               from fa_deprn_summary ds2
              where ds2.book_type_code = h_book_type_code
                and ds2.asset_id = h_member_asset_id
                and period_counter <= h_period_counter);
Line: 10372

  select sum(nvl(ret.reserve_retired,0) - nvl(ret.eofy_reserve,0))
    from fa_retirements ret
   where ret.book_type_code = h_book_type_code
     and ret.asset_id = h_member_asset_id
     and exists
         (select th1.transaction_header_id
            from fa_transaction_headers th1,
                 fa_deprn_periods dp1,
                 fa_deprn_periods dp3
           where th1.asset_id = ret.asset_id
             and dp1.book_type_code = h_book_type_code
             and dp1.fiscal_year =
                 (select dp2.fiscal_year
                    from fa_deprn_periods dp2
                   where dp2.book_type_code = dp1.book_type_code
                     and dp2.period_Counter = h_period_counter - 1)
             and dp1.period_num = 1
             and dp3.book_type_code = dp1.book_type_code
             and dp3.period_counter = h_period_counter - 1
             and nvl(th1.amortization_start_date,th1.transaction_date_entered) >= dp1.calendar_period_open_date
             and nvl(th1.amortization_start_date,th1.transaction_date_entered) <= dp3.calendar_period_close_date
             and th1.transaction_type_code in ('PARTIAL RETIREMENT','FULL RETIREMENT')
             and th1.transaction_header_id = ret.transaction_header_id_in);
Line: 10397

  select sum(nvl(ret.reserve_retired,0) - nvl(ret.eofy_reserve,0))
    from fa_retirements_mrc_v ret
   where ret.book_type_code = h_book_type_code
     and ret.asset_id = h_member_asset_id
     and exists
         (select th1.transaction_header_id
            from fa_transaction_headers th1,
                 fa_deprn_periods_mrc_v dp1,
                 fa_deprn_periods_mrc_v dp3
           where th1.asset_id = ret.asset_id
             and dp1.book_type_code = h_book_type_code
             and dp1.fiscal_year =
                 (select dp2.fiscal_year
                    from fa_deprn_periods_mrc_v dp2
                   where dp2.book_type_code = dp1.book_type_code
                     and dp2.period_Counter = h_period_counter - 1)
             and dp1.period_num = 1
             and dp3.book_type_code = dp1.book_type_code
             and dp3.period_counter = h_period_counter - 1
             and nvl(th1.amortization_start_date,th1.transaction_date_entered) >= dp1.calendar_period_open_date
             and nvl(th1.amortization_start_date,th1.transaction_date_entered) <= dp3.calendar_period_close_date
             and th1.transaction_type_code in ('PARTIAL RETIREMENT','FULL RETIREMENT')
             and th1.transaction_header_id = ret.transaction_header_id_in);
Line: 10422

   select sum(decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))
     from fa_adjustments adj
    where adj.book_type_code = h_book_type_code
      and adj.asset_id = h_member_asset_id
      and adj.adjustment_type = 'RESERVE'
      and nvl(adj.track_member_flag, 'N') = 'N' -- ENERGY
      and adj.source_type_code = 'ADJUSTMENT'
      and exists
         (select dp2.period_counter
            from fa_deprn_periods dp1,
                 fa_deprn_periods dp2
           where dp1.book_type_code = adj.book_type_code
             and dp1.period_counter = h_period_counter - 1
             and dp2.book_type_code = dp1.book_type_code
             and dp2.fiscal_year = dp1.fiscal_year
             and dp2.period_counter <= dp1.period_counter
             and dp2.period_counter = adj.period_counter_adjusted);
Line: 10443

   select sum(decode(adj.debit_credit_flag,
		     'DR',adj.adjustment_amount,
		     'CR', -1 * adj.adjustment_amount))
     from fa_adjustments_mrc_v adj
    where adj.book_type_code = h_book_type_code
      and adj.asset_id = h_member_asset_id
      and adj.adjustment_type = 'RESERVE'
      and nvl(adj.track_member_flag, 'N') = 'N'    -- ENERGY
      and adj.source_type_code = 'ADJUSTMENT'
      and exists
         (select dp2.period_counter
            from fa_deprn_periods_mrc_v dp1,
                 fa_deprn_periods_mrc_v dp2
           where dp1.book_type_code = adj.book_type_code
             and dp1.period_counter = h_period_counter - 1
             and dp2.book_type_code = dp1.book_type_code
             and dp2.fiscal_year = dp1.fiscal_year
             and dp2.period_counter <= dp1.period_counter
             and dp2.period_counter = adj.period_counter_adjusted);
Line: 10528

    select eofy_reserve into h_eofy_reserve
      from fa_books
     where book_type_code = h_book_type_code
       and asset_id = h_member_asset_id
       and date_ineffective is null;
Line: 10557

    select eofy_reserve into h_eofy_reserve
      from fa_books_mrc_v
     where book_type_code = h_book_type_code
       and asset_id = h_member_asset_id
       and date_ineffective is null;
Line: 10877

  p_track_member_table_for_deprn.delete;
Line: 10919

  p_track_member_table.delete;
Line: 10979

FUNCTION create_update_bs_table(p_trans_rec         in FA_API_TYPES.trans_rec_type,
                                p_book_type_code    in varchar2,
                                p_group_asset_id    in varchar2,
                                p_mrc_sob_type_code in varchar2,
                                p_calling_fn        in varchar2,
				p_log_level_rec      IN     FA_API_TYPES.log_level_rec_type default null)
  return boolean is

--* Local variables
h_book_type_code    varchar2(15);
Line: 10998

  select 'Y'
    from fa_books_summary
   where book_type_code = h_book_type_code
--     and group_asset_id = h_group_asset_id
     and asset_id = h_member_asset_id
     and period_counter = h_period_counter;
Line: 11007

  select 'Y'
    from fa_books_summary_mrc_v
   where book_type_code = h_book_type_code
--     and group_asset_id = h_group_asset_id
     and asset_id = h_member_asset_id
     and period_counter = h_period_counter;
Line: 11016

l_calling_fn        varchar2(50) := 'FA_TRACK_MEMBER_PVT.create_update_bs_table';
Line: 11021

  fa_debug_pkg.add(l_calling_fn, '## Start to insert/update fa_books_summary for member assets','####', p_log_level_rec);
Line: 11049

        fa_debug_pkg.add(l_calling_fn, 'Newly insert following assets into fa_books_summary','###', p_log_level_rec);
Line: 11054

      INSERT INTO FA_BOOKS_SUMMARY
                      (ASSET_ID,
                       GROUP_ASSET_ID,
                       BOOK_TYPE_CODE,
                       PERIOD_COUNTER,
                       COST,
                       SALVAGE_VALUE,
                       RECOVERABLE_COST,
                       ADJUSTED_COST,
                       ADJUSTED_RECOVERABLE_COST,
                       DEPRN_AMOUNT,
                       BONUS_DEPRN_AMOUNT,
                       DEPRN_RESERVE,
                       BONUS_DEPRN_RESERVE,
                       YTD_DEPRN,
                       BONUS_YTD_DEPRN,
                       EOFY_RESERVE,
                       CREATION_DATE,
                       CREATED_BY,
                       LAST_UPDATE_DATE,
                       LAST_UPDATED_BY,
                       LAST_UPDATE_LOGIN)
              VALUES (h_member_asset_id,
                      h_group_asset_id,
                      h_book_type_code,
                      h_period_counter,
                      p_track_member_table(i).cost,
                      p_track_member_table(i).salvage_value,
                      p_track_member_table(i).recoverable_cost,
                      p_track_member_table(i).adjusted_cost,
                      p_track_member_table(i).adjusted_recoverable_cost,
                      nvl(p_track_member_table(i).allocated_deprn_amount,0),
                      nvl(p_track_member_table(i).allocated_bonus_amount,0),
                      nvl(p_track_member_table(i).deprn_reserve,0),
                      nvl(p_track_member_table(i).bonus_deprn_reserve,0),
                      nvl(p_track_member_table(i).ytd_deprn,0),
                      nvl(p_track_member_table(i).bonus_ytd_deprn,0),
                      nvl(p_track_member_table(i).eofy_reserve,0),
                      p_trans_rec.who_info.last_update_date, -- sysdate,
                      p_trans_rec.who_info.last_updated_by, -- -1,
                      p_trans_rec.who_info.last_update_date,
                      p_trans_rec.who_info.last_updated_by,
                      p_trans_rec.who_info.last_update_login);
Line: 11098

         fa_debug_pkg.add(l_calling_fn, 'Inserted new row for', h_member_asset_id||':'||h_period_counter, p_log_level_rec);
Line: 11102

        fa_debug_pkg.add(l_calling_fn, 'Update following assets into fa_books_summary:','####', p_log_level_rec);
Line: 11106

       UPDATE FA_BOOKS_SUMMARY
                  SET COST                       = p_track_member_table(i).cost
                    , SALVAGE_VALUE              = p_track_member_table(i).salvage_value
                    , RECOVERABLE_COST           = p_track_member_table(i).recoverable_cost
                    , ADJUSTED_RECOVERABLE_COST  = p_track_member_table(i).adjusted_recoverable_cost
                    , ADJUSTED_COST              = p_track_member_table(i).adjusted_cost
                    , DEPRN_AMOUNT               = nvl(p_track_member_table(i).allocated_deprn_amount,0)
                    , YTD_DEPRN                  = nvl(p_track_member_table(i).ytd_deprn,0)
                    , DEPRN_RESERVE              = nvl(p_track_member_table(i).deprn_reserve,0)
                    , BONUS_DEPRN_AMOUNT         = nvl(p_track_member_table(i).allocated_bonus_amount,0)
                    , BONUS_YTD_DEPRN            = nvl(p_track_member_table(i).bonus_ytd_deprn,0)
                    , BONUS_DEPRN_RESERVE        = nvl(p_track_member_table(i).bonus_deprn_reserve,0)
                    , EOFY_RESERVE               = nvl(p_track_member_table(i).eofy_reserve,0)
                    , LAST_UPDATE_DATE           = p_trans_rec.who_info.last_update_date
                    , LAST_UPDATED_BY            = p_trans_rec.who_info.last_updated_by
                    , LAST_UPDATE_LOGIN          = p_trans_rec.who_info.last_update_login
                  WHERE GROUP_ASSET_ID = h_group_asset_id
                  AND   ASSET_ID = h_member_asset_id
                  AND   BOOK_TYPE_CODE = h_book_type_code
                  AND   PERIOD_COUNTER = h_period_counter;
Line: 11127

         fa_debug_pkg.add(l_calling_fn, 'Updated existing row for', h_member_asset_id||':'||h_period_counter, p_log_level_rec);
Line: 11139

      INSERT INTO FA_MC_BOOKS_SUMMARY
                      (SET_OF_BOOKS_ID,
                       ASSET_ID,
                       GROUP_ASSET_ID,
                       BOOK_TYPE_CODE,
                       PERIOD_COUNTER,
                       COST,
                       SALVAGE_VALUE,
                       RECOVERABLE_COST,
                       ADJUSTED_COST,
                       ADJUSTED_RECOVERABLE_COST,
                       DEPRN_AMOUNT,
                       BONUS_DEPRN_AMOUNT,
                       DEPRN_RESERVE,
                       BONUS_DEPRN_RESERVE,
                       YTD_DEPRN,
                       BONUS_YTD_DEPRN,
                       EOFY_RESERVE,
                       CREATION_DATE,
                       CREATED_BY,
                       LAST_UPDATE_DATE,
                       LAST_UPDATED_BY,
                       LAST_UPDATE_LOGIN)
              VALUES (h_set_of_books_id,
                      h_member_asset_id,
                      h_group_asset_id,
                      h_book_type_code,
                      h_period_counter,
                      p_track_member_table(i).cost,
                      p_track_member_table(i).salvage_value,
                      p_track_member_table(i).recoverable_cost,
                      p_track_member_table(i).adjusted_cost,
                      p_track_member_table(i).adjusted_recoverable_cost,
                      nvl(p_track_member_table(i).allocated_deprn_amount,0),
                      nvl(p_track_member_table(i).allocated_bonus_amount,0),
                      nvl(p_track_member_table(i).deprn_reserve,0),
                      nvl(p_track_member_table(i).bonus_deprn_reserve,0),
                      nvl(p_track_member_table(i).ytd_deprn,0),
                      nvl(p_track_member_table(i).bonus_ytd_deprn,0),
                      nvl(p_track_member_table(i).eofy_reserve,0),
                      p_trans_rec.who_info.last_update_date, -- sysdate,
                      p_trans_rec.who_info.last_updated_by, -- -1,
                      p_trans_rec.who_info.last_update_date,
                      p_trans_rec.who_info.last_updated_by,
                      p_trans_rec.who_info.last_update_login);
Line: 11185

         fa_debug_pkg.add(l_calling_fn, 'Inserted new row for', h_member_asset_id||':'||h_period_counter, p_log_level_rec);
Line: 11188

       UPDATE FA_BOOKS_SUMMARY_MRC_V
                  SET COST                       = p_track_member_table(i).cost
                    , SALVAGE_VALUE              = p_track_member_table(i).salvage_value
                    , RECOVERABLE_COST           = p_track_member_table(i).recoverable_cost
                    , ADJUSTED_RECOVERABLE_COST  = p_track_member_table(i).adjusted_recoverable_cost
                    , ADJUSTED_COST              = p_track_member_table(i).adjusted_cost
                    , DEPRN_AMOUNT               = nvl(p_track_member_table(i).allocated_deprn_amount,0)
                    , YTD_DEPRN                  = nvl(p_track_member_table(i).ytd_deprn,0)
                    , DEPRN_RESERVE              = nvl(p_track_member_table(i).deprn_reserve,0)
                    , BONUS_DEPRN_AMOUNT         = nvl(p_track_member_table(i).allocated_bonus_amount,0)
                    , BONUS_YTD_DEPRN            = nvl(p_track_member_table(i).bonus_ytd_deprn,0)
                    , BONUS_DEPRN_RESERVE        = nvl(p_track_member_table(i).bonus_deprn_reserve,0)
                    , EOFY_RESERVE               = nvl(p_track_member_table(i).eofy_reserve,0)
                    , LAST_UPDATE_DATE           = p_trans_rec.who_info.last_update_date
                    , LAST_UPDATED_BY            = p_trans_rec.who_info.last_updated_by
                    , LAST_UPDATE_LOGIN          = p_trans_rec.who_info.last_update_login
                  WHERE
-- GROUP_ASSET_ID = h_group_asset_id
--                  AND
                        ASSET_ID = h_member_asset_id
                  AND   BOOK_TYPE_CODE = h_book_type_code
                  AND   PERIOD_COUNTER = h_period_counter;
Line: 11211

         fa_debug_pkg.add(l_calling_fn, 'Updated existing row for', h_member_asset_id||':'||h_period_counter, p_log_level_rec);
Line: 11220

  fa_debug_pkg.add(l_calling_fn, '## End of insert/update fa_books_summary for member assets','####', p_log_level_rec);
Line: 11230

end create_update_bs_table;
Line: 11276

   SELECT deprn_amount, bonus_deprn_amount, subtract_ytd_flag, deprn_override_id
     FROM FA_DEPRN_OVERRIDE
    WHERE
      book_type_code = p_book_type_code and
      asset_id = p_member_asset_id and
      period_name = h_period_name and
      used_by = 'DEPRECIATION' and
      status = 'POSTED';
Line: 11309

   /* select the corresponding period_counter for the current period: fyctr, perd_ctr */
  h_calendar_type:= fa_cache_pkg.fazcbc_record.deprn_calendar;
Line: 11314

  select cp.period_name
    into h_period_name
    from fa_calendar_periods cp, fa_fiscal_year fy
   where cp.calendar_type = h_calendar_type and
         cp.period_num = p_period_num and
         cp.start_date >= fy.start_date and
         cp.end_date <= fy.end_date and
         fy.fiscal_year_name = h_fy_name and
         fy.fiscal_year = p_fiscal_year;