DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_PROCESS_ACCUM_ACTUALS

Source


1 PACKAGE BODY PA_PROCESS_ACCUM_ACTUALS AS
2 /* $Header: PAACTSKB.pls 120.2 2005/08/31 11:08:04 vmangulu noship $ */
3 
4 -- The procedures are called by PA_MAINT_PROJECT_ACCUMS.Process_Txn_Accum
5 
6 Procedure   Process_it_yt_pt_tasks
7                                 (x_project_id In Number,
8                                  x_task_id In Number,
9                                  x_Proj_Accum_id In Number,
10                                  x_current_period In Varchar2,
11                                  X_Revenue In Number,
12                                  X_Raw_Cost In Number,
13                                  X_Burdened_Cost In Number,
14                                  X_Labor_Hours In Number,
15                                  X_Billable_Raw_Cost In Number,
16                                  X_Billable_Burdened_Cost In Number,
17                                  X_Billable_Labor_Hours In Number,
18                                  X_Unit_Of_Measure In Varchar2,
19                                  x_actual_cost_flag  In Varchar2,
20                                  x_revenue_flag  In Varchar2,
21                                  X_Recs_processed Out NOCOPY Number , --File.Sql.39 bug 4440895
22                                  x_err_stack     In Out NOCOPY Varchar2, --File.Sql.39 bug 4440895
23                                  x_err_stage     In Out NOCOPY Varchar2, --File.Sql.39 bug 4440895
24                                  x_err_code      In Out NOCOPY Number ) IS --File.Sql.39 bug 4440895
25 
26 -- This procedure processes the ITD,YTD and PTD figures for Actuals
27 Recs_processed Number := 0;
28 V_Accum_id     Number := 0;
29 V_task_array task_id_tabtype;
30 v_noof_tasks Number := 0;
31 v_err_code Number := 0;
32 other_recs_processed Number := 0;
33 V_Old_Stack       Varchar2(630);
34 Begin
35    V_Old_Stack := x_err_stack;
36    x_err_stack :=
37    x_err_stack||'->PA_PROCESS_ACCUM_ACTUALS.Process_it_yt_pt_tasks';
38 
39    pa_debug.debug(x_err_stack);
40 
41    -- The follwing Update statement updates all records in the given task
42    -- WBS hierarchy.It will update only the Project-task combination records
43    -- and the Project level record (Task id = 0 and Resourcelist member id = 0)
44 
45    IF ( x_actual_cost_flag = 'Y' ) THEN
46 
47      Update PA_PROJECT_ACCUM_ACTUALS  PAA SET
48          RAW_COST_ITD               = RAW_COST_ITD + X_Raw_Cost,
49          RAW_COST_YTD               = RAW_COST_YTD + X_Raw_Cost,
50          RAW_COST_PTD               = RAW_COST_PTD + X_Raw_Cost,
51          BILLABLE_RAW_COST_ITD      = BILLABLE_RAW_COST_ITD +
52                                       X_Billable_Raw_Cost,
53          BILLABLE_RAW_COST_YTD      = BILLABLE_RAW_COST_YTD +
54                                       X_Billable_Raw_Cost,
55          BILLABLE_RAW_COST_PTD      = BILLABLE_RAW_COST_PTD +
56                                       X_Billable_Raw_Cost,
57          BURDENED_COST_ITD          = BURDENED_COST_ITD + X_Burdened_Cost,
58          BURDENED_COST_YTD          = BURDENED_COST_YTD + X_Burdened_Cost,
59          BURDENED_COST_PTD          = BURDENED_COST_PTD + X_Burdened_Cost,
60          BILLABLE_BURDENED_COST_ITD = BILLABLE_BURDENED_COST_ITD +
61                                       X_Billable_Burdened_Cost,
62          BILLABLE_BURDENED_COST_YTD = BILLABLE_BURDENED_COST_YTD +
63                                       X_Billable_Burdened_Cost,
64          BILLABLE_BURDENED_COST_PTD = BILLABLE_BURDENED_COST_PTD +
65                                       X_Billable_Burdened_Cost,
66          LABOR_HOURS_ITD            = LABOR_HOURS_ITD + X_Labor_Hours,
67          LABOR_HOURS_YTD            = LABOR_HOURS_YTD + X_Labor_Hours,
68          LABOR_HOURS_PTD            = LABOR_HOURS_PTD + X_Labor_Hours,
69          BILLABLE_LABOR_HOURS_ITD   = BILLABLE_LABOR_HOURS_ITD +
70                                       X_Billable_Labor_Hours,
71          BILLABLE_LABOR_HOURS_YTD   = BILLABLE_LABOR_HOURS_YTD +
72                                       X_Billable_Labor_Hours,
73          BILLABLE_LABOR_HOURS_PTD   = BILLABLE_LABOR_HOURS_PTD +
74                                       X_Billable_Labor_Hours,
75          LAST_UPDATED_BY            = pa_proj_accum_main.x_last_updated_by,
76          LAST_UPDATE_DATE           = Trunc(Sysdate),
77          LAST_UPDATE_LOGIN          = pa_proj_accum_main.x_last_update_login
78          Where PAA.Project_Accum_id     In
79         (Select Pah.Project_Accum_id from PA_PROJECT_ACCUM_HEADERS PAH
80          Where Pah.Project_id = x_project_id and
81          pah.Resource_list_member_id = 0 and
82          Pah.Task_id in (Select Pt.Task_Id from PA_TASKS pt
83          start with pt.task_id = x_task_id
84          connect by prior pt.parent_task_id = pt.task_id)  UNION
85          select  to_number(X_Proj_accum_id) from sys.dual);
86 
87      x_recs_processed := Recs_processed + SQL%ROWCOUNT;
88 
89    END IF;
90    IF ( x_revenue_flag = 'Y' ) THEN
91 
92      Update PA_PROJECT_ACCUM_ACTUALS  PAA SET
93          REVENUE_ITD                = REVENUE_ITD + X_Revenue,
94          REVENUE_YTD                = REVENUE_YTD + X_Revenue,
95          REVENUE_PTD                = REVENUE_PTD + X_Revenue,
96          LAST_UPDATED_BY            = pa_proj_accum_main.x_last_updated_by,
97          LAST_UPDATE_DATE           = Trunc(Sysdate),
98          LAST_UPDATE_LOGIN          = pa_proj_accum_main.x_last_update_login
99          Where PAA.Project_Accum_id     In
100         (Select Pah.Project_Accum_id from PA_PROJECT_ACCUM_HEADERS PAH
101          Where Pah.Project_id = x_project_id and
102          pah.Resource_list_member_id = 0 and
103          Pah.Task_id in (Select Pt.Task_Id from PA_TASKS pt
104          start with pt.task_id = x_task_id
105          connect by prior pt.parent_task_id = pt.task_id) UNION
106          select  to_number(X_Proj_accum_id) from sys.dual);
107 
108     x_recs_processed := Recs_processed + SQL%ROWCOUNT;
109 
110     END IF;
111 
112     -- Restore the old x_err_stack;
113     x_err_stack := V_Old_Stack;
114 
115 Exception
116   When others Then
117      x_err_code := SQLCODE;
118      RAISE;
119 
120 End Process_it_yt_pt_tasks;
121 
122 Procedure   Process_it_yt_pp_tasks
123                                 (x_project_id In Number,
124                                  x_task_id In Number,
125                                  x_Proj_Accum_id In Number,
126                                  x_current_period In Varchar2,
127                                  X_Revenue In Number,
128                                  X_Raw_Cost In Number,
129                                  X_Burdened_Cost In Number,
130                                  X_Labor_Hours In Number,
131                                  X_Billable_Raw_Cost In Number,
132                                  X_Billable_Burdened_Cost In Number,
133                                  X_Billable_Labor_Hours In Number,
134                                  X_Unit_Of_Measure In Varchar2,
135                                  x_actual_cost_flag  In Varchar2,
136                                  x_revenue_flag  In Varchar2,
137                                  X_Recs_processed Out NOCOPY Number, --File.Sql.39 bug 4440895
138                                  x_err_stack     In Out NOCOPY Varchar2, --File.Sql.39 bug 4440895
139                                  x_err_stage     In Out NOCOPY Varchar2, --File.Sql.39 bug 4440895
140                                  x_err_code      In Out NOCOPY Number ) IS --File.Sql.39 bug 4440895
141 
142 -- This procedure processes the ITD,YTD and PP figures for Actuals
143 
144 Recs_processed Number := 0;
145 V_Accum_id     Number := 0;
146 V_task_array task_id_tabtype;
147 v_noof_tasks Number := 0;
148 v_err_code Number := 0;
149 other_recs_processed Number := 0;
150 V_Old_Stack       Varchar2(630);
151 Begin
152       V_Old_Stack := x_err_stack;
153       x_err_stack :=
154       x_err_stack||'->PA_PROCESS_ACCUM_ACTUALS.Process_it_yt_pp_tasks';
155 
156       pa_debug.debug(x_err_stack);
157 
158       IF(x_actual_cost_flag = 'Y') THEN
159 
160         Update PA_PROJECT_ACCUM_ACTUALS  PAA SET
161          RAW_COST_ITD                 = RAW_COST_ITD + X_Raw_Cost,
162          RAW_COST_YTD                 = RAW_COST_YTD + X_Raw_Cost,
163          RAW_COST_PP                  = RAW_COST_PP + X_Raw_Cost,
164          BILLABLE_RAW_COST_ITD        = BILLABLE_RAW_COST_ITD +
165                                         X_Billable_Raw_Cost,
166          BILLABLE_RAW_COST_YTD        = BILLABLE_RAW_COST_YTD +
167                                         X_Billable_Raw_Cost,
168          BILLABLE_RAW_COST_PP         = BILLABLE_RAW_COST_PP +
169                                         X_Billable_Raw_Cost,
170          BURDENED_COST_ITD            = BURDENED_COST_ITD + X_Burdened_Cost,
171          BURDENED_COST_YTD            = BURDENED_COST_YTD + X_Burdened_Cost,
172          BURDENED_COST_PP             = BURDENED_COST_PP + X_Burdened_Cost,
173          BILLABLE_BURDENED_COST_ITD   = BILLABLE_BURDENED_COST_ITD +
174                                         X_Billable_Burdened_Cost,
175          BILLABLE_BURDENED_COST_YTD   = BILLABLE_BURDENED_COST_YTD +
176                                         X_Billable_Burdened_Cost,
177          BILLABLE_BURDENED_COST_PP    = BILLABLE_BURDENED_COST_PP +
178                                         X_Billable_Burdened_Cost,
179          LABOR_HOURS_ITD              = LABOR_HOURS_ITD + X_Labor_Hours,
180          LABOR_HOURS_YTD              = LABOR_HOURS_YTD + X_Labor_Hours,
181          LABOR_HOURS_PP               = LABOR_HOURS_PP + X_Labor_Hours,
182          BILLABLE_LABOR_HOURS_ITD     = BILLABLE_LABOR_HOURS_ITD +
183                                         X_Billable_Labor_Hours,
184          BILLABLE_LABOR_HOURS_YTD     = BILLABLE_LABOR_HOURS_YTD +
185                                         X_Billable_Labor_Hours,
186          BILLABLE_LABOR_HOURS_PP      = BILLABLE_LABOR_HOURS_PP +
187                                         X_Billable_Labor_Hours,
188          LAST_UPDATED_BY              = pa_proj_accum_main.x_last_updated_by,
189          LAST_UPDATE_DATE             = Trunc(Sysdate),
190          LAST_UPDATE_LOGIN            = pa_proj_accum_main.x_last_update_login
191          Where PAA.Project_Accum_id     In
192         (Select Pah.Project_Accum_id from PA_PROJECT_ACCUM_HEADERS PAH
193          Where Pah.Project_id = x_project_id and
194          pah.Resource_list_member_id = 0 and
195          Pah.Task_id in (Select Pt.Task_Id from PA_TASKS pt
196          start with pt.task_id = x_task_id
197          connect by prior pt.parent_task_id = pt.task_id)
198          UNION select  to_number(X_Proj_accum_id) from sys.dual);
199 
200      x_recs_processed := Recs_processed + SQL%ROWCOUNT;
201      END IF;
202      IF(x_revenue_flag = 'Y') THEN
203 
204         Update PA_PROJECT_ACCUM_ACTUALS  PAA SET
205          REVENUE_ITD                  = REVENUE_ITD + X_Revenue,
206          REVENUE_YTD                  = REVENUE_YTD + X_Revenue,
207          REVENUE_PP                   = REVENUE_PP + X_Revenue,
208          LAST_UPDATED_BY              = pa_proj_accum_main.x_last_updated_by,
209          LAST_UPDATE_DATE             = Trunc(Sysdate),
210          LAST_UPDATE_LOGIN            = pa_proj_accum_main.x_last_update_login
211          Where PAA.Project_Accum_id     In
212         (Select Pah.Project_Accum_id from PA_PROJECT_ACCUM_HEADERS PAH
213          Where Pah.Project_id = x_project_id and
214          pah.Resource_list_member_id = 0 and
215          Pah.Task_id in (Select Pt.Task_Id from PA_TASKS pt
216          start with pt.task_id = x_task_id
217          connect by prior pt.parent_task_id = pt.task_id)
218          UNION select  to_number(X_Proj_accum_id) from sys.dual);
219 
220      x_recs_processed := Recs_processed + SQL%ROWCOUNT;
221      END IF;
222      -- Restore the old x_err_stack;
223      x_err_stack := V_Old_Stack;
224 Exception
225 
226   When others Then
227      x_err_code := SQLCODE;
228      RAISE;
229 
230 End Process_it_yt_pp_tasks;
231 
232 Procedure   Process_it_pp_tasks
233                                 (x_project_id In Number,
234                                  x_task_id In Number,
235                                  x_Proj_Accum_id In Number,
236                                  x_current_period In Varchar2,
237                                  X_Revenue In Number,
238                                  X_Raw_Cost In Number,
239                                  X_Burdened_Cost In Number,
240                                  X_Labor_Hours In Number,
241                                  X_Billable_Raw_Cost In Number,
242                                  X_Billable_Burdened_Cost In Number,
243                                  X_Billable_Labor_Hours In Number,
244                                  X_Unit_Of_Measure In Varchar2,
245                                  x_actual_cost_flag  In Varchar2,
246                                  x_revenue_flag  In Varchar2,
247                                  X_Recs_processed Out NOCOPY Number, --File.Sql.39 bug 4440895
248                                  x_err_stack     In Out NOCOPY Varchar2, --File.Sql.39 bug 4440895
249                                  x_err_stage     In Out NOCOPY Varchar2, --File.Sql.39 bug 4440895
250                                  x_err_code      In Out NOCOPY Number ) IS --File.Sql.39 bug 4440895
251 
252 -- This procedure processes the ITD,and PP figures for Actuals
253 
254 Recs_processed Number := 0;
255 V_Accum_id     Number := 0;
256 V_task_array task_id_tabtype;
257 v_noof_tasks Number := 0;
258 v_err_code Number := 0;
259 other_recs_processed Number := 0;
260 V_Old_Stack       Varchar2(630);
261 Begin
262       V_Old_Stack := x_err_stack;
263       x_err_stack :=
264       x_err_stack||'->PA_PROCESS_ACCUM_ACTUALS.Process_it_pp_tasks';
265 
266       pa_debug.debug(x_err_stack);
267 
268       -- The follwing Update statement updates all records in the given task
269       -- WBS hierarchy.It will update only the Project-task combination records
270       -- and the Project level record (Task id = 0 and Resourcelist member id = 0)
271       IF(x_actual_cost_flag = 'Y') THEN
272 
273         Update PA_PROJECT_ACCUM_ACTUALS  PAA SET
274          RAW_COST_ITD               = RAW_COST_ITD + X_Raw_Cost,
275          RAW_COST_PP                = RAW_COST_PP + X_Raw_Cost,
276          BILLABLE_RAW_COST_ITD      = BILLABLE_RAW_COST_ITD +
277                                       X_Billable_Raw_Cost,
278          BILLABLE_RAW_COST_PP       = BILLABLE_RAW_COST_PP +
279                                       X_Billable_Raw_Cost,
280          BURDENED_COST_ITD          = BURDENED_COST_ITD + X_Burdened_Cost,
281          BURDENED_COST_PP           = BURDENED_COST_PP + X_Burdened_Cost,
282          BILLABLE_BURDENED_COST_ITD = BILLABLE_BURDENED_COST_ITD +
283                                       X_Billable_Burdened_Cost,
284          BILLABLE_BURDENED_COST_PP  = BILLABLE_BURDENED_COST_PP +
285                                       X_Billable_Burdened_Cost,
286          LABOR_HOURS_ITD            = LABOR_HOURS_ITD + X_Labor_Hours,
287          LABOR_HOURS_PP             = LABOR_HOURS_PP + X_Labor_Hours,
288          BILLABLE_LABOR_HOURS_ITD   = BILLABLE_LABOR_HOURS_ITD +
289                                       X_Billable_Labor_Hours,
290          BILLABLE_LABOR_HOURS_PP    = BILLABLE_LABOR_HOURS_PP +
291                                       X_Billable_Labor_Hours,
292          LAST_UPDATED_BY            = pa_proj_accum_main.x_last_updated_by,
293          LAST_UPDATE_DATE           = Trunc(Sysdate),
294          LAST_UPDATE_LOGIN          = pa_proj_accum_main.x_last_update_login
295          Where PAA.Project_Accum_id     In
296         (Select Pah.Project_Accum_id from PA_PROJECT_ACCUM_HEADERS PAH
297          Where Pah.Project_id = x_project_id and
298          pah.Resource_list_member_id = 0 and
299          Pah.Task_id in (Select Pt.Task_Id from PA_TASKS pt
300          start with pt.task_id = x_task_id
301          connect by prior pt.parent_task_id = pt.task_id)
302          UNION select  to_number(X_Proj_accum_id) from sys.dual);
303 
304        x_recs_processed := Recs_processed + SQL%ROWCOUNT;
305       END IF;
306       IF(x_revenue_flag = 'Y') THEN
307 
308         Update PA_PROJECT_ACCUM_ACTUALS  PAA SET
309          REVENUE_ITD                = REVENUE_ITD + X_Revenue,
310          REVENUE_PP                 = REVENUE_PP + X_Revenue,
311          LAST_UPDATED_BY            = pa_proj_accum_main.x_last_updated_by,
312          LAST_UPDATE_DATE           = Trunc(Sysdate),
313          LAST_UPDATE_LOGIN          = pa_proj_accum_main.x_last_update_login
314          Where PAA.Project_Accum_id     In
315         (Select Pah.Project_Accum_id from PA_PROJECT_ACCUM_HEADERS PAH
316          Where Pah.Project_id = x_project_id and
317          pah.Resource_list_member_id = 0 and
318          Pah.Task_id in (Select Pt.Task_Id from PA_TASKS pt
319          start with pt.task_id = x_task_id
320          connect by prior pt.parent_task_id = pt.task_id)
321          UNION select  to_number(X_Proj_accum_id) from sys.dual);
322 
323        x_recs_processed := Recs_processed + SQL%ROWCOUNT;
324        END IF;
325        -- Restore the old x_err_stack;
326 
327        x_err_stack := V_Old_Stack;
328 Exception
329 
330   When others Then
331     x_err_code := SQLCODE;
332      RAISE;
333 
334 End Process_it_pp_tasks;
335 
336 Procedure   Process_it_yt_tasks
337                                 (x_project_id In Number,
338                                  x_task_id In Number,
339                                  x_Proj_Accum_id In Number,
340                                  x_current_period In Varchar2,
341                                  X_Revenue In Number,
342                                  X_Raw_Cost In Number,
343                                  X_Burdened_Cost In Number,
344                                  X_Labor_Hours In Number,
345                                  X_Billable_Raw_Cost In Number,
346                                  X_Billable_Burdened_Cost In Number,
347                                  X_Billable_Labor_Hours In Number,
348                                  X_Unit_Of_Measure In Varchar2,
349                                  x_actual_cost_flag  In Varchar2,
350                                  x_revenue_flag  In Varchar2,
351                                  X_Recs_processed Out NOCOPY Number , --File.Sql.39 bug 4440895
352                                  x_err_stack     In Out NOCOPY Varchar2, --File.Sql.39 bug 4440895
353                                  x_err_stage     In Out NOCOPY Varchar2, --File.Sql.39 bug 4440895
354                                  x_err_code      In Out NOCOPY Number ) IS --File.Sql.39 bug 4440895
355 
356 -- This procedure processes the ITD and YTD figures for Actuals
357 
358 Recs_processed Number := 0;
359 V_Accum_id     Number := 0;
360 V_task_array task_id_tabtype;
361 v_noof_tasks Number := 0;
362 v_err_code Number := 0;
363 other_recs_processed Number := 0;
364 V_Old_Stack       Varchar2(630);
365 Begin
366       V_Old_Stack := x_err_stack;
367       x_err_stack :=
368       x_err_stack||'->PA_PROCESS_ACCUM_ACTUALS.Process_it_yt_tasks';
369 
370       pa_debug.debug(x_err_stack);
371 
372       -- The follwing Update statement updates all records in the given task
373       -- WBS hierarchy.It will update only the Project-task combination records
374       -- and the Project level record (Task id = 0 and Resourcelist member id = 0)
375       IF(x_actual_cost_flag = 'Y') THEN
376         Update PA_PROJECT_ACCUM_ACTUALS  PAA SET
377          RAW_COST_ITD               = RAW_COST_ITD + X_Raw_Cost,
378          RAW_COST_YTD               = RAW_COST_YTD + X_Raw_Cost,
379          BILLABLE_RAW_COST_ITD      = BILLABLE_RAW_COST_ITD +
380                                       X_Billable_Raw_Cost,
381          BILLABLE_RAW_COST_YTD      = BILLABLE_RAW_COST_YTD +
382                                       X_Billable_Raw_Cost,
383          BURDENED_COST_ITD          = BURDENED_COST_ITD + X_Burdened_Cost,
384          BURDENED_COST_YTD          = BURDENED_COST_YTD + X_Burdened_Cost,
385          BILLABLE_BURDENED_COST_ITD = BILLABLE_BURDENED_COST_ITD +
386                                       X_Billable_Burdened_Cost,
387          BILLABLE_BURDENED_COST_YTD = BILLABLE_BURDENED_COST_YTD +
388                                       X_Billable_Burdened_Cost,
389          LABOR_HOURS_ITD            = LABOR_HOURS_ITD + X_Labor_Hours,
390          LABOR_HOURS_YTD            = LABOR_HOURS_YTD + X_Labor_Hours,
391          BILLABLE_LABOR_HOURS_ITD   = BILLABLE_LABOR_HOURS_ITD +
392                                       X_Billable_Labor_Hours,
393          BILLABLE_LABOR_HOURS_YTD   = BILLABLE_LABOR_HOURS_YTD +
394                                       X_Billable_Labor_Hours,
395          LAST_UPDATED_BY            = pa_proj_accum_main.x_last_updated_by,
396          LAST_UPDATE_DATE           = Trunc(Sysdate),
397          LAST_UPDATE_LOGIN          = pa_proj_accum_main.x_last_update_login
398          Where PAA.Project_Accum_id     In
399         (Select Pah.Project_Accum_id from PA_PROJECT_ACCUM_HEADERS PAH
400          Where Pah.Project_id = x_project_id and
401          pah.Resource_list_member_id = 0 and
402          Pah.Task_id in (Select Pt.Task_Id from PA_TASKS pt
403          start with pt.task_id = x_task_id
404          connect by prior pt.parent_task_id = pt.task_id)
405          UNION select  to_number(X_Proj_accum_id) from sys.dual);
406 
407       x_recs_processed := Recs_processed + SQL%ROWCOUNT;
408       END IF;
409       IF(x_revenue_flag = 'Y') THEN
410         Update PA_PROJECT_ACCUM_ACTUALS  PAA SET
411          REVENUE_ITD                = REVENUE_ITD + X_Revenue,
412          REVENUE_YTD                = REVENUE_YTD + X_Revenue,
413          LAST_UPDATED_BY            = pa_proj_accum_main.x_last_updated_by,
414          LAST_UPDATE_DATE           = Trunc(Sysdate),
415          LAST_UPDATE_LOGIN          = pa_proj_accum_main.x_last_update_login
416          Where PAA.Project_Accum_id     In
417         (Select Pah.Project_Accum_id from PA_PROJECT_ACCUM_HEADERS PAH
418          Where Pah.Project_id = x_project_id and
419          pah.Resource_list_member_id = 0 and
420          Pah.Task_id in (Select Pt.Task_Id from PA_TASKS pt
421          start with pt.task_id = x_task_id
422          connect by prior pt.parent_task_id = pt.task_id)
423          UNION select  to_number(X_Proj_accum_id) from sys.dual);
424 
425       x_recs_processed := Recs_processed + SQL%ROWCOUNT;
426       END IF;
427     -- Restore the old x_err_stack;
428 
429     x_err_stack := V_Old_Stack;
430 Exception
431 
432   When others Then
433      x_err_code := SQLCODE;
434      RAISE;
435 
436 End Process_it_yt_tasks;
437 
438 Procedure   Process_it_tasks
439                                 (x_project_id In Number,
440                                  x_task_id In Number,
441                                  x_Proj_Accum_id In Number,
442                                  x_current_period In Varchar2,
443                                  X_Revenue In Number,
444                                  X_Raw_Cost In Number,
445                                  X_Burdened_Cost In Number,
446                                  X_Labor_Hours In Number,
447                                  X_Billable_Raw_Cost In Number,
448                                  X_Billable_Burdened_Cost In Number,
449                                  X_Billable_Labor_Hours In Number,
450                                  X_Unit_Of_Measure In Varchar2,
451                                  x_actual_cost_flag  In Varchar2,
452                                  x_revenue_flag  In Varchar2,
453                                  X_Recs_processed Out NOCOPY Number, --File.Sql.39 bug 4440895
454                                  x_err_stack     In Out NOCOPY Varchar2, --File.Sql.39 bug 4440895
455                                  x_err_stage     In Out NOCOPY Varchar2, --File.Sql.39 bug 4440895
456                                  x_err_code      In Out NOCOPY Number ) IS --File.Sql.39 bug 4440895
457 
458 -- This procedure processes the ITD figures for Actuals
459 
460 Recs_processed Number := 0;
461 V_Accum_id     Number := 0;
462 V_task_array task_id_tabtype;
463 v_noof_tasks Number := 0;
464 v_err_code Number := 0;
465 other_recs_processed Number := 0;
466 V_Old_Stack       Varchar2(630);
467 Begin
468    V_Old_Stack := x_err_stack;
469    x_err_stack :=
470    x_err_stack||'->PA_PROCESS_ACCUM_ACTUALS.Process_it_tasks';
471 
472    pa_debug.debug(x_err_stack);
473 
474    -- The follwing Update statement updates all records in the given task
475    -- WBS hierarchy.It will update only the Project-task combination records
476    -- and the Project level record (Task id = 0 and Resourcelist member id = 0)
477    IF(x_actual_cost_flag = 'Y') THEN
478 
479         Update PA_PROJECT_ACCUM_ACTUALS  PAA SET
480          RAW_COST_ITD               = RAW_COST_ITD + X_Raw_Cost,
481          BILLABLE_RAW_COST_ITD      = BILLABLE_RAW_COST_ITD +
482                                       X_Billable_Raw_Cost,
483          BURDENED_COST_ITD          = BURDENED_COST_ITD + X_Burdened_Cost,
484          BILLABLE_BURDENED_COST_ITD = BILLABLE_BURDENED_COST_ITD +
485                                       X_Billable_Burdened_Cost,
486          LABOR_HOURS_ITD            = LABOR_HOURS_ITD + X_Labor_Hours,
487          BILLABLE_LABOR_HOURS_ITD   = BILLABLE_LABOR_HOURS_ITD +
488                                       X_Billable_Labor_Hours,
489          LAST_UPDATED_BY            = pa_proj_accum_main.x_last_updated_by,
490          LAST_UPDATE_DATE           = Trunc(Sysdate),
491          LAST_UPDATE_LOGIN          = pa_proj_accum_main.x_last_update_login
492          Where PAA.Project_Accum_id     In
493         (Select Pah.Project_Accum_id from PA_PROJECT_ACCUM_HEADERS PAH
494          Where Pah.Project_id = x_project_id and
495          pah.Resource_list_member_id = 0 and
496          Pah.Task_id in (Select Pt.Task_Id from PA_TASKS pt
497          start with pt.task_id = x_task_id
498          connect by prior pt.parent_task_id = pt.task_id)
499          UNION select  to_number(X_Proj_accum_id) from sys.dual);
500 
501       x_recs_processed := Recs_processed + SQL%ROWCOUNT;
502    END IF;
503    IF(x_revenue_flag = 'Y') THEN
504 
505         Update PA_PROJECT_ACCUM_ACTUALS  PAA SET
506          REVENUE_ITD                = REVENUE_ITD + X_Revenue,
507          LAST_UPDATED_BY            = pa_proj_accum_main.x_last_updated_by,
508          LAST_UPDATE_DATE           = Trunc(Sysdate),
509          LAST_UPDATE_LOGIN          = pa_proj_accum_main.x_last_update_login
510          Where PAA.Project_Accum_id     In
511         (Select Pah.Project_Accum_id from PA_PROJECT_ACCUM_HEADERS PAH
512          Where Pah.Project_id = x_project_id and
513          pah.Resource_list_member_id = 0 and
514          Pah.Task_id in (Select Pt.Task_Id from PA_TASKS pt
515          start with pt.task_id = x_task_id
516          connect by prior pt.parent_task_id = pt.task_id)
517          UNION select  to_number(X_Proj_accum_id) from sys.dual);
518 
519       x_recs_processed := Recs_processed + SQL%ROWCOUNT;
520    END IF;
521       -- Restore the old x_err_stack;
522 
523       x_err_stack := V_Old_Stack;
524 
525 Exception
526 
527   When Others Then
528      x_err_code := SQLCODE;
529      RAISE;
530 
531 End Process_it_tasks;
532 
533 END PA_PROCESS_ACCUM_ACTUALS;