DBA Data[Home] [Help]

APPS.FA_POLISH_PVT SQL Statements

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

Line: 425

         select fy.fiscal_year
         into   l_first_fiscal_year
         from   fa_fiscal_year fy,
                fa_mc_book_controls mbc,
                fa_book_controls bc,
                fa_mc_books bks
         where  bc.book_type_code = p_Book_Type_Code
         and    mbc.book_type_code = p_Book_Type_Code
         and    bc.fiscal_year_name = fy.fiscal_year_name
         and    mbc.set_of_books_id = p_set_of_books_id
         and    bks.book_type_code = p_Book_Type_Code
         and    bks.asset_id = p_Asset_Id
         and    bks.transaction_header_id_out is null
         and    bks.set_of_books_id = p_set_of_books_id
         and    bks.date_placed_in_service between
                fy.start_date and fy.end_date;
Line: 442

         select dp.period_counter
         into   l_first_period_counter
         from   fa_mc_deprn_periods dp,
                fa_mc_books bks
         where  dp.book_type_code = p_Book_Type_Code
         and    dp.set_of_books_id = p_set_of_books_id
         and    bks.book_type_code = p_Book_Type_Code
         and    bks.asset_id = p_Asset_Id
         and    bks.transaction_header_id_out is null
         and    bks.set_of_books_id = p_set_of_books_id
         and    bks.date_placed_in_service between
                dp.calendar_period_open_date and dp.calendar_period_close_date;
Line: 455

         select period_counter
         into   l_open_period_counter
         from   fa_mc_deprn_periods
         where  book_type_code = p_Book_Type_Code
         and    period_close_date is null
         and    set_of_books_id = p_set_of_books_id;
Line: 464

         select fy.fiscal_year
         into   l_first_fiscal_year
         from   fa_fiscal_year fy,
                fa_book_controls bc,
                fa_books bks
         where  bc.book_type_code = p_Book_Type_Code
         and    bc.fiscal_year_name = fy.fiscal_year_name
         and    bks.book_type_code = p_Book_Type_Code
         and    bks.asset_id = p_Asset_Id
         and    bks.transaction_header_id_out is null
         and    bks.date_placed_in_service between
                fy.start_date and fy.end_date;
Line: 477

         select dp.period_counter
         into   l_first_period_counter
         from   fa_deprn_periods dp,
                fa_books bks
         where  dp.book_type_code = p_Book_Type_Code
         and    bks.book_type_code = p_Book_Type_Code
         and    bks.asset_id = p_Asset_Id
         and    bks.transaction_header_id_out is null
         and    bks.date_placed_in_service between
                dp.calendar_period_open_date and dp.calendar_period_close_date;
Line: 488

         select period_counter
         into   l_open_period_counter
         from   fa_deprn_periods
         where  book_type_code = p_Book_Type_Code
         and    period_close_date is null;
Line: 511

         select adjusted_cost
         into   l_old_adjusted_cost
         from   fa_mc_books
         where  book_type_code = p_Book_Type_Code
         and    asset_id = p_Asset_Id
         and    transaction_header_id_out is null
         and    set_of_books_id = p_set_of_books_id;
Line: 521

         select adjusted_cost
         into   l_old_adjusted_cost
         from   fa_books
         where  book_type_code = p_Book_Type_Code
         and    asset_id = p_Asset_Id
         and    transaction_header_id_out is null;
Line: 584

         select transaction_type_code,
                transaction_header_id
         into   l_transaction_type_code,
                l_transaction_header_id
         from   fa_transaction_headers
         where  book_type_code = p_Book_Type_Code
         and    asset_id = p_Asset_ID
         and    transaction_type_code in ('ADJUSTMENT', 'PARTIAL RETIREMENT')
         and    transaction_header_id =
         (
          select max(transaction_header_id)
          from   fa_transaction_headers
          where  book_type_code = p_Book_Type_Code
          and    asset_id = p_Asset_ID
          and    transaction_type_code in ('ADJUSTMENT', 'PARTIAL RETIREMENT')
         );
Line: 656

		select  deprn_reserve
		into    l_first_year_reserve
		from    fa_mc_deprn_summary
		where   book_type_code  = p_Book_Type_Code
		and     asset_id = p_Asset_Id
		and     period_counter = l_first_year_period_counter
                and     set_of_books_id = p_set_of_books_id;
