97:
98: x_total_budgets := 0;
99: -- validate if subsidy pool id passed is valid
100: IF(p_subsidy_pool_id IS NULL OR p_subsidy_pool_id = OKL_API.G_MISS_NUM)THEN
101: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'p_subsidy_pool_id');
102: x_return_status := OKC_API.G_RET_STS_ERROR;
103: RAISE OKL_API.G_EXCEPTION_ERROR;
104: END IF;
105: -- get the subsidy pool details to process
98: x_total_budgets := 0;
99: -- validate if subsidy pool id passed is valid
100: IF(p_subsidy_pool_id IS NULL OR p_subsidy_pool_id = OKL_API.G_MISS_NUM)THEN
101: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'p_subsidy_pool_id');
102: x_return_status := OKC_API.G_RET_STS_ERROR;
103: RAISE OKL_API.G_EXCEPTION_ERROR;
104: END IF;
105: -- get the subsidy pool details to process
106: OPEN c_get_pool_details_csr; FETCH c_get_pool_details_csr INTO cv_pool_details_csr;
107: CLOSE c_get_pool_details_csr;
108:
109: -- if the pool status is not new, then error out. initial pool approval should have the pool status and the line status as NEW
110: IF(cv_pool_details_csr.decision_status_code <> 'NEW')THEN
111: OKC_API.set_message(G_APP_NAME, G_INVALID_POOL_STATUS, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name);
112: x_return_status := OKC_API.G_RET_STS_ERROR;
113: RAISE OKL_API.G_EXCEPTION_ERROR;
114: END IF;
115:
108:
109: -- if the pool status is not new, then error out. initial pool approval should have the pool status and the line status as NEW
110: IF(cv_pool_details_csr.decision_status_code <> 'NEW')THEN
111: OKC_API.set_message(G_APP_NAME, G_INVALID_POOL_STATUS, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name);
112: x_return_status := OKC_API.G_RET_STS_ERROR;
113: RAISE OKL_API.G_EXCEPTION_ERROR;
114: END IF;
115:
116: -- check for pool expiration here. pool could be logically expired by the time user submits for approval.
145: -- at least one subsidy
146: OPEN c_chk_subsidy_assoc_csr; FETCH c_chk_subsidy_assoc_csr INTO lv_dummy_var;
147: CLOSE c_chk_subsidy_assoc_csr;
148: IF(NVL(lv_dummy_var,'N')<> 'X')THEN
149: OKC_API.set_message(G_APP_NAME, G_POOL_NO_SUB_ASSOC, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name);
150: x_return_status := OKC_API.G_RET_STS_ERROR;
151: RAISE OKL_API.G_EXCEPTION_ERROR;
152: END IF;
153: -- get the number of subsidy pool budget lines
146: OPEN c_chk_subsidy_assoc_csr; FETCH c_chk_subsidy_assoc_csr INTO lv_dummy_var;
147: CLOSE c_chk_subsidy_assoc_csr;
148: IF(NVL(lv_dummy_var,'N')<> 'X')THEN
149: OKC_API.set_message(G_APP_NAME, G_POOL_NO_SUB_ASSOC, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name);
150: x_return_status := OKC_API.G_RET_STS_ERROR;
151: RAISE OKL_API.G_EXCEPTION_ERROR;
152: END IF;
153: -- get the number of subsidy pool budget lines
154: lv_number_of_lines:=0;
154: lv_number_of_lines:=0;
155: OPEN c_get_pool_line_number; FETCH c_get_pool_line_number INTO lv_number_of_lines;
156: CLOSE c_get_pool_line_number;
157: IF(lv_number_of_lines = 0)THEN
158: OKC_API.set_message(G_APP_NAME, G_POOL_HAS_NO_LINES, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name);
159: x_return_status := OKC_API.G_RET_STS_ERROR;
160: RAISE OKL_API.G_EXCEPTION_ERROR;
161: ELSIF(lv_number_of_lines > 1)THEN -- for initial pool approval, only one budget line is allowed.
162: OKC_API.set_message(G_APP_NAME, G_POOL_HAS_MORE_LINES, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name);
155: OPEN c_get_pool_line_number; FETCH c_get_pool_line_number INTO lv_number_of_lines;
156: CLOSE c_get_pool_line_number;
157: IF(lv_number_of_lines = 0)THEN
158: OKC_API.set_message(G_APP_NAME, G_POOL_HAS_NO_LINES, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name);
159: x_return_status := OKC_API.G_RET_STS_ERROR;
160: RAISE OKL_API.G_EXCEPTION_ERROR;
161: ELSIF(lv_number_of_lines > 1)THEN -- for initial pool approval, only one budget line is allowed.
162: OKC_API.set_message(G_APP_NAME, G_POOL_HAS_MORE_LINES, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name);
163: x_return_status := OKC_API.G_RET_STS_ERROR;
158: OKC_API.set_message(G_APP_NAME, G_POOL_HAS_NO_LINES, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name);
159: x_return_status := OKC_API.G_RET_STS_ERROR;
160: RAISE OKL_API.G_EXCEPTION_ERROR;
161: ELSIF(lv_number_of_lines > 1)THEN -- for initial pool approval, only one budget line is allowed.
162: OKC_API.set_message(G_APP_NAME, G_POOL_HAS_MORE_LINES, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name);
163: x_return_status := OKC_API.G_RET_STS_ERROR;
164: RAISE OKL_API.G_EXCEPTION_ERROR;
165: END IF;
166:
159: x_return_status := OKC_API.G_RET_STS_ERROR;
160: RAISE OKL_API.G_EXCEPTION_ERROR;
161: ELSIF(lv_number_of_lines > 1)THEN -- for initial pool approval, only one budget line is allowed.
162: OKC_API.set_message(G_APP_NAME, G_POOL_HAS_MORE_LINES, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name);
163: x_return_status := OKC_API.G_RET_STS_ERROR;
164: RAISE OKL_API.G_EXCEPTION_ERROR;
165: END IF;
166:
167: -- get the budget line details
168: OPEN c_get_pool_line_details_csr; FETCH c_get_pool_line_details_csr INTO cv_get_pool_line_details_csr;
169: CLOSE c_get_pool_line_details_csr;
170: IF(cv_get_pool_line_details_csr.budget_type_code <> 'ADDITION' OR cv_get_pool_line_details_csr.budget_amount <= 0
171: OR cv_get_pool_line_details_csr.decision_status_code <> 'NEW')THEN
172: OKC_API.set_message(G_APP_NAME, G_POOL_LINE_INVALID, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name
173: ,'AMOUNT',cv_get_pool_line_details_csr.budget_amount);
174: x_return_status := OKC_API.G_RET_STS_ERROR;
175: RAISE OKL_API.G_EXCEPTION_ERROR;
176: END IF;
170: IF(cv_get_pool_line_details_csr.budget_type_code <> 'ADDITION' OR cv_get_pool_line_details_csr.budget_amount <= 0
171: OR cv_get_pool_line_details_csr.decision_status_code <> 'NEW')THEN
172: OKC_API.set_message(G_APP_NAME, G_POOL_LINE_INVALID, 'POOL_NAME', cv_pool_details_csr.subsidy_pool_name
173: ,'AMOUNT',cv_get_pool_line_details_csr.budget_amount);
174: x_return_status := OKC_API.G_RET_STS_ERROR;
175: RAISE OKL_API.G_EXCEPTION_ERROR;
176: END IF;
177:
178: -- now that all the required validations are passed, update the pool and line status to pending approval
423: is_debug_statement_on := okl_debug_pub.check_log_on(l_module,FND_LOG.LEVEL_STATEMENT);
424:
425: -- validate if subsidy pool budget id passed is valid
426: IF(p_subsidy_pool_budget_id IS NULL OR p_subsidy_pool_budget_id = OKL_API.G_MISS_NUM)THEN
427: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'p_subsidy_pool_budget_id');
428: x_return_status := OKC_API.G_RET_STS_ERROR;
429: RAISE OKL_API.G_EXCEPTION_ERROR;
430: END IF;
431:
424:
425: -- validate if subsidy pool budget id passed is valid
426: IF(p_subsidy_pool_budget_id IS NULL OR p_subsidy_pool_budget_id = OKL_API.G_MISS_NUM)THEN
427: OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'p_subsidy_pool_budget_id');
428: x_return_status := OKC_API.G_RET_STS_ERROR;
429: RAISE OKL_API.G_EXCEPTION_ERROR;
430: END IF;
431:
432: -- get the pool and the budget line information
434: CLOSE c_get_pool_info_csr;
435:
436: -- check if the pool status is ACTIVE, if not ACTIVE, throw error
437: IF(cv_get_pool_info.pool_status <> 'ACTIVE')THEN
438: OKC_API.set_message(G_APP_NAME, G_POOL_IS_NOT_ACTIVE, 'POOL_NAME', cv_get_pool_info.subsidy_pool_name);
439: x_return_status := OKC_API.G_RET_STS_ERROR;
440: RAISE OKL_API.G_EXCEPTION_ERROR;
441: END IF;
442:
435:
436: -- check if the pool status is ACTIVE, if not ACTIVE, throw error
437: IF(cv_get_pool_info.pool_status <> 'ACTIVE')THEN
438: OKC_API.set_message(G_APP_NAME, G_POOL_IS_NOT_ACTIVE, 'POOL_NAME', cv_get_pool_info.subsidy_pool_name);
439: x_return_status := OKC_API.G_RET_STS_ERROR;
440: RAISE OKL_API.G_EXCEPTION_ERROR;
441: END IF;
442:
443: -- check for pool expiration here. pool could be logically expired by the time user submits line for approval.
469: END IF;
470: -- check if the line status is NEW, if not throw an error. this check is required as the user might resubmit the same
471: -- line for approval, by clicking on the refresh icon (even when the submit for approval is disabled)
472: IF(cv_get_pool_info.line_status <> 'NEW')THEN
473: OKC_API.set_message(G_APP_NAME, G_POOL_LINE_INVALID, 'POOL_NAME', cv_get_pool_info.subsidy_pool_name
474: ,'AMOUNT',cv_get_pool_info.budget_amount);
475: x_return_status := OKC_API.G_RET_STS_ERROR;
476: RAISE OKL_API.G_EXCEPTION_ERROR;
477: END IF;
471: -- line for approval, by clicking on the refresh icon (even when the submit for approval is disabled)
472: IF(cv_get_pool_info.line_status <> 'NEW')THEN
473: OKC_API.set_message(G_APP_NAME, G_POOL_LINE_INVALID, 'POOL_NAME', cv_get_pool_info.subsidy_pool_name
474: ,'AMOUNT',cv_get_pool_info.budget_amount);
475: x_return_status := OKC_API.G_RET_STS_ERROR;
476: RAISE OKL_API.G_EXCEPTION_ERROR;
477: END IF;
478:
479: -- now that the validations have been passed, set the budget line to pending for approval