[Home] [Help]
PACKAGE BODY: APPS.PJI_REP_PRF_DFLT_PARAMS
Source
1 PACKAGE BODY Pji_Rep_Prf_Dflt_Params AS
2 /* $Header: PJIRX08B.pls 120.9 2006/10/20 13:19:33 ajdas noship $ */
3
4 --
5 -- This api will derive default values for the listed parameters
6 --
7 PROCEDURE derive_dflt_params(
8 p_project_id NUMBER
9 , x_WBS_Version_ID OUT NOCOPY NUMBER
10 , x_WBS_Element_Id OUT NOCOPY NUMBER
11 , x_RBS_Version_ID OUT NOCOPY NUMBER
12 , x_RBS_Element_Id OUT NOCOPY NUMBER
13 , x_calendar_id OUT NOCOPY NUMBER
14 , x_calendar_type OUT NOCOPY VARCHAR2
15 , x_report_date_julian OUT NOCOPY NUMBER
16 , x_period_name OUT NOCOPY VARCHAR2
17 , x_actual_version_id OUT NOCOPY NUMBER
18 , x_cstforecast_version_id OUT NOCOPY NUMBER
19 , x_cstbudget_version_id OUT NOCOPY NUMBER
20 , x_cstbudget2_version_id OUT NOCOPY NUMBER
21 , x_revforecast_version_id OUT NOCOPY NUMBER
22 , x_revbudget_version_id OUT NOCOPY NUMBER
23 , x_revbudget2_version_id OUT NOCOPY NUMBER
24 , x_orig_cstbudget_version_id OUT NOCOPY NUMBER
25 , x_orig_cstbudget2_version_id OUT NOCOPY NUMBER
26 , x_orig_revbudget_version_id OUT NOCOPY NUMBER
27 , x_orig_revbudget2_version_id OUT NOCOPY NUMBER
28 , x_prior_cstforecast_version_id OUT NOCOPY NUMBER
29 , x_prior_revforecast_version_id OUT NOCOPY NUMBER
30 , x_cstforecast_plan_type_id OUT NOCOPY NUMBER
31 , x_cstbudget_plan_type_id OUT NOCOPY NUMBER
32 , x_cstbudget2_plan_type_id OUT NOCOPY NUMBER
33 , x_revforecast_plan_type_id OUT NOCOPY NUMBER
34 , x_revbudget_plan_type_id OUT NOCOPY NUMBER
35 , x_revbudget2_plan_type_id OUT NOCOPY NUMBER
39 , x_Factor_By OUT NOCOPY NUMBER
36 , x_currency_record_type OUT NOCOPY NUMBER
37 , x_Currency_Code OUT NOCOPY VARCHAR2
38 , x_currency_type OUT NOCOPY VARCHAR2
40 , x_prg_display OUT NOCOPY VARCHAR2
41 , x_Effort_UOM OUT NOCOPY NUMBER
42 , x_slice_name OUT NOCOPY VARCHAR2
43 , x_task_ref_flag OUT NOCOPY VARCHAR2
44 , x_time_slice OUT NOCOPY INTEGER
45 , x_page_links_selection OUT NOCOPY VARCHAR2
46 , x_from_period OUT NOCOPY NUMBER
47 , x_to_period OUT NOCOPY NUMBER
48 , x_project_type OUT NOCOPY VARCHAR2
49 , x_ptc_flag OUT NOCOPY VARCHAR2
50 , p_prg_rollup IN OUT NOCOPY VARCHAR2
51 , x_Return_Status OUT NOCOPY VARCHAR2
52 , x_Msg_Count OUT NOCOPY NUMBER
53 , x_Msg_Data OUT NOCOPY VARCHAR2
54 , p_currency_record_type VARCHAR2 DEFAULT NULL
55 , p_period_type VARCHAR2 DEFAULT NULL
56 , p_as_of_date NUMBER DEFAULT NULL
57 , p_cstbudget_plan_type_id NUMBER DEFAULT NULL
58 , p_cstforecast_plan_type_id NUMBER DEFAULT NULL
59 , p_revbudget_plan_type_id NUMBER DEFAULT NULL
60 , p_revforecast_plan_type_id NUMBER DEFAULT NULL
61 , p_calling_type VARCHAR DEFAULT NULL
62 , x_fbs_expansion_lvl OUT NOCOPY NUMBER
63 ) IS
64
65 l_context_plan_version NUMBER;
66 l_plan_version_ids SYSTEM.PA_NUM_TBL_TYPE;
67 l_i NUMBER;
68 BEGIN
69
70
71 /* This call has to appear as the first one because we do a fnd_initialize
72 * at the end to avoid error from PA api
73 */
74
75 Pji_Rep_Util.Derive_Default_Plan_Type_Ids(p_project_id
76 , x_cstforecast_plan_type_id
77 , x_cstbudget_plan_type_id
78 , x_cstbudget2_plan_type_id
79 , x_revforecast_plan_type_id
80 , x_revbudget_plan_type_id
81 , x_revbudget2_plan_type_id
82 , x_return_status, x_msg_count, x_msg_data);
83
84 IF p_calling_type = 'PJI' THEN
85 Pji_Rep_Util.Validate_Plan_Type(p_project_id
86 , p_cstbudget_plan_type_id
87 , x_cstbudget_plan_type_id
88 , x_return_status, x_msg_count, x_msg_data);
89 Pji_Rep_Util.Validate_Plan_Type(p_project_id
90 , p_revbudget_plan_type_id
91 , x_revbudget_plan_type_id
92 , x_return_status, x_msg_count, x_msg_data);
93 Pji_Rep_Util.Validate_Plan_Type(p_project_id
94 , p_cstforecast_plan_type_id
95 , x_cstforecast_plan_type_id
96 , x_return_status, x_msg_count, x_msg_data);
97 Pji_Rep_Util.Validate_Plan_Type(p_project_id
98 , p_revforecast_plan_type_id
99 , x_revforecast_plan_type_id
100 , x_return_status, x_msg_count, x_msg_data);
101 END IF;
102
103 Pji_Rep_Util.Derive_Plan_Version_Ids(p_project_id
104 , x_cstforecast_plan_type_id
105 , x_cstbudget_plan_type_id
106 , x_cstbudget2_plan_type_id
107 , x_revforecast_plan_type_id
108 , x_revbudget_plan_type_id
109 , x_revbudget2_plan_type_id
110 , x_cstforecast_version_id
111 , x_cstbudget_version_id
112 , x_cstbudget2_version_id
113 , x_revforecast_version_id
114 , x_revbudget_version_id
115 , x_revbudget2_version_id
116 , x_orig_cstbudget_version_id
117 , x_orig_cstbudget2_version_id
118 , x_orig_revbudget_version_id
119 , x_orig_revbudget2_version_id
120 , x_prior_cstforecast_version_id
121 , x_prior_revforecast_version_id
122 , x_return_status, x_msg_count, x_msg_data);
123
124 x_actual_version_id := Pji_Rep_Util.Get_Fin_Plan_Actual_Version(p_project_id);
125
126
127 IF p_calling_type = 'PJI' THEN
128 --Bug 5593229
129
130 x_calendar_type := NVL(Fnd_Profile.value('PJI_DEF_RPT_CAL_TYPE'), 'E');
131
132 Pji_Rep_Util.Derive_Pji_Calendar_Info(p_project_id
133 , p_period_type
134 , p_as_of_date
135 , x_calendar_type
136 , x_calendar_id
137 , x_period_name
138 , x_report_date_julian
139 , x_slice_name
140 , x_return_status
141 , x_msg_count
142 , x_msg_data);
143
144 ELSE
145 Pji_Rep_Util.Derive_Default_Calendar_Info(p_project_id
146 , x_calendar_type
147 , x_calendar_id
148 , x_period_name
149 , x_report_date_julian
150 , x_slice_name
151 , x_return_status
152 , x_msg_count
153 , x_msg_data);
154 END IF;
155
156 IF p_calling_type = 'PJI' THEN
157 Pji_Rep_Util.Derive_Pji_Currency_Info(p_project_id
158 , p_currency_record_type
159 , x_currency_record_type, x_currency_code, x_currency_type
160 , x_return_status, x_msg_count, x_msg_data);
161 ELSE
162 Pji_Rep_Util.Derive_Perf_Currency_Info(p_project_id
163 , x_currency_record_type, x_currency_code, x_currency_type
164 , x_return_status, x_msg_count, x_msg_data);
165 END IF;
166
167 x_prg_display := Pji_Rep_Util.Derive_Prg_rollup_flag(p_project_id);
168
169 IF (x_prg_display = 'N') OR (p_prg_rollup = 'N') THEN
170 p_prg_rollup := 'N';
171 ELSE
172 p_prg_rollup := 'Y';
173 END IF;
174
175 Pji_Rep_Util.Derive_Perf_RBS_Parameters(p_project_id
176 , x_cstbudget_version_id
177 , p_prg_rollup
178 , x_RBS_Version_ID, x_RBS_Element_Id
179 , x_return_status, x_msg_count, x_msg_data);
180
181 IF x_cstbudget_version_id IS NOT NULL THEN
182 l_context_plan_version := x_cstbudget_version_id;
183 ELSIF x_cstforecast_version_id IS NOT NULL THEN
184 l_context_plan_version := x_cstforecast_version_id;
185 ELSIF x_revbudget_version_id IS NOT NULL THEN
186 l_context_plan_version := x_revbudget_version_id;
187 ELSIF x_revforecast_version_id IS NOT NULL THEN
188 l_context_plan_version := x_revforecast_version_id;
189 ELSIF x_cstbudget2_version_id IS NOT NULL THEN
190 l_context_plan_version := x_cstbudget2_version_id;
191 ELSIF x_revbudget2_version_id IS NOT NULL THEN
192 l_context_plan_version := x_revbudget2_version_id;
193 ELSE
194 l_context_plan_version := x_actual_version_id;
195 END IF;
196
197 x_Factor_By := Pji_Rep_Util.Derive_Factorby(p_project_id
198 , NULL -- bug 3793041
199 , x_return_status, x_msg_count, x_Msg_Data);
200
201 x_Effort_UOM := Pji_Rep_Util.get_effort_uom(p_project_id);
202 x_task_ref_flag := 'TS';
203 x_time_slice := 1376;
204 x_page_links_selection := 'PROJ_OVERVIEW';
205
206 l_plan_version_ids := SYSTEM.PA_NUM_TBL_TYPE(
207 x_actual_version_id
208 , x_cstforecast_version_id
209 , x_cstbudget_version_id
210 , x_cstbudget2_version_id
211 , x_revforecast_version_id
212 , x_revbudget_version_id
213 , x_revbudget2_version_id
214 , x_orig_cstbudget_version_id
215 , x_orig_cstbudget2_version_id
216 , x_orig_revbudget_version_id
217 , x_orig_revbudget2_version_id
218 , x_prior_cstforecast_version_id
219 , x_prior_revforecast_version_id);
220
221 IF p_prg_rollup = 'Y' THEN
222 l_plan_version_ids.extend(2);
223 l_plan_version_ids(14) := -3;
224 l_plan_version_ids(15) := -4;
225 END IF;
226
227 Pji_Rep_Util.Derive_Perf_Period(p_project_id, l_plan_version_ids
228 , x_from_period, x_to_period, x_return_status, x_msg_count, x_Msg_Data);
229
230 BEGIN
231 x_wbs_version_id := PA_PROJECT_STRUCTURE_UTILS.GET_LATEST_FIN_STRUC_VER_ID(p_project_id);
232
233 SELECT elm.proj_element_id
234 INTO x_wbs_element_id
235 FROM pa_proj_element_versions elm
236 WHERE elm.element_version_id = x_wbs_version_id;
237 EXCEPTION
238 WHEN NO_DATA_FOUND THEN
239 IF (x_wbs_version_id IS NOT NULL) THEN
240 x_msg_count := x_msg_count + 1;
241 x_return_status := Pji_Rep_Util.G_RET_STS_WARNING;
242 Pji_Rep_Util.Add_Message(p_app_short_name=> 'PJI',p_msg_name=> 'PJI_REP_SYSTEM_ERROR', p_msg_type=>Pji_Rep_Util.G_RET_STS_ERROR,p_token1=>'TOKEN_NAME',p_token1_value=>'WBS ELEMENT');
243 END IF;
244 END;
245
246 -- in case there is valid version retrieved and there is no actual.
247 IF x_wbs_version_id IS NULL THEN
248 Pji_Rep_Util.Derive_WP_WBS_Parameters(p_project_id
249 , x_WBS_Version_ID, x_WBS_Element_Id
250 , x_return_status, x_msg_count, x_msg_data);
251 END IF;
252
253 Pji_Rep_Util.Derive_Project_Type(p_project_id
254 , x_project_type
255 , x_return_status
256 , x_msg_count
257 , x_msg_data);
258
259 Pji_Rep_Util.Check_Proj_Type_Consistency(p_project_id
260 , x_wbs_version_id
261 , 'FINANCIAL'
262 , x_ptc_flag
263 , x_return_status
264 , x_msg_count
265 , x_msg_data);
266
267 --Bug 5469672 Derive the default FBS expansion level
268 x_fbs_expansion_lvl := pji_rep_util.GET_DEFAULT_EXPANSION_LEVEL(p_project_id, 'FT');
269
270 END derive_dflt_params;
271
272 END Pji_Rep_Prf_Dflt_Params;