The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT date_placed_in_service,
life_in_months
FROM fa_books
WHERE book_type_code = n_book_code
AND asset_id = n_asset_id
AND transaction_header_id_out IS NULL;
SELECT number_per_fiscal_year
FROM fa_calendar_types
WHERE calendar_type = (SELECT deprn_calendar
FROM fa_book_controls
WHERE book_type_code = n_book_code);
SELECT iidb.adjustment_id,
iidb.distribution_id,
iidb.adjustment_cost,
iidb.net_book_value,
iidb.reval_reserve_cost,
iidb.reval_reserve_backlog,
iidb.reval_reserve_gen_fund,
iidb.reval_reserve_net,
iidb.operating_acct_cost,
iidb.operating_acct_backlog,
iidb.operating_acct_net,
iidb.operating_acct_ytd,
iidb.deprn_period,
iidb.deprn_ytd,
iidb.deprn_reserve,
iidb.deprn_reserve_backlog,
iidb.general_fund_per,
iidb.general_fund_acc,
iidb.active_flag,
iidb.last_reval_date,
iidb.current_reval_factor,
iidb.cumulative_reval_factor
FROM igi_iac_det_balances iidb
WHERE iidb.adjustment_id = cp_adjustment_id
AND iidb.asset_id = cp_asset_id
AND iidb.book_type_code = cp_book_type_code
AND iidb.active_flag = 'N';
SELECT iifd.deprn_ytd
FROM igi_iac_fa_deprn iifd
WHERE iifd.adjustment_id = cp_adjustment_id
AND iifd.distribution_id = cp_distribution_id
AND iifd.active_flag = 'N';
SELECT sum(nvl(fdd.deprn_amount,0)-nvl(fdd.deprn_adjustment_amount,0)) deprn_YTD
FROM fa_deprn_detail fdd
WHERE fdd.distribution_id = cp_distribution_id
AND fdd.book_type_code = cp_book_type_code
AND fdd.asset_id = cp_asset_id
AND fdd.period_counter IN (SELECT period_counter
FROM fa_deprn_periods
WHERE book_type_code = cp_book_type_code
AND fiscal_year = (SELECT fiscal_year
FROM fa_deprn_periods
WHERE period_close_date IS NULL
AND book_type_code = cp_book_type_code))
GROUP BY fdd.distribution_id;
IGI_IAC_DET_BALANCES_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => p_new_adj_id,
x_asset_id => p_asset_id,
x_book_type_code => p_book_type_code,
x_distribution_id => l_get_ytd.distribution_id,
x_period_counter => p_prd_counter,
x_adjustment_cost => l_get_ytd.adjustment_cost,
x_net_book_value => l_get_ytd.net_book_value,
x_reval_reserve_cost => l_get_ytd.reval_reserve_cost,
x_reval_reserve_backlog => l_get_ytd.reval_reserve_backlog,
x_reval_reserve_gen_fund => l_get_ytd.reval_reserve_gen_fund,
x_reval_reserve_net => l_get_ytd.reval_reserve_net,
x_operating_acct_cost => l_get_ytd.operating_acct_cost,
x_operating_acct_backlog => l_get_ytd.operating_acct_backlog,
x_operating_acct_net => l_get_ytd.operating_acct_net,
x_operating_acct_ytd => l_get_ytd.operating_acct_ytd,
x_deprn_period => l_get_ytd.deprn_period,
x_deprn_ytd => l_get_ytd.deprn_ytd,
x_deprn_reserve => l_get_ytd.deprn_reserve,
x_deprn_reserve_backlog => l_get_ytd.deprn_reserve_backlog,
x_general_fund_per => l_get_ytd.general_fund_per,
x_general_fund_acc => l_get_ytd.general_fund_acc,
x_last_reval_date => l_get_ytd.last_reval_date,
x_current_reval_factor => l_get_ytd.current_reval_factor,
x_cumulative_reval_factor => l_get_ytd.cumulative_reval_factor,
x_active_flag => l_get_ytd.active_flag
);
IGI_IAC_FA_DEPRN_PKG.Insert_Row(
x_rowid => l_rowid,
x_book_type_code => p_book_type_code,
x_asset_id => p_asset_id,
x_period_counter => p_prd_counter,
x_adjustment_id => p_new_adj_id,
x_distribution_id => l_get_ytd.distribution_id,
x_deprn_period => 0,
x_deprn_ytd => l_fa_deprn_ytd,
x_deprn_reserve => 0,
x_active_flag => 'N',
x_mode => 'R'
);
SELECT period_counter,
net_book_value,
adjusted_cost,
operating_acct,
reval_reserve,
deprn_amount,
deprn_reserve,
backlog_deprn_reserve,
general_fund,
last_reval_date,
current_reval_factor,
cumulative_reval_factor
FROM igi_iac_asset_balances
WHERE asset_id = cp_asset_id
AND book_type_code = cp_book_type_code
AND period_counter = cp_period_counter;
SELECT iidb.adjustment_id,
iidb.distribution_id,
iidb.period_counter,
iidb.adjustment_cost,
iidb.net_book_value,
iidb.reval_reserve_cost,
iidb.reval_reserve_backlog,
iidb.reval_reserve_gen_fund,
iidb.reval_reserve_net,
iidb.operating_acct_cost,
iidb.operating_acct_backlog,
iidb.operating_acct_ytd,
iidb.operating_acct_net,
iidb.deprn_period,
iidb.deprn_ytd,
iidb.deprn_reserve,
iidb.deprn_reserve_backlog,
iidb.general_fund_per,
iidb.general_fund_acc,
iidb.last_reval_date,
iidb.current_reval_factor,
iidb.cumulative_reval_factor,
iidb.active_flag
FROM igi_iac_det_balances iidb
WHERE iidb.adjustment_id = cp_adjust_id
AND iidb.book_type_code = cp_book_type_code
AND iidb.asset_id = cp_asset_id
AND iidb.distribution_id = cp_dist_id
AND iidb.active_flag IS NULL
ORDER BY iidb.distribution_id;
SELECT iifd.deprn_ytd,
iifd.deprn_period,
iifd.deprn_reserve
FROM igi_iac_fa_deprn iifd
WHERE iifd.adjustment_id = cp_adjustment_id
AND iifd.distribution_id = cp_distribution_id
AND iifd.active_flag IS NULL;
SELECT period_counter
FROM igi_iac_transaction_headers
WHERE adjustment_id = cp_latest_adj_id;
SELECT depreciate_flag
FROM fa_books
WHERE book_type_code = cp_book_type_code
AND asset_id = cp_asset_id
AND date_ineffective IS NULL;
SELECT period_counter
INTO l_rsvd_pc
FROM igi_iac_transaction_headers
WHERE adjustment_id = l_latest_adj_id;
IGI_IAC_TRANS_HEADERS_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => l_new_adj_id, -- out NOCOPY parameter
x_transaction_header_id => p_adj_hist.transaction_header_id_in, -- bug 3391000 null,
x_adjustment_id_out => null,
x_transaction_type_code => 'ADJUSTMENT',
x_transaction_date_entered => sysdate,
x_mass_refrence_id => null,
x_transaction_sub_type => 'COST',
x_book_type_code => l_book_type_code,
x_asset_id => l_asset_id,
x_category_id => p_adj_hist.category_id,
x_adj_deprn_start_date => null,
x_revaluation_type_flag => null,
x_adjustment_status => 'COMPLETE',
x_period_counter => l_last_period_counter,
x_event_id => p_event_id
);
IGI_IAC_TRANS_HEADERS_PKG.Update_Row(
x_prev_adjustment_id => l_adj_id_out,
x_adjustment_id => l_new_adj_id
);
IGI_IAC_DET_BALANCES_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => l_new_adj_id,
x_asset_id => l_asset_id,
x_book_type_code => l_book_type_code,
x_distribution_id => l_dist_id,
x_period_counter => l_last_period_counter,
x_adjustment_cost => l_new_dist_cost,
x_net_book_value => l_new_dist_nbv, --l_det_bal.net_book_value,
x_reval_reserve_cost => l_new_dist_rr_cost, --l_det_bal.reval_reserve_cost,
x_reval_reserve_backlog => l_det_bal.reval_reserve_backlog,
x_reval_reserve_gen_fund => l_det_bal.reval_reserve_gen_fund,
x_reval_reserve_net => l_new_dist_rr_net, --l_det_bal.reval_reserve_net,
x_operating_acct_cost => l_new_dist_op_cost, --l_det_bal.operating_acct_cost,
x_operating_acct_backlog => l_det_bal.operating_acct_backlog,
x_operating_acct_net => l_new_dist_op_net, --l_det_bal.operating_acct_net,
x_operating_acct_ytd => l_det_bal.operating_acct_ytd,
x_deprn_period => l_det_bal.deprn_period,
x_deprn_ytd => l_det_bal.deprn_ytd,
x_deprn_reserve => l_det_bal.deprn_reserve,
x_deprn_reserve_backlog => l_det_bal.deprn_reserve_backlog,
x_general_fund_per => l_det_bal.general_fund_per,
x_general_fund_acc => l_det_bal.general_fund_acc,
x_last_reval_date => l_det_bal.last_reval_date,
x_current_reval_factor => l_det_bal.current_reval_factor,
x_cumulative_reval_factor => l_det_bal.cumulative_reval_factor,
x_active_flag => null,
x_mode => 'R'
);
IGI_IAC_FA_DEPRN_PKG.Insert_Row(
x_rowid => l_rowid,
x_book_type_code => l_book_type_code,
x_asset_id => l_asset_id,
x_period_counter => l_last_period_counter,
x_adjustment_id => l_new_adj_id,
x_distribution_id => l_dist_id,
x_deprn_period => l_fa_deprn_period,
x_deprn_ytd => l_fa_deprn_ytd,
x_deprn_reserve => l_fa_deprn_reserve,
x_active_flag => null,
x_mode => 'R'
);
p_string => 'IAC Deprn row inserted');
IGI_IAC_ADJUSTMENTS_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => l_new_adj_id,
x_book_type_code => l_book_type_code,
x_code_combination_id => l_reval_rsv_ccid,
x_set_of_books_id => l_sob_id,
x_dr_cr_flag => 'CR', -- l_dr_cr_flag_ro,
x_amount => l_add_cost,
x_adjustment_type => 'REVAL RESERVE',
x_transfer_to_gl_flag => 'Y',
x_units_assigned => l_units_assigned,
x_asset_id => l_asset_id,
x_distribution_id => l_det_bal.distribution_id,
x_period_counter => l_last_period_counter,
x_adjustment_offset_type => 'COST',
x_report_ccid => Null,
x_mode => 'R',
x_event_id => p_event_id
);
IGI_IAC_ADJUSTMENTS_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => l_new_adj_id,
x_book_type_code => l_book_type_code,
x_code_combination_id => l_op_exp_ccid,
x_set_of_books_id => l_sob_id,
x_dr_cr_flag => 'CR', -- l_dr_cr_flag_ro,
x_amount => l_add_cost,
x_adjustment_type => 'OP EXPENSE',
x_transfer_to_gl_flag => 'Y',
x_units_assigned => l_units_assigned,
x_asset_id => l_asset_id,
x_distribution_id => l_det_bal.distribution_id,
x_period_counter => l_last_period_counter,
x_adjustment_offset_type =>'COST',
x_report_ccid => Null,
x_mode => 'R',
x_event_id => p_event_id
);
IGI_IAC_ADJUSTMENTS_PKG.Insert_Row(
x_rowid => l_rowid,
x_adjustment_id => l_new_adj_id,
x_book_type_code => l_book_type_code,
x_code_combination_id => l_cost_ccid,
x_set_of_books_id => l_sob_id,
x_dr_cr_flag => 'DR', -- l_dr_cr_flag_c,
x_amount => l_add_cost,
x_adjustment_type => 'COST',
x_transfer_to_gl_flag => 'Y',
x_units_assigned => l_units_assigned,
x_asset_id => l_asset_id,
x_distribution_id => l_det_bal.distribution_id,
x_period_counter => l_last_period_counter,
x_adjustment_offset_type => l_adjustment_offset_type,
x_report_ccid => l_report_ccid,
x_mode => 'R',
x_event_id => p_event_id
);
SELECT count(*)
INTO l_exists
FROM igi_iac_asset_balances
WHERE asset_id = l_asset_id
AND book_type_code = l_book_type_code
AND period_counter = l_last_period_counter;
IGI_IAC_ASSET_BALANCES_PKG.Update_Row(
X_asset_id => l_asset_id,
X_book_type_code => l_book_type_code,
X_period_counter => l_iac_asset_bal.period_counter,
X_net_book_value => l_iac_new_nbv, --l_iac_asset_bal.net_book_value,
X_adjusted_cost => l_iac_new_reval_cost,
X_operating_acct => l_iac_new_op, --l_iac_asset_bal.operating_acct,
X_reval_reserve => l_iac_new_rr, --l_iac_asset_bal.reval_reserve,
X_deprn_amount => l_iac_asset_bal.deprn_amount,
X_deprn_reserve => l_iac_asset_bal.deprn_reserve,
X_backlog_deprn_reserve => l_iac_asset_bal.backlog_deprn_reserve,
X_general_fund => l_iac_asset_bal.general_fund,
X_last_reval_date => l_iac_asset_bal.last_reval_date,
X_current_reval_factor => l_iac_asset_bal.current_reval_factor,
X_cumulative_reval_factor => l_iac_asset_bal.cumulative_reval_factor
) ;
IGI_IAC_ASSET_BALANCES_PKG.Insert_Row(
X_rowid => l_rowid,
X_asset_id => l_asset_id,
X_book_type_code => l_book_type_code,
X_period_counter => l_last_period_counter,
X_net_book_value => l_iac_new_nbv, --l_iac_asset_bal.net_book_value,
X_adjusted_cost => l_iac_new_reval_cost,
X_operating_acct => l_iac_new_op, --l_iac_asset_bal.operating_acct,
X_reval_reserve => l_iac_new_rr, --l_iac_asset_bal.reval_reserve,
X_deprn_amount => l_iac_asset_bal.deprn_amount,
X_deprn_reserve => l_iac_asset_bal.deprn_reserve,
X_backlog_deprn_reserve => l_iac_asset_bal.backlog_deprn_reserve,
X_general_fund => l_iac_asset_bal.general_fund,
X_last_reval_date => l_iac_asset_bal.last_reval_date,
X_current_reval_factor => l_iac_asset_bal.current_reval_factor,
X_cumulative_reval_factor => l_iac_asset_bal.cumulative_reval_factor
) ;