Line: 669

		select  deprn_reserve
		into    l_prev_year_reserve
		from    fa_mc_deprn_summary
		where   book_type_code  = p_Book_Type_Code
		and     asset_id = p_Asset_Id
		and     period_counter = l_prev_year_period_counter
                and     set_of_books_id = p_set_of_books_id;
Line: 684

            select  polish_deprn_basis,
                    polish_adj_rec_cost
            into    l_prev_year_adjusted_cost,
                    l_prev_year_adj_rec_cost
            from    fa_mc_books_summary
            where   book_type_code  = p_Book_Type_Code
            and     asset_id = p_Asset_Id
            and     period_counter = l_prev_year_period_counter
            and     set_of_books_id = p_set_of_books_id;
Line: 709

               select min(period_counter)
               into   l_min_period_counter
               from   fa_mc_deprn_periods
               where  book_type_code = p_Book_Type_Code
               and     set_of_books_id = p_set_of_books_id;
Line: 719

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   l_prev_year_adjusted_cost,
                            l_prev_year_adj_rec_cost
                     from   fa_mc_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.set_of_books_id = p_set_of_books_id
                     and    bks.rowid =
                     (
                      select max(bks1.rowid)
                      from   fa_mc_books bks1,
                             fa_mc_deprn_periods dp
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                      and    bks1.book_type_code = dp.book_type_code
                      and    bks1.set_of_books_id = p_set_of_books_id
                      and    dp.period_counter = l_prev_year_period_counter
                      and    dp.set_of_books_id = p_set_of_books_id
                      and    bks1.date_effective <=
                             nvl(dp.period_close_date, sysdate)
                     );
Line: 749

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   l_prev_year_adjusted_cost,
                            l_prev_year_adj_rec_cost
                     from   fa_mc_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.set_of_books_id = p_set_of_books_id
                     and    bks.rowid =
                     (
                      select min(bks1.rowid)
                      from   fa_mc_books bks1
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                      and    bks1.set_of_books_id = p_set_of_books_id
                     );
Line: 775

		select  deprn_reserve
		into    l_first_year_reserve
		from    fa_deprn_summary
		where   book_type_code  = p_Book_Type_Code
		and     asset_id = p_Asset_Id
		and     period_counter = l_first_year_period_counter;
Line: 787

		select  deprn_reserve
		into    l_prev_year_reserve
		from    fa_deprn_summary
		where   book_type_code  = p_Book_Type_Code
		and     asset_id = p_Asset_Id
		and     period_counter = l_prev_year_period_counter;
Line: 802

            select  polish_deprn_basis,
                    polish_adj_rec_cost
            into    l_prev_year_adjusted_cost,
                    l_prev_year_adj_rec_cost
            from    fa_books_summary
            where   book_type_code  = p_Book_Type_Code
            and     asset_id = p_Asset_Id
            and     period_counter = l_prev_year_period_counter;
Line: 827

               select min(period_counter)
               into   l_min_period_counter
               from   fa_deprn_periods
               where  book_type_code = p_Book_Type_Code;
Line: 836

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   l_prev_year_adjusted_cost,
                            l_prev_year_adj_rec_cost
                     from   fa_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.rowid =
                     (
                      select max(bks1.rowid)
                      from   fa_books bks1,
                             fa_deprn_periods dp
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                      and    bks1.book_type_code = dp.book_type_code
                      and    dp.period_counter = l_prev_year_period_counter
                      and    bks1.date_effective <=
                             nvl(dp.period_close_date, sysdate)
                     );
Line: 863

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   l_prev_year_adjusted_cost,
                            l_prev_year_adj_rec_cost
                     from   fa_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.rowid =
                     (
                      select min(bks1.rowid)
                      from   fa_books bks1
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                     );
Line: 906

               select adjusted_cost
               into   l_prev_year_adjusted_cost
               from   fa_mc_books
               where  asset_id = p_asset_id
               and    book_type_code = p_book_type_code
               and    transaction_header_id_out is null
               and    set_of_books_id = p_set_of_books_id;
Line: 915

               select adjusted_cost
               into   l_prev_year_adjusted_cost
               from   fa_books
               where  asset_id = p_asset_id
               and    book_type_code = p_book_type_code
               and    transaction_header_id_out is null;
