DBA Data[Home] [Help]

PACKAGE BODY: APPS.PJI_FM_PLAN_CAL_RLPS_T

Source


1 PACKAGE BODY PJI_FM_PLAN_CAL_RLPS_T AS
2 /* $Header: PJIPP05B.pls 120.16 2011/11/10 00:41:00 jngeorge ship $ */
3 
4 
5 g_package_name      VARCHAR2(100) := 'PJI_FM_PLAN_CAL_RLPS_T';
6 
7 g_worker_id         NUMBER        := 1; -- PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
8 g_default_prg_level NUMBER        := 0;
9 
10 PROCEDURE PRINT_TIME(p_tag IN VARCHAR2);
11 
12 
13 
14 PROCEDURE CREATE_FP_PA_ROLLUP IS -- Public
15 BEGIN
16   CREATE_FP_PA_PRI_ROLLUP ;
17 EXCEPTION
18   WHEN OTHERS THEN
19     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
20                              p_procedure_name => 'CREATE_FP_PA_ROLLUP');
21     RAISE;
22 END;
23 
24 
25 PROCEDURE CREATE_FP_GL_ROLLUP IS -- Public
26 BEGIN
27   CREATE_FP_GL_PRI_ROLLUP ;
28 EXCEPTION
29   WHEN OTHERS THEN
30     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
31                              p_procedure_name => 'CREATE_FP_GL_ROLLUP');
32     RAISE;
33 END;
34 
35 PROCEDURE CREATE_FP_NONTP_ROLLUP IS -- Public. Not needed.
36 BEGIN
37   NULL;
38 EXCEPTION
39   WHEN OTHERS THEN
40     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
41                              p_procedure_name => 'CREATE_FP_NONTP_ROLLUP');
42     RAISE;
43 END;
44 
45 
46 PROCEDURE CREATE_FP_ENT_ROLLUP IS -- Public
47 /*Start for Bug# 9737300   */
48  l_entyear_id number;                /* For bug 10305483  */
49   l_laborhrs number;
50   l_effort_adj number;
51 
52   -- Added below for Bug 11684017
53   l_entperiod_id   number;
54   l_prd_laborhrs   number;
55   l_effort_adj_prd number;
56   --End of Bug 11684017
57 
58 
59   CURSOR c_budget_lines_csr IS
60     select distinct plnt.project_id, sum(pbl.quantity) quantity,
61            ra.planning_start_date, ra.planning_end_date, ra.task_id,
62            plnt.plan_type_code, plnt.plan_version_id, plnt.rbs_struct_version_id    /* For bug 10305483  */
63     from pa_budget_lines pbl, pji_fm_extr_plnver3_t plnt,
64          pa_resource_assignments  ra
65     where pbl.budget_version_id = plnt.plan_version_id
66     and ra.resource_assignment_id =pbl.resource_asSIGNment_id
67     and ra.project_id = plnt.project_id
68     and ra.resource_class_code = 'PEOPLE'
69     and plnt.secondary_rbs_flag = 'N'
70     group by plnt.project_id, ra.planning_start_date, ra.planning_end_date,
71              ra.task_id, plnt.plan_type_code, plnt.plan_version_id, plnt.rbs_struct_version_id;        /* For bug 10305483  */
72 /* End of Bug# 9737300 */
73 BEGIN
74 
75   -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
76 
77   INSERT INTO PJI_FP_AGGR_PJP1_T
78   (
79        WORKER_ID
80      , PROJECT_ID
81      , PROJECT_ORG_ID
82      , PROJECT_ORGANIZATION_ID
83      , PROJECT_ELEMENT_ID
84      , TIME_ID
85      , PERIOD_TYPE_ID
86      , CALENDAR_TYPE
87      , RBS_AGGR_LEVEL
88      , WBS_ROLLUP_FLAG
89      , PRG_ROLLUP_FLAG
90      , CURR_RECORD_TYPE_ID
91      , CURRENCY_CODE
92      , RBS_ELEMENT_ID
93      , RBS_VERSION_ID
94      , PLAN_VERSION_ID
95      , PLAN_TYPE_ID
96      , RAW_COST
97      , BRDN_COST
98      , REVENUE
99      , BILL_RAW_COST
100      , BILL_BRDN_COST
101      , BILL_LABOR_RAW_COST
102      , BILL_LABOR_BRDN_COST
103      , BILL_LABOR_HRS
104      , EQUIPMENT_RAW_COST
105      , EQUIPMENT_BRDN_COST
106      , CAPITALIZABLE_RAW_COST
107      , CAPITALIZABLE_BRDN_COST
108      , LABOR_RAW_COST
109      , LABOR_BRDN_COST
110      , LABOR_HRS
111      , LABOR_REVENUE
112      , EQUIPMENT_HOURS
113      , BILLABLE_EQUIPMENT_HOURS
114      , SUP_INV_COMMITTED_COST
115      , PO_COMMITTED_COST
116      , PR_COMMITTED_COST
117      , OTH_COMMITTED_COST
118        , ACT_LABOR_HRS
119 	   , ACT_EQUIP_HRS
120 	   , ACT_LABOR_BRDN_COST
121 	   , ACT_EQUIP_BRDN_COST
122 	   , ACT_BRDN_COST
123 	   , ACT_RAW_COST
124 	   , ACT_REVENUE
125          , ACT_LABOR_RAW_COST
126          , ACT_EQUIP_RAW_COST
127 	   , ETC_LABOR_HRS
128 	   , ETC_EQUIP_HRS
129 	   , ETC_LABOR_BRDN_COST
130 	   , ETC_EQUIP_BRDN_COST
131 	   , ETC_BRDN_COST
132          , ETC_RAW_COST
133          , ETC_LABOR_RAW_COST
134          , ETC_EQUIP_RAW_COST
135      , CUSTOM1
136      , CUSTOM2
137      , CUSTOM3
138      , CUSTOM4
139      , CUSTOM5
140      , CUSTOM6
141      , CUSTOM7
142      , CUSTOM8
143      , CUSTOM9
144      , CUSTOM10
145      , CUSTOM11
146      , CUSTOM12
147      , CUSTOM13
148      , CUSTOM14
149      , CUSTOM15
150      , LINE_TYPE
151      , PRG_LEVEL
152      , PLAN_TYPE_CODE   /* 4471527 */
153   )
154   SELECT * FROM (
155   SELECT
156       g_worker_id
157     , fact1.PROJECT_ID
158     , fact1.PROJECT_ORG_ID
159     , fact1.PROJECT_ORGANIZATION_ID
160     , fact1.PROJECT_ELEMENT_ID
161     , DECODE (
162                (grouping(qtr.ENT_YEAR_ID) || grouping(period.ENT_QTR_ID) || grouping(period.ENT_PERIOD_ID) )
163              , '000', period.ENT_PERIOD_ID
164              , '001', period.ENT_QTR_ID
165              , '011', qtr.ENT_YEAR_ID
166              , '111', -1 ) TIME_ID
167     , DECODE (
168                (grouping(qtr.ENT_YEAR_ID) || grouping(period.ENT_QTR_ID) || grouping(period.ENT_PERIOD_ID) )
169              , '000', 32
170              , '001', 64
171              , '011', 128
172              , '111', 2048 ) PERIOD_TYPE_ID
173     , DECODE (
174                grouping(qtr.ENT_YEAR_ID)
175              , 0 , 'E'
176              , 'A') CALENDAR_TYPE
177     , RBS_AGGR_LEVEL
178     , WBS_ROLLUP_FLAG
179     , PRG_ROLLUP_FLAG
180     , fact1.CURR_RECORD_TYPE_ID
181     , fact1.CURRENCY_CODE
182     , fact1.RBS_ELEMENT_ID
183     , fact1.RBS_VERSION_ID
184     , fact1.PLAN_VERSION_ID
185     , fact1.plan_type_id
186     , SUM(fact1.RAW_COST)
187     , SUM(fact1.BRDN_COST)
188     , SUM(fact1.REVENUE)
189     , SUM(fact1.BILL_RAW_COST)
190     , SUM(fact1.BILL_BRDN_COST )
191     , SUM(fact1.BILL_LABOR_RAW_COST)
192     , SUM(fact1.BILL_LABOR_BRDN_COST )
193     , SUM(fact1.BILL_LABOR_HRS )
194     , SUM(fact1.EQUIPMENT_RAW_COST )
195     , SUM(fact1.EQUIPMENT_BRDN_COST )
196     , SUM(fact1.CAPITALIZABLE_RAW_COST )
197     , SUM(fact1.CAPITALIZABLE_BRDN_COST )
198     , SUM(fact1.LABOR_RAW_COST )
199     , SUM(fact1.LABOR_BRDN_COST )
200     , SUM(fact1.LABOR_HRS)
201     , SUM(fact1.LABOR_REVENUE)
202     , SUM(fact1.EQUIPMENT_HOURS)
203     , SUM(fact1.BILLABLE_EQUIPMENT_HOURS)
204     , SUM(fact1.SUP_INV_COMMITTED_COST)
205     , SUM(fact1.PO_COMMITTED_COST   )
206     , SUM(fact1.PR_COMMITTED_COST  )
207     , SUM(fact1.OTH_COMMITTED_COST)
208        , SUM(fact1.ACT_LABOR_HRS)
209 	 , SUM(fact1.ACT_EQUIP_HRS)
210 	 , SUM(fact1.ACT_LABOR_BRDN_COST)
211 	 , SUM(fact1.ACT_EQUIP_BRDN_COST)
212 	 , SUM(fact1.ACT_BRDN_COST)
213 	 , SUM(fact1.ACT_RAW_COST)
214 	 , SUM(fact1.ACT_REVENUE)
215        , SUM(fact1.ACT_LABOR_RAW_COST)
216        , SUM(fact1.ACT_EQUIP_RAW_COST)
217 	 , SUM(fact1.ETC_LABOR_HRS)
218 	 , SUM(fact1.ETC_EQUIP_HRS)
219 	 , SUM(fact1.ETC_LABOR_BRDN_COST)
220 	 , SUM(fact1.ETC_EQUIP_BRDN_COST)
221 	 , SUM(fact1.ETC_BRDN_COST )
222        , SUM(fact1.ETC_RAW_COST )
223        , SUM(fact1.ETC_LABOR_RAW_COST)
224        , SUM(fact1.ETC_EQUIP_RAW_COST)
225     , SUM(CUSTOM1	)
226     , SUM(CUSTOM2	)
227     , SUM(CUSTOM3	)
228     , SUM(CUSTOM4	)
229     , SUM(CUSTOM5	)
230     , SUM(CUSTOM6	)
231     , SUM(CUSTOM7	)
232     , SUM(CUSTOM8	)
233     , SUM(CUSTOM9	)
234     , SUM(CUSTOM10	)
235     , SUM(CUSTOM11	)
236     , SUM(CUSTOM12	)
237     , SUM(CUSTOM13	)
238     , SUM(CUSTOM14	)
239     , SUM(CUSTOM15)
240     , 'ENTR'
241     , g_default_prg_level prg_level
242     , fact1.PLAN_TYPE_CODE PLAN_TYPE_CODE   /* 4471527 */
243     FROM
244 	  PJI_FP_AGGR_PJP1_T fact1  -- ,  PJI_FM_EXTR_PLNVER3_T ver
245       , pji_time_ENT_PERIOD period
246 	, pji_time_ENT_QTR    qtr
247     , pji_fm_extr_plnver3_t  ver
248     WHERE
249         fact1.calendar_type = 'E'
250     AND period.ENT_period_id = fact1.time_id
251     AND period.ENT_qtr_id = qtr.ENT_qtr_id
252     AND fact1.period_type_id = 32
253     AND fact1.worker_id = g_worker_id
254    -- AND fact1.rbs_version_id IN (ver.rbs_struct_version_id, -1)   /* 4632551 */
255     AND NVL(ver.rbs_struct_version_id, -1) = fact1.rbs_version_id
256     -- AND ver.secondary_rbs_flag = 'N'
257     AND fact1.plan_version_id = ver.plan_version_id
258     AND fact1.plan_type_code = ver.plan_type_code    /* 4471527 */
259 	GROUP BY
260  	  fact1.PROJECT_ID
261     , fact1.PROJECT_ORG_ID
262     , fact1.PROJECT_ORGANIZATION_ID
263     , fact1.PROJECT_ELEMENT_ID
264     , fact1.calendar_type
265     , RBS_AGGR_LEVEL
266     , WBS_ROLLUP_FLAG
267     , PRG_ROLLUP_FLAG
268     , fact1.CURR_RECORD_TYPE_ID
269     , fact1.CURRENCY_CODE
270     , fact1.RBS_ELEMENT_ID
271     , fact1.RBS_VERSION_ID
272     , fact1.PLAN_VERSION_ID
273     , fact1.plan_type_id
274     , fact1.plan_type_code    /* 4471527 */
275     , rollup (qtr.ENT_YEAR_ID,
276               period.ENT_QTR_ID,
277               period.ENT_PERIOD_ID))
278    WHERE period_type_id > 32
279      AND period_type_id < 2048;
280   /* Start for Bug# 9737300  */
281   BEGIN
282      commit;         -- For Bug  10305483
283      FOR i IN c_budget_lines_csr loop
284       begin                                               --Bug 10163571
285        select ent_year_id  -- Bug 10305483  -- select ent_year_id instead of ent_period_id
286               ,ent_period_id -- Bug 13365563 --period id also needed
287        into l_entyear_id, l_entperiod_id -- For Bug  10305483
288        from pji_time_ENT_PERIOD
289        where trunc(i.planning_end_date) between
290              trunc(start_date) and trunc(end_date);
291               exception                                    --Bug 10163571
292         when no_data_found then                            --Bug 10163571
293 	      l_entyear_id := -99;                               --Bug 10163571  /*For Bug 10305483 */
294 	      l_entperiod_id := -99;    --Bug 13365563  /*For Bug 10305483 */
295       end;                                                 --Bug 10163571
296 
297       if l_entyear_id <> -99 then                        --Bug 10163571      /*For Bug 10305483 */
298 
299        select sum(labor_hrs) into l_laborhrs
300        from PJI_FP_AGGR_PJP1_T
301        where project_id = i.project_id
302       -- and period_type_id = 32                      /*For Bug 10305483 */
303       and period_type_id = 128     -- Bug 10305483  - select value for yearly instead of period
304        and calendar_type = 'E'
305        and plan_type_code = i.plan_type_code
306        and plan_version_id = i.plan_version_id
307        and project_element_id = i.task_id
308        and rbs_version_id = i.rbs_struct_version_id       /*Added For Bug 10305483 */
309        and worker_id = g_worker_id;
310 
311        -- Added for Bug 13365563
312        select sum(labor_hrs) into l_prd_laborhrs
313        from PJI_FP_AGGR_PJP1_T
314        where project_id = i.project_id
315        and period_type_id = 32
316        and calendar_type = 'E'
317        and plan_type_code = i.plan_type_code
318        and plan_version_id = i.plan_version_id
319        and project_element_id = i.task_id
320        and rbs_version_id = i.rbs_struct_version_id
321        and worker_id = g_worker_id;
322        -- Added for Bug 13365563
323 
324        l_effort_adj := 0;
325        l_effort_adj_prd := 0; -- Added for Bug 13365563
326        l_effort_adj := i.quantity - l_laborhrs;
327        l_effort_adj_prd := i.quantity - l_prd_laborhrs; --Added for Bug 13365563
328 
329        If (l_effort_adj <> 0) Then
330          select sum(labor_hrs) into l_laborhrs      /* For Bug 10305483 */
331          from PJI_FP_AGGR_PJP1_T                     /* For Bug 10305483 */
332          where project_id = i.project_id
333         and time_id = l_entyear_id                   /* For Bug 10305483 */
334          /*Added For Bug 10305483 */
335             and project_element_id = i.task_id
336          and RBS_VERSION_ID = i.rbs_struct_version_id
337          and worker_id = g_worker_id;
338 
339          update PJI_FP_AGGR_PJP1_T
340          set labor_hrs = labor_hrs + l_effort_adj
341          where project_id = i.project_id
342          and time_id = l_entyear_id
343           /*Added For Bug 10305483 */
344          and project_element_id = i.task_id
345          and RBS_VERSION_ID = i.rbs_struct_version_id         /*Added For Bug 10305483 */
346          and worker_id = g_worker_id;
347        end if;
348 
349        --Added for Bug 13365563
350        If (l_effort_adj_prd <> 0) Then
351        select sum(labor_hrs) into l_prd_laborhrs
352        from PJI_FP_AGGR_PJP1_T
353          where project_id = i.project_id
354          and time_id = l_entperiod_id
355          and project_element_id = i.task_id
356          and RBS_VERSION_ID = i.rbs_struct_version_id
357          and worker_id = g_worker_id;
358 
359 
360          update PJI_FP_AGGR_PJP1_T
361          set labor_hrs = labor_hrs + l_effort_adj_prd
362          where project_id = i.project_id
363          and time_id = l_entperiod_id
364          and project_element_id = i.task_id
365          and RBS_VERSION_ID = i.rbs_struct_version_id
366          and worker_id = g_worker_id;
367 
368        end if;
369        -- End of Bug 13365563
370 
371        end if; /* if l_entyear_id <> -99 then */ --Bug 10163571 /* For Bug 10305483 */
372      END LOOP;
373     commit;        /*Added For Bug 10305483 */
374    END;
375 /*End of Bug# 9737300  */
376 
377 EXCEPTION
378   WHEN OTHERS THEN
379     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
380                              p_procedure_name => 'CREATE_FP_ENT_ROLLUP');
381     RAISE;
382 END;
383 
384 
385 PROCEDURE CREATE_FP_PA_PRI_ROLLUP (
386   p_honor_rbs  IN VARCHAR2 := 'Y'
387 ) IS
388 
389     -- l_last_update_date     date   := SYSDATE;
390     -- l_last_updated_by      NUMBER := FND_GLOBAL.USER_ID;
391     -- l_creation_date        date   := SYSDATE;
392     -- l_created_by           NUMBER := FND_GLOBAL.USER_ID;
393     -- l_last_update_login    NUMBER := FND_GLOBAL.LOGIN_ID;
394     l_calendar_type        VARCHAR2(15) := 'P';
395     l_line_type            VARCHAR2(15) := 'PAR';
396 
397 BEGIN
398 
399   -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
400 
401   INSERT INTO pji_fp_aggr_pjp1_t
402   (
403          WORKER_ID
404        , PROJECT_ID
405        , PROJECT_ORG_ID
406        , PROJECT_ORGANIZATION_ID
407        , PROJECT_ELEMENT_ID
408        , TIME_ID
409        , PERIOD_TYPE_ID
410        , CALENDAR_TYPE
411        , RBS_AGGR_LEVEL
412        , WBS_ROLLUP_FLAG
413        , PRG_ROLLUP_FLAG
414        , CURR_RECORD_TYPE_ID
415        , CURRENCY_CODE
416        , RBS_ELEMENT_ID
417        , RBS_VERSION_ID
418        , PLAN_VERSION_ID
419        , PLAN_TYPE_ID
420        , RAW_COST
421        , BRDN_COST
422        , REVENUE
423        , BILL_RAW_COST
424        , BILL_BRDN_COST
425        , BILL_LABOR_RAW_COST
426        , BILL_LABOR_BRDN_COST
427        , BILL_LABOR_HRS
428        , EQUIPMENT_RAW_COST
429        , EQUIPMENT_BRDN_COST
430        , CAPITALIZABLE_RAW_COST
431        , CAPITALIZABLE_BRDN_COST
432        , LABOR_RAW_COST
433        , LABOR_BRDN_COST
434        , LABOR_HRS
435        , LABOR_REVENUE
436        , EQUIPMENT_HOURS
437        , BILLABLE_EQUIPMENT_HOURS
438        , SUP_INV_COMMITTED_COST
439        , PO_COMMITTED_COST
440        , PR_COMMITTED_COST
441        , OTH_COMMITTED_COST
442        , ACT_LABOR_HRS
443 	   , ACT_EQUIP_HRS
444 	   , ACT_LABOR_BRDN_COST
445 	   , ACT_EQUIP_BRDN_COST
446 	   , ACT_BRDN_COST
447 	   , ACT_RAW_COST
448 	   , ACT_REVENUE
449          , ACT_LABOR_RAW_COST
450          , ACT_EQUIP_RAW_COST
451 	   , ETC_LABOR_HRS
452 	   , ETC_EQUIP_HRS
453 	   , ETC_LABOR_BRDN_COST
454 	   , ETC_EQUIP_BRDN_COST
455 	   , ETC_BRDN_COST
456          , ETC_RAW_COST
457          , ETC_LABOR_RAW_COST
458          , ETC_EQUIP_RAW_COST
459        , CUSTOM1
460        , CUSTOM2
461        , CUSTOM3
462        , CUSTOM4
463        , CUSTOM5
464        , CUSTOM6
465        , CUSTOM7
466        , CUSTOM8
467        , CUSTOM9
468        , CUSTOM10
469        , CUSTOM11
470        , CUSTOM12
471        , CUSTOM13
472        , CUSTOM14
473        , CUSTOM15
474        , LINE_TYPE
475        -- , RATE_DANGLING_FLAG
476        -- , TIME_DANGLING_FLAG
477        -- , START_DATE
478        -- , END_DATE
479        , PRG_LEVEL
480        , PLAN_TYPE_CODE    /* 4471527 */
481     )
482   SELECT * FROM (
483   SELECT
484        g_worker_id -- partition id
485 	, fact1.PROJECT_ID
486     , fact1.PROJECT_ORG_ID
487     , fact1.PROJECT_ORGANIZATION_ID
488     , fact1.PROJECT_ELEMENT_ID
489     , DECODE (
490                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
491              , '000', period.CAL_PERIOD_ID
492              , '001', period.CAL_QTR_ID
493              , '011', qtr.CAL_YEAR_ID
494              , '111', -1 ) TIME_ID
495     , DECODE (
496                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
497              , '000', 32
498              , '001', 64
499              , '011', 128
500              , '111', 2048 ) PERIOD_TYPE_ID
501     , DECODE (
502                grouping(qtr.CAL_YEAR_ID)
503              , 0 , l_calendar_type
504              , 'A') CALENDAR_TYPE
505     , fact1.RBS_AGGR_LEVEL
506     , fact1.WBS_ROLLUP_FLAG
507     , fact1.PRG_ROLLUP_FLAG
508     , fact1.CURR_RECORD_TYPE_ID
509     , fact1.CURRENCY_CODE
510     , fact1.RBS_ELEMENT_ID
511     , fact1.RBS_VERSION_ID
512     , fact1.PLAN_VERSION_ID
513 	, fact1.PLAN_TYPE_ID
514     , SUM(fact1.RAW_COST)  RAW_COST
515     , SUM(fact1.BRDN_COST)  BRDN_COST
516     , SUM(fact1.REVENUE)  REVENUE
517     , SUM(fact1.BILL_RAW_COST)  BILL_RAW_COST
518     , SUM(fact1.BILL_BRDN_COST )  BILL_BRDN_COST
519     , SUM(fact1.BILL_LABOR_RAW_COST)  BILL_LABOR_RAW_COST
520     , SUM(fact1.BILL_LABOR_BRDN_COST )  BILL_LABOR_BRDN_COST
521     , SUM(fact1.BILL_LABOR_HRS )  BILL_LABOR_HRS
522     , SUM(fact1.EQUIPMENT_RAW_COST )  EQUIPMENT_RAW_COST
523     , SUM(fact1.EQUIPMENT_BRDN_COST ) EQUIPMENT_BRDN_COST
524     , SUM(fact1.CAPITALIZABLE_RAW_COST ) CAPITALIZABLE_RAW_COST
525     , SUM(fact1.CAPITALIZABLE_BRDN_COST )   CAPITALIZABLE_BRDN_COST
526     , SUM(fact1.LABOR_RAW_COST )  LABOR_RAW_COST
527     , SUM(fact1.LABOR_BRDN_COST ) LABOR_BRDN_COST
528     , SUM(fact1.LABOR_HRS)  LABOR_HRS
529     , SUM(fact1.LABOR_REVENUE)    LABOR_REVENUE
530     , SUM(fact1.EQUIPMENT_HOURS)  EQUIPMENT_HOURS
531     , SUM(fact1.BILLABLE_EQUIPMENT_HOURS)  BILLABLE_EQUIPMENT_HOURS
532     , SUM(fact1.SUP_INV_COMMITTED_COST)   SUP_INV_COMMITTED_COST
533     , SUM(fact1.PO_COMMITTED_COST   )  PO_COMMITTED_COST
534     , SUM(fact1.PR_COMMITTED_COST  ) PR_COMMITTED_COST
535     , SUM(fact1.OTH_COMMITTED_COST)  OTH_COMMITTED_COST
536        , SUM(fact1.ACT_LABOR_HRS)
537 	 , SUM(fact1.ACT_EQUIP_HRS)
538 	 , SUM(fact1.ACT_LABOR_BRDN_COST)
539 	 , SUM(fact1.ACT_EQUIP_BRDN_COST)
540 	 , SUM(fact1.ACT_BRDN_COST)
541 	 , SUM(fact1.ACT_RAW_COST)
542 	 , SUM(fact1.ACT_REVENUE)
543        , SUM(fact1.ACT_LABOR_RAW_COST)
544        , SUM(fact1.ACT_EQUIP_RAW_COST)
545 	 , SUM(fact1.ETC_LABOR_HRS)
546 	 , SUM(fact1.ETC_EQUIP_HRS)
547 	 , SUM(fact1.ETC_LABOR_BRDN_COST)
548 	 , SUM(fact1.ETC_EQUIP_BRDN_COST)
549 	 , SUM(fact1.ETC_BRDN_COST )
550        , SUM(fact1.ETC_RAW_COST )
551        , SUM(fact1.ETC_LABOR_RAW_COST)
552        , SUM(fact1.ETC_EQUIP_RAW_COST)
553     , SUM(CUSTOM1	) CUSTOM1
554     , SUM(CUSTOM2	) CUSTOM2
555     , SUM(CUSTOM3	) CUSTOM3
556     , SUM(CUSTOM4	) CUSTOM4
557     , SUM(CUSTOM5	) CUSTOM5
558     , SUM(CUSTOM6	) CUSTOM6
559     , SUM(CUSTOM7	) CUSTOM7
560     , SUM(CUSTOM8	) CUSTOM8
561     , SUM(CUSTOM9	) CUSTOM9
562     , SUM(CUSTOM10	) CUSTOM10
563     , SUM(CUSTOM11	) CUSTOM11
564     , SUM(CUSTOM12	) CUSTOM12
565     , SUM(CUSTOM13	) CUSTOM13
566     , SUM(CUSTOM14	) CUSTOM14
567     , SUM(CUSTOM15) CUSTOM15
568     , l_line_type line_type
569     , g_default_prg_level prg_level
570     , fact1.PLAN_TYPE_CODE PLAN_TYPE_CODE   /* 4471527 */
571     FROM
572 	pji_fp_aggr_pjp1_t fact1  -- ,  PJI_FM_EXTR_PLNVER3_T ver
573     , pji_time_CAL_PERIOD period
574     , pji_time_CAL_QTR    qtr
575     , pji_fm_extr_plnver3_t  ver
576     WHERE
577         fact1.calendar_type = 'P'
578     AND period.cal_period_id = fact1.time_id
579     AND period.cal_qtr_id = qtr.cal_qtr_id
580     AND fact1.period_type_id = 32 -- > 0 -- <>  -1
581     AND fact1.worker_id = g_worker_id
582 --    AND fact1.rbs_version_id IN (ver.rbs_struct_version_id, -1)   /* 4632551 */
583     AND (
584           (     NVL(ver.rbs_struct_version_id, -1) = fact1.rbs_version_id
585             AND p_honor_rbs = 'Y'
586           )
587           OR
588           ( p_honor_rbs = 'N' )
589         )
590     -- AND ver.secondary_rbs_flag = 'N'
591     AND fact1.plan_version_id = ver.plan_version_id
592    AND fact1.plan_type_code = ver.plan_type_code   /* 4471527 */
593    GROUP BY
594 	fact1.PROJECT_ID
595     , fact1.PROJECT_ORGANIZATION_ID
596     , fact1.PROJECT_ORG_ID
597     -- -- -- , fact1.PARTITION_ID
598     , fact1.PROJECT_ELEMENT_ID
599     , rollup (qtr.CAL_YEAR_ID,
600               period.CAL_QTR_ID,
601               period.CAL_PERIOD_ID)
602     , fact1.calendar_type
603     , fact1.RBS_AGGR_LEVEL
604     , fact1.WBS_ROLLUP_FLAG
605     , fact1.PRG_ROLLUP_FLAG
606     , fact1.CURR_RECORD_TYPE_ID
607     , fact1.CURRENCY_CODE
608     , fact1.RBS_ELEMENT_ID
609     , fact1.RBS_VERSION_ID
610     , fact1.PLAN_VERSION_ID
611     , fact1.PLAN_TYPE_ID
612     , fact1.PLAN_TYPE_CODE )      /* 4471527 */
613     WHERE period_type_id > 32
614      AND period_type_id < 2048;
615 
616 EXCEPTION
617   WHEN OTHERS THEN
618     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
619                              p_procedure_name => 'CREATE_FP_PA_PRI_ROLLUP');
620     RAISE;
621 END;
622 
623 
624 PROCEDURE CREATE_FP_GL_PRI_ROLLUP (
625   p_honor_rbs  IN VARCHAR2 := 'Y'
626 ) IS
627     -- l_last_update_date     date   := SYSDATE;
628     -- l_last_updated_by      NUMBER := FND_GLOBAL.USER_ID;
629     -- l_creation_date        date   := SYSDATE;
630     -- l_created_by           NUMBER := FND_GLOBAL.USER_ID;
631     l_last_update_login    NUMBER := FND_GLOBAL.LOGIN_ID;
632     l_calendar_type        VARCHAR2(15) := 'G';
633     l_line_type            VARCHAR2(15) := 'GLR';
634 
635 BEGIN
636 
637   -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
638 
639   INSERT INTO pji_fp_aggr_pjp1_t
640   (
641        WORKER_ID
642      , PROJECT_ID
643      , PROJECT_ORG_ID
644      , PROJECT_ORGANIZATION_ID
645      -- , PARTITION_ID
646      , PROJECT_ELEMENT_ID
647      , TIME_ID
648      , PERIOD_TYPE_ID
649      , CALENDAR_TYPE
650      , RBS_AGGR_LEVEL
651      , WBS_ROLLUP_FLAG
652      , PRG_ROLLUP_FLAG
653      , CURR_RECORD_TYPE_ID
654      , CURRENCY_CODE
655      , RBS_ELEMENT_ID
656      , RBS_VERSION_ID
657      , PLAN_VERSION_ID
658      , PLAN_TYPE_ID
659      -- , LAST_UPDATE_DATE
660      -- , LAST_UPDATED_BY
661      -- , CREATION_DATE
662      -- , CREATED_BY
663      -- , LAST_UPDATE_LOGIN
664      , RAW_COST
665      , BRDN_COST
666      , REVENUE
667      , BILL_RAW_COST
668      , BILL_BRDN_COST
669      , BILL_LABOR_RAW_COST
670      , BILL_LABOR_BRDN_COST
671      , BILL_LABOR_HRS
672      , EQUIPMENT_RAW_COST
673      , EQUIPMENT_BRDN_COST
674      , CAPITALIZABLE_RAW_COST
675      , CAPITALIZABLE_BRDN_COST
676      , LABOR_RAW_COST
677      , LABOR_BRDN_COST
678      , LABOR_HRS
679      , LABOR_REVENUE
680      , EQUIPMENT_HOURS
681      , BILLABLE_EQUIPMENT_HOURS
682      , SUP_INV_COMMITTED_COST
683      , PO_COMMITTED_COST
684      , PR_COMMITTED_COST
685      , OTH_COMMITTED_COST
686        , ACT_LABOR_HRS
687 	   , ACT_EQUIP_HRS
688 	   , ACT_LABOR_BRDN_COST
689 	   , ACT_EQUIP_BRDN_COST
690 	   , ACT_BRDN_COST
691 	   , ACT_RAW_COST
692 	   , ACT_REVENUE
693          , ACT_LABOR_RAW_COST
694          , ACT_EQUIP_RAW_COST
695 	   , ETC_LABOR_HRS
696 	   , ETC_EQUIP_HRS
697 	   , ETC_LABOR_BRDN_COST
698 	   , ETC_EQUIP_BRDN_COST
699 	   , ETC_BRDN_COST
700          , ETC_RAW_COST
701          , ETC_LABOR_RAW_COST
702          , ETC_EQUIP_RAW_COST
703      , CUSTOM1
704      , CUSTOM2
705      , CUSTOM3
706      , CUSTOM4
707      , CUSTOM5
708      , CUSTOM6
709      , CUSTOM7
710      , CUSTOM8
711      , CUSTOM9
712      , CUSTOM10
713      , CUSTOM11
714      , CUSTOM12
715      , CUSTOM13
716      , CUSTOM14
717      , CUSTOM15
718      , LINE_TYPE
719      , PRG_LEVEL
720      , PLAN_TYPE_CODE      /* 4471527 */
721   )
722   SELECT * FROM (
723   SELECT
724     -- GROUPING(qtr.CAL_YEAR_ID)  gy
725     -- , GROUPING(period.CAL_QTR_ID)  gq
726     -- , GROUPING(period.CAL_PERIOD_ID)  gp
727 	-- ,
728       g_worker_id
729     , fact1.PROJECT_ID
730     , fact1.PROJECT_ORG_ID
731     , fact1.PROJECT_ORGANIZATION_ID
732     -- -- -- , fact1.PARTITION_ID
733     , fact1.PROJECT_ELEMENT_ID
734     , DECODE (
735                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
736              , '000', period.CAL_PERIOD_ID
737              , '001', period.CAL_QTR_ID
738              , '011', qtr.CAL_YEAR_ID
739              , '111', -1 ) TIME_ID
740     , DECODE (
741                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
742              , '000', 32
743              , '001', 64
744              , '011', 128
745              , '111', 2048 ) PERIOD_TYPE_ID
746     , DECODE (
747                grouping(qtr.CAL_YEAR_ID)
748              , 0 , l_calendar_type
749              , 'A') CALENDAR_TYPE
750     , fact1.RBS_AGGR_LEVEL
751     , fact1.WBS_ROLLUP_FLAG
752     , fact1.PRG_ROLLUP_FLAG
753     , fact1.CURR_RECORD_TYPE_ID
754     , fact1.CURRENCY_CODE
755     , fact1.RBS_ELEMENT_ID
756     , fact1.RBS_VERSION_ID
757     , fact1.PLAN_VERSION_ID
758 	, fact1.PLAN_TYPE_ID
759     , SUM(fact1.RAW_COST)  RAW_COST
760     , SUM(fact1.BRDN_COST)  BRDN_COST
761     , SUM(fact1.REVENUE)  REVENUE
762     , SUM(fact1.BILL_RAW_COST)  BILL_RAW_COST
763     , SUM(fact1.BILL_BRDN_COST )  BILL_BRDN_COST
764     , SUM(fact1.BILL_LABOR_RAW_COST)  BILL_LABOR_RAW_COST
765     , SUM(fact1.BILL_LABOR_BRDN_COST )  BILL_LABOR_BRDN_COST
766     , SUM(fact1.BILL_LABOR_HRS )  BILL_LABOR_HRS
767     , SUM(fact1.EQUIPMENT_RAW_COST )  EQUIPMENT_RAW_COST
768     , SUM(fact1.EQUIPMENT_BRDN_COST ) EQUIPMENT_BRDN_COST
769     , SUM(fact1.CAPITALIZABLE_RAW_COST ) CAPITALIZABLE_RAW_COST
770     , SUM(fact1.CAPITALIZABLE_BRDN_COST )   CAPITALIZABLE_BRDN_COST
771     , SUM(fact1.LABOR_RAW_COST )  LABOR_RAW_COST
772     , SUM(fact1.LABOR_BRDN_COST ) LABOR_BRDN_COST
773     , SUM(fact1.LABOR_HRS)  LABOR_HRS
774     , SUM(fact1.LABOR_REVENUE)    LABOR_REVENUE
775     , SUM(fact1.EQUIPMENT_HOURS)  EQUIPMENT_HOURS
776     , SUM(fact1.BILLABLE_EQUIPMENT_HOURS)  BILLABLE_EQUIPMENT_HOURS
777     , SUM(fact1.SUP_INV_COMMITTED_COST)   SUP_INV_COMMITTED_COST
778     , SUM(fact1.PO_COMMITTED_COST   )  PO_COMMITTED_COST
779     , SUM(fact1.PR_COMMITTED_COST  ) PR_COMMITTED_COST
780     , SUM(fact1.OTH_COMMITTED_COST)  OTH_COMMITTED_COST
781        , SUM(fact1.ACT_LABOR_HRS)
782 	 , SUM(fact1.ACT_EQUIP_HRS)
783 	 , SUM(fact1.ACT_LABOR_BRDN_COST)
784 	 , SUM(fact1.ACT_EQUIP_BRDN_COST)
785 	 , SUM(fact1.ACT_BRDN_COST)
786 	 , SUM(fact1.ACT_RAW_COST)
787 	 , SUM(fact1.ACT_REVENUE)
788        , SUM(fact1.ACT_LABOR_RAW_COST)
789        , SUM(fact1.ACT_EQUIP_RAW_COST)
790 	 , SUM(fact1.ETC_LABOR_HRS)
791 	 , SUM(fact1.ETC_EQUIP_HRS)
792 	 , SUM(fact1.ETC_LABOR_BRDN_COST)
793 	 , SUM(fact1.ETC_EQUIP_BRDN_COST)
794 	 , SUM(fact1.ETC_BRDN_COST )
795        , SUM(fact1.ETC_RAW_COST )
796        , SUM(fact1.ETC_LABOR_RAW_COST)
797        , SUM(fact1.ETC_EQUIP_RAW_COST)
798     , SUM(CUSTOM1	) CUSTOM1
799     , SUM(CUSTOM2	) CUSTOM2
800     , SUM(CUSTOM3	) CUSTOM3
801     , SUM(CUSTOM4	) CUSTOM4
802     , SUM(CUSTOM5	) CUSTOM5
803     , SUM(CUSTOM6	) CUSTOM6
804     , SUM(CUSTOM7	) CUSTOM7
805     , SUM(CUSTOM8	) CUSTOM8
806     , SUM(CUSTOM9	) CUSTOM9
807     , SUM(CUSTOM10	) CUSTOM10
808     , SUM(CUSTOM11	) CUSTOM11
809     , SUM(CUSTOM12	) CUSTOM12
810     , SUM(CUSTOM13	) CUSTOM13
811     , SUM(CUSTOM14	) CUSTOM14
812     , SUM(CUSTOM15) CUSTOM15
813     , l_line_type
814     , g_default_prg_level prg_level
815     , fact1.PLAN_TYPE_CODE PLAN_TYPE_CODE   /* 4471527 */
816     FROM
817 	pji_fp_aggr_pjp1_t fact1  -- ,  PJI_FM_EXTR_PLNVER3_T ver
818     , pji_time_CAL_PERIOD period
819     , pji_time_CAL_QTR    qtr
820     , pji_fm_extr_plnver3_t  ver
821     WHERE
822         fact1.calendar_type = l_calendar_type
823     AND period.cal_period_id = fact1.time_id
824     AND period.cal_qtr_id = qtr.cal_qtr_id
825     AND fact1.period_type_id = 32 -- <>  -1
826     AND fact1.worker_id = g_worker_id
827 --    AND fact1.rbs_version_id IN (ver.rbs_struct_version_id, -1)   /* 4632551 */
828     AND (
829           (     NVL(ver.rbs_struct_version_id, -1) = fact1.rbs_version_id
830             AND p_honor_rbs = 'Y'
831           )
832           OR
833           ( p_honor_rbs = 'N' )
834         )
835     -- AND ver.secondary_rbs_flag = 'N'
836     AND fact1.plan_version_id = ver.plan_version_id
837     AND fact1.plan_type_code = ver.plan_type_code      /* 4471527 */
838    GROUP BY
839 	fact1.PROJECT_ID
840     , fact1.PROJECT_ORGANIZATION_ID
841     , fact1.PROJECT_ORG_ID
842     -- -- -- , fact1.PARTITION_ID
843     , fact1.PROJECT_ELEMENT_ID
844     , rollup (qtr.CAL_YEAR_ID,
845               period.CAL_QTR_ID,
846               period.CAL_PERIOD_ID)
847     , fact1.calendar_type
848     , fact1.RBS_AGGR_LEVEL
849     , fact1.WBS_ROLLUP_FLAG
850     , fact1.PRG_ROLLUP_FLAG
851     , fact1.CURR_RECORD_TYPE_ID
852     , fact1.CURRENCY_CODE
853     , fact1.RBS_ELEMENT_ID
854     , fact1.RBS_VERSION_ID
855     , fact1.PLAN_VERSION_ID
856     , fact1.PLAN_TYPE_ID
857     , fact1.PLAN_TYPE_CODE)   /* 4471527 */
858    WHERE period_type_id > 32
859      AND period_type_id < 2048;
860 
861 
862 EXCEPTION
863   WHEN OTHERS THEN
864     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
865                              p_procedure_name => 'CREATE_FP_GL_PRI_ROLLUP');
866     RAISE;
867 END;
868 
869 
870 PROCEDURE CREATE_FP_ALL_T_PRI_ROLLUP (
871   p_honor_rbs     IN VARCHAR2 := 'Y'
872 , p_calendar_type IN VARCHAR2 ) IS /* Removed default value for bug 9067086 */
873 
874     l_last_update_login    NUMBER := FND_GLOBAL.LOGIN_ID;
875     l_line_type            VARCHAR2(15);
876     l_time_phase_change      NUMBER := 0;
877     l_calendar_type   varchar2(1); /* Added for bug 9067086 */
878 
879 BEGIN
880 
881    l_calendar_type := p_calendar_type; /* Added for bug 9067086 */
882 
883   -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
884   /* Added for bug 9067086 starts */
885   if (pji_utils.get_setup_parameter('TIME_PHASE_FLAG') = 'Y' )
886      and (l_calendar_type is null) then
887      select min(calendar_type)
888      into l_calendar_type
889      from pji_fp_aggr_pjp1_t
890      where worker_id = g_worker_id;
891 
892   elsif l_calendar_type is null then
893      l_calendar_type := 'G';
894   end if;
895   /* Added for bug 9067086 ends */
896 
897   IF (l_calendar_type NOT IN ('P', 'G','C') ) THEN  -- 'C' for time phase change
898     RETURN;
899   ELSE
900   /* Modified for bug 9067086 starts */
901     IF (l_calendar_type = 'P') THEN
902       l_line_type := 'PAR';
903     ELSIF (l_calendar_type = 'G') THEN
904       l_line_type := 'GLR';
905     ELSE
906       l_line_type := 'CLR';
907     END IF;
908   /* Modified for bug 9067086 ends */
909   END IF;
910 /*  4604617 */
911 BEGIN
912     select  1 into l_time_phase_change from  PJI_FM_EXTR_PLNVER3_T VER
913     where EXISTS (SELECT 1 FROM PJI_FM_EXTR_PLAN_LINES PL
914          	    WHERE PL.PROJECT_ID = VER.PROJECT_ID
915                     AND PL.PLAN_VERSION_ID = VER.PLAN_VERSION_ID
916                     AND PL.PLAN_TYPE_ID = VER.PLAN_TYPE_ID
917             	    AND PL.CALENDAR_TYPE <> VER.TIME_PHASED_TYPE_CODE);
918   exception when NO_DATA_FOUND then
919     null;
920  end ;
921 IF l_time_phase_change = 0 THEN
922 
923 INSERT INTO PJI_FP_AGGR_PJP1_T
924   (
925        WORKER_ID
926      , PROJECT_ID
927      , PROJECT_ORG_ID
928      , PROJECT_ORGANIZATION_ID
929      , PROJECT_ELEMENT_ID
930      , TIME_ID
931      , PERIOD_TYPE_ID
932      , CALENDAR_TYPE
933      , RBS_AGGR_LEVEL
934      , WBS_ROLLUP_FLAG
935      , PRG_ROLLUP_FLAG
936      , CURR_RECORD_TYPE_ID
937      , CURRENCY_CODE
938      , RBS_ELEMENT_ID
939      , RBS_VERSION_ID
940      , PLAN_VERSION_ID
941      , PLAN_TYPE_ID
942      , RAW_COST
943      , BRDN_COST
944      , REVENUE
945      , BILL_RAW_COST
946      , BILL_BRDN_COST
947      , BILL_LABOR_RAW_COST
948      , BILL_LABOR_BRDN_COST
949      , BILL_LABOR_HRS
950      , EQUIPMENT_RAW_COST
951      , EQUIPMENT_BRDN_COST
952      , CAPITALIZABLE_RAW_COST
953      , CAPITALIZABLE_BRDN_COST
954      , LABOR_RAW_COST
955      , LABOR_BRDN_COST
956      , LABOR_HRS
957      , LABOR_REVENUE
958      , EQUIPMENT_HOURS
959      , BILLABLE_EQUIPMENT_HOURS
960      , SUP_INV_COMMITTED_COST
961      , PO_COMMITTED_COST
962      , PR_COMMITTED_COST
963      , OTH_COMMITTED_COST
964        , ACT_LABOR_HRS
965 	   , ACT_EQUIP_HRS
966 	   , ACT_LABOR_BRDN_COST
967 	   , ACT_EQUIP_BRDN_COST
968 	   , ACT_BRDN_COST
969 	   , ACT_RAW_COST
970 	   , ACT_REVENUE
971          , ACT_LABOR_RAW_COST
972          , ACT_EQUIP_RAW_COST
973 	   , ETC_LABOR_HRS
974 	   , ETC_EQUIP_HRS
975 	   , ETC_LABOR_BRDN_COST
976 	   , ETC_EQUIP_BRDN_COST
977 	   , ETC_BRDN_COST
978          , ETC_RAW_COST
979          , ETC_LABOR_RAW_COST
980          , ETC_EQUIP_RAW_COST
981      , CUSTOM1
982      , CUSTOM2
983      , CUSTOM3
984      , CUSTOM4
985      , CUSTOM5
986      , CUSTOM6
987      , CUSTOM7
988      , CUSTOM8
989      , CUSTOM9
990      , CUSTOM10
991      , CUSTOM11
992      , CUSTOM12
993      , CUSTOM13
994      , CUSTOM14
995      , CUSTOM15
996      , LINE_TYPE
997      , PRG_LEVEL
998     , PLAN_TYPE_CODE   /* 4471527 */
999   )
1000    SELECT
1001       g_worker_id
1002     , fact1.PROJECT_ID
1003     , fact1.PROJECT_ORG_ID
1004     , fact1.PROJECT_ORGANIZATION_ID
1005     , fact1.PROJECT_ELEMENT_ID
1006 /*    , DECODE (
1007                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
1008              , '000', period.CAL_PERIOD_ID
1009              , '001', period.CAL_QTR_ID
1010              , '011', qtr.CAL_YEAR_ID
1011              , '111', -1 ) TIME_ID
1012     , DECODE (
1013                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
1014              , '000', 32
1015              , '001', 64
1016              , '011', 128
1017              , '111', 2048 ) PERIOD_TYPE_ID
1018     , DECODE (
1019                grouping(qtr.CAL_YEAR_ID)
1020              , 0 ,p_calendar_type
1021              , 'A') CALENDAR_TYPE    */
1022     , -1   TIME_ID
1023     , 2048 PERIOD_TYPE_ID
1024     , 'A'  CALENDAR_TYPE
1025     , fact1.RBS_AGGR_LEVEL
1026     , fact1.WBS_ROLLUP_FLAG
1027     , fact1.PRG_ROLLUP_FLAG
1028     , fact1.CURR_RECORD_TYPE_ID
1029     , fact1.CURRENCY_CODE
1030     , fact1.RBS_ELEMENT_ID
1031     , fact1.RBS_VERSION_ID
1032     , fact1.PLAN_VERSION_ID
1033 	, fact1.PLAN_TYPE_ID
1034     , SUM(fact1.RAW_COST)  RAW_COST
1035     , SUM(fact1.BRDN_COST)  BRDN_COST
1036     , SUM(fact1.REVENUE)  REVENUE
1037     , SUM(fact1.BILL_RAW_COST)  BILL_RAW_COST
1038     , SUM(fact1.BILL_BRDN_COST )  BILL_BRDN_COST
1039     , SUM(fact1.BILL_LABOR_RAW_COST)  BILL_LABOR_RAW_COST
1040     , SUM(fact1.BILL_LABOR_BRDN_COST )  BILL_LABOR_BRDN_COST
1041     , SUM(fact1.BILL_LABOR_HRS )  BILL_LABOR_HRS
1042     , SUM(fact1.EQUIPMENT_RAW_COST )  EQUIPMENT_RAW_COST
1043     , SUM(fact1.EQUIPMENT_BRDN_COST ) EQUIPMENT_BRDN_COST
1044     , SUM(fact1.CAPITALIZABLE_RAW_COST ) CAPITALIZABLE_RAW_COST
1045     , SUM(fact1.CAPITALIZABLE_BRDN_COST )   CAPITALIZABLE_BRDN_COST
1046     , SUM(fact1.LABOR_RAW_COST )  LABOR_RAW_COST
1047     , SUM(fact1.LABOR_BRDN_COST ) LABOR_BRDN_COST
1048     , SUM(fact1.LABOR_HRS)  LABOR_HRS
1049     , SUM(fact1.LABOR_REVENUE)    LABOR_REVENUE
1050     , SUM(fact1.EQUIPMENT_HOURS)  EQUIPMENT_HOURS
1051     , SUM(fact1.BILLABLE_EQUIPMENT_HOURS)  BILLABLE_EQUIPMENT_HOURS
1052     , SUM(fact1.SUP_INV_COMMITTED_COST)   SUP_INV_COMMITTED_COST
1053     , SUM(fact1.PO_COMMITTED_COST   )  PO_COMMITTED_COST
1054     , SUM(fact1.PR_COMMITTED_COST  ) PR_COMMITTED_COST
1055     , SUM(fact1.OTH_COMMITTED_COST)  OTH_COMMITTED_COST
1056        , SUM(fact1.ACT_LABOR_HRS)
1057 	 , SUM(fact1.ACT_EQUIP_HRS)
1058 	 , SUM(fact1.ACT_LABOR_BRDN_COST)
1059 	 , SUM(fact1.ACT_EQUIP_BRDN_COST)
1060 	 , SUM(fact1.ACT_BRDN_COST)
1061 	 , SUM(fact1.ACT_RAW_COST)
1062 	 , SUM(fact1.ACT_REVENUE)
1063        , SUM(fact1.ACT_LABOR_RAW_COST)
1064        , SUM(fact1.ACT_EQUIP_RAW_COST)
1065 	 , SUM(fact1.ETC_LABOR_HRS)
1066 	 , SUM(fact1.ETC_EQUIP_HRS)
1067 	 , SUM(fact1.ETC_LABOR_BRDN_COST)
1068 	 , SUM(fact1.ETC_EQUIP_BRDN_COST)
1069 	 , SUM(fact1.ETC_BRDN_COST )
1070        , SUM(fact1.ETC_RAW_COST )
1071        , SUM(fact1.ETC_LABOR_RAW_COST)
1072        , SUM(fact1.ETC_EQUIP_RAW_COST)
1073     , SUM(CUSTOM1	) CUSTOM1
1074     , SUM(CUSTOM2	) CUSTOM2
1075     , SUM(CUSTOM3	) CUSTOM3
1076     , SUM(CUSTOM4	) CUSTOM4
1077     , SUM(CUSTOM5	) CUSTOM5
1078     , SUM(CUSTOM6	) CUSTOM6
1079     , SUM(CUSTOM7	) CUSTOM7
1080     , SUM(CUSTOM8	) CUSTOM8
1081     , SUM(CUSTOM9	) CUSTOM9
1082     , SUM(CUSTOM10	) CUSTOM10
1083     , SUM(CUSTOM11	) CUSTOM11
1084     , SUM(CUSTOM12	) CUSTOM12
1085     , SUM(CUSTOM13	) CUSTOM13
1086     , SUM(CUSTOM14	) CUSTOM14
1087     , SUM(CUSTOM15) CUSTOM15
1088     ,l_line_type
1089     , g_default_prg_level prg_level
1090    , fact1.PLAN_TYPE_CODE PLAN_TYPE_CODE   /* 4471527 */
1091     FROM
1092 	PJI_FP_AGGR_PJP1_T fact1
1093     , pji_time_CAL_PERIOD period
1094     , pji_time_CAL_QTR    qtr
1095     , pji_fm_extr_plnver3_t ver
1096     WHERE
1097         fact1.calendar_type IN ( l_calendar_type
1098   				 , DECODE (l_calendar_type ,'C','G','X')
1099 				 , DECODE (l_calendar_type ,'C','P','X')
1100 				) /* Modified for bug 9067086 */
1101     AND period.cal_period_id = fact1.time_id
1102     AND period.cal_qtr_id = qtr.cal_qtr_id
1103     AND fact1.period_type_id = 32
1104     AND ver.time_phased_type_code IN ('P', 'G') -- If non time phased plan, then calender type is C.
1105     AND ver.project_id = fact1.project_id
1106     AND ver.plan_version_id = fact1.plan_version_id
1107     AND ver.plan_type_code  = fact1.plan_type_code   /* 4471527 */
1108     AND fact1.worker_id = g_worker_id
1109 --    AND fact1.rbs_version_id IN (ver.rbs_struct_version_id, -1)   /* 4632551 */
1110     AND (
1111           (     NVL(ver.rbs_struct_version_id, -1) = fact1.rbs_version_id
1112             AND p_honor_rbs = 'Y'
1113           )
1114           OR
1115           ( p_honor_rbs = 'N' )
1116         )
1117 --    AND fact1.plan_version_id = ver.plan_version_id
1118    GROUP BY
1119 	fact1.PROJECT_ID
1120     , fact1.PROJECT_ORGANIZATION_ID
1121     , fact1.PROJECT_ORG_ID
1122     , fact1.PROJECT_ELEMENT_ID
1123     , fact1.RBS_AGGR_LEVEL
1124     , fact1.WBS_ROLLUP_FLAG
1125     , fact1.PRG_ROLLUP_FLAG
1126     , fact1.CURR_RECORD_TYPE_ID
1127     , fact1.CURRENCY_CODE
1128     , fact1.RBS_ELEMENT_ID
1129     , fact1.RBS_VERSION_ID
1130     , fact1.PLAN_VERSION_ID
1131     , fact1.PLAN_TYPE_ID
1132     , fact1.PLAN_TYPE_CODE ;   /* 4471527 */
1133 
1134 ELSE
1135 /* 4604617 */
1136 /*When Time phase change from PA/GL to None then update the existing A lines
1137   When Gl to PA or vice versa , insert only one -A lines */
1138 MERGE INTO PJI_FP_AGGR_PJP1_T F1
1139 USING ( SELECT   g_worker_id WORKER_ID
1140     , fact1.PROJECT_ID
1141     , fact1.PROJECT_ORG_ID
1142     , fact1.PROJECT_ORGANIZATION_ID
1143     , fact1.PROJECT_ELEMENT_ID
1144     , -1   TIME_ID
1145     , 2048 PERIOD_TYPE_ID
1146     , 'A'  CALENDAR_TYPE
1147     , fact1.RBS_AGGR_LEVEL
1148     , fact1.WBS_ROLLUP_FLAG
1149     , fact1.PRG_ROLLUP_FLAG
1150     , fact1.CURR_RECORD_TYPE_ID
1151     , fact1.CURRENCY_CODE
1152     , fact1.RBS_ELEMENT_ID
1153     , fact1.RBS_VERSION_ID
1154     , fact1.PLAN_VERSION_ID
1155     , fact1.PLAN_TYPE_ID
1156     , SUM(fact1.RAW_COST)  RAW_COST
1157     , SUM(fact1.BRDN_COST)  BRDN_COST
1158     , SUM(fact1.REVENUE)  REVENUE
1159     , SUM(fact1.BILL_RAW_COST)  BILL_RAW_COST
1160     , SUM(fact1.BILL_BRDN_COST )  BILL_BRDN_COST
1161     , SUM(fact1.BILL_LABOR_RAW_COST)  BILL_LABOR_RAW_COST
1162     , SUM(fact1.BILL_LABOR_BRDN_COST )  BILL_LABOR_BRDN_COST
1163     , SUM(fact1.BILL_LABOR_HRS )  BILL_LABOR_HRS
1164     , SUM(fact1.EQUIPMENT_RAW_COST )  EQUIPMENT_RAW_COST
1165     , SUM(fact1.EQUIPMENT_BRDN_COST ) EQUIPMENT_BRDN_COST
1166     , SUM(fact1.CAPITALIZABLE_RAW_COST ) CAPITALIZABLE_RAW_COST
1167     , SUM(fact1.CAPITALIZABLE_BRDN_COST )   CAPITALIZABLE_BRDN_COST
1168     , SUM(fact1.LABOR_RAW_COST )  LABOR_RAW_COST
1169     , SUM(fact1.LABOR_BRDN_COST ) LABOR_BRDN_COST
1170     , SUM(fact1.LABOR_HRS)  LABOR_HRS
1171     , SUM(fact1.LABOR_REVENUE)    LABOR_REVENUE
1172     , SUM(fact1.EQUIPMENT_HOURS)  EQUIPMENT_HOURS
1173     , SUM(fact1.BILLABLE_EQUIPMENT_HOURS)  BILLABLE_EQUIPMENT_HOURS
1174     , SUM(fact1.SUP_INV_COMMITTED_COST)   SUP_INV_COMMITTED_COST
1175     , SUM(fact1.PO_COMMITTED_COST   )  PO_COMMITTED_COST
1176     , SUM(fact1.PR_COMMITTED_COST  ) PR_COMMITTED_COST
1177     , SUM(fact1.OTH_COMMITTED_COST)  OTH_COMMITTED_COST
1178     , SUM(CUSTOM1	) CUSTOM1
1179     , SUM(CUSTOM2	) CUSTOM2
1180     , SUM(CUSTOM3	) CUSTOM3
1181     , SUM(CUSTOM4	) CUSTOM4
1182     , SUM(CUSTOM5	) CUSTOM5
1183     , SUM(CUSTOM6	) CUSTOM6
1184     , SUM(CUSTOM7	) CUSTOM7
1185     , SUM(CUSTOM8	) CUSTOM8
1186     , SUM(CUSTOM9	) CUSTOM9
1187     , SUM(CUSTOM10	) CUSTOM10
1188     , SUM(CUSTOM11	) CUSTOM11
1189     , SUM(CUSTOM12	) CUSTOM12
1190     , SUM(CUSTOM13	) CUSTOM13
1191     , SUM(CUSTOM14	) CUSTOM14
1192     , SUM(CUSTOM15) CUSTOM15
1193     , SUM(fact1.ACT_LABOR_HRS) ACT_LABOR_HRS
1194     , SUM(fact1.ACT_EQUIP_HRS) ACT_EQUIP_HRS
1195     , SUM(fact1.ACT_LABOR_BRDN_COST) ACT_LABOR_BRDN_COST
1196     , SUM(fact1.ACT_EQUIP_BRDN_COST) ACT_EQUIP_BRDN_COST
1197     , SUM(fact1.ACT_BRDN_COST) ACT_BRDN_COST
1198     , SUM(fact1.ACT_RAW_COST) ACT_RAW_COST
1199     , SUM(fact1.ACT_REVENUE) ACT_REVENUE
1200     , SUM(fact1.ACT_LABOR_RAW_COST) ACT_LABOR_RAW_COST
1201     , SUM(fact1.ACT_EQUIP_RAW_COST) ACT_EQUIP_RAW_COST
1202     , SUM(fact1.ETC_LABOR_HRS) ETC_LABOR_HRS
1203     , SUM(fact1.ETC_EQUIP_HRS) ETC_EQUIP_HRS
1204     , SUM(fact1.ETC_LABOR_BRDN_COST) ETC_LABOR_BRDN_COST
1205     , SUM(fact1.ETC_EQUIP_BRDN_COST) ETC_EQUIP_BRDN_COST
1206     , SUM(fact1.ETC_BRDN_COST ) ETC_BRDN_COST
1207     , SUM(fact1.ETC_RAW_COST ) ETC_RAW_COST
1208     , SUM(fact1.ETC_LABOR_RAW_COST) ETC_LABOR_RAW_COST
1209     , SUM(fact1.ETC_EQUIP_RAW_COST) ETC_EQUIP_RAW_COST
1210     , g_default_prg_level PRG_LEVEL
1211     , l_line_type LINE_TYPE
1212     , fact1.PLAN_TYPE_CODE PLAN_TYPE_CODE     /* 4471527 */
1213     FROM
1214     PJI_FP_AGGR_PJP1_T fact1
1215     , pji_time_CAL_PERIOD period
1216     , pji_time_CAL_QTR    qtr
1217     , pji_fm_extr_plnver3_t ver
1218     WHERE
1219         fact1.calendar_type IN ( p_calendar_type
1220   				 , DECODE (p_calendar_type ,'C','G','X')
1221 				 , DECODE (p_calendar_type ,'C','P','X')
1222 				)
1223     AND period.cal_period_id = fact1.time_id
1224     AND period.cal_qtr_id = qtr.cal_qtr_id
1225     AND fact1.period_type_id = 32
1226     AND ver.time_phased_type_code IN ('P', 'G','N') -- If non time phased plan, then calender type is C.
1227     AND ver.project_id = fact1.project_id
1228     AND ver.plan_version_id = fact1.plan_version_id
1229    AND ver.plan_type_code = fact1.plan_type_code    /* 4471527 */
1230     AND fact1.worker_id = g_worker_id
1231 --    AND fact1.rbs_version_id IN (ver.rbs_struct_version_id, -1)   /* 4632551 */
1232     AND NVL(ver.rbs_struct_version_id, -1) = fact1.rbs_version_id
1233 --    AND fact1.plan_version_id = ver.plan_version_id
1234    GROUP BY
1235 	fact1.PROJECT_ID
1236     , fact1.PROJECT_ORGANIZATION_ID
1237     , fact1.PROJECT_ORG_ID
1238     , fact1.PROJECT_ELEMENT_ID
1239     , fact1.RBS_AGGR_LEVEL
1240     , fact1.WBS_ROLLUP_FLAG
1241     , fact1.PRG_ROLLUP_FLAG
1242     , fact1.CURR_RECORD_TYPE_ID
1243     , fact1.CURRENCY_CODE
1244     , fact1.RBS_ELEMENT_ID
1245     , fact1.RBS_VERSION_ID
1246     , fact1.PLAN_VERSION_ID
1247     , fact1.PLAN_TYPE_ID
1248     , fact1.PLAN_TYPE_CODE ) F2         /* 4471527 */
1249 ON (F1.WORKER_ID = F2.WORKER_ID
1250     AND F1.PROJECT_ID = F2.PROJECT_ID
1251     AND F1.PROJECT_ORGANIZATION_ID = F2.PROJECT_ORGANIZATION_ID
1252     AND F1.PROJECT_ORG_ID = F2.PROJECT_ORG_ID
1253     AND F1.PROJECT_ELEMENT_ID = F2.PROJECT_ELEMENT_ID
1254     AND F1.RBS_AGGR_LEVEL = F2.RBS_AGGR_LEVEL
1255     AND F1.WBS_ROLLUP_FLAG = F2.WBS_ROLLUP_FLAG
1256     AND F1.PRG_ROLLUP_FLAG = F2.PRG_ROLLUP_FLAG
1257     AND F1.CURR_RECORD_TYPE_ID = F2.CURR_RECORD_TYPE_ID
1258     AND F1.CURRENCY_CODE = F2.CURRENCY_CODE
1259     AND F1.RBS_ELEMENT_ID = F2.RBS_ELEMENT_ID
1260     AND F1.RBS_VERSION_ID = F2.RBS_VERSION_ID
1261     AND F1.PLAN_VERSION_ID = F2.PLAN_VERSION_ID
1262     AND F1.PLAN_TYPE_ID = F2.PLAN_TYPE_ID
1263     AND F1.PLAN_TYPE_CODE = F2.PLAN_TYPE_CODE    /* 4471527 */
1264     AND F1.TIME_ID = F2.TIME_ID
1265     AND F1.CALENDAR_TYPE = F2.CALENDAR_TYPE
1266     AND F1.PERIOD_TYPE_ID = F2.PERIOD_TYPE_ID )
1267 WHEN MATCHED THEN
1268 UPDATE
1269 SET   F1.RAW_COST = F1.RAW_COST + F2.RAW_COST
1270     , F1.BRDN_COST = F1.BRDN_COST + F2.BRDN_COST
1271     , F1.REVENUE = F1.REVENUE + F2.REVENUE
1272     , F1.BILL_RAW_COST = F1.BILL_RAW_COST + F2.BILL_RAW_COST
1273     , F1.BILL_BRDN_COST = F1.BILL_BRDN_COST + F2.BILL_BRDN_COST
1274     , F1.BILL_LABOR_RAW_COST = F1.BILL_LABOR_RAW_COST + F2.BILL_LABOR_RAW_COST
1275     , F1.BILL_LABOR_BRDN_COST = F1.BILL_LABOR_BRDN_COST + F2.BILL_LABOR_BRDN_COST
1276     , F1.BILL_LABOR_HRS = F1.BILL_LABOR_HRS + F2.BILL_LABOR_HRS
1277     , F1.EQUIPMENT_RAW_COST = F1.EQUIPMENT_RAW_COST + F2.EQUIPMENT_RAW_COST
1278     , F1.EQUIPMENT_BRDN_COST = F1.EQUIPMENT_BRDN_COST + F2.EQUIPMENT_BRDN_COST
1279     , F1.CAPITALIZABLE_RAW_COST = F1.CAPITALIZABLE_RAW_COST + F2.CAPITALIZABLE_RAW_COST
1280     , F1.CAPITALIZABLE_BRDN_COST = F1.CAPITALIZABLE_BRDN_COST + F2.CAPITALIZABLE_BRDN_COST
1281     , F1.LABOR_RAW_COST = F1.LABOR_RAW_COST + F2.LABOR_RAW_COST
1282     , F1.LABOR_BRDN_COST = F1.LABOR_BRDN_COST + F2.LABOR_BRDN_COST
1283     , F1.LABOR_HRS = F1.LABOR_HRS + F2.LABOR_HRS
1284     , F1.LABOR_REVENUE = F1.LABOR_REVENUE + F2.LABOR_REVENUE
1285     , F1.EQUIPMENT_HOURS = F1.EQUIPMENT_HOURS + F2.EQUIPMENT_HOURS
1286     , F1.BILLABLE_EQUIPMENT_HOURS = F1.BILLABLE_EQUIPMENT_HOURS + F2.BILLABLE_EQUIPMENT_HOURS
1287     , F1.SUP_INV_COMMITTED_COST = F1.SUP_INV_COMMITTED_COST + F2.SUP_INV_COMMITTED_COST
1288     , F1.PO_COMMITTED_COST = F1.PO_COMMITTED_COST + F2.PO_COMMITTED_COST
1289     , F1.PR_COMMITTED_COST = F1.PR_COMMITTED_COST + F2.PR_COMMITTED_COST
1290     , F1.OTH_COMMITTED_COST = F1.OTH_COMMITTED_COST + F2.OTH_COMMITTED_COST
1291     , F1.ACT_LABOR_HRS = F1.ACT_LABOR_HRS + F2.ACT_LABOR_HRS
1292     , F1.ACT_EQUIP_HRS = F1.ACT_EQUIP_HRS + F2.ACT_EQUIP_HRS
1293     , F1.ACT_LABOR_BRDN_COST = F1.ACT_LABOR_BRDN_COST + F2.ACT_LABOR_BRDN_COST
1294     , F1.ACT_EQUIP_BRDN_COST = F1.ACT_EQUIP_BRDN_COST + F2.ACT_EQUIP_BRDN_COST
1295     , F1.ACT_BRDN_COST = F1.ACT_BRDN_COST + F2.ACT_BRDN_COST
1296     , F1.ACT_RAW_COST = F1.ACT_RAW_COST + F2.ACT_RAW_COST
1297     , F1.ACT_REVENUE = F1.ACT_REVENUE + F2.ACT_REVENUE
1298     , F1.ACT_LABOR_RAW_COST = F1.ACT_LABOR_RAW_COST +F2.ACT_LABOR_RAW_COST
1299     , F1.ACT_EQUIP_RAW_COST = F1.ACT_EQUIP_RAW_COST + F2.ACT_EQUIP_RAW_COST
1300     , F1.ETC_LABOR_HRS = F1.ETC_LABOR_HRS + F2.ETC_LABOR_HRS
1301     , F1.ETC_EQUIP_HRS = F1.ETC_EQUIP_HRS + F2.ETC_EQUIP_HRS
1302     , F1.ETC_LABOR_BRDN_COST = F1.ETC_LABOR_BRDN_COST + F2.ETC_LABOR_BRDN_COST
1303     , F1.ETC_EQUIP_BRDN_COST = F1.ETC_EQUIP_BRDN_COST + F2.ETC_EQUIP_BRDN_COST
1304     , F1.ETC_BRDN_COST = F1.ETC_BRDN_COST + F2.ETC_BRDN_COST
1305     , F1.ETC_RAW_COST = F1.ETC_RAW_COST + F2.ETC_RAW_COST
1306     , F1.ETC_LABOR_RAW_COST = F1.ETC_LABOR_RAW_COST + F2.ETC_LABOR_RAW_COST
1307     , F1.ETC_EQUIP_RAW_COST = F1.ETC_EQUIP_RAW_COST + F2.ETC_EQUIP_RAW_COST
1308     , F1.CUSTOM1 = F1.CUSTOM1 + F2.CUSTOM1
1309     , F1.CUSTOM2 = F1.CUSTOM2 + F2.CUSTOM2
1310     , F1.CUSTOM3 = F1.CUSTOM3 + F2.CUSTOM3
1311     , F1.CUSTOM4 = F1.CUSTOM4 + F2.CUSTOM4
1312     , F1.CUSTOM5 = F1.CUSTOM5 + F2.CUSTOM5
1313     , F1.CUSTOM6 = F1.CUSTOM6 + F2.CUSTOM6
1314     , F1.CUSTOM7 = F1.CUSTOM7 + F2.CUSTOM7
1315     , F1.CUSTOM8 = F1.CUSTOM8 + F2.CUSTOM8
1316     , F1.CUSTOM9 = F1.CUSTOM9 + F2.CUSTOM9
1317     , F1.CUSTOM10 = F1.CUSTOM10 + F2.CUSTOM10
1318     , F1.CUSTOM11 = F1.CUSTOM11 + F2.CUSTOM11
1319     , F1.CUSTOM12 = F1.CUSTOM12 + F2.CUSTOM12
1320     , F1.CUSTOM13 = F1.CUSTOM13 + F2.CUSTOM13
1321     , F1.CUSTOM14 = F1.CUSTOM14 + F2.CUSTOM14
1322     , F1.CUSTOM15 = F1.CUSTOM15 + F2.CUSTOM15
1323  WHEN NOT MATCHED THEN
1324 INSERT
1325   (  F1.WORKER_ID
1326      , F1.PROJECT_ID
1327      , F1.PROJECT_ORG_ID
1328      , F1.PROJECT_ORGANIZATION_ID
1329      , F1.PROJECT_ELEMENT_ID
1330      , F1.TIME_ID
1331      , F1.PERIOD_TYPE_ID
1332      , F1.CALENDAR_TYPE
1333      , F1.RBS_AGGR_LEVEL
1334      , F1.WBS_ROLLUP_FLAG
1335      , F1.PRG_ROLLUP_FLAG
1336      , F1.CURR_RECORD_TYPE_ID
1337      , F1.CURRENCY_CODE
1338      , F1.RBS_ELEMENT_ID
1339      , F1.RBS_VERSION_ID
1340      , F1.PLAN_VERSION_ID
1341      , F1.PLAN_TYPE_ID
1342      , F1.RAW_COST
1343      , F1.BRDN_COST
1344      , F1.REVENUE
1345      , F1.BILL_RAW_COST
1346      , F1.BILL_BRDN_COST
1347      , F1.BILL_LABOR_RAW_COST
1348      , F1.BILL_LABOR_BRDN_COST
1349      , F1.BILL_LABOR_HRS
1350      , F1.EQUIPMENT_RAW_COST
1351      , F1.EQUIPMENT_BRDN_COST
1352      , F1.CAPITALIZABLE_RAW_COST
1353      , F1.CAPITALIZABLE_BRDN_COST
1354      , F1.LABOR_RAW_COST
1355      , F1.LABOR_BRDN_COST
1356      , F1.LABOR_HRS
1357      , F1.LABOR_REVENUE
1358      , F1.EQUIPMENT_HOURS
1359      , F1.BILLABLE_EQUIPMENT_HOURS
1360      , F1.SUP_INV_COMMITTED_COST
1361      , F1.PO_COMMITTED_COST
1362      , F1.PR_COMMITTED_COST
1363      , F1.OTH_COMMITTED_COST
1364      , F1.ACT_LABOR_HRS
1365      , F1.ACT_EQUIP_HRS
1366      , F1.ACT_LABOR_BRDN_COST
1367      , F1.ACT_EQUIP_BRDN_COST
1368      , F1.ACT_BRDN_COST
1369      , F1.ACT_RAW_COST
1370      , F1.ACT_REVENUE
1371      , F1.ACT_LABOR_RAW_COST
1372      , F1.ACT_EQUIP_RAW_COST
1373      , F1.ETC_LABOR_HRS
1374      , F1.ETC_EQUIP_HRS
1375      , F1.ETC_LABOR_BRDN_COST
1376      , F1.ETC_EQUIP_BRDN_COST
1377      , F1.ETC_BRDN_COST
1378      , F1.ETC_RAW_COST
1379      , F1.ETC_LABOR_RAW_COST
1380      , F1.ETC_EQUIP_RAW_COST
1381      , F1.CUSTOM1
1382      , F1.CUSTOM2
1383      , F1.CUSTOM3
1384      , F1.CUSTOM4
1385      , F1.CUSTOM5
1386      , F1.CUSTOM6
1387      , F1.CUSTOM7
1388      , F1.CUSTOM8
1389      , F1.CUSTOM9
1390      , F1.CUSTOM10
1391      , F1.CUSTOM11
1392      , F1.CUSTOM12
1393      , F1.CUSTOM13
1394      , F1.CUSTOM14
1395      , F1.CUSTOM15
1396      , F1.LINE_TYPE
1397      , F1.PRG_LEVEL
1398      , F1.PLAN_TYPE_CODE    /* 4471527 */
1399   )
1400 VALUES
1401 (  F2.WORKER_ID
1402      , F2.PROJECT_ID
1403      , F2.PROJECT_ORG_ID
1404      , F2.PROJECT_ORGANIZATION_ID
1405      , F2.PROJECT_ELEMENT_ID
1406      , F2.TIME_ID
1407      , F2.PERIOD_TYPE_ID
1408      , F2.CALENDAR_TYPE
1409      , F2.RBS_AGGR_LEVEL
1410      , F2.WBS_ROLLUP_FLAG
1411      , F2.PRG_ROLLUP_FLAG
1412      , F2.CURR_RECORD_TYPE_ID
1413      , F2.CURRENCY_CODE
1414      , F2.RBS_ELEMENT_ID
1415      , F2.RBS_VERSION_ID
1416      , F2.PLAN_VERSION_ID
1417      , F2.PLAN_TYPE_ID
1418      , F2.RAW_COST
1419      , F2.BRDN_COST
1420      , F2.REVENUE
1421      , F2.BILL_RAW_COST
1422      , F2.BILL_BRDN_COST
1423      , F2.BILL_LABOR_RAW_COST
1424      , F2.BILL_LABOR_BRDN_COST
1425      , F2.BILL_LABOR_HRS
1426      , F2.EQUIPMENT_RAW_COST
1427      , F2.EQUIPMENT_BRDN_COST
1428      , F2.CAPITALIZABLE_RAW_COST
1429      , F2.CAPITALIZABLE_BRDN_COST
1430      , F2.LABOR_RAW_COST
1431      , F2.LABOR_BRDN_COST
1432      , F2.LABOR_HRS
1433      , F2.LABOR_REVENUE
1434      , F2.EQUIPMENT_HOURS
1435      , F2.BILLABLE_EQUIPMENT_HOURS
1436      , F2.SUP_INV_COMMITTED_COST
1437      , F2.PO_COMMITTED_COST
1438      , F2.PR_COMMITTED_COST
1439      , F2.OTH_COMMITTED_COST
1440      , F2.ACT_LABOR_HRS
1441      , F2.ACT_EQUIP_HRS
1442      , F2.ACT_LABOR_BRDN_COST
1443      , F2.ACT_EQUIP_BRDN_COST
1444      , F2.ACT_BRDN_COST
1445      , F2.ACT_RAW_COST
1446      , F2.ACT_REVENUE
1447      , F2.ACT_LABOR_RAW_COST
1448      , F2.ACT_EQUIP_RAW_COST
1449      , F2.ETC_LABOR_HRS
1450      , F2.ETC_EQUIP_HRS
1451      , F2.ETC_LABOR_BRDN_COST
1452      , F2.ETC_EQUIP_BRDN_COST
1453      , F2.ETC_BRDN_COST
1454      , F2.ETC_RAW_COST
1455      , F2.ETC_LABOR_RAW_COST
1456      , F2.ETC_EQUIP_RAW_COST
1457      , F2.CUSTOM1
1458      , F2.CUSTOM2
1459      , F2.CUSTOM3
1460      , F2.CUSTOM4
1461      , F2.CUSTOM5
1462      , F2.CUSTOM6
1463      , F2.CUSTOM7
1464      , F2.CUSTOM8
1465      , F2.CUSTOM9
1466      , F2.CUSTOM10
1467      , F2.CUSTOM11
1468      , F2.CUSTOM12
1469      , F2.CUSTOM13
1470      , F2.CUSTOM14
1471      , F2.CUSTOM15
1472      , F2.LINE_TYPE
1473      , F2.PRG_LEVEL
1474      , F2.PLAN_TYPE_CODE    /* 4471527 */
1475   );
1476 
1477 END IF;
1478 
1479 EXCEPTION
1480   WHEN OTHERS THEN
1481     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
1482                              p_procedure_name => 'CREATE_FP_ALL_T_PRI_ROLLUP');
1483     RAISE;
1484 END;
1485 
1486 
1487 PROCEDURE CREATE_FP_ALLT_PRI_AGGREGATE IS
1488     -- l_last_update_date     date   := SYSDATE;
1489     -- l_last_updated_by      NUMBER := FND_GLOBAL.USER_ID;
1490     -- l_creation_date        date   := SYSDATE;
1491     -- l_created_by           NUMBER := FND_GLOBAL.USER_ID;
1492     l_last_update_login    NUMBER := FND_GLOBAL.LOGIN_ID;
1493     l_calendar_type        VARCHAR2(15) := 'A';
1494     l_line_type            VARCHAR2(15) := 'ATR';
1495     l_time_id              NUMBER := -1;
1496     l_period_type_id       NUMBER := 2048;
1497 
1498 BEGIN
1499 
1500   -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
1501 
1502   INSERT INTO pji_fp_aggr_pjp1_t
1503   (
1504        WORKER_ID
1505      , PRG_LEVEL
1506      , PROJECT_ID
1507      , PROJECT_ORG_ID
1508      , PROJECT_ORGANIZATION_ID
1509      , PROJECT_ELEMENT_ID
1510      , TIME_ID
1511      , PERIOD_TYPE_ID
1512      , CALENDAR_TYPE
1513      , RBS_AGGR_LEVEL
1514      , WBS_ROLLUP_FLAG
1515      , PRG_ROLLUP_FLAG
1516      , CURR_RECORD_TYPE_ID
1517      , CURRENCY_CODE
1518      , RBS_ELEMENT_ID
1519      , RBS_VERSION_ID
1520      , PLAN_VERSION_ID
1521      , PLAN_TYPE_ID
1522      , RAW_COST
1523      , BRDN_COST
1524      , REVENUE
1525      , BILL_RAW_COST
1526      , BILL_BRDN_COST
1527      , BILL_LABOR_RAW_COST
1528      , BILL_LABOR_BRDN_COST
1529      , BILL_LABOR_HRS
1530      , EQUIPMENT_RAW_COST
1531      , EQUIPMENT_BRDN_COST
1532      , CAPITALIZABLE_RAW_COST
1533      , CAPITALIZABLE_BRDN_COST
1534      , LABOR_RAW_COST
1535      , LABOR_BRDN_COST
1536      , LABOR_HRS
1537      , LABOR_REVENUE
1538      , EQUIPMENT_HOURS
1539      , BILLABLE_EQUIPMENT_HOURS
1540      , SUP_INV_COMMITTED_COST
1541      , PO_COMMITTED_COST
1542      , PR_COMMITTED_COST
1543      , OTH_COMMITTED_COST
1544        , ACT_LABOR_HRS
1545 	   , ACT_EQUIP_HRS
1546 	   , ACT_LABOR_BRDN_COST
1547 	   , ACT_EQUIP_BRDN_COST
1548 	   , ACT_BRDN_COST
1549 	   , ACT_RAW_COST
1550 	   , ACT_REVENUE
1551          , ACT_LABOR_RAW_COST
1552          , ACT_EQUIP_RAW_COST
1553 	   , ETC_LABOR_HRS
1554 	   , ETC_EQUIP_HRS
1555 	   , ETC_LABOR_BRDN_COST
1556 	   , ETC_EQUIP_BRDN_COST
1557 	   , ETC_BRDN_COST
1558          , ETC_RAW_COST
1559          , ETC_LABOR_RAW_COST
1560          , ETC_EQUIP_RAW_COST
1561      , CUSTOM1
1562      , CUSTOM2
1563      , CUSTOM3
1564      , CUSTOM4
1565      , CUSTOM5
1566      , CUSTOM6
1567      , CUSTOM7
1568      , CUSTOM8
1569      , CUSTOM9
1570      , CUSTOM10
1571      , CUSTOM11
1572      , CUSTOM12
1573      , CUSTOM13
1574      , CUSTOM14
1575      , CUSTOM15
1576      , LINE_TYPE
1577      , PLAN_TYPE_CODE
1578   )
1579   SELECT * FROM (
1580   SELECT
1581       g_worker_id
1582     , g_default_prg_level prg_level
1583     , fact1.PROJECT_ID
1584     , fact1.PROJECT_ORG_ID
1585     , fact1.PROJECT_ORGANIZATION_ID
1586     , fact1.PROJECT_ELEMENT_ID
1587     , l_time_id                             TIME_ID
1588     , l_period_type_id                      PERIOD_TYPE_ID
1589     , l_calendar_type                       CALENDAR_TYPE
1590     , fact1.RBS_AGGR_LEVEL
1591     , fact1.WBS_ROLLUP_FLAG
1592     , fact1.PRG_ROLLUP_FLAG
1593     , fact1.CURR_RECORD_TYPE_ID
1594     , fact1.CURRENCY_CODE
1595     , fact1.RBS_ELEMENT_ID
1596     , fact1.RBS_VERSION_ID
1597     , fact1.PLAN_VERSION_ID
1598 	, fact1.PLAN_TYPE_ID
1599     , SUM(fact1.RAW_COST)  RAW_COST
1600     , SUM(fact1.BRDN_COST)  BRDN_COST
1601     , SUM(fact1.REVENUE)  REVENUE
1602     , SUM(fact1.BILL_RAW_COST)  BILL_RAW_COST
1603     , SUM(fact1.BILL_BRDN_COST )  BILL_BRDN_COST
1604     , SUM(fact1.BILL_LABOR_RAW_COST)  BILL_LABOR_RAW_COST
1605     , SUM(fact1.BILL_LABOR_BRDN_COST )  BILL_LABOR_BRDN_COST
1606     , SUM(fact1.BILL_LABOR_HRS )  BILL_LABOR_HRS
1607     , SUM(fact1.EQUIPMENT_RAW_COST )  EQUIPMENT_RAW_COST
1608     , SUM(fact1.EQUIPMENT_BRDN_COST ) EQUIPMENT_BRDN_COST
1609     , SUM(fact1.CAPITALIZABLE_RAW_COST ) CAPITALIZABLE_RAW_COST
1610     , SUM(fact1.CAPITALIZABLE_BRDN_COST )   CAPITALIZABLE_BRDN_COST
1611     , SUM(fact1.LABOR_RAW_COST )  LABOR_RAW_COST
1612     , SUM(fact1.LABOR_BRDN_COST ) LABOR_BRDN_COST
1613     , SUM(fact1.LABOR_HRS)  LABOR_HRS
1614     , SUM(fact1.LABOR_REVENUE)    LABOR_REVENUE
1615     , SUM(fact1.EQUIPMENT_HOURS)  EQUIPMENT_HOURS
1616     , SUM(fact1.BILLABLE_EQUIPMENT_HOURS)  BILLABLE_EQUIPMENT_HOURS
1617     , SUM(fact1.SUP_INV_COMMITTED_COST)   SUP_INV_COMMITTED_COST
1618     , SUM(fact1.PO_COMMITTED_COST   )  PO_COMMITTED_COST
1619     , SUM(fact1.PR_COMMITTED_COST  ) PR_COMMITTED_COST
1620     , SUM(fact1.OTH_COMMITTED_COST)  OTH_COMMITTED_COST
1621        , SUM(fact1.ACT_LABOR_HRS)
1622 	 , SUM(fact1.ACT_EQUIP_HRS)
1623 	 , SUM(fact1.ACT_LABOR_BRDN_COST)
1624 	 , SUM(fact1.ACT_EQUIP_BRDN_COST)
1625 	 , SUM(fact1.ACT_BRDN_COST)
1626 	 , SUM(fact1.ACT_RAW_COST)
1627 	 , SUM(fact1.ACT_REVENUE)
1628        , SUM(fact1.ACT_LABOR_RAW_COST)
1629        , SUM(fact1.ACT_EQUIP_RAW_COST)
1630 	 , SUM(fact1.ETC_LABOR_HRS)
1631 	 , SUM(fact1.ETC_EQUIP_HRS)
1632 	 , SUM(fact1.ETC_LABOR_BRDN_COST)
1633 	 , SUM(fact1.ETC_EQUIP_BRDN_COST)
1634 	 , SUM(fact1.ETC_BRDN_COST )
1635        , SUM(fact1.ETC_RAW_COST )
1636        , SUM(fact1.ETC_LABOR_RAW_COST)
1637        , SUM(fact1.ETC_EQUIP_RAW_COST)
1638     , SUM(CUSTOM1	) CUSTOM1
1639     , SUM(CUSTOM2	) CUSTOM2
1640     , SUM(CUSTOM3	) CUSTOM3
1641     , SUM(CUSTOM4	) CUSTOM4
1642     , SUM(CUSTOM5	) CUSTOM5
1643     , SUM(CUSTOM6	) CUSTOM6
1644     , SUM(CUSTOM7	) CUSTOM7
1645     , SUM(CUSTOM8	) CUSTOM8
1646     , SUM(CUSTOM9	) CUSTOM9
1647     , SUM(CUSTOM10	) CUSTOM10
1648     , SUM(CUSTOM11	) CUSTOM11
1649     , SUM(CUSTOM12	) CUSTOM12
1650     , SUM(CUSTOM13	) CUSTOM13
1651     , SUM(CUSTOM14	) CUSTOM14
1652     , SUM(CUSTOM15) CUSTOM15
1653     , l_line_type
1654     , fact1.PLAN_TYPE_CODE PLAN_TYPE_CODE   /* 4471527 */
1655     FROM
1656 	  pji_fp_aggr_pjp1_t fact1  -- ,  PJI_FM_EXTR_PLNVER3_T ver
1657     , pji_fm_extr_plnver3_t  ver
1658     WHERE
1659         fact1.calendar_type = l_calendar_type
1660     AND fact1.period_type_id = l_period_type_id
1661     AND fact1.time_id = l_time_id
1662     AND fact1.worker_id = g_worker_id
1663 --    AND fact1.rbs_version_id IN (ver.rbs_struct_version_id, -1)   /* 4632551 */
1664   --  AND ( ver.rbs_struct_version_id = fact1.rbs_version_id  OR fact1.rbs_version_id = -1)
1665     AND NVL(ver.rbs_struct_version_id, -1) = fact1.rbs_version_id
1666     AND ver.secondary_rbs_flag = 'N'
1667     AND fact1.plan_version_id = ver.plan_version_id
1668     AND fact1.plan_type_code = ver.plan_type_code   /* 4471527 */
1669    GROUP BY
1670       fact1.PROJECT_ID
1671     , fact1.PROJECT_ORGANIZATION_ID
1672     , fact1.PROJECT_ORG_ID
1673     , fact1.PROJECT_ELEMENT_ID
1674     , fact1.RBS_AGGR_LEVEL
1675     , fact1.WBS_ROLLUP_FLAG
1676     , fact1.PRG_ROLLUP_FLAG
1677     , fact1.CURR_RECORD_TYPE_ID
1678     , fact1.CURRENCY_CODE
1679     , fact1.RBS_ELEMENT_ID
1680     , fact1.RBS_VERSION_ID
1681     , fact1.PLAN_VERSION_ID
1682     , fact1.PLAN_TYPE_ID
1683     , fact1.PLAN_TYPE_CODE) WHERE period_type_id > 32;
1684 
1685 
1686 EXCEPTION
1687   WHEN OTHERS THEN
1688     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
1689                              p_procedure_name => 'CREATE_FP_ALLT_PRI_AGGREGATE');
1690     RAISE;
1691 END;
1692 
1693 
1694 PROCEDURE CREATE_FP_ALLT_SEC_AGGREGATE IS
1695     -- l_last_update_date     date   := SYSDATE;
1696     -- l_last_updated_by      NUMBER := FND_GLOBAL.USER_ID;
1697     -- l_creation_date        date   := SYSDATE;
1698     -- l_created_by           NUMBER := FND_GLOBAL.USER_ID;
1699     l_last_update_login    NUMBER := FND_GLOBAL.LOGIN_ID;
1700     l_calendar_type        VARCHAR2(15) := 'A';
1701     l_line_type            VARCHAR2(15) := 'ATR';
1702     l_time_id              NUMBER := -1;
1703     l_period_type_id       NUMBER := 2048;
1704 
1705 BEGIN
1706 
1707   NULL;
1708 
1709 EXCEPTION
1710   WHEN OTHERS THEN
1711     RAISE;
1712 END;
1713 
1714 
1715 PROCEDURE CREATE_FP_PA_SEC_ROLLUP IS
1716     -- l_last_update_date     date   := SYSDATE;
1717     -- l_last_updated_by      NUMBER := FND_GLOBAL.USER_ID;
1718     -- l_creation_date        date   := SYSDATE;
1719     -- l_created_by           NUMBER := FND_GLOBAL.USER_ID;
1720     -- l_last_update_login    NUMBER := FND_GLOBAL.LOGIN_ID;
1721 BEGIN
1722 
1723   -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
1724 
1725   INSERT INTO pji_fp_aggr_pjp1_t
1726   (
1727        WORKER_ID
1728      , PROJECT_ID
1729      , PROJECT_ORG_ID
1730      , PROJECT_ORGANIZATION_ID
1731      -- , PARTITION_ID
1732      , PROJECT_ELEMENT_ID
1733      , TIME_ID
1734      , PERIOD_TYPE_ID
1735      , CALENDAR_TYPE
1736      , RBS_AGGR_LEVEL
1737      , WBS_ROLLUP_FLAG
1738      , PRG_ROLLUP_FLAG
1739      , CURR_RECORD_TYPE_ID
1740      , CURRENCY_CODE
1741      , RBS_ELEMENT_ID
1742      , RBS_VERSION_ID
1743      , PLAN_VERSION_ID
1744      , PLAN_TYPE_ID
1745      -- , LAST_UPDATE_DATE
1746      -- , LAST_UPDATED_BY
1747      -- , CREATION_DATE
1748      -- , CREATED_BY
1749      -- , LAST_UPDATE_LOGIN
1750      , RAW_COST
1751      , BRDN_COST
1752      , REVENUE
1753      , BILL_RAW_COST
1754      , BILL_BRDN_COST
1755      , BILL_LABOR_RAW_COST
1756      , BILL_LABOR_BRDN_COST
1757      , BILL_LABOR_HRS
1758      , EQUIPMENT_RAW_COST
1759      , EQUIPMENT_BRDN_COST
1760      , CAPITALIZABLE_RAW_COST
1761      , CAPITALIZABLE_BRDN_COST
1762      , LABOR_RAW_COST
1763      , LABOR_BRDN_COST
1764      , LABOR_HRS
1765      , LABOR_REVENUE
1766      , EQUIPMENT_HOURS
1767      , BILLABLE_EQUIPMENT_HOURS
1768      , SUP_INV_COMMITTED_COST
1769      , PO_COMMITTED_COST
1770      , PR_COMMITTED_COST
1771      , OTH_COMMITTED_COST
1772        , ACT_LABOR_HRS
1773 	   , ACT_EQUIP_HRS
1774 	   , ACT_LABOR_BRDN_COST
1775 	   , ACT_EQUIP_BRDN_COST
1776 	   , ACT_BRDN_COST
1777 	   , ACT_RAW_COST
1778 	   , ACT_REVENUE
1779          , ACT_LABOR_RAW_COST
1780          , ACT_EQUIP_RAW_COST
1781 	   , ETC_LABOR_HRS
1782 	   , ETC_EQUIP_HRS
1783 	   , ETC_LABOR_BRDN_COST
1784 	   , ETC_EQUIP_BRDN_COST
1785 	   , ETC_BRDN_COST
1786          , ETC_RAW_COST
1787          , ETC_LABOR_RAW_COST
1788          , ETC_EQUIP_RAW_COST
1789      , CUSTOM1
1790      , CUSTOM2
1791      , CUSTOM3
1792      , CUSTOM4
1793      , CUSTOM5
1794      , CUSTOM6
1795      , CUSTOM7
1796      , CUSTOM8
1797      , CUSTOM9
1798      , CUSTOM10
1799      , CUSTOM11
1800      , CUSTOM12
1801      , CUSTOM13
1802      , CUSTOM14
1803      , CUSTOM15
1804      , LINE_TYPE
1805      , PRG_LEVEL
1806      , PLAN_TYPE_CODE   /* 4471527 */
1807   )
1808   SELECT * FROM (
1809   SELECT
1810     -- GROUPING(qtr.CAL_YEAR_ID)  gy
1811     -- , GROUPING(period.CAL_QTR_ID)  gq
1812     -- , GROUPING(period.CAL_PERIOD_ID)  gp
1813 	-- ,
1814 	g_worker_id
1815     , fact1.PROJECT_ID
1816     , fact1.PROJECT_ORG_ID
1817     , fact1.PROJECT_ORGANIZATION_ID
1818     -- -- -- , fact1.PARTITION_ID
1819     , fact1.PROJECT_ELEMENT_ID
1820     , DECODE (
1821                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
1822              , '000', period.CAL_PERIOD_ID
1823              , '001', period.CAL_QTR_ID
1824              , '011', qtr.CAL_YEAR_ID
1825              , '111', -1 ) TIME_ID
1826     , DECODE (
1827                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
1828              , '000', 32
1829              , '001', 64
1830              , '011', 128
1831              , '111', 2048 ) PERIOD_TYPE_ID
1832     , DECODE (
1833                grouping(qtr.CAL_YEAR_ID)
1834              , 0 , 'P'
1835              , 'A') CALENDAR_TYPE
1836     , fact1.RBS_AGGR_LEVEL
1837     , fact1.WBS_ROLLUP_FLAG
1838     , fact1.PRG_ROLLUP_FLAG
1839     , fact1.CURR_RECORD_TYPE_ID
1840     , fact1.CURRENCY_CODE
1841     , fact1.RBS_ELEMENT_ID
1842     , fact1.RBS_VERSION_ID
1843     , fact1.PLAN_VERSION_ID
1844 	, fact1.PLAN_TYPE_ID
1845     -- , l_last_update_date
1846     -- , l_last_updated_by
1847     -- , l_creation_date
1848     -- , l_created_by
1849     -- , l_last_update_login
1850     , SUM(fact1.RAW_COST)
1851     , SUM(fact1.BRDN_COST)
1852     , SUM(fact1.REVENUE)
1853     , SUM(fact1.BILL_RAW_COST)
1854     , SUM(fact1.BILL_BRDN_COST )
1855     , SUM(fact1.BILL_LABOR_RAW_COST)
1856     , SUM(fact1.BILL_LABOR_BRDN_COST )
1857     , SUM(fact1.BILL_LABOR_HRS )
1858     , SUM(fact1.EQUIPMENT_RAW_COST )
1859     , SUM(fact1.EQUIPMENT_BRDN_COST )
1860     , SUM(fact1.CAPITALIZABLE_RAW_COST )
1861     , SUM(fact1.CAPITALIZABLE_BRDN_COST )
1862     , SUM(fact1.LABOR_RAW_COST )
1863     , SUM(fact1.LABOR_BRDN_COST )
1864     , SUM(fact1.LABOR_HRS)
1865     , SUM(fact1.LABOR_REVENUE)
1866     , SUM(fact1.EQUIPMENT_HOURS)
1867     , SUM(fact1.BILLABLE_EQUIPMENT_HOURS)
1868     , SUM(fact1.SUP_INV_COMMITTED_COST)
1869     , SUM(fact1.PO_COMMITTED_COST   )
1870     , SUM(fact1.PR_COMMITTED_COST  )
1871     , SUM(fact1.OTH_COMMITTED_COST)
1872        , SUM(fact1.ACT_LABOR_HRS)
1873 	 , SUM(fact1.ACT_EQUIP_HRS)
1874 	 , SUM(fact1.ACT_LABOR_BRDN_COST)
1875 	 , SUM(fact1.ACT_EQUIP_BRDN_COST)
1876 	 , SUM(fact1.ACT_BRDN_COST)
1877 	 , SUM(fact1.ACT_RAW_COST)
1878 	 , SUM(fact1.ACT_REVENUE)
1879        , SUM(fact1.ACT_LABOR_RAW_COST)
1880        , SUM(fact1.ACT_EQUIP_RAW_COST)
1881 	 , SUM(fact1.ETC_LABOR_HRS)
1882 	 , SUM(fact1.ETC_EQUIP_HRS)
1883 	 , SUM(fact1.ETC_LABOR_BRDN_COST)
1884 	 , SUM(fact1.ETC_EQUIP_BRDN_COST)
1885 	 , SUM(fact1.ETC_BRDN_COST )
1886        , SUM(fact1.ETC_RAW_COST )
1887        , SUM(fact1.ETC_LABOR_RAW_COST)
1888        , SUM(fact1.ETC_EQUIP_RAW_COST)
1889     , SUM(CUSTOM1	)
1890     , SUM(CUSTOM2	)
1891     , SUM(CUSTOM3	)
1892     , SUM(CUSTOM4	)
1893     , SUM(CUSTOM5	)
1894     , SUM(CUSTOM6	)
1895     , SUM(CUSTOM7	)
1896     , SUM(CUSTOM8	)
1897     , SUM(CUSTOM9	)
1898     , SUM(CUSTOM10	)
1899     , SUM(CUSTOM11	)
1900     , SUM(CUSTOM12	)
1901     , SUM(CUSTOM13	)
1902     , SUM(CUSTOM14	)
1903     , SUM(CUSTOM15)
1904     , 'PAR'
1905     , g_default_prg_level prg_level
1906     , fact1.plan_type_code plan_type_code     /* 4471527 */
1907    FROM
1908 	  pji_fp_aggr_pjp1_t fact1  -- ,  PJI_FM_EXTR_PLNVER3_T ver
1909     , pji_time_CAL_PERIOD period
1910     , pji_time_CAL_QTR    qtr
1911     , pji_fm_extr_plnver3_t  ver
1912    WHERE
1913         fact1.calendar_type = 'P'
1914     AND period.cal_period_id = fact1.time_id
1915     AND period.cal_qtr_id = qtr.cal_qtr_id
1916     AND fact1.period_type_id = 32
1917     AND fact1.line_type <> 'OF'
1918     AND fact1.worker_id = g_worker_id
1919   --  AND fact1.rbs_version_id IN (ver.rbs_struct_version_id, -1)   /* 4632551 */
1920     -- AND ( ver.rbs_struct_version_id = fact1.rbs_version_id  OR fact1.rbs_version_id = -1)
1921     AND NVL(ver.rbs_struct_version_id, -1) = fact1.rbs_version_id
1922     AND ver.secondary_rbs_flag = 'N'
1923     AND fact1.plan_version_id = ver.plan_version_id
1924     AND fact1.plan_type_code = ver.plan_type_code    /* 4471527 */
1925     GROUP BY
1926 	  fact1.PROJECT_ID
1927     , fact1.PROJECT_ORGANIZATION_ID
1928     , fact1.PROJECT_ORG_ID
1929     -- -- -- , fact1.PARTITION_ID
1930     , fact1.PROJECT_ELEMENT_ID
1931     , rollup (qtr.CAL_YEAR_ID,
1932               period.CAL_QTR_ID,
1933               period.CAL_PERIOD_ID)
1934     , fact1.calendar_type
1935     , fact1.RBS_AGGR_LEVEL
1936     , fact1.WBS_ROLLUP_FLAG
1937     , fact1.PRG_ROLLUP_FLAG
1938     , fact1.CURR_RECORD_TYPE_ID
1939     , fact1.CURRENCY_CODE
1940     , fact1.RBS_ELEMENT_ID
1941     , fact1.RBS_VERSION_ID
1942     , fact1.PLAN_VERSION_ID
1943     , fact1.PLAN_TYPE_ID
1944     , fact1.PLAN_TYPE_CODE)
1945    WHERE 1=1
1946      AND period_type_id > 32
1947      AND period_type_id < 2048;
1948 
1949 
1950 EXCEPTION
1951   WHEN OTHERS THEN
1952     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
1953                              p_procedure_name => 'CREATE_FP_ALLT_SEC_AGGREGATE');
1954     RAISE;
1955 END;
1956 
1957 
1958 PROCEDURE CREATE_FP_GL_SEC_ROLLUP IS
1959     -- l_last_update_date     date   := SYSDATE;
1960     -- l_last_updated_by      NUMBER := FND_GLOBAL.USER_ID;
1961     -- l_creation_date        date   := SYSDATE;
1962     -- l_created_by           NUMBER := FND_GLOBAL.USER_ID;
1963     -- l_last_update_login    NUMBER := FND_GLOBAL.LOGIN_ID;
1964 BEGIN
1965 
1966   -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
1967 
1968   INSERT INTO pji_fp_aggr_pjp1_t
1969   (
1970        WORKER_ID
1971      , PROJECT_ID
1972      , PROJECT_ORG_ID
1973      , PROJECT_ORGANIZATION_ID
1974      -- , PARTITION_ID
1975      , PROJECT_ELEMENT_ID
1976      , TIME_ID
1977      , PERIOD_TYPE_ID
1978      , CALENDAR_TYPE
1979      , RBS_AGGR_LEVEL
1980      , WBS_ROLLUP_FLAG
1981      , PRG_ROLLUP_FLAG
1982      , CURR_RECORD_TYPE_ID
1983      , CURRENCY_CODE
1984      , RBS_ELEMENT_ID
1985      , RBS_VERSION_ID
1986      , PLAN_VERSION_ID
1987      , PLAN_TYPE_ID
1988      -- , LAST_UPDATE_DATE
1989      -- , LAST_UPDATED_BY
1990      -- , CREATION_DATE
1991      -- , CREATED_BY
1992      -- , LAST_UPDATE_LOGIN
1993      , RAW_COST
1994      , BRDN_COST
1995      , REVENUE
1996      , BILL_RAW_COST
1997      , BILL_BRDN_COST
1998      , BILL_LABOR_RAW_COST
1999      , BILL_LABOR_BRDN_COST
2000      , BILL_LABOR_HRS
2001      , EQUIPMENT_RAW_COST
2002      , EQUIPMENT_BRDN_COST
2003      , CAPITALIZABLE_RAW_COST
2004      , CAPITALIZABLE_BRDN_COST
2005      , LABOR_RAW_COST
2006      , LABOR_BRDN_COST
2007      , LABOR_HRS
2008      , LABOR_REVENUE
2009      , EQUIPMENT_HOURS
2010      , BILLABLE_EQUIPMENT_HOURS
2011      , SUP_INV_COMMITTED_COST
2012      , PO_COMMITTED_COST
2013      , PR_COMMITTED_COST
2014      , OTH_COMMITTED_COST
2015        , ACT_LABOR_HRS
2016 	   , ACT_EQUIP_HRS
2017 	   , ACT_LABOR_BRDN_COST
2018 	   , ACT_EQUIP_BRDN_COST
2019 	   , ACT_BRDN_COST
2020 	   , ACT_RAW_COST
2021 	   , ACT_REVENUE
2022          , ACT_LABOR_RAW_COST
2023          , ACT_EQUIP_RAW_COST
2024 	   , ETC_LABOR_HRS
2025 	   , ETC_EQUIP_HRS
2026 	   , ETC_LABOR_BRDN_COST
2027 	   , ETC_EQUIP_BRDN_COST
2028 	   , ETC_BRDN_COST
2029          , ETC_RAW_COST
2030          , ETC_LABOR_RAW_COST
2031          , ETC_EQUIP_RAW_COST
2032      , CUSTOM1
2033      , CUSTOM2
2034      , CUSTOM3
2035      , CUSTOM4
2036      , CUSTOM5
2037      , CUSTOM6
2038      , CUSTOM7
2039      , CUSTOM8
2040      , CUSTOM9
2041      , CUSTOM10
2042      , CUSTOM11
2043      , CUSTOM12
2044      , CUSTOM13
2045      , CUSTOM14
2046      , CUSTOM15
2047      , LINE_TYPE
2048      , PRG_LEVEL
2049      , PLAN_TYPE_CODE     /* 4471527 */
2050   )
2051   SELECT * FROM (
2052   SELECT
2053     -- GROUPING(qtr.CAL_YEAR_ID)  gy
2054     -- , GROUPING(period.CAL_QTR_ID)  gq
2055     -- , GROUPING(period.CAL_PERIOD_ID)  gp
2056 	-- ,
2057 	g_worker_id
2058     , fact1.PROJECT_ID
2059     , fact1.PROJECT_ORG_ID
2060     , fact1.PROJECT_ORGANIZATION_ID
2061     -- -- -- , fact1.PARTITION_ID
2062     , fact1.PROJECT_ELEMENT_ID
2063     , DECODE (
2064                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
2065              , '000', period.CAL_PERIOD_ID
2066              , '001', period.CAL_QTR_ID
2067              , '011', qtr.CAL_YEAR_ID
2068              , '111', -1 ) TIME_ID
2069     , DECODE (
2070                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
2071              , '000', 32
2072              , '001', 64
2073              , '011', 128
2074              , '111', 2048 ) PERIOD_TYPE_ID
2075     , DECODE (
2076                grouping(qtr.CAL_YEAR_ID)
2077              , 0 , 'G'
2078              , 'A') CALENDAR_TYPE
2079     , fact1.RBS_AGGR_LEVEL
2080     , fact1.WBS_ROLLUP_FLAG
2081     , fact1.PRG_ROLLUP_FLAG
2082     , fact1.CURR_RECORD_TYPE_ID
2083     , fact1.CURRENCY_CODE
2084     , fact1.RBS_ELEMENT_ID
2085     , fact1.RBS_VERSION_ID
2086     , fact1.PLAN_VERSION_ID
2087     , fact1.PLAN_TYPE_ID
2088     -- , l_last_update_date
2089     -- , l_last_updated_by
2090     -- , l_creation_date
2091     -- , l_created_by
2092     -- , l_last_update_login
2093     , SUM(fact1.RAW_COST)
2094     , SUM(fact1.BRDN_COST)
2095     , SUM(fact1.REVENUE)
2096     , SUM(fact1.BILL_RAW_COST)
2097     , SUM(fact1.BILL_BRDN_COST )
2098     , SUM(fact1.BILL_LABOR_RAW_COST)
2099     , SUM(fact1.BILL_LABOR_BRDN_COST )
2100     , SUM(fact1.BILL_LABOR_HRS )
2101     , SUM(fact1.EQUIPMENT_RAW_COST )
2102     , SUM(fact1.EQUIPMENT_BRDN_COST )
2103     , SUM(fact1.CAPITALIZABLE_RAW_COST )
2104     , SUM(fact1.CAPITALIZABLE_BRDN_COST )
2105     , SUM(fact1.LABOR_RAW_COST )
2106     , SUM(fact1.LABOR_BRDN_COST )
2107     , SUM(fact1.LABOR_HRS)
2108     , SUM(fact1.LABOR_REVENUE)
2109     , SUM(fact1.EQUIPMENT_HOURS)
2110     , SUM(fact1.BILLABLE_EQUIPMENT_HOURS)
2111     , SUM(fact1.SUP_INV_COMMITTED_COST)
2112     , SUM(fact1.PO_COMMITTED_COST   )
2113     , SUM(fact1.PR_COMMITTED_COST  )
2114     , SUM(fact1.OTH_COMMITTED_COST)
2115        , SUM(fact1.ACT_LABOR_HRS)
2116 	 , SUM(fact1.ACT_EQUIP_HRS)
2117 	 , SUM(fact1.ACT_LABOR_BRDN_COST)
2118 	 , SUM(fact1.ACT_EQUIP_BRDN_COST)
2119 	 , SUM(fact1.ACT_BRDN_COST)
2120 	 , SUM(fact1.ACT_RAW_COST)
2121 	 , SUM(fact1.ACT_REVENUE)
2122        , SUM(fact1.ACT_LABOR_RAW_COST)
2123        , SUM(fact1.ACT_EQUIP_RAW_COST)
2124 	 , SUM(fact1.ETC_LABOR_HRS)
2125 	 , SUM(fact1.ETC_EQUIP_HRS)
2126 	 , SUM(fact1.ETC_LABOR_BRDN_COST)
2127 	 , SUM(fact1.ETC_EQUIP_BRDN_COST)
2128 	 , SUM(fact1.ETC_BRDN_COST )
2129        , SUM(fact1.ETC_RAW_COST )
2130        , SUM(fact1.ETC_LABOR_RAW_COST)
2131        , SUM(fact1.ETC_EQUIP_RAW_COST)
2132     , SUM(CUSTOM1	)
2133     , SUM(CUSTOM2	)
2134     , SUM(CUSTOM3	)
2135     , SUM(CUSTOM4	)
2136     , SUM(CUSTOM5	)
2137     , SUM(CUSTOM6	)
2138     , SUM(CUSTOM7	)
2139     , SUM(CUSTOM8	)
2140     , SUM(CUSTOM9	)
2141     , SUM(CUSTOM10)
2142     , SUM(CUSTOM11)
2143     , SUM(CUSTOM12)
2144     , SUM(CUSTOM13)
2145     , SUM(CUSTOM14)
2146     , SUM(CUSTOM15)
2147     , 'GLR'
2148     , g_default_prg_level prg_level
2149     , fact1.PLAN_TYPE_CODE  PLAN_TYPE_CODE   /* 4471527 */
2150     FROM
2151 	  pji_fp_aggr_pjp1_t fact1  -- ,  PJI_FM_EXTR_PLNVER3_T ver
2152     , pji_time_CAL_PERIOD period
2153 	, pji_time_CAL_QTR    qtr
2154     , pji_fm_extr_plnver3_t  ver
2155     WHERE
2156         fact1.calendar_type = 'G'
2157     AND period.cal_period_id = fact1.time_id
2158     AND period.cal_qtr_id = qtr.cal_qtr_id
2159     AND fact1.period_type_id = 32
2160     AND fact1.line_type <> 'OF'
2161     AND fact1.worker_id = g_worker_id
2162 --    AND fact1.rbs_version_id IN (ver.rbs_struct_version_id, -1)   /* 4632551 */
2163     -- AND ( ver.rbs_struct_version_id = fact1.rbs_version_id  OR fact1.rbs_version_id = -1)
2164     AND NVL(ver.rbs_struct_version_id, -1) = fact1.rbs_version_id
2165     AND ver.secondary_rbs_flag = 'N'
2166     AND fact1.plan_version_id = ver.plan_version_id
2167     AND fact1.plan_type_code = ver.plan_type_code    /* 4471527 */
2168   GROUP BY
2169 	  fact1.PROJECT_ID
2170     , fact1.PROJECT_ORGANIZATION_ID
2171     , fact1.PROJECT_ORG_ID
2172     -- -- -- , fact1.PARTITION_ID
2173     , fact1.PROJECT_ELEMENT_ID
2174     , rollup (qtr.CAL_YEAR_ID,
2175               period.CAL_QTR_ID,
2176               period.CAL_PERIOD_ID)
2177     , fact1.calendar_type
2178     , fact1.RBS_AGGR_LEVEL
2179     , fact1.WBS_ROLLUP_FLAG
2180     , fact1.PRG_ROLLUP_FLAG
2181     , fact1.CURR_RECORD_TYPE_ID
2182     , fact1.CURRENCY_CODE
2183     , fact1.RBS_ELEMENT_ID
2184     , fact1.RBS_VERSION_ID
2185     , fact1.PLAN_VERSION_ID
2186     , fact1.PLAN_TYPE_ID
2187     , fact1.PLAN_TYPE_CODE )
2188    WHERE 1=1
2189      AND period_type_id > 32
2190      AND period_type_id < 2048;
2191 
2192 
2193 EXCEPTION
2194   WHEN OTHERS THEN
2195     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
2196                              p_procedure_name => 'CREATE_FP_GL_SEC_ROLLUP');
2197     RAISE;
2198 END;
2199 
2200 
2201 PROCEDURE CREATE_FP_ENT_SEC_ROLLUP IS
2202     -- l_last_update_date     date   := SYSDATE;
2203     -- l_last_updated_by      NUMBER := FND_GLOBAL.USER_ID;
2204     -- l_creation_date        date   := SYSDATE;
2205     -- l_created_by           NUMBER := FND_GLOBAL.USER_ID;
2206     -- l_last_update_login    NUMBER := FND_GLOBAL.LOGIN_ID;
2207 BEGIN
2208 
2209   -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
2210 
2211   INSERT INTO pji_fp_aggr_pjp1_t
2212   (
2213        WORKER_ID
2214      , PROJECT_ID
2215      , PROJECT_ORG_ID
2216      , PROJECT_ORGANIZATION_ID
2217      -- , PARTITION_ID
2218      , PROJECT_ELEMENT_ID
2219      , TIME_ID
2220      , PERIOD_TYPE_ID
2221      , CALENDAR_TYPE
2222      , RBS_AGGR_LEVEL
2223      , WBS_ROLLUP_FLAG
2224      , PRG_ROLLUP_FLAG
2225      , CURR_RECORD_TYPE_ID
2226      , CURRENCY_CODE
2227      , RBS_ELEMENT_ID
2228      , RBS_VERSION_ID
2229      , PLAN_VERSION_ID
2230      , PLAN_TYPE_ID
2231      -- , LAST_UPDATE_DATE
2232      -- , LAST_UPDATED_BY
2233      -- , CREATION_DATE
2234      -- , CREATED_BY
2235      -- , LAST_UPDATE_LOGIN
2236      , RAW_COST
2237      , BRDN_COST
2238      , REVENUE
2239      , BILL_RAW_COST
2240      , BILL_BRDN_COST
2241      , BILL_LABOR_RAW_COST
2242      , BILL_LABOR_BRDN_COST
2243      , BILL_LABOR_HRS
2244      , EQUIPMENT_RAW_COST
2245      , EQUIPMENT_BRDN_COST
2246      , CAPITALIZABLE_RAW_COST
2247      , CAPITALIZABLE_BRDN_COST
2248      , LABOR_RAW_COST
2249      , LABOR_BRDN_COST
2250      , LABOR_HRS
2251      , LABOR_REVENUE
2252      , EQUIPMENT_HOURS
2253      , BILLABLE_EQUIPMENT_HOURS
2254      , SUP_INV_COMMITTED_COST
2255      , PO_COMMITTED_COST
2256      , PR_COMMITTED_COST
2257      , OTH_COMMITTED_COST
2258        , ACT_LABOR_HRS
2259 	   , ACT_EQUIP_HRS
2260 	   , ACT_LABOR_BRDN_COST
2261 	   , ACT_EQUIP_BRDN_COST
2262 	   , ACT_BRDN_COST
2263 	   , ACT_RAW_COST
2264 	   , ACT_REVENUE
2265          , ACT_LABOR_RAW_COST
2266          , ACT_EQUIP_RAW_COST
2267 	   , ETC_LABOR_HRS
2268 	   , ETC_EQUIP_HRS
2269 	   , ETC_LABOR_BRDN_COST
2270 	   , ETC_EQUIP_BRDN_COST
2271 	   , ETC_BRDN_COST
2272          , ETC_RAW_COST
2273          , ETC_LABOR_RAW_COST
2274          , ETC_EQUIP_RAW_COST
2275      , CUSTOM1
2276      , CUSTOM2
2277      , CUSTOM3
2278      , CUSTOM4
2279      , CUSTOM5
2280      , CUSTOM6
2281      , CUSTOM7
2282      , CUSTOM8
2283      , CUSTOM9
2284      , CUSTOM10
2285      , CUSTOM11
2286      , CUSTOM12
2287      , CUSTOM13
2288      , CUSTOM14
2289      , CUSTOM15
2290      , LINE_TYPE
2291      , PRG_LEVEL
2292      , PLAN_TYPE_CODE    /* 4471527 */
2293   )
2294   SELECT * FROM (
2295   SELECT
2296     --    GROUPING(qtr.ENT_YEAR_ID)  gy
2297     --, GROUPING(period.ENT_QTR_ID)  gq
2298     --, GROUPING(period.ENT_PERIOD_ID)  gp
2299 	--,
2300       g_worker_id
2301     , fact1.PROJECT_ID
2302     , fact1.PROJECT_ORG_ID
2303     , fact1.PROJECT_ORGANIZATION_ID
2304     -- -- -- , fact1.PARTITION_ID
2305     , fact1.PROJECT_ELEMENT_ID
2306     , DECODE (
2307                (grouping(qtr.ENT_YEAR_ID) || grouping(period.ENT_QTR_ID) || grouping(period.ENT_PERIOD_ID) )
2308              , '000', period.ENT_PERIOD_ID
2309              , '001', period.ENT_QTR_ID
2310              , '011', qtr.ENT_YEAR_ID
2311              , '111', -1 ) TIME_ID
2312     , DECODE (
2313                (grouping(qtr.ENT_YEAR_ID) || grouping(period.ENT_QTR_ID) || grouping(period.ENT_PERIOD_ID) )
2314              , '000', 32
2315              , '001', 64
2316              , '011', 128
2317              , '111', 2048 ) PERIOD_TYPE_ID
2318     , DECODE (
2319                grouping(qtr.ENT_YEAR_ID)
2320              , 0 , 'E'
2321              , 'A') CALENDAR_TYPE
2322     , RBS_AGGR_LEVEL
2323     , WBS_ROLLUP_FLAG
2324     , PRG_ROLLUP_FLAG
2325     , fact1.CURR_RECORD_TYPE_ID
2326     , fact1.CURRENCY_CODE
2327     , fact1.RBS_ELEMENT_ID
2328     , fact1.RBS_VERSION_ID
2329     , fact1.PLAN_VERSION_ID
2330     , fact1.plan_type_id
2331     -- , l_last_update_date
2332     -- , l_last_updated_by
2333     -- , l_creation_date
2334     -- , l_created_by
2335     -- , l_last_update_login
2336     , SUM(fact1.RAW_COST)
2337     , SUM(fact1.BRDN_COST)
2338     , SUM(fact1.REVENUE)
2339     , SUM(fact1.BILL_RAW_COST)
2340     , SUM(fact1.BILL_BRDN_COST )
2341     , SUM(fact1.BILL_LABOR_RAW_COST)
2342     , SUM(fact1.BILL_LABOR_BRDN_COST )
2343     , SUM(fact1.BILL_LABOR_HRS )
2344     , SUM(fact1.EQUIPMENT_RAW_COST )
2345     , SUM(fact1.EQUIPMENT_BRDN_COST )
2346     , SUM(fact1.CAPITALIZABLE_RAW_COST )
2347     , SUM(fact1.CAPITALIZABLE_BRDN_COST )
2348     , SUM(fact1.LABOR_RAW_COST )
2349     , SUM(fact1.LABOR_BRDN_COST )
2350     , SUM(fact1.LABOR_HRS)
2351     , SUM(fact1.LABOR_REVENUE)
2352     , SUM(fact1.EQUIPMENT_HOURS)
2353     , SUM(fact1.BILLABLE_EQUIPMENT_HOURS)
2354     , SUM(fact1.SUP_INV_COMMITTED_COST)
2355     , SUM(fact1.PO_COMMITTED_COST   )
2356     , SUM(fact1.PR_COMMITTED_COST  )
2357     , SUM(fact1.OTH_COMMITTED_COST)
2358        , SUM(fact1.ACT_LABOR_HRS)
2359 	 , SUM(fact1.ACT_EQUIP_HRS)
2360 	 , SUM(fact1.ACT_LABOR_BRDN_COST)
2361 	 , SUM(fact1.ACT_EQUIP_BRDN_COST)
2362 	 , SUM(fact1.ACT_BRDN_COST)
2363 	 , SUM(fact1.ACT_RAW_COST)
2364 	 , SUM(fact1.ACT_REVENUE)
2365        , SUM(fact1.ACT_LABOR_RAW_COST)
2366        , SUM(fact1.ACT_EQUIP_RAW_COST)
2367 	 , SUM(fact1.ETC_LABOR_HRS)
2368 	 , SUM(fact1.ETC_EQUIP_HRS)
2369 	 , SUM(fact1.ETC_LABOR_BRDN_COST)
2370 	 , SUM(fact1.ETC_EQUIP_BRDN_COST)
2371 	 , SUM(fact1.ETC_BRDN_COST )
2372        , SUM(fact1.ETC_RAW_COST )
2373        , SUM(fact1.ETC_LABOR_RAW_COST)
2374        , SUM(fact1.ETC_EQUIP_RAW_COST)
2375     , SUM(CUSTOM1	)
2376     , SUM(CUSTOM2	)
2377     , SUM(CUSTOM3	)
2378     , SUM(CUSTOM4	)
2379     , SUM(CUSTOM5	)
2380     , SUM(CUSTOM6	)
2381     , SUM(CUSTOM7	)
2382     , SUM(CUSTOM8	)
2383     , SUM(CUSTOM9	)
2384     , SUM(CUSTOM10	)
2385     , SUM(CUSTOM11	)
2386     , SUM(CUSTOM12	)
2387     , SUM(CUSTOM13	)
2388     , SUM(CUSTOM14	)
2389     , SUM(CUSTOM15)
2390     , 'ENTR'
2391     , g_default_prg_level prg_level
2392     , fact1.PLAN_TYPE_CODE PLAN_TYPE_CODE    /* 4471527 */
2393     FROM
2394 	  pji_fp_aggr_pjp1_t fact1  -- ,  PJI_FM_EXTR_PLNVER3_T ver
2395       , pji_time_ENT_PERIOD period
2396 	, pji_time_ENT_QTR    qtr
2397     , pji_fm_extr_plnver3_t  ver
2398     WHERE
2399         fact1.calendar_type = 'E'
2400     AND period.ENT_period_id = fact1.time_id
2401     AND period.ENT_qtr_id = qtr.ENT_qtr_id
2402     AND fact1.period_type_id = 32
2403     AND fact1.worker_id = g_worker_id
2404 --    AND fact1.rbs_version_id IN (ver.rbs_struct_version_id, -1)   /* 4632551 */
2405     -- AND ( ver.rbs_struct_version_id = fact1.rbs_version_id  OR fact1.rbs_version_id = -1)
2406     AND NVL(ver.rbs_struct_version_id, -1) = fact1.rbs_version_id
2407     AND ver.secondary_rbs_flag = 'N'
2408     AND fact1.plan_version_id = ver.plan_version_id
2409     AND fact1.plan_type_code = ver.plan_type_code    /*  4471527 */
2410   GROUP BY
2411       fact1.PROJECT_ID
2412     , fact1.PROJECT_ORG_ID
2413     , fact1.PROJECT_ORGANIZATION_ID
2414     -- -- -- , fact1.PARTITION_ID
2415     , fact1.PROJECT_ELEMENT_ID
2416     , fact1.calendar_type
2417     , RBS_AGGR_LEVEL
2418     , WBS_ROLLUP_FLAG
2419     , PRG_ROLLUP_FLAG
2420     , fact1.CURR_RECORD_TYPE_ID
2421     , fact1.CURRENCY_CODE
2422     , fact1.RBS_ELEMENT_ID
2423     , fact1.RBS_VERSION_ID
2424     , fact1.PLAN_VERSION_ID
2425     , fact1.plan_type_id
2426     , fact1.plan_type_code    /*4471527 */
2427     , rollup (qtr.ENT_YEAR_ID,
2428               period.ENT_QTR_ID,
2429               period.ENT_PERIOD_ID))
2430    WHERE 1=1
2431      AND period_type_id > 32
2432      AND period_type_id < 2048;
2433 
2434 EXCEPTION
2435   WHEN OTHERS THEN
2436     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
2437                              p_procedure_name => 'CREATE_FP_ENT_SEC_ROLLUP');
2438     RAISE;
2439 END;
2440 
2441 
2442 PROCEDURE CREATE_AC_PA_ROLLUP IS
2443 BEGIN
2444 
2445     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
2446 
2447     INSERT INTO pji_ac_aggr_pjp1_t
2448     (
2449        WORKER_ID
2450      , PROJECT_ID
2451      , PROJECT_ORG_ID
2452      , PROJECT_ORGANIZATION_ID
2453      -- , PARTITION_ID
2454      , PROJECT_ELEMENT_ID
2455      , TIME_ID
2456      , PERIOD_TYPE_ID
2457      , CALENDAR_TYPE
2458      , WBS_ROLLUP_FLAG
2459      , PRG_ROLLUP_FLAG
2460      , CURR_RECORD_TYPE_ID
2461      , CURRENCY_CODE
2462      , REVENUE
2463      , INITIAL_FUNDING_AMOUNT
2464      , INITIAL_FUNDING_COUNT
2465      , ADDITIONAL_FUNDING_AMOUNT
2466      , ADDITIONAL_FUNDING_COUNT
2467      , CANCELLED_FUNDING_AMOUNT
2468      , CANCELLED_FUNDING_COUNT
2469      , FUNDING_ADJUSTMENT_AMOUNT
2470      , FUNDING_ADJUSTMENT_COUNT
2471      , REVENUE_WRITEOFF
2472      , AR_INVOICE_AMOUNT
2473      , AR_INVOICE_COUNT
2474      , AR_CASH_APPLIED_AMOUNT
2475      , AR_INVOICE_WRITE_OFF_AMOUNT
2476      , AR_INVOICE_WRITEOFF_COUNT
2477      , AR_CREDIT_MEMO_AMOUNT
2478      , AR_CREDIT_MEMO_COUNT
2479      , UNBILLED_RECEIVABLES
2480      , UNEARNED_REVENUE
2481      , AR_UNAPPR_INVOICE_AMOUNT
2482      , AR_UNAPPR_INVOICE_COUNT
2483      , AR_APPR_INVOICE_AMOUNT
2484      , AR_APPR_INVOICE_COUNT
2485      , AR_AMOUNT_DUE
2486      , AR_COUNT_DUE
2487      , AR_AMOUNT_OVERDUE
2488      , AR_COUNT_OVERDUE
2489      , DORMANT_BACKLOG_INACTIV
2490      , DORMANT_BACKLOG_START
2491      , LOST_BACKLOG
2492      , ACTIVE_BACKLOG
2493      , REVENUE_AT_RISK
2494      , CUSTOM1
2495      , CUSTOM2
2496      , CUSTOM3
2497      , CUSTOM4
2498      , CUSTOM5
2499      , CUSTOM6
2500      , CUSTOM7
2501      , CUSTOM8
2502      , CUSTOM9
2503      , CUSTOM10
2504      , CUSTOM11
2505      , CUSTOM12
2506      , CUSTOM13
2507      , CUSTOM14
2508      , CUSTOM15
2509      , PRG_LEVEL
2510     )
2511   SELECT * FROM (
2512     SELECT
2513       -- GROUPING(qtr.CAL_YEAR_ID)  gy
2514       -- , GROUPING(period.CAL_QTR_ID)  gq
2515       -- , GROUPING(period.CAL_PERIOD_ID)  gp
2516       -- ,
2517        g_worker_id
2518      , fact1.PROJECT_ID
2519      , fact1.PROJECT_ORG_ID
2520      , fact1.PROJECT_ORGANIZATION_ID
2521      -- -- -- , fact1.PARTITION_ID
2522      , fact1.PROJECT_ELEMENT_ID
2523      , DECODE (
2524                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
2525              , '000', period.CAL_PERIOD_ID
2526              , '001', period.CAL_QTR_ID
2527              , '011', qtr.CAL_YEAR_ID
2528              , '111', -1 ) TIME_ID
2529      , DECODE (
2530                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
2531              , '000', 32
2532              , '001', 64
2533              , '011', 128
2534              , '111', 2048 ) PERIOD_TYPE_ID
2535      , fact1.CALENDAR_TYPE
2536      , fact1.WBS_ROLLUP_FLAG
2537      , fact1.PRG_ROLLUP_FLAG
2538      , fact1.CURR_RECORD_TYPE_ID
2539      , fact1.CURRENCY_CODE
2540      , SUM(fact1.REVENUE )
2541      , SUM(fact1.INITIAL_FUNDING_AMOUNT )
2542      , SUM(fact1.INITIAL_FUNDING_COUNT)
2543      , SUM(fact1.ADDITIONAL_FUNDING_AMOUNT)
2544      , SUM(fact1.ADDITIONAL_FUNDING_COUNT  )
2545      , SUM(fact1.CANCELLED_FUNDING_AMOUNT)
2546      , SUM(fact1.CANCELLED_FUNDING_COUNT)
2547      , SUM(fact1.FUNDING_ADJUSTMENT_AMOUNT)
2548      , SUM(fact1.FUNDING_ADJUSTMENT_COUNT)
2549      , SUM(fact1.REVENUE_WRITEOFF)
2550      , SUM(fact1.AR_INVOICE_AMOUNT)
2551      , SUM(fact1.AR_INVOICE_COUNT)
2552      , SUM(fact1.AR_CASH_APPLIED_AMOUNT)
2553      , SUM(fact1.AR_INVOICE_WRITE_OFF_AMOUNT)
2554      , SUM(fact1.AR_INVOICE_WRITEOFF_COUNT)
2555      , SUM(fact1.AR_CREDIT_MEMO_AMOUNT)
2556      , SUM(fact1.AR_CREDIT_MEMO_COUNT)
2557      , SUM(fact1.UNBILLED_RECEIVABLES)
2558      , SUM(fact1.UNEARNED_REVENUE)
2559      , SUM(fact1.AR_UNAPPR_INVOICE_AMOUNT)
2560      , SUM(fact1.AR_UNAPPR_INVOICE_COUNT)
2561      , SUM(fact1.AR_APPR_INVOICE_AMOUNT)
2562      , SUM(fact1.AR_APPR_INVOICE_COUNT)
2563      , SUM(fact1.AR_AMOUNT_DUE)
2564      , SUM(fact1.AR_COUNT_DUE)
2565      , SUM(fact1.AR_AMOUNT_OVERDUE)
2566      , SUM(fact1.AR_COUNT_OVERDUE)
2567      , SUM(fact1.DORMANT_BACKLOG_INACTIV)
2568      , SUM(fact1.DORMANT_BACKLOG_START)
2569      , SUM(fact1.LOST_BACKLOG)
2570      , SUM(fact1.ACTIVE_BACKLOG)
2571      , SUM(fact1.REVENUE_AT_RISK)
2572      , SUM(fact1.CUSTOM1)
2573      , SUM(fact1.CUSTOM2)
2574      , SUM(fact1.CUSTOM3)
2575      , SUM(fact1.CUSTOM4)
2576      , SUM(fact1.CUSTOM5)
2577      , SUM(fact1.CUSTOM6)
2578      , SUM(fact1.CUSTOM7)
2579      , SUM(fact1.CUSTOM8)
2580      , SUM(fact1.CUSTOM9)
2581      , SUM(fact1.CUSTOM10)
2582      , SUM(fact1.CUSTOM11)
2583      , SUM(fact1.CUSTOM12)
2584      , SUM(fact1.CUSTOM13)
2585      , SUM(fact1.CUSTOM14)
2586      , SUM(fact1.CUSTOM15)
2587      , g_default_prg_level prg_level
2588     FROM
2589       pji_ac_aggr_pjp1_t fact1
2590     , pji_time_CAL_PERIOD period
2591 	, pji_time_CAL_QTR    qtr
2592     WHERE
2593         fact1.calendar_type = 'P'
2594     AND period.cal_period_id = fact1.time_id
2595     AND period.cal_qtr_id = qtr.cal_qtr_id
2596     AND fact1.period_type_id = 32
2597     AND fact1.worker_id = g_worker_id
2598   GROUP BY
2599        fact1.PROJECT_ID
2600      , fact1.PROJECT_ORG_ID
2601      , fact1.PROJECT_ORGANIZATION_ID
2602      -- -- -- , fact1.PARTITION_ID
2603      , fact1.PROJECT_ELEMENT_ID
2604      , fact1.CALENDAR_TYPE
2605      , rollup (qtr.CAL_YEAR_ID,
2606                period.CAL_QTR_ID,
2607                period.CAL_PERIOD_ID)
2608      , fact1.WBS_ROLLUP_FLAG
2609      , fact1.PRG_ROLLUP_FLAG
2610      , fact1.CURR_RECORD_TYPE_ID
2611      , fact1.CURRENCY_CODE )
2612    WHERE 1=1
2613      AND period_type_id > 32
2614      AND period_type_id < 2048;
2615 
2616 
2617 EXCEPTION
2618   WHEN OTHERS THEN
2619     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
2620                              p_procedure_name => 'CREATE_AC_PA_ROLLUP');
2621     RAISE;
2622 END;
2623 
2624 
2625 PROCEDURE CREATE_AC_GL_ROLLUP IS
2626 BEGIN
2627 
2628     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
2629 
2630     INSERT INTO pji_ac_aggr_pjp1_t
2631     (
2632        worker_id
2633      , PROJECT_ID
2634      , PROJECT_ORG_ID
2635      , PROJECT_ORGANIZATION_ID
2636      -- , PARTITION_ID
2637      , PROJECT_ELEMENT_ID
2638      , TIME_ID
2639      , PERIOD_TYPE_ID
2640      , CALENDAR_TYPE
2641      , WBS_ROLLUP_FLAG
2642      , PRG_ROLLUP_FLAG
2643      , CURR_RECORD_TYPE_ID
2644      , CURRENCY_CODE
2645      , REVENUE
2646      , INITIAL_FUNDING_AMOUNT
2647      , INITIAL_FUNDING_COUNT
2648      , ADDITIONAL_FUNDING_AMOUNT
2649      , ADDITIONAL_FUNDING_COUNT
2650      , CANCELLED_FUNDING_AMOUNT
2651      , CANCELLED_FUNDING_COUNT
2652      , FUNDING_ADJUSTMENT_AMOUNT
2653      , FUNDING_ADJUSTMENT_COUNT
2654      , REVENUE_WRITEOFF
2655      , AR_INVOICE_AMOUNT
2656      , AR_INVOICE_COUNT
2657      , AR_CASH_APPLIED_AMOUNT
2658      , AR_INVOICE_WRITE_OFF_AMOUNT
2659      , AR_INVOICE_WRITEOFF_COUNT
2660      , AR_CREDIT_MEMO_AMOUNT
2661      , AR_CREDIT_MEMO_COUNT
2662      , UNBILLED_RECEIVABLES
2663      , UNEARNED_REVENUE
2664      , AR_UNAPPR_INVOICE_AMOUNT
2665      , AR_UNAPPR_INVOICE_COUNT
2666      , AR_APPR_INVOICE_AMOUNT
2667      , AR_APPR_INVOICE_COUNT
2668      , AR_AMOUNT_DUE
2669      , AR_COUNT_DUE
2670      , AR_AMOUNT_OVERDUE
2671      , AR_COUNT_OVERDUE
2672      , DORMANT_BACKLOG_INACTIV
2673      , DORMANT_BACKLOG_START
2674      , LOST_BACKLOG
2675      , ACTIVE_BACKLOG
2676      , REVENUE_AT_RISK
2677      , CUSTOM1
2678      , CUSTOM2
2679      , CUSTOM3
2680      , CUSTOM4
2681      , CUSTOM5
2682      , CUSTOM6
2683      , CUSTOM7
2684      , CUSTOM8
2685      , CUSTOM9
2686      , CUSTOM10
2687      , CUSTOM11
2688      , CUSTOM12
2689      , CUSTOM13
2690      , CUSTOM14
2691      , CUSTOM15
2692      , PRG_LEVEL
2693     )
2694   SELECT * FROM (
2695     SELECT
2696       -- GROUPING(qtr.CAL_YEAR_ID)  gy
2697       -- , GROUPING(period.CAL_QTR_ID)  gq
2698       -- , GROUPING(period.CAL_PERIOD_ID)  gp
2699       -- ,
2700        g_worker_id
2701      , fact1.PROJECT_ID
2702      , fact1.PROJECT_ORG_ID
2703      , fact1.PROJECT_ORGANIZATION_ID
2704      -- -- -- , fact1.PARTITION_ID
2705      , fact1.PROJECT_ELEMENT_ID
2706      , DECODE (
2707                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
2708              , '000', period.CAL_PERIOD_ID
2709              , '001', period.CAL_QTR_ID
2710              , '011', qtr.CAL_YEAR_ID
2711              , '111', -1 ) TIME_ID
2712      , DECODE (
2713                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
2714              , '000', 32
2715              , '001', 64
2716              , '011', 128
2717              , '111', 2048 ) PERIOD_TYPE_ID
2718      , fact1.CALENDAR_TYPE
2719      , fact1.WBS_ROLLUP_FLAG
2720      , fact1.PRG_ROLLUP_FLAG
2721      , fact1.CURR_RECORD_TYPE_ID
2722      , fact1.CURRENCY_CODE
2723      , SUM(fact1.REVENUE )
2724      , SUM(fact1.INITIAL_FUNDING_AMOUNT )
2725      , SUM(fact1.INITIAL_FUNDING_COUNT)
2726      , SUM(fact1.ADDITIONAL_FUNDING_AMOUNT)
2727      , SUM(fact1.ADDITIONAL_FUNDING_COUNT  )
2728      , SUM(fact1.CANCELLED_FUNDING_AMOUNT)
2729      , SUM(fact1.CANCELLED_FUNDING_COUNT)
2730      , SUM(fact1.FUNDING_ADJUSTMENT_AMOUNT)
2731      , SUM(fact1.FUNDING_ADJUSTMENT_COUNT)
2732      , SUM(fact1.REVENUE_WRITEOFF)
2733      , SUM(fact1.AR_INVOICE_AMOUNT)
2734      , SUM(fact1.AR_INVOICE_COUNT)
2735      , SUM(fact1.AR_CASH_APPLIED_AMOUNT)
2736      , SUM(fact1.AR_INVOICE_WRITE_OFF_AMOUNT)
2737      , SUM(fact1.AR_INVOICE_WRITEOFF_COUNT)
2738      , SUM(fact1.AR_CREDIT_MEMO_AMOUNT)
2739      , SUM(fact1.AR_CREDIT_MEMO_COUNT)
2740      , SUM(fact1.UNBILLED_RECEIVABLES)
2741      , SUM(fact1.UNEARNED_REVENUE)
2742      , SUM(fact1.AR_UNAPPR_INVOICE_AMOUNT)
2743      , SUM(fact1.AR_UNAPPR_INVOICE_COUNT)
2744      , SUM(fact1.AR_APPR_INVOICE_AMOUNT)
2745      , SUM(fact1.AR_APPR_INVOICE_COUNT)
2746      , SUM(fact1.AR_AMOUNT_DUE)
2747      , SUM(fact1.AR_COUNT_DUE)
2748      , SUM(fact1.AR_AMOUNT_OVERDUE)
2749      , SUM(fact1.AR_COUNT_OVERDUE)
2750      , SUM(fact1.DORMANT_BACKLOG_INACTIV)
2751      , SUM(fact1.DORMANT_BACKLOG_START)
2752      , SUM(fact1.LOST_BACKLOG)
2753      , SUM(fact1.ACTIVE_BACKLOG)
2754      , SUM(fact1.REVENUE_AT_RISK)
2755      , SUM(fact1.CUSTOM1)
2756      , SUM(fact1.CUSTOM2)
2757      , SUM(fact1.CUSTOM3)
2758      , SUM(fact1.CUSTOM4)
2759      , SUM(fact1.CUSTOM5)
2760      , SUM(fact1.CUSTOM6)
2761      , SUM(fact1.CUSTOM7)
2762      , SUM(fact1.CUSTOM8)
2763      , SUM(fact1.CUSTOM9)
2764      , SUM(fact1.CUSTOM10)
2765      , SUM(fact1.CUSTOM11)
2766      , SUM(fact1.CUSTOM12)
2767      , SUM(fact1.CUSTOM13)
2768      , SUM(fact1.CUSTOM14)
2769      , SUM(fact1.CUSTOM15)
2770      , g_default_prg_level prg_level
2771     FROM
2772       pji_ac_aggr_pjp1_t fact1
2773     , pji_time_CAL_PERIOD period
2774 	, pji_time_CAL_QTR    qtr
2775     WHERE
2776           fact1.calendar_type = 'G'
2777       AND period.cal_period_id = fact1.time_id
2778 	AND period.cal_qtr_id = qtr.cal_qtr_id
2779       AND fact1.period_type_id = 32
2780       AND fact1.worker_id = g_worker_id
2781     GROUP BY
2782        fact1.PROJECT_ID
2783      , fact1.PROJECT_ORG_ID
2784      , fact1.PROJECT_ORGANIZATION_ID
2785      -- -- -- , fact1.PARTITION_ID
2786      , fact1.PROJECT_ELEMENT_ID
2787      , fact1.CALENDAR_TYPE
2788      , rollup (qtr.CAL_YEAR_ID,
2789                period.CAL_QTR_ID,
2790                period.CAL_PERIOD_ID)
2791      , fact1.WBS_ROLLUP_FLAG
2792      , fact1.PRG_ROLLUP_FLAG
2793      , fact1.CURR_RECORD_TYPE_ID
2794      , fact1.CURRENCY_CODE )
2795    WHERE 1=1
2796      AND period_type_id > 32
2797      AND period_type_id < 2048;
2798 
2799 EXCEPTION
2800   WHEN OTHERS THEN
2801     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
2802                              p_procedure_name => 'CREATE_AC_GL_ROLLUP');
2803     RAISE;
2804 END;
2805 
2806 
2807 PROCEDURE CREATE_AC_ENT_ROLLUP IS
2808 BEGIN
2809 
2810   -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
2811 
2812   INSERT INTO pji_ac_aggr_pjp1_t
2813   (
2814        worker_id
2815      , PROJECT_ID
2816      , PROJECT_ORG_ID
2817      , PROJECT_ORGANIZATION_ID
2818      -- , PARTITION_ID
2819      , PROJECT_ELEMENT_ID
2820      , TIME_ID
2821      , PERIOD_TYPE_ID
2822      , CALENDAR_TYPE
2823      , WBS_ROLLUP_FLAG
2824      , PRG_ROLLUP_FLAG
2825      , CURR_RECORD_TYPE_ID
2826      , CURRENCY_CODE
2827      , REVENUE
2828      , INITIAL_FUNDING_AMOUNT
2829      , INITIAL_FUNDING_COUNT
2830      , ADDITIONAL_FUNDING_AMOUNT
2831      , ADDITIONAL_FUNDING_COUNT
2832      , CANCELLED_FUNDING_AMOUNT
2833      , CANCELLED_FUNDING_COUNT
2834      , FUNDING_ADJUSTMENT_AMOUNT
2835      , FUNDING_ADJUSTMENT_COUNT
2836      , REVENUE_WRITEOFF
2837      , AR_INVOICE_AMOUNT
2838      , AR_INVOICE_COUNT
2839      , AR_CASH_APPLIED_AMOUNT
2840      , AR_INVOICE_WRITE_OFF_AMOUNT
2841      , AR_INVOICE_WRITEOFF_COUNT
2842      , AR_CREDIT_MEMO_AMOUNT
2843      , AR_CREDIT_MEMO_COUNT
2844      , UNBILLED_RECEIVABLES
2845      , UNEARNED_REVENUE
2846      , AR_UNAPPR_INVOICE_AMOUNT
2847      , AR_UNAPPR_INVOICE_COUNT
2848      , AR_APPR_INVOICE_AMOUNT
2849      , AR_APPR_INVOICE_COUNT
2850      , AR_AMOUNT_DUE
2851      , AR_COUNT_DUE
2852      , AR_AMOUNT_OVERDUE
2853      , AR_COUNT_OVERDUE
2854      , DORMANT_BACKLOG_INACTIV
2855      , DORMANT_BACKLOG_START
2856      , LOST_BACKLOG
2857      , ACTIVE_BACKLOG
2858      , REVENUE_AT_RISK
2859      , CUSTOM1
2860      , CUSTOM2
2861      , CUSTOM3
2862      , CUSTOM4
2863      , CUSTOM5
2864      , CUSTOM6
2865      , CUSTOM7
2866      , CUSTOM8
2867      , CUSTOM9
2868      , CUSTOM10
2869      , CUSTOM11
2870      , CUSTOM12
2871      , CUSTOM13
2872      , CUSTOM14
2873      , CUSTOM15
2874      , PRG_LEVEL
2875   )
2876   SELECT * FROM (
2877   SELECT
2878       -- GROUPING(qtr.CAL_YEAR_ID)  gy
2879       -- , GROUPING(period.CAL_QTR_ID)  gq
2880       -- , GROUPING(period.CAL_PERIOD_ID)  gp
2881       -- ,
2882        g_worker_id
2883      , fact1.PROJECT_ID
2884      , fact1.PROJECT_ORG_ID
2885      , fact1.PROJECT_ORGANIZATION_ID
2886      -- -- -- , fact1.PARTITION_ID
2887      , fact1.PROJECT_ELEMENT_ID
2888      , DECODE (
2889                (grouping(qtr.ENT_YEAR_ID) || grouping(period.ENT_QTR_ID) || grouping(period.ENT_PERIOD_ID) )
2890              , '000', period.ENT_PERIOD_ID
2891              , '001', period.ENT_QTR_ID
2892              , '011', qtr.ENT_YEAR_ID
2893              , '111', -1 ) TIME_ID
2894      , DECODE (
2895                (grouping(qtr.ENT_YEAR_ID) || grouping(period.ENT_QTR_ID) || grouping(period.ENT_PERIOD_ID) )
2896              , '000', 32
2897              , '001', 64
2898              , '011', 128
2899              , '111', 2048 ) PERIOD_TYPE_ID
2900      , fact1.CALENDAR_TYPE
2901      , fact1.WBS_ROLLUP_FLAG
2902      , fact1.PRG_ROLLUP_FLAG
2903      , fact1.CURR_RECORD_TYPE_ID
2904      , fact1.CURRENCY_CODE
2905      , SUM(fact1.REVENUE )
2906      , SUM(fact1.INITIAL_FUNDING_AMOUNT )
2907      , SUM(fact1.INITIAL_FUNDING_COUNT)
2908      , SUM(fact1.ADDITIONAL_FUNDING_AMOUNT)
2909      , SUM(fact1.ADDITIONAL_FUNDING_COUNT  )
2910      , SUM(fact1.CANCELLED_FUNDING_AMOUNT)
2911      , SUM(fact1.CANCELLED_FUNDING_COUNT)
2912      , SUM(fact1.FUNDING_ADJUSTMENT_AMOUNT)
2913      , SUM(fact1.FUNDING_ADJUSTMENT_COUNT)
2914      , SUM(fact1.REVENUE_WRITEOFF)
2915      , SUM(fact1.AR_INVOICE_AMOUNT)
2916      , SUM(fact1.AR_INVOICE_COUNT)
2917      , SUM(fact1.AR_CASH_APPLIED_AMOUNT)
2918      , SUM(fact1.AR_INVOICE_WRITE_OFF_AMOUNT)
2919      , SUM(fact1.AR_INVOICE_WRITEOFF_COUNT)
2920      , SUM(fact1.AR_CREDIT_MEMO_AMOUNT)
2921      , SUM(fact1.AR_CREDIT_MEMO_COUNT)
2922      , SUM(fact1.UNBILLED_RECEIVABLES)
2923      , SUM(fact1.UNEARNED_REVENUE)
2924      , SUM(fact1.AR_UNAPPR_INVOICE_AMOUNT)
2925      , SUM(fact1.AR_UNAPPR_INVOICE_COUNT)
2926      , SUM(fact1.AR_APPR_INVOICE_AMOUNT)
2927      , SUM(fact1.AR_APPR_INVOICE_COUNT)
2928      , SUM(fact1.AR_AMOUNT_DUE)
2929      , SUM(fact1.AR_COUNT_DUE)
2930      , SUM(fact1.AR_AMOUNT_OVERDUE)
2931      , SUM(fact1.AR_COUNT_OVERDUE)
2932      , SUM(fact1.DORMANT_BACKLOG_INACTIV)
2933      , SUM(fact1.DORMANT_BACKLOG_START)
2934      , SUM(fact1.LOST_BACKLOG)
2935      , SUM(fact1.ACTIVE_BACKLOG)
2936      , SUM(fact1.REVENUE_AT_RISK)
2937      , SUM(fact1.CUSTOM1)
2938      , SUM(fact1.CUSTOM2)
2939      , SUM(fact1.CUSTOM3)
2940      , SUM(fact1.CUSTOM4)
2941      , SUM(fact1.CUSTOM5)
2942      , SUM(fact1.CUSTOM6)
2943      , SUM(fact1.CUSTOM7)
2944      , SUM(fact1.CUSTOM8)
2945      , SUM(fact1.CUSTOM9)
2946      , SUM(fact1.CUSTOM10)
2947      , SUM(fact1.CUSTOM11)
2948      , SUM(fact1.CUSTOM12)
2949      , SUM(fact1.CUSTOM13)
2950      , SUM(fact1.CUSTOM14)
2951      , SUM(fact1.CUSTOM15)
2952      , g_default_prg_level prg_level
2953     FROM
2954 	   pji_ac_aggr_pjp1_t fact1
2955      , pji_time_ENT_PERIOD period
2956  	 , pji_time_ENT_QTR    qtr
2957     WHERE
2958         fact1.calendar_type = 'E'
2959     AND period.ENT_period_id = fact1.time_id
2960     AND period.ENT_qtr_id = qtr.ENT_qtr_id
2961     AND fact1.period_type_id = 32
2962     AND fact1.worker_id = g_worker_id
2963   GROUP BY
2964        fact1.PROJECT_ID
2965      , fact1.PROJECT_ORG_ID
2966      , fact1.PROJECT_ORGANIZATION_ID
2967      -- -- -- , fact1.PARTITION_ID
2968      , fact1.PROJECT_ELEMENT_ID
2969      , fact1.CALENDAR_TYPE
2970      , fact1.WBS_ROLLUP_FLAG
2971      , fact1.PRG_ROLLUP_FLAG
2972      , fact1.CURR_RECORD_TYPE_ID
2973      , fact1.CURRENCY_CODE
2974      , rollup (qtr.ENT_YEAR_ID,
2975               period.ENT_QTR_ID,
2976               period.ENT_PERIOD_ID))
2977    WHERE 1=1
2978      AND period_type_id > 32
2979      AND period_type_id < 2048;
2980 
2981 EXCEPTION
2982   WHEN OTHERS THEN
2983     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
2984                              p_procedure_name => 'CREATE_AC_ENT_ROLLUP');
2985     RAISE;
2986 END;
2987 
2988 
2989 
2990 PROCEDURE CREATE_AC_ALL_T_PRI_ROLLUP (
2991   p_calendar_type IN VARCHAR2 := 'G' ) IS
2992     -- l_last_update_date     date   := SYSDATE;
2993     -- l_last_updated_by      NUMBER := FND_GLOBAL.USER_ID;
2994     -- l_creation_date        date   := SYSDATE;
2995     -- l_created_by           NUMBER := FND_GLOBAL.USER_ID;
2996     l_last_update_login    NUMBER := FND_GLOBAL.LOGIN_ID;
2997     l_line_type            VARCHAR2(15);
2998 
2999 BEGIN
3000 
3001   -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
3002 
3003   IF (p_calendar_type NOT IN ('P', 'G') ) THEN
3004     RETURN;
3005   ELSE
3006     IF (p_calendar_type = 'P') THEN
3007       l_line_type := 'PAR';
3008     ELSE
3009       l_line_type := 'GLR';
3010     END IF;
3011   END IF;
3012 
3013     INSERT INTO PJI_AC_AGGR_PJP1_T
3014     (
3015        worker_id
3016      , PROJECT_ID
3017      , PROJECT_ORG_ID
3018      , PROJECT_ORGANIZATION_ID
3019      -- , PARTITION_ID
3020      , PROJECT_ELEMENT_ID
3021      , TIME_ID
3022      , PERIOD_TYPE_ID
3023      , CALENDAR_TYPE
3024      , WBS_ROLLUP_FLAG
3025      , PRG_ROLLUP_FLAG
3026      , CURR_RECORD_TYPE_ID
3027      , CURRENCY_CODE
3028      , REVENUE
3029      , INITIAL_FUNDING_AMOUNT
3030      , INITIAL_FUNDING_COUNT
3031      , ADDITIONAL_FUNDING_AMOUNT
3032      , ADDITIONAL_FUNDING_COUNT
3033      , CANCELLED_FUNDING_AMOUNT
3034      , CANCELLED_FUNDING_COUNT
3035      , FUNDING_ADJUSTMENT_AMOUNT
3036      , FUNDING_ADJUSTMENT_COUNT
3037      , REVENUE_WRITEOFF
3038      , AR_INVOICE_AMOUNT
3039      , AR_INVOICE_COUNT
3040      , AR_CASH_APPLIED_AMOUNT
3041      , AR_INVOICE_WRITE_OFF_AMOUNT
3042      , AR_INVOICE_WRITEOFF_COUNT
3043      , AR_CREDIT_MEMO_AMOUNT
3044      , AR_CREDIT_MEMO_COUNT
3045      , UNBILLED_RECEIVABLES
3046      , UNEARNED_REVENUE
3047      , AR_UNAPPR_INVOICE_AMOUNT
3048      , AR_UNAPPR_INVOICE_COUNT
3049      , AR_APPR_INVOICE_AMOUNT
3050      , AR_APPR_INVOICE_COUNT
3051      , AR_AMOUNT_DUE
3052      , AR_COUNT_DUE
3053      , AR_AMOUNT_OVERDUE
3054      , AR_COUNT_OVERDUE
3055      , DORMANT_BACKLOG_INACTIV
3056      , DORMANT_BACKLOG_START
3057      , LOST_BACKLOG
3058      , ACTIVE_BACKLOG
3059      , REVENUE_AT_RISK
3060      , CUSTOM1
3061      , CUSTOM2
3062      , CUSTOM3
3063      , CUSTOM4
3064      , CUSTOM5
3065      , CUSTOM6
3066      , CUSTOM7
3067      , CUSTOM8
3068      , CUSTOM9
3069      , CUSTOM10
3070      , CUSTOM11
3071      , CUSTOM12
3072      , CUSTOM13
3073      , CUSTOM14
3074      , CUSTOM15
3075      , PRG_LEVEL
3076     )
3077   SELECT * FROM (
3078     SELECT
3079       -- GROUPING(qtr.CAL_YEAR_ID)  gy
3080       -- , GROUPING(period.CAL_QTR_ID)  gq
3081       -- , GROUPING(period.CAL_PERIOD_ID)  gp
3082       -- ,
3083        g_worker_id
3084      , fact1.PROJECT_ID
3085      , fact1.PROJECT_ORG_ID
3086      , fact1.PROJECT_ORGANIZATION_ID
3087      -- -- -- , fact1.PARTITION_ID
3088      , fact1.PROJECT_ELEMENT_ID
3089      , DECODE (
3090                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
3091              , '000', period.CAL_PERIOD_ID
3092              , '001', period.CAL_QTR_ID
3093              , '011', qtr.CAL_YEAR_ID
3094              , '111', -1 ) TIME_ID
3095      , DECODE (
3096                (grouping(qtr.CAL_YEAR_ID) || grouping(period.CAL_QTR_ID) || grouping(period.CAL_PERIOD_ID) )
3097              , '000', 32
3098              , '001', 64
3099              , '011', 128
3100              , '111', 2048 ) PERIOD_TYPE_ID
3101      , fact1.CALENDAR_TYPE
3102      , fact1.WBS_ROLLUP_FLAG
3103      , fact1.PRG_ROLLUP_FLAG
3104      , fact1.CURR_RECORD_TYPE_ID
3105      , fact1.CURRENCY_CODE
3106      , SUM(fact1.REVENUE )
3107      , SUM(fact1.INITIAL_FUNDING_AMOUNT )
3108      , SUM(fact1.INITIAL_FUNDING_COUNT)
3109      , SUM(fact1.ADDITIONAL_FUNDING_AMOUNT)
3110      , SUM(fact1.ADDITIONAL_FUNDING_COUNT  )
3111      , SUM(fact1.CANCELLED_FUNDING_AMOUNT)
3112      , SUM(fact1.CANCELLED_FUNDING_COUNT)
3113      , SUM(fact1.FUNDING_ADJUSTMENT_AMOUNT)
3114      , SUM(fact1.FUNDING_ADJUSTMENT_COUNT)
3115      , SUM(fact1.REVENUE_WRITEOFF)
3116      , SUM(fact1.AR_INVOICE_AMOUNT)
3117      , SUM(fact1.AR_INVOICE_COUNT)
3118      , SUM(fact1.AR_CASH_APPLIED_AMOUNT)
3119      , SUM(fact1.AR_INVOICE_WRITE_OFF_AMOUNT)
3120      , SUM(fact1.AR_INVOICE_WRITEOFF_COUNT)
3121      , SUM(fact1.AR_CREDIT_MEMO_AMOUNT)
3122      , SUM(fact1.AR_CREDIT_MEMO_COUNT)
3123      , SUM(fact1.UNBILLED_RECEIVABLES)
3124      , SUM(fact1.UNEARNED_REVENUE)
3125      , SUM(fact1.AR_UNAPPR_INVOICE_AMOUNT)
3126      , SUM(fact1.AR_UNAPPR_INVOICE_COUNT)
3127      , SUM(fact1.AR_APPR_INVOICE_AMOUNT)
3128      , SUM(fact1.AR_APPR_INVOICE_COUNT)
3129      , SUM(fact1.AR_AMOUNT_DUE)
3130      , SUM(fact1.AR_COUNT_DUE)
3131      , SUM(fact1.AR_AMOUNT_OVERDUE)
3132      , SUM(fact1.AR_COUNT_OVERDUE)
3133      , SUM(fact1.DORMANT_BACKLOG_INACTIV)
3134      , SUM(fact1.DORMANT_BACKLOG_START)
3135      , SUM(fact1.LOST_BACKLOG)
3136      , SUM(fact1.ACTIVE_BACKLOG)
3137      , SUM(fact1.REVENUE_AT_RISK)
3138      , SUM(fact1.CUSTOM1)
3139      , SUM(fact1.CUSTOM2)
3140      , SUM(fact1.CUSTOM3)
3141      , SUM(fact1.CUSTOM4)
3142      , SUM(fact1.CUSTOM5)
3143      , SUM(fact1.CUSTOM6)
3144      , SUM(fact1.CUSTOM7)
3145      , SUM(fact1.CUSTOM8)
3146      , SUM(fact1.CUSTOM9)
3147      , SUM(fact1.CUSTOM10)
3148      , SUM(fact1.CUSTOM11)
3149      , SUM(fact1.CUSTOM12)
3150      , SUM(fact1.CUSTOM13)
3151      , SUM(fact1.CUSTOM14)
3152      , SUM(fact1.CUSTOM15)
3153      , g_default_prg_level prg_level
3154     FROM
3155       PJI_AC_AGGR_PJP1_T fact1
3156     , pji_time_CAL_PERIOD period
3157 	, pji_time_CAL_QTR    qtr
3158     WHERE
3159           fact1.calendar_type = p_calendar_type
3160       AND period.cal_period_id = fact1.time_id
3161 	AND period.cal_qtr_id = qtr.cal_qtr_id
3162       AND fact1.period_type_id = 32
3163       AND fact1.worker_id = g_worker_id
3164     GROUP BY
3165        fact1.PROJECT_ID
3166      , fact1.PROJECT_ORG_ID
3167      , fact1.PROJECT_ORGANIZATION_ID
3168      -- -- -- , fact1.PARTITION_ID
3169      , fact1.PROJECT_ELEMENT_ID
3170      , fact1.CALENDAR_TYPE
3171      , rollup (qtr.CAL_YEAR_ID,
3172                period.CAL_QTR_ID,
3173                period.CAL_PERIOD_ID)
3174      , fact1.WBS_ROLLUP_FLAG
3175      , fact1.PRG_ROLLUP_FLAG
3176      , fact1.CURR_RECORD_TYPE_ID
3177      , fact1.CURRENCY_CODE )
3178    WHERE 1=1
3179      AND period_type_id = 2048;
3180 
3181 EXCEPTION
3182   WHEN OTHERS THEN
3183     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
3184                              p_procedure_name => 'CREATE_AC_ALL_T_PRI_ROLLUP');
3185     RAISE;
3186 END;
3187 
3188 
3189 --
3190 -- Prorate PA, GL entered entries in pjp1 table.
3191 --
3192 PROCEDURE PRORATE_TO_ENT_PG_PJP1_D IS
3193 BEGIN
3194 
3195     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
3196 
3197 /* Commented for bug 4005006
3198     INSERT INTO pji_fp_aggr_pjp1_t
3199     (
3200        WORKER_ID
3201      , PROJECT_ID
3202      , PROJECT_ORG_ID
3203      , PROJECT_ORGANIZATION_ID
3204      -- , PARTITION_ID
3205      , PROJECT_ELEMENT_ID
3206      , TIME_ID
3207      , PERIOD_TYPE_ID
3208      , CALENDAR_TYPE
3209      , RBS_AGGR_LEVEL
3210      , WBS_ROLLUP_FLAG
3211      , PRG_ROLLUP_FLAG
3212      , CURR_RECORD_TYPE_ID
3213      , CURRENCY_CODE
3214      , RBS_ELEMENT_ID
3215      , RBS_VERSION_ID
3216      , PLAN_VERSION_ID
3217      , PLAN_TYPE_ID
3218      , RAW_COST
3219      , BRDN_COST
3220      , REVENUE
3221      , BILL_RAW_COST
3222      , BILL_BRDN_COST
3223      , BILL_LABOR_RAW_COST
3224      , BILL_LABOR_BRDN_COST
3225      , BILL_LABOR_HRS
3226      , EQUIPMENT_RAW_COST
3227      , EQUIPMENT_BRDN_COST
3228      , CAPITALIZABLE_RAW_COST
3229      , CAPITALIZABLE_BRDN_COST
3230      , LABOR_RAW_COST
3231      , LABOR_BRDN_COST
3232      , LABOR_HRS
3233      , LABOR_REVENUE
3234      , EQUIPMENT_HOURS
3235      , BILLABLE_EQUIPMENT_HOURS
3236      , SUP_INV_COMMITTED_COST
3237      , PO_COMMITTED_COST
3238      , PR_COMMITTED_COST
3239      , OTH_COMMITTED_COST
3240        , ACT_LABOR_HRS
3241 	   , ACT_EQUIP_HRS
3242 	   , ACT_LABOR_BRDN_COST
3243 	   , ACT_EQUIP_BRDN_COST
3244 	   , ACT_BRDN_COST
3245 	   , ACT_RAW_COST
3246 	   , ACT_REVENUE
3247          , ACT_LABOR_RAW_COST
3248          , ACT_EQUIP_RAW_COST
3249 	   , ETC_LABOR_HRS
3250 	   , ETC_EQUIP_HRS
3251 	   , ETC_LABOR_BRDN_COST
3252 	   , ETC_EQUIP_BRDN_COST
3253 	   , ETC_BRDN_COST
3254          , ETC_RAW_COST
3255          , ETC_LABOR_RAW_COST
3256          , ETC_EQUIP_RAW_COST
3257      , CUSTOM1
3258      , CUSTOM2
3259      , CUSTOM3
3260      , CUSTOM4
3261      , CUSTOM5
3262      , CUSTOM6
3263      , CUSTOM7
3264      , CUSTOM8
3265      , CUSTOM9
3266      , CUSTOM10
3267      , CUSTOM11
3268      , CUSTOM12
3269      , CUSTOM13
3270      , CUSTOM14
3271      , CUSTOM15
3272      , LINE_TYPE
3273      , TIME_DANGLING_FLAG
3274      , RATE_DANGLING_FLAG
3275      , PRG_LEVEL
3276 	)
3277    SELECT
3278        g_worker_id worker_id
3279      , a.PROJECT_ID
3280      , a.PROJECT_ORG_ID
3281      , a.PROJECT_ORGANIZATION_ID
3282      , a.PROJECT_ELEMENT_ID
3283      , a.TIME_ID
3284      , a.PERIOD_TYPE_ID
3285      , a.CALENDAR_TYPE
3286      , a.RBS_AGGR_LEVEL
3287      , a.WBS_ROLLUP_FLAG
3288      , a.PRG_ROLLUP_FLAG
3289      , a.CURR_RECORD_TYPE_ID
3290      , a.CURRENCY_CODE
3291      , a.RBS_ELEMENT_ID
3292      , a.RBS_VERSION_ID
3293      , a.PLAN_VERSION_ID
3294      , a.PLAN_TYPE_ID
3295      , SUM(a.RAW_COST       )
3296      , SUM(a.BRDN_COST 	)
3297      , SUM(a.REVENUE	)
3298      , SUM(a.BILL_RAW_COST )
3299      , SUM(a.BILL_BRDN_COST )
3300      , SUM(a.BILL_LABOR_RAW_COST )
3301      , SUM(a.BILL_LABOR_BRDN_COST )
3302      , SUM(a.BILL_LABOR_HRS )
3303      , SUM(a.EQUIPMENT_RAW_COST )
3304      , SUM(a.EQUIPMENT_BRDN_COST )
3305      , SUM(a.CAPITALIZABLE_RAW_COST )
3306      , SUM(a.CAPITALIZABLE_BRDN_COST )
3307      , SUM(a.LABOR_RAW_COST )
3308      , SUM(a.LABOR_BRDN_COST)
3309      , SUM(a.LABOR_HRS )
3310      , SUM(a.LABOR_REVENUE )
3311      , SUM(a.EQUIPMENT_HOURS )
3312      , SUM(a.BILLABLE_EQUIPMENT_HOURS)
3313      , SUM(a.SUP_INV_COMMITTED_COST)
3314      , SUM(a.PO_COMMITTED_COST )
3315      , SUM(a.PR_COMMITTED_COST )
3316      , SUM(a.OTH_COMMITTED_COST)
3317        , SUM(a.ACT_LABOR_HRS)
3318 	   , SUM(a.ACT_EQUIP_HRS)
3319 	   , SUM(a.ACT_LABOR_BRDN_COST)
3320 	   , SUM(a.ACT_EQUIP_BRDN_COST)
3321 	   , SUM(a.ACT_BRDN_COST    )
3322 	   , SUM(a.ACT_RAW_COST    )
3323 	   , SUM(a.ACT_REVENUE    )
3324          , SUM(a.ACT_LABOR_RAW_COST)
3325          , SUM(a.ACT_EQUIP_RAW_COST)
3326 	   , SUM(a.ETC_LABOR_HRS         )
3327 	   , SUM(a.ETC_EQUIP_HRS        )
3328 	   , SUM(a.ETC_LABOR_BRDN_COST )
3329 	   , SUM(a.ETC_EQUIP_BRDN_COST)
3330 	   , SUM(a.ETC_BRDN_COST )
3331          , SUM(a.ETC_RAW_COST)
3332          , SUM(a.ETC_LABOR_RAW_COST)
3333          , SUM(a.ETC_EQUIP_RAW_COST)
3334      , SUM(a.CUSTOM1	)
3335      , SUM(a.CUSTOM2	)
3336      , SUM(a.CUSTOM3	)
3337      , SUM(a.CUSTOM4	)
3338      , SUM(a.CUSTOM5	)
3339      , SUM(a.CUSTOM6	)
3340      , SUM(a.CUSTOM7	)
3341      , SUM(a.CUSTOM8	)
3342      , SUM(a.CUSTOM9	)
3343      , SUM(a.CUSTOM10	)
3344      , SUM(a.CUSTOM11	)
3345      , SUM(a.CUSTOM12	)
3346      , SUM(a.CUSTOM13	)
3347      , SUM(a.CUSTOM14	)
3348      , SUM(a.CUSTOM15	)
3349      , a.LINE_TYPE
3350      , a.TIME_DANGLING_FLAG
3351      , a.RATE_DANGLING_FLAG
3352      , g_default_prg_level prg_level
3353    FROM (
3354    SELECT
3355          fact.project_id  project_id
3356    	 , fact.project_ORG_ID project_ORG_ID
3357    	 , fact.project_ORGANIZATION_ID project_ORGANIZATION_ID
3358      -- , fact.PARTITION_ID PARTITION_ID
3359    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
3360    	 , pa_cal.ent_period_id TIME_ID
3361    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
3362    	 , 'E' CALENDAR_TYPE -- fact.CALENDAR_TYPE
3363      , fact.RBS_AGGR_LEVEL
3364      , fact.WBS_ROLLUP_FLAG
3365      , fact.PRG_ROLLUP_FLAG
3366    	 , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
3367    	 , fact.CURRENCY_CODE CURRENCY_CODE
3368    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
3369    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
3370    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
3371 	 , fact.PLAN_TYPE_ID  PLAN_TYPE_ID
3372 	 , ROUND (
3373              NVL (
3374             DECODE (
3375                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3376 			  , '00'   , fact.raw_cost
3377 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3378 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3379 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3380 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3381 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3382 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3383 			  , '0-1'  , fact.raw_cost
3384 			  , '1-1'  , fact.raw_cost
3385 			  , 0  ) -- end decode
3386 			    , 0  ) -- end nvl
3387 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3388 						* PJI_UTILS.GET_MAU (fact.currency_code)	raw_cost
3389 	 , ROUND (
3390              NVL (
3391             DECODE (
3392                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3393 			 , '00'   , fact.brdn_cost
3394 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3395 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3396 			 , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3397 			 , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3398 			 , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3399 			 , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3400 			 , '0-1'  , fact.brdn_cost
3401 			 , '1-1'  , fact.brdn_cost
3402 			 , 0  ) -- end decode
3403 			  , 0  ) -- end nvl
3404 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3405 						* PJI_UTILS.GET_MAU (fact.currency_code)	brdn_cost
3406 	 , ROUND (
3407              NVL (
3408             DECODE (
3409                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3410 			 , '00'   , fact.revenue
3411 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3412 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3413 			 , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3414 			 , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3415 			 , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3416 			 , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3417 			 , '0-1'  , fact.revenue
3418 			 , '1-1'  , fact.revenue
3419 			 , 0  ) -- end decode
3420 			  , 0  ) -- end nvl
3421 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3422 						* PJI_UTILS.GET_MAU (fact.currency_code)	revenue
3423 	 , ROUND (
3424              NVL (
3425             DECODE (
3426                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3427 			  , '00'   , fact.bill_raw_cost
3428 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3429 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3430 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3431 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3432 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3433 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3434 			  , '0-1'  , fact.bill_raw_cost
3435 			  , '1-1'  , fact.bill_raw_cost
3436 			  , 0  ) -- end decode
3437 			    , 0  ) -- end nvl
3438 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3439 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_raw_cost
3440 	 , ROUND (
3441              NVL (
3442             DECODE (
3443                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3444 			  , '00'   , fact.bill_brdn_cost
3445 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3446 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3447 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3448 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3449 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3450 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3451 			  , '0-1'  , fact.bill_brdn_cost
3452 			  , '1-1'  , fact.bill_brdn_cost
3453 			  , 0  ) -- end decode
3454 			    , 0  ) -- end nvl
3455 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3456 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_brdn_cost
3457 	 , ROUND (
3458              NVL (
3459             DECODE (
3460                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3461 			  , '00'   , fact.bill_labor_raw_cost
3462 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3463 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3464 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3465 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3466 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3467 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3468 			  , '0-1'  , fact.bill_labor_raw_cost
3469 			  , '1-1'  , fact.bill_labor_raw_cost
3470 			  , 0  ) -- end decode
3471 			    , 0  ) -- end nvl
3472 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3473 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_raw_cost
3474 	 , ROUND (
3475              NVL (
3476             DECODE (
3477                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3478 			  , '00'   , fact.bill_labor_brdn_cost
3479 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3480 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3481 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3482 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3483 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3484 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3485 			  , '0-1'  , fact.bill_labor_brdn_cost
3486 			  , '1-1'  , fact.bill_labor_brdn_cost
3487 			  , 0  ) -- end decode
3488 			    , 0  ) -- end nvl
3489 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3490 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_brdn_cost
3491 	 , ROUND (
3492              NVL (
3493             DECODE (
3494                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3495 			  , '00'   , fact.bill_labor_hrs
3496 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3497 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3498 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3499 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3500 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3501 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3502 			  , '0-1'  , fact.bill_labor_hrs
3503 			  , '1-1'  , fact.bill_labor_hrs
3504 			  , 0  ) -- end decode
3505 			    , 0  ) -- end nvl
3506 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3507 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_hrs
3508 	 , ROUND (
3509              NVL (
3510             DECODE (
3511                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3512 			  , '00'   , fact.equipment_raw_cost
3513 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3514 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3515 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3516 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3517 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3518 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3519 			  , '0-1'  , fact.equipment_raw_cost
3520 			  , '1-1'  , fact.equipment_raw_cost
3521 			  , 0  ) -- end decode
3522 			    , 0  ) -- end nvl
3523 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3524 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_raw_cost
3525 	 , ROUND (
3526              NVL (
3527             DECODE (
3528                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3529 			  , '00'   , fact.equipment_brdn_cost
3530 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3531 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3532 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3533 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3534 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3535 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3536 			  , '0-1'  , fact.equipment_brdn_cost
3537 			  , '1-1'  , fact.equipment_brdn_cost
3538 			  , 0  ) -- end decode
3539 			    , 0  ) -- end nvl
3540 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3541 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_brdn_cost
3542 	 , ROUND (
3543              NVL (
3544             DECODE (
3545                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3546 			  , '00'   , fact.capitalizable_raw_cost
3547 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3548 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3549 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3550 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3551 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3552 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3553 			  , '0-1'  , fact.capitalizable_raw_cost
3554 			  , '1-1'  , fact.capitalizable_raw_cost
3555 			  , 0  ) -- end decode
3556 			    , 0  ) -- end nvl
3557 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3558 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_raw_cost
3559 	 , ROUND (
3560              NVL (
3561             DECODE (
3562                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3563 			  , '00'   , fact.capitalizable_brdn_cost
3564 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3565 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3566 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3567 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3568 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3569 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3570 			  , '0-1'  , fact.capitalizable_brdn_cost
3571 			  , '1-1'  , fact.capitalizable_brdn_cost
3572 			  , 0  ) -- end decode
3573 			    , 0  ) -- end nvl
3574 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3575 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_brdn_cost
3576 	 , ROUND (
3577              NVL (
3578             DECODE (
3579                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3580 			  , '00'   , fact.labor_raw_cost
3581 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3582 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3583 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3584 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3585 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3586 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3587 			  , '0-1'  , fact.labor_raw_cost
3588 			  , '1-1'  , fact.labor_raw_cost
3589 			  , 0  ) -- end decode
3590 			    , 0  ) -- end nvl
3591 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3592 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_raw_cost
3593 	 , ROUND (
3594              NVL (
3595             DECODE (
3596                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3597 			  , '00'   , fact.labor_brdn_cost
3598 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3599 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3600 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3601 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3602 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3603 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3604 			  , '0-1'  , fact.labor_brdn_cost
3605 			  , '1-1'  , fact.labor_brdn_cost
3606 			  , 0  ) -- end decode
3607 			    , 0  ) -- end nvl
3608 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3609 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_brdn_cost
3610 	 , ROUND (
3611              NVL (
3612             DECODE (
3613                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3614 			  , '00'   , fact.labor_hrs
3615 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3616 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3617 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3618 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3619 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3620 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3621 			  , '0-1'  , fact.labor_hrs
3622 			  , '1-1'  , fact.labor_hrs
3623 			  , 0  ) -- end decode
3624 			    , 0  ) -- end nvl
3625 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3626 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_hrs
3627 	 , ROUND (
3628              NVL (
3629             DECODE (
3630                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3631 			  , '00'   , fact.labor_revenue
3632 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3633 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3634 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3635 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3636 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3637 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3638 			  , '0-1'  , fact.labor_revenue
3639 			  , '1-1'  , fact.labor_revenue
3640 			  , 0  ) -- end decode
3641 			    , 0  ) -- end nvl
3642 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3643 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_revenue
3644 	 , ROUND (
3645              NVL (
3646             DECODE (
3647                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3648 			  , '00'   , fact.equipment_hours
3649 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3650 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3651 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3652 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3653 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3654 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3655 			  , '0-1'  , fact.equipment_hours
3656 			  , '1-1'  , fact.equipment_hours
3657 			  , 0  ) -- end decode
3658 			    , 0  ) -- end nvl
3659 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3660 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_hours
3661 	 , ROUND (
3662              NVL (
3663             DECODE (
3664                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3665 			  , '00'   , fact.billable_equipment_hours
3666 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3667 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3668 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3669 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3670 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3671 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3672 			  , '0-1'  , fact.billable_equipment_hours
3673 			  , '1-1'  , fact.billable_equipment_hours
3674 			  , 0  ) -- end decode
3675 			    , 0  ) -- end nvl
3676 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3677 						* PJI_UTILS.GET_MAU (fact.currency_code)	billable_equipment_hours
3678 	 , ROUND (
3679              NVL (
3680             DECODE (
3681                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3682 			  , '00'   , fact.sup_inv_committed_cost
3683 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3684 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3685 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3686 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3687 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3688 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3689 			  , '0-1'  , fact.sup_inv_committed_cost
3690 			  , '1-1'  , fact.sup_inv_committed_cost
3691 			  , 0  ) -- end decode
3692 			    , 0  ) -- end nvl
3693 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3694 						* PJI_UTILS.GET_MAU (fact.currency_code)	sup_inv_committed_cost
3695 	 , ROUND (
3696              NVL (
3697             DECODE (
3698                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3699 			  , '00'   , fact.po_committed_cost
3700 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3701 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3702 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3703 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3704 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3705 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3706 			  , '0-1'  , fact.po_committed_cost
3707 			  , '1-1'  , fact.po_committed_cost
3708 			  , 0  ) -- end decode
3709 			    , 0  ) -- end nvl
3710 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3711 						* PJI_UTILS.GET_MAU (fact.currency_code)	po_committed_cost
3712 	 , ROUND (
3713              NVL (
3714             DECODE (
3715                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3716 			  , '00'   , fact.pr_committed_cost
3717 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3718 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3719 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3720 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3721 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3722 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3723 			  , '0-1'  , fact.pr_committed_cost
3724 			  , '1-1'  , fact.pr_committed_cost
3725 			  , 0  ) -- end decode
3726 			    , 0  ) -- end nvl
3727 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3728 						* PJI_UTILS.GET_MAU (fact.currency_code)	pr_committed_cost
3729 	 , ROUND (
3730              NVL (
3731             DECODE (
3732                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3733 			  , '00'   , fact.oth_committed_cost
3734 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3735 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3736 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3737 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3738 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3739 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3740 			  , '0-1'  , fact.oth_committed_cost
3741 			  , '1-1'  , fact.oth_committed_cost
3742 			  , 0  ) -- end decode
3743 			    , 0  ) -- end nvl
3744 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3745 						* PJI_UTILS.GET_MAU (fact.currency_code)	oth_committed_cost
3746 	 , ROUND (
3747              NVL (
3748             DECODE (
3749                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3750 			  , '00'   , fact.ACT_LABOR_HRS
3751 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3752 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3753 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3754 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3755 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3756 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3757 			  , '0-1'  , fact.ACT_LABOR_HRS
3758 			  , '1-1'  , fact.ACT_LABOR_HRS
3759 			  , 0  ) -- end decode
3760 			    , 0  ) -- end nvl
3761 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3762 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_HRS
3763 	 , ROUND (
3764              NVL (
3765             DECODE (
3766                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3767 			  , '00'   , fact.ACT_EQUIP_HRS
3768 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3769 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3770 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3771 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3772 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3773 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3774 			  , '0-1'  , fact.ACT_EQUIP_HRS
3775 			  , '1-1'  , fact.ACT_EQUIP_HRS
3776 			  , 0  ) -- end decode
3777 			    , 0  ) -- end nvl
3778 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3779 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_HRS
3780 	 , ROUND (
3781              NVL (
3782             DECODE (
3783                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3784 			  , '00'   , fact.ACT_LABOR_BRDN_COST
3785 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3786 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3787 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3788 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3789 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3790 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3791 			  , '0-1'  , fact.ACT_LABOR_BRDN_COST
3792 			  , '1-1'  , fact.ACT_LABOR_BRDN_COST
3793 			  , 0  ) -- end decode
3794 			    , 0  ) -- end nvl
3795 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3796 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_BRDN_COST
3797 	 , ROUND (
3798              NVL (
3799             DECODE (
3800                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3801 			  , '00'   , fact.ACT_EQUIP_BRDN_COST
3802 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3803 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3804 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3805 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3806 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3807 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3808 			  , '0-1'  , fact.ACT_EQUIP_BRDN_COST
3809 			  , '1-1'  , fact.ACT_EQUIP_BRDN_COST
3810 			  , 0  ) -- end decode
3811 			    , 0  ) -- end nvl
3812 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3813 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_BRDN_COST
3814 	 , ROUND (
3815              NVL (
3816             DECODE (
3817                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3818 			  , '00'   , fact.ACT_BRDN_COST
3819 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3820 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3821 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3822 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3823 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3824 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3825 			  , '0-1'  , fact.ACT_BRDN_COST
3826 			  , '1-1'  , fact.ACT_BRDN_COST
3827 			  , 0  ) -- end decode
3828 			    , 0  ) -- end nvl
3829 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3830 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_BRDN_COST
3831 	 , ROUND (
3832              NVL (
3833             DECODE (
3834                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3835 			  , '00'   , fact.ACT_RAW_COST
3836 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3837 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3838 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3839 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3840 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3841 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3842 			  , '0-1'  , fact.ACT_RAW_COST
3843 			  , '1-1'  , fact.ACT_RAW_COST
3844 			  , 0  ) -- end decode
3845 			    , 0  ) -- end nvl
3846 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3847 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_RAW_COST
3848 	 , ROUND (
3849              NVL (
3850             DECODE (
3851                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3852 			  , '00'   , fact.ACT_REVENUE
3853 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3854 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3855 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3856 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3857 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3858 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3859 			  , '0-1'  , fact.ACT_REVENUE
3860 			  , '1-1'  , fact.ACT_REVENUE
3861 			  , 0  ) -- end decode
3862 			    , 0  ) -- end nvl
3863 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3864 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_REVENUE
3865 	 , ROUND (
3866              NVL (
3867             DECODE (
3868                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3869 			  , '00'   , fact.ACT_LABOR_RAW_COST
3870 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3871 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3872 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3873 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3874 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3875 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3876 			  , '0-1'  , fact.ACT_LABOR_RAW_COST
3877 			  , '1-1'  , fact.ACT_LABOR_RAW_COST
3878 			  , 0  ) -- end decode
3879 			    , 0  ) -- end nvl
3880 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3881 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_RAW_COST
3882 	 , ROUND (
3883              NVL (
3884             DECODE (
3885                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3886 			  , '00'   , fact.ACT_EQUIP_RAW_COST
3887 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3888 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3889 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3890 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3891 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3892 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3893 			  , '0-1'  , fact.ACT_EQUIP_RAW_COST
3894 			  , '1-1'  , fact.ACT_EQUIP_RAW_COST
3895 			  , 0  ) -- end decode
3896 			    , 0  ) -- end nvl
3897 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3898 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_RAW_COST
3899 	 , ROUND (
3900              NVL (
3901             DECODE (
3902                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3903 			  , '00'   , fact.ETC_LABOR_HRS
3904 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3905 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3906 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3907 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3908 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3909 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3910 			  , '0-1'  , fact.ETC_LABOR_HRS
3911 			  , '1-1'  , fact.ETC_LABOR_HRS
3912 			  , 0  ) -- end decode
3913 			    , 0  ) -- end nvl
3914 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3915 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_HRS
3916 	 , ROUND (
3917              NVL (
3918             DECODE (
3919                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3920 			  , '00'   , fact.ETC_EQUIP_HRS
3921 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3922 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3923 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3924 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3925 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3926 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3927 			  , '0-1'  , fact.ETC_EQUIP_HRS
3928 			  , '1-1'  , fact.ETC_EQUIP_HRS
3929 			  , 0  ) -- end decode
3930 			    , 0  ) -- end nvl
3931 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3932 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_HRS
3933 	 , ROUND (
3934              NVL (
3935             DECODE (
3936                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3937 			  , '00'   , fact.ETC_LABOR_BRDN_COST
3938 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3939 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3940 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3941 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3942 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3943 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3944 			  , '0-1'  , fact.ETC_LABOR_BRDN_COST
3945 			  , '1-1'  , fact.ETC_LABOR_BRDN_COST
3946 			  , 0  ) -- end decode
3947 			    , 0  ) -- end nvl
3948 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3949 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_BRDN_COST
3950 	 , ROUND (
3951              NVL (
3952             DECODE (
3953                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3954 			  , '00'   , fact.ETC_EQUIP_BRDN_COST
3955 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3956 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3957 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3958 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3959 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3960 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3961 			  , '0-1'  , fact.ETC_EQUIP_BRDN_COST
3962 			  , '1-1'  , fact.ETC_EQUIP_BRDN_COST
3963 			  , 0  ) -- end decode
3964 			    , 0  ) -- end nvl
3965 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3966 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_BRDN_COST
3967 	 , ROUND (
3968              NVL (
3969             DECODE (
3970                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3971 			  , '00'   , fact.ETC_BRDN_COST
3972 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3973 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3974 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3975 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3976 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3977 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3978 			  , '0-1'  , fact.ETC_BRDN_COST
3979 			  , '1-1'  , fact.ETC_BRDN_COST
3980 			  , 0  ) -- end decode
3981 			    , 0  ) -- end nvl
3982 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
3983 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_BRDN_COST
3984 	 , ROUND (
3985              NVL (
3986             DECODE (
3987                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
3988 			  , '00'   , fact.ETC_RAW_COST
3989 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3990 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3991 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3992 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3993 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3994 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
3995 			  , '0-1'  , fact.ETC_RAW_COST
3996 			  , '1-1'  , fact.ETC_RAW_COST
3997 			  , 0  ) -- end decode
3998 			    , 0  ) -- end nvl
3999 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4000 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_RAW_COST
4001 	 , ROUND (
4002              NVL (
4003             DECODE (
4004                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4005 			  , '00'   , fact.ETC_LABOR_RAW_COST
4006 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4007 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4008 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4009 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4010 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4011 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4012 			  , '0-1'  , fact.ETC_LABOR_RAW_COST
4013 			  , '1-1'  , fact.ETC_LABOR_RAW_COST
4014 			  , 0  ) -- end decode
4015 			    , 0  ) -- end nvl
4016 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4017 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_RAW_COST
4018 	 , ROUND (
4019              NVL (
4020             DECODE (
4021                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4022 			  , '00'   , fact.ETC_EQUIP_RAW_COST
4023 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4024 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4025 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4026 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4027 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4028 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4029 			  , '0-1'  , fact.ETC_EQUIP_RAW_COST
4030 			  , '1-1'  , fact.ETC_EQUIP_RAW_COST
4031 			  , 0  ) -- end decode
4032 			    , 0  ) -- end nvl
4033 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4034 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_RAW_COST
4035 	 , ROUND (
4036              NVL (
4037             DECODE (
4038                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4039 			  , '00'   , fact.custom1
4040 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4041 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4042 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4043 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4044 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4045 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4046 			  , '0-1'  , fact.custom1
4047 			  , '1-1'  , fact.custom1
4048 			  , 0  ) -- end decode
4049 			    , 0  ) -- end nvl
4050 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4051 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom1
4052 	 , ROUND (
4053              NVL (
4054             DECODE (
4055                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4056 			  , '00'   , fact.custom2
4057 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4058 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4059 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4060 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4061 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4062 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4063 			  , '0-1'  , fact.custom2
4064 			  , '1-1'  , fact.custom2
4065 			  , 0  ) -- end decode
4066 			    , 0  ) -- end nvl
4067 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4068 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom2
4069 	 , ROUND (
4070              NVL (
4071             DECODE (
4072                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4073 			  , '00'   , fact.custom3
4074 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4075 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4076 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4077 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4078 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4079 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4080 			  , '0-1'  , fact.custom3
4081 			  , '1-1'  , fact.custom3
4082 			  , 0  ) -- end decode
4083 			    , 0  ) -- end nvl
4084 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4085 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom3
4086 	 , ROUND (
4087              NVL (
4088             DECODE (
4089                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4090 			  , '00'   , fact.custom4
4091 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4092 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4093 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4094 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4095 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4096 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4097 			  , '0-1'  , fact.custom4
4098 			  , '1-1'  , fact.custom4
4099 			  , 0  ) -- end decode
4100 			    , 0  ) -- end nvl
4101 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4102 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom4
4103 	 , ROUND (
4104              NVL (
4105             DECODE (
4106                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4107 			  , '00'   , fact.custom5
4108 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4109 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4110 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4111 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4112 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4113 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4114 			  , '0-1'  , fact.custom5
4115 			  , '1-1'  , fact.custom5
4116 			  , 0  ) -- end decode
4117 			    , 0  ) -- end nvl
4118 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4119 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom5
4120 	 , ROUND (
4121              NVL (
4122             DECODE (
4123                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4124 			  , '00'   , fact.custom6
4125 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4126 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4127 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4128 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4129 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4130 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4131 			  , '0-1'  , fact.custom6
4132 			  , '1-1'  , fact.custom6
4133 			  , 0  ) -- end decode
4134 			    , 0  ) -- end nvl
4135 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4136 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom6
4137 	 , ROUND (
4138              NVL (
4139             DECODE (
4140                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4141 			  , '00'   , fact.custom7
4142 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4143 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4144 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4145 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4146 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4147 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4148 			  , '0-1'  , fact.custom7
4149 			  , '1-1'  , fact.custom7
4150 			  , 0  ) -- end decode
4151 			    , 0  ) -- end nvl
4152 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4153 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom7
4154 	 , ROUND (
4155              NVL (
4156             DECODE (
4157                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4158 			  , '00'   , fact.custom8
4159 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4160 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4161 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4162 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4163 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4164 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4165 			  , '0-1'  , fact.custom8
4166 			  , '1-1'  , fact.custom8
4167 			  , 0  ) -- end decode
4168 			    , 0  ) -- end nvl
4169 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4170 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom8
4171 	 , ROUND (
4172              NVL (
4173             DECODE (
4174                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4175 			  , '00'   , fact.custom9
4176 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4177 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4178 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4179 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4180 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4181 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4182 			  , '0-1'  , fact.custom9
4183 			  , '1-1'  , fact.custom9
4184 			  , 0  ) -- end decode
4185 			    , 0  ) -- end nvl
4186 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4187 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom9
4188 	 , ROUND (
4189              NVL (
4190             DECODE (
4191                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4192 			  , '00'   , fact.custom10
4193 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4194 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4195 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4196 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4197 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4198 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4199 			  , '0-1'  , fact.custom10
4200 			  , '1-1'  , fact.custom10
4201 			  , 0  ) -- end decode
4202 			    , 0  ) -- end nvl
4203 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4204 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom10
4205 	 , ROUND (
4206              NVL (
4207             DECODE (
4208                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4209 			  , '00'   , fact.custom11
4210 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4211 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4212 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4213 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4214 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4215 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4216 			  , '0-1'  , fact.custom11
4217 			  , '1-1'  , fact.custom11
4218 			  , 0  ) -- end decode
4219 			    , 0  ) -- end nvl
4220 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4221 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom11
4222 	 , ROUND (
4223              NVL (
4224             DECODE (
4225                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4226 			  , '00'   , fact.custom12
4227 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4228 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4229 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4230 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4231 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4232 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4233 			  , '0-1'  , fact.custom12
4234 			  , '1-1'  , fact.custom12
4235 			  , 0  ) -- end decode
4236 			    , 0  ) -- end nvl
4237 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4238 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom12
4239 	 , ROUND (
4240              NVL (
4241             DECODE (
4242                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4243 			  , '00'   , fact.custom13
4244 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4245 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4246 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4247 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4248 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4249 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4250 			  , '0-1'  , fact.custom13
4251 			  , '1-1'  , fact.custom13
4252 			  , 0  ) -- end decode
4253 			    , 0  ) -- end nvl
4254 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4255 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom13
4256 	 , ROUND (
4257              NVL (
4258             DECODE (
4259                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4260 			  , '00'   , fact.custom14
4261 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4262 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4263 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4264 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4265 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4266 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4267 			  , '0-1'  , fact.custom14
4268 			  , '1-1'  , fact.custom14
4269 			  , 0  ) -- end decode
4270 			    , 0  ) -- end nvl
4271 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4272 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom14
4273 	 , ROUND (
4274              NVL (
4275             DECODE (
4276                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4277 			  , '00'   , fact.custom15
4278 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4279 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4280 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4281 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4282 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4283 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4284 			  , '0-1'  , fact.custom15
4285 			  , '1-1'  , fact.custom15
4286 			  , 0  ) -- end decode
4287 			    , 0  ) -- end nvl
4288 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4289 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom15
4290      , 'CF'   line_type
4291      , fact.time_dangling_flag time_dangling_flag
4292      , fact.rate_dangling_flag rate_dangling_flag
4293      , g_default_prg_level prg_level
4294    FROM   pji_fp_aggr_pjp1_t fact
4295         , pji_time_cal_period  non_pa_cal
4296    	 , pji_time_ent_period  pa_cal
4297        , pji_fm_extr_plnver3_t  ver
4298    WHERE  fact.CALENDAR_TYPE IN ('P', 'G')
4299       AND fact.worker_id = g_worker_id
4300       AND non_pa_cal.cal_period_id = fact.time_id
4301       AND fact.line_type like 'OF%'
4302       AND (
4303 	       ( pa_cal.start_date >= non_pa_cal.start_date  AND pa_cal.end_date <= non_pa_cal.end_date )
4304 	    OR ( pa_cal.start_date <= non_pa_cal.start_date  AND pa_cal.end_date >= non_pa_cal.end_date )
4305 	    OR ( pa_cal.start_date <= non_pa_cal.start_date  AND pa_cal.end_date <= non_pa_cal.end_date AND pa_cal.end_date >= non_pa_cal.start_date )
4306 	    OR ( pa_cal.start_date >= non_pa_cal.start_date  AND pa_cal.end_date >= non_pa_cal.end_date AND pa_cal.start_date <= non_pa_cal.end_date )
4307           )
4308       AND fact.time_dangling_flag IS NULL
4309       AND fact.rate_dangling_flag IS NULL
4310       AND fact.period_type_id = 32
4311       AND fact.plan_version_id = ver.plan_version_id
4312       AND ver.wp_flag = 'N'
4313       AND ver.baselined_flag = 'Y'
4314 	-- AND ( ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
4315       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
4316 	  ) a
4317 	  GROUP BY
4318 	   a.PROJECT_ID
4319      , a.PROJECT_ORG_ID
4320      , a.PROJECT_ORGANIZATION_ID
4321      , a.PROJECT_ELEMENT_ID
4322      , a.TIME_ID
4323      , a.PERIOD_TYPE_ID
4324      , a.CALENDAR_TYPE
4325      , a.RBS_AGGR_LEVEL
4326      , a.WBS_ROLLUP_FLAG
4327      , a.PRG_ROLLUP_FLAG
4328      , a.CURR_RECORD_TYPE_ID
4329      , a.CURRENCY_CODE
4330      , a.RBS_ELEMENT_ID
4331      , a.RBS_VERSION_ID
4332      , a.PLAN_VERSION_ID
4333      , a.PLAN_TYPE_ID
4334 
4335 	 , a.LINE_TYPE
4336 	 , a.TIME_DANGLING_FLAG
4337 	 , a.RATE_DANGLING_FLAG;
4338  End of 4005006*/
4339 
4340     INSERT INTO pji_fp_aggr_pjp1_t
4341     (
4342        WORKER_ID
4343      , PROJECT_ID
4344      , PROJECT_ORG_ID
4345      , PROJECT_ORGANIZATION_ID
4346      -- , PARTITION_ID
4347      , PROJECT_ELEMENT_ID
4348      , TIME_ID
4349      , PERIOD_TYPE_ID
4350      , CALENDAR_TYPE
4351      , RBS_AGGR_LEVEL
4352      , WBS_ROLLUP_FLAG
4353      , PRG_ROLLUP_FLAG
4354      , CURR_RECORD_TYPE_ID
4355      , CURRENCY_CODE
4356      , RBS_ELEMENT_ID
4357      , RBS_VERSION_ID
4358      , PLAN_VERSION_ID
4359      , PLAN_TYPE_ID
4360      , RAW_COST
4361      , BRDN_COST
4362      , REVENUE
4363      , BILL_RAW_COST
4364      , BILL_BRDN_COST
4365      , BILL_LABOR_RAW_COST
4366      , BILL_LABOR_BRDN_COST
4367      , BILL_LABOR_HRS
4368      , EQUIPMENT_RAW_COST
4369      , EQUIPMENT_BRDN_COST
4370      , CAPITALIZABLE_RAW_COST
4371      , CAPITALIZABLE_BRDN_COST
4372      , LABOR_RAW_COST
4373      , LABOR_BRDN_COST
4374      , LABOR_HRS
4375      , LABOR_REVENUE
4376      , EQUIPMENT_HOURS
4377      , BILLABLE_EQUIPMENT_HOURS
4378      , SUP_INV_COMMITTED_COST
4379      , PO_COMMITTED_COST
4380      , PR_COMMITTED_COST
4381      , OTH_COMMITTED_COST
4382      , ACT_LABOR_HRS
4383      , ACT_EQUIP_HRS
4384      , ACT_LABOR_BRDN_COST
4385      , ACT_EQUIP_BRDN_COST
4386      , ACT_BRDN_COST
4387      , ACT_RAW_COST
4388      , ACT_REVENUE
4389      , ACT_LABOR_RAW_COST
4390      , ACT_EQUIP_RAW_COST
4391      , ETC_LABOR_HRS
4392      , ETC_EQUIP_HRS
4393      , ETC_LABOR_BRDN_COST
4394      , ETC_EQUIP_BRDN_COST
4395      , ETC_BRDN_COST
4396      , ETC_RAW_COST
4397      , ETC_LABOR_RAW_COST
4398      , ETC_EQUIP_RAW_COST
4399      , CUSTOM1
4400      , CUSTOM2
4401      , CUSTOM3
4402      , CUSTOM4
4403      , CUSTOM5
4404      , CUSTOM6
4405      , CUSTOM7
4406      , CUSTOM8
4407      , CUSTOM9
4408      , CUSTOM10
4409      , CUSTOM11
4410      , CUSTOM12
4411      , CUSTOM13
4412      , CUSTOM14
4413      , CUSTOM15
4414      , TIME_DANGLING_FLAG
4415      , RATE_DANGLING_FLAG
4416      , PRG_LEVEL
4417      , PLAN_TYPE_CODE    /* 4471527 */
4418 	)
4419    SELECT
4420            g_worker_id worker_id
4421          , a.PROJECT_ID
4422          , a.PROJECT_ORG_ID
4423          , a.PROJECT_ORGANIZATION_ID
4424          , a.PROJECT_ELEMENT_ID
4425          , a.TIME_ID
4426          , a.PERIOD_TYPE_ID
4427          , a.CALENDAR_TYPE
4428          , a.RBS_AGGR_LEVEL
4429          , a.WBS_ROLLUP_FLAG
4430          , a.PRG_ROLLUP_FLAG
4431          , a.CURR_RECORD_TYPE_ID
4432          , a.CURRENCY_CODE
4433          , a.RBS_ELEMENT_ID
4434          , a.RBS_VERSION_ID
4435          , a.PLAN_VERSION_ID
4436          , a.PLAN_TYPE_ID
4437 	 , SUM(ROUND (nvl(a.raw_cost,0)*a.factor/a.mau)*a.mau) raw_cost
4438 	 , SUM(ROUND (nvl(a.brdn_cost,0)*a.factor/a.mau)*a.mau) brdn_cost
4439 	 , SUM(ROUND (nvl(a.revenue,0)*a.factor/a.mau)*a.mau) revenue
4440 	 , SUM(ROUND (nvl(a.bill_raw_cost,0)*a.factor/a.mau)*a.mau) bill_raw_cost
4441 	 , SUM(ROUND (nvl(a.bill_brdn_cost,0)*a.factor/a.mau)*a.mau) bill_brdn_cost
4442 	 , SUM(ROUND (nvl(a.bill_labor_raw_cost,0)*a.factor/a.mau)*a.mau) bill_labor_raw_cost
4443 	 , SUM(ROUND (nvl(a.bill_labor_brdn_cost,0)*a.factor/a.mau)*a.mau) bill_labor_brdn_cost
4444 	 , SUM(ROUND (nvl(a.bill_labor_hrs,0)*a.factor/a.mau)*a.mau) bill_labor_hrs
4445 	 , SUM(ROUND (nvl(a.equipment_raw_cost,0)*a.factor/a.mau)*a.mau) equipment_raw_cost
4446 	 , SUM(ROUND (nvl(a.equipment_brdn_cost,0)*a.factor/a.mau)*a.mau) equipment_brdn_cost
4447 	 , SUM(ROUND (nvl(a.capitalizable_raw_cost,0)*a.factor/a.mau)*a.mau) capitalizable_raw_cost
4448 	 , SUM(ROUND (nvl(a.capitalizable_brdn_cost,0)*a.factor/a.mau)*a.mau) capitalizable_brdn_cost
4449 	 , SUM(ROUND (nvl(a.labor_raw_cost,0)*a.factor/a.mau)*a.mau) labor_raw_cost
4450 	 , SUM(ROUND (nvl(a.labor_brdn_cost,0)*a.factor/a.mau)*a.mau) labor_brdn_cost
4451 	 , SUM(ROUND (nvl(a.labor_hrs,0)*a.factor/a.mau)*a.mau) labor_hrs
4452 	 , SUM(ROUND (nvl(a.labor_revenue,0)*a.factor/a.mau)*a.mau) labor_revenue
4453 	 , SUM(ROUND (nvl(a.equipment_hours,0)*a.factor/a.mau)*a.mau) equipment_hours
4454 	 , SUM(ROUND (nvl(a.billable_equipment_hours,0)*a.factor/a.mau)*a.mau) billable_equipment_hours
4455 	 , SUM(ROUND (nvl(a.sup_inv_committed_cost,0)*a.factor/a.mau)*a.mau) sup_inv_committed_cost
4456 	 , SUM(ROUND (nvl(a.po_committed_cost,0)*a.factor/a.mau)*a.mau) po_committed_cost
4457 	 , SUM(ROUND (nvl(a.pr_committed_cost,0)*a.factor/a.mau)*a.mau) pr_committed_cost
4458 	 , SUM(ROUND (nvl(a.oth_committed_cost,0)*a.factor/a.mau)*a.mau) oth_committed_cost
4459 	 , SUM(ROUND (nvl(a.ACT_LABOR_HRS,0)*a.factor/a.mau)*a.mau) ACT_LABOR_HRS
4460 	 , SUM(ROUND (nvl(a.ACT_EQUIP_HRS,0)*a.factor/a.mau)*a.mau) ACT_EQUIP_HRS
4461 	 , SUM(ROUND (nvl(a.ACT_LABOR_BRDN_COST,0)*a.factor/a.mau)*a.mau) ACT_LABOR_BRDN_COST
4462 	 , SUM(ROUND (nvl(a.ACT_EQUIP_BRDN_COST,0)*a.factor/a.mau)*a.mau) ACT_EQUIP_BRDN_COST
4463 	 , SUM(ROUND (nvl(a.ACT_BRDN_COST,0)*a.factor/a.mau)*a.mau) ACT_BRDN_COST
4464 	 , SUM(ROUND (nvl(a.ACT_RAW_COST,0)*a.factor/a.mau)*a.mau) ACT_RAW_COST
4465 	 , SUM(ROUND (nvl(a.ACT_REVENUE,0)*a.factor/a.mau)*a.mau) ACT_REVENUE
4466 	 , SUM(ROUND (nvl(a.ACT_LABOR_RAW_COST,0)*a.factor/a.mau)*a.mau) ACT_LABOR_RAW_COST
4467 	 , SUM(ROUND (nvl(a.ACT_EQUIP_RAW_COST,0)*a.factor/a.mau)*a.mau) ACT_EQUIP_RAW_COST
4468 	 , SUM(ROUND (nvl(a.ETC_LABOR_HRS,0)*a.factor/a.mau)*a.mau) ETC_LABOR_HRS
4469 	 , SUM(ROUND (nvl(a.ETC_EQUIP_HRS,0)*a.factor/a.mau)*a.mau) ETC_EQUIP_HRS
4470 	 , SUM(ROUND (nvl(a.ETC_LABOR_BRDN_COST,0)*a.factor/a.mau)*a.mau) ETC_LABOR_BRDN_COST
4471 	 , SUM(ROUND (nvl(a.ETC_EQUIP_BRDN_COST,0)*a.factor/a.mau)*a.mau) ETC_EQUIP_BRDN_COST
4472 	 , SUM(ROUND (nvl(a.ETC_BRDN_COST,0)*a.factor/a.mau)*a.mau) ETC_BRDN_COST
4473 	 , SUM(ROUND (nvl(a.ETC_RAW_COST,0)*a.factor/a.mau)*a.mau) ETC_RAW_COST
4474 	 , SUM(ROUND (nvl(a.ETC_LABOR_RAW_COST,0)*a.factor/a.mau)*a.mau) ETC_LABOR_RAW_COST
4475 	 , SUM(ROUND (nvl(a.ETC_EQUIP_RAW_COST,0)*a.factor/a.mau)*a.mau) ETC_EQUIP_RAW_COST
4476 	 , SUM(ROUND (nvl(a.custom1,0)*a.factor/a.mau)*a.mau) custom1
4477 	 , SUM(ROUND (nvl(a.custom2,0)*a.factor/a.mau)*a.mau) custom2
4478 	 , SUM(ROUND (nvl(a.custom3,0)*a.factor/a.mau)*a.mau) custom3
4479 	 , SUM(ROUND (nvl(a.custom4,0)*a.factor/a.mau)*a.mau) custom4
4480 	 , SUM(ROUND (nvl(a.custom5,0)*a.factor/a.mau)*a.mau) custom5
4481 	 , SUM(ROUND (nvl(a.custom6,0)*a.factor/a.mau)*a.mau) custom6
4482 	 , SUM(ROUND (nvl(a.custom7,0)*a.factor/a.mau)*a.mau) custom7
4483 	 , SUM(ROUND (nvl(a.custom8,0)*a.factor/a.mau)*a.mau) custom8
4484 	 , SUM(ROUND (nvl(a.custom9,0)*a.factor/a.mau)*a.mau) custom9
4485 	 , SUM(ROUND (nvl(a.custom10,0)*a.factor/a.mau)*a.mau) custom10
4486 	 , SUM(ROUND (nvl(a.custom11,0)*a.factor/a.mau)*a.mau) custom11
4487 	 , SUM(ROUND (nvl(a.custom12,0)*a.factor/a.mau)*a.mau) custom12
4488 	 , SUM(ROUND (nvl(a.custom13,0)*a.factor/a.mau)*a.mau) custom13
4489 	 , SUM(ROUND (nvl(a.custom14,0)*a.factor/a.mau)*a.mau) custom14
4490 	 , SUM(ROUND (nvl(a.custom15,0)*a.factor/a.mau)*a.mau) custom15
4491          , a.TIME_DANGLING_FLAG
4492          , a.RATE_DANGLING_FLAG
4493          , g_default_prg_level prg_level
4494          , a.plan_type_code plan_type_code    /* 4471527 */
4495    FROM (
4496    SELECT /*+ NO_MERGE */
4497          fact.project_id  project_id
4498    	 , fact.project_ORG_ID project_ORG_ID
4499    	 , fact.project_ORGANIZATION_ID project_ORGANIZATION_ID
4500    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
4501    	 , pa_cal.ent_period_id TIME_ID
4502    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
4503    	 , 'E' CALENDAR_TYPE -- fact.CALENDAR_TYPE
4504          , fact.RBS_AGGR_LEVEL
4505          , fact.WBS_ROLLUP_FLAG
4506          , fact.PRG_ROLLUP_FLAG
4507    	 , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
4508    	 , fact.CURRENCY_CODE CURRENCY_CODE
4509    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
4510    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
4511    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
4512 	 , fact.PLAN_TYPE_ID  PLAN_TYPE_ID
4513 	 , fact.raw_cost
4514 	 , fact.brdn_cost
4515 	 , fact.revenue
4516 	 , fact.bill_raw_cost
4517 	 , fact.bill_brdn_cost
4518 	 , fact.bill_labor_raw_cost
4519 	 , fact.bill_labor_brdn_cost
4520 	 , fact.bill_labor_hrs
4521 	 , fact.equipment_raw_cost
4522 	 , fact.equipment_brdn_cost
4523 	 , fact.capitalizable_raw_cost
4524 	 , fact.capitalizable_brdn_cost
4525 	 , fact.labor_raw_cost
4526 	 , fact.labor_brdn_cost
4527 	 , fact.labor_hrs
4528 	 , fact.labor_revenue
4529 	 , fact.equipment_hours
4530 	 , fact.billable_equipment_hours
4531 	 , fact.sup_inv_committed_cost
4532 	 , fact.po_committed_cost
4533 	 , fact.pr_committed_cost
4534 	 , fact.oth_committed_cost
4535 	 , fact.ACT_LABOR_HRS
4536 	 , fact.ACT_EQUIP_HRS
4537 	 , fact.ACT_LABOR_BRDN_COST
4538 	 , fact.ACT_EQUIP_BRDN_COST
4539 	 , fact.ACT_BRDN_COST
4540 	 , fact.ACT_RAW_COST
4541 	 , fact.ACT_REVENUE
4542 	 , fact.ACT_LABOR_RAW_COST
4543 	 , fact.ACT_EQUIP_RAW_COST
4544 	 , fact.ETC_LABOR_HRS
4545 	 , fact.ETC_EQUIP_HRS
4546 	 , fact.ETC_LABOR_BRDN_COST
4547 	 , fact.ETC_EQUIP_BRDN_COST
4548 	 , fact.ETC_BRDN_COST
4549 	 , fact.ETC_RAW_COST
4550 	 , fact.ETC_LABOR_RAW_COST
4551 	 , fact.ETC_EQUIP_RAW_COST
4552 	 , fact.custom1
4553 	 , fact.custom2
4554 	 , fact.custom3
4555 	 , fact.custom4
4556 	 , fact.custom5
4557 	 , fact.custom6
4558 	 , fact.custom7
4559 	 , fact.custom8
4560 	 , fact.custom9
4561 	 , fact.custom10
4562 	 , fact.custom11
4563 	 , fact.custom12
4564 	 , fact.custom13
4565 	 , fact.custom14
4566 	 , fact.custom15
4567 	 , fact.time_dangling_flag time_dangling_flag
4568 	 , fact.rate_dangling_flag rate_dangling_flag
4569          , cur.mau mau
4570          , (LEAST(non_pa_cal.end_date,pa_cal.end_date) -
4571                     Greatest(non_pa_cal.start_date,pa_cal.start_date)+1)
4572                               / (non_pa_cal.end_date - non_pa_cal.start_date+1) factor
4573              , fact.plan_type_code  plan_type_code   /* 4471527 */
4574    FROM   pji_fp_aggr_pjp1_t fact
4575         , pji_time_cal_period_v  non_pa_cal
4576         , pji_time_ent_period_v  pa_cal
4577         , pji_fm_extr_plnver3_t  ver
4578         , (SELECT currency_code,
4579                    decode(nvl(MINIMUM_ACCOUNTABLE_UNIT, power(10, (-1 * PRECISION))),
4580                       null, 0.01,
4581                          0, 1,
4582                          nvl(MINIMUM_ACCOUNTABLE_UNIT, power(10, (-1 * PRECISION)))) mau
4583               FROM FND_CURRENCIES) cur
4584    WHERE  fact.CALENDAR_TYPE IN ('P', 'G')
4585       AND fact.worker_id = g_worker_id
4586       AND non_pa_cal.cal_period_id = fact.time_id
4587       AND fact.line_type like 'OF%'
4588       AND non_pa_cal.start_date<= pa_cal.end_date
4589       AND non_pa_cal.end_Date >=pa_cal.start_date
4590       AND fact.currency_code = cur.currency_code
4591       AND fact.time_dangling_flag IS NULL
4592       AND fact.rate_dangling_flag IS NULL
4593       AND fact.period_type_id = 32
4594       AND fact.plan_version_id = ver.plan_version_id
4595       AND fact.plan_type_code = ver.plan_type_code    /* 4471527 */
4596       AND ver.wp_flag = 'N'
4597       AND ver.baselined_flag = 'Y'
4598       -- AND ( ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
4599       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
4600 	  ) a
4601      WHERE a.factor >0
4602 	  GROUP BY
4603 	   a.PROJECT_ID
4604      , a.PROJECT_ORG_ID
4605      , a.PROJECT_ORGANIZATION_ID
4606      , a.PROJECT_ELEMENT_ID
4607      , a.TIME_ID
4608      , a.PERIOD_TYPE_ID
4609      , a.CALENDAR_TYPE
4610      , a.RBS_AGGR_LEVEL
4611      , a.WBS_ROLLUP_FLAG
4612      , a.PRG_ROLLUP_FLAG
4613      , a.CURR_RECORD_TYPE_ID
4614      , a.CURRENCY_CODE
4615      , a.RBS_ELEMENT_ID
4616      , a.RBS_VERSION_ID
4617      , a.PLAN_VERSION_ID
4618      , a.PLAN_TYPE_ID
4619      , a.PLAN_TYPE_CODE     /* 4471527 */
4620      , a.TIME_DANGLING_FLAG
4621      , a.RATE_DANGLING_FLAG;
4622 
4623 EXCEPTION
4624   WHEN OTHERS THEN
4625     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
4626                              p_procedure_name => ' PRORATE_TO_ENT_PG_PJP1_D ');
4627     RAISE;
4628 END;
4629 
4630 
4631 PROCEDURE PRORATE_TO_ENT_PG_FPRL_D IS
4632 BEGIN
4633 
4634     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
4635 
4636     INSERT INTO pji_fp_aggr_pjp1_t -- PA, GL calendar entries in FP Reporting lines.
4637     (
4638        WORKER_ID
4639      , PROJECT_ID
4640      , PROJECT_ORG_ID
4641      , PROJECT_ORGANIZATION_ID
4642      -- , PARTITION_ID
4643      , PROJECT_ELEMENT_ID
4644      , TIME_ID
4645      , PERIOD_TYPE_ID
4646      , CALENDAR_TYPE
4647      , RBS_AGGR_LEVEL
4648      , WBS_ROLLUP_FLAG
4649      , PRG_ROLLUP_FLAG
4650      , CURR_RECORD_TYPE_ID
4651      , CURRENCY_CODE
4652      , RBS_ELEMENT_ID
4653      , RBS_VERSION_ID
4654      , PLAN_VERSION_ID
4655      , PLAN_TYPE_ID
4656      , RAW_COST
4657      , BRDN_COST
4658      , REVENUE
4659      , BILL_RAW_COST
4660      , BILL_BRDN_COST
4661      , BILL_LABOR_RAW_COST
4662      , BILL_LABOR_BRDN_COST
4663      , BILL_LABOR_HRS
4664      , EQUIPMENT_RAW_COST
4665      , EQUIPMENT_BRDN_COST
4666      , CAPITALIZABLE_RAW_COST
4667      , CAPITALIZABLE_BRDN_COST
4668      , LABOR_RAW_COST
4669      , LABOR_BRDN_COST
4670      , LABOR_HRS
4671      , LABOR_REVENUE
4672      , EQUIPMENT_HOURS
4673      , BILLABLE_EQUIPMENT_HOURS
4674      , SUP_INV_COMMITTED_COST
4675      , PO_COMMITTED_COST
4676      , PR_COMMITTED_COST
4677      , OTH_COMMITTED_COST
4678        , ACT_LABOR_HRS
4679 	   , ACT_EQUIP_HRS
4680 	   , ACT_LABOR_BRDN_COST
4681 	   , ACT_EQUIP_BRDN_COST
4682 	   , ACT_BRDN_COST
4683 	   , ACT_RAW_COST
4684 	   , ACT_REVENUE
4685          , ACT_LABOR_RAW_COST
4686          , ACT_EQUIP_RAW_COST
4687 	   , ETC_LABOR_HRS
4688 	   , ETC_EQUIP_HRS
4689 	   , ETC_LABOR_BRDN_COST
4690 	   , ETC_EQUIP_BRDN_COST
4691 	   , ETC_BRDN_COST
4692          , ETC_RAW_COST
4693          , ETC_LABOR_RAW_COST
4694          , ETC_EQUIP_RAW_COST
4695      , CUSTOM1
4696      , CUSTOM2
4697      , CUSTOM3
4698      , CUSTOM4
4699      , CUSTOM5
4700      , CUSTOM6
4701      , CUSTOM7
4702      , CUSTOM8
4703      , CUSTOM9
4704      , CUSTOM10
4705      , CUSTOM11
4706      , CUSTOM12
4707      , CUSTOM13
4708      , CUSTOM14
4709      , CUSTOM15
4710      , PRG_LEVEL
4711      , PLAN_TYPE_CODE   /* 4471527 */
4712 	)
4713    SELECT
4714        g_worker_id worker_id
4715      , a.PROJECT_ID
4716      , a.PROJECT_ORG_ID
4717      , a.PROJECT_ORGANIZATION_ID
4718      , a.PROJECT_ELEMENT_ID
4719      , a.TIME_ID
4720      , a.PERIOD_TYPE_ID
4721      , a.CALENDAR_TYPE
4722      , a.RBS_AGGR_LEVEL
4723      , a.WBS_ROLLUP_FLAG
4724      , a.PRG_ROLLUP_FLAG
4725      , a.CURR_RECORD_TYPE_ID
4726      , a.CURRENCY_CODE
4727      , a.RBS_ELEMENT_ID
4728      , a.RBS_VERSION_ID
4729      , a.PLAN_VERSION_ID
4730      , a.PLAN_TYPE_ID
4731      , SUM(a.RAW_COST       )
4732      , SUM(a.BRDN_COST 	)
4733      , SUM(a.REVENUE	)
4734      , SUM(a.BILL_RAW_COST )
4735      , SUM(a.BILL_BRDN_COST )
4736      , SUM(a.BILL_LABOR_RAW_COST )
4737      , SUM(a.BILL_LABOR_BRDN_COST )
4738      , SUM(a.BILL_LABOR_HRS )
4739      , SUM(a.EQUIPMENT_RAW_COST )
4740      , SUM(a.EQUIPMENT_BRDN_COST )
4741      , SUM(a.CAPITALIZABLE_RAW_COST )
4742      , SUM(a.CAPITALIZABLE_BRDN_COST )
4743      , SUM(a.LABOR_RAW_COST )
4744      , SUM(a.LABOR_BRDN_COST)
4745      , SUM(a.LABOR_HRS )
4746      , SUM(a.LABOR_REVENUE )
4747      , SUM(a.EQUIPMENT_HOURS )
4748      , SUM(a.BILLABLE_EQUIPMENT_HOURS)
4749      , SUM(a.SUP_INV_COMMITTED_COST)
4750      , SUM(a.PO_COMMITTED_COST )
4751      , SUM(a.PR_COMMITTED_COST )
4752      , SUM(a.OTH_COMMITTED_COST)
4753        , SUM(a.ACT_LABOR_HRS)
4754 	   , SUM(a.ACT_EQUIP_HRS)
4755 	   , SUM(a.ACT_LABOR_BRDN_COST)
4756 	   , SUM(a.ACT_EQUIP_BRDN_COST)
4757 	   , SUM(a.ACT_BRDN_COST    )
4758 	   , SUM(a.ACT_RAW_COST    )
4759 	   , SUM(a.ACT_REVENUE    )
4760          , SUM(a.ACT_LABOR_RAW_COST)
4761          , SUM(a.ACT_EQUIP_RAW_COST)
4762 	   , SUM(a.ETC_LABOR_HRS         )
4763 	   , SUM(a.ETC_EQUIP_HRS        )
4764 	   , SUM(a.ETC_LABOR_BRDN_COST )
4765 	   , SUM(a.ETC_EQUIP_BRDN_COST)
4766 	   , SUM(a.ETC_BRDN_COST )
4767          , SUM(a.ETC_RAW_COST)
4768          , SUM(a.ETC_LABOR_RAW_COST)
4769          , SUM(a.ETC_EQUIP_RAW_COST)
4770      , SUM(a.CUSTOM1	)
4771      , SUM(a.CUSTOM2	)
4772      , SUM(a.CUSTOM3	)
4773      , SUM(a.CUSTOM4	)
4774      , SUM(a.CUSTOM5	)
4775      , SUM(a.CUSTOM6	)
4776      , SUM(a.CUSTOM7	)
4777      , SUM(a.CUSTOM8	)
4778      , SUM(a.CUSTOM9	)
4779      , SUM(a.CUSTOM10	)
4780      , SUM(a.CUSTOM11	)
4781      , SUM(a.CUSTOM12	)
4782      , SUM(a.CUSTOM13	)
4783      , SUM(a.CUSTOM14	)
4784      , SUM(a.CUSTOM15	)
4785      , g_default_prg_level prg_level
4786      , a.plan_type_code plan_type_code    /* 4471527 */
4787    FROM (
4788    SELECT
4789          fact.project_id  project_id
4790    	 , fact.project_ORG_ID project_ORG_ID
4791    	 , fact.project_ORGANIZATION_ID project_ORGANIZATION_ID
4792      -- , fact.PARTITION_ID PARTITION_ID
4793    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
4794    	 , pa_cal.ent_period_id TIME_ID
4795    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
4796    	 , 'E' CALENDAR_TYPE -- fact.CALENDAR_TYPE
4797      , fact.RBS_AGGR_LEVEL
4798      , fact.WBS_ROLLUP_FLAG
4799      , fact.PRG_ROLLUP_FLAG
4800    	 , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
4801    	 , fact.CURRENCY_CODE CURRENCY_CODE
4802    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
4803    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
4804    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
4805 	 , fact.PLAN_TYPE_ID  PLAN_TYPE_ID
4806 	 , ROUND (
4807              NVL (
4808             DECODE (
4809                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4810 			  , '00'   , fact.raw_cost
4811 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4812 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4813 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4814 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4815 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4816 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4817 			  , '0-1'  , fact.raw_cost
4818 			  , '1-1'  , fact.raw_cost
4819 			  , 0  ) -- end decode
4820 			    , 0  ) -- end nvl
4821 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4822 						* PJI_UTILS.GET_MAU (fact.currency_code)	raw_cost
4823 	 , ROUND (
4824              NVL (
4825             DECODE (
4826                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4827 			 , '00'   , fact.brdn_cost
4828 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4829 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4830 			 , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4831 			 , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4832 			 , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4833 			 , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4834 			 , '0-1'  , fact.brdn_cost
4835 			 , '1-1'  , fact.brdn_cost
4836 			 , 0  ) -- end decode
4837 			  , 0  ) -- end nvl
4838 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4839 						* PJI_UTILS.GET_MAU (fact.currency_code)	brdn_cost
4840 	 , ROUND (
4841              NVL (
4842             DECODE (
4843                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4844 			 , '00'   , fact.revenue
4845 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4846 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4847 			 , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4848 			 , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4849 			 , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4850 			 , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4851 			 , '0-1'  , fact.revenue
4852 			 , '1-1'  , fact.revenue
4853 			 , 0  ) -- end decode
4854 			  , 0  ) -- end nvl
4855 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4856 						* PJI_UTILS.GET_MAU (fact.currency_code)	revenue
4857 	 , ROUND (
4858              NVL (
4859             DECODE (
4860                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4861 			  , '00'   , fact.bill_raw_cost
4862 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4863 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4864 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4865 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4866 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4867 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4868 			  , '0-1'  , fact.bill_raw_cost
4869 			  , '1-1'  , fact.bill_raw_cost
4870 			  , 0  ) -- end decode
4871 			    , 0  ) -- end nvl
4872 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4873 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_raw_cost
4874 	 , ROUND (
4875              NVL (
4876             DECODE (
4877                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4878 			  , '00'   , fact.bill_brdn_cost
4879 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4880 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4881 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4882 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4883 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4884 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4885 			  , '0-1'  , fact.bill_brdn_cost
4886 			  , '1-1'  , fact.bill_brdn_cost
4887 			  , 0  ) -- end decode
4888 			    , 0  ) -- end nvl
4889 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4890 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_brdn_cost
4891 	 , ROUND (
4892              NVL (
4893             DECODE (
4894                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4895 			  , '00'   , fact.bill_labor_raw_cost
4896 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4897 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4898 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4899 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4900 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4901 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4902 			  , '0-1'  , fact.bill_labor_raw_cost
4903 			  , '1-1'  , fact.bill_labor_raw_cost
4904 			  , 0  ) -- end decode
4905 			    , 0  ) -- end nvl
4906 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4907 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_raw_cost
4908 	 , ROUND (
4909              NVL (
4910             DECODE (
4911                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4912 			  , '00'   , fact.bill_labor_brdn_cost
4913 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4914 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4915 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4916 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4917 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4918 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4919 			  , '0-1'  , fact.bill_labor_brdn_cost
4920 			  , '1-1'  , fact.bill_labor_brdn_cost
4921 			  , 0  ) -- end decode
4922 			    , 0  ) -- end nvl
4923 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4924 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_brdn_cost
4925 	 , ROUND (
4926              NVL (
4927             DECODE (
4928                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4929 			  , '00'   , fact.bill_labor_hrs
4930 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4931 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4932 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4933 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4934 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4935 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4936 			  , '0-1'  , fact.bill_labor_hrs
4937 			  , '1-1'  , fact.bill_labor_hrs
4938 			  , 0  ) -- end decode
4939 			    , 0  ) -- end nvl
4940 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4941 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_hrs
4942 	 , ROUND (
4943              NVL (
4944             DECODE (
4945                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4946 			  , '00'   , fact.equipment_raw_cost
4947 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4948 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4949 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4950 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4951 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4952 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4953 			  , '0-1'  , fact.equipment_raw_cost
4954 			  , '1-1'  , fact.equipment_raw_cost
4955 			  , 0  ) -- end decode
4956 			    , 0  ) -- end nvl
4957 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4958 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_raw_cost
4959 	 , ROUND (
4960              NVL (
4961             DECODE (
4962                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4963 			  , '00'   , fact.equipment_brdn_cost
4964 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4965 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4966 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4967 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4968 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4969 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4970 			  , '0-1'  , fact.equipment_brdn_cost
4971 			  , '1-1'  , fact.equipment_brdn_cost
4972 			  , 0  ) -- end decode
4973 			    , 0  ) -- end nvl
4974 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4975 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_brdn_cost
4976 	 , ROUND (
4977              NVL (
4978             DECODE (
4979                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4980 			  , '00'   , fact.capitalizable_raw_cost
4981 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4982 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4983 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4984 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4985 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4986 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4987 			  , '0-1'  , fact.capitalizable_raw_cost
4988 			  , '1-1'  , fact.capitalizable_raw_cost
4989 			  , 0  ) -- end decode
4990 			    , 0  ) -- end nvl
4991 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
4992 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_raw_cost
4993 	 , ROUND (
4994              NVL (
4995             DECODE (
4996                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
4997 			  , '00'   , fact.capitalizable_brdn_cost
4998 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
4999 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5000 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5001 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5002 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5003 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5004 			  , '0-1'  , fact.capitalizable_brdn_cost
5005 			  , '1-1'  , fact.capitalizable_brdn_cost
5006 			  , 0  ) -- end decode
5007 			    , 0  ) -- end nvl
5008 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5009 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_brdn_cost
5010 	 , ROUND (
5011              NVL (
5012             DECODE (
5013                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5014 			  , '00'   , fact.labor_raw_cost
5015 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5016 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5017 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5018 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5019 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5020 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5021 			  , '0-1'  , fact.labor_raw_cost
5022 			  , '1-1'  , fact.labor_raw_cost
5023 			  , 0  ) -- end decode
5024 			    , 0  ) -- end nvl
5025 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5026 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_raw_cost
5027 	 , ROUND (
5028              NVL (
5029             DECODE (
5030                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5031 			  , '00'   , fact.labor_brdn_cost
5032 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5033 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5034 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5035 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5036 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5037 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5038 			  , '0-1'  , fact.labor_brdn_cost
5039 			  , '1-1'  , fact.labor_brdn_cost
5040 			  , 0  ) -- end decode
5041 			    , 0  ) -- end nvl
5042 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5043 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_brdn_cost
5044 	 , ROUND (
5045              NVL (
5046             DECODE (
5047                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5048 			  , '00'   , fact.labor_hrs
5049 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5050 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5051 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5052 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5053 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5054 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5055 			  , '0-1'  , fact.labor_hrs
5056 			  , '1-1'  , fact.labor_hrs
5057 			  , 0  ) -- end decode
5058 			    , 0  ) -- end nvl
5059 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5060 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_hrs
5061 	 , ROUND (
5062              NVL (
5063             DECODE (
5064                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5065 			  , '00'   , fact.labor_revenue
5066 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5067 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5068 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5069 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5070 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5071 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5072 			  , '0-1'  , fact.labor_revenue
5073 			  , '1-1'  , fact.labor_revenue
5074 			  , 0  ) -- end decode
5075 			    , 0  ) -- end nvl
5076 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5077 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_revenue
5078 	 , ROUND (
5079              NVL (
5080             DECODE (
5081                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5082 			  , '00'   , fact.equipment_hours
5083 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5084 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5085 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5086 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5087 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5088 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5089 			  , '0-1'  , fact.equipment_hours
5090 			  , '1-1'  , fact.equipment_hours
5091 			  , 0  ) -- end decode
5092 			    , 0  ) -- end nvl
5093 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5094 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_hours
5095 	 , ROUND (
5096              NVL (
5097             DECODE (
5098                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5099 			  , '00'   , fact.billable_equipment_hours
5100 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5101 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5102 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5103 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5104 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5105 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5106 			  , '0-1'  , fact.billable_equipment_hours
5107 			  , '1-1'  , fact.billable_equipment_hours
5108 			  , 0  ) -- end decode
5109 			    , 0  ) -- end nvl
5110 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5111 						* PJI_UTILS.GET_MAU (fact.currency_code)	billable_equipment_hours
5112 	 , ROUND (
5113              NVL (
5114             DECODE (
5115                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5116 			  , '00'   , fact.sup_inv_committed_cost
5117 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5118 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5119 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5120 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5121 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5122 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5123 			  , '0-1'  , fact.sup_inv_committed_cost
5124 			  , '1-1'  , fact.sup_inv_committed_cost
5125 			  , 0  ) -- end decode
5126 			    , 0  ) -- end nvl
5127 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5128 						* PJI_UTILS.GET_MAU (fact.currency_code)	sup_inv_committed_cost
5129 	 , ROUND (
5130              NVL (
5131             DECODE (
5132                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5133 			  , '00'   , fact.po_committed_cost
5134 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5135 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5136 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5137 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5138 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5139 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5140 			  , '0-1'  , fact.po_committed_cost
5141 			  , '1-1'  , fact.po_committed_cost
5142 			  , 0  ) -- end decode
5143 			    , 0  ) -- end nvl
5144 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5145 						* PJI_UTILS.GET_MAU (fact.currency_code)	po_committed_cost
5146 	 , ROUND (
5147              NVL (
5148             DECODE (
5149                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5150 			  , '00'   , fact.pr_committed_cost
5151 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5152 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5153 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5154 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5155 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5156 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5157 			  , '0-1'  , fact.pr_committed_cost
5158 			  , '1-1'  , fact.pr_committed_cost
5159 			  , 0  ) -- end decode
5160 			    , 0  ) -- end nvl
5161 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5162 						* PJI_UTILS.GET_MAU (fact.currency_code)	pr_committed_cost
5163 	 , ROUND (
5164              NVL (
5165             DECODE (
5166                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5167 			  , '00'   , fact.oth_committed_cost
5168 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5169 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5170 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5171 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5172 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5173 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5174 			  , '0-1'  , fact.oth_committed_cost
5175 			  , '1-1'  , fact.oth_committed_cost
5176 			  , 0  ) -- end decode
5177 			    , 0  ) -- end nvl
5178 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5179 						* PJI_UTILS.GET_MAU (fact.currency_code)	oth_committed_cost
5180 	 , ROUND (
5181              NVL (
5182             DECODE (
5183                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5184 			  , '00'   , fact.ACT_LABOR_HRS
5185 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5186 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5187 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5188 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5189 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5190 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5191 			  , '0-1'  , fact.ACT_LABOR_HRS
5192 			  , '1-1'  , fact.ACT_LABOR_HRS
5193 			  , 0  ) -- end decode
5194 			    , 0  ) -- end nvl
5195 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5196 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_HRS
5197 	 , ROUND (
5198              NVL (
5199             DECODE (
5200                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5201 			  , '00'   , fact.ACT_EQUIP_HRS
5202 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5203 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5204 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5205 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5206 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5207 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5208 			  , '0-1'  , fact.ACT_EQUIP_HRS
5209 			  , '1-1'  , fact.ACT_EQUIP_HRS
5210 			  , 0  ) -- end decode
5211 			    , 0  ) -- end nvl
5212 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5213 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_HRS
5214 	 , ROUND (
5215              NVL (
5216             DECODE (
5217                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5218 			  , '00'   , fact.ACT_LABOR_BRDN_COST
5219 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5220 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5221 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5222 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5223 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5224 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5225 			  , '0-1'  , fact.ACT_LABOR_BRDN_COST
5226 			  , '1-1'  , fact.ACT_LABOR_BRDN_COST
5227 			  , 0  ) -- end decode
5228 			    , 0  ) -- end nvl
5229 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5230 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_BRDN_COST
5231 	 , ROUND (
5232              NVL (
5233             DECODE (
5234                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5235 			  , '00'   , fact.ACT_EQUIP_BRDN_COST
5236 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5237 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5238 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5239 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5240 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5241 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5242 			  , '0-1'  , fact.ACT_EQUIP_BRDN_COST
5243 			  , '1-1'  , fact.ACT_EQUIP_BRDN_COST
5244 			  , 0  ) -- end decode
5245 			    , 0  ) -- end nvl
5246 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5247 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_BRDN_COST
5248 	 , ROUND (
5249              NVL (
5250             DECODE (
5251                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5252 			  , '00'   , fact.ACT_BRDN_COST
5253 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5254 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5255 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5256 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5257 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5258 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5259 			  , '0-1'  , fact.ACT_BRDN_COST
5260 			  , '1-1'  , fact.ACT_BRDN_COST
5261 			  , 0  ) -- end decode
5262 			    , 0  ) -- end nvl
5263 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5264 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_BRDN_COST
5265 	 , ROUND (
5266              NVL (
5267             DECODE (
5268                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5269 			  , '00'   , fact.ACT_RAW_COST
5270 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5271 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5272 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5273 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5274 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5275 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5276 			  , '0-1'  , fact.ACT_RAW_COST
5277 			  , '1-1'  , fact.ACT_RAW_COST
5278 			  , 0  ) -- end decode
5279 			    , 0  ) -- end nvl
5280 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5281 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_RAW_COST
5282 	 , ROUND (
5283              NVL (
5284             DECODE (
5285                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5286 			  , '00'   , fact.ACT_REVENUE
5287 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5288 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5289 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5290 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5291 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5292 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5293 			  , '0-1'  , fact.ACT_REVENUE
5294 			  , '1-1'  , fact.ACT_REVENUE
5295 			  , 0  ) -- end decode
5296 			    , 0  ) -- end nvl
5297 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5298 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_REVENUE
5299 	 , ROUND (
5300              NVL (
5301             DECODE (
5302                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5303 			  , '00'   , fact.ACT_LABOR_RAW_COST
5304 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5305 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5306 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5307 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5308 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5309 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5310 			  , '0-1'  , fact.ACT_LABOR_RAW_COST
5311 			  , '1-1'  , fact.ACT_LABOR_RAW_COST
5312 			  , 0  ) -- end decode
5313 			    , 0  ) -- end nvl
5314 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5315 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_RAW_COST
5316 	 , ROUND (
5317              NVL (
5318             DECODE (
5319                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5320 			  , '00'   , fact.ACT_EQUIP_RAW_COST
5321 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5322 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5323 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5324 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5325 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5326 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5327 			  , '0-1'  , fact.ACT_EQUIP_RAW_COST
5328 			  , '1-1'  , fact.ACT_EQUIP_RAW_COST
5329 			  , 0  ) -- end decode
5330 			    , 0  ) -- end nvl
5331 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5332 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_RAW_COST
5333 	 , ROUND (
5334              NVL (
5335             DECODE (
5336                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5337 			  , '00'   , fact.ETC_LABOR_HRS
5338 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5339 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5340 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5341 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5342 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5343 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5344 			  , '0-1'  , fact.ETC_LABOR_HRS
5345 			  , '1-1'  , fact.ETC_LABOR_HRS
5346 			  , 0  ) -- end decode
5347 			    , 0  ) -- end nvl
5348 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5349 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_HRS
5350 	 , ROUND (
5351              NVL (
5352             DECODE (
5353                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5354 			  , '00'   , fact.ETC_EQUIP_HRS
5355 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5356 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5357 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5358 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5359 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5360 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5361 			  , '0-1'  , fact.ETC_EQUIP_HRS
5362 			  , '1-1'  , fact.ETC_EQUIP_HRS
5363 			  , 0  ) -- end decode
5364 			    , 0  ) -- end nvl
5365 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5366 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_HRS
5367 	 , ROUND (
5368              NVL (
5369             DECODE (
5370                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5371 			  , '00'   , fact.ETC_LABOR_BRDN_COST
5372 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5373 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5374 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5375 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5376 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5377 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5378 			  , '0-1'  , fact.ETC_LABOR_BRDN_COST
5379 			  , '1-1'  , fact.ETC_LABOR_BRDN_COST
5380 			  , 0  ) -- end decode
5381 			    , 0  ) -- end nvl
5382 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5383 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_BRDN_COST
5384 	 , ROUND (
5385              NVL (
5386             DECODE (
5387                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5388 			  , '00'   , fact.ETC_EQUIP_BRDN_COST
5389 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5390 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5391 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5392 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5393 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5394 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5395 			  , '0-1'  , fact.ETC_EQUIP_BRDN_COST
5396 			  , '1-1'  , fact.ETC_EQUIP_BRDN_COST
5397 			  , 0  ) -- end decode
5398 			    , 0  ) -- end nvl
5399 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5400 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_BRDN_COST
5401 	 , ROUND (
5402              NVL (
5403             DECODE (
5404                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5405 			  , '00'   , fact.ETC_BRDN_COST
5406 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5407 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5408 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5409 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5410 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5411 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5412 			  , '0-1'  , fact.ETC_BRDN_COST
5413 			  , '1-1'  , fact.ETC_BRDN_COST
5414 			  , 0  ) -- end decode
5415 			    , 0  ) -- end nvl
5416 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5417 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_BRDN_COST
5418 	 , ROUND (
5419              NVL (
5420             DECODE (
5421                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5422 			  , '00'   , fact.ETC_RAW_COST
5423 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5424 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5425 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5426 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5427 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5428 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5429 			  , '0-1'  , fact.ETC_RAW_COST
5430 			  , '1-1'  , fact.ETC_RAW_COST
5431 			  , 0  ) -- end decode
5432 			    , 0  ) -- end nvl
5433 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5434 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_RAW_COST
5435 	 , ROUND (
5436              NVL (
5437             DECODE (
5438                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5439 			  , '00'   , fact.ETC_LABOR_RAW_COST
5440 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5441 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5442 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5443 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5444 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5445 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5446 			  , '0-1'  , fact.ETC_LABOR_RAW_COST
5447 			  , '1-1'  , fact.ETC_LABOR_RAW_COST
5448 			  , 0  ) -- end decode
5449 			    , 0  ) -- end nvl
5450 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5451 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_RAW_COST
5452 	 , ROUND (
5453              NVL (
5454             DECODE (
5455                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5456 			  , '00'   , fact.ETC_EQUIP_RAW_COST
5457 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5458 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5459 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5460 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5461 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5462 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5463 			  , '0-1'  , fact.ETC_EQUIP_RAW_COST
5464 			  , '1-1'  , fact.ETC_EQUIP_RAW_COST
5465 			  , 0  ) -- end decode
5466 			    , 0  ) -- end nvl
5467 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5468 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_RAW_COST
5469 	 , ROUND (
5470              NVL (
5471             DECODE (
5472                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5473 			  , '00'   , fact.custom1
5474 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5475 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5476 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5477 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5478 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5479 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5480 			  , '0-1'  , fact.custom1
5481 			  , '1-1'  , fact.custom1
5482 			  , 0  ) -- end decode
5483 			    , 0  ) -- end nvl
5484 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5485 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom1
5486 	 , ROUND (
5487              NVL (
5488             DECODE (
5489                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5490 			  , '00'   , fact.custom2
5491 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5492 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5493 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5494 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5495 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5496 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5497 			  , '0-1'  , fact.custom2
5498 			  , '1-1'  , fact.custom2
5499 			  , 0  ) -- end decode
5500 			    , 0  ) -- end nvl
5501 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5502 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom2
5503 	 , ROUND (
5504              NVL (
5505             DECODE (
5506                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5507 			  , '00'   , fact.custom3
5508 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5509 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5510 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5511 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5512 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5513 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5514 			  , '0-1'  , fact.custom3
5515 			  , '1-1'  , fact.custom3
5516 			  , 0  ) -- end decode
5517 			    , 0  ) -- end nvl
5518 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5519 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom3
5520 	 , ROUND (
5521              NVL (
5522             DECODE (
5523                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5524 			  , '00'   , fact.custom4
5525 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5526 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5527 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5528 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5529 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5530 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5531 			  , '0-1'  , fact.custom4
5532 			  , '1-1'  , fact.custom4
5533 			  , 0  ) -- end decode
5534 			    , 0  ) -- end nvl
5535 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5536 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom4
5537 	 , ROUND (
5538              NVL (
5539             DECODE (
5540                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5541 			  , '00'   , fact.custom5
5542 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5543 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5544 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5545 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5546 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5547 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5548 			  , '0-1'  , fact.custom5
5549 			  , '1-1'  , fact.custom5
5550 			  , 0  ) -- end decode
5551 			    , 0  ) -- end nvl
5552 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5553 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom5
5554 	 , ROUND (
5555              NVL (
5556             DECODE (
5557                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5558 			  , '00'   , fact.custom6
5559 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5560 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5561 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5562 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5563 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5564 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5565 			  , '0-1'  , fact.custom6
5566 			  , '1-1'  , fact.custom6
5567 			  , 0  ) -- end decode
5568 			    , 0  ) -- end nvl
5569 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5570 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom6
5571 	 , ROUND (
5572              NVL (
5573             DECODE (
5574                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5575 			  , '00'   , fact.custom7
5576 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5577 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5578 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5579 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5580 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5581 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5582 			  , '0-1'  , fact.custom7
5583 			  , '1-1'  , fact.custom7
5584 			  , 0  ) -- end decode
5585 			    , 0  ) -- end nvl
5586 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5587 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom7
5588 	 , ROUND (
5589              NVL (
5590             DECODE (
5591                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5592 			  , '00'   , fact.custom8
5593 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5594 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5595 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5596 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5597 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5598 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5599 			  , '0-1'  , fact.custom8
5600 			  , '1-1'  , fact.custom8
5601 			  , 0  ) -- end decode
5602 			    , 0  ) -- end nvl
5603 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5604 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom8
5605 	 , ROUND (
5606              NVL (
5607             DECODE (
5608                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5609 			  , '00'   , fact.custom9
5610 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5611 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5612 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5613 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5614 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5615 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5616 			  , '0-1'  , fact.custom9
5617 			  , '1-1'  , fact.custom9
5618 			  , 0  ) -- end decode
5619 			    , 0  ) -- end nvl
5620 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5621 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom9
5622 	 , ROUND (
5623              NVL (
5624             DECODE (
5625                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5626 			  , '00'   , fact.custom10
5627 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5628 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5629 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5630 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5631 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5632 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5633 			  , '0-1'  , fact.custom10
5634 			  , '1-1'  , fact.custom10
5635 			  , 0  ) -- end decode
5636 			    , 0  ) -- end nvl
5637 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5638 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom10
5639 	 , ROUND (
5640              NVL (
5641             DECODE (
5642                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5643 			  , '00'   , fact.custom11
5644 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5645 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5646 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5647 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5648 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5649 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5650 			  , '0-1'  , fact.custom11
5651 			  , '1-1'  , fact.custom11
5652 			  , 0  ) -- end decode
5653 			    , 0  ) -- end nvl
5654 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5655 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom11
5656 	 , ROUND (
5657              NVL (
5658             DECODE (
5659                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5660 			  , '00'   , fact.custom12
5661 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5662 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5663 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5664 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5665 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5666 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5667 			  , '0-1'  , fact.custom12
5668 			  , '1-1'  , fact.custom12
5669 			  , 0  ) -- end decode
5670 			    , 0  ) -- end nvl
5671 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5672 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom12
5673 	 , ROUND (
5674              NVL (
5675             DECODE (
5676                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5677 			  , '00'   , fact.custom13
5678 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5679 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5680 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5681 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5682 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5683 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5684 			  , '0-1'  , fact.custom13
5685 			  , '1-1'  , fact.custom13
5686 			  , 0  ) -- end decode
5687 			    , 0  ) -- end nvl
5688 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5689 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom13
5690 	 , ROUND (
5691              NVL (
5692             DECODE (
5693                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5694 			  , '00'   , fact.custom14
5695 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5696 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5697 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5698 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5699 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5700 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5701 			  , '0-1'  , fact.custom14
5702 			  , '1-1'  , fact.custom14
5703 			  , 0  ) -- end decode
5704 			    , 0  ) -- end nvl
5705 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5706 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom14
5707 	 , ROUND (
5708              NVL (
5709             DECODE (
5710                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
5711 			  , '00'   , fact.custom15
5712 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5713 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5714 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5715 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5716 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5717 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
5718 			  , '0-1'  , fact.custom15
5719 			  , '1-1'  , fact.custom15
5720 			  , 0  ) -- end decode
5721 			    , 0  ) -- end nvl
5722 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5723 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom15
5724          , fact.plan_type_code   plan_type_code     /* 4471527  */
5725    FROM  pji_fp_xbs_accum_f  fact
5726        , pji_time_cal_period  non_pa_cal
5727     -- , pji_org_extr_info  orginfo
5728    	 , pji_time_ent_period  pa_cal
5729        , PJI_FM_EXTR_PLNVER3_T ver
5730    WHERE  1 = 1
5731       AND fact.calendar_type IN ('P', 'G')
5732       AND fact.period_type_id = 32
5733       AND non_pa_cal.cal_period_id = fact.time_id
5734       AND ver.project_id = fact.project_id
5735       AND ver.plan_version_id = fact.plan_version_id
5736       ANd ver.plan_type_code = fact.plan_type_code    /* 4471527 */
5737       -- AND orginfo.org_id = fact.PROJECT_ORG_ID
5738       -- AND orginfo.pa_calendar_id = pa_cal.calendar_id
5739       -- AND pa_cal.start_date >= non_pa_cal.start_date
5740       AND (
5741 	       ( pa_cal.start_date >= non_pa_cal.start_date  AND pa_cal.end_date <= non_pa_cal.end_date )
5742 	    OR ( pa_cal.start_date <= non_pa_cal.start_date  AND pa_cal.end_date >= non_pa_cal.end_date )
5743 	    OR ( pa_cal.start_date <= non_pa_cal.start_date  AND pa_cal.end_date <= non_pa_cal.end_date AND pa_cal.end_date >= non_pa_cal.start_date )
5744 	    OR ( pa_cal.start_date >= non_pa_cal.start_date  AND pa_cal.end_date >= non_pa_cal.end_date AND pa_cal.start_date <= non_pa_cal.end_date )
5745           )
5746       AND fact.period_type_id = 32
5747       AND ver.wp_flag = 'N'
5748       AND ver.baselined_flag = 'Y'
5749 	-- AND ( ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
5750       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
5751 	  ) a
5752 	  GROUP BY
5753 	   a.PROJECT_ID
5754      , a.PROJECT_ORG_ID
5755      , a.PROJECT_ORGANIZATION_ID
5756      , a.PROJECT_ELEMENT_ID
5757      , a.TIME_ID
5758      , a.PERIOD_TYPE_ID
5759      , a.CALENDAR_TYPE
5760      , a.RBS_AGGR_LEVEL
5761      , a.WBS_ROLLUP_FLAG
5762      , a.PRG_ROLLUP_FLAG
5763      , a.CURR_RECORD_TYPE_ID
5764      , a.CURRENCY_CODE
5765      , a.RBS_ELEMENT_ID
5766      , a.RBS_VERSION_ID
5767      , a.PLAN_VERSION_ID
5768      , a.PLAN_TYPE_ID
5769      , a.PLAN_TYPE_CODE ;
5770 
5771 EXCEPTION
5772   WHEN OTHERS THEN
5773     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
5774                              p_procedure_name => 'PRORATE_TO_ENT_PG_FPRL_D ');
5775     RAISE;
5776 END;
5777 
5778 
5779 PROCEDURE PRORATE_TO_ENT_N_PJP1_D IS
5780 BEGIN
5781 
5782     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
5783 
5784 /* Commented for bug 4005006
5785     INSERT INTO pji_fp_aggr_pjp1_t   -- Non time phased entries in pjp1 table.
5786     (
5787        WORKER_ID
5788      , PROJECT_ID
5789      , PROJECT_ORG_ID
5790      , PROJECT_ORGANIZATION_ID
5791      -- , PARTITION_ID
5792      , PROJECT_ELEMENT_ID
5793      , TIME_ID
5794      , PERIOD_TYPE_ID
5795      , CALENDAR_TYPE
5796      , RBS_AGGR_LEVEL
5797      , WBS_ROLLUP_FLAG
5798      , PRG_ROLLUP_FLAG
5799      , CURR_RECORD_TYPE_ID
5800      , CURRENCY_CODE
5801      , RBS_ELEMENT_ID
5802      , RBS_VERSION_ID
5803      , PLAN_VERSION_ID
5804      , PLAN_TYPE_ID
5805      , RAW_COST
5806      , BRDN_COST
5807      , REVENUE
5808      , BILL_RAW_COST
5809      , BILL_BRDN_COST
5810      , BILL_LABOR_RAW_COST
5811      , BILL_LABOR_BRDN_COST
5812      , BILL_LABOR_HRS
5813      , EQUIPMENT_RAW_COST
5814      , EQUIPMENT_BRDN_COST
5815      , CAPITALIZABLE_RAW_COST
5816      , CAPITALIZABLE_BRDN_COST
5817      , LABOR_RAW_COST
5818      , LABOR_BRDN_COST
5819      , LABOR_HRS
5820      , LABOR_REVENUE
5821      , EQUIPMENT_HOURS
5822      , BILLABLE_EQUIPMENT_HOURS
5823      , SUP_INV_COMMITTED_COST
5824      , PO_COMMITTED_COST
5825      , PR_COMMITTED_COST
5826      , OTH_COMMITTED_COST
5827        , ACT_LABOR_HRS
5828 	   , ACT_EQUIP_HRS
5829 	   , ACT_LABOR_BRDN_COST
5830 	   , ACT_EQUIP_BRDN_COST
5831 	   , ACT_BRDN_COST
5832 	   , ACT_RAW_COST
5833 	   , ACT_REVENUE
5834          , ACT_LABOR_RAW_COST
5835          , ACT_EQUIP_RAW_COST
5836 	   , ETC_LABOR_HRS
5837 	   , ETC_EQUIP_HRS
5838 	   , ETC_LABOR_BRDN_COST
5839 	   , ETC_EQUIP_BRDN_COST
5840 	   , ETC_BRDN_COST
5841          , ETC_RAW_COST
5842          , ETC_LABOR_RAW_COST
5843          , ETC_EQUIP_RAW_COST
5844      , CUSTOM1
5845      , CUSTOM2
5846      , CUSTOM3
5847      , CUSTOM4
5848      , CUSTOM5
5849      , CUSTOM6
5850      , CUSTOM7
5851      , CUSTOM8
5852      , CUSTOM9
5853      , CUSTOM10
5854      , CUSTOM11
5855      , CUSTOM12
5856      , CUSTOM13
5857      , CUSTOM14
5858      , CUSTOM15
5859      , LINE_TYPE
5860      , TIME_DANGLING_FLAG
5861      , RATE_DANGLING_FLAG
5862      , PRG_LEVEL
5863    )
5864    SELECT
5865        g_worker_id worker_id
5866      , a.PROJECT_ID
5867      , a.PROJECT_ORG_ID
5868      , a.PROJECT_ORGANIZATION_ID
5869      , a.PROJECT_ELEMENT_ID
5870      , a.TIME_ID
5871      , 32 -- a.PERIOD_TYPE_ID
5872      , a.CALENDAR_TYPE
5873      , a.RBS_AGGR_LEVEL
5874      , a.WBS_ROLLUP_FLAG
5875      , a.PRG_ROLLUP_FLAG
5876      , a.CURR_RECORD_TYPE_ID
5877      , a.CURRENCY_CODE
5878      , a.RBS_ELEMENT_ID
5879      , a.RBS_VERSION_ID
5880      , a.PLAN_VERSION_ID
5881      , a.PLAN_TYPE_ID
5882      , SUM(a.RAW_COST       )
5883      , SUM(a.BRDN_COST 	)
5884      , SUM(a.REVENUE	)
5885      , SUM(a.BILL_RAW_COST )
5886      , SUM(a.BILL_BRDN_COST )
5887      , SUM(a.BILL_LABOR_RAW_COST )
5888      , SUM(a.BILL_LABOR_BRDN_COST )
5889      , SUM(a.BILL_LABOR_HRS )
5890      , SUM(a.EQUIPMENT_RAW_COST )
5891      , SUM(a.EQUIPMENT_BRDN_COST )
5892      , SUM(a.CAPITALIZABLE_RAW_COST )
5893      , SUM(a.CAPITALIZABLE_BRDN_COST )
5894      , SUM(a.LABOR_RAW_COST )
5895      , SUM(a.LABOR_BRDN_COST)
5896      , SUM(a.LABOR_HRS )
5897      , SUM(a.LABOR_REVENUE )
5898      , SUM(a.EQUIPMENT_HOURS )
5899      , SUM(a.BILLABLE_EQUIPMENT_HOURS)
5900      , SUM(a.SUP_INV_COMMITTED_COST)
5901      , SUM(a.PO_COMMITTED_COST )
5902      , SUM(a.PR_COMMITTED_COST )
5903      , SUM(a.OTH_COMMITTED_COST)
5904        , SUM(a.ACT_LABOR_HRS)
5905 	   , SUM(a.ACT_EQUIP_HRS)
5906 	   , SUM(a.ACT_LABOR_BRDN_COST)
5907 	   , SUM(a.ACT_EQUIP_BRDN_COST)
5908 	   , SUM(a.ACT_BRDN_COST    )
5909 	   , SUM(a.ACT_RAW_COST    )
5910 	   , SUM(a.ACT_REVENUE    )
5911          , SUM(a.ACT_LABOR_RAW_COST)
5912          , SUM(a.ACT_EQUIP_RAW_COST)
5913 	   , SUM(a.ETC_LABOR_HRS         )
5914 	   , SUM(a.ETC_EQUIP_HRS        )
5915 	   , SUM(a.ETC_LABOR_BRDN_COST )
5916 	   , SUM(a.ETC_EQUIP_BRDN_COST)
5917 	   , SUM(a.ETC_BRDN_COST )
5918          , SUM(a.ETC_RAW_COST)
5919          , SUM(a.ETC_LABOR_RAW_COST)
5920          , SUM(a.ETC_EQUIP_RAW_COST)
5921      , SUM(a.CUSTOM1	)
5922      , SUM(a.CUSTOM2	)
5923      , SUM(a.CUSTOM3	)
5924      , SUM(a.CUSTOM4	)
5925      , SUM(a.CUSTOM5	)
5926      , SUM(a.CUSTOM6	)
5927      , SUM(a.CUSTOM7	)
5928      , SUM(a.CUSTOM8	)
5929      , SUM(a.CUSTOM9	)
5930      , SUM(a.CUSTOM10	)
5931      , SUM(a.CUSTOM11	)
5932      , SUM(a.CUSTOM12	)
5933      , SUM(a.CUSTOM13	)
5934      , SUM(a.CUSTOM14	)
5935      , SUM(a.CUSTOM15	)
5936      , a.LINE_TYPE
5937      , a.TIME_DANGLING_FLAG
5938      , a.RATE_DANGLING_FLAG
5939      , g_default_prg_level prg_level
5940    FROM (
5941    SELECT
5942          fact.project_id  project_id
5943    	 , fact.project_ORG_ID project_ORG_ID
5944    	 , fact.project_ORGANIZATION_ID project_ORGANIZATION_ID
5945      -- , fact.PARTITION_ID PARTITION_ID
5946    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
5947    	 , pa_cal.ent_period_id TIME_ID
5948    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
5949    	 , 'E' CALENDAR_TYPE -- fact.CALENDAR_TYPE
5950      , fact.RBS_AGGR_LEVEL
5951      , fact.WBS_ROLLUP_FLAG
5952      , fact.PRG_ROLLUP_FLAG
5953    	 , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
5954    	 , fact.CURRENCY_CODE CURRENCY_CODE
5955    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
5956    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
5957    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
5958 	 , fact.PLAN_TYPE_ID  PLAN_TYPE_ID
5959 	 , ROUND (
5960              NVL (
5961             DECODE (
5962                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
5963 			  , '00'   , fact.raw_cost
5964 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
5965 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
5966 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
5967 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
5968 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
5969 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
5970 			  , '0-1'  , fact.raw_cost
5971 			  , '1-1'  , fact.raw_cost
5972 			  , 0  ) -- end decode
5973 			    , 0  ) -- end nvl
5974 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5975 						* PJI_UTILS.GET_MAU (fact.currency_code)	raw_cost
5976 	 , ROUND (
5977              NVL (
5978             DECODE (
5979                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
5980 			 , '00'   , fact.brdn_cost
5981 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
5982 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
5983 			 , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
5984 			 , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
5985 			 , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
5986 			 , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
5987 			 , '0-1'  , fact.brdn_cost
5988 			 , '1-1'  , fact.brdn_cost
5989 			 , 0  ) -- end decode
5990 			  , 0  ) -- end nvl
5991 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
5992 						* PJI_UTILS.GET_MAU (fact.currency_code)	brdn_cost
5993 	 , ROUND (
5994              NVL (
5995             DECODE (
5996                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
5997 			 , '00'   , fact.revenue
5998 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
5999 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
6000 			 , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
6001 			 , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
6002 			 , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
6003 			 , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
6004 			 , '0-1'  , fact.revenue
6005 			 , '1-1'  , fact.revenue
6006 			 , 0  ) -- end decode
6007 			  , 0  ) -- end nvl
6008 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6009 						* PJI_UTILS.GET_MAU (fact.currency_code)	revenue
6010 	 , ROUND (
6011              NVL (
6012             DECODE (
6013                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6014 			  , '00'   , fact.bill_raw_cost
6015 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
6016 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
6017 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
6018 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
6019 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
6020 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
6021 			  , '0-1'  , fact.bill_raw_cost
6022 			  , '1-1'  , fact.bill_raw_cost
6023 			  , 0  ) -- end decode
6024 			    , 0  ) -- end nvl
6025 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6026 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_raw_cost
6027 	 , ROUND (
6028              NVL (
6029             DECODE (
6030                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6031 			  , '00'   , fact.bill_brdn_cost
6032 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
6033 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
6034 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
6035 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
6036 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
6037 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
6038 			  , '0-1'  , fact.bill_brdn_cost
6039 			  , '1-1'  , fact.bill_brdn_cost
6040 			  , 0  ) -- end decode
6041 			    , 0  ) -- end nvl
6042 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6043 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_brdn_cost
6044 	 , ROUND (
6045              NVL (
6046             DECODE (
6047                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6048 			  , '00'   , fact.bill_labor_raw_cost
6049 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
6050 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
6051 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
6052 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
6053 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
6054 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
6055 			  , '0-1'  , fact.bill_labor_raw_cost
6056 			  , '1-1'  , fact.bill_labor_raw_cost
6057 			  , 0  ) -- end decode
6058 			    , 0  ) -- end nvl
6059 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6060 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_raw_cost
6061 	 , ROUND (
6062              NVL (
6063             DECODE (
6064                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6065 			  , '00'   , fact.bill_labor_brdn_cost
6066 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6067 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6068 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6069 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6070 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6071 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6072 			  , '0-1'  , fact.bill_labor_brdn_cost
6073 			  , '1-1'  , fact.bill_labor_brdn_cost
6074 			  , 0  ) -- end decode
6075 			    , 0  ) -- end nvl
6076 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6077 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_brdn_cost
6078 	 , ROUND (
6079              NVL (
6080             DECODE (
6081                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6082 			  , '00'   , fact.bill_labor_hrs
6083 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
6084 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
6085 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
6086 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
6087 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
6088 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
6089 			  , '0-1'  , fact.bill_labor_hrs
6090 			  , '1-1'  , fact.bill_labor_hrs
6091 			  , 0  ) -- end decode
6092 			    , 0  ) -- end nvl
6093 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6094 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_hrs
6095 	 , ROUND (
6096              NVL (
6097             DECODE (
6098                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6099 			  , '00'   , fact.equipment_raw_cost
6100 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
6101 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
6102 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
6103 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
6104 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
6105 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
6106 			  , '0-1'  , fact.equipment_raw_cost
6107 			  , '1-1'  , fact.equipment_raw_cost
6108 			  , 0  ) -- end decode
6109 			    , 0  ) -- end nvl
6110 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6111 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_raw_cost
6112 	 , ROUND (
6113              NVL (
6114             DECODE (
6115                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6116 			  , '00'   , fact.equipment_brdn_cost
6117 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
6118 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
6119 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
6120 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
6121 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
6122 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
6123 			  , '0-1'  , fact.equipment_brdn_cost
6124 			  , '1-1'  , fact.equipment_brdn_cost
6125 			  , 0  ) -- end decode
6126 			    , 0  ) -- end nvl
6127 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6128 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_brdn_cost
6129 	 , ROUND (
6130              NVL (
6131             DECODE (
6132                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6133 			  , '00'   , fact.capitalizable_raw_cost
6134 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
6135 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
6136 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
6137 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
6138 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
6139 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
6140 			  , '0-1'  , fact.capitalizable_raw_cost
6141 			  , '1-1'  , fact.capitalizable_raw_cost
6142 			  , 0  ) -- end decode
6143 			    , 0  ) -- end nvl
6144 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6145 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_raw_cost
6146 	 , ROUND (
6147              NVL (
6148             DECODE (
6149                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6150 			  , '00'   , fact.capitalizable_brdn_cost
6151 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
6152 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
6153 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
6154 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
6155 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
6156 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
6157 			  , '0-1'  , fact.capitalizable_brdn_cost
6158 			  , '1-1'  , fact.capitalizable_brdn_cost
6159 			  , 0  ) -- end decode
6160 			    , 0  ) -- end nvl
6161 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6162 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_brdn_cost
6163 	 , ROUND (
6164              NVL (
6165             DECODE (
6166                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6167 			  , '00'   , fact.labor_raw_cost
6168 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
6169 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
6170 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
6171 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
6172 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
6173 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
6174 			  , '0-1'  , fact.labor_raw_cost
6175 			  , '1-1'  , fact.labor_raw_cost
6176 			  , 0  ) -- end decode
6177 			    , 0  ) -- end nvl
6178 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6179 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_raw_cost
6180 	 , ROUND (
6181              NVL (
6182             DECODE (
6183                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6184 			  , '00'   , fact.labor_brdn_cost
6185 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6186 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6187 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6188 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6189 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6190 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
6191 			  , '0-1'  , fact.labor_brdn_cost
6192 			  , '1-1'  , fact.labor_brdn_cost
6193 			  , 0  ) -- end decode
6194 			    , 0  ) -- end nvl
6195 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6196 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_brdn_cost
6197 	 , ROUND (
6198              NVL (
6199             DECODE (
6200                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6201 			  , '00'   , fact.labor_hrs
6202 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
6203 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
6204 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
6205 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
6206 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
6207 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
6208 			  , '0-1'  , fact.labor_hrs
6209 			  , '1-1'  , fact.labor_hrs
6210 			  , 0  ) -- end decode
6211 			    , 0  ) -- end nvl
6212 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6213 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_hrs
6214 	 , ROUND (
6215              NVL (
6216             DECODE (
6217                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6218 			  , '00'   , fact.labor_revenue
6219 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
6220 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
6221 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
6222 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
6223 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
6224 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
6225 			  , '0-1'  , fact.labor_revenue
6226 			  , '1-1'  , fact.labor_revenue
6227 			  , 0  ) -- end decode
6228 			    , 0  ) -- end nvl
6229 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6230 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_revenue
6231 	 , ROUND (
6232              NVL (
6233             DECODE (
6234                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6235 			  , '00'   , fact.equipment_hours
6236 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
6237 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
6238 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
6239 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
6240 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
6241 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
6242 			  , '0-1'  , fact.equipment_hours
6243 			  , '1-1'  , fact.equipment_hours
6244 			  , 0  ) -- end decode
6245 			    , 0  ) -- end nvl
6246 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6247 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_hours
6248 	 , ROUND (
6249              NVL (
6250             DECODE (
6251                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6252 			  , '00'   , fact.billable_equipment_hours
6253 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
6254 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
6255 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
6256 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
6257 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
6258 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
6259 			  , '0-1'  , fact.billable_equipment_hours
6260 			  , '1-1'  , fact.billable_equipment_hours
6261 			  , 0  ) -- end decode
6262 			    , 0  ) -- end nvl
6263 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6264 						* PJI_UTILS.GET_MAU (fact.currency_code)	billable_equipment_hours
6265 	 , ROUND (
6266              NVL (
6267             DECODE (
6268                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6269 			  , '00'   , fact.sup_inv_committed_cost
6270 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
6271 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
6272 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
6273 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
6274 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
6275 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
6276 			  , '0-1'  , fact.sup_inv_committed_cost
6277 			  , '1-1'  , fact.sup_inv_committed_cost
6278 			  , 0  ) -- end decode
6279 			    , 0  ) -- end nvl
6280 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6281 						* PJI_UTILS.GET_MAU (fact.currency_code)	sup_inv_committed_cost
6282 	 , ROUND (
6283              NVL (
6284             DECODE (
6285                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6286 			  , '00'   , fact.po_committed_cost
6287 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
6288 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
6289 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
6290 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
6291 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
6292 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
6293 			  , '0-1'  , fact.po_committed_cost
6294 			  , '1-1'  , fact.po_committed_cost
6295 			  , 0  ) -- end decode
6296 			    , 0  ) -- end nvl
6297 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6298 						* PJI_UTILS.GET_MAU (fact.currency_code)	po_committed_cost
6299 	 , ROUND (
6300              NVL (
6301             DECODE (
6302                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6303 			  , '00'   , fact.pr_committed_cost
6304 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
6305 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
6306 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
6307 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
6308 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
6309 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
6310 			  , '0-1'  , fact.pr_committed_cost
6311 			  , '1-1'  , fact.pr_committed_cost
6312 			  , 0  ) -- end decode
6313 			    , 0  ) -- end nvl
6314 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6315 						* PJI_UTILS.GET_MAU (fact.currency_code)	pr_committed_cost
6316 	 , ROUND (
6317              NVL (
6318             DECODE (
6319                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6320 			  , '00'   , fact.oth_committed_cost
6321 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
6322 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
6323 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
6324 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
6325 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
6326 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
6327 			  , '0-1'  , fact.oth_committed_cost
6328 			  , '1-1'  , fact.oth_committed_cost
6329 			  , 0  ) -- end decode
6330 			    , 0  ) -- end nvl
6331 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6332 						* PJI_UTILS.GET_MAU (fact.currency_code)	oth_committed_cost
6333 	 , ROUND (
6334              NVL (
6335             DECODE (
6336                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6337 			  , '00'   , fact.ACT_LABOR_HRS
6338 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6339 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6340 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6341 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6342 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6343 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6344 			  , '0-1'  , fact.ACT_LABOR_HRS
6345 			  , '1-1'  , fact.ACT_LABOR_HRS
6346 			  , 0  ) -- end decode
6347 			    , 0  ) -- end nvl
6348 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6349 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_HRS
6350 	 , ROUND (
6351              NVL (
6352             DECODE (
6353                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6354 			  , '00'   , fact.ACT_EQUIP_HRS
6355 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6356 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6357 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6358 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6359 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6360 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6361 			  , '0-1'  , fact.ACT_EQUIP_HRS
6362 			  , '1-1'  , fact.ACT_EQUIP_HRS
6363 			  , 0  ) -- end decode
6364 			    , 0  ) -- end nvl
6365 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6366 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_HRS
6367 	 , ROUND (
6368              NVL (
6369             DECODE (
6370                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6371 			  , '00'   , fact.ACT_LABOR_BRDN_COST
6372 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6373 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6374 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6375 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6376 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6377 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6378 			  , '0-1'  , fact.ACT_LABOR_BRDN_COST
6379 			  , '1-1'  , fact.ACT_LABOR_BRDN_COST
6380 			  , 0  ) -- end decode
6381 			    , 0  ) -- end nvl
6382 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6383 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_BRDN_COST
6384 	 , ROUND (
6385              NVL (
6386             DECODE (
6387                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6388 			  , '00'   , fact.ACT_EQUIP_BRDN_COST
6389 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6390 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6391 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6392 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6393 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6394 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6395 			  , '0-1'  , fact.ACT_EQUIP_BRDN_COST
6396 			  , '1-1'  , fact.ACT_EQUIP_BRDN_COST
6397 			  , 0  ) -- end decode
6398 			    , 0  ) -- end nvl
6399 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6400 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_BRDN_COST
6401 	 , ROUND (
6402              NVL (
6403             DECODE (
6404                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6405 			  , '00'   , fact.ACT_BRDN_COST
6406 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
6407 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
6408 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
6409 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
6410 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
6411 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
6412 			  , '0-1'  , fact.ACT_BRDN_COST
6413 			  , '1-1'  , fact.ACT_BRDN_COST
6414 			  , 0  ) -- end decode
6415 			    , 0  ) -- end nvl
6416 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6417 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_BRDN_COST
6418 	 , ROUND (
6419              NVL (
6420             DECODE (
6421                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6422 			  , '00'   , fact.ACT_RAW_COST
6423 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
6424 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
6425 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
6426 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
6427 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
6428 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
6429 			  , '0-1'  , fact.ACT_RAW_COST
6430 			  , '1-1'  , fact.ACT_RAW_COST
6431 			  , 0  ) -- end decode
6432 			    , 0  ) -- end nvl
6433 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6434 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_RAW_COST
6435 	 , ROUND (
6436              NVL (
6437             DECODE (
6438                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6439 			  , '00'   , fact.ACT_REVENUE
6440 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
6441 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
6442 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
6443 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
6444 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
6445 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
6446 			  , '0-1'  , fact.ACT_REVENUE
6447 			  , '1-1'  , fact.ACT_REVENUE
6448 			  , 0  ) -- end decode
6449 			    , 0  ) -- end nvl
6450 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6451 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_REVENUE
6452 	 , ROUND (
6453              NVL (
6454             DECODE (
6455                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6456 			  , '00'   , fact.ACT_LABOR_RAW_COST
6457 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6458 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6459 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6460 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6461 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6462 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6463 			  , '0-1'  , fact.ACT_LABOR_RAW_COST
6464 			  , '1-1'  , fact.ACT_LABOR_RAW_COST
6465 			  , 0  ) -- end decode
6466 			    , 0  ) -- end nvl
6467 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6468 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_RAW_COST
6469 	 , ROUND (
6470              NVL (
6471             DECODE (
6472                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6473 			  , '00'   , fact.ACT_EQUIP_RAW_COST
6474 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6475 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6476 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6477 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6478 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6479 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6480 			  , '0-1'  , fact.ACT_EQUIP_RAW_COST
6481 			  , '1-1'  , fact.ACT_EQUIP_RAW_COST
6482 			  , 0  ) -- end decode
6483 			    , 0  ) -- end nvl
6484 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6485 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_RAW_COST
6486 	 , ROUND (
6487              NVL (
6488             DECODE (
6489                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6490 			  , '00'   , fact.ETC_LABOR_HRS
6491 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6492 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6493 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6494 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6495 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6496 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
6497 			  , '0-1'  , fact.ETC_LABOR_HRS
6498 			  , '1-1'  , fact.ETC_LABOR_HRS
6499 			  , 0  ) -- end decode
6500 			    , 0  ) -- end nvl
6501 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6502 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_HRS
6503 	 , ROUND (
6504              NVL (
6505             DECODE (
6506                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6507 			  , '00'   , fact.ETC_EQUIP_HRS
6508 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6509 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6510 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6511 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6512 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6513 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
6514 			  , '0-1'  , fact.ETC_EQUIP_HRS
6515 			  , '1-1'  , fact.ETC_EQUIP_HRS
6516 			  , 0  ) -- end decode
6517 			    , 0  ) -- end nvl
6518 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6519 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_HRS
6520 	 , ROUND (
6521              NVL (
6522             DECODE (
6523                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6524 			  , '00'   , fact.ETC_LABOR_BRDN_COST
6525 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6526 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6527 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6528 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6529 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6530 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
6531 			  , '0-1'  , fact.ETC_LABOR_BRDN_COST
6532 			  , '1-1'  , fact.ETC_LABOR_BRDN_COST
6533 			  , 0  ) -- end decode
6534 			    , 0  ) -- end nvl
6535 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6536 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_BRDN_COST
6537 	 , ROUND (
6538              NVL (
6539             DECODE (
6540                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6541 			  , '00'   , fact.ETC_EQUIP_BRDN_COST
6542 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6543 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6544 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6545 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6546 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6547 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
6548 			  , '0-1'  , fact.ETC_EQUIP_BRDN_COST
6549 			  , '1-1'  , fact.ETC_EQUIP_BRDN_COST
6550 			  , 0  ) -- end decode
6551 			    , 0  ) -- end nvl
6552 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6553 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_BRDN_COST
6554 	 , ROUND (
6555              NVL (
6556             DECODE (
6557                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6558 			  , '00'   , fact.ETC_BRDN_COST
6559 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
6560 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
6561 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
6562 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
6563 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
6564 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
6565 			  , '0-1'  , fact.ETC_BRDN_COST
6566 			  , '1-1'  , fact.ETC_BRDN_COST
6567 			  , 0  ) -- end decode
6568 			    , 0  ) -- end nvl
6569 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6570 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_BRDN_COST
6571 	 , ROUND (
6572              NVL (
6573             DECODE (
6574                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6575 			  , '00'   , fact.ETC_RAW_COST
6576 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
6577 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
6578 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
6579 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
6580 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
6581 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
6582 			  , '0-1'  , fact.ETC_RAW_COST
6583 			  , '1-1'  , fact.ETC_RAW_COST
6584 			  , 0  ) -- end decode
6585 			    , 0  ) -- end nvl
6586 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6587 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_RAW_COST
6588 	 , ROUND (
6589              NVL (
6590             DECODE (
6591                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6592 			  , '00'   , fact.ETC_LABOR_RAW_COST
6593 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6594 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6595 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6596 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6597 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6598 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
6599 			  , '0-1'  , fact.ETC_LABOR_RAW_COST
6600 			  , '1-1'  , fact.ETC_LABOR_RAW_COST
6601 			  , 0  ) -- end decode
6602 			    , 0  ) -- end nvl
6603 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6604 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_RAW_COST
6605 	 , ROUND (
6606              NVL (
6607             DECODE (
6608                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6609 			  , '00'   , fact.ETC_EQUIP_RAW_COST
6610 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6611 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6612 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6613 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6614 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6615 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
6616 			  , '0-1'  , fact.ETC_EQUIP_RAW_COST
6617 			  , '1-1'  , fact.ETC_EQUIP_RAW_COST
6618 			  , 0  ) -- end decode
6619 			    , 0  ) -- end nvl
6620 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6621 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_RAW_COST
6622 	 , ROUND (
6623              NVL (
6624             DECODE (
6625                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6626 			  , '00'   , fact.custom1
6627 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
6628 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
6629 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
6630 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
6631 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
6632 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
6633 			  , '0-1'  , fact.custom1
6634 			  , '1-1'  , fact.custom1
6635 			  , 0  ) -- end decode
6636 			    , 0  ) -- end nvl
6637 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6638 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom1
6639 	 , ROUND (
6640              NVL (
6641             DECODE (
6642                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6643 			  , '00'   , fact.custom2
6644 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
6645 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
6646 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
6647 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
6648 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
6649 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
6650 			  , '0-1'  , fact.custom2
6651 			  , '1-1'  , fact.custom2
6652 			  , 0  ) -- end decode
6653 			    , 0  ) -- end nvl
6654 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6655 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom2
6656 	 , ROUND (
6657              NVL (
6658             DECODE (
6659                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6660 			  , '00'   , fact.custom3
6661 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
6662 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
6663 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
6664 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
6665 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
6666 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
6667 			  , '0-1'  , fact.custom3
6668 			  , '1-1'  , fact.custom3
6669 			  , 0  ) -- end decode
6670 			    , 0  ) -- end nvl
6671 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6672 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom3
6673 	 , ROUND (
6674              NVL (
6675             DECODE (
6676                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6677 			  , '00'   , fact.custom4
6678 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
6679 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
6680 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
6681 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
6682 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
6683 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
6684 			  , '0-1'  , fact.custom4
6685 			  , '1-1'  , fact.custom4
6686 			  , 0  ) -- end decode
6687 			    , 0  ) -- end nvl
6688 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6689 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom4
6690 	 , ROUND (
6691              NVL (
6692             DECODE (
6693                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6694 			  , '00'   , fact.custom5
6695 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
6696 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
6697 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
6698 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
6699 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
6700 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
6701 			  , '0-1'  , fact.custom5
6702 			  , '1-1'  , fact.custom5
6703 			  , 0  ) -- end decode
6704 			    , 0  ) -- end nvl
6705 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6706 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom5
6707 	 , ROUND (
6708              NVL (
6709             DECODE (
6710                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6711 			  , '00'   , fact.custom6
6712 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
6713 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
6714 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
6715 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
6716 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
6717 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
6718 			  , '0-1'  , fact.custom6
6719 			  , '1-1'  , fact.custom6
6720 			  , 0  ) -- end decode
6721 			    , 0  ) -- end nvl
6722 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6723 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom6
6724 	 , ROUND (
6725              NVL (
6726             DECODE (
6727                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6728 			  , '00'   , fact.custom7
6729 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
6730 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
6731 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
6732 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
6733 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
6734 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
6735 			  , '0-1'  , fact.custom7
6736 			  , '1-1'  , fact.custom7
6737 			  , 0  ) -- end decode
6738 			    , 0  ) -- end nvl
6739 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6740 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom7
6741 	 , ROUND (
6742              NVL (
6743             DECODE (
6744                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6745 			  , '00'   , fact.custom8
6746 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
6747 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
6748 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
6749 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
6750 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
6751 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
6752 			  , '0-1'  , fact.custom8
6753 			  , '1-1'  , fact.custom8
6754 			  , 0  ) -- end decode
6755 			    , 0  ) -- end nvl
6756 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6757 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom8
6758 	 , ROUND (
6759              NVL (
6760             DECODE (
6761                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6762 			  , '00'   , fact.custom9
6763 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
6764 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
6765 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
6766 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
6767 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
6768 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
6769 			  , '0-1'  , fact.custom9
6770 			  , '1-1'  , fact.custom9
6771 			  , 0  ) -- end decode
6772 			    , 0  ) -- end nvl
6773 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6774 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom9
6775 	 , ROUND (
6776              NVL (
6777             DECODE (
6778                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6779 			  , '00'   , fact.custom10
6780 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
6781 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
6782 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
6783 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
6784 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
6785 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
6786 			  , '0-1'  , fact.custom10
6787 			  , '1-1'  , fact.custom10
6788 			  , 0  ) -- end decode
6789 			    , 0  ) -- end nvl
6790 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6791 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom10
6792 	 , ROUND (
6793              NVL (
6794             DECODE (
6795                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6796 			  , '00'   , fact.custom11
6797 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
6798 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
6799 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
6800 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
6801 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
6802 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
6803 			  , '0-1'  , fact.custom11
6804 			  , '1-1'  , fact.custom11
6805 			  , 0  ) -- end decode
6806 			    , 0  ) -- end nvl
6807 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6808 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom11
6809 	 , ROUND (
6810              NVL (
6811             DECODE (
6812                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6813 			  , '00'   , fact.custom12
6814 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
6815 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
6816 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
6817 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
6818 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
6819 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
6820 			  , '0-1'  , fact.custom12
6821 			  , '1-1'  , fact.custom12
6822 			  , 0  ) -- end decode
6823 			    , 0  ) -- end nvl
6824 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6825 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom12
6826 	 , ROUND (
6827              NVL (
6828             DECODE (
6829                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6830 			  , '00'   , fact.custom13
6831 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
6832 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
6833 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
6834 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
6835 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
6836 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
6837 			  , '0-1'  , fact.custom13
6838 			  , '1-1'  , fact.custom13
6839 			  , 0  ) -- end decode
6840 			    , 0  ) -- end nvl
6841 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6842 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom13
6843 	 , ROUND (
6844              NVL (
6845             DECODE (
6846                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6847 			  , '00'   , fact.custom14
6848 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
6849 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
6850 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
6851 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
6852 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
6853 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
6854 			  , '0-1'  , fact.custom14
6855 			  , '1-1'  , fact.custom14
6856 			  , 0  ) -- end decode
6857 			    , 0  ) -- end nvl
6858 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6859 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom14
6860 	 , ROUND (
6861              NVL (
6862             DECODE (
6863                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
6864 			  , '00'   , fact.custom15
6865 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
6866 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
6867 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
6868 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
6869 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
6870 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
6871 			  , '0-1'  , fact.custom15
6872 			  , '1-1'  , fact.custom15
6873 			  , 0  ) -- end decode
6874 			    , 0  ) -- end nvl
6875 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
6876 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom15
6877        , 'CN'   line_type
6878 	 , fact.time_dangling_flag time_dangling_flag
6879 	 , fact.rate_dangling_flag rate_dangling_flag
6880        , g_default_prg_level prg_level
6881    FROM   pji_fp_aggr_pjp1_t fact
6882         , pji_time_ent_period  pa_cal
6883         , pji_fm_extr_plnver3_t  ver
6884    WHERE  1=1
6885       AND fact.CALENDAR_TYPE = 'A'
6886       AND fact.worker_id = g_worker_id
6887       AND fact.start_date IS NOT NULL
6888       AND fact.end_date IS NOT NULL
6889 	AND fact.time_dangling_flag IS NULL
6890 	AND fact.rate_dangling_flag IS NULL
6891       AND (
6892 	       (     pa_cal.start_date >= fact.start_date
6893                AND pa_cal.end_date <= fact.end_date ) -- fsps,pefe
6894 	    OR (     pa_cal.start_date <= fact.start_date
6895                AND pa_cal.end_date >= fact.end_date ) -- psfs,fepe
6896 	    OR (     pa_cal.start_date <= fact.start_date
6897                AND pa_cal.end_date <= fact.end_date
6898                AND pa_cal.end_date >= fact.start_date ) -- psfspefe
6899 	    OR (     pa_cal.start_date >= fact.start_date
6900                AND pa_cal.end_date >= fact.end_date
6901                AND pa_cal.start_date <= fact.end_date )  -- fspsfepe
6902           )
6903       AND fact.line_type = 'NTP'
6904       AND fact.period_type_id = 2048
6905       AND fact.plan_version_id = ver.plan_version_id
6906       AND ver.wp_flag = 'N'
6907       AND ver.baselined_flag = 'Y'
6908       AND ver.time_phased_type_code = 'N'
6909 	-- AND ( ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
6910       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
6911 	  ) a
6912 	  GROUP BY
6913 	   a.PROJECT_ID
6914      , a.PROJECT_ORG_ID
6915      , a.PROJECT_ORGANIZATION_ID
6916      , a.PROJECT_ELEMENT_ID
6917      , a.TIME_ID
6918      , a.PERIOD_TYPE_ID
6919      , a.CALENDAR_TYPE
6920      , a.RBS_AGGR_LEVEL
6921      , a.WBS_ROLLUP_FLAG
6922      , a.PRG_ROLLUP_FLAG
6923      , a.CURR_RECORD_TYPE_ID
6924      , a.CURRENCY_CODE
6925      , a.RBS_ELEMENT_ID
6926      , a.RBS_VERSION_ID
6927      , a.PLAN_VERSION_ID
6928      , a.PLAN_TYPE_ID
6929 	 , a.LINE_TYPE
6930 	 , a.TIME_DANGLING_FLAG
6931 	 , a.RATE_DANGLING_FLAG;
6932  End of 4005006*/
6933 
6934     INSERT INTO pji_fp_aggr_pjp1_t   -- Non time phased entries in pjp1 table.
6935     (
6936        WORKER_ID
6937      , PROJECT_ID
6938      , PROJECT_ORG_ID
6939      , PROJECT_ORGANIZATION_ID
6940      , PROJECT_ELEMENT_ID
6941      , TIME_ID
6942      , PERIOD_TYPE_ID
6943      , CALENDAR_TYPE
6944      , RBS_AGGR_LEVEL
6945      , WBS_ROLLUP_FLAG
6946      , PRG_ROLLUP_FLAG
6947      , CURR_RECORD_TYPE_ID
6948      , CURRENCY_CODE
6949      , RBS_ELEMENT_ID
6950      , RBS_VERSION_ID
6951      , PLAN_VERSION_ID
6952      , PLAN_TYPE_ID
6953      , RAW_COST
6954      , BRDN_COST
6955      , REVENUE
6956      , BILL_RAW_COST
6957      , BILL_BRDN_COST
6958      , BILL_LABOR_RAW_COST
6959      , BILL_LABOR_BRDN_COST
6960      , BILL_LABOR_HRS
6961      , EQUIPMENT_RAW_COST
6962      , EQUIPMENT_BRDN_COST
6963      , CAPITALIZABLE_RAW_COST
6964      , CAPITALIZABLE_BRDN_COST
6965      , LABOR_RAW_COST
6966      , LABOR_BRDN_COST
6967      , LABOR_HRS
6968      , LABOR_REVENUE
6969      , EQUIPMENT_HOURS
6970      , BILLABLE_EQUIPMENT_HOURS
6971      , SUP_INV_COMMITTED_COST
6972      , PO_COMMITTED_COST
6973      , PR_COMMITTED_COST
6974      , OTH_COMMITTED_COST
6975      , ACT_LABOR_HRS
6976      , ACT_EQUIP_HRS
6977      , ACT_LABOR_BRDN_COST
6978      , ACT_EQUIP_BRDN_COST
6979      , ACT_BRDN_COST
6980      , ACT_RAW_COST
6981      , ACT_REVENUE
6982      , ACT_LABOR_RAW_COST
6983      , ACT_EQUIP_RAW_COST
6984      , ETC_LABOR_HRS
6985      , ETC_EQUIP_HRS
6986      , ETC_LABOR_BRDN_COST
6987      , ETC_EQUIP_BRDN_COST
6988      , ETC_BRDN_COST
6989      , ETC_RAW_COST
6990      , ETC_LABOR_RAW_COST
6991      , ETC_EQUIP_RAW_COST
6992      , CUSTOM1
6993      , CUSTOM2
6994      , CUSTOM3
6995      , CUSTOM4
6996      , CUSTOM5
6997      , CUSTOM6
6998      , CUSTOM7
6999      , CUSTOM8
7000      , CUSTOM9
7001      , CUSTOM10
7002      , CUSTOM11
7003      , CUSTOM12
7004      , CUSTOM13
7005      , CUSTOM14
7006      , CUSTOM15
7007      , TIME_DANGLING_FLAG
7008      , RATE_DANGLING_FLAG
7009      , PRG_LEVEL
7010      , PLAN_TYPE_CODE    /* 4471527 */
7011    )
7012    SELECT
7013            g_worker_id worker_id
7014          , a.PROJECT_ID
7015          , a.PROJECT_ORG_ID
7016          , a.PROJECT_ORGANIZATION_ID
7017          , a.PROJECT_ELEMENT_ID
7018          , a.TIME_ID
7019          , 32 -- a.PERIOD_TYPE_ID
7020          , a.CALENDAR_TYPE
7021          , a.RBS_AGGR_LEVEL
7022          , a.WBS_ROLLUP_FLAG
7023          , a.PRG_ROLLUP_FLAG
7024          , a.CURR_RECORD_TYPE_ID
7025          , a.CURRENCY_CODE
7026          , a.RBS_ELEMENT_ID
7027          , a.RBS_VERSION_ID
7028          , a.PLAN_VERSION_ID
7029          , a.PLAN_TYPE_ID
7030 	 , SUM(ROUND (nvl(a.raw_cost,0)*a.factor/a.mau)*a.mau) raw_cost
7031 	 , SUM(ROUND (nvl(a.brdn_cost,0)*a.factor/a.mau)*a.mau) brdn_cost
7032 	 , SUM(ROUND (nvl(a.revenue,0)*a.factor/a.mau)*a.mau) revenue
7033 	 , SUM(ROUND (nvl(a.bill_raw_cost,0)*a.factor/a.mau)*a.mau) bill_raw_cost
7034 	 , SUM(ROUND (nvl(a.bill_brdn_cost,0)*a.factor/a.mau)*a.mau) bill_brdn_cost
7035 	 , SUM(ROUND (nvl(a.bill_labor_raw_cost,0)*a.factor/a.mau)*a.mau) bill_labor_raw_cost
7036 	 , SUM(ROUND (nvl(a.bill_labor_brdn_cost,0)*a.factor/a.mau)*a.mau) bill_labor_brdn_cost
7037 	 , SUM(ROUND (nvl(a.bill_labor_hrs,0)*a.factor/a.mau)*a.mau) bill_labor_hrs
7038 	 , SUM(ROUND (nvl(a.equipment_raw_cost,0)*a.factor/a.mau)*a.mau) equipment_raw_cost
7039 	 , SUM(ROUND (nvl(a.equipment_brdn_cost,0)*a.factor/a.mau)*a.mau) equipment_brdn_cost
7040 	 , SUM(ROUND (nvl(a.capitalizable_raw_cost,0)*a.factor/a.mau)*a.mau) capitalizable_raw_cost
7041 	 , SUM(ROUND (nvl(a.capitalizable_brdn_cost,0)*a.factor/a.mau)*a.mau) capitalizable_brdn_cost
7042 	 , SUM(ROUND (nvl(a.labor_raw_cost,0)*a.factor/a.mau)*a.mau) labor_raw_cost
7043 	 , SUM(ROUND (nvl(a.labor_brdn_cost,0)*a.factor/a.mau)*a.mau) labor_brdn_cost
7044 	 , SUM(ROUND (nvl(a.labor_hrs,0)*a.factor/a.mau)*a.mau) labor_hrs
7045 	 , SUM(ROUND (nvl(a.labor_revenue,0)*a.factor/a.mau)*a.mau) labor_revenue
7046 	 , SUM(ROUND (nvl(a.equipment_hours,0)*a.factor/a.mau)*a.mau) equipment_hours
7047 	 , SUM(ROUND (nvl(a.billable_equipment_hours,0)*a.factor/a.mau)*a.mau) billable_equipment_hours
7048 	 , SUM(ROUND (nvl(a.sup_inv_committed_cost,0)*a.factor/a.mau)*a.mau) sup_inv_committed_cost
7049 	 , SUM(ROUND (nvl(a.po_committed_cost,0)*a.factor/a.mau)*a.mau) po_committed_cost
7050 	 , SUM(ROUND (nvl(a.pr_committed_cost,0)*a.factor/a.mau)*a.mau) pr_committed_cost
7051 	 , SUM(ROUND (nvl(a.oth_committed_cost,0)*a.factor/a.mau)*a.mau) oth_committed_cost
7052 	 , SUM(ROUND (nvl(a.ACT_LABOR_HRS,0)*a.factor/a.mau)*a.mau) ACT_LABOR_HRS
7053 	 , SUM(ROUND (nvl(a.ACT_EQUIP_HRS,0)*a.factor/a.mau)*a.mau) ACT_EQUIP_HRS
7054 	 , SUM(ROUND (nvl(a.ACT_LABOR_BRDN_COST,0)*a.factor/a.mau)*a.mau) ACT_LABOR_BRDN_COST
7055 	 , SUM(ROUND (nvl(a.ACT_EQUIP_BRDN_COST,0)*a.factor/a.mau)*a.mau) ACT_EQUIP_BRDN_COST
7056 	 , SUM(ROUND (nvl(a.ACT_BRDN_COST,0)*a.factor/a.mau)*a.mau) ACT_BRDN_COST
7057 	 , SUM(ROUND (nvl(a.ACT_RAW_COST,0)*a.factor/a.mau)*a.mau) ACT_RAW_COST
7058 	 , SUM(ROUND (nvl(a.ACT_REVENUE,0)*a.factor/a.mau)*a.mau) ACT_REVENUE
7059 	 , SUM(ROUND (nvl(a.ACT_LABOR_RAW_COST,0)*a.factor/a.mau)*a.mau) ACT_LABOR_RAW_COST
7060 	 , SUM(ROUND (nvl(a.ACT_EQUIP_RAW_COST,0)*a.factor/a.mau)*a.mau) ACT_EQUIP_RAW_COST
7061 	 , SUM(ROUND (nvl(a.ETC_LABOR_HRS,0)*a.factor/a.mau)*a.mau) ETC_LABOR_HRS
7062 	 , SUM(ROUND (nvl(a.ETC_EQUIP_HRS,0)*a.factor/a.mau)*a.mau) ETC_EQUIP_HRS
7063 	 , SUM(ROUND (nvl(a.ETC_LABOR_BRDN_COST,0)*a.factor/a.mau)*a.mau) ETC_LABOR_BRDN_COST
7064 	 , SUM(ROUND (nvl(a.ETC_EQUIP_BRDN_COST,0)*a.factor/a.mau)*a.mau) ETC_EQUIP_BRDN_COST
7065 	 , SUM(ROUND (nvl(a.ETC_BRDN_COST,0)*a.factor/a.mau)*a.mau) ETC_BRDN_COST
7066 	 , SUM(ROUND (nvl(a.ETC_RAW_COST,0)*a.factor/a.mau)*a.mau) ETC_RAW_COST
7067 	 , SUM(ROUND (nvl(a.ETC_LABOR_RAW_COST,0)*a.factor/a.mau)*a.mau) ETC_LABOR_RAW_COST
7068 	 , SUM(ROUND (nvl(a.ETC_EQUIP_RAW_COST,0)*a.factor/a.mau)*a.mau) ETC_EQUIP_RAW_COST
7069 	 , SUM(ROUND (nvl(a.custom1,0)*a.factor/a.mau)*a.mau) custom1
7070 	 , SUM(ROUND (nvl(a.custom2,0)*a.factor/a.mau)*a.mau) custom2
7071 	 , SUM(ROUND (nvl(a.custom3,0)*a.factor/a.mau)*a.mau) custom3
7072 	 , SUM(ROUND (nvl(a.custom4,0)*a.factor/a.mau)*a.mau) custom4
7073 	 , SUM(ROUND (nvl(a.custom5,0)*a.factor/a.mau)*a.mau) custom5
7074 	 , SUM(ROUND (nvl(a.custom6,0)*a.factor/a.mau)*a.mau) custom6
7075 	 , SUM(ROUND (nvl(a.custom7,0)*a.factor/a.mau)*a.mau) custom7
7076 	 , SUM(ROUND (nvl(a.custom8,0)*a.factor/a.mau)*a.mau) custom8
7077 	 , SUM(ROUND (nvl(a.custom9,0)*a.factor/a.mau)*a.mau) custom9
7078 	 , SUM(ROUND (nvl(a.custom10,0)*a.factor/a.mau)*a.mau) custom10
7079 	 , SUM(ROUND (nvl(a.custom11,0)*a.factor/a.mau)*a.mau) custom11
7080 	 , SUM(ROUND (nvl(a.custom12,0)*a.factor/a.mau)*a.mau) custom12
7081 	 , SUM(ROUND (nvl(a.custom13,0)*a.factor/a.mau)*a.mau) custom13
7082 	 , SUM(ROUND (nvl(a.custom14,0)*a.factor/a.mau)*a.mau) custom14
7083 	 , SUM(ROUND (nvl(a.custom15,0)*a.factor/a.mau)*a.mau) custom15
7084          , a.TIME_DANGLING_FLAG
7085          , a.RATE_DANGLING_FLAG
7086          , g_default_prg_level prg_level
7087          , a.plan_type_code plan_type_code    /* 4471527   */
7088    FROM (
7089    SELECT /*+ NO_MERGE */
7090            fact.project_id  project_id
7091    	 , fact.project_ORG_ID project_ORG_ID
7092    	 , fact.project_ORGANIZATION_ID project_ORGANIZATION_ID
7093    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
7094    	 , entCal.ent_period_id TIME_ID
7095    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
7096    	 , 'E' CALENDAR_TYPE -- fact.CALENDAR_TYPE
7097          , fact.RBS_AGGR_LEVEL
7098          , fact.WBS_ROLLUP_FLAG
7099          , fact.PRG_ROLLUP_FLAG
7100    	 , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
7101    	 , fact.CURRENCY_CODE CURRENCY_CODE
7102    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
7103    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
7104    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
7105 	 , fact.PLAN_TYPE_ID  PLAN_TYPE_ID
7106 	 , fact.raw_cost
7107 	 , fact.brdn_cost
7108 	 , fact.revenue
7109 	 , fact.bill_raw_cost
7110 	 , fact.bill_brdn_cost
7111 	 , fact.bill_labor_raw_cost
7112 	 , fact.bill_labor_brdn_cost
7113 	 , fact.bill_labor_hrs
7114 	 , fact.equipment_raw_cost
7115 	 , fact.equipment_brdn_cost
7116 	 , fact.capitalizable_raw_cost
7117 	 , fact.capitalizable_brdn_cost
7118 	 , fact.labor_raw_cost
7119 	 , fact.labor_brdn_cost
7120 	 , fact.labor_hrs
7121 	 , fact.labor_revenue
7122 	 , fact.equipment_hours
7123 	 , fact.billable_equipment_hours
7124 	 , fact.sup_inv_committed_cost
7125 	 , fact.po_committed_cost
7126 	 , fact.pr_committed_cost
7127 	 , fact.oth_committed_cost
7128 	 , fact.ACT_LABOR_HRS
7129 	 , fact.ACT_EQUIP_HRS
7130 	 , fact.ACT_LABOR_BRDN_COST
7131 	 , fact.ACT_EQUIP_BRDN_COST
7132 	 , fact.ACT_BRDN_COST
7133 	 , fact.ACT_RAW_COST
7134 	 , fact.ACT_REVENUE
7135 	 , fact.ACT_LABOR_RAW_COST
7136 	 , fact.ACT_EQUIP_RAW_COST
7137 	 , fact.ETC_LABOR_HRS
7138 	 , fact.ETC_EQUIP_HRS
7139 	 , fact.ETC_LABOR_BRDN_COST
7140 	 , fact.ETC_EQUIP_BRDN_COST
7141 	 , fact.ETC_BRDN_COST
7142 	 , fact.ETC_RAW_COST
7143 	 , fact.ETC_LABOR_RAW_COST
7144 	 , fact.ETC_EQUIP_RAW_COST
7145 	 , fact.custom1
7146 	 , fact.custom2
7147 	 , fact.custom3
7148 	 , fact.custom4
7149 	 , fact.custom5
7150 	 , fact.custom6
7151 	 , fact.custom7
7152 	 , fact.custom8
7153 	 , fact.custom9
7154 	 , fact.custom10
7155 	 , fact.custom11
7156 	 , fact.custom12
7157 	 , fact.custom13
7158 	 , fact.custom14
7159 	 , fact.custom15
7160 	 , fact.time_dangling_flag time_dangling_flag
7161 	 , fact.rate_dangling_flag rate_dangling_flag
7162          , cur.mau mau
7163          , (LEAST(fact.end_date,entCal.end_date) - Greatest(fact.start_date,entCal.start_date)+1)
7164                               / (fact.end_date - fact.start_date+1) factor
7165          , fact.plan_type_code   plan_type_code     /* 4471527 */
7166    FROM   pji_fp_aggr_pjp1_t fact
7167         , pji_time_ent_period_v  entCal
7168         , pji_fm_extr_plnver3_t  ver
7169         , (SELECT currency_code,
7170                    decode(nvl(MINIMUM_ACCOUNTABLE_UNIT, power(10, (-1 * PRECISION))),
7171                       null, 0.01,
7172                          0, 1,
7173                          nvl(MINIMUM_ACCOUNTABLE_UNIT, power(10, (-1 * PRECISION)))) mau
7174               FROM FND_CURRENCIES) cur
7175    WHERE  1=1
7176       AND fact.CALENDAR_TYPE = 'A'
7177       AND fact.worker_id = g_worker_id
7178       AND fact.start_date IS NOT NULL
7179       AND fact.end_date IS NOT NULL
7180       AND fact.time_dangling_flag IS NULL
7181       AND fact.rate_dangling_flag IS NULL
7182       AND fact.line_type = 'NTP'
7183       AND fact.period_type_id = 2048
7184       AND fact.plan_version_id = ver.plan_version_id
7185       AND fact.plan_type_code = ver.plan_type_code    /* 4471527 */
7186       AND ver.wp_flag = 'N'
7187       AND ver.baselined_flag = 'Y'
7188       AND ver.time_phased_type_code = 'N'
7189       -- AND ( ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
7190       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
7191       AND cur.currency_code = fact.currency_code
7192       AND ( fact.start_date <= entCal.end_date AND fact.end_date >= entCal.start_date )
7193 	  ) a
7194    WHERE a.factor>0
7195   GROUP BY
7196        a.PROJECT_ID
7197      , a.PROJECT_ORG_ID
7198      , a.PROJECT_ORGANIZATION_ID
7199      , a.PROJECT_ELEMENT_ID
7200      , a.TIME_ID
7201      , a.PERIOD_TYPE_ID
7202      , a.CALENDAR_TYPE
7203      , a.RBS_AGGR_LEVEL
7204      , a.WBS_ROLLUP_FLAG
7205      , a.PRG_ROLLUP_FLAG
7206      , a.CURR_RECORD_TYPE_ID
7207      , a.CURRENCY_CODE
7208      , a.RBS_ELEMENT_ID
7209      , a.RBS_VERSION_ID
7210      , a.PLAN_VERSION_ID
7211      , a.PLAN_TYPE_ID
7212      , a.PLAN_TYPE_CODE   /* 4471527   */
7213      , a.TIME_DANGLING_FLAG
7214      , a.RATE_DANGLING_FLAG;
7215 
7216 EXCEPTION
7217   WHEN OTHERS THEN
7218     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
7219                              p_procedure_name => ' PRORATE_TO_ENT_N_PJP1_D ');
7220     RAISE;
7221 END;
7222 
7223 
7224 PROCEDURE PRORATE_TO_ENT_PG_PJP1_SE( p_prorating_format varchar2) IS
7225 BEGIN
7226 
7227     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
7228 
7229 /* Commented for bug 4005006
7230     INSERT INTO pji_fp_aggr_pjp1_t   -- PA, GL calendar entries.
7231     (
7232        WORKER_ID
7233      , PROJECT_ID
7234      , PROJECT_ORG_ID
7235      , PROJECT_ORGANIZATION_ID
7236      -- , PARTITION_ID
7237      , PROJECT_ELEMENT_ID
7238      , TIME_ID
7239      , PERIOD_TYPE_ID
7240      , CALENDAR_TYPE
7241      , RBS_AGGR_LEVEL
7242      , WBS_ROLLUP_FLAG
7243      , PRG_ROLLUP_FLAG
7244      , CURR_RECORD_TYPE_ID
7245      , CURRENCY_CODE
7246      , RBS_ELEMENT_ID
7247      , RBS_VERSION_ID
7248      , PLAN_VERSION_ID
7249      , PLAN_TYPE_ID
7250      , RAW_COST
7251      , BRDN_COST
7252      , REVENUE
7253      , BILL_RAW_COST
7254      , BILL_BRDN_COST
7255      , BILL_LABOR_RAW_COST
7256      , BILL_LABOR_BRDN_COST
7257      , BILL_LABOR_HRS
7258      , EQUIPMENT_RAW_COST
7259      , EQUIPMENT_BRDN_COST
7260      , CAPITALIZABLE_RAW_COST
7261      , CAPITALIZABLE_BRDN_COST
7262      , LABOR_RAW_COST
7263      , LABOR_BRDN_COST
7264      , LABOR_HRS
7265      , LABOR_REVENUE
7266      , EQUIPMENT_HOURS
7267      , BILLABLE_EQUIPMENT_HOURS
7268      , SUP_INV_COMMITTED_COST
7269      , PO_COMMITTED_COST
7270      , PR_COMMITTED_COST
7271      , OTH_COMMITTED_COST
7272        , ACT_LABOR_HRS
7273 	   , ACT_EQUIP_HRS
7274 	   , ACT_LABOR_BRDN_COST
7275 	   , ACT_EQUIP_BRDN_COST
7276 	   , ACT_BRDN_COST
7277 	   , ACT_RAW_COST
7278 	   , ACT_REVENUE
7279          , ACT_LABOR_RAW_COST
7280          , ACT_EQUIP_RAW_COST
7281 	   , ETC_LABOR_HRS
7282 	   , ETC_EQUIP_HRS
7283 	   , ETC_LABOR_BRDN_COST
7284 	   , ETC_EQUIP_BRDN_COST
7285 	   , ETC_BRDN_COST
7286          , ETC_RAW_COST
7287          , ETC_LABOR_RAW_COST
7288          , ETC_EQUIP_RAW_COST
7289      , CUSTOM1
7290      , CUSTOM2
7291      , CUSTOM3
7292      , CUSTOM4
7293      , CUSTOM5
7294      , CUSTOM6
7295      , CUSTOM7
7296      , CUSTOM8
7297      , CUSTOM9
7298      , CUSTOM10
7299      , CUSTOM11
7300      , CUSTOM12
7301      , CUSTOM13
7302      , CUSTOM14
7303      , CUSTOM15
7304      , LINE_TYPE
7305      , TIME_DANGLING_FLAG
7306      , RATE_DANGLING_FLAG
7307      , PRG_LEVEL
7308    )
7309    SELECT
7310          g_worker_id WORKER_ID
7311        , fact.project_id  project_id
7312 	 , fact.PROJECT_ORG_ID project_org_id
7313 	 , fact.PROJECT_ORGANIZATION_ID project_organization_id
7314      -- , fact.PARTITION_ID PARTITION_ID
7315    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
7316    	 , pa_cal.ent_period_id TIME_ID
7317    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
7318    	 , 'E' CALENDAR_TYPE -- fact.CALENDAR_TYPE
7319      , fact.RBS_AGGR_LEVEL RBS_AGGR_LEVEL
7320      , fact.WBS_ROLLUP_FLAG WBS_ROLLUP_FLAG
7321      , fact.PRG_ROLLUP_FLAG PRG_ROLLUP_FLAG
7322      , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
7323    	 , fact.CURRENCY_CODE CURRENCY_CODE
7324    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
7325    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
7326    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
7327    	 , fact.PLAN_TYPE_ID PLAN_TYPE_ID
7328    	 , MAX(fact.RAW_COST)	 raw_cost
7329    	 , MAX(fact.BRDN_COST) BRDN_COST
7330    	 , MAX(fact.REVENUE) REVENUE
7331    	 , MAX(fact.BILL_RAW_COST) BILL_RAW_COST
7332    	 , MAX(fact.BILL_BRDN_COST) BILL_BRDN_COST
7333    	 , MAX(fact.BILL_LABOR_RAW_COST) BILL_LABOR_RAW_COST
7334    	 , MAX(fact.BILL_LABOR_BRDN_COST) BILL_LABOR_BRDN_COST
7335    	 , MAX(fact.BILL_LABOR_HRS) BILL_LABOR_HRS
7336    	 , MAX(fact.EQUIPMENT_RAW_COST) EQUIPMENT_RAW_COST
7337    	 , MAX(fact.EQUIPMENT_BRDN_COST) EQUIPMENT_BRDN_COST
7338    	 , MAX(fact.CAPITALIZABLE_RAW_COST) CAPITALIZABLE_RAW_COST
7339    	 , MAX(fact.CAPITALIZABLE_BRDN_COST) CAPITALIZABLE_BRDN_COST
7340    	 , MAX(fact.LABOR_RAW_COST) LABOR_RAW_COST
7341    	 , MAX(fact.LABOR_BRDN_COST) LABOR_BRDN_COST
7342    	 , MAX(fact.LABOR_HRS) LABOR_HRS
7343    	 , MAX(fact.LABOR_REVENUE) LABOR_REVENUE
7344    	 , MAX(fact.EQUIPMENT_HOURS) EQUIPMENT_HOURS
7345    	 , MAX(fact.BILLABLE_EQUIPMENT_HOURS) BILLABLE_EQUIPMENT_HOURS
7346    	 , MAX(fact.SUP_INV_COMMITTED_COST) SUP_INV_COMMITTED_COST
7347    	 , MAX(fact.PO_COMMITTED_COST) PO_COMMITTED_COST
7348    	 , MAX(fact.PR_COMMITTED_COST) PR_COMMITTED_COST
7349    	 , MAX(fact.OTH_COMMITTED_COST) OTH_COMMITTED_COST
7350        , MAX(fact.ACT_LABOR_HRS )
7351 	 , MAX(fact.ACT_EQUIP_HRS )
7352 	 , MAX(fact.ACT_LABOR_BRDN_COST )
7353 	 , MAX(fact.ACT_EQUIP_BRDN_COST )
7354 	 , MAX(fact.ACT_BRDN_COST )
7355 	 , MAX(fact.ACT_RAW_COST )
7356 	 , MAX(fact.ACT_REVENUE )
7357        , MAX(fact.ACT_LABOR_RAW_COST)
7358        , MAX(fact.ACT_EQUIP_RAW_COST)
7359 	 , MAX(fact.ETC_LABOR_HRS )
7360 	 , MAX(fact.ETC_EQUIP_HRS )
7361 	 , MAX(fact.ETC_LABOR_BRDN_COST )
7362 	 , MAX(fact.ETC_EQUIP_BRDN_COST )
7363 	 , MAX(fact.ETC_BRDN_COST )
7364        , MAX(fact.ETC_RAW_COST )
7365        , MAX(fact.ETC_LABOR_RAW_COST)
7366        , MAX(fact.ETC_EQUIP_RAW_COST)
7367    	 , MAX(fact.CUSTOM1) CUSTOM1
7368    	 , MAX(fact.CUSTOM2) CUSTOM2
7369    	 , MAX(fact.CUSTOM3) CUSTOM3
7370    	 , MAX(fact.CUSTOM4) CUSTOM4
7371    	 , MAX(fact.CUSTOM5) CUSTOM5
7372    	 , MAX(fact.CUSTOM6) CUSTOM6
7373    	 , MAX(fact.CUSTOM7) CUSTOM7
7374    	 , MAX(fact.CUSTOM8) CUSTOM8
7375    	 , MAX(fact.CUSTOM9) CUSTOM9
7376    	 , MAX(fact.CUSTOM10) CUSTOM10
7377    	 , MAX(fact.CUSTOM11) CUSTOM11
7378    	 , MAX(fact.CUSTOM12) CUSTOM12
7379    	 , MAX(fact.CUSTOM13) CUSTOM13
7380    	 , MAX(fact.CUSTOM14) CUSTOM14
7381    	 , MAX(fact.CUSTOM15) CUSTOM15
7382    	 -- , DECODE ('E', 'E', MAX(pa_cal.start_date), 'S', MIN(pa_cal.start_date)) start_date
7383    	 -- , DECODE ('E', 'E', MAX(pa_cal.end_date), 'S', MIN(pa_cal.end_date))	 end_date
7384        , 'CF'   line_type
7385 	 , fact.TIME_DANGLING_FLAG  TIME_DANGLING_FLAG
7386 	 , fact.RATE_DANGLING_FLAG  RATE_DANGLING_FLAG
7387        , g_default_prg_level prg_level
7388    FROM   pji_fp_aggr_pjp1_t fact
7389         , pji_time_cal_period  non_pa_cal
7390         -- , pji_org_extr_info  orginfo
7391    	  , pji_time_ent_period  pa_cal
7392         , pji_fm_extr_plnver3_t  ver
7393    WHERE  fact.CALENDAR_TYPE IN ('P', 'G')
7394       AND fact.worker_id = g_worker_id
7395       AND non_pa_cal.cal_period_id = fact.time_id
7396       AND fact.line_type like 'OF%'
7397 	AND fact.TIME_DANGLING_FLAG  IS NULL
7398 	AND fact.RATE_DANGLING_FLAG  IS NULL
7399       AND ( non_pa_cal.start_date <= pa_cal.end_date AND non_pa_cal.end_date >= pa_cal.start_date )
7400       AND fact.period_type_id = 32
7401       AND fact.plan_version_id = ver.plan_version_id
7402       AND ver.wp_flag = 'N'
7403       AND ver.baselined_flag = 'Y'
7404 	-- AND (ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
7405       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
7406    GROUP BY
7407        fact.project_id
7408 	 , fact.PROJECT_ORG_ID
7409 	 , fact.PROJECT_ORGANIZATION_ID
7410      -- , fact.PARTITION_ID
7411    	 , fact.PROJECT_ELEMENT_ID
7412    	 , pa_cal.ent_period_id
7413    	 , fact.PERIOD_TYPE_ID
7414    	 , fact.CALENDAR_TYPE
7415      , fact.RBS_AGGR_LEVEL
7416      , fact.WBS_ROLLUP_FLAG
7417      , fact.PRG_ROLLUP_FLAG
7418      , fact.CURR_RECORD_TYPE_ID
7419    	 , fact.CURRENCY_CODE
7420    	 , fact.RBS_ELEMENT_ID
7421    	 , fact.RBS_VERSION_ID
7422    	 , fact.PLAN_VERSION_ID
7423    	 , fact.PLAN_TYPE_ID
7424 	 , fact.TIME_DANGLING_FLAG
7425 	 , fact.RATE_DANGLING_FLAG;
7426 End of bug 4005006*/
7427 
7428     INSERT INTO pji_fp_aggr_pjp1_t   -- PA, GL calendar entries.
7429     (
7430        WORKER_ID
7431      , PROJECT_ID
7432      , PROJECT_ORG_ID
7433      , PROJECT_ORGANIZATION_ID
7434      , PROJECT_ELEMENT_ID
7435      , TIME_ID
7436      , PERIOD_TYPE_ID
7437      , CALENDAR_TYPE
7438      , RBS_AGGR_LEVEL
7439      , WBS_ROLLUP_FLAG
7440      , PRG_ROLLUP_FLAG
7441      , CURR_RECORD_TYPE_ID
7442      , CURRENCY_CODE
7443      , RBS_ELEMENT_ID
7444      , RBS_VERSION_ID
7445      , PLAN_VERSION_ID
7446      , PLAN_TYPE_ID
7447      , RAW_COST
7448      , BRDN_COST
7449      , REVENUE
7450      , BILL_RAW_COST
7451      , BILL_BRDN_COST
7452      , BILL_LABOR_RAW_COST
7453      , BILL_LABOR_BRDN_COST
7454      , BILL_LABOR_HRS
7455      , EQUIPMENT_RAW_COST
7456      , EQUIPMENT_BRDN_COST
7457      , CAPITALIZABLE_RAW_COST
7458      , CAPITALIZABLE_BRDN_COST
7459      , LABOR_RAW_COST
7460      , LABOR_BRDN_COST
7461      , LABOR_HRS
7462      , LABOR_REVENUE
7463      , EQUIPMENT_HOURS
7464      , BILLABLE_EQUIPMENT_HOURS
7465      , SUP_INV_COMMITTED_COST
7466      , PO_COMMITTED_COST
7467      , PR_COMMITTED_COST
7468      , OTH_COMMITTED_COST
7469      , ACT_LABOR_HRS
7470      , ACT_EQUIP_HRS
7471      , ACT_LABOR_BRDN_COST
7472      , ACT_EQUIP_BRDN_COST
7473      , ACT_BRDN_COST
7474      , ACT_RAW_COST
7475      , ACT_REVENUE
7476      , ACT_LABOR_RAW_COST
7477      , ACT_EQUIP_RAW_COST
7478      , ETC_LABOR_HRS
7479      , ETC_EQUIP_HRS
7480      , ETC_LABOR_BRDN_COST
7481      , ETC_EQUIP_BRDN_COST
7482      , ETC_BRDN_COST
7483      , ETC_RAW_COST
7484      , ETC_LABOR_RAW_COST
7485      , ETC_EQUIP_RAW_COST
7486      , CUSTOM1
7487      , CUSTOM2
7488      , CUSTOM3
7489      , CUSTOM4
7490      , CUSTOM5
7491      , CUSTOM6
7492      , CUSTOM7
7493      , CUSTOM8
7494      , CUSTOM9
7495      , CUSTOM10
7496      , CUSTOM11
7497      , CUSTOM12
7498      , CUSTOM13
7499      , CUSTOM14
7500      , CUSTOM15
7501      , TIME_DANGLING_FLAG
7502      , RATE_DANGLING_FLAG
7503      , PRG_LEVEL
7504      , PLAN_TYPE_CODE    /* 4471527 */
7505    )
7506    SELECT
7507            g_worker_id WORKER_ID
7508          , fact.project_id  project_id
7509 	 , fact.PROJECT_ORG_ID project_org_id
7510 	 , fact.PROJECT_ORGANIZATION_ID project_organization_id
7511    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
7512    	 , pa_cal.ent_period_id TIME_ID
7513    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
7514    	 , 'E' CALENDAR_TYPE -- fact.CALENDAR_TYPE
7515          , fact.RBS_AGGR_LEVEL RBS_AGGR_LEVEL
7516          , fact.WBS_ROLLUP_FLAG WBS_ROLLUP_FLAG
7517          , fact.PRG_ROLLUP_FLAG PRG_ROLLUP_FLAG
7518          , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
7519    	 , fact.CURRENCY_CODE CURRENCY_CODE
7520    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
7521    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
7522    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
7523    	 , fact.PLAN_TYPE_ID PLAN_TYPE_ID
7524    	 , SUM(fact.RAW_COST)	 raw_cost
7525    	 , SUM(fact.BRDN_COST) BRDN_COST
7526    	 , SUM(fact.REVENUE) REVENUE
7527    	 , SUM(fact.BILL_RAW_COST) BILL_RAW_COST
7528    	 , SUM(fact.BILL_BRDN_COST) BILL_BRDN_COST
7529    	 , SUM(fact.BILL_LABOR_RAW_COST) BILL_LABOR_RAW_COST
7530    	 , SUM(fact.BILL_LABOR_BRDN_COST) BILL_LABOR_BRDN_COST
7531    	 , SUM(fact.BILL_LABOR_HRS) BILL_LABOR_HRS
7532    	 , SUM(fact.EQUIPMENT_RAW_COST) EQUIPMENT_RAW_COST
7533    	 , SUM(fact.EQUIPMENT_BRDN_COST) EQUIPMENT_BRDN_COST
7534    	 , SUM(fact.CAPITALIZABLE_RAW_COST) CAPITALIZABLE_RAW_COST
7535    	 , SUM(fact.CAPITALIZABLE_BRDN_COST) CAPITALIZABLE_BRDN_COST
7536    	 , SUM(fact.LABOR_RAW_COST) LABOR_RAW_COST
7537    	 , SUM(fact.LABOR_BRDN_COST) LABOR_BRDN_COST
7538    	 , SUM(fact.LABOR_HRS) LABOR_HRS
7539    	 , SUM(fact.LABOR_REVENUE) LABOR_REVENUE
7540    	 , SUM(fact.EQUIPMENT_HOURS) EQUIPMENT_HOURS
7541    	 , SUM(fact.BILLABLE_EQUIPMENT_HOURS) BILLABLE_EQUIPMENT_HOURS
7542    	 , SUM(fact.SUP_INV_COMMITTED_COST) SUP_INV_COMMITTED_COST
7543    	 , SUM(fact.PO_COMMITTED_COST) PO_COMMITTED_COST
7544    	 , SUM(fact.PR_COMMITTED_COST) PR_COMMITTED_COST
7545    	 , SUM(fact.OTH_COMMITTED_COST) OTH_COMMITTED_COST
7546          , SUM(fact.ACT_LABOR_HRS )
7547 	 , SUM(fact.ACT_EQUIP_HRS )
7548 	 , SUM(fact.ACT_LABOR_BRDN_COST )
7549 	 , SUM(fact.ACT_EQUIP_BRDN_COST )
7550 	 , SUM(fact.ACT_BRDN_COST )
7551 	 , SUM(fact.ACT_RAW_COST )
7552 	 , SUM(fact.ACT_REVENUE )
7553          , SUM(fact.ACT_LABOR_RAW_COST)
7554          , SUM(fact.ACT_EQUIP_RAW_COST)
7555 	 , SUM(fact.ETC_LABOR_HRS )
7556 	 , SUM(fact.ETC_EQUIP_HRS )
7557 	 , SUM(fact.ETC_LABOR_BRDN_COST )
7558 	 , SUM(fact.ETC_EQUIP_BRDN_COST )
7559 	 , SUM(fact.ETC_BRDN_COST )
7560          , SUM(fact.ETC_RAW_COST )
7561          , SUM(fact.ETC_LABOR_RAW_COST)
7562          , SUM(fact.ETC_EQUIP_RAW_COST)
7563    	 , SUM(fact.CUSTOM1) CUSTOM1
7564    	 , SUM(fact.CUSTOM2) CUSTOM2
7565    	 , SUM(fact.CUSTOM3) CUSTOM3
7566    	 , SUM(fact.CUSTOM4) CUSTOM4
7567    	 , SUM(fact.CUSTOM5) CUSTOM5
7568    	 , SUM(fact.CUSTOM6) CUSTOM6
7569    	 , SUM(fact.CUSTOM7) CUSTOM7
7570    	 , SUM(fact.CUSTOM8) CUSTOM8
7571    	 , SUM(fact.CUSTOM9) CUSTOM9
7572    	 , SUM(fact.CUSTOM10) CUSTOM10
7573    	 , SUM(fact.CUSTOM11) CUSTOM11
7574    	 , SUM(fact.CUSTOM12) CUSTOM12
7575    	 , SUM(fact.CUSTOM13) CUSTOM13
7576    	 , SUM(fact.CUSTOM14) CUSTOM14
7577    	 , SUM(fact.CUSTOM15) CUSTOM15
7578 	 , fact.TIME_DANGLING_FLAG  TIME_DANGLING_FLAG
7579 	 , fact.RATE_DANGLING_FLAG  RATE_DANGLING_FLAG
7580          , g_default_prg_level prg_level
7581          , fact.plan_type_code plan_type_code    /* 4471527 */
7582    FROM   pji_fp_aggr_pjp1_t fact
7583         , pji_time_cal_period_v  non_pa_cal
7584    	, pji_time_ent_period_v  pa_cal
7585         , pji_fm_extr_plnver3_t  ver
7586    WHERE  fact.CALENDAR_TYPE IN ('P', 'G')
7587       AND fact.worker_id = g_worker_id
7588       AND non_pa_cal.cal_period_id = fact.time_id
7589       AND fact.line_type like 'OF%'
7590       AND fact.TIME_DANGLING_FLAG  IS NULL
7591       AND fact.RATE_DANGLING_FLAG  IS NULL
7592       AND ( non_pa_cal.start_date <= pa_cal.end_date AND non_pa_cal.end_date >= pa_cal.start_date )
7593       AND fact.period_type_id = 32
7594       AND fact.plan_version_id = ver.plan_version_id
7595       AND fact.plan_type_code = ver.plan_type_code   /* 4471527 */
7596       AND ver.wp_flag = 'N'
7597       AND ver.baselined_flag = 'Y'
7598       -- AND (ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
7599       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
7600       AND DECODE(p_prorating_format,'S',
7601              DECODE(SIGN(non_pa_cal.start_Date-pa_cal.start_date),-1,0,1),
7602              DECODE(SIGN(non_pa_cal.end_Date - pa_cal.end_date), 1,0,1))=1
7603    GROUP BY
7604            fact.project_id
7605 	 , fact.PROJECT_ORG_ID
7606 	 , fact.PROJECT_ORGANIZATION_ID
7607    	 , fact.PROJECT_ELEMENT_ID
7608    	 , pa_cal.ent_period_id
7609    	 , fact.PERIOD_TYPE_ID
7610    	 , fact.CALENDAR_TYPE
7611          , fact.RBS_AGGR_LEVEL
7612          , fact.WBS_ROLLUP_FLAG
7613          , fact.PRG_ROLLUP_FLAG
7614          , fact.CURR_RECORD_TYPE_ID
7615    	 , fact.CURRENCY_CODE
7616    	 , fact.RBS_ELEMENT_ID
7617    	 , fact.RBS_VERSION_ID
7618    	 , fact.PLAN_VERSION_ID
7619    	 , fact.PLAN_TYPE_ID
7620               , fact.PLAN_TYPE_CODE     /*4471527 */
7621 	 , fact.TIME_DANGLING_FLAG
7622 	 , fact.RATE_DANGLING_FLAG;
7623 
7624 EXCEPTION
7625   WHEN OTHERS THEN
7626     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
7627                              p_procedure_name => 'PRORATE_TO_ENT_PG_PJP1_SE');
7628     RAISE;
7629 END;
7630 
7631 
7632 PROCEDURE PRORATE_TO_ENT_PG_FPRL_SE IS
7633 BEGIN
7634 
7635     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
7636 
7637     INSERT INTO pji_fp_aggr_pjp1_t   -- PA, GL calendar entries.
7638     (
7639        WORKER_ID
7640      , PROJECT_ID
7641      , PROJECT_ORG_ID
7642      , PROJECT_ORGANIZATION_ID
7643      -- , PARTITION_ID
7644      , PROJECT_ELEMENT_ID
7645      , TIME_ID
7646      , PERIOD_TYPE_ID
7647      , CALENDAR_TYPE
7648      , RBS_AGGR_LEVEL
7649      , WBS_ROLLUP_FLAG
7650      , PRG_ROLLUP_FLAG
7651      , CURR_RECORD_TYPE_ID
7652      , CURRENCY_CODE
7653      , RBS_ELEMENT_ID
7654      , RBS_VERSION_ID
7655      , PLAN_VERSION_ID
7656      , PLAN_TYPE_ID
7657      , RAW_COST
7658      , BRDN_COST
7659      , REVENUE
7660      , BILL_RAW_COST
7661      , BILL_BRDN_COST
7662      , BILL_LABOR_RAW_COST
7663      , BILL_LABOR_BRDN_COST
7664      , BILL_LABOR_HRS
7665      , EQUIPMENT_RAW_COST
7666      , EQUIPMENT_BRDN_COST
7667      , CAPITALIZABLE_RAW_COST
7668      , CAPITALIZABLE_BRDN_COST
7669      , LABOR_RAW_COST
7670      , LABOR_BRDN_COST
7671      , LABOR_HRS
7672      , LABOR_REVENUE
7673      , EQUIPMENT_HOURS
7674      , BILLABLE_EQUIPMENT_HOURS
7675      , SUP_INV_COMMITTED_COST
7676      , PO_COMMITTED_COST
7677      , PR_COMMITTED_COST
7678      , OTH_COMMITTED_COST
7679        , ACT_LABOR_HRS
7680 	   , ACT_EQUIP_HRS
7681 	   , ACT_LABOR_BRDN_COST
7682 	   , ACT_EQUIP_BRDN_COST
7683 	   , ACT_BRDN_COST
7684 	   , ACT_RAW_COST
7685 	   , ACT_REVENUE
7686          , ACT_LABOR_RAW_COST
7687          , ACT_EQUIP_RAW_COST
7688 	   , ETC_LABOR_HRS
7689 	   , ETC_EQUIP_HRS
7690 	   , ETC_LABOR_BRDN_COST
7691 	   , ETC_EQUIP_BRDN_COST
7692 	   , ETC_BRDN_COST
7693          , ETC_RAW_COST
7694          , ETC_LABOR_RAW_COST
7695          , ETC_EQUIP_RAW_COST
7696      , CUSTOM1
7697      , CUSTOM2
7698      , CUSTOM3
7699      , CUSTOM4
7700      , CUSTOM5
7701      , CUSTOM6
7702      , CUSTOM7
7703      , CUSTOM8
7704      , CUSTOM9
7705      , CUSTOM10
7706      , CUSTOM11
7707      , CUSTOM12
7708      , CUSTOM13
7709      , CUSTOM14
7710      , CUSTOM15
7711      , PRG_LEVEL
7712      , PLAN_TYPE_CODE    /* 4471527 */
7713    )
7714    SELECT
7715          g_worker_id WORKER_ID
7716        , fact.project_id  project_id
7717 	 , fact.PROJECT_ORG_ID project_org_id
7718 	 , fact.PROJECT_ORGANIZATION_ID project_organization_id
7719      -- , fact.PARTITION_ID PARTITION_ID
7720    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
7721    	 , pa_cal.ent_period_id TIME_ID
7722    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
7723    	 , 'E' CALENDAR_TYPE -- fact.CALENDAR_TYPE
7724      , fact.RBS_AGGR_LEVEL RBS_AGGR_LEVEL
7725      , fact.WBS_ROLLUP_FLAG WBS_ROLLUP_FLAG
7726      , fact.PRG_ROLLUP_FLAG PRG_ROLLUP_FLAG
7727      , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
7728    	 , fact.CURRENCY_CODE CURRENCY_CODE
7729    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
7730    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
7731    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
7732    	 , fact.PLAN_TYPE_ID PLAN_TYPE_ID
7733    	 , MAX(fact.RAW_COST)	 raw_cost
7734    	 , MAX(fact.BRDN_COST) BRDN_COST
7735    	 , MAX(fact.REVENUE) REVENUE
7736    	 , MAX(fact.BILL_RAW_COST) BILL_RAW_COST
7737    	 , MAX(fact.BILL_BRDN_COST) BILL_BRDN_COST
7738    	 , MAX(fact.BILL_LABOR_RAW_COST) BILL_LABOR_RAW_COST
7739    	 , MAX(fact.BILL_LABOR_BRDN_COST) BILL_LABOR_BRDN_COST
7740    	 , MAX(fact.BILL_LABOR_HRS) BILL_LABOR_HRS
7741    	 , MAX(fact.EQUIPMENT_RAW_COST) EQUIPMENT_RAW_COST
7742    	 , MAX(fact.EQUIPMENT_BRDN_COST) EQUIPMENT_BRDN_COST
7743    	 , MAX(fact.CAPITALIZABLE_RAW_COST) CAPITALIZABLE_RAW_COST
7744    	 , MAX(fact.CAPITALIZABLE_BRDN_COST) CAPITALIZABLE_BRDN_COST
7745    	 , MAX(fact.LABOR_RAW_COST) LABOR_RAW_COST
7746    	 , MAX(fact.LABOR_BRDN_COST) LABOR_BRDN_COST
7747    	 , MAX(fact.LABOR_HRS) LABOR_HRS
7748    	 , MAX(fact.LABOR_REVENUE) LABOR_REVENUE
7749    	 , MAX(fact.EQUIPMENT_HOURS) EQUIPMENT_HOURS
7750    	 , MAX(fact.BILLABLE_EQUIPMENT_HOURS) BILLABLE_EQUIPMENT_HOURS
7751    	 , MAX(fact.SUP_INV_COMMITTED_COST) SUP_INV_COMMITTED_COST
7752    	 , MAX(fact.PO_COMMITTED_COST) PO_COMMITTED_COST
7753    	 , MAX(fact.PR_COMMITTED_COST) PR_COMMITTED_COST
7754    	 , MAX(fact.OTH_COMMITTED_COST) OTH_COMMITTED_COST
7755        , MAX(fact.ACT_LABOR_HRS )
7756 	 , MAX(fact.ACT_EQUIP_HRS )
7757 	 , MAX(fact.ACT_LABOR_BRDN_COST )
7758 	 , MAX(fact.ACT_EQUIP_BRDN_COST )
7759 	 , MAX(fact.ACT_BRDN_COST )
7760 	 , MAX(fact.ACT_RAW_COST )
7761 	 , MAX(fact.ACT_REVENUE )
7762        , MAX(fact.ACT_LABOR_RAW_COST)
7763        , MAX(fact.ACT_EQUIP_RAW_COST)
7764 	 , MAX(fact.ETC_LABOR_HRS )
7765 	 , MAX(fact.ETC_EQUIP_HRS )
7766 	 , MAX(fact.ETC_LABOR_BRDN_COST )
7767 	 , MAX(fact.ETC_EQUIP_BRDN_COST )
7768 	 , MAX(fact.ETC_BRDN_COST )
7769        , MAX(fact.ETC_RAW_COST )
7770        , MAX(fact.ETC_LABOR_RAW_COST)
7771        , MAX(fact.ETC_EQUIP_RAW_COST)
7772    	 , MAX(fact.CUSTOM1) CUSTOM1
7773    	 , MAX(fact.CUSTOM2) CUSTOM2
7774    	 , MAX(fact.CUSTOM3) CUSTOM3
7775    	 , MAX(fact.CUSTOM4) CUSTOM4
7776    	 , MAX(fact.CUSTOM5) CUSTOM5
7777    	 , MAX(fact.CUSTOM6) CUSTOM6
7778    	 , MAX(fact.CUSTOM7) CUSTOM7
7779    	 , MAX(fact.CUSTOM8) CUSTOM8
7780    	 , MAX(fact.CUSTOM9) CUSTOM9
7781    	 , MAX(fact.CUSTOM10) CUSTOM10
7782    	 , MAX(fact.CUSTOM11) CUSTOM11
7783    	 , MAX(fact.CUSTOM12) CUSTOM12
7784    	 , MAX(fact.CUSTOM13) CUSTOM13
7785    	 , MAX(fact.CUSTOM14) CUSTOM14
7786    	 , MAX(fact.CUSTOM15) CUSTOM15
7787    	 -- , DECODE ('E', 'E', MAX(pa_cal.start_date), 'S', MIN(pa_cal.start_date)) start_date
7788    	 -- , DECODE ('E', 'E', MAX(pa_cal.end_date), 'S', MIN(pa_cal.end_date))	 end_date
7789        , g_default_prg_level prg_level
7790        , fact.plan_type_code   plan_type_code    /* 4471527 */
7791    FROM   pji_fp_xbs_accum_f  fact
7792        , PJI_FM_EXTR_PLNVER3_T ver
7793         , pji_time_cal_period  non_pa_cal
7794         -- , pji_org_extr_info  orginfo
7795    	  , pji_time_ent_period  pa_cal
7796    WHERE  non_pa_cal.cal_period_id = fact.time_id
7797       AND fact.period_type_id = 32
7798       AND ver.project_id = fact.project_id
7799       AND ver.plan_version_id = fact.plan_version_id
7800       AND ver.plan_type_code = fact.plan_type_code     /* 4471527 */
7801       AND ( non_pa_cal.start_date <= pa_cal.end_date AND non_pa_cal.end_date >= pa_cal.start_date )
7802       AND fact.period_type_id = 32
7803       AND ver.wp_flag = 'N'
7804       AND ver.baselined_flag = 'Y'
7805 	-- AND (ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
7806       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
7807    GROUP BY
7808        fact.project_id
7809 	 , fact.PROJECT_ORG_ID
7810 	 , fact.PROJECT_ORGANIZATION_ID
7811      -- , fact.PARTITION_ID
7812    	 , fact.PROJECT_ELEMENT_ID
7813    	 , pa_cal.ent_period_id
7814    	 , fact.PERIOD_TYPE_ID
7815    	 , fact.CALENDAR_TYPE
7816      , fact.RBS_AGGR_LEVEL
7817      , fact.WBS_ROLLUP_FLAG
7818      , fact.PRG_ROLLUP_FLAG
7819      , fact.CURR_RECORD_TYPE_ID
7820    	 , fact.CURRENCY_CODE
7821    	 , fact.RBS_ELEMENT_ID
7822    	 , fact.RBS_VERSION_ID
7823    	 , fact.PLAN_VERSION_ID
7824    	 , fact.PLAN_TYPE_ID
7825               , fact.PLAN_TYPE_CODE ;   /* 4471527 */
7826 
7827 EXCEPTION
7828   WHEN OTHERS THEN
7829     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
7830                              p_procedure_name => 'PRORATE_TO_ENT_PG_FPRL_SE');
7831     RAISE;
7832 END;
7833 
7834 
7835 PROCEDURE PRORATE_TO_ENT_N_PJP1_SE( p_prorating_format varchar2) IS
7836 BEGIN
7837 
7838     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
7839 
7840 /* Commented for bug 4005006
7841 
7842     INSERT INTO pji_fp_aggr_pjp1_t  -- Non time phased entries.
7843     (
7844        WORKER_ID
7845      , PROJECT_ID
7846      , PROJECT_ORG_ID
7847      , PROJECT_ORGANIZATION_ID
7848      -- , PARTITION_ID
7849      , PROJECT_ELEMENT_ID
7850      , TIME_ID
7851      , PERIOD_TYPE_ID
7852      , CALENDAR_TYPE
7853      , RBS_AGGR_LEVEL
7854      , WBS_ROLLUP_FLAG
7855      , PRG_ROLLUP_FLAG
7856      , CURR_RECORD_TYPE_ID
7857      , CURRENCY_CODE
7858      , RBS_ELEMENT_ID
7859      , RBS_VERSION_ID
7860      , PLAN_VERSION_ID
7861      , PLAN_TYPE_ID
7862      , RAW_COST
7863      , BRDN_COST
7864      , REVENUE
7865      , BILL_RAW_COST
7866      , BILL_BRDN_COST
7867      , BILL_LABOR_RAW_COST
7868      , BILL_LABOR_BRDN_COST
7869      , BILL_LABOR_HRS
7870      , EQUIPMENT_RAW_COST
7871      , EQUIPMENT_BRDN_COST
7872      , CAPITALIZABLE_RAW_COST
7873      , CAPITALIZABLE_BRDN_COST
7874      , LABOR_RAW_COST
7875      , LABOR_BRDN_COST
7876      , LABOR_HRS
7877      , LABOR_REVENUE
7878      , EQUIPMENT_HOURS
7879      , BILLABLE_EQUIPMENT_HOURS
7880      , SUP_INV_COMMITTED_COST
7881      , PO_COMMITTED_COST
7882      , PR_COMMITTED_COST
7883      , OTH_COMMITTED_COST
7884        , ACT_LABOR_HRS
7885 	   , ACT_EQUIP_HRS
7886 	   , ACT_LABOR_BRDN_COST
7887 	   , ACT_EQUIP_BRDN_COST
7888 	   , ACT_BRDN_COST
7889 	   , ACT_RAW_COST
7890 	   , ACT_REVENUE
7891          , ACT_LABOR_RAW_COST
7892          , ACT_EQUIP_RAW_COST
7893 	   , ETC_LABOR_HRS
7894 	   , ETC_EQUIP_HRS
7895 	   , ETC_LABOR_BRDN_COST
7896 	   , ETC_EQUIP_BRDN_COST
7897 	   , ETC_BRDN_COST
7898          , ETC_RAW_COST
7899          , ETC_LABOR_RAW_COST
7900          , ETC_EQUIP_RAW_COST
7901      , CUSTOM1
7902      , CUSTOM2
7903      , CUSTOM3
7904      , CUSTOM4
7905      , CUSTOM5
7906      , CUSTOM6
7907      , CUSTOM7
7908      , CUSTOM8
7909      , CUSTOM9
7910      , CUSTOM10
7911      , CUSTOM11
7912      , CUSTOM12
7913      , CUSTOM13
7914      , CUSTOM14
7915      , CUSTOM15
7916      , LINE_TYPE
7917      , TIME_DANGLING_FLAG
7918      , RATE_DANGLING_FLAG
7919      , PRG_LEVEL
7920    )
7921    SELECT
7922          g_worker_id WORKER_ID
7923        , fact.project_id  project_id
7924 	 , fact.PROJECT_ORG_ID project_org_id
7925 	 , fact.PROJECT_ORGANIZATION_ID project_organization_id
7926      -- , fact.PARTITION_ID PARTITION_ID
7927    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
7928    	 , pa_cal.ent_period_id TIME_ID
7929    	 , 32 -- fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
7930    	 , 'E' CALENDAR_TYPE -- fact.CALENDAR_TYPE
7931      , fact.RBS_AGGR_LEVEL RBS_AGGR_LEVEL
7932      , fact.WBS_ROLLUP_FLAG WBS_ROLLUP_FLAG
7933      , fact.PRG_ROLLUP_FLAG PRG_ROLLUP_FLAG
7934      , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
7935    	 , fact.CURRENCY_CODE CURRENCY_CODE
7936    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
7937    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
7938    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
7939    	 , fact.PLAN_TYPE_ID PLAN_TYPE_ID
7940    	 , MAX(fact.RAW_COST)	 raw_cost
7941    	 , MAX(fact.BRDN_COST) BRDN_COST
7942    	 , MAX(fact.REVENUE) REVENUE
7943    	 , MAX(fact.BILL_RAW_COST) BILL_RAW_COST
7944    	 , MAX(fact.BILL_BRDN_COST) BILL_BRDN_COST
7945    	 , MAX(fact.BILL_LABOR_RAW_COST) BILL_LABOR_RAW_COST
7946    	 , MAX(fact.BILL_LABOR_BRDN_COST) BILL_LABOR_BRDN_COST
7947    	 , MAX(fact.BILL_LABOR_HRS) BILL_LABOR_HRS
7948    	 , MAX(fact.EQUIPMENT_RAW_COST) EQUIPMENT_RAW_COST
7949    	 , MAX(fact.EQUIPMENT_BRDN_COST) EQUIPMENT_BRDN_COST
7950    	 , MAX(fact.CAPITALIZABLE_RAW_COST) CAPITALIZABLE_RAW_COST
7951    	 , MAX(fact.CAPITALIZABLE_BRDN_COST) CAPITALIZABLE_BRDN_COST
7952    	 , MAX(fact.LABOR_RAW_COST) LABOR_RAW_COST
7953    	 , MAX(fact.LABOR_BRDN_COST) LABOR_BRDN_COST
7954    	 , MAX(fact.LABOR_HRS) LABOR_HRS
7955    	 , MAX(fact.LABOR_REVENUE) LABOR_REVENUE
7956    	 , MAX(fact.EQUIPMENT_HOURS) EQUIPMENT_HOURS
7957    	 , MAX(fact.BILLABLE_EQUIPMENT_HOURS) BILLABLE_EQUIPMENT_HOURS
7958    	 , MAX(fact.SUP_INV_COMMITTED_COST) SUP_INV_COMMITTED_COST
7959    	 , MAX(fact.PO_COMMITTED_COST) PO_COMMITTED_COST
7960    	 , MAX(fact.PR_COMMITTED_COST) PR_COMMITTED_COST
7961    	 , MAX(fact.OTH_COMMITTED_COST) OTH_COMMITTED_COST
7962        , MAX(fact.ACT_LABOR_HRS )
7963 	 , MAX(fact.ACT_EQUIP_HRS )
7964 	 , MAX(fact.ACT_LABOR_BRDN_COST )
7965 	 , MAX(fact.ACT_EQUIP_BRDN_COST )
7966 	 , MAX(fact.ACT_BRDN_COST )
7967 	 , MAX(fact.ACT_RAW_COST )
7968 	 , MAX(fact.ACT_REVENUE )
7969        , MAX(fact.ACT_LABOR_RAW_COST)
7970        , MAX(fact.ACT_EQUIP_RAW_COST)
7971 	 , MAX(fact.ETC_LABOR_HRS )
7972 	 , MAX(fact.ETC_EQUIP_HRS )
7973 	 , MAX(fact.ETC_LABOR_BRDN_COST )
7974 	 , MAX(fact.ETC_EQUIP_BRDN_COST )
7975 	 , MAX(fact.ETC_BRDN_COST )
7976        , MAX(fact.ETC_RAW_COST )
7977        , MAX(fact.ETC_LABOR_RAW_COST)
7978        , MAX(fact.ETC_EQUIP_RAW_COST)
7979    	 , MAX(fact.CUSTOM1) CUSTOM1
7980    	 , MAX(fact.CUSTOM2) CUSTOM2
7981    	 , MAX(fact.CUSTOM3) CUSTOM3
7982    	 , MAX(fact.CUSTOM4) CUSTOM4
7983    	 , MAX(fact.CUSTOM5) CUSTOM5
7984    	 , MAX(fact.CUSTOM6) CUSTOM6
7985    	 , MAX(fact.CUSTOM7) CUSTOM7
7986    	 , MAX(fact.CUSTOM8) CUSTOM8
7987    	 , MAX(fact.CUSTOM9) CUSTOM9
7988    	 , MAX(fact.CUSTOM10) CUSTOM10
7989    	 , MAX(fact.CUSTOM11) CUSTOM11
7990    	 , MAX(fact.CUSTOM12) CUSTOM12
7991    	 , MAX(fact.CUSTOM13) CUSTOM13
7992    	 , MAX(fact.CUSTOM14) CUSTOM14
7993    	 , MAX(fact.CUSTOM15) CUSTOM15
7994        , 'CN'   line_type
7995 	 , fact.TIME_DANGLING_FLAG  TIME_DANGLING_FLAG
7996 	 , fact.RATE_DANGLING_FLAG  RATE_DANGLING_FLAG
7997        , g_default_prg_level prg_level
7998    FROM   pji_fp_aggr_pjp1_t fact
7999    	  , pji_time_ent_period  pa_cal
8000         , pji_fm_extr_plnver3_t  ver
8001    WHERE  fact.CALENDAR_TYPE = 'A'
8002       AND fact.worker_id = g_worker_id
8003       AND fact.line_type = 'NTP'
8004       AND fact.start_date IS NOT NULL
8005       AND fact.end_date IS NOT NULL
8006 	AND fact.TIME_DANGLING_FLAG  IS NULL
8007 	AND fact.RATE_DANGLING_FLAG  IS NULL
8008       AND (
8009 	       (     pa_cal.start_date >= fact.start_date
8010                AND pa_cal.end_date <= fact.end_date ) -- fsps,pefe
8011 	    OR (     pa_cal.start_date <= fact.start_date
8012                AND pa_cal.end_date >= fact.end_date ) -- psfs,fepe
8013 	    OR (     pa_cal.start_date <= fact.start_date
8014                AND pa_cal.end_date <= fact.end_date
8015                AND pa_cal.end_date >= fact.start_date ) -- psfspefe
8016 	    OR (     pa_cal.start_date >= fact.start_date
8017                AND pa_cal.end_date >= fact.end_date
8018                AND pa_cal.start_date <= fact.end_date )  -- fspsfepe
8019           )
8020       AND fact.period_type_id = 2048
8021       AND fact.plan_version_id = ver.plan_version_id
8022       AND ver.wp_flag = 'N'
8023       AND ver.baselined_flag = 'Y'
8024       AND ver.time_phased_type_code = 'N'
8025   	-- AND (ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
8026       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
8027    GROUP BY
8028        fact.project_id
8029 	 , fact.PROJECT_ORG_ID
8030 	 , fact.PROJECT_ORGANIZATION_ID
8031      -- , fact.PARTITION_ID
8032    	 , fact.PROJECT_ELEMENT_ID
8033    	 , pa_cal.ent_period_id
8034    	 , fact.PERIOD_TYPE_ID
8035    	 , fact.CALENDAR_TYPE
8036      , fact.RBS_AGGR_LEVEL
8037      , fact.WBS_ROLLUP_FLAG
8038      , fact.PRG_ROLLUP_FLAG
8039      , fact.CURR_RECORD_TYPE_ID
8040    	 , fact.CURRENCY_CODE
8041    	 , fact.RBS_ELEMENT_ID
8042    	 , fact.RBS_VERSION_ID
8043    	 , fact.PLAN_VERSION_ID
8044    	 , fact.PLAN_TYPE_ID
8045 	 , fact.TIME_DANGLING_FLAG
8046 	 , fact.RATE_DANGLING_FLAG;
8047 
8048 End of bug 4005006*/
8049 
8050     INSERT INTO pji_fp_aggr_pjp1_t  -- Non time phased entries.
8051     (
8052        WORKER_ID
8053      , PROJECT_ID
8054      , PROJECT_ORG_ID
8055      , PROJECT_ORGANIZATION_ID
8056      , PROJECT_ELEMENT_ID
8057      , TIME_ID
8058      , PERIOD_TYPE_ID
8059      , CALENDAR_TYPE
8060      , RBS_AGGR_LEVEL
8061      , WBS_ROLLUP_FLAG
8062      , PRG_ROLLUP_FLAG
8063      , CURR_RECORD_TYPE_ID
8064      , CURRENCY_CODE
8065      , RBS_ELEMENT_ID
8066      , RBS_VERSION_ID
8067      , PLAN_VERSION_ID
8068      , PLAN_TYPE_ID
8069      , RAW_COST
8070      , BRDN_COST
8071      , REVENUE
8072      , BILL_RAW_COST
8073      , BILL_BRDN_COST
8074      , BILL_LABOR_RAW_COST
8075      , BILL_LABOR_BRDN_COST
8076      , BILL_LABOR_HRS
8077      , EQUIPMENT_RAW_COST
8078      , EQUIPMENT_BRDN_COST
8079      , CAPITALIZABLE_RAW_COST
8080      , CAPITALIZABLE_BRDN_COST
8081      , LABOR_RAW_COST
8082      , LABOR_BRDN_COST
8083      , LABOR_HRS
8084      , LABOR_REVENUE
8085      , EQUIPMENT_HOURS
8086      , BILLABLE_EQUIPMENT_HOURS
8087      , SUP_INV_COMMITTED_COST
8088      , PO_COMMITTED_COST
8089      , PR_COMMITTED_COST
8090      , OTH_COMMITTED_COST
8091      , ACT_LABOR_HRS
8092      , ACT_EQUIP_HRS
8093      , ACT_LABOR_BRDN_COST
8094      , ACT_EQUIP_BRDN_COST
8095      , ACT_BRDN_COST
8096      , ACT_RAW_COST
8097      , ACT_REVENUE
8098      , ACT_LABOR_RAW_COST
8099      , ACT_EQUIP_RAW_COST
8100      , ETC_LABOR_HRS
8101      , ETC_EQUIP_HRS
8102      , ETC_LABOR_BRDN_COST
8103      , ETC_EQUIP_BRDN_COST
8104      , ETC_BRDN_COST
8105      , ETC_RAW_COST
8106      , ETC_LABOR_RAW_COST
8107      , ETC_EQUIP_RAW_COST
8108      , CUSTOM1
8109      , CUSTOM2
8110      , CUSTOM3
8111      , CUSTOM4
8112      , CUSTOM5
8113      , CUSTOM6
8114      , CUSTOM7
8115      , CUSTOM8
8116      , CUSTOM9
8117      , CUSTOM10
8118      , CUSTOM11
8119      , CUSTOM12
8120      , CUSTOM13
8121      , CUSTOM14
8122      , CUSTOM15
8123      , TIME_DANGLING_FLAG
8124      , RATE_DANGLING_FLAG
8125      , PRG_LEVEL
8126      , PLAN_TYPE_CODE     /* 4471527 */
8127    )
8128    SELECT
8129            g_worker_id WORKER_ID
8130          , fact.project_id  project_id
8131 	 , fact.PROJECT_ORG_ID project_org_id
8132 	 , fact.PROJECT_ORGANIZATION_ID project_organization_id
8133    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
8134    	 , pa_cal.ent_period_id TIME_ID
8135    	 , 32 -- fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
8136    	 , 'E' CALENDAR_TYPE -- fact.CALENDAR_TYPE
8137          , fact.RBS_AGGR_LEVEL RBS_AGGR_LEVEL
8138          , fact.WBS_ROLLUP_FLAG WBS_ROLLUP_FLAG
8139          , fact.PRG_ROLLUP_FLAG PRG_ROLLUP_FLAG
8140          , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
8141    	 , fact.CURRENCY_CODE CURRENCY_CODE
8142    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
8143    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
8144    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
8145    	 , fact.PLAN_TYPE_ID PLAN_TYPE_ID
8146    	 , SUM(fact.RAW_COST)	 raw_cost
8147    	 , SUM(fact.BRDN_COST) BRDN_COST
8148    	 , SUM(fact.REVENUE) REVENUE
8149    	 , SUM(fact.BILL_RAW_COST) BILL_RAW_COST
8150    	 , SUM(fact.BILL_BRDN_COST) BILL_BRDN_COST
8151    	 , SUM(fact.BILL_LABOR_RAW_COST) BILL_LABOR_RAW_COST
8152    	 , SUM(fact.BILL_LABOR_BRDN_COST) BILL_LABOR_BRDN_COST
8153    	 , SUM(fact.BILL_LABOR_HRS) BILL_LABOR_HRS
8154    	 , SUM(fact.EQUIPMENT_RAW_COST) EQUIPMENT_RAW_COST
8155    	 , SUM(fact.EQUIPMENT_BRDN_COST) EQUIPMENT_BRDN_COST
8156    	 , SUM(fact.CAPITALIZABLE_RAW_COST) CAPITALIZABLE_RAW_COST
8157    	 , SUM(fact.CAPITALIZABLE_BRDN_COST) CAPITALIZABLE_BRDN_COST
8158    	 , SUM(fact.LABOR_RAW_COST) LABOR_RAW_COST
8159    	 , SUM(fact.LABOR_BRDN_COST) LABOR_BRDN_COST
8160    	 , SUM(fact.LABOR_HRS) LABOR_HRS
8161    	 , SUM(fact.LABOR_REVENUE) LABOR_REVENUE
8162    	 , SUM(fact.EQUIPMENT_HOURS) EQUIPMENT_HOURS
8163    	 , SUM(fact.BILLABLE_EQUIPMENT_HOURS) BILLABLE_EQUIPMENT_HOURS
8164    	 , SUM(fact.SUP_INV_COMMITTED_COST) SUP_INV_COMMITTED_COST
8165    	 , SUM(fact.PO_COMMITTED_COST) PO_COMMITTED_COST
8166    	 , SUM(fact.PR_COMMITTED_COST) PR_COMMITTED_COST
8167    	 , SUM(fact.OTH_COMMITTED_COST) OTH_COMMITTED_COST
8168          , SUM(fact.ACT_LABOR_HRS )
8169 	 , SUM(fact.ACT_EQUIP_HRS )
8170 	 , SUM(fact.ACT_LABOR_BRDN_COST )
8171 	 , SUM(fact.ACT_EQUIP_BRDN_COST )
8172 	 , SUM(fact.ACT_BRDN_COST )
8173 	 , SUM(fact.ACT_RAW_COST )
8174 	 , SUM(fact.ACT_REVENUE )
8175          , SUM(fact.ACT_LABOR_RAW_COST)
8176          , SUM(fact.ACT_EQUIP_RAW_COST)
8177 	 , SUM(fact.ETC_LABOR_HRS )
8178 	 , SUM(fact.ETC_EQUIP_HRS )
8179 	 , SUM(fact.ETC_LABOR_BRDN_COST )
8180 	 , SUM(fact.ETC_EQUIP_BRDN_COST )
8181 	 , SUM(fact.ETC_BRDN_COST )
8182          , SUM(fact.ETC_RAW_COST )
8183          , SUM(fact.ETC_LABOR_RAW_COST)
8184          , SUM(fact.ETC_EQUIP_RAW_COST)
8185    	 , SUM(fact.CUSTOM1) CUSTOM1
8186    	 , SUM(fact.CUSTOM2) CUSTOM2
8187    	 , SUM(fact.CUSTOM3) CUSTOM3
8188    	 , SUM(fact.CUSTOM4) CUSTOM4
8189    	 , SUM(fact.CUSTOM5) CUSTOM5
8190    	 , SUM(fact.CUSTOM6) CUSTOM6
8191    	 , SUM(fact.CUSTOM7) CUSTOM7
8192    	 , SUM(fact.CUSTOM8) CUSTOM8
8193    	 , SUM(fact.CUSTOM9) CUSTOM9
8194    	 , SUM(fact.CUSTOM10) CUSTOM10
8195    	 , SUM(fact.CUSTOM11) CUSTOM11
8196    	 , SUM(fact.CUSTOM12) CUSTOM12
8197    	 , SUM(fact.CUSTOM13) CUSTOM13
8198    	 , SUM(fact.CUSTOM14) CUSTOM14
8199    	 , SUM(fact.CUSTOM15) CUSTOM15
8200 	 , fact.TIME_DANGLING_FLAG  TIME_DANGLING_FLAG
8201 	 , fact.RATE_DANGLING_FLAG  RATE_DANGLING_FLAG
8202          , g_default_prg_level prg_level
8203              , fact.plan_type_code  plan_type_code   /* 4471527 */
8204    FROM    pji_fp_aggr_pjp1_t fact
8205    	 , pji_time_ent_period_v  pa_cal
8206          , pji_fm_extr_plnver3_t  ver
8207    WHERE  fact.CALENDAR_TYPE = 'A'
8208       AND fact.worker_id = g_worker_id
8209       AND fact.line_type = 'NTP'
8210       AND fact.start_date IS NOT NULL
8211       AND fact.end_date IS NOT NULL
8212       AND fact.TIME_DANGLING_FLAG  IS NULL
8213       AND fact.RATE_DANGLING_FLAG  IS NULL
8214       AND ( fact.start_date <= pa_cal.end_date AND fact.end_date >= pa_cal.start_date )
8215       AND DECODE(p_prorating_format,'S',
8216              DECODE(SIGN(fact.start_Date-pa_cal.start_date),-1,0,1),
8217              DECODE(SIGN(fact.end_Date - pa_cal.end_date), 1,0,1))=1
8218       AND fact.period_type_id = 2048
8219       AND fact.plan_version_id = ver.plan_version_id
8220       AND fact.plan_type_code = ver.plan_type_code   /* 4471527 */
8221       AND ver.wp_flag = 'N'
8222       AND ver.baselined_flag = 'Y'
8223       AND ver.time_phased_type_code = 'N'
8224   	-- AND (ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
8225       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
8226    GROUP BY
8227            fact.project_id
8228 	 , fact.PROJECT_ORG_ID
8229 	 , fact.PROJECT_ORGANIZATION_ID
8230    	 , fact.PROJECT_ELEMENT_ID
8231    	 , pa_cal.ent_period_id
8232    	 , fact.PERIOD_TYPE_ID
8233  	 , fact.CALENDAR_TYPE
8234          , fact.RBS_AGGR_LEVEL
8235          , fact.WBS_ROLLUP_FLAG
8236          , fact.PRG_ROLLUP_FLAG
8237          , fact.CURR_RECORD_TYPE_ID
8238    	 , fact.CURRENCY_CODE
8239    	 , fact.RBS_ELEMENT_ID
8240    	 , fact.RBS_VERSION_ID
8241    	 , fact.PLAN_VERSION_ID
8242    	 , fact.PLAN_TYPE_ID
8243               , fact.PLAN_TYPE_CODE   /* 4471527 */
8244 	 , fact.TIME_DANGLING_FLAG
8245 	 , fact.RATE_DANGLING_FLAG;
8246 
8247 
8248 EXCEPTION
8249   WHEN OTHERS THEN
8250     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
8251                              p_procedure_name => 'PRORATE_TO_ENT_N_PJP1_SE');
8252     RAISE;
8253 END;
8254 
8255 
8256 PROCEDURE PRORATE_TO_PAGL_PGE_PJP1_D (p_calendar_type   IN   VARCHAR2 := NULL) IS
8257 BEGIN
8258 
8259     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
8260 
8261 /* Commented for bug 4005006
8262     INSERT INTO pji_fp_aggr_pjp1_t
8263     (
8264        worker_id
8265      , PROJECT_ID
8266      , PROJECT_ORG_ID
8267      , PROJECT_ORGANIZATION_ID
8268      -- , PARTITION_ID
8269      , PROJECT_ELEMENT_ID
8270      , TIME_ID
8271      , PERIOD_TYPE_ID
8272      , CALENDAR_TYPE
8273      , RBS_AGGR_LEVEL
8274      , WBS_ROLLUP_FLAG
8275      , PRG_ROLLUP_FLAG
8276      , CURR_RECORD_TYPE_ID
8277      , CURRENCY_CODE
8278      , RBS_ELEMENT_ID
8279      , RBS_VERSION_ID
8280      , PLAN_VERSION_ID
8281      , PLAN_TYPE_ID
8282      , RAW_COST
8283      , BRDN_COST
8284      , REVENUE
8285      , BILL_RAW_COST
8286      , BILL_BRDN_COST
8287      , BILL_LABOR_RAW_COST
8288      , BILL_LABOR_BRDN_COST
8289      , BILL_LABOR_HRS
8290      , EQUIPMENT_RAW_COST
8291      , EQUIPMENT_BRDN_COST
8292      , CAPITALIZABLE_RAW_COST
8293      , CAPITALIZABLE_BRDN_COST
8294      , LABOR_RAW_COST
8295      , LABOR_BRDN_COST
8296      , LABOR_HRS
8297      , LABOR_REVENUE
8298      , EQUIPMENT_HOURS
8299      , BILLABLE_EQUIPMENT_HOURS
8300      , SUP_INV_COMMITTED_COST
8301      , PO_COMMITTED_COST
8302      , PR_COMMITTED_COST
8303      , OTH_COMMITTED_COST
8304      , ACT_LABOR_HRS
8305 	   , ACT_EQUIP_HRS
8306 	   , ACT_LABOR_BRDN_COST
8307 	   , ACT_EQUIP_BRDN_COST
8308 	   , ACT_BRDN_COST
8309 	   , ACT_RAW_COST
8310 	   , ACT_REVENUE
8311          , ACT_LABOR_RAW_COST
8312          , ACT_EQUIP_RAW_COST
8313 	   , ETC_LABOR_HRS
8314 	   , ETC_EQUIP_HRS
8315 	   , ETC_LABOR_BRDN_COST
8316 	   , ETC_EQUIP_BRDN_COST
8317 	   , ETC_BRDN_COST
8318          , ETC_RAW_COST
8319          , ETC_LABOR_RAW_COST
8320          , ETC_EQUIP_RAW_COST
8321      , CUSTOM1
8322      , CUSTOM2
8323      , CUSTOM3
8324      , CUSTOM4
8325      , CUSTOM5
8326      , CUSTOM6
8327      , CUSTOM7
8328      , CUSTOM8
8329      , CUSTOM9
8330      , CUSTOM10
8331      , CUSTOM11
8332      , CUSTOM12
8333      , CUSTOM13
8334      , CUSTOM14
8335      , CUSTOM15
8336      , LINE_TYPE
8337      , TIME_DANGLING_FLAG
8338      , RATE_DANGLING_FLAG
8339      , PRG_LEVEL
8340 	)
8341    SELECT
8342        g_worker_id worker_id
8343      , a.PROJECT_ID
8344      , a.PROJECT_ORG_ID
8345      , a.PROJECT_ORGANIZATION_ID
8346      , a.PROJECT_ELEMENT_ID
8347      , a.TIME_ID
8348      , a.PERIOD_TYPE_ID
8349      , a.CALENDAR_TYPE
8350      , a.RBS_AGGR_LEVEL
8351      , a.WBS_ROLLUP_FLAG
8352      , a.PRG_ROLLUP_FLAG
8353      , a.CURR_RECORD_TYPE_ID
8354      , a.CURRENCY_CODE
8355      , a.RBS_ELEMENT_ID
8356      , a.RBS_VERSION_ID
8357      , a.PLAN_VERSION_ID
8358      , a.PLAN_TYPE_ID
8359      , SUM(a.RAW_COST       )
8360      , SUM(a.BRDN_COST 	)
8361      , SUM(a.REVENUE	)
8362      , SUM(a.BILL_RAW_COST )
8363      , SUM(a.BILL_BRDN_COST )
8364      , SUM(a.BILL_LABOR_RAW_COST )
8365      , SUM(a.BILL_LABOR_BRDN_COST )
8366      , SUM(a.BILL_LABOR_HRS )
8367      , SUM(a.EQUIPMENT_RAW_COST )
8368      , SUM(a.EQUIPMENT_BRDN_COST )
8369      , SUM(a.CAPITALIZABLE_RAW_COST )
8370      , SUM(a.CAPITALIZABLE_BRDN_COST )
8371      , SUM(a.LABOR_RAW_COST )
8372      , SUM(a.LABOR_BRDN_COST)
8373      , SUM(a.LABOR_HRS )
8374      , SUM(a.LABOR_REVENUE )
8375      , SUM(a.EQUIPMENT_HOURS )
8376      , SUM(a.BILLABLE_EQUIPMENT_HOURS)
8377      , SUM(a.SUP_INV_COMMITTED_COST)
8378      , SUM(a.PO_COMMITTED_COST )
8379      , SUM(a.PR_COMMITTED_COST )
8380      , SUM(a.OTH_COMMITTED_COST)
8381        , SUM(a.ACT_LABOR_HRS)
8382 	   , SUM(a.ACT_EQUIP_HRS)
8383 	   , SUM(a.ACT_LABOR_BRDN_COST)
8384 	   , SUM(a.ACT_EQUIP_BRDN_COST)
8385 	   , SUM(a.ACT_BRDN_COST    )
8386 	   , SUM(a.ACT_RAW_COST    )
8387 	   , SUM(a.ACT_REVENUE    )
8388          , SUM(a.ACT_LABOR_RAW_COST)
8389          , SUM(a.ACT_EQUIP_RAW_COST)
8390 	   , SUM(a.ETC_LABOR_HRS         )
8391 	   , SUM(a.ETC_EQUIP_HRS        )
8392 	   , SUM(a.ETC_LABOR_BRDN_COST )
8393 	   , SUM(a.ETC_EQUIP_BRDN_COST)
8394 	   , SUM(a.ETC_BRDN_COST )
8395          , SUM(a.ETC_RAW_COST)
8396          , SUM(a.ETC_LABOR_RAW_COST)
8397          , SUM(a.ETC_EQUIP_RAW_COST)
8398      , SUM(a.CUSTOM1	)
8399      , SUM(a.CUSTOM2	)
8400      , SUM(a.CUSTOM3	)
8401      , SUM(a.CUSTOM4	)
8402      , SUM(a.CUSTOM5	)
8403      , SUM(a.CUSTOM6	)
8404      , SUM(a.CUSTOM7	)
8405      , SUM(a.CUSTOM8	)
8406      , SUM(a.CUSTOM9	)
8407      , SUM(a.CUSTOM10	)
8408      , SUM(a.CUSTOM11	)
8409      , SUM(a.CUSTOM12	)
8410      , SUM(a.CUSTOM13	)
8411      , SUM(a.CUSTOM14	)
8412      , SUM(a.CUSTOM15	)
8413 	 , a.LINE_TYPE
8414 	 , a.TIME_DANGLING_FLAG
8415 	 , a.RATE_DANGLING_FLAG
8416        , g_default_prg_level prg_level
8417    FROM (
8418    SELECT
8419          fact.project_id  project_id
8420    	 , fact.project_ORG_ID project_ORG_ID
8421    	 , fact.project_ORGANIZATION_ID project_ORGANIZATION_ID
8422      -- , fact.PARTITION_ID PARTITION_ID
8423    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
8424    	 , pa_cal.cal_period_id TIME_ID
8425    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
8426    	 , DECODE(fact.CALENDAR_TYPE, 'P', 'G', 'G', 'P') CALENDAR_TYPE
8427      , fact.RBS_AGGR_LEVEL
8428      , fact.WBS_ROLLUP_FLAG
8429      , fact.PRG_ROLLUP_FLAG
8430    	 , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
8431    	 , fact.CURRENCY_CODE CURRENCY_CODE
8432    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
8433    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
8434    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
8435 	 , fact.PLAN_TYPE_ID  PLAN_TYPE_ID
8436 	 , ROUND (
8437              NVL (
8438             DECODE (
8439                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8440 			  , '00'   , fact.raw_cost
8441 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8442 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8443 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8444 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8445 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8446 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8447 			  , '0-1'  , fact.raw_cost
8448 			  , '1-1'  , fact.raw_cost
8449 			  , 0  ) -- end decode
8450 			    , 0  ) -- end nvl
8451 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8452 						* PJI_UTILS.GET_MAU (fact.currency_code)	raw_cost
8453 	 , ROUND (
8454              NVL (
8455             DECODE (
8456                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8457 			 , '00'   , fact.brdn_cost
8458 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8459 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8460 			 , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8461 			 , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8462 			 , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8463 			 , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8464 			 , '0-1'  , fact.brdn_cost
8465 			 , '1-1'  , fact.brdn_cost
8466 			 , 0  ) -- end decode
8467 			  , 0  ) -- end nvl
8468 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8469 						* PJI_UTILS.GET_MAU (fact.currency_code)	brdn_cost
8470 	 , ROUND (
8471              NVL (
8472             DECODE (
8473                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8474 			 , '00'   , fact.revenue
8475 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8476 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8477 			 , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8478 			 , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8479 			 , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8480 			 , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8481 			 , '0-1'  , fact.revenue
8482 			 , '1-1'  , fact.revenue
8483 			 , 0  ) -- end decode
8484 			  , 0  ) -- end nvl
8485 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8486 						* PJI_UTILS.GET_MAU (fact.currency_code)	revenue
8487 	 , ROUND (
8488              NVL (
8489             DECODE (
8490                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8491 			  , '00'   , fact.bill_raw_cost
8492 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8493 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8494 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8495 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8496 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8497 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8498 			  , '0-1'  , fact.bill_raw_cost
8499 			  , '1-1'  , fact.bill_raw_cost
8500 			  , 0  ) -- end decode
8501 			    , 0  ) -- end nvl
8502 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8503 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_raw_cost
8504 	 , ROUND (
8505              NVL (
8506             DECODE (
8507                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8508 			  , '00'   , fact.bill_brdn_cost
8509 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8510 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8511 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8512 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8513 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8514 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8515 			  , '0-1'  , fact.bill_brdn_cost
8516 			  , '1-1'  , fact.bill_brdn_cost
8517 			  , 0  ) -- end decode
8518 			    , 0  ) -- end nvl
8519 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8520 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_brdn_cost
8521 	 , ROUND (
8522              NVL (
8523             DECODE (
8524                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8525 			  , '00'   , fact.bill_labor_raw_cost
8526 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8527 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8528 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8529 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8530 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8531 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8532 			  , '0-1'  , fact.bill_labor_raw_cost
8533 			  , '1-1'  , fact.bill_labor_raw_cost
8534 			  , 0  ) -- end decode
8535 			    , 0  ) -- end nvl
8536 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8537 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_raw_cost
8538 	 , ROUND (
8539              NVL (
8540             DECODE (
8541                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8542 			  , '00'   , fact.bill_labor_brdn_cost
8543 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8544 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8545 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8546 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8547 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8548 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8549 			  , '0-1'  , fact.bill_labor_brdn_cost
8550 			  , '1-1'  , fact.bill_labor_brdn_cost
8551 			  , 0  ) -- end decode
8552 			    , 0  ) -- end nvl
8553 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8554 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_brdn_cost
8555 	 , ROUND (
8556              NVL (
8557             DECODE (
8558                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8559 			  , '00'   , fact.bill_labor_hrs
8560 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8561 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8562 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8563 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8564 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8565 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8566 			  , '0-1'  , fact.bill_labor_hrs
8567 			  , '1-1'  , fact.bill_labor_hrs
8568 			  , 0  ) -- end decode
8569 			    , 0  ) -- end nvl
8570 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8571 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_hrs
8572 	 , ROUND (
8573              NVL (
8574             DECODE (
8575                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8576 			  , '00'   , fact.equipment_raw_cost
8577 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8578 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8579 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8580 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8581 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8582 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8583 			  , '0-1'  , fact.equipment_raw_cost
8584 			  , '1-1'  , fact.equipment_raw_cost
8585 			  , 0  ) -- end decode
8586 			    , 0  ) -- end nvl
8587 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8588 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_raw_cost
8589 	 , ROUND (
8590              NVL (
8591             DECODE (
8592                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8593 			  , '00'   , fact.equipment_brdn_cost
8594 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8595 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8596 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8597 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8598 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8599 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8600 			  , '0-1'  , fact.equipment_brdn_cost
8601 			  , '1-1'  , fact.equipment_brdn_cost
8602 			  , 0  ) -- end decode
8603 			    , 0  ) -- end nvl
8604 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8605 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_brdn_cost
8606 	 , ROUND (
8607              NVL (
8608             DECODE (
8609                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8610 			  , '00'   , fact.capitalizable_raw_cost
8611 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8612 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8613 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8614 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8615 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8616 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8617 			  , '0-1'  , fact.capitalizable_raw_cost
8618 			  , '1-1'  , fact.capitalizable_raw_cost
8619 			  , 0  ) -- end decode
8620 			    , 0  ) -- end nvl
8621 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8622 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_raw_cost
8623 	 , ROUND (
8624              NVL (
8625             DECODE (
8626                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8627 			  , '00'   , fact.capitalizable_brdn_cost
8628 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8629 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8630 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8631 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8632 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8633 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8634 			  , '0-1'  , fact.capitalizable_brdn_cost
8635 			  , '1-1'  , fact.capitalizable_brdn_cost
8636 			  , 0  ) -- end decode
8637 			    , 0  ) -- end nvl
8638 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8639 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_brdn_cost
8640 	 , ROUND (
8641              NVL (
8642             DECODE (
8643                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8644 			  , '00'   , fact.labor_raw_cost
8645 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8646 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8647 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8648 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8649 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8650 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8651 			  , '0-1'  , fact.labor_raw_cost
8652 			  , '1-1'  , fact.labor_raw_cost
8653 			  , 0  ) -- end decode
8654 			    , 0  ) -- end nvl
8655 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8656 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_raw_cost
8657 	 , ROUND (
8658              NVL (
8659             DECODE (
8660                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8661 			  , '00'   , fact.labor_brdn_cost
8662 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8663 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8664 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8665 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8666 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8667 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8668 			  , '0-1'  , fact.labor_brdn_cost
8669 			  , '1-1'  , fact.labor_brdn_cost
8670 			  , 0  ) -- end decode
8671 			    , 0  ) -- end nvl
8672 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8673 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_brdn_cost
8674 	 , ROUND (
8675              NVL (
8676             DECODE (
8677                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8678 			  , '00'   , fact.labor_hrs
8679 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8680 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8681 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8682 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8683 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8684 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8685 			  , '0-1'  , fact.labor_hrs
8686 			  , '1-1'  , fact.labor_hrs
8687 			  , 0  ) -- end decode
8688 			    , 0  ) -- end nvl
8689 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8690 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_hrs
8691 	 , ROUND (
8692              NVL (
8693             DECODE (
8694                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8695 			  , '00'   , fact.labor_revenue
8696 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8697 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8698 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8699 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8700 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8701 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8702 			  , '0-1'  , fact.labor_revenue
8703 			  , '1-1'  , fact.labor_revenue
8704 			  , 0  ) -- end decode
8705 			    , 0  ) -- end nvl
8706 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8707 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_revenue
8708 	 , ROUND (
8709              NVL (
8710             DECODE (
8711                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8712 			  , '00'   , fact.equipment_hours
8713 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8714 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8715 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8716 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8717 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8718 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8719 			  , '0-1'  , fact.equipment_hours
8720 			  , '1-1'  , fact.equipment_hours
8721 			  , 0  ) -- end decode
8722 			    , 0  ) -- end nvl
8723 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8724 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_hours
8725 	 , ROUND (
8726              NVL (
8727             DECODE (
8728                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8729 			  , '00'   , fact.billable_equipment_hours
8730 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8731 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8732 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8733 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8734 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8735 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8736 			  , '0-1'  , fact.billable_equipment_hours
8737 			  , '1-1'  , fact.billable_equipment_hours
8738 			  , 0  ) -- end decode
8739 			    , 0  ) -- end nvl
8740 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8741 						* PJI_UTILS.GET_MAU (fact.currency_code)	billable_equipment_hours
8742 	 , ROUND (
8743              NVL (
8744             DECODE (
8745                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8746 			  , '00'   , fact.sup_inv_committed_cost
8747 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8748 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8749 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8750 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8751 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8752 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8753 			  , '0-1'  , fact.sup_inv_committed_cost
8754 			  , '1-1'  , fact.sup_inv_committed_cost
8755 			  , 0  ) -- end decode
8756 			    , 0  ) -- end nvl
8757 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8758 						* PJI_UTILS.GET_MAU (fact.currency_code)	sup_inv_committed_cost
8759 	 , ROUND (
8760              NVL (
8761             DECODE (
8762                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8763 			  , '00'   , fact.po_committed_cost
8764 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8765 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8766 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8767 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8768 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8769 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8770 			  , '0-1'  , fact.po_committed_cost
8771 			  , '1-1'  , fact.po_committed_cost
8772 			  , 0  ) -- end decode
8773 			    , 0  ) -- end nvl
8774 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8775 						* PJI_UTILS.GET_MAU (fact.currency_code)	po_committed_cost
8776 	 , ROUND (
8777              NVL (
8778             DECODE (
8779                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8780 			  , '00'   , fact.pr_committed_cost
8781 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8782 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8783 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8784 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8785 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8786 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8787 			  , '0-1'  , fact.pr_committed_cost
8788 			  , '1-1'  , fact.pr_committed_cost
8789 			  , 0  ) -- end decode
8790 			    , 0  ) -- end nvl
8791 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8792 						* PJI_UTILS.GET_MAU (fact.currency_code)	pr_committed_cost
8793 	 , ROUND (
8794              NVL (
8795             DECODE (
8796                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8797 			  , '00'   , fact.oth_committed_cost
8798 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8799 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8800 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8801 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8802 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8803 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8804 			  , '0-1'  , fact.oth_committed_cost
8805 			  , '1-1'  , fact.oth_committed_cost
8806 			  , 0  ) -- end decode
8807 			    , 0  ) -- end nvl
8808 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8809 						* PJI_UTILS.GET_MAU (fact.currency_code)	oth_committed_cost
8810 	 , ROUND (
8811              NVL (
8812             DECODE (
8813                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8814 			  , '00'   , fact.ACT_LABOR_HRS
8815 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8816 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8817 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8818 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8819 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8820 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8821 			  , '0-1'  , fact.ACT_LABOR_HRS
8822 			  , '1-1'  , fact.ACT_LABOR_HRS
8823 			  , 0  ) -- end decode
8824 			    , 0  ) -- end nvl
8825 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8826 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_HRS
8827 	 , ROUND (
8828              NVL (
8829             DECODE (
8830                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8831 			  , '00'   , fact.ACT_EQUIP_HRS
8832 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8833 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8834 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8835 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8836 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8837 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8838 			  , '0-1'  , fact.ACT_EQUIP_HRS
8839 			  , '1-1'  , fact.ACT_EQUIP_HRS
8840 			  , 0  ) -- end decode
8841 			    , 0  ) -- end nvl
8842 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8843 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_HRS
8844 	 , ROUND (
8845              NVL (
8846             DECODE (
8847                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8848 			  , '00'   , fact.ACT_LABOR_BRDN_COST
8849 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8850 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8851 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8852 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8853 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8854 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8855 			  , '0-1'  , fact.ACT_LABOR_BRDN_COST
8856 			  , '1-1'  , fact.ACT_LABOR_BRDN_COST
8857 			  , 0  ) -- end decode
8858 			    , 0  ) -- end nvl
8859 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8860 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_BRDN_COST
8861 	 , ROUND (
8862              NVL (
8863             DECODE (
8864                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8865 			  , '00'   , fact.ACT_EQUIP_BRDN_COST
8866 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8867 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8868 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8869 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8870 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8871 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8872 			  , '0-1'  , fact.ACT_EQUIP_BRDN_COST
8873 			  , '1-1'  , fact.ACT_EQUIP_BRDN_COST
8874 			  , 0  ) -- end decode
8875 			    , 0  ) -- end nvl
8876 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8877 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_BRDN_COST
8878 	 , ROUND (
8879              NVL (
8880             DECODE (
8881                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8882 			  , '00'   , fact.ACT_BRDN_COST
8883 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8884 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8885 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8886 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8887 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8888 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8889 			  , '0-1'  , fact.ACT_BRDN_COST
8890 			  , '1-1'  , fact.ACT_BRDN_COST
8891 			  , 0  ) -- end decode
8892 			    , 0  ) -- end nvl
8893 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8894 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_BRDN_COST
8895 	 , ROUND (
8896              NVL (
8897             DECODE (
8898                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8899 			  , '00'   , fact.ACT_RAW_COST
8900 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8901 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8902 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8903 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8904 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8905 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8906 			  , '0-1'  , fact.ACT_RAW_COST
8907 			  , '1-1'  , fact.ACT_RAW_COST
8908 			  , 0  ) -- end decode
8909 			    , 0  ) -- end nvl
8910 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8911 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_RAW_COST
8912 	 , ROUND (
8913              NVL (
8914             DECODE (
8915                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8916 			  , '00'   , fact.ACT_REVENUE
8917 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8918 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8919 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8920 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8921 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8922 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8923 			  , '0-1'  , fact.ACT_REVENUE
8924 			  , '1-1'  , fact.ACT_REVENUE
8925 			  , 0  ) -- end decode
8926 			    , 0  ) -- end nvl
8927 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8928 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_REVENUE
8929 	 , ROUND (
8930              NVL (
8931             DECODE (
8932                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8933 			  , '00'   , fact.ACT_LABOR_RAW_COST
8934 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8935 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8936 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8937 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8938 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8939 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8940 			  , '0-1'  , fact.ACT_LABOR_RAW_COST
8941 			  , '1-1'  , fact.ACT_LABOR_RAW_COST
8942 			  , 0  ) -- end decode
8943 			    , 0  ) -- end nvl
8944 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8945 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_RAW_COST
8946 	 , ROUND (
8947              NVL (
8948             DECODE (
8949                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8950 			  , '00'   , fact.ACT_EQUIP_RAW_COST
8951 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8952 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8953 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8954 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8955 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8956 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8957 			  , '0-1'  , fact.ACT_EQUIP_RAW_COST
8958 			  , '1-1'  , fact.ACT_EQUIP_RAW_COST
8959 			  , 0  ) -- end decode
8960 			    , 0  ) -- end nvl
8961 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8962 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_RAW_COST
8963 	 , ROUND (
8964              NVL (
8965             DECODE (
8966                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8967 			  , '00'   , fact.ETC_LABOR_HRS
8968 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8969 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8970 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8971 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8972 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8973 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8974 			  , '0-1'  , fact.ETC_LABOR_HRS
8975 			  , '1-1'  , fact.ETC_LABOR_HRS
8976 			  , 0  ) -- end decode
8977 			    , 0  ) -- end nvl
8978 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8979 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_HRS
8980 	 , ROUND (
8981              NVL (
8982             DECODE (
8983                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
8984 			  , '00'   , fact.ETC_EQUIP_HRS
8985 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8986 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8987 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8988 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8989 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8990 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
8991 			  , '0-1'  , fact.ETC_EQUIP_HRS
8992 			  , '1-1'  , fact.ETC_EQUIP_HRS
8993 			  , 0  ) -- end decode
8994 			    , 0  ) -- end nvl
8995 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
8996 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_HRS
8997 	 , ROUND (
8998              NVL (
8999             DECODE (
9000                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9001 			  , '00'   , fact.ETC_LABOR_BRDN_COST
9002 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9003 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9004 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9005 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9006 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9007 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9008 			  , '0-1'  , fact.ETC_LABOR_BRDN_COST
9009 			  , '1-1'  , fact.ETC_LABOR_BRDN_COST
9010 			  , 0  ) -- end decode
9011 			    , 0  ) -- end nvl
9012 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9013 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_BRDN_COST
9014 	 , ROUND (
9015              NVL (
9016             DECODE (
9017                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9018 			  , '00'   , fact.ETC_EQUIP_BRDN_COST
9019 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9020 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9021 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9022 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9023 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9024 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9025 			  , '0-1'  , fact.ETC_EQUIP_BRDN_COST
9026 			  , '1-1'  , fact.ETC_EQUIP_BRDN_COST
9027 			  , 0  ) -- end decode
9028 			    , 0  ) -- end nvl
9029 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9030 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_BRDN_COST
9031 	 , ROUND (
9032              NVL (
9033             DECODE (
9034                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9035 			  , '00'   , fact.ETC_BRDN_COST
9036 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9037 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9038 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9039 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9040 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9041 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9042 			  , '0-1'  , fact.ETC_BRDN_COST
9043 			  , '1-1'  , fact.ETC_BRDN_COST
9044 			  , 0  ) -- end decode
9045 			    , 0  ) -- end nvl
9046 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9047 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_BRDN_COST
9048 	 , ROUND (
9049              NVL (
9050             DECODE (
9051                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9052 			  , '00'   , fact.ETC_RAW_COST
9053 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9054 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9055 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9056 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9057 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9058 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9059 			  , '0-1'  , fact.ETC_RAW_COST
9060 			  , '1-1'  , fact.ETC_RAW_COST
9061 			  , 0  ) -- end decode
9062 			    , 0  ) -- end nvl
9063 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9064 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_RAW_COST
9065 	 , ROUND (
9066              NVL (
9067             DECODE (
9068                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9069 			  , '00'   , fact.ETC_LABOR_RAW_COST
9070 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9071 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9072 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9073 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9074 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9075 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9076 			  , '0-1'  , fact.ETC_LABOR_RAW_COST
9077 			  , '1-1'  , fact.ETC_LABOR_RAW_COST
9078 			  , 0  ) -- end decode
9079 			    , 0  ) -- end nvl
9080 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9081 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_RAW_COST
9082 	 , ROUND (
9083              NVL (
9084             DECODE (
9085                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9086 			  , '00'   , fact.ETC_EQUIP_RAW_COST
9087 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9088 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9089 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9090 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9091 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9092 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9093 			  , '0-1'  , fact.ETC_EQUIP_RAW_COST
9094 			  , '1-1'  , fact.ETC_EQUIP_RAW_COST
9095 			  , 0  ) -- end decode
9096 			    , 0  ) -- end nvl
9097 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9098 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_RAW_COST
9099 	 , ROUND (
9100              NVL (
9101             DECODE (
9102                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9103 			  , '00'   , fact.custom1
9104 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9105 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9106 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9107 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9108 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9109 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9110 			  , '0-1'  , fact.custom1
9111 			  , '1-1'  , fact.custom1
9112 			  , 0  ) -- end decode
9113 			    , 0  ) -- end nvl
9114 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9115 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom1
9116 	 , ROUND (
9117              NVL (
9118             DECODE (
9119                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9120 			  , '00'   , fact.custom2
9121 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9122 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9123 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9124 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9125 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9126 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9127 			  , '0-1'  , fact.custom2
9128 			  , '1-1'  , fact.custom2
9129 			  , 0  ) -- end decode
9130 			    , 0  ) -- end nvl
9131 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9132 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom2
9133 	 , ROUND (
9134              NVL (
9135             DECODE (
9136                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9137 			  , '00'   , fact.custom3
9138 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9139 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9140 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9141 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9142 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9143 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9144 			  , '0-1'  , fact.custom3
9145 			  , '1-1'  , fact.custom3
9146 			  , 0  ) -- end decode
9147 			    , 0  ) -- end nvl
9148 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9149 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom3
9150 	 , ROUND (
9151              NVL (
9152             DECODE (
9153                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9154 			  , '00'   , fact.custom4
9155 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9156 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9157 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9158 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9159 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9160 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9161 			  , '0-1'  , fact.custom4
9162 			  , '1-1'  , fact.custom4
9163 			  , 0  ) -- end decode
9164 			    , 0  ) -- end nvl
9165 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9166 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom4
9167 	 , ROUND (
9168              NVL (
9169             DECODE (
9170                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9171 			  , '00'   , fact.custom5
9172 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9173 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9174 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9175 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9176 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9177 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9178 			  , '0-1'  , fact.custom5
9179 			  , '1-1'  , fact.custom5
9180 			  , 0  ) -- end decode
9181 			    , 0  ) -- end nvl
9182 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9183 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom5
9184 	 , ROUND (
9185              NVL (
9186             DECODE (
9187                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9188 			  , '00'   , fact.custom6
9189 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9190 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9191 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9192 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9193 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9194 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9195 			  , '0-1'  , fact.custom6
9196 			  , '1-1'  , fact.custom6
9197 			  , 0  ) -- end decode
9198 			    , 0  ) -- end nvl
9199 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9200 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom6
9201 	 , ROUND (
9202              NVL (
9203             DECODE (
9204                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9205 			  , '00'   , fact.custom7
9206 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9207 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9208 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9209 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9210 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9211 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9212 			  , '0-1'  , fact.custom7
9213 			  , '1-1'  , fact.custom7
9214 			  , 0  ) -- end decode
9215 			    , 0  ) -- end nvl
9216 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9217 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom7
9218 	 , ROUND (
9219              NVL (
9220             DECODE (
9221                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9222 			  , '00'   , fact.custom8
9223 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9224 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9225 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9226 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9227 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9228 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9229 			  , '0-1'  , fact.custom8
9230 			  , '1-1'  , fact.custom8
9231 			  , 0  ) -- end decode
9232 			    , 0  ) -- end nvl
9233 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9234 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom8
9235 	 , ROUND (
9236              NVL (
9237             DECODE (
9238                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9239 			  , '00'   , fact.custom9
9240 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9241 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9242 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9243 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9244 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9245 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9246 			  , '0-1'  , fact.custom9
9247 			  , '1-1'  , fact.custom9
9248 			  , 0  ) -- end decode
9249 			    , 0  ) -- end nvl
9250 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9251 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom9
9252 	 , ROUND (
9253              NVL (
9254             DECODE (
9255                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9256 			  , '00'   , fact.custom10
9257 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9258 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9259 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9260 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9261 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9262 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9263 			  , '0-1'  , fact.custom10
9264 			  , '1-1'  , fact.custom10
9265 			  , 0  ) -- end decode
9266 			    , 0  ) -- end nvl
9267 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9268 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom10
9269 	 , ROUND (
9270              NVL (
9271             DECODE (
9272                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9273 			  , '00'   , fact.custom11
9274 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9275 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9276 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9277 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9278 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9279 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9280 			  , '0-1'  , fact.custom11
9281 			  , '1-1'  , fact.custom11
9282 			  , 0  ) -- end decode
9283 			    , 0  ) -- end nvl
9284 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9285 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom11
9286 	 , ROUND (
9287              NVL (
9288             DECODE (
9289                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9290 			  , '00'   , fact.custom12
9291 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9292 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9293 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9294 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9295 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9296 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9297 			  , '0-1'  , fact.custom12
9298 			  , '1-1'  , fact.custom12
9299 			  , 0  ) -- end decode
9300 			    , 0  ) -- end nvl
9301 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9302 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom12
9303 	 , ROUND (
9304              NVL (
9305             DECODE (
9306                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9307 			  , '00'   , fact.custom13
9308 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9309 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9310 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9311 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9312 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9313 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9314 			  , '0-1'  , fact.custom13
9315 			  , '1-1'  , fact.custom13
9316 			  , 0  ) -- end decode
9317 			    , 0  ) -- end nvl
9318 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9319 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom13
9320 	 , ROUND (
9321              NVL (
9322             DECODE (
9323                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9324 			  , '00'   , fact.custom14
9325 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9326 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9327 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9328 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9329 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9330 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9331 			  , '0-1'  , fact.custom14
9332 			  , '1-1'  , fact.custom14
9333 			  , 0  ) -- end decode
9334 			    , 0  ) -- end nvl
9335 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9336 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom14
9337 	 , ROUND (
9338              NVL (
9339             DECODE (
9340                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9341 			  , '00'   , fact.custom15
9342 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9343 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9344 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9345 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9346 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9347 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9348 			  , '0-1'  , fact.custom15
9349 			  , '1-1'  , fact.custom15
9350 			  , 0  ) -- end decode
9351 			    , 0  ) -- end nvl
9352 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9353 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom15
9354      , 'CF'   line_type
9355 	 , fact.time_dangling_flag time_dangling_flag
9356 	 , fact.rate_dangling_flag rate_dangling_flag
9357                 FROM   pji_fp_aggr_pjp1_t fact
9358         , pji_time_cal_period  non_pa_cal
9359    	 , pji_org_extr_info  orginfo
9360    	 , pji_time_cal_period  pa_cal
9361        , pji_fm_extr_plnver3_t  ver
9362    WHERE  1=1
9363       AND fact.CALENDAR_TYPE <> p_calendar_type
9364       AND fact.worker_id = g_worker_id
9365       AND fact.CALENDAR_TYPE IN ('P', 'G')
9366       AND non_pa_cal.cal_period_id = fact.time_id
9367       AND orginfo.org_id = fact.PROJECT_ORG_ID
9368       AND DECODE(fact.calendar_type, 'P', orginfo.gl_calendar_id, 'G', orginfo.pa_calendar_id) = pa_cal.calendar_id
9369       AND (
9370 	       ( pa_cal.start_date >= non_pa_cal.start_date  AND pa_cal.end_date <= non_pa_cal.end_date )
9371 	    OR ( pa_cal.start_date <= non_pa_cal.start_date  AND pa_cal.end_date >= non_pa_cal.end_date )
9372 	    OR ( pa_cal.start_date <= non_pa_cal.start_date  AND pa_cal.end_date <= non_pa_cal.end_date AND pa_cal.end_date >= non_pa_cal.start_date )
9373 	    OR ( pa_cal.start_date >= non_pa_cal.start_date  AND pa_cal.end_date >= non_pa_cal.end_date AND pa_cal.start_date <= non_pa_cal.end_date )
9374           )
9375 	AND fact.time_dangling_flag IS NULL
9376 	AND fact.rate_dangling_flag IS NULL
9377       AND fact.period_type_id = 32
9378       AND fact.line_type like 'OF%'
9379       AND fact.plan_version_id = ver.plan_version_id
9380       AND ver.wp_flag = 'N'
9381       AND ver.baselined_flag = 'Y'
9382 	-- AND (ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
9383       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
9384 	  ) a
9385 	  GROUP BY
9386 	   a.PROJECT_ID
9387      , a.PROJECT_ORG_ID
9388      , a.PROJECT_ORGANIZATION_ID
9389      , a.PROJECT_ELEMENT_ID
9390      , a.TIME_ID
9391      , a.PERIOD_TYPE_ID
9392      , a.CALENDAR_TYPE
9393      , a.RBS_AGGR_LEVEL
9394      , a.WBS_ROLLUP_FLAG
9395      , a.PRG_ROLLUP_FLAG
9396      , a.CURR_RECORD_TYPE_ID
9397      , a.CURRENCY_CODE
9398      , a.RBS_ELEMENT_ID
9399      , a.RBS_VERSION_ID
9400      , a.PLAN_VERSION_ID
9401      , a.PLAN_TYPE_ID
9402 	 , a.LINE_TYPE
9403 	 , a.TIME_DANGLING_FLAG
9404 	 , a.RATE_DANGLING_FLAG;
9405   End for 4005006*/
9406 
9407     INSERT INTO pji_fp_aggr_pjp1_t
9408     (
9409        worker_id
9410      , PROJECT_ID
9411      , PROJECT_ORG_ID
9412      , PROJECT_ORGANIZATION_ID
9413      -- , PARTITION_ID
9414      , PROJECT_ELEMENT_ID
9415      , TIME_ID
9416      , PERIOD_TYPE_ID
9417      , CALENDAR_TYPE
9418      , RBS_AGGR_LEVEL
9419      , WBS_ROLLUP_FLAG
9420      , PRG_ROLLUP_FLAG
9421      , CURR_RECORD_TYPE_ID
9422      , CURRENCY_CODE
9423      , RBS_ELEMENT_ID
9424      , RBS_VERSION_ID
9425      , PLAN_VERSION_ID
9426      , PLAN_TYPE_ID
9427      , RAW_COST
9428      , BRDN_COST
9429      , REVENUE
9430      , BILL_RAW_COST
9431      , BILL_BRDN_COST
9432      , BILL_LABOR_RAW_COST
9433      , BILL_LABOR_BRDN_COST
9434      , BILL_LABOR_HRS
9435      , EQUIPMENT_RAW_COST
9436      , EQUIPMENT_BRDN_COST
9437      , CAPITALIZABLE_RAW_COST
9438      , CAPITALIZABLE_BRDN_COST
9439      , LABOR_RAW_COST
9440      , LABOR_BRDN_COST
9441      , LABOR_HRS
9442      , LABOR_REVENUE
9443      , EQUIPMENT_HOURS
9444      , BILLABLE_EQUIPMENT_HOURS
9445      , SUP_INV_COMMITTED_COST
9446      , PO_COMMITTED_COST
9447      , PR_COMMITTED_COST
9448      , OTH_COMMITTED_COST
9449      , ACT_LABOR_HRS
9450      , ACT_EQUIP_HRS
9451      , ACT_LABOR_BRDN_COST
9452      , ACT_EQUIP_BRDN_COST
9453      , ACT_BRDN_COST
9454      , ACT_RAW_COST
9455      , ACT_REVENUE
9456      , ACT_LABOR_RAW_COST
9457      , ACT_EQUIP_RAW_COST
9458      , ETC_LABOR_HRS
9459      , ETC_EQUIP_HRS
9460      , ETC_LABOR_BRDN_COST
9461      , ETC_EQUIP_BRDN_COST
9462      , ETC_BRDN_COST
9463      , ETC_RAW_COST
9464      , ETC_LABOR_RAW_COST
9465      , ETC_EQUIP_RAW_COST
9466      , CUSTOM1
9467      , CUSTOM2
9468      , CUSTOM3
9469      , CUSTOM4
9470      , CUSTOM5
9471      , CUSTOM6
9472      , CUSTOM7
9473      , CUSTOM8
9474      , CUSTOM9
9475      , CUSTOM10
9476      , CUSTOM11
9477      , CUSTOM12
9478      , CUSTOM13
9479      , CUSTOM14
9480      , CUSTOM15
9481      , TIME_DANGLING_FLAG
9482      , RATE_DANGLING_FLAG
9483      , PRG_LEVEL
9484      , PLAN_TYPE_CODE        /* 4471527 */
9485 	)
9486    SELECT
9487        g_worker_id worker_id
9488      , a.PROJECT_ID
9489      , a.PROJECT_ORG_ID
9490      , a.PROJECT_ORGANIZATION_ID
9491      , a.PROJECT_ELEMENT_ID
9492      , a.TIME_ID
9493      , a.PERIOD_TYPE_ID
9494      , a.CALENDAR_TYPE
9495      , a.RBS_AGGR_LEVEL
9496      , a.WBS_ROLLUP_FLAG
9497      , a.PRG_ROLLUP_FLAG
9498      , a.CURR_RECORD_TYPE_ID
9499      , a.CURRENCY_CODE
9500      , a.RBS_ELEMENT_ID
9501      , a.RBS_VERSION_ID
9502      , a.PLAN_VERSION_ID
9503      , a.PLAN_TYPE_ID
9504      , SUM(a.RAW_COST       )
9505      , SUM(a.BRDN_COST 	)
9506      , SUM(a.REVENUE	)
9507      , SUM(a.BILL_RAW_COST )
9508      , SUM(a.BILL_BRDN_COST )
9509      , SUM(a.BILL_LABOR_RAW_COST )
9510      , SUM(a.BILL_LABOR_BRDN_COST )
9511      , SUM(a.BILL_LABOR_HRS )
9512      , SUM(a.EQUIPMENT_RAW_COST )
9513      , SUM(a.EQUIPMENT_BRDN_COST )
9514      , SUM(a.CAPITALIZABLE_RAW_COST )
9515      , SUM(a.CAPITALIZABLE_BRDN_COST )
9516      , SUM(a.LABOR_RAW_COST )
9517      , SUM(a.LABOR_BRDN_COST)
9518      , SUM(a.LABOR_HRS )
9519      , SUM(a.LABOR_REVENUE )
9520      , SUM(a.EQUIPMENT_HOURS )
9521      , SUM(a.BILLABLE_EQUIPMENT_HOURS)
9522      , SUM(a.SUP_INV_COMMITTED_COST)
9523      , SUM(a.PO_COMMITTED_COST )
9524      , SUM(a.PR_COMMITTED_COST )
9525      , SUM(a.OTH_COMMITTED_COST)
9526      , SUM(a.ACT_LABOR_HRS)
9527      , SUM(a.ACT_EQUIP_HRS)
9528      , SUM(a.ACT_LABOR_BRDN_COST)
9529      , SUM(a.ACT_EQUIP_BRDN_COST)
9530      , SUM(a.ACT_BRDN_COST    )
9531      , SUM(a.ACT_RAW_COST    )
9532      , SUM(a.ACT_REVENUE    )
9533      , SUM(a.ACT_LABOR_RAW_COST)
9534      , SUM(a.ACT_EQUIP_RAW_COST)
9535      , SUM(a.ETC_LABOR_HRS         )
9536      , SUM(a.ETC_EQUIP_HRS        )
9537      , SUM(a.ETC_LABOR_BRDN_COST )
9538      , SUM(a.ETC_EQUIP_BRDN_COST)
9539      , SUM(a.ETC_BRDN_COST )
9540      , SUM(a.ETC_RAW_COST)
9541      , SUM(a.ETC_LABOR_RAW_COST)
9542      , SUM(a.ETC_EQUIP_RAW_COST)
9543      , SUM(a.CUSTOM1	)
9544      , SUM(a.CUSTOM2	)
9545      , SUM(a.CUSTOM3	)
9546      , SUM(a.CUSTOM4	)
9547      , SUM(a.CUSTOM5	)
9548      , SUM(a.CUSTOM6	)
9549      , SUM(a.CUSTOM7	)
9550      , SUM(a.CUSTOM8	)
9551      , SUM(a.CUSTOM9	)
9552      , SUM(a.CUSTOM10	)
9553      , SUM(a.CUSTOM11	)
9554      , SUM(a.CUSTOM12	)
9555      , SUM(a.CUSTOM13	)
9556      , SUM(a.CUSTOM14	)
9557      , SUM(a.CUSTOM15	)
9558      , a.TIME_DANGLING_FLAG
9559      , a.RATE_DANGLING_FLAG
9560      , g_default_prg_level prg_level
9561      , a.plan_type_code plan_type_code   /* 4471527 */
9562    FROM (
9563    SELECT
9564            fact.project_id  project_id
9565    	 , fact.project_ORG_ID project_ORG_ID
9566    	 , fact.project_ORGANIZATION_ID project_ORGANIZATION_ID
9567       -- , fact.PARTITION_ID PARTITION_ID
9568    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
9569    	 , calDet.sec_cal_period_id TIME_ID
9570    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
9571    	 , DECODE(fact.CALENDAR_TYPE, 'P', 'G', 'G', 'P') CALENDAR_TYPE
9572          , fact.RBS_AGGR_LEVEL
9573          , fact.WBS_ROLLUP_FLAG
9574          , fact.PRG_ROLLUP_FLAG
9575    	 , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
9576    	 , fact.CURRENCY_CODE CURRENCY_CODE
9577    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
9578    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
9579    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
9580 	 , fact.PLAN_TYPE_ID  PLAN_TYPE_ID
9581 	 , ROUND (nvl(fact.raw_cost,0)*calDet.factor/cur.mau)*cur.mau raw_cost
9582 	 , ROUND (nvl(fact.brdn_cost,0)*calDet.factor/cur.mau)*cur.mau brdn_cost
9583 	 , ROUND (nvl(fact.revenue,0)*calDet.factor/cur.mau)*cur.mau revenue
9584 	 , ROUND (nvl(fact.bill_raw_cost,0)*calDet.factor/cur.mau)*cur.mau bill_raw_cost
9585 	 , ROUND (nvl(fact.bill_brdn_cost,0)*calDet.factor/cur.mau)*cur.mau bill_brdn_cost
9586 	 , ROUND (nvl(fact.bill_labor_raw_cost,0)*calDet.factor/cur.mau)*cur.mau bill_labor_raw_cost
9587 	 , ROUND (nvl(fact.bill_labor_brdn_cost,0)*calDet.factor/cur.mau)*cur.mau bill_labor_brdn_cost
9588 	 , ROUND (nvl(fact.bill_labor_hrs,0)*calDet.factor/cur.mau)*cur.mau bill_labor_hrs
9589 	 , ROUND (nvl(fact.equipment_raw_cost,0)*calDet.factor/cur.mau)*cur.mau equipment_raw_cost
9590 	 , ROUND (nvl(fact.equipment_brdn_cost,0)*calDet.factor/cur.mau)*cur.mau equipment_brdn_cost
9591 	 , ROUND (nvl(fact.capitalizable_raw_cost,0)*calDet.factor/cur.mau)*cur.mau capitalizable_raw_cost
9592 	 , ROUND (nvl(fact.capitalizable_brdn_cost,0)*calDet.factor/cur.mau)*cur.mau capitalizable_brdn_cost
9593 	 , ROUND (nvl(fact.labor_raw_cost,0)*calDet.factor/cur.mau)*cur.mau labor_raw_cost
9594 	 , ROUND (nvl(fact.labor_brdn_cost,0)*calDet.factor/cur.mau)*cur.mau labor_brdn_cost
9595 	 , ROUND (nvl(fact.labor_hrs,0)*calDet.factor/cur.mau)*cur.mau labor_hrs
9596 	 , ROUND (nvl(fact.labor_revenue,0)*calDet.factor/cur.mau)*cur.mau labor_revenue
9597 	 , ROUND (nvl(fact.equipment_hours,0)*calDet.factor/cur.mau)*cur.mau equipment_hours
9598 	 , ROUND (nvl(fact.billable_equipment_hours,0)*calDet.factor/cur.mau)*cur.mau billable_equipment_hours
9599 	 , ROUND (nvl(fact.sup_inv_committed_cost,0)*calDet.factor/cur.mau)*cur.mau sup_inv_committed_cost
9600 	 , ROUND (nvl(fact.po_committed_cost,0)*calDet.factor/cur.mau)*cur.mau po_committed_cost
9601 	 , ROUND (nvl(fact.pr_committed_cost,0)*calDet.factor/cur.mau)*cur.mau pr_committed_cost
9602 	 , ROUND (nvl(fact.oth_committed_cost,0)*calDet.factor/cur.mau)*cur.mau oth_committed_cost
9603 	 , ROUND (nvl(fact.ACT_LABOR_HRS,0)*calDet.factor/cur.mau)*cur.mau ACT_LABOR_HRS
9604 	 , ROUND (nvl(fact.ACT_EQUIP_HRS,0)*calDet.factor/cur.mau)*cur.mau ACT_EQUIP_HRS
9605 	 , ROUND (nvl(fact.ACT_LABOR_BRDN_COST,0)*calDet.factor/cur.mau)*cur.mau ACT_LABOR_BRDN_COST
9606 	 , ROUND (nvl(fact.ACT_EQUIP_BRDN_COST,0)*calDet.factor/cur.mau)*cur.mau ACT_EQUIP_BRDN_COST
9607 	 , ROUND (nvl(fact.ACT_BRDN_COST,0)*calDet.factor/cur.mau)*cur.mau ACT_BRDN_COST
9608 	 , ROUND (nvl(fact.ACT_RAW_COST,0)*calDet.factor/cur.mau)*cur.mau ACT_RAW_COST
9609 	 , ROUND (nvl(fact.ACT_REVENUE,0)*calDet.factor/cur.mau)*cur.mau ACT_REVENUE
9610 	 , ROUND (nvl(fact.ACT_LABOR_RAW_COST,0)*calDet.factor/cur.mau)*cur.mau ACT_LABOR_RAW_COST
9611 	 , ROUND (nvl(fact.ACT_EQUIP_RAW_COST,0)*calDet.factor/cur.mau)*cur.mau ACT_EQUIP_RAW_COST
9612 	 , ROUND (nvl(fact.ETC_LABOR_HRS,0)*calDet.factor/cur.mau)*cur.mau ETC_LABOR_HRS
9613 	 , ROUND (nvl(fact.ETC_EQUIP_HRS,0)*calDet.factor/cur.mau)*cur.mau ETC_EQUIP_HRS
9614 	 , ROUND (nvl(fact.ETC_LABOR_BRDN_COST,0)*calDet.factor/cur.mau)*cur.mau ETC_LABOR_BRDN_COST
9615 	 , ROUND (nvl(fact.ETC_EQUIP_BRDN_COST,0)*calDet.factor/cur.mau)*cur.mau ETC_EQUIP_BRDN_COST
9616 	 , ROUND (nvl(fact.ETC_BRDN_COST,0)*calDet.factor/cur.mau)*cur.mau ETC_BRDN_COST
9617 	 , ROUND (nvl(fact.ETC_RAW_COST,0)*calDet.factor/cur.mau)*cur.mau ETC_RAW_COST
9618 	 , ROUND (nvl(fact.ETC_LABOR_RAW_COST,0)*calDet.factor/cur.mau)*cur.mau ETC_LABOR_RAW_COST
9619 	 , ROUND (nvl(fact.ETC_EQUIP_RAW_COST,0)*calDet.factor/cur.mau)*cur.mau ETC_EQUIP_RAW_COST
9620 	 , ROUND (nvl(fact.custom1,0)*calDet.factor/cur.mau)*cur.mau custom1
9621 	 , ROUND (nvl(fact.custom2,0)*calDet.factor/cur.mau)*cur.mau custom2
9622 	 , ROUND (nvl(fact.custom3,0)*calDet.factor/cur.mau)*cur.mau custom3
9623 	 , ROUND (nvl(fact.custom4,0)*calDet.factor/cur.mau)*cur.mau custom4
9624 	 , ROUND (nvl(fact.custom5,0)*calDet.factor/cur.mau)*cur.mau custom5
9625 	 , ROUND (nvl(fact.custom6,0)*calDet.factor/cur.mau)*cur.mau custom6
9626 	 , ROUND (nvl(fact.custom7,0)*calDet.factor/cur.mau)*cur.mau custom7
9627 	 , ROUND (nvl(fact.custom8,0)*calDet.factor/cur.mau)*cur.mau custom8
9628 	 , ROUND (nvl(fact.custom9,0)*calDet.factor/cur.mau)*cur.mau custom9
9629 	 , ROUND (nvl(fact.custom10,0)*calDet.factor/cur.mau)*cur.mau custom10
9630 	 , ROUND (nvl(fact.custom11,0)*calDet.factor/cur.mau)*cur.mau custom11
9631 	 , ROUND (nvl(fact.custom12,0)*calDet.factor/cur.mau)*cur.mau custom12
9632 	 , ROUND (nvl(fact.custom13,0)*calDet.factor/cur.mau)*cur.mau custom13
9633 	 , ROUND (nvl(fact.custom14,0)*calDet.factor/cur.mau)*cur.mau custom14
9634 	 , ROUND (nvl(fact.custom15,0)*calDet.factor/cur.mau)*cur.mau custom15
9635 	 , fact.time_dangling_flag time_dangling_flag
9636 	 , fact.rate_dangling_flag rate_dangling_flag
9637               , fact.plan_type_code  plan_type_code    /* 4471527 */
9638    FROM   pji_fp_aggr_pjp1_t fact,
9639          (SELECT /*+ NO_MERGE */ (LEAST(pri.end_date,sec.end_date) - Greatest(pri.start_date,sec.start_date)+1)
9640 	                      / (pri.end_date - pri.start_date+1) factor,
9641 	         ppa.project_id,
9642 	         ver.rbs_struct_Version_id rbs_struct_version_id,
9643 		 ver.plan_version_id plan_Version_id,
9644                            ver.plan_type_code   plan_type_code,   /* 4471527 */
9645 		 pri.cal_period_id pri_cal_period_id,
9646 		 sec.cal_period_id sec_cal_period_id,
9647 		 orginfo.org_id
9648 	    FROM
9649                  pji_time_cal_period_v  pri
9650                , pji_org_extr_info  orginfo
9651                , pji_time_cal_period_v  sec
9652                , pji_fm_extr_plnver3_t  ver
9653 	       , pa_projects_all ppa
9654            WHERE  1=1
9655              AND ppa.org_id=orginfo.org_id
9656              AND pri.calendar_id in (orginfo.gl_calendar_id,orginfo.pa_calendar_id)
9657              AND sec.calendar_id in (orginfo.gl_calendar_id,orginfo.pa_calendar_id)
9658              AND ppa.project_id=ver.project_id
9659              AND decode(ver.time_phased_type_code,
9660                        'P',orginfo.pa_calendar_id,'G',orginfo.gl_calendar_id)=pri.calendar_id
9661              AND decode(ver.time_phased_type_code,
9662                        'G',orginfo.pa_calendar_id,'P',orginfo.gl_calendar_id)=sec.calendar_id
9663              AND ver.wp_flag = 'N'
9664              AND ( sec.start_date <= pri.end_date AND sec.end_date >= pri.start_date )
9665              AND ver.baselined_flag = 'Y') calDet,
9666 	   (SELECT currency_code,
9667 	           decode(nvl(MINIMUM_ACCOUNTABLE_UNIT, power(10, (-1 * PRECISION))),
9668 		      null, 0.01,
9669 		         0, 1,
9670 			 nvl(MINIMUM_ACCOUNTABLE_UNIT, power(10, (-1 * PRECISION)))) mau
9671 	      FROM FND_CURRENCIES) cur
9672     WHERE 1=1
9673       AND calDet.factor > 0
9674       -- AND (calDet.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
9675       AND NVL(calDet.rbs_struct_version_id, -1) = fact.rbs_version_id
9676       AND fact.CALENDAR_TYPE <> p_calendar_type
9677       AND fact.worker_id = g_worker_id
9678       AND fact.CALENDAR_TYPE IN ('P', 'G')
9679       AND CalDet.pri_cal_period_id = fact.time_id
9680       AND calDet.org_id = fact.PROJECT_ORG_ID
9681       AND fact.time_dangling_flag IS NULL
9682       AND fact.rate_dangling_flag IS NULL
9683       AND fact.period_type_id = 32
9684       AND fact.line_type like 'OF%' -- 4518721
9685       AND fact.plan_version_id = calDet.plan_version_id
9686       AND fact.plan_type_code = calDet.plan_type_code    /* 4471527 */
9687       AND cur.currency_code = fact.currency_code
9688 	  ) a
9689 	  GROUP BY
9690 	   a.PROJECT_ID
9691      , a.PROJECT_ORG_ID
9692      , a.PROJECT_ORGANIZATION_ID
9693      , a.PROJECT_ELEMENT_ID
9694      , a.TIME_ID
9695      , a.PERIOD_TYPE_ID
9696      , a.CALENDAR_TYPE
9697      , a.RBS_AGGR_LEVEL
9698      , a.WBS_ROLLUP_FLAG
9699      , a.PRG_ROLLUP_FLAG
9700      , a.CURR_RECORD_TYPE_ID
9701      , a.CURRENCY_CODE
9702      , a.RBS_ELEMENT_ID
9703      , a.RBS_VERSION_ID
9704      , a.PLAN_VERSION_ID
9705      , a.PLAN_TYPE_ID
9706      , a.PLAN_TYPE_CODE    /* 4471527 */
9707      , a.TIME_DANGLING_FLAG
9708      , a.RATE_DANGLING_FLAG;
9709 
9710 
9711 
9712 
9713 EXCEPTION
9714   WHEN OTHERS THEN
9715     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
9716                              p_procedure_name => ' PRORATE_TO_PAGL_PGE_PJP1_D ');
9717     RAISE;
9718 END;
9719 
9720 
9721 PROCEDURE PRORATE_TO_PAGL_PGE_FPRL_D (p_calendar_type   IN   VARCHAR2 := NULL) IS
9722 BEGIN
9723 
9724     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
9725 
9726     INSERT INTO pji_fp_aggr_pjp1_t
9727     (
9728        worker_id
9729      , PROJECT_ID
9730      , PROJECT_ORG_ID
9731      , PROJECT_ORGANIZATION_ID
9732      -- , PARTITION_ID
9733      , PROJECT_ELEMENT_ID
9734      , TIME_ID
9735      , PERIOD_TYPE_ID
9736      , CALENDAR_TYPE
9737      , RBS_AGGR_LEVEL
9738      , WBS_ROLLUP_FLAG
9739      , PRG_ROLLUP_FLAG
9740      , CURR_RECORD_TYPE_ID
9741      , CURRENCY_CODE
9742      , RBS_ELEMENT_ID
9743      , RBS_VERSION_ID
9744      , PLAN_VERSION_ID
9745      , PLAN_TYPE_ID
9746      , RAW_COST
9747      , BRDN_COST
9748      , REVENUE
9749      , BILL_RAW_COST
9750      , BILL_BRDN_COST
9751      , BILL_LABOR_RAW_COST
9752      , BILL_LABOR_BRDN_COST
9753      , BILL_LABOR_HRS
9754      , EQUIPMENT_RAW_COST
9755      , EQUIPMENT_BRDN_COST
9756      , CAPITALIZABLE_RAW_COST
9757      , CAPITALIZABLE_BRDN_COST
9758      , LABOR_RAW_COST
9759      , LABOR_BRDN_COST
9760      , LABOR_HRS
9761      , LABOR_REVENUE
9762      , EQUIPMENT_HOURS
9763      , BILLABLE_EQUIPMENT_HOURS
9764      , SUP_INV_COMMITTED_COST
9765      , PO_COMMITTED_COST
9766      , PR_COMMITTED_COST
9767      , OTH_COMMITTED_COST
9768        , ACT_LABOR_HRS
9769 	   , ACT_EQUIP_HRS
9770 	   , ACT_LABOR_BRDN_COST
9771 	   , ACT_EQUIP_BRDN_COST
9772 	   , ACT_BRDN_COST
9773 	   , ACT_RAW_COST
9774 	   , ACT_REVENUE
9775          , ACT_LABOR_RAW_COST
9776          , ACT_EQUIP_RAW_COST
9777 	   , ETC_LABOR_HRS
9778 	   , ETC_EQUIP_HRS
9779 	   , ETC_LABOR_BRDN_COST
9780 	   , ETC_EQUIP_BRDN_COST
9781 	   , ETC_BRDN_COST
9782          , ETC_RAW_COST
9783          , ETC_LABOR_RAW_COST
9784          , ETC_EQUIP_RAW_COST
9785      , CUSTOM1
9786      , CUSTOM2
9787      , CUSTOM3
9788      , CUSTOM4
9789      , CUSTOM5
9790      , CUSTOM6
9791      , CUSTOM7
9792      , CUSTOM8
9793      , CUSTOM9
9794      , CUSTOM10
9795      , CUSTOM11
9796      , CUSTOM12
9797      , CUSTOM13
9798      , CUSTOM14
9799      , CUSTOM15
9800      , LINE_TYPE
9801      , TIME_DANGLING_FLAG
9802      , RATE_DANGLING_FLAG
9803      , PRG_LEVEL
9804      , PLAN_TYPE_CODE   /* 4471527 */
9805    )
9806    SELECT
9807        g_worker_id worker_id
9808      , a.PROJECT_ID
9809      , a.PROJECT_ORG_ID
9810      , a.PROJECT_ORGANIZATION_ID
9811      , a.PROJECT_ELEMENT_ID
9812      , a.TIME_ID
9813      , a.PERIOD_TYPE_ID
9814      , a.CALENDAR_TYPE
9815      , a.RBS_AGGR_LEVEL
9816      , a.WBS_ROLLUP_FLAG
9817      , a.PRG_ROLLUP_FLAG
9818      , a.CURR_RECORD_TYPE_ID
9819      , a.CURRENCY_CODE
9820      , a.RBS_ELEMENT_ID
9821      , a.RBS_VERSION_ID
9822      , a.PLAN_VERSION_ID
9823      , a.PLAN_TYPE_ID
9824      , SUM(a.RAW_COST       )
9825      , SUM(a.BRDN_COST 	)
9826      , SUM(a.REVENUE	)
9827      , SUM(a.BILL_RAW_COST )
9828      , SUM(a.BILL_BRDN_COST )
9829      , SUM(a.BILL_LABOR_RAW_COST )
9830      , SUM(a.BILL_LABOR_BRDN_COST )
9831      , SUM(a.BILL_LABOR_HRS )
9832      , SUM(a.EQUIPMENT_RAW_COST )
9833      , SUM(a.EQUIPMENT_BRDN_COST )
9834      , SUM(a.CAPITALIZABLE_RAW_COST )
9835      , SUM(a.CAPITALIZABLE_BRDN_COST )
9836      , SUM(a.LABOR_RAW_COST )
9837      , SUM(a.LABOR_BRDN_COST)
9838      , SUM(a.LABOR_HRS )
9839      , SUM(a.LABOR_REVENUE )
9840      , SUM(a.EQUIPMENT_HOURS )
9841      , SUM(a.BILLABLE_EQUIPMENT_HOURS)
9842      , SUM(a.SUP_INV_COMMITTED_COST)
9843      , SUM(a.PO_COMMITTED_COST )
9844      , SUM(a.PR_COMMITTED_COST )
9845      , SUM(a.OTH_COMMITTED_COST)
9846        , SUM(a.ACT_LABOR_HRS)
9847 	   , SUM(a.ACT_EQUIP_HRS)
9848 	   , SUM(a.ACT_LABOR_BRDN_COST)
9849 	   , SUM(a.ACT_EQUIP_BRDN_COST)
9850 	   , SUM(a.ACT_BRDN_COST    )
9851 	   , SUM(a.ACT_RAW_COST    )
9852 	   , SUM(a.ACT_REVENUE    )
9853          , SUM(a.ACT_LABOR_RAW_COST)
9854          , SUM(a.ACT_EQUIP_RAW_COST)
9855 	   , SUM(a.ETC_LABOR_HRS         )
9856 	   , SUM(a.ETC_EQUIP_HRS        )
9857 	   , SUM(a.ETC_LABOR_BRDN_COST )
9858 	   , SUM(a.ETC_EQUIP_BRDN_COST)
9859 	   , SUM(a.ETC_BRDN_COST )
9860          , SUM(a.ETC_RAW_COST)
9861          , SUM(a.ETC_LABOR_RAW_COST)
9862          , SUM(a.ETC_EQUIP_RAW_COST)
9863      , SUM(a.CUSTOM1	)
9864      , SUM(a.CUSTOM2	)
9865      , SUM(a.CUSTOM3	)
9866      , SUM(a.CUSTOM4	)
9867      , SUM(a.CUSTOM5	)
9868      , SUM(a.CUSTOM6	)
9869      , SUM(a.CUSTOM7	)
9870      , SUM(a.CUSTOM8	)
9871      , SUM(a.CUSTOM9	)
9872      , SUM(a.CUSTOM10	)
9873      , SUM(a.CUSTOM11	)
9874      , SUM(a.CUSTOM12	)
9875      , SUM(a.CUSTOM13	)
9876      , SUM(a.CUSTOM14	)
9877      , SUM(a.CUSTOM15	)
9878 	 , a.LINE_TYPE
9879 	 , a.TIME_DANGLING_FLAG
9880 	 , a.RATE_DANGLING_FLAG
9881        , g_default_prg_level prg_level
9882        , a.plan_type_code plan_type_code    /* 4471527 */
9883    FROM (
9884    SELECT
9885          fact.project_id  project_id
9886    	 , fact.project_ORG_ID project_ORG_ID
9887    	 , fact.project_ORGANIZATION_ID project_ORGANIZATION_ID
9888      -- , fact.PARTITION_ID PARTITION_ID
9889    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
9890    	 , pa_cal.cal_period_id TIME_ID
9891    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
9892    	 , DECODE(fact.CALENDAR_TYPE, 'P', 'G', 'G', 'P') CALENDAR_TYPE
9893      , fact.RBS_AGGR_LEVEL
9894      , fact.WBS_ROLLUP_FLAG
9895      , fact.PRG_ROLLUP_FLAG
9896    	 , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
9897    	 , fact.CURRENCY_CODE CURRENCY_CODE
9898    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
9899    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
9900    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
9901 	 , fact.PLAN_TYPE_ID  PLAN_TYPE_ID
9902 	 , ROUND (
9903              NVL (
9904             DECODE (
9905                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9906 			  , '00'   , fact.raw_cost
9907 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9908 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9909 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9910 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9911 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9912 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9913 			  , '0-1'  , fact.raw_cost
9914 			  , '1-1'  , fact.raw_cost
9915 			  , 0  ) -- end decode
9916 			    , 0  ) -- end nvl
9917 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9918 						* PJI_UTILS.GET_MAU (fact.currency_code)	raw_cost
9919 	 , ROUND (
9920              NVL (
9921             DECODE (
9922                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9923 			 , '00'   , fact.brdn_cost
9924 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9925 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9926 			 , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9927 			 , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9928 			 , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9929 			 , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9930 			 , '0-1'  , fact.brdn_cost
9931 			 , '1-1'  , fact.brdn_cost
9932 			 , 0  ) -- end decode
9933 			  , 0  ) -- end nvl
9934 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9935 						* PJI_UTILS.GET_MAU (fact.currency_code)	brdn_cost
9936 	 , ROUND (
9937              NVL (
9938             DECODE (
9939                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9940 			 , '00'   , fact.revenue
9941 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9942 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9943 			 , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9944 			 , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9945 			 , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9946 			 , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9947 			 , '0-1'  , fact.revenue
9948 			 , '1-1'  , fact.revenue
9949 			 , 0  ) -- end decode
9950 			  , 0  ) -- end nvl
9951 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9952 						* PJI_UTILS.GET_MAU (fact.currency_code)	revenue
9953 	 , ROUND (
9954              NVL (
9955             DECODE (
9956                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9957 			  , '00'   , fact.bill_raw_cost
9958 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9959 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9960 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9961 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9962 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9963 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9964 			  , '0-1'  , fact.bill_raw_cost
9965 			  , '1-1'  , fact.bill_raw_cost
9966 			  , 0  ) -- end decode
9967 			    , 0  ) -- end nvl
9968 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9969 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_raw_cost
9970 	 , ROUND (
9971              NVL (
9972             DECODE (
9973                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9974 			  , '00'   , fact.bill_brdn_cost
9975 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9976 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9977 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9978 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9979 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9980 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9981 			  , '0-1'  , fact.bill_brdn_cost
9982 			  , '1-1'  , fact.bill_brdn_cost
9983 			  , 0  ) -- end decode
9984 			    , 0  ) -- end nvl
9985 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
9986 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_brdn_cost
9987 	 , ROUND (
9988              NVL (
9989             DECODE (
9990                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
9991 			  , '00'   , fact.bill_labor_raw_cost
9992 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9993 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9994 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9995 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9996 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9997 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
9998 			  , '0-1'  , fact.bill_labor_raw_cost
9999 			  , '1-1'  , fact.bill_labor_raw_cost
10000 			  , 0  ) -- end decode
10001 			    , 0  ) -- end nvl
10002 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10003 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_raw_cost
10004 	 , ROUND (
10005              NVL (
10006             DECODE (
10007                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10008 			  , '00'   , fact.bill_labor_brdn_cost
10009 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10010 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10011 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10012 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10013 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10014 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10015 			  , '0-1'  , fact.bill_labor_brdn_cost
10016 			  , '1-1'  , fact.bill_labor_brdn_cost
10017 			  , 0  ) -- end decode
10018 			    , 0  ) -- end nvl
10019 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10020 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_brdn_cost
10021 	 , ROUND (
10022              NVL (
10023             DECODE (
10024                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10025 			  , '00'   , fact.bill_labor_hrs
10026 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10027 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10028 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10029 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10030 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10031 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10032 			  , '0-1'  , fact.bill_labor_hrs
10033 			  , '1-1'  , fact.bill_labor_hrs
10034 			  , 0  ) -- end decode
10035 			    , 0  ) -- end nvl
10036 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10037 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_hrs
10038 	 , ROUND (
10039              NVL (
10040             DECODE (
10041                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10042 			  , '00'   , fact.equipment_raw_cost
10043 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10044 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10045 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10046 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10047 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10048 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10049 			  , '0-1'  , fact.equipment_raw_cost
10050 			  , '1-1'  , fact.equipment_raw_cost
10051 			  , 0  ) -- end decode
10052 			    , 0  ) -- end nvl
10053 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10054 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_raw_cost
10055 	 , ROUND (
10056              NVL (
10057             DECODE (
10058                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10059 			  , '00'   , fact.equipment_brdn_cost
10060 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10061 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10062 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10063 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10064 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10065 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10066 			  , '0-1'  , fact.equipment_brdn_cost
10067 			  , '1-1'  , fact.equipment_brdn_cost
10068 			  , 0  ) -- end decode
10069 			    , 0  ) -- end nvl
10070 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10071 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_brdn_cost
10072 	 , ROUND (
10073              NVL (
10074             DECODE (
10075                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10076 			  , '00'   , fact.capitalizable_raw_cost
10077 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10078 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10079 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10080 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10081 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10082 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10083 			  , '0-1'  , fact.capitalizable_raw_cost
10084 			  , '1-1'  , fact.capitalizable_raw_cost
10085 			  , 0  ) -- end decode
10086 			    , 0  ) -- end nvl
10087 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10088 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_raw_cost
10089 	 , ROUND (
10090              NVL (
10091             DECODE (
10092                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10093 			  , '00'   , fact.capitalizable_brdn_cost
10094 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10095 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10096 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10097 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10098 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10099 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10100 			  , '0-1'  , fact.capitalizable_brdn_cost
10101 			  , '1-1'  , fact.capitalizable_brdn_cost
10102 			  , 0  ) -- end decode
10103 			    , 0  ) -- end nvl
10104 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10105 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_brdn_cost
10106 	 , ROUND (
10107              NVL (
10108             DECODE (
10109                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10110 			  , '00'   , fact.labor_raw_cost
10111 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10112 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10113 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10114 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10115 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10116 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10117 			  , '0-1'  , fact.labor_raw_cost
10118 			  , '1-1'  , fact.labor_raw_cost
10119 			  , 0  ) -- end decode
10120 			    , 0  ) -- end nvl
10121 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10122 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_raw_cost
10123 	 , ROUND (
10124              NVL (
10125             DECODE (
10126                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10127 			  , '00'   , fact.labor_brdn_cost
10128 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10129 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10130 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10131 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10132 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10133 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10134 			  , '0-1'  , fact.labor_brdn_cost
10135 			  , '1-1'  , fact.labor_brdn_cost
10136 			  , 0  ) -- end decode
10137 			    , 0  ) -- end nvl
10138 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10139 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_brdn_cost
10140 	 , ROUND (
10141              NVL (
10142             DECODE (
10143                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10144 			  , '00'   , fact.labor_hrs
10145 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10146 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10147 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10148 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10149 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10150 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10151 			  , '0-1'  , fact.labor_hrs
10152 			  , '1-1'  , fact.labor_hrs
10153 			  , 0  ) -- end decode
10154 			    , 0  ) -- end nvl
10155 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10156 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_hrs
10157 	 , ROUND (
10158              NVL (
10159             DECODE (
10160                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10161 			  , '00'   , fact.labor_revenue
10162 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10163 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10164 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10165 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10166 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10167 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10168 			  , '0-1'  , fact.labor_revenue
10169 			  , '1-1'  , fact.labor_revenue
10170 			  , 0  ) -- end decode
10171 			    , 0  ) -- end nvl
10172 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10173 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_revenue
10174 	 , ROUND (
10175              NVL (
10176             DECODE (
10177                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10178 			  , '00'   , fact.equipment_hours
10179 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10180 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10181 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10182 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10183 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10184 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10185 			  , '0-1'  , fact.equipment_hours
10186 			  , '1-1'  , fact.equipment_hours
10187 			  , 0  ) -- end decode
10188 			    , 0  ) -- end nvl
10189 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10190 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_hours
10191 	 , ROUND (
10192              NVL (
10193             DECODE (
10194                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10195 			  , '00'   , fact.billable_equipment_hours
10196 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10197 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10198 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10199 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10200 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10201 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10202 			  , '0-1'  , fact.billable_equipment_hours
10203 			  , '1-1'  , fact.billable_equipment_hours
10204 			  , 0  ) -- end decode
10205 			    , 0  ) -- end nvl
10206 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10207 						* PJI_UTILS.GET_MAU (fact.currency_code)	billable_equipment_hours
10208 	 , ROUND (
10209              NVL (
10210             DECODE (
10211                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10212 			  , '00'   , fact.sup_inv_committed_cost
10213 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10214 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10215 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10216 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10217 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10218 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10219 			  , '0-1'  , fact.sup_inv_committed_cost
10220 			  , '1-1'  , fact.sup_inv_committed_cost
10221 			  , 0  ) -- end decode
10222 			    , 0  ) -- end nvl
10223 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10224 						* PJI_UTILS.GET_MAU (fact.currency_code)	sup_inv_committed_cost
10225 	 , ROUND (
10226              NVL (
10227             DECODE (
10228                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10229 			  , '00'   , fact.po_committed_cost
10230 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10231 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10232 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10233 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10234 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10235 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10236 			  , '0-1'  , fact.po_committed_cost
10237 			  , '1-1'  , fact.po_committed_cost
10238 			  , 0  ) -- end decode
10239 			    , 0  ) -- end nvl
10240 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10241 						* PJI_UTILS.GET_MAU (fact.currency_code)	po_committed_cost
10242 	 , ROUND (
10243              NVL (
10244             DECODE (
10245                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10246 			  , '00'   , fact.pr_committed_cost
10247 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10248 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10249 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10250 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10251 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10252 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10253 			  , '0-1'  , fact.pr_committed_cost
10254 			  , '1-1'  , fact.pr_committed_cost
10255 			  , 0  ) -- end decode
10256 			    , 0  ) -- end nvl
10257 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10258 						* PJI_UTILS.GET_MAU (fact.currency_code)	pr_committed_cost
10259 	 , ROUND (
10260              NVL (
10261             DECODE (
10262                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10263 			  , '00'   , fact.oth_committed_cost
10264 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10265 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10266 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10267 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10268 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10269 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10270 			  , '0-1'  , fact.oth_committed_cost
10271 			  , '1-1'  , fact.oth_committed_cost
10272 			  , 0  ) -- end decode
10273 			    , 0  ) -- end nvl
10274 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10275 						* PJI_UTILS.GET_MAU (fact.currency_code)	oth_committed_cost
10276 	 , ROUND (
10277              NVL (
10278             DECODE (
10279                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10280 			  , '00'   , fact.ACT_LABOR_HRS
10281 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10282 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10283 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10284 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10285 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10286 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10287 			  , '0-1'  , fact.ACT_LABOR_HRS
10288 			  , '1-1'  , fact.ACT_LABOR_HRS
10289 			  , 0  ) -- end decode
10290 			    , 0  ) -- end nvl
10291 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10292 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_HRS
10293 	 , ROUND (
10294              NVL (
10295             DECODE (
10296                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10297 			  , '00'   , fact.ACT_EQUIP_HRS
10298 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10299 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10300 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10301 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10302 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10303 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10304 			  , '0-1'  , fact.ACT_EQUIP_HRS
10305 			  , '1-1'  , fact.ACT_EQUIP_HRS
10306 			  , 0  ) -- end decode
10307 			    , 0  ) -- end nvl
10308 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10309 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_HRS
10310 	 , ROUND (
10311              NVL (
10312             DECODE (
10313                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10314 			  , '00'   , fact.ACT_LABOR_BRDN_COST
10315 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10316 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10317 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10318 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10319 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10320 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10321 			  , '0-1'  , fact.ACT_LABOR_BRDN_COST
10322 			  , '1-1'  , fact.ACT_LABOR_BRDN_COST
10323 			  , 0  ) -- end decode
10324 			    , 0  ) -- end nvl
10325 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10326 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_BRDN_COST
10327 	 , ROUND (
10328              NVL (
10329             DECODE (
10330                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10331 			  , '00'   , fact.ACT_EQUIP_BRDN_COST
10332 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10333 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10334 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10335 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10336 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10337 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10338 			  , '0-1'  , fact.ACT_EQUIP_BRDN_COST
10339 			  , '1-1'  , fact.ACT_EQUIP_BRDN_COST
10340 			  , 0  ) -- end decode
10341 			    , 0  ) -- end nvl
10342 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10343 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_BRDN_COST
10344 	 , ROUND (
10345              NVL (
10346             DECODE (
10347                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10348 			  , '00'   , fact.ACT_BRDN_COST
10349 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10350 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10351 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10352 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10353 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10354 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10355 			  , '0-1'  , fact.ACT_BRDN_COST
10356 			  , '1-1'  , fact.ACT_BRDN_COST
10357 			  , 0  ) -- end decode
10358 			    , 0  ) -- end nvl
10359 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10360 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_BRDN_COST
10361 	 , ROUND (
10362              NVL (
10363             DECODE (
10364                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10365 			  , '00'   , fact.ACT_RAW_COST
10366 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10367 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10368 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10369 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10370 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10371 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10372 			  , '0-1'  , fact.ACT_RAW_COST
10373 			  , '1-1'  , fact.ACT_RAW_COST
10374 			  , 0  ) -- end decode
10375 			    , 0  ) -- end nvl
10376 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10377 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_RAW_COST
10378 	 , ROUND (
10379              NVL (
10380             DECODE (
10381                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10382 			  , '00'   , fact.ACT_REVENUE
10383 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10384 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10385 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10386 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10387 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10388 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10389 			  , '0-1'  , fact.ACT_REVENUE
10390 			  , '1-1'  , fact.ACT_REVENUE
10391 			  , 0  ) -- end decode
10392 			    , 0  ) -- end nvl
10393 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10394 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_REVENUE
10395 	 , ROUND (
10396              NVL (
10397             DECODE (
10398                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10399 			  , '00'   , fact.ACT_LABOR_RAW_COST
10400 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10401 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10402 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10403 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10404 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10405 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10406 			  , '0-1'  , fact.ACT_LABOR_RAW_COST
10407 			  , '1-1'  , fact.ACT_LABOR_RAW_COST
10408 			  , 0  ) -- end decode
10409 			    , 0  ) -- end nvl
10410 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10411 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_RAW_COST
10412 	 , ROUND (
10413              NVL (
10414             DECODE (
10415                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10416 			  , '00'   , fact.ACT_EQUIP_RAW_COST
10417 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10418 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10419 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10420 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10421 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10422 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10423 			  , '0-1'  , fact.ACT_EQUIP_RAW_COST
10424 			  , '1-1'  , fact.ACT_EQUIP_RAW_COST
10425 			  , 0  ) -- end decode
10426 			    , 0  ) -- end nvl
10427 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10428 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_RAW_COST
10429 	 , ROUND (
10430              NVL (
10431             DECODE (
10432                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10433 			  , '00'   , fact.ETC_LABOR_HRS
10434 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10435 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10436 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10437 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10438 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10439 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10440 			  , '0-1'  , fact.ETC_LABOR_HRS
10441 			  , '1-1'  , fact.ETC_LABOR_HRS
10442 			  , 0  ) -- end decode
10443 			    , 0  ) -- end nvl
10444 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10445 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_HRS
10446 	 , ROUND (
10447              NVL (
10448             DECODE (
10449                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10450 			  , '00'   , fact.ETC_EQUIP_HRS
10451 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10452 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10453 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10454 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10455 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10456 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10457 			  , '0-1'  , fact.ETC_EQUIP_HRS
10458 			  , '1-1'  , fact.ETC_EQUIP_HRS
10459 			  , 0  ) -- end decode
10460 			    , 0  ) -- end nvl
10461 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10462 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_HRS
10463 	 , ROUND (
10464              NVL (
10465             DECODE (
10466                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10467 			  , '00'   , fact.ETC_LABOR_BRDN_COST
10468 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10469 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10470 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10471 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10472 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10473 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10474 			  , '0-1'  , fact.ETC_LABOR_BRDN_COST
10475 			  , '1-1'  , fact.ETC_LABOR_BRDN_COST
10476 			  , 0  ) -- end decode
10477 			    , 0  ) -- end nvl
10478 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10479 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_BRDN_COST
10480 	 , ROUND (
10481              NVL (
10482             DECODE (
10483                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10484 			  , '00'   , fact.ETC_EQUIP_BRDN_COST
10485 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10486 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10487 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10488 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10489 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10490 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10491 			  , '0-1'  , fact.ETC_EQUIP_BRDN_COST
10492 			  , '1-1'  , fact.ETC_EQUIP_BRDN_COST
10493 			  , 0  ) -- end decode
10494 			    , 0  ) -- end nvl
10495 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10496 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_BRDN_COST
10497 	 , ROUND (
10498              NVL (
10499             DECODE (
10500                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10501 			  , '00'   , fact.ETC_BRDN_COST
10502 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10503 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10504 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10505 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10506 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10507 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10508 			  , '0-1'  , fact.ETC_BRDN_COST
10509 			  , '1-1'  , fact.ETC_BRDN_COST
10510 			  , 0  ) -- end decode
10511 			    , 0  ) -- end nvl
10512 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10513 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_BRDN_COST
10514 	 , ROUND (
10515              NVL (
10516             DECODE (
10517                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10518 			  , '00'   , fact.ETC_RAW_COST
10519 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10520 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10521 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10522 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10523 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10524 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10525 			  , '0-1'  , fact.ETC_RAW_COST
10526 			  , '1-1'  , fact.ETC_RAW_COST
10527 			  , 0  ) -- end decode
10528 			    , 0  ) -- end nvl
10529 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10530 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_RAW_COST
10531 	 , ROUND (
10532              NVL (
10533             DECODE (
10534                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10535 			  , '00'   , fact.ETC_LABOR_RAW_COST
10536 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10537 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10538 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10539 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10540 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10541 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10542 			  , '0-1'  , fact.ETC_LABOR_RAW_COST
10543 			  , '1-1'  , fact.ETC_LABOR_RAW_COST
10544 			  , 0  ) -- end decode
10545 			    , 0  ) -- end nvl
10546 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10547 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_RAW_COST
10548 	 , ROUND (
10549              NVL (
10550             DECODE (
10551                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10552 			  , '00'   , fact.ETC_EQUIP_RAW_COST
10553 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10554 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10555 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10556 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10557 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10558 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10559 			  , '0-1'  , fact.ETC_EQUIP_RAW_COST
10560 			  , '1-1'  , fact.ETC_EQUIP_RAW_COST
10561 			  , 0  ) -- end decode
10562 			    , 0  ) -- end nvl
10563 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10564 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_RAW_COST
10565 	 , ROUND (
10566              NVL (
10567             DECODE (
10568                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10569 			  , '00'   , fact.custom1
10570 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10571 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10572 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10573 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10574 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10575 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10576 			  , '0-1'  , fact.custom1
10577 			  , '1-1'  , fact.custom1
10578 			  , 0  ) -- end decode
10579 			    , 0  ) -- end nvl
10580 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10581 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom1
10582 	 , ROUND (
10583              NVL (
10584             DECODE (
10585                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10586 			  , '00'   , fact.custom2
10587 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10588 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10589 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10590 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10591 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10592 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10593 			  , '0-1'  , fact.custom2
10594 			  , '1-1'  , fact.custom2
10595 			  , 0  ) -- end decode
10596 			    , 0  ) -- end nvl
10597 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10598 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom2
10599 	 , ROUND (
10600              NVL (
10601             DECODE (
10602                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10603 			  , '00'   , fact.custom3
10604 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10605 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10606 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10607 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10608 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10609 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10610 			  , '0-1'  , fact.custom3
10611 			  , '1-1'  , fact.custom3
10612 			  , 0  ) -- end decode
10613 			    , 0  ) -- end nvl
10614 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10615 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom3
10616 	 , ROUND (
10617              NVL (
10618             DECODE (
10619                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10620 			  , '00'   , fact.custom4
10621 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10622 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10623 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10624 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10625 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10626 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10627 			  , '0-1'  , fact.custom4
10628 			  , '1-1'  , fact.custom4
10629 			  , 0  ) -- end decode
10630 			    , 0  ) -- end nvl
10631 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10632 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom4
10633 	 , ROUND (
10634              NVL (
10635             DECODE (
10636                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10637 			  , '00'   , fact.custom5
10638 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10639 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10640 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10641 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10642 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10643 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10644 			  , '0-1'  , fact.custom5
10645 			  , '1-1'  , fact.custom5
10646 			  , 0  ) -- end decode
10647 			    , 0  ) -- end nvl
10648 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10649 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom5
10650 	 , ROUND (
10651              NVL (
10652             DECODE (
10653                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10654 			  , '00'   , fact.custom6
10655 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10656 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10657 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10658 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10659 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10660 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10661 			  , '0-1'  , fact.custom6
10662 			  , '1-1'  , fact.custom6
10663 			  , 0  ) -- end decode
10664 			    , 0  ) -- end nvl
10665 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10666 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom6
10667 	 , ROUND (
10668              NVL (
10669             DECODE (
10670                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10671 			  , '00'   , fact.custom7
10672 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10673 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10674 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10675 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10676 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10677 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10678 			  , '0-1'  , fact.custom7
10679 			  , '1-1'  , fact.custom7
10680 			  , 0  ) -- end decode
10681 			    , 0  ) -- end nvl
10682 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10683 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom7
10684 	 , ROUND (
10685              NVL (
10686             DECODE (
10687                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10688 			  , '00'   , fact.custom8
10689 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10690 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10691 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10692 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10693 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10694 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10695 			  , '0-1'  , fact.custom8
10696 			  , '1-1'  , fact.custom8
10697 			  , 0  ) -- end decode
10698 			    , 0  ) -- end nvl
10699 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10700 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom8
10701 	 , ROUND (
10702              NVL (
10703             DECODE (
10704                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10705 			  , '00'   , fact.custom9
10706 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10707 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10708 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10709 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10710 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10711 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10712 			  , '0-1'  , fact.custom9
10713 			  , '1-1'  , fact.custom9
10714 			  , 0  ) -- end decode
10715 			    , 0  ) -- end nvl
10716 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10717 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom9
10718 	 , ROUND (
10719              NVL (
10720             DECODE (
10721                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10722 			  , '00'   , fact.custom10
10723 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10724 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10725 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10726 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10727 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10728 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10729 			  , '0-1'  , fact.custom10
10730 			  , '1-1'  , fact.custom10
10731 			  , 0  ) -- end decode
10732 			    , 0  ) -- end nvl
10733 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10734 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom10
10735 	 , ROUND (
10736              NVL (
10737             DECODE (
10738                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10739 			  , '00'   , fact.custom11
10740 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10741 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10742 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10743 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10744 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10745 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10746 			  , '0-1'  , fact.custom11
10747 			  , '1-1'  , fact.custom11
10748 			  , 0  ) -- end decode
10749 			    , 0  ) -- end nvl
10750 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10751 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom11
10752 	 , ROUND (
10753              NVL (
10754             DECODE (
10755                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10756 			  , '00'   , fact.custom12
10757 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10758 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10759 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10760 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10761 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10762 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10763 			  , '0-1'  , fact.custom12
10764 			  , '1-1'  , fact.custom12
10765 			  , 0  ) -- end decode
10766 			    , 0  ) -- end nvl
10767 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10768 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom12
10769 	 , ROUND (
10770              NVL (
10771             DECODE (
10772                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10773 			  , '00'   , fact.custom13
10774 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10775 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10776 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10777 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10778 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10779 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10780 			  , '0-1'  , fact.custom13
10781 			  , '1-1'  , fact.custom13
10782 			  , 0  ) -- end decode
10783 			    , 0  ) -- end nvl
10784 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10785 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom13
10786 	 , ROUND (
10787              NVL (
10788             DECODE (
10789                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10790 			  , '00'   , fact.custom14
10791 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10792 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10793 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10794 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10795 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10796 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10797 			  , '0-1'  , fact.custom14
10798 			  , '1-1'  , fact.custom14
10799 			  , 0  ) -- end decode
10800 			    , 0  ) -- end nvl
10801 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10802 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom14
10803 	 , ROUND (
10804              NVL (
10805             DECODE (
10806                      ( sign (non_pa_cal.start_date - pa_cal.start_date) || sign (non_pa_cal.end_date - pa_cal.end_date) )
10807 			  , '00'   , fact.custom15
10808 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10809 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10810 			  , '10'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10811 			  , '11'   , (pa_cal.end_date - non_pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10812 			  , '-10'  , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10813 			  , '-1-1' , (non_pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (non_pa_cal.end_date - non_pa_cal.start_date + 1)
10814 			  , '0-1'  , fact.custom15
10815 			  , '1-1'  , fact.custom15
10816 			  , 0  ) -- end decode
10817 			    , 0  ) -- end nvl
10818 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
10819 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom15
10820      , 'CF'   line_type
10821 	 , NULL time_dangling_flag
10822 	 , NULL rate_dangling_flag
10823               ,fact.plan_type_code plan_type_code     /*4471527 */
10824    FROM   pji_fp_xbs_accum_f  fact
10825        , PJI_FM_EXTR_PLNVER3_T ver
10826         , pji_time_cal_period  non_pa_cal
10827    	 , pji_org_extr_info  orginfo
10828    	 , pji_time_cal_period  pa_cal
10829    WHERE  1=1
10830       AND fact.CALENDAR_TYPE <> p_calendar_type
10831       AND fact.CALENDAR_TYPE IN ('P', 'G')
10832       AND non_pa_cal.cal_period_id = fact.time_id
10833       AND ver.project_id = fact.project_id
10834       AND ver.plan_version_id = fact.plan_version_id
10835       AND orginfo.org_id = fact.PROJECT_ORG_ID
10836       AND DECODE(fact.calendar_type, 'P', orginfo.gl_calendar_id, 'G', orginfo.pa_calendar_id) = pa_cal.calendar_id
10837       AND (
10838 	       ( pa_cal.start_date >= non_pa_cal.start_date  AND pa_cal.end_date <= non_pa_cal.end_date )
10839 	    OR ( pa_cal.start_date <= non_pa_cal.start_date  AND pa_cal.end_date >= non_pa_cal.end_date )
10840 	    OR ( pa_cal.start_date <= non_pa_cal.start_date  AND pa_cal.end_date <= non_pa_cal.end_date AND pa_cal.end_date >= non_pa_cal.start_date )
10841 	    OR ( pa_cal.start_date >= non_pa_cal.start_date  AND pa_cal.end_date >= non_pa_cal.end_date AND pa_cal.start_date <= non_pa_cal.end_date )
10842           )
10843       AND fact.period_type_id = 32
10844       AND ver.wp_flag = 'N'
10845       AND ver.baselined_flag = 'Y'
10846 	  ) a
10847 	  GROUP BY
10848 	   a.PROJECT_ID
10849      , a.PROJECT_ORG_ID
10850      , a.PROJECT_ORGANIZATION_ID
10851      , a.PROJECT_ELEMENT_ID
10852      , a.TIME_ID
10853      , a.PERIOD_TYPE_ID
10854      , a.CALENDAR_TYPE
10855      , a.RBS_AGGR_LEVEL
10856      , a.WBS_ROLLUP_FLAG
10857      , a.PRG_ROLLUP_FLAG
10858      , a.CURR_RECORD_TYPE_ID
10859      , a.CURRENCY_CODE
10860      , a.RBS_ELEMENT_ID
10861      , a.RBS_VERSION_ID
10862      , a.PLAN_VERSION_ID
10863      , a.PLAN_TYPE_ID
10864 	 , a.LINE_TYPE
10865 	 , a.TIME_DANGLING_FLAG
10866 	 , a.RATE_DANGLING_FLAG;
10867 
10868 
10869 EXCEPTION
10870   WHEN OTHERS THEN
10871     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
10872                              p_procedure_name => 'PRORATE_TO_PAGL_PGE_FPRL_D ');
10873     RAISE;
10874 END;
10875 
10876 
10877 PROCEDURE PRORATE_TO_PAGL_N_PJP1_D (p_calendar_type   IN   VARCHAR2 := NULL) IS
10878 BEGIN
10879 
10880     IF (p_calendar_type NOT IN ('P', 'G')) THEN
10881       RETURN;
10882     END IF;
10883 
10884     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
10885 
10886 /* Commented for bug 4005006
10887     INSERT INTO pji_fp_aggr_pjp1_t  -- Non time phased entries..
10888     (
10889        worker_id
10890       , PROJECT_ID
10891      , PROJECT_ORG_ID
10892      , PROJECT_ORGANIZATION_ID
10893      -- , PARTITION_ID
10894      , PROJECT_ELEMENT_ID
10895      , TIME_ID
10896      , PERIOD_TYPE_ID
10897      , CALENDAR_TYPE
10898      , RBS_AGGR_LEVEL
10899      , WBS_ROLLUP_FLAG
10900      , PRG_ROLLUP_FLAG
10901      , CURR_RECORD_TYPE_ID
10902      , CURRENCY_CODE
10903      , RBS_ELEMENT_ID
10904      , RBS_VERSION_ID
10905      , PLAN_VERSION_ID
10906      , PLAN_TYPE_ID
10907      , RAW_COST
10908      , BRDN_COST
10909      , REVENUE
10910      , BILL_RAW_COST
10911      , BILL_BRDN_COST
10912      , BILL_LABOR_RAW_COST
10913      , BILL_LABOR_BRDN_COST
10914      , BILL_LABOR_HRS
10915      , EQUIPMENT_RAW_COST
10916      , EQUIPMENT_BRDN_COST
10917      , CAPITALIZABLE_RAW_COST
10918      , CAPITALIZABLE_BRDN_COST
10919      , LABOR_RAW_COST
10920      , LABOR_BRDN_COST
10921      , LABOR_HRS
10922      , LABOR_REVENUE
10923      , EQUIPMENT_HOURS
10924      , BILLABLE_EQUIPMENT_HOURS
10925      , SUP_INV_COMMITTED_COST
10926      , PO_COMMITTED_COST
10927      , PR_COMMITTED_COST
10928      , OTH_COMMITTED_COST
10929        , ACT_LABOR_HRS
10930 	   , ACT_EQUIP_HRS
10931 	   , ACT_LABOR_BRDN_COST
10932 	   , ACT_EQUIP_BRDN_COST
10933 	   , ACT_BRDN_COST
10934 	   , ACT_RAW_COST
10935 	   , ACT_REVENUE
10936          , ACT_LABOR_RAW_COST
10937          , ACT_EQUIP_RAW_COST
10938 	   , ETC_LABOR_HRS
10939 	   , ETC_EQUIP_HRS
10940 	   , ETC_LABOR_BRDN_COST
10941 	   , ETC_EQUIP_BRDN_COST
10942 	   , ETC_BRDN_COST
10943          , ETC_RAW_COST
10944          , ETC_LABOR_RAW_COST
10945          , ETC_EQUIP_RAW_COST
10946      , CUSTOM1
10947      , CUSTOM2
10948      , CUSTOM3
10949      , CUSTOM4
10950      , CUSTOM5
10951      , CUSTOM6
10952      , CUSTOM7
10953      , CUSTOM8
10954      , CUSTOM9
10955      , CUSTOM10
10956      , CUSTOM11
10957      , CUSTOM12
10958      , CUSTOM13
10959      , CUSTOM14
10960      , CUSTOM15
10961      , LINE_TYPE
10962      , TIME_DANGLING_FLAG
10963      , RATE_DANGLING_FLAG
10964      , PRG_LEVEL
10965 	)
10966    SELECT
10967          g_worker_id  worker_id
10968      , a.PROJECT_ID
10969      , a.PROJECT_ORG_ID
10970      , a.PROJECT_ORGANIZATION_ID
10971      , a.PROJECT_ELEMENT_ID
10972      , a.TIME_ID
10973      , 32 -- a.PERIOD_TYPE_ID
10974      , a.CALENDAR_TYPE
10975      , a.RBS_AGGR_LEVEL
10976      , a.WBS_ROLLUP_FLAG
10977      , a.PRG_ROLLUP_FLAG
10978      , a.CURR_RECORD_TYPE_ID
10979      , a.CURRENCY_CODE
10980      , a.RBS_ELEMENT_ID
10981      , a.RBS_VERSION_ID
10982      , a.PLAN_VERSION_ID
10983      , a.PLAN_TYPE_ID
10984      , SUM(a.RAW_COST       )
10985      , SUM(a.BRDN_COST 	)
10986      , SUM(a.REVENUE	)
10987      , SUM(a.BILL_RAW_COST )
10988      , SUM(a.BILL_BRDN_COST )
10989      , SUM(a.BILL_LABOR_RAW_COST )
10990      , SUM(a.BILL_LABOR_BRDN_COST )
10991      , SUM(a.BILL_LABOR_HRS )
10992      , SUM(a.EQUIPMENT_RAW_COST )
10993      , SUM(a.EQUIPMENT_BRDN_COST )
10994      , SUM(a.CAPITALIZABLE_RAW_COST )
10995      , SUM(a.CAPITALIZABLE_BRDN_COST )
10996      , SUM(a.LABOR_RAW_COST )
10997      , SUM(a.LABOR_BRDN_COST)
10998      , SUM(a.LABOR_HRS )
10999      , SUM(a.LABOR_REVENUE )
11000      , SUM(a.EQUIPMENT_HOURS )
11001      , SUM(a.BILLABLE_EQUIPMENT_HOURS)
11002      , SUM(a.SUP_INV_COMMITTED_COST)
11003      , SUM(a.PO_COMMITTED_COST )
11004      , SUM(a.PR_COMMITTED_COST )
11005      , SUM(a.OTH_COMMITTED_COST)
11006        , SUM(a.ACT_LABOR_HRS)
11007 	   , SUM(a.ACT_EQUIP_HRS)
11008 	   , SUM(a.ACT_LABOR_BRDN_COST)
11009 	   , SUM(a.ACT_EQUIP_BRDN_COST)
11010 	   , SUM(a.ACT_BRDN_COST    )
11011 	   , SUM(a.ACT_RAW_COST    )
11012 	   , SUM(a.ACT_REVENUE    )
11013          , SUM(a.ACT_LABOR_RAW_COST)
11014          , SUM(a.ACT_EQUIP_RAW_COST)
11015 	   , SUM(a.ETC_LABOR_HRS         )
11016 	   , SUM(a.ETC_EQUIP_HRS        )
11017 	   , SUM(a.ETC_LABOR_BRDN_COST )
11018 	   , SUM(a.ETC_EQUIP_BRDN_COST)
11019 	   , SUM(a.ETC_BRDN_COST )
11020          , SUM(a.ETC_RAW_COST)
11021          , SUM(a.ETC_LABOR_RAW_COST)
11022          , SUM(a.ETC_EQUIP_RAW_COST)
11023      , SUM(a.CUSTOM1	)
11024      , SUM(a.CUSTOM2	)
11025      , SUM(a.CUSTOM3	)
11026      , SUM(a.CUSTOM4	)
11027      , SUM(a.CUSTOM5	)
11028      , SUM(a.CUSTOM6	)
11029      , SUM(a.CUSTOM7	)
11030      , SUM(a.CUSTOM8	)
11031      , SUM(a.CUSTOM9	)
11032      , SUM(a.CUSTOM10	)
11033      , SUM(a.CUSTOM11	)
11034      , SUM(a.CUSTOM12	)
11035      , SUM(a.CUSTOM13	)
11036      , SUM(a.CUSTOM14	)
11037      , SUM(a.CUSTOM15	)
11038 	 , a.LINE_TYPE
11039 	 , a.TIME_DANGLING_FLAG
11040 	 , a.RATE_DANGLING_FLAG
11041        , g_default_prg_level prg_level
11042   FROM (
11043    SELECT
11044          fact.project_id  project_id
11045    	 , fact.project_ORG_ID project_ORG_ID
11046    	 , fact.project_ORGANIZATION_ID project_ORGANIZATION_ID
11047    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
11048    	 , pa_cal.cal_period_id TIME_ID
11049    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
11050        , p_calendar_type  CALENDAR_TYPE
11051        , fact.RBS_AGGR_LEVEL
11052        , fact.WBS_ROLLUP_FLAG
11053        , fact.PRG_ROLLUP_FLAG
11054    	 , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
11055    	 , fact.CURRENCY_CODE CURRENCY_CODE
11056    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
11057    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
11058    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
11059 	 , fact.PLAN_TYPE_ID  PLAN_TYPE_ID
11060 	 , ROUND (
11061              NVL (
11062             DECODE (
11063                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11064 			  , '00'   , fact.raw_cost
11065 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
11066 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
11067 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
11068 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
11069 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
11070 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.raw_cost / (fact.end_date - fact.start_date + 1)
11071 			  , '0-1'  , fact.raw_cost
11072 			  , '1-1'  , fact.raw_cost
11073 			  , 0  ) -- end decode
11074 			    , 0  ) -- end nvl
11075 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11076 						* PJI_UTILS.GET_MAU (fact.currency_code)	raw_cost
11077 	 , ROUND (
11078              NVL (
11079             DECODE (
11080                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11081 			 , '00'   , fact.brdn_cost
11082 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
11083 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
11084 			 , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
11085 			 , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
11086 			 , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
11087 			 , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.brdn_cost / (fact.end_date - fact.start_date + 1)
11088 			 , '0-1'  , fact.brdn_cost
11089 			 , '1-1'  , fact.brdn_cost
11090 			 , 0  ) -- end decode
11091 			  , 0  ) -- end nvl
11092 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11093 						* PJI_UTILS.GET_MAU (fact.currency_code)	brdn_cost
11094 	 , ROUND (
11095              NVL (
11096             DECODE (
11097                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11098 			 , '00'   , fact.revenue
11099 			 , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
11100 			 , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
11101 			 , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
11102 			 , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
11103 			 , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
11104 			 , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.revenue / (fact.end_date - fact.start_date + 1)
11105 			 , '0-1'  , fact.revenue
11106 			 , '1-1'  , fact.revenue
11107 			 , 0  ) -- end decode
11108 			  , 0  ) -- end nvl
11109 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11110 						* PJI_UTILS.GET_MAU (fact.currency_code)	revenue
11111 	 , ROUND (
11112              NVL (
11113             DECODE (
11114                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11115 			  , '00'   , fact.bill_raw_cost
11116 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
11117 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
11118 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
11119 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
11120 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
11121 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.bill_raw_cost / (fact.end_date - fact.start_date + 1)
11122 			  , '0-1'  , fact.bill_raw_cost
11123 			  , '1-1'  , fact.bill_raw_cost
11124 			  , 0  ) -- end decode
11125 			    , 0  ) -- end nvl
11126 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11127 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_raw_cost
11128 	 , ROUND (
11129              NVL (
11130             DECODE (
11131                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11132 			  , '00'   , fact.bill_brdn_cost
11133 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
11134 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
11135 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
11136 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
11137 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
11138 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.bill_brdn_cost / (fact.end_date - fact.start_date + 1)
11139 			  , '0-1'  , fact.bill_brdn_cost
11140 			  , '1-1'  , fact.bill_brdn_cost
11141 			  , 0  ) -- end decode
11142 			    , 0  ) -- end nvl
11143 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11144 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_brdn_cost
11145 	 , ROUND (
11146              NVL (
11147             DECODE (
11148                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11149 			  , '00'   , fact.bill_labor_raw_cost
11150 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
11151 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
11152 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
11153 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
11154 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
11155 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_raw_cost / (fact.end_date - fact.start_date + 1)
11156 			  , '0-1'  , fact.bill_labor_raw_cost
11157 			  , '1-1'  , fact.bill_labor_raw_cost
11158 			  , 0  ) -- end decode
11159 			    , 0  ) -- end nvl
11160 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11161 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_raw_cost
11162 	 , ROUND (
11163              NVL (
11164             DECODE (
11165                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11166 			  , '00'   , fact.bill_labor_brdn_cost
11167 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11168 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11169 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11170 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11171 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11172 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11173 			  , '0-1'  , fact.bill_labor_brdn_cost
11174 			  , '1-1'  , fact.bill_labor_brdn_cost
11175 			  , 0  ) -- end decode
11176 			    , 0  ) -- end nvl
11177 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11178 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_brdn_cost
11179 	 , ROUND (
11180              NVL (
11181             DECODE (
11182                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11183 			  , '00'   , fact.bill_labor_hrs
11184 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
11185 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
11186 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
11187 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
11188 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
11189 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.bill_labor_hrs / (fact.end_date - fact.start_date + 1)
11190 			  , '0-1'  , fact.bill_labor_hrs
11191 			  , '1-1'  , fact.bill_labor_hrs
11192 			  , 0  ) -- end decode
11193 			    , 0  ) -- end nvl
11194 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11195 						* PJI_UTILS.GET_MAU (fact.currency_code)	bill_labor_hrs
11196 	 , ROUND (
11197              NVL (
11198             DECODE (
11199                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11200 			  , '00'   , fact.equipment_raw_cost
11201 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
11202 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
11203 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
11204 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
11205 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
11206 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_raw_cost / (fact.end_date - fact.start_date + 1)
11207 			  , '0-1'  , fact.equipment_raw_cost
11208 			  , '1-1'  , fact.equipment_raw_cost
11209 			  , 0  ) -- end decode
11210 			    , 0  ) -- end nvl
11211 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11212 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_raw_cost
11213 	 , ROUND (
11214              NVL (
11215             DECODE (
11216                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11217 			  , '00'   , fact.equipment_brdn_cost
11218 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
11219 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
11220 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
11221 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
11222 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
11223 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_brdn_cost / (fact.end_date - fact.start_date + 1)
11224 			  , '0-1'  , fact.equipment_brdn_cost
11225 			  , '1-1'  , fact.equipment_brdn_cost
11226 			  , 0  ) -- end decode
11227 			    , 0  ) -- end nvl
11228 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11229 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_brdn_cost
11230 	 , ROUND (
11231              NVL (
11232             DECODE (
11233                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11234 			  , '00'   , fact.capitalizable_raw_cost
11235 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
11236 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
11237 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
11238 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
11239 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
11240 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.capitalizable_raw_cost / (fact.end_date - fact.start_date + 1)
11241 			  , '0-1'  , fact.capitalizable_raw_cost
11242 			  , '1-1'  , fact.capitalizable_raw_cost
11243 			  , 0  ) -- end decode
11244 			    , 0  ) -- end nvl
11245 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11246 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_raw_cost
11247 	 , ROUND (
11248              NVL (
11249             DECODE (
11250                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11251 			  , '00'   , fact.capitalizable_brdn_cost
11252 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
11253 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
11254 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
11255 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
11256 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
11257 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.capitalizable_brdn_cost / (fact.end_date - fact.start_date + 1)
11258 			  , '0-1'  , fact.capitalizable_brdn_cost
11259 			  , '1-1'  , fact.capitalizable_brdn_cost
11260 			  , 0  ) -- end decode
11261 			    , 0  ) -- end nvl
11262 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11263 						* PJI_UTILS.GET_MAU (fact.currency_code)	capitalizable_brdn_cost
11264 	 , ROUND (
11265              NVL (
11266             DECODE (
11267                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11268 			  , '00'   , fact.labor_raw_cost
11269 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
11270 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
11271 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
11272 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
11273 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
11274 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.labor_raw_cost / (fact.end_date - fact.start_date + 1)
11275 			  , '0-1'  , fact.labor_raw_cost
11276 			  , '1-1'  , fact.labor_raw_cost
11277 			  , 0  ) -- end decode
11278 			    , 0  ) -- end nvl
11279 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11280 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_raw_cost
11281 	 , ROUND (
11282              NVL (
11283             DECODE (
11284                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11285 			  , '00'   , fact.labor_brdn_cost
11286 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11287 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11288 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11289 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11290 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11291 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.labor_brdn_cost / (fact.end_date - fact.start_date + 1)
11292 			  , '0-1'  , fact.labor_brdn_cost
11293 			  , '1-1'  , fact.labor_brdn_cost
11294 			  , 0  ) -- end decode
11295 			    , 0  ) -- end nvl
11296 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11297 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_brdn_cost
11298 	 , ROUND (
11299              NVL (
11300             DECODE (
11301                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11302 			  , '00'   , fact.labor_hrs
11303 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
11304 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
11305 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
11306 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
11307 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
11308 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.labor_hrs / (fact.end_date - fact.start_date + 1)
11309 			  , '0-1'  , fact.labor_hrs
11310 			  , '1-1'  , fact.labor_hrs
11311 			  , 0  ) -- end decode
11312 			    , 0  ) -- end nvl
11313 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11314 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_hrs
11315 	 , ROUND (
11316              NVL (
11317             DECODE (
11318                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11319 			  , '00'   , fact.labor_revenue
11320 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
11321 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
11322 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
11323 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
11324 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
11325 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.labor_revenue / (fact.end_date - fact.start_date + 1)
11326 			  , '0-1'  , fact.labor_revenue
11327 			  , '1-1'  , fact.labor_revenue
11328 			  , 0  ) -- end decode
11329 			    , 0  ) -- end nvl
11330 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11331 						* PJI_UTILS.GET_MAU (fact.currency_code)	labor_revenue
11332 	 , ROUND (
11333              NVL (
11334             DECODE (
11335                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11336 			  , '00'   , fact.equipment_hours
11337 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
11338 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
11339 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
11340 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
11341 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
11342 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.equipment_hours / (fact.end_date - fact.start_date + 1)
11343 			  , '0-1'  , fact.equipment_hours
11344 			  , '1-1'  , fact.equipment_hours
11345 			  , 0  ) -- end decode
11346 			    , 0  ) -- end nvl
11347 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11348 						* PJI_UTILS.GET_MAU (fact.currency_code)	equipment_hours
11349 	 , ROUND (
11350              NVL (
11351             DECODE (
11352                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11353 			  , '00'   , fact.billable_equipment_hours
11354 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
11355 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
11356 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
11357 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
11358 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
11359 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.billable_equipment_hours / (fact.end_date - fact.start_date + 1)
11360 			  , '0-1'  , fact.billable_equipment_hours
11361 			  , '1-1'  , fact.billable_equipment_hours
11362 			  , 0  ) -- end decode
11363 			    , 0  ) -- end nvl
11364 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11365 						* PJI_UTILS.GET_MAU (fact.currency_code)	billable_equipment_hours
11366 	 , ROUND (
11367              NVL (
11368             DECODE (
11369                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11370 			  , '00'   , fact.sup_inv_committed_cost
11371 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
11372 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
11373 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
11374 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
11375 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
11376 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.sup_inv_committed_cost / (fact.end_date - fact.start_date + 1)
11377 			  , '0-1'  , fact.sup_inv_committed_cost
11378 			  , '1-1'  , fact.sup_inv_committed_cost
11379 			  , 0  ) -- end decode
11380 			    , 0  ) -- end nvl
11381 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11382 						* PJI_UTILS.GET_MAU (fact.currency_code)	sup_inv_committed_cost
11383 	 , ROUND (
11384              NVL (
11385             DECODE (
11386                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11387 			  , '00'   , fact.po_committed_cost
11388 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
11389 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
11390 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
11391 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
11392 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
11393 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.po_committed_cost / (fact.end_date - fact.start_date + 1)
11394 			  , '0-1'  , fact.po_committed_cost
11395 			  , '1-1'  , fact.po_committed_cost
11396 			  , 0  ) -- end decode
11397 			    , 0  ) -- end nvl
11398 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11399 						* PJI_UTILS.GET_MAU (fact.currency_code)	po_committed_cost
11400 	 , ROUND (
11401              NVL (
11402             DECODE (
11403                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11404 			  , '00'   , fact.pr_committed_cost
11405 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
11406 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
11407 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
11408 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
11409 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
11410 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.pr_committed_cost / (fact.end_date - fact.start_date + 1)
11411 			  , '0-1'  , fact.pr_committed_cost
11412 			  , '1-1'  , fact.pr_committed_cost
11413 			  , 0  ) -- end decode
11414 			    , 0  ) -- end nvl
11415 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11416 						* PJI_UTILS.GET_MAU (fact.currency_code)	pr_committed_cost
11417 	 , ROUND (
11418              NVL (
11419             DECODE (
11420                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11421 			  , '00'   , fact.oth_committed_cost
11422 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
11423 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
11424 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
11425 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
11426 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
11427 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.oth_committed_cost / (fact.end_date - fact.start_date + 1)
11428 			  , '0-1'  , fact.oth_committed_cost
11429 			  , '1-1'  , fact.oth_committed_cost
11430 			  , 0  ) -- end decode
11431 			    , 0  ) -- end nvl
11432 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11433 						* PJI_UTILS.GET_MAU (fact.currency_code)	oth_committed_cost
11434 	 , ROUND (
11435              NVL (
11436             DECODE (
11437                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11438 			  , '00'   , fact.ACT_LABOR_HRS
11439 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11440 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11441 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11442 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11443 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11444 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11445 			  , '0-1'  , fact.ACT_LABOR_HRS
11446 			  , '1-1'  , fact.ACT_LABOR_HRS
11447 			  , 0  ) -- end decode
11448 			    , 0  ) -- end nvl
11449 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11450 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_HRS
11451 	 , ROUND (
11452              NVL (
11453             DECODE (
11454                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11455 			  , '00'   , fact.ACT_EQUIP_HRS
11456 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11457 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11458 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11459 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11460 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11461 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11462 			  , '0-1'  , fact.ACT_EQUIP_HRS
11463 			  , '1-1'  , fact.ACT_EQUIP_HRS
11464 			  , 0  ) -- end decode
11465 			    , 0  ) -- end nvl
11466 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11467 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_HRS
11468 	 , ROUND (
11469              NVL (
11470             DECODE (
11471                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11472 			  , '00'   , fact.ACT_LABOR_BRDN_COST
11473 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11474 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11475 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11476 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11477 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11478 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11479 			  , '0-1'  , fact.ACT_LABOR_BRDN_COST
11480 			  , '1-1'  , fact.ACT_LABOR_BRDN_COST
11481 			  , 0  ) -- end decode
11482 			    , 0  ) -- end nvl
11483 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11484 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_BRDN_COST
11485 	 , ROUND (
11486              NVL (
11487             DECODE (
11488                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11489 			  , '00'   , fact.ACT_EQUIP_BRDN_COST
11490 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11491 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11492 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11493 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11494 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11495 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11496 			  , '0-1'  , fact.ACT_EQUIP_BRDN_COST
11497 			  , '1-1'  , fact.ACT_EQUIP_BRDN_COST
11498 			  , 0  ) -- end decode
11499 			    , 0  ) -- end nvl
11500 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11501 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_BRDN_COST
11502 	 , ROUND (
11503              NVL (
11504             DECODE (
11505                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11506 			  , '00'   , fact.ACT_BRDN_COST
11507 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
11508 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
11509 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
11510 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
11511 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
11512 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_BRDN_COST / (fact.end_date - fact.start_date + 1)
11513 			  , '0-1'  , fact.ACT_BRDN_COST
11514 			  , '1-1'  , fact.ACT_BRDN_COST
11515 			  , 0  ) -- end decode
11516 			    , 0  ) -- end nvl
11517 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11518 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_BRDN_COST
11519 	 , ROUND (
11520              NVL (
11521             DECODE (
11522                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11523 			  , '00'   , fact.ACT_RAW_COST
11524 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
11525 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
11526 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
11527 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
11528 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
11529 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_RAW_COST / (fact.end_date - fact.start_date + 1)
11530 			  , '0-1'  , fact.ACT_RAW_COST
11531 			  , '1-1'  , fact.ACT_RAW_COST
11532 			  , 0  ) -- end decode
11533 			    , 0  ) -- end nvl
11534 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11535 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_RAW_COST
11536 	 , ROUND (
11537              NVL (
11538             DECODE (
11539                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11540 			  , '00'   , fact.ACT_REVENUE
11541 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
11542 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
11543 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
11544 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
11545 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
11546 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_REVENUE / (fact.end_date - fact.start_date + 1)
11547 			  , '0-1'  , fact.ACT_REVENUE
11548 			  , '1-1'  , fact.ACT_REVENUE
11549 			  , 0  ) -- end decode
11550 			    , 0  ) -- end nvl
11551 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11552 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_REVENUE
11553 	 , ROUND (
11554              NVL (
11555             DECODE (
11556                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11557 			  , '00'   , fact.ACT_LABOR_RAW_COST
11558 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11559 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11560 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11561 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11562 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11563 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11564 			  , '0-1'  , fact.ACT_LABOR_RAW_COST
11565 			  , '1-1'  , fact.ACT_LABOR_RAW_COST
11566 			  , 0  ) -- end decode
11567 			    , 0  ) -- end nvl
11568 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11569 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_LABOR_RAW_COST
11570 	 , ROUND (
11571              NVL (
11572             DECODE (
11573                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11574 			  , '00'   , fact.ACT_EQUIP_RAW_COST
11575 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11576 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11577 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11578 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11579 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11580 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ACT_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11581 			  , '0-1'  , fact.ACT_EQUIP_RAW_COST
11582 			  , '1-1'  , fact.ACT_EQUIP_RAW_COST
11583 			  , 0  ) -- end decode
11584 			    , 0  ) -- end nvl
11585 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11586 						* PJI_UTILS.GET_MAU (fact.currency_code)	ACT_EQUIP_RAW_COST
11587 	 , ROUND (
11588              NVL (
11589             DECODE (
11590                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11591 			  , '00'   , fact.ETC_LABOR_HRS
11592 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11593 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11594 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11595 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11596 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11597 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_HRS / (fact.end_date - fact.start_date + 1)
11598 			  , '0-1'  , fact.ETC_LABOR_HRS
11599 			  , '1-1'  , fact.ETC_LABOR_HRS
11600 			  , 0  ) -- end decode
11601 			    , 0  ) -- end nvl
11602 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11603 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_HRS
11604 	 , ROUND (
11605              NVL (
11606             DECODE (
11607                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11608 			  , '00'   , fact.ETC_EQUIP_HRS
11609 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11610 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11611 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11612 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11613 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11614 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_HRS / (fact.end_date - fact.start_date + 1)
11615 			  , '0-1'  , fact.ETC_EQUIP_HRS
11616 			  , '1-1'  , fact.ETC_EQUIP_HRS
11617 			  , 0  ) -- end decode
11618 			    , 0  ) -- end nvl
11619 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11620 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_HRS
11621 	 , ROUND (
11622              NVL (
11623             DECODE (
11624                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11625 			  , '00'   , fact.ETC_LABOR_BRDN_COST
11626 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11627 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11628 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11629 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11630 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11631 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_BRDN_COST / (fact.end_date - fact.start_date + 1)
11632 			  , '0-1'  , fact.ETC_LABOR_BRDN_COST
11633 			  , '1-1'  , fact.ETC_LABOR_BRDN_COST
11634 			  , 0  ) -- end decode
11635 			    , 0  ) -- end nvl
11636 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11637 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_BRDN_COST
11638 	 , ROUND (
11639              NVL (
11640             DECODE (
11641                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11642 			  , '00'   , fact.ETC_EQUIP_BRDN_COST
11643 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11644 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11645 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11646 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11647 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11648 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_BRDN_COST / (fact.end_date - fact.start_date + 1)
11649 			  , '0-1'  , fact.ETC_EQUIP_BRDN_COST
11650 			  , '1-1'  , fact.ETC_EQUIP_BRDN_COST
11651 			  , 0  ) -- end decode
11652 			    , 0  ) -- end nvl
11653 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11654 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_BRDN_COST
11655 	 , ROUND (
11656              NVL (
11657             DECODE (
11658                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11659 			  , '00'   , fact.ETC_BRDN_COST
11660 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
11661 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
11662 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
11663 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
11664 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
11665 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_BRDN_COST / (fact.end_date - fact.start_date + 1)
11666 			  , '0-1'  , fact.ETC_BRDN_COST
11667 			  , '1-1'  , fact.ETC_BRDN_COST
11668 			  , 0  ) -- end decode
11669 			    , 0  ) -- end nvl
11670 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11671 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_BRDN_COST
11672 	 , ROUND (
11673              NVL (
11674             DECODE (
11675                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11676 			  , '00'   , fact.ETC_RAW_COST
11677 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
11678 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
11679 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
11680 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
11681 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
11682 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_RAW_COST / (fact.end_date - fact.start_date + 1)
11683 			  , '0-1'  , fact.ETC_RAW_COST
11684 			  , '1-1'  , fact.ETC_RAW_COST
11685 			  , 0  ) -- end decode
11686 			    , 0  ) -- end nvl
11687 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11688 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_RAW_COST
11689 	 , ROUND (
11690              NVL (
11691             DECODE (
11692                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11693 			  , '00'   , fact.ETC_LABOR_RAW_COST
11694 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11695 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11696 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11697 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11698 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11699 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_LABOR_RAW_COST / (fact.end_date - fact.start_date + 1)
11700 			  , '0-1'  , fact.ETC_LABOR_RAW_COST
11701 			  , '1-1'  , fact.ETC_LABOR_RAW_COST
11702 			  , 0  ) -- end decode
11703 			    , 0  ) -- end nvl
11704 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11705 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_LABOR_RAW_COST
11706 	 , ROUND (
11707              NVL (
11708             DECODE (
11709                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11710 			  , '00'   , fact.ETC_EQUIP_RAW_COST
11711 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11712 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11713 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11714 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11715 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11716 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.ETC_EQUIP_RAW_COST / (fact.end_date - fact.start_date + 1)
11717 			  , '0-1'  , fact.ETC_EQUIP_RAW_COST
11718 			  , '1-1'  , fact.ETC_EQUIP_RAW_COST
11719 			  , 0  ) -- end decode
11720 			    , 0  ) -- end nvl
11721 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11722 						* PJI_UTILS.GET_MAU (fact.currency_code)	ETC_EQUIP_RAW_COST
11723 	 , ROUND (
11724              NVL (
11725             DECODE (
11726                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11727 			  , '00'   , fact.custom1
11728 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
11729 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
11730 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
11731 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
11732 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
11733 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom1 / (fact.end_date - fact.start_date + 1)
11734 			  , '0-1'  , fact.custom1
11735 			  , '1-1'  , fact.custom1
11736 			  , 0  ) -- end decode
11737 			    , 0  ) -- end nvl
11738 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11739 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom1
11740 	 , ROUND (
11741              NVL (
11742             DECODE (
11743                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11744 			  , '00'   , fact.custom2
11745 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
11746 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
11747 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
11748 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
11749 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
11750 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom2 / (fact.end_date - fact.start_date + 1)
11751 			  , '0-1'  , fact.custom2
11752 			  , '1-1'  , fact.custom2
11753 			  , 0  ) -- end decode
11754 			    , 0  ) -- end nvl
11755 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11756 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom2
11757 	 , ROUND (
11758              NVL (
11759             DECODE (
11760                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11761 			  , '00'   , fact.custom3
11762 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
11763 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
11764 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
11765 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
11766 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
11767 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom3 / (fact.end_date - fact.start_date + 1)
11768 			  , '0-1'  , fact.custom3
11769 			  , '1-1'  , fact.custom3
11770 			  , 0  ) -- end decode
11771 			    , 0  ) -- end nvl
11772 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11773 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom3
11774 	 , ROUND (
11775              NVL (
11776             DECODE (
11777                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11778 			  , '00'   , fact.custom4
11779 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
11780 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
11781 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
11782 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
11783 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
11784 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom4 / (fact.end_date - fact.start_date + 1)
11785 			  , '0-1'  , fact.custom4
11786 			  , '1-1'  , fact.custom4
11787 			  , 0  ) -- end decode
11788 			    , 0  ) -- end nvl
11789 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11790 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom4
11791 	 , ROUND (
11792              NVL (
11793             DECODE (
11794                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11795 			  , '00'   , fact.custom5
11796 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
11797 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
11798 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
11799 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
11800 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
11801 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom5 / (fact.end_date - fact.start_date + 1)
11802 			  , '0-1'  , fact.custom5
11803 			  , '1-1'  , fact.custom5
11804 			  , 0  ) -- end decode
11805 			    , 0  ) -- end nvl
11806 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11807 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom5
11808 	 , ROUND (
11809              NVL (
11810             DECODE (
11811                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11812 			  , '00'   , fact.custom6
11813 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
11814 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
11815 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
11816 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
11817 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
11818 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom6 / (fact.end_date - fact.start_date + 1)
11819 			  , '0-1'  , fact.custom6
11820 			  , '1-1'  , fact.custom6
11821 			  , 0  ) -- end decode
11822 			    , 0  ) -- end nvl
11823 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11824 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom6
11825 	 , ROUND (
11826              NVL (
11827             DECODE (
11828                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11829 			  , '00'   , fact.custom7
11830 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
11831 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
11832 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
11833 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
11834 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
11835 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom7 / (fact.end_date - fact.start_date + 1)
11836 			  , '0-1'  , fact.custom7
11837 			  , '1-1'  , fact.custom7
11838 			  , 0  ) -- end decode
11839 			    , 0  ) -- end nvl
11840 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11841 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom7
11842 	 , ROUND (
11843              NVL (
11844             DECODE (
11845                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11846 			  , '00'   , fact.custom8
11847 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
11848 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
11849 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
11850 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
11851 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
11852 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom8 / (fact.end_date - fact.start_date + 1)
11853 			  , '0-1'  , fact.custom8
11854 			  , '1-1'  , fact.custom8
11855 			  , 0  ) -- end decode
11856 			    , 0  ) -- end nvl
11857 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11858 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom8
11859 	 , ROUND (
11860              NVL (
11861             DECODE (
11862                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11863 			  , '00'   , fact.custom9
11864 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
11865 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
11866 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
11867 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
11868 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
11869 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom9 / (fact.end_date - fact.start_date + 1)
11870 			  , '0-1'  , fact.custom9
11871 			  , '1-1'  , fact.custom9
11872 			  , 0  ) -- end decode
11873 			    , 0  ) -- end nvl
11874 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11875 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom9
11876 	 , ROUND (
11877              NVL (
11878             DECODE (
11879                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11880 			  , '00'   , fact.custom10
11881 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
11882 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
11883 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
11884 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
11885 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
11886 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom10 / (fact.end_date - fact.start_date + 1)
11887 			  , '0-1'  , fact.custom10
11888 			  , '1-1'  , fact.custom10
11889 			  , 0  ) -- end decode
11890 			    , 0  ) -- end nvl
11891 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11892 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom10
11893 	 , ROUND (
11894              NVL (
11895             DECODE (
11896                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11897 			  , '00'   , fact.custom11
11898 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
11899 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
11900 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
11901 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
11902 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
11903 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom11 / (fact.end_date - fact.start_date + 1)
11904 			  , '0-1'  , fact.custom11
11905 			  , '1-1'  , fact.custom11
11906 			  , 0  ) -- end decode
11907 			    , 0  ) -- end nvl
11908 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11909 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom11
11910 	 , ROUND (
11911              NVL (
11912             DECODE (
11913                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11914 			  , '00'   , fact.custom12
11915 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
11916 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
11917 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
11918 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
11919 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
11920 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom12 / (fact.end_date - fact.start_date + 1)
11921 			  , '0-1'  , fact.custom12
11922 			  , '1-1'  , fact.custom12
11923 			  , 0  ) -- end decode
11924 			    , 0  ) -- end nvl
11925 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11926 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom12
11927 	 , ROUND (
11928              NVL (
11929             DECODE (
11930                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11931 			  , '00'   , fact.custom13
11932 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
11933 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
11934 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
11935 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
11936 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
11937 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom13 / (fact.end_date - fact.start_date + 1)
11938 			  , '0-1'  , fact.custom13
11939 			  , '1-1'  , fact.custom13
11940 			  , 0  ) -- end decode
11941 			    , 0  ) -- end nvl
11942 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11943 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom13
11944 	 , ROUND (
11945              NVL (
11946             DECODE (
11947                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11948 			  , '00'   , fact.custom14
11949 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
11950 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
11951 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
11952 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
11953 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
11954 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom14 / (fact.end_date - fact.start_date + 1)
11955 			  , '0-1'  , fact.custom14
11956 			  , '1-1'  , fact.custom14
11957 			  , 0  ) -- end decode
11958 			    , 0  ) -- end nvl
11959 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11960 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom14
11961 	 , ROUND (
11962              NVL (
11963             DECODE (
11964                      ( sign (fact.start_date - pa_cal.start_date) || sign (fact.end_date - pa_cal.end_date) )
11965 			  , '00'   , fact.custom15
11966 			  , '01'   , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
11967 			  , '-11'  , (pa_cal.end_date - pa_cal.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
11968 			  , '10'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
11969 			  , '11'   , (pa_cal.end_date - fact.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
11970 			  , '-10'  , (fact.end_date - pa_cal.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
11971 			  , '-1-1' , (fact.end_date - pa_cal.start_date + 1) * fact.custom15 / (fact.end_date - fact.start_date + 1)
11972 			  , '0-1'  , fact.custom15
11973 			  , '1-1'  , fact.custom15
11974 			  , 0  ) -- end decode
11975 			    , 0  ) -- end nvl
11976 			/ PJI_UTILS.GET_MAU (fact.currency_code) )  -- end round
11977 						* PJI_UTILS.GET_MAU (fact.currency_code)	custom15
11978      , 'CF'   line_type
11979 	 , NULL time_dangling_flag
11980 	 , NULL rate_dangling_flag
11981    FROM   pji_fp_aggr_pjp1_t fact
11982    	 , pji_org_extr_info  orginfo
11983    	 , pji_time_cal_period  pa_cal
11984        , pji_fm_extr_plnver3_t  ver
11985    WHERE  1=1
11986       AND fact.CALENDAR_TYPE = 'A'
11987       AND fact.worker_id = g_worker_id
11988       AND fact.start_date IS NOT NULL
11989       AND fact.end_date IS NOT NULL
11990 	AND fact.time_dangling_flag IS NULL
11991 	AND fact.rate_dangling_flag IS NULL
11992       AND orginfo.org_id = fact.PROJECT_ORG_ID
11993       AND DECODE(p_calendar_type
11994                , 'P', orginfo.pa_calendar_id
11995                , 'G', orginfo.gl_calendar_id) = pa_cal.calendar_id
11996       AND (
11997 	       (     pa_cal.start_date >= fact.start_date
11998                AND pa_cal.end_date <= fact.end_date ) -- fsps,pefe
11999 	    OR (     pa_cal.start_date <= fact.start_date
12000                AND pa_cal.end_date >= fact.end_date ) -- psfs,fepe
12001 	    OR (     pa_cal.start_date <= fact.start_date
12002                AND pa_cal.end_date <= fact.end_date
12003                AND pa_cal.end_date >= fact.start_date ) -- psfspefe
12004 	    OR (     pa_cal.start_date >= fact.start_date
12005                AND pa_cal.end_date >= fact.end_date
12006                AND pa_cal.start_date <= fact.end_date )  -- fspsfepe
12007           )
12008       AND fact.line_type = 'NTP'
12009       AND fact.period_type_id = 2048
12010       AND fact.plan_version_id = ver.plan_version_id
12011       AND ver.wp_flag = 'N'
12012       AND ver.baselined_flag = 'Y'
12013       AND ver.time_phased_type_code = 'N'
12014       -- AND (ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
12015       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
12016 	  ) a
12017 	  GROUP BY
12018 	   a.PROJECT_ID
12019      , a.PROJECT_ORG_ID
12020      , a.PROJECT_ORGANIZATION_ID
12021      , a.PROJECT_ELEMENT_ID
12022      , a.TIME_ID
12023      , a.PERIOD_TYPE_ID
12024      , a.CALENDAR_TYPE
12025      , a.RBS_AGGR_LEVEL
12026      , a.WBS_ROLLUP_FLAG
12027      , a.PRG_ROLLUP_FLAG
12028      , a.CURR_RECORD_TYPE_ID
12029      , a.CURRENCY_CODE
12030      , a.RBS_ELEMENT_ID
12031      , a.RBS_VERSION_ID
12032      , a.PLAN_VERSION_ID
12033      , a.PLAN_TYPE_ID
12034 	 , a.LINE_TYPE
12035 	 , a.TIME_DANGLING_FLAG
12036 	 , a.RATE_DANGLING_FLAG;
12037 
12038 End for 4005006 */
12039 
12040     INSERT INTO pji_fp_aggr_pjp1_t  -- Non time phased entries..
12041     (
12042        worker_id
12043      , PROJECT_ID
12044      , PROJECT_ORG_ID
12045      , PROJECT_ORGANIZATION_ID
12046      -- , PARTITION_ID
12047      , PROJECT_ELEMENT_ID
12048      , TIME_ID
12049      , PERIOD_TYPE_ID
12050      , CALENDAR_TYPE
12051      , RBS_AGGR_LEVEL
12052      , WBS_ROLLUP_FLAG
12053      , PRG_ROLLUP_FLAG
12054      , CURR_RECORD_TYPE_ID
12055      , CURRENCY_CODE
12056      , RBS_ELEMENT_ID
12057      , RBS_VERSION_ID
12058      , PLAN_VERSION_ID
12059      , PLAN_TYPE_ID
12060      , RAW_COST
12061      , BRDN_COST
12062      , REVENUE
12063      , BILL_RAW_COST
12064      , BILL_BRDN_COST
12065      , BILL_LABOR_RAW_COST
12066      , BILL_LABOR_BRDN_COST
12067      , BILL_LABOR_HRS
12068      , EQUIPMENT_RAW_COST
12069      , EQUIPMENT_BRDN_COST
12070      , CAPITALIZABLE_RAW_COST
12071      , CAPITALIZABLE_BRDN_COST
12072      , LABOR_RAW_COST
12073      , LABOR_BRDN_COST
12074      , LABOR_HRS
12075      , LABOR_REVENUE
12076      , EQUIPMENT_HOURS
12077      , BILLABLE_EQUIPMENT_HOURS
12078      , SUP_INV_COMMITTED_COST
12079      , PO_COMMITTED_COST
12080      , PR_COMMITTED_COST
12081      , OTH_COMMITTED_COST
12082      , ACT_LABOR_HRS
12083      , ACT_EQUIP_HRS
12084      , ACT_LABOR_BRDN_COST
12085      , ACT_EQUIP_BRDN_COST
12086      , ACT_BRDN_COST
12087      , ACT_RAW_COST
12088      , ACT_REVENUE
12089      , ACT_LABOR_RAW_COST
12090      , ACT_EQUIP_RAW_COST
12091      , ETC_LABOR_HRS
12092      , ETC_EQUIP_HRS
12093      , ETC_LABOR_BRDN_COST
12094      , ETC_EQUIP_BRDN_COST
12095      , ETC_BRDN_COST
12096      , ETC_RAW_COST
12097      , ETC_LABOR_RAW_COST
12098      , ETC_EQUIP_RAW_COST
12099      , CUSTOM1
12100      , CUSTOM2
12101      , CUSTOM3
12102      , CUSTOM4
12103      , CUSTOM5
12104      , CUSTOM6
12105      , CUSTOM7
12106      , CUSTOM8
12107      , CUSTOM9
12108      , CUSTOM10
12109      , CUSTOM11
12110      , CUSTOM12
12111      , CUSTOM13
12112      , CUSTOM14
12113      , CUSTOM15
12114      , TIME_DANGLING_FLAG
12115      , RATE_DANGLING_FLAG
12116      , PRG_LEVEL
12117      , PLAN_TYPE_CODE
12118 	)
12119    SELECT
12120        g_worker_id  worker_id
12121      , a.PROJECT_ID
12122      , a.PROJECT_ORG_ID
12123      , a.PROJECT_ORGANIZATION_ID
12124      , a.PROJECT_ELEMENT_ID
12125      , a.TIME_ID
12126      , 32 -- a.PERIOD_TYPE_ID
12127      , a.CALENDAR_TYPE
12128      , a.RBS_AGGR_LEVEL
12129      , a.WBS_ROLLUP_FLAG
12130      , a.PRG_ROLLUP_FLAG
12131      , a.CURR_RECORD_TYPE_ID
12132      , a.CURRENCY_CODE
12133      , a.RBS_ELEMENT_ID
12134      , a.RBS_VERSION_ID
12135      , a.PLAN_VERSION_ID
12136      , a.PLAN_TYPE_ID
12137      , SUM(ROUND (nvl(a.raw_cost,0)*a.factor/a.mau)*a.mau) raw_cost
12138      , SUM(ROUND (nvl(a.brdn_cost,0)*a.factor/a.mau)*a.mau) brdn_cost
12139      , SUM(ROUND (nvl(a.revenue,0)*a.factor/a.mau)*a.mau) revenue
12140      , SUM(ROUND (nvl(a.bill_raw_cost,0)*a.factor/a.mau)*a.mau) bill_raw_cost
12141      , SUM(ROUND (nvl(a.bill_brdn_cost,0)*a.factor/a.mau)*a.mau) bill_brdn_cost
12142      , SUM(ROUND (nvl(a.bill_labor_raw_cost,0)*a.factor/a.mau)*a.mau) bill_labor_raw_cost
12143      , SUM(ROUND (nvl(a.bill_labor_brdn_cost,0)*a.factor/a.mau)*a.mau) bill_labor_brdn_cost
12144      , SUM(ROUND (nvl(a.bill_labor_hrs,0)*a.factor/a.mau)*a.mau) bill_labor_hrs
12145      , SUM(ROUND (nvl(a.equipment_raw_cost,0)*a.factor/a.mau)*a.mau) equipment_raw_cost
12146      , SUM(ROUND (nvl(a.equipment_brdn_cost,0)*a.factor/a.mau)*a.mau) equipment_brdn_cost
12147      , SUM(ROUND (nvl(a.capitalizable_raw_cost,0)*a.factor/a.mau)*a.mau) capitalizable_raw_cost
12148      , SUM(ROUND (nvl(a.capitalizable_brdn_cost,0)*a.factor/a.mau)*a.mau) capitalizable_brdn_cost
12149      , SUM(ROUND (nvl(a.labor_raw_cost,0)*a.factor/a.mau)*a.mau) labor_raw_cost
12150      , SUM(ROUND (nvl(a.labor_brdn_cost,0)*a.factor/a.mau)*a.mau) labor_brdn_cost
12151      , SUM(ROUND (nvl(a.labor_hrs,0)*a.factor/a.mau)*a.mau) labor_hrs
12152      , SUM(ROUND (nvl(a.labor_revenue,0)*a.factor/a.mau)*a.mau) labor_revenue
12153      , SUM(ROUND (nvl(a.equipment_hours,0)*a.factor/a.mau)*a.mau) equipment_hours
12154      , SUM(ROUND (nvl(a.billable_equipment_hours,0)*a.factor/a.mau)*a.mau) billable_equipment_hours         , SUM(ROUND (nvl(a.sup_inv_committed_cost,0)*a.factor/a.mau)*a.mau) sup_inv_committed_cost
12155      , SUM(ROUND (nvl(a.po_committed_cost,0)*a.factor/a.mau)*a.mau) po_committed_cost
12156      , SUM(ROUND (nvl(a.pr_committed_cost,0)*a.factor/a.mau)*a.mau) pr_committed_cost
12157      , SUM(ROUND (nvl(a.oth_committed_cost,0)*a.factor/a.mau)*a.mau) oth_committed_cost
12158      , SUM(ROUND (nvl(a.ACT_LABOR_HRS,0)*a.factor/a.mau)*a.mau) ACT_LABOR_HRS
12159      , SUM(ROUND (nvl(a.ACT_EQUIP_HRS,0)*a.factor/a.mau)*a.mau) ACT_EQUIP_HRS
12160      , SUM(ROUND (nvl(a.ACT_LABOR_BRDN_COST,0)*a.factor/a.mau)*a.mau) ACT_LABOR_BRDN_COST
12161      , SUM(ROUND (nvl(a.ACT_EQUIP_BRDN_COST,0)*a.factor/a.mau)*a.mau) ACT_EQUIP_BRDN_COST
12162      , SUM(ROUND (nvl(a.ACT_BRDN_COST,0)*a.factor/a.mau)*a.mau) ACT_BRDN_COST
12163      , SUM(ROUND (nvl(a.ACT_RAW_COST,0)*a.factor/a.mau)*a.mau) ACT_RAW_COST
12164      , SUM(ROUND (nvl(a.ACT_REVENUE,0)*a.factor/a.mau)*a.mau) ACT_REVENUE
12165      , SUM(ROUND (nvl(a.ACT_LABOR_RAW_COST,0)*a.factor/a.mau)*a.mau) ACT_LABOR_RAW_COST
12166      , SUM(ROUND (nvl(a.ACT_EQUIP_RAW_COST,0)*a.factor/a.mau)*a.mau) ACT_EQUIP_RAW_COST
12167      , SUM(ROUND (nvl(a.ETC_LABOR_HRS,0)*a.factor/a.mau)*a.mau) ETC_LABOR_HRS
12168      , SUM(ROUND (nvl(a.ETC_EQUIP_HRS,0)*a.factor/a.mau)*a.mau) ETC_EQUIP_HRS
12169      , SUM(ROUND (nvl(a.ETC_LABOR_BRDN_COST,0)*a.factor/a.mau)*a.mau) ETC_LABOR_BRDN_COST
12170      , SUM(ROUND (nvl(a.ETC_EQUIP_BRDN_COST,0)*a.factor/a.mau)*a.mau) ETC_EQUIP_BRDN_COST
12171      , SUM(ROUND (nvl(a.ETC_BRDN_COST,0)*a.factor/a.mau)*a.mau) ETC_BRDN_COST
12172      , SUM(ROUND (nvl(a.ETC_RAW_COST,0)*a.factor/a.mau)*a.mau) ETC_RAW_COST
12173      , SUM(ROUND (nvl(a.ETC_LABOR_RAW_COST,0)*a.factor/a.mau)*a.mau) ETC_LABOR_RAW_COST
12174      , SUM(ROUND (nvl(a.ETC_EQUIP_RAW_COST,0)*a.factor/a.mau)*a.mau) ETC_EQUIP_RAW_COST
12175      , SUM(ROUND (nvl(a.custom1,0)*a.factor/a.mau)*a.mau) custom1
12176      , SUM(ROUND (nvl(a.custom2,0)*a.factor/a.mau)*a.mau) custom2
12177      , SUM(ROUND (nvl(a.custom3,0)*a.factor/a.mau)*a.mau) custom3
12178      , SUM(ROUND (nvl(a.custom4,0)*a.factor/a.mau)*a.mau) custom4
12179      , SUM(ROUND (nvl(a.custom5,0)*a.factor/a.mau)*a.mau) custom5
12180      , SUM(ROUND (nvl(a.custom6,0)*a.factor/a.mau)*a.mau) custom6
12181      , SUM(ROUND (nvl(a.custom7,0)*a.factor/a.mau)*a.mau) custom7
12182      , SUM(ROUND (nvl(a.custom8,0)*a.factor/a.mau)*a.mau) custom8
12183      , SUM(ROUND (nvl(a.custom9,0)*a.factor/a.mau)*a.mau) custom9
12184      , SUM(ROUND (nvl(a.custom10,0)*a.factor/a.mau)*a.mau) custom10
12185      , SUM(ROUND (nvl(a.custom11,0)*a.factor/a.mau)*a.mau) custom11
12186      , SUM(ROUND (nvl(a.custom12,0)*a.factor/a.mau)*a.mau) custom12
12187      , SUM(ROUND (nvl(a.custom13,0)*a.factor/a.mau)*a.mau) custom13
12188      , SUM(ROUND (nvl(a.custom14,0)*a.factor/a.mau)*a.mau) custom14
12189      , SUM(ROUND (nvl(a.custom15,0)*a.factor/a.mau)*a.mau) custom15
12190      , a.TIME_DANGLING_FLAG
12191      , a.RATE_DANGLING_FLAG
12192      , g_default_prg_level prg_level
12193      , a.plan_type_code plan_type_Code   /* 4471527 */
12194   FROM (
12195    SELECT /*+ NO_MERGE */
12196            fact.project_id  project_id
12197    	 , fact.project_ORG_ID project_ORG_ID
12198    	 , fact.project_ORGANIZATION_ID project_ORGANIZATION_ID
12199    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
12200    	 , pa_cal.cal_period_id TIME_ID
12201    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
12202          , p_calendar_type  CALENDAR_TYPE
12203          , fact.RBS_AGGR_LEVEL
12204          , fact.WBS_ROLLUP_FLAG
12205          , fact.PRG_ROLLUP_FLAG
12206    	 , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
12207    	 , fact.CURRENCY_CODE CURRENCY_CODE
12208    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
12209    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
12210    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
12211 	 , fact.PLAN_TYPE_ID  PLAN_TYPE_ID
12212          , fact.raw_cost
12213          , fact.brdn_cost
12214          , fact.revenue
12215          , fact.bill_raw_cost
12216          , fact.bill_brdn_cost
12217          , fact.bill_labor_raw_cost
12218          , fact.bill_labor_brdn_cost
12219          , fact.bill_labor_hrs
12220          , fact.equipment_raw_cost
12221          , fact.equipment_brdn_cost
12222          , fact.capitalizable_raw_cost
12223          , fact.capitalizable_brdn_cost
12224          , fact.labor_raw_cost
12225          , fact.labor_brdn_cost
12226          , fact.labor_hrs
12227          , fact.labor_revenue
12228          , fact.equipment_hours
12229          , fact.billable_equipment_hours
12230          , fact.sup_inv_committed_cost
12231          , fact.po_committed_cost
12232          , fact.pr_committed_cost
12233          , fact.oth_committed_cost
12234          , fact.ACT_LABOR_HRS
12235          , fact.ACT_EQUIP_HRS
12236          , fact.ACT_LABOR_BRDN_COST
12237          , fact.ACT_EQUIP_BRDN_COST
12238          , fact.ACT_BRDN_COST
12239          , fact.ACT_RAW_COST
12240          , fact.ACT_REVENUE
12241          , fact.ACT_LABOR_RAW_COST
12242          , fact.ACT_EQUIP_RAW_COST
12243          , fact.ETC_LABOR_HRS
12244          , fact.ETC_EQUIP_HRS
12245          , fact.ETC_LABOR_BRDN_COST
12246          , fact.ETC_EQUIP_BRDN_COST
12247          , fact.ETC_BRDN_COST
12248          , fact.ETC_RAW_COST
12249          , fact.ETC_LABOR_RAW_COST
12250          , fact.ETC_EQUIP_RAW_COST
12251          , fact.custom1
12252          , fact.custom2
12253          , fact.custom3
12254          , fact.custom4
12255          , fact.custom5
12256          , fact.custom6
12257          , fact.custom7
12258          , fact.custom8
12259          , fact.custom9
12260          , fact.custom10
12261          , fact.custom11
12262          , fact.custom12
12263          , fact.custom13
12264          , fact.custom14
12265          , fact.custom15
12266 	 , NULL time_dangling_flag
12267 	 , NULL rate_dangling_flag
12268          , cur.mau mau
12269          , (LEAST(fact.end_date,pa_cal.end_date) - Greatest(fact.start_date,pa_cal.start_date)+1)
12270                               / (fact.end_date - fact.start_date+1) factor
12271           , fact.plan_type_code    plan_type_code   /* 4471527 */
12272    FROM    pji_fp_aggr_pjp1_t fact
12273    	 , pji_org_extr_info  orginfo
12274    	 , pji_time_cal_period_v  pa_cal
12275          , pji_fm_extr_plnver3_t  ver
12276          ,(SELECT currency_code,
12277                    decode(nvl(MINIMUM_ACCOUNTABLE_UNIT, power(10, (-1 * PRECISION))),
12278                       null, 0.01,
12279                          0, 1,
12280                          nvl(MINIMUM_ACCOUNTABLE_UNIT, power(10, (-1 * PRECISION)))) mau
12281               FROM FND_CURRENCIES) cur
12282    WHERE  1=1
12283       AND fact.CALENDAR_TYPE = 'A'
12284       AND fact.worker_id = g_worker_id
12285       AND fact.start_date IS NOT NULL
12286       AND fact.end_date IS NOT NULL
12287       AND fact.time_dangling_flag IS NULL
12288       AND fact.rate_dangling_flag IS NULL
12289       AND orginfo.org_id = fact.PROJECT_ORG_ID
12290       AND DECODE(p_calendar_type
12291                , 'P', orginfo.pa_calendar_id
12292                , 'G', orginfo.gl_calendar_id) = pa_cal.calendar_id
12293       AND fact.line_type = 'NTP'
12294       AND fact.period_type_id = 2048
12295       AND fact.plan_version_id = ver.plan_version_id
12296       ANd fact.plan_type_code = ver.plan_type_code   /* 4471527 */
12297       AND ver.wp_flag = 'N'
12298       AND ver.baselined_flag = 'Y'
12299       AND ver.time_phased_type_code = 'N'
12300       AND ( fact.start_date <= pa_cal.end_date AND fact.end_date >= pa_cal.start_date )
12301       -- AND (ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
12302       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
12303       AND cur.currency_code = fact.currency_code
12304 	  ) a
12305       WHERE a.factor >0
12306    GROUP BY
12307        a.PROJECT_ID
12308      , a.PROJECT_ORG_ID
12309      , a.PROJECT_ORGANIZATION_ID
12310      , a.PROJECT_ELEMENT_ID
12311      , a.TIME_ID
12312      , a.PERIOD_TYPE_ID
12313      , a.CALENDAR_TYPE
12314      , a.RBS_AGGR_LEVEL
12315      , a.WBS_ROLLUP_FLAG
12316      , a.PRG_ROLLUP_FLAG
12317      , a.CURR_RECORD_TYPE_ID
12318      , a.CURRENCY_CODE
12319      , a.RBS_ELEMENT_ID
12320      , a.RBS_VERSION_ID
12321      , a.PLAN_VERSION_ID
12322      , a.PLAN_TYPE_ID
12323      , a.PLAN_TYPE_CODE    /* 4471527 */
12324 	 , a.TIME_DANGLING_FLAG
12325 	 , a.RATE_DANGLING_FLAG;
12326 
12327 
12328 EXCEPTION
12329   WHEN OTHERS THEN
12330     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
12331                              p_procedure_name => ' PRORATE_TO_PAGL_N_PJP1_D ');
12332     RAISE;
12333 END;
12334 
12335 
12336 PROCEDURE PRORATE_TO_PAGL_PGE_PJP1_SE (p_calendar_type    IN  VARCHAR2 := NULL,
12337                                        p_prorating_format IN  VARCHAR2) IS
12338 BEGIN
12339 
12340     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
12341 
12342 /* Commented for bug 4005006
12343     INSERT INTO pji_fp_aggr_pjp1_t -- For PA/GL entries.
12344     (
12345        worker_id
12346      , PROJECT_ID
12347      , PROJECT_ORG_ID
12348      , PROJECT_ORGANIZATION_ID
12349      -- , PARTITION_ID
12350      , PROJECT_ELEMENT_ID
12351      , TIME_ID
12352      , PERIOD_TYPE_ID
12353      , CALENDAR_TYPE
12354      , RBS_AGGR_LEVEL
12355      , WBS_ROLLUP_FLAG
12356      , PRG_ROLLUP_FLAG
12357      , CURR_RECORD_TYPE_ID
12358      , CURRENCY_CODE
12359      , RBS_ELEMENT_ID
12360      , RBS_VERSION_ID
12361      , PLAN_VERSION_ID
12362      , PLAN_TYPE_ID
12363      , RAW_COST
12364      , BRDN_COST
12365      , REVENUE
12366      , BILL_RAW_COST
12367      , BILL_BRDN_COST
12368      , BILL_LABOR_RAW_COST
12369      , BILL_LABOR_BRDN_COST
12370      , BILL_LABOR_HRS
12371      , EQUIPMENT_RAW_COST
12372      , EQUIPMENT_BRDN_COST
12373      , CAPITALIZABLE_RAW_COST
12374      , CAPITALIZABLE_BRDN_COST
12375      , LABOR_RAW_COST
12376      , LABOR_BRDN_COST
12377      , LABOR_HRS
12378      , LABOR_REVENUE
12379      , EQUIPMENT_HOURS
12380      , BILLABLE_EQUIPMENT_HOURS
12381      , SUP_INV_COMMITTED_COST
12382      , PO_COMMITTED_COST
12383      , PR_COMMITTED_COST
12384      , OTH_COMMITTED_COST
12385        , ACT_LABOR_HRS
12386 	   , ACT_EQUIP_HRS
12387 	   , ACT_LABOR_BRDN_COST
12388 	   , ACT_EQUIP_BRDN_COST
12389 	   , ACT_BRDN_COST
12390 	   , ACT_RAW_COST
12391 	   , ACT_REVENUE
12392          , ACT_LABOR_RAW_COST
12393          , ACT_EQUIP_RAW_COST
12394 	   , ETC_LABOR_HRS
12395 	   , ETC_EQUIP_HRS
12396 	   , ETC_LABOR_BRDN_COST
12397 	   , ETC_EQUIP_BRDN_COST
12398 	   , ETC_BRDN_COST
12399          , ETC_RAW_COST
12400          , ETC_LABOR_RAW_COST
12401          , ETC_EQUIP_RAW_COST
12402      , CUSTOM1
12403      , CUSTOM2
12404      , CUSTOM3
12405      , CUSTOM4
12406      , CUSTOM5
12407      , CUSTOM6
12408      , CUSTOM7
12409      , CUSTOM8
12410      , CUSTOM9
12411      , CUSTOM10
12412      , CUSTOM11
12413      , CUSTOM12
12414      , CUSTOM13
12415      , CUSTOM14
12416      , CUSTOM15
12417      , LINE_TYPE
12418      , TIME_DANGLING_FLAG
12419      , RATE_DANGLING_FLAG
12420      , PRG_LEVEL
12421 	)
12422    SELECT
12423          g_worker_id
12424        , fact.project_id  project_id
12425 	 , fact.PROJECT_ORG_ID project_org_id
12426 	 , fact.PROJECT_ORGANIZATION_ID project_organization_id
12427      -- , fact.PARTITION_ID PARTITION_ID
12428    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
12429    	 , pa_cal.cal_period_id TIME_ID
12430    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
12431    	 , DECODE(fact.CALENDAR_TYPE, 'P', 'G', 'G', 'P') CALENDAR_TYPE
12432      , fact.RBS_AGGR_LEVEL RBS_AGGR_LEVEL
12433      , fact.WBS_ROLLUP_FLAG WBS_ROLLUP_FLAG
12434      , fact.PRG_ROLLUP_FLAG PRG_ROLLUP_FLAG
12435      , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
12436    	 , fact.CURRENCY_CODE CURRENCY_CODE
12437    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
12438    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
12439    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
12440    	 , fact.PLAN_TYPE_ID PLAN_TYPE_ID
12441    	 , MAX(fact.RAW_COST)	 raw_cost
12442    	 , MAX(fact.BRDN_COST) BRDN_COST
12443    	 , MAX(fact.REVENUE) REVENUE
12444    	 , MAX(fact.BILL_RAW_COST) BILL_RAW_COST
12445    	 , MAX(fact.BILL_BRDN_COST) BILL_BRDN_COST
12446    	 , MAX(fact.BILL_LABOR_RAW_COST) BILL_LABOR_RAW_COST
12447    	 , MAX(fact.BILL_LABOR_BRDN_COST) BILL_LABOR_BRDN_COST
12448    	 , MAX(fact.BILL_LABOR_HRS) BILL_LABOR_HRS
12449    	 , MAX(fact.EQUIPMENT_RAW_COST) EQUIPMENT_RAW_COST
12450    	 , MAX(fact.EQUIPMENT_BRDN_COST) EQUIPMENT_BRDN_COST
12451    	 , MAX(fact.CAPITALIZABLE_RAW_COST) CAPITALIZABLE_RAW_COST
12452    	 , MAX(fact.CAPITALIZABLE_BRDN_COST) CAPITALIZABLE_BRDN_COST
12453    	 , MAX(fact.LABOR_RAW_COST) LABOR_RAW_COST
12454    	 , MAX(fact.LABOR_BRDN_COST) LABOR_BRDN_COST
12455    	 , MAX(fact.LABOR_HRS) LABOR_HRS
12456    	 , MAX(fact.LABOR_REVENUE) LABOR_REVENUE
12457    	 , MAX(fact.EQUIPMENT_HOURS) EQUIPMENT_HOURS
12458    	 , MAX(fact.BILLABLE_EQUIPMENT_HOURS) BILLABLE_EQUIPMENT_HOURS
12459    	 , MAX(fact.SUP_INV_COMMITTED_COST) SUP_INV_COMMITTED_COST
12460    	 , MAX(fact.PO_COMMITTED_COST) PO_COMMITTED_COST
12461    	 , MAX(fact.PR_COMMITTED_COST) PR_COMMITTED_COST
12462    	 , MAX(fact.OTH_COMMITTED_COST) OTH_COMMITTED_COST
12463        , MAX(fact.ACT_LABOR_HRS )
12464 	 , MAX(fact.ACT_EQUIP_HRS )
12465 	 , MAX(fact.ACT_LABOR_BRDN_COST )
12466 	 , MAX(fact.ACT_EQUIP_BRDN_COST )
12467 	 , MAX(fact.ACT_BRDN_COST )
12468 	 , MAX(fact.ACT_RAW_COST )
12469 	 , MAX(fact.ACT_REVENUE )
12470        , MAX(fact.ACT_LABOR_RAW_COST)
12471        , MAX(fact.ACT_EQUIP_RAW_COST)
12472 	 , MAX(fact.ETC_LABOR_HRS )
12473 	 , MAX(fact.ETC_EQUIP_HRS )
12474 	 , MAX(fact.ETC_LABOR_BRDN_COST )
12475 	 , MAX(fact.ETC_EQUIP_BRDN_COST )
12476 	 , MAX(fact.ETC_BRDN_COST )
12477        , MAX(fact.ETC_RAW_COST )
12478        , MAX(fact.ETC_LABOR_RAW_COST)
12479        , MAX(fact.ETC_EQUIP_RAW_COST)
12480    	 , MAX(fact.CUSTOM1) CUSTOM1
12481    	 , MAX(fact.CUSTOM2) CUSTOM2
12482    	 , MAX(fact.CUSTOM3) CUSTOM3
12483    	 , MAX(fact.CUSTOM4) CUSTOM4
12484    	 , MAX(fact.CUSTOM5) CUSTOM5
12485    	 , MAX(fact.CUSTOM6) CUSTOM6
12486    	 , MAX(fact.CUSTOM7) CUSTOM7
12487    	 , MAX(fact.CUSTOM8) CUSTOM8
12488    	 , MAX(fact.CUSTOM9) CUSTOM9
12489    	 , MAX(fact.CUSTOM10) CUSTOM10
12490    	 , MAX(fact.CUSTOM11) CUSTOM11
12491    	 , MAX(fact.CUSTOM12) CUSTOM12
12492    	 , MAX(fact.CUSTOM13) CUSTOM13
12493    	 , MAX(fact.CUSTOM14) CUSTOM14
12494    	 , MAX(fact.CUSTOM15) CUSTOM15
12495    	 -- , DECODE ('E', 'E', MAX(pa_cal.start_date), 'S', MIN(pa_cal.start_date)) start_date
12496    	 -- , DECODE ('E', 'E', MAX(pa_cal.end_date), 'S', MIN(pa_cal.end_date))	 end_date
12497        , 'CF'   line_type
12498 	 , NULL TIME_DANGLING_FLAG
12499 	 , NULL RATE_DANGLING_FLAG
12500        , g_default_prg_level prg_level
12501    FROM   pji_fp_aggr_pjp1_t fact
12502         , pji_time_cal_period  non_pa_cal
12503    	 , pji_org_extr_info  orginfo
12504    	 , pji_time_cal_period  pa_cal
12505        , pji_fm_extr_plnver3_t  ver
12506    WHERE  fact.CALENDAR_TYPE <> p_calendar_type
12507       AND fact.worker_id = g_worker_id
12508       AND fact.CALENDAR_TYPE IN ('P', 'G')
12509       AND non_pa_cal.cal_period_id = fact.time_id
12510       AND fact.line_type like 'OF%'
12511       AND orginfo.org_id = fact.PROJECT_ORG_ID
12512       AND DECODE(fact.calendar_type, 'P', orginfo.gl_calendar_id, 'G', orginfo.pa_calendar_id) = pa_cal.calendar_id
12513       AND pa_cal.start_date >= non_pa_cal.start_date
12514       AND ( non_pa_cal.end_date <= pa_cal.end_date AND non_pa_cal.end_date >= pa_cal.start_date )
12515       AND fact.period_type_id = 32
12516       AND fact.plan_version_id = ver.plan_version_id
12517       AND ver.wp_flag = 'N'
12518       AND ver.baselined_flag = 'Y'
12519 	-- AND (ver.rbs_struct_version_id = fact.rbs_version_id OR fact.rbs_version_id = -1)
12520       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
12521    GROUP BY
12522        fact.project_id
12523 	 , fact.PROJECT_ORG_ID
12524 	 , fact.PROJECT_ORGANIZATION_ID
12525      -- , fact.PARTITION_ID
12526    	 , fact.PROJECT_ELEMENT_ID
12527    	 , pa_cal.cal_period_id
12528    	 , fact.PERIOD_TYPE_ID
12529    	 , fact.CALENDAR_TYPE
12530      , fact.RBS_AGGR_LEVEL
12531      , fact.WBS_ROLLUP_FLAG
12532      , fact.PRG_ROLLUP_FLAG
12533      , fact.CURR_RECORD_TYPE_ID
12534    	 , fact.CURRENCY_CODE
12535    	 , fact.RBS_ELEMENT_ID
12536    	 , fact.RBS_VERSION_ID
12537    	 , fact.PLAN_VERSION_ID
12538    	 , fact.PLAN_TYPE_ID ;
12539 
12540 End of bug 4005006*/
12541 
12542     INSERT INTO pji_fp_aggr_pjp1_t -- For PA/GL entries.
12543     (
12544        worker_id
12545      , PROJECT_ID
12546      , PROJECT_ORG_ID
12547      , PROJECT_ORGANIZATION_ID
12548      , PROJECT_ELEMENT_ID
12549      , TIME_ID
12550      , PERIOD_TYPE_ID
12551      , CALENDAR_TYPE
12552      , RBS_AGGR_LEVEL
12553      , WBS_ROLLUP_FLAG
12554      , PRG_ROLLUP_FLAG
12555      , CURR_RECORD_TYPE_ID
12556      , CURRENCY_CODE
12557      , RBS_ELEMENT_ID
12558      , RBS_VERSION_ID
12559      , PLAN_VERSION_ID
12560      , PLAN_TYPE_ID
12561      , RAW_COST
12562      , BRDN_COST
12563      , REVENUE
12564      , BILL_RAW_COST
12565      , BILL_BRDN_COST
12566      , BILL_LABOR_RAW_COST
12567      , BILL_LABOR_BRDN_COST
12568      , BILL_LABOR_HRS
12569      , EQUIPMENT_RAW_COST
12570      , EQUIPMENT_BRDN_COST
12571      , CAPITALIZABLE_RAW_COST
12572      , CAPITALIZABLE_BRDN_COST
12573      , LABOR_RAW_COST
12574      , LABOR_BRDN_COST
12575      , LABOR_HRS
12576      , LABOR_REVENUE
12577      , EQUIPMENT_HOURS
12578      , BILLABLE_EQUIPMENT_HOURS
12579      , SUP_INV_COMMITTED_COST
12580      , PO_COMMITTED_COST
12581      , PR_COMMITTED_COST
12582      , OTH_COMMITTED_COST
12583      , ACT_LABOR_HRS
12584      , ACT_EQUIP_HRS
12585      , ACT_LABOR_BRDN_COST
12586      , ACT_EQUIP_BRDN_COST
12587      , ACT_BRDN_COST
12588      , ACT_RAW_COST
12589      , ACT_REVENUE
12590      , ACT_LABOR_RAW_COST
12591      , ACT_EQUIP_RAW_COST
12592      , ETC_LABOR_HRS
12593      , ETC_EQUIP_HRS
12594      , ETC_LABOR_BRDN_COST
12595      , ETC_EQUIP_BRDN_COST
12596      , ETC_BRDN_COST
12597      , ETC_RAW_COST
12598      , ETC_LABOR_RAW_COST
12599      , ETC_EQUIP_RAW_COST
12600      , CUSTOM1
12601      , CUSTOM2
12602      , CUSTOM3
12603      , CUSTOM4
12604      , CUSTOM5
12605      , CUSTOM6
12606      , CUSTOM7
12607      , CUSTOM8
12608      , CUSTOM9
12609      , CUSTOM10
12610      , CUSTOM11
12611      , CUSTOM12
12612      , CUSTOM13
12613      , CUSTOM14
12614      , CUSTOM15
12615      , TIME_DANGLING_FLAG
12616      , RATE_DANGLING_FLAG
12617      , PRG_LEVEL
12618      , PLAN_TYPE_CODE    /* 4471527 */
12619 	)
12620    SELECT
12621            g_worker_id
12622          , fact.project_id  project_id
12623 	 , fact.PROJECT_ORG_ID project_org_id
12624 	 , fact.PROJECT_ORGANIZATION_ID project_organization_id
12625    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
12626    	 , pa_cal.cal_period_id TIME_ID
12627    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
12628    	 , DECODE(fact.CALENDAR_TYPE, 'P', 'G', 'G', 'P') CALENDAR_TYPE
12629          , fact.RBS_AGGR_LEVEL RBS_AGGR_LEVEL
12630          , fact.WBS_ROLLUP_FLAG WBS_ROLLUP_FLAG
12631          , fact.PRG_ROLLUP_FLAG PRG_ROLLUP_FLAG
12632          , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
12633    	 , fact.CURRENCY_CODE CURRENCY_CODE
12634    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
12635    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
12636    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
12637    	 , fact.PLAN_TYPE_ID PLAN_TYPE_ID
12638    	 , SUM(fact.RAW_COST)	 raw_cost
12639    	 , SUM(fact.BRDN_COST) BRDN_COST
12640    	 , SUM(fact.REVENUE) REVENUE
12641    	 , SUM(fact.BILL_RAW_COST) BILL_RAW_COST
12642    	 , SUM(fact.BILL_BRDN_COST) BILL_BRDN_COST
12643    	 , SUM(fact.BILL_LABOR_RAW_COST) BILL_LABOR_RAW_COST
12644    	 , SUM(fact.BILL_LABOR_BRDN_COST) BILL_LABOR_BRDN_COST
12645    	 , SUM(fact.BILL_LABOR_HRS) BILL_LABOR_HRS
12646    	 , SUM(fact.EQUIPMENT_RAW_COST) EQUIPMENT_RAW_COST
12647    	 , SUM(fact.EQUIPMENT_BRDN_COST) EQUIPMENT_BRDN_COST
12648    	 , SUM(fact.CAPITALIZABLE_RAW_COST) CAPITALIZABLE_RAW_COST
12649    	 , SUM(fact.CAPITALIZABLE_BRDN_COST) CAPITALIZABLE_BRDN_COST
12650    	 , SUM(fact.LABOR_RAW_COST) LABOR_RAW_COST
12651    	 , SUM(fact.LABOR_BRDN_COST) LABOR_BRDN_COST
12652    	 , SUM(fact.LABOR_HRS) LABOR_HRS
12653    	 , SUM(fact.LABOR_REVENUE) LABOR_REVENUE
12654    	 , SUM(fact.EQUIPMENT_HOURS) EQUIPMENT_HOURS
12655    	 , SUM(fact.BILLABLE_EQUIPMENT_HOURS) BILLABLE_EQUIPMENT_HOURS
12656    	 , SUM(fact.SUP_INV_COMMITTED_COST) SUP_INV_COMMITTED_COST
12657    	 , SUM(fact.PO_COMMITTED_COST) PO_COMMITTED_COST
12658    	 , SUM(fact.PR_COMMITTED_COST) PR_COMMITTED_COST
12659    	 , SUM(fact.OTH_COMMITTED_COST) OTH_COMMITTED_COST
12660          , SUM(fact.ACT_LABOR_HRS )
12661 	 , SUM(fact.ACT_EQUIP_HRS )
12662 	 , SUM(fact.ACT_LABOR_BRDN_COST )
12663 	 , SUM(fact.ACT_EQUIP_BRDN_COST )
12664 	 , SUM(fact.ACT_BRDN_COST )
12665 	 , SUM(fact.ACT_RAW_COST )
12666 	 , SUM(fact.ACT_REVENUE )
12667          , SUM(fact.ACT_LABOR_RAW_COST)
12668          , SUM(fact.ACT_EQUIP_RAW_COST)
12669 	 , SUM(fact.ETC_LABOR_HRS )
12670 	 , SUM(fact.ETC_EQUIP_HRS )
12671 	 , SUM(fact.ETC_LABOR_BRDN_COST )
12672 	 , SUM(fact.ETC_EQUIP_BRDN_COST )
12673 	 , SUM(fact.ETC_BRDN_COST )
12674          , SUM(fact.ETC_RAW_COST )
12675          , SUM(fact.ETC_LABOR_RAW_COST)
12676          , SUM(fact.ETC_EQUIP_RAW_COST)
12677    	 , SUM(fact.CUSTOM1) CUSTOM1
12678    	 , SUM(fact.CUSTOM2) CUSTOM2
12679    	 , SUM(fact.CUSTOM3) CUSTOM3
12680    	 , SUM(fact.CUSTOM4) CUSTOM4
12681    	 , SUM(fact.CUSTOM5) CUSTOM5
12682    	 , SUM(fact.CUSTOM6) CUSTOM6
12683    	 , SUM(fact.CUSTOM7) CUSTOM7
12684    	 , SUM(fact.CUSTOM8) CUSTOM8
12685    	 , SUM(fact.CUSTOM9) CUSTOM9
12686    	 , SUM(fact.CUSTOM10) CUSTOM10
12687    	 , SUM(fact.CUSTOM11) CUSTOM11
12688    	 , SUM(fact.CUSTOM12) CUSTOM12
12689    	 , SUM(fact.CUSTOM13) CUSTOM13
12690    	 , SUM(fact.CUSTOM14) CUSTOM14
12691    	 , SUM(fact.CUSTOM15) CUSTOM15
12692 	 , NULL TIME_DANGLING_FLAG
12693 	 , NULL RATE_DANGLING_FLAG
12694          , g_default_prg_level prg_level
12695          , fact.PLAN_TYPE_CODE   PLAN_TYPE_CODe   /* 4471527 */
12696      FROM  pji_fp_aggr_pjp1_t fact
12697          , pji_time_cal_period_v  non_pa_cal
12698    	 , pji_org_extr_info  orginfo
12699    	 , pji_time_cal_period_v  pa_cal
12700          , pji_fm_extr_plnver3_t  ver
12701    WHERE  fact.CALENDAR_TYPE <> p_calendar_type
12702       AND fact.worker_id = g_worker_id
12703       AND fact.CALENDAR_TYPE IN ('P', 'G')
12704       AND non_pa_cal.cal_period_id = fact.time_id
12705       AND fact.line_type like 'OF%'
12706       AND orginfo.org_id = fact.PROJECT_ORG_ID
12707       AND DECODE(fact.calendar_type, 'P', orginfo.gl_calendar_id, 'G', orginfo.pa_calendar_id) = pa_cal.calendar_id
12708       AND ( non_pa_cal.start_date <= pa_cal.end_date AND non_pa_cal.end_date >= pa_cal.start_date )
12709       AND fact.period_type_id = 32
12710       AND fact.plan_version_id = ver.plan_version_id
12711       AND fact.plan_type_code = ver.plan_type_code   /* 4471527 */
12712       AND ver.wp_flag = 'N'
12713       AND ver.baselined_flag = 'Y'
12714       -- AND (ver.rbs_struct_version_id = fact.rbs_version_id OR fact.rbs_version_id = -1)
12715       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
12716       AND DECODE(p_prorating_format,'S',
12717              DECODE(SIGN(non_pa_cal.start_Date-pa_cal.start_date),-1,0,1),
12718              DECODE(SIGN(non_pa_cal.end_Date - pa_cal.end_date), 1,0,1))=1
12719    GROUP BY
12720            fact.project_id
12721 	 , fact.PROJECT_ORG_ID
12722 	 , fact.PROJECT_ORGANIZATION_ID
12723    	 , fact.PROJECT_ELEMENT_ID
12724    	 , pa_cal.cal_period_id
12725    	 , fact.PERIOD_TYPE_ID
12726    	 , fact.CALENDAR_TYPE
12727          , fact.RBS_AGGR_LEVEL
12728          , fact.WBS_ROLLUP_FLAG
12729          , fact.PRG_ROLLUP_FLAG
12730          , fact.CURR_RECORD_TYPE_ID
12731    	 , fact.CURRENCY_CODE
12732    	 , fact.RBS_ELEMENT_ID
12733    	 , fact.RBS_VERSION_ID
12734    	 , fact.PLAN_VERSION_ID
12735    	 , fact.PLAN_TYPE_ID
12736               , fact.PLAN_TYPE_CODe  ;   /* 4471527 */
12737 
12738 EXCEPTION
12739   WHEN OTHERS THEN
12740     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
12741                              p_procedure_name => 'PRORATE_TO_PAGL_PGE_PJP1_SE');
12742     RAISE;
12743 END;
12744 
12745 
12746 PROCEDURE PRORATE_TO_PAGL_PGE_FPRL_SE (p_calendar_type   IN   VARCHAR2 := NULL) IS
12747 BEGIN
12748 
12749     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
12750 
12751     INSERT INTO pji_fp_aggr_pjp1_t -- For PA/GL entries.
12752     (
12753        worker_id
12754      , PROJECT_ID
12755      , PROJECT_ORG_ID
12756      , PROJECT_ORGANIZATION_ID
12757      -- , PARTITION_ID
12758      , PROJECT_ELEMENT_ID
12759      , TIME_ID
12760      , PERIOD_TYPE_ID
12761      , CALENDAR_TYPE
12762      , RBS_AGGR_LEVEL
12763      , WBS_ROLLUP_FLAG
12764      , PRG_ROLLUP_FLAG
12765      , CURR_RECORD_TYPE_ID
12766      , CURRENCY_CODE
12767      , RBS_ELEMENT_ID
12768      , RBS_VERSION_ID
12769      , PLAN_VERSION_ID
12770      , PLAN_TYPE_ID
12771      , RAW_COST
12772      , BRDN_COST
12773      , REVENUE
12774      , BILL_RAW_COST
12775      , BILL_BRDN_COST
12776      , BILL_LABOR_RAW_COST
12777      , BILL_LABOR_BRDN_COST
12778      , BILL_LABOR_HRS
12779      , EQUIPMENT_RAW_COST
12780      , EQUIPMENT_BRDN_COST
12781      , CAPITALIZABLE_RAW_COST
12782      , CAPITALIZABLE_BRDN_COST
12783      , LABOR_RAW_COST
12784      , LABOR_BRDN_COST
12785      , LABOR_HRS
12786      , LABOR_REVENUE
12787      , EQUIPMENT_HOURS
12788      , BILLABLE_EQUIPMENT_HOURS
12789      , SUP_INV_COMMITTED_COST
12790      , PO_COMMITTED_COST
12791      , PR_COMMITTED_COST
12792      , OTH_COMMITTED_COST
12793        , ACT_LABOR_HRS
12794 	   , ACT_EQUIP_HRS
12795 	   , ACT_LABOR_BRDN_COST
12796 	   , ACT_EQUIP_BRDN_COST
12797 	   , ACT_BRDN_COST
12798 	   , ACT_RAW_COST
12799 	   , ACT_REVENUE
12800          , ACT_LABOR_RAW_COST
12801          , ACT_EQUIP_RAW_COST
12802 	   , ETC_LABOR_HRS
12803 	   , ETC_EQUIP_HRS
12804 	   , ETC_LABOR_BRDN_COST
12805 	   , ETC_EQUIP_BRDN_COST
12806 	   , ETC_BRDN_COST
12807          , ETC_RAW_COST
12808          , ETC_LABOR_RAW_COST
12809          , ETC_EQUIP_RAW_COST
12810      , CUSTOM1
12811      , CUSTOM2
12812      , CUSTOM3
12813      , CUSTOM4
12814      , CUSTOM5
12815      , CUSTOM6
12816      , CUSTOM7
12817      , CUSTOM8
12818      , CUSTOM9
12819      , CUSTOM10
12820      , CUSTOM11
12821      , CUSTOM12
12822      , CUSTOM13
12823      , CUSTOM14
12824      , CUSTOM15
12825      , LINE_TYPE
12826      , TIME_DANGLING_FLAG
12827      , RATE_DANGLING_FLAG
12828      , PRG_LEVEL
12829      , PLAN_TYPE_CODE    /* 4471527 */
12830    )
12831    SELECT
12832          g_worker_id
12833        , fact.project_id  project_id
12834 	 , fact.PROJECT_ORG_ID project_org_id
12835 	 , fact.PROJECT_ORGANIZATION_ID project_organization_id
12836      -- , fact.PARTITION_ID PARTITION_ID
12837    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
12838    	 , pa_cal.cal_period_id TIME_ID
12839    	 , fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
12840    	 , DECODE(fact.CALENDAR_TYPE, 'P', 'G', 'G', 'P') CALENDAR_TYPE
12841      , fact.RBS_AGGR_LEVEL RBS_AGGR_LEVEL
12842      , fact.WBS_ROLLUP_FLAG WBS_ROLLUP_FLAG
12843      , fact.PRG_ROLLUP_FLAG PRG_ROLLUP_FLAG
12844      , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
12845    	 , fact.CURRENCY_CODE CURRENCY_CODE
12846    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
12847    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
12848    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
12849    	 , fact.PLAN_TYPE_ID PLAN_TYPE_ID
12850    	 , MAX(fact.RAW_COST)	 raw_cost
12851    	 , MAX(fact.BRDN_COST) BRDN_COST
12852    	 , MAX(fact.REVENUE) REVENUE
12853    	 , MAX(fact.BILL_RAW_COST) BILL_RAW_COST
12854    	 , MAX(fact.BILL_BRDN_COST) BILL_BRDN_COST
12855    	 , MAX(fact.BILL_LABOR_RAW_COST) BILL_LABOR_RAW_COST
12856    	 , MAX(fact.BILL_LABOR_BRDN_COST) BILL_LABOR_BRDN_COST
12857    	 , MAX(fact.BILL_LABOR_HRS) BILL_LABOR_HRS
12858    	 , MAX(fact.EQUIPMENT_RAW_COST) EQUIPMENT_RAW_COST
12859    	 , MAX(fact.EQUIPMENT_BRDN_COST) EQUIPMENT_BRDN_COST
12860    	 , MAX(fact.CAPITALIZABLE_RAW_COST) CAPITALIZABLE_RAW_COST
12861    	 , MAX(fact.CAPITALIZABLE_BRDN_COST) CAPITALIZABLE_BRDN_COST
12862    	 , MAX(fact.LABOR_RAW_COST) LABOR_RAW_COST
12863    	 , MAX(fact.LABOR_BRDN_COST) LABOR_BRDN_COST
12864    	 , MAX(fact.LABOR_HRS) LABOR_HRS
12865    	 , MAX(fact.LABOR_REVENUE) LABOR_REVENUE
12866    	 , MAX(fact.EQUIPMENT_HOURS) EQUIPMENT_HOURS
12867    	 , MAX(fact.BILLABLE_EQUIPMENT_HOURS) BILLABLE_EQUIPMENT_HOURS
12868    	 , MAX(fact.SUP_INV_COMMITTED_COST) SUP_INV_COMMITTED_COST
12869    	 , MAX(fact.PO_COMMITTED_COST) PO_COMMITTED_COST
12870    	 , MAX(fact.PR_COMMITTED_COST) PR_COMMITTED_COST
12871    	 , MAX(fact.OTH_COMMITTED_COST) OTH_COMMITTED_COST
12872        , MAX(fact.ACT_LABOR_HRS )
12873 	 , MAX(fact.ACT_EQUIP_HRS )
12874 	 , MAX(fact.ACT_LABOR_BRDN_COST )
12875 	 , MAX(fact.ACT_EQUIP_BRDN_COST )
12876 	 , MAX(fact.ACT_BRDN_COST )
12877 	 , MAX(fact.ACT_RAW_COST )
12878 	 , MAX(fact.ACT_REVENUE )
12879        , MAX(fact.ACT_LABOR_RAW_COST)
12880        , MAX(fact.ACT_EQUIP_RAW_COST)
12881 	 , MAX(fact.ETC_LABOR_HRS )
12882 	 , MAX(fact.ETC_EQUIP_HRS )
12883 	 , MAX(fact.ETC_LABOR_BRDN_COST )
12884 	 , MAX(fact.ETC_EQUIP_BRDN_COST )
12885 	 , MAX(fact.ETC_BRDN_COST )
12886        , MAX(fact.ETC_RAW_COST )
12887        , MAX(fact.ETC_LABOR_RAW_COST)
12888        , MAX(fact.ETC_EQUIP_RAW_COST)
12889    	 , MAX(fact.CUSTOM1) CUSTOM1
12890    	 , MAX(fact.CUSTOM2) CUSTOM2
12891    	 , MAX(fact.CUSTOM3) CUSTOM3
12892    	 , MAX(fact.CUSTOM4) CUSTOM4
12893    	 , MAX(fact.CUSTOM5) CUSTOM5
12894    	 , MAX(fact.CUSTOM6) CUSTOM6
12895    	 , MAX(fact.CUSTOM7) CUSTOM7
12896    	 , MAX(fact.CUSTOM8) CUSTOM8
12897    	 , MAX(fact.CUSTOM9) CUSTOM9
12898    	 , MAX(fact.CUSTOM10) CUSTOM10
12899    	 , MAX(fact.CUSTOM11) CUSTOM11
12900    	 , MAX(fact.CUSTOM12) CUSTOM12
12901    	 , MAX(fact.CUSTOM13) CUSTOM13
12902    	 , MAX(fact.CUSTOM14) CUSTOM14
12903    	 , MAX(fact.CUSTOM15) CUSTOM15
12904    	 -- , DECODE ('E', 'E', MAX(pa_cal.start_date), 'S', MIN(pa_cal.start_date)) start_date
12905    	 -- , DECODE ('E', 'E', MAX(pa_cal.end_date), 'S', MIN(pa_cal.end_date))	 end_date
12906        , 'CF'   line_type
12907 	 , NULL  TIME_DANGLING_FLAG
12908 	 , NULL RATE_DANGLING_FLAG
12909        , g_default_prg_level prg_level
12910        , fact.plan_type_code  plan_type_code    /* 4471527 */
12911    FROM   pji_fp_xbs_accum_f  fact
12912        , PJI_FM_EXTR_PLNVER3_T ver
12913         , pji_time_cal_period  non_pa_cal
12914    	 , pji_org_extr_info  orginfo
12915    	 , pji_time_cal_period  pa_cal
12916    WHERE  fact.CALENDAR_TYPE <> p_calendar_type
12917       AND fact.CALENDAR_TYPE IN ('P', 'G')
12918       AND non_pa_cal.cal_period_id = fact.time_id
12919       AND ver.project_id = fact.project_id
12920       AND ver.plan_version_id = fact.plan_version_id
12921       ANd ver.plan_type_code = fact.plan_type_code    /*  4471527 */
12922       AND orginfo.org_id = fact.PROJECT_ORG_ID
12923       AND DECODE(fact.calendar_type, 'P', orginfo.gl_calendar_id, 'G', orginfo.pa_calendar_id) = pa_cal.calendar_id
12924       AND pa_cal.start_date >= non_pa_cal.start_date
12925       AND ( non_pa_cal.end_date <= pa_cal.end_date AND non_pa_cal.end_date >= pa_cal.start_date )
12926       AND fact.period_type_id = 32
12927       AND ver.wp_flag = 'N'
12928       AND ver.baselined_flag = 'Y'
12929       -- AND (ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
12930       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
12931    GROUP BY
12932        fact.project_id
12933 	 , fact.PROJECT_ORG_ID
12934 	 , fact.PROJECT_ORGANIZATION_ID
12935      -- , fact.PARTITION_ID
12936    	 , fact.PROJECT_ELEMENT_ID
12937    	 , pa_cal.cal_period_id
12938    	 , fact.PERIOD_TYPE_ID
12939    	 , fact.CALENDAR_TYPE
12940      , fact.RBS_AGGR_LEVEL
12941      , fact.WBS_ROLLUP_FLAG
12942      , fact.PRG_ROLLUP_FLAG
12943      , fact.CURR_RECORD_TYPE_ID
12944    	 , fact.CURRENCY_CODE
12945    	 , fact.RBS_ELEMENT_ID
12946    	 , fact.RBS_VERSION_ID
12947    	 , fact.PLAN_VERSION_ID
12948    	 , fact.PLAN_TYPE_ID
12949               , fact.PLAN_TYPE_CODE ;   /* 4471527 */
12950 
12951 
12952 EXCEPTION
12953   WHEN OTHERS THEN
12954     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
12955                              p_procedure_name => 'PRORATE_TO_PAGL_PGE_FPRL_SE');
12956     RAISE;
12957 END;
12958 
12959 
12960 PROCEDURE PRORATE_TO_PAGL_N_PJP1_SE (p_calendar_type    IN   VARCHAR2 := NULL,
12961                                      p_prorating_format IN   VARCHAR2) IS
12962 BEGIN
12963 
12964     IF (p_calendar_type NOT IN ('P', 'G')) THEN
12965       RETURN;
12966     END IF;
12967 
12968     -- g_worker_id  := PJI_PJP_FP_CURR_WRAP.GET_WORKER_ID;
12969  /* Commented for bug 4005006
12970     INSERT INTO pji_fp_aggr_pjp1_t -- For non time phased entries.
12971     (
12972        worker_id
12973      , PROJECT_ID
12974      , PROJECT_ORG_ID
12975      , PROJECT_ORGANIZATION_ID
12976      -- , PARTITION_ID
12977      , PROJECT_ELEMENT_ID
12978      , TIME_ID
12979      , PERIOD_TYPE_ID
12980      , CALENDAR_TYPE
12981      , RBS_AGGR_LEVEL
12982      , WBS_ROLLUP_FLAG
12983      , PRG_ROLLUP_FLAG
12984      , CURR_RECORD_TYPE_ID
12985      , CURRENCY_CODE
12986      , RBS_ELEMENT_ID
12987      , RBS_VERSION_ID
12988      , PLAN_VERSION_ID
12989      , PLAN_TYPE_ID
12990      , RAW_COST
12991      , BRDN_COST
12992      , REVENUE
12993      , BILL_RAW_COST
12994      , BILL_BRDN_COST
12995      , BILL_LABOR_RAW_COST
12996      , BILL_LABOR_BRDN_COST
12997      , BILL_LABOR_HRS
12998      , EQUIPMENT_RAW_COST
12999      , EQUIPMENT_BRDN_COST
13000      , CAPITALIZABLE_RAW_COST
13001      , CAPITALIZABLE_BRDN_COST
13002      , LABOR_RAW_COST
13003      , LABOR_BRDN_COST
13004      , LABOR_HRS
13005      , LABOR_REVENUE
13006      , EQUIPMENT_HOURS
13007      , BILLABLE_EQUIPMENT_HOURS
13008      , SUP_INV_COMMITTED_COST
13009      , PO_COMMITTED_COST
13010      , PR_COMMITTED_COST
13011      , OTH_COMMITTED_COST
13012        , ACT_LABOR_HRS
13013 	   , ACT_EQUIP_HRS
13014 	   , ACT_LABOR_BRDN_COST
13015 	   , ACT_EQUIP_BRDN_COST
13016 	   , ACT_BRDN_COST
13017 	   , ACT_RAW_COST
13018 	   , ACT_REVENUE
13019          , ACT_LABOR_RAW_COST
13020          , ACT_EQUIP_RAW_COST
13021 	   , ETC_LABOR_HRS
13022 	   , ETC_EQUIP_HRS
13023 	   , ETC_LABOR_BRDN_COST
13024 	   , ETC_EQUIP_BRDN_COST
13025 	   , ETC_BRDN_COST
13026          , ETC_RAW_COST
13027          , ETC_LABOR_RAW_COST
13028          , ETC_EQUIP_RAW_COST
13029      , CUSTOM1
13030      , CUSTOM2
13031      , CUSTOM3
13032      , CUSTOM4
13033      , CUSTOM5
13034      , CUSTOM6
13035      , CUSTOM7
13036      , CUSTOM8
13037      , CUSTOM9
13038      , CUSTOM10
13039      , CUSTOM11
13040      , CUSTOM12
13041      , CUSTOM13
13042      , CUSTOM14
13043      , CUSTOM15
13044      , LINE_TYPE
13045      , TIME_DANGLING_FLAG
13046      , RATE_DANGLING_FLAG
13047      , PRG_LEVEL
13048    )
13049    SELECT
13050          g_worker_id
13051        , fact.project_id  project_id
13052 	 , fact.PROJECT_ORG_ID project_org_id
13053 	 , fact.PROJECT_ORGANIZATION_ID project_organization_id
13054      -- , fact.PARTITION_ID PARTITION_ID
13055    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
13056    	 , pa_cal.cal_period_id TIME_ID
13057    	 , 32 -- fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
13058    --    , fact.CALENDAR_TYPE CALENDAR_TYPE
13059          ,DECODE(pa_cal.calendar_id,orginfo.pa_calendar_id,'P',orginfo.gl_calendar_id,'G')
13060       , fact.RBS_AGGR_LEVEL RBS_AGGR_LEVEL
13061      , fact.WBS_ROLLUP_FLAG WBS_ROLLUP_FLAG
13062      , fact.PRG_ROLLUP_FLAG PRG_ROLLUP_FLAG
13063      , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
13064    	 , fact.CURRENCY_CODE CURRENCY_CODE
13065    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
13066    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
13067    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
13068    	 , fact.PLAN_TYPE_ID PLAN_TYPE_ID
13069    	 , MAX(fact.RAW_COST)	 raw_cost
13070    	 , MAX(fact.BRDN_COST) BRDN_COST
13071    	 , MAX(fact.REVENUE) REVENUE
13072    	 , MAX(fact.BILL_RAW_COST) BILL_RAW_COST
13073    	 , MAX(fact.BILL_BRDN_COST) BILL_BRDN_COST
13074    	 , MAX(fact.BILL_LABOR_RAW_COST) BILL_LABOR_RAW_COST
13075    	 , MAX(fact.BILL_LABOR_BRDN_COST) BILL_LABOR_BRDN_COST
13076    	 , MAX(fact.BILL_LABOR_HRS) BILL_LABOR_HRS
13077    	 , MAX(fact.EQUIPMENT_RAW_COST) EQUIPMENT_RAW_COST
13078    	 , MAX(fact.EQUIPMENT_BRDN_COST) EQUIPMENT_BRDN_COST
13079    	 , MAX(fact.CAPITALIZABLE_RAW_COST) CAPITALIZABLE_RAW_COST
13080    	 , MAX(fact.CAPITALIZABLE_BRDN_COST) CAPITALIZABLE_BRDN_COST
13081    	 , MAX(fact.LABOR_RAW_COST) LABOR_RAW_COST
13082    	 , MAX(fact.LABOR_BRDN_COST) LABOR_BRDN_COST
13083    	 , MAX(fact.LABOR_HRS) LABOR_HRS
13084    	 , MAX(fact.LABOR_REVENUE) LABOR_REVENUE
13085    	 , MAX(fact.EQUIPMENT_HOURS) EQUIPMENT_HOURS
13086    	 , MAX(fact.BILLABLE_EQUIPMENT_HOURS) BILLABLE_EQUIPMENT_HOURS
13087    	 , MAX(fact.SUP_INV_COMMITTED_COST) SUP_INV_COMMITTED_COST
13088    	 , MAX(fact.PO_COMMITTED_COST) PO_COMMITTED_COST
13089    	 , MAX(fact.PR_COMMITTED_COST) PR_COMMITTED_COST
13090    	 , MAX(fact.OTH_COMMITTED_COST) OTH_COMMITTED_COST
13091        , MAX(fact.ACT_LABOR_HRS )
13092 	 , MAX(fact.ACT_EQUIP_HRS )
13093 	 , MAX(fact.ACT_LABOR_BRDN_COST )
13094 	 , MAX(fact.ACT_EQUIP_BRDN_COST )
13095 	 , MAX(fact.ACT_BRDN_COST )
13096 	 , MAX(fact.ACT_RAW_COST )
13097 	 , MAX(fact.ACT_REVENUE )
13098        , MAX(fact.ACT_LABOR_RAW_COST)
13099        , MAX(fact.ACT_EQUIP_RAW_COST)
13100 	 , MAX(fact.ETC_LABOR_HRS )
13101 	 , MAX(fact.ETC_EQUIP_HRS )
13102 	 , MAX(fact.ETC_LABOR_BRDN_COST )
13103 	 , MAX(fact.ETC_EQUIP_BRDN_COST )
13104 	 , MAX(fact.ETC_BRDN_COST )
13105        , MAX(fact.ETC_RAW_COST )
13106        , MAX(fact.ETC_LABOR_RAW_COST)
13107        , MAX(fact.ETC_EQUIP_RAW_COST)
13108    	 , MAX(fact.CUSTOM1) CUSTOM1
13109    	 , MAX(fact.CUSTOM2) CUSTOM2
13110    	 , MAX(fact.CUSTOM3) CUSTOM3
13111    	 , MAX(fact.CUSTOM4) CUSTOM4
13112    	 , MAX(fact.CUSTOM5) CUSTOM5
13113    	 , MAX(fact.CUSTOM6) CUSTOM6
13114    	 , MAX(fact.CUSTOM7) CUSTOM7
13115    	 , MAX(fact.CUSTOM8) CUSTOM8
13116    	 , MAX(fact.CUSTOM9) CUSTOM9
13117    	 , MAX(fact.CUSTOM10) CUSTOM10
13118    	 , MAX(fact.CUSTOM11) CUSTOM11
13119    	 , MAX(fact.CUSTOM12) CUSTOM12
13120    	 , MAX(fact.CUSTOM13) CUSTOM13
13121    	 , MAX(fact.CUSTOM14) CUSTOM14
13122    	 , MAX(fact.CUSTOM15) CUSTOM15
13123    	 -- , DECODE ('E', 'E', MAX(pa_cal.start_date), 'S', MIN(pa_cal.start_date)) start_date
13124    	 -- , DECODE ('E', 'E', MAX(pa_cal.end_date), 'S', MIN(pa_cal.end_date))	 end_date
13125      , 'CN'   line_type
13126 	 , NULL  TIME_DANGLING_FLAG
13127 	 , NULL  RATE_DANGLING_FLAG
13128        , g_default_prg_level prg_level
13129    FROM   pji_fp_aggr_pjp1_t fact
13130    	 , pji_org_extr_info  orginfo
13131    	 , pji_time_cal_period  pa_cal
13132        , pji_fm_extr_plnver3_t  ver
13133    WHERE  1=1
13134       AND fact.CALENDAR_TYPE = 'A'
13135       AND orginfo.org_id = fact.PROJECT_ORG_ID
13136       AND DECODE(p_calendar_type
13137                , 'P', orginfo.pa_calendar_id
13138                , 'G', orginfo.gl_calendar_id) = pa_cal.calendar_id
13139       AND fact.start_date IS NOT NULL
13140       AND fact.end_date IS NOT NULL
13141       AND (
13142 	       (     pa_cal.start_date >= fact.start_date
13143                AND pa_cal.end_date <= fact.end_date ) -- fsps,pefe
13144 	    OR (     pa_cal.start_date <= fact.start_date
13145                AND pa_cal.end_date >= fact.end_date ) -- psfs,fepe
13146 	    OR (     pa_cal.start_date <= fact.start_date
13147                AND pa_cal.end_date <= fact.end_date
13148                AND pa_cal.end_date >= fact.start_date ) -- psfspefe
13149 	    OR (     pa_cal.start_date >= fact.start_date
13150                AND pa_cal.end_date >= fact.end_date
13151                AND pa_cal.start_date <= fact.end_date )  -- fspsfepe
13152           )
13153       AND fact.period_type_id = 2048
13154       AND fact.plan_version_id = ver.plan_version_id
13155       AND ver.wp_flag = 'N'
13156       AND ver.baselined_flag = 'Y'
13157       AND ver.time_phased_type_code = 'N'
13158       AND fact.line_type = 'NTP'
13159       AND fact.worker_id = g_worker_id
13160 	-- AND (ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
13161       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
13162    GROUP BY
13163        fact.project_id
13164 	 , fact.PROJECT_ORG_ID
13165 	 , fact.PROJECT_ORGANIZATION_ID
13166      -- , fact.PARTITION_ID
13167    	 , fact.PROJECT_ELEMENT_ID
13168    	 , pa_cal.cal_period_id
13169    	 , fact.PERIOD_TYPE_ID
13170    	 , fact.CALENDAR_TYPE
13171      , fact.RBS_AGGR_LEVEL
13172      , fact.WBS_ROLLUP_FLAG
13173      , fact.PRG_ROLLUP_FLAG
13174      , fact.CURR_RECORD_TYPE_ID
13175    	 , fact.CURRENCY_CODE
13176    	 , fact.RBS_ELEMENT_ID
13177    	 , fact.RBS_VERSION_ID
13178    	 , fact.PLAN_VERSION_ID
13179    	 , fact.PLAN_TYPE_ID
13180 	 , fact.TIME_DANGLING_FLAG
13181 	 , fact.RATE_DANGLING_FLAG
13182          ,pa_cal.CALENDAR_ID,
13183 	 orginfo.pa_calendar_id,
13184 	 orginfo.gl_calendar_id;
13185  End of bug 4005006*/
13186 
13187     INSERT INTO pji_fp_aggr_pjp1_t -- For non time phased entries.
13188     (
13189        worker_id
13190      , PROJECT_ID
13191      , PROJECT_ORG_ID
13192      , PROJECT_ORGANIZATION_ID
13193      , PROJECT_ELEMENT_ID
13194      , TIME_ID
13195      , PERIOD_TYPE_ID
13196      , CALENDAR_TYPE
13197      , RBS_AGGR_LEVEL
13198      , WBS_ROLLUP_FLAG
13199      , PRG_ROLLUP_FLAG
13200      , CURR_RECORD_TYPE_ID
13201      , CURRENCY_CODE
13202      , RBS_ELEMENT_ID
13203      , RBS_VERSION_ID
13204      , PLAN_VERSION_ID
13205      , PLAN_TYPE_ID
13206      , RAW_COST
13207      , BRDN_COST
13208      , REVENUE
13209      , BILL_RAW_COST
13210      , BILL_BRDN_COST
13211      , BILL_LABOR_RAW_COST
13212      , BILL_LABOR_BRDN_COST
13213      , BILL_LABOR_HRS
13214      , EQUIPMENT_RAW_COST
13215      , EQUIPMENT_BRDN_COST
13216      , CAPITALIZABLE_RAW_COST
13217      , CAPITALIZABLE_BRDN_COST
13218      , LABOR_RAW_COST
13219      , LABOR_BRDN_COST
13220      , LABOR_HRS
13221      , LABOR_REVENUE
13222      , EQUIPMENT_HOURS
13223      , BILLABLE_EQUIPMENT_HOURS
13224      , SUP_INV_COMMITTED_COST
13225      , PO_COMMITTED_COST
13226      , PR_COMMITTED_COST
13227      , OTH_COMMITTED_COST
13228      , ACT_LABOR_HRS
13229      , ACT_EQUIP_HRS
13230      , ACT_LABOR_BRDN_COST
13231      , ACT_EQUIP_BRDN_COST
13232      , ACT_BRDN_COST
13233      , ACT_RAW_COST
13234      , ACT_REVENUE
13235      , ACT_LABOR_RAW_COST
13236      , ACT_EQUIP_RAW_COST
13237      , ETC_LABOR_HRS
13238      , ETC_EQUIP_HRS
13239      , ETC_LABOR_BRDN_COST
13240      , ETC_EQUIP_BRDN_COST
13241      , ETC_BRDN_COST
13242      , ETC_RAW_COST
13243      , ETC_LABOR_RAW_COST
13244      , ETC_EQUIP_RAW_COST
13245      , CUSTOM1
13246      , CUSTOM2
13247      , CUSTOM3
13248      , CUSTOM4
13249      , CUSTOM5
13250      , CUSTOM6
13251      , CUSTOM7
13252      , CUSTOM8
13253      , CUSTOM9
13254      , CUSTOM10
13255      , CUSTOM11
13256      , CUSTOM12
13257      , CUSTOM13
13258      , CUSTOM14
13259      , CUSTOM15
13260      , TIME_DANGLING_FLAG
13261      , RATE_DANGLING_FLAG
13262      , PRG_LEVEL
13263      , PLAN_TYPE_CODE   /* 4471527 */
13264    )
13265    SELECT
13266            g_worker_id
13267          , fact.project_id  project_id
13268 	 , fact.PROJECT_ORG_ID project_org_id
13269 	 , fact.PROJECT_ORGANIZATION_ID project_organization_id
13270    	 , fact.PROJECT_ELEMENT_ID PROJECT_ELEMENT_ID
13271    	 , pa_cal.cal_period_id TIME_ID
13272    	 , 32 -- fact.PERIOD_TYPE_ID PERIOD_TYPE_ID
13273          , DECODE(pa_cal.calendar_id,orginfo.pa_calendar_id,'P',orginfo.gl_calendar_id,'G') CALENDAR_TYPE
13274          , fact.RBS_AGGR_LEVEL RBS_AGGR_LEVEL
13275          , fact.WBS_ROLLUP_FLAG WBS_ROLLUP_FLAG
13276          , fact.PRG_ROLLUP_FLAG PRG_ROLLUP_FLAG
13277          , fact.CURR_RECORD_TYPE_ID CURR_RECORD_TYPE_ID
13278    	 , fact.CURRENCY_CODE CURRENCY_CODE
13279    	 , fact.RBS_ELEMENT_ID RBS_ELEMENT_ID
13280    	 , fact.RBS_VERSION_ID RBS_VERSION_ID
13281    	 , fact.PLAN_VERSION_ID PLAN_VERSION_ID
13282    	 , fact.PLAN_TYPE_ID PLAN_TYPE_ID
13283    	 , SUM(fact.RAW_COST)	 raw_cost
13284    	 , SUM(fact.BRDN_COST) BRDN_COST
13285    	 , SUM(fact.REVENUE) REVENUE
13286    	 , SUM(fact.BILL_RAW_COST) BILL_RAW_COST
13287    	 , SUM(fact.BILL_BRDN_COST) BILL_BRDN_COST
13288    	 , SUM(fact.BILL_LABOR_RAW_COST) BILL_LABOR_RAW_COST
13289    	 , SUM(fact.BILL_LABOR_BRDN_COST) BILL_LABOR_BRDN_COST
13290    	 , SUM(fact.BILL_LABOR_HRS) BILL_LABOR_HRS
13291    	 , SUM(fact.EQUIPMENT_RAW_COST) EQUIPMENT_RAW_COST
13292    	 , SUM(fact.EQUIPMENT_BRDN_COST) EQUIPMENT_BRDN_COST
13293    	 , SUM(fact.CAPITALIZABLE_RAW_COST) CAPITALIZABLE_RAW_COST
13294    	 , SUM(fact.CAPITALIZABLE_BRDN_COST) CAPITALIZABLE_BRDN_COST
13295    	 , SUM(fact.LABOR_RAW_COST) LABOR_RAW_COST
13296    	 , SUM(fact.LABOR_BRDN_COST) LABOR_BRDN_COST
13297    	 , SUM(fact.LABOR_HRS) LABOR_HRS
13298    	 , SUM(fact.LABOR_REVENUE) LABOR_REVENUE
13299    	 , SUM(fact.EQUIPMENT_HOURS) EQUIPMENT_HOURS
13300    	 , SUM(fact.BILLABLE_EQUIPMENT_HOURS) BILLABLE_EQUIPMENT_HOURS
13301    	 , SUM(fact.SUP_INV_COMMITTED_COST) SUP_INV_COMMITTED_COST
13302    	 , SUM(fact.PO_COMMITTED_COST) PO_COMMITTED_COST
13303    	 , SUM(fact.PR_COMMITTED_COST) PR_COMMITTED_COST
13304    	 , SUM(fact.OTH_COMMITTED_COST) OTH_COMMITTED_COST
13305          , SUM(fact.ACT_LABOR_HRS )
13306 	 , SUM(fact.ACT_EQUIP_HRS )
13307 	 , SUM(fact.ACT_LABOR_BRDN_COST )
13308 	 , SUM(fact.ACT_EQUIP_BRDN_COST )
13309 	 , SUM(fact.ACT_BRDN_COST )
13310 	 , SUM(fact.ACT_RAW_COST )
13311 	 , SUM(fact.ACT_REVENUE )
13312          , SUM(fact.ACT_LABOR_RAW_COST)
13313          , SUM(fact.ACT_EQUIP_RAW_COST)
13314 	 , SUM(fact.ETC_LABOR_HRS )
13315 	 , SUM(fact.ETC_EQUIP_HRS )
13316 	 , SUM(fact.ETC_LABOR_BRDN_COST )
13317 	 , SUM(fact.ETC_EQUIP_BRDN_COST )
13318 	 , SUM(fact.ETC_BRDN_COST )
13319          , SUM(fact.ETC_RAW_COST )
13320          , SUM(fact.ETC_LABOR_RAW_COST)
13321          , SUM(fact.ETC_EQUIP_RAW_COST)
13322    	 , SUM(fact.CUSTOM1) CUSTOM1
13323    	 , SUM(fact.CUSTOM2) CUSTOM2
13324    	 , SUM(fact.CUSTOM3) CUSTOM3
13325    	 , SUM(fact.CUSTOM4) CUSTOM4
13326    	 , SUM(fact.CUSTOM5) CUSTOM5
13327    	 , SUM(fact.CUSTOM6) CUSTOM6
13328    	 , SUM(fact.CUSTOM7) CUSTOM7
13329    	 , SUM(fact.CUSTOM8) CUSTOM8
13330    	 , SUM(fact.CUSTOM9) CUSTOM9
13331    	 , SUM(fact.CUSTOM10) CUSTOM10
13332    	 , SUM(fact.CUSTOM11) CUSTOM11
13333    	 , SUM(fact.CUSTOM12) CUSTOM12
13334    	 , SUM(fact.CUSTOM13) CUSTOM13
13335    	 , SUM(fact.CUSTOM14) CUSTOM14
13336    	 , SUM(fact.CUSTOM15) CUSTOM15
13337 	 , NULL  TIME_DANGLING_FLAG
13338 	 , NULL  RATE_DANGLING_FLAG
13339          , g_default_prg_level prg_level
13340          , fact.PLAN_TYPE_CODE   PLAN_TYPE_CODE   /* 4471527 */
13341       FROM pji_fp_aggr_pjp1_t fact
13342    	 , pji_org_extr_info  orginfo
13343    	 , pji_time_cal_period_v  pa_cal
13344          , pji_fm_extr_plnver3_t  ver
13345    WHERE  1=1
13346       AND fact.CALENDAR_TYPE = 'A'
13347       AND orginfo.org_id = fact.PROJECT_ORG_ID
13348       AND DECODE(p_calendar_type
13349                , 'P', orginfo.pa_calendar_id
13350                , 'G', orginfo.gl_calendar_id) = pa_cal.calendar_id
13351       AND fact.start_date IS NOT NULL
13352       AND fact.end_date IS NOT NULL
13353       AND fact.period_type_id = 2048
13354       AND fact.plan_version_id = ver.plan_version_id
13355       AND fact.plan_type_code  = ver.plan_type_code   /* 4471527 */
13356       AND ver.wp_flag = 'N'
13357       AND ver.baselined_flag = 'Y'
13358       AND ver.time_phased_type_code = 'N'
13359       AND fact.line_type = 'NTP'
13360       AND fact.worker_id = g_worker_id
13361       -- AND (ver.rbs_struct_version_id = fact.rbs_version_id  OR fact.rbs_version_id = -1)
13362       AND NVL(ver.rbs_struct_version_id, -1) = fact.rbs_version_id
13363       AND ( fact.start_date <= pa_cal.end_date AND fact.end_date >= pa_cal.start_date )
13364       AND DECODE(p_prorating_format,'S',
13365              DECODE(SIGN(fact.start_Date-pa_cal.start_date),-1,0,1),
13366              DECODE(SIGN(fact.end_Date - pa_cal.end_date), 1,0,1))=1
13367    GROUP BY
13368            fact.project_id
13369 	 , fact.PROJECT_ORG_ID
13370 	 , fact.PROJECT_ORGANIZATION_ID
13371    	 , fact.PROJECT_ELEMENT_ID
13372    	 , pa_cal.cal_period_id
13373    	 , fact.PERIOD_TYPE_ID
13374    	 , fact.CALENDAR_TYPE
13375          , fact.RBS_AGGR_LEVEL
13376          , fact.WBS_ROLLUP_FLAG
13377          , fact.PRG_ROLLUP_FLAG
13378          , fact.CURR_RECORD_TYPE_ID
13379    	 , fact.CURRENCY_CODE
13380    	 , fact.RBS_ELEMENT_ID
13381    	 , fact.RBS_VERSION_ID
13382    	 , fact.PLAN_VERSION_ID
13383    	 , fact.PLAN_TYPE_ID
13384               , fact.PLAN_TYPE_CODe    /* 4471527 */
13385 	 , fact.TIME_DANGLING_FLAG
13386 	 , fact.RATE_DANGLING_FLAG
13387 	 ,  DECODE(pa_cal.calendar_id,orginfo.pa_calendar_id,'P',orginfo.gl_calendar_id,'G');
13388 
13389 EXCEPTION
13390   WHEN OTHERS THEN
13391     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
13392                              p_procedure_name => 'PRORATE_TO_PAGL_N_PJP1_SE');
13393     RAISE;
13394 END;
13395 
13396 
13397 ----------
13398 -- Print time API to measure time taken by each api. Also useful for debugging.
13399 ----------
13400 PROCEDURE PRINT_TIME(p_tag IN VARCHAR2) IS
13401 BEGIN
13402   PJI_PJP_FP_CURR_WRAP.print_time(p_tag);
13403 EXCEPTION
13404   WHEN OTHERS THEN
13405     FND_MSG_PUB.add_exc_msg( p_pkg_name       => g_package_name ,
13406                              p_procedure_name => 'PRINT_TIME');
13407     RAISE;
13408 END;
13409 
13410 
13411 END PJI_FM_PLAN_CAL_RLPS_T;