698:
699: -- Delete from FA_BOOKS_SUMMARY
700:
701: if (p_log_level_rec.statement_level) then
702: fa_debug_pkg.add(l_calling_fn,
703: 'Deleting FA_BOOKS_SUMMARY rows, next period ctr',
704: p_period_rec.period_counter + 1
705: ,p_log_level_rec => p_log_level_rec);
706: end if;
762: -- rollback/reverse terminal gain loss
763: -- pending new api / logic
764:
765: if (p_log_level_rec.statement_level) then
766: fa_debug_pkg.add(l_calling_fn, 'BEGIN', 'Processing terminal gain loss'
767: ,p_log_level_rec => p_log_level_rec);
768: end if;
769:
770: open c_get_thid;
771: fetch c_get_thid into l_thid, l_event_id;
772: close c_get_thid;
773:
774: if (p_log_level_rec.statement_level) then
775: fa_debug_pkg.add(l_calling_fn, 'THID of TGL', l_thid
776: ,p_log_level_rec => p_log_level_rec);
777: end if;
778: /* Bug#9018861 - set global variable for reporting currency */
779: if p_mrc_sob_type_code <> 'R' then
782: l_thid := g_l_thid;
783: end if;
784: if (l_thid is not null ) then
785: if (p_log_level_rec.statement_level) then
786: fa_debug_pkg.add(l_calling_fn, 'event id', l_event_id
787: ,p_log_level_rec => p_log_level_rec);
788: fa_debug_pkg.add(l_calling_fn, 'sob type code', p_mrc_sob_type_code
789: ,p_log_level_rec => p_log_level_rec);
790: end if;
784: if (l_thid is not null ) then
785: if (p_log_level_rec.statement_level) then
786: fa_debug_pkg.add(l_calling_fn, 'event id', l_event_id
787: ,p_log_level_rec => p_log_level_rec);
788: fa_debug_pkg.add(l_calling_fn, 'sob type code', p_mrc_sob_type_code
789: ,p_log_level_rec => p_log_level_rec);
790: end if;
791: /*=================================================================
792: Secondary Changes Start
799:
800: if(l_secondary_event_id is not null)then
801:
802: if (p_log_level_rec.statement_level) then
803: fa_debug_pkg.add(l_calling_fn, 'calling get event status for event ', l_event_id
804: ,p_log_level_rec => p_log_level_rec);
805: end if;
806:
807: l_deprn_source_info.application_id := 140;
822: p_valuation_method => p_asset_hdr_rec.book_type_code,
823: p_security_context => l_security_context);
824:
825: if (p_log_level_rec.statement_level) then
826: fa_debug_pkg.add(l_calling_fn, 'event status ', l_secondary_event_status
827: ,p_log_level_rec => p_log_level_rec);
828: end if;
829:
830: if (l_secondary_event_status = XLA_EVENTS_PUB_PKG.C_EVENT_PROCESSED) then
849: px_trans_rec => l_secondary_trans_rec,
850: p_event_status => NULL,
851: p_calling_fn => l_calling_fn
852: ,p_log_level_rec => p_log_level_rec) then
853: fa_debug_pkg.add(l_calling_fn, 'ERROR', 'Calling create_transaction_event'
854: ,p_log_level_rec => p_log_level_rec);
855: raise rb_error;
856: end if;
857: elsif (l_secondary_event_status = XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED) then
870:
871: EXCEPTION
872: WHEN OTHERS THEN
873: l_result := 1;
874: fa_debug_pkg.add(l_calling_fn, 'Unable to delete entity for rb event',
875: l_event_id, p_log_level_rec => p_log_level_rec);
876: fa_debug_pkg.add(l_calling_fn, 'l_result', l_result, p_log_level_rec => p_log_level_rec);
877: END; --annonymous
878: end if;
872: WHEN OTHERS THEN
873: l_result := 1;
874: fa_debug_pkg.add(l_calling_fn, 'Unable to delete entity for rb event',
875: l_event_id, p_log_level_rec => p_log_level_rec);
876: fa_debug_pkg.add(l_calling_fn, 'l_result', l_result, p_log_level_rec => p_log_level_rec);
877: END; --annonymous
878: end if;
879: end if;
880: end if;
881: /*Secondary Changes End
882: ==================================================================*/
883: if (l_event_id is not null) then
884: if (p_log_level_rec.statement_level) then
885: fa_debug_pkg.add(l_calling_fn, 'calling get event status for event ', l_event_id
886: ,p_log_level_rec => p_log_level_rec);
887: end if;
888:
889: l_deprn_source_info.application_id := 140;
904: p_valuation_method => p_asset_hdr_rec.book_type_code,
905: p_security_context => l_security_context);
906:
907: if (p_log_level_rec.statement_level) then
908: fa_debug_pkg.add(l_calling_fn, 'event status ', l_event_status
909: ,p_log_level_rec => p_log_level_rec);
910: end if;
911:
912: end if;
938: px_trans_rec => l_trans_rec,
939: p_event_status => NULL,
940: p_calling_fn => l_calling_fn
941: ,p_log_level_rec => p_log_level_rec) then
942: fa_debug_pkg.add(l_calling_fn, 'ERROR', 'Calling create_transaction_event'
943: ,p_log_level_rec => p_log_level_rec);
944: raise rb_error;
945: end if;
946:
1349: X_Calling_Fn => l_calling_fn
1350: ,p_log_level_rec => p_log_level_rec);
1351:
1352: if not l_status then
1353: fa_debug_pkg.add(l_calling_fn, 'Failed to insert ', 'FA_BOOKS'
1354: ,p_log_level_rec => p_log_level_rec);
1355: raise rb_error;
1356: end if;
1357: /* Bug#9018861 - Modified condition for reporting currency */
1357: /* Bug#9018861 - Modified condition for reporting currency */
1358: elsif (l_event_status = XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED OR p_mrc_sob_type_code = 'R' ) then
1359:
1360: if (p_log_level_rec.statement_level) then
1361: fa_debug_pkg.add(l_calling_fn, 'deleting event', l_event_id
1362: ,p_log_level_rec => p_log_level_rec);
1363: end if;
1364: /* Bug#9018861 - Null means already deleted for primary book */
1365: if p_mrc_sob_type_code <> 'R' then
1378:
1379: EXCEPTION
1380: WHEN OTHERS THEN
1381: l_result := 1;
1382: fa_debug_pkg.add(l_calling_fn, 'Unable to delete entity for rb event',
1383: l_event_id, p_log_level_rec => p_log_level_rec);
1384: fa_debug_pkg.add(l_calling_fn, 'l_result', l_result, p_log_level_rec => p_log_level_rec);
1385: END; --annonymous
1386: end if;
1380: WHEN OTHERS THEN
1381: l_result := 1;
1382: fa_debug_pkg.add(l_calling_fn, 'Unable to delete entity for rb event',
1383: l_event_id, p_log_level_rec => p_log_level_rec);
1384: fa_debug_pkg.add(l_calling_fn, 'l_result', l_result, p_log_level_rec => p_log_level_rec);
1385: END; --annonymous
1386: end if;
1387: -- Rollback Terminal Gain Loss
1388: if (p_mrc_sob_type_code <> 'R') then
1467: -- End of terminal gain loss
1468:
1469: -- Bug:6665510:Japan Tax Reform Project
1470: if (p_log_level_rec.statement_level) then
1471: fa_debug_pkg.add('FAVDRBB', 'guarantee_flag', fa_cache_pkg.fazccmt_record.guarantee_rate_method_flag);
1472: fa_debug_pkg.add('FAVDRBB', 'period_num', p_period_rec.period_num);
1473: fa_debug_pkg.add('FAVDRBB', 'pers_per_yr', pers_per_yr);
1474: end if;
1475:
1468:
1469: -- Bug:6665510:Japan Tax Reform Project
1470: if (p_log_level_rec.statement_level) then
1471: fa_debug_pkg.add('FAVDRBB', 'guarantee_flag', fa_cache_pkg.fazccmt_record.guarantee_rate_method_flag);
1472: fa_debug_pkg.add('FAVDRBB', 'period_num', p_period_rec.period_num);
1473: fa_debug_pkg.add('FAVDRBB', 'pers_per_yr', pers_per_yr);
1474: end if;
1475:
1476: if ((p_period_rec.period_num - pers_per_yr) = 0) and
1469: -- Bug:6665510:Japan Tax Reform Project
1470: if (p_log_level_rec.statement_level) then
1471: fa_debug_pkg.add('FAVDRBB', 'guarantee_flag', fa_cache_pkg.fazccmt_record.guarantee_rate_method_flag);
1472: fa_debug_pkg.add('FAVDRBB', 'period_num', p_period_rec.period_num);
1473: fa_debug_pkg.add('FAVDRBB', 'pers_per_yr', pers_per_yr);
1474: end if;
1475:
1476: if ((p_period_rec.period_num - pers_per_yr) = 0) and
1477: (nvl(fnd_profile.value('FA_JAPAN_TAX_REFORMS'),'N') = 'Y') then
1476: if ((p_period_rec.period_num - pers_per_yr) = 0) and
1477: (nvl(fnd_profile.value('FA_JAPAN_TAX_REFORMS'),'N') = 'Y') then
1478:
1479: if (p_log_level_rec.statement_level) then
1480: fa_debug_pkg.add('Updating rate_in_use', 'EOFY', 'YES');
1481: end if;
1482:
1483: if (p_mrc_sob_type_code = 'R') then
1484: Null;
1504: exit;
1505: end if;
1506:
1507: if (p_log_level_rec.statement_level) then
1508: fa_debug_pkg.add('FAVDRBB', 'l_bks_rowid_tbl2.count', l_bks_rowid_tbl2.count);
1509: end if;
1510:
1511: for i in 1..l_bks_rowid_tbl2.count loop
1512:
1510:
1511: for i in 1..l_bks_rowid_tbl2.count loop
1512:
1513: if (p_log_level_rec.statement_level) then
1514: fa_debug_pkg.add('FAVDRBB', 'l_asset_id_tbl2(i)', l_asset_id_tbl2(i));
1515: fa_debug_pkg.add('FAVDRBB', 'l_method_code_tbl2(i)', l_method_code_tbl2(i));
1516: end if;
1517:
1518: FA_CDE_PKG.faxgfr (X_Book_Type_Code => p_asset_hdr_rec.book_type_code,
1511: for i in 1..l_bks_rowid_tbl2.count loop
1512:
1513: if (p_log_level_rec.statement_level) then
1514: fa_debug_pkg.add('FAVDRBB', 'l_asset_id_tbl2(i)', l_asset_id_tbl2(i));
1515: fa_debug_pkg.add('FAVDRBB', 'l_method_code_tbl2(i)', l_method_code_tbl2(i));
1516: end if;
1517:
1518: FA_CDE_PKG.faxgfr (X_Book_Type_Code => p_asset_hdr_rec.book_type_code,
1519: X_Asset_Id => l_asset_id_tbl2(i),
1538: raise rb_error;
1539: end if;
1540: end loop;
1541:
1542: fa_debug_pkg.add('FAVDRBB', 'update fa_books.rate_in_use', l_bks_rowid_tbl2.count);
1543:
1544: forall i IN 1..l_bks_rowid_tbl2.count
1545: update fa_books
1546: set rate_in_use = l_rate_in_use_tbl(i)