118: IS
119:
120: cursor c_get_start_date(cp_tax_unit_id in number)
121: is
122: select fnd_date.canonical_to_date(ltrim(rtrim(substr(ppa.legislative_parameters,
123: instr(ppa.legislative_parameters,
124: 'END_DATE=')
125: + length('END_DATE='),
126: (instr(ppa.legislative_parameters,
138:
139:
140: cursor c_get_imp_date(cp_organization_id in number)
141: is
142: select fnd_date.canonical_to_date(org_information6)
143: from hr_organization_information
144: where org_information_context= 'MX_TAX_REGISTRATION'
145: and organization_id = cp_organization_id ;
146:
165: -- Bug 4403044 - Corrected condition
166: --
167: if (c_get_imp_date%notfound) OR (ld_report_imp_date IS NULL) then
168: -- defaulting to Report Implementation Date from mx pay legislation info table
169: ld_report_imp_date := fnd_date.canonical_to_date(per_mx_ssaffl_archive.get_default_imp_date) ;
170: end if;
171: close c_get_imp_date;
172:
173: if p_gre_id is not null then
183: ld_start_date := ld_report_imp_date ;
184: end if;
185: close c_get_start_date;
186:
187: lv_start_date := fnd_date.date_to_canonical(ld_start_date) ;
188:
189: return lv_start_date ;
190:
191: end get_start_date;
237: - (instr(legislative_parameters,
238: 'TRANS_GRE=')
239: + length('TRANS_GRE=')))))) , -- trans_gre
240:
241: fnd_date.canonical_to_date(ltrim(rtrim(substr(legislative_parameters,
242: instr(legislative_parameters,
243: 'END_DATE=')
244: + length('END_DATE='),
245: (instr(legislative_parameters,
247: - (instr(legislative_parameters,
248: 'END_DATE=')
249: + length('END_DATE=')))))), -- end_date
250:
251: fnd_date.canonical_to_date(ltrim(rtrim(substr(legislative_parameters,
252: instr(legislative_parameters,
253: 'START_DATE=')
254: + length('START_DATE='),
255: (instr(legislative_parameters,
258: 'START_DATE=')
259: + length('START_DATE=')))))), -- start_date
260:
261:
262: fnd_date.canonical_to_date(ltrim(rtrim(substr(legislative_parameters,
263: instr(legislative_parameters,
264: 'PERIOD_ENDING_DATE=')
265: + length('PERIOD_ENDING_DATE='),
266: (instr(legislative_parameters,
269: 'PERIOD_ENDING_DATE=')
270: + length('PERIOD_ENDING_DATE=')))))), -- period_ending_date
271:
272: trunc( add_months (
273: fnd_date.canonical_to_date(ltrim(rtrim(substr(legislative_parameters,
274: instr(legislative_parameters,
275: 'PERIOD_ENDING_DATE=')
276: + length('PERIOD_ENDING_DATE='),
277: (instr(legislative_parameters,
294: where payroll_action_id = cp_payroll_action_id;
295:
296: cursor c_get_imp_date(cp_organization_id in number)
297: is
298: select fnd_date.canonical_to_date(org_information6)
299: from hr_organization_information
300: where org_information_context= 'MX_TAX_REGISTRATION'
301: and organization_id = cp_organization_id ;
302:
359: fetch c_get_imp_date into ld_report_imp_date ;
360: if c_get_imp_date%notfound then
361: dbg('WARNING : Report Implementaton date is not entered for legal employer ' );
362: dbg('so defaulting to Report Implementation Date from pay mx legislation info table');
363: ld_report_imp_date := fnd_date.canonical_to_date(per_mx_ssaffl_archive.get_default_imp_date) ;
364: end if;
365: close c_get_imp_date;
366: dbg('report impl date is '||to_char(ld_report_imp_date) );
367: g_report_imp_date := ld_report_imp_date;
387:
388: dbg('Parameters.....');
389:
390: dbg('report mode : ' || p_report_mode ) ;
391: dbg('period start date : ' || fnd_date.date_to_canonical(p_period_start_date)) ;
392: dbg('period end date : ' || fnd_date.date_to_canonical(p_period_end_date)) ;
393: dbg('start date : ' || fnd_date.date_to_canonical(p_start_date)) ;
394: dbg('end date : ' || fnd_date.date_to_canonical(p_end_date)) ;
395: dbg('bus group id : ' || to_char(p_business_group_id)) ;
388: dbg('Parameters.....');
389:
390: dbg('report mode : ' || p_report_mode ) ;
391: dbg('period start date : ' || fnd_date.date_to_canonical(p_period_start_date)) ;
392: dbg('period end date : ' || fnd_date.date_to_canonical(p_period_end_date)) ;
393: dbg('start date : ' || fnd_date.date_to_canonical(p_start_date)) ;
394: dbg('end date : ' || fnd_date.date_to_canonical(p_end_date)) ;
395: dbg('bus group id : ' || to_char(p_business_group_id)) ;
396: dbg('trans gre id : ' || to_char(p_tran_gre_id)) ;
389:
390: dbg('report mode : ' || p_report_mode ) ;
391: dbg('period start date : ' || fnd_date.date_to_canonical(p_period_start_date)) ;
392: dbg('period end date : ' || fnd_date.date_to_canonical(p_period_end_date)) ;
393: dbg('start date : ' || fnd_date.date_to_canonical(p_start_date)) ;
394: dbg('end date : ' || fnd_date.date_to_canonical(p_end_date)) ;
395: dbg('bus group id : ' || to_char(p_business_group_id)) ;
396: dbg('trans gre id : ' || to_char(p_tran_gre_id)) ;
397: dbg('gre id : ' || to_char(p_gre_id)) ;
390: dbg('report mode : ' || p_report_mode ) ;
391: dbg('period start date : ' || fnd_date.date_to_canonical(p_period_start_date)) ;
392: dbg('period end date : ' || fnd_date.date_to_canonical(p_period_end_date)) ;
393: dbg('start date : ' || fnd_date.date_to_canonical(p_start_date)) ;
394: dbg('end date : ' || fnd_date.date_to_canonical(p_end_date)) ;
395: dbg('bus group id : ' || to_char(p_business_group_id)) ;
396: dbg('trans gre id : ' || to_char(p_tran_gre_id)) ;
397: dbg('gre id : ' || to_char(p_gre_id)) ;
398: dbg('event group id : ' || to_char(p_event_group_id) );
512: pay_element_types_f pet,
513: pay_element_type_extra_info petei,
514: per_all_assignments_f paf
515: where ppe.creation_date between
516: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_start_date) || ''')
517: and fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_end_date) || ''')
518: and peu.event_update_id =ppe.event_update_id
519: and peu.dated_table_id = pde.dated_table_id
520: and pde.event_group_id = ''' ||ln_event_group_id || '''
513: pay_element_type_extra_info petei,
514: per_all_assignments_f paf
515: where ppe.creation_date between
516: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_start_date) || ''')
517: and fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_end_date) || ''')
518: and peu.event_update_id =ppe.event_update_id
519: and peu.dated_table_id = pde.dated_table_id
520: and pde.event_group_id = ''' ||ln_event_group_id || '''
521: and ppe.business_group_id = ''' ||ln_business_group_id || '''
557: pay_element_types_f pet,
558: pay_element_type_extra_info petei,
559: per_all_assignments_f paf
560: where ppe.creation_date between
561: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_start_date) || ''')
562: and fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_end_date) || ''')
563: and peu.event_update_id =ppe.event_update_id
564: and peu.dated_table_id = pde.dated_table_id
565: and pde.event_group_id = ''' ||ln_event_group_id || '''
558: pay_element_type_extra_info petei,
559: per_all_assignments_f paf
560: where ppe.creation_date between
561: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_start_date) || ''')
562: and fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_end_date) || ''')
563: and peu.event_update_id =ppe.event_update_id
564: and peu.dated_table_id = pde.dated_table_id
565: and pde.event_group_id = ''' ||ln_event_group_id || '''
566: and ppe.business_group_id = ''' ||ln_business_group_id || '''
579: select distinct pee.assignment_id
580: from pay_element_entries_f pee,
581: pay_element_type_extra_info petei
582: where pee.effective_start_date between
583: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_start_date) || ''')
584: and fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || ''')
585: and petei.element_type_id = pee.element_type_id
586: and petei.eei_information_category=''PQP_UK_RATE_TYPE''
587: and petei.eei_information1=''MX_IDWV''
580: from pay_element_entries_f pee,
581: pay_element_type_extra_info petei
582: where pee.effective_start_date between
583: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_start_date) || ''')
584: and fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || ''')
585: and petei.element_type_id = pee.element_type_id
586: and petei.eei_information_category=''PQP_UK_RATE_TYPE''
587: and petei.eei_information1=''MX_IDWV''
588: ) x,
587: and petei.eei_information1=''MX_IDWV''
588: ) x,
589: per_all_assignments_f paf1
590: where x.assignment_id = paf1.assignment_id
591: and fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || ''')
592: between paf1.effective_start_date and paf1.effective_end_date
593: and (( per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
594: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || ''')) = -1 )
595: or ( per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
590: where x.assignment_id = paf1.assignment_id
591: and fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || ''')
592: between paf1.effective_start_date and paf1.effective_end_date
593: and (( per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
594: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || ''')) = -1 )
595: or ( per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
596: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || ''')) = -2 )
597: or ( ''' ||ln_tran_gre_id || ''' is not null and ''' ||ln_gre_id || ''' is not null and
598: per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
592: between paf1.effective_start_date and paf1.effective_end_date
593: and (( per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
594: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || ''')) = -1 )
595: or ( per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
596: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || ''')) = -2 )
597: or ( ''' ||ln_tran_gre_id || ''' is not null and ''' ||ln_gre_id || ''' is not null and
598: per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
599: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || '''))=''' ||ln_gre_id || ''')
600: or ( ''' ||ln_tran_gre_id || ''' is not null and ''' ||ln_gre_id || ''' is null and
595: or ( per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
596: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || ''')) = -2 )
597: or ( ''' ||ln_tran_gre_id || ''' is not null and ''' ||ln_gre_id || ''' is not null and
598: per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
599: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || '''))=''' ||ln_gre_id || ''')
600: or ( ''' ||ln_tran_gre_id || ''' is not null and ''' ||ln_gre_id || ''' is null and
601: per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
602: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || '''))
603: in
598: per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
599: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || '''))=''' ||ln_gre_id || ''')
600: or ( ''' ||ln_tran_gre_id || ''' is not null and ''' ||ln_gre_id || ''' is null and
601: per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf1.location_id,paf1.business_group_id,paf1.soft_coding_keyflex_id,
602: fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_period_end_date) || '''))
603: in
604: (select organization_id
605: from hr_organization_information hoi
606: where hoi.org_information_context = ''MX_SOC_SEC_DETAILS''
801: dbg('tansmitter gre id : ' || to_char(ln_tran_gre_id));
802: dbg('gre id : ' || to_char(ln_gre_id));
803: dbg('event group id : ' || to_char(ln_event_group_id));
804: dbg('business_group_id : ' || to_char(ln_business_group_id));
805: dbg('start date is : ' || fnd_date.date_to_canonical(ld_start_date)) ;
806: dbg('end date is : ' || fnd_date.date_to_canonical(ld_end_date)) ;
807:
808: if lv_report_mode = 'F' then -- Fixed Salary
809:
802: dbg('gre id : ' || to_char(ln_gre_id));
803: dbg('event group id : ' || to_char(ln_event_group_id));
804: dbg('business_group_id : ' || to_char(ln_business_group_id));
805: dbg('start date is : ' || fnd_date.date_to_canonical(ld_start_date)) ;
806: dbg('end date is : ' || fnd_date.date_to_canonical(ld_end_date)) ;
807:
808: if lv_report_mode = 'F' then -- Fixed Salary
809:
810: open c_get_fix_sal_asg( p_start_person_id