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