Line: 989

       ((l_transaction_type_code = 'ADJUSTMENT') and (l_pos_neg_adjustment is null)) or	 /* Brahma 6989831. This perticular statement is added for non cost adjustments like Dereciation checkbox unselected and selected again */
       ((l_transaction_type_code = 'PARTIAL RETIREMENT') and
        (l_previous_year_retirement))) then

      -- Determine the basis depending on the switch
      if (l_switch_code in ('30', 'DM')) then

         -- Set the basis to be the fully reservable cost
         l_adjusted_cost := nvl(l_adjusted_recoverable_cost, 0);
Line: 1365

            select period_counter - 1
            into   x_bef_trxn_period_counter
            from   fa_mc_deprn_periods
            where  book_type_code = p_Book_Type_Code
            and    set_of_books_id = p_set_of_books_id
            and    l_amortization_start_date between
                   calendar_period_open_date and calendar_period_close_date;
Line: 1373

            select period_counter - 1
            into   x_bef_trxn_period_counter
            from   fa_deprn_periods
            where  book_type_code = p_Book_Type_Code
            and    l_amortization_start_date between
                   calendar_period_open_date and calendar_period_close_date;
Line: 1404

              select adjustment_amount,
                     debit_credit_flag
               into  x_adjustment_amount,
                     l_debit_credit_flag
               from  fa_mc_adjustments
               where book_type_code  = p_Book_Type_Code
               and   asset_id = p_Asset_Id
               and   transaction_header_id = p_transaction_header_id
               and   set_of_books_id = p_set_of_books_id
               and   source_type_code = 'ADJUSTMENT'
               and   adjustment_type = 'COST';
Line: 1422

               select adjustment_amount,
                      debit_credit_flag
               into  x_adjustment_amount,
                     l_debit_credit_flag
               from  fa_adjustments
               where book_type_code  = p_Book_Type_Code
               and   asset_id = p_Asset_Id
               and   transaction_header_id = p_transaction_header_id
               and   source_type_code = 'ADJUSTMENT'
               and   adjustment_type = 'COST';
Line: 1471

               select dp.period_counter - 1
               into   x_bef_trxn_period_counter
               from   fa_mc_deprn_periods dp,
                      fa_transaction_headers th
               where  th.transaction_header_id = p_transaction_header_id
               and    dp.book_type_code = p_Book_Type_Code
               and    dp.set_of_books_id = p_set_of_books_id
               and    th.date_effective between
                      dp.period_open_date and
                      nvl(dp.period_close_date, sysdate);
Line: 1483

               select dp.period_counter - 1
               into   x_bef_trxn_period_counter
               from   fa_deprn_periods dp,
                      fa_transaction_headers th
               where  th.transaction_header_id = p_transaction_header_id
               and    dp.book_type_code = p_Book_Type_Code
               and    th.date_effective between
                      dp.period_open_date and
                      nvl(dp.period_close_date, sysdate);
Line: 1503

               select dp.period_counter - 1
               into   x_bef_trxn_period_counter
               from   fa_mc_deprn_periods dp,
                      fa_transaction_headers th
               where  th.transaction_header_id = p_transaction_header_id
               and    dp.book_type_code = p_Book_Type_Code
               and    dp.set_of_books_id = p_set_of_books_id
               and    th.transaction_date_entered between
                      dp.calendar_period_open_date and
                      dp.calendar_period_close_date;
Line: 1515

               select dp.period_counter - 1
               into   x_bef_trxn_period_counter
               from   fa_deprn_periods dp,
                      fa_transaction_headers th
               where  th.transaction_header_id = p_transaction_header_id
               and    dp.book_type_code = p_Book_Type_Code
               and    th.transaction_date_entered between
                      dp.calendar_period_open_date and
                      dp.calendar_period_close_date;
Line: 1539

            select polish_deprn_basis,
                   polish_adj_rec_cost
            into   x_prev_basis,
                   x_prev_adj_rec_cost
            from   fa_mc_books_summary
            where  book_type_code = p_Book_Type_Code
            and    asset_id = p_Asset_Id
            and    period_counter = x_bef_trxn_period_counter
            and    set_of_books_id = p_set_of_books_id;
Line: 1566

               select min(period_counter)
               into   l_min_period_counter
               from   fa_mc_deprn_periods
               where  book_type_code = p_Book_Type_Code
               and    set_of_books_id = p_set_of_books_id;
