[Home] [Help]
PACKAGE BODY: APPS.IGI_IMP_IAC_PREPARE_PKG
Source
1 PACKAGE BODY IGI_IMP_IAC_PREPARE_PKG AS
2 -- $Header: igiimpdb.pls 120.24.12000000.2 2007/10/22 13:51:43 gkumares ship $
3
4 Cursor C_Asset_Category(p_book in varchar) Is
5 Select category_id
6 From fa_category_books
7 Where book_type_code = p_book;
8
9 Cursor C_Book_Info(p_book in varchar2, p_category_id in number) Is
10 Select bk.asset_id,
11 bk.date_placed_in_service,
12 bk.life_in_months,
13 nvl(bk.cost,0) cost,
14 nvl(bk.adjusted_cost,0) adjusted_cost,
15 nvl(bk.original_cost,0) original_cost,
16 nvl(bk.salvage_value,0) salvage_value,
17 nvl(bk.adjusted_recoverable_cost, 0) adjusted_recoverable_cost,
18 nvl(bk.recoverable_cost,0) recoverable_cost,
19 bk.deprn_start_date,
20 bk.cost_change_flag,
21 bk.rate_adjustment_factor,
22 bk.depreciate_flag,
23 bk.fully_rsvd_revals_counter,
24 bk.period_counter_fully_reserved,
25 bk.period_counter_fully_retired,
26 ad.asset_number,
27 ad.asset_type
28 From fa_books bk,
29 fa_additions ad
30 Where bk.book_type_code = p_book
31 and bk.asset_id = ad.asset_id
32 and bk.transaction_header_id_out is null
33 and ad.asset_category_id = p_category_id;
34
35 Cursor C_Fiscal_Year(p_book in varchar2, p_period_counter in number) Is
36 Select fiscal_year
37 From fa_deprn_periods dp
38 Where book_type_code = p_book
39 and period_counter = p_period_counter;
40
41 Cursor C_Corp_Book_Info(p_book in varchar2, p_asset_id in number) Is
42 Select asset_id,
43 date_placed_in_service,
44 life_in_months,
45 nvl(cost,0) cost,
46 nvl(adjusted_cost,0) adjusted_cost,
47 nvl(original_cost,0) original_cost,
48 nvl(salvage_value,0) salvage_value,
49 nvl(adjusted_recoverable_cost, 0) adjusted_recoverable_cost,
50 nvl(recoverable_cost,0) recoverable_cost,
51 deprn_start_date,
52 cost_change_flag,
53 rate_adjustment_factor,
54 depreciate_flag,
55 fully_rsvd_revals_counter,
56 period_counter_fully_reserved,
57 period_counter_fully_retired
58 From fa_books
59 Where book_type_code = p_book
60 and date_ineffective is null
61 and asset_id = p_asset_id;
62
63 Cursor C_Corp_Deprn_Details(p_book in varchar2,
64 p_asset_id in number,
65 p_period_counter in number) Is
66 Select nvl(sum(deprn_amount),0) deprn_amount,
67 nvl(sum(deprn_reserve),0) deprn_reserve,
68 nvl(sum(cost),0) cost,
69 nvl(sum(reval_reserve),0) reval_reserve,
70 nvl(sum(ytd_deprn),0) ytd_deprn,
71 nvl(sum(deprn_adjustment_amount),0) deprn_adjustment_amount
72 From fa_deprn_detail
73 Where book_type_code = p_book
74 and period_counter = p_period_counter
75 and asset_id = p_asset_id
76 and deprn_source_code = 'D'
77 Group by asset_id;
78
79 Cursor C_Corp_Deprn_Summary(p_book in varchar2,
80 p_asset_id in number,
81 p_period_counter in number) Is
82 Select nvl(deprn_amount,0) deprn_amount,
83 nvl(ytd_deprn,0) ytd_deprn,
84 nvl(deprn_reserve,0) deprn_reserve,
85 deprn_source_code,
86 nvl(reval_reserve,0) reval_reserve,
87 nvl(adjusted_cost,0) adjusted_cost
88 From fa_deprn_summary
89 Where book_type_code = p_book
90 and period_counter = p_period_counter
91 and asset_id = p_asset_id
92 and deprn_source_code = 'DEPRN';
93
94 Cursor C_Corp_Max_Period_Counter(p_book in varchar2,
95 p_asset_id in number) Is
96 Select max(Period_counter) period_counter
97 From fa_deprn_summary
98 Where book_type_code = p_book
99 and asset_id = p_asset_id
100 and deprn_source_code = 'DEPRN';
101
102 l_rec_ctr number;
103 l_max_records number;
104 l_group_id number;
105 l_cat_records number;
106 l_fiscal_year number;
107 l_book_last_per_counter number;
108 l_corp_last_per_counter number;
109 l_exception_code varchar2(1);
110 l_exception_flag varchar2(1);
111
112 l_corp_book_info C_Corp_Book_Info%Rowtype;
113 l_corp_deprn_details C_Corp_Deprn_Details%Rowtype;
114 l_corp_deprn_summary C_Corp_Deprn_Summary%Rowtype;
115 l_imp_interface igi_imp_iac_interface%Rowtype;
116 l_hist_info igi_iac_types.fa_hist_asset_info;
117
118 --===========================FND_LOG.START=====================================
119 g_state_level NUMBER;
120 g_proc_level NUMBER;
121 g_event_level NUMBER;
122 g_excep_level NUMBER;
123 g_error_level NUMBER;
124 g_unexp_level NUMBER;
125 g_path VARCHAR2(100);
126 --===========================FND_LOG.END=======================================
127
128 Prepare_Data_Error Exception;
129
130
131 Procedure Set_Process_Status(p_book in varchar2, p_flag in varchar2) Is
132 l_path_name VARCHAR2(150);
133 Begin
134
135 l_path_name := g_path||'set_process_status';
136
137 Update igi_imp_iac_controls
138 Set Request_status = p_flag,
139 Request_id = fnd_global.conc_request_id,
140 Request_date = sysdate,
141 Last_updated_by = fnd_global.user_id,
142 last_update_date = sysdate,
143 last_update_login = fnd_global.login_id
144 Where book_type_code = p_book;
145 If Sql%found Then
146 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
147 p_full_path => l_path_name,
148 p_string => 'igi_imp_iac_controls updated, Request_status set to '
149 || p_flag || ' for Book ' || p_book);
150 End If;
151 Exception
152 When Others Then
153 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
154 p_full_path => l_path_name,
155 p_string => 'Error during update of Request Status to ' || p_flag);
156 Raise;
157 End;
158
159 Procedure Populate_Interface(p_interface_rec igi_imp_iac_interface%Rowtype) Is
160 l_path_name VARCHAR2(150);
161 Begin
162
163 l_path_name := g_path||'populate_interface';
164
165 Insert into igi_imp_iac_interface(
166 Asset_id,
167 Asset_number,
168 Book_type_code,
169 Category_id,
170 Hist_salvage_value,
171 Life_in_months,
172 Cost_hist,
173 Cost_mhca,
174 Deprn_exp_hist,
175 Deprn_exp_mhca,
176 Ytd_hist,
177 Ytd_mhca,
178 Accum_deprn_hist,
179 Accum_deprn_mhca,
180 Reval_reserve_hist,
181 Reval_reserve_mhca,
182 Backlog_hist,
183 Backlog_mhca,
184 General_fund_hist,
185 General_fund_mhca,
186 General_fund_per_hist,
187 General_fund_per_mhca,
188 Operating_account_hist,
189 Operating_account_mhca,
190 Operating_account_ytd_hist,
191 Operating_account_ytd_mhca,
192 Operating_account_cost,
193 Operating_account_backlog,
194 Nbv_hist,
195 Nbv_mhca,
196 Transferred_flag,
197 Selected_Flag,
198 Exception_Flag,
199 Exception_code,
200 Group_id,
201 Export_file,
202 Export_date,
203 Import_file,
204 Import_date,
205 Created_by,
206 Creation_date,
207 Last_updated_by,
208 Last_update_date,
209 Last_update_login,
210 Request_id,
211 Program_application_id,
212 Program_id,
213 Program_update_date,
214 Valid_flag) -- Added as a part of fix for Bug 5137813
215 Values(
216 p_interface_rec.Asset_id,
217 p_interface_rec.Asset_number,
218 p_interface_rec.Book_type_code,
219 p_interface_rec.Category_id,
220 p_interface_rec.Hist_salvage_value,
221 p_interface_rec.Life_in_months,
222 p_interface_rec.Cost_hist,
223 p_interface_rec.Cost_mhca,
224 p_interface_rec.Deprn_exp_hist,
225 p_interface_rec.Deprn_exp_mhca,
226 p_interface_rec.Ytd_hist,
227 p_interface_rec.Ytd_mhca,
228 p_interface_rec.Accum_deprn_hist,
229 p_interface_rec.Accum_deprn_mhca,
230 p_interface_rec.Reval_reserve_hist,
231 p_interface_rec.Reval_reserve_mhca,
232 p_interface_rec.Backlog_hist,
233 p_interface_rec.Backlog_mhca,
234 p_interface_rec.General_fund_hist,
235 p_interface_rec.General_fund_mhca,
236 p_interface_rec.General_fund_per_hist,
237 p_interface_rec.General_fund_per_mhca,
238 p_interface_rec.Operating_account_hist,
239 p_interface_rec.Operating_account_mhca,
240 p_interface_rec.Operating_account_ytd_hist,
241 p_interface_rec.Operating_account_ytd_mhca,
242 p_interface_rec.Operating_account_cost,
243 p_interface_rec.Operating_account_backlog,
244 p_interface_rec.Nbv_hist,
245 p_interface_rec.Nbv_mhca,
246 p_interface_rec.Transferred_flag,
247 p_interface_rec.Selected_Flag,
248 p_interface_rec.Exception_Flag,
249 p_interface_rec.Exception_code,
250 p_interface_rec.Group_id,
251 p_interface_rec.Export_file,
252 p_interface_rec.Export_date,
253 p_interface_rec.Import_file,
254 p_interface_rec.Import_date,
255 p_interface_rec.Created_by,
256 p_interface_rec.Creation_date,
257 p_interface_rec.Last_updated_by,
258 p_interface_rec.Last_update_date,
259 p_interface_rec.Last_update_login,
260 p_interface_rec.Request_id,
261 p_interface_rec.Program_application_id,
262 p_interface_rec.Program_id,
263 p_interface_rec.Program_update_date,
264 p_interface_rec.Valid_flag); -- Added as a part of fix for Bug 5137813
265 If Sql%found Then
266 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
267 p_full_path => l_path_name,
268 p_string => 'Created a record in igi_imp_iac_interface, Book Type Code : ' ||
269 p_interface_rec.Book_type_code ||
270 ' ,Asset Id : ' || p_interface_rec.Asset_id ||
271 ' ,Asset Number : ' || p_interface_rec.Asset_number ||
272 ' ,Category Id : ' || p_interface_rec.Category_id);
273 End If;
274 Exception
275 When Others Then
276 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
277 p_full_path => l_path_name,
278 p_string => 'Error during creation of record in igi_imp_iac_interface, '
279 ||'Book Type Code : ' ||p_interface_rec.Book_type_code
280 ||' ,Asset Id : ' || p_interface_rec.Asset_id
281 ||' ,Asset Number : ' || p_interface_rec.Asset_number
282 ||' ,Category Id : ' || p_interface_rec.Category_id);
283 Raise;
284 End;
285
286 Procedure Populate_Interface_control( p_book in varchar2, p_category_id in number) Is
287 l_path_name VARCHAR2(150);
288 Begin
289
290 l_path_name := g_path||'populate_interface_data';
291
292 Insert into igi_imp_iac_interface_ctrl(
293 book_type_code,
294 category_id,
295 created_by,
296 creation_date,
297 transfer_Status ,
298 last_updated_by,
299 last_update_date,
300 last_update_login)
301 Values(
302 p_book,
303 p_category_id,
304 fnd_global.user_id,
305 sysdate,
306 'N' ,
307 fnd_global.user_id,
308 sysdate,
309 fnd_global.login_id);
310 If Sql%found Then
311 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
312 p_full_path => l_path_name,
313 p_string => 'Created a record in igi_imp_iac_interface_ctrl for Book ' || p_book );
314 End if;
315 Exception
316 When Others Then
317 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
318 p_full_path => l_path_name,
319 p_string => ' Error during creation of record in igi_imp_iac_interface_ctrl for Book ' || p_book);
320 Raise;
321 End;
322
323 Procedure Initialise_Variables(p_corp_book_info in out NOCOPY C_Corp_Book_Info%Rowtype,
324 p_corp_deprn_details in out NOCOPY C_Corp_Deprn_Details%Rowtype,
325 p_corp_deprn_summary in out NOCOPY C_Corp_Deprn_Summary%Rowtype,
326 p_imp_interface in out NOCOPY igi_imp_iac_interface%Rowtype,
327 p_hist_info in out NOCOPY igi_iac_types.fa_hist_asset_info,
328 p_fiscal_year in out NOCOPY number,
329 p_book_last_per_counter in out NOCOPY number,
330 p_corp_last_per_counter in out NOCOPY number,
331 p_exception_code in out NOCOPY varchar2,
332 p_exception_flag in out NOCOPY varchar2) Is
333
334 l_initialise_corp_book C_Corp_Book_Info%Rowtype;
335 l_initialise_corp_details C_Corp_Deprn_Details%Rowtype;
336 l_initialise_corp_summary C_Corp_Deprn_Summary%Rowtype;
337 l_initialise_interface igi_imp_iac_interface%Rowtype;
338 l_initialise_hist_info igi_iac_types.fa_hist_asset_info;
339
340
341 p_corp_book_info_old C_Corp_Book_Info%Rowtype;
342 p_corp_deprn_details_old C_Corp_Deprn_Details%Rowtype;
343 p_corp_deprn_summary_old C_Corp_Deprn_Summary%Rowtype;
344 p_imp_interface_old igi_imp_iac_interface%Rowtype;
345 p_hist_info_old igi_iac_types.fa_hist_asset_info;
346 p_fiscal_year_old number;
347 p_book_last_per_counter_old number;
348 p_corp_last_per_counter_old number;
349 p_exception_code_old varchar2(1);
350 p_exception_flag_old varchar2(1);
351 l_path_name VARCHAR2(150);
352
353 Begin
354
355 l_path_name := g_path||'initialise_variables';
356
357 -- copying old values.
358 p_corp_book_info_old := p_corp_book_info;
359 p_corp_deprn_details_old := p_corp_deprn_details;
360 p_corp_deprn_summary_old := p_corp_deprn_summary;
361 p_imp_interface_old := p_imp_interface;
362 p_hist_info_old := p_hist_info;
363 p_fiscal_year_old := p_fiscal_year;
364 p_book_last_per_counter_old := p_book_last_per_counter;
365 p_corp_last_per_counter_old := p_corp_last_per_counter;
366 p_exception_code_old := p_exception_code;
367 p_exception_flag_old := p_exception_flag;
368
369 p_corp_book_info := l_initialise_corp_book;
370 p_corp_deprn_details := l_initialise_corp_details;
371 p_corp_deprn_summary := l_initialise_corp_summary;
372 p_imp_interface := l_initialise_interface;
373 p_hist_info := l_initialise_hist_info;
374 p_fiscal_year := NULL;
375 p_book_last_per_counter := NULL;
376 p_corp_last_per_counter := NULL;
377 p_exception_code := NULL;
378 p_exception_flag := 'N';
379
380 Exception
381 When Others Then
382
383 p_corp_book_info := p_corp_book_info_old;
384 p_corp_deprn_details := p_corp_deprn_details_old;
385 p_corp_deprn_summary := p_corp_deprn_summary_old;
386 p_imp_interface := p_imp_interface_old;
387 p_hist_info := p_hist_info_old;
388 p_fiscal_year := p_fiscal_year_old;
389 p_book_last_per_counter := p_book_last_per_counter_old;
390 p_corp_last_per_counter := p_corp_last_per_counter_old;
391 p_exception_code := p_exception_code_old;
392 p_exception_flag := p_exception_flag_old;
393
394 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
395 p_full_path => l_path_name,
396 p_string => 'Error during initialising of variables ');
397 Raise;
398 End;
399
400
401 Procedure Prepare_Data (errbuf out NOCOPY VARCHAR2,
402 retcode out NOCOPY NUMBER,
403 p_book_class in VARCHAR2 ,
404 p_book_type_code in VARCHAR2 ) Is
405
406 Cursor C_Period_Info IS
407 Select bk.last_period_counter book_last_per_counter,
408 dp1.fiscal_year book_per_fiscal_year,
409 ict.corp_book corp_book,
410 ict.period_counter -1 corp_last_per_counter,
411 dp2.fiscal_year corp_per_fiscal_year,
412 dp2.period_num corp_curr_period_num
413 From igi_imp_iac_controls ict,
414 fa_book_controls bk,
415 fa_deprn_periods dp1,
416 fa_deprn_periods dp2
417 Where ict.book_type_code = p_book_type_code
418 and bk.book_type_code = ict.book_type_code
419 and dp1.book_type_code = ict.book_type_code
420 and dp1.period_counter = bk.last_period_counter + 1
421 and dp2.book_type_code = ict.corp_book
422 and dp2.period_counter = ict.period_counter;
423
424 l_path_name VARCHAR2(150);
425 Begin
426
427 l_path_name := g_path||'prepare_data';
428
429 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
430 p_full_path => l_path_name,
431 p_string => '********************************************************'
432 ||' Start of IAC Implementation : Data Preparation Process'
433 ||'********************************************************');
434 Set_Process_Status(p_book_type_code,'R');
435 Commit;
436 For C_Period_Info_Rec In C_Period_Info Loop
437 IF p_book_class = 'TAX' Then
438 If Prepare_Mhca_Data(p_book_type_code,
439 C_Period_Info_Rec.book_last_per_counter,
440 C_Period_Info_Rec.book_per_fiscal_year,
441 C_Period_Info_Rec.corp_book,
442 C_Period_Info_Rec.corp_last_per_counter,
443 C_Period_Info_Rec.corp_per_fiscal_year,
444 C_Period_Info_Rec.corp_curr_period_num,
445 errbuf) Then
446 Set_Process_Status(p_book_type_code, 'C');
447 Else
448 Set_Process_Status(p_book_type_code,'E');
449 retcode := 2;
450 End if;
451 Elsif p_book_class = 'CORPORATE' Then
452 If Prepare_Corp_Data(p_book_type_code,
453 C_Period_Info_Rec.corp_last_per_counter,
454 C_Period_Info_Rec.corp_per_fiscal_year,
455 C_Period_Info_Rec.corp_curr_period_num,
456 errbuf) Then
457 Set_Process_Status(p_book_type_code, 'C');
458 Else
459 Set_Process_Status(p_book_type_code,'E');
460 retcode := 2;
461 End if;
462 End if;
463 Commit;
464 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
465 p_full_path => l_path_name,
466 p_string => '********************************************************'
467 ||' End of IAC Implementation : Data Preparation Process'
468 ||'********************************************************');
469 End Loop;
470 Exception
471 When Others Then
472 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
473 p_full_path => l_path_name,
474 p_string => '*** Error in IAC Implementation : Data Preparation Process *** '
475 || sqlerrm);
476 retcode := 2;
477 End Prepare_Data;
478
479 Function Prepare_Mhca_Data(p_book in varchar2,
480 p_book_last_per_counter in number,
481 p_book_curr_fiscal_year in number,
482 p_corp_book in varchar2,
483 p_corp_last_per_counter in number,
484 p_corp_curr_fiscal_year in number,
485 p_corp_curr_period_num in number,
486 p_out_message out NOCOPY varchar2 ) Return Boolean Is
487
488 Cursor C_Mhca_Reval_Details(p_asset_id in number,
489 p_period_counter in number) Is
490 Select sum(number_of_units_assigned) units,
491 nvl(sum(asset_cost),0) asset_cost,
492 nvl(sum(accumulated_depreciation),0) accumulated_depreciation,
493 nvl(sum(prior_yrs_accum_depreciation),0) prior_yrs_accum_depreciation,
494 nvl(sum(ytd_depreciation_reserve),0) ytd_depreciation_reserve,
495 nvl(sum(curr_mhc_prd_backlog_deprn),0) curr_mhc_prd_backlog_deprn,
496 nvl(sum(accumulated_backlog_deprn),0) accumulated_backlog_deprn,
497 nvl(sum(net_book_value),0) net_book_value,
498 nvl(sum(revaluation_reserve),0) revaluation_reserve,
499 nvl(sum(depreciation_expense),0) depreciation_expense,
500 nvl(sum(curr_yr_prior_prds_deprn),0) curr_yr_prior_prds_deprn,
501 nvl(sum(curr_yr_prior_prds_deprn_reval) ,0) curr_yr_prior_prds_deprn_reval,
502 nvl(sum(prior_year_operating_expense),0) prior_year_operating_expense,
503 nvl(sum(general_fund),0) general_fund,
504 nvl(sum(accumulated_general_fund),0) accumulated_general_fund
505 From igi_mhc_revaluation_detail
506 Where book_type_code = p_book
507 And period_counter = p_period_counter
508 And asset_id = p_asset_id
509 And reval_mode = 'INDEXED'
510 And active_flag= 'Y'
511 And Run_mode = 'L'
512 Group by asset_id;
513
514 Cursor C_Max_Period_Counter(p_asset_id in number) Is
515 Select max(period_counter) period_counter
516 From igi_mhc_revaluation_summary
517 Where book_type_code = p_book
518 and asset_id = p_asset_id
519 and reval_mode = 'INDEXED'
520 and active_flag= 'Y'
521 and run_mode = 'L';
522
523 Cursor C_Mhca_Reval_Summary(p_asset_id in number,
524 p_period_counter in number) Is
525 Select nvl(original_cost,0) original_cost,
526 nvl(new_asset_cost,0) new_asset_cost,
527 nvl(new_salvage_value,0) new_salvage_value,
528 original_life,
529 current_life,
530 nvl(old_accum_deprn,0) old_accum_deprn,
531 nvl(new_accum_deprn,0) new_accum_deprn,
532 nvl(old_reval_reserve,0) old_reval_reserve,
533 nvl(new_reval_reserve,0) new_reval_reserve,
534 nvl(new_curr_yr_expense,0) new_curr_yr_expense,
535 nvl(new_backlog_deprn,0) new_backlog_deprn
536 From igi_mhc_revaluation_summary
537 Where book_type_code = p_book
538 and period_counter = p_period_counter
539 and asset_id = p_asset_id
540 and reval_mode = 'INDEXED'
541 and active_flag= 'Y'
542 and Run_mode = 'L';
543
544
545 l_mhca_reval_details C_Mhca_Reval_Details%Rowtype;
546 l_mhca_reval_summary C_Mhca_Reval_Summary%Rowtype;
547
548 l_initialise_reval_details C_Mhca_Reval_Details%Rowtype;
549 l_initialise_reval_summary C_Mhca_Reval_Summary%Rowtype;
550 l_path_name VARCHAR2(150);
551 Begin
552
553 l_path_name := g_path||'prepare_mhca_data';
554
555 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
556 p_full_path => l_path_name,
557 p_string => '*** Start of Prepare Mhca Data ***'
558 ||'*** Parameter Last Period Counter for Mhca Book is : '
559 || p_book_last_per_counter
560 ||'*** Parameter Last Period Counter for Corp Book is : '
561 || p_corp_last_per_counter);
562
563 For C_Asset_Category_Rec In C_Asset_Category(p_book) Loop
564 l_cat_records := 0;
565 l_rec_ctr := 1;
566 For C_Book_Info_Rec in C_Book_Info(p_book, C_Asset_Category_Rec.category_id) Loop
567 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
568 p_full_path => l_path_name,
569 p_string => 'Processing Asset for Book : ' || p_book ||
570 ' ,Category Id : ' || C_Asset_Category_Rec.category_id ||
571 ' ,Asset Number : ' || C_Book_Info_Rec.Asset_number ||
572 ' ,Asset Id : ' || C_Book_Info_Rec.Asset_id);
573
574 Initialise_Variables(l_corp_book_info,
575 l_corp_deprn_details,
576 l_corp_deprn_summary,
577 l_imp_interface,
578 l_hist_info,
579 l_fiscal_year,
580 l_book_last_per_counter,
581 l_corp_last_per_counter,
582 l_exception_code,
583 l_exception_flag);
584 l_mhca_reval_details := l_initialise_reval_details;
585 l_mhca_reval_summary := l_initialise_reval_summary;
586
587
588 If l_rec_ctr > l_max_records then
589 l_rec_ctr := 1;
590 End if;
591 If l_rec_ctr = 1 then
592 Select igi_imp_iac_interface_group_s.nextval
593 Into l_group_id
594 From dual;
595 End if;
596
597 IF C_Book_Info_Rec.asset_type = 'CIP' THEN
598 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
599 p_full_path => l_path_name,
600 p_string => 'Asset is a CIP asset, Ignoring the asset');
601 goto Next_Record;
602 END IF;
603
604 IF C_Book_Info_Rec.cost < 0 THEN
605 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
606 p_full_path => l_path_name,
607 p_string => 'Asset is a negative asset, Ignoring the asset');
608 goto Next_Record;
609 END IF;
610
611 If C_Book_Info_Rec.period_counter_fully_retired is not null then
612
613 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
614 p_full_path => l_path_name,
615 p_string => 'Asset is fully retired in MHCA book, Ignoring the asset');
616
617 goto Next_Record;
618 Else
619 l_book_last_per_counter := p_book_last_per_counter;
620 End If;
621
622 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
623 p_full_path => l_path_name,
624 p_string => '*** New Last Period Counter for Mhca Book is : '
625 || l_book_last_per_counter );
626
627 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
628 p_full_path => l_path_name,
629 p_string => '*** Opening Cursor C_Mhca_Reval_Details for the asset ' ||
630 C_Book_Info_Rec.asset_id || ' ,Period Counter : '
631 || l_book_last_per_counter);
632
633 Open C_Mhca_Reval_Details(C_Book_Info_Rec.asset_id,
634 l_book_last_per_counter);
635 Fetch C_Mhca_Reval_Details into l_MHca_reval_details;
636 If C_Mhca_Reval_Details%notfound Then
637 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
638 p_full_path => l_path_name,
639 p_string => '??? C_Mhca_Reval_Details not found');
640 End if;
641 Close C_Mhca_Reval_Details;
642
643 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
644 p_full_path => l_path_name,
645 p_string => '*** Opening Cursor C_Mhca_Reval_Details for the asset ' ||
646 C_Book_Info_Rec.asset_id || ' ,Period Counter : '
647 || l_book_last_per_counter);
648
649 Open C_Mhca_Reval_Summary(C_Book_Info_Rec.asset_id,
650 l_book_last_per_counter);
651 Fetch C_Mhca_Reval_Summary Into l_mhca_reval_summary;
652 If C_Mhca_Reval_Summary%notfound Then
653 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
654 p_full_path => l_path_name,
655 p_string => '??? C_Mhca_Reval_Summary not found');
656 End if;
657 Close C_Mhca_Reval_Summary;
658
659 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
660 p_full_path => l_path_name,
661 p_string => '*** Opening Cursor C_Corp_Book_Info for the asset ' ||
662 C_Book_Info_Rec.asset_id || ' ,Book : ' || p_corp_book);
663
664 Open C_Corp_Book_Info(p_corp_book, C_Book_Info_Rec.asset_id);
665 Fetch C_Corp_Book_Info Into l_corp_book_info;
666 If C_Corp_Book_Info%notfound then
667 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
668 p_full_path => l_path_name,
669 p_string => '??? C_Corp_book_Info not found');
670 End if;
671 Close C_Corp_Book_Info;
672
673 IF l_Corp_Book_Info.cost < 0 THEN
674 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
675 p_full_path => l_path_name,
676 p_string => 'Asset is a negative asset, Ignoring the asset');
677 goto Next_Record;
678 END IF;
679
680 If l_Corp_Book_Info.period_counter_fully_retired is not null then
681 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
682 p_full_path => l_path_name,
683 p_string => 'Asset is fully retired in Corp book, Ignoring the asset');
684
685 goto Next_Record;
686
687 Else
688 If l_Corp_Book_Info.period_counter_fully_reserved is not null then
689 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
690 p_full_path => l_path_name,
691 p_string => 'Asset in the Corp Book is fully reserved');
692
693 l_corp_last_per_counter := l_Corp_Book_Info.period_counter_fully_reserved;
694 Else
695 If upper(l_Corp_Book_Info.depreciate_flag) = 'NO' Then
696 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
697 p_full_path => l_path_name,
698 p_string => 'Asset has depreciate flag set to No');
699
700 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
701 p_full_path => l_path_name,
702 p_string => '*** Opening Cursor C_Corp_Max_Deprn_Ctr for Book : ' ||
703 p_corp_book || ' ,Asset Id : ' || C_Book_Info_Rec.asset_id);
704
705 Open C_Corp_Max_Period_Counter(p_corp_book,
706 C_Book_Info_Rec.asset_id);
707 Fetch C_Corp_Max_Period_Counter into l_Corp_last_per_counter;
708 If C_Corp_Max_Period_Counter%notfound then
709 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
710 p_full_path => l_path_name,
711 p_string => '??? C_Corp_Max_Period_Counter not found');
712 End if;
713 Close C_Corp_Max_Period_Counter;
714 Else
715 l_corp_last_per_counter := p_corp_last_per_counter;
716 End if;
717 End if;
718 End if;
719
720 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
721 p_full_path => l_path_name,
722 p_string => '*** New Last Period Counter for Corp Book is : '
723 || l_corp_last_per_counter);
724
725 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
726 p_full_path => l_path_name,
727 p_string => '*** Opening Cursor C_Corp_Deprn_Details for Book : '
728 || p_corp_book || ' ,Asset Id : ' || C_Book_Info_Rec.asset_id
729 || ' ,Period Counter : ' || l_corp_last_per_counter);
730
731 Open C_Corp_Deprn_Details(p_corp_book,
732 C_book_info_rec.asset_id,
733 l_corp_last_per_counter);
734 Fetch C_Corp_Deprn_Details Into l_corp_deprn_details;
735 If C_Corp_Deprn_Details%notfound then
736 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
737 p_full_path => l_path_name,
738 p_string => '??? C_Corp_Deprn_Details not found');
739 End if;
740 Close C_Corp_Deprn_Details;
741
742 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
743 p_full_path => l_path_name,
744 p_string => '*** Opening Cursor C_Corp_Deprn_Summary for Book : '
745 || p_corp_book|| ' ,Asset Id : ' || C_Book_Info_Rec.asset_id
746 || ' ,Period Counter : ' || l_corp_last_per_counter);
747
748 Open C_Corp_Deprn_Summary(p_corp_book,
749 C_book_info_rec.asset_id,
750 l_corp_last_per_counter);
751 Fetch C_Corp_Deprn_Summary Into l_corp_deprn_summary;
752 If C_Corp_Deprn_Summary%notfound then
753 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
754 p_full_path => l_path_name,
755 p_string => 'C_Corp_Deprn_Summary not found');
756 End if;
757 Close C_Corp_Deprn_Summary;
758
759
760 If (abs((nvl(l_mhca_reval_summary.new_asset_cost,0) - nvl(l_mhca_reval_summary.new_reval_reserve,0))
761 - l_corp_book_info.cost ) <= 0.05 ) Then
762 null;
763 Else
764 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
765 p_full_path => l_path_name,
766 p_string => 'Cost Difference Exception flagged for the Asset');
767
768 l_exception_code := 'C';
769 l_exception_flag := 'Y';
770 End if;
771
772 If l_exception_flag = 'N' Then
773 If trunc(C_Book_Info_Rec.date_placed_in_service) = trunc(l_corp_book_info.date_placed_in_service) Then
774 null;
775 Else
776 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
777 p_full_path => l_path_name,
778 p_string => 'DPIS Difference Exception flagged for the Asset');
779
780 l_exception_code := 'D';
781 l_exception_flag := 'Y';
782 End if;
783 End if;
784
785 If l_exception_flag = 'N' Then
786 If C_Book_Info_Rec.life_in_months = l_corp_book_info.life_in_months Then
787 null;
788 Else
789 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
790 p_full_path => l_path_name,
791 p_string => 'Life Difference Exception flagged for the Asset');
792
793 l_exception_code := 'L';
794 l_exception_flag := 'Y';
795 End if;
796 End if;
797
798 If l_exception_flag = 'N' Then
799 If C_Book_Info_Rec.salvage_value = l_corp_book_info.salvage_value Then
800 null;
801 Else
802 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
803 p_full_path => l_path_name,
804 p_string => 'Salvage Value Difference Exception flagged for the Asset');
805
806 l_exception_code := 'S';
807 l_exception_flag := 'Y';
808 End if;
809 End if;
810
811 l_imp_interface.asset_id := C_Book_Info_Rec.asset_id;
812 l_imp_interface.asset_number := C_Book_Info_Rec.asset_number;
813 l_imp_interface.book_type_code := p_book;
814 l_imp_interface.category_id := C_Asset_Category_Rec.category_id;
815 l_imp_interface.hist_salvage_value := l_corp_book_info.salvage_value;
816 l_imp_interface.life_in_months := C_Book_Info_Rec.life_in_months;
817 l_imp_interface.cost_hist := l_corp_book_info.cost;
818 l_imp_interface.cost_mhca := l_mhca_reval_summary.New_asset_cost;
819
820 IF l_Corp_Book_Info.period_counter_fully_reserved is null then
821 l_imp_interface.deprn_exp_hist := l_corp_deprn_details.deprn_amount - l_corp_deprn_details.deprn_adjustment_amount;
822 l_imp_interface.deprn_exp_mhca := l_mhca_reval_details.depreciation_expense;
823 ELSE
824 l_imp_interface.deprn_exp_hist := 0;
825 l_imp_interface.deprn_exp_mhca := 0;
826 END IF;
827
828 l_hist_info.cost := l_corp_book_info.cost;
829 l_hist_info.adjusted_cost := l_corp_book_info.adjusted_cost;
830 l_hist_info.original_cost := l_corp_book_info.original_cost;
831 l_hist_info.salvage_value := l_corp_book_info.salvage_value;
832 l_hist_info.life_in_months := l_corp_book_info.life_in_months;
833 l_hist_info.rate_adjustment_factor := l_corp_book_info.rate_adjustment_factor;
834 l_hist_info.period_counter_fully_reserved := l_corp_book_info.period_counter_fully_reserved;
835 l_hist_info.adjusted_recoverable_cost := l_corp_book_info.adjusted_recoverable_cost;
836 l_hist_info.recoverable_cost := l_corp_book_info.recoverable_cost;
837 l_hist_info.date_placed_in_service := l_corp_book_info.date_placed_in_service;
838 l_hist_info.last_period_counter := l_corp_last_per_counter;
839 l_hist_info.gl_posting_allowed_flag := NULL;
840 l_hist_info.ytd_deprn := l_Corp_Deprn_Summary.ytd_deprn;
841 l_hist_info.deprn_reserve := l_corp_deprn_summary.deprn_reserve;
842 l_hist_info.deprn_amount := l_corp_deprn_summary.deprn_amount;
843 l_hist_info.deprn_start_date := l_corp_book_info.deprn_start_date;
844 l_fiscal_year := NULL;
845 Open C_Fiscal_Year(p_corp_book, l_corp_last_per_Counter);
846 Fetch C_Fiscal_Year Into l_fiscal_year;
847 Close C_Fiscal_Year;
848
849 If p_corp_curr_fiscal_year <> l_fiscal_year then
850 l_imp_interface.ytd_hist := 0;
851 Else
852 If p_corp_curr_period_num = 1 Then
853 l_imp_interface.ytd_hist := 0;
854 Else
855 If igi_iac_reval_utilities.Populate_depreciation(
856 C_book_info_rec.asset_id,
857 p_corp_book,
858 l_corp_last_per_counter,
859 l_hist_info ) Then
860 L_imp_interface.ytd_hist :=
861 ( l_Corp_Deprn_Summary.deprn_reserve
862 * (l_hist_info.deprn_periods_current_year/l_hist_info.deprn_periods_elapsed));
863 Else
864 fnd_message.set_name ('IGI', 'IGI_IMP_IAC_PREP_ERROR');
865 fnd_message.set_token('ROUTINE','igi_iac_reval_utilities.Populate_depreciation');
866 igi_iac_debug_pkg.debug_other_msg(p_level => g_error_level,
867 p_full_path => l_path_name,
868 p_remove_from_stack => FALSE);
869 p_out_message := fnd_message.get;
870 Raise Prepare_Data_Error;
871 End if;
872 End if;
873 End if;
874
875 l_imp_interface.ytd_mhca := l_mhca_reval_details.ytd_depreciation_reserve;
876 l_imp_interface.accum_deprn_hist := l_corp_deprn_summary.deprn_reserve;
877 l_imp_interface.accum_deprn_mhca := l_mhca_reval_summary.new_accum_deprn - l_mhca_reval_summary.new_backlog_deprn;
878 l_imp_interface.reval_reserve_hist := l_corp_deprn_summary.reval_reserve;
879 l_imp_interface.reval_reserve_mhca := l_mhca_reval_summary.new_reval_reserve - l_mhca_reval_summary.New_backlog_deprn;
880 l_imp_interface.backlog_hist := 0 ;
881 l_imp_interface.backlog_mhca := l_mhca_reval_summary.new_backlog_deprn;
882 l_imp_interface.general_fund_hist := 0;
883 l_imp_interface.general_fund_mhca := 0;
884 l_imp_interface.general_fund_per_hist := 0;
885 l_imp_interface.general_fund_per_mhca := 0;
886 l_imp_interface.operating_account_hist := 0;
887 l_imp_interface.operating_account_mhca :=0;
888 l_imp_interface.operating_account_ytd_hist := 0;
889 l_imp_interface.operating_account_ytd_mhca :=0;
890 l_imp_interface.operating_account_cost := 0;
891 l_imp_interface.operating_account_backlog := 0;
892 l_imp_interface.nbv_hist := l_corp_book_info.cost - l_corp_deprn_summary.deprn_reserve;
893 l_imp_interface.nbv_mhca := l_mhca_reval_details.net_book_value ;
894 l_imp_interface.transferred_Flag := 'N';
895 l_imp_interface.valid_flag := 'Y'; -- Added as a part of fix for Bug 5137813
896 l_imp_interface.selected_Flag := 'N';
897 l_imp_interface.exception_Flag := l_exception_flag;
898 l_imp_interface.exception_Code := l_exception_code;
899 l_imp_interface.group_id := l_group_id;
900 l_imp_interface.export_file := NULL;
901 l_imp_interface.export_date := NULL;
902 l_imp_interface.import_file := NULL;
903 l_imp_interface.import_date := NULL;
904 l_imp_interface.created_by := fnd_global.user_id;
905 l_imp_interface.creation_date := sysdate;
906 l_imp_interface.last_updated_by := fnd_global.user_id;
907 l_imp_interface.last_update_date := sysdate;
908 l_imp_interface.last_update_login := fnd_global.login_id;
909 l_imp_interface.request_id := fnd_global.conc_request_id;
910 l_imp_interface.program_application_id := fnd_global.prog_appl_id;
911 l_imp_interface.program_id := fnd_global.conc_program_id;
912 l_imp_interface.program_update_date := sysdate;
913
914 Populate_Interface(l_imp_interface);
915 l_cat_records := l_cat_records + 1;
916 l_rec_ctr := l_rec_ctr + 1;
917 <<Next_Record>>
918 Null;
919 End Loop;
920 If l_cat_records > 0 then
921 Populate_Interface_control( p_book, C_Asset_Category_Rec.category_id);
922 End if;
923 End Loop;
924 Return TRUE;
925 Exception
926 When Prepare_Data_Error Then
927 If C_Fiscal_Year%isopen then
928 Close C_Fiscal_Year;
929 End if;
930 If C_Max_Period_Counter%isopen Then
931 Close C_Max_Period_Counter;
932 End if;
933 If C_Mhca_Reval_Details%isopen Then
934 Close C_Mhca_Reval_Details;
935 End if;
936 If C_Mhca_Reval_Summary%isopen Then
937 Close C_Mhca_Reval_Summary;
938 End if;
939 If C_Corp_Book_Info%isopen Then
940 Close C_Corp_Book_Info;
941 End if;
942 If C_Corp_Deprn_Details%isopen Then
943 Close C_Corp_Deprn_Details;
944 End if;
945 If C_Corp_Deprn_Summary%isopen Then
946 Close C_Corp_Deprn_Summary;
947 End if;
948 If C_Corp_Max_Period_Counter%isopen Then
949 Close C_Corp_Max_Period_Counter;
950 End if;
951 Rollback work;
952 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
953 p_full_path => l_path_name,
954 p_string => 'Error : ' || p_out_message);
955 fnd_file.put_line(fnd_file.log, p_out_message);
956 Return False;
957 When Others Then
958 If C_Fiscal_Year%isopen Then
959 Close C_Fiscal_Year;
960 End if;
961 If C_Max_Period_Counter%isopen Then
962 Close C_Max_Period_Counter;
963 End if;
964 If C_Mhca_Reval_Details%isopen Then
965 Close C_Mhca_Reval_Details;
966 End if;
967 If C_Mhca_Reval_Summary%isopen Then
968 Close C_Mhca_Reval_Summary;
969 End if;
970 If C_Corp_Book_Info%isopen Then
971 Close C_Corp_Book_Info;
972 End if;
973 If C_Corp_Deprn_Details%isopen Then
974 Close C_Corp_Deprn_Details;
975 End if;
976 If C_Corp_Deprn_Summary%isopen Then
977 Close C_Corp_Deprn_Summary;
978 End if;
979 If C_Corp_Max_Period_Counter%isopen Then
980 Close C_Corp_Max_Period_Counter;
981 End if;
982 Rollback work;
983 igi_iac_debug_pkg.debug_unexpected_msg(p_full_path => l_path_name);
984 Return FALSE;
985 End Prepare_Mhca_Data;
986
987 FUNCTION Prepare_Corp_Data (
988 p_corp_book in varchar2,
989 p_corp_last_per_counter in number,
990 p_corp_curr_fiscal_year in number,
991 p_corp_curr_period_num in number,
992 p_out_message out NOCOPY varchar2 ) Return Boolean Is
993
994 /* Bug 2961656 vgadde 08-jul-03 start(1) */
995 CURSOR C_Get_User_Deprn(p_asset_id in number ) IS
996 SELECT period_counter, deprn_reserve, ytd_deprn
997 FROM fa_deprn_summary
998 WHERE book_type_code = p_corp_book
999 AND asset_id = p_asset_id
1000 AND deprn_source_code = 'BOOKS';
1001 /* Bug 2961656 vgadde 08-jul-03 end(1) */
1002
1003 Cursor C_Prior_Add(p_book in varchar2,
1004 p_category_id in number,
1005 p_asset_id in number) Is
1006 Select
1007 Asset_id,
1008 Asset_number,
1009 Book_type_code,
1010 Category_id,
1011 Period_counter,
1012 Net_book_value,
1013 Adjusted_cost,
1014 Operating_acct,
1015 Reval_reserve,
1016 Deprn_amount,
1017 Deprn_reserve,
1018 Backlog_deprn_reserve,
1019 General_fund,
1020 Hist_cost,
1021 Hist_deprn_expense,
1022 Hist_ytd,
1023 Hist_accum_deprn,
1024 Hist_life_in_months,
1025 Hist_nbv,
1026 Hist_salvage_value,
1027 General_fund_Periodic,
1028 Operating_account_ytd,
1029 cummulative_reval_factor,
1030 current_reval_factor
1031 From igi_imp_iac_interface_py_add
1032 Where book_type_code = p_book
1033 and category_id = p_category_id
1034 and asset_id = p_asset_id;
1035
1036 l_deprn_acc number;
1037 /* Bug 2961656 vgadde 08-jul-03 start(2) */
1038 l_deprn_ytd number;
1039 l_booksrow_counter number;
1040 l_booksrow_period igi_iac_types.prd_rec;
1041 /* Bug 2961656 vgadde 08-jul-03 end(2) */
1042 l_prior_addition c_prior_add%Rowtype;
1043 l_initialise_addition c_prior_add%Rowtype;
1044 l_dpis_period_counter number;
1045 l_current_year_addition boolean;
1046 l_path_name VARCHAR2(150);
1047 l_fa_ytd_derpn number;
1048 l_last_deprn_period igi_iac_types.prd_rec;
1049
1050 Begin
1051
1052 l_current_year_addition := TRUE;
1053 l_path_name := g_path||'prepare_corp_data';
1054
1055 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1056 p_full_path => l_path_name,
1057 p_string => '*** Start of Prepare Corp Data ***' );
1058
1059 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1060 p_full_path => l_path_name,
1061 p_string => '*** Parameter Last Period Counter for Corp Book is : '
1062 || p_corp_last_per_counter);
1063
1064 For C_Asset_Category_Rec In C_Asset_Category(p_corp_book) Loop
1065 l_cat_records := 0;
1066 l_rec_ctr := 1;
1067 For C_Book_Info_Rec in C_Book_Info(p_corp_book, C_Asset_Category_Rec.category_id) Loop
1068 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1069 p_full_path => l_path_name,
1070 p_string => 'Processing Asset for Book : ' || p_corp_book ||
1071 ' ,Category Id : ' || C_Asset_Category_Rec.category_id ||
1072 ' ,Asset Number : ' || C_Book_Info_Rec.Asset_number ||
1073 ' ,Asset Id : ' || C_Book_Info_Rec.Asset_id);
1074
1075 Initialise_Variables(l_corp_book_info,
1076 l_corp_deprn_details,
1077 l_corp_deprn_summary,
1078 l_imp_interface,
1079 l_hist_info,
1080 l_fiscal_year,
1081 l_book_last_per_counter,
1082 l_corp_last_per_counter,
1083 l_exception_code,
1084 l_exception_flag);
1085 l_deprn_acc := NULL;
1086 l_prior_addition := l_initialise_addition;
1087
1088 If l_rec_ctr > l_max_records then
1089 l_rec_ctr := 1;
1090 End if;
1091 If l_rec_ctr = 1 then
1092 Select igi_imp_iac_interface_group_s.nextval
1093 Into l_group_id
1094 From dual;
1095 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1096 p_full_path => l_path_name,
1097 p_string => 'The new group Id is : ' || l_group_id);
1098 End if;
1099
1100 l_current_year_addition := True;
1101
1102 IF C_Book_Info_Rec.asset_type = 'CIP' THEN
1103 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1104 p_full_path => l_path_name,
1105 p_string => 'Asset is a CIP asset, Ignoring the asset');
1106 goto Next_Record;
1107 END IF;
1108
1109 IF C_Book_Info_Rec.cost < 0 THEN
1110 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1111 p_full_path => l_path_name,
1112 p_string => 'Asset is a negative asset, Ignoring the asset');
1113 goto Next_Record;
1114 END IF;
1115
1116 If C_Book_Info_Rec.period_counter_fully_retired is not null then
1117 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1118 p_full_path => l_path_name,
1119 p_string => 'Asset is fully retired, Ignoring the asset');
1120 goto Next_Record;
1121 Else
1122 If C_Book_Info_Rec.period_counter_fully_reserved is not null then
1123
1124 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1125 p_full_path => l_path_name,
1126 p_string => 'Asset in the Corp_book is fully reserved');
1127
1128 l_corp_last_per_counter := C_Book_Info_Rec.period_counter_fully_reserved;
1129
1130 Else
1131
1132 If upper(C_Book_Info_Rec.depreciate_flag) = 'NO' Then
1133
1134 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1135 p_full_path => l_path_name,
1136 p_string => 'Asset has depreciate flag set to No');
1137
1138 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1139 p_full_path => l_path_name,
1140 p_string => '*** Opening Cursor C_Corp_Max_Deprn_Ctr for Book : '
1141 || p_corp_book|| ' ,Asset Id : ' || C_Book_Info_Rec.asset_id);
1142
1143 Open C_Corp_Max_Period_Counter(p_corp_book,
1144 C_Book_Info_Rec.asset_id);
1145 Fetch C_Corp_Max_Period_Counter into l_Corp_last_per_counter;
1146 If C_Corp_Max_Period_Counter%notfound then
1147 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1148 p_full_path => l_path_name,
1149 p_string => '??? C_Corp_Max_Period_Counter not found');
1150 End if;
1151 Close C_Corp_Max_Period_Counter;
1152
1153 IF l_Corp_last_per_counter IS NULL THEN
1154
1155 Select max(Period_counter)
1156 Into l_Corp_last_per_counter
1157 From fa_deprn_summary
1158 Where book_type_code = p_corp_book
1159 and asset_id = C_Book_Info_Rec.asset_id;
1160
1161 END IF;
1162
1163 IF NOT igi_iac_common_utils.get_period_info_for_counter(
1164 p_corp_book,
1165 l_Corp_last_per_counter,
1166 l_last_deprn_period) THEN
1167 fnd_message.set_name ('IGI', 'IGI_IMP_IAC_PREP_ERROR');
1168 fnd_message.set_token('ROUTINE','igi_iac_common_utils.get_period_info_for_counter');
1169 igi_iac_debug_pkg.debug_other_msg(p_level => g_error_level,
1170 p_full_path => l_path_name,
1171 p_remove_from_stack => FALSE);
1172 p_out_message := fnd_message.get;
1173 Raise Prepare_Data_Error;
1174 END IF;
1175 Else
1176 l_corp_last_per_counter := p_corp_last_per_counter;
1177 End if;
1178 End if;
1179 End if;
1180 /* Bug 2961656 vgadde 08-jul-03 start(3) */
1181 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1182 p_full_path => l_path_name,
1183 p_string => '*** Opening Cursor C_Corp_Deprn_Summary for Book : ' || p_corp_book
1184 || ' ,Asset Id : ' || C_Book_Info_Rec.asset_id
1185 || ' ,Period Counter : ' || l_corp_last_per_counter);
1186
1187 Open C_Corp_Deprn_Summary(p_corp_book,
1188 C_book_info_rec.asset_id,
1189 l_corp_last_per_counter);
1190 Fetch C_Corp_Deprn_Summary Into l_corp_deprn_summary;
1191 If C_Corp_Deprn_Summary%notfound then
1192 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1193 p_full_path => l_path_name,
1194 p_string => 'C_Corp_Deprn_Summary not found');
1195 l_corp_deprn_summary.deprn_reserve := 0;
1196 l_corp_deprn_summary.ytd_deprn := 0;
1197 End if;
1198 Close C_Corp_Deprn_Summary;
1199
1200 IF (upper(C_Book_Info_Rec.depreciate_flag) = 'NO') THEN
1201
1202 IF ((l_last_deprn_period.fiscal_year < p_corp_curr_fiscal_year)
1203 ) THEN
1204
1205 l_corp_deprn_summary.ytd_deprn := 0;
1206 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1207 p_full_path => l_path_name,
1208 p_string => 'Non Dpreciating C_Corp_Deprn_Summary found'|| l_corp_deprn_summary.ytd_deprn);
1209
1210 END IF;
1211 END IF;
1212
1213 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1214 p_full_path => l_path_name,
1215 p_string => '*** Opening Cursor C_Get_User_Deprn for Asset Id : '
1216 || C_Book_Info_Rec.asset_id);
1217
1218 Open C_Get_User_Deprn(C_book_info_rec.asset_id);
1219 Fetch C_Get_User_Deprn Into l_booksrow_counter, l_deprn_acc, l_deprn_ytd;
1220 If C_Get_User_Deprn%notfound Then
1221 l_booksrow_counter := NULL;
1222 l_deprn_acc := NULL;
1223 l_deprn_ytd := NULL;
1224 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1225 p_full_path => l_path_name,
1226 p_string => '??? C_Get_User_Deprn not found');
1227 End if;
1228 Close C_Get_User_Deprn;
1229
1230 IF l_booksrow_counter IS NOT NULL THEN
1231 l_booksrow_counter := l_booksrow_counter + 1;
1232 IF NOT igi_iac_common_utils.get_period_info_for_counter(
1233 p_corp_book,
1234 l_booksrow_counter,
1235 l_booksrow_period) THEN
1236 fnd_message.set_name ('IGI', 'IGI_IMP_IAC_PREP_ERROR');
1237 fnd_message.set_token('ROUTINE','igi_iac_common_utils.get_period_info_for_counter');
1238 igi_iac_debug_pkg.debug_other_msg(p_level => g_error_level,
1239 p_full_path => l_path_name,
1240 p_remove_from_stack => FALSE);
1241 p_out_message := fnd_message.get;
1242 Raise Prepare_Data_Error;
1243 END IF;
1244
1245 IF (l_booksrow_period.fiscal_year <> p_corp_curr_fiscal_year) OR
1246 (nvl(l_deprn_acc,0) = 0) THEN
1247 l_fa_ytd_derpn := l_corp_deprn_summary.ytd_deprn;
1248 l_corp_deprn_summary.ytd_deprn := NULL;
1249 l_current_year_addition := FALSE;
1250 END IF;
1251 END IF;
1252
1253 If Not IGI_IAC_ADDITIONS_PKG.Do_Addition(
1254 p_corp_book,
1255 C_Book_Info_Rec.asset_id,
1256 C_Asset_Category_Rec.category_id,
1257 null, null,null,null,null,null,
1258 l_corp_deprn_summary.deprn_reserve,
1259 l_corp_deprn_summary.ytd_deprn,
1260 'UPGRADE',NULL)Then
1261 fnd_message.set_name ('IGI', 'IGI_IMP_IAC_PREP_ERROR');
1262 fnd_message.set_token('ROUTINE','igi_iac_additions_pkg.do_prior_addition');
1263 igi_iac_debug_pkg.debug_other_msg(p_level => g_error_level,
1264 p_full_path => l_path_name,
1265 p_remove_from_stack => FALSE);
1266 p_out_message := fnd_message.get;
1267 Raise Prepare_Data_Error;
1268 Else
1269 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1270 p_full_path => l_path_name,
1271 p_string => 'Prior Addition is successful');
1272
1273 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1274 p_full_path => l_path_name,
1275 p_string => '*** Opening Cursor C_Prior_add for Book : ' || p_corp_book
1276 || ' ,Asset Id : ' || C_Book_Info_Rec.asset_id
1277 || ' ,Category Id ' || C_Asset_Category_Rec.category_id);
1278
1279 Open C_Prior_Add(p_corp_book,
1280 C_Asset_Category_Rec.category_id,
1281 C_Book_Info_Rec.asset_id);
1282 Fetch C_Prior_Add Into l_prior_addition;
1283
1284 If C_Prior_Add%notfound Then
1285 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1286 p_full_path => l_path_name,
1287 p_string => '??? C_Prior_Add not found, Skipping the Asset');
1288 Close C_Prior_Add;
1289 Goto Next_Record;
1290 End if;
1291 Close C_Prior_Add;
1292 End if;
1293 /* Bug 2961656 vgadde 08-jul-03 end(3) */
1294
1295 IF l_corp_deprn_summary.ytd_deprn is null Then
1296 l_corp_deprn_summary.ytd_deprn:= l_fa_ytd_derpn;
1297
1298 End if;
1299
1300
1301 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1302 p_full_path => l_path_name,
1303 p_string => '*** New Last Period Counter for Corp Book is : '
1304 || l_corp_last_per_counter);
1305 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1306 p_full_path => l_path_name,
1307 p_string => '*** Opening Cursor C_Corp_Deprn_Details for Book : '
1308 || p_corp_book|| ' ,Asset Id : ' || C_Book_Info_Rec.asset_id
1309 || ' ,Period Counter : ' || l_corp_last_per_counter);
1310 Open C_Corp_Deprn_Details(p_corp_book,
1311 C_book_info_rec.asset_id,
1312 l_corp_last_per_counter);
1313 Fetch C_Corp_Deprn_Details Into l_corp_deprn_details;
1314 If C_Corp_Deprn_Details%notfound then
1315 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1316 p_full_path => l_path_name,
1317 p_string => '??? C_Corp_Deprn_Details not found');
1318 End if;
1319 Close C_Corp_Deprn_Details;
1320
1321 l_imp_interface.Asset_id := l_prior_addition.Asset_id;
1322 l_imp_interface.Asset_number := l_prior_addition.Asset_number;
1323 l_imp_interface.Book_type_code := p_corp_book;
1324 l_imp_interface.Category_Id := l_prior_addition.Category_id;
1325 l_imp_interface.Hist_salvage_value := l_prior_addition.Hist_salvage_value;
1326 l_imp_interface.Life_in_months := l_prior_addition.Hist_life_in_months;
1327 l_imp_interface.Cost_hist := l_prior_addition.Hist_cost;
1328 l_imp_interface.Cost_mhca := l_prior_addition.Hist_cost + l_prior_addition.Adjusted_cost;
1329 IF C_book_info_rec.period_counter_fully_reserved IS NULL THEN
1330 l_imp_interface.Deprn_exp_hist := l_prior_addition.Hist_deprn_expense;
1331 l_imp_interface.Deprn_exp_mhca := l_prior_addition.Hist_deprn_expense + l_prior_addition.Deprn_amount;
1332 ELSE
1333 l_imp_interface.deprn_exp_hist := 0;
1334 l_imp_interface.deprn_exp_mhca := 0;
1335 END IF;
1336
1337
1338
1339 l_hist_info.cost := C_book_info_rec.cost;
1340 l_hist_info.adjusted_cost := C_book_info_rec.adjusted_cost;
1341 l_hist_info.original_cost := C_book_info_rec.original_cost;
1342 l_hist_info.salvage_value := C_book_info_rec.salvage_value;
1343 l_hist_info.life_in_months := C_book_info_rec.life_in_months;
1344 l_hist_info.rate_adjustment_factor := C_book_info_rec.rate_adjustment_factor;
1345 l_hist_info.period_counter_fully_reserved := C_book_info_rec.period_counter_fully_reserved;
1346 l_hist_info.adjusted_recoverable_cost := C_book_info_rec.adjusted_recoverable_cost;
1347 l_hist_info.recoverable_cost := C_book_info_rec.recoverable_cost;
1348 l_hist_info.date_placed_in_service := C_book_info_rec.date_placed_in_service;
1349 l_hist_info.last_period_counter := l_corp_last_per_counter;
1350 l_hist_info.gl_posting_allowed_flag := NULL;
1351 l_hist_info.ytd_deprn := 0;
1352 l_hist_info.deprn_reserve := l_corp_deprn_summary.deprn_reserve;
1353 l_hist_info.deprn_amount := 0;
1354 l_hist_info.deprn_start_date := C_book_info_rec.deprn_start_date;
1355 l_hist_info.depreciate_flag := C_book_info_rec.depreciate_flag;
1356
1357 IF NOT l_current_year_addition THEN
1358 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1359 p_full_path => l_path_name,
1360 p_string => ' Depreciation Reserve:'||l_hist_info.deprn_reserve);
1361
1362 IF ( NOT l_hist_info.salvage_value is Null) or (NOT l_hist_info.salvage_value=0) THEn
1363 IF NOT igi_iac_salvage_pkg.correction(C_book_info_rec.asset_id,
1364 l_imp_interface.Book_type_code,
1365 l_hist_info.deprn_reserve,
1366 l_hist_info.cost,
1367 l_hist_info.salvage_value,
1368 P_calling_program=>'IMPLEMENTATTION') THEN
1369
1370 return false;
1371 END IF;
1372 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1373 p_full_path => l_path_name,
1374 p_string => ' Depreciation Reserve Salvage value corrected:'||l_hist_info.deprn_reserve);
1375 EnD IF;
1376
1377 IF NOT igi_iac_ytd_engine.Calculate_YTD
1378 ( p_corp_book,
1379 C_book_info_rec.asset_id,
1380 l_hist_info,
1381 l_dpis_period_counter,
1382 l_corp_last_per_counter,
1383 'UPGRADE') THEN
1384
1385 fnd_message.set_name ('IGI', 'IGI_IMP_IAC_PREP_ERROR');
1386 fnd_message.set_token('ROUTINE','igi_iac_ytd_engine.Calculate_YTD');
1387 igi_iac_debug_pkg.debug_other_msg(p_level => g_error_level,
1388 p_full_path => l_path_name,
1389 p_remove_from_stack => FALSE);
1390 p_out_message := fnd_message.get;
1391 Raise Prepare_Data_Error;
1392 END IF;
1393
1394 l_imp_interface.ytd_hist := l_hist_info.ytd_deprn;
1395 Else
1396 l_hist_info.ytd_deprn :=l_corp_deprn_summary.ytd_deprn;
1397 --- salvage value YTD --
1398 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1399 p_full_path => l_path_name,
1400 p_string => ' YTD before salvage corrected:'||l_hist_info.ytd_deprn );
1401
1402 IF ( NOT l_hist_info.salvage_value is Null) or (NOT l_hist_info.salvage_value=0) THEn
1403 IF NOT igi_iac_salvage_pkg.correction(C_book_info_rec.asset_id,
1404 l_imp_interface.Book_type_code,
1405 l_hist_info.ytd_deprn,
1406 l_hist_info.cost,
1407 l_hist_info.salvage_value,
1408 P_calling_program=>'IMPLEMENTATTION') THEN
1409
1410 return false;
1411 END IF;
1412 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1413 p_full_path => l_path_name,
1414 p_string => ' YTD Salvage value corrected:'||l_hist_info.ytd_deprn );
1415 END IF;
1416 l_imp_interface.ytd_hist := l_hist_info.ytd_deprn;
1417 END IF;
1418 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1419 p_full_path => l_path_name,
1420 p_string => ' Historic Depreciation YTD :'||l_imp_interface.ytd_hist);
1421
1422
1423
1424
1425 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
1426 p_full_path => l_path_name,
1427 p_string => ' IAC Depreciation YTD :'||l_imp_interface.ytd_mhca);
1428
1429 IF NOT( Igi_Iac_Common_Utils.Iac_Round ( l_imp_interface.Deprn_exp_hist ,
1430 p_corp_book )) THEN
1431 null;
1432 END IF;
1433
1434 IF NOT( Igi_Iac_Common_Utils.Iac_Round ( l_imp_interface.Deprn_exp_mhca ,
1435 p_corp_book )) THEN
1436 null;
1437 END IF;
1438
1439 l_imp_interface.Accum_deprn_hist := l_corp_deprn_summary.deprn_reserve;
1440 l_imp_interface.Accum_deprn_mhca := l_corp_deprn_summary.deprn_reserve + l_prior_addition.Deprn_reserve ;
1441 l_imp_interface.Reval_reserve_hist := l_corp_deprn_summary.Reval_reserve;
1442 l_imp_interface.Reval_reserve_mhca := l_prior_addition.Reval_reserve;
1443 l_imp_interface.Backlog_hist := 0;
1444 l_imp_interface.Backlog_mhca := l_prior_addition.Backlog_Deprn_reserve;
1445 l_imp_interface.General_fund_hist := 0;
1446 l_imp_interface.General_fund_mhca := l_prior_addition.General_fund;
1447 l_imp_interface.General_fund_per_hist := 0;
1448 l_imp_interface.General_fund_per_mhca := l_prior_addition.Deprn_amount;
1449 l_imp_interface.Operating_account_hist := 0;
1450 l_imp_interface.Operating_account_mhca := l_prior_addition.Operating_acct;
1451 l_imp_interface.Operating_account_ytd_hist := 0;
1452 l_imp_interface.Operating_account_ytd_mhca :=0;
1453
1454 If l_imp_interface.Cost_mhca > l_prior_addition.Hist_cost then
1455 l_imp_interface.Operating_account_cost := 0;
1456 Else
1457 l_imp_interface.Operating_account_cost := l_prior_addition.Adjusted_cost;
1458 End if;
1459
1460 l_fiscal_year := NULL;
1461 Open C_Fiscal_Year(p_corp_book, l_corp_last_per_Counter);
1462 Fetch C_Fiscal_Year Into l_fiscal_year;
1463 Close C_Fiscal_Year;
1464
1465 -- For non depreciating asset interface and FA have same values
1466 If upper(C_Book_Info_Rec.depreciate_flag) = 'NO' THEN
1467 l_imp_interface.ytd_hist:= l_corp_deprn_summary.ytd_deprn;
1468 l_imp_interface.Ytd_mhca := l_imp_interface.ytd_hist;
1469 l_imp_interface.Accum_deprn_hist := l_corp_deprn_summary.deprn_reserve;
1470 l_imp_interface.Accum_deprn_mhca := l_corp_deprn_summary.deprn_reserve;
1471 ELSE
1472 l_imp_interface.Ytd_mhca := nvl(l_imp_interface.ytd_hist,0) * (l_prior_addition.cummulative_reval_factor -1) ;
1473 -- get back the FA YTD to interface table
1474 l_imp_interface.ytd_hist:= l_corp_deprn_summary.ytd_deprn;
1475 l_imp_interface.Ytd_mhca :=l_imp_interface.ytd_hist + Nvl(l_imp_interface.Ytd_mhca,0);
1476 End if;
1477
1478 If p_corp_curr_fiscal_year <> l_fiscal_year then
1479 l_imp_interface.ytd_hist := 0;
1480 l_imp_interface.Ytd_mhca := 0;
1481 Else
1482 If p_corp_curr_period_num = 1 Then
1483 l_imp_interface.ytd_hist := 0;
1484 l_imp_interface.Ytd_mhca := 0;
1485 End if;
1486 End if;
1487
1488 l_imp_interface.Operating_account_backlog :=
1489 l_imp_interface.Operating_account_cost - l_imp_interface.Operating_account_mhca;
1490
1491 l_imp_interface.Nbv_hist := l_prior_addition.hist_nbv;
1492 l_imp_interface.Nbv_mhca := l_prior_addition.hist_nbv + l_prior_addition.Net_book_value;
1493 l_imp_interface.Transferred_flag := 'N';
1494 l_imp_interface.Valid_flag := 'Y'; -- Added as a part of fix for Bug 5137813
1495 l_imp_interface.Selected_flag := 'Y';
1496 l_imp_interface.Exception_flag := l_exception_flag;
1497 l_imp_interface.Exception_code := l_exception_code;
1498 l_imp_interface.Group_id := l_group_id;
1499 l_imp_interface.Export_file := NULL;
1500 l_imp_interface.Export_date := NULL;
1501 l_imp_interface.Import_file := NULL;
1502 l_imp_interface.Import_date := NULL;
1503 l_imp_interface.Created_by := fnd_global.user_id;
1504 l_imp_interface.Creation_date := sysdate;
1505 l_imp_interface.Last_Updated_by := fnd_global.user_id;
1506 l_imp_interface.Last_Update_date := sysdate;
1507 l_imp_interface.Last_update_login := fnd_global.login_id;
1508 l_imp_interface.Request_id := fnd_global.conc_request_id;
1509 l_imp_interface.Program_application_id := fnd_global.prog_appl_id;
1510 l_imp_interface.Program_id := fnd_global.conc_program_id;
1511 l_imp_interface.Program_update_date := sysdate;
1512
1513
1514 If C_Book_Info_Rec.period_counter_fully_reserved is not null then
1515 l_imp_interface.Accum_deprn_mhca := l_imp_interface.Accum_deprn_mhca + l_prior_addition.Net_book_value;
1516 l_imp_interface.General_fund_mhca:= l_imp_interface.Reval_reserve_mhca+
1517 l_imp_interface.General_fund_mhca;
1518 l_imp_interface.Reval_reserve_mhca:=0;
1519 l_prior_addition.Net_book_value:=0;
1520 l_imp_interface.Nbv_mhca := l_prior_addition.hist_nbv + l_prior_addition.Net_book_value;
1521 End if;
1522
1523
1524 IF NOT( Igi_Iac_Common_Utils.Iac_Round ( l_imp_interface.ytd_hist ,
1525 p_corp_book )) THEN
1526 null;
1527 END IF;
1528 IF NOT( Igi_Iac_Common_Utils.Iac_Round ( l_imp_interface.Ytd_mhca ,
1529 p_corp_book )) THEN
1530 null;
1531 END IF;
1532
1533
1534 Populate_Interface(l_imp_interface);
1535 l_cat_records := l_cat_records + 1;
1536 l_rec_ctr := l_rec_ctr + 1;
1537 <<Next_Record>>
1538 Null;
1539 End Loop;
1540 If l_cat_records > 0 then
1541 Populate_Interface_control( p_corp_book, C_Asset_Category_Rec.category_id);
1542 End if;
1543 End Loop;
1544 Return TRUE;
1545
1546
1547 Exception
1548 When Prepare_Data_Error Then
1549 If C_Fiscal_Year%isopen Then
1550 Close C_Fiscal_Year;
1551 End if;
1552 If C_Get_User_Deprn%isopen Then
1553 Close C_Get_User_Deprn;
1554 End if;
1555 If C_Prior_Add%isopen Then
1556 Close C_Prior_Add;
1557 End if;
1558 If C_Corp_Deprn_Details%isopen Then
1559 Close C_Corp_Deprn_Details;
1560 End if;
1561 If C_Corp_Deprn_Summary%isopen Then
1562 Close C_Corp_Deprn_Summary;
1563 End if;
1564 If C_Corp_Max_Period_Counter%isopen Then
1565 Close C_Corp_Max_Period_Counter;
1566 End if;
1567 Rollback work;
1568 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
1569 p_full_path => l_path_name,
1570 p_string => 'Error : ' || p_out_message);
1571 fnd_file.put_line(fnd_file.log, p_out_message);
1572 Return False;
1573 When Others Then
1574 If C_Fiscal_Year%isopen Then
1575 Close C_Fiscal_Year;
1576 End if;
1577 If C_Get_User_Deprn%isopen Then
1578 Close C_Get_User_Deprn;
1579 End if;
1580 If C_Prior_Add%isopen Then
1581 Close C_Prior_Add;
1582 End if;
1583 If C_Corp_Deprn_Details%isopen Then
1584 Close C_Corp_Deprn_Details;
1585 End if;
1586 If C_Corp_Deprn_Summary%isopen Then
1587 Close C_Corp_Deprn_Summary;
1588 End if;
1589 If C_Corp_Max_Period_Counter%isopen Then
1590 Close C_Corp_Max_Period_Counter;
1591 End if;
1592 Rollback work;
1593 igi_iac_debug_pkg.debug_unexpected_msg(p_full_path => l_path_name);
1594 Return FALSE;
1595
1596 End Prepare_corp_data;
1597
1598 BEGIN
1599
1600 l_max_records := 10000;
1601 --===========================FND_LOG.START=====================================
1602
1603 g_state_level := FND_LOG.LEVEL_STATEMENT;
1604 g_proc_level := FND_LOG.LEVEL_PROCEDURE;
1605 g_event_level := FND_LOG.LEVEL_EVENT;
1606 g_excep_level := FND_LOG.LEVEL_EXCEPTION;
1607 g_error_level := FND_LOG.LEVEL_ERROR;
1608 g_unexp_level := FND_LOG.LEVEL_UNEXPECTED;
1609 g_path := 'IGI.PLSQL.igiimpdb.igi_imp_iac_prepare_pkg.';
1610 --===========================FND_LOG.END=====================================
1611
1612
1613 END IGI_IMP_IAC_PREPARE_PKG; -- Package Body