DBA Data[Home] [Help]

PACKAGE BODY: APPS.PJI_REP_MEASURE_UTIL

Source


1 PACKAGE BODY Pji_Rep_Measure_Util AS
2 /* $Header: PJIRX15B.pls 120.38.12020000.2 2012/07/18 10:56:32 admarath ship $ */
3 
4 /**
5  ** constants for logging
6  **/
7 g_msg_level_highest_detail    NUMBER;
8 g_msg_level_normal_flow       NUMBER;
9 g_msg_level_data_bug          NUMBER;
10 g_msg_level_data_corruption   NUMBER;
11 g_msg_level_runtime_info      NUMBER;
12 g_msg_level_proc_call         NUMBER;
13 g_msg_level_low_detail        NUMBER;
14 g_msg_level_lowest_detail     NUMBER;
15 g_debug_mode VARCHAR2(1) := NVL(Fnd_Profile.value('PA_DEBUG_MODE'),'N');
16 
17 /**
18  ** measure types
19  **/
20 g_CurrencyType                VARCHAR2(10);
21 g_PercentType                 VARCHAR2(10);
22 g_HoursType                   VARCHAR2(10);
23 g_IndexType                   VARCHAR2(10);
24 g_OtherType                  VARCHAR2(10);
25 g_DaysType					  VARCHAR2(10);
26 
27 /**
28  ** Constants for the number of decimal places to use for the different types
29  **/
30 g_CurrencyDecimalPlaces       NUMBER; -- number of decimal places for Currency measures
31 g_HoursDecimalPlaces          NUMBER; -- number of decimal places for effort measures
32 g_PercentDecimalPlaces        NUMBER; -- number of decimal places for percentage measures
33 g_IndexDecimalPlaces          NUMBER; -- number of decimal places for index measures
34 g_currency_size               NUMBER; -- maximum size of the currency measures strings
35 
36 /**
37  ** plan type constants for understanding which plan types are present in the current plan version
38  **/
39 g_Actual_is_present           NUMBER;
40 g_CstFcst_is_present          NUMBER;
41 g_CstBudget_is_present        NUMBER;
42 g_CstBudget2_is_present       NUMBER;
43 g_RevFcst_is_present          NUMBER;
44 g_RevBudget_is_present        NUMBER;
45 g_RevBudget2_is_present       NUMBER;
46 g_OrigCstFcst_is_present      NUMBER;
47 g_OrigCstBudget_is_present    NUMBER;
48 g_OrigCstBudget2_is_present   NUMBER;
49 g_OrigRevFcst_is_present      NUMBER;
50 g_OrigRevBudget_is_present    NUMBER;
51 g_OrigRevBudget2_is_present   NUMBER;
52 g_CstPriorfcst_is_present     NUMBER;
53 g_RevPriorfcst_is_present     NUMBER;
54 g_Actual_CstBudget            NUMBER;
55 g_Actual_CstFcst              NUMBER;
56 g_Actual_CstRevBudget         NUMBER;
57 g_Actual_RevBudget            NUMBER;
58 g_Actual_RevFcst			  NUMBER;
59 g_CstRevBudget                NUMBER;
60 g_CstRevBudget2               NUMBER;
61 g_CstRevFcst                  NUMBER;
62 g_CstBudget_CstFcst           NUMBER;
63 g_RevBudget_RevFcst           NUMBER;
64 g_CstRevBudgetFcst            NUMBER;
65 g_CstOrigCstBudget            NUMBER;
66 g_CstFcst_OrigCstBudget       NUMBER;
67 g_CstRevBudgetOrigbudget      NUMBER;
68 g_RevBudgetOrigbudget         NUMBER;
69 g_CstRevOrigbudgetFcst        NUMBER;
70 g_RevBudgetFcst               NUMBER;
71 g_RevOrigbudgetFcst           NUMBER;
72 g_RevFcstRevPriorfcst         NUMBER;
73 g_CstRevFcstPriorfcst         NUMBER;
74 g_Cst_FcstPriorfcst           NUMBER;
75 g_CstFcstCstPriorfcst		  NUMBER;
76 g_ProjList					  VARCHAR2(10):='PROJLIST';
77 g_Prepare					  VARCHAR2(10):='PREPARE';
78 g_Exception					  VARCHAR2(10):='EXCEPTION';
79 
80 PROCEDURE compute_proj_perf_exceptions
81 (
82     p_commit_flag               IN VARCHAR2
83     , x_msg_count               OUT NOCOPY NUMBER
84     , x_msg_data                OUT NOCOPY VARCHAR2
85     , x_return_status           OUT NOCOPY VARCHAR2
86 )
87 
88 IS
89 
90   l_DaysSinceITD                 NUMBER;
91   l_DaysInPeriod                 NUMBER;
92   i                              NUMBER;
93   l_WBS_Version_ID               NUMBER;
94   l_WBS_Element_Id               NUMBER;
95   l_RBS_Version_ID               NUMBER;
96   l_RBS_Element_Id               NUMBER;
97   l_calendar_id                  NUMBER;
98   l_report_date_julian           NUMBER ;
99   l_period_name                  VARCHAR2(255);
100   l_actual_version_id            NUMBER;
101   l_cstforecast_version_id       NUMBER;
102   l_cstbudget_version_id         NUMBER;
103   l_cstbudget2_version_id        NUMBER;
104   l_revforecast_version_id       NUMBER;
105   l_revbudget_version_id         NUMBER;
106   l_revbudget2_version_id        NUMBER;
107   l_orig_cstforecast_version_id  NUMBER;
108   l_orig_cstbudget_version_id    NUMBER;
109   l_orig_cstbudget2_version_id   NUMBER;
110   l_orig_revforecast_version_id  NUMBER;
111   l_orig_revbudget_version_id    NUMBER;
112   l_orig_revbudget2_version_id   NUMBER;
113   l_prior_cstforecast_version_id NUMBER;
114   l_prior_revforecast_version_id NUMBER;
115   l_actual_plantype_id           NUMBER;
116   l_cstforecast_plantype_id      NUMBER;
117   l_cstbudget_plantype_id        NUMBER;
118   l_cstbudget2_plantype_id       NUMBER;
119   l_revforecast_plantype_id      NUMBER;
120   l_revbudget_plantype_id        NUMBER;
121   l_revbudget2_plantype_id       NUMBER;
122   l_currency_record_type         NUMBER;
123   l_Currency_Code                VARCHAR2(255);
124   l_factor_by                    NUMBER;
125   l_effort_uom                   NUMBER;
126   l_time_slice                   NUMBER;
127   l_prg_rollup                   VARCHAR2(1);
128   l_report_type                  VARCHAR2(255);
129   l_sql_errm                     VARCHAR2(255);
130   l_org_id                       NUMBER;
131   l_currency_type_msg_name       VARCHAR2(255);
132   l_Return_Status                VARCHAR2(255);
133   l_Msg_Count                    NUMBER;
134   l_Msg_Data                     VARCHAR2(255);
135   l_measure_set_codes_tbl        SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
136   l_xtd_types_tbl                SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
137   l_measure_set_types            SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
138   l_ptd_values                   SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
139   l_qtd_values                   SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
140   l_ytd_values                   SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
141   l_itd_values                   SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
142   l_ac_values                    SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
143   l_prp_values                   SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
144   l_ptd_html                     SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
145   l_qtd_html                     SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
146   l_ytd_html                     SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
147   l_itd_html                     SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
148   l_ac_html                      SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
149   l_prp_html                     SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
150 
151   l_project_ids_tbl              SYSTEM.PA_NUM_TBL_TYPE;
152   l_calendar_type_tbl            SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
153   l_currency_type_tbl            SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
154   l_rowids_tbl                   SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
155   l_measure_ids_tbl              SYSTEM.PA_NUM_TBL_TYPE;
156   l_measure_values_tbl           SYSTEM.PA_NUM_TBL_TYPE;
157 
158   l_ptd_trans_id	     		 SYSTEM.PA_NUM_TBL_TYPE;
159   l_ytd_trans_id	     		 SYSTEM.PA_NUM_TBL_TYPE;
160   l_qtd_trans_id	     		 SYSTEM.PA_NUM_TBL_TYPE;
161   l_itd_trans_id	     		 SYSTEM.PA_NUM_TBL_TYPE;
162   l_ac_trans_id	     	 		 SYSTEM.PA_NUM_TBL_TYPE;
163   l_prp_trans_id	     		 SYSTEM.PA_NUM_TBL_TYPE;
164 
165   l_ptd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
166   l_ytd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
167   l_qtd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
168   l_itd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
169   l_ac_meaning       SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
170   l_prp_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
171 
172 
173   l_exception_indicator_tbl		 SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
174   l_plan_version_ids	     	 SYSTEM.PA_NUM_TBL_TYPE;
175   l_i NUMBER;
176   x NUMBER;
177 
178   l_slice_name VARCHAR2(30);
179 
180 BEGIN
181 
182 	NULL;
183 
184   IF g_debug_mode = 'Y' THEN
185 	  Pji_Utils.WRITE2LOG(
186 	    'PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions: beginning execution....',
187 	    TRUE, g_msg_level_proc_call
188 	  );
189   END IF;
190   l_msg_count     := 0;
191   l_return_status := Fnd_Api.G_RET_STS_SUCCESS;
192 
193 
194   --BEGIN
195   --  DELETE PA_PERF_TEMP_OBJ_MEASURE_debug;
196   --  INSERT INTO PA_PERF_TEMP_OBJ_MEASURE_debug SELECT * FROM PA_PERF_TEMP_OBJ_MEASURE;
197   --  COMMIT;
198   --END;
199 
200 
201   --
202   -- derive distinct combinations of {project_id, calendar_type, currency_type}:
203   -- each of these "combinations" will result in a distinct call to retrieveData
204   --
205   BEGIN
206     SELECT DISTINCT
207       excp.object_id project_id
208     , excp.calendar_type
209     , excp.currency_type
210     BULK COLLECT INTO
211       l_project_ids_tbl
212     , l_calendar_type_tbl
213     , l_currency_type_tbl
214     FROM
215       pa_perf_temp_obj_measure excp
216     WHERE 1=1
217     AND excp.object_type = 'PA_PROJECTS';
218   EXCEPTION
219     WHEN NO_DATA_FOUND THEN
220       RETURN;
221     WHEN OTHERS THEN
222       NULL;
223   END;
224 
225   IF l_project_ids_tbl.COUNT < 1 THEN
226       RETURN;
227   END IF;
228 
229   IF g_debug_mode = 'Y' THEN
230 	  Pji_Utils.WRITE2LOG(
231 	    'PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions: l_project_ids_tbl.LAST ' ||
232 	    '(collected from table PA_PERF_TEMP_OBJ_MEASURE) = ' || l_project_ids_tbl.LAST,
233 	    TRUE, g_msg_level_runtime_info
234 	  );
235   END IF;
236 
237 
238   --x := l_project_ids_tbl.LAST;
239   --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions', 'l_project_ids_tbl.LAST='||TO_CHAR(x),SYSDATE);
240 
241 
242 
243   --
244   -- for every project/cal/currency combination, find the related measures
245   -- and compute its excp
246   --
247   FOR i IN 1..l_project_ids_tbl.LAST LOOP
248 
249     --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions', 'i='||i||', project_id= '||TO_CHAR(l_project_ids_tbl(i)),SYSDATE);
250     --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions', 'i='||i||', calendar_type= '||l_calendar_type_tbl(i),SYSDATE);
251     --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions', 'i='||i||', currency type= '||l_currency_type_tbl(i),SYSDATE);
252 
253 
254     --
255     -- first obtain the measures and the measures_sets that we'll compute in
256     -- this loop iteration: the l_measure_set_codes_tbl collection will be
257     -- passed in to retrieveData. We'll need the xtd_type after retrieveData
258     -- to properly fill l_measure_values_tbl with the right timeslice value,
259     -- since retrieveData() retrieves the values of each input measure set
260     -- for all available timeslices. We'll use the rowid to efficiently
261     -- update the table with the row-related measure values and period_name.
262     --
263 	-- Ning add order by , so that we can easility build the measure_set_code with measure_code
264 	-- Array in retrieveData. Fix for performance bug 3999480
265     BEGIN
266       SELECT
267         ROWIDTOCHAR(excp.ROWID)
268       , excp.measure_id
269       , msrs.measure_set_code
270       , msrs.xtd_type
271       , NULL
272       BULK COLLECT INTO
273         l_rowids_tbl
274       , l_measure_ids_tbl
275       , l_measure_set_codes_tbl
276       , l_xtd_types_tbl
277       , l_measure_values_tbl --will contain the values for the requested measures
278       FROM
279         pa_perf_temp_obj_measure excp
280       , pji_mt_measures_b msrs
281       WHERE 1=1
282       AND excp.object_type = 'PA_PROJECTS'
283       AND msrs.measure_id  = excp.measure_id
284       AND excp.object_id     = l_project_ids_tbl(i)
285       AND excp.calendar_type = l_calendar_type_tbl(i)
286       AND excp.currency_type = l_currency_type_tbl(i)
287 	  ORDER BY msrs.measure_set_code;
288     EXCEPTION
289       WHEN OTHERS THEN
290         NULL;
291     END;
292 
293 
294 
295     --x:= l_measure_set_codes_tbl.LAST;
296     --INSERT INTO pji_rep_debug_msg VALUES('i='||i,'l_measure_set_codes_tbl.LAST = ' || x,SYSDATE);
297 
298 
299 
300     -- if no measures exceptions are found for the current project, will do nothing
301     IF l_measure_set_codes_tbl.LAST > 0 THEN
302 
303 
304 	  Pji_Rep_Util.Derive_Pa_Calendar_Info(p_project_id =>l_project_ids_tbl(i)
305 	  , p_calendar_type => l_calendar_type_tbl(i)
306 	  , x_calendar_id => l_calendar_id
307 	  , x_report_date_julian => l_report_date_julian
308 	  , x_period_name => l_period_name
309 	  , x_slice_name => l_slice_name
310 	  , x_return_status => x_return_status
311 	  , x_msg_count => x_msg_count
312 	  , x_msg_data => x_msg_data
313 	  );
314 
315 
316       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions', 'i='||i||', l_calendar_id = ' || TO_CHAR(l_calendar_id),SYSDATE);
317       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions', 'i='||i||', l_org_id = ' || TO_CHAR(l_org_id),SYSDATE);
318       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions', 'i='||i||', l_period_name = ' || l_period_name,SYSDATE);
319       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions', 'i='||i||', l_report_date_julian = ' || l_report_date_julian,SYSDATE);
320 
321 
322 
323       --
324       -- deriving currency_type, currency_record_type, currency_code
325       --
326 
327       IF l_currency_type_tbl(i)    = 'G' THEN
328         l_currency_type_msg_name := 'PJI_REP_GLOBAL_CURRENCY';
329         l_currency_record_type   := 1;
330         l_Currency_Code          := Pji_Utils.get_global_primary_currency;
331       ELSIF l_currency_type_tbl(i) = 'G2' THEN
332         l_currency_type_msg_name := 'PJI_REP_GLOBAL2_CURRENCY';
333         l_currency_record_type   := 2;
334         l_Currency_Code          := Pji_Utils.get_global_secondary_currency;
335       ELSIF l_currency_type_tbl(i) = 'F' THEN
336         l_currency_type_msg_name := 'PJI_REP_PROJ_FUNC_CURRENCY';
337         l_currency_record_type   := 4;
338         BEGIN
339           SELECT projfunc_currency_code
340           INTO  l_Currency_Code
341           FROM  pa_projects_all
342           WHERE project_id = l_project_ids_tbl(i);
343         EXCEPTION
344           WHEN OTHERS THEN
345             l_Currency_Code := NULL;
346         END;
347       ELSIF l_currency_type_tbl(i) = 'P' THEN
348         l_currency_type_msg_name := 'PJI_REP_PROJ_CURRENCY';
349         l_currency_record_type   := 8;
350         BEGIN
351           SELECT project_currency_code
352           INTO  l_Currency_Code
353           FROM  pa_projects_all
354           WHERE project_id = l_project_ids_tbl(i);
355         EXCEPTION
356           WHEN OTHERS THEN
357             l_Currency_Code := NULL;
358         END;
359       END IF;
360 
361 
362       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions', 'i='||i||', l_currency_type_msg_name = ' || l_currency_type_msg_name,SYSDATE);
363 
364 
365       --
366       -- derive other default values parameters except calendar_type
367       -- and currency_type
368       --
369 
370       Pji_Rep_Util.Derive_Default_Plan_Versions(l_project_ids_tbl(i)
371           , l_actual_version_id
372           , l_cstforecast_version_id
373           , l_cstbudget_version_id
374           , l_cstbudget2_version_id
375           , l_revforecast_version_id
376           , l_revbudget_version_id
377           , l_revbudget2_version_id
378           , l_orig_cstforecast_version_id
379           , l_orig_cstbudget_version_id
380           , l_orig_cstbudget2_version_id
381           , l_orig_revforecast_version_id
382           , l_orig_revbudget_version_id
383           , l_orig_revbudget2_version_id
384           , l_prior_cstforecast_version_id
385           , l_prior_revforecast_version_id
386           , l_return_status, l_msg_count, l_msg_data);
387 
388 	  --bug 4355820, only compute project amount for exception generation
389       l_prg_rollup := 'N';--Pji_Rep_Util.Derive_Prg_Rollup_Flag(l_project_ids_tbl(i));
390 
391 
392 
393 	l_plan_version_ids := SYSTEM.PA_NUM_TBL_TYPE(
394        l_actual_version_id
395       , l_cstforecast_version_id
396       , l_cstbudget_version_id
397       , l_cstbudget2_version_id
398       , l_revforecast_version_id
399       , l_revbudget_version_id
400       , l_revbudget2_version_id
401       , l_orig_cstbudget_version_id
402       , l_orig_cstbudget2_version_id
403       , l_orig_revbudget_version_id
404       , l_orig_revbudget2_version_id
405       , l_prior_cstforecast_version_id
406       , l_prior_revforecast_version_id);
407 
408 		l_i := 1;
409 		WHILE l_i <= l_plan_version_ids.COUNT AND l_wbs_version_id IS NULL LOOP
410 			IF l_plan_version_ids(l_i) IS NOT NULL THEN
411 		      Pji_Rep_Util.Derive_Default_WBS_Parameters(l_project_ids_tbl(i)
412 		          , l_plan_version_ids(l_i)
413 		          , l_WBS_Version_ID, l_WBS_Element_Id
414 		          , l_return_status, l_msg_count, l_msg_data);
415 			END IF;
416 		  l_i := l_i+1;
417 		END LOOP;
418 
419 
420 
421       l_Factor_By := Pji_Rep_Util.Derive_Factorby(l_project_ids_tbl(i),
422                        l_cstbudget_version_id, l_return_status, l_msg_count, l_Msg_Data);
423       l_Effort_UOM := Pji_Rep_Util.get_effort_uom(l_project_ids_tbl(i));
424 
425       l_time_slice  := 1376;
426       l_report_type := 'TS';  -- prfTaskResFlag
427 
428       -- derive plan types
429       get_plan_type_info( l_project_ids_tbl(i), l_actual_version_id,
430           l_cstforecast_version_id, l_cstbudget_version_id, l_cstbudget2_version_id,
431           l_revforecast_version_id, l_revbudget_version_id, l_revbudget2_version_id,
432           l_orig_cstforecast_version_id, l_orig_cstbudget_version_id, l_orig_cstbudget2_version_id,
433           l_orig_revforecast_version_id, l_orig_revbudget_version_id, l_orig_revbudget2_version_id,
434           l_actual_plantype_id,
435           l_cstforecast_plantype_id, l_cstbudget_plantype_id, l_cstbudget2_plantype_id,
436           l_revforecast_plantype_id, l_revbudget_plantype_id, l_revbudget2_plantype_id,
437           l_Return_Status, l_Msg_Count, l_Msg_Data);
438 
439 
440       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions',
441       --     'i='||i||', l_WBS_Element_Id = ' || TO_CHAR(l_WBS_Element_Id),SYSDATE);
442       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions',
443       --     'i='||i||', l_cstbudget_version_id = ' || TO_CHAR(l_cstbudget_version_id),SYSDATE);
444       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions',
445       --     'i='||i||', l_cstforecast_version_id = ' || TO_CHAR(l_cstforecast_version_id),SYSDATE);
446       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions',
447       --     'i='||i||', l_revbudget_version_id = ' || TO_CHAR(l_revbudget_version_id),SYSDATE);
448       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions',
449       --     'i='||i||', l_revforecast_version_id = ' || TO_CHAR(l_revforecast_version_id),SYSDATE);
450       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions',
451       --     'i='||i||', l_cstbudget_plantype_id = ' || TO_CHAR(l_cstbudget_plantype_id),SYSDATE);
452       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions',
453       --     'i='||i||', l_cstforecast_plantype_id = ' || TO_CHAR(l_cstforecast_plantype_id),SYSDATE);
454       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions',
455       --     'i='||i||', l_revbudget_plantype_id = ' || TO_CHAR(l_revbudget_plantype_id),SYSDATE);
456       --INSERT INTO pji_rep_debug_msg VALUES('PJI_REP_MEASURE_UTIL.compute_proj_perf_exceptions',
457       --     'i='||i||', l_revforecast_plantype_id = ' || TO_CHAR(l_revforecast_plantype_id),SYSDATE);
458 
459 
460       -- retrieve data related to the wanted measures sets, using default parameters
461       retrieveData(l_project_ids_tbl(i),  l_WBS_Version_Id, l_WBS_Element_Id, -1, -1,
462           l_calendar_id, l_calendar_type_tbl(i),  l_report_date_julian,
463           l_actual_version_id,
464           l_cstforecast_version_id, l_cstbudget_version_id, l_cstbudget2_version_id,
465           l_revforecast_version_id, l_revbudget_version_id, l_revbudget2_version_id,
466           l_orig_cstforecast_version_id, l_orig_cstbudget_version_id, l_orig_cstbudget2_version_id,
467           l_orig_revforecast_version_id, l_orig_revbudget_version_id, l_orig_revbudget2_version_id,
468           l_prior_cstforecast_version_id, l_prior_revforecast_version_id,
469           l_actual_plantype_id,
470           l_cstforecast_plantype_id, l_cstbudget_plantype_id, l_cstbudget2_plantype_id,
471           l_revforecast_plantype_id, l_revbudget_plantype_id, l_revbudget2_plantype_id,
472           l_currency_record_type, l_Currency_Code, l_factor_by, l_effort_uom,
473           l_currency_type_tbl(i), l_time_slice, l_prg_rollup, l_report_type,
474 		  l_period_name,
475           l_measure_set_codes_tbl,
476 		  'Y', 'Y', 'Y',
477 		  g_Exception, NULL, l_exception_indicator_tbl,
478           -- outputs below
479           l_measure_set_types,
480           l_ptd_values, l_qtd_values, l_ytd_values, l_itd_values, l_ac_values, l_prp_values,
481           l_ptd_html, l_qtd_html, l_ytd_html, l_itd_html, l_ac_html, l_prp_html,
482 		  l_ptd_trans_id, l_qtd_trans_id, l_ytd_trans_id, l_itd_trans_id, l_ac_trans_id, l_prp_trans_id,
483 		  l_ptd_meaning, l_qtd_meaning, l_ytd_meaning, l_itd_meaning, l_ac_meaning, l_prp_meaning,
484           l_DaysSinceITD, l_DaysInPeriod, l_Return_Status, l_Msg_Count, l_Msg_Data);
485 
486 		  /* Bug 6914287 changed the order of the trans_id variables to match the procedure definition */
487 
488     -- build l_measure_values_tbl
489       FOR j IN 1..l_measure_set_codes_tbl.LAST LOOP
490 
491 	  /* Bug 4213641
492 	  	 Remove the revert format logic here by Ning, we will handle this in retrieveData,
493 	  	 if we see the calling type is exception, we will not format it
494 
495         IF    l_xtd_types_tbl(j) = 'PTD' THEN
496             l_measure_values_tbl(j) := TO_NUMBER(REPLACE(REPLACE(l_ptd_values(j),',',NULL), '%',NULL));
497         ELSIF l_xtd_types_tbl(j) = 'QTD' THEN
498             l_measure_values_tbl(j) := TO_NUMBER(REPLACE(REPLACE(l_qtd_values(j),',',NULL), '%',NULL));
499         ELSIF l_xtd_types_tbl(j) = 'YTD' THEN
500             l_measure_values_tbl(j) := TO_NUMBER(REPLACE(REPLACE(l_ytd_values(j),',',NULL), '%',NULL));
501         ELSIF l_xtd_types_tbl(j) = 'ITD' THEN
502             l_measure_values_tbl(j) := TO_NUMBER(REPLACE(REPLACE(l_itd_values(j),',',NULL), '%',NULL));
503         ELSIF l_xtd_types_tbl(j) = 'AC'  THEN
504             l_measure_values_tbl(j) := TO_NUMBER(REPLACE(REPLACE(l_ac_values(j), ',',NULL), '%',NULL));
505         ELSIF l_xtd_types_tbl(j) = 'PRP' THEN
506             l_measure_values_tbl(j) := TO_NUMBER(REPLACE(REPLACE(l_prp_values(j),',',NULL), '%',NULL));
507         ELSE
508             l_measure_values_tbl(j) := NULL;
509         END IF;
510 */
511         IF    l_xtd_types_tbl(j) = 'PTD' THEN
512             l_measure_values_tbl(j) := TO_NUMBER(l_ptd_values(j));
513         ELSIF l_xtd_types_tbl(j) = 'QTD' THEN
514             l_measure_values_tbl(j) := TO_NUMBER(l_qtd_values(j));
515         ELSIF l_xtd_types_tbl(j) = 'YTD' THEN
516             l_measure_values_tbl(j) := TO_NUMBER(l_ytd_values(j));
517         ELSIF l_xtd_types_tbl(j) = 'ITD' THEN
518             l_measure_values_tbl(j) := TO_NUMBER(l_itd_values(j));
519         ELSIF l_xtd_types_tbl(j) = 'AC'  THEN
520             l_measure_values_tbl(j) := TO_NUMBER(l_ac_values(j));
521         ELSIF l_xtd_types_tbl(j) = 'PRP' THEN
522             l_measure_values_tbl(j) := TO_NUMBER(l_prp_values(j));
523         ELSE
524             l_measure_values_tbl(j) := NULL;
525         END IF;
526 
527 
528       END LOOP;
529 
530 	  FORALL j IN 1..l_measure_set_codes_tbl.LAST
531         UPDATE pa_perf_temp_obj_measure
532         SET    measure_value = l_measure_values_tbl(j)
533              , period_name   = l_period_name
534         WHERE  ROWID = CHARTOROWID(l_rowids_tbl(j));
535 
536     END IF;
537 
538     -- Initilizing WBS version and WBS element id every time diff project is selected  for bug 4346574
539     l_wbs_version_id:=NULL;
540     l_wbs_element_id:=NULL;
541 
542   END LOOP;
543 
544   IF l_msg_count IS NULL OR l_msg_count = 0 THEN
545       x_msg_count     := 0;
546       x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
547   ELSE
548       x_msg_count     := l_msg_count;
549       x_return_status := l_return_status;
550   END IF;
551 
552   -- ##########################################################
553   --BEGIN
554   --INSERT INTO PA_PERF_TEMP_OBJ_MEASURE_debug SELECT * FROM PA_PERF_TEMP_OBJ_MEASURE;
555   --COMMIT;
556   --END;
557   -- ##########################################################
558 
559   IF UPPER(p_commit_flag) ='Y' THEN
560     COMMIT;
561   END IF;
562 
563 END Compute_Proj_Perf_Exceptions;
564 
565 --Added for Bug 10053784
566 FUNCTION get_formatted_measures(p_number IN VARCHAR2) RETURN VARCHAR2 IS
567      l_formatted_number VARCHAR2(240);
568 BEGIN
569 
570 	 l_formatted_number := to_char(round(p_number,g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));
571 	 return l_formatted_number;
572 end ;
573 
574 FUNCTION Get_Measure_Label(p_measure_code IN VARCHAR2) RETURN VARCHAR2 IS
575 
576   l_measure_label VARCHAR2(240);
577 
578 BEGIN
579 
580 	SELECT NAME INTO l_measure_label
581 	FROM pji_mt_measures_vl
582 	WHERE measure_code = p_measure_code;
583 
584   RETURN l_measure_label;
585 
586 END;
587 
588 
589 
590 PROCEDURE Get_Measure_Labels
591 (
592   p_measure_codes_tbl IN SYSTEM.PA_VARCHAR2_80_TBL_TYPE
593 	, p_measure_labels_tbl OUT NOCOPY SYSTEM.PA_VARCHAR2_240_TBL_TYPE
594 	, x_return_status OUT NOCOPY VARCHAR2
595 	, x_msg_count OUT NOCOPY NUMBER
596 	, x_msg_data OUT NOCOPY VARCHAR2
597 ) IS
598 
599   l_measure_labels_tbl SYSTEM.PA_VARCHAR2_240_TBL_TYPE;
600   l_sql_errm VARCHAR2(255);
601 
602 BEGIN
603   l_measure_labels_tbl := SYSTEM.PA_VARCHAR2_240_TBL_TYPE();
604 	--
605 	-- Check if the array needs processing.
606 	--
607 	IF p_measure_codes_tbl.COUNT > 0 THEN
608 		FOR i IN p_measure_codes_tbl.FIRST..p_measure_codes_tbl.LAST
609 		LOOP
610 			--
611 			-- Extend the array before using it.
612 			--
613 			l_measure_labels_tbl.EXTEND;
614 			--
615 			-- Fetch the translated name for the measure code.
616 			--
617 			BEGIN
618 				SELECT NAME INTO l_measure_labels_tbl(i)
619 				FROM pji_mt_measures_vl
620 				WHERE measure_code = p_measure_codes_tbl(i);
621 			EXCEPTION
622 			WHEN NO_DATA_FOUND THEN
623 				x_return_status := Fnd_Api.G_RET_STS_ERROR;
624         l_sql_errm := SQLERRM();
625         Pji_Rep_Util.Add_Message(
626           p_app_short_name=>'PJI',
627           p_msg_name=> 'PJI_REP_GENERIC_MSG',
628           p_msg_type=>Pji_Rep_Util.G_RET_STS_ERROR,
629           p_token1=>'PROC_NAME',
630           p_token1_value=>'PJI_REP_MEASURE_UTIL.Get_Measure_Labels; No Data Found Error: '
631                                                                    ||l_sql_errm
632         );
633 			WHEN OTHERS THEN
634 				x_return_status := Fnd_Api.G_RET_STS_ERROR;
635         l_sql_errm := SQLERRM();
636         Pji_Rep_Util.Add_Message(
637           p_app_short_name=>'PJI',
638           p_msg_name=> 'PJI_REP_GENERIC_MSG',
639           p_msg_type=>Pji_Rep_Util.G_RET_STS_ERROR,
640           p_token1=>'PROC_NAME',
641           p_token1_value=>'PJI_REP_MEASURE_UTIL.Get_Measure_Labels; SQL Error: '
642                                                                    ||l_sql_errm
643         );
644 			END;
645 		END LOOP;
646 	END IF;
647 	p_measure_labels_tbl:=l_measure_labels_tbl;
648 END Get_Measure_Labels;
649 
650 PROCEDURE Get_Measure_Attributes
651 (
652   p_measure_codes_tbl          IN SYSTEM.PA_VARCHAR2_80_TBL_TYPE
653   , x_measure_set_codes_tbl    OUT NOCOPY SYSTEM.PA_VARCHAR2_30_TBL_TYPE
654   , x_timeslices_tbl   		OUT NOCOPY SYSTEM.PA_VARCHAR2_30_TBL_TYPE
655   , x_measure_id_tbl		OUT NOCOPY  SYSTEM.PA_NUM_TBL_TYPE
656   , x_return_status              OUT NOCOPY VARCHAR2
657   , x_msg_count                  OUT NOCOPY NUMBER
658   , x_msg_data                   OUT NOCOPY VARCHAR2 -- not used
659 )
660 IS
661   l_sql_errm                     VARCHAR2(255);
662 
663 BEGIN
664   IF g_debug_mode = 'Y' THEN
665 	  Pji_Utils.WRITE2LOG('entering get_financial_measures',TRUE, g_msg_level_runtime_info);
666   END IF;
667 
668 	IF x_return_status IS NULL THEN
669 		x_msg_count := 0;
670 		x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
671 	END IF;
672 
673   x_measure_set_codes_tbl        := SYSTEM.PA_VARCHAR2_30_TBL_TYPE();
674   x_timeslices_tbl              := SYSTEM.PA_VARCHAR2_30_TBL_TYPE();
675   x_measure_id_tbl			:= SYSTEM.PA_NUM_TBL_TYPE();
676 
677 
678   x_measure_set_codes_tbl.extend(p_measure_codes_tbl.LAST);
679   x_timeslices_tbl.extend(p_measure_codes_tbl.LAST);
680   x_measure_id_tbl.extend(p_measure_codes_tbl.LAST);
681 
682   FOR i IN 1..p_measure_codes_tbl.LAST  LOOP
683 
684     -- alternative strategy for the SQL statement below:
685     --   l_measure_set_code(i) := SUBSTR(p_measure_codes_tbl(i), 1, LENGTH(p_measure_codes_tbl(i)));
686     --   l_timeslices(i) := SUBSTR(p_measure_codes_tbl(i), -3, 3);
687     BEGIN
688 
689       SELECT
690         measure_set_code
691       , xtd_type
692 	  , measure_id
693       INTO
694          x_measure_set_codes_tbl(i)
695         ,x_timeslices_tbl(i)
696 		,x_measure_id_tbl(i)
697       FROM PJI_MT_MEASURES_B
698       WHERE measure_code = p_measure_codes_tbl(i);
699 
700     EXCEPTION
701       WHEN NO_DATA_FOUND THEN
702         x_return_status := Fnd_Api.G_RET_STS_ERROR;
703 		x_msg_count := x_msg_count + 1;
704         Pji_Rep_Util.Add_Message(
705           p_app_short_name=> 'PJI',
706           p_msg_name=> 'PJI_REP_UNDEFINED_MSR_CODE',
707           p_msg_type=>Pji_Rep_Util.G_RET_STS_ERROR);
708       WHEN TOO_MANY_ROWS THEN
709         x_return_status := Fnd_Api.G_RET_STS_ERROR;
710 		x_msg_count := x_msg_count + 1;
711         Pji_Rep_Util.Add_Message(
712           p_app_short_name=> 'PJI',
713           p_msg_name=> 'PJI_REP_DUPLICATED_MSR_CODE',
714           p_msg_type=>Pji_Rep_Util.G_RET_STS_ERROR);
715       WHEN OTHERS THEN
716         x_return_status := Fnd_Api.G_RET_STS_ERROR;
717         l_sql_errm := SQLERRM();
718 		x_msg_count := x_msg_count + 1;
719         Pji_Rep_Util.Add_Message(
720           p_app_short_name=> 'PJI',
721           p_msg_name=> 'PJI_REP_GENERIC_MSG',
722           p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
723           p_token1=>'PROC_NAME',
724           p_token1_value=>'PJI_REP_MEASURE_UTIL.Get_Financial_Measures; ' ||
725             'SQL Error: ' || l_sql_errm
726         );
727 
728     END;
729 
730   END LOOP;
731 
732   IF g_debug_mode = 'Y' THEN
733 	  Pji_Utils.WRITE2LOG('leaving get_measure_attributes',TRUE, g_msg_level_runtime_info);
734   END IF;
735 
736 END Get_Measure_Attributes;
737 
738 PROCEDURE Get_Financial_Measures
739 (
740   p_project_id                   NUMBER
741   , p_measure_codes_tbl          IN SYSTEM.PA_VARCHAR2_80_TBL_TYPE
742   , p_measure_set_codes_tbl          IN SYSTEM.PA_VARCHAR2_30_TBL_TYPE DEFAULT NULL
743   , p_timeslices_tbl   				 IN SYSTEM.PA_VARCHAR2_30_TBL_TYPE DEFAULT NULL
744   , p_measure_id_tbl		 		 IN SYSTEM.PA_NUM_TBL_TYPE DEFAULT NULL
745   , x_measure_values_tbl         OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
746   , x_exception_indicator_tbl OUT NOCOPY SYSTEM.PA_VARCHAR2_2000_TBL_TYPE
747   --, x_exception_labels_tbl       OUT NOCOPY SYSTEM.PA_VARCHAR2_240_TBL_TYPE
748   , x_return_status              OUT NOCOPY VARCHAR2
749   , x_msg_count                  OUT NOCOPY NUMBER
750   , x_msg_data                   OUT NOCOPY VARCHAR2 -- not used
751 )
752 IS
753 
754   l_Return_Status                VARCHAR2(255);
755   l_Msg_Count                    NUMBER;
756   l_Msg_Data                     VARCHAR2(255);
757   l_DaysSinceITD                 NUMBER;
758   l_DaysInPeriod                 NUMBER;
759   i                              NUMBER;
760   l_measure_set_codes_tbl             SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
761   l_timeslices_tbl                   SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
762   l_measure_type                 SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
763   l_ptd_values                   SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
764   l_qtd_values                   SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
765   l_ytd_values                   SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
766   l_itd_values                   SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
767   l_ac_values                    SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
768   l_prp_values                   SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
769   l_ptd_html                     SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
770   l_qtd_html                     SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
771   l_ytd_html                     SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
772   l_itd_html                     SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
773   l_ac_html                      SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
774   l_prp_html                     SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
775   l_ptd_trans_id	     		 SYSTEM.PA_NUM_TBL_TYPE;
776   l_ytd_trans_id	     		 SYSTEM.PA_NUM_TBL_TYPE;
777   l_qtd_trans_id	     		 SYSTEM.PA_NUM_TBL_TYPE;
778   l_itd_trans_id	     		 SYSTEM.PA_NUM_TBL_TYPE;
779   l_ac_trans_id	     	 		 SYSTEM.PA_NUM_TBL_TYPE;
780   l_prp_trans_id	     		 SYSTEM.PA_NUM_TBL_TYPE;
781   l_ptd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
782   l_ytd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
783   l_qtd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
784   l_itd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
785   l_ac_meaning       SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
786   l_prp_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
787   l_WBS_Version_ID               NUMBER;
788   l_WBS_Element_Id               NUMBER;
789   l_RBS_Version_ID               NUMBER;
790   l_RBS_Element_Id               NUMBER;
791   l_calendar_id                  NUMBER;
792   l_calendar_type                VARCHAR2(1);
793   l_report_date_julian           NUMBER ;
794   l_period_name                  VARCHAR2(255);
795   l_actual_version_id            NUMBER;
796   l_cstforecast_version_id       NUMBER;
797   l_cstbudget_version_id         NUMBER;
798   l_cstbudget2_version_id        NUMBER;
799   l_revforecast_version_id       NUMBER;
800   l_revbudget_version_id         NUMBER;
801   l_revbudget2_version_id        NUMBER;
802   l_orig_cstforecast_version_id  NUMBER;
803   l_orig_cstbudget_version_id    NUMBER;
804   l_orig_cstbudget2_version_id   NUMBER;
805   l_orig_revforecast_version_id  NUMBER;
806   l_orig_revbudget_version_id    NUMBER;
807   l_orig_revbudget2_version_id   NUMBER;
808   l_prior_cstforecast_version_id NUMBER;
809   l_prior_revforecast_version_id NUMBER;
810   l_actual_plantype_id           NUMBER;
811   l_cstforecast_plantype_id      NUMBER;
812   l_cstbudget_plantype_id        NUMBER;
813   l_cstbudget2_plantype_id       NUMBER;
814   l_revforecast_plantype_id      NUMBER;
815   l_revbudget_plantype_id        NUMBER;
816   l_revbudget2_plantype_id       NUMBER;
817   l_currency_record_type         NUMBER;
818   l_Currency_Code                VARCHAR2(255);
819   l_factor_by                    NUMBER;
820   l_effort_uom                   NUMBER;
821   l_currency_type                VARCHAR2(255);
822   l_time_slice                   NUMBER;
823   l_prg_rollup                   VARCHAR2(1);
824   l_report_type                  VARCHAR2(255);
825   l_sql_errm                     VARCHAR2(255);
826   l_tmp_measure_code             VARCHAR2(255);
827   l_tmp_measure_set_code         VARCHAR2(255);
828   l_tmp_xtd_type                 VARCHAR2(255);
829   l_effective_i                  NUMBER;
830   l_slice_name					 VARCHAR2(80);
831 
832   l_plan_version_ids	     	 SYSTEM.PA_NUM_TBL_TYPE;
833   l_i NUMBER;
834 
835  -- Add by Ning, besides passing the measure_set_code, also pass the measure_ids
836   l_measure_id_tbl		 		 SYSTEM.PA_NUM_TBL_TYPE;
837 BEGIN
838 	NULL;
839 
840   IF g_debug_mode = 'Y' THEN
841 	  Pji_Utils.WRITE2LOG('entering get_measure_attributes',TRUE, g_msg_level_runtime_info);
842   END IF;
843 
844 	x_msg_count := 0;
845 	x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
846 
847 
848   l_measure_set_codes_tbl        := SYSTEM.PA_VARCHAR2_30_TBL_TYPE();
849   l_timeslices_tbl              := SYSTEM.PA_VARCHAR2_30_TBL_TYPE();
850   x_measure_values_tbl      := SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
851   x_exception_indicator_tbl := SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
852   l_measure_id_tbl			:= SYSTEM.PA_NUM_TBL_TYPE();
853   --x_exception_labels_tbl    := SYSTEM.PA_VARCHAR2_240_TBL_TYPE();
854 
855   IF p_measure_codes_tbl.LAST < 1 THEN
856     x_measure_values_tbl := NULL;
857     x_exception_indicator_tbl := NULL;
858     RETURN;
859   END IF;
860 
861 
862   IF p_measure_set_codes_tbl.COUNT>0 THEN     -- Bug 8810949
863 	  l_measure_set_codes_tbl := p_measure_set_codes_tbl;
864 	  l_timeslices_tbl := p_timeslices_tbl;
865 	  l_measure_id_tbl := p_measure_id_tbl;
866   ELSE
867 	  l_measure_set_codes_tbl.extend(p_measure_codes_tbl.LAST);
868 	  l_timeslices_tbl.extend(p_measure_codes_tbl.LAST);
869 	  l_measure_id_tbl.extend(p_measure_codes_tbl.LAST);
870 	  -- obtain measure set name and timeslice (PTD, ITD, AC....) related to the input measures
871 	  FOR i IN 1..p_measure_codes_tbl.LAST  LOOP
872 
873 	    -- alternative strategy for the SQL statement below:
874 	    --   l_measure_set_code(i) := SUBSTR(p_measure_codes_tbl(i), 1, LENGTH(p_measure_codes_tbl(i)));
875 	    --   l_timeslices(i) := SUBSTR(p_measure_codes_tbl(i), -3, 3);
876 	    BEGIN
877 
878 	      SELECT
879 	        measure_set_code
880 	      , xtd_type
881 		  , measure_id
882 	      INTO
883 	         l_measure_set_codes_tbl(i)
884 	        ,l_timeslices_tbl(i)
885 			,l_measure_id_tbl(i)
886 	      FROM PJI_MT_MEASURES_B
887 	      WHERE measure_code = p_measure_codes_tbl(i);
888 
889 	    EXCEPTION
890 	      WHEN NO_DATA_FOUND THEN
891 	        x_return_status := Fnd_Api.G_RET_STS_ERROR;
892 	        Pji_Rep_Util.Add_Message(
893 	          p_app_short_name=> 'PJI',
894 	          p_msg_name=> 'PJI_REP_UNDEFINED_MSR_CODE',
895 	          p_msg_type=>Pji_Rep_Util.G_RET_STS_ERROR);
896 	      WHEN TOO_MANY_ROWS THEN
897 	        x_return_status := Fnd_Api.G_RET_STS_ERROR;
898 	        Pji_Rep_Util.Add_Message(
899 	          p_app_short_name=> 'PJI',
900 	          p_msg_name=> 'PJI_REP_DUPLICATED_MSR_CODE',
901 	          p_msg_type=>Pji_Rep_Util.G_RET_STS_ERROR);
902 	      WHEN OTHERS THEN
903 	        l_sql_errm := SQLERRM();
904 	        Pji_Rep_Util.Add_Message(
905 	          p_app_short_name=> 'PJI',
906 	          p_msg_name=> 'PJI_REP_GENERIC_MSG',
907 	          p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
908 	          p_token1=>'PROC_NAME',
909 	          p_token1_value=>'PJI_REP_MEASURE_UTIL.Get_Financial_Measures; ' ||
910 	            'SQL Error: ' || l_sql_errm
911 	        );
912 
913 	    END;
914 
915 	  END LOOP;
916   END IF;
917   --
918   -- derive default values parameters for measure retrieval
919   --
920 
921   Pji_Rep_Util.Derive_Default_Calendar_Info(p_project_id, l_calendar_type, l_calendar_id,
922   l_period_name, l_report_date_julian, l_slice_name
923       , l_return_status, l_msg_count, l_msg_data);
924 
925   Pji_Rep_Util.Derive_Default_Plan_Versions(p_project_id
926       , l_actual_version_id
927       , l_cstforecast_version_id
928       , l_cstbudget_version_id
929       , l_cstbudget2_version_id
930       , l_revforecast_version_id
931       , l_revbudget_version_id
932       , l_revbudget2_version_id
933       , l_orig_cstforecast_version_id
934       , l_orig_cstbudget_version_id
935       , l_orig_cstbudget2_version_id
936       , l_orig_revforecast_version_id
937       , l_orig_revbudget_version_id
938       , l_orig_revbudget2_version_id
939       , l_prior_cstforecast_version_id
940       , l_prior_revforecast_version_id
941       , l_return_status, l_msg_count, l_msg_data);
942 
943   Pji_Rep_Util.Derive_Default_Currency_Info(p_project_id
944       , l_currency_record_type, l_currency_code, l_currency_type
945       , l_return_status, l_msg_count, l_msg_data);
946 
947   --bug 4355820, only compute project amount for project list
948   l_prg_rollup := 'N'; --Pji_Rep_Util.Derive_Prg_Rollup_Flag(p_project_id);
949 
950 
951 	l_plan_version_ids := SYSTEM.PA_NUM_TBL_TYPE(
952        l_actual_version_id
953       , l_cstforecast_version_id
954       , l_cstbudget_version_id
955       , l_cstbudget2_version_id
956       , l_revforecast_version_id
957       , l_revbudget_version_id
958       , l_revbudget2_version_id
959       , l_orig_cstbudget_version_id
960       , l_orig_cstbudget2_version_id
961       , l_orig_revbudget_version_id
962       , l_orig_revbudget2_version_id
963       , l_prior_cstforecast_version_id
964       , l_prior_revforecast_version_id);
965 
966 		l_i := 1;
967 		WHILE l_i <= l_plan_version_ids.COUNT AND l_wbs_version_id IS NULL LOOP
968 			IF l_plan_version_ids(l_i) IS NOT NULL THEN
969 		      Pji_Rep_Util.Derive_Default_WBS_Parameters(p_project_id
970 		          , l_plan_version_ids(l_i)
971 		          , l_WBS_Version_ID, l_WBS_Element_Id
972 		          , l_return_status, l_msg_count, l_msg_data);
973 			END IF;
974 		  l_i := l_i+1;
975 		END LOOP;
976 
977 
978   l_Factor_By := Pji_Rep_Util.Derive_Factorby(p_project_id, l_cstbudget_version_id, l_return_status, l_msg_count, l_Msg_Data);
979   l_Effort_UOM := Pji_Rep_Util.get_effort_uom(p_project_id);
980 
981   l_time_slice  := 1376;
982   l_report_type := 'TS';  -- prfTaskResFlag
983 
984   -- derive plan types
985   get_plan_type_info( p_project_id, l_actual_version_id,
986       l_cstforecast_version_id, l_cstbudget_version_id, l_cstbudget2_version_id,
987       l_revforecast_version_id, l_revbudget_version_id, l_revbudget2_version_id,
988       l_orig_cstforecast_version_id, l_orig_cstbudget_version_id, l_orig_cstbudget2_version_id,
989       l_orig_revforecast_version_id, l_orig_revbudget_version_id, l_orig_revbudget2_version_id,
990       l_actual_plantype_id,
991       l_cstforecast_plantype_id, l_cstbudget_plantype_id, l_cstbudget2_plantype_id,
992       l_revforecast_plantype_id, l_revbudget_plantype_id, l_revbudget2_plantype_id,
993       l_Return_Status, l_Msg_Count, l_Msg_Data);
994 
995   -- retrieve data related to the wanted measures sets, using default parameters
996   retrieveData(p_Project_Id,  l_WBS_Version_ID, l_WBS_Element_Id, -1, -1,
997       l_calendar_id, l_calendar_type,  l_report_date_julian,
998       l_actual_version_id,
999       l_cstforecast_version_id, l_cstbudget_version_id, l_cstbudget2_version_id,
1000       l_revforecast_version_id, l_revbudget_version_id, l_revbudget2_version_id,
1001       l_orig_cstforecast_version_id, l_orig_cstbudget_version_id, l_orig_cstbudget2_version_id,
1002       l_orig_revforecast_version_id, l_orig_revbudget_version_id, l_orig_revbudget2_version_id,
1003       l_prior_cstforecast_version_id, l_prior_revforecast_version_id,
1004       l_actual_plantype_id,
1005       l_cstforecast_plantype_id, l_cstbudget_plantype_id, l_cstbudget2_plantype_id,
1006       l_revforecast_plantype_id, l_revbudget_plantype_id, l_revbudget2_plantype_id,
1007       l_currency_record_type, l_Currency_Code, l_factor_by, l_effort_uom,
1008       l_currency_type, l_time_slice, l_prg_rollup, l_report_type,
1009 	  l_period_name,
1010       l_measure_set_codes_tbl,
1011 	  'Y', 'Y', 'Y',
1012 	  g_ProjList, l_measure_id_tbl,x_exception_indicator_tbl,
1013 	  l_measure_type,
1014       l_ptd_values, l_qtd_values, l_ytd_values, l_itd_values, l_ac_values, l_prp_values,
1015       l_ptd_html, l_qtd_html, l_ytd_html, l_itd_html, l_ac_html, l_prp_html,
1016 	  l_ptd_trans_id, l_qtd_trans_id, l_ytd_trans_id, l_itd_trans_id, l_ac_trans_id, l_prp_trans_id,
1017 	  l_ptd_meaning, l_qtd_meaning, l_ytd_meaning, l_itd_meaning, l_ac_meaning, l_prp_meaning,
1018       l_DaysSinceITD, l_DaysInPeriod, l_Return_Status, l_Msg_Count, l_Msg_Data);
1019 
1020 
1021   x_measure_values_tbl.EXTEND(l_measure_set_codes_tbl.LAST);
1022   --Bug 5088377 Initialize the collection before extending
1023   IF (x_exception_indicator_tbl is NULL) THEN
1024       x_exception_indicator_tbl := SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
1025   END IF;
1026   x_exception_indicator_tbl.EXTEND(l_measure_set_codes_tbl.LAST);
1027   --x_exception_labels_tbl.EXTEND(l_measure_set_code.LAST);
1028 
1029   -- build x_measure_values_tbl and x_exception_indicator_tbl collections.
1030   -- NB: l_***_values arrays have, as per their contruction, the same length as
1031   -- x_measure_values_tbl, who has the same length as l_measure_set_code array.
1032   FOR i IN 1..x_measure_values_tbl.LAST
1033       LOOP
1034       IF l_timeslices_tbl(i) = 'PTD' THEN
1035           x_measure_values_tbl(i) := l_ptd_values(i);
1036 --          x_exception_indicator_tbl(i) := l_ptd_html(i);
1037       ELSIF l_timeslices_tbl(i) = 'QTD' THEN
1038           x_measure_values_tbl(i) := l_qtd_values(i);
1039 --          x_exception_indicator_tbl(i) := l_qtd_html(i);
1040       ELSIF l_timeslices_tbl(i) = 'YTD' THEN
1041           x_measure_values_tbl(i) := l_ytd_values(i);
1042 --          x_exception_indicator_tbl(i) := l_ytd_html(i);
1043       ELSIF l_timeslices_tbl(i) = 'ITD' THEN
1044           x_measure_values_tbl(i) := l_itd_values(i);
1045 --          x_exception_indicator_tbl(i) := l_itd_html(i);
1046       ELSIF l_timeslices_tbl(i) = 'AC' THEN
1047           x_measure_values_tbl(i) := l_ac_values(i);
1048 --          x_exception_indicator_tbl(i) := l_ac_html(i);
1049       ELSIF l_timeslices_tbl(i) = 'PRP' THEN
1050           x_measure_values_tbl(i) := l_prp_values(i);
1051 --          x_exception_indicator_tbl(i) := l_prp_html(i);
1052       ELSE
1053           x_measure_values_tbl(i) := NULL;
1054 --          x_exception_indicator_tbl(i) := NULL;
1055       END IF;
1056 
1057   END LOOP;
1058 
1059   IF l_msg_count IS NULL OR l_msg_count = 0 THEN
1060       x_msg_count  := 0;
1061       x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
1062   ELSE
1063       x_msg_count := l_msg_count;
1064       x_return_status := l_return_status;
1065   END IF;
1066 
1067   IF g_debug_mode = 'Y' THEN
1068 	  Pji_Utils.WRITE2LOG('leaving get_financial_measures',TRUE, g_msg_level_runtime_info);
1069   END IF;
1070 
1071 END Get_Financial_Measures;
1072 
1073 
1074 
1075 --
1076 -- This implementation calls get_financial_measures().
1077 --
1078 PROCEDURE Get_Activity_Measures
1079 (
1080     p_project_id                NUMBER
1081     , p_measure_codes_tbl       IN SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1082   , p_measure_set_codes_tbl          IN SYSTEM.PA_VARCHAR2_30_TBL_TYPE DEFAULT NULL
1083   , p_timeslices_tbl   				 IN SYSTEM.PA_VARCHAR2_30_TBL_TYPE DEFAULT NULL
1084   , p_measure_id_tbl		 		 IN SYSTEM.PA_NUM_TBL_TYPE DEFAULT NULL
1085     , x_measure_values_tbl      OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1086     , x_exception_indicator_tbl OUT NOCOPY SYSTEM.PA_VARCHAR2_2000_TBL_TYPE
1087     --, x_exception_labels_tbl    OUT NOCOPY SYSTEM.PA_VARCHAR2_240_TBL_TYPE
1088     , x_return_status           OUT NOCOPY VARCHAR2
1089     , x_msg_count               OUT NOCOPY NUMBER
1090     , x_msg_data                OUT NOCOPY VARCHAR2
1091 ) IS
1092 BEGIN
1093   NULL;
1094 
1095   Get_Financial_Measures(p_project_id
1096     , p_measure_codes_tbl
1097 	, p_measure_set_codes_tbl
1098 	, p_timeslices_tbl
1099 	, p_measure_id_tbl
1100     , x_measure_values_tbl
1101     , x_exception_indicator_tbl
1102     , x_return_status
1103     , x_msg_count
1104     , x_msg_data);
1105 
1106 END Get_Activity_Measures;
1107 
1108 
1109 
1110 /**
1111  ** For a given Project_id and a set of Currenct plan versions,
1112  ** this API extracts their relative
1113  ** Original plan versions IDs and plan types IDs.
1114  **
1115  ** History
1116  **   21-APR-2004   EPASQUIN    Created
1117  **   28-APR-2004   EPASQUIN    Added NO_DATA_FOUND exception handl3rs.
1118  **/
1119 PROCEDURE get_plan_type_info
1120 (
1121     p_project_id               NUMBER
1122   , pActualVersionId	         NUMBER
1123   , pCstForecastVersionId	     NUMBER
1124   , pCstBudgetVersionId	       NUMBER
1125   , pCstBudget2VersionId	     NUMBER
1126   , pRevForecastVersionId 	   NUMBER
1127   , pRevBudgetVersionId	       NUMBER
1128   , pRevBudget2VersionId	     NUMBER
1129   , xOrigCstForecastVersionId  OUT NOCOPY NUMBER
1130   , xOrigCstBudgetVersionId    OUT NOCOPY NUMBER
1131   , xOrigCstBudget2VersionId   OUT NOCOPY NUMBER
1132   , xOrigRevForecastVersionId  OUT NOCOPY NUMBER
1133   , xOrigRevBudgetVersionId    OUT NOCOPY NUMBER
1134   , xOrigRevBudget2VersionId   OUT NOCOPY NUMBER
1135   , xActualPlanTypeId	         OUT NOCOPY NUMBER
1136   , xCstForecastPlanTypeId     OUT NOCOPY NUMBER
1137   , xCstBudgetPlanTypeId	     OUT NOCOPY NUMBER
1138   , xCstBudget2PlanTypeId	     OUT NOCOPY NUMBER
1139   , xRevForecastPlanTypeId     OUT NOCOPY NUMBER
1140   , xRevBudgetPlanTypeId	     OUT NOCOPY NUMBER
1141   , xRevBudget2PlanTypeId	     OUT NOCOPY NUMBER
1142   , x_return_status            OUT NOCOPY VARCHAR2
1143   , x_msg_count                OUT NOCOPY NUMBER
1144   , x_msg_data                 OUT NOCOPY VARCHAR2
1145 )
1146 
1147 IS
1148 
1149   l_sql_errm VARCHAR2(255);
1150 
1151 BEGIN
1152 
1153   x_msg_count := 0;
1154   x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
1155 
1156   xActualPlanTypeId := -1;
1157 
1158   -- Cost Forecast
1159   BEGIN
1160       SELECT
1161       pbv.fin_plan_type_id         curr_plan_type
1162       ,orig_pbv.budget_version_id  orig_plan_version
1163       INTO
1164       xCstForecastPlanTypeId
1165       ,xOrigCstForecastVersionId
1166       FROM
1167       pa_budget_versions     pbv
1168       , pa_budget_versions   orig_pbv
1169       , pa_fin_plan_types_b  orig_pfptb
1170      -- , pa_fin_plan_types_tl orig_pfptt
1171       WHERE 1=1
1172       AND pbv.budget_version_id = pCstForecastVersionId
1173       AND pbv.fin_plan_type_id  = orig_pbv.fin_plan_type_id
1174       AND orig_pbv.project_id = p_project_id
1175       AND orig_pbv.budget_status_code = 'B'
1176       AND orig_pbv.current_original_flag = 'Y'
1177       AND orig_pbv.version_type IN ('COST','ALL')
1178       AND orig_pbv.fin_plan_type_id = orig_pfptb.fin_plan_type_id
1179      -- AND orig_pfptb.fin_plan_type_id = orig_pfptt.fin_plan_type_id
1180       AND orig_pfptb.plan_class_code IN ('FORECAST')
1181      -- AND orig_pfptt.LANGUAGE = USERENV('LANG')
1182       ;
1183   EXCEPTION
1184       WHEN NO_DATA_FOUND THEN
1185           xCstForecastPlanTypeId    := NULL;
1186           xOrigCstForecastVersionId := NULL;
1187       WHEN OTHERS THEN
1188         l_sql_errm := SQLERRM();
1189         Pji_Rep_Util.Add_Message(
1190           p_app_short_name=>'PJI',
1191           p_msg_name=>'PJI_REP_GENERIC_MSG',
1192           p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
1193           p_token1=>'PROC_NAME',
1194           p_token1_value=>'PJI_REP_MEASURE_UTIL.get_plan_type_info: ' ||
1195             'SQL Error during Cost Forecast query : ' || l_sql_errm
1196         );
1197 
1198   END;
1199 
1200   -- Cost Budget
1201   BEGIN
1202       SELECT
1203       pbv.fin_plan_type_id         curr_plan_type
1204       ,orig_pbv.budget_version_id  orig_plan_version
1205       INTO
1206       xCstBudgetPlanTypeId
1207       ,xOrigCstBudgetVersionId
1208       FROM
1209       pa_budget_versions     pbv
1210       , pa_budget_versions   orig_pbv
1211       , pa_fin_plan_types_b  orig_pfptb
1212       --, pa_fin_plan_types_tl orig_pfptt
1213       WHERE 1=1
1214       AND pbv.budget_version_id = pCstBudgetVersionId
1215       AND pbv.fin_plan_type_id  = orig_pbv.fin_plan_type_id
1216       AND orig_pbv.project_id = p_project_id
1217       AND orig_pbv.budget_status_code = 'B'
1218       AND orig_pbv.current_original_flag = 'Y'
1219       AND orig_pbv.version_type IN ('COST','ALL')
1220       AND orig_pbv.fin_plan_type_id = orig_pfptb.fin_plan_type_id
1221      -- AND orig_pfptb.fin_plan_type_id = orig_pfptt.fin_plan_type_id
1222       AND orig_pfptb.plan_class_code IN ('BUDGET')
1223       --AND orig_pfptt.LANGUAGE = USERENV('LANG')
1224       ;
1225   EXCEPTION
1226       WHEN NO_DATA_FOUND THEN
1227           xCstBudgetPlanTypeId    := NULL;
1228           xOrigCstBudgetVersionId := NULL;
1229       WHEN OTHERS THEN
1230         l_sql_errm := SQLERRM();
1231         Pji_Rep_Util.Add_Message(p_app_short_name=>'PJI',
1232             p_msg_name=>'PJI_REP_GENERIC_MSG',
1233             p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
1234             p_token1=>'PROC_NAME',
1235             p_token1_value=>'PJI_REP_MEASURE_UTIL.get_plan_type_info: ' ||
1236               'SQL Error during Cost Budget query: ' || l_sql_errm
1237         );
1238   END;
1239 
1240   -- Cost Budget 2
1241   BEGIN
1242   	SELECT
1243       pbv.fin_plan_type_id         curr_plan_type
1244       ,orig_pbv.budget_version_id  orig_plan_version
1245       INTO
1246       xCstBudget2PlanTypeId
1247       ,xOrigCstBudget2VersionId
1248       FROM
1249       pa_budget_versions     pbv
1250       , pa_budget_versions   orig_pbv
1251       , pa_fin_plan_types_b  orig_pfptb
1252       --, pa_fin_plan_types_tl orig_pfptt
1253       WHERE 1=1
1254       AND pbv.budget_version_id = pCstBudget2VersionId
1255       AND pbv.fin_plan_type_id  = orig_pbv.fin_plan_type_id
1256       AND orig_pbv.project_id = p_project_id
1257       AND orig_pbv.budget_status_code = 'B'
1258       AND orig_pbv.current_original_flag = 'Y'
1259       AND orig_pbv.version_type IN ('COST','ALL')
1260       AND orig_pbv.fin_plan_type_id = orig_pfptb.fin_plan_type_id
1261      -- AND orig_pfptb.fin_plan_type_id = orig_pfptt.fin_plan_type_id
1262       AND orig_pfptb.plan_class_code IN ('BUDGET')
1263       --AND orig_pfptt.LANGUAGE = USERENV('LANG')
1264       ;
1265   EXCEPTION
1266       WHEN NO_DATA_FOUND THEN
1267           xCstBudget2PlanTypeId    := NULL;
1268           xOrigCstBudget2VersionId := NULL;
1269       WHEN OTHERS THEN
1270         l_sql_errm := SQLERRM();
1271         Pji_Rep_Util.Add_Message(
1272           p_app_short_name=>'PJI',
1273           p_msg_name=>'PJI_REP_GENERIC_MSG',
1274           p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
1275           p_token1=>'PROC_NAME',
1276           p_token1_value=>'PJI_REP_MEASURE_UTIL.get_plan_type_info: '||
1277             'SQL Error during Cost Budget 2 query: ' || l_sql_errm
1278         );
1279   END;
1280 
1281   -- Revenue Forecast
1282   BEGIN
1283       SELECT
1284       pbv.fin_plan_type_id         curr_plan_type
1285       ,orig_pbv.budget_version_id  orig_plan_version
1286       INTO
1287       xRevForecastPlanTypeId
1288       ,xOrigRevForecastVersionId
1289       FROM
1290       pa_budget_versions     pbv
1291       , pa_budget_versions   orig_pbv
1292       , pa_fin_plan_types_b  orig_pfptb
1293      -- , pa_fin_plan_types_tl orig_pfptt
1294       WHERE 1=1
1295       AND pbv.budget_version_id = pRevForecastVersionId
1296       AND pbv.fin_plan_type_id  = orig_pbv.fin_plan_type_id
1297       AND orig_pbv.project_id = p_project_id
1298       AND orig_pbv.budget_status_code = 'B'
1299       AND orig_pbv.current_original_flag = 'Y'
1300       AND orig_pbv.version_type IN ('REVENUE','ALL')
1301       AND orig_pbv.fin_plan_type_id = orig_pfptb.fin_plan_type_id
1302     --  AND orig_pfptb.fin_plan_type_id = orig_pfptt.fin_plan_type_id
1303       AND orig_pfptb.plan_class_code IN ('FORECAST')
1304      -- AND orig_pfptt.LANGUAGE = USERENV('LANG')
1305       ;
1306   EXCEPTION
1307       WHEN NO_DATA_FOUND THEN
1308           xRevForecastPlanTypeId    := NULL;
1309           xOrigRevForecastVersionId := NULL;
1310       WHEN OTHERS THEN
1311         l_sql_errm := SQLERRM();
1312         Pji_Rep_Util.Add_Message(
1313           p_app_short_name=>'PJI',
1314           p_msg_name=>'PJI_REP_GENERIC_MSG',
1315           p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
1316           p_token1=>'PROC_NAME',
1317           p_token1_value=>'PJI_REP_MEASURE_UTIL.get_plan_type_info: ' ||
1318             'SQL Error during Revenue Forecast query: '|| l_sql_errm
1319         );
1320   END;
1321 
1322   -- Revenue Budget
1323   BEGIN
1324       SELECT
1325       pbv.fin_plan_type_id         curr_plan_type
1326       ,orig_pbv.budget_version_id  orig_plan_version
1327       INTO
1328       xRevBudgetPlanTypeId
1329       ,xOrigRevBudgetVersionId
1330       FROM
1331       pa_budget_versions     pbv
1332       , pa_budget_versions   orig_pbv
1333       , pa_fin_plan_types_b  orig_pfptb
1334       --, pa_fin_plan_types_tl orig_pfptt
1335       WHERE 1=1
1336       AND pbv.budget_version_id = pRevBudgetVersionId
1337       AND pbv.fin_plan_type_id  = orig_pbv.fin_plan_type_id
1338       AND orig_pbv.project_id = p_project_id
1339       AND orig_pbv.budget_status_code = 'B'
1340       AND orig_pbv.current_original_flag = 'Y'
1341       AND orig_pbv.version_type IN ('REVENUE','ALL')
1342       AND orig_pbv.fin_plan_type_id = orig_pfptb.fin_plan_type_id
1343      -- AND orig_pfptb.fin_plan_type_id = orig_pfptt.fin_plan_type_id
1344       AND orig_pfptb.plan_class_code IN ('BUDGET')
1345      -- AND orig_pfptt.LANGUAGE = USERENV('LANG')
1346       ;
1347   EXCEPTION
1348       WHEN NO_DATA_FOUND THEN
1349           xRevBudgetPlanTypeId    := NULL;
1350           xOrigRevBudgetVersionId := NULL;
1351       WHEN OTHERS THEN
1352         l_sql_errm := SQLERRM();
1353         Pji_Rep_Util.Add_Message(p_app_short_name=>'PJI',
1354           p_msg_name=>'PJI_REP_GENERIC_MSG',
1355           p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
1356           p_token1=>'PROC_NAME',
1357           p_token1_value=>'PJI_REP_MEASURE_UTIL.get_plan_type_info: ' ||
1358             'SQL Error during Revenue Budget query: ' || l_sql_errm
1359         );
1360   END;
1361 
1362   -- Revenue Budget 2
1363   BEGIN
1364   	SELECT
1365       pbv.fin_plan_type_id         curr_plan_type
1366       ,orig_pbv.budget_version_id  orig_plan_version
1367       INTO
1368       xRevBudget2PlanTypeId
1369       ,xOrigRevBudget2VersionId
1370       FROM
1371       pa_budget_versions     pbv
1372       , pa_budget_versions   orig_pbv
1373       , pa_fin_plan_types_b  orig_pfptb
1374      -- , pa_fin_plan_types_tl orig_pfptt
1375       WHERE 1=1
1376       AND pbv.budget_version_id = pRevBudget2VersionId
1377       AND pbv.fin_plan_type_id  = orig_pbv.fin_plan_type_id
1378       AND orig_pbv.project_id = p_project_id
1379       AND orig_pbv.budget_status_code = 'B'
1380       AND orig_pbv.current_original_flag = 'Y'
1381       AND orig_pbv.version_type IN ('REVENUE','ALL')
1382       AND orig_pbv.fin_plan_type_id = orig_pfptb.fin_plan_type_id
1383     --  AND orig_pfptb.fin_plan_type_id = orig_pfptt.fin_plan_type_id
1384       AND orig_pfptb.plan_class_code IN ('BUDGET')
1385      -- AND orig_pfptt.LANGUAGE = USERENV('LANG')
1386       ;
1387   EXCEPTION
1388       WHEN NO_DATA_FOUND THEN
1389           xRevBudget2PlanTypeId    := NULL;
1390           xOrigRevBudget2VersionId := NULL;
1391       WHEN OTHERS THEN
1392         l_sql_errm := SQLERRM();
1393         Pji_Rep_Util.Add_Message(p_app_short_name=>'PJI',
1394           p_msg_name=>'PJI_REP_GENERIC_MSG',
1395           p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
1396           p_token1=>'PROC_NAME',
1397           p_token1_value=>'PJI_REP_MEASURE_UTIL.get_plan_type_info: ' ||
1398             'SQL Error during Revenue Budget 2 query: ' || l_sql_errm
1399         );
1400   END;
1401 
1402 END get_plan_type_info;
1403 
1404 
1405 
1406 /**
1407  ** This API prepares, calculates, retrieves the measures to be used by
1408  ** Overview Page and breakdown pages. The measures are stored on the
1409  ** temporary table PJI_REP_XTD_MEASURES_TMP.
1410  **
1411  ** Return: xDaysSinceITD = number of days since Inception to Date
1412  ** Return: xDaysInPeriod = number of days in current period
1413  **
1414  ** History
1415  **   16-MAR-2004   EPASQUIN    Created
1416  **   21-APR-2004   EPASQUIN    Introduced Plan_types parameters
1417  **/
1418 PROCEDURE prepareData
1419 (
1420     pProjectId			            NUMBER
1421   , pWBSVersionId		            NUMBER
1422   , pWBSElementId	              NUMBER
1423   , pRBSVersionId		            NUMBER
1424   , pRBSElementId	              NUMBER
1425   , pCalendarId                 NUMBER
1426   , pCalendarType               VARCHAR2
1427   , pPeriodDateJulian           NUMBER
1428   , pActualVersionId	          NUMBER
1429   , pCstForecastVersionId	      NUMBER
1430   , pCstBudgetVersionId	        NUMBER
1431   , pCstBudget2VersionId	      NUMBER
1432   , pRevForecastVersionId	      NUMBER
1433   , pRevBudgetVersionId         NUMBER
1434   , pRevBudget2VersionId	      NUMBER
1435   , pOrigCstForecastVersionId	  NUMBER
1436   , pOrigCstBudgetVersionId	    NUMBER
1437   , pOrigCstBudget2VersionId	  NUMBER
1438   , pOrigRevForecastVersionId	  NUMBER
1439   , pOrigRevBudgetVersionId	    NUMBER
1440   , pOrigRevBudget2VersionId	  NUMBER
1441   , pPriorCstForecastVersionId  NUMBER
1442   , pPriorRevForecastVersionId  NUMBER
1443   , pActualPlanTypeId	          NUMBER
1444   , pCstForecastPlanTypeId      NUMBER
1445   , pCstBudgetPlanTypeId	      NUMBER
1446   , pCstBudget2PlanTypeId	      NUMBER
1447   , pRevForecastPlanTypeId      NUMBER
1448   , pRevBudgetPlanTypeId	      NUMBER
1449   , pRevBudget2PlanTypeId	      NUMBER
1450   , pCurrencyRecordType	        NUMBER
1451   , pCurrencyCode		            VARCHAR2
1452   , pFactorBy                   NUMBER   -- to be applied to every CURRENCY measure
1453   , pEffortUOM                  NUMBER   -- to be applied to every HOURS measure
1454   , pCurrencyType		            VARCHAR2
1455   , pTimeSlice                  NUMBER
1456   , pPrgRollup                  VARCHAR2
1457   , pReportType                 VARCHAR2
1458   , pWBSRollupFlag				VARCHAR2 DEFAULT 'Y'
1459   , pRBSRollupFlag				VARCHAR2 DEFAULT 'Y'
1460   , pPeriodName					VARCHAR2
1461   , xDaysSinceITD               OUT NOCOPY NUMBER
1462   , xDaysInPeriod               OUT NOCOPY NUMBER
1463   , x_return_status	            OUT NOCOPY VARCHAR2
1464   , x_msg_count		              OUT NOCOPY NUMBER
1465   , x_msg_data		              OUT NOCOPY VARCHAR2
1466 ) AS
1467 
1468   x_measure_set_code	SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
1469   x_measure_name	    SYSTEM.PA_VARCHAR2_240_TBL_TYPE;
1470   x_measure_type	    SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
1471   x_ptd_value		      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1472   x_qtd_value		      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1473   x_ytd_value		      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1474   x_itd_value		      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1475   x_ac_value		      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1476   x_prp_value	        SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1477   x_ptd_html	        SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
1478   x_qtd_html	        SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
1479   x_ytd_html	        SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
1480   x_itd_html	        SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
1481   x_ac_html	          SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
1482   x_prp_html	        SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
1483   x_ptd_trans_id	     SYSTEM.PA_NUM_TBL_TYPE;
1484   x_ytd_trans_id	     SYSTEM.PA_NUM_TBL_TYPE;
1485   x_qtd_trans_id	     SYSTEM.PA_NUM_TBL_TYPE;
1486   x_itd_trans_id	     SYSTEM.PA_NUM_TBL_TYPE;
1487   x_ac_trans_id	     	 SYSTEM.PA_NUM_TBL_TYPE;
1488   x_prp_trans_id	     SYSTEM.PA_NUM_TBL_TYPE;
1489   x_ptd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1490   x_ytd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1491   x_qtd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1492   x_itd_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1493   x_ac_meaning       SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1494   x_prp_meaning      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1495 
1496   l_exception_indicator_tbl		SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
1497   l_sql_errm          VARCHAR2(255);
1498 
1499 BEGIN
1500 	NULL;
1501 
1502   IF g_debug_mode = 'Y' THEN
1503 	  Pji_Utils.WRITE2LOG('entering preparedata',TRUE, g_msg_level_runtime_info);
1504   END IF;
1505 
1506 
1507 	--
1508 	-- Delete the existing records in temporary table.
1509 	--
1510 	DELETE PJI_REP_XTD_MEASURES_TMP;
1511 
1512   BEGIN
1513 
1514   	--
1515   	-- Fetch the translated measure names from the lookups.
1516     -- Measure_Types elements can be in ['CURRENCY', 'PERCENT', 'HOURS', 'INDEX', 'OTHERS']
1517     -- We must exclude the measures outside the PO scope.
1518   	--
1519   	SELECT measure_set_code
1520   	, NULL -- calculated later in the code -- measure_format
1521   	, name
1522   	, NULL -- calculated later in the code
1523   	, NULL -- calculated later in the code
1524    	, NULL -- calculated later in the code
1525   	, NULL -- calculated later in the code
1526    	, NULL -- calculated later in the code
1527   	, NULL -- calculated later in the code
1528    	BULK COLLECT INTO x_measure_set_code
1529   	, x_measure_type
1530   	, x_measure_name
1531   	, x_ptd_value
1532   	, x_qtd_value
1533   	, x_ytd_value
1534   	, x_itd_value
1535     , x_ac_value
1536     , x_prp_value
1537   	FROM pji_mt_measure_sets_vl
1538   	WHERE 1=1
1539     AND measure_set_type IN ('SEEDED', 'CUSTOM_STORED', 'CUSTOM_CALC')
1540 	AND measure_set_code LIKE 'PPF%'
1541     ORDER BY measure_set_code;
1542 
1543   EXCEPTION
1544 
1545     WHEN NO_DATA_FOUND THEN
1546         x_return_status := Pji_Rep_Util.G_RET_STS_WARNING;
1547         Pji_Rep_Util.Add_Message(p_app_short_name=>'PJI',
1548             p_msg_name=>'PJI_REP_UNDEFINED_MSR_CODE',
1549             p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING);
1550     WHEN OTHERS THEN
1551       l_sql_errm := SQLERRM();
1552       x_return_status := Pji_Rep_Util.G_RET_STS_WARNING;
1553       Pji_Rep_Util.Add_Message(
1554         p_app_short_name=>'PJI',
1555         p_msg_name=>'PJI_REP_GENERIC_MSG',
1556         p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
1557         p_token1=>'PROC_NAME',
1558         p_token1_value=>'PJI_REP_MEASURE_UTIL; SQL_Error: ' || l_sql_errm
1559       );
1560 
1561   END;
1562 
1563 	retrieveData(pProjectId, pWBSVersionId, pWBSElementId, pRBSVersionId, pRBSElementId,
1564         pCalendarId, pCalendarType, pPeriodDateJulian,
1565         pActualVersionId,
1566         pCstForecastVersionId, pCstBudgetVersionId, pCstBudget2VersionId,
1567         pRevForecastVersionId, pRevBudgetVersionId, pRevBudget2VersionId,
1568         pOrigCstForecastVersionId, pOrigCstBudgetVersionId, pOrigCstBudget2VersionId,
1569         pOrigRevForecastVersionId, pOrigRevBudgetVersionId, pOrigRevBudget2VersionId,
1570         pPriorCstForecastVersionId, pPriorRevForecastVersionId,
1571         pActualPlanTypeId,
1572         pCstForecastPlanTypeId, pCstBudgetPlanTypeId, pCstBudget2PlanTypeId,
1573         pRevForecastPlanTypeId, pRevBudgetPlanTypeId, pRevBudget2PlanTypeId,
1574         pCurrencyRecordType, pCurrencyCode, pFactorBy, pEffortUOM,
1575         pCurrencyType, pTimeSlice, pPrgRollup, pReportType,
1576 		pPeriodName,
1577         x_measure_set_code,
1578 		'N', pWBSRollupFlag, pRBSRollupFlag,
1579 		g_Prepare, NULL, l_exception_indicator_tbl,
1580 		x_measure_type, x_ptd_value, x_qtd_value,
1581         x_ytd_value, x_itd_value, x_ac_value, x_prp_value,
1582         x_ptd_html, x_qtd_html, x_ytd_html, x_itd_html, x_ac_html, x_prp_html,
1583 		x_ptd_trans_id, x_ytd_trans_id, x_qtd_trans_id, x_itd_trans_id, x_ac_trans_id, x_prp_trans_id,
1584 		x_ptd_meaning, x_qtd_meaning, x_ytd_meaning, x_itd_meaning, x_ac_meaning, x_prp_meaning,
1585         xDaysSinceITD, xDaysInPeriod, x_return_status, x_msg_count, x_msg_data);
1586 		  /* Bug 6914287 changed the order of the trans_id variables to match the procedure definition */
1587 
1588   IF x_measure_set_code.COUNT < 1 THEN
1589       RETURN;
1590   END IF;
1591 
1592 
1593   --FOR i IN 1..x_measure_set_code.COUNT LOOP
1594   --  dbms_output.put_line(x_measure_set_code(i)||'='||x_itd_value(i)||'; html('||i||')='||x_itd_html(i));
1595   --END LOOP;
1596 
1597   --
1598 	-- Bulk Insert the amounts into the temporary table.
1599 	--
1600   FORALL i IN 1..x_measure_set_code.LAST
1601   INSERT INTO PJI_REP_XTD_MEASURES_TMP
1602   (
1603     MEASURE_SET_CODE, MEASURE_TYPE, MEASURE_LABEL,
1604     PTD_VALUE, QTD_VALUE, YTD_VALUE, ITD_VALUE, AC_VALUE, PRP_VALUE,
1605     PTD_HTML, QTD_HTML, YTD_HTML, ITD_HTML, AC_HTML, PRP_HTML,
1606 	PTD_TRANS_ID, QTD_TRANS_ID, YTD_TRANS_ID, ITD_TRANS_ID, AC_TRANS_ID, PRP_TRANS_ID,
1607 	PTD_MEANING,QTD_MEANING,YTD_MEANING,ITD_MEANING,AC_MEANING,PRP_MEANING
1608   )
1609   VALUES (
1610     x_measure_set_code(i), x_measure_type(i), x_measure_name(i),
1611     x_ptd_value(i), x_qtd_value(i), x_ytd_value(i), x_itd_value(i), x_ac_value(i), x_prp_value(i),
1612     x_ptd_html(i), x_qtd_html(i), x_ytd_html(i), x_itd_html(i), x_ac_html(i), x_prp_html(i),
1613 	x_ptd_trans_id(i), x_qtd_trans_id(i), x_ytd_trans_id(i), x_itd_trans_id(i), x_ac_trans_id(i), x_prp_trans_id(i),
1614 	x_ptd_meaning(i), x_qtd_meaning(i), x_ytd_meaning(i), x_itd_meaning(i), x_ac_meaning(i), x_prp_meaning(i)
1615   );
1616 
1617   IF g_debug_mode = 'Y' THEN
1618 	  Pji_Utils.WRITE2LOG('leaving preparedata',TRUE, g_msg_level_runtime_info);
1619   END IF;
1620 
1621 	COMMIT;
1622 
1623 
1624 
1625 END prepareData;
1626 
1627 
1628 /**
1629  ** Given a list of wanted measures, this API retrieves them in collections
1630  ** executing all necessary calculations.
1631  ** The user is not required to initialize the output collections.
1632  **
1633  **   return: xDaysSinceITD = number of days since Inception to Date
1634  **   return: xDaysInPeriod = number of days in current period
1635  **   return: x_measure_type = collection with measure types
1636  **   return: x_ptd_value = collection with PTD measure values
1637  **   return: x_qtd_value = collection with QTD measure values
1638  **   return: x_ytd_value = collection with YTD measure values
1639  **   return: x_itd_value = collection with ITD measure values
1640  **   return: x_ac_value = collection with AT Completion measure values
1641  **   return: x_prp_value = collection with Prior Period measure values
1642  **   return: x_ptd_html = collection with HTML code for PTD measure values
1643  **   return: x_qtd_html = collection with HTML code for QTD measure values
1644  **   return: x_ytd_html = collection with HTML code for YTD measure values
1645  **   return: x_itd_html = collection with HTML code for ITD measure values
1646  **   return: x_ac_html = collection with HTML code for At Completion measure values
1647  **   return: x_prp_html = collection with HTML code for Prior Period measure values
1648  **
1649  **/
1650 PROCEDURE retrieveData
1651 (
1652   pProjectId                    NUMBER
1653   , pWBSVersionId		            NUMBER
1654   , pWBSElementId               NUMBER
1655   , pRBSVersionId               NUMBER
1656   , pRBSElementId               NUMBER
1657   , pCalendarId                 NUMBER
1658   , pCalendarType               VARCHAR2
1659   , pPeriodDateJulian           NUMBER
1660   , pActualVersionId            NUMBER
1661   , pCstForecastVersionId       NUMBER
1662   , pCstBudgetVersionId         NUMBER
1663   , pCstBudget2VersionId        NUMBER
1664   , pRevForecastVersionId       NUMBER
1665   , pRevBudgetVersionId         NUMBER
1666   , pRevBudget2VersionId        NUMBER
1667   , pOrigCstForecastVersionId   NUMBER
1668   , pOrigCstBudgetVersionId     NUMBER
1669   , pOrigCstBudget2VersionId    NUMBER
1670   , pOrigRevForecastVersionId   NUMBER
1671   , pOrigRevBudgetVersionId     NUMBER
1672   , pOrigRevBudget2VersionId    NUMBER
1673   , pPriorCstForecastVersionId  NUMBER
1674   , pPriorRevForecastVersionId  NUMBER
1675   , pActualPlanTypeId           NUMBER
1676   , pCstForecastPlanTypeId      NUMBER
1677   , pCstBudgetPlanTypeId        NUMBER
1678   , pCstBudget2PlanTypeId       NUMBER
1679   , pRevForecastPlanTypeId      NUMBER
1680   , pRevBudgetPlanTypeId        NUMBER
1681   , pRevBudget2PlanTypeId       NUMBER
1682   , pCurrencyRecordType         NUMBER
1683   , pCurrencyCode               VARCHAR2
1684   , pFactorBy                   NUMBER   -- to be applied to every CURRENCY measure
1685   , pEffortUOM                  NUMBER   -- to be applied to every HOURS measure
1686   , pCurrencyType               VARCHAR2
1687   , pTimeSlice                  NUMBER
1688   , pPrgRollup                  VARCHAR2
1689   , pReportType                 VARCHAR2
1690   , pPeriodName					VARCHAR2
1691   , p_measure_set_code          IN SYSTEM.PA_VARCHAR2_30_TBL_TYPE
1692   , p_raw_text_flag				VARCHAR2 DEFAULT 'Y'
1693   , pWBSRollupFlag				VARCHAR2 DEFAULT 'Y'
1694   , pRBSRollupFlag				VARCHAR2 DEFAULT 'Y'
1695   , pCallingType				VARCHAR2
1696   , p_measure_id_tbl			IN SYSTEM.PA_NUM_TBL_TYPE DEFAULT NULL
1697   , x_exception_indicator_tbl	OUT NOCOPY SYSTEM.PA_VARCHAR2_2000_TBL_TYPE
1698   , x_measure_type              OUT NOCOPY SYSTEM.PA_VARCHAR2_30_TBL_TYPE
1699   , x_ptd_value                 OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1700   , x_qtd_value                 OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1701   , x_ytd_value                 OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1702   , x_itd_value                 OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1703   , x_ac_value                  OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1704   , x_prp_value                 OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1705   , x_ptd_html                  OUT NOCOPY SYSTEM.PA_VARCHAR2_2000_TBL_TYPE
1706   , x_qtd_html                  OUT NOCOPY SYSTEM.PA_VARCHAR2_2000_TBL_TYPE
1707   , x_ytd_html                  OUT NOCOPY SYSTEM.PA_VARCHAR2_2000_TBL_TYPE
1708   , x_itd_html                  OUT NOCOPY SYSTEM.PA_VARCHAR2_2000_TBL_TYPE
1709   , x_ac_html                   OUT NOCOPY SYSTEM.PA_VARCHAR2_2000_TBL_TYPE
1710   , x_prp_html                  OUT NOCOPY SYSTEM.PA_VARCHAR2_2000_TBL_TYPE
1711   , x_ptd_trans_id	     		OUT NOCOPY SYSTEM.PA_NUM_TBL_TYPE
1712   , x_ytd_trans_id	     		OUT NOCOPY SYSTEM.PA_NUM_TBL_TYPE
1713   , x_qtd_trans_id	     		OUT NOCOPY SYSTEM.PA_NUM_TBL_TYPE
1714   , x_itd_trans_id	     		OUT NOCOPY SYSTEM.PA_NUM_TBL_TYPE
1715   , x_ac_trans_id	     	 	OUT NOCOPY SYSTEM.PA_NUM_TBL_TYPE
1716   , x_prp_trans_id	     	 	OUT NOCOPY SYSTEM.PA_NUM_TBL_TYPE
1717   , x_ptd_meaning      OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1718   , x_ytd_meaning      OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1719   , x_qtd_meaning      OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1720   , x_itd_meaning      OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1721   , x_ac_meaning       OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1722   , x_prp_meaning      OUT NOCOPY SYSTEM.PA_VARCHAR2_80_TBL_TYPE
1723   , xDaysSinceITD               OUT NOCOPY NUMBER
1724   , xDaysInPeriod               OUT NOCOPY NUMBER
1725   , x_return_status             IN OUT NOCOPY VARCHAR2
1726   , x_msg_count                 IN OUT NOCOPY NUMBER
1727   , x_msg_data                  IN OUT NOCOPY VARCHAR2
1728 ) AS
1729 
1730   l_overview_type               pji_rep_overview_type_tbl; --table of objects
1731 
1732   l_temp_overview_type			pji_rep_overview_type_tbl;
1733   l_result_index				NUMBER;
1734 
1735   l_pji_facts                   pji_ac_proj_f_rec;
1736   l_pji_facts_null              pji_ac_proj_f_rec;
1737   l_completed_percentage        NUMBER;
1738   l_planned_work_qt             prf_over_time_amounts_rec;
1739   l_incr_work_qt                prf_over_time_amounts_rec;
1740   l_amt_over_time_null          prf_over_time_amounts_rec;
1741   l_actual_index                NUMBER;
1742   l_cost_forecast_index         NUMBER;
1743   l_cost_budget_index           NUMBER;
1744   l_cost_budget2_index          NUMBER;
1745   l_rev_forecast_index          NUMBER;
1746   l_rev_budget_index            NUMBER;
1747   l_rev_budget2_index           NUMBER;
1748   l_orig_cost_forecast_index    NUMBER;
1749   l_orig_cost_budget_index      NUMBER;
1750   l_orig_cost_budget2_index     NUMBER;
1751   l_orig_rev_forecast_index     NUMBER;
1752   l_orig_rev_budget_index       NUMBER;
1753   l_orig_rev_budget2_index      NUMBER;
1754   l_prior_cost_forecast_index   NUMBER;
1755   l_prior_rev_forecast_index    NUMBER;
1756   l_check_plan_versions         NUMBER;
1757   ptd_measure_ids_tbl           SYSTEM.PA_NUM_TBL_TYPE;
1758   qtd_measure_ids_tbl           SYSTEM.PA_NUM_TBL_TYPE;
1759   ytd_measure_ids_tbl           SYSTEM.PA_NUM_TBL_TYPE;
1760   itd_measure_ids_tbl           SYSTEM.PA_NUM_TBL_TYPE;
1761   ac_measure_ids_tbl            SYSTEM.PA_NUM_TBL_TYPE;
1762   prp_measure_ids_tbl           SYSTEM.PA_NUM_TBL_TYPE;
1763   l_seeded_measures             SYSTEM.PA_Num_Tbl_Type;
1764   l_seeded_measures_ptd         SYSTEM.PA_Num_Tbl_Type;
1765   l_seeded_measures_qtd         SYSTEM.PA_Num_Tbl_Type;
1766   l_seeded_measures_ytd         SYSTEM.PA_Num_Tbl_Type;
1767   l_seeded_measures_itd         SYSTEM.PA_Num_Tbl_Type;
1768   l_seeded_measures_ac          SYSTEM.PA_Num_Tbl_Type;
1769   l_seeded_measures_prp         SYSTEM.PA_Num_Tbl_Type;
1770   l_fp_calc_custom_measures_ptd      SYSTEM.PA_Num_Tbl_Type;
1771   l_fp_calc_custom_measures_qtd      SYSTEM.PA_Num_Tbl_Type;
1772   l_fp_calc_custom_measures_ytd      SYSTEM.PA_Num_Tbl_Type;
1773   l_fp_calc_custom_measures_itd      SYSTEM.PA_Num_Tbl_Type;
1774   l_fp_calc_custom_measures_ac       SYSTEM.PA_Num_Tbl_Type;
1775   l_fp_calc_custom_measures_prp      SYSTEM.PA_Num_Tbl_Type;
1776   l_ac_calc_custom_measures_ptd      SYSTEM.PA_Num_Tbl_Type;
1777   l_ac_calc_custom_measures_qtd      SYSTEM.PA_Num_Tbl_Type;
1778   l_ac_calc_custom_measures_ytd      SYSTEM.PA_Num_Tbl_Type;
1779   l_ac_calc_custom_measures_itd      SYSTEM.PA_Num_Tbl_Type;
1780   l_ac_calc_custom_measures_ac       SYSTEM.PA_Num_Tbl_Type;
1781   l_ac_calc_custom_measures_prp      SYSTEM.PA_Num_Tbl_Type;
1782   l_fp_custom_measures_ptd      SYSTEM.PA_Num_Tbl_Type;
1783   l_fp_custom_measures_qtd      SYSTEM.PA_Num_Tbl_Type;
1784   l_fp_custom_measures_ytd      SYSTEM.PA_Num_Tbl_Type;
1785   l_fp_custom_measures_itd      SYSTEM.PA_Num_Tbl_Type;
1786   l_fp_custom_measures_ac       SYSTEM.PA_Num_Tbl_Type;
1787   l_fp_custom_measures_prp      SYSTEM.PA_Num_Tbl_Type;
1788   l_ac_custom_measures_ptd      SYSTEM.PA_Num_Tbl_Type;
1789   l_ac_custom_measures_qtd      SYSTEM.PA_Num_Tbl_Type;
1790   l_ac_custom_measures_ytd      SYSTEM.PA_Num_Tbl_Type;
1791   l_ac_custom_measures_itd      SYSTEM.PA_Num_Tbl_Type;
1792   l_ac_custom_measures_ac       SYSTEM.PA_Num_Tbl_Type;
1793   l_ac_custom_measures_prp      SYSTEM.PA_Num_Tbl_Type;
1794   l_fp_cus_meas_formats            SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
1795   l_ac_cus_meas_formats            SYSTEM.PA_VARCHAR2_30_TBL_TYPE;
1796   l_fp_custom_measures_ptd_char SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1797   l_fp_custom_measures_qtd_char SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1798   l_fp_custom_measures_ytd_char SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1799   l_fp_custom_measures_itd_char SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1800   l_fp_custom_measures_ac_char  SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1801   l_fp_custom_measures_prp_char SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1802   l_ac_custom_measures_ptd_char SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1803   l_ac_custom_measures_qtd_char SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1804   l_ac_custom_measures_ytd_char SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1805   l_ac_custom_measures_itd_char SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1806   l_ac_custom_measures_ac_char  SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1807   l_ac_custom_measures_prp_char SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1808   l_num                         NUMBER;
1809   i                             NUMBER;
1810   l_PrgRollupFlag1              VARCHAR2(1);
1811   l_PrgRollupFlag2              VARCHAR2(1);
1812   l_sql_errm                    VARCHAR2(255);
1813   l_org_id                      NUMBER;
1814   l_project_type_class          VARCHAR2(30);
1815   l_capital_proj_mask           NUMBER;
1816   l_total_funding               NUMBER;
1817   l_backlog                     NUMBER;
1818   S                             VARCHAR2(255);
1819   l_factor_by                   NUMBER;
1820   l_effort_UOM                  NUMBER;
1821   l_temp_excp_meaning	     	SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1822   l_indirect_proj_mask			NUMBER;
1823   l_contract_proj_mask			NUMBER;
1824   /* Added by Ning for the pass-in pRBSRollupFlag */
1825   l_rbs_aggr_level				VARCHAR2(1);
1826   l_next_invoice_date			DATE;
1827   l_start_date					DATE;
1828   l_billing_cycle_id			NUMBER;
1829   l_billing_offset				NUMBER;
1830   l_seeded_measure_count		NUMBER;
1831   l_hours_per_day				NUMBER;
1832 
1833   l_ptd_value					SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1834   l_qtd_value					SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1835   l_ytd_value					SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1836   l_itd_value					SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1837   l_ac_value					SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1838   l_prp_value					SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
1839   l_cust_measure_number			NUMBER;
1840 
1841    --
1842    -- Added following local variables for bug 3898511
1843    -- These variable are used to remove literals from a sqls used to fetch
1844    -- data from reporting fact table and activity based facts
1845    --
1846    l_calendarType_E                     VARCHAR2(1)   := 'E';
1847    l_calendarType_A                     VARCHAR2(1)   := 'A';
1848    l_julianFormat                       VARCHAR2(1)   := 'j';
1849    l_reportType_TS                      VARCHAR2(2)   := 'TS';
1850    l_reportType_TA                      VARCHAR2(2)   := 'TA';
1851    l_reportType_RA                      VARCHAR2(2)   := 'RA';
1852    l_reportType_RS                      VARCHAR2(2)   := 'RS';
1853    l_rbs_aggr_level_L                   VARCHAR2(1)   := 'L';
1854    l_rbs_aggr_level_T                   VARCHAR2(1)   := 'T';
1855    l_WBSRollupFlag_N                    VARCHAR2(1)   := 'N';
1856    -- till here for bug 3898511
1857 
1858   -- Adding following 8 variables for bug 4194804
1859   l_measure1                           NUMBER;
1860   l_measure2                           NUMBER;
1861   l_measure3                           NUMBER;
1862   l_measure4                           NUMBER;
1863   l_measure5                           NUMBER;
1864   l_measure6                           NUMBER;
1865   l_measure7                           NUMBER;
1866   l_measures_total                     NUMBER;
1867 
1868   -- project type consistent flag
1869   l_ptc_flag 	  			 	 	   VARCHAR2(1);
1870 
1871 BEGIN
1872 
1873   NULL;
1874 
1875   IF g_debug_mode = 'Y' THEN
1876 	  Pji_Utils.WRITE2LOG(
1877 	    'PJI_REP_MEASURE_UTIL.retrieveData: beginning execution....',
1878 	    TRUE, g_msg_level_proc_call
1879 	  );
1880   END IF;
1881   --
1882   -- some sanity checks and defaults
1883   --
1884 
1885   IF pPrgRollup = 'Y' THEN
1886     l_PrgRollupFlag1 := 'Y';
1887     l_PrgRollupFlag2 := 'N';
1888   ELSE
1889     l_PrgRollupFlag1 := 'N';
1890     l_PrgRollupFlag2 := 'N';
1891   END IF;
1892 
1893   l_factor_by := pFactorBy;
1894   IF pFactorBy IS NULL OR pFactorBy = 0 THEN
1895     l_factor_by := 1;
1896   END IF;
1897 
1898   l_effort_UOM := pEffortUOM;
1899   IF pEffortUOM IS NULL OR pEffortUOM = 0 THEN
1900     l_effort_UOM := 1;
1901   END IF;
1902 
1903   SELECT pia.fte_day
1904   INTO l_hours_per_day
1905   FROM pa_implementations_all pia, pa_projects_all ppa WHERE pia.org_id = ppa.org_id and ppa.project_id = pProjectId;
1906 
1907 /* To handle the program reporting when current version and orginal version are same
1908  * we have to generate a local table with current version orginal version in different
1909  * rows even the version id is same. So we will fix the index of those plan versions
1910  * as the follow:
1911  * we removed original forecast index because there is no such version*/
1912   l_actual_index		          := 1;
1913   l_cost_forecast_index	      := 2;
1914   l_cost_budget_index	        := 3;
1915   l_cost_budget2_index	      := 4;
1916   l_rev_forecast_index	      := 5;
1917   l_rev_budget_index	        := 6;
1918   l_rev_budget2_index	        := 7;
1919   l_orig_cost_budget_index	  := 8;
1920   l_orig_cost_budget2_index	  := 9;
1921   l_orig_rev_budget_index	    := 10;
1922   l_orig_rev_budget2_index	  := 11;
1923   l_prior_cost_forecast_index := 12;
1924   l_prior_rev_forecast_index  := 13;
1925   l_check_plan_versions       := 0;
1926 
1927   IF x_return_status IS NULL THEN
1928       x_msg_count := 0;
1929       x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
1930   END IF;
1931 
1932   l_overview_type := pji_rep_overview_type_tbl();
1933   l_temp_overview_type := pji_rep_overview_type_tbl();
1934 
1935 
1936   IF p_measure_set_code.COUNT < 1 THEN
1937       RETURN;
1938   END IF;
1939 
1940   --
1941   -- derive project type class for current project
1942   --
1943 
1944 	Pji_Rep_Util.Check_Proj_Type_Consistency(pProjectId
1945 	, pWBSVersionId
1946 	, 'FINANCIAL'
1947 	, l_ptc_flag
1948 	, x_return_status
1949 	, x_msg_count
1950 	, x_msg_data);
1951 
1952   IF (pPrgRollup = 'Y') AND (l_ptc_flag = 'F') THEN
1953   	 l_capital_proj_mask := 1;
1954 	 l_indirect_proj_mask := 1;
1955 	 l_contract_proj_mask := 1;
1956   ELSE
1957 	  BEGIN
1958 	    SELECT DISTINCT UPPER(t.project_type_class_code)
1959 	    INTO l_project_type_class
1960 	    FROM pa_projects_all   p
1961 	    , pa_project_types_all t
1962 	    WHERE 1=1
1963 	    AND p.project_id = pProjectId
1964 	    AND p.project_type = t.project_type
1965 	    AND p.org_id = t.org_id;
1966 	  EXCEPTION
1967 	    WHEN OTHERS THEN
1968 	      l_project_type_class := 'CONTRACT';
1969 	  END;
1970 
1971 	  --
1972 	  -- this mask is used to nullify all capital related measures for
1973 	  -- non-capital projects
1974 	  --
1975 	  IF l_project_type_class = 'CAPITAL' THEN
1976 	    l_capital_proj_mask := 1;
1977 	  ELSE
1978 	    l_capital_proj_mask := NULL;
1979 	  END IF;
1980 
1981 	  IF l_project_type_class = 'INDIRECT' THEN
1982 	    l_indirect_proj_mask := 1;
1983 	  ELSE
1984 	    l_indirect_proj_mask := NULL;
1985 	  END IF;
1986 
1987 	  IF l_project_type_class = 'CONTRACT' THEN
1988 	    l_contract_proj_mask := 1;
1989 	  ELSE
1990 	    l_contract_proj_mask := NULL;
1991 	  END IF;
1992   END IF;
1993   /* Added by Ning for the pass-in pRBSRollupFlag */
1994   IF (pRBSRollupFlag = 'Y') THEN
1995   	 l_rbs_aggr_level := 'R';
1996   ELSE
1997   	 l_rbs_aggr_level := 'L';
1998   END IF;
1999 
2000   /* Added by Ning to get the next invoice date */
2001   SELECT start_date, billing_cycle_id,
2002             billing_offset
2003     INTO l_start_date, l_billing_cycle_id, l_billing_offset
2004     FROM pa_projects_all
2005     WHERE project_id = pProjectId;
2006 
2007   l_next_invoice_date :=
2008   Pa_Billing_Cycles_Pkg.get_next_billing_date(
2009   						X_Project_ID => pProjectId,
2010 						X_Project_Start_Date => l_start_date,
2011 						X_Billing_Cycle_ID => l_billing_cycle_id,
2012 						X_Billing_Offset_Days => l_billing_offset,
2013 						X_Bill_Thru_Date  => NULL,
2014 						X_Last_Bill_Thru_Date => NULL);
2015 
2016   --
2017 	-- Fetch the data from the reporting fact table.
2018   -- Notes:
2019   -- 1. l_overview_type is a collection (table) of objects having structure:
2020   -- plan_version_id, plan_type_id, and various sums.
2021   -- 2. l_overview_type collects the SUMs of ALL the amount values from
2022   -- reporting lines for all plan types.
2023   -- 3. The l_overview_type collection is grouped by plan_type_id and plan_version_id.
2024   -- The masks are arithmetic selectors able to include (if their value = 1) or
2025   -- exclude (if their value is 0) a term in the sum.
2026   -- E.g. the qtd_mask is 1 for all the CURR_PERIOD and PREV_PERIOD record types,
2027   -- and 0 for the PREV_QUARTER and PREV_YEAR record types,
2028   -- so it will automatically exclude all the ytd, itd amounts from the QTD sums.
2029   -- Using the parameter pTimeSlice we exclude all the records which have a
2030   -- record type above the selected threshold
2031 	--
2032   BEGIN
2033 
2034     SELECT
2035     pji_rep_overview_type(
2036 	plan_version_id
2037     ,plan_type_id
2038     ,SUM(ptd_mask * raw_cost)
2039     ,SUM(ptd_mask * brdn_cost)
2040     ,SUM(ptd_mask * revenue * l_contract_proj_mask)
2041     ,SUM(ptd_mask * bill_raw_cost * l_contract_proj_mask)
2042     ,SUM(ptd_mask * bill_brdn_cost * l_contract_proj_mask)
2043     ,SUM(ptd_mask * billable_equipment_hours * l_contract_proj_mask)
2044     ,SUM(ptd_mask * bill_labor_raw_cost * l_contract_proj_mask)
2045     ,SUM(ptd_mask * bill_labor_brdn_cost * l_contract_proj_mask)
2046     ,SUM(ptd_mask * bill_labor_hrs * l_contract_proj_mask)
2047     ,SUM(ptd_mask * capitalizable_raw_cost * l_capital_proj_mask)
2048     ,SUM(ptd_mask * capitalizable_brdn_cost * l_capital_proj_mask)
2049     ,SUM(ptd_mask * equipment_hours)
2050 	,SUM(ptd_mask * equipment_raw_cost)
2051 	,SUM(ptd_mask * equipment_brdn_cost)
2052     ,SUM(ptd_mask * labor_raw_cost)
2053     ,SUM(ptd_mask * labor_brdn_cost)
2054     ,SUM(ptd_mask * labor_hrs)
2055     ,SUM(ptd_mask * labor_revenue * l_contract_proj_mask)
2056     ,SUM(ptd_mask * 0) --unbilled_cost
2057     ,SUM(ptd_mask * 0) --capitalized_cost
2058     ,SUM(itd_mask * sup_inv_committed_cost)
2059     ,SUM(itd_mask * po_committed_cost)
2060     ,SUM(itd_mask * pr_committed_cost)
2061     ,SUM(itd_mask * oth_committed_cost)
2062     ,SUM(qtd_mask * raw_cost)
2063     ,SUM(qtd_mask * brdn_cost)
2064     ,SUM(qtd_mask * revenue * l_contract_proj_mask)
2065     ,SUM(qtd_mask * bill_raw_cost * l_contract_proj_mask)
2066     ,SUM(qtd_mask * bill_brdn_cost * l_contract_proj_mask)
2067     ,SUM(qtd_mask * billable_equipment_hours * l_contract_proj_mask)
2068     ,SUM(qtd_mask * bill_labor_raw_cost * l_contract_proj_mask)
2069     ,SUM(qtd_mask * bill_labor_brdn_cost * l_contract_proj_mask)
2070     ,SUM(qtd_mask * bill_labor_hrs * l_contract_proj_mask)
2071     ,SUM(qtd_mask * capitalizable_raw_cost * l_capital_proj_mask)
2072     ,SUM(qtd_mask * capitalizable_brdn_cost * l_capital_proj_mask)
2073     ,SUM(qtd_mask * equipment_hours)
2074 	,SUM(qtd_mask * equipment_raw_cost)
2075 	,SUM(qtd_mask * equipment_brdn_cost)
2076     ,SUM(qtd_mask * labor_raw_cost)
2077     ,SUM(qtd_mask * labor_brdn_cost)
2078     ,SUM(qtd_mask * labor_hrs)
2079     ,SUM(qtd_mask * labor_revenue * l_contract_proj_mask)
2080     ,SUM(qtd_mask * 0) --unbilled_cost
2081     ,SUM(qtd_mask * 0) --capitalized_cost
2082     ,SUM(itd_mask * sup_inv_committed_cost) -- added for 6864037
2083     ,SUM(itd_mask * po_committed_cost) -- added for 6864037
2084     ,SUM(itd_mask * pr_committed_cost) -- added for 6864037
2085     ,SUM(itd_mask * oth_committed_cost) -- added for 6864037
2086     ,SUM(ytd_mask * raw_cost)
2087     ,SUM(ytd_mask * brdn_cost)
2088     ,SUM(ytd_mask * revenue * l_contract_proj_mask)
2089     ,SUM(ytd_mask * bill_raw_cost * l_contract_proj_mask)
2090     ,SUM(ytd_mask * bill_brdn_cost * l_contract_proj_mask)
2091     ,SUM(ytd_mask * billable_equipment_hours * l_contract_proj_mask)
2092     ,SUM(ytd_mask * bill_labor_raw_cost * l_contract_proj_mask)
2093     ,SUM(ytd_mask * bill_labor_brdn_cost * l_contract_proj_mask)
2094     ,SUM(ytd_mask * bill_labor_hrs * l_contract_proj_mask)
2095     ,SUM(ytd_mask * capitalizable_raw_cost * l_capital_proj_mask)
2096     ,SUM(ytd_mask * capitalizable_brdn_cost * l_capital_proj_mask)
2097     ,SUM(ytd_mask * equipment_hours)
2098 	,SUM(ytd_mask * equipment_raw_cost)
2099 	,SUM(ytd_mask * equipment_brdn_cost)
2100     ,SUM(ytd_mask * labor_raw_cost)
2101     ,SUM(ytd_mask * labor_brdn_cost)
2102     ,SUM(ytd_mask * labor_hrs)
2103     ,SUM(ytd_mask * labor_revenue * l_contract_proj_mask)
2104     ,SUM(ytd_mask * 0) --unbilled_cost
2105     ,SUM(ytd_mask * 0) --capitalized_cost
2106     ,SUM(itd_mask * sup_inv_committed_cost) -- added for 6864037
2107     ,SUM(itd_mask * po_committed_cost) -- added for 6864037
2108     ,SUM(itd_mask * pr_committed_cost) -- added for 6864037
2109     ,SUM(itd_mask * oth_committed_cost) -- added for 6864037
2110     ,SUM(itd_mask * raw_cost)
2111     ,SUM(itd_mask * brdn_cost)
2112     ,SUM(itd_mask * revenue * l_contract_proj_mask)
2113     ,SUM(itd_mask * bill_raw_cost * l_contract_proj_mask)
2114     ,SUM(itd_mask * bill_brdn_cost * l_contract_proj_mask)
2115     ,SUM(itd_mask * billable_equipment_hours * l_contract_proj_mask)
2116     ,SUM(itd_mask * bill_labor_raw_cost * l_contract_proj_mask)
2117     ,SUM(itd_mask * bill_labor_brdn_cost * l_contract_proj_mask)
2118     ,SUM(itd_mask * bill_labor_hrs * l_contract_proj_mask)
2119     ,SUM(itd_mask * capitalizable_raw_cost * l_capital_proj_mask)
2120     ,SUM(itd_mask * capitalizable_brdn_cost * l_capital_proj_mask)
2121     ,SUM(itd_mask * equipment_hours)
2122 	,SUM(itd_mask * equipment_raw_cost)
2123 	,SUM(itd_mask * equipment_brdn_cost)
2124     ,SUM(itd_mask * labor_raw_cost)
2125     ,SUM(itd_mask * labor_brdn_cost)
2126     ,SUM(itd_mask * labor_hrs)
2127     ,SUM(itd_mask * labor_revenue * l_contract_proj_mask)
2128     ,SUM(itd_mask * 0) --unbilled_cost
2129     ,SUM(itd_mask * 0) --capitalized_cost
2130     ,SUM(ac_mask * sup_inv_committed_cost)
2131     ,SUM(ac_mask * po_committed_cost)
2132     ,SUM(ac_mask * pr_committed_cost)
2133     ,SUM(ac_mask * oth_committed_cost)
2134     ,SUM(ac_mask * raw_cost)
2135     ,SUM(ac_mask * brdn_cost)
2136     ,SUM(ac_mask * revenue * l_contract_proj_mask)
2137     ,SUM(ac_mask * bill_raw_cost * l_contract_proj_mask)
2138     ,SUM(ac_mask * bill_brdn_cost * l_contract_proj_mask)
2139     ,SUM(ac_mask * billable_equipment_hours * l_contract_proj_mask)
2140     ,SUM(ac_mask * bill_labor_raw_cost * l_contract_proj_mask)
2141     ,SUM(ac_mask * bill_labor_brdn_cost * l_contract_proj_mask)
2142     ,SUM(ac_mask * bill_labor_hrs * l_contract_proj_mask)
2143     ,SUM(ac_mask * capitalizable_raw_cost * l_capital_proj_mask)
2144     ,SUM(ac_mask * capitalizable_brdn_cost * l_capital_proj_mask)
2145     ,SUM(ac_mask * equipment_hours)
2146 	,SUM(ac_mask * equipment_raw_cost)
2147 	,SUM(ac_mask * equipment_brdn_cost)
2148     ,SUM(ac_mask * labor_raw_cost)
2149     ,SUM(ac_mask * labor_brdn_cost)
2150     ,SUM(ac_mask * labor_hrs)
2151     ,SUM(ac_mask * labor_revenue * l_contract_proj_mask)
2152     ,SUM(ac_mask * 0) --unbilled_cost
2153     ,SUM(ac_mask * 0) --capitalized_cost
2154     ,SUM(ac_mask * sup_inv_committed_cost)
2155     ,SUM(ac_mask * po_committed_cost)
2156     ,SUM(ac_mask * pr_committed_cost)
2157     ,SUM(ac_mask * oth_committed_cost)
2158     ,SUM(prp_mask * raw_cost)
2159     ,SUM(prp_mask * brdn_cost)
2160     ,SUM(prp_mask * revenue * l_contract_proj_mask)
2161     ,SUM(prp_mask * bill_raw_cost * l_contract_proj_mask)
2162     ,SUM(prp_mask * bill_brdn_cost * l_contract_proj_mask)
2163     ,SUM(prp_mask * billable_equipment_hours * l_contract_proj_mask)
2164     ,SUM(prp_mask * bill_labor_raw_cost * l_contract_proj_mask)
2165     ,SUM(prp_mask * bill_labor_brdn_cost * l_contract_proj_mask)
2166     ,SUM(prp_mask * bill_labor_hrs * l_contract_proj_mask)
2167     ,SUM(prp_mask * capitalizable_raw_cost * l_capital_proj_mask)
2168     ,SUM(prp_mask * capitalizable_brdn_cost * l_capital_proj_mask)
2169     ,SUM(prp_mask * equipment_hours)
2170 	,SUM(prp_mask * equipment_raw_cost)
2171 	,SUM(prp_mask * equipment_brdn_cost)
2172     ,SUM(prp_mask * labor_raw_cost)
2173     ,SUM(prp_mask * labor_brdn_cost)
2174     ,SUM(prp_mask * labor_hrs)
2175     ,SUM(prp_mask * labor_revenue * l_contract_proj_mask)
2176     ,SUM(prp_mask * 0) --unbilled_cost
2177     ,SUM(prp_mask * 0) --capitalized_cost
2178     ,NULL
2179     ,NULL
2180     ,NULL
2181     ,NULL
2182     ,SUM(ptd_mask * fct.custom1)
2183     ,SUM(ptd_mask * fct.custom2)
2184     ,SUM(ptd_mask * fct.custom3)
2185     ,SUM(ptd_mask * fct.custom4)
2186     ,SUM(ptd_mask * fct.custom5)
2187     ,SUM(ptd_mask * fct.custom6)
2188     ,SUM(ptd_mask * fct.custom7)
2189     ,SUM(ptd_mask * fct.custom8)
2190     ,SUM(ptd_mask * fct.custom9)
2191     ,SUM(ptd_mask * fct.custom10)
2192     ,SUM(itd_mask * fct.custom11)  -- Modified for bug 13713726
2193     ,SUM(itd_mask * fct.custom12)  -- Modified for bug 13713726
2194     ,SUM(itd_mask * fct.custom13)  -- Modified for bug 13713726
2195     ,SUM(itd_mask * fct.custom14)  -- Modified for bug 13713726
2196     ,SUM(itd_mask * fct.custom15)  -- Modified for bug 13713726
2197     ,SUM(ptd_mask * fct.custom16)
2198     ,SUM(ptd_mask * fct.custom17)
2199     ,SUM(ptd_mask * fct.custom18)
2200     ,SUM(ptd_mask * fct.custom19)
2201     ,SUM(ptd_mask * fct.custom20)
2202     ,SUM(ptd_mask * fct.custom21)
2203     ,SUM(ptd_mask * fct.custom22)
2204     ,SUM(ptd_mask * fct.custom23)
2205     ,SUM(ptd_mask * fct.custom24)
2206     ,SUM(ptd_mask * fct.custom25)
2207     ,SUM(ptd_mask * fct.custom26)
2208     ,SUM(ptd_mask * fct.custom27)
2209     ,SUM(ptd_mask * fct.custom28)
2210     ,SUM(ptd_mask * fct.custom29)
2211     ,SUM(ptd_mask * fct.custom30)
2212     ,SUM(qtd_mask * fct.custom1)
2213     ,SUM(qtd_mask * fct.custom2)
2214     ,SUM(qtd_mask * fct.custom3)
2215     ,SUM(qtd_mask * fct.custom4)
2216     ,SUM(qtd_mask * fct.custom5)
2217     ,SUM(qtd_mask * fct.custom6)
2218     ,SUM(qtd_mask * fct.custom7)
2219     ,SUM(qtd_mask * fct.custom8)
2220     ,SUM(qtd_mask * fct.custom9)
2221     ,SUM(qtd_mask * fct.custom10)
2222     ,SUM(itd_mask * fct.custom11)  -- Modified for bug 13713726
2223     ,SUM(itd_mask * fct.custom12)  -- Modified for bug 13713726
2224     ,SUM(itd_mask * fct.custom13)  -- Modified for bug 13713726
2225     ,SUM(itd_mask * fct.custom14)  -- Modified for bug 13713726
2226     ,SUM(itd_mask * fct.custom15)  -- Modified for bug 13713726
2227     ,SUM(qtd_mask * fct.custom16)
2228     ,SUM(qtd_mask * fct.custom17)
2229     ,SUM(qtd_mask * fct.custom18)
2230     ,SUM(qtd_mask * fct.custom19)
2231     ,SUM(qtd_mask * fct.custom20)
2232     ,SUM(qtd_mask * fct.custom21)
2233     ,SUM(qtd_mask * fct.custom22)
2234     ,SUM(qtd_mask * fct.custom23)
2235     ,SUM(qtd_mask * fct.custom24)
2236     ,SUM(qtd_mask * fct.custom25)
2237     ,SUM(qtd_mask * fct.custom26)
2238     ,SUM(qtd_mask * fct.custom27)
2239     ,SUM(qtd_mask * fct.custom28)
2240     ,SUM(qtd_mask * fct.custom29)
2241     ,SUM(qtd_mask * fct.custom30)
2242     ,SUM(ytd_mask * fct.custom1)
2243     ,SUM(ytd_mask * fct.custom2)
2244     ,SUM(ytd_mask * fct.custom3)
2245     ,SUM(ytd_mask * fct.custom4)
2246     ,SUM(ytd_mask * fct.custom5)
2247     ,SUM(ytd_mask * fct.custom6)
2248     ,SUM(ytd_mask * fct.custom7)
2249     ,SUM(ytd_mask * fct.custom8)
2250     ,SUM(ytd_mask * fct.custom9)
2251     ,SUM(ytd_mask * fct.custom10)
2252     ,SUM(itd_mask * fct.custom11)  -- Modified for bug 13713726
2253     ,SUM(itd_mask * fct.custom12)  -- Modified for bug 13713726
2254     ,SUM(itd_mask * fct.custom13)  -- Modified for bug 13713726
2255     ,SUM(itd_mask * fct.custom14)  -- Modified for bug 13713726
2256     ,SUM(itd_mask * fct.custom15)  -- Modified for bug 13713726
2257     ,SUM(ytd_mask * fct.custom16)
2258     ,SUM(ytd_mask * fct.custom17)
2259     ,SUM(ytd_mask * fct.custom18)
2260     ,SUM(ytd_mask * fct.custom19)
2261     ,SUM(ytd_mask * fct.custom20)
2262     ,SUM(ytd_mask * fct.custom21)
2263     ,SUM(ytd_mask * fct.custom22)
2264     ,SUM(ytd_mask * fct.custom23)
2265     ,SUM(ytd_mask * fct.custom24)
2266     ,SUM(ytd_mask * fct.custom25)
2267     ,SUM(ytd_mask * fct.custom26)
2268     ,SUM(ytd_mask * fct.custom27)
2269     ,SUM(ytd_mask * fct.custom28)
2270     ,SUM(ytd_mask * fct.custom29)
2271     ,SUM(ytd_mask * fct.custom30)
2272     ,SUM(itd_mask * fct.custom1)
2273     ,SUM(itd_mask * fct.custom2)
2274     ,SUM(itd_mask * fct.custom3)
2275     ,SUM(itd_mask * fct.custom4)
2276     ,SUM(itd_mask * fct.custom5)
2277     ,SUM(itd_mask * fct.custom6)
2278     ,SUM(itd_mask * fct.custom7)
2279     ,SUM(itd_mask * fct.custom8)
2280     ,SUM(itd_mask * fct.custom9)
2281     ,SUM(itd_mask * fct.custom10)
2282     ,SUM(ac_mask * fct.custom11)  -- Modified for bug 13713726
2283     ,SUM(ac_mask * fct.custom12)  -- Modified for bug 13713726
2284     ,SUM(ac_mask * fct.custom13)  -- Modified for bug 13713726
2285     ,SUM(ac_mask * fct.custom14)  -- Modified for bug 13713726
2286     ,SUM(ac_mask * fct.custom15)  -- Modified for bug 13713726
2287     ,SUM(itd_mask * fct.custom16)
2288     ,SUM(itd_mask * fct.custom17)
2289     ,SUM(itd_mask * fct.custom18)
2290     ,SUM(itd_mask * fct.custom19)
2291     ,SUM(itd_mask * fct.custom20)
2292     ,SUM(itd_mask * fct.custom21)
2293     ,SUM(itd_mask * fct.custom22)
2294     ,SUM(itd_mask * fct.custom23)
2295     ,SUM(itd_mask * fct.custom24)
2296     ,SUM(itd_mask * fct.custom25)
2297     ,SUM(itd_mask * fct.custom26)
2298     ,SUM(itd_mask * fct.custom27)
2299     ,SUM(itd_mask * fct.custom28)
2300     ,SUM(itd_mask * fct.custom29)
2301     ,SUM(itd_mask * fct.custom30)
2302     ,SUM(ac_mask * fct.custom1)
2303     ,SUM(ac_mask * fct.custom2)
2304     ,SUM(ac_mask * fct.custom3)
2305     ,SUM(ac_mask * fct.custom4)
2306     ,SUM(ac_mask * fct.custom5)
2307     ,SUM(ac_mask * fct.custom6)
2308     ,SUM(ac_mask * fct.custom7)
2309     ,SUM(ac_mask * fct.custom8)
2310     ,SUM(ac_mask * fct.custom9)
2311     ,SUM(ac_mask * fct.custom10)
2312     ,SUM(ac_mask * fct.custom11)
2313     ,SUM(ac_mask * fct.custom12)
2314     ,SUM(ac_mask * fct.custom13)
2315     ,SUM(ac_mask * fct.custom14)
2316     ,SUM(ac_mask * fct.custom15)
2317     ,SUM(ac_mask * fct.custom16)
2318     ,SUM(ac_mask * fct.custom17)
2319     ,SUM(ac_mask * fct.custom18)
2320     ,SUM(ac_mask * fct.custom19)
2321     ,SUM(ac_mask * fct.custom20)
2322     ,SUM(ac_mask * fct.custom21)
2323     ,SUM(ac_mask * fct.custom22)
2324     ,SUM(ac_mask * fct.custom23)
2325     ,SUM(ac_mask * fct.custom24)
2326     ,SUM(ac_mask * fct.custom25)
2327     ,SUM(ac_mask * fct.custom26)
2328     ,SUM(ac_mask * fct.custom27)
2329     ,SUM(ac_mask * fct.custom28)
2330     ,SUM(ac_mask * fct.custom29)
2331     ,SUM(ac_mask * fct.custom30)
2332     ,SUM(prp_mask * fct.custom1)
2333     ,SUM(prp_mask * fct.custom2)
2334     ,SUM(prp_mask * fct.custom3)
2335     ,SUM(prp_mask * fct.custom4)
2336     ,SUM(prp_mask * fct.custom5)
2337     ,SUM(prp_mask * fct.custom6)
2338     ,SUM(prp_mask * fct.custom7)
2339     ,SUM(prp_mask * fct.custom8)
2340     ,SUM(prp_mask * fct.custom9)
2341     ,SUM(prp_mask * fct.custom10)
2342     ,SUM(prp_mask * fct.custom11)
2343     ,SUM(prp_mask * fct.custom12)
2344     ,SUM(prp_mask * fct.custom13)
2345     ,SUM(prp_mask * fct.custom14)
2346     ,SUM(prp_mask * fct.custom15)
2347     ,SUM(prp_mask * fct.custom16)
2348     ,SUM(prp_mask * fct.custom17)
2349     ,SUM(prp_mask * fct.custom18)
2350     ,SUM(prp_mask * fct.custom19)
2351     ,SUM(prp_mask * fct.custom20)
2352     ,SUM(prp_mask * fct.custom21)
2353     ,SUM(prp_mask * fct.custom22)
2354     ,SUM(prp_mask * fct.custom23)
2355     ,SUM(prp_mask * fct.custom24)
2356     ,SUM(prp_mask * fct.custom25)
2357     ,SUM(prp_mask * fct.custom26)
2358     ,SUM(prp_mask * fct.custom27)
2359     ,SUM(prp_mask * fct.custom28)
2360     ,SUM(prp_mask * fct.custom29)
2361     ,SUM(prp_mask * fct.custom30)
2362     )
2363     BULK COLLECT INTO l_temp_overview_type
2364     FROM PJI_FP_XBS_ACCUM_F_V fct --PA_REPORTING_LINES
2365     , (SELECT time_id, period_type_id, pCalendarType calendar_type
2366          ,SIGN(bitand(record_type_id,g_ptd_record_type))  ptd_mask
2367          ,SIGN(bitand(record_type_id,g_qtd_record_type))  qtd_mask
2368          ,SIGN(bitand(record_type_id,g_ytd_record_type))  ytd_mask
2369          ,SIGN(bitand(record_type_id,g_itd_record_type))  itd_mask
2370          ,0 ac_mask
2371          ,0 prp_mask
2372        FROM
2373        PJI_TIME_CAL_RPT_STRUCT
2374        WHERE 1=1
2375        AND bitand(record_type_id,pTimeSlice) = record_type_id --the records above the selected slice are excluded
2376        AND calendar_id = pCalendarId
2377        AND report_date = TO_DATE(pPeriodDateJulian,l_julianFormat)
2378        AND pCalendarType <> l_calendarType_E
2379        UNION ALL
2380        SELECT time_id, period_type_id, pCalendarType calendar_type
2381          ,SIGN(bitand(record_type_id,g_ptd_record_type))  ptd_mask
2382          ,SIGN(bitand(record_type_id,g_qtd_record_type))  qtd_mask
2383          ,SIGN(bitand(record_type_id,g_ytd_record_type))  ytd_mask
2384          ,SIGN(bitand(record_type_id,g_itd_record_type))  itd_mask
2385          ,0 ac_mask
2386          ,0 prp_mask
2387        FROM
2388        PJI_TIME_RPT_STRUCT
2389        WHERE 1=1
2390        AND bitand(record_type_id,pTimeSlice) = record_type_id
2391        AND report_date = TO_DATE(pPeriodDateJulian,l_julianFormat)
2392        AND pCalendarType = l_calendarType_E
2393        UNION ALL
2394        -- At Completion:
2395        SELECT -1 time_id, 2048 period_type_id, l_calendarType_A calendar_type
2396          ,0 ptd_mask
2397          ,0 qtd_mask
2398          ,0 ytd_mask
2399          ,0 itd_mask
2400          ,1 ac_mask
2401          ,0 prp_mask
2402        FROM  dual
2403        UNION ALL
2404        -- Prior Period:
2405        SELECT cal_period_id time_id, 32 period_type_id, pCalendarType calendar_type
2406          ,0 ptd_mask
2407          ,0 qtd_mask
2408          ,0 ytd_mask
2409          ,0 itd_mask
2410          ,0 ac_mask
2411          ,1 prp_mask
2412        FROM
2413        pji_time_cal_period_V
2414        WHERE 1=1
2415        --this is the first date of the period - 1 day, so I get the previous period, otherwise i'd get the curr. period
2416        AND TO_DATE(pPeriodDateJulian,l_julianFormat)-1 BETWEEN start_date AND end_date
2417        AND calendar_id = pCalendarId
2418        AND pCalendarType <> l_calendarType_E
2419        UNION ALL
2420        SELECT ent_period_id time_id, 32 period_type_id, pCalendarType calendar_type
2421          ,0 ptd_mask
2422          ,0 qtd_mask
2423          ,0 ytd_mask
2424          ,0 itd_mask
2425          ,0 ac_mask
2426          ,1 prp_mask
2427        FROM
2428        pji_time_ent_period_V
2429        WHERE 1=1
2430        AND TO_DATE(pPeriodDateJulian,l_julianFormat)-1 BETWEEN start_date AND end_date
2431        AND pCalendarType = l_calendarType_E
2432        ) TIME
2433     WHERE 1=1
2434     AND fct.prg_rollup_flag IN (l_PrgRollupFlag1,l_PrgRollupFlag2)
2435     AND (
2436         (pReportType = l_reportType_TS AND fct.rbs_aggr_level = l_rbs_aggr_level_T)
2437        OR
2438     ((pReportType IN (l_reportType_TA, l_reportType_RA, l_reportType_RS)) AND (fct.rbs_aggr_level IN (l_rbs_aggr_level, l_rbs_aggr_level_L)))
2439         )
2440 	AND fct.wbs_rollup_flag IN (l_WBSRollupFlag_N, pWBSRollupFlag)
2441     AND fct.project_id = pProjectId
2442     AND fct.project_element_id = pWBSElementId
2443     AND fct.rbs_version_id = pRBSVersionId
2444    	AND fct.rbs_element_id = pRBSElementId
2445     AND fct.currency_code = pCurrencyCode
2446     AND bitand(fct.curr_record_type_id,pCurrencyRecordType) = pCurrencyRecordType
2447     AND fct.period_type_id = TIME.period_type_id
2448     AND fct.time_id        = TIME.time_id
2449     AND (fct.calendar_type = TIME.calendar_type OR TIME.calendar_type = l_calendarType_A)
2450     AND fct.plan_version_id IN (
2451             pActualVersionId
2452           , pCstForecastVersionId
2453           , pCstBudgetVersionId
2454           , pCstBudget2VersionId
2455           , pRevForecastVersionId
2456           , pRevBudgetVersionId
2457           , pRevBudget2VersionId
2458           , pOrigCstForecastVersionId
2459           , pOrigCstBudgetVersionId
2460           , pOrigCstBudget2VersionId
2461           , pOrigRevForecastVersionId
2462           , pOrigRevBudgetVersionId
2463           , pOrigRevBudget2VersionId
2464           , pPriorCstForecastVersionId
2465           , pPriorRevForecastVersionId
2466 		  , DECODE(fct.prg_rollup_flag, 'Y', -3,-99)
2467 		  , DECODE(fct.prg_rollup_Flag, 'Y', -4,-99)
2468         )
2469     AND fct.plan_type_id IN (
2470          	-1
2471           , pCstForecastPlanTypeId
2472           , pCstBudgetPlanTypeId
2473           , pCstBudget2PlanTypeId
2474           , pRevForecastPlanTypeId
2475           , pRevBudgetPlanTypeId
2476           , pRevBudget2PlanTypeId
2477         )
2478     GROUP BY plan_version_id, fct.plan_type_id;
2479 
2480   EXCEPTION
2481 
2482     WHEN NO_DATA_FOUND THEN
2483       -- in case no data is found, we still can go on and return empty arrays
2484 	  IF g_debug_mode = 'Y' THEN
2485 	      Pji_Utils.WRITE2LOG(
2486 	        'PJI_REP_MEASURE_UTIL.retrieveData: NO_DATA_FOUND on reporting lines SQL query.',
2487 	        TRUE, g_msg_level_low_detail
2488 	      );
2489 	  END IF;
2490     WHEN OTHERS THEN
2491       --
2492       l_sql_errm := SQLERRM();
2493       Pji_Rep_Util.Add_Message(p_app_short_name=>'PJI',
2494         p_msg_name=>'PJI_REP_GENERIC_MSG',
2495         p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
2496         p_token1=>'PROC_NAME',
2497         p_token1_value=>'PJI_REP_MEASURE_UTIL; Reporting lines facts query SQL Error: ' || l_sql_errm);
2498 
2499   END;
2500 
2501 
2502   --
2503   -- for every object in the collection, depending on which version_id is selected
2504   -- from the params, we set up as many index NUMBERs as the number of version_id
2505   -- input params (we have 13 version_ids):
2506   -- l_rev_budget_index, l_rev_budget2_index, l_rev_forecast_index, ....
2507   -- We use these numbers as indexes to later access the same collection and
2508   -- save the various values into the PTD/ITD_VALUES collections;
2509   -- this way we are able to know which object in the collection is related
2510   -- to which versionId.
2511   -- e.g. if we know that object at index `i' is related to pCstForecastVersionId,
2512   -- then we save that `i' in a var, l_cost_forecast_index.
2513   --
2514 
2515   	l_overview_type.EXTEND(13);
2516 	FOR i IN l_overview_type.FIRST .. l_overview_type.LAST LOOP
2517 		l_overview_type(i) := pji_rep_overview_type(NULL,NULL,NULL,NULL,NULL,NULL,
2518 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2519 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2520 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2521 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2522 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2523 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2524 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2525 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2526 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2527 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2528 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2529 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2530 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2531 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2532 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2533 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2534 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2535 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2536 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
2537 		NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
2538 		);
2539 	END LOOP;
2540 
2541 	IF l_temp_overview_type.COUNT > 0 THEN
2542 
2543 		FOR i IN l_temp_overview_type.FIRST..l_temp_overview_type.LAST LOOP
2544 
2545 			IF l_temp_overview_type(i).plan_version_id = pActualVersionId THEN
2546 				l_result_index:=l_actual_index;
2547 
2548 				IF (bitand(g_Actual_is_present,l_check_plan_versions)<>g_Actual_is_present) THEN
2549 				   l_check_plan_versions := g_Actual_is_present +l_check_plan_versions;
2550 				END IF;
2551 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2552 			END IF;
2553 
2554 			IF (l_temp_overview_type(i).plan_version_id = pCstForecastVersionId
2555 			   OR l_temp_overview_type(i).plan_version_id = -3) AND
2556          	   l_temp_overview_type(i).plan_type_id = pCstForecastPlanTypeId THEN
2557 				l_result_index:=l_cost_forecast_index;
2558 				IF (bitand(g_CstFcst_is_present ,l_check_plan_versions)<>g_CstFcst_is_present) THEN
2559 				   l_check_plan_versions := g_CstFcst_is_present +l_check_plan_versions;
2560 				END IF;
2561 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2562 			END IF;
2563 
2564 			IF (l_temp_overview_type(i).plan_version_id = pCstBudgetVersionId
2565 			   OR l_temp_overview_type(i).plan_version_id = -3) AND
2566          	   l_temp_overview_type(i).plan_type_id = pCstBudgetPlanTypeId THEN
2567 				l_result_index:=l_cost_budget_index;
2568 				IF (bitand(g_CstBudget_is_present ,l_check_plan_versions)<>g_CstBudget_is_present) THEN
2569 				   l_check_plan_versions := g_CstBudget_is_present + l_check_plan_versions;
2570 				END IF;
2571 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2572 			END IF;
2573 
2574 			IF (l_temp_overview_type(i).plan_version_id = pCstBudget2VersionId
2575 			   OR l_temp_overview_type(i).plan_version_id = -3) AND
2576          	   l_temp_overview_type(i).plan_type_id = pCstBudget2PlanTypeId THEN
2577 				l_result_index:=l_cost_budget2_index;
2578 				IF (bitand(g_CstBudget2_is_present ,l_check_plan_versions)<>g_CstBudget2_is_present) THEN
2579 				   l_check_plan_versions := g_CstBudget2_is_present + l_check_plan_versions;
2580 				END IF;
2581 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2582 			END IF;
2583 
2584 			IF (l_temp_overview_type(i).plan_version_id = pRevForecastVersionId
2585 			   OR l_temp_overview_type(i).plan_version_id = -3) AND
2586          	   l_temp_overview_type(i).plan_type_id = pRevForecastPlanTypeId THEN
2587 				l_result_index:=l_rev_forecast_index;
2588 				IF (bitand(g_RevFcst_is_present ,l_check_plan_versions)<>g_RevFcst_is_present) THEN
2589 				   l_check_plan_versions := g_RevFcst_is_present + l_check_plan_versions;
2590 				END IF;
2591 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2592 			END IF;
2593 
2594 			IF (l_temp_overview_type(i).plan_version_id = pRevBudgetVersionId
2595 			   OR l_temp_overview_type(i).plan_version_id = -3) AND
2596          	   l_temp_overview_type(i).plan_type_id = pRevBudgetPlanTypeId THEN
2597 				l_result_index:=l_rev_budget_index;
2598 				IF (bitand(g_RevBudget_is_present ,l_check_plan_versions)<>g_RevBudget_is_present) THEN
2599 				   l_check_plan_versions := g_RevBudget_is_present + l_check_plan_versions;
2600 				END IF;
2601 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2602 			END IF;
2603 
2604 			IF (l_temp_overview_type(i).plan_version_id = pRevBudget2VersionId
2605 			   OR l_temp_overview_type(i).plan_version_id = -3) AND
2606          	   l_temp_overview_type(i).plan_type_id = pRevBudget2PlanTypeId THEN
2607 				l_result_index:=l_rev_budget2_index;
2608 				IF (bitand(g_RevBudget2_is_present ,l_check_plan_versions)<>g_RevBudget2_is_present) THEN
2609 				   l_check_plan_versions := g_RevBudget2_is_present + l_check_plan_versions;
2610 				END IF;
2611 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2612 			END IF;
2613 
2614 
2615 			IF (l_temp_overview_type(i).plan_version_id = pOrigCstBudgetVersionId
2616 			   OR l_temp_overview_type(i).plan_version_id = -4) AND
2617          	   l_temp_overview_type(i).plan_type_id = pCstBudgetPlanTypeId THEN
2618 				l_result_index:=l_orig_cost_budget_index;
2619 				IF (bitand(g_OrigCstBudget_is_present ,l_check_plan_versions)<>g_OrigCstBudget_is_present) THEN
2620 				   l_check_plan_versions := g_OrigCstBudget_is_present + l_check_plan_versions;
2621 				END IF;
2622 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2623 			END IF;
2624 
2625 			IF (l_temp_overview_type(i).plan_version_id = pOrigCstBudget2VersionId
2626 			   OR l_temp_overview_type(i).plan_version_id = -4) AND
2627 			   l_temp_overview_type(i).plan_type_id = pCstBudget2PlanTypeId THEN
2628 				l_result_index:=l_orig_cost_budget2_index;
2629 				IF (bitand(g_OrigCstBudget2_is_present ,l_check_plan_versions)<>g_OrigCstBudget2_is_present) THEN
2630 				   l_check_plan_versions := g_OrigCstBudget2_is_present + l_check_plan_versions;
2631 				END IF;
2632 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2633 			END IF;
2634 
2635 		    IF (l_temp_overview_type(i).plan_version_id = pOrigRevBudgetVersionId
2636 			   OR l_temp_overview_type(i).plan_version_id = -4) AND
2637 		       l_temp_overview_type(i).plan_type_id = pRevBudgetPlanTypeId THEN
2638 		        l_result_index:=l_orig_rev_budget_index;
2639 				IF (bitand(g_OrigRevBudget_is_present ,l_check_plan_versions)<>g_OrigRevBudget_is_present) THEN
2640 				   l_check_plan_versions := g_OrigRevBudget_is_present + l_check_plan_versions;
2641 				END IF;
2642 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2643 			END IF;
2644 
2645 			IF (l_temp_overview_type(i).plan_version_id = pOrigRevBudget2VersionId
2646 			   OR l_temp_overview_type(i).plan_version_id = -4) AND
2647 			   l_temp_overview_type(i).plan_type_id = pRevBudget2PlanTypeId THEN
2648 				l_result_index:=l_orig_rev_budget2_index;
2649 				IF (bitand(g_OrigRevBudget2_is_present ,l_check_plan_versions)<>g_OrigRevBudget2_is_present) THEN
2650 				   l_check_plan_versions := g_OrigRevBudget2_is_present + l_check_plan_versions;
2651 				END IF;
2652 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2653 			END IF;
2654 
2655 	      IF l_temp_overview_type(i).plan_version_id = pPriorCstForecastVersionId AND
2656 	         l_temp_overview_type(i).plan_type_id = pCstForecastPlanTypeId THEN
2657 	         	l_result_index:=l_prior_cost_forecast_index;
2658 				l_check_plan_versions := g_CstPriorfcst_is_present + l_check_plan_versions;
2659 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2660 	      END IF;
2661 
2662 	      IF l_temp_overview_type(i).plan_version_id = pPriorRevForecastVersionId AND
2663 	         l_temp_overview_type(i).plan_type_id = pRevForecastPlanTypeId THEN
2664 	         	l_result_index:=l_prior_rev_forecast_index;
2665 				l_check_plan_versions := g_RevPriorfcst_is_present + l_check_plan_versions;
2666 				Merge_Overview_Type(i, l_temp_overview_type, l_result_index, l_overview_type);
2667 	      END IF;
2668 
2669 		END LOOP;
2670 
2671 	END IF;
2672 
2673 
2674   --
2675   -- we shift the entire collection one place to the right
2676   -- to leave the first cell empty to use when there isn't an available plan type
2677   --
2678 
2679   IF g_debug_mode = 'Y' THEN
2680 	  Pji_Utils.WRITE2LOG(
2681 	    'PJI_REP_MEASURE_UTIL.retrieveData: project_id= ' || pProjectId ||
2682 	    '; plan versions info: l_actual_index= ' || l_actual_index ||
2683 	    '; l_cost_forecast_index= ' || l_cost_forecast_index ||
2684 	    '; l_cost_budget_index= '   || l_cost_budget_index   ||
2685 	    '; l_cost_budget2_index= '  || l_cost_budget2_index  ||
2686 	    '; l_rev_forecast_index= ' || l_rev_forecast_index ||
2687 	    '; l_rev_budget_index= '   || l_rev_budget_index   ||
2688 	    '; l_rev_budget2_index= '  || l_rev_budget2_index  ||
2689 	    '; l_overview_type collection length:= '  || l_overview_type.LAST,
2690 	    TRUE, g_msg_level_runtime_info
2691 	  );
2692   END IF;
2693   --
2694   -- collect and summarize the status of all plan versions into a single bit array (a NUMBER)
2695   --
2696 
2697 
2698   -- ########### DEBUG BEGIN ##################################################
2699   /*
2700   FOR i IN 1..(l_overview_type.LAST) LOOP
2701     dbms_output.put_line('## record: ' || i);
2702     dbms_output.put_line('type.itd_bill_burdened_cost='||l_overview_type(i).itd_bill_burdened_cost);
2703     dbms_output.put_line('type.itd_burdened_cost='||l_overview_type(i).itd_burdened_cost);
2704   END LOOP;
2705   dbms_output.put_line('-----\nl_check_plan_versions: ' || l_check_plan_versions);
2706   */
2707   -- ########### DEBUG END ####################################################
2708 
2709 
2710   --
2711 	-- Similar logic for activity based facts
2712 	--
2713   BEGIN
2714 
2715     SELECT
2716      SUM(ptd_mask * fct.active_backlog)
2717     ,SUM(ptd_mask * fct.additional_funding_amount)
2718     ,SUM(ptd_mask * fct.ar_cash_applied_amount)
2719     ,SUM(ptd_mask * fct.ar_credit_memo_amount)
2720     ,SUM(ptd_mask * fct.ar_invoice_amount)
2721     ,SUM(ptd_mask * fct.ar_invoice_write_off_amount)
2722     ,SUM(ptd_mask * fct.ar_invoice_count)
2723     ,SUM(ptd_mask * fct.ar_amount_due)
2724     ,SUM(ptd_mask * fct.ar_amount_overdue)
2725     ,SUM(ptd_mask * fct.cancelled_funding_amount)
2726     ,SUM(ptd_mask * fct.dormant_backlog_inactiv)
2727     ,SUM(ptd_mask * fct.dormant_backlog_start)
2728     ,SUM(ptd_mask * fct.funding_adjustment_amount)
2729     ,SUM(ptd_mask * fct.initial_funding_amount)
2730     ,SUM(ptd_mask * fct.lost_backlog)
2731     ,SUM(ptd_mask * fct.revenue * l_contract_proj_mask)
2732     ,SUM(ptd_mask * fct.revenue_at_risk * l_contract_proj_mask)
2733     ,SUM(ptd_mask * fct.revenue_writeoff)
2734     ,SUM(ptd_mask * fct.unbilled_receivables)
2735     ,SUM(ptd_mask * fct.unearned_revenue)
2736     ,SUM(qtd_mask * fct.active_backlog)
2737     ,SUM(qtd_mask * fct.additional_funding_amount)
2738     ,SUM(qtd_mask * fct.ar_cash_applied_amount)
2739     ,SUM(qtd_mask * fct.ar_credit_memo_amount)
2740     ,SUM(qtd_mask * fct.ar_invoice_amount)
2741     ,SUM(qtd_mask * fct.ar_invoice_write_off_amount)
2742     ,SUM(qtd_mask * fct.ar_invoice_count)
2743     ,SUM(qtd_mask * fct.ar_amount_due)
2744     ,SUM(qtd_mask * fct.ar_amount_overdue)
2745     ,SUM(qtd_mask * fct.cancelled_funding_amount)
2746     ,SUM(qtd_mask * fct.dormant_backlog_inactiv)
2747     ,SUM(qtd_mask * fct.dormant_backlog_start)
2748     ,SUM(qtd_mask * fct.funding_adjustment_amount)
2749     ,SUM(qtd_mask * fct.initial_funding_amount)
2750     ,SUM(qtd_mask * fct.lost_backlog)
2751     ,SUM(qtd_mask * fct.revenue * l_contract_proj_mask)
2752     ,SUM(qtd_mask * fct.revenue_at_risk * l_contract_proj_mask)
2753     ,SUM(qtd_mask * fct.revenue_writeoff)
2754     ,SUM(qtd_mask * fct.unbilled_receivables)
2755     ,SUM(qtd_mask * fct.unearned_revenue)
2756     ,SUM(ytd_mask * fct.active_backlog)
2757     ,SUM(ytd_mask * fct.additional_funding_amount)
2758     ,SUM(ytd_mask * fct.ar_cash_applied_amount)
2759     ,SUM(ytd_mask * fct.ar_credit_memo_amount)
2760     ,SUM(ytd_mask * fct.ar_invoice_amount)
2761     ,SUM(ytd_mask * fct.ar_invoice_write_off_amount)
2762     ,SUM(ytd_mask * fct.ar_invoice_count)
2763     ,SUM(ytd_mask * fct.ar_amount_due)
2764     ,SUM(ytd_mask * fct.ar_amount_overdue)
2765     ,SUM(ytd_mask * fct.cancelled_funding_amount)
2766     ,SUM(ytd_mask * fct.dormant_backlog_inactiv)
2767     ,SUM(ytd_mask * fct.dormant_backlog_start)
2768     ,SUM(ytd_mask * fct.funding_adjustment_amount)
2769     ,SUM(ytd_mask * fct.initial_funding_amount)
2770     ,SUM(ytd_mask * fct.lost_backlog)
2771     ,SUM(ytd_mask * fct.revenue * l_contract_proj_mask)
2772     ,SUM(ytd_mask * fct.revenue_at_risk * l_contract_proj_mask)
2773     ,SUM(ytd_mask * fct.revenue_writeoff)
2774     ,SUM(ytd_mask * fct.unbilled_receivables)
2775     ,SUM(ytd_mask * fct.unearned_revenue)
2776     ,SUM(itd_mask * fct.active_backlog)
2777     ,SUM(itd_mask * fct.additional_funding_amount)
2778     ,SUM(itd_mask * fct.ar_cash_applied_amount)
2779     ,SUM(itd_mask * fct.ar_credit_memo_amount)
2780     ,SUM(itd_mask * fct.ar_invoice_amount)
2781     ,SUM(itd_mask * fct.ar_invoice_write_off_amount)
2782     ,SUM(itd_mask * fct.ar_invoice_count)
2783     ,SUM(itd_mask * fct.ar_amount_due)
2784     ,SUM(itd_mask * fct.ar_amount_overdue)
2785     ,SUM(itd_mask * fct.cancelled_funding_amount)
2786     ,SUM(itd_mask * fct.dormant_backlog_inactiv)
2787     ,SUM(itd_mask * fct.dormant_backlog_start)
2788     ,SUM(itd_mask * fct.funding_adjustment_amount)
2789     ,SUM(itd_mask * fct.initial_funding_amount)
2790     ,SUM(itd_mask * fct.lost_backlog)
2791     ,SUM(itd_mask * fct.revenue * l_contract_proj_mask)
2792     ,SUM(itd_mask * fct.revenue_at_risk * l_contract_proj_mask)
2793     ,SUM(itd_mask * fct.revenue_writeoff)
2794     ,SUM(itd_mask * fct.unbilled_receivables)
2795     ,SUM(itd_mask * fct.unearned_revenue)
2796     ,SUM(ac_mask * fct.active_backlog)
2797     ,SUM(ac_mask * fct.additional_funding_amount)
2798     ,SUM(ac_mask * fct.ar_cash_applied_amount)
2799     ,SUM(ac_mask * fct.ar_credit_memo_amount)
2800     ,SUM(ac_mask * fct.ar_invoice_amount)
2801     ,SUM(ac_mask * fct.ar_invoice_write_off_amount)
2802     ,SUM(ac_mask * fct.ar_invoice_count)
2803     ,SUM(ac_mask * fct.ar_amount_due)
2804     ,SUM(ac_mask * fct.ar_amount_overdue)
2805     ,SUM(ac_mask * fct.cancelled_funding_amount)
2806     ,SUM(ac_mask * fct.dormant_backlog_inactiv)
2807     ,SUM(ac_mask * fct.dormant_backlog_start)
2808     ,SUM(ac_mask * fct.funding_adjustment_amount)
2809     ,SUM(ac_mask * fct.initial_funding_amount)
2810     ,SUM(ac_mask * fct.lost_backlog)
2811     ,SUM(ac_mask * fct.revenue * l_contract_proj_mask)
2812     ,SUM(ac_mask * fct.revenue_at_risk * l_contract_proj_mask)
2813     ,SUM(ac_mask * fct.revenue_writeoff)
2814     ,SUM(ac_mask * fct.unbilled_receivables)
2815     ,SUM(ac_mask * fct.unearned_revenue)
2816     ,SUM(prp_mask * fct.active_backlog)
2817     ,SUM(prp_mask * fct.additional_funding_amount)
2818     ,SUM(prp_mask * fct.ar_cash_applied_amount)
2819     ,SUM(prp_mask * fct.ar_credit_memo_amount)
2820     ,SUM(prp_mask * fct.ar_invoice_amount)
2821     ,SUM(prp_mask * fct.ar_invoice_write_off_amount)
2822     ,SUM(prp_mask * fct.ar_invoice_count)
2823     ,SUM(prp_mask * fct.ar_amount_due)
2824     ,SUM(prp_mask * fct.ar_amount_overdue)
2825     ,SUM(prp_mask * fct.cancelled_funding_amount)
2826     ,SUM(prp_mask * fct.dormant_backlog_inactiv)
2827     ,SUM(prp_mask * fct.dormant_backlog_start)
2828     ,SUM(prp_mask * fct.funding_adjustment_amount)
2829     ,SUM(prp_mask * fct.initial_funding_amount)
2830     ,SUM(prp_mask * fct.lost_backlog)
2831     ,SUM(prp_mask * fct.revenue * l_contract_proj_mask)
2832     ,SUM(prp_mask * fct.revenue_at_risk * l_contract_proj_mask)
2833     ,SUM(prp_mask * fct.revenue_writeoff)
2834     ,SUM(prp_mask * fct.unbilled_receivables)
2835     ,SUM(prp_mask * fct.unearned_revenue)
2836     ,SUM(ptd_mask * fct.custom1)
2837     ,SUM(ptd_mask * fct.custom2)
2838     ,SUM(ptd_mask * fct.custom3)
2839     ,SUM(ptd_mask * fct.custom4)
2840     ,SUM(ptd_mask * fct.custom5)
2841     ,SUM(ptd_mask * fct.custom6)
2842     ,SUM(ptd_mask * fct.custom7)
2843     ,SUM(ptd_mask * fct.custom8)
2844     ,SUM(ptd_mask * fct.custom9)
2845     ,SUM(ptd_mask * fct.custom10)
2846     ,SUM(itd_mask * fct.custom11)  -- Modified for bug 13713726
2847     ,SUM(itd_mask * fct.custom12)  -- Modified for bug 13713726
2848     ,SUM(itd_mask * fct.custom13)  -- Modified for bug 13713726
2849     ,SUM(itd_mask * fct.custom14)  -- Modified for bug 13713726
2850     ,SUM(itd_mask * fct.custom15)  -- Modified for bug 13713726
2851     ,SUM(ptd_mask * fct.custom16)
2852     ,SUM(ptd_mask * fct.custom17)
2853     ,SUM(ptd_mask * fct.custom18)
2854     ,SUM(ptd_mask * fct.custom19)
2855     ,SUM(ptd_mask * fct.custom20)
2856     ,SUM(ptd_mask * fct.custom21)
2857     ,SUM(ptd_mask * fct.custom22)
2858     ,SUM(ptd_mask * fct.custom23)
2859     ,SUM(ptd_mask * fct.custom24)
2860     ,SUM(ptd_mask * fct.custom25)
2861     ,SUM(ptd_mask * fct.custom26)
2862     ,SUM(ptd_mask * fct.custom27)
2863     ,SUM(ptd_mask * fct.custom28)
2864     ,SUM(ptd_mask * fct.custom29)
2865     ,SUM(ptd_mask * fct.custom30)
2866     ,SUM(qtd_mask * fct.custom1)
2867     ,SUM(qtd_mask * fct.custom2)
2868     ,SUM(qtd_mask * fct.custom3)
2869     ,SUM(qtd_mask * fct.custom4)
2870     ,SUM(qtd_mask * fct.custom5)
2871     ,SUM(qtd_mask * fct.custom6)
2872     ,SUM(qtd_mask * fct.custom7)
2873     ,SUM(qtd_mask * fct.custom8)
2874     ,SUM(qtd_mask * fct.custom9)
2875     ,SUM(qtd_mask * fct.custom10)
2876     ,SUM(itd_mask * fct.custom11)  -- Modified for bug 13713726
2877     ,SUM(itd_mask * fct.custom12)  -- Modified for bug 13713726
2878     ,SUM(itd_mask * fct.custom13)  -- Modified for bug 13713726
2879     ,SUM(itd_mask * fct.custom14)  -- Modified for bug 13713726
2880     ,SUM(itd_mask * fct.custom15)  -- Modified for bug 13713726
2881     ,SUM(qtd_mask * fct.custom16)
2882     ,SUM(qtd_mask * fct.custom17)
2883     ,SUM(qtd_mask * fct.custom18)
2884     ,SUM(qtd_mask * fct.custom19)
2885     ,SUM(qtd_mask * fct.custom20)
2886     ,SUM(qtd_mask * fct.custom21)
2887     ,SUM(qtd_mask * fct.custom22)
2888     ,SUM(qtd_mask * fct.custom23)
2889     ,SUM(qtd_mask * fct.custom24)
2890     ,SUM(qtd_mask * fct.custom25)
2891     ,SUM(qtd_mask * fct.custom26)
2892     ,SUM(qtd_mask * fct.custom27)
2893     ,SUM(qtd_mask * fct.custom28)
2894     ,SUM(qtd_mask * fct.custom29)
2895     ,SUM(qtd_mask * fct.custom30)
2896     ,SUM(ytd_mask * fct.custom1)
2897     ,SUM(ytd_mask * fct.custom2)
2898     ,SUM(ytd_mask * fct.custom3)
2899     ,SUM(ytd_mask * fct.custom4)
2900     ,SUM(ytd_mask * fct.custom5)
2901     ,SUM(ytd_mask * fct.custom6)
2902     ,SUM(ytd_mask * fct.custom7)
2903     ,SUM(ytd_mask * fct.custom8)
2904     ,SUM(ytd_mask * fct.custom9)
2905     ,SUM(ytd_mask * fct.custom10)
2906     ,SUM(itd_mask * fct.custom11)  -- Modified for bug 13713726
2907     ,SUM(itd_mask * fct.custom12)  -- Modified for bug 13713726
2908     ,SUM(itd_mask * fct.custom13)  -- Modified for bug 13713726
2909     ,SUM(itd_mask * fct.custom14)  -- Modified for bug 13713726
2910     ,SUM(itd_mask * fct.custom15)  -- Modified for bug 13713726
2911     ,SUM(ytd_mask * fct.custom16)
2912     ,SUM(ytd_mask * fct.custom17)
2913     ,SUM(ytd_mask * fct.custom18)
2914     ,SUM(ytd_mask * fct.custom19)
2915     ,SUM(ytd_mask * fct.custom20)
2916     ,SUM(ytd_mask * fct.custom21)
2917     ,SUM(ytd_mask * fct.custom22)
2918     ,SUM(ytd_mask * fct.custom23)
2919     ,SUM(ytd_mask * fct.custom24)
2920     ,SUM(ytd_mask * fct.custom25)
2921     ,SUM(ytd_mask * fct.custom26)
2922     ,SUM(ytd_mask * fct.custom27)
2923     ,SUM(ytd_mask * fct.custom28)
2924     ,SUM(ytd_mask * fct.custom29)
2925     ,SUM(ytd_mask * fct.custom30)
2926     ,SUM(itd_mask * fct.custom1)
2927     ,SUM(itd_mask * fct.custom2)
2928     ,SUM(itd_mask * fct.custom3)
2929     ,SUM(itd_mask * fct.custom4)
2930     ,SUM(itd_mask * fct.custom5)
2931     ,SUM(itd_mask * fct.custom6)
2932     ,SUM(itd_mask * fct.custom7)
2933     ,SUM(itd_mask * fct.custom8)
2934     ,SUM(itd_mask * fct.custom9)
2935     ,SUM(itd_mask * fct.custom10)
2936     ,SUM(ac_mask * fct.custom11)  -- Modified for bug 13713726
2937     ,SUM(ac_mask * fct.custom12)  -- Modified for bug 13713726
2938     ,SUM(ac_mask * fct.custom13)  -- Modified for bug 13713726
2939     ,SUM(ac_mask * fct.custom14)  -- Modified for bug 13713726
2940     ,SUM(ac_mask * fct.custom15)  -- Modified for bug 13713726
2941     ,SUM(itd_mask * fct.custom16)
2942     ,SUM(itd_mask * fct.custom17)
2943     ,SUM(itd_mask * fct.custom18)
2944     ,SUM(itd_mask * fct.custom19)
2945     ,SUM(itd_mask * fct.custom20)
2946     ,SUM(itd_mask * fct.custom21)
2947     ,SUM(itd_mask * fct.custom22)
2948     ,SUM(itd_mask * fct.custom23)
2949     ,SUM(itd_mask * fct.custom24)
2950     ,SUM(itd_mask * fct.custom25)
2951     ,SUM(itd_mask * fct.custom26)
2952     ,SUM(itd_mask * fct.custom27)
2953     ,SUM(itd_mask * fct.custom28)
2954     ,SUM(itd_mask * fct.custom29)
2955     ,SUM(itd_mask * fct.custom30)
2956     ,SUM(ac_mask * fct.custom1)
2957     ,SUM(ac_mask * fct.custom2)
2958     ,SUM(ac_mask * fct.custom3)
2959     ,SUM(ac_mask * fct.custom4)
2960     ,SUM(ac_mask * fct.custom5)
2961     ,SUM(ac_mask * fct.custom6)
2962     ,SUM(ac_mask * fct.custom7)
2963     ,SUM(ac_mask * fct.custom8)
2964     ,SUM(ac_mask * fct.custom9)
2965     ,SUM(ac_mask * fct.custom10)
2966     ,SUM(ac_mask * fct.custom11)
2967     ,SUM(ac_mask * fct.custom12)
2968     ,SUM(ac_mask * fct.custom13)
2969     ,SUM(ac_mask * fct.custom14)
2970     ,SUM(ac_mask * fct.custom15)
2971     ,SUM(ac_mask * fct.custom16)
2972     ,SUM(ac_mask * fct.custom17)
2973     ,SUM(ac_mask * fct.custom18)
2974     ,SUM(ac_mask * fct.custom19)
2975     ,SUM(ac_mask * fct.custom20)
2976     ,SUM(ac_mask * fct.custom21)
2977     ,SUM(ac_mask * fct.custom22)
2978     ,SUM(ac_mask * fct.custom23)
2979     ,SUM(ac_mask * fct.custom24)
2980     ,SUM(ac_mask * fct.custom25)
2981     ,SUM(ac_mask * fct.custom26)
2982     ,SUM(ac_mask * fct.custom27)
2983     ,SUM(ac_mask * fct.custom28)
2984     ,SUM(ac_mask * fct.custom29)
2985     ,SUM(ac_mask * fct.custom30)
2986     ,SUM(prp_mask * fct.custom1)
2987     ,SUM(prp_mask * fct.custom2)
2988     ,SUM(prp_mask * fct.custom3)
2989     ,SUM(prp_mask * fct.custom4)
2990     ,SUM(prp_mask * fct.custom5)
2991     ,SUM(prp_mask * fct.custom6)
2992     ,SUM(prp_mask * fct.custom7)
2993     ,SUM(prp_mask * fct.custom8)
2994     ,SUM(prp_mask * fct.custom9)
2995     ,SUM(prp_mask * fct.custom10)
2996     ,SUM(prp_mask * fct.custom11)
2997     ,SUM(prp_mask * fct.custom12)
2998     ,SUM(prp_mask * fct.custom13)
2999     ,SUM(prp_mask * fct.custom14)
3000     ,SUM(prp_mask * fct.custom15)
3001     ,SUM(prp_mask * fct.custom16)
3002     ,SUM(prp_mask * fct.custom17)
3003     ,SUM(prp_mask * fct.custom18)
3004     ,SUM(prp_mask * fct.custom19)
3005     ,SUM(prp_mask * fct.custom20)
3006     ,SUM(prp_mask * fct.custom21)
3007     ,SUM(prp_mask * fct.custom22)
3008     ,SUM(prp_mask * fct.custom23)
3009     ,SUM(prp_mask * fct.custom24)
3010     ,SUM(prp_mask * fct.custom25)
3011     ,SUM(prp_mask * fct.custom26)
3012     ,SUM(prp_mask * fct.custom27)
3013     ,SUM(prp_mask * fct.custom28)
3014     ,SUM(prp_mask * fct.custom29)
3015     ,SUM(prp_mask * fct.custom30)
3016     INTO l_pji_facts
3017 	  FROM PJI_AC_XBS_ACCUM_F_V fct
3018 	  ,(SELECT time_id, period_type_id, pCalendarType calendar_type
3019              ,SIGN(bitand(record_type_id,g_ptd_record_type))  ptd_mask
3020              ,SIGN(bitand(record_type_id,g_qtd_record_type))  qtd_mask
3021              ,SIGN(bitand(record_type_id,g_ytd_record_type))  ytd_mask
3022              ,SIGN(bitand(record_type_id,g_itd_record_type)) itd_mask
3023              ,0 ac_mask
3024              ,0 prp_mask
3025       FROM
3026       PJI_TIME_CAL_RPT_STRUCT
3027       WHERE 1=1
3028       AND bitand(record_type_id,pTimeSlice) = record_type_id
3029       AND calendar_id = pCalendarId
3030       AND report_date = TO_DATE(pPeriodDateJulian,l_julianFormat)
3031       AND pCalendarType <> l_calendarType_E
3032       UNION ALL
3033       SELECT time_id, period_type_id, pCalendarType
3034                ,SIGN(bitand(record_type_id,g_ptd_record_type))  ptd_mask
3035                ,SIGN(bitand(record_type_id,g_qtd_record_type))  qtd_mask
3036                ,SIGN(bitand(record_type_id,g_ytd_record_type))  ytd_mask
3037                ,SIGN(bitand(record_type_id,g_itd_record_type)) itd_mask
3038                ,0 ac_mask
3039                ,0 prp_mask
3040       FROM
3041       PJI_TIME_RPT_STRUCT
3042       WHERE 1=1
3043       AND bitand(record_type_id,pTimeSlice) = record_type_id
3044       AND report_date = TO_DATE(pPeriodDateJulian,l_julianFormat)
3045       AND pCalendarType = l_calendarType_E
3046       UNION ALL
3047       -- at completion
3048       SELECT -1 time_id, 2048 period_type_id, l_calendarType_A calendar_type
3049             ,0 ptd_mask
3050             ,0 qtd_mask
3051             ,0 ytd_mask
3052             ,0 itd_mask
3053             ,1 ac_mask
3054             ,0 prp_mask
3055       FROM  dual
3056       UNION ALL
3057       -- prior period
3058       SELECT cal_period_id time_id, 32 period_type_id, pCalendarType calendar_type
3059         ,0 ptd_mask
3060         ,0 qtd_mask
3061         ,0 ytd_mask
3062         ,0 itd_mask
3063         ,0 ac_mask
3064         ,1 prp_mask
3065       FROM
3066       pji_time_cal_period_V
3067       WHERE 1=1
3068       AND TO_DATE(pPeriodDateJulian,l_julianFormat)-1 BETWEEN start_date AND end_date -- report_date
3069       AND calendar_id = pCalendarId
3070       AND pCalendarType <> l_calendarType_E
3071       UNION ALL
3072       SELECT ent_period_id time_id, 32 period_type_id, pCalendarType calendar_type
3073         ,0 ptd_mask
3074         ,0 qtd_mask
3075         ,0 ytd_mask
3076         ,0 itd_mask
3077         ,0 ac_mask
3078         ,1 prp_mask
3079       FROM
3080       pji_time_ent_period_V
3081       WHERE 1=1
3082       AND TO_DATE(pPeriodDateJulian,l_julianFormat)-1 BETWEEN start_date AND end_date -- report_date
3083       AND pCalendarType = l_calendarType_E
3084       ) TIME
3085 	  WHERE 1=1
3086     AND fct.project_id = pProjectId
3087     AND fct.project_element_id = pWBSElementId
3088     AND fct.currency_code = pCurrencyCode
3089     AND bitand(fct.curr_record_type_id,pCurrencyRecordType) = pCurrencyRecordType
3090     AND fct.prg_rollup_flag IN (l_PrgRollupFlag1,l_PrgRollupFlag2)
3091     AND fct.time_id        = TIME.time_id
3092     AND fct.period_type_id = TIME.period_type_id
3093     AND (fct.calendar_type = TIME.calendar_type OR TIME.calendar_type = l_calendarType_A);
3094 
3095   EXCEPTION
3096 
3097     WHEN NO_DATA_FOUND THEN
3098       -- in case no data is found, we still can go on and eventually return empty arrays
3099       l_pji_facts := l_pji_facts_null;
3100 
3101     WHEN OTHERS THEN
3102       l_sql_errm := SQLERRM();
3103       Pji_Rep_Util.Add_Message(
3104         p_app_short_name=>'PJI',
3105         p_msg_name=> 'PJI_REP_GENERIC_MSG',
3106         p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
3107         p_token1=>'PROC_NAME',
3108         p_token1_value=>'PJI_REP_MEASURE_UTIL; activity facts query SQL Error: ' || l_sql_errm);
3109   END;
3110 
3111   --
3112   -- need to consider the rollup element
3113   --
3114 /*
3115   BEGIN
3116     SELECT completed_percentage/100
3117     INTO l_completed_percentage
3118     FROM pji_rep_xbs_denorm
3119     WHERE project_id = pProjectId
3120     --AND parent_element_id = pWBSElementId
3121     AND child_element_id  = pWBSElementId
3122     AND rollup_flag = 'Y'
3123     AND wbs_version_id = pWBSVersionId;
3124   EXCEPTION
3125     WHEN TOO_MANY_ROWS THEN
3126       l_completed_percentage := NULL;
3127       x_return_status := Pji_Rep_Util.G_RET_STS_WARNING;
3128       Pji_Rep_Util.Add_Message(p_app_short_name=>'PJI',
3129                                p_msg_name=>'PJI_REP_INVALID_COMPLETED_PERC',
3130                                p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING);
3131     WHEN OTHERS THEN
3132       l_completed_percentage := NULL;
3133   END;
3134 */
3135 	Pji_Rep_Util.Derive_Percent_Complete(pProjectId,
3136   									   pWBSVersionId,
3137 									   pWBSElementId,
3138 									   'Y',
3139 									   pPeriodDateJulian,
3140 									   'FINANCIAL',
3141 									   pCalendarType,
3142 									   pCalendarId,
3143 									   pPrgRollup,
3144 									   l_completed_percentage,
3145 									   x_return_status,
3146 									   x_msg_count,
3147 									   x_msg_data);
3148 
3149   l_completed_percentage := l_completed_percentage/100;
3150   --
3151   -- Planned WORK Quantity.
3152  	-- Currently we don't do PLanned Work quantity
3153   --
3154   BEGIN
3155     SELECT
3156       wq_planned_quantity
3157       , wq_planned_quantity
3158       , wq_planned_quantity
3159       , wq_planned_quantity
3160       , wq_planned_quantity
3161       , wq_planned_quantity
3162     INTO l_planned_work_qt
3163     FROM pa_proj_elem_ver_schedule
3164     WHERE project_id = pProjectId
3165     AND calendar_id = pCalendarId
3166     AND element_version_id = pWBSElementId;
3167   EXCEPTION
3168     -- since we don't do work quantity, we simply swallow these errors
3169     WHEN OTHERS THEN
3170       l_planned_work_qt := l_amt_over_time_null;
3171   END;
3172 
3173 
3174 
3175   --
3176   -- Note:
3177  	-- Currently we don't do planned Work quantity related measures
3178   --
3179   BEGIN
3180     SELECT
3181       wq_planned_quantity
3182       , wq_planned_quantity
3183       , wq_planned_quantity
3184       , wq_planned_quantity
3185       , wq_planned_quantity
3186       , wq_planned_quantity
3187     INTO l_incr_work_qt
3188     FROM
3189       pa_proj_elem_ver_schedule   pevs
3190       , pa_percent_completes      pc
3191     WHERE pevs.project_id = pProjectId
3192     AND calendar_id = pCalendarId
3193     AND element_version_id = pWBSElementId
3194     AND pevs.project_id = pc.project_id
3195     AND pc.object_type = 'PA_TASKS'
3196     AND pc.published_flag = 'Y'
3197     AND pc.OBJECT_VERSION_ID = pWBSElementId;
3198   EXCEPTION
3199     -- since we don't do work quantity, we simply swallow these errors
3200     WHEN OTHERS THEN
3201       l_incr_work_qt := l_amt_over_time_null;
3202   END;
3203 
3204 
3205   --
3206   -- calculate the number of days since inception to date
3207   --
3208   BEGIN
3209     SELECT
3210       report_date.end_date - start_date +1
3211       , org_id
3212     INTO
3213       xDaysSinceITD
3214       , l_org_id
3215     FROM pa_projects_all,
3216 	( SELECT end_date
3217       FROM pji_time_ent_period_v
3218       WHERE 1=1
3219       AND TO_DATE(pPeriodDateJulian,'j') BETWEEN start_date AND end_date
3220       AND pCalendarType = 'E'
3221       UNION ALL
3222       SELECT end_date
3223       FROM pji_time_cal_period_v
3224       WHERE 1=1
3225       AND (TO_DATE(pPeriodDateJulian,'j') BETWEEN start_date AND end_date)
3226       AND calendar_id = pCalendarId
3227       AND pCalendarType <> 'E'
3228 	 ) report_date
3229     WHERE project_id = pProjectId;
3230 
3231   EXCEPTION
3232     WHEN OTHERS THEN
3233       xDaysSinceITD := NULL;
3234       l_org_id := 458; -- PJI default
3235   END;
3236 
3237 
3238   --
3239   -- calculate the number of days in the period
3240   --
3241   BEGIN
3242     SELECT days
3243     INTO xDaysInPeriod
3244     FROM (
3245       SELECT (end_date - start_date+1) days
3246       FROM pji_time_ent_period_v
3247       WHERE 1=1
3248       AND TO_DATE(pPeriodDateJulian,'j') BETWEEN start_date AND end_date
3249       AND pCalendarType = 'E'
3250       UNION ALL
3251       SELECT (end_date - start_date+1) days
3252       FROM pji_time_cal_period_v
3253       WHERE 1=1
3254       AND (TO_DATE(pPeriodDateJulian,'j') BETWEEN start_date AND end_date)
3255       AND calendar_id = pCalendarId
3256       AND pCalendarType <> 'E'
3257     );
3258   EXCEPTION
3259     --
3260     --WHEN NO_DATA_FOUND THEN
3261     --  xDaysInPeriod := 0;
3262     --  x_return_status := Pji_Rep_Util.G_RET_STS_WARNING;
3263     --  Pji_Rep_Util.Add_Message(p_app_short_name=> 'PJI',p_msg_name=> 'PJI_REP_INVALID_TIME_DIMENSION',p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING);
3264     --WHEN TOO_MANY_ROWS THEN
3265     --  xDaysInPeriod := 0;
3266     --  x_return_status := Pji_Rep_Util.G_RET_STS_WARNING;
3267     --  Pji_Rep_Util.Add_Message(p_app_short_name=> 'PJI',p_msg_name=> 'PJI_REP_INVALID_TIME_DIMENSION',p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING);
3268     --
3269     WHEN OTHERS THEN
3270       xDaysInPeriod := NULL;
3271       --x_return_status := Pji_Rep_Util.G_RET_STS_WARNING;
3272       --Pji_Rep_Util.Add_Message(p_app_short_name=> 'PJI',p_msg_name=> 'PJI_REP_INVALID_TIME_DIMENSION',p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING);
3273   END;
3274 
3275 
3276   --
3277   -- get the HTML code for the color indicators for each PTD measure
3278   --
3279 
3280   ptd_measure_ids_tbl := SYSTEM.PA_NUM_TBL_TYPE();
3281   ptd_measure_ids_tbl.EXTEND(p_measure_set_code.LAST);
3282   qtd_measure_ids_tbl := SYSTEM.PA_NUM_TBL_TYPE();
3283   qtd_measure_ids_tbl.EXTEND(p_measure_set_code.LAST);
3284   ytd_measure_ids_tbl := SYSTEM.PA_NUM_TBL_TYPE();
3285   ytd_measure_ids_tbl.EXTEND(p_measure_set_code.LAST);
3286   itd_measure_ids_tbl := SYSTEM.PA_NUM_TBL_TYPE();
3287   itd_measure_ids_tbl.EXTEND(p_measure_set_code.LAST);
3288   ac_measure_ids_tbl  := SYSTEM.PA_NUM_TBL_TYPE();
3289   ac_measure_ids_tbl.EXTEND(p_measure_set_code.LAST);
3290   prp_measure_ids_tbl := SYSTEM.PA_NUM_TBL_TYPE();
3291   prp_measure_ids_tbl.EXTEND(p_measure_set_code.LAST);
3292 
3293 
3294   --
3295   -- derive the measure IDs for all the input measure set codes
3296   --
3297 
3298   IF pCallingType = g_Prepare THEN
3299 
3300 	  IF (pPrgRollup <> 'Y') THEN
3301 	  	  -- this query condition has to be the same with the mesaure_set_code query in preparedata
3302 		  SELECT
3303 		   MAX(DECODE (XTD_TYPE,'PTD',m.MEASURE_ID,NULL)),
3304 		   MAX(DECODE (XTD_TYPE,'QTD',m.MEASURE_ID,NULL)),
3305 		   MAX(DECODE (XTD_TYPE,'YTD',m.MEASURE_ID,NULL)),
3306 		   MAX(DECODE (XTD_TYPE,'ITD',m.MEASURE_ID,NULL)),
3307 		   MAX(DECODE (XTD_TYPE,'AC',m.MEASURE_ID,NULL)),
3308 		   MAX(DECODE (XTD_TYPE,'PRP',m.MEASURE_ID,NULL))
3309 		  BULK COLLECT INTO
3310 		       ptd_measure_ids_tbl
3311 		     , qtd_measure_ids_tbl
3312 		     , ytd_measure_ids_tbl
3313 		     , itd_measure_ids_tbl
3314 		     , ac_measure_ids_tbl
3315 		     , prp_measure_ids_tbl
3316 		  FROM
3317 		    pji_mt_measures_b  m,
3318 			pji_mt_measure_sets_b S
3319 		  WHERE 1=1
3320 		   AND m.measure_set_code = S.measure_set_code
3321 		   AND S.measure_set_type IN ('SEEDED', 'CUSTOM_STORED', 'CUSTOM_CALC')
3322 		   AND m.measure_set_code LIKE 'PPF%'
3323 		   GROUP BY m.measure_set_code
3324 		   ORDER BY m.measure_set_code;
3325 
3326 		  x_ptd_html := Pa_Perf_Excp_Utils.get_measure_indicator_list('PA_PROJECTS',
3327 		                  pProjectId, ptd_measure_ids_tbl, pCalendarType, pPeriodName, p_raw_text_flag,x_ptd_trans_id,x_ptd_meaning);
3328 		 /* Changes for Bug 6914287 starts */
3329 		  x_qtd_html := Pa_Perf_Excp_Utils.get_measure_indicator_list('PA_PROJECTS',
3330 		                  pProjectId, qtd_measure_ids_tbl, pCalendarType, pPeriodName, p_raw_text_flag,x_qtd_trans_id,x_qtd_meaning);
3331 
3332 		  x_ytd_html := Pa_Perf_Excp_Utils.get_measure_indicator_list('PA_PROJECTS',
3333 		                  pProjectId, ytd_measure_ids_tbl, pCalendarType, pPeriodName, p_raw_text_flag,x_ytd_trans_id,x_ytd_meaning);
3334 		/* Changes for Bug 6914287 ends */
3335 		  x_itd_html := Pa_Perf_Excp_Utils.get_measure_indicator_list('PA_PROJECTS',
3336 		                  pProjectId, itd_measure_ids_tbl, pCalendarType, pPeriodName, p_raw_text_flag,x_itd_trans_id,x_itd_meaning);
3337 
3338 		  x_ac_html := Pa_Perf_Excp_Utils.get_measure_indicator_list('PA_PROJECTS',
3339 		                  pProjectId, ac_measure_ids_tbl, pCalendarType, pPeriodName, p_raw_text_flag,x_ac_trans_id,x_ac_meaning);
3340 
3341 		/*  x_prp_html := Pa_Perf_Excp_Utils.get_measure_indicator_list('PA_PROJECTS',
3342 		                  pProjectId, prp_measure_ids_tbl, pCalendarType, l_period_name, p_raw_text_flag,x_prp_trans_id,l_temp_excp_meaning);
3343 		*/
3344 	END IF;
3345   ELSIF pCallingType = g_ProjList THEN
3346 	  x_exception_indicator_tbl := Pa_Perf_Excp_Utils.get_measure_indicator_list('PA_PROJECTS',
3347 	                  pProjectId, p_measure_id_tbl, pCalendarType, pPeriodName, p_raw_text_flag,x_ptd_trans_id,l_temp_excp_meaning);
3348   END IF;
3349 
3350   --
3351   -- calculate measure color indicators
3352   --
3353 
3354   IF g_debug_mode = 'Y' THEN
3355 	  Pji_Utils.WRITE2LOG('before calling exception API',TRUE, g_msg_level_runtime_info);
3356   END IF;
3357 
3358 
3359   IF g_debug_mode = 'Y' THEN
3360 	  Pji_Utils.WRITE2LOG('after calling exception API',TRUE, g_msg_level_runtime_info);
3361   END IF;
3362 
3363   --
3364   -- the Pa_Perf_Excp_Utils.get_measure_indicator_list could return a NULL
3365   -- collection, so I have to eventually create collections of the tight
3366   -- length, because at the exit of retrieveData I expect to have all the
3367   -- output collections long as the p_measure_set_code input collection.
3368   --
3369 
3370   IF x_ptd_html IS NULL THEN
3371     x_ptd_html := SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
3372     x_ptd_html.EXTEND(p_measure_set_code.LAST);
3373 	x_ptd_trans_id := SYSTEM.pa_NUM_TBL_TYPE();
3374 	x_ptd_trans_id.extend(p_measure_set_code.LAST);
3375 	x_ptd_meaning := SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3376 	x_ptd_meaning.extend(p_measure_set_code.LAST);
3377   END IF;
3378 
3379   IF x_qtd_html IS NULL THEN
3380     x_qtd_html := SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
3381     x_qtd_html.EXTEND(p_measure_set_code.LAST);
3382 	x_qtd_trans_id := SYSTEM.pa_NUM_TBL_TYPE();
3383 	x_qtd_trans_id.extend(p_measure_set_code.LAST);
3384 	x_qtd_meaning := SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3385 	x_qtd_meaning.extend(p_measure_set_code.LAST);
3386   END IF;
3387 
3388   IF x_ytd_html IS NULL THEN
3389     x_ytd_html := SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
3390     x_ytd_html.EXTEND(p_measure_set_code.LAST);
3391 	x_ytd_trans_id := SYSTEM.pa_NUM_TBL_TYPE();
3392 	x_ytd_trans_id.extend(p_measure_set_code.LAST);
3393 	x_ytd_meaning := SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3394 	x_ytd_meaning.extend(p_measure_set_code.LAST);
3395   END IF;
3396 
3397   IF x_itd_html IS NULL THEN
3398     x_itd_html := SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
3399     x_itd_html.EXTEND(p_measure_set_code.LAST);
3400 	x_itd_trans_id := SYSTEM.pa_NUM_TBL_TYPE();
3401 	x_itd_trans_id.extend(p_measure_set_code.LAST);
3402 	x_itd_meaning := SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3403 	x_itd_meaning.extend(p_measure_set_code.LAST);
3404   END IF;
3405 
3406   IF x_ac_html IS NULL THEN
3407     x_ac_html := SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
3408     x_ac_html.EXTEND(p_measure_set_code.LAST);
3409 	x_ac_trans_id := SYSTEM.pa_NUM_TBL_TYPE();
3410 	x_ac_trans_id.extend(p_measure_set_code.LAST);
3411 	x_ac_meaning := SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3412 	x_ac_meaning.extend(p_measure_set_code.LAST);
3413   END IF;
3414 
3415   IF x_prp_html IS NULL THEN
3416     x_prp_html := SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
3417     x_prp_html.EXTEND(p_measure_set_code.LAST);
3418 	x_prp_trans_id := SYSTEM.pa_NUM_TBL_TYPE();
3419 	x_prp_trans_id.extend(p_measure_set_code.LAST);
3420 	x_prp_meaning := SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3421 	x_prp_meaning.extend(p_measure_set_code.LAST);
3422   END IF;
3423 
3424   --FOR i IN 1..x_itd_html.last LOOP
3425   --  dbms_output.put_line('meas_id(' || i || ')= ' || itd_measure_ids_tbl(i)||'; itd_html(' || i || ')= ' || x_itd_html(i));
3426   --END LOOP;
3427 
3428 
3429   --
3430   -- initialize all the remaining output collections
3431   --
3432   x_measure_type:=  SYSTEM.PA_VARCHAR2_30_TBL_TYPE();
3433   x_ptd_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3434   x_qtd_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3435   x_ytd_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3436   x_itd_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3437   x_ac_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3438   x_prp_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3439 
3440   x_measure_type.EXTEND(p_measure_set_code.LAST);
3441   x_ptd_value.EXTEND(p_measure_set_code.LAST);
3442   x_qtd_value.EXTEND(p_measure_set_code.LAST);
3443   x_ytd_value.EXTEND(p_measure_set_code.LAST);
3444   x_itd_value.EXTEND(p_measure_set_code.LAST);
3445   x_ac_value.EXTEND(p_measure_set_code.LAST);
3446   x_prp_value.EXTEND(p_measure_set_code.LAST);
3447 
3448   l_ptd_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3449   l_qtd_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3450   l_ytd_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3451   l_itd_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3452   l_ac_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3453   l_prp_value		:=  SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
3454 
3455   l_ptd_value.EXTEND(p_measure_set_code.LAST);
3456   l_qtd_value.EXTEND(p_measure_set_code.LAST);
3457   l_ytd_value.EXTEND(p_measure_set_code.LAST);
3458   l_itd_value.EXTEND(p_measure_set_code.LAST);
3459   l_ac_value.EXTEND(p_measure_set_code.LAST);
3460   l_prp_value.EXTEND(p_measure_set_code.LAST);
3461 
3462   /*x_qtd_html    :=  SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
3463   x_ytd_html    :=  SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
3464   x_ac_html     :=  SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
3465   x_prp_html    :=  SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
3466   x_qtd_html.EXTEND(p_measure_set_code.LAST);
3467   x_ytd_html.EXTEND(p_measure_set_code.LAST);
3468   x_ac_html.EXTEND(p_measure_set_code.LAST);
3469   x_prp_html.EXTEND(p_measure_set_code.LAST);
3470   */
3471 
3472   --
3473   -- initialize custom measures arrays
3474   --
3475 
3476   l_seeded_measures             := SYSTEM.PA_Num_Tbl_Type();
3477 
3478   l_fp_custom_measures_ptd := SYSTEM.PA_NUM_TBL_TYPE(
3479   						   	    l_overview_type(l_actual_index).ptd_custom_1,
3480 								l_overview_type(l_actual_index).ptd_custom_2,
3481 								l_overview_type(l_actual_index).ptd_custom_3,
3482 								l_overview_type(l_actual_index).ptd_custom_4,
3483 								l_overview_type(l_actual_index).ptd_custom_5,
3484 								l_overview_type(l_actual_index).ptd_custom_6,
3485 								l_overview_type(l_actual_index).ptd_custom_7,
3486 								l_overview_type(l_actual_index).ptd_custom_8,
3487 								l_overview_type(l_actual_index).ptd_custom_9,
3488 								l_overview_type(l_actual_index).ptd_custom_10,
3489 								l_overview_type(l_actual_index).ptd_custom_11,
3490 								l_overview_type(l_actual_index).ptd_custom_12,
3491 								l_overview_type(l_actual_index).ptd_custom_13,
3492 								l_overview_type(l_actual_index).ptd_custom_14,
3493 								l_overview_type(l_actual_index).ptd_custom_15
3494 								);
3495   l_fp_custom_measures_qtd := SYSTEM.PA_NUM_TBL_TYPE(
3496   								l_overview_type(l_actual_index).qtd_custom_1,
3497 								l_overview_type(l_actual_index).qtd_custom_2,
3498 								l_overview_type(l_actual_index).qtd_custom_3,
3499 								l_overview_type(l_actual_index).qtd_custom_4,
3500 								l_overview_type(l_actual_index).qtd_custom_5,
3501 								l_overview_type(l_actual_index).qtd_custom_6,
3502 								l_overview_type(l_actual_index).qtd_custom_7,
3503 								l_overview_type(l_actual_index).qtd_custom_8,
3504 								l_overview_type(l_actual_index).qtd_custom_9,
3505 								l_overview_type(l_actual_index).qtd_custom_10,
3506 								l_overview_type(l_actual_index).qtd_custom_11,
3507 								l_overview_type(l_actual_index).qtd_custom_12,
3508 								l_overview_type(l_actual_index).qtd_custom_13,
3509 								l_overview_type(l_actual_index).qtd_custom_14,
3510 								l_overview_type(l_actual_index).qtd_custom_15
3511 								);
3512   l_fp_custom_measures_ytd := SYSTEM.PA_NUM_TBL_TYPE(
3513   								l_overview_type(l_actual_index).ytd_custom_1,
3514 								l_overview_type(l_actual_index).ytd_custom_2,
3515 								l_overview_type(l_actual_index).ytd_custom_3,
3516 								l_overview_type(l_actual_index).ytd_custom_4,
3517 								l_overview_type(l_actual_index).ytd_custom_5,
3518 								l_overview_type(l_actual_index).ytd_custom_6,
3519 								l_overview_type(l_actual_index).ytd_custom_7,
3520 								l_overview_type(l_actual_index).ytd_custom_8,
3521 								l_overview_type(l_actual_index).ytd_custom_9,
3522 								l_overview_type(l_actual_index).ytd_custom_10,
3523 								l_overview_type(l_actual_index).ytd_custom_11,
3524 								l_overview_type(l_actual_index).ytd_custom_12,
3525 								l_overview_type(l_actual_index).ytd_custom_13,
3526 								l_overview_type(l_actual_index).ytd_custom_14,
3527 								l_overview_type(l_actual_index).ytd_custom_15
3528 								);
3529   l_fp_custom_measures_itd := SYSTEM.PA_NUM_TBL_TYPE(
3530   								l_overview_type(l_actual_index).itd_custom_1,
3531 								l_overview_type(l_actual_index).itd_custom_2,
3532 								l_overview_type(l_actual_index).itd_custom_3,
3533 								l_overview_type(l_actual_index).itd_custom_4,
3534 								l_overview_type(l_actual_index).itd_custom_5,
3535 								l_overview_type(l_actual_index).itd_custom_6,
3536 								l_overview_type(l_actual_index).itd_custom_7,
3537 								l_overview_type(l_actual_index).itd_custom_8,
3538 								l_overview_type(l_actual_index).itd_custom_9,
3539 								l_overview_type(l_actual_index).itd_custom_10,
3540 								l_overview_type(l_actual_index).itd_custom_11,
3541 								l_overview_type(l_actual_index).itd_custom_12,
3542 								l_overview_type(l_actual_index).itd_custom_13,
3543 								l_overview_type(l_actual_index).itd_custom_14,
3544 								l_overview_type(l_actual_index).itd_custom_15
3545 								);
3546   l_fp_custom_measures_ac  := SYSTEM.PA_NUM_TBL_TYPE(
3547   								l_overview_type(l_actual_index).ac_custom_1,
3548 								l_overview_type(l_actual_index).ac_custom_2,
3549 								l_overview_type(l_actual_index).ac_custom_3,
3550 								l_overview_type(l_actual_index).ac_custom_4,
3551 								l_overview_type(l_actual_index).ac_custom_5,
3552 								l_overview_type(l_actual_index).ac_custom_6,
3553 								l_overview_type(l_actual_index).ac_custom_7,
3554 								l_overview_type(l_actual_index).ac_custom_8,
3555 								l_overview_type(l_actual_index).ac_custom_9,
3556 								l_overview_type(l_actual_index).ac_custom_10,
3557 								l_overview_type(l_actual_index).ac_custom_11,
3558 								l_overview_type(l_actual_index).ac_custom_12,
3559 								l_overview_type(l_actual_index).ac_custom_13,
3560 								l_overview_type(l_actual_index).ac_custom_14,
3561 								l_overview_type(l_actual_index).ac_custom_15
3562 								);
3563   l_fp_custom_measures_prp := SYSTEM.PA_NUM_TBL_TYPE(
3564   								l_overview_type(l_actual_index).prp_custom_1,
3565 								l_overview_type(l_actual_index).prp_custom_2,
3566 								l_overview_type(l_actual_index).prp_custom_3,
3567 								l_overview_type(l_actual_index).prp_custom_4,
3568 								l_overview_type(l_actual_index).prp_custom_5,
3569 								l_overview_type(l_actual_index).prp_custom_6,
3570 								l_overview_type(l_actual_index).prp_custom_7,
3571 								l_overview_type(l_actual_index).prp_custom_8,
3572 								l_overview_type(l_actual_index).prp_custom_9,
3573 								l_overview_type(l_actual_index).prp_custom_10,
3574 								l_overview_type(l_actual_index).prp_custom_11,
3575 								l_overview_type(l_actual_index).prp_custom_12,
3576 								l_overview_type(l_actual_index).prp_custom_13,
3577 								l_overview_type(l_actual_index).prp_custom_14,
3578 								l_overview_type(l_actual_index).prp_custom_15
3579 								);
3580 
3581   l_ac_custom_measures_ptd := SYSTEM.PA_NUM_TBL_TYPE(
3582   								l_pji_facts.ptd_custom_1,
3583 								l_pji_facts.ptd_custom_2,
3584 								l_pji_facts.ptd_custom_3,
3585 								l_pji_facts.ptd_custom_4,
3586 								l_pji_facts.ptd_custom_5,
3587 								l_pji_facts.ptd_custom_6,
3588 								l_pji_facts.ptd_custom_7,
3589 								l_pji_facts.ptd_custom_8,
3590 								l_pji_facts.ptd_custom_9,
3591 								l_pji_facts.ptd_custom_10,
3592 								l_pji_facts.ptd_custom_11,
3593 								l_pji_facts.ptd_custom_12,
3594 								l_pji_facts.ptd_custom_13,
3595 								l_pji_facts.ptd_custom_14,
3596 								l_pji_facts.ptd_custom_15
3597 								);
3598   l_ac_custom_measures_qtd := SYSTEM.PA_NUM_TBL_TYPE(
3599   								l_pji_facts.qtd_custom_1,
3600 								l_pji_facts.qtd_custom_2,
3601 								l_pji_facts.qtd_custom_3,
3602 								l_pji_facts.qtd_custom_4,
3603 								l_pji_facts.qtd_custom_5,
3604 								l_pji_facts.qtd_custom_6,
3605 								l_pji_facts.qtd_custom_7,
3606 								l_pji_facts.qtd_custom_8,
3607 								l_pji_facts.qtd_custom_9,
3608 								l_pji_facts.qtd_custom_10,
3609 								l_pji_facts.qtd_custom_11,
3610 								l_pji_facts.qtd_custom_12,
3611 								l_pji_facts.qtd_custom_13,
3612 								l_pji_facts.qtd_custom_14,
3613 								l_pji_facts.qtd_custom_15
3614 								);
3615   l_ac_custom_measures_ytd := SYSTEM.PA_NUM_TBL_TYPE(
3616   								l_pji_facts.ytd_custom_1,
3617 								l_pji_facts.ytd_custom_2,
3618 								l_pji_facts.ytd_custom_3,
3619 								l_pji_facts.ytd_custom_4,
3620 								l_pji_facts.ytd_custom_5,
3621 								l_pji_facts.ytd_custom_6,
3622 								l_pji_facts.ytd_custom_7,
3623 								l_pji_facts.ytd_custom_8,
3624 								l_pji_facts.ytd_custom_9,
3625 								l_pji_facts.ytd_custom_10,
3626 								l_pji_facts.ytd_custom_11,
3627 								l_pji_facts.ytd_custom_12,
3628 								l_pji_facts.ytd_custom_13,
3629 								l_pji_facts.ytd_custom_14,
3630 								l_pji_facts.ytd_custom_15
3631 								);
3632   l_ac_custom_measures_itd := SYSTEM.PA_NUM_TBL_TYPE(
3633   								l_pji_facts.itd_custom_1,
3634 								l_pji_facts.itd_custom_2,
3635 								l_pji_facts.itd_custom_3,
3636 								l_pji_facts.itd_custom_4,
3637 								l_pji_facts.itd_custom_5,
3638 								l_pji_facts.itd_custom_6,
3639 								l_pji_facts.itd_custom_7,
3640 								l_pji_facts.itd_custom_8,
3641 								l_pji_facts.itd_custom_9,
3642 								l_pji_facts.itd_custom_10,
3643 								l_pji_facts.itd_custom_11,
3644 								l_pji_facts.itd_custom_12,
3645 								l_pji_facts.itd_custom_13,
3646 								l_pji_facts.itd_custom_14,
3647 								l_pji_facts.itd_custom_15
3648 								);
3649   l_ac_custom_measures_ac  := SYSTEM.PA_NUM_TBL_TYPE(
3650   								l_pji_facts.ac_custom_1,
3651 								l_pji_facts.ac_custom_2,
3652 								l_pji_facts.ac_custom_3,
3653 								l_pji_facts.ac_custom_4,
3654 								l_pji_facts.ac_custom_5,
3655 								l_pji_facts.ac_custom_6,
3656 								l_pji_facts.ac_custom_7,
3657 								l_pji_facts.ac_custom_8,
3658 								l_pji_facts.ac_custom_9,
3659 								l_pji_facts.ac_custom_10,
3660 								l_pji_facts.ac_custom_11,
3661 								l_pji_facts.ac_custom_12,
3662 								l_pji_facts.ac_custom_13,
3663 								l_pji_facts.ac_custom_14,
3664 								l_pji_facts.ac_custom_15
3665 								);
3666   l_ac_custom_measures_prp := SYSTEM.PA_NUM_TBL_TYPE(
3667   								l_pji_facts.prp_custom_1,
3668 								l_pji_facts.prp_custom_2,
3669 								l_pji_facts.prp_custom_3,
3670 								l_pji_facts.prp_custom_4,
3671 								l_pji_facts.prp_custom_5,
3672 								l_pji_facts.prp_custom_6,
3673 								l_pji_facts.prp_custom_7,
3674 								l_pji_facts.prp_custom_8,
3675 								l_pji_facts.prp_custom_9,
3676 								l_pji_facts.prp_custom_10,
3677 								l_pji_facts.prp_custom_11,
3678 								l_pji_facts.prp_custom_12,
3679 								l_pji_facts.prp_custom_13,
3680 								l_pji_facts.prp_custom_14,
3681 								l_pji_facts.prp_custom_15
3682 								);
3683 
3684   l_seeded_measure_count :=45;
3685   l_seeded_measures.extend(l_seeded_measure_count);
3686 
3687   --
3688   -- compute AC (Activity facts related) Custom Measures
3689   --
3690 
3691   l_seeded_measures(1) := l_pji_facts.ptd_additional_funding_amount;
3692   l_seeded_measures(2) := l_pji_facts.ptd_ar_invoice_count;
3693   l_seeded_measures(3) := l_pji_facts.ptd_initial_funding_amount;
3694   l_seeded_measures(4) := l_pji_facts.ptd_revenue_writeoff;
3695 
3696   Pji_Calc_Engine.Compute_AC_Measures(l_seeded_measures,
3697     l_ac_calc_custom_measures_ptd, x_return_status, x_msg_count, x_msg_data);
3698 
3699   l_seeded_measures(1) := l_pji_facts.qtd_additional_funding_amount;
3700   l_seeded_measures(2) := l_pji_facts.qtd_ar_invoice_count;
3701   l_seeded_measures(3) := l_pji_facts.qtd_initial_funding_amount;
3702   l_seeded_measures(4) := l_pji_facts.qtd_revenue_writeoff;
3703 
3704   Pji_Calc_Engine.Compute_AC_Measures(l_seeded_measures,
3705     l_ac_calc_custom_measures_qtd, x_return_status, x_msg_count, x_msg_data);
3706 
3707   l_seeded_measures(1) := l_pji_facts.ytd_additional_funding_amount;
3708   l_seeded_measures(2) := l_pji_facts.ytd_ar_invoice_count;
3709   l_seeded_measures(3) := l_pji_facts.ytd_initial_funding_amount;
3710   l_seeded_measures(4) := l_pji_facts.ytd_revenue_writeoff;
3711 
3712   Pji_Calc_Engine.Compute_AC_Measures(l_seeded_measures,
3713     l_ac_calc_custom_measures_ytd, x_return_status, x_msg_count, x_msg_data);
3714 
3715   l_seeded_measures(1) := l_pji_facts.itd_additional_funding_amount;
3716   l_seeded_measures(2) := l_pji_facts.itd_ar_invoice_count;
3717   l_seeded_measures(3) := l_pji_facts.itd_initial_funding_amount;
3718   l_seeded_measures(4) := l_pji_facts.itd_revenue_writeoff;
3719 
3720   Pji_Calc_Engine.Compute_AC_Measures(l_seeded_measures,
3721     l_ac_calc_custom_measures_itd, x_return_status, x_msg_count, x_msg_data);
3722 
3723   l_seeded_measures(1) := l_pji_facts.ac_additional_funding_amount;
3724   l_seeded_measures(2) := l_pji_facts.ac_ar_invoice_count;
3725   l_seeded_measures(3) := l_pji_facts.ac_initial_funding_amount;
3726   l_seeded_measures(4) := l_pji_facts.ac_revenue_writeoff;
3727 
3728   Pji_Calc_Engine.Compute_AC_Measures(l_seeded_measures,
3729     l_ac_calc_custom_measures_ac, x_return_status, x_msg_count, x_msg_data);
3730 
3731   l_seeded_measures(1) := l_pji_facts.prp_additional_funding_amount;
3732   l_seeded_measures(2) := l_pji_facts.prp_ar_invoice_count;
3733   l_seeded_measures(3) := l_pji_facts.prp_initial_funding_amount;
3734   l_seeded_measures(4) := l_pji_facts.prp_revenue_writeoff;
3735 
3736   Pji_Calc_Engine.Compute_ac_Measures(l_seeded_measures,
3737     l_ac_calc_custom_measures_prp, x_return_status, x_msg_count, x_msg_data);
3738 
3739   --
3740   -- compute FP custom measures
3741   --
3742 
3743 -- input values array preparation for PTD
3744   l_seeded_measures(1)  := l_overview_type(l_actual_index).ptd_bill_equipment_hrs;
3745   l_seeded_measures(2)  := l_overview_type(l_actual_index).ptd_bill_burdened_cost;
3746   l_seeded_measures(3)  := l_overview_type(l_actual_index).ptd_bill_labor_hrs;
3747   l_seeded_measures(4)  := l_overview_type(l_actual_index).ptd_burdened_cost -
3748   						   l_overview_type(l_actual_index).ptd_raw_cost;
3749 /*  l_seeded_measures(5)  := l_overview_type(l_cost_budget2_index).ptd_burdened_cost;
3750   l_seeded_measures(6)  := l_overview_type(l_cost_budget2_index).ptd_equipment_hrs;
3751   l_seeded_measures(7)  := l_overview_type(l_cost_budget2_index).ptd_labor_hrs;
3752   l_seeded_measures(8)  := l_overview_type(l_rev_budget2_index).ptd_revenue;
3753   l_seeded_measures(9)  := l_overview_type(l_cost_budget2_index).ptd_raw_cost; commented for bug 9485251 */
3754   /* Order changed for bug 9485251 */
3755   l_seeded_measures(5)  := l_overview_type(l_cost_budget_index).ptd_burdened_cost;
3756   l_seeded_measures(6)  := l_overview_type(l_cost_budget_index).ptd_equipment_hrs;
3757   l_seeded_measures(7) := l_overview_type(l_cost_budget_index).ptd_labor_hrs;
3758   l_seeded_measures(8) := l_overview_type(l_rev_budget_index).ptd_revenue;
3759   l_seeded_measures(9)  := l_overview_type(l_cost_budget_index).ptd_raw_cost;
3760   l_seeded_measures(10)  := l_overview_type(l_actual_index).ptd_capitalizable_brdn_cost ;
3761   l_seeded_measures(11)  := l_overview_type(l_actual_index).ptd_equipment_brdn_cost;
3762   l_seeded_measures(12) := l_overview_type(l_cost_forecast_index).ptd_burdened_cost;
3763   l_seeded_measures(13) := l_overview_type(l_cost_forecast_index).ptd_equipment_hrs;
3764   l_seeded_measures(14) := l_overview_type(l_cost_forecast_index).ptd_labor_hrs;
3765   l_seeded_measures(15) := l_overview_type(l_rev_forecast_index).ptd_revenue;
3766   l_seeded_measures(16) := l_overview_type(l_actual_index).ptd_labor_raw_cost;
3767   l_seeded_measures(17) := l_overview_type(l_actual_index).ptd_burdened_cost -
3768                            l_overview_type(l_actual_index).ptd_bill_burdened_cost;
3769   l_seeded_measures(18) := l_overview_type(l_actual_index).ptd_equipment_hrs -
3770                            l_overview_type(l_actual_index).ptd_bill_equipment_hrs ;
3771   l_seeded_measures(19) := l_overview_type(l_actual_index).ptd_labor_hrs -
3772                            l_overview_type(l_actual_index).ptd_bill_labor_hrs ;
3773   l_seeded_measures(20) := l_overview_type(l_actual_index).ptd_burdened_cost -
3774                            NVL(l_overview_type(l_actual_index).ptd_bill_burdened_cost,0) -
3775 						   l_overview_type(l_actual_index).ptd_capitalizable_brdn_cost ;
3776 /*  l_seeded_measures(26) := l_overview_type(l_orig_cost_budget2_index).ptd_burdened_cost;
3777   l_seeded_measures(27) := l_overview_type(l_orig_cost_budget2_index).ptd_equipment_hrs;
3778   l_seeded_measures(28) := l_overview_type(l_orig_cost_budget2_index).ptd_labor_hrs;
3779   l_seeded_measures(29) := l_overview_type(l_orig_rev_budget2_index).ptd_revenue; commented for bug 9485251 */
3780   /* Order changed for bug 9485251 */
3781   l_seeded_measures(21) := l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost;
3782   l_seeded_measures(22) := l_overview_type(l_orig_cost_budget_index).ptd_equipment_hrs;
3783   l_seeded_measures(23) := l_overview_type(l_orig_cost_budget_index).ptd_labor_hrs;
3784   l_seeded_measures(24) := l_overview_type(l_orig_rev_budget_index).ptd_revenue;
3785   l_seeded_measures(25) := l_overview_type(l_actual_index).ptd_oth_committed_cost;
3786   l_seeded_measures(26) := l_overview_type(l_actual_index).ptd_po_committed_cost;
3787   l_seeded_measures(27) := l_completed_percentage;
3788   l_seeded_measures(28) := l_overview_type(l_actual_index).ptd_pr_committed_cost;
3789   l_seeded_measures(29) := l_overview_type(l_actual_index).ptd_revenue;
3790   l_seeded_measures(30) := l_overview_type(l_actual_index).ptd_raw_cost;
3791   l_seeded_measures(31) := l_overview_type(l_actual_index).ptd_sup_inv_committed_cost;
3792   l_seeded_measures(32) := l_overview_type(l_actual_index).ptd_burdened_cost;
3793   l_seeded_measures(33) := l_overview_type(l_actual_index).ptd_sup_inv_committed_cost +
3794      					   l_overview_type(l_actual_index).ptd_oth_committed_cost +
3795 						   l_overview_type(l_actual_index).ptd_po_committed_cost +
3796 						   l_overview_type(l_actual_index).ptd_pr_committed_cost;
3797   l_seeded_measures(34) := l_overview_type(l_actual_index).ptd_equipment_hrs;
3798   l_seeded_measures(35) := l_overview_type(l_actual_index).ptd_labor_burdened_cost;
3799   l_seeded_measures(36) := l_overview_type(l_actual_index).ptd_labor_hrs;
3800   -- compute PTD custom FP measures
3801   Pji_Calc_Engine.Compute_FP_Measures(l_seeded_measures,
3802     l_fp_calc_custom_measures_ptd, x_return_status, x_msg_count, x_msg_data);
3803 
3804   -- input values array preparation for QTD
3805   l_seeded_measures(1)  := l_overview_type(l_actual_index).qtd_bill_equipment_hrs;
3806   l_seeded_measures(2)  := l_overview_type(l_actual_index).qtd_bill_burdened_cost;
3807   l_seeded_measures(3)  := l_overview_type(l_actual_index).qtd_bill_labor_hrs;
3808   l_seeded_measures(4)  := l_overview_type(l_actual_index).qtd_burdened_cost -
3809   						   l_overview_type(l_actual_index).qtd_raw_cost;
3810 /*  l_seeded_measures(5)  := l_overview_type(l_cost_budget2_index).qtd_burdened_cost;
3811   l_seeded_measures(6)  := l_overview_type(l_cost_budget2_index).qtd_equipment_hrs;
3812   l_seeded_measures(7)  := l_overview_type(l_cost_budget2_index).qtd_labor_hrs;
3813   l_seeded_measures(8)  := l_overview_type(l_rev_budget2_index).qtd_revenue;
3814   l_seeded_measures(9)  := l_overview_type(l_cost_budget2_index).qtd_raw_cost; commented for bug 9485251 */
3815   /* Order changed for bug 9485251 */
3816   l_seeded_measures(5)  := l_overview_type(l_cost_budget_index).qtd_burdened_cost;
3817   l_seeded_measures(6)  := l_overview_type(l_cost_budget_index).qtd_equipment_hrs;
3818   l_seeded_measures(7) := l_overview_type(l_cost_budget_index).qtd_labor_hrs;
3819   l_seeded_measures(8) := l_overview_type(l_rev_budget_index).qtd_revenue;
3820   l_seeded_measures(9)  := l_overview_type(l_cost_budget_index).qtd_raw_cost;
3821   l_seeded_measures(10)  := l_overview_type(l_actual_index).qtd_capitalizable_brdn_cost ;
3822   l_seeded_measures(11)  := l_overview_type(l_actual_index).qtd_equipment_brdn_cost;
3823   l_seeded_measures(12) := l_overview_type(l_cost_forecast_index).qtd_burdened_cost;
3824   l_seeded_measures(13) := l_overview_type(l_cost_forecast_index).qtd_equipment_hrs;
3825   l_seeded_measures(14) := l_overview_type(l_cost_forecast_index).qtd_labor_hrs;
3826   l_seeded_measures(15) := l_overview_type(l_rev_forecast_index).qtd_revenue;
3827   l_seeded_measures(16) := l_overview_type(l_actual_index).qtd_labor_raw_cost;
3828   l_seeded_measures(17) := l_overview_type(l_actual_index).qtd_burdened_cost -
3829                            l_overview_type(l_actual_index).qtd_bill_burdened_cost;
3830   l_seeded_measures(18) := l_overview_type(l_actual_index).qtd_equipment_hrs -
3831                            l_overview_type(l_actual_index).qtd_bill_equipment_hrs ;
3832   l_seeded_measures(19) := l_overview_type(l_actual_index).qtd_labor_hrs -
3833                            l_overview_type(l_actual_index).qtd_bill_labor_hrs ;
3834   l_seeded_measures(20) := l_overview_type(l_actual_index).qtd_burdened_cost -
3835                            NVL(l_overview_type(l_actual_index).qtd_bill_burdened_cost,0) -
3836 						   l_overview_type(l_actual_index).qtd_capitalizable_brdn_cost ;
3837 /*  l_seeded_measures(26) := l_overview_type(l_orig_cost_budget2_index).qtd_burdened_cost;
3838   l_seeded_measures(27) := l_overview_type(l_orig_cost_budget2_index).qtd_equipment_hrs;
3839   l_seeded_measures(28) := l_overview_type(l_orig_cost_budget2_index).qtd_labor_hrs;
3840   l_seeded_measures(29) := l_overview_type(l_orig_rev_budget2_index).qtd_revenue; commented for bug 9485251 */
3841   /* Order changed for bug 9485251 */
3842   l_seeded_measures(21) := l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost;
3843   l_seeded_measures(22) := l_overview_type(l_orig_cost_budget_index).qtd_equipment_hrs;
3844   l_seeded_measures(23) := l_overview_type(l_orig_cost_budget_index).qtd_labor_hrs;
3845   l_seeded_measures(24) := l_overview_type(l_orig_rev_budget_index).qtd_revenue;
3846   l_seeded_measures(25) := l_overview_type(l_actual_index).qtd_oth_committed_cost;
3847   l_seeded_measures(26) := l_overview_type(l_actual_index).qtd_po_committed_cost;
3848   l_seeded_measures(27) := l_completed_percentage;
3849   l_seeded_measures(28) := l_overview_type(l_actual_index).qtd_pr_committed_cost;
3850   l_seeded_measures(29) := l_overview_type(l_actual_index).qtd_revenue;
3851   l_seeded_measures(30) := l_overview_type(l_actual_index).qtd_raw_cost;
3852   l_seeded_measures(31) := l_overview_type(l_actual_index).qtd_sup_inv_committed_cost;
3853   l_seeded_measures(32) := l_overview_type(l_actual_index).qtd_burdened_cost;
3854   l_seeded_measures(33) := l_overview_type(l_actual_index).qtd_sup_inv_committed_cost +
3855      					   l_overview_type(l_actual_index).qtd_oth_committed_cost +
3856 						   l_overview_type(l_actual_index).qtd_po_committed_cost +
3857 						   l_overview_type(l_actual_index).qtd_pr_committed_cost;
3858   l_seeded_measures(34) := l_overview_type(l_actual_index).qtd_equipment_hrs;
3859   l_seeded_measures(35) := l_overview_type(l_actual_index).qtd_labor_burdened_cost;
3860   l_seeded_measures(36) := l_overview_type(l_actual_index).qtd_labor_hrs;
3861   -- compute QTD custom FP measures
3862   Pji_Calc_Engine.Compute_FP_Measures(l_seeded_measures,
3863     l_fp_calc_custom_measures_qtd, x_return_status, x_msg_count, x_msg_data);
3864 
3865   -- input values array preparation for YTD
3866   l_seeded_measures(1)  := l_overview_type(l_actual_index).ytd_bill_equipment_hrs;
3867   l_seeded_measures(2)  := l_overview_type(l_actual_index).ytd_bill_burdened_cost;
3868   l_seeded_measures(3)  := l_overview_type(l_actual_index).ytd_bill_labor_hrs;
3869   l_seeded_measures(4)  := l_overview_type(l_actual_index).ytd_burdened_cost -
3870   						   l_overview_type(l_actual_index).ytd_raw_cost;
3871 /*  l_seeded_measures(5)  := l_overview_type(l_cost_budget2_index).ytd_burdened_cost;
3872   l_seeded_measures(6)  := l_overview_type(l_cost_budget2_index).ytd_equipment_hrs;
3873   l_seeded_measures(7)  := l_overview_type(l_cost_budget2_index).ytd_labor_hrs;
3874   l_seeded_measures(8)  := l_overview_type(l_rev_budget2_index).ytd_revenue;
3875   l_seeded_measures(9)  := l_overview_type(l_cost_budget2_index).ytd_raw_cost; commented for bug 9485251 */
3876   /* Order changed for bug 9485251 */
3877   l_seeded_measures(5)  := l_overview_type(l_cost_budget_index).ytd_burdened_cost;
3878   l_seeded_measures(6)  := l_overview_type(l_cost_budget_index).ytd_equipment_hrs;
3879   l_seeded_measures(7) := l_overview_type(l_cost_budget_index).ytd_labor_hrs;
3880   l_seeded_measures(8) := l_overview_type(l_rev_budget_index).ytd_revenue;
3881   l_seeded_measures(9)  := l_overview_type(l_cost_budget_index).ytd_raw_cost;
3882   l_seeded_measures(10)  := l_overview_type(l_actual_index).ytd_capitalizable_brdn_cost ;
3883   l_seeded_measures(11)  := l_overview_type(l_actual_index).ytd_equipment_brdn_cost;
3884   l_seeded_measures(12) := l_overview_type(l_cost_forecast_index).ytd_burdened_cost;
3885   l_seeded_measures(13) := l_overview_type(l_cost_forecast_index).ytd_equipment_hrs;
3886   l_seeded_measures(14) := l_overview_type(l_cost_forecast_index).ytd_labor_hrs;
3887   l_seeded_measures(15) := l_overview_type(l_rev_forecast_index).ytd_revenue;
3888   l_seeded_measures(16) := l_overview_type(l_actual_index).ytd_labor_raw_cost;
3889   l_seeded_measures(17) := l_overview_type(l_actual_index).ytd_burdened_cost -
3890                          l_overview_type(l_actual_index).ytd_bill_burdened_cost;
3891   l_seeded_measures(18) := l_overview_type(l_actual_index).ytd_equipment_hrs -
3892                            l_overview_type(l_actual_index).ytd_bill_equipment_hrs ;
3893   l_seeded_measures(19) := l_overview_type(l_actual_index).ytd_labor_hrs -
3894                            l_overview_type(l_actual_index).ytd_bill_labor_hrs ;
3895   l_seeded_measures(20) := l_overview_type(l_actual_index).ytd_burdened_cost -
3896                            NVL(l_overview_type(l_actual_index).ytd_bill_burdened_cost,0) -
3897 						   l_overview_type(l_actual_index).ytd_capitalizable_brdn_cost ;
3898 /*  l_seeded_measures(26) := l_overview_type(l_orig_cost_budget2_index).ytd_burdened_cost;
3899   l_seeded_measures(27) := l_overview_type(l_orig_cost_budget2_index).ytd_equipment_hrs;
3900   l_seeded_measures(28) := l_overview_type(l_orig_cost_budget2_index).ytd_labor_hrs;
3901   l_seeded_measures(29) := l_overview_type(l_orig_rev_budget2_index).ytd_revenue; commented for bug 9485251 */
3902   /* Order changed for bug 9485251 */
3903   l_seeded_measures(21) := l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost;
3904   l_seeded_measures(22) := l_overview_type(l_orig_cost_budget_index).ytd_equipment_hrs;
3905   l_seeded_measures(23) := l_overview_type(l_orig_cost_budget_index).ytd_labor_hrs;
3906   l_seeded_measures(24) := l_overview_type(l_orig_rev_budget_index).ytd_revenue;
3907   l_seeded_measures(25) := l_overview_type(l_actual_index).ytd_oth_committed_cost;
3908   l_seeded_measures(26) := l_overview_type(l_actual_index).ytd_po_committed_cost;
3909   l_seeded_measures(27) := l_completed_percentage;
3910   l_seeded_measures(28) := l_overview_type(l_actual_index).ytd_pr_committed_cost;
3911   l_seeded_measures(29) := l_overview_type(l_actual_index).ytd_revenue;
3912   l_seeded_measures(30) := l_overview_type(l_actual_index).ytd_raw_cost;
3913   l_seeded_measures(31) := l_overview_type(l_actual_index).ytd_sup_inv_committed_cost;
3914   l_seeded_measures(32) := l_overview_type(l_actual_index).ytd_burdened_cost;
3915   l_seeded_measures(33) := l_overview_type(l_actual_index).ytd_sup_inv_committed_cost +
3916      					   l_overview_type(l_actual_index).ytd_oth_committed_cost +
3917 						   l_overview_type(l_actual_index).ytd_po_committed_cost +
3918 						   l_overview_type(l_actual_index).ytd_pr_committed_cost;
3919   l_seeded_measures(34) := l_overview_type(l_actual_index).ytd_equipment_hrs;
3920   l_seeded_measures(35) := l_overview_type(l_actual_index).ytd_labor_burdened_cost;
3921   l_seeded_measures(36) := l_overview_type(l_actual_index).ytd_labor_hrs;
3922   -- compute YTD custom FP measures
3923   Pji_Calc_Engine.Compute_FP_Measures(l_seeded_measures,
3924     l_fp_calc_custom_measures_ytd, x_return_status, x_msg_count, x_msg_data);
3925 
3926   -- input values array preparation for ITD
3927   l_seeded_measures(1)  := l_overview_type(l_actual_index).itd_bill_equipment_hrs;
3928   l_seeded_measures(2)  := l_overview_type(l_actual_index).itd_bill_burdened_cost;
3929   l_seeded_measures(3)  := l_overview_type(l_actual_index).itd_bill_labor_hrs;
3930   l_seeded_measures(4)  := l_overview_type(l_actual_index).itd_burdened_cost -
3931   						   l_overview_type(l_actual_index).itd_raw_cost;
3932 /*  l_seeded_measures(5)  := l_overview_type(l_cost_budget2_index).itd_burdened_cost;
3933   l_seeded_measures(6)  := l_overview_type(l_cost_budget2_index).itd_equipment_hrs;
3934   l_seeded_measures(7)  := l_overview_type(l_cost_budget2_index).itd_labor_hrs;
3935   l_seeded_measures(8)  := l_overview_type(l_rev_budget2_index).itd_revenue;
3936   l_seeded_measures(9)  := l_overview_type(l_cost_budget2_index).itd_raw_cost;  commented for bug 9485251 */
3937   /* Order changed for bug 9485251 */
3938   l_seeded_measures(5)  := l_overview_type(l_cost_budget_index).itd_burdened_cost;
3939   l_seeded_measures(6)  := l_overview_type(l_cost_budget_index).itd_equipment_hrs;
3940   l_seeded_measures(7) := l_overview_type(l_cost_budget_index).itd_labor_hrs;
3941   l_seeded_measures(8) := l_overview_type(l_rev_budget_index).itd_revenue;
3942   l_seeded_measures(9)  := l_overview_type(l_cost_budget_index).itd_raw_cost;
3943   l_seeded_measures(10)  := l_overview_type(l_actual_index).itd_capitalizable_brdn_cost ;
3944   l_seeded_measures(11)  := l_overview_type(l_actual_index).itd_equipment_brdn_cost;
3945   l_seeded_measures(12) := l_overview_type(l_cost_forecast_index).itd_burdened_cost;
3946   l_seeded_measures(13) := l_overview_type(l_cost_forecast_index).itd_equipment_hrs;
3947   l_seeded_measures(14) := l_overview_type(l_cost_forecast_index).itd_labor_hrs;
3948   l_seeded_measures(15) := l_overview_type(l_rev_forecast_index).itd_revenue;
3949   l_seeded_measures(16) := l_overview_type(l_actual_index).itd_labor_raw_cost;
3950   l_seeded_measures(17) := l_overview_type(l_actual_index).itd_burdened_cost -
3951                          l_overview_type(l_actual_index).itd_bill_burdened_cost;
3952   l_seeded_measures(18) := l_overview_type(l_actual_index).itd_equipment_hrs -
3953                            l_overview_type(l_actual_index).itd_bill_equipment_hrs ;
3954   l_seeded_measures(19) := l_overview_type(l_actual_index).itd_labor_hrs -
3955                            l_overview_type(l_actual_index).itd_bill_labor_hrs ;
3956   l_seeded_measures(20) := l_overview_type(l_actual_index).itd_burdened_cost -
3957                            NVL(l_overview_type(l_actual_index).itd_bill_burdened_cost,0) -
3958 						   l_overview_type(l_actual_index).itd_capitalizable_brdn_cost ;
3959 /*  l_seeded_measures(26) := l_overview_type(l_orig_cost_budget2_index).itd_burdened_cost;
3960   l_seeded_measures(27) := l_overview_type(l_orig_cost_budget2_index).itd_equipment_hrs;
3961   l_seeded_measures(28) := l_overview_type(l_orig_cost_budget2_index).itd_labor_hrs;
3962   l_seeded_measures(29) := l_overview_type(l_orig_rev_budget2_index).itd_revenue; commented for bug 9485251 */
3963   /* Order changed for bug 9485251 */
3964   l_seeded_measures(21) := l_overview_type(l_orig_cost_budget_index).itd_burdened_cost;
3965   l_seeded_measures(22) := l_overview_type(l_orig_cost_budget_index).itd_equipment_hrs;
3966   l_seeded_measures(23) := l_overview_type(l_orig_cost_budget_index).itd_labor_hrs;
3967   l_seeded_measures(24) := l_overview_type(l_orig_rev_budget_index).itd_revenue;
3968   l_seeded_measures(25) := l_overview_type(l_actual_index).itd_oth_committed_cost;
3969   l_seeded_measures(26) := l_overview_type(l_actual_index).itd_po_committed_cost;
3970   l_seeded_measures(27) := l_completed_percentage;
3971   l_seeded_measures(28) := l_overview_type(l_actual_index).itd_pr_committed_cost;
3972   l_seeded_measures(29) := l_overview_type(l_actual_index).itd_revenue;
3973   l_seeded_measures(30) := l_overview_type(l_actual_index).itd_raw_cost;
3974   l_seeded_measures(31) := l_overview_type(l_actual_index).itd_sup_inv_committed_cost;
3975   l_seeded_measures(32) := l_overview_type(l_actual_index).itd_burdened_cost;
3976   l_seeded_measures(33) := l_overview_type(l_actual_index).itd_sup_inv_committed_cost +
3977      					   l_overview_type(l_actual_index).itd_oth_committed_cost +
3978 						   l_overview_type(l_actual_index).itd_po_committed_cost +
3979 						   l_overview_type(l_actual_index).itd_pr_committed_cost;
3980   l_seeded_measures(34) := l_overview_type(l_actual_index).itd_equipment_hrs;
3981   l_seeded_measures(35) := l_overview_type(l_actual_index).itd_labor_burdened_cost;
3982   l_seeded_measures(36) := l_overview_type(l_actual_index).itd_labor_hrs;
3983   -- compute ITD custom FP measures
3984   Pji_Calc_Engine.Compute_FP_Measures(l_seeded_measures,
3985     l_fp_calc_custom_measures_itd, x_return_status, x_msg_count, x_msg_data);
3986 
3987 
3988   -- input values array preparation for AT COMPL
3989   l_seeded_measures(1)  := l_overview_type(l_actual_index).ac_bill_equipment_hrs;
3990   l_seeded_measures(2)  := l_overview_type(l_actual_index).ac_bill_burdened_cost;
3991   l_seeded_measures(3)  := l_overview_type(l_actual_index).ac_bill_labor_hrs;
3992   l_seeded_measures(4)  := l_overview_type(l_actual_index).ac_burdened_cost -
3993   						   l_overview_type(l_actual_index).ac_raw_cost;
3994 /*  l_seeded_measures(5)  := l_overview_type(l_cost_budget2_index).ac_burdened_cost;
3995   l_seeded_measures(6)  := l_overview_type(l_cost_budget2_index).ac_equipment_hrs;
3996   l_seeded_measures(7)  := l_overview_type(l_cost_budget2_index).ac_labor_hrs;
3997   l_seeded_measures(8)  := l_overview_type(l_rev_budget2_index).ac_revenue;
3998   l_seeded_measures(9)  := l_overview_type(l_cost_budget2_index).ac_raw_cost; commented for bug 9485251 */
3999   /* Order changed for bug 9485251 */
4000   l_seeded_measures(5)  := l_overview_type(l_cost_budget_index).ac_burdened_cost;
4001   l_seeded_measures(6)  := l_overview_type(l_cost_budget_index).ac_equipment_hrs;
4002   l_seeded_measures(7) := l_overview_type(l_cost_budget_index).ac_labor_hrs;
4003   l_seeded_measures(8) := l_overview_type(l_rev_budget_index).ac_revenue;
4004   l_seeded_measures(9)  := l_overview_type(l_cost_budget_index).ac_raw_cost;
4005   l_seeded_measures(10)  := l_overview_type(l_actual_index).ac_capitalizable_brdn_cost ;
4006   l_seeded_measures(11)  := l_overview_type(l_actual_index).ac_equipment_brdn_cost;
4007   l_seeded_measures(12) := l_overview_type(l_cost_forecast_index).ac_burdened_cost;
4008   l_seeded_measures(13) := l_overview_type(l_cost_forecast_index).ac_equipment_hrs;
4009   l_seeded_measures(14) := l_overview_type(l_cost_forecast_index).ac_labor_hrs;
4010   l_seeded_measures(15) := l_overview_type(l_rev_forecast_index).ac_revenue;
4011   l_seeded_measures(16) := l_overview_type(l_actual_index).ac_labor_raw_cost;
4012   l_seeded_measures(17) := l_overview_type(l_actual_index).ac_burdened_cost -
4013                            l_overview_type(l_actual_index).ac_bill_burdened_cost;
4014   l_seeded_measures(18) := l_overview_type(l_actual_index).ac_equipment_hrs -
4015                            l_overview_type(l_actual_index).ac_bill_equipment_hrs ;
4016   l_seeded_measures(19) := l_overview_type(l_actual_index).ac_labor_hrs -
4017                            l_overview_type(l_actual_index).ac_bill_labor_hrs ;
4018   l_seeded_measures(20) := l_overview_type(l_actual_index).ac_burdened_cost -
4019                            NVL(l_overview_type(l_actual_index).ac_bill_burdened_cost,0) -
4020 						   l_overview_type(l_actual_index).ac_capitalizable_brdn_cost ;
4021 /*  l_seeded_measures(26) := l_overview_type(l_orig_cost_budget2_index).ac_burdened_cost;
4022   l_seeded_measures(27) := l_overview_type(l_orig_cost_budget2_index).ac_equipment_hrs;
4023   l_seeded_measures(28) := l_overview_type(l_orig_cost_budget2_index).ac_labor_hrs;
4024   l_seeded_measures(29) := l_overview_type(l_orig_rev_budget2_index).ac_revenue; commented for bug 9485251 */
4025   /* Order changed for bug 9485251 */
4026   l_seeded_measures(21) := l_overview_type(l_orig_cost_budget_index).ac_burdened_cost;
4027   l_seeded_measures(22) := l_overview_type(l_orig_cost_budget_index).ac_equipment_hrs;
4028   l_seeded_measures(23) := l_overview_type(l_orig_cost_budget_index).ac_labor_hrs;
4029   l_seeded_measures(24) := l_overview_type(l_orig_rev_budget_index).ac_revenue;
4030   l_seeded_measures(25) := l_overview_type(l_actual_index).ac_oth_committed_cost;
4031   l_seeded_measures(26) := l_overview_type(l_actual_index).ac_po_committed_cost;
4032   l_seeded_measures(27) := l_completed_percentage;
4033   l_seeded_measures(28) := l_overview_type(l_actual_index).ac_pr_committed_cost;
4034   l_seeded_measures(29) := l_overview_type(l_actual_index).ac_revenue;
4035   l_seeded_measures(30) := l_overview_type(l_actual_index).ac_raw_cost;
4036   l_seeded_measures(31) := l_overview_type(l_actual_index).ac_sup_inv_committed_cost;
4037   l_seeded_measures(32) := l_overview_type(l_actual_index).ac_burdened_cost;
4038   l_seeded_measures(33) := l_overview_type(l_actual_index).ac_sup_inv_committed_cost +
4039      					   l_overview_type(l_actual_index).ac_oth_committed_cost +
4040 						   l_overview_type(l_actual_index).ac_po_committed_cost +
4041 						   l_overview_type(l_actual_index).ac_pr_committed_cost;
4042   l_seeded_measures(34) := l_overview_type(l_actual_index).ac_equipment_hrs;
4043   l_seeded_measures(35) := l_overview_type(l_actual_index).ac_labor_burdened_cost;
4044   l_seeded_measures(36) := l_overview_type(l_actual_index).ac_labor_hrs;
4045   -- compute AT COMPL custom FP measures
4046   Pji_Calc_Engine.Compute_FP_Measures(l_seeded_measures,
4047     l_fp_calc_custom_measures_ac, x_return_status, x_msg_count, x_msg_data);
4048 
4049   -- input values array preparation for PRIOR PERIOD
4050   l_seeded_measures(1)  := l_overview_type(l_actual_index).prp_bill_equipment_hrs;
4051   l_seeded_measures(2)  := l_overview_type(l_actual_index).prp_bill_burdened_cost;
4052   l_seeded_measures(3)  := l_overview_type(l_actual_index).prp_bill_labor_hrs;
4053   l_seeded_measures(4)  := l_overview_type(l_actual_index).prp_burdened_cost -
4054   						   l_overview_type(l_actual_index).prp_raw_cost;
4055 /*  l_seeded_measures(5)  := l_overview_type(l_cost_budget2_index).prp_burdened_cost;
4056   l_seeded_measures(6)  := l_overview_type(l_cost_budget2_index).prp_equipment_hrs;
4057   l_seeded_measures(7)  := l_overview_type(l_cost_budget2_index).prp_labor_hrs;
4058   l_seeded_measures(8)  := l_overview_type(l_rev_budget2_index).prp_revenue;
4059   l_seeded_measures(9)  := l_overview_type(l_cost_budget2_index).prp_raw_cost;  commented for bug 9485251 */
4060   /* Order changed for bug 9485251 */
4061   l_seeded_measures(5)  := l_overview_type(l_cost_budget_index).prp_burdened_cost;
4062   l_seeded_measures(6)  := l_overview_type(l_cost_budget_index).prp_equipment_hrs;
4063   l_seeded_measures(7) := l_overview_type(l_cost_budget_index).prp_labor_hrs;
4064   l_seeded_measures(8) := l_overview_type(l_rev_budget_index).prp_revenue;
4065   l_seeded_measures(9)  := l_overview_type(l_cost_budget_index).prp_raw_cost;
4066   l_seeded_measures(10)  := l_overview_type(l_actual_index).prp_capitalizable_brdn_cost ;
4067   l_seeded_measures(11)  := l_overview_type(l_actual_index).prp_equipment_brdn_cost;
4068   l_seeded_measures(12) := l_overview_type(l_cost_forecast_index).prp_burdened_cost;
4069   l_seeded_measures(13) := l_overview_type(l_cost_forecast_index).prp_equipment_hrs;
4070   l_seeded_measures(14) := l_overview_type(l_cost_forecast_index).prp_labor_hrs;
4071   l_seeded_measures(15) := l_overview_type(l_rev_forecast_index).prp_revenue;
4072   l_seeded_measures(16) := l_overview_type(l_actual_index).prp_labor_raw_cost;
4073   l_seeded_measures(17) := l_overview_type(l_actual_index).prp_burdened_cost -
4074                            l_overview_type(l_actual_index).prp_bill_burdened_cost;
4075   l_seeded_measures(18) := l_overview_type(l_actual_index).prp_equipment_hrs -
4076                            l_overview_type(l_actual_index).prp_bill_equipment_hrs ;
4077   l_seeded_measures(19) := l_overview_type(l_actual_index).prp_labor_hrs -
4078                            l_overview_type(l_actual_index).prp_bill_labor_hrs ;
4079   l_seeded_measures(20) := l_overview_type(l_actual_index).prp_burdened_cost -
4080                            NVL(l_overview_type(l_actual_index).prp_bill_burdened_cost,0) -
4081 						   l_overview_type(l_actual_index).prp_capitalizable_brdn_cost ;
4082 /*  l_seeded_measures(26) := l_overview_type(l_orig_cost_budget2_index).prp_burdened_cost;
4083   l_seeded_measures(27) := l_overview_type(l_orig_cost_budget2_index).prp_equipment_hrs;
4084   l_seeded_measures(28) := l_overview_type(l_orig_cost_budget2_index).prp_labor_hrs;
4085   l_seeded_measures(29) := l_overview_type(l_orig_rev_budget2_index).prp_revenue; commented for bug 9485251 */
4086   /* Order changed for bug 9485251 */
4087   l_seeded_measures(21) := l_overview_type(l_orig_cost_budget_index).prp_burdened_cost;
4088   l_seeded_measures(22) := l_overview_type(l_orig_cost_budget_index).prp_equipment_hrs;
4089   l_seeded_measures(23) := l_overview_type(l_orig_cost_budget_index).prp_labor_hrs;
4090   l_seeded_measures(24) := l_overview_type(l_orig_rev_budget_index).prp_revenue;
4091   l_seeded_measures(25) := l_overview_type(l_actual_index).prp_oth_committed_cost;
4092   l_seeded_measures(26) := l_overview_type(l_actual_index).prp_po_committed_cost;
4093   l_seeded_measures(27) := l_completed_percentage;
4094   l_seeded_measures(28) := l_overview_type(l_actual_index).prp_pr_committed_cost;
4095   l_seeded_measures(29) := l_overview_type(l_actual_index).prp_revenue;
4096   l_seeded_measures(30) := l_overview_type(l_actual_index).prp_raw_cost;
4097   l_seeded_measures(31) := l_overview_type(l_actual_index).prp_sup_inv_committed_cost;
4098   l_seeded_measures(32) := l_overview_type(l_actual_index).prp_burdened_cost;
4099   l_seeded_measures(33) := l_overview_type(l_actual_index).prp_sup_inv_committed_cost +
4100      					   l_overview_type(l_actual_index).prp_oth_committed_cost +
4101 						   l_overview_type(l_actual_index).prp_po_committed_cost +
4102 						   l_overview_type(l_actual_index).prp_pr_committed_cost;
4103   l_seeded_measures(34) := l_overview_type(l_actual_index).prp_equipment_hrs;
4104   l_seeded_measures(35) := l_overview_type(l_actual_index).prp_labor_burdened_cost;
4105   l_seeded_measures(36) := l_overview_type(l_actual_index).prp_labor_hrs;
4106   -- compute PRIOR PERIOD custom FP measures
4107   Pji_Calc_Engine.Compute_FP_Measures(l_seeded_measures,
4108     l_fp_calc_custom_measures_prp, x_return_status, x_msg_count, x_msg_data);
4109 
4110   --
4111   -- all l_fp_custom_measures_XXX lists have the same length
4112   -- we also assume that Pji_Calc_Engine APIs always return arrays
4113   -- that are 15 elements long
4114   --
4115   l_fp_custom_measures_ptd.extend(15);
4116   l_fp_custom_measures_qtd.extend(15);
4117   l_fp_custom_measures_ytd.extend(15);
4118   l_fp_custom_measures_itd.extend(15);
4119   l_fp_custom_measures_ac .extend(15);
4120   l_fp_custom_measures_prp.extend(15);
4121 
4122   l_ac_custom_measures_ptd.extend(15);
4123   l_ac_custom_measures_qtd.extend(15);
4124   l_ac_custom_measures_ytd.extend(15);
4125   l_ac_custom_measures_itd.extend(15);
4126   l_ac_custom_measures_ac .extend(15);
4127   l_ac_custom_measures_prp.extend(15);
4128 
4129   FOR i IN 1..15 LOOP
4130 	  l_fp_custom_measures_ptd(i+15) := l_fp_calc_custom_measures_ptd(i);
4131 	  l_fp_custom_measures_qtd(i+15) := l_fp_calc_custom_measures_qtd(i);
4132 	  l_fp_custom_measures_ytd(i+15) := l_fp_calc_custom_measures_ytd(i);
4133 	  l_fp_custom_measures_itd(i+15) := l_fp_calc_custom_measures_itd(i);
4134 	  l_fp_custom_measures_ac(i+15) := l_fp_calc_custom_measures_ac(i);
4135 	  l_fp_custom_measures_prp(i+15) := l_fp_calc_custom_measures_prp(i);
4136 
4137 	  l_ac_custom_measures_ptd(i+15) := l_ac_calc_custom_measures_ptd(i);
4138 	  l_ac_custom_measures_qtd(i+15) := l_ac_calc_custom_measures_qtd(i);
4139 	  l_ac_custom_measures_ytd(i+15) := l_ac_calc_custom_measures_ytd(i);
4140 	  l_ac_custom_measures_itd(i+15) := l_ac_calc_custom_measures_itd(i);
4141 	  l_ac_custom_measures_ac(i+15) := l_ac_calc_custom_measures_ac(i);
4142 	  l_ac_custom_measures_prp(i+15) := l_ac_calc_custom_measures_prp(i);
4143   END LOOP;
4144 
4145   l_fp_cus_meas_formats := SYSTEM.PA_VARCHAR2_30_TBL_TYPE();
4146   l_ac_cus_meas_formats := SYSTEM.PA_VARCHAR2_30_TBL_TYPE();
4147   BEGIN
4148     SELECT measure_format
4149     BULK COLLECT INTO l_fp_cus_meas_formats
4150     FROM pji_mt_measure_sets_b
4151     WHERE 1=1
4152     AND measure_set_type IN ('CUSTOM_CALC','CUSTOM_STORED')
4153     AND measure_source = 'FP'
4154     ORDER BY TO_NUMBER(SUBSTR(measure_set_code,16,2));
4155 
4156     SELECT measure_format
4157     BULK COLLECT INTO l_ac_cus_meas_formats
4158     FROM pji_mt_measure_sets_b
4159     WHERE 1=1
4160     AND measure_set_type IN ('CUSTOM_CALC','CUSTOM_STORED')
4161     AND measure_source = 'AC'
4162     ORDER BY TO_NUMBER(SUBSTR(measure_set_code,16,2));
4163 
4164   EXCEPTION
4165     WHEN OTHERS THEN
4166       l_sql_errm := SQLERRM();
4167 	  IF g_debug_mode = 'Y' THEN
4168 	      Pji_Utils.WRITE2LOG(
4169 	        'PJI_REP_MEASURE_UTIL.retrieveData: project_id= ' || pProjectId ||
4170 	        '; error during bulk collect on l_cus_meas_formats collection: '|| l_sql_errm,
4171 	        TRUE, g_msg_level_runtime_info
4172 	      );
4173 	  END IF;
4174   END;
4175 
4176 
4177   -- sanity extension in case pji_mt_measure_sets_vl is not properly loaded
4178   l_fp_cus_meas_formats.extend(30);
4179   l_ac_cus_meas_formats.extend(30);
4180 
4181 /*
4182   l_fp_custom_measures_ptd_char.extend(30);
4183   l_fp_custom_measures_qtd_char.extend(30);
4184   l_fp_custom_measures_ytd_char.extend(30);
4185   l_fp_custom_measures_itd_char.extend(30);
4186   l_fp_custom_measures_ac_char.extend(30);
4187   l_fp_custom_measures_prp_char.extend(30);
4188 
4189   l_ac_custom_measures_ptd_char.extend(30);
4190   l_ac_custom_measures_qtd_char.extend(30);
4191   l_ac_custom_measures_ytd_char.extend(30);
4192   l_ac_custom_measures_itd_char.extend(30);
4193   l_ac_custom_measures_ac_char.extend(30);
4194   l_ac_custom_measures_prp_char.extend(30);
4195 */
4196 
4197   FOR i IN 1..30 LOOP
4198 
4199     IF l_fp_cus_meas_formats(i) = g_CurrencyType THEN
4200 
4201       l_fp_custom_measures_ptd(i) := l_fp_custom_measures_ptd(i) / l_factor_by;
4202       l_fp_custom_measures_qtd(i) := l_fp_custom_measures_qtd(i) / l_factor_by;
4203       l_fp_custom_measures_ytd(i) := l_fp_custom_measures_ytd(i) / l_factor_by;
4204       l_fp_custom_measures_itd(i) := l_fp_custom_measures_itd(i) / l_factor_by;
4205       l_fp_custom_measures_ac(i)  := l_fp_custom_measures_ac(i) / l_factor_by;
4206       l_fp_custom_measures_prp(i) := l_fp_custom_measures_prp(i) / l_factor_by;
4207 
4208     ELSIF l_fp_cus_meas_formats(i) = g_HoursType THEN
4209 
4210       l_fp_custom_measures_ptd(i) := l_fp_custom_measures_ptd(i) / l_effort_UOM;
4211       l_fp_custom_measures_qtd(i) := l_fp_custom_measures_qtd(i) / l_effort_UOM;
4212       l_fp_custom_measures_ytd(i) := l_fp_custom_measures_ytd(i) / l_effort_UOM;
4213       l_fp_custom_measures_itd(i) := l_fp_custom_measures_itd(i) / l_effort_UOM;
4214       l_fp_custom_measures_ac(i)  := l_fp_custom_measures_ac(i)  / l_effort_UOM;
4215       l_fp_custom_measures_prp(i) := l_fp_custom_measures_prp(i) / l_effort_UOM;
4216 	END IF;
4217 
4218 	IF l_ac_cus_meas_formats(i) = g_CurrencyType THEN
4219 
4220       l_ac_custom_measures_ptd(i) := l_ac_custom_measures_ptd(i) / l_factor_by;
4221       l_ac_custom_measures_qtd(i) := l_ac_custom_measures_qtd(i) / l_factor_by;
4222       l_ac_custom_measures_ytd(i) := l_ac_custom_measures_ytd(i) / l_factor_by;
4223       l_ac_custom_measures_itd(i) := l_ac_custom_measures_itd(i) / l_factor_by;
4224       l_ac_custom_measures_ac(i)  := l_ac_custom_measures_ac(i) / l_factor_by;
4225       l_ac_custom_measures_prp(i) := l_ac_custom_measures_prp(i) / l_factor_by;
4226 
4227     ELSIF l_ac_cus_meas_formats(i) = g_HoursType THEN
4228 
4229       l_ac_custom_measures_ptd(i) := l_ac_custom_measures_ptd(i) / l_effort_UOM;
4230       l_ac_custom_measures_qtd(i) := l_ac_custom_measures_qtd(i) / l_effort_UOM;
4231       l_ac_custom_measures_ytd(i) := l_ac_custom_measures_ytd(i) / l_effort_UOM;
4232       l_ac_custom_measures_itd(i) := l_ac_custom_measures_itd(i) / l_effort_UOM;
4233       l_ac_custom_measures_ac(i)  := l_ac_custom_measures_ac(i)  / l_effort_UOM;
4234       l_ac_custom_measures_prp(i) := l_ac_custom_measures_prp(i) / l_effort_UOM;
4235 	END IF;
4236 
4237   END LOOP;
4238 
4239 
4240 
4241   --dbms_output.put_line('p_measure_set_code.LAST='||p_measure_set_code.LAST);
4242   --IF l_overview_type.COUNT > 1 THEN
4243   --  dbms_output.put_line('l_overview_type.COUNT ='||l_overview_type.COUNT);
4244   --END IF;
4245 
4246 
4247   --
4248   -- for every measure, compute the amounts
4249   --
4250   FOR i IN 1..p_measure_set_code.LAST	LOOP
4251 
4252     BEGIN
4253 
4254       IF p_measure_set_code(i) = 'PPF_MSR_ACWP' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
4255         -- Actual cost of Work performed
4256         x_measure_type(i) := g_CurrencyType; -- then apply radix (thousand point), ask for API
4257       /* Starts Added for bug 6961599 */
4258         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_burdened_cost / l_factor_by;
4259 
4260         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_burdened_cost / l_factor_by;
4261 
4262         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_burdened_cost / l_factor_by;
4263       /* Ends Added for bug 6961599 */
4264    	    l_itd_value(i):=l_overview_type(l_actual_index).itd_burdened_cost / l_factor_by;
4265 
4266         l_ac_value(i):=l_overview_type(l_actual_index).ac_burdened_cost / l_factor_by;
4267 
4268 
4269       ELSIF p_measure_set_code(i) = 'PPF_MSR_AF' THEN
4270         --Additional Funding Amount (PJI_AC_PROJ_F)
4271         x_measure_type(i) := g_CurrencyType;
4272 
4273         l_ptd_value(i):=l_pji_facts.ptd_additional_funding_amount / l_factor_by;
4274 
4275         l_qtd_value(i):=l_pji_facts.qtd_additional_funding_amount / l_factor_by;
4276 
4277         l_ytd_value(i):=l_pji_facts.ytd_additional_funding_amount / l_factor_by;
4278 
4279         l_itd_value(i):=l_pji_facts.itd_additional_funding_amount / l_factor_by;
4280 
4281         l_ac_value(i):=l_pji_facts.ac_additional_funding_amount / l_factor_by;
4282 
4283         l_prp_value(i):=l_pji_facts.prp_additional_funding_amount / l_factor_by;
4284 
4285       ELSIF p_measure_set_code(i) = 'PPF_MSR_B' THEN
4286         --
4287         -- Backlog (PJI_AC_PROJ_F) (it IS a currency measure)
4288         --
4289         x_measure_type(i) := g_CurrencyType;
4290 
4291  /* Starts added for bug 6961599 */
4292         l_measure1       := l_pji_facts.ptd_additional_funding_amount;
4293         l_measure2       := l_pji_facts.ptd_cancelled_funding_amount;
4294         l_measure3       := l_pji_facts.ptd_funding_adjustment_amount;
4295         l_measure4       := l_pji_facts.ptd_initial_funding_amount;
4296 
4297         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
4298                                                            ,p_measure2 => l_measure2
4299                                                            ,p_measure3 => l_measure3
4300                                                            ,p_measure4 => l_measure4
4301                                                          );
4302 
4303         l_ptd_value(i):= (l_measures_total - NVL(l_overview_type(l_actual_index).ptd_revenue,0)) / l_factor_by;
4304 
4305 
4306 		IF l_ptd_value(i) < 0  THEN
4307 		   l_ptd_value(i) := 0;
4308 		END IF;
4309 
4310         l_measure1       := l_pji_facts.qtd_additional_funding_amount;
4311         l_measure2       := l_pji_facts.qtd_cancelled_funding_amount;
4312         l_measure3       := l_pji_facts.qtd_funding_adjustment_amount;
4313         l_measure4       := l_pji_facts.qtd_initial_funding_amount;
4314 
4315         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
4316                                                            ,p_measure2 => l_measure2
4317                                                            ,p_measure3 => l_measure3
4318                                                            ,p_measure4 => l_measure4
4319                                                          );
4320 
4321         l_qtd_value(i):= (l_measures_total - NVL(l_overview_type(l_actual_index).qtd_revenue,0)) / l_factor_by;
4322 
4323 
4324 		IF l_qtd_value(i) < 0  THEN
4325 		   l_qtd_value(i) := 0;
4326 		END IF;
4327 
4328         l_measure1       := l_pji_facts.ytd_additional_funding_amount;
4329         l_measure2       := l_pji_facts.ytd_cancelled_funding_amount;
4330         l_measure3       := l_pji_facts.ytd_funding_adjustment_amount;
4331         l_measure4       := l_pji_facts.ytd_initial_funding_amount;
4332 
4333         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
4334                                                            ,p_measure2 => l_measure2
4335                                                            ,p_measure3 => l_measure3
4336                                                            ,p_measure4 => l_measure4
4337                                                          );
4338 
4339         l_ytd_value(i):= (l_measures_total - NVL(l_overview_type(l_actual_index).ytd_revenue,0)) / l_factor_by;
4340 
4341 
4342 		IF l_ytd_value(i) < 0  THEN
4343 		   l_ytd_value(i) := 0;
4344 		END IF;
4345 
4346 /* Ends added for bug 6961599 */
4347 /*  commented for 6961599
4348         l_ptd_value(i)   := NULL;
4349         l_qtd_value(i)   := NULL;
4350         l_ytd_value(i)   := NULL;
4351 */
4352        -- Added for bug 4194804
4353         l_measure1       := l_pji_facts.itd_additional_funding_amount;
4354         l_measure2       := l_pji_facts.itd_cancelled_funding_amount;
4355         l_measure3       := l_pji_facts.itd_funding_adjustment_amount;
4356         l_measure4       := l_pji_facts.itd_initial_funding_amount;
4357 
4358         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
4359                                                            ,p_measure2 => l_measure2
4360                                                            ,p_measure3 => l_measure3
4361                                                            ,p_measure4 => l_measure4
4362                                                          );
4363 
4364 
4365         l_itd_value(i):= (l_measures_total - NVL(l_overview_type(l_actual_index).itd_revenue,0)) / l_factor_by;
4366 
4367 /* commented for bug 4194804  (l_pji_facts.itd_additional_funding_amount + l_pji_facts.itd_cancelled_funding_amount +
4368    l_pji_facts.itd_funding_adjustment_amount + l_pji_facts.itd_initial_funding_amount
4369 	         			 - l_overview_type(l_actual_index).itd_revenue) / l_factor_by;
4370 */
4371 
4372 
4373 		IF l_itd_value(i) < 0  THEN
4374 		   l_itd_value(i) := 0;
4375 		END IF;
4376   		--l_itd_value(i) := 10;
4377 
4378 /*        l_ac_value(i):= l_itd_value(i); - Commented for Bug 6485047*/
4379 
4380 	/* Revised calculation for At Completion Backlog - Bug 6485047*/
4381         l_measure1       := l_pji_facts.ac_additional_funding_amount;
4382         l_measure2       := l_pji_facts.ac_cancelled_funding_amount;
4383         l_measure3       := l_pji_facts.ac_funding_adjustment_amount;
4384         l_measure4       := l_pji_facts.ac_initial_funding_amount;
4385 
4386         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
4387                                                            ,p_measure2 => l_measure2
4388                                                            ,p_measure3 => l_measure3
4389                                                            ,p_measure4 => l_measure4
4390                                                          );
4391 
4392 
4393         l_ac_value(i):= (l_measures_total - NVL(l_overview_type(l_actual_index).ac_revenue,0)) / l_factor_by;
4394 		IF l_ac_value(i) < 0  THEN
4395 		   l_ac_value(i) := 0;
4396 		END IF;
4397 
4398 
4399         /*Changes for Bug 6485047 end here*/
4400 
4401         l_prp_value(i):= NULL;
4402 
4403       ELSIF p_measure_set_code(i) = 'PPF_MSR_BA' THEN
4404         -- Billed Amount (from PJI_AC_PROJ_F)
4405         x_measure_type(i) := g_CurrencyType;
4406 
4407         l_ptd_value(i):=l_pji_facts.ptd_ar_invoice_amount / l_factor_by; /* Modified for bug 6961599 */
4408         l_qtd_value(i):=l_pji_facts.qtd_ar_invoice_amount / l_factor_by; /* Modified for bug 6961599 */
4409         l_ytd_value(i):=l_pji_facts.ytd_ar_invoice_amount / l_factor_by; /* Modified for bug 6961599 */
4410         l_itd_value(i):=l_pji_facts.itd_ar_invoice_amount / l_factor_by;
4411         l_ac_value(i) :=l_pji_facts.ac_ar_invoice_amount / l_factor_by;
4412         l_prp_value(i):=NULL;
4413 
4414       ELSIF p_measure_set_code(i) = 'PPF_MSR_BDR' THEN
4415         --
4416         -- Backlog Days Remaining (PJI_AC_PROJ_F)
4417         --      backlog / revenue * days since inception to date
4418         --
4419         x_measure_type(i) := g_HoursType;
4420 
4421         l_ptd_value(i):= NULL;
4422         l_qtd_value(i):= NULL;
4423         l_ytd_value(i):= NULL;
4424 
4425         IF l_overview_type(l_actual_index).itd_revenue <> 0 THEN
4426 
4427              -- Added for bug 4194804
4428               l_measure1       := l_pji_facts.itd_additional_funding_amount;
4429               l_measure2       := l_pji_facts.itd_cancelled_funding_amount;
4430               l_measure3       := l_pji_facts.itd_funding_adjustment_amount;
4431               l_measure4       := l_pji_facts.itd_initial_funding_amount;
4432               l_measures_total := Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
4433                                                                 ,p_measure2 => l_measure2
4434                                                                 ,p_measure3 => l_measure3
4435                                                                 ,p_measure4 => l_measure4
4436                                                               );
4437 
4438               l_num := l_measures_total - NVL(l_overview_type(l_actual_index).itd_revenue,0);
4439 
4440 /* commented for bug 4194804
4441               l_num := l_pji_facts.itd_additional_funding_amount +
4442                        l_pji_facts.itd_cancelled_funding_amount +
4443                        l_pji_facts.itd_funding_adjustment_amount +
4444                        l_pji_facts.itd_initial_funding_amount -
4445                        l_overview_type(l_actual_index).itd_revenue; */
4446 
4447           IF l_num < 0 THEN
4448             l_num := 0;
4449           END IF;
4450 
4451 	        l_num := (l_num / l_overview_type(l_actual_index).itd_revenue) * xDaysSinceITD;
4452 	        l_itd_value(i):= TRUNC(l_num);
4453         ELSE
4454           l_itd_value(i):= NULL;
4455         END IF;
4456 
4457         l_ac_value(i):= NULL; /* Bug 6485047*/
4458         l_prp_value(i):= NULL;
4459 
4460       ELSIF p_measure_set_code(i) = 'PPF_MSR_BIC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
4461         -- Billable Cost
4462         x_measure_type(i) := g_CurrencyType;
4463 
4464         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_bill_burdened_cost / l_factor_by;
4465 
4466         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_bill_burdened_cost / l_factor_by;
4467 
4468         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_bill_burdened_cost / l_factor_by;
4469 
4470         l_itd_value(i):=l_overview_type(l_actual_index).itd_bill_burdened_cost / l_factor_by;
4471 
4472         l_ac_value(i):=l_overview_type(l_actual_index).ac_bill_burdened_cost / l_factor_by;
4473 
4474         l_prp_value(i):=l_overview_type(l_actual_index).prp_bill_burdened_cost / l_factor_by;
4475 
4476       ELSIF p_measure_set_code(i) = 'PPF_MSR_BCPOTC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
4477         -- Billable Cost % of total cost= Billable Cost / Total Cost
4478         x_measure_type(i) := g_PercentType;
4479 
4480         IF l_overview_type(l_actual_index).ptd_burdened_cost <> 0 THEN
4481           l_ptd_value(i):=100 * l_overview_type(l_actual_index).ptd_bill_burdened_cost /
4482                           l_overview_type(l_actual_index).ptd_burdened_cost;
4483         END IF;
4484 
4485         IF l_overview_type(l_actual_index).qtd_burdened_cost <> 0 THEN
4486           l_qtd_value(i):=100 * l_overview_type(l_actual_index).qtd_bill_burdened_cost /
4487                           l_overview_type(l_actual_index).qtd_burdened_cost;
4488         END IF;
4489 
4490         IF l_overview_type(l_actual_index).ytd_burdened_cost <> 0 THEN
4491           l_ytd_value(i):=100 * l_overview_type(l_actual_index).ytd_bill_burdened_cost /
4492                           l_overview_type(l_actual_index).ytd_burdened_cost;
4493         END IF;
4494 
4495         IF l_overview_type(l_actual_index).itd_burdened_cost <> 0 THEN
4496           l_itd_value(i):=100 * l_overview_type(l_actual_index).itd_bill_burdened_cost /
4497                           l_overview_type(l_actual_index).itd_burdened_cost;
4498         END IF;
4499 
4500         IF l_overview_type(l_actual_index).ac_burdened_cost <> 0 THEN
4501           l_ac_value(i):=100 * l_overview_type(l_actual_index).ac_bill_burdened_cost /
4502                           l_overview_type(l_actual_index).ac_burdened_cost;
4503         END IF;
4504 
4505         IF l_overview_type(l_actual_index).prp_burdened_cost <> 0 THEN
4506           l_prp_value(i):=100 * l_overview_type(l_actual_index).prp_bill_burdened_cost /
4507                           l_overview_type(l_actual_index).prp_burdened_cost;
4508         END IF;
4509 
4510       ELSIF p_measure_set_code(i) = 'PPF_MSR_BPTF' THEN
4511         -- Backlog % of Total Funding (PJI_AC_PROJ_F) =
4512         --      backlog / (init funding amt + addn funding amt + funding adjustment amt + cancelled funding amt)
4513         --
4514         x_measure_type(i) := g_PercentType;
4515 
4516 	/* Starts added for bug 6961599 */
4517 	-- FOR PTD
4518         l_measure1       := l_pji_facts.ptd_initial_funding_amount;
4519         l_measure2       := l_pji_facts.ptd_additional_funding_amount;
4520         l_measure3       := l_pji_facts.ptd_funding_adjustment_amount;
4521         l_measure4       := l_pji_facts.ptd_cancelled_funding_amount;
4522 
4523 
4524         l_measures_total := Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
4525                                                           ,p_measure2 => l_measure2
4526                                                           ,p_measure3 => l_measure3
4527                                                           ,p_measure4 => l_measure4
4528                                                         );
4529         l_total_funding := l_measures_total;
4530 
4531 
4532         IF l_total_funding <> 0 THEN
4533 
4534           l_backlog := l_total_funding - NVL(l_overview_type(l_actual_index).ptd_revenue,0);
4535 
4536           IF l_backlog < 0 THEN
4537             l_backlog := 0;
4538           END IF;
4539 
4540           l_num := 100 * l_backlog / l_total_funding;
4541 
4542          l_ptd_value(i):= l_num;
4543 
4544         ELSE
4545 
4546           l_ptd_value(i):= NULL;
4547 
4548         END IF;
4549 
4550 			-- FOR QTD
4551         l_measure1       := l_pji_facts.qtd_initial_funding_amount;
4552         l_measure2       := l_pji_facts.qtd_additional_funding_amount;
4553         l_measure3       := l_pji_facts.qtd_funding_adjustment_amount;
4554         l_measure4       := l_pji_facts.qtd_cancelled_funding_amount;
4555 
4556 
4557         l_measures_total := Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
4558                                                           ,p_measure2 => l_measure2
4559                                                           ,p_measure3 => l_measure3
4560                                                           ,p_measure4 => l_measure4
4561                                                         );
4562         l_total_funding := l_measures_total;
4563 
4564 
4565         IF l_total_funding <> 0 THEN
4566 
4567           l_backlog := l_total_funding - NVL(l_overview_type(l_actual_index).qtd_revenue,0);
4568 
4569           IF l_backlog < 0 THEN
4570             l_backlog := 0;
4571           END IF;
4572 
4573           l_num := 100 * l_backlog / l_total_funding;
4574 
4575          l_qtd_value(i):= l_num;
4576 
4577         ELSE
4578 
4579           l_qtd_value(i):= NULL;
4580 
4581         END IF;
4582 
4583 			-- FOR YTD
4584         l_measure1       := l_pji_facts.ytd_initial_funding_amount;
4585         l_measure2       := l_pji_facts.ytd_additional_funding_amount;
4586         l_measure3       := l_pji_facts.ytd_funding_adjustment_amount;
4587         l_measure4       := l_pji_facts.ytd_cancelled_funding_amount;
4588 
4589 
4590         l_measures_total := Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
4591                                                           ,p_measure2 => l_measure2
4592                                                           ,p_measure3 => l_measure3
4593                                                           ,p_measure4 => l_measure4
4594                                                         );
4595         l_total_funding := l_measures_total;
4596 
4597 
4598         IF l_total_funding <> 0 THEN
4599 
4600           l_backlog := l_total_funding - NVL(l_overview_type(l_actual_index).ytd_revenue,0);
4601 
4602           IF l_backlog < 0 THEN
4603             l_backlog := 0;
4604           END IF;
4605 
4606           l_num := 100 * l_backlog / l_total_funding;
4607 
4608          l_ytd_value(i):= l_num;
4609 
4610         ELSE
4611 
4612           l_ytd_value(i):= NULL;
4613 
4614         END IF;
4615 
4616 	/* Ends added for bug 6961599 */
4617 
4618 /* Commented for bug 6961599
4619         l_ptd_value(i):= NULL;
4620         l_qtd_value(i):= NULL;
4621         l_ytd_value(i):= NULL;
4622 */
4623              -- Added for bug 4194804
4624         l_measure1       := l_pji_facts.itd_initial_funding_amount;
4625         l_measure2       := l_pji_facts.itd_additional_funding_amount;
4626         l_measure3       := l_pji_facts.itd_funding_adjustment_amount;
4627         l_measure4       := l_pji_facts.itd_cancelled_funding_amount;
4628 
4629         l_measures_total := Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
4630                                                           ,p_measure2 => l_measure2
4631                                                           ,p_measure3 => l_measure3
4632                                                           ,p_measure4 => l_measure4
4633                                                         );
4634         l_total_funding := l_measures_total;
4635 
4636 /* Commented for bug 4194804
4637         l_total_funding := l_pji_facts.itd_initial_funding_amount    +
4638                            l_pji_facts.itd_additional_funding_amount +
4639                            l_pji_facts.itd_funding_adjustment_amount +
4640                            l_pji_facts.itd_cancelled_funding_amount;
4641 */
4642 
4643         IF l_total_funding <> 0 THEN
4644 
4645           l_backlog := l_total_funding - NVL(l_overview_type(l_actual_index).itd_revenue,0);
4646 
4647           IF l_backlog < 0 THEN
4648             l_backlog := 0;
4649           END IF;
4650 
4651           l_num := 100 * l_backlog / l_total_funding;
4652           l_itd_value(i):=l_num;
4653 
4654         ELSE
4655 
4656           l_itd_value(i):= NULL;
4657 
4658         END IF;
4659 
4660 
4661 	/* Bug 6485047 - changes start here*/
4662         l_measure1       := l_pji_facts.ac_initial_funding_amount;
4663         l_measure2       := l_pji_facts.ac_additional_funding_amount;
4664         l_measure3       := l_pji_facts.ac_funding_adjustment_amount;
4665         l_measure4       := l_pji_facts.ac_cancelled_funding_amount;
4666 
4667 
4668         l_measures_total := Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
4669                                                           ,p_measure2 => l_measure2
4670                                                           ,p_measure3 => l_measure3
4671                                                           ,p_measure4 => l_measure4
4672                                                         );
4673         l_total_funding := l_measures_total;
4674 
4675 
4676         IF l_total_funding <> 0 THEN
4677 
4678           l_backlog := l_total_funding - NVL(l_overview_type(l_actual_index).ac_revenue,0);
4679 
4680           IF l_backlog < 0 THEN
4681             l_backlog := 0;
4682           END IF;
4683 
4684           l_num := 100 * l_backlog / l_total_funding;
4685 
4686          l_ac_value(i):= l_num;
4687 
4688         ELSE
4689 
4690           l_ac_value(i):= NULL;
4691 
4692         END IF;
4693 
4694 	/*Bug 6485047 - changes end here*/
4695 
4696 	l_prp_value(i):= NULL;
4697 
4698       ELSIF p_measure_set_code(i) = 'PPF_MSR_BUC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
4699         -- Burden Cost = Burdened cost - Raw Cost
4700         x_measure_type(i) := g_CurrencyType;
4701 
4702         l_ptd_value(i):=(l_overview_type(l_actual_index).ptd_burdened_cost -
4703                                  NVL(l_overview_type(l_actual_index).ptd_raw_cost,0)) / l_factor_by;
4704 
4705         l_qtd_value(i):=(l_overview_type(l_actual_index).qtd_burdened_cost -
4706                                  NVL(l_overview_type(l_actual_index).qtd_raw_cost,0)) / l_factor_by;
4707 
4708         l_ytd_value(i):=(l_overview_type(l_actual_index).ytd_burdened_cost -
4709                                  NVL(l_overview_type(l_actual_index).ytd_raw_cost,0)) / l_factor_by;
4710 
4711         l_itd_value(i):=(l_overview_type(l_actual_index).itd_burdened_cost -
4712                                  NVL(l_overview_type(l_actual_index).itd_raw_cost,0)) / l_factor_by;
4713 
4714         l_ac_value(i):=(l_overview_type(l_actual_index).ac_burdened_cost -
4715                                 NVL(l_overview_type(l_actual_index).ac_raw_cost,0)) / l_factor_by;
4716 
4717         l_prp_value(i):=(l_overview_type(l_actual_index).prp_burdened_cost -
4718                                  NVL(l_overview_type(l_actual_index).prp_raw_cost,0)) / l_factor_by;
4719 
4720       ELSIF p_measure_set_code(i) = 'PPF_MSR_BCWP' AND bitand(l_check_plan_versions, g_CstBudget_is_present) = g_CstBudget_is_present THEN
4721         -- Budget Cost of Work Performed = burd cost * completed percentage
4722         x_measure_type(i) := g_CurrencyType;
4723 
4724         l_ptd_value(i):=NULL;
4725 
4726         l_qtd_value(i):=NULL;
4727 
4728         l_ytd_value(i):=NULL;
4729 
4730         l_itd_value(i):=l_overview_type(l_cost_budget_index).ac_burdened_cost * l_completed_percentage / l_factor_by;
4731 
4732         l_ac_value(i):=l_overview_type(l_cost_budget_index).ac_burdened_cost * l_completed_percentage / l_factor_by;
4733 
4734         l_prp_value(i):=NULL;
4735 
4736       ELSIF p_measure_set_code(i) = 'PPF_MSR_BCWS' AND bitand(l_check_plan_versions, g_CstBudget_is_present) = g_CstBudget_is_present THEN
4737         -- Budget Cost of Work Scheduled =  BurdenedCost(budget PLAN)
4738         x_measure_type(i) := g_CurrencyType;
4739 
4740         l_ptd_value(i):=NULL;
4741 
4742         l_qtd_value(i):=NULL;
4743 
4744         l_ytd_value(i):=NULL;
4745 
4746         l_itd_value(i):=l_overview_type(l_cost_budget_index).itd_burdened_cost / l_factor_by;
4747 
4748         l_ac_value(i):=l_overview_type(l_cost_budget_index).ac_burdened_cost / l_factor_by;
4749 
4750         l_prp_value(i):=NULL;
4751 
4752       ELSIF p_measure_set_code(i) = 'PPF_MSR_BEH' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
4753         -- billable equipment hours
4754         x_measure_type(i) := g_HoursType;
4755 
4756         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_bill_equipment_hrs / l_effort_UOM;
4757 
4758         --l_overview_type(l_actual_index).ptd_bill_equipment_hrs
4759 
4760         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_bill_equipment_hrs / l_effort_UOM;
4761 
4762         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_bill_equipment_hrs / l_effort_UOM;
4763 
4764         l_itd_value(i):=l_overview_type(l_actual_index).itd_bill_equipment_hrs / l_effort_UOM;
4765 
4766         l_ac_value(i):=l_overview_type(l_actual_index).ac_bill_equipment_hrs / l_effort_UOM;
4767 
4768         l_prp_value(i):=l_overview_type(l_actual_index).prp_bill_equipment_hrs / l_effort_UOM;
4769 
4770       ELSIF p_measure_set_code(i) = 'PPF_MSR_BLH' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
4771         -- billable labor hours
4772         x_measure_type(i) := g_HoursType;
4773 
4774         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_bill_labor_hrs / l_effort_UOM;
4775 
4776         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_bill_labor_hrs / l_effort_UOM;
4777 
4778         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_bill_labor_hrs / l_effort_UOM;
4779 
4780         l_itd_value(i):=l_overview_type(l_actual_index).itd_bill_labor_hrs / l_effort_UOM;
4781 
4782         l_ac_value(i):=l_overview_type(l_actual_index).ac_bill_labor_hrs / l_effort_UOM;
4783 
4784         l_prp_value(i):=l_overview_type(l_actual_index).prp_bill_labor_hrs / l_effort_UOM;
4785 
4786       ELSIF p_measure_set_code(i) = 'PPF_MSR_BPEPOTE' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
4787         -- billable labor hours % = billable labor hours / total labor hrs
4788         x_measure_type(i) := g_PercentType;
4789 
4790         IF l_overview_type(l_actual_index).ptd_labor_hrs <> 0 THEN
4791           l_ptd_value(i):=100 * l_overview_type(l_actual_index).ptd_bill_labor_hrs /
4792                           l_overview_type(l_actual_index).ptd_labor_hrs;
4793         END IF;
4794 
4795         IF l_overview_type(l_actual_index).qtd_labor_hrs <> 0 THEN
4796           l_qtd_value(i):=100 * l_overview_type(l_actual_index).qtd_bill_labor_hrs /
4797                           l_overview_type(l_actual_index).qtd_labor_hrs;
4798         END IF;
4799 
4800         IF l_overview_type(l_actual_index).ytd_labor_hrs <> 0 THEN
4801           l_ytd_value(i):=100 * l_overview_type(l_actual_index).ytd_bill_labor_hrs /
4802                           l_overview_type(l_actual_index).ytd_labor_hrs;
4803         END IF;
4804 
4805         IF l_overview_type(l_actual_index).itd_labor_hrs <> 0 THEN
4806           l_itd_value(i):=100 * l_overview_type(l_actual_index).itd_bill_labor_hrs /
4807                           l_overview_type(l_actual_index).itd_labor_hrs;
4808         END IF;
4809 
4810         IF l_overview_type(l_actual_index).ac_labor_hrs <> 0 THEN
4811           l_ac_value(i):=100 * l_overview_type(l_actual_index).ac_bill_labor_hrs /
4812                           l_overview_type(l_actual_index).ac_labor_hrs;
4813         END IF;
4814 
4815         IF l_overview_type(l_actual_index).prp_labor_hrs <> 0 THEN
4816           l_prp_value(i):=100 * l_overview_type(l_actual_index).prp_bill_labor_hrs /
4817                           l_overview_type(l_actual_index).prp_labor_hrs;
4818         END IF;
4819 
4820       ELSIF p_measure_set_code(i) = 'PPF_MSR_CA' THEN
4821         --cash paid (from PJI_AC_PROJ_F)
4822         x_measure_type(i) := g_CurrencyType;
4823 
4824         l_ptd_value(i):=l_pji_facts.ptd_ar_cash_applied_amount / l_factor_by;
4825 
4826         l_qtd_value(i):=l_pji_facts.qtd_ar_cash_applied_amount / l_factor_by;
4827 
4828         l_ytd_value(i):=l_pji_facts.ytd_ar_cash_applied_amount / l_factor_by;
4829 
4830         l_itd_value(i):=l_pji_facts.itd_ar_cash_applied_amount / l_factor_by;
4831 
4832         l_ac_value(i):=l_pji_facts.ac_ar_cash_applied_amount / l_factor_by;
4833 
4834         l_prp_value(i):=l_pji_facts.prp_ar_cash_applied_amount / l_factor_by;
4835 
4836       ELSIF (p_measure_set_code(i) = 'PPF_MSR_CB2C' OR p_measure_set_code(i) = 'PPF_MSR_PV2') AND bitand(l_check_plan_versions, g_CstBudget2_is_present) = g_CstBudget2_is_present THEN
4837         -- current Budget 2 Cost
4838         x_measure_type(i) := g_CurrencyType;
4839 
4840 	  	IF p_measure_set_code(i) = 'PPF_MSR_CB2C' THEN
4841 	        l_ptd_value(i):=l_overview_type(l_cost_budget2_index).ptd_burdened_cost / l_factor_by;
4842 
4843 	        l_qtd_value(i):=l_overview_type(l_cost_budget2_index).qtd_burdened_cost / l_factor_by;
4844 
4845 	        l_ytd_value(i):=l_overview_type(l_cost_budget2_index).ytd_burdened_cost / l_factor_by;
4846 
4847 	        l_prp_value(i):=l_overview_type(l_cost_budget2_index).prp_burdened_cost / l_factor_by;
4848 
4849 		END IF;
4850 
4851         l_itd_value(i):=l_overview_type(l_cost_budget2_index).itd_burdened_cost / l_factor_by;
4852 
4853         l_ac_value(i):=l_overview_type(l_cost_budget2_index).ac_burdened_cost / l_factor_by;
4854 
4855       ELSIF p_measure_set_code(i) = 'PPF_MSR_CB2EH' AND bitand(l_check_plan_versions, g_CstBudget2_is_present) = g_CstBudget2_is_present THEN
4856         -- current budget 2 equipment hours
4857         x_measure_type(i) := g_HoursType;
4858 
4859         l_ptd_value(i):=l_overview_type(l_cost_budget2_index).ptd_equipment_hrs / l_effort_UOM;
4860 
4861         l_qtd_value(i):=l_overview_type(l_cost_budget2_index).qtd_equipment_hrs / l_effort_UOM;
4862 
4863         l_ytd_value(i):=l_overview_type(l_cost_budget2_index).ytd_equipment_hrs / l_effort_UOM;
4864 
4865         l_itd_value(i):=l_overview_type(l_cost_budget2_index).itd_equipment_hrs / l_effort_UOM;
4866 
4867         l_ac_value(i):=l_overview_type(l_cost_budget2_index).ac_equipment_hrs / l_effort_UOM;
4868 
4869         l_prp_value(i):=l_overview_type(l_cost_budget2_index).prp_equipment_hrs / l_effort_UOM;
4870 
4871       ELSIF p_measure_set_code(i) = 'PPF_MSR_CB2LH' AND bitand(l_check_plan_versions, g_CstBudget2_is_present) = g_CstBudget2_is_present THEN
4872         -- current budget 2 labor hours
4873         x_measure_type(i) := g_HoursType;
4874 
4875         l_ptd_value(i):=l_overview_type(l_cost_budget2_index).ptd_labor_hrs / l_effort_UOM;
4876 
4877         l_qtd_value(i):=l_overview_type(l_cost_budget2_index).qtd_labor_hrs / l_effort_UOM;
4878 
4879         l_ytd_value(i):=l_overview_type(l_cost_budget2_index).ytd_labor_hrs / l_effort_UOM;
4880 
4881         l_itd_value(i):=l_overview_type(l_cost_budget2_index).itd_labor_hrs / l_effort_UOM;
4882 
4883         l_ac_value(i):=l_overview_type(l_cost_budget2_index).ac_labor_hrs / l_effort_UOM;
4884 
4885         l_prp_value(i):=l_overview_type(l_cost_budget2_index).prp_labor_hrs / l_effort_UOM;
4886 
4887       ELSIF p_measure_set_code(i) = 'PPF_MSR_CB2M' /*AND bitand(l_check_plan_versions, g_CstRevBudget2) = g_CstRevBudget2*/ THEN --commented for bug 6958448
4888         -- Current budget 2 margin =
4889         --      current budget 2 revenue - current budget 2 cost
4890         --
4891         x_measure_type(i) := g_CurrencyType;
4892 
4893         l_ptd_value(i):=(nvl(l_overview_type(l_rev_budget2_index).ptd_revenue,0)-
4894                                  nvl(l_overview_type(l_cost_budget2_index).ptd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
4895 
4896         l_qtd_value(i):=(nvl(l_overview_type(l_rev_budget2_index).qtd_revenue,0)-
4897                                  nvl(l_overview_type(l_cost_budget2_index).qtd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
4898 
4899         l_ytd_value(i):=(nvl(l_overview_type(l_rev_budget2_index).ytd_revenue,0)-
4900                                  nvl(l_overview_type(l_cost_budget2_index).ytd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
4901 
4902         l_itd_value(i):=(nvl(l_overview_type(l_rev_budget2_index).itd_revenue,0)-
4903                                  nvl(l_overview_type(l_cost_budget2_index).itd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
4904 
4905         l_ac_value(i):=(nvl(l_overview_type(l_rev_budget2_index).ac_revenue,0)-
4906                                 nvl(l_overview_type(l_cost_budget2_index).ac_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
4907 
4908         l_prp_value(i):=(nvl(l_overview_type(l_rev_budget2_index).prp_revenue,0)-
4909                                  nvl(l_overview_type(l_cost_budget2_index).prp_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
4910 
4911       ELSIF p_measure_set_code(i) = 'PPF_MSR_CB2R' AND bitand(l_check_plan_versions, g_RevBudget2_is_present) = g_RevBudget2_is_present THEN
4912         -- Current Budget 2 Revenue
4913         x_measure_type(i) := g_CurrencyType;
4914 
4915         l_ptd_value(i):=l_overview_type(l_rev_budget2_index).ptd_revenue / l_factor_by;
4916 
4917         l_qtd_value(i):=l_overview_type(l_rev_budget2_index).qtd_revenue / l_factor_by;
4918 
4919         l_ytd_value(i):=l_overview_type(l_rev_budget2_index).ytd_revenue / l_factor_by;
4920 
4921         l_itd_value(i):=l_overview_type(l_rev_budget2_index).itd_revenue / l_factor_by;
4922 
4923         l_ac_value(i):=l_overview_type(l_rev_budget2_index).ac_revenue / l_factor_by;
4924 
4925         l_prp_value(i):=l_overview_type(l_rev_budget2_index).prp_revenue / l_factor_by;
4926 
4927       ELSIF p_measure_set_code(i) = 'PPF_MSR_CB2C' AND bitand(l_check_plan_versions, g_CstBudget2_is_present) = g_CstBudget2_is_present THEN
4928         -- current Budget 2 Raw Cost
4929         x_measure_type(i) := g_CurrencyType;
4930 
4931         l_ptd_value(i):=l_overview_type(l_cost_budget2_index).ptd_raw_cost / l_factor_by;
4932 
4933         l_qtd_value(i):=l_overview_type(l_cost_budget2_index).qtd_raw_cost / l_factor_by;
4934 
4935         l_ytd_value(i):=l_overview_type(l_cost_budget2_index).ytd_raw_cost / l_factor_by;
4936 
4937         l_itd_value(i):=l_overview_type(l_cost_budget2_index).itd_raw_cost / l_factor_by;
4938 
4939         l_ac_value(i) :=l_overview_type(l_cost_budget2_index).ac_raw_cost / l_factor_by;
4940 
4941         l_prp_value(i):=l_overview_type(l_cost_budget2_index).prp_raw_cost / l_factor_by;
4942 
4943       ELSIF p_measure_set_code(i) = 'PPF_MSR_CB2MP' /*AND bitand(l_check_plan_versions, g_CstRevBudget2) = g_CstRevBudget2 */THEN --commented for bug 6958448
4944         -- Current budget 2 margin percent =
4945         --      current budget 2 margin / current budget 2 revenue * 100
4946         --
4947         x_measure_type(i) := g_PercentType;
4948 
4949         IF l_overview_type(l_rev_budget2_index).ptd_revenue <> 0 THEN
4950             l_num:= nvl(l_overview_type(l_rev_budget2_index).ptd_revenue,0)-nvl(l_overview_type(l_cost_budget2_index).ptd_burdened_cost,0); -- NVL for Bug#6844202
4951             l_ptd_value(i):=(l_num / l_overview_type(l_rev_budget2_index).ptd_revenue) * 100;
4952         ELSE
4953             l_ptd_value(i):= NULL;
4954         END IF;
4955 
4956         IF l_overview_type(l_rev_budget2_index).qtd_revenue <> 0 THEN
4957             l_num:= nvl(l_overview_type(l_rev_budget2_index).qtd_revenue,0)-nvl(l_overview_type(l_cost_budget2_index).qtd_burdened_cost,0); -- NVL for Bug#6844202
4958             l_qtd_value(i):=(l_num / l_overview_type(l_rev_budget2_index).qtd_revenue) * 100;
4959         ELSE
4960             l_qtd_value(i):= NULL;
4961         END IF;
4962 
4963         IF l_overview_type(l_rev_budget2_index).ytd_revenue <> 0 THEN
4964             l_num:= nvl(l_overview_type(l_rev_budget2_index).ytd_revenue,0)-nvl(l_overview_type(l_cost_budget2_index).ytd_burdened_cost,0); -- NVL for Bug#6844202
4965             l_ytd_value(i):=(l_num / l_overview_type(l_rev_budget2_index).ytd_revenue) * 100;
4966         ELSE
4967             l_ytd_value(i):= NULL;
4968         END IF;
4969 
4970         IF l_overview_type(l_rev_budget2_index).itd_revenue <> 0 THEN
4971             l_num:= nvl(l_overview_type(l_rev_budget2_index).itd_revenue,0)-nvl(l_overview_type(l_cost_budget2_index).itd_burdened_cost,0); -- NVL for Bug#6844202
4972             l_itd_value(i):=(l_num / l_overview_type(l_rev_budget2_index).itd_revenue) * 100;
4973         ELSE
4974             l_itd_value(i):= NULL;
4975         END IF;
4976 
4977         IF l_overview_type(l_rev_budget2_index).ac_revenue <> 0 THEN
4978             l_num:= nvl(l_overview_type(l_rev_budget2_index).ac_revenue,0)-nvl(l_overview_type(l_cost_budget2_index).ac_burdened_cost,0); -- NVL for Bug#6844202
4979             l_ac_value(i):=(l_num / l_overview_type(l_rev_budget2_index).ac_revenue) * 100;
4980         ELSE
4981             l_ac_value(i):= NULL;
4982         END IF;
4983 
4984         IF l_overview_type(l_rev_budget2_index).prp_revenue <> 0 THEN
4985             l_num:= nvl(l_overview_type(l_rev_budget2_index).prp_revenue,0)-nvl(l_overview_type(l_cost_budget2_index).prp_burdened_cost,0); -- NVL for Bug#6844202
4986             l_prp_value(i):=(l_num / l_overview_type(l_rev_budget2_index).prp_revenue) * 100;
4987         ELSE
4988             l_prp_value(i):= NULL;
4989         END IF;
4990 
4991       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBBC' AND bitand(l_check_plan_versions, g_CstBudget_is_present) = g_CstBudget_is_present THEN
4992         -- Current Budget Cost
4993         x_measure_type(i):= g_CurrencyType;
4994 
4995         l_ptd_value(i):=l_overview_type(l_cost_budget_index).ptd_burdened_cost / l_factor_by;
4996 
4997         l_qtd_value(i):=l_overview_type(l_cost_budget_index).qtd_burdened_cost / l_factor_by;
4998 
4999         l_ytd_value(i):=l_overview_type(l_cost_budget_index).ytd_burdened_cost / l_factor_by;
5000 
5001         l_itd_value(i):=l_overview_type(l_cost_budget_index).itd_burdened_cost / l_factor_by;
5002 
5003         l_ac_value(i):=l_overview_type(l_cost_budget_index).ac_burdened_cost / l_factor_by;
5004 
5005         l_prp_value(i):=l_overview_type(l_cost_budget_index).prp_burdened_cost / l_factor_by;
5006 
5007       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBCTC'
5008         AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
5009         --
5010         -- Current Budget Cost - Total Cost
5011         --
5012         x_measure_type(i):= g_CurrencyType;
5013 
5014         l_ptd_value(i):=NULL;
5015 
5016         l_qtd_value(i):=NULL;
5017 
5018         l_ytd_value(i):=NULL;
5019 
5020         l_itd_value(i):=(l_overview_type(l_cost_budget_index).itd_burdened_cost -
5021                         l_overview_type(l_actual_index).ytd_burdened_cost) / l_factor_by;
5022 
5023         l_ac_value(i) :=(l_overview_type(l_cost_budget_index).ac_burdened_cost  -
5024                         l_overview_type(l_actual_index).ac_burdened_cost) / l_factor_by;
5025 
5026         l_prp_value(i):=NULL;
5027 
5028       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBCVOB' AND bitand(l_check_plan_versions, g_CstOrigCstBudget) = g_CstOrigCstBudget THEN
5029         -- curr budget cost variance from orig budget
5030         --      (Current Budget Cost - Original Budget Cost)
5031         --
5032         x_measure_type(i) := g_CurrencyType;
5033 
5034         l_ptd_value(i):= (l_overview_type(l_cost_budget_index).ptd_burdened_cost -
5035                          l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost) / l_factor_by;
5036 
5037         l_qtd_value(i):= (l_overview_type(l_cost_budget_index).qtd_burdened_cost -
5038                          l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost) / l_factor_by;
5039 
5040         l_ytd_value(i):= (l_overview_type(l_cost_budget_index).ytd_burdened_cost -
5041                          l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost) / l_factor_by;
5042 
5043         l_itd_value(i):= (l_overview_type(l_cost_budget_index).itd_burdened_cost -
5044                          l_overview_type(l_orig_cost_budget_index).itd_burdened_cost) / l_factor_by;
5045 
5046         l_ac_value(i):=  (l_overview_type(l_cost_budget_index).ac_burdened_cost -
5047                          l_overview_type(l_orig_cost_budget_index).ac_burdened_cost) / l_factor_by;
5048 
5049         l_prp_value(i):= (l_overview_type(l_cost_budget_index).prp_burdened_cost -
5050                          l_overview_type(l_orig_cost_budget_index).prp_burdened_cost) / l_factor_by;
5051 
5052       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBEH' AND bitand(l_check_plan_versions, g_CstBudget_is_present) = g_CstBudget_is_present THEN
5053         -- current budget equipment hours
5054         x_measure_type(i) := g_HoursType;
5055 
5056         l_ptd_value(i):=l_overview_type(l_cost_budget_index).ptd_equipment_hrs / l_effort_UOM;
5057 
5058         l_qtd_value(i):=l_overview_type(l_cost_budget_index).qtd_equipment_hrs / l_effort_UOM;
5059 
5060         l_ytd_value(i):=l_overview_type(l_cost_budget_index).ytd_equipment_hrs / l_effort_UOM;
5061 
5062         l_itd_value(i):=l_overview_type(l_cost_budget_index).itd_equipment_hrs / l_effort_UOM;
5063 
5064         l_ac_value(i):=l_overview_type(l_cost_budget_index).ac_equipment_hrs / l_effort_UOM;
5065 
5066         l_prp_value(i):=l_overview_type(l_cost_budget_index).prp_equipment_hrs / l_effort_UOM;
5067 
5068       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBLH' AND bitand(l_check_plan_versions, g_CstBudget_is_present) = g_CstBudget_is_present THEN
5069         -- current budget 2 labor hours
5070         x_measure_type(i) := g_HoursType;
5071 
5072         l_ptd_value(i):=l_overview_type(l_cost_budget_index).ptd_labor_hrs / l_effort_UOM;
5073 
5074         l_qtd_value(i):=l_overview_type(l_cost_budget_index).qtd_labor_hrs / l_effort_UOM;
5075 
5076         l_ytd_value(i):=l_overview_type(l_cost_budget_index).ytd_labor_hrs / l_effort_UOM;
5077 
5078         l_itd_value(i):=l_overview_type(l_cost_budget_index).itd_labor_hrs / l_effort_UOM;
5079 
5080         l_ac_value(i):=l_overview_type(l_cost_budget_index).ac_labor_hrs / l_effort_UOM;
5081 
5082         l_prp_value(i):=l_overview_type(l_cost_budget_index).prp_labor_hrs / l_effort_UOM;
5083 
5084       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBM' /*AND bitand(l_check_plan_versions, g_CstRevBudget) = g_CstRevBudget*/ THEN --commented for bug 6958448
5085         --
5086         -- Current budget margin =
5087         --      current budget revenue - current budget cost
5088         --
5089         x_measure_type(i) := g_CurrencyType;
5090 
5091 	l_ptd_value(i):=(nvl(l_overview_type(l_rev_budget_index).ptd_revenue,0)-nvl(l_overview_type(l_cost_budget_index).ptd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
5092 
5093         l_qtd_value(i):=(nvl(l_overview_type(l_rev_budget_index).qtd_revenue,0)-nvl(l_overview_type(l_cost_budget_index).qtd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
5094 
5095         l_ytd_value(i):=(nvl(l_overview_type(l_rev_budget_index).ytd_revenue,0)-nvl(l_overview_type(l_cost_budget_index).ytd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
5096 
5097         l_itd_value(i):=(nvl(l_overview_type(l_rev_budget_index).itd_revenue,0)-nvl(l_overview_type(l_cost_budget_index).itd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
5098 
5099         l_ac_value(i):=(nvl(l_overview_type(l_rev_budget_index).ac_revenue,0)-nvl(l_overview_type(l_cost_budget_index).ac_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
5100 
5101         l_prp_value(i):=(nvl(l_overview_type(l_rev_budget_index).prp_revenue,0)-nvl(l_overview_type(l_cost_budget_index).prp_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
5102 
5103       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBMP' /*AND bitand(l_check_plan_versions, g_CstRevBudget) = g_CstRevBudget*/ THEN --commented for bug 6958448
5104         -- Current budget margin percent =
5105         --      current budget margin / current budget revenue * 100
5106         --
5107         x_measure_type(i) := g_PercentType;
5108 
5109         IF l_overview_type(l_rev_budget_index).ptd_revenue <> 0 THEN
5110             l_num:= nvl(l_overview_type(l_rev_budget_index).ptd_revenue,0)-nvl(l_overview_type(l_cost_budget_index).ptd_burdened_cost,0); -- NVL for Bug#6844202
5111             l_ptd_value(i):=(l_num / l_overview_type(l_rev_budget_index).ptd_revenue) * 100;
5112         ELSE
5113             l_ptd_value(i):= NULL;
5114         END IF;
5115 
5116         IF l_overview_type(l_rev_budget_index).qtd_revenue <> 0 THEN
5117             l_num:= nvl(l_overview_type(l_rev_budget_index).qtd_revenue,0)-nvl(l_overview_type(l_cost_budget_index).qtd_burdened_cost,0); -- NVL for Bug#6844202
5118             l_qtd_value(i):=(l_num / l_overview_type(l_rev_budget_index).qtd_revenue) * 100;
5119         ELSE
5120             l_qtd_value(i):= NULL;
5121         END IF;
5122 
5123         IF l_overview_type(l_rev_budget_index).ytd_revenue <> 0 THEN
5124             l_num:= nvl(l_overview_type(l_rev_budget_index).ytd_revenue,0)-nvl(l_overview_type(l_cost_budget_index).ytd_burdened_cost,0); -- NVL for Bug#6844202
5125             l_ytd_value(i):=(l_num / l_overview_type(l_rev_budget_index).ytd_revenue) * 100;
5126         ELSE
5127             l_ytd_value(i):= NULL;
5128         END IF;
5129 
5130         IF l_overview_type(l_rev_budget_index).itd_revenue <> 0 THEN
5131             l_num:= nvl(l_overview_type(l_rev_budget_index).itd_revenue,0)-nvl(l_overview_type(l_cost_budget_index).itd_burdened_cost,0); -- NVL for Bug#6844202
5132             l_itd_value(i):=(l_num / l_overview_type(l_rev_budget_index).itd_revenue) * 100;
5133         ELSE
5134             l_itd_value(i):= NULL;
5135         END IF;
5136 
5137         IF l_overview_type(l_rev_budget_index).ac_revenue <> 0 THEN
5138             l_num:= nvl(l_overview_type(l_rev_budget_index).ac_revenue,0)-nvl(l_overview_type(l_cost_budget_index).ac_burdened_cost,0); -- NVL for Bug#6844202
5139             l_ac_value(i):=(l_num / l_overview_type(l_rev_budget_index).ac_revenue) * 100;
5140         ELSE
5141             l_ac_value(i):= NULL;
5142         END IF;
5143 
5144         IF l_overview_type(l_rev_budget_index).prp_revenue <> 0 THEN
5145             l_num:= nvl(l_overview_type(l_rev_budget_index).prp_revenue,0)-nvl(l_overview_type(l_cost_budget_index).prp_burdened_cost,0); -- NVL for Bug#6844202
5146             l_prp_value(i):=(l_num / l_overview_type(l_rev_budget_index).prp_revenue) * 100;
5147         ELSE
5148             l_prp_value(i):= NULL;
5149         END IF;
5150 
5151       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBMPVOB' AND bitand(l_check_plan_versions, g_CstRevBudgetOrigBudget) = g_CstRevBudgetOrigBudget THEN
5152         -- Current budget margin percent variance from original budget =
5153         --      (budget rev. * orig. budget burdened cost - orig. budget rev * budget Burden cost)/ (budget rev.*orig.budget Rev)
5154         --
5155         x_measure_type(i) := g_IndexType;
5156 
5157         l_num := l_overview_type(l_rev_budget_index).ptd_revenue * l_overview_type(l_orig_rev_budget_index).ptd_revenue;
5158         IF l_num <> 0 THEN
5159             l_ptd_value(i):= 100 * (
5160                              l_overview_type(l_rev_budget_index).ptd_revenue *
5161                              l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost -
5162                              l_overview_type(l_orig_rev_budget_index).ptd_revenue *
5163                              l_overview_type(l_cost_budget_index).ptd_burdened_cost)/l_num;
5164         ELSE
5165             l_ptd_value(i):= NULL;
5166         END IF;
5167 
5168         l_num := l_overview_type(l_rev_budget_index).qtd_revenue * l_overview_type(l_orig_rev_budget_index).qtd_revenue;
5169         IF l_num <> 0 THEN
5170             l_qtd_value(i):= 100 * (
5171                              l_overview_type(l_rev_budget_index).qtd_revenue *
5172                              l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost -
5173                              l_overview_type(l_orig_rev_budget_index).qtd_revenue *
5174                              l_overview_type(l_cost_budget_index).qtd_burdened_cost)/l_num;
5175         ELSE
5176             l_qtd_value(i):= NULL;
5177         END IF;
5178 
5179         l_num := l_overview_type(l_rev_budget_index).ytd_revenue * l_overview_type(l_orig_rev_budget_index).ytd_revenue;
5180         IF l_num <> 0 THEN
5181             l_ytd_value(i):= 100 * (
5182                              l_overview_type(l_rev_budget_index).ytd_revenue *
5183                              l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost -
5184                              l_overview_type(l_orig_rev_budget_index).ytd_revenue *
5185                              l_overview_type(l_cost_budget_index).ytd_burdened_cost)/l_num;
5186         ELSE
5187             l_ytd_value(i):= NULL;
5188         END IF;
5189 
5190         l_num := l_overview_type(l_rev_budget_index).itd_revenue * l_overview_type(l_orig_rev_budget_index).itd_revenue;
5191         IF l_num <> 0 THEN
5192             l_itd_value(i):= 100 * (
5193                              l_overview_type(l_rev_budget_index).itd_revenue *
5194                              l_overview_type(l_orig_cost_budget_index).itd_burdened_cost -
5195                              l_overview_type(l_orig_rev_budget_index).itd_revenue *
5196                              l_overview_type(l_cost_budget_index).itd_burdened_cost)/l_num;
5197         ELSE
5198             l_itd_value(i):= NULL;
5199         END IF;
5200 
5201         l_num := l_overview_type(l_rev_budget_index).ac_revenue * l_overview_type(l_orig_rev_budget_index).ac_revenue;
5202         IF l_num <> 0 THEN
5203             l_ac_value(i):= 100 * (
5204                             l_overview_type(l_rev_budget_index).ac_revenue *
5205                             l_overview_type(l_orig_cost_budget_index).ac_burdened_cost -
5206                             l_overview_type(l_orig_rev_budget_index).ac_revenue *
5207                             l_overview_type(l_cost_budget_index).ac_burdened_cost)/l_num;
5208         ELSE
5209             l_ac_value(i):= NULL;
5210         END IF;
5211 
5212         l_num := l_overview_type(l_rev_budget_index).prp_revenue * l_overview_type(l_orig_rev_budget_index).prp_revenue;
5213         IF l_num <> 0 THEN
5214             l_prp_value(i):= 100 * (
5215                              l_overview_type(l_rev_budget_index).prp_revenue *
5216                              l_overview_type(l_orig_cost_budget_index).prp_burdened_cost -
5217                              l_overview_type(l_orig_rev_budget_index).prp_revenue *
5218                              l_overview_type(l_cost_budget_index).prp_burdened_cost)/l_num;
5219         ELSE
5220             l_prp_value(i):= NULL;
5221         END IF;
5222 
5223       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBMVOB' AND bitand(l_check_plan_versions, g_CstRevBudgetOrigBudget) = g_CstRevBudgetOrigBudget THEN
5224         -- Current budget margin variance from original budget =
5225         --      (budget rev. - budget Burden cost) - (orig budget rev - orig budget burd. cost)
5226         --
5227         x_measure_type(i) := g_CurrencyType;
5228 
5229         l_ptd_value(i):= (
5230                          l_overview_type(l_rev_budget_index).ptd_revenue +
5231                          l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost -
5232                          l_overview_type(l_orig_rev_budget_index).ptd_revenue -
5233                          l_overview_type(l_cost_budget_index).ptd_burdened_cost) / l_factor_by;
5234 
5235         l_qtd_value(i):= (
5236                          l_overview_type(l_rev_budget_index).qtd_revenue +
5237                          l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost -
5238                          l_overview_type(l_orig_rev_budget_index).qtd_revenue -
5239                          l_overview_type(l_cost_budget_index).qtd_burdened_cost) / l_factor_by;
5240  /* Corrected the YTD formula for bug 6961599 */
5241         l_ytd_value(i):= (
5242                          l_overview_type(l_rev_budget_index).ytd_revenue+
5243                          l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost -
5244                          l_overview_type(l_orig_rev_budget_index).ytd_revenue -
5245                          l_overview_type(l_cost_budget_index).ytd_burdened_cost) / l_factor_by;
5246 
5247         l_itd_value(i):= (
5248                          l_overview_type(l_rev_budget_index).itd_revenue +
5249                          l_overview_type(l_orig_cost_budget_index).itd_burdened_cost -
5250                          l_overview_type(l_orig_rev_budget_index).itd_revenue -
5251                          l_overview_type(l_cost_budget_index).itd_burdened_cost) / l_factor_by;
5252 
5253         l_ac_value(i) := (
5254                          l_overview_type(l_rev_budget_index).ac_revenue +
5255                          l_overview_type(l_orig_cost_budget_index).ac_burdened_cost -
5256                          l_overview_type(l_orig_rev_budget_index).ac_revenue -
5257                          l_overview_type(l_cost_budget_index).ac_burdened_cost) / l_factor_by;
5258 
5259         l_prp_value(i):= (
5260                          l_overview_type(l_rev_budget_index).prp_revenue +
5261                          l_overview_type(l_orig_cost_budget_index).prp_burdened_cost -
5262                          l_overview_type(l_orig_rev_budget_index).prp_revenue -
5263                          l_overview_type(l_cost_budget_index).prp_burdened_cost) / l_factor_by;
5264 
5265       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBR' AND bitand(l_check_plan_versions, g_RevBudget_is_present) = g_RevBudget_is_present THEN
5266         -- Current Budget Revenue
5267         x_measure_type(i) := g_CurrencyType;
5268 
5269         l_ptd_value(i):=l_overview_type(l_rev_budget_index).ptd_revenue / l_factor_by;
5270 
5271         l_qtd_value(i):=l_overview_type(l_rev_budget_index).qtd_revenue / l_factor_by;
5272 
5273         l_ytd_value(i):=l_overview_type(l_rev_budget_index).ytd_revenue / l_factor_by;
5274 
5275         l_itd_value(i):=l_overview_type(l_rev_budget_index).itd_revenue / l_factor_by;
5276 
5277         l_ac_value(i):=l_overview_type(l_rev_budget_index).ac_revenue / l_factor_by;
5278 
5279         l_prp_value(i):=l_overview_type(l_rev_budget_index).prp_revenue / l_factor_by;
5280 
5281       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBRC' AND bitand(l_check_plan_versions, g_CstBudget_is_present) = g_CstBudget_is_present THEN
5282         -- Current Budget Raw Cost
5283         x_measure_type(i):= g_CurrencyType;
5284 
5285         l_ptd_value(i):= l_overview_type(l_cost_budget_index).ptd_raw_cost / l_factor_by;
5286 
5287         l_qtd_value(i):= l_overview_type(l_cost_budget_index).qtd_raw_cost / l_factor_by;
5288 
5289         l_ytd_value(i):= l_overview_type(l_cost_budget_index).ytd_raw_cost / l_factor_by;
5290 
5291         l_itd_value(i):= l_overview_type(l_cost_budget_index).itd_raw_cost / l_factor_by;
5292 
5293         l_ac_value(i) := l_overview_type(l_cost_budget_index).ac_raw_cost / l_factor_by;
5294 
5295         l_prp_value(i):= l_overview_type(l_cost_budget_index).prp_raw_cost / l_factor_by;
5296 
5297       ELSIF p_measure_set_code(i) = 'PPF_MSR_CB2RC' AND bitand(l_check_plan_versions, g_CstBudget2_is_present) = g_CstBudget2_is_present THEN
5298         -- Current Budget 2 Raw Cost
5299         x_measure_type(i):= g_CurrencyType;
5300 
5301         l_ptd_value(i):= l_overview_type(l_cost_budget2_index).ptd_raw_cost / l_factor_by;
5302 
5303         l_qtd_value(i):= l_overview_type(l_cost_budget2_index).qtd_raw_cost / l_factor_by;
5304 
5305         l_ytd_value(i):= l_overview_type(l_cost_budget2_index).ytd_raw_cost / l_factor_by;
5306 
5307         l_itd_value(i):= l_overview_type(l_cost_budget2_index).itd_raw_cost / l_factor_by;
5308 
5309         l_ac_value(i) := l_overview_type(l_cost_budget2_index).ac_raw_cost / l_factor_by;
5310 
5311         l_prp_value(i):= l_overview_type(l_cost_budget2_index).prp_raw_cost / l_factor_by;
5312 
5313       ELSIF p_measure_set_code(i) = 'PPF_MSR_CBRVOB' AND bitand(l_check_plan_versions, g_CstOrigCstBudget) = g_CstOrigCstBudget THEN
5314         -- curr budget Revenue variance from orig budget
5315         --      (Current Budget Revenue - Original Budget revenue)
5316         --
5317         x_measure_type(i) := g_CurrencyType;
5318 
5319         l_ptd_value(i):= (l_overview_type(l_rev_budget_index).ptd_revenue -
5320                          l_overview_type(l_orig_rev_budget_index).ptd_revenue) / l_factor_by;
5321 
5322         l_qtd_value(i):= (l_overview_type(l_rev_budget_index).qtd_revenue -
5323                          l_overview_type(l_orig_rev_budget_index).qtd_revenue) / l_factor_by;
5324 
5325         l_ytd_value(i):= (l_overview_type(l_rev_budget_index).ytd_revenue -
5326                          l_overview_type(l_orig_rev_budget_index).ytd_revenue) / l_factor_by;
5327 
5328         l_itd_value(i):= (l_overview_type(l_rev_budget_index).itd_revenue -
5329                          l_overview_type(l_orig_rev_budget_index).itd_revenue) / l_factor_by;
5330 
5331         l_ac_value(i) := (l_overview_type(l_rev_budget_index).ac_revenue -
5332                          l_overview_type(l_orig_rev_budget_index).ac_revenue)  / l_factor_by;
5333 
5334         l_prp_value(i):= (l_overview_type(l_rev_budget_index).prp_revenue -
5335                          l_overview_type(l_orig_rev_budget_index).prp_revenue) / l_factor_by;
5336 
5337       ELSIF p_measure_set_code(i) = 'PPF_MSR_CCPTC' AND
5338             bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
5339         --
5340         -- Capital Cost  % of Total Cost =
5341         --      Actual Capitalizable Burden Cost / Actual Burden cost
5342         --
5343         x_measure_type(i) := g_PercentType;
5344 
5345 --        IF l_capital_proj_mask = 1 THEN
5346 
5347           IF l_overview_type(l_actual_index).ptd_burdened_cost <> 0 THEN
5348               l_ptd_value(i):= 100 * (l_overview_type(l_actual_index).ptd_capitalizable_brdn_cost /
5349                                              l_overview_type(l_actual_index).ptd_burdened_cost);
5350           ELSE
5351               l_ptd_value(i):= NULL;
5352           END IF;
5353 
5354           IF l_overview_type(l_actual_index).qtd_burdened_cost <> 0 THEN
5355               l_qtd_value(i):=100 * (l_overview_type(l_actual_index).qtd_capitalizable_brdn_cost /
5356                                             l_overview_type(l_actual_index).qtd_burdened_cost);
5357           ELSE
5358               l_qtd_value(i):= NULL;
5359           END IF;
5360 
5361           IF l_overview_type(l_actual_index).ytd_burdened_cost <> 0 THEN
5362               l_ytd_value(i):=100 * (l_overview_type(l_actual_index).ytd_capitalizable_brdn_cost /
5363                                             l_overview_type(l_actual_index).ytd_burdened_cost);
5364           ELSE
5365               l_ytd_value(i):= NULL;
5366           END IF;
5367 
5368           IF l_overview_type(l_actual_index).itd_burdened_cost <> 0 THEN
5369               l_itd_value(i):=100 * (l_overview_type(l_actual_index).itd_capitalizable_brdn_cost /
5370                                             l_overview_type(l_actual_index).itd_burdened_cost);
5371           ELSE
5372               l_itd_value(i):= NULL;
5373           END IF;
5374 
5375           IF l_overview_type(l_actual_index).ac_burdened_cost <> 0 THEN
5376               l_ac_value(i):=100 * (l_overview_type(l_actual_index).ac_capitalizable_brdn_cost /
5377                                            l_overview_type(l_actual_index).ac_burdened_cost);
5378           ELSE
5379               l_ac_value(i):= NULL;
5380           END IF;
5381 
5382           IF l_overview_type(l_actual_index).prp_burdened_cost <> 0 THEN
5383               l_prp_value(i):=100 * (l_overview_type(l_actual_index).prp_capitalizable_brdn_cost /
5384                                             l_overview_type(l_actual_index).prp_burdened_cost);
5385           ELSE
5386               l_prp_value(i):= NULL;
5387           END IF;
5388 
5389 --        END IF;
5390 
5391       ELSIF p_measure_set_code(i) = 'PPF_MSR_CFRVPF' AND
5392             bitand(l_check_plan_versions, g_RevFcstRevPriorfcst) = g_RevFcstRevPriorfcst THEN
5393         --
5394         -- Current Forecast Revenue Variance from Prior Forecast =
5395         --   Curr. Forecast Revenue - Prior Forecast Revenue
5396         --
5397         x_measure_type(i) := g_CurrencyType;
5398 
5399         l_ptd_value(i):=(l_overview_type(l_rev_forecast_index).ptd_revenue -
5400                         l_overview_type(l_prior_rev_forecast_index).ptd_revenue) / l_factor_by;
5401 /* Un-Commented the code for Bug 7681638 i.e reverted fix of 6961599 */
5402   /* Commented for bug 6961599 as this measure shouldn't display values for QTD/YTD */
5403         l_qtd_value(i):=(l_overview_type(l_rev_forecast_index).qtd_revenue -
5404                         l_overview_type(l_prior_rev_forecast_index).qtd_revenue) / l_factor_by;
5405 
5406         l_ytd_value(i):=(l_overview_type(l_rev_forecast_index).ytd_revenue -
5407                         l_overview_type(l_prior_rev_forecast_index).ytd_revenue) / l_factor_by;
5408   /* Commented the code for Bug 7681638 Start
5409         l_qtd_value(i):=NULL;
5410 
5411         l_ytd_value(i):=NULL;
5412    Commented the code for Bug 7681638 End */
5413 
5414 
5415         l_itd_value(i):=(l_overview_type(l_rev_forecast_index).itd_revenue -
5416                         l_overview_type(l_prior_rev_forecast_index).itd_revenue) / l_factor_by;
5417 
5418         l_ac_value(i) :=(l_overview_type(l_rev_forecast_index).ac_revenue -
5419                         l_overview_type(l_prior_rev_forecast_index).ac_revenue)  / l_factor_by;
5420 
5421         l_prp_value(i):=(l_overview_type(l_rev_forecast_index).prp_revenue -
5422                         l_overview_type(l_prior_rev_forecast_index).prp_revenue) / l_factor_by;
5423 
5424       ELSIF p_measure_set_code(i) = 'PPF_MSR_CM' THEN
5425         --credit memos (from PJI_AC_PROJ_F)
5426         x_measure_type(i) := g_CurrencyType;
5427 
5428         l_ptd_value(i):=l_pji_facts.ptd_ar_credit_memo_amount / l_factor_by;
5429 
5430         l_qtd_value(i):=l_pji_facts.qtd_ar_credit_memo_amount / l_factor_by;
5431 
5432         l_ytd_value(i):=l_pji_facts.ytd_ar_credit_memo_amount / l_factor_by;
5433 
5434         l_itd_value(i):=l_pji_facts.itd_ar_credit_memo_amount / l_factor_by;
5435 
5436         l_ac_value(i):=l_pji_facts.ac_ar_credit_memo_amount / l_factor_by;
5437 
5438         l_prp_value(i):=l_pji_facts.prp_ar_credit_memo_amount / l_factor_by;
5439 
5440       ELSIF p_measure_set_code(i) = 'PPF_MSR_CP' THEN
5441         --cash paid (duplicate of cash allocated (from PJI_AC_PROJ_F)
5442         x_measure_type(i) := g_CurrencyType;
5443 
5444         l_ptd_value(i):=l_pji_facts.ptd_ar_cash_applied_amount / l_factor_by;
5445 
5446         l_qtd_value(i):=l_pji_facts.qtd_ar_cash_applied_amount / l_factor_by;
5447 
5448         l_ytd_value(i):=l_pji_facts.ytd_ar_cash_applied_amount / l_factor_by;
5449 
5450         l_itd_value(i):=l_pji_facts.itd_ar_cash_applied_amount / l_factor_by;
5451 
5452         l_ac_value(i):=l_pji_facts.ac_ar_cash_applied_amount / l_factor_by;
5453 
5454         l_prp_value(i):=l_pji_facts.prp_ar_cash_applied_amount / l_factor_by;
5455 
5456       ELSIF p_measure_set_code(i) = 'PPF_MSR_CPI' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
5457         -- Cost performance index =
5458         --      budget burden cost * completed percentage / actual burden cost
5459         --
5460         x_measure_type(i) := g_IndexType;
5461 
5462         l_ptd_value(i):=NULL;
5463 
5464         l_qtd_value(i):=NULL;
5465 
5466         l_ytd_value(i):=NULL;
5467 
5468         IF l_overview_type(l_actual_index).itd_burdened_cost <> 0 THEN
5469             l_itd_value(i):=(l_overview_type(l_cost_budget_index).ac_burdened_cost * l_completed_percentage
5470                             / l_overview_type(l_actual_index).itd_burdened_cost);
5471         ELSE
5472             l_itd_value(i):= NULL;
5473         END IF;
5474 
5475         IF l_overview_type(l_actual_index).ac_burdened_cost <> 0 THEN
5476             l_ac_value(i):=(l_overview_type(l_cost_budget_index).ac_burdened_cost * l_completed_percentage
5477                             / l_overview_type(l_actual_index).ac_burdened_cost);
5478         ELSE
5479             l_ac_value(i):= NULL;
5480         END IF;
5481 
5482         l_prp_value(i):= NULL;
5483 
5484       ELSIF p_measure_set_code(i) = 'PPF_MSR_CRBVOB' AND bitand(l_check_plan_versions, g_RevBudgetOrigbudget) = g_RevBudgetOrigbudget THEN
5485         --
5486         -- Current Rev Budget Variance from Original Budget=
5487         --      (Budget Rev - Orig Budget Rev )
5488         --
5489         x_measure_type(i) := g_CurrencyType;
5490 
5491         l_ptd_value(i):=(l_overview_type(l_rev_budget_index).ptd_revenue -
5492                         l_overview_type(l_orig_rev_budget_index).ptd_revenue) / l_factor_by;
5493 
5494         l_qtd_value(i):=(l_overview_type(l_rev_budget_index).qtd_revenue -
5495                         l_overview_type(l_orig_rev_budget_index).qtd_revenue) / l_factor_by;
5496 
5497         l_ytd_value(i):=(l_overview_type(l_rev_budget_index).ytd_revenue -
5498                         l_overview_type(l_orig_rev_budget_index).ytd_revenue) / l_factor_by;
5499 
5500         l_itd_value(i):=(l_overview_type(l_rev_budget_index).itd_revenue -
5501                         l_overview_type(l_orig_rev_budget_index).itd_revenue) / l_factor_by;
5502 
5503         l_ac_value(i) :=(l_overview_type(l_rev_budget_index).ac_revenue -
5504                         l_overview_type(l_orig_rev_budget_index).ac_revenue)  / l_factor_by;
5505 
5506         l_prp_value(i):=(l_overview_type(l_rev_budget_index).prp_revenue -
5507                         l_overview_type(l_orig_rev_budget_index).prp_revenue) / l_factor_by;
5508 
5509       ELSIF  p_measure_set_code(i) = 'PPF_MSR_CV' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
5510         --
5511         -- Cost variance =
5512         --      (Actual Burden Cost - Current Budget Cost)
5513         --
5514         x_measure_type(i) := g_CurrencyType;
5515 
5516         l_ptd_value(i):=(l_overview_type(l_actual_index).ptd_burdened_cost -
5517                         l_overview_type(l_cost_budget_index).ptd_burdened_cost) / l_factor_by;
5518 
5519         l_qtd_value(i):=(l_overview_type(l_actual_index).qtd_burdened_cost -
5520                         l_overview_type(l_cost_budget_index).qtd_burdened_cost) / l_factor_by;
5521 
5522         l_ytd_value(i):=(l_overview_type(l_actual_index).ytd_burdened_cost -
5523                         l_overview_type(l_cost_budget_index).ytd_burdened_cost) / l_factor_by;
5524 
5525         l_itd_value(i):=(l_overview_type(l_actual_index).itd_burdened_cost -
5526                         l_overview_type(l_cost_budget_index).itd_burdened_cost) / l_factor_by;
5527 
5528         l_ac_value(i):= (l_overview_type(l_actual_index).ac_burdened_cost -
5529                         l_overview_type(l_cost_budget_index).ac_burdened_cost)  / l_factor_by;
5530 
5531         l_prp_value(i):=(l_overview_type(l_actual_index).prp_burdened_cost -
5532                         l_overview_type(l_cost_budget_index).prp_burdened_cost) / l_factor_by;
5533 
5534       ELSIF p_measure_set_code(i) = 'PPF_MSR_CZC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
5535         --
5536         -- capitalized cost
5537         --
5538         x_measure_type(i) := g_CurrencyType;
5539 
5540 --        IF l_capital_proj_mask = 1 THEN
5541 
5542           l_ptd_value(i):=l_overview_type(l_actual_index).ptd_capitalizable_brdn_cost / l_factor_by;
5543 
5544           l_qtd_value(i):=l_overview_type(l_actual_index).qtd_capitalizable_brdn_cost / l_factor_by;
5545 
5546           l_ytd_value(i):=l_overview_type(l_actual_index).ytd_capitalizable_brdn_cost / l_factor_by;
5547 
5548           l_itd_value(i):=l_overview_type(l_actual_index).itd_capitalizable_brdn_cost / l_factor_by;
5549 
5550           l_ac_value(i):=l_overview_type(l_actual_index).ac_capitalizable_brdn_cost / l_factor_by;
5551 
5552           l_prp_value(i):=l_overview_type(l_actual_index).prp_capitalizable_brdn_cost / l_factor_by;
5553 
5554 --        END IF;
5555 
5556       ELSIF p_measure_set_code(i) = 'PPF_MSR_DSO' THEN
5557         --
5558         -- Days Sales Outstanding (PJI_AC_PROJ_F)
5559         --      (cash allocated / Billed Amount) * number of days in the period
5560         --
5561         x_measure_type(i) := g_DaysType;
5562 /*
5563         IF l_pji_facts.ptd_ar_invoice_amount <> 0 THEN
5564             l_num := (l_pji_facts.ptd_ar_cash_applied_amount / l_pji_facts.ptd_ar_invoice_amount) * xDaysInPeriod;
5565             l_ptd_value(i):=l_num;
5566         ELSE
5567             l_ptd_value(i):= NULL;
5568         END IF;
5569 
5570         IF l_pji_facts.qtd_ar_invoice_amount <> 0 THEN
5571             l_num := (l_pji_facts.qtd_ar_cash_applied_amount / l_pji_facts.qtd_ar_invoice_amount) * xDaysInPeriod;
5572             l_qtd_value(i):=l_num;
5573         ELSE
5574             l_qtd_value(i):= NULL;
5575         END IF;
5576 
5577         IF l_pji_facts.ytd_ar_invoice_amount <> 0 THEN
5578             l_num := (l_pji_facts.ytd_ar_cash_applied_amount / l_pji_facts.ytd_ar_invoice_amount) * xDaysInPeriod;
5579             l_ytd_value(i):=l_num;
5580         ELSE
5581             l_ytd_value(i):= NULL;
5582         END IF;
5583 
5584 */
5585 
5586         IF l_pji_facts.itd_ar_invoice_amount <> 0 THEN
5587             l_itd_value(i):=(Pji_Rep_Util.MEASURES_TOTAL(l_pji_facts.itd_ar_amount_due,l_pji_facts.itd_ar_amount_overdue) / l_pji_facts.itd_ar_invoice_amount) * xDaysSinceITD;
5588         ELSE
5589             l_itd_value(i):= NULL;
5590         END IF;
5591 /*
5592         IF l_pji_facts.ac_ar_invoice_amount <> 0 THEN
5593             l_num := (l_pji_facts.ac_ar_cash_applied_amount / l_pji_facts.ac_ar_invoice_amount) * xDaysInPeriod;
5594             l_ac_value(i):=l_num;
5595         ELSE
5596             l_ac_value(i):= NULL;
5597         END IF;
5598 
5599         IF l_pji_facts.prp_ar_invoice_amount <> 0 THEN
5600             l_num := (l_pji_facts.prp_ar_cash_applied_amount / l_pji_facts.prp_ar_invoice_amount) * xDaysInPeriod;
5601             l_prp_value(i):=l_num;
5602         ELSE
5603             l_prp_value(i):= NULL;
5604         END IF;
5605 */
5606       ELSIF  p_measure_set_code(i) = 'PPF_MSR_ELM' AND bitand(l_check_plan_versions, g_Actual_is_Present) = g_Actual_is_Present THEN
5607         --
5608         -- Effective labor multiplier =
5609         --      Actual revenue / actual labor burdened cost
5610         --
5611         x_measure_type(i) := g_IndexType;
5612       --Bug fix 7226979
5613         IF l_overview_type(l_actual_index).ptd_labor_burdened_cost <> 0 THEN
5614             l_ptd_value(i):=(l_overview_type(l_actual_index).ptd_revenue /
5615                                            l_overview_type(l_actual_index).ptd_labor_burdened_cost);
5616         ELSE
5617             l_ptd_value(i):=NULL;
5618         END IF;
5619 
5620         IF l_overview_type(l_actual_index).qtd_labor_burdened_cost <> 0 THEN
5621             l_qtd_value(i):=(l_overview_type(l_actual_index).qtd_revenue /
5622                                            l_overview_type(l_actual_index).qtd_labor_burdened_cost);
5623         ELSE
5624             l_qtd_value(i):=NULL;
5625         END IF;
5626 
5627         IF l_overview_type(l_actual_index).ytd_labor_burdened_cost <> 0 THEN
5628             l_ytd_value(i):=(l_overview_type(l_actual_index).ytd_revenue /
5629                                            l_overview_type(l_actual_index).ytd_labor_burdened_cost);
5630         ELSE
5631             l_ytd_value(i):=NULL;
5632         END IF;
5633 
5634         IF l_overview_type(l_actual_index).itd_labor_burdened_cost <> 0 THEN
5635             l_itd_value(i):=(l_overview_type(l_actual_index).itd_revenue /
5636                                            l_overview_type(l_actual_index).itd_labor_burdened_cost);
5637         ELSE
5638             l_itd_value(i):=NULL;
5639         END IF;
5640 
5641         IF l_overview_type(l_actual_index).ac_labor_burdened_cost <> 0 THEN
5642             l_ac_value(i):=(l_overview_type(l_actual_index).ac_revenue /
5643                                            l_overview_type(l_actual_index).ac_labor_burdened_cost);
5644         ELSE
5645             l_ac_value(i):=NULL;
5646         END IF;
5647 
5648         IF l_overview_type(l_actual_index).prp_labor_burdened_cost <> 0 THEN
5649             l_prp_value(i):=(l_overview_type(l_actual_index).prp_revenue /
5650                                            l_overview_type(l_actual_index).prp_labor_burdened_cost);
5651         ELSE
5652             l_prp_value(i):=NULL;
5653         END IF;
5654       --Bug fix 7226979
5655 
5656       ELSIF p_measure_set_code(i) = 'PPF_MSR_ETC' AND bitand(l_check_plan_versions, g_Actual_CstFcst) = g_Actual_CstFcst THEN
5657         --
5658         -- E.T.C. =
5659         --      forecast brdn cost - actual burdened cost
5660         --
5661         x_measure_type(i) := g_CurrencyType;
5662 /*
5663         l_ptd_value(i):=(l_overview_type(l_cost_forecast_index).ptd_burdened_cost - NVL(l_overview_type(l_actual_index).ptd_burdened_cost,0)) / l_factor_by;
5664 
5665         l_qtd_value(i):=(l_overview_type(l_cost_forecast_index).qtd_burdened_cost - NVL(l_overview_type(l_actual_index).qtd_burdened_cost,0)) / l_factor_by;
5666 
5667         l_ytd_value(i):=(l_overview_type(l_cost_forecast_index).ytd_burdened_cost - NVL(l_overview_type(l_actual_index).ytd_burdened_cost,0)) / l_factor_by;
5668 */
5669         l_itd_value(i):=(l_overview_type(l_cost_forecast_index).ac_burdened_cost - NVL(l_overview_type(l_actual_index).itd_burdened_cost,0)) / l_factor_by;
5670 
5671 		IF l_itd_value(i) < 0 THEN
5672 		   l_itd_value(i) := 0;
5673 		END IF;
5674 /*
5675         l_ac_value(i):=(l_overview_type(l_cost_forecast_index).ac_burdened_cost - NVL(l_overview_type(l_actual_index).ac_burdened_cost,0)) / l_factor_by;
5676 
5677         l_prp_value(i):=(l_overview_type(l_cost_forecast_index).prp_burdened_cost - NVL(l_overview_type(l_actual_index).prp_burdened_cost,0)) / l_factor_by;
5678 */
5679 
5680       ELSIF p_measure_set_code(i) = 'PPF_MSR_ETCEH' AND bitand(l_check_plan_versions, g_Actual_CstFcst) = g_Actual_CstFcst THEN
5681         -- ETC equipment hours
5682         x_measure_type(i) := g_HoursType;
5683 /*
5684         l_ptd_value(i):=(l_overview_type(l_cost_forecast_index).ptd_equipment_hrs - NVL(l_overview_type(l_actual_index).ptd_equipment_hrs,0)) / l_effort_UOM;
5685 
5686         l_qtd_value(i):=(l_overview_type(l_cost_forecast_index).qtd_equipment_hrs - NVL(l_overview_type(l_actual_index).qtd_equipment_hrs,0)) / l_effort_UOM;
5687 
5688         l_ytd_value(i):=(l_overview_type(l_cost_forecast_index).ytd_equipment_hrs - NVL(l_overview_type(l_actual_index).ytd_equipment_hrs,0)) / l_effort_UOM;
5689 */
5690         l_itd_value(i):=(l_overview_type(l_cost_forecast_index).ac_equipment_hrs - NVL(l_overview_type(l_actual_index).itd_equipment_hrs,0)) / l_effort_UOM;
5691 
5692 		IF l_itd_value(i) < 0 THEN
5693 		   l_itd_value(i) := 0;
5694 		END IF;
5695 
5696 /*
5697         l_ac_value(i):=(l_overview_type(l_cost_forecast_index).ac_equipment_hrs - NVL(l_overview_type(l_actual_index).ac_equipment_hrs,0)) / l_effort_UOM;
5698 
5699         l_prp_value(i):=(l_overview_type(l_cost_forecast_index).prp_equipment_hrs - NVL(l_overview_type(l_actual_index).prp_equipment_hrs,0)) / l_effort_UOM;
5700 */
5701       ELSIF p_measure_set_code(i) = 'PPF_MSR_ETCLH' AND bitand(l_check_plan_versions, g_Actual_CstFcst) = g_Actual_CstFcst THEN
5702         -- ETC labor hours
5703         x_measure_type(i) := g_HoursType;
5704 
5705 /*        l_ptd_value(i):=(l_overview_type(l_cost_forecast_index).ptd_labor_hrs - NVL(l_overview_type(l_actual_index).ptd_labor_hrs,0)) / l_effort_UOM;
5706 
5707         l_qtd_value(i):=(l_overview_type(l_cost_forecast_index).qtd_labor_hrs - NVL(l_overview_type(l_actual_index).qtd_labor_hrs,0)) / l_effort_UOM;
5708 
5709         l_ytd_value(i):=(l_overview_type(l_cost_forecast_index).ytd_labor_hrs - NVL(l_overview_type(l_actual_index).ytd_labor_hrs,0)) / l_effort_UOM;
5710 */
5711         l_itd_value(i):=(l_overview_type(l_cost_forecast_index).ac_labor_hrs - NVL(l_overview_type(l_actual_index).itd_labor_hrs,0)) / l_effort_UOM;
5712 
5713 		IF l_itd_value(i) < 0 THEN
5714 		   l_itd_value(i) := 0;
5715 		END IF;
5716 
5717 /*
5718         l_ac_value(i):=(l_overview_type(l_cost_forecast_index).ac_labor_hrs - NVL(l_overview_type(l_actual_index).ac_labor_hrs,0)) / l_effort_UOM;
5719 
5720         l_prp_value(i):=(l_overview_type(l_cost_forecast_index).prp_labor_hrs - NVL(l_overview_type(l_actual_index).prp_labor_hrs,0)) / l_effort_UOM;
5721   */
5722       ELSIF p_measure_set_code(i) = 'PPF_MSR_EVCV' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
5723         --
5724         -- Earned Value Cost variance =
5725         --   Budget Burdened Cost * Completed Perc - Actual Burdened Cost
5726         --
5727         x_measure_type(i) := g_CurrencyType;
5728 
5729 /*        l_ptd_value(i):= (l_overview_type(l_cost_budget_index).ptd_burdened_cost * l_completed_percentage -
5730                          l_overview_type(l_actual_index).ptd_burdened_cost) / l_factor_by;
5731 
5732         l_qtd_value(i):= (l_overview_type(l_cost_budget_index).qtd_burdened_cost * l_completed_percentage -
5733                          l_overview_type(l_actual_index).qtd_burdened_cost) / l_factor_by;
5734 
5735         l_ytd_value(i):= (l_overview_type(l_cost_budget_index).ytd_burdened_cost * l_completed_percentage -
5736                          l_overview_type(l_actual_index).ytd_burdened_cost) / l_factor_by;
5737 */
5738         l_itd_value(i):= (l_overview_type(l_cost_budget_index).ac_burdened_cost * l_completed_percentage -
5739                          l_overview_type(l_actual_index).itd_burdened_cost) / l_factor_by;
5740 
5741         l_ac_value(i) := (l_overview_type(l_cost_budget_index).ac_burdened_cost  * l_completed_percentage -
5742                          l_overview_type(l_actual_index).ac_burdened_cost) / l_factor_by;
5743 
5744 /*        l_prp_value(i):= (l_overview_type(l_cost_budget_index).prp_burdened_cost * l_completed_percentage -
5745                          l_overview_type(l_actual_index).prp_burdened_cost) / l_factor_by;
5746   */
5747       ELSIF p_measure_set_code(i) = 'PPF_MSR_EVSV' AND bitand(l_check_plan_versions, g_CstBudget_is_present) = g_CstBudget_is_present THEN
5748         --
5749         -- Earned Value Schedule variance =
5750         --   Budget Burdened Cost * Completed Perc - Budget Burdened Cost
5751         --
5752         x_measure_type(i) := g_CurrencyType;
5753 /*
5754         l_ptd_value(i):= (l_overview_type(l_cost_budget_index).ptd_burdened_cost * l_completed_percentage -
5755                          l_overview_type(l_cost_budget_index).ptd_burdened_cost) / l_factor_by;
5756 
5757         l_qtd_value(i):= (l_overview_type(l_cost_budget_index).qtd_burdened_cost * l_completed_percentage -
5758                          l_overview_type(l_cost_budget_index).qtd_burdened_cost) / l_factor_by;
5759 
5760         l_ytd_value(i):= (l_overview_type(l_cost_budget_index).ytd_burdened_cost * l_completed_percentage -
5761                          l_overview_type(l_cost_budget_index).ytd_burdened_cost) / l_factor_by;
5762 */
5763         l_itd_value(i):= (l_overview_type(l_cost_budget_index).ac_burdened_cost * l_completed_percentage -
5764                          l_overview_type(l_cost_budget_index).itd_burdened_cost) / l_factor_by;
5765 
5766         l_ac_value(i) := (l_overview_type(l_cost_budget_index).ac_burdened_cost  * l_completed_percentage -
5767                          l_overview_type(l_cost_budget_index).ac_burdened_cost)  / l_factor_by;
5768 
5769 /*        l_prp_value(i):= (l_overview_type(l_cost_budget_index).prp_burdened_cost * l_completed_percentage -
5770                          l_overview_type(l_cost_budget_index).prp_burdened_cost) / l_factor_by;
5771   */
5772       ELSIF p_measure_set_code(i) = 'PPF_MSR_EXP' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
5773         -- expense cost =
5774         --      actual burd cost - actual capitalizable burd cost
5775         --
5776         x_measure_type(i) := g_CurrencyType;
5777 
5778         l_ptd_value(i):=(l_overview_type(l_actual_index).ptd_burdened_cost - l_overview_type(l_actual_index).ptd_capitalizable_brdn_cost) / l_factor_by;
5779 
5780         l_qtd_value(i):=(l_overview_type(l_actual_index).qtd_burdened_cost - l_overview_type(l_actual_index).qtd_capitalizable_brdn_cost) / l_factor_by;
5781 
5782         l_ytd_value(i):=(l_overview_type(l_actual_index).ytd_burdened_cost - l_overview_type(l_actual_index).ytd_capitalizable_brdn_cost) / l_factor_by;
5783 
5784         l_itd_value(i):=(l_overview_type(l_actual_index).itd_burdened_cost - l_overview_type(l_actual_index).itd_capitalizable_brdn_cost) / l_factor_by;
5785 
5786         l_ac_value(i):=(l_overview_type(l_actual_index).ac_burdened_cost - l_overview_type(l_actual_index).ac_capitalizable_brdn_cost) / l_factor_by;
5787 
5788         l_prp_value(i):=(l_overview_type(l_actual_index).prp_burdened_cost - l_overview_type(l_actual_index).prp_capitalizable_brdn_cost) / l_factor_by;
5789 
5790       ELSIF p_measure_set_code(i) = 'PPF_MSR_FA' THEN
5791         -- funding adjustments (from PJI_AC_PROJ_F)
5792         x_measure_type(i) := g_CurrencyType;
5793 
5794         l_ptd_value(i):=l_pji_facts.ptd_funding_adjustment_amount / l_factor_by;
5795 
5796         l_qtd_value(i):=l_pji_facts.qtd_funding_adjustment_amount / l_factor_by;
5797 
5798         l_ytd_value(i):=l_pji_facts.ytd_funding_adjustment_amount / l_factor_by;
5799 
5800         l_itd_value(i):=l_pji_facts.itd_funding_adjustment_amount / l_factor_by;
5801 
5802         l_ac_value(i):=l_pji_facts.ac_funding_adjustment_amount / l_factor_by;
5803 
5804         l_prp_value(i):=l_pji_facts.prp_funding_adjustment_amount / l_factor_by;
5805 
5806       ELSIF p_measure_set_code(i) = 'PPF_MSR_FC' AND bitand(l_check_plan_versions, g_CstFcst_is_present) = g_CstFcst_is_present THEN
5807         --
5808         -- forecast cost (at completion)
5809         --
5810         x_measure_type(i) := g_CurrencyType;
5811 
5812         l_ptd_value(i):=l_overview_type(l_cost_forecast_index).ptd_burdened_cost / l_factor_by;
5813 
5814         l_qtd_value(i):=l_overview_type(l_cost_forecast_index).qtd_burdened_cost / l_factor_by;
5815 
5816         l_ytd_value(i):=l_overview_type(l_cost_forecast_index).ytd_burdened_cost / l_factor_by;
5817 
5818         l_itd_value(i):=l_overview_type(l_cost_forecast_index).itd_burdened_cost / l_factor_by;
5819 
5820         l_ac_value(i):=l_overview_type(l_cost_forecast_index).ac_burdened_cost / l_factor_by;
5821 
5822         l_prp_value(i):=l_overview_type(l_cost_forecast_index).prp_burdened_cost / l_factor_by;
5823 
5824       ELSIF p_measure_set_code(i) = 'PPF_MSR_FCV' AND bitand(l_check_plan_versions, g_CstBudget_CstFcst) = g_CstBudget_CstFcst THEN
5825         --
5826         -- forecast cost variance =
5827         --      (Forecast Burdened Cost - Budget Burdened cost)
5828         --
5829         x_measure_type(i) := g_CurrencyType;
5830 
5831         l_ptd_value(i):=(l_overview_type(l_cost_forecast_index).ptd_burdened_cost -
5832                                        l_overview_type(l_cost_budget_index).ptd_burdened_cost) / l_factor_by;
5833 
5834         l_qtd_value(i):=(l_overview_type(l_cost_forecast_index).qtd_burdened_cost -
5835                                        l_overview_type(l_cost_budget_index).qtd_burdened_cost) / l_factor_by;
5836 
5837         l_ytd_value(i):=(l_overview_type(l_cost_forecast_index).ytd_burdened_cost -
5838                                        l_overview_type(l_cost_budget_index).ytd_burdened_cost) / l_factor_by;
5839 
5840         l_itd_value(i):=(l_overview_type(l_cost_forecast_index).itd_burdened_cost -
5841                                        l_overview_type(l_cost_budget_index).itd_burdened_cost) / l_factor_by;
5842 
5843         l_ac_value(i) :=(l_overview_type(l_cost_forecast_index).ac_burdened_cost -
5844                                        l_overview_type(l_cost_budget_index).ac_burdened_cost) / l_factor_by;
5845 
5846         l_prp_value(i):=(l_overview_type(l_cost_forecast_index).prp_burdened_cost -
5847                                        l_overview_type(l_cost_budget_index).prp_burdened_cost) / l_factor_by;
5848 
5849       ELSIF p_measure_set_code(i) = 'PPF_MSR_FCVP' AND
5850             bitand(l_check_plan_versions, g_CstBudget_CstFcst) = g_CstBudget_CstFcst THEN
5851         --
5852         -- forecast cost variance % =
5853         --      (Forecast burdened Cost - Current Cost Budget) / Current Cost Budget * 100
5854         --
5855         x_measure_type(i) := g_PercentType;
5856 
5857         IF l_overview_type(l_cost_budget_index).ptd_burdened_cost <> 0 THEN
5858             l_ptd_value(i):=100 * (l_overview_type(l_cost_forecast_index).ptd_burdened_cost -
5859                             l_overview_type(l_cost_budget_index).ptd_burdened_cost) /
5860                             l_overview_type(l_cost_budget_index).ptd_burdened_cost;
5861         ELSE
5862             l_ptd_value(i):=NULL;
5863         END IF;
5864 
5865         IF l_overview_type(l_cost_budget_index).qtd_burdened_cost <> 0 THEN
5866             l_qtd_value(i):=100 * (l_overview_type(l_cost_forecast_index).qtd_burdened_cost -
5867                             l_overview_type(l_cost_budget_index).qtd_burdened_cost) /
5868                             l_overview_type(l_cost_budget_index).qtd_burdened_cost;
5869         ELSE
5870             l_qtd_value(i):=NULL;
5871         END IF;
5872 
5873         IF l_overview_type(l_cost_budget_index).ytd_burdened_cost <> 0 THEN
5874             l_ytd_value(i):=100 * (l_overview_type(l_cost_forecast_index).ytd_burdened_cost -
5875                             l_overview_type(l_cost_budget_index).ytd_burdened_cost) /
5876                             l_overview_type(l_cost_budget_index).ytd_burdened_cost;
5877         ELSE
5878             l_ytd_value(i):=NULL;
5879         END IF;
5880 
5881         IF l_overview_type(l_cost_budget_index).itd_burdened_cost <> 0 THEN
5882             l_itd_value(i):=100 * (l_overview_type(l_cost_forecast_index).itd_burdened_cost -
5883                             l_overview_type(l_cost_budget_index).itd_burdened_cost) /
5884                             l_overview_type(l_cost_budget_index).itd_burdened_cost;
5885         ELSE
5886             l_itd_value(i):=NULL;
5887         END IF;
5888 
5889         IF l_overview_type(l_cost_budget_index).ac_burdened_cost <> 0 THEN
5890             l_ac_value(i):=100 * (l_overview_type(l_cost_forecast_index).ac_burdened_cost -
5891                            l_overview_type(l_cost_budget_index).ac_burdened_cost) /
5892                            l_overview_type(l_cost_budget_index).ac_burdened_cost;
5893         ELSE
5894             l_ac_value(i):=NULL;
5895         END IF;
5896 
5897         IF l_overview_type(l_cost_budget_index).prp_burdened_cost <> 0 THEN
5898             l_prp_value(i):=100 * (l_overview_type(l_cost_forecast_index).prp_burdened_cost -
5899                             l_overview_type(l_cost_budget_index).prp_burdened_cost) /
5900                             l_overview_type(l_cost_budget_index).prp_burdened_cost;
5901         ELSE
5902             l_prp_value(i):=NULL;
5903         END IF;
5904 
5905       ELSIF p_measure_set_code(i) = 'PPF_MSR_FCVOB' AND bitand(l_check_plan_versions, g_CstFcst_OrigCstBudget) = g_CstFcst_OrigCstBudget  THEN
5906         --
5907         -- forecast cost variance from original budget
5908         --   (forecast Cost - Original budget Cost)
5909         --
5910         x_measure_type(i) := g_CurrencyType;
5911 
5912         l_ptd_value(i):=
5913             (l_overview_type(l_cost_forecast_index).ptd_burdened_cost -
5914                    l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost) / l_factor_by;
5915 
5916         l_qtd_value(i):=
5917             (l_overview_type(l_cost_forecast_index).qtd_burdened_cost -
5918                    l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost) / l_factor_by;
5919 
5920         l_ytd_value(i):=
5921             (l_overview_type(l_cost_forecast_index).ytd_burdened_cost -
5922                    l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost) / l_factor_by;
5923 
5924         l_itd_value(i):=
5925             (l_overview_type(l_cost_forecast_index).itd_burdened_cost -
5926                    l_overview_type(l_orig_cost_budget_index).itd_burdened_cost) / l_factor_by;
5927 
5928         l_ac_value(i):=
5929             (l_overview_type(l_cost_forecast_index).ac_burdened_cost -
5930                    l_overview_type(l_orig_cost_budget_index).ac_burdened_cost)  / l_factor_by;
5931 
5932         l_prp_value(i):=
5933             (l_overview_type(l_cost_forecast_index).prp_burdened_cost -
5934                    l_overview_type(l_orig_cost_budget_index).prp_burdened_cost) / l_factor_by;
5935 
5936       ELSIF p_measure_set_code(i) = 'PPF_MSR_FEH' AND bitand(l_check_plan_versions, g_CstFcst_is_present) = g_CstFcst_is_present THEN
5937         -- forecast equipment hours
5938         x_measure_type(i) := g_HoursType;
5939 
5940         l_ptd_value(i):=l_overview_type(l_cost_forecast_index).ptd_equipment_hrs / l_effort_UOM;
5941 
5942         l_qtd_value(i):=l_overview_type(l_cost_forecast_index).qtd_equipment_hrs / l_effort_UOM;
5943 
5944         l_ytd_value(i):=l_overview_type(l_cost_forecast_index).ytd_equipment_hrs / l_effort_UOM;
5945 
5946 
5947         l_itd_value(i):=l_overview_type(l_cost_forecast_index).itd_equipment_hrs / l_effort_UOM;
5948 
5949         l_ac_value(i):=l_overview_type(l_cost_forecast_index).ac_equipment_hrs / l_effort_UOM;
5950 
5951         l_prp_value(i):=l_overview_type(l_cost_forecast_index).prp_equipment_hrs / l_effort_UOM;
5952 
5953       ELSIF p_measure_set_code(i) = 'PPF_MSR_FEHVP' AND bitand(l_check_plan_versions, g_CstBudget_CstFcst) = g_CstBudget_CstFcst THEN
5954         -- Changed from Actual to Budget for bug 3954485
5955         --
5956         -- forecast equip hours variance %
5957         --      (forecast equip Hours - budget equip Hours) / budget equip Hours * 100
5958         --
5959         x_measure_type(i) := g_PercentType;
5960 
5961         IF l_overview_type(l_cost_budget_index).ptd_equipment_hrs <> 0 THEN
5962             l_ptd_value(i):=100 * (l_overview_type(l_cost_forecast_index).ptd_equipment_hrs -
5963                                   l_overview_type(l_cost_budget_index).ptd_equipment_hrs) /
5964                                   l_overview_type(l_cost_budget_index).ptd_equipment_hrs;
5965         ELSE
5966             l_ptd_value(i):=NULL;
5967         END IF;
5968 
5969         IF l_overview_type(l_cost_budget_index).qtd_equipment_hrs <> 0 THEN
5970             l_qtd_value(i):=100 * (l_overview_type(l_cost_forecast_index).qtd_equipment_hrs -
5971                                   l_overview_type(l_cost_budget_index).qtd_equipment_hrs) /
5972                                   l_overview_type(l_cost_budget_index).qtd_equipment_hrs;
5973         ELSE
5974             l_qtd_value(i):=NULL;
5975         END IF;
5976 
5977         IF l_overview_type(l_cost_budget_index).ytd_equipment_hrs <> 0 THEN
5978             l_ytd_value(i):=100 * (l_overview_type(l_cost_forecast_index).ytd_equipment_hrs -
5979                                   l_overview_type(l_cost_budget_index).ytd_equipment_hrs) /
5980                                   l_overview_type(l_cost_budget_index).ytd_equipment_hrs;
5981         ELSE
5982             l_ytd_value(i):=NULL;
5983         END IF;
5984 
5985         IF l_overview_type(l_cost_budget_index).itd_equipment_hrs <> 0 THEN
5986             l_itd_value(i):=100 * (l_overview_type(l_cost_forecast_index).itd_equipment_hrs -
5987                                   l_overview_type(l_cost_budget_index).itd_equipment_hrs) /
5988                                   l_overview_type(l_cost_budget_index).itd_equipment_hrs;
5989         ELSE
5990             l_itd_value(i):=NULL;
5991         END IF;
5992 
5993         IF l_overview_type(l_cost_budget_index).ac_equipment_hrs <> 0 THEN
5994             l_ac_value(i):=100 * (l_overview_type(l_cost_forecast_index).ac_equipment_hrs -
5995                                   l_overview_type(l_cost_budget_index).ac_equipment_hrs) /
5996                                   l_overview_type(l_cost_budget_index).ac_equipment_hrs;
5997         ELSE
5998             l_ac_value(i):=NULL;
5999         END IF;
6000 
6001         IF l_overview_type(l_cost_budget_index).prp_equipment_hrs <> 0 THEN
6002             l_prp_value(i):=100 * (l_overview_type(l_cost_forecast_index).prp_equipment_hrs -
6003                                   l_overview_type(l_cost_budget_index).prp_equipment_hrs) /
6004                                   l_overview_type(l_cost_budget_index).prp_equipment_hrs;
6005         ELSE
6006             l_prp_value(i):=NULL;
6007         END IF;
6008 
6009       ELSIF (p_measure_set_code(i) = 'PPF_MSR_FPH') AND bitand(l_check_plan_versions, g_CstFcst_is_present) = g_CstFcst_is_present THEN
6010         -- forecast people hours
6011         x_measure_type(i) := g_HoursType;
6012 
6013         l_ptd_value(i):= l_overview_type(l_cost_forecast_index).ptd_labor_hrs / l_effort_UOM;
6014 
6015         l_qtd_value(i):= l_overview_type(l_cost_forecast_index).qtd_labor_hrs / l_effort_UOM;
6016 
6017         l_ytd_value(i):= l_overview_type(l_cost_forecast_index).ytd_labor_hrs / l_effort_UOM;
6018 
6019         l_itd_value(i):=l_overview_type(l_cost_forecast_index).itd_labor_hrs / l_effort_UOM;
6020 
6021         l_ac_value(i):=l_overview_type(l_cost_forecast_index).ac_labor_hrs / l_effort_UOM;
6022 
6023         l_prp_value(i):= l_overview_type(l_cost_forecast_index).prp_labor_hrs / l_effort_UOM;
6024 
6025       ELSIF (p_measure_set_code(i) = 'PPF_MSR_FPHVP') AND bitand(l_check_plan_versions, g_CstBudget_CstFcst) = g_CstBudget_CstFcst THEN
6026         -- Changed from Actual to Budget for bug 3954485
6027         --
6028         -- forecast labor hours variance %
6029         --      (forecast Labor Hours - budget Labor Hours) / budget Labor Hours * 100
6030         --
6031         x_measure_type(i) := g_PercentType;
6032 
6033         IF l_overview_type(l_cost_budget_index).ptd_labor_hrs <> 0 THEN
6034             l_ptd_value(i):=100 * (l_overview_type(l_cost_forecast_index).ptd_labor_hrs -
6035                                   l_overview_type(l_cost_budget_index).ptd_labor_hrs) /
6036                                   l_overview_type(l_cost_budget_index).ptd_labor_hrs;
6037         ELSE
6038             l_ptd_value(i):=NULL;
6039         END IF;
6040 
6041         IF l_overview_type(l_cost_budget_index).qtd_labor_hrs <> 0 THEN
6042             l_qtd_value(i):=100 * (l_overview_type(l_cost_forecast_index).qtd_labor_hrs -
6043                                   l_overview_type(l_cost_budget_index).qtd_labor_hrs) /
6044                                   l_overview_type(l_cost_budget_index).qtd_labor_hrs;
6045         ELSE
6046             l_qtd_value(i):=NULL;
6047         END IF;
6048 
6049         IF l_overview_type(l_cost_budget_index).ytd_labor_hrs <> 0 THEN
6050             l_ytd_value(i):=100 * (l_overview_type(l_cost_forecast_index).ytd_labor_hrs -
6051                                   l_overview_type(l_cost_budget_index).ytd_labor_hrs) /
6052                                   l_overview_type(l_cost_budget_index).ytd_labor_hrs;
6053         ELSE
6054             l_ytd_value(i):=NULL;
6055         END IF;
6056 
6057         IF l_overview_type(l_cost_budget_index).itd_labor_hrs <> 0 THEN
6058             l_itd_value(i):=100 * (l_overview_type(l_cost_forecast_index).itd_labor_hrs -
6059                                   l_overview_type(l_cost_budget_index).itd_labor_hrs) /
6060                                   l_overview_type(l_cost_budget_index).itd_labor_hrs;
6061         ELSE
6062             l_itd_value(i):=NULL;
6063         END IF;
6064 
6065         IF l_overview_type(l_cost_budget_index).ac_labor_hrs <> 0 THEN
6066             l_ac_value(i):=100 * (l_overview_type(l_cost_forecast_index).ac_labor_hrs -
6067                                   l_overview_type(l_cost_budget_index).ac_labor_hrs) /
6068                                   l_overview_type(l_cost_budget_index).ac_labor_hrs;
6069         ELSE
6070             l_ac_value(i):=NULL;
6071         END IF;
6072 
6073         IF l_overview_type(l_cost_budget_index).prp_labor_hrs <> 0 THEN
6074             l_prp_value(i):=100 * (l_overview_type(l_cost_forecast_index).prp_labor_hrs -
6075                                   l_overview_type(l_cost_budget_index).prp_labor_hrs) /
6076                                   l_overview_type(l_cost_budget_index).prp_labor_hrs;
6077         ELSE
6078             l_prp_value(i):=NULL;
6079         END IF;
6080 
6081       ELSIF p_measure_set_code(i) = 'PPF_MSR_FM' /*AND bitand(l_check_plan_versions, g_CstRevFcst) = g_CstRevFcst*/ THEN --commented for bug 6958448
6082         --
6083         -- forecast margin =
6084         --      Forecast Revenue - Forecast Burdened Cost
6085         --
6086         x_measure_type(i) := g_CurrencyType;
6087 
6088         l_ptd_value(i):=(nvl(l_overview_type(l_rev_forecast_index).ptd_revenue,0) - nvl(l_overview_type(l_cost_forecast_index).ptd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6089 
6090         l_qtd_value(i):=(nvl(l_overview_type(l_rev_forecast_index).qtd_revenue,0) - nvl(l_overview_type(l_cost_forecast_index).qtd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6091 
6092         l_ytd_value(i):=(nvl(l_overview_type(l_rev_forecast_index).ytd_revenue,0) - nvl(l_overview_type(l_cost_forecast_index).ytd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6093 
6094         l_itd_value(i):=(nvl(l_overview_type(l_rev_forecast_index).itd_revenue,0) - nvl(l_overview_type(l_cost_forecast_index).itd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6095 
6096         l_ac_value(i):=(nvl(l_overview_type(l_rev_forecast_index).ac_revenue,0) - nvl(l_overview_type(l_cost_forecast_index).ac_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6097 
6098         l_prp_value(i):=(nvl(l_overview_type(l_rev_forecast_index).prp_revenue,0) - nvl(l_overview_type(l_cost_forecast_index).prp_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6099 
6100       ELSIF p_measure_set_code(i) = 'PPF_MSR_FMP' /*AND bitand(l_check_plan_versions, g_CstRevFcst) = g_CstRevFcst */ THEN --commented for bug 6958448
6101         --
6102         -- forecast margin percent =
6103         --      (Forecast Revenue - Forecast Cost) / Forecast Revenue * 100
6104         --
6105         x_measure_type(i) := g_PercentType;
6106 
6107         IF l_overview_type(l_rev_forecast_index).ptd_revenue <> 0 THEN
6108             l_ptd_value(i):= 100*(nvl(l_overview_type(l_rev_forecast_index).ptd_revenue,0) -
6109                                     nvl(l_overview_type(l_cost_forecast_index).ptd_burdened_cost,0)) /
6110                                     l_overview_type(l_rev_forecast_index).ptd_revenue; -- NVL for Bug#6844202
6111         ELSE
6112             l_ptd_value(i):= NULL;
6113         END IF;
6114 
6115         IF l_overview_type(l_rev_forecast_index).qtd_revenue <> 0 THEN
6116             l_qtd_value(i):= 100*(nvl(l_overview_type(l_rev_forecast_index).qtd_revenue,0) -
6117                                   nvl(l_overview_type(l_cost_forecast_index).qtd_burdened_cost,0))/
6118                                   l_overview_type(l_rev_forecast_index).qtd_revenue; -- NVL for Bug#6844202
6119         ELSE
6120             l_qtd_value(i):= NULL;
6121         END IF;
6122 
6123         IF l_overview_type(l_rev_forecast_index).ytd_revenue <> 0 THEN
6124             l_ytd_value(i):= 100*(nvl(l_overview_type(l_rev_forecast_index).ytd_revenue,0) -
6125                                   nvl(l_overview_type(l_cost_forecast_index).ytd_burdened_cost,0))/
6126                                   l_overview_type(l_rev_forecast_index).ytd_revenue; -- NVL for Bug#6844202
6127         ELSE
6128             l_ytd_value(i):= NULL;
6129         END IF;
6130 
6131         IF l_overview_type(l_rev_forecast_index).itd_revenue <> 0 THEN
6132             l_itd_value(i):= 100*(nvl(l_overview_type(l_rev_forecast_index).itd_revenue,0) -
6133                                   nvl(l_overview_type(l_cost_forecast_index).itd_burdened_cost,0))/
6134                                   l_overview_type(l_rev_forecast_index).itd_revenue; -- NVL for Bug#6844202
6135         ELSE
6136             l_itd_value(i):= NULL;
6137         END IF;
6138 
6139         IF l_overview_type(l_rev_forecast_index).ac_revenue <> 0 THEN
6140             l_ac_value(i):= 100*(nvl(l_overview_type(l_rev_forecast_index).ac_revenue,0) -
6141                                   nvl(l_overview_type(l_cost_forecast_index).ac_burdened_cost,0))/
6142                                   l_overview_type(l_rev_forecast_index).ac_revenue; -- NVL for Bug#6844202
6143         ELSE
6144             l_ac_value(i):= NULL;
6145         END IF;
6146 
6147         IF l_overview_type(l_rev_forecast_index).prp_revenue <> 0 THEN
6148             l_prp_value(i):= 100*(nvl(l_overview_type(l_rev_forecast_index).prp_revenue,0) -
6149                                   nvl(l_overview_type(l_cost_forecast_index).prp_burdened_cost,0))/
6150                                   l_overview_type(l_rev_forecast_index).prp_revenue; -- NVL for Bug#6844202
6151         ELSE
6152             l_prp_value(i):= NULL;
6153         END IF;
6154 
6155       ELSIF p_measure_set_code(i) = 'PPF_MSR_FMPV' AND bitand(l_check_plan_versions, g_CstRevBudgetFcst) = g_CstRevBudgetFcst THEN
6156         --
6157         -- forecast margin percent variance =
6158         --      ((rev forecast * budget burden bost) - (rev budget * forecast burden cost)) / (rev forecast * rev budget)
6159         --
6160         x_measure_type(i) := g_IndexType;
6161 
6162         l_num := l_overview_type(l_rev_forecast_index).ptd_revenue * l_overview_type(l_rev_budget_index).ptd_revenue;
6163         IF l_num <> 0 THEN
6164             l_ptd_value(i):= (100*(
6165                              l_overview_type(l_rev_forecast_index).ptd_revenue * l_overview_type(l_cost_budget_index).ptd_burdened_cost -
6166                              l_overview_type(l_rev_budget_index).ptd_revenue * l_overview_type(l_cost_forecast_index).ptd_burdened_cost
6167                              )/l_num);
6168         ELSE
6169             l_ptd_value(i):= NULL;
6170         END IF;
6171 
6172         l_num := l_overview_type(l_rev_forecast_index).qtd_revenue * l_overview_type(l_rev_budget_index).qtd_revenue;
6173         IF l_num <> 0 THEN
6174             l_qtd_value(i):= (100*(
6175                              l_overview_type(l_rev_forecast_index).qtd_revenue * l_overview_type(l_cost_budget_index).qtd_burdened_cost -
6176                              l_overview_type(l_rev_budget_index).qtd_revenue * l_overview_type(l_cost_forecast_index).qtd_burdened_cost
6177                              )/l_num);
6178         ELSE
6179             l_qtd_value(i):= NULL;
6180         END IF;
6181 
6182         l_num := l_overview_type(l_rev_forecast_index).ytd_revenue * l_overview_type(l_rev_budget_index).ytd_revenue;
6183         IF l_num <> 0 THEN
6184             l_ytd_value(i):= (100*(
6185                              l_overview_type(l_rev_forecast_index).ytd_revenue * l_overview_type(l_cost_budget_index).ytd_burdened_cost -
6186                              l_overview_type(l_rev_budget_index).ytd_revenue * l_overview_type(l_cost_forecast_index).ytd_burdened_cost
6187                              )/l_num);
6188         ELSE
6189             l_ytd_value(i):= NULL;
6190         END IF;
6191 
6192         l_num := l_overview_type(l_rev_forecast_index).itd_revenue * l_overview_type(l_rev_budget_index).itd_revenue;
6193         IF l_num <> 0 THEN
6194             l_itd_value(i):= (100*(
6195                              l_overview_type(l_rev_forecast_index).itd_revenue * l_overview_type(l_cost_budget_index).itd_burdened_cost -
6196                              l_overview_type(l_rev_budget_index).itd_revenue * l_overview_type(l_cost_forecast_index).itd_burdened_cost
6197                              )/l_num);
6198         ELSE
6199             l_itd_value(i):= NULL;
6200         END IF;
6201 
6202         l_num := l_overview_type(l_rev_forecast_index).ac_revenue * l_overview_type(l_rev_budget_index).ac_revenue;
6203         IF l_num <> 0 THEN
6204             l_ac_value(i):=  (100*(l_overview_type(
6205                              l_rev_forecast_index).ac_revenue * l_overview_type(l_cost_budget_index).ac_burdened_cost -
6206                              l_overview_type(l_rev_budget_index).ac_revenue * l_overview_type(l_cost_forecast_index).ac_burdened_cost
6207                              )/l_num);
6208         ELSE
6209             l_ac_value(i):= NULL;
6210         END IF;
6211 
6212         l_num := l_overview_type(l_rev_forecast_index).prp_revenue * l_overview_type(l_rev_budget_index).prp_revenue;
6213         IF l_num <> 0 THEN
6214             l_prp_value(i):= (100*(
6215                              l_overview_type(l_rev_forecast_index).prp_revenue * l_overview_type(l_cost_budget_index).prp_burdened_cost -
6216                              l_overview_type(l_rev_budget_index).prp_revenue * l_overview_type(l_cost_forecast_index).prp_burdened_cost
6217                              )/l_num);
6218         ELSE
6219             l_prp_value(i):= NULL;
6220         END IF;
6221 
6222       ELSIF p_measure_set_code(i) = 'PPF_MSR_FMPVOB' AND bitand(l_check_plan_versions, g_CstRevOrigbudgetFcst) = g_CstRevOrigbudgetFcst THEN
6223         --
6224         -- forecast margin percent variance from orig. budget =
6225         --      ((rev forecast * orig budget burden cost) - (rev orig budget * forecast burden cost)) / (rev forecast * rev orig budget)
6226         --
6227         x_measure_type(i) := g_IndexType;
6228 
6229         l_num := l_overview_type(l_rev_forecast_index).ptd_revenue * l_overview_type(l_orig_rev_budget_index).ptd_revenue;
6230         IF l_num <> 0 THEN
6231             l_ptd_value(i):= 100*(l_overview_type(l_rev_forecast_index).ptd_revenue *
6232                              l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost -
6233                              l_overview_type(l_orig_rev_budget_index).ptd_revenue *
6234                              l_overview_type(l_cost_forecast_index).ptd_burdened_cost)/l_num;
6235         ELSE
6236             l_ptd_value(i):= NULL;
6237         END IF;
6238 
6239         l_num := l_overview_type(l_rev_forecast_index).qtd_revenue * l_overview_type(l_orig_rev_budget_index).qtd_revenue;
6240         IF l_num <> 0 THEN
6241             l_qtd_value(i):= 100*(l_overview_type(l_rev_forecast_index).qtd_revenue *
6242                              l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost -
6243                              l_overview_type(l_orig_rev_budget_index).qtd_revenue *
6244                              l_overview_type(l_cost_forecast_index).qtd_burdened_cost)/l_num;
6245         ELSE
6246             l_qtd_value(i):= NULL;
6247         END IF;
6248 
6249         l_num := l_overview_type(l_rev_forecast_index).ytd_revenue * l_overview_type(l_orig_rev_budget_index).ytd_revenue;
6250         IF l_num <> 0 THEN
6251             l_ytd_value(i):= 100*(l_overview_type(l_rev_forecast_index).ytd_revenue *
6252                              l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost -
6253                              l_overview_type(l_orig_rev_budget_index).ytd_revenue *
6254                              l_overview_type(l_cost_forecast_index).ytd_burdened_cost)/l_num;
6255         ELSE
6256             l_ytd_value(i):= NULL;
6257         END IF;
6258 
6259         l_num := l_overview_type(l_rev_forecast_index).itd_revenue * l_overview_type(l_orig_rev_budget_index).itd_revenue;
6260         IF l_num <> 0 THEN
6261             l_itd_value(i):= 100*(l_overview_type(l_rev_forecast_index).itd_revenue *
6262                              l_overview_type(l_orig_cost_budget_index).itd_burdened_cost -
6263                              l_overview_type(l_orig_rev_budget_index).itd_revenue *
6264                              l_overview_type(l_cost_forecast_index).itd_burdened_cost)/l_num;
6265         ELSE
6266             l_itd_value(i):= NULL;
6267         END IF;
6268 
6269         l_num := l_overview_type(l_rev_forecast_index).ac_revenue * l_overview_type(l_orig_rev_budget_index).ac_revenue;
6270         IF l_num <> 0 THEN
6271             l_ac_value(i) := 100*(l_overview_type(l_rev_forecast_index).ac_revenue *
6272                              l_overview_type(l_orig_cost_budget_index).ac_burdened_cost -
6273                              l_overview_type(l_orig_rev_budget_index).ac_revenue *
6274                              l_overview_type(l_cost_forecast_index).ac_burdened_cost)/l_num;
6275         ELSE
6276             l_ac_value(i):= NULL;
6277         END IF;
6278 
6279         l_num := l_overview_type(l_rev_forecast_index).prp_revenue * l_overview_type(l_orig_rev_budget_index).prp_revenue;
6280         IF l_num <> 0 THEN
6281             l_prp_value(i):= 100*(l_overview_type(l_rev_forecast_index).prp_revenue *
6282                              l_overview_type(l_orig_cost_budget_index).prp_burdened_cost -
6283                              l_overview_type(l_orig_rev_budget_index).prp_revenue *
6284                              l_overview_type(l_cost_forecast_index).prp_burdened_cost)/l_num;
6285         ELSE
6286             l_prp_value(i):= NULL;
6287         END IF;
6288 
6289       ELSIF p_measure_set_code(i) = 'PPF_MSR_FMPVPFC' AND bitand(l_check_plan_versions, g_CstRevFcstPriorfcst) = g_CstRevFcstPriorfcst THEN
6290         --
6291         -- forecast margin percent variance from prior forecast =
6292         -- 100*(rev prior forecast * (rev forecast - fcst burden cost) - rev forecast * (rev prior fcst - prior fcst burden cost)) / (rev forecast * rev prior fcst)
6293         -- Bug 5523168 : Corrected the formula to compute PPF_MSR_FMPVPFC
6294         --
6295         x_measure_type(i) := g_IndexType;
6296 
6297         l_num := l_overview_type(l_rev_forecast_index).ptd_revenue * l_overview_type(l_prior_rev_forecast_index).ptd_revenue;
6298         IF l_num <> 0 THEN
6299             l_ptd_value(i):= 100*(l_overview_type(l_prior_rev_forecast_index).ptd_revenue *
6300              (l_overview_type(l_rev_forecast_index).ptd_revenue - l_overview_type(l_cost_forecast_index).ptd_burdened_cost)
6301                              - l_overview_type(l_rev_forecast_index).ptd_revenue *
6302 	     (l_overview_type(l_prior_rev_forecast_index).ptd_revenue - l_overview_type(l_prior_cost_forecast_index).ptd_burdened_cost)
6303 			     )/l_num;
6304         ELSE
6305             l_ptd_value(i):= NULL;
6306         END IF;
6307 /* Un-Commented the code for Bug 7681638 i.e reverted fix of 6961599 */
6308      /* Commented for bug 6961599 as this measure shouldn't display values for QTD/YDT */
6309         l_num := l_overview_type(l_rev_forecast_index).qtd_revenue * l_overview_type(l_prior_rev_forecast_index).qtd_revenue;
6310         IF l_num <> 0 THEN
6311             l_qtd_value(i):= 100*(l_overview_type(l_prior_rev_forecast_index).qtd_revenue *
6312              (l_overview_type(l_rev_forecast_index).qtd_revenue - l_overview_type(l_cost_forecast_index).qtd_burdened_cost)
6313                              - l_overview_type(l_rev_forecast_index).qtd_revenue *
6314 	     (l_overview_type(l_prior_rev_forecast_index).qtd_revenue - l_overview_type(l_prior_cost_forecast_index).qtd_burdened_cost)
6315 			     )/l_num;
6316         ELSE
6317             l_qtd_value(i):= NULL;
6318         END IF;
6319 
6320         l_num := l_overview_type(l_rev_forecast_index).ytd_revenue * l_overview_type(l_prior_rev_forecast_index).ytd_revenue;
6321         IF l_num <> 0 THEN
6322             l_ytd_value(i):= 100*(l_overview_type(l_prior_rev_forecast_index).ytd_revenue *
6323              (l_overview_type(l_rev_forecast_index).ytd_revenue - l_overview_type(l_cost_forecast_index).ytd_burdened_cost)
6324                              - l_overview_type(l_rev_forecast_index).ytd_revenue *
6325 	     (l_overview_type(l_prior_rev_forecast_index).ytd_revenue - l_overview_type(l_prior_cost_forecast_index).ytd_burdened_cost)
6326 			     )/l_num;
6327         ELSE
6328             l_ytd_value(i):= NULL;
6329         END IF;
6330       /* Commented the code for Bug 7681638 Start
6331 	l_qtd_value(i):= NULL;
6332 	l_ytd_value(i):= NULL;
6333 	     Commented the code for Bug 7681638 End */
6334 
6335         l_num := l_overview_type(l_rev_forecast_index).itd_revenue * l_overview_type(l_prior_rev_forecast_index).itd_revenue;
6336         IF l_num <> 0 THEN
6337             l_itd_value(i):= 100*(l_overview_type(l_prior_rev_forecast_index).itd_revenue *
6338              (l_overview_type(l_rev_forecast_index).itd_revenue - l_overview_type(l_cost_forecast_index).itd_burdened_cost)
6339                              - l_overview_type(l_rev_forecast_index).itd_revenue *
6340 	     (l_overview_type(l_prior_rev_forecast_index).itd_revenue - l_overview_type(l_prior_cost_forecast_index).itd_burdened_cost)
6341 			     )/l_num;
6342         ELSE
6343             l_itd_value(i):= NULL;
6344         END IF;
6345 
6346         l_num := l_overview_type(l_rev_forecast_index).ac_revenue * l_overview_type(l_prior_rev_forecast_index).ac_revenue;
6347         IF l_num <> 0 THEN
6348             l_ac_value(i):= 100*(l_overview_type(l_prior_rev_forecast_index).ac_revenue *
6349              (l_overview_type(l_rev_forecast_index).ac_revenue - l_overview_type(l_cost_forecast_index).ac_burdened_cost)
6350                              - l_overview_type(l_rev_forecast_index).ac_revenue *
6351 	     (l_overview_type(l_prior_rev_forecast_index).ac_revenue - l_overview_type(l_prior_cost_forecast_index).ac_burdened_cost)
6352 			     )/l_num;
6353         ELSE
6354             l_ac_value(i):= NULL;
6355         END IF;
6356 
6357         l_num := l_overview_type(l_rev_forecast_index).prp_revenue * l_overview_type(l_prior_rev_forecast_index).prp_revenue;
6358         IF l_num <> 0 THEN
6359             l_prp_value(i):= 100*(l_overview_type(l_prior_rev_forecast_index).prp_revenue *
6360              (l_overview_type(l_rev_forecast_index).prp_revenue - l_overview_type(l_cost_forecast_index).prp_burdened_cost)
6361                              - l_overview_type(l_rev_forecast_index).prp_revenue *
6362 	     (l_overview_type(l_prior_rev_forecast_index).prp_revenue - l_overview_type(l_prior_cost_forecast_index).prp_burdened_cost)
6363 			     )/l_num;
6364         ELSE
6365             l_prp_value(i):= NULL;
6366         END IF;
6367 
6368       ELSIF p_measure_set_code(i) = 'PPF_MSR_FMV' AND bitand(l_check_plan_versions, g_CstRevBudgetFcst) = g_CstRevBudgetFcst THEN
6369         --
6370         -- forecast margin variance =
6371         --      (forecast rev - rev budget ) - (forecast burden cost - budget burden cost)
6372         --
6373         x_measure_type(i) := g_CurrencyType;
6374 
6375         l_ptd_value(i):= (l_overview_type(l_rev_forecast_index).ptd_revenue +
6376                          l_overview_type(l_cost_budget_index).ptd_burdened_cost -
6377                          l_overview_type(l_rev_budget_index).ptd_revenue -
6378                          l_overview_type(l_cost_forecast_index).ptd_burdened_cost) / l_factor_by;
6379 
6380         l_qtd_value(i):= (l_overview_type(l_rev_forecast_index).qtd_revenue +
6381                          l_overview_type(l_cost_budget_index).qtd_burdened_cost -
6382                          l_overview_type(l_rev_budget_index).qtd_revenue -
6383                          l_overview_type(l_cost_forecast_index).qtd_burdened_cost) / l_factor_by;
6384 
6385         l_ytd_value(i):= (l_overview_type(l_rev_forecast_index).ytd_revenue +
6386                          l_overview_type(l_cost_budget_index).ytd_burdened_cost -
6387                          l_overview_type(l_rev_budget_index).ytd_revenue -
6388                          l_overview_type(l_cost_forecast_index).ytd_burdened_cost) / l_factor_by;
6389 
6390         l_itd_value(i):= (l_overview_type(l_rev_forecast_index).itd_revenue +
6391                          l_overview_type(l_cost_budget_index).itd_burdened_cost -
6392                          l_overview_type(l_rev_budget_index).itd_revenue -
6393                          l_overview_type(l_cost_forecast_index).itd_burdened_cost) / l_factor_by;
6394 
6395         l_ac_value(i) := (l_overview_type(l_rev_forecast_index).ac_revenue +
6396                          l_overview_type(l_cost_budget_index).ac_burdened_cost -
6397                          l_overview_type(l_rev_budget_index).ac_revenue -
6398                          l_overview_type(l_cost_forecast_index).ac_burdened_cost)  / l_factor_by;
6399 
6400         l_prp_value(i):= (l_overview_type(l_rev_forecast_index).prp_revenue +
6401                          l_overview_type(l_cost_budget_index).prp_burdened_cost -
6402                          l_overview_type(l_rev_budget_index).prp_revenue -
6403                          l_overview_type(l_cost_forecast_index).prp_burdened_cost) / l_factor_by;
6404 
6405       ELSIF p_measure_set_code(i) = 'PPF_MSR_FMVOB' AND bitand(l_check_plan_versions, g_CstRevOrigbudgetFcst) = g_CstRevOrigbudgetFcst THEN
6406         --
6407         -- forecast margin variance from orig budget =
6408         --      (rev forecast + orig budget burden cost - rev orig budget - forecast burden cost)
6409         --
6410         x_measure_type(i) := g_CurrencyType;
6411 
6412         l_ptd_value(i):= (l_overview_type(l_rev_forecast_index).ptd_revenue +
6413                          l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost -
6414                          l_overview_type(l_orig_rev_budget_index).ptd_revenue -
6415                          l_overview_type(l_cost_forecast_index).ptd_burdened_cost) / l_factor_by;
6416 
6417         l_qtd_value(i):= (l_overview_type(l_rev_forecast_index).qtd_revenue +
6418                          l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost -
6419                          l_overview_type(l_orig_rev_budget_index).qtd_revenue -
6420                          l_overview_type(l_cost_forecast_index).qtd_burdened_cost) / l_factor_by;
6421 
6422         l_ytd_value(i):= (l_overview_type(l_rev_forecast_index).ytd_revenue +
6423                          l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost -
6424                          l_overview_type(l_orig_rev_budget_index).ytd_revenue -
6425                          l_overview_type(l_cost_forecast_index).ytd_burdened_cost) / l_factor_by;
6426 
6427         l_itd_value(i):= (l_overview_type(l_rev_forecast_index).itd_revenue +
6428                          l_overview_type(l_orig_cost_budget_index).itd_burdened_cost -
6429                          l_overview_type(l_orig_rev_budget_index).itd_revenue -
6430                          l_overview_type(l_cost_forecast_index).itd_burdened_cost) / l_factor_by;
6431 
6432         l_ac_value(i) := (l_overview_type(l_rev_forecast_index).ac_revenue +
6433                          l_overview_type(l_orig_cost_budget_index).ac_burdened_cost -
6434                          l_overview_type(l_orig_rev_budget_index).ac_revenue -
6435                          l_overview_type(l_cost_forecast_index).ac_burdened_cost) / l_factor_by;
6436 
6437         l_prp_value(i):= (l_overview_type(l_rev_forecast_index).prp_revenue +
6438                          l_overview_type(l_orig_cost_budget_index).prp_burdened_cost -
6439                          l_overview_type(l_orig_rev_budget_index).prp_revenue -
6440                          l_overview_type(l_cost_forecast_index).prp_burdened_cost) / l_factor_by;
6441 
6442       ELSIF p_measure_set_code(i) = 'PPF_MSR_CFMVPF' AND bitand(l_check_plan_versions, g_CstRevFcstPriorfcst) = g_CstRevFcstPriorfcst THEN
6443         --
6444         -- Current forecast margin variance from prior forecast =
6445         --      (forecast rev + prior forecast burdened cost - prior forecast rev - forecast burden cost)
6446         --
6447         x_measure_type(i) := g_CurrencyType;
6448 
6449         l_ptd_value(i):= (l_overview_type(l_rev_forecast_index).ptd_revenue +
6450                          l_overview_type(l_prior_cost_forecast_index).ptd_burdened_cost -
6451                          l_overview_type(l_prior_rev_forecast_index).ptd_revenue -
6452                          l_overview_type(l_cost_forecast_index).ptd_burdened_cost) / l_factor_by;
6453 
6454         l_qtd_value(i):= (l_overview_type(l_rev_forecast_index).qtd_revenue +
6455                          l_overview_type(l_prior_cost_forecast_index).qtd_burdened_cost -
6456                          l_overview_type(l_prior_rev_forecast_index).qtd_revenue -
6457                          l_overview_type(l_cost_forecast_index).qtd_burdened_cost) / l_factor_by;
6458 
6459         l_ytd_value(i):= (l_overview_type(l_rev_forecast_index).ytd_revenue +
6460                          l_overview_type(l_prior_cost_forecast_index).ytd_burdened_cost -
6461                          l_overview_type(l_prior_rev_forecast_index).ytd_revenue -
6462                          l_overview_type(l_cost_forecast_index).ytd_burdened_cost) / l_factor_by;
6463 
6464         l_itd_value(i):= (l_overview_type(l_rev_forecast_index).itd_revenue +
6465                          l_overview_type(l_prior_cost_forecast_index).itd_burdened_cost -
6466                          l_overview_type(l_prior_rev_forecast_index).itd_revenue -
6467                          l_overview_type(l_cost_forecast_index).itd_burdened_cost) / l_factor_by;
6468 
6469         l_ac_value(i) := (l_overview_type(l_rev_forecast_index).ac_revenue +
6470                          l_overview_type(l_prior_cost_forecast_index).ac_burdened_cost -
6471                          l_overview_type(l_prior_rev_forecast_index).ac_revenue -
6472                          l_overview_type(l_cost_forecast_index).ac_burdened_cost) / l_factor_by;
6473 
6474         l_prp_value(i):= (l_overview_type(l_rev_forecast_index).prp_revenue +
6475                          l_overview_type(l_prior_cost_forecast_index).prp_burdened_cost -
6476                          l_overview_type(l_prior_rev_forecast_index).prp_revenue -
6477                          l_overview_type(l_cost_forecast_index).prp_burdened_cost) / l_factor_by;
6478 
6479       ELSIF p_measure_set_code(i) = 'PPF_MSR_FR' AND bitand(l_check_plan_versions, g_RevFcst_is_present) = g_RevFcst_is_present  THEN
6480         --forecast revenue
6481         x_measure_type(i) := g_CurrencyType;
6482 
6483         l_ptd_value(i):=l_overview_type(l_rev_forecast_index).ptd_revenue / l_factor_by;
6484 
6485         l_qtd_value(i):=l_overview_type(l_rev_forecast_index).qtd_revenue / l_factor_by;
6486 
6487         l_ytd_value(i):=l_overview_type(l_rev_forecast_index).ytd_revenue / l_factor_by;
6488 
6489         l_itd_value(i):=l_overview_type(l_rev_forecast_index).itd_revenue / l_factor_by;
6490 
6491         l_ac_value(i):=l_overview_type(l_rev_forecast_index).ac_revenue / l_factor_by;
6492 
6493         l_prp_value(i):=l_overview_type(l_rev_forecast_index).prp_revenue / l_factor_by;
6494 
6495       ELSIF p_measure_set_code(i) = 'PPF_MSR_FRAR' AND bitand(l_check_plan_versions, g_RevFcst_is_present) = g_RevFcst_is_present  THEN
6496         --
6497         --forecast revenue at risk =
6498         --  forecast revenue - (initial_funding_amount + additional_funding_amount +
6499         --  funding_adjustment_amount + cancelled_funding_amount)
6500         --
6501         x_measure_type(i) := g_CurrencyType;
6502 
6503 /*        l_ptd_value(i):= (l_overview_type(l_rev_forecast_index).ptd_revenue -
6504                                   (l_pji_facts.ptd_initial_funding_amount +
6505                                    l_pji_facts.ptd_additional_funding_amount +
6506                                    l_pji_facts.ptd_funding_adjustment_amount +
6507                                    l_pji_facts.ptd_cancelled_funding_amount)) / l_factor_by;
6508 
6509         l_qtd_value(i):= (l_overview_type(l_rev_forecast_index).qtd_revenue -
6510                                   (l_pji_facts.qtd_initial_funding_amount +
6511                                    l_pji_facts.qtd_additional_funding_amount +
6512                                    l_pji_facts.qtd_funding_adjustment_amount +
6513                                    l_pji_facts.qtd_cancelled_funding_amount)) / l_factor_by;
6514 
6515         l_ytd_value(i):= (l_overview_type(l_rev_forecast_index).ytd_revenue -
6516                                   (l_pji_facts.ytd_initial_funding_amount +
6517                                    l_pji_facts.ytd_additional_funding_amount +
6518                                    l_pji_facts.ytd_funding_adjustment_amount +
6519                                    l_pji_facts.ytd_cancelled_funding_amount)) / l_factor_by;
6520 */
6521 
6522 /*  commented out for bug 4194804
6523         l_itd_value(i):= (l_overview_type(l_rev_forecast_index).itd_revenue -
6524                                   (l_pji_facts.itd_initial_funding_amount +
6525                                    l_pji_facts.itd_additional_funding_amount +
6526                                    l_pji_facts.itd_funding_adjustment_amount +
6527                                    l_pji_facts.itd_cancelled_funding_amount)) / l_factor_by;
6528 */
6529 
6530         -- Added for bug 4194804
6531         l_measure1       := l_pji_facts.itd_initial_funding_amount;
6532         l_measure2       := l_pji_facts.itd_additional_funding_amount;
6533         l_measure3       := l_pji_facts.itd_funding_adjustment_amount;
6534         l_measure4       := l_pji_facts.itd_cancelled_funding_amount;
6535         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
6536                                                            ,p_measure2 => l_measure2
6537                                                            ,p_measure3 => l_measure3
6538                                                            ,p_measure4 => l_measure4
6539                                                          );
6540 
6541         l_itd_value(i):= (l_overview_type(l_rev_forecast_index).itd_revenue - NVL(l_measures_total,0) )/l_factor_by;
6542 
6543 		IF l_itd_value(i) < 0  THEN
6544 		   l_itd_value(i) := 0;
6545 		END IF;
6546 
6547 		--bug 7150594 l_ac_value(i) := l_itd_value(i);
6548 
6549 	   l_measure1       := l_pji_facts.ac_additional_funding_amount;
6550        l_measure2       := l_pji_facts.ac_cancelled_funding_amount;
6551        l_measure3       := l_pji_facts.ac_funding_adjustment_amount;
6552        l_measure4       := l_pji_facts.ac_initial_funding_amount;
6553 
6554        l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
6555                                                           ,p_measure2 => l_measure2
6556                                                           ,p_measure3 => l_measure3
6557                                                           ,p_measure4 => l_measure4
6558                                                         );
6559 
6560 
6561        l_num  := l_overview_type(l_rev_forecast_index).ac_revenue - NVL(l_measures_total,0);
6562 
6563 
6564 		IF l_num < 0 THEN
6565 		   l_num := 0;
6566 		END IF;
6567 
6568         l_ac_value(i):=l_num / l_factor_by;
6569 
6570 -- bug 7150594 changes end
6571 
6572 
6573 /*
6574         l_ac_value(i) := (l_overview_type(l_rev_forecast_index).ac_revenue  -
6575                                   (l_pji_facts.ac_initial_funding_amount +
6576                                    l_pji_facts.ac_additional_funding_amount +
6577                                    l_pji_facts.ac_funding_adjustment_amount +
6578                                    l_pji_facts.ac_cancelled_funding_amount)) / l_factor_by;
6579 
6580         l_prp_value(i):= (l_overview_type(l_rev_forecast_index).prp_revenue -
6581                                   (l_pji_facts.prp_initial_funding_amount +
6582                                    l_pji_facts.prp_additional_funding_amount +
6583                                    l_pji_facts.prp_funding_adjustment_amount +
6584                                    l_pji_facts.prp_cancelled_funding_amount)) / l_factor_by;
6585 */
6586 
6587       ELSIF p_measure_set_code(i) = 'PPF_MSR_FRV' AND bitand(l_check_plan_versions, g_RevBudgetFcst) = g_RevBudgetFcst THEN
6588         --
6589         -- forecast revenue variance =
6590         -- (Forecast Revenue - Current Budget Revenue)
6591         --
6592         x_measure_type(i) := g_CurrencyType;
6593 
6594         l_ptd_value(i):= (l_overview_type(l_rev_forecast_index).ptd_revenue -
6595                          l_overview_type(l_rev_budget_index).ptd_revenue) / l_factor_by;
6596 
6597         l_qtd_value(i):= (l_overview_type(l_rev_forecast_index).qtd_revenue -
6598                          l_overview_type(l_rev_budget_index).qtd_revenue) / l_factor_by;
6599 
6600         l_ytd_value(i):= (l_overview_type(l_rev_forecast_index).ytd_revenue -
6601                          l_overview_type(l_rev_budget_index).ytd_revenue) / l_factor_by;
6602 
6603         l_itd_value(i):= (l_overview_type(l_rev_forecast_index).itd_revenue -
6604                          l_overview_type(l_rev_budget_index).itd_revenue) / l_factor_by;
6605 
6606         l_ac_value(i) := (l_overview_type(l_rev_forecast_index).ac_revenue -
6607                          l_overview_type(l_rev_budget_index).ac_revenue) / l_factor_by;
6608 
6609         l_prp_value(i):= (l_overview_type(l_rev_forecast_index).prp_revenue -
6610                          l_overview_type(l_rev_budget_index).prp_revenue) / l_factor_by;
6611 
6612       ELSIF p_measure_set_code(i) = 'PPF_MSR_FRVOB' AND bitand(l_check_plan_versions, g_RevOrigbudgetFcst) = g_RevOrigbudgetFcst THEN
6613         --
6614         -- forecast revenue variance from orig budget =
6615         --      (Forecast Revenue - Orig Budget Revenue)
6616         --
6617         x_measure_type(i) := g_CurrencyType;
6618 
6619         l_ptd_value(i):= (l_overview_type(l_rev_forecast_index).ptd_revenue -
6620                          l_overview_type(l_orig_rev_budget_index).ptd_revenue) / l_factor_by;
6621 
6622         l_qtd_value(i):= (l_overview_type(l_rev_forecast_index).qtd_revenue -
6623                          l_overview_type(l_orig_rev_budget_index).qtd_revenue) / l_factor_by;
6624 
6625         l_ytd_value(i):= (l_overview_type(l_rev_forecast_index).ytd_revenue -
6626                          l_overview_type(l_orig_rev_budget_index).ytd_revenue) / l_factor_by;
6627 
6628         l_itd_value(i):= (l_overview_type(l_rev_forecast_index).itd_revenue -
6629                          l_overview_type(l_orig_rev_budget_index).itd_revenue) / l_factor_by;
6630 
6631         l_ac_value(i) := (l_overview_type(l_rev_forecast_index).ac_revenue -
6632                          l_overview_type(l_orig_rev_budget_index).ac_revenue)  / l_factor_by;
6633 
6634         l_prp_value(i):= (l_overview_type(l_rev_forecast_index).prp_revenue -
6635                          l_overview_type(l_orig_rev_budget_index).prp_revenue) / l_factor_by;
6636 
6637       ELSIF p_measure_set_code(i) = 'PPF_MSR_FUC' THEN
6638         -- funding cancellations (from PJI_AC_PROJ_F)
6639         x_measure_type(i) := g_CurrencyType;
6640 
6641         l_ptd_value(i):=l_pji_facts.ptd_cancelled_funding_amount / l_factor_by;
6642 
6643         l_qtd_value(i):=l_pji_facts.qtd_cancelled_funding_amount / l_factor_by;
6644 
6645         l_ytd_value(i):=l_pji_facts.ytd_cancelled_funding_amount / l_factor_by;
6646 
6647         l_itd_value(i):=l_pji_facts.itd_cancelled_funding_amount / l_factor_by;
6648 
6649         l_ac_value(i):=l_pji_facts.ac_cancelled_funding_amount / l_factor_by;
6650 
6651         l_prp_value(i):=l_pji_facts.prp_cancelled_funding_amount / l_factor_by;
6652 
6653       ELSIF p_measure_set_code(i) = 'PPF_MSR_IW' THEN
6654         -- invoice writeoffs (from PJI_AC_PROJ_F)
6655         x_measure_type(i) := g_CurrencyType;
6656 
6657         l_ptd_value(i):=l_pji_facts.ptd_ar_invoice_writeoff_amount / l_factor_by;
6658 
6659         l_qtd_value(i):=l_pji_facts.qtd_ar_invoice_writeoff_amount / l_factor_by;
6660 
6661         l_ytd_value(i):=l_pji_facts.ytd_ar_invoice_writeoff_amount / l_factor_by;
6662 
6663         l_itd_value(i):=l_pji_facts.itd_ar_invoice_writeoff_amount / l_factor_by;
6664 
6665         l_ac_value(i):=l_pji_facts.ac_ar_invoice_writeoff_amount / l_factor_by;
6666 
6667         l_prp_value(i):=l_pji_facts.prp_ar_invoice_writeoff_amount / l_factor_by;
6668 
6669       ELSIF p_measure_set_code(i) = 'PPF_MSR_LBC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
6670         -- labor burdened cost
6671         x_measure_type(i) := g_CurrencyType;
6672 
6673         l_ptd_value(i):=(l_overview_type(l_actual_index).ptd_labor_burdened_cost - l_overview_type(l_actual_index).ptd_labor_raw_cost) / l_factor_by;
6674 
6675         l_qtd_value(i):=(l_overview_type(l_actual_index).qtd_labor_burdened_cost - l_overview_type(l_actual_index).qtd_labor_raw_cost) / l_factor_by;
6676 
6677         l_ytd_value(i):=(l_overview_type(l_actual_index).ytd_labor_burdened_cost - l_overview_type(l_actual_index).ytd_labor_raw_cost) / l_factor_by;
6678 
6679         l_itd_value(i):=(l_overview_type(l_actual_index).itd_labor_burdened_cost - l_overview_type(l_actual_index).itd_labor_raw_cost) / l_factor_by;
6680 
6681         l_ac_value(i):=(l_overview_type(l_actual_index).ac_labor_burdened_cost - l_overview_type(l_actual_index).ac_labor_raw_cost) / l_factor_by;
6682 
6683         l_prp_value(i):=(l_overview_type(l_actual_index).prp_labor_burdened_cost - l_overview_type(l_actual_index).prp_labor_raw_cost) / l_factor_by;
6684 
6685       ELSIF p_measure_set_code(i) = 'PPF_MSR_LRC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
6686         -- labor raw cost
6687         x_measure_type(i) := g_CurrencyType;
6688 
6689         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_labor_raw_cost / l_factor_by;
6690 
6691         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_labor_raw_cost / l_factor_by;
6692 
6693         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_labor_raw_cost / l_factor_by;
6694 
6695         l_itd_value(i):=l_overview_type(l_actual_index).itd_labor_raw_cost / l_factor_by;
6696 
6697         l_ac_value(i):=l_overview_type(l_actual_index).ac_labor_raw_cost / l_factor_by;
6698 
6699         l_prp_value(i):=l_overview_type(l_actual_index).prp_labor_raw_cost / l_factor_by;
6700 
6701       ELSIF p_measure_set_code(i) = 'PPF_MSR_M' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
6702         --
6703         -- Margin =
6704         --      Revenue - Burdened Cost
6705         --
6706         x_measure_type(i) := g_CurrencyType;
6707 
6708         l_ptd_value(i):=(nvl(l_overview_type(l_actual_index).ptd_revenue,0) -
6709                                 nvl(l_overview_type(l_actual_index).ptd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6710 
6711         l_qtd_value(i):=(nvl(l_overview_type(l_actual_index).qtd_revenue,0) -
6712                                 nvl(l_overview_type(l_actual_index).qtd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6713 
6714         l_ytd_value(i):=(nvl(l_overview_type(l_actual_index).ytd_revenue,0) -
6715                                 nvl(l_overview_type(l_actual_index).ytd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6716 
6717         l_itd_value(i):=(nvl(l_overview_type(l_actual_index).itd_revenue,0) -
6718                                 nvl(l_overview_type(l_actual_index).itd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6719 
6720         l_ac_value(i) :=(nvl(l_overview_type(l_actual_index).ac_revenue,0) -
6721                                 nvl(l_overview_type(l_actual_index).ac_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6722 
6723         l_prp_value(i):=(nvl(l_overview_type(l_actual_index).prp_revenue,0) -
6724                                 nvl(l_overview_type(l_actual_index).prp_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
6725 
6726       ELSIF p_measure_set_code(i) = 'PPF_MSR_MP' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
6727         --
6728         -- Margin Percent =
6729         --      Margin / Revenue = (Revenue - Burdened Cost) / Revenue * 100
6730         --
6731         x_measure_type(i) := g_PercentType;
6732 
6733         IF l_overview_type(l_actual_index).ptd_revenue <> 0 THEN
6734             l_num := nvl(l_overview_type(l_actual_index).ptd_revenue,0) - nvl(l_overview_type(l_actual_index).ptd_burdened_cost,0); -- NVL for Bug#6844202
6735             IF l_num IS NOT NULL THEN
6736               l_ptd_value(i):=(l_num / l_overview_type(l_actual_index).ptd_revenue) * 100;
6737             ELSE
6738               l_ptd_value(i):= NULL;
6739             END IF;
6740         ELSE
6741             l_ptd_value(i):= NULL;
6742         END IF;
6743 
6744         IF l_overview_type(l_actual_index).qtd_revenue <> 0 THEN
6745             l_num := nvl(l_overview_type(l_actual_index).qtd_revenue,0) - nvl(l_overview_type(l_actual_index).qtd_burdened_cost,0); -- NVL for Bug#6844202
6746             IF l_num IS NOT NULL THEN
6747               l_qtd_value(i):=(l_num / l_overview_type(l_actual_index).qtd_revenue) * 100;
6748             ELSE
6749               l_qtd_value(i):= NULL;
6750             END IF;
6751         ELSE
6752             l_qtd_value(i):= NULL;
6753         END IF;
6754 
6755         IF l_overview_type(l_actual_index).ytd_revenue <> 0 THEN
6756             l_num := nvl(l_overview_type(l_actual_index).ytd_revenue,0) - nvl(l_overview_type(l_actual_index).ytd_burdened_cost,0); -- NVL for Bug#6844202
6757             IF l_num IS NOT NULL THEN
6758               l_ytd_value(i):=(l_num / l_overview_type(l_actual_index).ytd_revenue) *100;
6759             ELSE
6760               l_ytd_value(i):= NULL;
6761             END IF;
6762         ELSE
6763             l_ytd_value(i):= NULL;
6764         END IF;
6765 
6766         IF l_overview_type(l_actual_index).itd_revenue <> 0 THEN
6767             l_num := nvl(l_overview_type(l_actual_index).itd_revenue,0) - nvl(l_overview_type(l_actual_index).itd_burdened_cost,0); -- NVL for Bug#6844202
6768             IF l_num IS NOT NULL THEN
6769               l_itd_value(i):=(l_num / l_overview_type(l_actual_index).itd_revenue) *100;
6770             ELSE
6771               l_itd_value(i):= NULL;
6772             END IF;
6773         ELSE
6774             l_itd_value(i):= NULL;
6775         END IF;
6776 
6777         IF l_overview_type(l_actual_index).ac_revenue <> 0 THEN
6778             l_num := nvl(l_overview_type(l_actual_index).ac_revenue,0) - nvl(l_overview_type(l_actual_index).ac_burdened_cost,0); -- NVL for Bug#6844202
6779             IF l_num IS NOT NULL THEN
6780               l_ac_value(i):=(l_num / l_overview_type(l_actual_index).ac_revenue) *100;
6781             ELSE
6782               l_ac_value(i):= NULL;
6783             END IF;
6784         ELSE
6785             l_ac_value(i):= NULL;
6786         END IF;
6787 
6788         IF l_overview_type(l_actual_index).prp_revenue <> 0 THEN
6789             l_num := nvl(l_overview_type(l_actual_index).prp_revenue,0) - nvl(l_overview_type(l_actual_index).prp_burdened_cost,0); -- NVL for Bug#6844202
6790             IF l_num IS NOT NULL THEN
6791               l_prp_value(i):=(l_num / l_overview_type(l_actual_index).prp_revenue) *100;
6792             ELSE
6793               l_prp_value(i):= NULL;
6794             END IF;
6795         ELSE
6796             l_prp_value(i):= NULL;
6797         END IF;
6798 
6799       ELSIF p_measure_set_code(i) = 'PPF_MSR_MPV' AND bitand(l_check_plan_versions, g_Actual_CstRevBudget) = g_Actual_CstRevBudget THEN
6800         --
6801         -- margin percent variance =
6802         --      ((actual rev * budget burden bost) - (rev budget * actual burden cost)) / (actual rev * rev budget)
6803         --
6804         x_measure_type(i) := g_IndexType;
6805 
6806         l_num := l_overview_type(l_actual_index).ptd_revenue * l_overview_type(l_rev_budget_index).ptd_revenue;
6807         IF l_num <> 0 THEN
6808             l_ptd_value(i):= 100*(l_overview_type(l_actual_index).ptd_revenue * l_overview_type(l_cost_budget_index).ptd_burdened_cost -
6809                              l_overview_type(l_rev_budget_index).ptd_revenue * l_overview_type(l_actual_index).ptd_burdened_cost)/l_num;
6810         ELSE
6811             l_ptd_value(i):= NULL;
6812         END IF;
6813 
6814         l_num := l_overview_type(l_actual_index).qtd_revenue * l_overview_type(l_rev_budget_index).qtd_revenue;
6815         IF l_num <> 0 THEN
6816             l_qtd_value(i):= 100*(l_overview_type(l_actual_index).qtd_revenue * l_overview_type(l_cost_budget_index).qtd_burdened_cost -
6817                              l_overview_type(l_rev_budget_index).qtd_revenue * l_overview_type(l_actual_index).qtd_burdened_cost)/l_num;
6818         ELSE
6819             l_qtd_value(i):= NULL;
6820         END IF;
6821 
6822         l_num := l_overview_type(l_actual_index).ytd_revenue * l_overview_type(l_rev_budget_index).ytd_revenue;
6823         IF l_num <> 0 THEN
6824             l_ytd_value(i):= 100*(l_overview_type(l_actual_index).ytd_revenue * l_overview_type(l_cost_budget_index).ytd_burdened_cost -
6825                              l_overview_type(l_rev_budget_index).ytd_revenue * l_overview_type(l_actual_index).ytd_burdened_cost)/l_num;
6826         ELSE
6827             l_ytd_value(i):= NULL;
6828         END IF;
6829 
6830         l_num := l_overview_type(l_actual_index).itd_revenue * l_overview_type(l_rev_budget_index).itd_revenue;
6831         IF l_num <> 0 THEN
6832             l_itd_value(i):= 100*(l_overview_type(l_actual_index).itd_revenue * l_overview_type(l_cost_budget_index).itd_burdened_cost -
6833                              l_overview_type(l_rev_budget_index).itd_revenue * l_overview_type(l_actual_index).itd_burdened_cost)/l_num;
6834         ELSE
6835             l_itd_value(i):= NULL;
6836         END IF;
6837 
6838         l_num := l_overview_type(l_actual_index).ac_revenue * l_overview_type(l_rev_budget_index).ac_revenue;
6839         IF l_num <> 0 THEN
6840             l_ac_value(i):= 100*(l_overview_type(l_actual_index).ac_revenue * l_overview_type(l_cost_budget_index).ac_burdened_cost -
6841                              l_overview_type(l_rev_budget_index).ac_revenue * l_overview_type(l_actual_index).ac_burdened_cost)/l_num;
6842         ELSE
6843             l_ac_value(i):= NULL;
6844         END IF;
6845 
6846         l_num := l_overview_type(l_actual_index).prp_revenue * l_overview_type(l_rev_budget_index).prp_revenue;
6847         IF l_num <> 0 THEN
6848             l_prp_value(i):= 100*(l_overview_type(l_actual_index).prp_revenue * l_overview_type(l_cost_budget_index).prp_burdened_cost -
6849                              l_overview_type(l_rev_budget_index).prp_revenue * l_overview_type(l_actual_index).prp_burdened_cost)/l_num;
6850         ELSE
6851             l_prp_value(i):= NULL;
6852         END IF;
6853 
6854       ELSIF p_measure_set_code(i) = 'PPF_MSR_MV' AND bitand(l_check_plan_versions, g_Actual_CstRevBudget) = g_Actual_CstRevBudget THEN
6855         --
6856         -- margin variance =
6857         --      (actual rev + budget burden cost - rev budget - actual burden cost) / (rev budget - budget burden cost)
6858         --
6859         x_measure_type(i) := g_CurrencyType;
6860 
6861         l_ptd_value(i):= (l_overview_type(l_actual_index).ptd_revenue + l_overview_type(l_cost_budget_index).ptd_burdened_cost -
6862                          l_overview_type(l_rev_budget_index).ptd_revenue - l_overview_type(l_actual_index).ptd_burdened_cost) / l_factor_by;
6863 
6864         l_qtd_value(i):= (l_overview_type(l_actual_index).qtd_revenue + l_overview_type(l_cost_budget_index).qtd_burdened_cost -
6865                          l_overview_type(l_rev_budget_index).qtd_revenue - l_overview_type(l_actual_index).qtd_burdened_cost) / l_factor_by;
6866 
6867         l_ytd_value(i):= (l_overview_type(l_actual_index).ytd_revenue + l_overview_type(l_cost_budget_index).ytd_burdened_cost -
6868                          l_overview_type(l_rev_budget_index).ytd_revenue - l_overview_type(l_actual_index).ytd_burdened_cost) / l_factor_by;
6869 
6870         l_itd_value(i):= (l_overview_type(l_actual_index).itd_revenue + l_overview_type(l_cost_budget_index).itd_burdened_cost -
6871                          l_overview_type(l_rev_budget_index).itd_revenue - l_overview_type(l_actual_index).itd_burdened_cost) / l_factor_by;
6872 
6873         l_ac_value(i) := (l_overview_type(l_actual_index).ac_revenue + l_overview_type(l_cost_budget_index).ac_burdened_cost -
6874                          l_overview_type(l_rev_budget_index).ac_revenue - l_overview_type(l_actual_index).ac_burdened_cost) / l_factor_by;
6875 
6876         l_prp_value(i):= (l_overview_type(l_actual_index).prp_revenue + l_overview_type(l_cost_budget_index).prp_burdened_cost -
6877                          l_overview_type(l_rev_budget_index).prp_revenue - l_overview_type(l_actual_index).prp_burdened_cost) / l_factor_by;
6878 
6879       ELSIF p_measure_set_code(i) = 'PPF_MSR_NBC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
6880         --
6881         -- non billable cost =
6882         --      actual burd cost - actual billable burd cost - actual capitalizable burd cost
6883         --
6884         x_measure_type(i) := g_CurrencyType;
6885 
6886         -- Added Factor by for bug 4251793
6887         -- Added for bug  4194804
6888 
6889 	  	IF l_contract_proj_mask = 1 THEN
6890 	       l_measure1       := l_overview_type(l_actual_index).ptd_bill_burdened_cost;
6891 	       l_measure2       := NULL; --l_overview_type(l_actual_index).ptd_capitalizable_brdn_cost;
6892 	       l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
6893 	                                                          ,p_measure2 => l_measure2
6894 	                                                        );
6895 
6896 	        l_ptd_value(i):= (l_overview_type(l_actual_index).ptd_burdened_cost - NVL(l_measures_total,0)) / l_factor_by;
6897 
6898 	        -- Added for bug  4194804
6899 	       l_measure1       := l_overview_type(l_actual_index).qtd_bill_burdened_cost;
6900 	       l_measure2       := NULL; --l_overview_type(l_actual_index).qtd_capitalizable_brdn_cost;
6901 	       l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
6902 	                                                          ,p_measure2 => l_measure2
6903 	                                                        );
6904 
6905 	        l_qtd_value(i):= (l_overview_type(l_actual_index).qtd_burdened_cost - NVL(l_measures_total,0))/ l_factor_by;
6906 
6907 	        -- Added for bug  4194804
6908 	       l_measure1       := l_overview_type(l_actual_index).ytd_bill_burdened_cost;
6909 	       l_measure2       := NULL; --l_overview_type(l_actual_index).ytd_capitalizable_brdn_cost;
6910 	       l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
6911 	                                                          ,p_measure2 => l_measure2
6912 	                                                        );
6913 
6914 	        l_ytd_value(i):= (l_overview_type(l_actual_index).ytd_burdened_cost - NVL(l_measures_total,0)) / l_factor_by;
6915 
6916 	        -- Added for bug  4194804
6917 	       l_measure1       := l_overview_type(l_actual_index).itd_bill_burdened_cost;
6918 	       l_measure2       := NULL; --l_overview_type(l_actual_index).itd_capitalizable_brdn_cost;
6919 	       l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
6920 	                                                          ,p_measure2 => l_measure2
6921 	                                                        );
6922 
6923 	        l_itd_value(i):= (l_overview_type(l_actual_index).itd_burdened_cost - NVL(l_measures_total,0)) / l_factor_by;
6924 
6925 	        -- Added for bug  4194804
6926 	       l_measure1       := l_overview_type(l_actual_index).ac_bill_burdened_cost;
6927 	       l_measure2       := NULL; --l_overview_type(l_actual_index).ac_capitalizable_brdn_cost;
6928 	       l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
6929 	                                                          ,p_measure2 => l_measure2
6930 	                                                        );
6931 
6932 	        l_ac_value(i):= (l_overview_type(l_actual_index).ac_burdened_cost - NVL(l_measures_total,0)) / l_factor_by;
6933 
6934 	        -- Added for bug  4194804
6935 	       l_measure1       := l_overview_type(l_actual_index).prp_bill_burdened_cost;
6936 	       l_measure2       := NULL; --l_overview_type(l_actual_index).prp_capitalizable_brdn_cost;
6937 	       l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
6938 	                                                          ,p_measure2 => l_measure2
6939 	                                                        );
6940 
6941 	        l_prp_value(i):= (l_overview_type(l_actual_index).prp_burdened_cost - NVL(l_measures_total,0)) / l_factor_by;
6942 		END IF;
6943 
6944 
6945       ELSIF p_measure_set_code(i) = 'PPF_MSR_NBEH' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
6946         --
6947         --  non billable equipment hours =
6948         --      equipment hrs - billable equipment hrs
6949         --
6950         x_measure_type(i) := g_HoursType;
6951 
6952 		IF l_contract_proj_mask=1 THEN
6953 
6954 	        l_ptd_value(i):=(l_overview_type(l_actual_index).ptd_equipment_hrs - NVL(l_overview_type(l_actual_index).ptd_bill_equipment_hrs,0)) / l_effort_UOM;
6955 
6956 	        l_qtd_value(i):=(l_overview_type(l_actual_index).qtd_equipment_hrs - NVL(l_overview_type(l_actual_index).qtd_bill_equipment_hrs,0)) / l_effort_UOM;
6957 
6958 	        l_ytd_value(i):=(l_overview_type(l_actual_index).ytd_equipment_hrs - NVL(l_overview_type(l_actual_index).ytd_bill_equipment_hrs,0)) / l_effort_UOM;
6959 
6960 	        l_itd_value(i):=(l_overview_type(l_actual_index).itd_equipment_hrs - NVL(l_overview_type(l_actual_index).itd_bill_equipment_hrs,0)) / l_effort_UOM;
6961 
6962 	        l_ac_value(i):=(l_overview_type(l_actual_index).ac_equipment_hrs - NVL(l_overview_type(l_actual_index).ac_bill_equipment_hrs,0)) / l_effort_UOM;
6963 
6964 	        l_prp_value(i):=(l_overview_type(l_actual_index).prp_equipment_hrs - NVL(l_overview_type(l_actual_index).prp_bill_equipment_hrs,0)) / l_effort_UOM;
6965 		END IF;
6966 
6967       ELSIF p_measure_set_code(i) = 'PPF_MSR_NBLH' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
6968         --
6969         -- non billable labor hours =
6970         --      labor hrs - billable labor hrs
6971         --
6972         x_measure_type(i) := g_HoursType;
6973 
6974 	  	IF l_contract_proj_mask = 1 THEN
6975 	        l_ptd_value(i):=(l_overview_type(l_actual_index).ptd_labor_hrs - NVL(l_overview_type(l_actual_index).ptd_bill_labor_hrs,0)) / l_effort_UOM;
6976 
6977 	        l_qtd_value(i):=(l_overview_type(l_actual_index).qtd_labor_hrs - NVL(l_overview_type(l_actual_index).qtd_bill_labor_hrs,0)) / l_effort_UOM;
6978 
6979 		    l_ytd_value(i):=(l_overview_type(l_actual_index).ytd_labor_hrs - NVL(l_overview_type(l_actual_index).ytd_bill_labor_hrs,0)) / l_effort_UOM;
6980 
6981 	        l_itd_value(i):=(l_overview_type(l_actual_index).itd_labor_hrs - NVL(l_overview_type(l_actual_index).itd_bill_labor_hrs,0)) / l_effort_UOM;
6982 
6983 	        l_ac_value(i):=(l_overview_type(l_actual_index).ac_labor_hrs - NVL(l_overview_type(l_actual_index).ac_bill_labor_hrs,0)) / l_effort_UOM;
6984 
6985 	        l_prp_value(i):=(l_overview_type(l_actual_index).prp_labor_hrs - NVL(l_overview_type(l_actual_index).prp_bill_labor_hrs,0)) / l_effort_UOM;
6986 		END IF;
6987 
6988       ELSIF p_measure_set_code(i) = 'PPF_MSR_NCA' THEN
6989         -- number of cash applications (from PJI_AC_PROJ_F)  #### TO BE DONE ####
6990         x_measure_type(i) := g_OtherType;
6991 
6992         l_ptd_value(i):=NULL /*l_pji_facts.ptd_)*/;
6993 
6994         l_qtd_value(i):=NULL /*l_pji_facts.qtd_)*/;
6995 
6996         l_ytd_value(i):=NULL /*l_pji_facts.ytd_)*/;
6997 
6998         l_itd_value(i):=NULL /*l_pji_facts.itd_)*/;
6999 
7000         l_ac_value(i):=NULL /*l_pji_facts.ac_)*/;
7001 
7002         l_prp_value(i):=NULL /*l_pji_facts.prp_)*/;
7003 
7004       ELSIF p_measure_set_code(i) = 'PPF_MSR_NCO' THEN
7005         -- number of change orders (from PJI_AC_PROJ_F)  #### TO BE DONE ####
7006         x_measure_type(i) := g_OtherType;
7007 
7008         l_ptd_value(i):=NULL /*l_pji_facts.ptd_)*/;
7009 
7010         l_qtd_value(i):=NULL /*l_pji_facts.qtd_)*/;
7011 
7012         l_ytd_value(i):=NULL /*l_pji_facts.ytd_)*/;
7013 
7014         l_itd_value(i):=NULL /*l_pji_facts.itd_)*/;
7015 
7016         l_ac_value(i):=NULL /*l_pji_facts.ac_)*/;
7017 
7018         l_prp_value(i):=NULL /*l_pji_facts.prp_)*/;
7019 
7020       ELSIF p_measure_set_code(i) = 'PPF_MSR_NCZC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
7021         --
7022         -- non capitalizable cost =
7023         --      actual burd cost - actual billable burd cost - actual capitalizable burd cost
7024         --
7025         x_measure_type(i) := g_CurrencyType;
7026 
7027         IF l_capital_proj_mask = 1 THEN
7028 
7029 /* Commented out for bug  4194804
7030           l_ptd_value(i):= (l_overview_type(l_actual_index).ptd_burdened_cost - NVL(l_overview_type(l_actual_index).ptd_bill_burdened_cost,0) -
7031                              l_overview_type(l_actual_index).ptd_capitalizable_brdn_cost) / l_factor_by;
7032 
7033           l_qtd_value(i):= (l_overview_type(l_actual_index).qtd_burdened_cost - NVL(l_overview_type(l_actual_index).qtd_bill_burdened_cost,0) -
7034                              l_overview_type(l_actual_index).qtd_capitalizable_brdn_cost) / l_factor_by;
7035 
7036           l_ytd_value(i):= (l_overview_type(l_actual_index).ytd_burdened_cost - NVL(l_overview_type(l_actual_index).ytd_bill_burdened_cost,0) -
7037                              l_overview_type(l_actual_index).ytd_capitalizable_brdn_cost) / l_factor_by;
7038 
7039           l_itd_value(i):= (l_overview_type(l_actual_index).itd_burdened_cost - NVL(l_overview_type(l_actual_index).itd_bill_burdened_cost,0) -
7040                              l_overview_type(l_actual_index).itd_capitalizable_brdn_cost) / l_factor_by;
7041 
7042           l_ac_value(i):= (l_overview_type(l_actual_index).ac_burdened_cost - NVL(l_overview_type(l_actual_index).ac_bill_burdened_cost,0) -
7043                              l_overview_type(l_actual_index).ac_capitalizable_brdn_cost) / l_factor_by;
7044 
7045           l_prp_value(i):= (l_overview_type(l_actual_index).prp_burdened_cost - NVL(l_overview_type(l_actual_index).prp_bill_burdened_cost,0) -
7046                              l_overview_type(l_actual_index).prp_capitalizable_brdn_cost) / l_factor_by;
7047 
7048 */
7049 
7050         -- Added for bug  4194804
7051        l_measure1       := NULL; --l_overview_type(l_actual_index).ptd_bill_burdened_cost;
7052        l_measure2       := l_overview_type(l_actual_index).ptd_capitalizable_brdn_cost;
7053        l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
7054                                                           ,p_measure2 => l_measure2
7055                                                         );
7056 
7057        l_ptd_value(i):= (l_overview_type(l_actual_index).ptd_burdened_cost - NVL(l_measures_total,0)) / l_factor_by;
7058 
7059         -- Added for bug  4194804
7060        l_measure1       := NULL; --l_overview_type(l_actual_index).qtd_bill_burdened_cost;
7061        l_measure2       := l_overview_type(l_actual_index).qtd_capitalizable_brdn_cost;
7062        l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
7063                                                           ,p_measure2 => l_measure2
7064                                                         );
7065 
7066        l_qtd_value(i):= (l_overview_type(l_actual_index).qtd_burdened_cost - NVL(l_measures_total,0)) / l_factor_by;
7067 
7068         -- Added for bug  4194804
7069        l_measure1       := NULL; --l_overview_type(l_actual_index).ytd_bill_burdened_cost;
7070        l_measure2       := l_overview_type(l_actual_index).ytd_capitalizable_brdn_cost;
7071        l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
7072                                                           ,p_measure2 => l_measure2
7073                                                         );
7074 
7075        l_ytd_value(i):= (l_overview_type(l_actual_index).ytd_burdened_cost - NVL(l_measures_total,0)) / l_factor_by;
7076 
7077         -- Added for bug  4194804
7078        l_measure1       := NULL; --l_overview_type(l_actual_index).itd_bill_burdened_cost;
7079        l_measure2       := l_overview_type(l_actual_index).itd_capitalizable_brdn_cost;
7080        l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
7081                                                           ,p_measure2 => l_measure2
7082                                                         );
7083 
7084        l_itd_value(i):= (l_overview_type(l_actual_index).itd_burdened_cost - NVL(l_measures_total,0)) / l_factor_by;
7085 
7086         -- Added for bug  4194804
7087        l_measure1       := NULL; --l_overview_type(l_actual_index).ac_bill_burdened_cost;
7088        l_measure2       := l_overview_type(l_actual_index).ac_capitalizable_brdn_cost;
7089        l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
7090                                                           ,p_measure2 => l_measure2
7091                                                         );
7092 
7093        l_ac_value(i):= (l_overview_type(l_actual_index).ac_burdened_cost - NVL(l_measures_total,0)) / l_factor_by;
7094 
7095         -- Added for bug  4194804
7096        l_measure1       := NULL; --l_overview_type(l_actual_index).prp_bill_burdened_cost;
7097        l_measure2       := l_overview_type(l_actual_index).prp_capitalizable_brdn_cost;
7098        l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
7099                                                           ,p_measure2 => l_measure2
7100                                                         );
7101 
7102        l_prp_value(i):= (l_overview_type(l_actual_index).prp_burdened_cost - NVL(l_measures_total,0)) / l_factor_by;
7103 
7104 
7105 
7106        END IF;
7107 
7108       ELSIF p_measure_set_code(i) = 'PPF_MSR_NII' THEN
7109         -- number of invoice issued (from PJI_AC_PROJ_F)
7110         x_measure_type(i) := g_OtherType;
7111 
7112         l_ptd_value(i):=l_pji_facts.ptd_ar_invoice_count;
7113 
7114         l_qtd_value(i):=l_pji_facts.qtd_ar_invoice_count;
7115 
7116         l_ytd_value(i):=l_pji_facts.ytd_ar_invoice_count;
7117 
7118         l_itd_value(i):=l_pji_facts.itd_ar_invoice_count;
7119 
7120         l_ac_value(i):=l_pji_facts.ac_ar_invoice_count;
7121 
7122         l_prp_value(i):=l_pji_facts.prp_ar_invoice_count;
7123 
7124       ELSIF p_measure_set_code(i) = 'PPF_MSR_OB2C' AND bitand(l_check_plan_versions, g_OrigCstBudget2_is_present) = g_OrigCstBudget2_is_present  THEN
7125         -- Original Budget 2 Cost
7126         x_measure_type(i) := g_CurrencyType;
7127 
7128         l_ptd_value(i):=l_overview_type(l_orig_cost_budget2_index).ptd_burdened_cost / l_factor_by;
7129 
7130         l_qtd_value(i):=l_overview_type(l_orig_cost_budget2_index).qtd_burdened_cost / l_factor_by;
7131 
7132         l_ytd_value(i):=l_overview_type(l_orig_cost_budget2_index).ytd_burdened_cost / l_factor_by;
7133 
7134         l_itd_value(i):=l_overview_type(l_orig_cost_budget2_index).itd_burdened_cost / l_factor_by;
7135 
7136         l_ac_value(i):=l_overview_type(l_orig_cost_budget2_index).ac_burdened_cost / l_factor_by;
7137 
7138         l_prp_value(i):=l_overview_type(l_orig_cost_budget2_index).prp_burdened_cost / l_factor_by;
7139 
7140       ELSIF p_measure_set_code(i) = 'PPF_MSR_OB2EH' AND bitand(l_check_plan_versions, g_OrigCstBudget2_is_present) = g_OrigCstBudget2_is_present  THEN
7141         -- Original Budget 2 equipment Hours
7142         x_measure_type(i) := g_HoursType;
7143 
7144         l_ptd_value(i):=l_overview_type(l_orig_cost_budget2_index).ptd_equipment_hrs / l_effort_UOM;
7145 
7146         l_qtd_value(i):=l_overview_type(l_orig_cost_budget2_index).qtd_equipment_hrs / l_effort_UOM;
7147 
7148         l_ytd_value(i):=l_overview_type(l_orig_cost_budget2_index).ytd_equipment_hrs / l_effort_UOM;
7149 
7150         l_itd_value(i):=l_overview_type(l_orig_cost_budget2_index).itd_equipment_hrs / l_effort_UOM;
7151 
7152         l_ac_value(i):=l_overview_type(l_orig_cost_budget2_index).ac_equipment_hrs / l_effort_UOM;
7153 
7154         l_prp_value(i):=l_overview_type(l_orig_cost_budget2_index).prp_equipment_hrs / l_effort_UOM;
7155 
7156       ELSIF p_measure_set_code(i) = 'PPF_MSR_OB2LH' AND bitand(l_check_plan_versions, g_OrigCstBudget2_is_present) = g_OrigCstBudget2_is_present  THEN
7157         -- Original Budget People Hours
7158         x_measure_type(i) := g_HoursType;
7159 
7160         l_ptd_value(i):=l_overview_type(l_orig_cost_budget2_index).ptd_labor_hrs / l_effort_UOM;
7161 
7162         l_qtd_value(i):=l_overview_type(l_orig_cost_budget2_index).qtd_labor_hrs / l_effort_UOM;
7163 
7164         l_ytd_value(i):=l_overview_type(l_orig_cost_budget2_index).ytd_labor_hrs / l_effort_UOM;
7165 
7166         l_itd_value(i):=l_overview_type(l_orig_cost_budget2_index).itd_labor_hrs / l_effort_UOM;
7167 
7168         l_ac_value(i):=l_overview_type(l_orig_cost_budget2_index).ac_labor_hrs / l_effort_UOM;
7169 
7170         l_prp_value(i):=l_overview_type(l_orig_cost_budget2_index).prp_labor_hrs / l_effort_UOM;
7171 
7172       ELSIF p_measure_set_code(i) = 'PPF_MSR_OB2M' AND bitand(l_check_plan_versions, g_OrigCstBudget2_is_present) = g_OrigCstBudget2_is_present THEN
7173         --
7174         -- Original Budget 2 Margin =
7175         --      o.b.2 Revenue - o.b.2 Burdened Cost
7176         --
7177         x_measure_type(i) := g_CurrencyType;
7178 
7179         l_ptd_value(i):=(nvl(l_overview_type(l_orig_rev_budget2_index).ptd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).ptd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7180 
7181         l_qtd_value(i):=(nvl(l_overview_type(l_orig_rev_budget2_index).qtd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).qtd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7182 
7183         l_ytd_value(i):=(nvl(l_overview_type(l_orig_rev_budget2_index).ytd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).ytd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7184 
7185         l_itd_value(i):=(nvl(l_overview_type(l_orig_rev_budget2_index).itd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).itd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7186 
7187         l_ac_value(i):=(nvl(l_overview_type(l_orig_rev_budget2_index).ac_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).ac_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7188 
7189         l_prp_value(i):=(nvl(l_overview_type(l_orig_cost_budget2_index).prp_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).prp_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7190 
7191       ELSIF p_measure_set_code(i) = 'PPF_MSR_OB2MP' AND bitand(l_check_plan_versions, g_OrigCstBudget2_is_present) = g_OrigCstBudget2_is_present THEN
7192         --
7193         -- OB2 Margin Percent =
7194         --      OB2 Margin / OB2 Revenue = (OB2 Revenue - OB2 Burdened Cost) / OB2 Revenue * 100
7195         --
7196         x_measure_type(i) := g_PercentType;
7197 
7198         IF l_overview_type(l_orig_rev_budget2_index).ptd_revenue <> 0 THEN
7199             l_num := nvl(l_overview_type(l_orig_rev_budget2_index).ptd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).ptd_burdened_cost,0); -- NVL for Bug#6844202
7200             l_ptd_value(i):=(l_num / l_overview_type(l_orig_rev_budget2_index).ptd_revenue) * 100;
7201         ELSE
7202             l_ptd_value(i):= NULL;
7203         END IF;
7204 
7205         IF l_overview_type(l_orig_rev_budget2_index).qtd_revenue <> 0 THEN
7206             l_num := nvl(l_overview_type(l_orig_rev_budget2_index).qtd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).qtd_burdened_cost,0); -- NVL for Bug#6844202
7207             l_qtd_value(i):=(l_num / l_overview_type(l_orig_rev_budget2_index).qtd_revenue) * 100;
7208         ELSE
7209             l_qtd_value(i):= NULL;
7210         END IF;
7211 
7212         IF l_overview_type(l_orig_rev_budget2_index).ytd_revenue <> 0 THEN
7213             l_num := nvl(l_overview_type(l_orig_rev_budget2_index).ytd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).ytd_burdened_cost,0); -- NVL for Bug#6844202
7214             l_ytd_value(i):=(l_num / l_overview_type(l_orig_rev_budget2_index).ytd_revenue) *100;
7215         ELSE
7216             l_ytd_value(i):= NULL;
7217         END IF;
7218 
7219         IF l_overview_type(l_orig_rev_budget2_index).itd_revenue <> 0 THEN
7220             l_num := nvl(l_overview_type(l_orig_rev_budget2_index).itd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).itd_burdened_cost,0); -- NVL for Bug#6844202
7221             l_itd_value(i):=(l_num / l_overview_type(l_orig_rev_budget2_index).itd_revenue) *100;
7222         ELSE
7223             l_itd_value(i):= NULL;
7224         END IF;
7225 
7226         IF l_overview_type(l_orig_rev_budget2_index).ac_revenue <> 0 THEN
7227             l_num := nvl(l_overview_type(l_orig_rev_budget2_index).ac_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).ac_burdened_cost,0); -- NVL for Bug#6844202
7228             l_ac_value(i):=(l_num / l_overview_type(l_orig_rev_budget2_index).ac_revenue) *100;
7229         ELSE
7230             l_ac_value(i):= NULL;
7231         END IF;
7232 
7233         IF l_overview_type(l_orig_rev_budget2_index).prp_revenue <> 0 THEN
7234             l_num := nvl(l_overview_type(l_orig_rev_budget2_index).prp_revenue,0) - nvl(l_overview_type(l_orig_cost_budget2_index).prp_burdened_cost,0); -- NVL for Bug#6844202
7235             l_prp_value(i):=(l_num / l_overview_type(l_orig_rev_budget2_index).prp_revenue) *100;
7236         ELSE
7237             l_prp_value(i):= NULL;
7238         END IF;
7239 
7240       ELSIF p_measure_set_code(i) = 'PPF_MSR_OB2R' AND bitand(l_check_plan_versions, g_OrigCstBudget2_is_present) = g_OrigCstBudget2_is_present THEN
7241         -- Original Budget 2 Revenue
7242         x_measure_type(i) := g_CurrencyType;
7243 
7244         l_ptd_value(i):=l_overview_type(l_orig_rev_budget2_index).ptd_revenue / l_factor_by;
7245 
7246         l_qtd_value(i):=l_overview_type(l_orig_rev_budget2_index).qtd_revenue / l_factor_by;
7247 
7248         l_ytd_value(i):=l_overview_type(l_orig_rev_budget2_index).ytd_revenue / l_factor_by;
7249 
7250         l_itd_value(i):=l_overview_type(l_orig_rev_budget2_index).itd_revenue / l_factor_by;
7251 
7252         l_ac_value(i):=l_overview_type(l_orig_rev_budget2_index).ac_revenue / l_factor_by;
7253 
7254         l_prp_value(i):=l_overview_type(l_orig_rev_budget2_index).prp_revenue / l_factor_by;
7255 
7256       ELSIF p_measure_set_code(i) = 'PPF_MSR_OB2RC' AND bitand(l_check_plan_versions, g_OrigCstBudget2_is_present) = g_OrigCstBudget2_is_present THEN
7257         -- Original Budget 2 raw cost
7258         x_measure_type(i) := g_CurrencyType;
7259 
7260         l_ptd_value(i):=l_overview_type(l_orig_cost_budget2_index).ptd_raw_cost / l_factor_by;
7261 
7262         l_qtd_value(i):=l_overview_type(l_orig_cost_budget2_index).qtd_raw_cost / l_factor_by;
7263 
7264         l_ytd_value(i):=l_overview_type(l_orig_cost_budget2_index).ytd_raw_cost / l_factor_by;
7265 
7266         l_itd_value(i):=l_overview_type(l_orig_cost_budget2_index).itd_raw_cost / l_factor_by;
7267 
7268         l_ac_value(i):=l_overview_type(l_orig_cost_budget2_index).ac_raw_cost / l_factor_by;
7269 
7270         l_prp_value(i):=l_overview_type(l_orig_cost_budget2_index).prp_raw_cost / l_factor_by;
7271 
7272       ELSIF  p_measure_set_code(i) = 'PPF_MSR_OBBCV' AND bitand(l_check_plan_versions, g_OrigCstBudget_is_present) = g_OrigCstBudget_is_present AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
7273         --
7274         -- Cost variance from Original budget:
7275         --      Actual Cost - Original budget Cost
7276         --
7277         x_measure_type(i) := g_CurrencyType;
7278 
7279         l_ptd_value(i):=(l_overview_type(l_actual_index).ptd_burdened_cost -
7280                         l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost) / l_factor_by;
7281 
7282         l_qtd_value(i):=(l_overview_type(l_actual_index).qtd_burdened_cost -
7283                         l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost) / l_factor_by;
7284 
7285         l_ytd_value(i):=(l_overview_type(l_actual_index).ytd_burdened_cost -
7286                         l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost) / l_factor_by;
7287 
7288         l_itd_value(i):=(l_overview_type(l_actual_index).itd_burdened_cost -
7289                         l_overview_type(l_orig_cost_budget_index).itd_burdened_cost) / l_factor_by;
7290 
7291         l_ac_value(i):= (l_overview_type(l_actual_index).ac_burdened_cost -
7292                         l_overview_type(l_orig_cost_budget_index).ac_burdened_cost)  / l_factor_by;
7293 
7294         l_prp_value(i):=(l_overview_type(l_actual_index).prp_burdened_cost -
7295                         l_overview_type(l_orig_cost_budget_index).prp_burdened_cost) / l_factor_by;
7296 
7297       ELSIF p_measure_set_code(i) = 'PPF_MSR_OBC' AND bitand(l_check_plan_versions, g_OrigCstBudget_is_present) = g_OrigCstBudget_is_present  THEN
7298         -- Original Budget Cost
7299         x_measure_type(i) := g_CurrencyType;
7300 
7301         l_ptd_value(i):=l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost / l_factor_by;
7302 
7303         l_qtd_value(i):=l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost / l_factor_by;
7304 
7305         l_ytd_value(i):=l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost / l_factor_by;
7306 
7307         l_itd_value(i):=l_overview_type(l_orig_cost_budget_index).itd_burdened_cost / l_factor_by;
7308 
7309         l_ac_value(i):=l_overview_type(l_orig_cost_budget_index).ac_burdened_cost / l_factor_by;
7310 
7311         l_prp_value(i):=l_overview_type(l_orig_cost_budget_index).prp_burdened_cost / l_factor_by;
7312 
7313       ELSIF p_measure_set_code(i) = 'PPF_MSR_OBEH' AND bitand(l_check_plan_versions, g_OrigCstBudget_is_present) = g_OrigCstBudget_is_present  THEN
7314         -- Original Budget equipment Hours
7315         x_measure_type(i) := g_HoursType;
7316 
7317         l_ptd_value(i):=l_overview_type(l_orig_cost_budget_index).ptd_equipment_hrs / l_effort_UOM;
7318 
7319         l_qtd_value(i):=l_overview_type(l_orig_cost_budget_index).qtd_equipment_hrs / l_effort_UOM;
7320 
7321         l_ytd_value(i):=l_overview_type(l_orig_cost_budget_index).ytd_equipment_hrs / l_effort_UOM;
7322 
7323         l_itd_value(i):=l_overview_type(l_orig_cost_budget_index).itd_equipment_hrs / l_effort_UOM;
7324 
7325         l_ac_value(i):=l_overview_type(l_orig_cost_budget_index).ac_equipment_hrs / l_effort_UOM;
7326 
7327         l_prp_value(i):=l_overview_type(l_orig_cost_budget_index).prp_equipment_hrs / l_effort_UOM;
7328 
7329       ELSIF p_measure_set_code(i) = 'PPF_MSR_OBLH' AND bitand(l_check_plan_versions, g_OrigCstBudget_is_present) = g_OrigCstBudget_is_present  THEN
7330         -- Original Budget People Hours
7331         x_measure_type(i) := g_HoursType;
7332 
7333         l_ptd_value(i):=l_overview_type(l_orig_cost_budget_index).ptd_labor_hrs / l_effort_UOM;
7334 
7335         l_qtd_value(i):=l_overview_type(l_orig_cost_budget_index).qtd_labor_hrs / l_effort_UOM;
7336 
7337         l_ytd_value(i):=l_overview_type(l_orig_cost_budget_index).ytd_labor_hrs / l_effort_UOM;
7338 
7339         l_itd_value(i):=l_overview_type(l_orig_cost_budget_index).itd_labor_hrs / l_effort_UOM;
7340 
7341         l_ac_value(i):=l_overview_type(l_orig_cost_budget_index).ac_labor_hrs / l_effort_UOM;
7342 
7343         l_prp_value(i):=l_overview_type(l_orig_cost_budget_index).prp_labor_hrs / l_effort_UOM;
7344 
7345       ELSIF p_measure_set_code(i) = 'PPF_MSR_OBM' AND bitand(l_check_plan_versions, g_OrigCstBudget_is_present) = g_OrigCstBudget_is_present THEN
7346         --
7347         -- Original Budget Margin =
7348         --      o.b. Revenue - o.b. Burdened Cost
7349         --
7350         x_measure_type(i) := g_CurrencyType;
7351 
7352         l_ptd_value(i):=(nvl(l_overview_type(l_orig_rev_budget_index).ptd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7353 
7354         l_qtd_value(i):=(nvl(l_overview_type(l_orig_rev_budget_index).qtd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7355 
7356         l_ytd_value(i):=(nvl(l_overview_type(l_orig_rev_budget_index).ytd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7357 
7358         l_itd_value(i):=(nvl(l_overview_type(l_orig_rev_budget_index).itd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).itd_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7359 
7360         l_ac_value(i):=(nvl(l_overview_type(l_orig_rev_budget_index).ac_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).ac_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7361 
7362         l_prp_value(i):=(nvl(l_overview_type(l_orig_rev_budget_index).prp_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).prp_burdened_cost,0)) / l_factor_by; -- NVL for Bug#6844202
7363 
7364       ELSIF p_measure_set_code(i) = 'PPF_MSR_OBMP' AND bitand(l_check_plan_versions, g_OrigCstBudget_is_present) = g_OrigCstBudget_is_present THEN
7365         --
7366         -- OB Margin Percent =
7367         --      OB Margin / OB Revenue = (OB Revenue - OB Burdened Cost) / OB Revenue * 100
7368         --
7369         x_measure_type(i) := g_PercentType;
7370 
7371         IF l_overview_type(l_orig_rev_budget_index).ptd_revenue <> 0 THEN
7372             l_num := nvl(l_overview_type(l_orig_rev_budget_index).ptd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost,0); -- NVL for Bug#6844202
7373             l_ptd_value(i):=(l_num / l_overview_type(l_orig_rev_budget_index).ptd_revenue) * 100;
7374         ELSE
7375             l_ptd_value(i):= NULL;
7376         END IF;
7377 
7378         IF l_overview_type(l_orig_rev_budget_index).qtd_revenue <> 0 THEN
7379             l_num := nvl(l_overview_type(l_orig_rev_budget_index).qtd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost,0); -- NVL for Bug#6844202
7380             l_qtd_value(i):=(l_num / l_overview_type(l_orig_rev_budget_index).qtd_revenue) * 100;
7381         ELSE
7382             l_qtd_value(i):= NULL;
7383         END IF;
7384 
7385         IF l_overview_type(l_orig_rev_budget_index).ytd_revenue <> 0 THEN
7386             l_num := nvl(l_overview_type(l_orig_rev_budget_index).ytd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost,0); -- NVL for Bug#6844202
7387             l_ytd_value(i):=(l_num / l_overview_type(l_orig_rev_budget_index).ytd_revenue) *100;
7388         ELSE
7389             l_ytd_value(i):= NULL;
7390         END IF;
7391 
7392         IF l_overview_type(l_orig_rev_budget_index).itd_revenue <> 0 THEN
7393             l_num := nvl(l_overview_type(l_orig_rev_budget_index).itd_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).itd_burdened_cost,0); -- NVL for Bug#6844202
7394             l_itd_value(i):=(l_num / l_overview_type(l_orig_rev_budget_index).itd_revenue) *100;
7395         ELSE
7396             l_itd_value(i):= NULL;
7397         END IF;
7398 
7399         IF l_overview_type(l_orig_rev_budget_index).ac_revenue <> 0 THEN
7400             l_num := nvl(l_overview_type(l_orig_rev_budget_index).ac_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).ac_burdened_cost,0); -- NVL for Bug#6844202
7401             l_ac_value(i):=(l_num / l_overview_type(l_orig_rev_budget_index).ac_revenue) *100;
7402         ELSE
7403             l_ac_value(i):= NULL;
7404         END IF;
7405 
7406         IF l_overview_type(l_orig_rev_budget_index).prp_revenue <> 0 THEN
7407             l_num := nvl(l_overview_type(l_orig_rev_budget_index).prp_revenue,0) - nvl(l_overview_type(l_orig_cost_budget_index).prp_burdened_cost,0); -- NVL for Bug#6844202
7408             l_prp_value(i):=(l_num / l_overview_type(l_orig_rev_budget_index).prp_revenue) *100;
7409         ELSE
7410             l_prp_value(i):= NULL;
7411         END IF;
7412 
7413       ELSIF p_measure_set_code(i) = 'PPF_MSR_OBR' AND bitand(l_check_plan_versions, g_OrigCstBudget_is_present) = g_OrigCstBudget_is_present THEN
7414         -- Original Budget Revenue
7415         x_measure_type(i) := g_CurrencyType;
7416 
7417         l_ptd_value(i):=l_overview_type(l_orig_rev_budget_index).ptd_revenue / l_factor_by;
7418 
7419         l_qtd_value(i):=l_overview_type(l_orig_rev_budget_index).qtd_revenue / l_factor_by;
7420 
7421         l_ytd_value(i):=l_overview_type(l_orig_rev_budget_index).ytd_revenue / l_factor_by;
7422 
7423         l_itd_value(i):=l_overview_type(l_orig_rev_budget_index).itd_revenue / l_factor_by;
7424 
7425         l_ac_value(i):=l_overview_type(l_orig_rev_budget_index).ac_revenue / l_factor_by;
7426 
7427         l_prp_value(i):=l_overview_type(l_orig_rev_budget_index).prp_revenue / l_factor_by;
7428 
7429       ELSIF p_measure_set_code(i) = 'PPF_MSR_OCC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
7430         -- Other Committed Cost
7431         x_measure_type(i) := g_CurrencyType;
7432 
7433         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_oth_committed_cost / l_factor_by;
7434 
7435         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_oth_committed_cost / l_factor_by;
7436 
7437         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_oth_committed_cost / l_factor_by;
7438 
7439         l_itd_value(i):=l_overview_type(l_actual_index).itd_oth_committed_cost / l_factor_by;
7440 
7441         l_ac_value(i):=l_overview_type(l_actual_index).ac_oth_committed_cost / l_factor_by;
7442 
7443         l_prp_value(i):=l_overview_type(l_actual_index).prp_oth_committed_cost / l_factor_by;
7444 
7445       ELSIF p_measure_set_code(i) = 'PPF_MSR_OF' THEN
7446         -- original funding (from PJI_AC_PROJ_F)
7447         x_measure_type(i) := g_CurrencyType;
7448 
7449         l_ptd_value(i):=l_pji_facts.ptd_initial_funding_amount / l_factor_by;
7450 
7451         l_qtd_value(i):=l_pji_facts.qtd_initial_funding_amount / l_factor_by;
7452 
7453         l_ytd_value(i):=l_pji_facts.ytd_initial_funding_amount / l_factor_by;
7454 
7455         l_itd_value(i):=l_pji_facts.itd_initial_funding_amount / l_factor_by;
7456 
7457         l_ac_value(i):=l_pji_facts.ac_initial_funding_amount / l_factor_by;
7458 
7459         l_prp_value(i):=l_pji_facts.prp_initial_funding_amount / l_factor_by;
7460 
7461       ELSIF p_measure_set_code(i) = 'PPF_MSR_OR' THEN
7462         -- outstanding receivables (from PJI_AC_PROJ_F)
7463         x_measure_type(i) := g_CurrencyType;
7464 /* Starts added for bug 6961599 */
7465 		l_measures_total := Pji_Rep_Util.Measures_Total(   p_measure1 => l_pji_facts.ptd_ar_amount_due
7466                                                                        ,p_measure2 => l_pji_facts.ptd_ar_amount_overdue
7467                                                                      );
7468         l_ptd_value(i):= l_measures_total/l_factor_by;
7469 
7470 		l_measures_total := Pji_Rep_Util.Measures_Total(   p_measure1 => l_pji_facts.qtd_ar_amount_due
7471                                                                        ,p_measure2 => l_pji_facts.qtd_ar_amount_overdue
7472                                                                      );
7473         l_qtd_value(i):= l_measures_total/l_factor_by;
7474 
7475     	l_measures_total := Pji_Rep_Util.Measures_Total(   p_measure1 => l_pji_facts.ytd_ar_amount_due
7476                                                                        ,p_measure2 => l_pji_facts.ytd_ar_amount_overdue
7477                                                                      );
7478         l_ytd_value(i):= l_measures_total/l_factor_by;
7479 
7480 /* Ends added for bug 6961599 */
7481 
7482 /* Commented for bug 6961599
7483         l_ptd_value(i):=NULL;
7484 
7485         l_qtd_value(i):=NULL;
7486 
7487         l_ytd_value(i):=NULL;
7488 */
7489 		l_measures_total := Pji_Rep_Util.Measures_Total(   p_measure1 => l_pji_facts.itd_ar_amount_due
7490                                                                        ,p_measure2 => l_pji_facts.itd_ar_amount_overdue
7491                                                                      );
7492         l_itd_value(i):= l_measures_total/l_factor_by;
7493 
7494 
7495 		l_measures_total := Pji_Rep_Util.Measures_Total(   p_measure1 => l_pji_facts.ac_ar_amount_due
7496                                                                        ,p_measure2 => l_pji_facts.ac_ar_amount_overdue
7497                                                                      );
7498 
7499         l_ac_value(i):= l_measures_total/l_factor_by;
7500 
7501         l_prp_value(i):=NULL;
7502 
7503       ELSIF p_measure_set_code(i) = 'PPF_MSR_PC' AND bitand(l_check_plan_versions, g_Actual_CstFcst) = g_Actual_CstFcst THEN
7504         --  percent complete =
7505         --      actual burd cost / forecast burd cost
7506         --
7507         x_measure_type(i) := g_PercentType;
7508 
7509 /* Uncommented for bug 6961599 */
7510         IF l_overview_type(l_cost_forecast_index).ptd_burdened_cost <> 0 THEN
7511             l_ptd_value(i):=100 * (l_overview_type(l_actual_index).ptd_burdened_cost /
7512                             l_overview_type(l_cost_forecast_index).ptd_burdened_cost);
7513         ELSE
7514             l_ptd_value(i):= NULL;
7515         END IF;
7516 
7517         IF l_overview_type(l_cost_forecast_index).qtd_burdened_cost <> 0 THEN
7518             l_qtd_value(i):=100 * (l_overview_type(l_actual_index).qtd_burdened_cost /
7519                             l_overview_type(l_cost_forecast_index).qtd_burdened_cost);
7520         ELSE
7521             l_qtd_value(i):= NULL;
7522         END IF;
7523 
7524         IF l_overview_type(l_cost_forecast_index).ytd_burdened_cost <> 0 THEN
7525             l_ytd_value(i):=100 * (l_overview_type(l_actual_index).ytd_burdened_cost /
7526                             l_overview_type(l_cost_forecast_index).ytd_burdened_cost);
7527         ELSE
7528             l_ytd_value(i):= NULL;
7529         END IF;
7530 /* Uncommented for bug 6961599 */
7531         IF l_overview_type(l_cost_forecast_index).itd_burdened_cost <> 0 THEN
7532             l_itd_value(i):=100 * (l_overview_type(l_actual_index).itd_burdened_cost /
7533                             l_overview_type(l_cost_forecast_index).itd_burdened_cost);
7534          /* Modified the itd calulation from ac to itd burdened cost for Bug 7681638 */
7535         ELSE
7536             l_itd_value(i):= NULL;
7537         END IF;
7538 
7539         IF l_overview_type(l_cost_forecast_index).ac_burdened_cost <> 0 THEN
7540             l_ac_value(i):=100 * (l_overview_type(l_actual_index).ac_burdened_cost /
7541                            l_overview_type(l_cost_forecast_index).ac_burdened_cost);
7542         ELSE
7543             l_ac_value(i):= NULL;
7544         END IF;
7545 /*
7546         IF l_overview_type(l_cost_forecast_index).prp_burdened_cost <> 0 THEN
7547             l_prp_value(i):=100 * (l_overview_type(l_actual_index).prp_burdened_cost /
7548                             l_overview_type(l_cost_forecast_index).prp_burdened_cost);
7549         ELSE
7550             l_prp_value(i):= NULL;
7551         END IF;
7552 */
7553       ELSIF p_measure_set_code(i) = 'PPF_MSR_PDR' THEN
7554         -- past due receivables (from PJI_AC_PROJ_F)
7555         x_measure_type(i) := g_CurrencyType;
7556 
7557         l_ptd_value(i):=NULL;
7558 
7559         l_qtd_value(i):=NULL;
7560 
7561         l_ytd_value(i):=NULL;
7562 
7563         l_itd_value(i):=l_pji_facts.itd_ar_amount_overdue / l_factor_by;
7564 
7565         l_ac_value(i):=l_pji_facts.ac_ar_amount_overdue / l_factor_by;
7566 
7567         l_prp_value(i):=NULL;
7568 
7569       ELSIF  p_measure_set_code(i) = 'PPF_MSR_PFCV' AND bitand(l_check_plan_versions, g_Cst_FcstPriorfcst) = g_Cst_FcstPriorfcst THEN
7570         --
7571         -- Forecast Cost variance from Prior Forecast
7572         --      (Forecast Cost - Prior Forecast Cost)
7573         --
7574         x_measure_type(i) := g_CurrencyType;
7575 
7576         l_ptd_value(i):=(l_overview_type(l_cost_forecast_index).ptd_burdened_cost -
7577                         l_overview_type(l_prior_cost_forecast_index).ptd_burdened_cost) / l_factor_by;
7578 /* Un-Commented the code for Bug 7681638 i.e reverted fix of 6961599 */
7579 		/* Commented for bug 6961599 as this measure shouldn't display values for QTD/YTD */
7580         l_qtd_value(i):=(l_overview_type(l_cost_forecast_index).qtd_burdened_cost -
7581                         l_overview_type(l_prior_cost_forecast_index).qtd_burdened_cost) / l_factor_by;
7582 
7583         l_ytd_value(i):=(l_overview_type(l_cost_forecast_index).ytd_burdened_cost -
7584                         l_overview_type(l_prior_cost_forecast_index).ytd_burdened_cost) / l_factor_by;
7585 /* Commented the code for Bug 7681638 Start
7586         l_qtd_value(i):=NULL;
7587 
7588         l_ytd_value(i):=NULL;
7589  Commented the code for Bug 7681638 End */
7590 
7591         l_itd_value(i):=(l_overview_type(l_cost_forecast_index).itd_burdened_cost -
7592                         l_overview_type(l_prior_cost_forecast_index).itd_burdened_cost) / l_factor_by;
7593 
7594         l_ac_value(i):= (l_overview_type(l_cost_forecast_index).ac_burdened_cost -
7595                         l_overview_type(l_prior_cost_forecast_index).ac_burdened_cost)  / l_factor_by;
7596 
7597         l_prp_value(i):=(l_overview_type(l_cost_forecast_index).prp_burdened_cost -
7598                         l_overview_type(l_prior_cost_forecast_index).prp_burdened_cost) / l_factor_by;
7599 
7600       ELSIF p_measure_set_code(i) = 'PPF_MSR_POCC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
7601         -- purchased orders committed cost
7602         x_measure_type(i) := g_CurrencyType;
7603 
7604         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_po_committed_cost / l_factor_by;
7605 
7606         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_po_committed_cost / l_factor_by;
7607 
7608         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_po_committed_cost / l_factor_by;
7609 
7610         l_itd_value(i):=l_overview_type(l_actual_index).itd_po_committed_cost / l_factor_by;
7611 
7612         l_ac_value(i):=l_overview_type(l_actual_index).ac_po_committed_cost / l_factor_by;
7613 
7614         l_prp_value(i):=l_overview_type(l_actual_index).prp_po_committed_cost / l_factor_by;
7615 
7616       ELSIF p_measure_set_code(i) = 'PPF_MSR_PPC' THEN
7617         --Physical Percent Complete (from PA_PERCENT_COMPLETES)
7618         x_measure_type(i) := g_PercentType;
7619 
7620         l_ptd_value(i):=NULL;
7621         l_qtd_value(i):=NULL;
7622         l_ytd_value(i):=NULL;
7623 
7624         IF l_completed_percentage IS NOT NULL THEN
7625           l_itd_value(i):=l_completed_percentage * 100;
7626           l_ac_value(i):=l_completed_percentage * 100;
7627         ELSE
7628           l_itd_value(i):=NULL;
7629           l_ac_value(i) :=NULL;
7630         END IF;
7631 
7632         l_prp_value(i):=NULL;
7633 
7634       ELSIF p_measure_set_code(i) = 'PPF_MSR_PRCC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
7635         -- purchased requisitions committed cost
7636         x_measure_type(i) := g_CurrencyType;
7637 
7638         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_pr_committed_cost / l_factor_by;
7639 
7640         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_pr_committed_cost / l_factor_by;
7641 
7642         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_pr_committed_cost / l_factor_by;
7643 
7644         l_itd_value(i):=l_overview_type(l_actual_index).itd_pr_committed_cost / l_factor_by;
7645 
7646         l_ac_value(i):=l_overview_type(l_actual_index).ac_pr_committed_cost / l_factor_by;
7647 
7648         l_prp_value(i):=l_overview_type(l_actual_index).prp_pr_committed_cost / l_factor_by;
7649 
7650        ELSIF p_measure_set_code(i) = 'PPF_MSR_PS' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
7651         --
7652         --  percent spent =
7653         --      actual burd cost / budget burdened cost
7654         --
7655         x_measure_type(i) := g_PercentType;
7656 
7657         IF l_overview_type(l_cost_budget_index).ptd_burdened_cost <> 0 THEN
7658             l_ptd_value(i):=100 * (l_overview_type(l_actual_index).ptd_burdened_cost / l_overview_type(l_cost_budget_index).ptd_burdened_cost);
7659 				--Bug 12312399
7660         ELSE
7661             l_ptd_value(i):=NULL;
7662         END IF;
7663 
7664         IF l_overview_type(l_cost_budget_index).qtd_burdened_cost <> 0 THEN
7665             l_qtd_value(i):=100 * (l_overview_type(l_actual_index).qtd_burdened_cost /  l_overview_type(l_cost_budget_index).qtd_burdened_cost);
7666 			--Bug 12312399
7667         ELSE
7668             l_qtd_value(i):=NULL;
7669         END IF;
7670 
7671         IF l_overview_type(l_cost_budget_index).ytd_burdened_cost <> 0 THEN
7672             l_ytd_value(i):=100 * (l_overview_type(l_actual_index).ytd_burdened_cost /  l_overview_type(l_cost_budget_index).ytd_burdened_cost);
7673          	--Bug 12312399
7674         ELSE
7675            l_ytd_value(i):=NULL;
7676         END IF;
7677 
7678         IF l_overview_type(l_cost_budget_index).itd_burdened_cost <> 0 THEN
7679 
7680 			l_itd_value(i) := 100 * (l_overview_type(l_actual_index).itd_burdened_cost / l_overview_type(l_cost_budget_index).itd_burdened_cost);
7681             --Bug 12312399
7682         ELSE
7683             l_itd_value(i):= NULL;
7684         END IF;
7685 
7686         IF l_overview_type(l_cost_budget_index).ac_burdened_cost <> 0 THEN
7687             l_ac_value(i):=100 * (l_overview_type(l_actual_index).ac_burdened_cost / l_overview_type(l_cost_budget_index).ac_burdened_cost);
7688 				--Bug 12312399
7689         ELSE
7690             l_ac_value(i):= NULL;
7691         END IF;
7692 
7693         IF l_overview_type(l_cost_budget_index).prp_burdened_cost <> 0 THEN
7694             l_prp_value(i):=100 * (l_overview_type(l_actual_index).prp_burdened_cost /  l_overview_type(l_cost_budget_index).prp_burdened_cost);
7695 			--Bug 12312399
7696         ELSE
7697             l_prp_value(i):= NULL;
7698         END IF;
7699 
7700 
7701       ELSIF p_measure_set_code(i) = 'PPF_MSR_PSE' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
7702         --
7703         --  percent spent effort =
7704         --      (actual equipment hrs + actual labor hrs) / (curr budget equipment hrs + curr budget labor hrs)
7705         --
7706         x_measure_type(i) := g_PercentType;
7707 
7708         l_num := l_overview_type(l_cost_budget_index).ptd_labor_hrs +
7709                  l_overview_type(l_cost_budget_index).ptd_equipment_hrs;
7710         IF l_num <> 0 THEN
7711             l_ptd_value(i):=100 * (l_overview_type(l_actual_index).ptd_equipment_hrs + l_overview_type(l_actual_index).ptd_labor_hrs) / l_num;
7712 			--Bug 12312399
7713         ELSE
7714             l_ptd_value(i):= NULL;
7715         END IF;
7716 
7717         l_num := l_overview_type(l_cost_budget_index).qtd_labor_hrs +
7718                  l_overview_type(l_cost_budget_index).qtd_equipment_hrs;
7719         IF l_num <> 0 THEN
7720             l_qtd_value(i):=100 * (l_overview_type(l_actual_index).qtd_equipment_hrs +  l_overview_type(l_actual_index).qtd_labor_hrs) / l_num;
7721 			--Bug 12312399
7722         ELSE
7723             l_qtd_value(i):= NULL;
7724         END IF;
7725 
7726         l_num := l_overview_type(l_cost_budget_index).ytd_labor_hrs +
7727                  l_overview_type(l_cost_budget_index).ytd_equipment_hrs;
7728         IF l_num <> 0 THEN
7729             l_ytd_value(i):=100 * (l_overview_type(l_actual_index).ytd_equipment_hrs + l_overview_type(l_actual_index).ytd_labor_hrs) / l_num;
7730             --Bug 12312399
7731         ELSE
7732             l_ytd_value(i):= NULL;
7733         END IF;
7734 
7735         l_num := l_overview_type(l_cost_budget_index).itd_labor_hrs +
7736                  l_overview_type(l_cost_budget_index).itd_equipment_hrs;
7737         IF l_num <> 0 THEN
7738             l_itd_value(i):=100 * (l_overview_type(l_actual_index).itd_equipment_hrs +  l_overview_type(l_actual_index).itd_labor_hrs) / l_num;
7739 			--Bug 12312399
7740         ELSE
7741             l_itd_value(i):= NULL;
7742         END IF;
7743 
7744         l_num := l_overview_type(l_cost_budget_index).ac_labor_hrs +
7745                  l_overview_type(l_cost_budget_index).ac_equipment_hrs;
7746         IF l_num <> 0 THEN
7747             l_ac_value(i):=100 * (l_overview_type(l_actual_index).ac_equipment_hrs + l_overview_type(l_actual_index).ac_labor_hrs) / l_num;
7748 			--Bug 12312399
7749         ELSE
7750             l_ac_value(i):= NULL;
7751         END IF;
7752 
7753         l_num := l_overview_type(l_cost_budget_index).prp_labor_hrs +
7754                  l_overview_type(l_cost_budget_index).prp_equipment_hrs;
7755         IF l_num <> 0 THEN
7756             l_prp_value(i):=100 * (l_overview_type(l_actual_index).prp_equipment_hrs + l_overview_type(l_actual_index).prp_labor_hrs) / l_num;
7757 			--Bug 12312399
7758         ELSE
7759             l_prp_value(i):= NULL;
7760         END IF;
7761 
7762       ELSIF p_measure_set_code(i) = 'PPF_MSR_PSEH' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
7763         --
7764         --  percent spent equipment hours =
7765         --      actual equipment hrs / curr budget equipment hrs
7766         --
7767         x_measure_type(i) := g_PercentType;
7768 
7769         IF l_overview_type(l_cost_budget_index).ptd_equipment_hrs <> 0 THEN
7770             l_ptd_value(i):=100 * (l_overview_type(l_actual_index).ptd_equipment_hrs /  l_overview_type(l_cost_budget_index).ptd_equipment_hrs);
7771 			--Bug 12312399
7772         ELSE
7773             l_ptd_value(i):= NULL;
7774         END IF;
7775 
7776         IF l_overview_type(l_cost_budget_index).qtd_equipment_hrs <> 0 THEN
7777             l_qtd_value(i):=100 * (l_overview_type(l_actual_index).qtd_equipment_hrs / l_overview_type(l_cost_budget_index).qtd_equipment_hrs);
7778 			--Bug 12312399
7779         ELSE
7780             l_qtd_value(i):= NULL;
7781         END IF;
7782 
7783         IF l_overview_type(l_cost_budget_index).ytd_equipment_hrs <> 0 THEN
7784             l_ytd_value(i):=100 * (l_overview_type(l_actual_index).ytd_equipment_hrs / l_overview_type(l_cost_budget_index).ytd_equipment_hrs);
7785 			--Bug 12312399
7786         ELSE
7787             l_ytd_value(i):= NULL;
7788         END IF;
7789 
7790         IF l_overview_type(l_cost_budget_index).itd_equipment_hrs <> 0 THEN
7791             l_itd_value(i):=100 * (l_overview_type(l_actual_index).itd_equipment_hrs / l_overview_type(l_cost_budget_index).itd_equipment_hrs);
7792 			--Bug 12312399
7793         ELSE
7794             l_itd_value(i):= NULL;
7795         END IF;
7796 
7797         IF l_overview_type(l_cost_budget_index).ac_equipment_hrs <> 0 THEN
7798             l_ac_value(i):=100 * (l_overview_type(l_actual_index).ac_equipment_hrs / l_overview_type(l_cost_budget_index).ac_equipment_hrs);
7799 			--Bug 12312399
7800         ELSE
7801             l_ac_value(i):= NULL;
7802         END IF;
7803 
7804         IF l_overview_type(l_cost_budget_index).prp_equipment_hrs <> 0 THEN
7805             l_prp_value(i):=100 * (l_overview_type(l_actual_index).prp_equipment_hrs /  l_overview_type(l_cost_budget_index).prp_equipment_hrs);
7806 			--Bug 12312399
7807         ELSE
7808             l_prp_value(i):= NULL;
7809         END IF;
7810 
7811       ELSIF p_measure_set_code(i) = 'PPF_MSR_PSLH' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
7812         --  percent spent labor hours =
7813         --      actual labor hrs / curr budget labor hrs
7814         --
7815         x_measure_type(i) := g_PercentType;
7816 
7817         IF l_overview_type(l_cost_budget_index).ptd_labor_hrs <> 0 THEN
7818             l_ptd_value(i):=100 * (l_overview_type(l_actual_index).ptd_labor_hrs / l_overview_type(l_cost_budget_index).ptd_labor_hrs);
7819 			--Bug 12312399
7820         ELSE
7821             l_ptd_value(i):= NULL;
7822         END IF;
7823 
7824         IF l_overview_type(l_cost_budget_index).qtd_labor_hrs <> 0 THEN
7825             l_qtd_value(i):=100 * (l_overview_type(l_actual_index).qtd_labor_hrs /  l_overview_type(l_cost_budget_index).qtd_labor_hrs);
7826 			--Bug 12312399
7827         ELSE
7828             l_qtd_value(i):= NULL;
7829         END IF;
7830 
7831         IF l_overview_type(l_cost_budget_index).ytd_labor_hrs <> 0 THEN
7832             l_ytd_value(i):=100 * (l_overview_type(l_actual_index).ytd_labor_hrs / l_overview_type(l_cost_budget_index).ytd_labor_hrs);
7833 			--Bug 12312399
7834         ELSE
7835             l_ytd_value(i):= NULL;
7836         END IF;
7837 
7838         IF l_overview_type(l_cost_budget_index).itd_labor_hrs <> 0 THEN
7839             l_itd_value(i):=100 * (l_overview_type(l_actual_index).itd_labor_hrs /  l_overview_type(l_cost_budget_index).itd_labor_hrs);
7840              --Bug 12312399
7841         ELSE
7842             l_itd_value(i):= NULL;
7843         END IF;
7844 
7845         IF l_overview_type(l_cost_budget_index).ac_labor_hrs <> 0 THEN
7846             l_ac_value(i):=100 * (l_overview_type(l_actual_index).ac_labor_hrs / l_overview_type(l_cost_budget_index).ac_labor_hrs);
7847 			--Bug 12312399
7848         ELSE
7849             l_ac_value(i):= NULL;
7850         END IF;
7851 
7852         IF l_overview_type(l_cost_budget_index).prp_labor_hrs <> 0 THEN
7853             l_prp_value(i):=100 * (l_overview_type(l_actual_index).prp_labor_hrs /  l_overview_type(l_cost_budget_index).prp_labor_hrs);
7854 			--Bug 12312399
7855         ELSE
7856             l_prp_value(i):= NULL;
7857         END IF;
7858 
7859       ELSIF p_measure_set_code(i) = 'PPF_MSR_PWQ' THEN
7860         -- Planned work quantity
7861         x_measure_type(i) := g_HoursType;
7862 
7863         l_ptd_value(i):=l_planned_work_qt.ptd / l_effort_UOM;
7864 
7865         l_qtd_value(i):=l_planned_work_qt.qtd / l_effort_UOM;
7866 
7867         l_ytd_value(i):=l_planned_work_qt.ytd / l_effort_UOM;
7868 
7869         l_itd_value(i):=l_planned_work_qt.itd / l_effort_UOM;
7870 
7871         l_ac_value(i):=l_planned_work_qt.ac / l_effort_UOM;
7872 
7873         l_prp_value(i):=l_planned_work_qt.prp / l_effort_UOM;
7874 
7875       ELSIF p_measure_set_code(i) = 'PPF_MSR_R' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
7876         -- Revenue
7877         x_measure_type(i) := g_CurrencyType;
7878 
7879         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_revenue / l_factor_by;
7880 
7881         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_revenue / l_factor_by;
7882 
7883         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_revenue / l_factor_by;
7884 
7885         l_itd_value(i):=l_overview_type(l_actual_index).itd_revenue / l_factor_by;
7886 
7887         l_ac_value(i):=l_overview_type(l_actual_index).ac_revenue / l_factor_by;
7888 
7889         l_prp_value(i):=l_overview_type(l_actual_index).prp_revenue / l_factor_by;
7890 
7891       ELSIF p_measure_set_code(i) = 'PPF_MSR_RC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
7892         -- raw cost
7893         x_measure_type(i) := g_CurrencyType;
7894 
7895         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_raw_cost / l_factor_by;
7896 
7897         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_raw_cost / l_factor_by;
7898 
7899         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_raw_cost / l_factor_by;
7900 
7901         l_itd_value(i):=l_overview_type(l_actual_index).itd_raw_cost / l_factor_by;
7902 
7903         l_ac_value(i):=l_overview_type(l_actual_index).ac_raw_cost / l_factor_by;
7904 
7905         l_prp_value(i):=l_overview_type(l_actual_index).prp_raw_cost / l_factor_by;
7906 
7907       ELSIF p_measure_set_code(i) = 'PPF_MSR_RR' THEN
7908         -- revenue at risk (from PJI_AC_PROJ_F)
7909         x_measure_type(i) := g_CurrencyType;
7910         l_ptd_value(i):= NULL;
7911 
7912         l_qtd_value(i):= NULL;
7913 
7914         l_ytd_value(i):= NULL;
7915 
7916         /* Commented out for bug 4194804
7917             l_num := l_overview_type(l_actual_index).itd_revenue - l_pji_facts.itd_additional_funding_amount
7918                  - l_pji_facts.itd_cancelled_funding_amount
7919 			  	 - l_pji_facts.itd_funding_adjustment_amount
7920 				 - l_pji_facts.itd_initial_funding_amount;
7921   */
7922         -- Added for bug  4194804
7923        l_measure1       := l_pji_facts.itd_additional_funding_amount;
7924        l_measure2       := l_pji_facts.itd_cancelled_funding_amount;
7925        l_measure3       := l_pji_facts.itd_funding_adjustment_amount;
7926        l_measure4       := l_pji_facts.itd_initial_funding_amount;
7927 
7928        l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
7929                                                           ,p_measure2 => l_measure2
7930                                                           ,p_measure3 => l_measure3
7931                                                           ,p_measure4 => l_measure4
7932                                                         );
7933 
7934        l_num  := l_overview_type(l_actual_index).itd_revenue - NVL(l_measures_total,0);
7935 
7936 
7937 		IF l_num < 0 THEN
7938 		   l_num := 0;
7939 		END IF;
7940 
7941         l_itd_value(i):=l_num / l_factor_by;
7942 
7943       /* Bug 6485047 Changes start here*/
7944        l_measure1       := l_pji_facts.ac_additional_funding_amount;
7945        l_measure2       := l_pji_facts.ac_cancelled_funding_amount;
7946        l_measure3       := l_pji_facts.ac_funding_adjustment_amount;
7947        l_measure4       := l_pji_facts.ac_initial_funding_amount;
7948 
7949        l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
7950                                                           ,p_measure2 => l_measure2
7951                                                           ,p_measure3 => l_measure3
7952                                                           ,p_measure4 => l_measure4
7953                                                         );
7954 
7955 
7956        l_num  := l_overview_type(l_actual_index).ac_revenue - NVL(l_measures_total,0);
7957 
7958 
7959 		IF l_num < 0 THEN
7960 		   l_num := 0;
7961 		END IF;
7962 
7963         l_ac_value(i):=l_num / l_factor_by;
7964 
7965 
7966 	/*Bug 6485047 Changes end here*/
7967 
7968         l_prp_value(i):= NULL;
7969 
7970       ELSIF p_measure_set_code(i) = 'PPF_MSR_RV' AND bitand(l_check_plan_versions, g_Actual_RevBudget) = g_Actual_RevBudget  THEN
7971         --
7972         -- revenue variance =
7973         --      (actual revenue - current budget revenue)
7974         --
7975         x_measure_type(i) := g_CurrencyType;
7976 
7977         l_ptd_value(i):=(l_overview_type(l_actual_index).ptd_revenue -
7978                         l_overview_type(l_rev_budget_index).ptd_revenue) / l_factor_by;
7979 
7980         l_qtd_value(i):=(l_overview_type(l_actual_index).qtd_revenue -
7981                         l_overview_type(l_rev_budget_index).qtd_revenue) / l_factor_by;
7982 
7983         l_ytd_value(i):=(l_overview_type(l_actual_index).ytd_revenue -
7984                         l_overview_type(l_rev_budget_index).ytd_revenue) / l_factor_by;
7985 
7986         l_itd_value(i):=(l_overview_type(l_actual_index).itd_revenue -
7987                         l_overview_type(l_rev_budget_index).itd_revenue) / l_factor_by;
7988 
7989         l_ac_value(i) :=(l_overview_type(l_actual_index).ac_revenue -
7990                         l_overview_type(l_rev_budget_index).ac_revenue) / l_factor_by;
7991 
7992         l_prp_value(i):=(l_overview_type(l_actual_index).prp_revenue -
7993                         l_overview_type(l_rev_budget_index).prp_revenue) / l_factor_by;
7994 
7995       ELSIF p_measure_set_code(i) = 'PPF_MSR_RW' THEN
7996         -- revenue write offs (from PJI_AC_PROJ_F)
7997         x_measure_type(i) := g_CurrencyType;
7998 
7999         l_ptd_value(i):=l_pji_facts.ptd_revenue_writeoff / l_factor_by;
8000 
8001         l_qtd_value(i):=l_pji_facts.qtd_revenue_writeoff / l_factor_by;
8002 
8003         l_ytd_value(i):=l_pji_facts.ytd_revenue_writeoff / l_factor_by;
8004 
8005         l_itd_value(i):=l_pji_facts.itd_revenue_writeoff / l_factor_by;
8006 
8007         l_ac_value(i):=l_pji_facts.ac_revenue_writeoff / l_factor_by;
8008 
8009         l_prp_value(i):=l_pji_facts.prp_revenue_writeoff / l_factor_by;
8010 
8011       ELSIF p_measure_set_code(i) = 'PPF_MSR_RWQ' THEN
8012         --
8013         -- Remaining Work Quantity (only lowest level task) =
8014         --      WQ_PLANNED_QUANTITY (ELEMENT_VERSION_ID=PROJECT_ELEMENT_ID) -
8015         --      INCREMENTAL_WORK_QUANTITY (PUBLISHED_FLAG='Y',OBJECT_TYPE='PA_TASKS',OBJECT_VERSION_ID=PROJECT_ELEMENT_ID)
8016         --
8017         x_measure_type(i) := g_HoursType;
8018 
8019         l_ptd_value(i):=(l_planned_work_qt.ptd - l_incr_work_qt.ptd) / l_effort_UOM;
8020 
8021         l_qtd_value(i):=(l_planned_work_qt.qtd - l_incr_work_qt.qtd) / l_effort_UOM;
8022 
8023         l_ytd_value(i):=(l_planned_work_qt.ytd - l_incr_work_qt.ytd) / l_effort_UOM;
8024 
8025         l_itd_value(i):=(l_planned_work_qt.itd - l_incr_work_qt.itd) / l_effort_UOM;
8026 
8027         l_ac_value(i):=(l_planned_work_qt.ac - l_incr_work_qt.ac) / l_effort_UOM;
8028 
8029         l_prp_value(i):=(l_planned_work_qt.prp - l_incr_work_qt.prp) / l_effort_UOM;
8030 
8031       ELSIF p_measure_set_code(i) = 'PPF_MSR_SICC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
8032         -- supplier invoices committed cost
8033         x_measure_type(i) := g_CurrencyType;
8034 
8035         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_sup_inv_committed_cost / l_factor_by;
8036 
8037         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_sup_inv_committed_cost / l_factor_by;
8038 
8039         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_sup_inv_committed_cost / l_factor_by;
8040 
8041         l_itd_value(i):=l_overview_type(l_actual_index).itd_sup_inv_committed_cost / l_factor_by;
8042 
8043         l_ac_value(i):=l_overview_type(l_actual_index).ac_sup_inv_committed_cost / l_factor_by;
8044 
8045         l_prp_value(i):=l_overview_type(l_actual_index).prp_sup_inv_committed_cost / l_factor_by;
8046 
8047       ELSIF p_measure_set_code(i) = 'PPF_MSR_SPI' AND bitand(l_check_plan_versions, g_CstBudget_is_present) = g_CstBudget_is_present THEN
8048         -- Schedule performance index =
8049         --      (budget burden cost * completed percentage) / budget burden cost
8050         --
8051         x_measure_type(i) := g_IndexType;
8052 
8053         l_ptd_value(i):=NULL;
8054 
8055         l_qtd_value(i):=NULL;
8056 
8057         l_ytd_value(i):=NULL;
8058 
8059         IF l_overview_type(l_cost_budget_index).itd_burdened_cost <> 0 THEN
8060             l_itd_value(i):=((l_overview_type(l_cost_budget_index).ac_burdened_cost * l_completed_percentage)
8061                             / l_overview_type(l_cost_budget_index).itd_burdened_cost);
8062         ELSE
8063             l_itd_value(i):= NULL;
8064         END IF;
8065 
8066         IF l_overview_type(l_cost_budget_index).ac_burdened_cost <> 0 THEN
8067             l_ac_value(i):=((l_overview_type(l_cost_budget_index).ac_burdened_cost * l_completed_percentage)
8068                             / l_overview_type(l_cost_budget_index).ac_burdened_cost);
8069         ELSE
8070             l_ac_value(i):= NULL;
8071         END IF;
8072 
8073         l_prp_value(i):= NULL;
8074 
8075       ELSIF p_measure_set_code(i) = 'PPF_MSR_TC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
8076         -- total cost
8077         x_measure_type(i) := g_CurrencyType;
8078 
8079         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_burdened_cost / l_factor_by;
8080 
8081         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_burdened_cost / l_factor_by;
8082 
8083         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_burdened_cost / l_factor_by;
8084 
8085         l_itd_value(i):=l_overview_type(l_actual_index).itd_burdened_cost / l_factor_by;
8086 
8087         l_ac_value(i):=l_overview_type(l_actual_index).ac_burdened_cost / l_factor_by;
8088 
8089         l_prp_value(i):=l_overview_type(l_actual_index).prp_burdened_cost / l_factor_by;
8090 
8091       ELSIF p_measure_set_code(i) = 'PPF_MSR_TCC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
8092         --
8093         -- total committed cost =
8094         -- supplier invoice committed cost + purchase orders committed cost + purchase requisitions committed cost + other committed cost
8095         --
8096         x_measure_type(i) := g_CurrencyType;
8097 
8098         -- Added for bug 4194804
8099         l_measure1       := l_overview_type(l_actual_index).ptd_sup_inv_committed_cost;
8100         l_measure2       := l_overview_type(l_actual_index).ptd_po_committed_cost;
8101         l_measure3       := l_overview_type(l_actual_index).ptd_pr_committed_cost;
8102         l_measure4       := l_overview_type(l_actual_index).ptd_oth_committed_cost;
8103         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8104                                                            ,p_measure2 => l_measure2
8105                                                            ,p_measure3 => l_measure3
8106                                                            ,p_measure4 => l_measure4
8107                                                          );
8108 
8109         l_ptd_value(i):= l_measures_total/l_factor_by;
8110 
8111         -- Added for bug 4194804
8112         l_measure1       := l_overview_type(l_actual_index).qtd_sup_inv_committed_cost;
8113         l_measure2       := l_overview_type(l_actual_index).qtd_po_committed_cost;
8114         l_measure3       := l_overview_type(l_actual_index).qtd_pr_committed_cost;
8115         l_measure4       := l_overview_type(l_actual_index).qtd_oth_committed_cost;
8116         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8117                                                            ,p_measure2 => l_measure2
8118                                                            ,p_measure3 => l_measure3
8119                                                            ,p_measure4 => l_measure4
8120                                                          );
8121 
8122         l_qtd_value(i):= l_measures_total/l_factor_by;
8123 
8124         -- Added for bug 4194804
8125         l_measure1       := l_overview_type(l_actual_index).ytd_sup_inv_committed_cost;
8126         l_measure2       := l_overview_type(l_actual_index).ytd_po_committed_cost;
8127         l_measure3       := l_overview_type(l_actual_index).ytd_pr_committed_cost;
8128         l_measure4       := l_overview_type(l_actual_index).ytd_oth_committed_cost;
8129         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8130                                                            ,p_measure2 => l_measure2
8131                                                            ,p_measure3 => l_measure3
8132                                                            ,p_measure4 => l_measure4
8133                                                          );
8134 
8135         l_ytd_value(i):= l_measures_total/l_factor_by;
8136 
8137         -- Added for bug 4194804
8138         l_measure1       := l_overview_type(l_actual_index).itd_sup_inv_committed_cost;
8139         l_measure2       := l_overview_type(l_actual_index).itd_po_committed_cost;
8140         l_measure3       := l_overview_type(l_actual_index).itd_pr_committed_cost;
8141         l_measure4       := l_overview_type(l_actual_index).itd_oth_committed_cost;
8142         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8143                                                            ,p_measure2 => l_measure2
8144                                                            ,p_measure3 => l_measure3
8145                                                            ,p_measure4 => l_measure4
8146                                                          );
8147 
8148         l_itd_value(i):= l_measures_total/l_factor_by;
8149 
8150         -- Added for bug 4194804
8151         l_measure1       := l_overview_type(l_actual_index).ac_sup_inv_committed_cost;
8152         l_measure2       := l_overview_type(l_actual_index).ac_po_committed_cost;
8153         l_measure3       := l_overview_type(l_actual_index).ac_pr_committed_cost;
8154         l_measure4       := l_overview_type(l_actual_index).ac_oth_committed_cost;
8155         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8156                                                            ,p_measure2 => l_measure2
8157                                                            ,p_measure3 => l_measure3
8158                                                            ,p_measure4 => l_measure4
8159                                                          );
8160 
8161         l_ac_value(i):= l_measures_total/l_factor_by;
8162 
8163         -- Added for bug 4194804
8164         l_measure1       := l_overview_type(l_actual_index).prp_sup_inv_committed_cost;
8165         l_measure2       := l_overview_type(l_actual_index).prp_po_committed_cost;
8166         l_measure3       := l_overview_type(l_actual_index).prp_pr_committed_cost;
8167         l_measure4       := l_overview_type(l_actual_index).prp_oth_committed_cost;
8168         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8169                                                            ,p_measure2 => l_measure2
8170                                                            ,p_measure3 => l_measure3
8171                                                            ,p_measure4 => l_measure4
8172                                                          );
8173 
8174         l_prp_value(i):= l_measures_total/l_factor_by;
8175 
8176      /* Commented for bug 4194804
8177         l_ptd_value(i):=(l_overview_type(l_actual_index).ptd_sup_inv_committed_cost + l_overview_type(l_actual_index).ptd_po_committed_cost +
8178                          l_overview_type(l_actual_index).ptd_pr_committed_cost + l_overview_type(l_actual_index).ptd_oth_committed_cost) / l_factor_by;
8179 
8180         l_qtd_value(i):=(l_overview_type(l_actual_index).qtd_sup_inv_committed_cost + l_overview_type(l_actual_index).qtd_po_committed_cost +
8181                          l_overview_type(l_actual_index).qtd_pr_committed_cost + l_overview_type(l_actual_index).qtd_oth_committed_cost) / l_factor_by;
8182 
8183         l_ytd_value(i):=(l_overview_type(l_actual_index).ytd_sup_inv_committed_cost + l_overview_type(l_actual_index).ytd_po_committed_cost +
8184                          l_overview_type(l_actual_index).ytd_pr_committed_cost + l_overview_type(l_actual_index).ytd_oth_committed_cost) / l_factor_by;
8185 
8186         l_itd_value(i):=(l_overview_type(l_actual_index).itd_sup_inv_committed_cost + l_overview_type(l_actual_index).itd_po_committed_cost +
8187                          l_overview_type(l_actual_index).itd_pr_committed_cost + l_overview_type(l_actual_index).itd_oth_committed_cost) / l_factor_by;
8188 
8189         l_ac_value(i):=(l_overview_type(l_actual_index).ac_sup_inv_committed_cost + l_overview_type(l_actual_index).ac_po_committed_cost +
8190                          l_overview_type(l_actual_index).ac_pr_committed_cost + l_overview_type(l_actual_index).ac_oth_committed_cost) / l_factor_by;
8191 
8192         l_prp_value(i):=(l_overview_type(l_actual_index).prp_sup_inv_committed_cost + l_overview_type(l_actual_index).prp_po_committed_cost +
8193                          l_overview_type(l_actual_index).prp_pr_committed_cost + l_overview_type(l_actual_index).prp_oth_committed_cost) / l_factor_by;
8194 */
8195 
8196 
8197       ELSIF p_measure_set_code(i) = 'PPF_MSR_TCCC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
8198         -- total cost + committed cost
8199         x_measure_type(i) := g_CurrencyType;
8200 
8201         -- Added for bug 4194804
8202         l_measure1       := l_overview_type(l_actual_index).ptd_sup_inv_committed_cost;
8203         l_measure2       := l_overview_type(l_actual_index).ptd_po_committed_cost;
8204         l_measure3       := l_overview_type(l_actual_index).ptd_pr_committed_cost;
8205         l_measure4       := l_overview_type(l_actual_index).ptd_oth_committed_cost;
8206         l_measure5       := l_overview_type(l_actual_index).ptd_burdened_cost;
8207         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8208                                                            ,p_measure2 => l_measure2
8209                                                            ,p_measure3 => l_measure3
8210                                                            ,p_measure4 => l_measure4
8211                                                            ,p_measure5 => l_measure5
8212                                                          );
8213 
8214         l_ptd_value(i):= l_measures_total/l_factor_by;
8215 
8216          -- Added for bug 4194804
8217         l_measure1       := l_overview_type(l_actual_index).qtd_sup_inv_committed_cost;
8218         l_measure2       := l_overview_type(l_actual_index).qtd_po_committed_cost;
8219         l_measure3       := l_overview_type(l_actual_index).qtd_pr_committed_cost;
8220         l_measure4       := l_overview_type(l_actual_index).qtd_oth_committed_cost;
8221         l_measure5       := l_overview_type(l_actual_index).qtd_burdened_cost;
8222         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8223                                                            ,p_measure2 => l_measure2
8224                                                            ,p_measure3 => l_measure3
8225                                                            ,p_measure4 => l_measure4
8226                                                            ,p_measure5 => l_measure5
8227                                                          );
8228         l_qtd_value(i):= l_measures_total/l_factor_by;
8229 
8230          -- Added for bug 4194804
8231         l_measure1       := l_overview_type(l_actual_index).ytd_sup_inv_committed_cost;
8232         l_measure2       := l_overview_type(l_actual_index).ytd_po_committed_cost;
8233         l_measure3       := l_overview_type(l_actual_index).ytd_pr_committed_cost;
8234         l_measure4       := l_overview_type(l_actual_index).ytd_oth_committed_cost;
8235         l_measure5       := l_overview_type(l_actual_index).ytd_burdened_cost;
8236         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8237                                                            ,p_measure2 => l_measure2
8238                                                            ,p_measure3 => l_measure3
8239                                                            ,p_measure4 => l_measure4
8240                                                            ,p_measure5 => l_measure5
8241                                                          );
8242 
8243         l_ytd_value(i):= l_measures_total/l_factor_by;
8244 
8245         -- Added for bug  4194804
8246         l_measure1       := l_overview_type(l_actual_index).itd_sup_inv_committed_cost;
8247         l_measure2       := l_overview_type(l_actual_index).itd_po_committed_cost;
8248         l_measure3       := l_overview_type(l_actual_index).itd_pr_committed_cost;
8249         l_measure4       := l_overview_type(l_actual_index).itd_oth_committed_cost;
8250         l_measure5       := l_overview_type(l_actual_index).itd_burdened_cost;
8251         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8252                                                            ,p_measure2 => l_measure2
8253                                                            ,p_measure3 => l_measure3
8254                                                            ,p_measure4 => l_measure4
8255                                                            ,p_measure5 => l_measure5
8256                                                          );
8257 
8258         l_itd_value(i):= l_measures_total/l_factor_by;
8259 
8260         -- Added for bug  4194804
8261         l_measure1       := l_overview_type(l_actual_index).ac_sup_inv_committed_cost;
8262         l_measure2       := l_overview_type(l_actual_index).ac_po_committed_cost;
8263         l_measure3       := l_overview_type(l_actual_index).ac_pr_committed_cost;
8264         l_measure4       := l_overview_type(l_actual_index).ac_oth_committed_cost;
8265         l_measure5       := l_overview_type(l_actual_index).ac_burdened_cost;
8266         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8267                                                            ,p_measure2 => l_measure2
8268                                                            ,p_measure3 => l_measure3
8269                                                            ,p_measure4 => l_measure4
8270                                                            ,p_measure5 => l_measure5
8271                                                          );
8272 
8273         l_ac_value(i):= l_measures_total/l_factor_by;
8274 
8275         -- Added for bug  4194804
8276         l_measure1       := l_overview_type(l_actual_index).prp_sup_inv_committed_cost;
8277         l_measure2       := l_overview_type(l_actual_index).prp_po_committed_cost;
8278         l_measure3       := l_overview_type(l_actual_index).prp_pr_committed_cost;
8279         l_measure4       := l_overview_type(l_actual_index).prp_oth_committed_cost;
8280         l_measure5       := l_overview_type(l_actual_index).prp_burdened_cost;
8281         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8282                                                            ,p_measure2 => l_measure2
8283                                                            ,p_measure3 => l_measure3
8284                                                            ,p_measure4 => l_measure4
8285                                                            ,p_measure5 => l_measure5
8286                                                          );
8287 
8288         l_prp_value(i):= l_measures_total/l_factor_by;
8289 
8290 /* Commented for bug 4194804
8291         l_ptd_value(i):=(l_overview_type(l_actual_index).ptd_sup_inv_committed_cost + l_overview_type(l_actual_index).ptd_po_committed_cost +
8292                          l_overview_type(l_actual_index).ptd_pr_committed_cost + l_overview_type(l_actual_index).ptd_oth_committed_cost +
8293                          l_overview_type(l_actual_index).ptd_burdened_cost) / l_factor_by;
8294 
8295         l_qtd_value(i):=(l_overview_type(l_actual_index).qtd_sup_inv_committed_cost + l_overview_type(l_actual_index).qtd_po_committed_cost +
8296                          l_overview_type(l_actual_index).qtd_pr_committed_cost + l_overview_type(l_actual_index).qtd_oth_committed_cost +
8297                          l_overview_type(l_actual_index).qtd_burdened_cost) / l_factor_by;
8298 
8299         l_ytd_value(i):=(l_overview_type(l_actual_index).ytd_sup_inv_committed_cost + l_overview_type(l_actual_index).ytd_po_committed_cost +
8300                          l_overview_type(l_actual_index).ytd_pr_committed_cost + l_overview_type(l_actual_index).ytd_oth_committed_cost +
8301                          l_overview_type(l_actual_index).ytd_burdened_cost) / l_factor_by;
8302 
8303         l_itd_value(i):=(l_overview_type(l_actual_index).itd_sup_inv_committed_cost + l_overview_type(l_actual_index).itd_po_committed_cost +
8304                          l_overview_type(l_actual_index).itd_pr_committed_cost + l_overview_type(l_actual_index).itd_oth_committed_cost +
8305                          l_overview_type(l_actual_index).itd_burdened_cost) / l_factor_by;
8306 
8307         l_ac_value(i):=(l_overview_type(l_actual_index).ac_sup_inv_committed_cost + l_overview_type(l_actual_index).ac_po_committed_cost +
8308                          l_overview_type(l_actual_index).ac_pr_committed_cost + l_overview_type(l_actual_index).ac_oth_committed_cost +
8309                          l_overview_type(l_actual_index).ac_burdened_cost) / l_factor_by;
8310 
8311         l_prp_value(i):=(l_overview_type(l_actual_index).prp_sup_inv_committed_cost + l_overview_type(l_actual_index).prp_po_committed_cost +
8312                          l_overview_type(l_actual_index).prp_pr_committed_cost + l_overview_type(l_actual_index).prp_oth_committed_cost +
8313                          l_overview_type(l_actual_index).prp_burdened_cost) / l_factor_by;
8314 
8315 */
8316 
8317       ELSIF p_measure_set_code(i) = 'PPF_MSR_TLC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
8318         --Total labor cost
8319         x_measure_type(i) := g_CurrencyType;
8320 
8321         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_labor_burdened_cost / l_factor_by;
8322 
8323         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_labor_burdened_cost / l_factor_by;
8324 
8325         l_ytd_value(i) := l_overview_type(l_actual_index).ytd_labor_burdened_cost / l_factor_by;
8326 
8327         l_itd_value(i) := l_overview_type(l_actual_index).itd_labor_burdened_cost / l_factor_by;
8328 
8329         l_ac_value(i) := l_overview_type(l_actual_index).ac_labor_burdened_cost / l_factor_by;
8330 
8331         l_prp_value(i) := l_overview_type(l_actual_index).prp_labor_burdened_cost / l_factor_by;
8332 
8333       ELSIF (p_measure_set_code(i) = 'PPF_MSR_TEH' OR p_measure_set_code(i) = 'PPF_MSR_THE') AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
8334         --Total equipment hours
8335         x_measure_type(i) := g_HoursType;
8336 
8337         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_equipment_hrs / l_effort_UOM;
8338 
8339         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_equipment_hrs / l_effort_UOM;
8340 
8341         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_equipment_hrs / l_effort_UOM;
8342 
8343         l_itd_value(i):=l_overview_type(l_actual_index).itd_equipment_hrs / l_effort_UOM;
8344 
8345         l_ac_value(i):=l_overview_type(l_actual_index).ac_equipment_hrs / l_effort_UOM;
8346 
8347         l_prp_value(i):=l_overview_type(l_actual_index).prp_equipment_hrs / l_effort_UOM;
8348 
8349       ELSIF p_measure_set_code(i) = 'PPF_MSR_TLH' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
8350         --Total labor hours
8351         x_measure_type(i) := g_HoursType;
8352 
8353         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_labor_hrs / l_effort_UOM;
8354 
8355         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_labor_hrs / l_effort_UOM;
8356 
8357         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_labor_hrs / l_effort_UOM;
8358 
8359         l_itd_value(i):=l_overview_type(l_actual_index).itd_labor_hrs / l_effort_UOM;
8360 
8361         l_ac_value(i):=l_overview_type(l_actual_index).ac_labor_hrs / l_effort_UOM;
8362 
8363         l_prp_value(i):=l_overview_type(l_actual_index).prp_labor_hrs / l_effort_UOM;
8364 
8365       ELSIF p_measure_set_code(i) = 'PPF_MSR_TNF' THEN
8366         -- Total Net Funding (from PJI_AC_PROJ_F) =
8367         --      initial_funding_amount + additional_funding_amount + funding_adjustment_amount + cancelled_funding_amount
8368         --
8369         x_measure_type(i) := g_CurrencyType;
8370 
8371 
8372         -- Added for bug  4194804
8373         l_measure1       := l_pji_facts.ptd_initial_funding_amount;
8374         l_measure2       := l_pji_facts.ptd_additional_funding_amount;
8375         l_measure3       := l_pji_facts.ptd_funding_adjustment_amount;
8376         l_measure4       := l_pji_facts.ptd_cancelled_funding_amount;
8377         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8378                                                            ,p_measure2 => l_measure2
8379                                                            ,p_measure3 => l_measure3
8380                                                            ,p_measure4 => l_measure4
8381                                                          );
8382 
8383         l_ptd_value(i):= l_measures_total/l_factor_by;
8384 
8385         -- Added for bug  4194804
8386         l_measure1       := l_pji_facts.qtd_initial_funding_amount;
8387         l_measure2       := l_pji_facts.qtd_additional_funding_amount;
8388         l_measure3       := l_pji_facts.qtd_funding_adjustment_amount;
8389         l_measure4       := l_pji_facts.qtd_cancelled_funding_amount;
8390         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8391                                                            ,p_measure2 => l_measure2
8392                                                            ,p_measure3 => l_measure3
8393                                                            ,p_measure4 => l_measure4
8394                                                          );
8395 
8396         l_qtd_value(i):= l_measures_total/l_factor_by;
8397 
8398         -- Added for bug  4194804
8399         l_measure1       := l_pji_facts.ytd_initial_funding_amount;
8400         l_measure2       := l_pji_facts.ytd_additional_funding_amount;
8401         l_measure3       := l_pji_facts.ytd_funding_adjustment_amount;
8402         l_measure4       := l_pji_facts.ytd_cancelled_funding_amount;
8403         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8404                                                            ,p_measure2 => l_measure2
8405                                                            ,p_measure3 => l_measure3
8406                                                            ,p_measure4 => l_measure4
8407                                                          );
8408 
8409         l_ytd_value(i):= l_measures_total/l_factor_by;
8410 
8411         -- Added for bug  4194804
8412         l_measure1       := l_pji_facts.itd_initial_funding_amount;
8413         l_measure2       := l_pji_facts.itd_additional_funding_amount;
8414         l_measure3       := l_pji_facts.itd_funding_adjustment_amount;
8415         l_measure4       := l_pji_facts.itd_cancelled_funding_amount;
8416         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8417                                                            ,p_measure2 => l_measure2
8418                                                            ,p_measure3 => l_measure3
8419                                                            ,p_measure4 => l_measure4
8420                                                          );
8421 
8422         l_itd_value(i):= l_measures_total/l_factor_by;
8423 
8424         -- Added for bug  4194804
8425         l_measure1       := l_pji_facts.ac_initial_funding_amount;
8426         l_measure2       := l_pji_facts.ac_additional_funding_amount;
8427         l_measure3       := l_pji_facts.ac_funding_adjustment_amount;
8428         l_measure4       := l_pji_facts.ac_cancelled_funding_amount;
8429         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8430                                                            ,p_measure2 => l_measure2
8431                                                            ,p_measure3 => l_measure3
8432                                                            ,p_measure4 => l_measure4
8433                                                          );
8434 
8435         l_ac_value(i):= l_measures_total/l_factor_by;
8436 
8437         -- Added for bug  4194804
8438         l_measure1       := l_pji_facts.prp_initial_funding_amount;
8439         l_measure2       := l_pji_facts.prp_additional_funding_amount;
8440         l_measure3       := l_pji_facts.prp_funding_adjustment_amount;
8441         l_measure4       := l_pji_facts.prp_cancelled_funding_amount;
8442         l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8443                                                            ,p_measure2 => l_measure2
8444                                                            ,p_measure3 => l_measure3
8445                                                            ,p_measure4 => l_measure4
8446                                                          );
8447 
8448         l_prp_value(i):= l_measures_total/l_factor_by;
8449 
8450 
8451 /* Commented for bug 4194804
8452         l_ptd_value(i) := (l_pji_facts.ptd_initial_funding_amount + l_pji_facts.ptd_additional_funding_amount +
8453                  l_pji_facts.ptd_funding_adjustment_amount + l_pji_facts.ptd_cancelled_funding_amount)/ l_factor_by;
8454 
8455         l_qtd_value(i) := (l_pji_facts.qtd_initial_funding_amount + l_pji_facts.qtd_additional_funding_amount +
8456                  l_pji_facts.qtd_funding_adjustment_amount + l_pji_facts.qtd_cancelled_funding_amount)/ l_factor_by;
8457 
8458         l_ytd_value(i) := (l_pji_facts.ytd_initial_funding_amount + l_pji_facts.ytd_additional_funding_amount +
8459                 l_pji_facts.ytd_funding_adjustment_amount + l_pji_facts.ytd_cancelled_funding_amount)/ l_factor_by;
8460 
8461         l_itd_value(i) := (l_pji_facts.itd_initial_funding_amount + l_pji_facts.itd_additional_funding_amount +
8462                 l_pji_facts.itd_funding_adjustment_amount + l_pji_facts.itd_cancelled_funding_amount)/ l_factor_by;
8463 
8464         l_ac_value(i) := (l_pji_facts.ac_initial_funding_amount + l_pji_facts.ac_additional_funding_amount +
8465                 l_pji_facts.ac_funding_adjustment_amount + l_pji_facts.ac_cancelled_funding_amount)/ l_factor_by;
8466 
8467         l_prp_value(i) := (l_pji_facts.prp_initial_funding_amount + l_pji_facts.prp_additional_funding_amount +
8468                 l_pji_facts.prp_funding_adjustment_amount + l_pji_facts.prp_cancelled_funding_amount)/ l_factor_by;
8469 */
8470 
8471       ELSIF p_measure_set_code(i) = 'PPF_MSR_TRDO' THEN
8472         -- Total receivables Days Outstanding (from PJI_AC_PROJ_F)
8473         --      ((cash allocated + unbilled receivables) / ar_invoice_amount) * number of days in the period
8474         --
8475         x_measure_type(i) := g_DaysType;
8476 
8477 /*        IF l_pji_facts.ptd_ar_invoice_amount <> 0 THEN
8478             l_ptd_value(i):=((l_pji_facts.ptd_ar_cash_applied_amount + l_pji_facts.ptd_unbilled_receivables) / l_pji_facts.ptd_ar_invoice_amount) * xDaysInPeriod;
8479         ELSE
8480             l_ptd_value(i):= NULL;
8481         END IF;
8482 
8483         IF l_pji_facts.qtd_ar_invoice_amount <> 0 THEN
8484             l_qtd_value(i):=((l_pji_facts.qtd_ar_cash_applied_amount + l_pji_facts.qtd_unbilled_receivables) / l_pji_facts.qtd_ar_invoice_amount) * xDaysInPeriod;
8485         ELSE
8486             l_qtd_value(i):= NULL;
8487         END IF;
8488 
8489         IF l_pji_facts.ytd_ar_invoice_amount <> 0 THEN
8490             l_ytd_value(i):=((l_pji_facts.ytd_ar_cash_applied_amount + l_pji_facts.ytd_unbilled_receivables) / l_pji_facts.ytd_ar_invoice_amount) * xDaysInPeriod;
8491         ELSE
8492             l_ytd_value(i):= NULL;
8493         END IF;
8494 */
8495 
8496 
8497         IF l_pji_facts.itd_ar_invoice_amount <> 0 THEN
8498 /* Commented for bug 4194804
8499       l_itd_value(i):=((l_pji_facts.itd_ar_invoice_amount - l_pji_facts.itd_ar_cash_applied_amount + l_pji_facts.itd_unbilled_receivables) / l_pji_facts.itd_ar_invoice_amount) * xDaysSinceITD;  */
8500 
8501                      -- Added for bug  4194804
8502                     l_measure1       := l_pji_facts.itd_ar_amount_due;
8503 					l_measure2		 := l_pji_facts.itd_ar_amount_overdue;
8504                     l_measure2       := l_pji_facts.itd_unbilled_receivables;
8505                     l_measures_total :=  Pji_Rep_Util.Measures_Total(   p_measure1 => l_measure1
8506                                                                        ,p_measure2 => l_measure2
8507 																	   ,p_measure3 => l_measure3
8508                                                                      );
8509 
8510                     l_itd_value(i):= ( NVL(l_measures_total,0) /l_pji_facts.itd_ar_invoice_amount ) * xDaysSinceITD;
8511 
8512         ELSE
8513             l_itd_value(i):= NULL;
8514         END IF;
8515 /*
8516 		l_ac_value(i) := l_itd_value(i);
8517 
8518 
8519         IF l_pji_facts.ac_ar_invoice_amount <> 0 THEN
8520             l_ac_value(i):=((l_pji_facts.ac_ar_cash_applied_amount + l_pji_facts.ac_unbilled_receivables) / l_pji_facts.ac_ar_invoice_amount) * xDaysInPeriod;
8521         ELSE
8522             l_ac_value(i):= NULL;
8523         END IF;
8524 
8525         IF l_pji_facts.prp_ar_invoice_amount <> 0 THEN
8526             l_prp_value(i):=((l_pji_facts.prp_ar_cash_applied_amount + l_pji_facts.prp_unbilled_receivables) / l_pji_facts.prp_ar_invoice_amount) * xDaysInPeriod;
8527         ELSE
8528             l_prp_value(i):= NULL;
8529         END IF;
8530 */
8531 
8532 /* Unbilled Cost is scoped out
8533       ELSIF p_measure_set_code(i) = 'PPF_MSR_UBC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present  THEN
8534         -- unbilled cost
8535         x_measure_type(i) := g_CurrencyType;
8536 
8537         l_ptd_value(i):=NULL;
8538 
8539         l_qtd_value(i):=NULL;
8540 
8541         l_ytd_value(i):=NULL;
8542 
8543         l_itd_value(i):=l_overview_type(l_actual_index).itd_unbilled_cost / l_factor_by;
8544 
8545         l_ac_value(i):=l_overview_type(l_actual_index).ac_unbilled_cost / l_factor_by;
8546 
8547         l_prp_value(i):=NULL;
8548 */
8549       ELSIF p_measure_set_code(i) = 'PPF_MSR_UBR' THEN
8550         -- unbilled receivables (from PJI_AC_PROJ_F)
8551         x_measure_type(i) := g_CurrencyType;
8552 /* Starts added for bug 6961599 */
8553         l_ptd_value(i):=l_pji_facts.ptd_unbilled_receivables / l_factor_by;
8554 
8555         l_qtd_value(i):=l_pji_facts.qtd_unbilled_receivables / l_factor_by;
8556 
8557 	    l_ytd_value(i):=l_pji_facts.ytd_unbilled_receivables / l_factor_by;
8558 
8559 /* Ends added for bug 6961599 */
8560 
8561 /* Commented for bug 6961599
8562         l_ptd_value(i):=NULL;
8563 
8564         l_qtd_value(i):=NULL;
8565 
8566         l_ytd_value(i):=NULL;
8567 */
8568         l_itd_value(i):=l_pji_facts.itd_unbilled_receivables / l_factor_by;
8569 
8570         l_ac_value(i):=l_pji_facts.ac_unbilled_receivables / l_factor_by;
8571 
8572         l_prp_value(i):=NULL;
8573 
8574       ELSIF p_measure_set_code(i) = 'PPF_MSR_UER' THEN
8575         -- unearned_revenue (from PJI_AC_PROJ_F)
8576         x_measure_type(i) := g_CurrencyType;
8577 
8578 /* Starts added for bug 6961599 */
8579         l_ptd_value(i):=l_pji_facts.ptd_unearned_revenue / l_factor_by;
8580 
8581         l_qtd_value(i):=l_pji_facts.qtd_unearned_revenue / l_factor_by;
8582 
8583 	    l_ytd_value(i):=l_pji_facts.ytd_unearned_revenue / l_factor_by;
8584 
8585 /* Ends added for bug 6961599 */
8586 
8587 /* Commented for bug 6961599
8588         l_ptd_value(i):=NULL;
8589 
8590         l_qtd_value(i):=NULL;
8591 
8592         l_ytd_value(i):=NULL;
8593 */
8594 
8595         l_itd_value(i):=l_pji_facts.itd_unearned_revenue / l_factor_by;
8596 
8597         l_ac_value(i):=l_pji_facts.ac_unearned_revenue / l_factor_by;
8598 
8599         l_prp_value(i):=NULL;
8600 
8601 /* New measures added by Ning */
8602       ELSIF  p_measure_set_code(i) = 'PPF_MSR_CVP' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
8603         --
8604         -- Cost variance Percent=
8605         --      (Actual Burden Cost - Current Budget Cost)/Current Budget Cost)
8606         --
8607         x_measure_type(i) := g_PercentType;
8608 
8609         IF l_overview_type(l_cost_budget_index).ptd_burdened_cost <> 0 THEN
8610             l_ptd_value(i):= 100*(l_overview_type(l_actual_index).ptd_burdened_cost -
8611                                     l_overview_type(l_cost_budget_index).ptd_burdened_cost) /
8612                                     l_overview_type(l_cost_budget_index).ptd_burdened_cost;
8613         ELSE
8614             l_ptd_value(i):= NULL;
8615         END IF;
8616 
8617         IF l_overview_type(l_cost_budget_index).itd_burdened_cost <> 0 THEN
8618             l_itd_value(i):= 100*(l_overview_type(l_actual_index).itd_burdened_cost -
8619                                     l_overview_type(l_cost_budget_index).itd_burdened_cost) /
8620                                     l_overview_type(l_cost_budget_index).itd_burdened_cost;
8621         ELSE
8622             l_itd_value(i):= NULL;
8623         END IF;
8624 
8625         IF l_overview_type(l_cost_budget_index).qtd_burdened_cost <> 0 THEN
8626             l_qtd_value(i):= 100*(l_overview_type(l_actual_index).qtd_burdened_cost -
8627                                     l_overview_type(l_cost_budget_index).qtd_burdened_cost) /
8628                                     l_overview_type(l_cost_budget_index).qtd_burdened_cost;
8629         ELSE
8630             l_qtd_value(i):= NULL;
8631         END IF;
8632 
8633         IF l_overview_type(l_cost_budget_index).ytd_burdened_cost <> 0 THEN
8634             l_ytd_value(i):= 100*(l_overview_type(l_actual_index).ytd_burdened_cost -
8635                                     l_overview_type(l_cost_budget_index).ytd_burdened_cost) /
8636                                     l_overview_type(l_cost_budget_index).ytd_burdened_cost;
8637         ELSE
8638             l_ytd_value(i):= NULL;
8639         END IF;
8640 
8641         IF l_overview_type(l_cost_budget_index).ac_burdened_cost <> 0 THEN
8642             l_ac_value(i):= 100*(l_overview_type(l_actual_index).ac_burdened_cost -
8643                                     l_overview_type(l_cost_budget_index).ac_burdened_cost) /
8644                                     l_overview_type(l_cost_budget_index).ac_burdened_cost;
8645         ELSE
8646             l_ac_value(i):= NULL;
8647         END IF;
8648 
8649         IF l_overview_type(l_cost_budget_index).prp_burdened_cost <> 0 THEN
8650             l_prp_value(i):= 100*(l_overview_type(l_actual_index).prp_burdened_cost -
8651                                     l_overview_type(l_cost_budget_index).prp_burdened_cost) /
8652                                     l_overview_type(l_cost_budget_index).prp_burdened_cost;
8653         ELSE
8654             l_ac_value(i):= NULL;
8655         END IF;
8656 
8657 
8658       ELSIF p_measure_set_code(i) = 'PPF_MSR_MVP' AND bitand(l_check_plan_versions, g_Actual_CstRevBudget) = g_Actual_CstRevBudget THEN
8659         --
8660         -- margin variance % =
8661         --      (Actual Revenue - Actual Burdended Cost) - (Current Budget Revenue - Current Budget Burdended Cost)
8662 		-- / (Current Budget Revenue - Current Budget Burdended Cost) * 100
8663         --
8664         x_measure_type(i) := g_PercentType;
8665 
8666 	    IF (NVL(l_overview_type(l_cost_budget_index).ptd_burdened_cost,0) - NVL(l_overview_type(l_rev_budget_index).ptd_revenue,0) ) <>0 THEN
8667            l_ptd_value(i):= 100*((l_overview_type(l_actual_index).ptd_revenue
8668 						 - l_overview_type(l_actual_index).ptd_burdened_cost) -
8669 						 (l_overview_type(l_rev_budget_index).ptd_revenue-
8670                          l_overview_type(l_cost_budget_index).ptd_burdened_cost
8671                          )) /(l_overview_type(l_rev_budget_index).ptd_revenue-
8672                          l_overview_type(l_cost_budget_index).ptd_burdened_cost);
8673         ELSE
8674            l_ptd_value(i):=NULL;
8675         END IF;
8676 
8677 	    IF (NVL(l_overview_type(l_cost_budget_index).qtd_burdened_cost,0) - NVL(l_overview_type(l_rev_budget_index).qtd_revenue,0) ) <>0 THEN
8678            l_qtd_value(i):= 100*((l_overview_type(l_actual_index).qtd_revenue
8679 						 - l_overview_type(l_actual_index).qtd_burdened_cost) -
8680                          (l_overview_type(l_rev_budget_index).qtd_revenue -
8681 						 l_overview_type(l_cost_budget_index).qtd_burdened_cost
8682                          ))/ (l_overview_type(l_rev_budget_index).qtd_revenue -
8683 						 l_overview_type(l_cost_budget_index).qtd_burdened_cost);
8684         ELSE
8685            l_qtd_value(i):=NULL;
8686         END IF;
8687 
8688 	    IF ( NVL(l_overview_type(l_cost_budget_index).ytd_burdened_cost,0) - NVL(l_overview_type(l_rev_budget_index).ytd_revenue,0) ) <>0 THEN
8689            l_ytd_value(i):= 100*((l_overview_type(l_actual_index).ytd_revenue
8690 						 - l_overview_type(l_actual_index).ytd_burdened_cost) -
8691                          (l_overview_type(l_rev_budget_index).ytd_revenue-
8692 						 l_overview_type(l_cost_budget_index).ytd_burdened_cost
8693                          )) / (l_overview_type(l_rev_budget_index).ytd_revenue -
8694 						 l_overview_type(l_cost_budget_index).ytd_burdened_cost);
8695         ELSE
8696            l_ytd_value(i):=NULL;
8697         END IF;
8698 
8699 	    IF (NVL(l_overview_type(l_cost_budget_index).itd_burdened_cost,0) - NVL(l_overview_type(l_rev_budget_index).itd_revenue,0) ) <>0 THEN
8700            l_itd_value(i):= 100*((l_overview_type(l_actual_index).itd_revenue
8701 						 - l_overview_type(l_actual_index).itd_burdened_cost) -
8702                          (l_overview_type(l_rev_budget_index).itd_revenue -
8703 						 l_overview_type(l_cost_budget_index).itd_burdened_cost
8704                          )) / (l_overview_type(l_rev_budget_index).itd_revenue -
8705 						 l_overview_type(l_cost_budget_index).itd_burdened_cost);
8706         ELSE
8707            l_itd_value(i):=NULL;
8708         END IF;
8709 
8710 	    IF (NVL(l_overview_type(l_cost_budget_index).ac_burdened_cost,0) - NVL(l_overview_type(l_rev_budget_index).ac_revenue,0)) <>0 THEN
8711            l_ac_value(i):= 100*((l_overview_type(l_actual_index).ac_revenue
8712 						 - l_overview_type(l_actual_index).ac_burdened_cost) -
8713                          (l_overview_type(l_rev_budget_index).ac_revenue -
8714 						 l_overview_type(l_cost_budget_index).ac_burdened_cost
8715                          )) / (l_overview_type(l_rev_budget_index).ac_revenue
8716 						 - l_overview_type(l_cost_budget_index).ac_burdened_cost);
8717         ELSE
8718            l_ac_value(i):=NULL;
8719         END IF;
8720 
8721 	    IF (NVL(l_overview_type(l_cost_budget_index).prp_burdened_cost,0) - NVL(l_overview_type(l_rev_budget_index).prp_revenue,0)) <>0 THEN
8722            l_prp_value(i):= 100*((l_overview_type(l_actual_index).prp_revenue
8723 						 - l_overview_type(l_actual_index).prp_burdened_cost) -
8724                          (l_overview_type(l_cost_budget_index).prp_burdened_cost -
8725                          l_overview_type(l_rev_budget_index).prp_revenue
8726                          )) / (l_overview_type(l_rev_budget_index).prp_revenue -
8727 						 l_overview_type(l_cost_budget_index).prp_burdened_cost);
8728         ELSE
8729            l_prp_value(i):=NULL;
8730         END IF;
8731       ELSIF  p_measure_set_code(i) = 'PPF_MSR_RVP' AND bitand(l_check_plan_versions, g_Actual_RevBudget) = g_Actual_RevBudget THEN
8732         --
8733         -- Revenue variance Percent=
8734         --      (Actual Revenue - Current Budget Revenue)/Current Budget Revenue)
8735         --
8736         x_measure_type(i) := g_PercentType;
8737 
8738         IF l_overview_type(l_rev_budget_index).ptd_revenue <> 0 THEN
8739             l_ptd_value(i):= 100*(l_overview_type(l_actual_index).ptd_revenue -
8740                                     l_overview_type(l_rev_budget_index).ptd_revenue) /
8741                                     l_overview_type(l_rev_budget_index).ptd_revenue;
8742         ELSE
8743             l_ptd_value(i):= NULL;
8744         END IF;
8745 
8746         IF l_overview_type(l_rev_budget_index).qtd_revenue <> 0 THEN
8747             l_qtd_value(i):= 100*(l_overview_type(l_actual_index).qtd_revenue -
8748                                     l_overview_type(l_rev_budget_index).qtd_revenue) /
8749                                     l_overview_type(l_rev_budget_index).qtd_revenue;
8750         ELSE
8751             l_qtd_value(i):= NULL;
8752         END IF;
8753 
8754         IF l_overview_type(l_rev_budget_index).ytd_revenue <> 0 THEN
8755             l_ytd_value(i):= 100*(l_overview_type(l_actual_index).ytd_revenue -
8756                                     l_overview_type(l_rev_budget_index).ytd_revenue) /
8757                                     l_overview_type(l_rev_budget_index).ytd_revenue;
8758         ELSE
8759             l_ytd_value(i):= NULL;
8760         END IF;
8761 
8762         IF l_overview_type(l_rev_budget_index).itd_revenue <> 0 THEN
8763             l_itd_value(i):= 100*(l_overview_type(l_actual_index).itd_revenue -
8764                                     l_overview_type(l_rev_budget_index).itd_revenue) /
8765                                     l_overview_type(l_rev_budget_index).itd_revenue;
8766         ELSE
8767             l_itd_value(i):= NULL;
8768         END IF;
8769 
8770         IF l_overview_type(l_rev_budget_index).ac_revenue <> 0 THEN
8771             l_ac_value(i):= 100*(l_overview_type(l_actual_index).ac_revenue -
8772                                     l_overview_type(l_rev_budget_index).ac_revenue) /
8773                                     l_overview_type(l_rev_budget_index).ac_revenue;
8774         ELSE
8775             l_ac_value(i):= NULL;
8776         END IF;
8777 
8778         IF l_overview_type(l_rev_budget_index).prp_revenue <> 0 THEN
8779             l_prp_value(i):= 100*(l_overview_type(l_actual_index).prp_revenue -
8780                                     l_overview_type(l_rev_budget_index).prp_revenue) /
8781                                     l_overview_type(l_rev_budget_index).prp_revenue;
8782         ELSE
8783             l_prp_value(i):= NULL;
8784         END IF;
8785 
8786       ELSIF p_measure_set_code(i) = 'PPF_MSR_FMVP' AND bitand(l_check_plan_versions, g_CstRevBudgetFcst) = g_CstRevBudgetFcst THEN
8787         --
8788         -- Forecast margin variance % =
8789         --      (Forecast Revenue - Forecast Burdended Cost) - (Current Budget Revenue - Current Budget Burdended Cost)
8790 		-- / (Current Budget Revenue - Current Budget Burdended Cost) * 100
8791         --
8792         x_measure_type(i) := g_PercentType;
8793 
8794 	    IF (NVL(l_overview_type(l_cost_budget_index).ptd_burdened_cost,0) - NVL(l_overview_type(l_rev_budget_index).ptd_revenue,0)) <>0 THEN
8795            l_ptd_value(i):= 100*((l_overview_type(l_rev_forecast_index).ptd_revenue
8796 						 - l_overview_type(l_cost_forecast_index).ptd_burdened_cost) -
8797                          (l_overview_type(l_rev_budget_index).ptd_revenue -
8798 						 l_overview_type(l_cost_budget_index).ptd_burdened_cost
8799                          )) / (l_overview_type(l_rev_budget_index).ptd_revenue -
8800 						 l_overview_type(l_cost_budget_index).ptd_burdened_cost);
8801         ELSE
8802            l_ptd_value(i):=NULL;
8803         END IF;
8804 
8805 	    IF (NVL(l_overview_type(l_cost_budget_index).qtd_burdened_cost,0) - NVL(l_overview_type(l_rev_budget_index).qtd_revenue,0) ) <>0 THEN
8806            l_qtd_value(i):= 100*((l_overview_type(l_rev_forecast_index).qtd_revenue
8807 						 - l_overview_type(l_cost_forecast_index).qtd_burdened_cost) -
8808                          (l_overview_type(l_rev_budget_index).qtd_revenue -
8809 						 l_overview_type(l_cost_budget_index).qtd_burdened_cost
8810                          )) / (l_overview_type(l_rev_budget_index).qtd_revenue -
8811 						 l_overview_type(l_cost_budget_index).qtd_burdened_cost);
8812         ELSE
8813            l_qtd_value(i):=NULL;
8814         END IF;
8815 
8816 	    IF (NVL(l_overview_type(l_cost_budget_index).qtd_burdened_cost,0)  - NVL(l_overview_type(l_rev_budget_index).qtd_revenue,0) ) <>0 THEN
8817            l_qtd_value(i):= 100*((l_overview_type(l_rev_forecast_index).qtd_revenue
8818 						 - l_overview_type(l_cost_forecast_index).qtd_burdened_cost) -
8819                          (l_overview_type(l_rev_budget_index).qtd_revenue -
8820 						 l_overview_type(l_cost_budget_index).qtd_burdened_cost
8821                          )) / (l_overview_type(l_rev_budget_index).qtd_revenue -
8822 						 l_overview_type(l_cost_budget_index).qtd_burdened_cost);
8823         ELSE
8824            l_qtd_value(i):=NULL;
8825         END IF;
8826 
8827 	    IF (NVL(l_overview_type(l_cost_budget_index).ytd_burdened_cost,0)  - NVL(l_overview_type(l_rev_budget_index).ytd_revenue,0)) <>0 THEN
8828            l_ytd_value(i):= 100*((l_overview_type(l_rev_forecast_index).ytd_revenue
8829 						 - l_overview_type(l_cost_forecast_index).ytd_burdened_cost) -
8830                          (l_overview_type(l_rev_budget_index).ytd_revenue -
8831 						 l_overview_type(l_cost_budget_index).ytd_burdened_cost
8832                          )) / (l_overview_type(l_rev_budget_index).ytd_revenue -
8833 						 l_overview_type(l_cost_budget_index).ytd_burdened_cost);
8834         ELSE
8835            l_ytd_value(i):=NULL;
8836         END IF;
8837 
8838 	    IF (NVL(l_overview_type(l_cost_budget_index).itd_burdened_cost,0) - NVL(l_overview_type(l_rev_budget_index).itd_revenue,0)) <>0 THEN
8839            l_itd_value(i):= 100*((l_overview_type(l_rev_forecast_index).itd_revenue
8840 						 - l_overview_type(l_cost_forecast_index).itd_burdened_cost) -
8841                          (l_overview_type(l_rev_budget_index).itd_revenue -
8842 						 l_overview_type(l_cost_budget_index).itd_burdened_cost
8843                          )) / (l_overview_type(l_rev_budget_index).itd_revenue -
8844 						 l_overview_type(l_cost_budget_index).itd_burdened_cost);
8845         ELSE
8846            l_itd_value(i):=NULL;
8847         END IF;
8848 
8849 	    IF (NVL(l_overview_type(l_cost_budget_index).ac_burdened_cost,0) - NVL(l_overview_type(l_rev_budget_index).ac_revenue,0)) <>0 THEN
8850            l_ac_value(i):= 100*((l_overview_type(l_rev_forecast_index).ac_revenue
8851 						 - l_overview_type(l_cost_forecast_index).ac_burdened_cost) -
8852                          (l_overview_type(l_rev_budget_index).ac_revenue -
8853 						 l_overview_type(l_cost_budget_index).ac_burdened_cost
8854                          )) / (l_overview_type(l_rev_budget_index).ac_revenue -
8855 						 l_overview_type(l_cost_budget_index).ac_burdened_cost);
8856         ELSE
8857            l_ac_value(i):=NULL;
8858         END IF;
8859 
8860 	    IF (NVL(l_overview_type(l_cost_budget_index).prp_burdened_cost,0) - NVL(l_overview_type(l_rev_budget_index).prp_revenue,0)) <>0 THEN
8861            l_prp_value(i):= 100*((l_overview_type(l_rev_forecast_index).prp_revenue
8862 						 - l_overview_type(l_cost_forecast_index).prp_burdened_cost) -
8863                          (l_overview_type(l_rev_budget_index).prp_revenue -
8864 						 l_overview_type(l_cost_budget_index).prp_burdened_cost
8865                          )) / (l_overview_type(l_rev_budget_index).prp_revenue -
8866 						 l_overview_type(l_cost_budget_index).prp_burdened_cost);
8867         ELSE
8868            l_prp_value(i):=NULL;
8869         END IF;
8870 
8871 
8872       ELSIF  p_measure_set_code(i) = 'PPF_MSR_FRVP' AND bitand(l_check_plan_versions, g_RevBudget_RevFcst ) = g_RevBudget_RevFcst  THEN
8873         --
8874         -- Forecast Revenue variance Percent=
8875         --      (Forecast Revenue - Current Budget Revenue)/Current Budget Revenue)
8876         --
8877         x_measure_type(i) := g_PercentType;
8878 
8879         IF l_overview_type(l_rev_budget_index).ptd_revenue <> 0 THEN
8880             l_ptd_value(i):= 100*(l_overview_type(l_rev_forecast_index).ptd_revenue -
8881                                     l_overview_type(l_rev_budget_index).ptd_revenue) /
8882                                     l_overview_type(l_rev_budget_index).ptd_revenue;
8883         ELSE
8884             l_ptd_value(i):= NULL;
8885         END IF;
8886 
8887         IF l_overview_type(l_rev_budget_index).qtd_revenue <> 0 THEN
8888             l_qtd_value(i):= 100*(l_overview_type(l_rev_forecast_index).qtd_revenue -
8889                                     l_overview_type(l_rev_budget_index).qtd_revenue) /
8890                                     l_overview_type(l_rev_budget_index).qtd_revenue;
8891         ELSE
8892             l_qtd_value(i):= NULL;
8893         END IF;
8894 
8895         IF l_overview_type(l_rev_budget_index).ytd_revenue <> 0 THEN
8896             l_ytd_value(i):= 100*(l_overview_type(l_rev_forecast_index).ytd_revenue -
8897                                     l_overview_type(l_rev_budget_index).ytd_revenue) /
8898                                     l_overview_type(l_rev_budget_index).ytd_revenue;
8899         ELSE
8900             l_ytd_value(i):= NULL;
8901         END IF;
8902 
8903         IF l_overview_type(l_rev_budget_index).itd_revenue <> 0 THEN
8904             l_itd_value(i):= 100*(l_overview_type(l_rev_forecast_index).itd_revenue -
8905                                     l_overview_type(l_rev_budget_index).itd_revenue) /
8906                                     l_overview_type(l_rev_budget_index).itd_revenue;
8907         ELSE
8908             l_itd_value(i):= NULL;
8909         END IF;
8910 
8911         IF l_overview_type(l_rev_budget_index).ac_revenue <> 0 THEN
8912             l_ac_value(i):= 100*(l_overview_type(l_rev_forecast_index).ac_revenue -
8913                                     l_overview_type(l_rev_budget_index).ac_revenue) /
8914                                     l_overview_type(l_rev_budget_index).ac_revenue;
8915         ELSE
8916             l_ac_value(i):= NULL;
8917         END IF;
8918 
8919         IF l_overview_type(l_rev_budget_index).prp_revenue <> 0 THEN
8920             l_prp_value(i):= 100*(l_overview_type(l_rev_forecast_index).prp_revenue -
8921                                     l_overview_type(l_rev_budget_index).prp_revenue) /
8922                                     l_overview_type(l_rev_budget_index).prp_revenue;
8923         ELSE
8924             l_prp_value(i):= NULL;
8925         END IF;
8926 
8927 
8928 
8929       ELSIF  p_measure_set_code(i) = 'PPF_MSR_CBCVPOB' AND bitand(l_check_plan_versions, g_CstOrigCstBudget ) = g_CstOrigCstBudget  THEN
8930         --
8931         -- Current Budget Cost variance Percent from Original Budget:
8932         --      (Current Budget Cost - Original Budget Cost)/Original Budget Cost)
8933         --
8934         x_measure_type(i) := g_PercentType;
8935 
8936         IF l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost <> 0 THEN
8937             l_ptd_value(i):= 100*(l_overview_type(l_cost_budget_index).ptd_burdened_cost -
8938                                     l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost) /
8939                                     l_overview_type(l_orig_cost_budget_index).ptd_burdened_cost;
8940 
8941         ELSE
8942             l_ptd_value(i):= NULL;
8943         END IF;
8944 
8945         IF l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost <> 0 THEN
8946             l_qtd_value(i):= 100*(l_overview_type(l_cost_budget_index).qtd_burdened_cost -
8947                                     l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost) /
8948                                     l_overview_type(l_orig_cost_budget_index).qtd_burdened_cost;
8949 
8950         ELSE
8951             l_qtd_value(i):= NULL;
8952         END IF;
8953 
8954         IF l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost <> 0 THEN
8955             l_ytd_value(i):= 100*(l_overview_type(l_cost_budget_index).ytd_burdened_cost -
8956                                     l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost) /
8957                                     l_overview_type(l_orig_cost_budget_index).ytd_burdened_cost;
8958 
8959         ELSE
8960             l_ytd_value(i):= NULL;
8961         END IF;
8962 
8963         IF l_overview_type(l_orig_cost_budget_index).itd_burdened_cost <> 0 THEN
8964             l_itd_value(i):= 100*(l_overview_type(l_cost_budget_index).itd_burdened_cost -
8965                                     l_overview_type(l_orig_cost_budget_index).itd_burdened_cost) /
8966                                     l_overview_type(l_orig_cost_budget_index).itd_burdened_cost;
8967 
8968         ELSE
8969             l_itd_value(i):= NULL;
8970         END IF;
8971 
8972         IF l_overview_type(l_orig_cost_budget_index).ac_burdened_cost <> 0 THEN
8973             l_ac_value(i):= 100*(l_overview_type(l_cost_budget_index).ac_burdened_cost -
8974                                     l_overview_type(l_orig_cost_budget_index).ac_burdened_cost) /
8975                                     l_overview_type(l_orig_cost_budget_index).ac_burdened_cost;
8976 
8977         ELSE
8978             l_ac_value(i):= NULL;
8979         END IF;
8980 
8981         IF l_overview_type(l_orig_cost_budget_index).prp_burdened_cost <> 0 THEN
8982             l_prp_value(i):= 100*(l_overview_type(l_cost_budget_index).prp_burdened_cost -
8983                                     l_overview_type(l_orig_cost_budget_index).prp_burdened_cost) /
8984                                     l_overview_type(l_orig_cost_budget_index).prp_burdened_cost;
8985 
8986         ELSE
8987             l_prp_value(i):= NULL;
8988         END IF;
8989 
8990       ELSIF  p_measure_set_code(i) = 'PPF_MSR_CBRVPOB' AND bitand(l_check_plan_versions, g_RevBudgetOrigbudget ) = g_RevBudgetOrigbudget THEN
8991         --
8992         -- Current budget Revenue variance Percent From Original Budget
8993         --      (Current Budget Revenue - Original Budget Revenue)/Original Budget Revenue)
8994         --
8995         x_measure_type(i) := g_PercentType;
8996 
8997         IF l_overview_type(l_orig_rev_budget_index).ptd_revenue <> 0 THEN
8998             l_ptd_value(i):= 100*(l_overview_type(l_rev_budget_index).ptd_revenue -
8999                                     l_overview_type(l_orig_rev_budget_index).ptd_revenue) /
9000                                     l_overview_type(l_orig_rev_budget_index).ptd_revenue;
9001 
9002         ELSE
9003             l_ptd_value(i):= NULL;
9004         END IF;
9005 
9006         IF l_overview_type(l_orig_rev_budget_index).qtd_revenue <> 0 THEN
9007             l_qtd_value(i):= 100*(l_overview_type(l_rev_budget_index).qtd_revenue -
9008                                     l_overview_type(l_orig_rev_budget_index).qtd_revenue) /
9009                                     l_overview_type(l_orig_rev_budget_index).qtd_revenue;
9010 
9011         ELSE
9012             l_qtd_value(i):= NULL;
9013         END IF;
9014 
9015         IF l_overview_type(l_orig_rev_budget_index).ytd_revenue <> 0 THEN
9016             l_ytd_value(i):= 100*(l_overview_type(l_rev_budget_index).ytd_revenue -
9017                                     l_overview_type(l_orig_rev_budget_index).ytd_revenue) /
9018                                     l_overview_type(l_orig_rev_budget_index).ytd_revenue;
9019 
9020         ELSE
9021             l_ytd_value(i):= NULL;
9022         END IF;
9023 
9024         IF l_overview_type(l_orig_rev_budget_index).itd_revenue <> 0 THEN
9025             l_itd_value(i):= 100*(l_overview_type(l_rev_budget_index).itd_revenue -
9026                                     l_overview_type(l_orig_rev_budget_index).itd_revenue) /
9027                                     l_overview_type(l_orig_rev_budget_index).itd_revenue;
9028 
9029         ELSE
9030             l_itd_value(i):= NULL;
9031         END IF;
9032 
9033         IF l_overview_type(l_orig_rev_budget_index).ac_revenue <> 0 THEN
9034             l_ac_value(i):= 100*(l_overview_type(l_rev_budget_index).ac_revenue -
9035                                     l_overview_type(l_orig_rev_budget_index).ac_revenue) /
9036                                     l_overview_type(l_orig_rev_budget_index).ac_revenue;
9037 
9038         ELSE
9039             l_ac_value(i):= NULL;
9040         END IF;
9041 
9042         IF l_overview_type(l_orig_rev_budget_index).prp_revenue <> 0 THEN
9043             l_prp_value(i):= 100*(l_overview_type(l_rev_budget_index).prp_revenue -
9044                                     l_overview_type(l_orig_rev_budget_index).prp_revenue) /
9045                                     l_overview_type(l_orig_rev_budget_index).prp_revenue;
9046 
9047         ELSE
9048             l_prp_value(i):= NULL;
9049         END IF;
9050 
9051       ELSIF p_measure_set_code(i) = 'PPF_MSR_ERC' AND bitand(l_check_plan_versions, g_Actual_CstFcst) = g_Actual_CstFcst THEN
9052         --
9053         -- E.T.C. Raw Cost=
9054         --      forecast raw cost - actual raw cost
9055         --
9056         x_measure_type(i) := g_CurrencyType;
9057 
9058 /*        l_ptd_value(i):= NULL;--(l_overview_type(l_cost_forecast_index).ptd_raw_cost - l_overview_type(l_actual_index).ptd_raw_cost) / l_factor_by;
9059 
9060         l_qtd_value(i):= NULL; --(l_overview_type(l_cost_forecast_index).qtd_raw_cost - l_overview_type(l_actual_index).qtd_raw_cost) / l_factor_by;
9061 
9062         l_ytd_value(i):= NULL; --(l_overview_type(l_cost_forecast_index).ytd_raw_cost - l_overview_type(l_actual_index).ytd_raw_cost) / l_factor_by;
9063 */
9064         l_itd_value(i):=(l_overview_type(l_cost_forecast_index).ac_raw_cost - NVL(l_overview_type(l_actual_index).itd_raw_cost,0)) / l_factor_by;
9065 
9066 		IF l_itd_value(i) < 0 THEN
9067 		   l_itd_value(i) := 0;
9068 		END IF;
9069 
9070 
9071 /*        l_ac_value(i):=(l_overview_type(l_cost_forecast_index).ac_raw_cost - l_overview_type(l_actual_index).ac_raw_cost) / l_factor_by;
9072 
9073         l_prp_value(i):= NULL; --(l_overview_type(l_cost_forecast_index).prp_raw_cost - l_overview_type(l_actual_index).prp_raw_cost) / l_factor_by;
9074 */
9075       ELSIF p_measure_set_code(i) = 'PPF_MSR_ER' AND bitand(l_check_plan_versions, g_Actual_RevFcst) = g_Actual_RevFcst THEN
9076         --
9077         -- E.T.C. Revenue=
9078         --      forecast revenue - actual revenue
9079         --
9080         x_measure_type(i) := g_CurrencyType;
9081 
9082 /*        l_ptd_value(i):= NULL; --(l_overview_type(l_rev_forecast_index).ptd_revenue - l_overview_type(l_actual_index).ptd_revenue) / l_factor_by;
9083 
9084         l_qtd_value(i):= NULL; --(l_overview_type(l_rev_forecast_index).qtd_revenue - l_overview_type(l_actual_index).qtd_revenue) / l_factor_by;
9085 
9086         l_ytd_value(i):= NULL; --(l_overview_type(l_rev_forecast_index).ytd_revenue - l_overview_type(l_actual_index).ytd_revenue) / l_factor_by;
9087 */
9088         l_itd_value(i):=(l_overview_type(l_rev_forecast_index).ac_revenue - NVL(l_overview_type(l_actual_index).itd_revenue,0)) / l_factor_by;
9089 
9090 		IF l_itd_value(i) < 0 THEN
9091 		   l_itd_value(i) := 0;
9092 		END IF;
9093 
9094 /*
9095         l_ac_value(i):=(l_overview_type(l_rev_forecast_index).ac_revenue - l_overview_type(l_actual_index).ac_revenue) / l_factor_by;
9096 
9097         l_prp_value(i):= NULL; --(l_overview_type(l_rev_forecast_index).prp_revenue - l_overview_type(l_actual_index).prp_revenue) / l_factor_by;
9098 */
9099       ELSIF p_measure_set_code(i) = 'PPF_MSR_OBOC' AND bitand(l_check_plan_versions, g_OrigCstBudget_is_present) = g_OrigCstBudget_is_present THEN
9100         -- Original Budget Raw Cost
9101         x_measure_type(i) := g_CurrencyType;
9102 
9103         l_ptd_value(i):=l_overview_type(l_orig_cost_budget_index).ptd_raw_cost / l_factor_by;
9104 
9105         l_qtd_value(i):=l_overview_type(l_orig_cost_budget_index).qtd_raw_cost / l_factor_by;
9106 
9107         l_ytd_value(i):=l_overview_type(l_orig_cost_budget_index).ytd_raw_cost / l_factor_by;
9108 
9109         l_itd_value(i):=l_overview_type(l_orig_cost_budget_index).itd_raw_cost / l_factor_by;
9110 
9111         l_ac_value(i):=l_overview_type(l_orig_cost_budget_index).ac_raw_cost / l_factor_by;
9112 
9113         l_prp_value(i):=l_overview_type(l_orig_cost_budget_index).prp_raw_cost / l_factor_by;
9114 
9115       ELSIF  p_measure_set_code(i) = 'PPF_MSR_PEVP' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
9116         --
9117         --  People Effort variance Percent=
9118         --      (Actual People Effort - Current Budget People Effort)/Current Budget People Effort)
9119         --
9120         x_measure_type(i) := g_PercentType;
9121 
9122         IF l_overview_type(l_cost_budget_index).ptd_labor_hrs <> 0 THEN
9123             l_ptd_value(i):= 100*(l_overview_type(l_actual_index).ptd_labor_hrs -
9124                                     l_overview_type(l_cost_budget_index).ptd_labor_hrs) /
9125                                     l_overview_type(l_cost_budget_index).ptd_labor_hrs;
9126 
9127         ELSE
9128             l_ptd_value(i):= NULL;
9129         END IF;
9130 
9131 
9132         IF l_overview_type(l_cost_budget_index).qtd_labor_hrs <> 0 THEN
9133             l_qtd_value(i):= 100*(l_overview_type(l_actual_index).qtd_labor_hrs -
9134                                     l_overview_type(l_cost_budget_index).qtd_labor_hrs) /
9135                                     l_overview_type(l_cost_budget_index).qtd_labor_hrs;
9136 
9137         ELSE
9138             l_qtd_value(i):= NULL;
9139         END IF;
9140 
9141         IF l_overview_type(l_cost_budget_index).ytd_labor_hrs <> 0 THEN
9142             l_ytd_value(i):= 100*(l_overview_type(l_actual_index).ytd_labor_hrs -
9143                                     l_overview_type(l_cost_budget_index).ytd_labor_hrs) /
9144                                     l_overview_type(l_cost_budget_index).ytd_labor_hrs;
9145 
9146         ELSE
9147             l_ytd_value(i):= NULL;
9148         END IF;
9149 
9150         IF l_overview_type(l_cost_budget_index).itd_labor_hrs <> 0 THEN
9151             l_itd_value(i):= 100*(l_overview_type(l_actual_index).itd_labor_hrs -
9152                                     l_overview_type(l_cost_budget_index).itd_labor_hrs) /
9153                                     l_overview_type(l_cost_budget_index).itd_labor_hrs;
9154 
9155         ELSE
9156             l_itd_value(i):= NULL;
9157         END IF;
9158 
9159         IF l_overview_type(l_cost_budget_index).ac_labor_hrs <> 0 THEN
9160             l_ac_value(i):= 100*(l_overview_type(l_actual_index).ac_labor_hrs -
9161                                     l_overview_type(l_cost_budget_index).ac_labor_hrs) /
9162                                     l_overview_type(l_cost_budget_index).ac_labor_hrs;
9163 
9164         ELSE
9165             l_ac_value(i):= NULL;
9166         END IF;
9167 
9168         IF l_overview_type(l_cost_budget_index).prp_labor_hrs <> 0 THEN
9169             l_prp_value(i):= 100*(l_overview_type(l_actual_index).prp_labor_hrs -
9170                                     l_overview_type(l_cost_budget_index).prp_labor_hrs) /
9171                                     l_overview_type(l_cost_budget_index).prp_labor_hrs;
9172 
9173         ELSE
9174             l_prp_value(i):= NULL;
9175         END IF;
9176 
9177 
9178       ELSIF  p_measure_set_code(i) = 'PPF_MSR_EEVP' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
9179         --
9180         --  Equipment Effort variance Percent=
9181         --      (Actual Equipment Effort - Current Budget Equipment Effort)/Current Budget Equipment Effort)
9182         --
9183         x_measure_type(i) := g_PercentType;
9184 
9185         IF l_overview_type(l_cost_budget_index).ptd_equipment_hrs <> 0 THEN
9186             l_ptd_value(i):= 100*(l_overview_type(l_actual_index).ptd_equipment_hrs -
9187                                     l_overview_type(l_cost_budget_index).ptd_equipment_hrs) /
9188                                     l_overview_type(l_cost_budget_index).ptd_equipment_hrs;
9189 
9190         ELSE
9191             l_ptd_value(i):= NULL;
9192         END IF;
9193 
9194         IF l_overview_type(l_cost_budget_index).qtd_equipment_hrs <> 0 THEN
9195             l_qtd_value(i):= 100*(l_overview_type(l_actual_index).qtd_equipment_hrs -
9196                                     l_overview_type(l_cost_budget_index).qtd_equipment_hrs) /
9197                                     l_overview_type(l_cost_budget_index).qtd_equipment_hrs;
9198 
9199         ELSE
9200             l_qtd_value(i):= NULL;
9201         END IF;
9202 
9203         IF l_overview_type(l_cost_budget_index).ytd_equipment_hrs <> 0 THEN
9204             l_ytd_value(i):= 100*(l_overview_type(l_actual_index).ytd_equipment_hrs -
9205                                     l_overview_type(l_cost_budget_index).ytd_equipment_hrs) /
9206                                     l_overview_type(l_cost_budget_index).ytd_equipment_hrs;
9207 
9208         ELSE
9209             l_ytd_value(i):= NULL;
9210         END IF;
9211 
9212         IF l_overview_type(l_cost_budget_index).itd_equipment_hrs <> 0 THEN
9213             l_itd_value(i):= 100*(l_overview_type(l_actual_index).itd_equipment_hrs -
9214                                     l_overview_type(l_cost_budget_index).itd_equipment_hrs) /
9215                                     l_overview_type(l_cost_budget_index).itd_equipment_hrs;
9216 
9217         ELSE
9218             l_itd_value(i):= NULL;
9219         END IF;
9220 
9221         IF l_overview_type(l_cost_budget_index).ac_equipment_hrs <> 0 THEN
9222             l_ac_value(i):= 100*(l_overview_type(l_actual_index).ac_equipment_hrs -
9223                                     l_overview_type(l_cost_budget_index).ac_equipment_hrs) /
9224                                     l_overview_type(l_cost_budget_index).ac_equipment_hrs;
9225 
9226         ELSE
9227             l_ac_value(i):= NULL;
9228         END IF;
9229 
9230         IF l_overview_type(l_cost_budget_index).prp_equipment_hrs <> 0 THEN
9231             l_prp_value(i):= 100*(l_overview_type(l_actual_index).prp_equipment_hrs -
9232                                     l_overview_type(l_cost_budget_index).prp_equipment_hrs) /
9233                                     l_overview_type(l_cost_budget_index).prp_equipment_hrs;
9234 
9235         ELSE
9236             l_prp_value(i):= NULL;
9237         END IF;
9238 
9239       ELSIF p_measure_set_code(i) = 'PPF_MSR_EBC' AND bitand(l_check_plan_versions, g_Actual_is_present  ) = g_Actual_is_present   THEN
9240         --
9241         -- E.T.C. Raw Cost=
9242         --      forecast raw cost - actual raw cost
9243         --
9244         x_measure_type(i) := g_CurrencyType;
9245 
9246         l_ptd_value(i):=l_overview_type(l_actual_index).ptd_equipment_brdn_cost / l_factor_by;
9247 
9248         l_qtd_value(i):=l_overview_type(l_actual_index).qtd_equipment_brdn_cost / l_factor_by;
9249 
9250         l_ytd_value(i):=l_overview_type(l_actual_index).ytd_equipment_brdn_cost / l_factor_by;
9251 
9252         l_itd_value(i):=l_overview_type(l_actual_index).itd_equipment_brdn_cost / l_factor_by;
9253 
9254         l_ac_value(i):=l_overview_type(l_actual_index).ac_equipment_brdn_cost / l_factor_by;
9255 
9256         l_prp_value(i):=l_overview_type(l_actual_index).prp_equipment_brdn_cost / l_factor_by;
9257 		/* Modified the following measure set code from PPF_MSR_CFEVPF to PPF_MSR_CFEFPF for bug 6961599 */
9258       ELSIF p_measure_set_code(i) = 'PPF_MSR_CFEFPF' AND bitand(l_check_plan_versions, g_Cst_FcstPriorfcst   ) = g_Cst_FcstPriorfcst    THEN
9259         --
9260         -- Current Forecast Effort Variance from Prior Forecast
9261         --      Current Forecast Effort - Prior Forecast
9262         --
9263         x_measure_type(i) := g_HoursType;
9264 
9265         l_ptd_value(i):=((l_overview_type(l_cost_forecast_index).ptd_labor_hrs+l_overview_type(l_cost_forecast_index).ptd_equipment_hrs)
9266 								-(l_overview_type(l_prior_cost_forecast_index).ptd_labor_hrs+l_overview_type(l_prior_cost_forecast_index).ptd_equipment_hrs)) / l_effort_UOM;
9267 
9268         l_qtd_value(i):=((l_overview_type(l_cost_forecast_index).qtd_labor_hrs+l_overview_type(l_cost_forecast_index).qtd_equipment_hrs)
9269 								-(l_overview_type(l_prior_cost_forecast_index).qtd_labor_hrs+l_overview_type(l_prior_cost_forecast_index).qtd_equipment_hrs)) / l_effort_UOM;
9270 
9271         l_ytd_value(i):=((l_overview_type(l_cost_forecast_index).ytd_labor_hrs+l_overview_type(l_cost_forecast_index).ytd_equipment_hrs)
9272 								-(l_overview_type(l_prior_cost_forecast_index).ytd_labor_hrs+l_overview_type(l_prior_cost_forecast_index).ytd_equipment_hrs)) / l_effort_UOM;
9273 
9274         l_itd_value(i):=((l_overview_type(l_cost_forecast_index).itd_labor_hrs+l_overview_type(l_cost_forecast_index).itd_equipment_hrs)
9275 								-(l_overview_type(l_prior_cost_forecast_index).itd_labor_hrs+l_overview_type(l_prior_cost_forecast_index).itd_equipment_hrs)) / l_effort_UOM;
9276 
9277         l_ac_value(i):=((l_overview_type(l_cost_forecast_index).ac_labor_hrs+l_overview_type(l_cost_forecast_index).ac_equipment_hrs)
9278 								-(l_overview_type(l_prior_cost_forecast_index).ac_labor_hrs+l_overview_type(l_prior_cost_forecast_index).ac_equipment_hrs)) / l_effort_UOM;
9279 
9280         l_prp_value(i):=((l_overview_type(l_cost_forecast_index).prp_labor_hrs+l_overview_type(l_cost_forecast_index).prp_equipment_hrs)
9281 								-(l_overview_type(l_prior_cost_forecast_index).prp_labor_hrs+l_overview_type(l_prior_cost_forecast_index).prp_equipment_hrs)) / l_effort_UOM;
9282 
9283 
9284       ELSIF p_measure_set_code(i) = 'PPF_MSR_NID' THEN
9285         --
9286 		-- Next invoice date
9287         --
9288         x_measure_type(i) := g_OtherType;
9289 
9290 		IF (l_contract_proj_mask = 1) AND (pPrgRollup = 'N') THEN
9291 
9292 	/*        l_ptd_value(i):= l_next_invoice_date;
9293 
9294 	        l_qtd_value(i):= l_next_invoice_date;
9295 
9296 	        l_ytd_value(i):= l_next_invoice_date;
9297 	*/
9298 	        l_itd_value(i):= l_next_invoice_date;
9299 
9300 	        l_ac_value(i):= l_next_invoice_date;
9301 
9302 	--        l_prp_value(i):= l_next_invoice_date;
9303 	    END IF;
9304 
9305       ELSIF p_measure_set_code(i) = 'PPF_MSR_BEHP' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
9306         -- billable equipment hours % = billable equipment hours / total equipment hrs
9307         x_measure_type(i) := g_PercentType;
9308 
9309         IF l_overview_type(l_actual_index).ptd_equipment_hrs <> 0 THEN
9310           l_ptd_value(i):=100 * l_overview_type(l_actual_index).ptd_bill_equipment_hrs /
9311                           l_overview_type(l_actual_index).ptd_equipment_hrs;
9312         END IF;
9313 
9314         IF l_overview_type(l_actual_index).qtd_equipment_hrs <> 0 THEN
9315           l_qtd_value(i):=100 * l_overview_type(l_actual_index).qtd_bill_equipment_hrs /
9316                           l_overview_type(l_actual_index).qtd_equipment_hrs;
9317         END IF;
9318 
9319         IF l_overview_type(l_actual_index).ytd_equipment_hrs <> 0 THEN
9320           l_ytd_value(i):=100 * l_overview_type(l_actual_index).ytd_bill_equipment_hrs /
9321                           l_overview_type(l_actual_index).ytd_equipment_hrs;
9322         END IF;
9323 
9324         IF l_overview_type(l_actual_index).itd_equipment_hrs <> 0 THEN
9325           l_itd_value(i):=100 * l_overview_type(l_actual_index).itd_bill_equipment_hrs /
9326                           l_overview_type(l_actual_index).itd_equipment_hrs;
9327         END IF;
9328 
9329         IF l_overview_type(l_actual_index).ac_equipment_hrs <> 0 THEN
9330           l_ac_value(i):=100 * l_overview_type(l_actual_index).ac_bill_equipment_hrs /
9331                           l_overview_type(l_actual_index).ac_equipment_hrs;
9332         END IF;
9333 
9334         IF l_overview_type(l_actual_index).prp_equipment_hrs <> 0 THEN
9335           l_prp_value(i):=100 * l_overview_type(l_actual_index).prp_bill_equipment_hrs /
9336                           l_overview_type(l_actual_index).prp_equipment_hrs;
9337         END IF;
9338 
9339       ELSIF p_measure_set_code(i) = 'PPF_MSR_NBCPOTC' AND bitand(l_check_plan_versions, g_Actual_is_present) = g_Actual_is_present THEN
9340         -- Nonbillable Cost % of total cost= Nonbillable Cost / Total Cost
9341         x_measure_type(i) := g_PercentType;
9342 
9343 		IF l_contract_proj_mask = 1 THEN
9344 	        IF l_overview_type(l_actual_index).ptd_burdened_cost <> 0 THEN
9345 	          l_ptd_value(i):=100 * (l_overview_type(l_actual_index).ptd_burdened_cost - l_overview_type(l_actual_index).ptd_bill_burdened_cost -
9346 	                          NVL(l_overview_type(l_actual_index).ptd_capitalizable_brdn_cost,0)) /
9347 	                          l_overview_type(l_actual_index).ptd_burdened_cost;
9348 
9349 
9350 	          l_ptd_value(i):=TO_NUMBER(l_ptd_value(i));
9351 	        END IF;
9352 
9353 	        IF l_overview_type(l_actual_index).qtd_burdened_cost <> 0 THEN
9354 	          l_qtd_value(i):=100 * (l_overview_type(l_actual_index).qtd_burdened_cost - l_overview_type(l_actual_index).qtd_bill_burdened_cost -
9355 	                          NVL(l_overview_type(l_actual_index).qtd_capitalizable_brdn_cost,0)) /
9356 	                          l_overview_type(l_actual_index).qtd_burdened_cost;
9357 	        END IF;
9358 
9359 	        IF l_overview_type(l_actual_index).ytd_burdened_cost <> 0 THEN
9360 	          l_ytd_value(i):=100 * (l_overview_type(l_actual_index).ytd_burdened_cost - l_overview_type(l_actual_index).ytd_bill_burdened_cost -
9361 	                          NVL(l_overview_type(l_actual_index).ytd_capitalizable_brdn_cost,0)) /
9362 	                          l_overview_type(l_actual_index).ytd_burdened_cost;
9363 	        END IF;
9364 
9365 	        IF l_overview_type(l_actual_index).itd_burdened_cost <> 0 THEN
9366 	          l_itd_value(i):=100 * (l_overview_type(l_actual_index).itd_burdened_cost - l_overview_type(l_actual_index).itd_bill_burdened_cost -
9367 	                          NVL(l_overview_type(l_actual_index).itd_capitalizable_brdn_cost,0)) /
9368 	                          l_overview_type(l_actual_index).itd_burdened_cost;
9369 	        END IF;
9370 
9371 	        IF l_overview_type(l_actual_index).ac_burdened_cost <> 0 THEN
9372 	          l_ac_value(i):=100 * (l_overview_type(l_actual_index).ac_burdened_cost - l_overview_type(l_actual_index).ac_bill_burdened_cost -
9373 	                          NVL(l_overview_type(l_actual_index).ac_capitalizable_brdn_cost,0)) /
9374 	                          l_overview_type(l_actual_index).ac_burdened_cost;
9375 	        END IF;
9376 
9377 	        IF l_overview_type(l_actual_index).prp_burdened_cost <> 0 THEN
9378 	          l_prp_value(i):=100 * (l_overview_type(l_actual_index).prp_burdened_cost - l_overview_type(l_actual_index).prp_bill_burdened_cost -
9379 	                          NVL(l_overview_type(l_actual_index).prp_capitalizable_brdn_cost,0)) /
9380 	                          l_overview_type(l_actual_index).prp_burdened_cost;
9381 	        END IF;
9382 		END IF;
9383 
9384       ELSIF p_measure_set_code(i) = 'PPF_MSR_TCPI' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
9385         -- To Completion Percent Index
9386         x_measure_type(i) := g_IndexType;
9387 
9388 		IF (NVL(l_overview_type(l_cost_budget_index).ac_burdened_cost,0) - NVL(l_overview_type(l_actual_index).itd_burdened_cost,0)) = 0 THEN
9389 		   l_itd_value(i) := NULL;
9390 		ELSE
9391 		   l_itd_value(i) := (l_overview_type(l_cost_budget_index).ac_burdened_cost - NVL(l_overview_type(l_cost_budget_index).ac_burdened_cost,0) * l_completed_percentage)/
9392 		   (l_overview_type(l_cost_budget_index).ac_burdened_cost - NVL(l_overview_type(l_actual_index).itd_burdened_cost,0) );
9393 		END IF;
9394 
9395       ELSIF p_measure_set_code(i) = 'PPF_MSR_ADR' AND bitand(l_check_plan_versions, g_Actual_CstBudget) = g_Actual_CstBudget THEN
9396         -- Average Daily Rate
9397         x_measure_type(i) := g_IndexType;
9398 
9399 		IF (NVL(l_overview_type(l_actual_index).ptd_equipment_hrs,0)+NVL(l_overview_type(l_actual_index).ptd_labor_hrs,0)) <> 0 THEN
9400 		   l_ptd_value(i) := l_hours_per_day * l_overview_type(l_actual_index).ptd_revenue / (NVL(l_overview_type(l_actual_index).ptd_equipment_hrs,0)+NVL(l_overview_type(l_actual_index).ptd_labor_hrs,0));
9401 		END IF;
9402 
9403 		IF (NVL(l_overview_type(l_actual_index).itd_equipment_hrs,0)+NVL(l_overview_type(l_actual_index).itd_labor_hrs,0)) <> 0 THEN
9404 		   l_itd_value(i) := l_hours_per_day * l_overview_type(l_actual_index).itd_revenue / (NVL(l_overview_type(l_actual_index).itd_equipment_hrs,0)+NVL(l_overview_type(l_actual_index).itd_labor_hrs,0));
9405 		END IF;
9406 		--Added for fix of Bug 7150631
9407 		IF (NVL(l_overview_type(l_actual_index).qtd_equipment_hrs,0)+NVL(l_overview_type(l_actual_index).qtd_labor_hrs,0)) <> 0 THEN
9408 		   l_qtd_value(i) := l_hours_per_day * l_overview_type(l_actual_index).qtd_revenue / (NVL(l_overview_type(l_actual_index).qtd_equipment_hrs,0)+NVL(l_overview_type(l_actual_index).qtd_labor_hrs,0));
9409 		END IF;
9410 
9411 		IF (NVL(l_overview_type(l_actual_index).ytd_equipment_hrs,0)+NVL(l_overview_type(l_actual_index).ytd_labor_hrs,0)) <> 0 THEN
9412 		   l_ytd_value(i) := l_hours_per_day * l_overview_type(l_actual_index).ytd_revenue / (NVL(l_overview_type(l_actual_index).ytd_equipment_hrs,0)+NVL(l_overview_type(l_actual_index).ytd_labor_hrs,0));
9413 		END IF;
9414 
9415 		IF (NVL(l_overview_type(l_actual_index).ac_equipment_hrs,0)+NVL(l_overview_type(l_actual_index).ac_labor_hrs,0)) <> 0 THEN
9416 		   l_ac_value(i) := l_hours_per_day * l_overview_type(l_actual_index).ac_revenue / (NVL(l_overview_type(l_actual_index).ac_equipment_hrs,0)+NVL(l_overview_type(l_actual_index).ac_labor_hrs,0));
9417 		END IF;
9418 		--End of fix for Bug 7150631
9419 
9420       ELSIF SUBSTR(p_measure_set_code(i),0,15) = 'PPF_MSR_FP_CUST' THEN
9421 
9422 	    l_cust_measure_number := TO_NUMBER(SUBSTR(p_measure_set_code(i),16,2));
9423 
9424   	    x_measure_type(i) := l_fp_cus_meas_formats(l_cust_measure_number);
9425 
9426         l_ptd_value(i):=l_fp_custom_measures_ptd(l_cust_measure_number);
9427 
9428         l_qtd_value(i):=l_fp_custom_measures_qtd(l_cust_measure_number);
9429 
9430         l_ytd_value(i):=l_fp_custom_measures_ytd(l_cust_measure_number);
9431 
9432         l_itd_value(i):=l_fp_custom_measures_itd(l_cust_measure_number);
9433 
9434         l_ac_value(i):=l_fp_custom_measures_ac(l_cust_measure_number);
9435 
9436         l_prp_value(i):=l_fp_custom_measures_prp(l_cust_measure_number);
9437 
9438       ELSIF SUBSTR(p_measure_set_code(i),0,15) = 'PPF_MSR_AC_CUST' THEN
9439 
9440 	    l_cust_measure_number := TO_NUMBER(SUBSTR(p_measure_set_code(i),16,2));
9441 
9442   	    x_measure_type(i) := l_ac_cus_meas_formats(l_cust_measure_number);
9443 
9444         l_ptd_value(i):=l_ac_custom_measures_ptd(l_cust_measure_number);
9445 
9446         l_qtd_value(i):=l_ac_custom_measures_qtd(l_cust_measure_number);
9447 
9448         l_ytd_value(i):=l_ac_custom_measures_ytd(l_cust_measure_number);
9449 
9450         l_itd_value(i):=l_ac_custom_measures_itd(l_cust_measure_number);
9451 
9452         l_ac_value(i):=l_ac_custom_measures_ac(l_cust_measure_number);
9453 
9454         l_prp_value(i):=l_ac_custom_measures_prp(l_cust_measure_number);
9455 
9456 
9457       END IF;
9458 
9459 
9460     EXCEPTION WHEN OTHERS THEN
9461 
9462       l_sql_errm := SQLERRM();
9463       Pji_Rep_Util.Add_Message(
9464         p_app_short_name=>'PJI',
9465         p_msg_name=> 'PJI_REP_GENERIC_MSG',
9466         p_msg_type=>Pji_Rep_Util.G_RET_STS_WARNING,
9467         p_token1=>'PROC_NAME',
9468         p_token1_value=>'PJI_REP_MEASURE_UTIL; SQL Error during computation '||
9469           'of measure '||p_measure_set_code(i)||' : '|| l_sql_errm
9470       );
9471 
9472     END;
9473 
9474     -- do formatting for Currency measures
9475 	IF pCallingType = g_Exception THEN
9476 	  x_ptd_value(i):= l_ptd_value(i);
9477       x_qtd_value(i):= l_qtd_value(i);
9478       x_ytd_value(i):= l_ytd_value(i);
9479       x_itd_value(i):= l_itd_value(i);
9480       x_ac_value(i) := l_ac_value(i);
9481       x_prp_value(i):= l_prp_value(i);
9482     ELSIF x_measure_type(i) = g_CurrencyType THEN
9483 /*      IF SIGN(l_ptd_value(i)) < 0 THEN
9484         s := '-';
9485       ELSE
9486         s := '';
9487       END IF;
9488       x_ptd_value(i) := s||TO_CHAR(ABS(l_ptd_value(i)),Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9489 
9490       s := '';
9491 */
9492    	  IF l_ptd_value(i) IS NOT NULL THEN
9493 	   	  x_ptd_value(i) := TO_CHAR(TO_NUMBER(l_ptd_value(i)),Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9494 	  END IF;
9495      -- Changed from x_qtd_value to l_qtd_value for bug 3954603
9496 /*      IF SIGN(l_qtd_value(i)) < 0 THEN
9497         s := '-';
9498       ELSE
9499         s := '';
9500       END IF;
9501       x_qtd_value(i) := s||TO_CHAR(ABS(l_qtd_value(i)),Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9502 */
9503    	  IF l_qtd_value(i) IS NOT NULL THEN
9504 	  	 x_qtd_value(i) := TO_CHAR(TO_NUMBER(l_qtd_value(i)),Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9505 	  END IF;
9506       -- Changed from x_ytd_value to l_ytd_value for bug 3954603
9507 /*      IF SIGN(l_ytd_value(i)) < 0 THEN
9508         s := '-';
9509       ELSE
9510         s := '';
9511       END IF;
9512       x_ytd_value(i) := s||TO_CHAR(ABS(l_ytd_value(i)),Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9513 */
9514    	  IF l_ytd_value(i) IS NOT NULL THEN
9515 	  	 x_ytd_value(i) := TO_CHAR(TO_NUMBER(l_ytd_value(i)),Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9516 	  END IF;
9517       -- Changed from x_itd_value to l_itd_value for bug 3954603
9518 /*      IF SIGN(l_itd_value(i)) < 0 THEN
9519         s := '-';
9520       ELSE
9521         s := '';
9522       END IF;
9523       x_itd_value(i) := s||TO_CHAR(ABS(l_itd_value(i)),Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9524 */
9525    	  IF l_itd_value(i) IS NOT NULL THEN
9526 	     x_itd_value(i) := TO_CHAR(TO_NUMBER(l_itd_value(i)),Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9527 	  END IF;
9528       -- Changed from x_ac_value to l_ac_value for bug 3954603
9529 /*      IF SIGN(l_ac_value(i)) < 0 THEN
9530         s := '-';
9531       ELSE
9532         s := '';
9533       END IF;
9534       x_ac_value(i)  := s||TO_CHAR(ABS(l_ac_value(i)), Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9535 */
9536    	  IF l_ac_value(i) IS NOT NULL THEN
9537 	    x_ac_value(i)  := TO_CHAR(TO_NUMBER(l_ac_value(i)), Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9538 	  END IF;
9539       -- Changed from x_prp_value to l_prp_value for bug 3954603
9540 /*      IF SIGN(l_prp_value(i)) < 0 THEN
9541         s := '-';
9542       ELSE
9543         s := '';
9544       END IF;
9545       x_prp_value(i) := s||TO_CHAR(ABS(l_prp_value(i)),Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9546 */
9547   	  IF l_prp_value(i) IS NOT NULL THEN
9548 	     x_prp_value(i) := TO_CHAR(TO_NUMBER(l_prp_value(i)),Fnd_Currency.get_format_mask(pCurrencyCode,g_currency_size));
9549 	  END IF;
9550     ELSIF x_measure_type(i) = g_PercentType THEN -- Formatting for Percent measures
9551          /*
9552           *  Removing concatenated '%' sign to make overview page consistent with other pages.
9553           *  This changes are done for bug 3936453
9554           */
9555 	  IF l_ptd_value(i) IS NOT NULL THEN
9556 	  	 x_ptd_value(i) := to_char(round(l_ptd_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                           --Bug 8586592
9557 	  ELSE
9558 	  	 x_ptd_value(i) := NULL;
9559 	  END IF;
9560 
9561 	  IF l_qtd_value(i) IS NOT NULL THEN
9562 	  	 x_qtd_value(i) := to_char(round(l_qtd_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                           --Bug 8586592
9563 	  ELSE
9564 	  	 x_qtd_value(i) := NULL;
9565 	  END IF;
9566 
9567 	  IF l_ytd_value(i) IS NOT NULL THEN
9568 	  	 x_ytd_value(i) := to_char(round(l_ytd_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                           --Bug 8586592
9569 	  ELSE
9570 	  	 x_ytd_value(i) := NULL;
9571 	  END IF;
9572 
9573 	  IF l_itd_value(i) IS NOT NULL THEN
9574 	  	 x_itd_value(i) := to_char(round(l_itd_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                           --Bug 8586592
9575 	  ELSE
9576 	  	 x_itd_value(i) := NULL;
9577 	  END IF;
9578 
9579 	  IF l_ac_value(i) IS NOT NULL THEN
9580 	  	 x_ac_value(i) := to_char(round(l_ac_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                           --Bug 8586592
9581 	  ELSE
9582 	  	 x_ac_value(i) := NULL;
9583 	  END IF;
9584 
9585 	  IF l_prp_value(i) IS NOT NULL THEN
9586 	  	 x_prp_value(i) := to_char(round(l_prp_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                           --Bug 8586592
9587 	  ELSE
9588 	  	 x_prp_value(i) := NULL;
9589 	  END IF;
9590 
9591     ELSIF x_measure_type(i) = g_IndexType THEN -- Formatting for Index measures
9592 
9593 	  IF l_ptd_value(i) IS NOT NULL THEN
9594 	  	 x_ptd_value(i):=to_char(round(l_ptd_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                           --Bug 8586592
9595 	  ELSE
9596 	  	 x_ptd_value(i) := NULL;
9597 	  END IF;
9598 
9599 	  IF l_qtd_value(i) IS NOT NULL THEN
9600 	  	 x_qtd_value(i):=to_char(round(l_qtd_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                           --Bug 8586592
9601 	  ELSE
9602 	  	 x_qtd_value(i) := NULL;
9603 	  END IF;
9604 
9605 	  IF l_ytd_value(i) IS NOT NULL THEN
9606 	     x_ytd_value(i):=to_char(round(l_ytd_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                           --Bug 8586592
9607 	  ELSE
9608 	  	 x_ytd_value(i) := NULL;
9609 	  END IF;
9610 
9611 	  IF l_itd_value(i) IS NOT NULL THEN
9612 	  	 x_itd_value(i):=to_char(round(l_itd_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                           --Bug 8586592
9613 	  ELSE
9614 	  	 x_itd_value(i) := NULL;
9615 	  END IF;
9616 
9617 	  IF l_ac_value(i) IS NOT NULL THEN
9618 	  	 x_ac_value(i) :=to_char(round(l_ac_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                                                 --Bug 8586592
9619 	  ELSE
9620 	  	 x_ac_value(i) := NULL;
9621 	  END IF;
9622 
9623 	  IF l_prp_value(i) IS NOT NULL THEN
9624 	     x_prp_value(i):=to_char(round(l_prp_value(i),g_PercentDecimalPlaces),'999G999G999G990D'||substr('0000000000',1,g_PercentDecimalPlaces));                                                           --Bug 8586592
9625 	  ELSE
9626 	  	 x_prp_value(i) := NULL;
9627 	  END IF;
9628 
9629 	ELSIF x_measure_type(i) = g_DaysType THEN
9630 
9631       x_ptd_value(i):= TO_CHAR(ROUND(l_ptd_value(i),0));
9632       x_qtd_value(i):= TO_CHAR(ROUND(l_qtd_value(i),0));
9633       x_ytd_value(i):= TO_CHAR(ROUND(l_ytd_value(i),0));
9634       x_itd_value(i):= TO_CHAR(ROUND(l_itd_value(i),0));
9635       x_ac_value(i) := TO_CHAR(ROUND(l_ac_value(i),0));
9636       x_prp_value(i):= TO_CHAR(ROUND(l_prp_value(i),0));
9637 	ELSIF x_measure_type(i) = g_HoursType THEN
9638       x_ptd_value(i):= TO_CHAR(ROUND(l_ptd_value(i),5));
9639       x_qtd_value(i):= TO_CHAR(ROUND(l_qtd_value(i),5));
9640       x_ytd_value(i):= TO_CHAR(ROUND(l_ytd_value(i),5));
9641       x_itd_value(i):= TO_CHAR(ROUND(l_itd_value(i),5));
9642       x_ac_value(i) := TO_CHAR(ROUND(l_ac_value(i),5));
9643       x_prp_value(i):= TO_CHAR(ROUND(l_prp_value(i),5));
9644 	ELSE
9645       x_ptd_value(i):= l_ptd_value(i);
9646       x_qtd_value(i):= l_qtd_value(i);
9647       x_ytd_value(i):= l_ytd_value(i);
9648       x_itd_value(i):= l_itd_value(i);
9649       x_ac_value(i) := l_ac_value(i);
9650       x_prp_value(i):= l_prp_value(i);
9651 
9652     END IF;
9653 
9654   END LOOP;
9655 
9656   IF g_debug_mode = 'Y' THEN
9657 	  Pji_Utils.WRITE2LOG(
9658 	    'PJI_REP_MEASURE_UTIL.retrieveData: reached end.',
9659 	    TRUE, g_msg_level_proc_call
9660 	  );
9661   END IF;
9662 
9663   COMMIT;
9664 
9665 END retrieveData;
9666 
9667 PROCEDURE Merge_Overview_Type
9668 (
9669  p_source_index IN NUMBER
9670  ,p_source_table IN pji_rep_overview_type_tbl
9671  ,p_target_index IN NUMBER
9672  ,p_target_table IN OUT NOCOPY pji_rep_overview_type_tbl
9673 )
9674 IS
9675 BEGIN
9676 
9677 p_target_table(p_target_index).ptd_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_raw_cost 	,	p_source_table(p_source_index).ptd_raw_cost 	);
9678 p_target_table(p_target_index).ptd_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_burdened_cost 	,	p_source_table(p_source_index).ptd_burdened_cost 	);
9679 p_target_table(p_target_index).ptd_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_revenue 	,	p_source_table(p_source_index).ptd_revenue 	);
9680 p_target_table(p_target_index).ptd_bill_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_bill_raw_cost 	,	p_source_table(p_source_index).ptd_bill_raw_cost 	);
9681 p_target_table(p_target_index).ptd_bill_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_bill_burdened_cost 	,	p_source_table(p_source_index).ptd_bill_burdened_cost 	);
9682 p_target_table(p_target_index).ptd_bill_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_bill_equipment_hrs 	,	p_source_table(p_source_index).ptd_bill_equipment_hrs 	);
9683 p_target_table(p_target_index).ptd_bill_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_bill_labor_raw_cost 	,	p_source_table(p_source_index).ptd_bill_labor_raw_cost 	);
9684 p_target_table(p_target_index).ptd_bill_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_bill_labor_burdened_cost 	,	p_source_table(p_source_index).ptd_bill_labor_burdened_cost 	);
9685 p_target_table(p_target_index).ptd_bill_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_bill_labor_hrs 	,	p_source_table(p_source_index).ptd_bill_labor_hrs 	);
9686 p_target_table(p_target_index).ptd_capitalizable_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_capitalizable_raw_cost 	,	p_source_table(p_source_index).ptd_capitalizable_raw_cost 	);
9687 p_target_table(p_target_index).ptd_capitalizable_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_capitalizable_brdn_cost 	,	p_source_table(p_source_index).ptd_capitalizable_brdn_cost 	);
9688 p_target_table(p_target_index).ptd_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_equipment_hrs 	,	p_source_table(p_source_index).ptd_equipment_hrs 	);
9689 p_target_table(p_target_index).ptd_equipment_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_equipment_raw_cost 	,	p_source_table(p_source_index).ptd_equipment_raw_cost 	);
9690 p_target_table(p_target_index).ptd_equipment_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_equipment_brdn_cost 	,	p_source_table(p_source_index).ptd_equipment_brdn_cost 	);
9691 p_target_table(p_target_index).ptd_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_labor_raw_cost 	,	p_source_table(p_source_index).ptd_labor_raw_cost 	);
9692 p_target_table(p_target_index).ptd_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_labor_burdened_cost 	,	p_source_table(p_source_index).ptd_labor_burdened_cost 	);
9693 p_target_table(p_target_index).ptd_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_labor_hrs 	,	p_source_table(p_source_index).ptd_labor_hrs 	);
9694 p_target_table(p_target_index).ptd_labor_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_labor_revenue 	,	p_source_table(p_source_index).ptd_labor_revenue 	);
9695 p_target_table(p_target_index).ptd_unbilled_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_unbilled_cost 	,	p_source_table(p_source_index).ptd_unbilled_cost 	);
9696 p_target_table(p_target_index).ptd_capitalized_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_capitalized_cost 	,	p_source_table(p_source_index).ptd_capitalized_cost 	);
9697 p_target_table(p_target_index).ptd_sup_inv_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_sup_inv_committed_cost 	,	p_source_table(p_source_index).ptd_sup_inv_committed_cost 	);
9698 p_target_table(p_target_index).ptd_po_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_po_committed_cost 	,	p_source_table(p_source_index).ptd_po_committed_cost 	);
9699 p_target_table(p_target_index).ptd_pr_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_pr_committed_cost 	,	p_source_table(p_source_index).ptd_pr_committed_cost 	);
9700 p_target_table(p_target_index).ptd_oth_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_oth_committed_cost 	,	p_source_table(p_source_index).ptd_oth_committed_cost 	);
9701 p_target_table(p_target_index).qtd_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_raw_cost 	,	p_source_table(p_source_index).qtd_raw_cost 	);
9702 p_target_table(p_target_index).qtd_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_burdened_cost 	,	p_source_table(p_source_index).qtd_burdened_cost 	);
9703 p_target_table(p_target_index).qtd_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_revenue 	,	p_source_table(p_source_index).qtd_revenue 	);
9704 p_target_table(p_target_index).qtd_bill_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_bill_raw_cost 	,	p_source_table(p_source_index).qtd_bill_raw_cost 	);
9705 p_target_table(p_target_index).qtd_bill_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_bill_burdened_cost 	,	p_source_table(p_source_index).qtd_bill_burdened_cost 	);
9706 p_target_table(p_target_index).qtd_bill_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_bill_equipment_hrs 	,	p_source_table(p_source_index).qtd_bill_equipment_hrs 	);
9707 p_target_table(p_target_index).qtd_bill_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_bill_labor_raw_cost 	,	p_source_table(p_source_index).qtd_bill_labor_raw_cost 	);
9708 p_target_table(p_target_index).qtd_bill_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_bill_labor_burdened_cost 	,	p_source_table(p_source_index).qtd_bill_labor_burdened_cost 	);
9709 p_target_table(p_target_index).qtd_bill_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_bill_labor_hrs 	,	p_source_table(p_source_index).qtd_bill_labor_hrs 	);
9710 p_target_table(p_target_index).qtd_capitalizable_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_capitalizable_raw_cost 	,	p_source_table(p_source_index).qtd_capitalizable_raw_cost 	);
9711 p_target_table(p_target_index).qtd_capitalizable_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_capitalizable_brdn_cost 	,	p_source_table(p_source_index).qtd_capitalizable_brdn_cost 	);
9712 p_target_table(p_target_index).qtd_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_equipment_hrs 	,	p_source_table(p_source_index).qtd_equipment_hrs 	);
9713 p_target_table(p_target_index).qtd_equipment_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_equipment_raw_cost 	,	p_source_table(p_source_index).qtd_equipment_raw_cost 	);
9714 p_target_table(p_target_index).qtd_equipment_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_equipment_brdn_cost 	,	p_source_table(p_source_index).qtd_equipment_brdn_cost 	);
9715 p_target_table(p_target_index).qtd_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_labor_raw_cost 	,	p_source_table(p_source_index).qtd_labor_raw_cost 	);
9716 p_target_table(p_target_index).qtd_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_labor_burdened_cost 	,	p_source_table(p_source_index).qtd_labor_burdened_cost 	);
9717 p_target_table(p_target_index).qtd_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_labor_hrs 	,	p_source_table(p_source_index).qtd_labor_hrs 	);
9718 p_target_table(p_target_index).qtd_labor_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_labor_revenue 	,	p_source_table(p_source_index).qtd_labor_revenue 	);
9719 p_target_table(p_target_index).qtd_unbilled_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_unbilled_cost 	,	p_source_table(p_source_index).qtd_unbilled_cost 	);
9720 p_target_table(p_target_index).qtd_capitalized_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_capitalized_cost 	,	p_source_table(p_source_index).qtd_capitalized_cost 	);
9721 p_target_table(p_target_index).qtd_sup_inv_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_sup_inv_committed_cost 	,	p_source_table(p_source_index).qtd_sup_inv_committed_cost 	);
9722 p_target_table(p_target_index).qtd_po_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_po_committed_cost 	,	p_source_table(p_source_index).qtd_po_committed_cost 	);
9723 p_target_table(p_target_index).qtd_pr_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_pr_committed_cost 	,	p_source_table(p_source_index).qtd_pr_committed_cost 	);
9724 p_target_table(p_target_index).qtd_oth_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_oth_committed_cost 	,	p_source_table(p_source_index).qtd_oth_committed_cost 	);
9725 p_target_table(p_target_index).ytd_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_raw_cost 	,	p_source_table(p_source_index).ytd_raw_cost 	);
9726 p_target_table(p_target_index).ytd_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_burdened_cost 	,	p_source_table(p_source_index).ytd_burdened_cost 	);
9727 p_target_table(p_target_index).ytd_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_revenue 	,	p_source_table(p_source_index).ytd_revenue 	);
9728 p_target_table(p_target_index).ytd_bill_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_bill_raw_cost 	,	p_source_table(p_source_index).ytd_bill_raw_cost 	);
9729 p_target_table(p_target_index).ytd_bill_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_bill_burdened_cost 	,	p_source_table(p_source_index).ytd_bill_burdened_cost 	);
9730 p_target_table(p_target_index).ytd_bill_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_bill_equipment_hrs 	,	p_source_table(p_source_index).ytd_bill_equipment_hrs 	);
9731 p_target_table(p_target_index).ytd_bill_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_bill_labor_raw_cost 	,	p_source_table(p_source_index).ytd_bill_labor_raw_cost 	);
9732 p_target_table(p_target_index).ytd_bill_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_bill_labor_burdened_cost 	,	p_source_table(p_source_index).ytd_bill_labor_burdened_cost 	);
9733 p_target_table(p_target_index).ytd_bill_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_bill_labor_hrs 	,	p_source_table(p_source_index).ytd_bill_labor_hrs 	);
9734 p_target_table(p_target_index).ytd_capitalizable_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_capitalizable_raw_cost 	,	p_source_table(p_source_index).ytd_capitalizable_raw_cost 	);
9735 p_target_table(p_target_index).ytd_capitalizable_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_capitalizable_brdn_cost 	,	p_source_table(p_source_index).ytd_capitalizable_brdn_cost 	);
9736 p_target_table(p_target_index).ytd_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_equipment_hrs 	,	p_source_table(p_source_index).ytd_equipment_hrs 	);
9737 p_target_table(p_target_index).ytd_equipment_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_equipment_raw_cost 	,	p_source_table(p_source_index).ytd_equipment_raw_cost 	);
9738 p_target_table(p_target_index).ytd_equipment_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_equipment_brdn_cost 	,	p_source_table(p_source_index).ytd_equipment_brdn_cost 	);
9739 p_target_table(p_target_index).ytd_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_labor_raw_cost 	,	p_source_table(p_source_index).ytd_labor_raw_cost 	);
9740 p_target_table(p_target_index).ytd_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_labor_burdened_cost 	,	p_source_table(p_source_index).ytd_labor_burdened_cost 	);
9741 p_target_table(p_target_index).ytd_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_labor_hrs 	,	p_source_table(p_source_index).ytd_labor_hrs 	);
9742 p_target_table(p_target_index).ytd_labor_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_labor_revenue 	,	p_source_table(p_source_index).ytd_labor_revenue 	);
9743 p_target_table(p_target_index).ytd_unbilled_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_unbilled_cost 	,	p_source_table(p_source_index).ytd_unbilled_cost 	);
9744 p_target_table(p_target_index).ytd_capitalized_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_capitalized_cost 	,	p_source_table(p_source_index).ytd_capitalized_cost 	);
9745 p_target_table(p_target_index).ytd_sup_inv_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_sup_inv_committed_cost 	,	p_source_table(p_source_index).ytd_sup_inv_committed_cost 	);
9746 p_target_table(p_target_index).ytd_po_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_po_committed_cost 	,	p_source_table(p_source_index).ytd_po_committed_cost 	);
9747 p_target_table(p_target_index).ytd_pr_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_pr_committed_cost 	,	p_source_table(p_source_index).ytd_pr_committed_cost 	);
9748 p_target_table(p_target_index).ytd_oth_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_oth_committed_cost 	,	p_source_table(p_source_index).ytd_oth_committed_cost 	);
9749 p_target_table(p_target_index).itd_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_raw_cost 	,	p_source_table(p_source_index).itd_raw_cost 	);
9750 p_target_table(p_target_index).itd_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_burdened_cost 	,	p_source_table(p_source_index).itd_burdened_cost 	);
9751 p_target_table(p_target_index).itd_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_revenue 	,	p_source_table(p_source_index).itd_revenue 	);
9752 p_target_table(p_target_index).itd_bill_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_bill_raw_cost 	,	p_source_table(p_source_index).itd_bill_raw_cost 	);
9753 p_target_table(p_target_index).itd_bill_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_bill_burdened_cost 	,	p_source_table(p_source_index).itd_bill_burdened_cost 	);
9754 p_target_table(p_target_index).itd_bill_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_bill_equipment_hrs 	,	p_source_table(p_source_index).itd_bill_equipment_hrs 	);
9755 p_target_table(p_target_index).itd_bill_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_bill_labor_raw_cost 	,	p_source_table(p_source_index).itd_bill_labor_raw_cost 	);
9756 p_target_table(p_target_index).itd_bill_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_bill_labor_burdened_cost 	,	p_source_table(p_source_index).itd_bill_labor_burdened_cost 	);
9757 p_target_table(p_target_index).itd_bill_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_bill_labor_hrs 	,	p_source_table(p_source_index).itd_bill_labor_hrs 	);
9758 p_target_table(p_target_index).itd_capitalizable_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_capitalizable_raw_cost 	,	p_source_table(p_source_index).itd_capitalizable_raw_cost 	);
9759 p_target_table(p_target_index).itd_capitalizable_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_capitalizable_brdn_cost 	,	p_source_table(p_source_index).itd_capitalizable_brdn_cost 	);
9760 p_target_table(p_target_index).itd_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_equipment_hrs 	,	p_source_table(p_source_index).itd_equipment_hrs 	);
9761 p_target_table(p_target_index).itd_equipment_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_equipment_raw_cost 	,	p_source_table(p_source_index).itd_equipment_raw_cost 	);
9762 p_target_table(p_target_index).itd_equipment_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_equipment_brdn_cost 	,	p_source_table(p_source_index).itd_equipment_brdn_cost 	);
9763 p_target_table(p_target_index).itd_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_labor_raw_cost 	,	p_source_table(p_source_index).itd_labor_raw_cost 	);
9764 p_target_table(p_target_index).itd_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_labor_burdened_cost 	,	p_source_table(p_source_index).itd_labor_burdened_cost 	);
9765 p_target_table(p_target_index).itd_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_labor_hrs 	,	p_source_table(p_source_index).itd_labor_hrs 	);
9766 p_target_table(p_target_index).itd_labor_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_labor_revenue 	,	p_source_table(p_source_index).itd_labor_revenue 	);
9767 p_target_table(p_target_index).itd_unbilled_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_unbilled_cost 	,	p_source_table(p_source_index).itd_unbilled_cost 	);
9768 p_target_table(p_target_index).itd_capitalized_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_capitalized_cost 	,	p_source_table(p_source_index).itd_capitalized_cost 	);
9769 p_target_table(p_target_index).itd_sup_inv_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_sup_inv_committed_cost 	,	p_source_table(p_source_index).itd_sup_inv_committed_cost 	);
9770 p_target_table(p_target_index).itd_po_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_po_committed_cost 	,	p_source_table(p_source_index).itd_po_committed_cost 	);
9771 p_target_table(p_target_index).itd_pr_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_pr_committed_cost 	,	p_source_table(p_source_index).itd_pr_committed_cost 	);
9772 p_target_table(p_target_index).itd_oth_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_oth_committed_cost 	,	p_source_table(p_source_index).itd_oth_committed_cost 	);
9773 p_target_table(p_target_index).ac_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_raw_cost 	,	p_source_table(p_source_index).ac_raw_cost 	);
9774 p_target_table(p_target_index).ac_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_burdened_cost 	,	p_source_table(p_source_index).ac_burdened_cost 	);
9775 p_target_table(p_target_index).ac_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_revenue 	,	p_source_table(p_source_index).ac_revenue 	);
9776 p_target_table(p_target_index).ac_bill_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_bill_raw_cost 	,	p_source_table(p_source_index).ac_bill_raw_cost 	);
9777 p_target_table(p_target_index).ac_bill_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_bill_burdened_cost 	,	p_source_table(p_source_index).ac_bill_burdened_cost 	);
9778 p_target_table(p_target_index).ac_bill_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_bill_equipment_hrs 	,	p_source_table(p_source_index).ac_bill_equipment_hrs 	);
9779 p_target_table(p_target_index).ac_bill_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_bill_labor_raw_cost 	,	p_source_table(p_source_index).ac_bill_labor_raw_cost 	);
9780 p_target_table(p_target_index).ac_bill_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_bill_labor_burdened_cost 	,	p_source_table(p_source_index).ac_bill_labor_burdened_cost 	);
9781 p_target_table(p_target_index).ac_bill_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_bill_labor_hrs 	,	p_source_table(p_source_index).ac_bill_labor_hrs 	);
9782 p_target_table(p_target_index).ac_capitalizable_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_capitalizable_raw_cost 	,	p_source_table(p_source_index).ac_capitalizable_raw_cost 	);
9783 p_target_table(p_target_index).ac_capitalizable_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_capitalizable_brdn_cost 	,	p_source_table(p_source_index).ac_capitalizable_brdn_cost 	);
9784 p_target_table(p_target_index).ac_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_equipment_hrs 	,	p_source_table(p_source_index).ac_equipment_hrs 	);
9785 p_target_table(p_target_index).ac_equipment_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_equipment_raw_cost 	,	p_source_table(p_source_index).ac_equipment_raw_cost 	);
9786 p_target_table(p_target_index).ac_equipment_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_equipment_brdn_cost 	,	p_source_table(p_source_index).ac_equipment_brdn_cost 	);
9787 p_target_table(p_target_index).ac_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_labor_raw_cost 	,	p_source_table(p_source_index).ac_labor_raw_cost 	);
9788 p_target_table(p_target_index).ac_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_labor_burdened_cost 	,	p_source_table(p_source_index).ac_labor_burdened_cost 	);
9789 p_target_table(p_target_index).ac_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_labor_hrs 	,	p_source_table(p_source_index).ac_labor_hrs 	);
9790 p_target_table(p_target_index).ac_labor_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_labor_revenue 	,	p_source_table(p_source_index).ac_labor_revenue 	);
9791 p_target_table(p_target_index).ac_unbilled_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_unbilled_cost 	,	p_source_table(p_source_index).ac_unbilled_cost 	);
9792 p_target_table(p_target_index).ac_capitalized_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_capitalized_cost 	,	p_source_table(p_source_index).ac_capitalized_cost 	);
9793 p_target_table(p_target_index).ac_sup_inv_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_sup_inv_committed_cost 	,	p_source_table(p_source_index).ac_sup_inv_committed_cost 	);
9794 p_target_table(p_target_index).ac_po_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_po_committed_cost 	,	p_source_table(p_source_index).ac_po_committed_cost 	);
9795 p_target_table(p_target_index).ac_pr_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_pr_committed_cost 	,	p_source_table(p_source_index).ac_pr_committed_cost 	);
9796 p_target_table(p_target_index).ac_oth_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_oth_committed_cost 	,	p_source_table(p_source_index).ac_oth_committed_cost 	);
9797 p_target_table(p_target_index).prp_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_raw_cost 	,	p_source_table(p_source_index).prp_raw_cost 	);
9798 p_target_table(p_target_index).prp_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_burdened_cost 	,	p_source_table(p_source_index).prp_burdened_cost 	);
9799 p_target_table(p_target_index).prp_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_revenue 	,	p_source_table(p_source_index).prp_revenue 	);
9800 p_target_table(p_target_index).prp_bill_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_bill_raw_cost 	,	p_source_table(p_source_index).prp_bill_raw_cost 	);
9801 p_target_table(p_target_index).prp_bill_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_bill_burdened_cost 	,	p_source_table(p_source_index).prp_bill_burdened_cost 	);
9802 p_target_table(p_target_index).prp_bill_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_bill_equipment_hrs 	,	p_source_table(p_source_index).prp_bill_equipment_hrs 	);
9803 p_target_table(p_target_index).prp_bill_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_bill_labor_raw_cost 	,	p_source_table(p_source_index).prp_bill_labor_raw_cost 	);
9804 p_target_table(p_target_index).prp_bill_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_bill_labor_burdened_cost 	,	p_source_table(p_source_index).prp_bill_labor_burdened_cost 	);
9805 p_target_table(p_target_index).prp_bill_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_bill_labor_hrs 	,	p_source_table(p_source_index).prp_bill_labor_hrs 	);
9806 p_target_table(p_target_index).prp_capitalizable_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_capitalizable_raw_cost 	,	p_source_table(p_source_index).prp_capitalizable_raw_cost 	);
9807 p_target_table(p_target_index).prp_capitalizable_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_capitalizable_brdn_cost 	,	p_source_table(p_source_index).prp_capitalizable_brdn_cost 	);
9808 p_target_table(p_target_index).prp_equipment_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_equipment_hrs 	,	p_source_table(p_source_index).prp_equipment_hrs 	);
9809 p_target_table(p_target_index).prp_equipment_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_equipment_raw_cost 	,	p_source_table(p_source_index).prp_equipment_raw_cost 	);
9810 p_target_table(p_target_index).prp_equipment_brdn_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_equipment_brdn_cost 	,	p_source_table(p_source_index).prp_equipment_brdn_cost 	);
9811 p_target_table(p_target_index).prp_labor_raw_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_labor_raw_cost 	,	p_source_table(p_source_index).prp_labor_raw_cost 	);
9812 p_target_table(p_target_index).prp_labor_burdened_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_labor_burdened_cost 	,	p_source_table(p_source_index).prp_labor_burdened_cost 	);
9813 p_target_table(p_target_index).prp_labor_hrs 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_labor_hrs 	,	p_source_table(p_source_index).prp_labor_hrs 	);
9814 p_target_table(p_target_index).prp_labor_revenue 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_labor_revenue 	,	p_source_table(p_source_index).prp_labor_revenue 	);
9815 p_target_table(p_target_index).prp_unbilled_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_unbilled_cost 	,	p_source_table(p_source_index).prp_unbilled_cost 	);
9816 p_target_table(p_target_index).prp_capitalized_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_capitalized_cost 	,	p_source_table(p_source_index).prp_capitalized_cost 	);
9817 p_target_table(p_target_index).prp_sup_inv_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_sup_inv_committed_cost 	,	p_source_table(p_source_index).prp_sup_inv_committed_cost 	);
9818 p_target_table(p_target_index).prp_po_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_po_committed_cost 	,	p_source_table(p_source_index).prp_po_committed_cost 	);
9819 p_target_table(p_target_index).prp_pr_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_pr_committed_cost 	,	p_source_table(p_source_index).prp_pr_committed_cost 	);
9820 p_target_table(p_target_index).prp_oth_committed_cost 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_oth_committed_cost 	,	p_source_table(p_source_index).prp_oth_committed_cost 	);
9821 p_target_table(p_target_index).ptd_custom_1 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_1 	,	p_source_table(p_source_index).ptd_custom_1 	);
9822 p_target_table(p_target_index).ptd_custom_2 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_2 	,	p_source_table(p_source_index).ptd_custom_2 	);
9823 p_target_table(p_target_index).ptd_custom_3 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_3 	,	p_source_table(p_source_index).ptd_custom_3 	);
9824 p_target_table(p_target_index).ptd_custom_4 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_4 	,	p_source_table(p_source_index).ptd_custom_4 	);
9825 p_target_table(p_target_index).ptd_custom_5 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_5 	,	p_source_table(p_source_index).ptd_custom_5 	);
9826 p_target_table(p_target_index).ptd_custom_6 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_6 	,	p_source_table(p_source_index).ptd_custom_6 	);
9827 p_target_table(p_target_index).ptd_custom_7 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_7 	,	p_source_table(p_source_index).ptd_custom_7 	);
9828 p_target_table(p_target_index).ptd_custom_8 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_8 	,	p_source_table(p_source_index).ptd_custom_8 	);
9829 p_target_table(p_target_index).ptd_custom_9 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_9 	,	p_source_table(p_source_index).ptd_custom_9 	);
9830 p_target_table(p_target_index).ptd_custom_10 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_10 	,	p_source_table(p_source_index).ptd_custom_10 	);
9831 p_target_table(p_target_index).ptd_custom_11 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_11 	,	p_source_table(p_source_index).ptd_custom_11 	);
9832 p_target_table(p_target_index).ptd_custom_12 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_12 	,	p_source_table(p_source_index).ptd_custom_12 	);
9833 p_target_table(p_target_index).ptd_custom_13 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_13 	,	p_source_table(p_source_index).ptd_custom_13 	);
9834 p_target_table(p_target_index).ptd_custom_14 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_14 	,	p_source_table(p_source_index).ptd_custom_14 	);
9835 p_target_table(p_target_index).ptd_custom_15 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_15 	,	p_source_table(p_source_index).ptd_custom_15 	);
9836 p_target_table(p_target_index).ptd_custom_16 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_16 	,	p_source_table(p_source_index).ptd_custom_16 	);
9837 p_target_table(p_target_index).ptd_custom_17 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_17 	,	p_source_table(p_source_index).ptd_custom_17 	);
9838 p_target_table(p_target_index).ptd_custom_18 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_18 	,	p_source_table(p_source_index).ptd_custom_18 	);
9839 p_target_table(p_target_index).ptd_custom_19 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_19 	,	p_source_table(p_source_index).ptd_custom_19 	);
9840 p_target_table(p_target_index).ptd_custom_20 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_20 	,	p_source_table(p_source_index).ptd_custom_20 	);
9841 p_target_table(p_target_index).ptd_custom_21 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_21 	,	p_source_table(p_source_index).ptd_custom_21 	);
9842 p_target_table(p_target_index).ptd_custom_22 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_22 	,	p_source_table(p_source_index).ptd_custom_22 	);
9843 p_target_table(p_target_index).ptd_custom_23 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_23 	,	p_source_table(p_source_index).ptd_custom_23 	);
9844 p_target_table(p_target_index).ptd_custom_24 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_24 	,	p_source_table(p_source_index).ptd_custom_24 	);
9845 p_target_table(p_target_index).ptd_custom_25 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_25 	,	p_source_table(p_source_index).ptd_custom_25 	);
9846 p_target_table(p_target_index).ptd_custom_26 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_26 	,	p_source_table(p_source_index).ptd_custom_26 	);
9847 p_target_table(p_target_index).ptd_custom_27 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_27 	,	p_source_table(p_source_index).ptd_custom_27 	);
9848 p_target_table(p_target_index).ptd_custom_28 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_28 	,	p_source_table(p_source_index).ptd_custom_28 	);
9849 p_target_table(p_target_index).ptd_custom_29 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_29 	,	p_source_table(p_source_index).ptd_custom_29 	);
9850 p_target_table(p_target_index).ptd_custom_30 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ptd_custom_30 	,	p_source_table(p_source_index).ptd_custom_30 	);
9851 p_target_table(p_target_index).qtd_custom_1 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_1 	,	p_source_table(p_source_index).qtd_custom_1 	);
9852 p_target_table(p_target_index).qtd_custom_2 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_2 	,	p_source_table(p_source_index).qtd_custom_2 	);
9853 p_target_table(p_target_index).qtd_custom_3 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_3 	,	p_source_table(p_source_index).qtd_custom_3 	);
9854 p_target_table(p_target_index).qtd_custom_4 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_4 	,	p_source_table(p_source_index).qtd_custom_4 	);
9855 p_target_table(p_target_index).qtd_custom_5 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_5 	,	p_source_table(p_source_index).qtd_custom_5 	);
9856 p_target_table(p_target_index).qtd_custom_6 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_6 	,	p_source_table(p_source_index).qtd_custom_6 	);
9857 p_target_table(p_target_index).qtd_custom_7 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_7 	,	p_source_table(p_source_index).qtd_custom_7 	);
9858 p_target_table(p_target_index).qtd_custom_8 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_8 	,	p_source_table(p_source_index).qtd_custom_8 	);
9859 p_target_table(p_target_index).qtd_custom_9 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_9 	,	p_source_table(p_source_index).qtd_custom_9 	);
9860 p_target_table(p_target_index).qtd_custom_10 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_10 	,	p_source_table(p_source_index).qtd_custom_10 	);
9861 p_target_table(p_target_index).qtd_custom_11 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_11 	,	p_source_table(p_source_index).qtd_custom_11 	);
9862 p_target_table(p_target_index).qtd_custom_12 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_12 	,	p_source_table(p_source_index).qtd_custom_12 	);
9863 p_target_table(p_target_index).qtd_custom_13 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_13 	,	p_source_table(p_source_index).qtd_custom_13 	);
9864 p_target_table(p_target_index).qtd_custom_14 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_14 	,	p_source_table(p_source_index).qtd_custom_14 	);
9865 p_target_table(p_target_index).qtd_custom_15 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_15 	,	p_source_table(p_source_index).qtd_custom_15 	);
9866 p_target_table(p_target_index).qtd_custom_16 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_16 	,	p_source_table(p_source_index).qtd_custom_16 	);
9867 p_target_table(p_target_index).qtd_custom_17 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_17 	,	p_source_table(p_source_index).qtd_custom_17 	);
9868 p_target_table(p_target_index).qtd_custom_18 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_18 	,	p_source_table(p_source_index).qtd_custom_18 	);
9869 p_target_table(p_target_index).qtd_custom_19 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_19 	,	p_source_table(p_source_index).qtd_custom_19 	);
9870 p_target_table(p_target_index).qtd_custom_20 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_20 	,	p_source_table(p_source_index).qtd_custom_20 	);
9871 p_target_table(p_target_index).qtd_custom_21 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_21 	,	p_source_table(p_source_index).qtd_custom_21 	);
9872 p_target_table(p_target_index).qtd_custom_22 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_22 	,	p_source_table(p_source_index).qtd_custom_22 	);
9873 p_target_table(p_target_index).qtd_custom_23 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_23 	,	p_source_table(p_source_index).qtd_custom_23 	);
9874 p_target_table(p_target_index).qtd_custom_24 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_24 	,	p_source_table(p_source_index).qtd_custom_24 	);
9875 p_target_table(p_target_index).qtd_custom_25 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_25 	,	p_source_table(p_source_index).qtd_custom_25 	);
9876 p_target_table(p_target_index).qtd_custom_26 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_26 	,	p_source_table(p_source_index).qtd_custom_26 	);
9877 p_target_table(p_target_index).qtd_custom_27 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_27 	,	p_source_table(p_source_index).qtd_custom_27 	);
9878 p_target_table(p_target_index).qtd_custom_28 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_28 	,	p_source_table(p_source_index).qtd_custom_28 	);
9879 p_target_table(p_target_index).qtd_custom_29 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_29 	,	p_source_table(p_source_index).qtd_custom_29 	);
9880 p_target_table(p_target_index).qtd_custom_30 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).qtd_custom_30 	,	p_source_table(p_source_index).qtd_custom_30 	);
9881 p_target_table(p_target_index).ytd_custom_1 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_1 	,	p_source_table(p_source_index).ytd_custom_1 	);
9882 p_target_table(p_target_index).ytd_custom_2 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_2 	,	p_source_table(p_source_index).ytd_custom_2 	);
9883 p_target_table(p_target_index).ytd_custom_3 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_3 	,	p_source_table(p_source_index).ytd_custom_3 	);
9884 p_target_table(p_target_index).ytd_custom_4 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_4 	,	p_source_table(p_source_index).ytd_custom_4 	);
9885 p_target_table(p_target_index).ytd_custom_5 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_5 	,	p_source_table(p_source_index).ytd_custom_5 	);
9886 p_target_table(p_target_index).ytd_custom_6 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_6 	,	p_source_table(p_source_index).ytd_custom_6 	);
9887 p_target_table(p_target_index).ytd_custom_7 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_7 	,	p_source_table(p_source_index).ytd_custom_7 	);
9888 p_target_table(p_target_index).ytd_custom_8 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_8 	,	p_source_table(p_source_index).ytd_custom_8 	);
9889 p_target_table(p_target_index).ytd_custom_9 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_9 	,	p_source_table(p_source_index).ytd_custom_9 	);
9890 p_target_table(p_target_index).ytd_custom_10 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_10 	,	p_source_table(p_source_index).ytd_custom_10 	);
9891 p_target_table(p_target_index).ytd_custom_11 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_11 	,	p_source_table(p_source_index).ytd_custom_11 	);
9892 p_target_table(p_target_index).ytd_custom_12 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_12 	,	p_source_table(p_source_index).ytd_custom_12 	);
9893 p_target_table(p_target_index).ytd_custom_13 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_13 	,	p_source_table(p_source_index).ytd_custom_13 	);
9894 p_target_table(p_target_index).ytd_custom_14 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_14 	,	p_source_table(p_source_index).ytd_custom_14 	);
9895 p_target_table(p_target_index).ytd_custom_15 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_15 	,	p_source_table(p_source_index).ytd_custom_15 	);
9896 p_target_table(p_target_index).ytd_custom_16 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_16 	,	p_source_table(p_source_index).ytd_custom_16 	);
9897 p_target_table(p_target_index).ytd_custom_17 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_17 	,	p_source_table(p_source_index).ytd_custom_17 	);
9898 p_target_table(p_target_index).ytd_custom_18 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_18 	,	p_source_table(p_source_index).ytd_custom_18 	);
9899 p_target_table(p_target_index).ytd_custom_19 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_19 	,	p_source_table(p_source_index).ytd_custom_19 	);
9900 p_target_table(p_target_index).ytd_custom_20 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_20 	,	p_source_table(p_source_index).ytd_custom_20 	);
9901 p_target_table(p_target_index).ytd_custom_21 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_21 	,	p_source_table(p_source_index).ytd_custom_21 	);
9902 p_target_table(p_target_index).ytd_custom_22 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_22 	,	p_source_table(p_source_index).ytd_custom_22 	);
9903 p_target_table(p_target_index).ytd_custom_23 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_23 	,	p_source_table(p_source_index).ytd_custom_23 	);
9904 p_target_table(p_target_index).ytd_custom_24 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_24 	,	p_source_table(p_source_index).ytd_custom_24 	);
9905 p_target_table(p_target_index).ytd_custom_25 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_25 	,	p_source_table(p_source_index).ytd_custom_25 	);
9906 p_target_table(p_target_index).ytd_custom_26 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_26 	,	p_source_table(p_source_index).ytd_custom_26 	);
9907 p_target_table(p_target_index).ytd_custom_27 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_27 	,	p_source_table(p_source_index).ytd_custom_27 	);
9908 p_target_table(p_target_index).ytd_custom_28 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_28 	,	p_source_table(p_source_index).ytd_custom_28 	);
9909 p_target_table(p_target_index).ytd_custom_29 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_29 	,	p_source_table(p_source_index).ytd_custom_29 	);
9910 p_target_table(p_target_index).ytd_custom_30 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ytd_custom_30 	,	p_source_table(p_source_index).ytd_custom_30 	);
9911 p_target_table(p_target_index).itd_custom_1 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_1 	,	p_source_table(p_source_index).itd_custom_1 	);
9912 p_target_table(p_target_index).itd_custom_2 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_2 	,	p_source_table(p_source_index).itd_custom_2 	);
9913 p_target_table(p_target_index).itd_custom_3 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_3 	,	p_source_table(p_source_index).itd_custom_3 	);
9914 p_target_table(p_target_index).itd_custom_4 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_4 	,	p_source_table(p_source_index).itd_custom_4 	);
9915 p_target_table(p_target_index).itd_custom_5 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_5 	,	p_source_table(p_source_index).itd_custom_5 	);
9916 p_target_table(p_target_index).itd_custom_6 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_6 	,	p_source_table(p_source_index).itd_custom_6 	);
9917 p_target_table(p_target_index).itd_custom_7 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_7 	,	p_source_table(p_source_index).itd_custom_7 	);
9918 p_target_table(p_target_index).itd_custom_8 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_8 	,	p_source_table(p_source_index).itd_custom_8 	);
9919 p_target_table(p_target_index).itd_custom_9 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_9 	,	p_source_table(p_source_index).itd_custom_9 	);
9920 p_target_table(p_target_index).itd_custom_10 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_10 	,	p_source_table(p_source_index).itd_custom_10 	);
9921 p_target_table(p_target_index).itd_custom_11 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_11 	,	p_source_table(p_source_index).itd_custom_11 	);
9922 p_target_table(p_target_index).itd_custom_12 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_12 	,	p_source_table(p_source_index).itd_custom_12 	);
9923 p_target_table(p_target_index).itd_custom_13 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_13 	,	p_source_table(p_source_index).itd_custom_13 	);
9924 p_target_table(p_target_index).itd_custom_14 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_14 	,	p_source_table(p_source_index).itd_custom_14 	);
9925 p_target_table(p_target_index).itd_custom_15 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_15 	,	p_source_table(p_source_index).itd_custom_15 	);
9926 p_target_table(p_target_index).itd_custom_16 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_16 	,	p_source_table(p_source_index).itd_custom_16 	);
9927 p_target_table(p_target_index).itd_custom_17 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_17 	,	p_source_table(p_source_index).itd_custom_17 	);
9928 p_target_table(p_target_index).itd_custom_18 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_18 	,	p_source_table(p_source_index).itd_custom_18 	);
9929 p_target_table(p_target_index).itd_custom_19 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_19 	,	p_source_table(p_source_index).itd_custom_19 	);
9930 p_target_table(p_target_index).itd_custom_20 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_20 	,	p_source_table(p_source_index).itd_custom_20 	);
9931 p_target_table(p_target_index).itd_custom_21 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_21 	,	p_source_table(p_source_index).itd_custom_21 	);
9932 p_target_table(p_target_index).itd_custom_22 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_22 	,	p_source_table(p_source_index).itd_custom_22 	);
9933 p_target_table(p_target_index).itd_custom_23 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_23 	,	p_source_table(p_source_index).itd_custom_23 	);
9934 p_target_table(p_target_index).itd_custom_24 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_24 	,	p_source_table(p_source_index).itd_custom_24 	);
9935 p_target_table(p_target_index).itd_custom_25 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_25 	,	p_source_table(p_source_index).itd_custom_25 	);
9936 p_target_table(p_target_index).itd_custom_26 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_26 	,	p_source_table(p_source_index).itd_custom_26 	);
9937 p_target_table(p_target_index).itd_custom_27 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_27 	,	p_source_table(p_source_index).itd_custom_27 	);
9938 p_target_table(p_target_index).itd_custom_28 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_28 	,	p_source_table(p_source_index).itd_custom_28 	);
9939 p_target_table(p_target_index).itd_custom_29 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_29 	,	p_source_table(p_source_index).itd_custom_29 	);
9940 p_target_table(p_target_index).itd_custom_30 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).itd_custom_30 	,	p_source_table(p_source_index).itd_custom_30 	);
9941 p_target_table(p_target_index).ac_custom_1 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_1 	,	p_source_table(p_source_index).ac_custom_1 	);
9942 p_target_table(p_target_index).ac_custom_2 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_2 	,	p_source_table(p_source_index).ac_custom_2 	);
9943 p_target_table(p_target_index).ac_custom_3 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_3 	,	p_source_table(p_source_index).ac_custom_3 	);
9944 p_target_table(p_target_index).ac_custom_4 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_4 	,	p_source_table(p_source_index).ac_custom_4 	);
9945 p_target_table(p_target_index).ac_custom_5 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_5 	,	p_source_table(p_source_index).ac_custom_5 	);
9946 p_target_table(p_target_index).ac_custom_6 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_6 	,	p_source_table(p_source_index).ac_custom_6 	);
9947 p_target_table(p_target_index).ac_custom_7 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_7 	,	p_source_table(p_source_index).ac_custom_7 	);
9948 p_target_table(p_target_index).ac_custom_8 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_8 	,	p_source_table(p_source_index).ac_custom_8 	);
9949 p_target_table(p_target_index).ac_custom_9 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_9 	,	p_source_table(p_source_index).ac_custom_9 	);
9950 p_target_table(p_target_index).ac_custom_10 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_10 	,	p_source_table(p_source_index).ac_custom_10 	);
9951 p_target_table(p_target_index).ac_custom_11 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_11 	,	p_source_table(p_source_index).ac_custom_11 	);
9952 p_target_table(p_target_index).ac_custom_12 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_12 	,	p_source_table(p_source_index).ac_custom_12 	);
9953 p_target_table(p_target_index).ac_custom_13 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_13 	,	p_source_table(p_source_index).ac_custom_13 	);
9954 p_target_table(p_target_index).ac_custom_14 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_14 	,	p_source_table(p_source_index).ac_custom_14 	);
9955 p_target_table(p_target_index).ac_custom_15 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_15 	,	p_source_table(p_source_index).ac_custom_15 	);
9956 p_target_table(p_target_index).ac_custom_16 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_16 	,	p_source_table(p_source_index).ac_custom_16 	);
9957 p_target_table(p_target_index).ac_custom_17 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_17 	,	p_source_table(p_source_index).ac_custom_17 	);
9958 p_target_table(p_target_index).ac_custom_18 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_18 	,	p_source_table(p_source_index).ac_custom_18 	);
9959 p_target_table(p_target_index).ac_custom_19 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_19 	,	p_source_table(p_source_index).ac_custom_19 	);
9960 p_target_table(p_target_index).ac_custom_20 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_20 	,	p_source_table(p_source_index).ac_custom_20 	);
9961 p_target_table(p_target_index).ac_custom_21 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_21 	,	p_source_table(p_source_index).ac_custom_21 	);
9962 p_target_table(p_target_index).ac_custom_22 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_22 	,	p_source_table(p_source_index).ac_custom_22 	);
9963 p_target_table(p_target_index).ac_custom_23 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_23 	,	p_source_table(p_source_index).ac_custom_23 	);
9964 p_target_table(p_target_index).ac_custom_24 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_24 	,	p_source_table(p_source_index).ac_custom_24 	);
9965 p_target_table(p_target_index).ac_custom_25 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_25 	,	p_source_table(p_source_index).ac_custom_25 	);
9966 p_target_table(p_target_index).ac_custom_26 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_26 	,	p_source_table(p_source_index).ac_custom_26 	);
9967 p_target_table(p_target_index).ac_custom_27 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_27 	,	p_source_table(p_source_index).ac_custom_27 	);
9968 p_target_table(p_target_index).ac_custom_28 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_28 	,	p_source_table(p_source_index).ac_custom_28 	);
9969 p_target_table(p_target_index).ac_custom_29 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_29 	,	p_source_table(p_source_index).ac_custom_29 	);
9970 p_target_table(p_target_index).ac_custom_30 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).ac_custom_30 	,	p_source_table(p_source_index).ac_custom_30 	);
9971 p_target_table(p_target_index).prp_custom_1 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_1 	,	p_source_table(p_source_index).prp_custom_1 	);
9972 p_target_table(p_target_index).prp_custom_2 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_2 	,	p_source_table(p_source_index).prp_custom_2 	);
9973 p_target_table(p_target_index).prp_custom_3 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_3 	,	p_source_table(p_source_index).prp_custom_3 	);
9974 p_target_table(p_target_index).prp_custom_4 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_4 	,	p_source_table(p_source_index).prp_custom_4 	);
9975 p_target_table(p_target_index).prp_custom_5 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_5 	,	p_source_table(p_source_index).prp_custom_5 	);
9976 p_target_table(p_target_index).prp_custom_6 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_6 	,	p_source_table(p_source_index).prp_custom_6 	);
9977 p_target_table(p_target_index).prp_custom_7 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_7 	,	p_source_table(p_source_index).prp_custom_7 	);
9978 p_target_table(p_target_index).prp_custom_8 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_8 	,	p_source_table(p_source_index).prp_custom_8 	);
9979 p_target_table(p_target_index).prp_custom_9 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_9 	,	p_source_table(p_source_index).prp_custom_9 	);
9980 p_target_table(p_target_index).prp_custom_10 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_10 	,	p_source_table(p_source_index).prp_custom_10 	);
9981 p_target_table(p_target_index).prp_custom_11 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_11 	,	p_source_table(p_source_index).prp_custom_11 	);
9982 p_target_table(p_target_index).prp_custom_12 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_12 	,	p_source_table(p_source_index).prp_custom_12 	);
9983 p_target_table(p_target_index).prp_custom_13 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_13 	,	p_source_table(p_source_index).prp_custom_13 	);
9984 p_target_table(p_target_index).prp_custom_14 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_14 	,	p_source_table(p_source_index).prp_custom_14 	);
9985 p_target_table(p_target_index).prp_custom_15 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_15 	,	p_source_table(p_source_index).prp_custom_15 	);
9986 p_target_table(p_target_index).prp_custom_16 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_16 	,	p_source_table(p_source_index).prp_custom_16 	);
9987 p_target_table(p_target_index).prp_custom_17 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_17 	,	p_source_table(p_source_index).prp_custom_17 	);
9988 p_target_table(p_target_index).prp_custom_18 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_18 	,	p_source_table(p_source_index).prp_custom_18 	);
9989 p_target_table(p_target_index).prp_custom_19 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_19 	,	p_source_table(p_source_index).prp_custom_19 	);
9990 p_target_table(p_target_index).prp_custom_20 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_20 	,	p_source_table(p_source_index).prp_custom_20 	);
9991 p_target_table(p_target_index).prp_custom_21 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_21 	,	p_source_table(p_source_index).prp_custom_21 	);
9992 p_target_table(p_target_index).prp_custom_22 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_22 	,	p_source_table(p_source_index).prp_custom_22 	);
9993 p_target_table(p_target_index).prp_custom_23 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_23 	,	p_source_table(p_source_index).prp_custom_23 	);
9994 p_target_table(p_target_index).prp_custom_24 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_24 	,	p_source_table(p_source_index).prp_custom_24 	);
9995 p_target_table(p_target_index).prp_custom_25 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_25 	,	p_source_table(p_source_index).prp_custom_25 	);
9996 p_target_table(p_target_index).prp_custom_26 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_26 	,	p_source_table(p_source_index).prp_custom_26 	);
9997 p_target_table(p_target_index).prp_custom_27 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_27 	,	p_source_table(p_source_index).prp_custom_27 	);
9998 p_target_table(p_target_index).prp_custom_28 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_28 	,	p_source_table(p_source_index).prp_custom_28 	);
9999 p_target_table(p_target_index).prp_custom_29 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_29 	,	p_source_table(p_source_index).prp_custom_29 	);
10000 p_target_table(p_target_index).prp_custom_30 	:=	Pji_Rep_Util.measures_total(	p_target_table(p_target_index).prp_custom_30 	,	p_source_table(p_source_index).prp_custom_30 	);
10001 
10002 END Merge_Overview_Type;
10003 
10004 /** Added for Bug 7533980
10005  * This procedure would be called from setFinancialAndActivityMeasuresWRP
10006  * method defined in ProjectListGenVOImpl. In accepts a table of Project
10007  * ids and returns back two tables that have financial measures and
10008  * exception indicators for All the passed project ids.
10009  */
10010 PROCEDURE Get_Financial_Measures_wrp
10011 (
10012     p_project_id_tbl             IN SYSTEM.pa_num_tbl_type
10013   , p_measure_codes_tbl          IN SYSTEM.PA_VARCHAR2_80_TBL_TYPE
10014   , p_measure_set_codes_tbl      IN SYSTEM.PA_VARCHAR2_30_TBL_TYPE DEFAULT NULL
10015   , p_timeslices_tbl   		 IN SYSTEM.PA_VARCHAR2_30_TBL_TYPE DEFAULT NULL
10016   , p_measure_id_tbl		 IN SYSTEM.PA_NUM_TBL_TYPE DEFAULT NULL
10017   , x_measure_values_tbl         OUT NOCOPY SYSTEM.PJI_FIN_MEAS_REC_TBL_TYPE
10018   , x_exception_indicator_tbl    OUT NOCOPY SYSTEM.PJI_EXCP_IND_REC_TBL_TYPE
10019   --, x_exception_labels_tbl       OUT NOCOPY SYSTEM.PA_VARCHAR2_240_TBL_TYPE
10020   , x_return_status              OUT NOCOPY VARCHAR2
10021   , x_msg_count                  OUT NOCOPY NUMBER
10022   , x_msg_data                   OUT NOCOPY VARCHAR2 -- not used
10023 )
10024 IS
10025 
10026   x_sec_ret_code          VARCHAR2(1);
10027 
10028   l_sec_return_status     VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
10029   l_sec_msg_count         NUMBER      := 0;
10030   l_sec_msg_data          VARCHAR2(1) := NULL;
10031 
10032   l_measure_values_tbl      SYSTEM.PA_VARCHAR2_80_TBL_TYPE;
10033   l_exception_indicator_tbl SYSTEM.PA_VARCHAR2_2000_TBL_TYPE;
10034 
10035   l_pji_fin_meas_rec  SYSTEM.PJI_FIN_MEAS_REC;
10036   l_pji_fin_meas_rec_tbl    SYSTEM.PJI_FIN_MEAS_REC_TBL_TYPE ;
10037 
10038   l_pji_excp_ind_rec  SYSTEM.PJI_EXCP_IND_REC;
10039   l_pji_excp_ind_rec_tbl SYSTEM.PJI_EXCP_IND_REC_TBL_TYPE;
10040 
10041   l_project_id_tbl            SYSTEM.pa_num_tbl_type;
10042 
10043 BEGIN
10044 
10045   l_project_id_tbl := p_project_id_tbl;
10046 
10047   IF (p_project_id_tbl.COUNT < 1 ) THEN
10048     x_measure_values_tbl := NULL ;
10049     x_exception_indicator_tbl := NULL ;
10050     RETURN ;
10051   END IF ;
10052 
10053   ----------------
10054   l_pji_fin_meas_rec := NULL ;
10055   l_pji_fin_meas_rec_tbl := SYSTEM.PJI_FIN_MEAS_REC_TBL_TYPE();
10056   l_pji_fin_meas_rec_tbl := SYSTEM.PJI_FIN_MEAS_REC_TBL_TYPE (l_pji_fin_meas_rec); -- initialize
10057 
10058   l_pji_fin_meas_rec_tbl.extend((p_project_id_tbl.COUNT - 1 ));
10059 
10060   -------------
10061   l_pji_excp_ind_rec := NULL ;
10062   l_pji_excp_ind_rec_tbl := SYSTEM.PJI_EXCP_IND_REC_TBL_TYPE();
10063   l_pji_excp_ind_rec_tbl := SYSTEM.PJI_EXCP_IND_REC_TBL_TYPE (l_pji_excp_ind_rec); -- initialize
10064 
10065   l_pji_excp_ind_rec_tbl.extend((p_project_id_tbl.COUNT - 1 ));
10066 
10067   --------------
10068 
10069 FOR i IN l_project_id_tbl.FIRST .. l_project_id_tbl.LAST LOOP
10070 
10071 l_measure_values_tbl      := SYSTEM.PA_VARCHAR2_80_TBL_TYPE();
10072 l_exception_indicator_tbl := SYSTEM.PA_VARCHAR2_2000_TBL_TYPE();
10073 
10074 x_sec_ret_code := 'F';
10075 
10076 PA_SECURITY_PVT.check_user_privilege
10077    (
10078       p_privilege     => 'PA_MY_PROJ_MAIN_TAB_PSI_COL',
10079       p_object_name   => 'PA_PROJECTS',
10080       p_object_key    => l_project_id_tbl(i),
10081       x_ret_code      => x_sec_ret_code,
10082       x_return_status => l_sec_return_status,
10083       x_msg_count     => l_sec_msg_count,
10084       x_msg_data      => l_sec_msg_data
10085    );
10086 
10087 IF (x_sec_ret_code = 'T') THEN
10088 
10089 /* This value will set context as Project List in downstream code
10090    where default currency is derived. This has been done so that
10091    Project List pages honors the value of profile option
10092    PJI:Default Reporting Currency Type
10093    Added for bug 9112216 */
10094 Pji_Rep_Util.G_PROJECT_LIST := 'Y';
10095 
10096 Get_Financial_Measures
10097 (
10098    p_project_id            => l_project_id_tbl(i)
10099  , p_measure_codes_tbl     => p_measure_codes_tbl
10100  , p_measure_set_codes_tbl => p_measure_set_codes_tbl
10101  , p_timeslices_tbl        => p_timeslices_tbl
10102  , p_measure_id_tbl        => p_measure_id_tbl
10103  , x_measure_values_tbl    => l_measure_values_tbl
10104  , x_exception_indicator_tbl => l_exception_indicator_tbl
10105  --, x_exception_labels_tbl    OUT NOCOPY SYSTEM.PA_VARCHAR2_240_TBL_TYPE -- remove
10106  , x_return_status           =>  x_return_status
10107  , x_msg_count               =>  x_msg_count
10108  , x_msg_data                =>  x_msg_data
10109 
10110 );
10111 
10112 
10113 l_pji_fin_meas_rec := SYSTEM.PJI_FIN_MEAS_REC( p_project_id_tbl(i),
10114 l_measure_values_tbl(1) ,
10115 l_measure_values_tbl(2) ,
10116 l_measure_values_tbl(3) ,
10117 l_measure_values_tbl(4) ,
10118 l_measure_values_tbl(5) ,
10119 l_measure_values_tbl(6) ,
10120 l_measure_values_tbl(7) ,
10121 l_measure_values_tbl(8) ,
10122 l_measure_values_tbl(9) ,
10123 l_measure_values_tbl(10) ,
10124 l_measure_values_tbl(11) ,
10125 l_measure_values_tbl(12) ,
10126 l_measure_values_tbl(13) ,
10127 l_measure_values_tbl(14) ,
10128 l_measure_values_tbl(15) ,
10129 l_measure_values_tbl(16) ,
10130 l_measure_values_tbl(17) ,
10131 l_measure_values_tbl(18) ,
10132 l_measure_values_tbl(19) ,
10133 l_measure_values_tbl(20) ,
10134 l_measure_values_tbl(21) ,
10135 l_measure_values_tbl(22) ,
10136 l_measure_values_tbl(23) ,
10137 l_measure_values_tbl(24) ,
10138 l_measure_values_tbl(25) ,
10139 l_measure_values_tbl(26) ,
10140 l_measure_values_tbl(27) ,
10141 l_measure_values_tbl(28) ,
10142 l_measure_values_tbl(29) ,
10143 l_measure_values_tbl(30) ,
10144 l_measure_values_tbl(31) ,
10145 l_measure_values_tbl(32) ,
10146 l_measure_values_tbl(33) ,
10147 l_measure_values_tbl(34) ,
10148 l_measure_values_tbl(35) ,
10149 l_measure_values_tbl(36) ,
10150 l_measure_values_tbl(37) ,
10151 l_measure_values_tbl(38) ,
10152 l_measure_values_tbl(39) ,
10153 l_measure_values_tbl(40) ,
10154 l_measure_values_tbl(41) ,
10155 l_measure_values_tbl(42) ,
10156 l_measure_values_tbl(43) ,
10157 l_measure_values_tbl(44) ,
10158 l_measure_values_tbl(45) ,
10159 l_measure_values_tbl(46) ,
10160 l_measure_values_tbl(47) ,
10161 l_measure_values_tbl(48) ,
10162 l_measure_values_tbl(49) ,
10163 l_measure_values_tbl(50) ,
10164 l_measure_values_tbl(51) ,
10165 l_measure_values_tbl(52) ,
10166 l_measure_values_tbl(53) ,
10167 l_measure_values_tbl(54) ,
10168 l_measure_values_tbl(55) ,
10169 l_measure_values_tbl(56) ,
10170 l_measure_values_tbl(57) ,
10171 l_measure_values_tbl(58) ,
10172 l_measure_values_tbl(59) ,
10173 l_measure_values_tbl(60) ,
10174 l_measure_values_tbl(61) ,
10175 l_measure_values_tbl(62) ,
10176 l_measure_values_tbl(63) ,
10177 l_measure_values_tbl(64) ,
10178 l_measure_values_tbl(65) ,
10179 l_measure_values_tbl(66) ,
10180 l_measure_values_tbl(67) ,
10181 l_measure_values_tbl(68) ,
10182 l_measure_values_tbl(69) ,
10183 l_measure_values_tbl(70) ,
10184 l_measure_values_tbl(71) ,
10185 l_measure_values_tbl(72) ,
10186 l_measure_values_tbl(73) ,
10187 l_measure_values_tbl(74) ,
10188 l_measure_values_tbl(75) ,
10189 l_measure_values_tbl(76) ,
10190 l_measure_values_tbl(77) ,
10191 l_measure_values_tbl(78) ,
10192 l_measure_values_tbl(79) ,
10193 l_measure_values_tbl(80) ,
10194 l_measure_values_tbl(81) ,      -- Bug 8810949 : Start
10195 l_measure_values_tbl(82) ,
10196 l_measure_values_tbl(83) ,
10197 l_measure_values_tbl(84) ,
10198 l_measure_values_tbl(85) ,
10199 l_measure_values_tbl(86) ,
10200 l_measure_values_tbl(87) ,
10201 l_measure_values_tbl(88) ,
10202 l_measure_values_tbl(89) ,
10203 l_measure_values_tbl(90) ,
10204 l_measure_values_tbl(91) ,
10205 l_measure_values_tbl(92) ,
10206 l_measure_values_tbl(93) ,
10207 l_measure_values_tbl(94) ,
10208 l_measure_values_tbl(95) ,
10209 l_measure_values_tbl(96) ,
10210 l_measure_values_tbl(97) ,
10211 l_measure_values_tbl(98) ,
10212 l_measure_values_tbl(99) ,
10213 l_measure_values_tbl(100) ,
10214 l_measure_values_tbl(101) ,
10215 l_measure_values_tbl(102) ,
10216 l_measure_values_tbl(103) ,
10217 l_measure_values_tbl(104) ,
10218 l_measure_values_tbl(105) ,
10219 l_measure_values_tbl(106) ,
10220 l_measure_values_tbl(107) ,
10221 l_measure_values_tbl(108) ,
10222 l_measure_values_tbl(109) ,
10223 l_measure_values_tbl(110) ,
10224 l_measure_values_tbl(111) ,
10225 l_measure_values_tbl(112) ,
10226 l_measure_values_tbl(113) ,
10227 l_measure_values_tbl(114) ,
10228 l_measure_values_tbl(115) ,
10229 l_measure_values_tbl(116) ,
10230 l_measure_values_tbl(117) ,
10231 l_measure_values_tbl(118) ,
10232 l_measure_values_tbl(119) ,
10233 l_measure_values_tbl(120) ,
10234 l_measure_values_tbl(121) ,
10235 l_measure_values_tbl(122) ,
10236 l_measure_values_tbl(123) ,
10237 l_measure_values_tbl(124) ,
10238 l_measure_values_tbl(125) ,
10239 l_measure_values_tbl(126) ,
10240 l_measure_values_tbl(127) ,
10241 l_measure_values_tbl(128) ,
10242 l_measure_values_tbl(129) ,
10243 l_measure_values_tbl(130) ,
10244 l_measure_values_tbl(131) ,
10245 l_measure_values_tbl(132) ,
10246 l_measure_values_tbl(133) ,
10247 l_measure_values_tbl(134) ,
10248 l_measure_values_tbl(135) ,
10249 l_measure_values_tbl(136) ,
10250 l_measure_values_tbl(137) ,
10251 l_measure_values_tbl(138) ,
10252 l_measure_values_tbl(139) ,
10253 l_measure_values_tbl(140) ,
10254 l_measure_values_tbl(141) ,
10255 l_measure_values_tbl(142) ,
10256 l_measure_values_tbl(143) ,
10257 l_measure_values_tbl(144) ,
10258 l_measure_values_tbl(145) ,
10259 l_measure_values_tbl(146) ,
10260 l_measure_values_tbl(147) ,
10261 l_measure_values_tbl(148) ,
10262 l_measure_values_tbl(149) ,
10263 l_measure_values_tbl(150) ,
10264 l_measure_values_tbl(151) ,
10265 l_measure_values_tbl(152) ,
10266 l_measure_values_tbl(153) ,
10267 l_measure_values_tbl(154) ,
10268 l_measure_values_tbl(155) ,
10269 l_measure_values_tbl(156) ,
10270 l_measure_values_tbl(157) ,
10271 l_measure_values_tbl(158) ,
10272 l_measure_values_tbl(159) ,
10273 l_measure_values_tbl(160) ,
10274 l_measure_values_tbl(161) ,
10275 l_measure_values_tbl(162) ,
10276 l_measure_values_tbl(163) );      -- Bug 8810949 : End
10277 
10278 l_pji_fin_meas_rec_tbl(i) := l_pji_fin_meas_rec;
10279 
10280 ----------------
10281 
10282 l_pji_excp_ind_rec := SYSTEM.PJI_EXCP_IND_REC( p_project_id_tbl(i),
10283 l_exception_indicator_tbl(1) ,
10284 l_exception_indicator_tbl(2) ,
10285 l_exception_indicator_tbl(3) ,
10286 l_exception_indicator_tbl(4) ,
10287 l_exception_indicator_tbl(5) ,
10288 l_exception_indicator_tbl(6) ,
10289 l_exception_indicator_tbl(7) ,
10290 l_exception_indicator_tbl(8) ,
10291 l_exception_indicator_tbl(9) ,
10292 l_exception_indicator_tbl(10) ,
10293 l_exception_indicator_tbl(11) ,
10294 l_exception_indicator_tbl(12) ,
10295 l_exception_indicator_tbl(13) ,
10296 l_exception_indicator_tbl(14) ,
10297 l_exception_indicator_tbl(15) ,
10298 l_exception_indicator_tbl(16) ,
10299 l_exception_indicator_tbl(17) ,
10300 l_exception_indicator_tbl(18) ,
10301 l_exception_indicator_tbl(19) ,
10302 l_exception_indicator_tbl(20) ,
10303 l_exception_indicator_tbl(21) ,
10304 l_exception_indicator_tbl(22) ,
10305 l_exception_indicator_tbl(23) ,
10306 l_exception_indicator_tbl(24) ,
10307 l_exception_indicator_tbl(25) ,
10308 l_exception_indicator_tbl(26) ,
10309 l_exception_indicator_tbl(27) ,
10310 l_exception_indicator_tbl(28) ,
10311 l_exception_indicator_tbl(29) ,
10312 l_exception_indicator_tbl(30) ,
10313 l_exception_indicator_tbl(31) ,
10314 l_exception_indicator_tbl(32) ,
10315 l_exception_indicator_tbl(33) ,
10316 l_exception_indicator_tbl(34) ,
10317 l_exception_indicator_tbl(35) ,
10318 l_exception_indicator_tbl(36) ,
10319 l_exception_indicator_tbl(37) ,
10320 l_exception_indicator_tbl(38) ,
10321 l_exception_indicator_tbl(39) ,
10322 l_exception_indicator_tbl(40) ,
10323 l_exception_indicator_tbl(41) ,
10324 l_exception_indicator_tbl(42) ,
10325 l_exception_indicator_tbl(43) ,
10326 l_exception_indicator_tbl(44) ,
10327 l_exception_indicator_tbl(45) ,
10328 l_exception_indicator_tbl(46) ,
10329 l_exception_indicator_tbl(47) ,
10330 l_exception_indicator_tbl(48) ,
10331 l_exception_indicator_tbl(49) ,
10332 l_exception_indicator_tbl(50) ,
10333 l_exception_indicator_tbl(51) ,
10334 l_exception_indicator_tbl(52) ,
10335 l_exception_indicator_tbl(53) ,
10336 l_exception_indicator_tbl(54) ,
10337 l_exception_indicator_tbl(55) ,
10338 l_exception_indicator_tbl(56) ,
10339 l_exception_indicator_tbl(57) ,
10340 l_exception_indicator_tbl(58) ,
10341 l_exception_indicator_tbl(59) ,
10342 l_exception_indicator_tbl(60) ,
10343 l_exception_indicator_tbl(61) ,
10344 l_exception_indicator_tbl(62) ,
10345 l_exception_indicator_tbl(63) ,
10346 l_exception_indicator_tbl(64) ,
10347 l_exception_indicator_tbl(65) ,
10348 l_exception_indicator_tbl(66) ,
10349 l_exception_indicator_tbl(67) ,
10350 l_exception_indicator_tbl(68) ,
10351 l_exception_indicator_tbl(69) ,
10352 l_exception_indicator_tbl(70) ,
10353 l_exception_indicator_tbl(71) ,
10354 l_exception_indicator_tbl(72) ,
10355 l_exception_indicator_tbl(73) ,
10356 l_exception_indicator_tbl(74) ,
10357 l_exception_indicator_tbl(75) ,
10358 l_exception_indicator_tbl(76) ,
10359 l_exception_indicator_tbl(77) ,
10360 l_exception_indicator_tbl(78) ,
10361 l_exception_indicator_tbl(79) ,
10362 l_exception_indicator_tbl(80) ,
10363 l_exception_indicator_tbl(81) ,      -- Bug 8810949 : Start
10364 l_exception_indicator_tbl(82) ,
10365 l_exception_indicator_tbl(83) ,
10366 l_exception_indicator_tbl(84) ,
10367 l_exception_indicator_tbl(85) ,
10368 l_exception_indicator_tbl(86) ,
10369 l_exception_indicator_tbl(87) ,
10370 l_exception_indicator_tbl(88) ,
10371 l_exception_indicator_tbl(89) ,
10372 l_exception_indicator_tbl(90) ,
10373 l_exception_indicator_tbl(91) ,
10374 l_exception_indicator_tbl(92) ,
10375 l_exception_indicator_tbl(93) ,
10376 l_exception_indicator_tbl(94) ,
10377 l_exception_indicator_tbl(95) ,
10378 l_exception_indicator_tbl(96) ,
10379 l_exception_indicator_tbl(97) ,
10380 l_exception_indicator_tbl(98) ,
10381 l_exception_indicator_tbl(99) ,
10382 l_exception_indicator_tbl(100) ,
10383 l_exception_indicator_tbl(101) ,
10384 l_exception_indicator_tbl(102) ,
10385 l_exception_indicator_tbl(103) ,
10386 l_exception_indicator_tbl(104) ,
10387 l_exception_indicator_tbl(105) ,
10388 l_exception_indicator_tbl(106) ,
10389 l_exception_indicator_tbl(107) ,
10390 l_exception_indicator_tbl(108) ,
10391 l_exception_indicator_tbl(109) ,
10392 l_exception_indicator_tbl(110) ,
10393 l_exception_indicator_tbl(111) ,
10394 l_exception_indicator_tbl(112) ,
10395 l_exception_indicator_tbl(113) ,
10396 l_exception_indicator_tbl(114) ,
10397 l_exception_indicator_tbl(115) ,
10398 l_exception_indicator_tbl(116) ,
10399 l_exception_indicator_tbl(117) ,
10400 l_exception_indicator_tbl(118) ,
10401 l_exception_indicator_tbl(119) ,
10402 l_exception_indicator_tbl(120) ,
10403 l_exception_indicator_tbl(121) ,
10404 l_exception_indicator_tbl(122) ,
10405 l_exception_indicator_tbl(123) ,
10406 l_exception_indicator_tbl(124) ,
10407 l_exception_indicator_tbl(125) ,
10408 l_exception_indicator_tbl(126) ,
10409 l_exception_indicator_tbl(127) ,
10410 l_exception_indicator_tbl(128) ,
10411 l_exception_indicator_tbl(129) ,
10412 l_exception_indicator_tbl(130) ,
10413 l_exception_indicator_tbl(131) ,
10414 l_exception_indicator_tbl(132) ,
10415 l_exception_indicator_tbl(133) ,
10416 l_exception_indicator_tbl(134) ,
10417 l_exception_indicator_tbl(135) ,
10418 l_exception_indicator_tbl(136) ,
10419 l_exception_indicator_tbl(137) ,
10420 l_exception_indicator_tbl(138) ,
10421 l_exception_indicator_tbl(139) ,
10422 l_exception_indicator_tbl(140) ,
10423 l_exception_indicator_tbl(141) ,
10424 l_exception_indicator_tbl(142) ,
10425 l_exception_indicator_tbl(143) ,
10426 l_exception_indicator_tbl(144) ,
10427 l_exception_indicator_tbl(145) ,
10428 l_exception_indicator_tbl(146) ,
10429 l_exception_indicator_tbl(147) ,
10430 l_exception_indicator_tbl(148) ,
10431 l_exception_indicator_tbl(149) ,
10432 l_exception_indicator_tbl(150) ,
10433 l_exception_indicator_tbl(151) ,
10434 l_exception_indicator_tbl(152) ,
10435 l_exception_indicator_tbl(153) ,
10436 l_exception_indicator_tbl(154) ,
10437 l_exception_indicator_tbl(155) ,
10438 l_exception_indicator_tbl(156) ,
10439 l_exception_indicator_tbl(157) ,
10440 l_exception_indicator_tbl(158) ,
10441 l_exception_indicator_tbl(159) ,
10442 l_exception_indicator_tbl(160) ,
10443 l_exception_indicator_tbl(161) ,
10444 l_exception_indicator_tbl(162) ,
10445 l_exception_indicator_tbl(163) );      -- Bug 8810949 : End
10446 
10447 l_pji_excp_ind_rec_tbl(i) := l_pji_excp_ind_rec;
10448 
10449 END IF ; -- IF (x_sec_ret_code = 'T')
10450 
10451 END LOOP ;
10452 
10453 x_measure_values_tbl := l_pji_fin_meas_rec_tbl;
10454 x_exception_indicator_tbl := l_pji_excp_ind_rec_tbl;
10455 
10456 END Get_Financial_Measures_wrp;
10457 
10458 BEGIN
10459 
10460 g_msg_level_highest_detail := 6;
10461 g_msg_level_normal_flow    := 5;
10462 g_msg_level_data_bug       := 5;
10463 g_msg_level_data_corruption:= 5;
10464 g_msg_level_proc_call      := 5;
10465 g_msg_level_runtime_info   := 5;
10466 g_msg_level_low_detail     := 2;
10467 g_msg_level_lowest_detail  := 1;
10468 
10469 g_CurrencyType             := 'CURRENCY';
10470 g_PercentType              := 'PERCENT';
10471 g_HoursType                := 'EFFORT';
10472 g_IndexType                := 'INDEX';
10473 g_OtherType               := 'OTHER';
10474 g_DaysType				   := 'DAYS';
10475 
10476 g_CurrencyDecimalPlaces    := 0; -- Currencies must be rounded to the nearest integer ##TBD##
10477 g_HoursDecimalPlaces       := 0; -- Hours must be rounded to the nearest integer
10478 g_PercentDecimalPlaces     := 2; -- Percentages must be rounded to 2 decimal place
10479 g_IndexDecimalPlaces       := 2; -- Indexes must be rounded to 2 decimal place
10480 g_currency_size            := 30;
10481 
10482 g_Actual_is_present        := 1;
10483 g_CstFcst_is_present       := 2;
10484 g_CstBudget_is_present     := 4;
10485 g_CstBudget2_is_present    := 8;
10486 g_RevFcst_is_present       := 16;
10487 g_RevBudget_is_present     := 32;
10488 g_RevBudget2_is_present    := 64;
10489 g_OrigCstFcst_is_present   := 128;
10490 g_OrigCstBudget_is_present := 256;
10491 g_OrigCstBudget2_is_present:= 512;
10492 g_OrigRevFcst_is_present   := 1024;
10493 g_OrigRevBudget_is_present := 2048;
10494 g_OrigRevBudget2_is_present:= 4096;
10495 g_CstPriorfcst_is_present  := 8192;
10496 g_RevPriorfcst_is_present  := 16384;
10497 g_Actual_CstBudget         := g_Actual_is_present + g_CstBudget_is_present;
10498 g_Actual_CstFcst           := g_Actual_is_present + g_CstFcst_is_present;
10499 g_Actual_CstRevBudget      := g_Actual_is_present + g_CstBudget_is_present + g_RevBudget_is_present;
10500 g_Actual_RevBudget         := g_Actual_is_present + g_RevBudget_is_present;
10501 g_Actual_RevFcst           := g_Actual_is_present + g_RevFcst_is_present;
10502 g_CstRevBudget             := g_CstBudget_is_present + g_RevBudget_is_present;
10503 g_CstRevBudget2            := g_CstBudget2_is_present + g_RevBudget2_is_present;
10504 g_CstRevFcst               := g_CstFcst_is_present + g_RevFcst_is_present;
10505 g_CstBudget_CstFcst        := g_CstBudget_is_present + g_CstFcst_is_present;
10506 g_RevBudget_RevFcst        := g_RevBudget_is_present + g_RevFcst_is_present;
10507 g_CstRevBudgetFcst         := g_CstBudget_is_present + g_RevBudget_is_present + g_CstFcst_is_present + g_RevFcst_is_present;
10508 g_CstOrigCstBudget         := g_CstBudget_is_present + g_OrigCstBudget_is_present;
10509 g_CstFcst_OrigCstBudget    := g_CstFcst_is_present + g_OrigCstBudget_is_present;
10510 g_CstRevBudgetOrigbudget   := g_CstBudget_is_present + g_RevBudget_is_present + g_OrigCstBudget_is_present + g_OrigRevBudget_is_present;
10511 g_RevBudgetOrigbudget      := g_RevBudget_is_present + g_OrigRevBudget_is_present;
10512 g_CstRevOrigbudgetFcst     := g_OrigCstBudget_is_present + g_OrigRevBudget_is_present + g_CstFcst_is_present + g_RevFcst_is_present;
10513 g_RevBudgetFcst            := g_RevBudget_is_present + g_RevFcst_is_present;
10514 g_RevOrigbudgetFcst        := g_RevFcst_is_present + g_OrigRevBudget_is_present;
10515 g_CstRevFcstPriorfcst      := g_CstPriorfcst_is_present + g_RevPriorfcst_is_present + g_CstFcst_is_present + g_RevFcst_is_present;
10516 g_RevFcstRevPriorfcst      := g_RevFcst_is_present + g_RevPriorfcst_is_present;
10517 g_CstFcstCstPriorfcst      := g_CstFcst_is_present + g_CstPriorfcst_is_present;
10518 g_Cst_FcstPriorfcst        := g_CstBudget_is_present + g_CstPriorfcst_is_present;
10519 
10520 END Pji_Rep_Measure_Util;