1 PACKAGE BODY FA_IGI_EXT_PKG AS
2 /* $Header: igiiafab.pls 120.9 2011/04/03 14:25:24 sasukuma ship $ */
3
4 --===========================FND_LOG.START=====================================
5
6 g_state_level NUMBER := FND_LOG.LEVEL_STATEMENT;
7 g_proc_level NUMBER := FND_LOG.LEVEL_PROCEDURE;
8 g_event_level NUMBER := FND_LOG.LEVEL_EVENT;
9 g_excep_level NUMBER := FND_LOG.LEVEL_EXCEPTION;
10 g_error_level NUMBER := FND_LOG.LEVEL_ERROR;
11 g_unexp_level NUMBER := FND_LOG.LEVEL_UNEXPECTED;
12 g_path VARCHAR2(200) := 'IGI.PLSQL.igiiacub.fa_igi_ext_pkg';
13
14 --===========================FND_LOG.END=====================================
15
16 /*=========================================================================+
17 | Function Name: |
18 | Do_Current_Addition |
19 | |
20 | Description: |
21 | This IAC hook function is to process addition for IAC and called from|
22 | Depreciation program(fadcje.lpc). |
23 | |
24 +=========================================================================*/
25 FUNCTION Do_Current_Addition(
26 p_book_type_code VARCHAR2,
27 p_asset_id NUMBER,
28 p_calling_function VARCHAR2
29 ) return BOOLEAN IS
30
31 BEGIN
32 return TRUE;
33 END Do_Current_Addition;
34
35
36 -- Bug6391045 : Added the function Do_Addition
37 /*=========================================================================+
38 | Function Name: |
39 | Do_Addition |
40 | |
41 | Description: |
42 | This IAC hook function is to calculate catch-up at the time of |
43 | addition. IAC will encapsulate do_prior_addition call into this |
44 | do_addition call. |
45 | |
46 +=========================================================================*/
47
48 /* scalar
49 FUNCTION Do_Addition(
50 p_book_type_code VARCHAR2,
51 p_asset_id NUMBER,
52 p_category_id NUMBER,
53 p_deprn_method_code VARCHAR2,
54 p_cost NUMBER,
55 p_adjusted_cost NUMBER,
56 p_salvage_value NUMBER,
57 p_current_unit NUMBER,
58 p_life_in_months NUMBER,
59 p_event_id NIMBER,
60 p_calling_function VARCHAR2
61 ) return BOOLEAN IS
62 BEGIN
63 return TRUE;
64 END Do_Addition;
65
66 */
67
68
69 FUNCTION Do_Addition(
70 p_trans_rec FA_API_TYPES.trans_rec_type,
71 p_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type,
72 p_asset_cat_rec FA_API_TYPES.asset_cat_rec_type,
73 p_asset_desc_rec FA_API_TYPES.asset_desc_rec_type,
74 p_asset_fin_rec FA_API_TYPES.asset_fin_rec_type,
75 p_asset_deprn_rec FA_API_TYPES.asset_deprn_rec_type,
76 p_asset_type_rec FA_API_TYPES.asset_type_rec_type,
77 p_calling_function VARCHAR2
78 ) return BOOLEAN IS
79 BEGIN
80
81 IF ( NOT (igi_iac_common_utils.is_iac_book(p_asset_hdr_rec.book_type_code))) THEN
82
83 return TRUE;
84 END IF;
85
86 -- Created a new procedure Do_Addition_Wrapper which encapsultaes the do_prior_addition call
87 -- R12 uptake
88 IF ( NOT ( Igi_Iac_Additions_Pkg.Do_Addition_Wrapper(p_asset_hdr_rec.book_type_code,
89 p_asset_hdr_rec.asset_id,
90 p_asset_cat_rec.category_id,
91 p_asset_fin_rec.deprn_method_code,
92 p_asset_fin_rec.cost,
93 p_asset_fin_rec.adjusted_cost,
94 p_asset_fin_rec.salvage_value,
95 p_asset_desc_rec.current_units,
96 p_asset_fin_rec.life_in_months,
97 p_trans_rec.event_id,
98 p_calling_function))) THEN
99
100
101 return FALSE;
102 END IF;
103
104 Return TRUE;
105 END Do_Addition;
106
107
108 /*=========================================================================+
109 | Function Name: |
110 | Validate_Retire_Reinstate |
111 | |
112 | Description: [Added for Bug 8524429] |
113 | The function is called from package FA_RETIREMENT_PUB and is used to |
114 | perform validations before allowing retirement or reinstatements |
115 | |
116 +=========================================================================*/
117 FUNCTION Validate_Retire_Reinstate(
118 p_book_type_code VARCHAR2,
119 p_asset_id NUMBER,
120 p_calling_function VARCHAR2
121 ) return BOOLEAN IS
122 l_path_name VARCHAR2(300);
123 BEGIN
124
125 l_path_name := g_path||'.Validate_Retire_Reinstate';
126
127 IF ( NOT (igi_iac_common_utils.is_iac_book(p_book_type_code))) THEN
128 Return True;
129 END IF;
130
131 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
132 p_full_path => l_path_name,
133 p_string => 'p_asset_id = '||p_asset_id);
134
135 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
136 p_full_path => l_path_name,
137 p_string => 'p_book_type_code = '||p_book_type_code);
138
139 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
140 p_full_path => l_path_name,
141 p_string => 'p_calling_function = '||p_calling_function);
142
143 IF IGI_IAC_COMMON_UTILS.Is_Asset_Adjustment_Done(X_book_type_code => p_book_type_code,
144 X_asset_id => p_asset_id) THEN
145 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
146 p_full_path => l_path_name,
147 p_string => 'Adjustment exists in the current period for the given asset');
148 fnd_message.set_name('IGI', 'IGI_IAC_NO_REINST_ADJUST');
149 fnd_msg_pub.add;
150 Return False;
151 ELSE
152 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
153 p_full_path => l_path_name,
154 p_string => 'No Adjustment exists in the current period for the given asset');
155 Return True;
156 END IF;
157
158 EXCEPTION
159 WHEN OTHERS THEN
160 igi_iac_debug_pkg.debug_other_string(p_level => g_error_level,
161 p_full_path => l_path_name,
162 p_string => 'Unexpected error SQLERRM(sqlcode) = '||SQLERRM(sqlcode));
163
164 fnd_message.set_name('IGI', 'IGI_IAC_NO_REINST_ADJUST');
165 fnd_message.set_token('PACKAGE', 'FA_IGI_EXT_PKG.Validate_Retire_Reinstate');
166 fnd_msg_pub.add;
167 Return False;
168 END Validate_Retire_Reinstate;
169
170 -- Bug 8400876 : Uncommented the function Do_Prior_Addition
171 /*=========================================================================+
172 | Function Name: |
173 | Do_Prior_Addition |
174 | |
175 | Description: |
176 | This function was added in R12 to allow FA to dual maintain the |
177 | spec of this package. This function has been modified to return |
178 | false. Release 12 FA code will never call this function. |
179 | |
180 +=========================================================================*/
181 -- Bug6391045
182 FUNCTION Do_Prior_Addition(
183 p_book_type_code VARCHAR2,
184 p_asset_id NUMBER,
185 p_category_id NUMBER,
186 p_deprn_method_code VARCHAR2,
187 p_cost NUMBER,
188 p_adjusted_cost NUMBER,
189 p_salvage_value NUMBER,
190 p_current_unit NUMBER,
191 p_life_in_months NUMBER,
192 p_calling_function VARCHAR2
193 ) return BOOLEAN IS
194 BEGIN
195 -- Modified to return false as this function will never be called in Release 12.
196 -- If flow reaches this point in R12, it is due to some error in FA code
197 return FALSE;
198 END Do_Prior_Addition;
199 -- End of Bug 8400876
200
201 /*=========================================================================+
202 | Function Name: |
203 | Do_Adjustment |
204 | |
205 | Description: |
206 | This IAC hook function is to process adjustment for IAC and called |
207 | from Adjustment API(FA_ADJUSTMENT_PUB.DO_All_Books). |
208 | |
209 +=========================================================================*/
210 FUNCTION Do_Adjustment(
211 p_trans_rec FA_API_TYPES.trans_rec_type,
212 p_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type,
213 p_asset_cat_rec FA_API_TYPES.asset_cat_rec_type,
214 p_asset_desc_rec FA_API_TYPES.asset_desc_rec_type,
215 p_asset_type_rec FA_API_TYPES.asset_type_rec_type,
216 p_asset_fin_rec FA_API_TYPES.asset_fin_rec_type,
217 p_asset_deprn_rec FA_API_TYPES.asset_deprn_rec_type,
218 p_calling_function VARCHAR2
219 ) return BOOLEAN IS
220 BEGIN
221 IF NOT(IGI_IAC_COMMON_UTILS.is_iac_book(p_asset_hdr_rec.book_type_code)) THEN
222 return TRUE;
223 END IF;
224
225 IF not (igi_iac_adj_pkg.Do_Record_Adjustments(
226 p_trans_rec ,
227 p_asset_hdr_rec,
228 p_asset_cat_rec ,
229 p_asset_desc_rec ,
230 p_asset_type_rec ,
231 p_asset_fin_rec ,
232 p_asset_deprn_rec ,
233 p_calling_function
234 )) THEN
235
236 return FALSE;
237 END IF;
238
239 return TRUE;
240 END Do_Adjustment;
241
242 /*=========================================================================+
243 | Function Name: |
244 | Do_Reclass |
245 | |
246 | Description: |
247 | This IAC hook function is to process reclassification for IAC and |
248 | called from Reclass API(FA_RECLASS_PVT.Do_Reclass). |
249 | |
250 +=========================================================================*/
251 FUNCTION Do_Reclass(
252 p_trans_rec FA_API_TYPES.trans_rec_type,
253 p_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type,
254 p_asset_cat_rec_old FA_API_TYPES.asset_cat_rec_type,
255 p_asset_cat_rec_new FA_API_TYPES.asset_cat_rec_type,
256 p_asset_desc_rec FA_API_TYPES.asset_desc_rec_type,
257 p_asset_type_rec FA_API_TYPES.asset_type_rec_type,
258 p_calling_function VARCHAR2
259 ) return BOOLEAN IS
260
261 BEGIN
262 IF NOT(IGI_IAC_COMMON_UTILS.is_iac_book(p_asset_hdr_rec.book_type_code)) THEN
263
264 return TRUE;
265 END IF;
266 IF ( NOT ( Igi_Iac_Reclass_Pkg.Do_Reclass(
267 p_trans_rec ,
268 p_asset_hdr_rec ,
269 p_asset_cat_rec_old ,
270 p_asset_cat_rec_new ,
271 p_asset_desc_rec ,
272 p_asset_type_rec ,
273 p_calling_function ,
274 p_trans_rec.event_id )))
275 THEN
276 return FALSE ;
277 END IF;
278
279 return TRUE;
280 END Do_Reclass;
281
282 /*=========================================================================+
283 | Function Name: |
284 | Do_Transfer |
285 | |
286 | Description: |
287 | This IAC hook function is to process transfers for IAC and |
288 | called from Transfer API(FA_TRANSFER_PUB.Do_Transfer). |
289 | |
290 +=========================================================================*/
291 FUNCTION Do_Transfer(
292 p_trans_rec FA_API_TYPES.trans_rec_type,
293 p_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type,
294 p_asset_cat_rec FA_API_TYPES.asset_cat_rec_type,
295 p_calling_function VARCHAR2
296 ) return BOOLEAN IS
297
298 BEGIN
299 IF NOT(IGI_IAC_COMMON_UTILS.is_iac_book(p_asset_hdr_rec.book_type_code)) THEN
300
301 return TRUE;
302 END IF;
303 IF ( NOT ( IGI_IAC_TRANSFERS_PKG.Do_Transfer(
304 p_trans_rec ,
305 p_asset_hdr_rec ,
306 p_asset_cat_rec ,
307 p_calling_function,
308 p_trans_rec.event_id ))) THEN
309 return FALSE;
310 END IF;
311 return TRUE;
312
313 END Do_Transfer;
314
315 -- Bug 8400876 : Uncommented the function Do_Prior_Transfer
316 /*=========================================================================+
317 | Function Name: |
318 | Do_Prior_Transfer |
319 | |
320 | Description: |
321 | This function was added in R12 to allow FA to dual maintain the |
322 | spec of this package. This function has been modified to return |
323 | false. Release 12 FA code will never call this function. |
324 | |
325 +=========================================================================*/
326 -- Bug6391045
327 FUNCTION Do_Prior_Transfer(
328 p_book_type_code VARCHAR2,
329 p_asset_id NUMBER,
330 p_category_id NUMBER,
331 p_transaction_header_id NUMBER,
332 p_cost NUMBER,
333 p_adjusted_cost NUMBER,
334 p_salvage_value NUMBER,
335 p_current_unit NUMBER,
336 p_life_in_months NUMBER,
337 p_calling_function VARCHAR2
338 ) return BOOLEAN IS
339
340 BEGIN
341 -- Modified to return false as this function will never be called in Release 12.
342 -- If flow reaches this point in R12, it is due to some error in FA code
343 return FALSE;
344 END Do_Prior_Transfer;
345 -- End of Bug 8400876
346
347
348 /*=========================================================================+
349 | Function Name: |
350 | Do_Unit_Adjustment |
351 | |
352 | Description: |
353 | This IAC hook function is to process unit adjustment for IAC and |
354 | called from Unit Adjustment API(FA_UNIT_ADJ_PUB.Do_Unit_Adjustment). |
355 | |
356 +=========================================================================*/
357 FUNCTION Do_Unit_Adjustment(
358 p_trans_rec FA_API_TYPES.trans_rec_type,
359 p_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type,
360 p_asset_cat_rec FA_API_TYPES.asset_cat_rec_type,
361 p_calling_function VARCHAR2
362 ) return BOOLEAN IS
363 BEGIN
364 return TRUE;
365 END Do_Unit_Adjustment;
366
367 /*=========================================================================+
368 | Function Name: |
369 | Do_Unplanned |
370 | |
371 | Description: |
372 | This IAC hook function is to process unplanned depreciation for IAC |
373 | and called from Unplanned Depreciation API |
374 | (FA_UNPLANNED_PUB.Do_Unplanned). |
375 | |
376 +=========================================================================*/
377 FUNCTION Do_Unplanned(
378 p_trans_rec FA_API_TYPES.trans_rec_type,
379 p_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type,
380 p_asset_cat_rec FA_API_TYPES.asset_cat_rec_type,
381 p_asset_desc_rec FA_API_TYPES.asset_desc_rec_type,
382 p_asset_type_rec FA_API_TYPES.asset_type_rec_type,
383 p_unplanned_deprn_rec FA_API_TYPES.unplanned_deprn_rec_type,
384 p_period_rec FA_API_TYPES.period_rec_type,
385 p_calling_function VARCHAR2
386 ) return BOOLEAN IS
387 BEGIN
388 return TRUE;
389 END Do_Unplanned;
390
391 /*=========================================================================+
392 | Function Name: |
393 | Do_Depreciation |
394 | |
395 | Description: |
396 | This IAC hook function is to process Post-Depreciation for IAC and |
397 | called from Depreciation program(fadpmn.opc). |
398 | |
399 +=========================================================================*/
400 FUNCTION Do_Depreciation(
401 p_book_type_code VARCHAR2,
402 p_period_counter NUMBER,
403 p_calling_function VARCHAR2
404 ) return BOOLEAN IS
405
406 BEGIN
407 IF ( NOT (igi_iac_common_utils.is_iac_book(p_book_type_code))) THEN
408
409 return TRUE;
410 END IF;
411
412 IF ( NOT ( IGI_IAC_DEPRN_PKG.Do_Depreciation(
413 p_book_type_code ,
414 p_period_counter ,
415 p_calling_function ))) THEN
416 RETURN FALSE ;
417 END IF;
418 return TRUE;
419 END Do_Depreciation;
420
421
422 /*=========================================================================+
423 | Function Name: |
424 | Do_Gain_Loss |
425 | |
426 | Description: |
427 | This IAC hook function is to process gain and loss calculation for |
428 | IAC and called from Gain and Loss program(fagpro.lpc). |
429 | Added for FP Bug 8566785 |
430 +=========================================================================*/
431 FUNCTION Do_Gain_Loss(
432 p_retirement_id NUMBER,
433 p_asset_id NUMBER,
434 p_book_type_code VARCHAR2,
435 -- p_event_id NUMBER,-- Bug6391045
436 p_calling_function VARCHAR2
437 ) return BOOLEAN IS
438 BEGIN
439 return FALSE;
440 END Do_Gain_Loss;
441
442 /*=========================================================================+
443 | Function Name: |
444 | Do_Gain_Loss |
445 | |
446 | Description: |
447 | This IAC hook function is to process gain and loss calculation for |
448 | IAC and called from Gain and Loss program(fagpro.lpc). |
449 | |
450 +=========================================================================*/
451 FUNCTION Do_Gain_Loss(
452 p_retirement_id NUMBER,
453 p_asset_id NUMBER,
454 p_book_type_code VARCHAR2,
455 p_event_id NUMBER,-- Bug6391045
456 p_calling_function VARCHAR2
457 ) return BOOLEAN IS
458
459 l_txn_id_out NUMBER := 0 ;
460 BEGIN
461 IF ( NOT (igi_iac_common_utils.is_iac_book(p_book_type_code))) THEN
462
463 return TRUE;
464 END IF;
465
466 SELECT nvl(ret.transaction_header_id_out,0)
467 INTO l_txn_id_out
468 FROM fa_retirements ret
469 WHERE ret.retirement_id = p_retirement_id ;
470
471
472 IF ( l_txn_id_out = 0 ) THEN
473 IF ( NOT( IGI_IAC_RETIREMENT.Do_Iac_Retirement ( p_asset_id ,
474 p_book_type_code ,
475 p_retirement_id ,
476 p_calling_function ,
477 p_event_id)))
478 THEN
479 RETURN FALSE ;
480 END IF ;
481 ELSE
482 IF ( NOT( IGI_IAC_REINSTATE_PKG.Do_Iac_Reinstatement( p_asset_id ,
483 p_book_type_code ,
484 p_retirement_id ,
485 p_calling_function ,
486 p_event_id)))
487 THEN
488 RETURN FALSE ;
489 END IF ;
490 END IF;
491
492 return TRUE;
493
494 EXCEPTION
495 WHEN NO_DATA_FOUND THEN
496 Return TRUE ;
497 END Do_Gain_Loss;
498
499 /*=========================================================================+
500 | Function Name: |
501 | Do_Rollback_Deprn |
502 | |
503 | Description: |
504 | This IAC hook function is to process Rollback Depreciation for IAC |
505 | and called from Rollback Depreciation program |
506 | (FA_DEPRN_ROLLBACK_PKG.do_rollback). |
507 | |
508 +=========================================================================*/
509 -- Bug6391045 : New Signature for the function Do_Rollback_Deprn
510 FUNCTION Do_Rollback_Deprn(
511 p_asset_hdr_rec fa_api_types.asset_hdr_rec_type,
512 p_period_rec fa_api_types.period_rec_type,
513 p_deprn_run_id NUMBER,
514 p_reversal_event_id NUMBER,
515 p_reversal_date DATE,
516 p_deprn_exists_count NUMBER,
517 p_calling_function VARCHAR2
518 ) return BOOLEAN IS
519
520 BEGIN
521 /* - commented for bug#11938068
522 IF NOT igi_iac_additions_pkg.do_rollback_addition(
523 p_asset_hdr_rec.book_type_code,
524 p_period_rec.period_counter,
525 p_calling_function) THEN
526 return FALSE;
527 END IF;
528
529 IF NOT igi_iac_transfers_pkg.do_rollback_deprn(
530 p_asset_hdr_rec.book_type_code,
531 p_period_rec.period_counter,
532 p_calling_function) THEN
533 return FALSE;
534 END IF;
535 */
536 return TRUE;
537 END Do_Rollback_Deprn;
538
539 /*=========================================================================+
540 | Function Name: |
541 | Do_Rollback_JE |
542 | |
543 | Description: |
544 | This IAC hook function is to process Rollback Journal Entries for |
545 | IAC and called from (FA_JE_ROLLBACK_PKG.do_rollback). |
546 | |
547 +=========================================================================*/
548 FUNCTION Do_Rollback_JE(
549 p_book_type_code VARCHAR2,
550 p_period_counter NUMBER,
551 p_set_of_books_id NUMBER,
552 p_batch_name VARCHAR2,
553 p_je_batch_id NUMBER,
554 p_calling_function VARCHAR2
555 ) return BOOLEAN IS
556
557 BEGIN
558 return TRUE;
559 END Do_Rollback_JE;
560
561
562 /*=========================================================================+
563 | Function Name: |
564 | IAC_Enabled |
565 | |
566 | Description: |
567 | This is to return flag to indicate whether subsequent IAC calls |
568 | should be made or not. |
569 | This function will return FALSE if IAC is not installed or not set |
570 | up to use IAC feature. |
571 | |
572 +=========================================================================*/
573 FUNCTION IAC_Enabled return BOOLEAN IS
574 BEGIN
575 IF igi_gen.is_req_installed('IAC') THEN
576 return TRUE ;
577 END IF;
578 return FALSE;
579 END IAC_Enabled;
580
581
582 -- Bug 8400876 : Added the function Do_Rollback_Deprn
583 /*=========================================================================+
584 | Function Name: |
585 | Do_Rollback_Deprn |
586 | |
587 | Description: |
588 | This function was added in R12 to allow FA to dual maintain the |
589 | spec of this package. This function has been modified to return |
590 | false. Release 12 FA code will never call this function. |
591 | |
592 +=========================================================================*/
593 FUNCTION Do_Rollback_Deprn(
594 p_book_type_code VARCHAR2,
595 p_period_counter NUMBER,
596 p_calling_function VARCHAR2
597 ) return BOOLEAN IS
598
599 BEGIN
600 -- Modified to return false as this function will never be called in Release 12.
601 -- If flow reaches this point in R12, it is due to some error in FA code
602 return FALSE;
603 END Do_Rollback_Deprn;
604 -- End of Bug 8400876
605
606 END FA_IGI_EXT_PKG;