[Home] [Help]
24:
25: PROCEDURE set_global_variables
26: (p_project_id IN pa_budget_versions.project_id%TYPE,
27: -- p_plan_class_code IN pa_fin_plan_types_b.plan_class_code%TYPE,
28: x_factor_by_code OUT NOCOPY pa_proj_fp_options.factor_by_code%TYPE, --File.Sql.39 bug 4440895
29: x_return_status OUT NOCOPY VARCHAR2, --File.Sql.39 bug 4440895
30: x_msg_count OUT NOCOPY NUMBER, --File.Sql.39 bug 4440895
31: x_msg_data OUT NOCOPY VARCHAR2) --File.Sql.39 bug 4440895
32: is
37: -- pa_fin_plan_type_global.G_PLAN_CLASS_CODE := p_plan_class_code;
38: -- *** bug fix 2770782: retrieve x_budget_status code from project-level row ***
39: select nvl(po.factor_by_code, 1)
40: into x_factor_by_code
41: from pa_proj_fp_options po
42: where po.project_id = p_project_id and
43: po.fin_plan_option_level_code = 'PROJECT';
44:
45: EXCEPTION WHEN NO_DATA_FOUND THEN
245: , gen_src_all_plan_version_id
246: , gen_src_all_plan_ver_code
247: , fin_plan_option_level_code
248: , proj_fp_options_id
249: FROM pa_proj_fp_options
250: WHERE project_id = c_project_id
251: AND fin_plan_type_id IS NOT NULL -- eliminates project level record
252: AND fin_plan_type_id <> c_fin_plan_type_id -- eliminates plan type being deleted
253: AND (gen_src_cost_plan_type_id = c_fin_plan_type_id OR
259: -- Bug 3619687 Cursor to return the default generation source plan type
260: CURSOR def_gen_src_plan_type_cur (c_project_id NUMBER, c_fin_plan_type_id NUMBER)IS
261: SELECT pt.fin_plan_type_id as fin_plan_type_id
262: ,pt.plan_class_code as plan_class_code
263: FROM pa_proj_fp_options o
264: ,pa_fin_plan_types_vl pt
265: WHERE o.project_id = c_project_id
266: AND o.fin_plan_option_level_code = 'PLAN_TYPE'
267: AND o.fin_plan_type_id <> c_fin_plan_type_id
272:
273: --Bug#11776072 - cusror to get rbs_version_id
274: CURSOR get_rbs_version_id_cur(c_project_id NUMBER, c_fin_plan_type_id NUMBER) IS
275: SELECT rbs_version_id
276: FROM pa_proj_fp_options
277: WHERE project_id = c_project_id
278: AND fin_plan_type_id=c_fin_plan_type_id
279: and fin_plan_option_level_code = 'PLAN_TYPE';
280:
286:
287: --Bug#11776072 - cusror to check rbs association in the project
288: CURSOR check_association_cur(c_rbs_version_id pa_rbs_versions_b.rbs_version_id%TYPE , c_project_id NUMBER) IS
289: SELECT 'X'
290: FROM pa_proj_fp_options
291: WHERE rbs_version_id = c_rbs_version_id
292: AND project_id=c_project_id
293: AND fin_plan_option_level_code = 'PLAN_TYPE';
294:
303: l_msg_index_out NUMBER;
304: l_return_status VARCHAR2(2000);
305:
306: -- Bug 10305516 skkoppul
307: TYPE x_proj_fp_options_id is table of pa_proj_fp_options.proj_fp_options_id%type;
308: x_proj_fp_options_id_array x_proj_fp_options_id;
309:
310: --Bug#11776072
311: l_rbs_version_id pa_rbs_versions_b.rbs_version_id%TYPE;
440: END IF;
441:
442: END IF;
443:
444: -- Update pa_proj_fp_options table
445: UPDATE pa_proj_fp_options
446: SET gen_src_cost_plan_type_id = fp_options_rec.gen_src_cost_plan_type_id
447: , gen_src_cost_plan_version_id = fp_options_rec.gen_src_cost_plan_version_id
448: , gen_src_cost_plan_ver_code = fp_options_rec.gen_src_cost_plan_ver_code
441:
442: END IF;
443:
444: -- Update pa_proj_fp_options table
445: UPDATE pa_proj_fp_options
446: SET gen_src_cost_plan_type_id = fp_options_rec.gen_src_cost_plan_type_id
447: , gen_src_cost_plan_version_id = fp_options_rec.gen_src_cost_plan_version_id
448: , gen_src_cost_plan_ver_code = fp_options_rec.gen_src_cost_plan_ver_code
449: , gen_src_rev_plan_type_id = fp_options_rec.gen_src_rev_plan_type_id
465: -- delete from PA_FP_ELEMENTS
466:
467: /*
468: Bug 3106741 For pa_fp_elements there is no index avaialable on project_id and plan_type_id
469: to avoid full table scan pa_proj_fp_options would be used to fetch all the relevant option_ids
470: */
471:
472: /* commented for bug 10305516
473: delete from pa_fp_elements e
470: */
471:
472: /* commented for bug 10305516
473: delete from pa_fp_elements e
474: where e.proj_fp_options_id in (select o.proj_fp_options_id from pa_proj_fp_options o
475: where o.project_id = p_project_id and
476: o.fin_plan_type_id = p_fin_plan_type_id);
477: */
478: /*
476: o.fin_plan_type_id = p_fin_plan_type_id);
477: */
478: /*
479: Bug 3106741 For pa_fp_txn_currencies there is no index avaialable on project_id and plan_type_id
480: to avoid full table scan pa_proj_fp_options would be used to fetch all the relevant option_ids
481: */
482:
483: -- Bug 10305516 skkoppul: replaced above delete statement with following 2 statements
484: SELECT proj_fp_options_id bulk collect
482:
483: -- Bug 10305516 skkoppul: replaced above delete statement with following 2 statements
484: SELECT proj_fp_options_id bulk collect
485: INTO x_proj_fp_options_id_array
486: FROM pa_proj_fp_options
487: WHERE project_id = p_project_id and fin_plan_type_id = p_fin_plan_type_id;
488:
489: FORALL i IN x_proj_fp_options_id_array.first..x_proj_fp_options_id_array.last
490: DELETE from pa_fp_elements
492:
493: -- delete from PA_FP_TXN_CURRENCIES
494: delete from pa_fp_txn_currencies tc
495: where tc.proj_fp_options_id in (select o.proj_fp_options_id
496: from pa_proj_fp_options o
497: where o.project_id = p_project_id and --Replaced project_id with p_project_id
498: --for bug 2740553
499: o.fin_plan_type_id = p_fin_plan_type_id);
500:
510:
511: DELETE
512: FROM pa_fp_excluded_elements ee
513: WHERE ee.proj_fp_options_id IN (SELECT pfo.proj_fp_options_id
514: FROM pa_proj_fp_options pfo
515: WHERE pfo.project_id = p_project_id
516: AND pfo.fin_plan_type_id=p_fin_plan_type_id);
517:
518: IF P_PA_DEBUG_MODE = 'Y' THEN
525: fetch get_rbs_version_id_cur into l_rbs_version_id;
526: close get_rbs_version_id_cur;
527: --Bug#11776072 - Addition end
528:
529: -- finally, delete from PA_PROJ_FP_OPTIONS
530: delete from pa_proj_fp_options
531: where project_id = p_project_id and
532: fin_plan_option_level_code = 'PLAN_TYPE' and
533: fin_plan_type_id = p_fin_plan_type_id;
526: close get_rbs_version_id_cur;
527: --Bug#11776072 - Addition end
528:
529: -- finally, delete from PA_PROJ_FP_OPTIONS
530: delete from pa_proj_fp_options
531: where project_id = p_project_id and
532: fin_plan_option_level_code = 'PLAN_TYPE' and
533: fin_plan_type_id = p_fin_plan_type_id;
534:
581: -- APPROVED_BUDGET - if the plan type is an approved budget plan class
582: -- NON_APPROVED_BUDGET - if the plan type is a non-approved budget plan class
583: -- This is used for FUNCTION SECURITY checks in Budgeting/Forecasting OA pages
584: FUNCTION plantype_to_planclass
585: (p_project_id IN pa_proj_fp_options.project_id%TYPE,
586: p_fin_plan_type_id IN pa_proj_fp_options.fin_plan_type_id%TYPE)
587: return VARCHAR2 is
588: l_plan_class_code pa_fin_plan_types_b.plan_class_code%TYPE;
589: l_approved_cost_pt_flag pa_fin_plan_types_b.approved_cost_plan_type_flag%TYPE;
582: -- NON_APPROVED_BUDGET - if the plan type is a non-approved budget plan class
583: -- This is used for FUNCTION SECURITY checks in Budgeting/Forecasting OA pages
584: FUNCTION plantype_to_planclass
585: (p_project_id IN pa_proj_fp_options.project_id%TYPE,
586: p_fin_plan_type_id IN pa_proj_fp_options.fin_plan_type_id%TYPE)
587: return VARCHAR2 is
588: l_plan_class_code pa_fin_plan_types_b.plan_class_code%TYPE;
589: l_approved_cost_pt_flag pa_fin_plan_types_b.approved_cost_plan_type_flag%TYPE;
590: l_approved_rev_pt_flag pa_fin_plan_types_b.approved_rev_plan_type_flag%TYPE;
597: select approved_cost_plan_type_flag,
598: approved_rev_plan_type_flag
599: into l_approved_cost_pt_flag,
600: l_approved_rev_pt_flag
601: from pa_proj_fp_options
602: where project_id = p_project_id and
603: fin_plan_type_id = p_fin_plan_type_id and
604: fin_plan_option_level_code = 'PLAN_TYPE';
605: if l_approved_cost_pt_flag = 'Y' or l_approved_rev_pt_flag = 'Y' then