[Home] [Help]
80: where
81: budget_version_id = p_budget_version_id;
82: select pt.fin_plan_type_code
83: into l_fin_plan_type_code
84: from pa_proj_fp_options po,
85: pa_fin_plan_types_b pt /* Bug# 2661650 - _vl to _b/_tl for performance changes */
86: where po.project_id = p_project_id and
87: po.fin_plan_version_id = p_budget_version_id and
88: po.fin_plan_option_level_code = 'PLAN_VERSION' and
1204:
1205: l_wp_fin_plan_type_id:=NULL;
1206:
1207: END IF;
1208: /* call Delete_Version_Helper to delete everything but the entry in PA_BUDGET_VERSIONS and PA_PROJ_FP_OPTIONS */
1209: pa_fin_plan_pub.Delete_Version_Helper
1210: (p_project_id => p_project_id,
1211: p_context => p_context,
1212: p_budget_version_id => p_budget_version_id,
1223: IF p_budget_version_id IS NOT NULL THEN
1224:
1225: delete
1226: from
1227: pa_proj_fp_options
1228: where
1229: fin_plan_version_id= p_budget_version_id AND
1230: project_id=nvl(p_project_id,project_id) AND
1231: fin_plan_type_id = nvl(l_wp_fin_plan_type_id,fin_plan_type_id);
1232:
1233: ELSIF p_project_id IS NOT NULL THEN
1234: delete
1235: from
1236: pa_proj_fp_options
1237: where
1238: fin_plan_version_id=nvl(p_budget_version_id,fin_plan_version_id) AND
1239: project_id=p_project_id AND
1240: (fin_plan_type_id IS NULL OR
1587: fin_plan_version_id
1588: BULK COLLECT INTO
1589: l_proj_fp_options_id_tbl,
1590: l_budget_Version_id_tbl
1591: FROM pa_proj_fp_options
1592: WHERE fin_plan_version_id=p_budget_version_id
1593: AND fin_plan_type_id = nvl(l_wp_fin_plan_type_id,fin_plan_type_id);
1594:
1595: ELSE
1598: fin_plan_version_id
1599: BULK COLLECT INTO
1600: l_proj_fp_options_id_tbl,
1601: l_budget_Version_id_tbl
1602: FROM pa_proj_fp_options
1603: WHERE project_id=p_project_id
1604: AND (fin_plan_type_id = nvl(l_wp_fin_plan_type_id,fin_plan_type_id) OR
1605: fin_plan_type_id IS NULL);
1606:
1787: IF p_budget_version_id IS NOT NULL THEN
1788: -- Bug 3572548 Update all the budget versions that have the input budget version id
1789: -- gen source version id with null for that column as this is being deleted
1790:
1791: UPDATE pa_proj_fp_options
1792: SET gen_src_cost_plan_version_id = DECODE(gen_src_cost_plan_version_id
1793: ,p_budget_version_id,NULL,gen_src_cost_plan_version_id)
1794: ,gen_src_rev_plan_version_id = DECODE(gen_src_rev_plan_version_id
1795: ,p_budget_version_id,NULL,gen_src_rev_plan_version_id)
1983:
1984: l_adj_percentage NUMBER := NVL(p_adj_percentage,0);
1985: --Make adjustment percentage zero if passed as null
1986:
1987: l_source_proj_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
1988: l_source_fp_preference_code pa_proj_fp_options.fin_plan_preference_code%TYPE;
1989: l_source_element_type pa_fp_elements.element_type%TYPE;
1990: l_source_profile_id pa_budget_versions.period_profile_id%TYPE;
1991: l_source_fin_plan_type_id pa_proj_fp_options.fin_plan_type_id%TYPE;
1984: l_adj_percentage NUMBER := NVL(p_adj_percentage,0);
1985: --Make adjustment percentage zero if passed as null
1986:
1987: l_source_proj_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
1988: l_source_fp_preference_code pa_proj_fp_options.fin_plan_preference_code%TYPE;
1989: l_source_element_type pa_fp_elements.element_type%TYPE;
1990: l_source_profile_id pa_budget_versions.period_profile_id%TYPE;
1991: l_source_fin_plan_type_id pa_proj_fp_options.fin_plan_type_id%TYPE;
1992:
1987: l_source_proj_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
1988: l_source_fp_preference_code pa_proj_fp_options.fin_plan_preference_code%TYPE;
1989: l_source_element_type pa_fp_elements.element_type%TYPE;
1990: l_source_profile_id pa_budget_versions.period_profile_id%TYPE;
1991: l_source_fin_plan_type_id pa_proj_fp_options.fin_plan_type_id%TYPE;
1992:
1993:
1994: l_target_proj_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
1995: l_target_fin_plan_type_id pa_proj_fp_options.fin_plan_type_id%TYPE;
1990: l_source_profile_id pa_budget_versions.period_profile_id%TYPE;
1991: l_source_fin_plan_type_id pa_proj_fp_options.fin_plan_type_id%TYPE;
1992:
1993:
1994: l_target_proj_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
1995: l_target_fin_plan_type_id pa_proj_fp_options.fin_plan_type_id%TYPE;
1996: l_target_fp_preference_code pa_proj_fp_options.fin_plan_preference_code%TYPE;
1997: l_plan_in_multi_curr_flag pa_proj_fp_options.plan_in_multi_curr_flag%TYPE;
1998:
1991: l_source_fin_plan_type_id pa_proj_fp_options.fin_plan_type_id%TYPE;
1992:
1993:
1994: l_target_proj_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
1995: l_target_fin_plan_type_id pa_proj_fp_options.fin_plan_type_id%TYPE;
1996: l_target_fp_preference_code pa_proj_fp_options.fin_plan_preference_code%TYPE;
1997: l_plan_in_multi_curr_flag pa_proj_fp_options.plan_in_multi_curr_flag%TYPE;
1998:
1999: l_target_element_type pa_fp_elements.element_type%TYPE;
1992:
1993:
1994: l_target_proj_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
1995: l_target_fin_plan_type_id pa_proj_fp_options.fin_plan_type_id%TYPE;
1996: l_target_fp_preference_code pa_proj_fp_options.fin_plan_preference_code%TYPE;
1997: l_plan_in_multi_curr_flag pa_proj_fp_options.plan_in_multi_curr_flag%TYPE;
1998:
1999: l_target_element_type pa_fp_elements.element_type%TYPE;
2000:
1993:
1994: l_target_proj_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
1995: l_target_fin_plan_type_id pa_proj_fp_options.fin_plan_type_id%TYPE;
1996: l_target_fp_preference_code pa_proj_fp_options.fin_plan_preference_code%TYPE;
1997: l_plan_in_multi_curr_flag pa_proj_fp_options.plan_in_multi_curr_flag%TYPE;
1998:
1999: l_target_element_type pa_fp_elements.element_type%TYPE;
2000:
2001: l_budget_version_id pa_budget_versions.budget_version_id%TYPE;
2022: -- Local variables for 3156057
2023:
2024: l_target_appr_rev_plan_flag pa_budget_versions.approved_rev_plan_type_flag%TYPE;
2025: l_source_appr_rev_plan_flag pa_budget_versions.approved_rev_plan_type_flag%TYPE;
2026: l_source_plan_in_mc_flag pa_proj_fp_options.plan_in_multi_curr_flag%TYPE;
2027: l_source_ver_rbs_version_id pa_proj_fp_options.rbs_version_id%TYPE;-- Bug 3731925
2028: l_target_pt_lvl_rbs_version_id pa_proj_fp_options.rbs_version_id%TYPE;-- Bug 3731925
2029:
2030: --Declared for Bug 4290043
2023:
2024: l_target_appr_rev_plan_flag pa_budget_versions.approved_rev_plan_type_flag%TYPE;
2025: l_source_appr_rev_plan_flag pa_budget_versions.approved_rev_plan_type_flag%TYPE;
2026: l_source_plan_in_mc_flag pa_proj_fp_options.plan_in_multi_curr_flag%TYPE;
2027: l_source_ver_rbs_version_id pa_proj_fp_options.rbs_version_id%TYPE;-- Bug 3731925
2028: l_target_pt_lvl_rbs_version_id pa_proj_fp_options.rbs_version_id%TYPE;-- Bug 3731925
2029:
2030: --Declared for Bug 4290043
2031: l_source_plan_class_code pa_fin_plan_types_b.plan_class_code%TYPE;
2024: l_target_appr_rev_plan_flag pa_budget_versions.approved_rev_plan_type_flag%TYPE;
2025: l_source_appr_rev_plan_flag pa_budget_versions.approved_rev_plan_type_flag%TYPE;
2026: l_source_plan_in_mc_flag pa_proj_fp_options.plan_in_multi_curr_flag%TYPE;
2027: l_source_ver_rbs_version_id pa_proj_fp_options.rbs_version_id%TYPE;-- Bug 3731925
2028: l_target_pt_lvl_rbs_version_id pa_proj_fp_options.rbs_version_id%TYPE;-- Bug 3731925
2029:
2030: --Declared for Bug 4290043
2031: l_source_plan_class_code pa_fin_plan_types_b.plan_class_code%TYPE;
2032: l_target_plan_class_code pa_fin_plan_types_b.plan_class_code%TYPE;
2154: ,l_source_plan_in_mc_flag
2155: ,l_source_appr_rev_plan_flag
2156: ,l_source_ver_rbs_version_id -- Bug 3731925
2157: ,l_source_plan_class_code
2158: FROM pa_proj_fp_options pfo,
2159: pa_fin_plan_types_b fin
2160: WHERE pfo.fin_plan_version_id = p_source_version_id
2161: AND fin.fin_plan_type_id=pfo.fin_plan_type_id;
2162:
2178: ,l_target_fin_plan_type_id
2179: ,l_target_element_type
2180: ,l_target_appr_rev_plan_flag
2181: ,l_target_plan_class_code
2182: FROM pa_proj_fp_options pfo,
2183: pa_fin_plan_types_b fin
2184: WHERE pfo.fin_plan_version_id = l_budget_version_id
2185: AND pfo.fin_plan_type_id = fin.fin_plan_type_id;
2186:
2280: END IF;
2281:
2282: -- End of changes for BUG :- 2634900
2283:
2284: --Calling create fp option api to insert or update pa_proj_fp_options.
2285: --In case of create working copy, it will insert into pa_proj_fp_options.
2286: --In case of target version is passed in copy plan, we update pa_proj_fp_options.
2287:
2288:
2281:
2282: -- End of changes for BUG :- 2634900
2283:
2284: --Calling create fp option api to insert or update pa_proj_fp_options.
2285: --In case of create working copy, it will insert into pa_proj_fp_options.
2286: --In case of target version is passed in copy plan, we update pa_proj_fp_options.
2287:
2288:
2289: --Calling create fp option api
2282: -- End of changes for BUG :- 2634900
2283:
2284: --Calling create fp option api to insert or update pa_proj_fp_options.
2285: --In case of create working copy, it will insert into pa_proj_fp_options.
2286: --In case of target version is passed in copy plan, we update pa_proj_fp_options.
2287:
2288:
2289: --Calling create fp option api
2290:
2292: pa_debug.g_err_stage := 'Calling create_fp_option api';
2293: pa_debug.write('Copy_Version: ' || l_module_name,pa_debug.g_err_stage,3);
2294: END IF;
2295:
2296: PA_PROJ_FP_OPTIONS_PUB.create_fp_option (
2297: px_target_proj_fp_option_id => l_target_proj_fp_options_id
2298: ,p_source_proj_fp_option_id => l_source_proj_fp_options_id
2299: ,p_target_fp_option_level_code => PA_FP_CONSTANTS_PKG.G_OPTION_LEVEL_PLAN_VERSION
2300: ,p_target_fp_preference_code => l_target_fp_preference_code
2321: END IF;
2322:
2323: SELECT pfo.plan_in_multi_curr_flag
2324: INTO l_plan_in_multi_curr_flag
2325: FROM pa_proj_fp_options pfo
2326: WHERE pfo.fin_plan_version_id = l_budget_version_id;
2327:
2328: /* IF l_plan_in_multi_curr_flag = 'Y' THEN Commented for bug 2706430 */
2329:
2970: -- bug 3731925 Check if rbs version id for the target version needs to be
2971: -- updated with plan type level value
2972: Select rbs_version_id
2973: into l_target_pt_lvl_rbs_version_id
2974: from pa_proj_fp_options opt
2975: where opt.project_id = p_project_id
2976: and opt.fin_plan_type_id = l_target_fin_plan_type_id
2977: and opt.fin_plan_option_level_code = 'PLAN_TYPE';
2978:
3583:
3584: procedure Create_Version_OrgFcst
3585: (p_project_id IN pa_budget_versions.project_id%TYPE,
3586: p_fin_plan_type_id IN pa_budget_versions.fin_plan_type_id%TYPE,
3587: p_fin_plan_options_id IN pa_proj_fp_options.proj_fp_options_id%TYPE,
3588: p_version_name IN pa_budget_versions.version_name%TYPE,
3589: p_description IN pa_budget_versions.description%TYPE,
3590: p_resource_list_id IN pa_budget_versions.resource_list_id%TYPE,
3591: x_budget_version_id OUT NOCOPY pa_budget_versions.budget_version_id%TYPE, --File.Sql.39 bug 4440895
3608: l_max_version pa_budget_versions.version_number%TYPE;
3609: l_current_working_flag pa_budget_versions.current_working_flag%TYPE;
3610:
3611: l_budget_version_id pa_budget_versions.budget_version_id%TYPE; /* newly-created budget_version_id */
3612: l_proj_fin_plan_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
3613: l_row_id ROWID;
3614: l_resource_list_id pa_budget_versions.resource_list_id%TYPE;
3615: l_org_fcst_period_type pa_forecasting_options_all.org_fcst_period_type%TYPE;
3616: l_org_time_phased_code pa_proj_fp_options.all_time_phased_code%TYPE;
3612: l_proj_fin_plan_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
3613: l_row_id ROWID;
3614: l_resource_list_id pa_budget_versions.resource_list_id%TYPE;
3615: l_org_fcst_period_type pa_forecasting_options_all.org_fcst_period_type%TYPE;
3616: l_org_time_phased_code pa_proj_fp_options.all_time_phased_code%TYPE;
3617: l_org_amount_set_id pa_fin_plan_amount_sets.fin_plan_amount_set_id%TYPE;
3618: l_org_structure_version_id pa_implementations_all.org_structure_version_id%TYPE;
3619: l_period_set_name pa_implementations_all.period_set_name%TYPE;
3620: l_act_period_type gl_periods.period_type%TYPE;
3621: l_org_projfunc_currency_code gl_sets_of_books.currency_code%TYPE;
3622: l_number_of_periods pa_forecasting_options_all.number_of_periods%TYPE;
3623: l_request_id pa_budget_versions.request_id%TYPE;
3624: l_weighted_or_full_code pa_forecasting_options_all.weighted_or_full_code%TYPE;
3625: l_fcst_start_date pa_proj_fp_options.fin_plan_start_date%TYPE;
3626: l_fcst_end_date pa_proj_fp_options.fin_plan_end_date%TYPE;
3627: l_org_project_template_id pa_forecasting_options_all.org_fcst_project_template_id%TYPE;
3628: l_org_id pa_forecasting_options_all.org_id%TYPE;
3629: l_period_profile_id pa_proj_period_profiles.period_profile_id%TYPE;
3622: l_number_of_periods pa_forecasting_options_all.number_of_periods%TYPE;
3623: l_request_id pa_budget_versions.request_id%TYPE;
3624: l_weighted_or_full_code pa_forecasting_options_all.weighted_or_full_code%TYPE;
3625: l_fcst_start_date pa_proj_fp_options.fin_plan_start_date%TYPE;
3626: l_fcst_end_date pa_proj_fp_options.fin_plan_end_date%TYPE;
3627: l_org_project_template_id pa_forecasting_options_all.org_fcst_project_template_id%TYPE;
3628: l_org_id pa_forecasting_options_all.org_id%TYPE;
3629: l_period_profile_id pa_proj_period_profiles.period_profile_id%TYPE;
3630: l_ppp_start_date DATE;
3643: cursor plan_options_csr is
3644: select
3645: proj_fp_options_id
3646: from
3647: pa_proj_fp_options
3648: where
3649: project_id=p_project_id and
3650: fin_plan_type_id=p_fin_plan_type_id and
3651: fin_plan_option_level_code = 'PLAN_TYPE';
3997: IF P_PA_DEBUG_MODE = 'Y' THEN
3998: pa_debug.write_file('Create_Version_OrgFcst: ' || 'no planning options for plan_type level: creating one now');
3999: END IF;
4000: /* call table handler to create planning options for plan_type */
4001: select pa_proj_fp_options_s.nextVal into l_proj_fin_plan_options_id from dual;
4002: pa_proj_fp_options_pkg.Insert_Row
4003: (px_proj_fp_options_id => l_proj_fin_plan_options_id,
4004: p_project_id => p_project_id,
4005: p_fin_plan_option_level_code => 'PLAN_TYPE',
3998: pa_debug.write_file('Create_Version_OrgFcst: ' || 'no planning options for plan_type level: creating one now');
3999: END IF;
4000: /* call table handler to create planning options for plan_type */
4001: select pa_proj_fp_options_s.nextVal into l_proj_fin_plan_options_id from dual;
4002: pa_proj_fp_options_pkg.Insert_Row
4003: (px_proj_fp_options_id => l_proj_fin_plan_options_id,
4004: p_project_id => p_project_id,
4005: p_fin_plan_option_level_code => 'PLAN_TYPE',
4006: p_fin_plan_type_id => p_fin_plan_type_id,
4034: /* create planning option for plan VERSION */
4035: IF P_PA_DEBUG_MODE = 'Y' THEN
4036: pa_debug.write_file('Create_Version_OrgFcst: ' || 'creating planning options for PLAN_VERSION level');
4037: END IF;
4038: select pa_proj_fp_options_s.nextVal into l_proj_fin_plan_options_id from dual;
4039: pa_proj_fp_options_pkg.Insert_Row
4040: (px_proj_fp_options_id => l_proj_fin_plan_options_id,
4041: p_project_id => p_project_id,
4042: p_fin_plan_option_level_code => 'PLAN_VERSION',
4035: IF P_PA_DEBUG_MODE = 'Y' THEN
4036: pa_debug.write_file('Create_Version_OrgFcst: ' || 'creating planning options for PLAN_VERSION level');
4037: END IF;
4038: select pa_proj_fp_options_s.nextVal into l_proj_fin_plan_options_id from dual;
4039: pa_proj_fp_options_pkg.Insert_Row
4040: (px_proj_fp_options_id => l_proj_fin_plan_options_id,
4041: p_project_id => p_project_id,
4042: p_fin_plan_option_level_code => 'PLAN_VERSION',
4043: p_fin_plan_type_id => p_fin_plan_type_id,
5131: /*=====================================================================
5132: Bug No. 2331201 For finplan this api has been added
5133: This api Creates a working fin plan version.The version inherits its
5134: properties from plan type.This api creates records in
5135: pa_proj_fp_options , pa_resource_assignments,
5136: pa_fp_txn_currencies and pa_budget_versions.
5137: If px_budget_version_id is passed it is assumed that new version
5138: id is created and passed to the api, else new value is created.
5139:
5198: ,p_calling_context IN VARCHAR2 --:= NULL
5199: -- End of additional columns for Bug :- 2634900
5200: -- Start of additional columns for Bug :- 2649474
5201: ,p_resource_list_id IN pa_budget_versions.resource_list_id%TYPE --:= NULL
5202: ,p_time_phased_code IN pa_proj_fp_options.cost_time_phased_code%TYPE --:= NULL
5203: ,p_fin_plan_level_code IN pa_proj_fp_options.cost_fin_plan_level_code%TYPE --:= NULL
5204: ,p_plan_in_multi_curr_flag IN pa_proj_fp_options.plan_in_multi_curr_flag%TYPE --:= NULL
5205: ,p_amount_set_id IN pa_proj_fp_options.cost_amount_set_id%TYPE --:= NULL
5206: -- End of additional columns for Bug :- 2649474
5199: -- End of additional columns for Bug :- 2634900
5200: -- Start of additional columns for Bug :- 2649474
5201: ,p_resource_list_id IN pa_budget_versions.resource_list_id%TYPE --:= NULL
5202: ,p_time_phased_code IN pa_proj_fp_options.cost_time_phased_code%TYPE --:= NULL
5203: ,p_fin_plan_level_code IN pa_proj_fp_options.cost_fin_plan_level_code%TYPE --:= NULL
5204: ,p_plan_in_multi_curr_flag IN pa_proj_fp_options.plan_in_multi_curr_flag%TYPE --:= NULL
5205: ,p_amount_set_id IN pa_proj_fp_options.cost_amount_set_id%TYPE --:= NULL
5206: -- End of additional columns for Bug :- 2649474
5207: -- Start of additional columns for Bug :- 3088010
5200: -- Start of additional columns for Bug :- 2649474
5201: ,p_resource_list_id IN pa_budget_versions.resource_list_id%TYPE --:= NULL
5202: ,p_time_phased_code IN pa_proj_fp_options.cost_time_phased_code%TYPE --:= NULL
5203: ,p_fin_plan_level_code IN pa_proj_fp_options.cost_fin_plan_level_code%TYPE --:= NULL
5204: ,p_plan_in_multi_curr_flag IN pa_proj_fp_options.plan_in_multi_curr_flag%TYPE --:= NULL
5205: ,p_amount_set_id IN pa_proj_fp_options.cost_amount_set_id%TYPE --:= NULL
5206: -- End of additional columns for Bug :- 2649474
5207: -- Start of additional columns for Bug :- 3088010
5208: ,p_attribute_category IN pa_budget_versions.attribute_category%TYPE
5201: ,p_resource_list_id IN pa_budget_versions.resource_list_id%TYPE --:= NULL
5202: ,p_time_phased_code IN pa_proj_fp_options.cost_time_phased_code%TYPE --:= NULL
5203: ,p_fin_plan_level_code IN pa_proj_fp_options.cost_fin_plan_level_code%TYPE --:= NULL
5204: ,p_plan_in_multi_curr_flag IN pa_proj_fp_options.plan_in_multi_curr_flag%TYPE --:= NULL
5205: ,p_amount_set_id IN pa_proj_fp_options.cost_amount_set_id%TYPE --:= NULL
5206: -- End of additional columns for Bug :- 2649474
5207: -- Start of additional columns for Bug :- 3088010
5208: ,p_attribute_category IN pa_budget_versions.attribute_category%TYPE
5209: ,p_attribute1 IN pa_budget_versions.attribute1%TYPE
5251: l_max_version_number pa_budget_versions.version_number%TYPE;
5252: l_new_budget_version_id pa_budget_versions.budget_version_id%TYPE;
5253: l_current_working_flag pa_budget_versions.current_working_flag%TYPE;
5254: l_dummy_version_id pa_budget_versions.budget_version_id%TYPE;
5255: l_new_proj_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
5256: l_project_currency_code pa_projects_all.project_currency_code%TYPE;
5257: l_projfunc_currency_code pa_projects_all.projfunc_currency_code%TYPE;
5258: l_dummy_currency_code pa_projects_all.projfunc_currency_code%TYPE;
5259: l_est_projfunc_raw_cost pa_budget_versions.est_projfunc_raw_cost%TYPE;
5267: l_agreement_currency_code pa_agreements_all.agreement_currency_code%TYPE;
5268:
5269: --l_mixed_resource_planned_flag VARCHAR2(1); --Added for Bug:-2625872
5270:
5271: l_plan_type_mc_flag pa_proj_fp_options.plan_in_multi_curr_flag%TYPE; --Bug 2661237
5272:
5273: /* Project level conversion attributes var for bug 2661237 */
5274:
5275: l_multi_currency_billing_flag pa_projects_all.multi_currency_billing_flag%TYPE;
5345: ,primary_rev_forecast_flag
5346: ,rev_current_planning_period
5347: ,rev_period_mask_id
5348: ,copy_etc_from_plan_flag --skkoppul bug 8318932 - added for AAI enhancement
5349: FROM pa_proj_fp_options
5350: WHERE project_id = c_project_id
5351: AND fin_plan_type_id = c_fin_plan_type_id
5352: AND fin_plan_option_level_code = PA_FP_CONSTANTS_PKG.G_OPTION_LEVEL_PLAN_TYPE;
5353:
5389: , pfo.primary_cost_forecast_flag
5390: , pfo.primary_rev_forecast_flag
5391: , bv.actual_amts_thru_period
5392: , bv.project_structure_version_id
5393: FROM pa_proj_fp_options pfo, pa_budget_versions bv
5394: WHERE pfo.project_id = c_project_id
5395: AND pfo.fin_plan_type_id = c_fin_plan_type_id
5396: AND pfo.fin_plan_version_id = c_fin_plan_version_id
5397: AND bv.budget_version_id = c_fin_plan_version_id
5399:
5400: plan_version_info_rec plan_version_info_cur%ROWTYPE;
5401:
5402: TYPE new_version_rec_type IS RECORD (
5403: fin_plan_option_level_code PA_PROJ_FP_OPTIONS.fin_plan_option_level_code%TYPE
5404: ,fin_plan_preference_code PA_PROJ_FP_OPTIONS.fin_plan_preference_code%TYPE
5405: ,fin_plan_level_code PA_PROJ_FP_OPTIONS.cost_fin_plan_level_code%TYPE
5406: ,time_phased_code PA_PROJ_FP_OPTIONS.cost_time_phased_code%TYPE
5407: ,resource_list_id PA_PROJ_FP_OPTIONS.cost_resource_list_id%TYPE
5400: plan_version_info_rec plan_version_info_cur%ROWTYPE;
5401:
5402: TYPE new_version_rec_type IS RECORD (
5403: fin_plan_option_level_code PA_PROJ_FP_OPTIONS.fin_plan_option_level_code%TYPE
5404: ,fin_plan_preference_code PA_PROJ_FP_OPTIONS.fin_plan_preference_code%TYPE
5405: ,fin_plan_level_code PA_PROJ_FP_OPTIONS.cost_fin_plan_level_code%TYPE
5406: ,time_phased_code PA_PROJ_FP_OPTIONS.cost_time_phased_code%TYPE
5407: ,resource_list_id PA_PROJ_FP_OPTIONS.cost_resource_list_id%TYPE
5408: ,amount_set_id PA_PROJ_FP_OPTIONS.cost_amount_set_id%TYPE
5401:
5402: TYPE new_version_rec_type IS RECORD (
5403: fin_plan_option_level_code PA_PROJ_FP_OPTIONS.fin_plan_option_level_code%TYPE
5404: ,fin_plan_preference_code PA_PROJ_FP_OPTIONS.fin_plan_preference_code%TYPE
5405: ,fin_plan_level_code PA_PROJ_FP_OPTIONS.cost_fin_plan_level_code%TYPE
5406: ,time_phased_code PA_PROJ_FP_OPTIONS.cost_time_phased_code%TYPE
5407: ,resource_list_id PA_PROJ_FP_OPTIONS.cost_resource_list_id%TYPE
5408: ,amount_set_id PA_PROJ_FP_OPTIONS.cost_amount_set_id%TYPE
5409: ,current_planning_period PA_PROJ_FP_OPTIONS.cost_CURRENT_PLANNING_PERIOD%TYPE
5402: TYPE new_version_rec_type IS RECORD (
5403: fin_plan_option_level_code PA_PROJ_FP_OPTIONS.fin_plan_option_level_code%TYPE
5404: ,fin_plan_preference_code PA_PROJ_FP_OPTIONS.fin_plan_preference_code%TYPE
5405: ,fin_plan_level_code PA_PROJ_FP_OPTIONS.cost_fin_plan_level_code%TYPE
5406: ,time_phased_code PA_PROJ_FP_OPTIONS.cost_time_phased_code%TYPE
5407: ,resource_list_id PA_PROJ_FP_OPTIONS.cost_resource_list_id%TYPE
5408: ,amount_set_id PA_PROJ_FP_OPTIONS.cost_amount_set_id%TYPE
5409: ,current_planning_period PA_PROJ_FP_OPTIONS.cost_CURRENT_PLANNING_PERIOD%TYPE
5410: ,period_mask_id PA_PROJ_FP_OPTIONS.cost_PERIOD_MASK_ID%TYPE
5403: fin_plan_option_level_code PA_PROJ_FP_OPTIONS.fin_plan_option_level_code%TYPE
5404: ,fin_plan_preference_code PA_PROJ_FP_OPTIONS.fin_plan_preference_code%TYPE
5405: ,fin_plan_level_code PA_PROJ_FP_OPTIONS.cost_fin_plan_level_code%TYPE
5406: ,time_phased_code PA_PROJ_FP_OPTIONS.cost_time_phased_code%TYPE
5407: ,resource_list_id PA_PROJ_FP_OPTIONS.cost_resource_list_id%TYPE
5408: ,amount_set_id PA_PROJ_FP_OPTIONS.cost_amount_set_id%TYPE
5409: ,current_planning_period PA_PROJ_FP_OPTIONS.cost_CURRENT_PLANNING_PERIOD%TYPE
5410: ,period_mask_id PA_PROJ_FP_OPTIONS.cost_PERIOD_MASK_ID%TYPE
5411: ,plan_in_multi_curr_flag PA_PROJ_FP_OPTIONS.plan_in_multi_curr_flag%TYPE
5404: ,fin_plan_preference_code PA_PROJ_FP_OPTIONS.fin_plan_preference_code%TYPE
5405: ,fin_plan_level_code PA_PROJ_FP_OPTIONS.cost_fin_plan_level_code%TYPE
5406: ,time_phased_code PA_PROJ_FP_OPTIONS.cost_time_phased_code%TYPE
5407: ,resource_list_id PA_PROJ_FP_OPTIONS.cost_resource_list_id%TYPE
5408: ,amount_set_id PA_PROJ_FP_OPTIONS.cost_amount_set_id%TYPE
5409: ,current_planning_period PA_PROJ_FP_OPTIONS.cost_CURRENT_PLANNING_PERIOD%TYPE
5410: ,period_mask_id PA_PROJ_FP_OPTIONS.cost_PERIOD_MASK_ID%TYPE
5411: ,plan_in_multi_curr_flag PA_PROJ_FP_OPTIONS.plan_in_multi_curr_flag%TYPE
5412: ,approved_cost_plan_type_flag PA_PROJ_FP_OPTIONS.approved_cost_plan_type_flag%TYPE
5405: ,fin_plan_level_code PA_PROJ_FP_OPTIONS.cost_fin_plan_level_code%TYPE
5406: ,time_phased_code PA_PROJ_FP_OPTIONS.cost_time_phased_code%TYPE
5407: ,resource_list_id PA_PROJ_FP_OPTIONS.cost_resource_list_id%TYPE
5408: ,amount_set_id PA_PROJ_FP_OPTIONS.cost_amount_set_id%TYPE
5409: ,current_planning_period PA_PROJ_FP_OPTIONS.cost_CURRENT_PLANNING_PERIOD%TYPE
5410: ,period_mask_id PA_PROJ_FP_OPTIONS.cost_PERIOD_MASK_ID%TYPE
5411: ,plan_in_multi_curr_flag PA_PROJ_FP_OPTIONS.plan_in_multi_curr_flag%TYPE
5412: ,approved_cost_plan_type_flag PA_PROJ_FP_OPTIONS.approved_cost_plan_type_flag%TYPE
5413: ,approved_rev_plan_type_flag PA_PROJ_FP_OPTIONS.approved_rev_plan_type_flag%TYPE
5406: ,time_phased_code PA_PROJ_FP_OPTIONS.cost_time_phased_code%TYPE
5407: ,resource_list_id PA_PROJ_FP_OPTIONS.cost_resource_list_id%TYPE
5408: ,amount_set_id PA_PROJ_FP_OPTIONS.cost_amount_set_id%TYPE
5409: ,current_planning_period PA_PROJ_FP_OPTIONS.cost_CURRENT_PLANNING_PERIOD%TYPE
5410: ,period_mask_id PA_PROJ_FP_OPTIONS.cost_PERIOD_MASK_ID%TYPE
5411: ,plan_in_multi_curr_flag PA_PROJ_FP_OPTIONS.plan_in_multi_curr_flag%TYPE
5412: ,approved_cost_plan_type_flag PA_PROJ_FP_OPTIONS.approved_cost_plan_type_flag%TYPE
5413: ,approved_rev_plan_type_flag PA_PROJ_FP_OPTIONS.approved_rev_plan_type_flag%TYPE
5414: ,select_res_auto_flag PA_PROJ_FP_OPTIONS.select_cost_res_auto_flag%TYPE
5407: ,resource_list_id PA_PROJ_FP_OPTIONS.cost_resource_list_id%TYPE
5408: ,amount_set_id PA_PROJ_FP_OPTIONS.cost_amount_set_id%TYPE
5409: ,current_planning_period PA_PROJ_FP_OPTIONS.cost_CURRENT_PLANNING_PERIOD%TYPE
5410: ,period_mask_id PA_PROJ_FP_OPTIONS.cost_PERIOD_MASK_ID%TYPE
5411: ,plan_in_multi_curr_flag PA_PROJ_FP_OPTIONS.plan_in_multi_curr_flag%TYPE
5412: ,approved_cost_plan_type_flag PA_PROJ_FP_OPTIONS.approved_cost_plan_type_flag%TYPE
5413: ,approved_rev_plan_type_flag PA_PROJ_FP_OPTIONS.approved_rev_plan_type_flag%TYPE
5414: ,select_res_auto_flag PA_PROJ_FP_OPTIONS.select_cost_res_auto_flag%TYPE
5415: ,source_fp_options_id PA_PROJ_FP_OPTIONS.PROJ_FP_OPTIONS_ID%TYPE
5408: ,amount_set_id PA_PROJ_FP_OPTIONS.cost_amount_set_id%TYPE
5409: ,current_planning_period PA_PROJ_FP_OPTIONS.cost_CURRENT_PLANNING_PERIOD%TYPE
5410: ,period_mask_id PA_PROJ_FP_OPTIONS.cost_PERIOD_MASK_ID%TYPE
5411: ,plan_in_multi_curr_flag PA_PROJ_FP_OPTIONS.plan_in_multi_curr_flag%TYPE
5412: ,approved_cost_plan_type_flag PA_PROJ_FP_OPTIONS.approved_cost_plan_type_flag%TYPE
5413: ,approved_rev_plan_type_flag PA_PROJ_FP_OPTIONS.approved_rev_plan_type_flag%TYPE
5414: ,select_res_auto_flag PA_PROJ_FP_OPTIONS.select_cost_res_auto_flag%TYPE
5415: ,source_fp_options_id PA_PROJ_FP_OPTIONS.PROJ_FP_OPTIONS_ID%TYPE
5416: ,version_type PA_BUDGET_VERSIONS.version_type%TYPE
5409: ,current_planning_period PA_PROJ_FP_OPTIONS.cost_CURRENT_PLANNING_PERIOD%TYPE
5410: ,period_mask_id PA_PROJ_FP_OPTIONS.cost_PERIOD_MASK_ID%TYPE
5411: ,plan_in_multi_curr_flag PA_PROJ_FP_OPTIONS.plan_in_multi_curr_flag%TYPE
5412: ,approved_cost_plan_type_flag PA_PROJ_FP_OPTIONS.approved_cost_plan_type_flag%TYPE
5413: ,approved_rev_plan_type_flag PA_PROJ_FP_OPTIONS.approved_rev_plan_type_flag%TYPE
5414: ,select_res_auto_flag PA_PROJ_FP_OPTIONS.select_cost_res_auto_flag%TYPE
5415: ,source_fp_options_id PA_PROJ_FP_OPTIONS.PROJ_FP_OPTIONS_ID%TYPE
5416: ,version_type PA_BUDGET_VERSIONS.version_type%TYPE
5417: ,project_structure_version_id PA_BUDGET_VERSIONS.project_structure_version_id%TYPE
5410: ,period_mask_id PA_PROJ_FP_OPTIONS.cost_PERIOD_MASK_ID%TYPE
5411: ,plan_in_multi_curr_flag PA_PROJ_FP_OPTIONS.plan_in_multi_curr_flag%TYPE
5412: ,approved_cost_plan_type_flag PA_PROJ_FP_OPTIONS.approved_cost_plan_type_flag%TYPE
5413: ,approved_rev_plan_type_flag PA_PROJ_FP_OPTIONS.approved_rev_plan_type_flag%TYPE
5414: ,select_res_auto_flag PA_PROJ_FP_OPTIONS.select_cost_res_auto_flag%TYPE
5415: ,source_fp_options_id PA_PROJ_FP_OPTIONS.PROJ_FP_OPTIONS_ID%TYPE
5416: ,version_type PA_BUDGET_VERSIONS.version_type%TYPE
5417: ,project_structure_version_id PA_BUDGET_VERSIONS.project_structure_version_id%TYPE
5418: ,rbs_version_id PA_PROJ_FP_OPTIONS.rbs_version_id%TYPE
5411: ,plan_in_multi_curr_flag PA_PROJ_FP_OPTIONS.plan_in_multi_curr_flag%TYPE
5412: ,approved_cost_plan_type_flag PA_PROJ_FP_OPTIONS.approved_cost_plan_type_flag%TYPE
5413: ,approved_rev_plan_type_flag PA_PROJ_FP_OPTIONS.approved_rev_plan_type_flag%TYPE
5414: ,select_res_auto_flag PA_PROJ_FP_OPTIONS.select_cost_res_auto_flag%TYPE
5415: ,source_fp_options_id PA_PROJ_FP_OPTIONS.PROJ_FP_OPTIONS_ID%TYPE
5416: ,version_type PA_BUDGET_VERSIONS.version_type%TYPE
5417: ,project_structure_version_id PA_BUDGET_VERSIONS.project_structure_version_id%TYPE
5418: ,rbs_version_id PA_PROJ_FP_OPTIONS.rbs_version_id%TYPE
5419: ,primary_cost_forecast_flag PA_BUDGET_VERSIONS.primary_cost_forecast_flag%TYPE
5414: ,select_res_auto_flag PA_PROJ_FP_OPTIONS.select_cost_res_auto_flag%TYPE
5415: ,source_fp_options_id PA_PROJ_FP_OPTIONS.PROJ_FP_OPTIONS_ID%TYPE
5416: ,version_type PA_BUDGET_VERSIONS.version_type%TYPE
5417: ,project_structure_version_id PA_BUDGET_VERSIONS.project_structure_version_id%TYPE
5418: ,rbs_version_id PA_PROJ_FP_OPTIONS.rbs_version_id%TYPE
5419: ,primary_cost_forecast_flag PA_BUDGET_VERSIONS.primary_cost_forecast_flag%TYPE
5420: ,primary_rev_forecast_flag PA_BUDGET_VERSIONS.primary_rev_forecast_flag%TYPE
5421: ,actual_amts_thru_period PA_BUDGET_VERSIONS.actual_amts_thru_period%TYPE := NULL
5422: );
5423:
5424: new_version_info_rec new_version_rec_type;
5425:
5426: l_curr_work_ver_exists_flag VARCHAR2(1);
5427: l_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
5428: l_fin_plan_version_id pa_proj_fp_options.fin_plan_version_id%TYPE;
5429: l_cw_fin_plan_level_code VARCHAR2(30);
5430: l_cw_ver_res_list_id NUMBER;
5431: l_row_id rowid;
5424: new_version_info_rec new_version_rec_type;
5425:
5426: l_curr_work_ver_exists_flag VARCHAR2(1);
5427: l_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE;
5428: l_fin_plan_version_id pa_proj_fp_options.fin_plan_version_id%TYPE;
5429: l_cw_fin_plan_level_code VARCHAR2(30);
5430: l_cw_ver_res_list_id NUMBER;
5431: l_row_id rowid;
5432: l_copy_res_assmt_from_cwv_flag VARCHAR2(1);
6225: END IF;
6226: END IF;
6227: -- end of changes for Bug :- 2634900
6228:
6229: -- Create record in PA_PROJ_FP_OPTIONS
6230: -- Calling create_fp_options api to create new record for the created plan version
6231:
6232:
6233: IF P_PA_DEBUG_MODE = 'Y' THEN
6234: pa_debug.g_err_stage:='Calling create_fp_option api';
6235: pa_debug.write('Create_Version: ' || l_module_name,pa_debug.g_err_stage,3);
6236: END IF;
6237:
6238: PA_PROJ_FP_OPTIONS_PUB.create_fp_option (
6239: px_target_proj_fp_option_id => l_new_proj_fp_options_id
6240: ,p_source_proj_fp_option_id => new_version_info_rec.source_fp_options_id
6241: ,p_target_fp_option_level_code => PA_FP_CONSTANTS_PKG.G_OPTION_LEVEL_PLAN_VERSION
6242: ,p_target_fp_preference_code => new_version_info_rec.fin_plan_preference_code
6253:
6254: --Update the fp option created for plan version with the passed i/p parameters if they are not null
6255:
6256: IF new_version_info_rec.version_type = PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_COST THEN
6257: UPDATE pa_proj_fp_options
6258: SET cost_amount_set_id = NVL(p_amount_set_id,new_version_info_rec.amount_set_id),
6259: plan_in_multi_curr_flag = new_version_info_rec.plan_in_multi_curr_flag,
6260: cost_fin_plan_level_code = new_version_info_rec.fin_plan_level_code,
6261: cost_time_phased_code = new_version_info_rec.time_phased_code,
6268: copy_etc_from_plan_flag = plan_type_info_rec.copy_etc_from_plan_flag
6269: --gboomina bug 8318932 - AAI enhancement - end
6270: WHERE proj_fp_options_id = l_new_proj_fp_options_id;
6271: ELSIF new_version_info_rec.version_type = PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_REVENUE THEN
6272: UPDATE pa_proj_fp_options
6273: SET revenue_amount_set_id = NVL(p_amount_set_id,new_version_info_rec.amount_set_id),
6274: plan_in_multi_curr_flag = new_version_info_rec.plan_in_multi_curr_flag,
6275: revenue_fin_plan_level_code = new_version_info_rec.fin_plan_level_code,
6276: revenue_time_phased_code = new_version_info_rec.time_phased_code,
6280: rev_period_mask_id = new_version_info_rec.period_mask_id,
6281: rbs_version_id = Decode(p_ci_id, null, rbs_version_id, null) -- bug 3867302
6282: WHERE proj_fp_options_id = l_new_proj_fp_options_id;
6283: ELSIF new_version_info_rec.version_type = PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_ALL THEN
6284: UPDATE pa_proj_fp_options
6285: SET all_amount_set_id = NVL(p_amount_set_id,new_version_info_rec.amount_set_id),
6286: plan_in_multi_curr_flag = new_version_info_rec.plan_in_multi_curr_flag,
6287: all_fin_plan_level_code = new_version_info_rec.fin_plan_level_code,
6288: all_time_phased_code = new_version_info_rec.time_phased_code,
6453: and txn_currency_code = l_agreement_currency_code;
6454:
6455: END IF;
6456:
6457: UPDATE pa_proj_fp_options
6458: SET PROJECT_REV_RATE_TYPE = l_project_bil_rate_type
6459: ,PROJECT_REV_RATE_DATE_TYPE = l_project_bil_rate_date_code
6460: ,PROJECT_REV_RATE_DATE = l_project_bil_rate_date
6461: ,PROJFUNC_REV_RATE_TYPE = l_projfunc_bil_rate_type
7670:
7671: l_project_id pa_budget_versions.PROJECT_ID%TYPE;
7672: l_period_profile_id pa_budget_versions.PERIOD_PROFILE_ID%TYPE;
7673: l_budget_version_type pa_budget_versions.VERSION_TYPE%TYPE;
7674: l_fp_preference_code pa_proj_fp_options.FIN_PLAN_PREFERENCE_CODE%TYPE;
7675: l_margin_derived_from_code pa_proj_fp_options.MARGIN_DERIVED_FROM_CODE%TYPE;
7676:
7677: l_plsql_max_array_size NUMBER := 200;
7678: l_tbl_index NUMBER := 1;
7671: l_project_id pa_budget_versions.PROJECT_ID%TYPE;
7672: l_period_profile_id pa_budget_versions.PERIOD_PROFILE_ID%TYPE;
7673: l_budget_version_type pa_budget_versions.VERSION_TYPE%TYPE;
7674: l_fp_preference_code pa_proj_fp_options.FIN_PLAN_PREFERENCE_CODE%TYPE;
7675: l_margin_derived_from_code pa_proj_fp_options.MARGIN_DERIVED_FROM_CODE%TYPE;
7676:
7677: l_plsql_max_array_size NUMBER := 200;
7678: l_tbl_index NUMBER := 1;
7679:
7898:
7899:
7900: SELECT fin_plan_preference_code, margin_derived_from_code
7901: INTO l_fp_preference_code, l_margin_derived_from_code
7902: FROM pa_proj_fp_options
7903: WHERE fin_plan_version_id = p_budget_version_id;
7904:
7905:
7906: IF (p_data_source = PA_FP_CONSTANTS_PKG.G_DATA_SOURCE_BUDGET_LINE) THEN