8: g_basis_end date;
9: g_basis_start date;
10: g_basis_year varchar2(4);
11: g_legal_entity_id varchar2(20);
12: g_person_id per_all_people_f.person_id%type;
13: g_assignment_set_id hr_assignment_sets.assignment_set_id%type;
14: g_setup_action_id pay_payroll_actions.payroll_action_id%type;
15: g_report_type varchar2(30);
16: g_previous_person_id per_all_people_f.person_id%type;
12: g_person_id per_all_people_f.person_id%type;
13: g_assignment_set_id hr_assignment_sets.assignment_set_id%type;
14: g_setup_action_id pay_payroll_actions.payroll_action_id%type;
15: g_report_type varchar2(30);
16: g_previous_person_id per_all_people_f.person_id%type;
17: g_moa_369_date ff_archive_items.value%type;
18: -- Added for bug 5435088 org cursor only need to run once
19: g_name_of_bank ff_archive_items.value%type;
20: g_org_run char(1);
19: g_name_of_bank ff_archive_items.value%type;
20: g_org_run char(1);
21: g_org_a8a_run char(1);
22: g_iras_method char(1); /* Bug 7415444 , Original or Amendment*/
23: g_national_identifier per_all_people_f.national_identifier%type;
24: g_legal_entity_name hr_organization_information.org_information1%type;
25: g_er_income_tax_number hr_organization_information.org_information4%type;
26: g_er_ohq_status hr_organization_information.org_information12%type;
27: g_er_iras_category hr_organization_information.org_information13%type;
80: -- Assignment actions are created for all assignments processed by pre-processor
81: ----------------------------------------------------------------------------
82: procedure assignment_action_code
83: ( p_payroll_action_id in pay_payroll_actions.payroll_action_id%type,
84: p_start_person_id in per_all_people_f.person_id%type,
85: p_end_person_id in per_all_people_f.person_id%type,
86: p_chunk in number )
87: is
88: v_next_action_id pay_assignment_actions.assignment_action_id%type;
81: ----------------------------------------------------------------------------
82: procedure assignment_action_code
83: ( p_payroll_action_id in pay_payroll_actions.payroll_action_id%type,
84: p_start_person_id in per_all_people_f.person_id%type,
85: p_end_person_id in per_all_people_f.person_id%type,
86: p_chunk in number )
87: is
88: v_next_action_id pay_assignment_actions.assignment_action_id%type;
89: v_setup_action_id pay_payroll_actions.payroll_action_id%type;
207: -- Bug: 3118540 - This function is called from SRS 'IR8S Ad Hoc Printed Archive'
208: --------------------------------------------------------------------------------
209: procedure assignment_action_code_adhoc
210: ( p_payroll_action_id in pay_payroll_actions.payroll_action_id%type,
211: p_start_person_id in per_all_people_f.person_id%type,
212: p_end_person_id in per_all_people_f.person_id%type,
213: p_chunk in number )
214: is
215: v_next_action_id pay_assignment_actions.assignment_action_id%type;
208: --------------------------------------------------------------------------------
209: procedure assignment_action_code_adhoc
210: ( p_payroll_action_id in pay_payroll_actions.payroll_action_id%type,
211: p_start_person_id in per_all_people_f.person_id%type,
212: p_end_person_id in per_all_people_f.person_id%type,
213: p_chunk in number )
214: is
215: v_next_action_id pay_assignment_actions.assignment_action_id%type;
216: v_person_id per_all_people_f.person_id%type;
212: p_end_person_id in per_all_people_f.person_id%type,
213: p_chunk in number )
214: is
215: v_next_action_id pay_assignment_actions.assignment_action_id%type;
216: v_person_id per_all_people_f.person_id%type;
217: v_assignment_set_id hr_assignment_sets.assignment_set_id%type;
218: v_business_group_id number;
219: v_basis_start date;
220: v_basis_end date;
246: -- Bug#3614563 Removed the Business Group id check from inner query to imporove the performence.
247: ----------------------------------------------------------------------------
248: cursor process_assignments
249: ( c_payroll_action_id in pay_payroll_actions.payroll_action_id%type,
250: c_start_person_id in per_all_people_f.person_id%type,
251: c_end_person_id in per_all_people_f.person_id%type,
252: c_person_id in per_all_people_f.person_id%type,
253: c_assignment_set_id in hr_assignment_sets.assignment_set_id%type,
254: c_business_group_id in number,
247: ----------------------------------------------------------------------------
248: cursor process_assignments
249: ( c_payroll_action_id in pay_payroll_actions.payroll_action_id%type,
250: c_start_person_id in per_all_people_f.person_id%type,
251: c_end_person_id in per_all_people_f.person_id%type,
252: c_person_id in per_all_people_f.person_id%type,
253: c_assignment_set_id in hr_assignment_sets.assignment_set_id%type,
254: c_business_group_id in number,
255: c_legal_entity_id in number,
248: cursor process_assignments
249: ( c_payroll_action_id in pay_payroll_actions.payroll_action_id%type,
250: c_start_person_id in per_all_people_f.person_id%type,
251: c_end_person_id in per_all_people_f.person_id%type,
252: c_person_id in per_all_people_f.person_id%type,
253: c_assignment_set_id in hr_assignment_sets.assignment_set_id%type,
254: c_business_group_id in number,
255: c_legal_entity_id in number,
256: c_basis_start in date,
425: procedure archive_code
426: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
427: p_effective_date in date )
428: is
429: v_person_id per_all_people_f.person_id%type;
430: v_assignment_id per_all_assignments_f.assignment_id%type;
431: v_national_identifier varchar2(50);
432: v_archive_date pay_payroll_actions.effective_date%type;
433: l_person_id per_all_people_f.person_id%type;
429: v_person_id per_all_people_f.person_id%type;
430: v_assignment_id per_all_assignments_f.assignment_id%type;
431: v_national_identifier varchar2(50);
432: v_archive_date pay_payroll_actions.effective_date%type;
433: l_person_id per_all_people_f.person_id%type;
434: l_archived_person_id binary_integer;
435:
436: ------------------------------------------------------------------------
437: -- Bug 2920732 - Modified the cursor to use secured views per_people_f, per_assignments_f
1069: -- earnings by month.
1070: ---------------------------------------------------------------------------
1071: procedure archive_balances
1072: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
1073: p_person_id in per_all_people_f.person_id%type,
1074: p_business_group_id in hr_organization_units.business_group_id%type,
1075: p_tax_unit_id in ff_archive_item_contexts.context%type,
1076: p_basis_year in varchar2 )
1077: is
1137: -- Bug# 2920732 - Modified the cursor to use secured view per_assignments_f
1138: -- Cursor month_year_action_sequence
1139: ---------------------------------------------------------------------------------------------------
1140: cursor month_year_action_sequence
1141: ( c_person_id per_all_people_f.person_id%type,
1142: c_business_group_id hr_organization_units.business_group_id%type,
1143: c_legal_entity_id pay_assignment_actions.tax_unit_id%type,
1144: c_basis_year varchar2 )
1145: is
1162: ---------------------------------------------------------------------------------------------------
1163: -- cursor month_year_action
1164: ---------------------------------------------------------------------------------------------------
1165: cursor month_year_action
1166: ( c_person_id per_all_people_f.person_id%type,
1167: c_business_group_id hr_organization_units.business_group_id%type,
1168: c_legal_entity_id pay_assignment_actions.tax_unit_id%type,
1169: c_basis_year varchar2,
1170: c_action_sequence pay_assignment_actions.action_sequence%type )
1253: ---------------------------------------------------------------------------------------------------
1254: -- Type to store the person ids with same national_identifier (Bug 2649107)
1255: ---------------------------------------------------------------------------------------------------
1256: type person_id_store_rec is record
1257: ( person_id per_all_people_f.person_id%type );
1258: type person_id_tab is table of person_id_store_rec index by binary_integer;
1259: person_id_rec person_id_tab;
1260: ---------------------------------------------------------------------------------------------------
1261: -- Type to store the months on which payroll is run for a perticular person id
1274: month_year_action_sequence_rec month_year_action_sequence%rowtype;
1275: month_year_action_rec month_year_action%rowtype;
1276: per_le_ytd_bal number;
1277: per_le_mtd_bal number;
1278: l_person_id per_all_people_f.person_id%type;
1279: l_ytd_counter number;
1280: l_mon_counter number;
1281: counter number;
1282: icounter number;
1761: -- Bug#2833530
1762: -- bug 2724020
1763: ---------------------------------------------------------------------------
1764: procedure archive_balance_dates
1765: ( p_person_id in per_all_people_f.person_id%TYPE,
1766: p_basis_year in varchar2,
1767: p_business_group_id in hr_organization_units.business_group_id%type,
1768: p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
1769: p_run_ass_action_id in pay_assignment_actions.assignment_action_id%type,
1786: l_prev_ass_id per_all_assignments_f.assignment_id%TYPE;
1787: l_new_ass_id per_all_assignments_f.assignment_id%TYPE;
1788: l_run_ass_action_id pay_assignment_actions.assignment_action_id%TYPE;
1789: l_term_max_assact_id pay_assignment_actions.assignment_action_id%TYPE;
1790: l_person_id per_all_people_f.person_id%type;
1791: v_person_id per_all_people_f.person_id%type;
1792:
1793: ---------------------------------------------------------------------------
1794: -- Bug# 2833530
1787: l_new_ass_id per_all_assignments_f.assignment_id%TYPE;
1788: l_run_ass_action_id pay_assignment_actions.assignment_action_id%TYPE;
1789: l_term_max_assact_id pay_assignment_actions.assignment_action_id%TYPE;
1790: l_person_id per_all_people_f.person_id%type;
1791: v_person_id per_all_people_f.person_id%type;
1792:
1793: ---------------------------------------------------------------------------
1794: -- Bug# 2833530
1795: -- Added check_termination and get_max_assactid cursors
1794: -- Bug# 2833530
1795: -- Added check_termination and get_max_assactid cursors
1796: -- Bug# 2920732 - Modified the cursor to use secured views per_people_f, per_assignments_f
1797: ---------------------------------------------------------------------------
1798: cursor check_termination( c_person_id per_all_people_f.person_id%TYPE,
1799: c_basis_year varchar2 )
1800: is
1801: select 'Y',
1802: oldpaaf.assignment_id,
2496: procedure archive_org_info
2497: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
2498: p_business_group_id in hr_organization_units.business_group_id%type,
2499: p_legal_entity_id in hr_organization_units.organization_id%type,
2500: p_person_id in per_all_people_f.person_id%type,
2501: p_basis_start in date,
2502: p_basis_end in date)
2503: is
2504: --
2571: c_basis_end date)
2572: is
2573: select
2574: count(distinct pei.person_extra_info_id)
2575: from per_all_people_f pap,
2576: per_people_extra_info pei,
2577: per_assignments_f assign,
2578: hr_soft_coding_keyflex hsc
2579: where pap.person_id = pei.person_id
2774: procedure archive_payroll_date
2775: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
2776: p_business_group_id in hr_organization_units.business_group_id%type,
2777: p_legal_entity_id in hr_organization_units.organization_id%type,
2778: p_person_id in per_all_people_f.person_id%type,
2779: p_basis_year in varchar2) is
2780:
2781: v_payroll_date varchar2(30);
2782: cursor payroll_date
2781: v_payroll_date varchar2(30);
2782: cursor payroll_date
2783: ( c_business_group_id hr_organization_units.business_group_id%type,
2784: c_legal_entity_id hr_organization_units.organization_id%type,
2785: c_person_id per_all_people_f.person_id%type,
2786: c_basis_year varchar2)
2787: is
2788: select fnd_date.date_to_canonical(max(ppamax.effective_date))
2789: from per_assignments_f paamax,
2821: -- Copies the standard Person information route code.
2822: ---------------------------------------------------------------------------
2823: procedure archive_person_details
2824: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
2825: p_person_id in per_all_people_f.person_id%type,
2826: p_basis_start in date,
2827: p_basis_end in date )
2828: is
2829: --
2826: p_basis_start in date,
2827: p_basis_end in date )
2828: is
2829: --
2830: v_national_identifier per_all_people_f.national_identifier%type;
2831: v_sex hr_lookups.meaning%type;
2832: v_date_of_birth varchar2(30);
2833: ---------------------------------------------------------------------------
2834: -- Bug# 2920732 - Modified the cursor to use secured view per_people_f
2834: -- Bug# 2920732 - Modified the cursor to use secured view per_people_f
2835: -- Bug 2645599
2836: ---------------------------------------------------------------------------
2837: cursor person_details
2838: ( c_person_id per_all_people_f.person_id%type,
2839: c_basis_start date,
2840: c_basis_end date )
2841: is
2842: select people.national_identifier,
2881: -- Copies the standard Person Address information route code.
2882: ---------------------------------------------------------------------------
2883: procedure archive_person_addresses
2884: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
2885: p_person_id in per_all_people_f.person_id%type,
2886: p_basis_start in date,
2887: p_basis_end in date )
2888: is
2889: v_style per_addresses.style%type;
2899: -- Bug2647074
2900: -- Modified for bug 5435088, added style, type and country
2901: ---------------------------------------------------------------------------
2902: cursor person_address
2903: (c_person_id per_all_people_f.person_id%type,
2904: c_basis_start date,
2905: c_basis_end date) is
2906: select addr.style,
2907: addr.address_type,
2969: -- Bug 4688761, to separate from the above procedure
2970: ---------------------------------------------------------------------------
2971: procedure archive_person_cq_addresses
2972: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
2973: p_person_id in per_all_people_f.person_id%type,
2974: p_basis_start in date,
2975: p_basis_end in date )
2976: is
2977: v_address_line_1 per_addresses.address_line1%type;
2982: v_date_to varchar2(30);
2983:
2984: -- Added for bug 2373475
2985: cursor person_cq_address
2986: (c_person_id per_all_people_f.person_id%type,
2987: c_basis_start date,
2988: c_basis_end date) is
2989: select addr.address_line1,
2990: addr.address_line2,
3037: -- Copies the standard Employee information route code.
3038: ---------------------------------------------------------------------------
3039: procedure archive_emp_details
3040: (p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
3041: p_person_id in per_all_people_f.person_id%type,
3042: p_legal_entity_id in hr_organization_units.organization_id%type,
3043: p_basis_start in date,
3044: p_basis_end in date) is
3045:
3051:
3052: /* Bug 13711297 */
3053: /* Bug 13786754 */
3054: cursor ass_latest_join_dates
3055: (c_person_id per_all_people_f.person_id%type,
3056: c_legal_entity_id hr_organization_units.organization_id%type,
3057: c_basis_start date,
3058: c_basis_end date )
3059: is
3072: or assign.effective_end_date between c_basis_start and c_basis_end)
3073: and assign.effective_start_date >= c_basis_start;
3074:
3075: cursor ass_check_dayb4_a
3076: (c_person_id per_all_people_f.person_id%type,
3077: c_legal_entity_id hr_organization_units.organization_id%type,
3078: c_date date )
3079: is
3080: select 'Y'
3089: and sta.per_system_status in ('ACTIVE_ASSIGN')
3090: and c_date between assign.effective_start_date and assign.effective_end_date;
3091:
3092: cursor ass_latest_term_dates
3093: (c_person_id per_all_people_f.person_id%type,
3094: c_legal_entity_id hr_organization_units.organization_id%type,
3095: c_basis_start date,
3096: c_basis_end date )
3097: is
3171: -- Copies the standard Person Developer DF route code.
3172: ---------------------------------------------------------------------------
3173: procedure archive_people_flex
3174: (p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
3175: p_person_id in per_all_people_f.person_id%type,
3176: p_basis_start in date,
3177: p_basis_end in date)
3178: is
3179: --
3176: p_basis_start in date,
3177: p_basis_end in date)
3178: is
3179: --
3180: v_sg_legal_name per_all_people_f.per_information1%type;
3181: v_pp_country per_all_people_f.per_information3%type;
3182: v_permit_type per_all_people_f.per_information6%type;
3183: v_permit_date varchar2(30);
3184: v_income_tax_no per_all_people_f.per_information12%type;
3177: p_basis_end in date)
3178: is
3179: --
3180: v_sg_legal_name per_all_people_f.per_information1%type;
3181: v_pp_country per_all_people_f.per_information3%type;
3182: v_permit_type per_all_people_f.per_information6%type;
3183: v_permit_date varchar2(30);
3184: v_income_tax_no per_all_people_f.per_information12%type;
3185: v_payee_id_type per_all_people_f.per_information23%type;
3178: is
3179: --
3180: v_sg_legal_name per_all_people_f.per_information1%type;
3181: v_pp_country per_all_people_f.per_information3%type;
3182: v_permit_type per_all_people_f.per_information6%type;
3183: v_permit_date varchar2(30);
3184: v_income_tax_no per_all_people_f.per_information12%type;
3185: v_payee_id_type per_all_people_f.per_information23%type;
3186: l_payee_id_check char(1);
3180: v_sg_legal_name per_all_people_f.per_information1%type;
3181: v_pp_country per_all_people_f.per_information3%type;
3182: v_permit_type per_all_people_f.per_information6%type;
3183: v_permit_date varchar2(30);
3184: v_income_tax_no per_all_people_f.per_information12%type;
3185: v_payee_id_type per_all_people_f.per_information23%type;
3186: l_payee_id_check char(1);
3187: l_nationality_code varchar2(3);
3188: ---------------------------------------------------------------------------
3181: v_pp_country per_all_people_f.per_information3%type;
3182: v_permit_type per_all_people_f.per_information6%type;
3183: v_permit_date varchar2(30);
3184: v_income_tax_no per_all_people_f.per_information12%type;
3185: v_payee_id_type per_all_people_f.per_information23%type;
3186: l_payee_id_check char(1);
3187: l_nationality_code varchar2(3);
3188: ---------------------------------------------------------------------------
3189: -- Bug# 2920732 - Modified the cursor to use secured view per_people_f
3190: -- Bug 2645599
3191: -- Bug 5435088, Added Payee ID Type and permit date
3192: ---------------------------------------------------------------------------
3193: cursor emp_details
3194: ( c_person_id per_all_people_f.person_id%type,
3195: c_basis_start date,
3196: c_basis_end date )
3197: is
3198: select people.per_information1,
3276: -- Copies the standard Extra Person Information DF route code.
3277: ---------------------------------------------------------------------------
3278: procedure archive_person_eits
3279: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
3280: p_person_id in per_all_people_f.person_id%type,
3281: p_basis_start in date,
3282: p_basis_end in date )
3283: is
3284: --
3382: -- Added p_assignment_id as parameter
3383: ---------------------------------------------------------------------------
3384: procedure archive_assignment_eits
3385: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
3386: p_person_id in per_all_people_f.person_id%type,
3387: p_assignment_id in per_all_assignments_f.assignment_id%type,
3388: p_legal_entity_id in hr_organization_units.organization_id%type,
3389: p_basis_start in date,
3390: p_basis_end in date )
3401: -- we pass the assignment_id as a parameter
3402: -- Bug 5435088 - Added field Approval from CPF to make full
3403: ---------------------------------------------------------------------------
3404: cursor assignment_eits
3405: ( c_person_id per_all_people_f.person_id%type,
3406: c_assignment_id per_assignments_f.assignment_id%type,
3407: c_legal_entity_id hr_organization_units.organization_id%type,
3408: c_basis_start date,
3409: c_basis_end date )
3450: -- value g_moa_369_date
3451: ---------------------------------------------------------------------------
3452: procedure archive_ass_bonus_date_eits
3453: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
3454: p_person_id in per_all_people_f.person_id%type,
3455: p_assignment_id in per_all_assignments_f.assignment_id%type,
3456: p_legal_entity_id in hr_organization_units.organization_id%type,
3457: p_basis_start in date,
3458: p_basis_end in date )
3461: v_ass_bonus_date varchar2(10);
3462: v_assignment_id per_assignments_f.assignment_id%type;
3463:
3464: cursor ass_bonus_date_eits
3465: ( c_person_id per_all_people_f.person_id%type,
3466: c_assignment_id per_assignments_f.assignment_id%type,
3467: c_legal_entity_id hr_organization_units.organization_id%type,
3468: c_basis_start date,
3469: c_basis_end date )
3515: -- payment method
3516: ---------------------------------------------------------------------------
3517: procedure archive_ass_payment_method
3518: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
3519: p_person_id in per_all_people_f.person_id%type,
3520: p_assignment_id in per_all_assignments_f.assignment_id%type,
3521: p_legal_entity_id in hr_organization_units.organization_id%type,
3522: p_basis_start in date,
3523: p_basis_end in date)
3526: v_ass_bank_name varchar2(10);
3527: v_assignment_id per_assignments_f.assignment_id%type;
3528:
3529: cursor ass_payment_method
3530: ( c_person_id per_all_people_f.person_id%type,
3531: c_assignment_id per_assignments_f.assignment_id%type,
3532: c_legal_entity_id hr_organization_units.organization_id%type,
3533: c_basis_start in date,
3534: c_basis_end in date)
3593: -- Bug 4890964, added p_assignment_id as parameter
3594: ---------------------------------------------------------------------------
3595: procedure archive_job_designation
3596: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
3597: p_person_id in per_all_people_f.person_id%type,
3598: p_assignment_id in per_all_assignments_f.assignment_id%type,
3599: p_legal_entity_id in hr_organization_units.organization_id%type,
3600: p_basis_start in date,
3601: p_basis_end in date,
3613: -- Bug 5868910 - Added effective_start_date sub-query for the date tracked
3614: -- assignment
3615: ---------------------------------------------------------------------------
3616: cursor grade
3617: ( c_person_id per_all_people_f.person_id%type,
3618: c_assignment_id per_assignments_f.assignment_id%type,
3619: c_legal_entity_id hr_organization_units.organization_id%type,
3620: c_basis_start date,
3621: c_basis_end date) is
3647: -- Bug 5868910 - Added effective_start_date sub-query for the date tracked
3648: -- assignment
3649: ---------------------------------------------------------------------------
3650: cursor job
3651: ( c_person_id per_all_people_f.person_id%type,
3652: c_assignment_id per_all_assignments_f.assignment_id%type,
3653: c_legal_entity_id hr_organization_units.organization_id%type,
3654: c_basis_start date,
3655: c_basis_end date) is
3682: -- Bug 5868910 - Added effective_start_date sub-query for the date tracked
3683: -- assignment
3684: ---------------------------------------------------------------------------
3685: cursor position
3686: ( c_person_id per_all_people_f.person_id%type,
3687: c_assignment_id per_all_assignments_f.assignment_id%type,
3688: c_legal_entity_id hr_organization_units.organization_id%type,
3689: c_basis_start date,
3690: c_basis_end date) is
3720: -- assignment
3721: ---------------------------------------------------------------------------
3722:
3723: cursor position_seg
3724: ( c_person_id per_all_people_f.person_id%type,
3725: c_assignment_id per_all_assignments_f.assignment_id%type,
3726: c_basis_start date,
3727: c_basis_end date,
3728: c_legal_entity_id hr_organization_units.organization_id%type,
3809: -- we pass the assignment_id as a parameter
3810: ---------------------------------------------------------------------------
3811:
3812: cursor other
3813: ( c_person_id per_all_people_f.person_id%type,
3814: c_assignment_id per_all_assignments_f.assignment_id%type,
3815: c_legal_entity_id hr_organization_units.organization_id%type,
3816: c_basis_start date,
3817: c_basis_end date) is
3898: -- assignment whose duration is within Basis Year.
3899: ---------------------------------------------------------------------------
3900: procedure archive_os_assignment
3901: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
3902: p_person_id in per_all_people_f.person_id%type,
3903: p_legal_entity_id in hr_organization_units.organization_id%type,
3904: p_basis_start in date,
3905: p_basis_end in date )
3906: is
3916: --
3917: -- Bug# 4688761 - Modified cursor to check the legal entity
3918: ---------------------------------------------------------------------------
3919: cursor os_assignment
3920: ( c_person_id per_all_people_f.person_id%type,
3921: c_legal_entity_id hr_organization_units.organization_id%type,
3922: c_basis_start date,
3923: c_basis_end date )
3924: is
3966: -- extra information screen, bug 2475287
3967: ---------------------------------------------------------------------------
3968: procedure archive_shares_details
3969: ( p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
3970: p_person_id in per_all_people_f.person_id%type,
3971: p_tax_unit_id in ff_archive_item_contexts.context%type,
3972: p_basis_start in date,
3973: p_basis_end in date )
3974: is
4005: -- Bug 5435088 - Added grant type
4006: -- Bug 13069992 - Added new function to check ESOP date
4007: ---------------------------------------------------------------------------
4008: cursor shares_details
4009: ( c_person_id per_all_people_f.person_id%type,
4010: c_basis_start date,
4011: c_basis_end date )
4012: is -- Bug 10326903, added fnd_number.canonical_to_number
4013: select distinct pei.person_extra_info_id,
4024: pei2.pei_information5 grant_type,
4025: decode(pei2.pei_information3, null, null, to_char(fnd_date.canonical_to_date(pei2.pei_information3),'YYYY')||'/'||
4026: to_char(fnd_date.canonical_to_date(pei2.pei_information3),'MM')||'/'||to_char(fnd_date.canonical_to_date(pei2.pei_information3),'DD')) grant_date,
4027: fnd_number.canonical_to_number(pei2.pei_information4) shares_granted
4028: from per_all_people_f pap,
4029: per_people_extra_info pei,
4030: per_people_extra_info pei2,
4031: hr_all_organization_units hou,
4032: hr_organization_information hoi2,
4233: -- which is entered via assignment extra information screen, bug 3027801
4234: ---------------------------------------------------------------------------
4235: procedure archive_ir8s_c_details
4236: (p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
4237: p_person_id in per_all_people_f.person_id%type,
4238: p_tax_unit_id in ff_archive_item_contexts.context%type,
4239: p_business_group_id in per_assignments_f.business_group_id%type,
4240: p_basis_start in date,
4241: p_basis_end in date) is
4242:
4243: /* Type to store the person ids with same national_identifier */
4244:
4245: type person_id_store_rec is record
4246: (person_id per_all_people_f.person_id%type);
4247:
4248: type person_id_tab is table of person_id_store_rec index by binary_integer;
4249: person_id_rec person_id_tab;
4250:
4248: type person_id_tab is table of person_id_store_rec index by binary_integer;
4249: person_id_rec person_id_tab;
4250:
4251: cursor ir8s_c_invalid_records
4252: (c_person_id per_all_people_f.person_id%type,
4253: c_tax_unit_id ff_archive_item_contexts.context%type,
4254: c_business_group_id per_assignments_f.business_group_id%type,
4255: c_basis_start date,
4256: c_basis_end date) is
4269: and paei.aei_information1 = to_char(c_basis_end,'YYYY')
4270: and (paa.effective_start_date <= c_basis_end
4271: and paa.effective_end_date >= c_basis_start);
4272:
4273: l_person_id per_all_people_f.person_id%type;
4274: l_temp_person_id per_all_people_f.person_id%type;
4275: l_archive_person_id per_all_people_f.person_id%type;
4276: counter number;
4277: l_counter number;
4270: and (paa.effective_start_date <= c_basis_end
4271: and paa.effective_end_date >= c_basis_start);
4272:
4273: l_person_id per_all_people_f.person_id%type;
4274: l_temp_person_id per_all_people_f.person_id%type;
4275: l_archive_person_id per_all_people_f.person_id%type;
4276: counter number;
4277: l_counter number;
4278: duplicate_exists varchar2(1);
4271: and paa.effective_end_date >= c_basis_start);
4272:
4273: l_person_id per_all_people_f.person_id%type;
4274: l_temp_person_id per_all_people_f.person_id%type;
4275: l_archive_person_id per_all_people_f.person_id%type;
4276: counter number;
4277: l_counter number;
4278: duplicate_exists varchar2(1);
4279: l_total_counts number;
4359:
4360:
4361: procedure archive_ir8s_c_detail_moas
4362: (p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
4363: p_1_person_id in per_all_people_f.person_id%type,
4364: p_person_id in per_all_people_f.person_id%type,
4365: p_tax_unit_id in ff_archive_item_contexts.context%type,
4366: p_business_group_id in per_assignments_f.business_group_id%type,
4367: p_basis_start in date,
4360:
4361: procedure archive_ir8s_c_detail_moas
4362: (p_assignment_action_id in pay_assignment_actions.assignment_action_id%type,
4363: p_1_person_id in per_all_people_f.person_id%type,
4364: p_person_id in per_all_people_f.person_id%type,
4365: p_tax_unit_id in ff_archive_item_contexts.context%type,
4366: p_business_group_id in per_assignments_f.business_group_id%type,
4367: p_basis_start in date,
4368: p_basis_end in date) is
4680: -- system Or if current employee is latest in case duplicates exist in the system
4681: -- For second case it also populates global table with all its previous employement records
4682: ----------------------------------------------------------------------
4683: function employee_if_latest ( p_national_identifier in varchar2,
4684: p_person_id in per_all_people_f.person_id%type,
4685: p_setup_action_id in pay_payroll_actions.payroll_action_id%type,
4686: p_report_type in varchar2 ) return boolean
4687: is
4688: type t_person_start_date_tab is table of per_all_people_f.start_date%type;
4684: p_person_id in per_all_people_f.person_id%type,
4685: p_setup_action_id in pay_payroll_actions.payroll_action_id%type,
4686: p_report_type in varchar2 ) return boolean
4687: is
4688: type t_person_start_date_tab is table of per_all_people_f.start_date%type;
4689: g_person_start_date_tab t_person_start_date_tab;
4690: begin
4691: g_person_id_tab.delete;
4692: --
4720: -------------------------------------------------------------------------
4721: -- Bug 4688761, this function checks the same person_id has been archived
4722: -------------------------------------------------------------------------
4723:
4724: function person_if_archived (p_person_id in per_all_people_f.person_id%type) return boolean
4725: is
4726: l_archived_person_id binary_integer;
4727: begin
4728: if g_debug then
4749: -- primary assignment, it needs for share details.
4750: -------------------------------------------------------------------------
4751:
4752: function pri_if_latest
4753: ( p_person_id in per_all_people_f.person_id%type
4754: , p_tax_unit_id in ff_archive_item_contexts.context%type
4755: , p_basis_start in date
4756: , p_basis_end in date) return boolean
4757: is
4756: , p_basis_end in date) return boolean
4757: is
4758: v_dummy varchar2(1);
4759: cursor pri_latest
4760: ( c_person_id per_all_people_f.person_id%type,
4761: c_tax_unit_id pay_assignment_actions.tax_unit_id%type,
4762: c_basis_start date,
4763: c_basis_end date )
4764: is
4812: -- effective_start_date with the primary defined
4813: -------------------------------------------------------------------------
4814:
4815: function pri_LE_if_latest
4816: ( p_person_id in per_all_people_f.person_id%type
4817: , p_tax_unit_id in ff_archive_item_contexts.context%type
4818: , p_basis_start in date
4819: , p_basis_end in date) return number
4820: is
4819: , p_basis_end in date) return number
4820: is
4821: v_assignment_id number(10);
4822: cursor pri_latest_LE
4823: ( c_person_id per_all_people_f.person_id%type,
4824: c_tax_unit_id pay_assignment_actions.tax_unit_id%type,
4825: c_basis_start date,
4826: c_basis_end date )
4827: is
4881: -- not return an assignment_id.
4882: -------------------------------------------------------------------------
4883:
4884: function id_LE_if_latest
4885: ( p_person_id in per_all_people_f.person_id%type
4886: , p_tax_unit_id in ff_archive_item_contexts.context%type
4887: , p_basis_start in date
4888: , p_basis_end in date) return number
4889: is
4888: , p_basis_end in date) return number
4889: is
4890: v_assignment_id number(10);
4891: cursor id_latest_LE
4892: ( c_person_id per_all_people_f.person_id%type,
4893: c_tax_unit_id pay_assignment_actions.tax_unit_id%type,
4894: c_basis_start date,
4895: c_basis_end date )
4896: is