16: , cp_asset_id in number
17: , cp_book_type_code in varchar2
18: ) is
19: select cumulative_reval_factor, current_reval_factor
20: from igi_iac_asset_balances
21: where asset_id = cp_asset_id
22: and book_type_code = cp_book_type_code
23: and period_counter = cp_period_counter
24: ;
254: igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'+ x_cumulative_reval_factor => '||pp_reval_output_asset.cumulative_reval_factor);
255:
256: if l_exists then
257: igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'+balance record already exists, so update');
258: IGI_IAC_ASSET_BALANCES_PKG.update_row (
259: x_asset_id => pp_reval_output_asset.asset_id,
260: x_book_type_code => pp_reval_output_asset.book_type_code,
261: x_period_counter => pp_period_counter,
262: x_net_book_value => pp_reval_output_asset.net_book_value,
273: x_mode => 'R'
274: );
275: else
276: igi_iac_debug_pkg.debug_other_string(g_state_level,l_path,'+balance record does not exist, so insert');
277: IGI_IAC_ASSET_BALANCES_PKG.insert_row (
278: x_rowid => l_rowid,
279: x_asset_id => pp_reval_output_asset.asset_id,
280: x_book_type_code => pp_reval_output_asset.book_type_code,
281: x_period_counter => pp_period_counter,
304: )
305: return boolean is
306: cursor c_bal is
307: select *
308: from igi_iac_asset_balances
309: where asset_id = fp_Asset_id
310: and book_type_code = fp_book_type_code
311: and period_counter = fp_period_counter
312: ;
2244: , fp_book_type_code in IGI_IAC_TRANSACTION_HEADERS.BOOK_TYPE_CODE%TYPE
2245: )
2246: return boolean is
2247:
2248: l_bal_net_book_value IGI_IAC_ASSET_BALANCES.NET_BOOK_VALUE%TYPE;
2249: l_bal_adjusted_cost IGI_IAC_ASSET_BALANCES.adjusted_cost%TYPE;
2250: l_bal_operating_acct IGI_IAC_ASSET_BALANCES.operating_acct%TYPE;
2251: l_bal_reval_reserve IGI_IAC_ASSET_BALANCES.reval_reserve%TYPE;
2252: l_bal_deprn_reserve IGI_IAC_ASSET_BALANCES.deprn_reserve%TYPE;
2245: )
2246: return boolean is
2247:
2248: l_bal_net_book_value IGI_IAC_ASSET_BALANCES.NET_BOOK_VALUE%TYPE;
2249: l_bal_adjusted_cost IGI_IAC_ASSET_BALANCES.adjusted_cost%TYPE;
2250: l_bal_operating_acct IGI_IAC_ASSET_BALANCES.operating_acct%TYPE;
2251: l_bal_reval_reserve IGI_IAC_ASSET_BALANCES.reval_reserve%TYPE;
2252: l_bal_deprn_reserve IGI_IAC_ASSET_BALANCES.deprn_reserve%TYPE;
2253: l_bal_deprn_amount IGI_IAC_ASSET_BALANCES.deprn_amount%TYPE;
2246: return boolean is
2247:
2248: l_bal_net_book_value IGI_IAC_ASSET_BALANCES.NET_BOOK_VALUE%TYPE;
2249: l_bal_adjusted_cost IGI_IAC_ASSET_BALANCES.adjusted_cost%TYPE;
2250: l_bal_operating_acct IGI_IAC_ASSET_BALANCES.operating_acct%TYPE;
2251: l_bal_reval_reserve IGI_IAC_ASSET_BALANCES.reval_reserve%TYPE;
2252: l_bal_deprn_reserve IGI_IAC_ASSET_BALANCES.deprn_reserve%TYPE;
2253: l_bal_deprn_amount IGI_IAC_ASSET_BALANCES.deprn_amount%TYPE;
2254: l_bal_backlog_deprn_reserve IGI_IAC_ASSET_BALANCES.backlog_deprn_reserve%TYPE;
2247:
2248: l_bal_net_book_value IGI_IAC_ASSET_BALANCES.NET_BOOK_VALUE%TYPE;
2249: l_bal_adjusted_cost IGI_IAC_ASSET_BALANCES.adjusted_cost%TYPE;
2250: l_bal_operating_acct IGI_IAC_ASSET_BALANCES.operating_acct%TYPE;
2251: l_bal_reval_reserve IGI_IAC_ASSET_BALANCES.reval_reserve%TYPE;
2252: l_bal_deprn_reserve IGI_IAC_ASSET_BALANCES.deprn_reserve%TYPE;
2253: l_bal_deprn_amount IGI_IAC_ASSET_BALANCES.deprn_amount%TYPE;
2254: l_bal_backlog_deprn_reserve IGI_IAC_ASSET_BALANCES.backlog_deprn_reserve%TYPE;
2255: l_bal_general_fund IGI_IAC_ASSET_BALANCES.general_fund%TYPE;
2248: l_bal_net_book_value IGI_IAC_ASSET_BALANCES.NET_BOOK_VALUE%TYPE;
2249: l_bal_adjusted_cost IGI_IAC_ASSET_BALANCES.adjusted_cost%TYPE;
2250: l_bal_operating_acct IGI_IAC_ASSET_BALANCES.operating_acct%TYPE;
2251: l_bal_reval_reserve IGI_IAC_ASSET_BALANCES.reval_reserve%TYPE;
2252: l_bal_deprn_reserve IGI_IAC_ASSET_BALANCES.deprn_reserve%TYPE;
2253: l_bal_deprn_amount IGI_IAC_ASSET_BALANCES.deprn_amount%TYPE;
2254: l_bal_backlog_deprn_reserve IGI_IAC_ASSET_BALANCES.backlog_deprn_reserve%TYPE;
2255: l_bal_general_fund IGI_IAC_ASSET_BALANCES.general_fund%TYPE;
2256: l_cumm_reval_factor IGI_IAC_ASSET_BALANCES.cumulative_reval_factor%TYPE;
2249: l_bal_adjusted_cost IGI_IAC_ASSET_BALANCES.adjusted_cost%TYPE;
2250: l_bal_operating_acct IGI_IAC_ASSET_BALANCES.operating_acct%TYPE;
2251: l_bal_reval_reserve IGI_IAC_ASSET_BALANCES.reval_reserve%TYPE;
2252: l_bal_deprn_reserve IGI_IAC_ASSET_BALANCES.deprn_reserve%TYPE;
2253: l_bal_deprn_amount IGI_IAC_ASSET_BALANCES.deprn_amount%TYPE;
2254: l_bal_backlog_deprn_reserve IGI_IAC_ASSET_BALANCES.backlog_deprn_reserve%TYPE;
2255: l_bal_general_fund IGI_IAC_ASSET_BALANCES.general_fund%TYPE;
2256: l_cumm_reval_factor IGI_IAC_ASSET_BALANCES.cumulative_reval_factor%TYPE;
2257: l_reval_factor IGI_IAC_ASSET_BALANCES.current_reval_factor%TYPE;
2250: l_bal_operating_acct IGI_IAC_ASSET_BALANCES.operating_acct%TYPE;
2251: l_bal_reval_reserve IGI_IAC_ASSET_BALANCES.reval_reserve%TYPE;
2252: l_bal_deprn_reserve IGI_IAC_ASSET_BALANCES.deprn_reserve%TYPE;
2253: l_bal_deprn_amount IGI_IAC_ASSET_BALANCES.deprn_amount%TYPE;
2254: l_bal_backlog_deprn_reserve IGI_IAC_ASSET_BALANCES.backlog_deprn_reserve%TYPE;
2255: l_bal_general_fund IGI_IAC_ASSET_BALANCES.general_fund%TYPE;
2256: l_cumm_reval_factor IGI_IAC_ASSET_BALANCES.cumulative_reval_factor%TYPE;
2257: l_reval_factor IGI_IAC_ASSET_BALANCES.current_reval_factor%TYPE;
2258: l_reval_date date;
2251: l_bal_reval_reserve IGI_IAC_ASSET_BALANCES.reval_reserve%TYPE;
2252: l_bal_deprn_reserve IGI_IAC_ASSET_BALANCES.deprn_reserve%TYPE;
2253: l_bal_deprn_amount IGI_IAC_ASSET_BALANCES.deprn_amount%TYPE;
2254: l_bal_backlog_deprn_reserve IGI_IAC_ASSET_BALANCES.backlog_deprn_reserve%TYPE;
2255: l_bal_general_fund IGI_IAC_ASSET_BALANCES.general_fund%TYPE;
2256: l_cumm_reval_factor IGI_IAC_ASSET_BALANCES.cumulative_reval_factor%TYPE;
2257: l_reval_factor IGI_IAC_ASSET_BALANCES.current_reval_factor%TYPE;
2258: l_reval_date date;
2259: l_output igi_iac_types.iac_reval_output_asset;
2252: l_bal_deprn_reserve IGI_IAC_ASSET_BALANCES.deprn_reserve%TYPE;
2253: l_bal_deprn_amount IGI_IAC_ASSET_BALANCES.deprn_amount%TYPE;
2254: l_bal_backlog_deprn_reserve IGI_IAC_ASSET_BALANCES.backlog_deprn_reserve%TYPE;
2255: l_bal_general_fund IGI_IAC_ASSET_BALANCES.general_fund%TYPE;
2256: l_cumm_reval_factor IGI_IAC_ASSET_BALANCES.cumulative_reval_factor%TYPE;
2257: l_reval_factor IGI_IAC_ASSET_BALANCES.current_reval_factor%TYPE;
2258: l_reval_date date;
2259: l_output igi_iac_types.iac_reval_output_asset;
2260:
2253: l_bal_deprn_amount IGI_IAC_ASSET_BALANCES.deprn_amount%TYPE;
2254: l_bal_backlog_deprn_reserve IGI_IAC_ASSET_BALANCES.backlog_deprn_reserve%TYPE;
2255: l_bal_general_fund IGI_IAC_ASSET_BALANCES.general_fund%TYPE;
2256: l_cumm_reval_factor IGI_IAC_ASSET_BALANCES.cumulative_reval_factor%TYPE;
2257: l_reval_factor IGI_IAC_ASSET_BALANCES.current_reval_factor%TYPE;
2258: l_reval_date date;
2259: l_output igi_iac_types.iac_reval_output_asset;
2260:
2261: cursor c_asset_bal is
2270: ,nvl(general_fund,0) general_fund
2271: ,last_reval_date
2272: ,current_reval_factor
2273: ,cumulative_reval_factor
2274: from igi_iac_asset_balances
2275: where asset_id = fp_asset_id
2276: and book_type_code = fp_book_type_code
2277: and period_counter = ( select max(period_counter)
2278: from igi_iac_asset_balances
2274: from igi_iac_asset_balances
2275: where asset_id = fp_asset_id
2276: and book_type_code = fp_book_type_code
2277: and period_counter = ( select max(period_counter)
2278: from igi_iac_asset_balances
2279: where asset_id = fp_asset_id
2280: and book_type_code = fp_book_type_code
2281: and period_counter <= fp_period_counter )
2282: ;
2319: l_path varchar2(150);
2320:
2321: begin
2322: l_path := g_path||'update_balances';
2323: -- 1. Get the old balance from igi_iac_asset_balances
2324: l_bal_net_book_value := 0;
2325: l_bal_adjusted_cost := 0;
2326: l_bal_operating_acct := 0;
2327: l_bal_reval_reserve := 0;