Line: 1576

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   x_prev_basis,
                            x_prev_adj_rec_cost
                     from   fa_mc_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.set_of_books_id = p_set_of_books_id
                     and    bks.rowid =
                     (
                      select max(bks1.rowid)
                      from   fa_mc_books bks1,
                             fa_mc_deprn_periods dp
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                      and    bks1.book_type_code = dp.book_type_code
                      and    bks1.set_of_books_id = p_set_of_books_id
                      and    dp.period_counter = x_bef_trxn_period_counter
                      and    dp.set_of_books_id = p_set_of_books_id
                      and    bks1.date_effective <=
                             nvl(dp.period_close_date, sysdate)
                     );
Line: 1602

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   x_prev_basis,
                            x_prev_adj_rec_cost
                     from   fa_mc_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.set_of_books_id = p_set_of_books_id
                     and    bks.rowid =
                     (
                      select min(bks1.rowid)
                      from   fa_mc_books bks1
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                      and    bks.set_of_books_id = p_set_of_books_id
                     );
Line: 1623

         select deprn_reserve
         into   x_prev_reserve
         from   fa_mc_deprn_summary
         where  book_type_code = p_Book_Type_Code
         and    asset_id = p_Asset_Id
         and    period_counter = x_bef_trxn_period_counter
         and    set_of_books_id = p_set_of_books_id;
Line: 1642

            select polish_deprn_basis,
                   polish_adj_rec_cost
            into   x_prev_basis,
                   x_prev_adj_rec_cost
            from   fa_books_summary
            where  book_type_code = p_Book_Type_Code
            and    asset_id = p_Asset_Id
            and    period_counter = x_bef_trxn_period_counter;
Line: 1668

               select min(period_counter)
               into   l_min_period_counter
               from   fa_deprn_periods
               where  book_type_code = p_Book_Type_Code;
Line: 1677

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   x_prev_basis,
                            x_prev_adj_rec_cost
                     from   fa_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.rowid =
                     (
                      select max(bks1.rowid)
                      from   fa_books bks1,
                             fa_deprn_periods dp
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                      and    bks1.book_type_code = dp.book_type_code
                      and    dp.period_counter = x_bef_trxn_period_counter
                      and    bks1.date_effective <=
                             nvl(dp.period_close_date, sysdate)
                     );
Line: 1700

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   x_prev_basis,
                            x_prev_adj_rec_cost
                     from   fa_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.rowid =
                     (
                      select min(bks1.rowid)
                      from   fa_books bks1
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                     );
Line: 1719

		select deprn_reserve
	         into   x_prev_reserve
		 from   fa_deprn_summary
	         where  book_type_code = p_Book_Type_Code
	         and    asset_id = p_Asset_Id
	         and    period_counter = x_bef_trxn_period_counter;
Line: 1746

         select adjustment_amount,
                debit_credit_flag
         into   x_retirement_amount,
                l_debit_credit_flag
         from   fa_mc_adjustments
         where  book_type_code = p_Book_Type_Code
         and    asset_id = p_Asset_Id
         and    transaction_header_id = p_transaction_header_id
         and    source_type_code = 'RETIREMENT'
         and    adjustment_type = 'COST'
         and    set_of_books_id = p_set_of_books_id;
Line: 1758

         select dp.period_counter - 1
         into   x_bef_trxn_period_counter
         from   fa_mc_deprn_periods dp,
                fa_transaction_headers th
         where  th.transaction_header_id = p_transaction_header_id
         and    dp.book_type_code = p_Book_Type_Code
         and    dp.set_of_books_id = p_set_of_books_id
         and    th.transaction_date_entered between
                dp.calendar_period_open_date and
                dp.calendar_period_close_date;
Line: 1771

         select adjustment_amount,
                debit_credit_flag
         into   x_retirement_amount,
                l_debit_credit_flag
         from   fa_adjustments
         where  book_type_code = p_Book_Type_Code
         and    asset_id = p_Asset_Id
         and    transaction_header_id = p_transaction_header_id
         and    source_type_code = 'RETIREMENT'
         and    adjustment_type = 'COST';
Line: 1782

         select dp.period_counter - 1
         into   x_bef_trxn_period_counter
         from   fa_deprn_periods dp,
                fa_transaction_headers th
         where  th.transaction_header_id = p_transaction_header_id
         and    dp.book_type_code = p_Book_Type_Code
         and    th.transaction_date_entered between
                dp.calendar_period_open_date and
                dp.calendar_period_close_date;
Line: 1810

            select polish_deprn_basis,
                   polish_adj_rec_cost
            into   x_prev_basis,
                   x_prev_adj_rec_cost
            from   fa_mc_books_summary
            where  book_type_code = p_Book_Type_Code
            and    asset_id = p_Asset_Id
            and    period_counter = x_bef_trxn_period_counter
            and    set_of_books_id = p_set_of_books_id;
Line: 1837

               select min(period_counter)
               into   l_min_period_counter
               from   fa_mc_deprn_periods
               where  book_type_code = p_Book_Type_Code
               and    set_of_books_id = p_set_of_books_id;
Line: 1847

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   x_prev_basis,
                            x_prev_adj_rec_cost
                     from   fa_mc_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.set_of_books_id = p_set_of_books_id
                     and    bks.rowid =
                     (
                      select max(bks1.rowid)
                      from   fa_mc_books bks1,
                             fa_mc_deprn_periods dp
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                      and    bks1.set_of_books_id = p_set_of_books_id
                      and    bks1.book_type_code = dp.book_type_code
                      and    dp.period_counter = x_bef_trxn_period_counter
                      and    dp.set_of_books_id = p_set_of_books_id
                      and    bks1.date_effective <=
                             nvl(dp.period_close_date, sysdate)
                     );
Line: 1873

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   x_prev_basis,
                            x_prev_adj_rec_cost
                     from   fa_mc_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.set_of_books_id = p_set_of_books_id
                     and    bks.rowid =
                     (
                      select min(bks1.rowid)
                      from   fa_mc_books bks1
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                      and    bks1.set_of_books_id = p_set_of_books_id
                     );
Line: 1899

            select polish_deprn_basis,
                   polish_adj_rec_cost
            into   x_prev_basis,
                   x_prev_adj_rec_cost
            from   fa_books_summary
            where  book_type_code = p_Book_Type_Code
            and    asset_id = p_Asset_Id
            and    period_counter = x_bef_trxn_period_counter;
Line: 1925

               select min(period_counter)
               into   l_min_period_counter
               from   fa_deprn_periods
               where  book_type_code = p_Book_Type_Code;
Line: 1934

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   x_prev_basis,
                            x_prev_adj_rec_cost
                     from   fa_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.rowid =
                     (
                      select max(bks1.rowid)
                      from   fa_books bks1,
                             fa_deprn_periods dp
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                      and    bks1.book_type_code = dp.book_type_code
                      and    dp.period_counter = x_bef_trxn_period_counter
                      and    bks1.date_effective <=
                             nvl(dp.period_close_date, sysdate)
                     );
Line: 1957

                     select bks.adjusted_cost,
                            bks.adjusted_recoverable_cost
                     into   x_prev_basis,
                            x_prev_adj_rec_cost
                     from   fa_books bks
                     where  bks.book_type_code = p_Book_Type_Code
                     and    bks.asset_id = p_Asset_Id
                     and    bks.rowid =
                     (
                      select min(bks1.rowid)
                      from   fa_books bks1
                      where  bks1.book_type_code = p_Book_Type_Code
                      and    bks1.asset_id = p_Asset_Id
                     );
Line: 2132

            select nvl(switch_code, 'XX')
            into   x_switch_code
            from   fa_mc_books_summary
            where  book_type_code = p_book_type_code
            and    asset_id = p_asset_id
            and    period_counter = p_period_counter
            and     set_of_books_id = p_set_of_books_id;
Line: 2146

            select nvl(switch_code, 'XX')
            into   x_switch_code
            from   fa_books_summary
            where  book_type_code = p_book_type_code
            and    asset_id = p_asset_id
            and    period_counter = p_period_counter;
Line: 2164

            select nvl(switch_code, 'XX')
            into   l_prev_switch_code
            from   fa_mc_books_summary
            where  book_type_code = p_book_type_code
            and    asset_id = p_asset_id
            and    period_counter = p_period_counter - 1
            and    set_of_books_id = p_set_of_books_id;
Line: 2178

            select nvl(switch_code, 'XX')
            into   l_prev_switch_code
            from   fa_books_summary
            where  book_type_code = p_book_type_code
            and    asset_id = p_asset_id
            and    period_counter = p_period_counter - 1;