DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_TASKS_PKG

Source


1 PACKAGE BODY PA_TASKS_PKG as
2 /* $Header: PAXTASKB.pls 120.9 2011/03/21 10:50:08 pcheruvu ship $ */
3 
4   PROCEDURE Insert_Row(X_Rowid                   IN OUT NOCOPY VARCHAR2, --File.Sql.39 bug 4440895
5                        X_Task_Id                        IN OUT NOCOPY NUMBER, --File.Sql.39 bug 4440895
6                        X_Project_Id                     NUMBER,
7                        X_Task_Number                    VARCHAR2,
8                        X_Creation_Date                  DATE,
9                        X_Created_By                     NUMBER,
10                        X_Last_Update_Date               DATE,
11                        X_Last_Updated_By                NUMBER,
12                        X_Last_Update_Login              NUMBER,
13                        X_Task_Name                      VARCHAR2,
14 -- Long Task Name change by xxlu
15                        X_Long_Task_Name                 VARCHAR2,
16                        X_Top_Task_Id                    NUMBER,
17                        X_Wbs_Level                      NUMBER,
18                        X_Ready_To_Bill_Flag             VARCHAR2,
19                        X_Ready_To_Distribute_Flag       VARCHAR2,
20                        X_Parent_Task_Id                 NUMBER,
21                        X_Description                    VARCHAR2,
22                        X_Carrying_Out_Organization_Id   NUMBER,
23                        X_Service_Type_Code              VARCHAR2,
24                        X_Task_Manager_Person_Id         NUMBER,
25                        X_Chargeable_Flag                VARCHAR2,
26                        X_Billable_Flag                  VARCHAR2,
27                        X_Limit_To_Txn_Controls_Flag     VARCHAR2,
28                        X_Start_Date                     DATE,
29                        X_Completion_Date                DATE,
30                        X_Address_Id                     NUMBER,
31                        X_Labor_Bill_Rate_Org_Id         NUMBER,
32                        X_Labor_Std_Bill_Rate_Schdl      VARCHAR2,
33                        X_Labor_Schedule_Fixed_Date      DATE,
34                        X_Labor_Schedule_Discount        NUMBER,
35                        X_Non_Labor_Bill_Rate_Org_Id     NUMBER,
36                        X_NL_Std_Bill_Rate_Schdl         VARCHAR2,
37                        X_NL_Schedule_Fixed_Date         DATE,
38                        X_Non_Labor_Schedule_Discount    NUMBER,
39                        X_Labor_Cost_Multiplier_Name     VARCHAR2,
40                        X_Attribute_Category             VARCHAR2,
41                        X_Attribute1                     VARCHAR2,
42                        X_Attribute2                     VARCHAR2,
43                        X_Attribute3                     VARCHAR2,
44                        X_Attribute4                     VARCHAR2,
45                        X_Attribute5                     VARCHAR2,
46                        X_Attribute6                     VARCHAR2,
47                        X_Attribute7                     VARCHAR2,
48                        X_Attribute8                     VARCHAR2,
49                        X_Attribute9                     VARCHAR2,
50                        X_Attribute10                    VARCHAR2,
51                        X_Cost_Ind_Rate_Sch_Id           NUMBER,
52                        X_Rev_Ind_Rate_Sch_Id            NUMBER,
53                        X_Inv_Ind_Rate_Sch_Id            NUMBER,
54                        X_Cost_Ind_Sch_Fixed_Date        DATE,
55                        X_Rev_Ind_Sch_Fixed_Date         DATE,
56                        X_Inv_Ind_Sch_Fixed_Date         DATE,
57                        X_Labor_Sch_Type                 VARCHAR2,
58                        X_Non_Labor_Sch_Type             VARCHAR2,
59                        X_Allow_Cross_Charge_Flag        VARCHAR2,
60                        X_Project_Rate_Date              DATE,
61                        X_Project_Rate_Type              VARCHAR2,
62                        X_CC_Process_Labor_Flag          VARCHAR2,
63                        X_Labor_Tp_Schedule_Id           NUMBER,
64                        X_Labor_Tp_Fixed_Date            DATE,
65                        X_CC_Process_NL_Flag             VARCHAR2,
66                        X_Nl_Tp_Schedule_Id              NUMBER,
67                        X_Nl_Tp_Fixed_Date               DATE,
68                        X_receive_project_invoice_flag   VARCHAR2,
69                        X_work_type_id                   NUMBER,
70 -- 21-MAR-2001 anlee
71 -- added job_bill_rate_schedule_id,
72 -- emp_bill_rate_schedule_id for
73 -- PRM forecasting changes
74                        X_job_bill_rate_schedule_id      NUMBER,
75                        X_emp_bill_rate_schedule_id      NUMBER,
76 --MCA Sakthi for MultiAgreementCurreny Project
77                        X_taskfunc_cost_rate_type        VARCHAR2,
78                        X_taskfunc_cost_rate_date        DATE,
79                        X_non_lab_std_bill_rt_sch_id     NUMBER,
80 --MCA Sakthi for MultiAgreementCurreny Project
81 -- FP.K Setup changes by msundare
82                        X_labor_disc_reason_code         VARCHAR2,
83                        X_non_labor_disc_reason_code     VARCHAR2,
84 --PA L Dev
85                        x_retirement_cost_flag           VARCHAR2,
86                        x_cint_eligible_flag             VARCHAR2,
87                        x_cint_stop_date                 DATE,
88 /*Added for FPM Changes */
89                        x_customer_id                    Number  default NULL,
90                        x_revenue_accrual_method           varchar2 default null,
91                        x_invoice_method                   varchar2 default null,
92                        x_gen_etc_src_code               VARCHAR2 default NULL,
93                        x_ADJ_ON_STD_INV  VARCHAR2  default 'N' /* Added for 12.2 Payroll billing ER  11847616 */
94 
95   ) IS
96 
97     CURSOR C IS SELECT rowid FROM PA_TASKS
98                  WHERE task_id = X_Task_Id;
99       CURSOR C2 IS SELECT pa_tasks_s.nextval FROM sys.dual;
100 
101 	-- 4537865
102 	l_incoming_taskid pa_tasks.task_id%type ;
103 
104    BEGIN
105 	l_incoming_taskid := x_task_id ;
106 
107       if (X_Task_Id is NULL) then
108         OPEN C2;
109         FETCH C2 INTO X_Task_Id;
110         CLOSE C2;
111       end if;
112 
113        INSERT INTO PA_TASKS(
114               task_id,
115               project_id,
116               task_number,
117               creation_date,
118               created_by,
119               last_update_date,
120               last_updated_by,
121               last_update_login,
122               task_name,
123               long_task_name,
124               top_task_id,
125               wbs_level,
126               ready_to_bill_flag,
127               ready_to_distribute_flag,
128               parent_task_id,
129               description,
130               carrying_out_organization_id,
131               service_type_code,
132               task_manager_person_id,
133               chargeable_flag,
134               billable_flag,
135               limit_to_txn_controls_flag,
136               start_date,
137               completion_date,
138               address_id,
139               labor_bill_rate_org_id,
140               labor_std_bill_rate_schdl,
141               labor_schedule_fixed_date,
142               labor_schedule_discount,
143               non_labor_bill_rate_org_id,
144               non_labor_std_bill_rate_schdl,
145               non_labor_schedule_fixed_date,
146               non_labor_schedule_discount,
147               labor_cost_multiplier_name,
148               attribute_category,
149               attribute1,
150               attribute2,
151               attribute3,
152               attribute4,
153               attribute5,
154               attribute6,
155               attribute7,
156               attribute8,
157               attribute9,
158               attribute10,
159               cost_ind_rate_sch_id,
160               rev_ind_rate_sch_id,
161               inv_ind_rate_sch_id,
162               cost_ind_sch_fixed_date,
163               rev_ind_sch_fixed_date,
164               inv_ind_sch_fixed_date,
165               labor_sch_type,
166               non_labor_sch_type,
167               Allow_Cross_Charge_Flag,
168               Project_Rate_Date,
169               Project_Rate_Type,
170 			     CC_Process_Labor_Flag,
171 			     Labor_Tp_Schedule_Id,
172 			     Labor_Tp_Fixed_Date,
173 			     CC_Process_NL_Flag,
174 			     Nl_Tp_Schedule_Id,
175 			     Nl_Tp_Fixed_Date,
176 			     receive_project_invoice_flag,
177               work_type_id,
178               job_bill_rate_schedule_id,
179               emp_bill_rate_schedule_id,
180               taskfunc_cost_rate_type,
181               taskfunc_cost_rate_date,
182               non_lab_std_bill_rt_sch_id,
183               labor_disc_reason_code,
184               non_labor_disc_reason_code,
185               retirement_cost_flag ,
186               cint_eligible_flag ,
187               cint_stop_date  ,
188               record_version_number,
189               customer_id,
190               revenue_accrual_method,
191               invoice_method,
192               GEN_ETC_SOURCE_CODE,
193               ADJ_ON_STD_INV  /* Added for 12.2 Payroll billing ER  11847616 */
194              ) VALUES (
195               X_Task_Id,
196               X_Project_Id,
197               SUBSTRB( X_Task_Number, 1, 25 ), --Bug 4297289
198               X_Creation_Date,
199               X_Created_By,
200               X_Last_Update_Date,
201               X_Last_Updated_By,
202               X_Last_Update_Login,
203               SUBSTRB( X_Task_Name, 1, 20 ), --Bug 4297289
204               X_Long_Task_Name,
205               nvl(X_Top_Task_Id, X_Task_id),
206               X_Wbs_Level,
207               X_Ready_To_Bill_Flag,
208               X_Ready_To_Distribute_Flag,
209               X_Parent_Task_Id,
210               X_Description,
211               X_Carrying_Out_Organization_Id,
212               X_Service_Type_Code,
213               X_Task_Manager_Person_Id,
214               X_Chargeable_Flag,
215               X_Billable_Flag,
216               X_Limit_To_Txn_Controls_Flag,
217               X_Start_Date,
218               X_Completion_Date,
219               X_Address_Id,
220               X_Labor_Bill_Rate_Org_Id,
221               X_Labor_Std_Bill_Rate_Schdl,
222               X_Labor_Schedule_Fixed_Date,
223               X_Labor_Schedule_Discount,
224               X_Non_Labor_Bill_Rate_Org_Id,
225               X_NL_Std_Bill_Rate_Schdl,
226               X_NL_Schedule_Fixed_Date,
227               X_Non_Labor_Schedule_Discount,
228               X_Labor_Cost_Multiplier_Name,
229               X_Attribute_Category,
230               X_Attribute1,
231               X_Attribute2,
232               X_Attribute3,
233               X_Attribute4,
234               X_Attribute5,
235               X_Attribute6,
236               X_Attribute7,
237               X_Attribute8,
238               X_Attribute9,
239               X_Attribute10,
240               X_Cost_Ind_Rate_Sch_Id,
241               X_Rev_Ind_Rate_Sch_Id,
242               X_Inv_Ind_Rate_Sch_Id,
243               X_Cost_Ind_Sch_Fixed_Date,
244               X_Rev_Ind_Sch_Fixed_Date,
245               X_Inv_Ind_Sch_Fixed_Date,
246               X_Labor_Sch_Type,
247               X_Non_Labor_Sch_Type,
248               X_Allow_Cross_Charge_Flag,
249               X_Project_Rate_Date,
250               X_Project_Rate_Type,
251 			     X_CC_Process_Labor_Flag,
252 			     X_Labor_Tp_Schedule_Id,
253 			     X_Labor_Tp_Fixed_Date,
254 			     X_CC_Process_NL_Flag,
255 			     X_Nl_Tp_Schedule_Id,
256 			     X_Nl_Tp_Fixed_Date,
257 			     X_Receive_Project_Invoice_Flag,
258               X_work_type_id,
259               X_job_bill_rate_schedule_id,
260               X_emp_bill_rate_schedule_id,
261               X_taskfunc_cost_rate_type,
262               X_taskfunc_cost_rate_date,
263               X_non_lab_std_bill_rt_sch_id,
264               X_labor_disc_reason_code,
265               X_non_labor_disc_reason_code,
266 --PA L Changes 2872708
267               x_retirement_cost_flag ,
268               x_cint_eligible_flag ,
269               x_cint_stop_date  ,
270               1,
271               x_customer_id,
272               x_revenue_accrual_method,
273               x_invoice_method,
274                x_gen_etc_src_code,
275               x_ADJ_ON_STD_INV  /* Added for 12.2 Payroll billing ER  11847616 */
276              );
277 
278 
279     OPEN C;
280     FETCH C INTO X_Rowid;
281     if (C%NOTFOUND) then
282       CLOSE C;
283       Raise NO_DATA_FOUND;
284     end if;
285     CLOSE C;
286 -- 4537865
287 EXCEPTION
288   WHEN OTHERS THEN
289 	-- RESET IN OUT params to their original values
290 	X_Rowid := NULL ;
291 	X_Task_Id := l_incoming_taskid ;
292 
296                           p_error_text     => SUBSTRB(SQLERRM,1,240));
293 	-- Populate error stack and RAISE
294 	fnd_msg_pub.add_exc_msg(p_pkg_name => 'PA_TASKS_PKG',
295                           p_procedure_name => 'Insert_Row',
297   RAISE;
298   END Insert_Row;
299 
300 
301   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2,
302                      X_Task_Id                          NUMBER,
303                      X_Project_Id                       NUMBER,
304                      X_Task_Number                      VARCHAR2,
305                      X_Task_Name                        VARCHAR2,
306 -- Long Task Name change by xxlu
307                      X_Long_Task_Name                   VARCHAR2,
308                      X_Top_Task_Id                      NUMBER,
309                      X_Wbs_Level                        NUMBER,
310                      X_Ready_To_Bill_Flag               VARCHAR2,
311                      X_Ready_To_Distribute_Flag         VARCHAR2,
312                      X_Parent_Task_Id                   NUMBER,
313                      X_Description                      VARCHAR2,
314                      X_Carrying_Out_Organization_Id     NUMBER,
315                      X_Service_Type_Code                VARCHAR2,
316                      X_Task_Manager_Person_Id           NUMBER,
317                      X_Chargeable_Flag                  VARCHAR2,
318                      X_Billable_Flag                    VARCHAR2,
319                      X_Limit_To_Txn_Controls_Flag       VARCHAR2,
320                      X_Start_Date                       DATE,
321                      X_Completion_Date                  DATE,
322                      X_Address_Id                       NUMBER,
323                      X_Labor_Bill_Rate_Org_Id           NUMBER,
324                      X_Labor_Std_Bill_Rate_Schdl        VARCHAR2,
325                      X_Labor_Schedule_Fixed_Date        DATE,
326                      X_Labor_Schedule_Discount          NUMBER,
327                      X_Non_Labor_Bill_Rate_Org_Id       NUMBER,
328                      X_NL_Std_Bill_Rate_Schdl           VARCHAR2,
329                      X_NL_Schedule_Fixed_Date           DATE,
330                      X_Non_Labor_Schedule_Discount      NUMBER,
331                      X_Labor_Cost_Multiplier_Name       VARCHAR2,
332                      X_Attribute_Category               VARCHAR2,
333                      X_Attribute1                       VARCHAR2,
334                      X_Attribute2                       VARCHAR2,
335                      X_Attribute3                       VARCHAR2,
336                      X_Attribute4                       VARCHAR2,
337                      X_Attribute5                       VARCHAR2,
338                      X_Attribute6                       VARCHAR2,
339                      X_Attribute7                       VARCHAR2,
340                      X_Attribute8                       VARCHAR2,
341                      X_Attribute9                       VARCHAR2,
342                      X_Attribute10                      VARCHAR2,
343                      X_Cost_Ind_Rate_Sch_Id             NUMBER,
344                      X_Rev_Ind_Rate_Sch_Id              NUMBER,
345                      X_Inv_Ind_Rate_Sch_Id              NUMBER,
346                      X_Cost_Ind_Sch_Fixed_Date          DATE,
347                      X_Rev_Ind_Sch_Fixed_Date           DATE,
348                      X_Inv_Ind_Sch_Fixed_Date           DATE,
349                      X_Labor_Sch_Type                   VARCHAR2,
350                      X_Non_Labor_Sch_Type               VARCHAR2,
351                      X_Allow_Cross_Charge_Flag        VARCHAR2,
352                      X_Project_Rate_Date              DATE,
353                      X_Project_Rate_Type              VARCHAR2,
354                      X_CC_Process_Labor_Flag          VARCHAR2,
355                      X_Labor_Tp_Schedule_Id           NUMBER,
356                      X_Labor_Tp_Fixed_Date            DATE,
357                      X_CC_Process_NL_Flag             VARCHAR2,
358                      X_Nl_Tp_Schedule_Id              NUMBER,
359                      X_Nl_Tp_Fixed_Date               DATE,
360                      X_receive_project_invoice_flag   VARCHAR2,
361                      X_work_type_id                   NUMBER,
362 -- 21-MAR-2001 anlee
363 -- added job_bill_rate_schedule_id,
364 -- emp_bill_rate_schedule_id for
365 -- PRM forecasting changes
366                      X_job_bill_rate_schedule_id      NUMBER,
367                      X_emp_bill_rate_schedule_id      NUMBER,
368 --MCA Sakthi for MultiAgreementCurreny Project
369                        X_taskfunc_cost_rate_type        VARCHAR2,
370                        X_taskfunc_cost_rate_date        DATE,
371                        X_non_lab_std_bill_rt_sch_id     NUMBER,
372 --MCA Sakthi for MultiAgreementCurreny Project
373 -- FP.K Setup changes by msundare
374                        X_labor_disc_reason_code         VARCHAR2,
375                        X_non_labor_disc_reason_code     VARCHAR2,
376 --PA L Changes 2872708
377                        x_retirement_cost_flag           VARCHAR2,
378                        x_cint_eligible_flag             VARCHAR2,
379                      x_cint_stop_date                 DATE
380 
381   ) IS
382     CURSOR C IS
383         SELECT *
384         FROM   PA_TASKS
385         WHERE  rowid = X_Rowid
386         FOR UPDATE of Task_Id NOWAIT;
387     Recinfo C%ROWTYPE;
388 
389   BEGIN
390     OPEN C;
391     FETCH C INTO Recinfo;
392     if (C%NOTFOUND) then
393       CLOSE C;
394       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
395       APP_EXCEPTION.Raise_Exception;
396     end if;
397     CLOSE C;
398 
399     if (
400                (Recinfo.task_id =  X_Task_Id)
401            AND (Recinfo.project_id =  X_Project_Id)
402            AND (ltrim(rtrim(Recinfo.task_number)) =  ltrim(rtrim(X_Task_Number)))
406            AND (Recinfo.ready_to_bill_flag =  X_Ready_To_Bill_Flag)
403            AND (rtrim(Recinfo.task_name) =  rtrim(X_Task_Name))
404            AND (Recinfo.top_task_id =  X_Top_Task_Id)
405            AND (Recinfo.wbs_level =  X_Wbs_Level)
407            AND (Recinfo.ready_to_distribute_flag =  X_Ready_To_Distribute_Flag)
408            AND (   (Recinfo.parent_task_id =  X_Parent_Task_Id)
409                 OR (    (Recinfo.parent_task_id IS NULL)
410                     AND (X_Parent_Task_Id IS NULL)))
411            AND (   (Recinfo.description =  X_Description)
412                 OR (    (Recinfo.description IS NULL)
413                     AND (X_Description IS NULL)))
414            AND (   (Recinfo.carrying_out_organization_id =
415 			X_Carrying_Out_Organization_Id)
416                 OR (    (Recinfo.carrying_out_organization_id IS NULL)
417                     AND (X_Carrying_Out_Organization_Id IS NULL)))
418            AND (   (Recinfo.service_type_code =  X_Service_Type_Code)
419                 OR (    (Recinfo.service_type_code IS NULL)
420                     AND (X_Service_Type_Code IS NULL)))
421            AND (   (Recinfo.task_manager_person_id =
422 			X_Task_Manager_Person_Id)
423                 OR (    (Recinfo.task_manager_person_id IS NULL)
424                     AND (X_Task_Manager_Person_Id IS NULL)))
425            AND (   (Recinfo.chargeable_flag =  X_Chargeable_Flag)
426                 OR (    (Recinfo.chargeable_flag IS NULL)
427                     AND (X_Chargeable_Flag IS NULL)))
428            AND (   (Recinfo.billable_flag =  X_Billable_Flag)
429                 OR (    (Recinfo.billable_flag IS NULL)
430                     AND (X_Billable_Flag IS NULL)))
431            AND (   (Recinfo.limit_to_txn_controls_flag =
432 			X_Limit_To_Txn_Controls_Flag)
433                 OR (    (Recinfo.limit_to_txn_controls_flag IS NULL)
434                     AND (X_Limit_To_Txn_Controls_Flag IS NULL)))
435            AND (   (Recinfo.start_date =  X_Start_Date)
436                 OR (    (Recinfo.start_date IS NULL)
437                     AND (X_Start_Date IS NULL)))
438            AND (   (Recinfo.completion_date =  X_Completion_Date)
439                 OR (    (Recinfo.completion_date IS NULL)
440                     AND (X_Completion_Date IS NULL)))
441            AND (   (Recinfo.address_id =  X_Address_Id)
442                 OR (    (Recinfo.address_id IS NULL)
443                     AND (X_Address_Id IS NULL)))
444            AND (   (Recinfo.labor_bill_rate_org_id =  X_Labor_Bill_Rate_Org_Id)
445                 OR (    (Recinfo.labor_bill_rate_org_id IS NULL)
446                     AND (X_Labor_Bill_Rate_Org_Id IS NULL)))
447            AND (   (Recinfo.labor_std_bill_rate_schdl =
448 			 X_Labor_Std_Bill_Rate_Schdl)
449                 OR (    (Recinfo.labor_std_bill_rate_schdl IS NULL)
450                     AND (X_Labor_Std_Bill_Rate_Schdl IS NULL)))
451            AND (   (Recinfo.labor_schedule_fixed_date =
452 			 X_Labor_Schedule_Fixed_Date)
453                 OR (    (Recinfo.labor_schedule_fixed_date IS NULL)
454                     AND (X_Labor_Schedule_Fixed_Date IS NULL)))
455            AND (   (Recinfo.labor_schedule_discount =
456 			 X_Labor_Schedule_Discount)
457                 OR (    (Recinfo.labor_schedule_discount IS NULL)
458                     AND (X_Labor_Schedule_Discount IS NULL)))
459            AND (   (Recinfo.non_labor_bill_rate_org_id =
460 			 X_Non_Labor_Bill_Rate_Org_Id)
461                 OR (    (Recinfo.non_labor_bill_rate_org_id IS NULL)
462                     AND (X_Non_Labor_Bill_Rate_Org_Id IS NULL)))
463            AND (   (Recinfo.non_labor_std_bill_rate_schdl =
464 			 X_NL_Std_Bill_Rate_Schdl)
465                 OR (    (Recinfo.non_labor_std_bill_rate_schdl IS NULL)
466                     AND (X_NL_Std_Bill_Rate_Schdl IS NULL)))
467            AND (   (Recinfo.non_labor_schedule_fixed_date =
468 			 X_NL_Schedule_Fixed_Date)
469                 OR (    (Recinfo.non_labor_schedule_fixed_date IS NULL)
470                     AND (X_NL_Schedule_Fixed_Date IS NULL)))
471            AND (   (Recinfo.non_labor_schedule_discount =
472 			 X_Non_Labor_Schedule_Discount)
473                 OR (    (Recinfo.non_labor_schedule_discount IS NULL)
474                     AND (X_Non_Labor_Schedule_Discount IS NULL)))
475            AND (   (Recinfo.labor_cost_multiplier_name =
476 			 X_Labor_Cost_Multiplier_Name)
477                 OR (    (Recinfo.labor_cost_multiplier_name IS NULL)
478                     AND (X_Labor_Cost_Multiplier_Name IS NULL)))
479            AND (   (Recinfo.attribute_category =  X_Attribute_Category)
480                 OR (    (Recinfo.attribute_category IS NULL)
481                     AND (X_Attribute_Category IS NULL)))
482            AND (   (Recinfo.attribute1 =  X_Attribute1)
483                 OR (    (Recinfo.attribute1 IS NULL)
484                     AND (X_Attribute1 IS NULL)))
485            AND (   (Recinfo.attribute2 =  X_Attribute2)
486                 OR (    (Recinfo.attribute2 IS NULL)
487                     AND (X_Attribute2 IS NULL)))
488            AND (   (Recinfo.attribute3 =  X_Attribute3)
489                 OR (    (Recinfo.attribute3 IS NULL)
490                     AND (X_Attribute3 IS NULL)))
491            AND (   (Recinfo.attribute4 =  X_Attribute4)
492                 OR (    (Recinfo.attribute4 IS NULL)
493                     AND (X_Attribute4 IS NULL)))
494            AND (   (Recinfo.attribute5 =  X_Attribute5)
495                 OR (    (Recinfo.attribute5 IS NULL)
496                     AND (X_Attribute5 IS NULL)))
497            AND (   (Recinfo.attribute6 =  X_Attribute6)
498                 OR (    (Recinfo.attribute6 IS NULL)
499                     AND (X_Attribute6 IS NULL)))
500            AND (   (Recinfo.attribute7 =  X_Attribute7)
501                 OR (    (Recinfo.attribute7 IS NULL)
502                     AND (X_Attribute7 IS NULL)))
503            AND (   (Recinfo.attribute8 =  X_Attribute8)
504                 OR (    (Recinfo.attribute8 IS NULL)
508                     AND (X_Attribute9 IS NULL)))
505                     AND (X_Attribute8 IS NULL)))
506            AND (   (Recinfo.attribute9 =  X_Attribute9)
507                 OR (    (Recinfo.attribute9 IS NULL)
509            AND (   (Recinfo.attribute10 =  X_Attribute10)
510                 OR (    (Recinfo.attribute10 IS NULL)
511                     AND (X_Attribute10 IS NULL)))
512            AND (   (Recinfo.cost_ind_rate_sch_id =
513 			X_Cost_Ind_Rate_Sch_Id)
514                 OR (    (Recinfo.cost_ind_rate_sch_id IS NULL)
515                     AND (X_Cost_Ind_Rate_Sch_Id IS NULL)))
516            AND (   (Recinfo.rev_ind_rate_sch_id =  X_Rev_Ind_Rate_Sch_Id)
517                 OR (    (Recinfo.rev_ind_rate_sch_id IS NULL)
518                     AND (X_Rev_Ind_Rate_Sch_Id IS NULL)))
519            AND (   (Recinfo.inv_ind_rate_sch_id =  X_Inv_Ind_Rate_Sch_Id)
520                 OR (    (Recinfo.inv_ind_rate_sch_id IS NULL)
521                     AND (X_Inv_Ind_Rate_Sch_Id IS NULL)))
522            AND (   (Recinfo.cost_ind_sch_fixed_date =
523 			 X_Cost_Ind_Sch_Fixed_Date)
524                 OR (    (Recinfo.cost_ind_sch_fixed_date IS NULL)
525                     AND (X_Cost_Ind_Sch_Fixed_Date IS NULL)))
526            AND (   (Recinfo.rev_ind_sch_fixed_date =
527 			 X_Rev_Ind_Sch_Fixed_Date)
528                 OR (    (Recinfo.rev_ind_sch_fixed_date IS NULL)
529                     AND (X_Rev_Ind_Sch_Fixed_Date IS NULL)))
530            AND (   (Recinfo.inv_ind_sch_fixed_date =
531 			 X_Inv_Ind_Sch_Fixed_Date)
532                 OR (    (Recinfo.inv_ind_sch_fixed_date IS NULL)
533                     AND (X_Inv_Ind_Sch_Fixed_Date IS NULL)))
534            AND (   (Recinfo.labor_sch_type =  X_Labor_Sch_Type)
535                 OR (    (Recinfo.labor_sch_type IS NULL)
536                     AND (X_Labor_Sch_Type IS NULL)))
537            AND (   (Recinfo.non_labor_sch_type =  X_Non_Labor_Sch_Type)
538                 OR (    (Recinfo.non_labor_sch_type IS NULL)
539                     AND (X_Non_Labor_Sch_Type IS NULL)))
540               AND (   (Recinfo.Allow_Cross_Charge_Flag =
541          X_Allow_Cross_Charge_Flag)
542                 OR (    (Recinfo.Allow_Cross_Charge_Flag IS NULL)
543                     AND (X_Allow_Cross_Charge_Flag IS NULL)))
544               AND (   (Recinfo.Project_Rate_Date =
545          X_Project_Rate_Date)
546                 OR (    (Recinfo.Project_Rate_Date IS NULL)
547                     AND (X_Project_Rate_Date IS NULL)))
548               AND (   (Recinfo.Project_Rate_Type =
549          X_Project_Rate_Type)
550                 OR (    (Recinfo.Project_Rate_Type IS NULL)
551                     AND (X_Project_Rate_Type IS NULL)))
552               AND (   (Recinfo.CC_Process_Labor_Flag =
553          X_CC_Process_Labor_Flag)
554                 OR (    (Recinfo.CC_Process_Labor_Flag IS NULL)
555                     AND (X_CC_Process_Labor_Flag IS NULL)))
556               AND (   (Recinfo.Labor_Tp_Schedule_Id =
557          X_Labor_Tp_Schedule_Id)
558                 OR (    (Recinfo.Labor_Tp_Schedule_Id IS NULL)
559                     AND (X_Labor_Tp_Schedule_Id IS NULL)))
560               AND (   (Recinfo.Labor_Tp_Fixed_Date =
561          X_Labor_Tp_Fixed_Date)
562                 OR (    (Recinfo.Labor_Tp_Fixed_Date IS NULL)
563                     AND (X_Labor_Tp_Fixed_Date IS NULL)))
564               AND (   (Recinfo.CC_Process_NL_Flag =
565          X_CC_Process_NL_Flag)
566                 OR (    (Recinfo.CC_Process_NL_Flag IS NULL)
567                     AND (X_CC_Process_NL_Flag IS NULL)))
568               AND (   (Recinfo.Nl_Tp_Schedule_Id =
569          X_Nl_Tp_Schedule_Id)
570                 OR (    (Recinfo.Nl_Tp_Schedule_Id IS NULL)
571                     AND (X_Nl_Tp_Schedule_Id IS NULL)))
572               AND (   (Recinfo.Nl_Tp_Fixed_Date =
573          X_Nl_Tp_Fixed_Date)
574                 OR (    (Recinfo.Nl_Tp_Fixed_Date IS NULL)
575                     AND (X_Nl_Tp_Fixed_Date IS NULL)))
576               AND (   (Recinfo.Receive_Project_Invoice_Flag =
577          X_Receive_Project_Invoice_Flag)
578                 OR (    (Recinfo.Receive_Project_Invoice_Flag IS NULL)
579                     AND (X_Receive_Project_Invoice_Flag IS NULL)))
580               AND (   (Recinfo.work_type_id =
581          X_work_type_id)
582                 OR (    (Recinfo.work_type_id IS NULL)
583                     AND (X_work_type_id IS NULL)))
584               AND (   (Recinfo.job_bill_rate_schedule_id =
585          X_job_bill_rate_schedule_id)
586                 OR (    (Recinfo.job_bill_rate_schedule_id IS NULL)
587                     AND (X_job_bill_rate_schedule_id IS NULL)))
588               AND (   (Recinfo.emp_bill_rate_schedule_id =
589          X_emp_bill_rate_schedule_id)
590                 OR (    (Recinfo.emp_bill_rate_schedule_id IS NULL)
591                     AND (X_emp_bill_rate_schedule_id IS NULL)))
592 --MCA Sakthi for MultiAgreementCurreny Project
593               AND (   (Recinfo.taskfunc_cost_rate_type =
594          X_taskfunc_cost_rate_type)
595                 OR (    (Recinfo.taskfunc_cost_rate_type IS NULL)
596                     AND (X_taskfunc_cost_rate_type IS NULL)))
597               AND (   (Recinfo.taskfunc_cost_rate_date =
598          X_taskfunc_cost_rate_date)
599                 OR (    (Recinfo.taskfunc_cost_rate_date IS NULL)
600                     AND (X_taskfunc_cost_rate_date IS NULL)))
601               AND (   (Recinfo.non_lab_std_bill_rt_sch_id =
602          X_non_lab_std_bill_rt_sch_id)
603                 OR (    (Recinfo.non_lab_std_bill_rt_sch_id IS NULL)
604                     AND (X_non_lab_std_bill_rt_sch_id IS NULL)))
605 --MCA Sakthi for MultiAgreementCurreny Project
606 -- Modified for added columns in FP.K msundare
607               AND (   (Recinfo.labor_disc_reason_code =
608          X_labor_disc_reason_code)
609                 OR (    (Recinfo.labor_disc_reason_code IS NULL)
610                     AND (X_labor_disc_reason_code IS NULL)))
614                     AND (X_non_labor_disc_reason_code IS NULL)))
611               AND (   (Recinfo.non_labor_disc_reason_code =
612          X_non_labor_disc_reason_code)
613                 OR (    (Recinfo.non_labor_disc_reason_code IS NULL)
615               AND (   (Recinfo.retirement_cost_flag =
616          X_retirement_cost_flag)
617                 OR (    (Recinfo.retirement_cost_flag IS NULL)
618                     AND (X_retirement_cost_flag IS NULL)))
619               AND (   (Recinfo.cint_eligible_flag =
620          X_cint_eligible_flag)
621                 OR (    (Recinfo.cint_eligible_flag IS NULL)
622                     AND (X_cint_eligible_flag IS NULL)))
623              AND (   (Recinfo.cint_stop_date =
624          X_cint_stop_date)
625                 OR (    (Recinfo.cint_stop_date IS NULL)
626                     AND (X_cint_stop_date IS NULL)))
627 
628 
629       ) then
630       return;
631     else
632       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
633       APP_EXCEPTION.Raise_Exception;
634     end if;
635   END Lock_Row;
636 
637 
638   PROCEDURE Update_Row(X_Rowid                          VARCHAR2,
639                        X_Task_Id                        NUMBER,
640                        X_Project_Id                     NUMBER,
641                        X_Task_Number                    VARCHAR2,
642                        X_Last_Update_Date               DATE,
643                        X_Last_Updated_By                NUMBER,
644                        X_Last_Update_Login              NUMBER,
645                        X_Task_Name                      VARCHAR2,
646 -- Long Task Name change by xxlu
647                        X_Long_Task_Name                 VARCHAR2,
648                        X_Top_Task_Id                    NUMBER,
649                        X_Wbs_Level                      NUMBER,
650                        X_Ready_To_Bill_Flag             VARCHAR2,
651                        X_Ready_To_Distribute_Flag       VARCHAR2,
652                        X_Parent_Task_Id                 NUMBER,
653                        X_Description                    VARCHAR2,
654                        X_Carrying_Out_Organization_Id   NUMBER,
655                        X_Service_Type_Code              VARCHAR2,
656                        X_Task_Manager_Person_Id         NUMBER,
657                        X_Chargeable_Flag                VARCHAR2,
658                        X_Billable_Flag                  VARCHAR2,
659                        X_Limit_To_Txn_Controls_Flag     VARCHAR2,
660                        X_Start_Date                     DATE,
661                        X_Completion_Date                DATE,
662                        X_Address_Id                     NUMBER,
663                        X_Labor_Bill_Rate_Org_Id         NUMBER,
664                        X_Labor_Std_Bill_Rate_Schdl      VARCHAR2,
665                        X_Labor_Schedule_Fixed_Date      DATE,
666                        X_Labor_Schedule_Discount        NUMBER,
667                        X_Non_Labor_Bill_Rate_Org_Id     NUMBER,
668                        X_NL_Std_Bill_Rate_Schdl  	VARCHAR2,
669                        X_NL_Schedule_Fixed_Date  	DATE,
670                        X_Non_Labor_Schedule_Discount    NUMBER,
671                        X_Labor_Cost_Multiplier_Name     VARCHAR2,
672                        X_Attribute_Category             VARCHAR2,
673                        X_Attribute1                     VARCHAR2,
674                        X_Attribute2                     VARCHAR2,
675                        X_Attribute3                     VARCHAR2,
676                        X_Attribute4                     VARCHAR2,
677                        X_Attribute5                     VARCHAR2,
678                        X_Attribute6                     VARCHAR2,
679                        X_Attribute7                     VARCHAR2,
680                        X_Attribute8                     VARCHAR2,
681                        X_Attribute9                     VARCHAR2,
682                        X_Attribute10                    VARCHAR2,
683                        X_Cost_Ind_Rate_Sch_Id           NUMBER,
684                        X_Rev_Ind_Rate_Sch_Id            NUMBER,
685                        X_Inv_Ind_Rate_Sch_Id            NUMBER,
686                        X_Cost_Ind_Sch_Fixed_Date        DATE,
687                        X_Rev_Ind_Sch_Fixed_Date         DATE,
688                        X_Inv_Ind_Sch_Fixed_Date         DATE,
689                        X_Labor_Sch_Type                 VARCHAR2,
690                        X_Non_Labor_Sch_Type             VARCHAR2,
691                        X_Allow_Cross_Charge_Flag        VARCHAR2,
692                        X_Project_Rate_Date              DATE,
693                        X_Project_Rate_Type              VARCHAR2,
694                        X_CC_Process_Labor_Flag          VARCHAR2,
695                        X_Labor_Tp_Schedule_Id           NUMBER,
696                        X_Labor_Tp_Fixed_Date            DATE,
697                        X_CC_Process_NL_Flag             VARCHAR2,
698                        X_Nl_Tp_Schedule_Id              NUMBER,
699                        X_Nl_Tp_Fixed_Date               DATE,
700                        X_receive_project_invoice_flag   VARCHAR2,
701                        X_work_type_id                   NUMBER,
702 -- 21-MAR-2001 anlee
703 -- added job_bill_rate_schedule_id,
704 -- emp_bill_rate_schedule_id for
705 -- PRM forecasting changes
706                        X_job_bill_rate_schedule_id      NUMBER,
707                        X_emp_bill_rate_schedule_id      NUMBER,
708 --MCA Sakthi for MultiAgreementCurreny Project
709                        X_taskfunc_cost_rate_type        VARCHAR2,
710                        X_taskfunc_cost_rate_date        DATE,
711                        X_non_lab_std_bill_rt_sch_id     NUMBER,
712 --MCA Sakthi for MultiAgreementCurreny Project
713 -- FP.K Setup changes by msundare
714                        X_labor_disc_reason_code         VARCHAR2,
718                        x_cint_eligible_flag             VARCHAR2,
715                        X_non_labor_disc_reason_code     VARCHAR2,
716 --PA L Dev
717                        x_retirement_cost_flag           VARCHAR2,
719                        x_cint_stop_date                 DATE,
720                        x_gen_etc_src_code               VARCHAR2
721 
722   ) IS
723 
724   BEGIN
725 
726 
727     UPDATE PA_TASKS
728     SET
729        task_id                         =     X_Task_Id,
730        project_id                      =     X_Project_Id,
731        task_number                     =     SUBSTRB( X_Task_Number, 1, 25 ), -- 4537865 : Replaced SUBSTR with SUBSTRB
732        last_update_date                =     X_Last_Update_Date,
733        last_updated_by                 =     X_Last_Updated_By,
734        last_update_login               =     X_Last_Update_Login,
735        task_name                       =     SUBSTRB( X_Task_Name, 1, 20 ),-- 4537865 : Replaced SUBSTR with SUBSTRB
736        long_task_name                  =     X_Long_Task_Name,
737        top_task_id                     =     X_Top_Task_Id,
738        wbs_level                       =     X_Wbs_Level,
739        ready_to_bill_flag              =     X_Ready_To_Bill_Flag,
740        ready_to_distribute_flag        =     X_Ready_To_Distribute_Flag,
741        parent_task_id                  =     X_Parent_Task_Id,
742        description                     =     X_Description,
743        carrying_out_organization_id    =     X_Carrying_Out_Organization_Id,
744        service_type_code               =     X_Service_Type_Code,
745        task_manager_person_id          =     X_Task_Manager_Person_Id,
746        chargeable_flag                 =     X_Chargeable_Flag,
747        billable_flag                   =     X_Billable_Flag,
748        limit_to_txn_controls_flag      =     X_Limit_To_Txn_Controls_Flag,
749        start_date                      =     X_Start_Date,
750        completion_date                 =     X_Completion_Date,
751        address_id                      =     X_Address_Id,
752        labor_bill_rate_org_id          =     X_Labor_Bill_Rate_Org_Id,
753        labor_std_bill_rate_schdl       =     X_Labor_Std_Bill_Rate_Schdl,
754        labor_schedule_fixed_date       =     X_Labor_Schedule_Fixed_Date,
755        labor_schedule_discount         =     X_Labor_Schedule_Discount,
756        non_labor_bill_rate_org_id      =     X_Non_Labor_Bill_Rate_Org_Id,
757        non_labor_std_bill_rate_schdl   =     X_NL_Std_Bill_Rate_Schdl,
758        non_labor_schedule_fixed_date   =     X_NL_Schedule_Fixed_Date,
759        non_labor_schedule_discount     =     X_Non_Labor_Schedule_Discount,
760        labor_cost_multiplier_name      =     X_Labor_Cost_Multiplier_Name,
761        attribute_category              =     X_Attribute_Category,
762        attribute1                      =     X_Attribute1,
763        attribute2                      =     X_Attribute2,
764        attribute3                      =     X_Attribute3,
765        attribute4                      =     X_Attribute4,
766        attribute5                      =     X_Attribute5,
767        attribute6                      =     X_Attribute6,
768        attribute7                      =     X_Attribute7,
769        attribute8                      =     X_Attribute8,
770        attribute9                      =     X_Attribute9,
771        attribute10                     =     X_Attribute10,
772        cost_ind_rate_sch_id            =     X_Cost_Ind_Rate_Sch_Id,
773        rev_ind_rate_sch_id             =     X_Rev_Ind_Rate_Sch_Id,
774        inv_ind_rate_sch_id             =     X_Inv_Ind_Rate_Sch_Id,
775        cost_ind_sch_fixed_date         =     X_Cost_Ind_Sch_Fixed_Date,
776        rev_ind_sch_fixed_date          =     X_Rev_Ind_Sch_Fixed_Date,
777        inv_ind_sch_fixed_date          =     X_Inv_Ind_Sch_Fixed_Date,
778        labor_sch_type                  =     X_Labor_Sch_Type,
779        non_labor_sch_type              =     X_Non_Labor_Sch_Type,
780        Allow_Cross_Charge_Flag         =     X_Allow_Cross_Charge_Flag,
781        Project_Rate_Date               =     X_Project_Rate_Date,
782        Project_Rate_Type               =     X_Project_Rate_Type,
783        CC_Process_Labor_Flag           =     X_CC_Process_Labor_Flag,
784        Labor_Tp_Schedule_Id            =     X_Labor_Tp_Schedule_Id,
785        Labor_Tp_Fixed_Date             =     X_Labor_Tp_Fixed_Date,
786        CC_Process_NL_Flag              =     X_CC_Process_NL_Flag,
787        Nl_Tp_Schedule_Id               =     X_Nl_Tp_Schedule_Id,
788        Nl_Tp_Fixed_Date                =     X_Nl_Tp_Fixed_Date,
789        Receive_Project_Invoice_Flag    =     X_Receive_Project_Invoice_Flag,
790        Work_Type_ID                    =     X_Work_Type_ID,
791        job_bill_rate_schedule_id       =     X_job_bill_rate_schedule_id,
792        emp_bill_rate_schedule_id       =     X_emp_bill_rate_schedule_id,
793 --MCA Sakthi for MultiAgreementCurreny Project
794        taskfunc_cost_rate_type       =     X_taskfunc_cost_rate_type,
795        taskfunc_cost_rate_date       =     X_taskfunc_cost_rate_date,
796        non_lab_std_bill_rt_sch_id    =     X_non_lab_std_bill_rt_sch_id,
797  --msundare
798        labor_disc_reason_code        =     X_labor_disc_reason_code,
799        non_labor_disc_reason_code    =     X_non_labor_disc_reason_code,
800 --PA_L
801        retirement_cost_flag          =     x_retirement_cost_flag,
802        cint_eligible_flag            =     x_cint_eligible_flag,
803        cint_stop_date                =     x_cint_stop_date,
804        GEN_ETC_SOURCE_CODE           =     x_gen_etc_src_code,
805        record_version_number         =     nvl( record_version_number, 1 ) + 1
806 
807             --MCA Sakthi for MultiAgreementCurreny Project
808     WHERE rowid = X_Rowid;
809 
810 
811     if (SQL%NOTFOUND) then
812       Raise NO_DATA_FOUND;
813     end if;
814   END Update_Row;
815 
816   PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
817   BEGIN
821     if (SQL%NOTFOUND) then
818     DELETE FROM PA_TASKS
819     WHERE rowid = X_Rowid;
820 
822       Raise NO_DATA_FOUND;
823     end if;
824   END Delete_Row;
825 
826 --
827 --  Name
828 --          verify_lowest_level_task
829 --
830 --  Purpose
831 --          This procedure is used to verify if a task is a lowest level task.
832 --
833 --  History
834 --          XX-MAY-94   R. Wadera          Created
835 --
836 procedure verify_lowest_level_task (x_return_status IN OUT NOCOPY number, --File.Sql.39 bug 4440895
837                                     x_task_id       IN     number)
838 is
839 x_dummy number;
840 
841 begin
842 
843   x_return_status := 0;
844   begin
845     select task_id
846     into   x_dummy
847     from   pa_tasks t1
848     where  not exists
849                    (select *
850                     from   pa_tasks t2
851                     where  t1.task_id = t2.parent_task_id)
852     and t1.task_id = x_task_id;
853 
854     x_return_status := 0;
855     EXCEPTION
856       WHEN NO_DATA_FOUND then
857       x_return_status := 1;
858 
859       WHEN OTHERS then
860       x_return_status := SQLCODE;
861   end;
862 
863 end verify_lowest_level_task;
864 
865 END PA_TASKS_PKG;
866