The following lines contain the word 'select', 'insert', 'update' or 'delete':
x_last_updated_by jl_co_fa_adjustments.last_updated_by%TYPE ;
x_last_update_login jl_co_fa_adjustments.last_update_login%TYPE;
SELECT ah.category_id,
th.asset_id,
th.transaction_header_id,
th.book_type_code,
th.transaction_type_code,
th.transaction_subtype,
th.transaction_date_entered,
th.date_effective,
th.source_transaction_header_id,
ad.asset_number,
ah.asset_type,
nvl (ah.units,0) units,
bk.date_placed_in_service,
bk.period_counter_capitalized,
nvl (bk.cost,0) adj_cost,
fnd_number.canonical_to_number(nvl (bk.global_attribute2,0)) appraisal_balance,
fnd_number.canonical_to_number(nvl (bk.global_attribute7,0)) deprn_to_cost,
bk.rowid book_rowid
FROM fa_transaction_headers th,
fa_deprn_periods dp,
fa_additions ad,
fa_asset_history ah,
fa_books bk
WHERE dp.book_type_code = pc_tax_book
AND dp.period_counter = pc_period_counter
AND th.book_type_code = dp.book_type_code
AND dp.period_open_date <= th.date_effective
AND th.date_effective <= dp.period_close_date
AND th.transaction_type_code IN ('REVALUATION',
'ADDITION',
'CIP ADDITION',
'ADJUSTMENT',
'CIP ADJUSTMENT',
'FULL RETIREMENT',
'PARTIAL RETIREMENT',
'REINSTATEMENT'
)
AND ad.asset_id = th.asset_id
AND ah.asset_id = th.asset_id
AND ah.date_effective <= th.date_effective
AND th.date_effective < nvl (ah.date_ineffective, sysdate)
AND bk.book_type_code = pc_tax_book
AND bk.asset_id = th.asset_id
AND bk.date_effective <= th.date_effective
AND th.date_effective < nvl (bk.date_ineffective, sysdate)
UNION
SELECT ah.category_id,
th.asset_id,
th.transaction_header_id,
th.book_type_code,
th.transaction_type_code,
th.transaction_subtype,
th.transaction_date_entered,
th.date_effective,
th.source_transaction_header_id,
ad.asset_number,
ah.asset_type,
nvl (ah.units,0),
bk.date_placed_in_service,
bk.period_counter_capitalized,
nvl (bk.cost,0),
fnd_number.canonical_to_number(nvl (bk.global_attribute2,0)),
fnd_number.canonical_to_number(nvl (bk.global_attribute7,0)),
bk.rowid
FROM fa_transaction_headers th,
fa_deprn_periods dp,
fa_additions ad,
fa_asset_history ah,
fa_books bk
WHERE dp.book_type_code = pc_corporate_book
AND dp.period_counter = pc_period_counter
AND th.book_type_code = dp.book_type_code
AND dp.period_open_date <= th.date_effective
AND th.date_effective <= dp.period_close_date
AND th.transaction_type_code IN ('TRANSFER OUT',
'RECLASS',
'CIP RECLASS',
'TRANSFER',
'CIP TRANSFER',
'UNIT ADJUSTMENT'
)
AND ad.asset_id = th.asset_id
AND ah.asset_id = th.asset_id
AND ah.date_effective <= th.date_effective
AND th.date_effective < nvl (ah.date_ineffective, sysdate)
AND bk.book_type_code = pc_tax_book
AND bk.asset_id = th.asset_id
AND bk.date_effective <= th.date_effective
AND th.date_effective < nvl (bk.date_ineffective, sysdate)
ORDER BY 1,2,3 ;
SELECT reserve_account_ccid,
deprn_reserve_acct,
global_attribute3,
global_attribute4,
global_attribute5,
global_attribute6,
global_attribute9,
global_attribute10,
global_attribute11,
global_attribute12,
global_attribute13,
global_attribute14,
global_attribute15
FROM fa_category_books
WHERE category_id = pc_category_id
AND book_type_code = pc_book_type_code ;
SELECT reserve_account_ccid,
deprn_reserve_acct
FROM fa_category_books
WHERE category_id = pc_category_id
AND book_type_code = pc_book_type_code ;
SELECT category_id
FROM fa_asset_history
WHERE asset_id = pc_asset_id
AND transaction_header_id_out = pc_transaction_header_id;
SELECT nvl (deprn_reserve,0),
nvl (reval_reserve,0),
nvl (reval_deprn_expense,0)
FROM fa_deprn_summary
WHERE asset_id = pc_asset_id
AND book_type_code = pc_book_type_code
AND period_counter = pc_period_counter;
SELECT ADJ.distribution_id,
ADJ.source_type_code,
ADJ.adjustment_type,
ADJ.debit_credit_flag,
--ADJ.code_combination_id,
XLN.code_combination_id,
ADJ.adjustment_amount,
ADJ.annualized_adjustment,
ADJ.period_counter_adjusted,
ADJ.period_counter_created,
ADJ.asset_invoice_id
FROM fa_adjustments ADJ,
--SLA Changes. New Tables Added
xla_ae_headers XHD,
xla_ae_lines XLN,
xla_distribution_links XDL
WHERE ADJ.transaction_header_id = pc_transaction_header_id
AND ADJ.book_type_code = pc_book_type_code
AND ADJ.period_counter_created = pc_period_counter --Bug 3680318,4060555
AND ADJ.adjustment_amount <> 0
--SLA Changes. New Joins added.
AND XDL.source_distribution_id_num_1 = ADJ.transaction_header_id
AND XDL.source_distribution_id_num_2 = ADJ.adjustment_line_id
AND XLN.ae_header_id = XHD.ae_header_id
AND XDL.application_id = 140
AND XDL.source_distribution_type = 'TRX'
AND XLN.ae_header_id = XDL.ae_header_id
AND XLN.ae_line_num = XDL.ae_line_num
AND XLN.application_id = 140
ORDER BY 1,2,3;
SELECT ADJ.distribution_id,
ADJ.source_type_code,
ADJ.adjustment_type,
ADJ.debit_credit_flag,
--ADJ.code_combination_id,
XLN.code_combination_id,
ADJ.adjustment_amount,
ADJ.annualized_adjustment,
ADJ.period_counter_adjusted,
ADJ.period_counter_created,
ADJ.asset_invoice_id
FROM fa_adjustments ADJ,
--SLA Changes. New Tables Added
xla_ae_headers XHD,
xla_ae_lines XLN,
xla_distribution_links XDL
WHERE ADJ.transaction_header_id = pc_transaction_header_id
AND ADJ.book_type_code = pc_book_type_code
AND ADJ.period_counter_created = pc_period_counter --Bug 3680318,4060555
AND ADJ.adjustment_amount <> 0
AND ADJ.adjustment_type = pc_adjustment_type
--SLA Changes. New Joins added.
AND XDL.source_distribution_id_num_1 = ADJ.transaction_header_id
AND XDL.source_distribution_id_num_2 = ADJ.adjustment_line_id
AND XLN.ae_header_id = XHD.ae_header_id
AND XDL.application_id = 140
AND XDL.source_distribution_type = 'TRX'
AND XLN.ae_header_id = XDL.ae_header_id
AND XLN.ae_line_num = XDL.ae_line_num
AND XLN.application_id = 140
ORDER BY 1,2,3;
SELECT XLN.code_combination_id,
ADJ.adjustment_amount
FROM fa_adjustments ADJ,
--SLA Changes. New Tables Added
xla_ae_headers XHD,
xla_ae_lines XLN,
xla_distribution_links XDL
WHERE ADJ.transaction_header_id = pc_transaction_header_id
AND ADJ.book_type_code = pc_book_type_code
AND ADJ.source_type_code = pc_source_type_code
AND ADJ.adjustment_type = pc_adjustment_type
AND ADJ.debit_credit_flag = pc_debit_credit_flag
AND ADJ.distribution_id = pc_distribution_id
AND ADJ.adjustment_amount <> 0
--SLA Changes. New Joins added.
AND XDL.source_distribution_id_num_1 = ADJ.transaction_header_id
AND XDL.source_distribution_id_num_2 = ADJ.adjustment_line_id
AND XLN.ae_header_id = XHD.ae_header_id
AND XDL.application_id = 140
AND XDL.source_distribution_type = 'TRX'
AND XLN.ae_header_id = XDL.ae_header_id
AND XLN.ae_line_num = XDL.ae_line_num
AND XLN.application_id = 140;
SELECT nvl (sum (nvl (adjustment_amount,0)), 0)
FROM fa_adjustments
WHERE asset_id = pc_asset_id
AND book_type_code = pc_book_type_code
AND transaction_header_id = pc_transaction_header_id
AND adjustment_type = pc_adjustment_type
AND debit_credit_flag = pc_debit_credit_flag ;
SELECT nvl (sum (nvl (adjustment_amount,0)), 0)
FROM fa_adjustments
WHERE asset_id = pc_asset_id
AND book_type_code = pc_book_type_code
AND period_counter_created = pc_period_counter
AND adjustment_type = pc_adjustment_type
AND debit_credit_flag = pc_debit_credit_flag ;
SELECT retirement_id,
nvl (cost_retired,0),
nvl (units,0),
nvl (nbv_retired,0),
nvl (reval_reserve_retired,0),
nvl (gain_loss_amount,0)
FROM fa_retirements
WHERE transaction_header_id_in = pc_transaction_header_id ;
SELECT rt.retirement_id,
nvl (rt.cost_retired,0),
nvl (rt.units,0),
nvl (rt.nbv_retired,0),
nvl (rt.reval_reserve_retired,0),
nvl (rt.gain_loss_amount,0),
dp.period_counter,
th.transaction_type_code
FROM fa_retirements rt,
fa_deprn_periods dp,
fa_transaction_headers th
WHERE rt.transaction_header_id_out = pc_transaction_header_id
AND dp.book_type_code = rt.book_type_code
AND dp.period_open_date <= rt.date_effective
AND rt.date_effective <= dp.period_close_date
AND th.transaction_header_id = rt.transaction_header_id_in ;
SELECT transaction_header_id_in
FROM fa_retirements
WHERE retirement_id = (SELECT retirement_id
FROM fa_distribution_history
WHERE distribution_id = (SELECT distribution_id
FROM fa_distribution_history
WHERE transaction_header_id_out = pc_transaction_header_id
AND rownum = 1));
SELECT transaction_header_id_in,
fnd_number.canonical_to_number(nvl (global_attribute7,0))
FROM fa_books
WHERE transaction_header_id_out = pc_transaction_header_id;
SELECT ah.category_id,
ds.asset_id,
ad.asset_number,
bk.transaction_header_id_in,
fnd_number.canonical_to_number(nvl (bk.global_attribute7,0)) deprn_to_cost,
bk.rowid book_rowid
FROM fa_additions ad,
fa_asset_history ah,
fa_books bk,
fa_deprn_summary ds
WHERE ds.book_type_code = pc_book_type_code
AND ds.period_counter = pc_period_counter
AND ad.asset_id = ds.asset_id
AND ah.asset_id = ds.asset_id
AND ah.date_effective <= pc_deprn_date
AND pc_deprn_date < nvl (ah.date_ineffective, sysdate)
AND bk.book_type_code = ds.book_type_code
AND bk.asset_id = ds.asset_id
AND bk.date_effective <= pc_deprn_date
AND pc_deprn_date < nvl (bk.date_ineffective, sysdate)
ORDER BY ah.category_id,
ds.asset_id ;
SELECT dd.distribution_id,
nvl (dd.deprn_amount, 0) adj_deprn_amount,
nvl (dd.deprn_adjustment_amount, 0) adj_deprn_adjustment_amount,
nvl (dc.deprn_amount, 0) corp_deprn_amount,
nvl (dc.deprn_adjustment_amount, 0) corp_deprn_adjustment_amount,
dh.code_combination_id
FROM fa_deprn_detail dd,
fa_deprn_detail dc,
fa_distribution_history dh
WHERE dd.asset_id = pc_asset_id
AND dd.book_type_code = pc_tax_book
AND dd.period_counter = pc_period_counter
AND dc.asset_id = dd.asset_id
AND dc.book_type_code = pc_corporate_book
AND dc.period_counter = dd.period_counter
AND dc.distribution_id = dd.distribution_id
AND dh.distribution_id = dd.distribution_id;
x_last_updated_by := fnd_global.user_id;
x_last_update_login := fnd_global.login_id;
SELECT bc.accounting_flex_structure,
bc.distribution_source_book,
bc.last_period_counter,
nvl (bc.global_attribute5, last_period_counter),
-- bc.je_depreciation_category,
bc.global_attribute6,
bc.global_attribute7,
bc.global_attribute8,
bc.global_attribute9,
bc.global_attribute10,
bc.global_attribute11,
bc.global_attribute12,
bc.global_attribute13,
bc.global_attribute14,
bc.global_attribute15,
bc.global_attribute16,
bc.global_attribute17,
bc.global_attribute18,
dp.period_name,
dp.period_close_date,
sb.currency_code
INTO x_chart_of_accounts_id,
x_corporate_book,
x_period_counter,
x_account_period,
-- x_je_depreciation,
x_je_infln_adjustment,
x_je_ia_reclass,
x_je_ia_cip_reclass,
x_je_ia_transfer,
x_je_ia_cip_transfer,
x_je_ia_retirement,
x_je_ia_cip_retirement,
x_je_appraisal,
x_je_ia_addition,
x_je_ia_cip_addition,
x_je_ia_adjustment,
x_je_ia_cip_adjustment,
x_je_cip_infln_adjustment,
x_period_name,
x_deprn_date,
x_currency_code
FROM fa_book_controls bc,
fa_deprn_periods dp,
gl_sets_of_books sb
WHERE bc.book_type_code = p_tax_book
AND dp.book_type_code = bc.book_type_code
AND dp.period_counter = bc.last_period_counter
AND sb.set_of_books_id = bc.set_of_books_id ;
SELECT je_category_name
INTO x_je_depreciation
FROM xla_event_class_attrs
WHERE application_id = 140
AND entity_code = 'DEPRECIATION'
AND event_class_code = 'DEPRECIATION';
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_infln_adjustment,
x_ia_cost_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
ra.adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_infln_adjustment,
x_ix_cost_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
ra.adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_infln_adjustment,
x_ix_reserve_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
ra.adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_infln_adjustment,
x_ia_reserve_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
ra.adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_cip_infln_adjustment,
x_ia_cip_cost_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
ra.adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_cip_infln_adjustment,
x_ix_cip_cost_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
ra.adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_cost_name,
ra.debit_credit_flag,
ra.code_combination_id,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ia_cost_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ix_cost_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
'DEPRECIATION',
x_je_depreciation,
x_expense_name,
ra.debit_credit_flag,
ra.code_combination_id,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
x_period_counter,
x_period_counter,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
'DEPRECIATION',
x_je_depreciation,
x_reserve_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
x_period_counter,
x_period_counter,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ix_reserve_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ia_reserve_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ia_cip_cost_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ix_cip_cost_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ia_cost_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_std_category_name,
x_reserve_name,
ra.debit_credit_flag,
ra.code_combination_id,
p_tax_book,
tr.asset_id,
x_value_1,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ia_reserve_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_value_2,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
'DEPRECIATION',
x_je_depreciation,
x_expense_name,
ra.debit_credit_flag,
ra.code_combination_id,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
x_period_counter,
x_period_counter,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ia_cip_cost_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_appraisal,
x_je_appraisal,
x_ta_revaluation_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_ta_line_amount,
ra.distribution_id,
NULL,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
NULL,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_appraisal,
x_je_appraisal,
x_ta_surplus_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_ta_line_amount,
ra.distribution_id,
NULL,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
NULL,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_appraisal,
x_je_appraisal,
x_ta_reserve_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_ta_line_amount,
ra.distribution_id,
NULL,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
NULL,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ia_cost_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_std_category_name,
x_reserve_name,
ra.debit_credit_flag,
ra.code_combination_id,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ia_reserve_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
'DEPRECIATION',
x_je_depreciation,
x_expense_name,
ra.debit_credit_flag,
ra.code_combination_id,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
x_period_counter,
x_period_counter,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_category_name,
x_ia_cip_cost_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_appraisal,
x_je_appraisal,
x_ta_revaluation_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_ta_line_amount,
ra.distribution_id,
NULL,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
NULL,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_appraisal,
x_je_appraisal,
x_ta_surplus_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_ta_line_amount,
ra.distribution_id,
NULL,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
NULL,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_appraisal,
x_je_appraisal,
x_ta_reserve_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_ta_line_amount,
ra.distribution_id,
NULL,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
NULL,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
'DEPRECIATION',
x_je_depreciation,
x_expense_name,
ra.debit_credit_flag,
ra.code_combination_id,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
x_period_counter,
x_period_counter,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
'DEPRECIATION',
x_je_depreciation,
x_reserve_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
x_period_counter,
x_period_counter,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_ia_retirement,
x_nbv_retired_name,
x_nbv_debit_credit_flag,
x_nbv_retired_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
x_distribution_id,
NULL,
NULL,
NULL,
x_period_counter,
x_period_counter,
NULL,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_ia_cip_retirement,
x_ia_cip_cost_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_ia_retirement,
x_ia_cost_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_std_category_name,
x_reserve_name,
ra.debit_credit_flag,
ra.code_combination_id,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_ia_retirement,
x_ia_reserve_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_ia_reserve,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_ia_retirement,
ra.adjustment_type,
x_debit_credit_flag,
x_code_combination_id,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_ia_retirement,
ra.adjustment_type,
ra.debit_credit_flag,
ra.code_combination_id,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
ra.distribution_id,
ra.annualized_adjustment,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
ra.asset_invoice_id,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_appraisal,
x_je_appraisal,
x_ta_revaluation_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_ta_line_amount,
ra.distribution_id,
NULL,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
NULL,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_appraisal,
x_je_appraisal,
x_ta_surplus_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_ta_line_amount,
ra.distribution_id,
NULL,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
NULL,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_appraisal,
x_je_appraisal,
x_ta_reserve_name,
x_debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_ta_line_amount,
ra.distribution_id,
NULL,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
NULL,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_appraisal,
x_je_appraisal,
x_ta_recovery_name,
ra.debit_credit_flag,
x_returned_ccid,
p_tax_book,
tr.asset_id,
x_ta_line_amount,
ra.distribution_id,
NULL,
NULL,
NULL,
ra.period_counter_adjusted,
ra.period_counter_created,
NULL,
NULL,
NULL
);
insert_adjustment (tr.transaction_header_id,
x_global_source,
x_je_ia_retirement,
x_nbv_retired_name,
x_nbv_debit_credit_flag,
x_nbv_retired_ccid,
p_tax_book,
tr.asset_id,
x_adjustment_amount,
x_distribution_id,
NULL,
NULL,
NULL,
x_period_counter,
x_period_counter,
NULL,
NULL,
NULL
);
x_char := 'Update Deprn_to_cost = ' || to_char(x_deprn_to_cost);
UPDATE fa_books
SET global_attribute7 = fnd_number.number_to_canonical(x_deprn_to_cost)
WHERE rowid = tr.book_rowid ;
insert_adjustment (NULL,
x_global_source,
x_je_depreciation,
x_expense_name,
'DR',
ld.code_combination_id,
p_tax_book,
ad.asset_id,
x_adjustment_amount,
ld.distribution_id,
NULL,
NULL,
NULL,
x_period_counter,
x_period_counter,
NULL,
NULL,
NULL
);
insert_adjustment (NULL,
x_global_source,
x_je_depreciation,
x_reserve_name,
'CR',
x_returned_ccid,
p_tax_book,
ad.asset_id,
x_adjustment_amount,
ld.distribution_id,
NULL,
NULL,
NULL,
x_period_counter,
x_period_counter,
NULL,
NULL,
NULL
);
x_char := 'Update Deprn_to_cost = ' || to_char(x_deprn_to_cost);
UPDATE fa_books
SET global_attribute7 = fnd_number.number_to_canonical(x_deprn_to_cost)
WHERE rowid = ad.book_rowid ;
UPDATE fa_book_controls
SET global_attribute5 = x_period_counter
WHERE book_type_code = p_tax_book;
PROCEDURE insert_adjustment (p_transaction_header_id IN jl_co_fa_adjustments.transaction_header_id%TYPE,
p_source_type_code IN jl_co_fa_adjustments.source_type_code%TYPE,
p_je_category_name IN jl_co_fa_adjustments.je_category_name%TYPE,
p_adjustment_type IN jl_co_fa_adjustments.adjustment_type%TYPE,
p_debit_credit_flag IN jl_co_fa_adjustments.debit_credit_flag%TYPE,
p_code_combination_id IN jl_co_fa_adjustments.code_combination_id%TYPE,
p_book_type_code IN jl_co_fa_adjustments.book_type_code%TYPE,
p_asset_id IN jl_co_fa_adjustments.asset_id%TYPE,
p_adjustment_amount IN jl_co_fa_adjustments.adjustment_amount%TYPE,
p_distribution_id IN jl_co_fa_adjustments.distribution_id%TYPE,
p_annualized_adjustment IN jl_co_fa_adjustments.annualized_adjustment%TYPE,
p_je_header_reference_id IN jl_co_fa_adjustments.je_header_reference_id%TYPE,
p_sequence_line IN jl_co_fa_adjustments.sequence_line%TYPE,
p_period_counter_adjusted IN jl_co_fa_adjustments.period_counter_adjusted%TYPE,
p_period_counter_created IN jl_co_fa_adjustments.period_counter_created%TYPE,
p_asset_invoice_id IN jl_co_fa_adjustments.asset_invoice_id%TYPE,
p_reference IN jl_co_fa_adjustments.reference%TYPE,
p_posting_flag IN jl_co_fa_adjustments.posting_flag%TYPE
)
IS
x_adjustment_amount NUMBER;
SELECT original_cost
INTO l_original_cost
FROM FA_BOOKS
WHERE book_type_code = p_book_type_code
AND asset_id = p_asset_id;
INSERT INTO jl_co_fa_adjustments
(transaction_header_id,
source_type_code,
je_category_name,
adjustment_type,
debit_credit_flag,
code_combination_id,
book_type_code,
asset_id,
adjustment_amount,
distribution_id,
annualized_adjustment,
je_header_reference_id,
sequence_line,
period_counter_adjusted,
period_counter_created,
asset_invoice_id,
reference,
posting_flag,
created_by,
creation_date,
last_updated_by,
last_update_date,
last_update_login,
request_id,
program_application_id,
program_id,
program_update_date
)
VALUES (p_transaction_header_id,
p_source_type_code,
p_je_category_name,
p_adjustment_type,
x_debit_credit_flag,
p_code_combination_id,
p_book_type_code,
p_asset_id,
x_adjustment_amount,
p_distribution_id,
p_annualized_adjustment,
p_je_header_reference_id,
p_sequence_line,
p_period_counter_adjusted,
p_period_counter_created,
p_asset_invoice_id,
p_reference,
p_posting_flag,
x_last_updated_by,
x_sysdate,
x_last_updated_by,
x_sysdate,
x_last_update_login,
x_request_id,
x_program_application_id,
x_program_id,
x_sysdate
);
END insert_adjustment;