[Home] [Help]
PACKAGE BODY: APPS.PA_ONLINE_COPY_EXP
Source
1 PACKAGE BODY PA_ONLINE_COPY_EXP AS
2 /* $Header: PAXTRCPB.pls 120.1 2005/08/17 12:57:03 ramurthy noship $ */
3
4 dummy NUMBER;
5 org_id NUMBER(15);
6 G_module VARCHAR2(30);
7 outcome VARCHAR2(30);
8 G_exp_class_code VARCHAR2(2);
9 G_user NUMBER;
10 G_new_org_id NUMBER;
11 G_copy_exp_type_flag VARCHAR2(1);
12 G_copy_qty_flag VARCHAR2(1);
13 G_copy_cmt_flag VARCHAR2(1);
14 G_copy_dff_flag VARCHAR2(1);
15 G_entered_by_person_id NUMBER;
16 G_inc_by_person_id NUMBER;
17
18 PROCEDURE ValidateEmp ( X_ei_date IN DATE
19 , x_job_id IN OUT NOCOPY NUMBER
20 , X_status IN OUT NOCOPY VARCHAR2)
21 IS
22 l_job_id NUMBER;
23 l_status VARCHAR2(1000);
24 BEGIN
25 l_status := x_status; -- store passed in values
26 l_job_id := x_job_id;
27
28 X_status := NULL;
29 org_id := NULL;
30 dummy := NULL;
31
32 org_id := pa_utils.GetEmpOrgId ( G_inc_by_person_id, X_ei_date );
33
34 IF ( org_id IS NULL ) THEN
35 X_status := 'PA_EX_NO_ORG_ASSGN';
36 RETURN;
37 ELSE
38 IF G_new_org_id <> org_id THEN
39 x_status := 'PA_TR_DIFFERENT_ORG';
40 RETURN;
41 END IF;
42 END IF;
43
44 dummy := NULL;
45 dummy := pa_utils.GetEmpJobId ( G_inc_by_person_id, X_ei_date );
46
47 x_job_id := dummy;
48
49 IF ( dummy IS NULL ) THEN
50 X_status := 'PA_EX_NO_ASSGN';
51 RETURN;
52 END IF;
53
54 -- R12 NOCOPY mandate -- copy back passed in values.
55 EXCEPTION WHEN OTHERS THEN
56 x_status := l_status;
57 x_job_id := l_job_id;
58 RAISE;
59 END ValidateEmp;
60
61 PROCEDURE CopyItems ( X_orig_exp_id IN NUMBER
62 , X_new_exp_id IN NUMBER
63 , X_days_diff IN NUMBER
64 , x_total_exp_copied IN OUT NOCOPY NUMBER)
65 IS
66 temp_outcome VARCHAR2(30) DEFAULT NULL;
67 temp_status NUMBER DEFAULT NULL;
68 x_outcome VARCHAR2(30);
69 i BINARY_INTEGER DEFAULT 0;
70 l_dummy NUMBER; -- used to populate the all null number columns
71 l_dummy_date DATE; -- used to populate all the null date columns
72
73
74 CURSOR getEIdenorm IS
75 SELECT
76 x_new_exp_id expenditure_id,
77 pa_ei_denorm_s.nextval denorm_id,
78 G_inc_by_person_id person_id,
79 project_id,
80 task_id,
81 billable_flag,
82 decode(G_copy_exp_type_flag,'Y',expenditure_type,NULL) expenditure_type,
83 decode(G_copy_exp_type_flag,'Y',default_sys_link_func,NULL) default_sys_link_func,
84 decode(G_copy_exp_type_flag,'Y',unit_of_measure_code,NULL) unit_of_measure_code,
85 decode(G_copy_exp_type_flag,'Y',unit_of_measure,NULL) unit_of_measure,
86 l_dummy expenditure_item_id_1,
87 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
88 decode(G_copy_exp_type_flag,'Y',
89 decode(G_copy_qty_flag,'Y',
90 trunc(nvl(expenditure_item_date_1,sysdate) + x_days_diff),
91 l_dummy_date),l_dummy_date),l_dummy_date) expenditure_item_date_1,
92 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
93 decode(G_copy_exp_type_flag,'Y',
94 decode(G_copy_qty_flag,'Y',quantity_1,
95 l_dummy),l_dummy),l_dummy) quantity_1,
96 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
97 decode(G_copy_exp_type_flag,'Y',
98 decode(G_copy_qty_flag,'Y',system_linkage_function_1,
99 NULL),NULL),NULL) system_linkage_function_1,
100 null non_labor_resource_1,
101 l_dummy organization_id_1,
102 l_dummy override_to_organization_id_1,
103 l_dummy raw_cost_1,
104 l_dummy raw_cost_rate_1,
105 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
106 decode(G_copy_exp_type_flag,'Y',
107 decode(G_copy_qty_flag,'Y',
108 decode(G_copy_dff_flag,'Y',attribute_category_1,
109 NULL),NULL),NULL),NULL) attribute_category_1,
110 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
111 decode(G_copy_exp_type_flag,'Y',
112 decode(G_copy_qty_flag,'Y',
113 decode(G_copy_dff_flag,'Y',attribute1_1,
114 NULL),NULL),NULL),NULL) attribute1_1,
115 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
116 decode(G_copy_exp_type_flag,'Y',
117 decode(G_copy_qty_flag,'Y',
118 decode(G_copy_dff_flag,'Y',attribute1_2,
119 NULL),NULL),NULL),NULL) attribute1_2,
120 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
121 decode(G_copy_exp_type_flag,'Y',
122 decode(G_copy_qty_flag,'Y',
123 decode(G_copy_dff_flag,'Y',attribute1_3,
124 NULL),NULL),NULL),NULL) attribute1_3,
125 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
126 decode(G_copy_exp_type_flag,'Y',
127 decode(G_copy_qty_flag,'Y',
128 decode(G_copy_dff_flag,'Y',attribute1_4,
129 NULL),NULL),NULL),NULL) attribute1_4,
130 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
131 decode(G_copy_exp_type_flag,'Y',
132 decode(G_copy_qty_flag,'Y',
133 decode(G_copy_dff_flag,'Y',attribute1_5,
134 NULL),NULL),NULL),NULL) attribute1_5,
135 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
136 decode(G_copy_exp_type_flag,'Y',
137 decode(G_copy_qty_flag,'Y',
138 decode(G_copy_dff_flag,'Y',attribute1_6,
139 NULL),NULL),NULL),NULL) attribute1_6,
140 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
141 decode(G_copy_exp_type_flag,'Y',
142 decode(G_copy_qty_flag,'Y',
143 decode(G_copy_dff_flag,'Y',attribute1_7,
144 NULL),NULL),NULL),NULL) attribute1_7,
145 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
146 decode(G_copy_exp_type_flag,'Y',
147 decode(G_copy_qty_flag,'Y',
148 decode(G_copy_dff_flag,'Y',attribute1_8,
149 NULL),NULL),NULL),NULL) attribute1_8,
150 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
151 decode(G_copy_exp_type_flag,'Y',
152 decode(G_copy_qty_flag,'Y',
153 decode(G_copy_dff_flag,'Y',attribute1_9,
154 NULL),NULL),NULL),NULL) attribute1_9,
155 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
156 decode(G_copy_exp_type_flag,'Y',
157 decode(G_copy_qty_flag,'Y',
158 decode(G_copy_dff_flag,'Y',attribute1_10,
159 NULL),NULL),NULL),NULL) attribute1_10,
160 null orig_transaction_reference_1,
161 l_dummy adjusted_expenditure_item_id_1,
162 net_zero_adjustment_flag_1,
163 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
164 decode(G_copy_exp_type_flag,'Y',
165 decode(G_copy_qty_flag,'Y',
166 decode(G_copy_cmt_flag,'Y',expenditure_comment_1,
167 NULL),NULL),NULL),NULL) expenditure_comment_1,
168 l_dummy expenditure_item_id_2,
169 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
170 decode(G_copy_exp_type_flag,'Y',
171 decode(G_copy_qty_flag,'Y',
172 trunc(nvl(expenditure_item_date_2, sysdate) + x_days_diff),
173 l_dummy_date),l_dummy_date),l_dummy_date) expenditure_item_date_2,
174 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
175 decode(G_copy_exp_type_flag,'Y',
176 decode(G_copy_qty_flag,'Y',quantity_2,
177 l_dummy),l_dummy),l_dummy) quantity_2,
178 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
179 decode(G_copy_exp_type_flag,'Y',
180 decode(G_copy_qty_flag,'Y',system_linkage_function_2,
181 NULL),NULL),NULL) system_linkage_function_2,
182 null non_labor_resource_2,
183 l_dummy organization_id_2,
184 l_dummy override_to_organization_id_2,
185 l_dummy raw_cost_2,
186 l_dummy raw_cost_rate_2,
187 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
188 decode(G_copy_exp_type_flag,'Y',
189 decode(G_copy_qty_flag,'Y',
190 decode(G_copy_dff_flag,'Y',attribute_category_2,
191 NULL),NULL),NULL),NULL) attribute_category_2,
192 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
193 decode(G_copy_exp_type_flag,'Y',
194 decode(G_copy_qty_flag,'Y',
195 decode(G_copy_dff_flag,'Y',attribute2_1,
196 NULL),NULL),NULL),NULL) attribute2_1,
197 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
198 decode(G_copy_exp_type_flag,'Y',
199 decode(G_copy_qty_flag,'Y',
200 decode(G_copy_dff_flag,'Y',attribute2_2,
201 NULL),NULL),NULL),NULL) attribute2_2,
202 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
203 decode(G_copy_exp_type_flag,'Y',
204 decode(G_copy_qty_flag,'Y',
205 decode(G_copy_dff_flag,'Y',attribute2_3,
206 NULL),NULL),NULL),NULL) attribute2_3,
207 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
208 decode(G_copy_exp_type_flag,'Y',
209 decode(G_copy_qty_flag,'Y',
210 decode(G_copy_dff_flag,'Y',attribute2_4,
211 NULL),NULL),NULL),NULL) attribute2_4,
212 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
213 decode(G_copy_exp_type_flag,'Y',
214 decode(G_copy_qty_flag,'Y',
215 decode(G_copy_dff_flag,'Y',attribute2_5,
216 NULL),NULL),NULL),NULL) attribute2_5,
217 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
218 decode(G_copy_exp_type_flag,'Y',
219 decode(G_copy_qty_flag,'Y',
220 decode(G_copy_dff_flag,'Y',attribute2_6,
221 NULL),NULL),NULL),NULL) attribute2_6,
222 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
223 decode(G_copy_exp_type_flag,'Y',
224 decode(G_copy_qty_flag,'Y',
225 decode(G_copy_dff_flag,'Y',attribute2_7,
226 NULL),NULL),NULL),NULL) attribute2_7,
227 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
228 decode(G_copy_exp_type_flag,'Y',
229 decode(G_copy_qty_flag,'Y',
230 decode(G_copy_dff_flag,'Y',attribute2_8,
231 NULL),NULL),NULL),NULL) attribute2_8,
232 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
233 decode(G_copy_exp_type_flag,'Y',
234 decode(G_copy_qty_flag,'Y',
235 decode(G_copy_dff_flag,'Y',attribute2_9,
236 NULL),NULL),NULL),NULL) attribute2_9,
237 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
238 decode(G_copy_exp_type_flag,'Y',
239 decode(G_copy_qty_flag,'Y',
240 decode(G_copy_dff_flag,'Y',attribute2_10,
241 NULL),NULL),NULL),NULL) attribute2_10,
242 null orig_transaction_reference_2,
243 l_dummy adjusted_expenditure_item_id_2,
244 net_zero_adjustment_flag_2,
245 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
246 decode(G_copy_exp_type_flag,'Y',
247 decode(G_copy_qty_flag,'Y',
248 decode(G_copy_cmt_flag,'Y',expenditure_comment_2,
249 NULL),NULL),NULL),NULL) expenditure_comment_2,
250 l_dummy expenditure_item_id_3,
251 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
252 decode(G_copy_exp_type_flag,'Y',
253 decode(G_copy_qty_flag,'Y',
254 trunc(nvl(expenditure_item_date_3,sysdate) + x_days_diff),
255 l_dummy_date),l_dummy_date),l_dummy_date) expenditure_item_date_3,
256 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
257 decode(G_copy_exp_type_flag,'Y',
258 decode(G_copy_qty_flag,'Y',quantity_3,
259 l_dummy),l_dummy),l_dummy) quantity_3,
260 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
261 decode(G_copy_exp_type_flag,'Y',
262 decode(G_copy_qty_flag,'Y', system_linkage_function_3,
263 NULL),NULL),NULL) system_linkage_function_3,
264 non_labor_resource_3,
265 l_dummy organization_id_3,
266 l_dummy override_to_organization_id_3,
267 l_dummy raw_cost_3,
268 l_dummy raw_cost_rate_3,
269 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
270 decode(G_copy_exp_type_flag,'Y',
271 decode(G_copy_qty_flag,'Y',
272 decode(G_copy_dff_flag,'Y',attribute_category_3,
273 NULL),NULL),NULL),NULL) attribute_category_3,
274 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
275 decode(G_copy_exp_type_flag,'Y',
276 decode(G_copy_qty_flag,'Y',
277 decode(G_copy_dff_flag,'Y',attribute3_1,
278 NULL),NULL),NULL),NULL) attribute3_1,
279 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
280 decode(G_copy_exp_type_flag,'Y',
281 decode(G_copy_qty_flag,'Y',
282 decode(G_copy_dff_flag,'Y',attribute3_2,
283 NULL),NULL),NULL),NULL) attribute3_2,
284 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
285 decode(G_copy_exp_type_flag,'Y',
286 decode(G_copy_qty_flag,'Y',
287 decode(G_copy_dff_flag,'Y',attribute3_3,
288 NULL),NULL),NULL),NULL) attribute3_3,
289 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
290 decode(G_copy_exp_type_flag,'Y',
291 decode(G_copy_qty_flag,'Y',
292 decode(G_copy_dff_flag,'Y',attribute3_4,
293 NULL),NULL),NULL),NULL) attribute3_4,
294 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
295 decode(G_copy_exp_type_flag,'Y',
296 decode(G_copy_qty_flag,'Y',
297 decode(G_copy_dff_flag,'Y',attribute3_5,
298 NULL),NULL),NULL),NULL) attribute3_5,
299 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
300 decode(G_copy_exp_type_flag,'Y',
301 decode(G_copy_qty_flag,'Y',
302 decode(G_copy_dff_flag,'Y',attribute3_6,
303 NULL),NULL),NULL),NULL) attribute3_6,
304 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
305 decode(G_copy_exp_type_flag,'Y',
306 decode(G_copy_qty_flag,'Y',
307 decode(G_copy_dff_flag,'Y',attribute3_7,
308 NULL),NULL),NULL),NULL) attribute3_7,
309 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
310 decode(G_copy_exp_type_flag,'Y',
311 decode(G_copy_qty_flag,'Y',
312 decode(G_copy_dff_flag,'Y',attribute3_8,
313 NULL),NULL),NULL),NULL) attribute3_8,
314 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
315 decode(G_copy_exp_type_flag,'Y',
316 decode(G_copy_qty_flag,'Y',
317 decode(G_copy_dff_flag,'Y',attribute3_9,
318 NULL),NULL),NULL),NULL) attribute3_9,
319 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
320 decode(G_copy_exp_type_flag,'Y',
321 decode(G_copy_qty_flag,'Y',
322 decode(G_copy_dff_flag,'Y',attribute3_10,
323 NULL),NULL),NULL),NULL) attribute3_10,
324 null orig_transaction_reference_3,
325 l_dummy adjusted_expenditure_item_id_3,
326 net_zero_adjustment_flag_3,
327 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
328 decode(G_copy_exp_type_flag,'Y',
329 decode(G_copy_qty_flag,'Y',
330 decode(G_copy_cmt_flag,'Y',expenditure_comment_3,
331 NULL),NULL),NULL),NULL) expenditure_comment_3,
332 l_dummy expenditure_item_id_4,
333 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
334 decode(G_copy_exp_type_flag,'Y',
335 decode(G_copy_qty_flag,'Y',
336 trunc(nvl(expenditure_item_date_4,sysdate) + x_days_diff),
337 l_dummy_date),l_dummy_date),l_dummy_date) expenditure_item_date_4,
338 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
339 decode(G_copy_exp_type_flag,'Y',
340 decode(G_copy_qty_flag,'Y',quantity_4,
341 l_dummy),l_dummy),l_dummy) quantity_4,
342 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
343 decode(G_copy_exp_type_flag,'Y',
344 decode(G_copy_qty_flag,'Y',system_linkage_function_4,
345 NULL),NULL),NULL) system_linkage_function_4,
346 null non_labor_resource_4,
347 l_dummy organization_id_4,
348 l_dummy override_to_organization_id_4,
349 l_dummy raw_cost_4,
350 l_dummy raw_cost_rate_4,
351 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
352 decode(G_copy_exp_type_flag,'Y',
353 decode(G_copy_qty_flag,'Y',
354 decode(G_copy_dff_flag,'Y',attribute_category_4,
355 NULL),NULL),NULL),NULL) attribute_category_4,
356 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
357 decode(G_copy_exp_type_flag,'Y',
358 decode(G_copy_qty_flag,'Y',
359 decode(G_copy_dff_flag,'Y',attribute4_1,
360 NULL),NULL),NULL),NULL) attribute4_1,
361 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
362 decode(G_copy_exp_type_flag,'Y',
363 decode(G_copy_qty_flag,'Y',
364 decode(G_copy_dff_flag,'Y',attribute4_2,
365 NULL),NULL),NULL),NULL) attribute4_2,
366 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
367 decode(G_copy_exp_type_flag,'Y',
368 decode(G_copy_qty_flag,'Y',
369 decode(G_copy_dff_flag,'Y',attribute4_3,
370 NULL),NULL),NULL),NULL) attribute4_3,
371 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
372 decode(G_copy_exp_type_flag,'Y',
373 decode(G_copy_qty_flag,'Y',
374 decode(G_copy_dff_flag,'Y',attribute4_4,
375 NULL),NULL),NULL),NULL) attribute4_4,
376 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
377 decode(G_copy_exp_type_flag,'Y',
378 decode(G_copy_qty_flag,'Y',
379 decode(G_copy_dff_flag,'Y',attribute4_5,
380 NULL),NULL),NULL),NULL) attribute4_5,
381 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
382 decode(G_copy_exp_type_flag,'Y',
383 decode(G_copy_qty_flag,'Y',
384 decode(G_copy_dff_flag,'Y',attribute4_6,
385 NULL),NULL),NULL),NULL) attribute4_6,
386 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
387 decode(G_copy_exp_type_flag,'Y',
388 decode(G_copy_qty_flag,'Y',
389 decode(G_copy_dff_flag,'Y',attribute4_7,
390 NULL),NULL),NULL),NULL) attribute4_7,
391 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
392 decode(G_copy_exp_type_flag,'Y',
393 decode(G_copy_qty_flag,'Y',
394 decode(G_copy_dff_flag,'Y',attribute4_8,
395 NULL),NULL),NULL),NULL) attribute4_8,
396 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
397 decode(G_copy_exp_type_flag,'Y',
398 decode(G_copy_qty_flag,'Y',
399 decode(G_copy_dff_flag,'Y',attribute4_9,
400 NULL),NULL),NULL),NULL) attribute4_9,
401 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
402 decode(G_copy_exp_type_flag,'Y',
403 decode(G_copy_qty_flag,'Y',
404 decode(G_copy_dff_flag,'Y',attribute4_10,
405 NULL),NULL),NULL),NULL) attribute4_10,
406 null orig_transaction_reference_4,
407 l_dummy adjusted_expenditure_item_id_4,
408 null net_zero_adjustment_flag_4,
409 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
410 decode(G_copy_exp_type_flag,'Y',
411 decode(G_copy_qty_flag,'Y',
412 decode(G_copy_cmt_flag,'Y',expenditure_comment_4,
413 NULL),NULL),NULL),NULL) expenditure_comment_4,
414 l_dummy expenditure_item_id_5,
415 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
416 decode(G_copy_exp_type_flag,'Y',
417 decode(G_copy_qty_flag,'Y',
418 trunc(nvl(expenditure_item_date_5,sysdate) + x_days_diff),
419 l_dummy_date),l_dummy_date),l_dummy_date) expenditure_item_date_5,
420 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
421 decode(G_copy_exp_type_flag,'Y',
422 decode(G_copy_qty_flag,'Y',quantity_5,
423 l_dummy),l_dummy),l_dummy) quantity_5,
424 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
425 decode(G_copy_exp_type_flag,'Y',
426 decode(G_copy_qty_flag,'Y',system_linkage_function_5,
427 NULL),NULL),NULL) system_linkage_function_5,
428 null non_labor_resource_5,
429 l_dummy organization_id_5,
430 l_dummy override_to_organization_id_5,
431 l_dummy raw_cost_5,
432 l_dummy raw_cost_rate_5,
433 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
434 decode(G_copy_exp_type_flag,'Y',
435 decode(G_copy_qty_flag,'Y',
436 decode(G_copy_dff_flag,'Y',attribute_category_5,
437 NULL),NULL),NULL),NULL) attribute_category_5,
438 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
439 decode(G_copy_exp_type_flag,'Y',
440 decode(G_copy_qty_flag,'Y',
441 decode(G_copy_dff_flag,'Y',attribute5_1,
442 NULL),NULL),NULL),NULL) attribute5_1,
443 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
444 decode(G_copy_exp_type_flag,'Y',
445 decode(G_copy_qty_flag,'Y',
446 decode(G_copy_dff_flag,'Y',attribute5_2,
447 NULL),NULL),NULL),NULL) attribute5_2,
448 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
449 decode(G_copy_exp_type_flag,'Y',
450 decode(G_copy_qty_flag,'Y',
451 decode(G_copy_dff_flag,'Y',attribute5_3,
452 NULL),NULL),NULL),NULL) attribute5_3,
453 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
454 decode(G_copy_exp_type_flag,'Y',
455 decode(G_copy_qty_flag,'Y',
456 decode(G_copy_dff_flag,'Y',attribute5_4,
457 NULL),NULL),NULL),NULL) attribute5_4,
458 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
459 decode(G_copy_exp_type_flag,'Y',
460 decode(G_copy_qty_flag,'Y',
461 decode(G_copy_dff_flag,'Y',attribute5_5,
462 NULL),NULL),NULL),NULL) attribute5_5,
463 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
464 decode(G_copy_exp_type_flag,'Y',
465 decode(G_copy_qty_flag,'Y',
466 decode(G_copy_dff_flag,'Y',attribute5_6,
467 NULL),NULL),NULL),NULL) attribute5_6,
468 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
469 decode(G_copy_exp_type_flag,'Y',
470 decode(G_copy_qty_flag,'Y',
471 decode(G_copy_dff_flag,'Y',attribute5_7,
472 NULL),NULL),NULL),NULL) attribute5_7,
473 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
474 decode(G_copy_exp_type_flag,'Y',
475 decode(G_copy_qty_flag,'Y',
476 decode(G_copy_dff_flag,'Y',attribute5_8,
477 NULL),NULL),NULL),NULL) attribute5_8,
478 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
479 decode(G_copy_exp_type_flag,'Y',
480 decode(G_copy_qty_flag,'Y',
481 decode(G_copy_dff_flag,'Y',attribute5_9,
482 NULL),NULL),NULL),NULL) attribute5_9,
483 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
484 decode(G_copy_exp_type_flag,'Y',
485 decode(G_copy_qty_flag,'Y',
486 decode(G_copy_dff_flag,'Y',attribute5_10,
487 NULL),NULL),NULL),NULL) attribute5_10,
488 null orig_transaction_reference_5,
489 l_dummy adjusted_expenditure_item_id_5,
490 net_zero_adjustment_flag_5,
491 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
492 decode(G_copy_exp_type_flag,'Y',
493 decode(G_copy_qty_flag,'Y',
494 decode(G_copy_cmt_flag,'Y',expenditure_comment_5,
495 NULL),NULL),NULL),NULL) expenditure_comment_5,
496 l_dummy expenditure_item_id_6,
497 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
498 decode(G_copy_exp_type_flag,'Y',
499 decode(G_copy_qty_flag,'Y',
500 trunc(nvl(expenditure_item_date_6,sysdate) + x_days_diff),
501 l_dummy_date),l_dummy_date),l_dummy_date) expenditure_item_date_6,
502 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
503 decode(G_copy_exp_type_flag,'Y',
504 decode(G_copy_qty_flag,'Y',quantity_6,
505 l_dummy),l_dummy),l_dummy) quantity_6,
506 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
507 decode(G_copy_exp_type_flag,'Y',
508 decode(G_copy_qty_flag,'Y',system_linkage_function_6,
509 NULL),NULL),NULL) system_linkage_function_6,
510 null non_labor_resource_6,
511 l_dummy organization_id_6,
512 l_dummy override_to_organization_id_6,
513 l_dummy raw_cost_6,
514 l_dummy raw_cost_rate_6,
515 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
516 decode(G_copy_exp_type_flag,'Y',
517 decode(G_copy_qty_flag,'Y',
518 decode(G_copy_dff_flag,'Y',attribute_category_6,
519 NULL),NULL),NULL),NULL) attribute_category_6,
520 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
521 decode(G_copy_exp_type_flag,'Y',
522 decode(G_copy_qty_flag,'Y',
523 decode(G_copy_dff_flag,'Y',attribute6_1,
524 NULL),NULL),NULL),NULL) attribute6_1,
525 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
526 decode(G_copy_exp_type_flag,'Y',
527 decode(G_copy_qty_flag,'Y',
528 decode(G_copy_dff_flag,'Y',attribute6_2,
529 NULL),NULL),NULL),NULL) attribute6_2,
530 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
531 decode(G_copy_exp_type_flag,'Y',
532 decode(G_copy_qty_flag,'Y',
533 decode(G_copy_dff_flag,'Y',attribute6_3,
534 NULL),NULL),NULL),NULL) attribute6_3,
535 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
536 decode(G_copy_exp_type_flag,'Y',
537 decode(G_copy_qty_flag,'Y',
538 decode(G_copy_dff_flag,'Y',attribute6_4,
539 NULL),NULL),NULL),NULL) attribute6_4,
540 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
541 decode(G_copy_exp_type_flag,'Y',
542 decode(G_copy_qty_flag,'Y',
543 decode(G_copy_dff_flag,'Y',attribute6_5,
544 NULL),NULL),NULL),NULL) attribute6_5,
545 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
546 decode(G_copy_exp_type_flag,'Y',
547 decode(G_copy_qty_flag,'Y',
548 decode(G_copy_dff_flag,'Y',attribute6_6,
549 NULL),NULL),NULL),NULL) attribute6_6,
550 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
551 decode(G_copy_exp_type_flag,'Y',
552 decode(G_copy_qty_flag,'Y',
553 decode(G_copy_dff_flag,'Y',attribute6_7,
554 NULL),NULL),NULL),NULL) attribute6_7,
555 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
556 decode(G_copy_exp_type_flag,'Y',
557 decode(G_copy_qty_flag,'Y',
558 decode(G_copy_dff_flag,'Y',attribute6_8,
559 NULL),NULL),NULL),NULL) attribute6_8,
560 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
561 decode(G_copy_exp_type_flag,'Y',
562 decode(G_copy_qty_flag,'Y',
563 decode(G_copy_dff_flag,'Y',attribute6_9,
564 NULL),NULL),NULL),NULL) attribute6_9,
565 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
566 decode(G_copy_exp_type_flag,'Y',
567 decode(G_copy_qty_flag,'Y',
568 decode(G_copy_dff_flag,'Y',attribute6_10,
569 NULL),NULL),NULL),NULL) attribute6_10,
570 null orig_transaction_reference_6,
571 l_dummy adjusted_expenditure_item_id_6,
572 net_zero_adjustment_flag_6,
573 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
574 decode(G_copy_exp_type_flag,'Y',
575 decode(G_copy_qty_flag,'Y',
576 decode(G_copy_cmt_flag,'Y',expenditure_comment_6,
577 NULL),NULL),NULL),NULL) expenditure_comment_6,
578 l_dummy expenditure_item_id_7,
579 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
580 decode(G_copy_exp_type_flag,'Y',
581 decode(G_copy_qty_flag,'Y',
582 trunc(nvl(expenditure_item_date_7,sysdate) + x_days_diff),
583 l_dummy_date),l_dummy_date),l_dummy_date) expenditure_item_date_7,
584 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
585 decode(G_copy_exp_type_flag,'Y',
586 decode(G_copy_qty_flag,'Y',quantity_7,
587 l_dummy),l_dummy),l_dummy) quantity_7,
588 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
589 decode(G_copy_exp_type_flag,'Y',
590 decode(G_copy_qty_flag,'Y',system_linkage_function_7,
591 NULL),NULL),NULL) system_linkage_function_7,
592 null non_labor_resource_7,
593 l_dummy organization_id_7,
594 l_dummy override_to_organization_id_7,
595 l_dummy raw_cost_7,
596 l_dummy raw_cost_rate_7,
597 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
598 decode(G_copy_exp_type_flag,'Y',
599 decode(G_copy_qty_flag,'Y',
600 decode(G_copy_dff_flag,'Y',attribute_category_7,
601 NULL),NULL),NULL),NULL) attribute_category_7,
602 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
603 decode(G_copy_exp_type_flag,'Y',
604 decode(G_copy_qty_flag,'Y',
605 decode(G_copy_dff_flag,'Y',attribute7_1,
606 NULL),NULL),NULL),NULL) attribute7_1,
607 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
608 decode(G_copy_exp_type_flag,'Y',
609 decode(G_copy_qty_flag,'Y',
610 decode(G_copy_dff_flag,'Y',attribute7_2,
611 NULL),NULL),NULL),NULL) attribute7_2,
612 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
613 decode(G_copy_exp_type_flag,'Y',
614 decode(G_copy_qty_flag,'Y',
615 decode(G_copy_dff_flag,'Y',attribute7_3,
616 NULL),NULL),NULL),NULL) attribute7_3,
617 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
618 decode(G_copy_exp_type_flag,'Y',
619 decode(G_copy_qty_flag,'Y',
620 decode(G_copy_dff_flag,'Y',attribute7_4,
621 NULL),NULL),NULL),NULL) attribute7_4,
622 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
623 decode(G_copy_exp_type_flag,'Y',
624 decode(G_copy_qty_flag,'Y',
625 decode(G_copy_dff_flag,'Y',attribute7_5,
626 NULL),NULL),NULL),NULL) attribute7_5,
627 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
628 decode(G_copy_exp_type_flag,'Y',
629 decode(G_copy_qty_flag,'Y',
630 decode(G_copy_dff_flag,'Y',attribute7_6,
631 NULL),NULL),NULL),NULL) attribute7_6,
632 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
633 decode(G_copy_exp_type_flag,'Y',
634 decode(G_copy_qty_flag,'Y',
635 decode(G_copy_dff_flag,'Y',attribute7_7,
636 NULL),NULL),NULL),NULL) attribute7_7,
637 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
638 decode(G_copy_exp_type_flag,'Y',
639 decode(G_copy_qty_flag,'Y',
640 decode(G_copy_dff_flag,'Y',attribute7_8,
641 NULL),NULL),NULL),NULL) attribute7_8,
642 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
643 decode(G_copy_exp_type_flag,'Y',
644 decode(G_copy_qty_flag,'Y',
645 decode(G_copy_dff_flag,'Y',attribute7_9,
646 NULL),NULL),NULL),NULL) attribute7_9,
647 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
648 decode(G_copy_exp_type_flag,'Y',
649 decode(G_copy_qty_flag,'Y',
650 decode(G_copy_dff_flag,'Y',attribute7_10,
651 NULL),NULL),NULL),NULL) attribute7_10,
652 null orig_transaction_reference_7,
653 l_dummy adjusted_expenditure_item_id_7,
654 net_zero_adjustment_flag_7,
655 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
656 decode(G_copy_exp_type_flag,'Y',
657 decode(G_copy_qty_flag,'Y',
658 decode(G_copy_cmt_flag,'Y',expenditure_comment_7,
659 NULL),NULL),NULL),NULL) expenditure_comment_7,
660 0 denorm_total_qty,
661 0 denorm_total_amount,
662 G_user created_by,
663 trunc(sysdate) creation_date,
664 trunc(sysdate) last_update_date,
665 G_user last_updated_by,
666 FND_PROFILE.VALUE('LOGIN_ID') last_update_login,
667 decode(nvl(net_zero_adjustment_flag_1,'N'),'N',
668 decode(G_copy_exp_type_flag,'Y',
669 decode(G_copy_qty_flag,'Y',job_id_1,
670 l_dummy),l_dummy),l_dummy) job_id_1,
671 decode(nvl(net_zero_adjustment_flag_2,'N'),'N',
672 decode(G_copy_exp_type_flag,'Y',
673 decode(G_copy_qty_flag,'Y',job_id_2,
674 l_dummy),l_dummy),l_dummy) job_id_2,
675 decode(nvl(net_zero_adjustment_flag_3,'N'),'N',
676 decode(G_copy_exp_type_flag,'Y',
677 decode(G_copy_qty_flag,'Y',job_id_3,
678 l_dummy),l_dummy),l_dummy) job_id_3,
679 decode(nvl(net_zero_adjustment_flag_4,'N'),'N',
680 decode(G_copy_exp_type_flag,'Y',
681 decode(G_copy_qty_flag,'Y',job_id_4,
682 l_dummy),l_dummy),l_dummy) job_id_4,
683 decode(nvl(net_zero_adjustment_flag_5,'N'),'N',
684 decode(G_copy_exp_type_flag,'Y',
685 decode(G_copy_qty_flag,'Y',job_id_5,
686 l_dummy),l_dummy),l_dummy) job_id_5,
687 decode(nvl(net_zero_adjustment_flag_6,'N'),'N',
688 decode(G_copy_exp_type_flag,'Y',
689 decode(G_copy_qty_flag,'Y',job_id_6,
690 l_dummy),l_dummy),l_dummy) job_id_6,
691 decode(nvl(net_zero_adjustment_flag_7,'N'),'N',
692 decode(G_copy_exp_type_flag,'Y',
693 decode(G_copy_qty_flag,'Y',job_id_7,
694 l_dummy),l_dummy),l_dummy) job_id_7
695 FROM
696 pa_ei_denorm
697 WHERE expenditure_id = x_orig_exp_id;
698
699 ei_denorm getEIdenorm%ROWTYPE;
700
701 BEGIN
702 OPEN getEIdenorm;
703 x_total_exp_copied := 0;
704 LOOP
705
706 FETCH getEIdenorm INTO ei_denorm;
707 EXIT WHEN getEIdenorm%NOTFOUND;
708
709 IF ei_denorm.quantity_1 IS NOT NULL THEN
710 PA_ONLINE_COPY_EXP.validate_item(ei_denorm.project_id,
711 ei_denorm.task_id,
712 ei_denorm.expenditure_item_date_1,
713 ei_denorm.expenditure_type,
714 ei_denorm.system_linkage_function_1,
715 ei_denorm.quantity_1,
716 ei_denorm.attribute_category_1,
717 ei_denorm.attribute1_1,
718 ei_denorm.attribute1_2,
719 ei_denorm.attribute1_3,
720 ei_denorm.attribute1_4,
721 ei_denorm.attribute1_5,
722 ei_denorm.attribute1_6,
723 ei_denorm.attribute1_7,
724 ei_denorm.attribute1_8,
725 ei_denorm.attribute1_9,
726 ei_denorm.attribute1_10,
727 ei_denorm.billable_flag,
728 ei_denorm.job_id_1,
729 x_outcome);
730 IF x_outcome IS NOT NULL THEN
731 ei_denorm.quantity_1 := NULL;
732 ei_denorm.expenditure_item_date_1 := NULL;
733 ei_denorm.system_linkage_function_1 := NULL;
734 ei_denorm.attribute_category_1 := NULL;
735 ei_denorm.attribute1_1 := NULL;
736 ei_denorm.attribute1_2 := NULL;
737 ei_denorm.attribute1_3 := NULL;
738 ei_denorm.attribute1_4 := NULL;
739 ei_denorm.attribute1_5 := NULL;
740 ei_denorm.attribute1_6 := NULL;
741 ei_denorm.attribute1_7 := NULL;
742 ei_denorm.attribute1_8 := NULL;
743 ei_denorm.attribute1_9 := NULL;
744 ei_denorm.attribute1_10 := NULL;
745 ei_denorm.expenditure_comment_1 := NULL;
746 ei_denorm.job_id_1 := NULL;
747 ELSE
748 IF ( G_exp_class_code = 'OE' ) THEN
749 ei_denorm.raw_cost_rate_1 := pa_utils.GetExpTypeCostRate( ei_denorm.expenditure_type
750 , ei_denorm.expenditure_item_date_1 );
751 ei_denorm.raw_cost_1 := PA_CURRENCY.ROUND_CURRENCY_AMT(
752 ( ei_denorm.quantity_1 * ei_denorm.raw_cost_rate_1 ) );
753 ELSE
754 ei_denorm.raw_cost_rate_1 := null;
755 ei_denorm.raw_cost_1 := null;
756 END IF;
757 END IF;
758
759 ELSE
760 ei_denorm.quantity_1 := NULL;
761 ei_denorm.expenditure_item_date_1 := NULL;
762 ei_denorm.system_linkage_function_1 := NULL;
763 ei_denorm.attribute_category_1 := NULL;
764 ei_denorm.attribute1_1 := NULL;
765 ei_denorm.attribute1_2 := NULL;
766 ei_denorm.attribute1_3 := NULL;
767 ei_denorm.attribute1_4 := NULL;
768 ei_denorm.attribute1_5 := NULL;
769 ei_denorm.attribute1_6 := NULL;
770 ei_denorm.attribute1_7 := NULL;
771 ei_denorm.attribute1_8 := NULL;
772 ei_denorm.attribute1_9 := NULL;
773 ei_denorm.attribute1_10 := NULL;
774 ei_denorm.expenditure_comment_1 := NULL;
775 ei_denorm.job_id_1 := NULL;
776
777 END IF;
778
779 IF ei_denorm.quantity_2 IS NOT NULL THEN
780 PA_ONLINE_COPY_EXP.validate_item(ei_denorm.project_id,
781 ei_denorm.task_id,
782 ei_denorm.expenditure_item_date_2,
783 ei_denorm.expenditure_type,
784 ei_denorm.system_linkage_function_2,
785 ei_denorm.quantity_2,
786 ei_denorm.attribute_category_2,
787 ei_denorm.attribute2_1,
788 ei_denorm.attribute2_2,
789 ei_denorm.attribute2_3,
790 ei_denorm.attribute2_4,
791 ei_denorm.attribute2_5,
792 ei_denorm.attribute2_6,
793 ei_denorm.attribute2_7,
794 ei_denorm.attribute2_8,
795 ei_denorm.attribute2_9,
796 ei_denorm.attribute2_10,
797 ei_denorm.billable_flag,
798 ei_denorm.job_id_2,
799 x_outcome);
800
801 IF x_outcome IS NOT NULL THEN
802 ei_denorm.quantity_2 := NULL;
803 ei_denorm.expenditure_item_date_2 := NULL;
804 ei_denorm.system_linkage_function_2 := NULL;
805 ei_denorm.attribute_category_2 := NULL;
806 ei_denorm.attribute2_1 := NULL;
807 ei_denorm.attribute2_2 := NULL;
808 ei_denorm.attribute2_3 := NULL;
809 ei_denorm.attribute2_4 := NULL;
810 ei_denorm.attribute2_5 := NULL;
811 ei_denorm.attribute2_6 := NULL;
812 ei_denorm.attribute2_7 := NULL;
813 ei_denorm.attribute2_8 := NULL;
814 ei_denorm.attribute2_9 := NULL;
815 ei_denorm.attribute2_10 := NULL;
816 ei_denorm.expenditure_comment_2 := NULL;
817 ei_denorm.job_id_2 := NULL;
818 ELSE
819 IF ( G_exp_class_code = 'OE' ) THEN
820 ei_denorm.raw_cost_rate_2 := pa_utils.GetExpTypeCostRate( ei_denorm.expenditure_type
821 , ei_denorm.expenditure_item_date_2 );
822 ei_denorm.raw_cost_2 := PA_CURRENCY.ROUND_CURRENCY_AMT(
823 ( ei_denorm.quantity_2 * ei_denorm.raw_cost_rate_2 ) );
824 ELSE
825 ei_denorm.raw_cost_rate_2 := null;
826 ei_denorm.raw_cost_2 := null;
827 END IF;
828 END IF;
829 ELSE
830 ei_denorm.quantity_2 := NULL;
831 ei_denorm.expenditure_item_date_2 := NULL;
832 ei_denorm.system_linkage_function_2 := NULL;
833 ei_denorm.attribute_category_2 := NULL;
834 ei_denorm.attribute2_1 := NULL;
835 ei_denorm.attribute2_2 := NULL;
836 ei_denorm.attribute2_3 := NULL;
837 ei_denorm.attribute2_4 := NULL;
838 ei_denorm.attribute2_5 := NULL;
839 ei_denorm.attribute2_6 := NULL;
840 ei_denorm.attribute2_7 := NULL;
841 ei_denorm.attribute2_8 := NULL;
842 ei_denorm.attribute2_9 := NULL;
843 ei_denorm.attribute2_10 := NULL;
844 ei_denorm.expenditure_comment_2 := NULL;
845 ei_denorm.job_id_2 := NULL;
846 END IF;
847
848 IF ei_denorm.quantity_3 IS NOT NULL THEN
849 PA_ONLINE_COPY_EXP.validate_item(ei_denorm.project_id,
850 ei_denorm.task_id,
851 ei_denorm.expenditure_item_date_3,
852 ei_denorm.expenditure_type,
853 ei_denorm.system_linkage_function_3,
854 ei_denorm.quantity_3,
855 ei_denorm.attribute_category_3,
856 ei_denorm.attribute3_1,
857 ei_denorm.attribute3_2,
858 ei_denorm.attribute3_3,
859 ei_denorm.attribute3_4,
860 ei_denorm.attribute3_5,
861 ei_denorm.attribute3_6,
862 ei_denorm.attribute3_7,
863 ei_denorm.attribute3_8,
864 ei_denorm.attribute3_9,
865 ei_denorm.attribute3_10,
866 ei_denorm.billable_flag,
867 ei_denorm.job_id_3,
868 x_outcome);
869
870 IF x_outcome IS NOT NULL THEN
871 ei_denorm.quantity_3 := NULL;
872 ei_denorm.expenditure_item_date_3 := NULL;
873 ei_denorm.system_linkage_function_3 := NULL;
874 ei_denorm.attribute_category_3 := NULL;
875 ei_denorm.attribute3_1 := NULL;
876 ei_denorm.attribute3_2 := NULL;
877 ei_denorm.attribute3_3 := NULL;
878 ei_denorm.attribute3_4 := NULL;
879 ei_denorm.attribute3_5 := NULL;
880 ei_denorm.attribute3_6 := NULL;
881 ei_denorm.attribute3_7 := NULL;
882 ei_denorm.attribute3_8 := NULL;
883 ei_denorm.attribute3_9 := NULL;
884 ei_denorm.attribute3_10 := NULL;
885 ei_denorm.expenditure_comment_3 := NULL;
886 ei_denorm.job_id_3 := NULL;
887 ELSE
888 IF ( G_exp_class_code = 'OE' ) THEN
889 ei_denorm.raw_cost_rate_3 := pa_utils.GetExpTypeCostRate( ei_denorm.expenditure_type
890 , ei_denorm.expenditure_item_date_3 );
891 ei_denorm.raw_cost_3 := PA_CURRENCY.ROUND_CURRENCY_AMT(
892 ( ei_denorm.quantity_3 * ei_denorm.raw_cost_rate_3 ) );
893 ELSE
894 ei_denorm.raw_cost_rate_3 := null;
895 ei_denorm.raw_cost_3 := null;
896 END IF;
897 END IF;
898 ELSE
899 ei_denorm.quantity_3 := NULL;
900 ei_denorm.expenditure_item_date_3 := NULL;
901 ei_denorm.system_linkage_function_3 := NULL;
902 ei_denorm.attribute_category_3 := NULL;
903 ei_denorm.attribute3_1 := NULL;
904 ei_denorm.attribute3_2 := NULL;
905 ei_denorm.attribute3_3 := NULL;
906 ei_denorm.attribute3_4 := NULL;
907 ei_denorm.attribute3_5 := NULL;
908 ei_denorm.attribute3_6 := NULL;
909 ei_denorm.attribute3_7 := NULL;
910 ei_denorm.attribute3_8 := NULL;
911 ei_denorm.attribute3_9 := NULL;
912 ei_denorm.attribute3_10 := NULL;
913 ei_denorm.expenditure_comment_3 := NULL;
914 ei_denorm.job_id_3 := NULL;
915 END IF;
916
917 IF ei_denorm.quantity_4 IS NOT NULL THEN
918
919 PA_ONLINE_COPY_EXP.validate_item(ei_denorm.project_id,
920 ei_denorm.task_id,
921 ei_denorm.expenditure_item_date_4,
922 ei_denorm.expenditure_type,
923 ei_denorm.system_linkage_function_4,
924 ei_denorm.quantity_4,
925 ei_denorm.attribute_category_4,
926 ei_denorm.attribute4_1,
927 ei_denorm.attribute4_2,
928 ei_denorm.attribute4_3,
929 ei_denorm.attribute4_4,
930 ei_denorm.attribute4_5,
931 ei_denorm.attribute4_6,
932 ei_denorm.attribute4_7,
933 ei_denorm.attribute4_8,
934 ei_denorm.attribute4_9,
935 ei_denorm.attribute4_10,
936 ei_denorm.billable_flag,
937 ei_denorm.job_id_4,
938 x_outcome);
939
940 IF x_outcome IS NOT NULL THEN
941 ei_denorm.quantity_4 := NULL;
942 ei_denorm.expenditure_item_date_4 := NULL;
943 ei_denorm.system_linkage_function_4 := NULL;
944 ei_denorm.attribute_category_4 := NULL;
945 ei_denorm.attribute4_1 := NULL;
946 ei_denorm.attribute4_2 := NULL;
947 ei_denorm.attribute4_3 := NULL;
948 ei_denorm.attribute4_4 := NULL;
949 ei_denorm.attribute4_5 := NULL;
950 ei_denorm.attribute4_6 := NULL;
951 ei_denorm.attribute4_7 := NULL;
952 ei_denorm.attribute4_8 := NULL;
953 ei_denorm.attribute4_9 := NULL;
954 ei_denorm.attribute4_10 := NULL;
955 ei_denorm.expenditure_comment_4 := NULL;
956 ei_denorm.job_id_4 := NULL;
957 ELSE
958 IF ( G_exp_class_code = 'OE' ) THEN
959 ei_denorm.raw_cost_rate_4 := pa_utils.GetExpTypeCostRate( ei_denorm.expenditure_type
960 , ei_denorm.expenditure_item_date_4 );
961 ei_denorm.raw_cost_4 := PA_CURRENCY.ROUND_CURRENCY_AMT(
962 ( ei_denorm.quantity_4 * ei_denorm.raw_cost_rate_4 ) );
963 ELSE
964 ei_denorm.raw_cost_rate_4 := null;
965 ei_denorm.raw_cost_4 := null;
966 END IF;
967 END IF;
968 ELSE
969 ei_denorm.quantity_4 := NULL;
970 ei_denorm.expenditure_item_date_4 := NULL;
971 ei_denorm.system_linkage_function_4 := NULL;
972 ei_denorm.attribute_category_4 := NULL;
973 ei_denorm.attribute4_1 := NULL;
974 ei_denorm.attribute4_2 := NULL;
975 ei_denorm.attribute4_3 := NULL;
976 ei_denorm.attribute4_4 := NULL;
977 ei_denorm.attribute4_5 := NULL;
978 ei_denorm.attribute4_6 := NULL;
979 ei_denorm.attribute4_7 := NULL;
980 ei_denorm.attribute4_8 := NULL;
981 ei_denorm.attribute4_9 := NULL;
982 ei_denorm.attribute4_10 := NULL;
983 ei_denorm.expenditure_comment_4 := NULL;
984 ei_denorm.job_id_4 := NULL;
985 END IF;
986
987 IF ei_denorm.quantity_5 IS NOT NULL THEN
988
989 PA_ONLINE_COPY_EXP.validate_item(ei_denorm.project_id,
990 ei_denorm.task_id,
991 ei_denorm.expenditure_item_date_5,
992 ei_denorm.expenditure_type,
993 ei_denorm.system_linkage_function_5,
994 ei_denorm.quantity_5,
995 ei_denorm.attribute_category_5,
996 ei_denorm.attribute5_1,
997 ei_denorm.attribute5_2,
998 ei_denorm.attribute5_3,
999 ei_denorm.attribute5_4,
1000 ei_denorm.attribute5_5,
1001 ei_denorm.attribute5_6,
1002 ei_denorm.attribute5_7,
1003 ei_denorm.attribute5_8,
1004 ei_denorm.attribute5_9,
1005 ei_denorm.attribute5_10,
1006 ei_denorm.billable_flag,
1007 ei_denorm.job_id_5,
1008 x_outcome);
1009
1010 IF x_outcome IS NOT NULL THEN
1011 ei_denorm.quantity_5 := NULL;
1012 ei_denorm.expenditure_item_date_5 := NULL;
1013 ei_denorm.system_linkage_function_5 := NULL;
1014 ei_denorm.attribute_category_5 := NULL;
1015 ei_denorm.attribute5_1 := NULL;
1016 ei_denorm.attribute5_2 := NULL;
1017 ei_denorm.attribute5_3 := NULL;
1018 ei_denorm.attribute5_4 := NULL;
1019 ei_denorm.attribute5_5 := NULL;
1020 ei_denorm.attribute5_6 := NULL;
1021 ei_denorm.attribute5_7 := NULL;
1022 ei_denorm.attribute5_8 := NULL;
1023 ei_denorm.attribute5_9 := NULL;
1024 ei_denorm.attribute5_10 := NULL;
1025 ei_denorm.expenditure_comment_5 := NULL;
1026 ei_denorm.job_id_5 := NULL;
1027 ELSE
1028 IF ( G_exp_class_code = 'OE' ) THEN
1029 ei_denorm.raw_cost_rate_5 := pa_utils.GetExpTypeCostRate( ei_denorm.expenditure_type
1030 , ei_denorm.expenditure_item_date_5 );
1031 ei_denorm.raw_cost_5 := PA_CURRENCY.ROUND_CURRENCY_AMT(
1032 ( ei_denorm.quantity_5 * ei_denorm.raw_cost_rate_5 ) );
1033 ELSE
1034 ei_denorm.raw_cost_rate_5 := null;
1035 ei_denorm.raw_cost_5 := null;
1036 END IF;
1037 END IF;
1038 ELSE
1039 ei_denorm.quantity_5 := NULL;
1040 ei_denorm.expenditure_item_date_5 := NULL;
1041 ei_denorm.system_linkage_function_5 := NULL;
1042 ei_denorm.attribute_category_5 := NULL;
1043 ei_denorm.attribute5_1 := NULL;
1044 ei_denorm.attribute5_2 := NULL;
1045 ei_denorm.attribute5_3 := NULL;
1046 ei_denorm.attribute5_4 := NULL;
1047 ei_denorm.attribute5_5 := NULL;
1048 ei_denorm.attribute5_6 := NULL;
1049 ei_denorm.attribute5_7 := NULL;
1050 ei_denorm.attribute5_8 := NULL;
1051 ei_denorm.attribute5_9 := NULL;
1052 ei_denorm.attribute5_10 := NULL;
1053 ei_denorm.expenditure_comment_5 := NULL;
1054 ei_denorm.job_id_5 := NULL;
1055 END IF;
1056
1057 IF ei_denorm.quantity_6 IS NOT NULL THEN
1058
1059 PA_ONLINE_COPY_EXP.validate_item(ei_denorm.project_id,
1060 ei_denorm.task_id,
1061 ei_denorm.expenditure_item_date_6,
1062 ei_denorm.expenditure_type,
1063 ei_denorm.system_linkage_function_6,
1064 ei_denorm.quantity_6,
1065 ei_denorm.attribute_category_6,
1066 ei_denorm.attribute6_1,
1067 ei_denorm.attribute6_2,
1068 ei_denorm.attribute6_3,
1069 ei_denorm.attribute6_4,
1070 ei_denorm.attribute6_5,
1071 ei_denorm.attribute6_6,
1072 ei_denorm.attribute6_7,
1073 ei_denorm.attribute6_8,
1074 ei_denorm.attribute6_9,
1075 ei_denorm.attribute6_10,
1076 ei_denorm.billable_flag,
1077 ei_denorm.job_id_6,
1078 x_outcome);
1079
1080 IF x_outcome IS NOT NULL THEN
1081 ei_denorm.quantity_6 := NULL;
1082 ei_denorm.expenditure_item_date_6 := NULL;
1083 ei_denorm.system_linkage_function_6 := NULL;
1084 ei_denorm.attribute_category_6 := NULL;
1085 ei_denorm.attribute6_1 := NULL;
1086 ei_denorm.attribute6_2 := NULL;
1087 ei_denorm.attribute6_3 := NULL;
1088 ei_denorm.attribute6_4 := NULL;
1089 ei_denorm.attribute6_5 := NULL;
1090 ei_denorm.attribute6_6 := NULL;
1091 ei_denorm.attribute6_7 := NULL;
1092 ei_denorm.attribute6_8 := NULL;
1093 ei_denorm.attribute6_9 := NULL;
1094 ei_denorm.attribute6_10 := NULL;
1095 ei_denorm.expenditure_comment_6 := NULL;
1096 ei_denorm.job_id_6 := NULL;
1097 ELSE
1098 IF ( G_exp_class_code = 'OE' ) THEN
1099 ei_denorm.raw_cost_rate_6 := pa_utils.GetExpTypeCostRate( ei_denorm.expenditure_type
1100 , ei_denorm.expenditure_item_date_6 );
1101 ei_denorm.raw_cost_6 := PA_CURRENCY.ROUND_CURRENCY_AMT(
1102 ( ei_denorm.quantity_6 * ei_denorm.raw_cost_rate_6 ) );
1103 ELSE
1104 ei_denorm.raw_cost_rate_6 := null;
1105 ei_denorm.raw_cost_6 := null;
1106 END IF;
1107 END IF;
1108 ELSE
1109 ei_denorm.quantity_6 := NULL;
1110 ei_denorm.expenditure_item_date_6 := NULL;
1111 ei_denorm.system_linkage_function_6 := NULL;
1112 ei_denorm.attribute_category_6 := NULL;
1113 ei_denorm.attribute6_1 := NULL;
1114 ei_denorm.attribute6_2 := NULL;
1115 ei_denorm.attribute6_3 := NULL;
1116 ei_denorm.attribute6_4 := NULL;
1117 ei_denorm.attribute6_5 := NULL;
1118 ei_denorm.attribute6_6 := NULL;
1119 ei_denorm.attribute6_7 := NULL;
1120 ei_denorm.attribute6_8 := NULL;
1121 ei_denorm.attribute6_9 := NULL;
1122 ei_denorm.attribute6_10 := NULL;
1123 ei_denorm.expenditure_comment_6 := NULL;
1124 ei_denorm.job_id_6 := NULL;
1125 END IF;
1126
1127 IF ei_denorm.quantity_7 IS NOT NULL THEN
1128
1129 PA_ONLINE_COPY_EXP.validate_item(ei_denorm.project_id,
1130 ei_denorm.task_id,
1131 ei_denorm.expenditure_item_date_7,
1132 ei_denorm.expenditure_type,
1133 ei_denorm.system_linkage_function_7,
1134 ei_denorm.quantity_7,
1135 ei_denorm.attribute_category_7,
1136 ei_denorm.attribute7_1,
1137 ei_denorm.attribute7_2,
1138 ei_denorm.attribute7_3,
1139 ei_denorm.attribute7_4,
1140 ei_denorm.attribute7_5,
1141 ei_denorm.attribute7_6,
1142 ei_denorm.attribute7_7,
1143 ei_denorm.attribute7_8,
1144 ei_denorm.attribute7_9,
1145 ei_denorm.attribute7_10,
1146 ei_denorm.billable_flag,
1147 ei_denorm.job_id_7,
1148 x_outcome);
1149
1150 IF x_outcome IS NOT NULL THEN
1151 ei_denorm.quantity_7 := NULL;
1152 ei_denorm.expenditure_item_date_7 := NULL;
1153 ei_denorm.system_linkage_function_7 := NULL;
1154 ei_denorm.attribute_category_7 := NULL;
1155 ei_denorm.attribute7_1 := NULL;
1156 ei_denorm.attribute7_2 := NULL;
1157 ei_denorm.attribute7_3 := NULL;
1158 ei_denorm.attribute7_4 := NULL;
1159 ei_denorm.attribute7_5 := NULL;
1160 ei_denorm.attribute7_6 := NULL;
1161 ei_denorm.attribute7_7 := NULL;
1162 ei_denorm.attribute7_8 := NULL;
1163 ei_denorm.attribute7_9 := NULL;
1164 ei_denorm.attribute7_10 := NULL;
1165 ei_denorm.expenditure_comment_7 := NULL;
1166 ei_denorm.job_id_7 := NULL;
1167 ELSE
1168 IF ( G_exp_class_code = 'OE' ) THEN
1169 ei_denorm.raw_cost_rate_7 := pa_utils.GetExpTypeCostRate( ei_denorm.expenditure_type
1170 , ei_denorm.expenditure_item_date_7 );
1171 ei_denorm.raw_cost_7 := PA_CURRENCY.ROUND_CURRENCY_AMT(
1172 ( ei_denorm.quantity_7 * ei_denorm.raw_cost_rate_7 ) );
1173 ELSE
1174 ei_denorm.raw_cost_rate_7 := null;
1175 ei_denorm.raw_cost_7 := null;
1176 END IF;
1177 END IF;
1178 ELSE
1179 ei_denorm.quantity_7 := NULL;
1180 ei_denorm.expenditure_item_date_7 := NULL;
1181 ei_denorm.system_linkage_function_7 := NULL;
1182 ei_denorm.attribute_category_7 := NULL;
1183 ei_denorm.attribute7_1 := NULL;
1184 ei_denorm.attribute7_2 := NULL;
1185 ei_denorm.attribute7_3 := NULL;
1186 ei_denorm.attribute7_4 := NULL;
1187 ei_denorm.attribute7_5 := NULL;
1188 ei_denorm.attribute7_6 := NULL;
1189 ei_denorm.attribute7_7 := NULL;
1190 ei_denorm.attribute7_8 := NULL;
1191 ei_denorm.attribute7_9 := NULL;
1192 ei_denorm.attribute7_10 := NULL;
1193 ei_denorm.expenditure_comment_7 := NULL;
1194 ei_denorm.job_id_7 := NULL;
1195 END IF;
1196
1197 ei_denorm.net_zero_adjustment_flag_1 := NULL;
1198 ei_denorm.net_zero_adjustment_flag_2 := NULL;
1199 ei_denorm.net_zero_adjustment_flag_3 := NULL;
1200 ei_denorm.net_zero_adjustment_flag_4 := NULL;
1201 ei_denorm.net_zero_adjustment_flag_5 := NULL;
1202 ei_denorm.net_zero_adjustment_flag_6 := NULL;
1203 ei_denorm.net_zero_adjustment_flag_7 := NULL;
1204 ei_denorm.denorm_total_qty := nvl(ei_denorm.quantity_1,0) + nvl(ei_denorm.quantity_2,0) +
1205 nvl(ei_denorm.quantity_3,0) + nvl(ei_denorm.quantity_4,0) +
1206 nvl(ei_denorm.quantity_5,0) + nvl(ei_denorm.quantity_6,0) +
1207 nvl(ei_denorm.quantity_7,0);
1208 IF G_exp_class_code = 'OE' THEN
1209 ei_denorm.denorm_total_amount := nvl(ei_denorm.raw_cost_1,0) + nvl(ei_denorm.raw_cost_2,0) +
1210 nvl(ei_denorm.raw_cost_3,0) + nvl(ei_denorm.raw_cost_4,0) +
1211 nvl(ei_denorm.raw_cost_5,0) + nvl(ei_denorm.raw_cost_6,0) +
1212 nvl(ei_denorm.raw_cost_7,0);
1213 x_total_exp_copied := x_total_exp_copied + nvl(ei_denorm.denorm_total_amount,0);
1214 ELSE
1215 ei_denorm.denorm_total_amount := null;
1216 x_total_exp_copied := x_total_exp_copied + nvl(ei_denorm.denorm_total_qty,0);
1217 END IF;
1218
1219 -- Insert denorm record into pa_ei_denorm regards if any quantities got thru or not.
1220 pa_online_exp.insert_pa_ei_denorm_rec(
1221 ei_denorm.expenditure_id,
1222 ei_denorm.denorm_id,
1223 ei_denorm.person_id,
1224 ei_denorm.project_id,
1225 ei_denorm.task_id,
1226 ei_denorm.billable_flag,
1227 ei_denorm.expenditure_type,
1228 ei_denorm.default_sys_link_func,
1229 ei_denorm.unit_of_measure_code,
1230 ei_denorm.unit_of_measure,
1231 ei_denorm.expenditure_item_id_1,
1232 ei_denorm.expenditure_item_date_1,
1233 ei_denorm.quantity_1,
1234 ei_denorm.system_linkage_function_1,
1235 ei_denorm.non_labor_resource_1,
1236 ei_denorm.organization_id_1,
1237 ei_denorm.override_to_organization_id_1,
1238 ei_denorm.raw_cost_1,
1239 ei_denorm.raw_cost_rate_1,
1240 ei_denorm.attribute_category_1,
1241 ei_denorm.attribute1_1,
1242 ei_denorm.attribute1_2,
1243 ei_denorm.attribute1_3,
1244 ei_denorm.attribute1_4,
1245 ei_denorm.attribute1_5,
1246 ei_denorm.attribute1_6,
1247 ei_denorm.attribute1_7,
1248 ei_denorm.attribute1_8,
1249 ei_denorm.attribute1_9,
1250 ei_denorm.attribute1_10,
1251 ei_denorm.orig_transaction_reference_1,
1252 ei_denorm.adjusted_expenditure_item_id_1,
1253 ei_denorm.net_zero_adjustment_flag_1,
1254 ei_denorm.expenditure_comment_1,
1255 ei_denorm.expenditure_item_id_2,
1256 ei_denorm.expenditure_item_date_2,
1257 ei_denorm.quantity_2,
1258 ei_denorm.system_linkage_function_2,
1259 ei_denorm.non_labor_resource_2,
1260 ei_denorm.organization_id_2,
1261 ei_denorm.override_to_organization_id_2,
1262 ei_denorm.raw_cost_2,
1263 ei_denorm.raw_cost_rate_2,
1264 ei_denorm.attribute_category_2,
1265 ei_denorm.attribute2_1,
1266 ei_denorm.attribute2_2,
1267 ei_denorm.attribute2_3,
1268 ei_denorm.attribute2_4,
1269 ei_denorm.attribute2_5,
1270 ei_denorm.attribute2_6,
1271 ei_denorm.attribute2_7,
1272 ei_denorm.attribute2_8,
1273 ei_denorm.attribute2_9,
1274 ei_denorm.attribute2_10,
1275 ei_denorm.orig_transaction_reference_2,
1276 ei_denorm.adjusted_expenditure_item_id_2,
1277 ei_denorm.net_zero_adjustment_flag_2,
1278 ei_denorm.expenditure_comment_2,
1279 ei_denorm.expenditure_item_id_3,
1280 ei_denorm.expenditure_item_date_3,
1281 ei_denorm.quantity_3,
1282 ei_denorm.system_linkage_function_3,
1283 ei_denorm.non_labor_resource_3,
1284 ei_denorm.organization_id_3,
1285 ei_denorm.override_to_organization_id_3,
1286 ei_denorm.raw_cost_3,
1287 ei_denorm.raw_cost_rate_3,
1288 ei_denorm.attribute_category_3,
1289 ei_denorm.attribute3_1,
1290 ei_denorm.attribute3_2,
1291 ei_denorm.attribute3_3,
1292 ei_denorm.attribute3_4,
1293 ei_denorm.attribute3_5,
1294 ei_denorm.attribute3_6,
1295 ei_denorm.attribute3_7,
1296 ei_denorm.attribute3_8,
1297 ei_denorm.attribute3_9,
1298 ei_denorm.attribute3_10,
1299 ei_denorm.orig_transaction_reference_3,
1300 ei_denorm.adjusted_expenditure_item_id_3,
1301 ei_denorm.net_zero_adjustment_flag_3,
1302 ei_denorm.expenditure_comment_3,
1303 ei_denorm.expenditure_item_id_4,
1304 ei_denorm.expenditure_item_date_4,
1305 ei_denorm.quantity_4,
1306 ei_denorm.system_linkage_function_4,
1307 ei_denorm.non_labor_resource_4,
1308 ei_denorm.organization_id_4,
1309 ei_denorm.override_to_organization_id_4,
1310 ei_denorm.raw_cost_4,
1311 ei_denorm.raw_cost_rate_4,
1312 ei_denorm.attribute_category_4,
1313 ei_denorm.attribute4_1,
1314 ei_denorm.attribute4_2,
1315 ei_denorm.attribute4_3,
1316 ei_denorm.attribute4_4,
1317 ei_denorm.attribute4_5,
1318 ei_denorm.attribute4_6,
1319 ei_denorm.attribute4_7,
1320 ei_denorm.attribute4_8,
1321 ei_denorm.attribute4_9,
1322 ei_denorm.attribute4_10,
1323 ei_denorm.orig_transaction_reference_4,
1324 ei_denorm.adjusted_expenditure_item_id_4,
1325 ei_denorm.net_zero_adjustment_flag_4,
1326 ei_denorm.expenditure_comment_4,
1327 ei_denorm.expenditure_item_id_5,
1328 ei_denorm.expenditure_item_date_5,
1329 ei_denorm.quantity_5,
1330 ei_denorm.system_linkage_function_5,
1331 ei_denorm.non_labor_resource_5,
1332 ei_denorm.organization_id_5,
1333 ei_denorm.override_to_organization_id_5,
1334 ei_denorm.raw_cost_5,
1335 ei_denorm.raw_cost_rate_5,
1336 ei_denorm.attribute_category_5,
1337 ei_denorm.attribute5_1,
1338 ei_denorm.attribute5_2,
1339 ei_denorm.attribute5_3,
1340 ei_denorm.attribute5_4,
1341 ei_denorm.attribute5_5,
1342 ei_denorm.attribute5_6,
1343 ei_denorm.attribute5_7,
1344 ei_denorm.attribute5_8,
1345 ei_denorm.attribute5_9,
1346 ei_denorm.attribute5_10,
1347 ei_denorm.orig_transaction_reference_5,
1348 ei_denorm.adjusted_expenditure_item_id_5,
1349 ei_denorm.net_zero_adjustment_flag_5,
1350 ei_denorm.expenditure_comment_5,
1351 ei_denorm.expenditure_item_id_6,
1352 ei_denorm.expenditure_item_date_6,
1353 ei_denorm.quantity_6,
1354 ei_denorm.system_linkage_function_6,
1355 ei_denorm.non_labor_resource_6,
1356 ei_denorm.organization_id_6,
1357 ei_denorm.override_to_organization_id_6,
1358 ei_denorm.raw_cost_6,
1359 ei_denorm.raw_cost_rate_6,
1360 ei_denorm.attribute_category_6,
1361 ei_denorm.attribute6_1,
1362 ei_denorm.attribute6_2,
1363 ei_denorm.attribute6_3,
1364 ei_denorm.attribute6_4,
1365 ei_denorm.attribute6_5,
1366 ei_denorm.attribute6_6,
1367 ei_denorm.attribute6_7,
1368 ei_denorm.attribute6_8,
1369 ei_denorm.attribute6_9,
1370 ei_denorm.attribute6_10,
1371 ei_denorm.orig_transaction_reference_6,
1372 ei_denorm.adjusted_expenditure_item_id_6,
1373 ei_denorm.net_zero_adjustment_flag_6,
1374 ei_denorm.expenditure_comment_6,
1375 ei_denorm.expenditure_item_id_7,
1376 ei_denorm.expenditure_item_date_7,
1377 ei_denorm.quantity_7,
1378 ei_denorm.system_linkage_function_7,
1379 ei_denorm.non_labor_resource_7,
1380 ei_denorm.organization_id_7,
1381 ei_denorm.override_to_organization_id_7,
1382 ei_denorm.raw_cost_7,
1383 ei_denorm.raw_cost_rate_7,
1384 ei_denorm.attribute_category_7,
1385 ei_denorm.attribute7_1,
1386 ei_denorm.attribute7_2,
1387 ei_denorm.attribute7_3,
1388 ei_denorm.attribute7_4,
1389 ei_denorm.attribute7_5,
1390 ei_denorm.attribute7_6,
1391 ei_denorm.attribute7_7,
1392 ei_denorm.attribute7_8,
1393 ei_denorm.attribute7_9,
1394 ei_denorm.attribute7_10,
1395 ei_denorm.orig_transaction_reference_7,
1396 ei_denorm.adjusted_expenditure_item_id_7,
1397 ei_denorm.net_zero_adjustment_flag_7,
1398 ei_denorm.expenditure_comment_7,
1399 ei_denorm.denorm_total_qty,
1400 ei_denorm.denorm_total_amount,
1401 ei_denorm.created_by,
1402 ei_denorm.creation_date,
1403 ei_denorm.last_update_date,
1404 ei_denorm.last_updated_by,
1405 ei_denorm.last_update_login,
1406 ei_denorm.job_id_1,
1407 ei_denorm.job_id_2,
1408 ei_denorm.job_id_3,
1409 ei_denorm.job_id_4,
1410 ei_denorm.job_id_5,
1411 ei_denorm.job_id_6,
1412 ei_denorm.job_id_7);
1413
1414
1415 END LOOP;
1416 CLOSE getEIdenorm;
1417
1418 EXCEPTION
1419 WHEN OTHERS THEN
1420 RAISE;
1421
1422 END CopyItems;
1423
1424 PROCEDURE Validate_item (x_project_id IN NUMBER,
1425 x_task_id IN NUMBER,
1426 x_expenditure_item_date IN DATE,
1427 x_expenditure_type IN VARCHAR2,
1428 x_sys_link_func IN VARCHAR2,
1429 x_quantity IN NUMBER,
1430 x_attribute_category IN VARCHAR2,
1431 x_attribute1 IN VARCHAR2,
1432 x_attribute2 IN VARCHAR2,
1433 x_attribute3 IN VARCHAR2,
1434 x_attribute4 IN VARCHAR2,
1435 x_attribute5 IN VARCHAR2,
1436 x_attribute6 IN VARCHAR2,
1437 x_attribute7 IN VARCHAR2,
1438 x_attribute8 IN VARCHAR2,
1439 x_attribute9 IN VARCHAR2,
1440 x_attribute10 IN VARCHAR2,
1441 x_billable_flag IN OUT NOCOPY VARCHAR2,
1442 x_job_id IN OUT NOCOPY NUMBER,
1443 temp_outcome IN OUT NOCOPY VARCHAR2)
1444 IS
1445
1446 x_task_billable_flag VARCHAR2(1);
1447 -- adding the temp variables transaction control
1448 -- extension chnages. This is only a temporary change
1449 -- because this function is not supported in 11.5.
1450
1451 temp_outcome_type VARCHAR2(1);
1452 temp_msg_application VARCHAR2(50);
1453 temp_msg_token1 VARCHAR2(240);
1454 temp_msg_token2 VARCHAR2(240);
1455 temp_msg_token3 VARCHAR2(240);
1456 temp_msg_count NUMBER;
1457
1458 l_billable_flag VARCHAR2(1);
1459 l_job_id NUMBER;
1460 l_temp_outcome VARCHAR2(1000);
1461 BEGIN
1462
1463 l_billable_flag := x_billable_flag; -- Store passed in values
1464 l_job_id := x_job_id;
1465 l_temp_outcome := temp_outcome;
1466
1467 temp_outcome := NULL;
1468
1469 IF pa_utils.CheckExpTypeActive(x_expenditure_type,x_expenditure_item_date) = FALSE THEN
1470 temp_outcome := 'NOT ACTIVE EXP TYPE';
1471 RETURN;
1472 END IF;
1473
1474 IF pa_utils2.CheckSysLinkFuncActive(x_expenditure_type, x_expenditure_item_date, x_sys_link_func) = FALSE THEN
1475 temp_outcome := 'NOT ACTIVE SYS LINK FUNC';
1476 RETURN;
1477 END IF;
1478
1479 ValidateEmp ( x_expenditure_item_date,
1480 x_job_id,
1481 temp_outcome );
1482
1483 IF temp_outcome IS NULL THEN
1484 --
1485 -- replaced patc.get_status with pa_transactions_pub.
1486 -- validate_transaction. This is a temporary change,
1487 -- because this function will not be supported in 11.5
1488 --
1489 pa_transactions_pub.validate_transaction(
1490 X_project_id => X_project_id
1491 , X_task_id => X_task_id
1492 , X_ei_date => X_expenditure_item_date
1493 , X_expenditure_type => X_expenditure_type
1494 , X_non_labor_resource => NULL
1495 , X_person_id => G_inc_by_person_id
1496 , X_quantity => X_quantity
1497 , X_denom_currency_code => NULL
1498 , X_acct_currency_code => NULL
1499 , X_denom_raw_cost => NULL
1500 , X_acct_raw_cost => NULL
1501 , X_acct_rate_type => NULL
1502 , X_acct_rate_date => NULL
1503 , X_acct_exchange_rate => NULL
1504 , X_transfer_ei => NULL
1505 , X_incurred_by_org_id => G_new_org_id
1506 , X_nl_resource_org_id => NULL
1507 , X_transaction_source => NULL
1508 , X_calling_module => G_module
1509 , X_vendor_id => NULL
1510 , X_entered_by_user_id => G_entered_by_person_id
1511 , X_attribute_category => X_attribute_category
1512 , X_attribute1 => X_attribute1
1513 , X_attribute2 => X_attribute2
1514 , X_attribute3 => X_attribute3
1515 , X_attribute4 => X_attribute4
1516 , X_attribute5 => X_attribute5
1517 , X_attribute6 => X_attribute6
1518 , X_attribute7 => X_attribute7
1519 , X_attribute8 => X_attribute8
1520 , X_attribute9 => X_attribute9
1521 , X_attribute10 => X_attribute10
1522 , X_attribute11 => NULL
1523 , X_attribute12 => NULL
1524 , X_attribute13 => NULL
1525 , X_attribute14 => NULL
1526 , X_attribute15 => NULL
1527 , X_msg_application => temp_msg_application
1528 , X_msg_type => temp_outcome_type
1529 , X_msg_token1 => temp_msg_token1
1530 , X_msg_token2 => temp_msg_token2
1531 , X_msg_token3 => temp_msg_token3
1532 , X_msg_count => temp_msg_count
1533 , X_msg_data => temp_outcome
1534 , X_billable_flag=> x_task_billable_flag
1535 , P_sys_link_function => x_sys_link_func );
1536
1537 IF x_task_billable_flag IS NOT NULL THEN
1538 x_billable_flag := x_task_billable_flag;
1539 END IF;
1540
1541 END IF;
1542
1543 -- R12 NOCOPY Mandate - copy back passed in values
1544 EXCEPTION WHEN OTHERS THEN
1545 x_billable_flag := l_billable_flag;
1546 x_job_id := l_job_id;
1547 temp_outcome := l_temp_outcome;
1548
1549 END Validate_Item;
1550
1551
1552 PROCEDURE Copy_exp ( orig_exp_id IN NUMBER
1553 , old_exp_ending_date IN DATE
1554 , new_exp_id IN NUMBER
1555 , new_exp_ending_date IN DATE
1556 , incurred_by_org_id IN NUMBER
1557 , expenditure_class_code IN VARCHAR2
1558 , x_exp_status_code IN VARCHAR2
1559 , x_exp_source_code IN VARCHAR2
1560 , x_copy_exp_type_flag IN VARCHAR2
1561 , x_copy_qty_flag IN VARCHAR2
1562 , x_copy_cmt_flag IN VARCHAR2
1563 , x_copy_dff_flag IN VARCHAR2
1564 , x_copy_attachment_flag IN VARCHAR2
1565 , X_inc_by_person IN NUMBER
1566 , X_entered_by_person_id IN NUMBER
1567 , userid IN NUMBER
1568 , x_total_exp_copied IN OUT NOCOPY NUMBER)
1569 IS
1570 days_diff NUMBER;
1571
1572 BEGIN
1573 G_user := userid;
1574 G_exp_class_code := expenditure_class_code;
1575 G_new_org_id := incurred_by_org_id;
1576 G_module := 'PAXTRONE';
1577 G_copy_exp_type_flag := x_copy_exp_type_flag;
1578 G_copy_qty_flag := x_copy_qty_flag;
1579 G_copy_cmt_flag := x_copy_cmt_flag;
1580 G_copy_dff_flag := x_copy_dff_flag;
1581 G_entered_by_person_id := X_entered_by_person_id;
1582 G_inc_by_person_id := x_inc_by_person;
1583
1584 IF EXP_EXISTS_IN_DENORM(orig_exp_id) = 'N' THEN
1585 pa_online_exp.build_denorm_table(orig_exp_id,
1586 expenditure_class_code,
1587 x_exp_status_code,
1588 x_exp_source_code,
1589 x_inc_by_person);
1590 END IF;
1591
1592 days_diff := trunc(new_exp_ending_date) - trunc(old_exp_ending_date);
1593
1594 CopyItems ( orig_exp_id
1595 , new_exp_id
1596 , days_diff
1597 , x_total_exp_copied);
1598
1599 IF x_copy_attachment_flag = 'Y' THEN
1600
1601 fnd_attached_documents2_pkg.copy_attachments('PA_EXPENDITURES',
1602 orig_exp_id,
1603 null,
1604 null,
1605 null,
1606 null,
1607 'PA_EXPENDITURES',
1608 new_exp_id,
1609 null,
1610 null,
1611 null,
1612 null,
1613 G_user,
1614 FND_GLOBAL.LOGIN_ID,
1615 null,
1616 null,
1617 null);
1618
1619 END IF;
1620
1621 EXCEPTION
1622 WHEN OTHERS THEN
1623 RAISE;
1624
1625 END copy_exp;
1626
1627
1628 FUNCTION EXP_EXISTS_IN_DENORM(x_orig_exp_id IN NUMBER) RETURN VARCHAR2
1629 IS
1630 x_return VARCHAR2(1) DEFAULT 'N';
1631
1632 BEGIN
1633
1634 SELECT 'Y'
1635 INTO x_return
1636 FROM SYS.DUAL
1637 WHERE EXISTS (SELECT 'x'
1638 FROM PA_EI_DENORM
1639 WHERE EXPENDITURE_ID = x_orig_exp_id);
1640
1641 RETURN ( x_return ) ;
1642
1643 EXCEPTION
1644 WHEN NO_DATA_FOUND THEN
1645 RETURN ( x_return );
1646 WHEN OTHERS THEN
1647 RAISE;
1648
1649 END EXP_EXISTS_IN_DENORM;
1650
1651 END PA_ONLINE_COPY_EXP;