DBA Data[Home] [Help]

PACKAGE BODY: APPS.PJI_REP_WP_DFLT_PARAMS

Source


1 package body PJI_REP_WP_DFLT_PARAMS as
2 /*$Header: PJIRX09B.pls 120.0 2005/05/29 12:56:24 appldev noship $*/
3 
4 -- ---------------------------------------------------------------------
5 
6 g_msg_level_data_bug		number;
7 g_msg_level_data_corruption 	number;
8 g_msg_level_proc_call		number;
9 g_msg_level_high_detail		number;
10 g_msg_level_low_detail		number;
11 
12 
13 -- ----------------------------------------------------------------------
14 --   This procedures derives the default values for the listed parameters
15 -- ----------------------------------------------------------------------
16 
17 procedure Derive_Default_Parameters(
18 	p_project_id			in 		number,
19 	p_structure_version_id		in 		number,
20 
21 	x_wbs_element_id		out nocopy 	number,
22 	x_wbs_version_id		out nocopy 	number,
23 	x_rbs_element_id		out nocopy 	number,
24 	x_rbs_version_id		out nocopy 	number,
25 
26 	x_calendar_type			out nocopy 	varchar2,
27 	x_calendar_id			out nocopy 	number,
28 
29 	x_current_version_id		out nocopy 	number,
30 	x_actual_version_id		out nocopy 	number,
31 	x_latest_published_version_id	out nocopy 	number,
32 	x_baselined_version_id		out nocopy 	number,
33 
34 	x_currency_record_type		out nocopy 	number,
35 	x_currency_code			out nocopy 	varchar2,
36 	x_program_flag  		out nocopy 	varchar2,
37 	x_factor_by  			out nocopy 	number,
38 	x_published_version_flag	out nocopy 	varchar2,
39 	x_versioning_enabled_flag	out nocopy 	varchar2,
40 
41 	x_from_period 			out nocopy 	number,
42 	x_to_period 			out nocopy 	number,
43 	x_report_period 		out nocopy 	number,
44 
45 	x_context_margin_mask 		out nocopy 	varchar2,
46 	x_str_editable_flag         out nocopy varchar2,
47 	x_wbs_expansion_lvl		out nocopy number,
48 	x_rbs_expansion_lvl     out nocopy number,
49 
50 	x_return_status 		out nocopy 	varchar2,
51 	x_msg_count 			out nocopy 	number,
52 	x_msg_data 			out nocopy 	varchar2
53 ) is
54 
55 -- ---------------------------------------------------------
56 
57 -- Declare statements
58 
59 g_ret_sts_warning		varchar2(1);
60 g_ret_sts_error			varchar2(1);
61 
62 l_org_id 			varchar2(30);
63 l_edit_task_ok			varchar2(1);
64 l_period_name			varchar2(30);
65 l_report_date_julian		number;
66 l_currency_type			varchar2(30);
67 l_actual_summ_date 		date;
68 
69 
70 -- ---------------------------------------------------------
71 
72 begin
73 
74 g_ret_sts_warning 	:= 'W';
75 g_ret_sts_error		:= 'E';
76 
77 
78 -- ---------------------------
79 
80 if 	x_return_status is null
81 then
82 	x_msg_count := 0;
83 	x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
84 end if;
85 
86 
87 -- ---------------------------
88 -- x_program_flag --
89 
90 -- x_program_flag := 'N'; -- hard-code value to deactivate programs
91 
92 x_program_flag :=
93 	Pji_Rep_Util.Derive_Prg_Rollup_Flag(
94 		p_project_id
95 	 );
96 
97 /*
98 -- --------------------------
99 -- populate project hierarch cache
100 
101 Pji_Rep_Util.Populate_WBS_Hierarchy_Cache(
102 	p_project_id,
103 	p_structure_version_id,
104 	x_program_flag,
105 	'WORKPLAN',
106 	null,
107 	x_return_status,
108 	x_msg_count,
109 	x_msg_data
110 	);
111 */
112 
113 
114 -- --------------------------
115 -- x_current_version_id --
116 -- x_latest_published_version_id --
117 -- x_baselined_version_id --
118 
119 Pji_Rep_Util.Derive_Work_Plan_Versions(
120 	p_project_id,
121 	p_structure_version_id,
122 	x_current_version_id,
123 	x_baselined_version_id,
124 	x_latest_published_version_id,
125 	x_return_status,
126 	x_msg_count,
127 	x_msg_data
128 	);
129 
130 
131 -- ---------------------------
132 -- x_wbs_element_id --
133 -- x_wbs_version_id --
134 
135 Pji_Rep_Util.Derive_Default_WBS_Parameters(
136 	p_project_id,
137 	x_current_version_id, 		-- derived
138 	x_wbs_version_id,
139 	x_wbs_element_id,
140 	x_return_status,
141 	x_msg_count,
142 	x_msg_data
143 	);
144 
145 
146 -- ---------------------------
147 -- x_rbs_element_id --
148 -- x_rbs_version_id --
149 
150 Pji_Rep_Util.Derive_Default_RBS_Parameters(
151 	p_project_id,
152 	x_current_version_id, -- p_structure_version_id,
153 	x_rbs_version_id,
154 	x_rbs_element_id,
155 	x_return_status,
156 	x_msg_count,
157 	x_msg_data
158 	);
159 
160 
161 -- ---------------------------
162 -- x_calendar_id --
163 -- x_calendar_type --
164 
165 Pji_Rep_Util.Derive_WP_Calendar_Info(
166 	p_project_id,
167 	x_current_version_id,  		-- derived
168 	x_calendar_id,
169 	x_calendar_type,
170 	x_return_status,
171 	x_msg_count,
172 	x_msg_data
173 	);
174 
175 
176 -- ---------------------------
177 -- x_actual_version_id --
178 
179 x_actual_version_id :=
180 	Pji_Rep_Util.get_work_plan_actual_version(
181 		p_project_id
182 	);
183 
184 
185 -- ---------------------------
186 -- x_currency_record_type --
187 -- x_currency_code --
188 
189 Pji_Rep_Util.Derive_Default_Currency_Info(
190 	p_project_id,
191 	x_currency_record_type,
192 	x_currency_code,
193 	l_currency_type,
194 	x_return_status,
195 	x_msg_count,
196 	x_msg_data
197 	);
198 
199 
200 -- ---------------------------
201 -- x_from_period
202 -- x_to_period
203 
204 Pji_Rep_Util.Derive_WP_Period(
205 	p_project_id,
206 	x_latest_published_version_id, 	-- derived
207 	x_current_version_id, 		-- derived
208 	x_from_period,
209 	x_to_period,
210 	x_return_status,
211 	x_msg_count,
212 	x_msg_data
213 	);
214 
215 
216 -- ---------------------------
217 -- x_factor_by --
218 
219 x_factor_by :=
220 	Pji_Rep_Util.Derive_Factorby(
221 		p_project_id,
222 		--NULL,			-- p_fin_plan_type_id
223 		x_current_version_id, --bug 3793041
224 		x_return_status,
225 		x_msg_count,
226 		x_msg_data
227 	);
228 
229 /*
230 -- ---------------------------
231 -- l_edit_task_ok--
232 -- x_published_version_flag --
233 
234 l_edit_task_ok :=
235         pa_proj_elements_utils.Check_Edit_Task_Ok(
236                 p_project_id,
237                 p_structure_version_id,
238                 p_structure_version_id
239         );
240 
241 if      l_edit_task_ok = 'Y'
242 then
243         x_published_version_flag := 'N';
244 else
245         x_published_version_flag := 'Y';
246 
247 end if;
248 */
249 -- ---------------------------
250 -- x_published_version_flag --
251 
252 x_published_version_flag :=
253 PA_PROJECT_STRUCTURE_UTILS.Check_Struc_Ver_Published(
254 		p_project_id => p_project_id,
255 		p_structure_version_id => p_structure_version_id);
256 
257 if x_published_version_flag not in ('Y','N') then
258 	x_return_status := FND_API.G_RET_STS_ERROR;
259 	return;
260 end if;
261 -- ---------------------------
262 -- x_editable_flag --
263 
264 x_str_editable_flag :=
265 	pa_proj_elements_utils.Check_Edit_Task_Ok(
266 		p_project_id,
267 		p_structure_version_id,
268 		p_structure_version_id
269 	);
270 
271 -- ---------------------------
272 -- x_context_margin_mask
273 
274 Pji_Rep_Util.Derive_Version_Margin_Mask(
275 	p_project_id,
276 	x_current_version_id,
277 	x_context_margin_mask,
278 	x_return_status,
279 	x_msg_count,
280 	x_msg_data
281 	);
282 
283 if 	x_context_margin_mask is null
284 then
285 	x_context_margin_mask := 'B';
286 end if;
287 
288 
289 -- ---------------------------
290 -- l_versioning_enabled--
291 
292 x_versioning_enabled_flag :=
293 	PA_WORKPLAN_ATTR_UTILS.CHECK_WP_VERSIONING_ENABLED(
294 		p_project_id
295 	);
296 
297 if 	x_versioning_enabled_flag is null
298 then
299 	x_versioning_enabled_flag := 'N';
300 
301 end if;
302 
303 
304 -- ---------------------------
305 -- x_report_period
306 
307 l_actual_summ_date :=
308 	pa_progress_utils.get_actual_summ_date(
309 		p_project_id
310 	);
311 
312 begin
313 	select 	to_char(start_date,'j')
314 	into 	x_report_period
315 	from 	pji_time_cal_period
316 	where 	l_actual_summ_date -- sysdate
317 	between start_date
318 	and 	end_date
319 	and 	calendar_id = x_calendar_id;
320 exception
321 	when no_data_found
322 	then
323 		x_report_period := 1;
324 end;
325 
326 
327 if 	l_actual_summ_date is null
328 then
329 	x_report_period := 1;
330 end if;
331 
332 -- ---------------------------
333 -- Get the default expansion levels
334 
335 x_wbs_expansion_lvl := pji_rep_util.GET_DEFAULT_EXPANSION_LEVEL
336 								(p_project_id => p_project_id,
337 								 p_object_type => 'T');
338 
339 x_rbs_expansion_lvl := pji_rep_util.GET_DEFAULT_EXPANSION_LEVEL
340 								(p_project_id => p_project_id,
341 								 p_object_type => 'R');
342 
343 exception
344 
345 	when 	NO_DATA_FOUND
346 	then
347 		x_msg_count := 1;
348 		x_return_status := Fnd_Api.G_RET_STS_ERROR;
349 		Pji_Rep_Util.Add_Message(p_app_short_name=> 'PJI',p_msg_name=> 'PJI_REP_NO_DATA_MSG', p_msg_type=>Pji_Rep_Util.G_RET_STS_ERROR, p_token1=>'ITEM_NAME', p_token1_value=>'plan type attributes');
350 	when 	OTHERS
351 	then
352 		x_msg_count := 1;
353 		x_return_status := Fnd_Api.G_RET_STS_ERROR;
354 		Pji_Rep_Util.Add_Message(p_app_short_name=> 'PJI',p_msg_name=> 'PJI_REP_GENERIC_MSG',p_msg_type=>Pji_Rep_Util.G_RET_STS_ERROR,p_token1=>'PROC_NAME',p_token1_value=>'Pji_Rep_Util.Derive_Plan_Type_Parameters');
355 
356 	raise;
357 
358 
359 -- ---------------------------
360 
361 end Derive_Default_Parameters;
362 
363 -- ----------------------------------------------------------------------
364 
365 
366 
367 
368 
369 -- ----------------------------------------------------------------------
370 --   This procedure derives the tip message for view workplan pages
371 -- ----------------------------------------------------------------------
372 
373 procedure Get_Currency_Tip(
374 	p_project_id			in		number,
375 	p_currency_record_type		in		varchar2,
376 	x_tip_message			out nocopy 	varchar2,
377 
378 	x_return_status			out nocopy 	varchar2,
379 	x_msg_count			out nocopy	number,
380 	x_msg_data			out nocopy 	varchar2
381 ) is
382 
383 -- -------------------------------------
384 -- Declare statements
385 
386 l_prj_curr		varchar2(30);
387 l_pfc_curr		varchar2(30);
388 
389 l_curr_text		varchar2(60);
390 l_version_text		varchar2(60);
391 
392 l_curr_code		varchar2(30);
393 l_curr_type_msg		fnd_new_messages.MESSAGE_TEXT%TYPE; /* commented and modified for bug 4135886 varchar2(40); */
394 
395 l_version_type_msg	fnd_new_messages.MESSAGE_TEXT%TYPE; /* commented and modified for bug 4135886 varchar(60); */
396 
397 
398 -- -------------------------------------
399 
400 begin
401 
402 -- ---------------------------
403 
404 if 	x_return_status is null
405 then
406 	x_msg_count := 0;
407 	x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
408 end if;
409 
410 
411 -- -------------------------------------
412 
413 select 	project_currency_code,
414 	projfunc_currency_code
415 into	l_prj_curr,
416 	l_pfc_curr
417 from	pa_projects
418 where	project_id = p_project_id;
419 
420 
421 -- -------------------------------------
422 
423 -- record type id for project currency code is 8
424 -- record type id for project functional currency code is 4
425 
426 if	(p_currency_record_type = '8')
427 then
428 	l_curr_code	:= l_prj_curr;
429 	l_curr_type_msg	:= fnd_message.get_string('PJI', 'PJI_REP_PROJECT_CURR');
430 
431 elsif 	(p_currency_record_type = '4')
432 then
433 	l_curr_code	:= l_pfc_curr;
434 	l_curr_type_msg	:= fnd_message.get_string('PJI', 'PJI_REP_PFC_CURR');
435 
436 else
437 	l_curr_code	:= l_prj_curr;
438 	l_curr_type_msg	:= fnd_message.get_string('PJI', 'PJI_REP_PROJECT_CURR');
439 
440 end if;
441 
442 
443 -- -------------------------------------
444 
445 fnd_Message.set_name('PJI','PJI_WP_CURR_TIP');
446 fnd_Message.set_token('CURRTYPE', l_curr_type_msg);
447 fnd_Message.set_token('CURRCODE',l_curr_code);
448 x_tip_message := Fnd_Message.get;
449 
450 
451 -- -------------------------------------
452 
453 exception
454 
455 	when 	NO_DATA_FOUND
456 	then
457 		x_msg_count := 1;
458 		x_return_status := Fnd_Api.G_RET_STS_ERROR;
459 		Pji_Rep_Util.Add_Message(p_app_short_name=> 'PJI',p_msg_name=> 'PJI_REP_NO_DATA_MSG', p_msg_type=>Pji_Rep_Util.G_RET_STS_ERROR, p_token1=>'ITEM_NAME', p_token1_value=>'plan type attributes');
460 	when 	OTHERS
461 	then
462 		x_msg_count := 1;
463 		x_return_status := Fnd_Api.G_RET_STS_ERROR;
464 		Pji_Rep_Util.Add_Message(p_app_short_name=> 'PJI',p_msg_name=> 'PJI_REP_GENERIC_MSG',p_msg_type=>Pji_Rep_Util.G_RET_STS_ERROR,p_token1=>'PROC_NAME',p_token1_value=>'Pji_Rep_Util.Derive_Plan_Type_Parameters');
465 
466 	raise;
467 
468 -- -------------------------------------
469 
470 end Get_Currency_Tip;
471 
472 -- ----------------------------------------------------------------------
473 
474 
475 
476 
477 
478 -- --------------------------------------------------------------------
479 
480 begin
481 
482 -- --------------------------------------------------------------------
483 
484 -- Declare Global Variables
485 
486 g_msg_level_data_bug		:= 6;
487 g_msg_level_data_corruption 	:= 5;
488 g_msg_level_proc_call		:= 3;
489 g_msg_level_high_detail		:= 2;
490 g_msg_level_low_detail		:= 1;
491 
492 -- ----------------------------------------------------------------------
493 
494 end PJI_REP_WP_DFLT_PARAMS;
495 
496 -- ----------------------------------------------------------------------
497 
498 -- ----------------------------------------------------------------------
499 
500