1500:
1501: -- added this for bug 3684222
1502: select MAX(transaction_date_entered)
1503: into l_latest_reval_date
1504: from fa_transaction_headers
1505: where asset_id = l_asset_hdr_rec.asset_id
1506: and book_type_code = l_asset_hdr_rec.book_type_code
1507: and transaction_type_code in ('REVALUATION');
1508:
1614: end if;
1615:
1616: /*Bug#8289173 - to fetch transaction_header_id and retirement_id for the RETIREMENT row
1617: to not rely on table handler (for consistency)*/
1618: select fa_transaction_headers_s.nextval
1619: into l_trans_rec.transaction_header_id
1620: from dual;
1621:
1622: select fa_retirements_s.nextval
2023: if (l_asset_fin_rec.group_asset_id is not null) and
2024: (l_asset_retire_rec.recognize_gain_loss = 'NO') then
2025:
2026: --Need this for selection_thid
2027: SELECT fa_transaction_headers_s.nextval
2028: into l_dist_trans_rec.transaction_header_id /* 3513319 */
2029: FROM dual; /* Do we need this ???? dist th_id is initialized again below */
2030:
2031: -- Bug 15877517 : Reinitialize who_info as well
2109: fa_debug_pkg.add(l_calling_fn, 'asset_id:', l_asset_hdr_rec.asset_id, p_log_level_rec => p_log_level_rec);
2110: fa_debug_pkg.add(l_calling_fn, 'book_type_code:', l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec);
2111: end if;
2112:
2113: SELECT fa_transaction_headers_s.nextval
2114: into l_dist_trans_rec.transaction_header_id
2115: FROM dual;
2116:
2117: -- Bug 15877517 : Reinitialize who_info as well
2501: g_token1 := null;
2502: raise FND_API.G_EXC_ERROR;
2503: end if;
2504:
2505: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'do fa_transaction_headers_pkg.insert_row', '', p_log_level_rec => p_log_level_rec); end if;
2506: fa_transaction_headers_pkg.insert_row
2507: (x_rowid => l_th_rowid,
2508: x_transaction_header_id => l_trans_rec.transaction_header_id,
2509: x_book_type_code => l_asset_hdr_rec.book_type_code,
2502: raise FND_API.G_EXC_ERROR;
2503: end if;
2504:
2505: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'do fa_transaction_headers_pkg.insert_row', '', p_log_level_rec => p_log_level_rec); end if;
2506: fa_transaction_headers_pkg.insert_row
2507: (x_rowid => l_th_rowid,
2508: x_transaction_header_id => l_trans_rec.transaction_header_id,
2509: x_book_type_code => l_asset_hdr_rec.book_type_code,
2510: x_asset_id => l_asset_hdr_rec.asset_id,
3963: * Check to see previous retirement was source line retirement or not
3964: */
3965: cursor c_inv_trx_id (c_thid number)is
3966: select invoice_transaction_id
3967: from fa_transaction_headers
3968: where transaction_header_id = c_thid;
3969:
3970: cursor get_cost_before_ret(c_asset_id number, c_book varchar2, c_ret_id number, c_reporting_flag varchar2) is
3971: select cost
4281: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4282:
4283: end if; -- if corporate
4284:
4285: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'FA_TRANSACTION_HEADERS_PKG.DELETE_ROW', '', p_log_level_rec => p_log_level_rec); end if;
4286: FA_TRANSACTION_HEADERS_PKG.DELETE_ROW -- delete PARTIAL RETIREMENT row
4287: (X_Transaction_Header_Id =>
4288: l_asset_retire_rec.detail_info.transaction_header_id_in,
4289: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4282:
4283: end if; -- if corporate
4284:
4285: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'FA_TRANSACTION_HEADERS_PKG.DELETE_ROW', '', p_log_level_rec => p_log_level_rec); end if;
4286: FA_TRANSACTION_HEADERS_PKG.DELETE_ROW -- delete PARTIAL RETIREMENT row
4287: (X_Transaction_Header_Id =>
4288: l_asset_retire_rec.detail_info.transaction_header_id_in,
4289: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4290:
4287: (X_Transaction_Header_Id =>
4288: l_asset_retire_rec.detail_info.transaction_header_id_in,
4289: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4290:
4291: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'FA_TRANSACTION_HEADERS_PKG.DELETE_ROW -- delete TRANSFER OUT row', '', p_log_level_rec => p_log_level_rec); end if;
4292: FA_TRANSACTION_HEADERS_PKG.DELETE_ROW -- delete TRANSFER OUT row
4293: (X_Transaction_Header_Id =>
4294: transfer_id,
4295: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4288: l_asset_retire_rec.detail_info.transaction_header_id_in,
4289: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4290:
4291: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'FA_TRANSACTION_HEADERS_PKG.DELETE_ROW -- delete TRANSFER OUT row', '', p_log_level_rec => p_log_level_rec); end if;
4292: FA_TRANSACTION_HEADERS_PKG.DELETE_ROW -- delete TRANSFER OUT row
4293: (X_Transaction_Header_Id =>
4294: transfer_id,
4295: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4296:
4369: X_Book_Type_Code=> l_asset_hdr_rec.book_type_code,
4370: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4371: end if; -- if corporate
4372:
4373: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'FA_TRANSACTION_HEADERS_PKG.DELETE_ROW', '', p_log_level_rec => p_log_level_rec); end if;
4374: FA_TRANSACTION_HEADERS_PKG.DELETE_ROW
4375: (X_Transaction_Header_Id =>
4376: l_asset_retire_rec.detail_info.transaction_header_id_in,
4377: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4370: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4371: end if; -- if corporate
4372:
4373: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'FA_TRANSACTION_HEADERS_PKG.DELETE_ROW', '', p_log_level_rec => p_log_level_rec); end if;
4374: FA_TRANSACTION_HEADERS_PKG.DELETE_ROW
4375: (X_Transaction_Header_Id =>
4376: l_asset_retire_rec.detail_info.transaction_header_id_in,
4377: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4378:
4468:
4469: cursor tde_cursor is
4470: select max(th.transaction_date_entered)
4471: from fa_deprn_periods dp
4472: ,fa_transaction_headers th
4473: ,fa_books bk
4474: where dp.book_type_code = l_asset_hdr_rec.book_type_code
4475: and dp.period_close_date is null
4476: and bk.book_type_code = dp.book_type_code
5112:
5113: end if; -- date_retired
5114:
5115: -- Pop the transaction_header_id for the REINSTATEMENT row
5116: select fa_transaction_headers_s.nextval
5117: into l_trans_rec.transaction_header_id
5118: from dual;
5119:
5120: -- Bug 15877517 : Reinitialize who_info as well
5555:
5556: l_status boolean := TRUE;
5557:
5558: /*
5559: * Getting FA_TRANSACTION_HEADERS.INVOICE_TRANSACTION_ID
5560: */
5561: cursor c_inv_trx_id (c_thid number) is
5562: select invoice_transaction_id
5563: from fa_transaction_headers
5559: * Getting FA_TRANSACTION_HEADERS.INVOICE_TRANSACTION_ID
5560: */
5561: cursor c_inv_trx_id (c_thid number) is
5562: select invoice_transaction_id
5563: from fa_transaction_headers
5564: where transaction_header_id = c_thid;
5565:
5566: l_invoice_transaction_id number; -- Local variable to store return value of c_inv_trx_id;
5567:
5678: raise FND_API.G_EXC_UNEXPECTED_ERROR;
5679: end if;
5680: end if;
5681:
5682: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'do fa_transaction_headers_pkg.insert_row', '', p_log_level_rec => p_log_level_rec); end if;
5683:
5684: fa_transaction_headers_pkg.insert_row
5685: (x_rowid => l_rowid,
5686: x_transaction_header_id => l_trans_rec.transaction_header_id,
5680: end if;
5681:
5682: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'do fa_transaction_headers_pkg.insert_row', '', p_log_level_rec => p_log_level_rec); end if;
5683:
5684: fa_transaction_headers_pkg.insert_row
5685: (x_rowid => l_rowid,
5686: x_transaction_header_id => l_trans_rec.transaction_header_id,
5687: x_book_type_code => l_asset_hdr_rec.book_type_code,
5688: x_asset_id => l_asset_hdr_rec.asset_id,
6419: * Check to see previous retirement was source line retirement or not
6420: */
6421: cursor c_inv_trx_id (c_thid number)is
6422: select invoice_transaction_id
6423: from fa_transaction_headers
6424: where transaction_header_id = c_thid;
6425:
6426: l_invoice_transaction_id number; -- Local variable to store return value of c_inv_trx_id
6427:
6530:
6531: if (p_mrc_sob_type_code <> 'R') then
6532: -- ? check this parameter again
6533: -- delete transaction_headers row only for primary book
6534: FA_TRANSACTION_HEADERS_PKG.DELETE_ROW
6535: (X_Transaction_Header_Id => l_asset_retire_rec.detail_info.transaction_header_id_out,
6536: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
6537:
6538: end if; -- reporting_flag
6669: l_chk_ext_deprn varchar2(1) := 'N'; -- bug#8941124
6670:
6671: CURSOR c_last_grp_reclass IS
6672: select th.transaction_date_entered
6673: from fa_transaction_headers th
6674: , fa_trx_references tr
6675: where th.asset_id = p_asset_hdr_rec.asset_id
6676: and th.book_type_code = p_asset_hdr_rec.book_type_code
6677: and th.transaction_header_id = tr.member_transaction_header_id
6683:
6684: -- bug#8941124: Cursor to check the period of extended depreciation.
6685: CURSOR c_check_extended_deprn IS
6686: select distinct 'Y'
6687: from fa_transaction_headers trx,fa_Deprn_periods prd
6688: where trx.book_type_code = p_asset_hdr_rec.book_type_code
6689: and trx.asset_id = p_asset_hdr_rec.asset_id
6690: and trx.date_effective > prd.period_open_date
6691: and prd.book_type_code = trx.book_type_code
7251: begin
7252: select distinct 'Y'
7253: into l_trans_flag
7254: from
7255: fa_transaction_headers th,
7256: fa_calendar_periods cp,
7257: fa_book_controls bc,
7258: fa_conventions con,
7259: fa_additions_b ad,
7365: end if;
7366:
7367: SELECT nvl(max(transaction_header_id),0)
7368: INTO l_latest_ret_thid
7369: FROM fa_transaction_headers
7370: WHERE asset_id = l_asset_hdr_rec.asset_id
7371: AND book_type_code = l_asset_hdr_rec.book_type_code
7372: AND transaction_key = 'R'
7373: AND transaction_type_code||'' like '%RETIREMENT';
7666: end if;
7667: raise FND_API.G_EXC_UNEXPECTED_ERROR;
7668: end if;
7669:
7670: FA_TRANSACTION_HEADERS_PKG.UPDATE_ROW(
7671: X_Rowid => p_rowid,
7672: X_Invoice_Transaction_Id => l_inv_trans_rec.invoice_transaction_id,
7673: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
7674: