348: --
349: l_archived_flag VARCHAR2(1) := 'Y';
350: l_proc VARCHAR2(50) := g_package||'CHK_ACTION_ARCHIVED';
351: BEGIN
352: hr_utility.set_location(l_proc, 10);
353: hr_utility.trace(l_proc||': p_assignment_id='|| p_assignment_id);
354: hr_utility.trace(l_proc||': p_vehicle_allocation_id='|| p_vehicle_allocation_id);
355: hr_utility.trace(l_proc||': p_allocation_start_date='|| fnd_date.date_to_displaydate(p_allocation_start_date));
356: hr_utility.trace(l_proc||': p_action_flag='|| p_action_flag);
349: l_archived_flag VARCHAR2(1) := 'Y';
350: l_proc VARCHAR2(50) := g_package||'CHK_ACTION_ARCHIVED';
351: BEGIN
352: hr_utility.set_location(l_proc, 10);
353: hr_utility.trace(l_proc||': p_assignment_id='|| p_assignment_id);
354: hr_utility.trace(l_proc||': p_vehicle_allocation_id='|| p_vehicle_allocation_id);
355: hr_utility.trace(l_proc||': p_allocation_start_date='|| fnd_date.date_to_displaydate(p_allocation_start_date));
356: hr_utility.trace(l_proc||': p_action_flag='|| p_action_flag);
357: --
350: l_proc VARCHAR2(50) := g_package||'CHK_ACTION_ARCHIVED';
351: BEGIN
352: hr_utility.set_location(l_proc, 10);
353: hr_utility.trace(l_proc||': p_assignment_id='|| p_assignment_id);
354: hr_utility.trace(l_proc||': p_vehicle_allocation_id='|| p_vehicle_allocation_id);
355: hr_utility.trace(l_proc||': p_allocation_start_date='|| fnd_date.date_to_displaydate(p_allocation_start_date));
356: hr_utility.trace(l_proc||': p_action_flag='|| p_action_flag);
357: --
358: OPEN c_chk_archive;
351: BEGIN
352: hr_utility.set_location(l_proc, 10);
353: hr_utility.trace(l_proc||': p_assignment_id='|| p_assignment_id);
354: hr_utility.trace(l_proc||': p_vehicle_allocation_id='|| p_vehicle_allocation_id);
355: hr_utility.trace(l_proc||': p_allocation_start_date='|| fnd_date.date_to_displaydate(p_allocation_start_date));
356: hr_utility.trace(l_proc||': p_action_flag='|| p_action_flag);
357: --
358: OPEN c_chk_archive;
359: FETCH c_chk_archive INTO chk_archive_rec;
352: hr_utility.set_location(l_proc, 10);
353: hr_utility.trace(l_proc||': p_assignment_id='|| p_assignment_id);
354: hr_utility.trace(l_proc||': p_vehicle_allocation_id='|| p_vehicle_allocation_id);
355: hr_utility.trace(l_proc||': p_allocation_start_date='|| fnd_date.date_to_displaydate(p_allocation_start_date));
356: hr_utility.trace(l_proc||': p_action_flag='|| p_action_flag);
357: --
358: OPEN c_chk_archive;
359: FETCH c_chk_archive INTO chk_archive_rec;
360: IF c_chk_archive%NOTFOUND THEN
357: --
358: OPEN c_chk_archive;
359: FETCH c_chk_archive INTO chk_archive_rec;
360: IF c_chk_archive%NOTFOUND THEN
361: hr_utility.set_location(l_proc, 20);
362: l_archived_flag := 'N';
363: END IF;
364: CLOSE c_chk_archive;
365: --
362: l_archived_flag := 'N';
363: END IF;
364: CLOSE c_chk_archive;
365: --
366: hr_utility.set_location(l_proc, 30);
367: RETURN l_archived_flag;
368: END chk_action_archived;
369:
370: --For Bug 6652235
403: --
404: l_archived_flag VARCHAR2(1) := 'Y';
405: l_proc VARCHAR2(50) := g_package||'CHK_ACTION_ARCHIVED_V2';
406: BEGIN
407: hr_utility.set_location(l_proc, 10);
408: hr_utility.trace(l_proc||': p_assignment_id='|| p_assignment_id);
409: hr_utility.trace(l_proc||': p_vehicle_allocation_id='|| p_vehicle_allocation_id);
410: hr_utility.trace(l_proc||': p_allocation_start_date='|| fnd_date.date_to_displaydate(p_allocation_start_date));
411: hr_utility.trace(l_proc||': p_action_flag='|| p_action_flag);
404: l_archived_flag VARCHAR2(1) := 'Y';
405: l_proc VARCHAR2(50) := g_package||'CHK_ACTION_ARCHIVED_V2';
406: BEGIN
407: hr_utility.set_location(l_proc, 10);
408: hr_utility.trace(l_proc||': p_assignment_id='|| p_assignment_id);
409: hr_utility.trace(l_proc||': p_vehicle_allocation_id='|| p_vehicle_allocation_id);
410: hr_utility.trace(l_proc||': p_allocation_start_date='|| fnd_date.date_to_displaydate(p_allocation_start_date));
411: hr_utility.trace(l_proc||': p_action_flag='|| p_action_flag);
412: --
405: l_proc VARCHAR2(50) := g_package||'CHK_ACTION_ARCHIVED_V2';
406: BEGIN
407: hr_utility.set_location(l_proc, 10);
408: hr_utility.trace(l_proc||': p_assignment_id='|| p_assignment_id);
409: hr_utility.trace(l_proc||': p_vehicle_allocation_id='|| p_vehicle_allocation_id);
410: hr_utility.trace(l_proc||': p_allocation_start_date='|| fnd_date.date_to_displaydate(p_allocation_start_date));
411: hr_utility.trace(l_proc||': p_action_flag='|| p_action_flag);
412: --
413: OPEN c_chk_archive;
406: BEGIN
407: hr_utility.set_location(l_proc, 10);
408: hr_utility.trace(l_proc||': p_assignment_id='|| p_assignment_id);
409: hr_utility.trace(l_proc||': p_vehicle_allocation_id='|| p_vehicle_allocation_id);
410: hr_utility.trace(l_proc||': p_allocation_start_date='|| fnd_date.date_to_displaydate(p_allocation_start_date));
411: hr_utility.trace(l_proc||': p_action_flag='|| p_action_flag);
412: --
413: OPEN c_chk_archive;
414: FETCH c_chk_archive INTO chk_archive_rec;
407: hr_utility.set_location(l_proc, 10);
408: hr_utility.trace(l_proc||': p_assignment_id='|| p_assignment_id);
409: hr_utility.trace(l_proc||': p_vehicle_allocation_id='|| p_vehicle_allocation_id);
410: hr_utility.trace(l_proc||': p_allocation_start_date='|| fnd_date.date_to_displaydate(p_allocation_start_date));
411: hr_utility.trace(l_proc||': p_action_flag='|| p_action_flag);
412: --
413: OPEN c_chk_archive;
414: FETCH c_chk_archive INTO chk_archive_rec;
415: IF c_chk_archive%NOTFOUND THEN
412: --
413: OPEN c_chk_archive;
414: FETCH c_chk_archive INTO chk_archive_rec;
415: IF c_chk_archive%NOTFOUND THEN
416: hr_utility.set_location(l_proc, 20);
417: l_archived_flag := 'N';
418: END IF;
419: CLOSE c_chk_archive;
420: --
417: l_archived_flag := 'N';
418: END IF;
419: CLOSE c_chk_archive;
420: --
421: hr_utility.set_location(l_proc, 30);
422: RETURN l_archived_flag;
423: END chk_action_archived_v2;
424:
425: -----------------------------------------------------
458: l_ovn pay_action_information.object_version_number%TYPE;
459: --
460: BEGIN
461: --
462: -- hr_utility.trace_on(null, 'RMAKHIJA');
463: hr_utility.set_location('Enering: '||l_proc, 10);
464: hr_utility.trace(l_proc||': payroll_action_id='||pactid);
465: --
466: -- Get Employer information
459: --
460: BEGIN
461: --
462: -- hr_utility.trace_on(null, 'RMAKHIJA');
463: hr_utility.set_location('Enering: '||l_proc, 10);
464: hr_utility.trace(l_proc||': payroll_action_id='||pactid);
465: --
466: -- Get Employer information
467: OPEN c_employer;
460: BEGIN
461: --
462: -- hr_utility.trace_on(null, 'RMAKHIJA');
463: hr_utility.set_location('Enering: '||l_proc, 10);
464: hr_utility.trace(l_proc||': payroll_action_id='||pactid);
465: --
466: -- Get Employer information
467: OPEN c_employer;
468: FETCH c_employer INTO employer_rec;
466: -- Get Employer information
467: OPEN c_employer;
468: FETCH c_employer INTO employer_rec;
469: IF c_employer%NOTFOUND THEN
470: hr_utility.set_location(l_proc, 20);
471: raise NO_DATA_FOUND;
472: END IF;
473: CLOSE c_employer;
474: --
473: CLOSE c_employer;
474: --
475: g_effective_date := employer_rec.effective_Date;
476: --
477: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
478: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
479: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
480: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
481: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
474: --
475: g_effective_date := employer_rec.effective_Date;
476: --
477: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
478: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
479: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
480: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
481: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
482: --
475: g_effective_date := employer_rec.effective_Date;
476: --
477: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
478: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
479: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
480: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
481: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
482: --
483: pay_action_information_api.create_action_information (
476: --
477: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
478: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
479: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
480: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
481: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
482: --
483: pay_action_information_api.create_action_information (
484: p_action_information_id => l_action_info_id
477: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
478: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
479: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
480: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
481: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
482: --
483: pay_action_information_api.create_action_information (
484: p_action_information_id => l_action_info_id
485: , p_action_context_id => pactid
494: , p_action_information2 => upper(employer_rec.employer_name)
495: , p_action_information3 => upper(employer_rec.tax_district_name)
496: , p_action_information4 => upper(employer_rec.employer_address_line));
497: --
498: hr_utility.set_location(l_proc, 30);
499: --
500: sqlstr := 'select distinct person_id '||
501: 'from per_people_f ppf, '||
502: 'pay_payroll_actions ppa '||
504: 'and ppa.business_group_id = ppf.business_group_id '||
505: 'order by ppf.person_id';
506:
507: --
508: hr_utility.set_location('Leaving: '||l_proc, 100);
509: --
510: -- hr_utility.trace_off;
511: EXCEPTION
512: WHEN OTHERS THEN
506:
507: --
508: hr_utility.set_location('Leaving: '||l_proc, 100);
509: --
510: -- hr_utility.trace_off;
511: EXCEPTION
512: WHEN OTHERS THEN
513: -- Return cursor that selects no rows
514: sqlstr := 'select 1 '||
514: sqlstr := 'select 1 '||
515: '/* ERROR - Employer Details Fetch failed with: '||
516: sqlerrm(sqlcode)||' */ '||
517: 'from dual where to_char(:payroll_action_id) = dummy';
518: hr_utility.set_location(' Leaving: '||l_proc,110);
519: END range_cursor;
520:
521: --For Bug 8986543
522: -----------------------------------------------------
555: l_ovn pay_action_information.object_version_number%TYPE;
556: --
557: BEGIN
558: --
559: hr_utility.set_location('Enering: '||l_proc, 10);
560: hr_utility.trace(l_proc||': payroll_action_id='||pactid);
561: --
562: -- Get Employer information
563: OPEN c_employer;
556: --
557: BEGIN
558: --
559: hr_utility.set_location('Enering: '||l_proc, 10);
560: hr_utility.trace(l_proc||': payroll_action_id='||pactid);
561: --
562: -- Get Employer information
563: OPEN c_employer;
564: FETCH c_employer INTO employer_rec;
562: -- Get Employer information
563: OPEN c_employer;
564: FETCH c_employer INTO employer_rec;
565: IF c_employer%NOTFOUND THEN
566: hr_utility.set_location(l_proc, 20);
567: raise NO_DATA_FOUND;
568: END IF;
569: CLOSE c_employer;
570: --
569: CLOSE c_employer;
570: --
571: g_effective_date := employer_rec.effective_Date;
572: --
573: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
574: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
575: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
576: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
577: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
570: --
571: g_effective_date := employer_rec.effective_Date;
572: --
573: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
574: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
575: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
576: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
577: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
578: --
571: g_effective_date := employer_rec.effective_Date;
572: --
573: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
574: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
575: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
576: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
577: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
578: --
579: pay_action_information_api.create_action_information (
572: --
573: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
574: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
575: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
576: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
577: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
578: --
579: pay_action_information_api.create_action_information (
580: p_action_information_id => l_action_info_id
573: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
574: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
575: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
576: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
577: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
578: --
579: pay_action_information_api.create_action_information (
580: p_action_information_id => l_action_info_id
581: , p_action_context_id => pactid
590: , p_action_information2 => upper(employer_rec.employer_name)
591: , p_action_information3 => upper(employer_rec.tax_district_name)
592: , p_action_information4 => upper(employer_rec.employer_address_line));
593: --
594: hr_utility.set_location(l_proc, 30);
595: --
596: sqlstr := 'select distinct person_id '||
597: 'from per_people_f ppf, '||
598: 'pay_payroll_actions ppa '||
600: 'and ppa.business_group_id = ppf.business_group_id '||
601: 'order by ppf.person_id';
602:
603: --
604: hr_utility.set_location('Leaving: '||l_proc, 100);
605: --
606: -- hr_utility.trace_off;
607: EXCEPTION
608: WHEN OTHERS THEN
602:
603: --
604: hr_utility.set_location('Leaving: '||l_proc, 100);
605: --
606: -- hr_utility.trace_off;
607: EXCEPTION
608: WHEN OTHERS THEN
609: -- Return cursor that selects no rows
610: sqlstr := 'select 1 '||
610: sqlstr := 'select 1 '||
611: '/* ERROR - Employer Details Fetch failed with: '||
612: sqlerrm(sqlcode)||' */ '||
613: 'from dual where to_char(:payroll_action_id) = dummy';
614: hr_utility.set_location(' Leaving: '||l_proc,110);
615: END range_code_v3;
616:
617:
618: --For Bug 10095492
652: l_ovn pay_action_information.object_version_number%TYPE;
653: --
654: BEGIN
655: --
656: hr_utility.set_location('Enering: '||l_proc, 10);
657: hr_utility.trace(l_proc||': payroll_action_id='||pactid);
658: --
659: -- Get Employer information
660: OPEN c_employer;
653: --
654: BEGIN
655: --
656: hr_utility.set_location('Enering: '||l_proc, 10);
657: hr_utility.trace(l_proc||': payroll_action_id='||pactid);
658: --
659: -- Get Employer information
660: OPEN c_employer;
661: FETCH c_employer INTO employer_rec;
659: -- Get Employer information
660: OPEN c_employer;
661: FETCH c_employer INTO employer_rec;
662: IF c_employer%NOTFOUND THEN
663: hr_utility.set_location(l_proc, 20);
664: raise NO_DATA_FOUND;
665: END IF;
666: CLOSE c_employer;
667: --
666: CLOSE c_employer;
667: --
668: g_effective_date := employer_rec.effective_Date;
669: --
670: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
671: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
672: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
673: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
674: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
667: --
668: g_effective_date := employer_rec.effective_Date;
669: --
670: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
671: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
672: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
673: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
674: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
675: --
668: g_effective_date := employer_rec.effective_Date;
669: --
670: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
671: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
672: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
673: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
674: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
675: --
676: pay_action_information_api.create_action_information (
669: --
670: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
671: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
672: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
673: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
674: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
675: --
676: pay_action_information_api.create_action_information (
677: p_action_information_id => l_action_info_id
670: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
671: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
672: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
673: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
674: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
675: --
676: pay_action_information_api.create_action_information (
677: p_action_information_id => l_action_info_id
678: , p_action_context_id => pactid
687: , p_action_information2 => upper(employer_rec.employer_name)
688: , p_action_information3 => upper(employer_rec.tax_district_name)
689: , p_action_information4 => upper(employer_rec.employer_address_line));
690: --
691: hr_utility.set_location(l_proc, 30);
692: --
693: sqlstr := 'select distinct person_id '||
694: 'from per_people_f ppf, '||
695: 'pay_payroll_actions ppa '||
697: 'and ppa.business_group_id = ppf.business_group_id '||
698: 'order by ppf.person_id';
699:
700: --
701: hr_utility.set_location('Leaving: '||l_proc, 100);
702: --
703: -- hr_utility.trace_off;
704: EXCEPTION
705: WHEN OTHERS THEN
699:
700: --
701: hr_utility.set_location('Leaving: '||l_proc, 100);
702: --
703: -- hr_utility.trace_off;
704: EXCEPTION
705: WHEN OTHERS THEN
706: -- Return cursor that selects no rows
707: sqlstr := 'select 1 '||
707: sqlstr := 'select 1 '||
708: '/* ERROR - Employer Details Fetch failed with: '||
709: sqlerrm(sqlcode)||' */ '||
710: 'from dual where to_char(:payroll_action_id) = dummy';
711: hr_utility.set_location(' Leaving: '||l_proc,110);
712: END range_code_v4;
713:
714: --For Bug 13400872
715: -----------------------------------------------------
748: l_ovn pay_action_information.object_version_number%TYPE;
749: --
750: BEGIN
751: --
752: hr_utility.set_location('Enering: '||l_proc, 10);
753: hr_utility.trace(l_proc||': payroll_action_id='||pactid);
754: --
755: -- Get Employer information
756: OPEN c_employer;
749: --
750: BEGIN
751: --
752: hr_utility.set_location('Enering: '||l_proc, 10);
753: hr_utility.trace(l_proc||': payroll_action_id='||pactid);
754: --
755: -- Get Employer information
756: OPEN c_employer;
757: FETCH c_employer INTO employer_rec;
755: -- Get Employer information
756: OPEN c_employer;
757: FETCH c_employer INTO employer_rec;
758: IF c_employer%NOTFOUND THEN
759: hr_utility.set_location(l_proc, 20);
760: raise NO_DATA_FOUND;
761: END IF;
762: CLOSE c_employer;
763: --
762: CLOSE c_employer;
763: --
764: g_effective_date := employer_rec.effective_Date;
765: --
766: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
767: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
768: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
769: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
770: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
763: --
764: g_effective_date := employer_rec.effective_Date;
765: --
766: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
767: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
768: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
769: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
770: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
771: --
764: g_effective_date := employer_rec.effective_Date;
765: --
766: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
767: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
768: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
769: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
770: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
771: --
772: pay_action_information_api.create_action_information (
765: --
766: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
767: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
768: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
769: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
770: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
771: --
772: pay_action_information_api.create_action_information (
773: p_action_information_id => l_action_info_id
766: hr_utility.trace(l_proc||': employer_name='||employer_rec.employer_name);
767: hr_utility.trace(l_proc||': employer_address_line='||employer_rec.employer_address_line);
768: hr_utility.trace(l_proc||': tax_district_name='||employer_rec.tax_district_name);
769: hr_utility.trace(l_proc||': organization_id='||employer_rec.organization_id);
770: hr_utility.trace(l_proc||': effective_Date='||fnd_date.date_to_displaydate(employer_rec.effective_date));
771: --
772: pay_action_information_api.create_action_information (
773: p_action_information_id => l_action_info_id
774: , p_action_context_id => pactid
783: , p_action_information2 => upper(employer_rec.employer_name)
784: , p_action_information3 => upper(employer_rec.tax_district_name)
785: , p_action_information4 => upper(employer_rec.employer_address_line));
786: --
787: hr_utility.set_location(l_proc, 30);
788: --
789: sqlstr := 'select distinct person_id '||
790: 'from per_people_f ppf, '||
791: 'pay_payroll_actions ppa '||
793: 'and ppa.business_group_id = ppf.business_group_id '||
794: 'order by ppf.person_id';
795:
796: --
797: hr_utility.set_location('Leaving: '||l_proc, 100);
798: --
799: -- hr_utility.trace_off;
800: EXCEPTION
801: WHEN OTHERS THEN
795:
796: --
797: hr_utility.set_location('Leaving: '||l_proc, 100);
798: --
799: -- hr_utility.trace_off;
800: EXCEPTION
801: WHEN OTHERS THEN
802: -- Return cursor that selects no rows
803: sqlstr := 'select 1 '||
803: sqlstr := 'select 1 '||
804: '/* ERROR - Employer Details Fetch failed with: '||
805: sqlerrm(sqlcode)||' */ '||
806: 'from dual where to_char(:payroll_action_id) = dummy';
807: hr_utility.set_location(' Leaving: '||l_proc,110);
808: END range_code_v5;
809:
810:
811: --For Bug 6652235
875: l_create_assact_flag VARCHAR2(1);
876: l_action_flag VARCHAR2(1);
877: l_archived_flag VARCHAR2(1);
878: BEGIN
879: --hr_utility.trace_on(null, 'KTHAMPAN');
880: hr_utility.set_location('Entering '||l_proc, 10);
881: --
882: OPEN c_param_values;
883: FETCH c_param_values INTO g_payroll_id,
876: l_action_flag VARCHAR2(1);
877: l_archived_flag VARCHAR2(1);
878: BEGIN
879: --hr_utility.trace_on(null, 'KTHAMPAN');
880: hr_utility.set_location('Entering '||l_proc, 10);
881: --
882: OPEN c_param_values;
883: FETCH c_param_values INTO g_payroll_id,
884: g_tax_ref,
887: g_end_date,
888: g_business_group_id;
889: CLOSE c_param_values;
890: --
891: hr_utility.set_location(l_proc, 15);
892: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
893: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
894: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
895: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
888: g_business_group_id;
889: CLOSE c_param_values;
890: --
891: hr_utility.set_location(l_proc, 15);
892: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
893: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
894: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
895: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
896: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
889: CLOSE c_param_values;
890: --
891: hr_utility.set_location(l_proc, 15);
892: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
893: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
894: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
895: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
896: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
897: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
890: --
891: hr_utility.set_location(l_proc, 15);
892: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
893: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
894: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
895: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
896: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
897: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
898: For asg_rec IN c_asg
891: hr_utility.set_location(l_proc, 15);
892: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
893: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
894: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
895: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
896: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
897: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
898: For asg_rec IN c_asg
899: LOOP
892: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
893: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
894: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
895: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
896: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
897: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
898: For asg_rec IN c_asg
899: LOOP
900: -- Loop through all assignments
893: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
894: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
895: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
896: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
897: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
898: For asg_rec IN c_asg
899: LOOP
900: -- Loop through all assignments
901: hr_utility.set_location(l_proc, 20);
897: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
898: For asg_rec IN c_asg
899: LOOP
900: -- Loop through all assignments
901: hr_utility.set_location(l_proc, 20);
902: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
903: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
904: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
905: --
898: For asg_rec IN c_asg
899: LOOP
900: -- Loop through all assignments
901: hr_utility.set_location(l_proc, 20);
902: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
903: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
904: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
905: --
906: l_create_assact_flag := 'N';
899: LOOP
900: -- Loop through all assignments
901: hr_utility.set_location(l_proc, 20);
902: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
903: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
904: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
905: --
906: l_create_assact_flag := 'N';
907: --
900: -- Loop through all assignments
901: hr_utility.set_location(l_proc, 20);
902: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
903: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
904: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
905: --
906: l_create_assact_flag := 'N';
907: --
908: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
907: --
908: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
909: -- Loop through all vehicle allocations
910: -- over the date range
911: hr_utility.set_location(l_proc, 30);
912: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
913: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
914: --
915: L_action_flag := 'X';
908: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
909: -- Loop through all vehicle allocations
910: -- over the date range
911: hr_utility.set_location(l_proc, 30);
912: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
913: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
914: --
915: L_action_flag := 'X';
916: l_archived_flag := 'Y';
909: -- Loop through all vehicle allocations
910: -- over the date range
911: hr_utility.set_location(l_proc, 30);
912: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
913: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
914: --
915: L_action_flag := 'X';
916: l_archived_flag := 'Y';
917: --
918: OPEN c_alloc_dates(alc_rec.vehicle_allocation_id);
919: FETCH c_alloc_dates INTO alc_dates_rec;
920: CLOSE c_alloc_dates;
921: --
922: hr_utility.set_location(l_proc, 40);
923: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
924: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
925: --
926: -- Check whether vehicle was allocated or
919: FETCH c_alloc_dates INTO alc_dates_rec;
920: CLOSE c_alloc_dates;
921: --
922: hr_utility.set_location(l_proc, 40);
923: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
924: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
925: --
926: -- Check whether vehicle was allocated or
927: -- Withdrawn within the date range also
920: CLOSE c_alloc_dates;
921: --
922: hr_utility.set_location(l_proc, 40);
923: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
924: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
925: --
926: -- Check whether vehicle was allocated or
927: -- Withdrawn within the date range also
928: -- check that this allocation or withdrawal
942: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.min_start_date);
943: FETCH c_first_asg INTO first_asg_rec;
944: CLOSE c_first_asg;
945: --
946: hr_utility.set_location(l_proc, 50);
947: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
948: -- Get primary car allocation of the
949: -- first assignment of this person
950: -- in this tax ref
943: FETCH c_first_asg INTO first_asg_rec;
944: CLOSE c_first_asg;
945: --
946: hr_utility.set_location(l_proc, 50);
947: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
948: -- Get primary car allocation of the
949: -- first assignment of this person
950: -- in this tax ref
951: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
951: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
952: FETCH c_primary_car INTO primary_car_rec;
953: CLOSE c_primary_car;
954: --
955: hr_utility.set_location(l_proc, 60);
956: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
957: --
958: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
959: -- This is the first car allocation
952: FETCH c_primary_car INTO primary_car_rec;
953: CLOSE c_primary_car;
954: --
955: hr_utility.set_location(l_proc, 60);
956: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
957: --
958: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
959: -- This is the first car allocation
960: -- of this employee in this tax ref
967: ELSE
968: L_action_flag := 'N';
969: END IF;
970: --
971: hr_utility.set_location(l_proc, 70);
972: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
973: --
974: CLOSE c_prior_prim_car;
975: ELSE
968: L_action_flag := 'N';
969: END IF;
970: --
971: hr_utility.set_location(l_proc, 70);
972: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
973: --
974: CLOSE c_prior_prim_car;
975: ELSE
976: -- Not the first car of the employee
977: -- report this as new car
978: L_action_flag := 'N';
979: END IF;
980: --
981: hr_utility.set_location(l_proc, 80);
982: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
983: --
984: ELSE
985: -- Not a primary car therefore mark
978: L_action_flag := 'N';
979: END IF;
980: --
981: hr_utility.set_location(l_proc, 80);
982: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
983: --
984: ELSE
985: -- Not a primary car therefore mark
986: -- it as new car allocation action
986: -- it as new car allocation action
987: l_action_flag := 'N';
988: END IF;
989: --
990: hr_utility.set_location(l_proc, 90);
991: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
992: --
993: IF L_action_flag <> 'X' THEN
994: -- Check whether this allocation action
987: l_action_flag := 'N';
988: END IF;
989: --
990: hr_utility.set_location(l_proc, 90);
991: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
992: --
993: IF L_action_flag <> 'X' THEN
994: -- Check whether this allocation action
995: -- has been already archived
998: alc_rec.vehicle_allocation_id,
999: alc_dates_rec.min_start_date,
1000: l_action_flag);
1001: --
1002: hr_utility.set_location(l_proc, 100);
1003: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1004: --
1005: IF l_archived_flag = 'N' THEN
1006: -- Action has not been archived already
999: alc_dates_rec.min_start_date,
1000: l_action_flag);
1001: --
1002: hr_utility.set_location(l_proc, 100);
1003: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1004: --
1005: IF l_archived_flag = 'N' THEN
1006: -- Action has not been archived already
1007: -- therefore create assignment action
1028: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.max_end_date);
1029: FETCH c_first_asg INTO first_asg_rec;
1030: CLOSE c_first_asg;
1031: --
1032: hr_utility.set_location(l_proc, 50);
1033: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
1034: -- Get primary car allocation of the
1035: -- first assignment of this person
1036: -- in this tax ref
1029: FETCH c_first_asg INTO first_asg_rec;
1030: CLOSE c_first_asg;
1031: --
1032: hr_utility.set_location(l_proc, 50);
1033: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
1034: -- Get primary car allocation of the
1035: -- first assignment of this person
1036: -- in this tax ref
1037: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
1037: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
1038: FETCH c_primary_car INTO primary_car_rec;
1039: CLOSE c_primary_car;
1040: --
1041: hr_utility.set_location(l_proc, 60);
1042: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
1043: --
1044: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
1045: --
1038: FETCH c_primary_car INTO primary_car_rec;
1039: CLOSE c_primary_car;
1040: --
1041: hr_utility.set_location(l_proc, 60);
1042: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
1043: --
1044: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
1045: --
1046: OPEN c_next_prim_car(asg_rec.assignment_id, Alc_dates_rec.max_end_date);
1054: -- This is a withdrawal action
1055: L_action_flag := 'W';
1056: END IF;
1057: --
1058: hr_utility.set_location(l_proc, 70);
1059: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1060: --
1061: CLOSE c_next_prim_car;
1062: ELSE
1055: L_action_flag := 'W';
1056: END IF;
1057: --
1058: hr_utility.set_location(l_proc, 70);
1059: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1060: --
1061: CLOSE c_next_prim_car;
1062: ELSE
1063: -- Not the first car of the employee
1065: L_action_flag := 'W';
1066: END IF;
1067: --
1068: --
1069: hr_utility.set_location(l_proc, 80);
1070: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1071: --
1072: ELSE
1073: -- Not a first car therefore mark
1066: END IF;
1067: --
1068: --
1069: hr_utility.set_location(l_proc, 80);
1070: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1071: --
1072: ELSE
1073: -- Not a first car therefore mark
1074: -- it as withdrawal car action
1074: -- it as withdrawal car action
1075: l_action_flag := 'W';
1076: END IF;
1077: --
1078: hr_utility.set_location(l_proc, 90);
1079: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1080: --
1081: IF L_action_flag <> 'X' THEN
1082: -- Check whether this allocation action
1075: l_action_flag := 'W';
1076: END IF;
1077: --
1078: hr_utility.set_location(l_proc, 90);
1079: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1080: --
1081: IF L_action_flag <> 'X' THEN
1082: -- Check whether this allocation action
1083: -- has been already archived
1086: alc_rec.vehicle_allocation_id,
1087: alc_dates_rec.min_start_date,
1088: l_action_flag);
1089: --
1090: hr_utility.set_location(l_proc, 100);
1091: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1092: --
1093: IF l_archived_flag = 'N' THEN
1094: -- Action has not been archived already
1087: alc_dates_rec.min_start_date,
1088: l_action_flag);
1089: --
1090: hr_utility.set_location(l_proc, 100);
1091: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1092: --
1093: IF l_archived_flag = 'N' THEN
1094: -- Action has not been archived already
1095: -- therefore create assignment action
1103: -- Fuel type has changed therefore make sure
1104: -- this change occured after the vehicle was
1105: -- allocated to this assignment
1106: --
1107: hr_utility.set_location(l_proc, 110);
1108: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
1109: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
1110: --
1111: IF (vehicle_changes_rec.effective_start_date
1104: -- this change occured after the vehicle was
1105: -- allocated to this assignment
1106: --
1107: hr_utility.set_location(l_proc, 110);
1108: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
1109: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
1110: --
1111: IF (vehicle_changes_rec.effective_start_date
1112: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
1105: -- allocated to this assignment
1106: --
1107: hr_utility.set_location(l_proc, 110);
1108: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
1109: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
1110: --
1111: IF (vehicle_changes_rec.effective_start_date
1112: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
1113: (vehicle_changes_rec.effective_start_date
1120: alc_rec.vehicle_allocation_id,
1121: vehicle_changes_rec.effective_start_date,
1122: 'F');
1123: --
1124: hr_utility.set_location(l_proc, 120);
1125: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1126: --
1127: IF l_archived_flag = 'N' THEN
1128: -- Action has not been archived already
1121: vehicle_changes_rec.effective_start_date,
1122: 'F');
1123: --
1124: hr_utility.set_location(l_proc, 120);
1125: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1126: --
1127: IF l_archived_flag = 'N' THEN
1128: -- Action has not been archived already
1129: -- therefore create assignment action
1132: END IF;
1133: END IF;
1134: END LOOP;
1135: --
1136: hr_utility.set_location(l_proc, 130);
1137: --
1138: --
1139: L_action_flag := 'X';
1140: l_archived_flag := 'Y';
1149: -- Assignment has started on this payroll or tax ref during the
1150: -- input date range and this car allocation was active on the
1151: -- start date therefore check whether it is a transfer
1152: -- from another tax ref
1153: hr_utility.set_location(l_proc, 160);
1154: l_previous_tax_ref := NULL;
1155: --
1156: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
1157: FETCH c_tax_ref INTO l_previous_tax_ref;
1156: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
1157: FETCH c_tax_ref INTO l_previous_tax_ref;
1158: CLOSE c_tax_ref;
1159: --
1160: hr_utility.set_location(l_proc, 170);
1161: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
1162: --
1163: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
1164: -- This assignment has a different prior tax ref
1157: FETCH c_tax_ref INTO l_previous_tax_ref;
1158: CLOSE c_tax_ref;
1159: --
1160: hr_utility.set_location(l_proc, 170);
1161: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
1162: --
1163: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
1164: -- This assignment has a different prior tax ref
1165: -- therefore it should be reported as a new car
1163: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
1164: -- This assignment has a different prior tax ref
1165: -- therefore it should be reported as a new car
1166: -- allocation on this EDI message.
1167: hr_utility.set_location(l_proc, 180);
1168: l_action_flag := 'N';
1169: --
1170: -- Check whether this allocation action
1171: -- has been already archived
1174: alc_rec.vehicle_allocation_id,
1175: asg_rec.asg_min_start_date,
1176: l_action_flag);
1177: --
1178: hr_utility.set_location(l_proc, 190);
1179: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
1180: --
1181: IF l_archived_flag = 'N' THEN
1182: -- Action has not been archived already
1175: asg_rec.asg_min_start_date,
1176: l_action_flag);
1177: --
1178: hr_utility.set_location(l_proc, 190);
1179: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
1180: --
1181: IF l_archived_flag = 'N' THEN
1182: -- Action has not been archived already
1183: -- therefore create assignment action
1195: -- Assignment has ended on this payroll or tax ref during the
1196: -- input date range and this car allocation was active on the
1197: -- end date therefore check whether it is a transfer
1198: -- to another tax ref
1199: hr_utility.set_location(l_proc, 200);
1200: l_next_tax_ref := NULL;
1201: --
1202: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
1203: FETCH c_tax_ref INTO l_next_tax_ref;
1202: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
1203: FETCH c_tax_ref INTO l_next_tax_ref;
1204: CLOSE c_tax_ref;
1205: --
1206: hr_utility.set_location(l_proc, 210);
1207: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
1208: --
1209: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
1210: -- This assignment has a different tax ref after end date
1203: FETCH c_tax_ref INTO l_next_tax_ref;
1204: CLOSE c_tax_ref;
1205: --
1206: hr_utility.set_location(l_proc, 210);
1207: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
1208: --
1209: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
1210: -- This assignment has a different tax ref after end date
1211: -- therefore it should be reported as allocation withdrawal
1209: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
1210: -- This assignment has a different tax ref after end date
1211: -- therefore it should be reported as allocation withdrawal
1212: -- on this EDI message.
1213: hr_utility.set_location(l_proc, 220);
1214: l_action_flag := 'W';
1215: --
1216: -- Check whether this allocation action
1217: -- has been already archived
1220: alc_rec.vehicle_allocation_id,
1221: asg_rec.asg_max_end_date,
1222: l_action_flag);
1223: --
1224: hr_utility.set_location(l_proc, 230);
1225: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
1226: --
1227: IF l_archived_flag = 'N' THEN
1228: -- Action has not been archived already
1221: asg_rec.asg_max_end_date,
1222: l_action_flag);
1223: --
1224: hr_utility.set_location(l_proc, 230);
1225: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
1226: --
1227: IF l_archived_flag = 'N' THEN
1228: -- Action has not been archived already
1229: -- therefore create assignment action
1232: --
1233: END IF;
1234: END IF;
1235: --
1236: hr_utility.set_location(l_proc, 240);
1237: --
1238: hr_utility.set_location(l_proc, 250);
1239: END LOOP;
1240: --
1234: END IF;
1235: --
1236: hr_utility.set_location(l_proc, 240);
1237: --
1238: hr_utility.set_location(l_proc, 250);
1239: END LOOP;
1240: --
1241: hr_utility.set_location(l_proc, 260);
1242: --
1237: --
1238: hr_utility.set_location(l_proc, 250);
1239: END LOOP;
1240: --
1241: hr_utility.set_location(l_proc, 260);
1242: --
1243: -- If flag is set then create action
1244: IF l_create_assact_flag = 'Y' THEN
1245: --
1246: SELECT pay_assignment_actions_s.nextval
1247: INTO l_actid
1248: FROM dual;
1249:
1250: hr_utility.set_location(l_proc, 270);
1251: hr_utility.trace(l_proc||': l_actid='||l_actid);
1252: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
1253: hr_utility.trace(l_proc||': pactid='||pactid);
1254: hr_utility.trace(l_proc||': chunk='||chunk);
1247: INTO l_actid
1248: FROM dual;
1249:
1250: hr_utility.set_location(l_proc, 270);
1251: hr_utility.trace(l_proc||': l_actid='||l_actid);
1252: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
1253: hr_utility.trace(l_proc||': pactid='||pactid);
1254: hr_utility.trace(l_proc||': chunk='||chunk);
1255: --
1248: FROM dual;
1249:
1250: hr_utility.set_location(l_proc, 270);
1251: hr_utility.trace(l_proc||': l_actid='||l_actid);
1252: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
1253: hr_utility.trace(l_proc||': pactid='||pactid);
1254: hr_utility.trace(l_proc||': chunk='||chunk);
1255: --
1256: hr_nonrun_asact.insact(l_actid,
1249:
1250: hr_utility.set_location(l_proc, 270);
1251: hr_utility.trace(l_proc||': l_actid='||l_actid);
1252: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
1253: hr_utility.trace(l_proc||': pactid='||pactid);
1254: hr_utility.trace(l_proc||': chunk='||chunk);
1255: --
1256: hr_nonrun_asact.insact(l_actid,
1257: asg_rec.assignment_id,
1250: hr_utility.set_location(l_proc, 270);
1251: hr_utility.trace(l_proc||': l_actid='||l_actid);
1252: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
1253: hr_utility.trace(l_proc||': pactid='||pactid);
1254: hr_utility.trace(l_proc||': chunk='||chunk);
1255: --
1256: hr_nonrun_asact.insact(l_actid,
1257: asg_rec.assignment_id,
1258: pactid,
1257: asg_rec.assignment_id,
1258: pactid,
1259: chunk, NULL);
1260: --
1261: hr_utility.set_location(l_proc, 280);
1262: --
1263: END IF;
1264: END LOOP;
1265: --
1262: --
1263: END IF;
1264: END LOOP;
1265: --
1266: hr_utility.set_location('Leaving: '||l_proc,290);
1267: -- hr_utility.trace_off;
1268: EXCEPTION
1269: WHEN OTHERS THEN
1270: hr_utility.set_location('Leaving: '||l_proc,300);
1263: END IF;
1264: END LOOP;
1265: --
1266: hr_utility.set_location('Leaving: '||l_proc,290);
1267: -- hr_utility.trace_off;
1268: EXCEPTION
1269: WHEN OTHERS THEN
1270: hr_utility.set_location('Leaving: '||l_proc,300);
1271: -- hr_utility.trace_off;
1266: hr_utility.set_location('Leaving: '||l_proc,290);
1267: -- hr_utility.trace_off;
1268: EXCEPTION
1269: WHEN OTHERS THEN
1270: hr_utility.set_location('Leaving: '||l_proc,300);
1271: -- hr_utility.trace_off;
1272: raise;
1273: END Create_asg_act_v2;
1274:
1267: -- hr_utility.trace_off;
1268: EXCEPTION
1269: WHEN OTHERS THEN
1270: hr_utility.set_location('Leaving: '||l_proc,300);
1271: -- hr_utility.trace_off;
1272: raise;
1273: END Create_asg_act_v2;
1274:
1275:
1342: l_archived_flag VARCHAR2(1);
1343: l_private_start_dt date;
1344: l_latest_private_flag varchar2(1);
1345: BEGIN
1346: --hr_utility.trace_on(null, 'KTHAMPAN');
1347: hr_utility.set_location('Entering '||l_proc, 10);
1348: --
1349: OPEN c_param_values;
1350: FETCH c_param_values INTO g_payroll_id,
1343: l_private_start_dt date;
1344: l_latest_private_flag varchar2(1);
1345: BEGIN
1346: --hr_utility.trace_on(null, 'KTHAMPAN');
1347: hr_utility.set_location('Entering '||l_proc, 10);
1348: --
1349: OPEN c_param_values;
1350: FETCH c_param_values INTO g_payroll_id,
1351: g_tax_ref,
1354: g_end_date,
1355: g_business_group_id;
1356: CLOSE c_param_values;
1357: --
1358: hr_utility.set_location(l_proc, 15);
1359: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1360: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1361: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1362: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1355: g_business_group_id;
1356: CLOSE c_param_values;
1357: --
1358: hr_utility.set_location(l_proc, 15);
1359: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1360: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1361: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1362: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1363: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1356: CLOSE c_param_values;
1357: --
1358: hr_utility.set_location(l_proc, 15);
1359: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1360: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1361: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1362: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1363: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1364: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1357: --
1358: hr_utility.set_location(l_proc, 15);
1359: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1360: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1361: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1362: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1363: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1364: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1365: For asg_rec IN c_asg
1358: hr_utility.set_location(l_proc, 15);
1359: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1360: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1361: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1362: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1363: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1364: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1365: For asg_rec IN c_asg
1366: LOOP
1359: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1360: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1361: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1362: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1363: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1364: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1365: For asg_rec IN c_asg
1366: LOOP
1367: -- Loop through all assignments
1360: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1361: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1362: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1363: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1364: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1365: For asg_rec IN c_asg
1366: LOOP
1367: -- Loop through all assignments
1368: hr_utility.set_location(l_proc, 20);
1364: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1365: For asg_rec IN c_asg
1366: LOOP
1367: -- Loop through all assignments
1368: hr_utility.set_location(l_proc, 20);
1369: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
1370: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1371: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1372: --
1365: For asg_rec IN c_asg
1366: LOOP
1367: -- Loop through all assignments
1368: hr_utility.set_location(l_proc, 20);
1369: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
1370: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1371: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1372: --
1373: l_create_assact_flag := 'N';
1366: LOOP
1367: -- Loop through all assignments
1368: hr_utility.set_location(l_proc, 20);
1369: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
1370: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1371: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1372: --
1373: l_create_assact_flag := 'N';
1374: --
1367: -- Loop through all assignments
1368: hr_utility.set_location(l_proc, 20);
1369: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
1370: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1371: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1372: --
1373: l_create_assact_flag := 'N';
1374: --
1375: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
1374: --
1375: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
1376: -- Loop through all vehicle allocations
1377: -- over the date range
1378: hr_utility.set_location(l_proc, 30);
1379: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
1380: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
1381: --
1382: L_action_flag := 'X';
1375: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
1376: -- Loop through all vehicle allocations
1377: -- over the date range
1378: hr_utility.set_location(l_proc, 30);
1379: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
1380: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
1381: --
1382: L_action_flag := 'X';
1383: l_archived_flag := 'Y';
1376: -- Loop through all vehicle allocations
1377: -- over the date range
1378: hr_utility.set_location(l_proc, 30);
1379: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
1380: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
1381: --
1382: L_action_flag := 'X';
1383: l_archived_flag := 'Y';
1384: --
1388: open private_flag_check(alc_rec.vehicle_allocation_id);
1389: fetch private_flag_check into l_private_start_dt;
1390: close private_flag_check;
1391:
1392: hr_utility.set_location(l_proc, 32);
1393: hr_utility.trace(l_proc||': l_private_start_dt='||l_private_start_dt);
1394: if l_private_start_dt is not null then
1395: -- Cursor to check if the change was from Y to N i.e. Withdrawal
1396: -- else was it from N to Y i.e. new Benifit
1389: fetch private_flag_check into l_private_start_dt;
1390: close private_flag_check;
1391:
1392: hr_utility.set_location(l_proc, 32);
1393: hr_utility.trace(l_proc||': l_private_start_dt='||l_private_start_dt);
1394: if l_private_start_dt is not null then
1395: -- Cursor to check if the change was from Y to N i.e. Withdrawal
1396: -- else was it from N to Y i.e. new Benifit
1397:
1398: open withdrawal_check(alc_rec.vehicle_allocation_id,l_private_start_dt );
1399: fetch withdrawal_check into l_latest_private_flag;
1400: close withdrawal_check;
1401:
1402: hr_utility.set_location(l_proc, 35);
1403: hr_utility.trace(l_proc||': l_latest_private_flag='||nvl(l_latest_private_flag,'NULL'));
1404:
1405: if l_latest_private_flag = 'Y' then
1406: -- This means the value has changed from N to Y so this is a new benefit
1399: fetch withdrawal_check into l_latest_private_flag;
1400: close withdrawal_check;
1401:
1402: hr_utility.set_location(l_proc, 35);
1403: hr_utility.trace(l_proc||': l_latest_private_flag='||nvl(l_latest_private_flag,'NULL'));
1404:
1405: if l_latest_private_flag = 'Y' then
1406: -- This means the value has changed from N to Y so this is a new benefit
1407: L_action_flag := 'N';
1418: alc_rec.vehicle_allocation_id,
1419: l_private_start_dt,
1420: l_action_flag);
1421: --
1422: hr_utility.set_location(l_proc, 38);
1423: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1424: --
1425: IF l_archived_flag = 'N' THEN
1426: -- Action has not been archived already
1419: l_private_start_dt,
1420: l_action_flag);
1421: --
1422: hr_utility.set_location(l_proc, 38);
1423: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1424: --
1425: IF l_archived_flag = 'N' THEN
1426: -- Action has not been archived already
1427: -- therefore create assignment action
1441: OPEN c_alloc_dates(alc_rec.vehicle_allocation_id);
1442: FETCH c_alloc_dates INTO alc_dates_rec;
1443: CLOSE c_alloc_dates;
1444: --
1445: hr_utility.set_location(l_proc, 40);
1446: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1447: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
1448: --
1449: -- Check whether vehicle was allocated or
1442: FETCH c_alloc_dates INTO alc_dates_rec;
1443: CLOSE c_alloc_dates;
1444: --
1445: hr_utility.set_location(l_proc, 40);
1446: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1447: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
1448: --
1449: -- Check whether vehicle was allocated or
1450: -- Withdrawn within the date range also
1443: CLOSE c_alloc_dates;
1444: --
1445: hr_utility.set_location(l_proc, 40);
1446: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1447: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
1448: --
1449: -- Check whether vehicle was allocated or
1450: -- Withdrawn within the date range also
1451: -- check that this allocation or withdrawal
1449: -- Check whether vehicle was allocated or
1450: -- Withdrawn within the date range also
1451: -- check that this allocation or withdrawal
1452: -- happened when assignment was with input tax ref
1453: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1454: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1455: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1456: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
1457: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
1450: -- Withdrawn within the date range also
1451: -- check that this allocation or withdrawal
1452: -- happened when assignment was with input tax ref
1453: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1454: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1455: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1456: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
1457: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
1458: (alc_dates_rec.min_start_date BETWEEN asg_rec.asg_min_start_date AND asg_rec.asg_max_end_date) THEN
1451: -- check that this allocation or withdrawal
1452: -- happened when assignment was with input tax ref
1453: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1454: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1455: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1456: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
1457: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
1458: (alc_dates_rec.min_start_date BETWEEN asg_rec.asg_min_start_date AND asg_rec.asg_max_end_date) THEN
1459: --
1452: -- happened when assignment was with input tax ref
1453: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1454: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1455: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1456: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
1457: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
1458: (alc_dates_rec.min_start_date BETWEEN asg_rec.asg_min_start_date AND asg_rec.asg_max_end_date) THEN
1459: --
1460: -- This is a New Car or replacement action
1469: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.min_start_date);
1470: FETCH c_first_asg INTO first_asg_rec;
1471: CLOSE c_first_asg;
1472: --
1473: hr_utility.set_location(l_proc, 50);
1474: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
1475: -- Get primary car allocation of the
1476: -- first assignment of this person
1477: -- in this tax ref
1470: FETCH c_first_asg INTO first_asg_rec;
1471: CLOSE c_first_asg;
1472: --
1473: hr_utility.set_location(l_proc, 50);
1474: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
1475: -- Get primary car allocation of the
1476: -- first assignment of this person
1477: -- in this tax ref
1478: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
1478: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
1479: FETCH c_primary_car INTO primary_car_rec;
1480: CLOSE c_primary_car;
1481: --
1482: hr_utility.set_location(l_proc, 60);
1483: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
1484: --
1485: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
1486: -- This is the first car allocation
1479: FETCH c_primary_car INTO primary_car_rec;
1480: CLOSE c_primary_car;
1481: --
1482: hr_utility.set_location(l_proc, 60);
1483: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
1484: --
1485: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
1486: -- This is the first car allocation
1487: -- of this employee in this tax ref
1494: ELSE
1495: L_action_flag := 'N';
1496: END IF;
1497: --
1498: hr_utility.set_location(l_proc, 70);
1499: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1500: --
1501: CLOSE c_prior_prim_car;
1502: ELSE
1495: L_action_flag := 'N';
1496: END IF;
1497: --
1498: hr_utility.set_location(l_proc, 70);
1499: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1500: --
1501: CLOSE c_prior_prim_car;
1502: ELSE
1503: -- Not the first car of the employee
1504: -- report this as new car
1505: L_action_flag := 'N';
1506: END IF;
1507: --
1508: hr_utility.set_location(l_proc, 80);
1509: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1510: --
1511: ELSE
1512: -- Not a primary car therefore mark
1505: L_action_flag := 'N';
1506: END IF;
1507: --
1508: hr_utility.set_location(l_proc, 80);
1509: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1510: --
1511: ELSE
1512: -- Not a primary car therefore mark
1513: -- it as new car allocation action
1513: -- it as new car allocation action
1514: l_action_flag := 'N';
1515: END IF;
1516: --
1517: hr_utility.set_location(l_proc, 90);
1518: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1519: --
1520: IF L_action_flag <> 'X' THEN
1521: -- Check whether this allocation action
1514: l_action_flag := 'N';
1515: END IF;
1516: --
1517: hr_utility.set_location(l_proc, 90);
1518: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1519: --
1520: IF L_action_flag <> 'X' THEN
1521: -- Check whether this allocation action
1522: -- has been already archived
1525: alc_rec.vehicle_allocation_id,
1526: alc_dates_rec.min_start_date,
1527: l_action_flag);
1528: --
1529: hr_utility.set_location(l_proc, 100);
1530: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1531: --
1532: IF l_archived_flag = 'N' THEN
1533: -- Action has not been archived already
1526: alc_dates_rec.min_start_date,
1527: l_action_flag);
1528: --
1529: hr_utility.set_location(l_proc, 100);
1530: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1531: --
1532: IF l_archived_flag = 'N' THEN
1533: -- Action has not been archived already
1534: -- therefore create assignment action
1562: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.max_end_date);
1563: FETCH c_first_asg INTO first_asg_rec;
1564: CLOSE c_first_asg;
1565: --
1566: hr_utility.set_location(l_proc, 50);
1567: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
1568: -- Get primary car allocation of the
1569: -- first assignment of this person
1570: -- in this tax ref
1563: FETCH c_first_asg INTO first_asg_rec;
1564: CLOSE c_first_asg;
1565: --
1566: hr_utility.set_location(l_proc, 50);
1567: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
1568: -- Get primary car allocation of the
1569: -- first assignment of this person
1570: -- in this tax ref
1571: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
1571: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
1572: FETCH c_primary_car INTO primary_car_rec;
1573: CLOSE c_primary_car;
1574: --
1575: hr_utility.set_location(l_proc, 60);
1576: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
1577: --
1578: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
1579: --
1572: FETCH c_primary_car INTO primary_car_rec;
1573: CLOSE c_primary_car;
1574: --
1575: hr_utility.set_location(l_proc, 60);
1576: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
1577: --
1578: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
1579: --
1580: OPEN c_next_prim_car(asg_rec.assignment_id, Alc_dates_rec.max_end_date);
1588: -- This is a withdrawal action
1589: L_action_flag := 'W';
1590: END IF;
1591: --
1592: hr_utility.set_location(l_proc, 70);
1593: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1594: --
1595: CLOSE c_next_prim_car;
1596: ELSE
1589: L_action_flag := 'W';
1590: END IF;
1591: --
1592: hr_utility.set_location(l_proc, 70);
1593: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1594: --
1595: CLOSE c_next_prim_car;
1596: ELSE
1597: -- Not the first car of the employee
1599: L_action_flag := 'W';
1600: END IF;
1601: --
1602: --
1603: hr_utility.set_location(l_proc, 80);
1604: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1605: --
1606: ELSE
1607: -- Not a Primary car therefore mark
1600: END IF;
1601: --
1602: --
1603: hr_utility.set_location(l_proc, 80);
1604: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1605: --
1606: ELSE
1607: -- Not a Primary car therefore mark
1608: -- it as withdrawal car action
1608: -- it as withdrawal car action
1609: l_action_flag := 'W';
1610: END IF;
1611: --
1612: hr_utility.set_location(l_proc, 90);
1613: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1614: --
1615: IF L_action_flag <> 'X' THEN
1616: -- Check whether this allocation action
1609: l_action_flag := 'W';
1610: END IF;
1611: --
1612: hr_utility.set_location(l_proc, 90);
1613: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
1614: --
1615: IF L_action_flag <> 'X' THEN
1616: -- Check whether this allocation action
1617: -- has been already archived
1620: alc_rec.vehicle_allocation_id,
1621: alc_dates_rec.min_start_date,
1622: l_action_flag);
1623: --
1624: hr_utility.set_location(l_proc, 100);
1625: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1626: --
1627: IF l_archived_flag = 'N' THEN
1628: -- Action has not been archived already
1621: alc_dates_rec.min_start_date,
1622: l_action_flag);
1623: --
1624: hr_utility.set_location(l_proc, 100);
1625: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1626: --
1627: IF l_archived_flag = 'N' THEN
1628: -- Action has not been archived already
1629: -- therefore create assignment action
1637: -- Fuel type has changed therefore make sure
1638: -- this change occured after the vehicle was
1639: -- allocated to this assignment
1640: --
1641: hr_utility.set_location(l_proc, 110);
1642: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
1643: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
1644: --
1645: IF (vehicle_changes_rec.effective_start_date
1638: -- this change occured after the vehicle was
1639: -- allocated to this assignment
1640: --
1641: hr_utility.set_location(l_proc, 110);
1642: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
1643: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
1644: --
1645: IF (vehicle_changes_rec.effective_start_date
1646: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
1639: -- allocated to this assignment
1640: --
1641: hr_utility.set_location(l_proc, 110);
1642: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
1643: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
1644: --
1645: IF (vehicle_changes_rec.effective_start_date
1646: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
1647: (vehicle_changes_rec.effective_start_date
1654: alc_rec.vehicle_allocation_id,
1655: vehicle_changes_rec.effective_start_date,
1656: 'F');
1657: --
1658: hr_utility.set_location(l_proc, 120);
1659: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1660: --
1661: IF l_archived_flag = 'N' THEN
1662: -- Action has not been archived already
1655: vehicle_changes_rec.effective_start_date,
1656: 'F');
1657: --
1658: hr_utility.set_location(l_proc, 120);
1659: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1660: --
1661: IF l_archived_flag = 'N' THEN
1662: -- Action has not been archived already
1663: -- therefore create assignment action
1666: END IF;
1667: END IF;
1668: END LOOP;
1669: --
1670: hr_utility.set_location(l_proc, 130);
1671: --
1672: --
1673: L_action_flag := 'X';
1674: l_archived_flag := 'Y';
1683: -- Assignment has started on this payroll or tax ref during the
1684: -- input date range and this car allocation was active on the
1685: -- start date therefore check whether it is a transfer
1686: -- from another tax ref
1687: hr_utility.set_location(l_proc, 160);
1688: l_previous_tax_ref := NULL;
1689: --
1690: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
1691: FETCH c_tax_ref INTO l_previous_tax_ref;
1690: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
1691: FETCH c_tax_ref INTO l_previous_tax_ref;
1692: CLOSE c_tax_ref;
1693: --
1694: hr_utility.set_location(l_proc, 170);
1695: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
1696: --
1697: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
1698: -- This assignment has a different prior tax ref
1691: FETCH c_tax_ref INTO l_previous_tax_ref;
1692: CLOSE c_tax_ref;
1693: --
1694: hr_utility.set_location(l_proc, 170);
1695: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
1696: --
1697: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
1698: -- This assignment has a different prior tax ref
1699: -- therefore it should be reported as a new car
1697: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
1698: -- This assignment has a different prior tax ref
1699: -- therefore it should be reported as a new car
1700: -- allocation on this EDI message.
1701: hr_utility.set_location(l_proc, 180);
1702: l_action_flag := 'N';
1703: --
1704: -- Check whether this allocation action
1705: -- has been already archived
1708: alc_rec.vehicle_allocation_id,
1709: asg_rec.asg_min_start_date,
1710: l_action_flag);
1711: --
1712: hr_utility.set_location(l_proc, 190);
1713: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
1714: --
1715: IF l_archived_flag = 'N' THEN
1716: -- Action has not been archived already
1709: asg_rec.asg_min_start_date,
1710: l_action_flag);
1711: --
1712: hr_utility.set_location(l_proc, 190);
1713: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
1714: --
1715: IF l_archived_flag = 'N' THEN
1716: -- Action has not been archived already
1717: -- therefore create assignment action
1729: -- Assignment has ended on this payroll or tax ref during the
1730: -- input date range and this car allocation was active on the
1731: -- end date therefore check whether it is a transfer
1732: -- to another tax ref
1733: hr_utility.set_location(l_proc, 200);
1734: l_next_tax_ref := NULL;
1735: --
1736: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
1737: FETCH c_tax_ref INTO l_next_tax_ref;
1736: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
1737: FETCH c_tax_ref INTO l_next_tax_ref;
1738: CLOSE c_tax_ref;
1739: --
1740: hr_utility.set_location(l_proc, 210);
1741: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
1742: --
1743: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
1744: -- This assignment has a different tax ref after end date
1737: FETCH c_tax_ref INTO l_next_tax_ref;
1738: CLOSE c_tax_ref;
1739: --
1740: hr_utility.set_location(l_proc, 210);
1741: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
1742: --
1743: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
1744: -- This assignment has a different tax ref after end date
1745: -- therefore it should be reported as allocation withdrawal
1743: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
1744: -- This assignment has a different tax ref after end date
1745: -- therefore it should be reported as allocation withdrawal
1746: -- on this EDI message.
1747: hr_utility.set_location(l_proc, 220);
1748: l_action_flag := 'W';
1749: --
1750: -- Check whether this allocation action
1751: -- has been already archived
1754: alc_rec.vehicle_allocation_id,
1755: asg_rec.asg_max_end_date,
1756: l_action_flag);
1757: --
1758: hr_utility.set_location(l_proc, 230);
1759: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
1760: --
1761: IF l_archived_flag = 'N' THEN
1762: -- Action has not been archived already
1755: asg_rec.asg_max_end_date,
1756: l_action_flag);
1757: --
1758: hr_utility.set_location(l_proc, 230);
1759: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
1760: --
1761: IF l_archived_flag = 'N' THEN
1762: -- Action has not been archived already
1763: -- therefore create assignment action
1766: --
1767: END IF;
1768: END IF;
1769: --
1770: hr_utility.set_location(l_proc, 240);
1771: --
1772: hr_utility.set_location(l_proc, 250);
1773: END LOOP;
1774: --
1768: END IF;
1769: --
1770: hr_utility.set_location(l_proc, 240);
1771: --
1772: hr_utility.set_location(l_proc, 250);
1773: END LOOP;
1774: --
1775: hr_utility.set_location(l_proc, 260);
1776: --
1771: --
1772: hr_utility.set_location(l_proc, 250);
1773: END LOOP;
1774: --
1775: hr_utility.set_location(l_proc, 260);
1776: --
1777: -- If flag is set then create action
1778: IF l_create_assact_flag = 'Y' THEN
1779: --
1780: SELECT pay_assignment_actions_s.nextval
1781: INTO l_actid
1782: FROM dual;
1783:
1784: hr_utility.set_location(l_proc, 270);
1785: hr_utility.trace(l_proc||': l_actid='||l_actid);
1786: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
1787: hr_utility.trace(l_proc||': pactid='||pactid);
1788: hr_utility.trace(l_proc||': chunk='||chunk);
1781: INTO l_actid
1782: FROM dual;
1783:
1784: hr_utility.set_location(l_proc, 270);
1785: hr_utility.trace(l_proc||': l_actid='||l_actid);
1786: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
1787: hr_utility.trace(l_proc||': pactid='||pactid);
1788: hr_utility.trace(l_proc||': chunk='||chunk);
1789: --
1782: FROM dual;
1783:
1784: hr_utility.set_location(l_proc, 270);
1785: hr_utility.trace(l_proc||': l_actid='||l_actid);
1786: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
1787: hr_utility.trace(l_proc||': pactid='||pactid);
1788: hr_utility.trace(l_proc||': chunk='||chunk);
1789: --
1790: hr_nonrun_asact.insact(l_actid,
1783:
1784: hr_utility.set_location(l_proc, 270);
1785: hr_utility.trace(l_proc||': l_actid='||l_actid);
1786: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
1787: hr_utility.trace(l_proc||': pactid='||pactid);
1788: hr_utility.trace(l_proc||': chunk='||chunk);
1789: --
1790: hr_nonrun_asact.insact(l_actid,
1791: asg_rec.assignment_id,
1784: hr_utility.set_location(l_proc, 270);
1785: hr_utility.trace(l_proc||': l_actid='||l_actid);
1786: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
1787: hr_utility.trace(l_proc||': pactid='||pactid);
1788: hr_utility.trace(l_proc||': chunk='||chunk);
1789: --
1790: hr_nonrun_asact.insact(l_actid,
1791: asg_rec.assignment_id,
1792: pactid,
1791: asg_rec.assignment_id,
1792: pactid,
1793: chunk, NULL);
1794: --
1795: hr_utility.set_location(l_proc, 280);
1796: --
1797: END IF;
1798: END LOOP;
1799: --
1796: --
1797: END IF;
1798: END LOOP;
1799: --
1800: hr_utility.set_location('Leaving: '||l_proc,290);
1801: -- hr_utility.trace_off;
1802: EXCEPTION
1803: WHEN OTHERS THEN
1804: hr_utility.set_location('Leaving: '||l_proc,300);
1797: END IF;
1798: END LOOP;
1799: --
1800: hr_utility.set_location('Leaving: '||l_proc,290);
1801: -- hr_utility.trace_off;
1802: EXCEPTION
1803: WHEN OTHERS THEN
1804: hr_utility.set_location('Leaving: '||l_proc,300);
1805: -- hr_utility.trace_off;
1800: hr_utility.set_location('Leaving: '||l_proc,290);
1801: -- hr_utility.trace_off;
1802: EXCEPTION
1803: WHEN OTHERS THEN
1804: hr_utility.set_location('Leaving: '||l_proc,300);
1805: -- hr_utility.trace_off;
1806: raise;
1807: END Create_asg_act_v3;
1808:
1801: -- hr_utility.trace_off;
1802: EXCEPTION
1803: WHEN OTHERS THEN
1804: hr_utility.set_location('Leaving: '||l_proc,300);
1805: -- hr_utility.trace_off;
1806: raise;
1807: END Create_asg_act_v3;
1808:
1809:
1876: l_archived_flag VARCHAR2(1);
1877: l_private_start_dt date;
1878: l_latest_private_flag varchar2(1);
1879: BEGIN
1880: --hr_utility.trace_on(null, 'KTHAMPAN');
1881: hr_utility.set_location('Entering '||l_proc, 10);
1882: --
1883: OPEN c_param_values;
1884: FETCH c_param_values INTO g_payroll_id,
1877: l_private_start_dt date;
1878: l_latest_private_flag varchar2(1);
1879: BEGIN
1880: --hr_utility.trace_on(null, 'KTHAMPAN');
1881: hr_utility.set_location('Entering '||l_proc, 10);
1882: --
1883: OPEN c_param_values;
1884: FETCH c_param_values INTO g_payroll_id,
1885: g_tax_ref,
1888: g_end_date,
1889: g_business_group_id;
1890: CLOSE c_param_values;
1891: --
1892: hr_utility.set_location(l_proc, 15);
1893: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1894: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1895: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1896: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1889: g_business_group_id;
1890: CLOSE c_param_values;
1891: --
1892: hr_utility.set_location(l_proc, 15);
1893: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1894: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1895: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1896: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1897: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1890: CLOSE c_param_values;
1891: --
1892: hr_utility.set_location(l_proc, 15);
1893: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1894: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1895: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1896: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1897: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1898: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1891: --
1892: hr_utility.set_location(l_proc, 15);
1893: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1894: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1895: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1896: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1897: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1898: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1899: For asg_rec IN c_asg
1892: hr_utility.set_location(l_proc, 15);
1893: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1894: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1895: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1896: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1897: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1898: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1899: For asg_rec IN c_asg
1900: LOOP
1893: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
1894: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1895: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1896: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1897: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1898: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1899: For asg_rec IN c_asg
1900: LOOP
1901: -- Loop through all assignments
1894: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
1895: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
1896: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
1897: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
1898: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1899: For asg_rec IN c_asg
1900: LOOP
1901: -- Loop through all assignments
1902: hr_utility.set_location(l_proc, 20);
1898: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
1899: For asg_rec IN c_asg
1900: LOOP
1901: -- Loop through all assignments
1902: hr_utility.set_location(l_proc, 20);
1903: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
1904: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1905: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1906: --
1899: For asg_rec IN c_asg
1900: LOOP
1901: -- Loop through all assignments
1902: hr_utility.set_location(l_proc, 20);
1903: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
1904: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1905: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1906: --
1907: l_create_assact_flag := 'N';
1900: LOOP
1901: -- Loop through all assignments
1902: hr_utility.set_location(l_proc, 20);
1903: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
1904: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1905: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1906: --
1907: l_create_assact_flag := 'N';
1908: --
1901: -- Loop through all assignments
1902: hr_utility.set_location(l_proc, 20);
1903: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
1904: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1905: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1906: --
1907: l_create_assact_flag := 'N';
1908: --
1909: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
1908: --
1909: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
1910: -- Loop through all vehicle allocations
1911: -- over the date range
1912: hr_utility.set_location(l_proc, 30);
1913: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
1914: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
1915: --
1916: L_action_flag := 'X';
1909: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
1910: -- Loop through all vehicle allocations
1911: -- over the date range
1912: hr_utility.set_location(l_proc, 30);
1913: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
1914: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
1915: --
1916: L_action_flag := 'X';
1917: l_archived_flag := 'Y';
1910: -- Loop through all vehicle allocations
1911: -- over the date range
1912: hr_utility.set_location(l_proc, 30);
1913: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
1914: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
1915: --
1916: L_action_flag := 'X';
1917: l_archived_flag := 'Y';
1918: --
1922: open private_flag_check(alc_rec.vehicle_allocation_id);
1923: fetch private_flag_check into l_private_start_dt;
1924: close private_flag_check;
1925:
1926: hr_utility.set_location(l_proc, 32);
1927: hr_utility.trace(l_proc||': l_private_start_dt='||l_private_start_dt);
1928: if l_private_start_dt is not null then
1929: -- Cursor to check if the change was from Y to N i.e. Withdrawal
1930: -- else was it from N to Y i.e. new Benifit
1923: fetch private_flag_check into l_private_start_dt;
1924: close private_flag_check;
1925:
1926: hr_utility.set_location(l_proc, 32);
1927: hr_utility.trace(l_proc||': l_private_start_dt='||l_private_start_dt);
1928: if l_private_start_dt is not null then
1929: -- Cursor to check if the change was from Y to N i.e. Withdrawal
1930: -- else was it from N to Y i.e. new Benifit
1931:
1932: open withdrawal_check(alc_rec.vehicle_allocation_id,l_private_start_dt );
1933: fetch withdrawal_check into l_latest_private_flag;
1934: close withdrawal_check;
1935:
1936: hr_utility.set_location(l_proc, 35);
1937: hr_utility.trace(l_proc||': l_latest_private_flag='||nvl(l_latest_private_flag,'NULL'));
1938:
1939: if l_latest_private_flag = 'Y' then
1940: -- This means the value has changed from N to Y so this is a new benefit
1933: fetch withdrawal_check into l_latest_private_flag;
1934: close withdrawal_check;
1935:
1936: hr_utility.set_location(l_proc, 35);
1937: hr_utility.trace(l_proc||': l_latest_private_flag='||nvl(l_latest_private_flag,'NULL'));
1938:
1939: if l_latest_private_flag = 'Y' then
1940: -- This means the value has changed from N to Y so this is a new benefit
1941: L_action_flag := 'N';
1952: alc_rec.vehicle_allocation_id,
1953: l_private_start_dt,
1954: l_action_flag);
1955: --
1956: hr_utility.set_location(l_proc, 38);
1957: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1958: --
1959: IF l_archived_flag = 'N' THEN
1960: -- Action has not been archived already
1953: l_private_start_dt,
1954: l_action_flag);
1955: --
1956: hr_utility.set_location(l_proc, 38);
1957: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
1958: --
1959: IF l_archived_flag = 'N' THEN
1960: -- Action has not been archived already
1961: -- therefore create assignment action
1978: OPEN c_alloc_dates(alc_rec.vehicle_allocation_id);
1979: FETCH c_alloc_dates INTO alc_dates_rec;
1980: CLOSE c_alloc_dates;
1981: --
1982: hr_utility.set_location(l_proc, 40);
1983: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1984: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
1985: --
1986: -- Check whether vehicle was allocated or
1979: FETCH c_alloc_dates INTO alc_dates_rec;
1980: CLOSE c_alloc_dates;
1981: --
1982: hr_utility.set_location(l_proc, 40);
1983: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1984: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
1985: --
1986: -- Check whether vehicle was allocated or
1987: -- Withdrawn within the date range also
1980: CLOSE c_alloc_dates;
1981: --
1982: hr_utility.set_location(l_proc, 40);
1983: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1984: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
1985: --
1986: -- Check whether vehicle was allocated or
1987: -- Withdrawn within the date range also
1988: -- check that this allocation or withdrawal
1986: -- Check whether vehicle was allocated or
1987: -- Withdrawn within the date range also
1988: -- check that this allocation or withdrawal
1989: -- happened when assignment was with input tax ref
1990: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1991: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1992: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1993: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
1994: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
1987: -- Withdrawn within the date range also
1988: -- check that this allocation or withdrawal
1989: -- happened when assignment was with input tax ref
1990: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1991: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1992: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1993: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
1994: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
1995: (alc_dates_rec.min_start_date BETWEEN asg_rec.asg_min_start_date AND asg_rec.asg_max_end_date) THEN
1988: -- check that this allocation or withdrawal
1989: -- happened when assignment was with input tax ref
1990: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1991: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1992: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1993: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
1994: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
1995: (alc_dates_rec.min_start_date BETWEEN asg_rec.asg_min_start_date AND asg_rec.asg_max_end_date) THEN
1996: --
1989: -- happened when assignment was with input tax ref
1990: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
1991: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
1992: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
1993: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
1994: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
1995: (alc_dates_rec.min_start_date BETWEEN asg_rec.asg_min_start_date AND asg_rec.asg_max_end_date) THEN
1996: --
1997: -- This is a New Car or replacement action
2006: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.min_start_date);
2007: FETCH c_first_asg INTO first_asg_rec;
2008: CLOSE c_first_asg;
2009: --
2010: hr_utility.set_location(l_proc, 50);
2011: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
2012: -- Get primary car allocation of the
2013: -- first assignment of this person
2014: -- in this tax ref
2007: FETCH c_first_asg INTO first_asg_rec;
2008: CLOSE c_first_asg;
2009: --
2010: hr_utility.set_location(l_proc, 50);
2011: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
2012: -- Get primary car allocation of the
2013: -- first assignment of this person
2014: -- in this tax ref
2015: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
2015: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
2016: FETCH c_primary_car INTO primary_car_rec;
2017: CLOSE c_primary_car;
2018: --
2019: hr_utility.set_location(l_proc, 60);
2020: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
2021: --
2022: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
2023: -- This is the first car allocation
2016: FETCH c_primary_car INTO primary_car_rec;
2017: CLOSE c_primary_car;
2018: --
2019: hr_utility.set_location(l_proc, 60);
2020: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
2021: --
2022: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
2023: -- This is the first car allocation
2024: -- of this employee in this tax ref
2031: ELSE
2032: L_action_flag := 'N';
2033: END IF;
2034: --
2035: hr_utility.set_location(l_proc, 70);
2036: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2037: --
2038: CLOSE c_prior_prim_car;
2039: ELSE
2032: L_action_flag := 'N';
2033: END IF;
2034: --
2035: hr_utility.set_location(l_proc, 70);
2036: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2037: --
2038: CLOSE c_prior_prim_car;
2039: ELSE
2040: -- Not the first car of the employee
2041: -- report this as new car
2042: L_action_flag := 'N';
2043: END IF;
2044: --
2045: hr_utility.set_location(l_proc, 80);
2046: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2047: --
2048: ELSE
2049: -- Not a primary car therefore mark
2042: L_action_flag := 'N';
2043: END IF;
2044: --
2045: hr_utility.set_location(l_proc, 80);
2046: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2047: --
2048: ELSE
2049: -- Not a primary car therefore mark
2050: -- it as new car allocation action
2050: -- it as new car allocation action
2051: l_action_flag := 'N';
2052: END IF;
2053: --
2054: hr_utility.set_location(l_proc, 90);
2055: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2056: --
2057: IF L_action_flag <> 'X' THEN
2058: -- Check whether this allocation action
2051: l_action_flag := 'N';
2052: END IF;
2053: --
2054: hr_utility.set_location(l_proc, 90);
2055: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2056: --
2057: IF L_action_flag <> 'X' THEN
2058: -- Check whether this allocation action
2059: -- has been already archived
2062: alc_rec.vehicle_allocation_id,
2063: alc_dates_rec.min_start_date,
2064: l_action_flag);
2065: --
2066: hr_utility.set_location(l_proc, 100);
2067: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2068: --
2069: IF l_archived_flag = 'N' THEN
2070: -- Action has not been archived already
2063: alc_dates_rec.min_start_date,
2064: l_action_flag);
2065: --
2066: hr_utility.set_location(l_proc, 100);
2067: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2068: --
2069: IF l_archived_flag = 'N' THEN
2070: -- Action has not been archived already
2071: -- therefore create assignment action
2102: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.max_end_date);
2103: FETCH c_first_asg INTO first_asg_rec;
2104: CLOSE c_first_asg;
2105: --
2106: hr_utility.set_location(l_proc, 50);
2107: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
2108: -- Get primary car allocation of the
2109: -- first assignment of this person
2110: -- in this tax ref
2103: FETCH c_first_asg INTO first_asg_rec;
2104: CLOSE c_first_asg;
2105: --
2106: hr_utility.set_location(l_proc, 50);
2107: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
2108: -- Get primary car allocation of the
2109: -- first assignment of this person
2110: -- in this tax ref
2111: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
2111: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
2112: FETCH c_primary_car INTO primary_car_rec;
2113: CLOSE c_primary_car;
2114: --
2115: hr_utility.set_location(l_proc, 60);
2116: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
2117: --
2118: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
2119: --
2112: FETCH c_primary_car INTO primary_car_rec;
2113: CLOSE c_primary_car;
2114: --
2115: hr_utility.set_location(l_proc, 60);
2116: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
2117: --
2118: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
2119: --
2120: OPEN c_next_prim_car(asg_rec.assignment_id, Alc_dates_rec.max_end_date);
2128: -- This is a withdrawal action
2129: L_action_flag := 'W';
2130: END IF;
2131: --
2132: hr_utility.set_location(l_proc, 70);
2133: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2134: --
2135: CLOSE c_next_prim_car;
2136: ELSE
2129: L_action_flag := 'W';
2130: END IF;
2131: --
2132: hr_utility.set_location(l_proc, 70);
2133: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2134: --
2135: CLOSE c_next_prim_car;
2136: ELSE
2137: -- Not the first car of the employee
2139: L_action_flag := 'W';
2140: END IF;
2141: --
2142: --
2143: hr_utility.set_location(l_proc, 80);
2144: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2145: --
2146: ELSE
2147: -- Not a Primary car therefore mark
2140: END IF;
2141: --
2142: --
2143: hr_utility.set_location(l_proc, 80);
2144: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2145: --
2146: ELSE
2147: -- Not a Primary car therefore mark
2148: -- it as withdrawal car action
2148: -- it as withdrawal car action
2149: l_action_flag := 'W';
2150: END IF;
2151: --
2152: hr_utility.set_location(l_proc, 90);
2153: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2154: --
2155: IF L_action_flag <> 'X' THEN
2156: -- Check whether this allocation action
2149: l_action_flag := 'W';
2150: END IF;
2151: --
2152: hr_utility.set_location(l_proc, 90);
2153: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2154: --
2155: IF L_action_flag <> 'X' THEN
2156: -- Check whether this allocation action
2157: -- has been already archived
2160: alc_rec.vehicle_allocation_id,
2161: alc_dates_rec.min_start_date,
2162: l_action_flag);
2163: --
2164: hr_utility.set_location(l_proc, 100);
2165: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2166: --
2167: IF l_archived_flag = 'N' THEN
2168: -- Action has not been archived already
2161: alc_dates_rec.min_start_date,
2162: l_action_flag);
2163: --
2164: hr_utility.set_location(l_proc, 100);
2165: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2166: --
2167: IF l_archived_flag = 'N' THEN
2168: -- Action has not been archived already
2169: -- therefore create assignment action
2177: -- Fuel type has changed therefore make sure
2178: -- this change occured after the vehicle was
2179: -- allocated to this assignment
2180: --
2181: hr_utility.set_location(l_proc, 110);
2182: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
2183: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
2184: --
2185: IF (vehicle_changes_rec.effective_start_date
2178: -- this change occured after the vehicle was
2179: -- allocated to this assignment
2180: --
2181: hr_utility.set_location(l_proc, 110);
2182: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
2183: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
2184: --
2185: IF (vehicle_changes_rec.effective_start_date
2186: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
2179: -- allocated to this assignment
2180: --
2181: hr_utility.set_location(l_proc, 110);
2182: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
2183: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
2184: --
2185: IF (vehicle_changes_rec.effective_start_date
2186: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
2187: (vehicle_changes_rec.effective_start_date
2194: alc_rec.vehicle_allocation_id,
2195: vehicle_changes_rec.effective_start_date,
2196: 'F');
2197: --
2198: hr_utility.set_location(l_proc, 120);
2199: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2200: --
2201: IF l_archived_flag = 'N' THEN
2202: -- Action has not been archived already
2195: vehicle_changes_rec.effective_start_date,
2196: 'F');
2197: --
2198: hr_utility.set_location(l_proc, 120);
2199: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2200: --
2201: IF l_archived_flag = 'N' THEN
2202: -- Action has not been archived already
2203: -- therefore create assignment action
2206: END IF;
2207: END IF;
2208: END LOOP;
2209: --
2210: hr_utility.set_location(l_proc, 130);
2211: --
2212: --
2213: L_action_flag := 'X';
2214: l_archived_flag := 'Y';
2223: -- Assignment has started on this payroll or tax ref during the
2224: -- input date range and this car allocation was active on the
2225: -- start date therefore check whether it is a transfer
2226: -- from another tax ref
2227: hr_utility.set_location(l_proc, 160);
2228: l_previous_tax_ref := NULL;
2229: --
2230: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
2231: FETCH c_tax_ref INTO l_previous_tax_ref;
2230: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
2231: FETCH c_tax_ref INTO l_previous_tax_ref;
2232: CLOSE c_tax_ref;
2233: --
2234: hr_utility.set_location(l_proc, 170);
2235: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
2236: --
2237: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
2238: -- This assignment has a different prior tax ref
2231: FETCH c_tax_ref INTO l_previous_tax_ref;
2232: CLOSE c_tax_ref;
2233: --
2234: hr_utility.set_location(l_proc, 170);
2235: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
2236: --
2237: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
2238: -- This assignment has a different prior tax ref
2239: -- therefore it should be reported as a new car
2237: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
2238: -- This assignment has a different prior tax ref
2239: -- therefore it should be reported as a new car
2240: -- allocation on this EDI message.
2241: hr_utility.set_location(l_proc, 180);
2242: l_action_flag := 'N';
2243: --
2244: -- Check whether this allocation action
2245: -- has been already archived
2248: alc_rec.vehicle_allocation_id,
2249: asg_rec.asg_min_start_date,
2250: l_action_flag);
2251: --
2252: hr_utility.set_location(l_proc, 190);
2253: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
2254: --
2255: IF l_archived_flag = 'N' THEN
2256: -- Action has not been archived already
2249: asg_rec.asg_min_start_date,
2250: l_action_flag);
2251: --
2252: hr_utility.set_location(l_proc, 190);
2253: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
2254: --
2255: IF l_archived_flag = 'N' THEN
2256: -- Action has not been archived already
2257: -- therefore create assignment action
2269: -- Assignment has ended on this payroll or tax ref during the
2270: -- input date range and this car allocation was active on the
2271: -- end date therefore check whether it is a transfer
2272: -- to another tax ref
2273: hr_utility.set_location(l_proc, 200);
2274: l_next_tax_ref := NULL;
2275: --
2276: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
2277: FETCH c_tax_ref INTO l_next_tax_ref;
2276: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
2277: FETCH c_tax_ref INTO l_next_tax_ref;
2278: CLOSE c_tax_ref;
2279: --
2280: hr_utility.set_location(l_proc, 210);
2281: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
2282: --
2283: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
2284: -- This assignment has a different tax ref after end date
2277: FETCH c_tax_ref INTO l_next_tax_ref;
2278: CLOSE c_tax_ref;
2279: --
2280: hr_utility.set_location(l_proc, 210);
2281: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
2282: --
2283: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
2284: -- This assignment has a different tax ref after end date
2285: -- therefore it should be reported as allocation withdrawal
2283: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
2284: -- This assignment has a different tax ref after end date
2285: -- therefore it should be reported as allocation withdrawal
2286: -- on this EDI message.
2287: hr_utility.set_location(l_proc, 220);
2288: l_action_flag := 'W';
2289: --
2290: -- Check whether this allocation action
2291: -- has been already archived
2294: alc_rec.vehicle_allocation_id,
2295: asg_rec.asg_max_end_date,
2296: l_action_flag);
2297: --
2298: hr_utility.set_location(l_proc, 230);
2299: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
2300: --
2301: IF l_archived_flag = 'N' THEN
2302: -- Action has not been archived already
2295: asg_rec.asg_max_end_date,
2296: l_action_flag);
2297: --
2298: hr_utility.set_location(l_proc, 230);
2299: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
2300: --
2301: IF l_archived_flag = 'N' THEN
2302: -- Action has not been archived already
2303: -- therefore create assignment action
2306: --
2307: END IF;
2308: END IF;
2309: --
2310: hr_utility.set_location(l_proc, 240);
2311: --
2312: hr_utility.set_location(l_proc, 250);
2313: END LOOP;
2314: --
2308: END IF;
2309: --
2310: hr_utility.set_location(l_proc, 240);
2311: --
2312: hr_utility.set_location(l_proc, 250);
2313: END LOOP;
2314: --
2315: hr_utility.set_location(l_proc, 260);
2316: --
2311: --
2312: hr_utility.set_location(l_proc, 250);
2313: END LOOP;
2314: --
2315: hr_utility.set_location(l_proc, 260);
2316: --
2317: -- If flag is set then create action
2318: IF l_create_assact_flag = 'Y' THEN
2319: --
2320: SELECT pay_assignment_actions_s.nextval
2321: INTO l_actid
2322: FROM dual;
2323:
2324: hr_utility.set_location(l_proc, 270);
2325: hr_utility.trace(l_proc||': l_actid='||l_actid);
2326: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
2327: hr_utility.trace(l_proc||': pactid='||pactid);
2328: hr_utility.trace(l_proc||': chunk='||chunk);
2321: INTO l_actid
2322: FROM dual;
2323:
2324: hr_utility.set_location(l_proc, 270);
2325: hr_utility.trace(l_proc||': l_actid='||l_actid);
2326: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
2327: hr_utility.trace(l_proc||': pactid='||pactid);
2328: hr_utility.trace(l_proc||': chunk='||chunk);
2329: --
2322: FROM dual;
2323:
2324: hr_utility.set_location(l_proc, 270);
2325: hr_utility.trace(l_proc||': l_actid='||l_actid);
2326: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
2327: hr_utility.trace(l_proc||': pactid='||pactid);
2328: hr_utility.trace(l_proc||': chunk='||chunk);
2329: --
2330: hr_nonrun_asact.insact(l_actid,
2323:
2324: hr_utility.set_location(l_proc, 270);
2325: hr_utility.trace(l_proc||': l_actid='||l_actid);
2326: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
2327: hr_utility.trace(l_proc||': pactid='||pactid);
2328: hr_utility.trace(l_proc||': chunk='||chunk);
2329: --
2330: hr_nonrun_asact.insact(l_actid,
2331: asg_rec.assignment_id,
2324: hr_utility.set_location(l_proc, 270);
2325: hr_utility.trace(l_proc||': l_actid='||l_actid);
2326: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
2327: hr_utility.trace(l_proc||': pactid='||pactid);
2328: hr_utility.trace(l_proc||': chunk='||chunk);
2329: --
2330: hr_nonrun_asact.insact(l_actid,
2331: asg_rec.assignment_id,
2332: pactid,
2331: asg_rec.assignment_id,
2332: pactid,
2333: chunk, NULL);
2334: --
2335: hr_utility.set_location(l_proc, 280);
2336: --
2337: END IF;
2338: END LOOP;
2339: --
2336: --
2337: END IF;
2338: END LOOP;
2339: --
2340: hr_utility.set_location('Leaving: '||l_proc,290);
2341: -- hr_utility.trace_off;
2342: EXCEPTION
2343: WHEN OTHERS THEN
2344: hr_utility.set_location('Leaving: '||l_proc,300);
2337: END IF;
2338: END LOOP;
2339: --
2340: hr_utility.set_location('Leaving: '||l_proc,290);
2341: -- hr_utility.trace_off;
2342: EXCEPTION
2343: WHEN OTHERS THEN
2344: hr_utility.set_location('Leaving: '||l_proc,300);
2345: -- hr_utility.trace_off;
2340: hr_utility.set_location('Leaving: '||l_proc,290);
2341: -- hr_utility.trace_off;
2342: EXCEPTION
2343: WHEN OTHERS THEN
2344: hr_utility.set_location('Leaving: '||l_proc,300);
2345: -- hr_utility.trace_off;
2346: raise;
2347: END Create_asg_act_v4;
2348:
2341: -- hr_utility.trace_off;
2342: EXCEPTION
2343: WHEN OTHERS THEN
2344: hr_utility.set_location('Leaving: '||l_proc,300);
2345: -- hr_utility.trace_off;
2346: raise;
2347: END Create_asg_act_v4;
2348:
2349:
2416: l_archived_flag VARCHAR2(1);
2417: l_private_start_dt date;
2418: l_latest_private_flag varchar2(1);
2419: BEGIN
2420: --hr_utility.trace_on(null, 'KTHAMPAN');
2421: hr_utility.set_location('Entering '||l_proc, 10);
2422: --
2423: OPEN c_param_values;
2424: FETCH c_param_values INTO g_payroll_id,
2417: l_private_start_dt date;
2418: l_latest_private_flag varchar2(1);
2419: BEGIN
2420: --hr_utility.trace_on(null, 'KTHAMPAN');
2421: hr_utility.set_location('Entering '||l_proc, 10);
2422: --
2423: OPEN c_param_values;
2424: FETCH c_param_values INTO g_payroll_id,
2425: g_tax_ref,
2428: g_end_date,
2429: g_business_group_id;
2430: CLOSE c_param_values;
2431: --
2432: hr_utility.set_location(l_proc, 15);
2433: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
2434: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
2435: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
2436: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
2429: g_business_group_id;
2430: CLOSE c_param_values;
2431: --
2432: hr_utility.set_location(l_proc, 15);
2433: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
2434: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
2435: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
2436: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
2437: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
2430: CLOSE c_param_values;
2431: --
2432: hr_utility.set_location(l_proc, 15);
2433: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
2434: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
2435: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
2436: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
2437: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
2438: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
2431: --
2432: hr_utility.set_location(l_proc, 15);
2433: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
2434: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
2435: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
2436: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
2437: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
2438: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
2439: For asg_rec IN c_asg
2432: hr_utility.set_location(l_proc, 15);
2433: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
2434: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
2435: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
2436: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
2437: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
2438: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
2439: For asg_rec IN c_asg
2440: LOOP
2433: hr_utility.trace(l_proc||': g_payroll_id='||g_payroll_id);
2434: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
2435: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
2436: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
2437: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
2438: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
2439: For asg_rec IN c_asg
2440: LOOP
2441: -- Loop through all assignments
2434: hr_utility.trace(l_proc||': g_tax_ref='||g_tax_ref);
2435: hr_utility.trace(l_proc||': g_start_date='||fnd_date.date_to_displaydate(g_start_date));
2436: hr_utility.trace(l_proc||': g_effective_date='||fnd_date.date_to_displaydate(g_effective_date));
2437: hr_utility.trace(l_proc||': g_end_date='||fnd_date.date_to_displaydate(g_end_date));
2438: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
2439: For asg_rec IN c_asg
2440: LOOP
2441: -- Loop through all assignments
2442: hr_utility.set_location(l_proc, 20);
2438: hr_utility.trace(l_proc||': g_business_group_id='||g_business_group_id);
2439: For asg_rec IN c_asg
2440: LOOP
2441: -- Loop through all assignments
2442: hr_utility.set_location(l_proc, 20);
2443: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
2444: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
2445: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
2446: --
2439: For asg_rec IN c_asg
2440: LOOP
2441: -- Loop through all assignments
2442: hr_utility.set_location(l_proc, 20);
2443: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
2444: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
2445: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
2446: --
2447: l_create_assact_flag := 'N';
2440: LOOP
2441: -- Loop through all assignments
2442: hr_utility.set_location(l_proc, 20);
2443: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
2444: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
2445: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
2446: --
2447: l_create_assact_flag := 'N';
2448: --
2441: -- Loop through all assignments
2442: hr_utility.set_location(l_proc, 20);
2443: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
2444: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
2445: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
2446: --
2447: l_create_assact_flag := 'N';
2448: --
2449: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
2448: --
2449: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
2450: -- Loop through all vehicle allocations
2451: -- over the date range
2452: hr_utility.set_location(l_proc, 30);
2453: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
2454: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
2455: --
2456: L_action_flag := 'X';
2449: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
2450: -- Loop through all vehicle allocations
2451: -- over the date range
2452: hr_utility.set_location(l_proc, 30);
2453: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
2454: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
2455: --
2456: L_action_flag := 'X';
2457: l_archived_flag := 'Y';
2450: -- Loop through all vehicle allocations
2451: -- over the date range
2452: hr_utility.set_location(l_proc, 30);
2453: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
2454: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
2455: --
2456: L_action_flag := 'X';
2457: l_archived_flag := 'Y';
2458: --
2462: open private_flag_check(alc_rec.vehicle_allocation_id);
2463: fetch private_flag_check into l_private_start_dt;
2464: close private_flag_check;
2465:
2466: hr_utility.set_location(l_proc, 32);
2467: hr_utility.trace(l_proc||': l_private_start_dt='||l_private_start_dt);
2468: if l_private_start_dt is not null then
2469: -- Cursor to check if the change was from Y to N i.e. Withdrawal
2470: -- else was it from N to Y i.e. new Benifit
2463: fetch private_flag_check into l_private_start_dt;
2464: close private_flag_check;
2465:
2466: hr_utility.set_location(l_proc, 32);
2467: hr_utility.trace(l_proc||': l_private_start_dt='||l_private_start_dt);
2468: if l_private_start_dt is not null then
2469: -- Cursor to check if the change was from Y to N i.e. Withdrawal
2470: -- else was it from N to Y i.e. new Benifit
2471:
2472: open withdrawal_check(alc_rec.vehicle_allocation_id,l_private_start_dt );
2473: fetch withdrawal_check into l_latest_private_flag;
2474: close withdrawal_check;
2475:
2476: hr_utility.set_location(l_proc, 35);
2477: hr_utility.trace(l_proc||': l_latest_private_flag='||nvl(l_latest_private_flag,'NULL'));
2478:
2479: if l_latest_private_flag = 'Y' then
2480: -- This means the value has changed from N to Y so this is a new benefit
2473: fetch withdrawal_check into l_latest_private_flag;
2474: close withdrawal_check;
2475:
2476: hr_utility.set_location(l_proc, 35);
2477: hr_utility.trace(l_proc||': l_latest_private_flag='||nvl(l_latest_private_flag,'NULL'));
2478:
2479: if l_latest_private_flag = 'Y' then
2480: -- This means the value has changed from N to Y so this is a new benefit
2481: L_action_flag := 'N';
2492: alc_rec.vehicle_allocation_id,
2493: l_private_start_dt,
2494: l_action_flag);
2495: --
2496: hr_utility.set_location(l_proc, 38);
2497: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2498: --
2499: IF l_archived_flag = 'N' THEN
2500: -- Action has not been archived already
2493: l_private_start_dt,
2494: l_action_flag);
2495: --
2496: hr_utility.set_location(l_proc, 38);
2497: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2498: --
2499: IF l_archived_flag = 'N' THEN
2500: -- Action has not been archived already
2501: -- therefore create assignment action
2518: OPEN c_alloc_dates(alc_rec.vehicle_allocation_id);
2519: FETCH c_alloc_dates INTO alc_dates_rec;
2520: CLOSE c_alloc_dates;
2521: --
2522: hr_utility.set_location(l_proc, 40);
2523: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
2524: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
2525: --
2526: -- Check whether vehicle was allocated or
2519: FETCH c_alloc_dates INTO alc_dates_rec;
2520: CLOSE c_alloc_dates;
2521: --
2522: hr_utility.set_location(l_proc, 40);
2523: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
2524: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
2525: --
2526: -- Check whether vehicle was allocated or
2527: -- Withdrawn within the date range also
2520: CLOSE c_alloc_dates;
2521: --
2522: hr_utility.set_location(l_proc, 40);
2523: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
2524: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
2525: --
2526: -- Check whether vehicle was allocated or
2527: -- Withdrawn within the date range also
2528: -- check that this allocation or withdrawal
2526: -- Check whether vehicle was allocated or
2527: -- Withdrawn within the date range also
2528: -- check that this allocation or withdrawal
2529: -- happened when assignment was with input tax ref
2530: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
2531: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
2532: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
2533: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
2534: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
2527: -- Withdrawn within the date range also
2528: -- check that this allocation or withdrawal
2529: -- happened when assignment was with input tax ref
2530: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
2531: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
2532: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
2533: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
2534: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
2535: (alc_dates_rec.min_start_date BETWEEN asg_rec.asg_min_start_date AND asg_rec.asg_max_end_date) THEN
2528: -- check that this allocation or withdrawal
2529: -- happened when assignment was with input tax ref
2530: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
2531: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
2532: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
2533: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
2534: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
2535: (alc_dates_rec.min_start_date BETWEEN asg_rec.asg_min_start_date AND asg_rec.asg_max_end_date) THEN
2536: --
2529: -- happened when assignment was with input tax ref
2530: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
2531: hr_utility.trace(l_proc||': asg_rec.asg_min_start_date='|| fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
2532: hr_utility.trace(l_proc||': asg_rec.asg_max_end_date='|| fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
2533: hr_utility.trace(l_proc||': alc_rec.usage_type='|| alc_rec.usage_type);
2534: IF (alc_dates_rec.min_start_date BETWEEN g_start_date AND g_end_Date) AND
2535: (alc_dates_rec.min_start_date BETWEEN asg_rec.asg_min_start_date AND asg_rec.asg_max_end_date) THEN
2536: --
2537: -- This is a New Car or replacement action
2546: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.min_start_date);
2547: FETCH c_first_asg INTO first_asg_rec;
2548: CLOSE c_first_asg;
2549: --
2550: hr_utility.set_location(l_proc, 50);
2551: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
2552: -- Get primary car allocation of the
2553: -- first assignment of this person
2554: -- in this tax ref
2547: FETCH c_first_asg INTO first_asg_rec;
2548: CLOSE c_first_asg;
2549: --
2550: hr_utility.set_location(l_proc, 50);
2551: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
2552: -- Get primary car allocation of the
2553: -- first assignment of this person
2554: -- in this tax ref
2555: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
2555: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
2556: FETCH c_primary_car INTO primary_car_rec;
2557: CLOSE c_primary_car;
2558: --
2559: hr_utility.set_location(l_proc, 60);
2560: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
2561: --
2562: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
2563: -- This is the first car allocation
2556: FETCH c_primary_car INTO primary_car_rec;
2557: CLOSE c_primary_car;
2558: --
2559: hr_utility.set_location(l_proc, 60);
2560: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
2561: --
2562: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
2563: -- This is the first car allocation
2564: -- of this employee in this tax ref
2571: ELSE
2572: L_action_flag := 'N';
2573: END IF;
2574: --
2575: hr_utility.set_location(l_proc, 70);
2576: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2577: --
2578: CLOSE c_prior_prim_car;
2579: ELSE
2572: L_action_flag := 'N';
2573: END IF;
2574: --
2575: hr_utility.set_location(l_proc, 70);
2576: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2577: --
2578: CLOSE c_prior_prim_car;
2579: ELSE
2580: -- Not the first car of the employee
2581: -- report this as new car
2582: L_action_flag := 'N';
2583: END IF;
2584: --
2585: hr_utility.set_location(l_proc, 80);
2586: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2587: --
2588: ELSE
2589: -- Not a primary car therefore mark
2582: L_action_flag := 'N';
2583: END IF;
2584: --
2585: hr_utility.set_location(l_proc, 80);
2586: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2587: --
2588: ELSE
2589: -- Not a primary car therefore mark
2590: -- it as new car allocation action
2590: -- it as new car allocation action
2591: l_action_flag := 'N';
2592: END IF;
2593: --
2594: hr_utility.set_location(l_proc, 90);
2595: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2596: --
2597: IF L_action_flag <> 'X' THEN
2598: -- Check whether this allocation action
2591: l_action_flag := 'N';
2592: END IF;
2593: --
2594: hr_utility.set_location(l_proc, 90);
2595: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2596: --
2597: IF L_action_flag <> 'X' THEN
2598: -- Check whether this allocation action
2599: -- has been already archived
2602: alc_rec.vehicle_allocation_id,
2603: alc_dates_rec.min_start_date,
2604: l_action_flag);
2605: --
2606: hr_utility.set_location(l_proc, 100);
2607: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2608: --
2609: IF l_archived_flag = 'N' THEN
2610: -- Action has not been archived already
2603: alc_dates_rec.min_start_date,
2604: l_action_flag);
2605: --
2606: hr_utility.set_location(l_proc, 100);
2607: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2608: --
2609: IF l_archived_flag = 'N' THEN
2610: -- Action has not been archived already
2611: -- therefore create assignment action
2642: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.max_end_date);
2643: FETCH c_first_asg INTO first_asg_rec;
2644: CLOSE c_first_asg;
2645: --
2646: hr_utility.set_location(l_proc, 50);
2647: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
2648: -- Get primary car allocation of the
2649: -- first assignment of this person
2650: -- in this tax ref
2643: FETCH c_first_asg INTO first_asg_rec;
2644: CLOSE c_first_asg;
2645: --
2646: hr_utility.set_location(l_proc, 50);
2647: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
2648: -- Get primary car allocation of the
2649: -- first assignment of this person
2650: -- in this tax ref
2651: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
2651: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
2652: FETCH c_primary_car INTO primary_car_rec;
2653: CLOSE c_primary_car;
2654: --
2655: hr_utility.set_location(l_proc, 60);
2656: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
2657: --
2658: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
2659: --
2652: FETCH c_primary_car INTO primary_car_rec;
2653: CLOSE c_primary_car;
2654: --
2655: hr_utility.set_location(l_proc, 60);
2656: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
2657: --
2658: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
2659: --
2660: OPEN c_next_prim_car(asg_rec.assignment_id, Alc_dates_rec.max_end_date);
2668: -- This is a withdrawal action
2669: L_action_flag := 'W';
2670: END IF;
2671: --
2672: hr_utility.set_location(l_proc, 70);
2673: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2674: --
2675: CLOSE c_next_prim_car;
2676: ELSE
2669: L_action_flag := 'W';
2670: END IF;
2671: --
2672: hr_utility.set_location(l_proc, 70);
2673: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2674: --
2675: CLOSE c_next_prim_car;
2676: ELSE
2677: -- Not the first car of the employee
2679: L_action_flag := 'W';
2680: END IF;
2681: --
2682: --
2683: hr_utility.set_location(l_proc, 80);
2684: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2685: --
2686: ELSE
2687: -- Not a Primary car therefore mark
2680: END IF;
2681: --
2682: --
2683: hr_utility.set_location(l_proc, 80);
2684: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2685: --
2686: ELSE
2687: -- Not a Primary car therefore mark
2688: -- it as withdrawal car action
2688: -- it as withdrawal car action
2689: l_action_flag := 'W';
2690: END IF;
2691: --
2692: hr_utility.set_location(l_proc, 90);
2693: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2694: --
2695: IF L_action_flag <> 'X' THEN
2696: -- Check whether this allocation action
2689: l_action_flag := 'W';
2690: END IF;
2691: --
2692: hr_utility.set_location(l_proc, 90);
2693: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
2694: --
2695: IF L_action_flag <> 'X' THEN
2696: -- Check whether this allocation action
2697: -- has been already archived
2700: alc_rec.vehicle_allocation_id,
2701: alc_dates_rec.min_start_date,
2702: l_action_flag);
2703: --
2704: hr_utility.set_location(l_proc, 100);
2705: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2706: --
2707: IF l_archived_flag = 'N' THEN
2708: -- Action has not been archived already
2701: alc_dates_rec.min_start_date,
2702: l_action_flag);
2703: --
2704: hr_utility.set_location(l_proc, 100);
2705: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2706: --
2707: IF l_archived_flag = 'N' THEN
2708: -- Action has not been archived already
2709: -- therefore create assignment action
2717: -- Fuel type has changed therefore make sure
2718: -- this change occured after the vehicle was
2719: -- allocated to this assignment
2720: --
2721: hr_utility.set_location(l_proc, 110);
2722: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
2723: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
2724: --
2725: IF (vehicle_changes_rec.effective_start_date
2718: -- this change occured after the vehicle was
2719: -- allocated to this assignment
2720: --
2721: hr_utility.set_location(l_proc, 110);
2722: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
2723: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
2724: --
2725: IF (vehicle_changes_rec.effective_start_date
2726: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
2719: -- allocated to this assignment
2720: --
2721: hr_utility.set_location(l_proc, 110);
2722: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
2723: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
2724: --
2725: IF (vehicle_changes_rec.effective_start_date
2726: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
2727: (vehicle_changes_rec.effective_start_date
2734: alc_rec.vehicle_allocation_id,
2735: vehicle_changes_rec.effective_start_date,
2736: 'F');
2737: --
2738: hr_utility.set_location(l_proc, 120);
2739: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2740: --
2741: IF l_archived_flag = 'N' THEN
2742: -- Action has not been archived already
2735: vehicle_changes_rec.effective_start_date,
2736: 'F');
2737: --
2738: hr_utility.set_location(l_proc, 120);
2739: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
2740: --
2741: IF l_archived_flag = 'N' THEN
2742: -- Action has not been archived already
2743: -- therefore create assignment action
2746: END IF;
2747: END IF;
2748: END LOOP;
2749: --
2750: hr_utility.set_location(l_proc, 130);
2751: --
2752: --
2753: L_action_flag := 'X';
2754: l_archived_flag := 'Y';
2763: -- Assignment has started on this payroll or tax ref during the
2764: -- input date range and this car allocation was active on the
2765: -- start date therefore check whether it is a transfer
2766: -- from another tax ref
2767: hr_utility.set_location(l_proc, 160);
2768: l_previous_tax_ref := NULL;
2769: --
2770: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
2771: FETCH c_tax_ref INTO l_previous_tax_ref;
2770: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
2771: FETCH c_tax_ref INTO l_previous_tax_ref;
2772: CLOSE c_tax_ref;
2773: --
2774: hr_utility.set_location(l_proc, 170);
2775: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
2776: --
2777: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
2778: -- This assignment has a different prior tax ref
2771: FETCH c_tax_ref INTO l_previous_tax_ref;
2772: CLOSE c_tax_ref;
2773: --
2774: hr_utility.set_location(l_proc, 170);
2775: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
2776: --
2777: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
2778: -- This assignment has a different prior tax ref
2779: -- therefore it should be reported as a new car
2777: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
2778: -- This assignment has a different prior tax ref
2779: -- therefore it should be reported as a new car
2780: -- allocation on this EDI message.
2781: hr_utility.set_location(l_proc, 180);
2782: l_action_flag := 'N';
2783: --
2784: -- Check whether this allocation action
2785: -- has been already archived
2788: alc_rec.vehicle_allocation_id,
2789: asg_rec.asg_min_start_date,
2790: l_action_flag);
2791: --
2792: hr_utility.set_location(l_proc, 190);
2793: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
2794: --
2795: IF l_archived_flag = 'N' THEN
2796: -- Action has not been archived already
2789: asg_rec.asg_min_start_date,
2790: l_action_flag);
2791: --
2792: hr_utility.set_location(l_proc, 190);
2793: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
2794: --
2795: IF l_archived_flag = 'N' THEN
2796: -- Action has not been archived already
2797: -- therefore create assignment action
2809: -- Assignment has ended on this payroll or tax ref during the
2810: -- input date range and this car allocation was active on the
2811: -- end date therefore check whether it is a transfer
2812: -- to another tax ref
2813: hr_utility.set_location(l_proc, 200);
2814: l_next_tax_ref := NULL;
2815: --
2816: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
2817: FETCH c_tax_ref INTO l_next_tax_ref;
2816: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
2817: FETCH c_tax_ref INTO l_next_tax_ref;
2818: CLOSE c_tax_ref;
2819: --
2820: hr_utility.set_location(l_proc, 210);
2821: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
2822: --
2823: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
2824: -- This assignment has a different tax ref after end date
2817: FETCH c_tax_ref INTO l_next_tax_ref;
2818: CLOSE c_tax_ref;
2819: --
2820: hr_utility.set_location(l_proc, 210);
2821: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
2822: --
2823: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
2824: -- This assignment has a different tax ref after end date
2825: -- therefore it should be reported as allocation withdrawal
2823: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
2824: -- This assignment has a different tax ref after end date
2825: -- therefore it should be reported as allocation withdrawal
2826: -- on this EDI message.
2827: hr_utility.set_location(l_proc, 220);
2828: l_action_flag := 'W';
2829: --
2830: -- Check whether this allocation action
2831: -- has been already archived
2834: alc_rec.vehicle_allocation_id,
2835: asg_rec.asg_max_end_date,
2836: l_action_flag);
2837: --
2838: hr_utility.set_location(l_proc, 230);
2839: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
2840: --
2841: IF l_archived_flag = 'N' THEN
2842: -- Action has not been archived already
2835: asg_rec.asg_max_end_date,
2836: l_action_flag);
2837: --
2838: hr_utility.set_location(l_proc, 230);
2839: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
2840: --
2841: IF l_archived_flag = 'N' THEN
2842: -- Action has not been archived already
2843: -- therefore create assignment action
2846: --
2847: END IF;
2848: END IF;
2849: --
2850: hr_utility.set_location(l_proc, 240);
2851: --
2852: hr_utility.set_location(l_proc, 250);
2853: END LOOP;
2854: --
2848: END IF;
2849: --
2850: hr_utility.set_location(l_proc, 240);
2851: --
2852: hr_utility.set_location(l_proc, 250);
2853: END LOOP;
2854: --
2855: hr_utility.set_location(l_proc, 260);
2856: --
2851: --
2852: hr_utility.set_location(l_proc, 250);
2853: END LOOP;
2854: --
2855: hr_utility.set_location(l_proc, 260);
2856: --
2857: -- If flag is set then create action
2858: IF l_create_assact_flag = 'Y' THEN
2859: --
2860: SELECT pay_assignment_actions_s.nextval
2861: INTO l_actid
2862: FROM dual;
2863:
2864: hr_utility.set_location(l_proc, 270);
2865: hr_utility.trace(l_proc||': l_actid='||l_actid);
2866: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
2867: hr_utility.trace(l_proc||': pactid='||pactid);
2868: hr_utility.trace(l_proc||': chunk='||chunk);
2861: INTO l_actid
2862: FROM dual;
2863:
2864: hr_utility.set_location(l_proc, 270);
2865: hr_utility.trace(l_proc||': l_actid='||l_actid);
2866: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
2867: hr_utility.trace(l_proc||': pactid='||pactid);
2868: hr_utility.trace(l_proc||': chunk='||chunk);
2869: --
2862: FROM dual;
2863:
2864: hr_utility.set_location(l_proc, 270);
2865: hr_utility.trace(l_proc||': l_actid='||l_actid);
2866: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
2867: hr_utility.trace(l_proc||': pactid='||pactid);
2868: hr_utility.trace(l_proc||': chunk='||chunk);
2869: --
2870: hr_nonrun_asact.insact(l_actid,
2863:
2864: hr_utility.set_location(l_proc, 270);
2865: hr_utility.trace(l_proc||': l_actid='||l_actid);
2866: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
2867: hr_utility.trace(l_proc||': pactid='||pactid);
2868: hr_utility.trace(l_proc||': chunk='||chunk);
2869: --
2870: hr_nonrun_asact.insact(l_actid,
2871: asg_rec.assignment_id,
2864: hr_utility.set_location(l_proc, 270);
2865: hr_utility.trace(l_proc||': l_actid='||l_actid);
2866: hr_utility.trace(l_proc||': asg_rec.assignment_id='||asg_rec.assignment_id);
2867: hr_utility.trace(l_proc||': pactid='||pactid);
2868: hr_utility.trace(l_proc||': chunk='||chunk);
2869: --
2870: hr_nonrun_asact.insact(l_actid,
2871: asg_rec.assignment_id,
2872: pactid,
2871: asg_rec.assignment_id,
2872: pactid,
2873: chunk, NULL);
2874: --
2875: hr_utility.set_location(l_proc, 280);
2876: --
2877: END IF;
2878: END LOOP;
2879: --
2876: --
2877: END IF;
2878: END LOOP;
2879: --
2880: hr_utility.set_location('Leaving: '||l_proc,290);
2881: -- hr_utility.trace_off;
2882: EXCEPTION
2883: WHEN OTHERS THEN
2884: hr_utility.set_location('Leaving: '||l_proc,300);
2877: END IF;
2878: END LOOP;
2879: --
2880: hr_utility.set_location('Leaving: '||l_proc,290);
2881: -- hr_utility.trace_off;
2882: EXCEPTION
2883: WHEN OTHERS THEN
2884: hr_utility.set_location('Leaving: '||l_proc,300);
2885: -- hr_utility.trace_off;
2880: hr_utility.set_location('Leaving: '||l_proc,290);
2881: -- hr_utility.trace_off;
2882: EXCEPTION
2883: WHEN OTHERS THEN
2884: hr_utility.set_location('Leaving: '||l_proc,300);
2885: -- hr_utility.trace_off;
2886: raise;
2887: END Create_asg_act_v5;
2888:
2881: -- hr_utility.trace_off;
2882: EXCEPTION
2883: WHEN OTHERS THEN
2884: hr_utility.set_location('Leaving: '||l_proc,300);
2885: -- hr_utility.trace_off;
2886: raise;
2887: END Create_asg_act_v5;
2888:
2889:
3022: l_proc CONSTANT VARCHAR2(50):= g_package||'archive_allocation_action';
3023: l_interval_of_payment VARCHAR2(1); -- Added the for the bug 9354919
3024: --
3025: BEGIN
3026: hr_utility.set_location('Entering '||l_proc, 10);
3027: hr_utility.trace('p_assignment_id='||p_assignment_id);
3028: hr_utility.trace('p_asg_act_id='||p_asg_act_id);
3029: hr_utility.trace('p_vehicle_allocation_id='||p_vehicle_allocation_id);
3030: hr_utility.trace('p_vehicle_repository_id='||p_vehicle_repository_id);
3023: l_interval_of_payment VARCHAR2(1); -- Added the for the bug 9354919
3024: --
3025: BEGIN
3026: hr_utility.set_location('Entering '||l_proc, 10);
3027: hr_utility.trace('p_assignment_id='||p_assignment_id);
3028: hr_utility.trace('p_asg_act_id='||p_asg_act_id);
3029: hr_utility.trace('p_vehicle_allocation_id='||p_vehicle_allocation_id);
3030: hr_utility.trace('p_vehicle_repository_id='||p_vehicle_repository_id);
3031: hr_utility.trace('p_action_flag='||p_action_flag);
3024: --
3025: BEGIN
3026: hr_utility.set_location('Entering '||l_proc, 10);
3027: hr_utility.trace('p_assignment_id='||p_assignment_id);
3028: hr_utility.trace('p_asg_act_id='||p_asg_act_id);
3029: hr_utility.trace('p_vehicle_allocation_id='||p_vehicle_allocation_id);
3030: hr_utility.trace('p_vehicle_repository_id='||p_vehicle_repository_id);
3031: hr_utility.trace('p_action_flag='||p_action_flag);
3032: hr_utility.trace('p_fuel_type_change_date='||fnd_date.date_to_displaydate(p_fuel_type_change_date));
3025: BEGIN
3026: hr_utility.set_location('Entering '||l_proc, 10);
3027: hr_utility.trace('p_assignment_id='||p_assignment_id);
3028: hr_utility.trace('p_asg_act_id='||p_asg_act_id);
3029: hr_utility.trace('p_vehicle_allocation_id='||p_vehicle_allocation_id);
3030: hr_utility.trace('p_vehicle_repository_id='||p_vehicle_repository_id);
3031: hr_utility.trace('p_action_flag='||p_action_flag);
3032: hr_utility.trace('p_fuel_type_change_date='||fnd_date.date_to_displaydate(p_fuel_type_change_date));
3033: hr_utility.trace('p_allocation_start_date='||fnd_date.date_to_displaydate(p_allocation_start_date));
3026: hr_utility.set_location('Entering '||l_proc, 10);
3027: hr_utility.trace('p_assignment_id='||p_assignment_id);
3028: hr_utility.trace('p_asg_act_id='||p_asg_act_id);
3029: hr_utility.trace('p_vehicle_allocation_id='||p_vehicle_allocation_id);
3030: hr_utility.trace('p_vehicle_repository_id='||p_vehicle_repository_id);
3031: hr_utility.trace('p_action_flag='||p_action_flag);
3032: hr_utility.trace('p_fuel_type_change_date='||fnd_date.date_to_displaydate(p_fuel_type_change_date));
3033: hr_utility.trace('p_allocation_start_date='||fnd_date.date_to_displaydate(p_allocation_start_date));
3034: hr_utility.trace('p_allocation_end_date='||fnd_date.date_to_displaydate(p_allocation_end_date));
3027: hr_utility.trace('p_assignment_id='||p_assignment_id);
3028: hr_utility.trace('p_asg_act_id='||p_asg_act_id);
3029: hr_utility.trace('p_vehicle_allocation_id='||p_vehicle_allocation_id);
3030: hr_utility.trace('p_vehicle_repository_id='||p_vehicle_repository_id);
3031: hr_utility.trace('p_action_flag='||p_action_flag);
3032: hr_utility.trace('p_fuel_type_change_date='||fnd_date.date_to_displaydate(p_fuel_type_change_date));
3033: hr_utility.trace('p_allocation_start_date='||fnd_date.date_to_displaydate(p_allocation_start_date));
3034: hr_utility.trace('p_allocation_end_date='||fnd_date.date_to_displaydate(p_allocation_end_date));
3035: -- Get data as of the action date within
3028: hr_utility.trace('p_asg_act_id='||p_asg_act_id);
3029: hr_utility.trace('p_vehicle_allocation_id='||p_vehicle_allocation_id);
3030: hr_utility.trace('p_vehicle_repository_id='||p_vehicle_repository_id);
3031: hr_utility.trace('p_action_flag='||p_action_flag);
3032: hr_utility.trace('p_fuel_type_change_date='||fnd_date.date_to_displaydate(p_fuel_type_change_date));
3033: hr_utility.trace('p_allocation_start_date='||fnd_date.date_to_displaydate(p_allocation_start_date));
3034: hr_utility.trace('p_allocation_end_date='||fnd_date.date_to_displaydate(p_allocation_end_date));
3035: -- Get data as of the action date within
3036: -- the date range, effective date is:
3029: hr_utility.trace('p_vehicle_allocation_id='||p_vehicle_allocation_id);
3030: hr_utility.trace('p_vehicle_repository_id='||p_vehicle_repository_id);
3031: hr_utility.trace('p_action_flag='||p_action_flag);
3032: hr_utility.trace('p_fuel_type_change_date='||fnd_date.date_to_displaydate(p_fuel_type_change_date));
3033: hr_utility.trace('p_allocation_start_date='||fnd_date.date_to_displaydate(p_allocation_start_date));
3034: hr_utility.trace('p_allocation_end_date='||fnd_date.date_to_displaydate(p_allocation_end_date));
3035: -- Get data as of the action date within
3036: -- the date range, effective date is:
3037: IF p_action_flag = 'F' THEN
3030: hr_utility.trace('p_vehicle_repository_id='||p_vehicle_repository_id);
3031: hr_utility.trace('p_action_flag='||p_action_flag);
3032: hr_utility.trace('p_fuel_type_change_date='||fnd_date.date_to_displaydate(p_fuel_type_change_date));
3033: hr_utility.trace('p_allocation_start_date='||fnd_date.date_to_displaydate(p_allocation_start_date));
3034: hr_utility.trace('p_allocation_end_date='||fnd_date.date_to_displaydate(p_allocation_end_date));
3035: -- Get data as of the action date within
3036: -- the date range, effective date is:
3037: IF p_action_flag = 'F' THEN
3038: -- Get data as of the fuel type change date
3041: l_eff_date := p_allocation_start_date;
3042: ELSIF p_action_flag = 'W' THEN
3043: l_eff_date := p_allocation_end_date;
3044: END IF;
3045: hr_utility.set_location(l_proc, 20);
3046: hr_utility.trace('l_eff_date='||fnd_date.date_to_displaydate(l_eff_date));
3047: --
3048: -- Get person details
3049: OPEN c_person(p_assignment_id);
3042: ELSIF p_action_flag = 'W' THEN
3043: l_eff_date := p_allocation_end_date;
3044: END IF;
3045: hr_utility.set_location(l_proc, 20);
3046: hr_utility.trace('l_eff_date='||fnd_date.date_to_displaydate(l_eff_date));
3047: --
3048: -- Get person details
3049: OPEN c_person(p_assignment_id);
3050: FETCH c_person INTO person_rec;
3049: OPEN c_person(p_assignment_id);
3050: FETCH c_person INTO person_rec;
3051: CLOSE c_person;
3052: --
3053: hr_utility.set_location(l_proc, 30);
3054: -- Get Address Details
3055: OPEN c_addr(person_rec.person_id);
3056: FETCH c_addr INTO addr_rec;
3057: CLOSE c_addr;
3055: OPEN c_addr(person_rec.person_id);
3056: FETCH c_addr INTO addr_rec;
3057: CLOSE c_addr;
3058: --
3059: hr_utility.set_location(l_proc, 40);
3060: -- Get Allocation details
3061: OPEN c_alloc;
3062: FETCH c_alloc INTO alloc_rec;
3063: CLOSE c_alloc;
3061: OPEN c_alloc;
3062: FETCH c_alloc INTO alloc_rec;
3063: CLOSE c_alloc;
3064: --
3065: hr_utility.set_location(l_proc, 50);
3066: -- Get Car details
3067: OPEN c_car;
3068: FETCH c_car INTO car_rec;
3069: CLOSE c_car;
3074: CLOSE c_interval_of_payment;
3075: -- Modification for the bug 9354919 ends here
3076:
3077: --
3078: hr_utility.set_location(l_proc, 60);
3079: ---------------------------------------------
3080: -- Archive Person and Address details --
3081: ---------------------------------------------
3082: hr_utility.trace('Person ID : ' || person_rec.person_id);
3078: hr_utility.set_location(l_proc, 60);
3079: ---------------------------------------------
3080: -- Archive Person and Address details --
3081: ---------------------------------------------
3082: hr_utility.trace('Person ID : ' || person_rec.person_id);
3083: hr_utility.trace('Last Name : ' || person_rec.last_name);
3084: hr_utility.trace('First Nme : ' || person_rec.first_name);
3085: hr_utility.trace('Title : ' || person_rec.title);
3086: hr_utility.trace('NINO : ' || person_rec.national_identifier);
3079: ---------------------------------------------
3080: -- Archive Person and Address details --
3081: ---------------------------------------------
3082: hr_utility.trace('Person ID : ' || person_rec.person_id);
3083: hr_utility.trace('Last Name : ' || person_rec.last_name);
3084: hr_utility.trace('First Nme : ' || person_rec.first_name);
3085: hr_utility.trace('Title : ' || person_rec.title);
3086: hr_utility.trace('NINO : ' || person_rec.national_identifier);
3087: hr_utility.trace('ADDR1 : ' || addr_rec.address_line1);
3080: -- Archive Person and Address details --
3081: ---------------------------------------------
3082: hr_utility.trace('Person ID : ' || person_rec.person_id);
3083: hr_utility.trace('Last Name : ' || person_rec.last_name);
3084: hr_utility.trace('First Nme : ' || person_rec.first_name);
3085: hr_utility.trace('Title : ' || person_rec.title);
3086: hr_utility.trace('NINO : ' || person_rec.national_identifier);
3087: hr_utility.trace('ADDR1 : ' || addr_rec.address_line1);
3088: hr_utility.trace('ADDR1 : ' || addr_rec.address_line2);
3081: ---------------------------------------------
3082: hr_utility.trace('Person ID : ' || person_rec.person_id);
3083: hr_utility.trace('Last Name : ' || person_rec.last_name);
3084: hr_utility.trace('First Nme : ' || person_rec.first_name);
3085: hr_utility.trace('Title : ' || person_rec.title);
3086: hr_utility.trace('NINO : ' || person_rec.national_identifier);
3087: hr_utility.trace('ADDR1 : ' || addr_rec.address_line1);
3088: hr_utility.trace('ADDR1 : ' || addr_rec.address_line2);
3089: hr_utility.trace('ADDR1 : ' || addr_rec.address_line3);
3082: hr_utility.trace('Person ID : ' || person_rec.person_id);
3083: hr_utility.trace('Last Name : ' || person_rec.last_name);
3084: hr_utility.trace('First Nme : ' || person_rec.first_name);
3085: hr_utility.trace('Title : ' || person_rec.title);
3086: hr_utility.trace('NINO : ' || person_rec.national_identifier);
3087: hr_utility.trace('ADDR1 : ' || addr_rec.address_line1);
3088: hr_utility.trace('ADDR1 : ' || addr_rec.address_line2);
3089: hr_utility.trace('ADDR1 : ' || addr_rec.address_line3);
3090: hr_utility.trace('City/Town : ' || addr_rec.town_or_city);
3083: hr_utility.trace('Last Name : ' || person_rec.last_name);
3084: hr_utility.trace('First Nme : ' || person_rec.first_name);
3085: hr_utility.trace('Title : ' || person_rec.title);
3086: hr_utility.trace('NINO : ' || person_rec.national_identifier);
3087: hr_utility.trace('ADDR1 : ' || addr_rec.address_line1);
3088: hr_utility.trace('ADDR1 : ' || addr_rec.address_line2);
3089: hr_utility.trace('ADDR1 : ' || addr_rec.address_line3);
3090: hr_utility.trace('City/Town : ' || addr_rec.town_or_city);
3091: hr_utility.trace('Regioin_1 : ' || addr_rec.region_1);
3084: hr_utility.trace('First Nme : ' || person_rec.first_name);
3085: hr_utility.trace('Title : ' || person_rec.title);
3086: hr_utility.trace('NINO : ' || person_rec.national_identifier);
3087: hr_utility.trace('ADDR1 : ' || addr_rec.address_line1);
3088: hr_utility.trace('ADDR1 : ' || addr_rec.address_line2);
3089: hr_utility.trace('ADDR1 : ' || addr_rec.address_line3);
3090: hr_utility.trace('City/Town : ' || addr_rec.town_or_city);
3091: hr_utility.trace('Regioin_1 : ' || addr_rec.region_1);
3092: hr_utility.trace('Postal : ' || addr_rec.postal_code);
3085: hr_utility.trace('Title : ' || person_rec.title);
3086: hr_utility.trace('NINO : ' || person_rec.national_identifier);
3087: hr_utility.trace('ADDR1 : ' || addr_rec.address_line1);
3088: hr_utility.trace('ADDR1 : ' || addr_rec.address_line2);
3089: hr_utility.trace('ADDR1 : ' || addr_rec.address_line3);
3090: hr_utility.trace('City/Town : ' || addr_rec.town_or_city);
3091: hr_utility.trace('Regioin_1 : ' || addr_rec.region_1);
3092: hr_utility.trace('Postal : ' || addr_rec.postal_code);
3093: hr_utility.trace('DOB : ' || fnd_date.date_to_canonical(person_rec.date_of_birth)); --For Bug 6652235
3086: hr_utility.trace('NINO : ' || person_rec.national_identifier);
3087: hr_utility.trace('ADDR1 : ' || addr_rec.address_line1);
3088: hr_utility.trace('ADDR1 : ' || addr_rec.address_line2);
3089: hr_utility.trace('ADDR1 : ' || addr_rec.address_line3);
3090: hr_utility.trace('City/Town : ' || addr_rec.town_or_city);
3091: hr_utility.trace('Regioin_1 : ' || addr_rec.region_1);
3092: hr_utility.trace('Postal : ' || addr_rec.postal_code);
3093: hr_utility.trace('DOB : ' || fnd_date.date_to_canonical(person_rec.date_of_birth)); --For Bug 6652235
3094: hr_utility.trace('Gender : ' || person_rec.sex); --For Bug 6652235
3087: hr_utility.trace('ADDR1 : ' || addr_rec.address_line1);
3088: hr_utility.trace('ADDR1 : ' || addr_rec.address_line2);
3089: hr_utility.trace('ADDR1 : ' || addr_rec.address_line3);
3090: hr_utility.trace('City/Town : ' || addr_rec.town_or_city);
3091: hr_utility.trace('Regioin_1 : ' || addr_rec.region_1);
3092: hr_utility.trace('Postal : ' || addr_rec.postal_code);
3093: hr_utility.trace('DOB : ' || fnd_date.date_to_canonical(person_rec.date_of_birth)); --For Bug 6652235
3094: hr_utility.trace('Gender : ' || person_rec.sex); --For Bug 6652235
3095:
3088: hr_utility.trace('ADDR1 : ' || addr_rec.address_line2);
3089: hr_utility.trace('ADDR1 : ' || addr_rec.address_line3);
3090: hr_utility.trace('City/Town : ' || addr_rec.town_or_city);
3091: hr_utility.trace('Regioin_1 : ' || addr_rec.region_1);
3092: hr_utility.trace('Postal : ' || addr_rec.postal_code);
3093: hr_utility.trace('DOB : ' || fnd_date.date_to_canonical(person_rec.date_of_birth)); --For Bug 6652235
3094: hr_utility.trace('Gender : ' || person_rec.sex); --For Bug 6652235
3095:
3096: pay_action_information_api.create_action_information (
3089: hr_utility.trace('ADDR1 : ' || addr_rec.address_line3);
3090: hr_utility.trace('City/Town : ' || addr_rec.town_or_city);
3091: hr_utility.trace('Regioin_1 : ' || addr_rec.region_1);
3092: hr_utility.trace('Postal : ' || addr_rec.postal_code);
3093: hr_utility.trace('DOB : ' || fnd_date.date_to_canonical(person_rec.date_of_birth)); --For Bug 6652235
3094: hr_utility.trace('Gender : ' || person_rec.sex); --For Bug 6652235
3095:
3096: pay_action_information_api.create_action_information (
3097: p_action_information_id => l_action_info_id
3090: hr_utility.trace('City/Town : ' || addr_rec.town_or_city);
3091: hr_utility.trace('Regioin_1 : ' || addr_rec.region_1);
3092: hr_utility.trace('Postal : ' || addr_rec.postal_code);
3093: hr_utility.trace('DOB : ' || fnd_date.date_to_canonical(person_rec.date_of_birth)); --For Bug 6652235
3094: hr_utility.trace('Gender : ' || person_rec.sex); --For Bug 6652235
3095:
3096: pay_action_information_api.create_action_information (
3097: p_action_information_id => l_action_info_id
3098: , p_action_context_id => p_asg_act_id
3116: , p_action_information11 => upper(addr_rec.postal_code)
3117: , p_action_information12 => fnd_date.date_to_canonical(person_rec.date_of_birth) --For Bug 6652235
3118: , p_action_information13 => upper(person_rec.sex)); --For Bug 6652235
3119: --
3120: hr_utility.set_location(l_proc, 70);
3121: ---------------------------------------------
3122: -- Archive Vehicle Allocation Details --
3123: ---------------------------------------------
3124: IF g_effective_date <
3135: l_tax_year_start := fnd_date.canonical_to_date(
3136: to_char(g_effective_date, 'YYYY')||'04/06');
3137: END IF;
3138: --
3139: hr_utility.set_location(l_proc, 80);
3140: --
3141: IF p_allocation_start_date >= l_tax_year_start THEN
3142: -- Car was first allocated in this tax year
3143: -- Archive Date Car First Available
3145: ELSE
3146: l_date_first_avail := NULL;
3147: END IF;
3148: --
3149: hr_utility.set_location(l_proc, 90);
3150: hr_utility.trace('l_date_first_avail='||l_date_first_avail);
3151: --
3152: ---------------------------------------------
3153: -- Check whether it's the primary car of --
3146: l_date_first_avail := NULL;
3147: END IF;
3148: --
3149: hr_utility.set_location(l_proc, 90);
3150: hr_utility.trace('l_date_first_avail='||l_date_first_avail);
3151: --
3152: ---------------------------------------------
3153: -- Check whether it's the primary car of --
3154: -- the employee --
3158: OPEN c_first_asg(p_assignment_id, l_eff_date);
3159: FETCH c_first_asg INTO first_asg_rec;
3160: CLOSE c_first_asg;
3161: --
3162: hr_utility.set_location(l_proc, 100);
3163: --
3164: -- Get primary car allocation of the
3165: -- first assignment of this person
3166: -- in this tax ref
3167: OPEN c_primary_car(first_asg_rec.assignment_id, l_eff_date);
3168: FETCH c_primary_car INTO primary_car_rec;
3169: CLOSE c_primary_car;
3170: --
3171: hr_utility.set_location(l_proc, 110);
3172: --
3173: IF primary_car_rec.vehicle_allocation_id
3174: = p_vehicle_allocation_id THEN
3175: -- This is the primary car allocation
3180: -- therefore mark it as a second car.
3181: l_second_car_flag := 'Y';
3182: END IF;
3183: --
3184: hr_utility.set_location(l_proc, 120);
3185: hr_utility.trace('l_second_car_flag='||l_second_car_flag);
3186: --
3187: -- To indicate the Fuel Type change date in EDI File. Also checked
3188: -- that this is not Second/Further car.
3181: l_second_car_flag := 'Y';
3182: END IF;
3183: --
3184: hr_utility.set_location(l_proc, 120);
3185: hr_utility.trace('l_second_car_flag='||l_second_car_flag);
3186: --
3187: -- To indicate the Fuel Type change date in EDI File. Also checked
3188: -- that this is not Second/Further car.
3189: IF NOT(p_fuel_type_Change_date is NULL) AND p_action_flag = 'F' THEN
3187: -- To indicate the Fuel Type change date in EDI File. Also checked
3188: -- that this is not Second/Further car.
3189: IF NOT(p_fuel_type_Change_date is NULL) AND p_action_flag = 'F' THEN
3190: l_date_first_avail := fnd_date.date_to_canonical(p_fuel_type_Change_date);
3191: hr_utility.trace('p_fuel_type_change_date='||p_fuel_type_Change_date);
3192: END IF;
3193:
3194:
3195: IF p_action_flag = 'N' THEN
3192: END IF;
3193:
3194:
3195: IF p_action_flag = 'N' THEN
3196: hr_utility.set_location(l_proc, 130);
3197: --
3198: pay_action_information_api.create_action_information (
3199: p_action_information_id => l_action_info_id
3200: , p_action_context_id => p_asg_act_id
3223: , p_action_information16 => upper(car_rec.make || ' ' || car_rec.model)
3224: , p_action_information17 => to_char(car_rec.engine_capacity_in_cc)
3225: , p_action_information22 => nvl(l_interval_of_payment,'Y')); -- Added for the bug 9354919
3226: --
3227: hr_utility.set_location(l_proc, 140);
3228: ELSIF p_action_flag = 'R' THEN
3229: hr_utility.set_location(l_proc, 150);
3230: --
3231: pay_action_information_api.create_action_information (
3225: , p_action_information22 => nvl(l_interval_of_payment,'Y')); -- Added for the bug 9354919
3226: --
3227: hr_utility.set_location(l_proc, 140);
3228: ELSIF p_action_flag = 'R' THEN
3229: hr_utility.set_location(l_proc, 150);
3230: --
3231: pay_action_information_api.create_action_information (
3232: p_action_information_id => l_action_info_id
3233: , p_action_context_id => p_asg_act_id
3261: , p_action_information21 => fnd_date.date_to_canonical(prior_prim_car_rec.effective_end_date)
3262: , p_action_information22 => nvl(l_interval_of_payment,'Y') -- Added for the bug 9354919
3263: );
3264: --
3265: hr_utility.set_location(l_proc, 160);
3266: ELSIF p_action_flag = 'W' THEN
3267: hr_utility.set_location(l_proc, 170);
3268: --
3269: pay_action_information_api.create_action_information (
3263: );
3264: --
3265: hr_utility.set_location(l_proc, 160);
3266: ELSIF p_action_flag = 'W' THEN
3267: hr_utility.set_location(l_proc, 170);
3268: --
3269: pay_action_information_api.create_action_information (
3270: p_action_information_id => l_action_info_id
3271: , p_action_context_id => p_asg_act_id
3295: , p_action_information17 => to_char(car_rec.engine_capacity_in_cc)
3296: , p_action_information22 => nvl(l_interval_of_payment,'Y') -- Added for the bug 9354919
3297: );
3298: --
3299: hr_utility.set_location(l_proc, 180);
3300: ELSIF p_action_flag = 'F' THEN
3301: hr_utility.set_location(l_proc, 190);
3302: --
3303: pay_action_information_api.create_action_information (
3297: );
3298: --
3299: hr_utility.set_location(l_proc, 180);
3300: ELSIF p_action_flag = 'F' THEN
3301: hr_utility.set_location(l_proc, 190);
3302: --
3303: pay_action_information_api.create_action_information (
3304: p_action_information_id => l_action_info_id
3305: , p_action_context_id => p_asg_act_id
3333: , p_action_information21 => fnd_date.date_to_canonical(p_fuel_type_change_date-1)
3334: , p_action_information22 => nvl(l_interval_of_payment,'Y') -- Added for the bug 9354919
3335: );
3336: --
3337: hr_utility.set_location(l_proc, 200);
3338: END IF;
3339: --
3340: hr_utility.set_location('Leaving '||l_proc, 300);
3341: END archive_allocation_action;
3336: --
3337: hr_utility.set_location(l_proc, 200);
3338: END IF;
3339: --
3340: hr_utility.set_location('Leaving '||l_proc, 300);
3341: END archive_allocation_action;
3342:
3343:
3344:
3375: l_action_flag VARCHAR2(1);
3376: l_archived_flag VARCHAR2(1);
3377: --
3378: BEGIN
3379: --hr_utility.trace_on(null, 'KTHAMPAN');
3380: hr_utility.set_location('Entering '||l_proc, 10);
3381: --
3382: For asg_rec IN c_asg
3383: LOOP
3376: l_archived_flag VARCHAR2(1);
3377: --
3378: BEGIN
3379: --hr_utility.trace_on(null, 'KTHAMPAN');
3380: hr_utility.set_location('Entering '||l_proc, 10);
3381: --
3382: For asg_rec IN c_asg
3383: LOOP
3384: -- Loop through all assignments
3381: --
3382: For asg_rec IN c_asg
3383: LOOP
3384: -- Loop through all assignments
3385: hr_utility.set_location(l_proc, 20);
3386: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
3387: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
3388: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
3389: --
3382: For asg_rec IN c_asg
3383: LOOP
3384: -- Loop through all assignments
3385: hr_utility.set_location(l_proc, 20);
3386: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
3387: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
3388: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
3389: --
3390: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
3383: LOOP
3384: -- Loop through all assignments
3385: hr_utility.set_location(l_proc, 20);
3386: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
3387: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
3388: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
3389: --
3390: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
3391: -- Loop through all vehicle allocations
3384: -- Loop through all assignments
3385: hr_utility.set_location(l_proc, 20);
3386: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
3387: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
3388: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
3389: --
3390: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
3391: -- Loop through all vehicle allocations
3392: -- over the date range
3389: --
3390: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
3391: -- Loop through all vehicle allocations
3392: -- over the date range
3393: hr_utility.set_location(l_proc, 30);
3394: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
3395: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
3396: --
3397: L_action_flag := 'X';
3390: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
3391: -- Loop through all vehicle allocations
3392: -- over the date range
3393: hr_utility.set_location(l_proc, 30);
3394: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
3395: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
3396: --
3397: L_action_flag := 'X';
3398: l_archived_flag := 'Y';
3391: -- Loop through all vehicle allocations
3392: -- over the date range
3393: hr_utility.set_location(l_proc, 30);
3394: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
3395: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
3396: --
3397: L_action_flag := 'X';
3398: l_archived_flag := 'Y';
3399: --
3400: OPEN c_alloc_dates(alc_rec.vehicle_allocation_id);
3401: FETCH c_alloc_dates INTO alc_dates_rec;
3402: CLOSE c_alloc_dates;
3403: --
3404: hr_utility.set_location(l_proc, 40);
3405: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3406: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3407: --
3408: -- Check whether vehicle was allocated or
3401: FETCH c_alloc_dates INTO alc_dates_rec;
3402: CLOSE c_alloc_dates;
3403: --
3404: hr_utility.set_location(l_proc, 40);
3405: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3406: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3407: --
3408: -- Check whether vehicle was allocated or
3409: -- Withdrawn within the date range also
3402: CLOSE c_alloc_dates;
3403: --
3404: hr_utility.set_location(l_proc, 40);
3405: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3406: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3407: --
3408: -- Check whether vehicle was allocated or
3409: -- Withdrawn within the date range also
3410: -- check that this allocation or withdrawal
3424: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.min_start_date);
3425: FETCH c_first_asg INTO first_asg_rec;
3426: CLOSE c_first_asg;
3427: --
3428: hr_utility.set_location(l_proc, 50);
3429: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
3430: -- Get primary car allocation of the
3431: -- first assignment of this person
3432: -- in this tax ref
3425: FETCH c_first_asg INTO first_asg_rec;
3426: CLOSE c_first_asg;
3427: --
3428: hr_utility.set_location(l_proc, 50);
3429: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
3430: -- Get primary car allocation of the
3431: -- first assignment of this person
3432: -- in this tax ref
3433: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
3433: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
3434: FETCH c_primary_car INTO primary_car_rec;
3435: CLOSE c_primary_car;
3436: --
3437: hr_utility.set_location(l_proc, 60);
3438: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
3439: --
3440: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
3441: -- This is the first car allocation
3434: FETCH c_primary_car INTO primary_car_rec;
3435: CLOSE c_primary_car;
3436: --
3437: hr_utility.set_location(l_proc, 60);
3438: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
3439: --
3440: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
3441: -- This is the first car allocation
3442: -- of this employee in this tax ref
3449: ELSE
3450: L_action_flag := 'N';
3451: END IF;
3452: --
3453: hr_utility.set_location(l_proc, 70);
3454: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3455: --
3456: CLOSE c_prior_prim_car;
3457: ELSE
3450: L_action_flag := 'N';
3451: END IF;
3452: --
3453: hr_utility.set_location(l_proc, 70);
3454: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3455: --
3456: CLOSE c_prior_prim_car;
3457: ELSE
3458: -- Not the first car of the employee
3459: -- report this as new car
3460: L_action_flag := 'N';
3461: END IF;
3462: --
3463: hr_utility.set_location(l_proc, 80);
3464: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3465: --
3466: ELSE
3467: -- Not a primary car therefore mark
3460: L_action_flag := 'N';
3461: END IF;
3462: --
3463: hr_utility.set_location(l_proc, 80);
3464: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3465: --
3466: ELSE
3467: -- Not a primary car therefore mark
3468: -- it as new car allocation action
3468: -- it as new car allocation action
3469: l_action_flag := 'N';
3470: END IF;
3471: --
3472: hr_utility.set_location(l_proc, 90);
3473: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3474: --
3475: IF L_action_flag <> 'X' THEN
3476: -- Check whether this allocation action
3469: l_action_flag := 'N';
3470: END IF;
3471: --
3472: hr_utility.set_location(l_proc, 90);
3473: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3474: --
3475: IF L_action_flag <> 'X' THEN
3476: -- Check whether this allocation action
3477: -- has been already archived
3480: alc_rec.vehicle_allocation_id,
3481: alc_dates_rec.min_start_date,
3482: l_action_flag);
3483: --
3484: hr_utility.set_location(l_proc, 100);
3485: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
3486: --
3487: IF l_archived_flag = 'N' THEN
3488: -- Action has not been archived already
3481: alc_dates_rec.min_start_date,
3482: l_action_flag);
3483: --
3484: hr_utility.set_location(l_proc, 100);
3485: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
3486: --
3487: IF l_archived_flag = 'N' THEN
3488: -- Action has not been archived already
3489: -- therefore archive it.
3486: --
3487: IF l_archived_flag = 'N' THEN
3488: -- Action has not been archived already
3489: -- therefore archive it.
3490: hr_utility.set_location(l_proc, 105);
3491: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3492: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3493: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3494: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3487: IF l_archived_flag = 'N' THEN
3488: -- Action has not been archived already
3489: -- therefore archive it.
3490: hr_utility.set_location(l_proc, 105);
3491: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3492: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3493: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3494: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3495: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3488: -- Action has not been archived already
3489: -- therefore archive it.
3490: hr_utility.set_location(l_proc, 105);
3491: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3492: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3493: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3494: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3495: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3496: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3489: -- therefore archive it.
3490: hr_utility.set_location(l_proc, 105);
3491: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3492: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3493: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3494: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3495: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3496: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3497: --
3490: hr_utility.set_location(l_proc, 105);
3491: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3492: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3493: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3494: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3495: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3496: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3497: --
3498: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
3491: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3492: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3493: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3494: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3495: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3496: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3497: --
3498: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
3499: p_asg_act_id => p_assactid,
3492: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3493: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3494: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3495: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3496: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3497: --
3498: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
3499: p_asg_act_id => p_assactid,
3500: p_vehicle_allocation_id => alc_rec.vehicle_allocation_id,
3523: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.max_end_date);
3524: FETCH c_first_asg INTO first_asg_rec;
3525: CLOSE c_first_asg;
3526: --
3527: hr_utility.set_location(l_proc, 50);
3528: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
3529: -- Get primary car allocation of the
3530: -- first assignment of this person
3531: -- in this tax ref
3524: FETCH c_first_asg INTO first_asg_rec;
3525: CLOSE c_first_asg;
3526: --
3527: hr_utility.set_location(l_proc, 50);
3528: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
3529: -- Get primary car allocation of the
3530: -- first assignment of this person
3531: -- in this tax ref
3532: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
3532: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
3533: FETCH c_primary_car INTO primary_car_rec;
3534: CLOSE c_primary_car;
3535: --
3536: hr_utility.set_location(l_proc, 60);
3537: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
3538: --
3539: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
3540: --
3533: FETCH c_primary_car INTO primary_car_rec;
3534: CLOSE c_primary_car;
3535: --
3536: hr_utility.set_location(l_proc, 60);
3537: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
3538: --
3539: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
3540: --
3541: OPEN c_next_prim_car(asg_rec.assignment_id, Alc_dates_rec.max_end_date);
3549: -- This is a withdrawal action
3550: L_action_flag := 'W';
3551: END IF;
3552: --
3553: hr_utility.set_location(l_proc, 70);
3554: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3555: --
3556: CLOSE c_next_prim_car;
3557: ELSE
3550: L_action_flag := 'W';
3551: END IF;
3552: --
3553: hr_utility.set_location(l_proc, 70);
3554: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3555: --
3556: CLOSE c_next_prim_car;
3557: ELSE
3558: -- Not the first car of the employee
3560: L_action_flag := 'W';
3561: END IF;
3562: --
3563: --
3564: hr_utility.set_location(l_proc, 80);
3565: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3566: --
3567: ELSE
3568: -- Not a first car therefore mark
3561: END IF;
3562: --
3563: --
3564: hr_utility.set_location(l_proc, 80);
3565: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3566: --
3567: ELSE
3568: -- Not a first car therefore mark
3569: -- it as withdrawal car action
3569: -- it as withdrawal car action
3570: l_action_flag := 'W';
3571: END IF;
3572: --
3573: hr_utility.set_location(l_proc, 90);
3574: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3575: --
3576: IF L_action_flag <> 'X' THEN
3577: -- Check whether this allocation action
3570: l_action_flag := 'W';
3571: END IF;
3572: --
3573: hr_utility.set_location(l_proc, 90);
3574: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3575: --
3576: IF L_action_flag <> 'X' THEN
3577: -- Check whether this allocation action
3578: -- has been already archived
3581: alc_rec.vehicle_allocation_id,
3582: alc_dates_rec.min_start_date,
3583: l_action_flag);
3584: --
3585: hr_utility.set_location(l_proc, 100);
3586: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
3587: --
3588: IF l_archived_flag = 'N' THEN
3589: -- Action has not been archived already
3582: alc_dates_rec.min_start_date,
3583: l_action_flag);
3584: --
3585: hr_utility.set_location(l_proc, 100);
3586: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
3587: --
3588: IF l_archived_flag = 'N' THEN
3589: -- Action has not been archived already
3590: -- therefore archive it.
3587: --
3588: IF l_archived_flag = 'N' THEN
3589: -- Action has not been archived already
3590: -- therefore archive it.
3591: hr_utility.set_location(l_proc, 105);
3592: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3593: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3594: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3595: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3588: IF l_archived_flag = 'N' THEN
3589: -- Action has not been archived already
3590: -- therefore archive it.
3591: hr_utility.set_location(l_proc, 105);
3592: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3593: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3594: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3595: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3596: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3589: -- Action has not been archived already
3590: -- therefore archive it.
3591: hr_utility.set_location(l_proc, 105);
3592: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3593: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3594: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3595: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3596: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3597: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3590: -- therefore archive it.
3591: hr_utility.set_location(l_proc, 105);
3592: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3593: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3594: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3595: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3596: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3597: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3598: --
3591: hr_utility.set_location(l_proc, 105);
3592: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3593: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3594: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3595: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3596: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3597: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3598: --
3599: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
3592: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3593: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3594: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3595: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3596: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3597: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3598: --
3599: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
3600: p_asg_act_id => p_assactid,
3593: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3594: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3595: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3596: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3597: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3598: --
3599: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
3600: p_asg_act_id => p_assactid,
3601: p_vehicle_allocation_id => alc_rec.vehicle_allocation_id,
3612: -- Fuel type has changed therefore make sure
3613: -- this change occured after the vehicle was
3614: -- allocated to this assignment
3615: --
3616: hr_utility.set_location(l_proc, 110);
3617: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
3618: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
3619: --
3620: IF (vehicle_changes_rec.effective_start_date
3613: -- this change occured after the vehicle was
3614: -- allocated to this assignment
3615: --
3616: hr_utility.set_location(l_proc, 110);
3617: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
3618: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
3619: --
3620: IF (vehicle_changes_rec.effective_start_date
3621: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
3614: -- allocated to this assignment
3615: --
3616: hr_utility.set_location(l_proc, 110);
3617: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
3618: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
3619: --
3620: IF (vehicle_changes_rec.effective_start_date
3621: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
3622: (vehicle_changes_rec.effective_start_date
3629: alc_rec.vehicle_allocation_id,
3630: vehicle_changes_rec.effective_start_date,
3631: 'F');
3632: --
3633: hr_utility.set_location(l_proc, 120);
3634: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
3635: --
3636: IF l_archived_flag = 'N' THEN
3637: -- Action has not been archived already
3630: vehicle_changes_rec.effective_start_date,
3631: 'F');
3632: --
3633: hr_utility.set_location(l_proc, 120);
3634: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
3635: --
3636: IF l_archived_flag = 'N' THEN
3637: -- Action has not been archived already
3638: -- therefore archive it.
3648: END IF;
3649: END IF;
3650: END LOOP;
3651: --
3652: hr_utility.set_location(l_proc, 130);
3653: --
3654: L_action_flag := 'X';
3655: l_archived_flag := 'Y';
3656: --
3664: -- Assignment has started on this payroll or tax ref during the
3665: -- input date range and this car allocation was active on the
3666: -- start date therefore check whether it is a transfer
3667: -- from another tax ref
3668: hr_utility.set_location(l_proc, 160);
3669: l_previous_tax_ref := NULL;
3670: --
3671: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
3672: FETCH c_tax_ref INTO l_previous_tax_ref;
3671: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
3672: FETCH c_tax_ref INTO l_previous_tax_ref;
3673: CLOSE c_tax_ref;
3674: --
3675: hr_utility.set_location(l_proc, 170);
3676: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
3677: --
3678: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
3679: -- This assignment has a different prior tax ref
3672: FETCH c_tax_ref INTO l_previous_tax_ref;
3673: CLOSE c_tax_ref;
3674: --
3675: hr_utility.set_location(l_proc, 170);
3676: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
3677: --
3678: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
3679: -- This assignment has a different prior tax ref
3680: -- therefore it should be reported as a new car
3678: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
3679: -- This assignment has a different prior tax ref
3680: -- therefore it should be reported as a new car
3681: -- allocation on this EDI message.
3682: hr_utility.set_location(l_proc, 180);
3683: l_action_flag := 'N';
3684: --
3685: -- Check whether this allocation action
3686: -- has been already archived
3689: alc_rec.vehicle_allocation_id,
3690: asg_rec.asg_min_start_date,
3691: l_action_flag);
3692: --
3693: hr_utility.set_location(l_proc, 190);
3694: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
3695: --
3696: IF l_archived_flag = 'N' THEN
3697: -- Action has not been archived already
3690: asg_rec.asg_min_start_date,
3691: l_action_flag);
3692: --
3693: hr_utility.set_location(l_proc, 190);
3694: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
3695: --
3696: IF l_archived_flag = 'N' THEN
3697: -- Action has not been archived already
3698: -- therefore archive it.
3716: -- Assignment has ended on this payroll or tax ref during the
3717: -- input date range and this car allocation was active on the
3718: -- end date therefore check whether it is a transfer
3719: -- to another tax ref
3720: hr_utility.set_location(l_proc, 200);
3721: l_next_tax_ref := NULL;
3722: --
3723: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
3724: FETCH c_tax_ref INTO l_next_tax_ref;
3723: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
3724: FETCH c_tax_ref INTO l_next_tax_ref;
3725: CLOSE c_tax_ref;
3726: --
3727: hr_utility.set_location(l_proc, 210);
3728: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
3729: --
3730: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
3731: -- This assignment has a different tax ref after end date
3724: FETCH c_tax_ref INTO l_next_tax_ref;
3725: CLOSE c_tax_ref;
3726: --
3727: hr_utility.set_location(l_proc, 210);
3728: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
3729: --
3730: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
3731: -- This assignment has a different tax ref after end date
3732: -- therefore it should be reported as allocation withdrawal
3730: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
3731: -- This assignment has a different tax ref after end date
3732: -- therefore it should be reported as allocation withdrawal
3733: -- on this EDI message.
3734: hr_utility.set_location(l_proc, 220);
3735: l_action_flag := 'W';
3736: --
3737: -- Check whether this allocation action
3738: -- has been already archived
3741: alc_rec.vehicle_allocation_id,
3742: asg_rec.asg_max_end_date,
3743: l_action_flag);
3744: --
3745: hr_utility.set_location(l_proc, 230);
3746: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
3747: --
3748: IF l_archived_flag = 'N' THEN
3749: -- Action has not been archived already
3742: asg_rec.asg_max_end_date,
3743: l_action_flag);
3744: --
3745: hr_utility.set_location(l_proc, 230);
3746: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
3747: --
3748: IF l_archived_flag = 'N' THEN
3749: -- Action has not been archived already
3750: -- therefore archive it.
3759: --
3760: END IF;
3761: END IF;
3762: --
3763: hr_utility.set_location(l_proc, 240);
3764: --
3765: hr_utility.set_location(l_proc, 250);
3766: END LOOP;
3767: --
3761: END IF;
3762: --
3763: hr_utility.set_location(l_proc, 240);
3764: --
3765: hr_utility.set_location(l_proc, 250);
3766: END LOOP;
3767: --
3768: hr_utility.set_location(l_proc, 260);
3769: --
3764: --
3765: hr_utility.set_location(l_proc, 250);
3766: END LOOP;
3767: --
3768: hr_utility.set_location(l_proc, 260);
3769: --
3770: END LOOP;
3771: --
3772: hr_utility.set_location('Leaving: '||l_proc,290);
3768: hr_utility.set_location(l_proc, 260);
3769: --
3770: END LOOP;
3771: --
3772: hr_utility.set_location('Leaving: '||l_proc,290);
3773: --hr_utility.trace_off;
3774: EXCEPTION
3775: WHEN OTHERS THEN
3776: hr_utility.set_location('Leaving: '||l_proc,300);
3769: --
3770: END LOOP;
3771: --
3772: hr_utility.set_location('Leaving: '||l_proc,290);
3773: --hr_utility.trace_off;
3774: EXCEPTION
3775: WHEN OTHERS THEN
3776: hr_utility.set_location('Leaving: '||l_proc,300);
3777: -- hr_utility.trace_off;
3772: hr_utility.set_location('Leaving: '||l_proc,290);
3773: --hr_utility.trace_off;
3774: EXCEPTION
3775: WHEN OTHERS THEN
3776: hr_utility.set_location('Leaving: '||l_proc,300);
3777: -- hr_utility.trace_off;
3778: raise;
3779: END archive_code_v2;
3780:
3773: --hr_utility.trace_off;
3774: EXCEPTION
3775: WHEN OTHERS THEN
3776: hr_utility.set_location('Leaving: '||l_proc,300);
3777: -- hr_utility.trace_off;
3778: raise;
3779: END archive_code_v2;
3780:
3781: --For Bug 8986543
3812: l_archived_flag VARCHAR2(1);
3813: --
3814: BEGIN
3815:
3816: hr_utility.set_location('Entering '||l_proc, 10);
3817: --
3818: For asg_rec IN c_asg
3819: LOOP
3820: -- Loop through all assignments
3817: --
3818: For asg_rec IN c_asg
3819: LOOP
3820: -- Loop through all assignments
3821: hr_utility.set_location(l_proc, 20);
3822: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
3823: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
3824: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
3825: --
3818: For asg_rec IN c_asg
3819: LOOP
3820: -- Loop through all assignments
3821: hr_utility.set_location(l_proc, 20);
3822: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
3823: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
3824: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
3825: --
3826: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
3819: LOOP
3820: -- Loop through all assignments
3821: hr_utility.set_location(l_proc, 20);
3822: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
3823: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
3824: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
3825: --
3826: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
3827: -- Loop through all vehicle allocations
3820: -- Loop through all assignments
3821: hr_utility.set_location(l_proc, 20);
3822: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
3823: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
3824: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
3825: --
3826: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
3827: -- Loop through all vehicle allocations
3828: -- over the date range
3825: --
3826: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
3827: -- Loop through all vehicle allocations
3828: -- over the date range
3829: hr_utility.set_location(l_proc, 30);
3830: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
3831: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
3832: --
3833: L_action_flag := 'X';
3826: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
3827: -- Loop through all vehicle allocations
3828: -- over the date range
3829: hr_utility.set_location(l_proc, 30);
3830: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
3831: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
3832: --
3833: L_action_flag := 'X';
3834: l_archived_flag := 'Y';
3827: -- Loop through all vehicle allocations
3828: -- over the date range
3829: hr_utility.set_location(l_proc, 30);
3830: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
3831: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
3832: --
3833: L_action_flag := 'X';
3834: l_archived_flag := 'Y';
3835: --
3836: OPEN c_alloc_dates(alc_rec.vehicle_allocation_id);
3837: FETCH c_alloc_dates INTO alc_dates_rec;
3838: CLOSE c_alloc_dates;
3839: --
3840: hr_utility.set_location(l_proc, 40);
3841: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3842: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3843:
3844: -- Moved the code here from below for the bug 10088866
3837: FETCH c_alloc_dates INTO alc_dates_rec;
3838: CLOSE c_alloc_dates;
3839: --
3840: hr_utility.set_location(l_proc, 40);
3841: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3842: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3843:
3844: -- Moved the code here from below for the bug 10088866
3845: -- Start moving for the bug 10088866
3838: CLOSE c_alloc_dates;
3839: --
3840: hr_utility.set_location(l_proc, 40);
3841: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3842: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3843:
3844: -- Moved the code here from below for the bug 10088866
3845: -- Start moving for the bug 10088866
3846: -- Private flag logic
3850: L_action_flag := 'X';
3851: l_archived_flag := 'Y';
3852: --
3853: FOR private_flag_iterator IN private_flag_arch(alc_rec.vehicle_allocation_id) LOOP
3854: hr_utility.set_location(l_proc, 250);
3855: hr_utility.trace(l_proc||', private_flag_iterator.private_use_flag='||private_flag_iterator.private_use_flag);
3856:
3857: L_action_flag := 'X';
3858: l_archived_flag := 'Y';
3851: l_archived_flag := 'Y';
3852: --
3853: FOR private_flag_iterator IN private_flag_arch(alc_rec.vehicle_allocation_id) LOOP
3854: hr_utility.set_location(l_proc, 250);
3855: hr_utility.trace(l_proc||', private_flag_iterator.private_use_flag='||private_flag_iterator.private_use_flag);
3856:
3857: L_action_flag := 'X';
3858: l_archived_flag := 'Y';
3859:
3869: private_flag_iterator.effective_start_date,
3870: l_action_flag,
3871: private_flag_iterator.effective_start_date);
3872: --
3873: hr_utility.set_location(l_proc, 260);
3874: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
3875: --
3876: IF l_archived_flag = 'N' THEN
3877: -- Action has not been archived already
3870: l_action_flag,
3871: private_flag_iterator.effective_start_date);
3872: --
3873: hr_utility.set_location(l_proc, 260);
3874: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
3875: --
3876: IF l_archived_flag = 'N' THEN
3877: -- Action has not been archived already
3878: -- therefore archive it.
3917: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.min_start_date);
3918: FETCH c_first_asg INTO first_asg_rec;
3919: CLOSE c_first_asg;
3920: --
3921: hr_utility.set_location(l_proc, 50);
3922: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
3923: -- Get primary car allocation of the
3924: -- first assignment of this person
3925: -- in this tax ref
3918: FETCH c_first_asg INTO first_asg_rec;
3919: CLOSE c_first_asg;
3920: --
3921: hr_utility.set_location(l_proc, 50);
3922: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
3923: -- Get primary car allocation of the
3924: -- first assignment of this person
3925: -- in this tax ref
3926: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
3926: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
3927: FETCH c_primary_car INTO primary_car_rec;
3928: CLOSE c_primary_car;
3929: --
3930: hr_utility.set_location(l_proc, 60);
3931: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
3932: --
3933: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
3934: -- This is the first car allocation
3927: FETCH c_primary_car INTO primary_car_rec;
3928: CLOSE c_primary_car;
3929: --
3930: hr_utility.set_location(l_proc, 60);
3931: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
3932: --
3933: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
3934: -- This is the first car allocation
3935: -- of this employee in this tax ref
3942: ELSE
3943: L_action_flag := 'N';
3944: END IF;
3945: --
3946: hr_utility.set_location(l_proc, 70);
3947: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3948: --
3949: CLOSE c_prior_prim_car;
3950: ELSE
3943: L_action_flag := 'N';
3944: END IF;
3945: --
3946: hr_utility.set_location(l_proc, 70);
3947: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3948: --
3949: CLOSE c_prior_prim_car;
3950: ELSE
3951: -- Not the first car of the employee
3952: -- report this as new car
3953: L_action_flag := 'N';
3954: END IF;
3955: --
3956: hr_utility.set_location(l_proc, 80);
3957: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3958: --
3959: ELSE
3960: -- Not a primary car therefore mark
3953: L_action_flag := 'N';
3954: END IF;
3955: --
3956: hr_utility.set_location(l_proc, 80);
3957: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3958: --
3959: ELSE
3960: -- Not a primary car therefore mark
3961: -- it as new car allocation action
3961: -- it as new car allocation action
3962: l_action_flag := 'N';
3963: END IF;
3964: --
3965: hr_utility.set_location(l_proc, 90);
3966: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3967: --
3968: IF L_action_flag <> 'X' THEN
3969: -- Check whether this allocation action
3962: l_action_flag := 'N';
3963: END IF;
3964: --
3965: hr_utility.set_location(l_proc, 90);
3966: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3967: --
3968: IF L_action_flag <> 'X' THEN
3969: -- Check whether this allocation action
3970: -- has been already archived
3974: alc_dates_rec.min_start_date,
3975: l_action_flag,
3976: alc_rec.effective_start_date); -- Added for the bug 10088866
3977: --
3978: hr_utility.set_location(l_proc, 100);
3979: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
3980: --
3981: IF (l_archived_flag = 'N' AND l_action_flag <> 'R') --No need to archive replaced car as per new requirements of V3
3982: THEN
3975: l_action_flag,
3976: alc_rec.effective_start_date); -- Added for the bug 10088866
3977: --
3978: hr_utility.set_location(l_proc, 100);
3979: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
3980: --
3981: IF (l_archived_flag = 'N' AND l_action_flag <> 'R') --No need to archive replaced car as per new requirements of V3
3982: THEN
3983: -- Action has not been archived already
3981: IF (l_archived_flag = 'N' AND l_action_flag <> 'R') --No need to archive replaced car as per new requirements of V3
3982: THEN
3983: -- Action has not been archived already
3984: -- therefore archive it.
3985: hr_utility.set_location(l_proc, 105);
3986: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3987: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3988: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3989: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3982: THEN
3983: -- Action has not been archived already
3984: -- therefore archive it.
3985: hr_utility.set_location(l_proc, 105);
3986: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3987: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3988: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3989: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3990: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3983: -- Action has not been archived already
3984: -- therefore archive it.
3985: hr_utility.set_location(l_proc, 105);
3986: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3987: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3988: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3989: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3990: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3991: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3984: -- therefore archive it.
3985: hr_utility.set_location(l_proc, 105);
3986: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3987: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3988: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3989: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3990: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3991: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3992: --
3985: hr_utility.set_location(l_proc, 105);
3986: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3987: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3988: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3989: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3990: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3991: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3992: --
3993: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
3986: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
3987: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3988: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3989: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3990: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3991: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3992: --
3993: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
3994: p_asg_act_id => p_assactid,
3987: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
3988: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
3989: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
3990: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
3991: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
3992: --
3993: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
3994: p_asg_act_id => p_assactid,
3995: p_vehicle_allocation_id => alc_rec.vehicle_allocation_id,
4018: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.max_end_date);
4019: FETCH c_first_asg INTO first_asg_rec;
4020: CLOSE c_first_asg;
4021: --
4022: hr_utility.set_location(l_proc, 50);
4023: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
4024: -- Get primary car allocation of the
4025: -- first assignment of this person
4026: -- in this tax ref
4019: FETCH c_first_asg INTO first_asg_rec;
4020: CLOSE c_first_asg;
4021: --
4022: hr_utility.set_location(l_proc, 50);
4023: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
4024: -- Get primary car allocation of the
4025: -- first assignment of this person
4026: -- in this tax ref
4027: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
4027: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
4028: FETCH c_primary_car INTO primary_car_rec;
4029: CLOSE c_primary_car;
4030: --
4031: hr_utility.set_location(l_proc, 60);
4032: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
4033: --
4034: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
4035: --
4028: FETCH c_primary_car INTO primary_car_rec;
4029: CLOSE c_primary_car;
4030: --
4031: hr_utility.set_location(l_proc, 60);
4032: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
4033: --
4034: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
4035: --
4036: OPEN c_next_prim_car(asg_rec.assignment_id, Alc_dates_rec.max_end_date);
4044: -- This is a withdrawal action
4045: L_action_flag := 'W';
4046: END IF;
4047: --
4048: hr_utility.set_location(l_proc, 70);
4049: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4050: --
4051: CLOSE c_next_prim_car;
4052: ELSE
4045: L_action_flag := 'W';
4046: END IF;
4047: --
4048: hr_utility.set_location(l_proc, 70);
4049: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4050: --
4051: CLOSE c_next_prim_car;
4052: ELSE
4053: -- Not the first car of the employee
4055: L_action_flag := 'W';
4056: END IF;
4057: --
4058: --
4059: hr_utility.set_location(l_proc, 80);
4060: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4061: --
4062: ELSE
4063: -- Not a first car therefore mark
4056: END IF;
4057: --
4058: --
4059: hr_utility.set_location(l_proc, 80);
4060: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4061: --
4062: ELSE
4063: -- Not a first car therefore mark
4064: -- it as withdrawal car action
4064: -- it as withdrawal car action
4065: l_action_flag := 'W';
4066: END IF;
4067: --
4068: hr_utility.set_location(l_proc, 90);
4069: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4070: --
4071: IF L_action_flag <> 'X' THEN
4072: -- Check whether this allocation action
4065: l_action_flag := 'W';
4066: END IF;
4067: --
4068: hr_utility.set_location(l_proc, 90);
4069: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4070: --
4071: IF L_action_flag <> 'X' THEN
4072: -- Check whether this allocation action
4073: -- has been already archived
4077: alc_dates_rec.min_start_date,
4078: l_action_flag,
4079: alc_rec.effective_start_date); -- Added for the bug 10088866
4080: --
4081: hr_utility.set_location(l_proc, 100);
4082: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4083: --
4084: IF l_archived_flag = 'N' THEN
4085: -- Action has not been archived already
4078: l_action_flag,
4079: alc_rec.effective_start_date); -- Added for the bug 10088866
4080: --
4081: hr_utility.set_location(l_proc, 100);
4082: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4083: --
4084: IF l_archived_flag = 'N' THEN
4085: -- Action has not been archived already
4086: -- therefore archive it.
4083: --
4084: IF l_archived_flag = 'N' THEN
4085: -- Action has not been archived already
4086: -- therefore archive it.
4087: hr_utility.set_location(l_proc, 105);
4088: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4089: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4090: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4091: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4084: IF l_archived_flag = 'N' THEN
4085: -- Action has not been archived already
4086: -- therefore archive it.
4087: hr_utility.set_location(l_proc, 105);
4088: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4089: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4090: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4091: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4092: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4085: -- Action has not been archived already
4086: -- therefore archive it.
4087: hr_utility.set_location(l_proc, 105);
4088: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4089: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4090: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4091: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4092: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4093: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4086: -- therefore archive it.
4087: hr_utility.set_location(l_proc, 105);
4088: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4089: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4090: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4091: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4092: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4093: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4094: --
4087: hr_utility.set_location(l_proc, 105);
4088: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4089: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4090: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4091: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4092: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4093: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4094: --
4095: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
4088: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4089: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4090: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4091: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4092: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4093: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4094: --
4095: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
4096: p_asg_act_id => p_assactid,
4089: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4090: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4091: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4092: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4093: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4094: --
4095: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
4096: p_asg_act_id => p_assactid,
4097: p_vehicle_allocation_id => alc_rec.vehicle_allocation_id,
4108: -- Fuel type has changed therefore make sure
4109: -- this change occured after the vehicle was
4110: -- allocated to this assignment
4111: --
4112: hr_utility.set_location(l_proc, 110);
4113: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
4114: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
4115: --
4116: IF (vehicle_changes_rec.effective_start_date
4109: -- this change occured after the vehicle was
4110: -- allocated to this assignment
4111: --
4112: hr_utility.set_location(l_proc, 110);
4113: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
4114: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
4115: --
4116: IF (vehicle_changes_rec.effective_start_date
4117: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
4110: -- allocated to this assignment
4111: --
4112: hr_utility.set_location(l_proc, 110);
4113: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
4114: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
4115: --
4116: IF (vehicle_changes_rec.effective_start_date
4117: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
4118: (vehicle_changes_rec.effective_start_date
4126: vehicle_changes_rec.effective_start_date,
4127: 'F',
4128: alc_rec.effective_start_date); -- Added for the bug 10088866
4129: --
4130: hr_utility.set_location(l_proc, 120);
4131: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4132: --
4133: IF l_archived_flag = 'N' THEN
4134: -- Action has not been archived already
4127: 'F',
4128: alc_rec.effective_start_date); -- Added for the bug 10088866
4129: --
4130: hr_utility.set_location(l_proc, 120);
4131: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4132: --
4133: IF l_archived_flag = 'N' THEN
4134: -- Action has not been archived already
4135: -- therefore archive it.
4145: END IF;
4146: END IF;
4147: END LOOP;
4148: --
4149: hr_utility.set_location(l_proc, 130);
4150: --
4151: L_action_flag := 'X';
4152: l_archived_flag := 'Y';
4153: --
4161: -- Assignment has started on this payroll or tax ref during the
4162: -- input date range and this car allocation was active on the
4163: -- start date therefore check whether it is a transfer
4164: -- from another tax ref
4165: hr_utility.set_location(l_proc, 160);
4166: l_previous_tax_ref := NULL;
4167: --
4168: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
4169: FETCH c_tax_ref INTO l_previous_tax_ref;
4168: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
4169: FETCH c_tax_ref INTO l_previous_tax_ref;
4170: CLOSE c_tax_ref;
4171: --
4172: hr_utility.set_location(l_proc, 170);
4173: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
4174: --
4175: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
4176: -- This assignment has a different prior tax ref
4169: FETCH c_tax_ref INTO l_previous_tax_ref;
4170: CLOSE c_tax_ref;
4171: --
4172: hr_utility.set_location(l_proc, 170);
4173: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
4174: --
4175: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
4176: -- This assignment has a different prior tax ref
4177: -- therefore it should be reported as a new car
4175: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
4176: -- This assignment has a different prior tax ref
4177: -- therefore it should be reported as a new car
4178: -- allocation on this EDI message.
4179: hr_utility.set_location(l_proc, 180);
4180: l_action_flag := 'N';
4181: --
4182: -- Check whether this allocation action
4183: -- has been already archived
4187: asg_rec.asg_min_start_date,
4188: l_action_flag,
4189: alc_rec.effective_start_date); -- Added for the bug 10088866
4190: --
4191: hr_utility.set_location(l_proc, 190);
4192: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4193: --
4194: IF l_archived_flag = 'N' THEN
4195: -- Action has not been archived already
4188: l_action_flag,
4189: alc_rec.effective_start_date); -- Added for the bug 10088866
4190: --
4191: hr_utility.set_location(l_proc, 190);
4192: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4193: --
4194: IF l_archived_flag = 'N' THEN
4195: -- Action has not been archived already
4196: -- therefore archive it.
4214: -- Assignment has ended on this payroll or tax ref during the
4215: -- input date range and this car allocation was active on the
4216: -- end date therefore check whether it is a transfer
4217: -- to another tax ref
4218: hr_utility.set_location(l_proc, 200);
4219: l_next_tax_ref := NULL;
4220: --
4221: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
4222: FETCH c_tax_ref INTO l_next_tax_ref;
4221: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
4222: FETCH c_tax_ref INTO l_next_tax_ref;
4223: CLOSE c_tax_ref;
4224: --
4225: hr_utility.set_location(l_proc, 210);
4226: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
4227: --
4228: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
4229: -- This assignment has a different tax ref after end date
4222: FETCH c_tax_ref INTO l_next_tax_ref;
4223: CLOSE c_tax_ref;
4224: --
4225: hr_utility.set_location(l_proc, 210);
4226: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
4227: --
4228: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
4229: -- This assignment has a different tax ref after end date
4230: -- therefore it should be reported as allocation withdrawal
4228: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
4229: -- This assignment has a different tax ref after end date
4230: -- therefore it should be reported as allocation withdrawal
4231: -- on this EDI message.
4232: hr_utility.set_location(l_proc, 220);
4233: l_action_flag := 'W';
4234: --
4235: -- Check whether this allocation action
4236: -- has been already archived
4240: asg_rec.asg_max_end_date,
4241: l_action_flag,
4242: alc_rec.effective_start_date); -- Added for the bug 10088866
4243: --
4244: hr_utility.set_location(l_proc, 230);
4245: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4246: --
4247: IF l_archived_flag = 'N' THEN
4248: -- Action has not been archived already
4241: l_action_flag,
4242: alc_rec.effective_start_date); -- Added for the bug 10088866
4243: --
4244: hr_utility.set_location(l_proc, 230);
4245: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4246: --
4247: IF l_archived_flag = 'N' THEN
4248: -- Action has not been archived already
4249: -- therefore archive it.
4258: --
4259: END IF;
4260: END IF;
4261: --
4262: hr_utility.set_location(l_proc, 240);
4263:
4264: hr_utility.set_location(l_proc, 390);
4265: END LOOP;
4266: --
4260: END IF;
4261: --
4262: hr_utility.set_location(l_proc, 240);
4263:
4264: hr_utility.set_location(l_proc, 390);
4265: END LOOP;
4266: --
4267: hr_utility.set_location(l_proc, 400);
4268: --
4263:
4264: hr_utility.set_location(l_proc, 390);
4265: END LOOP;
4266: --
4267: hr_utility.set_location(l_proc, 400);
4268: --
4269: END LOOP;
4270: --
4271: hr_utility.set_location('Leaving: '||l_proc,450);
4267: hr_utility.set_location(l_proc, 400);
4268: --
4269: END LOOP;
4270: --
4271: hr_utility.set_location('Leaving: '||l_proc,450);
4272: --hr_utility.trace_off;
4273: EXCEPTION
4274: WHEN OTHERS THEN
4275: hr_utility.set_location('Leaving: '||l_proc,300);
4268: --
4269: END LOOP;
4270: --
4271: hr_utility.set_location('Leaving: '||l_proc,450);
4272: --hr_utility.trace_off;
4273: EXCEPTION
4274: WHEN OTHERS THEN
4275: hr_utility.set_location('Leaving: '||l_proc,300);
4276: -- hr_utility.trace_off;
4271: hr_utility.set_location('Leaving: '||l_proc,450);
4272: --hr_utility.trace_off;
4273: EXCEPTION
4274: WHEN OTHERS THEN
4275: hr_utility.set_location('Leaving: '||l_proc,300);
4276: -- hr_utility.trace_off;
4277: raise;
4278: END archive_code_v3;
4279:
4272: --hr_utility.trace_off;
4273: EXCEPTION
4274: WHEN OTHERS THEN
4275: hr_utility.set_location('Leaving: '||l_proc,300);
4276: -- hr_utility.trace_off;
4277: raise;
4278: END archive_code_v3;
4279:
4280: --For Bug 10095492
4311: l_archived_flag VARCHAR2(1);
4312: --
4313: BEGIN
4314:
4315: hr_utility.set_location('Entering '||l_proc, 10);
4316: --
4317: For asg_rec IN c_asg
4318: LOOP
4319: -- Loop through all assignments
4316: --
4317: For asg_rec IN c_asg
4318: LOOP
4319: -- Loop through all assignments
4320: hr_utility.set_location(l_proc, 20);
4321: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
4322: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
4323: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
4324: --
4317: For asg_rec IN c_asg
4318: LOOP
4319: -- Loop through all assignments
4320: hr_utility.set_location(l_proc, 20);
4321: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
4322: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
4323: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
4324: --
4325: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
4318: LOOP
4319: -- Loop through all assignments
4320: hr_utility.set_location(l_proc, 20);
4321: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
4322: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
4323: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
4324: --
4325: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
4326: -- Loop through all vehicle allocations
4319: -- Loop through all assignments
4320: hr_utility.set_location(l_proc, 20);
4321: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
4322: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
4323: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
4324: --
4325: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
4326: -- Loop through all vehicle allocations
4327: -- over the date range
4324: --
4325: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
4326: -- Loop through all vehicle allocations
4327: -- over the date range
4328: hr_utility.set_location(l_proc, 30);
4329: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
4330: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
4331: --
4332: L_action_flag := 'X';
4325: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
4326: -- Loop through all vehicle allocations
4327: -- over the date range
4328: hr_utility.set_location(l_proc, 30);
4329: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
4330: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
4331: --
4332: L_action_flag := 'X';
4333: l_archived_flag := 'Y';
4326: -- Loop through all vehicle allocations
4327: -- over the date range
4328: hr_utility.set_location(l_proc, 30);
4329: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
4330: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
4331: --
4332: L_action_flag := 'X';
4333: l_archived_flag := 'Y';
4334: --
4335: OPEN c_alloc_dates(alc_rec.vehicle_allocation_id);
4336: FETCH c_alloc_dates INTO alc_dates_rec;
4337: CLOSE c_alloc_dates;
4338: --
4339: hr_utility.set_location(l_proc, 40);
4340: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4341: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4342:
4343: -- Moved the code here from below for the bug 10088866
4336: FETCH c_alloc_dates INTO alc_dates_rec;
4337: CLOSE c_alloc_dates;
4338: --
4339: hr_utility.set_location(l_proc, 40);
4340: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4341: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4342:
4343: -- Moved the code here from below for the bug 10088866
4344: -- Start moving for the bug 10088866
4337: CLOSE c_alloc_dates;
4338: --
4339: hr_utility.set_location(l_proc, 40);
4340: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4341: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4342:
4343: -- Moved the code here from below for the bug 10088866
4344: -- Start moving for the bug 10088866
4345: -- Private flag logic
4349: L_action_flag := 'X';
4350: l_archived_flag := 'Y';
4351: --
4352: FOR private_flag_iterator IN private_flag_arch(alc_rec.vehicle_allocation_id) LOOP
4353: hr_utility.set_location(l_proc, 250);
4354: hr_utility.trace(l_proc||', private_flag_iterator.private_use_flag='||private_flag_iterator.private_use_flag);
4355:
4356: L_action_flag := 'X';
4357: l_archived_flag := 'Y';
4350: l_archived_flag := 'Y';
4351: --
4352: FOR private_flag_iterator IN private_flag_arch(alc_rec.vehicle_allocation_id) LOOP
4353: hr_utility.set_location(l_proc, 250);
4354: hr_utility.trace(l_proc||', private_flag_iterator.private_use_flag='||private_flag_iterator.private_use_flag);
4355:
4356: L_action_flag := 'X';
4357: l_archived_flag := 'Y';
4358:
4368: private_flag_iterator.effective_start_date,
4369: l_action_flag,
4370: private_flag_iterator.effective_start_date);
4371: --
4372: hr_utility.set_location(l_proc, 260);
4373: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4374: --
4375: IF l_archived_flag = 'N' THEN
4376: -- Action has not been archived already
4369: l_action_flag,
4370: private_flag_iterator.effective_start_date);
4371: --
4372: hr_utility.set_location(l_proc, 260);
4373: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4374: --
4375: IF l_archived_flag = 'N' THEN
4376: -- Action has not been archived already
4377: -- therefore archive it.
4417: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.min_start_date);
4418: FETCH c_first_asg INTO first_asg_rec;
4419: CLOSE c_first_asg;
4420: --
4421: hr_utility.set_location(l_proc, 50);
4422: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
4423: -- Get primary car allocation of the
4424: -- first assignment of this person
4425: -- in this tax ref
4418: FETCH c_first_asg INTO first_asg_rec;
4419: CLOSE c_first_asg;
4420: --
4421: hr_utility.set_location(l_proc, 50);
4422: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
4423: -- Get primary car allocation of the
4424: -- first assignment of this person
4425: -- in this tax ref
4426: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
4426: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
4427: FETCH c_primary_car INTO primary_car_rec;
4428: CLOSE c_primary_car;
4429: --
4430: hr_utility.set_location(l_proc, 60);
4431: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
4432: --
4433: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
4434: -- This is the first car allocation
4427: FETCH c_primary_car INTO primary_car_rec;
4428: CLOSE c_primary_car;
4429: --
4430: hr_utility.set_location(l_proc, 60);
4431: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
4432: --
4433: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
4434: -- This is the first car allocation
4435: -- of this employee in this tax ref
4442: ELSE
4443: L_action_flag := 'N';
4444: END IF;
4445: --
4446: hr_utility.set_location(l_proc, 70);
4447: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4448: --
4449: CLOSE c_prior_prim_car;
4450: ELSE
4443: L_action_flag := 'N';
4444: END IF;
4445: --
4446: hr_utility.set_location(l_proc, 70);
4447: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4448: --
4449: CLOSE c_prior_prim_car;
4450: ELSE
4451: -- Not the first car of the employee
4452: -- report this as new car
4453: L_action_flag := 'N';
4454: END IF;
4455: --
4456: hr_utility.set_location(l_proc, 80);
4457: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4458: --
4459: ELSE
4460: -- Not a primary car therefore mark
4453: L_action_flag := 'N';
4454: END IF;
4455: --
4456: hr_utility.set_location(l_proc, 80);
4457: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4458: --
4459: ELSE
4460: -- Not a primary car therefore mark
4461: -- it as new car allocation action
4461: -- it as new car allocation action
4462: l_action_flag := 'N';
4463: END IF;
4464: --
4465: hr_utility.set_location(l_proc, 90);
4466: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4467: --
4468: IF L_action_flag <> 'X' THEN
4469: -- Check whether this allocation action
4462: l_action_flag := 'N';
4463: END IF;
4464: --
4465: hr_utility.set_location(l_proc, 90);
4466: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4467: --
4468: IF L_action_flag <> 'X' THEN
4469: -- Check whether this allocation action
4470: -- has been already archived
4474: alc_dates_rec.min_start_date,
4475: l_action_flag,
4476: alc_rec.effective_start_date); -- Added for the bug 10088866
4477: --
4478: hr_utility.set_location(l_proc, 100);
4479: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4480: --
4481: IF (l_archived_flag = 'N')
4482: THEN
4475: l_action_flag,
4476: alc_rec.effective_start_date); -- Added for the bug 10088866
4477: --
4478: hr_utility.set_location(l_proc, 100);
4479: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4480: --
4481: IF (l_archived_flag = 'N')
4482: THEN
4483: -- Action has not been archived already
4481: IF (l_archived_flag = 'N')
4482: THEN
4483: -- Action has not been archived already
4484: -- therefore archive it.
4485: hr_utility.set_location(l_proc, 105);
4486: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4487: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4488: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4489: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4482: THEN
4483: -- Action has not been archived already
4484: -- therefore archive it.
4485: hr_utility.set_location(l_proc, 105);
4486: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4487: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4488: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4489: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4490: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4483: -- Action has not been archived already
4484: -- therefore archive it.
4485: hr_utility.set_location(l_proc, 105);
4486: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4487: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4488: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4489: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4490: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4491: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4484: -- therefore archive it.
4485: hr_utility.set_location(l_proc, 105);
4486: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4487: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4488: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4489: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4490: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4491: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4492: --
4485: hr_utility.set_location(l_proc, 105);
4486: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4487: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4488: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4489: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4490: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4491: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4492: --
4493: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
4486: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4487: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4488: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4489: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4490: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4491: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4492: --
4493: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
4494: p_asg_act_id => p_assactid,
4487: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4488: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4489: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4490: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4491: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4492: --
4493: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
4494: p_asg_act_id => p_assactid,
4495: p_vehicle_allocation_id => alc_rec.vehicle_allocation_id,
4519: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.max_end_date);
4520: FETCH c_first_asg INTO first_asg_rec;
4521: CLOSE c_first_asg;
4522: --
4523: hr_utility.set_location(l_proc, 50);
4524: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
4525: -- Get primary car allocation of the
4526: -- first assignment of this person
4527: -- in this tax ref
4520: FETCH c_first_asg INTO first_asg_rec;
4521: CLOSE c_first_asg;
4522: --
4523: hr_utility.set_location(l_proc, 50);
4524: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
4525: -- Get primary car allocation of the
4526: -- first assignment of this person
4527: -- in this tax ref
4528: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
4528: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
4529: FETCH c_primary_car INTO primary_car_rec;
4530: CLOSE c_primary_car;
4531: --
4532: hr_utility.set_location(l_proc, 60);
4533: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
4534: --
4535: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
4536: --
4529: FETCH c_primary_car INTO primary_car_rec;
4530: CLOSE c_primary_car;
4531: --
4532: hr_utility.set_location(l_proc, 60);
4533: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
4534: --
4535: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
4536: --
4537: OPEN c_next_prim_car(asg_rec.assignment_id, Alc_dates_rec.max_end_date);
4545: -- This is a withdrawal action
4546: L_action_flag := 'W';
4547: END IF;
4548: --
4549: hr_utility.set_location(l_proc, 70);
4550: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4551: --
4552: CLOSE c_next_prim_car;
4553: ELSE
4546: L_action_flag := 'W';
4547: END IF;
4548: --
4549: hr_utility.set_location(l_proc, 70);
4550: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4551: --
4552: CLOSE c_next_prim_car;
4553: ELSE
4554: -- Not the first car of the employee
4556: L_action_flag := 'W';
4557: END IF;
4558: --
4559: --
4560: hr_utility.set_location(l_proc, 80);
4561: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4562: --
4563: ELSE
4564: -- Not a first car therefore mark
4557: END IF;
4558: --
4559: --
4560: hr_utility.set_location(l_proc, 80);
4561: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4562: --
4563: ELSE
4564: -- Not a first car therefore mark
4565: -- it as withdrawal car action
4565: -- it as withdrawal car action
4566: l_action_flag := 'W';
4567: END IF;
4568: --
4569: hr_utility.set_location(l_proc, 90);
4570: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4571: --
4572: IF L_action_flag <> 'X' THEN
4573: -- Check whether this allocation action
4566: l_action_flag := 'W';
4567: END IF;
4568: --
4569: hr_utility.set_location(l_proc, 90);
4570: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4571: --
4572: IF L_action_flag <> 'X' THEN
4573: -- Check whether this allocation action
4574: -- has been already archived
4578: alc_dates_rec.min_start_date,
4579: l_action_flag,
4580: alc_rec.effective_start_date); -- Added for the bug 10088866
4581: --
4582: hr_utility.set_location(l_proc, 100);
4583: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4584: --
4585: IF l_archived_flag = 'N' THEN
4586: -- Action has not been archived already
4579: l_action_flag,
4580: alc_rec.effective_start_date); -- Added for the bug 10088866
4581: --
4582: hr_utility.set_location(l_proc, 100);
4583: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4584: --
4585: IF l_archived_flag = 'N' THEN
4586: -- Action has not been archived already
4587: -- therefore archive it.
4584: --
4585: IF l_archived_flag = 'N' THEN
4586: -- Action has not been archived already
4587: -- therefore archive it.
4588: hr_utility.set_location(l_proc, 105);
4589: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4590: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4591: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4592: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4585: IF l_archived_flag = 'N' THEN
4586: -- Action has not been archived already
4587: -- therefore archive it.
4588: hr_utility.set_location(l_proc, 105);
4589: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4590: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4591: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4592: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4593: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4586: -- Action has not been archived already
4587: -- therefore archive it.
4588: hr_utility.set_location(l_proc, 105);
4589: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4590: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4591: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4592: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4593: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4594: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4587: -- therefore archive it.
4588: hr_utility.set_location(l_proc, 105);
4589: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4590: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4591: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4592: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4593: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4594: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4595: --
4588: hr_utility.set_location(l_proc, 105);
4589: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4590: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4591: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4592: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4593: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4594: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4595: --
4596: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
4589: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4590: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4591: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4592: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4593: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4594: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4595: --
4596: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
4597: p_asg_act_id => p_assactid,
4590: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4591: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4592: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4593: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4594: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4595: --
4596: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
4597: p_asg_act_id => p_assactid,
4598: p_vehicle_allocation_id => alc_rec.vehicle_allocation_id,
4610: -- Fuel type has changed therefore make sure
4611: -- this change occured after the vehicle was
4612: -- allocated to this assignment
4613: --
4614: hr_utility.set_location(l_proc, 110);
4615: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
4616: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
4617: --
4618: IF (vehicle_changes_rec.effective_start_date
4611: -- this change occured after the vehicle was
4612: -- allocated to this assignment
4613: --
4614: hr_utility.set_location(l_proc, 110);
4615: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
4616: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
4617: --
4618: IF (vehicle_changes_rec.effective_start_date
4619: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
4612: -- allocated to this assignment
4613: --
4614: hr_utility.set_location(l_proc, 110);
4615: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
4616: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
4617: --
4618: IF (vehicle_changes_rec.effective_start_date
4619: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
4620: (vehicle_changes_rec.effective_start_date
4628: vehicle_changes_rec.effective_start_date,
4629: 'F',
4630: alc_rec.effective_start_date); -- Added for the bug 10088866
4631: --
4632: hr_utility.set_location(l_proc, 120);
4633: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4634: --
4635: IF l_archived_flag = 'N' THEN
4636: -- Action has not been archived already
4629: 'F',
4630: alc_rec.effective_start_date); -- Added for the bug 10088866
4631: --
4632: hr_utility.set_location(l_proc, 120);
4633: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4634: --
4635: IF l_archived_flag = 'N' THEN
4636: -- Action has not been archived already
4637: -- therefore archive it.
4648: END IF;
4649: END IF;
4650: END LOOP;
4651: --
4652: hr_utility.set_location(l_proc, 130);
4653: --
4654: L_action_flag := 'X';
4655: l_archived_flag := 'Y';
4656: --
4664: -- Assignment has started on this payroll or tax ref during the
4665: -- input date range and this car allocation was active on the
4666: -- start date therefore check whether it is a transfer
4667: -- from another tax ref
4668: hr_utility.set_location(l_proc, 160);
4669: l_previous_tax_ref := NULL;
4670: --
4671: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
4672: FETCH c_tax_ref INTO l_previous_tax_ref;
4671: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
4672: FETCH c_tax_ref INTO l_previous_tax_ref;
4673: CLOSE c_tax_ref;
4674: --
4675: hr_utility.set_location(l_proc, 170);
4676: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
4677: --
4678: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
4679: -- This assignment has a different prior tax ref
4672: FETCH c_tax_ref INTO l_previous_tax_ref;
4673: CLOSE c_tax_ref;
4674: --
4675: hr_utility.set_location(l_proc, 170);
4676: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
4677: --
4678: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
4679: -- This assignment has a different prior tax ref
4680: -- therefore it should be reported as a new car
4678: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
4679: -- This assignment has a different prior tax ref
4680: -- therefore it should be reported as a new car
4681: -- allocation on this EDI message.
4682: hr_utility.set_location(l_proc, 180);
4683: l_action_flag := 'N';
4684: --
4685: -- Check whether this allocation action
4686: -- has been already archived
4690: asg_rec.asg_min_start_date,
4691: l_action_flag,
4692: alc_rec.effective_start_date); -- Added for the bug 10088866
4693: --
4694: hr_utility.set_location(l_proc, 190);
4695: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4696: --
4697: IF l_archived_flag = 'N' THEN
4698: -- Action has not been archived already
4691: l_action_flag,
4692: alc_rec.effective_start_date); -- Added for the bug 10088866
4693: --
4694: hr_utility.set_location(l_proc, 190);
4695: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4696: --
4697: IF l_archived_flag = 'N' THEN
4698: -- Action has not been archived already
4699: -- therefore archive it.
4718: -- Assignment has ended on this payroll or tax ref during the
4719: -- input date range and this car allocation was active on the
4720: -- end date therefore check whether it is a transfer
4721: -- to another tax ref
4722: hr_utility.set_location(l_proc, 200);
4723: l_next_tax_ref := NULL;
4724: --
4725: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
4726: FETCH c_tax_ref INTO l_next_tax_ref;
4725: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
4726: FETCH c_tax_ref INTO l_next_tax_ref;
4727: CLOSE c_tax_ref;
4728: --
4729: hr_utility.set_location(l_proc, 210);
4730: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
4731: --
4732: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
4733: -- This assignment has a different tax ref after end date
4726: FETCH c_tax_ref INTO l_next_tax_ref;
4727: CLOSE c_tax_ref;
4728: --
4729: hr_utility.set_location(l_proc, 210);
4730: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
4731: --
4732: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
4733: -- This assignment has a different tax ref after end date
4734: -- therefore it should be reported as allocation withdrawal
4732: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
4733: -- This assignment has a different tax ref after end date
4734: -- therefore it should be reported as allocation withdrawal
4735: -- on this EDI message.
4736: hr_utility.set_location(l_proc, 220);
4737: l_action_flag := 'W';
4738: --
4739: -- Check whether this allocation action
4740: -- has been already archived
4744: asg_rec.asg_max_end_date,
4745: l_action_flag,
4746: alc_rec.effective_start_date); -- Added for the bug 10088866
4747: --
4748: hr_utility.set_location(l_proc, 230);
4749: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4750: --
4751: IF l_archived_flag = 'N' THEN
4752: -- Action has not been archived already
4745: l_action_flag,
4746: alc_rec.effective_start_date); -- Added for the bug 10088866
4747: --
4748: hr_utility.set_location(l_proc, 230);
4749: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4750: --
4751: IF l_archived_flag = 'N' THEN
4752: -- Action has not been archived already
4753: -- therefore archive it.
4763: --
4764: END IF;
4765: END IF;
4766: --
4767: hr_utility.set_location(l_proc, 240);
4768:
4769: hr_utility.set_location(l_proc, 390);
4770: END LOOP;
4771: --
4765: END IF;
4766: --
4767: hr_utility.set_location(l_proc, 240);
4768:
4769: hr_utility.set_location(l_proc, 390);
4770: END LOOP;
4771: --
4772: hr_utility.set_location(l_proc, 400);
4773: --
4768:
4769: hr_utility.set_location(l_proc, 390);
4770: END LOOP;
4771: --
4772: hr_utility.set_location(l_proc, 400);
4773: --
4774: END LOOP;
4775: --
4776: hr_utility.set_location('Leaving: '||l_proc,450);
4772: hr_utility.set_location(l_proc, 400);
4773: --
4774: END LOOP;
4775: --
4776: hr_utility.set_location('Leaving: '||l_proc,450);
4777: --hr_utility.trace_off;
4778: EXCEPTION
4779: WHEN OTHERS THEN
4780: hr_utility.set_location('Leaving: '||l_proc,300);
4773: --
4774: END LOOP;
4775: --
4776: hr_utility.set_location('Leaving: '||l_proc,450);
4777: --hr_utility.trace_off;
4778: EXCEPTION
4779: WHEN OTHERS THEN
4780: hr_utility.set_location('Leaving: '||l_proc,300);
4781: -- hr_utility.trace_off;
4776: hr_utility.set_location('Leaving: '||l_proc,450);
4777: --hr_utility.trace_off;
4778: EXCEPTION
4779: WHEN OTHERS THEN
4780: hr_utility.set_location('Leaving: '||l_proc,300);
4781: -- hr_utility.trace_off;
4782: raise;
4783: END archive_code_v4;
4784:
4777: --hr_utility.trace_off;
4778: EXCEPTION
4779: WHEN OTHERS THEN
4780: hr_utility.set_location('Leaving: '||l_proc,300);
4781: -- hr_utility.trace_off;
4782: raise;
4783: END archive_code_v4;
4784:
4785:
4818: l_archived_flag VARCHAR2(1);
4819: --
4820: BEGIN
4821:
4822: hr_utility.set_location('Entering '||l_proc, 10);
4823: --
4824: For asg_rec IN c_asg
4825: LOOP
4826: -- Loop through all assignments
4823: --
4824: For asg_rec IN c_asg
4825: LOOP
4826: -- Loop through all assignments
4827: hr_utility.set_location(l_proc, 20);
4828: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
4829: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
4830: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
4831: --
4824: For asg_rec IN c_asg
4825: LOOP
4826: -- Loop through all assignments
4827: hr_utility.set_location(l_proc, 20);
4828: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
4829: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
4830: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
4831: --
4832: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
4825: LOOP
4826: -- Loop through all assignments
4827: hr_utility.set_location(l_proc, 20);
4828: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
4829: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
4830: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
4831: --
4832: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
4833: -- Loop through all vehicle allocations
4826: -- Loop through all assignments
4827: hr_utility.set_location(l_proc, 20);
4828: hr_utility.trace(l_proc||': assignment_id='||asg_rec.assignment_id);
4829: hr_utility.trace(l_proc||': asg_min_start_date='||fnd_date.date_to_displaydate(asg_rec.asg_min_start_date));
4830: hr_utility.trace(l_proc||': asg_max_end_date='||fnd_date.date_to_displaydate(asg_rec.asg_max_end_date));
4831: --
4832: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
4833: -- Loop through all vehicle allocations
4834: -- over the date range
4831: --
4832: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
4833: -- Loop through all vehicle allocations
4834: -- over the date range
4835: hr_utility.set_location(l_proc, 30);
4836: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
4837: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
4838: --
4839: L_action_flag := 'X';
4832: FOR alc_rec IN c_allocations(asg_rec.assignment_id) LOOP
4833: -- Loop through all vehicle allocations
4834: -- over the date range
4835: hr_utility.set_location(l_proc, 30);
4836: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
4837: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
4838: --
4839: L_action_flag := 'X';
4840: l_archived_flag := 'Y';
4833: -- Loop through all vehicle allocations
4834: -- over the date range
4835: hr_utility.set_location(l_proc, 30);
4836: hr_utility.trace(l_proc||': vehicle_allocation_id='||alc_rec.vehicle_allocation_id);
4837: hr_utility.trace(l_proc||': usage_type='||alc_rec.usage_type);
4838: --
4839: L_action_flag := 'X';
4840: l_archived_flag := 'Y';
4841: --
4842: OPEN c_alloc_dates(alc_rec.vehicle_allocation_id);
4843: FETCH c_alloc_dates INTO alc_dates_rec;
4844: CLOSE c_alloc_dates;
4845: --
4846: hr_utility.set_location(l_proc, 40);
4847: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4848: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4849:
4850: -- Moved the code here from below for the bug 10088866
4843: FETCH c_alloc_dates INTO alc_dates_rec;
4844: CLOSE c_alloc_dates;
4845: --
4846: hr_utility.set_location(l_proc, 40);
4847: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4848: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4849:
4850: -- Moved the code here from below for the bug 10088866
4851: -- Start moving for the bug 10088866
4844: CLOSE c_alloc_dates;
4845: --
4846: hr_utility.set_location(l_proc, 40);
4847: hr_utility.trace(l_proc||': min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4848: hr_utility.trace(l_proc||': max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4849:
4850: -- Moved the code here from below for the bug 10088866
4851: -- Start moving for the bug 10088866
4852: -- Private flag logic
4856: L_action_flag := 'X';
4857: l_archived_flag := 'Y';
4858: --
4859: FOR private_flag_iterator IN private_flag_arch(alc_rec.vehicle_allocation_id) LOOP
4860: hr_utility.set_location(l_proc, 250);
4861: hr_utility.trace(l_proc||', private_flag_iterator.private_use_flag='||private_flag_iterator.private_use_flag);
4862:
4863: L_action_flag := 'X';
4864: l_archived_flag := 'Y';
4857: l_archived_flag := 'Y';
4858: --
4859: FOR private_flag_iterator IN private_flag_arch(alc_rec.vehicle_allocation_id) LOOP
4860: hr_utility.set_location(l_proc, 250);
4861: hr_utility.trace(l_proc||', private_flag_iterator.private_use_flag='||private_flag_iterator.private_use_flag);
4862:
4863: L_action_flag := 'X';
4864: l_archived_flag := 'Y';
4865:
4875: private_flag_iterator.effective_start_date,
4876: l_action_flag,
4877: private_flag_iterator.effective_start_date);
4878: --
4879: hr_utility.set_location(l_proc, 260);
4880: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4881: --
4882: IF l_archived_flag = 'N' THEN
4883: -- Action has not been archived already
4876: l_action_flag,
4877: private_flag_iterator.effective_start_date);
4878: --
4879: hr_utility.set_location(l_proc, 260);
4880: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
4881: --
4882: IF l_archived_flag = 'N' THEN
4883: -- Action has not been archived already
4884: -- therefore archive it.
4924: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.min_start_date);
4925: FETCH c_first_asg INTO first_asg_rec;
4926: CLOSE c_first_asg;
4927: --
4928: hr_utility.set_location(l_proc, 50);
4929: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
4930: -- Get primary car allocation of the
4931: -- first assignment of this person
4932: -- in this tax ref
4925: FETCH c_first_asg INTO first_asg_rec;
4926: CLOSE c_first_asg;
4927: --
4928: hr_utility.set_location(l_proc, 50);
4929: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
4930: -- Get primary car allocation of the
4931: -- first assignment of this person
4932: -- in this tax ref
4933: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
4933: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.min_start_date);
4934: FETCH c_primary_car INTO primary_car_rec;
4935: CLOSE c_primary_car;
4936: --
4937: hr_utility.set_location(l_proc, 60);
4938: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
4939: --
4940: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
4941: -- This is the first car allocation
4934: FETCH c_primary_car INTO primary_car_rec;
4935: CLOSE c_primary_car;
4936: --
4937: hr_utility.set_location(l_proc, 60);
4938: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
4939: --
4940: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
4941: -- This is the first car allocation
4942: -- of this employee in this tax ref
4949: ELSE
4950: L_action_flag := 'N';
4951: END IF;
4952: --
4953: hr_utility.set_location(l_proc, 70);
4954: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4955: --
4956: CLOSE c_prior_prim_car;
4957: ELSE
4950: L_action_flag := 'N';
4951: END IF;
4952: --
4953: hr_utility.set_location(l_proc, 70);
4954: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4955: --
4956: CLOSE c_prior_prim_car;
4957: ELSE
4958: -- Not the first car of the employee
4959: -- report this as new car
4960: L_action_flag := 'N';
4961: END IF;
4962: --
4963: hr_utility.set_location(l_proc, 80);
4964: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4965: --
4966: ELSE
4967: -- Not a primary car therefore mark
4960: L_action_flag := 'N';
4961: END IF;
4962: --
4963: hr_utility.set_location(l_proc, 80);
4964: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4965: --
4966: ELSE
4967: -- Not a primary car therefore mark
4968: -- it as new car allocation action
4968: -- it as new car allocation action
4969: l_action_flag := 'N';
4970: END IF;
4971: --
4972: hr_utility.set_location(l_proc, 90);
4973: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4974: --
4975: IF L_action_flag <> 'X' THEN
4976: -- Check whether this allocation action
4969: l_action_flag := 'N';
4970: END IF;
4971: --
4972: hr_utility.set_location(l_proc, 90);
4973: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4974: --
4975: IF L_action_flag <> 'X' THEN
4976: -- Check whether this allocation action
4977: -- has been already archived
4981: alc_dates_rec.min_start_date,
4982: l_action_flag,
4983: alc_rec.effective_start_date); -- Added for the bug 10088866
4984: --
4985: hr_utility.set_location(l_proc, 100);
4986: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4987: --
4988: IF (l_archived_flag = 'N')
4989: THEN
4982: l_action_flag,
4983: alc_rec.effective_start_date); -- Added for the bug 10088866
4984: --
4985: hr_utility.set_location(l_proc, 100);
4986: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
4987: --
4988: IF (l_archived_flag = 'N')
4989: THEN
4990: -- Action has not been archived already
4988: IF (l_archived_flag = 'N')
4989: THEN
4990: -- Action has not been archived already
4991: -- therefore archive it.
4992: hr_utility.set_location(l_proc, 105);
4993: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4994: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4995: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4996: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4989: THEN
4990: -- Action has not been archived already
4991: -- therefore archive it.
4992: hr_utility.set_location(l_proc, 105);
4993: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4994: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4995: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4996: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4997: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4990: -- Action has not been archived already
4991: -- therefore archive it.
4992: hr_utility.set_location(l_proc, 105);
4993: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4994: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4995: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4996: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4997: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4998: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4991: -- therefore archive it.
4992: hr_utility.set_location(l_proc, 105);
4993: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4994: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4995: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4996: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4997: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4998: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4999: --
4992: hr_utility.set_location(l_proc, 105);
4993: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4994: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4995: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4996: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4997: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4998: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4999: --
5000: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
4993: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
4994: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4995: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4996: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4997: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4998: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4999: --
5000: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
5001: p_asg_act_id => p_assactid,
4994: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
4995: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
4996: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
4997: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
4998: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
4999: --
5000: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
5001: p_asg_act_id => p_assactid,
5002: p_vehicle_allocation_id => alc_rec.vehicle_allocation_id,
5026: OPEN c_first_asg(asg_rec.assignment_id, alc_dates_rec.max_end_date);
5027: FETCH c_first_asg INTO first_asg_rec;
5028: CLOSE c_first_asg;
5029: --
5030: hr_utility.set_location(l_proc, 50);
5031: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
5032: -- Get primary car allocation of the
5033: -- first assignment of this person
5034: -- in this tax ref
5027: FETCH c_first_asg INTO first_asg_rec;
5028: CLOSE c_first_asg;
5029: --
5030: hr_utility.set_location(l_proc, 50);
5031: hr_utility.trace(l_proc||': First Assignment='|| first_asg_rec.assignment_id);
5032: -- Get primary car allocation of the
5033: -- first assignment of this person
5034: -- in this tax ref
5035: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
5035: OPEN c_primary_car(first_asg_rec.assignment_id, alc_dates_rec.max_end_date);
5036: FETCH c_primary_car INTO primary_car_rec;
5037: CLOSE c_primary_car;
5038: --
5039: hr_utility.set_location(l_proc, 60);
5040: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
5041: --
5042: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
5043: --
5036: FETCH c_primary_car INTO primary_car_rec;
5037: CLOSE c_primary_car;
5038: --
5039: hr_utility.set_location(l_proc, 60);
5040: hr_utility.trace(l_proc||': Primary Car Allocation='|| primary_car_rec.vehicle_allocation_id);
5041: --
5042: IF primary_car_rec.vehicle_allocation_id = alc_rec.vehicle_allocation_id THEN
5043: --
5044: OPEN c_next_prim_car(asg_rec.assignment_id, Alc_dates_rec.max_end_date);
5052: -- This is a withdrawal action
5053: L_action_flag := 'W';
5054: END IF;
5055: --
5056: hr_utility.set_location(l_proc, 70);
5057: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5058: --
5059: CLOSE c_next_prim_car;
5060: ELSE
5053: L_action_flag := 'W';
5054: END IF;
5055: --
5056: hr_utility.set_location(l_proc, 70);
5057: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5058: --
5059: CLOSE c_next_prim_car;
5060: ELSE
5061: -- Not the first car of the employee
5063: L_action_flag := 'W';
5064: END IF;
5065: --
5066: --
5067: hr_utility.set_location(l_proc, 80);
5068: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5069: --
5070: ELSE
5071: -- Not a first car therefore mark
5064: END IF;
5065: --
5066: --
5067: hr_utility.set_location(l_proc, 80);
5068: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5069: --
5070: ELSE
5071: -- Not a first car therefore mark
5072: -- it as withdrawal car action
5072: -- it as withdrawal car action
5073: l_action_flag := 'W';
5074: END IF;
5075: --
5076: hr_utility.set_location(l_proc, 90);
5077: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5078: --
5079: IF L_action_flag <> 'X' THEN
5080: -- Check whether this allocation action
5073: l_action_flag := 'W';
5074: END IF;
5075: --
5076: hr_utility.set_location(l_proc, 90);
5077: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5078: --
5079: IF L_action_flag <> 'X' THEN
5080: -- Check whether this allocation action
5081: -- has been already archived
5085: alc_dates_rec.min_start_date,
5086: l_action_flag,
5087: alc_rec.effective_start_date); -- Added for the bug 10088866
5088: --
5089: hr_utility.set_location(l_proc, 100);
5090: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
5091: --
5092: IF l_archived_flag = 'N' THEN
5093: -- Action has not been archived already
5086: l_action_flag,
5087: alc_rec.effective_start_date); -- Added for the bug 10088866
5088: --
5089: hr_utility.set_location(l_proc, 100);
5090: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
5091: --
5092: IF l_archived_flag = 'N' THEN
5093: -- Action has not been archived already
5094: -- therefore archive it.
5091: --
5092: IF l_archived_flag = 'N' THEN
5093: -- Action has not been archived already
5094: -- therefore archive it.
5095: hr_utility.set_location(l_proc, 105);
5096: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
5097: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
5098: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
5099: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5092: IF l_archived_flag = 'N' THEN
5093: -- Action has not been archived already
5094: -- therefore archive it.
5095: hr_utility.set_location(l_proc, 105);
5096: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
5097: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
5098: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
5099: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5100: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
5093: -- Action has not been archived already
5094: -- therefore archive it.
5095: hr_utility.set_location(l_proc, 105);
5096: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
5097: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
5098: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
5099: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5100: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
5101: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
5094: -- therefore archive it.
5095: hr_utility.set_location(l_proc, 105);
5096: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
5097: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
5098: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
5099: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5100: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
5101: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
5102: --
5095: hr_utility.set_location(l_proc, 105);
5096: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
5097: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
5098: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
5099: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5100: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
5101: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
5102: --
5103: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
5096: hr_utility.trace(l_proc||': p_assactid='|| p_assactid);
5097: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
5098: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
5099: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5100: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
5101: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
5102: --
5103: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
5104: p_asg_act_id => p_assactid,
5097: hr_utility.trace(l_proc||': vehicle_allocation_id='|| alc_rec.vehicle_allocation_id);
5098: hr_utility.trace(l_proc||': vehicle_repository_id='|| alc_rec.vehicle_repository_id);
5099: hr_utility.trace(l_proc||': l_action_flag='|| l_action_flag);
5100: hr_utility.trace(l_proc||': alc_dates_rec.min_start_date='|| fnd_date.date_to_displaydate(alc_dates_rec.min_start_date));
5101: hr_utility.trace(l_proc||': alc_dates_rec.max_end_date='|| fnd_date.date_to_displaydate(alc_dates_rec.max_end_date));
5102: --
5103: archive_allocation_action(p_assignment_id => asg_rec.assignment_id,
5104: p_asg_act_id => p_assactid,
5105: p_vehicle_allocation_id => alc_rec.vehicle_allocation_id,
5117: -- Fuel type has changed therefore make sure
5118: -- this change occured after the vehicle was
5119: -- allocated to this assignment
5120: --
5121: hr_utility.set_location(l_proc, 110);
5122: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
5123: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
5124: --
5125: IF (vehicle_changes_rec.effective_start_date
5118: -- this change occured after the vehicle was
5119: -- allocated to this assignment
5120: --
5121: hr_utility.set_location(l_proc, 110);
5122: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
5123: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
5124: --
5125: IF (vehicle_changes_rec.effective_start_date
5126: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
5119: -- allocated to this assignment
5120: --
5121: hr_utility.set_location(l_proc, 110);
5122: hr_utility.trace(l_proc||': effective_start_date='|| vehicle_changes_rec.effective_start_date);
5123: hr_utility.trace(l_proc||': fuel_type='|| vehicle_changes_rec.fuel_type);
5124: --
5125: IF (vehicle_changes_rec.effective_start_date
5126: BETWEEN alc_dates_rec.min_start_date+1 AND alc_dates_rec.max_end_date) AND
5127: (vehicle_changes_rec.effective_start_date
5135: vehicle_changes_rec.effective_start_date,
5136: 'F',
5137: alc_rec.effective_start_date); -- Added for the bug 10088866
5138: --
5139: hr_utility.set_location(l_proc, 120);
5140: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
5141: --
5142: IF l_archived_flag = 'N' THEN
5143: -- Action has not been archived already
5136: 'F',
5137: alc_rec.effective_start_date); -- Added for the bug 10088866
5138: --
5139: hr_utility.set_location(l_proc, 120);
5140: hr_utility.trace(l_proc||': l_archived_flag='|| l_archived_flag);
5141: --
5142: IF l_archived_flag = 'N' THEN
5143: -- Action has not been archived already
5144: -- therefore archive it.
5155: END IF;
5156: END IF;
5157: END LOOP;
5158: --
5159: hr_utility.set_location(l_proc, 130);
5160: --
5161: L_action_flag := 'X';
5162: l_archived_flag := 'Y';
5163: --
5171: -- Assignment has started on this payroll or tax ref during the
5172: -- input date range and this car allocation was active on the
5173: -- start date therefore check whether it is a transfer
5174: -- from another tax ref
5175: hr_utility.set_location(l_proc, 160);
5176: l_previous_tax_ref := NULL;
5177: --
5178: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
5179: FETCH c_tax_ref INTO l_previous_tax_ref;
5178: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_min_start_date-1);
5179: FETCH c_tax_ref INTO l_previous_tax_ref;
5180: CLOSE c_tax_ref;
5181: --
5182: hr_utility.set_location(l_proc, 170);
5183: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
5184: --
5185: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
5186: -- This assignment has a different prior tax ref
5179: FETCH c_tax_ref INTO l_previous_tax_ref;
5180: CLOSE c_tax_ref;
5181: --
5182: hr_utility.set_location(l_proc, 170);
5183: hr_utility.trace(l_proc||', l_previous_tax_ref='||l_previous_tax_ref);
5184: --
5185: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
5186: -- This assignment has a different prior tax ref
5187: -- therefore it should be reported as a new car
5185: IF l_previous_tax_ref is NOT NULL AND l_previous_tax_ref <> g_tax_ref THEN
5186: -- This assignment has a different prior tax ref
5187: -- therefore it should be reported as a new car
5188: -- allocation on this EDI message.
5189: hr_utility.set_location(l_proc, 180);
5190: l_action_flag := 'N';
5191: --
5192: -- Check whether this allocation action
5193: -- has been already archived
5197: asg_rec.asg_min_start_date,
5198: l_action_flag,
5199: alc_rec.effective_start_date); -- Added for the bug 10088866
5200: --
5201: hr_utility.set_location(l_proc, 190);
5202: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
5203: --
5204: IF l_archived_flag = 'N' THEN
5205: -- Action has not been archived already
5198: l_action_flag,
5199: alc_rec.effective_start_date); -- Added for the bug 10088866
5200: --
5201: hr_utility.set_location(l_proc, 190);
5202: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
5203: --
5204: IF l_archived_flag = 'N' THEN
5205: -- Action has not been archived already
5206: -- therefore archive it.
5225: -- Assignment has ended on this payroll or tax ref during the
5226: -- input date range and this car allocation was active on the
5227: -- end date therefore check whether it is a transfer
5228: -- to another tax ref
5229: hr_utility.set_location(l_proc, 200);
5230: l_next_tax_ref := NULL;
5231:
5232: --
5233: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
5233: OPEN c_tax_ref(asg_rec.assignment_id, asg_rec.asg_max_end_date+1);
5234: FETCH c_tax_ref INTO l_next_tax_ref;
5235: CLOSE c_tax_ref;
5236: --
5237: hr_utility.set_location(l_proc, 210);
5238: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
5239: --
5240: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
5241: -- This assignment has a different tax ref after end date
5234: FETCH c_tax_ref INTO l_next_tax_ref;
5235: CLOSE c_tax_ref;
5236: --
5237: hr_utility.set_location(l_proc, 210);
5238: hr_utility.trace(l_proc||', l_next_tax_ref='||l_next_tax_ref);
5239: --
5240: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
5241: -- This assignment has a different tax ref after end date
5242: -- therefore it should be reported as allocation withdrawal
5240: IF l_next_tax_ref is NOT NULL AND l_next_tax_ref <> g_tax_ref THEN
5241: -- This assignment has a different tax ref after end date
5242: -- therefore it should be reported as allocation withdrawal
5243: -- on this EDI message.
5244: hr_utility.set_location(l_proc, 220);
5245: l_action_flag := 'W';
5246: --
5247: -- Check whether this allocation action
5248: -- has been already archived
5252: asg_rec.asg_max_end_date,
5253: l_action_flag,
5254: alc_rec.effective_start_date); -- Added for the bug 10088866
5255: --
5256: hr_utility.set_location(l_proc, 230);
5257: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
5258: --
5259: IF l_archived_flag = 'N' THEN
5260: -- Action has not been archived already
5253: l_action_flag,
5254: alc_rec.effective_start_date); -- Added for the bug 10088866
5255: --
5256: hr_utility.set_location(l_proc, 230);
5257: hr_utility.trace(l_proc||', l_archived_flag='||l_archived_flag);
5258: --
5259: IF l_archived_flag = 'N' THEN
5260: -- Action has not been archived already
5261: -- therefore archive it.
5271: --
5272: END IF;
5273: END IF;
5274: --
5275: hr_utility.set_location(l_proc, 240);
5276:
5277: hr_utility.set_location(l_proc, 390);
5278: END LOOP;
5279: --
5273: END IF;
5274: --
5275: hr_utility.set_location(l_proc, 240);
5276:
5277: hr_utility.set_location(l_proc, 390);
5278: END LOOP;
5279: --
5280: hr_utility.set_location(l_proc, 400);
5281: --
5276:
5277: hr_utility.set_location(l_proc, 390);
5278: END LOOP;
5279: --
5280: hr_utility.set_location(l_proc, 400);
5281: --
5282: END LOOP;
5283: --
5284: hr_utility.set_location('Leaving: '||l_proc,450);
5280: hr_utility.set_location(l_proc, 400);
5281: --
5282: END LOOP;
5283: --
5284: hr_utility.set_location('Leaving: '||l_proc,450);
5285: --hr_utility.trace_off;
5286: EXCEPTION
5287: WHEN OTHERS THEN
5288: hr_utility.set_location('Leaving: '||l_proc,300);
5281: --
5282: END LOOP;
5283: --
5284: hr_utility.set_location('Leaving: '||l_proc,450);
5285: --hr_utility.trace_off;
5286: EXCEPTION
5287: WHEN OTHERS THEN
5288: hr_utility.set_location('Leaving: '||l_proc,300);
5289: -- hr_utility.trace_off;
5284: hr_utility.set_location('Leaving: '||l_proc,450);
5285: --hr_utility.trace_off;
5286: EXCEPTION
5287: WHEN OTHERS THEN
5288: hr_utility.set_location('Leaving: '||l_proc,300);
5289: -- hr_utility.trace_off;
5290: raise;
5291: END archive_code_v5;
5292:
5285: --hr_utility.trace_off;
5286: EXCEPTION
5287: WHEN OTHERS THEN
5288: hr_utility.set_location('Leaving: '||l_proc,300);
5289: -- hr_utility.trace_off;
5290: raise;
5291: END archive_code_v5;
5292:
5293: END pay_gb_edi_p46_car;