1600: CURSOR get_billable_flag IS
1601: SELECT stb.stream_type_purpose purpose,
1602: stb.billable_yn
1603: FROM OKL_ST_GEN_TMPT_LNS gtl
1604: ,okl_strm_type_b stb
1605: WHERE
1606: gtl.gtt_id = p_gtt_id
1607: AND gtl.DEPENDENT_STY_ID = stb.id
1608: AND gtl.primary_yn = 'N'
1614: )
1615: AND gtl.PRIMARY_STY_ID IN
1616: (
1617: SELECT id
1618: FROM okl_strm_type_b
1619: WHERE stream_type_purpose='RENT'
1620: );
1621:
1622: CURSOR get_rent_flag IS
1621:
1622: CURSOR get_rent_flag IS
1623: SELECT stb.stream_type_purpose purpose, stb.billable_yn
1624: FROM OKL_ST_GEN_TMPT_LNS gtl
1625: ,okl_strm_type_b stb
1626: WHERE
1627: gtl.gtt_id = p_gtt_id
1628: AND gtl.PRIMARY_STY_ID = stb.id
1629: AND gtl.primary_yn = 'Y'
1630: AND stb.stream_type_purpose ='RENT';
1631: --Local variable declarations
1632: l_interest_calc_meth OKL_ST_GEN_TMPT_SETS.interest_calc_meth_code%TYPE;
1633: l_revenue_recog_meth OKL_ST_GEN_TMPT_SETS.revenue_recog_meth_code%TYPE;
1634: l_purpose okl_strm_type_b.billable_yn%TYPE;
1635: l_billable_yn okl_strm_type_b.stream_type_purpose%TYPE;
1636: l_pricing_engine OKL_ST_GEN_TMPT_SETS.pricing_engine%TYPE;
1637: l_days_in_month_code OKL_ST_GEN_TMPT_SETS.days_in_month_code %TYPE;
1638: l_days_in_yr_code OKL_ST_GEN_TMPT_SETS.days_in_yr_code%TYPE;
1631: --Local variable declarations
1632: l_interest_calc_meth OKL_ST_GEN_TMPT_SETS.interest_calc_meth_code%TYPE;
1633: l_revenue_recog_meth OKL_ST_GEN_TMPT_SETS.revenue_recog_meth_code%TYPE;
1634: l_purpose okl_strm_type_b.billable_yn%TYPE;
1635: l_billable_yn okl_strm_type_b.stream_type_purpose%TYPE;
1636: l_pricing_engine OKL_ST_GEN_TMPT_SETS.pricing_engine%TYPE;
1637: l_days_in_month_code OKL_ST_GEN_TMPT_SETS.days_in_month_code %TYPE;
1638: l_days_in_yr_code OKL_ST_GEN_TMPT_SETS.days_in_yr_code%TYPE;
1639: l_days_month_yr_concat VARCHAR2(2700);
2011: -- insurance stream purposes must be defined.
2012: CURSOR okl_ins_purposes_csr( p_gtt_id IN OKL_ST_GEN_TEMPLATES.id%type) IS
2013: SELECT count(*) ins_strms_count
2014: FROM OKL_ST_GEN_TMPT_LNS gtl
2015: , okl_strm_type_b stb
2016: WHERE gtl.primary_sty_id = stb.id
2017: AND GTL.GTT_ID = p_gtt_id
2018: AND GTL.primary_yn = 'Y'
2019: AND stb.stream_type_purpose IN
2037: -- SQL statement.
2038: CURSOR fin_only_one_as_primary_csr( p_gtt_id IN OKL_ST_GEN_TEMPLATES.id%type) IS
2039: SELECT stb.stream_type_purpose purpose, count(stb.stream_type_purpose)
2040: FROM OKL_ST_GEN_TMPT_LNS gtl
2041: ,okl_strm_type_b stb
2042: WHERE gtl.primary_sty_id = stb.id
2043: AND gtl.primary_yn = 'Y'
2044: AND stb.stream_type_purpose IN
2045: (
2160: )
2161: MINUS
2162: SELECT distinct stb.stream_type_purpose purpose
2163: FROM OKL_ST_GEN_TMPT_LNS gtl
2164: , okl_strm_type_b stb
2165: WHERE gtl.primary_sty_id = stb.id
2166: AND gtl.primary_yn = 'Y'
2167: AND stb.stream_type_purpose IN
2168: (
2202: )
2203: MINUS
2204: SELECT distinct stb.stream_type_purpose purpose
2205: FROM OKL_ST_GEN_TMPT_LNS gtl
2206: , okl_strm_type_b stb
2207: WHERE gtl.primary_sty_id = stb.id
2208: AND gtl.primary_yn = 'Y'
2209: AND stb.stream_type_purpose IN
2210: (
2222: )
2223: MINUS
2224: SELECT distinct stb.stream_type_purpose purpose
2225: FROM OKL_ST_GEN_TMPT_LNS gtl
2226: , okl_strm_type_b stb
2227: WHERE gtl.primary_sty_id = stb.id
2228: AND gtl.primary_yn = 'Y'
2229: AND stb.stream_type_purpose IN
2230: (
2240: AND LOOKUP_CODE ='VARIABLE_INTEREST_SCHEDULE'
2241: MINUS
2242: SELECT distinct stb.stream_type_purpose purpose
2243: FROM OKL_ST_GEN_TMPT_LNS gtl
2244: , okl_strm_type_b stb
2245: WHERE gtl.primary_sty_id = stb.id
2246: AND gtl.primary_yn = 'Y'
2247: AND stb.stream_type_purpose ='VARIABLE_INTEREST_SCHEDULE'
2248: and GTL.GTT_ID = p_gtt_id;
2260: )
2261: MINUS
2262: SELECT distinct stb.stream_type_purpose purpose
2263: FROM OKL_ST_GEN_TMPT_LNS gtl
2264: , okl_strm_type_b stb
2265: WHERE gtl.primary_sty_id = stb.id
2266: AND gtl.primary_yn = 'Y'
2267: AND stb.stream_type_purpose IN
2268: (
2280: )
2281: MINUS
2282: SELECT distinct stb.stream_type_purpose purpose
2283: FROM OKL_ST_GEN_TMPT_LNS gtl
2284: , okl_strm_type_b stb
2285: WHERE gtl.primary_sty_id = stb.id
2286: AND gtl.primary_yn = 'Y'
2287: AND stb.stream_type_purpose IN
2288: (
2305: )
2306: MINUS
2307: SELECT distinct stb.stream_type_purpose purpose
2308: FROM OKL_ST_GEN_TMPT_LNS gtl
2309: , okl_strm_type_b stb
2310: , okl_strm_type_b sstb
2311: WHERE gtl.dependent_sty_id = stb.id
2312: AND gtl.primary_yn = 'N'
2313: AND stb.stream_type_purpose IN
2306: MINUS
2307: SELECT distinct stb.stream_type_purpose purpose
2308: FROM OKL_ST_GEN_TMPT_LNS gtl
2309: , okl_strm_type_b stb
2310: , okl_strm_type_b sstb
2311: WHERE gtl.dependent_sty_id = stb.id
2312: AND gtl.primary_yn = 'N'
2313: AND stb.stream_type_purpose IN
2314: (
2345: )
2346: MINUS
2347: SELECT distinct stb.stream_type_purpose purpose
2348: FROM OKL_ST_GEN_TMPT_LNS gtl
2349: , okl_strm_type_b stb
2350: , okl_strm_type_b sstb
2351: WHERE gtl.dependent_sty_id = stb.id
2352: AND gtl.primary_yn = 'N'
2353: AND stb.stream_type_purpose IN
2346: MINUS
2347: SELECT distinct stb.stream_type_purpose purpose
2348: FROM OKL_ST_GEN_TMPT_LNS gtl
2349: , okl_strm_type_b stb
2350: , okl_strm_type_b sstb
2351: WHERE gtl.dependent_sty_id = stb.id
2352: AND gtl.primary_yn = 'N'
2353: AND stb.stream_type_purpose IN
2354: (
2392: )
2393: MINUS
2394: SELECT distinct stb.stream_type_purpose purpose
2395: FROM OKL_ST_GEN_TMPT_LNS gtl
2396: , okl_strm_type_b stb
2397: , okl_strm_type_b ptb
2398: WHERE gtl.dependent_sty_id = stb.id
2399: AND gtl.primary_yn = 'N'
2400: AND stb.stream_type_purpose IN
2393: MINUS
2394: SELECT distinct stb.stream_type_purpose purpose
2395: FROM OKL_ST_GEN_TMPT_LNS gtl
2396: , okl_strm_type_b stb
2397: , okl_strm_type_b ptb
2398: WHERE gtl.dependent_sty_id = stb.id
2399: AND gtl.primary_yn = 'N'
2400: AND stb.stream_type_purpose IN
2401: (
2433: )
2434: MINUS
2435: SELECT distinct stb.stream_type_purpose purpose
2436: FROM OKL_ST_GEN_TMPT_LNS gtl
2437: , okl_strm_type_b stb
2438: , okl_strm_type_b ptb
2439: WHERE gtl.dependent_sty_id = stb.id
2440: AND gtl.primary_yn = 'N'
2441: AND stb.stream_type_purpose IN
2434: MINUS
2435: SELECT distinct stb.stream_type_purpose purpose
2436: FROM OKL_ST_GEN_TMPT_LNS gtl
2437: , okl_strm_type_b stb
2438: , okl_strm_type_b ptb
2439: WHERE gtl.dependent_sty_id = stb.id
2440: AND gtl.primary_yn = 'N'
2441: AND stb.stream_type_purpose IN
2442: (
2467: )
2468: MINUS
2469: SELECT distinct stb.stream_type_purpose purpose
2470: FROM OKL_ST_GEN_TMPT_LNS gtl
2471: , okl_strm_type_b stb
2472: , okl_strm_type_b ptb
2473: WHERE gtl.dependent_sty_id = stb.id
2474: AND gtl.primary_yn = 'N'
2475: AND stb.stream_type_purpose IN
2468: MINUS
2469: SELECT distinct stb.stream_type_purpose purpose
2470: FROM OKL_ST_GEN_TMPT_LNS gtl
2471: , okl_strm_type_b stb
2472: , okl_strm_type_b ptb
2473: WHERE gtl.dependent_sty_id = stb.id
2474: AND gtl.primary_yn = 'N'
2475: AND stb.stream_type_purpose IN
2476: (
2499: AND LOOKUP_CODE = 'VARIABLE_INTEREST_INCOME'
2500: MINUS
2501: SELECT distinct stb.stream_type_purpose purpose
2502: FROM OKL_ST_GEN_TMPT_LNS gtl
2503: , okl_strm_type_b stb
2504: , okl_strm_type_b sstb
2505: WHERE gtl.dependent_sty_id = stb.id
2506: AND gtl.primary_yn = 'N'
2507: AND stb.stream_type_purpose = 'VARIABLE_INTEREST_INCOME'
2500: MINUS
2501: SELECT distinct stb.stream_type_purpose purpose
2502: FROM OKL_ST_GEN_TMPT_LNS gtl
2503: , okl_strm_type_b stb
2504: , okl_strm_type_b sstb
2505: WHERE gtl.dependent_sty_id = stb.id
2506: AND gtl.primary_yn = 'N'
2507: AND stb.stream_type_purpose = 'VARIABLE_INTEREST_INCOME'
2508: and GTL.GTT_ID = p_gtt_id
2531: )
2532: MINUS
2533: SELECT distinct stb.stream_type_purpose purpose
2534: FROM OKL_ST_GEN_TMPT_LNS gtl
2535: , okl_strm_type_b stb
2536: , okl_strm_type_b sstb
2537: WHERE gtl.dependent_sty_id = stb.id
2538: AND gtl.primary_yn = 'N'
2539: AND stb.stream_type_purpose IN
2532: MINUS
2533: SELECT distinct stb.stream_type_purpose purpose
2534: FROM OKL_ST_GEN_TMPT_LNS gtl
2535: , okl_strm_type_b stb
2536: , okl_strm_type_b sstb
2537: WHERE gtl.dependent_sty_id = stb.id
2538: AND gtl.primary_yn = 'N'
2539: AND stb.stream_type_purpose IN
2540: (
2567: )
2568: MINUS
2569: SELECT distinct stb.stream_type_purpose purpose
2570: FROM OKL_ST_GEN_TMPT_LNS gtl
2571: , okl_strm_type_b stb
2572: , okl_strm_type_b sstb
2573: WHERE gtl.dependent_sty_id = stb.id
2574: AND gtl.primary_yn = 'N'
2575: AND stb.stream_type_purpose IN
2568: MINUS
2569: SELECT distinct stb.stream_type_purpose purpose
2570: FROM OKL_ST_GEN_TMPT_LNS gtl
2571: , okl_strm_type_b stb
2572: , okl_strm_type_b sstb
2573: WHERE gtl.dependent_sty_id = stb.id
2574: AND gtl.primary_yn = 'N'
2575: AND stb.stream_type_purpose IN
2576: (
2609: )
2610: MINUS
2611: SELECT distinct stb.stream_type_purpose purpose
2612: FROM OKL_ST_GEN_TMPT_LNS gtl
2613: , okl_strm_type_b stb
2614: , okl_strm_type_b sstb
2615: WHERE gtl.dependent_sty_id = stb.id
2616: AND gtl.primary_yn = 'N'
2617: AND stb.stream_type_purpose IN
2610: MINUS
2611: SELECT distinct stb.stream_type_purpose purpose
2612: FROM OKL_ST_GEN_TMPT_LNS gtl
2613: , okl_strm_type_b stb
2614: , okl_strm_type_b sstb
2615: WHERE gtl.dependent_sty_id = stb.id
2616: AND gtl.primary_yn = 'N'
2617: AND stb.stream_type_purpose IN
2618: (
2649: )
2650: MINUS
2651: SELECT distinct stb.stream_type_purpose purpose
2652: FROM OKL_ST_GEN_TMPT_LNS gtl
2653: , okl_strm_type_b stb
2654: , okl_strm_type_b sstb
2655: WHERE gtl.dependent_sty_id = stb.id
2656: AND gtl.primary_yn = 'N'
2657: AND stb.stream_type_purpose IN
2650: MINUS
2651: SELECT distinct stb.stream_type_purpose purpose
2652: FROM OKL_ST_GEN_TMPT_LNS gtl
2653: , okl_strm_type_b stb
2654: , okl_strm_type_b sstb
2655: WHERE gtl.dependent_sty_id = stb.id
2656: AND gtl.primary_yn = 'N'
2657: AND stb.stream_type_purpose IN
2658: (
2679: (
2680: -- Retrieve the List of Primary Stream Purposes in the Template
2681: SELECT distinct stb.stream_type_purpose purpose
2682: FROM OKL_ST_GEN_TMPT_LNS gtl
2683: , okl_strm_type_b stb
2684: WHERE gtl.primary_sty_id = stb.id
2685: AND gtl.primary_yn = 'Y'
2686: AND GTL.GTT_ID = p_gtt_id
2687: UNION
2687: UNION
2688: -- Retrieve the List of Dependent Stream Purposes in the Template
2689: SELECT distinct stb.stream_type_purpose purpose
2690: FROM OKL_ST_GEN_TMPT_LNS gtl
2691: , okl_strm_type_b stb
2692: WHERE gtl.dependent_sty_id = stb.id
2693: AND gtl.primary_yn = 'N'
2694: and GTL.GTT_ID = p_gtt_id
2695: )
2840: (
2841: -- Retrieve the List of Primary Stream Purposes in the Template
2842: SELECT distinct stb.stream_type_purpose purpose
2843: FROM OKL_ST_GEN_TMPT_LNS gtl
2844: , okl_strm_type_b stb
2845: WHERE gtl.primary_sty_id = stb.id
2846: AND gtl.primary_yn = 'Y'
2847: AND GTL.GTT_ID = p_gtt_id
2848: UNION
2848: UNION
2849: -- Retrieve the List of Dependent Stream Purposes in the Template
2850: SELECT distinct stb.stream_type_purpose purpose
2851: FROM OKL_ST_GEN_TMPT_LNS gtl
2852: , okl_strm_type_b stb
2853: WHERE gtl.dependent_sty_id = stb.id
2854: AND gtl.primary_yn = 'N'
2855: and GTL.GTT_ID = p_gtt_id
2856: )
3001: (
3002: -- Retrieve the List of Primary Stream Purposes in the Template
3003: SELECT distinct stb.stream_type_purpose purpose
3004: FROM OKL_ST_GEN_TMPT_LNS gtl
3005: , okl_strm_type_b stb
3006: WHERE gtl.primary_sty_id = stb.id
3007: AND gtl.primary_yn = 'Y'
3008: AND GTL.GTT_ID = p_gtt_id
3009: UNION
3009: UNION
3010: -- Retrieve the List of Dependent Stream Purposes in the Template
3011: SELECT distinct stb.stream_type_purpose purpose
3012: FROM OKL_ST_GEN_TMPT_LNS gtl
3013: , okl_strm_type_b stb
3014: WHERE gtl.dependent_sty_id = stb.id
3015: AND gtl.primary_yn = 'N'
3016: and GTL.GTT_ID = p_gtt_id
3017: )
3696: -- 1. Only one stream type of the following primary purposes should be defined.
3697: CURSOR inv_only_one_as_primary_csr( p_gtt_id IN OKL_ST_GEN_TEMPLATES.id%type) IS
3698: SELECT stb.stream_type_purpose purpose, count(stb.stream_type_purpose)
3699: FROM OKL_ST_GEN_TMPT_LNS gtl
3700: ,okl_strm_type_b stb
3701: WHERE gtl.primary_sty_id = stb.id
3702: AND gtl.primary_yn = 'Y'
3703: AND stb.stream_type_purpose IN
3704: (
3753: )
3754: MINUS
3755: SELECT distinct stb.stream_type_purpose purpose
3756: FROM OKL_ST_GEN_TMPT_LNS gtl
3757: , okl_strm_type_b stb
3758: WHERE gtl.primary_sty_id = stb.id
3759: AND gtl.primary_yn = 'Y'
3760: AND stb.stream_type_purpose IN
3761: (
4052: MINUS
4053: (
4054: SELECT STB.STREAM_TYPE_PURPOSE PURPOSE
4055: FROM OKL_ST_GEN_TMPT_LNS GTL
4056: ,OKL_STRM_TYPE_B STB
4057: WHERE GTL.GTT_ID = p_gtt_id
4058: AND GTL.PRIMARY_YN = 'N'
4059: AND GTL.DEPENDENT_STY_ID = STB.ID
4060: AND GTL.PRIMARY_STY_ID = p_pri_sty_id
4157: ,STB.CODE STRM_NAME
4158: FROM OKL_ST_GEN_TMPT_LNS GTL
4159: ,OKL_ST_GEN_TMPT_SETS GTS
4160: ,OKL_ST_GEN_TEMPLATES GTT
4161: ,OKL_STRM_TYPE_B STB
4162: WHERE GTL.GTT_ID = p_gtt_id
4163: AND GTL.GTT_ID = GTT.ID
4164: AND GTS.ID = GTT.GTS_ID
4165: AND GTL.PRIMARY_YN = 'Y'
4529: AND LOOKUP_CODE = STY.STREAM_TYPE_PURPOSE
4530: ) PURPOSE_MEANING,
4531: COUNT( STY.STREAM_TYPE_PURPOSE) streams_count
4532: FROM OKL_ST_GEN_TMPT_LNS GTL
4533: ,okl_Strm_Type_b STY
4534: WHERE GTL.DEPENDENT_STY_ID = STY.ID
4535: AND PRIMARY_YN = 'N'
4536: AND GTL.GTT_ID = p_gtt_id
4537: AND GTL.PRIMARY_STY_ID = p_pri_id
4560: ,p_pri_sty_id OKL_ST_GEN_TMPT_LNS.PRIMARY_STY_ID%TYPE)
4561: IS
4562: SELECT STY.STREAM_TYPE_PURPOSE PRI_STRM_PURPOSE
4563: FROM OKL_ST_GEN_TMPT_LNS GTL
4564: ,OKL_STRM_TYPE_B STY
4565: WHERE STY.ID = GTL.PRIMARY_sTY_ID
4566: AND GTL.PRIMARY_YN = 'Y'
4567: AND GTL.GTT_ID = p_gtt_id
4568: AND GTL.PRIMARY_STY_ID = p_pri_sty_id;
4568: AND GTL.PRIMARY_STY_ID = p_pri_sty_id;
4569:
4570: l_missing_deps VARCHAR2(10000) := OKL_API.G_MISS_CHAR;
4571: l_show_warn_flag VARCHAR2(1):= OKL_API.G_FALSE;
4572: l_pri_strm_purpose OKL_STRM_TYPE_B.STREAM_TYPE_PURPOSE%TYPE;
4573:
4574: -- Modified by RGOOTY
4575: -- Bug 4094361: Start
4576: CURSOR pdt_for_active_sgt_csr( p_gts_id OKL_ST_GEN_TMPT_SETS.ID%TYPE )
4843: ) DEP_PURPOSE_MEANING,
4844: COUNT( STY.STREAM_TYPE_PURPOSE) streams_count
4845: FROM OKL_ST_GEN_TMPT_LNS GTL
4846: ,OKL_ST_GEN_TMPT_LNS GTLP
4847: ,OKL_STRM_TYPE_B STY
4848: ,OKL_STRM_TYPE_B STYP
4849: WHERE GTL.DEPENDENT_STY_ID = STY.ID
4850: AND GTLP.PRIMARY_STY_ID = STYP.ID
4851: AND GTL.PRIMARY_YN = 'N'
4844: COUNT( STY.STREAM_TYPE_PURPOSE) streams_count
4845: FROM OKL_ST_GEN_TMPT_LNS GTL
4846: ,OKL_ST_GEN_TMPT_LNS GTLP
4847: ,OKL_STRM_TYPE_B STY
4848: ,OKL_STRM_TYPE_B STYP
4849: WHERE GTL.DEPENDENT_STY_ID = STY.ID
4850: AND GTLP.PRIMARY_STY_ID = STYP.ID
4851: AND GTL.PRIMARY_YN = 'N'
4852: AND GTLP.PRIMARY_YN = 'Y'
4880: l_sgt_set_id OKL_ST_GEN_TMPT_SETS.ID%TYPE;
4881: l_pri_purpose_list VARCHAR2(10000);
4882: l_found VARCHAR2(30);
4883: l_msg VARCHAR2(10000);
4884: l_pri_stream_name OKL_STRM_TYPE_B.CODE%TYPE;
4885: l_dep_purp_list VARCHAR2(10000);
4886: BEGIN
4887: x_return_status := OKL_API.G_RET_STS_SUCCESS;
4888: l_return_status := OKL_API.START_ACTIVITY( l_api_name