DBA Data[Home] [Help]

PACKAGE BODY: APPS.PJI_PJP_SUM_CUST

Source


1 package body PJI_PJP_SUM_CUST as
2   /* $Header: PJISC01B.pls 120.0.12010000.2 2009/06/11 07:36:07 rmandali ship $ */
3 
4   -- -----------------------------------------------------
5   -- procedure PJP_CUSTOM_FPR_API
6   --
7   --   Attention Project Performance customer:
8   --
9   --   This API should be used to implement custom measures in the
10   --   Financial Planning Reporting Lines fact: PJI_FP_XBS_ACCUM_F.
11   --
12   --   1. Only modify code in the indicated area.
13   --   2. Do not issue any statements that result in a "commit" or a "rollback"
14   --   3. Only populate PJI_FP_CUST_PJP0.
15   --
16   --   History
17   --   19-MAR-2004  SVERMETT  Created
18   --
19   -- -----------------------------------------------------
20   procedure PJP_CUSTOM_FPR_API (p_worker_id in number) is
21 
22     l_process         varchar2(30);
23     l_batch_id        number;
24     l_extraction_type varchar2(15);
25     l_pji_schema      varchar2(30);
26 
27   begin
28 
29     l_process := PJI_PJP_SUM_MAIN.g_process ||
30                  to_char(p_worker_id);
31 
32     if (not PJI_PROCESS_UTIL.NEED_TO_RUN_STEP
33         (l_process,
34          'PJI_PJP_SUM_CUST.PJP_CUSTOM_FPR_API(p_worker_id);')) then
35       return;
36     end if;
37 
38     l_batch_id := PJI_PROCESS_UTIL.GET_PROCESS_PARAMETER
39                   (l_process, 'CURRENT_BATCH');
40 
41     l_extraction_type := PJI_PROCESS_UTIL.GET_PROCESS_PARAMETER
42                          (l_process, 'EXTRACTION_TYPE');
43 
44     l_pji_schema := PJI_UTILS.GET_PJI_SCHEMA_NAME;
45 
46     /**************************************************************
47      *                                                            *
48      * Insert custom measures code after this box comment         *
49      *                                                            *
50      *                                                            *
51      * IMPORTANT:  DO NOT INCLUDE ANY COMMIT STATEMENTS IN THE    *
52      *             CUSTOM CODE.                                   *
53      *                                                            *
54      *                                                            *
55      **************************************************************/
56 
57     /**************************************************************************************************************
58      *                                                                                                            *
59      * Sample code with steps to customize custom measures for FP CUSTOM MEASURE TABLE(i.e.PJI_FP_CUST_PJP0) table*
60      *                                                                                                            *
61      *                                                                                                            *
62      * FP BASIS TABLE ( I.E. PJI_FP_AGGR_PJP0)                                                                    *
63      * --------------------------------------                                                                     *
64      *  This table is the first aggregation point after the transaction accum tables and provides a basis for     *
65      *  custom measures. This table has to be populated to store customized measures. It holds the mandatory      *
66      *  keys, which are being used, in custom table (i.e. PJI_FP_CUST_PJP0) to store customized measures.         *
67      *  To see the definition of this table and its columns, please refer ETRM.                                   *
68      *                                                                                                            *
69      * MANDOTORY PREREQUISTE TO DEFINE CUSTOM MEASURE                                                             *
70      * ---------------------------------------------                                                              *
71      *  1. Basis Table PJI_FP_AGGR_PJP0 should be populated                                                       *
72      *   WHAT IF FP BASIS TABLE IS NOT POPULATED                                                                  *
73      *   --------------------------------------                                                                   *
74      *    If the basis table is not populated then the program will not use and store the customized measures     *
75      *    at all.                                                                                                 *
76      *                                                                                                            *
77      * FP CUSTOM MEASURES TABLE ( I.E. PJI_FP_CUST_PJP0)                                                          *
78      * -------------------------------------------------                                                          *
79      *  This table is used to derive PJP custom measures only if derived measures are available in context        *
80      *  of RESOURCE and TASK. After customizing the custom measures, they are stored in this table.               *
81      *  Following is the list of custom measure available:                                                        *
82      *  1. WORKER_ID                 Identify the set of data used by a particular process so that                *
83      *                               when other process is running should not pickup the same record.             *
84      *  2. TXN_ACCUM_HEADER_ID       Identifier for the transaction header                                        *
85      *  3. PROJECT_ID                Identifier for the project                                                   *
86      *  4. PROJECT_ORG_ID            Identifier of the Project Operating Unit                                     *
87      *  5. PROJECT_ORGANIZATION_ID   Identifier of the Project Organization                                       *
88      *  6. PROJECT_ELEMENT_ID        This is the WBS element id and consists of projects and tasks.               *
89      *  7. TIME_ID                   Numeric identifier for time                                                  *
90      *  8. PERIOD_TYPE_ID            Numeric identifier for the period type (period, quarter, year, weeks)        *
91      *  9. CALENDAR_TYPE             Specifies the calendar type (PA, GL, Enterprise)                             *
92      *  10. RBS_AGGR_LEVEL           Indicates, for the current task, the type of RBS aggregation.                *
93      *                               'L' = Lowest (data extracted from the transaction system)                    *
94      *                               'R' = Rollup (date rollup up by RBS)'T' = Top (Common amount that is         *
95      *                               the sum total of a given RBS structure for the current task.)                *
96      *  11. WBS_ROLLUP_FLAG          Indicates, for the given project structure version, whether the amounts      *
97      *                               are rolled up by WBS or not.'N' = No (Task self amounts.)                    *
98      *                               'Y' = Yes (Task amounts rolled up by WBS.                                    *
99      *                               Rolled up amounts do not include self amounts.)                              *
100      *  12. PRG_ROLLUP_FLAG          Indicates whether the amounts are rolled up by Project Hierarchy or not.     *
101      *                               'N' = No (Amounts within a given project.)                                   *
102      *                               'Y' = Yes (Project structure version amounts rolled up by Project            *
103      *                               Hierarchy. Rolled up amounts do not include self amounts.)                   *
104      *  13. CURR_RECORD_TYPE_ID      Identifier for the Currency record type                                      *
105      *  14. CURRENCY_CODE            Currency Code                                                                *
106      *  15. RBS_ELEMENT_ID           Identifier for the RBS                                                       *
107      *  16. RBS_VERSION_ID           Identifier for the RBS version                                               *
108      *  17. PLAN_VERSION_ID          Same as Budget version identifier.                                           *
109      *                               >0 = version id, -1 = Actuals, -2 = Progress Actuals,                        *
110      *                               -3 = Current Baselined, -4 = Current Original Baselined                      *
111      *  18. PLAN_TYPE_ID             Identifier of the Plan Type                                                  *
112      *  19. There are 15 custom measures available to store the customized data.                                  *
113      *                                                                                                            *
114      * PJI LOOKUP TABLE ( I.E. PJI_FP_TXN_ACCUM_HEADER) FOR CUSTOM MEASURES                                       *
115      * --------------------------------------------------------------------                                       *
116      * This table stores all-important information regarding the transactions used in customizing measures.       *
117      * It has 26 attributes/filers, which can be used to customize measure in a very precise manor                *
118      * E.g. If user want to use different amount for timecard having expenditure type is 'Airfare'                *
119      * and it should belong to a particular expenditure org then EXPENDITURE_TYPE and                             *
120      * EXPENDITURE_ORG_ID attribute can be used to filter. Please see example in example section to understand    *
121      * more clearly. To see the complete definition of this table and its columns, please refer ETRM              *
122      *                                                                                                            *
123      * EXAMPLE TO CUSTOMIZE CUSTOM MEASURES                                                                       *
124      * ------------------------------------                                                                       *
125      *  - Customizing a measure using  EXPENDITURE_TYPE, and EXPENDITURE_ORG_ID                                   *
126      *  - Define computation logic for custom measure 1                                                           *
127      *  - Remove 1=2 from the SELECT part                                                                         *
128      * INSERT INTO PJI_FP_CUST_PJP0 cust_i                                                                        *
129      * (                                                                                                          *
130      *   WORKER_ID,                                                                                               *
131      *   TXN_ACCUM_HEADER_ID,                                                                                     *
132      *   PROJECT_ID,                                                                                              *
133      *   PROJECT_ORG_ID,                                                                                          *
134      *   PROJECT_ORGANIZATION_ID,                                                                                 *
135      *   PROJECT_ELEMENT_ID,                                                                                      *
136      *   TIME_ID,                                                                                                 *
137      *   PERIOD_TYPE_ID,                                                                                          *
138      *   CALENDAR_TYPE,                                                                                           *
139      *   RBS_AGGR_LEVEL,                                                                                          *
140      *   WBS_ROLLUP_FLAG,                                                                                         *
141      *   PRG_ROLLUP_FLAG,                                                                                         *
142      *   CURR_RECORD_TYPE_ID,                                                                                     *
143      *   CURRENCY_CODE,                                                                                           *
144      *   RBS_ELEMENT_ID,                                                                                          *
145      *   RBS_VERSION_ID,                                                                                          *
146      *   PLAN_VERSION_ID,                                                                                         *
147      *   PLAN_TYPE_ID,                                                                                            *
148      *   CUSTOM1,                                                                                                 *
149      *   CUSTOM2,                                                                                                 *
150      *   CUSTOM3,                                                                                                 *
151      *   CUSTOM4,                                                                                                 *
152      *   CUSTOM5,                                                                                                 *
153      *   CUSTOM6,                                                                                                 *
154      *   CUSTOM7,                                                                                                 *
155      *   CUSTOM8,                                                                                                 *
156      *   CUSTOM9,                                                                                                 *
157      *   CUSTOM10,                                                                                                *
158      *   CUSTOM11,                                                                                                *
159      *   CUSTOM12,                                                                                                *
160      *   CUSTOM13,                                                                                                *
161      *   CUSTOM14,                                                                                                *
162      *   CUSTOM15                                                                                                 *
163      *   )                                                                                                        *
164      * SELECT                                                                                                     *
165      *   p_worker_id,                                                                                             *
166      *   pjp0.TXN_ACCUM_HEADER_ID,                                                                                *
167      *   pjp0.PROJECT_ID,                                                                                         *
168      *   pjp0.PROJECT_ORG_ID,                                                                                     *
169      *   pjp0.PROJECT_ORGANIZATION_ID,                                                                            *
170      *   pjp0.PROJECT_ELEMENT_ID,                                                                                 *
171      *   pjp0.TIME_ID,                                                                                            *
172      *   pjp0.PERIOD_TYPE_ID,                                                                                     *
173      *   pjp0.CALENDAR_TYPE,                                                                                      *
174      *   pjp0.RBS_AGGR_LEVEL,                                                                                     *
175      *   pjp0.WBS_ROLLUP_FLAG,                                                                                    *
176      *   pjp0.PRG_ROLLUP_FLAG,                                                                                    *
177      *   pjp0.CURR_RECORD_TYPE_ID,                                                                                *
178      *   pjp0.CURRENCY_CODE,                                                                                      *
179      *   pjp0.RBS_ELEMENT_ID,                                                                                     *
180      *   pjp0.RBS_VERSION_ID,                                                                                     *
181      *   pjp0.PLAN_VERSION_ID,                                                                                    *
182      *   pjp0.PLAN_TYPE_ID,                                                                                       *
183      *   -- Custom measure 1                                                                                      *
184      *   DECODE(pjilookup.expenditure_type,'Airfare',DECODE(pjilookup.expenditure_org_id,-1,100,50),0) CUSTOM1,   *
185      *   -- Custom measure 1                                                                                      *
186      *   TO_NUMBER(NULL)                               CUSTOM2,                                                   *
187      *   TO_NUMBER(NULL)                               CUSTOM3,                                                   *
188      *   TO_NUMBER(NULL)                               CUSTOM4,                                                   *
189      *   TO_NUMBER(NULL)                               CUSTOM5,                                                   *
190      *   TO_NUMBER(NULL)                               CUSTOM6,                                                   *
191      *   TO_NUMBER(NULL)                               CUSTOM7,                                                   *
192      *   TO_NUMBER(NULL)                               CUSTOM8,                                                   *
193      *   TO_NUMBER(NULL)                               CUSTOM9,                                                   *
197      *   TO_NUMBER(NULL)                               CUSTOM13,                                                  *
194      *   TO_NUMBER(NULL)                               CUSTOM10,                                                  *
195      *   TO_NUMBER(NULL)                               CUSTOM11,                                                  *
196      *   TO_NUMBER(NULL)                               CUSTOM12,                                                  *
198      *   TO_NUMBER(NULL)                               CUSTOM14,                                                  *
199      *   TO_NUMBER(NULL)                               CUSTOM15                                                   *
200      * FROM                                                                                                       *
201      *   PJI_FP_AGGR_PJP0 pjp0 -- FP basis table,                                                                 *
202      *   PJI_FP_TXN_ACCUM_HEADER pjilookup -- PJI Lookup table                                                    *
203      * WHERE                                                                                                      *
204      *   pjp0.WORKER_ID = p_worker_id                                                                             *
205      *   AND  pjp0.TXN_ACCUM_HEADER_ID = pjilookup.TXN_ACCUM_HEADER_ID;                                           *
206      *                                                                                                            *
207      * LIMITATION TO CUSTOMIZE CUSTOM MEASURES                                                                    *
208      * --------------------------------------                                                                     *
209      *  1. Currently, User can customize any measure available in Oracle Projects.                                *
210      *  2. Only Number data type can be stored in Custom measures.                                                *
211      *  3. The summarization always extracts incremental records from the transaction source.  If the custom      *
212      *     measures are defined on an amount column from the basis table, then they are always computed on        *
213      *     incremental values. However, if the custom measures are derived from other sources then the custom     *
214      *     pl/sql logic has to ensure that it derives incremental amounts (ie., change since the last time        *
215      *     summarization has been run).                                                                           *
216      *  4. Custom 11 to 15 are exclusively for the Commitment related custom measures and thus these columns      *
217      *     would be processesed similar to that of Commitments                                                    *
218      **************************************************************************************************************/
219 
220     INSERT INTO PJI_FP_CUST_PJP0 cust_i
221     (
222       WORKER_ID,
223       TXN_ACCUM_HEADER_ID,
224       PROJECT_ID,
225       PROJECT_ORG_ID,
226       PROJECT_ORGANIZATION_ID,
227       PROJECT_ELEMENT_ID,
228       TIME_ID,
229       PERIOD_TYPE_ID,
230       CALENDAR_TYPE,
231       RBS_AGGR_LEVEL,
232       WBS_ROLLUP_FLAG,
233       PRG_ROLLUP_FLAG,
234       CURR_RECORD_TYPE_ID,
235       CURRENCY_CODE,
236       RBS_ELEMENT_ID,
237       RBS_VERSION_ID,
238       PLAN_VERSION_ID,
239       PLAN_TYPE_ID,
240       CUSTOM1,
241       CUSTOM2,
242       CUSTOM3,
243       CUSTOM4,
244       CUSTOM5,
245       CUSTOM6,
246       CUSTOM7,
247       CUSTOM8,
248       CUSTOM9,
249       CUSTOM10,
250       CUSTOM11,
251       CUSTOM12,
252       CUSTOM13,
253       CUSTOM14,
254       CUSTOM15
255     )
256     SELECT
257       p_worker_id,
258       pjp0.TXN_ACCUM_HEADER_ID,
259       pjp0.PROJECT_ID,
260       pjp0.PROJECT_ORG_ID,
261       pjp0.PROJECT_ORGANIZATION_ID,
262       pjp0.PROJECT_ELEMENT_ID,
263       pjp0.TIME_ID,
264       pjp0.PERIOD_TYPE_ID,
265       pjp0.CALENDAR_TYPE,
266       pjp0.RBS_AGGR_LEVEL,
267       pjp0.WBS_ROLLUP_FLAG,
268       pjp0.PRG_ROLLUP_FLAG,
269       pjp0.CURR_RECORD_TYPE_ID,
270       pjp0.CURRENCY_CODE,
271       pjp0.RBS_ELEMENT_ID,
272       pjp0.RBS_VERSION_ID,
273       pjp0.PLAN_VERSION_ID,
274       pjp0.PLAN_TYPE_ID,
275       TO_NUMBER(NULL)                               CUSTOM1,
276       TO_NUMBER(NULL)                               CUSTOM2,
277       TO_NUMBER(NULL)                               CUSTOM3,
278       TO_NUMBER(NULL)                               CUSTOM4,
279       TO_NUMBER(NULL)                               CUSTOM5,
280       TO_NUMBER(NULL)                               CUSTOM6,
281       TO_NUMBER(NULL)                               CUSTOM7,
282       TO_NUMBER(NULL)                               CUSTOM8,
283       TO_NUMBER(NULL)                               CUSTOM9,
284       TO_NUMBER(NULL)                               CUSTOM10,
285       TO_NUMBER(NULL)                               CUSTOM11,
286       TO_NUMBER(NULL)                               CUSTOM12,
287       TO_NUMBER(NULL)                               CUSTOM13,
288       TO_NUMBER(NULL)                               CUSTOM14,
289       TO_NUMBER(NULL)                               CUSTOM15
290     FROM
291       PJI_FP_AGGR_PJP0 pjp0
292     WHERE
293       pjp0.WORKER_ID = p_worker_id AND
294       1 = 2;
295 
296     /**************************************************************
300      **************************************************************/
297      *                                                            *
298      * Insert custom measures code before this box comment        *
299      *                                                            *
301 
302     PJI_PROCESS_UTIL.REGISTER_STEP_COMPLETION
303     (l_process,
304      'PJI_PJP_SUM_CUST.PJP_CUSTOM_FPR_API(p_worker_id);');
305 
306     commit;
307 
308   end PJP_CUSTOM_FPR_API;
309 
310 
311   -- -----------------------------------------------------
312   -- procedure PJP_CUSTOM_ACR_API
313   --
314   --   Attention Project Performance customer:
315   --
316   --   This API should be used to implement custom measures in the
317   --   Activities Reporting Lines fact: PJI_AC_XBS_ACCUM_F.
318   --
319   --   1. Only modify code in the indicated area.
320   --   2. Do not issue any statements that result in a "commit" or a "rollback"
321   --   3. Only populate PJI_AC_CUST_PJP0.
322   --
323   --   History
324   --   19-MAR-2004  SVERMETT  Created
325   --
326   -- -----------------------------------------------------
327   procedure PJP_CUSTOM_ACR_API (p_worker_id in number) is
328 
329     l_process         varchar2(30);
330     l_batch_id        number;
331     l_extraction_type varchar2(15);
332     l_pji_schema      varchar2(30);
333 
334   begin
335 
336     l_process := PJI_PJP_SUM_MAIN.g_process ||
337                  to_char(p_worker_id);
338 
339     if (not PJI_PROCESS_UTIL.NEED_TO_RUN_STEP
340         (l_process,
341          'PJI_PJP_SUM_CUST.PJP_CUSTOM_ACR_API(p_worker_id);')) then
342       return;
343     end if;
344 
345     l_batch_id := PJI_PROCESS_UTIL.GET_PROCESS_PARAMETER
346                   (l_process, 'CURRENT_BATCH');
347 
348     l_extraction_type := PJI_PROCESS_UTIL.GET_PROCESS_PARAMETER
349                          (l_process, 'EXTRACTION_TYPE');
350 
351     l_pji_schema := PJI_UTILS.GET_PJI_SCHEMA_NAME;
352 
353     /**************************************************************
354      *                                                            *
355      * Insert custom measures code after this box comment         *
356      *                                                            *
357      *                                                            *
358      * IMPORTANT:  DO NOT INCLUDE ANY COMMIT STATEMENTS IN THE    *
359      *             CUSTOM CODE.                                   *
360      *                                                            *
361      *                                                            *
362      **************************************************************/
363 
364 
365     /**************************************************************************************************************
366      * Sample code with steps to customize custom measures for AC CUSTOM MEASURE TABLE(i.e.PJI_AC_CUST_PJP0) table*
367      *                                                                                                            *
368      *                                                                                                            *
369      * AC BASIS TABLE ( I.E. PJI_AC_AGGR_PJP0)                                                                    *
370      * --------------------------------------                                                                     *
371      *  This table is the first aggregation point after the transaction accum tables and provides a basis for     *
372      *  custom measures. This table has to be populated to store customized measures. It holds the mandatory      *
373      *  keys, which are being used, in custom table (i.e. PJI_AC_CUST_PJP0) to store customized measures.         *
374      *  To see the definition of this table and its columns, please refer ETRM.                                   *
375      *                                                                                                            *
376      * MANDOTORY PREREQUISTE TO DEFINE CUSTOM MEASURE                                                             *
377      * ---------------------------------------------                                                              *
378      *  1. Basis Table PJI_AC_AGGR_PJP0 should be populated                                                       *
379      *   WHAT IF AC BASIS TABLE IS NOT POPULATED                                                                  *
380      *   --------------------------------------                                                                   *
381      *    If the basis table is not populated then the program will not use and store the customized measures     *
382      *    at all.
383      *                                                                                                            *
384      * AC CUSTOM MEASURES TABLE ( I.E. PJI_AC_CUST_PJP0)                                                          *
385      * -------------------------------------------------                                                          *
386      *  This table is used to derive PJP custom measures only if derived measures are available in context        *
387      *  of TASK. After customizing the custom measures, they are stored in this table.                            *
388      *  Following is the list of custom measure available:                                                        *
389      *  1. WORKER_ID                 Identify the set of data used by a particular process so that                *
390      *                               when other process is running should not pickup the same record.             *
391      *  2. PROJECT_ID                Identifier for the project                                                   *
392      *  3. PROJECT_ORG_ID            Identifier of the Project Operating Unit                                     *
396      *  7. PERIOD_TYPE_ID            Numeric identifier for the period type (period, quarter, year, weeks)        *
393      *  4. PROJECT_ORGANIZATION_ID   Identifier of the Project Organization                                       *
394      *  5. PROJECT_ELEMENT_ID        This is the WBS element id and consists of projects and tasks.               *
395      *  6. TIME_ID                   Numeric identifier for time                                                  *
397      *  8. CALENDAR_TYPE             Specifies the calendar type (PA, GL, Enterprise)                             *
398      *  9. WBS_ROLLUP_FLAG          Indicates, for the given project structure version, whether the amounts       *
399      *                               are rolled up by WBS or not.'N' = No (Task self amounts.)                    *
400      *                               'Y' = Yes (Task amounts rolled up by WBS.                                    *
401      *                               Rolled up amounts do not include self amounts.)                              *
402      *  10. PRG_ROLLUP_FLAG          Indicates whether the amounts are rolled up by Project Hierarchy or not.     *
403      *                               'N' = No (Amounts within a given project.)                                   *
404      *                               'Y' = Yes (Project structure version amounts rolled up by Project            *
405      *                               Hierarchy. Rolled up amounts do not include self amounts.)                   *
406      *  11. CURR_RECORD_TYPE_ID      Identifier for the Currency record type                                      *
407      *  12. CURRENCY_CODE            Currency Code                                                                *
408      *  13. There are 15 custom measures available to store the customized data.                                  *
409      *                                                                                                            *
410      * USING AC BASIS TABLE FOR LOOKUP AND CUSTOMIZING MEASURE                                                    *
411      * ----------------------------------------------------------                                                 *
412      * As mentioned  above any table in Oracle Projects can be used to derive customized measures. In this section      *
413      * basis table is being used                                                                                  *
414      * E.g. If user wants to calculate certain amount of tax percentage base on Revenue for PA calendar ,USD      *
415      * currency then CURRENCY_CODE, and CALENDAR_TYPE attribute can be used to filter.                            *
416      * Please see example in example section to understand more clearly.                                          *
417      *                                                                                                            *
418      * EXAMPLE TO CUSTOMIZE CUSTOM MEASURES                                                                       *
419      * ------------------------------------                                                                       *
420      *  - Customizing a measure using  CALENDAR_TYPE,CURRENCY_CODE,REVENUE                                        *
421      *  - Define computation logic for custom measure 1                                                           *
422      *  - Remove 1=2 from the SELECT part                                                                         *
423      * INSERT INTO PJI_AC_CUST_PJP0 cust_i                                                                        *
424      * (                                                                                                          *
425      *   WORKER_ID,                                                                                               *
426      *   PROJECT_ID,                                                                                              *
427      *   PROJECT_ORG_ID,                                                                                          *
428      *   PROJECT_ORGANIZATION_ID,                                                                                 *
429      *   PROJECT_ELEMENT_ID,                                                                                      *
430      *   TIME_ID,                                                                                                 *
431      *   PERIOD_TYPE_ID,                                                                                          *
432      *   CALENDAR_TYPE,                                                                                           *
433      *   WBS_ROLLUP_FLAG,                                                                                         *
434      *   PRG_ROLLUP_FLAG,                                                                                         *
435      *   CURR_RECORD_TYPE_ID,                                                                                     *
436      *   CURRENCY_CODE,                                                                                           *
437      *   CUSTOM1,                                                                                                 *
438      *   CUSTOM2,                                                                                                 *
439      *   CUSTOM3,                                                                                                 *
440      *   CUSTOM4,                                                                                                 *
441      *   CUSTOM5,                                                                                                 *
442      *   CUSTOM6,                                                                                                 *
443      *   CUSTOM7,                                                                                                 *
444      *   CUSTOM8,                                                                                                 *
445      *   CUSTOM9,                                                                                                 *
449      *   CUSTOM13,                                                                                                *
446      *   CUSTOM10,                                                                                                *
447      *   CUSTOM11,                                                                                                *
448      *   CUSTOM12,                                                                                                *
450      *   CUSTOM14,                                                                                                *
451      *   CUSTOM15                                                                                                 *
452      *   )                                                                                                        *
453      * SELECT                                                                                                     *
454      *   p_worker_id,                                                                                             *
455      *   pjp0.PROJECT_ID,                                                                                         *
456      *   pjp0.PROJECT_ORG_ID,                                                                                     *
457      *   pjp0.PROJECT_ORGANIZATION_ID,                                                                            *
458      *   pjp0.PROJECT_ELEMENT_ID,                                                                                 *
459      *   pjp0.TIME_ID,                                                                                            *
460      *   pjp0.PERIOD_TYPE_ID,                                                                                     *
461      *   pjp0.CALENDAR_TYPE,                                                                                      *
462      *   pjp0.WBS_ROLLUP_FLAG,                                                                                    *
463      *   pjp0.PRG_ROLLUP_FLAG,                                                                                    *
464      *   pjp0.CURR_RECORD_TYPE_ID,                                                                                *
465      *   pjp0.CURRENCY_CODE,                                                                                      *
466      *   -- Custom measure 1                                                                                      *
467      *   (0.15*pjp0.REVENUE) CUSTOM1,                                                                             *
468      *   -- Custom measure 1                                                                                      *
469      *   TO_NUMBER(NULL)                               CUSTOM2,                                                   *
470      *   TO_NUMBER(NULL)                               CUSTOM3,                                                   *
471      *   TO_NUMBER(NULL)                               CUSTOM4,                                                   *
472      *   TO_NUMBER(NULL)                               CUSTOM5,                                                   *
473      *   TO_NUMBER(NULL)                               CUSTOM6,                                                   *
474      *   TO_NUMBER(NULL)                               CUSTOM7,                                                   *
475      *   TO_NUMBER(NULL)                               CUSTOM8,                                                   *
476      *   TO_NUMBER(NULL)                               CUSTOM9,                                                   *
477      *   TO_NUMBER(NULL)                               CUSTOM10,                                                  *
478      *   TO_NUMBER(NULL)                               CUSTOM11,                                                  *
479      *   TO_NUMBER(NULL)                               CUSTOM12,                                                  *
480      *   TO_NUMBER(NULL)                               CUSTOM13,                                                  *
481      *   TO_NUMBER(NULL)                               CUSTOM14,                                                  *
482      *   TO_NUMBER(NULL)                               CUSTOM15                                                   *
483      * FROM                                                                                                       *
484      *   PJI_AC_AGGR_PJP0 pjp0 -- AC basis table,                                                                 *
485      * WHERE                                                                                                      *
486      *   pjp0.WORKER_ID = p_worker_id AND                                                                         *
487      *   pjp0.CURRENCY_CODE = 'USD' AND                                                                           *
488      *   pjp0.CALENDAR_TYPE = 'PA;                                                                                *
489      *                                                                                                            *
490      * LIMITATION TO CUSTOMIZE CUSTOM MEASURES                                                                    *
491      * --------------------------------------                                                                     *
492      *  1. Currently, User can customize any measure available in Oracle Projects.                                *
493      *  2. Only Number data type can be stored in Custom measures.                                                *
494      *  3. The summarization always extracts incremental records from the transaction source.  If the custom      *
495      *     measures are defined on an amount column from the basis table, then they are always computed on        *
496      *     incremental values. However, if the custom measures are derived from other sources then the custom     *
497      *     pl/sql logic has to ensure that it derives incremental amounts (ie., change since the last time        *
498      *     summarization has been run).
502     (
499      **************************************************************************************************************/
500 
501     INSERT INTO PJI_AC_CUST_PJP0 cust_i
503       WORKER_ID,
504       PROJECT_ID,
505       PROJECT_ORG_ID,
506       PROJECT_ORGANIZATION_ID,
507       PROJECT_ELEMENT_ID,
508       TIME_ID,
509       PERIOD_TYPE_ID,
510       CALENDAR_TYPE,
511       WBS_ROLLUP_FLAG,
512       PRG_ROLLUP_FLAG,
513       CURR_RECORD_TYPE_ID,
514       CURRENCY_CODE,
515       CUSTOM1,
516       CUSTOM2,
517       CUSTOM3,
518       CUSTOM4,
519       CUSTOM5,
520       CUSTOM6,
521       CUSTOM7,
522       CUSTOM8,
523       CUSTOM9,
524       CUSTOM10,
525       CUSTOM11,
526       CUSTOM12,
527       CUSTOM13,
528       CUSTOM14,
529       CUSTOM15
530     )
531     SELECT
532       p_worker_id,
533       pjp0.PROJECT_ID,
534       pjp0.PROJECT_ORG_ID,
535       pjp0.PROJECT_ORGANIZATION_ID,
536       pjp0.PROJECT_ELEMENT_ID,
537       pjp0.TIME_ID,
538       pjp0.PERIOD_TYPE_ID,
539       pjp0.CALENDAR_TYPE,
540       pjp0.WBS_ROLLUP_FLAG,
541       pjp0.PRG_ROLLUP_FLAG,
542       pjp0.CURR_RECORD_TYPE_ID,
543       pjp0.CURRENCY_CODE,
544       TO_NUMBER(NULL)                               CUSTOM1,
545       TO_NUMBER(NULL)                               CUSTOM2,
546       TO_NUMBER(NULL)                               CUSTOM3,
547       TO_NUMBER(NULL)                               CUSTOM4,
548       TO_NUMBER(NULL)                               CUSTOM5,
549       TO_NUMBER(NULL)                               CUSTOM6,
550       TO_NUMBER(NULL)                               CUSTOM7,
551       TO_NUMBER(NULL)                               CUSTOM8,
552       TO_NUMBER(NULL)                               CUSTOM9,
553       TO_NUMBER(NULL)                               CUSTOM10,
554       TO_NUMBER(NULL)                               CUSTOM11,
555       TO_NUMBER(NULL)                               CUSTOM12,
556       TO_NUMBER(NULL)                               CUSTOM13,
557       TO_NUMBER(NULL)                               CUSTOM14,
558       TO_NUMBER(NULL)                               CUSTOM15
559     FROM
560       PJI_AC_AGGR_PJP0 pjp0
561     WHERE
562       pjp0.WORKER_ID = p_worker_id AND
563       1 = 2;
564 
565     /**************************************************************
566      *                                                            *
567      * Insert custom measures code before this box comment        *
568      *                                                            *
569      **************************************************************/
570 
571     PJI_PROCESS_UTIL.REGISTER_STEP_COMPLETION
572     (l_process,
573      'PJI_PJP_SUM_CUST.PJP_CUSTOM_ACR_API(p_worker_id);');
574 
575     commit;
576 
577   end PJP_CUSTOM_ACR_API;
578 
579 end PJI_PJP_SUM_CUST;