3:
4: G_DEBUG CONSTANT VARCHAR2(10) := OKL_DEBUG_PUB.CHECK_LOG_ENABLED;
5: G_INIT_NUMBER CONSTANT NUMBER := -9999;
6: G_API_TYPE CONSTANT VARCHAR2(4) := '_PVT';
7: G_REQUIRED_VALUE CONSTANT VARCHAR2(200) := OKL_API.G_REQUIRED_VALUE;
8: G_COL_NAME_TOKEN CONSTANT VARCHAR2(200) := OKL_API.G_COL_NAME_TOKEN;
9: G_FIN_LINE_LTY_ID CONSTANT NUMBER := 33;
10: rule_failed EXCEPTION;
11:
4: G_DEBUG CONSTANT VARCHAR2(10) := OKL_DEBUG_PUB.CHECK_LOG_ENABLED;
5: G_INIT_NUMBER CONSTANT NUMBER := -9999;
6: G_API_TYPE CONSTANT VARCHAR2(4) := '_PVT';
7: G_REQUIRED_VALUE CONSTANT VARCHAR2(200) := OKL_API.G_REQUIRED_VALUE;
8: G_COL_NAME_TOKEN CONSTANT VARCHAR2(200) := OKL_API.G_COL_NAME_TOKEN;
9: G_FIN_LINE_LTY_ID CONSTANT NUMBER := 33;
10: rule_failed EXCEPTION;
11:
12:
73: --Bug# 7277007
74:
75: FUNCTION set_value_null(p_value_in IN VARCHAR2) RETURN VARCHAR2 IS
76: BEGIN
77: IF (p_value_in = OKL_API.G_MISS_CHAR) THEN
78: RETURN NULL;
79: END IF;
80: RETURN p_value_in;
81: END;
81: END;
82:
83: FUNCTION set_value_null(p_value_in IN DATE) RETURN DATE IS
84: BEGIN
85: IF (p_value_in = OKL_API.G_MISS_DATE) THEN
86: RETURN NULL;
87: END IF;
88: RETURN p_value_in;
89: END;
89: END;
90:
91: FUNCTION set_value_null(p_value_in IN NUMBER) RETURN NUMBER IS
92: BEGIN
93: IF (p_value_in = OKL_API.G_MISS_NUM) THEN
94: RETURN NULL;
95: END IF;
96: RETURN p_value_in;
97: END;
280: x_msg_out VARCHAR2(2000);
281:
282: BEGIN
283:
284: okl_api.end_activity(
285: X_msg_count => x_msg_count,
286: X_msg_data => x_msg_data
287: );
288:
333:
334: ------------------------------------------------------------------------------
335: PROCEDURE initialize_contract_params (
336: p_api_version IN NUMBER,
337: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
338: x_return_status OUT NOCOPY VARCHAR2,
339: x_msg_count OUT NOCOPY NUMBER,
340: x_msg_data OUT NOCOPY VARCHAR2,
341: p_contract_id IN NUMBER) IS
374: FROM okl_product_parameters_v ppm
375: WHERE ppm.id = p_product_id;
376:
377: BEGIN
378: x_return_status := OKL_API.G_RET_STS_SUCCESS;
379:
380: print_debug('Executing procedure INITIALIZE_CONTRACT_PARAMS using following parameters : ');
381: print_debug(' p_contract_id : '|| p_contract_id );
382:
456:
457: EXCEPTION
458: WHEN init_ctr_params_failed THEN
459: print_error_message('init_ctr_params_failed Exception raised in procedure INITIALIZE_CONTRACT_PARAMS');
460: x_return_status := OKL_API.G_RET_STS_ERROR;
461:
462: WHEN OTHERS THEN
463: print_error_message('Exception raised in procedure INITIALIZE_CONTRACT_PARAMS');
464: Okl_Api.SET_MESSAGE(
460: x_return_status := OKL_API.G_RET_STS_ERROR;
461:
462: WHEN OTHERS THEN
463: print_error_message('Exception raised in procedure INITIALIZE_CONTRACT_PARAMS');
464: Okl_Api.SET_MESSAGE(
465: p_app_name => G_APP_NAME,
466: p_msg_name => G_UNEXPECTED_ERROR,
467: p_token1 => G_SQLCODE_TOKEN,
468: p_token1_value => SQLCODE,
468: p_token1_value => SQLCODE,
469: p_token2 => G_SQLERRM_TOKEN,
470: p_token2_value => SQLERRM);
471:
472: x_return_status := OKL_API.G_RET_STS_ERROR;
473:
474: END initialize_contract_params;
475:
476: ------------------------------------------------------------------------------
485:
486: ------------------------------------------------------------------------------
487: PROCEDURE get_contract_financed_amount (
488: p_api_version IN NUMBER,
489: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
490: x_return_status OUT NOCOPY VARCHAR2,
491: x_msg_count OUT NOCOPY NUMBER,
492: x_msg_data OUT NOCOPY VARCHAR2,
493: p_contract_id IN NUMBER,
498: get_ctr_fin_amt_failed EXCEPTION;
499:
500:
501: BEGIN
502: x_return_status := OKL_API.G_RET_STS_SUCCESS;
503:
504: print_debug('Executing procedure GET_CONTRACT_FINANCED_AMOUNT using following parameters : ');
505: print_debug(' p_contract_id : '|| p_contract_id );
506: print_debug(' G_CONTRACT_ID : '|| G_CONTRACT_ID );
512: G_CONTRACT_ID <> p_contract_id
513: ) THEN
514: -- Derive Principal Balance
515: Okl_Execute_Formula_Pub.EXECUTE(p_api_version => 1.0,
516: p_init_msg_list => OKL_API.G_FALSE,
517: x_return_status => x_return_status,
518: x_msg_count => x_msg_count,
519: x_msg_data => x_msg_data,
520: p_formula_name => 'CONTRACT_FINANCED_AMOUNT',
522: p_line_id => NULL,
523: x_value => x_principal_balance
524: );
525:
526: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
527: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
528: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
529: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
530: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
524: );
525:
526: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
527: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
528: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
529: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
530: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
531: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
532: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
527: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
528: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
529: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
530: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
531: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
532: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
533: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
534: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
535: RAISE get_ctr_fin_amt_failed;
528: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
529: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
530: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
531: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
532: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
533: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
534: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
535: RAISE get_ctr_fin_amt_failed;
536: END IF;
547:
548: EXCEPTION
549: WHEN get_ctr_fin_amt_failed THEN
550: print_error_message('get_ctr_fin_amt_failed Exception raised in procedure GET_CONTRACT_FINANCED_AMOUNT');
551: x_return_status := OKL_API.G_RET_STS_ERROR;
552:
553: WHEN OTHERS THEN
554: print_error_message('Exception raised in procedure GET_CONTRACT_FINANCED_AMOUNT');
555: Okl_Api.SET_MESSAGE(
551: x_return_status := OKL_API.G_RET_STS_ERROR;
552:
553: WHEN OTHERS THEN
554: print_error_message('Exception raised in procedure GET_CONTRACT_FINANCED_AMOUNT');
555: Okl_Api.SET_MESSAGE(
556: p_app_name => G_APP_NAME,
557: p_msg_name => G_UNEXPECTED_ERROR,
558: p_token1 => G_SQLCODE_TOKEN,
559: p_token1_value => SQLCODE,
559: p_token1_value => SQLCODE,
560: p_token2 => G_SQLERRM_TOKEN,
561: p_token2_value => SQLERRM);
562:
563: x_return_status := OKL_API.G_RET_STS_ERROR;
564:
565: END get_contract_financed_amount;
566:
567: ------------------------------------------------------------------------------
576:
577: ------------------------------------------------------------------------------
578: PROCEDURE get_asset_financed_amount (
579: p_api_version IN NUMBER,
580: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
581: x_return_status OUT NOCOPY VARCHAR2,
582: x_msg_count OUT NOCOPY NUMBER,
583: x_msg_data OUT NOCOPY VARCHAR2,
584: p_contract_id IN NUMBER,
590: get_asset_fin_amt_failed EXCEPTION;
591:
592:
593: BEGIN
594: x_return_status := OKL_API.G_RET_STS_SUCCESS;
595:
596: print_debug('Executing procedure GET_ASSET_FINANCED_AMOUNT using following parameters : ');
597: print_debug(' p_contract_id : '|| p_contract_id );
598: print_debug(' p_line_id : '|| p_line_id );
608: G_FIN_AST_LINE_ID <> p_line_id
609: ) THEN
610: -- Derive Principal Balance
611: Okl_Execute_Formula_Pub.EXECUTE(p_api_version => 1.0,
612: p_init_msg_list => OKL_API.G_FALSE,
613: x_return_status => x_return_status,
614: x_msg_count => x_msg_count,
615: x_msg_data => x_msg_data,
616: p_formula_name => 'CONTRACT_FINANCED_AMOUNT',
618: p_line_id => p_line_id,
619: x_value => x_principal_balance
620: );
621:
622: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
623: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
624: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
625: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
626: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
620: );
621:
622: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
623: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
624: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
625: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
626: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
627: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
628: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
623: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
624: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
625: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
626: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
627: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
628: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
629: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
630: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
631: RAISE get_asset_fin_amt_failed;
624: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
625: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
626: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
627: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
628: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
629: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
630: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
631: RAISE get_asset_fin_amt_failed;
632: END IF;
644:
645: EXCEPTION
646: WHEN get_asset_fin_amt_failed THEN
647: print_error_message('get_asset_fin_amt_failed Exception raised in procedure GET_ASSET_FINANCED_AMOUNT');
648: x_return_status := OKL_API.G_RET_STS_ERROR;
649:
650: WHEN OTHERS THEN
651: print_error_message('Exception raised in procedure GET_ASSET_FINANCED_AMOUNT');
652: Okl_Api.SET_MESSAGE(
648: x_return_status := OKL_API.G_RET_STS_ERROR;
649:
650: WHEN OTHERS THEN
651: print_error_message('Exception raised in procedure GET_ASSET_FINANCED_AMOUNT');
652: Okl_Api.SET_MESSAGE(
653: p_app_name => G_APP_NAME,
654: p_msg_name => G_UNEXPECTED_ERROR,
655: p_token1 => G_SQLCODE_TOKEN,
656: p_token1_value => SQLCODE,
656: p_token1_value => SQLCODE,
657: p_token2 => G_SQLERRM_TOKEN,
658: p_token2_value => SQLERRM);
659:
660: x_return_status := OKL_API.G_RET_STS_ERROR;
661:
662: END get_asset_financed_amount;
663: ------------------------------------------------------------------------------
664: -- PROCEDURE print_report
929: p_advance_or_arrears IN VARCHAR2) RETURN NUMBER IS
930:
931: /* l_api_name CONSTANT VARCHAR2(30) := 'contract_future_rents';
932: l_api_version CONSTANT NUMBER := 1;
933: x_return_status VARCHAR2(1) := Okl_Api.G_RET_STS_SUCCESS;
934: x_msg_count NUMBER;
935: x_msg_data VARCHAR2(256);
936: */
937: l_rents NUMBER := 0;
981:
982: BEGIN
983:
984: IF ( p_chr_id IS NULL OR p_kle_id IS NULL) THEN
985: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
986: END IF;
987:
988: OPEN ln_future_rents_csr(p_chr_id, p_kle_id, p_date, p_advance_or_arrears);
989: FETCH ln_future_rents_csr INTO ln_future_rents_rec;
1000:
1001:
1002: EXCEPTION
1003: WHEN OTHERS THEN
1004: Okl_Api.SET_MESSAGE(
1005: p_app_name => G_APP_NAME,
1006: p_msg_name => G_UNEXPECTED_ERROR,
1007: p_token1 => G_SQLCODE_TOKEN,
1008: p_token1_value => SQLCODE,
1030: p_date IN DATE) RETURN NUMBER IS
1031:
1032: /* l_api_name CONSTANT VARCHAR2(30) := 'RETURN_CONTRACT_FUTURE_INCOME';
1033: l_api_version CONSTANT NUMBER := 1;
1034: x_return_status VARCHAR2(1) := Okl_Api.G_RET_STS_SUCCESS;
1035: x_msg_count NUMBER;
1036: x_msg_data VARCHAR2(256);
1037: */
1038: l_income NUMBER := 0;
1061: l_chr_income_rec l_chr_income_csr%ROWTYPE;
1062: BEGIN
1063:
1064: IF ( p_chr_id IS NULL OR p_kle_id IS NULL) THEN
1065: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
1066: END IF;
1067:
1068: OPEN l_chr_income_csr(p_chr_id, p_kle_id, p_date);
1069: FETCH l_chr_income_csr INTO l_chr_income_rec;
1077:
1078: EXCEPTION
1079:
1080: WHEN OTHERS THEN
1081: Okl_Api.SET_MESSAGE(
1082: p_app_name => G_APP_NAME,
1083: p_msg_name => G_UNEXPECTED_ERROR,
1084: p_token1 => G_SQLCODE_TOKEN,
1085: p_token1_value => SQLCODE,
1107: p_kle_id IN NUMBER) RETURN NUMBER IS
1108:
1109: /* l_api_name CONSTANT VARCHAR2(30) := 'contract_residual_value';
1110: l_api_version CONSTANT NUMBER := 1;
1111: x_return_status VARCHAR2(1) := Okl_Api.G_RET_STS_SUCCESS;
1112: x_msg_count NUMBER;
1113: x_msg_data VARCHAR2(256);
1114: */
1115: l_residual_value NUMBER := 0;
1129: residual_value_rec residual_value_csr%ROWTYPE;
1130: BEGIN
1131:
1132: IF ( p_chr_id IS NULL OR p_kle_id IS NULL ) THEN
1133: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
1134: END IF;
1135:
1136: OPEN residual_value_csr(p_chr_id, p_kle_id);
1137: FETCH residual_value_csr INTO residual_value_rec;
1145:
1146: EXCEPTION
1147:
1148: WHEN OTHERS THEN
1149: Okl_Api.SET_MESSAGE(
1150: p_app_name => G_APP_NAME,
1151: p_msg_name => G_UNEXPECTED_ERROR,
1152: p_token1 => G_SQLCODE_TOKEN,
1153: p_token1_value => SQLCODE,
1174: p_chr_id IN NUMBER) RETURN NUMBER IS
1175:
1176: l_api_name CONSTANT VARCHAR2(30) := 'RETURN_CONTRACT_RESIDUAL_VALUE';
1177: l_api_version CONSTANT NUMBER := 1;
1178: x_return_status VARCHAR2(1) := Okl_Api.G_RET_STS_SUCCESS;
1179: x_msg_count NUMBER;
1180: x_msg_data VARCHAR2(256);
1181:
1182: l_asset_cost NUMBER := 0;
1194: loan_asset_cost_rec loan_asset_cost_csr%ROWTYPE;
1195: BEGIN
1196:
1197: IF ( p_chr_id = NULL ) THEN
1198: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
1199: END IF;
1200:
1201: OPEN loan_asset_cost_csr(p_chr_id);
1202: FETCH loan_asset_cost_csr INTO loan_asset_cost_rec;
1209:
1210: EXCEPTION
1211:
1212: WHEN OTHERS THEN
1213: Okl_Api.SET_MESSAGE(
1214: p_app_name => G_APP_NAME,
1215: p_msg_name => G_UNEXPECTED_ERROR,
1216: p_token1 => G_SQLCODE_TOKEN,
1217: p_token1_value => SQLCODE,
1239: p_date IN DATE) RETURN NUMBER IS
1240:
1241: l_api_name CONSTANT VARCHAR2(30) := 'RETURN_CONTRACT_RESIDUAL_VALUE';
1242: l_api_version CONSTANT NUMBER := 1;
1243: x_return_status VARCHAR2(1) := Okl_Api.G_RET_STS_SUCCESS;
1244: x_msg_count NUMBER;
1245: x_msg_data VARCHAR2(256);
1246:
1247: l_payment_received NUMBER := 0;
1267: Principal_Paid_Rec Principal_Paid_Cur%ROWTYPE;
1268: BEGIN
1269:
1270: IF ( p_chr_id = NULL ) THEN
1271: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
1272: END IF;
1273:
1274: OPEN Principal_Paid_Cur(p_chr_id,p_date);
1275: FETCH Principal_Paid_Cur INTO Principal_Paid_Rec.AMOUNT;
1282:
1283: EXCEPTION
1284:
1285: WHEN OTHERS THEN
1286: Okl_Api.SET_MESSAGE(
1287: p_app_name => G_APP_NAME,
1288: p_msg_name => G_UNEXPECTED_ERROR,
1289: p_token1 => G_SQLCODE_TOKEN,
1290: p_token1_value => SQLCODE,
1311: p_date IN DATE) RETURN NUMBER IS
1312:
1313: l_api_name CONSTANT VARCHAR2(30) := 'RETURN_CONTRACT_RESIDUAL_VALUE';
1314: l_api_version CONSTANT NUMBER := 1;
1315: x_return_status VARCHAR2(1) := Okl_Api.G_RET_STS_SUCCESS;
1316: x_msg_count NUMBER;
1317: x_msg_data VARCHAR2(256);
1318:
1319: l_funding_req NUMBER := 0;
1344: Amount_Funded_Rec Amount_Funded_Cur%ROWTYPE;
1345: BEGIN
1346:
1347: IF ( p_chr_id = NULL ) THEN
1348: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
1349: END IF;
1350:
1351: OPEN Amount_Funded_Cur(p_chr_id,p_date);
1352: FETCH Amount_Funded_Cur INTO Amount_Funded_Rec.AMOUNT;
1359:
1360: EXCEPTION
1361:
1362: WHEN OTHERS THEN
1363: Okl_Api.SET_MESSAGE(
1364: p_app_name => G_APP_NAME,
1365: p_msg_name => G_UNEXPECTED_ERROR,
1366: p_token1 => G_SQLCODE_TOKEN,
1367: p_token1_value => SQLCODE,
1389: p_kle_id IN NUMBER) RETURN NUMBER IS
1390:
1391: /* l_api_name CONSTANT VARCHAR2(30) := 'CONTRACT_RESIDUAL_VALUE';
1392: l_api_version CONSTANT NUMBER := 1;
1393: x_return_status VARCHAR2(1) := Okl_Api.G_RET_STS_SUCCESS;
1394: x_msg_count NUMBER;
1395: x_msg_data VARCHAR2(256);
1396: */
1397: l_net_book_value NUMBER := 0;
1426:
1427: BEGIN
1428:
1429: IF ( p_chr_id = NULL ) THEN
1430: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
1431: END IF;
1432:
1433: print_debug('Asset id :' || p_kle_id);
1434: FOR l_lease_asset_cost_csr IN lease_asset_cost_csr(p_chr_id, p_kle_id)
1453:
1454: EXCEPTION
1455:
1456: WHEN OTHERS THEN
1457: Okl_Api.SET_MESSAGE(
1458: p_app_name => G_APP_NAME,
1459: p_msg_name => G_UNEXPECTED_ERROR,
1460: p_token1 => G_SQLCODE_TOKEN,
1461: p_token1_value => SQLCODE,
1538: and sel.stream_element_date >= p_bal_date;
1539: */
1540: BEGIN
1541: IF ( p_khr_id IS NULL OR p_kle_id IS NULL ) THEN
1542: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
1543: END IF;
1544:
1545: OPEN c_khr_type(p_khr_id);
1546: FETCH c_khr_type INTO c_khr_type_rec.deal_type;
1601: RETURN l_principal_balance;
1602:
1603: EXCEPTION
1604: WHEN OTHERS THEN
1605: --l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
1606: OKL_API.Set_Message(p_app_name => OKL_API.G_APP_NAME,
1607: p_msg_name => 'OKL_UNEXPECTED_ERROR',
1608: p_token1 => 'OKL_SQLCODE',
1609: p_token1_value => SQLCODE,
1602:
1603: EXCEPTION
1604: WHEN OTHERS THEN
1605: --l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
1606: OKL_API.Set_Message(p_app_name => OKL_API.G_APP_NAME,
1607: p_msg_name => 'OKL_UNEXPECTED_ERROR',
1608: p_token1 => 'OKL_SQLCODE',
1609: p_token1_value => SQLCODE,
1610: p_token2 => 'OKL_SQLERRM',
2228: ------------------------------------------------------------
2229:
2230: l_api_version CONSTANT NUMBER := 1;
2231: l_api_name CONSTANT VARCHAR2(30) := 'VARIABLE_INTEREST';
2232: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2233: l_msg_index_out NUMBER;
2234: l_principle_balance NUMBER := 0;
2235: --l_interim_cal_yn BOOLEAN;
2236:
2411: ------------------------------------------------------------
2412: -- Start processing
2413: ------------------------------------------------------------
2414:
2415: x_return_status := OKL_API.G_RET_STS_SUCCESS;
2416:
2417: l_return_status := OKL_API.START_ACTIVITY(
2418: p_api_name => l_api_name,
2419: p_pkg_name => g_pkg_name,
2413: ------------------------------------------------------------
2414:
2415: x_return_status := OKL_API.G_RET_STS_SUCCESS;
2416:
2417: l_return_status := OKL_API.START_ACTIVITY(
2418: p_api_name => l_api_name,
2419: p_pkg_name => g_pkg_name,
2420: p_init_msg_list => p_init_msg_list,
2421: l_api_version => l_api_version,
2422: p_api_version => p_api_version,
2423: p_api_type => '_PVT',
2424: x_return_status => l_return_status);
2425:
2426: IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2427: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2428: ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2429: RAISE OKL_API.G_EXCEPTION_ERROR;
2430: END IF;
2423: p_api_type => '_PVT',
2424: x_return_status => l_return_status);
2425:
2426: IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2427: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2428: ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2429: RAISE OKL_API.G_EXCEPTION_ERROR;
2430: END IF;
2431:
2424: x_return_status => l_return_status);
2425:
2426: IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2427: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2428: ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2429: RAISE OKL_API.G_EXCEPTION_ERROR;
2430: END IF;
2431:
2432: ------------------------------------------------------------
2425:
2426: IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2427: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2428: ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2429: RAISE OKL_API.G_EXCEPTION_ERROR;
2430: END IF;
2431:
2432: ------------------------------------------------------------
2433: -- Initialise local variables
2475: ELSE
2476: FND_FILE.PUT_LINE (FND_FILE.LOG, ' -- ERROR: Could not retrieve Stream Id for purpose VARIABLE_INTEREST.');
2477: END IF;
2478:
2479: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2480: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2481: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2482: RAISE Okl_Api.G_EXCEPTION_ERROR;
2483: END IF;
2476: FND_FILE.PUT_LINE (FND_FILE.LOG, ' -- ERROR: Could not retrieve Stream Id for purpose VARIABLE_INTEREST.');
2477: END IF;
2478:
2479: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2480: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2481: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2482: RAISE Okl_Api.G_EXCEPTION_ERROR;
2483: END IF;
2484:
2477: END IF;
2478:
2479: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2480: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2481: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2482: RAISE Okl_Api.G_EXCEPTION_ERROR;
2483: END IF;
2484:
2485: l_last_interest_cal_date := null;
2478:
2479: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2480: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2481: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2482: RAISE Okl_Api.G_EXCEPTION_ERROR;
2483: END IF;
2484:
2485: l_last_interest_cal_date := null;
2486: lx_rulv_rec := e_rulv_rec; -- Initialize rule record
2529: print_debug('Length of To Due Date: ' || length(p_to_date));
2530: print_debug('Next ReAmort Date: '||c_next_reamort_date_csr.next_reamort_date || ' To Due Date: ' || p_to_date);
2531: IF (trunc(c_next_reamort_date_csr.next_reamort_date) > trunc(nvl(p_to_date, sysdate))) THEN
2532: FND_FILE.PUT_LINE (FND_FILE.OUTPUT, 'Reamort date or contract start date is past the provided end date.');
2533: x_return_status := okl_api.G_RET_STS_SUCCESS;
2534: l_end_of_process := TRUE;
2535: END IF;
2536: END LOOP;
2537: END IF;
2597: FND_FILE.PUT_LINE (FND_FILE.OUTPUT,'Stream Element Date: '|| l_due_date);
2598:
2599: print_debug('Stream Element Date: '||l_due_date);
2600:
2601: x_return_status := OKL_API.G_RET_STS_SUCCESS;
2602: ----------------------------------------------------
2603: -- Create new transaction header for every
2604: -- contract and bill_date combination
2605: ----------------------------------------------------
2631: ,x_msg_data
2632: ,u_taiv_rec
2633: ,r_taiv_rec);
2634:
2635: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2636: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2637: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2638: RAISE Okl_Api.G_EXCEPTION_ERROR;
2639: END IF;
2632: ,u_taiv_rec
2633: ,r_taiv_rec);
2634:
2635: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2636: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2637: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2638: RAISE Okl_Api.G_EXCEPTION_ERROR;
2639: END IF;
2640: print_debug('Updated the TAI record successfully');
2633: ,r_taiv_rec);
2634:
2635: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2636: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2637: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2638: RAISE Okl_Api.G_EXCEPTION_ERROR;
2639: END IF;
2640: print_debug('Updated the TAI record successfully');
2641: FND_FILE.PUT_LINE (FND_FILE.OUTPUT,'Updated the TAI record successfully');
2634:
2635: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2636: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2637: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2638: RAISE Okl_Api.G_EXCEPTION_ERROR;
2639: END IF;
2640: print_debug('Updated the TAI record successfully');
2641: FND_FILE.PUT_LINE (FND_FILE.OUTPUT,'Updated the TAI record successfully');
2642: COMMIT;
2689: ELSE
2690: FND_FILE.PUT_LINE (FND_FILE.LOG, ' -- ERROR: Creating Internal TXN Header.');
2691: END IF;
2692:
2693: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2694: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2695: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2696: RAISE Okl_Api.G_EXCEPTION_ERROR;
2697: END IF;
2690: FND_FILE.PUT_LINE (FND_FILE.LOG, ' -- ERROR: Creating Internal TXN Header.');
2691: END IF;
2692:
2693: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2694: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2695: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2696: RAISE Okl_Api.G_EXCEPTION_ERROR;
2697: END IF;
2698:
2691: END IF;
2692:
2693: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2694: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2695: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2696: RAISE Okl_Api.G_EXCEPTION_ERROR;
2697: END IF;
2698:
2699: ---------------------------------------------
2692:
2693: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2694: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2695: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2696: RAISE Okl_Api.G_EXCEPTION_ERROR;
2697: END IF;
2698:
2699: ---------------------------------------------
2700: -- Adjust header variables
2733: ,x_msg_data
2734: ,u_tilv_rec
2735: ,r_tilv_rec);
2736:
2737: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2738: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2739: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2740: RAISE Okl_Api.G_EXCEPTION_ERROR;
2741: END IF;
2734: ,u_tilv_rec
2735: ,r_tilv_rec);
2736:
2737: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2738: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2739: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2740: RAISE Okl_Api.G_EXCEPTION_ERROR;
2741: END IF;
2742:
2735: ,r_tilv_rec);
2736:
2737: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2738: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2739: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2740: RAISE Okl_Api.G_EXCEPTION_ERROR;
2741: END IF;
2742:
2743: END IF;
2736:
2737: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2738: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2739: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2740: RAISE Okl_Api.G_EXCEPTION_ERROR;
2741: END IF;
2742:
2743: END IF;
2744:
2789: ELSE
2790: FND_FILE.PUT_LINE (FND_FILE.LOG, ' -- ERROR: Creating Internal TXN Line.');
2791: END IF;
2792:
2793: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2794: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2795: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2796: RAISE Okl_Api.G_EXCEPTION_ERROR;
2797: END IF;
2790: FND_FILE.PUT_LINE (FND_FILE.LOG, ' -- ERROR: Creating Internal TXN Line.');
2791: END IF;
2792:
2793: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2794: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2795: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2796: RAISE Okl_Api.G_EXCEPTION_ERROR;
2797: END IF;
2798:
2791: END IF;
2792:
2793: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2794: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2795: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2796: RAISE Okl_Api.G_EXCEPTION_ERROR;
2797: END IF;
2798:
2799: ---------------------------------------------
2792:
2793: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
2794: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
2795: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
2796: RAISE Okl_Api.G_EXCEPTION_ERROR;
2797: END IF;
2798:
2799: ---------------------------------------------
2800: -- Adjust line variables
2893: print_debug (' -- Error: '||x_msg_data);
2894: FND_FILE.PUT_LINE (FND_FILE.OUTPUT,' -- Error: '||x_msg_data);
2895: END IF;
2896:
2897: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2898: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2899: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
2900: RAISE OKL_API.G_EXCEPTION_ERROR;
2901: END IF;
2894: FND_FILE.PUT_LINE (FND_FILE.OUTPUT,' -- Error: '||x_msg_data);
2895: END IF;
2896:
2897: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2898: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2899: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
2900: RAISE OKL_API.G_EXCEPTION_ERROR;
2901: END IF;
2902:
2895: END IF;
2896:
2897: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2898: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2899: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
2900: RAISE OKL_API.G_EXCEPTION_ERROR;
2901: END IF;
2902:
2903: print_debug ('Stm ID: '||lx_stmv_rec.id);
2896:
2897: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2898: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2899: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
2900: RAISE OKL_API.G_EXCEPTION_ERROR;
2901: END IF;
2902:
2903: print_debug ('Stm ID: '||lx_stmv_rec.id);
2904: l_selv_rec.stm_id := lx_stmv_rec.id;
2943: FND_FILE.PUT_LINE (FND_FILE.OUTPUT,' -- Error in Creating Stream'||x_msg_data);
2944: END IF;
2945:
2946:
2947: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2948: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2949: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
2950: RAISE OKL_API.G_EXCEPTION_ERROR;
2951: END IF;
2944: END IF;
2945:
2946:
2947: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2948: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2949: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
2950: RAISE OKL_API.G_EXCEPTION_ERROR;
2951: END IF;
2952:
2945:
2946:
2947: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2948: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2949: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
2950: RAISE OKL_API.G_EXCEPTION_ERROR;
2951: END IF;
2952:
2953: ---------------------------------------------
2946:
2947: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2948: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2949: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
2950: RAISE OKL_API.G_EXCEPTION_ERROR;
2951: END IF;
2952:
2953: ---------------------------------------------
2954: -- Insert record in IPM
3026: print_debug('Message Index: '||l_msg_index_out);
3027: END LOOP;
3028: END IF;
3029:
3030: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
3031: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
3032: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
3033: RAISE Okl_Api.G_EXCEPTION_ERROR;
3034: END IF;
3027: END LOOP;
3028: END IF;
3029:
3030: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
3031: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
3032: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
3033: RAISE Okl_Api.G_EXCEPTION_ERROR;
3034: END IF;
3035:
3028: END IF;
3029:
3030: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
3031: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
3032: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
3033: RAISE Okl_Api.G_EXCEPTION_ERROR;
3034: END IF;
3035:
3036: l_bpd_acc_rec.id := r_tldv_rec.id;
3029:
3030: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
3031: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
3032: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
3033: RAISE Okl_Api.G_EXCEPTION_ERROR;
3034: END IF;
3035:
3036: l_bpd_acc_rec.id := r_tldv_rec.id;
3037: l_bpd_acc_rec.source_table := 'OKL_TXD_AR_LN_DTLS_B';
3067: END LOOP;
3068: END IF;
3069:
3070:
3071: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
3072: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
3073: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
3074: RAISE Okl_Api.G_EXCEPTION_ERROR;
3075: END IF;
3068: END IF;
3069:
3070:
3071: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
3072: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
3073: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
3074: RAISE Okl_Api.G_EXCEPTION_ERROR;
3075: END IF;
3076:
3069:
3070:
3071: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
3072: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
3073: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
3074: RAISE Okl_Api.G_EXCEPTION_ERROR;
3075: END IF;
3076:
3077: ----------------------------------------------------
3070:
3071: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
3072: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
3073: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
3074: RAISE Okl_Api.G_EXCEPTION_ERROR;
3075: END IF;
3076:
3077: ----------------------------------------------------
3078: -- Adjust line variables
3107: print_debug ('End Processing for Contract Number: ' ||r_contracts_csr.contract_number);
3108: END LOOP;
3109: print_debug('***End of Processing***');
3110:
3111: OKL_API.END_ACTIVITY (x_msg_count, x_msg_data);
3112:
3113: EXCEPTION
3114: ------------------------------------------------------------
3115: -- Exception handling
3114: ------------------------------------------------------------
3115: -- Exception handling
3116: ------------------------------------------------------------
3117:
3118: WHEN OKL_API.G_EXCEPTION_ERROR THEN
3119: x_return_status := OKL_API.HANDLE_EXCEPTIONS (
3120: p_api_name => l_api_name,
3121: p_pkg_name => G_PKG_NAME,
3122: p_exc_name => 'OKL_API.G_RET_STS_ERROR',
3115: -- Exception handling
3116: ------------------------------------------------------------
3117:
3118: WHEN OKL_API.G_EXCEPTION_ERROR THEN
3119: x_return_status := OKL_API.HANDLE_EXCEPTIONS (
3120: p_api_name => l_api_name,
3121: p_pkg_name => G_PKG_NAME,
3122: p_exc_name => 'OKL_API.G_RET_STS_ERROR',
3123: x_msg_count => x_msg_count,
3118: WHEN OKL_API.G_EXCEPTION_ERROR THEN
3119: x_return_status := OKL_API.HANDLE_EXCEPTIONS (
3120: p_api_name => l_api_name,
3121: p_pkg_name => G_PKG_NAME,
3122: p_exc_name => 'OKL_API.G_RET_STS_ERROR',
3123: x_msg_count => x_msg_count,
3124: x_msg_data => x_msg_data,
3125: p_api_type => '_PVT');
3126:
3123: x_msg_count => x_msg_count,
3124: x_msg_data => x_msg_data,
3125: p_api_type => '_PVT');
3126:
3127: WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3128: x_return_status := OKL_API.HANDLE_EXCEPTIONS (
3129: p_api_name => l_api_name,
3130: p_pkg_name => G_PKG_NAME,
3131: p_exc_name => 'OKL_API.G_RET_STS_UNEXP_ERROR',
3124: x_msg_data => x_msg_data,
3125: p_api_type => '_PVT');
3126:
3127: WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3128: x_return_status := OKL_API.HANDLE_EXCEPTIONS (
3129: p_api_name => l_api_name,
3130: p_pkg_name => G_PKG_NAME,
3131: p_exc_name => 'OKL_API.G_RET_STS_UNEXP_ERROR',
3132: x_msg_count => x_msg_count,
3127: WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3128: x_return_status := OKL_API.HANDLE_EXCEPTIONS (
3129: p_api_name => l_api_name,
3130: p_pkg_name => G_PKG_NAME,
3131: p_exc_name => 'OKL_API.G_RET_STS_UNEXP_ERROR',
3132: x_msg_count => x_msg_count,
3133: x_msg_data => x_msg_data,
3134: p_api_type => '_PVT');
3135:
3133: x_msg_data => x_msg_data,
3134: p_api_type => '_PVT');
3135:
3136: WHEN OTHERS THEN
3137: x_return_status := OKL_API.HANDLE_EXCEPTIONS (
3138: p_api_name => l_api_name,
3139: p_pkg_name => G_PKG_NAME,
3140: p_exc_name => 'OTHERS',
3141: x_msg_count => x_msg_count,
3435:
3436: ------------------------------------------------------------------------------
3437: PROCEDURE principal_date_range_loan (
3438: p_api_version IN NUMBER,
3439: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
3440: x_return_status OUT NOCOPY VARCHAR2,
3441: x_msg_count OUT NOCOPY NUMBER,
3442: x_msg_data OUT NOCOPY VARCHAR2,
3443: p_contract_id IN NUMBER,
3601: , sel_ln_pmt.stream_element_date
3602: ORDER BY raa.apply_date asc;
3603:
3604: BEGIN
3605: x_return_status := OKL_API.G_RET_STS_SUCCESS;
3606:
3607: OPEN principal_basis_csr (p_contract_id, l_effective_date);
3608: FETCH principal_basis_csr INTO l_principal_basis;
3609: IF principal_basis_csr%NOTFOUND THEN
3621: CLOSE contract_csr;
3622:
3623: -- Derive Principal Balance
3624: Okl_Execute_Formula_Pub.EXECUTE(p_api_version => 1.0,
3625: p_init_msg_list => OKL_API.G_TRUE,
3626: x_return_status => x_return_status,
3627: x_msg_count => x_msg_count,
3628: x_msg_data => x_msg_data,
3629: p_formula_name => 'CONTRACT_FINANCED_AMOUNT',
3631: p_line_id => p_line_id,
3632: x_value => l_principal_balance
3633: );
3634:
3635: IF (x_return_status <> Okl_Api.G_RET_STS_SUCCESS) THEN
3636: NULL;
3637: -- raise exception;
3638: END IF;
3639:
3819:
3820: EXCEPTION
3821:
3822: WHEN OTHERS THEN
3823: Okl_Api.SET_MESSAGE(
3824: p_app_name => G_APP_NAME,
3825: p_msg_name => G_UNEXPECTED_ERROR,
3826: p_token1 => G_SQLCODE_TOKEN,
3827: p_token1_value => SQLCODE,
3844:
3845: ------------------------------------------------------------------------------
3846: PROCEDURE principal_date_range_rev_loan (
3847: p_api_version IN NUMBER,
3848: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
3849: x_return_status OUT NOCOPY VARCHAR2,
3850: x_msg_count OUT NOCOPY NUMBER,
3851: x_msg_data OUT NOCOPY VARCHAR2,
3852: p_contract_id IN NUMBER,
3983: AND sty.stream_type_purpose IN ('VARIABLE_LOAN_PAYMENT','UNSCHEDULED_LOAN_PAYMENT')
3984: GROUP BY raa.apply_date
3985: ORDER BY txn_date asc;
3986: BEGIN
3987: x_return_status := OKL_API.G_RET_STS_SUCCESS;
3988:
3989: OPEN contract_csr (p_contract_id);
3990: FETCH contract_csr INTO l_contract_start_date, l_currency_code;
3991: IF (contract_csr%NOTFOUND) THEN
4087:
4088: EXCEPTION
4089:
4090: WHEN OTHERS THEN
4091: Okl_Api.SET_MESSAGE(
4092: p_app_name => G_APP_NAME,
4093: p_msg_name => G_UNEXPECTED_ERROR,
4094: p_token1 => G_SQLCODE_TOKEN,
4095: p_token1_value => SQLCODE,
4135: l_index := p_principal_balance_tbl.NEXT(l_index);
4136: END LOOP;
4137: EXCEPTION
4138: WHEN OTHERS THEN
4139: Okl_Api.SET_MESSAGE(
4140: p_app_name => G_APP_NAME,
4141: p_msg_name => G_UNEXPECTED_ERROR,
4142: p_token1 => G_SQLCODE_TOKEN,
4143: p_token1_value => SQLCODE,
4177:
4178: ------------------------------------------------------------------------------
4179: PROCEDURE prin_date_range_var_int_loan (
4180: p_api_version IN NUMBER,
4181: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
4182: x_return_status OUT NOCOPY VARCHAR2,
4183: x_msg_count OUT NOCOPY NUMBER,
4184: x_msg_data OUT NOCOPY VARCHAR2,
4185: p_contract_id IN NUMBER,
4384: ORDER BY receipt_date asc;
4385:
4386:
4387: BEGIN
4388: x_return_status := OKL_API.G_RET_STS_SUCCESS;
4389:
4390: print_debug('Executing procedure PRIN_DATE_RANGE_VAR_INT_LOAN using following parameters : ');
4391: print_debug(' p_contract_id : '|| p_contract_id );
4392: print_debug(' p_line_id : '|| p_line_id );
4394: print_debug(' p_due_date : '|| to_char(p_due_date));
4395: print_debug(' p_principal_basis : '|| p_principal_basis);
4396:
4397: Initialize_contract_params( p_api_version => 1.0,
4398: p_init_msg_list => OKL_API.G_FALSE,
4399: x_return_status => x_return_status,
4400: x_msg_count => x_msg_count,
4401: x_msg_data => x_msg_data,
4402: p_contract_id => p_contract_id
4400: x_msg_count => x_msg_count,
4401: x_msg_data => x_msg_data,
4402: p_contract_id => p_contract_id
4403: );
4404: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
4405: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
4406: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4407: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4408: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4402: p_contract_id => p_contract_id
4403: );
4404: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
4405: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
4406: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4407: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4408: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4409: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4410: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4405: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
4406: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4407: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4408: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4409: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4410: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4411: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
4412: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
4413: RAISE prin_date_range_loan_failed;
4406: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4407: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4408: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4409: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4410: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4411: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
4412: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
4413: RAISE prin_date_range_loan_failed;
4414: END IF;
4451: IF (l_principal_basis = 'ACTUAL') THEN
4452: /*
4453: -- Derive Principal Balance
4454: Okl_Execute_Formula_Pub.EXECUTE(p_api_version => 1.0,
4455: p_init_msg_list => OKL_API.G_TRUE,
4456: x_return_status => x_return_status,
4457: x_msg_count => x_msg_count,
4458: x_msg_data => x_msg_data,
4459: p_formula_name => 'CONTRACT_FINANCED_AMOUNT',
4461: p_line_id => p_line_id,
4462: x_value => l_principal_balance
4463: );
4464:
4465: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
4466: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
4467: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4468: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
4469: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
4463: );
4464:
4465: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
4466: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
4467: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4468: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
4469: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
4470: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4471: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4466: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
4467: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4468: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
4469: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
4470: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4471: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4472: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
4473: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
4474: RAISE prin_date_range_loan_failed;
4467: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4468: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
4469: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
4470: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4471: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4472: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
4473: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
4474: RAISE prin_date_range_loan_failed;
4475: END IF;
4476: */
4477: IF (p_line_id IS NULL) THEN
4478: get_contract_financed_amount (
4479: p_api_version => 1.0,
4480: p_init_msg_list => OKL_API.G_FALSE,
4481: x_return_status => x_return_status,
4482: x_msg_count => x_msg_count,
4483: x_msg_data => x_msg_data,
4484: p_contract_id => p_contract_id,
4483: x_msg_data => x_msg_data,
4484: p_contract_id => p_contract_id,
4485: x_principal_balance => l_principal_balance);
4486:
4487: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
4488: print_debug ('Procedure GET_CONTRACT_FINANCED_AMOUNT completed successfully');
4489: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4490: print_debug ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned unexpected error');
4491: print_error_message ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned unexpected error');
4485: x_principal_balance => l_principal_balance);
4486:
4487: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
4488: print_debug ('Procedure GET_CONTRACT_FINANCED_AMOUNT completed successfully');
4489: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4490: print_debug ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned unexpected error');
4491: print_error_message ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned unexpected error');
4492: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4493: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4488: print_debug ('Procedure GET_CONTRACT_FINANCED_AMOUNT completed successfully');
4489: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4490: print_debug ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned unexpected error');
4491: print_error_message ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned unexpected error');
4492: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4493: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4494: print_debug ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned exception');
4495: print_error_message ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned exception');
4496: RAISE prin_date_range_loan_failed;
4489: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4490: print_debug ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned unexpected error');
4491: print_error_message ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned unexpected error');
4492: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4493: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4494: print_debug ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned exception');
4495: print_error_message ('Procedure GET_CONTRACT_FINANCED_AMOUNT returned exception');
4496: RAISE prin_date_range_loan_failed;
4497: END IF;
4497: END IF;
4498: ELSE
4499: get_asset_financed_amount (
4500: p_api_version => 1.0,
4501: p_init_msg_list => OKL_API.G_FALSE,
4502: x_return_status => x_return_status,
4503: x_msg_count => x_msg_count,
4504: x_msg_data => x_msg_data,
4505: p_contract_id => p_contract_id,
4505: p_contract_id => p_contract_id,
4506: p_line_id => p_line_id,
4507: x_principal_balance => l_principal_balance);
4508:
4509: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
4510: print_debug ('Procedure GET_ASSET_FINANCED_AMOUNT completed successfully');
4511: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4512: print_debug ('Procedure GET_ASSET_FINANCED_AMOUNT returned unexpected error');
4513: print_error_message ('Procedure GET_ASSET_FINANCED_AMOUNT returned unexpected error');
4507: x_principal_balance => l_principal_balance);
4508:
4509: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
4510: print_debug ('Procedure GET_ASSET_FINANCED_AMOUNT completed successfully');
4511: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4512: print_debug ('Procedure GET_ASSET_FINANCED_AMOUNT returned unexpected error');
4513: print_error_message ('Procedure GET_ASSET_FINANCED_AMOUNT returned unexpected error');
4514: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4515: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4510: print_debug ('Procedure GET_ASSET_FINANCED_AMOUNT completed successfully');
4511: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4512: print_debug ('Procedure GET_ASSET_FINANCED_AMOUNT returned unexpected error');
4513: print_error_message ('Procedure GET_ASSET_FINANCED_AMOUNT returned unexpected error');
4514: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4515: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4516: print_debug ('Procedure GET_ASSET_FINANCED_AMOUNT returned exception');
4517: print_error_message ('Procedure GET_ASSET_FINANCED_AMOUNT returned exception');
4518: RAISE prin_date_range_loan_failed;
4511: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4512: print_debug ('Procedure GET_ASSET_FINANCED_AMOUNT returned unexpected error');
4513: print_error_message ('Procedure GET_ASSET_FINANCED_AMOUNT returned unexpected error');
4514: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4515: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4516: print_debug ('Procedure GET_ASSET_FINANCED_AMOUNT returned exception');
4517: print_error_message ('Procedure GET_ASSET_FINANCED_AMOUNT returned exception');
4518: RAISE prin_date_range_loan_failed;
4519: END IF;
4744:
4745: EXCEPTION
4746: WHEN prin_date_range_loan_failed THEN
4747: print_error_message('prin_date_range_loan_failed Exception Raised in procedure PRIN_DATE_RANGE_VAR_INT_LOAN ');
4748: x_return_status := OKL_API.G_RET_STS_ERROR;
4749: WHEN OTHERS THEN
4750: print_error_message('Exception Raised in procedure PRIN_DATE_RANGE_VAR_INT_LOAN ');
4751: Okl_Api.SET_MESSAGE(
4752: p_app_name => G_APP_NAME,
4747: print_error_message('prin_date_range_loan_failed Exception Raised in procedure PRIN_DATE_RANGE_VAR_INT_LOAN ');
4748: x_return_status := OKL_API.G_RET_STS_ERROR;
4749: WHEN OTHERS THEN
4750: print_error_message('Exception Raised in procedure PRIN_DATE_RANGE_VAR_INT_LOAN ');
4751: Okl_Api.SET_MESSAGE(
4752: p_app_name => G_APP_NAME,
4753: p_msg_name => G_UNEXPECTED_ERROR,
4754: p_token1 => G_SQLCODE_TOKEN,
4755: p_token1_value => SQLCODE,
4754: p_token1 => G_SQLCODE_TOKEN,
4755: p_token1_value => SQLCODE,
4756: p_token2 => G_SQLERRM_TOKEN,
4757: p_token2_value => SQLERRM);
4758: x_return_status := OKL_API.G_RET_STS_ERROR;
4759: END prin_date_range_var_int_loan;
4760:
4761: ------------------------------------------------------------------------------
4762:
4773:
4774: ------------------------------------------------------------------------------
4775: PROCEDURE prin_date_range_var_int_rloan (
4776: p_api_version IN NUMBER,
4777: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
4778: x_return_status OUT NOCOPY VARCHAR2,
4779: x_msg_count OUT NOCOPY NUMBER,
4780: x_msg_data OUT NOCOPY VARCHAR2,
4781: p_contract_id IN NUMBER,
4906: -- End - Billing Inline changes - Bug#5898792 - varangan - 23/2/2007
4907:
4908:
4909: BEGIN
4910: x_return_status := OKL_API.G_RET_STS_SUCCESS;
4911:
4912: print_debug('Executing procedure PRIN_DATE_RANGE_VAR_INT_RLOAN using following parameters : ');
4913: print_debug(' p_contract_id : '|| p_contract_id);
4914: print_debug(' p_line_id : '|| p_line_id );
4914: print_debug(' p_line_id : '|| p_line_id );
4915: print_debug(' p_due_date : '|| to_char(p_due_date));
4916:
4917: Initialize_contract_params( p_api_version => 1.0,
4918: p_init_msg_list => OKL_API.G_FALSE,
4919: x_return_status => x_return_status,
4920: x_msg_count => x_msg_count,
4921: x_msg_data => x_msg_data,
4922: p_contract_id => p_contract_id
4920: x_msg_count => x_msg_count,
4921: x_msg_data => x_msg_data,
4922: p_contract_id => p_contract_id
4923: );
4924: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
4925: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
4926: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4927: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4928: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4922: p_contract_id => p_contract_id
4923: );
4924: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
4925: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
4926: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4927: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4928: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4929: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4930: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4925: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
4926: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4927: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4928: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4929: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4930: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4931: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
4932: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
4933: RAISE prin_date_range_rloan_failed;
4926: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
4927: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4928: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
4929: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
4930: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
4931: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
4932: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
4933: RAISE prin_date_range_rloan_failed;
4934: END IF;
5146:
5147: EXCEPTION
5148: WHEN prin_date_range_rloan_failed THEN
5149: print_error_message('print_date_range_rloan_failed Exception raised inside procedure PRIN_DATE_RANGE_VAR_INT_RLOAN');
5150: x_return_status := OKL_API.G_RET_STS_ERROR;
5151:
5152: WHEN OTHERS THEN
5153: print_error_message('Exception raised inside procedure PRIN_DATE_RANGE_VAR_INT_RLOAN');
5154: Okl_Api.SET_MESSAGE(
5150: x_return_status := OKL_API.G_RET_STS_ERROR;
5151:
5152: WHEN OTHERS THEN
5153: print_error_message('Exception raised inside procedure PRIN_DATE_RANGE_VAR_INT_RLOAN');
5154: Okl_Api.SET_MESSAGE(
5155: p_app_name => G_APP_NAME,
5156: p_msg_name => G_UNEXPECTED_ERROR,
5157: p_token1 => G_SQLCODE_TOKEN,
5158: p_token1_value => SQLCODE,
5158: p_token1_value => SQLCODE,
5159: p_token2 => G_SQLERRM_TOKEN,
5160: p_token2_value => SQLERRM);
5161:
5162: x_return_status := OKL_API.G_RET_STS_ERROR;
5163:
5164: END prin_date_range_var_int_rloan;
5165:
5166: ------------------------------------------------------------------------------
5193:
5194: ------------------------------------------------------------------------------
5195: PROCEDURE prin_date_range_var_rate_ctr (
5196: p_api_version IN NUMBER,
5197: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
5198: x_return_status OUT NOCOPY VARCHAR2,
5199: x_msg_count OUT NOCOPY NUMBER,
5200: x_msg_data OUT NOCOPY VARCHAR2,
5201: p_contract_id IN NUMBER,
5218: WHERE id = p_contract_id;
5219:
5220:
5221: BEGIN
5222: x_return_status := OKL_API.G_RET_STS_SUCCESS;
5223:
5224: print_debug('Executing procedure PRIN_DATE_RANGE_VAR_RATE_CTR using following parameters : ');
5225: print_debug(' p_contract_id : '|| p_contract_id );
5226: print_debug(' p_line_id : '|| p_line_id );
5246:
5247: IF (l_deal_type = 'LOAN') THEN
5248: prin_date_range_var_int_loan (
5249: p_api_version => 1.0,
5250: p_init_msg_list => OKL_API.G_FALSE,
5251: x_return_status => x_return_status,
5252: x_msg_count => x_msg_count,
5253: x_msg_data => x_msg_data,
5254: p_contract_id => p_contract_id,
5257: p_due_date => p_due_date,
5258: p_principal_basis => p_principal_basis,
5259: x_principal_balance_tbl => r_principal_balance_tbl);
5260:
5261: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
5262: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_INT_LOAN');
5263: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
5264: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
5265: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_INT_LOAN');
5259: x_principal_balance_tbl => r_principal_balance_tbl);
5260:
5261: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
5262: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_INT_LOAN');
5263: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
5264: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
5265: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_INT_LOAN');
5266: RAISE prin_date_range_failed;
5267: END IF;
5260:
5261: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
5262: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_INT_LOAN');
5263: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
5264: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
5265: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_INT_LOAN');
5266: RAISE prin_date_range_failed;
5267: END IF;
5268:
5268:
5269: ELSIF (l_deal_type = 'LOAN-REVOLVING') THEN
5270: prin_date_range_var_int_rloan (
5271: p_api_version => 1.0,
5272: p_init_msg_list => OKL_API.G_FALSE,
5273: x_return_status => x_return_status,
5274: x_msg_count => x_msg_count,
5275: x_msg_data => x_msg_data,
5276: p_contract_id => p_contract_id,
5277: p_line_id => p_line_id,
5278: p_start_date => p_start_date,
5279: p_due_date => p_due_date,
5280: x_principal_balance_tbl => r_principal_balance_tbl);
5281: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
5282: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_INT_RLOAN');
5283: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
5284: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
5285: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_INT_LOAN');
5279: p_due_date => p_due_date,
5280: x_principal_balance_tbl => r_principal_balance_tbl);
5281: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
5282: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_INT_RLOAN');
5283: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
5284: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
5285: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_INT_LOAN');
5286: RAISE prin_date_range_failed;
5287: END IF;
5280: x_principal_balance_tbl => r_principal_balance_tbl);
5281: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
5282: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_INT_RLOAN');
5283: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
5284: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
5285: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_INT_LOAN');
5286: RAISE prin_date_range_failed;
5287: END IF;
5288: END IF;
5291:
5292: EXCEPTION
5293: WHEN prin_date_range_failed THEN
5294: print_error_message('prin_date_range_failed Exception raised in procedure PRIN_DATE_RANGE_VAR_INT_CTR');
5295: x_return_status := OKL_API.G_RET_STS_ERROR;
5296:
5297: WHEN OTHERS THEN
5298: print_error_message('Exception raised in procedure PRIN_DATE_RANGE_VAR_INT_CTR');
5299: Okl_Api.SET_MESSAGE(
5295: x_return_status := OKL_API.G_RET_STS_ERROR;
5296:
5297: WHEN OTHERS THEN
5298: print_error_message('Exception raised in procedure PRIN_DATE_RANGE_VAR_INT_CTR');
5299: Okl_Api.SET_MESSAGE(
5300: p_app_name => G_APP_NAME,
5301: p_msg_name => G_UNEXPECTED_ERROR,
5302: p_token1 => G_SQLCODE_TOKEN,
5303: p_token1_value => SQLCODE,
5303: p_token1_value => SQLCODE,
5304: p_token2 => G_SQLERRM_TOKEN,
5305: p_token2_value => SQLERRM);
5306:
5307: x_return_status := OKL_API.G_RET_STS_ERROR;
5308:
5309: END prin_date_range_var_rate_ctr;
5310: ------------------------------------------------------------------------------
5311: FUNCTION get_last_int_calc_date(p_khr_id IN NUMBER) RETURN DATE IS
5339: END;
5340: ------------------------------------------------------------------------------
5341: PROCEDURE interest_date_range (
5342: p_api_version IN NUMBER,
5343: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
5344: x_return_status OUT NOCOPY VARCHAR2,
5345: x_msg_count OUT NOCOPY NUMBER,
5346: x_msg_data OUT NOCOPY VARCHAR2,
5347: p_contract_id IN NUMBER,
5354: -----------------------------------------------------------------
5355: -- Declare Process Variable
5356: -----------------------------------------------------------------
5357: l_api_name CONSTANT VARCHAR2(30) := 'interest_date_range';
5358: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
5359:
5360: l_interest_rate_tbl interest_rate_tbl_type;
5361: l_start_date DATE;
5362: l_end_date DATE;
5506: print_debug('exit procedure get_eff_int_rate');
5507: x_eff_int_tbl := l_eff_int_tbl;
5508: EXCEPTION
5509: WHEN OTHERS THEN
5510: OKL_API.SET_MESSAGE( p_app_name => G_APP_NAME
5511: ,p_msg_name => G_UNEXPECTED_ERROR
5512: ,p_token1 => G_SQLCODE_TOKEN
5513: ,p_token1_value => SQLCODE
5514: ,p_token2 => G_SQLERRM_TOKEN
5573: print_debug('exiting function get_next_rate_change_date');
5574: RETURN l_next_rate_change_date;
5575: EXCEPTION
5576: WHEN OTHERS THEN
5577: OKL_API.SET_MESSAGE( p_app_name => G_APP_NAME
5578: ,p_msg_name => G_UNEXPECTED_ERROR
5579: ,p_token1 => G_SQLCODE_TOKEN
5580: ,p_token1_value => SQLCODE
5581: ,p_token2 => G_SQLERRM_TOKEN
5674: x_eff_int_with_tol_tbl := l_eff_int_with_tol_tbl;
5675: print_debug('exiting procedure apply_tolerance');
5676: EXCEPTION
5677: WHEN OTHERS THEN
5678: OKL_API.SET_MESSAGE( p_app_name => G_APP_NAME
5679: ,p_msg_name => G_UNEXPECTED_ERROR
5680: ,p_token1 => G_SQLCODE_TOKEN
5681: ,p_token1_value => SQLCODE
5682: ,p_token2 => G_SQLERRM_TOKEN
6072: x_return_status := l_return_status;
6073: Exception
6074: WHEN OTHERS THEN
6075: print_debug('sqlcode : ' || sqlcode || ' $ sqlerrm : ' || sqlerrm);
6076: x_return_status := OKL_API.HANDLE_EXCEPTIONS (
6077: p_api_name => l_api_name,
6078: p_pkg_name => G_PKG_NAME,
6079: p_exc_name => 'OTHERS',
6080: x_msg_count => x_msg_count,
6086: ------------------------------------------------------------------------------
6087:
6088: PROCEDURE interest_date_range (
6089: p_api_version IN NUMBER,
6090: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
6091: x_return_status OUT NOCOPY VARCHAR2,
6092: x_msg_count OUT NOCOPY NUMBER,
6093: x_msg_data OUT NOCOPY VARCHAR2,
6094: p_contract_id IN NUMBER,
6100: -----------------------------------------------------------------
6101: -- Declare Process Variable
6102: -----------------------------------------------------------------
6103: l_api_name CONSTANT VARCHAR2(30) := 'interest_date_range';
6104: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
6105:
6106: l_interest_rate_tbl interest_rate_tbl_type;
6107: l_interest_rate_tbl_out interest_rate_tbl_type;
6108: l_int_tbl_row NUMBER := 0;
6137: print_debug('end_date: ' || cur_param_rate.end_date);
6138: print_debug('rate_param_rowid: ' || cur_param_rate.rate_param_rowid);
6139: interest_date_range (
6140: p_api_version => 1.0,
6141: p_init_msg_list => OKL_API.G_FALSE,
6142: x_return_status => x_return_status,
6143: x_msg_count => x_msg_count,
6144: x_msg_data => x_msg_data,
6145: p_contract_id => p_contract_id,
6148: p_process_flag => p_process_flag,
6149: p_rate_param_rowid => cur_param_rate.rate_param_rowid,
6150: x_interest_rate_tbl => l_interest_rate_tbl);
6151:
6152: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6153: print_error_message('Unexpected error raised in call to INTEREST_DATE_RANGE');
6154: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6155: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6156: print_error_message('Error raised in call to INTEREST_DATE_RANGE');
6150: x_interest_rate_tbl => l_interest_rate_tbl);
6151:
6152: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6153: print_error_message('Unexpected error raised in call to INTEREST_DATE_RANGE');
6154: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6155: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6156: print_error_message('Error raised in call to INTEREST_DATE_RANGE');
6157: RAISE Okl_Api.G_EXCEPTION_ERROR;
6158: END IF;
6151:
6152: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6153: print_error_message('Unexpected error raised in call to INTEREST_DATE_RANGE');
6154: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6155: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6156: print_error_message('Error raised in call to INTEREST_DATE_RANGE');
6157: RAISE Okl_Api.G_EXCEPTION_ERROR;
6158: END IF;
6159:
6153: print_error_message('Unexpected error raised in call to INTEREST_DATE_RANGE');
6154: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6155: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6156: print_error_message('Error raised in call to INTEREST_DATE_RANGE');
6157: RAISE Okl_Api.G_EXCEPTION_ERROR;
6158: END IF;
6159:
6160: print_debug('count in l_interest_rate_tbl: ' || l_interest_rate_tbl.count);
6161: l_int_tbl_row := l_interest_rate_tbl.first;
6174: print_debug('exiting procedure interest_date_range outer');
6175: Exception
6176: WHEN OTHERS THEN
6177: print_debug('sqlcode : ' || sqlcode || ' $ sqlerrm : ' || sqlerrm);
6178: x_return_status := OKL_API.HANDLE_EXCEPTIONS (
6179: p_api_name => l_api_name,
6180: p_pkg_name => G_PKG_NAME,
6181: p_exc_name => 'OTHERS',
6182: x_msg_count => x_msg_count,
6199:
6200: ------------------------------------------------------------------------------
6201: Function calculate_interest (
6202: p_api_version IN NUMBER,
6203: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
6204: x_return_status OUT NOCOPY VARCHAR2,
6205: x_msg_count OUT NOCOPY NUMBER,
6206: x_msg_data OUT NOCOPY VARCHAR2,
6207: p_contract_id IN NUMBER,
6233: calculate_interest_failed EXCEPTION;
6234:
6235:
6236: BEGIN
6237: x_return_status := OKL_API.G_RET_STS_SUCCESS;
6238:
6239: print_debug('Executing procedure CALCULATE_INTEREST using following parameters : ');
6240: print_debug(' p_contract_id : '|| p_contract_id );
6241: print_debug(' p_from_date : '|| to_char(p_from_date));
6245:
6246: print_debug(' g_contract_id : '|| G_CONTRACT_ID );
6247:
6248: Initialize_contract_params( p_api_version => 1.0,
6249: p_init_msg_list => OKL_API.G_FALSE,
6250: x_return_status => x_return_status,
6251: x_msg_count => x_msg_count,
6252: x_msg_data => x_msg_data,
6253: p_contract_id => p_contract_id
6251: x_msg_count => x_msg_count,
6252: x_msg_data => x_msg_data,
6253: p_contract_id => p_contract_id
6254: );
6255: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
6256: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
6257: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6258: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
6259: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
6253: p_contract_id => p_contract_id
6254: );
6255: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
6256: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
6257: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6258: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
6259: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
6260: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6261: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6256: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
6257: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6258: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
6259: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
6260: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6261: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6262: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
6263: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
6264: RAISE calculate_interest_failed;
6257: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6258: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
6259: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
6260: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6261: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6262: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
6263: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
6264: RAISE calculate_interest_failed;
6265: END IF;
6276: IF G_DAYS_IN_A_MONTH_CODE = '30' AND to_char(p_to_date,'DD') = '31'
6277: THEN
6278: interest_date_range (
6279: p_api_version => 1.0,
6280: p_init_msg_list => OKL_API.G_FALSE,
6281: x_return_status => x_return_status,
6282: x_msg_count => x_msg_count,
6283: x_msg_data => x_msg_data,
6284: p_contract_id => p_contract_id,
6288: x_interest_rate_tbl => l_interest_rate_tbl);
6289: ELSE
6290: interest_date_range (
6291: p_api_version => 1.0,
6292: p_init_msg_list => OKL_API.G_FALSE,
6293: x_return_status => x_return_status,
6294: x_msg_count => x_msg_count,
6295: x_msg_data => x_msg_data,
6296: p_contract_id => p_contract_id,
6308:
6309:
6310:
6311:
6312: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6313: print_error_message('Unexpected error raised in call to INTEREST_DATE_RANGE');
6314: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6315: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6316: print_error_message('Error raised in call to INTEREST_DATE_RANGE');
6310:
6311:
6312: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6313: print_error_message('Unexpected error raised in call to INTEREST_DATE_RANGE');
6314: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6315: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6316: print_error_message('Error raised in call to INTEREST_DATE_RANGE');
6317: RAISE calculate_interest_failed;
6318: END IF;
6311:
6312: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6313: print_error_message('Unexpected error raised in call to INTEREST_DATE_RANGE');
6314: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6315: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6316: print_error_message('Error raised in call to INTEREST_DATE_RANGE');
6317: RAISE calculate_interest_failed;
6318: END IF;
6319:
6427:
6428: EXCEPTION
6429: WHEN calculate_interest_failed THEN
6430: print_error_message('Exception calculate_interest_failed raised in function CALCULATE_INTEREST');
6431: x_return_status := OKL_API.G_RET_STS_ERROR;
6432: RETURN NULL;
6433: WHEN OTHERS THEN
6434: print_error_message('Exception raised in function CALCULATE_INTEREST');
6435: Okl_Api.SET_MESSAGE(
6431: x_return_status := OKL_API.G_RET_STS_ERROR;
6432: RETURN NULL;
6433: WHEN OTHERS THEN
6434: print_error_message('Exception raised in function CALCULATE_INTEREST');
6435: Okl_Api.SET_MESSAGE(
6436: p_app_name => G_APP_NAME,
6437: p_msg_name => G_UNEXPECTED_ERROR,
6438: p_token1 => G_SQLCODE_TOKEN,
6439: p_token1_value => SQLCODE,
6438: p_token1 => G_SQLCODE_TOKEN,
6439: p_token1_value => SQLCODE,
6440: p_token2 => G_SQLERRM_TOKEN,
6441: p_token2_value => SQLERRM);
6442: x_return_status := OKL_API.G_RET_STS_ERROR;
6443: RETURN NULL;
6444:
6445: END calculate_interest;
6446:
6459:
6460: ------------------------------------------------------------------------------
6461: Function Calc_Variable_Rate_Interest (
6462: p_api_version IN NUMBER,
6463: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
6464: x_return_status OUT NOCOPY VARCHAR2,
6465: x_msg_count OUT NOCOPY NUMBER,
6466: x_msg_data OUT NOCOPY VARCHAR2,
6467: p_contract_id IN NUMBER,
6487: print_debug('Executing function CALC_VARIABLE_RATE_INTEREST using following parameters : ');
6488: print_debug('p_contract_id : '|| p_contract_id );
6489: print_debug('p_currency_code : '|| p_currency_code);
6490:
6491: x_return_status := OKL_API.G_RET_STS_SUCCESS;
6492: l_principal_balance_tbl := p_principal_balance_tbl;
6493: l_principal_bal_tbl_count := l_principal_balance_tbl.COUNT;
6494:
6495: print_debug ('No. of records in Principal balance table: '|| l_principal_bal_tbl_count);
6505:
6506: IF (l_principal_balance_tbl(l_principal_bal_tbl_index).principal_balance > 0) THEN
6507: l_interest_amt := calculate_interest (
6508: p_api_version => 1.0,
6509: p_init_msg_list => OKL_API.G_FALSE,
6510: x_return_status => x_return_status,
6511: x_msg_count => x_msg_count,
6512: x_msg_data => x_msg_data,
6513: p_contract_id => p_contract_id,
6515: p_to_date => l_to_date,
6516: p_principal_amount => l_principal_balance_tbl(l_principal_bal_tbl_index).principal_balance,
6517: p_currency_code => p_currency_code);
6518:
6519: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6520: print_error_message('Unexpected error raised in call to CALCULATE_INTEREST');
6521: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6522: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6523: print_error_message('Error raised in call to CALCULATE_INTEREST');
6517: p_currency_code => p_currency_code);
6518:
6519: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6520: print_error_message('Unexpected error raised in call to CALCULATE_INTEREST');
6521: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6522: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6523: print_error_message('Error raised in call to CALCULATE_INTEREST');
6524: RAISE Calc_Var_Rate_Int_failed;
6525: END IF;
6518:
6519: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6520: print_error_message('Unexpected error raised in call to CALCULATE_INTEREST');
6521: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6522: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6523: print_error_message('Error raised in call to CALCULATE_INTEREST');
6524: RAISE Calc_Var_Rate_Int_failed;
6525: END IF;
6526: ELSE
6537:
6538: EXCEPTION
6539: WHEN Calc_Var_Rate_Int_failed THEN
6540: print_error_message('Exception Calc_Var_Rate_Int_failed raised in function CALC_VARIABLE_RATE_INTEREST');
6541: x_return_status := OKL_API.G_RET_STS_ERROR;
6542: RETURN NULL;
6543:
6544: WHEN OTHERS THEN
6545: print_error_message('Exception raised in function CALC_VARIABLE_RATE_INTEREST');
6542: RETURN NULL;
6543:
6544: WHEN OTHERS THEN
6545: print_error_message('Exception raised in function CALC_VARIABLE_RATE_INTEREST');
6546: Okl_Api.SET_MESSAGE(
6547: p_app_name => G_APP_NAME,
6548: p_msg_name => G_UNEXPECTED_ERROR,
6549: p_token1 => G_SQLCODE_TOKEN,
6550: p_token1_value => SQLCODE,
6549: p_token1 => G_SQLCODE_TOKEN,
6550: p_token1_value => SQLCODE,
6551: p_token2 => G_SQLERRM_TOKEN,
6552: p_token2_value => SQLERRM);
6553: x_return_status := OKL_API.G_RET_STS_ERROR;
6554: RETURN NULL;
6555:
6556:
6557: END Calc_Variable_Rate_Interest;
6571:
6572: ------------------------------------------------------------------------------
6573: Procedure Create_Stream_Invoice (
6574: p_api_version IN NUMBER,
6575: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
6576: x_return_status OUT NOCOPY VARCHAR2,
6577: x_msg_count OUT NOCOPY NUMBER,
6578: x_msg_data OUT NOCOPY VARCHAR2,
6579: p_contract_id IN NUMBER,
6580: p_line_id IN NUMBER DEFAULT NULL,
6581: p_amount IN NUMBER,
6582: p_due_date IN DATE,
6583: p_stream_type_purpose IN VARCHAR2,
6584: p_create_invoice_flag IN VARCHAR2 DEFAULT OKL_API.G_TRUE,
6585: p_process_flag IN VARCHAR2 DEFAULT NULL,
6586: p_parent_strm_element_id IN NUMBER DEFAULT NULL,
6587: x_invoice_id OUT NOCOPY NUMBER,
6588: x_stream_element_id OUT NOCOPY NUMBER) IS
6637: l_acc_gen_primary_key_tbl Okl_Account_Generator_Pvt.primary_key_tbl;
6638: l_meaning FND_LOOKUPS.meaning%TYPE;
6639: l_description FND_LOOKUPS.description%TYPE;
6640:
6641: l_stream_created VARCHAR2(1) := OKL_API.G_FALSE;
6642: l_strm_element_created VARCHAR2(1) := OKL_API.G_FALSE;
6643: l_okl_trx_created VARCHAR2(1) := OKL_API.G_FALSE;
6644: create_stream_invoice_failed EXCEPTION;
6645:
6638: l_meaning FND_LOOKUPS.meaning%TYPE;
6639: l_description FND_LOOKUPS.description%TYPE;
6640:
6641: l_stream_created VARCHAR2(1) := OKL_API.G_FALSE;
6642: l_strm_element_created VARCHAR2(1) := OKL_API.G_FALSE;
6643: l_okl_trx_created VARCHAR2(1) := OKL_API.G_FALSE;
6644: create_stream_invoice_failed EXCEPTION;
6645:
6646: -- 5033120
6639: l_description FND_LOOKUPS.description%TYPE;
6640:
6641: l_stream_created VARCHAR2(1) := OKL_API.G_FALSE;
6642: l_strm_element_created VARCHAR2(1) := OKL_API.G_FALSE;
6643: l_okl_trx_created VARCHAR2(1) := OKL_API.G_FALSE;
6644: create_stream_invoice_failed EXCEPTION;
6645:
6646: -- 5033120
6647: l_trx_type_id Okl_Trx_Types_V.id%TYPE;
6744: print_debug(' p_create_invoice_flag: '|| p_create_invoice_flag);
6745: print_debug(' p_process_flag : '|| p_process_flag);
6746: print_debug(' p_parent_strm_element_id : '|| p_parent_strm_element_id);
6747:
6748: x_return_status := OKL_API.G_RET_STS_SUCCESS;
6749:
6750: -- Get sty_id for the contract
6751: IF (p_stream_type_purpose = 'VARIABLE_INTEREST') THEN
6752: Okl_Streams_Util.get_primary_stream_type(
6770: ELSE
6771: print_debug( ' -- ERROR: Could not retrieve Stream Id for purpose '|| p_stream_type_purpose );
6772: END IF;
6773:
6774: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6775: print_error_message('Unexpected error raised in call to Okl_Streams_Util.get_primary/dependent_stream_type');
6776: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6777: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6778: print_error_message('Error raised in call to Okl_Streams_Util.get_primary/dependent_stream_type');
6772: END IF;
6773:
6774: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6775: print_error_message('Unexpected error raised in call to Okl_Streams_Util.get_primary/dependent_stream_type');
6776: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6777: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6778: print_error_message('Error raised in call to Okl_Streams_Util.get_primary/dependent_stream_type');
6779: RAISE create_stream_invoice_failed;
6780: END IF;
6773:
6774: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6775: print_error_message('Unexpected error raised in call to Okl_Streams_Util.get_primary/dependent_stream_type');
6776: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6777: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6778: print_error_message('Error raised in call to Okl_Streams_Util.get_primary/dependent_stream_type');
6779: RAISE create_stream_invoice_failed;
6780: END IF;
6781:
6825: ELSE
6826: print_debug (' -- Error: '||x_msg_data);
6827: END IF;
6828:
6829: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
6830: print_error_message('Unexpected error raised in call to Okl_Streams_Pub.create_streams');
6831: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
6832: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
6833: print_error_message('Error raised in call to Okl_Streams_Pub.create_streams');
6827: END IF;
6828:
6829: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
6830: print_error_message('Unexpected error raised in call to Okl_Streams_Pub.create_streams');
6831: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
6832: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
6833: print_error_message('Error raised in call to Okl_Streams_Pub.create_streams');
6834: RAISE create_stream_invoice_failed;
6835: END IF;
6828:
6829: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
6830: print_error_message('Unexpected error raised in call to Okl_Streams_Pub.create_streams');
6831: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
6832: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
6833: print_error_message('Error raised in call to Okl_Streams_Pub.create_streams');
6834: RAISE create_stream_invoice_failed;
6835: END IF;
6836:
6833: print_error_message('Error raised in call to Okl_Streams_Pub.create_streams');
6834: RAISE create_stream_invoice_failed;
6835: END IF;
6836:
6837: l_stream_created := OKL_API.G_TRUE;
6838:
6839: print_debug ('Stm ID: '||lx_stmv_rec.id);
6840: l_selv_rec.stm_id := lx_stmv_rec.id;
6841: print_debug ('Stm ID: '||l_selv_rec.stm_id);
6884: ELSE
6885: print_debug (' -- Error: '||x_msg_data);
6886: END IF;
6887:
6888: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
6889: print_error_message('Unexpected error raised in call to Okl_Streams_Pub.create_stream_elements');
6890: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
6891: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
6892: print_error_message('Error raised in call to Okl_Streams_Pub.create_stream_elements');
6886: END IF;
6887:
6888: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
6889: print_error_message('Unexpected error raised in call to Okl_Streams_Pub.create_stream_elements');
6890: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
6891: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
6892: print_error_message('Error raised in call to Okl_Streams_Pub.create_stream_elements');
6893: RAISE create_stream_invoice_failed;
6894: END IF;
6887:
6888: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
6889: print_error_message('Unexpected error raised in call to Okl_Streams_Pub.create_stream_elements');
6890: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
6891: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
6892: print_error_message('Error raised in call to Okl_Streams_Pub.create_stream_elements');
6893: RAISE create_stream_invoice_failed;
6894: END IF;
6895:
6892: print_error_message('Error raised in call to Okl_Streams_Pub.create_stream_elements');
6893: RAISE create_stream_invoice_failed;
6894: END IF;
6895:
6896: l_strm_element_created := OKL_API.G_TRUE;
6897:
6898: x_stream_element_id := lx_selv_rec.id;
6899:
6900:
6906: RAISE create_stream_invoice_failed;
6907: END IF;
6908: CLOSE set_of_books_csr;
6909:
6910: IF (p_create_invoice_flag = OKL_API.G_TRUE) THEN
6911: IF (G_BILLING_TRX_TYPE_ID IS NULL) THEN
6912: OPEN trx_type_csr ('Billing');
6913: FETCH trx_type_csr INTO G_BILLING_TRX_TYPE_ID, G_BILLING_TRX_TRY_ID, G_BILLING_TRX_DESC;
6914: IF (trx_type_csr%NOTFOUND) THEN
6939: -- get the contract number
6940: OPEN get_contract_number(p_contract_id);
6941: FETCH get_contract_number INTO l_cntrct_number;
6942: CLOSE get_contract_number;
6943: Okl_Api.set_message(p_app_name => g_app_name,
6944: p_msg_name => 'OKL_LE_NOT_EXIST_CNTRCT',
6945: p_token1 => 'CONTRACT_NUMBER',
6946: p_token1_value => l_cntrct_number);
6947: RAISE OKL_API.G_EXCEPTION_ERROR;
6943: Okl_Api.set_message(p_app_name => g_app_name,
6944: p_msg_name => 'OKL_LE_NOT_EXIST_CNTRCT',
6945: p_token1 => 'CONTRACT_NUMBER',
6946: p_token1_value => l_cntrct_number);
6947: RAISE OKL_API.G_EXCEPTION_ERROR;
6948: END IF;
6949:
6950: print_debug('Executing procedure OKL_TRX_AR_INVOICES_PUB.INSERT_TRX_AR_INVOICES');
6951:
6965: ELSE
6966: print_debug( ' -- ERROR: Creating Internal TXN Header.');
6967: END IF;
6968:
6969: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6970: print_error_message('Unexpected error raised in call to Okl_Trx_Ar_Invoices_Pub.insert_trx_ar_invoices');
6971: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6972: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6973: print_error_message('Error raised in call to Okl_Trx_Ar_Invoices_Pub.insert_trx_ar_invoices');
6967: END IF;
6968:
6969: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6970: print_error_message('Unexpected error raised in call to Okl_Trx_Ar_Invoices_Pub.insert_trx_ar_invoices');
6971: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6972: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6973: print_error_message('Error raised in call to Okl_Trx_Ar_Invoices_Pub.insert_trx_ar_invoices');
6974: RAISE create_stream_invoice_failed;
6975: END IF; */
6968:
6969: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
6970: print_error_message('Unexpected error raised in call to Okl_Trx_Ar_Invoices_Pub.insert_trx_ar_invoices');
6971: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
6972: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
6973: print_error_message('Error raised in call to Okl_Trx_Ar_Invoices_Pub.insert_trx_ar_invoices');
6974: RAISE create_stream_invoice_failed;
6975: END IF; */
6976:
7011: ELSE
7012: FND_FILE.PUT_LINE (FND_FILE.LOG, ' -- ERROR: Creating Internal TXN Line.');
7013: END IF;
7014:
7015: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7016: print_error_message('Unexpected error raised in call to Okl_Txl_Ar_Inv_Lns_Pub.insert_txl_ar_inv_lns');
7017: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7018: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7019: print_error_message('Error raised in call to Okl_Txl_Ar_Inv_Lns_Pub.insert_txl_ar_inv_lns');
7013: END IF;
7014:
7015: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7016: print_error_message('Unexpected error raised in call to Okl_Txl_Ar_Inv_Lns_Pub.insert_txl_ar_inv_lns');
7017: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7018: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7019: print_error_message('Error raised in call to Okl_Txl_Ar_Inv_Lns_Pub.insert_txl_ar_inv_lns');
7020: RAISE create_stream_invoice_failed;
7021: END IF; */
7014:
7015: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7016: print_error_message('Unexpected error raised in call to Okl_Txl_Ar_Inv_Lns_Pub.insert_txl_ar_inv_lns');
7017: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7018: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7019: print_error_message('Error raised in call to Okl_Txl_Ar_Inv_Lns_Pub.insert_txl_ar_inv_lns');
7020: RAISE create_stream_invoice_failed;
7021: END IF; */
7022:
7046: x_taiv_rec => lx_taiv_rec,
7047: x_tilv_tbl => lx_tilv_tbl,
7048: x_tldv_tbl => lx_tldv_tbl);
7049:
7050: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
7051: print_error_message('Unexpected error raised in call to okl_internal_billing_pvt.create_billing_trx');
7052: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
7053: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
7054: print_error_message('Error raised in call to okl_internal_billing_pvt.create_billing_trx');
7048: x_tldv_tbl => lx_tldv_tbl);
7049:
7050: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
7051: print_error_message('Unexpected error raised in call to okl_internal_billing_pvt.create_billing_trx');
7052: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
7053: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
7054: print_error_message('Error raised in call to okl_internal_billing_pvt.create_billing_trx');
7055: RAISE create_stream_invoice_failed;
7056: END IF;
7049:
7050: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
7051: print_error_message('Unexpected error raised in call to okl_internal_billing_pvt.create_billing_trx');
7052: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
7053: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
7054: print_error_message('Error raised in call to okl_internal_billing_pvt.create_billing_trx');
7055: RAISE create_stream_invoice_failed;
7056: END IF;
7057: --sosharma added for billing changes
7085: print_debug('Message Index: '||l_msg_index_out);
7086: END LOOP;
7087: END IF;
7088:
7089: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7090: print_error_message('Unexpected error raised in call to Okl_Txd_Ar_Ln_Dtls_Pub.insert_txd_ar_ln_dtls');
7091: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7092: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7093: print_error_message('Error raised in call to Okl_Txd_Ar_Ln_Dtls_Pub.insert_txd_ar_ln_dtls');
7087: END IF;
7088:
7089: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7090: print_error_message('Unexpected error raised in call to Okl_Txd_Ar_Ln_Dtls_Pub.insert_txd_ar_ln_dtls');
7091: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7092: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7093: print_error_message('Error raised in call to Okl_Txd_Ar_Ln_Dtls_Pub.insert_txd_ar_ln_dtls');
7094: RAISE create_stream_invoice_failed;
7095: END IF;
7088:
7089: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7090: print_error_message('Unexpected error raised in call to Okl_Txd_Ar_Ln_Dtls_Pub.insert_txd_ar_ln_dtls');
7091: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7092: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7093: print_error_message('Error raised in call to Okl_Txd_Ar_Ln_Dtls_Pub.insert_txd_ar_ln_dtls');
7094: RAISE create_stream_invoice_failed;
7095: END IF;
7096:
7125: print_error_message('Message Index: '|| l_msg_index_out);
7126: END LOOP;
7127: END IF;
7128:
7129: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7130: print_error_message('Unexpected error raised in call to Okl_Acc_Call_Pub.CREATE_ACC_TRANS');
7131: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7132: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7133: print_error_message('Error raised in call to Okl_Acc_Call_Pub.CREATE_ACC_TRANS');
7127: END IF;
7128:
7129: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7130: print_error_message('Unexpected error raised in call to Okl_Acc_Call_Pub.CREATE_ACC_TRANS');
7131: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7132: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7133: print_error_message('Error raised in call to Okl_Acc_Call_Pub.CREATE_ACC_TRANS');
7134: RAISE create_stream_invoice_failed;
7135: END IF;*/ -- end commenting existing code for common billing API call
7128:
7129: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7130: print_error_message('Unexpected error raised in call to Okl_Acc_Call_Pub.CREATE_ACC_TRANS');
7131: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7132: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7133: print_error_message('Error raised in call to Okl_Acc_Call_Pub.CREATE_ACC_TRANS');
7134: RAISE create_stream_invoice_failed;
7135: END IF;*/ -- end commenting existing code for common billing API call
7136:
7303: p_tclv_tbl => l_trxL_in_tbl,
7304: x_tcnv_rec => l_trxH_out_rec,
7305: x_tclv_tbl => l_trxL_out_tbl);
7306:
7307: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7308: print_error_message('Unexpected error raised in call to Okl_Trx_Contracts_Pub.create_trx_contracts');
7309: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7310: ELSIF (x_return_Status = Okl_Api.G_RET_STS_ERROR) THEN
7311: print_error_message('Error raised in call to Okl_Trx_Contracts_Pub.create_trx_contracts');
7305: x_tclv_tbl => l_trxL_out_tbl);
7306:
7307: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7308: print_error_message('Unexpected error raised in call to Okl_Trx_Contracts_Pub.create_trx_contracts');
7309: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7310: ELSIF (x_return_Status = Okl_Api.G_RET_STS_ERROR) THEN
7311: print_error_message('Error raised in call to Okl_Trx_Contracts_Pub.create_trx_contracts');
7312: RAISE create_stream_invoice_failed;
7313: END IF;
7306:
7307: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7308: print_error_message('Unexpected error raised in call to Okl_Trx_Contracts_Pub.create_trx_contracts');
7309: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7310: ELSIF (x_return_Status = Okl_Api.G_RET_STS_ERROR) THEN
7311: print_error_message('Error raised in call to Okl_Trx_Contracts_Pub.create_trx_contracts');
7312: RAISE create_stream_invoice_failed;
7313: END IF;
7314:
7311: print_error_message('Error raised in call to Okl_Trx_Contracts_Pub.create_trx_contracts');
7312: RAISE create_stream_invoice_failed;
7313: END IF;
7314:
7315: IF ((l_trxH_out_rec.id = OKL_API.G_MISS_NUM) OR
7316: (l_trxH_out_rec.id IS NULL) ) THEN
7317: OKL_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'TRANSACTION_ID');
7318: print_error_message ('ERROR : OKL transaction ID is NULL');
7319: RAISE create_stream_invoice_failed;
7313: END IF;
7314:
7315: IF ((l_trxH_out_rec.id = OKL_API.G_MISS_NUM) OR
7316: (l_trxH_out_rec.id IS NULL) ) THEN
7317: OKL_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'TRANSACTION_ID');
7318: print_error_message ('ERROR : OKL transaction ID is NULL');
7319: RAISE create_stream_invoice_failed;
7320: END IF;
7321:
7318: print_error_message ('ERROR : OKL transaction ID is NULL');
7319: RAISE create_stream_invoice_failed;
7320: END IF;
7321:
7322: l_okl_trx_created := OKL_API.G_TRUE;
7323:
7324: ------------------------------------------------------------
7325: -- Derive and Insert Distribution Line
7326: ------------------------------------------------------------
7335: x_acc_gen_tbl => l_acc_gen_primary_key_tbl,
7336: x_return_status => x_return_status);
7337:
7338: print_debug('End Debug OKLRVARB.pls call Okl_Acc_Call_Pvt.Okl_Populate_Acc_Gen ');
7339: IF ( x_return_status = okl_api.g_ret_sts_success) THEN
7340: FND_FILE.PUT_LINE (FND_FILE.LOG, ' -- Accounting engine called successfully ');
7341: ELSE
7342: FND_FILE.PUT_LINE (FND_FILE.LOG, '*=> ERROR : Calling Accounting engine.');
7343: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7339: IF ( x_return_status = okl_api.g_ret_sts_success) THEN
7340: FND_FILE.PUT_LINE (FND_FILE.LOG, ' -- Accounting engine called successfully ');
7341: ELSE
7342: FND_FILE.PUT_LINE (FND_FILE.LOG, '*=> ERROR : Calling Accounting engine.');
7343: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7344: print_error_message('Unexpected error raised in call to Okl_Acc_Call_Pvt.Okl_Populate_Acc_Gen');
7345: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7346: ELSIF (x_return_Status = Okl_Api.G_RET_STS_ERROR) THEN
7347: print_error_message('Error raised in call to Okl_Acc_Call_Pvt.Okl_Populate_Acc_Gen');
7341: ELSE
7342: FND_FILE.PUT_LINE (FND_FILE.LOG, '*=> ERROR : Calling Accounting engine.');
7343: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7344: print_error_message('Unexpected error raised in call to Okl_Acc_Call_Pvt.Okl_Populate_Acc_Gen');
7345: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7346: ELSIF (x_return_Status = Okl_Api.G_RET_STS_ERROR) THEN
7347: print_error_message('Error raised in call to Okl_Acc_Call_Pvt.Okl_Populate_Acc_Gen');
7348: RAISE create_stream_invoice_failed;
7349: END IF;
7342: FND_FILE.PUT_LINE (FND_FILE.LOG, '*=> ERROR : Calling Accounting engine.');
7343: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7344: print_error_message('Unexpected error raised in call to Okl_Acc_Call_Pvt.Okl_Populate_Acc_Gen');
7345: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7346: ELSIF (x_return_Status = Okl_Api.G_RET_STS_ERROR) THEN
7347: print_error_message('Error raised in call to Okl_Acc_Call_Pvt.Okl_Populate_Acc_Gen');
7348: RAISE create_stream_invoice_failed;
7349: END IF;
7350: END IF;
7398: --END: Changes by dpsingh for SLA Uptake, Bug #5964482
7399:
7400: print_debug('End Debug OKLRVARB.pls call Okl_Account_Dist_Pub.CREATE_ACCOUNTING_DIST ');
7401:
7402: IF ( x_return_status = okl_api.g_ret_sts_success) THEN
7403: FND_FILE.PUT_LINE (FND_FILE.LOG, ' -- Accounting distributions created. ');
7404: ELSE
7405: FND_FILE.PUT_LINE (FND_FILE.LOG, '*=> ERROR : Accounting distributions not created.'||x_msg_count || x_msg_data);
7406: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7402: IF ( x_return_status = okl_api.g_ret_sts_success) THEN
7403: FND_FILE.PUT_LINE (FND_FILE.LOG, ' -- Accounting distributions created. ');
7404: ELSE
7405: FND_FILE.PUT_LINE (FND_FILE.LOG, '*=> ERROR : Accounting distributions not created.'||x_msg_count || x_msg_data);
7406: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7407: print_error_message('Unexpected error raised in call to Okl_Account_Dist_Pub.CREATE_ACCOUNTING_DIST');
7408: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7409: ELSIF (x_return_Status = Okl_Api.G_RET_STS_ERROR) THEN
7410: print_error_message('Error raised in call to Okl_Account_Dist_Pub.CREATE_ACCOUNTING_DIST');
7404: ELSE
7405: FND_FILE.PUT_LINE (FND_FILE.LOG, '*=> ERROR : Accounting distributions not created.'||x_msg_count || x_msg_data);
7406: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7407: print_error_message('Unexpected error raised in call to Okl_Account_Dist_Pub.CREATE_ACCOUNTING_DIST');
7408: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7409: ELSIF (x_return_Status = Okl_Api.G_RET_STS_ERROR) THEN
7410: print_error_message('Error raised in call to Okl_Account_Dist_Pub.CREATE_ACCOUNTING_DIST');
7411: RAISE create_stream_invoice_failed;
7412: END IF;
7405: FND_FILE.PUT_LINE (FND_FILE.LOG, '*=> ERROR : Accounting distributions not created.'||x_msg_count || x_msg_data);
7406: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7407: print_error_message('Unexpected error raised in call to Okl_Account_Dist_Pub.CREATE_ACCOUNTING_DIST');
7408: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7409: ELSIF (x_return_Status = Okl_Api.G_RET_STS_ERROR) THEN
7410: print_error_message('Error raised in call to Okl_Account_Dist_Pub.CREATE_ACCOUNTING_DIST');
7411: RAISE create_stream_invoice_failed;
7412: END IF;
7413: END IF;
7425: ,P_TCLV_TBL => l_trxL_out_tbl
7426: ,p_ctxt_val_tbl => l_ctxt_tbl
7427: ,p_acc_gen_primary_key_tbl => l_acc_gen_primary_key_tbl);
7428:
7429: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7430: print_error_message('Unexpected error raised in call to OKL_MULTIGAAP_ENGINE_PVT.CREATE_SEC_REP_TRX');
7431: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7432: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7433: print_error_message('Error raised in call to OKL_MULTIGAAP_ENGINE_PVT.CREATE_SEC_REP_TRX');
7427: ,p_acc_gen_primary_key_tbl => l_acc_gen_primary_key_tbl);
7428:
7429: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7430: print_error_message('Unexpected error raised in call to OKL_MULTIGAAP_ENGINE_PVT.CREATE_SEC_REP_TRX');
7431: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7432: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7433: print_error_message('Error raised in call to OKL_MULTIGAAP_ENGINE_PVT.CREATE_SEC_REP_TRX');
7434: RAISE Okl_Api.G_EXCEPTION_ERROR;
7435: END IF;
7428:
7429: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
7430: print_error_message('Unexpected error raised in call to OKL_MULTIGAAP_ENGINE_PVT.CREATE_SEC_REP_TRX');
7431: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7432: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7433: print_error_message('Error raised in call to OKL_MULTIGAAP_ENGINE_PVT.CREATE_SEC_REP_TRX');
7434: RAISE Okl_Api.G_EXCEPTION_ERROR;
7435: END IF;
7436: -- end the call to MG engine .. racheruv. Bug 7690456
7430: print_error_message('Unexpected error raised in call to OKL_MULTIGAAP_ENGINE_PVT.CREATE_SEC_REP_TRX');
7431: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
7432: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
7433: print_error_message('Error raised in call to OKL_MULTIGAAP_ENGINE_PVT.CREATE_SEC_REP_TRX');
7434: RAISE Okl_Api.G_EXCEPTION_ERROR;
7435: END IF;
7436: -- end the call to MG engine .. racheruv. Bug 7690456
7437: END IF;
7438:
7452: CLOSE set_of_books_csr;
7453: END IF;
7454: -- Daily Interest calculation conc. program does not use savepoint. Delete the streams/Trx
7455: IF (p_process_flag = 'DAILY_INTEREST') THEN
7456: IF (l_strm_element_created = OKL_API.G_TRUE) THEN
7457: OKL_STREAMS_PUB.delete_stream_elements(
7458: p_api_version => 1.0,
7459: p_init_msg_list => OKC_API.G_FALSE,
7460: x_return_status => x_return_status,
7461: x_msg_count => x_msg_count,
7462: x_msg_data => x_msg_data,
7463: p_selv_rec => lx_selv_rec);
7464: END IF;
7465: IF (l_stream_created = OKL_API.G_TRUE) THEN
7466: OKL_STREAMS_PUB.delete_streams(
7467: p_api_version => 1.0,
7468: p_init_msg_list => OKC_API.G_FALSE,
7469: x_return_status => x_return_status,
7471: x_msg_data => x_msg_data,
7472: p_stmv_rec => lx_stmv_rec);
7473: END IF;
7474:
7475: IF (l_okl_trx_created = OKL_API.G_TRUE) THEN
7476: OKL_TRX_CONTRACTS_PUB.delete_trx_contracts(
7477: p_api_version => 1.0,
7478: p_init_msg_list => OKC_API.G_FALSE,
7479: x_return_status => x_return_status,
7482: p_tcnv_rec => l_trxH_out_rec);
7483: END IF;
7484:
7485: END IF;
7486: x_return_status := OKL_API.G_RET_STS_ERROR;
7487:
7488: WHEN OTHERS THEN
7489: print_error_message('Exception raised in procedure CREATE_STREAM_INVOICE');
7490: IF (stream_csr%ISOPEN) THEN
7499: CLOSE set_of_books_csr;
7500: END IF;
7501: -- Daily Interest calculation conc. program does not use savepoint. Delete the streams/Trx
7502: IF (p_process_flag = 'DAILY_INTEREST') THEN
7503: IF (l_strm_element_created = OKL_API.G_TRUE) THEN
7504: OKL_STREAMS_PUB.delete_stream_elements(
7505: p_api_version => 1.0,
7506: p_init_msg_list => OKC_API.G_FALSE,
7507: x_return_status => x_return_status,
7508: x_msg_count => x_msg_count,
7509: x_msg_data => x_msg_data,
7510: p_selv_rec => lx_selv_rec);
7511: END IF;
7512: IF (l_stream_created = OKL_API.G_TRUE) THEN
7513: OKL_STREAMS_PUB.delete_streams(
7514: p_api_version => 1.0,
7515: p_init_msg_list => OKC_API.G_FALSE,
7516: x_return_status => x_return_status,
7518: x_msg_data => x_msg_data,
7519: p_stmv_rec => lx_stmv_rec);
7520: END IF;
7521:
7522: IF (l_okl_trx_created = OKL_API.G_TRUE) THEN
7523: OKL_TRX_CONTRACTS_PUB.delete_trx_contracts(
7524: p_api_version => 1.0,
7525: p_init_msg_list => OKC_API.G_FALSE,
7526: x_return_status => x_return_status,
7530: END IF;
7531:
7532: END IF;
7533:
7534: Okl_Api.SET_MESSAGE(
7535: p_app_name => G_APP_NAME,
7536: p_msg_name => G_UNEXPECTED_ERROR,
7537: p_token1 => G_SQLCODE_TOKEN,
7538: p_token1_value => SQLCODE,
7538: p_token1_value => SQLCODE,
7539: p_token2 => G_SQLERRM_TOKEN,
7540: p_token2_value => SQLERRM);
7541:
7542: x_return_status := OKL_API.G_RET_STS_ERROR;
7543:
7544: END Create_Stream_Invoice;
7545:
7546: ------------------------------------------------------------------------------
7558:
7559: ------------------------------------------------------------------------------
7560: Procedure upd_vir_params_with_invoice (
7561: p_api_version IN NUMBER,
7562: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
7563: x_return_status OUT NOCOPY VARCHAR2,
7564: x_msg_count OUT NOCOPY NUMBER,
7565: x_msg_data OUT NOCOPY VARCHAR2,
7566: p_source_id IN NUMBER,
7571: l_api_version CONSTANT NUMBER := 1.0;
7572: l_index NUMBER := 0;
7573:
7574: BEGIN
7575: x_return_status := OKL_API.G_RET_STS_SUCCESS;
7576: x_vir_tbl := p_vir_tbl;
7577:
7578: print_debug('Executing procedure UPD_VIR_PARAMS_WITH_INVOICE using following parameters : ');
7579: print_debug(' p_source_id : '|| p_source_id );
7589: EXCEPTION
7590:
7591: WHEN OTHERS THEN
7592: print_error_message('Exception raised in procedure UPD_VIR_PARAMS_WITH_INVOICE');
7593: x_return_status := OKL_API.G_RET_STS_ERROR;
7594: Okl_Api.SET_MESSAGE(
7595: p_app_name => G_APP_NAME,
7596: p_msg_name => G_UNEXPECTED_ERROR,
7597: p_token1 => G_SQLCODE_TOKEN,
7590:
7591: WHEN OTHERS THEN
7592: print_error_message('Exception raised in procedure UPD_VIR_PARAMS_WITH_INVOICE');
7593: x_return_status := OKL_API.G_RET_STS_ERROR;
7594: Okl_Api.SET_MESSAGE(
7595: p_app_name => G_APP_NAME,
7596: p_msg_name => G_UNEXPECTED_ERROR,
7597: p_token1 => G_SQLCODE_TOKEN,
7598: p_token1_value => SQLCODE,
7674: END LOOP;
7675: EXCEPTION
7676: WHEN OTHERS THEN
7677: print_error_message('Exception raised in procedure PRINT_VIR_TBL');
7678: Okl_Api.SET_MESSAGE(
7679: p_app_name => G_APP_NAME,
7680: p_msg_name => G_UNEXPECTED_ERROR,
7681: p_token1 => G_SQLCODE_TOKEN,
7682: p_token1_value => SQLCODE,
7699:
7700: ------------------------------------------------------------------------------
7701: Procedure populate_vir_params(
7702: p_api_version IN NUMBER,
7703: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
7704: x_return_status OUT NOCOPY VARCHAR2,
7705: x_msg_count OUT NOCOPY NUMBER,
7706: x_msg_data OUT NOCOPY VARCHAR2,
7707: p_vir_tbl IN vir_tbl_type) IS
7710: l_api_version CONSTANT NUMBER := 1.0;
7711: l_index NUMBER := 0;
7712:
7713: BEGIN
7714: x_return_status := OKL_API.G_RET_STS_SUCCESS;
7715:
7716: print_debug('Executing procedure POPULATE_VIR_PARAMS using following parameters : ');
7717: print_debug(' p_vir_tbl.count : '|| p_vir_tbl.COUNT );
7718: print_vir_tbl (p_vir_tbl);
7750:
7751: end loop;
7752: END IF;
7753:
7754: x_return_status := OKL_API.G_RET_STS_ERROR;
7755: Okl_Api.SET_MESSAGE(
7756: p_app_name => G_APP_NAME,
7757: p_msg_name => G_UNEXPECTED_ERROR,
7758: p_token1 => G_SQLCODE_TOKEN,
7751: end loop;
7752: END IF;
7753:
7754: x_return_status := OKL_API.G_RET_STS_ERROR;
7755: Okl_Api.SET_MESSAGE(
7756: p_app_name => G_APP_NAME,
7757: p_msg_name => G_UNEXPECTED_ERROR,
7758: p_token1 => G_SQLCODE_TOKEN,
7759: p_token1_value => SQLCODE,
8042:
8043: ------------------------------------------------------------------------------
8044:
8045: PROCEDURE populate_txns ( p_api_version IN NUMBER,
8046: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
8047: p_khr_id IN NUMBER,
8048: p_from_date IN DATE,
8049: p_to_date IN DATE,
8050: x_return_status OUT NOCOPY VARCHAR2,
8204: AND vpb.int_cal_process = 'VARIABLE_INTEREST'
8205: AND vpb.source_id = ocb.id);
8206:
8207: BEGIN
8208: x_return_status := OKL_API.G_RET_STS_SUCCESS;
8209: print_debug('Executing procedure populate_txns');
8210:
8211: print_debug('Before fetching Rebook Transactions g_vpb_tbl count is: '|| g_vpb_tbl.COUNT);
8212: OPEN l_rebook_csr(p_khr_id);
8711: END IF;
8712: EXCEPTION
8713: WHEN OTHERS THEN
8714: print_error_message('Exception raised in procedure POPULATE_TXNS');
8715: x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
8716: Okl_Api.SET_MESSAGE(
8717: p_app_name => G_APP_NAME,
8718: p_msg_name => G_UNEXPECTED_ERROR,
8719: p_token1 => G_SQLCODE_TOKEN,
8712: EXCEPTION
8713: WHEN OTHERS THEN
8714: print_error_message('Exception raised in procedure POPULATE_TXNS');
8715: x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
8716: Okl_Api.SET_MESSAGE(
8717: p_app_name => G_APP_NAME,
8718: p_msg_name => G_UNEXPECTED_ERROR,
8719: p_token1 => G_SQLCODE_TOKEN,
8720: p_token1_value => SQLCODE,
8783: print_debug('End => Contents of p_vpb_tbl');
8784: EXCEPTION
8785: WHEN OTHERS THEN
8786: print_error_message('Exception raised in procedure PRINT_VPB_TBL');
8787: Okl_Api.SET_MESSAGE(
8788: p_app_name => G_APP_NAME,
8789: p_msg_name => G_UNEXPECTED_ERROR,
8790: p_token1 => G_SQLCODE_TOKEN,
8791: p_token1_value => SQLCODE,
8808:
8809: ------------------------------------------------------------------------------
8810: Procedure populate_principal_bal_txn(
8811: p_api_version IN NUMBER,
8812: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
8813: x_return_status OUT NOCOPY VARCHAR2,
8814: x_msg_count OUT NOCOPY NUMBER,
8815: x_msg_data OUT NOCOPY VARCHAR2,
8816: p_vpb_tbl IN vpb_tbl_type) IS
8819: l_api_version CONSTANT NUMBER := 1.0;
8820: l_index NUMBER := 0;
8821:
8822: BEGIN
8823: x_return_status := OKL_API.G_RET_STS_SUCCESS;
8824:
8825: print_debug('Executing procedure populate_principal_bal_txn using following parameters : ');
8826: print_debug(' p_vpb_tbl.count : '|| p_vpb_tbl.COUNT );
8827: print_vpb_tbl (p_vpb_tbl);
8859:
8860: end loop;
8861: END IF;
8862:
8863: x_return_status := OKL_API.G_RET_STS_ERROR;
8864: Okl_Api.SET_MESSAGE(
8865: p_app_name => G_APP_NAME,
8866: p_msg_name => G_UNEXPECTED_ERROR,
8867: p_token1 => G_SQLCODE_TOKEN,
8860: end loop;
8861: END IF;
8862:
8863: x_return_status := OKL_API.G_RET_STS_ERROR;
8864: Okl_Api.SET_MESSAGE(
8865: p_app_name => G_APP_NAME,
8866: p_msg_name => G_UNEXPECTED_ERROR,
8867: p_token1 => G_SQLCODE_TOKEN,
8868: p_token1_value => SQLCODE,
9169:
9170: print_debug('****Entering procedure VAR_INT_RENT_LEVEL****');
9171: print_debug('****Start-Creating Rent Levels and ReBooking.');
9172:
9173: x_return_status := OKL_API.G_RET_STS_SUCCESS;
9174:
9175: x_return_status := OKL_API.START_ACTIVITY(
9176: p_api_name => l_api_name,
9177: p_init_msg_list => p_init_msg_list,
9171: print_debug('****Start-Creating Rent Levels and ReBooking.');
9172:
9173: x_return_status := OKL_API.G_RET_STS_SUCCESS;
9174:
9175: x_return_status := OKL_API.START_ACTIVITY(
9176: p_api_name => l_api_name,
9177: p_init_msg_list => p_init_msg_list,
9178: p_api_type => '_PVT',
9179: x_return_status => x_return_status);
9177: p_init_msg_list => p_init_msg_list,
9178: p_api_type => '_PVT',
9179: x_return_status => x_return_status);
9180:
9181: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9182: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9183: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9184: RAISE OKL_API.G_EXCEPTION_ERROR;
9185: END IF;
9178: p_api_type => '_PVT',
9179: x_return_status => x_return_status);
9180:
9181: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9182: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9183: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9184: RAISE OKL_API.G_EXCEPTION_ERROR;
9185: END IF;
9186:
9179: x_return_status => x_return_status);
9180:
9181: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9182: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9183: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9184: RAISE OKL_API.G_EXCEPTION_ERROR;
9185: END IF;
9186:
9187: /*begin
9180:
9181: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9182: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9183: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9184: RAISE OKL_API.G_EXCEPTION_ERROR;
9185: END IF;
9186:
9187: /*begin
9188: select pg_source_seq.NEXTVAL into l_source from dual;
9295: l_kle_id := get_kle_id(p_trx_number => p_trx_id,
9296: p_index_number => l_index_number,
9297: x_return_status => x_return_status);
9298:
9299: IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
9300: print_debug('Unable to derive kle_id from inbound supertrump call.');
9301: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9302: ELSE
9303: print_debug('l_kle_id: '||l_kle_id);
9297: x_return_status => x_return_status);
9298:
9299: IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
9300: print_debug('Unable to derive kle_id from inbound supertrump call.');
9301: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9302: ELSE
9303: print_debug('l_kle_id: '||l_kle_id);
9304: END IF;
9305: l_sequence := 0;
9573: print_debug('After Mass Rebook status: '||x_return_status||' Error: '||x_msg_data);
9574: print_debug('After Mass Rebook x_strm_trx_tbl.count: '|| x_strm_trx_tbl.count);
9575: FND_FILE.PUT_LINE (FND_FILE.LOG,'After mass rebook Stream Table count: '|| x_strm_trx_tbl.count);
9576:
9577: IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
9578: FOR i in 1..x_msg_count
9579: LOOP
9580: FND_MSG_PUB.GET(
9581: p_msg_index => i,
9588: print_debug('Error '||to_char(i)||': '||x_msg_data);
9589: print_debug('Message Index: '||l_msg_index_out);
9590: END LOOP;
9591:
9592: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9593: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9594: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9595: RAISE OKL_API.G_EXCEPTION_ERROR;
9596: END IF;
9589: print_debug('Message Index: '||l_msg_index_out);
9590: END LOOP;
9591:
9592: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9593: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9594: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9595: RAISE OKL_API.G_EXCEPTION_ERROR;
9596: END IF;
9597: ELSE
9590: END LOOP;
9591:
9592: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9593: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9594: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9595: RAISE OKL_API.G_EXCEPTION_ERROR;
9596: END IF;
9597: ELSE
9598: i := x_strm_trx_tbl.first;
9591:
9592: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9593: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9594: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9595: RAISE OKL_API.G_EXCEPTION_ERROR;
9596: END IF;
9597: ELSE
9598: i := x_strm_trx_tbl.first;
9599: l_child_trx_id := x_strm_trx_tbl(i).trx_number;
9660: print_debug('****End-Creating Rent Levels and ReBooking.');
9661: print_debug('****Exiting procedure VAR_INT_RENT_LEVEL****');
9662:
9663:
9664: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9665: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9666: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9667: RAISE OKL_API.G_EXCEPTION_ERROR;
9668: END IF;
9661: print_debug('****Exiting procedure VAR_INT_RENT_LEVEL****');
9662:
9663:
9664: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9665: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9666: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9667: RAISE OKL_API.G_EXCEPTION_ERROR;
9668: END IF;
9669: END IF;
9662:
9663:
9664: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9665: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9666: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9667: RAISE OKL_API.G_EXCEPTION_ERROR;
9668: END IF;
9669: END IF;
9670: END IF;
9663:
9664: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
9665: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
9666: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
9667: RAISE OKL_API.G_EXCEPTION_ERROR;
9668: END IF;
9669: END IF;
9670: END IF;
9671: Exception
9670: END IF;
9671: Exception
9672: WHEN OTHERS THEN
9673: print_debug('sqlcode : ' || sqlcode || ' $ sqlerrm : ' || sqlerrm);
9674: x_return_status := OKL_API.HANDLE_EXCEPTIONS (
9675: p_api_name => l_api_name,
9676: p_pkg_name => G_PKG_NAME,
9677: p_exc_name => 'OTHERS',
9678: x_msg_count => x_msg_count,
9696:
9697: ------------------------------------------------------------------------------
9698: Procedure Create_Daily_Interest_Streams (
9699: p_api_version IN NUMBER,
9700: p_init_msg_list IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
9701: x_return_status OUT NOCOPY VARCHAR2,
9702: x_msg_count OUT NOCOPY NUMBER,
9703: x_msg_data OUT NOCOPY VARCHAR2,
9704: p_contract_id IN NUMBER,
9705: p_line_id IN NUMBER DEFAULT NULL, -- not currently used
9706: p_amount IN NUMBER,
9707: p_due_date IN DATE,
9708: p_stream_type_purpose IN VARCHAR2,
9709: p_create_invoice_flag IN VARCHAR2 DEFAULT OKL_API.G_TRUE,
9710: p_process_flag IN VARCHAR2 DEFAULT NULL,
9711: p_currency_code IN VARCHAR2 DEFAULT NULL ) IS
9712:
9713: l_api_name CONSTANT VARCHAR2(30) := 'CREATE_DAILY_INTEREST_STREAMS';
9745: print_debug(' p_stream_type_purpose : '||p_stream_type_purpose);
9746: print_debug(' p_create_invoice_flag: '|| p_create_invoice_flag);
9747: print_debug(' p_process_flag : '|| p_process_flag);
9748:
9749: x_return_status := OKL_API.G_RET_STS_SUCCESS;
9750:
9751: Initialize_contract_params( p_api_version => 1.0,
9752: p_init_msg_list => OKL_API.G_FALSE,
9753: x_return_status => x_return_status,
9748:
9749: x_return_status := OKL_API.G_RET_STS_SUCCESS;
9750:
9751: Initialize_contract_params( p_api_version => 1.0,
9752: p_init_msg_list => OKL_API.G_FALSE,
9753: x_return_status => x_return_status,
9754: x_msg_count => x_msg_count,
9755: x_msg_data => x_msg_data,
9756: p_contract_id => p_contract_id
9754: x_msg_count => x_msg_count,
9755: x_msg_data => x_msg_data,
9756: p_contract_id => p_contract_id
9757: );
9758: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
9759: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
9760: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9761: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
9762: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
9756: p_contract_id => p_contract_id
9757: );
9758: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
9759: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
9760: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9761: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
9762: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
9763: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9764: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9759: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
9760: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9761: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
9762: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
9763: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9764: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9765: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
9766: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
9767: RAISE Create_Daily_Int_Str_failed;
9760: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9761: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
9762: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
9763: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9764: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9765: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
9766: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
9767: RAISE Create_Daily_Int_Str_failed;
9768: END IF;
9770: IF (p_stream_type_purpose = 'DAILY_INTEREST_INTEREST') THEN
9771:
9772: Create_Stream_Invoice (
9773: p_api_version => 1.0,
9774: p_init_msg_list => OKL_API.G_FALSE,
9775: x_return_status => x_return_status,
9776: x_msg_count => x_msg_count,
9777: x_msg_data => x_msg_data,
9778: p_contract_id => p_contract_id,
9785: p_parent_strm_element_id => NULL,
9786: x_invoice_id => l_invoice_id,
9787: x_stream_element_id => l_stream_element_id);
9788:
9789: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9790: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
9791: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9792: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9793: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
9787: x_stream_element_id => l_stream_element_id);
9788:
9789: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9790: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
9791: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9792: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9793: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
9794: RAISE Create_Daily_Int_Str_failed;
9795: END IF;
9788:
9789: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9790: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
9791: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9792: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9793: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
9794: RAISE Create_Daily_Int_Str_failed;
9795: END IF;
9796:
9797: i_vir_tbl := g_vir_tbl;
9798:
9799: upd_vir_params_with_invoice (
9800: p_api_version => 1.0,
9801: p_init_msg_list => OKL_API.G_TRUE,
9802: x_return_status => x_return_status,
9803: x_msg_count => x_msg_count,
9804: x_msg_data => x_msg_data,
9805: p_source_id => l_stream_element_id,
9804: x_msg_data => x_msg_data,
9805: p_source_id => l_stream_element_id,
9806: p_vir_tbl => i_vir_tbl,
9807: x_vir_tbl => r_vir_tbl);
9808: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9809: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
9810: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9811: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9812: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
9806: p_vir_tbl => i_vir_tbl,
9807: x_vir_tbl => r_vir_tbl);
9808: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9809: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
9810: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9811: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9812: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
9813: RAISE Create_Daily_Int_Str_failed;
9814: END IF;
9807: x_vir_tbl => r_vir_tbl);
9808: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9809: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
9810: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9811: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9812: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
9813: RAISE Create_Daily_Int_Str_failed;
9814: END IF;
9815:
9816: g_vir_tbl := r_vir_tbl;
9817:
9818: populate_vir_params(
9819: p_api_version => 1.0,
9820: p_init_msg_list => OKL_API.G_TRUE,
9821: x_return_status => x_return_status,
9822: x_msg_count => x_msg_count,
9823: x_msg_data => x_msg_data,
9824: p_vir_tbl => g_vir_tbl);
9821: x_return_status => x_return_status,
9822: x_msg_count => x_msg_count,
9823: x_msg_data => x_msg_data,
9824: p_vir_tbl => g_vir_tbl);
9825: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9826: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
9827: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9828: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9829: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
9823: x_msg_data => x_msg_data,
9824: p_vir_tbl => g_vir_tbl);
9825: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9826: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
9827: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9828: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9829: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
9830: RAISE Create_Daily_Int_Str_failed;
9831: END IF;
9824: p_vir_tbl => g_vir_tbl);
9825: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9826: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
9827: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9828: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9829: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
9830: RAISE Create_Daily_Int_Str_failed;
9831: END IF;
9832:
9839: LOOP
9840: -- Derive Asset Cost
9841: Okl_Execute_Formula_Pub.EXECUTE(
9842: p_api_version => 1.0,
9843: p_init_msg_list => OKL_API.G_FALSE,
9844: x_return_status => x_return_status,
9845: x_msg_count => x_msg_count,
9846: x_msg_data => x_msg_data,
9847: p_formula_name => 'LINE_OEC',
9847: p_formula_name => 'LINE_OEC',
9848: p_contract_id => p_contract_id,
9849: p_line_id => current_line.id,
9850: x_value => l_asset_cost);
9851: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
9852: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
9853: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9854: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
9855: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
9849: p_line_id => current_line.id,
9850: x_value => l_asset_cost);
9851: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
9852: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
9853: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9854: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
9855: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
9856: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9857: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9852: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE completed successfully');
9853: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9854: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
9855: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
9856: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9857: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9858: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
9859: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
9860: RAISE Create_Daily_Int_Str_failed;
9853: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9854: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
9855: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned unexpected error');
9856: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9857: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9858: print_debug ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
9859: print_error_message ('Procedure OKL_EXECUTE_FORMULA_PUB.EXECUTE returned exception');
9860: RAISE Create_Daily_Int_Str_failed;
9861: END IF;
9882: print_debug('Creating DAILY_INTEREST_PRINCIPAL streams for asset id : ' || l_asset_line_tbl(l_index).id || ' for Amount :' || l_prorated_invoice_amt);
9883:
9884: Create_Stream_Invoice (
9885: p_api_version => 1.0,
9886: p_init_msg_list => OKL_API.G_FALSE,
9887: x_return_status => x_return_status,
9888: x_msg_count => x_msg_count,
9889: x_msg_data => x_msg_data,
9890: p_contract_id => p_contract_id,
9897: p_parent_strm_element_id => NULL,
9898: x_invoice_id => l_invoice_id,
9899: x_stream_element_id => l_stream_element_id);
9900:
9901: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9902: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
9903: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9904: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9905: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
9899: x_stream_element_id => l_stream_element_id);
9900:
9901: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9902: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
9903: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9904: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9905: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
9906: RAISE Create_Daily_Int_Str_failed;
9907: END IF;
9900:
9901: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9902: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
9903: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9904: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9905: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
9906: RAISE Create_Daily_Int_Str_failed;
9907: END IF;
9908: print_debug('Successfully created DAILY_INTEREST_PRINCIPAL streams for asset id : ' || l_asset_line_tbl(l_index).id || ' for Amount :' || l_prorated_invoice_amt);
9913: print_debug('Creating DAILY_INTEREST_PRINCIPAL streams '|| ' for Amount :' || l_invoice_amt);
9914:
9915: Create_Stream_Invoice (
9916: p_api_version => 1.0,
9917: p_init_msg_list => OKL_API.G_FALSE,
9918: x_return_status => x_return_status,
9919: x_msg_count => x_msg_count,
9920: x_msg_data => x_msg_data,
9921: p_contract_id => p_contract_id,
9928: p_parent_strm_element_id => NULL,
9929: x_invoice_id => l_invoice_id,
9930: x_stream_element_id => l_stream_element_id);
9931:
9932: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9933: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
9934: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9935: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9936: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
9930: x_stream_element_id => l_stream_element_id);
9931:
9932: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9933: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
9934: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9935: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9936: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
9937: RAISE Create_Daily_Int_Str_failed;
9938: END IF;
9931:
9932: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
9933: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
9934: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
9935: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
9936: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
9937: RAISE Create_Daily_Int_Str_failed;
9938: END IF;
9939: print_debug('Successfully created DAILY_INTEREST_PRINCIPAL streams ' || ' for Amount :' || l_invoice_amt);
9943:
9944: EXCEPTION
9945: WHEN Create_Daily_Int_Str_failed THEN
9946: print_error_message('Exception Create_Daily_Int_Str_failed raised in procedure CREATE_DAILY_INTEREST_STREAMS');
9947: x_return_status := OKL_API.G_RET_STS_ERROR;
9948: WHEN OTHERS THEN
9949: print_error_message('Exception raised in procedure CREATE_DAILY_INTEREST_STREAMS');
9950: x_return_status := OKL_API.G_RET_STS_ERROR;
9951: Okl_Api.SET_MESSAGE(
9946: print_error_message('Exception Create_Daily_Int_Str_failed raised in procedure CREATE_DAILY_INTEREST_STREAMS');
9947: x_return_status := OKL_API.G_RET_STS_ERROR;
9948: WHEN OTHERS THEN
9949: print_error_message('Exception raised in procedure CREATE_DAILY_INTEREST_STREAMS');
9950: x_return_status := OKL_API.G_RET_STS_ERROR;
9951: Okl_Api.SET_MESSAGE(
9952: p_app_name => G_APP_NAME,
9953: p_msg_name => G_UNEXPECTED_ERROR,
9954: p_token1 => G_SQLCODE_TOKEN,
9947: x_return_status := OKL_API.G_RET_STS_ERROR;
9948: WHEN OTHERS THEN
9949: print_error_message('Exception raised in procedure CREATE_DAILY_INTEREST_STREAMS');
9950: x_return_status := OKL_API.G_RET_STS_ERROR;
9951: Okl_Api.SET_MESSAGE(
9952: p_app_name => G_APP_NAME,
9953: p_msg_name => G_UNEXPECTED_ERROR,
9954: p_token1 => G_SQLCODE_TOKEN,
9955: p_token1_value => SQLCODE,
9984: p_principal_basis IN VARCHAR2 DEFAULT NULL) RETURN NUMBER IS
9985:
9986: l_api_version CONSTANT NUMBER := 1.0;
9987: l_api_name CONSTANT VARCHAR2(30) := 'CALCULATE_TOTAL_INTEREST_DUE';
9988: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
9989: l_interest_calculated NUMBER := 0;
9990: r_principal_balance_tbl principal_balance_tbl_typ;
9991: -- l_interest_basis OKL_K_RATE_PARAMS.interest_basis_code%TYPE;
9992: -- l_formula_id OKL_K_RATE_PARAMS.calculation_formula_id%TYPE;
10020: ------------------------------------------------------------
10021: -- Start processing
10022: ------------------------------------------------------------
10023:
10024: x_return_status := OKL_API.G_RET_STS_SUCCESS;
10025:
10026: print_debug('Executing function CALCULATE_TOTAL_INTEREST_DUE using following parameters : ');
10027: print_debug('contract ID : '|| p_contract_id);
10028: print_debug('Currency Code : '|| p_currency_code);
10029: print_debug('start date : '|| p_start_date);
10030: print_Debug('Due date : '|| p_due_date);
10031:
10032: Initialize_contract_params( p_api_version => 1.0,
10033: p_init_msg_list => OKL_API.G_FALSE,
10034: x_return_status => x_return_status,
10035: x_msg_count => x_msg_count,
10036: x_msg_data => x_msg_data,
10037: p_contract_id => p_contract_id
10035: x_msg_count => x_msg_count,
10036: x_msg_data => x_msg_data,
10037: p_contract_id => p_contract_id
10038: );
10039: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
10040: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
10041: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10042: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
10043: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
10037: p_contract_id => p_contract_id
10038: );
10039: IF (x_return_status = Okl_Api.G_RET_STS_SUCCESS) THEN
10040: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
10041: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10042: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
10043: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
10044: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10045: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10040: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS completed successfully');
10041: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10042: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
10043: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
10044: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10045: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10046: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
10047: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
10048: RAISE calc_total_int_due_failed;
10041: ELSIF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10042: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
10043: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned unexpected error');
10044: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10045: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10046: print_debug ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
10047: print_error_message ('Procedure INITIALIZE_CONTRACT_PARAMS returned exception');
10048: RAISE calc_total_int_due_failed;
10049: END IF;
10073: IF (G_INTEREST_BASIS_CODE = 'SIMPLE') THEN
10074:
10075: prin_date_range_var_rate_ctr (
10076: p_api_version => 1.0,
10077: p_init_msg_list => OKL_API.G_FALSE,
10078: x_return_status => x_return_status,
10079: x_msg_count => x_msg_count,
10080: x_msg_data => x_msg_data,
10081: p_contract_id => p_contract_id,
10083: p_start_date => p_start_date,
10084: p_due_date => p_due_date,
10085: p_principal_basis => p_principal_basis,
10086: x_principal_balance_tbl => r_principal_balance_tbl);
10087: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10088: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
10089: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10090: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10091: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
10085: p_principal_basis => p_principal_basis,
10086: x_principal_balance_tbl => r_principal_balance_tbl);
10087: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10088: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
10089: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10090: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10091: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
10092: RAISE calc_total_int_due_failed;
10093: END IF;
10086: x_principal_balance_tbl => r_principal_balance_tbl);
10087: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10088: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
10089: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10090: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10091: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
10092: RAISE calc_total_int_due_failed;
10093: END IF;
10094: print_debug ('Before call to Calc_Variable_Rate_Interest');
10094: print_debug ('Before call to Calc_Variable_Rate_Interest');
10095:
10096: l_interest_calculated := Calc_Variable_Rate_Interest (
10097: p_api_version => p_api_version,
10098: p_init_msg_list => OKL_API.G_FALSE,
10099: x_return_status => x_return_status,
10100: x_msg_count => x_msg_count,
10101: x_msg_data => x_msg_data,
10102: p_contract_id => p_contract_id,
10101: x_msg_data => x_msg_data,
10102: p_contract_id => p_contract_id,
10103: p_currency_code => p_currency_code,
10104: p_principal_balance_tbl => r_principal_balance_tbl);
10105: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10106: print_error_message('Unexpected error raised in call to CALC_VARIABLE_RATE_INTEREST');
10107: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10108: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10109: print_error_message('Error raised in call to CALC_VARIABLE_RATE_INTEREST');
10103: p_currency_code => p_currency_code,
10104: p_principal_balance_tbl => r_principal_balance_tbl);
10105: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10106: print_error_message('Unexpected error raised in call to CALC_VARIABLE_RATE_INTEREST');
10107: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10108: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10109: print_error_message('Error raised in call to CALC_VARIABLE_RATE_INTEREST');
10110: RAISE calc_total_int_due_failed;
10111: END IF;
10104: p_principal_balance_tbl => r_principal_balance_tbl);
10105: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10106: print_error_message('Unexpected error raised in call to CALC_VARIABLE_RATE_INTEREST');
10107: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10108: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10109: print_error_message('Error raised in call to CALC_VARIABLE_RATE_INTEREST');
10110: RAISE calc_total_int_due_failed;
10111: END IF;
10112: ELSE
10120: CLOSE formula_csr;
10121:
10122: -- Derive Interest using formula
10123: Okl_Execute_Formula_Pub.EXECUTE(p_api_version => 1.0,
10124: p_init_msg_list => OKL_API.G_TRUE,
10125: x_return_status => x_return_status,
10126: x_msg_count => x_msg_count,
10127: x_msg_data => x_msg_data,
10128: p_formula_name => l_formula_name,
10129: p_contract_id => p_contract_id,
10130: p_line_id => NULL,
10131: x_value => l_interest_calculated
10132: );
10133: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10134: print_error_message('Unexpected error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
10135: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10136: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10137: print_error_message('Error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
10131: x_value => l_interest_calculated
10132: );
10133: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10134: print_error_message('Unexpected error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
10135: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10136: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10137: print_error_message('Error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
10138: RAISE calc_total_int_due_failed;
10139: END IF;
10132: );
10133: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10134: print_error_message('Unexpected error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
10135: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10136: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10137: print_error_message('Error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
10138: RAISE calc_total_int_due_failed;
10139: END IF;
10140: END IF;
10141: RETURN l_interest_calculated;
10142: EXCEPTION
10143: WHEN calc_total_int_due_failed THEN
10144: print_error_message('Exception calc_total_int_due_failed raised in function CALCULATE_TOTAL_INTEREST_DUE');
10145: x_return_status := OKL_API.G_RET_STS_ERROR;
10146: RETURN -1;
10147: WHEN OTHERS THEN
10148: print_error_message('Exception raised in function CALCULATE_TOTAL_INTEREST_DUE');
10149: Okl_Api.SET_MESSAGE(
10145: x_return_status := OKL_API.G_RET_STS_ERROR;
10146: RETURN -1;
10147: WHEN OTHERS THEN
10148: print_error_message('Exception raised in function CALCULATE_TOTAL_INTEREST_DUE');
10149: Okl_Api.SET_MESSAGE(
10150: p_app_name => G_APP_NAME,
10151: p_msg_name => G_UNEXPECTED_ERROR,
10152: p_token1 => G_SQLCODE_TOKEN,
10153: p_token1_value => SQLCODE,
10153: p_token1_value => SQLCODE,
10154: p_token2 => G_SQLERRM_TOKEN,
10155: p_token2_value => SQLERRM);
10156:
10157: x_return_status := OKL_API.G_RET_STS_ERROR;
10158: RETURN -1;
10159: END calculate_total_interest_due;
10160:
10161: PROCEDURE initiate_request(p_api_version IN NUMBER,
10172:
10173:
10174: l_vipv_rec vipv_rec;
10175: x_vipv_rec vipv_rec;
10176: l_skip_prc_engine VARCHAR2(1) := OKL_API.G_FALSE;
10177: --l_rents_tbl and l_rents_tbl_in used for lease processing
10178: l_rents_tbl Okl_Create_Streams_Pub.csm_periodic_expenses_tbl_type;
10179: l_rents_tbl_in Okl_Create_Streams_Pub.csm_periodic_expenses_tbl_type;
10180: --l_rents_prin_tbl used for loan processing
10311: --end | 19-May-08 cklee fixed Bug 7043360 |
10312:
10313: BEGIN
10314:
10315: x_return_status := OKL_API.G_RET_STS_SUCCESS;
10316:
10317: print_debug('****Entering procedure INITIATE_REQUEST****');
10318: FND_FILE.PUT_LINE (FND_FILE.LOG,'Initiating Super Trump Request');
10319:
10390: p_end_date => l_start_date,
10391: p_process_flag => G_INTEREST_CALCULATION_BASIS, /* value is set in Calculate_total_interest_due */
10392: x_interest_rate_tbl => l_interest_rate_tbl);
10393:
10394: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10395: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10396: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10397: RAISE initiate_request_failed;
10398: END IF;
10391: p_process_flag => G_INTEREST_CALCULATION_BASIS, /* value is set in Calculate_total_interest_due */
10392: x_interest_rate_tbl => l_interest_rate_tbl);
10393:
10394: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10395: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10396: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10397: RAISE initiate_request_failed;
10398: END IF;
10399:
10392: x_interest_rate_tbl => l_interest_rate_tbl);
10393:
10394: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
10395: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
10396: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
10397: RAISE initiate_request_failed;
10398: END IF;
10399:
10400: l_interest_rate_tbl_count := l_interest_rate_tbl.COUNT;
10455: x_csm_periodic_expenses_tbl => l_csm_periodic_expenses_tbl,
10456: x_csm_yields_tbl => l_csm_yields_tbl,
10457: x_csm_stream_types_tbl => l_csm_stream_types_tbl);
10458:
10459: IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
10460: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10461: ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
10462: RAISE initiate_request_failed;
10463: END IF;
10456: x_csm_yields_tbl => l_csm_yields_tbl,
10457: x_csm_stream_types_tbl => l_csm_stream_types_tbl);
10458:
10459: IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
10460: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10461: ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
10462: RAISE initiate_request_failed;
10463: END IF;
10464:
10457: x_csm_stream_types_tbl => l_csm_stream_types_tbl);
10458:
10459: IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
10460: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10461: ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
10462: RAISE initiate_request_failed;
10463: END IF;
10464:
10465: print_debug('Contents of l_csm_loan_levels_tbl after call to OKL_LA_STREAM_PUB.extract_params_loan.');
10643: p_due_date => l_start_date,
10644: p_principal_basis => NULL,
10645: x_principal_balance_tbl => l_principal_balance_tbl);
10646:
10647: IF(x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR)THEN
10648: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10649: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR)THEN
10650: RAISE initiate_request_failed;
10651: END IF;
10644: p_principal_basis => NULL,
10645: x_principal_balance_tbl => l_principal_balance_tbl);
10646:
10647: IF(x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR)THEN
10648: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10649: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR)THEN
10650: RAISE initiate_request_failed;
10651: END IF;
10652:
10645: x_principal_balance_tbl => l_principal_balance_tbl);
10646:
10647: IF(x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR)THEN
10648: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10649: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR)THEN
10650: RAISE initiate_request_failed;
10651: END IF;
10652:
10653: --l_csm_loan_levels_tbl_in(l_loan_levels_cntr).amount := get_tot_principal_amt(p_khr_id, l_start_date);
10718: x_msg_count => x_msg_count,
10719: x_msg_data => x_msg_data);
10720: --l_return_status := x_return_status;
10721: print_debug('After pricing call, status :' || l_trans_status);
10722: IF(x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR)THEN
10723: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10724: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR)THEN
10725: RAISE initiate_request_failed;
10726: END IF;
10719: x_msg_data => x_msg_data);
10720: --l_return_status := x_return_status;
10721: print_debug('After pricing call, status :' || l_trans_status);
10722: IF(x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR)THEN
10723: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10724: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR)THEN
10725: RAISE initiate_request_failed;
10726: END IF;
10727:
10720: --l_return_status := x_return_status;
10721: print_debug('After pricing call, status :' || l_trans_status);
10722: IF(x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR)THEN
10723: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10724: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR)THEN
10725: RAISE initiate_request_failed;
10726: END IF;
10727:
10728: print_debug('Super trump request id:' || l_super_trump_request_id);
10754:
10755: print_debug('After calling var_int_rent_level, status :' || x_return_status);
10756: print_debug('Rebook child request id:' || l_child_trx_id);
10757:
10758: IF(x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR)THEN
10759: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10760: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR)THEN
10761: RAISE initiate_request_failed;
10762: END IF;
10755: print_debug('After calling var_int_rent_level, status :' || x_return_status);
10756: print_debug('Rebook child request id:' || l_child_trx_id);
10757:
10758: IF(x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR)THEN
10759: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10760: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR)THEN
10761: RAISE initiate_request_failed;
10762: END IF;
10763: END IF;
10756: print_debug('Rebook child request id:' || l_child_trx_id);
10757:
10758: IF(x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR)THEN
10759: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10760: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR)THEN
10761: RAISE initiate_request_failed;
10762: END IF;
10763: END IF;
10764: END IF;
10798: print_debug('Error '||to_char(i)||': '||x_msg_data);
10799: print_debug('Message Index: '||l_msg_index_out);
10800: END LOOP;
10801:
10802: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
10803: print_error_message('Status after Extract params: '||x_return_status);
10804: print_error_message('Message after Extract params: '||x_msg_data);
10805: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10806: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
10801:
10802: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
10803: print_error_message('Status after Extract params: '||x_return_status);
10804: print_error_message('Message after Extract params: '||x_msg_data);
10805: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10806: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
10807: print_error_message('Status after Extract params: '||x_return_status);
10808: RAISE initiate_request_failed;
10809: END IF;
10802: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
10803: print_error_message('Status after Extract params: '||x_return_status);
10804: print_error_message('Message after Extract params: '||x_msg_data);
10805: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
10806: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
10807: print_error_message('Status after Extract params: '||x_return_status);
10808: RAISE initiate_request_failed;
10809: END IF;
10810: --Fine tune the params
10990: print_debug('Super trump request id:' || l_super_trump_request_id);
10991: print_debug('super trump transaction status:'|| l_trans_status);
10992: print_debug('x return :'||x_return_status);
10993:
10994: IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
10995: print_error_message('Printing message stack.');
10996: FOR i in 1..x_msg_count
10997: LOOP
10998: FND_MSG_PUB.GET(
11006: print_error_message('Error '||to_char(i)||': '||x_msg_data);
11007: print_error_message('Message Index: '||l_msg_index_out);
11008: END LOOP;
11009: END IF;
11010: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
11011: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
11012: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
11013: RAISE initiate_request_failed;
11014: END IF;
11007: print_error_message('Message Index: '||l_msg_index_out);
11008: END LOOP;
11009: END IF;
11010: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
11011: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
11012: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
11013: RAISE initiate_request_failed;
11014: END IF;
11015: END IF;
11008: END LOOP;
11009: END IF;
11010: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
11011: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
11012: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
11013: RAISE initiate_request_failed;
11014: END IF;
11015: END IF;
11016: End IF; -- Added by prasjain bug# 6142095
11038: p_vipv_rec => l_vipv_rec,
11039: x_vipv_rec => x_vipv_rec);
11040:
11041:
11042: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
11043: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
11044: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
11045: RAISE initiate_request_failed;
11046: END IF;
11039: x_vipv_rec => x_vipv_rec);
11040:
11041:
11042: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
11043: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
11044: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
11045: RAISE initiate_request_failed;
11046: END IF;
11047: print_debug('Updating OKL_VAR_INT_PROCESS_V Successful');
11040:
11041:
11042: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
11043: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
11044: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
11045: RAISE initiate_request_failed;
11046: END IF;
11047: print_debug('Updating OKL_VAR_INT_PROCESS_V Successful');
11048:
11160: x_msg_count => x_msg_count,
11161: x_msg_data => x_msg_data,
11162: p_vir_tbl => g_vir_tbl);
11163:
11164: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
11165: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
11166: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
11167: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
11168: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
11162: p_vir_tbl => g_vir_tbl);
11163:
11164: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
11165: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
11166: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
11167: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
11168: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
11169: RAISE initiate_request_failed;
11170: END IF;
11163:
11164: IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
11165: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
11166: RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
11167: ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
11168: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
11169: RAISE initiate_request_failed;
11170: END IF;
11171: print_debug('Updating OKL_VAR_INT_PARAMS Successful');
11178:
11179: EXCEPTION
11180: WHEN initiate_request_failed THEN
11181: print_error_message ('Exception initiate_request_failed raised in procedure initiate_request');
11182: x_return_status := OKL_API.G_RET_STS_ERROR;
11183: WHEN OTHERS THEN
11184: print_error_message ('Exception raised in procedure initiate_request');
11185: Okl_Api.SET_MESSAGE(
11186: p_app_name => G_APP_NAME,
11181: print_error_message ('Exception initiate_request_failed raised in procedure initiate_request');
11182: x_return_status := OKL_API.G_RET_STS_ERROR;
11183: WHEN OTHERS THEN
11184: print_error_message ('Exception raised in procedure initiate_request');
11185: Okl_Api.SET_MESSAGE(
11186: p_app_name => G_APP_NAME,
11187: p_msg_name => G_UNEXPECTED_ERROR,
11188: p_token1 => G_SQLCODE_TOKEN,
11189: p_token1_value => SQLCODE,
11189: p_token1_value => SQLCODE,
11190: p_token2 => G_SQLERRM_TOKEN,
11191: p_token2_value => SQLERRM);
11192:
11193: x_return_status := OKL_API.G_RET_STS_ERROR;
11194: END initiate_request;
11195: ------------------------------------------------------------------------------
11196:
11197: -- Start of Comments
11222: p_due_date IN DATE) IS
11223:
11224: l_api_version CONSTANT NUMBER := 1.0;
11225: l_api_name CONSTANT VARCHAR2(30) := 'VARIABLE_INTEREST_FLOAT';
11226: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
11227: l_msg_index_out NUMBER;
11228: l_principal_balance NUMBER := 0;
11229: l_interest_calculated NUMBER := 0;
11230: r_principal_balance_tbl principal_balance_tbl_typ;
11269: ------------------------------------------------------------
11270: -- Start processing
11271: ------------------------------------------------------------
11272:
11273: x_return_status := OKL_API.G_RET_STS_SUCCESS;
11274: g_vir_tbl.delete;
11275: g_vir_tbl_counter := 0;
11276:
11277: l_interest_calculated := calculate_total_interest_due(
11275: g_vir_tbl_counter := 0;
11276:
11277: l_interest_calculated := calculate_total_interest_due(
11278: p_api_version => 1.0,
11279: p_init_msg_list => OKL_API.G_FALSE,
11280: x_return_status => x_return_status,
11281: x_msg_count => x_msg_count,
11282: x_msg_data => x_msg_data,
11283: p_contract_id => p_contract_id,
11283: p_contract_id => p_contract_id,
11284: p_currency_code => p_currency_code,
11285: p_start_date => p_start_date,
11286: p_due_date => p_due_date);
11287: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11288: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11289: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11290: RAISE Okl_Api.G_EXCEPTION_ERROR;
11291: END IF;
11284: p_currency_code => p_currency_code,
11285: p_start_date => p_start_date,
11286: p_due_date => p_due_date);
11287: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11288: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11289: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11290: RAISE Okl_Api.G_EXCEPTION_ERROR;
11291: END IF;
11292:
11285: p_start_date => p_start_date,
11286: p_due_date => p_due_date);
11287: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11288: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11289: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11290: RAISE Okl_Api.G_EXCEPTION_ERROR;
11291: END IF;
11292:
11293: l_total_loan_pmt := 0;
11286: p_due_date => p_due_date);
11287: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11288: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11289: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11290: RAISE Okl_Api.G_EXCEPTION_ERROR;
11291: END IF;
11292:
11293: l_total_loan_pmt := 0;
11294: l_total_principal_pmt := 0;
11379: END IF;
11380:
11381: Create_Stream_Invoice (
11382: p_api_version => 1.0,
11383: p_init_msg_list => OKL_API.G_FALSE,
11384: x_return_status => x_return_status,
11385: x_msg_count => x_msg_count,
11386: x_msg_data => x_msg_data,
11387: p_contract_id => p_contract_id,
11388: p_line_id => NULL,
11389: p_amount => l_invoice_amt,
11390: p_due_date => p_due_date,
11391: p_stream_type_purpose => l_stream_type_purpose,
11392: p_create_invoice_flag => OKL_API.G_TRUE,
11393: p_parent_strm_element_id => NULL,
11394: x_invoice_id => l_invoice_id,
11395: x_stream_element_id => l_stream_element_id);
11396:
11393: p_parent_strm_element_id => NULL,
11394: x_invoice_id => l_invoice_id,
11395: x_stream_element_id => l_stream_element_id);
11396:
11397: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11398: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11399: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11400: RAISE Okl_Api.G_EXCEPTION_ERROR;
11401: END IF;
11394: x_invoice_id => l_invoice_id,
11395: x_stream_element_id => l_stream_element_id);
11396:
11397: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11398: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11399: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11400: RAISE Okl_Api.G_EXCEPTION_ERROR;
11401: END IF;
11402: i_vir_tbl := g_vir_tbl;
11395: x_stream_element_id => l_stream_element_id);
11396:
11397: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11398: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11399: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11400: RAISE Okl_Api.G_EXCEPTION_ERROR;
11401: END IF;
11402: i_vir_tbl := g_vir_tbl;
11403:
11396:
11397: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11398: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11399: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11400: RAISE Okl_Api.G_EXCEPTION_ERROR;
11401: END IF;
11402: i_vir_tbl := g_vir_tbl;
11403:
11404: upd_vir_params_with_invoice (
11402: i_vir_tbl := g_vir_tbl;
11403:
11404: upd_vir_params_with_invoice (
11405: p_api_version => 1.0,
11406: p_init_msg_list => OKL_API.G_TRUE,
11407: x_return_status => x_return_status,
11408: x_msg_count => x_msg_count,
11409: x_msg_data => x_msg_data,
11410: p_source_id => l_invoice_id,
11409: x_msg_data => x_msg_data,
11410: p_source_id => l_invoice_id,
11411: p_vir_tbl => i_vir_tbl,
11412: x_vir_tbl => r_vir_tbl);
11413: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11414: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11415: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11416: RAISE Okl_Api.G_EXCEPTION_ERROR;
11417: END IF;
11410: p_source_id => l_invoice_id,
11411: p_vir_tbl => i_vir_tbl,
11412: x_vir_tbl => r_vir_tbl);
11413: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11414: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11415: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11416: RAISE Okl_Api.G_EXCEPTION_ERROR;
11417: END IF;
11418:
11411: p_vir_tbl => i_vir_tbl,
11412: x_vir_tbl => r_vir_tbl);
11413: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11414: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11415: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11416: RAISE Okl_Api.G_EXCEPTION_ERROR;
11417: END IF;
11418:
11419: g_vir_tbl := r_vir_tbl;
11412: x_vir_tbl => r_vir_tbl);
11413: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11414: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11415: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11416: RAISE Okl_Api.G_EXCEPTION_ERROR;
11417: END IF;
11418:
11419: g_vir_tbl := r_vir_tbl;
11420:
11419: g_vir_tbl := r_vir_tbl;
11420:
11421: populate_vir_params(
11422: p_api_version => 1.0,
11423: p_init_msg_list => OKL_API.G_TRUE,
11424: x_return_status => x_return_status,
11425: x_msg_count => x_msg_count,
11426: x_msg_data => x_msg_data,
11427: p_vir_tbl => g_vir_tbl);
11424: x_return_status => x_return_status,
11425: x_msg_count => x_msg_count,
11426: x_msg_data => x_msg_data,
11427: p_vir_tbl => g_vir_tbl);
11428: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11429: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
11430: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11431: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11432: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
11426: x_msg_data => x_msg_data,
11427: p_vir_tbl => g_vir_tbl);
11428: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11429: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
11430: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11431: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11432: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
11433: RAISE Okl_Api.G_EXCEPTION_ERROR;
11434: END IF;
11427: p_vir_tbl => g_vir_tbl);
11428: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11429: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
11430: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11431: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11432: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
11433: RAISE Okl_Api.G_EXCEPTION_ERROR;
11434: END IF;
11435:
11429: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
11430: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11431: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11432: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
11433: RAISE Okl_Api.G_EXCEPTION_ERROR;
11434: END IF;
11435:
11436: EXCEPTION
11437: WHEN OTHERS THEN
11435:
11436: EXCEPTION
11437: WHEN OTHERS THEN
11438: print_debug ('exception raised in variable_interest_float');
11439: Okl_Api.SET_MESSAGE(
11440: p_app_name => G_APP_NAME,
11441: p_msg_name => G_UNEXPECTED_ERROR,
11442: p_token1 => G_SQLCODE_TOKEN,
11443: p_token1_value => SQLCODE,
11443: p_token1_value => SQLCODE,
11444: p_token2 => G_SQLERRM_TOKEN,
11445: p_token2_value => SQLERRM);
11446:
11447: x_return_status := OKL_API.G_RET_STS_ERROR;
11448:
11449: END variable_interest_float_old;
11450: ------------------------------------------------------------------------------
11451:
11477: p_due_date IN DATE) IS
11478:
11479: l_api_version CONSTANT NUMBER := 1.0;
11480: l_api_name CONSTANT VARCHAR2(30) := 'VARIABLE_INTEREST_FLOAT';
11481: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
11482: l_msg_index_out NUMBER;
11483: l_principal_balance NUMBER := 0;
11484: l_interest_calculated NUMBER := 0;
11485: r_principal_balance_tbl principal_balance_tbl_typ;
11582: Print_debug('Currency Code: '|| p_currency_code);
11583: print_debug('Start Date: '|| p_start_date);
11584: print_debug('Due Date: '|| p_due_date);
11585:
11586: x_return_status := OKL_API.G_RET_STS_SUCCESS;
11587: g_vir_tbl.delete;
11588: g_vir_tbl_counter := 0;
11589: g_vpb_tbl.delete;
11590: g_vpb_tbl_counter := 0;
11597: x_return_status => x_return_status,
11598: x_msg_count => x_msg_count,
11599: x_msg_data => x_msg_data);
11600:
11601: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11602: print_error_message('Unexpected error raised in call to POPULATE_TXNS');
11603: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11604: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11605: print_error_message('Error raised in call to POPULATE_TXNS');
11599: x_msg_data => x_msg_data);
11600:
11601: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11602: print_error_message('Unexpected error raised in call to POPULATE_TXNS');
11603: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11604: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11605: print_error_message('Error raised in call to POPULATE_TXNS');
11606: RAISE var_int_float_failed;
11607: END IF;
11600:
11601: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11602: print_error_message('Unexpected error raised in call to POPULATE_TXNS');
11603: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11604: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11605: print_error_message('Error raised in call to POPULATE_TXNS');
11606: RAISE var_int_float_failed;
11607: END IF;
11608:
11607: END IF;
11608:
11609: l_interest_calculated := calculate_total_interest_due(
11610: p_api_version => 1.0,
11611: p_init_msg_list => OKL_API.G_FALSE,
11612: x_return_status => x_return_status,
11613: x_msg_count => x_msg_count,
11614: x_msg_data => x_msg_data,
11615: p_contract_id => p_contract_id,
11615: p_contract_id => p_contract_id,
11616: p_currency_code => p_currency_code,
11617: p_start_date => p_start_date,
11618: p_due_date => p_due_date);
11619: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11620: print_error_message('Unexpected error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
11621: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11622: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11623: print_error_message('Error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
11617: p_start_date => p_start_date,
11618: p_due_date => p_due_date);
11619: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11620: print_error_message('Unexpected error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
11621: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11622: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11623: print_error_message('Error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
11624: RAISE var_int_float_failed;
11625: END IF;
11618: p_due_date => p_due_date);
11619: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11620: print_error_message('Unexpected error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
11621: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11622: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11623: print_error_message('Error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
11624: RAISE var_int_float_failed;
11625: END IF;
11626:
11713: p_line_id => NULL,
11714: p_amount => l_invoice_amt,
11715: p_due_date => p_due_date,
11716: p_stream_type_purpose => l_stream_type_purpose,
11717: p_create_invoice_flag => OKL_API.G_TRUE,
11718: p_parent_strm_element_id => NULL,
11719: x_invoice_id => l_invoice_id,
11720: x_stream_element_id => l_stream_element_id);
11721:
11718: p_parent_strm_element_id => NULL,
11719: x_invoice_id => l_invoice_id,
11720: x_stream_element_id => l_stream_element_id);
11721:
11722: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11723: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
11724: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11725: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11726: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
11720: x_stream_element_id => l_stream_element_id);
11721:
11722: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11723: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
11724: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11725: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11726: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
11727: RAISE var_int_float_failed;
11728: END IF;
11721:
11722: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11723: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
11724: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11725: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11726: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
11727: RAISE var_int_float_failed;
11728: END IF;
11729: i_vir_tbl := g_vir_tbl;
11729: i_vir_tbl := g_vir_tbl;
11730:
11731: upd_vir_params_with_invoice (
11732: p_api_version => 1.0,
11733: p_init_msg_list => OKL_API.G_TRUE,
11734: x_return_status => x_return_status,
11735: x_msg_count => x_msg_count,
11736: x_msg_data => x_msg_data,
11737: p_source_id => l_invoice_id,
11736: x_msg_data => x_msg_data,
11737: p_source_id => l_invoice_id,
11738: p_vir_tbl => i_vir_tbl,
11739: x_vir_tbl => r_vir_tbl);
11740: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11741: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
11742: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11743: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11744: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
11738: p_vir_tbl => i_vir_tbl,
11739: x_vir_tbl => r_vir_tbl);
11740: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11741: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
11742: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11743: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11744: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
11745: RAISE var_int_float_failed;
11746: END IF;
11739: x_vir_tbl => r_vir_tbl);
11740: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11741: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
11742: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11743: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11744: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
11745: RAISE var_int_float_failed;
11746: END IF;
11747:
11748: g_vir_tbl := r_vir_tbl;
11749:
11750: populate_vir_params(
11751: p_api_version => 1.0,
11752: p_init_msg_list => OKL_API.G_TRUE,
11753: x_return_status => x_return_status,
11754: x_msg_count => x_msg_count,
11755: x_msg_data => x_msg_data,
11756: p_vir_tbl => g_vir_tbl);
11753: x_return_status => x_return_status,
11754: x_msg_count => x_msg_count,
11755: x_msg_data => x_msg_data,
11756: p_vir_tbl => g_vir_tbl);
11757: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11758: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
11759: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11760: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11761: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
11755: x_msg_data => x_msg_data,
11756: p_vir_tbl => g_vir_tbl);
11757: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11758: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
11759: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11760: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11761: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
11762: RAISE var_int_float_failed;
11763: END IF;
11756: p_vir_tbl => g_vir_tbl);
11757: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11758: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
11759: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11760: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11761: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
11762: RAISE var_int_float_failed;
11763: END IF;
11764:
11769: x_msg_count => x_msg_count,
11770: x_msg_data => x_msg_data,
11771: p_vpb_tbl => g_vpb_tbl);
11772:
11773: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11774: print_error_message('Unexpected error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
11775: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11776: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11777: print_error_message('Error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
11771: p_vpb_tbl => g_vpb_tbl);
11772:
11773: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11774: print_error_message('Unexpected error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
11775: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11776: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11777: print_error_message('Error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
11778: RAISE var_int_float_failed;
11779: END IF;
11772:
11773: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11774: print_error_message('Unexpected error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
11775: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11776: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11777: print_error_message('Error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
11778: RAISE var_int_float_failed;
11779: END IF;
11780:
11804: p_line_id => l_kle_id,
11805: p_amount => l_invoice_amt,
11806: p_due_date => l_strm_element_date,
11807: p_stream_type_purpose => l_stream_type_purpose,
11808: p_create_invoice_flag => OKL_API.G_TRUE,
11809: p_parent_strm_element_id => l_parent_strm_element_id,
11810: x_invoice_id => l_invoice_id,
11811: x_stream_element_id => l_stream_element_id);
11812: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11808: p_create_invoice_flag => OKL_API.G_TRUE,
11809: p_parent_strm_element_id => l_parent_strm_element_id,
11810: x_invoice_id => l_invoice_id,
11811: x_stream_element_id => l_stream_element_id);
11812: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11813: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
11814: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11815: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11816: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
11810: x_invoice_id => l_invoice_id,
11811: x_stream_element_id => l_stream_element_id);
11812: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11813: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
11814: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11815: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11816: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
11817: RAISE var_int_float_failed;
11818: END IF;
11811: x_stream_element_id => l_stream_element_id);
11812: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11813: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
11814: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11815: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11816: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
11817: RAISE var_int_float_failed;
11818: END IF;
11819: END LOOP;
11822:
11823: EXCEPTION
11824: WHEN var_int_float_failed THEN
11825: print_error_message ('Exception var_int_float_failed raised in procedure VARIABLE_INTEREST_FLOAT');
11826: x_return_status := OKL_API.G_RET_STS_ERROR;
11827: WHEN OTHERS THEN
11828: print_error_message ('Exception raised in procedure VARIABLE_INTEREST_FLOAT');
11829: Okl_Api.SET_MESSAGE(
11830: p_app_name => G_APP_NAME,
11825: print_error_message ('Exception var_int_float_failed raised in procedure VARIABLE_INTEREST_FLOAT');
11826: x_return_status := OKL_API.G_RET_STS_ERROR;
11827: WHEN OTHERS THEN
11828: print_error_message ('Exception raised in procedure VARIABLE_INTEREST_FLOAT');
11829: Okl_Api.SET_MESSAGE(
11830: p_app_name => G_APP_NAME,
11831: p_msg_name => G_UNEXPECTED_ERROR,
11832: p_token1 => G_SQLCODE_TOKEN,
11833: p_token1_value => SQLCODE,
11833: p_token1_value => SQLCODE,
11834: p_token2 => G_SQLERRM_TOKEN,
11835: p_token2_value => SQLERRM);
11836:
11837: x_return_status := OKL_API.G_RET_STS_ERROR;
11838:
11839: END variable_interest_float;
11840: ------------------------------------------------------------------------------
11841:
11863: p_to_date IN DATE) IS
11864:
11865: l_api_version CONSTANT NUMBER := 1.0;
11866: l_api_name CONSTANT VARCHAR2(30) := 'VARIABLE_INTEREST_FLOAT_FACTOR';
11867: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
11868: l_stream_type_purpose OKL_STRM_TYPE_V.stream_type_purpose%TYPE;
11869: l_invoice_amt NUMBER := 0;
11870: l_formula_id OKL_FORMULAE_V.id%TYPE;
11871: l_formula_name OKL_FORMULAE_V.name%TYPE;
11910: ------------------------------------------------------------
11911: -- Start processing
11912: ------------------------------------------------------------
11913:
11914: x_return_status := OKL_API.G_RET_STS_SUCCESS;
11915:
11916: print_debug('Executing procedure VARIABLE_INTEREST_FLOAT_FACTOR using following parameters : ');
11917: print_debug('contract ID : '|| p_contract_id);
11918: print_debug('g_contract_id : '|| G_CONTRACT_ID);
11947:
11948: -- Apply FLoat factor formula
11949: Okl_Execute_Formula_Pub.EXECUTE(
11950: p_api_version => 1.0,
11951: p_init_msg_list => OKL_API.G_TRUE,
11952: x_return_status => x_return_status,
11953: x_msg_count => x_msg_count,
11954: x_msg_data => x_msg_data,
11955: p_formula_name => l_formula_name,
11957: p_line_id => l_line_id,
11958: x_value => l_invoice_amt
11959: );
11960:
11961: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11962: print_error_message('Unexpected error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
11963: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11964: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11965: print_error_message('Error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
11959: );
11960:
11961: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11962: print_error_message('Unexpected error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
11963: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11964: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11965: print_error_message('Error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
11966: RAISE var_int_float_factor_failed;
11967: END IF;
11960:
11961: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11962: print_error_message('Unexpected error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
11963: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11964: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11965: print_error_message('Error raised in call to OKL_EXECUTE_FORMULA_PUB.EXECUTE');
11966: RAISE var_int_float_factor_failed;
11967: END IF;
11968:
11982: p_line_id => l_line_id,
11983: p_amount => l_invoice_amt,
11984: p_due_date => l_stream_element_date,
11985: p_stream_type_purpose => l_stream_type_purpose,
11986: p_create_invoice_flag => OKL_API.G_TRUE,
11987: p_parent_strm_element_id => NULL,
11988: x_invoice_id => l_invoice_id,
11989: x_stream_element_id => l_stream_element_id);
11990: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11986: p_create_invoice_flag => OKL_API.G_TRUE,
11987: p_parent_strm_element_id => NULL,
11988: x_invoice_id => l_invoice_id,
11989: x_stream_element_id => l_stream_element_id);
11990: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11991: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
11992: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11993: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11994: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
11988: x_invoice_id => l_invoice_id,
11989: x_stream_element_id => l_stream_element_id);
11990: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11991: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
11992: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11993: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11994: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
11995: RAISE var_int_float_factor_failed;
11996: END IF;
11989: x_stream_element_id => l_stream_element_id);
11990: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
11991: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
11992: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
11993: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
11994: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
11995: RAISE var_int_float_factor_failed;
11996: END IF;
11997: END IF;
12006:
12007: EXCEPTION
12008: WHEN var_int_float_factor_failed THEN
12009: print_error_message('Exception var_int_float_factor_failed raised in procedure VARIABLE_INTEREST_FLOAT_FACTOR');
12010: x_return_status := OKL_API.G_RET_STS_ERROR;
12011: WHEN OTHERS THEN
12012: print_error_message('Exception raised in procedure VARIABLE_INTEREST_FLOAT_FACTOR');
12013: Okl_Api.SET_MESSAGE(
12014: p_app_name => G_APP_NAME,
12009: print_error_message('Exception var_int_float_factor_failed raised in procedure VARIABLE_INTEREST_FLOAT_FACTOR');
12010: x_return_status := OKL_API.G_RET_STS_ERROR;
12011: WHEN OTHERS THEN
12012: print_error_message('Exception raised in procedure VARIABLE_INTEREST_FLOAT_FACTOR');
12013: Okl_Api.SET_MESSAGE(
12014: p_app_name => G_APP_NAME,
12015: p_msg_name => G_UNEXPECTED_ERROR,
12016: p_token1 => G_SQLCODE_TOKEN,
12017: p_token1_value => SQLCODE,
12017: p_token1_value => SQLCODE,
12018: p_token2 => G_SQLERRM_TOKEN,
12019: p_token2_value => SQLERRM);
12020:
12021: x_return_status := OKL_API.G_RET_STS_ERROR;
12022:
12023: END variable_interest_float_factor;
12024: ------------------------------------------------------------------------------
12025: FUNCTION get_next_catchup_date(p_khr_id IN NUMBER) RETURN DATE IS
12109: p_due_date IN DATE) IS
12110:
12111: l_api_version CONSTANT NUMBER := 1.0;
12112: l_api_name CONSTANT VARCHAR2(30) := 'VARIABLE_INTEREST_CATCHUP';
12113: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
12114: l_msg_index_out NUMBER;
12115: l_interest_calculated NUMBER := 0;
12116: l_total_interest_billed NUMBER := 0;
12117: l_principal_adjusted NUMBER := 0;
12189: ------------------------------------------------------------
12190: -- Start processing
12191: ------------------------------------------------------------
12192:
12193: x_return_status := OKL_API.G_RET_STS_SUCCESS;
12194:
12195: print_debug('Executing procedure VARIABLE_INTEREST_CATCHUP using following parameters : ');
12196: print_debug('contract ID: '|| p_contract_id);
12197: print_Debug('Principal Basis: '|| p_principal_basis);
12214: x_return_status => x_return_status,
12215: x_msg_count => x_msg_count,
12216: x_msg_data => x_msg_data);
12217:
12218: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12219: print_error_message('Unexpected error raised in call to POPULATE_TXNS');
12220: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12221: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12222: print_error_message('Error raised in call to POPULATE_TXNS');
12216: x_msg_data => x_msg_data);
12217:
12218: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12219: print_error_message('Unexpected error raised in call to POPULATE_TXNS');
12220: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12221: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12222: print_error_message('Error raised in call to POPULATE_TXNS');
12223: RAISE var_int_catchup_failed;
12224: END IF;
12217:
12218: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12219: print_error_message('Unexpected error raised in call to POPULATE_TXNS');
12220: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12221: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12222: print_error_message('Error raised in call to POPULATE_TXNS');
12223: RAISE var_int_catchup_failed;
12224: END IF;
12225:
12224: END IF;
12225:
12226: l_interest_calculated := calculate_total_interest_due(
12227: p_api_version => 1.0,
12228: p_init_msg_list => OKL_API.G_FALSE,
12229: x_return_status => x_return_status,
12230: x_msg_count => x_msg_count,
12231: x_msg_data => x_msg_data,
12232: p_contract_id => p_contract_id,
12232: p_contract_id => p_contract_id,
12233: p_currency_code => p_currency_code,
12234: p_start_date => p_start_date,
12235: p_due_date => p_due_date);
12236: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12237: print_error_message('Unexpected error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
12238: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12239: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12240: print_error_message('Error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
12234: p_start_date => p_start_date,
12235: p_due_date => p_due_date);
12236: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12237: print_error_message('Unexpected error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
12238: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12239: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12240: print_error_message('Error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
12241: RAISE var_int_catchup_failed;
12242: END IF;
12235: p_due_date => p_due_date);
12236: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12237: print_error_message('Unexpected error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
12238: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12239: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12240: print_error_message('Error raised in call to CALCULATE_TOTAL_INTEREST_DUE');
12241: RAISE var_int_catchup_failed;
12242: END IF;
12243:
12281: p_line_id => NULL,
12282: p_amount => l_invoice_amt,
12283: p_due_date => p_due_date,
12284: p_stream_type_purpose => l_stream_type_purpose,
12285: p_create_invoice_flag => OKL_API.G_TRUE,
12286: p_parent_strm_element_id => NULL,
12287: x_invoice_id => l_invoice_id,
12288: x_stream_element_id => l_stream_element_id);
12289: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12285: p_create_invoice_flag => OKL_API.G_TRUE,
12286: p_parent_strm_element_id => NULL,
12287: x_invoice_id => l_invoice_id,
12288: x_stream_element_id => l_stream_element_id);
12289: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12290: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
12291: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12292: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12293: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
12287: x_invoice_id => l_invoice_id,
12288: x_stream_element_id => l_stream_element_id);
12289: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12290: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
12291: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12292: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12293: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
12294: RAISE var_int_catchup_failed;
12295: END IF;
12288: x_stream_element_id => l_stream_element_id);
12289: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12290: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
12291: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12292: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12293: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
12294: RAISE var_int_catchup_failed;
12295: END IF;
12296:
12297: i_vir_tbl := g_vir_tbl;
12298:
12299: upd_vir_params_with_invoice (
12300: p_api_version => 1.0,
12301: p_init_msg_list => OKL_API.G_TRUE,
12302: x_return_status => x_return_status,
12303: x_msg_count => x_msg_count,
12304: x_msg_data => x_msg_data,
12305: p_source_id => l_invoice_id,
12304: x_msg_data => x_msg_data,
12305: p_source_id => l_invoice_id,
12306: p_vir_tbl => i_vir_tbl,
12307: x_vir_tbl => r_vir_tbl);
12308: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12309: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12310: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12311: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12312: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12306: p_vir_tbl => i_vir_tbl,
12307: x_vir_tbl => r_vir_tbl);
12308: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12309: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12310: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12311: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12312: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12313: RAISE var_int_catchup_failed;
12314: END IF;
12307: x_vir_tbl => r_vir_tbl);
12308: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12309: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12310: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12311: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12312: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12313: RAISE var_int_catchup_failed;
12314: END IF;
12315:
12316: g_vir_tbl := r_vir_tbl;
12317:
12318: populate_vir_params(
12319: p_api_version => 1.0,
12320: p_init_msg_list => OKL_API.G_TRUE,
12321: x_return_status => x_return_status,
12322: x_msg_count => x_msg_count,
12323: x_msg_data => x_msg_data,
12324: p_vir_tbl => g_vir_tbl);
12321: x_return_status => x_return_status,
12322: x_msg_count => x_msg_count,
12323: x_msg_data => x_msg_data,
12324: p_vir_tbl => g_vir_tbl);
12325: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12326: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
12327: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12328: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12329: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
12323: x_msg_data => x_msg_data,
12324: p_vir_tbl => g_vir_tbl);
12325: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12326: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
12327: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12328: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12329: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
12330: RAISE var_int_catchup_failed;
12331: END IF;
12324: p_vir_tbl => g_vir_tbl);
12325: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12326: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
12327: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12328: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12329: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
12330: RAISE var_int_catchup_failed;
12331: END IF;
12332:
12354: p_line_id => NULL,
12355: p_amount => l_invoice_amt,
12356: p_due_date => p_due_date,
12357: p_stream_type_purpose => l_stream_type_purpose,
12358: p_create_invoice_flag => OKL_API.G_TRUE,
12359: p_parent_strm_element_id => NULL,
12360: x_invoice_id => l_invoice_id,
12361: x_stream_element_id => l_stream_element_id);
12362:
12359: p_parent_strm_element_id => NULL,
12360: x_invoice_id => l_invoice_id,
12361: x_stream_element_id => l_stream_element_id);
12362:
12363: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12364: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
12365: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12366: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12367: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
12361: x_stream_element_id => l_stream_element_id);
12362:
12363: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12364: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
12365: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12366: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12367: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
12368: RAISE var_int_catchup_failed;
12369: END IF;
12362:
12363: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12364: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
12365: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12366: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12367: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
12368: RAISE var_int_catchup_failed;
12369: END IF;
12370:
12371: i_vir_tbl := g_vir_tbl;
12372:
12373: upd_vir_params_with_invoice (
12374: p_api_version => 1.0,
12375: p_init_msg_list => OKL_API.G_TRUE,
12376: x_return_status => x_return_status,
12377: x_msg_count => x_msg_count,
12378: x_msg_data => x_msg_data,
12379: p_source_id => l_invoice_id,
12378: x_msg_data => x_msg_data,
12379: p_source_id => l_invoice_id,
12380: p_vir_tbl => i_vir_tbl,
12381: x_vir_tbl => r_vir_tbl);
12382: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12383: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12384: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12385: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12386: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12380: p_vir_tbl => i_vir_tbl,
12381: x_vir_tbl => r_vir_tbl);
12382: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12383: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12384: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12385: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12386: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12387: RAISE var_int_catchup_failed;
12388: END IF;
12381: x_vir_tbl => r_vir_tbl);
12382: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12383: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12384: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12385: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12386: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12387: RAISE var_int_catchup_failed;
12388: END IF;
12389:
12390: g_vir_tbl := r_vir_tbl;
12391:
12392: populate_vir_params(
12393: p_api_version => 1.0,
12394: p_init_msg_list => OKL_API.G_TRUE,
12395: x_return_status => x_return_status,
12396: x_msg_count => x_msg_count,
12397: x_msg_data => x_msg_data,
12398: p_vir_tbl => g_vir_tbl);
12395: x_return_status => x_return_status,
12396: x_msg_count => x_msg_count,
12397: x_msg_data => x_msg_data,
12398: p_vir_tbl => g_vir_tbl);
12399: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12400: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
12401: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12402: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12403: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
12397: x_msg_data => x_msg_data,
12398: p_vir_tbl => g_vir_tbl);
12399: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12400: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
12401: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12402: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12403: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
12404: RAISE var_int_catchup_failed;
12405: END IF;
12398: p_vir_tbl => g_vir_tbl);
12399: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12400: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
12401: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12402: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12403: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
12404: RAISE var_int_catchup_failed;
12405: END IF;
12406:
12412: FOR current_line IN contract_line_csr(p_contract_id)
12413: LOOP
12414: prin_date_range_var_rate_ctr (
12415: p_api_version => 1.0,
12416: p_init_msg_list => OKL_API.G_FALSE,
12417: x_return_status => x_return_status,
12418: x_msg_count => x_msg_count,
12419: x_msg_data => x_msg_data,
12420: p_contract_id => p_contract_id,
12422: p_start_date => p_start_date,
12423: p_due_date => p_due_date,
12424: p_principal_basis => G_PRINCIPAL_BASIS_CODE,
12425: x_principal_balance_tbl => l_principal_balance_tbl);
12426: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12427: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
12428: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12429: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12430: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
12424: p_principal_basis => G_PRINCIPAL_BASIS_CODE,
12425: x_principal_balance_tbl => l_principal_balance_tbl);
12426: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12427: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
12428: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12429: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12430: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
12431: RAISE var_int_catchup_failed;
12432: END IF;
12425: x_principal_balance_tbl => l_principal_balance_tbl);
12426: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12427: print_error_message('Unexpected error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
12428: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12429: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12430: print_error_message('Error raised in call to PRIN_DATE_RANGE_VAR_RATE_CTR');
12431: RAISE var_int_catchup_failed;
12432: END IF;
12433:
12476: p_line_id => l_asset_line_tbl(l_index).id,
12477: p_amount => l_prorated_invoice_amt,
12478: p_due_date => p_due_date,
12479: p_stream_type_purpose => l_stream_type_purpose,
12480: p_create_invoice_flag => OKL_API.G_FALSE,
12481: p_process_flag => 'PRINCIPAL_CATCHUP',
12482: p_parent_strm_element_id => NULL,
12483: x_invoice_id => l_invoice_id,
12484: x_stream_element_id => l_stream_element_id);
12482: p_parent_strm_element_id => NULL,
12483: x_invoice_id => l_invoice_id,
12484: x_stream_element_id => l_stream_element_id);
12485:
12486: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12487: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
12488: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12489: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12490: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
12484: x_stream_element_id => l_stream_element_id);
12485:
12486: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12487: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
12488: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12489: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12490: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
12491: RAISE var_int_catchup_failed;
12492: END IF;
12485:
12486: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12487: print_error_message('Unexpected error raised in call to CREATE_STREAM_INVOICE');
12488: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12489: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12490: print_error_message('Error raised in call to CREATE_STREAM_INVOICE');
12491: RAISE var_int_catchup_failed;
12492: END IF;
12493: print_debug('Successfully created PRINCIPAL_CATCHUP adjustment streams for asset id : ' || l_asset_line_tbl(l_index).id || ' for Amount :' || l_prorated_invoice_amt);
12499: i_vir_tbl := g_vir_tbl;
12500:
12501: upd_vir_params_with_invoice (
12502: p_api_version => 1.0,
12503: p_init_msg_list => OKL_API.G_TRUE,
12504: x_return_status => x_return_status,
12505: x_msg_count => x_msg_count,
12506: x_msg_data => x_msg_data,
12507: p_source_id => l_stream_element_id,
12506: x_msg_data => x_msg_data,
12507: p_source_id => l_stream_element_id,
12508: p_vir_tbl => i_vir_tbl,
12509: x_vir_tbl => r_vir_tbl);
12510: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12511: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12512: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12513: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12514: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12508: p_vir_tbl => i_vir_tbl,
12509: x_vir_tbl => r_vir_tbl);
12510: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12511: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12512: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12513: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12514: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12515: RAISE var_int_catchup_failed;
12516: END IF;
12509: x_vir_tbl => r_vir_tbl);
12510: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12511: print_error_message('Unexpected error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12512: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12513: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12514: print_error_message('Error raised in call to UPD_VIR_PARAMS_WITH_INVOICE');
12515: RAISE var_int_catchup_failed;
12516: END IF;
12517:
12518: g_vir_tbl := r_vir_tbl;
12519:
12520: populate_vir_params(
12521: p_api_version => 1.0,
12522: p_init_msg_list => OKL_API.G_TRUE,
12523: x_return_status => x_return_status,
12524: x_msg_count => x_msg_count,
12525: x_msg_data => x_msg_data,
12526: p_vir_tbl => g_vir_tbl);
12523: x_return_status => x_return_status,
12524: x_msg_count => x_msg_count,
12525: x_msg_data => x_msg_data,
12526: p_vir_tbl => g_vir_tbl);
12527: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12528: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
12529: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12530: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12531: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
12525: x_msg_data => x_msg_data,
12526: p_vir_tbl => g_vir_tbl);
12527: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12528: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
12529: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12530: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12531: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
12532: RAISE var_int_catchup_failed;
12533: END IF;
12526: p_vir_tbl => g_vir_tbl);
12527: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12528: print_error_message('Unexpected error raised in call to POPULATE_VIR_PARAMS');
12529: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12530: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12531: print_error_message('Error raised in call to POPULATE_VIR_PARAMS');
12532: RAISE var_int_catchup_failed;
12533: END IF;
12534: END IF;
12545: x_msg_count => x_msg_count,
12546: x_msg_data => x_msg_data,
12547: p_vpb_tbl => g_vpb_tbl);
12548:
12549: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12550: print_error_message('Unexpected error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
12551: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12552: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12553: print_error_message('Error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
12547: p_vpb_tbl => g_vpb_tbl);
12548:
12549: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12550: print_error_message('Unexpected error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
12551: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12552: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12553: print_error_message('Error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
12554: RAISE var_int_catchup_failed;
12555: END IF;
12548:
12549: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12550: print_error_message('Unexpected error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
12551: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12552: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12553: print_error_message('Error raised in call to POPULATE_PRINCIPAL_BAL_TXN');
12554: RAISE var_int_catchup_failed;
12555: END IF;
12556:
12560:
12561: EXCEPTION
12562: WHEN var_int_catchup_failed THEN
12563: print_error_message ('Exception var_int_catchup_failed raised in procedure VARIABLE_INTEREST_CATCHUP');
12564: x_return_status := OKL_API.G_RET_STS_ERROR;
12565: WHEN OTHERS THEN
12566: print_error_message ('Exception raised in procedure VARIABLE_INTEREST_CATCHUP');
12567: Okl_Api.SET_MESSAGE(
12568: p_app_name => G_APP_NAME,
12563: print_error_message ('Exception var_int_catchup_failed raised in procedure VARIABLE_INTEREST_CATCHUP');
12564: x_return_status := OKL_API.G_RET_STS_ERROR;
12565: WHEN OTHERS THEN
12566: print_error_message ('Exception raised in procedure VARIABLE_INTEREST_CATCHUP');
12567: Okl_Api.SET_MESSAGE(
12568: p_app_name => G_APP_NAME,
12569: p_msg_name => G_UNEXPECTED_ERROR,
12570: p_token1 => G_SQLCODE_TOKEN,
12571: p_token1_value => SQLCODE,
12570: p_token1 => G_SQLCODE_TOKEN,
12571: p_token1_value => SQLCODE,
12572: p_token2 => G_SQLERRM_TOKEN,
12573: p_token2_value => SQLERRM);
12574: x_return_status := OKL_API.G_RET_STS_ERROR;
12575: END variable_interest_catchup;
12576:
12577: -----------------------------------------------------------------
12578: PROCEDURE variable_interest(
12590: ------------------------------------------------------------
12591:
12592: l_api_version CONSTANT NUMBER := 1.0;
12593: l_api_name CONSTANT VARCHAR2(30) := 'VARIABLE_INTEREST';
12594: l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
12595: l_msg_data VARCHAR2(2000);
12596: l_def_no_val CONSTANT NUMBER := -1;
12597: l_bill_date OKL_TRX_AR_INVOICES_V.date_invoiced%TYPE;
12598: l_kle_id OKL_TXL_AR_INV_LNS_V.kle_id%TYPE;
12682: ------------------------------------------------------------
12683: -- Start processing
12684: ------------------------------------------------------------
12685:
12686: x_return_status := OKL_API.G_RET_STS_SUCCESS;
12687:
12688: g_request_id := FND_GLOBAL.CONC_REQUEST_ID;
12689:
12690: print_debug ('g_request_id : '|| g_request_id);
12791: print_debug ('To Date : '|| l_to_date);
12792:
12793: variable_interest_float_factor(
12794: p_api_version => 1.0,
12795: p_init_msg_list => OKL_API.G_TRUE,
12796: x_return_status => l_return_status,
12797: x_msg_count => l_msg_count,
12798: x_msg_data => l_msg_data,
12799: p_contract_id => G_CONTRACT_ID,
12798: x_msg_data => l_msg_data,
12799: p_contract_id => G_CONTRACT_ID,
12800: p_from_date => l_from_date,
12801: p_to_date => l_to_date);
12802: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12803: print_error_message('Unexpected error raised in call to VARIABLE_INTEREST_FLOAT_FACTOR');
12804: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12805: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12806: print_error_message('Error raised in call to VARIABLE_INTEREST_FLOAT_FACTOR');
12800: p_from_date => l_from_date,
12801: p_to_date => l_to_date);
12802: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12803: print_error_message('Unexpected error raised in call to VARIABLE_INTEREST_FLOAT_FACTOR');
12804: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12805: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12806: print_error_message('Error raised in call to VARIABLE_INTEREST_FLOAT_FACTOR');
12807: RAISE variable_interest_failed;
12808: END IF;
12801: p_to_date => l_to_date);
12802: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12803: print_error_message('Unexpected error raised in call to VARIABLE_INTEREST_FLOAT_FACTOR');
12804: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12805: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12806: print_error_message('Error raised in call to VARIABLE_INTEREST_FLOAT_FACTOR');
12807: RAISE variable_interest_failed;
12808: END IF;
12809: print_debug('Variable interest calculation completed successfully for contract id : '|| G_CONTRACT_ID);
12820: p_last_int_calc_date => l_last_interest_cal_date,
12821: x_msg_count => x_msg_count,
12822: x_msg_data => x_msg_data);
12823:
12824: x_return_status := OKL_API.G_RET_STS_ERROR;
12825: END;
12826: ELSIF (G_INTEREST_CALCULATION_BASIS = G_INT_CALC_BASIS_REAMORT) THEN
12827: BEGIN
12828: print_debug ('contract id : '|| G_CONTRACT_ID );
12834: print_debug('Reamort Date is past the system date (with print lead days included) or is past the To Date or is past the Contract End Date.');
12835: ELSE
12836: initiate_request(
12837: p_api_version => 1.0,
12838: p_init_msg_list => OKL_API.G_TRUE,
12839: p_khr_id => G_CONTRACT_ID,
12840: x_return_status => l_return_status,
12841: x_msg_count => l_msg_count,
12842: x_msg_data => l_msg_data);
12840: x_return_status => l_return_status,
12841: x_msg_count => l_msg_count,
12842: x_msg_data => l_msg_data);
12843:
12844: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12845: print_error_message('Unexpected error raised in call to INITIATE_REQUEST');
12846: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12847: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12848: print_error_message('Error raised in call to INITIATE_REQUEST');
12842: x_msg_data => l_msg_data);
12843:
12844: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12845: print_error_message('Unexpected error raised in call to INITIATE_REQUEST');
12846: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12847: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12848: print_error_message('Error raised in call to INITIATE_REQUEST');
12849: RAISE variable_interest_failed;
12850: END IF;
12843:
12844: IF (l_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12845: print_error_message('Unexpected error raised in call to INITIATE_REQUEST');
12846: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12847: ELSIF (l_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12848: print_error_message('Error raised in call to INITIATE_REQUEST');
12849: RAISE variable_interest_failed;
12850: END IF;
12851: print_debug('Variable interest calculation completed successfully for contract id : '|| G_CONTRACT_ID);
12863: p_last_int_calc_date => l_last_interest_cal_date,
12864: x_msg_count => x_msg_count,
12865: x_msg_data => x_msg_data);
12866:
12867: x_return_status := OKL_API.G_RET_STS_ERROR;
12868: END;
12869: ELSIF (G_INTEREST_CALCULATION_BASIS = G_INT_CALC_BASIS_FLOAT) THEN
12870: BEGIN
12871: IF (l_last_interest_cal_date is not null
12904: x_return_status => x_return_status,
12905: x_msg_count => x_msg_count,
12906: x_msg_data => x_msg_data);
12907:
12908: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12909: print_error_message('Unexpected error raised in call to OKL_STREAM_GENERATOR_PVT.get_next_billing_date');
12910: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12911: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12912: print_error_message('Error raised in call to OKL_STREAM_GENERATOR_PVT.get_next_billing_date');
12906: x_msg_data => x_msg_data);
12907:
12908: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12909: print_error_message('Unexpected error raised in call to OKL_STREAM_GENERATOR_PVT.get_next_billing_date');
12910: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12911: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12912: print_error_message('Error raised in call to OKL_STREAM_GENERATOR_PVT.get_next_billing_date');
12913: RAISE variable_interest_failed;
12914: END IF;
12907:
12908: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12909: print_error_message('Unexpected error raised in call to OKL_STREAM_GENERATOR_PVT.get_next_billing_date');
12910: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12911: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12912: print_error_message('Error raised in call to OKL_STREAM_GENERATOR_PVT.get_next_billing_date');
12913: RAISE variable_interest_failed;
12914: END IF;
12915:
12929: END IF;
12930:
12931: print_debug('Stream Element Date: '||l_due_date);
12932:
12933: x_return_status := OKL_API.G_RET_STS_SUCCESS;
12934: ----------------------------------------------------
12935: -- Create new transaction header for every
12936: -- contract and bill_date combination
12937: ----------------------------------------------------
12967: END IF;
12968:
12969: variable_interest_float(
12970: p_api_version => 1.0,
12971: p_init_msg_list => OKL_API.G_TRUE,
12972: x_return_status => x_return_status,
12973: x_msg_count => x_msg_count,
12974: x_msg_data => x_msg_data,
12975: p_contract_id => G_CONTRACT_ID,
12979: p_currency_code => G_CURRENCY_CODE,
12980: p_start_date => l_int_cal_start_date,
12981: p_due_date => l_due_date);
12982:
12983: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12984: print_error_message('Unexpected error raised in call to VARIABLE_INTEREST_FLOAT');
12985: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12986: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12987: print_error_message('Error raised in call to VARIABLE_INTEREST_FLOAT');
12981: p_due_date => l_due_date);
12982:
12983: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12984: print_error_message('Unexpected error raised in call to VARIABLE_INTEREST_FLOAT');
12985: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12986: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12987: print_error_message('Error raised in call to VARIABLE_INTEREST_FLOAT');
12988: RAISE variable_interest_failed;
12989: END IF;
12982:
12983: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
12984: print_error_message('Unexpected error raised in call to VARIABLE_INTEREST_FLOAT');
12985: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
12986: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
12987: print_error_message('Error raised in call to VARIABLE_INTEREST_FLOAT');
12988: RAISE variable_interest_failed;
12989: END IF;
12990:
13008: g_no_of_successful_contracts := g_no_of_successful_contracts + 1;
13009: EXCEPTION
13010: WHEN OTHERS THEN
13011: g_no_of_rejected_contracts := g_no_of_rejected_contracts + 1;
13012: x_return_status := OKL_API.G_RET_STS_ERROR;
13013: l_end_of_process := TRUE;
13014: report_error (
13015: p_contract_number => l_contract_number,
13016: p_product_name => l_product_name,
13058: END IF;
13059:
13060: VARIABLE_INTEREST_CATCHUP(
13061: p_api_version => p_api_version,
13062: p_init_msg_list => Okl_Api.G_TRUE,
13063: x_return_status => x_return_status,
13064: x_msg_count => x_msg_count,
13065: x_msg_data => x_msg_data,
13066: p_contract_id => G_CONTRACT_ID,
13070: p_currency_code => G_CURRENCY_CODE,
13071: p_start_date => l_int_cal_start_date,
13072: p_due_date => l_catchup_date);
13073:
13074: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
13075: print_error_message('Unexpected error raised in call to VARIABLE_INTEREST_CATCHUP');
13076: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
13077: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
13078: print_error_message('Error raised in call to VARIABLE_INTEREST_CATCHUP');
13072: p_due_date => l_catchup_date);
13073:
13074: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
13075: print_error_message('Unexpected error raised in call to VARIABLE_INTEREST_CATCHUP');
13076: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
13077: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
13078: print_error_message('Error raised in call to VARIABLE_INTEREST_CATCHUP');
13079: RAISE variable_interest_failed;
13080: END IF;
13073:
13074: IF (x_return_status = Okl_Api.G_RET_STS_UNEXP_ERROR) THEN
13075: print_error_message('Unexpected error raised in call to VARIABLE_INTEREST_CATCHUP');
13076: RAISE Okl_Api.G_EXCEPTION_UNEXPECTED_ERROR;
13077: ELSIF (x_return_status = Okl_Api.G_RET_STS_ERROR) THEN
13078: print_error_message('Error raised in call to VARIABLE_INTEREST_CATCHUP');
13079: RAISE variable_interest_failed;
13080: END IF;
13081:
13101: g_no_of_successful_contracts := g_no_of_successful_contracts + 1;
13102: EXCEPTION
13103: WHEN OTHERS THEN
13104: g_no_of_rejected_contracts := g_no_of_rejected_contracts + 1;
13105: x_return_status := OKL_API.G_RET_STS_ERROR;
13106: l_end_of_process := TRUE;
13107: report_error (
13108: p_contract_number => l_contract_number,
13109: p_product_name => l_product_name,
13178: p_interest_calc_basis => G_INTEREST_CALCULATION_BASIS,
13179: p_last_int_calc_date => l_last_interest_cal_date,
13180: x_msg_count => x_msg_count,
13181: x_msg_data => x_msg_data);
13182: x_return_status := OKL_API.G_RET_STS_ERROR;
13183: ROLLBACK;
13184: END variable_interest;
13185: END;