[Home] [Help]
PACKAGE BODY: APPS.HXC_TIMEKEEPER_PROCESS
Source
1 PACKAGE BODY hxc_timekeeper_process AS
2 /* $Header: hxctksta.pkb 120.12.12010000.3 2008/09/08 12:57:27 pvelugul ship $ */
3
4 g_debug boolean := hr_utility.debug_enabled;
5 PROCEDURE timekeeper_query (
6 p_timekeeper_data IN OUT NOCOPY t_timekeeper_table,
7 p_timekeeper_id IN NUMBER,
8 p_start_period IN DATE,
9 p_end_period IN DATE,
10 p_group_id IN NUMBER,
11 p_resource_id IN NUMBER,
12 p_attribute1 IN VARCHAR2,
13 p_attribute2 IN VARCHAR2,
14 p_attribute3 IN VARCHAR2,
15 p_attribute4 IN VARCHAR2,
16 p_attribute5 IN VARCHAR2,
17 p_attribute6 IN VARCHAR2,
18 p_attribute7 IN VARCHAR2,
19 p_attribute8 IN VARCHAR2,
20 p_attribute9 IN VARCHAR2,
21 p_attribute10 IN VARCHAR2,
22 p_attribute11 IN VARCHAR2,
23 p_attribute12 IN VARCHAR2,
24 p_attribute13 IN VARCHAR2,
25 p_attribute14 IN VARCHAR2,
26 p_attribute15 IN VARCHAR2,
27 p_attribute16 IN VARCHAR2,
28 p_attribute17 IN VARCHAR2,
29 p_attribute18 IN VARCHAR2,
30 p_attribute19 IN VARCHAR2,
31 p_attribute20 IN VARCHAR2,
32 p_status_code IN VARCHAR2,
33 p_rec_periodid IN NUMBER,
34 p_superflag
35 /*ADVICE(128): Unreferenced parameter [552] */
36 IN VARCHAR2,
37 p_reqryflg IN VARCHAR2,
38 p_trx_lock_id IN NUMBER,
39 p_row_lock_id IN VARCHAR2,
40 p_person_type IN VARCHAR2,
41 p_message_type IN VARCHAR2,
42 p_query_type IN VARCHAR2,
43 p_lock_profile IN VARCHAR2,
44 p_message_text IN VARCHAR2,
45 p_late_reason IN VARCHAR2,
46 p_change_reason IN VARCHAR2,
47 p_audit_enabled IN VARCHAR2,
48 p_audit_history IN VARCHAR2
49 ) IS
50 /*Cursor Modified By Mithun for CWK Terminate Bug*/
51 CURSOR c_resource_info (
52 p_timekeeper_id
53 /*ADVICE(145): This definition hides another one [556] */
54
55 /*ADVICE(147): Unreferenced parameter [552] */
56 IN NUMBER,
57 p_start_period
58 /*ADVICE(150): This definition hides another one [556] */
59 IN DATE,
60 p_end_period
61 /*ADVICE(153): This definition hides another one [556] */
62 IN DATE,
63 p_group_id
64 /*ADVICE(156): This definition hides another one [556] */
65 IN NUMBER,
66 p_resource_id
67 /*ADVICE(159): This definition hides another one [556] */
68 IN NUMBER,
69 p_person_type
70 /*ADVICE(162): This definition hides another one [556] */
71 IN VARCHAR2
72 ) IS
73 SELECT ppf.person_id person_id, ppf.full_name,
74 NVL (ppf.employee_number, ppf.npw_number) employee_number,
75 hr_person_type_usage_info.get_user_person_type (p_start_period, ppf.person_id) person_type
76 FROM hxc_tk_group_queries htgq,
77 hxc_tk_groups htg,
78 hxc_tk_group_query_criteria htgqc,
79 per_all_people_f ppf,
80 per_all_assignments_f paa,
81 per_person_type_usages_f ptu,
82 per_person_types ppt
83 WHERE ppf.person_id = paa.person_id
84 AND ppt.person_type_id = ptu.person_type_id
85 AND ppt.system_person_type IN ('EMP', 'EMP_APL', 'CWK','EX_EMP', 'EX_CWK')
86 AND ( p_person_type IS NULL
87 OR ( DECODE (ppt.system_person_type, 'EMP_APL', 'EMP', ppt.system_person_type) =
88 p_person_type
89 AND p_person_type IS NOT NULL
90 )
91 )
92 AND ptu.person_id = ppf.person_id
93 AND p_start_period <= ptu.effective_end_date
94 AND p_end_period >= ptu.effective_start_date
95 AND paa.primary_flag = 'Y'
96 AND paa.assignment_type IN ('E', 'C')
97 AND p_start_period <= paa.effective_end_date
98 AND p_end_period >= paa.effective_start_date
99 AND p_start_period <= ppf.effective_end_date
100 AND p_end_period >= ppf.effective_start_date
101 AND ppf.person_id = htgqc.criteria_id
102 AND htgqc.tk_group_query_id = htgq.tk_group_query_id
103 AND htgq.tk_group_id = htg.tk_group_id
104 AND htg.business_group_id = ppf.business_group_id
105 AND htg.tk_group_id = p_group_id
106 AND ppf.person_id = NVL (p_resource_id, ppf.person_id)
107 AND htgq.include_exclude = 'I'
108 AND htgqc.criteria_type = 'PERSON'
109 AND ppf.effective_end_date = (SELECT MAX (ppf2.effective_end_date)
110 FROM per_people_f ppf2, per_all_assignments_f paa2
111 WHERE ppf2.person_id = paa2.person_id
112 AND paa2.primary_flag = 'Y'
113 AND paa2.assignment_type IN ('E', 'C')
114 AND p_start_period <= paa2.effective_end_date
115 AND p_end_period >= paa2.effective_start_date
116 AND p_start_period <= ppf2.effective_end_date
117 AND p_end_period >= ppf2.effective_start_date
118 AND ppf2.person_id = ppf.person_id)
119 UNION
120 SELECT ppf.person_id person_id, ppf.full_name,
121 NVL (ppf.employee_number, ppf.npw_number) employee_number,
122 hr_person_type_usage_info.get_user_person_type (p_start_period, ppf.person_id) person_type
123 FROM hxc_tk_group_queries htgq,
124 hxc_tk_groups htg,
125 hxc_tk_group_query_criteria htgqc,
126 per_all_people_f ppf,
127 per_all_assignments_f paa,
128 per_person_type_usages_f ptu,
129 per_person_types ppt
130 WHERE ppf.person_id = paa.person_id
131 AND ppt.person_type_id = ptu.person_type_id
132 AND ppt.system_person_type IN ('EMP', 'EMP_APL', 'CWK','EX_EMP')
133 AND ptu.person_id = ppf.person_id
134 AND ( p_person_type IS NULL
135 OR ( DECODE (ppt.system_person_type, 'EMP_APL', 'EMP', ppt.system_person_type) =
136 p_person_type
137 AND p_person_type IS NOT NULL
138 )
139 )
140 AND p_start_period <= ptu.effective_end_date
141 AND p_end_period >= ptu.effective_start_date
142 AND paa.primary_flag = 'Y'
143 AND paa.assignment_type IN ('E', 'C')
144 AND p_start_period <= paa.effective_end_date
145 AND p_end_period >= paa.effective_start_date
146 AND p_start_period <= ppf.effective_end_date
147 AND p_end_period >= ppf.effective_start_date
148 AND ppf.person_id = p_resource_id
149 AND ppf.person_id = htgqc.criteria_id
150 AND htgqc.tk_group_query_id = htgq.tk_group_query_id
151 AND htgq.tk_group_id = htg.tk_group_id
152 AND htg.business_group_id = ppf.business_group_id
153 AND htgq.include_exclude = 'I'
154 AND htgqc.criteria_type = 'PERSON'
155 AND ppf.effective_end_date = (SELECT MAX (ppf2.effective_end_date)
156 FROM per_people_f ppf2, per_all_assignments_f paa2
157 WHERE ppf2.person_id = paa2.person_id
158 AND paa2.primary_flag = 'Y'
159 AND paa2.assignment_type IN ('E', 'C')
160 AND p_start_period <= paa2.effective_end_date
161 AND p_end_period >= paa2.effective_start_date
162 AND p_start_period <= ppf2.effective_end_date
163 AND p_end_period >= ppf2.effective_start_date
164 AND ppf2.person_id = ppf.person_id)
165 ORDER BY 2;
166
167 CURSOR c_timecard_info (
168 p_resource_id
169 /*ADVICE(261): This definition hides another one [556] */
170 IN NUMBER,
171 p_start_period
172 /*ADVICE(264): This definition hides another one [556] */
173 IN DATE,
174 p_end_period
175 /*ADVICE(267): This definition hides another one [556] */
176 IN DATE
177 ) IS
178 SELECT time_building_block_id, object_version_number, start_time, comment_text, created_by,
179 creation_date, last_updated_by, last_update_date, last_update_login
180 FROM hxc_time_building_blocks
181 WHERE resource_id = p_resource_id
182 AND SCOPE = 'TIMECARD'
183 AND start_time = p_start_period
184 AND stop_time = p_end_period
185 AND date_to = hr_general.end_of_time;
186
187 CURSOR c (
188 p_detailid NUMBER
189 ) IS
190 SELECT *
191 FROM hxc_tk_detail_temp
192 WHERE detailid = p_detailid;
193
194 c_row hxc_tk_detail_temp%ROWTYPE;
195
196 CURSOR c_detail_info (
197 timecard_id IN NUMBER,
198 timecard_ovn IN NUMBER
199 ) IS
200 SELECT detail.time_building_block_id detail_id, detail.object_version_number detail_ovn,
201 detail.measure, DAY.start_time, detail.start_time time_in, detail.stop_time time_out,
202 detail.comment_text
203 FROM hxc_time_building_blocks detail, hxc_time_building_blocks DAY
204 WHERE DAY.parent_building_block_id = timecard_id
205 AND DAY.parent_building_block_ovn = timecard_ovn
206 AND detail.date_to = hr_general.end_of_time
207 AND detail.SCOPE = 'DETAIL'
208 AND detail.parent_building_block_id = DAY.time_building_block_id
209 AND detail.parent_building_block_ovn = DAY.object_version_number
210 AND DAY.SCOPE = 'DAY'
211 AND DAY.date_to = hr_general.end_of_time
212 ORDER BY 4, 5, 1; --nitin
213
214
215 /* UNCOMMENT WHEN hxc_timecard_summary is enable
216 CURSOR c_timecard_status (timecard_id IN NUMBER, timecard_ovn IN NUMBER)
217 IS
218 SELECT approval_status
219 FROM hxc_timecard_summary
220 WHERE timecard_id = time_building_block_id
221 AND timecard_ovn = time_building_block_ovn;
222 */
223 l_table_counter NUMBER
224 /*ADVICE(316): NUMBER has no precision [315] */
225 := 0;
226 l_day_index
227 /*ADVICE(319): Unreferenced variable [553] */
228 NUMBER
229 /*ADVICE(321): NUMBER has no precision [315] */
230 ;
231 l_detail_index NUMBER
232 /*ADVICE(324): NUMBER has no precision [315] */
233 ;
234 l_attribute_index NUMBER
235 /*ADVICE(327): NUMBER has no precision [315] */
236 := 0;
237 l_index_buffer NUMBER
238 /*ADVICE(330): NUMBER has no precision [315] */
239 := 0;
240 l_record_index_buffer NUMBER
241 /*ADVICE(333): NUMBER has no precision [315] */
242 := 0;
243 l_attributes hxc_attribute_table_type;
244 l_timecard hxc_block_table_type;
245 l_messages hxc_message_table_type;
246 l_alias_def_list_index
247 /*ADVICE(339): Unreferenced variable [553] */
248 NUMBER
249 /*ADVICE(341): NUMBER has no precision [315] */
250 ;
251 l_alias_type
252 /*ADVICE(344): Unreferenced variable [553] */
253 VARCHAR2 (80);
254 l_buffer_info t_buffer_table;
255 t_base_table t_base_info;
256 t_base_index NUMBER
257 /*ADVICE(349): NUMBER has no precision [315] */
258 := 0;
259 l_found_hours_type BOOLEAN;
260 l_found_timecard BOOLEAN := FALSE;
261 l_detail_start_time DATE;
262 l_detail_measure NUMBER
263 /*ADVICE(355): NUMBER has no precision [315] */
264 ;
265 l_detail_id NUMBER
266 /*ADVICE(358): NUMBER has no precision [315] */
267 ;
268 l_detail_ovn NUMBER
269 /*ADVICE(361): NUMBER has no precision [315] */
270 ;
271 l_detail_time_in DATE;
272 l_detail_time_out DATE;
273 l_detail_comment_text VARCHAR2 (2000) := NULL;
274 /*ADVICE(366): VARCHAR2 declaration with length greater than 500 characters [307] */
275
276 /*ADVICE(368): Initialization to NULL is superfluous [417] */
277
278 l_detail_info_table t_detail_info_table;
279 l_day_id_info_table t_day_id_info_table;
280 l_timecard_id NUMBER
281 /*ADVICE(373): NUMBER has no precision [315] */
282 ;
283 l_timecard_ovn NUMBER
284 /*ADVICE(376): NUMBER has no precision [315] */
285 ;
286 l_timecard_start_time DATE;
287 l_timecard_comment_text VARCHAR2 (2000) := NULL;
288 /*ADVICE(380): VARCHAR2 declaration with length greater than 500 characters [307] */
289
290 /*ADVICE(382): Initialization to NULL is superfluous [417] */
291
292 l_last_update_date DATE;
293 l_last_updated_by NUMBER (16);
294 l_last_update_login NUMBER (16);
295 l_created_by NUMBER (16);
296 l_creation_date DATE;
297 l_query BOOLEAN;
298 l_audit_query BOOLEAN;
299 l_approval_style_id NUMBER
300 /*ADVICE(392): NUMBER has no precision [315] */
301 ;
302 l_approval_status VARCHAR2 (80);
303 l_found_detail BOOLEAN := FALSE;
304 l_rec_periodid NUMBER
305 /*ADVICE(397): NUMBER has no precision [315] */
306 ;
307 l_status_code VARCHAR2 (80);
308 l_timecard_status VARCHAR2 (80);
309 l_timecard_status_meaning VARCHAR2 (80);
310 l_emp_negpref VARCHAR2 (150);
311 l_emp_recpref NUMBER
312 /*ADVICE(404): NUMBER has no precision [315] */
313 ;
314 l_emp_appstyle NUMBER
315 /*ADVICE(407): NUMBER has no precision [315] */
316 ;
317 l_emp_layout1 NUMBER
318 /*ADVICE(410): NUMBER has no precision [315] */
319 ;
320 l_emp_layout2 NUMBER
321 /*ADVICE(413): NUMBER has no precision [315] */
322 ;
323 l_emp_layout3 NUMBER
324 /*ADVICE(416): NUMBER has no precision [315] */
325 ;
326 l_emp_layout4 NUMBER
327 /*ADVICE(419): NUMBER has no precision [315] */
328 ;
329 l_emp_layout5 NUMBER
330 /*ADVICE(422): NUMBER has no precision [315] */
331 ;
332 l_emp_layout6 NUMBER
333 /*ADVICE(425): NUMBER has no precision [315] */
334 ;
335 l_emp_layout7 NUMBER
336 /*ADVICE(428): NUMBER has no precision [315] */
337 ;
338 l_emp_layout8 NUMBER
339 /*ADVICE(431): NUMBER has no precision [315] */
340 ;
341 l_emp_edits VARCHAR2 (150);
342 l_pastdt VARCHAR2 (30);
343 l_futuredt VARCHAR2 (30);
344 num
345 /*ADVICE(437): Unreferenced variable [553] */
346 NUMBER
347 /*ADVICE(439): NUMBER has no precision [315] */
348 ;
349 n
350 /*ADVICE(442): Unreferenced variable [553] */
351 NUMBER
352 /*ADVICE(444): NUMBER has no precision [315] */
353 := 0;
354 changed_no NUMBER
355 /*ADVICE(447): NUMBER has no precision [315] */
356 := 0;
357 changed VARCHAR2 (5) := 'N';
358 emp_tab_index NUMBER
359 /*ADVICE(451): NUMBER has no precision [315] */
360 := 0;
361 tc_start DATE;
362 tc_end DATE;
363 emp_qry_tc_info hxc_timekeeper_utilities.emptctab;
364 l_add_index_day NUMBER
365 /*ADVICE(457): NUMBER has no precision [315] */
366 := 0;
367 l_resource_tc_table t_resource_tc_table;
368 l_timecard_index_info hxc_timekeeper_process.t_timecard_index_info;
369 l_attribute_index_info hxc_timekeeper_process.t_attribute_index_info;
370 l_emp_start_date DATE;
371 l_emp_terminate_date DATE;
372 l_row_id ROWID
373 /*ADVICE(464): Use of ROWID [113] */
374 ;
375 l_tc_lock_success VARCHAR2 (30) := 'FALSE';
376 l_tc_lock_boolean BOOLEAN := FALSE;
377 l_process_lock_type VARCHAR2 (80) := hxc_lock_util.c_pui_timekeeper_action;
378 l_relased_success
379 /*ADVICE(470): Unreferenced variable [553] */
380 BOOLEAN;
381 l_lock_trx_id NUMBER (15) := p_trx_lock_id;
382 l_row_lock_id VARCHAR2 (30) := p_row_lock_id;
383 l_timecard_message_code VARCHAR2 (30) := NULL;
384 /*ADVICE(475): Initialization to NULL is superfluous [417] */
385
386 l_timecard_reason_code VARCHAR2 (30) := NULL;
387 /*ADVICE(478): Initialization to NULL is superfluous [417] */
388
389 l_timecard_message VARCHAR2 (240) := NULL;
390 /*ADVICE(481): Initialization to NULL is superfluous [417] */
391
392 l_index NUMBER
393 /*ADVICE(484): NUMBER has no precision [315] */
394 ;
395 l_pref_exception EXCEPTION;
396 l_terminated_list VARCHAR2 (32000);
397 /*ADVICE(488): VARCHAR2 declaration with length greater than 500 characters [307] */
398
399 l_audit_enabled VARCHAR2 (150) := NULL;
400 /*ADVICE(491): Initialization to NULL is superfluous [417] */
401
402
403
404 ----------------------------------------------------------------------
405 --Private function to check if timecard has message of type queried
406 ----------------------------------------------------------------------
407 FUNCTION tc_has_message (
408 p_bb_id IN NUMBER,
409 p_bb_ovn IN NUMBER,
410 p_msg_type IN VARCHAR2,
411 p_msg_text IN VARCHAR2
412 )
413 RETURN BOOLEAN IS
414 CURSOR csr_get_timecard IS
415 SELECT detail.time_building_block_id bb_id, detail.object_version_number bb_ovn
416 FROM hxc_time_building_blocks detail, hxc_time_building_blocks DAY
417 WHERE DAY.parent_building_block_id = p_bb_id
418 /*ADVICE(509): Cursor references an external variable (use a parameter) [209] */
419
420 AND DAY.parent_building_block_ovn = p_bb_ovn
421 /*ADVICE(512): Cursor references an external variable (use a parameter) [209] */
422
423 AND detail.date_to = hr_general.end_of_time
424 AND detail.SCOPE = 'DETAIL'
425 AND detail.parent_building_block_id = DAY.time_building_block_id
426 AND detail.parent_building_block_ovn = DAY.object_version_number
427 AND DAY.SCOPE = 'DAY'
428 AND DAY.date_to = hr_general.end_of_time;
429
430 CURSOR c_get_warning_msg (
431 bb_id NUMBER,
432 bb_ovn NUMBER,
433 msg_type VARCHAR2,
434 msg_text VARCHAR2
435 ) IS
436 SELECT 'Y'
437 FROM hxc_errors
438 WHERE time_building_block_id = bb_id
439 AND time_building_block_ovn = bb_ovn
440 AND (date_to = hr_general.end_of_time OR date_to IS NULL)
441 AND message_level = DECODE (msg_type, 'ALL', message_level, NULL, message_level, msg_type)
442 AND message_name = DECODE (msg_text, NULL, message_name, msg_text);
443
444 l_msg_flag VARCHAR2 (10) := NULL;
445 /*ADVICE(536): Initialization to NULL is superfluous [417] */
446
447 BEGIN
448 l_msg_flag := NULL;
449
450 -- check for timecard scope
451 OPEN c_get_warning_msg (p_bb_id, p_bb_ovn, p_msg_type, p_msg_text);
452 FETCH c_get_warning_msg INTO l_msg_flag;
453 CLOSE c_get_warning_msg;
454
455 IF l_msg_flag IS NOT NULL THEN
456 RETURN TRUE;
457 END IF;
458
459 FOR timecard_error_rec IN csr_get_timecard LOOP
460 OPEN c_get_warning_msg (timecard_error_rec.bb_id, timecard_error_rec.bb_ovn, p_msg_type, p_msg_text);
461 FETCH c_get_warning_msg INTO l_msg_flag;
462 CLOSE c_get_warning_msg;
463
464 IF l_msg_flag IS NOT NULL THEN
465 RETURN TRUE;
466 /*ADVICE(557): A RETURN statement is used in a FOR loop [504] */
467
468 END IF;
469 END LOOP;
470
471 IF l_msg_flag IS NULL THEN
472 RETURN FALSE;
473 ELSE
474 RETURN TRUE;
475 END IF;
476 /*ADVICE(567): Last statement in function must be a RETURN [510] */
477
478 END tc_has_message;
479 /*ADVICE(570): Function with more than one RETURN statement in the executable section [512] */
480
481
482 FUNCTION tc_has_reason (
483 p_bb_id IN NUMBER,
484 p_bb_ovn IN NUMBER,
485 p_late_reason
486 /*ADVICE(577): This definition hides another one [556] */
487 IN VARCHAR2,
488 p_change_reason
489 /*ADVICE(580): This definition hides another one [556] */
490 IN VARCHAR2
491 )
492 RETURN BOOLEAN IS
493 CURSOR csr_get_timecard IS
494 SELECT detail.time_building_block_id bb_id, detail.object_version_number bb_ovn
495 FROM hxc_time_building_blocks detail, hxc_time_building_blocks DAY
496 WHERE DAY.parent_building_block_id = p_bb_id
497 /*ADVICE(588): Cursor references an external variable (use a parameter) [209] */
498
499 AND DAY.parent_building_block_ovn = p_bb_ovn
500 /*ADVICE(591): Cursor references an external variable (use a parameter) [209] */
501
502 AND detail.date_to = hr_general.end_of_time
503 AND detail.SCOPE = 'DETAIL'
504 AND detail.parent_building_block_id = DAY.time_building_block_id
505 AND detail.parent_building_block_ovn = DAY.object_version_number
506 AND DAY.SCOPE = 'DAY'
507 AND DAY.date_to = hr_general.end_of_time;
508
509 CURSOR c_get_reason (
510 bb_id NUMBER,
511 bb_ovn NUMBER,
512 late_reason VARCHAR2,
513 change_reason VARCHAR2,
514 audit_history VARCHAR2
515 ) IS
516 SELECT 'Y'
517 FROM hxc_time_attributes
518 WHERE time_attribute_id IN (SELECT time_attribute_id
519 FROM hxc_time_attribute_usages
520 WHERE time_building_block_id = bb_id
521 AND time_building_block_ovn = bb_ovn)
522 AND attribute_category = 'REASON'
523 AND attribute1 = DECODE (attribute3, 'CHANGE', change_reason, 'LATE', late_reason)
524 AND NVL (attribute7, '-99') = DECODE (audit_history, NULL, NVL (attribute7, '-99'), audit_history);
525
526 CURSOR c_get_reason_null (
527 bb_id NUMBER,
528 bb_ovn NUMBER,
529 audit_history VARCHAR2
530 ) IS
531 SELECT 'Y'
532 FROM hxc_time_attributes
533 WHERE time_attribute_id IN (SELECT time_attribute_id
534 FROM hxc_time_attribute_usages
535 WHERE time_building_block_id = bb_id
536 AND time_building_block_ovn = bb_ovn)
537 AND attribute_category = 'REASON'
538 AND attribute7 = DECODE (audit_history, NULL, attribute7, audit_history);
539
540 l_reason_flag VARCHAR2 (10) := NULL;
541 /*ADVICE(632): Initialization to NULL is superfluous [417] */
542
543 BEGIN
544 g_debug :=hr_utility.debug_enabled;
545 l_reason_flag := NULL;
546
547
548 -- check for timecard scope
549
550 IF (p_late_reason IS NOT NULL OR p_change_reason IS NOT NULL) THEN
551 FOR timecard_error_rec IN csr_get_timecard LOOP
552 if g_debug then
553 hr_utility.TRACE ('timecard_error_rec.bb_id'|| timecard_error_rec.bb_id);
554 hr_utility.TRACE ('timecard_error_rec.bb_ovn'|| timecard_error_rec.bb_ovn);
555 hr_utility.TRACE ('timecard_error_rec.bb_ovn'|| p_late_reason);
556 hr_utility.TRACE ('timecard_error_rec.bb_ovn'|| p_audit_history);
557 end if;
558 /*ADVICE(646): Local program unit references an external variable (use a parameter or pull in the
559 definition) [210] */
560
561 l_reason_flag := NULL;
562 OPEN c_get_reason (
563 timecard_error_rec.bb_id,
564 timecard_error_rec.bb_ovn,
565 p_late_reason,
566 p_change_reason,
567 p_audit_history
568 /*ADVICE(656): Local program unit references an external variable (use a parameter or pull in the
569 definition) [210] */
570
571 );
572 FETCH c_get_reason INTO l_reason_flag;
573 CLOSE c_get_reason;
574
575 IF l_reason_flag IS NOT NULL THEN
576 RETURN TRUE;
577 /*ADVICE(665): A RETURN statement is used in a FOR loop [504] */
578
579 END IF;
580 END LOOP;
581 ELSE
582 FOR timecard_error_rec IN csr_get_timecard LOOP
583 l_reason_flag := NULL;
584 OPEN c_get_reason_null (timecard_error_rec.bb_id, timecard_error_rec.bb_ovn, p_audit_history
585 /*ADVICE(673): Local program unit references an external variable (use a parameter or pull in the
586 definition) [210] */
587 );
588 FETCH c_get_reason_null INTO l_reason_flag;
589 CLOSE c_get_reason_null;
590
591 IF l_reason_flag IS NOT NULL THEN
592 RETURN TRUE;
593 /*ADVICE(681): A RETURN statement is used in a FOR loop [504] */
594
595 END IF;
596 END LOOP;
597 END IF;
598
599 IF l_reason_flag IS NULL THEN
600 RETURN FALSE;
601 ELSE
602 RETURN TRUE;
603 END IF;
604 /*ADVICE(692): Last statement in function must be a RETURN [510] */
605
606 END tc_has_reason ;
607 /*ADVICE(695): Function with more than one RETURN statement in the executable section [512] */
608
609
610 --Main Query Begin
611 BEGIN
612 l_attributes := hxc_attribute_table_type ();
613 l_timecard := hxc_block_table_type ();
614 l_messages := hxc_message_table_type ();
615 g_debug :=hr_utility.debug_enabled;
616
617 -- DELETE FROM detail_temp;
618
619 --get the timekeeper setup preference for details button to decide the category
620 IF p_query_type IS NOT NULL THEN
621 g_resource_tc_table.DELETE;
622 g_submit_table.DELETE;
623 l_index := g_timekeeper_data_query.FIRST;
624
625 LOOP
626 EXIT WHEN NOT g_timekeeper_data_query.EXISTS (l_index);
627
628 IF ((p_query_type = 'CHECKBOX_ENABLED') --OR (p_query_type = 'SKIP_ENABLED')
629 ) THEN
630 g_timekeeper_data_query (l_index).check_box := 'Y';
631 END IF;
632
633 IF ((p_query_type = 'CHECKBOX_DISABLED') -- OR (p_query_type = 'SKIP_DISABLED')
634 ) THEN
635 g_timekeeper_data_query (l_index).check_box := 'N';
636 END IF;
637
638 IF g_timekeeper_data_query (l_index).check_box = 'Y' THEN
639 g_submit_table (g_timekeeper_data_query (l_index).resource_id).resource_id :=
640 g_timekeeper_data_query (l_index).resource_id;
641 g_submit_table (g_timekeeper_data_query (l_index).resource_id).timecard_id :=
642 g_timekeeper_data_query (l_index).timecard_id;
643 g_submit_table (g_timekeeper_data_query (l_index).resource_id).start_time :=
644 g_timekeeper_data_query (l_index).timecard_start_period;
645 g_submit_table (g_timekeeper_data_query (l_index).resource_id).stop_time :=
646 g_timekeeper_data_query (l_index).timecard_end_period;
647 g_submit_table (g_timekeeper_data_query (l_index).resource_id).row_lock_id :=
648 g_timekeeper_data_query (l_index).row_lock_id;
649 END IF;
650
651 IF g_resource_tc_table.EXISTS (g_timekeeper_data_query (l_index).resource_id)
652 AND g_timekeeper_data_query (l_index).check_box = 'Y' THEN
653 g_resource_tc_table (g_timekeeper_data_query (l_index).resource_id).no_rows :=
654 g_resource_tc_table (g_timekeeper_data_query (l_index).resource_id).no_rows + 1;
655 ELSE
656 IF g_timekeeper_data_query (l_index).check_box = 'Y' THEN
657 g_resource_tc_table (g_timekeeper_data_query (l_index).resource_id).no_rows := 1;
658 ELSE
659 g_resource_tc_table (g_timekeeper_data_query (l_index).resource_id).no_rows := 0;
660 END IF;
661 END IF;
662
663 l_index := g_timekeeper_data_query.NEXT (l_index);
664 END LOOP;
665
666 p_timekeeper_data := g_timekeeper_data_query;
667 ELSE -- global checkbix select
668 --get the timekeeper setup preference for details button to decide the category
669
670 IF g_base_att IS NULL THEN
671 g_base_att := hxc_preference_evaluation.resource_preferences (
672 p_resource_id => p_timekeeper_id,
673 p_pref_code => 'TK_TCARD_SETUP',
674 p_attribute_n => 4,
675 p_evaluation_date => SYSDATE
676 );
677 END IF;
678
679 IF (g_tk_finish_process) THEN
680 -- set the parameter to send back
681 p_timekeeper_data := g_tk_data_query_from_process;
682 -- reset the data
683 g_tk_data_query_from_process.DELETE;
684 g_from_tk_process := FALSE;
685 g_tk_finish_process := FALSE;
686 ELSE
687 --detail table needs to be deleted when it is queried first time
688 --to store the detail associated
689 --p_reqryflg is used to check the check box which got affected in requery only.
690
691 if g_debug then
692 hr_utility.TRACE ('p_reqryflg'|| p_reqryflg);
693 end if;
694 IF p_reqryflg = 'N' THEN
695 --ctk --empty the detail_temp table
696 g_detail_data.DELETE;
697
698 DELETE FROM hxc_tk_detail_temp; --4191367
699 /*ADVICE(786): Use of DELETE or UPDATE without WHERE clause [313] */
700
701
702 g_submit_table.DELETE;
703 g_lock_table.DELETE;
704 g_resource_tc_table.DELETE;
705 END IF;
706
707 FOR resource_info IN c_resource_info (
708 p_timekeeper_id,
709 p_start_period,
710 p_end_period,
711 p_group_id,
712 p_resource_id,
713 p_person_type
714 ) LOOP
715 BEGIN
716 g_debug :=hr_utility.debug_enabled;
717 if g_debug then
718 hr_utility.TRACE ('processing for'|| resource_info.person_id);
719 end if;
720 IF NOT (l_resource_tc_table.EXISTS (resource_info.person_id)) THEN
721 -- first thing it is to add this person into the buffer table
722
723 l_resource_tc_table (resource_info.person_id).index_string :=
724 'We are creating a timecard for this person';
725 g_resource_tc_table (resource_info.person_id).index_string :=
726 'We are creating a timecard for this person';
727 ---store the employee preferences
728
729 l_emp_negpref := NULL;
730 l_emp_recpref := NULL;
731 l_emp_appstyle := NULL;
732 l_emp_layout1 := NULL;
733 l_emp_layout2 := NULL;
734 l_emp_layout3 := NULL;
735 l_emp_layout4 := NULL;
736 l_emp_layout5 := NULL;
737 l_emp_layout6 := NULL;
738 l_emp_layout7 := NULL;
739 l_emp_layout8 := NULL;
740 l_emp_edits := NULL;
741 l_audit_enabled := NULL;
742
743 BEGIN
744 hxc_timekeeper_utilities.get_emp_pref (
745 resource_info.person_id,
746 l_emp_negpref,
747 l_emp_recpref,
748 l_emp_appstyle,
749 l_emp_layout1,
750 l_emp_layout2,
751 l_emp_layout3,
752 l_emp_layout4,
753 l_emp_layout5,
754 l_emp_layout6,
755 l_emp_layout7,
756 l_emp_layout8,
757 l_emp_edits,
758 l_pastdt,
759 l_futuredt,
760 l_emp_start_date,
761 l_emp_terminate_date,
762 l_audit_enabled
763 );
764 EXCEPTION
765 WHEN OTHERS THEN
766 IF l_terminated_list IS NOT NULL THEN
767 l_terminated_list :=
768 l_terminated_list || ' , ' || resource_info.employee_number || ' - ' || resource_info.full_name;
769 ELSE
770 l_terminated_list := resource_info.employee_number || ' - ' || resource_info.full_name;
771 END IF;
772
773 l_terminated_list := REPLACE (l_terminated_list, ', ,', ',');
774 RAISE l_pref_exception;
775 /*ADVICE(859): A WHEN OTHERS clause is used in the exception section without any other specific handlers
776 [201] */
777
778 END;
779
780 --
781 --initialize the emp_qry_tc_info table used to store the saved timecards for that person
782
783
784
785 emp_qry_tc_info.DELETE;
786 --populate emp_qry_tc_info table with saved timecards in that period
787
788 hxc_timekeeper_utilities.populate_query_tc_tab (
789 resource_info.person_id,
790 p_start_period,
791 p_end_period,
792 emp_qry_tc_info
793 );
794 ---now we check if he is mid period employee or normal employee
795 l_audit_query := FALSE;
796 if g_debug then
797 hr_utility.TRACE ('l_audit_enabled'|| l_audit_enabled);
798 hr_utility.TRACE ('p_audit_enabled'|| p_audit_enabled);
799 end if;
800 IF ( (l_audit_enabled IS NOT NULL AND p_audit_enabled = 'Y')
801 OR (l_audit_enabled IS NULL AND p_audit_enabled = 'N')
802 OR p_audit_enabled IS NULL
803 ) THEN
804 l_audit_query := TRUE;
805 END IF;
806 /*
807 IF l_audit_query THEN
808 ----hr_utility.TRACE ('l_audit_query IS TRUE');
809 ELSE
810 ----hr_utility.TRACE ('l_audit_query IS FALSE');
811 END IF;
812 JOEL */
813 l_query := FALSE;
814
815 IF emp_qry_tc_info.COUNT > 1 AND NVL (l_emp_recpref, '-999') = NVL (p_rec_periodid, '-999') THEN
816 if g_debug then
817 hr_utility.trace('Multiple Timecard exists and he is mid period change');
818 end if;
819 l_query := TRUE;
820 ELSIF emp_qry_tc_info.COUNT = 1 THEN
821 if g_debug then
822 hr_utility.trace ('Normal employee or mid period with no timecard in range');
823 end if;
824 l_query := TRUE;
825 END IF;
826
827 -- Now we are looping thro this table to query all the timecards.
828 /* JOEL
829 IF l_query THEN
830 ----hr_utility.TRACE ('l_query IS TRUE');
831 ELSE
832 ----hr_utility.TRACE ('l_query IS FALSE');
833 END IF;
834 */
835 IF l_query AND l_audit_query THEN
836 emp_tab_index := emp_qry_tc_info.FIRST;
837
838 LOOP
839 EXIT WHEN NOT emp_qry_tc_info.EXISTS (emp_tab_index);
840 l_found_timecard := FALSE;
841 --tc_start stores the timecard start period
842 --tc_end stores the timecard end period.
843
844 tc_start := TO_DATE (emp_qry_tc_info (emp_tab_index).tc_frdt, 'DD-MM-RRRR');
845 tc_end := TO_DATE (emp_qry_tc_info (emp_tab_index).tc_todt, 'DD-MM-RRRR');
846
847 IF tc_start <> p_start_period THEN
848 l_add_index_day := (tc_start - p_start_period); -- this is used to add an offset for matrix of hours
849 ELSE
850 l_add_index_day := 0;
851 END IF;
852
853 OPEN c_timecard_info (resource_info.person_id, tc_start, tc_end + g_one_day);
854 FETCH c_timecard_info INTO l_timecard_id,
855 l_timecard_ovn,
856 l_timecard_start_time,
857 l_timecard_comment_text,
858 l_created_by,
859 l_creation_date,
860 l_last_updated_by,
861 l_last_update_date,
862 l_last_update_login;
863 /*ADVICE(942): FETCH into a list of variables instead of a record [204] */
864
865
866 -- find the status of the timecard
867 IF c_timecard_info%FOUND THEN
868 -- when the hxc_timecard_summary is enable
869 -- we need to open c_timecard_status instead.
870
871
872
873 l_timecard_status :=
874 hxc_timecard_search_pkg.get_timecard_status_code (l_timecard_id, l_timecard_ovn);
875 l_timecard_status_meaning :=
876 hr_bis.bis_decode_lookup ('HXC_APPROVAL_STATUS', l_timecard_status);
877 END IF;
878
879 IF p_status_code IS NULL THEN
880 l_status_code := l_timecard_status;
881 ELSE
882 l_status_code := p_status_code;
883 END IF;
884
885 if g_debug then
886 hr_utility.TRACE ('p_message_type'|| p_message_type);
887 hr_utility.TRACE ('p_message_text'|| p_message_text);
888 end if;
889 -- check for timecard message associated
890 IF tc_has_message (l_timecard_id, l_timecard_ovn, p_message_type, p_message_text) THEN
891 l_timecard_message_code := 'MESSAGE';
892 l_timecard_message := hr_bis.bis_decode_lookup ('HXC_TK_MESSAGE', l_timecard_message_code);
893 ELSE
894 l_timecard_message_code := NULL;
895 l_timecard_message := NULL;
896 END IF;
897
898 IF tc_has_reason (l_timecard_id, l_timecard_ovn, p_late_reason, p_change_reason) THEN
899 l_timecard_reason_code := 'REASON';
900 if g_debug then
901 hr_utility.TRACE ('yes tc has reason');
902 end if;
903 /* l_timecard_message :=
904 hr_bis.bis_decode_lookup(
905 'HXC_TK_MESSAGE',
906 l_timecard_message_code
907 );*/
908 ELSE
909 if g_debug then
910 hr_utility.TRACE ('no reason'|| l_timecard_reason_code);
911 end if;
912 l_timecard_reason_code := NULL;
913
914 -- l_timecard_message := NULL;
915 END IF;
916
917 IF c_timecard_info%FOUND
918 AND l_timecard_status = l_status_code
919 AND (p_message_type IS NULL OR l_timecard_message_code = 'MESSAGE')
920 AND (p_message_text IS NULL OR l_timecard_message_code = 'MESSAGE')
921 AND (p_change_reason IS NULL OR l_timecard_reason_code = 'REASON')
922 AND (p_late_reason IS NULL OR l_timecard_reason_code = 'REASON')
923 AND (p_audit_history IS NULL OR l_timecard_reason_code = 'REASON') THEN
924 --now we lock the timecard
925 IF p_reqryflg = 'N' AND p_lock_profile = 'Y' THEN
926 --lock only when user does fresh find
927
928 l_row_id := NULL;
929 l_row_lock_id := NULL;
930 l_tc_lock_success := 'FALSE';
931 hxc_lock_api.request_lock (
932 p_process_locker_type => l_process_lock_type,
933 p_resource_id => resource_info.person_id,
934 p_start_time => p_start_period,
935 p_stop_time => p_end_period + g_one_day,
936 p_time_building_block_id => NULL,
937 p_time_building_block_ovn => NULL,
938 p_transaction_lock_id => l_lock_trx_id,
939 p_messages => l_messages,
940 p_row_lock_id => l_row_id,
941 p_locked_success => l_tc_lock_boolean
942 );
943 l_row_lock_id := ROWIDTOCHAR (l_row_id);
944
945 IF l_tc_lock_boolean THEN
946 l_tc_lock_success := 'TRUE';
947 g_lock_table (resource_info.person_id).row_lock_id := l_row_id;
948 g_lock_table (resource_info.person_id).resource_id := resource_info.person_id;
949 g_lock_table (resource_info.person_id).timecard_id := l_timecard_id;
950 g_lock_table (resource_info.person_id).start_time := p_start_period;
951 g_lock_table (resource_info.person_id).stop_time := p_end_period + g_one_day;
952 ELSE
953 l_tc_lock_success := 'FALSE';
954 END IF;
955 --nitin check
956 --l_resource_tc_table (resource_info.person_id).lockid:=l_row_lock_id;
957 ELSE
958 IF l_row_lock_id IS NOT NULL THEN
959 l_tc_lock_success := 'TRUE';
960 ELSE
961 l_tc_lock_success := 'FALSE';
962 END IF;
963 END IF;
964
965
966 -- CLOSE c_timecard_info;
967
968 l_buffer_info.DELETE;
969 l_index_buffer := 0;
970
971 -- rest the l_attribute_index
972 l_attribute_index := 0;
973 l_found_detail := FALSE;
974
975 --populate the attribute table
976 l_attributes.DELETE;
977 l_detail_info_table.DELETE;
978
979 --delete l_timecard before populating
980 l_timecard.DELETE;
981
982
983 if g_debug then
984 hr_utility.trace('l_timecard_id'||l_timecard_id||' l_timecard_onv'||l_timecard_ovn);
985 end if;
986 -- populate detail information for this timecard
987 FOR detail_info IN c_detail_info (l_timecard_id, l_timecard_ovn) LOOP
988 l_detail_info_table (detail_info.detail_id).detail_id := detail_info.detail_id;
989 l_detail_info_table (detail_info.detail_id).detail_ovn := detail_info.detail_ovn;
990 l_detail_info_table (detail_info.detail_id).measure := detail_info.measure;
991 l_detail_info_table (detail_info.detail_id).start_time := detail_info.start_time;
992 l_detail_info_table (detail_info.detail_id).time_in := detail_info.time_in;
993 l_detail_info_table (detail_info.detail_id).time_out := detail_info.time_out;
994 l_detail_info_table (detail_info.detail_id).detail_comment_text := detail_info.comment_text;
995 END LOOP;
996 /*ADVICE(1067): Nested LOOPs should all be labeled [406] */
997
998
999
1000 -- Get the data actually stored in the database.
1001
1002
1003 hxc_timekeeper_utilities.create_attribute_structure (
1004 p_timecard_id => l_timecard_id,
1005 p_timecard_ovn => l_timecard_ovn,
1006 p_resource_id => resource_info.person_id,
1007 p_start_period => tc_start,
1008 p_end_period => tc_end,
1009 p_attributes => l_attributes,
1010 p_add_hours_type_id => NULL,
1011 p_attribute_index_info => l_attribute_index_info
1012 );
1013 --create timecard block
1014
1015
1016 create_timecard_day_structure (
1017 p_resource_id => resource_info.person_id,
1018 p_start_period => tc_start,
1019 p_end_period => tc_end,
1020 p_tc_frdt => tc_start,
1021 p_tc_todt => tc_end,
1022 p_timecard => l_timecard,
1023 p_attributes => l_attributes,
1024 p_day_id_info_table => l_day_id_info_table,
1025 p_approval_style_id => l_approval_style_id,
1026 p_approval_status => l_approval_status,
1027 p_comment_text => l_timecard_comment_text,
1028 p_timecard_status => l_timecard_status,
1029 p_attribute_index_info => l_attribute_index_info,
1030 p_timecard_index_info => l_timecard_index_info,
1031 p_timecard_id => l_timecard_id
1032 );
1033
1034 -- call the alias translator to translate the attributes to OTL_ALIAS_ITEM_1...
1035
1036 IF (l_attributes.COUNT > 0) THEN
1037 if g_debug then
1038 hr_utility.trace ('count is greater');
1039 end if;
1040 hxc_alias_translator.do_retrieval_translation (
1041 p_attributes => l_attributes,
1042 p_blocks => l_timecard,
1043 p_start_time => tc_start,
1044 p_stop_time => tc_end,
1045 p_resource_id => p_timekeeper_id,
1046 p_processing_mode => hxc_alias_utility.c_tk_processing,
1047 p_messages => l_messages
1048 );
1049 --t_base_table--used to take the output of translator and convert into matrix
1050
1051 t_base_index := 1;
1052 t_base_table.DELETE;
1053
1054
1055 /*1 my_debug.print_attributes(
1056 '111',
1057 l_attributes
1058 );*/
1059 --
1060
1061 FOR x IN c_detail_info (l_timecard_id, l_timecard_ovn) LOOP
1062 l_attribute_index := l_attributes.FIRST;
1063
1064 LOOP
1065 EXIT WHEN NOT l_attributes.EXISTS (l_attribute_index);
1066 if g_debug then
1067 hr_utility.TRACE (l_attributes (l_attribute_index).attribute_category);
1068 end if;
1069
1070 --
1071
1072 IF l_attributes ( ---1
1073 l_attribute_index).building_block_id = x.detail_id
1074 AND l_attributes (l_attribute_index).attribute_category LIKE 'OTL_ALIAS_ITEM_%' THEN
1075 t_base_table (t_base_index).base_id := l_attributes (l_attribute_index).building_block_id;
1076
1077 IF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_1' THEN
1078 t_base_table (t_base_index).attribute1 := l_attributes (l_attribute_index).attribute1;
1079 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_2' THEN
1080 t_base_table (t_base_index).attribute2 := l_attributes (l_attribute_index).attribute1;
1081 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_3' THEN
1082 t_base_table (t_base_index).attribute3 := l_attributes (l_attribute_index).attribute1;
1083 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_4' THEN
1084 t_base_table (t_base_index).attribute4 := l_attributes (l_attribute_index).attribute1;
1085 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_5' THEN
1086 t_base_table (t_base_index).attribute5 := l_attributes (l_attribute_index).attribute1;
1087 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_6' THEN
1088 t_base_table (t_base_index).attribute6 := l_attributes (l_attribute_index).attribute1;
1089 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_7' THEN
1090 t_base_table (t_base_index).attribute7 := l_attributes (l_attribute_index).attribute1;
1091 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_8' THEN
1092 t_base_table (t_base_index).attribute8 := l_attributes (l_attribute_index).attribute1;
1093 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_9' THEN
1094 t_base_table (t_base_index).attribute9 := l_attributes (l_attribute_index).attribute1;
1095 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_10' THEN
1096 t_base_table (t_base_index).attribute10 := l_attributes (l_attribute_index).attribute1;
1097 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_11' THEN
1098 t_base_table (t_base_index).attribute11 := l_attributes (l_attribute_index).attribute1;
1099 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_12' THEN
1100 t_base_table (t_base_index).attribute12 := l_attributes (l_attribute_index).attribute1;
1101 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_13' THEN
1102 t_base_table (t_base_index).attribute13 := l_attributes (l_attribute_index).attribute1;
1103 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_14' THEN
1104 t_base_table (t_base_index).attribute14 := l_attributes (l_attribute_index).attribute1;
1105 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_15' THEN
1106 t_base_table (t_base_index).attribute15 := l_attributes (l_attribute_index).attribute1;
1107 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_16' THEN
1108 t_base_table (t_base_index).attribute16 := l_attributes (l_attribute_index).attribute1;
1109 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_17' THEN
1110 t_base_table (t_base_index).attribute17 := l_attributes (l_attribute_index).attribute1;
1111 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_18' THEN
1112 t_base_table (t_base_index).attribute18 := l_attributes (l_attribute_index).attribute1;
1113 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_19' THEN
1114 t_base_table (t_base_index).attribute19 := l_attributes (l_attribute_index).attribute1;
1115 ELSIF l_attributes (l_attribute_index).attribute_category = 'OTL_ALIAS_ITEM_20' THEN
1116 t_base_table (t_base_index).attribute20 := l_attributes (l_attribute_index).attribute1;
1117 END IF;
1118 ELSIF l_attributes (l_attribute_index).building_block_id = x.detail_id
1119 AND l_attributes (l_attribute_index).attribute_category LIKE 'PAEXPITDFF%' THEN
1120 if g_debug then
1121 hr_utility.TRACE ('100');
1122 hr_utility.TRACE ('inserting='|| x.comment_text || ' for x.detail_id= ' || x.detail_id);
1123 end if;
1124
1125 --
1126
1127 IF c%ISOPEN THEN
1128 CLOSE c;
1129 END IF;
1130
1131 OPEN c (x.detail_id);
1132 FETCH c INTO c_row;
1133
1134 IF c%FOUND THEN
1135 UPDATE hxc_tk_detail_temp
1136 SET dff_catg = l_attributes (l_attribute_index).attribute_category,
1137 dff_oldcatg = l_attributes (l_attribute_index).attribute_category,
1138 dff_attr1 = l_attributes (l_attribute_index).attribute1,
1139 dff_attr2 = l_attributes (l_attribute_index).attribute2,
1140 dff_attr3 = l_attributes (l_attribute_index).attribute3,
1141 dff_attr4 = l_attributes (l_attribute_index).attribute4,
1142 dff_attr5 = l_attributes (l_attribute_index).attribute5,
1143 dff_attr6 = l_attributes (l_attribute_index).attribute6,
1144 dff_attr7 = l_attributes (l_attribute_index).attribute7,
1145 dff_attr8 = l_attributes (l_attribute_index).attribute8,
1146 dff_attr9 = l_attributes (l_attribute_index).attribute9,
1147 dff_attr10 = l_attributes (l_attribute_index).attribute10,
1148 dff_attr11 = l_attributes (l_attribute_index).attribute11,
1149 dff_attr12 = l_attributes (l_attribute_index).attribute12,
1150 dff_attr13 = l_attributes (l_attribute_index).attribute13,
1151 dff_attr14 = l_attributes (l_attribute_index).attribute14,
1152 dff_attr15 = l_attributes (l_attribute_index).attribute15,
1153 dff_attr16 = l_attributes (l_attribute_index).attribute16,
1154 dff_attr17 = l_attributes (l_attribute_index).attribute17,
1155 dff_attr18 = l_attributes (l_attribute_index).attribute18,
1156 dff_attr19 = l_attributes (l_attribute_index).attribute19,
1157 dff_attr20 = l_attributes (l_attribute_index).attribute20,
1158 dff_attr21 = l_attributes (l_attribute_index).attribute21,
1159 dff_attr22 = l_attributes (l_attribute_index).attribute22,
1160 dff_attr23 = l_attributes (l_attribute_index).attribute23,
1161 dff_attr24 = l_attributes (l_attribute_index).attribute24,
1162 dff_attr25 = l_attributes (l_attribute_index).attribute25,
1163 dff_attr26 = l_attributes (l_attribute_index).attribute26,
1164 dff_attr27 = l_attributes (l_attribute_index).attribute27,
1165 dff_attr28 = l_attributes (l_attribute_index).attribute28,
1166 dff_attr29 = l_attributes (l_attribute_index).attribute29,
1167 dff_attr30 = l_attributes (l_attribute_index).attribute30,
1168 dff_oldattr1 = l_attributes (l_attribute_index).attribute1,
1169 dff_oldattr2 = l_attributes (l_attribute_index).attribute2,
1170 dff_oldattr3 = l_attributes (l_attribute_index).attribute3,
1171 dff_oldattr4 = l_attributes (l_attribute_index).attribute4,
1172 dff_oldattr5 = l_attributes (l_attribute_index).attribute5,
1173 dff_oldattr6 = l_attributes (l_attribute_index).attribute6,
1174 dff_oldattr7 = l_attributes (l_attribute_index).attribute7,
1175 dff_oldattr8 = l_attributes (l_attribute_index).attribute8,
1176 dff_oldattr9 = l_attributes (l_attribute_index).attribute9,
1177 dff_oldattr10 = l_attributes (l_attribute_index).attribute10,
1178 dff_oldattr11 = l_attributes (l_attribute_index).attribute11,
1179 dff_oldattr12 = l_attributes (l_attribute_index).attribute12,
1180 dff_oldattr13 = l_attributes (l_attribute_index).attribute13,
1181 dff_oldattr14 = l_attributes (l_attribute_index).attribute14,
1182 dff_oldattr15 = l_attributes (l_attribute_index).attribute15,
1183 dff_oldattr16 = l_attributes (l_attribute_index).attribute16,
1184 dff_oldattr17 = l_attributes (l_attribute_index).attribute17,
1185 dff_oldattr18 = l_attributes (l_attribute_index).attribute18,
1186 dff_oldattr19 = l_attributes (l_attribute_index).attribute19,
1187 dff_oldattr20 = l_attributes (l_attribute_index).attribute20,
1188 dff_oldattr21 = l_attributes (l_attribute_index).attribute21,
1189 dff_oldattr22 = l_attributes (l_attribute_index).attribute22,
1190 dff_oldattr23 = l_attributes (l_attribute_index).attribute23,
1191 dff_oldattr24 = l_attributes (l_attribute_index).attribute24,
1192 dff_oldattr25 = l_attributes (l_attribute_index).attribute25,
1193 dff_oldattr26 = l_attributes (l_attribute_index).attribute26,
1194 dff_oldattr27 = l_attributes (l_attribute_index).attribute27,
1195 dff_oldattr28 = l_attributes (l_attribute_index).attribute28,
1196 dff_oldattr29 = l_attributes (l_attribute_index).attribute29,
1197 dff_oldattr30 = l_attributes (l_attribute_index).attribute30
1198 WHERE detailid = x.detail_id;
1199 ELSE
1200 INSERT INTO hxc_tk_detail_temp
1201 (detailid, timecard_id, resource_id, comment_text, dff_catg, dff_oldcatg,
1202 dff_attr1, dff_attr2, dff_attr3, dff_attr4, dff_attr5, dff_attr6, dff_attr7,
1203 dff_attr8, dff_attr9, dff_attr10, dff_attr11, dff_attr12, dff_attr13,
1204 dff_attr14, dff_attr15, dff_attr16, dff_attr17, dff_attr18, dff_attr19,
1205 dff_attr20, dff_attr21, dff_attr22, dff_attr23, dff_attr24, dff_attr25,
1206 dff_attr26, dff_attr27, dff_attr28, dff_attr29, dff_attr30, dff_oldattr1,
1207 dff_oldattr2, dff_oldattr3, dff_oldattr4, dff_oldattr5, dff_oldattr6,
1208 dff_oldattr7, dff_oldattr8, dff_oldattr9, dff_oldattr10, dff_oldattr11,
1209 dff_oldattr12, dff_oldattr13, dff_oldattr14, dff_oldattr15, dff_oldattr16,
1210 dff_oldattr17, dff_oldattr18, dff_oldattr19, dff_oldattr20, dff_oldattr21,
1211 dff_oldattr22, dff_oldattr23, dff_oldattr24, dff_oldattr25, dff_oldattr26,
1212 dff_oldattr27, dff_oldattr28, dff_oldattr29, dff_oldattr30)
1213 VALUES (x.detail_id, l_timecard_id, p_resource_id, x.comment_text,
1214 l_attributes (l_attribute_index).attribute_category,
1215 l_attributes (l_attribute_index).attribute_category,
1216 l_attributes (l_attribute_index).attribute1,
1217 l_attributes (l_attribute_index).attribute2,
1218 l_attributes (l_attribute_index).attribute3,
1219 l_attributes (l_attribute_index).attribute4,
1220 l_attributes (l_attribute_index).attribute5,
1221 l_attributes (l_attribute_index).attribute6,
1222 l_attributes (l_attribute_index).attribute7,
1223 l_attributes (l_attribute_index).attribute8,
1224 l_attributes (l_attribute_index).attribute9,
1225 l_attributes (l_attribute_index).attribute10,
1226 l_attributes (l_attribute_index).attribute11,
1227 l_attributes (l_attribute_index).attribute12,
1228 l_attributes (l_attribute_index).attribute13,
1229 l_attributes (l_attribute_index).attribute14,
1230 l_attributes (l_attribute_index).attribute15,
1231 l_attributes (l_attribute_index).attribute16,
1232 l_attributes (l_attribute_index).attribute17,
1233 l_attributes (l_attribute_index).attribute18,
1234 l_attributes (l_attribute_index).attribute19,
1235 l_attributes (l_attribute_index).attribute20,
1236 l_attributes (l_attribute_index).attribute21,
1237 l_attributes (l_attribute_index).attribute22,
1238 l_attributes (l_attribute_index).attribute23,
1239 l_attributes (l_attribute_index).attribute24,
1240 l_attributes (l_attribute_index).attribute25,
1241 l_attributes (l_attribute_index).attribute26,
1242 l_attributes (l_attribute_index).attribute27,
1243 l_attributes (l_attribute_index).attribute28,
1244 l_attributes (l_attribute_index).attribute29,
1245 l_attributes (l_attribute_index).attribute30,
1246 l_attributes (l_attribute_index).attribute1,
1247 l_attributes (l_attribute_index).attribute2,
1248 l_attributes (l_attribute_index).attribute3,
1249 l_attributes (l_attribute_index).attribute4,
1250 l_attributes (l_attribute_index).attribute5,
1251 l_attributes (l_attribute_index).attribute6,
1252 l_attributes (l_attribute_index).attribute7,
1253 l_attributes (l_attribute_index).attribute8,
1254 l_attributes (l_attribute_index).attribute9,
1255 l_attributes (l_attribute_index).attribute10,
1256 l_attributes (l_attribute_index).attribute11,
1257 l_attributes (l_attribute_index).attribute12,
1258 l_attributes (l_attribute_index).attribute13,
1259 l_attributes (l_attribute_index).attribute14,
1260 l_attributes (l_attribute_index).attribute15,
1261 l_attributes (l_attribute_index).attribute16,
1262 l_attributes (l_attribute_index).attribute17,
1263 l_attributes (l_attribute_index).attribute18,
1264 l_attributes (l_attribute_index).attribute19,
1265 l_attributes (l_attribute_index).attribute20,
1266 l_attributes (l_attribute_index).attribute21,
1267 l_attributes (l_attribute_index).attribute22,
1268 l_attributes (l_attribute_index).attribute23,
1269 l_attributes (l_attribute_index).attribute24,
1270 l_attributes (l_attribute_index).attribute25,
1271 l_attributes (l_attribute_index).attribute26,
1272 l_attributes (l_attribute_index).attribute27,
1273 l_attributes (l_attribute_index).attribute28,
1274 l_attributes (l_attribute_index).attribute29,
1275 l_attributes (l_attribute_index).attribute30);
1276 END IF;
1277
1278 CLOSE c;
1279 ELSIF l_attributes (l_attribute_index).building_block_id = x.detail_id
1280 AND l_attributes (l_attribute_index).attribute_category = 'REASON' THEN
1281 if g_debug then
1282 hr_utility.TRACE ('REASON');
1283 hr_utility.TRACE (
1284 'inserting REASON='|| x.comment_text || ' for x.detail_id= ' || x.detail_id
1285 );
1286 hr_utility.TRACE ('LATE/CHANGE:'|| l_attributes (l_attribute_index).attribute3);
1287 hr_utility.TRACE ('LATE/CHANGE COMMENT'|| l_attributes (l_attribute_index).attribute2);
1288 hr_utility.TRACE ('CODE'|| l_attributes (l_attribute_index).attribute1);
1289 end if;
1290
1291 --
1292
1293 IF c%ISOPEN THEN
1294 CLOSE c;
1295 END IF;
1296
1297 OPEN c (x.detail_id);
1298 FETCH c INTO c_row;
1299
1300 IF c%FOUND THEN
1301 if g_debug then
1302 hr_utility.TRACE ('detail found'|| x.detail_id);
1303 end if;
1304
1305 --
1306
1307 IF (l_attributes (l_attribute_index).attribute3 = 'LATE') THEN
1308 /* JOEL => we are missing old_audit_datetime in the table*/
1309 UPDATE hxc_tk_detail_temp
1310 SET late_change = 'LATE',
1311 old_late_change = 'LATE',
1312 change_comment = NULL,
1313 old_change_comment = NULL,
1314 change_reason = NULL,
1315 old_change_reason = NULL, --dhar
1316 late_comment = l_attributes (l_attribute_index).attribute2,
1317 old_late_comment = l_attributes (l_attribute_index).attribute2,
1318 late_reason = l_attributes (l_attribute_index).attribute1,
1319 old_late_reason = l_attributes (l_attribute_index).attribute1,
1320 audit_datetime = l_attributes (l_attribute_index).attribute6,
1321 old_audit_datetime = l_attributes (l_attribute_index).attribute6,
1322 audit_history = l_attributes (l_attribute_index).attribute7,
1323 old_audit_history = l_attributes (l_attribute_index).attribute7
1324 WHERE detailid = x.detail_id;
1325 --JOEL let make sure it is a change
1326 ELSIF (l_attributes (l_attribute_index).attribute3 = 'CHANGE') THEN -- change
1327
1328 /* IF (l_attributes ( l_attribute_index ).attribute3)='CHANGE'
1329 THEN*/
1330 UPDATE hxc_tk_detail_temp
1331 SET late_change = 'CHANGE',
1332 old_late_change = 'CHANGE',
1333 late_comment = NULL,
1334 old_late_comment = NULL,
1335 late_reason = NULL,
1336 old_late_reason = NULL, --dhar
1337 change_comment = l_attributes (l_attribute_index).attribute2,
1338 old_change_comment = l_attributes (l_attribute_index).attribute2,
1339 change_reason = l_attributes (l_attribute_index).attribute1,
1340 old_change_reason = l_attributes (l_attribute_index).attribute1,
1341 audit_datetime = l_attributes (l_attribute_index).attribute6,
1342 old_audit_datetime = l_attributes (l_attribute_index).attribute6,
1343 audit_history = l_attributes (l_attribute_index).attribute7,
1344 old_audit_history = l_attributes (l_attribute_index).attribute7
1345 WHERE detailid = x.detail_id;
1346
1347 ELSIF (l_attributes (l_attribute_index).attribute3 is null) THEN
1348
1349 UPDATE hxc_tk_detail_temp
1350 SET late_change = NULL,
1351 old_late_change = NULL,
1352 late_comment = NULL,
1353 old_late_comment = NULL,
1354 late_reason = NULL,
1355 old_late_reason = NULL, --dhar
1356 change_comment = l_attributes (l_attribute_index).attribute2,
1357 old_change_comment = l_attributes (l_attribute_index).attribute2,
1358 change_reason = l_attributes (l_attribute_index).attribute1,
1359 old_change_reason = l_attributes (l_attribute_index).attribute1,
1360 audit_datetime = l_attributes (l_attribute_index).attribute6,
1361 old_audit_datetime = l_attributes (l_attribute_index).attribute6,
1362 audit_history = l_attributes (l_attribute_index).attribute7,
1363 old_audit_history = l_attributes (l_attribute_index).attribute7
1364 WHERE detailid = x.detail_id;
1365
1366
1367
1368
1369 END IF; -- late or change
1370
1371 ---after adding the negative detail id, it is not present in the db..so it requires to be inserted
1372 --while all positive detail id can be update.
1373 ELSE -- no detailid --so insert
1374 IF (l_attributes (l_attribute_index).attribute3 = 'LATE') THEN
1375 if g_debug then
1376 hr_utility.TRACE ('late reason');
1377 end if;
1378
1379 --
1380
1381 INSERT INTO hxc_tk_detail_temp
1382 (detailid, timecard_id, resource_id, comment_text, late_change, old_late_change,
1383 late_reason,
1384 late_comment, old_late_reason, old_late_comment, audit_datetime,
1385 old_audit_datetime,
1386 audit_history, old_audit_history)
1387 VALUES (x.detail_id, l_timecard_id, p_resource_id, x.comment_text,
1388 'LATE',
1389 'LATE',
1390 l_attributes (l_attribute_index).attribute1,
1391 l_attributes (l_attribute_index).attribute2,
1392 l_attributes (l_attribute_index).attribute1,
1393 l_attributes (l_attribute_index).attribute2,
1394 l_attributes (l_attribute_index).attribute6,
1395 l_attributes (l_attribute_index).attribute6,
1396 l_attributes (l_attribute_index).attribute7,
1397 l_attributes (l_attribute_index).attribute7);
1398
1399 ELSIF (l_attributes (l_attribute_index).attribute3 = 'CHANGE') THEN
1400
1401 INSERT INTO hxc_tk_detail_temp
1402 (detailid, timecard_id, resource_id, comment_text, late_change,old_late_change,
1403 change_reason,
1404 change_comment, old_change_reason, old_change_comment, audit_datetime,
1405 old_audit_datetime,
1406 audit_history, old_audit_history)
1407 VALUES (x.detail_id, l_timecard_id, p_resource_id, x.comment_text,
1408 'CHANGE','CHANGE',
1409 l_attributes (l_attribute_index).attribute1,
1410 l_attributes (l_attribute_index).attribute2,
1411 l_attributes (l_attribute_index).attribute1,
1412 l_attributes (l_attribute_index).attribute2,
1413 l_attributes (l_attribute_index).attribute6,
1414 l_attributes (l_attribute_index).attribute6,
1415 l_attributes (l_attribute_index).attribute7,
1416 l_attributes (l_attribute_index).attribute7);
1417
1418 ELSIF (l_attributes (l_attribute_index).attribute3 is null) THEN
1419
1420 INSERT INTO hxc_tk_detail_temp
1421 (detailid, timecard_id, resource_id, comment_text, late_change,old_late_change,
1422 change_reason,
1423 change_comment, old_change_reason, old_change_comment, audit_datetime,
1424 old_audit_datetime,
1425 audit_history, old_audit_history)
1426 VALUES (x.detail_id, l_timecard_id, p_resource_id, x.comment_text,
1427 NULL,NULL,
1428 l_attributes (l_attribute_index).attribute1,
1429 l_attributes (l_attribute_index).attribute2,
1430 l_attributes (l_attribute_index).attribute1,
1431 l_attributes (l_attribute_index).attribute2,
1432 l_attributes (l_attribute_index).attribute6,
1433 l_attributes (l_attribute_index).attribute6,
1434 l_attributes (l_attribute_index).attribute7,
1435 l_attributes (l_attribute_index).attribute7);
1436
1437
1438 END IF; --reason is late
1439 END IF; --if detail is found
1440
1441 CLOSE c;
1442 END IF; --if the attribute category
1443
1444 l_attribute_index := l_attributes.NEXT (l_attribute_index);
1445 END LOOP;
1446 /*ADVICE(1462): Nested LOOPs should all be labeled [406] */
1447
1448
1449 t_base_index := t_base_index + 1;
1450 END LOOP;
1451 /*ADVICE(1467): Nested LOOPs should all be labeled [406] */
1452
1453
1454 -- Populate the final table based on the attribute information
1455
1456 t_base_index := t_base_table.FIRST;
1457
1458 LOOP
1459 EXIT WHEN (NOT t_base_table.EXISTS (t_base_index));
1460
1461 IF ( NVL (t_base_table (t_base_index).attribute1, 1) =
1462 NVL (NVL (p_attribute1, t_base_table (t_base_index).attribute1), 1)
1463 AND NVL (t_base_table (t_base_index).attribute2, 1) =
1464 NVL (NVL (p_attribute2, t_base_table (t_base_index).attribute2), 1)
1465 AND NVL (t_base_table (t_base_index).attribute3, 1) =
1466 NVL (NVL (p_attribute3, t_base_table (t_base_index).attribute3), 1)
1467 AND NVL (t_base_table (t_base_index).attribute4, 1) =
1468 NVL (NVL (p_attribute4, t_base_table (t_base_index).attribute4), 1)
1469 AND NVL (t_base_table (t_base_index).attribute5, 1) =
1470 NVL (NVL (p_attribute5, t_base_table (t_base_index).attribute5), 1)
1471 AND NVL (t_base_table (t_base_index).attribute6, 1) =
1472 NVL (NVL (p_attribute6, t_base_table (t_base_index).attribute6), 1)
1473 AND NVL (t_base_table (t_base_index).attribute7, 1) =
1474 NVL (NVL (p_attribute7, t_base_table (t_base_index).attribute7), 1)
1475 AND NVL (t_base_table (t_base_index).attribute8, 1) =
1476 NVL (NVL (p_attribute8, t_base_table (t_base_index).attribute8), 1)
1477 AND NVL (t_base_table (t_base_index).attribute9, 1) =
1478 NVL (NVL (p_attribute9, t_base_table (t_base_index).attribute9), 1)
1479 AND NVL (t_base_table (t_base_index).attribute10, 1) =
1480 NVL (NVL (p_attribute10, t_base_table (t_base_index).attribute10), 1)
1481 AND NVL (t_base_table (t_base_index).attribute11, 1) =
1482 NVL (NVL (p_attribute11, t_base_table (t_base_index).attribute11), 1)
1483 AND NVL (t_base_table (t_base_index).attribute12, 1) =
1484 NVL (NVL (p_attribute12, t_base_table (t_base_index).attribute12), 1)
1485 AND NVL (t_base_table (t_base_index).attribute13, 1) =
1486 NVL (NVL (p_attribute13, t_base_table (t_base_index).attribute13), 1)
1487 AND NVL (t_base_table (t_base_index).attribute14, 1) =
1488 NVL (NVL (p_attribute14, t_base_table (t_base_index).attribute14), 1)
1489 AND NVL (t_base_table (t_base_index).attribute15, 1) =
1490 NVL (NVL (p_attribute15, t_base_table (t_base_index).attribute15), 1)
1491 AND NVL (t_base_table (t_base_index).attribute16, 1) =
1492 NVL (NVL (p_attribute16, t_base_table (t_base_index).attribute16), 1)
1493 AND NVL (t_base_table (t_base_index).attribute17, 1) =
1494 NVL (NVL (p_attribute17, t_base_table (t_base_index).attribute17), 1)
1495 AND NVL (t_base_table (t_base_index).attribute18, 1) =
1496 NVL (NVL (p_attribute18, t_base_table (t_base_index).attribute18), 1)
1497 AND NVL (t_base_table (t_base_index).attribute19, 1) =
1498 NVL (NVL (p_attribute19, t_base_table (t_base_index).attribute19), 1)
1499 AND NVL (t_base_table (t_base_index).attribute20, 1) =
1500 NVL (NVL (p_attribute20, t_base_table (t_base_index).attribute20), 1)
1501 ) THEN
1502 -- first time in the loop
1503 -- put the first value
1504 IF l_buffer_info.COUNT = 0 THEN
1505 l_table_counter := l_table_counter + 1;
1506 l_index_buffer := l_index_buffer + 1;
1507 l_buffer_info (l_index_buffer).row_table_index := l_table_counter;
1508 l_buffer_info (l_index_buffer).attribute1 := t_base_table (t_base_index).attribute1;
1509 l_buffer_info (l_index_buffer).attribute2 := t_base_table (t_base_index).attribute2;
1510 l_buffer_info (l_index_buffer).attribute3 := t_base_table (t_base_index).attribute3;
1511 l_buffer_info (l_index_buffer).attribute4 := t_base_table (t_base_index).attribute4;
1512 l_buffer_info (l_index_buffer).attribute5 := t_base_table (t_base_index).attribute5;
1513 l_buffer_info (l_index_buffer).attribute6 := t_base_table (t_base_index).attribute6;
1514 l_buffer_info (l_index_buffer).attribute7 := t_base_table (t_base_index).attribute7;
1515 l_buffer_info (l_index_buffer).attribute8 := t_base_table (t_base_index).attribute8;
1516 l_buffer_info (l_index_buffer).attribute9 := t_base_table (t_base_index).attribute9;
1517 l_buffer_info (l_index_buffer).attribute10 := t_base_table (t_base_index).attribute10;
1518 l_buffer_info (l_index_buffer).attribute11 := t_base_table (t_base_index).attribute11;
1519 l_buffer_info (l_index_buffer).attribute12 := t_base_table (t_base_index).attribute12;
1520 l_buffer_info (l_index_buffer).attribute13 := t_base_table (t_base_index).attribute13;
1521 l_buffer_info (l_index_buffer).attribute14 := t_base_table (t_base_index).attribute14;
1522 l_buffer_info (l_index_buffer).attribute15 := t_base_table (t_base_index).attribute15;
1523 l_buffer_info (l_index_buffer).attribute16 := t_base_table (t_base_index).attribute16;
1524 l_buffer_info (l_index_buffer).attribute17 := t_base_table (t_base_index).attribute17;
1525 l_buffer_info (l_index_buffer).attribute18 := t_base_table (t_base_index).attribute18;
1526 l_buffer_info (l_index_buffer).attribute19 := t_base_table (t_base_index).attribute19;
1527 l_buffer_info (l_index_buffer).attribute20 := t_base_table (t_base_index).attribute20;
1528 END IF;
1529
1530 -- find detail information
1531 l_detail_id := l_detail_info_table (t_base_table (t_base_index).base_id).detail_id;
1532 l_detail_ovn := l_detail_info_table (t_base_table (t_base_index).base_id).detail_ovn;
1533 l_detail_measure := l_detail_info_table (t_base_table (t_base_index).base_id).measure;
1534 l_detail_start_time := l_detail_info_table (t_base_table (t_base_index).base_id).start_time;
1535 l_detail_time_in := l_detail_info_table (t_base_table (t_base_index).base_id).time_in;
1536 l_detail_time_out := l_detail_info_table (t_base_table (t_base_index).base_id).time_out;
1537 l_detail_comment_text :=
1538 l_detail_info_table (t_base_table (t_base_index).base_id).detail_comment_text;
1539 -- remove the detail now in the table.
1540
1541
1542 l_detail_info_table.DELETE (t_base_table (t_base_index).base_id);
1543 l_found_detail := TRUE;
1544 l_index_buffer := l_buffer_info.FIRST;
1545
1546 -- search if the hours type exists already
1547 -- in the table
1548 -- we are going through the table to make sure
1549 -- we will be on the last index of this hours type
1550
1551 LOOP
1552 EXIT WHEN (NOT l_buffer_info.EXISTS (l_index_buffer));
1553
1554 IF NVL (l_buffer_info (l_index_buffer).attribute1, 1) =
1555 NVL (t_base_table (t_base_index).attribute1, 1)
1556 AND NVL (l_buffer_info (l_index_buffer).attribute2, 1) =
1557 NVL (t_base_table (t_base_index).attribute2, 1)
1558 AND NVL (l_buffer_info (l_index_buffer).attribute3, 1) =
1559 NVL (t_base_table (t_base_index).attribute3, 1)
1560 AND NVL (l_buffer_info (l_index_buffer).attribute4, 1) =
1561 NVL (t_base_table (t_base_index).attribute4, 1)
1562 AND NVL (l_buffer_info (l_index_buffer).attribute5, 1) =
1563 NVL (t_base_table (t_base_index).attribute5, 1)
1564 AND NVL (l_buffer_info (l_index_buffer).attribute6, 1) =
1565 NVL (t_base_table (t_base_index).attribute6, 1)
1566 AND NVL (l_buffer_info (l_index_buffer).attribute7, 1) =
1567 NVL (t_base_table (t_base_index).attribute7, 1)
1568 AND NVL (l_buffer_info (l_index_buffer).attribute8, 1) =
1569 NVL (t_base_table (t_base_index).attribute8, 1)
1570 AND NVL (l_buffer_info (l_index_buffer).attribute9, 1) =
1571 NVL (t_base_table (t_base_index).attribute9, 1)
1572 AND NVL (l_buffer_info (l_index_buffer).attribute10, 1) =
1573 NVL (t_base_table (t_base_index).attribute10, 1)
1574 AND NVL (l_buffer_info (l_index_buffer).attribute11, 1) =
1575 NVL (t_base_table (t_base_index).attribute11, 1)
1576 AND NVL (l_buffer_info (l_index_buffer).attribute12, 1) =
1577 NVL (t_base_table (t_base_index).attribute12, 1)
1578 AND NVL (l_buffer_info (l_index_buffer).attribute13, 1) =
1579 NVL (t_base_table (t_base_index).attribute13, 1)
1580 AND NVL (l_buffer_info (l_index_buffer).attribute14, 1) =
1581 NVL (t_base_table (t_base_index).attribute14, 1)
1582 AND NVL (l_buffer_info (l_index_buffer).attribute15, 1) =
1583 NVL (t_base_table (t_base_index).attribute15, 1)
1584 AND NVL (l_buffer_info (l_index_buffer).attribute16, 1) =
1585 NVL (t_base_table (t_base_index).attribute16, 1)
1586 AND NVL (l_buffer_info (l_index_buffer).attribute17, 1) =
1587 NVL (t_base_table (t_base_index).attribute17, 1)
1588 AND NVL (l_buffer_info (l_index_buffer).attribute18, 1) =
1589 NVL (t_base_table (t_base_index).attribute18, 1)
1590 AND NVL (l_buffer_info (l_index_buffer).attribute19, 1) =
1591 NVL (t_base_table (t_base_index).attribute19, 1)
1592 AND NVL (l_buffer_info (l_index_buffer).attribute20, 1) =
1593 NVL (t_base_table (t_base_index).attribute20, 1) THEN
1594 -- the hours type has been found
1595 -- record the index
1596
1597 l_record_index_buffer := l_index_buffer;
1598 l_found_hours_type := TRUE;
1599
1600 -- l_table_counter := l_buffer_info(l_index_buffer).row_table_index; ---nitin
1601
1602 IF (l_timecard_start_time = l_detail_start_time) THEN
1603 IF (l_buffer_info (l_record_index_buffer).day_1) THEN
1604 l_found_hours_type := FALSE;
1605 ELSE
1606 l_buffer_info (l_record_index_buffer).day_1 := TRUE;
1607 END IF;
1608 ELSIF ((l_timecard_start_time + 1) = l_detail_start_time) THEN
1609 IF (l_buffer_info (l_record_index_buffer).day_2) THEN
1610 l_found_hours_type := FALSE;
1611 ELSE
1612 l_buffer_info (l_record_index_buffer).day_2 := TRUE;
1613 END IF;
1614 ELSIF ((l_timecard_start_time + 2) = l_detail_start_time) THEN
1615 IF (l_buffer_info (l_record_index_buffer).day_3) THEN
1616 l_found_hours_type := FALSE;
1617 ELSE
1618 l_buffer_info (l_record_index_buffer).day_3 := TRUE;
1619 END IF;
1620 ELSIF ((l_timecard_start_time + 3) = l_detail_start_time) THEN
1621 IF (l_buffer_info (l_record_index_buffer).day_4) THEN
1622 l_found_hours_type := FALSE;
1623 ELSE
1624 l_buffer_info (l_record_index_buffer).day_4 := TRUE;
1625 END IF;
1626 ELSIF ((l_timecard_start_time + 4) = l_detail_start_time) THEN
1627 IF (l_buffer_info (l_record_index_buffer).day_5) THEN
1628 l_found_hours_type := FALSE;
1629 ELSE
1630 l_buffer_info (l_record_index_buffer).day_5 := TRUE;
1631 END IF;
1632 ELSIF ((l_timecard_start_time + 5) = l_detail_start_time) THEN
1633 IF (l_buffer_info (l_record_index_buffer).day_6) THEN
1634 l_found_hours_type := FALSE;
1635 ELSE
1636 l_buffer_info (l_record_index_buffer).day_6 := TRUE;
1637 END IF;
1638 ELSIF ((l_timecard_start_time + 6) = l_detail_start_time) THEN
1639 IF (l_buffer_info (l_record_index_buffer).day_7) THEN
1640 l_found_hours_type := FALSE;
1641 ELSE
1642 l_buffer_info (l_record_index_buffer).day_7 := TRUE;
1643 END IF;
1644 ELSIF ((l_timecard_start_time + 7) = l_detail_start_time) THEN
1645 IF (l_buffer_info (l_record_index_buffer).day_8) THEN
1646 l_found_hours_type := FALSE;
1647 ELSE
1648 l_buffer_info (l_record_index_buffer).day_8 := TRUE;
1649 END IF;
1650 ELSIF ((l_timecard_start_time + 8) = l_detail_start_time) THEN
1651 IF (l_buffer_info (l_record_index_buffer).day_9) THEN
1652 l_found_hours_type := FALSE;
1653 ELSE
1654 l_buffer_info (l_record_index_buffer).day_9 := TRUE;
1655 END IF;
1656 ELSIF ((l_timecard_start_time + 9) = l_detail_start_time) THEN
1657 IF (l_buffer_info (l_record_index_buffer).day_10) THEN
1658 l_found_hours_type := FALSE;
1659 ELSE
1660 l_buffer_info (l_record_index_buffer).day_10 := TRUE;
1661 END IF;
1662 ELSIF ((l_timecard_start_time + 10) = l_detail_start_time) THEN
1663 IF (l_buffer_info (l_record_index_buffer).day_11) THEN
1664 l_found_hours_type := FALSE;
1665 ELSE
1666 l_buffer_info (l_record_index_buffer).day_11 := TRUE;
1667 END IF;
1668 ELSIF ((l_timecard_start_time + 11) = l_detail_start_time) THEN
1669 IF (l_buffer_info (l_record_index_buffer).day_12) THEN
1670 l_found_hours_type := FALSE;
1671 ELSE
1672 l_buffer_info (l_record_index_buffer).day_12 := TRUE;
1673 END IF;
1674 ELSIF ((l_timecard_start_time + 12) = l_detail_start_time) THEN
1675 IF (l_buffer_info (l_record_index_buffer).day_13) THEN
1676 l_found_hours_type := FALSE;
1677 ELSE
1678 l_buffer_info (l_record_index_buffer).day_13 := TRUE;
1679 END IF;
1680 ELSIF ((l_timecard_start_time + 13) = l_detail_start_time) THEN
1681 IF (l_buffer_info (l_record_index_buffer).day_14) THEN
1682 l_found_hours_type := FALSE;
1683 ELSE
1684 l_buffer_info (l_record_index_buffer).day_14 := TRUE;
1685 END IF;
1686 ELSIF ((l_timecard_start_time + 14) = l_detail_start_time) THEN
1687 IF (l_buffer_info (l_record_index_buffer).day_15) THEN
1688 l_found_hours_type := FALSE;
1689 ELSE
1690 l_buffer_info (l_record_index_buffer).day_15 := TRUE;
1691 END IF;
1692 ELSIF ((l_timecard_start_time + 15) = l_detail_start_time) THEN
1693 IF (l_buffer_info (l_record_index_buffer).day_16) THEN
1694 l_found_hours_type := FALSE;
1695 ELSE
1696 l_buffer_info (l_record_index_buffer).day_16 := TRUE;
1697 END IF;
1698 ELSIF ((l_timecard_start_time + 16) = l_detail_start_time) THEN
1699 IF (l_buffer_info (l_record_index_buffer).day_17) THEN
1700 l_found_hours_type := FALSE;
1701 ELSE
1702 l_buffer_info (l_record_index_buffer).day_17 := TRUE;
1703 END IF;
1704 ELSIF ((l_timecard_start_time + 17) = l_detail_start_time) THEN
1705 IF (l_buffer_info (l_record_index_buffer).day_18) THEN
1706 l_found_hours_type := FALSE;
1707 ELSE
1708 l_buffer_info (l_record_index_buffer).day_18 := TRUE;
1709 END IF;
1710 ELSIF ((l_timecard_start_time + 18) = l_detail_start_time) THEN
1711 IF (l_buffer_info (l_record_index_buffer).day_19) THEN
1712 l_found_hours_type := FALSE;
1713 ELSE
1714 l_buffer_info (l_record_index_buffer).day_19 := TRUE;
1715 END IF;
1716 ELSIF ((l_timecard_start_time + 19) = l_detail_start_time) THEN
1717 IF (l_buffer_info (l_record_index_buffer).day_20) THEN
1718 l_found_hours_type := FALSE;
1719 ELSE
1720 l_buffer_info (l_record_index_buffer).day_20 := TRUE;
1721 END IF;
1722 ELSIF ((l_timecard_start_time + 20) = l_detail_start_time) THEN
1723 IF (l_buffer_info (l_record_index_buffer).day_21) THEN
1724 l_found_hours_type := FALSE;
1725 ELSE
1726 l_buffer_info (l_record_index_buffer).day_21 := TRUE;
1727 END IF;
1728 ELSIF ((l_timecard_start_time + 21) = l_detail_start_time) THEN
1729 IF (l_buffer_info (l_record_index_buffer).day_22) THEN
1730 l_found_hours_type := FALSE;
1731 ELSE
1732 l_buffer_info (l_record_index_buffer).day_22 := TRUE;
1733 END IF;
1734 ELSIF ((l_timecard_start_time + 22) = l_detail_start_time) THEN
1735 IF (l_buffer_info (l_record_index_buffer).day_23) THEN
1736 l_found_hours_type := FALSE;
1737 ELSE
1738 l_buffer_info (l_record_index_buffer).day_23 := TRUE;
1739 END IF;
1740 ELSIF ((l_timecard_start_time + 23) = l_detail_start_time) THEN
1741 IF (l_buffer_info (l_record_index_buffer).day_24) THEN
1742 l_found_hours_type := FALSE;
1743 ELSE
1744 l_buffer_info (l_record_index_buffer).day_24 := TRUE;
1745 END IF;
1746 ELSIF ((l_timecard_start_time + 24) = l_detail_start_time) THEN
1747 IF (l_buffer_info (l_record_index_buffer).day_25) THEN
1748 l_found_hours_type := FALSE;
1749 ELSE
1750 l_buffer_info (l_record_index_buffer).day_25 := TRUE;
1751 END IF;
1752 ELSIF ((l_timecard_start_time + 25) = l_detail_start_time) THEN
1753 IF (l_buffer_info (l_record_index_buffer).day_26) THEN
1754 l_found_hours_type := FALSE;
1755 ELSE
1756 l_buffer_info (l_record_index_buffer).day_26 := TRUE;
1757 END IF;
1758 ELSIF ((l_timecard_start_time + 26) = l_detail_start_time) THEN
1759 IF (l_buffer_info (l_record_index_buffer).day_27) THEN
1760 l_found_hours_type := FALSE;
1761 ELSE
1762 l_buffer_info (l_record_index_buffer).day_27 := TRUE;
1763 END IF;
1764 ELSIF ((l_timecard_start_time + 27) = l_detail_start_time) THEN
1765 IF (l_buffer_info (l_record_index_buffer).day_28) THEN
1766 l_found_hours_type := FALSE;
1767 ELSE
1768 l_buffer_info (l_record_index_buffer).day_28 := TRUE;
1769 END IF;
1770 ELSIF ((l_timecard_start_time + 28) = l_detail_start_time) THEN
1771 IF (l_buffer_info (l_record_index_buffer).day_29) THEN
1772 l_found_hours_type := FALSE;
1773 ELSE
1774 l_buffer_info (l_record_index_buffer).day_29 := TRUE;
1775 END IF;
1776 ELSIF ((l_timecard_start_time + 29) = l_detail_start_time) THEN
1777 IF (l_buffer_info (l_record_index_buffer).day_30) THEN
1778 l_found_hours_type := FALSE;
1779 ELSE
1780 l_buffer_info (l_record_index_buffer).day_30 := TRUE;
1781 END IF;
1782 ELSIF ((l_timecard_start_time + 30) = l_detail_start_time) THEN
1783 IF (l_buffer_info (l_record_index_buffer).day_31) THEN
1784 l_found_hours_type := FALSE;
1785 ELSE
1786 l_buffer_info (l_record_index_buffer).day_31 := TRUE;
1787 END IF;
1788 END IF;
1789
1790 IF (l_found_hours_type) THEN
1791 changed := 'Y'; --nitin
1792 changed_no := l_table_counter; --nitin
1793 l_table_counter := l_buffer_info (l_index_buffer).row_table_index; ---nitin
1794 END IF;
1795
1796 -- reset
1797 l_record_index_buffer := NULL;
1798 END IF;
1799
1800 IF (l_found_hours_type) THEN
1801 l_index_buffer := l_buffer_info.LAST + 1;
1802 ELSE
1803 l_index_buffer := l_buffer_info.NEXT (l_index_buffer);
1804 END IF;
1805 END LOOP;
1806 /*ADVICE(1822): Nested LOOPs should all be labeled [406] */
1807
1808
1809 -- now we need to check at this index that the detail info is not populate
1810 -- if it is so the we need to increment the table index.
1811 -- the hours type has not been found
1812 -- create a new row in the buffer and increment the table_counter
1813
1814 IF ( l_found_hours_type = FALSE
1815 AND NVL (t_base_table (t_base_index).attribute1, 1) =
1816 NVL (NVL (p_attribute1, t_base_table (t_base_index).attribute1), 1)
1817 AND NVL (t_base_table (t_base_index).attribute2, 1) =
1818 NVL (NVL (p_attribute2, t_base_table (t_base_index).attribute2), 1)
1819 AND NVL (t_base_table (t_base_index).attribute3, 1) =
1820 NVL (NVL (p_attribute3, t_base_table (t_base_index).attribute3), 1)
1821 AND NVL (t_base_table (t_base_index).attribute4, 1) =
1822 NVL (NVL (p_attribute4, t_base_table (t_base_index).attribute4), 1)
1823 AND NVL (t_base_table (t_base_index).attribute5, 1) =
1824 NVL (NVL (p_attribute5, t_base_table (t_base_index).attribute5), 1)
1825 AND NVL (t_base_table (t_base_index).attribute6, 1) =
1826 NVL (NVL (p_attribute6, t_base_table (t_base_index).attribute6), 1)
1827 AND NVL (t_base_table (t_base_index).attribute7, 1) =
1828 NVL (NVL (p_attribute7, t_base_table (t_base_index).attribute7), 1)
1829 AND NVL (t_base_table (t_base_index).attribute8, 1) =
1830 NVL (NVL (p_attribute8, t_base_table (t_base_index).attribute8), 1)
1831 AND NVL (t_base_table (t_base_index).attribute9, 1) =
1832 NVL (NVL (p_attribute9, t_base_table (t_base_index).attribute9), 1)
1833 AND NVL (t_base_table (t_base_index).attribute10, 1) =
1834 NVL (NVL (p_attribute10, t_base_table (t_base_index).attribute10), 1)
1835 AND NVL (t_base_table (t_base_index).attribute11, 1) =
1836 NVL (NVL (p_attribute11, t_base_table (t_base_index).attribute11), 1)
1837 AND NVL (t_base_table (t_base_index).attribute12, 1) =
1838 NVL (NVL (p_attribute12, t_base_table (t_base_index).attribute12), 1)
1839 AND NVL (t_base_table (t_base_index).attribute13, 1) =
1840 NVL (NVL (p_attribute13, t_base_table (t_base_index).attribute13), 1)
1841 AND NVL (t_base_table (t_base_index).attribute14, 1) =
1842 NVL (NVL (p_attribute14, t_base_table (t_base_index).attribute14), 1)
1843 AND NVL (t_base_table (t_base_index).attribute15, 1) =
1844 NVL (NVL (p_attribute15, t_base_table (t_base_index).attribute15), 1)
1845 AND NVL (t_base_table (t_base_index).attribute16, 1) =
1846 NVL (NVL (p_attribute16, t_base_table (t_base_index).attribute16), 1)
1847 AND NVL (t_base_table (t_base_index).attribute17, 1) =
1848 NVL (NVL (p_attribute17, t_base_table (t_base_index).attribute17), 1)
1849 AND NVL (t_base_table (t_base_index).attribute18, 1) =
1850 NVL (NVL (p_attribute18, t_base_table (t_base_index).attribute18), 1)
1851 AND NVL (t_base_table (t_base_index).attribute19, 1) =
1852 NVL (NVL (p_attribute19, t_base_table (t_base_index).attribute19), 1)
1853 AND NVL (t_base_table (t_base_index).attribute20, 1) =
1854 NVL (NVL (p_attribute20, t_base_table (t_base_index).attribute20), 1)
1855 ) THEN
1856 -- increment of the index
1857
1858
1859 -- if l_table_counter < l_buffer_info(l_buffer_info.last).row_table_index then --nitin
1860 -- l_table_counter :=l_buffer_info(l_buffer_info.last).row_table_index; --nitin
1861 -- end if; --nitin
1862
1863 l_table_counter := l_table_counter + 1;
1864 l_index_buffer := l_buffer_info.LAST + 1;
1865 l_buffer_info (l_index_buffer).row_table_index := l_table_counter;
1866 l_buffer_info (l_index_buffer).attribute1 := t_base_table (t_base_index).attribute1;
1867 l_buffer_info (l_index_buffer).attribute2 := t_base_table (t_base_index).attribute2;
1868 l_buffer_info (l_index_buffer).attribute3 := t_base_table (t_base_index).attribute3;
1869 l_buffer_info (l_index_buffer).attribute4 := t_base_table (t_base_index).attribute4;
1870 l_buffer_info (l_index_buffer).attribute5 := t_base_table (t_base_index).attribute5;
1871 l_buffer_info (l_index_buffer).attribute6 := t_base_table (t_base_index).attribute6;
1872 l_buffer_info (l_index_buffer).attribute7 := t_base_table (t_base_index).attribute7;
1873 l_buffer_info (l_index_buffer).attribute8 := t_base_table (t_base_index).attribute8;
1874 l_buffer_info (l_index_buffer).attribute9 := t_base_table (t_base_index).attribute9;
1875 l_buffer_info (l_index_buffer).attribute10 := t_base_table (t_base_index).attribute10;
1876 l_buffer_info (l_index_buffer).attribute11 := t_base_table (t_base_index).attribute11;
1877 l_buffer_info (l_index_buffer).attribute12 := t_base_table (t_base_index).attribute12;
1878 l_buffer_info (l_index_buffer).attribute13 := t_base_table (t_base_index).attribute13;
1879 l_buffer_info (l_index_buffer).attribute14 := t_base_table (t_base_index).attribute14;
1880 l_buffer_info (l_index_buffer).attribute15 := t_base_table (t_base_index).attribute15;
1881 l_buffer_info (l_index_buffer).attribute16 := t_base_table (t_base_index).attribute16;
1882 l_buffer_info (l_index_buffer).attribute17 := t_base_table (t_base_index).attribute17;
1883 l_buffer_info (l_index_buffer).attribute18 := t_base_table (t_base_index).attribute18;
1884 l_buffer_info (l_index_buffer).attribute19 := t_base_table (t_base_index).attribute19;
1885 l_buffer_info (l_index_buffer).attribute20 := t_base_table (t_base_index).attribute20;
1886
1887 -- store the day that has been populated
1888 IF (l_timecard_start_time = l_detail_start_time) THEN
1889 l_buffer_info (l_index_buffer).day_1 := TRUE;
1890 ELSIF ((l_timecard_start_time + 1) = l_detail_start_time) THEN
1891 l_buffer_info (l_index_buffer).day_2 := TRUE;
1892 ELSIF ((l_timecard_start_time + 2) = l_detail_start_time) THEN
1893 l_buffer_info (l_index_buffer).day_3 := TRUE;
1894 ELSIF ((l_timecard_start_time + 3) = l_detail_start_time) THEN
1895 l_buffer_info (l_index_buffer).day_4 := TRUE;
1896 ELSIF ((l_timecard_start_time + 4) = l_detail_start_time) THEN
1897 l_buffer_info (l_index_buffer).day_5 := TRUE;
1898 ELSIF ((l_timecard_start_time + 5) = l_detail_start_time) THEN
1899 l_buffer_info (l_index_buffer).day_6 := TRUE;
1900 ELSIF ((l_timecard_start_time + 6) = l_detail_start_time) THEN
1901 l_buffer_info (l_index_buffer).day_7 := TRUE;
1902 ELSIF ((l_timecard_start_time + 7) = l_detail_start_time) THEN
1903 l_buffer_info (l_index_buffer).day_8 := TRUE;
1904 ELSIF ((l_timecard_start_time + 8) = l_detail_start_time) THEN
1905 l_buffer_info (l_index_buffer).day_9 := TRUE;
1906 ELSIF ((l_timecard_start_time + 9) = l_detail_start_time) THEN
1907 l_buffer_info (l_index_buffer).day_10 := TRUE;
1908 ELSIF ((l_timecard_start_time + 10) = l_detail_start_time) THEN
1909 l_buffer_info (l_index_buffer).day_11 := TRUE;
1910 ELSIF ((l_timecard_start_time + 11) = l_detail_start_time) THEN
1911 l_buffer_info (l_index_buffer).day_12 := TRUE;
1912 ELSIF ((l_timecard_start_time + 12) = l_detail_start_time) THEN
1913 l_buffer_info (l_index_buffer).day_13 := TRUE;
1914 ELSIF ((l_timecard_start_time + 13) = l_detail_start_time) THEN
1915 l_buffer_info (l_index_buffer).day_14 := TRUE;
1916 ELSIF ((l_timecard_start_time + 14) = l_detail_start_time) THEN
1917 l_buffer_info (l_index_buffer).day_15 := TRUE;
1918 ELSIF ((l_timecard_start_time + 15) = l_detail_start_time) THEN
1919 l_buffer_info (l_index_buffer).day_16 := TRUE;
1920 ELSIF ((l_timecard_start_time + 16) = l_detail_start_time) THEN
1921 l_buffer_info (l_index_buffer).day_17 := TRUE;
1922 ELSIF ((l_timecard_start_time + 17) = l_detail_start_time) THEN
1923 l_buffer_info (l_index_buffer).day_18 := TRUE;
1924 ELSIF ((l_timecard_start_time + 18) = l_detail_start_time) THEN
1925 l_buffer_info (l_index_buffer).day_19 := TRUE;
1926 ELSIF ((l_timecard_start_time + 19) = l_detail_start_time) THEN
1927 l_buffer_info (l_index_buffer).day_20 := TRUE;
1928 ELSIF ((l_timecard_start_time + 20) = l_detail_start_time) THEN
1929 l_buffer_info (l_index_buffer).day_21 := TRUE;
1930 ELSIF ((l_timecard_start_time + 21) = l_detail_start_time) THEN
1931 l_buffer_info (l_index_buffer).day_22 := TRUE;
1932 ELSIF ((l_timecard_start_time + 22) = l_detail_start_time) THEN
1933 l_buffer_info (l_index_buffer).day_23 := TRUE;
1934 ELSIF ((l_timecard_start_time + 23) = l_detail_start_time) THEN
1935 l_buffer_info (l_index_buffer).day_24 := TRUE;
1936 ELSIF ((l_timecard_start_time + 24) = l_detail_start_time) THEN
1937 l_buffer_info (l_index_buffer).day_25 := TRUE;
1938 ELSIF ((l_timecard_start_time + 25) = l_detail_start_time) THEN
1939 l_buffer_info (l_index_buffer).day_26 := TRUE;
1940 ELSIF ((l_timecard_start_time + 26) = l_detail_start_time) THEN
1941 l_buffer_info (l_index_buffer).day_27 := TRUE;
1942 ELSIF ((l_timecard_start_time + 27) = l_detail_start_time) THEN
1943 l_buffer_info (l_index_buffer).day_28 := TRUE;
1944 ELSIF ((l_timecard_start_time + 28) = l_detail_start_time) THEN
1945 l_buffer_info (l_index_buffer).day_29 := TRUE;
1946 ELSIF ((l_timecard_start_time + 29) = l_detail_start_time) THEN
1947 l_buffer_info (l_index_buffer).day_30 := TRUE;
1948 ELSIF ((l_timecard_start_time + 30) = l_detail_start_time) THEN
1949 l_buffer_info (l_index_buffer).day_31 := TRUE;
1950 END IF;
1951 END IF;
1952
1953 l_found_hours_type := FALSE;
1954
1955 --IF g_debbug THEN
1956 --hxc_timekeeper_utilities.dump_buffer_table(l_buffer_info);
1957 --END IF;
1958 if g_debug then
1959 hr_utility.trace ('101 -- Normal Query procedure ');
1960 end if;
1961 IF p_reqryflg = 'N' THEN
1962 p_timekeeper_data (l_table_counter).check_box := 'Y';
1963 g_submit_table (resource_info.person_id).resource_id := resource_info.person_id;
1964 g_submit_table (resource_info.person_id).timecard_id := l_timecard_id;
1965 g_submit_table (resource_info.person_id).start_time := tc_start;
1966 g_submit_table (resource_info.person_id).stop_time := tc_end;
1967 g_submit_table (resource_info.person_id).row_lock_id := l_row_lock_id;
1968 g_submit_table (resource_info.person_id).no_rows :=
1969 NVL (g_submit_table (resource_info.person_id).no_rows, 0) + 1;
1970 ELSE
1971 p_timekeeper_data (l_table_counter).check_box := 'N';
1972 g_submit_table.DELETE (resource_info.person_id);
1973 END IF;
1974
1975 p_timekeeper_data (l_table_counter).timecard_id := l_timecard_id;
1976 p_timekeeper_data (l_table_counter).timecard_start_period := tc_start;
1977 p_timekeeper_data (l_table_counter).timecard_end_period := tc_end;
1978 p_timekeeper_data (l_table_counter).last_update_date := l_last_update_date;
1979 p_timekeeper_data (l_table_counter).last_updated_by := l_last_updated_by;
1980 p_timekeeper_data (l_table_counter).last_update_login := l_last_update_login;
1981 p_timekeeper_data (l_table_counter).created_by := l_created_by;
1982 p_timekeeper_data (l_table_counter).creation_date := l_creation_date;
1983 p_timekeeper_data (l_table_counter).timecard_ovn := l_timecard_ovn;
1984 p_timekeeper_data (l_table_counter).timecard_status_code := l_status_code;
1985 p_timekeeper_data (l_table_counter).timecard_status := l_timecard_status_meaning;
1986 p_timekeeper_data (l_table_counter).timecard_message_code := l_timecard_message_code;
1987 p_timekeeper_data (l_table_counter).timecard_message := l_timecard_message;
1988 p_timekeeper_data (l_table_counter).comment_text := l_timecard_comment_text;
1989 p_timekeeper_data (l_table_counter).attr_id_1 := t_base_table (t_base_index).attribute1;
1990 p_timekeeper_data (l_table_counter).attr_id_2 := t_base_table (t_base_index).attribute2;
1991 p_timekeeper_data (l_table_counter).attr_id_3 := t_base_table (t_base_index).attribute3;
1992 p_timekeeper_data (l_table_counter).attr_id_4 := t_base_table (t_base_index).attribute4;
1993 p_timekeeper_data (l_table_counter).attr_id_5 := t_base_table (t_base_index).attribute5;
1994 p_timekeeper_data (l_table_counter).attr_id_6 := t_base_table (t_base_index).attribute6;
1995 p_timekeeper_data (l_table_counter).attr_id_7 := t_base_table (t_base_index).attribute7;
1996 p_timekeeper_data (l_table_counter).attr_id_8 := t_base_table (t_base_index).attribute8;
1997 p_timekeeper_data (l_table_counter).attr_id_9 := t_base_table (t_base_index).attribute9;
1998 p_timekeeper_data (l_table_counter).attr_id_10 := t_base_table (t_base_index).attribute10;
1999 p_timekeeper_data (l_table_counter).attr_id_11 := t_base_table (t_base_index).attribute11;
2000 p_timekeeper_data (l_table_counter).attr_id_12 := t_base_table (t_base_index).attribute12;
2001 p_timekeeper_data (l_table_counter).attr_id_13 := t_base_table (t_base_index).attribute13;
2002 p_timekeeper_data (l_table_counter).attr_id_14 := t_base_table (t_base_index).attribute14;
2003 p_timekeeper_data (l_table_counter).attr_id_15 := t_base_table (t_base_index).attribute15;
2004 p_timekeeper_data (l_table_counter).attr_id_14 := t_base_table (t_base_index).attribute14;
2005 p_timekeeper_data (l_table_counter).attr_id_15 := t_base_table (t_base_index).attribute15;
2006 p_timekeeper_data (l_table_counter).attr_id_16 := t_base_table (t_base_index).attribute16;
2007 p_timekeeper_data (l_table_counter).attr_id_17 := t_base_table (t_base_index).attribute17;
2008 p_timekeeper_data (l_table_counter).attr_id_18 := t_base_table (t_base_index).attribute18;
2009 p_timekeeper_data (l_table_counter).attr_id_19 := t_base_table (t_base_index).attribute19;
2010 p_timekeeper_data (l_table_counter).attr_id_20 := t_base_table (t_base_index).attribute20;
2011 p_timekeeper_data (l_table_counter).attr_oldid_1 := t_base_table (t_base_index).attribute1;
2012 p_timekeeper_data (l_table_counter).attr_oldid_2 := t_base_table (t_base_index).attribute2;
2013 p_timekeeper_data (l_table_counter).attr_oldid_3 := t_base_table (t_base_index).attribute3;
2014 p_timekeeper_data (l_table_counter).attr_oldid_4 := t_base_table (t_base_index).attribute4;
2015 p_timekeeper_data (l_table_counter).attr_oldid_5 := t_base_table (t_base_index).attribute5;
2016 p_timekeeper_data (l_table_counter).attr_oldid_6 := t_base_table (t_base_index).attribute6;
2017 p_timekeeper_data (l_table_counter).attr_oldid_7 := t_base_table (t_base_index).attribute7;
2018 p_timekeeper_data (l_table_counter).attr_oldid_8 := t_base_table (t_base_index).attribute8;
2019 p_timekeeper_data (l_table_counter).attr_oldid_9 := t_base_table (t_base_index).attribute9;
2020 p_timekeeper_data (l_table_counter).attr_oldid_10 := t_base_table (t_base_index).attribute10;
2021 p_timekeeper_data (l_table_counter).attr_oldid_11 := t_base_table (t_base_index).attribute11;
2022 p_timekeeper_data (l_table_counter).attr_oldid_12 := t_base_table (t_base_index).attribute12;
2023 p_timekeeper_data (l_table_counter).attr_oldid_13 := t_base_table (t_base_index).attribute13;
2024 p_timekeeper_data (l_table_counter).attr_oldid_14 := t_base_table (t_base_index).attribute14;
2025 p_timekeeper_data (l_table_counter).attr_oldid_15 := t_base_table (t_base_index).attribute15;
2026 p_timekeeper_data (l_table_counter).attr_oldid_14 := t_base_table (t_base_index).attribute14;
2027 p_timekeeper_data (l_table_counter).attr_oldid_15 := t_base_table (t_base_index).attribute15;
2028 p_timekeeper_data (l_table_counter).attr_oldid_16 := t_base_table (t_base_index).attribute16;
2029 p_timekeeper_data (l_table_counter).attr_oldid_17 := t_base_table (t_base_index).attribute17;
2030 p_timekeeper_data (l_table_counter).attr_oldid_18 := t_base_table (t_base_index).attribute18;
2031 p_timekeeper_data (l_table_counter).attr_oldid_19 := t_base_table (t_base_index).attribute19;
2032 p_timekeeper_data (l_table_counter).attr_oldid_20 := t_base_table (t_base_index).attribute20;
2033 p_timekeeper_data (l_table_counter).resource_id := resource_info.person_id;
2034 p_timekeeper_data (l_table_counter).employee_number := resource_info.employee_number;
2035 p_timekeeper_data (l_table_counter).person_type := resource_info.person_type;
2036 p_timekeeper_data (l_table_counter).audit_enabled := l_audit_enabled;
2037 p_timekeeper_data (l_table_counter).employee_full_name := resource_info.full_name;
2038 p_timekeeper_data (l_table_counter).row_lock_id := l_row_lock_id;
2039 p_timekeeper_data (l_table_counter).tc_lock_success := l_tc_lock_success;
2040 if g_debug then
2041 hr_utility.TRACE ('l_detail_id'|| l_detail_id);
2042 hr_utility.TRACE ('l_timecard_id'|| l_timecard_id);
2043 hr_utility.TRACE ('l_detail_comment_text'|| l_detail_comment_text);
2044 end if;
2045 IF l_detail_comment_text IS NOT NULL THEN
2046 if g_debug then
2047 hr_utility.TRACE ('200');
2048 hr_utility.TRACE ('l_detail_idA'|| l_detail_id);
2049 hr_utility.TRACE ('l_timecard_idA'|| l_timecard_id);
2050 hr_utility.TRACE ('l_detail_comment_textA'|| l_detail_comment_text);
2051 end if;
2052 IF c%ISOPEN THEN
2053 CLOSE c;
2054 END IF;
2055
2056 OPEN c (l_detail_id);
2057 FETCH c INTO c_row;
2058
2059 IF c%FOUND THEN
2060 UPDATE hxc_tk_detail_temp
2061 SET comment_text = l_detail_comment_text
2062 WHERE detailid = l_detail_id AND timecard_id = l_timecard_id;
2063 ELSE
2064 INSERT INTO hxc_tk_detail_temp
2065 (detailid, timecard_id, comment_text)
2066 VALUES (l_detail_id, l_timecard_id, l_detail_comment_text);
2067 END IF;
2068
2069 CLOSE c;
2070 END IF;
2071
2072 -- attach the detail information with the right day
2073 IF (l_timecard_start_time - (l_add_index_day) = l_detail_start_time) THEN
2074 p_timekeeper_data (l_table_counter).day_1 := l_detail_measure;
2075 p_timekeeper_data (l_table_counter).detail_id_1 := l_detail_id;
2076 p_timekeeper_data (l_table_counter).detail_ovn_1 := l_detail_ovn;
2077 p_timekeeper_data (l_table_counter).time_in_1 := l_detail_time_in;
2078 p_timekeeper_data (l_table_counter).time_out_1 := l_detail_time_out;
2079 ELSIF ((l_timecard_start_time - l_add_index_day + 1) = l_detail_start_time) THEN
2080 p_timekeeper_data (l_table_counter).day_2 := l_detail_measure;
2081 p_timekeeper_data (l_table_counter).detail_id_2 := l_detail_id;
2082 p_timekeeper_data (l_table_counter).detail_ovn_2 := l_detail_ovn;
2083 p_timekeeper_data (l_table_counter).time_in_2 := l_detail_time_in;
2084 p_timekeeper_data (l_table_counter).time_out_2 := l_detail_time_out;
2085 ELSIF ((l_timecard_start_time - l_add_index_day + 2) = l_detail_start_time) THEN
2086 p_timekeeper_data (l_table_counter).day_3 := l_detail_measure;
2087 p_timekeeper_data (l_table_counter).detail_id_3 := l_detail_id;
2088 p_timekeeper_data (l_table_counter).detail_ovn_3 := l_detail_ovn;
2089 p_timekeeper_data (l_table_counter).time_in_3 := l_detail_time_in;
2090 p_timekeeper_data (l_table_counter).time_out_3 := l_detail_time_out;
2091 ELSIF ((l_timecard_start_time - l_add_index_day + 3) = l_detail_start_time) THEN
2092 p_timekeeper_data (l_table_counter).day_4 := l_detail_measure;
2093 p_timekeeper_data (l_table_counter).detail_id_4 := l_detail_id;
2094 p_timekeeper_data (l_table_counter).detail_ovn_4 := l_detail_ovn;
2095 p_timekeeper_data (l_table_counter).time_in_4 := l_detail_time_in;
2096 p_timekeeper_data (l_table_counter).time_out_4 := l_detail_time_out;
2097 ELSIF ((l_timecard_start_time - l_add_index_day + 4) = l_detail_start_time) THEN
2098 p_timekeeper_data (l_table_counter).day_5 := l_detail_measure;
2099 p_timekeeper_data (l_table_counter).detail_id_5 := l_detail_id;
2100 p_timekeeper_data (l_table_counter).detail_ovn_5 := l_detail_ovn;
2101 p_timekeeper_data (l_table_counter).time_in_5 := l_detail_time_in;
2102 p_timekeeper_data (l_table_counter).time_out_5 := l_detail_time_out;
2103 ELSIF ((l_timecard_start_time - l_add_index_day + 5) = l_detail_start_time) THEN
2104 p_timekeeper_data (l_table_counter).day_6 := l_detail_measure;
2105 p_timekeeper_data (l_table_counter).detail_id_6 := l_detail_id;
2106 p_timekeeper_data (l_table_counter).detail_ovn_6 := l_detail_ovn;
2107 p_timekeeper_data (l_table_counter).time_in_6 := l_detail_time_in;
2108 p_timekeeper_data (l_table_counter).time_out_6 := l_detail_time_out;
2109 ELSIF ((l_timecard_start_time - l_add_index_day + 6) = l_detail_start_time) THEN
2110 p_timekeeper_data (l_table_counter).day_7 := l_detail_measure;
2111 p_timekeeper_data (l_table_counter).detail_id_7 := l_detail_id;
2112 p_timekeeper_data (l_table_counter).detail_ovn_7 := l_detail_ovn;
2113 p_timekeeper_data (l_table_counter).time_in_7 := l_detail_time_in;
2114 p_timekeeper_data (l_table_counter).time_out_7 := l_detail_time_out;
2115 ELSIF ((l_timecard_start_time - l_add_index_day + 7) = l_detail_start_time) THEN
2116 p_timekeeper_data (l_table_counter).day_8 := l_detail_measure;
2117 p_timekeeper_data (l_table_counter).detail_id_8 := l_detail_id;
2118 p_timekeeper_data (l_table_counter).detail_ovn_8 := l_detail_ovn;
2119 p_timekeeper_data (l_table_counter).time_in_8 := l_detail_time_in;
2120 p_timekeeper_data (l_table_counter).time_out_8 := l_detail_time_out;
2121 ELSIF ((l_timecard_start_time - l_add_index_day + 8) = l_detail_start_time) THEN
2122 p_timekeeper_data (l_table_counter).day_9 := l_detail_measure;
2123 p_timekeeper_data (l_table_counter).detail_id_9 := l_detail_id;
2124 p_timekeeper_data (l_table_counter).detail_ovn_9 := l_detail_ovn;
2125 p_timekeeper_data (l_table_counter).time_in_9 := l_detail_time_in;
2126 p_timekeeper_data (l_table_counter).time_out_9 := l_detail_time_out;
2127 ELSIF ((l_timecard_start_time - l_add_index_day + 9) = l_detail_start_time) THEN
2128 p_timekeeper_data (l_table_counter).day_10 := l_detail_measure;
2129 p_timekeeper_data (l_table_counter).detail_id_10 := l_detail_id;
2130 p_timekeeper_data (l_table_counter).detail_ovn_10 := l_detail_ovn;
2131 p_timekeeper_data (l_table_counter).time_in_10 := l_detail_time_in;
2132 p_timekeeper_data (l_table_counter).time_out_10 := l_detail_time_out;
2133 ELSIF ((l_timecard_start_time - l_add_index_day + 10) = l_detail_start_time) THEN
2134 p_timekeeper_data (l_table_counter).day_11 := l_detail_measure;
2135 p_timekeeper_data (l_table_counter).detail_id_11 := l_detail_id;
2136 p_timekeeper_data (l_table_counter).detail_ovn_11 := l_detail_ovn;
2137 p_timekeeper_data (l_table_counter).time_in_11 := l_detail_time_in;
2138 p_timekeeper_data (l_table_counter).time_out_11 := l_detail_time_out;
2139 ELSIF ((l_timecard_start_time - l_add_index_day + 11) = l_detail_start_time) THEN
2140 p_timekeeper_data (l_table_counter).day_12 := l_detail_measure;
2141 p_timekeeper_data (l_table_counter).detail_id_12 := l_detail_id;
2142 p_timekeeper_data (l_table_counter).detail_ovn_12 := l_detail_ovn;
2143 p_timekeeper_data (l_table_counter).time_in_12 := l_detail_time_in;
2144 p_timekeeper_data (l_table_counter).time_out_12 := l_detail_time_out;
2145 ELSIF ((l_timecard_start_time - l_add_index_day + 12) = l_detail_start_time) THEN
2146 p_timekeeper_data (l_table_counter).day_13 := l_detail_measure;
2147 p_timekeeper_data (l_table_counter).detail_id_13 := l_detail_id;
2148 p_timekeeper_data (l_table_counter).detail_ovn_13 := l_detail_ovn;
2149 p_timekeeper_data (l_table_counter).time_in_13 := l_detail_time_in;
2150 p_timekeeper_data (l_table_counter).time_out_13 := l_detail_time_out;
2151 ELSIF ((l_timecard_start_time - l_add_index_day + 13) = l_detail_start_time) THEN
2152 p_timekeeper_data (l_table_counter).day_14 := l_detail_measure;
2153 p_timekeeper_data (l_table_counter).detail_id_14 := l_detail_id;
2154 p_timekeeper_data (l_table_counter).detail_ovn_14 := l_detail_ovn;
2155 p_timekeeper_data (l_table_counter).time_in_14 := l_detail_time_in;
2156 p_timekeeper_data (l_table_counter).time_out_14 := l_detail_time_out;
2157 ELSIF ((l_timecard_start_time - l_add_index_day + 14) = l_detail_start_time) THEN
2158 p_timekeeper_data (l_table_counter).day_15 := l_detail_measure;
2159 p_timekeeper_data (l_table_counter).detail_id_15 := l_detail_id;
2160 p_timekeeper_data (l_table_counter).detail_ovn_15 := l_detail_ovn;
2161 p_timekeeper_data (l_table_counter).time_in_15 := l_detail_time_in;
2162 p_timekeeper_data (l_table_counter).time_out_15 := l_detail_time_out;
2163 ELSIF ((l_timecard_start_time - l_add_index_day + 15) = l_detail_start_time) THEN
2164 p_timekeeper_data (l_table_counter).day_16 := l_detail_measure;
2165 p_timekeeper_data (l_table_counter).detail_id_16 := l_detail_id;
2166 p_timekeeper_data (l_table_counter).detail_ovn_16 := l_detail_ovn;
2167 p_timekeeper_data (l_table_counter).time_in_16 := l_detail_time_in;
2168 p_timekeeper_data (l_table_counter).time_out_16 := l_detail_time_out;
2169 ELSIF ((l_timecard_start_time - l_add_index_day + 16) = l_detail_start_time) THEN
2170 p_timekeeper_data (l_table_counter).day_17 := l_detail_measure;
2171 p_timekeeper_data (l_table_counter).detail_id_17 := l_detail_id;
2172 p_timekeeper_data (l_table_counter).detail_ovn_17 := l_detail_ovn;
2173 p_timekeeper_data (l_table_counter).time_in_17 := l_detail_time_in;
2174 p_timekeeper_data (l_table_counter).time_out_17 := l_detail_time_out;
2175 ELSIF ((l_timecard_start_time - l_add_index_day + 17) = l_detail_start_time) THEN
2176 p_timekeeper_data (l_table_counter).day_18 := l_detail_measure;
2177 p_timekeeper_data (l_table_counter).detail_id_18 := l_detail_id;
2178 p_timekeeper_data (l_table_counter).detail_ovn_18 := l_detail_ovn;
2179 p_timekeeper_data (l_table_counter).time_in_18 := l_detail_time_in;
2180 p_timekeeper_data (l_table_counter).time_out_18 := l_detail_time_out;
2181 ELSIF ((l_timecard_start_time - l_add_index_day + 18) = l_detail_start_time) THEN
2182 p_timekeeper_data (l_table_counter).day_19 := l_detail_measure;
2183 p_timekeeper_data (l_table_counter).detail_id_19 := l_detail_id;
2184 p_timekeeper_data (l_table_counter).detail_ovn_19 := l_detail_ovn;
2185 p_timekeeper_data (l_table_counter).time_in_19 := l_detail_time_in;
2186 p_timekeeper_data (l_table_counter).time_out_19 := l_detail_time_out;
2187 ELSIF ((l_timecard_start_time - l_add_index_day + 19) = l_detail_start_time) THEN
2188 p_timekeeper_data (l_table_counter).day_20 := l_detail_measure;
2189 p_timekeeper_data (l_table_counter).detail_id_20 := l_detail_id;
2190 p_timekeeper_data (l_table_counter).detail_ovn_20 := l_detail_ovn;
2191 p_timekeeper_data (l_table_counter).time_in_20 := l_detail_time_in;
2192 p_timekeeper_data (l_table_counter).time_out_20 := l_detail_time_out;
2193 ELSIF ((l_timecard_start_time - l_add_index_day + 20) = l_detail_start_time) THEN
2194 p_timekeeper_data (l_table_counter).day_21 := l_detail_measure;
2195 p_timekeeper_data (l_table_counter).detail_id_21 := l_detail_id;
2196 p_timekeeper_data (l_table_counter).detail_ovn_21 := l_detail_ovn;
2197 p_timekeeper_data (l_table_counter).time_in_21 := l_detail_time_in;
2198 p_timekeeper_data (l_table_counter).time_out_21 := l_detail_time_out;
2199 ELSIF ((l_timecard_start_time - l_add_index_day + 21) = l_detail_start_time) THEN
2200 p_timekeeper_data (l_table_counter).day_22 := l_detail_measure;
2201 p_timekeeper_data (l_table_counter).detail_id_22 := l_detail_id;
2202 p_timekeeper_data (l_table_counter).detail_ovn_22 := l_detail_ovn;
2203 p_timekeeper_data (l_table_counter).time_in_22 := l_detail_time_in;
2204 p_timekeeper_data (l_table_counter).time_out_22 := l_detail_time_out;
2205 ELSIF ((l_timecard_start_time - l_add_index_day + 22) = l_detail_start_time) THEN
2206 p_timekeeper_data (l_table_counter).day_23 := l_detail_measure;
2207 p_timekeeper_data (l_table_counter).detail_id_23 := l_detail_id;
2208 p_timekeeper_data (l_table_counter).detail_ovn_23 := l_detail_ovn;
2209 p_timekeeper_data (l_table_counter).time_in_23 := l_detail_time_in;
2210 p_timekeeper_data (l_table_counter).time_out_23 := l_detail_time_out;
2211 ELSIF ((l_timecard_start_time - l_add_index_day + 23) = l_detail_start_time) THEN
2212 p_timekeeper_data (l_table_counter).day_24 := l_detail_measure;
2213 p_timekeeper_data (l_table_counter).detail_id_24 := l_detail_id;
2214 p_timekeeper_data (l_table_counter).detail_ovn_24 := l_detail_ovn;
2215 p_timekeeper_data (l_table_counter).time_in_24 := l_detail_time_in;
2216 p_timekeeper_data (l_table_counter).time_out_24 := l_detail_time_out;
2217 ELSIF ((l_timecard_start_time - l_add_index_day + 24) = l_detail_start_time) THEN
2218 p_timekeeper_data (l_table_counter).day_25 := l_detail_measure;
2219 p_timekeeper_data (l_table_counter).detail_id_25 := l_detail_id;
2220 p_timekeeper_data (l_table_counter).detail_ovn_25 := l_detail_ovn;
2221 p_timekeeper_data (l_table_counter).time_in_25 := l_detail_time_in;
2222 p_timekeeper_data (l_table_counter).time_out_25 := l_detail_time_out;
2223 ELSIF ((l_timecard_start_time - l_add_index_day + 25) = l_detail_start_time) THEN
2224 p_timekeeper_data (l_table_counter).day_26 := l_detail_measure;
2225 p_timekeeper_data (l_table_counter).detail_id_26 := l_detail_id;
2226 p_timekeeper_data (l_table_counter).detail_ovn_26 := l_detail_ovn;
2227 p_timekeeper_data (l_table_counter).time_in_26 := l_detail_time_in;
2228 p_timekeeper_data (l_table_counter).time_out_26 := l_detail_time_out;
2229 ELSIF ((l_timecard_start_time - l_add_index_day + 26) = l_detail_start_time) THEN
2230 p_timekeeper_data (l_table_counter).day_27 := l_detail_measure;
2231 p_timekeeper_data (l_table_counter).detail_id_27 := l_detail_id;
2232 p_timekeeper_data (l_table_counter).detail_ovn_27 := l_detail_ovn;
2233 p_timekeeper_data (l_table_counter).time_in_27 := l_detail_time_in;
2234 p_timekeeper_data (l_table_counter).time_out_27 := l_detail_time_out;
2235 ELSIF ((l_timecard_start_time - l_add_index_day + 27) = l_detail_start_time) THEN
2236 p_timekeeper_data (l_table_counter).day_28 := l_detail_measure;
2237 p_timekeeper_data (l_table_counter).detail_id_28 := l_detail_id;
2238 p_timekeeper_data (l_table_counter).detail_ovn_28 := l_detail_ovn;
2239 p_timekeeper_data (l_table_counter).time_in_28 := l_detail_time_in;
2240 p_timekeeper_data (l_table_counter).time_out_28 := l_detail_time_out;
2241 ELSIF ((l_timecard_start_time - l_add_index_day + 28) = l_detail_start_time) THEN
2242 p_timekeeper_data (l_table_counter).day_29 := l_detail_measure;
2243 p_timekeeper_data (l_table_counter).detail_id_29 := l_detail_id;
2244 p_timekeeper_data (l_table_counter).detail_ovn_29 := l_detail_ovn;
2245 p_timekeeper_data (l_table_counter).time_in_29 := l_detail_time_in;
2246 p_timekeeper_data (l_table_counter).time_out_29 := l_detail_time_out;
2247 ELSIF ((l_timecard_start_time - l_add_index_day + 29) = l_detail_start_time) THEN
2248 p_timekeeper_data (l_table_counter).day_30 := l_detail_measure;
2249 p_timekeeper_data (l_table_counter).detail_id_30 := l_detail_id;
2250 p_timekeeper_data (l_table_counter).detail_ovn_30 := l_detail_ovn;
2251 p_timekeeper_data (l_table_counter).time_in_30 := l_detail_time_in;
2252 p_timekeeper_data (l_table_counter).time_out_30 := l_detail_time_out;
2253 ELSIF ((l_timecard_start_time - l_add_index_day + 30) = l_detail_start_time) THEN
2254 p_timekeeper_data (l_table_counter).day_31 := l_detail_measure;
2255 p_timekeeper_data (l_table_counter).detail_id_31 := l_detail_id;
2256 p_timekeeper_data (l_table_counter).detail_ovn_31 := l_detail_ovn;
2257 p_timekeeper_data (l_table_counter).time_in_31 := l_detail_time_in;
2258 p_timekeeper_data (l_table_counter).time_out_31 := l_detail_time_out;
2259 END IF;
2260 END IF;
2261
2262 IF changed = 'Y' THEN
2263 l_table_counter := changed_no;
2264 END IF;
2265
2266 changed := 'N';
2267 t_base_index := t_base_table.NEXT (t_base_index);
2268 END LOOP;
2269 /*ADVICE(2285): Nested LOOPs should all be labeled [406] */
2270
2271 END IF; -- end if attribute
2272
2273 -- now loop how many detail we still have to process
2274
2275 -- we need to handle the detail with no attribute attached here.....
2276
2277 l_detail_index := l_detail_info_table.FIRST;
2278
2279 -- the timecard is there but contains not detail
2280
2281 IF ( l_detail_info_table.COUNT = 0
2282 AND l_found_detail = FALSE
2283 AND p_status_code IS NULL
2284 AND p_message_type IS NULL
2285 AND p_message_text IS NULL
2286 AND p_change_reason IS NULL
2287 AND p_late_reason IS NULL
2288 AND p_audit_history IS NULL
2289 AND ( p_attribute1 IS NULL
2290 AND p_attribute2 IS NULL
2291 AND p_attribute3 IS NULL
2292 AND p_attribute4 IS NULL
2293 AND p_attribute5 IS NULL
2294 AND p_attribute6 IS NULL
2295 AND p_attribute7 IS NULL
2296 AND p_attribute8 IS NULL
2297 AND p_attribute9 IS NULL
2298 AND p_attribute10 IS NULL
2299 AND p_attribute11 IS NULL
2300 AND p_attribute12 IS NULL
2301 AND p_attribute13 IS NULL
2302 AND p_attribute14 IS NULL
2303 AND p_attribute15 IS NULL
2304 AND p_attribute16 IS NULL
2305 AND p_attribute17 IS NULL
2306 AND p_attribute18 IS NULL
2307 AND p_attribute19 IS NULL
2308 AND p_attribute20 IS NULL
2309 )
2310 ) THEN
2311 l_table_counter := l_table_counter + 1;
2312
2313 IF p_reqryflg = 'N' THEN
2314 p_timekeeper_data (l_table_counter).check_box := 'Y';
2315 g_submit_table (resource_info.person_id).resource_id := resource_info.person_id;
2316 g_submit_table (resource_info.person_id).timecard_id := l_timecard_id;
2317 g_submit_table (resource_info.person_id).start_time := tc_start;
2318 g_submit_table (resource_info.person_id).stop_time := tc_end;
2319 g_submit_table (resource_info.person_id).row_lock_id := l_row_lock_id;
2320 g_submit_table (resource_info.person_id).no_rows :=
2321 NVL (g_submit_table (resource_info.person_id).no_rows, 0) + 1;
2322 ELSE
2323 p_timekeeper_data (l_table_counter).check_box := 'N';
2324 g_submit_table.DELETE (resource_info.person_id);
2325 END IF;
2326
2327 p_timekeeper_data (l_table_counter).timecard_status_code := l_status_code;
2328 p_timekeeper_data (l_table_counter).timecard_status := l_timecard_status_meaning;
2329 p_timekeeper_data (l_table_counter).timecard_message_code := l_timecard_message_code;
2330 p_timekeeper_data (l_table_counter).timecard_message := l_timecard_message;
2331 p_timekeeper_data (l_table_counter).timecard_start_period := tc_start;
2332 p_timekeeper_data (l_table_counter).timecard_end_period := tc_end;
2333 p_timekeeper_data (l_table_counter).comment_text := l_timecard_comment_text;
2334 p_timekeeper_data (l_table_counter).timecard_id := l_timecard_id;
2335 p_timekeeper_data (l_table_counter).timecard_ovn := l_timecard_ovn;
2336 p_timekeeper_data (l_table_counter).resource_id := resource_info.person_id;
2337 p_timekeeper_data (l_table_counter).employee_number := resource_info.employee_number;
2338 p_timekeeper_data (l_table_counter).person_type := resource_info.person_type;
2339 p_timekeeper_data (l_table_counter).audit_enabled := l_audit_enabled;
2340 p_timekeeper_data (l_table_counter).employee_full_name := resource_info.full_name;
2341 p_timekeeper_data (l_table_counter).last_update_date := l_last_update_date;
2342 p_timekeeper_data (l_table_counter).last_updated_by := l_last_updated_by;
2343 p_timekeeper_data (l_table_counter).last_update_login := l_last_update_login;
2344 p_timekeeper_data (l_table_counter).created_by := l_created_by;
2345 p_timekeeper_data (l_table_counter).creation_date := l_creation_date;
2346 p_timekeeper_data (l_table_counter).row_lock_id := l_row_lock_id;
2347 p_timekeeper_data (l_table_counter).tc_lock_success := l_tc_lock_success;
2348 ELSE
2349 -- IF (p_status_code is null and p_hours_type_id is null) THEN
2350
2351 IF ( p_attribute1 IS NULL
2352 AND p_attribute2 IS NULL
2353 AND p_attribute3 IS NULL
2354 AND p_attribute4 IS NULL
2355 AND p_attribute5 IS NULL
2356 AND p_attribute6 IS NULL
2357 AND p_attribute7 IS NULL
2358 AND p_attribute8 IS NULL
2359 AND p_attribute9 IS NULL
2360 AND p_attribute10 IS NULL
2361 AND p_attribute11 IS NULL
2362 AND p_attribute12 IS NULL
2363 AND p_attribute13 IS NULL
2364 AND p_attribute14 IS NULL
2365 AND p_attribute15 IS NULL
2366 AND p_attribute16 IS NULL
2367 AND p_attribute17 IS NULL
2368 AND p_attribute18 IS NULL
2369 AND p_attribute19 IS NULL
2370 AND p_attribute20 IS NULL
2371 ) THEN
2372 if g_debug then
2373 hr_utility.trace('two'||l_detail_info_table.count);
2374 end if;
2375 l_table_counter := l_table_counter + 1;
2376
2377 LOOP
2378 EXIT WHEN (NOT l_detail_info_table.EXISTS (l_detail_index));
2379 if g_debug then
2380 hr_utility.trace('two row'||l_table_counter);
2381 hr_utility.trace('two row'||l_detail_id);
2382 end if;
2383
2384 p_timekeeper_data (l_table_counter).timecard_status_code := l_status_code;
2385 p_timekeeper_data (l_table_counter).timecard_status := l_timecard_status_meaning;
2386 p_timekeeper_data (l_table_counter).timecard_message_code := l_timecard_message_code;
2387 p_timekeeper_data (l_table_counter).timecard_message := l_timecard_message;
2388
2389 if g_debug then
2390 hr_utility.trace('p_reqryflg is '||p_reqryflg);
2391 end if;
2392 IF p_reqryflg = 'N' THEN
2393 p_timekeeper_data (l_table_counter).check_box := 'Y';
2394 g_submit_table (resource_info.person_id).resource_id := resource_info.person_id;
2395 g_submit_table (resource_info.person_id).timecard_id := l_timecard_id;
2396 g_submit_table (resource_info.person_id).start_time := tc_start;
2397 g_submit_table (resource_info.person_id).stop_time := tc_end;
2398 g_submit_table (resource_info.person_id).row_lock_id := l_row_lock_id;
2399 g_submit_table (resource_info.person_id).no_rows :=
2400 NVL (g_submit_table (resource_info.person_id).no_rows, 0) + 1;
2401 ELSE
2402 p_timekeeper_data (l_table_counter).check_box := 'N';
2403 g_submit_table.DELETE (resource_info.person_id);
2404 END IF;
2405
2406 p_timekeeper_data (l_table_counter).timecard_start_period := tc_start;
2407 p_timekeeper_data (l_table_counter).timecard_end_period := tc_end;
2408 p_timekeeper_data (l_table_counter).timecard_id := l_timecard_id;
2409 p_timekeeper_data (l_table_counter).timecard_ovn := l_timecard_ovn;
2410 p_timekeeper_data (l_table_counter).comment_text := l_timecard_comment_text;
2411 p_timekeeper_data (l_table_counter).resource_id := resource_info.person_id;
2412 p_timekeeper_data (l_table_counter).employee_number := resource_info.employee_number;
2413 p_timekeeper_data (l_table_counter).audit_enabled := l_audit_enabled;
2414 p_timekeeper_data (l_table_counter).person_type := resource_info.person_type;
2415 p_timekeeper_data (l_table_counter).employee_full_name := resource_info.full_name;
2416 p_timekeeper_data (l_table_counter).last_update_date := l_last_update_date;
2417 p_timekeeper_data (l_table_counter).last_updated_by := l_last_updated_by;
2418 p_timekeeper_data (l_table_counter).last_update_login := l_last_update_login;
2419 p_timekeeper_data (l_table_counter).created_by := l_created_by;
2420 p_timekeeper_data (l_table_counter).creation_date := l_creation_date;
2421 p_timekeeper_data (l_table_counter).row_lock_id := l_row_lock_id;
2422 p_timekeeper_data (l_table_counter).tc_lock_success := l_tc_lock_success;
2423 l_detail_id := l_detail_info_table (l_detail_index).detail_id;
2424 l_detail_ovn := l_detail_info_table (l_detail_index).detail_ovn;
2425 l_detail_measure := l_detail_info_table (l_detail_index).measure;
2426 l_detail_start_time := l_detail_info_table (l_detail_index).start_time;
2427 l_detail_time_in := l_detail_info_table (l_detail_index).time_in;
2428 l_detail_time_out := l_detail_info_table (l_detail_index).time_out;
2429 l_detail_comment_text := l_detail_info_table (l_detail_index).detail_comment_text;
2430 -- here we need to check if the item in the table is already populated.
2431
2432 if g_debug then
2433 hr_utility.TRACE ('l_detail_id3'|| l_detail_id);
2434 hr_utility.TRACE ('l_timecard_id3'|| l_timecard_id);
2435 hr_utility.TRACE ('l_detail_comment_text3'|| l_detail_comment_text);
2436 end if;
2437
2438 --
2439
2440 IF l_detail_comment_text IS NOT NULL THEN
2441 if g_debug then
2442 hr_utility.TRACE ('500');
2443 hr_utility.TRACE ('l_detail_id4'|| l_detail_id);
2444 hr_utility.TRACE ('l_timecard_id4'|| l_timecard_id);
2445 hr_utility.TRACE ('l_detail_comment_text4'|| l_detail_comment_text);
2446 end if;
2447
2448 --
2449
2450 IF c%ISOPEN THEN
2451 CLOSE c;
2452 END IF;
2453
2454 OPEN c (l_detail_id);
2455 FETCH c INTO c_row;
2456
2457 IF c%FOUND THEN
2458 UPDATE hxc_tk_detail_temp
2459 SET comment_text = l_detail_comment_text
2460 WHERE detailid = l_detail_id AND timecard_id = l_timecard_id;
2461 ELSE
2462 INSERT INTO hxc_tk_detail_temp
2463 (detailid, timecard_id, comment_text)
2464 VALUES (l_detail_id, l_timecard_id, l_detail_comment_text);
2465 END IF;
2466
2467 CLOSE c;
2468 END IF;
2469
2470 IF (l_timecard_start_time - l_add_index_day = l_detail_start_time) THEN
2471 IF ( p_timekeeper_data (l_table_counter).day_1 IS NULL
2472 AND p_timekeeper_data (l_table_counter).time_in_1 IS NULL
2473 AND p_timekeeper_data (l_table_counter).time_out_1 IS NULL
2474 ) THEN
2475 p_timekeeper_data (l_table_counter).day_1 := l_detail_measure;
2476 p_timekeeper_data (l_table_counter).time_in_1 := l_detail_time_in;
2477 p_timekeeper_data (l_table_counter).time_out_1 := l_detail_time_out;
2478 ELSE
2479 l_table_counter := l_table_counter + 1;
2480 p_timekeeper_data (l_table_counter).day_1 := l_detail_measure;
2481 p_timekeeper_data (l_table_counter).time_in_1 := l_detail_time_in;
2482 p_timekeeper_data (l_table_counter).time_out_1 := l_detail_time_out;
2483 END IF;
2484
2485 p_timekeeper_data (l_table_counter).detail_id_1 := l_detail_id;
2486 p_timekeeper_data (l_table_counter).detail_ovn_1 := l_detail_ovn;
2487 ELSIF ((l_timecard_start_time - l_add_index_day + 1) = l_detail_start_time) THEN
2488 IF ( p_timekeeper_data (l_table_counter).day_2 IS NULL
2489 AND p_timekeeper_data (l_table_counter).time_in_2 IS NULL
2490 AND p_timekeeper_data (l_table_counter).time_out_2 IS NULL
2491 ) THEN
2492 p_timekeeper_data (l_table_counter).day_2 := l_detail_measure;
2493 p_timekeeper_data (l_table_counter).time_in_2 := l_detail_time_in;
2494 p_timekeeper_data (l_table_counter).time_out_2 := l_detail_time_out;
2495 ELSE
2496 l_table_counter := l_table_counter + 1;
2497 p_timekeeper_data (l_table_counter).day_2 := l_detail_measure;
2498 p_timekeeper_data (l_table_counter).time_in_2 := l_detail_time_in;
2499 p_timekeeper_data (l_table_counter).time_out_2 := l_detail_time_out;
2500 END IF;
2501
2502 p_timekeeper_data (l_table_counter).detail_id_2 := l_detail_id;
2503 p_timekeeper_data (l_table_counter).detail_ovn_2 := l_detail_ovn;
2504 ELSIF ((l_timecard_start_time - l_add_index_day + 2) = l_detail_start_time) THEN
2505 IF ( p_timekeeper_data (l_table_counter).day_3 IS NULL
2506 AND p_timekeeper_data (l_table_counter).time_in_3 IS NULL
2507 AND p_timekeeper_data (l_table_counter).time_out_3 IS NULL
2508 ) THEN
2509 p_timekeeper_data (l_table_counter).day_3 := l_detail_measure;
2510 p_timekeeper_data (l_table_counter).time_in_3 := l_detail_time_in;
2511 p_timekeeper_data (l_table_counter).time_out_3 := l_detail_time_out;
2512 ELSE
2513 l_table_counter := l_table_counter + 1;
2514 p_timekeeper_data (l_table_counter).day_3 := l_detail_measure;
2515 p_timekeeper_data (l_table_counter).time_in_3 := l_detail_time_in;
2516 p_timekeeper_data (l_table_counter).time_out_3 := l_detail_time_out;
2517 END IF;
2518
2519 p_timekeeper_data (l_table_counter).detail_id_3 := l_detail_id;
2520 p_timekeeper_data (l_table_counter).detail_ovn_3 := l_detail_ovn;
2521 ELSIF ((l_timecard_start_time - l_add_index_day + 3) = l_detail_start_time) THEN
2522 IF ( p_timekeeper_data (l_table_counter).day_4 IS NULL
2523 AND p_timekeeper_data (l_table_counter).time_in_4 IS NULL
2524 AND p_timekeeper_data (l_table_counter).time_out_4 IS NULL
2525 ) THEN
2526 p_timekeeper_data (l_table_counter).day_4 := l_detail_measure;
2527 p_timekeeper_data (l_table_counter).time_in_4 := l_detail_time_in;
2528 p_timekeeper_data (l_table_counter).time_out_4 := l_detail_time_out;
2529 ELSE
2530 l_table_counter := l_table_counter + 1;
2531 p_timekeeper_data (l_table_counter).day_4 := l_detail_measure;
2532 p_timekeeper_data (l_table_counter).time_in_4 := l_detail_time_in;
2533 p_timekeeper_data (l_table_counter).time_out_4 := l_detail_time_out;
2534 END IF;
2535
2536 p_timekeeper_data (l_table_counter).detail_id_4 := l_detail_id;
2537 p_timekeeper_data (l_table_counter).detail_ovn_4 := l_detail_ovn;
2538 ELSIF ((l_timecard_start_time - l_add_index_day + 4) = l_detail_start_time) THEN
2539 IF ( p_timekeeper_data (l_table_counter).day_5 IS NULL
2540 AND p_timekeeper_data (l_table_counter).time_in_5 IS NULL
2541 AND p_timekeeper_data (l_table_counter).time_out_5 IS NULL
2542 ) THEN
2543 p_timekeeper_data (l_table_counter).day_5 := l_detail_measure;
2544 p_timekeeper_data (l_table_counter).time_in_5 := l_detail_time_in;
2545 p_timekeeper_data (l_table_counter).time_out_5 := l_detail_time_out;
2546 ELSE
2547 l_table_counter := l_table_counter + 1;
2548 p_timekeeper_data (l_table_counter).day_5 := l_detail_measure;
2549 p_timekeeper_data (l_table_counter).time_in_5 := l_detail_time_in;
2550 p_timekeeper_data (l_table_counter).time_out_5 := l_detail_time_out;
2551 END IF;
2552
2553 p_timekeeper_data (l_table_counter).detail_id_5 := l_detail_id;
2554 p_timekeeper_data (l_table_counter).detail_ovn_5 := l_detail_ovn;
2555 ELSIF ((l_timecard_start_time - l_add_index_day + 5) = l_detail_start_time) THEN
2556 IF ( p_timekeeper_data (l_table_counter).day_6 IS NULL
2557 AND p_timekeeper_data (l_table_counter).time_in_6 IS NULL
2558 AND p_timekeeper_data (l_table_counter).time_out_6 IS NULL
2559 ) THEN
2560 p_timekeeper_data (l_table_counter).day_6 := l_detail_measure;
2561 p_timekeeper_data (l_table_counter).time_in_6 := l_detail_time_in;
2562 p_timekeeper_data (l_table_counter).time_out_6 := l_detail_time_out;
2563 ELSE
2564 l_table_counter := l_table_counter + 1;
2565 p_timekeeper_data (l_table_counter).day_6 := l_detail_measure;
2566 p_timekeeper_data (l_table_counter).time_in_6 := l_detail_time_in;
2567 p_timekeeper_data (l_table_counter).time_out_6 := l_detail_time_out;
2568 END IF;
2569
2570 p_timekeeper_data (l_table_counter).detail_id_6 := l_detail_id;
2571 p_timekeeper_data (l_table_counter).detail_ovn_6 := l_detail_ovn;
2572 ELSIF ((l_timecard_start_time - l_add_index_day + 6) = l_detail_start_time) THEN
2573 IF ( p_timekeeper_data (l_table_counter).day_7 IS NULL
2574 AND p_timekeeper_data (l_table_counter).time_in_7 IS NULL
2575 AND p_timekeeper_data (l_table_counter).time_out_7 IS NULL
2576 ) THEN
2577 p_timekeeper_data (l_table_counter).day_7 := l_detail_measure;
2578 p_timekeeper_data (l_table_counter).time_in_7 := l_detail_time_in;
2579 p_timekeeper_data (l_table_counter).time_out_7 := l_detail_time_out;
2580 ELSE
2581 l_table_counter := l_table_counter + 1;
2582 p_timekeeper_data (l_table_counter).day_7 := l_detail_measure;
2583 p_timekeeper_data (l_table_counter).time_in_7 := l_detail_time_in;
2584 p_timekeeper_data (l_table_counter).time_out_7 := l_detail_time_out;
2585 END IF;
2586
2587 p_timekeeper_data (l_table_counter).detail_id_7 := l_detail_id;
2588 p_timekeeper_data (l_table_counter).detail_ovn_7 := l_detail_ovn;
2589 ELSIF ((l_timecard_start_time - l_add_index_day + 7) = l_detail_start_time) THEN
2590 IF ( p_timekeeper_data (l_table_counter).day_8 IS NULL
2591 AND p_timekeeper_data (l_table_counter).time_in_8 IS NULL
2592 AND p_timekeeper_data (l_table_counter).time_out_8 IS NULL
2593 ) THEN
2594 p_timekeeper_data (l_table_counter).day_8 := l_detail_measure;
2595 p_timekeeper_data (l_table_counter).time_in_8 := l_detail_time_in;
2596 p_timekeeper_data (l_table_counter).time_out_8 := l_detail_time_out;
2597 ELSE
2598 l_table_counter := l_table_counter + 1;
2599 p_timekeeper_data (l_table_counter).day_8 := l_detail_measure;
2600 p_timekeeper_data (l_table_counter).time_in_8 := l_detail_time_in;
2601 p_timekeeper_data (l_table_counter).time_out_8 := l_detail_time_out;
2602 END IF;
2603
2604 p_timekeeper_data (l_table_counter).detail_id_8 := l_detail_id;
2605 p_timekeeper_data (l_table_counter).detail_ovn_8 := l_detail_ovn;
2606 ELSIF ((l_timecard_start_time - l_add_index_day + 8) = l_detail_start_time) THEN
2607 IF ( p_timekeeper_data (l_table_counter).day_9 IS NULL
2608 AND p_timekeeper_data (l_table_counter).time_in_9 IS NULL
2609 AND p_timekeeper_data (l_table_counter).time_out_9 IS NULL
2610 ) THEN
2611 p_timekeeper_data (l_table_counter).day_9 := l_detail_measure;
2612 p_timekeeper_data (l_table_counter).time_in_9 := l_detail_time_in;
2613 p_timekeeper_data (l_table_counter).time_out_9 := l_detail_time_out;
2614 ELSE
2615 l_table_counter := l_table_counter + 1;
2616 p_timekeeper_data (l_table_counter).day_9 := l_detail_measure;
2617 p_timekeeper_data (l_table_counter).time_in_9 := l_detail_time_in;
2618 p_timekeeper_data (l_table_counter).time_out_9 := l_detail_time_out;
2619 END IF;
2620
2621 p_timekeeper_data (l_table_counter).detail_id_9 := l_detail_id;
2622 p_timekeeper_data (l_table_counter).detail_ovn_9 := l_detail_ovn;
2623 ELSIF ((l_timecard_start_time - l_add_index_day + 9) = l_detail_start_time) THEN
2624 IF ( p_timekeeper_data (l_table_counter).day_10 IS NULL
2625 AND p_timekeeper_data (l_table_counter).time_in_10 IS NULL
2626 AND p_timekeeper_data (l_table_counter).time_out_10 IS NULL
2627 ) THEN
2628 p_timekeeper_data (l_table_counter).day_10 := l_detail_measure;
2629 p_timekeeper_data (l_table_counter).time_in_10 := l_detail_time_in;
2630 p_timekeeper_data (l_table_counter).time_out_10 := l_detail_time_out;
2631 ELSE
2632 l_table_counter := l_table_counter + 1;
2633 p_timekeeper_data (l_table_counter).day_10 := l_detail_measure;
2634 p_timekeeper_data (l_table_counter).time_in_10 := l_detail_time_in;
2635 p_timekeeper_data (l_table_counter).time_out_10 := l_detail_time_out;
2636 END IF;
2637
2638 p_timekeeper_data (l_table_counter).detail_id_10 := l_detail_id;
2639 p_timekeeper_data (l_table_counter).detail_ovn_10 := l_detail_ovn;
2640 ELSIF ((l_timecard_start_time - l_add_index_day + 10) = l_detail_start_time) THEN
2641 IF ( p_timekeeper_data (l_table_counter).day_11 IS NULL
2642 AND p_timekeeper_data (l_table_counter).time_in_11 IS NULL
2643 AND p_timekeeper_data (l_table_counter).time_out_11 IS NULL
2644 ) THEN
2645 p_timekeeper_data (l_table_counter).day_11 := l_detail_measure;
2646 p_timekeeper_data (l_table_counter).time_in_11 := l_detail_time_in;
2647 p_timekeeper_data (l_table_counter).time_out_11 := l_detail_time_out;
2648 ELSE
2649 l_table_counter := l_table_counter + 1;
2650 p_timekeeper_data (l_table_counter).day_11 := l_detail_measure;
2651 p_timekeeper_data (l_table_counter).time_in_11 := l_detail_time_in;
2652 p_timekeeper_data (l_table_counter).time_out_11 := l_detail_time_out;
2653 END IF;
2654
2655 p_timekeeper_data (l_table_counter).detail_id_11 := l_detail_id;
2656 p_timekeeper_data (l_table_counter).detail_ovn_11 := l_detail_ovn;
2657 ELSIF ((l_timecard_start_time - l_add_index_day + 11) = l_detail_start_time) THEN
2658 IF ( p_timekeeper_data (l_table_counter).day_12 IS NULL
2659 AND p_timekeeper_data (l_table_counter).time_in_12 IS NULL
2660 AND p_timekeeper_data (l_table_counter).time_out_12 IS NULL
2661 ) THEN
2662 p_timekeeper_data (l_table_counter).day_12 := l_detail_measure;
2663 p_timekeeper_data (l_table_counter).time_in_12 := l_detail_time_in;
2664 p_timekeeper_data (l_table_counter).time_out_12 := l_detail_time_out;
2665 ELSE
2666 l_table_counter := l_table_counter + 1;
2667 p_timekeeper_data (l_table_counter).day_12 := l_detail_measure;
2668 p_timekeeper_data (l_table_counter).time_in_12 := l_detail_time_in;
2669 p_timekeeper_data (l_table_counter).time_out_12 := l_detail_time_out;
2670 END IF;
2671
2672 p_timekeeper_data (l_table_counter).detail_id_12 := l_detail_id;
2673 p_timekeeper_data (l_table_counter).detail_ovn_12 := l_detail_ovn;
2674 ELSIF ((l_timecard_start_time - l_add_index_day + 12) = l_detail_start_time) THEN
2675 IF ( p_timekeeper_data (l_table_counter).day_13 IS NULL
2676 AND p_timekeeper_data (l_table_counter).time_in_13 IS NULL
2677 AND p_timekeeper_data (l_table_counter).time_out_13 IS NULL
2678 ) THEN
2679 p_timekeeper_data (l_table_counter).day_13 := l_detail_measure;
2680 p_timekeeper_data (l_table_counter).time_in_13 := l_detail_time_in;
2681 p_timekeeper_data (l_table_counter).time_out_13 := l_detail_time_out;
2682 ELSE
2683 l_table_counter := l_table_counter + 1;
2684 p_timekeeper_data (l_table_counter).day_13 := l_detail_measure;
2685 p_timekeeper_data (l_table_counter).time_in_13 := l_detail_time_in;
2686 p_timekeeper_data (l_table_counter).time_out_13 := l_detail_time_out;
2687 END IF;
2688
2689 p_timekeeper_data (l_table_counter).detail_id_13 := l_detail_id;
2690 p_timekeeper_data (l_table_counter).detail_ovn_13 := l_detail_ovn;
2691 ELSIF ((l_timecard_start_time - l_add_index_day + 13) = l_detail_start_time) THEN
2692 IF ( p_timekeeper_data (l_table_counter).day_14 IS NULL
2693 AND p_timekeeper_data (l_table_counter).time_in_14 IS NULL
2694 AND p_timekeeper_data (l_table_counter).time_out_14 IS NULL
2695 ) THEN
2696 p_timekeeper_data (l_table_counter).day_14 := l_detail_measure;
2697 p_timekeeper_data (l_table_counter).time_in_14 := l_detail_time_in;
2698 p_timekeeper_data (l_table_counter).time_out_14 := l_detail_time_out;
2699 ELSE
2700 l_table_counter := l_table_counter + 1;
2701 p_timekeeper_data (l_table_counter).day_14 := l_detail_measure;
2702 p_timekeeper_data (l_table_counter).time_in_14 := l_detail_time_in;
2703 p_timekeeper_data (l_table_counter).time_out_14 := l_detail_time_out;
2704 END IF;
2705
2706 p_timekeeper_data (l_table_counter).detail_id_14 := l_detail_id;
2707 p_timekeeper_data (l_table_counter).detail_ovn_14 := l_detail_ovn;
2708 ELSIF ((l_timecard_start_time - l_add_index_day + 14) = l_detail_start_time) THEN
2709 IF ( p_timekeeper_data (l_table_counter).day_15 IS NULL
2710 AND p_timekeeper_data (l_table_counter).time_in_15 IS NULL
2711 AND p_timekeeper_data (l_table_counter).time_out_15 IS NULL
2712 ) THEN
2713 p_timekeeper_data (l_table_counter).day_15 := l_detail_measure;
2714 p_timekeeper_data (l_table_counter).time_in_15 := l_detail_time_in;
2715 p_timekeeper_data (l_table_counter).time_out_15 := l_detail_time_out;
2716 ELSE
2717 l_table_counter := l_table_counter + 1;
2718 p_timekeeper_data (l_table_counter).day_15 := l_detail_measure;
2719 p_timekeeper_data (l_table_counter).time_in_15 := l_detail_time_in;
2720 p_timekeeper_data (l_table_counter).time_out_15 := l_detail_time_out;
2721 END IF;
2722
2723 p_timekeeper_data (l_table_counter).detail_id_15 := l_detail_id;
2724 p_timekeeper_data (l_table_counter).detail_ovn_15 := l_detail_ovn;
2725 ELSIF ((l_timecard_start_time - l_add_index_day + 15) = l_detail_start_time) THEN
2726 IF ( p_timekeeper_data (l_table_counter).day_16 IS NULL
2727 AND p_timekeeper_data (l_table_counter).time_in_16 IS NULL
2728 AND p_timekeeper_data (l_table_counter).time_out_16 IS NULL
2729 ) THEN
2730 p_timekeeper_data (l_table_counter).day_16 := l_detail_measure;
2731 p_timekeeper_data (l_table_counter).time_in_16 := l_detail_time_in;
2732 p_timekeeper_data (l_table_counter).time_out_16 := l_detail_time_out;
2733 ELSE
2734 l_table_counter := l_table_counter + 1;
2735 p_timekeeper_data (l_table_counter).day_16 := l_detail_measure;
2736 p_timekeeper_data (l_table_counter).time_in_16 := l_detail_time_in;
2737 p_timekeeper_data (l_table_counter).time_out_16 := l_detail_time_out;
2738 END IF;
2739
2740 p_timekeeper_data (l_table_counter).detail_id_16 := l_detail_id;
2741 p_timekeeper_data (l_table_counter).detail_ovn_16 := l_detail_ovn;
2742 ELSIF ((l_timecard_start_time - l_add_index_day + 16) = l_detail_start_time) THEN
2743 IF ( p_timekeeper_data (l_table_counter).day_17 IS NULL
2744 AND p_timekeeper_data (l_table_counter).time_in_17 IS NULL
2745 AND p_timekeeper_data (l_table_counter).time_out_17 IS NULL
2746 ) THEN
2747 p_timekeeper_data (l_table_counter).day_17 := l_detail_measure;
2748 p_timekeeper_data (l_table_counter).time_in_17 := l_detail_time_in;
2749 p_timekeeper_data (l_table_counter).time_out_17 := l_detail_time_out;
2750 ELSE
2751 l_table_counter := l_table_counter + 1;
2752 p_timekeeper_data (l_table_counter).day_17 := l_detail_measure;
2753 p_timekeeper_data (l_table_counter).time_in_17 := l_detail_time_in;
2754 p_timekeeper_data (l_table_counter).time_out_17 := l_detail_time_out;
2755 END IF;
2756
2757 p_timekeeper_data (l_table_counter).detail_id_17 := l_detail_id;
2758 p_timekeeper_data (l_table_counter).detail_ovn_17 := l_detail_ovn;
2759 ELSIF ((l_timecard_start_time - l_add_index_day + 17) = l_detail_start_time) THEN
2760 IF ( p_timekeeper_data (l_table_counter).day_18 IS NULL
2761 AND p_timekeeper_data (l_table_counter).time_in_18 IS NULL
2762 AND p_timekeeper_data (l_table_counter).time_out_18 IS NULL
2763 ) THEN
2764 p_timekeeper_data (l_table_counter).day_18 := l_detail_measure;
2765 p_timekeeper_data (l_table_counter).time_in_18 := l_detail_time_in;
2766 p_timekeeper_data (l_table_counter).time_out_18 := l_detail_time_out;
2767 ELSE
2768 l_table_counter := l_table_counter + 1;
2769 p_timekeeper_data (l_table_counter).day_18 := l_detail_measure;
2770 p_timekeeper_data (l_table_counter).time_in_18 := l_detail_time_in;
2771 p_timekeeper_data (l_table_counter).time_out_18 := l_detail_time_out;
2772 END IF;
2773
2774 p_timekeeper_data (l_table_counter).detail_id_18 := l_detail_id;
2775 p_timekeeper_data (l_table_counter).detail_ovn_18 := l_detail_ovn;
2776 ELSIF ((l_timecard_start_time - l_add_index_day + 18) = l_detail_start_time) THEN
2777 IF ( p_timekeeper_data (l_table_counter).day_19 IS NULL
2778 AND p_timekeeper_data (l_table_counter).time_in_19 IS NULL
2779 AND p_timekeeper_data (l_table_counter).time_out_19 IS NULL
2780 ) THEN
2781 p_timekeeper_data (l_table_counter).day_19 := l_detail_measure;
2782 p_timekeeper_data (l_table_counter).time_in_19 := l_detail_time_in;
2783 p_timekeeper_data (l_table_counter).time_out_19 := l_detail_time_out;
2784 ELSE
2785 l_table_counter := l_table_counter + 1;
2786 p_timekeeper_data (l_table_counter).day_19 := l_detail_measure;
2787 p_timekeeper_data (l_table_counter).time_in_19 := l_detail_time_in;
2788 p_timekeeper_data (l_table_counter).time_out_19 := l_detail_time_out;
2789 END IF;
2790
2791 p_timekeeper_data (l_table_counter).detail_id_19 := l_detail_id;
2792 p_timekeeper_data (l_table_counter).detail_ovn_19 := l_detail_ovn;
2793 ELSIF ((l_timecard_start_time - l_add_index_day + 19) = l_detail_start_time) THEN
2794 IF ( p_timekeeper_data (l_table_counter).day_20 IS NULL
2795 AND p_timekeeper_data (l_table_counter).time_in_20 IS NULL
2796 AND p_timekeeper_data (l_table_counter).time_out_20 IS NULL
2797 ) THEN
2798 p_timekeeper_data (l_table_counter).day_20 := l_detail_measure;
2799 p_timekeeper_data (l_table_counter).time_in_20 := l_detail_time_in;
2800 p_timekeeper_data (l_table_counter).time_out_20 := l_detail_time_out;
2801 ELSE
2802 l_table_counter := l_table_counter + 1;
2803 p_timekeeper_data (l_table_counter).day_20 := l_detail_measure;
2804 p_timekeeper_data (l_table_counter).time_in_20 := l_detail_time_in;
2805 p_timekeeper_data (l_table_counter).time_out_20 := l_detail_time_out;
2806 END IF;
2807
2808 p_timekeeper_data (l_table_counter).detail_id_20 := l_detail_id;
2809 p_timekeeper_data (l_table_counter).detail_ovn_20 := l_detail_ovn;
2810 ELSIF ((l_timecard_start_time - l_add_index_day + 20) = l_detail_start_time) THEN
2811 IF ( p_timekeeper_data (l_table_counter).day_21 IS NULL
2812 AND p_timekeeper_data (l_table_counter).time_in_21 IS NULL
2813 AND p_timekeeper_data (l_table_counter).time_out_21 IS NULL
2814 ) THEN
2815 p_timekeeper_data (l_table_counter).day_21 := l_detail_measure;
2816 p_timekeeper_data (l_table_counter).time_in_21 := l_detail_time_in;
2817 p_timekeeper_data (l_table_counter).time_out_21 := l_detail_time_out;
2818 ELSE
2819 l_table_counter := l_table_counter + 1;
2820 p_timekeeper_data (l_table_counter).day_21 := l_detail_measure;
2821 p_timekeeper_data (l_table_counter).time_in_21 := l_detail_time_in;
2822 p_timekeeper_data (l_table_counter).time_out_21 := l_detail_time_out;
2823 END IF;
2824
2825 p_timekeeper_data (l_table_counter).detail_id_21 := l_detail_id;
2826 p_timekeeper_data (l_table_counter).detail_ovn_21 := l_detail_ovn;
2827 ELSIF ((l_timecard_start_time - l_add_index_day + 21) = l_detail_start_time) THEN
2828 IF ( p_timekeeper_data (l_table_counter).day_22 IS NULL
2829 AND p_timekeeper_data (l_table_counter).time_in_22 IS NULL
2830 AND p_timekeeper_data (l_table_counter).time_out_22 IS NULL
2831 ) THEN
2832 p_timekeeper_data (l_table_counter).day_22 := l_detail_measure;
2833 p_timekeeper_data (l_table_counter).time_in_22 := l_detail_time_in;
2834 p_timekeeper_data (l_table_counter).time_out_22 := l_detail_time_out;
2835 ELSE
2836 l_table_counter := l_table_counter + 1;
2837 p_timekeeper_data (l_table_counter).day_22 := l_detail_measure;
2838 p_timekeeper_data (l_table_counter).time_in_22 := l_detail_time_in;
2839 p_timekeeper_data (l_table_counter).time_out_22 := l_detail_time_out;
2840 END IF;
2841
2842 p_timekeeper_data (l_table_counter).detail_id_22 := l_detail_id;
2843 p_timekeeper_data (l_table_counter).detail_ovn_22 := l_detail_ovn;
2844 ELSIF ((l_timecard_start_time - l_add_index_day + 22) = l_detail_start_time) THEN
2845 IF ( p_timekeeper_data (l_table_counter).day_23 IS NULL
2846 AND p_timekeeper_data (l_table_counter).time_in_23 IS NULL
2847 AND p_timekeeper_data (l_table_counter).time_out_23 IS NULL
2848 ) THEN
2849 p_timekeeper_data (l_table_counter).day_23 := l_detail_measure;
2850 p_timekeeper_data (l_table_counter).time_in_23 := l_detail_time_in;
2851 p_timekeeper_data (l_table_counter).time_out_23 := l_detail_time_out;
2852 ELSE
2853 l_table_counter := l_table_counter + 1;
2854 p_timekeeper_data (l_table_counter).day_23 := l_detail_measure;
2855 p_timekeeper_data (l_table_counter).time_in_23 := l_detail_time_in;
2856 p_timekeeper_data (l_table_counter).time_out_23 := l_detail_time_out;
2857 END IF;
2858
2859 p_timekeeper_data (l_table_counter).detail_id_23 := l_detail_id;
2860 p_timekeeper_data (l_table_counter).detail_ovn_23 := l_detail_ovn;
2861 ELSIF ((l_timecard_start_time - l_add_index_day + 23) = l_detail_start_time) THEN
2862 IF ( p_timekeeper_data (l_table_counter).day_24 IS NULL
2863 AND p_timekeeper_data (l_table_counter).time_in_24 IS NULL
2864 AND p_timekeeper_data (l_table_counter).time_out_24 IS NULL
2865 ) THEN
2866 p_timekeeper_data (l_table_counter).day_24 := l_detail_measure;
2867 p_timekeeper_data (l_table_counter).time_in_24 := l_detail_time_in;
2868 p_timekeeper_data (l_table_counter).time_out_24 := l_detail_time_out;
2869 ELSE
2870 l_table_counter := l_table_counter + 1;
2871 p_timekeeper_data (l_table_counter).day_24 := l_detail_measure;
2872 p_timekeeper_data (l_table_counter).time_in_24 := l_detail_time_in;
2873 p_timekeeper_data (l_table_counter).time_out_24 := l_detail_time_out;
2874 END IF;
2875
2876 p_timekeeper_data (l_table_counter).detail_id_24 := l_detail_id;
2877 p_timekeeper_data (l_table_counter).detail_ovn_24 := l_detail_ovn;
2878 ELSIF ((l_timecard_start_time - l_add_index_day + 24) = l_detail_start_time) THEN
2879 IF ( p_timekeeper_data (l_table_counter).day_25 IS NULL
2880 AND p_timekeeper_data (l_table_counter).time_in_25 IS NULL
2881 AND p_timekeeper_data (l_table_counter).time_out_25 IS NULL
2882 ) THEN
2883 p_timekeeper_data (l_table_counter).day_25 := l_detail_measure;
2884 p_timekeeper_data (l_table_counter).time_in_25 := l_detail_time_in;
2885 p_timekeeper_data (l_table_counter).time_out_25 := l_detail_time_out;
2886 ELSE
2887 l_table_counter := l_table_counter + 1;
2888 p_timekeeper_data (l_table_counter).day_25 := l_detail_measure;
2889 p_timekeeper_data (l_table_counter).time_in_25 := l_detail_time_in;
2890 p_timekeeper_data (l_table_counter).time_out_25 := l_detail_time_out;
2891 END IF;
2892
2893 p_timekeeper_data (l_table_counter).detail_id_25 := l_detail_id;
2894 p_timekeeper_data (l_table_counter).detail_ovn_25 := l_detail_ovn;
2895 ELSIF ((l_timecard_start_time - l_add_index_day + 25) = l_detail_start_time) THEN
2896 IF ( p_timekeeper_data (l_table_counter).day_26 IS NULL
2897 AND p_timekeeper_data (l_table_counter).time_in_26 IS NULL
2898 AND p_timekeeper_data (l_table_counter).time_out_26 IS NULL
2899 ) THEN
2900 p_timekeeper_data (l_table_counter).day_26 := l_detail_measure;
2901 p_timekeeper_data (l_table_counter).time_in_26 := l_detail_time_in;
2902 p_timekeeper_data (l_table_counter).time_out_26 := l_detail_time_out;
2903 ELSE
2904 l_table_counter := l_table_counter + 1;
2905 p_timekeeper_data (l_table_counter).day_26 := l_detail_measure;
2906 p_timekeeper_data (l_table_counter).time_in_26 := l_detail_time_in;
2907 p_timekeeper_data (l_table_counter).time_out_26 := l_detail_time_out;
2908 END IF;
2909
2910 p_timekeeper_data (l_table_counter).detail_id_26 := l_detail_id;
2911 p_timekeeper_data (l_table_counter).detail_ovn_26 := l_detail_ovn;
2912 ELSIF ((l_timecard_start_time - l_add_index_day + 26) = l_detail_start_time) THEN
2913 IF ( p_timekeeper_data (l_table_counter).day_27 IS NULL
2914 AND p_timekeeper_data (l_table_counter).time_in_27 IS NULL
2915 AND p_timekeeper_data (l_table_counter).time_out_27 IS NULL
2916 ) THEN
2917 p_timekeeper_data (l_table_counter).day_27 := l_detail_measure;
2918 p_timekeeper_data (l_table_counter).time_in_27 := l_detail_time_in;
2919 p_timekeeper_data (l_table_counter).time_out_27 := l_detail_time_out;
2920 ELSE
2921 l_table_counter := l_table_counter + 1;
2922 p_timekeeper_data (l_table_counter).day_27 := l_detail_measure;
2923 p_timekeeper_data (l_table_counter).time_in_27 := l_detail_time_in;
2924 p_timekeeper_data (l_table_counter).time_out_27 := l_detail_time_out;
2925 END IF;
2926
2927 p_timekeeper_data (l_table_counter).detail_id_27 := l_detail_id;
2928 p_timekeeper_data (l_table_counter).detail_ovn_27 := l_detail_ovn;
2929 ELSIF ((l_timecard_start_time - l_add_index_day + 27) = l_detail_start_time) THEN
2930 IF ( p_timekeeper_data (l_table_counter).day_28 IS NULL
2931 AND p_timekeeper_data (l_table_counter).time_in_28 IS NULL
2932 AND p_timekeeper_data (l_table_counter).time_out_28 IS NULL
2933 ) THEN
2934 p_timekeeper_data (l_table_counter).day_28 := l_detail_measure;
2935 p_timekeeper_data (l_table_counter).time_in_28 := l_detail_time_in;
2936 p_timekeeper_data (l_table_counter).time_out_28 := l_detail_time_out;
2937 ELSE
2938 l_table_counter := l_table_counter + 1;
2939 p_timekeeper_data (l_table_counter).day_28 := l_detail_measure;
2940 p_timekeeper_data (l_table_counter).time_in_28 := l_detail_time_in;
2941 p_timekeeper_data (l_table_counter).time_out_28 := l_detail_time_out;
2942 END IF;
2943
2944 p_timekeeper_data (l_table_counter).detail_id_28 := l_detail_id;
2945 p_timekeeper_data (l_table_counter).detail_ovn_28 := l_detail_ovn;
2946 ELSIF ((l_timecard_start_time - l_add_index_day + 28) = l_detail_start_time) THEN
2947 IF ( p_timekeeper_data (l_table_counter).day_29 IS NULL
2948 AND p_timekeeper_data (l_table_counter).time_in_29 IS NULL
2949 AND p_timekeeper_data (l_table_counter).time_out_29 IS NULL
2950 ) THEN
2951 p_timekeeper_data (l_table_counter).day_29 := l_detail_measure;
2952 p_timekeeper_data (l_table_counter).time_in_29 := l_detail_time_in;
2953 p_timekeeper_data (l_table_counter).time_out_29 := l_detail_time_out;
2954 ELSE
2955 l_table_counter := l_table_counter + 1;
2956 p_timekeeper_data (l_table_counter).day_29 := l_detail_measure;
2957 p_timekeeper_data (l_table_counter).time_in_29 := l_detail_time_in;
2958 p_timekeeper_data (l_table_counter).time_out_29 := l_detail_time_out;
2959 END IF;
2960
2961 p_timekeeper_data (l_table_counter).detail_id_29 := l_detail_id;
2962 p_timekeeper_data (l_table_counter).detail_ovn_29 := l_detail_ovn;
2963 ELSIF ((l_timecard_start_time - l_add_index_day + 29) = l_detail_start_time) THEN
2964 IF ( p_timekeeper_data (l_table_counter).day_30 IS NULL
2965 AND p_timekeeper_data (l_table_counter).time_in_30 IS NULL
2966 AND p_timekeeper_data (l_table_counter).time_out_30 IS NULL
2967 ) THEN
2968 p_timekeeper_data (l_table_counter).day_30 := l_detail_measure;
2969 p_timekeeper_data (l_table_counter).time_in_30 := l_detail_time_in;
2970 p_timekeeper_data (l_table_counter).time_out_30 := l_detail_time_out;
2971 ELSE
2972 l_table_counter := l_table_counter + 1;
2973 p_timekeeper_data (l_table_counter).day_30 := l_detail_measure;
2974 p_timekeeper_data (l_table_counter).time_in_30 := l_detail_time_in;
2975 p_timekeeper_data (l_table_counter).time_out_30 := l_detail_time_out;
2976 END IF;
2977
2978 p_timekeeper_data (l_table_counter).detail_id_30 := l_detail_id;
2979 p_timekeeper_data (l_table_counter).detail_ovn_30 := l_detail_ovn;
2980 ELSIF ((l_timecard_start_time - l_add_index_day + 30) = l_detail_start_time) THEN
2981 IF ( p_timekeeper_data (l_table_counter).day_31 IS NULL
2982 AND p_timekeeper_data (l_table_counter).time_in_31 IS NULL
2983 AND p_timekeeper_data (l_table_counter).time_out_31 IS NULL
2984 ) THEN
2985 p_timekeeper_data (l_table_counter).day_31 := l_detail_measure;
2986 p_timekeeper_data (l_table_counter).time_in_31 := l_detail_time_in;
2987 p_timekeeper_data (l_table_counter).time_out_31 := l_detail_time_out;
2988 ELSE
2989 l_table_counter := l_table_counter + 1;
2990 p_timekeeper_data (l_table_counter).day_31 := l_detail_measure;
2991 p_timekeeper_data (l_table_counter).time_in_31 := l_detail_time_in;
2992 p_timekeeper_data (l_table_counter).time_out_31 := l_detail_time_out;
2993 END IF;
2994
2995 p_timekeeper_data (l_table_counter).detail_id_31 := l_detail_id;
2996 p_timekeeper_data (l_table_counter).detail_ovn_31 := l_detail_ovn;
2997 END IF;
2998
2999 p_timekeeper_data (l_table_counter).timecard_status_code := l_status_code;
3000 p_timekeeper_data (l_table_counter).timecard_status := l_timecard_status_meaning;
3001 p_timekeeper_data (l_table_counter).timecard_message_code := l_timecard_message_code;
3002 p_timekeeper_data (l_table_counter).timecard_message := l_timecard_message;
3003 p_timekeeper_data (l_table_counter).comment_text := l_timecard_comment_text;
3004 p_timekeeper_data (l_table_counter).timecard_start_period := tc_start;
3005 p_timekeeper_data (l_table_counter).timecard_end_period := tc_end;
3006
3007 IF p_reqryflg = 'N' THEN
3008 p_timekeeper_data (l_table_counter).check_box := 'Y';
3009 g_submit_table (resource_info.person_id).resource_id := resource_info.person_id;
3010 g_submit_table (resource_info.person_id).timecard_id := l_timecard_id;
3011 g_submit_table (resource_info.person_id).start_time := tc_start;
3012 g_submit_table (resource_info.person_id).stop_time := tc_end;
3013 g_submit_table (resource_info.person_id).row_lock_id := l_row_lock_id;
3014 g_submit_table (resource_info.person_id).no_rows :=
3015 NVL (g_submit_table (resource_info.person_id).no_rows, 0) + 1;
3016 ELSE
3017 p_timekeeper_data (l_table_counter).check_box := 'N';
3018 g_submit_table.DELETE (resource_info.person_id);
3019 END IF;
3020
3021 p_timekeeper_data (l_table_counter).timecard_id := l_timecard_id;
3022 p_timekeeper_data (l_table_counter).timecard_ovn := l_timecard_ovn;
3023 p_timekeeper_data (l_table_counter).resource_id := resource_info.person_id;
3024 p_timekeeper_data (l_table_counter).employee_number := resource_info.employee_number;
3025 p_timekeeper_data (l_table_counter).audit_enabled := l_audit_enabled;
3026 p_timekeeper_data (l_table_counter).person_type := resource_info.person_type;
3027 p_timekeeper_data (l_table_counter).employee_full_name := resource_info.full_name;
3028 p_timekeeper_data (l_table_counter).row_lock_id := l_row_lock_id;
3029 p_timekeeper_data (l_table_counter).tc_lock_success := l_tc_lock_success;
3030 l_detail_index := l_detail_info_table.NEXT (l_detail_index);
3031 END LOOP;
3032 /*ADVICE(3044): Nested LOOPs should all be labeled [406] */
3033
3034 END IF;
3035 if g_debug then
3036 hr_utility.TRACE ('103--end of second type');
3037 end if;
3038 END IF;
3039 -- handle the case that the resource does not have a timecard
3040 --IF (l_found_timecard = false) THEN
3041 ELSIF ( p_status_code IS NULL
3042 AND p_message_type IS NULL
3043 AND p_message_text IS NULL
3044 AND p_change_reason IS NULL
3045 AND p_late_reason IS NULL
3046 AND p_audit_history IS NULL
3047 AND ( p_attribute1 IS NULL
3048 AND p_attribute2 IS NULL
3049 AND p_attribute3 IS NULL
3050 AND p_attribute4 IS NULL
3051 AND p_attribute5 IS NULL
3052 AND p_attribute6 IS NULL
3053 AND p_attribute7 IS NULL
3054 AND p_attribute8 IS NULL
3055 AND p_attribute9 IS NULL
3056 AND p_attribute10 IS NULL
3057 AND p_attribute11 IS NULL
3058 AND p_attribute12 IS NULL
3059 AND p_attribute13 IS NULL
3060 AND p_attribute14 IS NULL
3061 AND p_attribute15 IS NULL
3062 AND p_attribute16 IS NULL
3063 AND p_attribute17 IS NULL
3064 AND p_attribute18 IS NULL
3065 AND p_attribute19 IS NULL
3066 AND p_attribute20 IS NULL
3067 )
3068 ) THEN
3069 if g_debug then
3070 hr_utility.TRACE('104--three- no record so create blank record');
3071 hr_utility.TRACE ('no records');
3072 end if;
3073 BEGIN
3074 --l_rec_periodid := hxc_preference_evaluation.resource_preferences(resource_info.person_id,'TC_W_TCRD_PERIOD',1,SYSDATE);
3075 l_rec_periodid := l_emp_recpref;
3076 EXCEPTION
3077 WHEN OTHERS THEN
3078 l_rec_periodid := 0;
3079 /*ADVICE(3089): A WHEN OTHERS clause is used in the exception section without any other specific handlers
3080 [201] */
3081
3082 END;
3083
3084 l_audit_query := FALSE;
3085 if g_debug then
3086 hr_utility.TRACE ('l_audit_enabled'|| l_audit_enabled);
3087 hr_utility.TRACE ('p_audit_enabled'|| p_audit_enabled);
3088 end if;
3089 IF ( (l_audit_enabled IS NOT NULL AND p_audit_enabled = 'Y')
3090 OR (l_audit_enabled IS NULL AND p_audit_enabled = 'N')
3091 OR p_audit_enabled IS NULL
3092 ) THEN
3093 l_audit_query := TRUE;
3094 END IF;
3095
3096 ---add a blank row only when recurring period matches period selected.
3097
3098 IF emp_qry_tc_info.COUNT > 1 THEN
3099 NULL; ---for mid period employee even if one timecard is found i
3100 /*ADVICE(3109): Use of NULL statements [532] */
3101
3102 ---in that period do not add an addtional blank row.
3103 ELSE
3104 IF NVL (l_rec_periodid, '-999') = NVL (p_rec_periodid, '-999') AND l_audit_query THEN
3105 --now we lock the timecard
3106 IF p_reqryflg = 'N' AND p_lock_profile = 'Y' THEN
3107 --lock only when user does fresh find
3108
3109 l_row_id := NULL;
3110 l_row_lock_id := NULL;
3111 l_tc_lock_success := 'FALSE';
3112 hxc_lock_api.request_lock (
3113 p_process_locker_type => l_process_lock_type,
3114 p_resource_id => resource_info.person_id,
3115 p_start_time => p_start_period,
3116 p_stop_time => p_end_period + g_one_day,
3117 p_time_building_block_id => NULL,
3118 p_time_building_block_ovn => NULL,
3119 p_transaction_lock_id => l_lock_trx_id,
3120 p_messages => l_messages,
3121 p_row_lock_id => l_row_id,
3122 p_locked_success => l_tc_lock_boolean
3123 );
3124 l_row_lock_id := ROWIDTOCHAR (l_row_id);
3125
3126 IF l_tc_lock_boolean THEN
3127 l_tc_lock_success := 'TRUE';
3128 g_lock_table (resource_info.person_id).row_lock_id := l_row_id;
3129 g_lock_table (resource_info.person_id).resource_id := resource_info.person_id;
3130 g_lock_table (resource_info.person_id).timecard_id := NULL;
3131 g_lock_table (resource_info.person_id).start_time := p_start_period;
3132 g_lock_table (resource_info.person_id).stop_time := p_end_period + g_one_day;
3133 ELSE
3134 l_tc_lock_success := 'FALSE';
3135 END IF; --lock
3136 --nitin check
3137 -- l_resource_tc_table (resource_info.person_id).lockid:=l_row_lock_id;
3138 ELSE --lock prof
3139 IF l_row_lock_id IS NOT NULL THEN
3140 l_tc_lock_success := 'TRUE';
3141 ELSE
3142 l_tc_lock_success := 'FALSE';
3143 END IF;
3144 END IF;
3145
3146 if g_debug then
3147 hr_utility.TRACE ('adding entry');
3148 end if;
3149 l_table_counter := l_table_counter + 1;
3150 p_timekeeper_data (l_table_counter).resource_id := resource_info.person_id;
3151 p_timekeeper_data (l_table_counter).timecard_id := fnd_api.g_miss_num;
3152 p_timekeeper_data (l_table_counter).employee_number := resource_info.employee_number;
3153 p_timekeeper_data (l_table_counter).audit_enabled := l_audit_enabled;
3154 p_timekeeper_data (l_table_counter).person_type := resource_info.person_type;
3155 p_timekeeper_data (l_table_counter).employee_full_name := resource_info.full_name;
3156 p_timekeeper_data (l_table_counter).row_lock_id := l_row_lock_id;
3157 p_timekeeper_data (l_table_counter).tc_lock_success := l_tc_lock_success;
3158
3159 IF TO_DATE (tc_start, 'dd-mm-rrrr') < TO_DATE (l_emp_start_date, 'dd-mm-rrrr') THEN
3160 p_timekeeper_data (l_table_counter).timecard_start_period :=
3161 TO_DATE (l_emp_start_date, 'dd-mm-rrrr');
3162 ELSE
3163 p_timekeeper_data (l_table_counter).timecard_start_period := tc_start;
3164 end if;
3165 /* changes done by senthil for emp terminate enhancement*/
3166 IF TO_DATE (tc_end, 'dd-mm-rrrr') > TO_DATE (nvl(l_emp_terminate_date,tc_end), 'dd-mm-rrrr') THEN
3167 p_timekeeper_data (l_table_counter).timecard_end_period := TO_DATE (nvl(l_emp_terminate_date,tc_end), 'dd-mm-rrrr');
3168 ELSE
3169 p_timekeeper_data (l_table_counter).timecard_end_period := tc_end;
3170 END IF;
3171 /* end of changes done by senthil */
3172 IF p_reqryflg = 'N' THEN
3173 p_timekeeper_data (l_table_counter).check_box := 'Y';
3174 g_submit_table (resource_info.person_id).resource_id := resource_info.person_id;
3175 g_submit_table (resource_info.person_id).timecard_id := fnd_api.g_miss_num;
3176 g_submit_table (resource_info.person_id).start_time :=
3177 p_timekeeper_data (l_table_counter).timecard_start_period;
3178 g_submit_table (resource_info.person_id).stop_time :=
3179 p_timekeeper_data (l_table_counter).timecard_end_period;
3180 g_submit_table (resource_info.person_id).row_lock_id := l_row_lock_id;
3181 g_submit_table (resource_info.person_id).no_rows :=
3182 NVL (g_submit_table (resource_info.person_id).no_rows, 0) + 1;
3183 ELSE
3184 p_timekeeper_data (l_table_counter).check_box := 'N';
3185 g_submit_table.DELETE (resource_info.person_id);
3186 END IF;
3187 END IF; ---recurring period match
3188 END IF; ---end if for mid period add blank row
3189 END IF;
3190
3191 CLOSE c_timecard_info;
3192 emp_tab_index := emp_qry_tc_info.NEXT (emp_tab_index);
3193 END LOOP; ----periods list
3194 /*ADVICE(3197): Nested LOOPs should all be labeled [406] */
3195
3196 END IF; --- l_query
3197 END IF; ------added for duplicate employee
3198 EXCEPTION
3199 WHEN l_pref_exception THEN
3200 NULL;
3201 /*ADVICE(3204): Use of NULL statements [532] */
3202
3203 /*ADVICE(3206): Exception masked by a NULL statement [533] */
3204
3205 END;
3206 END LOOP;
3207
3208 IF p_reqryflg = 'N' THEN
3209 g_resource_tc_table.DELETE;
3210 l_index := p_timekeeper_data.FIRST;
3211
3212 LOOP
3213 EXIT WHEN NOT p_timekeeper_data.EXISTS (l_index);
3214
3215 IF g_resource_tc_table.EXISTS (p_timekeeper_data (l_index).resource_id)
3216 AND p_timekeeper_data (l_index).check_box = 'Y' THEN
3217 IF p_timekeeper_data (l_index).check_box = 'N' THEN
3218 g_resource_tc_table (p_timekeeper_data (l_index).resource_id).no_rows := 0;
3219 ELSE
3220 g_resource_tc_table (p_timekeeper_data (l_index).resource_id).no_rows :=
3221 g_resource_tc_table (p_timekeeper_data (l_index).resource_id).no_rows + 1;
3222 END IF;
3223 ELSE
3224 IF p_timekeeper_data (l_index).check_box = 'Y' THEN
3225 g_resource_tc_table (p_timekeeper_data (l_index).resource_id).no_rows := 1;
3226 ELSE
3227 g_resource_tc_table (p_timekeeper_data (l_index).resource_id).no_rows := 0;
3228 END IF;
3229 END IF;
3230
3231 l_index := p_timekeeper_data.NEXT (l_index);
3232 END LOOP;
3233 END IF;
3234 END IF;
3235
3236
3237 -- set in session the timekeeper_data return with query
3238 -- if we are not from the timekeeper_process_call
3239 -- if we are we not need to set the global table
3240
3241 IF g_from_tk_process = FALSE THEN
3242 g_timekeeper_data_query := p_timekeeper_data;
3243 END IF;
3244 END IF;
3245
3246 IF l_terminated_list IS NOT NULL AND p_reqryflg = 'N' THEN
3247 g_terminated_list := substr(l_terminated_list, 1,3000);
3248 ELSE
3249 g_terminated_list := NULL;
3250 END IF;
3251 END;
3252
3253
3254 ---------------------------------------------------------------------------
3255 --Add_remove_submit
3256 ---------------------------------------------------------------------------
3257 PROCEDURE add_remove_submit (
3258 p_resource_id IN NUMBER,
3259 p_start_period IN DATE,
3260 p_end_period IN DATE,
3261 p_timecard_id IN NUMBER,
3262 p_row_lock_id IN ROWID,
3263 p_operation IN VARCHAR2,
3264 p_number_rows IN NUMBER
3265 ) IS
3266 BEGIN
3267 IF p_operation = 'Y' THEN
3268 --Add the record
3269 g_submit_table (p_resource_id).resource_id := p_resource_id;
3270 g_submit_table (p_resource_id).timecard_id := p_timecard_id;
3271 g_submit_table (p_resource_id).start_time := p_start_period;
3272 g_submit_table (p_resource_id).stop_time := p_end_period;
3273 g_submit_table (p_resource_id).row_lock_id := p_row_lock_id;
3274 g_submit_table (p_resource_id).no_rows :=
3275 NVL (g_submit_table (p_resource_id).no_rows, 0) + NVL (
3276 p_number_rows,
3277 0
3278 );
3279
3280 IF g_resource_tc_table.EXISTS (p_resource_id) THEN
3281 g_resource_tc_table (p_resource_id).no_rows :=
3282 NVL (g_resource_tc_table (p_resource_id).no_rows, 0) + 1;
3283 ELSE
3284 g_resource_tc_table (p_resource_id).no_rows := 1;
3285 END IF;
3286 ELSE
3287 --- remove the row
3288 IF g_resource_tc_table.EXISTS (p_resource_id) THEN
3289 g_resource_tc_table (p_resource_id).no_rows :=
3290 NVL (g_resource_tc_table (p_resource_id).no_rows, 0) - 1;
3291 ELSE
3292 g_resource_tc_table (p_resource_id).no_rows := 0;
3293 END IF;
3294
3295 IF g_submit_table.EXISTS (p_resource_id) THEN
3296 g_submit_table (p_resource_id).no_rows :=
3297 NVL (g_submit_table (p_resource_id).no_rows, 0) - NVL (
3298 p_number_rows,
3299 0
3300 );
3301 END IF;
3302
3303 IF NVL (g_resource_tc_table (p_resource_id).no_rows, 0) <= 0 THEN
3304 g_submit_table.DELETE (p_resource_id);
3305 END IF;
3306 END IF;
3307 END;
3308
3309
3310 ---------------------------------------------------------------------------
3311 --Add_remove_submit
3312 ---------------------------------------------------------------------------
3313 PROCEDURE add_remove_lock (
3314 p_resource_id IN NUMBER,
3315 p_start_period IN DATE,
3316 p_end_period IN DATE,
3317 p_timecard_id IN NUMBER,
3318 p_row_lock_id IN ROWID,
3319 p_operation IN VARCHAR2
3320 ) IS
3321 BEGIN
3322 IF p_operation = 'Y' THEN
3323 --Add the record
3324 g_lock_table (p_resource_id).resource_id := p_resource_id;
3325 g_lock_table (p_resource_id).timecard_id := p_timecard_id;
3326 g_lock_table (p_resource_id).start_time := p_start_period;
3327 g_lock_table (p_resource_id).stop_time := p_end_period;
3328 g_lock_table (p_resource_id).row_lock_id := p_row_lock_id;
3329 ELSE
3330 g_lock_table.DELETE (p_resource_id);
3331 END IF;
3332 END;
3333
3334
3335 ----------------------------------------------
3336 FUNCTION check_row_lock (
3337 p_resource_id IN NUMBER
3338 )
3339 RETURN BOOLEAN IS
3340 BEGIN
3341 IF g_lock_table.EXISTS (p_resource_id) THEN
3342 RETURN TRUE;
3343 ELSE
3344 RETURN FALSE;
3345 END IF;
3346 /*ADVICE(3349): Last statement in function must be a RETURN [510] */
3347
3348 END;
3349 /*ADVICE(3352): Function with more than one RETURN statement in the executable section [512] */
3350
3351
3352
3353 ----------------------------------------------
3354 FUNCTION get_row_lock (
3355 p_resource_id IN NUMBER
3356 )
3357 RETURN VARCHAR2 IS
3358 BEGIN
3359 IF g_lock_table.EXISTS (p_resource_id) THEN
3360 RETURN ROWIDTOCHAR (g_lock_table (p_resource_id).row_lock_id);
3361 ELSE
3362 RETURN NULL;
3363 END IF;
3364 /*ADVICE(3367): Last statement in function must be a RETURN [510] */
3365
3366 END;
3367 /*ADVICE(3370): Function with more than one RETURN statement in the executable section [512] */
3368
3369
3370 ----------------------------------------------
3371 FUNCTION not_empty_row
3372 (p_insert_data IN OUT NOCOPY t_time_info)
3373 RETURN BOOLEAN IS
3374
3375 BEGIN
3376 g_debug :=hr_utility.debug_enabled;
3377
3378 if g_debug then
3379 hr_utility.trace('p_insert_data.timecard_end_period '||p_insert_data.timecard_end_period );
3380 hr_utility.trace('p_insert_data.resource_id '||p_insert_data.resource_id );
3381 hr_utility.trace('p_insert_data.employee_number '||p_insert_data.employee_number );
3382 hr_utility.trace('p_insert_data.employee_full_name '||p_insert_data.employee_full_name );
3383 hr_utility.trace('p_insert_data.timecard_id '||p_insert_data.timecard_id );
3384 hr_utility.trace('p_insert_data.timecard_ovn '||p_insert_data.timecard_ovn );
3385 hr_utility.trace('p_insert_data.check_box '||p_insert_data.check_box );
3386 hr_utility.trace('p_insert_data.error_status '||p_insert_data.error_status );
3387 hr_utility.trace('p_insert_data.timecard_status '||p_insert_data.timecard_status );
3388 hr_utility.trace('p_insert_data.timecard_status_code '||p_insert_data.timecard_status_code );
3389 hr_utility.trace('p_insert_data.attr_value_1 '||p_insert_data.attr_value_1 );
3390 hr_utility.trace('p_insert_data.attr_value_2 '||p_insert_data.attr_value_2 );
3391 hr_utility.trace('p_insert_data.attr_value_3 '||p_insert_data.attr_value_3 );
3392 hr_utility.trace('p_insert_data.attr_value_4 '||p_insert_data.attr_value_4 );
3393 hr_utility.trace('p_insert_data.attr_value_5 '||p_insert_data.attr_value_5 );
3394 hr_utility.trace('p_insert_data.attr_value_6 '||p_insert_data.attr_value_6 );
3395 hr_utility.trace('p_insert_data.attr_value_7 '||p_insert_data.attr_value_7 );
3396 hr_utility.trace('p_insert_data.attr_value_8 '||p_insert_data.attr_value_8 );
3397 hr_utility.trace('p_insert_data.attr_value_9 '||p_insert_data.attr_value_9 );
3398 hr_utility.trace('p_insert_data.attr_value_10 '||p_insert_data.attr_value_10 );
3399 hr_utility.trace('p_insert_data.attr_value_11 '||p_insert_data.attr_value_11 );
3400 hr_utility.trace('p_insert_data.attr_value_12 '||p_insert_data.attr_value_12 );
3401 hr_utility.trace('p_insert_data.attr_value_13 '||p_insert_data.attr_value_13 );
3402 hr_utility.trace('p_insert_data.attr_value_14 '||p_insert_data.attr_value_14 );
3403 hr_utility.trace('p_insert_data.attr_value_15 '||p_insert_data.attr_value_15 );
3404 hr_utility.trace('p_insert_data.attr_value_16 '||p_insert_data.attr_value_16 );
3405 hr_utility.trace('p_insert_data.attr_value_17 '||p_insert_data.attr_value_17 );
3406 hr_utility.trace('p_insert_data.attr_value_18 '||p_insert_data.attr_value_18 );
3407 hr_utility.trace('p_insert_data.attr_value_19 '||p_insert_data.attr_value_19 );
3408 hr_utility.trace('p_insert_data.attr_value_20 '||p_insert_data.attr_value_20 );
3409 hr_utility.trace('p_insert_data.attr_id_1 '||p_insert_data.attr_id_1 );
3410 hr_utility.trace('p_insert_data.attr_id_2 '||p_insert_data.attr_id_2 );
3411 hr_utility.trace('p_insert_data.attr_id_3 '||p_insert_data.attr_id_3 );
3412 hr_utility.trace('p_insert_data.attr_id_4 '||p_insert_data.attr_id_4 );
3413 hr_utility.trace('p_insert_data.attr_id_5 '||p_insert_data.attr_id_5 );
3414 hr_utility.trace('p_insert_data.attr_id_6 '||p_insert_data.attr_id_6 );
3415 hr_utility.trace('p_insert_data.attr_id_7 '||p_insert_data.attr_id_7 );
3416 hr_utility.trace('p_insert_data.attr_id_8 '||p_insert_data.attr_id_8 );
3417 hr_utility.trace('p_insert_data.attr_id_9 '||p_insert_data.attr_id_9 );
3418 hr_utility.trace('p_insert_data.attr_id_10 '||p_insert_data.attr_id_10 );
3419 hr_utility.trace('p_insert_data.attr_id_11 '||p_insert_data.attr_id_11 );
3420 hr_utility.trace('p_insert_data.attr_id_12 '||p_insert_data.attr_id_12 );
3421 hr_utility.trace('p_insert_data.attr_id_13 '||p_insert_data.attr_id_13 );
3422 hr_utility.trace('p_insert_data.attr_id_14 '||p_insert_data.attr_id_14 );
3423 hr_utility.trace('p_insert_data.attr_id_15 '||p_insert_data.attr_id_15 );
3424 hr_utility.trace('p_insert_data.attr_id_16 '||p_insert_data.attr_id_16 );
3425 hr_utility.trace('p_insert_data.attr_id_17 '||p_insert_data.attr_id_17 );
3426 hr_utility.trace('p_insert_data.attr_id_18 '||p_insert_data.attr_id_18 );
3427 hr_utility.trace('p_insert_data.attr_id_19 '||p_insert_data.attr_id_19 );
3428 hr_utility.trace('p_insert_data.attr_id_20 '||p_insert_data.attr_id_20 );
3429 hr_utility.trace('p_insert_data.attr_oldid_1 '||p_insert_data.attr_oldid_1 );
3430 hr_utility.trace('p_insert_data.attr_oldid_2 '||p_insert_data.attr_oldid_2 );
3431 hr_utility.trace('p_insert_data.attr_oldid_3 '||p_insert_data.attr_oldid_3 );
3432 hr_utility.trace('p_insert_data.attr_oldid_4 '||p_insert_data.attr_oldid_4 );
3433 hr_utility.trace('p_insert_data.attr_oldid_5 '||p_insert_data.attr_oldid_5 );
3434 hr_utility.trace('p_insert_data.attr_oldid_6 '||p_insert_data.attr_oldid_6 );
3435 hr_utility.trace('p_insert_data.attr_oldid_7 '||p_insert_data.attr_oldid_7 );
3436 hr_utility.trace('p_insert_data.attr_oldid_8 '||p_insert_data.attr_oldid_8 );
3437 hr_utility.trace('p_insert_data.attr_oldid_9 '||p_insert_data.attr_oldid_9 );
3438 hr_utility.trace('p_insert_data.attr_oldid_10 '||p_insert_data.attr_oldid_10 );
3439 hr_utility.trace('p_insert_data.attr_oldid_11 '||p_insert_data.attr_oldid_11 );
3440 hr_utility.trace('p_insert_data.attr_oldid_12 '||p_insert_data.attr_oldid_12 );
3441 hr_utility.trace('p_insert_data.attr_oldid_13 '||p_insert_data.attr_oldid_13 );
3442 hr_utility.trace('p_insert_data.attr_oldid_14 '||p_insert_data.attr_oldid_14 );
3443 hr_utility.trace('p_insert_data.attr_oldid_15 '||p_insert_data.attr_oldid_15 );
3444 hr_utility.trace('p_insert_data.attr_oldid_16 '||p_insert_data.attr_oldid_16 );
3445 hr_utility.trace('p_insert_data.attr_oldid_17 '||p_insert_data.attr_oldid_17 );
3446 hr_utility.trace('p_insert_data.attr_oldid_18 '||p_insert_data.attr_oldid_18 );
3447 hr_utility.trace('p_insert_data.attr_oldid_19 '||p_insert_data.attr_oldid_19 );
3448 hr_utility.trace('p_insert_data.attr_oldid_20 '||p_insert_data.attr_oldid_20 );
3449 hr_utility.trace('p_insert_data.timekeeper_action '||p_insert_data.timekeeper_action );
3450 hr_utility.trace('p_insert_data.detail_id_1 '||p_insert_data.detail_id_1 );
3451 hr_utility.trace('p_insert_data.detail_id_2 '||p_insert_data.detail_id_2 );
3452 hr_utility.trace('p_insert_data.detail_id_3 '||p_insert_data.detail_id_3 );
3453 hr_utility.trace('p_insert_data.detail_id_4 '||p_insert_data.detail_id_4 );
3454 hr_utility.trace('p_insert_data.detail_id_5 '||p_insert_data.detail_id_5 );
3455 hr_utility.trace('p_insert_data.detail_id_6 '||p_insert_data.detail_id_6 );
3456 hr_utility.trace('p_insert_data.detail_id_7 '||p_insert_data.detail_id_7 );
3457 hr_utility.trace('p_insert_data.detail_id_8 '||p_insert_data.detail_id_8 );
3458 hr_utility.trace('p_insert_data.detail_id_9 '||p_insert_data.detail_id_9 );
3459 hr_utility.trace('p_insert_data.detail_id_10 '||p_insert_data.detail_id_10 );
3460 hr_utility.trace('p_insert_data.detail_id_11 '||p_insert_data.detail_id_11 );
3461 hr_utility.trace('p_insert_data.detail_id_12 '||p_insert_data.detail_id_12 );
3462 hr_utility.trace('p_insert_data.detail_id_13 '||p_insert_data.detail_id_13 );
3463 hr_utility.trace('p_insert_data.detail_id_14 '||p_insert_data.detail_id_14 );
3464 hr_utility.trace('p_insert_data.detail_id_15 '||p_insert_data.detail_id_15 );
3465 hr_utility.trace('p_insert_data.detail_id_16 '||p_insert_data.detail_id_16 );
3466 hr_utility.trace('p_insert_data.detail_id_17 '||p_insert_data.detail_id_17 );
3467 hr_utility.trace('p_insert_data.detail_id_18 '||p_insert_data.detail_id_18 );
3468 hr_utility.trace('p_insert_data.detail_id_19 '||p_insert_data.detail_id_19 );
3469 hr_utility.trace('p_insert_data.detail_id_20 '||p_insert_data.detail_id_20 );
3470 hr_utility.trace('p_insert_data.detail_id_21 '||p_insert_data.detail_id_21 );
3471 hr_utility.trace('p_insert_data.detail_id_22 '||p_insert_data.detail_id_22 );
3472 hr_utility.trace('p_insert_data.detail_id_23 '||p_insert_data.detail_id_23 );
3473 hr_utility.trace('p_insert_data.detail_id_24 '||p_insert_data.detail_id_24 );
3474 hr_utility.trace('p_insert_data.detail_id_25 '||p_insert_data.detail_id_25 );
3475 hr_utility.trace('p_insert_data.detail_id_26 '||p_insert_data.detail_id_26 );
3476 hr_utility.trace('p_insert_data.detail_id_27 '||p_insert_data.detail_id_27 );
3477 hr_utility.trace('p_insert_data.detail_id_28 '||p_insert_data.detail_id_28 );
3478 hr_utility.trace('p_insert_data.detail_id_29 '||p_insert_data.detail_id_29 );
3479 hr_utility.trace('p_insert_data.detail_id_30 '||p_insert_data.detail_id_30 );
3480 hr_utility.trace('p_insert_data.detail_id_31 '||p_insert_data.detail_id_31 );
3481 hr_utility.trace('p_insert_data.detail_ovn_1 '||p_insert_data.detail_ovn_1 );
3482 hr_utility.trace('p_insert_data.detail_ovn_2 '||p_insert_data.detail_ovn_2 );
3483 hr_utility.trace('p_insert_data.detail_ovn_3 '||p_insert_data.detail_ovn_3 );
3484 hr_utility.trace('p_insert_data.detail_ovn_4 '||p_insert_data.detail_ovn_4 );
3485 hr_utility.trace('p_insert_data.detail_ovn_5 '||p_insert_data.detail_ovn_5 );
3486 hr_utility.trace('p_insert_data.detail_ovn_6 '||p_insert_data.detail_ovn_6 );
3487 hr_utility.trace('p_insert_data.detail_ovn_7 '||p_insert_data.detail_ovn_7 );
3488 hr_utility.trace('p_insert_data.detail_ovn_8 '||p_insert_data.detail_ovn_8 );
3489 hr_utility.trace('p_insert_data.detail_ovn_9 '||p_insert_data.detail_ovn_9 );
3490 hr_utility.trace('p_insert_data.detail_ovn_10 '||p_insert_data.detail_ovn_10 );
3491 hr_utility.trace('p_insert_data.detail_ovn_11 '||p_insert_data.detail_ovn_11 );
3492 hr_utility.trace('p_insert_data.detail_ovn_12 '||p_insert_data.detail_ovn_12 );
3493 hr_utility.trace('p_insert_data.detail_ovn_13 '||p_insert_data.detail_ovn_13 );
3494 hr_utility.trace('p_insert_data.detail_ovn_14 '||p_insert_data.detail_ovn_14 );
3495 hr_utility.trace('p_insert_data.detail_ovn_15 '||p_insert_data.detail_ovn_15 );
3496 hr_utility.trace('p_insert_data.detail_ovn_16 '||p_insert_data.detail_ovn_16 );
3497 hr_utility.trace('p_insert_data.detail_ovn_17 '||p_insert_data.detail_ovn_17 );
3498 hr_utility.trace('p_insert_data.detail_ovn_18 '||p_insert_data.detail_ovn_18 );
3499 hr_utility.trace('p_insert_data.detail_ovn_19 '||p_insert_data.detail_ovn_19 );
3500 hr_utility.trace('p_insert_data.detail_ovn_20 '||p_insert_data.detail_ovn_20 );
3501 hr_utility.trace('p_insert_data.detail_ovn_21 '||p_insert_data.detail_ovn_21 );
3502 hr_utility.trace('p_insert_data.detail_ovn_22 '||p_insert_data.detail_ovn_22 );
3503 hr_utility.trace('p_insert_data.detail_ovn_23 '||p_insert_data.detail_ovn_23 );
3504 hr_utility.trace('p_insert_data.detail_ovn_24 '||p_insert_data.detail_ovn_24 );
3505 hr_utility.trace('p_insert_data.detail_ovn_25 '||p_insert_data.detail_ovn_25 );
3506 hr_utility.trace('p_insert_data.detail_ovn_26 '||p_insert_data.detail_ovn_26 );
3507 hr_utility.trace('p_insert_data.detail_ovn_27 '||p_insert_data.detail_ovn_27 );
3508 hr_utility.trace('p_insert_data.detail_ovn_28 '||p_insert_data.detail_ovn_28 );
3509 hr_utility.trace('p_insert_data.detail_ovn_29 '||p_insert_data.detail_ovn_29 );
3510 hr_utility.trace('p_insert_data.detail_ovn_30 '||p_insert_data.detail_ovn_30 );
3511 hr_utility.trace('p_insert_data.detail_ovn_31 '||p_insert_data.detail_ovn_31 );
3512 hr_utility.trace('p_insert_data.day_1 '||p_insert_data.day_1 );
3513 hr_utility.trace('p_insert_data.day_2 '||p_insert_data.day_2 );
3514 hr_utility.trace('p_insert_data.day_3 '||p_insert_data.day_3 );
3515 hr_utility.trace('p_insert_data.day_4 '||p_insert_data.day_4 );
3516 hr_utility.trace('p_insert_data.day_5 '||p_insert_data.day_5 );
3517 hr_utility.trace('p_insert_data.day_6 '||p_insert_data.day_6 );
3518 hr_utility.trace('p_insert_data.day_7 '||p_insert_data.day_7 );
3519 hr_utility.trace('p_insert_data.day_8 '||p_insert_data.day_8 );
3520 hr_utility.trace('p_insert_data.day_9 '||p_insert_data.day_9 );
3521 hr_utility.trace('p_insert_data.day_10 '||p_insert_data.day_10 );
3522 hr_utility.trace('p_insert_data.day_11 '||p_insert_data.day_11 );
3523 hr_utility.trace('p_insert_data.day_12 '||p_insert_data.day_12 );
3524 hr_utility.trace('p_insert_data.day_13 '||p_insert_data.day_13 );
3525 hr_utility.trace('p_insert_data.day_14 '||p_insert_data.day_14 );
3526 hr_utility.trace('p_insert_data.day_15 '||p_insert_data.day_15 );
3527 hr_utility.trace('p_insert_data.day_16 '||p_insert_data.day_16 );
3528 hr_utility.trace('p_insert_data.day_17 '||p_insert_data.day_17 );
3529 hr_utility.trace('p_insert_data.day_18 '||p_insert_data.day_18 );
3530 hr_utility.trace('p_insert_data.day_19 '||p_insert_data.day_19 );
3531 hr_utility.trace('p_insert_data.day_20 '||p_insert_data.day_20 );
3532 hr_utility.trace('p_insert_data.day_21 '||p_insert_data.day_21 );
3533 hr_utility.trace('p_insert_data.day_22 '||p_insert_data.day_22 );
3534 hr_utility.trace('p_insert_data.day_23 '||p_insert_data.day_23 );
3535 hr_utility.trace('p_insert_data.day_24 '||p_insert_data.day_24 );
3536 hr_utility.trace('p_insert_data.day_25 '||p_insert_data.day_25 );
3537 hr_utility.trace('p_insert_data.day_26 '||p_insert_data.day_26 );
3538 hr_utility.trace('p_insert_data.day_27 '||p_insert_data.day_27 );
3539 hr_utility.trace('p_insert_data.day_28 '||p_insert_data.day_28 );
3540 hr_utility.trace('p_insert_data.day_29 '||p_insert_data.day_29 );
3541 hr_utility.trace('p_insert_data.day_30 '||p_insert_data.day_30 );
3542 hr_utility.trace('p_insert_data.day_31 '||p_insert_data.day_31 );
3543 hr_utility.trace('p_insert_data.time_in_1 '||p_insert_data.time_in_1 );
3544 hr_utility.trace('p_insert_data.time_out_1 '||p_insert_data.time_out_1 );
3545 hr_utility.trace('p_insert_data.time_in_2 '||p_insert_data.time_in_2 );
3546 hr_utility.trace('p_insert_data.time_out_2 '||p_insert_data.time_out_2 );
3547 hr_utility.trace('p_insert_data.time_in_3 '||p_insert_data.time_in_3 );
3548 hr_utility.trace('p_insert_data.time_out_3 '||p_insert_data.time_out_3 );
3549 hr_utility.trace('p_insert_data.time_in_4 '||p_insert_data.time_in_4 );
3550 hr_utility.trace('p_insert_data.time_out_4 '||p_insert_data.time_out_4 );
3551 hr_utility.trace('p_insert_data.time_in_5 '||p_insert_data.time_in_5 );
3552 hr_utility.trace('p_insert_data.time_out_5 '||p_insert_data.time_out_5 );
3553 hr_utility.trace('p_insert_data.time_in_6 '||p_insert_data.time_in_6 );
3554 hr_utility.trace('p_insert_data.time_out_6 '||p_insert_data.time_out_6 );
3555 hr_utility.trace('p_insert_data.time_in_7 '||p_insert_data.time_in_7 );
3556 hr_utility.trace('p_insert_data.time_out_7 '||p_insert_data.time_out_7 );
3557 hr_utility.trace('p_insert_data.time_in_8 '||p_insert_data.time_in_8 );
3558 hr_utility.trace('p_insert_data.time_out_8 '||p_insert_data.time_out_8 );
3559 hr_utility.trace('p_insert_data.time_in_9 '||p_insert_data.time_in_9 );
3560 hr_utility.trace('p_insert_data.time_out_9 '||p_insert_data.time_out_9 );
3561 hr_utility.trace('p_insert_data.time_in_10 '||p_insert_data.time_in_10 );
3562 hr_utility.trace('p_insert_data.time_out_10 '||p_insert_data.time_out_10 );
3563 hr_utility.trace('p_insert_data.time_in_11 '||p_insert_data.time_in_11 );
3564 hr_utility.trace('p_insert_data.time_out_11 '||p_insert_data.time_out_11 );
3565 hr_utility.trace('p_insert_data.time_in_12 '||p_insert_data.time_in_12 );
3566 hr_utility.trace('p_insert_data.time_out_12 '||p_insert_data.time_out_12 );
3567 hr_utility.trace('p_insert_data.time_in_13 '||p_insert_data.time_in_13 );
3568 hr_utility.trace('p_insert_data.time_out_13 '||p_insert_data.time_out_13 );
3569 hr_utility.trace('p_insert_data.time_in_14 '||p_insert_data.time_in_14 );
3570 hr_utility.trace('p_insert_data.time_out_14 '||p_insert_data.time_out_14 );
3571 hr_utility.trace('p_insert_data.time_in_15 '||p_insert_data.time_in_15 );
3572 hr_utility.trace('p_insert_data.time_out_15 '||p_insert_data.time_out_15 );
3573 hr_utility.trace('p_insert_data.time_in_16 '||p_insert_data.time_in_16 );
3574 hr_utility.trace('p_insert_data.time_out_16 '||p_insert_data.time_out_16 );
3575 hr_utility.trace('p_insert_data.time_in_17 '||p_insert_data.time_in_17 );
3576 hr_utility.trace('p_insert_data.time_out_17 '||p_insert_data.time_out_17 );
3577 hr_utility.trace('p_insert_data.time_in_18 '||p_insert_data.time_in_18 );
3578 hr_utility.trace('p_insert_data.time_out_18 '||p_insert_data.time_out_18 );
3579 hr_utility.trace('p_insert_data.time_in_19 '||p_insert_data.time_in_19 );
3580 hr_utility.trace('p_insert_data.time_out_19 '||p_insert_data.time_out_19 );
3581 hr_utility.trace('p_insert_data.time_in_20 '||p_insert_data.time_in_20 );
3582 hr_utility.trace('p_insert_data.time_out_20 '||p_insert_data.time_out_20 );
3583 hr_utility.trace('p_insert_data.time_in_21 '||p_insert_data.time_in_21 );
3584 hr_utility.trace('p_insert_data.time_out_21 '||p_insert_data.time_out_21 );
3585 hr_utility.trace('p_insert_data.time_in_22 '||p_insert_data.time_in_22 );
3586 hr_utility.trace('p_insert_data.time_out_22 '||p_insert_data.time_out_22 );
3587 hr_utility.trace('p_insert_data.time_in_23 '||p_insert_data.time_in_23 );
3588 hr_utility.trace('p_insert_data.time_out_23 '||p_insert_data.time_out_23 );
3589 hr_utility.trace('p_insert_data.time_in_24 '||p_insert_data.time_in_24 );
3590 hr_utility.trace('p_insert_data.time_out_24 '||p_insert_data.time_out_24 );
3591 hr_utility.trace('p_insert_data.time_in_25 '||p_insert_data.time_in_25 );
3592 hr_utility.trace('p_insert_data.time_out_25 '||p_insert_data.time_out_25 );
3593 hr_utility.trace('p_insert_data.time_in_26 '||p_insert_data.time_in_26 );
3594 hr_utility.trace('p_insert_data.time_out_26 '||p_insert_data.time_out_26 );
3595 hr_utility.trace('p_insert_data.time_in_27 '||p_insert_data.time_in_27 );
3596 hr_utility.trace('p_insert_data.time_out_27 '||p_insert_data.time_out_27 );
3597 hr_utility.trace('p_insert_data.time_in_28 '||p_insert_data.time_in_28 );
3598 hr_utility.trace('p_insert_data.time_out_28 '||p_insert_data.time_out_28 );
3599 hr_utility.trace('p_insert_data.time_in_29 '||p_insert_data.time_in_29 );
3600 hr_utility.trace('p_insert_data.time_out_29 '||p_insert_data.time_out_29 );
3601 hr_utility.trace('p_insert_data.time_in_30 '||p_insert_data.time_in_30 );
3602 hr_utility.trace('p_insert_data.time_out_30 '||p_insert_data.time_out_30 );
3603 hr_utility.trace('p_insert_data.time_in_31 '||p_insert_data.time_in_31 );
3604 hr_utility.trace('p_insert_data.time_out_31 '||p_insert_data.time_out_31 );
3605 hr_utility.trace('p_insert_data.comment_text '||p_insert_data.comment_text );
3606 hr_utility.trace('p_insert_data.last_update_date '||p_insert_data.last_update_date );
3607 hr_utility.trace('p_insert_data.last_updated_by '||p_insert_data.last_updated_by );
3608 hr_utility.trace('p_insert_data.last_update_login '||p_insert_data.last_update_login );
3609 hr_utility.trace('p_insert_data.created_by '||p_insert_data.created_by );
3610 hr_utility.trace('p_insert_data.creation_date '||p_insert_data.creation_date );
3611 hr_utility.trace('p_insert_data.row_lock_id '||p_insert_data.row_lock_id );
3612 hr_utility.trace('p_insert_data.tc_lock_success '||p_insert_data.tc_lock_success );
3613 hr_utility.trace('p_insert_data.person_type '||p_insert_data.person_type );
3614 hr_utility.trace('p_insert_data.timecard_message '||p_insert_data.timecard_message );
3615 hr_utility.trace('p_insert_data.timecard_message_code '||p_insert_data.timecard_message_code );
3616 hr_utility.trace('p_insert_data.audit_enabled '||p_insert_data.audit_enabled );
3617 end if;
3618
3619
3620 IF p_insert_data.timecard_start_period is not null OR
3621 p_insert_data.timecard_end_period is not null OR
3622 -- p_insert_data.resource_id IS NOT NULL OR
3623 -- p_insert_data.employee_number IS NOT NULL OR
3624 -- p_insert_data.employee_full_name IS NOT NULL OR
3625 p_insert_data.timecard_id IS NOT NULL OR
3626 p_insert_data.timecard_ovn IS NOT NULL OR
3627 --p_insert_data.check_box IS NOT NULL OR
3628 p_insert_data.error_status IS NOT NULL OR
3629 p_insert_data.timecard_status IS NOT NULL OR
3630 p_insert_data.timecard_status_code IS NOT NULL OR
3631 p_insert_data.attr_value_1 IS NOT NULL OR
3632 p_insert_data.attr_value_2 IS NOT NULL OR
3633 p_insert_data.attr_value_3 IS NOT NULL OR
3634 p_insert_data.attr_value_4 IS NOT NULL OR
3635 p_insert_data.attr_value_5 IS NOT NULL OR
3636 p_insert_data.attr_value_6 IS NOT NULL OR
3637 p_insert_data.attr_value_7 IS NOT NULL OR
3638 p_insert_data.attr_value_8 IS NOT NULL OR
3639 p_insert_data.attr_value_9 IS NOT NULL OR
3640 p_insert_data.attr_value_10 IS NOT NULL OR
3641 p_insert_data.attr_value_11 IS NOT NULL OR
3642 p_insert_data.attr_value_12 IS NOT NULL OR
3643 p_insert_data.attr_value_13 IS NOT NULL OR
3644 p_insert_data.attr_value_14 IS NOT NULL OR
3645 p_insert_data.attr_value_15 IS NOT NULL OR
3646 p_insert_data.attr_value_16 IS NOT NULL OR
3647 p_insert_data.attr_value_17 IS NOT NULL OR
3648 p_insert_data.attr_value_18 IS NOT NULL OR
3649 p_insert_data.attr_value_19 IS NOT NULL OR
3650 p_insert_data.attr_value_20 IS NOT NULL OR
3651 p_insert_data.attr_id_1 IS NOT NULL OR
3652 p_insert_data.attr_id_2 IS NOT NULL OR
3653 p_insert_data.attr_id_3 IS NOT NULL OR
3654 p_insert_data.attr_id_4 IS NOT NULL OR
3655 p_insert_data.attr_id_5 IS NOT NULL OR
3656 p_insert_data.attr_id_6 IS NOT NULL OR
3657 p_insert_data.attr_id_7 IS NOT NULL OR
3658 p_insert_data.attr_id_8 IS NOT NULL OR
3659 p_insert_data.attr_id_9 IS NOT NULL OR
3660 p_insert_data.attr_id_10 IS NOT NULL OR
3661 p_insert_data.attr_id_11 IS NOT NULL OR
3662 p_insert_data.attr_id_12 IS NOT NULL OR
3663 p_insert_data.attr_id_13 IS NOT NULL OR
3664 p_insert_data.attr_id_14 IS NOT NULL OR
3665 p_insert_data.attr_id_15 IS NOT NULL OR
3666 p_insert_data.attr_id_16 IS NOT NULL OR
3667 p_insert_data.attr_id_17 IS NOT NULL OR
3668 p_insert_data.attr_id_18 IS NOT NULL OR
3669 p_insert_data.attr_id_19 IS NOT NULL OR
3670 p_insert_data.attr_id_20 IS NOT NULL OR
3671 p_insert_data.attr_oldid_1 IS NOT NULL OR
3672 p_insert_data.attr_oldid_2 IS NOT NULL OR
3673 p_insert_data.attr_oldid_3 IS NOT NULL OR
3674 p_insert_data.attr_oldid_4 IS NOT NULL OR
3675 p_insert_data.attr_oldid_5 IS NOT NULL OR
3676 p_insert_data.attr_oldid_6 IS NOT NULL OR
3677 p_insert_data.attr_oldid_7 IS NOT NULL OR
3678 p_insert_data.attr_oldid_8 IS NOT NULL OR
3679 p_insert_data.attr_oldid_9 IS NOT NULL OR
3680 p_insert_data.attr_oldid_10 IS NOT NULL OR
3681 p_insert_data.attr_oldid_11 IS NOT NULL OR
3682 p_insert_data.attr_oldid_12 IS NOT NULL OR
3683 p_insert_data.attr_oldid_13 IS NOT NULL OR
3684 p_insert_data.attr_oldid_14 IS NOT NULL OR
3685 p_insert_data.attr_oldid_15 IS NOT NULL OR
3686 p_insert_data.attr_oldid_16 IS NOT NULL OR
3687 p_insert_data.attr_oldid_17 IS NOT NULL OR
3688 p_insert_data.attr_oldid_18 IS NOT NULL OR
3689 p_insert_data.attr_oldid_19 IS NOT NULL OR
3690 p_insert_data.attr_oldid_20 IS NOT NULL OR
3691 p_insert_data.timekeeper_action IS NOT NULL OR
3692 p_insert_data.detail_id_1 IS NOT NULL OR
3693 p_insert_data.detail_id_2 IS NOT NULL OR
3694 p_insert_data.detail_id_3 IS NOT NULL OR
3695 p_insert_data.detail_id_4 IS NOT NULL OR
3696 p_insert_data.detail_id_5 IS NOT NULL OR
3697 p_insert_data.detail_id_6 IS NOT NULL OR
3698 p_insert_data.detail_id_7 IS NOT NULL OR
3699 p_insert_data.detail_id_8 IS NOT NULL OR
3700 p_insert_data.detail_id_9 IS NOT NULL OR
3701 p_insert_data.detail_id_10 IS NOT NULL OR
3702 p_insert_data.detail_id_11 IS NOT NULL OR
3703 p_insert_data.detail_id_12 IS NOT NULL OR
3704 p_insert_data.detail_id_13 IS NOT NULL OR
3705 p_insert_data.detail_id_14 IS NOT NULL OR
3706 p_insert_data.detail_id_15 IS NOT NULL OR
3707 p_insert_data.detail_id_16 IS NOT NULL OR
3708 p_insert_data.detail_id_17 IS NOT NULL OR
3709 p_insert_data.detail_id_18 IS NOT NULL OR
3710 p_insert_data.detail_id_19 IS NOT NULL OR
3711 p_insert_data.detail_id_20 IS NOT NULL OR
3712 p_insert_data.detail_id_21 IS NOT NULL OR
3713 p_insert_data.detail_id_22 IS NOT NULL OR
3714 p_insert_data.detail_id_23 IS NOT NULL OR
3715 p_insert_data.detail_id_24 IS NOT NULL OR
3716 p_insert_data.detail_id_25 IS NOT NULL OR
3717 p_insert_data.detail_id_26 IS NOT NULL OR
3718 p_insert_data.detail_id_27 IS NOT NULL OR
3719 p_insert_data.detail_id_28 IS NOT NULL OR
3720 p_insert_data.detail_id_29 IS NOT NULL OR
3721 p_insert_data.detail_id_30 IS NOT NULL OR
3722 p_insert_data.detail_id_31 IS NOT NULL OR
3723 p_insert_data.detail_ovn_1 IS NOT NULL OR
3724 p_insert_data.detail_ovn_2 IS NOT NULL OR
3725 p_insert_data.detail_ovn_3 IS NOT NULL OR
3726 p_insert_data.detail_ovn_4 IS NOT NULL OR
3727 p_insert_data.detail_ovn_5 IS NOT NULL OR
3728 p_insert_data.detail_ovn_6 IS NOT NULL OR
3729 p_insert_data.detail_ovn_7 IS NOT NULL OR
3730 p_insert_data.detail_ovn_8 IS NOT NULL OR
3731 p_insert_data.detail_ovn_9 IS NOT NULL OR
3732 p_insert_data.detail_ovn_10 IS NOT NULL OR
3733 p_insert_data.detail_ovn_11 IS NOT NULL OR
3734 p_insert_data.detail_ovn_12 IS NOT NULL OR
3735 p_insert_data.detail_ovn_13 IS NOT NULL OR
3736 p_insert_data.detail_ovn_14 IS NOT NULL OR
3737 p_insert_data.detail_ovn_15 IS NOT NULL OR
3738 p_insert_data.detail_ovn_16 IS NOT NULL OR
3739 p_insert_data.detail_ovn_17 IS NOT NULL OR
3740 p_insert_data.detail_ovn_18 IS NOT NULL OR
3741 p_insert_data.detail_ovn_19 IS NOT NULL OR
3742 p_insert_data.detail_ovn_20 IS NOT NULL OR
3743 p_insert_data.detail_ovn_21 IS NOT NULL OR
3744 p_insert_data.detail_ovn_22 IS NOT NULL OR
3745 p_insert_data.detail_ovn_23 IS NOT NULL OR
3746 p_insert_data.detail_ovn_24 IS NOT NULL OR
3747 p_insert_data.detail_ovn_25 IS NOT NULL OR
3748 p_insert_data.detail_ovn_26 IS NOT NULL OR
3749 p_insert_data.detail_ovn_27 IS NOT NULL OR
3750 p_insert_data.detail_ovn_28 IS NOT NULL OR
3751 p_insert_data.detail_ovn_29 IS NOT NULL OR
3752 p_insert_data.detail_ovn_30 IS NOT NULL OR
3753 p_insert_data.detail_ovn_31 IS NOT NULL OR
3754 p_insert_data.day_1 IS NOT NULL OR
3755 p_insert_data.day_2 IS NOT NULL OR
3756 p_insert_data.day_3 IS NOT NULL OR
3757 p_insert_data.day_4 IS NOT NULL OR
3758 p_insert_data.day_5 IS NOT NULL OR
3759 p_insert_data.day_6 IS NOT NULL OR
3760 p_insert_data.day_7 IS NOT NULL OR
3761 p_insert_data.day_8 IS NOT NULL OR
3762 p_insert_data.day_9 IS NOT NULL OR
3763 p_insert_data.day_10 IS NOT NULL OR
3764 p_insert_data.day_11 IS NOT NULL OR
3765 p_insert_data.day_12 IS NOT NULL OR
3766 p_insert_data.day_13 IS NOT NULL OR
3767 p_insert_data.day_14 IS NOT NULL OR
3768 p_insert_data.day_15 IS NOT NULL OR
3769 p_insert_data.day_16 IS NOT NULL OR
3770 p_insert_data.day_17 IS NOT NULL OR
3771 p_insert_data.day_18 IS NOT NULL OR
3772 p_insert_data.day_19 IS NOT NULL OR
3773 p_insert_data.day_20 IS NOT NULL OR
3774 p_insert_data.day_21 IS NOT NULL OR
3775 p_insert_data.day_22 IS NOT NULL OR
3776 p_insert_data.day_23 IS NOT NULL OR
3777 p_insert_data.day_24 IS NOT NULL OR
3778 p_insert_data.day_25 IS NOT NULL OR
3779 p_insert_data.day_26 IS NOT NULL OR
3780 p_insert_data.day_27 IS NOT NULL OR
3781 p_insert_data.day_28 IS NOT NULL OR
3782 p_insert_data.day_29 IS NOT NULL OR
3783 p_insert_data.day_30 IS NOT NULL OR
3784 p_insert_data.day_31 IS NOT NULL OR
3785 p_insert_data.time_in_1 IS NOT NULL OR
3786 p_insert_data.time_out_1 IS NOT NULL OR
3787 p_insert_data.time_in_2 IS NOT NULL OR
3788 p_insert_data.time_out_2 IS NOT NULL OR
3789 p_insert_data.time_in_3 IS NOT NULL OR
3790 p_insert_data.time_out_3 IS NOT NULL OR
3791 p_insert_data.time_in_4 IS NOT NULL OR
3792 p_insert_data.time_out_4 IS NOT NULL OR
3793 p_insert_data.time_in_5 IS NOT NULL OR
3794 p_insert_data.time_out_5 IS NOT NULL OR
3795 p_insert_data.time_in_6 IS NOT NULL OR
3796 p_insert_data.time_out_6 IS NOT NULL OR
3797 p_insert_data.time_in_7 IS NOT NULL OR
3798 p_insert_data.time_out_7 IS NOT NULL OR
3799 p_insert_data.time_in_8 IS NOT NULL OR
3800 p_insert_data.time_out_8 IS NOT NULL OR
3801 p_insert_data.time_in_9 IS NOT NULL OR
3802 p_insert_data.time_out_9 IS NOT NULL OR
3803 p_insert_data.time_in_10 IS NOT NULL OR
3804 p_insert_data.time_out_10 IS NOT NULL OR
3805 p_insert_data.time_in_11 IS NOT NULL OR
3806 p_insert_data.time_out_11 IS NOT NULL OR
3807 p_insert_data.time_in_12 IS NOT NULL OR
3808 p_insert_data.time_out_12 IS NOT NULL OR
3809 p_insert_data.time_in_13 IS NOT NULL OR
3810 p_insert_data.time_out_13 IS NOT NULL OR
3811 p_insert_data.time_in_14 IS NOT NULL OR
3812 p_insert_data.time_out_14 IS NOT NULL OR
3813 p_insert_data.time_in_15 IS NOT NULL OR
3814 p_insert_data.time_out_15 IS NOT NULL OR
3815 p_insert_data.time_in_16 IS NOT NULL OR
3816 p_insert_data.time_out_16 IS NOT NULL OR
3817 p_insert_data.time_in_17 IS NOT NULL OR
3818 p_insert_data.time_out_17 IS NOT NULL OR
3819 p_insert_data.time_in_18 IS NOT NULL OR
3820 p_insert_data.time_out_18 IS NOT NULL OR
3821 p_insert_data.time_in_19 IS NOT NULL OR
3822 p_insert_data.time_out_19 IS NOT NULL OR
3823 p_insert_data.time_in_20 IS NOT NULL OR
3824 p_insert_data.time_out_20 IS NOT NULL OR
3825 p_insert_data.time_in_21 IS NOT NULL OR
3826 p_insert_data.time_out_21 IS NOT NULL OR
3827 p_insert_data.time_in_22 IS NOT NULL OR
3828 p_insert_data.time_out_22 IS NOT NULL OR
3829 p_insert_data.time_in_23 IS NOT NULL OR
3830 p_insert_data.time_out_23 IS NOT NULL OR
3831 p_insert_data.time_in_24 IS NOT NULL OR
3832 p_insert_data.time_out_24 IS NOT NULL OR
3833 p_insert_data.time_in_25 IS NOT NULL OR
3834 p_insert_data.time_out_25 IS NOT NULL OR
3835 p_insert_data.time_in_26 IS NOT NULL OR
3836 p_insert_data.time_out_26 IS NOT NULL OR
3837 p_insert_data.time_in_27 IS NOT NULL OR
3838 p_insert_data.time_out_27 IS NOT NULL OR
3839 p_insert_data.time_in_28 IS NOT NULL OR
3840 p_insert_data.time_out_28 IS NOT NULL OR
3841 p_insert_data.time_in_29 IS NOT NULL OR
3842 p_insert_data.time_out_29 IS NOT NULL OR
3843 p_insert_data.time_in_30 IS NOT NULL OR
3844 p_insert_data.time_out_30 IS NOT NULL OR
3845 p_insert_data.time_in_31 IS NOT NULL OR
3846 p_insert_data.time_out_31 IS NOT NULL OR
3847 p_insert_data.comment_text IS NOT NULL OR
3848 p_insert_data.last_update_date IS NOT NULL OR
3849 p_insert_data.last_updated_by IS NOT NULL OR
3850 p_insert_data.last_update_login IS NOT NULL OR
3851 p_insert_data.created_by IS NOT NULL OR
3852 p_insert_data.creation_date IS NOT NULL OR
3853 --p_insert_data.row_lock_id IS NOT NULL OR
3854 p_insert_data.tc_lock_success IS NOT NULL OR
3855 -- p_insert_data.person_type IS NOT NULL OR
3856 p_insert_data.timecard_message IS NOT NULL OR
3857 p_insert_data.timecard_message_code IS NOT NULL
3858 --p_insert_data.audit_enabled IS NOT NULL
3859 THEN
3860 if g_debug then
3861 hr_utility.trace(' found data');
3862 end if;
3863
3864
3865 RETURN TRUE;
3866
3867 ELSE
3868 if g_debug then
3869 hr_utility.trace(' empty row');
3870 end if;
3871
3872 RETURN FALSE;
3873
3874 END IF;
3875
3876 END not_empty_row;
3877
3878
3879 ----------------------------------------------------------------------------
3880 -- timekeeper_insert
3881 ----------------------------------------------------------------------------
3882 PROCEDURE timekeeper_insert (
3883 p_insert_data IN OUT NOCOPY t_timekeeper_table
3884 ) IS
3885
3886 l_index NUMBER;
3887
3888 BEGIN
3889
3890 l_index := p_insert_data.FIRST;
3891
3892 LOOP
3893 EXIT WHEN (NOT p_insert_data.EXISTS (l_index));
3894 IF not_empty_row(p_insert_data(l_index))
3895 THEN
3896 populate_global_table (p_table_data => p_insert_data(l_index), p_action => 'INSERT');
3897 END IF;
3898 l_index := p_insert_data.NEXT (l_index);
3899 END LOOP;
3900
3901 END timekeeper_insert;
3902
3903
3904 -------------------------------------------------------------------------------
3905 -- timekeeper_update
3906 -------------------------------------------------------------------------------
3907
3908
3909
3910 PROCEDURE timekeeper_update (
3911 p_update_data IN OUT NOCOPY t_timekeeper_table
3912 ) IS
3913
3914 l_index NUMBER;
3915
3916 BEGIN
3917
3918 l_index := p_update_data.FIRST;
3919
3920 LOOP
3921 EXIT WHEN (NOT p_update_data.EXISTS (l_index));
3922 IF not_empty_row(p_update_data(l_index))
3923 THEN
3924 populate_global_table (p_table_data => p_update_data(l_index), p_action => 'UPDATE');
3925 END IF;
3926 l_index := p_update_data.NEXT (l_index);
3927 END LOOP;
3928
3929 END timekeeper_update;
3930
3931
3932 -------------------------------------------------------------------------------
3933 -- timekeeper_delete
3934 -------------------------------------------------------------------------------
3935
3936 PROCEDURE timekeeper_delete (
3937 p_delete_data IN OUT NOCOPY t_timekeeper_table
3938 ) IS
3939
3940 l_index NUMBER;
3941
3942 BEGIN
3943
3944 l_index := p_delete_data.FIRST;
3945
3946 LOOP
3947 EXIT WHEN (NOT p_delete_data.EXISTS (l_index));
3948 IF not_empty_row(p_delete_data(l_index))
3949 THEN
3950 populate_global_table (p_table_data => p_delete_data(l_index), p_action => 'DELETE');
3951 END IF;
3952 l_index := p_delete_data.NEXT (l_index);
3953 END LOOP;
3954
3955 END timekeeper_delete;
3956
3957
3958 -------------------------------------------------------------------------------
3959 --
3960 -------------------------------------------------------------------------------
3961
3962 PROCEDURE timekeeper_lock (
3963 p_lock_data
3964 /*ADVICE(3415): Unreferenced parameter [552] */
3965 IN t_timekeeper_table
3966 ) IS
3967 BEGIN
3968 NULL;
3969 /*ADVICE(3420): Use of NULL statements [532] */
3970
3971 END;
3972
3973
3974 -------------------------------------------------------------------------------
3975 -- populate_global_table
3976 -------------------------------------------------------------------------------
3977
3978 PROCEDURE populate_global_table (
3979 p_table_data IN t_time_info,
3980 p_action IN VARCHAR2
3981 ) IS
3982 l_global_index NUMBER
3983 /*ADVICE(3434): NUMBER has no precision [315] */
3984 := 0;
3985 l_index NUMBER
3986 /*ADVICE(3437): NUMBER has no precision [315] */
3987 ;
3988 BEGIN
3989 l_global_index := g_timekeeper_data.LAST + 1;
3990
3991 IF l_global_index IS NULL THEN
3992 l_global_index := 0;
3993 END IF;
3994
3995 --l_index := p_table_data.FIRST;
3996
3997 --LOOP
3998 --EXIT WHEN (NOT p_table_data.EXISTS (l_index));
3999 g_timekeeper_data (l_global_index) := p_table_data; --(l_index);
4000 g_timekeeper_data (l_global_index).timekeeper_action := p_action;
4001 -- l_global_index := l_global_index + 1;
4002 --l_index := p_table_data.NEXT (l_index);
4003 -- END LOOP;
4004 END populate_global_table;
4005
4006
4007 -------------------------------------------------------------------------------
4008 -- populate_detail_global_table
4009 -------------------------------------------------------------------------------
4010
4011 PROCEDURE populate_detail_global_table (
4012 p_detail_data IN det_info,
4013 p_detail_action
4014 /*ADVICE(3465): Unreferenced parameter [552] */
4015 IN VARCHAR2
4016 ) IS
4017 l_detail_global_index
4018 /*ADVICE(3469): Unreferenced variable [553] */
4019 NUMBER
4020 /*ADVICE(3471): NUMBER has no precision [315] */
4021 := 0;
4022 l_detail_index
4023 /*ADVICE(3474): Unreferenced variable [553] */
4024 NUMBER
4025 /*ADVICE(3476): NUMBER has no precision [315] */
4026 ;
4027 BEGIN
4028 g_detail_data.DELETE;
4029 g_detail_data := p_detail_data;
4030 END populate_detail_global_table;
4031 -------------------------------------------------------------------------------
4032 --- deletes the g_timekeeper_date table when Audit Information is mandatory
4033 --- and CLA information is not entered.
4034
4035 PROCEDURE timekeeper_data_delete IS
4036 BEGIN
4037 g_timekeeper_data.delete;
4038 END;
4039 ------------------------------------------------------------------------------
4040 --PROCEDURE get det details
4041 ------------------------------------------------------------------------------
4042 FUNCTION get_det_details
4043 RETURN det_info
4044 /*ADVICE(3489): Function has no parameters [514] */
4045 IS
4046 BEGIN
4047 RETURN (g_detail_data);
4048 END;
4049
4050 ------------------------------------------------------------------------------
4051 --PROCEDURE get terminated list
4052 ------------------------------------------------------------------------------
4053 FUNCTION get_terminated_list
4054 RETURN VARCHAR2
4055 /*ADVICE(3500): Function has no parameters [514] */
4056 IS
4057 BEGIN
4058 RETURN (g_terminated_list);
4059 END;
4060
4061
4062 ------------------------------------------------------------------------------
4063 -------------------------------------------------------------------------------
4064 -- timekeeper_process
4065 -------------------------------------------------------------------------------
4066 PROCEDURE timekeeper_process (
4067 p_timekeeper_id IN NUMBER,
4068 p_superflag IN VARCHAR2,
4069 p_rec_periodid IN NUMBER,
4070 p_start_period IN DATE,
4071 p_end_period IN DATE,
4072 p_mode
4073 /*ADVICE(3519): Unreferenced parameter [552] */
4074 IN VARCHAR2,
4075 p_messages OUT NOCOPY hxc_self_service_time_deposit.message_table,
4076 p_trx_lock_id IN NUMBER,
4077 p_lock_profile IN VARCHAR2,
4078 p_tk_audit_enabled IN VARCHAR2,
4079 p_tk_notify_to IN VARCHAR2,
4080 p_tk_notify_type IN VARCHAR2
4081 ) IS
4082 CURSOR c_timecard_info
4083 /*ADVICE(3529): Unreferenced local procedure or function [557] */
4084 (
4085 p_resource_id IN NUMBER,
4086 p_start_period
4087 /*ADVICE(3533): This definition hides another one [556] */
4088 IN DATE,
4089 p_end_period
4090 /*ADVICE(3536): This definition hides another one [556] */
4091 IN DATE
4092 ) IS
4093 SELECT time_building_block_id, object_version_number, comment_text
4094 FROM hxc_time_building_blocks
4095 WHERE SCOPE = 'TIMECARD'
4096 AND date_to = hr_general.end_of_time
4097 AND resource_id = p_resource_id
4098 AND start_time = p_start_period
4099 AND stop_time = p_end_period;
4100
4101 CURSOR c_detail_check
4102 /*ADVICE(3548): Unreferenced local procedure or function [557] */
4103 (
4104 p_timecard_id IN NUMBER,
4105 p_timecard_ovn IN NUMBER,
4106 p_resource_id IN NUMBER
4107 ) IS
4108 SELECT '1'
4109 FROM hxc_time_building_blocks detail, hxc_time_building_blocks DAY
4110 WHERE DAY.SCOPE = 'DAY'
4111 AND DAY.resource_id = p_resource_id
4112 AND DAY.parent_building_block_id = p_timecard_id
4113 AND DAY.parent_building_block_ovn = p_timecard_ovn
4114 AND DAY.time_building_block_id = detail.parent_building_block_id
4115 AND DAY.object_version_number = detail.parent_building_block_ovn
4116 AND detail.SCOPE = 'DETAIL'
4117 AND detail.resource_id = p_resource_id;
4118
4119 /*Cursor Modified By Mithun for CWK Terminate Bug*/
4120 /* changes done by senthil for emp terminate enhancement*/
4121 CURSOR c_emp_terminateinfo(
4122 p_resource_id NUMBER
4123 ) IS
4124 SELECT final_process_date, date_start
4125 FROM per_periods_of_service
4126 WHERE person_id = p_resource_id
4127 union all
4128 select (final_process_date + NVL(fnd_profile.value('HXC_CWK_TK_FPD'),0)) final_process_date, date_start
4129 from per_periods_of_placement
4130 where person_id = p_resource_id
4131 ORDER BY date_start DESC;
4132
4133 --Added By Mithun for CWK Terminate Bug
4134 date_start DATE;
4135
4136 CURSOR c_tc_in_term_period_exists(
4137 p_resource_id number, p_start_date date, p_end_date date) IS
4138 SELECT 'Y'
4139 from hxc_time_building_blocks
4140 where resource_id=p_resource_id
4141 and scope='TIMECARD'
4142 and trunc(start_time)=trunc(p_start_date)
4143 and trunc(stop_time)=trunc(p_end_date)
4144 and (trunc(date_to) = hr_general.end_of_time or APPROVAL_STATUS='ERROR');
4145 /*end of senthil changes */
4146 l_tk_table_index NUMBER
4147 /*ADVICE(3566): NUMBER has no precision [315] */
4148 ;
4149 l_index_next NUMBER
4150 /*ADVICE(3569): NUMBER has no precision [315] */
4151 ;
4152 l_index_start NUMBER
4153 /*ADVICE(3572): NUMBER has no precision [315] */
4154 ;
4155 l_result VARCHAR2 (10);
4156 l_timecard_id NUMBER
4157 /*ADVICE(3576): NUMBER has no precision [315] */
4158 := NULL;
4159 /*ADVICE(3578): Initialization to NULL is superfluous [417] */
4160
4161 l_timecard_ovn NUMBER
4162 /*ADVICE(3581): NUMBER has no precision [315] */
4163 := NULL;
4164 /*ADVICE(3583): Initialization to NULL is superfluous [417] */
4165
4166 l_timecard_comment_text VARCHAR2 (2000) := NULL;
4167 /*ADVICE(3586): VARCHAR2 declaration with length greater than 500 characters [307] */
4168
4169 /*ADVICE(3588): Initialization to NULL is superfluous [417] */
4170
4171 l_resource_tc_table t_resource_tc_table;
4172 l_resource_id NUMBER
4173 /*ADVICE(3592): NUMBER has no precision [315] */
4174 ;
4175 l_string VARCHAR2 (32000);
4176 l_timecard hxc_block_table_type := hxc_block_table_type ();
4177 ord_timecard
4178 /*ADVICE(3597): Unreferenced variable [553] */
4179 hxc_block_table_type := hxc_block_table_type ();
4180 l_attributes hxc_attribute_table_type := hxc_attribute_table_type (
4181
4182 );
4183 l_messages hxc_message_table_type := hxc_message_table_type ();
4184 l_day_id_info_table t_day_id_info_table;
4185 l_timecard_index NUMBER
4186 /*ADVICE(3605): NUMBER has no precision [315] */
4187 ;
4188 l_timekeeper_table t_timekeeper_table;
4189 l_new_tk_data_from_process t_timekeeper_table;
4190 l_old_tk_data_from_process t_timekeeper_table;
4191 l_tk_data_index NUMBER
4192 /*ADVICE(3611): NUMBER has no precision [315] */
4193 ;
4194 l_new_tk_data_index NUMBER
4195 /*ADVICE(3614): NUMBER has no precision [315] */
4196 ;
4197 l_global_index NUMBER
4198 /*ADVICE(3617): NUMBER has no precision [315] */
4199 := 0;
4200 l_approval_style_id NUMBER
4201 /*ADVICE(3620): NUMBER has no precision [315] */
4202 ;
4203 l_approval_status VARCHAR2 (80);
4204 l_delete BOOLEAN;
4205 l_dummy
4206 /*ADVICE(3625): Unreferenced variable [553] */
4207 VARCHAR2 (1);
4208 l_timecard_status VARCHAR2 (10);
4209 num
4210 /*ADVICE(3629): Unreferenced variable [553] */
4211 NUMBER
4212 /*ADVICE(3631): NUMBER has no precision [315] */
4213 ;
4214 e_error_failed
4215 /*ADVICE(3634): Unreferenced variable [553] */
4216 EXCEPTION;
4217 l_message_index
4218 /*ADVICE(3637): Unreferenced variable [553] */
4219 NUMBER
4220 /*ADVICE(3639): NUMBER has no precision [315] */
4221 ;
4222 l_mid_index
4223 /*ADVICE(3642): Unreferenced variable [553] */
4224 NUMBER
4225 /*ADVICE(3644): NUMBER has no precision [315] */
4226 ;
4227 l_tc_status VARCHAR2 (15) := NULL;
4228 /*ADVICE(3652): Initialization to NULL is superfluous [417] */
4229
4230 att_seg_tab hxc_alias_utility.t_alias_att_info;
4231 spemp_tc_list hxc_timecard_utilities.periods;
4232 spemp_tc_info hxc_timekeeper_utilities.emptctab;
4233 sp_index NUMBER
4234 /*ADVICE(3658): NUMBER has no precision [315] */
4235 := 0;
4236 l_timecard_index_info hxc_timekeeper_process.t_timecard_index_info;
4237 l_attribute_index_info hxc_timekeeper_process.t_attribute_index_info;
4238 l_mid_save VARCHAR2 (5) := 'N';
4239 l_comment_made_null BOOLEAN := FALSE;
4240 l_row_locked_id ROWID
4241 /*ADVICE(3665): Use of ROWID [113] */
4242 ;
4243 l_process_lock_type
4244 /*ADVICE(3668): Unreferenced variable [553] */
4245 VARCHAR2 (80) := hxc_lock_util.c_pui_timekeeper_action;
4246 l_relased_success
4247 /*ADVICE(3671): Unreferenced variable [553] */
4248 BOOLEAN;
4249 l_lock_success
4250 /*ADVICE(3674): Unreferenced variable [553] */
4251 BOOLEAN;
4252 l_lock_trx_id
4253 /*ADVICE(3677): Unreferenced variable [553] */
4254 NUMBER (15) := p_trx_lock_id;
4255 l_time_building_block_scope
4256 /*ADVICE(3680): Unreferenced variable [553] */
4257 VARCHAR2 (30);
4258 l_locker_type_id
4259 /*ADVICE(3683): Unreferenced variable [553] */
4260 NUMBER (15);
4261 l_no_details NUMBER
4262 /*ADVICE(3686): NUMBER has no precision [315] */
4263 := 0;
4264 l_changed_detail BOOLEAN := FALSE;
4265 l_emp_terminate_date date;
4266 l_tc_in_term_status varchar2(1) :='N';
4267 BEGIN
4268 g_debug :=hr_utility.debug_enabled;
4269 -- loop in the insert_table and manage the data
4270
4271 g_mid_data.DELETE;
4272 l_tk_table_index := g_timekeeper_data.FIRST;
4273
4274 LOOP
4275 EXIT WHEN (NOT g_timekeeper_data.EXISTS (l_tk_table_index));
4276 -- sort the table
4277
4278 l_resource_id := g_timekeeper_data (l_tk_table_index).resource_id;
4279
4280 IF l_resource_tc_table.EXISTS (l_resource_id) THEN
4281 l_string := l_resource_tc_table (l_resource_id).index_string;
4282 ELSE
4283 l_string := ''
4284 /*ADVICE(3704): In Oracle 8, VARCHAR2 variables of zero length assigned to CHAR variables will blank-pad
4285 these rather than making them NULL [111] */
4286 ;
4287 END IF;
4288
4289 l_resource_tc_table (l_resource_id).index_string := l_string || '|' || l_tk_table_index;
4290
4291 IF g_lock_table.EXISTS (l_resource_id) THEN
4292 l_resource_tc_table (l_resource_id).lockid := g_lock_table (l_resource_id).row_lock_id;
4293 END IF;
4294
4295 -- l_resource_tc_table (l_resource_id).lockid :=g_timekeeper_data(l_tk_table_index).row_lock_id;
4296 l_tk_table_index := g_timekeeper_data.NEXT (l_tk_table_index);
4297 END LOOP;
4298
4299 --get the attributes information associated with timekeeper into att_seg_tab table.
4300
4301 att_seg_tab.DELETE;
4302 hxc_alias_utility.get_alias_att_info (p_timekeeper_id, att_seg_tab);
4303 -- Now we have a table that contains all the indexes of the insert_table
4304 -- by resource_id
4305 -- Let start to build the time_building_block and attributes table by
4306 -- resource_id and deposit it.
4307
4308 l_resource_id := l_resource_tc_table.FIRST;
4309
4310 LOOP
4311 EXIT WHEN (NOT l_resource_tc_table.EXISTS (l_resource_id));
4312 -- empty the timecard and attribute table
4313
4314 -- get the timecards which fit between the range selected.
4315 hxc_timekeeper_utilities.populate_tc_tab (l_resource_id, p_start_period, p_end_period, spemp_tc_info);
4316 -- Remove the timecards which totally dosnt fit in the period
4317 /* changes done by senthil for emp terminate enhancement*/
4318 /*Changed By Mithun for CWK Terminate Bug*/
4319 OPEN c_emp_terminateinfo (p_resource_id => l_resource_id);
4320 FETCH c_emp_terminateinfo INTO l_emp_terminate_date, date_start;
4321 CLOSE c_emp_terminateinfo;
4322
4323 if l_emp_terminate_date between p_start_period and p_end_period then
4324 open c_tc_in_term_period_exists(l_resource_id,p_start_period,p_end_period);
4325 FETCH c_tc_in_term_period_exists into l_tc_in_term_status;
4326 close c_tc_in_term_period_exists;
4327 end if;
4328 if l_tc_in_term_status <> 'Y' then
4329 hxc_timekeeper_utilities.split_timecard (
4330 l_resource_id,
4331 p_start_period,
4332 p_end_period,
4333 spemp_tc_info,
4334 spemp_tc_list
4335 );
4336 else
4337 spemp_tc_list (TO_NUMBER (TO_CHAR (TO_DATE (p_start_period, 'dd-mm-rrrr'), 'J'))).start_date := p_start_period;
4338 spemp_tc_list (TO_NUMBER (TO_CHAR (TO_DATE (p_start_period, 'dd-mm-rrrr'), 'J'))).end_date := p_end_period;
4339 end if;
4340 if g_debug then
4341 hr_utility.trace('spemp_tc_list'||spemp_tc_list.count);
4342 end if;
4343 sp_index := spemp_tc_list.FIRST;
4344
4345 LOOP
4346 EXIT WHEN NOT spemp_tc_list.EXISTS (sp_index);
4347 /* changes done by senthil for emp terminate enhancement*/
4348 if ( nvl(l_emp_terminate_date,TO_DATE (spemp_tc_list (sp_index).start_date, 'DD-MM-RRRR') ) >=
4349 TO_DATE (spemp_tc_list (sp_index).start_date, 'DD-MM-RRRR') and
4350 nvl(l_emp_terminate_date,TO_DATE (spemp_tc_list (sp_index).end_date, 'DD-MM-RRRR')) >=
4351 TO_DATE (spemp_tc_list (sp_index).end_date, 'DD-MM-RRRR') )
4352 or (nvl(l_emp_terminate_date,TO_DATE (spemp_tc_list (sp_index).start_date, 'DD-MM-RRRR'))
4353 between TO_DATE (spemp_tc_list (sp_index).start_date, 'DD-MM-RRRR') and TO_DATE (spemp_tc_list (sp_index).end_date, 'DD-MM-RRRR')) then
4354 IF (TO_DATE (p_start_period, 'DD-MM-RRRR') >
4355 TO_DATE (spemp_tc_list (sp_index).start_date, 'DD-MM-RRRR')
4356 )
4357 OR (TO_DATE (p_end_period, 'DD-MM-RRRR') <
4358 TO_DATE (spemp_tc_list (sp_index).end_date, 'DD-MM-RRRR')
4359 ) THEN
4360 if g_debug then
4361 hr_utility.trace('outside timecard');
4362 end if;
4363 NULL; --outside range
4364 /*ADVICE(3761): Use of NULL statements [532] */
4365
4366 ELSE
4367 l_timecard.DELETE;
4368 l_attributes.DELETE;
4369 if g_debug then
4370 hr_utility.trace('before create timecard day structure ');
4371 end if;
4372 --
4373 -- create the TIMECARD, DAY, DETAIL, ATTRIBUTE structure
4374 if g_debug then
4375 hr_utility.trace('Timekeeper Save process--20');
4376 end if;
4377 create_timecard_day_structure (
4378 p_resource_id => l_resource_id,
4379 p_start_period => TO_DATE (spemp_tc_list (sp_index).start_date, 'DD-MM-RRRR'),
4380 p_end_period => TO_DATE (spemp_tc_list (sp_index).end_date, 'DD-MM-RRRR'),
4381 p_tc_frdt => p_start_period,
4382 p_tc_todt => p_end_period,
4383 p_timecard => l_timecard,
4384 p_attributes => l_attributes,
4385 p_day_id_info_table => l_day_id_info_table,
4386 p_approval_style_id => l_approval_style_id,
4387 p_approval_status => l_approval_status,
4388 p_comment_text => l_timecard_comment_text,
4389 p_timecard_status => l_timecard_status,
4390 p_attribute_index_info => l_attribute_index_info,
4391 p_timecard_index_info => l_timecard_index_info,
4392 p_timecard_id => l_timecard_id
4393 ); --added p_timecard 2789497
4394 -- at this point we have the timecard structure set up
4395 -- now following the action on the detail, we need to reajust this structure
4396 -- before send it to the deposit.
4397
4398 -- for each index found for the resource create the detail information
4399 l_mid_save := 'N'; --2789497
4400 l_comment_made_null := FALSE; --2789497
4401 l_index_start := INSTR (l_resource_tc_table (l_resource_id).index_string, '|', 1, 1) + 1;
4402
4403 LOOP
4404 l_index_next := INSTR (l_resource_tc_table (l_resource_id).index_string, '|', l_index_start, 1);
4405
4406 IF (l_index_next = 0) THEN
4407 l_result := SUBSTR (
4408 l_resource_tc_table (l_resource_id).index_string,
4409 l_index_start,
4410 LENGTH (l_resource_tc_table (l_resource_id).index_string) + 1 - l_index_start
4411 );
4412 ELSE
4413 l_result := SUBSTR (
4414 l_resource_tc_table (l_resource_id).index_string,
4415 l_index_start,
4416 l_index_next - l_index_start
4417 );
4418 END IF;
4419
4420 --create Timecard attributes structure
4421 if g_debug then
4422 hr_utility.trace('Timekeeper Save process--30');
4423 end if;
4424 create_detail_structure (
4425 p_timekeeper_id => p_timekeeper_id,
4426 p_att_tab => att_seg_tab,
4427 p_resource_id => l_resource_id,
4428 p_start_period => TO_DATE (spemp_tc_list (sp_index).start_date, 'DD-MM-RRRR'),
4429 p_end_period => TO_DATE (spemp_tc_list (sp_index).end_date, 'DD-MM-RRRR'),
4430 p_tc_frdt => p_start_period,
4431 p_tc_todt => p_end_period,
4432 p_insert_detail => g_timekeeper_data (l_result),
4433 p_timecard => l_timecard,
4434 p_attributes => l_attributes,
4435 p_day_id_info_table => l_day_id_info_table,
4436 p_approval_style_id => l_approval_style_id,
4437 p_attribute_index_info => l_attribute_index_info,
4438 p_timecard_index_info => l_timecard_index_info,
4439 p_timecard_id => l_timecard_id,
4440 p_mid_save => l_mid_save,
4441 p_comment_made_null => l_comment_made_null,
4442 p_row_lock_id => l_row_locked_id,
4443 p_tk_audit_enabled => p_tk_audit_enabled
4444 );
4445 l_index_start := l_index_next + 1;
4446 l_result := NULL;
4447 EXIT WHEN l_index_next = 0;
4448 END LOOP; --l_index loop
4449 /*ADVICE(3839): Nested LOOPs should all be labeled [406] */
4450
4451 -- we are checking that the timecard has at least
4452 -- one detail valid
4453
4454 l_delete := TRUE;
4455 l_timecard_index := l_timecard.FIRST;
4456
4457 LOOP
4458 EXIT WHEN (NOT l_timecard.EXISTS (l_timecard_index));
4459 IF l_timecard (l_timecard_index).SCOPE = 'DETAIL' THEN
4460 IF fnd_date.canonical_to_date (l_timecard (l_timecard_index).date_to) = hr_general.end_of_time THEN
4461 l_delete := FALSE;
4462 EXIT;
4463 END IF;
4464 END IF;
4465
4466 IF l_timecard (l_timecard_index).SCOPE = 'TIMECARD' THEN
4467 IF fnd_date.canonical_to_date (l_timecard (l_timecard_index).date_to) =
4468 hr_general.end_of_time
4469 AND l_timecard (l_timecard_index).comment_text IS NOT NULL
4470 AND l_timecard (l_timecard_index).NEW = 'Y' THEN
4471 l_delete := FALSE;
4472 EXIT;
4473 END IF;
4474 END IF;
4475
4476 IF l_timecard (l_timecard_index).SCOPE = 'TIMECARD' THEN
4477 l_timecard_id := l_timecard (l_timecard_index).time_building_block_id;
4478 END IF;
4479
4480 -- next item
4481 l_timecard_index := l_timecard.NEXT (l_timecard_index);
4482 END LOOP;
4483 /*ADVICE(3875): Presence of more than one exit point from a loop [503] */
4484
4485 /*ADVICE(3877): Nested LOOPs should all be labeled [406] */
4486
4487
4488 -- save the timecard
4489
4490 IF (l_delete) THEN
4491 l_messages.DELETE;
4492
4493 IF l_timecard_id IS NOT NULL AND l_timecard_id < 0 THEN
4494 l_timecard.DELETE;
4495 l_attributes.DELETE;
4496 ELSE
4497 --delete the timecard as no detail is active
4498 hxc_timekeeper.delete_timecard (p_timecard_id => l_timecard_id, p_messages => l_messages);
4499 END IF;
4500 ELSE
4501 l_timecard_id := NULL;
4502 l_tc_status := NULL;
4503 l_messages.DELETE;
4504 if g_debug then
4505 hr_utility.trace('Timekeeper Save process--40');
4506 hr_utility.trace('l_timecard.count'||l_timecard.count);
4507 hr_utility.trace('l_attributes.count'||l_attributes.count);
4508 hr_utility.trace('l_messages.count'||l_messages.count);
4509 end if;
4510 IF l_mid_save = 'Y' THEN --2789497
4511 if g_debug then
4512 hr_utility.TRACE ('start');
4513 end if;
4514 -- my_debug.print_timecard('100', l_timecard);
4515 -- my_debug.print_attributes('200', l_attributes);
4516 --
4517
4518 hxc_timekeeper.save_timecard (
4519 p_blocks => l_timecard,
4520 p_attributes => l_attributes,
4521 p_messages => l_messages,
4522 p_timecard_id => l_timecard_id,
4523 p_timecard_ovn => l_timecard_ovn,
4524 p_timekeeper_id => p_timekeeper_id,
4525 p_tk_audit_enabled => p_tk_audit_enabled,
4526 p_tk_notify_to => p_tk_notify_to,
4527 p_tk_notify_type => p_tk_notify_type
4528 );
4529 END IF;
4530 END IF;
4531 END IF;
4532 end if;
4533 /* end of changes made by senthil */
4534 sp_index := spemp_tc_list.NEXT (sp_index);
4535 END LOOP;
4536 /*ADVICE(3925): Nested LOOPs should all be labeled [406] */
4537
4538
4539 -- next timecard
4540 l_resource_id := l_resource_tc_table.NEXT (l_resource_id);
4541 END LOOP;
4542
4543 -- reset global table
4544 if g_debug then
4545 hr_utility.trace('Timekeeper Save process--50');
4546 end if;
4547 g_timekeeper_data.DELETE;
4548 g_negative_index := -2;
4549
4550 -- now we need to go through the global query table and up-to-date the information
4551 -- first set the global parameter to tell the query procedure to not update the
4552 -- global query table.
4553 -- get the g_timekeeper_data_query first.
4554
4555 -- IF it is not a submit
4556
4557 ---start the rqquery process
4558
4559 -- IF p_mode <> 'SUBMIT' THEN
4560
4561
4562 l_new_tk_data_from_process.DELETE;
4563 l_old_tk_data_from_process := g_timekeeper_data_query;
4564 g_from_tk_process := TRUE;
4565 -- repopulate the global table that we want to send back via the query
4566
4567 l_resource_id := l_resource_tc_table.FIRST;
4568
4569 LOOP
4570 EXIT WHEN (NOT l_resource_tc_table.EXISTS (l_resource_id));
4571 -- call the process query to requery only the person has
4572 -- his timecard changed
4573
4574 l_timekeeper_table.DELETE;
4575 timekeeper_query (
4576 p_timekeeper_data => l_timekeeper_table,
4577 p_timekeeper_id => p_timekeeper_id,
4578 p_start_period => p_start_period,
4579 p_end_period => p_end_period,
4580 p_group_id => NULL,
4581 p_resource_id => l_resource_id,
4582 p_attribute1 => NULL,
4583 p_attribute2 => NULL,
4584 p_attribute3 => NULL,
4585 p_attribute4 => NULL,
4586 p_attribute5 => NULL,
4587 p_attribute6 => NULL,
4588 p_attribute7 => NULL,
4589 p_attribute8 => NULL,
4590 p_attribute9 => NULL,
4591 p_attribute10 => NULL,
4592 p_attribute11 => NULL,
4593 p_attribute12 => NULL,
4594 p_attribute13 => NULL,
4595 p_attribute14 => NULL,
4596 p_attribute15 => NULL,
4597 p_attribute16 => NULL,
4598 p_attribute17 => NULL,
4599 p_attribute18 => NULL,
4600 p_attribute19 => NULL,
4601 p_attribute20 => NULL,
4602 p_status_code => NULL,
4603 p_rec_periodid => p_rec_periodid,
4604 p_superflag => p_superflag,
4605 p_reqryflg => 'Y',
4606 p_trx_lock_id => p_trx_lock_id,
4607 p_row_lock_id => g_lock_table (l_resource_id).row_lock_id,
4608 p_person_type => NULL,
4609 p_message_type => NULL,
4610 p_query_type => NULL,
4611 p_lock_profile => p_lock_profile,
4612 p_message_text => NULL,
4613 p_late_reason => NULL,
4614 p_change_reason => NULL,
4615 p_audit_enabled => NULL,
4616 p_audit_history => NULL
4617 );
4618
4619 -- now we have the new timecard saved in the DB
4620 -- we need to go through the global table to replace
4621 -- the old timecard for this person.
4622
4623 -- first we are populating all the timecard information
4624 -- that have changed.
4625
4626
4627 IF l_new_tk_data_from_process.COUNT > 0 THEN
4628 l_new_tk_data_index := l_new_tk_data_from_process.LAST + 1;
4629 ELSE
4630 l_new_tk_data_index := 1;
4631 END IF;
4632
4633 l_tk_data_index := l_timekeeper_table.FIRST;
4634 g_resource_tc_table (l_resource_id).no_rows := 0;
4635
4636 LOOP
4637 EXIT WHEN (NOT l_timekeeper_table.EXISTS (l_tk_data_index));
4638 l_new_tk_data_from_process (l_new_tk_data_index) := l_timekeeper_table (l_tk_data_index);
4639 l_new_tk_data_index := l_new_tk_data_index + 1;
4640 g_resource_tc_table (l_resource_id).no_rows :=
4641 NVL (g_resource_tc_table (l_resource_id).no_rows, 0) + 1;
4642 l_tk_data_index := l_timekeeper_table.NEXT (l_tk_data_index);
4643 END LOOP;
4644 /*ADVICE(4031): Nested LOOPs should all be labeled [406] */
4645
4646
4647 -- next timecard
4648 l_resource_id := l_resource_tc_table.NEXT (l_resource_id);
4649 END LOOP;
4650
4651 -- with the new information and the old information we are going
4652 -- to make the up-to-date information in global table
4653 -- handle the case that the query did not return a row
4654
4655 IF l_old_tk_data_from_process.COUNT = 0 THEN
4656 g_tk_data_query_from_process := l_new_tk_data_from_process;
4657 ELSE
4658 -- loop into the old table to made the new table
4659 l_tk_data_index := l_old_tk_data_from_process.FIRST;
4660
4661 LOOP
4662 EXIT WHEN (NOT l_old_tk_data_from_process.EXISTS (l_tk_data_index));
4663 l_resource_id := l_old_tk_data_from_process (l_tk_data_index).resource_id;
4664
4665 IF l_resource_tc_table.EXISTS (l_resource_id) THEN
4666 -- that means that we need to populate the new table with
4667 -- the new information contains in the new table
4668
4669 l_new_tk_data_index := l_new_tk_data_from_process.FIRST;
4670
4671 LOOP
4672 EXIT WHEN (NOT l_new_tk_data_from_process.EXISTS (l_new_tk_data_index));
4673
4674 IF l_new_tk_data_from_process (l_new_tk_data_index).resource_id = l_resource_id THEN
4675 l_no_details := 0;
4676 l_global_index := l_global_index + 1;
4677 g_tk_data_query_from_process (l_global_index) := l_new_tk_data_from_process (l_new_tk_data_index);
4678 g_tk_data_query_from_process (l_global_index).check_box := 'Y';
4679 g_submit_table (l_resource_id).resource_id := l_resource_id;
4680 g_submit_table (l_resource_id).timecard_id :=
4681 l_new_tk_data_from_process (l_new_tk_data_index).timecard_id;
4682 g_submit_table (l_resource_id).start_time :=
4683 l_new_tk_data_from_process (l_new_tk_data_index).timecard_start_period;
4684 g_submit_table (l_resource_id).stop_time :=
4685 l_new_tk_data_from_process (l_new_tk_data_index).timecard_end_period;
4686 g_submit_table (l_resource_id).row_lock_id :=
4687 l_new_tk_data_from_process (l_new_tk_data_index).row_lock_id;
4688 -- delete this information since we don't need it anymore
4689
4690 l_new_tk_data_from_process.DELETE (l_new_tk_data_index);
4691 END IF;
4692
4693 -- increment the index
4694 l_new_tk_data_index := l_new_tk_data_from_process.NEXT (l_new_tk_data_index);
4695 END LOOP;
4696 /*ADVICE(4083): Nested LOOPs should all be labeled [406] */
4697
4698 ELSE
4699 -- populate the information with the old data
4700
4701 l_global_index := l_global_index + 1;
4702 g_tk_data_query_from_process (l_global_index) := l_old_tk_data_from_process (l_tk_data_index);
4703 g_tk_data_query_from_process (l_global_index).check_box := 'N';
4704 g_resource_tc_table (l_resource_id).no_rows := 0;
4705 g_submit_table.DELETE (l_resource_id);
4706 END IF;
4707
4708 -- increment the index
4709
4710 l_tk_data_index := l_old_tk_data_from_process.NEXT (l_tk_data_index);
4711 END LOOP;
4712
4713 -- now we need to handle the extra new information and stick them
4714 -- at the bottom of the pl/sql table
4715 -- not a pretty solution -- need to look if we can find better.
4716
4717 l_new_tk_data_index := l_new_tk_data_from_process.FIRST;
4718
4719 LOOP
4720 EXIT WHEN (NOT l_new_tk_data_from_process.EXISTS (l_new_tk_data_index));
4721 l_global_index := l_global_index + 1;
4722 g_tk_data_query_from_process (l_global_index) := l_new_tk_data_from_process (l_new_tk_data_index);
4723 -- increment the index
4724 l_new_tk_data_index := l_new_tk_data_from_process.NEXT (l_new_tk_data_index);
4725 END LOOP;
4726 END IF;
4727
4728 g_tk_finish_process := TRUE;
4729 --END IF;
4730
4731 hxc_timekeeper_utilities.convert_type_to_message_table (l_messages, p_messages);
4732 /* bug fix for 5229954 */
4733 hxc_timekeeper_utilities.populate_detail_temp(1);
4734 /* end of fix for 5229954 */
4735 COMMIT;
4736 END;
4737
4738
4739 -------------------------------------------------------------------------------
4740 -- call_submit
4741 -------------------------------------------------------------------------------
4742 PROCEDURE call_submit (
4743 p_timekeeper_id IN NUMBER,
4744 p_start_period IN DATE,
4745 p_end_period IN DATE,
4746 p_submission_id IN NUMBER,
4747 p_request_id OUT NOCOPY NUMBER
4748 ) IS
4749 l_erro
4750 /*ADVICE(4134): Unreferenced variable [553] */
4751 VARCHAR2 (80);
4752 l_err_code
4753 /*ADVICE(4137): Unreferenced variable [553] */
4754 NUMBER
4755 /*ADVICE(4139): NUMBER has no precision [315] */
4756 ;
4757 BEGIN
4758 p_request_id := fnd_request.submit_request (
4759 application => 'HXC',
4760 program => 'HXCTKSUB',
4761 description => NULL,
4762 argument1 => p_timekeeper_id,
4763 argument2 => fnd_date.date_to_canonical (p_start_period),
4764 argument3 => fnd_date.date_to_canonical (p_end_period),
4765 argument4 => p_submission_id
4766 );
4767 COMMIT;
4768 END;
4769
4770
4771 ------------------------------------------------------------------------------
4772 -- submit resources
4773 ------------------------------------------------------------------------------
4774 PROCEDURE submit_resource (
4775 p_timekeeper_id
4776 /*ADVICE(4160): Unreferenced parameter [552] */
4777 IN NUMBER,
4778 p_start_time IN DATE,
4779 p_stop_time IN DATE,
4780 p_trx_id IN NUMBER,
4781 p_submit_id OUT NOCOPY NUMBER,
4782 p_insert OUT NOCOPY BOOLEAN,
4783 p_submit_emp OUT NOCOPY hxc_timekeeper_process.tk_submit_tab,
4784 p_messages IN OUT NOCOPY hxc_self_service_time_deposit.message_table
4785 ) IS
4786 CURSOR crs_max_submit IS
4787 SELECT MAX (submission_id)
4788 FROM hxc_tk_timekeeper_submits;
4789
4790 l_max_submission_id NUMBER
4791 /*ADVICE(4175): NUMBER has no precision [315] */
4792 ;
4793 l_next_val NUMBER
4794 /*ADVICE(4178): NUMBER has no precision [315] */
4795 ;
4796 l_index NUMBER
4797 /*ADVICE(4181): NUMBER has no precision [315] */
4798 ;
4799 l_success BOOLEAN;
4800 l_row_id ROWID
4801 /*ADVICE(4185): Use of ROWID [113] */
4802 ;
4803 l_tc_lock_boolean BOOLEAN;
4804 BEGIN
4805 OPEN crs_max_submit;
4806 FETCH crs_max_submit INTO l_max_submission_id;
4807 CLOSE crs_max_submit;
4808
4809 IF l_max_submission_id IS NULL THEN
4810 l_max_submission_id := 1;
4811 END IF;
4812
4813 SELECT hxc_tk_timekeeper_submits_s.NEXTVAL
4814 INTO l_next_val
4815 FROM DUAL;
4816
4817 IF l_max_submission_id < l_next_val THEN
4818 l_max_submission_id := l_next_val;
4819 ELSE
4820 l_max_submission_id := l_max_submission_id + 1;
4821 END IF;
4822
4823 p_insert := FALSE;
4824 l_index := g_submit_table.FIRST;
4825
4826 LOOP
4827 EXIT WHEN NOT g_submit_table.EXISTS (l_index);
4828 hxc_tks_ins.ins (
4829 p_resource_id => g_submit_table (l_index).resource_id,
4830 p_submission_id => l_max_submission_id
4831 );
4832 p_insert := TRUE;
4833 hxc_lock_api.release_lock (
4834 p_row_lock_id => g_submit_table (l_index).row_lock_id,
4835 p_process_locker_type => 'PUI_TIMEKEEPER_ACTION',
4836 p_transaction_lock_id => p_trx_id,
4837 p_released_success => l_success
4838 );
4839 hxc_timekeeper_process.add_remove_lock (
4840 p_resource_id => g_submit_table (l_index).resource_id,
4841 p_start_period => p_start_time,
4842 p_end_period => p_stop_time + g_one_day,
4843 p_timecard_id => NULL,
4844 p_row_lock_id => g_submit_table (l_index).row_lock_id,
4845 p_operation => 'N'
4846 );
4847 hxc_lock_api.request_lock (
4848 p_process_locker_type => 'PUI_TIMEKEEPER_ACTION',
4849 p_resource_id => g_submit_table (l_index).resource_id,
4850 p_start_time => p_start_time,
4851 p_stop_time => p_stop_time + g_one_day,
4852 p_time_building_block_id => NULL,
4853 p_time_building_block_ovn => NULL,
4854 p_transaction_lock_id => l_max_submission_id,
4855 p_expiration_time => 60,
4856 p_messages => p_messages,
4857 p_row_lock_id => l_row_id,
4858 p_locked_success => l_tc_lock_boolean
4859 );
4860 hxc_timekeeper_process.add_remove_lock (
4861 p_resource_id => g_submit_table (l_index).resource_id,
4862 p_start_period => p_start_time,
4863 p_end_period => p_stop_time + g_one_day,
4864 p_timecard_id => NULL,
4865 p_row_lock_id => l_row_id,
4866 p_operation => 'Y'
4867 );
4868 l_index := g_submit_table.NEXT (l_index);
4869 END LOOP;
4870
4871 p_submit_emp := g_submit_table;
4872 p_submit_id := l_max_submission_id;
4873 g_submit_table.DELETE;
4874 END submit_resource;
4875
4876
4877 -------------------------------------------------------------------------------
4878 -- run_submit
4879 -------------------------------------------------------------------------------
4880 PROCEDURE run_submit (
4881 p_errmsg
4882 /*ADVICE(4266): Unreferenced parameter [552] */
4883 OUT NOCOPY VARCHAR2,
4884 p_errcode
4885 /*ADVICE(4269): Unreferenced parameter [552] */
4886 OUT NOCOPY NUMBER,
4887 p_timekeeper_id IN NUMBER,
4888 p_start_period IN VARCHAR2,
4889 p_end_period IN VARCHAR2,
4890 p_submission_id IN NUMBER
4891 ) IS
4892 CURSOR crs_resource_id (
4893 p_submit_id IN NUMBER
4894 ) IS
4895 SELECT DISTINCT (resource_id) resource_id
4896 FROM hxc_tk_timekeeper_submits
4897 WHERE submission_id = p_submit_id;
4898
4899 CURSOR crs_employee_info (
4900 p_resource_id IN NUMBER,
4901 p_from_period IN DATE,
4902 p_to_period IN DATE
4903 ) IS
4904 SELECT DISTINCT NVL (ppf.employee_number, ppf.npw_number) employee_number,
4905 ppf.full_name,
4906 ppf.effective_end_date
4907 FROM per_people_f ppf
4908 WHERE ppf.person_id = p_resource_id
4909 AND p_from_period < ppf.effective_end_date
4910 AND p_to_period > ppf.effective_start_date
4911 AND EXISTS ( select 'x'
4912 from per_all_assignments_f paa
4913 WHERE ppf.person_id = paa.person_id
4914 AND paa.primary_flag = 'Y'
4915 AND paa.assignment_type IN ('E', 'C')
4916 AND p_from_period < paa.effective_end_date
4917 AND p_to_period > paa.effective_start_date )
4918 ORDER BY ppf.effective_end_date DESC;
4919
4920 /*Cursor Modified By Mithun for CWK Terminate Bug*/
4921 /* changes done by senthil for emp terminate enhancement*/
4922 CURSOR c_emp_terminateinfo(
4923 p_resource_id NUMBER
4924 ) IS
4925 SELECT final_process_date, date_start
4926 FROM per_periods_of_service
4927 WHERE person_id = p_resource_id
4928 union all
4929 select (final_process_date + NVL(fnd_profile.value('HXC_CWK_TK_FPD'),0)) final_process_date, date_start
4930 from per_periods_of_placement
4931 where person_id = p_resource_id
4932 ORDER BY date_start DESC;
4933
4934 --Added By Mithun for CWK Terminate Bug
4935 date_start DATE;
4936
4937 CURSOR c_tc_in_term_period_exists(
4938 p_resource_id number, p_start_date date, p_end_date date) IS
4939 SELECT 'Y'
4940 from hxc_time_building_blocks
4941 where resource_id=p_resource_id
4942 and scope='TIMECARD'
4943 and trunc(start_time)=trunc(p_start_date)
4944 and trunc(stop_time)=trunc(p_end_date)
4945 and (trunc(date_to) = hr_general.end_of_time or APPROVAL_STATUS='ERROR');
4946 /*end of senthil changes */
4947
4948 l_timecard hxc_block_table_type := hxc_block_table_type ();
4949 ord_timecard
4950 /*ADVICE(4303): Unreferenced variable [553] */
4951 hxc_block_table_type := hxc_block_table_type ();
4952 l_attributes hxc_attribute_table_type := hxc_attribute_table_type ();
4953 p_messages hxc_message_table_type := hxc_message_table_type ();
4954 l_day_id_info_table t_day_id_info_table;
4955 n
4956 /*ADVICE(4309): Unreferenced variable [553] */
4957 NUMBER
4958 /*ADVICE(4311): NUMBER has no precision [315] */
4959 := 0;
4960 l_timecard_id NUMBER
4961 /*ADVICE(4314): NUMBER has no precision [315] */
4962 := NULL;
4963 /*ADVICE(4316): Initialization to NULL is superfluous [417] */
4964
4965 l_timecard_ovn NUMBER
4966 /*ADVICE(4319): NUMBER has no precision [315] */
4967 := NULL;
4968 /*ADVICE(4321): Initialization to NULL is superfluous [417] */
4969
4970 l_approval_style_id NUMBER
4971 /*ADVICE(4324): NUMBER has no precision [315] */
4972 := NULL;
4973 /*ADVICE(4326): Initialization to NULL is superfluous [417] */
4974
4975 l_approval_status VARCHAR2 (80) := NULL;
4976 /*ADVICE(4329): Initialization to NULL is superfluous [417] */
4977
4978 l_index_next
4979 /*ADVICE(4332): Unreferenced variable [553] */
4980 NUMBER
4981 /*ADVICE(4334): NUMBER has no precision [315] */
4982 ;
4983 l_index_start
4984 /*ADVICE(4337): Unreferenced variable [553] */
4985 NUMBER
4986 /*ADVICE(4339): NUMBER has no precision [315] */
4987 ;
4988 l_result
4989 /*ADVICE(4342): Unreferenced variable [553] */
4990 VARCHAR2 (10);
4991 l_timecard_status VARCHAR2 (10);
4992 l_resource_id
4993 /*ADVICE(4346): Unreferenced variable [553] */
4994 NUMBER
4995 /*ADVICE(4348): NUMBER has no precision [315] */
4996 ;
4997 l_timecard_comment_text
4998 /*ADVICE(4351): Unreferenced variable [553] */
4999 VARCHAR2 (2000) := NULL;
5000 /*ADVICE(4353): VARCHAR2 declaration with length greater than 500 characters [307] */
5001
5002 /*ADVICE(4355): Initialization to NULL is superfluous [417] */
5003
5004 l_date_to
5005 /*ADVICE(4358): Unreferenced variable [553] */
5006 DATE;
5007 l_date_from
5008 /*ADVICE(4361): Unreferenced variable [553] */
5009 DATE;
5010 sub_log_msg VARCHAR2 (2000);
5011 /*ADVICE(4364): VARCHAR2 declaration with length greater than 500 characters [307] */
5012
5013 rej_log_msg VARCHAR2 (2000);
5014 /*ADVICE(4367): VARCHAR2 declaration with length greater than 500 characters [307] */
5015
5016 lock_log_msg VARCHAR2 (2000);
5017 /*ADVICE(4370): VARCHAR2 declaration with length greater than 500 characters [307] */
5018
5019 l_empnumber VARCHAR2 (30);
5020 l_empname VARCHAR2 (240);
5021 l_enddate DATE;
5022 spemp_tc_list hxc_timecard_utilities.periods;
5023 spemp_tc_info hxc_timekeeper_utilities.emptctab;
5024 sp_index NUMBER
5025 /*ADVICE(4378): NUMBER has no precision [315] */
5026 := 0;
5027 l_timecard_index_info hxc_timekeeper_process.t_timecard_index_info;
5028 l_attribute_index_info hxc_timekeeper_process.t_attribute_index_info;
5029 l_process_lock_type VARCHAR2 (80) := hxc_lock_util.c_pui_timekeeper_action;
5030 l_messages hxc_message_table_type := hxc_message_table_type ();
5031 l_row_id ROWID
5032 /*ADVICE(4385): Use of ROWID [113] */
5033 ;
5034 l_tc_lock_boolean BOOLEAN;
5035 l_relased_success BOOLEAN := FALSE;
5036 l_lock_trx_id NUMBER (15) := p_submission_id;
5037 l_lock_row_id ROWID
5038 /*ADVICE(4391): Use of ROWID [113] */
5039 ;
5040 l_notify_to VARCHAR2 (30);
5041 l_notify_type VARCHAR2 (20);
5042 l_tk_audit_enabled VARCHAR2 (30);
5043 l_operating_unit_id number(15);
5044 l_operating_name hr_operating_units.name%type;
5045 l_operating_unit_cnt number(10);
5046 l_emp_terminate_date date;
5047 l_tc_in_term_status varchar2(1) :='N';
5048 BEGIN
5049 g_submit := TRUE;
5050 -- initialize the workflow
5051
5052
5053 hxc_self_service_time_deposit.set_workflow_info (
5054 p_item_type => 'HXCEMP',
5055 p_process_name => 'HXC_APPROVAL'
5056 );
5057
5058 FOR c_resource IN crs_resource_id (p_submission_id) LOOP
5059 --Initialize the org_id
5060 BEGIN
5061 -- Derive the operating unit for the resource
5062
5063 -- ONLY CALL THIS FOR R12 WHEN API AVAILABLE
5064 Begin
5065 l_operating_unit_id := hr_organization_api.get_operating_unit
5066 (p_effective_date => sysdate
5067 ,p_person_id => c_resource.resource_id);
5068
5069 exception
5070 when others then
5071 MO_UTILS.get_default_ou(l_operating_unit_id,l_operating_name,l_operating_unit_cnt);
5072 end;
5073
5074 -- now set the operating unit context
5075
5076 -- ONLY CALL THIS FOR RELEASE 12
5077
5078 mo_global.init('HXC');
5079 mo_global.set_policy_context ( 'S', l_operating_unit_id );
5080 End;
5081 hxc_timekeeper_utilities.populate_tc_tab (
5082 c_resource.resource_id,
5083 fnd_date.canonical_to_date (p_start_period),
5084 fnd_date.canonical_to_date (p_end_period),
5085 spemp_tc_info
5086 );
5087 /* changes done by senthil for emp terminate enhancement*/
5088 /*Changed By Mithun for CWK Terminate Bug*/
5089 OPEN c_emp_terminateinfo (p_resource_id => c_resource.resource_id);
5090 FETCH c_emp_terminateinfo INTO l_emp_terminate_date, date_start;
5091 CLOSE c_emp_terminateinfo;
5092 if l_emp_terminate_date between fnd_date.canonical_to_date (p_start_period) and fnd_date.canonical_to_date (p_end_period) then
5093 open c_tc_in_term_period_exists(c_resource.resource_id, fnd_date.canonical_to_date (p_start_period), fnd_date.canonical_to_date (p_end_period));
5094 FETCH c_tc_in_term_period_exists into l_tc_in_term_status;
5095 close c_tc_in_term_period_exists;
5096 end if;
5097 if l_tc_in_term_status <> 'Y' then
5098 hxc_timekeeper_utilities.split_timecard (
5099 c_resource.resource_id,
5100 fnd_date.canonical_to_date (p_start_period),
5101 fnd_date.canonical_to_date (p_end_period),
5102 spemp_tc_info,
5103 spemp_tc_list
5104 );
5105 else
5106 spemp_tc_list (TO_NUMBER (TO_CHAR (TO_DATE (fnd_date.canonical_to_date(p_start_period), 'dd-mm-rrrr'), 'J'))).start_date := fnd_date.canonical_to_date (p_start_period);
5107 spemp_tc_list (TO_NUMBER (TO_CHAR (TO_DATE (fnd_date.canonical_to_date(p_start_period), 'dd-mm-rrrr'), 'J'))).end_date := fnd_date.canonical_to_date (p_end_period);
5108 end if;
5109 sp_index := spemp_tc_list.FIRST;
5110 LOOP
5111 EXIT WHEN NOT spemp_tc_list.EXISTS (sp_index);
5112 IF (TO_DATE (fnd_date.canonical_to_date (p_start_period), 'DD-MM-RRRR') >
5113 TO_DATE (spemp_tc_list (sp_index).start_date, 'DD-MM-RRRR')
5114 )
5115 OR (TO_DATE (fnd_date.canonical_to_date (p_end_period), 'DD-MM-RRRR') <
5116 TO_DATE (spemp_tc_list (sp_index).end_date, 'DD-MM-RRRR')
5117 ) THEN
5118 NULL;
5119 /*ADVICE(4432): Use of NULL statements [532] */
5120
5121 ELSE
5122 l_attributes.DELETE;
5123 l_timecard.DELETE;
5124 l_timecard_id := NULL;
5125 l_row_id := NULL;
5126 l_tc_lock_boolean := FALSE;
5127 l_relased_success := FALSE;
5128 l_day_id_info_table.delete;
5129 l_timecard_index_info.delete;
5130 l_attribute_index_info.delete;
5131
5132 create_timecard_day_structure (
5133 p_resource_id => c_resource.resource_id,
5134 p_start_period => TO_DATE (spemp_tc_list (sp_index).start_date, 'DD-MM-RRRR'),
5135 p_end_period => TO_DATE (spemp_tc_list (sp_index).end_date, 'DD-MM-RRRR'),
5136 p_tc_frdt => fnd_date.canonical_to_date (p_start_period),
5137 p_tc_todt => fnd_date.canonical_to_date (p_end_period),
5138 p_timecard => l_timecard,
5139 p_attributes => l_attributes,
5140 p_day_id_info_table => l_day_id_info_table,
5141 p_approval_style_id => l_approval_style_id,
5142 p_approval_status => l_approval_status,
5143 p_comment_text => NULL,
5144 p_timecard_status => l_timecard_status,
5145 p_attribute_index_info => l_attribute_index_info,
5146 p_timecard_index_info => l_timecard_index_info,
5147 p_timecard_id => l_timecard_id
5148 );
5149 --check the lock
5150 l_lock_row_id := hxc_lock_api.check_lock (
5151 p_process_locker_type => l_process_lock_type,
5152 p_transaction_lock_id => l_lock_trx_id,
5153 p_resource_id => c_resource.resource_id
5154 );
5155
5156 IF NVL (l_timecard_status, 'xx') = 'SUBMITTED' OR NVL (l_timecard_status, 'xx') = 'APPROVED' THEN
5157 fnd_file.new_line (fnd_file.LOG, 1);
5158 fnd_message.set_name ('HXC', 'HXC_NOCHANGE_TIMECARD');
5159
5160 IF sub_log_msg IS NULL THEN
5161 sub_log_msg := SUBSTR (fnd_message.get (), 1, 2000);
5162 fnd_file.put_line (fnd_file.LOG, sub_log_msg);
5163 rej_log_msg := NULL;
5164 fnd_file.new_line (fnd_file.LOG, 1);
5165 END IF;
5166
5167 OPEN crs_employee_info (
5168 c_resource.resource_id,
5169 fnd_date.canonical_to_date (p_start_period),
5170 fnd_date.canonical_to_date (p_end_period)
5171 );
5172 FETCH crs_employee_info INTO l_empnumber, l_empname, l_enddate;
5173 /*ADVICE(4482): FETCH into a list of variables instead of a record [204] */
5174
5175 CLOSE crs_employee_info;
5176 fnd_file.put_line (fnd_file.LOG, RTRIM (l_empnumber) || ' - ' || RTRIM (l_empname));
5177 hxc_lock_api.release_lock (
5178 p_row_lock_id => l_lock_row_id,
5179 p_process_locker_type => l_process_lock_type,
5180 p_transaction_lock_id => l_lock_trx_id,
5181 p_resource_id => NULL,
5182 p_start_time => NULL,
5183 p_stop_time => NULL,
5184 p_time_building_block_id => NULL,
5185 p_time_building_block_ovn => NULL,
5186 p_messages => l_messages,
5187 p_released_success => l_relased_success
5188 );
5189 ELSIF NVL (l_timecard_status, 'xx') = 'xx' THEN
5190 l_timecard.DELETE;
5191 l_attributes.DELETE;
5192 hxc_lock_api.release_lock (
5193 p_row_lock_id => l_lock_row_id,
5194 p_process_locker_type => l_process_lock_type,
5195 p_transaction_lock_id => l_lock_trx_id,
5196 p_resource_id => NULL,
5197 p_start_time => NULL,
5198 p_stop_time => NULL,
5199 p_time_building_block_id => NULL,
5200 p_time_building_block_ovn => NULL,
5201 p_messages => l_messages,
5202 p_released_success => l_relased_success
5203 );
5204 ELSE
5205 --if lock is removed again request lock
5206 IF l_lock_row_id IS NULL THEN
5207 hxc_lock_api.request_lock (
5208 p_process_locker_type => l_process_lock_type,
5209 p_resource_id => c_resource.resource_id,
5210 p_start_time => fnd_date.canonical_to_date (p_start_period),
5211 p_stop_time => fnd_date.canonical_to_date (p_end_period) + g_one_day,
5212 p_time_building_block_id => NULL,
5213 p_time_building_block_ovn => NULL,
5214 p_transaction_lock_id => l_lock_trx_id,
5215 p_messages => l_messages,
5216 p_row_lock_id => l_lock_row_id,
5217 p_locked_success => l_tc_lock_boolean
5218 );
5219 END IF;
5220
5221 IF l_lock_row_id IS NOT NULL THEN
5222 -- first insert message in log file if rejected TC is submitted without any change
5223 -- before subm,itting the TC.
5224
5225 IF NVL (l_timecard_status, 'xx') = 'REJECTED' THEN
5226 fnd_file.new_line (fnd_file.LOG, 1);
5227 fnd_message.set_name ('HXC', 'HXC_TK_SUBMIT_UNCHANGED_TC');
5228
5229 IF rej_log_msg IS NULL THEN
5230 rej_log_msg := SUBSTR (fnd_message.get (), 1, 2000);
5231 fnd_file.put_line (fnd_file.LOG, rej_log_msg);
5232 sub_log_msg := NULL;
5233 fnd_file.new_line (fnd_file.LOG, 1);
5234 END IF;
5235
5236 OPEN crs_employee_info (
5237 c_resource.resource_id,
5238 fnd_date.canonical_to_date (p_start_period),
5239 fnd_date.canonical_to_date (p_end_period)
5240 );
5241 FETCH crs_employee_info INTO l_empnumber, l_empname, l_enddate;
5242 /*ADVICE(4551): FETCH into a list of variables instead of a record [204] */
5243
5244 CLOSE crs_employee_info;
5245 fnd_file.put_line (fnd_file.LOG, RTRIM (l_empnumber) || ' - ' || RTRIM (l_empname));
5246 END IF;
5247
5248 l_notify_to :=
5249 hxc_preference_evaluation.resource_preferences (p_timekeeper_id, 'TK_TCARD_CLA', 3, SYSDATE);
5250 l_notify_type :=
5251 hxc_preference_evaluation.resource_preferences (p_timekeeper_id, 'TK_TCARD_CLA', 4, SYSDATE);
5252 l_tk_audit_enabled :=
5253 hxc_preference_evaluation.resource_preferences (p_timekeeper_id, 'TK_TCARD_CLA', 1, SYSDATE);
5254
5255 hxc_timekeeper.submit_timecard (
5256 p_blocks => l_timecard,
5257 p_attributes => l_attributes,
5258 p_messages => p_messages,
5259 p_timecard_id => l_timecard_id,
5260 p_timecard_ovn => l_timecard_ovn,
5261 p_timekeeper_id => p_timekeeper_id,
5262 p_tk_audit_enabled => l_tk_audit_enabled,
5263 p_tk_notify_to => l_notify_to,
5264 p_tk_notify_type => l_notify_type
5265 );
5266 l_relased_success := FALSE;
5267 hxc_lock_api.release_lock (
5268 p_row_lock_id => l_lock_row_id,
5269 p_process_locker_type => l_process_lock_type,
5270 p_transaction_lock_id => l_lock_trx_id,
5271 p_resource_id => NULL,
5272 p_start_time => NULL,
5273 p_stop_time => NULL,
5274 p_time_building_block_id => NULL,
5275 p_time_building_block_ovn => NULL,
5276 p_messages => l_messages,
5277 p_released_success => l_relased_success
5278 );
5279 ELSE
5280 --put message in log file as it is not locked
5281 OPEN crs_employee_info (
5282 c_resource.resource_id,
5283 fnd_date.canonical_to_date (p_start_period),
5284 fnd_date.canonical_to_date (p_end_period)
5285 );
5286 FETCH crs_employee_info INTO l_empnumber, l_empname, l_enddate;
5287 /*ADVICE(4595): FETCH into a list of variables instead of a record [204] */
5288
5289 CLOSE crs_employee_info;
5290 fnd_file.new_line (fnd_file.LOG, 1);
5291 fnd_message.set_name ('HXC', 'HXC_TIMECARD_LOCKED');
5292 fnd_message.set_token ('FULL_NAME', l_empname);
5293 lock_log_msg := SUBSTR (fnd_message.get (), 1, 2000);
5294 fnd_file.put_line (fnd_file.LOG, lock_log_msg);
5295 lock_log_msg := NULL;
5296 END IF;
5297 END IF;
5298 END IF;
5299
5300 sp_index := spemp_tc_list.NEXT (sp_index);
5301 END LOOP;
5302 /*ADVICE(4610): Nested LOOPs should all be labeled [406] */
5303 COMMIT;
5304
5305 END LOOP;
5306
5307 g_submit := FALSE;
5308 END;
5309
5310
5311 -------------------------------------------------------------------------------
5312 -- this procedure create the timecard - day structure for a resource_id
5313 -- and a period of time
5314 -------------------------------------------------------------------------------
5315
5316 PROCEDURE create_timecard_day_structure (
5317 p_resource_id IN NUMBER,
5318 p_start_period IN DATE,
5319 p_end_period IN DATE,
5320 p_tc_frdt
5321 /*ADVICE(4629): Unreferenced parameter [552] */
5322 IN DATE,
5323 p_tc_todt
5324 /*ADVICE(4632): Unreferenced parameter [552] */
5325 IN DATE,
5326 p_timecard IN OUT NOCOPY hxc_block_table_type,
5327 p_attributes IN OUT NOCOPY hxc_attribute_table_type,
5328 p_day_id_info_table OUT NOCOPY t_day_id_info_table,
5329 p_approval_style_id OUT NOCOPY NUMBER,
5330 p_approval_status OUT NOCOPY VARCHAR2,
5331 p_comment_text IN VARCHAR2,
5332 p_timecard_status OUT NOCOPY VARCHAR2,
5333 p_attribute_index_info IN OUT NOCOPY hxc_timekeeper_process.t_attribute_index_info,
5334 p_timecard_index_info IN OUT NOCOPY hxc_timekeeper_process.t_timecard_index_info,
5335 p_timecard_id OUT NOCOPY NUMBER
5336 ) IS
5337 CURSOR c_timecard_info (
5338 p_resource_id
5339 /*ADVICE(4647): This definition hides another one [556] */
5340 IN NUMBER,
5341 p_start_period
5342 /*ADVICE(4650): This definition hides another one [556] */
5343 IN DATE,
5344 p_end_period
5345 /*ADVICE(4653): This definition hides another one [556] */
5346 IN DATE
5347 ) IS
5348 SELECT time_building_block_id, object_version_number, date_to, date_from, approval_style_id,
5349 approval_status, comment_text,application_set_id
5350 FROM hxc_time_building_blocks
5351 WHERE resource_id = p_resource_id
5352 AND SCOPE = 'TIMECARD'
5353 AND date_to = hr_general.end_of_time
5354 AND start_time = p_start_period
5355 AND stop_time = p_end_period;
5356
5357 CURSOR c_day_info (
5358 p_resource_id
5359 /*ADVICE(4667): This definition hides another one [556] */
5360 IN NUMBER,
5361 p_start_period
5362 /*ADVICE(4670): This definition hides another one [556] */
5363 IN DATE,
5364 p_end_period
5365 /*ADVICE(4673): This definition hides another one [556] */
5366 IN DATE,
5367 p_parent_building_block_id IN NUMBER,
5368 p_parent_ovn IN NUMBER
5369 ) IS
5370 SELECT time_building_block_id, object_version_number, date_to, date_from,application_set_id
5371 FROM hxc_time_building_blocks
5372 WHERE resource_id = p_resource_id
5373 AND parent_building_block_id = p_parent_building_block_id
5374 AND parent_building_block_ovn = p_parent_ovn
5375 AND date_to = hr_general.end_of_time
5376 AND SCOPE = 'DAY'
5377 AND start_time = p_start_period
5378 AND stop_time = p_end_period;
5379
5380 CURSOR c_detail_info (
5381 p_resource_id
5382 /*ADVICE(4690): This definition hides another one [556] */
5383 IN NUMBER,
5384 p_parent_building_block_id IN NUMBER,
5385 p_parent_ovn IN NUMBER
5386 ) IS
5387 SELECT time_building_block_id detail_id, object_version_number detail_ovn, measure, date_to,
5388 date_from, start_time, stop_time, comment_text,application_set_id
5389 FROM hxc_time_building_blocks
5390 WHERE resource_id = p_resource_id
5391 AND parent_building_block_id = p_parent_building_block_id
5392 AND parent_building_block_ovn = p_parent_ovn
5393 AND date_to = hr_general.end_of_time
5394 AND SCOPE = 'DETAIL';
5395
5396 l_find_day_also BOOLEAN := TRUE;
5397 l_index_day NUMBER
5398 /*ADVICE(4706): NUMBER has no precision [315] */
5399 := 0;
5400 l_index
5401 /*ADVICE(4709): Unreferenced variable [553] */
5402 NUMBER
5403 /*ADVICE(4711): NUMBER has no precision [315] */
5404 ;
5405 l_timecard_id NUMBER
5406 /*ADVICE(4714): NUMBER has no precision [315] */
5407 := NULL;
5408 /*ADVICE(4716): Initialization to NULL is superfluous [417] */
5409
5410 l_timecard_ovn NUMBER
5411 /*ADVICE(4719): NUMBER has no precision [315] */
5412 := NULL;
5413 /*ADVICE(4721): Initialization to NULL is superfluous [417] */
5414
5415 l_timecard_comment_text VARCHAR2 (2000) := NULL;
5416 /*ADVICE(4724): VARCHAR2 declaration with length greater than 500 characters [307] */
5417
5418 /*ADVICE(4726): Initialization to NULL is superfluous [417] */
5419
5420 l_day_id NUMBER
5421 /*ADVICE(4729): NUMBER has no precision [315] */
5422 := 0;
5423 l_day_ovn NUMBER
5424 /*ADVICE(4732): NUMBER has no precision [315] */
5425 := NULL;
5426 /*ADVICE(4734): Initialization to NULL is superfluous [417] */
5427
5428 l_date_to DATE;
5429 l_date_from DATE;
5430 l_day_date_from DATE;
5431 l_day_date_to DATE;
5432 l_emp_negpref VARCHAR2 (150);
5433 l_emp_recpref NUMBER
5434 /*ADVICE(4742): NUMBER has no precision [315] */
5435 ;
5436 l_emp_appstyle NUMBER
5437 /*ADVICE(4745): NUMBER has no precision [315] */
5438 ;
5439 l_emp_layout1 NUMBER
5440 /*ADVICE(4748): NUMBER has no precision [315] */
5441 ;
5442 l_emp_layout2 NUMBER
5443 /*ADVICE(4751): NUMBER has no precision [315] */
5444 ;
5445 l_emp_layout3 NUMBER
5446 /*ADVICE(4754): NUMBER has no precision [315] */
5447 ;
5448 l_emp_layout4 NUMBER
5449 /*ADVICE(4757): NUMBER has no precision [315] */
5450 ;
5451 l_emp_layout5 NUMBER
5452 /*ADVICE(4760): NUMBER has no precision [315] */
5453 ;
5454 l_emp_layout6 NUMBER
5455 /*ADVICE(4763): NUMBER has no precision [315] */
5456 ;
5457 l_emp_layout7 NUMBER
5458 /*ADVICE(4766): NUMBER has no precision [315] */
5459 ;
5460 l_emp_layout8 NUMBER
5461 /*ADVICE(4769): NUMBER has no precision [315] */
5462 ;
5463 l_emp_edits VARCHAR2 (150);
5464 l_pastdt VARCHAR2 (30);
5465 l_futuredt VARCHAR2 (30);
5466 l_pref_table
5467 /*ADVICE(4775): Unreferenced variable [553] */
5468 hxc_preference_evaluation.t_pref_table;
5469 l_timecard_status VARCHAR2 (10);
5470 l_emp_start_date DATE;
5471 l_emp_terminate_date DATE;
5472 l_audit_enabled VARCHAR2 (150);
5473 l_application_set_id hxc_time_building_blocks.application_set_id%type:=NULL;
5474 l_day_changed VARCHAR2(1):='N';
5475 l_timecard_changed VARCHAR2(1):='N';
5476 BEGIN
5477 g_debug :=hr_utility.debug_enabled;
5478 -- check if the resource_id has already an timecard for the
5479 -- period.
5480
5481 OPEN c_timecard_info (p_resource_id, p_start_period, p_end_period + g_one_day);
5482 FETCH c_timecard_info INTO l_timecard_id,
5483 l_timecard_ovn,
5484 l_date_to,
5485 l_date_from,
5486 p_approval_style_id,
5487 p_approval_status,
5488 l_timecard_comment_text,
5489 l_application_set_id;
5490 /*ADVICE(4793): FETCH into a list of variables instead of a record [204] */
5491
5492 CLOSE c_timecard_info;
5493
5494 IF NOT g_submit THEN
5495 l_timecard_comment_text := p_comment_text;
5496 END IF;
5497
5498 ---store the employee preferences
5499 l_emp_negpref := NULL;
5500 l_emp_recpref := NULL;
5501 l_emp_appstyle := NULL;
5502 l_emp_layout1 := NULL;
5503 l_emp_layout2 := NULL;
5504 l_emp_layout3 := NULL;
5505 l_emp_layout4 := NULL;
5506 l_emp_layout5 := NULL;
5507 l_emp_layout6 := NULL;
5508 l_emp_layout7 := NULL;
5509 l_emp_layout8 := NULL;
5510 l_emp_edits := NULL;
5511 l_audit_enabled := NULL;
5512
5513 -- let's get the resource preference
5514 -- we need to reset the approval style all the time.
5515 hxc_timekeeper_utilities.get_emp_pref (
5516 p_resource_id => p_resource_id,
5517 neg_pref => l_emp_negpref,
5518 recpref => l_emp_recpref,
5519 appstyle => l_emp_appstyle,
5520 layout1 => l_emp_layout1,
5521 layout2 => l_emp_layout2,
5522 layout3 => l_emp_layout3,
5523 layout4 => l_emp_layout4,
5524 layout5 => l_emp_layout5,
5525 layout6 => l_emp_layout6,
5526 layout7 => l_emp_layout7,
5527 layout8 => l_emp_layout8,
5528 edits => l_emp_edits,
5529 l_pastdate => l_pastdt,
5530 l_futuredate => l_futuredt,
5531 l_emp_start_date => l_emp_start_date,
5532 l_emp_terminate_date =>l_emp_terminate_date,
5533 l_audit_enabled => l_audit_enabled
5534 );
5535 if g_debug then
5536 hr_utility.TRACE ('_audit_enabled'|| l_audit_enabled);
5537 end if;
5538
5539 p_approval_style_id := l_emp_appstyle;
5540
5541 -- if the timecard_id is null then we need to generate one
5542 IF l_timecard_id IS NULL then
5543 g_negative_index := g_negative_index - 1;
5544 l_timecard_id := g_negative_index;
5545 l_date_to := hr_general.end_of_time;
5546 l_date_from := SYSDATE;
5547 l_timecard_ovn := 1; --added for new deposit_wrapper null;
5548 l_find_day_also := FALSE;
5549 -- we will need to create the required attributes on the timecard as LAYOUT....
5550 -- first we need to find the approval_style_id and the layout information
5551 -- attached to user the preference.
5552
5553 g_negative_index := g_negative_index - 1;
5554
5555 --
5556 hxc_timekeeper_utilities.add_attribute (
5557 p_attribute => p_attributes,
5558 p_attribute_id => g_negative_index,
5559 p_tbb_id => l_timecard_id,
5560 p_tbb_ovn => l_timecard_ovn,
5561 p_blk_type => 'LAYOUT',
5562 p_blk_id => hxc_alias_utility.get_bld_blk_type_id ('LAYOUT'),
5563 p_att_category => 'LAYOUT',
5564 p_att_1 => l_emp_layout1,
5565 p_att_2 => l_emp_layout2,
5566 p_att_3 => l_emp_layout3,
5567 p_att_4 => l_emp_layout4,
5568 p_att_5 => l_emp_layout5,
5569 p_att_6 => l_emp_layout6,
5570 p_att_7 => l_emp_layout7,
5571 p_att_8 => l_emp_layout8,
5572 p_attribute_index_info => p_attribute_index_info
5573 );
5574 p_timecard_status := NULL;
5575 ELSE
5576 -- if the timecard is not null then we create the all attributes table
5577
5578 IF g_submit THEN
5579 l_timecard_status :=
5580 hxc_timecard_search_pkg.get_timecard_status_code (l_timecard_id, l_timecard_ovn);
5581 p_timecard_status := l_timecard_status;
5582 END IF;
5583
5584 hxc_timekeeper_utilities.create_attribute_structure (
5585 p_timecard_id => l_timecard_id,
5586 p_timecard_ovn => l_timecard_ovn,
5587 p_resource_id => p_resource_id,
5588 p_start_period => p_start_period,
5589 p_end_period => p_end_period,
5590 p_attributes => p_attributes,
5591 p_add_hours_type_id => NULL,
5592 p_attribute_index_info => p_attribute_index_info
5593 );
5594 END IF;
5595
5596 p_timecard_id := l_timecard_id;
5597 -- create the timecard block
5598 /* start of fix for 5398047 */
5599 if (not g_submit ) and p_approval_status = 'WORKING' then
5600 l_timecard_changed:='N';
5601 else
5602 l_timecard_changed:='Y';
5603 end if;
5604 /* end of fix for 5398047 */
5605 hxc_timekeeper_utilities.add_block (
5606 p_timecard => p_timecard,
5607 p_timecard_id => l_timecard_id,
5608 p_ovn => l_timecard_ovn,
5609 p_parent_id => NULL,
5610 p_parent_ovn => NULL,
5611 p_approval_style_id => p_approval_style_id,
5612 p_measure => NULL,
5613 p_scope => 'TIMECARD',
5614 p_date_to => l_date_to,
5615 p_date_from => l_date_from,
5616 p_start_period => p_start_period,
5617 p_end_period => p_end_period + g_one_day,
5618 p_resource_id => p_resource_id,
5619 p_changed => l_timecard_changed,
5620 p_comment_text => l_timecard_comment_text,
5621 p_submit_flg => g_submit,
5622 p_application_set_id => l_application_set_id,
5623 p_timecard_index_info => p_timecard_index_info
5624 );
5625
5626 -- create the day block
5627 WHILE p_start_period + l_index_day <= p_end_period
5628 /*ADVICE(4917): Complex expression not fully parenthesized [404] */
5629 LOOP
5630 -- create a day block
5631 -- first check if the the day already exists
5632
5633 IF l_find_day_also THEN
5634 OPEN c_day_info (
5635 p_resource_id,
5636 p_start_period + l_index_day,
5637 p_start_period + l_index_day + g_one_day,
5638 l_timecard_id,
5639 l_timecard_ovn
5640 );
5641 FETCH c_day_info INTO l_day_id, l_day_ovn, l_day_date_to, l_day_date_from,l_application_set_id;
5642 /*ADVICE(4931): FETCH into a list of variables instead of a record [204] */
5643
5644
5645 IF c_day_info%NOTFOUND THEN
5646 g_negative_index := g_negative_index - 1;
5647 l_day_date_to := hr_general.end_of_time;
5648 l_day_date_from := SYSDATE;
5649 l_day_id := g_negative_index;
5650 l_day_ovn := 1;
5651 END IF;
5652
5653 CLOSE c_day_info;
5654 ELSE
5655 g_negative_index := g_negative_index - 1;
5656 l_day_date_to := hr_general.end_of_time;
5657 l_day_date_from := SYSDATE;
5658 l_day_id := g_negative_index;
5659 l_day_ovn := 1;
5660 END IF;
5661
5662 -- add the day
5663 /* start of fix for 5398047 */
5664 if (not g_submit ) then
5665 l_day_changed:='N';
5666 else
5667 l_day_changed:='Y';
5668 end if;
5669 /* end of fix for 5398047 */
5670 hxc_timekeeper_utilities.add_block (
5671 p_timecard => p_timecard,
5672 p_timecard_id => l_day_id,
5673 p_ovn => l_day_ovn,
5674 p_parent_id => l_timecard_id,
5675 p_parent_ovn => l_timecard_ovn,
5676 p_approval_style_id => p_approval_style_id,
5677 p_measure => NULL,
5678 p_scope => 'DAY',
5679 p_date_to => l_day_date_to,
5680 p_date_from => l_day_date_from,
5681 p_start_period => p_start_period + l_index_day,
5682 p_end_period => p_start_period + l_index_day + g_one_day,
5683 p_resource_id => p_resource_id,
5684 p_changed => l_day_changed,
5685 p_comment_text => NULL,
5686 p_submit_flg => g_submit,
5687 p_application_set_id => l_application_set_id,
5688 p_timecard_index_info => p_timecard_index_info
5689 );
5690
5691 -- add the detail now
5692 IF l_day_id > 0 THEN
5693 FOR detail_info IN c_detail_info (p_resource_id, l_day_id, l_day_ovn) LOOP
5694 -- add the detail
5695 hxc_timekeeper_utilities.add_block (
5696 p_timecard => p_timecard,
5697 p_timecard_id => detail_info.detail_id,
5698 p_ovn => detail_info.detail_ovn,
5699 p_parent_id => l_day_id,
5700 p_parent_ovn => l_day_ovn,
5701 p_approval_style_id => p_approval_style_id,
5702 p_measure => detail_info.measure,
5703 p_scope => 'DETAIL',
5704 p_date_to => detail_info.date_to,
5705 p_date_from => detail_info.date_from,
5706 p_start_period => detail_info.start_time,
5707 p_end_period => detail_info.stop_time,
5708 p_resource_id => p_resource_id,
5709 p_changed => 'Y',
5710 p_comment_text => detail_info.comment_text,
5711 p_submit_flg => g_submit,
5712 p_application_set_id => detail_info.application_set_id,
5713 p_timecard_index_info => p_timecard_index_info
5714 );
5715 END LOOP;
5716 /*ADVICE(4996): Nested LOOPs should all be labeled [406] */
5717
5718 END IF;
5719
5720 p_day_id_info_table (l_index_day).day_id := l_day_id;
5721 p_day_id_info_table (l_index_day).day_ovn := l_day_ovn;
5722 -- increment the l_index_day of one
5723 l_index_day := l_index_day + 1;
5724 END LOOP; --day block while loop
5725 END create_timecard_day_structure;
5726
5727
5728 -------------------------------------------------------------------------------
5729 -- this procedure create the detail-attribute information for an existing
5730 -- timecard structure
5731 -------------------------------------------------------------------------------
5732
5733 PROCEDURE create_detail_structure (
5734 p_timekeeper_id IN NUMBER,
5735 p_att_tab IN hxc_alias_utility.t_alias_att_info,
5736 p_resource_id IN NUMBER,
5737 p_start_period IN DATE,
5738 p_end_period IN DATE,
5739 p_tc_frdt IN DATE,
5740 p_tc_todt
5741 /*ADVICE(5021): Unreferenced parameter [552] */
5742 IN DATE,
5743 p_insert_detail IN hxc_timekeeper_process.t_time_info,
5744 p_timecard IN OUT NOCOPY hxc_block_table_type,
5745 p_attributes IN OUT NOCOPY hxc_attribute_table_type,
5746 p_day_id_info_table IN hxc_timekeeper_process.t_day_id_info_table,
5747 p_approval_style_id IN NUMBER,
5748 p_attribute_index_info IN OUT NOCOPY hxc_timekeeper_process.t_attribute_index_info,
5749 p_timecard_index_info IN OUT NOCOPY hxc_timekeeper_process.t_timecard_index_info,
5750 p_timecard_id IN NUMBER,
5751 p_mid_save IN OUT NOCOPY VARCHAR2,
5752 p_comment_made_null IN OUT NOCOPY BOOLEAN,
5753 p_row_lock_id OUT NOCOPY ROWID,
5754 p_tk_audit_enabled IN VARCHAR2
5755 ) IS
5756 l_index_day NUMBER
5757 /*ADVICE(5036): NUMBER has no precision [315] */
5758 := 0;
5759 l_measure NUMBER
5760 /*ADVICE(5039): NUMBER has no precision [315] */
5761 := NULL;
5762 /*ADVICE(5041): Initialization to NULL is superfluous [417] */
5763
5764 l_detail_id hxc_time_building_blocks.time_building_block_id%TYPE := 0;
5765 l_detail_ovn NUMBER
5766 /*ADVICE(5045): NUMBER has no precision [315] */
5767 := 0;
5768 l_detail_time_in DATE;
5769 l_detail_time_out DATE;
5770 l_detail_comment_text VARCHAR2 (2000) := NULL;
5771 /*ADVICE(5050): VARCHAR2 declaration with length greater than 500 characters [307] */
5772
5773 /*ADVICE(5052): Initialization to NULL is superfluous [417] */
5774
5775 l_detail_old_comment_text VARCHAR2 (2000);
5776 /*ADVICE(5055): VARCHAR2 declaration with length greater than 500 characters [307] */
5777
5778 l_attribute_index NUMBER
5779 /*ADVICE(5058): NUMBER has no precision [315] */
5780 ;
5781 l_att_string VARCHAR2 (100);
5782 l_action VARCHAR2 (80);
5783 l_index_next
5784 /*ADVICE(5063): Unreferenced variable [553] */
5785 NUMBER
5786 /*ADVICE(5065): NUMBER has no precision [315] */
5787 ;
5788 l_index_start
5789 /*ADVICE(5068): Unreferenced variable [553] */
5790 NUMBER
5791 /*ADVICE(5070): NUMBER has no precision [315] */
5792 ;
5793 l_result
5794 /*ADVICE(5073): Unreferenced variable [553] */
5795 VARCHAR2 (10);
5796 l_tbb_id_reference_table hxc_alias_utility.t_tbb_id_reference;
5797 n
5798 /*ADVICE(5077): Unreferenced variable [553] */
5799 NUMBER
5800 /*ADVICE(5079): NUMBER has no precision [315] */
5801 := 0;
5802 valid_att_cat VARCHAR2 (2000) := NULL;
5803 /*ADVICE(5082): VARCHAR2 declaration with length greater than 500 characters [307] */
5804
5805 /*ADVICE(5084): Initialization to NULL is superfluous [417] */
5806
5807 l_add_index_day NUMBER
5808 /*ADVICE(5087): NUMBER has no precision [315] */
5809 := 0;
5810 bldtyp_id NUMBER
5811 /*ADVICE(5090): NUMBER has no precision [315] */
5812 ;
5813 reason_bldtyp_id NUMBER
5814 /*ADVICE(5093): NUMBER has no precision [315] */
5815 ;
5816 l_old_attribute_value VARCHAR2 (150);
5817 l_new_attribute_value VARCHAR2 (150);
5818 l_application_set_id hxc_time_building_blocks.application_set_id%type:=NULL;
5819
5820 CURSOR c_detail (
5821 p_detailid IN NUMBER
5822 ) IS
5823 SELECT *
5824 FROM hxc_tk_detail_temp
5825 WHERE detailid = p_detailid;
5826
5827 CURSOR c_timecard_info (
5828 p_resource_id
5829 /*ADVICE(5107): This definition hides another one [556] */
5830 IN NUMBER,
5831 p_start_period
5832 /*ADVICE(5110): This definition hides another one [556] */
5833 IN DATE,
5834 p_end_period
5835 /*ADVICE(5113): This definition hides another one [556] */
5836 IN DATE
5837 ) IS
5838 SELECT comment_text
5839 FROM hxc_time_building_blocks
5840 WHERE resource_id = p_resource_id
5841 AND SCOPE = 'TIMECARD'
5842 AND date_to = hr_general.end_of_time
5843 AND start_time = p_start_period
5844 AND stop_time = p_end_period;
5845
5846 c_row hxc_tk_detail_temp%ROWTYPE;
5847
5848 l_detail_reason_category VARCHAR2 (150);
5849 l_detail_reason_att_1 VARCHAR2 (150);
5850 l_detail_reason_att_2 VARCHAR2 (150);
5851 l_detail_reason_att_3 VARCHAR2 (150);
5852 l_detail_reason_att_4 VARCHAR2 (150);
5853 l_detail_reason_att_5 VARCHAR2 (150);
5854 l_detail_reason_att_6 VARCHAR2 (150);
5855 l_detail_reason_att_7 VARCHAR2 (150);
5856
5857 l_detail_old_reason_category VARCHAR2 (150);
5858 l_detail_old_reason_att_1 VARCHAR2 (150);
5859 l_detail_old_reason_att_2 VARCHAR2 (150);
5860 l_detail_old_reason_att_3 VARCHAR2 (150);
5861 l_detail_old_reason_att_4 VARCHAR2 (150);
5862 l_detail_old_reason_att_5 VARCHAR2 (150);
5863 l_detail_old_reason_att_6 VARCHAR2 (150);
5864 l_detail_old_reason_att_7 VARCHAR2 (150);
5865
5866 l_detail_dff_category VARCHAR2 (150);
5867 l_detail_att_1 VARCHAR2 (150);
5868 l_detail_att_2 VARCHAR2 (150);
5869 l_detail_att_3 VARCHAR2 (150);
5870 l_detail_att_4 VARCHAR2 (150);
5871 l_detail_att_5 VARCHAR2 (150);
5872 l_detail_att_6 VARCHAR2 (150);
5873 l_detail_att_7 VARCHAR2 (150);
5874 l_detail_att_8 VARCHAR2 (150);
5875 l_detail_att_9 VARCHAR2 (150);
5876 l_detail_att_10 VARCHAR2 (150);
5877 l_detail_att_11 VARCHAR2 (150);
5878 l_detail_att_12 VARCHAR2 (150);
5879 l_detail_att_13 VARCHAR2 (150);
5880 l_detail_att_14 VARCHAR2 (150);
5881 l_detail_att_15 VARCHAR2 (150);
5882 l_detail_att_16 VARCHAR2 (150);
5883 l_detail_att_17 VARCHAR2 (150);
5884 l_detail_att_18 VARCHAR2 (150);
5885 l_detail_att_19 VARCHAR2 (150);
5886 l_detail_att_20 VARCHAR2 (150);
5887 l_detail_att_21 VARCHAR2 (150);
5888 l_detail_att_22 VARCHAR2 (150);
5889 l_detail_att_23 VARCHAR2 (150);
5890 l_detail_att_24 VARCHAR2 (150);
5891 l_detail_att_25 VARCHAR2 (150);
5892 l_detail_att_26 VARCHAR2 (150);
5893 l_detail_att_27 VARCHAR2 (150);
5894 l_detail_att_28 VARCHAR2 (150);
5895 l_detail_att_29 VARCHAR2 (150);
5896 l_detail_att_30 VARCHAR2 (150);
5897
5898 l_detail_dff_old_category VARCHAR2 (150);
5899 l_detail_old_att_1 VARCHAR2 (150);
5900 l_detail_old_att_2 VARCHAR2 (150);
5901 l_detail_old_att_3 VARCHAR2 (150);
5902 l_detail_old_att_4 VARCHAR2 (150);
5903 l_detail_old_att_5 VARCHAR2 (150);
5904 l_detail_old_att_6 VARCHAR2 (150);
5905 l_detail_old_att_7 VARCHAR2 (150);
5906 l_detail_old_att_8 VARCHAR2 (150);
5907 l_detail_old_att_9 VARCHAR2 (150);
5908 l_detail_old_att_10 VARCHAR2 (150);
5909 l_detail_old_att_11 VARCHAR2 (150);
5910 l_detail_old_att_12 VARCHAR2 (150);
5911 l_detail_old_att_13 VARCHAR2 (150);
5912 l_detail_old_att_14 VARCHAR2 (150);
5913 l_detail_old_att_15 VARCHAR2 (150);
5914 l_detail_old_att_16 VARCHAR2 (150);
5915 l_detail_old_att_17 VARCHAR2 (150);
5916 l_detail_old_att_18 VARCHAR2 (150);
5917 l_detail_old_att_19 VARCHAR2 (150);
5918 l_detail_old_att_20 VARCHAR2 (150);
5919 l_detail_old_att_21 VARCHAR2 (150);
5920 l_detail_old_att_22 VARCHAR2 (150);
5921 l_detail_old_att_23 VARCHAR2 (150);
5922 l_detail_old_att_24 VARCHAR2 (150);
5923 l_detail_old_att_25 VARCHAR2 (150);
5924 l_detail_old_att_26 VARCHAR2 (150);
5925 l_detail_old_att_27 VARCHAR2 (150);
5926 l_detail_old_att_28 VARCHAR2 (150);
5927 l_detail_old_att_29 VARCHAR2 (150);
5928 l_detail_old_att_30 VARCHAR2 (150);
5929
5930 l_detail_info_found BOOLEAN := FALSE;
5931 l_attribute_found BOOLEAN := FALSE;
5932
5933 l_reason_info_found BOOLEAN := FALSE;
5934 l_cla_attribute_changed BOOLEAN := FALSE;
5935
5936 l_detail_dff_found BOOLEAN := FALSE;
5937 l_detail_dff_changed BOOLEAN := FALSE;
5938
5939 l_timecard_comment_text VARCHAR2 (2000);
5940 /*ADVICE(5235): VARCHAR2 declaration with length greater than 500 characters [307] */
5941
5942 l_block_index NUMBER
5943 /*ADVICE(5238): NUMBER has no precision [315] */
5944 ;
5945 l_detail_changed VARCHAR2(1);
5946
5947 BEGIN
5948 g_debug :=hr_utility.debug_enabled;
5949
5950 /*JOEL MUST CACHE THIS INFORMATION */
5951 BEGIN
5952 SELECT bld_blk_info_type_id
5953 INTO bldtyp_id
5954 FROM hxc_bld_blk_info_types
5955 WHERE bld_blk_info_type = 'Dummy Paexpitdff Context';
5956 EXCEPTION
5957 WHEN OTHERS THEN
5958 NULL;
5959 /*ADVICE(5377): Use of NULL statements [532] */
5960
5961 /*ADVICE(5379): Exception masked by a NULL statement [533] */
5962
5963 /*ADVICE(5381): A WHEN OTHERS clause is used in the exception section without any other specific handlers
5964 [201] */
5965
5966 END;
5967
5968 BEGIN
5969 SELECT bld_blk_info_type_id
5970 INTO reason_bldtyp_id
5971 FROM hxc_bld_blk_info_types
5972 WHERE bld_blk_info_type = 'REASON';
5973 EXCEPTION
5974 WHEN OTHERS THEN
5975 NULL;
5976
5977 END ;
5978
5979 -- added to handle comment 2789497
5980 IF NVL (p_insert_detail.timecard_start_period, p_start_period) = p_start_period
5981 OR NVL (p_insert_detail.timecard_end_period, p_end_period) = p_end_period THEN
5982 p_mid_save := 'Y';
5983 p_row_lock_id := CHARTOROWID (p_insert_detail.row_lock_id);
5984
5985 IF p_insert_detail.timekeeper_action = 'INSERT' AND p_insert_detail.comment_text IS NULL THEN
5986 IF p_timecard_index_info.EXISTS (p_timecard_id) THEN
5987 l_block_index := p_timecard_index_info (p_timecard_id).time_block_row_index;
5988 OPEN c_timecard_info (p_resource_id, p_start_period, p_end_period + g_one_day);
5989 FETCH c_timecard_info INTO l_timecard_comment_text;
5990 CLOSE c_timecard_info;
5991
5992 IF p_comment_made_null THEN
5993 l_timecard_comment_text := NULL;
5994 END IF;
5995
5996 p_timecard (l_block_index).comment_text :=
5997 NVL (p_timecard (l_block_index).comment_text, l_timecard_comment_text);
5998 END IF;
5999 ELSE
6000 IF p_timecard_index_info.EXISTS (p_timecard_id) THEN
6001 l_block_index := p_timecard_index_info (p_timecard_id).time_block_row_index;
6002 p_timecard (l_block_index).comment_text := p_insert_detail.comment_text;
6003
6004 IF p_insert_detail.comment_text IS NULL THEN
6005 p_comment_made_null := TRUE;
6006 END IF;
6007 END IF;
6008 END IF;
6009
6010
6011 if g_debug then
6012 hr_utility.trace('p_mid_save'||p_mid_save);
6013 end if;
6014 -- get the action on this row
6015 l_action := p_insert_detail.timekeeper_action;
6016
6017 IF l_action = 'INSERT' THEN
6018 p_mid_save := 'N';
6019 END IF;
6020
6021
6022 -- end 2789497
6023
6024 -- get the attribute category as base for Details
6025 valid_att_cat :=
6026 hxc_timekeeper_utilities.get_tk_dff_attrname (
6027 p_tkid => p_timekeeper_id,
6028 p_insert_detail => p_insert_detail,
6029 p_base_dff => hxc_timekeeper_process.g_base_att,
6030 p_att_tab => p_att_tab
6031 );
6032 if g_debug then
6033 hr_utility.TRACE ('Attribute category is '|| valid_att_cat);
6034 end if;
6035
6036 --
6037
6038 IF l_action = 'UPDATE' THEN -- create the tbb_id table reference
6039 -- for each time_building_block_id let create a reference attribute_id table
6040 hxc_alias_utility.get_tbb_id_reference_table (
6041 p_attributes => p_attributes,
6042 p_tbb_id_reference_table => l_tbb_id_reference_table
6043 );
6044 END IF;
6045
6046 IF p_tc_frdt <> p_start_period THEN
6047 l_add_index_day := (trunc(p_start_period) - trunc(p_tc_frdt));
6048 ELSE
6049 l_add_index_day := 0;
6050 END IF;
6051 -- we are going the all table by looping all day of the
6052 -- period
6053 WHILE p_start_period + l_index_day <= p_end_period
6054 /*ADVICE(5316): Complex expression not fully parenthesized [404] */
6055 LOOP
6056 -- reset the variables
6057 l_measure := NULL;
6058 l_detail_id := NULL;
6059 l_detail_ovn := NULL;
6060 l_att_string := NULL;
6061 l_detail_time_in := NULL;
6062 l_detail_time_out := NULL;
6063
6064 l_detail_info_found := FALSE;
6065 l_reason_info_found := FALSE;
6066
6067 l_detail_reason_category := NULL;
6068 l_detail_reason_att_1 := NULL;
6069 l_detail_reason_att_2 := NULL;
6070 l_detail_reason_att_3 := NULL;
6071 l_detail_reason_att_4 := NULL;
6072 l_detail_reason_att_5 := NULL;
6073 l_detail_reason_att_6 := NULL;
6074 l_detail_reason_att_7 := NULL;
6075
6076 l_detail_old_reason_category := NULL;
6077 l_detail_old_reason_att_1 := NULL;
6078 l_detail_old_reason_att_2 := NULL;
6079 l_detail_old_reason_att_3 := NULL;
6080 l_detail_old_reason_att_4 := NULL;
6081 l_detail_old_reason_att_5 := NULL;
6082 l_detail_old_reason_att_6 := NULL;
6083 l_detail_old_reason_att_7 := NULL;
6084
6085 l_detail_comment_text := NULL;
6086 l_detail_old_comment_text := NULL;
6087
6088 l_detail_dff_category := NULL;
6089 l_detail_att_1 := NULL;
6090 l_detail_att_2 := NULL;
6091 l_detail_att_3 := NULL;
6092 l_detail_att_4 := NULL;
6093 l_detail_att_5 := NULL;
6094 l_detail_att_6 := NULL;
6095 l_detail_att_7 := NULL;
6096 l_detail_att_8 := NULL;
6097 l_detail_att_9 := NULL;
6098 l_detail_att_10 := NULL;
6099 l_detail_att_11 := NULL;
6100 l_detail_att_12 := NULL;
6101 l_detail_att_13 := NULL;
6102 l_detail_att_14 := NULL;
6103 l_detail_att_15 := NULL;
6104 l_detail_att_16 := NULL;
6105 l_detail_att_17 := NULL;
6106 l_detail_att_18 := NULL;
6107 l_detail_att_19 := NULL;
6108 l_detail_att_20 := NULL;
6109 l_detail_att_21 := NULL;
6110 l_detail_att_22 := NULL;
6111 l_detail_att_23 := NULL;
6112 l_detail_att_24 := NULL;
6113 l_detail_att_25 := NULL;
6114 l_detail_att_26 := NULL;
6115 l_detail_att_27 := NULL;
6116 l_detail_att_28 := NULL;
6117 l_detail_att_29 := NULL;
6118 l_detail_att_30 := NULL;
6119
6120 l_detail_dff_old_category := NULL;
6121 l_detail_old_att_1 := NULL;
6122 l_detail_old_att_2 := NULL;
6123 l_detail_old_att_3 := NULL;
6124 l_detail_old_att_4 := NULL;
6125 l_detail_old_att_5 := NULL;
6126 l_detail_old_att_6 := NULL;
6127 l_detail_old_att_7 := NULL;
6128 l_detail_old_att_8 := NULL;
6129 l_detail_old_att_9 := NULL;
6130 l_detail_old_att_10 := NULL;
6131 l_detail_old_att_11 := NULL;
6132 l_detail_old_att_12 := NULL;
6133 l_detail_old_att_13 := NULL;
6134 l_detail_old_att_14 := NULL;
6135 l_detail_old_att_15 := NULL;
6136 l_detail_old_att_16 := NULL;
6137 l_detail_old_att_17 := NULL;
6138 l_detail_old_att_18 := NULL;
6139 l_detail_old_att_19 := NULL;
6140 l_detail_old_att_20 := NULL;
6141 l_detail_old_att_21 := NULL;
6142 l_detail_old_att_22 := NULL;
6143 l_detail_old_att_23 := NULL;
6144 l_detail_old_att_24 := NULL;
6145 l_detail_old_att_25 := NULL;
6146 l_detail_old_att_26 := NULL;
6147 l_detail_old_att_27 := NULL;
6148 l_detail_old_att_28 := NULL;
6149 l_detail_old_att_29 := NULL;
6150 l_detail_old_att_30 := NULL;
6151
6152 -- find the detail information for the current day
6153
6154 hxc_timekeeper_utilities.manage_timeinfo (
6155 p_day_counter => (l_add_index_day + l_index_day),
6156 p_insert_detail => p_insert_detail,
6157 p_measure => l_measure,
6158 p_detail_id => l_detail_id,
6159 p_detail_ovn => l_detail_ovn,
6160 p_detail_time_in => l_detail_time_in,
6161 p_detail_time_out => l_detail_time_out
6162 );
6163
6164 IF p_mid_save = 'N' AND p_insert_detail.timekeeper_action = 'INSERT' THEN
6165 IF l_measure IS NOT NULL OR l_detail_time_in IS NOT NULL OR l_detail_time_out IS NOT NULL THEN
6166 p_mid_save := 'Y';
6167 END IF;
6168 END IF;
6169 if g_debug then
6170 hr_utility.trace('p_mid_save '|| p_mid_save);
6171 end if;
6172
6173
6174 IF l_detail_id IS NOT NULL THEN
6175 if g_debug then
6176 hr_utility.TRACE (' l_detail_id is '|| l_detail_id);
6177 end if;
6178
6179 --
6180
6181 IF c_detail%ISOPEN THEN
6182 CLOSE c_detail;
6183 END IF;
6184
6185 OPEN c_detail (l_detail_id);
6186 FETCH c_detail INTO c_row;
6187
6188 IF c_detail%FOUND THEN
6189
6190 if g_debug then
6191 hr_utility.TRACE (' c_row is found');
6192 end if;
6193
6194
6195
6196 l_detail_info_found := TRUE;
6197
6198 l_detail_comment_text := c_row.comment_text;
6199
6200 l_detail_reason_category := 'REASON';
6201 if g_debug then
6202 hr_utility.TRACE (' c_row.late_change is '|| c_row.late_change);
6203 hr_utility.TRACE (' change_comment '|| c_row.change_comment);
6204 end if;
6205 --
6206 l_detail_reason_att_1 := NULL;
6207 l_detail_reason_att_2 := NULL;
6208 l_detail_reason_att_3 := NULL;
6209 l_detail_reason_att_4 := NULL;-- JOEL c_row.dff_attr4; --left
6210 l_detail_reason_att_5 := NULL; -- JOEL c_row.dff_attr5;
6211 l_detail_reason_att_6 := NULL; ---imp
6212 l_detail_reason_att_7 := NULL;
6213
6214 IF (c_row.late_change = 'LATE') THEN
6215 l_detail_reason_att_1 := c_row.late_reason;
6216 l_detail_reason_att_2 := c_row.late_comment;
6217 l_detail_reason_att_3 := 'LATE';
6218 l_reason_info_found := TRUE;
6219
6220 if g_debug then
6221 hr_utility.TRACE (' l_reason_info_found1 ');
6222 end if;
6223 END IF;
6224
6225 IF (c_row.late_change = 'CHANGE') THEN
6226 l_detail_reason_att_1 := c_row.change_reason;
6227 l_detail_reason_att_2 := c_row.change_comment;
6228 l_detail_reason_att_3 := 'CHANGE';
6229 l_reason_info_found := TRUE;
6230 l_detail_reason_att_6 := c_row.audit_datetime; ---imp
6231 l_detail_reason_att_7 := c_row.audit_history;
6232 if g_debug then
6233 hr_utility.TRACE (' l_reason_info_found2 ');
6234 hr_utility.TRACE (' l_reason_info_found '|| c_row.late_change);
6235 end if;
6236 END IF;
6237
6238 l_detail_reason_att_6 := c_row.audit_datetime; ---imp
6239 l_detail_reason_att_7 := c_row.audit_history;
6240
6241 IF l_detail_reason_att_6 is not null or l_detail_reason_att_7 is not null
6242 THEN
6243 l_reason_info_found := TRUE;
6244 if g_debug then
6245 hr_utility.TRACE (' l_reason_info_found3 ');
6246 end if;
6247 END IF;
6248
6249
6250 if g_debug then
6251 hr_utility.TRACE (' l_detail_id is '|| l_detail_id);
6252 end if;
6253 --
6254 -- new
6255 l_detail_reason_att_4 := null;-- JOEL c_row.dff_attr4; --left
6256 l_detail_reason_att_5 := null; -- JOEL c_row.dff_attr5;
6257
6258 --IF l_reason_info_found THEN
6259 if g_debug then
6260 hr_utility.TRACE ('l_reason_info_found');
6261 end if;
6262 --END IF;
6263
6264
6265 -- JOEL check if the old and new are different,
6266 -- if they are we need to deposit again
6267 l_cla_attribute_changed := FALSE;
6268
6269
6270
6271 IF (c_row.old_late_change = 'LATE') THEN
6272 l_detail_old_reason_att_1 := c_row.old_late_reason;
6273 l_detail_old_reason_att_2 := c_row.old_late_comment;
6274 l_detail_old_reason_att_3 := 'LATE';
6275 END IF;
6276
6277 IF (c_row.old_late_change = 'CHANGE') THEN
6278 l_detail_old_reason_att_1 := c_row.old_change_reason;
6279 l_detail_old_reason_att_2 := c_row.old_change_comment;
6280 l_detail_old_reason_att_3 := 'CHANGE';
6281 END IF;
6282
6283 l_detail_old_reason_att_4 := null;-- JOEL c_row.dff_attr4; --left
6284 l_detail_old_reason_att_5 := null; -- JOELc_row.dff_attr5;
6285 l_detail_old_reason_att_6 := c_row.old_audit_datetime; ---imp
6286 l_detail_old_reason_att_7 := c_row.old_audit_history;
6287
6288 if g_debug then
6289 hr_utility.TRACE (' l_detail_reason_att_1 '||l_detail_reason_att_1);
6290 hr_utility.TRACE (' l_detail_reason_att_2 '||l_detail_reason_att_2);
6291 hr_utility.TRACE (' l_detail_reason_att_3 '||l_detail_reason_att_3);
6292 hr_utility.TRACE (' l_detail_reason_att_4 '||l_detail_reason_att_4);
6293 hr_utility.TRACE (' l_detail_reason_att_5 '||l_detail_reason_att_5);
6294 hr_utility.TRACE (' l_detail_reason_att_6 '||l_detail_reason_att_6);
6295 hr_utility.TRACE (' l_detail_reason_att_7 '||l_detail_reason_att_7);
6296
6297 hr_utility.TRACE (' l_detail_old_reason_att_1 '||l_detail_old_reason_att_1);
6298 hr_utility.TRACE (' l_detail_old_reason_att_2 '||l_detail_old_reason_att_2);
6299 hr_utility.TRACE (' l_detail_old_reason_att_3 '||l_detail_old_reason_att_3);
6300 hr_utility.TRACE (' l_detail_old_reason_att_4 '||l_detail_old_reason_att_4);
6301 hr_utility.TRACE (' l_detail_old_reason_att_5 '||l_detail_old_reason_att_5);
6302 hr_utility.TRACE (' l_detail_old_reason_att_6 '||l_detail_old_reason_att_6);
6303 hr_utility.TRACE (' l_detail_old_reason_att_7 '||l_detail_old_reason_att_7);
6304 end if;
6305 IF ( nvl(l_detail_reason_att_1,'xx') <> nvl(l_detail_old_reason_att_1,'xx')
6306 or nvl(l_detail_reason_att_2,'xx') <> nvl(l_detail_old_reason_att_2,'xx')
6307 or nvl(l_detail_reason_att_3,'xx') <> nvl(l_detail_old_reason_att_3,'xx')
6308 or nvl(l_detail_reason_att_6,'xx') <> nvl(l_detail_old_reason_att_6,'xx')
6309 or nvl(l_detail_reason_att_7,'xx') <> nvl(l_detail_old_reason_att_7,'xx') ) THEN
6310
6311 -- the detail has changed
6312 -- and we need to redeposit it.
6313 l_cla_attribute_changed := TRUE;
6314 if g_debug then
6315 hr_utility.trace('l_cla_attribute_changed');
6316 hr_utility.TRACE (' l_cla_attribute_changed ');
6317 end if;
6318 END IF;
6319
6320 l_detail_dff_found := FALSE;
6321 l_detail_dff_changed := FALSE;
6322
6323 -- new
6324 l_detail_dff_category := c_row.dff_catg;
6325 l_detail_att_1 := c_row.dff_attr1;
6326 l_detail_att_2 := c_row.dff_attr2;
6327 l_detail_att_3 := c_row.dff_attr3;
6328 l_detail_att_4 := c_row.dff_attr4;
6329 l_detail_att_5 := c_row.dff_attr5;
6330 l_detail_att_6 := c_row.dff_attr6;
6331 l_detail_att_7 := c_row.dff_attr7;
6332 l_detail_att_8 := c_row.dff_attr8;
6333 l_detail_att_9 := c_row.dff_attr9;
6334 l_detail_att_10 := c_row.dff_attr10;
6335 l_detail_att_11 := c_row.dff_attr11;
6336 l_detail_att_12 := c_row.dff_attr12;
6337 l_detail_att_13 := c_row.dff_attr13;
6338 l_detail_att_14 := c_row.dff_attr14;
6339 l_detail_att_15 := c_row.dff_attr15;
6340 l_detail_att_16 := c_row.dff_attr16;
6341 l_detail_att_17 := c_row.dff_attr17;
6342 l_detail_att_18 := c_row.dff_attr18;
6343 l_detail_att_19 := c_row.dff_attr19;
6344 l_detail_att_20 := c_row.dff_attr20;
6345 l_detail_att_21 := c_row.dff_attr21;
6346 l_detail_att_22 := c_row.dff_attr22;
6347 l_detail_att_23 := c_row.dff_attr23;
6348 l_detail_att_24 := c_row.dff_attr24;
6349 l_detail_att_25 := c_row.dff_attr25;
6350 l_detail_att_26 := c_row.dff_attr26;
6351 l_detail_att_27 := c_row.dff_attr27;
6352 l_detail_att_28 := c_row.dff_attr28;
6353 l_detail_att_29 := c_row.dff_attr29;
6354 l_detail_att_30 := c_row.dff_attr30;
6355
6356 -- old
6357 l_detail_dff_old_category := c_row.dff_oldcatg;
6358 l_detail_old_att_1 := c_row.dff_oldattr1;
6359 l_detail_old_att_2 := c_row.dff_oldattr2;
6360 l_detail_old_att_3 := c_row.dff_oldattr3;
6361 l_detail_old_att_4 := c_row.dff_oldattr4;
6362 l_detail_old_att_5 := c_row.dff_oldattr5;
6363 l_detail_old_att_6 := c_row.dff_oldattr6;
6364 l_detail_old_att_7 := c_row.dff_oldattr7;
6365 l_detail_old_att_8 := c_row.dff_oldattr8;
6366 l_detail_old_att_9 := c_row.dff_oldattr9;
6367 l_detail_old_att_10 := c_row.dff_oldattr10;
6368 l_detail_old_att_11 := c_row.dff_oldattr11;
6369 l_detail_old_att_12 := c_row.dff_oldattr12;
6370 l_detail_old_att_13 := c_row.dff_oldattr13;
6371 l_detail_old_att_14 := c_row.dff_oldattr14;
6372 l_detail_old_att_15 := c_row.dff_oldattr15;
6373 l_detail_old_att_16 := c_row.dff_oldattr16;
6374 l_detail_old_att_17 := c_row.dff_oldattr17;
6375 l_detail_old_att_18 := c_row.dff_oldattr18;
6376 l_detail_old_att_19 := c_row.dff_oldattr19;
6377 l_detail_old_att_20 := c_row.dff_oldattr20;
6378 l_detail_old_att_21 := c_row.dff_oldattr21;
6379 l_detail_old_att_22 := c_row.dff_oldattr22;
6380 l_detail_old_att_23 := c_row.dff_oldattr23;
6381 l_detail_old_att_24 := c_row.dff_oldattr24;
6382 l_detail_old_att_25 := c_row.dff_oldattr25;
6383 l_detail_old_att_26 := c_row.dff_oldattr26;
6384 l_detail_old_att_27 := c_row.dff_oldattr27;
6385 l_detail_old_att_28 := c_row.dff_oldattr28;
6386 l_detail_old_att_29 := c_row.dff_oldattr29;
6387 l_detail_old_att_30 := c_row.dff_oldattr30;
6388
6389
6390 -- now we can check everything on the dff attributes
6391
6392 -- IF l_detail_id < 0 THEN
6393 --g_detail_data.DELETE (l_detail_id);
6394 -- END IF;
6395
6396 IF (--l_detail_dff_category IS NULL
6397 l_detail_att_1 IS NULL
6398 AND l_detail_att_2 IS NULL
6399 AND l_detail_att_3 IS NULL
6400 AND l_detail_att_4 IS NULL
6401 AND l_detail_att_5 IS NULL
6402 AND l_detail_att_6 IS NULL
6403 AND l_detail_att_7 IS NULL
6404 AND l_detail_att_8 IS NULL
6405 AND l_detail_att_9 IS NULL
6406 AND l_detail_att_10 IS NULL
6407 AND l_detail_att_11 IS NULL
6408 AND l_detail_att_12 IS NULL
6409 AND l_detail_att_13 IS NULL
6410 AND l_detail_att_14 IS NULL
6411 AND l_detail_att_15 IS NULL
6412 AND l_detail_att_16 IS NULL
6413 AND l_detail_att_17 IS NULL
6414 AND l_detail_att_18 IS NULL
6415 AND l_detail_att_19 IS NULL
6416 AND l_detail_att_20 IS NULL
6417 AND l_detail_att_21 IS NULL
6418 AND l_detail_att_22 IS NULL
6419 AND l_detail_att_23 IS NULL
6420 AND l_detail_att_24 IS NULL
6421 AND l_detail_att_25 IS NULL
6422 AND l_detail_att_26 IS NULL
6423 AND l_detail_att_27 IS NULL
6424 AND l_detail_att_28 IS NULL
6425 AND l_detail_att_29 IS NULL
6426 AND l_detail_att_30 IS NULL
6427 ) THEN
6428
6429 l_detail_dff_found := FALSE;
6430 /*ADVICE(5706): Use of NULL statements [532] */
6431 if g_debug then
6432 hr_utility.trace('NOT l_detail_dff_found');
6433 end if;
6434 ELSE
6435 l_detail_dff_found := TRUE;
6436 if g_debug then
6437 hr_utility.trace('l_detail_dff_found');
6438 end if;
6439 END IF;
6440
6441 -- at this point we need to handle the attribute case
6442 IF (l_detail_dff_old_category IS NOT NULL
6443 AND not(l_detail_dff_found)) THEN
6444 -- that mean we need to reset the l_detail_dff_found to TRUE
6445 l_detail_dff_found := TRUE;
6446 if g_debug then
6447 hr_utility.trace('l_detail_dff_found');
6448 end if;
6449 END IF;
6450
6451
6452
6453
6454 IF valid_att_cat IS NOT NULL THEN
6455 IF NVL (valid_att_cat, '-999') <> NVL (l_detail_dff_category, '-999') THEN
6456 l_detail_dff_category := valid_att_cat;
6457 END IF;
6458 -- ELSE
6459 --l_detail_dff_category := l_detail_dff_category;
6460 END IF;
6461 if g_debug then
6462 hr_utility.trace(l_detail_dff_category);
6463 end if;
6464 IF ( (NVL (l_detail_dff_category, '-999') <> NVL (l_detail_dff_old_category, '-999')
6465 OR NVL (l_detail_att_1, '-999') <> NVL (l_detail_old_att_1, '-999')
6466 OR NVL (l_detail_att_2, '-999') <> NVL (l_detail_old_att_2, '-999')
6467 OR NVL (l_detail_att_3, '-999') <> NVL (l_detail_old_att_3, '-999')
6468 OR NVL (l_detail_att_4, '-999') <> NVL (l_detail_old_att_4, '-999')
6469 OR NVL (l_detail_att_5, '-999') <> NVL (l_detail_old_att_5, '-999')
6470 OR NVL (l_detail_att_6, '-999') <> NVL (l_detail_old_att_6, '-999')
6471 OR NVL (l_detail_att_7, '-999') <> NVL (l_detail_old_att_7, '-999')
6472 OR NVL (l_detail_att_8, '-999') <> NVL (l_detail_old_att_8, '-999')
6473 OR NVL (l_detail_att_9, '-999') <> NVL (l_detail_old_att_9, '-999')
6474 OR NVL (l_detail_att_10, '-999') <> NVL (l_detail_old_att_10, '-999')
6475 OR NVL (l_detail_att_11, '-999') <> NVL (l_detail_old_att_11, '-999')
6476 OR NVL (l_detail_att_12, '-999') <> NVL (l_detail_old_att_12, '-999')
6477 OR NVL (l_detail_att_13, '-999') <> NVL (l_detail_old_att_13, '-999')
6478 OR NVL (l_detail_att_14, '-999') <> NVL (l_detail_old_att_14, '-999')
6479 OR NVL (l_detail_att_15, '-999') <> NVL (l_detail_old_att_15, '-999')
6480 OR NVL (l_detail_att_16, '-999') <> NVL (l_detail_old_att_16, '-999')
6481 OR NVL (l_detail_att_17, '-999') <> NVL (l_detail_old_att_17, '-999')
6482 OR NVL (l_detail_att_18, '-999') <> NVL (l_detail_old_att_18, '-999')
6483 OR NVL (l_detail_att_19, '-999') <> NVL (l_detail_old_att_19, '-999')
6484 OR NVL (l_detail_att_20, '-999') <> NVL (l_detail_old_att_20, '-999')
6485 OR NVL (l_detail_att_21, '-999') <> NVL (l_detail_old_att_21, '-999')
6486 OR NVL (l_detail_att_22, '-999') <> NVL (l_detail_old_att_22, '-999')
6487 OR NVL (l_detail_att_23, '-999') <> NVL (l_detail_old_att_23, '-999')
6488 OR NVL (l_detail_att_24, '-999') <> NVL (l_detail_old_att_24, '-999')
6489 OR NVL (l_detail_att_25, '-999') <> NVL (l_detail_old_att_25, '-999')
6490 OR NVL (l_detail_att_26, '-999') <> NVL (l_detail_old_att_26, '-999')
6491 OR NVL (l_detail_att_27, '-999') <> NVL (l_detail_old_att_27, '-999')
6492 OR NVL (l_detail_att_28, '-999') <> NVL (l_detail_old_att_28, '-999')
6493 OR NVL (l_detail_att_29, '-999') <> NVL (l_detail_old_att_29, '-999')
6494 OR NVL (l_detail_att_30, '-999') <> NVL (l_detail_old_att_30, '-999'))
6495 AND l_detail_dff_found
6496 ) THEN
6497 l_detail_dff_changed := TRUE;
6498 if g_debug then
6499 hr_utility.trace('l_detail_dff_changed');
6500 end if;
6501 ELSE
6502 l_detail_dff_changed := FALSE;
6503 if g_debug then
6504 hr_utility.trace('not l_detail_dff_changed');
6505 end if;
6506 END IF;
6507
6508 DELETE FROM hxc_tk_detail_temp
6509 WHERE detailid = l_detail_id;
6510
6511 END IF;
6512
6513 ELSE
6514 if g_debug then
6515 hr_utility.TRACE ('nothign to change');
6516 end if;
6517 l_detail_info_found := FALSE;
6518
6519 END IF;
6520
6521
6522 if g_debug then
6523 hr_utility.trace('l_action'||l_action);
6524 end if;
6525 -- detail block is not changed
6526 l_detail_changed := 'N';
6527
6528 IF l_action = 'QUERY' THEN -- do anything
6529 NULL;
6530 /*ADVICE(5594): Use of NULL statements [532] */
6531
6532 ELSIF l_action = 'INSERT' THEN
6533
6534 -- the easy one just attach the new information on the timecard/attributes structure.
6535 -- add the detail only if the measure has been filled.
6536 IF (l_measure IS NOT NULL OR l_detail_time_in IS NOT NULL OR l_detail_time_out IS NOT NULL) THEN
6537 -- add the detail information.
6538 g_negative_index := g_negative_index - 1;
6539 l_detail_id := g_negative_index;
6540 l_detail_ovn := 1; ---added for new deposit
6541
6542 IF l_detail_time_in > l_detail_time_out THEN
6543 l_detail_time_out := l_detail_time_out + 1;
6544 END IF;
6545
6546 hxc_timekeeper_utilities.add_block (
6547 p_timecard => p_timecard,
6548 p_timecard_id => l_detail_id,
6549 p_ovn => l_detail_ovn,
6550 p_parent_id => p_day_id_info_table (l_index_day).day_id,
6551 p_parent_ovn => p_day_id_info_table (l_index_day).day_ovn,
6552 p_approval_style_id => p_approval_style_id,
6553 p_measure => l_measure,
6554 p_scope => 'DETAIL',
6555 p_date_to => hr_general.end_of_time,
6556 p_date_from => SYSDATE,
6557 p_start_period => l_detail_time_in,
6558 p_end_period => l_detail_time_out,
6559 p_resource_id => p_resource_id,
6560 p_changed => 'Y',
6561 p_comment_text => l_detail_comment_text,
6562 p_submit_flg => g_submit,
6563 p_application_set_id => l_application_set_id,
6564 p_timecard_index_info => p_timecard_index_info
6565 );
6566
6567 -- add the attribute information.
6568
6569 FOR l_index_attribute IN 1 .. 20 LOOP
6570
6571 hxc_timekeeper_utilities.manage_attributes (
6572 p_attribute_number => l_index_attribute,
6573 p_insert_data_details => p_insert_detail,
6574 p_old_value => l_old_attribute_value,
6575 p_new_value => l_new_attribute_value
6576 );
6577
6578 IF (l_new_attribute_value IS NOT NULL)
6579 AND p_att_tab.EXISTS (l_index_attribute) THEN --2786991
6580
6581 hxc_timekeeper_process.g_negative_index := hxc_timekeeper_process.g_negative_index - 1;
6582
6583 hxc_timekeeper_utilities.add_attribute (
6584 p_attribute => p_attributes,
6585 p_attribute_id => hxc_timekeeper_process.g_negative_index,
6586 p_tbb_id => l_detail_id,
6587 p_tbb_ovn => l_detail_ovn,
6588 p_blk_type => 'OTL_ALIAS_ITEM_' || l_index_attribute,
6589 p_blk_id => NULL,
6590 p_att_category => 'OTL_ALIAS_ITEM_' || l_index_attribute,
6591 p_att_1 => l_new_attribute_value,
6592 p_att_2 => p_att_tab (l_index_attribute).alias_definition_id,
6593 p_att_3 => l_old_attribute_value,
6594 p_att_4 => p_att_tab (l_index_attribute).alias_type,
6595 p_attribute_index_info => p_attribute_index_info
6596 );
6597 END IF;
6598 END LOOP;
6599 /*ADVICE(5663): Nested LOOPs should all be labeled [406] */
6600
6601
6602 --add detail info
6603 IF l_detail_info_found and l_detail_dff_found THEN
6604 if g_debug then
6605 hr_utility.TRACE ('DETAILDFFFOUND');
6606 end if;
6607 -- add the dff detail
6608 g_negative_index := g_negative_index - 1;
6609 l_attribute_index := g_negative_index;
6610
6611 hxc_timekeeper_utilities.add_dff_attribute (
6612 p_attribute => p_attributes,
6613 p_attribute_id => g_negative_index,
6614 p_tbb_id => l_detail_id,
6615 p_tbb_ovn => l_detail_ovn,
6616 p_blk_type => 'Dummy Paexpitdff Context',
6617 p_blk_id => bldtyp_id,
6618 p_att_category => l_detail_dff_category,
6619 p_att_1 => l_detail_att_1,
6620 p_att_2 => l_detail_att_2,
6621 p_att_3 => l_detail_att_3,
6622 p_att_4 => l_detail_att_4,
6623 p_att_5 => l_detail_att_5,
6624 p_att_6 => l_detail_att_6,
6625 p_att_7 => l_detail_att_7,
6626 p_att_8 => l_detail_att_8,
6627 p_att_9 => l_detail_att_9,
6628 p_att_10 => l_detail_att_10,
6629 p_att_11 => l_detail_att_11,
6630 p_att_12 => l_detail_att_12,
6631 p_att_13 => l_detail_att_13,
6632 p_att_14 => l_detail_att_14,
6633 p_att_15 => l_detail_att_15,
6634 p_att_16 => l_detail_att_16,
6635 p_att_17 => l_detail_att_17,
6636 p_att_18 => l_detail_att_18,
6637 p_att_19 => l_detail_att_19,
6638 p_att_20 => l_detail_att_20,
6639 p_att_21 => l_detail_att_21,
6640 p_att_22 => l_detail_att_22,
6641 p_att_23 => l_detail_att_23,
6642 p_att_24 => l_detail_att_24,
6643 p_att_25 => l_detail_att_25,
6644 p_att_26 => l_detail_att_26,
6645 p_att_27 => l_detail_att_27,
6646 p_att_28 => l_detail_att_28,
6647 p_att_29 => l_detail_att_29,
6648 p_att_30 => l_detail_att_30,
6649 p_attribute_index_info => p_attribute_index_info
6650 );
6651
6652
6653 END IF;
6654
6655 IF l_detail_info_found and l_reason_info_found THEN
6656
6657 g_negative_index := g_negative_index - 1;
6658
6659 if g_debug then
6660 hr_utility.TRACE ('DETAILREASONFOUND');
6661 end if;
6662 -- g_negative_index := g_negative_index;
6663 -- the above statement can be mutually exclusive..check out
6664
6665 l_attribute_index := g_negative_index;
6666 hxc_timekeeper_utilities.add_dff_attribute (
6667 p_attribute => p_attributes,
6668 p_attribute_id => g_negative_index,
6669 p_tbb_id => l_detail_id,
6670 p_tbb_ovn => l_detail_ovn,
6671 p_blk_type => 'REASON', --ctk
6672 p_blk_id => reason_bldtyp_id, --ctk
6673 p_att_category => l_detail_reason_category,
6674 p_att_1 => l_detail_reason_att_1,
6675 p_att_2 => l_detail_reason_att_2,
6676 p_att_3 => l_detail_reason_att_3,
6677 p_att_4 => l_detail_reason_att_4,
6678 p_att_5 => l_detail_reason_att_5,
6679 p_att_6 => l_detail_reason_att_6,
6680 p_att_7 => l_detail_reason_att_7,
6681 p_att_8 => NULL,
6682 p_att_9 => NULL,
6683 p_att_10 => NULL,
6684 p_att_11 => NULL,
6685 p_att_12 => NULL,
6686 p_att_13 => NULL,
6687 p_att_14 => NULL,
6688 p_att_15 => NULL,
6689 p_att_16 => NULL,
6690 p_att_17 => NULL,
6691 p_att_18 => NULL,
6692 p_att_19 => NULL,
6693 p_att_20 => NULL,
6694 p_att_21 => NULL,
6695 p_att_22 => NULL,
6696 p_att_23 => NULL,
6697 p_att_24 => NULL,
6698 p_att_25 => NULL,
6699 p_att_26 => NULL,
6700 p_att_27 => NULL,
6701 p_att_28 => NULL,
6702 p_att_29 => NULL,
6703 p_att_30 => NULL,
6704 p_attribute_index_info => p_attribute_index_info
6705 );
6706 END IF;
6707
6708 END IF;
6709
6710 ELSIF l_action = 'UPDATE' THEN
6711
6712
6713 IF (l_measure IS NOT NULL OR l_detail_time_in IS NOT NULL OR l_detail_time_out IS NOT NULL)
6714 AND l_detail_id IS NOT NULL
6715 AND l_detail_id > 0 THEN
6716 -- we are on an existing block
6717 -- update the detail information with the new measure
6718
6719
6720
6721 IF l_detail_time_in > l_detail_time_out THEN
6722 l_detail_time_out := l_detail_time_out + 1;
6723 END IF;
6724
6725 -- work on the attribute information.
6726
6727 FOR l_index_attribute IN 1 .. 20 LOOP
6728
6729 hxc_timekeeper_utilities.manage_attributes (
6730 p_attribute_number => l_index_attribute,
6731 p_insert_data_details => p_insert_detail,
6732 p_old_value => l_old_attribute_value,
6733 p_new_value => l_new_attribute_value
6734 );
6735
6736 IF p_att_tab.EXISTS (l_index_attribute)
6737 AND ((l_new_attribute_value is not null and l_old_attribute_value is not null
6738 and l_old_attribute_value <> l_new_attribute_value)
6739 /* start of fix for 5398047
6740 OR (l_new_attribute_value is null and l_old_attribute_value is null)
6741 end of fix for 5398047 */
6742 OR (l_new_attribute_value is null and l_old_attribute_value is not null)
6743 OR (l_new_attribute_value is not null and l_old_attribute_value is null))
6744 THEN --2786991
6745 --IF NVL (l_new_attribute_value, -1) <> NVL (l_old_attribute_value, -1) THEN
6746 hxc_timekeeper_process.g_negative_index := hxc_timekeeper_process.g_negative_index - 1;
6747
6748
6749 if g_debug then
6750 hr_utility.trace('l_detail_changed1 '||l_detail_changed);
6751 end if;
6752 IF l_detail_changed <> 'Y' THEN
6753 l_detail_changed := 'Y';
6754
6755 if g_debug then
6756 hr_utility.trace('l_detail_changed1 '||l_detail_changed);
6757 end if;
6758 END IF;
6759
6760 hxc_timekeeper_utilities.add_attribute (
6761 p_attribute => p_attributes,
6762 p_attribute_id => g_negative_index,
6763 p_tbb_id => l_detail_id,
6764 p_tbb_ovn => l_detail_ovn,
6765 p_blk_type => 'OTL_ALIAS_ITEM_' || l_index_attribute,
6766 p_blk_id => NULL,
6767 p_att_category => 'OTL_ALIAS_ITEM_' || l_index_attribute,
6768 p_att_1 => l_new_attribute_value,
6769 p_att_2 => p_att_tab (l_index_attribute).alias_definition_id,
6770 p_att_3 => l_old_attribute_value,
6771 p_att_4 => p_att_tab (l_index_attribute).alias_type,
6772 p_attribute_index_info => p_attribute_index_info
6773 );
6774 END IF;
6775 END LOOP;
6776 /*ADVICE(5889): Nested LOOPs should all be labeled [406] */
6777
6778 -- first we can set the flag if one of the dff att
6779 -- or cla attributes changed.
6780 IF (l_detail_info_found and l_detail_dff_changed and NVL (bldtyp_id, -999) <> -999)
6781 OR (l_detail_info_found AND l_reason_info_found AND l_cla_attribute_changed
6782 AND NVL (reason_bldtyp_id, -999) <> -999) THEN
6783
6784 l_detail_changed := 'Y';
6785 if g_debug then
6786 hr_utility.trace('l_detail_changed2 '||l_detail_changed);
6787 end if;
6788 END IF;
6789 if g_debug then
6790 hr_utility.trace('l_detail_changed 3'||l_detail_changed);
6791 end if;
6792
6793
6794 hxc_timekeeper_utilities.add_block (
6795 p_timecard => p_timecard,
6796 p_timecard_id => l_detail_id,
6797 p_ovn => l_detail_ovn,
6798 p_parent_id => p_day_id_info_table (l_index_day).day_id,
6799 p_parent_ovn => p_day_id_info_table (l_index_day).day_ovn,
6800 p_approval_style_id => p_approval_style_id,
6801 p_measure => l_measure,
6802 p_scope => 'DETAIL',
6803 p_date_to => hr_general.end_of_time,
6804 p_date_from => SYSDATE,
6805 p_start_period => l_detail_time_in,
6806 p_end_period => l_detail_time_out,
6807 p_resource_id => p_resource_id,
6808 p_changed => l_detail_changed,
6809 p_comment_text => l_detail_comment_text,
6810 p_submit_flg => g_submit,
6811 p_application_set_id => l_application_set_id,
6812 p_timecard_index_info => p_timecard_index_info
6813 );
6814
6815 -- check the detail changed flag again
6816
6817
6818 IF l_detail_info_found and l_detail_dff_changed
6819 AND NVL (bldtyp_id, -999) <> -999 THEN -- and l_detail_dff_found THEN
6820
6821 l_attribute_found := FALSE;
6822 --l_attribute_index :=
6823 hxc_alias_utility.attribute_check (
6824 p_bld_blk_info_type_id => bldtyp_id,
6825 p_time_building_block_id => l_detail_id,
6826 p_attributes => p_attributes,
6827 p_tbb_id_reference_table => l_tbb_id_reference_table,
6828 p_attribute_found => l_attribute_found,
6829 p_attribute_index => l_attribute_index
6830 );
6831
6832 -- now we need to check if we need to create an attribute or do an update
6833
6834 -- if l_attribute_index = -1 THEN
6835 IF NOT (l_attribute_found) THEN
6836 g_negative_index := g_negative_index - 1;
6837 l_attribute_index := g_negative_index;
6838 ELSE
6839 l_attribute_index := p_attributes (l_attribute_index).time_attribute_id;
6840 END IF;
6841
6842 hxc_timekeeper_utilities.add_dff_attribute (
6843 p_attribute => p_attributes,
6844 p_attribute_id => l_attribute_index,
6845 p_tbb_id => l_detail_id,
6846 p_tbb_ovn => l_detail_ovn,
6847 p_blk_type => 'Dummy Paexpitdff Context',
6848 p_blk_id => bldtyp_id,
6849 p_att_category => l_detail_dff_category,
6850 p_att_1 => l_detail_att_1,
6851 p_att_2 => l_detail_att_2,
6852 p_att_3 => l_detail_att_3,
6853 p_att_4 => l_detail_att_4,
6854 p_att_5 => l_detail_att_5,
6855 p_att_6 => l_detail_att_6,
6856 p_att_7 => l_detail_att_7,
6857 p_att_8 => l_detail_att_8,
6858 p_att_9 => l_detail_att_9,
6859 p_att_10 => l_detail_att_10,
6860 p_att_11 => l_detail_att_11,
6861 p_att_12 => l_detail_att_12,
6862 p_att_13 => l_detail_att_13,
6863 p_att_14 => l_detail_att_14,
6864 p_att_15 => l_detail_att_15,
6865 p_att_16 => l_detail_att_16,
6866 p_att_17 => l_detail_att_17,
6867 p_att_18 => l_detail_att_18,
6868 p_att_19 => l_detail_att_19,
6869 p_att_20 => l_detail_att_20,
6870 p_att_21 => l_detail_att_21,
6871 p_att_22 => l_detail_att_22,
6872 p_att_23 => l_detail_att_23,
6873 p_att_24 => l_detail_att_24,
6874 p_att_25 => l_detail_att_25,
6875 p_att_26 => l_detail_att_26,
6876 p_att_27 => l_detail_att_27,
6877 p_att_28 => l_detail_att_28,
6878 p_att_29 => l_detail_att_29,
6879 p_att_30 => l_detail_att_30,
6880 p_attribute_index_info => p_attribute_index_info
6881 );
6882
6883 -- add the new attribute in the ref table
6884
6885 IF l_tbb_id_reference_table.EXISTS ( --4
6886 l_detail_id) THEN
6887
6888 l_tbb_id_reference_table (l_detail_id).attribute_index :=
6889 l_tbb_id_reference_table (l_detail_id).attribute_index || '|' || l_attribute_index;
6890 ELSE
6891 l_tbb_id_reference_table (l_detail_id).attribute_index := '|' || l_attribute_index;
6892 END IF; --4
6893 END IF; --3
6894 -----------------------
6895
6896 IF l_detail_info_found AND l_reason_info_found AND l_cla_attribute_changed
6897 AND NVL (reason_bldtyp_id, -999) <> -999 THEN
6898
6899 l_attribute_found := FALSE;
6900 --l_attribute_index :=
6901 hxc_alias_utility.attribute_check (
6902 p_bld_blk_info_type_id => reason_bldtyp_id, --pass reason info type id
6903 p_time_building_block_id => l_detail_id,
6904 p_attributes => p_attributes,
6905 p_tbb_id_reference_table => l_tbb_id_reference_table,
6906 p_attribute_found => l_attribute_found,
6907 p_attribute_index => l_attribute_index
6908 );
6909
6910 -- now we need to check if we need to create an attribute or do an update
6911 IF NOT (l_attribute_found) THEN
6912 g_negative_index := g_negative_index - 1;
6913 l_attribute_index := g_negative_index;
6914 ELSE
6915 l_attribute_index := p_attributes (l_attribute_index).time_attribute_id;
6916 END IF;
6917
6918
6919 hxc_timekeeper_utilities.add_dff_attribute (
6920 p_attribute => p_attributes,
6921 p_attribute_id => l_attribute_index,
6922 p_tbb_id => l_detail_id,
6923 p_tbb_ovn => l_detail_ovn,
6924 p_blk_type => 'REASON',
6925 p_blk_id => reason_bldtyp_id,
6926 p_att_category => l_detail_reason_category,
6927 p_att_1 => l_detail_reason_att_1,
6928 p_att_2 => l_detail_reason_att_2,
6929 p_att_3 => l_detail_reason_att_3,
6930 p_att_4 => l_detail_reason_att_4,
6931 p_att_5 => l_detail_reason_att_5,
6932 p_att_6 => l_detail_reason_att_6,
6933 p_att_7 => l_detail_reason_att_7,
6934 p_att_8 => NULL,
6935 p_att_9 => NULL,
6936 p_att_10 => NULL,
6937 p_att_11 => NULL,
6938 p_att_12 => NULL,
6939 p_att_13 => NULL,
6940 p_att_14 => NULL,
6941 p_att_15 => NULL,
6942 p_att_16 => NULL,
6943 p_att_17 => NULL,
6944 p_att_18 => NULL,
6945 p_att_19 => NULL,
6946 p_att_20 => NULL,
6947 p_att_21 => NULL,
6948 p_att_22 => NULL,
6949 p_att_23 => NULL,
6950 p_att_24 => NULL,
6951 p_att_25 => NULL,
6952 p_att_26 => NULL,
6953 p_att_27 => NULL,
6954 p_att_28 => NULL,
6955 p_att_29 => NULL,
6956 p_att_30 => NULL,
6957 p_attribute_index_info => p_attribute_index_info
6958 );
6959
6960 -- add the new attribute in the ref table
6961
6962 IF l_tbb_id_reference_table.EXISTS ( --4
6963 l_detail_id) THEN
6964
6965 l_tbb_id_reference_table (l_detail_id).attribute_index :=
6966 l_tbb_id_reference_table (l_detail_id).attribute_index || '|' || l_attribute_index;
6967 ELSE
6968 l_tbb_id_reference_table (l_detail_id).attribute_index := '|' || l_attribute_index;
6969 END IF; --4
6970 -----------------------
6971 END IF; --detail is found --1
6972
6973 ELSIF (l_measure IS NOT NULL OR l_detail_time_in IS NOT NULL OR l_detail_time_out IS NOT NULL)
6974 AND (l_detail_id IS NULL OR l_detail_id < 0) THEN
6975 -- new block the block the detail information with the new measure
6976 -- add the detail information.
6977 g_negative_index := g_negative_index - 1;
6978 l_detail_id := g_negative_index;
6979 if g_debug then
6980 hr_utility.trace('HERE');
6981 end if;
6982 IF l_detail_time_in > l_detail_time_out THEN
6983 l_detail_time_out := l_detail_time_out + 1;
6984 END IF;
6985
6986 hxc_timekeeper_utilities.add_block (
6987 p_timecard => p_timecard,
6988 p_timecard_id => l_detail_id,
6989 p_ovn => l_detail_ovn,
6990 p_parent_id => p_day_id_info_table (l_index_day).day_id,
6991 p_parent_ovn => p_day_id_info_table (l_index_day).day_ovn,
6992 p_approval_style_id => p_approval_style_id,
6993 p_measure => l_measure,
6994 p_scope => 'DETAIL',
6995 p_date_to => hr_general.end_of_time,
6996 p_date_from => SYSDATE,
6997 p_start_period => l_detail_time_in,
6998 p_end_period => l_detail_time_out,
6999 p_resource_id => p_resource_id,
7000 p_changed => 'Y',
7001 p_comment_text => l_detail_comment_text,
7002 p_submit_flg => g_submit,
7003 p_application_set_id => l_application_set_id,
7004 p_timecard_index_info => p_timecard_index_info
7005 );
7006
7007 FOR l_index_attribute IN 1 .. 20 LOOP
7008 hxc_timekeeper_utilities.manage_attributes (
7009 p_attribute_number => l_index_attribute,
7010 p_insert_data_details => p_insert_detail,
7011 p_old_value => l_old_attribute_value,
7012 p_new_value => l_new_attribute_value
7013 );
7014
7015 IF l_new_attribute_value IS NOT NULL AND p_att_tab.EXISTS (l_index_attribute) THEN --2786991
7016
7017 hxc_timekeeper_process.g_negative_index := hxc_timekeeper_process.g_negative_index - 1;
7018 hxc_timekeeper_utilities.add_attribute (
7019 p_attribute => p_attributes,
7020 p_attribute_id => g_negative_index,
7021 p_tbb_id => l_detail_id,
7022 p_tbb_ovn => l_detail_ovn,
7023 p_blk_type => 'OTL_ALIAS_ITEM_' || l_index_attribute,
7024 p_blk_id => NULL,
7025 p_att_category => 'OTL_ALIAS_ITEM_' || l_index_attribute,
7026 p_att_1 => l_new_attribute_value,
7027 p_att_2 => p_att_tab (l_index_attribute).alias_definition_id,
7028 p_att_3 => l_old_attribute_value,
7029 p_att_4 => p_att_tab (l_index_attribute).alias_type,
7030 p_attribute_index_info => p_attribute_index_info
7031 );
7032 END IF;
7033 END LOOP;
7034 --left
7035
7036 IF l_detail_info_found and l_reason_info_found THEN
7037 if g_debug then
7038 hr_utility.trace('HERE 1 RESSON');
7039 end if;
7040 g_negative_index := g_negative_index - 1;
7041
7042 l_attribute_index := g_negative_index;
7043 if g_debug then
7044 hr_utility.trace(l_attribute_index);
7045 end if;
7046 hxc_timekeeper_utilities.add_dff_attribute (
7047 p_attribute => p_attributes,
7048 p_attribute_id => g_negative_index,
7049 p_tbb_id => l_detail_id,
7050 p_tbb_ovn => l_detail_ovn,
7051 p_blk_type => 'REASON', --ctk
7052 p_blk_id => reason_bldtyp_id, --ctk
7053 p_att_category => l_detail_reason_category,
7054 p_att_1 => l_detail_reason_att_1,
7055 p_att_2 => l_detail_reason_att_2,
7056 p_att_3 => l_detail_reason_att_3,
7057 p_att_4 => l_detail_reason_att_4,
7058 p_att_5 => l_detail_reason_att_5,
7059 p_att_6 => l_detail_reason_att_6,
7060 p_att_7 => l_detail_reason_att_7,
7061 p_att_8 => NULL,
7062 p_att_9 => NULL,
7063 p_att_10 => NULL,
7064 p_att_11 => NULL,
7065 p_att_12 => NULL,
7066 p_att_13 => NULL,
7067 p_att_14 => NULL,
7068 p_att_15 => NULL,
7069 p_att_16 => NULL,
7070 p_att_17 => NULL,
7071 p_att_18 => NULL,
7072 p_att_19 => NULL,
7073 p_att_20 => NULL,
7074 p_att_21 => NULL,
7075 p_att_22 => NULL,
7076 p_att_23 => NULL,
7077 p_att_24 => NULL,
7078 p_att_25 => NULL,
7079 p_att_26 => NULL,
7080 p_att_27 => NULL,
7081 p_att_28 => NULL,
7082 p_att_29 => NULL,
7083 p_att_30 => NULL,
7084 p_attribute_index_info => p_attribute_index_info
7085 );
7086 END IF;
7087
7088 IF l_detail_info_found and l_detail_dff_found THEN
7089 if g_debug then
7090 hr_utility.trace('HERE 2');
7091 hr_utility.trace(l_attribute_index);
7092 end if;
7093 g_negative_index := g_negative_index - 1;
7094 l_attribute_index := g_negative_index;
7095
7096 hxc_timekeeper_utilities.add_dff_attribute (
7097 p_attribute => p_attributes,
7098 p_attribute_id => g_negative_index,
7099 p_tbb_id => l_detail_id,
7100 p_tbb_ovn => l_detail_ovn,
7101 p_blk_type => 'Dummy Paexpitdff Context',
7102 p_blk_id => bldtyp_id,
7103 p_att_category => l_detail_dff_category,
7104 p_att_1 => l_detail_att_1,
7105 p_att_2 => l_detail_att_2,
7106 p_att_3 => l_detail_att_3,
7107 p_att_4 => l_detail_att_4,
7108 p_att_5 => l_detail_att_5,
7109 p_att_6 => l_detail_att_6,
7110 p_att_7 => l_detail_att_7,
7111 p_att_8 => l_detail_att_8,
7112 p_att_9 => l_detail_att_9,
7113 p_att_10 => l_detail_att_10,
7114 p_att_11 => l_detail_att_11,
7115 p_att_12 => l_detail_att_12,
7116 p_att_13 => l_detail_att_13,
7117 p_att_14 => l_detail_att_14,
7118 p_att_15 => l_detail_att_15,
7119 p_att_16 => l_detail_att_16,
7120 p_att_17 => l_detail_att_17,
7121 p_att_18 => l_detail_att_18,
7122 p_att_19 => l_detail_att_19,
7123 p_att_20 => l_detail_att_20,
7124 p_att_21 => l_detail_att_21,
7125 p_att_22 => l_detail_att_22,
7126 p_att_23 => l_detail_att_23,
7127 p_att_24 => l_detail_att_24,
7128 p_att_25 => l_detail_att_25,
7129 p_att_26 => l_detail_att_26,
7130 p_att_27 => l_detail_att_27,
7131 p_att_28 => l_detail_att_28,
7132 p_att_29 => l_detail_att_29,
7133 p_att_30 => l_detail_att_30,
7134 p_attribute_index_info => p_attribute_index_info
7135 );
7136
7137 END IF;
7138
7139 ELSIF (l_measure IS NULL OR (l_detail_time_in IS NULL AND l_detail_time_out IS NULL))
7140 AND (l_detail_id IS NOT NULL AND l_detail_id > 0) THEN
7141 -- terminate the block the detail information with the new measure
7142 hxc_timekeeper_utilities.add_block (
7143 p_timecard => p_timecard,
7144 p_timecard_id => l_detail_id,
7145 p_ovn => l_detail_ovn,
7146 p_parent_id => p_day_id_info_table (l_index_day).day_id,
7147 p_parent_ovn => p_day_id_info_table (l_index_day).day_ovn,
7148 p_approval_style_id => p_approval_style_id,
7149 p_measure => l_measure,
7150 p_scope => 'DETAIL',
7151 p_date_to => SYSDATE,
7152 p_date_from => NULL,
7153 p_start_period => l_detail_time_in, --p_start_period + l_index_day,
7154 p_end_period => l_detail_time_out, --p_start_period + l_index_day + g_one_day,
7155 p_resource_id => p_resource_id,
7156 p_changed => 'Y',
7157 p_comment_text => l_detail_comment_text,
7158 p_submit_flg => g_submit,
7159 p_application_set_id => l_application_set_id,
7160 p_timecard_index_info => p_timecard_index_info
7161 );
7162
7163 IF (p_tk_audit_enabled = 'Y') THEN
7164
7165 l_attribute_found := FALSE;
7166 --l_attribute_index :=
7167 hxc_alias_utility.attribute_check (
7168 p_bld_blk_info_type_id => reason_bldtyp_id,
7169 p_time_building_block_id => l_detail_id,
7170 p_attributes => p_attributes,
7171 p_tbb_id_reference_table => l_tbb_id_reference_table,
7172 p_attribute_found => l_attribute_found,
7173 p_attribute_index => l_attribute_index
7174 );
7175
7176 -- now we need to check if we need to create an attribute or do an update
7177
7178 -- if l_attribute_index = -1 THEN
7179 IF NOT (l_attribute_found) THEN
7180 g_negative_index := g_negative_index - 1;
7181 l_attribute_index := g_negative_index;
7182 ELSE
7183 l_attribute_index := p_attributes (l_attribute_index).time_attribute_id;
7184 END IF;
7185
7186 hxc_timekeeper_utilities.add_dff_attribute (
7187 p_attribute => p_attributes,
7188 p_attribute_id => l_attribute_index,
7189 p_tbb_id => l_detail_id,
7190 p_tbb_ovn => l_detail_ovn,
7191 p_blk_type => 'REASON', --ctk
7192 p_blk_id => reason_bldtyp_id, --ctk
7193 p_att_category => 'REASON',
7194 p_att_1 => 'TK_DEL_CHANGE_REASON',
7195 p_att_2 => NULL,
7196 p_att_3 => 'CHANGE',
7197 p_att_4 => NULL,
7198 p_att_5 => NULL,
7199 p_att_6 => NULL,
7200 p_att_7 => NULL,
7201 p_att_8 => NULL,
7202 p_att_9 => NULL,
7203 p_att_10 => NULL,
7204 p_att_11 => NULL,
7205 p_att_12 => NULL,
7206 p_att_13 => NULL,
7207 p_att_14 => NULL,
7208 p_att_15 => NULL,
7209 p_att_16 => NULL,
7210 p_att_17 => NULL,
7211 p_att_18 => NULL,
7212 p_att_19 => NULL,
7213 p_att_20 => NULL,
7214 p_att_21 => NULL,
7215 p_att_22 => NULL,
7216 p_att_23 => NULL,
7217 p_att_24 => NULL,
7218 p_att_25 => NULL,
7219 p_att_26 => NULL,
7220 p_att_27 => NULL,
7221 p_att_28 => NULL,
7222 p_att_29 => NULL,
7223 p_att_30 => NULL,
7224 p_attribute_index_info => p_attribute_index_info
7225 );
7226 END IF; ---DELETE REASON
7227
7228
7229 END IF;
7230
7231 ELSIF l_action = 'DELETE' THEN
7232 IF l_detail_id IS NOT NULL AND l_detail_id > 0 THEN
7233 -- terminate the block
7234 hxc_timekeeper_utilities.add_block (
7235 p_timecard => p_timecard,
7236 p_timecard_id => l_detail_id,
7237 p_ovn => l_detail_ovn,
7238 p_parent_id => p_day_id_info_table (l_index_day).day_id,
7239 p_parent_ovn => p_day_id_info_table (l_index_day).day_ovn,
7240 p_approval_style_id => p_approval_style_id,
7241 p_measure => l_measure,
7242 p_scope => 'DETAIL',
7243 p_date_to => SYSDATE,
7244 p_date_from => NULL,
7245 p_start_period => l_detail_time_in,
7246 p_end_period => l_detail_time_out,
7247 p_resource_id => p_resource_id,
7248 p_changed => 'Y',
7249 p_comment_text => l_detail_comment_text,
7250 p_submit_flg => g_submit,
7251 p_application_set_id => l_application_set_id,
7252 p_timecard_index_info => p_timecard_index_info
7253 );
7254
7255 IF (p_tk_audit_enabled = 'Y') THEN
7256
7257 l_attribute_found := FALSE;
7258 --l_attribute_index :=
7259 hxc_alias_utility.attribute_check (
7260 p_bld_blk_info_type_id => reason_bldtyp_id,
7261 p_time_building_block_id => l_detail_id,
7262 p_attributes => p_attributes,
7263 p_tbb_id_reference_table => l_tbb_id_reference_table,
7264 p_attribute_found => l_attribute_found,
7265 p_attribute_index => l_attribute_index
7266 );
7267
7268 -- now we need to check if we need to create an attribute or do an update
7269
7270 -- if l_attribute_index = -1 THEN
7271 IF NOT (l_attribute_found) THEN
7272 g_negative_index := g_negative_index - 1;
7273 l_attribute_index := g_negative_index;
7274 ELSE
7275 l_attribute_index := p_attributes (l_attribute_index).time_attribute_id;
7276 END IF;
7277
7278 hxc_timekeeper_utilities.add_dff_attribute (
7279 p_attribute => p_attributes,
7280 p_attribute_id => l_attribute_index,
7281 p_tbb_id => l_detail_id,
7282 p_tbb_ovn => l_detail_ovn,
7283 p_blk_type => 'REASON', --ctk
7284 p_blk_id => reason_bldtyp_id, --ctk
7285 p_att_category => 'REASON',
7286 p_att_1 => 'TK_DEL_CHANGE_REASON',
7287 p_att_2 => NULL,
7288 p_att_3 => 'CHANGE',
7289 p_att_4 => NULL,
7290 p_att_5 => NULL,
7291 p_att_6 => NULL,
7292 p_att_7 => NULL,
7293 p_att_8 => NULL,
7294 p_att_9 => NULL,
7295 p_att_10 => NULL,
7296 p_att_11 => NULL,
7297 p_att_12 => NULL,
7298 p_att_13 => NULL,
7299 p_att_14 => NULL,
7300 p_att_15 => NULL,
7301 p_att_16 => NULL,
7302 p_att_17 => NULL,
7303 p_att_18 => NULL,
7304 p_att_19 => NULL,
7305 p_att_20 => NULL,
7306 p_att_21 => NULL,
7307 p_att_22 => NULL,
7308 p_att_23 => NULL,
7309 p_att_24 => NULL,
7310 p_att_25 => NULL,
7311 p_att_26 => NULL,
7312 p_att_27 => NULL,
7313 p_att_28 => NULL,
7314 p_att_29 => NULL,
7315 p_att_30 => NULL,
7316 p_attribute_index_info => p_attribute_index_info
7317 );
7318 END IF; ---DELETE REASON
7319 END IF;
7320 END IF;
7321
7322 -- increment day
7323 l_index_day := l_index_day + 1;
7324 END LOOP; --while end loop for the days
7325 END IF;
7326
7327
7328
7329
7330 END; --create detail structure
7331
7332
7333 -----------------------------------------------------------------------------
7334 PROCEDURE get_day_totals (
7335 p_day_total_1 OUT NOCOPY NUMBER,
7336 p_day_total_2 OUT NOCOPY NUMBER,
7337 p_day_total_3 OUT NOCOPY NUMBER,
7338 p_day_total_4 OUT NOCOPY NUMBER,
7339 p_day_total_5 OUT NOCOPY NUMBER,
7340 p_day_total_6 OUT NOCOPY NUMBER,
7341 p_day_total_7 OUT NOCOPY NUMBER,
7342 p_day_total_8 OUT NOCOPY NUMBER,
7343 p_day_total_9 OUT NOCOPY NUMBER,
7344 p_day_total_10 OUT NOCOPY NUMBER,
7345 p_day_total_11 OUT NOCOPY NUMBER,
7346 p_day_total_12 OUT NOCOPY NUMBER,
7347 p_day_total_13 OUT NOCOPY NUMBER,
7348 p_day_total_14 OUT NOCOPY NUMBER,
7349 p_day_total_15 OUT NOCOPY NUMBER,
7350 p_day_total_16 OUT NOCOPY NUMBER,
7351 p_day_total_17 OUT NOCOPY NUMBER,
7352 p_day_total_18 OUT NOCOPY NUMBER,
7353 p_day_total_19 OUT NOCOPY NUMBER,
7354 p_day_total_20 OUT NOCOPY NUMBER,
7355 p_day_total_21 OUT NOCOPY NUMBER,
7356 p_day_total_22 OUT NOCOPY NUMBER,
7357 p_day_total_23 OUT NOCOPY NUMBER,
7358 p_day_total_24 OUT NOCOPY NUMBER,
7359 p_day_total_25 OUT NOCOPY NUMBER,
7360 p_day_total_26 OUT NOCOPY NUMBER,
7361 p_day_total_27 OUT NOCOPY NUMBER,
7362 p_day_total_28 OUT NOCOPY NUMBER,
7363 p_day_total_29 OUT NOCOPY NUMBER,
7364 p_day_total_30 OUT NOCOPY NUMBER,
7365 p_day_total_31 OUT NOCOPY NUMBER
7366 ) IS
7367 l_index NUMBER
7368 /*ADVICE(6710): NUMBER has no precision [315] */
7369 ;
7370 BEGIN
7371 l_index := g_timekeeper_data_query.FIRST;
7372
7373 LOOP
7374 EXIT WHEN NOT g_timekeeper_data_query.EXISTS (l_index);
7375 p_day_total_1 := NVL (p_day_total_1, 0) + NVL (g_timekeeper_data_query (l_index).day_1, 0)
7376 + NVL (
7377 (g_timekeeper_data_query (l_index).time_out_1
7378 - g_timekeeper_data_query (l_index).time_in_1
7379 )
7380 * 24,
7381 0
7382 );
7383 p_day_total_2 := NVL (p_day_total_2, 0) + NVL (g_timekeeper_data_query (l_index).day_2, 0)
7384 + NVL (
7385 (g_timekeeper_data_query (l_index).time_out_2
7386 - g_timekeeper_data_query (l_index).time_in_2
7387 )
7388 * 24,
7389 0
7390 );
7391 p_day_total_3 := NVL (p_day_total_3, 0) + NVL (g_timekeeper_data_query (l_index).day_3, 0)
7392 + NVL (
7393 (g_timekeeper_data_query (l_index).time_out_3
7394 - g_timekeeper_data_query (l_index).time_in_3
7395 )
7396 * 24,
7397 0
7398 );
7399 p_day_total_4 := NVL (p_day_total_4, 0) + NVL (g_timekeeper_data_query (l_index).day_4, 0)
7400 + NVL (
7401 (g_timekeeper_data_query (l_index).time_out_4
7402 - g_timekeeper_data_query (l_index).time_in_4
7403 )
7404 * 24,
7405 0
7406 );
7407 p_day_total_5 := NVL (p_day_total_5, 0) + NVL (g_timekeeper_data_query (l_index).day_5, 0)
7408 + NVL (
7409 (g_timekeeper_data_query (l_index).time_out_5
7410 - g_timekeeper_data_query (l_index).time_in_5
7411 )
7412 * 24,
7413 0
7414 );
7415 p_day_total_6 := NVL (p_day_total_6, 0) + NVL (g_timekeeper_data_query (l_index).day_6, 0)
7416 + NVL (
7417 (g_timekeeper_data_query (l_index).time_out_6
7418 - g_timekeeper_data_query (l_index).time_in_6
7419 )
7420 * 24,
7421 0
7422 );
7423 p_day_total_7 := NVL (p_day_total_7, 0) + NVL (g_timekeeper_data_query (l_index).day_7, 0)
7424 + NVL (
7425 (g_timekeeper_data_query (l_index).time_out_7
7426 - g_timekeeper_data_query (l_index).time_in_7
7427 )
7428 * 24,
7429 0
7430 );
7431 p_day_total_8 := NVL (p_day_total_8, 0) + NVL (g_timekeeper_data_query (l_index).day_8, 0)
7432 + NVL (
7433 (g_timekeeper_data_query (l_index).time_out_8
7434 - g_timekeeper_data_query (l_index).time_in_8
7435 )
7436 * 24,
7437 0
7438 );
7439 p_day_total_9 := NVL (p_day_total_9, 0) + NVL (g_timekeeper_data_query (l_index).day_9, 0)
7440 + NVL (
7441 (g_timekeeper_data_query (l_index).time_out_9
7442 - g_timekeeper_data_query (l_index).time_in_9
7443 )
7444 * 24,
7445 0
7446 );
7447 p_day_total_10 := NVL (p_day_total_10, 0) + NVL (g_timekeeper_data_query (l_index).day_10, 0)
7448 + NVL (
7449 (g_timekeeper_data_query (l_index).time_out_10
7450 - g_timekeeper_data_query (l_index).time_in_10
7451 )
7452 * 24,
7453 0
7454 );
7455 p_day_total_11 := NVL (p_day_total_11, 0) + NVL (g_timekeeper_data_query (l_index).day_11, 0)
7456 + NVL (
7457 (g_timekeeper_data_query (l_index).time_out_11
7458 - g_timekeeper_data_query (l_index).time_in_11
7459 )
7460 * 24,
7461 0
7462 );
7463 p_day_total_12 := NVL (p_day_total_12, 0) + NVL (g_timekeeper_data_query (l_index).day_12, 0)
7464 + NVL (
7465 (g_timekeeper_data_query (l_index).time_out_12
7466 - g_timekeeper_data_query (l_index).time_in_12
7467 )
7468 * 24,
7469 0
7470 );
7471 p_day_total_13 := NVL (p_day_total_13, 0) + NVL (g_timekeeper_data_query (l_index).day_13, 0)
7472 + NVL (
7473 (g_timekeeper_data_query (l_index).time_out_13
7474 - g_timekeeper_data_query (l_index).time_in_13
7475 )
7476 * 24,
7477 0
7478 );
7479 p_day_total_14 := NVL (p_day_total_14, 0) + NVL (g_timekeeper_data_query (l_index).day_14, 0)
7480 + NVL (
7481 (g_timekeeper_data_query (l_index).time_out_14
7482 - g_timekeeper_data_query (l_index).time_in_14
7483 )
7484 * 24,
7485 0
7486 );
7487 p_day_total_15 := NVL (p_day_total_15, 0) + NVL (g_timekeeper_data_query (l_index).day_15, 0)
7488 + NVL (
7489 (g_timekeeper_data_query (l_index).time_out_15
7490 - g_timekeeper_data_query (l_index).time_in_15
7491 )
7492 * 24,
7493 0
7494 );
7495 p_day_total_16 := NVL (p_day_total_16, 0) + NVL (g_timekeeper_data_query (l_index).day_16, 0)
7496 + NVL (
7497 (g_timekeeper_data_query (l_index).time_out_16
7498 - g_timekeeper_data_query (l_index).time_in_16
7499 )
7500 * 24,
7501 0
7502 );
7503 p_day_total_17 := NVL (p_day_total_17, 0) + NVL (g_timekeeper_data_query (l_index).day_17, 0)
7504 + NVL (
7505 (g_timekeeper_data_query (l_index).time_out_17
7506 - g_timekeeper_data_query (l_index).time_in_17
7507 )
7508 * 24,
7509 0
7510 );
7511 p_day_total_18 := NVL (p_day_total_18, 0) + NVL (g_timekeeper_data_query (l_index).day_18, 0)
7512 + NVL (
7513 (g_timekeeper_data_query (l_index).time_out_18
7514 - g_timekeeper_data_query (l_index).time_in_18
7515 )
7516 * 24,
7517 0
7518 );
7519 p_day_total_19 := NVL (p_day_total_19, 0) + NVL (g_timekeeper_data_query (l_index).day_19, 0)
7520 + NVL (
7521 (g_timekeeper_data_query (l_index).time_out_19
7522 - g_timekeeper_data_query (l_index).time_in_19
7523 )
7524 * 24,
7525 0
7526 );
7527 p_day_total_20 := NVL (p_day_total_20, 0) + NVL (g_timekeeper_data_query (l_index).day_20, 0)
7528 + NVL (
7529 (g_timekeeper_data_query (l_index).time_out_20
7530 - g_timekeeper_data_query (l_index).time_in_20
7531 )
7532 * 24,
7533 0
7534 );
7535 p_day_total_21 := NVL (p_day_total_21, 0) + NVL (g_timekeeper_data_query (l_index).day_21, 0)
7536 + NVL (
7537 (g_timekeeper_data_query (l_index).time_out_21
7538 - g_timekeeper_data_query (l_index).time_in_21
7539 )
7540 * 24,
7541 0
7542 );
7543 p_day_total_22 := NVL (p_day_total_22, 0) + NVL (g_timekeeper_data_query (l_index).day_22, 0)
7544 + NVL (
7545 (g_timekeeper_data_query (l_index).time_out_22
7546 - g_timekeeper_data_query (l_index).time_in_22
7547 )
7548 * 24,
7549 0
7550 );
7551 p_day_total_23 := NVL (p_day_total_23, 0) + NVL (g_timekeeper_data_query (l_index).day_23, 0)
7552 + NVL (
7553 (g_timekeeper_data_query (l_index).time_out_23
7554 - g_timekeeper_data_query (l_index).time_in_23
7555 )
7556 * 24,
7557 0
7558 );
7559 p_day_total_24 := NVL (p_day_total_24, 0) + NVL (g_timekeeper_data_query (l_index).day_24, 0)
7560 + NVL (
7561 (g_timekeeper_data_query (l_index).time_out_24
7562 - g_timekeeper_data_query (l_index).time_in_24
7563 )
7564 * 24,
7565 0
7566 );
7567 p_day_total_25 := NVL (p_day_total_25, 0) + NVL (g_timekeeper_data_query (l_index).day_25, 0)
7568 + NVL (
7569 (g_timekeeper_data_query (l_index).time_out_25
7570 - g_timekeeper_data_query (l_index).time_in_25
7571 )
7572 * 24,
7573 0
7574 );
7575 p_day_total_26 := NVL (p_day_total_26, 0) + NVL (g_timekeeper_data_query (l_index).day_26, 0)
7576 + NVL (
7577 (g_timekeeper_data_query (l_index).time_out_26
7578 - g_timekeeper_data_query (l_index).time_in_26
7579 )
7580 * 24,
7581 0
7582 );
7583 p_day_total_27 := NVL (p_day_total_27, 0) + NVL (g_timekeeper_data_query (l_index).day_27, 0)
7584 + NVL (
7585 (g_timekeeper_data_query (l_index).time_out_27
7586 - g_timekeeper_data_query (l_index).time_in_27
7587 )
7588 * 24,
7589 0
7590 );
7591 p_day_total_28 := NVL (p_day_total_28, 0) + NVL (g_timekeeper_data_query (l_index).day_28, 0)
7592 + NVL (
7593 (g_timekeeper_data_query (l_index).time_out_28
7594 - g_timekeeper_data_query (l_index).time_in_28
7595 )
7596 * 24,
7597 0
7598 );
7599 p_day_total_29 := NVL (p_day_total_29, 0) + NVL (g_timekeeper_data_query (l_index).day_29, 0)
7600 + NVL (
7601 (g_timekeeper_data_query (l_index).time_out_29
7602 - g_timekeeper_data_query (l_index).time_in_29
7603 )
7604 * 24,
7605 0
7606 );
7607 p_day_total_30 := NVL (p_day_total_30, 0) + NVL (g_timekeeper_data_query (l_index).day_30, 0)
7608 + NVL (
7609 (g_timekeeper_data_query (l_index).time_out_30
7610 - g_timekeeper_data_query (l_index).time_in_30
7611 )
7612 * 24,
7613 0
7614 );
7615 p_day_total_31 := NVL (p_day_total_31, 0) + NVL (g_timekeeper_data_query (l_index).day_31, 0)
7616 + NVL (
7617 (g_timekeeper_data_query (l_index).time_out_31
7618 - g_timekeeper_data_query (l_index).time_in_31
7619 )
7620 * 24,
7621 0
7622 );
7623 l_index := g_timekeeper_data_query.NEXT (l_index);
7624 END LOOP;
7625 END;
7626 -----------------------------------------------------------------------------
7627
7628 END;