[Home] [Help]
PACKAGE BODY: APPS.FA_CACHE_PKG
Source
1 PACKAGE BODY FA_CACHE_PKG as
2 /* $Header: FACACHEB.pls 120.24.12010000.2 2008/10/15 14:17:01 gigupta ship $ */
3
4 Function fazcbc
5 (X_book in varchar2,
6 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
7 return boolean is
8
9 l_found boolean;
10 l_count number;
11 fazcbc_err exception;
12
13 begin <<FAZCBC>>
14
15 -- due to caching problem, will do direct select
16 -- BUG# 1910467 - reinstating cache
17 -- transaction approval will insure the cache is not
18 -- not stale every time it is called
19 -- bridgway 08/01/01
20
21 if nvl(fazcbc_record.book_type_code, X_book || 'NULL') = X_book then
22
23 -- BUG# 2366515
24 -- now load the fazcbcs cache proactively
25 if NOT fa_cache_pkg.fazcbcs(X_book => x_book,
26 p_log_level_rec => p_log_level_rec) then
27 raise fazcbc_err;
28 end if;
29
30 return true;
31 else
32 if fazcbc_table.count = 0 then
33 l_found := FALSE;
34
35 -- load profiles
36 if not fazprof then
37 raise fazcbc_err;
38 end if;
39
40 end if;
41
42 for i in 1..fazcbc_table.count loop
43
44 if (fazcbc_table(i).book_type_code = X_book) then
45 l_found := TRUE;
46 l_count := i;
47 exit;
48 else
49 l_found := FALSE;
50 end if;
51
52 end loop;
53
54 if l_found = TRUE then
55 fazcbc_record := fazcbc_table(l_count);
56 fazcbc_index := l_count;
57 else
58 SELECT book_type_code,
59 book_type_name,
60 set_of_books_id,
61 initial_date,
62 last_deprn_run_date,
63 amortize_flag,
64 fully_reserved_flag,
65 deprn_calendar,
66 book_class,
67 gl_posting_allowed_flag,
68 current_fiscal_year,
69 allow_mass_changes,
70 allow_deprn_adjustments,
71 accounting_flex_structure,
72 last_update_date,
73 last_updated_by,
74 prorate_calendar,
75 date_ineffective,
76 je_retirement_category,
77 je_depreciation_category,
78 je_reclass_category,
79 gl_je_source,
80 je_addition_category,
81 je_adjustment_category,
82 distribution_source_book,
83 je_transfer_category,
84 copy_retirements_flag,
85 copy_adjustments_flag,
86 deprn_request_id,
87 allow_cost_ceiling,
88 allow_deprn_exp_ceiling,
89 calculate_nbv,
90 run_year_end_program,
91 je_deferred_deprn_category,
92 itc_allowed_flag,
93 created_by,
94 creation_date,
95 last_update_login,
96 allow_mass_copy,
97 allow_purge_flag,
98 allow_reval_flag,
99 amortize_reval_reserve_flag,
100 ap_intercompany_acct,
101 ar_intercompany_acct,
102 attribute1,
103 attribute2,
104 attribute3,
105 attribute4,
106 attribute5,
107 attribute6,
108 attribute7,
109 attribute8,
110 attribute9,
111 attribute10,
112 attribute11,
113 attribute12,
114 attribute13,
115 attribute14,
116 attribute15,
117 attribute_category_code,
118 capital_gain_threshold,
119 copy_salvage_value_flag,
120 cost_of_removal_clearing_acct,
121 cost_of_removal_gain_acct,
122 cost_of_removal_loss_acct,
123 default_life_extension_ceiling,
124 default_life_extension_factor,
125 default_max_fully_rsvd_revals,
126 default_reval_fully_rsvd_flag,
127 deferred_deprn_expense_acct,
128 deferred_deprn_reserve_acct,
129 deprn_allocation_code,
130 deprn_status,
131 fiscal_year_name,
132 initial_period_counter,
133 je_cip_adjustment_category,
134 je_cip_addition_category,
135 je_cip_reclass_category,
136 je_cip_retirement_category,
137 je_cip_reval_category,
138 je_cip_transfer_category,
139 je_reval_category,
140 last_mass_copy_period_counter,
141 last_period_counter,
142 last_purge_period_counter,
143 mass_copy_source_book,
144 mass_request_id,
145 nbv_amount_threshold,
146 nbv_fraction_threshold,
147 nbv_retired_gain_acct,
148 nbv_retired_loss_acct,
149 proceeds_of_sale_clearing_acct,
150 proceeds_of_sale_gain_acct,
151 proceeds_of_sale_loss_acct,
152 revalue_on_retirement_flag,
153 reval_deprn_reserve_flag,
154 reval_rsv_retired_gain_acct,
155 reval_rsv_retired_loss_acct,
156 deprn_adjustment_acct,
157 immediate_copy_flag,
158 je_deprn_adjustment_category,
159 depr_first_year_ret_flag,
160 flexbuilder_defaults_ccid,
161 retire_reval_reserve_flag,
162 use_current_nbv_for_deprn,
163 copy_additions_flag,
164 use_percent_salvage_value_flag,
165 reval_posting_flag,
166 global_attribute1,
167 global_attribute2,
168 global_attribute3,
169 global_attribute4,
170 global_attribute5,
171 global_attribute6,
172 global_attribute7,
173 global_attribute8,
174 global_attribute9,
175 global_attribute10,
176 global_attribute11,
177 global_attribute12,
178 global_attribute13,
179 global_attribute14,
180 global_attribute15,
181 global_attribute16,
182 global_attribute17,
183 global_attribute18,
184 global_attribute19,
185 global_attribute20,
186 global_attribute_category,
187 mc_source_flag,
188 reval_ytd_deprn_flag,
189 allow_cip_assets_flag,
190 org_id,
191 allow_group_deprn_flag,
192 allow_cip_dep_group_flag,
193 allow_interco_group_flag,
194 copy_group_addition_flag,
195 copy_group_assignment_flag,
196 allow_cip_member_flag, /* HH: for conditional defaulting of group */
197 allow_member_tracking_flag, -- HH
198 --added for fapost minor enhancement start
199 INTERCOMPANY_POSTING_FLAG,
200 --added for fapost minor enhancement end
201 allow_cost_sign_change_flag,
202 create_accounting_request_id
203 INTO fazcbc_record.book_type_code,
204 fazcbc_record.book_type_name,
205 fazcbc_record.set_of_books_id,
206 fazcbc_record.initial_date,
207 fazcbc_record.last_deprn_run_date,
208 fazcbc_record.amortize_flag,
209 fazcbc_record.fully_reserved_flag,
210 fazcbc_record.deprn_calendar,
211 fazcbc_record.book_class,
212 fazcbc_record.gl_posting_allowed_flag,
213 fazcbc_record.current_fiscal_year,
214 fazcbc_record.allow_mass_changes,
215 fazcbc_record.allow_deprn_adjustments,
216 fazcbc_record.accounting_flex_structure,
217 fazcbc_record.last_update_date,
218 fazcbc_record.last_updated_by,
219 fazcbc_record.prorate_calendar,
220 fazcbc_record.date_ineffective,
221 fazcbc_record.je_retirement_category,
222 fazcbc_record.je_depreciation_category,
223 fazcbc_record.je_reclass_category,
224 fazcbc_record.gl_je_source,
225 fazcbc_record.je_addition_category,
226 fazcbc_record.je_adjustment_category,
227 fazcbc_record.distribution_source_book,
228 fazcbc_record.je_transfer_category,
229 fazcbc_record.copy_retirements_flag,
230 fazcbc_record.copy_adjustments_flag,
231 fazcbc_record.deprn_request_id,
232 fazcbc_record.allow_cost_ceiling,
233 fazcbc_record.allow_deprn_exp_ceiling,
234 fazcbc_record.calculate_nbv,
235 fazcbc_record.run_year_end_program,
236 fazcbc_record.je_deferred_deprn_category,
237 fazcbc_record.itc_allowed_flag,
238 fazcbc_record.created_by,
239 fazcbc_record.creation_date,
240 fazcbc_record.last_update_login,
241 fazcbc_record.allow_mass_copy,
242 fazcbc_record.allow_purge_flag,
243 fazcbc_record.allow_reval_flag,
244 fazcbc_record.amortize_reval_reserve_flag,
245 fazcbc_record.ap_intercompany_acct,
246 fazcbc_record.ar_intercompany_acct,
247 fazcbc_record.attribute1,
248 fazcbc_record.attribute2,
249 fazcbc_record.attribute3,
250 fazcbc_record.attribute4,
251 fazcbc_record.attribute5,
252 fazcbc_record.attribute6,
253 fazcbc_record.attribute7,
254 fazcbc_record.attribute8,
255 fazcbc_record.attribute9,
256 fazcbc_record.attribute10,
257 fazcbc_record.attribute11,
258 fazcbc_record.attribute12,
259 fazcbc_record.attribute13,
260 fazcbc_record.attribute14,
261 fazcbc_record.attribute15,
262 fazcbc_record.attribute_category_code,
263 fazcbc_record.capital_gain_threshold,
264 fazcbc_record.copy_salvage_value_flag,
265 fazcbc_record.cost_of_removal_clearing_acct,
266 fazcbc_record.cost_of_removal_gain_acct,
267 fazcbc_record.cost_of_removal_loss_acct,
268 fazcbc_record.default_life_extension_ceiling,
269 fazcbc_record.default_life_extension_factor,
270 fazcbc_record.default_max_fully_rsvd_revals,
271 fazcbc_record.default_reval_fully_rsvd_flag,
272 fazcbc_record.deferred_deprn_expense_acct,
273 fazcbc_record.deferred_deprn_reserve_acct,
274 fazcbc_record.deprn_allocation_code,
275 fazcbc_record.deprn_status,
276 fazcbc_record.fiscal_year_name,
277 fazcbc_record.initial_period_counter,
278 fazcbc_record.je_cip_adjustment_category,
279 fazcbc_record.je_cip_addition_category,
280 fazcbc_record.je_cip_reclass_category,
281 fazcbc_record.je_cip_retirement_category,
282 fazcbc_record.je_cip_reval_category,
283 fazcbc_record.je_cip_transfer_category,
284 fazcbc_record.je_reval_category,
285 fazcbc_record.last_mass_copy_period_counter,
286 fazcbc_record.last_period_counter,
287 fazcbc_record.last_purge_period_counter,
288 fazcbc_record.mass_copy_source_book,
289 fazcbc_record.mass_request_id,
290 fazcbc_record.nbv_amount_threshold,
291 fazcbc_record.nbv_fraction_threshold,
292 fazcbc_record.nbv_retired_gain_acct,
293 fazcbc_record.nbv_retired_loss_acct,
294 fazcbc_record.proceeds_of_sale_clearing_acct,
295 fazcbc_record.proceeds_of_sale_gain_acct,
296 fazcbc_record.proceeds_of_sale_loss_acct,
297 fazcbc_record.revalue_on_retirement_flag,
298 fazcbc_record.reval_deprn_reserve_flag,
299 fazcbc_record.reval_rsv_retired_gain_acct,
300 fazcbc_record.reval_rsv_retired_loss_acct,
301 fazcbc_record.deprn_adjustment_acct,
302 fazcbc_record.immediate_copy_flag,
303 fazcbc_record.je_deprn_adjustment_category,
304 fazcbc_record.depr_first_year_ret_flag,
305 fazcbc_record.flexbuilder_defaults_ccid,
306 fazcbc_record.retire_reval_reserve_flag,
307 fazcbc_record.use_current_nbv_for_deprn,
308 fazcbc_record.copy_additions_flag,
309 fazcbc_record.use_percent_salvage_value_flag,
310 fazcbc_record.reval_posting_flag,
311 fazcbc_record.global_attribute1,
312 fazcbc_record.global_attribute2,
313 fazcbc_record.global_attribute3,
314 fazcbc_record.global_attribute4,
315 fazcbc_record.global_attribute5,
316 fazcbc_record.global_attribute6,
317 fazcbc_record.global_attribute7,
318 fazcbc_record.global_attribute8,
319 fazcbc_record.global_attribute9,
320 fazcbc_record.global_attribute10,
321 fazcbc_record.global_attribute11,
322 fazcbc_record.global_attribute12,
323 fazcbc_record.global_attribute13,
324 fazcbc_record.global_attribute14,
325 fazcbc_record.global_attribute15,
326 fazcbc_record.global_attribute16,
327 fazcbc_record.global_attribute17,
328 fazcbc_record.global_attribute18,
329 fazcbc_record.global_attribute19,
330 fazcbc_record.global_attribute20,
331 fazcbc_record.global_attribute_category,
332 fazcbc_record.mc_source_flag,
333 fazcbc_record.reval_ytd_deprn_flag,
334 fazcbc_record.allow_cip_assets_flag,
335 fazcbc_record.org_id,
336 fazcbc_record.allow_group_deprn_flag,
337 fazcbc_record.allow_cip_dep_group_flag,
338 fazcbc_record.allow_interco_group_flag,
339 fazcbc_record.copy_group_addition_flag,
340 fazcbc_record.copy_group_assignment_flag,
341 fazcbc_record.allow_cip_member_flag, /* HH */
342 fazcbc_record.allow_member_tracking_flag, -- HH
343 --added for fapost minor enhancement start
344 fazcbc_record.INTERCOMPANY_POSTING_FLAG,
345 --added for fapost minor enhancement end
346 fazcbc_record.allow_cost_sign_change_flag,
347 fazcbc_record.create_accounting_request_id
348 FROM fa_book_controls
349 WHERE book_type_code = X_book;
350
351 fazcbc_table(fazcbc_table.count + 1):= fazcbc_record;
352 fazcbc_index := fazcbc_table.count;
353
354 end if;
355 end if;
356
357 -- now load the fazcbcs cache proactively
358 if NOT fa_cache_pkg.fazcbcs(X_book => x_book,
359 p_log_level_rec => p_log_level_rec) then
360 raise fazcbc_err;
361 end if;
362
363 return (TRUE);
364
365 exception
366 when NO_DATA_FOUND then
367 fa_srvr_msg.add_message(calling_fn => NULL,
368 name => 'FA_CACHE_BOOK_CONTROLS',
369 token1 => 'BOOK',
370 value1 => X_book
371 ,p_log_level_rec => p_log_level_rec);
372 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcbc'
373 ,p_log_level_rec => p_log_level_rec);
374 return (false);
375 when fazcbc_err then
376 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcbc'
377 ,p_log_level_rec => p_log_level_rec);
378 return (false);
379 when others then
380 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcbc'
381 ,p_log_level_rec => p_log_level_rec);
382 return (FALSE);
383
384 end FAZCBC;
385
386
387
388 Function fazcbcs
389 (X_book in VARCHAR2,
390 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
391 return boolean is
392
393 l_found boolean;
394 l_count number;
395 h_set_of_books_id number;
396 h_reporting_flag varchar2(1);
397
398 begin <<FAZCBCS>>
399
400 -- get mrc related info
401 fnd_profile.get('GL_SET_OF_BKS_ID', h_set_of_books_id);
402
403 if (h_set_of_books_id is not null) then
404 if not fazcsob
405 (X_set_of_books_id => h_set_of_books_id,
406 X_mrc_sob_type_code => h_reporting_flag,
407 p_log_level_rec => p_log_level_rec) then
408 fa_srvr_msg.add_sql_error
409 (calling_fn => 'fa_cache_pkg.fazcbcs'
410 ,p_log_level_rec => p_log_level_rec);
411 return(FALSE);
412 end if;
413 else
414 h_reporting_flag := 'P';
415 end if;
416
417 -- if this not a reporting book, call the normal cache to insure we're
418 -- using the right SOB ID incase profile doesn't match
419
420 IF (nvl(h_reporting_flag, 'P') <> 'R') then
421 h_set_of_books_id := fazcbc_record.set_of_books_id;
422 END IF;
423
424
425 if ((nvl(fazcbcs_record.book_type_code, X_book || 'NULL') = X_book) and
426 (fazcbcs_record.set_of_books_id = h_set_of_books_id)) then
427 return true;
428 else
429 if fazcbcs_table.count = 0 then
430 l_found := FALSE;
431 end if;
432
433 for i in 1..fazcbcs_table.count loop
434 if ((fazcbcs_table(i).book_type_code = X_book) and
435 (fazcbcs_table(i).set_of_books_id = h_set_of_books_id)) then
436 l_found := TRUE;
437 l_count := i;
438 exit;
439 else
440 l_found := FALSE;
441 end if;
442 end loop;
443
444 if l_found = TRUE then
445 fazcbcs_record := fazcbcs_table(l_count);
446 fazcbcs_index := l_count;
447 else
448 if h_reporting_flag = 'R' then
449 SELECT book_type_code,
450 book_type_name,
451 set_of_books_id,
452 initial_date,
453 last_deprn_run_date,
454 amortize_flag,
455 fully_reserved_flag,
456 deprn_calendar,
457 book_class,
458 gl_posting_allowed_flag,
459 current_fiscal_year,
460 allow_mass_changes,
461 allow_deprn_adjustments,
462 accounting_flex_structure,
463 last_update_date,
464 last_updated_by,
465 prorate_calendar,
466 date_ineffective,
467 je_retirement_category,
468 je_depreciation_category,
469 je_reclass_category,
470 gl_je_source,
471 je_addition_category,
472 je_adjustment_category,
473 distribution_source_book,
474 je_transfer_category,
475 copy_retirements_flag,
476 copy_adjustments_flag,
477 deprn_request_id,
478 allow_cost_ceiling,
479 allow_deprn_exp_ceiling,
480 calculate_nbv,
481 run_year_end_program,
482 je_deferred_deprn_category,
483 itc_allowed_flag,
484 created_by,
485 creation_date,
486 last_update_login,
487 allow_mass_copy,
488 allow_purge_flag,
489 allow_reval_flag,
490 amortize_reval_reserve_flag,
491 ap_intercompany_acct,
492 ar_intercompany_acct,
493 attribute1,
494 attribute2,
495 attribute3,
496 attribute4,
497 attribute5,
498 attribute6,
499 attribute7,
500 attribute8,
501 attribute9,
502 attribute10,
503 attribute11,
504 attribute12,
505 attribute13,
506 attribute14,
507 attribute15,
508 attribute_category_code,
509 capital_gain_threshold,
510 copy_salvage_value_flag,
511 cost_of_removal_clearing_acct,
512 cost_of_removal_gain_acct,
513 cost_of_removal_loss_acct,
514 default_life_extension_ceiling,
515 default_life_extension_factor,
516 default_max_fully_rsvd_revals,
517 default_reval_fully_rsvd_flag,
518 deferred_deprn_expense_acct,
519 deferred_deprn_reserve_acct,
520 deprn_allocation_code,
521 deprn_status,
522 fiscal_year_name,
523 initial_period_counter,
524 je_cip_adjustment_category,
525 je_cip_addition_category,
526 je_cip_reclass_category,
527 je_cip_retirement_category,
528 je_cip_reval_category,
529 je_cip_transfer_category,
530 je_reval_category,
531 last_mass_copy_period_counter,
532 last_period_counter,
533 last_purge_period_counter,
534 mass_copy_source_book,
535 mass_request_id,
536 nbv_amount_threshold,
537 nbv_fraction_threshold,
538 nbv_retired_gain_acct,
539 nbv_retired_loss_acct,
540 proceeds_of_sale_clearing_acct,
541 proceeds_of_sale_gain_acct,
542 proceeds_of_sale_loss_acct,
543 revalue_on_retirement_flag,
544 reval_deprn_reserve_flag,
545 reval_rsv_retired_gain_acct,
546 reval_rsv_retired_loss_acct,
547 deprn_adjustment_acct,
548 immediate_copy_flag,
549 je_deprn_adjustment_category,
550 depr_first_year_ret_flag,
551 flexbuilder_defaults_ccid,
552 retire_reval_reserve_flag,
553 use_current_nbv_for_deprn,
554 copy_additions_flag,
555 use_percent_salvage_value_flag,
556 reval_posting_flag,
557 global_attribute1,
558 global_attribute2,
559 global_attribute3,
560 global_attribute4,
561 global_attribute5,
562 global_attribute6,
563 global_attribute7,
564 global_attribute8,
565 global_attribute9,
566 global_attribute10,
567 global_attribute11,
568 global_attribute12,
569 global_attribute13,
570 global_attribute14,
571 global_attribute15,
572 global_attribute16,
573 global_attribute17,
574 global_attribute18,
575 global_attribute19,
576 global_attribute20,
577 global_attribute_category,
578 mc_source_flag,
579 reval_ytd_deprn_flag,
580 allow_cip_assets_flag,
581 org_id,
582 allow_group_deprn_flag,
583 allow_cip_dep_group_flag,
584 allow_interco_group_flag,
585 copy_group_addition_flag,
586 copy_group_assignment_flag,
587 --added for fapost minor enhancement start
588 INTERCOMPANY_POSTING_FLAG
589 --added for fapost minor enhancement end
590 INTO fazcbcs_record.book_type_code,
591 fazcbcs_record.book_type_name,
592 fazcbcs_record.set_of_books_id,
593 fazcbcs_record.initial_date,
594 fazcbcs_record.last_deprn_run_date,
595 fazcbcs_record.amortize_flag,
596 fazcbcs_record.fully_reserved_flag,
597 fazcbcs_record.deprn_calendar,
598 fazcbcs_record.book_class,
599 fazcbcs_record.gl_posting_allowed_flag,
600 fazcbcs_record.current_fiscal_year,
601 fazcbcs_record.allow_mass_changes,
602 fazcbcs_record.allow_deprn_adjustments,
603 fazcbcs_record.accounting_flex_structure,
604 fazcbcs_record.last_update_date,
605 fazcbcs_record.last_updated_by,
606 fazcbcs_record.prorate_calendar,
607 fazcbcs_record.date_ineffective,
608 fazcbcs_record.je_retirement_category,
609 fazcbcs_record.je_depreciation_category,
610 fazcbcs_record.je_reclass_category,
611 fazcbcs_record.gl_je_source,
612 fazcbcs_record.je_addition_category,
613 fazcbcs_record.je_adjustment_category,
614 fazcbcs_record.distribution_source_book,
615 fazcbcs_record.je_transfer_category,
616 fazcbcs_record.copy_retirements_flag,
617 fazcbcs_record.copy_adjustments_flag,
618 fazcbcs_record.deprn_request_id,
619 fazcbcs_record.allow_cost_ceiling,
620 fazcbcs_record.allow_deprn_exp_ceiling,
621 fazcbcs_record.calculate_nbv,
622 fazcbcs_record.run_year_end_program,
623 fazcbcs_record.je_deferred_deprn_category,
624 fazcbcs_record.itc_allowed_flag,
625 fazcbcs_record.created_by,
626 fazcbcs_record.creation_date,
627 fazcbcs_record.last_update_login,
628 fazcbcs_record.allow_mass_copy,
629 fazcbcs_record.allow_purge_flag,
630 fazcbcs_record.allow_reval_flag,
631 fazcbcs_record.amortize_reval_reserve_flag,
632 fazcbcs_record.ap_intercompany_acct,
633 fazcbcs_record.ar_intercompany_acct,
634 fazcbcs_record.attribute1,
635 fazcbcs_record.attribute2,
636 fazcbcs_record.attribute3,
637 fazcbcs_record.attribute4,
638 fazcbcs_record.attribute5,
639 fazcbcs_record.attribute6,
640 fazcbcs_record.attribute7,
641 fazcbcs_record.attribute8,
642 fazcbcs_record.attribute9,
643 fazcbcs_record.attribute10,
644 fazcbcs_record.attribute11,
645 fazcbcs_record.attribute12,
646 fazcbcs_record.attribute13,
647 fazcbcs_record.attribute14,
648 fazcbcs_record.attribute15,
649 fazcbcs_record.attribute_category_code,
650 fazcbcs_record.capital_gain_threshold,
651 fazcbcs_record.copy_salvage_value_flag,
652 fazcbcs_record.cost_of_removal_clearing_acct,
653 fazcbcs_record.cost_of_removal_gain_acct,
654 fazcbcs_record.cost_of_removal_loss_acct,
655 fazcbcs_record.default_life_extension_ceiling,
656 fazcbcs_record.default_life_extension_factor,
657 fazcbcs_record.default_max_fully_rsvd_revals,
658 fazcbcs_record.default_reval_fully_rsvd_flag,
659 fazcbcs_record.deferred_deprn_expense_acct,
660 fazcbcs_record.deferred_deprn_reserve_acct,
661 fazcbcs_record.deprn_allocation_code,
662 fazcbcs_record.deprn_status,
663 fazcbcs_record.fiscal_year_name,
664 fazcbcs_record.initial_period_counter,
665 fazcbcs_record.je_cip_adjustment_category,
666 fazcbcs_record.je_cip_addition_category,
667 fazcbcs_record.je_cip_reclass_category,
668 fazcbcs_record.je_cip_retirement_category,
669 fazcbcs_record.je_cip_reval_category,
670 fazcbcs_record.je_cip_transfer_category,
671 fazcbcs_record.je_reval_category,
672 fazcbcs_record.last_mass_copy_period_counter,
673 fazcbcs_record.last_period_counter,
674 fazcbcs_record.last_purge_period_counter,
675 fazcbcs_record.mass_copy_source_book,
676 fazcbcs_record.mass_request_id,
677 fazcbcs_record.nbv_amount_threshold,
678 fazcbcs_record.nbv_fraction_threshold,
679 fazcbcs_record.nbv_retired_gain_acct,
680 fazcbcs_record.nbv_retired_loss_acct,
681 fazcbcs_record.proceeds_of_sale_clearing_acct,
682 fazcbcs_record.proceeds_of_sale_gain_acct,
683 fazcbcs_record.proceeds_of_sale_loss_acct,
684 fazcbcs_record.revalue_on_retirement_flag,
685 fazcbcs_record.reval_deprn_reserve_flag,
686 fazcbcs_record.reval_rsv_retired_gain_acct,
687 fazcbcs_record.reval_rsv_retired_loss_acct,
688 fazcbcs_record.deprn_adjustment_acct,
689 fazcbcs_record.immediate_copy_flag,
690 fazcbcs_record.je_deprn_adjustment_category,
691 fazcbcs_record.depr_first_year_ret_flag,
692 fazcbcs_record.flexbuilder_defaults_ccid,
693 fazcbcs_record.retire_reval_reserve_flag,
694 fazcbcs_record.use_current_nbv_for_deprn,
695 fazcbcs_record.copy_additions_flag,
696 fazcbcs_record.use_percent_salvage_value_flag,
697 fazcbcs_record.reval_posting_flag,
698 fazcbcs_record.global_attribute1,
699 fazcbcs_record.global_attribute2,
700 fazcbcs_record.global_attribute3,
701 fazcbcs_record.global_attribute4,
702 fazcbcs_record.global_attribute5,
703 fazcbcs_record.global_attribute6,
704 fazcbcs_record.global_attribute7,
705 fazcbcs_record.global_attribute8,
706 fazcbcs_record.global_attribute9,
707 fazcbcs_record.global_attribute10,
708 fazcbcs_record.global_attribute11,
709 fazcbcs_record.global_attribute12,
710 fazcbcs_record.global_attribute13,
711 fazcbcs_record.global_attribute14,
712 fazcbcs_record.global_attribute15,
713 fazcbcs_record.global_attribute16,
714 fazcbcs_record.global_attribute17,
715 fazcbcs_record.global_attribute18,
716 fazcbcs_record.global_attribute19,
717 fazcbcs_record.global_attribute20,
718 fazcbcs_record.global_attribute_category,
719 fazcbcs_record.mc_source_flag,
720 fazcbcs_record.reval_ytd_deprn_flag,
721 fazcbcs_record.allow_cip_assets_flag,
722 fazcbcs_record.org_id,
723 fazcbcs_record.allow_group_deprn_flag,
724 fazcbcs_record.allow_cip_dep_group_flag,
725 fazcbcs_record.allow_interco_group_flag,
726 fazcbcs_record.copy_group_addition_flag,
727 fazcbcs_record.copy_group_assignment_flag,
728 --added for fapost minor enhancement start
729 fazcbcs_record.INTERCOMPANY_POSTING_FLAG
730 --added for fapost minor enhancement end
731 FROM fa_book_controls_mrc_v
732 WHERE book_type_code = X_book;
733 else
734 fazcbcs_record := fazcbc_record;
735 end if;
736
737 fazcbcs_table(fazcbcs_table.count + 1):= fazcbcs_record;
738 fazcbcs_index := fazcbcs_table.count;
739
740 end if;
741 end if;
742
743 return (TRUE);
744
745 exception
746 when NO_DATA_FOUND then
747 fa_srvr_msg.add_message(calling_fn => NULL,
748 name => 'FA_CACHE_MC_BOOK_CONTROLS',
749 token1 => 'BOOK',
750 value1 => X_book,
751 token2 => 'SET_OF_BOOKS_ID',
752 value2 => h_set_of_books_id
753 ,p_log_level_rec => p_log_level_rec);
754 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcbcs'
755 ,p_log_level_rec => p_log_level_rec);
756 return (FALSE);
757 when others then
758 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcbcs'
759 ,p_log_level_rec => p_log_level_rec);
760 return (FALSE);
761
762 end FAZCBCS;
763
764
765
766 Function fazcbc_clr
767 (X_book in varchar2,
768 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
769 return boolean is
770
771 l_count number;
772
773 BEGIN <<fazcbc_clr>>
774
775 -- clear the record
776 fazcbc_record.book_type_code := 'NULL';
777
778 -- clear the member in the table. since the cache should always
779 -- be called before doing this (i.e. faxcps) we know the global
780 -- index variable will have the correct index from fazcbc
781
782 -- correction on the above - this is not necessarily true
783 -- since we're proatviely clearing it in query_balances
784 -- in the client interface to prevent stale data in the
785 -- last period counter
786
787 if nvl(fazcbc_index, 0) > 0 then
788
789 fazcbc_table.delete(fazcbc_index);
790
791 -- reset the values so there is no missing member for future use
792 l_count := fazcbc_table.count;
793
794 for i in fazcbc_index..l_count loop
795 -- copy the next member into the current one
796 fazcbc_table(i) := fazcbc_table(i+1);
797 end loop;
798
799 -- delete the last member in the array which is now a duplicate
800 fazcbc_table.delete(l_count + 1);
801 end if;
802
803 fazcbcs_record.book_type_code := 'NULL';
804
805 if nvl(fazcbcs_index, 0) > 0 then
806
807 fazcbcs_table.delete(fazcbcs_index);
808
809 -- reset the values so there is no missing member for future use
810 l_count := fazcbcs_table.count;
811
812 for i in fazcbcs_index..l_count loop
813 -- copy the next member into the current one
814 fazcbcs_table(i) := fazcbcs_table(i+1);
815 end loop;
816
817 -- delete the last member in the array which is now a duplicate
818 fazcbcs_table.delete(l_count + 1);
819 end if;
820
821 return TRUE;
822
823 exception
824 when others then
825 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcbc_clr'
826 ,p_log_level_rec => p_log_level_rec);
827 return (FALSE);
828
829 END fazcbc_clr;
830
831
832 Function fazcct
833 (X_calendar in varchar2,
834 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
835 return boolean is
836
837 l_found boolean;
838 l_count number;
839
840 begin <<FAZCCT>>
841 if nvl(fazcct_record.calendar_type, 'NULL') = X_calendar then
842 return true;
843 else
844
845 if fazcct_table.count = 0 then
846 l_found := FALSE;
847 end if;
848
849 for i in 1..fazcct_table.count loop
850
851 if (fazcct_table(i).calendar_type = X_calendar) then
852 l_found := TRUE;
853 l_count := i;
854 exit;
855 else
856 l_found := FALSE;
857 end if;
858
859 end loop;
860
861 if l_found = TRUE then
862 fazcct_record := fazcct_table(l_count);
863 else
864 SELECT *
865 INTO fazcct_record
866 FROM fa_calendar_types
867 WHERE calendar_type = X_calendar;
868
869 fazcct_table(fazcct_table.count + 1):= fazcct_record;
870
871 end if;
872 end if;
873
874 return (TRUE);
875
876 exception
877 when NO_DATA_FOUND then
878 fa_srvr_msg.add_message(calling_fn => NULL,
879 name => 'FA_CACHE_CALENDAR_TYPES',
880 token1 => 'CALENDAR',
881 value1 => X_calendar
882 ,p_log_level_rec => p_log_level_rec);
883 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcct'
884 ,p_log_level_rec => p_log_level_rec);
885 return (FALSE);
886
887 when others then
888 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcct'
889 ,p_log_level_rec => p_log_level_rec);
890 return (FALSE);
891
892 end FAZCCT;
893
894
895 Function fazcff
896 (X_calendar varchar2,
897 X_book varchar2,
898 X_fy integer,
899 X_period_fracs out NOCOPY fa_std_types.table_fa_cp_struct,
900 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
901 return boolean is
902
903 l_count number;
904 l_period number;
905 l_found boolean;
906
907 h_fiscal_year_name varchar2(30);
908 h_deprn_alloc_code varchar2(30);
909 h_pers_per_yr integer(5);
910
911 CURSOR FAZCFF_CURSOR IS
912 SELECT decode (substr(h_deprn_alloc_code,1,1),
913 'E', 1.0 / h_pers_per_yr,
914 (cp.end_date + 1 - cp.start_date) /
915 (fy.end_date + 1 - fy.start_date)),
916 to_number (to_char (cp.start_date, 'J')),
917 to_number (to_char (cp.end_date, 'J'))
918 FROM fa_calendar_periods cp, fa_fiscal_year fy
919 WHERE fy.fiscal_year = X_fy
920 AND fy.fiscal_year_name = h_fiscal_year_name
921 AND cp.calendar_type = X_calendar
922 AND cp.start_date BETWEEN fy.start_date AND fy.end_date
923 AND cp.end_date BETWEEN fy.start_date AND fy.end_date
924 ORDER BY period_num;
925
926 begin <<FAZCFF>>
927
928 -- NOTE: the internal fazcff table is indexed starting at 1
929 -- the out paramter starts at 0!!!!
930
931 if fazcff_table.count = 0 then
932 l_found := FALSE;
933 end if;
934
935 for i in 1..fazcff_table.count loop
936 -- find first match which is the first period of the year
937 if (fazcff_table(i).book_type_code = X_book and
938 fazcff_table(i).calendar_type = X_calendar and
939 fazcff_table(i).fiscal_year = X_fy) then
940 l_count := i;
941 l_found := TRUE;
942 exit;
943 else
944 l_found := FALSE;
945 end if;
946 end loop;
947
948 -- Get number of periods per year
949 if not fazcct (X_calendar,
950 p_log_level_rec => p_log_level_rec) then
951 fa_srvr_msg.add_message(calling_fn => 'fa_cache_pkg.fazcff'
952 ,p_log_level_rec => p_log_level_rec);
953 return (FALSE);
954 end if;
955
956 h_pers_per_yr := fazcct_record.number_per_fiscal_year;
957
958 if l_found = TRUE then
959
960 -- init l_period which is used for output struct to 0
961 l_period := 0;
962 for x in l_count..l_count + h_pers_per_yr - 1 loop
963 X_period_fracs(l_period).frac := fazcff_table(x).frac;
964 X_period_fracs(l_period).start_jdate := fazcff_table(x).start_jdate;
965 X_period_fracs(l_period).end_jdate := fazcff_table(x).end_jdate;
966 l_period := l_period + 1;
967 end loop;
968 else
969
970 /* will implement this later for this cache type in order
971 * to prevent the pl/sql table from getting to big
972 * logic should delete all rows for the book/cal/fy combo
973 * though this may get tricky and we might need to bump max_size
974
975 -- do not let array get to big.. once it is at the
976 -- max begin clearing values from the array
977 if fazcff_table.count >= G_max_array_size then
978
979 -- get the first record
980
981 -- clear the first record
982 fazcff_record.book_type_code := 'NULL';
983
984 -- clear the first member in the table
985 fazcff_table.delete(1);
986
987 -- reset values so there is no missing member for future use
988 l_count := fazcff_table.count;
989
990 for i in 1..l_count loop
991 -- copy the next member into the current one
992 fazcff_table(i) := fazcff_table(i+1);
993 end loop;
994
995 -- delete the last member in the array which is now a duplicate
996 fazcff_table.delete(l_count + 1);
997
998 end if;
999 */
1000
1001 -- Get fiscal year name (book cache should already be loaded)
1002
1003 h_fiscal_year_name := fazcbc_record.fiscal_year_name;
1004 h_deprn_alloc_code := fazcbc_record.deprn_allocation_code;
1005
1006 OPEN FAZCFF_CURSOR;
1007 for ctr in 0..h_pers_per_yr-1 loop
1008 FETCH FAZCFF_CURSOR
1009 INTO X_period_fracs(ctr).frac,
1010 X_period_fracs(ctr).start_jdate,
1011 X_period_fracs(ctr).end_jdate;
1012
1013 fazcff_table(fazcff_table.count + 1).book_type_code := X_book;
1014 fazcff_table(fazcff_table.count).calendar_type := X_calendar;
1015 fazcff_table(fazcff_table.count).fiscal_year := X_fy;
1016 fazcff_table(fazcff_table.count).frac := X_period_fracs(ctr).frac;
1017 fazcff_table(fazcff_table.count).start_jdate := X_period_fracs(ctr).start_jdate;
1018 fazcff_table(fazcff_table.count).end_jdate := X_period_fracs(ctr).end_jdate;
1019
1020 end loop;
1021
1022 if FAZCFF_CURSOR%ROWCOUNT = 0 then
1023 CLOSE FAZCFF_CURSOR;
1024 raise NO_DATA_FOUND;
1025 end if;
1026
1027 CLOSE FAZCFF_CURSOR;
1028 end if;
1029
1030 return (TRUE);
1031
1032 Exception
1033 when NO_DATA_FOUND then
1034 fa_srvr_msg.add_message(calling_fn => NULL,
1035 name => 'FA_CACHE_CALENDAR_FRAC',
1036 token1 => 'CALENDAR',
1037 value1 => X_calendar,
1038 token2 => 'BOOK',
1039 value2 => X_book,
1040 token3 => 'FY',
1041 value3 => X_fy
1042 ,p_log_level_rec => p_log_level_rec);
1043 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcff'
1044 ,p_log_level_rec => p_log_level_rec);
1045 return (FALSE);
1046 when others then
1047 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcff'
1048 ,p_log_level_rec => p_log_level_rec);
1049 return (FALSE);
1050
1051 end FAZCFF;
1052
1053
1054 Function fazccl
1055 (X_target_ceiling_name varchar2,
1056 X_target_jdate integer,
1057 X_target_year integer,
1058 X_ceiling out NOCOPY number,
1059 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
1060 return boolean is
1061
1062 l_found boolean;
1063 l_count number;
1064
1065 begin <<FAZCCL>>
1066
1067 if (nvl(fazccl_record.t_ceiling_name, 'NULL') = X_target_ceiling_name and
1068 nvl(fazccl_record.t_jdate, -1) = X_target_jdate and
1069 nvl(fazccl_record.t_year, -1) = X_target_year) then
1070 X_ceiling := fazccl_record.ceiling;
1071 return (TRUE);
1072 else
1073 if fazccl_table.count = 0 then
1074 l_found := FALSE;
1075 end if;
1076
1077 for i in 1..fazccl_table.count loop
1078
1079 if (nvl(fazccl_table(i).t_ceiling_name, 'NULL') = X_target_ceiling_name and
1080 nvl(fazccl_table(i).t_jdate, -1) = X_target_jdate and
1081 nvl(fazccl_table(i).t_year, -1) = X_target_year) then
1082 l_found := TRUE;
1083 l_count := i;
1084 exit;
1085 else
1086 l_found := FALSE;
1087 end if;
1088 end loop;
1089
1090 if l_found = TRUE then
1091 fazccl_record := fazccl_table(l_count);
1092 else
1093 SELECT cur_one.limit
1094 INTO fazccl_record.ceiling
1095 FROM fa_ceilings cur_one,
1096 fa_ceilings this_one,
1097 fa_ceilings next_one
1098 WHERE cur_one.ceiling_name = X_target_ceiling_name
1099 AND this_one.ceiling_name = X_target_ceiling_name
1100 AND next_one.ceiling_name (+) = X_target_ceiling_name
1101 AND to_date (X_target_jdate, 'J') BETWEEN
1102 cur_one.start_date AND
1103 nvl (cur_one.end_date, to_date (X_target_jdate, 'J'))
1104 AND to_date (X_target_jdate, 'J') BETWEEN
1105 this_one.start_date AND
1106 nvl (this_one.end_date, to_date (X_target_jdate, 'J'))
1107 AND to_date (X_target_jdate, 'J') BETWEEN
1108 next_one.start_date (+) AND
1109 nvl (next_one.end_date (+),
1110 to_date (X_target_jdate, 'J'))
1111 AND X_target_year >= nvl (this_one.year_of_life, 0)
1112 AND nvl (cur_one.year_of_life, 0) < next_one.year_of_life (+)
1113 GROUP BY cur_one.limit, cur_one.year_of_life,
1114 cur_one.start_date, cur_one.end_date
1115 HAVING nvl (cur_one.year_of_life, 0) =
1116 nvl (max (this_one.year_of_life), 0);
1117
1118 fazccl_record.t_ceiling_name := X_target_ceiling_name;
1119 fazccl_record.t_jdate := X_target_jdate;
1120 fazccl_record.t_year := X_target_year;
1121 fazccl_table(fazccl_table.count + 1) := fazccl_record;
1122
1123 end if;
1124 end if;
1125
1126 X_ceiling := fazccl_record.ceiling;
1127 return (TRUE);
1128
1129 Exception
1130 when no_data_found then
1131 X_ceiling := 1000000000000.00;
1132 return (TRUE);
1133 when others then
1134 fa_srvr_msg.add_sql_error (calling_fn => 'fa_cache_pkg.fazccl'
1135 ,p_log_level_rec => p_log_level_rec);
1136 return (FALSE);
1137
1138 end FAZCCL;
1139
1140
1141 Function fazcbr
1142 (X_target_bonus_rule varchar2,
1143 X_target_year number,
1144 X_bonus_rate out NOCOPY number,
1145 X_deprn_factor out NOCOPY number,
1146 X_alternate_deprn_factor out NOCOPY number,
1147 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
1148 return boolean is
1149
1150 l_found boolean;
1151 l_count number;
1152
1153 begin <<FAZCBR>>
1154
1155 if (nvl(fazcbr_record.t_bonus_rule, 'NULL') = X_target_bonus_rule and
1156 fazcbr_record.t_year = X_target_year) then
1157 X_bonus_rate := fazcbr_record.bonus_rate;
1158 X_deprn_factor := fazcbr_record.deprn_factor;
1159 X_alternate_deprn_factor := fazcbr_record.alternate_deprn_factor;
1160 return (TRUE);
1161 else
1162 if fazcbr_table.count = 0 then
1163 l_found := FALSE;
1164 end if;
1165
1166 for i in 1..fazcbr_table.count loop
1167
1168 if (fazcbr_table(i).t_bonus_rule = X_target_bonus_rule and
1169 fazcbr_table(i).t_year = X_target_year) then
1170 l_count := i;
1171 l_found := TRUE;
1172 exit;
1173 else
1174 l_found := FALSE;
1175 end if;
1176 end loop;
1177
1178 if l_found = TRUE then
1179 fazcbr_record := fazcbr_table(l_count);
1180 else
1181
1182 SELECT bonus_rate,
1183 deprn_factor,
1184 alternate_deprn_factor
1185 INTO fazcbr_record.bonus_rate,
1186 fazcbr_record.deprn_factor,
1187 fazcbr_record.alternate_deprn_factor
1188 FROM fa_bonus_rates
1189 WHERE bonus_rule = X_target_bonus_rule
1190 AND X_target_year BETWEEN
1191 start_year AND nvl (end_year, X_target_year);
1192
1193 fazcbr_record.t_bonus_rule := X_target_bonus_rule;
1194 fazcbr_record.t_year := X_target_year;
1195 fazcbr_table(fazcbr_table.count + 1):= fazcbr_record;
1196
1197 end if;
1198 end if;
1199
1200 X_bonus_rate := fazcbr_record.bonus_rate;
1201 X_deprn_factor := fazcbr_record.deprn_factor;
1202 X_alternate_deprn_factor := fazcbr_record.alternate_deprn_factor;
1203
1204 return (TRUE);
1205
1206 Exception
1207 when no_data_found then
1208 X_bonus_rate := 0;
1209 X_deprn_factor := 0;
1210 X_alternate_deprn_factor := 0;
1211
1212 return (TRUE);
1213 when others then
1214 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcbr'
1215 ,p_log_level_rec => p_log_level_rec);
1216 return (FALSE);
1217
1218 end FAZCBR;
1219
1220
1221 Function fazccp
1222 (X_target_calendar varchar2,
1223 X_target_fy_name varchar2,
1224 X_target_jdate number,
1225 X_period_num in out NOCOPY number,
1226 X_fiscal_year in out NOCOPY number,
1227 X_start_jdate in out NOCOPY number,
1228 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
1229 return boolean is
1230
1231 x_target_date date;
1232 l_found boolean;
1233 l_count number;
1234
1235 begin <<FAZCCP>>
1236
1237 if (fazccp_record.t_calendar = X_target_calendar and
1238 fazccp_record.t_fy_name = X_target_fy_name and
1239 fazccp_record.t_jdate = X_target_jdate) then
1240 X_period_num := fazccp_record.period_num;
1241 X_fiscal_year := fazccp_record.fiscal_year;
1242 X_start_jdate := fazccp_record.start_jdate;
1243 return (TRUE);
1244 else
1245 if fazccp_table.count = 0 then
1246 l_found := FALSE;
1247 end if;
1248
1249 for i in 1..fazccp_table.count loop
1250 if (fazccp_table(i).t_calendar = X_target_calendar and
1251 fazccp_table(i).t_fy_name = X_target_fy_name and
1252 fazccp_table(i).t_jdate = X_target_jdate) then
1253 l_found := TRUE;
1254 l_count := i;
1255 exit;
1256 else
1257 l_found := FALSE;
1258 end if;
1259
1260 end loop;
1261
1262 if l_found = TRUE then
1263 fazccp_record := fazccp_table(l_count);
1264 else
1265 x_target_date := to_date (to_char (X_target_jdate), 'J');
1266
1267 SELECT to_number (to_char (cp.start_date, 'J')),
1268 cp.period_num,
1269 fy.fiscal_year
1270 INTO fazccp_record.start_jdate,
1271 fazccp_record.period_num,
1272 fazccp_record.fiscal_year
1273 FROM fa_calendar_periods cp,
1274 fa_fiscal_year fy
1275 WHERE fy.fiscal_year_name = X_target_fy_name
1276 AND cp.calendar_type = X_target_calendar
1277 AND x_target_date between fy.start_date and fy.end_date
1278 AND cp.start_date between fy.start_date and fy.end_date
1279 AND cp.end_date between fy.start_date and fy.end_date
1280 AND x_target_date between cp.start_date and cp.end_date;
1281
1282 fazccp_record.t_calendar := X_target_calendar;
1283 fazccp_record.t_fy_name := X_target_fy_name;
1284 fazccp_record.t_jdate := X_target_jdate;
1285 fazccp_table(fazccp_table.count + 1):= fazccp_record;
1286 end if;
1287 end if;
1288
1289 X_period_num := fazccp_record.period_num;
1290 X_fiscal_year := fazccp_record.fiscal_year;
1291 X_start_jdate := fazccp_record.start_jdate;
1292 return (TRUE);
1293
1294 exception
1295 when NO_DATA_FOUND then
1296 fa_srvr_msg.add_message(calling_fn => NULL,
1297 name => 'FA_CACHE_CALENDAR_PERIODS',
1298 token1 => 'CALENDAR',
1299 value1 => X_target_calendar,
1300 token2 => 'FY_NAME',
1301 value2 => X_target_fy_name,
1302 token3 => 'DATE',
1303 value3 => X_target_date
1304 ,p_log_level_rec => p_log_level_rec);
1305 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazccp'
1306 ,p_log_level_rec => p_log_level_rec);
1307 return (FALSE);
1308 when others then
1309 fa_srvr_msg.add_sql_error ( calling_fn => 'fa_cache_pkg.fazccp'
1310 ,p_log_level_rec => p_log_level_rec);
1311 return (FALSE);
1312
1313 end FAZCCP;
1314
1315 function fazccb
1316 (X_book in varchar2,
1317 X_cat_id in number,
1318 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
1319 return boolean is
1320
1321 l_found boolean;
1322 l_count number;
1323
1324 begin <<FAZCCB>>
1325
1326 if (fazccb_record.book_type_code = X_book and
1327 fazccb_record.category_id = X_cat_id) then
1328 return (TRUE);
1329 else
1330 if fazccb_table.count = 0 then
1331 l_found := FALSE;
1332 end if;
1333
1334 for i in 1..fazccb_table.count loop
1335
1336 if (fazccb_table(i).book_type_code = X_book and
1337 fazccb_table(i).category_id = X_cat_id) then
1338 l_count := i;
1339 l_found := TRUE;
1340 exit;
1341 else
1342 l_found := FALSE;
1343 end if;
1344
1345 end loop;
1346
1347 if l_found = TRUE then
1348 fazccb_record := fazccb_table(l_count);
1349 else
1350 SELECT *
1351 INTO fazccb_record
1352 FROM fa_category_books
1353 WHERE book_type_code = X_book
1354 AND category_id = X_cat_id;
1355
1356 fazccb_table(fazccb_table.count + 1):= fazccb_record;
1357
1358 end if;
1359
1360 end if;
1361
1362 return (TRUE);
1363
1364 exception
1365 when NO_DATA_FOUND then
1366 fa_srvr_msg.add_message(calling_fn => NULL,
1367 name => 'FA_CACHE_CATEGORY_BOOKS',
1368 token1 => 'CATEGORY_ID',
1369 value1 => X_cat_id,
1370 token2 => 'BOOK',
1371 value2 => X_book
1372 ,p_log_level_rec => p_log_level_rec);
1373 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazccb'
1374 ,p_log_level_rec => p_log_level_rec);
1375 return (FALSE);
1376 when others then
1377 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazccb'
1378 ,p_log_level_rec => p_log_level_rec);
1379 return (FALSE);
1380
1381 end fazccb;
1382
1383 --------------------------------------------------------------------------
1384
1385 Function fazccmt
1386 (X_method varchar2,
1387 X_life integer,
1388 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
1389 return boolean is
1390
1391 l_found boolean;
1392 l_count number;
1393 l_table_name varchar2(15);
1394
1395 begin
1396
1397 if (nvl(fazccmt_record.method_code, '-NULL') = X_method and
1398 nvl(fazccmt_record.life_in_months, -99) = nvl(X_life, -99)) then
1399 return true;
1400 else
1401
1402 l_table_name := 'METHODS';
1403
1404 if fazccmt_table.count = 0 then
1405 l_found := FALSE;
1406 end if;
1407
1408 for i in 1..fazccmt_table.count loop
1409
1410 if (fazccmt_table(i).method_code = X_method and
1411 nvl(fazccmt_table(i).life_in_months, -99) = nvl(X_life, -99)) then
1412 l_count := i;
1413 l_found := TRUE;
1414 exit;
1415 else
1416 l_found := FALSE;
1417 end if;
1418
1419 end loop;
1420
1421 if l_found = TRUE then
1422
1423 fazccmt_record := fazccmt_table(l_count);
1424
1425 else
1426
1427 -- Performance issue.
1428 -- Split into different selects to use index better
1429
1430 if (X_life is not null and X_life <> 0) then
1431
1432 SELECT *
1433 INTO fazccmt_record
1434 FROM fa_methods
1435 WHERE method_code = X_method
1436 AND life_in_months = X_life;
1437
1438 else
1439
1440 SELECT *
1441 INTO fazccmt_record
1442 FROM fa_methods
1443 WHERE method_code = X_method
1444 AND (life_in_months is null OR
1445 life_in_months = 0);
1446
1447 end if;
1448
1449 if (fazccmt_record.deprn_basis_rule_id is null) then
1450 fazccmt_record.deprn_basis_rule_id := 0;
1451 end if;
1452
1453 fazccmt_table(fazccmt_table.count + 1) := fazccmt_record;
1454
1455 end if;
1456 end if;
1457
1458 -- load fa_formulas if formula based asset
1459 if (fazccmt_record.rate_source_rule = 'FORMULA') then
1460 if (fazccmt_record.method_id = nvl(fazcfor_record.method_id, -99)) then
1461 -- return true;
1462 null; -- keep what is in the fazcfor cache
1463 else
1464 l_table_name := 'FORMULAS';
1465
1466 if fazcfor_table.count = 0 then
1467 l_found := FALSE;
1468 end if;
1469
1470 for i in 1..fazcfor_table.count loop
1471 if (fazcfor_table(i).method_id = fazccmt_record.method_id) then
1472
1473 l_count := i;
1474 l_found := TRUE;
1475 exit;
1476 else
1477 l_found := FALSE;
1478 end if;
1479 end loop;
1480
1481 if l_found = TRUE then
1482
1483 fazcfor_record := fazcfor_table(l_count);
1484
1485 else
1486 select *
1487 into fazcfor_record
1488 from fa_formulas
1489 where method_id = fazccmt_record.method_id;
1490
1491 fazcfor_table(fazcfor_table.count + 1) := fazcfor_record;
1492 end if;
1493 end if;
1494 else
1495 -- Not a formula method, so make sure everything is null
1496 fazcfor_record.method_id := null;
1497 fazcfor_record.formula_actual := null;
1498 fazcfor_record.formula_displayed := null;
1499 fazcfor_record.formula_parsed := null;
1500 end if;
1501
1502 -- now find and load the deprn basis rules
1503 if (fazcdbr_record.deprn_basis_rule_id= nvl(fazccmt_record.deprn_basis_rule_id, 0)) then
1504 return true;
1505 else
1506 l_table_name := 'RULES';
1507
1508 if fazcdbr_table.count = 0 then
1509 l_found := FALSE;
1510 end if;
1511
1512 for j in 1..fazcdbr_table.count loop
1513 if fazcdbr_table(j).deprn_basis_rule_id = nvl(fazccmt_record.deprn_basis_rule_id, 0) then
1514 l_count := j;
1515 l_found := TRUE;
1516 exit;
1517 else
1518 l_found := FALSE;
1519 end if;
1520 end loop;
1521
1522 if l_found = TRUE then
1523 fazcdbr_record := fazcdbr_table(l_count);
1524 else
1525
1526 if (fazccmt_record.deprn_basis_rule_id = 0) then
1527 fazcdbr_record.deprn_basis_rule_id := 0;
1528 fazcdbr_record.rule_name := null;
1529 fazcdbr_record.user_rule_name := null;
1530 fazcdbr_record.rate_source := null;
1531 fazcdbr_record.deprn_basis := null;
1532 fazcdbr_record.enabled_flag := null;
1533 fazcdbr_record.program_name := null;
1534 fazcdbr_record.polish_rule :=
1535 FA_STD_TYPES.FAD_DBR_POLISH_NONE;
1536 else
1537 select deprn_basis_rule_id,
1538 rule_name,
1539 user_rule_name,
1540 last_update_date,
1541 last_updated_by,
1542 created_by,
1543 creation_date,
1544 last_update_login,
1545 rate_source,
1546 deprn_basis,
1547 enabled_flag,
1548 program_name,
1549 description
1550 into fazcdbr_record.deprn_basis_rule_id,
1551 fazcdbr_record.rule_name,
1552 fazcdbr_record.user_rule_name,
1553 fazcdbr_record.last_update_date,
1554 fazcdbr_record.last_updated_by,
1555 fazcdbr_record.created_by,
1556 fazcdbr_record.creation_date,
1557 fazcdbr_record.last_update_login,
1558 fazcdbr_record.rate_source,
1559 fazcdbr_record.deprn_basis,
1560 fazcdbr_record.enabled_flag,
1561 fazcdbr_record.program_name,
1562 fazcdbr_record.description
1563 from fa_deprn_basis_rules
1564 where deprn_basis_rule_id = fazccmt_record.deprn_basis_rule_id;
1565 end if;
1566
1567 -- Determine the Polish Rule
1568 if (fazcdbr_record.rule_name =
1569 'POLISH 30% WITH A SWITCH TO DECLINING CLASSICAL AND FLAT RATE') then
1570 -- Polish Mechanism 1
1571 fazcdbr_record.polish_rule := FA_STD_TYPES.FAD_DBR_POLISH_1;
1572 elsif (fazcdbr_record.rule_name =
1573 'POLISH 30% WITH A SWITCH TO FLAT RATE') then
1574 -- Polish Mechanism 2
1575 fazcdbr_record.polish_rule := FA_STD_TYPES.FAD_DBR_POLISH_2;
1576 elsif (fazcdbr_record.rule_name =
1577 'POLISH DECLINING MODIFIED WITH A SWITCH TO DECLINING CLASSICAL AND FLAT RATE' ) then
1578 -- Polish Mechanism 3
1579 fazcdbr_record.polish_rule := FA_STD_TYPES.FAD_DBR_POLISH_3;
1580 elsif (fazcdbr_record.rule_name =
1581 'POLISH DECLINING MODIFIED WITH A SWITCH TO FLAT RATE') then
1582 -- Polish Mechanism 4
1583 fazcdbr_record.polish_rule := FA_STD_TYPES.FAD_DBR_POLISH_4;
1584 elsif (fazcdbr_record.rule_name =
1585 'POLISH STANDARD DECLINING WITH A SWITCH TO FLAT RATE') then
1586 -- Polish Mechansism 5
1587 fazcdbr_record.polish_rule := FA_STD_TYPES.FAD_DBR_POLISH_5;
1588 else
1589 -- No Polish Mechanism
1590 fazcdbr_record.polish_rule := FA_STD_TYPES.FAD_DBR_POLISH_NONE;
1591 end if;
1592
1593 fazcdbr_table(fazcdbr_table.count + 1) := fazcdbr_record;
1594 end if;
1595 end if;
1596
1597 -- now find and load the deprn basis rule details
1598 if (fazcdrd_record.deprn_basis_rule_id = nvl(fazccmt_record.deprn_basis_rule_id, 0))
1599 and fazcdrd_record.rate_source_rule = fazccmt_record.rate_source_rule
1600 and fazcdrd_record.deprn_basis_rule = fazccmt_record.deprn_basis_rule
1601 then
1602 return true;
1603
1604 else
1605 l_table_name := 'RULE_DETAILS';
1606
1607 if fazcdrd_table.count =0 then
1608 l_found := FALSE;
1609 end if;
1610
1611 for k in 1..fazcdrd_table.count loop
1612 if nvl(fazcdrd_table(k).deprn_basis_rule_id,0) = nvl(fazccmt_record.deprn_basis_rule_id, 0)
1613 and fazcdrd_table(k).rate_source_rule = fazccmt_record.rate_source_rule
1614 and fazcdrd_table(k).deprn_basis_rule = fazccmt_record.deprn_basis_rule then
1615 l_count := k;
1616 l_found := TRUE;
1617 exit;
1618 else
1619 l_found := FALSE;
1620 end if;
1621 end loop;
1622
1623 if l_found = TRUE then
1624 fazcdrd_record := fazcdrd_table(l_count);
1625 else
1626
1627 if (fazccmt_record.deprn_basis_rule_id = 0) then
1628 -- For FA_DEPRN_RULE_DETAILS
1629 fazcdrd_record.deprn_rule_detail_id := 0;
1630 fazcdrd_record.deprn_basis_rule_id := 0;
1631 fazcdrd_record.rule_name := null;
1632 fazcdrd_record.rate_source_rule := null;
1633 fazcdrd_record.deprn_basis_rule := null;
1634 fazcdrd_record.asset_type := null;
1635 fazcdrd_record.period_update_flag := null;
1636 fazcdrd_record.subtract_ytd_flag := null;
1637 fazcdrd_record.allow_reduction_rate_flag := null;
1638 fazcdrd_record.use_eofy_reserve_flag := null;
1639 else
1640
1641 select *
1642 into fazcdrd_record
1643 from fa_deprn_rule_details
1644 where deprn_basis_rule_id = fazccmt_record.deprn_basis_rule_id
1645 and rate_source_rule = fazccmt_record.rate_source_rule
1646 and deprn_basis_rule = fazccmt_record.deprn_basis_rule;
1647 end if;
1648
1649 fazcdrd_table(fazcdrd_table.count + 1) := fazcdrd_record;
1650
1651 end if; -- End l_found
1652 end if; -- End FA_DEPRN_RULE_DETAILS
1653
1654 return (TRUE);
1655
1656 exception
1657 when NO_DATA_FOUND then
1658 if (l_table_name = 'METHODS')then
1659 fa_srvr_msg.add_message(calling_fn => NULL,
1660 name => 'FA_CACHE_METHODS',
1661 token1 => 'METHOD',
1662 value1 => X_method,
1663 token2 => 'LIFE',
1664 value2 => X_life
1665 ,p_log_level_rec => p_log_level_rec);
1666 else
1667 fa_srvr_msg.add_message(calling_fn => NULL,
1668 name => 'FA_CACHE_DEPRN_BASIS_RULES',
1669 token1 => 'RULE_ID',
1670 value1 => fazccmt_record.deprn_basis_rule_id
1671 ,p_log_level_rec => p_log_level_rec);
1672 end if;
1673
1674 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazccmt'
1675 ,p_log_level_rec => p_log_level_rec);
1676 return (FALSE);
1677
1678 when others then
1679 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazccmt'
1680 ,p_log_level_rec => p_log_level_rec);
1681 return (False);
1682
1683 end FAZCCMT;
1684
1685 --------------------------------------------------------------
1686
1687 -- sob_book_type_code
1688 function fazcsob
1689 (X_set_of_books_id in number,
1690 X_mrc_sob_type_code out NOCOPY varchar,
1691 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
1692 return boolean is
1693
1694 l_found boolean;
1695 l_count number;
1696
1697 begin
1698
1699 if (nvl(fazcsob_record.set_of_books_id, -1) = X_set_of_books_id) then
1700 X_mrc_sob_type_code := fazcsob_record.mrc_sob_type_code;
1701 return (TRUE);
1702 else
1703 if fazcsob_table.count = 0 then
1704 l_found := FALSE;
1705 end if;
1706
1707 for i in 1..fazcsob_table.count loop
1708
1709 if (fazcsob_table(i).set_of_books_id = X_set_of_books_id) then
1710 l_count := i;
1711 l_found := TRUE;
1712 exit;
1713 else
1714 l_found := FALSE;
1715 end if;
1716
1717 end loop;
1718
1719 if l_found = TRUE then
1720 X_mrc_sob_type_code := fazcsob_table(l_count).mrc_sob_type_code;
1721 fazcsob_record := fazcsob_table(l_count);
1722 else
1723 SELECT set_of_books_id,
1724 mrc_sob_type_code
1725 INTO fazcsob_record.set_of_books_id,
1726 fazcsob_record.mrc_sob_type_code
1727 FROM gl_sets_of_books
1728 WHERE set_of_books_id = X_set_of_books_id;
1729
1730 fazcsob_table(fazcsob_table.count + 1) := fazcsob_record;
1731 end if;
1732 end if;
1733
1734 X_mrc_sob_type_code := fazcsob_record.mrc_sob_type_code;
1735 return (TRUE);
1736
1737 exception
1738 when NO_DATA_FOUND then
1739 fa_srvr_msg.add_message(calling_fn => NULL,
1740 name => 'FA_CACHE_SETS_OF_BOOKS',
1741 token1 => 'SET_OF_BOOKS_ID',
1742 value1 => X_set_of_books_id
1743 ,p_log_level_rec => p_log_level_rec);
1744 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcsob'
1745 ,p_log_level_rec => p_log_level_rec);
1746 return (FALSE);
1747 when others then
1748 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcsob'
1749 ,p_log_level_rec => p_log_level_rec);
1750 return(FALSE);
1751
1752 end fazcsob;
1753
1754 -------------------------------------------------------------------
1755 FUNCTION fazccbd
1756 (X_book in varchar2,
1757 X_cat_id in number,
1758 X_jdpis in number,
1759 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
1760 return boolean is
1761
1762 l_found boolean;
1763 l_count number;
1764
1765 begin <<FAZCCBD>>
1766
1767 if (fazccbd_record.book_type_code = X_book and
1768 fazccbd_record.category_id = X_cat_id and
1769 fazccbd_record.start_dpis <= to_date(X_jdpis, 'J') and
1770 nvl(fazccbd_record.end_dpis, to_date(X_jdpis, 'J')) >=
1771 to_date(X_jdpis, 'J')) then
1772 return (TRUE);
1773 else
1774 if fazccbd_table.count = 0 then
1775 l_found := FALSE;
1776 end if;
1777
1778 for i in 1..fazccbd_table.count loop
1779
1780 if (fazccbd_table(i).book_type_code = X_book and
1781 fazccbd_table(i).category_id = X_cat_id and
1782 fazccbd_table(i).start_dpis <= to_date(X_jdpis, 'J') and
1783 nvl(fazccbd_table(i).end_dpis, to_date(X_jdpis, 'J')) >=
1784 to_date(X_jdpis, 'J')) then
1785 l_count := i;
1786 l_found := TRUE;
1787 exit;
1788 else
1789 l_found := FALSE;
1790 end if;
1791 end loop;
1792
1793 if l_found = TRUE then
1794 fazccbd_record := fazccbd_table(l_count);
1795 else
1796 -- do not let array get to big.. once it is at the
1797 -- max begin clearing values from the array
1798 if fazccbd_table.count = G_max_array_size then
1799
1800 -- clear the first record
1801 fazccbd_record.book_type_code := 'NULL';
1802
1803 -- clear the first member in the table
1804 fazccbd_table.delete(1);
1805
1806 -- reset values so there is no missing member for future use
1807 l_count := fazccbd_table.count;
1808
1809 for i in 1..l_count loop
1810 -- copy the next member into the current one
1811 fazccbd_table(i) := fazccbd_table(i+1);
1812 end loop;
1813
1814 -- delete the last member in the array which is now a duplicate
1815 fazccbd_table.delete(l_count + 1);
1816
1817 end if;
1818
1819 SELECT *
1820 INTO fazccbd_record
1821 FROM fa_category_book_defaults
1822 WHERE book_type_code = X_book
1823 AND category_id = X_cat_id
1824 AND to_date (X_jdpis, 'J') BETWEEN
1825 start_dpis AND
1826 nvl (end_dpis, to_date (X_jdpis, 'J'));
1827
1828 fazccbd_table(fazccbd_table.count + 1):= fazccbd_record;
1829
1830 end if;
1831 end if;
1832
1833 return (TRUE);
1834
1835 exception
1836 when NO_DATA_FOUND then
1837 fa_srvr_msg.add_message(calling_fn => NULL,
1838 name => 'FA_CACHE_CATEGORY_BOOK_DEF',
1839 token1 => 'BOOK',
1840 value1 => X_book,
1841 token2 => 'CATEGORY_ID',
1842 value2 => X_cat_id,
1843 token3 => 'DATE',
1844 value3 => to_date(X_jdpis, 'J'));
1845 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazccbd'
1846 ,p_log_level_rec => p_log_level_rec);
1847 return (FALSE);
1848
1849 when others then
1850 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazccbd'
1851 ,p_log_level_rec => p_log_level_rec);
1852 return (FALSE);
1853
1854 end fazccbd;
1855
1856
1857
1858 -------------------------------------------------------------------
1859 FUNCTION fazcat
1860 (X_cat_id in number,
1861 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
1862 return boolean is
1863
1864 l_found boolean;
1865 l_count number;
1866
1867 begin <<FAZCAT>>
1868
1869 if (fazcat_record.category_id = X_cat_id) then
1870 return (TRUE);
1871 else
1872 if fazcat_table.count = 0 then
1873 l_found := FALSE;
1874 end if;
1875
1876 for i in 1..fazcat_table.count loop
1877
1878 if (fazcat_table(i).category_id = X_cat_id)then
1879 l_count := i;
1880 l_found := TRUE;
1881 exit;
1882 else
1883 l_found := FALSE;
1884 end if;
1885
1886 end loop;
1887
1888
1889 if l_found = TRUE then
1890 fazcat_record := fazcat_table(l_count);
1891 else
1892 -- do not let array get to big.. once it is at the
1893 -- max begin clearing values from the array
1894 if fazcat_table.count = G_max_array_size then
1895
1896 -- clear the first record
1897 fazcat_record.category_id := NULL;
1898
1899 -- clear the first member in the table
1900 fazcat_table.delete(1);
1901
1902 -- reset values so there is no missing member for future use
1903 l_count := fazcat_table.count;
1904
1905 for i in 1..l_count loop
1906 -- copy the next member into the current one
1907 fazcat_table(i) := fazcat_table(i+1);
1908 end loop;
1909
1910 -- delete the last member in the array which is now a duplicate
1911 fazcat_table.delete(l_count + 1);
1912
1913 end if;
1914
1915 SELECT *
1916 INTO fazcat_record
1917 FROM fa_categories
1918 WHERE category_id = X_cat_id;
1919
1920 fazcat_table(fazcat_table.count + 1):= fazcat_record;
1921
1922 end if;
1923 end if;
1924
1925 return (TRUE);
1926
1927 exception
1928 when NO_DATA_FOUND then
1929 fa_srvr_msg.add_message(calling_fn => NULL,
1930 name => 'FA_CACHE_CATEGORIES',
1931 token1 => 'CATEGORY',
1932 value1 => X_cat_id
1933 ,p_log_level_rec => p_log_level_rec);
1934 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcat'
1935 ,p_log_level_rec => p_log_level_rec);
1936 return (FALSE);
1937
1938 when others then
1939 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcat'
1940 ,p_log_level_rec => p_log_level_rec);
1941 return (FALSE);
1942
1943 end fazcat;
1944
1945 ------------------------------------------------------------------------
1946
1947 Function fazsys return boolean is
1948
1949 begin <<FAZSYS>>
1950
1951 if (fazsys_record.company_name is not null) then
1952 return (TRUE);
1953 else
1954 SELECT *
1955 INTO fazsys_record
1956 FROM fa_system_controls;
1957 end if;
1958
1959 return (TRUE);
1960
1961 exception
1962 when NO_DATA_FOUND then
1963 fa_srvr_msg.add_message(calling_fn => NULL,
1964 name => 'FA_SYSTEM_CONTROLS'
1965 );
1966 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazsys'
1967 );
1968 return (FALSE);
1969
1970 when others then
1971 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazsys'
1972 );
1973 return (FALSE);
1974
1975 end FAZSYS;
1976
1977
1978 ---------------------------------------------------------------------
1979
1980 Function fazctbk
1981 (x_corp_book in varchar2,
1982 x_asset_type in varchar2,
1983 x_tax_book_tbl out NOCOPY fazctbk_tbl_type,
1984 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
1985 return boolean is
1986
1987 l_tax_rec fazctbk_pvt_rec_type;
1988 l_found boolean := FALSE;
1989 l_main_array_count number := fazctbk_main_tbl.count;
1990 l_corp_array_count number := fazctbk_corp_tbl.count;
1991 l_tax_array_count number := fazctbk_tax_tbl.count;
1992
1993 i number := 0;
1994
1995 CURSOR c_tax_books IS
1996 select distribution_source_book,
1997 book_type_code,
1998 nvl(allow_cip_assets_flag, 'NO') allow_cip_assets_flag,
1999 nvl(immediate_copy_flag, 'NO') immediate_copy_flag,
2000 nvl(copy_group_addition_flag, 'N') copy_group_addition_flag
2001 from fa_book_controls
2002 where book_class = 'TAX'
2003 and distribution_source_book = x_corp_book
2004 and date_ineffective is null;
2005
2006 begin <<FAZCTBK>>
2007
2008 -- check if values are the same as the last cobination requested
2009
2010 if ((nvl(fazctbk_last_book_used, 'NULL') = x_corp_book ) and
2011 (nvl(fazctbk_last_type_used, 'NULL') = x_asset_type)) then
2012 x_tax_book_tbl := fazctbk_tax_tbl;
2013 return (TRUE);
2014 else
2015 -- delete the existing return table contents
2016 fazctbk_tax_tbl.delete;
2017 l_tax_array_count := 0;
2018
2019 -- see if the corp book in question has previously been cached
2020 for i in 1..l_corp_array_count loop
2021
2022 if (fazctbk_corp_tbl(i) = x_corp_book) then -- book_type_code
2023 l_found := TRUE;
2024 exit;
2025 else
2026 l_found := FALSE;
2027 end if;
2028
2029 end loop;
2030
2031 if l_found then
2032
2033 -- load the values for this particular asset type and book into return table
2034 for i in 1..fazctbk_main_tbl.count loop
2035 if (((x_asset_type = 'CIP' and
2036 fazctbk_main_tbl(i).allow_cip_assets_flag = 'YES') or
2037 (x_asset_type = 'CAPITALIZED' and
2038 fazctbk_main_tbl(i).immediate_copy_flag = 'YES') or
2039 (x_asset_type = 'GROUP' and
2040 fazctbk_main_tbl(i).copy_group_addition_flag = 'Y' and
2041 fazctbk_main_tbl(i).immediate_copy_flag = 'YES')) and
2042 (fazctbk_main_tbl(i).corp_book = x_corp_book)) then
2043
2044 -- add record to return table
2045 fazctbk_tax_tbl(l_tax_array_count + 1) := fazctbk_main_tbl(i).tax_book; -- book_type_code
2046 l_tax_array_count := l_tax_array_count + 1;
2047 end if;
2048 end loop;
2049
2050 else
2051
2052 -- corp book not been cached before so first get each enabled tax book regardless
2053 -- of auto-copy / cip-intax value into the main table
2054
2055 for c_rec in c_tax_books loop
2056 -- populate the tax record
2057
2058 l_tax_rec.corp_book := c_rec.distribution_source_book;
2059 l_tax_rec.tax_book := c_rec.book_type_code;
2060 l_tax_rec.allow_cip_assets_flag := c_rec.allow_cip_assets_flag;
2061 l_tax_rec.immediate_copy_flag := c_rec.immediate_copy_flag;
2062 l_tax_rec.copy_group_addition_flag := c_rec.copy_group_addition_flag;
2063
2064 -- add record to the main association table
2065 fazctbk_main_tbl(l_main_array_count + 1) := l_tax_rec;
2066 l_main_array_count := l_main_array_count + 1;
2067 end loop;
2068
2069 -- add the corp book to the array of corp book to indicate it's been processed
2070 fazctbk_corp_tbl(l_corp_array_count + 1) := x_corp_book;
2071 l_corp_array_count := l_corp_array_count + 1;
2072
2073
2074 -- load the values for this particular asset type and book into return table
2075 for i in 1..fazctbk_main_tbl.count loop
2076 if (((x_asset_type = 'CIP' and
2077 fazctbk_main_tbl(i).allow_cip_assets_flag = 'YES') or
2078 (x_asset_type = 'CAPITALIZED' and
2079 fazctbk_main_tbl(i).immediate_copy_flag = 'YES') or
2080 (x_asset_type = 'GROUP' and
2081 fazctbk_main_tbl(i).copy_group_addition_flag = 'Y' and
2082 fazctbk_main_tbl(i).immediate_copy_flag = 'YES')) and
2083 (fazctbk_main_tbl(i).corp_book = x_corp_book)) then
2084 -- add record to return table
2085 fazctbk_tax_tbl(l_tax_array_count + 1) := fazctbk_main_tbl(i).tax_book;
2086 l_tax_array_count := l_tax_array_count + 1;
2087 end if;
2088 end loop;
2089
2090 end if;
2091
2092 fazctbk_last_book_used := x_corp_book;
2093 fazctbk_last_type_used := x_asset_type;
2094
2095 end if;
2096
2097 -- set the return table to the new loaded one
2098 x_tax_book_tbl := fazctbk_tax_tbl;
2099 return (TRUE);
2100
2101 exception
2102 when NO_DATA_FOUND then
2103 fa_srvr_msg.add_message(calling_fn => NULL,
2104 name => 'FA_CACHE_BOOK_CONTROLS',
2105 token1 => 'BOOK',
2106 value1 => X_corp_book
2107 ,p_log_level_rec => p_log_level_rec);
2108 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazctbk'
2109 ,p_log_level_rec => p_log_level_rec);
2110 return (FALSE);
2111
2112 when others then
2113 fa_srvr_msg.add_sql_error (calling_fn => 'fa_cache_pkg.fazctbk'
2114 ,p_log_level_rec => p_log_level_rec);
2115 return (FALSE);
2116
2117 end fazctbk;
2118
2119
2120 ---------------------------------------------------------------------
2121
2122 Function fazcrsob
2123 (x_book_type_code in varchar2,
2124 x_sob_tbl out NOCOPY fazcrsob_sob_tbl_type,
2125 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
2126 return boolean is
2127
2128 l_sob_rec fazcrsob_pvt_rec_type;
2129 l_found boolean;
2130 l_main_array_count number := fazcrsob_main_tbl.count;
2131 l_book_array_count number := fazcrsob_book_tbl.count;
2132 l_sob_array_count number := fazcrsob_sob_tbl.count;
2133
2134 i number := 0;
2135
2136 CURSOR r_sob_id is
2137 SELECT set_of_books_id
2138 FROM fa_mc_book_controls
2139 WHERE book_type_code = x_book_type_code
2140 AND enabled_flag = 'Y'
2141 AND mrc_converted_flag = 'Y';
2142
2143
2144 begin <<FAZCRSOB>>
2145
2146 -- check if values are the same as the last cobination requested
2147
2148 if (nvl(fazcrsob_last_book_used, 'NULL') = x_book_type_code) then
2149 -- set the return table to the new loaded one
2150 x_sob_tbl := fazcrsob_sob_tbl;
2151 else
2152 -- delete the existing return table contents
2153 fazcrsob_sob_tbl.delete;
2154 l_sob_array_count := 0;
2155
2156 -- see if the book in question has previously been cached
2157 for i in 1..l_book_array_count loop
2158
2159 if (fazcrsob_book_tbl(i) = x_book_type_code) then
2160 l_found := TRUE;
2161 exit;
2162 else
2163 l_found := FALSE;
2164 end if;
2165
2166 end loop;
2167
2168 if l_found then
2169
2170 -- load the reporting sobs into the return table
2171 for i in 1..fazcrsob_main_tbl.count loop
2172 if (fazcrsob_main_tbl(i).book_type_code = x_book_type_code) then
2173
2174 -- add record to return table
2175 fazcrsob_sob_tbl(l_sob_array_count + 1) := fazcrsob_main_tbl(i).set_of_books_id;
2176 l_sob_array_count := l_sob_array_count + 1;
2177 end if;
2178 end loop;
2179
2180 else
2181
2182 -- book has not been cached before so first get each enabled
2183 -- reporting book that is enabled and converted
2184
2185 for c_sob_id in r_sob_id loop
2186 -- populate the tax record
2187 l_sob_rec.book_type_code := x_book_type_code;
2188 l_sob_rec.set_of_books_id := c_sob_id.set_of_books_id;
2189
2190 -- add record to the main association table
2191 fazcrsob_main_tbl(l_main_array_count + 1) := l_sob_rec;
2192 l_main_array_count := l_main_array_count + 1;
2193 end loop;
2194
2195 -- add the book to the array of books to indicate it's been processed
2196 fazcrsob_book_tbl(l_book_array_count + 1) := x_book_type_code;
2197 l_book_array_count := l_book_array_count + 1;
2198
2199
2200 -- load the values for this particular asset type and book into return table
2201 for i in 1..fazcrsob_main_tbl.count loop
2202 if (fazcrsob_main_tbl(i).book_type_code = x_book_type_code) then
2203
2204 -- add record to return table
2205 fazcrsob_sob_tbl(l_sob_array_count + 1) := fazcrsob_main_tbl(i).set_of_books_id;
2206 l_sob_array_count := l_sob_array_count + 1;
2207 end if;
2208 end loop;
2209
2210 end if;
2211
2212 fazcrsob_last_book_used := x_book_type_code;
2213
2214 end if;
2215
2216 -- set the return table to the new loaded one
2217 x_sob_tbl := fazcrsob_sob_tbl;
2218
2219 return (TRUE);
2220
2221 exception
2222 when others then
2223 fa_srvr_msg.add_sql_error (calling_fn => 'fa_cache_pkg.fazcrsob'
2224 ,p_log_level_rec => p_log_level_rec);
2225 return (FALSE);
2226
2227 end fazcrsob;
2228
2229 -----------------------------------------------------------------------------
2230
2231 Function fazccvt
2232 (x_prorate_convention_code in varchar2,
2233 x_fiscal_year_name in varchar2,
2234 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
2235 return boolean is
2236
2237 l_found boolean;
2238 l_count number;
2239
2240 begin
2241
2242 if (nvl(fazccvt_record.prorate_convention_code, 'NULL') = X_prorate_convention_code and
2243 nvl(fazccvt_record.fiscal_year_name, 'NULL') = X_fiscal_year_name) then
2244 return (TRUE);
2245 else
2246 if fazccvt_table.count = 0 then
2247 l_found := FALSE;
2248 end if;
2249
2250 for i in 1..fazccvt_table.count loop
2251
2252 if (fazccvt_table(i).prorate_convention_code = X_prorate_convention_code and
2253 fazccvt_table(i).fiscal_year_name = X_fiscal_year_name) then
2254 l_count := i;
2255 l_found := TRUE;
2256 exit;
2257 else
2258 l_found := FALSE;
2259 end if;
2260
2261 end loop;
2262
2263 if l_found = TRUE then
2264 fazccvt_record := fazccvt_table(l_count);
2265 else
2266 -- do not let array get to big.. once it is at the
2267 -- max begin clearing values from the array
2268 if fazccvt_table.count = G_max_array_size then
2269
2270 -- clear the first record
2271 fazccvt_record.fiscal_year_name := 'NULL';
2272
2273 -- clear the first member in the table
2274 fazccvt_table.delete(1);
2275
2276 -- reset values so there is no missing member for future use
2277 l_count := fazccvt_table.count;
2278
2279 for i in 1..l_count loop
2280 -- copy the next member into the current one
2281 fazccvt_table(i) := fazccvt_table(i+1);
2282 end loop;
2283
2284 -- delete the last member in the array which is now a duplicate
2285 fazccvt_table.delete(l_count + 1);
2286
2287 end if;
2288
2289 SELECT *
2290 INTO fazccvt_record
2291 FROM fa_convention_types
2292 WHERE prorate_convention_code = X_prorate_convention_code
2293 AND fiscal_year_name = X_fiscal_year_name;
2294
2295 fazccvt_table(fazccvt_table.count + 1):= fazccvt_record;
2296 end if;
2297 end if;
2298
2299 return (TRUE);
2300
2301 exception
2302 when NO_DATA_FOUND then
2303 fa_srvr_msg.add_message(calling_fn => NULL,
2304 name => 'FA_CACHE_CONVENTION_TYPES',
2305 token1 => 'CONVENTION',
2306 value1 => X_prorate_convention_code,
2307 token2 => 'FISCAL_YEAR_NAME',
2308 value2 => X_fiscal_year_name
2309 ,p_log_level_rec => p_log_level_rec);
2310 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazccvt'
2311 ,p_log_level_rec => p_log_level_rec);
2312 return (FALSE);
2313 when others then
2314 fa_srvr_msg.add_sql_error (
2315 calling_fn => 'fa_cache_pkg.fazccvt'
2316 ,p_log_level_rec => p_log_level_rec);
2317 return (FALSE);
2318 end fazccvt;
2319
2320 -----------------------------------------------------------------------------
2321
2322 Function fazcfy
2323 (x_fiscal_year_name in varchar2,
2324 x_fiscal_year in number,
2325 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
2326 return boolean is
2327
2328 l_found boolean;
2329 l_count number;
2330
2331 begin
2332
2333
2334 if (nvl(fazcfy_record.fiscal_year_name, 'NULL') = X_fiscal_year_name and
2335 nvl(fazcfy_record.fiscal_year, -99) = X_fiscal_year) then
2336 return (TRUE);
2337 else
2338 if fazcfy_table.count = 0 then
2339 l_found := FALSE;
2340 end if;
2341
2342 for i in 1..fazcfy_table.count loop
2343 if (fazcfy_table(i).fiscal_year_name = X_fiscal_year_name and
2344 fazcfy_table(i).fiscal_year = X_fiscal_year) then
2345 l_count := i;
2346 l_found := TRUE;
2347 exit;
2348 else
2349 l_found := FALSE;
2350 end if;
2351
2352 end loop;
2353
2354 if l_found = TRUE then
2355 fazcfy_record := fazcfy_table(l_count);
2356 else
2357 -- do not let array get to big.. once it is at the
2358 -- max begin clearing values from the array
2359 if fazcfy_table.count = G_max_array_size then
2360
2361 -- clear the first record
2362 fazcfy_record.fiscal_year_name := 'NULL';
2363
2364 -- clear the first member in the table
2365 fazcfy_table.delete(1);
2366
2367 -- reset values so there is no missing member for future use
2368 l_count := fazcfy_table.count;
2369
2370 for i in 1..l_count loop
2371 -- copy the next member into the current one
2372 fazcfy_table(i) := fazcfy_table(i+1);
2373 end loop;
2374
2375 -- delete the last member in the array which is now a duplicate
2376 fazcfy_table.delete(l_count + 1);
2377
2378 end if;
2379
2380 SELECT *
2381 INTO fazcfy_record
2382 FROM fa_fiscal_year
2383 WHERE fiscal_year_name = X_fiscal_year_name
2384 AND fiscal_year = X_fiscal_year;
2385
2386 fazcfy_table(fazcfy_table.count + 1):= fazcfy_record;
2387
2388 end if;
2389 end if;
2390
2391 return (TRUE);
2392
2393 exception
2394 when NO_DATA_FOUND then
2395 fa_srvr_msg.add_message(calling_fn => NULL,
2396 name => 'FA_CACHE_FISCAL_YEARS',
2397 token1 => 'FY_NAME',
2398 value1 => X_fiscal_year_name,
2399 token2 => 'FY',
2400 value2 => X_fiscal_year
2401 ,p_log_level_rec => p_log_level_rec);
2402 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcfy'
2403 ,p_log_level_rec => p_log_level_rec);
2404 return (FALSE);
2405
2406 when others then
2407 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcfy'
2408 ,p_log_level_rec => p_log_level_rec);
2409 return (FALSE);
2410 end fazcfy;
2411
2412 -----------------------------------------------------------------------------
2413
2414 Function fazcdp
2415 (x_book_type_code in varchar2,
2416 x_period_counter in number default null,
2417 x_effective_date in date default null,
2418 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
2419 return boolean is
2420
2421 l_found boolean;
2422 l_count number;
2423
2424 begin
2425
2426 if ((nvl(fazcdp_record.book_type_code, 'NULL') = X_book_type_code) and
2427 (((X_period_counter is not null) and
2428 (nvl(fazcdp_record.period_counter, -99) = X_period_counter)) or
2429 ((x_effective_date is not null) and
2430 (fazcdp_record.period_open_date <= x_effective_date) and
2431 (nvl(fazcdp_record.period_close_date, sysdate) >= x_effective_date)) or
2432 (X_period_counter is null and
2433 x_effective_date is null and
2434 fazcdp_record.period_close_date is null))) then
2435 null;
2436 else
2437 if fazcdp_table.count = 0 then
2438 l_found := FALSE;
2439 end if;
2440
2441 for i in 1..fazcdp_table.count loop
2442
2443 if ((fazcdp_table(i).book_type_code = X_book_type_code) and
2444 ((X_period_counter is not null and
2445 fazcdp_table(i).period_counter = X_period_counter) or
2446 (x_effective_date is not null and
2447 (fazcdp_table(i).period_open_date <= x_effective_date) and
2448 (nvl(fazcdp_table(i).period_close_date, sysdate) >= x_effective_date)) or
2449 (X_period_counter is null and
2450 x_effective_date is null and
2451 fazcdp_table(i).period_close_date is null))) then
2452 l_count := i;
2453 l_found := TRUE;
2454 exit;
2455 else
2456 l_found := FALSE;
2457 end if;
2458
2459 end loop;
2460
2461 if l_found = TRUE then
2462 fazcdp_record := fazcdp_table(l_count);
2463 fazcdp_index := l_count;
2464 else
2465 -- do not let array get to big.. once it is at the
2466 -- max begin clearing values from the array
2467 if fazcdp_table.count = G_max_array_size then
2468
2469 -- clear the first record
2470 fazcdp_record.book_type_code := 'NULL';
2471 fazcdp_record.period_counter := NULL;
2472
2473 -- clear the first member in the table
2474 fazcdp_table.delete(1);
2475
2476 -- reset values so there is no missing member for future use
2477 l_count := fazcdp_table.count;
2478
2479 for i in 1..l_count loop
2480 -- copy the next member into the current one
2481 fazcdp_table(i) := fazcdp_table(i+1);
2482 end loop;
2483
2484 -- delete the last member in the array which is now a duplicate
2485 fazcdp_table.delete(l_count + 1);
2486
2487 end if;
2488
2489 if X_period_counter is not null then
2490 SELECT book_type_code,
2491 period_name,
2492 period_counter,
2493 fiscal_year,
2494 period_num,
2495 period_open_date,
2496 period_close_date,
2497 calendar_period_open_date,
2498 calendar_period_close_date,
2499 deprn_run
2500 INTO fazcdp_record
2501 FROM fa_deprn_periods
2502 WHERE book_type_code = X_book_type_code
2503 AND period_counter = X_period_counter;
2504 elsif X_effective_date is not null then
2505 SELECT book_type_code,
2506 period_name,
2507 period_counter,
2508 fiscal_year,
2509 period_num,
2510 period_open_date,
2511 period_close_date,
2512 calendar_period_open_date,
2513 calendar_period_close_date,
2514 deprn_run
2515 INTO fazcdp_record
2516 FROM fa_deprn_periods
2517 WHERE book_type_code = X_book_type_code
2518 AND x_effective_date between
2519 period_open_date and nvl(period_close_date, sysdate);
2520 else
2521 SELECT book_type_code,
2522 period_name,
2523 period_counter,
2524 fiscal_year,
2525 period_num,
2526 period_open_date,
2527 period_close_date,
2528 calendar_period_open_date,
2529 calendar_period_close_date,
2530 deprn_run
2531 INTO fazcdp_record
2532 FROM fa_deprn_periods
2533 WHERE book_type_code = X_book_type_code
2534 AND period_close_date is null;
2535 end if;
2536
2537 fazcdp_table(fazcdp_table.count + 1):= fazcdp_record;
2538 fazcdp_index := fazcdp_table.count;
2539
2540 end if;
2541 end if;
2542
2543 return (TRUE);
2544
2545 exception
2546 when NO_DATA_FOUND then
2547 fa_srvr_msg.add_message(calling_fn => NULL,
2548 name => 'FA_CACHE_DEPRN_PERIODS',
2549 token1 => 'BOOK',
2550 value1 => X_book_type_code,
2551 token2 => 'PERIOD_COUNTER',
2552 value2 => X_period_counter,
2553 token3 => 'DATE',
2554 value3 => X_effective_date
2555 ,p_log_level_rec => p_log_level_rec);
2556 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcdp'
2557 ,p_log_level_rec => p_log_level_rec);
2558 return (FALSE);
2559
2560 when others then
2561 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcdp'
2562 ,p_log_level_rec => p_log_level_rec);
2563 return (FALSE);
2564 end fazcdp;
2565
2566 -----------------------------------------------------------------------------
2567
2568 Function fazcdp_clr
2569 (X_book in varchar2,
2570 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
2571 return boolean is
2572
2573 l_count number;
2574
2575 BEGIN <<fazcdp_clr>>
2576
2577 -- clear the record
2578 fazcdp_record.book_type_code := 'NULL';
2579 fazcdp_record.period_counter := NULL;
2580
2581 -- clear the member in the table. since the cache should always
2582 -- be called before doing this (i.e. faxcps) we know the global
2583 -- index variable will have the correct index from fazcdp
2584
2585 fazcdp_table.delete(fazcdp_index);
2586
2587 -- reset the values so there is no missing member for future use
2588 l_count := fazcdp_table.count;
2589
2590 for i in fazcdp_index..l_count loop
2591 -- copy the next member into the current one
2592 fazcdp_table(i) := fazcdp_table(i+1);
2593 end loop;
2594
2595 -- delete the last member in the array which is now a duplicate
2596 fazcdp_table.delete(l_count + 1);
2597
2598 return TRUE;
2599
2600 exception
2601 when others then
2602 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcdp_clr'
2603 ,p_log_level_rec => p_log_level_rec);
2604 return (FALSE);
2605
2606 END fazcdp_clr;
2607
2608
2609 Function fazprof return boolean IS
2610
2611 l_fa_crl_enabled varchar2(3);
2612 l_fa_print_debug varchar2(3);
2613 l_fa_use_threshold varchar2(3);
2614 l_fa_gen_expense_account varchar2(3);
2615 l_fa_pregen_asset_account varchar2(3);
2616 l_fa_pregen_book_account varchar2(3);
2617 l_fa_pregen_cat_account varchar2(3);
2618 l_fa_mcp_all_cost_adj varchar2(3);
2619 l_fa_deprn_override_enabled varchar2(3);
2620 l_fa_deprn_basis_enabled varchar2(3);
2621 l_fa_batch_size varchar2(15);
2622 l_fa_custom_gen_ccid varchar2(3);
2623
2624 BEGIN
2625
2626 if not fa_profile_init then
2627
2628 -- load profiles
2629 fnd_profile.get('FA_DEBUG_FILE', fa_debug_file);
2630 fnd_profile.get('FA_ANNUAL_ROUND', fa_annual_round );
2631
2632 fnd_profile.get('CRL-FA ENABLED', l_fa_crl_enabled);
2633 fnd_profile.get('PRINT_DEBUG', l_fa_print_debug);
2634 fnd_profile.get('FA_USE_THRESHOLD', l_fa_use_threshold);
2635 fnd_profile.get('FA_GEN_EXPENSE_ACCOUNT', l_fa_gen_expense_account);
2636 fnd_profile.get('FA_PREGEN_ASSET_ACCOUNT', l_fa_pregen_asset_account);
2637 fnd_profile.get('FA_PREGEN_BOOK_ACCOUNT', l_fa_pregen_book_account);
2638 fnd_profile.get('FA_PREGEN_CAT_ACCOUNT', l_fa_pregen_cat_account );
2639 fnd_profile.get('FA_MCP_ALL_COST_ADJ', l_fa_mcp_all_cost_adj);
2640 fnd_profile.get('FA_DEPRN_OVERRIDE_ENABLED', l_fa_deprn_override_enabled);
2641 fnd_profile.get('FA_ENABLED_DEPRN_BASIS_FORMULA', l_fa_deprn_basis_enabled);
2642
2643 fnd_profile.get('FA_BATCH_SIZE', l_fa_batch_size);
2644 fnd_profile.get('FA_CUSTOM_GEN_CCID', l_fa_custom_gen_ccid);
2645
2646 if (nvl(l_fa_crl_enabled, 'N') = 'Y') then
2647 fa_crl_enabled := TRUE;
2648 else
2649 fa_crl_enabled := FALSE;
2650 end if;
2651
2652 if (nvl(l_fa_print_debug, 'N') = 'Y') then
2653 fa_print_debug := TRUE;
2654 else
2655 fa_print_debug := FALSE;
2656 end if;
2657
2658 if (nvl(l_fa_use_threshold, 'N') = 'Y') then
2659 fa_use_threshold := TRUE;
2660 else
2661 fa_use_threshold := FALSE;
2662 end if;
2663
2664 if (nvl(l_fa_gen_expense_account, 'N') = 'Y') then
2665 fa_gen_expense_account := TRUE;
2666 else
2667 fa_gen_expense_account := FALSE;
2668 end if;
2669
2670 if (nvl(l_fa_pregen_asset_account, 'Y') = 'Y') then
2671 fa_pregen_asset_account := TRUE;
2672 else
2673 fa_pregen_asset_account := FALSE;
2674 end if;
2675
2676 if (nvl(l_fa_pregen_book_account, 'Y') = 'Y') then
2677 fa_pregen_book_account := TRUE;
2678 else
2679 fa_pregen_book_account := FALSE;
2680 end if;
2681
2682 if (nvl(l_fa_pregen_cat_account, 'Y') = 'Y') then
2683 fa_pregen_cat_account := TRUE;
2684 else
2685 fa_pregen_cat_account := FALSE;
2686 end if;
2687
2688 if (nvl(l_fa_mcp_all_cost_adj, 'N') = 'Y') then
2689 fa_mcp_all_cost_adj := TRUE;
2690 else
2691 fa_mcp_all_cost_adj := FALSE;
2692 end if;
2693
2694 if (nvl(l_fa_deprn_override_enabled, 'N') = 'Y') then
2695 fa_deprn_override_enabled := TRUE;
2696 else
2697 fa_deprn_override_enabled := FALSE;
2698 end if;
2699
2700 if (nvl(l_fa_deprn_basis_enabled, 'N') = 'Y') then
2701 fa_enabled_deprn_basis_formula := TRUE;
2702 else
2703 fa_enabled_deprn_basis_formula := FALSE;
2704 end if;
2705
2706 if (nvl(l_fa_custom_gen_ccid, 'N') = 'Y') then
2707 fa_custom_gen_ccid := TRUE;
2708 else
2709 fa_custom_gen_ccid := FALSE;
2710 end if;
2711
2712 begin
2713 fa_batch_size := to_number(nvl(l_fa_batch_size, '200'));
2714 exception
2715 when others then
2716 fa_batch_size := 200;
2717 end;
2718
2719 fa_profile_init := true;
2720
2721 end if;
2722
2723 return true;
2724
2725 EXCEPTION
2726 WHEN others then
2727 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazprof'
2728 );
2729 return (FALSE);
2730
2731
2732 END fazprof;
2733
2734 --================================================================================
2735 Function fazcsgr(
2736 X_super_group_id in number,
2737 X_book_type_code in varchar2,
2738 X_period_counter in number,
2739 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
2740 return boolean is
2741
2742 CURSOR c_get_super_group_rules is
2743 select super_group_id,
2744 book_type_code,
2745 start_period_counter,
2746 end_period_counter,
2747 deprn_method_code,
2748 basic_rate,
2749 adjusted_rate,
2750 percent_salvage_value
2751 from fa_super_group_rules
2752 where super_group_id = X_super_group_id
2753 and book_type_code = X_book_type_code
2754 and X_period_counter between start_period_counter
2755 and nvl(end_period_counter, X_period_counter)
2756 and date_ineffective is null;
2757
2758 CURSOR c_get_init_super_group_rules is
2759 select super_group_id,
2760 book_type_code,
2761 0,
2762 start_period_counter -1,
2763 deprn_method_code,
2764 0,
2765 0,
2766 1
2767 from fa_super_group_rules
2768 where super_group_id = X_super_group_id
2769 and book_type_code = X_book_type_code
2770 and date_ineffective is null
2771 order by start_period_counter;
2772
2773 l_found boolean;
2774 l_count number;
2775
2776 begin
2777 if (fazcsgr_record.book_type_code = X_book_type_code and
2778 fazcsgr_record.super_group_id = X_super_group_id and
2779 X_period_counter >= fazcsgr_record.start_period_counter and
2780 X_period_counter <= nvl(fazcsgr_record.end_period_counter, X_period_counter)) then
2781 return (TRUE);
2782 else
2783 if fazcsgr_table.count = 0 then
2784 l_found := FALSE;
2785 end if;
2786
2787 for i in 1..fazcsgr_table.count loop
2788
2789 if (fazcsgr_table(i).book_type_code = X_book_type_code and
2790 fazcsgr_table(i).super_group_id = X_super_group_id and
2791 X_period_counter >= fazcsgr_table(i).start_period_counter and
2792 X_period_counter <= nvl(fazcsgr_table(i).end_period_counter, X_period_counter)) then
2793 l_count := i;
2794 l_found := TRUE;
2795 exit;
2796 else
2797 l_found := FALSE;
2798 end if;
2799
2800 end loop;
2801
2802 if l_found = TRUE then
2803 fazcsgr_record := fazcsgr_table(l_count);
2804 else
2805 -- do not let array get to big.. once it is at the
2806 -- max begin clearing values from the array
2807 if fazcsgr_table.count = G_max_array_size then
2808
2809 -- clear the first record
2810 fazcsgr_record.book_type_code := 'NULL';
2811
2812 -- clear the first member in the table
2813 fazcsgr_table.delete(1);
2814
2815 -- reset values so there is no missing member for future use
2816 l_count := fazcsgr_table.count;
2817
2818 for i in 1..l_count loop
2819 -- copy the next member into the current one
2820 fazcsgr_table(i) := fazcsgr_table(i+1);
2821 end loop;
2822
2823 -- delete the last member in the array which is now a duplicate
2824 fazcsgr_table.delete(l_count + 1);
2825
2826 end if;
2827
2828 OPEN c_get_super_group_rules;
2829 FETCH c_get_super_group_rules
2830 INTO fazcsgr_record.super_group_id,
2831 fazcsgr_record.book_type_code,
2832 fazcsgr_record.start_period_counter,
2833 fazcsgr_record.end_period_counter,
2834 fazcsgr_record.deprn_method_code,
2835 fazcsgr_record.basic_rate,
2836 fazcsgr_record.adjusted_rate,
2837 fazcsgr_record.percent_salvage_value;
2838
2839 -- Bug4037112
2840 -- Added to handle the case that super group rule
2841 -- is not available. Earlier periods
2842 if c_get_super_group_rules%NOTFOUND then
2843 OPEN c_get_init_super_group_rules;
2844 FETCH c_get_init_super_group_rules
2845 INTO fazcsgr_record.super_group_id,
2846 fazcsgr_record.book_type_code,
2847 fazcsgr_record.start_period_counter,
2848 fazcsgr_record.end_period_counter,
2849 fazcsgr_record.deprn_method_code,
2850 fazcsgr_record.basic_rate,
2851 fazcsgr_record.adjusted_rate,
2852 fazcsgr_record.percent_salvage_value;
2853 CLOSE c_get_init_super_group_rules;
2854 end if;
2855
2856 CLOSE c_get_super_group_rules;
2857
2858 fazcsgr_table(fazcsgr_table.count + 1):= fazcsgr_record;
2859
2860 end if;
2861 end if;
2862
2863 return (TRUE);
2864
2865 exception
2866 when NO_DATA_FOUND then
2867 fa_srvr_msg.add_message(calling_fn => NULL,
2868 name => 'FA_CACHE_SUPER_GROUP_RULES',
2869 token1 => 'BOOK',
2870 value1 => X_book_type_code,
2871 token2 => 'PERIOD_COUNTER',
2872 value2 => X_period_counter
2873 ,p_log_level_rec => p_log_level_rec);
2874 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcsgr'
2875 ,p_log_level_rec => p_log_level_rec);
2876 return (FALSE);
2877
2878 when others then
2879 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcsgr'
2880 ,p_log_level_rec => p_log_level_rec);
2881 return (FALSE);
2882 end fazcsgr;
2883
2884 /*Bug# 6933726 - Added following function which is called from fadpmn.opc for secondary books
2885 - to set profile GL_SET_OF_BKS_ID and cache FA_BOOK_CONTROLS by SOB information */
2886 FUNCTION fazcbcsob
2887 (
2888 X_book in varchar2,
2889 X_sob_id in number,
2890 p_log_level_rec in fa_api_types.log_level_rec_type default null
2891 )
2892 return boolean is
2893 fazcbcsob_err exception;
2894 begin <<FAZCBCSOB>>
2895
2896 fnd_profile.put('GL_SET_OF_BKS_ID',X_sob_id);
2897
2898 if NOT fa_cache_pkg.fazcbc(X_book => X_book,
2899 p_log_level_rec => p_log_level_rec) then
2900 raise fazcbcsob_err;
2901 end if;
2902 return (TRUE);
2903 exception
2904 when fazcbcsob_err then
2905 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcbcsob'
2906 ,p_log_level_rec => p_log_level_rec);
2907 return (false);
2908 when others then
2909 fa_srvr_msg.add_sql_error(calling_fn => 'fa_cache_pkg.fazcbcsob'
2910 ,p_log_level_rec => p_log_level_rec);
2911 return (FALSE);
2912 end fazcbcsob;
2913
2914
2915 END FA_CACHE_PKG;