[Home] [Help]
PACKAGE BODY: APPS.GHR_MSL_PKG
Source
1 PACKAGE BODY GHR_MSL_PKG AS
2 /* $Header: ghmslexe.pkb 120.21.12010000.3 2008/12/02 11:01:23 vmididho ship $ */
3
4 g_no number := 0;
5 g_package varchar2(32) := 'GHR_MSL_PKG';
6 g_proc varchar2(72) := null;
7 g_effective_date date;
8 g_rg_recs_failed NUMBER := 0;
9
10 -- Bug#5063304
11 l_log_text varchar2(2000) := null;
12 l_mslerrbuf varchar2(2000) := null;
13 --l_errbuf varchar2(2000) := null;
14
15 PROCEDURE execute_msl (p_errbuf out nocopy varchar2,
16 p_retcode out nocopy number,
17 p_mass_salary_id in number,
18 p_action in varchar2 ) is
19 --p_bus_grp_id in number) IS
20
21 p_mass_salary varchar2(32);
22
23 --
24 --
25 -- Main Cursor which fetches from per_assignments_f and per_people_f
26 --
27 /***** Splitting the cursor into two for better performance
28 ***** 1. First eliminate the check of assignment_status_type_id in the cursor and have outside.
29 ***** 2. One cursor as organization as not null
30 ***** 3. One cursor as organization is null (One FTS will be there because
31 ***** the system should search the entire database.)
32
33 cursor cur_people (effective_date date, p_org_id number) is
34 select ppf.person_id PERSON_ID,
35 ppf.first_name FIRST_NAME,
36 ppf.last_name LAST_NAME,
37 ppf.middle_names MIDDLE_NAMES,
38 ppf.full_name FULL_NAME,
39 ppf.date_of_birth DATE_OF_BIRTH,
40 ppf.national_identifier NATIONAL_IDENTIFIER,
41 paf.position_id POSITION_ID,
42 paf.assignment_id ASSIGNMENT_ID,
43 paf.grade_id GRADE_ID,
44 paf.job_id JOB_ID,
45 paf.location_id LOCATION_ID,
46 paf.organization_id ORGANIZATION_ID,
47 paf.business_group_id BUSINESS_GROUP_ID
48 from per_assignments_f paf,
49 per_people_f ppf,
50 per_person_types ppt,
51 per_assignment_status_types pas_t
52 where ppf.person_id = paf.person_id
53 and paf.primary_flag = 'Y'
54 and paf.assignment_type <> 'B'
55 and paf.assignment_status_type_id = pas_t.assignment_status_type_id
56 and pas_t.user_status not in (
57 'Terminate Assignment',
58 'Active Application',
59 'Offer',
60 'Accepted',
61 'Terminate Application',
62 'End',
63 'Terminate Appointment',
64 'Separated')
65 and effective_date between paf.effective_start_date
66 and nvl(paf.effective_end_date,effective_date+1)
67 and ppf.person_type_id = ppt.person_type_id
68 and ppt.system_person_type = 'EMP'
69 and effective_date between ppf.effective_start_date
70 and nvl(ppf.effective_end_date,effective_date+1)
71 -- VSM. Enhancements [Masscrit.doc] Organization can be null
72 and paf.organization_id + 0 = nvl(p_org_id, paf.organization_id)
73 and paf.position_id is not null
74 order by ppf.person_id; -- 3539816 Order by added to prevent snapshot old error
75 ****/
76 ---
77 --- Bug 3539816 Order by added to prevent snapshot old error
78 --- 1. Cursor with organization.
79 ---
80 CURSOR cur_people_org (effective_date date, p_org_id number) IS
81 SELECT ppf.person_id PERSON_ID,
82 ppf.first_name FIRST_NAME,
83 ppf.last_name LAST_NAME,
84 ppf.middle_names MIDDLE_NAMES,
85 ppf.full_name FULL_NAME,
86 ppf.date_of_birth DATE_OF_BIRTH,
87 ppf.national_identifier NATIONAL_IDENTIFIER,
88 paf.position_id POSITION_ID,
89 paf.assignment_id ASSIGNMENT_ID,
90 paf.grade_id GRADE_ID,
91 paf.job_id JOB_ID,
92 paf.location_id LOCATION_ID,
93 paf.organization_id ORGANIZATION_ID,
94 paf.business_group_id BUSINESS_GROUP_ID,
95 paf.assignment_status_type_id ASSIGNMENT_STATUS_TYPE_ID
96 FROM per_assignments_f paf,
97 per_people_f ppf,
98 per_person_types ppt
99 WHERE ppf.person_id = paf.person_id
100 AND effective_date between ppf.effective_start_date and ppf.effective_end_date
101 AND effective_date between paf.effective_start_date and paf.effective_end_date
102 AND paf.primary_flag = 'Y'
103 AND paf.assignment_type <> 'B'
104 AND ppf.person_type_id = ppt.person_type_id
105 AND ppt.system_person_type IN ('EMP','EMP_APL')
106 AND paf.organization_id = p_org_id
107 AND paf.position_id is not null
108 ORDER BY ppf.person_id;
109
110
111 ---
112 --- Bug 3539816 Order by added to prevent snapshot old error
113 --- 2. Cursor with no organization.
114 ---
115 --- This SQL is tuned by joining the hr_organization_units to avoid the FTS of PAF.
116 --- Bug 6152582
117 ---
118 CURSOR cur_people (effective_date date) IS
119 SELECT ppf.person_id PERSON_ID,
120 ppf.first_name FIRST_NAME,
121 ppf.last_name LAST_NAME,
122 ppf.middle_names MIDDLE_NAMES,
123 ppf.full_name FULL_NAME,
124 ppf.date_of_birth DATE_OF_BIRTH,
125 ppf.national_identifier NATIONAL_IDENTIFIER,
126 paf.position_id POSITION_ID,
127 paf.assignment_id ASSIGNMENT_ID,
128 paf.grade_id GRADE_ID,
129 paf.job_id JOB_ID,
130 paf.location_id LOCATION_ID,
131 paf.organization_id ORGANIZATION_ID,
132 paf.business_group_id BUSINESS_GROUP_ID,
133 paf.assignment_status_type_id ASSIGNMENT_STATUS_TYPE_ID
134 FROM per_assignments_f paf,
135 per_people_f ppf,
136 per_person_types ppt,
137 hr_organization_units hou
138 WHERE ppf.person_id = paf.person_id
139 AND effective_date between ppf.effective_start_date and ppf.effective_end_date
140 AND effective_date between paf.effective_start_date and paf.effective_end_date
141 AND paf.primary_flag = 'Y'
142 AND paf.assignment_type <> 'B'
143 AND ppf.person_type_id = ppt.person_type_id
144 AND ppt.system_person_type IN ('EMP','EMP_APL')
145 AND paf.organization_id = hou.organization_id
146 AND paf.position_id is not null
147 ORDER BY ppf.person_id;
148 --
149 -- Check assignment_status_type
150 --
151
152 CURSOR cur_ast (asg_status_type_id number) IS
153 SELECT user_status from per_assignment_status_types
154 WHERE assignment_status_type_id = asg_status_type_id
155 AND upper(user_status) not in (
156 'TERMINATE ASSIGNMENT', /* 3 */
157 'ACTIVE APPLICATION', /* 4 */
158 'OFFER', /* 5 */
159 'ACCEPTED', /* 6 */
160 'TERMINATE APPLICATION', /* 7 */
161 'END', /* 8 */
162 'TERMINATE APPOINTMENT', /* 126 */
163 'SEPARATED'); /* 132 */
164
165 --
166 -- Cursor to select from GHR_MASS_SALARIES - Where criteria is stored
167 -- Before executing this package
168 -- from ghr_mass_salary_criteria
169 --
170
171 cursor ghr_msl (p_msl_id number) is
172 select name, effective_date, mass_salary_id, user_table_id, submit_flag,
173 executive_order_number, executive_order_date, ROWID, PA_REQUEST_ID,
174 ORGANIZATION_ID, DUTY_STATION_ID, PERSONNEL_OFFICE_ID,
175 AGENCY_CODE_SUBELEMENT, OPM_ISSUANCE_NUMBER, OPM_ISSUANCE_DATE, PROCESS_TYPE
176 from ghr_mass_salaries
177 where MASS_SALARY_ID = p_msl_id
178 for update of user_table_id nowait;
179
180 -- VSM [family name was hardcoded previously to SALARY_CHG. Fetching it from DB now]
181 cursor get_sal_chg_fam is
182 select NOA_FAMILY_CODE
183 from ghr_families
184 where NOA_FAMILY_CODE in
185 (select NOA_FAMILY_CODE from ghr_noa_families
186 where nature_of_action_id =
187 (select nature_of_action_id
188 from ghr_nature_of_actions
189 where code = '894')
190 ) and proc_method_flag = 'Y'; --AVR 13-JAN-99
191 ------------- ) and update_hr_flag = 'Y';
192
193 l_assignment_id per_assignments_f.assignment_id%type;
194 l_position_id per_assignments_f.position_id%type;
195 l_grade_id per_assignments_f.grade_id%type;
196 l_business_group_id per_assignments_f.business_group_id%type;
197
198 l_position_title varchar2(300);
199 l_position_number varchar2(20);
200 l_position_seq_no varchar2(20);
201
202 l_msl_cnt number := 0;
203 l_recs_failed number := 0;
204
205 l_tenure varchar2(35);
206 l_annuitant_indicator varchar2(35);
207 l_pay_rate_determinant varchar2(35);
208 l_work_schedule varchar2(35);
209 l_part_time_hour varchar2(35);
210 l_pay_table_id number;
211 l_pay_plan varchar2(30);
212 l_grade_or_level varchar2(30);
213 -- Bug#5089732 Added current pay plan, grade_or_level
214 l_to_grade_id number;
215 l_to_pay_plan varchar2(30);
216 l_to_grade_or_level varchar2(30);
217 -- Bug#5089732
218 l_step_or_rate varchar2(30);
219 l_pay_basis varchar2(30);
220 l_location_id number;
221 l_duty_station_id number;
222 l_duty_station_desc ghr_pa_requests.duty_station_desc%type;
223 l_duty_station_code ghr_pa_requests.duty_station_code%type;
224 l_effective_date date;
225 l_personnel_office_id varchar2(300);
226 l_org_structure_id varchar2(300);
227 l_sub_element_code varchar2(300);
228
229 l_old_basic_pay number;
230 l_old_avail_pay number;
231 l_old_loc_diff number;
232 l_tot_old_sal number;
233 l_old_auo_pay number;
234 l_old_ADJ_basic_pay number;
235 l_other_pay number;
236
237
238 l_auo_premium_pay_indicator varchar2(30);
239 l_ap_premium_pay_indicator varchar2(30);
240 l_retention_allowance number;
241 l_retention_allow_perc number; ---AVR
242 l_new_retention_allowance number; ---AVR
243 l_supervisory_differential number;
244 l_supervisory_diff_perc number; ---AVR
245 l_new_supervisory_differential number; ---AVR
246 l_staffing_differential number;
247
248 l_new_avail_pay number;
249 l_new_loc_diff number;
250 l_tot_new_sal number;
251 l_new_auo_pay number;
252
253 l_new_basic_pay number;
254 l_new_locality_adj number;
255 l_new_adj_basic_pay number;
256 l_new_total_salary number;
257 l_new_other_pay_amount number;
258 l_new_au_overtime number;
259 l_new_availability_pay number;
260 l_out_step_or_rate varchar2(30);
261 l_out_pay_rate_determinant varchar2(30);
262 l_out_pay_plan varchar2(30);
263 l_out_grade_id number;
264 l_out_grade_or_level varchar2(30);
265
266 l_PT_eff_start_date date;
267 l_open_pay_fields boolean;
268 l_message_set boolean;
269 l_calculated boolean;
270
271 l_mass_salary_id number;
272 l_user_table_id number;
273 l_submit_flag varchar2(2);
274 l_executive_order_number ghr_mass_salaries.executive_order_number%TYPE;
275 l_executive_order_date ghr_mass_salaries.executive_order_date%TYPE;
276 l_opm_issuance_number ghr_mass_salaries.opm_issuance_number%TYPE;
277 l_opm_issuance_date ghr_mass_salaries.opm_issuance_date%TYPE;
278 l_pa_request_id number;
279 l_rowid varchar2(30);
280
281 l_p_ORGANIZATION_ID number;
282 l_p_DUTY_STATION_ID number;
283 l_p_PERSONNEL_OFFICE_ID varchar2(5);
284
285 L_row_cnt number := 0;
286
287 l_sf52_rec ghr_pa_requests%rowtype;
288 l_lac_sf52_rec ghr_pa_requests%rowtype;
289 l_errbuf varchar2(2000);
290
291 l_retcode number;
292
293 l_pos_ei_data per_position_extra_info%rowtype;
294 l_pos_grp1_rec per_position_extra_info%rowtype;
295
296 l_pay_calc_in_data ghr_pay_calc.pay_calc_in_rec_type;
297 l_pay_calc_out_data ghr_pay_calc.pay_calc_out_rec_type;
298 l_sel_flg varchar2(2);
299
300 l_first_action_la_code1 varchar2(30);
301 l_first_action_la_code2 varchar2(30);
302
303 l_remark_code1 varchar2(30);
304 l_remark_code2 varchar2(30);
305 l_p_AGENCY_CODE_SUBELEMENT varchar2(30);
306
307 ----Pay cap variables
308 l_entitled_other_pay NUMBER;
309 l_capped_other_pay NUMBER;
310 l_adj_basic_message BOOLEAN := FALSE;
311 l_pay_cap_message BOOLEAN := FALSE;
312 l_temp_retention_allowance NUMBER;
313 l_open_pay_fields_caps BOOLEAN;
314 l_message_set_caps BOOLEAN;
315 l_total_pay_check VARCHAR2(1);
316 l_comment VARCHAR2(150);
317 l_comment_sal VARCHAR2(150);
318 -- Bug#3968005 Commented l_pay_sel as it is not required.
319 -- l_pay_sel VARCHAR2(1) := NULL;
320 l_old_capped_other_pay NUMBER;
321
322 -- Bug#5063304
323 l_elig_flag BOOLEAN := FALSE;
324 ----
325 REC_BUSY exception;
326 pragma exception_init(REC_BUSY,-54);
327
328 l_proc varchar2(72) := g_package || '.execute_msl';
329
330 -- Bug#5063304 Moved the following cursor, variable declaration
331 -- from execute_msl.
332 CURSOR c_pay_tab_essl IS
333 SELECT 1 from pay_user_tables
334 WHERE substr(user_table_name,1,4) = 'ESSL'
335 AND user_table_id = l_user_table_id;
336
337 l_essl_table BOOLEAN := FALSE;
338 l_org_name hr_organization_units.name%type;
339
340 -- Bug 3315432 Madhuri
341 --
342 CURSOR cur_pp_prd(p_msl_id ghr_mass_salary_criteria.mass_salary_id%type)
343 IS
344 SELECT pay_plan ,pay_rate_determinant prd
345 FROM ghr_mass_salary_criteria
346 WHERE mass_salary_id=p_msl_id;
347
348
349 rec_pp_prd pp_prd;
350 l_index NUMBER:=1;
351 l_cnt NUMBER;
352 l_process_type ghr_mass_salaries.process_type%TYPE;
353 --
354 --
355 -- Local procedure msl_process
356 --
357
358 --
359 -- GPPA Update 46
360 --
361 cursor cur_eq_ppl (c_pay_plan ghr_pay_plans.pay_plan%type)
362 IS
363 select EQUIVALENT_PAY_PLAN
364 from ghr_pay_plans
365 where pay_plan = c_pay_plan;
366
367 l_eq_pay_plan ghr_pay_plans.equivalent_pay_plaN%type;
368
369 --
370 --
371
372 PROCEDURE msl_process( p_assignment_id per_assignments_f.assignment_id%TYPE
373 ,p_person_id per_assignments_f.person_id%TYPE
374 ,p_position_id per_assignments_f.position_id%TYPE
375 ,p_grade_id per_assignments_f.grade_id%TYPE
376 ,p_business_group_id per_assignments_f.business_group_iD%TYPE
377 ,p_location_id per_assignments_f.location_id%TYPE
378 ,p_organization_id per_assignments_f.organization_id%TYPE
379 ,p_date_of_birth date
380 ,p_first_name per_people_f.first_name%TYPE
381 ,p_last_name per_people_f.last_name%TYPE
382 ,p_full_name per_people_f.full_name%TYPE
383 ,p_middle_names per_people_f.middle_names%TYPE
384 ,p_national_identifier per_people_f.national_identifier%TYPE
385 ,p_personnel_office_id IN VARCHAR2
386 ,p_org_structure_id IN VARCHAR2
387 ,p_position_title IN VARCHAR2
388 ,p_position_number IN VARCHAR2
389 ,p_position_seq_no IN VARCHAR2
390 ,p_subelem_code IN VARCHAR2
391 ,p_duty_station_id IN ghr_duty_stations_f.duty_station_id%TYPE
392 ,p_tenure IN VARCHAR2
393 ,p_annuitant_indicator IN VARCHAR2
394 ,p_pay_rate_determinant IN VARCHAR2
395 ,p_work_schedule IN VARCHAR2
396 ,p_part_time_hour IN VARCHAR2
397 ,p_to_grade_id IN per_assignments_f.grade_id%type
398 ,p_pay_plan IN VARCHAR2
399 ,p_to_pay_plan IN VARCHAR2
400 ,p_pay_table_id IN NUMBER
401 ,p_grade_or_level IN VARCHAR2
402 ,p_to_grade_or_level IN VARCHAR2
403 ,p_step_or_rate IN VARCHAR2
404 ,p_pay_basis IN VARCHAR2
405 ) IS
406 -- Bug3437354
407 CURSOR cur_valid_DS(p_ds_id NUMBER)
408 IS
409 SELECT effective_end_date end_date
410 FROM ghr_duty_stations_f
411 WHERE duty_station_id=p_ds_id
412 AND g_effective_date between effective_start_date and effective_end_date;
413
414 l_ds_end_date ghr_duty_stations_f.effective_end_date%type;
415
416 BEGIN
417 savepoint execute_msl_sp;
418 l_msl_cnt := l_msl_cnt +1;
419 --Bug#3968005 Initialised l_sel_flg
420 l_sel_flg := NULL;
421 l_pay_calc_in_data := NULL;
422 l_pay_calc_out_data := NULL;
423
424 l_assignment_id := p_assignment_id;
425 l_position_id := p_position_id;
426 l_grade_id := p_grade_id;
427 l_business_group_id := p_business_group_iD;
428 l_location_id := p_location_id;
429 -- Bug#5063304
430 l_personnel_office_id := p_personnel_office_id;
431 l_org_structure_id := p_org_structure_id;
432 l_position_title := p_position_title;
433 l_position_number := p_position_number;
434 l_position_seq_no := p_position_seq_no;
435 l_sub_element_code := p_subelem_code;
436 l_duty_station_id := p_duty_station_id;
437 l_tenure := p_tenure;
438 l_annuitant_indicator := p_annuitant_indicator;
439 l_pay_rate_determinant := p_pay_rate_determinant;
440 l_work_schedule := P_work_schedule;
441 l_part_time_hour := p_part_time_hour;
442 l_to_grade_id := p_to_grade_id;
443 l_pay_plan := p_pay_plan;
444 l_to_pay_plan := p_to_pay_plan;
445 l_pay_table_id := p_pay_table_id;
446 l_grade_or_level := p_grade_or_level;
447 l_to_grade_or_level := p_to_grade_or_level;
448 l_step_or_rate := P_step_or_rate;
449 l_pay_basis := p_pay_basis;
450 hr_utility.set_location('The location id is:'||l_location_id,1);
451
452 --------GPPA Update 46 start
453 ghr_msl_pkg.g_first_noa_code := NULL;
454 FOR cur_eq_ppl_rec IN cur_eq_ppl(l_pay_plan)
455 LOOP
456 l_eq_pay_plan := cur_eq_ppl_rec.EQUIVALENT_PAY_PLAN;
457 exit;
458 END LOOP;
459 if l_effective_date >= to_date('2007/01/07','YYYY/MM/DD') AND
460 l_eq_pay_plan = 'GS' AND
461 l_lac_sf52_rec.first_action_la_code1 = 'QLP' AND
462 l_lac_sf52_rec.first_action_la_code2 = 'ZLM' THEN
463
464 ghr_msl_pkg.g_first_noa_code := '890';
465
466 end if;
467 if l_effective_date >= to_date('2007/01/07','YYYY/MM/DD') AND
468 l_eq_pay_plan = 'FW' AND
469 l_lac_sf52_rec.first_action_la_code1 = 'RJR' THEN
470
471 ghr_msl_pkg.g_first_noa_code := '890';
472
473 end if;
474 --------GPPA Update 46 end
475
476 g_proc := 'Location Validation';
477 -- Start of Bug3437354
478 IF l_location_id IS NULL THEN
479 l_mslerrbuf := ' Error: No valid Location found, salary cannot be calculated correctly'||
480 ' without the employee''s duty location. ';
481 RAISE msl_error;
482 END IF;
483
484 g_proc := 'Duty Station Validation';
485 IF l_duty_station_id IS NOT NULL THEN
486
487 --
488 -- Added this condition for bug 3437354, error out the record without valid Loc id
489 --
490 FOR rec_ds in cur_valid_ds(l_duty_station_id)
491 LOOP
492 l_ds_end_date := rec_ds.end_Date;
493 END LOOP;
494 IF l_ds_end_date IS NULL THEN
495 hr_utility.set_location('Under DS null check'||l_duty_station_id, 1);
496 l_mslerrbuf := ' Error: Duty Station associated with the location is INVALID. '||
497 'Salary cannot be calculated correctly without valid duty station. ';
498 RAISE msl_error;
499 END IF;
500
501 END IF;
502 -- End of bug 3437354
503
504 /* -- BEGIN
505 ghr_pa_requests_pkg.get_SF52_loc_ddf_details
506 (p_location_id => l_location_id
507 ,p_duty_station_id => l_duty_station_id);
508 / *exception
509 when others then
510 hr_utility.set_location(
511 'Error in Ghr_pa_requests_pkg.get_sf52_loc_ddf_details'||
512 'Err is '||sqlerrm(sqlcode),20);
513 l_mslerrbuf := 'Error in get_sf52_loc_ddf_details '||
514 'Sql Err is '|| sqlerrm(sqlcode);
515 raise msl_error;
516 end;* /
517
518
519
520 get_pos_grp1_ddf(l_position_id,
521 l_effective_date,
522 l_pos_grp1_rec);
523
524 l_personnel_office_id := l_pos_grp1_rec.poei_information3;
525 l_org_structure_id := l_pos_grp1_rec.poei_information5;
526
527 get_sub_element_code_pos_title(l_position_id,
528 p_person_id,
529 l_business_group_id,
530 l_assignment_id,
531 l_effective_date,
532 l_sub_element_code,
533 l_position_title,
534 l_position_number,
535 l_position_seq_no);
536
537 hr_utility.set_location('The duty station id is:'||l_duty_station_id,12345);
538
539 if check_init_eligibility(l_p_duty_station_id,
540 l_p_PERSONNEL_OFFICE_ID,
541 l_p_AGENCY_CODE_SUBELEMENT,
542 l_duty_station_id,
543 l_personnel_office_id,
544 l_sub_element_code) then
545
546 hr_utility.set_location('check_init_eligibility ' || l_proc,6);
547 -- Bug 3457205 Filter the Pay plan table id condition also b4 checking any other thing
548 -- Moving check_eligibility to here.
549 -- Get PRD, work schedule etc form ASG EI
550 begin
551 ghr_pa_requests_pkg.get_sf52_asg_ddf_details
552 (l_assignment_id,
553 l_effective_date,
554 l_tenure,
555 l_annuitant_indicator,
556 l_pay_rate_determinant,
557 l_work_schedule,
558 l_part_time_hour);
559 exception
560 when others then
561 hr_utility.set_location('Error in Ghr_pa_requests_pkg.get_sf52_asg_ddf_details'||
562 'Err is '||sqlerrm(sqlcode),20);
563 l_mslerrbuf := 'Error in get_sf52_asgddf_details Sql Err is '|| sqlerrm(sqlcode);
564 raise msl_error;
565 end;
566
567 -- Bug 3315432 Madhuri
568 --
569 FOR l_cnt in 1..rec_pp_prd.COUNT LOOP
570
571 ---Bug 3327999 First filter the PRD. Then check for Pay plan and Pay table ID
572 IF nvl(rec_pp_prd(l_cnt).prd,l_pay_rate_determinant) = l_pay_rate_determinant THEN
573 -- Get Pay table ID and other details
574 BEGIN
575 -- Bug#5089732 Used the overloaded procedure.
576 get_pay_plan_and_table_id
577 (l_pay_rate_determinant,p_person_id,
578 l_position_id,l_effective_date,
579 l_grade_id, l_to_grade_id,l_assignment_id,'SHOW',
580 l_pay_plan,l_to_pay_plan,l_pay_table_id,
581 l_grade_or_level, l_to_grade_or_level, l_step_or_rate,
582 l_pay_basis);
583 EXCEPTION
584 when msl_error then
585 l_mslerrbuf := hr_utility.get_message;
586 raise;
587 END;
588
589 IF ( nvl(rec_pp_prd(l_cnt).pay_plan,l_pay_plan) = l_pay_plan
590 and l_user_table_id = nvl(l_pay_table_id,l_user_table_id) ) THEN
591
592 IF check_eligibility(l_mass_salary_id,
593 l_user_table_id,
594 l_pay_table_id,
595 l_pay_plan,
596 l_pay_rate_determinant,
597 p_person_id,
598 l_effective_date,
599 p_action) THEN
600 hr_utility.set_location('check_eligibility ' || l_proc,8); */
601 -- Bug#5063304 Moved this call outside check_init_eligibility condition to
602 -- this location.
603 -- BUG 3377958 Madhuri
604 -- Pick the organization name
605 g_proc := 'Fetch Organization Name';
606 l_org_name :=GHR_MRE_PKG.GET_ORGANIZATION_NAME(P_ORGANIZATION_ID);
607 -- BUG 3377958 Madhuri
608 IF upper(p_action) = 'REPORT' AND l_submit_flag = 'P' THEN
609 -- BUG 3377958 Madhuri
610 pop_dtls_from_pa_req(p_person_id,l_effective_date,l_mass_salary_id,l_org_name);
611 -- BUG 3377958 Madhuri
612 ELSE
613 if check_select_flg(p_person_id,upper(p_action),
614 l_effective_date,p_mass_salary_id,l_sel_flg) then
615
616 hr_utility.set_location('check_select_flg ' || l_proc,7);
617 BEGIN
618 hr_utility.set_location('The duty station name is:'||l_duty_station_code,12345);
619 hr_utility.set_location('The duty station desc is:'||l_duty_station_desc,12345);
620 ghr_pa_requests_pkg.get_duty_station_details
621 (p_duty_station_id => l_duty_station_id
622 ,p_effective_date => l_effective_date
623 ,p_duty_station_code => l_duty_station_code
624 ,p_duty_station_desc => l_duty_station_desc);
625 EXCEPTION
626 WHEN others THEN
627 hr_utility.set_location('Error in Ghr_pa_requests_pkg.get_duty_station_details'||
628 'Err is '||sqlerrm(sqlcode),20);
629 l_mslerrbuf := 'Error in get_duty_station_details Sql Err is '|| sqlerrm(sqlcode);
630 RAISE msl_error;
631
632 END;
633
634 get_other_dtls_for_rep(l_pay_rate_determinant,
635 l_executive_order_number,
636 to_char(l_executive_order_date),
637 l_first_action_la_code1,
638 l_first_action_la_code2,
639 l_remark_code1,
640 l_remark_code2);
641
642 get_from_sf52_data_elements
643 (l_assignment_id, l_effective_date,
644 l_old_basic_pay, l_old_avail_pay,
645 l_old_loc_diff, l_tot_old_sal,
646 l_old_auo_pay, l_old_adj_basic_pay,
647 l_other_pay, l_auo_premium_pay_indicator,
648 l_ap_premium_pay_indicator,
649 l_retention_allowance,
650 l_retention_allow_perc,
651 l_supervisory_differential,
652 l_supervisory_diff_perc,
653 l_staffing_differential);
654
655
656
657
658
659 l_pay_calc_in_data.person_id := p_person_id;
660 l_pay_calc_in_data.position_id := l_position_id;
661 --l_pay_calc_in_data.noa_family_code := 'SALARY_CHG';
662 l_pay_calc_in_data.noa_family_code := 'GHR_SAL_PAY_ADJ';
663 l_pay_calc_in_data.noa_code := nvl(g_first_noa_code,'894');
664 l_pay_calc_in_data.second_noa_code := null;
665 l_pay_calc_in_data.first_action_la_code1 := l_lac_sf52_rec.first_action_la_code1;
666 l_pay_calc_in_data.effective_date := l_effective_date;
667 l_pay_calc_in_data.pay_rate_determinant := l_pay_rate_determinant;
668 l_pay_calc_in_data.pay_plan := l_pay_plan;
669 l_pay_calc_in_data.grade_or_level := l_grade_or_level;
670 l_pay_calc_in_data.step_or_rate := l_step_or_rate;
671 l_pay_calc_in_data.pay_basis := l_pay_basis;
672 l_pay_calc_in_data.user_table_id := l_pay_table_id;
673 l_pay_calc_in_data.duty_station_id := l_duty_station_id;
674 l_pay_calc_in_data.auo_premium_pay_indicator := l_auo_premium_pay_indicator;
675 l_pay_calc_in_data.ap_premium_pay_indicator := l_ap_premium_pay_indicator;
676 l_pay_calc_in_data.retention_allowance := l_retention_allowance;
677 l_pay_calc_in_data.to_ret_allow_percentage := l_retention_allow_perc;
678 l_pay_calc_in_data.supervisory_differential := l_supervisory_differential;
679 l_pay_calc_in_data.staffing_differential := l_staffing_differential;
680 l_pay_calc_in_data.current_basic_pay := l_old_basic_pay;
681 --Bug 6340584
682 l_pay_calc_in_data.open_out_locality_adj := l_old_loc_diff;
683 --
684 l_pay_calc_in_data.current_adj_basic_pay := l_old_adj_basic_pay;
685 l_pay_calc_in_data.current_step_or_rate := l_step_or_rate;
686 l_pay_calc_in_data.pa_request_id := null;
687
688 ghr_msl_pkg.g_ses_msl_process := 'N';
689
690 IF l_pay_plan in ('ES','EP','IE','FE') and l_essl_table THEN
691 ghr_msl_pkg.g_ses_msl_process := 'Y';
692 l_step_or_rate := '00';
693 END IF;
694
695 BEGIN
696 ghr_pay_calc.sql_main_pay_calc (l_pay_calc_in_data
697 ,l_pay_calc_out_data
698 ,l_message_set
699 ,l_calculated);
700
701 IF l_message_set THEN
702 hr_utility.set_location( l_proc, 40);
703 l_calculated := FALSE;
704 l_mslerrbuf := hr_utility.get_message;
705 -- raise msl_error;
706 END IF;
707 EXCEPTION
708 when msl_error then
709 g_proc := 'ghr_pay_calc';
710 raise;
711 when others then
712 ----BUG 3287299 Start
713 IF ghr_pay_calc.gm_unadjusted_pay_flg = 'Y' then
714 l_comment := 'MSL:Error: Unadjusted Basic Pay must be entered in Employee record.';
715 ELSE
716 l_comment := 'MSL:Error: See process log for details.';
717 END IF;
718
719 IF upper(p_action) IN ('SHOW') THEN
720 -- Bug#2383392
721 create_mass_act_prev (
722 p_effective_date => l_effective_date,
723 p_date_of_birth => p_date_of_birth,
724 p_full_name => p_full_name,
725 p_national_identifier => p_national_identifier,
726 p_duty_station_code => l_duty_station_code,
727 p_duty_station_desc => l_duty_station_desc,
728 p_personnel_office_id => l_personnel_office_id,
729 p_basic_pay => l_old_basic_pay,
730 p_new_basic_pay => null,
731 --Bug#2383992 Added old_adj_basic_pay
732 p_adj_basic_pay => l_old_adj_basic_pay,
733 p_new_adj_basic_pay => null,
734 p_old_avail_pay => l_old_avail_pay,
735 p_new_avail_pay => null,
736 p_old_loc_diff => l_old_loc_diff,
737 p_new_loc_diff => null,
738 p_tot_old_sal => l_tot_old_sal,
739 p_tot_new_sal => null,
740 p_old_auo_pay => l_old_auo_pay,
741 p_new_auo_pay => null,
742 p_position_id => l_position_id,
743 p_position_title => l_position_title,
744 -- FWFA Changes Bug#4444609
745 p_position_number => l_position_number,
746 p_position_seq_no => l_position_seq_no,
747 -- FWFA Changes
748 p_org_structure_id => l_org_structure_id,
749 p_agency_sub_element_code => l_sub_element_code,
750 p_person_id => p_person_id,
751 p_mass_salary_id => l_mass_salary_id,
752 p_sel_flg => l_sel_flg,
753 p_first_action_la_code1 => l_first_action_la_code1,
754 p_first_action_la_code2 => l_first_action_la_code2,
755 p_remark_code1 => l_remark_code1,
756 p_remark_code2 => l_remark_code2,
757 p_grade_or_level => l_grade_or_level,
758 p_step_or_rate => l_step_or_rate,
759 p_pay_plan => l_pay_plan,
760 p_pay_rate_determinant => null,
761 p_tenure => l_tenure,
762 p_action => p_action,
763 p_assignment_id => l_assignment_id,
764 p_old_other_pay => l_other_pay,
765 p_new_other_pay => null,
766 -- Bug#2383992
767 p_old_capped_other_pay => NULL,
768 p_new_capped_other_pay => NULL,
769 p_old_retention_allowance => l_retention_allowance,
770 p_new_retention_allowance => NULL,
771 p_old_supervisory_differential => l_supervisory_differential,
772 p_new_supervisory_differential => NULL,
773 -- BUG 3377958 Madhuri
774 p_organization_name => l_org_name,
775 -- BUG 3377958 Madhuri
776 -- Bug#2383992
777 -- FWFA changes Bug#4444609
778 p_input_pay_rate_determinant => l_pay_rate_determinant,
779 p_from_pay_table_id => l_user_table_id,
780 p_to_pay_table_id => null
781 -- FWFA changes
782 );
783 END IF;
784 -- Bug#3968005 Replaced parameter l_pay_sel with l_sel_flg
785 ins_upd_per_extra_info
786 (p_person_id,l_effective_date, l_sel_flg, l_comment,p_mass_salary_id);
787 l_comment := NULL;
788 ------ BUG 3287299 End
789 hr_utility.set_location('Error in Ghr_pay_calc.sql_main_pay_calc '||
790 'Err is '||sqlerrm(sqlcode),20);
791 l_mslerrbuf := 'Error in ghr_pay_calc Sql Err is '|| sqlerrm(sqlcode);
792 g_proc := 'ghr_pay_calc';
793 raise msl_error;
794 END;
795
796 ghr_msl_pkg.g_ses_msl_process := 'N';
797
798 l_new_basic_pay := l_pay_calc_out_data.basic_pay;
799 l_new_locality_adj := l_pay_calc_out_data.locality_adj;
800 l_new_adj_basic_pay := l_pay_calc_out_data.adj_basic_pay;
801 l_new_au_overtime := l_pay_calc_out_data.au_overtime;
802 l_new_availability_pay := l_pay_calc_out_data.availability_pay;
803
804 --Added by mani related to the bug 5919694
805 l_out_pay_plan := l_pay_calc_out_data.out_to_pay_plan;
806 l_out_grade_id := l_pay_calc_out_data.out_to_grade_id;
807 l_out_grade_or_level := l_pay_calc_out_data.out_to_grade_or_level;
808
809
810 l_out_pay_rate_determinant := l_pay_calc_out_data.out_pay_rate_determinant;
811
812
813 l_out_step_or_rate := l_pay_calc_out_data.out_step_or_rate;
814 l_new_retention_allowance := l_pay_calc_out_data.retention_allowance;
815 l_new_supervisory_differential := l_supervisory_differential;
816 l_new_other_pay_amount := l_pay_calc_out_data.other_pay_amount;
817 l_entitled_other_pay := l_new_other_pay_amount;
818 if l_new_other_pay_amount = 0 then
819 l_new_other_pay_amount := null;
820 end if;
821 l_new_total_salary := l_pay_calc_out_data.total_salary;
822
823 hr_utility.set_location('retention_allowance = ' || to_char(l_retention_allowance),10);
824 hr_utility.set_location('Supervisory Diff Amount = ' || to_char(l_supervisory_differential),10);
825
826
827 -------------Call Pay cap Procedure
828 begin
829 l_capped_other_pay := ghr_pa_requests_pkg2.get_cop( p_assignment_id => l_assignment_id
830 ,p_effective_date => l_effective_date);
831 l_old_capped_other_pay := l_capped_other_pay;
832 -- Sundar Added the following if statement to improve performance
833 if hr_utility.debug_enabled = true then
834 hr_utility.set_location('Before Pay Cap ' || l_proc,21);
835 hr_utility.set_location('l_effective_date ' || l_effective_date,21);
836 hr_utility.set_location('l_out_pay_rate_determinant ' || l_out_pay_rate_determinant,21);
837 hr_utility.set_location('l_pay_plan ' || l_pay_plan,21);
838 hr_utility.set_location('l_position_id ' || to_char(l_position_id),21);
839 hr_utility.set_location('l_pay_basis ' || l_pay_basis,21);
840 hr_utility.set_location('person_id ' || to_char(p_person_id),21);
841 hr_utility.set_location('l_new_basic_pay ' || to_char(l_new_basic_pay),21);
842 hr_utility.set_location('l_new_locality_adj ' || to_char(l_new_locality_adj),21);
843 hr_utility.set_location('l_new_adj_basic_pay ' || to_char(l_new_adj_basic_pay),21);
844 hr_utility.set_location('l_new_total_salary ' || to_char(l_new_total_salary),21);
845 hr_utility.set_location('l_entitled_other_pay ' || to_char(l_entitled_other_pay),21);
846 hr_utility.set_location('l_capped_other_pay ' || to_char(l_capped_other_pay),21);
847 hr_utility.set_location('l_new_retention_allowance ' || to_char(l_new_retention_allowance),21);
848 hr_utility.set_location('l_new_supervisory_differential ' || to_char(l_new_supervisory_differential),21);
849 hr_utility.set_location('l_staffing_differential ' || to_char(l_staffing_differential),21);
850 hr_utility.set_location('l_new_au_overtime ' || to_char(l_new_au_overtime),21);
851 hr_utility.set_location('l_new_availability_pay ' || to_char(l_new_availability_pay),21);
852
853 end if;
854
855
856 ghr_pay_caps.do_pay_caps_main
857 (p_pa_request_id => null
858 ,p_effective_date => l_effective_date
859 ,p_pay_rate_determinant => nvl(l_out_pay_rate_determinant,l_pay_rate_determinant)
860 ,p_pay_plan => nvl(l_out_pay_plan,l_pay_plan)
861 ,p_to_position_id => l_position_id
862 ,p_pay_basis => l_pay_basis
863 ,p_person_id => p_person_id
864 ,p_noa_code => nvl(g_first_noa_code,'894')
865 ,p_basic_pay => l_new_basic_pay
866 ,p_locality_adj => l_new_locality_adj
867 ,p_adj_basic_pay => l_new_adj_basic_pay
868 ,p_total_salary => l_new_total_salary
869 ,p_other_pay_amount => l_entitled_other_pay
870 ,p_capped_other_pay => l_capped_other_pay
871 ,p_retention_allowance => l_new_retention_allowance
872 ,p_retention_allow_percentage => l_retention_allow_perc
873 ,p_supervisory_allowance => l_new_supervisory_differential
874 ,p_staffing_differential => l_staffing_differential
875 ,p_au_overtime => l_new_au_overtime
876 ,p_availability_pay => l_new_availability_pay
877 ,p_adj_basic_message => l_adj_basic_message
878 ,p_pay_cap_message => l_pay_cap_message
879 ,p_pay_cap_adj => l_temp_retention_allowance
880 ,p_open_pay_fields => l_open_pay_fields_caps
881 ,p_message_set => l_message_set_caps
882 ,p_total_pay_check => l_total_pay_check);
883
884
885 l_new_other_pay_amount := nvl(l_capped_other_pay,l_entitled_other_pay);
886
887 -- Sundar Added the following statement to improve performance
888 if hr_utility.debug_enabled = true then
889 hr_utility.set_location('After Pay Cap ' || l_proc,22);
890 hr_utility.set_location('l_effective_date ' || l_effective_date,22);
891 hr_utility.set_location('l_out_pay_rate_determinant ' || l_out_pay_rate_determinant,22);
892 hr_utility.set_location('l_pay_plan ' || l_pay_plan,22);
893 hr_utility.set_location('l_position_id ' || to_char(l_position_id),22);
894 hr_utility.set_location('l_pay_basis ' || l_pay_basis,22);
895 hr_utility.set_location('person_id ' || to_char(p_person_id),22);
896 hr_utility.set_location('l_new_basic_pay ' || to_char(l_new_basic_pay),22);
897 hr_utility.set_location('l_new_locality_adj ' || to_char(l_new_locality_adj),22);
898 hr_utility.set_location('l_new_adj_basic_pay ' || to_char(l_new_adj_basic_pay),22);
899 hr_utility.set_location('l_new_total_salary ' || to_char(l_new_total_salary),22);
900 hr_utility.set_location('l_entitled_other_pay ' || to_char(l_entitled_other_pay),22);
901 hr_utility.set_location('l_capped_other_pay ' || to_char(l_capped_other_pay),22);
902 hr_utility.set_location('l_new_retention_allowance ' || to_char(l_new_retention_allowance),22);
903 hr_utility.set_location('l_new_supervisory_differential ' || to_char(l_new_supervisory_differential),22);
904 hr_utility.set_location('l_staffing_differential ' || to_char(l_staffing_differential),22);
905 hr_utility.set_location('l_new_au_overtime ' || to_char(l_new_au_overtime),22);
906 hr_utility.set_location('l_new_availability_pay ' || to_char(l_new_availability_pay),22);
907 end if;
908
909 IF l_pay_cap_message THEN
910 IF nvl(l_temp_retention_allowance,0) > 0 THEN
911 l_comment := 'MSL: Exceeded Total Cap - reduce Retention Allow to '
912 || to_char(l_temp_retention_allowance);
913 -- Bug#3968005 Replaced l_pay_sel with l_sel_flg
914 l_sel_flg := 'N';
915 ELSE
916 l_comment := 'MSL: Exceeded Total cap - pls review.';
917 END IF;
918 ELSIF l_adj_basic_message THEN
919 l_comment := 'MSL: Exceeded Adjusted Pay Cap - Locality reduced.';
920 END IF;
921
922 -- Bug 2639698 Sundar
923 IF (l_old_basic_pay > l_new_basic_pay) THEN
924 l_comment_sal := 'MSL: From Basic Pay exceeds To Basic Pay.';
925 END IF;
926 -- End Bug 2639698
927
928 IF l_pay_cap_message or l_adj_basic_message THEN
929 -- Bug 2639698
930 IF (l_comment_sal IS NOT NULL) THEN
931 l_comment := l_comment_sal || ' ' || l_comment;
932 END IF;
933 -- End Bug 2639698
934 -- Bug#3968005 Replaced parameter l_pay_sel with l_sel_flg
935 ins_upd_per_extra_info
936 (p_person_id,l_effective_date, l_sel_flg, l_comment,p_mass_salary_id);
937 l_comment := NULL;
938 --------------------Bug 2639698 Sundar To add comments
939 -- Should create comments only if comments need to be inserted
940 ELSIF l_comment_sal IS NOT NULL THEN
941 -- Bug#3968005 Replaced parameter l_pay_sel with l_sel_flg
942 ins_upd_per_extra_info
943 (p_person_id,l_effective_date, l_sel_flg, l_comment_sal,p_mass_salary_id);
944 END IF;
945
946 l_comment_sal := NULL; -- bug 2639698
947 exception
948 when msl_error then
949 raise;
950 when others then
951 hr_utility.set_location('Error in ghr_pay_caps.do_pay_caps_main ' ||
952 'Err is '||sqlerrm(sqlcode),23);
953 l_mslerrbuf := 'Error in do_pay_caps_main Sql Err is '|| sqlerrm(sqlcode);
954 raise msl_error;
955 end;
956
957
958 IF upper(p_action) IN ('SHOW','REPORT') THEN
959 -- Bug#2383392
960
961
962 --6753050 modified if user manually changes position table from special
963 -- pay table identifier to '0000' then PRD should change to '0'
964 If l_pay_rate_determinant = '6' and
965 get_user_table_name(l_pay_table_id) = '0000' then
966 l_out_pay_rate_determinant := '0';
967 End If;
968 --6753050
969 create_mass_act_prev (
970 p_effective_date => l_effective_date,
971 p_date_of_birth => p_date_of_birth,
972 p_full_name => p_full_name,
973 p_national_identifier => p_national_identifier,
974 p_duty_station_code => l_duty_station_code,
975 p_duty_station_desc => l_duty_station_desc,
976 p_personnel_office_id => l_personnel_office_id,
977 p_basic_pay => l_old_basic_pay,
978 p_new_basic_pay => l_new_basic_pay,
979 --Bug#2383992 Added old_adj_basic_pay
980 p_adj_basic_pay => l_old_adj_basic_pay,
981 p_new_adj_basic_pay => l_new_adj_basic_pay,
982 p_old_avail_pay => l_old_avail_pay,
983 p_new_avail_pay => l_new_availability_pay,
984 p_old_loc_diff => l_old_loc_diff,
985 p_new_loc_diff => l_new_locality_adj,
986 p_tot_old_sal => l_tot_old_sal,
987 p_tot_new_sal => l_new_total_salary,
988 p_old_auo_pay => l_old_auo_pay,
989 p_new_auo_pay => l_new_au_overtime,
990 p_position_id => l_position_id,
991 p_position_title => l_position_title,
992 -- FWFA Changes Bug#4444609
993 p_position_number => l_position_number,
994 p_position_seq_no => l_position_seq_no,
995 -- FWFA Changes
996 p_org_structure_id => l_org_structure_id,
997 p_agency_sub_element_code => l_sub_element_code,
998 p_person_id => p_person_id,
999 p_mass_salary_id => l_mass_salary_id,
1000 p_sel_flg => l_sel_flg,
1001 p_first_action_la_code1 => l_first_action_la_code1,
1002 p_first_action_la_code2 => l_first_action_la_code2,
1003 p_remark_code1 => l_remark_code1,
1004 p_remark_code2 => l_remark_code2,
1005 p_grade_or_level => NVL(l_out_grade_or_level,l_grade_or_level),
1006 p_step_or_rate => l_step_or_rate,
1007 p_pay_plan => NVL(l_out_pay_plan,l_pay_plan),
1008 -- FWFA Changes Bug#4444609
1009 p_pay_rate_determinant => NVL(l_out_pay_rate_determinant,l_pay_rate_determinant),
1010 -- FWFA Changes
1011 p_tenure => l_tenure,
1012 p_action => p_action,
1013 p_assignment_id => l_assignment_id,
1014 p_old_other_pay => l_other_pay,
1015 p_new_other_pay => l_new_other_pay_amount,
1016 -- Bug#2383992
1017 p_old_capped_other_pay => l_old_capped_other_pay,--NULL,
1018 p_new_capped_other_pay => l_capped_other_pay,
1019 p_old_retention_allowance => l_retention_allowance,
1020 p_new_retention_allowance => l_new_retention_allowance,
1021 p_old_supervisory_differential => l_supervisory_differential,
1022 p_new_supervisory_differential => l_new_supervisory_differential,
1023 -- BUG 3377958 Madhuri
1024 p_organization_name => l_org_name,
1025 -- Bug#2383992
1026 -- FWFA Changes Bug#4444609
1027 p_input_pay_rate_determinant => l_pay_rate_determinant,
1028 p_from_pay_table_id => l_pay_calc_out_data.pay_table_id,
1029 p_to_pay_table_id => l_pay_calc_out_data.calculation_pay_table_id
1030 -- FWFA Changes
1031 );
1032 ELSIF upper(p_action) = 'CREATE' then
1033
1034 BEGIN
1035 -- Bug#5089732 Used the overloaded procedure.
1036 get_pay_plan_and_table_id
1037 (l_pay_rate_determinant,p_person_id,
1038 l_position_id,l_effective_date,
1039 l_grade_id, l_to_grade_id,l_assignment_id,'CREATE',
1040 l_pay_plan,l_to_pay_plan,l_pay_table_id,
1041 l_grade_or_level, l_to_grade_or_level, l_step_or_rate,
1042 l_pay_basis);
1043 EXCEPTION
1044 when msl_error then
1045 l_mslerrbuf := hr_utility.get_message;
1046 raise;
1047 END;
1048
1049 --6753050 modified if user manually changes position table from special
1050 -- pay table identifier to '0000' then PRD should change to '0'
1051 If l_pay_rate_determinant = '6' and
1052 get_user_table_name(l_pay_table_id) = '0000' then
1053 l_pay_rate_determinant := '0';
1054 End If;
1055 --6753050
1056
1057 assign_to_sf52_rec(
1058 p_person_id,
1059 p_first_name,
1060 p_last_name,
1061 p_middle_names,
1062 p_national_identifier,
1063 p_date_of_birth,
1064 l_effective_date,
1065 l_assignment_id,
1066 l_tenure,
1067 -- Bug#5089732
1068 NVL(l_out_grade_id,l_to_grade_id),
1069 NVL(l_out_pay_plan,l_to_pay_plan),
1070 NVL(l_out_grade_or_level,l_to_grade_or_level),
1071 -- Bug#5089732
1072 l_step_or_rate,
1073 l_annuitant_indicator,
1074 -- FWFA Changes Bug#4444609
1075 NVL(l_out_pay_rate_determinant,l_pay_rate_determinant),
1076 -- FWFA Changes
1077 l_work_schedule,
1078 l_part_time_hour,
1079 l_pos_ei_data.poei_information7, --FLSA Category
1080 l_pos_ei_data.poei_information8, --Bargaining Unit Status
1081 l_pos_ei_data.poei_information11,--Functional Class
1082 l_pos_ei_data.poei_information16,--Supervisory Status,
1083 l_new_basic_pay,
1084 l_new_locality_adj,
1085 l_new_adj_basic_pay,
1086 l_new_total_salary,
1087 l_other_pay,
1088 l_new_other_pay_amount,
1089 l_new_au_overtime,
1090 l_new_availability_pay,
1091 l_new_retention_allowance,
1092 l_retention_allow_perc,
1093 l_new_supervisory_differential,
1094 l_supervisory_diff_perc,
1095 l_staffing_differential,
1096 l_duty_station_id,
1097 l_duty_station_code,
1098 l_duty_station_desc,
1099 -- FWFA Changes Bug#4444609
1100 l_pay_rate_determinant,
1101 l_pay_calc_out_data.pay_table_id,
1102 l_pay_calc_out_data.calculation_pay_table_id,
1103 -- FWFA Changes
1104 l_lac_sf52_rec,
1105 l_sf52_rec);
1106
1107 BEGIN
1108 ghr_mass_actions_pkg.pay_calc_rec_to_sf52_rec
1109 (l_pay_calc_out_data,
1110 l_sf52_rec);
1111 EXCEPTION
1112 when others then
1113 hr_utility.set_location('Error in Ghr_mass_actions_pkg.pay_calc_rec_to_sf52_rec '||
1114 'Err is '||sqlerrm(sqlcode),20);
1115 l_mslerrbuf := 'Error in ghr_mass_act_pkg.pay_calc_to_sf52 Sql Err is '|| sqlerrm(sqlcode);
1116 raise msl_error;
1117 END;
1118
1119 BEGIN
1120 l_sf52_rec.mass_action_id := p_mass_salary_id;
1121 l_sf52_rec.rpa_type := 'MSL';
1122 g_proc := 'Create_sf52_recrod';
1123 ghr_mass_changes.create_sf52_for_mass_changes
1124 (p_mass_action_type => 'MASS_SALARY_CHG',
1125 p_pa_request_rec => l_sf52_rec,
1126 p_errbuf => l_errbuf,
1127 p_retcode => l_retcode);
1128
1129 ------ Added by Dinkar for List reports problem
1130 ---------------------------------------
1131 IF l_errbuf IS NULL THEN
1132
1133 DECLARE
1134 l_pa_request_number ghr_pa_requests.request_number%TYPE;
1135 BEGIN
1136 l_pa_request_number :=
1137 l_sf52_rec.request_number||'-'||p_mass_salary_id;
1138
1139 ghr_par_upd.upd
1140 (p_pa_request_id => l_sf52_rec.pa_request_id,
1141 p_object_version_number => l_sf52_rec.object_version_number,
1142 p_request_number => l_pa_request_number
1143 );
1144 END;
1145
1146 pr('No error in create sf52 ');
1147
1148 ghr_mto_int.log_message(
1149 p_procedure => 'Successful Completion',
1150 p_message => 'Name: '||p_full_name ||
1151 ' SSN: '|| p_national_identifier||
1152 ' Mass Salary : '||
1153 p_mass_salary ||' SF52 Successfully completed');
1154
1155 create_lac_remarks(l_pa_request_id,
1156 l_sf52_rec.pa_request_id);
1157
1158 -- Added by Enunez 11-SEP-1999
1159 IF l_lac_sf52_rec.first_action_la_code1 IS NULL THEN
1160 -- Added by Edward Nunez for 894 rules
1161 g_proc := 'Apply_894_Rules';
1162 --Bug 2012782 fix
1163 IF l_out_pay_rate_determinant IS NULL THEN
1164 l_out_pay_rate_determinant := l_pay_rate_determinant;
1165 END IF;
1166 --Bug 2012782 fix end
1167 ghr_lacs_remarks.Apply_894_Rules(
1168 l_sf52_rec.pa_request_id,
1169 l_out_pay_rate_determinant,
1170 l_pay_rate_determinant,
1171 l_out_step_or_rate,
1172 l_executive_order_number,
1173 l_executive_order_date,
1174 l_opm_issuance_number,
1175 l_opm_issuance_date,
1176 l_errbuf,
1177 l_retcode
1178 );
1179 IF l_errbuf IS NOT NULL THEN
1180 IF sqlcode = 0000 THEN
1181 l_mslerrbuf := l_mslerrbuf || '; ' || l_errbuf;
1182 ELSE
1183 l_mslerrbuf := l_mslerrbuf || ' ' || l_errbuf || ' Sql Err is: '
1184 || sqlerrm(sqlcode);
1185 END IF;
1186 RAISE msl_error;
1187 END IF;
1188 END IF; -- IF l_lac_sf52_rec.first_action_la_code1
1189 g_proc := 'update_SEL_FLG';
1190
1191 update_SEL_FLG(p_PERSON_ID,l_effective_date);
1192
1193 COMMIT;
1194 ELSE
1195 pr('Error in create sf52',l_errbuf);
1196 l_recs_failed := l_recs_failed + 1;
1197 -- Raising MSL_ERROR is not required as the process log
1198 -- was updated in ghr_mass_changes.create_sf52_for_mass_changes pkg itself.
1199 --raise msl_error;
1200 END IF; -- if l_errbuf is null then
1201 EXCEPTION
1202 WHEN msl_error then raise;
1203 WHEN others then null;
1204 l_mslerrbuf := 'Error in ghr_mass_chg.create_sf52 '||
1205 ' Sql Err is '|| sqlerrm(sqlcode);
1206 RAISE msl_error;
1207 END;
1208 END IF; -- IF upper(p_action) IN ('SHOW','REPORT') THEN
1209 END IF; -- end if for check_select_flg
1210 END IF; -- end if for p_action = 'REPORT'
1211
1212
1213 L_row_cnt := L_row_cnt + 1;
1214 IF upper(p_action) <> 'CREATE' THEN
1215 IF L_row_cnt > 50 then
1216 COMMIT;
1217 L_row_cnt := 0;
1218 END IF;
1219 END IF;
1220 EXCEPTION
1221 WHEN MSL_ERROR THEN
1222 HR_UTILITY.SET_LOCATION('Error occurred in '||l_proc||' Sql error '||sqlerrm(sqlcode),10);
1223 begin
1224 ------ BUG 3287299 -- Not to rollback for preview.
1225 if upper(p_action) <> 'SHOW' then
1226 ROLLBACK TO EXECUTE_MSL_SP;
1227 end if;
1228 EXCEPTION
1229 WHEN OTHERS THEN NULL;
1230 END;
1231 l_log_text := 'Error in '||l_proc||' '||
1232 ' For Mass Salary Name : '||p_mass_salary||
1233 'Name: '|| p_full_name || ' SSN: ' || p_national_identifier ||
1234 l_mslerrbuf;
1235 hr_utility.set_location('before creating entry in log file',10);
1236 l_recs_failed := l_recs_failed + 1;
1237 begin
1238 ghr_mto_int.log_message(
1239 p_procedure => g_proc,
1240 p_message => l_log_text);
1241 exception
1242 when others then
1243 hr_utility.set_message(8301, 'GHR_38475_ERROR_LOG_FAILURE');
1244 hr_utility.raise_error;
1245 end;
1246 when others then
1247 HR_UTILITY.SET_LOCATION('Error (Others) occurred in '||l_proc||' Sql error '||sqlerrm(sqlcode),20);
1248 BEGIN
1249 ROLLBACK TO EXECUTE_MSL_SP;
1250 EXCEPTION
1251 WHEN OTHERS THEN NULL;
1252 END;
1253 l_log_text := 'Error (others) in '||l_proc||
1254 ' For Mass Salary Name : '||p_mass_salary||
1255 'Name: '|| p_full_name || ' SSN: ' || p_national_identifier ||
1256 ' Sql Err is '||sqlerrm(sqlcode);
1257 hr_utility.set_location('before creating entry in log file',20);
1258 l_recs_failed := l_recs_failed + 1;
1259 begin
1260 ghr_mto_int.log_message(
1261 p_procedure => g_proc,
1262 p_message => l_log_text);
1263 exception
1264 when others then
1265 hr_utility.set_message(8301, 'Create Error Log failed');
1266 hr_utility.raise_error;
1267 end;
1268 END;
1269
1270 --
1271 -- msl_process END
1272
1273 --
1274 --
1275 BEGIN
1276 g_proc := 'execute_msl';
1277 hr_utility.set_location('Entering ' || l_proc,5);
1278
1279 g_first_noa_code := null;
1280 p_retcode := 0;
1281 BEGIN
1282 FOR msl IN ghr_msl (p_mass_salary_id)
1283 LOOP
1284 p_mass_salary := msl.name;
1285 l_effective_date := msl.effective_date;
1286 l_mass_salary_id := msl.mass_salary_id;
1287 l_user_table_id := msl.user_table_id;
1288 l_submit_flag := msl.submit_flag;
1289 l_executive_order_number := msl.executive_order_number;
1290 l_executive_order_date := msl.executive_order_date;
1291 l_opm_issuance_number := msl.opm_issuance_number;
1292 l_opm_issuance_date := msl.opm_issuance_date;
1293 l_pa_request_id := msl.pa_request_id;
1294 l_rowid := msl.rowid;
1295 l_p_ORGANIZATION_ID := msl.ORGANIZATION_ID;
1296 l_p_DUTY_STATION_ID := msl.DUTY_STATION_ID;
1297 l_p_PERSONNEL_OFFICE_ID := msl.PERSONNEL_OFFICE_ID;
1298 l_p_AGENCY_CODE_SUBELEMENT := msl.AGENCY_CODE_SUBELEMENT;
1299 l_process_type := msl.process_type;
1300
1301 pr('Pa request id is '||to_char(l_pa_request_id));
1302 exit;
1303 END LOOP;
1304 EXCEPTION
1305 when REC_BUSY then
1306 hr_utility.set_location('Mass Salary is in use',1);
1307 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
1308 -- raise error;
1309 hr_utility.set_message(8301, 'GHR_38477_LOCK_ON_MSL');
1310 hr_utility.raise_error;
1311 --
1312 when others then
1313 hr_utility.set_location('Error in '||l_proc||' Sql err is '||sqlerrm(sqlcode),1);
1314 -- raise_application_error(-20111,'Error while selecting from Ghr Mass Salaries');
1315 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
1316 raise msl_error;
1317 END;
1318 --Bug#5063304 Moved this cursor from execute_msl to this place.
1319 FOR c_pay_tab_essl_rec in c_pay_tab_essl
1320 LOOP
1321 l_essl_table := TRUE;
1322 EXIT;
1323 END LOOP;
1324
1325 IF l_process_type = 'P' THEN
1326
1327 hr_utility.set_location('befo perc' || l_proc,5);
1328 execute_msl_perc( p_errbuf,
1329 p_retcode,
1330 p_mass_salary_id,
1331 p_action );
1332
1333 ELSIF l_process_type = 'T' THEN
1334
1335 ghr_mlc_pkg.execute_msl_pay( p_errbuf,
1336 p_retcode,
1337 p_mass_salary_id,
1338 p_action );
1339
1340 ELSIF l_process_type = 'L' THEN
1341
1342 ghr_mlc_pkg.execute_mlc( p_errbuf,
1343 p_retcode,
1344 p_mass_salary_id,
1345 p_action );
1346
1347 ELSIF l_process_type = 'R' THEN
1348 hr_utility.set_location('befo proc' || l_proc,5);
1349 execute_msl_ses_range( p_errbuf,
1350 p_retcode,
1351 p_mass_salary_id,
1352 p_action);
1353 ELSE
1354
1355 g_effective_date := l_effective_date;
1356
1357
1358
1359 -- Bug 3315432 Madhuri
1360 --
1361 FOR pp_prd IN cur_pp_prd(p_mass_salary_id)
1362 LOOP
1363 rec_pp_prd(l_index).pay_plan := pp_prd.pay_plan;
1364 rec_pp_prd(l_index).prd := pp_prd.prd;
1365 l_index := l_index +1;
1366 END LOOP;
1367
1368 IF upper(p_action) = 'CREATE' then
1369 ghr_mto_int.set_log_program_name('GHR_MSL_PKG');
1370 ELSE
1371 ghr_mto_int.set_log_program_name('MSL_'||p_mass_salary);
1372 END IF;
1373
1374 get_lac_dtls(l_pa_request_id, l_lac_sf52_rec);
1375
1376 hr_utility.set_location('After fetch msl '||to_char(l_effective_date)||' '||to_char(l_user_table_id),20);
1377 IF l_p_ORGANIZATION_ID is not null then
1378 FOR per IN cur_people_org (l_effective_date,l_p_ORGANIZATION_ID)
1379 LOOP
1380
1381 -- Bug#5719467 Initialised the variable l_mslerrbuf to avoid ora error 6502
1382 l_mslerrbuf := NULL;
1383 -- Bug#5063304 Added the following IF Condition.
1384 IF NVL(l_p_organization_id,per.organization_id) = per.organization_id THEN
1385 FOR ast IN cur_ast (per.assignment_status_type_id) LOOP
1386 --
1387 -- Set all local variables to NULL
1388 l_personnel_office_id := NULL;
1389 l_org_structure_id := NULL;
1390 l_position_title := NULL;
1391 l_position_number := NULL;
1392 l_position_seq_no := NULL;
1393 l_sub_element_code := NULL;
1394 l_duty_station_id := NULL;
1395 l_tenure := NULL;
1396 l_annuitant_indicator := NULL;
1397 l_pay_rate_determinant := NULL;
1398 l_work_schedule := NULL;
1399 l_part_time_hour := NULL;
1400 l_to_grade_id := NULL;
1401 l_pay_plan := NULL;
1402 l_to_pay_plan := NULL;
1403 l_pay_table_id := NULL;
1404 l_grade_or_level := NULL;
1405 l_to_grade_or_level := NULL;
1406 l_step_or_rate := NULL;
1407 l_pay_basis := NULL;
1408 l_elig_flag := FALSE;
1409 --
1410 hr_utility.set_location('SSN: '||per.national_identifier,1000);
1411 BEGIN
1412 fetch_and_validate_emp(
1413 p_action => p_action
1414 ,p_mass_salary_id => p_mass_salary_id
1415 ,p_mass_salary_name => p_mass_salary
1416 ,p_full_name => per.full_name
1417 ,p_national_identifier => per.national_identifier
1418 ,p_assignment_id => per.assignment_id
1419 ,p_person_id => per.person_id
1420 ,p_position_id => per.position_id
1421 ,p_grade_id => per.grade_id
1422 ,p_business_group_id => per.business_group_id
1423 ,p_location_id => per.location_id
1424 ,p_organization_id => per.organization_id
1425 ,p_msl_organization_id => l_p_organization_id
1426 ,p_msl_duty_station_id => l_p_duty_station_id
1427 ,p_msl_personnel_office_id => l_p_personnel_office_id
1428 ,p_msl_agency_code_subelement => l_p_agency_code_subelement
1429 ,p_msl_user_table_id => l_user_table_id
1430 ,p_rec_pp_prd => rec_pp_prd
1431 ,p_personnel_office_id => l_personnel_office_id
1432 ,p_org_structure_id => l_org_structure_id
1433 ,p_position_title => l_position_title
1434 ,p_position_number => l_position_number
1435 ,p_position_seq_no => l_position_seq_no
1436 ,p_subelem_code => l_sub_element_code
1437 ,p_duty_station_id => l_duty_station_id
1438 ,p_tenure => l_tenure
1439 ,p_annuitant_indicator => l_annuitant_indicator
1440 ,p_pay_rate_determinant => l_pay_rate_determinant
1441 ,p_work_schedule => l_work_schedule
1442 ,p_part_time_hour => l_part_time_hour
1443 ,p_to_grade_id => l_to_grade_id
1444 ,p_pay_plan => l_pay_plan
1445 ,p_to_pay_plan => l_to_pay_plan
1446 ,p_pay_table_id => l_pay_table_id
1447 ,p_grade_or_level => l_grade_or_level
1448 ,p_to_grade_or_level => l_to_grade_or_level
1449 ,p_step_or_rate => l_step_or_rate
1450 ,p_pay_basis => l_pay_basis
1451 ,p_elig_flag => l_elig_flag
1452 );
1453 EXCEPTION
1454 --WHEN fetch_validate_error THEN
1455 -- l_elig_flag := FALSE;
1456 WHEN OTHERS THEN
1457 l_elig_flag := FALSE;
1458 END;
1459
1460 IF l_elig_flag THEN
1461
1462 msl_process( p_assignment_id => per.assignment_id
1463 ,p_person_id => per.person_id
1464 ,p_position_id => per.position_id
1465 ,p_grade_id => per.grade_id
1466 ,p_business_group_id => per.business_group_id
1467 ,p_location_id => per.location_id
1468 ,p_organization_id => per.organization_id
1469 ,p_date_of_birth => per.date_of_birth
1470 ,p_first_name => per.first_name
1471 ,p_last_name => per.last_name
1472 ,p_full_name => per.full_name
1473 ,p_middle_names => per.middle_names
1474 ,p_national_identifier => per.national_identifier
1475 ,p_personnel_office_id => l_personnel_office_id
1476 ,p_org_structure_id => l_org_structure_id
1477 ,p_position_title => l_position_title
1478 ,p_position_number => l_position_number
1479 ,p_position_seq_no => l_position_seq_no
1480 ,p_subelem_code => l_sub_element_code
1481 ,p_duty_station_id => l_duty_station_id
1482 ,p_tenure => l_tenure
1483 ,p_annuitant_indicator => l_annuitant_indicator
1484 ,p_pay_rate_determinant => l_pay_rate_determinant
1485 ,p_work_schedule => l_work_schedule
1486 ,p_part_time_hour => l_part_time_hour
1487 ,p_to_grade_id => l_to_grade_id
1488 ,p_pay_plan => l_pay_plan
1489 ,p_to_pay_plan => l_to_pay_plan
1490 ,p_pay_table_id => l_pay_table_id
1491 ,p_grade_or_level => l_grade_or_level
1492 ,p_to_grade_or_level => l_to_grade_or_level
1493 ,p_step_or_rate => l_step_or_rate
1494 ,p_pay_basis => l_pay_basis
1495 );
1496 END IF;
1497 END LOOP;
1498 END IF;
1499 END LOOP;
1500 ELSE
1501 FOR per IN cur_people (l_effective_date)
1502 LOOP
1503 -- Bug#5719467 Initialised the variable l_mslerrbuf to avoid ora error 6502
1504 l_mslerrbuf := NULL;
1505 FOR ast IN cur_ast (per.assignment_status_type_id)
1506 LOOP
1507 --
1508 -- Set all local variables to NULL
1509 l_personnel_office_id := NULL;
1510 l_org_structure_id := NULL;
1511 l_position_title := NULL;
1512 l_position_number := NULL;
1513 l_position_seq_no := NULL;
1514 l_sub_element_code := NULL;
1515 l_duty_station_id := NULL;
1516 l_tenure := NULL;
1517 l_annuitant_indicator := NULL;
1518 l_pay_rate_determinant := NULL;
1519 l_work_schedule := NULL;
1520 l_part_time_hour := NULL;
1521 l_to_grade_id := NULL;
1522 l_pay_plan := NULL;
1523 l_to_pay_plan := NULL;
1524 l_pay_table_id := NULL;
1525 l_grade_or_level := NULL;
1526 l_to_grade_or_level := NULL;
1527 l_step_or_rate := NULL;
1528 l_pay_basis := NULL;
1529 l_elig_flag := FALSE;
1530 --
1531 hr_utility.set_location('SSN: '||per.national_identifier,2000);
1532 BEGIN
1533 fetch_and_validate_emp(
1534 p_action => p_action
1535 ,p_mass_salary_id => p_mass_salary_id
1536 ,p_mass_salary_name => p_mass_salary
1537 ,p_full_name => per.full_name
1538 ,p_national_identifier => per.national_identifier
1539 ,p_assignment_id => per.assignment_id
1540 ,p_person_id => per.person_id
1541 ,p_position_id => per.position_id
1542 ,p_grade_id => per.grade_id
1543 ,p_business_group_id => per.business_group_id
1544 ,p_location_id => per.location_id
1545 ,p_organization_id => per.organization_id
1546 ,p_msl_organization_id => l_p_organization_id
1547 ,p_msl_duty_station_id => l_p_duty_station_id
1548 ,p_msl_personnel_office_id => l_p_personnel_office_id
1549 ,p_msl_agency_code_subelement => l_p_agency_code_subelement
1550 ,p_msl_user_table_id => l_user_table_id
1551 ,p_rec_pp_prd => rec_pp_prd
1552 ,p_personnel_office_id => l_personnel_office_id
1553 ,p_org_structure_id => l_org_structure_id
1554 ,p_position_title => l_position_title
1555 ,p_position_number => l_position_number
1556 ,p_position_seq_no => l_position_seq_no
1557 ,p_subelem_code => l_sub_element_code
1558 ,p_duty_station_id => l_duty_station_id
1559 ,p_tenure => l_tenure
1560 ,p_annuitant_indicator => l_annuitant_indicator
1561 ,p_pay_rate_determinant => l_pay_rate_determinant
1562 ,p_work_schedule => l_work_schedule
1563 ,p_part_time_hour => l_part_time_hour
1564 ,p_to_grade_id => l_to_grade_id
1565 ,p_pay_plan => l_pay_plan
1566 ,p_to_pay_plan => l_to_pay_plan
1567 ,p_pay_table_id => l_pay_table_id
1568 ,p_grade_or_level => l_grade_or_level
1569 ,p_to_grade_or_level => l_to_grade_or_level
1570 ,p_step_or_rate => l_step_or_rate
1571 ,p_pay_basis => l_pay_basis
1572 ,p_elig_flag => l_elig_flag
1573 );
1574 EXCEPTION
1575 --WHEN fetch_validate_error THEN
1576 -- l_elig_flag := FALSE;
1577 WHEN OTHERS THEN
1578 l_elig_flag := FALSE;
1579 END;
1580 IF l_elig_flag THEN
1581 msl_process( p_assignment_id => per.assignment_id
1582 ,p_person_id => per.person_id
1583 ,p_position_id => per.position_id
1584 ,p_grade_id => per.grade_id
1585 ,p_business_group_id => per.business_group_id
1586 ,p_location_id => per.location_id
1587 ,p_organization_id => per.organization_id
1588 ,p_date_of_birth => per.date_of_birth
1589 ,p_first_name => per.first_name
1590 ,p_last_name => per.last_name
1591 ,p_full_name => per.full_name
1592 ,p_middle_names => per.middle_names
1593 ,p_national_identifier => per.national_identifier
1594 ,p_personnel_office_id => l_personnel_office_id
1595 ,p_org_structure_id => l_org_structure_id
1596 ,p_position_title => l_position_title
1597 ,p_position_number => l_position_number
1598 ,p_position_seq_no => l_position_seq_no
1599 ,p_subelem_code => l_sub_element_code
1600 ,p_duty_station_id => l_duty_station_id
1601 ,p_tenure => l_tenure
1602 ,p_annuitant_indicator => l_annuitant_indicator
1603 ,p_pay_rate_determinant => l_pay_rate_determinant
1604 ,p_work_schedule => l_work_schedule
1605 ,p_part_time_hour => l_part_time_hour
1606 ,p_to_grade_id => l_to_grade_id
1607 ,p_pay_plan => l_pay_plan
1608 ,p_to_pay_plan => l_to_pay_plan
1609 ,p_pay_table_id => l_pay_table_id
1610 ,p_grade_or_level => l_grade_or_level
1611 ,p_to_grade_or_level => l_to_grade_or_level
1612 ,p_step_or_rate => l_step_or_rate
1613 ,p_pay_basis => l_pay_basis
1614 );
1615 END IF;
1616 END LOOP;
1617 END LOOP;
1618 END IF;
1619
1620 pr('After processing is over ',to_char(l_recs_failed));
1621 --Bug#4016384 Add the RG expired record count to the l_recs_failed count
1622 l_recs_failed := l_recs_failed + g_rg_recs_failed;
1623 IF (l_recs_failed = 0) THEN
1624 IF UPPER(p_action) = 'CREATE' THEN
1625 BEGIN
1626 UPDATE ghr_mass_salaries
1627 SET submit_flag = 'P'
1628 WHERE rowid = l_rowid;
1629 EXCEPTION
1630 WHEN others THEN
1631 HR_UTILITY.SET_LOCATION('Error in Update ghr_msl Sql error '||sqlerrm(sqlcode),30);
1632 hr_utility.set_message(8301, 'GHR_38476_UPD_GHR_MSL_FAILURE');
1633 hr_utility.raise_error;
1634 END;
1635 END IF;
1636 ELSE
1637 p_errbuf := 'Error in '||l_proc || ' Details in GHR_PROCESS_LOG';
1638 p_retcode := 2;
1639 IF upper(p_action) = 'CREATE' THEN
1640 UPDATE ghr_mass_salaries
1641 SET submit_flag = 'E'
1642 WHERE rowid = l_rowid;
1643 END IF;
1644 END IF;
1645 pr('Before commiting.....');
1646 COMMIT;
1647 pr('After commiting.....',to_char(l_recs_failed));
1648
1649 END IF;
1650
1651 EXCEPTION
1652 when others then
1653 HR_UTILITY.SET_LOCATION('Error (Others2) occurred in '||l_proc||' Sql error '||sqlerrm(sqlcode),30);
1654 BEGIN
1655 ROLLBACK TO EXECUTE_MSL_SP;
1656 EXCEPTION
1657 WHEN OTHERS THEN NULL;
1658 END;
1659 l_log_text := 'Error in '||l_proc||
1660 ' For Mass Salary Name : '||p_mass_salary||
1661 ' Sql Err is '||sqlerrm(sqlcode);
1662 l_recs_failed := l_recs_failed + 1;
1663 hr_utility.set_location('before creating entry in log file',30);
1664
1665 p_errbuf := 'Error in '||l_proc || ' Details in GHR_PROCESS_LOG';
1666 p_retcode := 2;
1667 IF upper(p_action) = 'CREATE' THEN
1668 UPDATE ghr_mass_salaries
1669 SET submit_flag = 'E'
1670 WHERE rowid = l_rowid;
1671 COMMIT;
1672 END IF;
1673
1674 BEGIN
1675 ghr_mto_int.log_message(
1676 p_procedure => g_proc,
1677 p_message => l_log_text);
1678 EXCEPTION
1679 WHEN others THEN
1680 hr_utility.set_message(8301, 'Create Error Log failed');
1681 hr_utility.raise_error;
1682 END;
1683
1684
1685 END EXECUTE_MSL;
1686
1687 --
1688 --
1689 --
1690
1691 -- Function returns the request id.
1692 -- This is coded as a wrapper for fnd_request.submit_request
1693 -- if all the params are passed as null, the submit request is passing all the
1694 -- params as null and so, we get wrong no of params passed error.
1695 --
1696
1697 FUNCTION submit_conc_req (P_APPLICATION IN VARCHAR2,
1698 P_PROGRAM IN VARCHAR2,
1699 P_DESCRIPTION IN VARCHAR2,
1700 P_START_TIME IN VARCHAR2,
1701 P_SUB_REQUEST IN BOOLEAN,
1702 P_ARGUMENT1 IN VARCHAR2,
1703 P_ARGUMENT2 IN VARCHAR2)
1704 RETURN NUMBER IS
1705 BEGIN
1706 return (fnd_request.submit_request(
1707 APPLICATION => p_application
1708 ,PROGRAM => p_program
1709 ,DESCRIPTION => p_description
1710 ,START_TIME => p_start_time
1711 ,SUB_REQUEST => p_sub_request
1712 ,ARGUMENT1 => p_argument1
1713 ,ARGUMENT2 => p_argument2
1714 ));
1715
1716 END submit_conc_req;
1717
1718 --
1719 --
1720 --
1721 -- Procedure Deletes all records processed by the report
1722 --
1723
1724 PROCEDURE purge_processed_recs(p_session_id in number,
1725 p_err_buf out nocopy varchar2) IS
1726 BEGIN
1727 p_err_buf := null;
1728 DELETE from ghr_mass_actions_preview
1729 WHERE mass_action_type = 'SALARY'
1730 AND session_id = p_session_id;
1731 COMMIT;
1732
1733 EXCEPTION
1734 WHEN others THEN
1735 p_err_buf := 'Sql err '|| sqlerrm(sqlcode);
1736 END;
1737
1738 -- BUG 3377958 Madhuri
1739 -- Added p_org_name to this proc for MSL form changes
1740 --
1741 PROCEDURE pop_dtls_from_pa_req(p_person_id in number,p_effective_date in date,
1742 p_mass_salary_id in number, p_org_name in varchar2) IS
1743
1744 CURSOR ghr_pa_req_cur IS
1745 SELECT EMPLOYEE_DATE_OF_BIRTH,
1746 substr(EMPLOYEE_LAST_NAME||', '||EMPLOYEE_FIRST_NAME||' '||
1747 EMPLOYEE_MIDDLE_NAMES,1,240) FULL_NAME,
1748 EMPLOYEE_NATIONAL_IDENTIFIER,
1749 DUTY_STATION_CODE,
1750 DUTY_STATION_DESC,
1751 PERSONNEL_OFFICE_ID,
1752 FROM_BASIC_PAY,
1753 TO_BASIC_PAY,
1754 --Bug#2383992
1755 FROM_ADJ_BASIC_PAY,
1756 TO_ADJ_BASIC_PAY,
1757 --Bug#2383992
1758 NULL FROM_AVAILABILITY_PAY,
1759 TO_AVAILABILITY_PAY,
1760 FROM_LOCALITY_ADJ,
1761 TO_LOCALITY_ADJ,
1762 FROM_TOTAL_SALARY,
1763 TO_TOTAL_SALARY,
1764 NULL FROM_AU_OVERTIME,
1765 TO_AU_OVERTIME,
1766 TO_POSITION_ID POSITION_ID,
1767 TO_POSITION_TITLE POSITION_TITLE,
1768 -- FWFA Changes Bug#4444609
1769 TO_POSITION_NUMBER POSITION_NUMBER,
1770 TO_POSITION_SEQ_NO POSITION_SEQ_NO,
1771 -- FWFA Changes
1772 null org_structure_id,
1773 FROM_AGENCY_CODE,
1774 PERSON_ID,
1775 -- p_mass_salary_id
1776 'Y' Sel_flag,
1777 first_action_la_code1,
1778 first_action_la_code2,
1779 NULL REMARK_CODE1,
1780 NULL REMARK_CODE2,
1781 from_grade_or_level,
1782 from_step_or_rate,
1783 from_pay_plan,
1784 PAY_RATE_DETERMINANT,
1785 TENURE,
1786 EMPLOYEE_ASSIGNMENT_ID,
1787 FROM_OTHER_PAY_AMOUNT,
1788 TO_OTHER_PAY_AMOUNT,
1789 --Bug#2383992
1790 NULL FROM_RETENTION_ALLOWANCE,
1791 TO_RETENTION_ALLOWANCE,
1792 NULL FROM_SUPERVISORY_DIFFERENTIAL,
1793 TO_SUPERVISORY_DIFFERENTIAL,
1794 NULL FROM_CAPPED_OTHER_PAY,
1795 NULL TO_CAPPED_OTHER_PAY,
1796 RPA_TYPE,
1797 -- FWFA Changes Bug#4444609
1798 input_pay_rate_determinant,
1799 from_pay_table_identifier,
1800 to_pay_table_identifier
1801 -- FWFA Changes
1802 FROM ghr_pa_requests
1803 WHERE person_id = p_person_id
1804 AND effective_date = p_effective_date
1805 -- Added by Dinkar for reports
1806 AND SUBSTR(request_number,(instr(request_number,'-')+1)) = TO_CHAR(p_mass_salary_id)
1807 AND first_noa_code = nvl(g_first_noa_code,'894');
1808
1809 -- Bug#3964284 Added the following cursor to get the custom percentage.
1810 CURSOR ghr_mass_percent(p_pay_plan VARCHAR2,
1811 p_grade VARCHAR2,
1812 p_prd NUMBER,
1813 p_msl_id NUMBER
1814 ) IS
1815 SELECT ext.increase_percent percent
1816 FROM ghr_mass_salary_criteria criteria, ghr_mass_salary_criteria_ext ext
1817 WHERE criteria.mass_salary_id = p_msl_id
1818 AND criteria.mass_salary_criteria_id=ext.mass_salary_criteria_id
1819 AND criteria.pay_plan = p_pay_plan
1820 AND criteria.PAY_RATE_DETERMINANT = p_prd
1821 And ext.GRADE = p_grade;
1822
1823 l_proc varchar2(72) := g_package || '.pop_dtls_from_pa_req';
1824 l_sel_flag VARCHAR2(3) := NULL;
1825 l_comments VARCHAR2(150) := NULL;
1826 l_increase_percent ghr_mass_actions_preview.increase_percent%type;
1827 l_ses_basic_pay ghr_mass_actions_preview.to_basic_pay%type;
1828
1829 BEGIN
1830 g_proc := 'pop_dtls_from_pa_req';
1831
1832 hr_utility.set_location('Entering ' || l_proc,5);
1833 FOR pa_req_rec in ghr_pa_req_cur
1834 LOOP
1835 -- To calculate percent increase from From Pay and To Pay if rpa_type = 'MPC'.
1836 IF pa_req_rec.rpa_type = 'MPC' THEN
1837 -- Bug#3964284 Get the customized increase percent from History using get_extra_info_comments procedure.
1838 -- If the value is NULL THEN
1839 -- Get the value from the table ghr_mass_salary_criteria_ext.
1840 -- End If;
1841 get_extra_info_comments
1842 (p_person_id => p_person_id,
1843 p_effective_date => p_effective_date,
1844 p_sel_flag => l_sel_flag,
1845 p_comments => l_comments,
1846 p_mass_salary_id => p_mass_salary_id,
1847 p_increase_percent => l_increase_percent,
1848 p_ses_basic_pay => l_ses_basic_pay);
1849
1850 IF l_increase_percent is NULL THEN
1851 For cur in ghr_mass_percent(pa_req_rec.from_pay_plan,
1852 pa_req_rec.from_grade_or_level,
1853 pa_req_rec.pay_rate_determinant,
1854 p_mass_salary_id)
1855 LOOP
1856 l_increase_percent := cur.percent;
1857 END LOOP;
1858 END IF;
1859 ELSE
1860 l_increase_percent := NULL;
1861 END IF;
1862
1863 create_mass_act_prev (
1864 p_effective_date => p_effective_date,
1865 p_date_of_birth => pa_req_rec.employee_date_of_birth,
1866 p_full_name => pa_req_rec.full_name,
1867 p_national_identifier => pa_req_rec.employee_national_identifier,
1868 p_duty_station_code => pa_req_rec.duty_station_code,
1869 p_duty_station_desc => pa_req_rec.duty_station_desc,
1870 p_personnel_office_id => pa_req_rec.personnel_office_id,
1871 p_basic_pay =>pa_req_rec.from_basic_pay,
1872 p_new_basic_pay => pa_req_rec.to_basic_pay,
1873 --Bug#2383992 Added old_adj_basic_pay
1874 p_adj_basic_pay => pa_req_rec.from_adj_basic_pay,
1875 p_new_adj_basic_pay => pa_req_rec.to_adj_basic_pay,
1876 p_old_avail_pay => pa_req_rec.from_availability_pay,
1877 p_new_avail_pay => pa_req_rec.to_availability_pay,
1878 p_old_loc_diff => pa_req_rec.from_locality_adj,
1879 p_new_loc_diff => pa_req_rec.to_locality_adj,
1880 p_tot_old_sal => pa_req_rec.from_total_salary,
1881 p_tot_new_sal => pa_req_rec.to_total_salary,
1882 p_old_auo_pay => pa_req_rec.from_au_overtime,
1883 p_new_auo_pay => pa_req_rec.to_au_overtime,
1884 p_position_id => pa_req_rec.position_id,
1885 p_position_title => pa_req_rec.position_title,
1886 -- FWFA Changes Bug#4444609
1887 p_position_number => pa_req_rec.position_number,
1888 p_position_seq_no => pa_req_rec.position_seq_no,
1889 -- FWFA Changes
1890 p_org_structure_id => pa_req_rec.org_structure_id,
1891 p_agency_sub_element_code => pa_req_rec.from_agency_code,
1892 p_person_id => pa_req_rec.person_id,
1893 p_mass_salary_id => p_mass_salary_id,
1894 p_sel_flg => 'Y', --- Sel flag
1895 p_first_action_la_code1 => pa_req_rec.first_action_la_code1,
1896 p_first_action_la_code2 => pa_req_rec.first_action_la_code2,
1897 p_remark_code1 => pa_req_rec.remark_code1, --- will be null
1898 p_remark_code2 => pa_req_rec.remark_code2, --- will be null
1899 p_grade_or_level => pa_req_rec.from_grade_or_level,
1900 p_step_or_rate => pa_req_rec.from_step_or_rate,
1901 p_pay_plan => pa_req_rec.from_pay_plan,
1902 p_pay_rate_determinant => pa_req_rec.pay_rate_determinant,
1903 p_tenure => pa_req_rec.tenure,
1904 p_action => 'REPORT',
1905 p_assignment_id => pa_req_rec.employee_assignment_id,
1906 p_old_other_pay => pa_req_rec.from_other_pay_amount,
1907 p_new_other_pay => pa_req_rec.to_other_pay_amount,
1908 -- Bug#2383992
1909 p_old_capped_other_pay => pa_req_rec.from_capped_other_pay,
1910 p_new_capped_other_pay => pa_req_rec.to_capped_other_pay,
1911 p_old_retention_allowance => pa_req_rec.from_retention_allowance,
1912 p_new_retention_allowance => pa_req_rec.to_retention_allowance,
1913 p_old_supervisory_differential => pa_req_rec.from_supervisory_differential,
1914 p_new_supervisory_differential => pa_req_rec.to_supervisory_differential,
1915 -- BUG 3377958 Madhuri
1916 p_organization_name => p_org_name,
1917 p_increase_percent => l_increase_percent,
1918 -- Bug#2383992
1919 -- FWFA Changes Bug#4444609
1920 p_input_pay_rate_determinant => pa_req_rec.input_pay_rate_determinant,
1921 p_from_pay_table_id => pa_req_rec.from_pay_table_identifier,
1922 p_to_pay_table_id => pa_req_rec.to_pay_table_identifier
1923 -- FWFA Changes
1924 );
1925 exit;
1926 END LOOP;
1927 hr_utility.set_location('Exiting ' || l_proc,10);
1928 exception
1929 when msl_error then raise;
1930 when others then
1931 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
1932 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
1933 raise msl_error;
1934 end pop_dtls_from_pa_req;
1935
1936
1937 --
1938 --
1939 --
1940
1941 function check_select_flg_msl_perc(p_person_id in number,
1942 p_action in varchar2,
1943 p_effective_date in date,
1944 p_mass_salary_id in number,
1945 p_sel_flg in out nocopy varchar2,
1946 p_increase_percent in out nocopy number
1947 )
1948 return boolean IS
1949
1950 l_per_ei_data per_people_extra_info%rowtype;
1951 l_comments varchar2(250);
1952 l_sel_flag varchar2(3);
1953 l_line number := 0;
1954 l_proc varchar2(72) := g_package || '.check_select_flg_msl_perc';
1955 l_increase_percent ghr_mass_actions_preview.increase_percent%type; -- Added by Sundar 3843306
1956 l_ses_basic_pay ghr_mass_actions_preview.to_basic_pay%type;
1957 l_temp_increase_percent number;
1958 begin
1959
1960 g_proc := 'check_select_flg_msl_perc';
1961 l_temp_increase_percent := p_increase_percent;
1962
1963 hr_utility.set_location('Entering ' || l_proc,5);
1964
1965 l_line := 5;
1966 get_extra_info_comments(p_person_id,p_effective_date,l_sel_flag,l_comments,p_mass_salary_id,l_increase_percent,l_ses_basic_pay); -- Added by Sundar 3843306
1967
1968 --------- Initialize the comments
1969 -- Sundar 3337361 Included GM Error, To basic pay < From basic pay in the condition
1970 -- Now all the messages have MSL as a prefix. Rest of the conditions are alo
1971 -- included for the old records which may still have old message.
1972 IF l_comments is not null THEN
1973 --Bug#4093705 Added ltrim function to verify the System generated Comments as few comments
1974 -- might start with Blank Spaces. Removed NVL condition as control comes here
1975 -- only when l_comments has Non Null value.
1976 IF substr(ltrim(l_comments),1,8) = 'Exceeded'
1977 OR substr(ltrim(l_comments),1,3) = 'MSL'
1978 OR substr(ltrim(l_comments),1,5) = 'Error'
1979 OR substr(ltrim(l_comments),1,13) = 'The From Side'
1980 THEN
1981 ins_upd_per_extra_info
1982 (p_person_id,p_effective_date, l_sel_flag, null,p_mass_salary_id,l_increase_percent);
1983 END IF;
1984 END IF;
1985 -- Bug 3843306 If Increase percent is entered from Preview screen, the same should be retrieved
1986 -- and not the one entered in Grade screen.
1987
1988 IF l_increase_percent IS NOT NULL THEN
1989 p_increase_percent := l_increase_percent;
1990 END IF;
1991
1992 IF p_increase_percent = 0 THEN
1993 l_sel_flag := 'N';
1994 END IF;
1995
1996 l_line := 10;
1997 if l_sel_flag is null then
1998 p_sel_flg := 'Y';
1999 else
2000 p_sel_flg := l_sel_flag;
2001 end if;
2002
2003 l_line := 15;
2004 if p_action IN ('SHOW','REPORT') THEN
2005 return TRUE;
2006 elsif p_action = 'CREATE' THEN
2007 if p_sel_flg = 'Y' THEN
2008 return TRUE;
2009 else
2010 return FALSE;
2011 end if;
2012 end if;
2013 exception
2014 when msl_error then raise;
2015 when others then
2016 p_increase_percent := l_temp_increase_percent ;
2017 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
2018 l_mslerrbuf := 'Error in '||l_proc||' @'||to_char(l_line)||' Sql Err is '|| sqlerrm(sqlcode);
2019 raise msl_error;
2020 end;
2021
2022 --
2023 --
2024 --
2025 function check_select_flg(p_person_id in number,
2026 p_action in varchar2,
2027 p_effective_date in date,
2028 p_mass_salary_id in number,
2029 p_sel_flg in out nocopy varchar2
2030 )
2031 return boolean IS
2032
2033 l_per_ei_data per_people_extra_info%rowtype;
2034 l_comments varchar2(250);
2035 l_sel_flag varchar2(3);
2036 l_line number := 0;
2037 l_temp NUMBER;
2038 l_ses_basic_pay ghr_mass_actions_preview.to_basic_pay%type;
2039
2040 l_proc varchar2(72) := g_package || '.check_select_flg';
2041 begin
2042
2043 g_proc := 'check_select_flg';
2044
2045 hr_utility.set_location('Entering ' || l_proc,5);
2046
2047 l_line := 5;
2048 get_extra_info_comments(p_person_id,p_effective_date,l_sel_flag,l_comments,p_mass_salary_id,l_temp,l_ses_basic_pay);
2049
2050 --------- Initialize the comments
2051 -- Sundar 3337361 Included GM Error, To basic pay < From basic pay in the condition
2052 -- Now all the messages have MSL as a prefix. Rest of the conditions are alo
2053 -- included for the old records which may still have old message.
2054 IF l_comments is not null THEN
2055 IF substr(nvl(l_comments,'@#%'),1,8) = 'Exceeded'
2056 OR substr(nvl(l_comments,'@#%'),1,3) = 'MSL'
2057 OR substr(nvl(l_comments,'@#%'),1,5) = 'Error'
2058 OR substr(nvl(l_comments,'@#%'),1,13) = 'The From Side'
2059 THEN
2060 ins_upd_per_extra_info
2061 (p_person_id,p_effective_date, l_sel_flag, null,p_mass_salary_id);
2062 END IF;
2063 END IF;
2064 ---------
2065
2066
2067 l_line := 10;
2068 if l_sel_flag is null then
2069 p_sel_flg := 'Y';
2070 else
2071 p_sel_flg := l_sel_flag;
2072 end if;
2073
2074 l_line := 15;
2075 if p_action IN ('SHOW','REPORT') THEN
2076 return TRUE;
2077 elsif p_action = 'CREATE' THEN
2078 if p_sel_flg = 'Y' THEN
2079 return TRUE;
2080 else
2081 return FALSE;
2082 end if;
2083 end if;
2084 exception
2085 when msl_error then raise;
2086 when others then
2087 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
2088 l_mslerrbuf := 'Error in '||l_proc||' @'||to_char(l_line)||' Sql Err is '|| sqlerrm(sqlcode);
2089 raise msl_error;
2090 end;
2091
2092
2093 --
2094 --
2095 --
2096
2097
2098 procedure purge_old_data (p_mass_salary_id in number) is
2099 l_proc varchar2(72) := g_package || '.purge_old_data';
2100 BEGIN
2101 g_proc := 'purge_old_data';
2102
2103 hr_utility.set_location('Entering ' || l_proc,5);
2104 delete from ghr_mass_actions_preview
2105 where mass_action_type = 'SALARY'
2106 and session_id = p_mass_salary_id;
2107 commit;
2108 hr_utility.set_location('Exiting ' || l_proc,10);
2109 exception
2110 when msl_error then raise;
2111 when others then
2112 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
2113 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
2114 raise msl_error;
2115 END;
2116
2117 --
2118 --
2119 --
2120
2121 PROCEDURE get_pay_plan_and_table_id (p_prd in varchar2,
2122 p_person_id in number,
2123 p_position_id in per_assignments_f.position_id%type,
2124 p_effective_date in date,
2125 p_grade_id in per_assignments_f.grade_id%type,
2126 p_assignment_id in per_assignments_f.assignment_id%type,
2127 p_action in varchar2,
2128 p_pay_plan out nocopy varchar2,
2129 p_pay_table_id out nocopy number,
2130 p_grade_or_level out nocopy varchar2,
2131 p_step_or_rate out nocopy varchar2,
2132 p_pay_basis out nocopy varchar2) is
2133
2134 p_person_extra_info_id number;
2135 ----p_locality_percent number; --- AVR 12/08/98
2136
2137 l_pos_ei_data per_position_extra_info%rowtype;
2138 l_asg_ei_data per_assignment_extra_info%rowtype;
2139
2140 cursor c_grade_kff (grd_id number) is
2141 select gdf.segment1
2142 ,gdf.segment2
2143 from per_grades grd,
2144 per_grade_definitions gdf
2145 where grd.grade_id = grd_id
2146 and grd.grade_definition_id = gdf.grade_definition_id;
2147
2148 l_retained_grade_rec ghr_pay_calc.retained_grade_rec_type;
2149 l_proc varchar2(72) := g_package || '.get_pay_plan_and_table_id';
2150 l_line number := 0;
2151 l_check_grade_retention VARCHAR2(200);
2152 BEGIN
2153 g_proc := 'get_pay_plan_and_table_id';
2154 hr_utility.set_location('Entering ' || l_proc,5);
2155 ghr_mre_pkg.pr('Entering ',l_proc,'ACTION '||p_action);
2156 -- Bug# 4126137,4179270,4086677
2157 l_check_grade_retention := CHECK_GRADE_RETENTION(P_PRD,P_PERSON_ID,P_EFFECTIVE_DATE);
2158
2159 IF p_action = 'CREATE' THEN
2160
2161 l_line := 10;
2162 FOR c_grade_kff_rec IN c_grade_kff (p_grade_id)
2163 LOOP
2164 p_pay_plan := c_grade_kff_rec.segment1;
2165 p_grade_or_level := c_grade_kff_rec.segment2;
2166 exit;
2167 end loop;
2168
2169 l_line := 20;
2170 hr_utility.set_location('Got grade or level and pay plan',2);
2171 ghr_mre_pkg.pr('Got grade or level and pay plan');
2172
2173 ghr_history_fetch.fetch_positionei
2174 (p_position_id => p_position_id
2175 ,p_information_type => 'GHR_US_POS_VALID_GRADE'
2176 ,p_date_effective => p_effective_date
2177 ,p_pos_ei_data => l_pos_ei_data
2178 );
2179
2180 l_line := 30;
2181 P_PAY_table_id := l_pos_ei_data.poei_information5;
2182 P_PAY_BASIS := l_pos_ei_data.poei_information6;
2183
2184 ghr_mre_pkg.pr(' Before fetch asgei', to_char(p_assignment_id));
2185
2186 ghr_history_fetch.fetch_asgei
2187 (p_assignment_id => p_assignment_id
2188 ,p_information_type => 'GHR_US_ASG_SF52'
2189 ,p_date_effective => p_effective_date
2190 ,p_asg_ei_data => l_asg_ei_data
2191 );
2192
2193 l_line := 40;
2194 p_step_or_rate := l_asg_ei_data.aei_information3;
2195
2196 ELSIF l_check_grade_retention = 'REGULAR' THEN
2197 hr_utility.set_location('Grade retention is regular',1);
2198
2199 ghr_mre_pkg.pr('Grade retention is regular',1);
2200
2201 FOR c_grade_kff_rec IN c_grade_kff (p_grade_id)
2202 LOOP
2203 p_pay_plan := c_grade_kff_rec.segment1;
2204 p_grade_or_level := c_grade_kff_rec.segment2;
2205 exit;
2206 end loop;
2207
2208 hr_utility.set_location('Got grade or level and pay plan',2);
2209
2210 ghr_mre_pkg.pr('Got grade or level and pay plan',2);
2211
2212 l_line := 50;
2213 ghr_history_fetch.fetch_positionei
2214 (p_position_id => p_position_id
2215 ,p_information_type => 'GHR_US_POS_VALID_GRADE'
2216 ,p_date_effective => p_effective_date
2217 ,p_pos_ei_data => l_pos_ei_data
2218 );
2219
2220 P_PAY_table_id := l_pos_ei_data.poei_information5;
2221 P_PAY_BASIS := l_pos_ei_data.poei_information6;
2222
2223 l_line := 60;
2224
2225 ghr_mre_pkg.pr('before fetch asgei 2 ',to_char(p_assignment_id));
2226
2227 ghr_history_fetch.fetch_asgei
2228 (p_assignment_id => p_assignment_id
2229 ,p_information_type => 'GHR_US_ASG_SF52'
2230 ,p_date_effective => p_effective_date
2231 ,p_asg_ei_data => l_asg_ei_data
2232 );
2233 p_step_or_rate := l_asg_ei_data.aei_information3;
2234
2235 l_line := 70;
2236 ELSIF l_check_grade_retention = 'RETAIN' THEN
2237 --
2238 -- get retained details
2239 --
2240 hr_utility.set_location('Before get retained grade',4);
2241
2242 l_line := 80;
2243 ghr_mre_pkg.pr('Retained prd ',P_PRD);
2244
2245 ghr_mre_pkg.pr('before get retained grade 2 ',to_char(p_person_id));
2246
2247 BEGIN
2248 l_retained_grade_rec :=
2249 ghr_pc_basic_pay.get_retained_grade_details
2250 ( p_person_id,
2251 p_effective_date);
2252 p_person_extra_info_id := l_retained_grade_rec.person_extra_info_id;
2253 p_pay_plan := l_retained_grade_rec.pay_plan;
2254 p_grade_or_level := l_retained_grade_rec.grade_or_level;
2255 p_step_or_rate := l_retained_grade_rec.step_or_rate;
2256 p_pay_basis := l_retained_grade_rec.pay_basis;
2257 p_pay_table_id := l_retained_grade_rec.user_table_id;
2258 -- p_locality_percent := l_retained_grade_rec.locality_percent; --AVR 12/08/98
2259 EXCEPTION
2260 WHEN ghr_pay_calc.pay_calc_message THEN
2261 IF p_action = 'CREATE' THEN
2262 l_mslerrbuf := 'Error in Get retained grade for Person ID'||
2263 to_char(p_person_id)||
2264 'Error is '||' Sql Err is '|| sqlerrm(sqlcode);
2265 ghr_mre_pkg.pr('Person id '||to_char(p_person_id),'ERROR 1',l_mslerrbuf);
2266 raise msl_error;
2267 END IF;
2268 WHEN others THEN
2269 l_mslerrbuf := 'Others error in Get retained grade '||
2270 'Error is '||' Sql Err is '|| sqlerrm(sqlcode);
2271 ghr_mre_pkg.pr('Person ID '||to_char(p_person_id),'ERROR 2',l_mslerrbuf);
2272 raise msl_error;
2273 END;
2274 l_line := 90;
2275 -- Bug#4179270,4126137,4086677 Added the following ELSIF Condition.
2276 ELSIF l_check_grade_retention ='MSL_ERROR' THEN
2277 hr_utility.set_message(8301,'GHR_38927_MISSING_MA_RET_DET');
2278 raise msl_error;
2279 ELSIF l_check_grade_retention = 'OTHER_ERROR' THEN
2280 l_mslerrbuf := 'Others error in check_grade_retention function while fetching retained grade record. Please
2281 verify the retained grade record';
2282 raise msl_error;
2283 END IF;
2284 hr_utility.set_location('Exiting ' || l_proc,10);
2285 l_line := 100;
2286 EXCEPTION
2287 when msl_error then raise;
2288 when others then
2289 raise msl_error;
2290 END get_pay_plan_and_table_id;
2291
2292 --
2293 --
2294
2295 -- Bug#5089732 Added p_to_grade_id,p_to_pay_plan, p_to_grade_or_level parameters.
2296 PROCEDURE get_pay_plan_and_table_id (p_prd in varchar2,
2297 p_person_id in number,
2298 p_position_id in per_assignments_f.position_id%type,
2299 p_effective_date in date,
2300 p_grade_id in per_assignments_f.grade_id%type,
2301 p_to_grade_id out nocopy per_assignments_f.grade_id%type,
2302 p_assignment_id in per_assignments_f.assignment_id%type,
2303 p_action in varchar2,
2304 p_pay_plan out nocopy varchar2,
2305 p_to_pay_plan out nocopy varchar2,
2306 p_pay_table_id out nocopy number,
2307 p_grade_or_level out nocopy varchar2,
2308 p_to_grade_or_level out nocopy varchar2,
2309 p_step_or_rate out nocopy varchar2,
2310 p_pay_basis out nocopy varchar2) is
2311
2312 p_person_extra_info_id number;
2313 --p_locality_percent number; --- AVR 12/08/98
2314
2315 l_pos_ei_data per_position_extra_info%rowtype;
2316 l_asg_ei_data per_assignment_extra_info%rowtype;
2317
2318
2319 cursor c_grade_kff (grd_id number) is
2320 select gdf.segment1
2321 ,gdf.segment2
2322 from per_grades grd,
2323 per_grade_definitions gdf
2324 where grd.grade_id = grd_id
2325 and grd.grade_definition_id = gdf.grade_definition_id;
2326
2327 l_retained_grade_rec ghr_pay_calc.retained_grade_rec_type;
2328 l_proc varchar2(72) := g_package || '.get_pay_plan_and_table_id';
2329 l_line number := 0;
2330 l_check_grade_retention VARCHAR2(200);
2331 BEGIN
2332 g_proc := 'get_pay_plan_and_table_id';
2333 hr_utility.set_location('Entering ' || l_proc,5);
2334 ghr_mre_pkg.pr('Entering ',l_proc,'ACTION '||p_action);
2335 -- Bug# 4126137,4179270,4086677
2336 l_check_grade_retention := CHECK_GRADE_RETENTION(P_PRD,P_PERSON_ID,P_EFFECTIVE_DATE);
2337
2338 IF p_action = 'CREATE' THEN
2339
2340 l_line := 10;
2341 FOR c_grade_kff_rec IN c_grade_kff (p_grade_id)
2342 LOOP
2343 p_pay_plan := c_grade_kff_rec.segment1;
2344 p_grade_or_level := c_grade_kff_rec.segment2;
2345 exit;
2346 end loop;
2347
2348 l_line := 20;
2349 hr_utility.set_location('Got grade or level and pay plan',2);
2350 ghr_mre_pkg.pr('Got grade or level and pay plan');
2351
2352 ghr_history_fetch.fetch_positionei
2353 (p_position_id => p_position_id
2354 ,p_information_type => 'GHR_US_POS_VALID_GRADE'
2355 ,p_date_effective => p_effective_date
2356 ,p_pos_ei_data => l_pos_ei_data
2357 );
2358
2359 l_line := 30;
2360 -- Bug#5089732 Added the cursor to fetch the pay plan as on effective date.
2361 p_to_grade_id := l_pos_ei_data.poei_information3;
2362 FOR c_grade_kff_rec IN c_grade_kff (p_to_grade_id)
2363 LOOP
2364 p_to_pay_plan := c_grade_kff_rec.segment1;
2365 p_to_grade_or_level := c_grade_kff_rec.segment2;
2366 exit;
2367 END LOOP;
2368 -- Pass the position pay plan, grade or level as output for comparison, pay calculation.
2369 IF p_to_pay_plan <> p_pay_plan THEN
2370 p_pay_plan := p_to_pay_plan;
2371 p_grade_or_level := p_to_grade_or_level;
2372 END IF;
2373
2374 P_PAY_table_id := l_pos_ei_data.poei_information5;
2375 P_PAY_BASIS := l_pos_ei_data.poei_information6;
2376
2377 ghr_mre_pkg.pr(' Before fetch asgei', to_char(p_assignment_id));
2378
2379 ghr_history_fetch.fetch_asgei
2380 (p_assignment_id => p_assignment_id
2381 ,p_information_type => 'GHR_US_ASG_SF52'
2382 ,p_date_effective => p_effective_date
2383 ,p_asg_ei_data => l_asg_ei_data
2384 );
2385
2386 l_line := 40;
2387 p_step_or_rate := l_asg_ei_data.aei_information3;
2388
2389 ELSIF l_check_grade_retention = 'REGULAR' THEN
2390 hr_utility.set_location('Grade retention is regular',1);
2391
2392 ghr_mre_pkg.pr('Grade retention is regular',1);
2393
2394 FOR c_grade_kff_rec IN c_grade_kff (p_grade_id)
2395 LOOP
2396 p_pay_plan := c_grade_kff_rec.segment1;
2397 p_grade_or_level := c_grade_kff_rec.segment2;
2398 exit;
2399 end loop;
2400
2401 hr_utility.set_location('Got grade or level and pay plan',2);
2402
2403 ghr_mre_pkg.pr('Got grade or level and pay plan',2);
2404
2405 l_line := 50;
2406 ghr_history_fetch.fetch_positionei
2407 (p_position_id => p_position_id
2408 ,p_information_type => 'GHR_US_POS_VALID_GRADE'
2409 ,p_date_effective => p_effective_date
2410 ,p_pos_ei_data => l_pos_ei_data
2411 );
2412 -- Bug#5089732 Added the cursor to fetch the pay plan as on effective date.
2413 p_to_grade_id := l_pos_ei_data.poei_information3;
2414 FOR c_grade_kff_rec IN c_grade_kff (p_to_grade_id)
2415 LOOP
2416 p_to_pay_plan := c_grade_kff_rec.segment1;
2417 p_to_grade_or_level := c_grade_kff_rec.segment2;
2418 exit;
2419 end loop;
2420 -- Pass the position pay plan, grade or level as output for comparison, pay calculation.
2421 IF p_to_pay_plan <> p_pay_plan THEN
2422 p_pay_plan := p_to_pay_plan;
2423 p_grade_or_level := p_to_grade_or_level;
2424 END IF;
2425 P_PAY_table_id := l_pos_ei_data.poei_information5;
2426 P_PAY_BASIS := l_pos_ei_data.poei_information6;
2427
2428 l_line := 60;
2429
2430 ghr_mre_pkg.pr('before fetch asgei 2 ',to_char(p_assignment_id));
2431
2432 ghr_history_fetch.fetch_asgei
2433 (p_assignment_id => p_assignment_id
2434 ,p_information_type => 'GHR_US_ASG_SF52'
2435 ,p_date_effective => p_effective_date
2436 ,p_asg_ei_data => l_asg_ei_data
2437 );
2438 p_step_or_rate := l_asg_ei_data.aei_information3;
2439
2440 l_line := 70;
2441 ELSIF l_check_grade_retention = 'RETAIN' THEN
2442 --
2443 -- get retained details
2444 --
2445 hr_utility.set_location('Before get retained grade',4);
2446
2447 l_line := 80;
2448 ghr_mre_pkg.pr('Retained prd ',P_PRD);
2449
2450 ghr_mre_pkg.pr('before get retained grade 2 ',to_char(p_person_id));
2451
2452 BEGIN
2453 l_retained_grade_rec :=
2454 ghr_pc_basic_pay.get_retained_grade_details
2455 ( p_person_id,
2456 p_effective_date);
2457 p_person_extra_info_id := l_retained_grade_rec.person_extra_info_id;
2458 p_pay_plan := l_retained_grade_rec.pay_plan;
2459 p_grade_or_level := l_retained_grade_rec.grade_or_level;
2460 p_step_or_rate := l_retained_grade_rec.step_or_rate;
2461 p_pay_basis := l_retained_grade_rec.pay_basis;
2462 p_pay_table_id := l_retained_grade_rec.user_table_id;
2463 -- p_locality_percent := l_retained_grade_rec.locality_percent; --AVR 12/08/98
2464 EXCEPTION
2465 WHEN ghr_pay_calc.pay_calc_message THEN
2466 IF p_action = 'CREATE' THEN
2467 l_mslerrbuf := 'Error in Get retained grade for Person ID'||
2468 to_char(p_person_id)||
2469 'Error is '||' Sql Err is '|| sqlerrm(sqlcode);
2470 ghr_mre_pkg.pr('Person id '||to_char(p_person_id),'ERROR 1',l_mslerrbuf);
2471 raise msl_error;
2472 END IF;
2473 WHEN others THEN
2474 l_mslerrbuf := 'Others error in Get retained grade '||
2475 'Error is '||' Sql Err is '|| sqlerrm(sqlcode);
2476 ghr_mre_pkg.pr('Person ID '||to_char(p_person_id),'ERROR 2',l_mslerrbuf);
2477 raise msl_error;
2478 END;
2479 l_line := 85;
2480 -- Bug#5089732 Pass the to to position pay plan, grade, grade_id also.
2481 p_to_grade_id := p_grade_id;
2482 FOR c_grade_kff_rec IN c_grade_kff (p_to_grade_id)
2483 LOOP
2484 p_to_pay_plan := c_grade_kff_rec.segment1;
2485 p_to_grade_or_level := c_grade_kff_rec.segment2;
2486 exit;
2487 END LOOP;
2488 l_line := 90;
2489 -- Bug#4179270,4126137,4086677 Added the following ELSIF Condition.
2490 ELSIF l_check_grade_retention ='MSL_ERROR' THEN
2491 hr_utility.set_message(8301,'GHR_38927_MISSING_MA_RET_DET');
2492 raise msl_error;
2493 ELSIF l_check_grade_retention = 'OTHER_ERROR' THEN
2494 l_mslerrbuf := 'Others error in check_grade_retention function while fetching retained grade record. Please
2495 verify the retained grade record';
2496 raise msl_error;
2497 END IF;
2498 hr_utility.set_location('Exiting ' || l_proc,10);
2499 l_line := 100;
2500 EXCEPTION
2501 when msl_error then raise;
2502 when others then
2503 raise msl_error;
2504 END get_pay_plan_and_table_id;
2505
2506 --
2507 --
2508
2509 procedure update_sel_flg (p_person_id in number,p_effective_date date) is
2510
2511 l_person_extra_info_id number;
2512 l_object_version_number number;
2513 l_per_ei_data per_people_extra_info%rowtype;
2514 l_proc varchar2(72) := g_package || '.update_sel_flg';
2515 l_ind number := 1;
2516 begin
2517 g_proc := 'update_sel_flg';
2518 hr_utility.set_location('Entering ' || l_proc,5);
2519 pr('Inside '||l_proc,to_char(p_person_id));
2520 l_ind := 10;
2521 ghr_history_fetch.fetch_peopleei
2522 (p_person_id => p_person_id
2523 ,p_information_type => 'GHR_US_PER_MASS_ACTIONS'
2524 ,p_date_effective => p_effective_date
2525 ,p_per_ei_data => l_per_ei_data);
2526
2527 l_ind := 20;
2528 l_person_extra_info_id := l_per_ei_data.person_extra_info_id;
2529 l_object_version_number := l_per_ei_data.object_version_number;
2530
2531 if l_person_extra_info_id is not null then
2532 ghr_person_extra_info_api.update_person_extra_info
2533 (P_PERSON_EXTRA_INFO_ID => l_person_extra_info_id
2534 ,P_EFFECTIVE_DATE => sysdate
2535 ,P_OBJECT_VERSION_NUMBER => l_object_version_number
2536 ,p_pei_INFORMATION3 => NULL
2537 ,p_pei_INFORMATION4 => NULL
2538 ,p_pei_INFORMATION5 => NULL
2539 -- Bug#3988449 Added p_pei_information10 to clear the increase percentage value.
2540 ,p_pei_information10 => NULL
2541 ,P_PEI_INFORMATION_CATEGORY => 'GHR_US_PER_MASS_ACTIONS');
2542
2543 l_ind := 30;
2544 hr_utility.set_location('Exiting ' || l_proc,10);
2545 -- There is a trigger on PER_PEOPLE_EXTRA_INFO to make the employee INVALID
2546 -- when there is a update done on the table.
2547 ---Commented the following three lines to remove Validation functionality on Person.
2548 --- ghr_validate_perwsepi.validate_perwsepi(p_person_id);
2549 --- l_ind := 40;
2550 --- ghr_validate_perwsepi.update_person_user_type(p_person_id);
2551 end if;
2552
2553 l_ind := 50;
2554 pr('Exiting '||l_proc,to_char(p_person_id));
2555 exception
2556 when msl_error then raise;
2557 when others then
2558 hr_utility.set_location('Error in '||l_proc||
2559 ' Err is '||sqlerrm(sqlcode),20);
2560 l_mslerrbuf := 'Error in '||l_proc||' at '||to_char(l_ind)||
2561 ' Sql Err is '|| sqlerrm(sqlcode);
2562 raise msl_error;
2563 end update_sel_flg;
2564
2565 --
2566 --
2567 --
2568
2569 FUNCTION GET_PAY_PLAN_NAME (PP IN VARCHAR2) RETURN VARCHAR2 IS
2570
2571 CURSOR CUR_PP IS
2572 select pay_plan,description
2573 from ghr_pay_plans
2574 WHERE PAY_PLAN = PP;
2575 l_pp_desc varchar2(150);
2576 BEGIN
2577 FOR PP_REC IN CUR_PP
2578 LOOP
2579 l_pp_desc := pp_rec.description;
2580 exit;
2581 END LOOP;
2582 return (l_pp_desc);
2583 END;
2584
2585 FUNCTION GET_USER_TABLE_name (P_USER_TABLE_id IN NUMBER) RETURN VARCHAR2 IS
2586 CURSOR MSL_CUR IS
2587 select user_table_id,substr(user_table_name,0,4) user_table_name
2588 from pay_user_tables
2589 where substr(user_table_name,6,14) in
2590 ('Oracle Federal','Federal Agency')
2591 and user_table_id = p_user_table_id;
2592 l_user_table_name varchar2(80);
2593 BEGIN
2594 for msl in msl_cur
2595 LOOP
2596 l_user_table_name := msl.user_table_name;
2597 exit;
2598 end loop;
2599 return (l_user_table_name);
2600 END;
2601
2602 --
2603 --
2604 --
2605 /*
2606 Procedure to get Person EI for MSL Percentage.
2607 */
2608
2609 PROCEDURE get_extra_info_comments
2610 (p_person_id in number,
2611 p_effective_date in date,
2612 p_sel_flag in out nocopy varchar2,
2613 p_comments in out nocopy varchar2,
2614 p_mass_salary_id in number,
2615 p_increase_percent out nocopy number,
2616 p_ses_basic_pay out nocopy number) is
2617
2618 l_per_ei_data per_people_extra_info%rowtype;
2619 l_proc varchar2(72) := g_package || '.get_extra_info_comments';
2620 l_eff_date date;
2621
2622 CURSOR chk_history (p_person_id in NUMBER ,
2623 eff_date in Date) IS
2624 select information9 info9
2625 ,information10 info10
2626 ,information11 info11
2627 ,information16 increase_percent -- Added by Sundar 3843306
2628 ,information17 info17
2629 from ghr_pa_history
2630 where person_id = p_person_id
2631 and pa_history_id IN ( select max(pa_history_id)
2632 from ghr_pa_history
2633 where person_id = p_person_id
2634 and information5 = 'GHR_US_PER_MASS_ACTIONS'
2635 and table_name = 'PER_PEOPLE_EXTRA_INFO'
2636 and effective_date = eff_date
2637 group by information11);
2638
2639 begin
2640 g_proc := 'get_extra_info_comments';
2641 hr_utility.set_location('Entering ' || l_proc,5);
2642
2643 l_eff_date := p_effective_date;
2644
2645 ghr_history_fetch.fetch_peopleei
2646 (p_person_id => p_person_id
2647 ,p_information_type => 'GHR_US_PER_MASS_ACTIONS'
2648 ,p_date_effective => l_eff_date
2649 ,p_per_ei_data => l_per_ei_data);
2650
2651 --Bug#3988449 Added NVL and to_number in the following condition
2652 IF NVL(to_number(l_per_ei_data.pei_information5),hr_api.g_number) <> NVL(p_mass_salary_id,hr_api.g_number) then
2653 p_sel_flag := 'Y';
2654 p_comments := null;
2655 p_increase_percent := null;
2656 p_ses_basic_pay := null;
2657 else
2658 p_sel_flag := l_per_ei_data.pei_information3;
2659 p_comments := l_per_ei_data.pei_information4;
2660 p_increase_percent := l_per_ei_data.pei_information10; -- Added by Sundar 3843306
2661 p_ses_basic_pay := l_per_ei_data.pei_information11;
2662 end if;
2663
2664 --Bug#3988449 Added NVL and to_number to l_per_ei_data.pei_information5, p_mass_salary_id.
2665 IF p_sel_flag IS NOT NULL and
2666 NVL(to_number(l_per_ei_data.pei_information5),hr_api.g_number) <> NVL(p_mass_salary_id,hr_api.g_number) THEN
2667 FOR chk_history_rec in chk_history(p_person_id => p_person_id,
2668 eff_date => l_eff_date) loop
2669 If chk_history_rec.info11 = p_mass_salary_id then
2670 p_sel_flag := chk_history_rec.info9;
2671 p_comments := chk_history_rec.info10;--Added by Ashley
2672 p_increase_percent := chk_history_rec.increase_percent; -- Added by Sundar 3843306
2673 p_ses_basic_pay := chk_history_rec.info11; -- Added by Sundar 3843306
2674 END IF;
2675 END LOOP;
2676 END IF;
2677
2678
2679 exception
2680 when msl_error then
2681 p_increase_percent := NULL;
2682 raise;
2683 when others then
2684 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
2685 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
2686 p_increase_percent := NULL;
2687 p_ses_basic_pay := NULL;
2688 raise msl_error;
2689 end;
2690
2691 --
2692 --
2693 --
2694
2695
2696
2697 procedure ins_upd_per_extra_info
2698 (p_person_id in number,
2699 p_effective_date in date,
2700 p_sel_flag in varchar2,
2701 p_comment in varchar2,
2702 p_msl_id in number,
2703 p_increase_percent in number default NULL) is
2704
2705 l_person_extra_info_id number;
2706 l_object_version_number number;
2707 l_per_ei_data per_people_extra_info%rowtype;
2708
2709 CURSOR people_ext_cur (person number) is
2710 SELECT person_extra_info_id, object_version_number
2711 FROM PER_people_EXTRA_INFO
2712 WHERE person_ID = person
2713 and information_type = 'GHR_US_PER_MASS_ACTIONS';
2714
2715 l_proc varchar2(72) := g_package || '.ins_upd_per_extra_info';
2716 l_eff_date date;
2717
2718 begin
2719 g_proc := 'ins_upd_per_extra_info';
2720 hr_utility.set_location('Entering ' || l_proc,5);
2721 if p_effective_date > sysdate then
2722 l_eff_date := sysdate;
2723 else
2724 l_eff_date := p_effective_date;
2725 end if;
2726
2727 ghr_history_fetch.fetch_peopleei
2728 (p_person_id => p_person_id
2729 ,p_information_type => 'GHR_US_PER_MASS_ACTIONS'
2730 ,p_date_effective => l_eff_date
2731 ,p_per_ei_data => l_per_ei_data);
2732
2733 l_person_extra_info_id := l_per_ei_data.person_extra_info_id;
2734 l_object_version_number := l_per_ei_data.object_version_number;
2735
2736 if l_person_extra_info_id is null then
2737 for per_ext_rec in people_ext_cur(p_person_id)
2738 loop
2739 l_person_extra_info_id := per_ext_rec.person_extra_info_id;
2740 l_object_version_number := per_ext_rec.object_version_number;
2741 end loop;
2742 end if;
2743
2744 if l_person_extra_info_id is not null then
2745 ghr_person_extra_info_api.update_person_extra_info
2746 (P_PERSON_EXTRA_INFO_ID => l_person_extra_info_id
2747 ,P_EFFECTIVE_DATE => trunc(l_eff_date)
2748 ,P_OBJECT_VERSION_NUMBER => l_object_version_number
2749 ,p_pei_INFORMATION3 => p_sel_flag
2750 ,p_pei_INFORMATION4 => p_comment
2751 ,p_pei_INFORMATION5 => to_char(p_msl_id)
2752 ,p_pei_information10 => to_char(p_increase_percent)
2753 ,P_PEI_INFORMATION_CATEGORY => 'GHR_US_PER_MASS_ACTIONS');
2754 else
2755 ghr_person_extra_info_api.create_person_extra_info
2756 (P_pERSON_ID => p_PERSON_id
2757 ,P_INFORMATION_TYPE => 'GHR_US_PER_MASS_ACTIONS'
2758 ,P_EFFECTIVE_DATE => trunc(l_eff_date)
2759 ,p_pei_INFORMATION3 => p_sel_flag
2760 ,p_pei_INFORMATION4 => p_comment
2761 ,p_pei_INFORMATION5 => to_char(p_msl_id)
2762 ,p_pei_information10 =>to_char(p_increase_percent)
2763 ,P_PEI_INFORMATION_CATEGORY => 'GHR_US_PER_MASS_ACTIONS'
2764 ,P_pERSON_EXTRA_INFO_ID => l_pERSON_extra_info_id
2765 ,P_OBJECT_VERSION_NUMBER => l_object_version_number);
2766 end if;
2767
2768 ---Commented the following two lines to remove Validation functionality on Person.
2769 -- ghr_validate_perwsepi.validate_perwsepi(p_person_id);
2770 -- ghr_validate_perwsepi.update_person_user_type(p_person_id);
2771
2772 hr_utility.set_location('Exiting ' || l_proc,10);
2773 exception
2774 when msl_error then raise;
2775 when others then
2776 pr('Error in '||l_proc);
2777 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
2778 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
2779 raise msl_error;
2780 end ins_upd_per_extra_info;
2781
2782 --
2783 -- Bug#5063304 Created this new procedure
2784 PROCEDURE fetch_and_validate_emp(
2785 p_action IN VARCHAR2
2786 ,p_mass_salary_id IN NUMBER
2787 ,p_mass_salary_name IN VARCHAR2
2788 ,p_full_name IN per_people_f.full_name%TYPE
2789 ,p_national_identifier IN per_people_f.national_identifier%TYPE
2790 ,p_assignment_id IN per_assignments_f.assignment_id%TYPE
2791 ,p_person_id IN per_assignments_f.person_id%TYPE
2792 ,p_position_id IN per_assignments_f.position_id%TYPE
2793 ,p_grade_id IN per_assignments_f.grade_id%TYPE
2794 ,p_business_group_id IN per_assignments_f.business_group_iD%TYPE
2795 ,p_location_id IN per_assignments_f.location_id%TYPE
2796 ,p_organization_id IN per_assignments_f.organization_id%TYPE
2797 ,p_msl_organization_id IN per_assignments_f.organization_id%TYPE
2798 ,p_msl_duty_station_id IN ghr_duty_stations_f.duty_station_id%TYPE
2799 ,p_msl_personnel_office_id IN VARCHAR2
2800 ,p_msl_agency_code_subelement IN VARCHAR2
2801 ,p_msl_user_table_id IN NUMBER
2802 ,p_rec_pp_prd IN pp_prd
2803 ,p_personnel_office_id OUT NOCOPY VARCHAR2
2804 ,p_org_structure_id OUT NOCOPY VARCHAR2
2805 ,p_position_title OUT NOCOPY VARCHAR2
2806 ,p_position_number OUT NOCOPY VARCHAR2
2807 ,p_position_seq_no OUT NOCOPY VARCHAR2
2808 ,p_subelem_code OUT NOCOPY VARCHAR2
2809 ,p_duty_station_id OUT NOCOPY ghr_duty_stations_f.duty_station_id%TYPE
2810 ,p_tenure OUT NOCOPY VARCHAR2
2811 ,p_annuitant_indicator OUT NOCOPY VARCHAR2
2812 ,p_pay_rate_determinant OUT NOCOPY VARCHAR2
2813 ,p_work_schedule OUT NOCOPY VARCHAR2
2814 ,p_part_time_hour OUT NOCOPY VARCHAR2
2815 ,p_to_grade_id OUT NOCOPY per_assignments_f.grade_id%type
2816 ,p_pay_plan OUT NOCOPY VARCHAR2
2817 ,p_to_pay_plan OUT NOCOPY VARCHAR2
2818 ,p_pay_table_id OUT NOCOPY NUMBER
2819 ,p_grade_or_level OUT NOCOPY VARCHAR2
2820 ,p_to_grade_or_level OUT NOCOPY VARCHAR2
2821 ,p_step_or_rate OUT NOCOPY VARCHAR2
2822 ,p_pay_basis OUT NOCOPY VARCHAR2
2823 ,p_elig_flag OUT NOCOPY BOOLEAN
2824 ) IS
2825
2826
2827
2828 CURSOR msl_dtl_cur (cur_pay_plan varchar2, cur_prd varchar2) IS
2829 SELECT count(*) cnt
2830 FROM ghr_mass_salary_criteria
2831 WHERE mass_salary_id = p_mass_salary_id
2832 AND pay_plan = cur_pay_plan
2833 AND pay_rate_determinant = cur_prd;
2834
2835 l_row_cnt NUMBER := 0;
2836 l_pos_grp1_rec per_position_extra_info%rowtype;
2837 l_assignment_id per_assignments_f.assignment_id%TYPE;
2838 l_person_id per_assignments_f.person_id%TYPE;
2839 l_position_id per_assignments_f.position_id%TYPE;
2840 l_grade_id per_assignments_f.grade_id%TYPE;
2841 l_business_group_id per_assignments_f.business_group_iD%TYPE;
2842 l_location_id per_assignments_f.location_id%TYPE;
2843 l_organization_id per_assignments_f.organization_id%TYPE;
2844 l_tenure VARCHAR2(35);
2845 l_annuitant_indicator VARCHAR2(35);
2846 l_pay_rate_determinant VARCHAR2(35);
2847 l_work_schedule VARCHAR2(35);
2848 l_part_time_hour VARCHAR2(35);
2849 l_pay_table_id NUMBER;
2850 l_pay_plan VARCHAR2(30);
2851 l_grade_or_level VARCHAR2(30);
2852 -- Bug#5089732 Added current pay plan, grade_or_level
2853 l_to_grade_id NUMBER;
2854 l_to_pay_plan VARCHAR2(30);
2855 l_to_grade_or_level VARCHAR2(30);
2856 -- Bug#5089732
2857 l_step_or_rate VARCHAR2(30);
2858 l_pay_basis VARCHAR2(30);
2859 l_duty_station_id NUMBER;
2860 l_duty_station_desc ghr_pa_requests.duty_station_desc%type;
2861 l_duty_station_code ghr_pa_requests.duty_station_code%type;
2862 l_effective_date DATE;
2863 l_personnel_office_id VARCHAR2(300);
2864 l_org_structure_id VARCHAR2(300);
2865 l_sub_element_code VARCHAR2(300);
2866 l_position_title VARCHAR2(300);
2867 l_position_number VARCHAR2(20);
2868 l_position_seq_no VARCHAR2(20);
2869 l_log_text VARCHAR2(2000) := null;
2870 l_retained_grade_rec ghr_pay_calc.retained_grade_rec_type;
2871 l_fetch_poid_data BOOLEAN := FALSE;
2872 l_fetch_ds_data BOOLEAN := FALSE;
2873 l_fetch_agency_data BOOLEAN := FALSE;
2874 init_elig_flag BOOLEAN := FALSE;
2875 l_prd_matched BOOLEAN := FALSE;
2876 l_prd_pp_matched BOOLEAN := FALSE;
2877
2878
2879 l_proc varchar2(72) := g_package || '.fetch_and_validate_emp';
2880
2881 BEGIN
2882
2883 g_proc := 'fetch_and_validate_emp';
2884 hr_utility.set_location('Entering ' || l_proc,5);
2885 -- Bug#5623035 Moved the local variable assigning to here.
2886 l_assignment_id := p_assignment_id;
2887 l_position_id := p_position_id;
2888 l_grade_id := p_grade_id;
2889 l_business_group_id := p_business_group_iD;
2890 l_location_id := p_location_id;
2891 l_effective_date := g_effective_date;
2892
2893 -- Verify whether this process is required or not.
2894 IF p_msl_organization_id IS NOT NULL OR
2895 p_msl_duty_station_id IS NOT NULL OR
2896 p_msl_personnel_office_id IS NOT NULL OR
2897 p_msl_agency_code_subelement IS NOT NULL THEN
2898 -- get the values and verify whether the record meets the condition or not.
2899 -- If Yes, proceed further. Otherwise, skip the other checks for this record
2900
2901 hr_utility.set_location('The location id is:'||l_location_id,12345);
2902 hr_utility.set_location('MSL Org ID:'||p_msl_organization_id,11111);
2903 hr_utility.set_location('Org ID:'||p_organization_id,22222);
2904 IF NVL(p_msl_organization_id,p_organization_id) = p_organization_id THEN
2905 hr_utility.set_location('Org ID PASS',10);
2906 IF p_msl_personnel_office_id IS NOT NULL THEN
2907 hr_utility.set_location('POID CHECK',15);
2908 get_pos_grp1_ddf(l_position_id,
2909 l_effective_date,
2910 l_pos_grp1_rec);
2911
2912 l_personnel_office_id := l_pos_grp1_rec.poei_information3;
2913 l_org_structure_id := l_pos_grp1_rec.poei_information5;
2914 l_fetch_poid_data := TRUE;
2915 END IF;
2916 IF (p_msl_personnel_office_id = l_personnel_office_id) OR
2917 NOT(l_fetch_poid_data) THEN
2918 hr_utility.set_location('POID PASS',20);
2919 IF p_msl_agency_code_subelement IS NOT NULL THEN
2920 hr_utility.set_location('Agency CHECK',25);
2921 get_sub_element_code_pos_title(l_position_id,
2922 p_person_id,
2923 l_business_group_id,
2924 l_assignment_id,
2925 l_effective_date,
2926 l_sub_element_code,
2927 l_position_title,
2928 l_position_number,
2929 l_position_seq_no);
2930 l_fetch_agency_data := TRUE;
2931 END IF;
2932 -- Bug#5674003 Modified the following IF condition
2933 IF (SUBSTR(p_msl_agency_code_subelement,1,2) = SUBSTR(l_sub_element_code,1,2) AND
2934 NVL(SUBSTR(p_msl_agency_code_subelement,3,2),SUBSTR(l_sub_element_code,3,2))=
2935 SUBSTR(l_sub_element_code,3,2)
2936 ) OR
2937 NOT(l_fetch_agency_data) THEN
2938 hr_utility.set_location('Agency PASS',30);
2939 IF p_msl_duty_station_id IS NOT NULL THEN
2940 hr_utility.set_location('DS CHECK',35);
2941 ghr_pa_requests_pkg.get_SF52_loc_ddf_details
2942 (p_location_id => l_location_id
2943 ,p_duty_station_id => l_duty_station_id);
2944 l_fetch_ds_data := TRUE;
2945 END IF;
2946 IF (p_msl_duty_station_id = l_duty_station_id) OR
2947 NOT(l_fetch_ds_data)THEN
2948 hr_utility.set_location('DS PASS',40);
2949 init_elig_flag := TRUE;
2950 ELSE -- Duty Station not matching.
2951 hr_utility.set_location('DS FAIL',45);
2952 init_elig_flag := FALSE;
2953 END IF;
2954 ELSE -- Agency Code Subelement Not matching.
2955 hr_utility.set_location('Agency FAIL',55);
2956 init_elig_flag := FALSE;
2957 END IF;
2958 ELSE -- Personnel Office ID not matching
2959 hr_utility.set_location('POID FAIL',65);
2960 init_elig_flag := FALSE;
2961 END IF;
2962 ELSE -- Organization_id is not matching.
2963 hr_utility.set_location('Org FAIL',75);
2964 init_elig_flag := FALSE;
2965 END IF;
2966 ELSE -- If No value is entered for organization, Duty Station, Agency, POID of MSL Criteria.
2967 hr_utility.set_location('No INIT CRITERIA',85);
2968 init_elig_flag := TRUE;
2969 END IF;
2970
2971 -- If the initial eligibility is passed then proceed further. Otherwise move to next record.
2972 IF init_elig_flag THEN
2973 hr_utility.set_location('Init Criteria Pass',95);
2974 ghr_pa_requests_pkg.get_sf52_asg_ddf_details
2975 (l_assignment_id,
2976 l_effective_date,
2977 l_tenure,
2978 l_annuitant_indicator,
2979 l_pay_rate_determinant,
2980 l_work_schedule,
2981 l_part_time_hour);
2982
2983 FOR l_cnt in 1..p_rec_pp_prd.COUNT LOOP
2984 IF nvl(p_rec_pp_prd(l_cnt).prd,l_pay_rate_determinant) = l_pay_rate_determinant THEN
2985 hr_utility.set_location('PRD PASS',105);
2986 l_prd_matched := TRUE;
2987 exit;
2988 END IF;
2989 END LOOP;
2990
2991 IF l_prd_matched THEN
2992 -- Bug#5089732 Used the overloaded procedure.
2993 BEGIN
2994 get_pay_plan_and_table_id
2995 (l_pay_rate_determinant,p_person_id,
2996 l_position_id,l_effective_date,
2997 l_grade_id, l_to_grade_id,l_assignment_id,'SHOW',
2998 l_pay_plan,l_to_pay_plan,l_pay_table_id,
2999 l_grade_or_level, l_to_grade_or_level, l_step_or_rate,
3000 l_pay_basis);
3001 -- Bug#4016384 Added the exception handling to report RG employees in the process log.
3002 EXCEPTION
3003 WHEN OTHERS THEN
3004 -- Report the record in the process log if the pay table ID matches.
3005 BEGIN
3006 hr_utility.set_location('before calling expired_rg_det',10);
3007 l_retained_grade_rec := ghr_pc_basic_pay.get_expired_rg_details
3008 (p_person_id => p_person_id
3009 ,p_effective_date => l_effective_date);
3010 hr_utility.set_location('ret grd tableid:'||l_retained_grade_rec.user_table_id,99999);
3011 hr_utility.set_location('MSL tableid:'||p_msl_user_table_id,99999);
3012 IF l_retained_grade_rec.user_table_id = p_msl_user_table_id THEN
3013 hr_utility.set_location('Rg table matches with MSL table ID',10);
3014 l_log_text := 'Error in RG Record In Mass Salary Name: '||
3015 p_mass_salary_name||'; Employee Name: '|| p_full_name ||
3016 '; SSN: ' || p_national_identifier || '; '||
3017 hr_utility.get_message;
3018 BEGIN
3019 ghr_mto_int.log_message(
3020 p_procedure => 'check_grade_retention',
3021 p_message => l_log_text);
3022 g_rg_recs_failed := g_rg_recs_failed + 1;
3023 EXCEPTION
3024 WHEN OTHERS THEN
3025 l_prd_pp_matched := FALSE;
3026 END;
3027 ELSE
3028 l_prd_pp_matched := FALSE;
3029 END IF;
3030 EXCEPTION
3031 WHEN OTHERS THEN
3032 hr_utility.set_location('WHEN OTHERS of EXPIRED RG ',999999);
3033 l_prd_pp_matched := FALSE;
3034 END;
3035 --WHEN OTHERS THEN
3036 -- Skip this record from reporting.
3037 -- l_prd_pp_matched := FALSE;
3038 END;
3039 END IF;
3040
3041 FOR l_cnt in 1..p_rec_pp_prd.COUNT LOOP
3042 IF nvl(p_rec_pp_prd(l_cnt).prd,l_pay_rate_determinant) = l_pay_rate_determinant AND
3043 nvl(p_rec_pp_prd(l_cnt).pay_plan,l_pay_plan) = l_pay_plan THEN
3044 hr_utility.set_location('PP/PRD PASS',115);
3045 l_prd_pp_matched := TRUE;
3046 exit;
3047 END IF;
3048 END LOOP;
3049
3050 IF l_prd_pp_matched THEN
3051 IF l_pay_table_id = p_msl_user_table_id THEN
3052 hr_utility.set_location('Table ID PASS',125);
3053 IF NOT (p_action = 'CREATE' AND
3054 person_in_pa_req_1noa
3055 (p_person_id => p_person_id,
3056 p_effective_date => l_effective_date,
3057 p_first_noa_code => nvl(g_first_noa_code,'894'),
3058 p_pay_plan => p_pay_plan
3059 )
3060 )THEN
3061 -- Pass l_pay_plan instead of l_to_pay_plan.
3062 FOR msl_dtl IN msl_dtl_cur(l_pay_plan, l_pay_rate_determinant)
3063 LOOP
3064 IF msl_dtl.cnt <> 0 THEN
3065 l_row_cnt := msl_dtl.cnt;
3066 END IF;
3067 END LOOP;
3068
3069 IF l_row_cnt <> 0 THEN
3070 hr_utility.set_location('ROW COUNT PASS',135);
3071 -- Get the required details if the related check has not been done above.
3072 IF NOT l_fetch_poid_data THEN
3073
3074 get_pos_grp1_ddf(l_position_id,
3075 l_effective_date,
3076 l_pos_grp1_rec);
3077 END IF;
3078
3079 IF NOT l_fetch_ds_data THEN
3080 ghr_pa_requests_pkg.get_SF52_loc_ddf_details
3081 (p_location_id => l_location_id
3082 ,p_duty_station_id => l_duty_station_id);
3083 END IF;
3084
3085 IF NOT l_fetch_agency_data THEN
3086 get_sub_element_code_pos_title(
3087 l_position_id,
3088 p_person_id,
3089 l_business_group_id,
3090 l_assignment_id,
3091 l_effective_date,
3092 l_sub_element_code,
3093 l_position_title,
3094 l_position_number,
3095 l_position_seq_no
3096 );
3097 END IF;
3098
3099 -- Set all the out parameters
3100 p_elig_flag := TRUE;
3101 p_personnel_office_id := l_personnel_office_id;
3102 p_org_structure_id := l_org_structure_id;
3103 p_position_title := l_position_title;
3104 p_position_number := l_position_number;
3105 p_position_seq_no := l_position_seq_no;
3106 p_subelem_code := l_sub_element_code;
3107 p_duty_station_id := l_duty_station_id;
3108 p_tenure := l_tenure;
3109 p_annuitant_indicator := l_annuitant_indicator;
3110 p_pay_rate_determinant := l_pay_rate_determinant;
3111 p_work_schedule := l_work_schedule;
3112 p_part_time_hour := l_part_time_hour;
3113 p_to_grade_id := l_to_grade_id;
3114 p_pay_plan := l_pay_plan;
3115 p_to_pay_plan := l_to_pay_plan;
3116 p_pay_table_id := l_pay_table_id;
3117 p_grade_or_level := l_grade_or_level;
3118 p_to_grade_or_level := l_to_grade_or_level;
3119 p_step_or_rate := l_step_or_rate;
3120 p_pay_basis := l_pay_basis;
3121 ELSE -- If PP,PRD combinations are "0".
3122 -- Raise Error
3123 NULL;
3124 END IF;
3125 ELSE -- Not (Create and RPA exists)
3126 hr_utility.set_location('ROW COUNT FAIL',145);
3127 p_elig_flag := FALSE;
3128 END IF;
3129 ELSE -- Pay table id is not matched
3130 hr_utility.set_location('Pay Table FAIL',155);
3131 p_elig_flag := FALSE;
3132 END IF;
3133 ELSE -- Pay Plan and PRD not matched
3134 hr_utility.set_location('PP/PRD FAIL',165);
3135 p_elig_flag := FALSE;
3136 END IF;
3137 ELSE
3138 hr_utility.set_location('PP FAIL',175);
3139 p_elig_flag := FALSE;
3140 END IF;
3141 EXCEPTION
3142 WHEN others THEN
3143 hr_utility.set_location('WHEN OTHERS',185);
3144 RAISE;
3145 END fetch_and_validate_emp;
3146 --
3147 --
3148 --
3149 -- Bug#5063304 Created this new procedure
3150 PROCEDURE fetch_and_validate_emp_perc(
3151 p_action IN VARCHAR2
3152 ,p_mass_salary_id IN NUMBER
3153 ,p_mass_salary_name IN VARCHAR2
3154 ,p_full_name IN per_people_f.full_name%TYPE
3155 ,p_national_identifier IN per_people_f.national_identifier%TYPE
3156 ,p_assignment_id IN per_assignments_f.assignment_id%TYPE
3157 ,p_person_id IN per_assignments_f.person_id%TYPE
3158 ,p_position_id IN per_assignments_f.position_id%TYPE
3159 ,p_grade_id IN per_assignments_f.grade_id%TYPE
3160 ,p_business_group_id IN per_assignments_f.business_group_iD%TYPE
3161 ,p_location_id IN per_assignments_f.location_id%TYPE
3162 ,p_organization_id IN per_assignments_f.organization_id%TYPE
3163 ,p_msl_organization_id IN per_assignments_f.organization_id%TYPE
3164 ,p_msl_duty_station_id IN ghr_duty_stations_f.duty_station_id%TYPE
3165 ,p_msl_personnel_office_id IN VARCHAR2
3166 ,p_msl_agency_code_subelement IN VARCHAR2
3167 ,p_msl_user_table_id IN NUMBER
3168 ,p_rec_pp_prd_per_gr IN pp_prd_per_gr
3169 ,p_personnel_office_id OUT NOCOPY VARCHAR2
3170 ,p_org_structure_id OUT NOCOPY VARCHAR2
3171 ,p_position_title OUT NOCOPY VARCHAR2
3172 ,p_position_number OUT NOCOPY VARCHAR2
3173 ,p_position_seq_no OUT NOCOPY VARCHAR2
3174 ,p_subelem_code OUT NOCOPY VARCHAR2
3175 ,p_duty_station_id OUT NOCOPY ghr_duty_stations_f.duty_station_id%TYPE
3176 ,p_tenure OUT NOCOPY VARCHAR2
3177 ,p_annuitant_indicator OUT NOCOPY VARCHAR2
3178 ,p_pay_rate_determinant OUT NOCOPY VARCHAR2
3179 ,p_work_schedule OUT NOCOPY VARCHAR2
3180 ,p_part_time_hour OUT NOCOPY VARCHAR2
3181 ,p_pay_plan OUT NOCOPY VARCHAR2
3182 ,p_pay_table_id OUT NOCOPY NUMBER
3183 ,p_grade_or_level OUT NOCOPY VARCHAR2
3184 ,p_step_or_rate OUT NOCOPY VARCHAR2
3185 ,p_pay_basis OUT NOCOPY VARCHAR2
3186 ,p_increase_percent OUT NOCOPY NUMBER
3187 ,p_elig_flag OUT NOCOPY BOOLEAN
3188 ) IS
3189
3190 CURSOR msl_dtl_cur (cur_pay_plan varchar2, cur_prd varchar2) IS
3191 SELECT count(*) cnt
3192 FROM ghr_mass_salary_criteria
3193 WHERE mass_salary_id = p_mass_salary_id
3194 AND pay_plan = cur_pay_plan
3195 AND pay_rate_determinant = cur_prd;
3196
3197 l_row_cnt NUMBER := 0;
3198 l_pos_grp1_rec per_position_extra_info%rowtype;
3199 l_assignment_id per_assignments_f.assignment_id%TYPE;
3200 l_person_id per_assignments_f.person_id%TYPE;
3201 l_position_id per_assignments_f.position_id%TYPE;
3202 l_grade_id per_assignments_f.grade_id%TYPE;
3203 l_business_group_id per_assignments_f.business_group_iD%TYPE;
3204 l_location_id per_assignments_f.location_id%TYPE;
3205 l_organization_id per_assignments_f.organization_id%TYPE;
3206 l_increase_percent ghr_mass_actions_preview.increase_percent%type;
3207 l_tenure VARCHAR2(35);
3208 l_annuitant_indicator VARCHAR2(35);
3209 l_pay_rate_determinant VARCHAR2(35);
3210 l_work_schedule VARCHAR2(35);
3211 l_part_time_hour VARCHAR2(35);
3212 l_pay_table_id NUMBER;
3213 l_pay_plan VARCHAR2(30);
3214 l_grade_or_level VARCHAR2(30);
3215 l_step_or_rate VARCHAR2(30);
3216 l_pay_basis VARCHAR2(30);
3217 l_duty_station_id NUMBER;
3218 l_duty_station_desc ghr_pa_requests.duty_station_desc%type;
3219 l_duty_station_code ghr_pa_requests.duty_station_code%type;
3220 l_effective_date DATE;
3221 l_personnel_office_id VARCHAR2(300);
3222 l_org_structure_id VARCHAR2(300);
3223 l_sub_element_code VARCHAR2(300);
3224 l_position_title VARCHAR2(300);
3225 l_position_number VARCHAR2(20);
3226 l_position_seq_no VARCHAR2(20);
3227 l_log_text VARCHAR2(2000) := null;
3228 l_retained_grade_rec ghr_pay_calc.retained_grade_rec_type;
3229 l_fetch_poid_data BOOLEAN := FALSE;
3230 l_fetch_ds_data BOOLEAN := FALSE;
3231 l_fetch_agency_data BOOLEAN := FALSE;
3232 init_elig_flag BOOLEAN := FALSE;
3233 l_prd_matched BOOLEAN := FALSE;
3234 l_prd_pp_matched BOOLEAN := FALSE;
3235
3236 l_proc varchar2(72) := g_package || '.fetch_and_validate_emp_perc';
3237
3238 BEGIN
3239
3240 g_proc := 'fetch_and_validate_emp_perc';
3241 hr_utility.set_location('Entering ' || l_proc,5);
3242 -- Bug#5623035 Moved the local variable declaratio to here.
3243 l_assignment_id := p_assignment_id;
3244 l_position_id := p_position_id;
3245 l_grade_id := p_grade_id;
3246 l_business_group_id := p_business_group_iD;
3247 l_location_id := p_location_id;
3248 l_effective_date := g_effective_date;
3249 -- Verify whether this process is required or not.
3250 IF p_msl_organization_id IS NOT NULL OR
3251 p_msl_duty_station_id IS NOT NULL OR
3252 p_msl_personnel_office_id IS NOT NULL OR
3253 p_msl_agency_code_subelement IS NOT NULL THEN
3254 -- get the values and verify whether the record meets the condition or not.
3255 -- If Yes, proceed further. Otherwise, skip the other checks for this record
3256
3257 hr_utility.set_location('The location id is:'||l_location_id,12345);
3258 hr_utility.set_location('MSL Org ID:'||p_msl_organization_id,11111);
3259 hr_utility.set_location('Org ID:'||p_organization_id,22222);
3260 IF NVL(p_msl_organization_id,p_organization_id) = p_organization_id THEN
3261 hr_utility.set_location('Org ID PASS',10);
3262 IF p_msl_personnel_office_id IS NOT NULL THEN
3263 hr_utility.set_location('POID CHECK',15);
3264 get_pos_grp1_ddf(l_position_id,
3265 l_effective_date,
3266 l_pos_grp1_rec);
3267
3268 l_personnel_office_id := l_pos_grp1_rec.poei_information3;
3269 l_org_structure_id := l_pos_grp1_rec.poei_information5;
3270 l_fetch_poid_data := TRUE;
3271 END IF;
3272 IF (p_msl_personnel_office_id = l_personnel_office_id) OR
3273 NOT(l_fetch_poid_data) THEN
3274 hr_utility.set_location('POID PASS',20);
3275 IF p_msl_agency_code_subelement IS NOT NULL THEN
3276 hr_utility.set_location('Agency CHECK',25);
3277 get_sub_element_code_pos_title(l_position_id,
3278 p_person_id,
3279 l_business_group_id,
3280 l_assignment_id,
3281 l_effective_date,
3282 l_sub_element_code,
3283 l_position_title,
3284 l_position_number,
3285 l_position_seq_no);
3286 l_fetch_agency_data := TRUE;
3287 END IF;
3288 -- Bug#5674003 Modified the following IF condition
3289 IF (SUBSTR(p_msl_agency_code_subelement,1,2) = SUBSTR(l_sub_element_code,1,2) AND
3290 NVL(SUBSTR(p_msl_agency_code_subelement,3,2),SUBSTR(l_sub_element_code,3,2))=
3291 SUBSTR(l_sub_element_code,3,2)
3292 ) OR
3293 NOT(l_fetch_agency_data) THEN
3294 hr_utility.set_location('Agency PASS',30);
3295 IF p_msl_duty_station_id IS NOT NULL THEN
3296 hr_utility.set_location('DS CHECK',35);
3297 ghr_pa_requests_pkg.get_SF52_loc_ddf_details
3298 (p_location_id => l_location_id
3299 ,p_duty_station_id => l_duty_station_id);
3300 l_fetch_ds_data := TRUE;
3301 END IF;
3302 IF (p_msl_duty_station_id = l_duty_station_id) OR
3303 NOT(l_fetch_ds_data)THEN
3304 hr_utility.set_location('DS PASS',40);
3305 init_elig_flag := TRUE;
3306 ELSE -- Duty Station not matching.
3307 hr_utility.set_location('DS FAIL',45);
3308 init_elig_flag := FALSE;
3309 END IF;
3310 ELSE -- Agency Code Subelement Not matching.
3311 hr_utility.set_location('Agency FAIL',55);
3312 init_elig_flag := FALSE;
3313 END IF;
3314 ELSE -- Personnel Office ID not matching
3315 hr_utility.set_location('POID FAIL',65);
3316 init_elig_flag := FALSE;
3317 END IF;
3318 ELSE -- Organization_id is not matching.
3319 hr_utility.set_location('Org FAIL',75);
3320 init_elig_flag := FALSE;
3321 END IF;
3322 ELSE -- If No value is entered for organization, Duty Station, Agency, POID of MSL Criteria.
3323 hr_utility.set_location('No INIT CRITERIA',85);
3324 init_elig_flag := TRUE;
3325 END IF;
3326
3327 -- If the initial eligibility is passed then proceed further. Otherwise move to next record.
3328 IF init_elig_flag THEN
3329 hr_utility.set_location('Init Criteria Pass',95);
3330 ghr_pa_requests_pkg.get_sf52_asg_ddf_details
3331 (l_assignment_id,
3332 l_effective_date,
3333 l_tenure,
3334 l_annuitant_indicator,
3335 l_pay_rate_determinant,
3336 l_work_schedule,
3337 l_part_time_hour);
3338
3339 FOR l_cnt in 1..p_rec_pp_prd_per_gr.COUNT LOOP
3340 IF nvl(p_rec_pp_prd_per_gr(l_cnt).prd,l_pay_rate_determinant) = l_pay_rate_determinant THEN
3341 hr_utility.set_location('PRD PASS',105);
3342 l_prd_matched := TRUE;
3343 exit;
3344 END IF;
3345 END LOOP;
3346
3347 IF l_prd_matched THEN
3348 BEGIN
3349 get_pay_plan_and_table_id(l_pay_rate_determinant,p_person_id,
3350 l_position_id,l_effective_date,
3351 l_grade_id, l_assignment_id,'SHOW',l_pay_plan,
3352 l_pay_table_id,l_grade_or_level, l_step_or_rate,
3353 l_pay_basis);
3354 -- Bug#4016384 Added the exception handling to report RG employees in the process log.
3355 EXCEPTION
3356 WHEN MSL_ERROR THEN
3357 -- Report the record in the process log if the pay table ID matches.
3358 BEGIN
3359 l_retained_grade_rec := ghr_pc_basic_pay.get_expired_rg_details
3360 (p_person_id => p_person_id
3361 ,p_effective_date => l_effective_date);
3362
3363 IF l_retained_grade_rec.user_table_id = p_msl_user_table_id THEN
3364
3365 l_log_text := 'Error in RG Record In Mass Salary Name: '||
3366 p_mass_salary_name||'; Employee Name: '|| p_full_name ||
3367 '; SSN: ' || p_national_identifier || '; '||
3368 hr_utility.get_message;
3369 BEGIN
3370 ghr_mto_int.log_message(
3371 p_procedure => 'check_grade_retention',
3372 p_message => l_log_text);
3373 g_rg_recs_failed := g_rg_recs_failed + 1;
3374 EXCEPTION
3375 WHEN OTHERS THEN
3376 l_prd_pp_matched := FALSE;
3377 END;
3378 ELSE
3379 l_prd_pp_matched := FALSE;
3380 END IF;
3381 EXCEPTION
3382 WHEN OTHERS THEN
3383 l_prd_pp_matched := FALSE;
3384 END;
3385 WHEN OTHERS THEN
3386 -- Skip this record from reporting.
3387 l_prd_pp_matched := FALSE;
3388 END;
3389 END IF;
3390
3391 FOR l_cnt in 1..p_rec_pp_prd_per_gr.COUNT LOOP
3392 IF nvl(p_rec_pp_prd_per_gr(l_cnt).prd,l_pay_rate_determinant) = l_pay_rate_determinant AND
3393 nvl(p_rec_pp_prd_per_gr(l_cnt).pay_plan,l_pay_plan) = l_pay_plan AND
3394 nvl(p_rec_pp_prd_per_gr(l_cnt).grade,l_grade_or_level) = l_grade_or_level THEN
3395 l_prd_pp_matched := TRUE;
3396 l_increase_percent := nvl(p_rec_pp_prd_per_gr(l_cnt).percent,0);
3397 EXIT;
3398 END IF;
3399 END LOOP;
3400
3401 IF l_prd_pp_matched THEN
3402 IF l_pay_table_id = p_msl_user_table_id THEN
3403 hr_utility.set_location('Table ID PASS',125);
3404 IF NOT (p_action = 'CREATE' AND
3405 person_in_pa_req_1noa
3406 (p_person_id => p_person_id,
3407 p_effective_date => l_effective_date,
3408 p_first_noa_code => nvl(g_first_noa_code,'894'),
3409 p_pay_plan => p_pay_plan
3410 )
3411 )THEN
3412 FOR msl_dtl IN msl_dtl_cur(l_pay_plan, l_pay_rate_determinant)
3413 LOOP
3414 IF msl_dtl.cnt <> 0 THEN
3415 l_row_cnt := msl_dtl.cnt;
3416 END IF;
3417 END LOOP;
3418
3419 IF l_row_cnt <> 0 THEN
3420 hr_utility.set_location('ROW COUNT PASS',135);
3421 -- Get the required details if the related check has not been done above.
3422 IF NOT l_fetch_poid_data THEN
3423
3424 get_pos_grp1_ddf(l_position_id,
3425 l_effective_date,
3426 l_pos_grp1_rec);
3427 END IF;
3428
3429 IF NOT l_fetch_ds_data THEN
3430 ghr_pa_requests_pkg.get_SF52_loc_ddf_details
3431 (p_location_id => l_location_id
3432 ,p_duty_station_id => l_duty_station_id);
3433 END IF;
3434
3435 IF NOT l_fetch_agency_data THEN
3436 get_sub_element_code_pos_title(
3437 l_position_id,
3438 p_person_id,
3439 l_business_group_id,
3440 l_assignment_id,
3441 l_effective_date,
3442 l_sub_element_code,
3443 l_position_title,
3444 l_position_number,
3445 l_position_seq_no
3446 );
3447 END IF;
3448
3449 -- Set all the out parameters
3450 p_elig_flag := TRUE;
3451 p_personnel_office_id := l_personnel_office_id;
3452 p_org_structure_id := l_org_structure_id;
3453 p_position_title := l_position_title;
3454 p_position_number := l_position_number;
3455 p_position_seq_no := l_position_seq_no;
3456 p_subelem_code := l_sub_element_code;
3457 p_duty_station_id := l_duty_station_id;
3458 p_tenure := l_tenure;
3459 p_annuitant_indicator := l_annuitant_indicator;
3460 p_pay_rate_determinant := l_pay_rate_determinant;
3461 p_work_schedule := l_work_schedule;
3462 p_part_time_hour := l_part_time_hour;
3463 p_pay_plan := l_pay_plan;
3464 p_pay_table_id := l_pay_table_id;
3465 p_grade_or_level := l_grade_or_level;
3466 p_step_or_rate := l_step_or_rate;
3467 p_pay_basis := l_pay_basis;
3468 p_increase_percent := l_increase_percent;
3469 ELSE -- If PP,PRD combinations are "0".
3470 -- Raise Error
3471 NULL;
3472 END IF;
3473 ELSE -- Not (Create and RPA exists)
3474 hr_utility.set_location('ROW COUNT FAIL',145);
3475 p_elig_flag := FALSE;
3476 END IF;
3477 ELSE -- Pay table id is not matched
3478 hr_utility.set_location('Pay Table FAIL',155);
3479 p_elig_flag := FALSE;
3480 END IF;
3481 ELSE -- Pay Plan and PRD not matched
3482 hr_utility.set_location('PP/PRD FAIL',165);
3483 p_elig_flag := FALSE;
3484 END IF;
3485 ELSE
3486 hr_utility.set_location('PP FAIL',175);
3487 p_elig_flag := FALSE;
3488 END IF;
3489 EXCEPTION
3490 WHEN others THEN
3491 hr_utility.set_location('WHEN OTHERS',185);
3492 RAISE;
3493 END fetch_and_validate_emp_perc;
3494 --
3495 --
3496 --
3497
3498 FUNCTION check_init_eligibility(p_duty_station_id in number,
3499 p_PERSONNEL_OFFICE_ID in varchar2,
3500 p_AGENCY_CODE_SUBELEMENT in varchar2,
3501 p_l_duty_station_id in number,
3502 p_l_personnel_office_id in varchar2,
3503 p_l_sub_element_code in varchar2)
3504 return boolean is
3505
3506 CURSOR cur_valid_DS(p_ds_id NUMBER)
3507 IS
3508 SELECT effective_end_date end_date
3509 FROM ghr_duty_stations_f
3510 WHERE duty_station_id=p_ds_id
3511 AND g_effective_date between effective_start_date and effective_end_date;
3512
3513 l_ds_end_date ghr_duty_stations_f.effective_end_date%type;
3514
3515
3516 l_proc varchar2(72) := g_package || '.check_init_eligibility';
3517 BEGIN
3518
3519 g_proc := 'check_init_eligibility';
3520 hr_utility.set_location('Entering ' || l_proc,5);
3521
3522 if p_personnel_office_id is not null then
3523 if p_personnel_office_id <> nvl(p_l_personnel_office_id,'NULL!~') then
3524 return false;
3525 end if;
3526 end if;
3527
3528 -- VSM [Masscrit.doc]
3529 -- 2 char - Test for Agency Code only
3530 -- 4 char Test for agency and subelement
3531 if p_agency_code_subelement is not null then
3532 if substr(p_agency_code_subelement, 1, 2) <> nvl(substr(p_l_sub_element_code, 1, 2), 'NULL!~') then
3533 return false;
3534 end if;
3535 end if;
3536
3537 if substr(p_agency_code_subelement, 3, 2) is not null then
3538 if substr(p_agency_code_subelement, 3, 2) <> nvl(substr(p_l_sub_element_code, 3, 2), 'NULL!~') then
3539 return false;
3540 end if;
3541 end if;
3542
3543 -- Start of Bug3437354
3544 --
3545 -- Added this condition for bug 3437354, error out the record without valid Loc id
3546 --
3547 if p_duty_station_id <> nvl(p_l_duty_station_id,0) then
3548 return false;
3549 end if;
3550
3551 FOR rec_ds in cur_valid_ds(p_l_duty_station_id)
3552 LOOP
3553 l_ds_end_date := rec_ds.end_Date;
3554 END LOOP;
3555
3556 If l_ds_end_date IS NULL THEN
3557 hr_utility.set_location('Under DS null check'||p_l_duty_station_id,12345);
3558 raise msl_error;
3559 return false;
3560 end if;
3561 -- End of bug 3437354
3562 --
3563 pr('Eligible');
3564 return true;
3565 exception
3566 when msl_error then --raise;
3567 hr_utility.set_location('Error NO DUTY STATION '||l_proc||' Err is '||sqlerrm(sqlcode),20);
3568 l_mslerrbuf :=
3569 'Error - No valid Location found, salary cannot be correctly calculated without the employee''s duty location ';
3570 raise msl_error;
3571 when others then
3572 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
3573 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
3574 raise msl_error;
3575 END check_init_eligibility;
3576
3577
3578 FUNCTION check_eligibility(p_mass_salary_id in number,
3579 p_user_table_id in number,
3580 p_pay_table_id in number,
3581 p_pay_plan in varchar2,
3582 p_pay_rate_determinant in varchar2,
3583 p_person_id in number,
3584 p_effective_date in date,
3585 p_action in varchar2)
3586 return boolean is
3587
3588 cursor msl_dtl_cur (cur_pay_plan varchar2, cur_prd varchar2) is
3589 select count(*) count
3590 from ghr_mass_salary_criteria
3591 where mass_salary_id = p_mass_salary_id
3592 and pay_plan = cur_pay_plan
3593 and pay_rate_determinant = cur_prd;
3594
3595 l_row_cnt number := 0;
3596 l_proc varchar2(72) := g_package || '.check_eligibility';
3597 BEGIN
3598 g_proc := 'check_eligibility';
3599 hr_utility.set_location('Entering ' || l_proc,5);
3600 --return true;
3601
3602 if p_user_table_id is null or p_pay_table_id is null then
3603 return false;
3604 end if;
3605
3606 /************ on 3/21/1998
3607 if p_pay_rate_determinant not in ('0','2','3','4','6','A','B','E','F','J','K','R','S','U','V')
3608 then
3609 return false;
3610 end if;
3611 **************/
3612
3613 if p_pay_plan is null or p_pay_rate_determinant is null then
3614 ghr_mre_pkg.pr('pay plan, prd failed');
3615 return false;
3616 end if;
3617
3618 IF p_user_table_id <> p_pay_table_id THEN
3619 ghr_mre_pkg.pr('pay table id failed');
3620 return false;
3621 END IF;
3622
3623 FOR msl_dtl IN msl_dtl_cur(p_pay_plan, p_pay_rate_determinant)
3624 LOOP
3625 if msl_dtl.count <> 0 then
3626 l_row_cnt := msl_dtl.count;
3627 end if;
3628 END LOOP;
3629
3630 IF l_row_cnt = 0 THEN
3631 RETURN FALSE;
3632 END IF;
3633
3634 if p_action = 'CREATE' THEN
3635 if person_in_pa_req_1noa
3636 (p_person_id => p_person_id,
3637 p_effective_date => p_effective_date,
3638 p_first_noa_code => nvl(g_first_noa_code,'894'),
3639 p_pay_plan => p_pay_plan
3640 ) then
3641 ghr_mre_pkg.pr('1noa failed',to_char(p_person_id));
3642 return false;
3643 ELSE
3644 ghr_mre_pkg.pr('Eligible');
3645 RETURN TRUE;
3646 end if;
3647 end if;
3648 /************ This is not required****************
3649 if person_in_pa_req_2noa
3650 (p_person_id => p_person_id,
3651 p_effective_date => p_effective_date,
3652 p_second_noa_code => '894'
3653 ) then
3654 ghr_mre_pkg.pr('2noa failed',to_char(p_person_id));
3655 return false;
3656 end if;
3657
3658 *********** This is not required****************/
3659 return true;
3660 exception
3661 when msl_error then raise;
3662 when others then
3663 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
3664 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
3665 raise msl_error;
3666 END check_eligibility;
3667
3668 --
3669 --
3670 --
3671
3672 function person_in_pa_req_1noa
3673 (p_person_id in number,
3674 p_effective_date in date,
3675 p_first_noa_code in varchar2,
3676 p_pay_plan in varchar2,
3677 p_days in number default 350
3678 )
3679 return boolean is
3680 --
3681 l_name per_people_f.full_name%type;
3682 -- Bug#3718167 Added l_ssn
3683 l_ssn per_people_f.national_identifier%TYPE;
3684 l_pa_request_id ghr_pa_requests.pa_request_id%TYPE;
3685
3686 cursor csr_action_taken is
3687 select pr.pa_request_id, max(pa_routing_history_id) pa_routing_history_id
3688 from ghr_pa_requests pr, ghr_pa_routing_history prh
3689 where pr.pa_request_id = prh.pa_request_id
3690 and person_id = p_person_id
3691 and first_noa_code = p_first_noa_code
3692 and effective_date = p_effective_date
3693 and nvl(pr.first_noa_cancel_or_correct,'X') <> ghr_history_api.g_cancel
3694 ---- Bug # 657439
3695 --and nvl(pr.first_noa_cancel_or_correct,'X') <> 'CANCELED'
3696 group by pr.pa_request_id;
3697
3698 -- Bug#3718167
3699 cursor csr_name_ssn is
3700 select substr(pr.employee_last_name || ', ' || pr.employee_first_name,1,240) fname,
3701 pr.employee_national_identifier SSN
3702 from ghr_pa_requests pr
3703 where pr.pa_request_id = l_pa_request_id;
3704
3705 cursor csr_action_taken_fw is
3706 select pr.pa_request_id, max(pa_routing_history_id) pa_routing_history_id
3707 from ghr_pa_requests pr, ghr_pa_routing_history prh
3708 where pr.pa_request_id = prh.pa_request_id
3709 and person_id = p_person_id
3710 and first_noa_code = p_first_noa_code
3711 and effective_date = p_effective_date
3712 and nvl(pr.first_noa_cancel_or_correct,'X') <> ghr_history_api.g_cancel
3713 group by pr.pa_request_id;
3714
3715 cursor csr_eq_pay_plan is
3716 SELECT equivalent_pay_plan
3717 FROM ghr_pay_plans
3718 WHERE pay_plan = p_pay_plan;
3719
3720 cursor pa_hist_cur (p_r_hist_id number) is
3721 select nvl(action_taken,' ') action_taken
3722 from ghr_pa_routing_history
3723 where pa_routing_history_id = p_r_hist_id;
3724
3725 l_action_taken ghr_pa_routing_history.action_taken%TYPE;
3726 l_proc varchar2(72) := g_package || '.person_in_pa_req_1noa';
3727 l_eq_pay_plan ghr_pay_plans.equivalent_pay_plan%type;
3728
3729 begin
3730 g_proc := 'person_in_pa_req_1noa';
3731 hr_utility.set_location('Entering ' || l_proc,5);
3732 -- Bug 1631952 start
3733 for csr_eq_pay_plan_rec in csr_eq_pay_plan loop
3734 l_eq_pay_plan := csr_eq_pay_plan_rec.equivalent_pay_plan;
3735 end loop;
3736
3737 if l_eq_pay_plan = 'FW' then
3738 for v_action_taken_fw in csr_action_taken_fw loop
3739 l_pa_request_id := v_action_taken_fw.pa_request_id;
3740 for v_name in csr_name_ssn
3741 loop
3742 l_name := v_name.fname;
3743 -- Bug#3718167 Added l_ssn statement
3744 l_ssn := v_name.ssn;
3745 exit;
3746 end loop;
3747 for pa_hist_rec in pa_hist_cur (v_action_taken_fw.pa_routing_history_id)
3748 loop
3749 l_action_taken := pa_hist_rec.action_taken;
3750 exit;
3751 end loop;
3752 if l_action_taken <> 'CANCELED' then
3753 -- Bug#3718167 Added SSN in the following message
3754 ghr_mto_int.log_message(
3755 p_procedure => 'RPA Exists Already',
3756 p_message => 'Name: '|| l_name || '; SSN: '||l_ssn||
3757 ' - Salary Change ' ||
3758 ' RPA Exists for the given FWS pay_lan and effective date' );
3759 return true;
3760 end if;
3761 end loop;
3762 else
3763 --- Bug 1631952 end. The same bug was extended to GS equvalent pay plans.
3764 for v_action_taken in csr_action_taken loop
3765 l_pa_request_id := v_action_taken.pa_request_id;
3766 for v_name in csr_name_ssn
3767 loop
3768 l_name := v_name.fname;
3769 -- Bug#3718167 Added l_ssn statement
3770 l_ssn := v_name.ssn;
3771 exit;
3772 end loop;
3773 for pa_hist_rec in pa_hist_cur (v_action_taken.pa_routing_history_id)
3774 loop
3775 l_action_taken := pa_hist_rec.action_taken;
3776 exit;
3777 end loop;
3778 if l_action_taken <> 'CANCELED' then
3779 -- Bug#3718167 Added SSN in the following message
3780 ghr_mto_int.log_message(
3781 p_procedure => 'RPA Exists Already',
3782 p_message => 'Name: '|| l_name || '; SSN: '||l_ssn||
3783 ' - Salary Change ' ||
3784 ' RPA Exists for the given effective date ' );
3785 return true;
3786 end if;
3787
3788 end loop;
3789 end if; ------Bug 1631952
3790 return false;
3791 end person_in_pa_req_1noa;
3792
3793 --
3794 --
3795 --
3796
3797 function person_in_pa_req_2noa
3798 (p_person_id in number,
3799 p_effective_date in date,
3800 p_second_noa_code in varchar2,
3801 p_days in number default 350
3802 )
3803 return boolean is
3804 --
3805 cursor csr_action_taken is
3806 select pr.pa_request_id, max(pa_routing_history_id) pa_routing_history_id
3807 from ghr_pa_requests pr, ghr_pa_routing_history prh
3808 where pr.pa_request_id = prh.pa_request_id
3809 and nvl(person_id,0) = p_person_id
3810 and nvl(second_noa_code,0) = p_second_noa_code
3811 and nvl(effective_date,trunc(sysdate)) >= (p_effective_date-p_days)
3812 and nvl(pr.second_noa_cancel_or_correct,'X') <> ghr_history_api.g_cancel
3813 --Bug 657439
3814 -- and nvl(pr.second_noa_cancel_or_correct,'X') <> 'CANCELED'
3815 group by pr.pa_request_id;
3816
3817 cursor pa_hist_cur (p_r_hist_id number) is
3818 select nvl(action_taken,' ') action_taken
3819 from ghr_pa_routing_history
3820 where pa_routing_history_id = p_r_hist_id;
3821
3822 l_action_taken ghr_pa_routing_history.action_taken%TYPE;
3823 l_proc varchar2(72) := g_package || '.person_in_pa_req_2noa';
3824 begin
3825 g_proc := 'person_in_pa_req_2noa';
3826 hr_utility.set_location('Entering ' || l_proc,5);
3827 for v_action_taken in csr_action_taken loop
3828 for pa_hist_rec in pa_hist_cur (v_action_taken.pa_routing_history_id)
3829 loop
3830 l_action_taken := pa_hist_rec.action_taken;
3831 exit;
3832 end loop;
3833 if l_action_taken <> 'CANCELED' then
3834 return true;
3835 end if;
3836 end loop;
3837 return false;
3838 end person_in_pa_req_2noa;
3839
3840 --
3841 --
3842 --
3843
3844 FUNCTION check_grade_retention(p_prd in varchar2
3845 ,p_person_id in number
3846 ,p_effective_date in date) return varchar2 is
3847
3848 l_retained_grade_rec ghr_pay_calc.retained_grade_rec_type;
3849 l_per_ei_data per_people_extra_info%rowtype;
3850
3851 l_proc varchar2(72) := g_package || '.check_grade_retention';
3852
3853 BEGIN
3854 g_proc := 'check_grade_retention';
3855 hr_utility.set_location('Entering ' || l_proc,5);
3856 IF p_prd in ('A','B','E','F','U','V') THEN
3857 IF p_prd in ('A','B','E','F') THEN
3858 -- Bug#4179270,4126137,4086677 Removed the History Fetch call.
3859 -- Note: Do not use fetch_peopleei to get Retained grade details as it
3860 -- is not date tracked.
3861 BEGIN
3862 l_retained_grade_rec :=
3863 ghr_pc_basic_pay.get_retained_grade_details
3864 ( p_person_id,
3865 p_effective_date);
3866 IF l_retained_grade_rec.temp_step is not null THEN
3867 return 'REGULAR';
3868 END IF;
3869 EXCEPTION
3870 WHEN ghr_pay_calc.pay_calc_message THEN
3871 raise msl_error;
3872 WHEN OTHERS THEN
3873 raise;
3874 END;
3875 END IF;
3876 return 'RETAIN';
3877 ELSE
3878 return 'REGULAR';
3879 END IF;
3880 EXCEPTION
3881 when msl_error then
3882 RETURN 'MSL_ERROR';
3883 when others then
3884 RETURN 'OTHER_ERROR';
3885 END CHECK_GRADE_RETENTION;
3886
3887 --
3888 --
3889 --
3890
3891 procedure get_pos_grp1_ddf (p_position_id in per_assignments_f.position_id%type,
3892 p_effective_date in date,
3893 p_pos_ei_data out nocopy per_position_extra_info%rowtype)
3894 IS
3895
3896 l_proc varchar2(72) := g_package || '.get_pos_grp1_ddf';
3897 --l_pos_ei_data per_position_extra_info%type;
3898
3899 begin
3900 g_proc := 'get_pos_grp1_ddf';
3901 hr_utility.set_location('Entering ' || l_proc,5);
3902 ghr_history_fetch.fetch_positionei
3903 (p_position_id => p_position_id
3904 ,p_information_type => 'GHR_US_POS_GRP1'
3905 ,p_date_effective => p_effective_date
3906 ,p_pos_ei_data => p_pos_ei_data
3907 );
3908 hr_utility.set_location('Exiting ' || l_proc,10);
3909 exception
3910 when msl_error then raise;
3911 when others then
3912 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
3913 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
3914 raise msl_error;
3915 END get_pos_grp1_ddf;
3916
3917 --
3918 --
3919 --
3920
3921 procedure get_from_sf52_data_elements (p_assignment_id in number,
3922 p_effective_date in date,
3923 p_old_basic_pay out nocopy number,
3924 p_old_avail_pay out nocopy number,
3925 p_old_loc_diff out nocopy number,
3926 p_tot_old_sal out nocopy number,
3927 p_old_auo_pay out nocopy number,
3928 p_old_adj_basic_pay out nocopy number,
3929 p_other_pay out nocopy number,
3930 p_auo_premium_pay_indicator out nocopy varchar2,
3931 p_ap_premium_pay_indicator out nocopy varchar2,
3932 p_retention_allowance out nocopy number,
3933 p_retention_allow_perc out nocopy number,
3934 p_supervisory_differential out nocopy number,
3935 p_supervisory_diff_perc out nocopy number,
3936 p_staffing_differential out nocopy number) is
3937
3938 l_multi_error_flag boolean;
3939 l_total_salary number;
3940 l_basic_pay number;
3941 l_locality_adj number;
3942 l_adj_basic_pay number;
3943 l_other_pay number;
3944 l_au_overtime NUMBER;
3945 l_auo_premium_pay_indicator VARCHAR2(30);
3946 l_availability_pay NUMBER;
3947 l_ap_premium_pay_indicator VARCHAR2(30);
3948 l_retention_allowance NUMBER;
3949 l_retention_allow_perc NUMBER;
3950 l_supervisory_differential NUMBER;
3951 l_supervisory_diff_perc NUMBER;
3952 l_staffing_differential NUMBER;
3953 l_proc varchar2(72) := g_package || '.get_from_sf52_data_elements';
3954
3955 BEGIN
3956
3957 g_proc := 'get_from_sf52_data_elements';
3958 hr_utility.set_location('Entering ' || l_proc,5);
3959
3960 -- Processing Total Pay and Adjusted Basic Pay
3961 -- NAME DATE BUG COMMENTS
3962 -- Ashley 17-JUL-03 Payroll Intg Modified the Input Value name
3963 -- Changes from Total Salary -> Amount
3964 -- Adjusted Pay -> Amount
3965
3966 ghr_api.retrieve_element_entry_value
3967 (p_element_name => 'Total Pay'
3968 ,p_input_value_name => 'Amount'
3969 ,p_assignment_id => p_assignment_id
3970 ,p_effective_date => p_effective_date
3971 ,p_value => l_total_salary
3972 ,p_multiple_error_flag => l_multi_error_flag);
3973
3974 hr_utility.set_location('Total Pay = ' || to_char(l_total_salary), 6);
3975
3976 if l_multi_error_flag then
3977 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
3978 hr_utility.raise_error;
3979 end if;
3980
3981 ghr_api.retrieve_element_entry_value
3982 (p_element_name => 'Basic Salary Rate'
3983 ,p_input_value_name => 'Rate'
3984 ,p_assignment_id => p_assignment_id
3985 ,p_effective_date => p_effective_date
3986 ,p_value => l_basic_pay
3987 ,p_multiple_error_flag => l_multi_error_flag);
3988
3989 hr_utility.set_location('Basic Salary Rate = ' || to_char(l_basic_pay), 6);
3990
3991 if l_multi_error_flag then
3992 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
3993 hr_utility.raise_error;
3994 end if;
3995
3996 ghr_api.retrieve_element_entry_value
3997 -- FWFA Changes Bug#4444609
3998 (p_element_name => 'Locality Pay or SR Supplement'
3999 -- FWFA Changes Modify 'Locality Pay' to 'Locality Pay or SR Supplement'
4000 ,p_input_value_name => 'Rate'
4001 -- Changed by Ashu. 'Amount' to 'Rate'
4002 ,p_assignment_id => p_assignment_id
4003 ,p_effective_date => p_effective_date
4004 ,p_value => l_locality_adj
4005 ,p_multiple_error_flag => l_multi_error_flag);
4006
4007 hr_utility.set_location('Locality Pay = ' || to_char(l_locality_adj), 6);
4008
4009 if l_multi_error_flag then
4010 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4011 hr_utility.raise_error;
4012 end if;
4013
4014 ghr_api.retrieve_element_entry_value
4015 (p_element_name => 'Adjusted Basic Pay'
4016 ,p_input_value_name => 'Amount'
4017 ,p_assignment_id => p_assignment_id
4018 ,p_effective_date => p_effective_date
4019 ,p_value => l_adj_basic_pay
4020 ,p_multiple_error_flag => l_multi_error_flag);
4021
4022 hr_utility.set_location('Adjusted Basic Pay = ' || to_char(l_adj_basic_pay), 6);
4023
4024 if l_multi_error_flag then
4025 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4026 hr_utility.raise_error;
4027 end if;
4028
4029 ghr_api.retrieve_element_entry_value
4030 (p_element_name => 'Other Pay'
4031 ,p_input_value_name => 'Amount'
4032 ,p_assignment_id => p_assignment_id
4033 ,p_effective_date => p_effective_date
4034 ,p_value => l_other_pay
4035 ,p_multiple_error_flag => l_multi_error_flag);
4036
4037 hr_utility.set_location('Other Pay = ' || to_char(l_other_pay), 6);
4038
4039 if l_multi_error_flag then
4040 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4041 hr_utility.raise_error;
4042 end if;
4043
4044 ghr_api.retrieve_element_entry_value
4045 (p_element_name => 'AUO'
4046 ,p_input_value_name => 'Amount'
4047 ,p_assignment_id => p_assignment_id
4048 ,p_effective_date => p_effective_date
4049 ,p_value => l_au_overtime
4050 ,p_multiple_error_flag => l_multi_error_flag);
4051
4052 hr_utility.set_location('AUO Amount = ' || to_char(l_au_overtime), 6);
4053
4054 if l_multi_error_flag then
4055 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4056 hr_utility.raise_error;
4057 end if;
4058
4059 ghr_api.retrieve_element_entry_value
4060 (p_element_name => 'AUO'
4061 ,p_input_value_name => 'Premium Pay Ind'
4062 ,p_assignment_id => p_assignment_id
4063 ,p_effective_date => p_effective_date
4064 ,p_value => l_auo_premium_pay_indicator
4065 ,p_multiple_error_flag => l_multi_error_flag);
4066
4067 if l_multi_error_flag then
4068 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4069 hr_utility.raise_error;
4070 end if;
4071
4072 ghr_api.retrieve_element_entry_value
4073 (p_element_name => 'Availability Pay'
4074 ,p_input_value_name => 'Amount'
4075 ,p_assignment_id => p_assignment_id
4076 ,p_effective_date => p_effective_date
4077 ,p_value => l_availability_pay
4078 ,p_multiple_error_flag => l_multi_error_flag);
4079
4080 hr_utility.set_location('Availability Pay Amount = ' || to_char(l_availability_pay), 6);
4081
4082 if l_multi_error_flag then
4083 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4084 hr_utility.raise_error;
4085 end if;
4086
4087 ghr_api.retrieve_element_entry_value
4088 (p_element_name => 'Availability Pay'
4089 ,p_input_value_name => 'Premium Pay Ind'
4090 ,p_assignment_id => p_assignment_id
4091 ,p_effective_date => p_effective_date
4092 ,p_value => l_ap_premium_pay_indicator
4093 ,p_multiple_error_flag => l_multi_error_flag);
4094
4095 if l_multi_error_flag then
4096 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4097 hr_utility.raise_error;
4098 end if;
4099 --
4100 ghr_api.retrieve_element_entry_value
4101 (p_element_name => 'Retention Allowance'
4102 ,p_input_value_name => 'Amount'
4103 ,p_assignment_id => p_assignment_id
4104 ,p_effective_date => p_effective_date
4105 ,p_value => l_retention_allowance
4106 ,p_multiple_error_flag => l_multi_error_flag);
4107
4108 hr_utility.set_location('Retention Allowance Amount = ' || to_char(l_retention_allowance), 6);
4109
4110 if l_multi_error_flag then
4111 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4112 hr_utility.raise_error;
4113 end if;
4114
4115 ghr_api.retrieve_element_entry_value
4116 (p_element_name => 'Retention Allowance'
4117 ,p_input_value_name => 'Percentage'
4118 ,p_assignment_id => p_assignment_id
4119 ,p_effective_date => p_effective_date
4120 ,p_value => l_retention_allow_perc
4121 ,p_multiple_error_flag => l_multi_error_flag);
4122
4123 hr_utility.set_location('Retention Allowance Percent = ' || to_char(l_retention_allow_perc), 6);
4124
4125 if l_multi_error_flag then
4126 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4127 hr_utility.raise_error;
4128 end if;
4129
4130 ghr_api.retrieve_element_entry_value
4131 (p_element_name => 'Supervisory Differential'
4132 ,p_input_value_name => 'Amount'
4133 ,p_assignment_id => p_assignment_id
4134 ,p_effective_date => p_effective_date
4135 ,p_value => l_supervisory_differential
4136 ,p_multiple_error_flag => l_multi_error_flag);
4137
4138 hr_utility.set_location('Supervisory Diff Amount = ' || to_char(l_supervisory_differential), 6);
4139
4140 if l_multi_error_flag then
4141 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4142 hr_utility.raise_error;
4143 end if;
4144
4145 ghr_api.retrieve_element_entry_value
4146 (p_element_name => 'Supervisory Differential'
4147 ,p_input_value_name => 'Percentage'
4148 ,p_assignment_id => p_assignment_id
4149 ,p_effective_date => p_effective_date
4150 ,p_value => l_supervisory_diff_perc
4151 ,p_multiple_error_flag => l_multi_error_flag);
4152
4153 hr_utility.set_location('Supervisory Diff Percent = ' || to_char(l_supervisory_diff_perc), 6);
4154
4155 if l_multi_error_flag then
4156 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4157 hr_utility.raise_error;
4158 end if;
4159
4160 --
4161 --
4162 ghr_api.retrieve_element_entry_value
4163 (p_element_name => 'Staffing Differential'
4164 ,p_input_value_name => 'Amount'
4165 ,p_assignment_id => p_assignment_id
4166 ,p_effective_date => p_effective_date
4167 ,p_value => l_staffing_differential
4168 ,p_multiple_error_flag => l_multi_error_flag);
4169
4170 hr_utility.set_location('Staffing Diff Amount = ' || to_char(l_staffing_differential), 6);
4171
4172 if l_multi_error_flag then
4173 hr_utility.set_message(8301, 'GHR_38014_API_MULTI_ELE_ENTR');
4174 hr_utility.raise_error;
4175 end if;
4176
4177 p_tot_old_sal := round(l_total_salary,2);
4178 p_OLD_BASIC_PAY := round(l_basic_pay,2);
4179 p_OLD_LOC_DIFF := round(l_locality_adj,0);
4180 p_old_adj_basic_pay := round(l_adj_basic_pay,2);
4181 p_other_pay := l_other_pay;
4182 p_OLD_AUO_PAY := l_au_overtime;
4183 p_auo_premium_pay_indicator := l_auo_premium_pay_indicator;
4184 p_OLD_AVAIL_PAY := l_availability_pay;
4185 p_ap_premium_pay_indicator := l_ap_premium_pay_indicator;
4186 p_retention_allowance := l_retention_allowance;
4187 p_retention_allow_perc := l_retention_allow_perc;
4188 p_supervisory_differential := l_supervisory_differential;
4189 p_supervisory_diff_perc := l_supervisory_diff_perc;
4190 p_staffing_differential := l_staffing_differential;
4191
4192 hr_utility.set_location('Exiting ' || l_proc,10);
4193
4194 exception
4195 when msl_error then raise;
4196 when others then
4197 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
4198 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
4199 raise msl_error;
4200 END GET_FROM_SF52_DATA_ELEMENTS;
4201
4202 --
4203 --
4204 --
4205
4206 procedure get_sub_element_code_pos_title
4207 (p_position_id in per_assignments_f.position_id%type,
4208 p_person_id in number,
4209 p_business_group_id in per_assignments_f.business_group_id%type,
4210 p_assignment_id in per_assignments_f.assignment_id%type,
4211 p_effective_date in date,
4212 p_sub_element_code out nocopy varchar2,
4213 p_position_title out nocopy varchar2,
4214 p_position_number out nocopy varchar2,
4215 p_position_seq_no out nocopy varchar2) is
4216 l_proc varchar2(72) := g_package || '.get_sub_element_code_pos_title';
4217 begin
4218 g_proc := 'get_sub_element_code_pos_title';
4219 hr_utility.set_location('Entering ' || l_proc,5);
4220 p_sub_element_code := ghr_api.get_position_agency_code_pos
4221 (p_position_id,p_business_group_id,p_effective_date);
4222
4223 p_position_title := ghr_api.get_position_title_pos
4224 (p_position_id => p_position_id
4225 ,p_business_group_id => p_business_group_id
4226 ,p_effective_date => p_effective_date ) ;
4227
4228 if p_person_id is not null then
4229 p_position_number := ghr_api.get_position_description_no
4230 (p_person_id => p_person_id
4231 ,p_assignment_id => p_assignment_id
4232 ,p_effective_date => p_effective_date
4233 );
4234
4235 p_position_seq_no := ghr_api.get_position_sequence_no
4236 (p_person_id => p_person_id
4237 ,p_assignment_id => p_assignment_id
4238 ,p_effective_date => p_effective_date
4239 );
4240 end if;
4241
4242 hr_utility.set_location('Exiting ' || l_proc,10);
4243 end get_sub_element_code_pos_title;
4244
4245 --
4246 -- Get all details for the reporting...
4247 --
4248
4249 procedure get_other_dtls_for_rep(p_prd in varchar2,
4250 p_first_lac2_information1 in varchar2,
4251 p_first_lac2_information2 in varchar2,
4252 p_first_action_la_code1 out nocopy varchar2,
4253 p_first_action_la_code2 out nocopy varchar2,
4254 p_remark_code1 out nocopy varchar2,
4255 p_remark_code2 out nocopy varchar2
4256 ) is
4257 l_proc varchar2(72) := g_package || '.get_other_dtls_for_rep';
4258 BEGIN
4259 g_proc := 'get_other_dtls_for_rep';
4260 hr_utility.set_location('Entering ' || l_proc,5);
4261 p_first_action_la_code1 := 'QWM';
4262 p_first_action_la_code2 := 'ZLM';
4263
4264 /**
4265 If p_prd in ('A','B','E','F') then -- retained grade
4266 p_first_action_la_code1 := 'QWM';
4267 p_first_action_la_code2 := 'ZLM';
4268 p_remark_code1 := 'X44';
4269 Elsif p_prd in ('3','J','K') then -- retained pay
4270 p_first_action_la_code1 := 'QWM';
4271 p_first_action_la_code2 := 'ZLM';
4272 p_remark_code1 := 'X40';
4273 Elsif p_prd in ('U','V') then -- pay and grade
4274 p_first_action_la_code1 := 'QWM';
4275 p_first_action_la_code2 := 'ZLM';
4276 p_remark_code1 := 'X40';
4277 p_remark_code2 := 'X44';
4278 Else
4279 p_first_action_la_code1 := 'QWM';
4280 p_first_action_la_code2 := 'ZLM';
4281 End if;
4282 */
4283
4284 hr_utility.set_location('Exiting ' || l_proc,10);
4285
4286 exception
4287 when msl_error then raise;
4288 when others then
4289 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
4290 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
4291 raise msl_error;
4292 END get_other_dtls_for_rep;
4293
4294 --
4295 --
4296 --
4297
4298 procedure create_mass_act_prev (
4299 p_effective_date in date,
4300 p_date_of_birth in date,
4301 p_full_name in varchar2,
4302 p_national_identifier in varchar2,
4303 p_duty_station_code in varchar2,
4304 p_duty_station_desc in varchar2,
4305 p_personnel_office_id in varchar2,
4306 p_basic_pay in number,
4307 p_new_basic_pay in number,
4308 -- Bug#2383992
4309 p_adj_basic_pay in number,
4310 p_new_adj_basic_pay in number,
4311 -- Bug#2383992
4312 p_old_avail_pay in number,
4313 p_new_avail_pay in number,
4314 p_old_loc_diff in number,
4315 p_new_loc_diff in number,
4316 p_tot_old_sal in number,
4317 p_tot_new_sal in number,
4318 p_old_auo_pay in number,
4319 p_new_auo_pay in number,
4320 p_position_id in per_assignments_f.position_id%type,
4321 p_position_title in varchar2,
4322 -- FWFA Changes Bug#4444609
4323 p_position_number in varchar2,
4324 p_position_seq_no in varchar2,
4325 -- FWFA Changes
4326 p_org_structure_id in varchar2,
4327 p_agency_sub_element_code in varchar2,
4328 p_person_id in number,
4329 p_mass_salary_id in number,
4330 p_sel_flg in varchar2,
4331 p_first_action_la_code1 in varchar2,
4332 p_first_action_la_code2 in varchar2,
4333 p_remark_code1 in varchar2,
4334 p_remark_code2 in varchar2,
4335 p_grade_or_level in varchar2,
4336 p_step_or_rate in varchar2,
4337 p_pay_plan in varchar2,
4338 p_pay_rate_determinant in varchar2,
4339 p_tenure in varchar2,
4340 p_action in varchar2,
4341 p_assignment_id in number,
4342 p_old_other_pay in number,
4343 p_new_other_pay in number,
4344 -- Bug#2383992
4345 p_old_capped_other_pay in number,
4346 p_new_capped_other_pay in number,
4347 p_old_retention_allowance in number,
4348 p_new_retention_allowance in number,
4349 p_old_supervisory_differential in number,
4350 p_new_supervisory_differential in number,
4351 p_organization_name in varchar2,
4352 -- Bug#2383992
4353 p_increase_percent in number default null,
4354 -- FWFA Changes Bug#4444609
4355 p_input_pay_rate_determinant in varchar2,
4356 p_from_pay_table_id in number,
4357 p_to_pay_table_id in number
4358 -- FWFA Changes
4359 )
4360 is
4361
4362 l_comb_rem varchar2(30);
4363 l_proc varchar2(72) := g_package || '.create_mass_act_prev';
4364
4365 l_cust_rec ghr_mass_act_custom.ghr_mass_custom_out_rec_type;
4366 l_cust_in_rec ghr_mass_act_custom.ghr_mass_custom_in_rec_type;
4367 l_poi_desc varchar2(80);
4368 ----Temp Promo Changes.
4369 l_step_or_rate varchar2(30);
4370 l_retained_grade_rec ghr_pay_calc.retained_grade_rec_type;
4371 -- Bug# 4126137,4179270,4086677
4372 l_check_grade_retention VARCHAR2(200);
4373
4374 begin
4375 g_proc := 'create_mass_act_prev';
4376 hr_utility.set_location('Entering ' || l_proc,5);
4377 if p_remark_code2 is not null then
4378 l_comb_rem := p_remark_code1||', '||p_remark_code2;
4379 else
4380 l_comb_rem := p_remark_code1;
4381 end if;
4382
4383 l_poi_desc := GHR_MRE_PKG.GET_POI_NAME (p_personnel_office_id);
4384
4385 BEGIN
4386 l_cust_in_rec.person_id := p_person_id;
4387 l_cust_in_rec.position_id := p_position_id;
4388 l_cust_in_rec.assignment_id := p_assignment_id;
4389 l_cust_in_rec.national_identifier := p_national_identifier;
4390 l_cust_in_rec.mass_action_type := 'SALARY';
4391 l_cust_in_rec.mass_action_id := p_mass_salary_id;
4392 l_cust_in_rec.effective_date := p_effective_date;
4393
4394 GHR_MASS_ACT_CUSTOM.pre_insert (
4395 p_cust_in_rec => l_cust_in_rec,
4396 p_cust_rec => l_cust_rec);
4397
4398 exception
4399 when others then
4400 hr_utility.set_location('Error in Mass Act Custom '||
4401 'Err is '||sqlerrm(sqlcode),20);
4402 l_mslerrbuf := 'Error in Mass Act Custom '||
4403 'Err is '|| sqlerrm(sqlcode);
4404 raise msl_error;
4405 END;
4406
4407 l_step_or_rate := p_step_or_rate;
4408
4409 IF p_pay_rate_determinant in ('A','B','E','F') THEN
4410
4411 -- Bug#4179270,4126137,4086677 Modified the following IF Condition.
4412 l_check_grade_retention := CHECK_GRADE_RETENTION(p_pay_rate_determinant,p_person_id,p_effective_date);
4413 IF l_check_grade_retention = 'REGULAR' THEN
4414 BEGIN
4415 l_retained_grade_rec :=
4416 ghr_pc_basic_pay.get_retained_grade_details
4417 ( p_person_id,
4418 p_effective_date);
4419 if l_retained_grade_rec.temp_step is not null then
4420 l_step_or_rate := l_retained_grade_rec.temp_step;
4421 end if;
4422 EXCEPTION
4423 when others then
4424 l_mslerrbuf := 'Preview - Others error in Get retained grade '||
4425 'Error is '||' Sql Err is '|| sqlerrm(sqlcode);
4426 ghr_mre_pkg.pr('Person ID '||to_char(p_person_id),'ERROR 2',l_mslerrbuf);
4427 raise msl_error;
4428 END;
4429 ELSIF l_check_grade_retention ='MSL_ERROR' THEN
4430 hr_utility.set_message(8301,'GHR_38927_MISSING_MA_RET_DET');
4431 raise msl_error;
4432 ELSIF l_check_grade_retention = 'OTHER_ERROR' THEN
4433 l_mslerrbuf := 'Others error in check_grade_retention function while fetching retained grade record. Please
4434 verify the retained grade record';
4435 raise msl_error;
4436 END IF;
4437 END IF;
4438
4439 insert into GHR_MASS_ACTIONS_PREVIEW
4440 (
4441 mass_action_type,
4442 --report_type,
4443 ui_type,
4444 session_id,
4445 effective_date,
4446 employee_date_of_birth,
4447 full_name,
4448 national_identifier,
4449 duty_station_code,
4450 duty_station_desc,
4451 personnel_office_id,
4452 from_basic_pay,
4453 to_basic_pay,
4454 -- Bug#2383992
4455 from_adj_basic_pay ,
4456 to_adj_basic_pay ,
4457 -- Bug#2383992
4458 from_availability_pay,
4459 to_availability_pay,
4460 from_locality_adj,
4461 to_locality_adj,
4462 from_total_salary,
4463 to_total_salary,
4464 from_auo_pay,
4465 to_auo_pay,
4466 from_other_pay,
4467 to_other_pay,
4468 -- Bug#2383992
4469 from_capped_other_pay,
4470 to_capped_other_pay,
4471 from_retention_allowance,
4472 to_retention_allowance,
4473 from_supervisory_differential ,
4474 to_supervisory_differential ,
4475 -- Bug#2383992
4476 position_id,
4477 position_title,
4478 -- FWFA Changes Bug#4444609
4479 position_number,
4480 position_seq_no,
4481 -- FWFA Changes
4482 org_structure_id,
4483 agency_code,
4484 person_id,
4485 select_flag,
4486 first_noa_code,
4487 first_action_la_code1,
4488 first_action_la_code2,
4489 grade_or_level,
4490 step_or_rate,
4491 pay_plan,
4492 pay_rate_determinant,
4493 tenure,
4494 POI_DESC,
4495 organization_name,
4496 -- FWFA Changes Bug#4444609
4497 input_pay_rate_determinant,
4498 from_pay_table_identifier,
4499 to_pay_table_identifier,
4500 -- FWFA Changes
4501 USER_ATTRIBUTE1,
4502 USER_ATTRIBUTE2,
4503 USER_ATTRIBUTE3,
4504 USER_ATTRIBUTE4,
4505 USER_ATTRIBUTE5,
4506 USER_ATTRIBUTE6,
4507 USER_ATTRIBUTE7,
4508 USER_ATTRIBUTE8,
4509 USER_ATTRIBUTE9,
4510 USER_ATTRIBUTE10,
4511 USER_ATTRIBUTE11,
4512 USER_ATTRIBUTE12,
4513 USER_ATTRIBUTE13,
4514 USER_ATTRIBUTE14,
4515 USER_ATTRIBUTE15,
4516 USER_ATTRIBUTE16,
4517 USER_ATTRIBUTE17,
4518 USER_ATTRIBUTE18,
4519 USER_ATTRIBUTE19,
4520 USER_ATTRIBUTE20,
4521 increase_percent
4522 )
4523 values
4524 (
4525 'SALARY',
4526 /*--decode(p_action,'REPORT',userenv('SESSIONID'),p_mass_realignment_id),*/
4527 decode(p_action,'SHOW','FORM','REPORT'),
4528 userenv('SESSIONID'),
4529 p_effective_date,
4530 p_date_of_birth,
4531 p_full_name,
4532 p_national_identifier,
4533 p_duty_station_code,
4534 p_duty_station_desc,
4535 p_personnel_office_id,
4536 p_basic_pay,
4537 p_new_basic_pay,
4538 -- Bug#2383992
4539 p_adj_basic_pay ,
4540 p_new_adj_basic_pay ,
4541 -- Bug#2383992
4542 p_old_avail_pay,
4543 p_new_avail_pay,
4544 p_old_loc_diff,
4545 p_new_loc_diff,
4546 p_tot_old_sal,
4547 p_tot_new_sal,
4548 p_old_auo_pay,
4549 p_new_auo_pay,
4550 p_old_other_pay, ----------- nvl(p_old_auo_pay,0)+ nvl(p_old_avail_pay,0),
4551 p_new_other_pay, ----------- nvl(p_new_auo_pay,0)+ nvl(p_new_avail_pay,0),
4552 -- Bug#2383992
4553 p_old_capped_other_pay,
4554 p_new_capped_other_pay,
4555 p_old_retention_allowance,
4556 p_new_retention_allowance,
4557 p_old_supervisory_differential ,
4558 p_new_supervisory_differential ,
4559 -- Bug#2383992
4560 p_position_id,
4561 p_position_title,
4562 -- FWFA Changes Bug#4444609
4563 p_position_number,
4564 p_position_seq_no,
4565 -- FWFA Changes
4566 p_org_structure_id,
4567 p_agency_sub_element_code,
4568 p_person_id,
4569 p_sel_flg,
4570 nvl(g_first_noa_code,'894'),
4571 p_first_action_la_code1,
4572 p_first_action_la_code2,
4573 p_grade_or_level,
4574 l_step_or_rate,
4575 p_pay_plan,
4576 p_pay_rate_determinant,
4577 p_tenure,
4578 l_poi_desc,
4579 p_organization_name,
4580 -- FWFA Changes Bug#4444609
4581 p_input_pay_rate_determinant,
4582 p_from_pay_table_id,
4583 p_to_pay_table_id,
4584 -- FWFA Changes
4585 l_cust_rec.user_attribute1,
4586 l_cust_rec.user_attribute2,
4587 l_cust_rec.user_attribute3,
4588 l_cust_rec.user_attribute4,
4589 l_cust_rec.user_attribute5,
4590 l_cust_rec.user_attribute6,
4591 l_cust_rec.user_attribute7,
4592 l_cust_rec.user_attribute8,
4593 l_cust_rec.user_attribute9,
4594 l_cust_rec.user_attribute10,
4595 l_cust_rec.user_attribute11,
4596 l_cust_rec.user_attribute12,
4597 l_cust_rec.user_attribute13,
4598 l_cust_rec.user_attribute14,
4599 l_cust_rec.user_attribute15,
4600 l_cust_rec.user_attribute16,
4601 l_cust_rec.user_attribute17,
4602 l_cust_rec.user_attribute18,
4603 l_cust_rec.user_attribute19,
4604 l_cust_rec.user_attribute20,
4605 p_increase_percent
4606 );
4607
4608 hr_utility.set_location('Exiting ' || l_proc,10);
4609 exception
4610 when msl_error then raise;
4611 when others then
4612 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
4613 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
4614 raise msl_error;
4615 end create_mass_act_prev;
4616
4617 --
4618 --
4619 --
4620
4621 procedure get_lac_dtls
4622 (p_pa_request_id in number,
4623 p_sf52_rec out nocopy ghr_pa_requests%rowtype) IS
4624
4625 l_proc varchar2(72) := g_package || '.get_lac_dtls';
4626
4627 cursor cur_pa_req_cur is
4628 select * from ghr_pa_requests
4629 where pa_request_id = p_pa_request_id;
4630
4631 begin
4632 g_proc := 'get_lac_dtls';
4633 hr_utility.set_location('Entering ' || l_proc,5);
4634
4635 pr('Entering '||l_proc||' Pa req id ',to_char(p_pa_request_id));
4636 if p_pa_request_id is null then
4637 pr('PA request id is null.................');
4638 else
4639
4640 for cur_pa_rec in cur_pa_req_cur
4641 loop
4642 p_sf52_rec := cur_pa_rec;
4643 exit;
4644 end loop;
4645 end if;
4646
4647 hr_utility.set_location('Exiting ' || l_proc,10);
4648 exception
4649 when others then
4650 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
4651 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
4652 raise msl_error;
4653 end get_lac_dtls;
4654
4655 --
4656 --
4657 --
4658
4659 procedure create_lac_remarks
4660 (p_pa_request_id in number,
4661 p_new_pa_request_id in number) is
4662
4663 l_proc varchar2(72) := g_package || '.create_lac_remarks';
4664
4665 cursor cur_pa_rem_cur is
4666 select * from ghr_pa_remarks
4667 where pa_request_id = p_pa_request_id;
4668
4669 l_remarks_rec ghr_pa_remarks%rowtype;
4670
4671 begin
4672 g_proc := 'create_lac_remarks';
4673 hr_utility.set_location('Entering ' || l_proc,5);
4674
4675 pr('Inside '||l_proc,to_char(p_pa_request_id),to_char(p_new_pa_request_id));
4676
4677 FOR CUR_PA_REM_rec in cur_pa_rem_cur
4678 loop
4679
4680 l_remarks_rec := cur_pa_rem_rec;
4681
4682 pr('Rem id '||to_char(l_remarks_rec.remark_id));
4683 ghr_pa_remarks_api.create_pa_remarks
4684 (p_validate => false
4685 ,p_pa_request_id => p_new_pa_request_id
4686 ,p_remark_id => l_remarks_rec.remark_id
4687 ,p_description => l_remarks_rec.description
4688 ,p_remark_code_information1 => l_remarks_rec.remark_code_information1
4689 ,p_remark_code_information2 => l_remarks_rec.remark_code_information2
4690 ,p_remark_code_information3 => l_remarks_rec.remark_code_information3
4691 ,p_remark_code_information4 => l_remarks_rec.remark_code_information4
4692 ,p_remark_code_information5 => l_remarks_rec.remark_code_information5
4693 ,p_pa_remark_id => l_remarks_rec.pa_remark_id
4694 ,p_object_version_number => l_remarks_rec.object_version_number
4695 );
4696
4697 end loop;
4698
4699 hr_utility.set_location('Exiting ' || l_proc,10);
4700
4701 exception
4702 when others then
4703 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
4704 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
4705 raise msl_error;
4706 end create_lac_remarks;
4707
4708 --
4709 --
4710 --
4711
4712 procedure upd_ext_info_to_null(p_effective_date in date) is
4713
4714 cursor cur1 is
4715 select person_id
4716 FROM PER_people_EXTRA_INFO
4717 WHERE information_type = 'GHR_US_PER_MASS_ACTIONS'
4718 AND pei_INFORMATION3 IS NOT NULL;
4719
4720 l_person_id number;
4721
4722 l_proc varchar2(72) := g_package || '.upd_ext_info_to_null';
4723
4724 begin
4725 g_proc := 'upd_ext_info_to_null';
4726 hr_utility.set_location('Entering ' || l_proc,5);
4727
4728 pr('Inside '||l_proc);
4729
4730 for per_ext_rec in cur1
4731 loop
4732 l_person_id := per_ext_rec.person_id;
4733 update_sel_flg (l_person_id,p_effective_date);
4734 end loop;
4735
4736 commit;
4737
4738 pr('Exiting '||l_proc);
4739 hr_utility.set_location('Exiting ' || l_proc,10);
4740
4741 exception
4742 when msl_error then raise;
4743 when others then
4744 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
4745 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
4746 raise msl_error;
4747 end;
4748
4749 --
4750 --
4751 --
4752
4753 PROCEDURE assign_to_sf52_rec(
4754 p_person_id in number,
4755 p_first_name in varchar2,
4756 p_last_name in varchar2,
4757 p_middle_names in varchar2,
4758 p_national_identifier in varchar2,
4759 p_date_of_birth in date,
4760 p_effective_date in date,
4761 p_assignment_id in number,
4762 p_tenure in varchar2,
4763 -- Bug#5089732 Added to_grade_id, to_pay_plan,to_grade_or_level parameters.
4764 p_to_grade_id in number,
4765 p_to_pay_plan in varchar2,
4766 p_to_grade_or_level in varchar2,
4767 -- Bug#5089732
4768 p_step_or_rate in varchar2,
4769 p_annuitant_indicator in varchar2,
4770 p_pay_rate_determinant in varchar2,
4771 p_work_schedule in varchar2,
4772 p_part_time_hour in varchar2,
4773 p_flsa_category in varchar2,
4774 p_bargaining_unit_status in varchar2,
4775 p_functional_class in varchar2,
4776 p_supervisory_status in varchar2,
4777 p_basic_pay in number,
4778 p_to_locality_adj in number,
4779 p_to_adj_basic_pay in number,
4780 p_to_total_salary in number,
4781 p_from_other_pay_amount in number,
4782 p_to_other_pay_amount in number,
4783 p_to_au_overtime in number,
4784 p_to_availability_pay in number,
4785 p_to_retention_allowance in number,
4786 p_to_retention_allow_perce in number,
4787 p_to_supervisory_differential in number,
4788 p_to_supervisory_diff_perce in number,
4789 p_to_staffing_differential in number,
4790 p_duty_station_id in number,
4791 p_duty_station_code in ghr_pa_requests.duty_station_code%type,
4792 p_duty_station_desc in ghr_pa_requests.duty_station_desc%type,
4793 -- FWFA Changes Bug#4444609
4794 p_input_pay_rate_determinant in ghr_pa_requests.input_pay_rate_determinant%type,
4795 p_from_pay_table_id in ghr_pa_requests.from_pay_table_identifier%type,
4796 p_to_pay_table_id in ghr_pa_requests.to_pay_table_identifier%type,
4797 -- FWFA Changes
4798 p_lac_sf52_rec in ghr_pa_requests%rowtype,
4799 p_sf52_rec out nocopy ghr_pa_requests%rowtype) IS
4800
4801 l_proc varchar2(72) := g_package || '.assign_to_sf52_rec';
4802 begin
4803
4804 g_proc := 'assign_to_sf52_rec';
4805
4806 hr_utility.set_location('Entering ' || l_proc,5);
4807
4808 p_sf52_rec.person_id := p_person_id;
4809 p_sf52_rec.employee_first_name := p_first_name;
4810 p_sf52_rec.employee_last_name := p_last_name;
4811 p_sf52_rec.employee_middle_names := p_middle_names;
4812 p_sf52_rec.employee_national_identifier := p_national_identifier;
4813 p_sf52_rec.employee_date_of_birth := p_date_of_birth;
4814 p_sf52_rec.effective_date := p_effective_date;
4815 p_sf52_rec.employee_assignment_id := p_assignment_id;
4816 p_sf52_rec.tenure := p_tenure;
4817 -- Bug#5089732 Added to_grade_id, to_pay_plan,to_grade_or_level parameters.
4818 p_sf52_rec.to_grade_id := p_to_grade_id;
4819 p_sf52_rec.to_pay_plan := p_to_pay_plan;
4820 p_sf52_rec.to_grade_or_level := p_to_grade_or_level;
4821 -- Bug35089732
4822 p_sf52_rec.to_step_or_rate := p_step_or_rate;
4823 p_sf52_rec.annuitant_indicator := p_annuitant_indicator;
4824 p_sf52_rec.pay_rate_determinant := p_pay_rate_determinant;
4825 p_sf52_rec.work_schedule := p_work_schedule;
4826 p_sf52_rec.part_time_hours := p_part_time_hour;
4827 p_sf52_rec.flsa_category := p_flsa_category;
4828 p_sf52_rec.bargaining_unit_status := p_bargaining_unit_status;
4829 p_sf52_rec.functional_class := p_functional_class;
4830 p_sf52_rec.supervisory_status := p_supervisory_status;
4831 p_sf52_rec.to_basic_pay := p_basic_pay;
4832 p_sf52_rec.to_locality_adj := p_to_locality_adj;
4833 p_sf52_rec.to_adj_basic_pay := p_to_adj_basic_pay;
4834 p_sf52_rec.to_total_salary := p_to_total_salary;
4835 p_sf52_rec.from_other_pay_amount := p_from_other_pay_amount;
4836 p_sf52_rec.to_other_pay_amount := p_to_other_pay_amount;
4837 p_sf52_rec.to_au_overtime := p_to_au_overtime;
4838 p_sf52_rec.to_availability_pay := p_to_availability_pay;
4839 if p_to_retention_allowance = 0 or p_to_retention_allowance is null then
4840 p_sf52_rec.to_retention_allowance := null;
4841 else
4842 p_sf52_rec.to_retention_allowance := p_to_retention_allowance;
4843 end if;
4844 p_sf52_rec.to_retention_allow_percentage := p_to_retention_allow_perce;
4845 if p_to_supervisory_differential = 0 or p_to_supervisory_differential is null then
4846 p_sf52_rec.to_supervisory_differential := null;
4847 else
4848 p_sf52_rec.to_supervisory_differential := p_to_supervisory_differential;
4849 end if;
4850 p_sf52_rec.to_supervisory_diff_percentage := p_to_supervisory_diff_perce;
4851 p_sf52_rec.to_staffing_differential := p_to_staffing_differential;
4852 p_sf52_rec.duty_station_id := p_duty_station_id;
4853 p_sf52_rec.duty_station_code := p_duty_station_code;
4854 p_sf52_rec.duty_station_desc := p_duty_station_desc;
4855 -- FWFA Changes Bug#4444609
4856 p_sf52_rec.input_pay_rate_determinant := p_input_pay_rate_determinant;
4857 p_sf52_rec.from_pay_table_identifier := p_from_pay_table_id;
4858 p_sf52_rec.to_pay_table_identifier := p_to_pay_table_id;
4859 -- FWFA Changes
4860 p_sf52_rec.FIRST_LAC1_INFORMATION1 := p_lac_sf52_rec.FIRST_LAC1_INFORMATION1;
4861 p_sf52_rec.FIRST_LAC1_INFORMATION2 := p_lac_sf52_rec.FIRST_LAC1_INFORMATION2;
4862 p_sf52_rec.FIRST_LAC1_INFORMATION3 := p_lac_sf52_rec.FIRST_LAC1_INFORMATION3;
4863 p_sf52_rec.FIRST_LAC1_INFORMATION4 := p_lac_sf52_rec.FIRST_LAC1_INFORMATION4;
4864 p_sf52_rec.FIRST_LAC1_INFORMATION5 := p_lac_sf52_rec.FIRST_LAC1_INFORMATION5;
4865 p_sf52_rec.SECOND_LAC1_INFORMATION1 := p_lac_sf52_rec.SECOND_LAC1_INFORMATION1;
4866 p_sf52_rec.SECOND_LAC1_INFORMATION2 := p_lac_sf52_rec.SECOND_LAC1_INFORMATION2;
4867 p_sf52_rec.SECOND_LAC1_INFORMATION3 := p_lac_sf52_rec.SECOND_LAC1_INFORMATION3;
4868 p_sf52_rec.SECOND_LAC1_INFORMATION4 := p_lac_sf52_rec.SECOND_LAC1_INFORMATION4;
4869 p_sf52_rec.SECOND_LAC1_INFORMATION5 := p_lac_sf52_rec.SECOND_LAC1_INFORMATION5;
4870 p_sf52_rec.FIRST_ACTION_LA_CODE1 := p_lac_sf52_rec.FIRST_ACTION_LA_CODE1;
4871 p_sf52_rec.FIRST_ACTION_LA_CODE2 := p_lac_sf52_rec.FIRST_ACTION_LA_CODE2;
4872 p_sf52_rec.FIRST_ACTION_LA_DESC1 := p_lac_sf52_rec.FIRST_ACTION_LA_DESC1;
4873 p_sf52_rec.FIRST_ACTION_LA_DESC2 := p_lac_sf52_rec.FIRST_ACTION_LA_DESC2;
4874
4875 hr_utility.set_location('Exiting ' || l_proc,10);
4876
4877 exception
4878 when msl_error then raise;
4879 when others then
4880 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
4881 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
4882 raise msl_error;
4883 end assign_to_sf52_rec;
4884
4885 --
4886 --
4887 --
4888
4889 procedure pr (msg varchar2,par1 in varchar2 default null,
4890 par2 in varchar2 default null) is
4891 begin
4892 -- g_no := g_no +1;
4893 -- insert into l_tmp values (g_no,substr(msg||'-'||par1||' -'||par2||'-',1,199));
4894 -- DBMS_OUTPUT.PUT_LINE(msg||'-'||par1||' -'||par2||'-');
4895
4896 ghr_mto_int.put_line(msg||'-'||par1||' -'||par2||'-');
4897 exception
4898 when others then
4899 hr_utility.set_location('Error in pr '||' Err is '||sqlerrm(sqlcode),20);
4900 l_mslerrbuf := 'Error in pr Sql Err is '|| sqlerrm(sqlcode);
4901 raise msl_error;
4902 end;
4903
4904 -- 3843306
4905 -- Start of MSL Percentage Changes
4906 -- This is same as Execute_msl except for few modifications
4907 --
4908 --+-----------------------------------------------------------------+------
4909 --+ Procedure for Mass Percentage Pay Adjustmentfor Range employees +--
4910 --+ ----------------------------------------------------------------+------
4911 PROCEDURE execute_msl_perc (p_errbuf out nocopy varchar2,
4912 p_retcode out nocopy number,
4913 p_mass_salary_id in number,
4914 p_action in varchar2) is
4915 --p_bus_grp_id in number) is
4916
4917 p_mass_salary varchar2(32);
4918
4919 --
4920 --
4921 -- Main Cursor which fetches from per_assignments_f and per_people_f
4922 --
4923 --
4924 --1. Cursor with organization.
4925 ---
4926
4927
4928 cursor cur_people_org (effective_date date, p_org_id number) is
4929 select ppf.person_id PERSON_ID,
4930 ppf.first_name FIRST_NAME,
4931 ppf.last_name LAST_NAME,
4932 ppf.middle_names MIDDLE_NAMES,
4933 ppf.full_name FULL_NAME,
4934 ppf.date_of_birth DATE_OF_BIRTH,
4935 ppf.national_identifier NATIONAL_IDENTIFIER,
4936 paf.position_id POSITION_ID,
4937 paf.assignment_id ASSIGNMENT_ID,
4938 paf.grade_id GRADE_ID,
4939 paf.job_id JOB_ID,
4940 paf.location_id LOCATION_ID,
4941 paf.organization_id ORGANIZATION_ID,
4942 paf.business_group_id BUSINESS_GROUP_ID,
4943 paf.assignment_status_type_id ASSIGNMENT_STATUS_TYPE_ID
4944 from per_assignments_f paf,
4945 per_people_f ppf,
4946 per_person_types ppt
4947 where ppf.person_id = paf.person_id
4948 and effective_date between ppf.effective_start_date and ppf.effective_end_date
4949 and effective_date between paf.effective_start_date and paf.effective_end_date
4950 and paf.primary_flag = 'Y'
4951 and paf.assignment_type <> 'B'
4952 and ppf.person_type_id = ppt.person_type_id
4953 and ppt.system_person_type IN ('EMP','EMP_APL')
4954 and paf.organization_id = p_org_id
4955 and paf.position_id is not null
4956 order by ppf.person_id;
4957
4958 ---
4959 --- Bug 3539816 Order by added to prevent snapshot old error
4960 --- 2. Cursor with no organization.
4961 ---
4962 --- This SQL is tuned by joining the hr_organization_units to avoid the FTS of PAF.
4963 --- Bug 6152582
4964 ---
4965 cursor cur_people (effective_date date) is
4966 select ppf.person_id PERSON_ID,
4967 ppf.first_name FIRST_NAME,
4968 ppf.last_name LAST_NAME,
4969 ppf.middle_names MIDDLE_NAMES,
4970 ppf.full_name FULL_NAME,
4971 ppf.date_of_birth DATE_OF_BIRTH,
4972 ppf.national_identifier NATIONAL_IDENTIFIER,
4973 paf.position_id POSITION_ID,
4974 paf.assignment_id ASSIGNMENT_ID,
4975 paf.grade_id GRADE_ID,
4976 paf.job_id JOB_ID,
4977 paf.location_id LOCATION_ID,
4978 paf.organization_id ORGANIZATION_ID,
4979 paf.business_group_id BUSINESS_GROUP_ID,
4980 paf.assignment_status_type_id ASSIGNMENT_STATUS_TYPE_ID
4981 from per_assignments_f paf,
4982 per_people_f ppf,
4983 per_person_types ppt,
4984 hr_organization_units hou
4985 where ppf.person_id = paf.person_id
4986 and effective_date between ppf.effective_start_date and ppf.effective_end_date
4987 and effective_date between paf.effective_start_date and paf.effective_end_date
4988 and paf.primary_flag = 'Y'
4989 and paf.assignment_type <> 'B'
4990 and ppf.person_type_id = ppt.person_type_id
4991 and ppt.system_person_type IN ('EMP','EMP_APL')
4992 and paf.organization_id = hou.organization_id
4993 and paf.position_id is not null
4994 order by ppf.person_id;
4995 --
4996 -- Check assignment_status_type
4997 --
4998
4999 cursor cur_ast (asg_status_type_id number) is
5000 select user_status from per_assignment_status_types
5001 where assignment_status_type_id = asg_status_type_id
5002 and upper(user_status) not in (
5003 'TERMINATE ASSIGNMENT', /* 3 */
5004 'ACTIVE APPLICATION', /* 4 */
5005 'OFFER', /* 5 */
5006 'ACCEPTED', /* 6 */
5007 'TERMINATE APPLICATION', /* 7 */
5008 'END', /* 8 */
5009 'TERMINATE APPOINTMENT', /* 126 */
5010 'SEPARATED'); /* 132 */
5011
5012 --
5013 -- Cursor to select from GHR_MASS_SALARIES - Where criteria is stored
5014 -- Before executing this package
5015 -- from ghr_mass_salary_criteria
5016
5017 cursor ghr_msl (p_msl_id number) is
5018 select name, effective_date, mass_salary_id, user_table_id, submit_flag,
5019 executive_order_number, executive_order_date, ROWID, PA_REQUEST_ID,
5020 ORGANIZATION_ID, DUTY_STATION_ID, PERSONNEL_OFFICE_ID,
5021 AGENCY_CODE_SUBELEMENT, OPM_ISSUANCE_NUMBER, OPM_ISSUANCE_DATE, PROCESS_TYPE
5022 from ghr_mass_salaries
5023 where MASS_SALARY_ID = p_msl_id
5024 for update of user_table_id nowait;
5025
5026 -- VSM [family name was hardcoded previously to SALARY_CHG. Fetching it from DB now]
5027 /*cursor get_sal_chg_fam is
5028 select NOA_FAMILY_CODE
5029 from ghr_families
5030 where NOA_FAMILY_CODE in
5031 (select NOA_FAMILY_CODE from ghr_noa_families
5032 where nature_of_action_id =
5033 (select nature_of_action_id
5034 from ghr_nature_of_actions
5035 where code = '894')
5036 ) and proc_method_flag = 'Y'; --AVR 13-JAN-99 */
5037 ------------- ) and update_hr_flag = 'Y';
5038
5039 l_assignment_id per_assignments_f.assignment_id%type;
5040 l_position_id per_assignments_f.position_id%type;
5041 l_grade_id per_assignments_f.grade_id%type;
5042 l_business_group_id per_assignments_f.business_group_id%type;
5043
5044 l_position_title varchar2(300);
5045 l_position_number varchar2(20);
5046 l_position_seq_no varchar2(20);
5047
5048 l_msl_cnt number := 0;
5049 l_recs_failed number := 0;
5050
5051 l_tenure varchar2(35);
5052 l_annuitant_indicator varchar2(35);
5053 l_pay_rate_determinant varchar2(35);
5054 l_work_schedule varchar2(35);
5055 l_part_time_hour varchar2(35);
5056 l_pay_table_id number;
5057 l_pay_plan varchar2(30);
5058 l_grade_or_level varchar2(30);
5059 l_step_or_rate varchar2(30);
5060 l_pay_basis varchar2(30);
5061 l_location_id number;
5062 l_duty_station_id number;
5063 l_duty_station_desc ghr_pa_requests.duty_station_desc%type;
5064 l_duty_station_code ghr_pa_requests.duty_station_code%type;
5065 l_effective_date date;
5066 l_personnel_office_id varchar2(300);
5067 l_org_structure_id varchar2(300);
5068 l_sub_element_code varchar2(300);
5069
5070 l_old_basic_pay number;
5071 l_old_avail_pay number;
5072 l_old_loc_diff number;
5073 l_tot_old_sal number;
5074 l_old_auo_pay number;
5075 l_old_ADJ_basic_pay number;
5076 l_other_pay number;
5077
5078
5079 l_auo_premium_pay_indicator varchar2(30);
5080 l_ap_premium_pay_indicator varchar2(30);
5081 l_retention_allowance number;
5082 l_retention_allow_perc number; ---AVR
5083 l_new_retention_allowance number; ---AVR
5084 l_supervisory_differential number;
5085 l_supervisory_diff_perc number; ---AVR
5086 l_new_supervisory_differential number; ---AVR
5087 l_staffing_differential number;
5088
5089 l_new_avail_pay number;
5090 l_new_loc_diff number;
5091 l_tot_new_sal number;
5092 l_new_auo_pay number;
5093
5094 l_new_basic_pay number;
5095 l_new_locality_adj number;
5096 l_new_adj_basic_pay number;
5097 l_new_total_salary number;
5098 l_new_other_pay_amount number;
5099 l_new_au_overtime number;
5100 l_new_availability_pay number;
5101 l_out_step_or_rate varchar2(30);
5102 l_out_pay_rate_determinant varchar2(30);
5103 l_PT_eff_start_date date;
5104 l_open_pay_fields boolean;
5105 l_message_set boolean;
5106 l_calculated boolean;
5107
5108 l_mass_salary_id number;
5109 l_user_table_id number;
5110 l_submit_flag varchar2(2);
5111 l_executive_order_number ghr_mass_salaries.executive_order_number%TYPE;
5112 l_executive_order_date ghr_mass_salaries.executive_order_date%TYPE;
5113 l_opm_issuance_number ghr_mass_salaries.opm_issuance_number%TYPE;
5114 l_opm_issuance_date ghr_mass_salaries.opm_issuance_date%TYPE;
5115 l_pa_request_id number;
5116 l_rowid varchar2(30);
5117
5118 l_p_ORGANIZATION_ID number;
5119 l_p_DUTY_STATION_ID number;
5120 l_p_PERSONNEL_OFFICE_ID varchar2(5);
5121
5122 L_row_cnt number := 0;
5123
5124 l_sf52_rec ghr_pa_requests%rowtype;
5125 l_lac_sf52_rec ghr_pa_requests%rowtype;
5126 l_errbuf varchar2(2000);
5127
5128 l_retcode number;
5129
5130 l_pos_ei_data per_position_extra_info%rowtype;
5131 l_pos_grp1_rec per_position_extra_info%rowtype;
5132
5133 l_pay_calc_in_data ghr_pay_calc.pay_calc_in_rec_type;
5134 l_pay_calc_out_data ghr_pay_calc.pay_calc_out_rec_type;
5135 l_sel_flg varchar2(2);
5136
5137 l_first_action_la_code1 varchar2(30);
5138 l_first_action_la_code2 varchar2(30);
5139
5140 l_remark_code1 varchar2(30);
5141 l_remark_code2 varchar2(30);
5142 l_p_AGENCY_CODE_SUBELEMENT varchar2(30);
5143
5144 ----Pay cap variables
5145 l_entitled_other_pay NUMBER;
5146 l_capped_other_pay NUMBER;
5147 l_adj_basic_message BOOLEAN := FALSE;
5148 l_pay_cap_message BOOLEAN := FALSE;
5149 l_temp_retention_allowance NUMBER;
5150 l_open_pay_fields_caps BOOLEAN;
5151 l_message_set_caps BOOLEAN;
5152 l_total_pay_check VARCHAR2(1);
5153 l_comment VARCHAR2(150);
5154 l_comment_sal VARCHAR2(150);
5155 l_pay_sel VARCHAR2(1) := NULL;
5156 l_old_capped_other_pay NUMBER;
5157 ----
5158 l_row_low NUMBER;
5159 l_row_high NUMBER;
5160 l_comment_range VARCHAR2(150);
5161 l_comments VARCHAR2(150);
5162
5163 REC_BUSY exception;
5164 pragma exception_init(REC_BUSY,-54);
5165
5166 l_proc varchar2(72) := g_package || '.execute_msl_perc';
5167
5168 cursor c_pay_tab_essl is
5169 select 1 from pay_user_tables
5170 where substr(user_table_name,1,4) = 'ESSL'
5171 and user_table_id = l_user_table_id;
5172
5173 l_essl_table BOOLEAN := FALSE;
5174 l_org_name hr_organization_units.name%type;
5175
5176 -- Bug 3315432 Madhuri
5177 --
5178 CURSOR cur_pp_prd_per_gr(p_msl_id ghr_mass_salary_criteria.mass_salary_id%type)
5179 IS
5180 SELECT criteria.pay_plan pay_plan,
5181 criteria.pay_rate_determinant prd,
5182 ext.increase_percent percent,
5183 ext.grade grade
5184 FROM ghr_mass_salary_criteria criteria, ghr_mass_salary_criteria_ext ext
5185 WHERE criteria.mass_salary_id=p_msl_id
5186 AND criteria.mass_salary_criteria_id=ext.mass_salary_criteria_id;
5187
5188
5189 rec_pp_prd_per_gr pp_prd_per_gr;
5190
5191 l_index NUMBER:=1;
5192 l_cnt NUMBER;
5193 l_increase_percent NUMBER;
5194 l_cust_percent NUMBER;
5195 l_elig_flag BOOLEAN := FALSE;
5196 --
5197 -- Defining the record type variable
5198 --
5199 l_pay_calc_msl_percentage ghr_mass_salary_criteria_ext.increase_percent%type;
5200 l_ses_basic_pay NUMBER;
5201 --
5202 --
5203
5204 --
5205 -- GPPA Update 46
5206 --
5207 cursor cur_eq_ppl (c_pay_plan ghr_pay_plans.pay_plan%type)
5208 IS
5209 select EQUIVALENT_PAY_PLAN
5210 from ghr_pay_plans
5211 where pay_plan = c_pay_plan;
5212
5213 l_eq_pay_plan ghr_pay_plans.equivalent_pay_plaN%type;
5214
5215 --
5216 --
5217 PROCEDURE msl_perc_process(p_assignment_id per_assignments_f.assignment_id%TYPE
5218 ,p_person_id per_assignments_f.person_id%TYPE
5219 ,p_position_id per_assignments_f.position_id%TYPE
5220 ,p_grade_id per_assignments_f.grade_id%TYPE
5221 ,p_business_group_id per_assignments_f.business_group_iD%TYPE
5222 ,p_location_id per_assignments_f.location_id%TYPE
5223 ,p_organization_id per_assignments_f.organization_id%TYPE
5224 ,p_date_of_birth date
5225 ,p_first_name per_people_f.first_name%TYPE
5226 ,p_last_name per_people_f.last_name%TYPE
5227 ,p_full_name per_people_f.full_name%TYPE
5228 ,p_middle_names per_people_f.middle_names%TYPE
5229 ,p_national_identifier per_people_f.national_identifier%TYPE
5230 ,p_personnel_office_id IN VARCHAR2
5231 ,p_org_structure_id IN VARCHAR2
5232 ,p_position_title IN VARCHAR2
5233 ,p_position_number IN VARCHAR2
5234 ,p_position_seq_no IN VARCHAR2
5235 ,p_subelem_code IN VARCHAR2
5236 ,p_duty_station_id IN ghr_duty_stations_f.duty_station_id%TYPE
5237 ,p_tenure IN VARCHAR2
5238 ,p_annuitant_indicator IN VARCHAR2
5239 ,p_pay_rate_determinant IN VARCHAR2
5240 ,p_work_schedule IN VARCHAR2
5241 ,p_part_time_hour IN VARCHAR2
5242 ,p_pay_plan IN VARCHAR2
5243 ,p_pay_table_id IN NUMBER
5244 ,p_grade_or_level IN VARCHAR2
5245 ,p_step_or_rate IN VARCHAR2
5246 ,p_pay_basis IN VARCHAR2
5247 ,p_increase_percent IN VARCHAR2
5248 ) IS
5249
5250 -- Bug3437354
5251 CURSOR cur_valid_DS(p_ds_id NUMBER)
5252 IS
5253 SELECT effective_end_date end_date
5254 FROM ghr_duty_stations_f
5255 WHERE duty_station_id=p_ds_id
5256 AND g_effective_date between effective_start_date and effective_end_date;
5257 --7577249
5258 cursor get_sal_chg_fam is
5259 select NOA_FAMILY_CODE
5260 from ghr_families
5261 where NOA_FAMILY_CODE in
5262 (select NOA_FAMILY_CODE from ghr_noa_families
5263 where nature_of_action_id =
5264 (select nature_of_action_id
5265 from ghr_nature_of_actions
5266 where code = nvl(g_first_noa_code,'894') and g_effective_date between date_from and nvl(date_to,g_effective_date))
5267 ) and proc_method_flag = 'Y';
5268 --7577249
5269 l_ds_end_date ghr_duty_stations_f.effective_end_date%type;
5270
5271 BEGIN
5272 savepoint execute_msl_perc_sp;
5273 l_msl_cnt := l_msl_cnt +1;
5274 --Bug#3968005 Initialised l_sel_flg
5275 l_sel_flg := NULL;
5276 l_pay_calc_in_data := NULL;
5277 l_pay_calc_out_data := NULL;
5278
5279
5280 l_assignment_id := p_assignment_id;
5281 l_position_id := p_position_id;
5282 l_grade_id := p_grade_id;
5283 l_business_group_id := p_business_group_iD;
5284 l_location_id := p_location_id;
5285
5286 -- Bug#5063304
5287 l_personnel_office_id := p_personnel_office_id;
5288 l_org_structure_id := p_org_structure_id;
5289 l_position_title := p_position_title;
5290 l_position_number := p_position_number;
5291 l_position_seq_no := p_position_seq_no;
5292 l_sub_element_code := p_subelem_code;
5293 l_duty_station_id := p_duty_station_id;
5294 l_tenure := p_tenure;
5295 l_annuitant_indicator := p_annuitant_indicator;
5296 l_pay_rate_determinant := p_pay_rate_determinant;
5297 l_work_schedule := P_work_schedule;
5298 l_part_time_hour := p_part_time_hour;
5299 l_pay_plan := p_pay_plan;
5300 l_pay_table_id := p_pay_table_id;
5301 l_grade_or_level := p_grade_or_level;
5302 l_step_or_rate := P_step_or_rate;
5303 l_pay_basis := p_pay_basis;
5304
5305 hr_utility.set_location('The location id is:'||l_location_id,12345);
5306
5307 ghr_msl_pkg.g_first_noa_code := '894';
5308 --------GPPA Update 46 start
5309 -- ghr_msl_pkg.g_first_noa_code := NULL;
5310 FOR cur_eq_ppl_rec IN cur_eq_ppl(l_pay_plan)
5311 LOOP
5312 l_eq_pay_plan := cur_eq_ppl_rec.EQUIVALENT_PAY_PLAN;
5313 exit;
5314 END LOOP;
5315 if l_effective_date >= to_date('2007/01/07','YYYY/MM/DD') AND
5316 l_eq_pay_plan = 'GS' AND
5317 l_lac_sf52_rec.first_action_la_code1 = 'QLP' AND
5318 l_lac_sf52_rec.first_action_la_code2 = 'ZLM' THEN
5319
5320 ghr_msl_pkg.g_first_noa_code := '890';
5321
5322 end if;
5323 if l_effective_date >= to_date('2007/01/07','YYYY/MM/DD') AND
5324 l_eq_pay_plan = 'FW' AND
5325 l_lac_sf52_rec.first_action_la_code1 = 'RJR' THEN
5326
5327 ghr_msl_pkg.g_first_noa_code := '890';
5328
5329 end if;
5330 --------GPPA Update 46 end
5331
5332
5333 ---- Start of Bug #7577249
5334 IF l_essl_table and (l_eq_pay_plan = 'ES' OR l_pay_plan = 'FE') then
5335 If l_pay_plan in ('ES', 'FE', 'IE', 'EP') and
5336 l_lac_sf52_rec.first_action_la_code1 = 'Q3A' then
5337 ghr_msl_pkg.g_first_noa_code := '891';
5338 elsif l_pay_plan in ('ES', 'FE', 'IE', 'EP') and
5339 l_lac_sf52_rec.first_action_la_code1 = 'Q3B' then
5340 ghr_msl_pkg.g_first_noa_code := '892';
5341 elsif l_pay_plan in ('ES', 'FE', 'IE', 'EP') and
5342 l_lac_sf52_rec.first_action_la_code1 = 'Q3D' then
5343 ghr_msl_pkg.g_first_noa_code := '890';
5344 elsif l_pay_plan in ('ES', 'FE', 'IE', 'EP') and
5345 l_lac_sf52_rec.first_action_la_code1 = 'Q3E' then
5346 ghr_msl_pkg.g_first_noa_code := '890';
5347 end if;
5348 END IF;
5349
5350 --------end of Bug #7577249
5351
5352 -- Start of Bug3437354
5353 g_proc := 'Location Validation';
5354 IF l_location_id IS NULL THEN
5355 l_mslerrbuf := 'Error - No valid Location found, salary cannot be calculated correctly'||
5356 ' without the employee''s duty location. ';
5357 RAISE msl_error;
5358 END IF;
5359 g_proc := 'Duty Station Validation';
5360 IF l_duty_station_id IS NOT NULL THEN
5361
5362 --
5363 -- Added this condition for bug 3437354, error out the record without valid Loc id
5364 --
5365 FOR rec_ds in cur_valid_ds(l_duty_station_id)
5366 LOOP
5367 l_ds_end_date := rec_ds.end_Date;
5368 END LOOP;
5369 IF l_ds_end_date IS NULL THEN
5370 hr_utility.set_location('Under DS null check'||l_duty_station_id,12345);
5371 l_mslerrbuf := 'Error - Duty Station associated with the location is INVALID. '||
5372 'Salary cannot be calculated correctly without valid duty station. ';
5373 RAISE msl_error;
5374 END IF;
5375
5376 END IF;
5377 -- End of bug 3437354
5378
5379 /*begin
5380 ghr_pa_requests_pkg.get_SF52_loc_ddf_details
5381 (p_location_id => l_location_id
5382 ,p_duty_station_id => l_duty_station_id);
5383 exception
5384 when others then
5385 hr_utility.set_location(
5386 'Error in Ghr_pa_requests_pkg.get_sf52_loc_ddf_details'||
5387 'Err is '||sqlerrm(sqlcode),20);
5388 l_mslerrbuf := 'Error in get_sf52_loc_ddf_details '||
5389 'Sql Err is '|| sqlerrm(sqlcode);
5390 raise msl_error;
5391 end;*/
5392
5393 --
5394 -- BUG 3377958 Madhuri
5395 -- Pick the organization name
5396 --
5397 l_org_name :=GHR_MRE_PKG.GET_ORGANIZATION_NAME(p_ORGANIZATION_ID);
5398 -- BUG 3377958 Madhuri
5399 --
5400 /*get_pos_grp1_ddf(l_position_id,
5401 l_effective_date,
5402 l_pos_grp1_rec);
5403
5404 l_personnel_office_id := l_pos_grp1_rec.poei_information3;
5405 l_org_structure_id := l_pos_grp1_rec.poei_information5;
5406
5407 get_sub_element_code_pos_title(l_position_id,
5408 p_person_id,
5409 l_business_group_id,
5410 l_assignment_id,
5411 l_effective_date,
5412 l_sub_element_code,
5413 l_position_title,
5414 l_position_number,
5415 l_position_seq_no);
5416
5417 hr_utility.set_location('The duty station id is:'||l_duty_station_id,12345);
5418
5419 if check_init_eligibility(l_p_duty_station_id,
5420 l_p_PERSONNEL_OFFICE_ID,
5421 l_p_AGENCY_CODE_SUBELEMENT,
5422 l_duty_station_id,
5423 l_personnel_office_id,
5424 l_sub_element_code) then
5425
5426 hr_utility.set_location('check_init_eligibility ' || l_proc,6);
5427 -- Bug 3457205 Filter the Pay plan table id condition also b4 checking any other thing
5428 -- Moving check_eligibility to here.
5429 -- Get PRD, work schedule etc form ASG EI
5430 begin
5431 ghr_pa_requests_pkg.get_sf52_asg_ddf_details
5432 (l_assignment_id,
5433 l_effective_date,
5434 l_tenure,
5435 l_annuitant_indicator,
5436 l_pay_rate_determinant,
5437 l_work_schedule,
5438 l_part_time_hour);
5439 exception
5440 when others then
5441 hr_utility.set_location('Error in Ghr_pa_requests_pkg.get_sf52_asg_ddf_details'||
5442 'Err is '||sqlerrm(sqlcode),20);
5443 l_mslerrbuf := 'Error in get_sf52_asgddf_details Sql Err is '|| sqlerrm(sqlcode);
5444 raise msl_error;
5445 end;
5446
5447 -- Bug 3315432 Madhuri
5448 --
5449 FOR l_cnt in 1..rec_pp_prd_per_gr.COUNT LOOP
5450
5451 / * IF ( nvl(rec_pp_prd_per_gr(l_cnt).pay_plan,l_pay_plan) = l_pay_plan
5452 and nvl(rec_pp_prd_per_gr(l_cnt).prd,l_pay_rate_determinant) = l_pay_rate_determinant
5453 and l_user_table_id = nvl(l_pay_table_id,l_user_table_id) ) THEN * /
5454
5455 ---Bug 3327999 First filter the PRD. Then check for Pay plan and Pay table ID
5456 IF nvl(rec_pp_prd_per_gr(l_cnt).prd,l_pay_rate_determinant) = l_pay_rate_determinant THEN
5457 -- Get Pay table ID and other details
5458 BEGIN
5459 get_pay_plan_and_table_id(l_pay_rate_determinant,p_person_id,
5460 l_position_id,l_effective_date,
5461 l_grade_id, l_assignment_id,'SHOW',l_pay_plan,
5462 l_pay_table_id,l_grade_or_level, l_step_or_rate,
5463 l_pay_basis);
5464 EXCEPTION
5465 when msl_error then
5466 l_mslerrbuf := hr_utility.get_message;
5467 raise;
5468 END;
5469
5470 IF ( nvl(rec_pp_prd_per_gr(l_cnt).pay_plan,l_pay_plan) = l_pay_plan
5471 and l_user_table_id = nvl(l_pay_table_id,l_user_table_id) ) THEN
5472
5473 IF ( nvl(rec_pp_prd_per_gr(l_cnt).grade,l_grade_or_level)=l_grade_or_level
5474 and nvl(rec_pp_prd_per_gr(l_cnt).percent,0) <> 0 ) THEN
5475
5476
5477 IF check_eligibility(l_mass_salary_id,
5478 l_user_table_id,
5479 l_pay_table_id,
5480 l_pay_plan,
5481 l_pay_rate_determinant,
5482 p_person_id,
5483 l_effective_date,
5484 p_action) THEN
5485 hr_utility.set_location('check_eligibility ' || l_proc,8);
5486
5487 l_increase_percent := nvl(rec_pp_prd_per_gr(l_cnt).percent,0);*/
5488
5489 if upper(p_action) = 'REPORT' AND l_submit_flag = 'P' THEN
5490 -- BUG 3377958 Madhuri
5491 pop_dtls_from_pa_req(p_person_id,l_effective_date,l_mass_salary_id,l_org_name);
5492 -- BUG 3377958 Madhuri
5493 ELSE
5494 if check_select_flg_msl_perc(p_person_id,upper(p_action),
5495 l_effective_date,p_mass_salary_id,l_sel_flg,
5496 l_increase_percent ) then
5497
5498 hr_utility.set_location('check_select_flg ' || l_proc,7);
5499 begin
5500 hr_utility.set_location('The duty station name is:'||l_duty_station_code,12345);
5501 hr_utility.set_location('The duty station desc is:'||l_duty_station_desc,12345);
5502
5503 ghr_pa_requests_pkg.get_duty_station_details
5504 (p_duty_station_id => l_duty_station_id
5505 ,p_effective_date => l_effective_date
5506 ,p_duty_station_code => l_duty_station_code
5507 ,p_duty_station_desc => l_duty_station_desc);
5508 exception
5509 when others then
5510 hr_utility.set_location('Error in Ghr_pa_requests_pkg.get_duty_station_details'||
5511 'Err is '||sqlerrm(sqlcode),20);
5512 l_mslerrbuf := 'Error in get_duty_station_details Sql Err is '|| sqlerrm(sqlcode);
5513 raise msl_error;
5514
5515 end;
5516
5517 get_other_dtls_for_rep(l_pay_rate_determinant,
5518 l_executive_order_number,
5519 to_char(l_executive_order_date),
5520 l_first_action_la_code1,
5521 l_first_action_la_code2,
5522 l_remark_code1,
5523 l_remark_code2);
5524
5525 get_from_sf52_data_elements
5526 (l_assignment_id, l_effective_date,
5527 l_old_basic_pay, l_old_avail_pay,
5528 l_old_loc_diff, l_tot_old_sal,
5529 l_old_auo_pay, l_old_adj_basic_pay,
5530 l_other_pay, l_auo_premium_pay_indicator,
5531 l_ap_premium_pay_indicator,
5532 l_retention_allowance,
5533 l_retention_allow_perc,
5534 l_supervisory_differential,
5535 l_supervisory_diff_perc,
5536 l_staffing_differential);
5537
5538 --7577249 commented hardcoding and fetched the family code from DB
5539 -- as it changes the NOA code based on LAC for SES perc process.
5540 open get_sal_chg_fam;
5541 fetch get_sal_chg_fam into l_pay_calc_in_data.noa_family_code;
5542 close get_sal_chg_fam;
5543 --7577249
5544
5545 l_pay_calc_in_data.person_id := p_person_id;
5546 l_pay_calc_in_data.position_id := l_position_id;
5547 --l_pay_calc_in_data.noa_family_code := 'SALARY_CHG';
5548 --l_pay_calc_in_data.noa_family_code := 'GHR_SAL_PAY_ADJ';
5549 l_pay_calc_in_data.noa_code := nvl(g_first_noa_code,'894');
5550 l_pay_calc_in_data.second_noa_code := null;
5551 l_pay_calc_in_data.first_action_la_code1 := l_lac_sf52_rec.first_action_la_code1;
5552 l_pay_calc_in_data.effective_date := l_effective_date;
5553 l_pay_calc_in_data.pay_rate_determinant := l_pay_rate_determinant;
5554 l_pay_calc_in_data.pay_plan := l_pay_plan;
5555 l_pay_calc_in_data.grade_or_level := l_grade_or_level;
5556 l_pay_calc_in_data.step_or_rate := l_step_or_rate;
5557 l_pay_calc_in_data.pay_basis := l_pay_basis;
5558 l_pay_calc_in_data.user_table_id := l_pay_table_id;
5559 l_pay_calc_in_data.duty_station_id := l_duty_station_id;
5560 l_pay_calc_in_data.auo_premium_pay_indicator := l_auo_premium_pay_indicator;
5561 l_pay_calc_in_data.ap_premium_pay_indicator := l_ap_premium_pay_indicator;
5562 l_pay_calc_in_data.retention_allowance := l_retention_allowance;
5563 l_pay_calc_in_data.to_ret_allow_percentage := l_retention_allow_perc;
5564 l_pay_calc_in_data.supervisory_differential := l_supervisory_differential;
5565 l_pay_calc_in_data.staffing_differential := l_staffing_differential;
5566 l_pay_calc_in_data.current_basic_pay := l_old_basic_pay;
5567 l_pay_calc_in_data.current_adj_basic_pay := l_old_adj_basic_pay;
5568 l_pay_calc_in_data.current_step_or_rate := l_step_or_rate;
5569 l_pay_calc_in_data.pa_request_id := null;
5570
5571 ghr_msl_pkg.g_ses_msl_process := 'N';
5572
5573 if l_pay_plan in ('ES','EP','IE','FE') and l_essl_table then
5574 ghr_msl_pkg.g_ses_msl_process := 'Y';
5575 l_step_or_rate := '00';
5576 end if;
5577
5578 ---3843306
5579 -- Start of MSL percentage changes
5580 --
5581 --l_pay_calc_msl_percentage := rec_pp_prd_per_gr(l_cnt).percent;
5582 l_pay_calc_msl_percentage := l_increase_percent; -- Bug 3843306
5583
5584 get_extra_info_comments(p_person_id,l_effective_date,l_pay_sel,
5585 l_comments,p_mass_salary_id,l_cust_percent,l_ses_basic_pay); -- Added by AVR 3964284
5586 l_comments := NULL;
5587
5588 -- Recalculate Open range basic pay with new %.
5589 ghr_pay_calc.get_open_pay_table_values
5590 (p_user_table_id => l_pay_table_id
5591 ,p_pay_plan => l_pay_plan
5592 ,p_grade_or_level => l_grade_or_level
5593 ,p_effective_date => NVL(l_effective_date,TRUNC(sysdate))
5594 ,p_row_high => l_row_high
5595 ,p_row_low => l_row_low );
5596 -- MSL Percentage issue
5597 IF l_pay_basis='PA' THEN
5598 l_pay_calc_in_data.open_range_out_basic_pay := round(l_pay_calc_in_data.current_basic_pay *
5599 ( 1 + ( l_pay_calc_msl_percentage / 100 ) ),0);
5600 ELSIF l_pay_basis='PH' THEN
5601 l_pay_calc_in_data.open_range_out_basic_pay := round(l_pay_calc_in_data.current_basic_pay *
5602 ( 1 + ( l_pay_calc_msl_percentage / 100 ) ),2);
5603 ELSE
5604 l_pay_calc_in_data.open_range_out_basic_pay := round(l_pay_calc_in_data.current_basic_pay *
5605 ( 1 + ( l_pay_calc_msl_percentage / 100 ) ),0);
5606 END IF;
5607
5608 IF l_pay_calc_in_data.open_range_out_basic_pay < l_row_low THEN
5609 l_comment_range := 'MSL:New Basic Pay is set to table minimum ' || l_row_low;
5610 l_comments := substr(l_comments || ' ' || l_comment_range , 1,150);
5611 ins_upd_per_extra_info
5612 (p_person_id,l_effective_date, l_sel_flg, l_comments,p_mass_salary_id,l_cust_percent);
5613 l_pay_calc_in_data.open_range_out_basic_pay := l_row_low;
5614 l_comment_range:= NULL;
5615
5616 ELSIF l_pay_calc_in_data.open_range_out_basic_pay > l_row_high THEN
5617 l_comment_range := 'MSL:New Basic Pay is set to table maximum ' || l_row_high;
5618 l_comments := substr(l_comments || ' ' || l_comment_range , 1,150);
5619 ins_upd_per_extra_info
5620 (p_person_id,l_effective_date, l_sel_flg, l_comments,p_mass_salary_id,l_cust_percent);
5621 l_pay_calc_in_data.open_range_out_basic_pay := l_row_high;
5622 l_comment_range:= NULL;
5623 ELSE
5624 l_comment_range:= NULL;
5625 END IF;
5626
5627
5628 -- 3843306
5629 -- End of MSL percentage Changes
5630 begin
5631 ghr_pay_calc.sql_main_pay_calc (l_pay_calc_in_data
5632 ,l_pay_calc_out_data
5633 ,l_message_set
5634 ,l_calculated);
5635
5636 IF l_message_set THEN
5637 hr_utility.set_location( l_proc, 40);
5638 l_calculated := FALSE;
5639 l_mslerrbuf := hr_utility.get_message;
5640 -- raise msl_error;
5641 END IF;
5642 exception
5643 when msl_error then
5644 g_proc := 'ghr_pay_calc';
5645 raise;
5646 when others then
5647 ----BUG 3287299 Start
5648 IF ghr_pay_calc.gm_unadjusted_pay_flg = 'Y' then
5649 l_comment := 'MSL:Error: Unadjusted Basic Pay must be entered in Employee record.';
5650 ELSE
5651 l_comment := 'MSL:Error: See process log for details.';
5652 END IF;
5653
5654 IF upper(p_action) IN ('SHOW') THEN
5655 -- Bug#2383392
5656 create_mass_act_prev (
5657 p_effective_date => l_effective_date,
5658 p_date_of_birth => p_date_of_birth,
5659 p_full_name => p_full_name,
5660 p_national_identifier => p_national_identifier,
5661 p_duty_station_code => l_duty_station_code,
5662 p_duty_station_desc => l_duty_station_desc,
5663 p_personnel_office_id => l_personnel_office_id,
5664 p_basic_pay => l_old_basic_pay,
5665 p_new_basic_pay => null,
5666 --Bug#2383992 Added old_adj_basic_pay
5667 p_adj_basic_pay => l_old_adj_basic_pay,
5668 p_new_adj_basic_pay => null,
5669 p_old_avail_pay => l_old_avail_pay,
5670 p_new_avail_pay => null,
5671 p_old_loc_diff => l_old_loc_diff,
5672 p_new_loc_diff => null,
5673 p_tot_old_sal => l_tot_old_sal,
5674 p_tot_new_sal => null,
5675 p_old_auo_pay => l_old_auo_pay,
5676 p_new_auo_pay => null,
5677 p_position_id => l_position_id,
5678 p_position_title => l_position_title,
5679 -- FWFA Changes Bug#4444609
5680 p_position_number => l_position_number,
5681 p_position_seq_no => l_position_seq_no,
5682 -- FWFA Changes
5683 p_org_structure_id => l_org_structure_id,
5684 p_agency_sub_element_code => l_sub_element_code,
5685 p_person_id => p_person_id,
5686 p_mass_salary_id => l_mass_salary_id,
5687 p_sel_flg => l_sel_flg,
5688 p_first_action_la_code1 => l_first_action_la_code1,
5689 p_first_action_la_code2 => l_first_action_la_code2,
5690 p_remark_code1 => l_remark_code1,
5691 p_remark_code2 => l_remark_code2,
5692 p_grade_or_level => l_grade_or_level,
5693 p_step_or_rate => l_step_or_rate,
5694 p_pay_plan => l_pay_plan,
5695 p_pay_rate_determinant => NULL,
5696 p_tenure => l_tenure,
5697 p_action => p_action,
5698 p_assignment_id => l_assignment_id,
5699 p_old_other_pay => l_other_pay,
5700 p_new_other_pay => null,
5701 -- Bug#2383992
5702 p_old_capped_other_pay => NULL,
5703 p_new_capped_other_pay => NULL,
5704 p_old_retention_allowance => l_retention_allowance,
5705 p_new_retention_allowance => NULL,
5706 p_old_supervisory_differential => l_supervisory_differential,
5707 p_new_supervisory_differential => NULL,
5708 -- BUG 3377958 Madhuri
5709 p_organization_name => l_org_name,
5710 -- BUG 3377958 Madhuri
5711 -- Bug#2383992
5712 p_increase_percent => l_pay_calc_msl_percentage,
5713 -- FWFA Changes Bug#4444609
5714 p_input_pay_rate_determinant => l_pay_rate_determinant,
5715 p_from_pay_table_id => l_user_table_id,
5716 p_to_pay_table_id => null
5717 -- FWFA Changes
5718 );
5719 END IF;
5720 l_comments := substr(l_comments || ' ' || l_comment , 1,150);
5721 ins_upd_per_extra_info
5722 (p_person_id,l_effective_date, l_sel_flg, l_comments,p_mass_salary_id,l_cust_percent);
5723 l_comment := NULL;
5724 ------ BUG 3287299 End
5725 hr_utility.set_location('Error in Ghr_pay_calc.sql_main_pay_calc '||
5726 'Err is '||sqlerrm(sqlcode),20);
5727 l_mslerrbuf := 'Error in ghr_pay_calc Sql Err is '|| sqlerrm(sqlcode);
5728 g_proc := 'ghr_pay_calc';
5729 raise msl_error;
5730 end;
5731
5732 ghr_msl_pkg.g_ses_msl_process := 'N';
5733
5734 l_new_basic_pay := l_pay_calc_out_data.basic_pay;
5735 l_new_locality_adj := l_pay_calc_out_data.locality_adj;
5736 l_new_adj_basic_pay := l_pay_calc_out_data.adj_basic_pay;
5737 l_new_au_overtime := l_pay_calc_out_data.au_overtime;
5738 l_new_availability_pay := l_pay_calc_out_data.availability_pay;
5739
5740 l_out_pay_rate_determinant := l_pay_calc_out_data.out_pay_rate_determinant;
5741 l_out_step_or_rate := l_pay_calc_out_data.out_step_or_rate;
5742 l_new_retention_allowance := l_pay_calc_out_data.retention_allowance;
5743 l_new_supervisory_differential := l_supervisory_differential;
5744 l_new_other_pay_amount := l_pay_calc_out_data.other_pay_amount;
5745 l_entitled_other_pay := l_new_other_pay_amount;
5746 if l_new_other_pay_amount = 0 then
5747 l_new_other_pay_amount := null;
5748 end if;
5749 l_new_total_salary := l_pay_calc_out_data.total_salary;
5750
5751 hr_utility.set_location('retention_allowance = ' || to_char(l_retention_allowance),10);
5752 hr_utility.set_location('Supervisory Diff Amount = ' || to_char(l_supervisory_differential),10);
5753
5754
5755 -------------Call Pay cap Procedure
5756 begin
5757 l_capped_other_pay := ghr_pa_requests_pkg2.get_cop( p_assignment_id => l_assignment_id
5758 ,p_effective_date => l_effective_date);
5759 l_old_capped_other_pay := l_capped_other_pay;
5760 -- Sundar Added the following if statement to improve performance
5761 if hr_utility.debug_enabled = true then
5762 hr_utility.set_location('Before Pay Cap ' || l_proc,21);
5763 hr_utility.set_location('l_effective_date ' || l_effective_date,21);
5764 hr_utility.set_location('l_out_pay_rate_determinant ' || l_out_pay_rate_determinant,21);
5765 hr_utility.set_location('l_pay_plan ' || l_pay_plan,21);
5766 hr_utility.set_location('l_position_id ' || to_char(l_position_id),21);
5767 hr_utility.set_location('l_pay_basis ' || l_pay_basis,21);
5768 hr_utility.set_location('person_id ' || to_char(p_person_id),21);
5769 hr_utility.set_location('l_new_basic_pay ' || to_char(l_new_basic_pay),21);
5770 hr_utility.set_location('l_new_locality_adj ' || to_char(l_new_locality_adj),21);
5771 hr_utility.set_location('l_new_adj_basic_pay ' || to_char(l_new_adj_basic_pay),21);
5772 hr_utility.set_location('l_new_total_salary ' || to_char(l_new_total_salary),21);
5773 hr_utility.set_location('l_entitled_other_pay ' || to_char(l_entitled_other_pay),21);
5774 hr_utility.set_location('l_capped_other_pay ' || to_char(l_capped_other_pay),21);
5775 hr_utility.set_location('l_new_retention_allowance ' || to_char(l_new_retention_allowance),21);
5776 hr_utility.set_location('l_new_supervisory_differential ' || to_char(l_new_supervisory_differential),21);
5777 hr_utility.set_location('l_staffing_differential ' || to_char(l_staffing_differential),21);
5778 hr_utility.set_location('l_new_au_overtime ' || to_char(l_new_au_overtime),21);
5779 hr_utility.set_location('l_new_availability_pay ' || to_char(l_new_availability_pay),21);
5780 end if;
5781
5782
5783 ghr_pay_caps.do_pay_caps_main
5784 (p_pa_request_id => null
5785 ,p_effective_date => l_effective_date
5786 ,p_pay_rate_determinant => nvl(l_out_pay_rate_determinant,l_pay_rate_determinant)
5787 ,p_pay_plan => l_pay_plan
5788 ,p_to_position_id => l_position_id
5789 ,p_pay_basis => l_pay_basis
5790 ,p_person_id => p_person_id
5791 ,p_noa_code => nvl(g_first_noa_code,'894')
5792 ,p_basic_pay => l_new_basic_pay
5793 ,p_locality_adj => l_new_locality_adj
5794 ,p_adj_basic_pay => l_new_adj_basic_pay
5795 ,p_total_salary => l_new_total_salary
5796 ,p_other_pay_amount => l_entitled_other_pay
5797 ,p_capped_other_pay => l_capped_other_pay
5798 ,p_retention_allowance => l_new_retention_allowance
5799 ,p_retention_allow_percentage => l_retention_allow_perc
5800 ,p_supervisory_allowance => l_new_supervisory_differential
5801 ,p_staffing_differential => l_staffing_differential
5802 ,p_au_overtime => l_new_au_overtime
5803 ,p_availability_pay => l_new_availability_pay
5804 ,p_adj_basic_message => l_adj_basic_message
5805 ,p_pay_cap_message => l_pay_cap_message
5806 ,p_pay_cap_adj => l_temp_retention_allowance
5807 ,p_open_pay_fields => l_open_pay_fields_caps
5808 ,p_message_set => l_message_set_caps
5809 ,p_total_pay_check => l_total_pay_check);
5810
5811
5812 l_new_other_pay_amount := nvl(l_capped_other_pay,l_entitled_other_pay);
5813
5814 -- Sundar Added the following statement to improve performance
5815 if hr_utility.debug_enabled = true then
5816 hr_utility.set_location('After Pay Cap ' || l_proc,22);
5817 hr_utility.set_location('l_effective_date ' || l_effective_date,22);
5818 hr_utility.set_location('l_out_pay_rate_determinant ' || l_out_pay_rate_determinant,22);
5819 hr_utility.set_location('l_pay_plan ' || l_pay_plan,22);
5820 hr_utility.set_location('l_position_id ' || to_char(l_position_id),22);
5821 hr_utility.set_location('l_pay_basis ' || l_pay_basis,22);
5822 hr_utility.set_location('person_id ' || to_char(p_person_id),22);
5823 hr_utility.set_location('l_new_basic_pay ' || to_char(l_new_basic_pay),22);
5824 hr_utility.set_location('l_new_locality_adj ' || to_char(l_new_locality_adj),22);
5825 hr_utility.set_location('l_new_adj_basic_pay ' || to_char(l_new_adj_basic_pay),22);
5826 hr_utility.set_location('l_new_total_salary ' || to_char(l_new_total_salary),22);
5827 hr_utility.set_location('l_entitled_other_pay ' || to_char(l_entitled_other_pay),22);
5828 hr_utility.set_location('l_capped_other_pay ' || to_char(l_capped_other_pay),22);
5829 hr_utility.set_location('l_new_retention_allowance ' || to_char(l_new_retention_allowance),22);
5830 hr_utility.set_location('l_new_supervisory_differential ' || to_char(l_new_supervisory_differential),22);
5831 hr_utility.set_location('l_staffing_differential ' || to_char(l_staffing_differential),22);
5832 hr_utility.set_location('l_new_au_overtime ' || to_char(l_new_au_overtime),22);
5833 hr_utility.set_location('l_new_availability_pay ' || to_char(l_new_availability_pay),22);
5834 end if;
5835
5836 IF l_pay_cap_message THEN
5837 IF nvl(l_temp_retention_allowance,0) > 0 THEN
5838 l_comment := 'MSL: Exceeded Total Cap - reduce Retention Allow to '
5839 || to_char(l_temp_retention_allowance);
5840 l_sel_flg := 'N';
5841 ELSE
5842 l_comment := 'MSL: Exceeded Total cap - pls review.';
5843 END IF;
5844 ELSIF l_adj_basic_message THEN
5845 l_comment := 'MSL: Exceeded Adjusted Pay Cap - Locality reduced.';
5846 END IF;
5847
5848 -- Bug 2639698 Sundar
5849 IF (l_old_basic_pay > l_new_basic_pay) THEN
5850 l_comment_sal := 'MSL: From Basic Pay exceeds To Basic Pay.';
5851 END IF;
5852 -- End Bug 2639698
5853
5854 IF l_pay_cap_message or l_adj_basic_message THEN
5855 -- Bug 2639698
5856 IF (l_comment_sal IS NOT NULL) THEN
5857 l_comment := l_comment_sal || ' ' || l_comment;
5858 END IF;
5859 -- End Bug 2639698
5860 l_comments := substr(l_comments || ' ' || l_comment, 1,150);
5861 ins_upd_per_extra_info
5862 (p_person_id,l_effective_date, l_sel_flg, l_comments,p_mass_salary_id,l_cust_percent);
5863 l_comment := NULL;
5864 --------------------Bug 2639698 Sundar To add comments
5865 -- Should create comments only if comments need to be inserted
5866 ELSIF l_comment_sal IS NOT NULL THEN
5867 l_comments := substr(l_comments || ' ' || l_comment_sal, 1,150);
5868 ins_upd_per_extra_info
5869 (p_person_id,l_effective_date, l_sel_flg, l_comments,p_mass_salary_id,l_cust_percent);
5870 END IF;
5871
5872 l_comment_sal := NULL; -- bug 2639698
5873 exception
5874 when msl_error then
5875 raise;
5876 when others then
5877 hr_utility.set_location('Error in ghr_pay_caps.do_pay_caps_main ' ||
5878 'Err is '||sqlerrm(sqlcode),23);
5879 l_mslerrbuf := 'Error in do_pay_caps_main Sql Err is '|| sqlerrm(sqlcode);
5880 raise msl_error;
5881 end;
5882
5883
5884 IF upper(p_action) IN ('SHOW','REPORT') THEN
5885 -- Bug#2383392
5886 create_mass_act_prev (
5887 p_effective_date => l_effective_date,
5888 p_date_of_birth => p_date_of_birth,
5889 p_full_name => p_full_name,
5890 p_national_identifier => p_national_identifier,
5891 p_duty_station_code => l_duty_station_code,
5892 p_duty_station_desc => l_duty_station_desc,
5893 p_personnel_office_id => l_personnel_office_id,
5894 p_basic_pay => l_old_basic_pay,
5895 p_new_basic_pay => l_new_basic_pay,
5896 --Bug#2383992 Added old_adj_basic_pay
5897 p_adj_basic_pay => l_old_adj_basic_pay,
5898 p_new_adj_basic_pay => l_new_adj_basic_pay,
5899 p_old_avail_pay => l_old_avail_pay,
5900 p_new_avail_pay => l_new_availability_pay,
5901 p_old_loc_diff => l_old_loc_diff,
5902 p_new_loc_diff => l_new_locality_adj,
5903 p_tot_old_sal => l_tot_old_sal,
5904 p_tot_new_sal => l_new_total_salary,
5905 p_old_auo_pay => l_old_auo_pay,
5906 p_new_auo_pay => l_new_au_overtime,
5907 p_position_id => l_position_id,
5908 p_position_title => l_position_title,
5909 -- FWFA Changes Bug#4444609
5910 p_position_number => l_position_number,
5911 p_position_seq_no => l_position_seq_no,
5912 -- FWFA Changes
5913 p_org_structure_id => l_org_structure_id,
5914 p_agency_sub_element_code => l_sub_element_code,
5915 p_person_id => p_person_id,
5916 p_mass_salary_id => l_mass_salary_id,
5917 p_sel_flg => l_sel_flg,
5918 p_first_action_la_code1 => l_first_action_la_code1,
5919 p_first_action_la_code2 => l_first_action_la_code2,
5920 p_remark_code1 => l_remark_code1,
5921 p_remark_code2 => l_remark_code2,
5922 p_grade_or_level => l_grade_or_level,
5923 p_step_or_rate => l_step_or_rate,
5924 p_pay_plan => l_pay_plan,
5925 p_pay_rate_determinant => NVL(l_out_pay_rate_determinant,l_pay_rate_determinant),
5926 p_tenure => l_tenure,
5927 p_action => p_action,
5928 p_assignment_id => l_assignment_id,
5929 p_old_other_pay => l_other_pay,
5930 p_new_other_pay => l_new_other_pay_amount,
5931 -- Bug#2383992
5932 p_old_capped_other_pay => l_old_capped_other_pay,--NULL,
5933 p_new_capped_other_pay => l_capped_other_pay,
5934 p_old_retention_allowance => l_retention_allowance,
5935 p_new_retention_allowance => l_new_retention_allowance,
5936 p_old_supervisory_differential => l_supervisory_differential,
5937 p_new_supervisory_differential => l_new_supervisory_differential,
5938 -- BUG 3377958 Madhuri
5939 p_organization_name => l_org_name,
5940 -- Bug#2383992
5941 p_increase_percent => l_pay_calc_msl_percentage,
5942 -- FWFA Changes Bug#4444609
5943 p_input_pay_rate_determinant => l_pay_rate_determinant,
5944 p_from_pay_table_id => l_pay_calc_out_data.pay_table_id,
5945 p_to_pay_table_id => l_pay_calc_out_data.calculation_pay_table_id
5946 -- FWFA Changes
5947 );
5948
5949
5950 ELSIF upper(p_action) = 'CREATE' then
5951 BEGIN
5952 get_pay_plan_and_table_id
5953 (l_pay_rate_determinant,p_person_id,
5954 l_position_id,l_effective_date,
5955 l_grade_id, l_assignment_id,'CREATE',
5956 l_pay_plan,l_pay_table_id,
5957 l_grade_or_level, l_step_or_rate,
5958 l_pay_basis);
5959 EXCEPTION
5960 when msl_error then
5961 l_mslerrbuf := hr_utility.get_message;
5962 raise;
5963 END;
5964 assign_to_sf52_rec(
5965 p_person_id,
5966 p_first_name,
5967 p_last_name,
5968 p_middle_names,
5969 p_national_identifier,
5970 p_date_of_birth,
5971 l_effective_date,
5972 l_assignment_id,
5973 l_tenure,
5974 -- Bug#5089732
5975 l_grade_id,
5976 l_pay_plan,
5977 l_grade_or_level,
5978 -- Bug#5089732
5979 l_step_or_rate,
5980 l_annuitant_indicator,
5981 -- FWFA Changes Bug#4444609
5982 NVL(l_out_pay_rate_determinant,l_pay_rate_determinant),
5983 -- FWFA Changes
5984 l_work_schedule,
5985 l_part_time_hour,
5986 l_pos_ei_data.poei_information7, --FLSA Category
5987 l_pos_ei_data.poei_information8, --Bargaining Unit Status
5988 l_pos_ei_data.poei_information11,--Functional Class
5989 l_pos_ei_data.poei_information16,--Supervisory Status,
5990 l_new_basic_pay,
5991 l_new_locality_adj,
5992 l_new_adj_basic_pay,
5993 l_new_total_salary,
5994 l_other_pay,
5995 l_new_other_pay_amount,
5996 l_new_au_overtime,
5997 l_new_availability_pay,
5998 l_new_retention_allowance,
5999 l_retention_allow_perc,
6000 l_new_supervisory_differential,
6001 l_supervisory_diff_perc,
6002 l_staffing_differential,
6003 l_duty_station_id,
6004 l_duty_station_code,
6005 l_duty_station_desc,
6006 -- FWFA Changes Bug#4444609
6007 l_pay_rate_determinant,
6008 l_pay_calc_out_data.pay_table_id,
6009 l_pay_calc_out_data.calculation_pay_table_id,
6010 -- FWFA Changes
6011 l_lac_sf52_rec,
6012 l_sf52_rec);
6013
6014 /* Bug#3964284 Commented the following code as PAY RELATED FIELDS are already
6015 Assigned to l_sf52_rec variable in the above procedure call(i.e.assign_to_sf52_rec)
6016 */
6017
6018 BEGIN
6019
6020 l_sf52_rec.mass_action_id := p_mass_salary_id;
6021 l_sf52_rec.rpa_type := 'MPC';
6022 g_proc := 'create_sf52_recrod';
6023 ghr_mass_changes.create_sf52_for_mass_changes
6024 (p_mass_action_type => 'MASS_SALARY_CHG',
6025 p_pa_request_rec => l_sf52_rec,
6026 p_errbuf => l_errbuf,
6027 p_retcode => l_retcode);
6028
6029 ------ Added by Dinkar for List reports problem
6030 ---------------------------------------
6031 IF l_errbuf IS NULL THEN
6032 DECLARE
6033 l_pa_request_number ghr_pa_requests.request_number%TYPE;
6034 BEGIN
6035 l_pa_request_number :=
6036 l_sf52_rec.request_number||'-'||p_mass_salary_id;
6037
6038 ghr_par_upd.upd
6039 (p_pa_request_id => l_sf52_rec.pa_request_id,
6040 p_object_version_number => l_sf52_rec.object_version_number,
6041 p_request_number => l_pa_request_number
6042 );
6043 END;
6044
6045 pr('No error in create sf52 ');
6046 ghr_mto_int.log_message(
6047 p_procedure => 'Successful Completion',
6048 p_message => 'Name: '||p_full_name ||
6049 ' SSN: '|| p_national_identifier||
6050 ' Mass Salary : '||
6051 p_mass_salary ||' SF52 Successfully completed');
6052
6053 create_lac_remarks(l_pa_request_id,
6054 l_sf52_rec.pa_request_id);
6055
6056 -- Added by Enunez 11-SEP-1999
6057 IF l_lac_sf52_rec.first_action_la_code1 IS NULL THEN
6058 -- Added by Edward Nunez for 894 rules
6059 g_proc := 'Apply_894_Rules';
6060 --Bug 2012782 fix
6061 IF l_out_pay_rate_determinant IS NULL THEN
6062 l_out_pay_rate_determinant := l_pay_rate_determinant;
6063 END IF;
6064 --Bug 2012782 fix end
6065 ghr_lacs_remarks.Apply_894_Rules(
6066 l_sf52_rec.pa_request_id,
6067 l_out_pay_rate_determinant,
6068 l_pay_rate_determinant,
6069 l_out_step_or_rate,
6070 l_executive_order_number,
6071 l_executive_order_date,
6072 l_opm_issuance_number,
6073 l_opm_issuance_date,
6074 l_errbuf,
6075 l_retcode
6076 );
6077 IF l_errbuf IS NOT NULL THEN
6078 l_mslerrbuf := l_mslerrbuf || ' ' || l_errbuf || ' Sql Err is '
6079 || sqlerrm(sqlcode);
6080 RAISE msl_error;
6081 END IF;
6082 END IF; -- IF l_lac_sf52_rec.first_action_la_code1
6083 g_proc := 'update_SEL_FLG';
6084
6085 update_SEL_FLG(p_PERSON_ID,l_effective_date);
6086
6087 COMMIT;
6088 ELSE
6089 pr('Error in create sf52',l_errbuf);
6090 hr_utility.set_location('Error in '||to_char(p_position_id),20);
6091 l_recs_failed := l_recs_failed + 1;
6092 -- Error raising is not required as the error is written to process
6093 -- log in the create_sf52_for_mass_changes procedure.
6094 --raise msl_error;
6095 END IF; -- if l_errbuf is null then
6096 EXCEPTION
6097 when msl_error then raise;
6098 when others then null;
6099 l_mslerrbuf := 'Error in ghr_mass_chg.create_sf52 '||
6100 ' Sql Err is '|| sqlerrm(sqlcode);
6101 RAISE msl_error;
6102 END;
6103 END IF; -- IF upper(p_action) IN ('SHOW','REPORT') THEN
6104 END IF; -- end if for check_select_flg
6105 END IF; -- end if for p_action = 'REPORT'
6106
6107 l_row_cnt := l_row_cnt + 1;
6108 IF UPPER(p_action) <> 'CREATE' THEN
6109 IF L_row_cnt > 50 THEN
6110 COMMIT;
6111 L_row_cnt := 0;
6112 END IF;
6113 END IF;
6114 EXCEPTION
6115 WHEN MSL_ERROR THEN
6116 HR_UTILITY.SET_LOCATION('Error occurred in '||l_proc||' Sql error '||sqlerrm(sqlcode),10);
6117 begin
6118 ------ BUG 3287299 -- Not to rollback for preview.
6119 if upper(p_action) <> 'SHOW' then
6120 ROLLBACK TO execute_msl_perc_SP;
6121 end if;
6122 EXCEPTION
6123 WHEN OTHERS THEN NULL;
6124 END;
6125 l_log_text := 'Error in '||l_proc||' '||
6126 ' For Mass Salary Name : '||p_mass_salary||
6127 'Name: '|| p_full_name || ' SSN: ' || p_national_identifier ||' '||
6128 l_mslerrbuf;
6129 hr_utility.set_location('before creating entry in log file',10);
6130 l_recs_failed := l_recs_failed + 1;
6131 begin
6132 ghr_mto_int.log_message(
6133 p_procedure => g_proc,
6134 p_message => l_log_text);
6135
6136 exception
6137 when others then
6138 hr_utility.set_message(8301, 'GHR_38475_ERROR_LOG_FAILURE');
6139 hr_utility.raise_error;
6140 end;
6141 when others then
6142 HR_UTILITY.SET_LOCATION('Error (Others) occurred in '||l_proc||' Sql error '||sqlerrm(sqlcode),20);
6143 BEGIN
6144 ROLLBACK TO execute_msl_perc_SP;
6145 EXCEPTION
6146 WHEN OTHERS THEN NULL;
6147 END;
6148 l_log_text := 'Error (others) in '||l_proc||
6149 ' For Mass Salary Name : '||p_mass_salary||
6150 'Name: '|| p_full_name || ' SSN: ' || p_national_identifier ||
6151 ' Sql Err is '||sqlerrm(sqlcode);
6152 hr_utility.set_location('before creating entry in log file',20);
6153 l_recs_failed := l_recs_failed + 1;
6154 begin
6155 ghr_mto_int.log_message(
6156 p_procedure => g_proc,
6157 p_message => l_log_text);
6158
6159 exception
6160 when others then
6161 hr_utility.set_message(8301, 'Create Error Log failed');
6162 hr_utility.raise_error;
6163 end;
6164
6165
6166 END msl_perc_process;
6167
6168 BEGIN
6169
6170 g_proc := 'execute_msl_perc';
6171 hr_utility.set_location('Entering ' || l_proc,5);
6172 p_retcode := 0;
6173
6174 g_first_noa_code := null;
6175 BEGIN
6176 FOR msl IN ghr_msl (p_mass_salary_id)
6177 LOOP
6178 p_mass_salary := msl.name;
6179 l_effective_date := msl.effective_date;
6180 l_mass_salary_id := msl.mass_salary_id;
6181 l_user_table_id := msl.user_table_id;
6182 l_submit_flag := msl.submit_flag;
6183 l_executive_order_number := msl.executive_order_number;
6184 l_executive_order_date := msl.executive_order_date;
6185 l_opm_issuance_number := msl.opm_issuance_number;
6186 l_opm_issuance_date := msl.opm_issuance_date;
6187 l_pa_request_id := msl.pa_request_id;
6188 l_rowid := msl.rowid;
6189 l_p_ORGANIZATION_ID := msl.ORGANIZATION_ID;
6190 l_p_DUTY_STATION_ID := msl.DUTY_STATION_ID;
6191 l_p_PERSONNEL_OFFICE_ID := msl.PERSONNEL_OFFICE_ID;
6192 l_p_AGENCY_CODE_SUBELEMENT := msl.AGENCY_CODE_SUBELEMENT;
6193
6194 pr('Pa request id is '||to_char(l_pa_request_id));
6195 exit;
6196 END LOOP;
6197 EXCEPTION
6198 when REC_BUSY then
6199 hr_utility.set_location('Mass Salary is in use',1);
6200 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
6201 -- raise error;
6202 hr_utility.set_message(8301, 'GHR_38477_LOCK_ON_MSL');
6203 hr_utility.raise_error;
6204 --
6205 when others then
6206 hr_utility.set_location('Error in '||l_proc||' Sql err is '||sqlerrm(sqlcode),1);
6207 -- raise_application_error(-20111,'Error while selecting from Ghr Mass Salaries');
6208 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
6209 raise msl_error;
6210 END;
6211
6212 g_effective_date := l_effective_date;
6213
6214 for c_pay_tab_essl_rec in c_pay_tab_essl loop
6215 l_essl_table := TRUE;
6216 exit;
6217 end loop;
6218
6219 -- Bug 3315432 Madhuri
6220 --
6221 FOR pp_prd_per_gr IN cur_pp_prd_per_gr(p_mass_salary_id)
6222 LOOP
6223 rec_pp_prd_per_gr(l_index).pay_plan := pp_prd_per_gr.pay_plan;
6224 rec_pp_prd_per_gr(l_index).prd := pp_prd_per_gr.prd;
6225 rec_pp_prd_per_gr(l_index).percent := pp_prd_per_gr.percent;
6226 rec_pp_prd_per_gr(l_index).grade := pp_prd_per_gr.grade;
6227 l_index := l_index +1;
6228
6229 END LOOP;
6230
6231 IF upper(p_action) = 'CREATE' then
6232 ghr_mto_int.set_log_program_name('GHR_MSL_PKG');
6233 ELSE
6234 ghr_mto_int.set_log_program_name('MSL_'||p_mass_salary);
6235 END IF;
6236
6237 -- Commented out by Edward Nunez. It's not needed anymore with 894 rules
6238 -- IF upper(p_action) = 'CREATE' then
6239 -- if l_pa_request_id is null then
6240 -- hr_utility.set_message(8301, 'GHR_99999_SELECT_LAC_REMARKS');
6241 -- hr_utility.raise_error;
6242 -- END IF;
6243 -- END IF;
6244
6245 get_lac_dtls(l_pa_request_id,
6246 l_lac_sf52_rec);
6247
6248 --purge_old_data(l_mass_salary_id);
6249
6250 hr_utility.set_location('After fetch msl '||to_char(l_effective_date)
6251 ||' '||to_char(l_user_table_id),20);
6252
6253 IF l_p_ORGANIZATION_ID is not null then
6254 FOR per IN cur_people_org (l_effective_date,l_p_ORGANIZATION_ID)
6255 LOOP
6256 -- Bug#5719467 Initialised the variable l_mslerrbuf to avoid ora error 6502
6257 l_mslerrbuf := NULL;
6258 -- Bug#5063304 Added the following IF Condition.
6259 IF NVL(l_p_organization_id,per.organization_id) = per.organization_id THEN
6260 FOR ast IN cur_ast (per.assignment_status_type_id)
6261 LOOP
6262 -- Set all local variables to NULL
6263 l_personnel_office_id := NULL;
6264 l_org_structure_id := NULL;
6265 l_position_title := NULL;
6266 l_position_number := NULL;
6267 l_position_seq_no := NULL;
6268 l_sub_element_code := NULL;
6269 l_duty_station_id := NULL;
6270 l_tenure := NULL;
6271 l_annuitant_indicator := NULL;
6272 l_pay_rate_determinant := NULL;
6273 l_work_schedule := NULL;
6274 l_part_time_hour := NULL;
6275 l_pay_plan := NULL;
6276 l_pay_table_id := NULL;
6277 l_grade_or_level := NULL;
6278 l_step_or_rate := NULL;
6279 l_pay_basis := NULL;
6280 l_increase_percent := NULL;
6281 l_elig_flag := FALSE;
6282 --
6283 BEGIN
6284 fetch_and_validate_emp_perc(
6285 p_action => p_action
6286 ,p_mass_salary_id => p_mass_salary_id
6287 ,p_mass_salary_name => p_mass_salary
6288 ,p_full_name => per.full_name
6289 ,p_national_identifier => per.national_identifier
6290 ,p_assignment_id => per.assignment_id
6291 ,p_person_id => per.person_id
6292 ,p_position_id => per.position_id
6293 ,p_grade_id => per.grade_id
6294 ,p_business_group_id => per.business_group_id
6295 ,p_location_id => per.location_id
6296 ,p_organization_id => per.organization_id
6297 ,p_msl_organization_id => l_p_organization_id
6298 ,p_msl_duty_station_id => l_p_duty_station_id
6299 ,p_msl_personnel_office_id => l_p_personnel_office_id
6300 ,p_msl_agency_code_subelement => l_p_agency_code_subelement
6301 ,p_msl_user_table_id => l_user_table_id
6302 ,p_rec_pp_prd_per_gr => rec_pp_prd_per_gr
6303 ,p_personnel_office_id => l_personnel_office_id
6304 ,p_org_structure_id => l_org_structure_id
6305 ,p_position_title => l_position_title
6306 ,p_position_number => l_position_number
6307 ,p_position_seq_no => l_position_seq_no
6308 ,p_subelem_code => l_sub_element_code
6309 ,p_duty_station_id => l_duty_station_id
6310 ,p_tenure => l_tenure
6311 ,p_annuitant_indicator => l_annuitant_indicator
6312 ,p_pay_rate_determinant => l_pay_rate_determinant
6313 ,p_work_schedule => l_work_schedule
6314 ,p_part_time_hour => l_part_time_hour
6315 ,p_pay_plan => l_pay_plan
6316 ,p_pay_table_id => l_pay_table_id
6317 ,p_grade_or_level => l_grade_or_level
6318 ,p_step_or_rate => l_step_or_rate
6319 ,p_pay_basis => l_pay_basis
6320 ,p_increase_percent => l_increase_percent
6321 ,p_elig_flag => l_elig_flag
6322 );
6323 EXCEPTION
6324 --WHEN fetch_validate_error THEN
6325 --l_elig_flag := FALSE;
6326 WHEN OTHERS THEN
6327 l_elig_flag := FALSE;
6328 END;
6329
6330 IF l_elig_flag THEN
6331 msl_perc_process( p_assignment_id => per.assignment_id
6332 ,p_person_id => per.person_id
6333 ,p_position_id => per.position_id
6334 ,p_grade_id => per.grade_id
6335 ,p_business_group_id => per.business_group_id
6336 ,p_location_id => per.location_id
6337 ,p_organization_id => per.organization_id
6338 ,p_date_of_birth => per.date_of_birth
6339 ,p_first_name => per.first_name
6340 ,p_last_name => per.last_name
6341 ,p_full_name => per.full_name
6342 ,p_middle_names => per.middle_names
6343 ,p_national_identifier => per.national_identifier
6344 ,p_personnel_office_id => l_personnel_office_id
6345 ,p_org_structure_id => l_org_structure_id
6346 ,p_position_title => l_position_title
6347 ,p_position_number => l_position_number
6348 ,p_position_seq_no => l_position_seq_no
6349 ,p_subelem_code => l_sub_element_code
6350 ,p_duty_station_id => l_duty_station_id
6351 ,p_tenure => l_tenure
6352 ,p_annuitant_indicator => l_annuitant_indicator
6353 ,p_pay_rate_determinant => l_pay_rate_determinant
6354 ,p_work_schedule => l_work_schedule
6355 ,p_part_time_hour => l_part_time_hour
6356 ,p_pay_plan => l_pay_plan
6357 ,p_pay_table_id => l_pay_table_id
6358 ,p_grade_or_level => l_grade_or_level
6359 ,p_step_or_rate => l_step_or_rate
6360 ,p_pay_basis => l_pay_basis
6361 ,p_increase_percent => l_increase_percent
6362 );
6363
6364 END IF;
6365 END LOOP;
6366 END IF;
6367 END LOOP;
6368 ELSE
6369 FOR per IN cur_people (l_effective_date)
6370 LOOP
6371 -- Bug#5719467 Initialised the variable l_mslerrbuf to avoid ora error 6502
6372 l_mslerrbuf := NULL;
6373 FOR ast IN cur_ast (per.assignment_status_type_id)
6374 LOOP
6375 --
6376 -- Set all local variables to NULL
6377 l_personnel_office_id := NULL;
6378 l_org_structure_id := NULL;
6379 l_position_title := NULL;
6380 l_position_number := NULL;
6381 l_position_seq_no := NULL;
6382 l_sub_element_code := NULL;
6383 l_duty_station_id := NULL;
6384 l_tenure := NULL;
6385 l_annuitant_indicator := NULL;
6386 l_pay_rate_determinant := NULL;
6387 l_work_schedule := NULL;
6388 l_part_time_hour := NULL;
6389 l_pay_plan := NULL;
6390 l_pay_table_id := NULL;
6391 l_grade_or_level := NULL;
6392 l_step_or_rate := NULL;
6393 l_pay_basis := NULL;
6394 l_increase_percent := NULL;
6395 l_elig_flag := FALSE;
6396 --
6397 BEGIN
6398 fetch_and_validate_emp_perc(
6399 p_action => p_action
6400 ,p_mass_salary_id => p_mass_salary_id
6401 ,p_mass_salary_name => p_mass_salary
6402 ,p_full_name => per.full_name
6403 ,p_national_identifier => per.national_identifier
6404 ,p_assignment_id => per.assignment_id
6405 ,p_person_id => per.person_id
6406 ,p_position_id => per.position_id
6407 ,p_grade_id => per.grade_id
6408 ,p_business_group_id => per.business_group_id
6409 ,p_location_id => per.location_id
6410 ,p_organization_id => per.organization_id
6411 ,p_msl_organization_id => l_p_organization_id
6412 ,p_msl_duty_station_id => l_p_duty_station_id
6413 ,p_msl_personnel_office_id => l_p_personnel_office_id
6414 ,p_msl_agency_code_subelement => l_p_agency_code_subelement
6415 ,p_msl_user_table_id => l_user_table_id
6416 ,p_rec_pp_prd_per_gr => rec_pp_prd_per_gr
6417 ,p_personnel_office_id => l_personnel_office_id
6418 ,p_org_structure_id => l_org_structure_id
6419 ,p_position_title => l_position_title
6420 ,p_position_number => l_position_number
6421 ,p_position_seq_no => l_position_seq_no
6422 ,p_subelem_code => l_sub_element_code
6423 ,p_duty_station_id => l_duty_station_id
6424 ,p_tenure => l_tenure
6425 ,p_annuitant_indicator => l_annuitant_indicator
6426 ,p_pay_rate_determinant => l_pay_rate_determinant
6427 ,p_work_schedule => l_work_schedule
6428 ,p_part_time_hour => l_part_time_hour
6429 ,p_pay_plan => l_pay_plan
6430 ,p_pay_table_id => l_pay_table_id
6431 ,p_grade_or_level => l_grade_or_level
6432 ,p_step_or_rate => l_step_or_rate
6433 ,p_pay_basis => l_pay_basis
6434 ,p_increase_percent => l_increase_percent
6435 ,p_elig_flag => l_elig_flag
6436 );
6437 EXCEPTION
6438 --WHEN fetch_validate_error THEN
6439 -- l_elig_flag := FALSE;
6440 WHEN OTHERS THEN
6441 l_elig_flag := FALSE;
6442 END;
6443 IF l_elig_flag THEN
6444
6445 msl_perc_process(
6446 p_assignment_id => per.assignment_id
6447 ,p_person_id => per.person_id
6448 ,p_position_id => per.position_id
6449 ,p_grade_id => per.grade_id
6450 ,p_business_group_id => per.business_group_id
6451 ,p_location_id => per.location_id
6452 ,p_organization_id => per.organization_id
6453 ,p_date_of_birth => per.date_of_birth
6454 ,p_first_name => per.first_name
6455 ,p_last_name => per.last_name
6456 ,p_full_name => per.full_name
6457 ,p_middle_names => per.middle_names
6458 ,p_national_identifier => per.national_identifier
6459 ,p_personnel_office_id => l_personnel_office_id
6460 ,p_org_structure_id => l_org_structure_id
6461 ,p_position_title => l_position_title
6462 ,p_position_number => l_position_number
6463 ,p_position_seq_no => l_position_seq_no
6464 ,p_subelem_code => l_sub_element_code
6465 ,p_duty_station_id => l_duty_station_id
6466 ,p_tenure => l_tenure
6467 ,p_annuitant_indicator => l_annuitant_indicator
6468 ,p_pay_rate_determinant => l_pay_rate_determinant
6469 ,p_work_schedule => l_work_schedule
6470 ,p_part_time_hour => l_part_time_hour
6471 ,p_pay_plan => l_pay_plan
6472 ,p_pay_table_id => l_pay_table_id
6473 ,p_grade_or_level => l_grade_or_level
6474 ,p_step_or_rate => l_step_or_rate
6475 ,p_pay_basis => l_pay_basis
6476 ,p_increase_percent => l_increase_percent
6477 );
6478 END IF;
6479
6480 END LOOP;
6481 END LOOP;
6482 END IF;
6483
6484 pr('After processing is over ',to_char(l_recs_failed));
6485 /*
6486 if (l_recs_failed < (l_msl_cnt * (1/3))) then
6487 */
6488 if (l_recs_failed = 0) then
6489 IF upper(p_action) = 'CREATE' THEN
6490 begin
6491 update ghr_mass_salaries
6492 set submit_flag = 'P'
6493 where rowid = l_rowid;
6494 EXCEPTION
6495 when others then
6496 HR_UTILITY.SET_LOCATION('Error in Update ghr_msl Sql error '||sqlerrm(sqlcode),30);
6497 hr_utility.set_message(8301, 'GHR_38476_UPD_GHR_MSL_FAILURE');
6498 hr_utility.raise_error;
6499 END;
6500 -----Bug 2849262. Updating extra info to null is already done by Update_sel_flg in the main loop.
6501 ----- So it is not required to do in global if you see the procedure upd_ext_info_to_null
6502 ----- Commenting the following line. Dated 14-OCT-2003.
6503 -----
6504 ----- upd_ext_info_to_null(l_effective_date);
6505 end if;
6506 ELSE
6507 --if (l_recs_failed <> 0) then
6508 p_errbuf := 'Error in '||l_proc || ' Details in GHR_PROCESS_LOG';
6509 p_retcode := 2;
6510 IF upper(p_action) = 'CREATE' THEN
6511 update ghr_mass_salaries
6512 set submit_flag = 'E'
6513 where rowid = l_rowid;
6514 END IF;
6515 end if;
6516 pr('Before commiting.....');
6517 COMMIT;
6518 pr('After commiting.....',to_char(l_recs_failed));
6519
6520 EXCEPTION
6521 when others then
6522 -- raise_application_error(-20121,'Error in execute_msl_perc Err is '||sqlerrm(sqlcode));
6523 HR_UTILITY.SET_LOCATION('Error (Others2) occurred in '||l_proc||' Sql error '||sqlerrm(sqlcode),30);
6524 BEGIN
6525 ROLLBACK TO execute_msl_perc_SP;
6526 EXCEPTION
6527 WHEN OTHERS THEN NULL;
6528 END;
6529 l_log_text := 'Error in '||l_proc||
6530 ' For Mass Salary Name : '||p_mass_salary||
6531 ' Sql Err is '||sqlerrm(sqlcode);
6532 l_recs_failed := l_recs_failed + 1;
6533 hr_utility.set_location('before creating entry in log file',30);
6534
6535 p_errbuf := 'Error in '||l_proc || ' Details in GHR_PROCESS_LOG';
6536 p_retcode := 2;
6537 IF upper(p_action) = 'CREATE' THEN
6538 update ghr_mass_salaries
6539 set submit_flag = 'E'
6540 where rowid = l_rowid;
6541 commit;
6542 END IF;
6543
6544 begin
6545 ghr_mto_int.log_message(
6546 p_procedure => g_proc,
6547 p_message => l_log_text);
6548
6549 exception
6550 when others then
6551 hr_utility.set_message(8301, 'Create Error Log failed');
6552 hr_utility.raise_error;
6553 end;
6554
6555 END execute_msl_perc;
6556 -- 3843306
6557 -- END of MSL Percentage Changes
6558 -- This is same as Execute_msl except for few modifications
6559 --
6560 PROCEDURE set_ses_msl_process(ses_flag varchar2)
6561 IS
6562 BEGIN
6563 ghr_msl_pkg.g_ses_msl_process := ses_flag;
6564 END set_ses_msl_process;
6565
6566 -- Bug#5063304 Created this new procedure
6567
6568 --5470182 -- For SES Relative Rate Range
6569 -- Bug#5063304 Created this new procedure
6570 PROCEDURE fetch_and_validate_emp_ses(
6571 p_action IN VARCHAR2
6572 ,p_mass_salary_id IN NUMBER
6573 ,p_mass_salary_name IN VARCHAR2
6574 ,p_full_name IN per_people_f.full_name%TYPE
6575 ,p_national_identifier IN per_people_f.national_identifier%TYPE
6576 ,p_assignment_id IN per_assignments_f.assignment_id%TYPE
6577 ,p_person_id IN per_assignments_f.person_id%TYPE
6578 ,p_position_id IN per_assignments_f.position_id%TYPE
6579 ,p_grade_id IN per_assignments_f.grade_id%TYPE
6580 ,p_business_group_id IN per_assignments_f.business_group_iD%TYPE
6581 ,p_location_id IN per_assignments_f.location_id%TYPE
6582 ,p_organization_id IN per_assignments_f.organization_id%TYPE
6583 ,p_msl_organization_id IN per_assignments_f.organization_id%TYPE
6584 ,p_msl_duty_station_id IN ghr_duty_stations_f.duty_station_id%TYPE
6585 ,p_msl_personnel_office_id IN VARCHAR2
6586 ,p_msl_agency_code_subelement IN VARCHAR2
6587 ,p_msl_user_table_id IN NUMBER
6588 ,p_rec_pp_prd IN pp_prd
6589 ,p_personnel_office_id OUT NOCOPY VARCHAR2
6590 ,p_org_structure_id OUT NOCOPY VARCHAR2
6591 ,p_position_title OUT NOCOPY VARCHAR2
6592 ,p_position_number OUT NOCOPY VARCHAR2
6593 ,p_position_seq_no OUT NOCOPY VARCHAR2
6594 ,p_subelem_code OUT NOCOPY VARCHAR2
6595 ,p_duty_station_id OUT NOCOPY ghr_duty_stations_f.duty_station_id%TYPE
6596 ,p_tenure OUT NOCOPY VARCHAR2
6597 ,p_annuitant_indicator OUT NOCOPY VARCHAR2
6598 ,p_pay_rate_determinant OUT NOCOPY VARCHAR2
6599 ,p_work_schedule OUT NOCOPY VARCHAR2
6600 ,p_part_time_hour OUT NOCOPY VARCHAR2
6601 ,p_to_grade_id OUT NOCOPY per_assignments_f.grade_id%type
6602 ,p_pay_plan OUT NOCOPY VARCHAR2
6603 ,p_to_pay_plan OUT NOCOPY VARCHAR2
6604 ,p_pay_table_id OUT NOCOPY NUMBER
6605 ,p_grade_or_level OUT NOCOPY VARCHAR2
6606 ,p_to_grade_or_level OUT NOCOPY VARCHAR2
6607 ,p_step_or_rate OUT NOCOPY VARCHAR2
6608 ,p_pay_basis OUT NOCOPY VARCHAR2
6609 ,p_elig_flag OUT NOCOPY BOOLEAN
6610 ) IS
6611
6612
6613
6614 CURSOR msl_dtl_cur (cur_pay_plan varchar2, cur_prd varchar2) IS
6615 SELECT count(*) cnt
6616 FROM ghr_mass_salary_criteria
6617 WHERE mass_salary_id = p_mass_salary_id
6618 AND pay_plan = cur_pay_plan
6619 AND pay_rate_determinant = cur_prd;
6620
6621 l_row_cnt NUMBER := 0;
6622 l_pos_grp1_rec per_position_extra_info%rowtype;
6623 l_assignment_id per_assignments_f.assignment_id%TYPE;
6624 l_person_id per_assignments_f.person_id%TYPE;
6625 l_position_id per_assignments_f.position_id%TYPE;
6626 l_grade_id per_assignments_f.grade_id%TYPE;
6627 l_business_group_id per_assignments_f.business_group_iD%TYPE;
6628 l_location_id per_assignments_f.location_id%TYPE;
6629 l_organization_id per_assignments_f.organization_id%TYPE;
6630 l_tenure VARCHAR2(35);
6631 l_annuitant_indicator VARCHAR2(35);
6632 l_pay_rate_determinant VARCHAR2(35);
6633 l_work_schedule VARCHAR2(35);
6634 l_part_time_hour VARCHAR2(35);
6635 l_pay_table_id NUMBER;
6636 l_pay_plan VARCHAR2(30);
6637 l_grade_or_level VARCHAR2(30);
6638 -- Bug#5089732 Added current pay plan, grade_or_level
6639 l_to_grade_id NUMBER;
6640 l_to_pay_plan VARCHAR2(30);
6641 l_to_grade_or_level VARCHAR2(30);
6642 -- Bug#5089732
6643 l_step_or_rate VARCHAR2(30);
6644 l_pay_basis VARCHAR2(30);
6645 l_duty_station_id NUMBER;
6646 l_duty_station_desc ghr_pa_requests.duty_station_desc%type;
6647 l_duty_station_code ghr_pa_requests.duty_station_code%type;
6648 l_effective_date DATE;
6649 l_personnel_office_id VARCHAR2(300);
6650 l_org_structure_id VARCHAR2(300);
6651 l_sub_element_code VARCHAR2(300);
6652 l_position_title VARCHAR2(300);
6653 l_position_number VARCHAR2(20);
6654 l_position_seq_no VARCHAR2(20);
6655 l_log_text VARCHAR2(2000) := null;
6656 l_retained_grade_rec ghr_pay_calc.retained_grade_rec_type;
6657 l_fetch_poid_data BOOLEAN := FALSE;
6658 l_fetch_ds_data BOOLEAN := FALSE;
6659 l_fetch_agency_data BOOLEAN := FALSE;
6660 init_elig_flag BOOLEAN := FALSE;
6661 l_prd_matched BOOLEAN := FALSE;
6662 l_prd_pp_matched BOOLEAN := FALSE;
6663 l_rat_matched BOOLEAN := FALSE;
6664
6665
6666 --5470182
6667 l_special_info_type ghr_api.special_information_type;
6668
6669
6670
6671 l_proc varchar2(72) := g_package || '.fetch_and_validate_emp_ses';
6672
6673 BEGIN
6674
6675 g_proc := 'fetch_and_validate_emp_ses';
6676 hr_utility.set_location('Entering ' || l_proc,5);
6677
6678 -- Bug#5623035 Moved the local variable assigning to here.
6679 l_assignment_id := p_assignment_id;
6680 l_position_id := p_position_id;
6681 l_grade_id := p_grade_id;
6682 l_business_group_id := p_business_group_iD;
6683 l_location_id := p_location_id;
6684 l_effective_date := g_effective_date;
6685
6686 -- Verify whether this process is required or not.
6687 IF p_msl_organization_id IS NOT NULL OR
6688 p_msl_duty_station_id IS NOT NULL OR
6689 p_msl_personnel_office_id IS NOT NULL OR
6690 p_msl_agency_code_subelement IS NOT NULL THEN
6691 -- get the values and verify whether the record meets the condition or not.
6692 -- If Yes, proceed further. Otherwise, skip the other checks for this record
6693
6694 hr_utility.set_location('The location id is:'||l_location_id,12345);
6695 hr_utility.set_location('MSL Org ID:'||p_msl_organization_id,11111);
6696 hr_utility.set_location('Org ID:'||p_organization_id,22222);
6697 IF NVL(p_msl_organization_id,p_organization_id) = p_organization_id THEN
6698 hr_utility.set_location('Org ID PASS',10);
6699 IF p_msl_personnel_office_id IS NOT NULL THEN
6700 hr_utility.set_location('POID CHECK',15);
6701 get_pos_grp1_ddf(l_position_id,
6702 l_effective_date,
6703 l_pos_grp1_rec);
6704
6705 l_personnel_office_id := l_pos_grp1_rec.poei_information3;
6706 l_org_structure_id := l_pos_grp1_rec.poei_information5;
6707 l_fetch_poid_data := TRUE;
6708 END IF;
6709 IF (p_msl_personnel_office_id = l_personnel_office_id) OR
6710 NOT(l_fetch_poid_data) THEN
6711
6712 hr_utility.set_location('POID PASS',20);
6713 IF p_msl_agency_code_subelement IS NOT NULL THEN
6714 hr_utility.set_location('Agency CHECK',25);
6715 get_sub_element_code_pos_title(l_position_id,
6716 p_person_id,
6717 l_business_group_id,
6718 l_assignment_id,
6719 l_effective_date,
6720 l_sub_element_code,
6721 l_position_title,
6722 l_position_number,
6723 l_position_seq_no);
6724 l_fetch_agency_data := TRUE;
6725 END IF;
6726 -- Bug#5674003 Modified the following IF condition
6727 IF (SUBSTR(p_msl_agency_code_subelement,1,2) = SUBSTR(l_sub_element_code,1,2) AND
6728 NVL(SUBSTR(p_msl_agency_code_subelement,3,2),SUBSTR(l_sub_element_code,3,2))=
6729 SUBSTR(l_sub_element_code,3,2)
6730 ) OR
6731 NOT(l_fetch_agency_data) THEN
6732 hr_utility.set_location('Agency PASS',30);
6733 IF p_msl_duty_station_id IS NOT NULL THEN
6734 hr_utility.set_location('DS CHECK',35);
6735 ghr_pa_requests_pkg.get_SF52_loc_ddf_details
6736 (p_location_id => l_location_id
6737 ,p_duty_station_id => l_duty_station_id);
6738 l_fetch_ds_data := TRUE;
6739 END IF;
6740 IF (p_msl_duty_station_id = l_duty_station_id) OR
6741 NOT(l_fetch_ds_data)THEN
6742 hr_utility.set_location('DS PASS',40);
6743 init_elig_flag := TRUE;
6744 ELSE -- Duty Station not matching.
6745 hr_utility.set_location('DS FAIL',45);
6746 init_elig_flag := FALSE;
6747 END IF;
6748 ELSE -- Agency Code Subelement Not matching.
6749 hr_utility.set_location('Agency FAIL',55);
6750 init_elig_flag := FALSE;
6751 END IF;
6752 ELSE -- Personnel Office ID not matching
6753 hr_utility.set_location('POID FAIL',65);
6754 init_elig_flag := FALSE;
6755 END IF;
6756 ELSE -- Organization_id is not matching.
6757 hr_utility.set_location('Org FAIL',75);
6758 init_elig_flag := FALSE;
6759 END IF;
6760 ELSE -- If No value is entered for organization, Duty Station, Agency, POID of MSL Criteria.
6761 hr_utility.set_location('No INIT CRITERIA',85);
6762 init_elig_flag := TRUE;
6763 END IF;
6764
6765 -- If the initial eligibility is passed then proceed further. Otherwise move to next record.
6766 IF init_elig_flag THEN
6767 hr_utility.set_location('Init Criteria Pass',95);
6768 ghr_pa_requests_pkg.get_sf52_asg_ddf_details
6769 (l_assignment_id,
6770 l_effective_date,
6771 l_tenure,
6772 l_annuitant_indicator,
6773 l_pay_rate_determinant,
6774 l_work_schedule,
6775 l_part_time_hour);
6776
6777 FOR l_cnt in 1..p_rec_pp_prd.COUNT LOOP
6778 IF nvl(p_rec_pp_prd(l_cnt).prd,l_pay_rate_determinant) = l_pay_rate_determinant THEN
6779 hr_utility.set_location('PRD PASS',105);
6780 l_prd_matched := TRUE;
6781 exit;
6782 END IF;
6783 END LOOP;
6784
6785 IF l_prd_matched THEN
6786 -- Bug#5089732 Used the overloaded procedure.
6787 BEGIN
6788 get_pay_plan_and_table_id
6789 (l_pay_rate_determinant,p_person_id,
6790 l_position_id,l_effective_date,
6791 l_grade_id, l_to_grade_id,l_assignment_id,'SHOW',
6792 l_pay_plan,l_to_pay_plan,l_pay_table_id,
6793 l_grade_or_level, l_to_grade_or_level, l_step_or_rate,
6794 l_pay_basis);
6795 -- Bug#4016384 Added the exception handling to report RG employees in the process log.
6796 EXCEPTION
6797 WHEN OTHERS THEN
6798 -- Report the record in the process log if the pay table ID matches.
6799 BEGIN
6800 hr_utility.set_location('before calling expired_rg_det',10);
6801 l_retained_grade_rec := ghr_pc_basic_pay.get_expired_rg_details
6802 (p_person_id => p_person_id
6803 ,p_effective_date => l_effective_date);
6804 hr_utility.set_location('ret grd tableid:'||l_retained_grade_rec.user_table_id,99999);
6805 hr_utility.set_location('MSL tableid:'||p_msl_user_table_id,99999);
6806 IF l_retained_grade_rec.user_table_id = p_msl_user_table_id THEN
6807 hr_utility.set_location('Rg table matches with MSL table ID',10);
6808 l_log_text := 'Error in RG Record In Mass Salary Name: '||
6809 p_mass_salary_name||'; Employee Name: '|| p_full_name ||
6810 '; SSN: ' || p_national_identifier || '; '||
6811 hr_utility.get_message;
6812 BEGIN
6813 ghr_mto_int.log_message(
6814 p_procedure => 'check_grade_retention',
6815 p_message => l_log_text);
6816 g_rg_recs_failed := g_rg_recs_failed + 1;
6817 EXCEPTION
6818 WHEN OTHERS THEN
6819 l_prd_pp_matched := FALSE;
6820 END;
6821 ELSE
6822 l_prd_pp_matched := FALSE;
6823 END IF;
6824 EXCEPTION
6825 WHEN OTHERS THEN
6826 hr_utility.set_location('WHEN OTHERS of EXPIRED RG ',999999);
6827 l_prd_pp_matched := FALSE;
6828 END;
6829 --WHEN OTHERS THEN
6830 -- Skip this record from reporting.
6831 -- l_prd_pp_matched := FALSE;
6832 END;
6833 END IF;
6834
6835 FOR l_cnt in 1..p_rec_pp_prd.COUNT LOOP
6836 IF nvl(p_rec_pp_prd(l_cnt).prd,l_pay_rate_determinant) = l_pay_rate_determinant AND
6837 nvl(p_rec_pp_prd(l_cnt).pay_plan,l_pay_plan) = l_pay_plan THEN
6838 hr_utility.set_location('PP/PRD PASS',115);
6839 l_prd_pp_matched := TRUE;
6840 exit;
6841 END IF;
6842 END LOOP;
6843
6844
6845 --5470182
6846 IF l_prd_pp_matched AND l_pay_table_id = p_msl_user_table_id THEN
6847 ghr_history_fetch.return_special_information
6848 (p_person_id => p_person_id,
6849 p_structure_name => 'US Fed Perf Appraisal',
6850 p_effective_date => l_effective_date,
6851 p_special_info => l_special_info_type
6852 );
6853
6854 -- BUG #6528698 Appraisal effective date need to be considered instead of Appraisal start date
6855 /* Rating of Record Level must be within 12 months*/
6856 IF l_effective_date between fnd_date.canonical_to_date(l_special_info_type.segment3)
6857 and ADD_MONTHS(fnd_date.canonical_to_date(l_special_info_type.segment3),12) THEN
6858 /*Rating of Record Level must be '3','4' '5' or Rating of Record
6859 must be 'E','F' or 'O'*/
6860 IF l_special_info_type.segment5 in ('3','4','5')
6861 OR
6862 l_special_info_type.segment2 in ('E','F','O') THEN
6863 l_rat_matched :=TRUE;
6864
6865 END IF; -- rating of recor level comp
6866 END IF; -- rating of record level with in 12 months
6867 END IF; -- prd and payplan matched and user table id matched
6868 --5470182
6869
6870 IF l_rat_matched THEN
6871 IF l_pay_table_id = p_msl_user_table_id THEN
6872 hr_utility.set_location('Table ID PASS',125);
6873 IF NOT (p_action = 'CREATE' AND
6874 person_in_pa_req_1noa
6875 (p_person_id => p_person_id,
6876 p_effective_date => l_effective_date,
6877 p_first_noa_code => nvl(g_first_noa_code,'890'),
6878 p_pay_plan => p_pay_plan
6879 )
6880 )THEN
6881 -- Pass l_pay_plan instead of l_to_pay_plan.
6882 FOR msl_dtl IN msl_dtl_cur(l_pay_plan, l_pay_rate_determinant)
6883 LOOP
6884 IF msl_dtl.cnt <> 0 THEN
6885 l_row_cnt := msl_dtl.cnt;
6886 END IF;
6887 END LOOP;
6888
6889 IF l_row_cnt <> 0 THEN
6890 hr_utility.set_location('ROW COUNT PASS',135);
6891 -- Get the required details if the related check has not been done above.
6892 IF NOT l_fetch_poid_data THEN
6893
6894 get_pos_grp1_ddf(l_position_id,
6895 l_effective_date,
6896 l_pos_grp1_rec);
6897 END IF;
6898
6899 IF NOT l_fetch_ds_data THEN
6900 ghr_pa_requests_pkg.get_SF52_loc_ddf_details
6901 (p_location_id => l_location_id
6902 ,p_duty_station_id => l_duty_station_id);
6903 END IF;
6904
6905 IF NOT l_fetch_agency_data THEN
6906 get_sub_element_code_pos_title(
6907 l_position_id,
6908 p_person_id,
6909 l_business_group_id,
6910 l_assignment_id,
6911 l_effective_date,
6912 l_sub_element_code,
6913 l_position_title,
6914 l_position_number,
6915 l_position_seq_no
6916 );
6917 END IF;
6918
6919 -- Set all the out parameters
6920 p_elig_flag := TRUE;
6921 p_personnel_office_id := l_personnel_office_id;
6922 p_org_structure_id := l_org_structure_id;
6923 p_position_title := l_position_title;
6924 p_position_number := l_position_number;
6925 p_position_seq_no := l_position_seq_no;
6926 p_subelem_code := l_sub_element_code;
6927 p_duty_station_id := l_duty_station_id;
6928 p_tenure := l_tenure;
6929 p_annuitant_indicator := l_annuitant_indicator;
6930 p_pay_rate_determinant := l_pay_rate_determinant;
6931 p_work_schedule := l_work_schedule;
6932 p_part_time_hour := l_part_time_hour;
6933 p_to_grade_id := l_to_grade_id;
6934 p_pay_plan := l_pay_plan;
6935 p_to_pay_plan := l_to_pay_plan;
6936 p_pay_table_id := l_pay_table_id;
6937 p_grade_or_level := l_grade_or_level;
6938 p_to_grade_or_level := l_to_grade_or_level;
6939 p_step_or_rate := l_step_or_rate;
6940 p_pay_basis := l_pay_basis;
6941 ELSE -- If PP,PRD combinations are "0".
6942 -- Raise Error
6943 NULL;
6944 END IF;
6945 ELSE -- Not (Create and RPA exists)
6946 hr_utility.set_location('ROW COUNT FAIL',145);
6947 p_elig_flag := FALSE;
6948 END IF;
6949 ELSE -- Pay table id is not matched
6950 hr_utility.set_location('Pay Table FAIL',155);
6951 p_elig_flag := FALSE;
6952 END IF;
6953 ELSE -- Pay Plan and PRD not matched
6954 hr_utility.set_location('PP/PRD FAIL',165);
6955 p_elig_flag := FALSE;
6956 END IF;
6957 ELSE
6958 hr_utility.set_location('PP FAIL',175);
6959 p_elig_flag := FALSE;
6960 END IF;
6961 EXCEPTION
6962 WHEN others THEN
6963 hr_utility.set_location('WHEN OTHERS',185);
6964 RAISE;
6965 END fetch_and_validate_emp_ses;
6966
6967 PROCEDURE execute_msl_ses_range (p_errbuf out nocopy varchar2,
6968 p_retcode out nocopy number,
6969 p_mass_salary_id in number,
6970 p_action in varchar2) is
6971
6972 p_mass_salary varchar2(32);
6973
6974 --
6975 --
6976 -- Main Cursor which fetches from per_assignments_f and per_people_f
6977 --
6978 --
6979 --1. Cursor with organization.
6980 ---
6981 cursor cur_people_org (effective_date date, p_org_id number) is
6982 select ppf.person_id PERSON_ID,
6983 ppf.first_name FIRST_NAME,
6984 ppf.last_name LAST_NAME,
6985 ppf.middle_names MIDDLE_NAMES,
6986 ppf.full_name FULL_NAME,
6987 ppf.date_of_birth DATE_OF_BIRTH,
6988 ppf.national_identifier NATIONAL_IDENTIFIER,
6989 paf.position_id POSITION_ID,
6990 paf.assignment_id ASSIGNMENT_ID,
6991 paf.grade_id GRADE_ID,
6992 paf.job_id JOB_ID,
6993 paf.location_id LOCATION_ID,
6994 paf.organization_id ORGANIZATION_ID,
6995 paf.business_group_id BUSINESS_GROUP_ID,
6996 paf.assignment_status_type_id ASSIGNMENT_STATUS_TYPE_ID
6997 from per_assignments_f paf,
6998 per_people_f ppf,
6999 per_person_types ppt
7000 where ppf.person_id = paf.person_id
7001 and effective_date between ppf.effective_start_date and ppf.effective_end_date
7002 and effective_date between paf.effective_start_date and paf.effective_end_date
7003 and paf.primary_flag = 'Y'
7004 and paf.assignment_type <> 'B'
7005 and ppf.person_type_id = ppt.person_type_id
7006 and ppt.system_person_type IN ('EMP','EMP_APL')
7007 and paf.organization_id = p_org_id
7008 and paf.position_id is not null
7009 order by ppf.person_id;
7010
7011 ---
7012 --- Bug 3539816 Order by added to prevent snapshot old error
7013 --- 2. Cursor with no organization.
7014 ---
7015 cursor cur_people (effective_date date) is
7016 select ppf.person_id PERSON_ID,
7017 ppf.first_name FIRST_NAME,
7018 ppf.last_name LAST_NAME,
7019 ppf.middle_names MIDDLE_NAMES,
7020 ppf.full_name FULL_NAME,
7021 ppf.date_of_birth DATE_OF_BIRTH,
7022 ppf.national_identifier NATIONAL_IDENTIFIER,
7023 paf.position_id POSITION_ID,
7024 paf.assignment_id ASSIGNMENT_ID,
7025 paf.grade_id GRADE_ID,
7026 paf.job_id JOB_ID,
7027 paf.location_id LOCATION_ID,
7028 paf.organization_id ORGANIZATION_ID,
7029 paf.business_group_id BUSINESS_GROUP_ID,
7030 paf.assignment_status_type_id ASSIGNMENT_STATUS_TYPE_ID
7031 from per_assignments_f paf,
7032 per_people_f ppf,
7033 per_person_types ppt,
7034 hr_organization_units hou
7035 where ppf.person_id = paf.person_id
7036 and effective_date between ppf.effective_start_date and ppf.effective_end_date
7037 and effective_date between paf.effective_start_date and paf.effective_end_date
7038 and paf.primary_flag = 'Y'
7039 and paf.assignment_type <> 'B'
7040 and ppf.person_type_id = ppt.person_type_id
7041 and ppt.system_person_type IN ('EMP','EMP_APL')
7042 and paf.organization_id = hou.organization_id
7043 and paf.position_id is not null
7044 order by ppf.person_id;
7045 --
7046 -- Check assignment_status_type
7047 --
7048
7049 cursor cur_ast (asg_status_type_id number)
7050 is
7051 select user_status
7052 from per_assignment_status_types
7053 where assignment_status_type_id = asg_status_type_id
7054 and upper(user_status) not in (
7055 'TERMINATE ASSIGNMENT', /* 3 */
7056 'ACTIVE APPLICATION', /* 4 */
7057 'OFFER', /* 5 */
7058 'ACCEPTED', /* 6 */
7059 'TERMINATE APPLICATION', /* 7 */
7060 'END', /* 8 */
7061 'TERMINATE APPOINTMENT', /* 126 */
7062 'SEPARATED'); /* 132 */
7063
7064 --
7065 -- Cursor to select from GHR_MASS_SALARIES - Where criteria is stored
7066 -- Before executing this package
7067 -- from ghr_mass_salary_criteria
7068
7069 cursor ghr_msl (p_msl_id number) is
7070 select name, effective_date, mass_salary_id, user_table_id, submit_flag,
7071 executive_order_number, executive_order_date, ROWID, PA_REQUEST_ID,
7072 ORGANIZATION_ID, DUTY_STATION_ID, PERSONNEL_OFFICE_ID,
7073 AGENCY_CODE_SUBELEMENT, OPM_ISSUANCE_NUMBER, OPM_ISSUANCE_DATE, PROCESS_TYPE
7074 from ghr_mass_salaries
7075 where MASS_SALARY_ID = p_msl_id
7076 for update of user_table_id nowait;
7077
7078 -- VSM [family name was hardcoded previously to SALARY_CHG. Fetching it from DB now]
7079 cursor get_sal_chg_fam is
7080 select NOA_FAMILY_CODE
7081 from ghr_families
7082 where NOA_FAMILY_CODE in
7083 (select NOA_FAMILY_CODE from ghr_noa_families
7084 where nature_of_action_id =
7085 (select nature_of_action_id
7086 from ghr_nature_of_actions
7087 where code = '890')
7088 ) and proc_method_flag = 'Y'; --AVR 13-JAN-99
7089 ------------- ) and update_hr_flag = 'Y';
7090
7091 l_assignment_id per_assignments_f.assignment_id%type;
7092 l_position_id per_assignments_f.position_id%type;
7093 l_grade_id per_assignments_f.grade_id%type;
7094 l_business_group_id per_assignments_f.business_group_id%type;
7095
7096 l_position_title varchar2(300);
7097 l_position_number varchar2(20);
7098 l_position_seq_no varchar2(20);
7099
7100 l_msl_cnt number := 0;
7101 l_recs_failed number := 0;
7102
7103 l_tenure varchar2(35);
7104 l_annuitant_indicator varchar2(35);
7105 l_pay_rate_determinant varchar2(35);
7106 l_work_schedule varchar2(35);
7107 l_part_time_hour varchar2(35);
7108 l_pay_table_id number;
7109 l_pay_plan varchar2(30);
7110 l_grade_or_level varchar2(30);
7111 l_step_or_rate varchar2(30);
7112 l_pay_basis varchar2(30);
7113 l_location_id number;
7114 l_duty_station_id number;
7115 l_duty_station_desc ghr_pa_requests.duty_station_desc%type;
7116 l_duty_station_code ghr_pa_requests.duty_station_code%type;
7117 l_effective_date date;
7118 l_personnel_office_id varchar2(300);
7119 l_org_structure_id varchar2(300);
7120 l_sub_element_code varchar2(300);
7121
7122 l_old_basic_pay number;
7123 l_old_avail_pay number;
7124 l_old_loc_diff number;
7125 l_tot_old_sal number;
7126 l_old_auo_pay number;
7127 l_old_ADJ_basic_pay number;
7128 l_other_pay number;
7129
7130 l_out_step_or_rate varchar2(30);
7131 l_out_pay_rate_determinant varchar2(30);
7132 l_out_pay_plan varchar2(30);
7133 l_out_grade_id number;
7134 l_out_grade_or_level varchar2(30);
7135
7136
7137 l_auo_premium_pay_indicator varchar2(30);
7138 l_ap_premium_pay_indicator varchar2(30);
7139 l_retention_allowance number;
7140 l_retention_allow_perc number; ---AVR
7141 l_new_retention_allowance number; ---AVR
7142 l_supervisory_differential number;
7143 l_supervisory_diff_perc number; ---AVR
7144 l_new_supervisory_differential number; ---AVR
7145 l_staffing_differential number;
7146
7147 l_new_avail_pay number;
7148 l_new_loc_diff number;
7149 l_tot_new_sal number;
7150 l_new_auo_pay number;
7151
7152 l_new_basic_pay number;
7153 l_new_locality_adj number;
7154 l_new_adj_basic_pay number;
7155 l_new_total_salary number;
7156 l_new_other_pay_amount number;
7157 l_new_au_overtime number;
7158 l_new_availability_pay number;
7159
7160 l_open_pay_fields boolean;
7161 l_message_set boolean;
7162 l_calculated boolean;
7163
7164 l_mass_salary_id number;
7165 l_user_table_id number;
7166 l_submit_flag varchar2(2);
7167
7168 l_executive_order_number ghr_mass_salaries.executive_order_number%TYPE;
7169 l_executive_order_date ghr_mass_salaries.executive_order_date%TYPE;
7170 l_opm_issuance_number ghr_mass_salaries.opm_issuance_number%TYPE;
7171 l_opm_issuance_date ghr_mass_salaries.opm_issuance_date%TYPE;
7172 l_pa_request_id number;
7173 l_rowid varchar2(30);
7174
7175 l_p_ORGANIZATION_ID number;
7176 l_p_DUTY_STATION_ID number;
7177 l_p_PERSONNEL_OFFICE_ID varchar2(5);
7178
7179 L_row_cnt number := 0;
7180
7181 l_sf52_rec ghr_pa_requests%rowtype;
7182 l_lac_sf52_rec ghr_pa_requests%rowtype;
7183 l_errbuf varchar2(2000);
7184
7185 l_retcode number;
7186
7187 l_pos_ei_data per_position_extra_info%rowtype;
7188 l_pos_grp1_rec per_position_extra_info%rowtype;
7189
7190 l_pay_calc_in_data ghr_pay_calc.pay_calc_in_rec_type;
7191 l_pay_calc_out_data ghr_pay_calc.pay_calc_out_rec_type;
7192 l_sel_flg varchar2(2);
7193
7194 l_first_action_la_code1 varchar2(30);
7195 l_first_action_la_code2 varchar2(30);
7196
7197 l_remark_code1 varchar2(30);
7198 l_remark_code2 varchar2(30);
7199 l_p_AGENCY_CODE_SUBELEMENT varchar2(30);
7200
7201 ----Pay cap variables
7202 l_entitled_other_pay NUMBER;
7203 l_capped_other_pay NUMBER;
7204 l_adj_basic_message BOOLEAN := FALSE;
7205 l_pay_cap_message BOOLEAN := FALSE;
7206 l_temp_retention_allowance NUMBER;
7207 l_open_pay_fields_caps BOOLEAN;
7208 l_message_set_caps BOOLEAN;
7209 l_total_pay_check VARCHAR2(1);
7210 l_comment VARCHAR2(150);
7211 l_comment_sal VARCHAR2(150);
7212 l_pay_sel VARCHAR2(1) := NULL;
7213 l_old_capped_other_pay NUMBER;
7214 ----
7215 l_row_low NUMBER;
7216 l_row_high NUMBER;
7217 l_comment_range VARCHAR2(150);
7218 l_comments VARCHAR2(150);
7219
7220 -- Bug#5089732 Added current pay plan, grade_or_level
7221 l_to_grade_id per_assignments_f.grade_id%type;
7222 l_to_pay_plan varchar2(30);
7223 l_to_grade_or_level varchar2(30);
7224 -- Bug#5089732
7225
7226 REC_BUSY exception;
7227 pragma exception_init(REC_BUSY,-54);
7228
7229 l_proc varchar2(72) := g_package || '.execute_msl_ses_range';
7230
7231 cursor c_pay_tab_essl is
7232 select 1 from pay_user_tables
7233 where substr(user_table_name,1,4) = 'ESSL'
7234 and user_table_id = l_user_table_id;
7235
7236 l_essl_table BOOLEAN := FALSE;
7237 l_org_name hr_organization_units.name%type;
7238
7239 CURSOR cur_pp_prd(p_msl_id ghr_mass_salary_criteria.mass_salary_id%type)
7240 IS
7241 SELECT pay_plan ,pay_rate_determinant prd
7242 FROM ghr_mass_salary_criteria
7243 WHERE mass_salary_id=p_msl_id;
7244
7245 rec_pp_prd pp_prd;
7246
7247 l_index NUMBER:=1;
7248 l_cnt NUMBER;
7249 l_elig_flag BOOLEAN := FALSE;
7250 --
7251
7252 --
7253 -- GPPA Update 46
7254 --
7255 cursor cur_eq_ppl (c_pay_plan ghr_pay_plans.pay_plan%type)
7256 IS
7257 select EQUIVALENT_PAY_PLAN
7258 from ghr_pay_plans
7259 where pay_plan = c_pay_plan;
7260
7261 l_eq_pay_plan ghr_pay_plans.equivalent_pay_plaN%type;
7262 l_ses_basic_pay ghr_mass_actions_preview.to_basic_pay%type;
7263
7264
7265 PROCEDURE msl_ses_process(p_assignment_id per_assignments_f.assignment_id%TYPE
7266 ,p_person_id per_assignments_f.person_id%TYPE
7267 ,p_position_id per_assignments_f.position_id%TYPE
7268 ,p_grade_id per_assignments_f.grade_id%TYPE
7269 ,p_business_group_id per_assignments_f.business_group_iD%TYPE
7270 ,p_location_id per_assignments_f.location_id%TYPE
7271 ,p_organization_id per_assignments_f.organization_id%TYPE
7272 ,p_date_of_birth date
7273 ,p_first_name per_people_f.first_name%TYPE
7274 ,p_last_name per_people_f.last_name%TYPE
7275 ,p_full_name per_people_f.full_name%TYPE
7276 ,p_middle_names per_people_f.middle_names%TYPE
7277 ,p_national_identifier per_people_f.national_identifier%TYPE
7278 ,p_personnel_office_id IN VARCHAR2
7279 ,p_org_structure_id IN VARCHAR2
7280 ,p_position_title IN VARCHAR2
7281 ,p_position_number IN VARCHAR2
7282 ,p_position_seq_no IN VARCHAR2
7283 ,p_subelem_code IN VARCHAR2
7284 ,p_duty_station_id IN ghr_duty_stations_f.duty_station_id%TYPE
7285 ,p_tenure IN VARCHAR2
7286 ,p_annuitant_indicator IN VARCHAR2
7287 ,p_pay_rate_determinant IN VARCHAR2
7288 ,p_work_schedule IN VARCHAR2
7289 ,p_part_time_hour IN VARCHAR2
7290 ,p_to_grade_id IN per_assignments_f.grade_id%type
7291 ,p_pay_plan IN VARCHAR2
7292 ,p_to_pay_plan IN VARCHAR2
7293 ,p_pay_table_id IN NUMBER
7294 ,p_grade_or_level IN VARCHAR2
7295 ,p_to_grade_or_level IN VARCHAR2
7296 ,p_step_or_rate IN VARCHAR2
7297 ,p_pay_basis IN VARCHAR2
7298 ) IS
7299 -- Bug3437354
7300 CURSOR cur_valid_DS(p_ds_id NUMBER)
7301 IS
7302 SELECT effective_end_date end_date
7303 FROM ghr_duty_stations_f
7304 WHERE duty_station_id=p_ds_id
7305 AND g_effective_date between effective_start_date and effective_end_date;
7306
7307 l_ds_end_date ghr_duty_stations_f.effective_end_date%type;
7308
7309 BEGIN
7310 savepoint execute_msl_sp;
7311 l_msl_cnt := l_msl_cnt +1;
7312 --Bug#3968005 Initialised l_sel_flg
7313 l_sel_flg := NULL;
7314 l_pay_calc_in_data := NULL;
7315 l_pay_calc_out_data := NULL;
7316
7317 l_assignment_id := p_assignment_id;
7318 l_position_id := p_position_id;
7319 l_grade_id := p_grade_id;
7320 l_business_group_id := p_business_group_iD;
7321 l_location_id := p_location_id;
7322 -- Bug#5063304
7323 l_personnel_office_id := p_personnel_office_id;
7324 l_org_structure_id := p_org_structure_id;
7325 l_position_title := p_position_title;
7326 l_position_number := p_position_number;
7327 l_position_seq_no := p_position_seq_no;
7328 l_sub_element_code := p_subelem_code;
7329 l_duty_station_id := p_duty_station_id;
7330 l_tenure := p_tenure;
7331 l_annuitant_indicator := p_annuitant_indicator;
7332 l_pay_rate_determinant := p_pay_rate_determinant;
7333 l_work_schedule := P_work_schedule;
7334 l_part_time_hour := p_part_time_hour;
7335 l_to_grade_id := p_to_grade_id;
7336 l_pay_plan := p_pay_plan;
7337 l_to_pay_plan := p_to_pay_plan;
7338 l_pay_table_id := p_pay_table_id;
7339 l_grade_or_level := p_grade_or_level;
7340 l_to_grade_or_level := p_to_grade_or_level;
7341 l_step_or_rate := P_step_or_rate;
7342 l_pay_basis := p_pay_basis;
7343 hr_utility.set_location('The location id is:'||l_location_id,1);
7344 /*5470182 need to be commented
7345 --------GPPA Update 46 start
7346 ghr_msl_pkg.g_first_noa_code := NULL;
7347 FOR cur_eq_ppl_rec IN cur_eq_ppl(l_pay_plan)
7348 LOOP
7349 l_eq_pay_plan := cur_eq_ppl_rec.EQUIVALENT_PAY_PLAN;
7350 exit;
7351 END LOOP;
7352 if l_effective_date >= to_date('2007/01/07','YYYY/MM/DD') AND
7353 l_eq_pay_plan = 'GS' AND
7354 l_lac_sf52_rec.first_action_la_code1 = 'QLP' AND
7355 l_lac_sf52_rec.first_action_la_code2 = 'ZLM' THEN
7356
7357 ghr_msl_pkg.g_first_noa_code := '890';
7358
7359 end if;
7360 if l_effective_date >= to_date('2007/01/07','YYYY/MM/DD') AND
7361 l_eq_pay_plan = 'FW' AND
7362 l_lac_sf52_rec.first_action_la_code1 = 'RJR' THEN
7363
7364 ghr_msl_pkg.g_first_noa_code := '890';
7365
7366 end if;
7367 --------GPPA Update 46 end */
7368
7369 --5470182
7370 ghr_msl_pkg.g_first_noa_code := '890';
7371 l_lac_sf52_rec.first_action_la_code1 := 'Q3C';
7372 -- l_lac_sf52_rec.first_action_la_desc1 := 'Reg. 534.404(h)';
7373 l_lac_sf52_rec.first_action_la_desc1 := ghr_pa_requests_pkg.get_lookup_description(800,'GHR_US_LEGAL_AUTHORITY','Q3C');
7374
7375 g_proc := 'Location Validation';
7376 -- Start of Bug3437354
7377 IF l_location_id IS NULL THEN
7378 l_mslerrbuf := ' Error: No valid Location found, salary cannot be calculated correctly'||
7379 ' without the employee''s duty location. ';
7380 RAISE msl_error;
7381 END IF;
7382
7383 g_proc := 'Duty Station Validation';
7384 IF l_duty_station_id IS NOT NULL THEN
7385
7386 --
7387 -- Added this condition for bug 3437354, error out the record without valid Loc id
7388 --
7389 FOR rec_ds in cur_valid_ds(l_duty_station_id)
7390 LOOP
7391 l_ds_end_date := rec_ds.end_Date;
7392 END LOOP;
7393 IF l_ds_end_date IS NULL THEN
7394 hr_utility.set_location('Under DS null check'||l_duty_station_id, 1);
7395 l_mslerrbuf := ' Error: Duty Station associated with the location is INVALID. '||
7396 'Salary cannot be calculated correctly without valid duty station. ';
7397 RAISE msl_error;
7398 END IF;
7399
7400 END IF;
7401 -- End of bug 3437354
7402
7403 /* -- BEGIN
7404 ghr_pa_requests_pkg.get_SF52_loc_ddf_details
7405 (p_location_id => l_location_id
7406 ,p_duty_station_id => l_duty_station_id);
7407 / *exception
7408 when others then
7409 hr_utility.set_location(
7410 'Error in Ghr_pa_requests_pkg.get_sf52_loc_ddf_details'||
7411 'Err is '||sqlerrm(sqlcode),20);
7412 l_mslerrbuf := 'Error in get_sf52_loc_ddf_details '||
7413 'Sql Err is '|| sqlerrm(sqlcode);
7414 raise msl_error;
7415 end;* /
7416
7417
7418
7419 get_pos_grp1_ddf(l_position_id,
7420 l_effective_date,
7421 l_pos_grp1_rec);
7422
7423 l_personnel_office_id := l_pos_grp1_rec.poei_information3;
7424 l_org_structure_id := l_pos_grp1_rec.poei_information5;
7425
7426 get_sub_element_code_pos_title(l_position_id,
7427 p_person_id,
7428 l_business_group_id,
7429 l_assignment_id,
7430 l_effective_date,
7431 l_sub_element_code,
7432 l_position_title,
7433 l_position_number,
7434 l_position_seq_no);
7435
7436 hr_utility.set_location('The duty station id is:'||l_duty_station_id,12345);
7437
7438 if check_init_eligibility(l_p_duty_station_id,
7439 l_p_PERSONNEL_OFFICE_ID,
7440 l_p_AGENCY_CODE_SUBELEMENT,
7441 l_duty_station_id,
7442 l_personnel_office_id,
7443 l_sub_element_code) then
7444
7445 hr_utility.set_location('check_init_eligibility ' || l_proc,6);
7446 -- Bug 3457205 Filter the Pay plan table id condition also b4 checking any other thing
7447 -- Moving check_eligibility to here.
7448 -- Get PRD, work schedule etc form ASG EI
7449 begin
7450 ghr_pa_requests_pkg.get_sf52_asg_ddf_details
7451 (l_assignment_id,
7452 l_effective_date,
7453 l_tenure,
7454 l_annuitant_indicator,
7455 l_pay_rate_determinant,
7456 l_work_schedule,
7457 l_part_time_hour);
7458 exception
7459 when others then
7460 hr_utility.set_location('Error in Ghr_pa_requests_pkg.get_sf52_asg_ddf_details'||
7461 'Err is '||sqlerrm(sqlcode),20);
7462 l_mslerrbuf := 'Error in get_sf52_asgddf_details Sql Err is '|| sqlerrm(sqlcode);
7463 raise msl_error;
7464 end;
7465
7466 -- Bug 3315432 Madhuri
7467 --
7468 FOR l_cnt in 1..rec_pp_prd.COUNT LOOP
7469
7470 ---Bug 3327999 First filter the PRD. Then check for Pay plan and Pay table ID
7471 IF nvl(rec_pp_prd(l_cnt).prd,l_pay_rate_determinant) = l_pay_rate_determinant THEN
7472 -- Get Pay table ID and other details
7473 BEGIN
7474 -- Bug#5089732 Used the overloaded procedure.
7475 get_pay_plan_and_table_id
7476 (l_pay_rate_determinant,p_person_id,
7477 l_position_id,l_effective_date,
7478 l_grade_id, l_to_grade_id,l_assignment_id,'SHOW',
7479 l_pay_plan,l_to_pay_plan,l_pay_table_id,
7480 l_grade_or_level, l_to_grade_or_level, l_step_or_rate,
7481 l_pay_basis);
7482 EXCEPTION
7483 when msl_error then
7484 l_mslerrbuf := hr_utility.get_message;
7485 raise;
7486 END;
7487
7488 IF ( nvl(rec_pp_prd(l_cnt).pay_plan,l_pay_plan) = l_pay_plan
7489 and l_user_table_id = nvl(l_pay_table_id,l_user_table_id) ) THEN
7490
7491 IF check_eligibility(l_mass_salary_id,
7492 l_user_table_id,
7493 l_pay_table_id,
7494 l_pay_plan,
7495 l_pay_rate_determinant,
7496 p_person_id,
7497 l_effective_date,
7498 p_action) THEN
7499 hr_utility.set_location('check_eligibility ' || l_proc,8); */
7500 -- Bug#5063304 Moved this call outside check_init_eligibility condition to
7501 -- this location.
7502 -- BUG 3377958 Madhuri
7503 -- Pick the organization name
7504 g_proc := 'Fetch Organization Name';
7505 l_org_name :=GHR_MRE_PKG.GET_ORGANIZATION_NAME(P_ORGANIZATION_ID);
7506 l_ses_basic_pay := NULL;
7507 -- BUG 3377958 Madhuri
7508 IF upper(p_action) = 'REPORT' AND l_submit_flag = 'P' THEN
7509 -- BUG 3377958 Madhuri
7510 pop_dtls_from_pa_req(p_person_id,l_effective_date,l_mass_salary_id,l_org_name);
7511 -- BUG 3377958 Madhuri
7512 ELSE
7513 if check_select_flg_ses(p_person_id,upper(p_action),
7514 l_effective_date,p_mass_salary_id,l_sel_flg,l_ses_basic_pay) then
7515
7516 hr_utility.set_location('check_select_flg ' || l_proc,7);
7517 BEGIN
7518 hr_utility.set_location('The duty station name is:'||l_duty_station_code,12345);
7519 hr_utility.set_location('The duty station desc is:'||l_duty_station_desc,12345);
7520 ghr_pa_requests_pkg.get_duty_station_details
7521 (p_duty_station_id => l_duty_station_id
7522 ,p_effective_date => l_effective_date
7523 ,p_duty_station_code => l_duty_station_code
7524 ,p_duty_station_desc => l_duty_station_desc);
7525 EXCEPTION
7526 WHEN others THEN
7527 hr_utility.set_location('Error in Ghr_pa_requests_pkg.get_duty_station_details'||
7528 'Err is '||sqlerrm(sqlcode),20);
7529 l_mslerrbuf := 'Error in get_duty_station_details Sql Err is '|| sqlerrm(sqlcode);
7530 RAISE msl_error;
7531
7532 END;
7533
7534 get_other_dtls_for_rep(l_pay_rate_determinant,
7535 l_executive_order_number,
7536 to_char(l_executive_order_date),
7537 l_first_action_la_code1,
7538 l_first_action_la_code2,
7539 l_remark_code1,
7540 l_remark_code2);
7541
7542 get_from_sf52_data_elements
7543 (l_assignment_id, l_effective_date,
7544 l_old_basic_pay, l_old_avail_pay,
7545 l_old_loc_diff, l_tot_old_sal,
7546 l_old_auo_pay, l_old_adj_basic_pay,
7547 l_other_pay, l_auo_premium_pay_indicator,
7548 l_ap_premium_pay_indicator,
7549 l_retention_allowance,
7550 l_retention_allow_perc,
7551 l_supervisory_differential,
7552 l_supervisory_diff_perc,
7553 l_staffing_differential);
7554
7555 l_pay_calc_in_data.person_id := p_person_id;
7556 l_pay_calc_in_data.position_id := l_position_id;
7557 --l_pay_calc_in_data.noa_family_code := 'SALARY_CHG';
7558 l_pay_calc_in_data.noa_family_code := 'GHR_SAL_PAY_ADJ';
7559 l_pay_calc_in_data.noa_code := nvl(g_first_noa_code,'890');
7560 l_pay_calc_in_data.second_noa_code := null;
7561 l_pay_calc_in_data.first_action_la_code1 := l_lac_sf52_rec.first_action_la_code1;
7562 l_pay_calc_in_data.effective_date := l_effective_date;
7563 l_pay_calc_in_data.pay_rate_determinant := l_pay_rate_determinant;
7564 l_pay_calc_in_data.pay_plan := l_pay_plan;
7565 l_pay_calc_in_data.grade_or_level := l_grade_or_level;
7566 l_pay_calc_in_data.step_or_rate := l_step_or_rate;
7567 l_pay_calc_in_data.pay_basis := l_pay_basis;
7568 l_pay_calc_in_data.user_table_id := l_pay_table_id;
7569 l_pay_calc_in_data.duty_station_id := l_duty_station_id;
7570 l_pay_calc_in_data.auo_premium_pay_indicator := l_auo_premium_pay_indicator;
7571 l_pay_calc_in_data.ap_premium_pay_indicator := l_ap_premium_pay_indicator;
7572 l_pay_calc_in_data.retention_allowance := l_retention_allowance;
7573 l_pay_calc_in_data.to_ret_allow_percentage := l_retention_allow_perc;
7574 l_pay_calc_in_data.supervisory_differential := l_supervisory_differential;
7575 l_pay_calc_in_data.staffing_differential := l_staffing_differential;
7576 l_pay_calc_in_data.current_basic_pay := l_old_basic_pay;
7577 l_pay_calc_in_data.current_adj_basic_pay := l_old_adj_basic_pay;
7578 l_pay_calc_in_data.current_step_or_rate := l_step_or_rate;
7579 l_pay_calc_in_data.pa_request_id := null;
7580
7581 l_pay_calc_in_data.open_range_out_basic_pay := l_ses_basic_pay;
7582
7583 ghr_msl_pkg.g_ses_msl_process := 'N';
7584
7585 IF l_pay_plan in ('ES','EP','IE','FE') and l_essl_table THEN
7586 ghr_msl_pkg.g_ses_msl_process := 'Y';
7587 l_step_or_rate := '00';
7588 END IF;
7589
7590 BEGIN
7591 ghr_pay_calc.sql_main_pay_calc (l_pay_calc_in_data
7592 ,l_pay_calc_out_data
7593 ,l_message_set
7594 ,l_calculated);
7595
7596 IF l_message_set THEN
7597 hr_utility.set_location( l_proc, 40);
7598 l_calculated := FALSE;
7599 l_mslerrbuf := hr_utility.get_message;
7600 -- raise msl_error;
7601 END IF;
7602 EXCEPTION
7603 when msl_error then
7604 g_proc := 'ghr_pay_calc';
7605 raise;
7606 when others then
7607 ----BUG 3287299 Start
7608 IF ghr_pay_calc.gm_unadjusted_pay_flg = 'Y' then
7609 l_comment := 'MSL:Error: Unadjusted Basic Pay must be entered in Employee record.';
7610 ELSE
7611 l_comment := 'MSL:Error: See process log for details.';
7612 END IF;
7613
7614 IF upper(p_action) IN ('SHOW') THEN
7615 -- Bug#2383392
7616 create_mass_act_prev (
7617 p_effective_date => l_effective_date,
7618 p_date_of_birth => p_date_of_birth,
7619 p_full_name => p_full_name,
7620 p_national_identifier => p_national_identifier,
7621 p_duty_station_code => l_duty_station_code,
7622 p_duty_station_desc => l_duty_station_desc,
7623 p_personnel_office_id => l_personnel_office_id,
7624 p_basic_pay => l_old_basic_pay,
7625 p_new_basic_pay => null,
7626 --Bug#2383992 Added old_adj_basic_pay
7627 p_adj_basic_pay => l_old_adj_basic_pay,
7628 p_new_adj_basic_pay => null,
7629 p_old_avail_pay => l_old_avail_pay,
7630 p_new_avail_pay => null,
7631 p_old_loc_diff => l_old_loc_diff,
7632 p_new_loc_diff => null,
7633 p_tot_old_sal => l_tot_old_sal,
7634 p_tot_new_sal => null,
7635 p_old_auo_pay => l_old_auo_pay,
7636 p_new_auo_pay => null,
7637 p_position_id => l_position_id,
7638 p_position_title => l_position_title,
7639 -- FWFA Changes Bug#4444609
7640 p_position_number => l_position_number,
7641 p_position_seq_no => l_position_seq_no,
7642 -- FWFA Changes
7643 p_org_structure_id => l_org_structure_id,
7644 p_agency_sub_element_code => l_sub_element_code,
7645 p_person_id => p_person_id,
7646 p_mass_salary_id => l_mass_salary_id,
7647 p_sel_flg => l_sel_flg,
7648 p_first_action_la_code1 => l_first_action_la_code1,
7649 p_first_action_la_code2 => l_first_action_la_code2,
7650 p_remark_code1 => l_remark_code1,
7651 p_remark_code2 => l_remark_code2,
7652 p_grade_or_level => l_grade_or_level,
7653 p_step_or_rate => l_step_or_rate,
7654 p_pay_plan => l_pay_plan,
7655 p_pay_rate_determinant => null,
7656 p_tenure => l_tenure,
7657 p_action => p_action,
7658 p_assignment_id => l_assignment_id,
7659 p_old_other_pay => l_other_pay,
7660 p_new_other_pay => null,
7661 -- Bug#2383992
7662 p_old_capped_other_pay => NULL,
7663 p_new_capped_other_pay => NULL,
7664 p_old_retention_allowance => l_retention_allowance,
7665 p_new_retention_allowance => NULL,
7666 p_old_supervisory_differential => l_supervisory_differential,
7667 p_new_supervisory_differential => NULL,
7668 -- BUG 3377958 Madhuri
7669 p_organization_name => l_org_name,
7670 -- BUG 3377958 Madhuri
7671 -- Bug#2383992
7672 -- FWFA changes Bug#4444609
7673 p_input_pay_rate_determinant => l_pay_rate_determinant,
7674 p_from_pay_table_id => l_user_table_id,
7675 p_to_pay_table_id => null
7676 -- FWFA changes
7677 );
7678 END IF;
7679 -- Bug#3968005 Replaced parameter l_pay_sel with l_sel_flg
7680 ins_upd_per_ses_extra_info
7681 (p_person_id,l_effective_date, l_sel_flg, l_comment,p_mass_salary_id);
7682 l_comment := NULL;
7683 ------ BUG 3287299 End
7684 hr_utility.set_location('Error in Ghr_pay_calc.sql_main_pay_calc '||
7685 'Err is '||sqlerrm(sqlcode),20);
7686 l_mslerrbuf := 'Error in ghr_pay_calc Sql Err is '|| sqlerrm(sqlcode);
7687 g_proc := 'ghr_pay_calc';
7688 raise msl_error;
7689 END;
7690
7691 ghr_msl_pkg.g_ses_msl_process := 'N';
7692
7693 l_new_basic_pay := l_pay_calc_out_data.basic_pay;
7694 l_new_locality_adj := l_pay_calc_out_data.locality_adj;
7695 l_new_adj_basic_pay := l_pay_calc_out_data.adj_basic_pay;
7696 l_new_au_overtime := l_pay_calc_out_data.au_overtime;
7697 l_new_availability_pay := l_pay_calc_out_data.availability_pay;
7698
7699 --Added by mani related to the bug 5919694
7700 l_out_pay_plan := l_pay_calc_out_data.out_to_pay_plan;
7701 l_out_grade_id := l_pay_calc_out_data.out_to_grade_id;
7702 l_out_grade_or_level := l_pay_calc_out_data.out_to_grade_or_level;
7703
7704
7705 l_out_pay_rate_determinant := l_pay_calc_out_data.out_pay_rate_determinant;
7706 l_out_step_or_rate := l_pay_calc_out_data.out_step_or_rate;
7707 l_new_retention_allowance := l_pay_calc_out_data.retention_allowance;
7708 l_new_supervisory_differential := l_supervisory_differential;
7709 l_new_other_pay_amount := l_pay_calc_out_data.other_pay_amount;
7710 l_entitled_other_pay := l_new_other_pay_amount;
7711 if l_new_other_pay_amount = 0 then
7712 l_new_other_pay_amount := null;
7713 end if;
7714 l_new_total_salary := l_pay_calc_out_data.total_salary;
7715
7716 hr_utility.set_location('retention_allowance = ' || to_char(l_retention_allowance),10);
7717 hr_utility.set_location('Supervisory Diff Amount = ' || to_char(l_supervisory_differential),10);
7718
7719
7720 -------------Call Pay cap Procedure
7721 begin
7722 l_capped_other_pay := ghr_pa_requests_pkg2.get_cop( p_assignment_id => l_assignment_id
7723 ,p_effective_date => l_effective_date);
7724 l_old_capped_other_pay := l_capped_other_pay;
7725 -- Sundar Added the following if statement to improve performance
7726 if hr_utility.debug_enabled = true then
7727 hr_utility.set_location('Before Pay Cap ' || l_proc,21);
7728 hr_utility.set_location('l_effective_date ' || l_effective_date,21);
7729 hr_utility.set_location('l_out_pay_rate_determinant ' || l_out_pay_rate_determinant,21);
7730 hr_utility.set_location('l_pay_plan ' || l_pay_plan,21);
7731 hr_utility.set_location('l_position_id ' || to_char(l_position_id),21);
7732 hr_utility.set_location('l_pay_basis ' || l_pay_basis,21);
7733 hr_utility.set_location('person_id ' || to_char(p_person_id),21);
7734 hr_utility.set_location('l_new_basic_pay ' || to_char(l_new_basic_pay),21);
7735 hr_utility.set_location('l_new_locality_adj ' || to_char(l_new_locality_adj),21);
7736 hr_utility.set_location('l_new_adj_basic_pay ' || to_char(l_new_adj_basic_pay),21);
7737 hr_utility.set_location('l_new_total_salary ' || to_char(l_new_total_salary),21);
7738 hr_utility.set_location('l_entitled_other_pay ' || to_char(l_entitled_other_pay),21);
7739 hr_utility.set_location('l_capped_other_pay ' || to_char(l_capped_other_pay),21);
7740 hr_utility.set_location('l_new_retention_allowance ' || to_char(l_new_retention_allowance),21);
7741 hr_utility.set_location('l_new_supervisory_differential ' || to_char(l_new_supervisory_differential),21);
7742 hr_utility.set_location('l_staffing_differential ' || to_char(l_staffing_differential),21);
7743 hr_utility.set_location('l_new_au_overtime ' || to_char(l_new_au_overtime),21);
7744 hr_utility.set_location('l_new_availability_pay ' || to_char(l_new_availability_pay),21);
7745
7746 end if;
7747
7748
7749 ghr_pay_caps.do_pay_caps_main
7750 (p_pa_request_id => null
7751 ,p_effective_date => l_effective_date
7752 ,p_pay_rate_determinant => nvl(l_out_pay_rate_determinant,l_pay_rate_determinant)
7753 ,p_pay_plan => nvl(l_out_pay_plan,l_pay_plan)
7754 ,p_to_position_id => l_position_id
7755 ,p_pay_basis => l_pay_basis
7756 ,p_person_id => p_person_id
7757 ,p_noa_code => nvl(g_first_noa_code,'894')
7758 ,p_basic_pay => l_new_basic_pay
7759 ,p_locality_adj => l_new_locality_adj
7760 ,p_adj_basic_pay => l_new_adj_basic_pay
7761 ,p_total_salary => l_new_total_salary
7762 ,p_other_pay_amount => l_entitled_other_pay
7763 ,p_capped_other_pay => l_capped_other_pay
7764 ,p_retention_allowance => l_new_retention_allowance
7765 ,p_retention_allow_percentage => l_retention_allow_perc
7766 ,p_supervisory_allowance => l_new_supervisory_differential
7767 ,p_staffing_differential => l_staffing_differential
7768 ,p_au_overtime => l_new_au_overtime
7769 ,p_availability_pay => l_new_availability_pay
7770 ,p_adj_basic_message => l_adj_basic_message
7771 ,p_pay_cap_message => l_pay_cap_message
7772 ,p_pay_cap_adj => l_temp_retention_allowance
7773 ,p_open_pay_fields => l_open_pay_fields_caps
7774 ,p_message_set => l_message_set_caps
7775 ,p_total_pay_check => l_total_pay_check);
7776
7777
7778 l_new_other_pay_amount := nvl(l_capped_other_pay,l_entitled_other_pay);
7779
7780 -- Sundar Added the following statement to improve performance
7781 if hr_utility.debug_enabled = true then
7782 hr_utility.set_location('After Pay Cap ' || l_proc,22);
7783 hr_utility.set_location('l_effective_date ' || l_effective_date,22);
7784 hr_utility.set_location('l_out_pay_rate_determinant ' || l_out_pay_rate_determinant,22);
7785 hr_utility.set_location('l_pay_plan ' || l_pay_plan,22);
7786 hr_utility.set_location('l_position_id ' || to_char(l_position_id),22);
7787 hr_utility.set_location('l_pay_basis ' || l_pay_basis,22);
7788 hr_utility.set_location('person_id ' || to_char(p_person_id),22);
7789 hr_utility.set_location('l_new_basic_pay ' || to_char(l_new_basic_pay),22);
7790 hr_utility.set_location('l_new_locality_adj ' || to_char(l_new_locality_adj),22);
7791 hr_utility.set_location('l_new_adj_basic_pay ' || to_char(l_new_adj_basic_pay),22);
7792 hr_utility.set_location('l_new_total_salary ' || to_char(l_new_total_salary),22);
7793 hr_utility.set_location('l_entitled_other_pay ' || to_char(l_entitled_other_pay),22);
7794 hr_utility.set_location('l_capped_other_pay ' || to_char(l_capped_other_pay),22);
7795 hr_utility.set_location('l_new_retention_allowance ' || to_char(l_new_retention_allowance),22);
7796 hr_utility.set_location('l_new_supervisory_differential ' || to_char(l_new_supervisory_differential),22);
7797 hr_utility.set_location('l_staffing_differential ' || to_char(l_staffing_differential),22);
7798 hr_utility.set_location('l_new_au_overtime ' || to_char(l_new_au_overtime),22);
7799 hr_utility.set_location('l_new_availability_pay ' || to_char(l_new_availability_pay),22);
7800 end if;
7801
7802 IF l_pay_cap_message THEN
7803 IF nvl(l_temp_retention_allowance,0) > 0 THEN
7804 l_comment := 'MSL: Exceeded Total Cap - reduce Retention Allow to '
7805 || to_char(l_temp_retention_allowance);
7806 -- Bug#3968005 Replaced l_pay_sel with l_sel_flg
7807 l_sel_flg := 'N';
7808 ELSE
7809 l_comment := 'MSL: Exceeded Total cap - pls review.';
7810 END IF;
7811 ELSIF l_adj_basic_message THEN
7812 l_comment := 'MSL: Exceeded Adjusted Pay Cap - Locality reduced.';
7813 END IF;
7814
7815
7816
7817 -- Bug 2639698 Sundar
7818 IF (l_old_basic_pay > l_new_basic_pay) THEN
7819 l_comment_sal := 'MSL: From Basic Pay exceeds To Basic Pay.';
7820 END IF;
7821 -- End Bug 2639698
7822
7823 IF l_pay_cap_message or l_adj_basic_message THEN
7824 -- Bug 2639698
7825 IF (l_comment_sal IS NOT NULL) THEN
7826 l_comment := l_comment_sal || ' ' || l_comment;
7827 END IF;
7828 -- End Bug 2639698
7829 -- Bug#3968005 Replaced parameter l_pay_sel with l_sel_flg
7830 ins_upd_per_extra_info
7831 (p_person_id,l_effective_date, l_sel_flg, l_comment,p_mass_salary_id);
7832 l_comment := NULL;
7833 --------------------Bug 2639698 Sundar To add comments
7834 -- Should create comments only if comments need to be inserted
7835 ELSIF l_comment_sal IS NOT NULL THEN
7836 -- Bug#3968005 Replaced parameter l_pay_sel with l_sel_flg
7837 ins_upd_per_extra_info
7838 (p_person_id,l_effective_date, l_sel_flg, l_comment_sal,p_mass_salary_id);
7839 END IF;
7840
7841 l_comment_sal := NULL; -- bug 2639698
7842 exception
7843 when msl_error then
7844 raise;
7845 when others then
7846 IF ghr_msl_pkg.g_ses_bp_capped = TRUE and upper(p_action) IN ('SHOW') THEN
7847 l_comment := 'MSL: Exceeded Basic Pay Cap EX III';
7848 l_sel_flg := 'N';
7849 ins_upd_per_extra_info
7850 (p_person_id,l_effective_date, l_sel_flg, l_comment,p_mass_salary_id);
7851 l_comment := NULL;
7852 ELSE
7853 hr_utility.set_location('Error in ghr_pay_caps.do_pay_caps_main ' ||
7854 'Err is '||sqlerrm(sqlcode),23);
7855 l_mslerrbuf := 'Error in do_pay_caps_main Sql Err is '|| sqlerrm(sqlcode);
7856 raise msl_error;
7857 END IF;
7858 end;
7859
7860
7861 IF upper(p_action) IN ('SHOW','REPORT') THEN
7862 -- Bug#2383392
7863 create_mass_act_prev (
7864 p_effective_date => l_effective_date,
7865 p_date_of_birth => p_date_of_birth,
7866 p_full_name => p_full_name,
7867 p_national_identifier => p_national_identifier,
7868 p_duty_station_code => l_duty_station_code,
7869 p_duty_station_desc => l_duty_station_desc,
7870 p_personnel_office_id => l_personnel_office_id,
7871 p_basic_pay => l_old_basic_pay,
7872 p_new_basic_pay => l_new_basic_pay,
7873 --Bug#2383992 Added old_adj_basic_pay
7874 p_adj_basic_pay => l_old_adj_basic_pay,
7875 p_new_adj_basic_pay => l_new_adj_basic_pay,
7876 p_old_avail_pay => l_old_avail_pay,
7877 p_new_avail_pay => l_new_availability_pay,
7878 p_old_loc_diff => l_old_loc_diff,
7879 p_new_loc_diff => l_new_locality_adj,
7880 p_tot_old_sal => l_tot_old_sal,
7881 p_tot_new_sal => l_new_total_salary,
7882 p_old_auo_pay => l_old_auo_pay,
7883 p_new_auo_pay => l_new_au_overtime,
7884 p_position_id => l_position_id,
7885 p_position_title => l_position_title,
7886 -- FWFA Changes Bug#4444609
7887 p_position_number => l_position_number,
7888 p_position_seq_no => l_position_seq_no,
7889 -- FWFA Changes
7890 p_org_structure_id => l_org_structure_id,
7891 p_agency_sub_element_code => l_sub_element_code,
7892 p_person_id => p_person_id,
7893 p_mass_salary_id => l_mass_salary_id,
7894 p_sel_flg => l_sel_flg,
7895 p_first_action_la_code1 => l_first_action_la_code1,
7896 p_first_action_la_code2 => l_first_action_la_code2,
7897 p_remark_code1 => l_remark_code1,
7898 p_remark_code2 => l_remark_code2,
7899 p_grade_or_level => NVL(l_out_grade_or_level,l_grade_or_level),
7900 p_step_or_rate => l_step_or_rate,
7901 p_pay_plan => NVL(l_out_pay_plan,l_pay_plan),
7902 -- FWFA Changes Bug#4444609
7903 p_pay_rate_determinant => NVL(l_out_pay_rate_determinant,l_pay_rate_determinant),
7904 -- FWFA Changes
7905 p_tenure => l_tenure,
7906 p_action => p_action,
7907 p_assignment_id => l_assignment_id,
7908 p_old_other_pay => l_other_pay,
7909 p_new_other_pay => l_new_other_pay_amount,
7910 -- Bug#2383992
7911 p_old_capped_other_pay => l_old_capped_other_pay,--NULL,
7912 p_new_capped_other_pay => l_capped_other_pay,
7913 p_old_retention_allowance => l_retention_allowance,
7914 p_new_retention_allowance => l_new_retention_allowance,
7915 p_old_supervisory_differential => l_supervisory_differential,
7916 p_new_supervisory_differential => l_new_supervisory_differential,
7917 -- BUG 3377958 Madhuri
7918 p_organization_name => l_org_name,
7919 -- Bug#2383992
7920 -- FWFA Changes Bug#4444609
7921 p_input_pay_rate_determinant => l_pay_rate_determinant,
7922 p_from_pay_table_id => l_pay_calc_out_data.pay_table_id,
7923 p_to_pay_table_id => l_pay_calc_out_data.calculation_pay_table_id
7924 -- FWFA Changes
7925 );
7926 ELSIF upper(p_action) = 'CREATE' then
7927
7928 BEGIN
7929 -- Bug#5089732 Used the overloaded procedure.
7930 get_pay_plan_and_table_id
7931 (l_pay_rate_determinant,p_person_id,
7932 l_position_id,l_effective_date,
7933 l_grade_id, l_to_grade_id,l_assignment_id,'CREATE',
7934 l_pay_plan,l_to_pay_plan,l_pay_table_id,
7935 l_grade_or_level, l_to_grade_or_level, l_step_or_rate,
7936 l_pay_basis);
7937 EXCEPTION
7938 when msl_error then
7939 l_mslerrbuf := hr_utility.get_message;
7940 raise;
7941 END;
7942
7943 assign_to_sf52_rec(
7944 p_person_id,
7945 p_first_name,
7946 p_last_name,
7947 p_middle_names,
7948 p_national_identifier,
7949 p_date_of_birth,
7950 l_effective_date,
7951 l_assignment_id,
7952 l_tenure,
7953 -- Bug#5089732
7954 NVL(l_out_grade_id,l_to_grade_id),
7955 NVL(l_out_pay_plan,l_to_pay_plan),
7956 NVL(l_out_grade_or_level,l_to_grade_or_level),
7957 -- Bug#5089732
7958 l_step_or_rate,
7959 l_annuitant_indicator,
7960 -- FWFA Changes Bug#4444609
7961 NVL(l_out_pay_rate_determinant,l_pay_rate_determinant),
7962 -- FWFA Changes
7963 l_work_schedule,
7964 l_part_time_hour,
7965 l_pos_ei_data.poei_information7, --FLSA Category
7966 l_pos_ei_data.poei_information8, --Bargaining Unit Status
7967 l_pos_ei_data.poei_information11,--Functional Class
7968 l_pos_ei_data.poei_information16,--Supervisory Status,
7969 l_new_basic_pay,
7970 l_new_locality_adj,
7971 l_new_adj_basic_pay,
7972 l_new_total_salary,
7973 l_other_pay,
7974 l_new_other_pay_amount,
7975 l_new_au_overtime,
7976 l_new_availability_pay,
7977 l_new_retention_allowance,
7978 l_retention_allow_perc,
7979 l_new_supervisory_differential,
7980 l_supervisory_diff_perc,
7981 l_staffing_differential,
7982 l_duty_station_id,
7983 l_duty_station_code,
7984 l_duty_station_desc,
7985 -- FWFA Changes Bug#4444609
7986 l_pay_rate_determinant,
7987 l_pay_calc_out_data.pay_table_id,
7988 l_pay_calc_out_data.calculation_pay_table_id,
7989 -- FWFA Changes
7990 l_lac_sf52_rec,
7991 l_sf52_rec);
7992
7993 BEGIN
7994 ghr_mass_actions_pkg.pay_calc_rec_to_sf52_rec
7995 (l_pay_calc_out_data,
7996 l_sf52_rec);
7997 EXCEPTION
7998 when others then
7999 hr_utility.set_location('Error in Ghr_mass_actions_pkg.pay_calc_rec_to_sf52_rec '||
8000 'Err is '||sqlerrm(sqlcode),20);
8001 l_mslerrbuf := 'Error in ghr_mass_act_pkg.pay_calc_to_sf52 Sql Err is '|| sqlerrm(sqlcode);
8002 raise msl_error;
8003 END;
8004
8005 BEGIN
8006 l_sf52_rec.mass_action_id := p_mass_salary_id;
8007 l_sf52_rec.rpa_type := 'MRR';
8008 g_proc := 'Create_sf52_recrod';
8009 ghr_mass_changes.create_sf52_for_mass_changes
8010 (p_mass_action_type => 'MASS_SALARY_CHG',
8011 p_pa_request_rec => l_sf52_rec,
8012 p_errbuf => l_errbuf,
8013 p_retcode => l_retcode);
8014
8015 ------ Added by Dinkar for List reports problem
8016 ---------------------------------------
8017 IF l_errbuf IS NULL THEN
8018
8019 DECLARE
8020 l_pa_request_number ghr_pa_requests.request_number%TYPE;
8021 BEGIN
8022 l_pa_request_number :=
8023 l_sf52_rec.request_number||'-'||p_mass_salary_id;
8024
8025 ghr_par_upd.upd
8026 (p_pa_request_id => l_sf52_rec.pa_request_id,
8027 p_object_version_number => l_sf52_rec.object_version_number,
8028 p_request_number => l_pa_request_number
8029 );
8030 END;
8031
8032 pr('No error in create sf52 ');
8033
8034 ghr_mto_int.log_message(
8035 p_procedure => 'Successful Completion',
8036 p_message => 'Name: '||p_full_name ||
8037 ' SSN: '|| p_national_identifier||
8038 ' Mass Salary : '||
8039 p_mass_salary ||' SF52 Successfully completed');
8040
8041 create_lac_remarks(l_pa_request_id,
8042 l_sf52_rec.pa_request_id);
8043
8044 --5470182
8045 /* -- Added by Enunez 11-SEP-1999
8046 IF l_lac_sf52_rec.first_action_la_code1 IS NULL THEN
8047 -- Added by Edward Nunez for 894 rules
8048 g_proc := 'Apply_894_Rules';
8049 --Bug 2012782 fix
8050 IF l_out_pay_rate_determinant IS NULL THEN
8051 l_out_pay_rate_determinant := l_pay_rate_determinant;
8052 END IF;
8053 --Bug 2012782 fix end
8054 ghr_lacs_remarks.Apply_894_Rules(
8055 l_sf52_rec.pa_request_id,
8056 l_out_pay_rate_determinant,
8057 l_pay_rate_determinant,
8058 l_out_step_or_rate,
8059 l_executive_order_number,
8060 l_executive_order_date,
8061 l_opm_issuance_number,
8062 l_opm_issuance_date,
8063 l_errbuf,
8064 l_retcode
8065 );
8066 IF l_errbuf IS NOT NULL THEN
8067 IF sqlcode = 0000 THEN
8068 l_mslerrbuf := l_mslerrbuf || '; ' || l_errbuf;
8069 ELSE
8070 l_mslerrbuf := l_mslerrbuf || ' ' || l_errbuf || ' Sql Err is: '
8071 || sqlerrm(sqlcode);
8072 END IF;
8073 RAISE msl_error;
8074 END IF;
8075 END IF; -- IF l_lac_sf52_rec.first_action_la_code1*/
8076 g_proc := 'update_SEL_FLG';
8077
8078 update_SEL_FLG(p_PERSON_ID,l_effective_date);
8079
8080 COMMIT;
8081 ELSE
8082 pr('Error in create sf52',l_errbuf);
8083 l_recs_failed := l_recs_failed + 1;
8084 -- Raising MSL_ERROR is not required as the process log
8085 -- was updated in ghr_mass_changes.create_sf52_for_mass_changes pkg itself.
8086 --raise msl_error;
8087 END IF; -- if l_errbuf is null then
8088 EXCEPTION
8089 WHEN msl_error then raise;
8090 WHEN others then null;
8091 l_mslerrbuf := 'Error in ghr_mass_chg.create_sf52 '||
8092 ' Sql Err is '|| sqlerrm(sqlcode);
8093 RAISE msl_error;
8094 END;
8095 END IF; -- IF upper(p_action) IN ('SHOW','REPORT') THEN
8096 END IF; -- end if for check_select_flg
8097 END IF; -- end if for p_action = 'REPORT'
8098
8099
8100 L_row_cnt := L_row_cnt + 1;
8101 IF upper(p_action) <> 'CREATE' THEN
8102 IF L_row_cnt > 50 then
8103 COMMIT;
8104 L_row_cnt := 0;
8105 END IF;
8106 END IF;
8107 EXCEPTION
8108 WHEN MSL_ERROR THEN
8109 HR_UTILITY.SET_LOCATION('Error occurred in '||l_proc||' Sql error '||sqlerrm(sqlcode),10);
8110 begin
8111 ------ BUG 3287299 -- Not to rollback for preview.
8112 if upper(p_action) <> 'SHOW' then
8113 ROLLBACK TO EXECUTE_MSL_SP;
8114 end if;
8115 EXCEPTION
8116 WHEN OTHERS THEN NULL;
8117 END;
8118 l_log_text := 'Error in '||l_proc||' '||
8119 ' For Mass Salary Name : '||p_mass_salary||
8120 'Name: '|| p_full_name || ' SSN: ' || p_national_identifier ||
8121 l_mslerrbuf;
8122 hr_utility.set_location('before creating entry in log file',10);
8123 l_recs_failed := l_recs_failed + 1;
8124 begin
8125 ghr_mto_int.log_message(
8126 p_procedure => g_proc,
8127 p_message => l_log_text);
8128 exception
8129 when others then
8130 hr_utility.set_message(8301, 'GHR_38475_ERROR_LOG_FAILURE');
8131 hr_utility.raise_error;
8132 end;
8133 when others then
8134 HR_UTILITY.SET_LOCATION('Error (Others) occurred in '||l_proc||' Sql error '||sqlerrm(sqlcode),20);
8135 BEGIN
8136 ROLLBACK TO EXECUTE_MSL_SP;
8137 EXCEPTION
8138 WHEN OTHERS THEN NULL;
8139 END;
8140 l_log_text := 'Error (others) in '||l_proc||
8141 ' For Mass Salary Name : '||p_mass_salary||
8142 'Name: '|| p_full_name || ' SSN: ' || p_national_identifier ||
8143 ' Sql Err is '||sqlerrm(sqlcode);
8144 hr_utility.set_location('before creating entry in log file',20);
8145 l_recs_failed := l_recs_failed + 1;
8146 begin
8147 ghr_mto_int.log_message(
8148 p_procedure => g_proc,
8149 p_message => l_log_text);
8150 exception
8151 when others then
8152 hr_utility.set_message(8301, 'Create Error Log failed');
8153 hr_utility.raise_error;
8154 end;
8155 END msl_ses_process;
8156
8157 BEGIN
8158
8159 g_proc := 'execute_msl_ses_range';
8160 hr_utility.set_location('Entering ' || l_proc,5);
8161 p_retcode := 0;
8162
8163 g_first_noa_code := null;
8164 BEGIN
8165 FOR msl IN ghr_msl (p_mass_salary_id)
8166 LOOP
8167 p_mass_salary := msl.name;
8168 l_effective_date := msl.effective_date;
8169 l_mass_salary_id := msl.mass_salary_id;
8170 l_user_table_id := msl.user_table_id;
8171 l_submit_flag := msl.submit_flag;
8172
8173
8174 l_executive_order_number := msl.executive_order_number;
8175 l_executive_order_date := msl.executive_order_date;
8176
8177 l_opm_issuance_number := msl.opm_issuance_number;
8178 l_opm_issuance_date := msl.opm_issuance_date;
8179 l_pa_request_id := msl.pa_request_id;
8180 l_rowid := msl.rowid;
8181 l_p_ORGANIZATION_ID := msl.ORGANIZATION_ID;
8182 l_p_DUTY_STATION_ID := msl.DUTY_STATION_ID;
8183 l_p_PERSONNEL_OFFICE_ID := msl.PERSONNEL_OFFICE_ID;
8184 l_p_AGENCY_CODE_SUBELEMENT := msl.AGENCY_CODE_SUBELEMENT;
8185
8186 pr('Pa request id is '||to_char(l_pa_request_id));
8187 exit;
8188 END LOOP;
8189 EXCEPTION
8190 when REC_BUSY then
8191 hr_utility.set_location('Mass Salary is in use',1);
8192 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
8193 -- raise error;
8194 hr_utility.set_message(8301, 'GHR_38477_LOCK_ON_MSL');
8195 hr_utility.raise_error;
8196 --
8197 when others then
8198 hr_utility.set_location('Error in '||l_proc||' Sql err is '||sqlerrm(sqlcode),1);
8199 -- raise_application_error(-20111,'Error while selecting from Ghr Mass Salaries');
8200 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
8201 raise msl_error;
8202 END;
8203
8204 g_effective_date := l_effective_date;
8205
8206 for c_pay_tab_essl_rec in c_pay_tab_essl loop
8207 l_essl_table := TRUE;
8208 exit;
8209 end loop;
8210 --5470182
8211
8212 FOR pp_prd IN cur_pp_prd(p_mass_salary_id)
8213 LOOP
8214 rec_pp_prd(l_index).pay_plan := pp_prd.pay_plan;
8215 rec_pp_prd(l_index).prd := pp_prd.prd;
8216 l_index := l_index +1;
8217 END LOOP;
8218
8219
8220 /*-- Bug 3315432 Madhuri
8221 --
8222 FOR pp_prd_per_gr IN cur_pp_prd_per_gr(p_mass_salary_id)
8223 LOOP
8224 rec_pp_prd_per_gr(l_index).pay_plan := pp_prd_per_gr.pay_plan;
8225 rec_pp_prd_per_gr(l_index).prd := pp_prd_per_gr.prd;
8226 rec_pp_prd_per_gr(l_index).percent := pp_prd_per_gr.percent;
8227 rec_pp_prd_per_gr(l_index).grade := pp_prd_per_gr.grade;
8228 l_index := l_index +1;
8229
8230 END LOOP;*/
8231
8232 IF upper(p_action) = 'CREATE' then
8233 ghr_mto_int.set_log_program_name('GHR_MSL_PKG');
8234 ELSE
8235 ghr_mto_int.set_log_program_name('MSL_'||p_mass_salary);
8236 END IF;
8237
8238 -- Commented out by Edward Nunez. It's not needed anymore with 894 rules
8239 -- IF upper(p_action) = 'CREATE' then
8240 -- if l_pa_request_id is null then
8241 -- hr_utility.set_message(8301, 'GHR_99999_SELECT_LAC_REMARKS');
8242 -- hr_utility.raise_error;
8243 -- END IF;
8244 -- END IF;
8245
8246 get_lac_dtls(l_pa_request_id,
8247 l_lac_sf52_rec);
8248
8249 --purge_old_data(l_mass_salary_id);
8250
8251 hr_utility.set_location('After fetch msl '||to_char(l_effective_date)
8252 ||' '||to_char(l_user_table_id),20);
8253
8254 IF l_p_ORGANIZATION_ID is not null then
8255 FOR per IN cur_people_org (l_effective_date,l_p_ORGANIZATION_ID)
8256 LOOP
8257 -- Bug#5719467 Initialised the variable l_mslerrbuf to avoid ora error 6502
8258 l_mslerrbuf := NULL;
8259 -- Bug#5063304 Added the following IF Condition.
8260 IF NVL(l_p_organization_id,per.organization_id) = per.organization_id THEN
8261 FOR ast IN cur_ast (per.assignment_status_type_id)
8262 LOOP
8263 -- Set all local variables to NULL
8264 l_personnel_office_id := NULL;
8265 l_org_structure_id := NULL;
8266 l_position_title := NULL;
8267 l_position_number := NULL;
8268 l_position_seq_no := NULL;
8269 l_sub_element_code := NULL;
8270 l_duty_station_id := NULL;
8271 l_tenure := NULL;
8272 l_annuitant_indicator := NULL;
8273 l_pay_rate_determinant := NULL;
8274 l_work_schedule := NULL;
8275 l_part_time_hour := NULL;
8276 l_to_grade_id := NULL;
8277 l_pay_plan := NULL;
8278 l_to_pay_plan := NULL;
8279 l_pay_table_id := NULL;
8280 l_grade_or_level := NULL;
8281 l_to_grade_or_level := NULL;
8282 l_step_or_rate := NULL;
8283 l_pay_basis := NULL;
8284 l_elig_flag := FALSE;
8285 --
8286 BEGIN
8287 fetch_and_validate_emp_ses(
8288 p_action => p_action
8289 ,p_mass_salary_id => p_mass_salary_id
8290 ,p_mass_salary_name => p_mass_salary
8291 ,p_full_name => per.full_name
8292 ,p_national_identifier => per.national_identifier
8293 ,p_assignment_id => per.assignment_id
8294 ,p_person_id => per.person_id
8295 ,p_position_id => per.position_id
8296 ,p_grade_id => per.grade_id
8297 ,p_business_group_id => per.business_group_id
8298 ,p_location_id => per.location_id
8299 ,p_organization_id => per.organization_id
8300 ,p_msl_organization_id => l_p_organization_id
8301 ,p_msl_duty_station_id => l_p_duty_station_id
8302 ,p_msl_personnel_office_id => l_p_personnel_office_id
8303 ,p_msl_agency_code_subelement => l_p_agency_code_subelement
8304 ,p_msl_user_table_id => l_user_table_id
8305 ,p_rec_pp_prd => rec_pp_prd
8306 ,p_personnel_office_id => l_personnel_office_id
8307 ,p_org_structure_id => l_org_structure_id
8308 ,p_position_title => l_position_title
8309 ,p_position_number => l_position_number
8310 ,p_position_seq_no => l_position_seq_no
8311 ,p_subelem_code => l_sub_element_code
8312 ,p_duty_station_id => l_duty_station_id
8313 ,p_tenure => l_tenure
8314 ,p_annuitant_indicator => l_annuitant_indicator
8315 ,p_pay_rate_determinant => l_pay_rate_determinant
8316 ,p_work_schedule => l_work_schedule
8317 ,p_part_time_hour => l_part_time_hour
8318 ,p_to_grade_id => l_to_grade_id
8319 ,p_pay_plan => l_pay_plan
8320 ,p_to_pay_plan => l_to_pay_plan
8321 ,p_pay_table_id => l_pay_table_id
8322 ,p_grade_or_level => l_grade_or_level
8323 ,p_to_grade_or_level => l_to_grade_or_level
8324 ,p_step_or_rate => l_step_or_rate
8325 ,p_pay_basis => l_pay_basis
8326 ,p_elig_flag => l_elig_flag
8327 );
8328 EXCEPTION
8329 --WHEN fetch_validate_error THEN
8330 --l_elig_flag := FALSE;
8331 WHEN OTHERS THEN
8332 l_elig_flag := FALSE;
8333 END;
8334
8335 IF l_elig_flag THEN
8336 msl_ses_process( p_assignment_id => per.assignment_id
8337 ,p_person_id => per.person_id
8338 ,p_position_id => per.position_id
8339 ,p_grade_id => per.grade_id
8340 ,p_business_group_id => per.business_group_id
8341 ,p_location_id => per.location_id
8342 ,p_organization_id => per.organization_id
8343 ,p_date_of_birth => per.date_of_birth
8344 ,p_first_name => per.first_name
8345 ,p_last_name => per.last_name
8346 ,p_full_name => per.full_name
8347 ,p_middle_names => per.middle_names
8348 ,p_national_identifier => per.national_identifier
8349 ,p_personnel_office_id => l_personnel_office_id
8350 ,p_org_structure_id => l_org_structure_id
8351 ,p_position_title => l_position_title
8352 ,p_position_number => l_position_number
8353 ,p_position_seq_no => l_position_seq_no
8354 ,p_subelem_code => l_sub_element_code
8355 ,p_duty_station_id => l_duty_station_id
8356 ,p_tenure => l_tenure
8357 ,p_annuitant_indicator => l_annuitant_indicator
8358 ,p_pay_rate_determinant => l_pay_rate_determinant
8359 ,p_work_schedule => l_work_schedule
8360 ,p_part_time_hour => l_part_time_hour
8361 ,p_to_grade_id => l_to_grade_id
8362 ,p_pay_plan => l_pay_plan
8363 ,p_to_pay_plan => l_to_pay_plan
8364 ,p_pay_table_id => l_pay_table_id
8365 ,p_grade_or_level => l_grade_or_level
8366 ,p_to_grade_or_level => l_to_grade_or_level
8367 ,p_step_or_rate => l_step_or_rate
8368 ,p_pay_basis => l_pay_basis
8369 );
8370 END IF;
8371 END LOOP;
8372 END IF;
8373 END LOOP;
8374 ELSE
8375 FOR per IN cur_people (l_effective_date)
8376 LOOP
8377 -- Bug#5719467 Initialised the variable l_mslerrbuf to avoid ora error 6502
8378 l_mslerrbuf := NULL;
8379 FOR ast IN cur_ast (per.assignment_status_type_id)
8380 LOOP
8381 --
8382 -- Set all local variables to NULL
8383 l_personnel_office_id := NULL;
8384 l_org_structure_id := NULL;
8385 l_position_title := NULL;
8386 l_position_number := NULL;
8387 l_position_seq_no := NULL;
8388 l_sub_element_code := NULL;
8389 l_duty_station_id := NULL;
8390 l_tenure := NULL;
8391 l_annuitant_indicator := NULL;
8392 l_pay_rate_determinant := NULL;
8393 l_work_schedule := NULL;
8394 l_part_time_hour := NULL;
8395 l_to_grade_id := NULL;
8396 l_pay_plan := NULL;
8397 l_to_pay_plan := NULL;
8398 l_pay_table_id := NULL;
8399 l_grade_or_level := NULL;
8400 l_to_grade_or_level := NULL;
8401 l_step_or_rate := NULL;
8402 l_pay_basis := NULL;
8403 l_elig_flag := FALSE;
8404 --
8405 BEGIN
8406 fetch_and_validate_emp_ses(
8407 p_action => p_action
8408 ,p_mass_salary_id => p_mass_salary_id
8409 ,p_mass_salary_name => p_mass_salary
8410 ,p_full_name => per.full_name
8411 ,p_national_identifier => per.national_identifier
8412 ,p_assignment_id => per.assignment_id
8413 ,p_person_id => per.person_id
8414 ,p_position_id => per.position_id
8415 ,p_grade_id => per.grade_id
8416 ,p_business_group_id => per.business_group_id
8417 ,p_location_id => per.location_id
8418 ,p_organization_id => per.organization_id
8419 ,p_msl_organization_id => l_p_organization_id
8420 ,p_msl_duty_station_id => l_p_duty_station_id
8421 ,p_msl_personnel_office_id => l_p_personnel_office_id
8422 ,p_msl_agency_code_subelement => l_p_agency_code_subelement
8423 ,p_msl_user_table_id => l_user_table_id
8424 ,p_rec_pp_prd => rec_pp_prd
8425 ,p_personnel_office_id => l_personnel_office_id
8426 ,p_org_structure_id => l_org_structure_id
8427 ,p_position_title => l_position_title
8428 ,p_position_number => l_position_number
8429 ,p_position_seq_no => l_position_seq_no
8430 ,p_subelem_code => l_sub_element_code
8431 ,p_duty_station_id => l_duty_station_id
8432 ,p_tenure => l_tenure
8433 ,p_annuitant_indicator => l_annuitant_indicator
8434 ,p_pay_rate_determinant => l_pay_rate_determinant
8435 ,p_work_schedule => l_work_schedule
8436 ,p_part_time_hour => l_part_time_hour
8437 ,p_to_grade_id => l_to_grade_id
8438 ,p_pay_plan => l_pay_plan
8439 ,p_to_pay_plan => l_to_pay_plan
8440 ,p_pay_table_id => l_pay_table_id
8441 ,p_grade_or_level => l_grade_or_level
8442 ,p_to_grade_or_level => l_to_grade_or_level
8443 ,p_step_or_rate => l_step_or_rate
8444 ,p_pay_basis => l_pay_basis
8445 ,p_elig_flag => l_elig_flag
8446 );
8447 EXCEPTION
8448 --WHEN fetch_validate_error THEN
8449 -- l_elig_flag := FALSE;
8450 WHEN OTHERS THEN
8451 l_elig_flag := FALSE;
8452 END;
8453 IF l_elig_flag THEN
8454 msl_ses_process(
8455 p_assignment_id => per.assignment_id
8456 ,p_person_id => per.person_id
8457 ,p_position_id => per.position_id
8458 ,p_grade_id => per.grade_id
8459 ,p_business_group_id => per.business_group_id
8460 ,p_location_id => per.location_id
8461 ,p_organization_id => per.organization_id
8462 ,p_date_of_birth => per.date_of_birth
8463 ,p_first_name => per.first_name
8464 ,p_last_name => per.last_name
8465 ,p_full_name => per.full_name
8466 ,p_middle_names => per.middle_names
8467 ,p_national_identifier => per.national_identifier
8468 ,p_personnel_office_id => l_personnel_office_id
8469 ,p_org_structure_id => l_org_structure_id
8470 ,p_position_title => l_position_title
8471 ,p_position_number => l_position_number
8472 ,p_position_seq_no => l_position_seq_no
8473 ,p_subelem_code => l_sub_element_code
8474 ,p_duty_station_id => l_duty_station_id
8475 ,p_tenure => l_tenure
8476 ,p_annuitant_indicator => l_annuitant_indicator
8477 ,p_pay_rate_determinant => l_pay_rate_determinant
8478 ,p_work_schedule => l_work_schedule
8479 ,p_part_time_hour => l_part_time_hour
8480 ,p_to_grade_id => l_to_grade_id
8481 ,p_pay_plan => l_pay_plan
8482 ,p_to_pay_plan => l_to_pay_plan
8483 ,p_pay_table_id => l_pay_table_id
8484 ,p_grade_or_level => l_grade_or_level
8485 ,p_to_grade_or_level => l_to_grade_or_level
8486 ,p_step_or_rate => l_step_or_rate
8487 ,p_pay_basis => l_pay_basis
8488 );
8489 END IF;
8490
8491 END LOOP;
8492 END LOOP;
8493 END IF;
8494
8495 pr('After processing is over ',to_char(l_recs_failed));
8496 /*
8497 if (l_recs_failed < (l_msl_cnt * (1/3))) then
8498 */
8499 if (l_recs_failed = 0) then
8500 IF upper(p_action) = 'CREATE' THEN
8501 begin
8502 update ghr_mass_salaries
8503 set submit_flag = 'P'
8504 where rowid = l_rowid;
8505 EXCEPTION
8506 when others then
8507 HR_UTILITY.SET_LOCATION('Error in Update ghr_msl Sql error '||sqlerrm(sqlcode),30);
8508 hr_utility.set_message(8301, 'GHR_38476_UPD_GHR_MSL_FAILURE');
8509 hr_utility.raise_error;
8510 END;
8511 -----Bug 2849262. Updating extra info to null is already done by Update_sel_flg in the main loop.
8512 ----- So it is not required to do in global if you see the procedure upd_ext_info_to_null
8513 ----- Commenting the following line. Dated 14-OCT-2003.
8514 -----
8515 ----- upd_ext_info_to_null(l_effective_date);
8516 end if;
8517 ELSE
8518 --if (l_recs_failed <> 0) then
8519 p_errbuf := 'Error in '||l_proc || ' Details in GHR_PROCESS_LOG';
8520 p_retcode := 2;
8521 IF upper(p_action) = 'CREATE' THEN
8522 update ghr_mass_salaries
8523 set submit_flag = 'E'
8524 where rowid = l_rowid;
8525 END IF;
8526 end if;
8527 pr('Before commiting.....');
8528 COMMIT;
8529 pr('After commiting.....',to_char(l_recs_failed));
8530
8531 EXCEPTION
8532 when others then
8533 -- raise_application_error(-20121,'Error in execute_msl_ses Err is '||sqlerrm(sqlcode));
8534 HR_UTILITY.SET_LOCATION('Error (Others2) occurred in '||l_proc||' Sql error '||sqlerrm(sqlcode),30);
8535 BEGIN
8536 ROLLBACK TO execute_msl_ses_sp;
8537 EXCEPTION
8538 WHEN OTHERS THEN NULL;
8539 END;
8540 l_log_text := 'Error in '||l_proc||
8541 ' For Mass Salary Name : '||p_mass_salary||
8542 ' Sql Err is '||sqlerrm(sqlcode);
8543 l_recs_failed := l_recs_failed + 1;
8544 hr_utility.set_location('before creating entry in log file',30);
8545
8546 p_errbuf := 'Error in '||l_proc || ' Details in GHR_PROCESS_LOG';
8547 p_retcode := 2;
8548 IF upper(p_action) = 'CREATE' THEN
8549 update ghr_mass_salaries
8550 set submit_flag = 'E'
8551 where rowid = l_rowid;
8552 commit;
8553 END IF;
8554
8555 begin
8556 ghr_mto_int.log_message(
8557 p_procedure => g_proc,
8558 p_message => l_log_text);
8559
8560 exception
8561 when others then
8562 hr_utility.set_message(8301, 'Create Error Log failed');
8563 hr_utility.raise_error;
8564 end;
8565
8566 END execute_msl_ses_range;
8567
8568
8569 procedure ins_upd_per_ses_extra_info
8570 (p_person_id in number,
8571 p_effective_date in date,
8572 p_sel_flag in varchar2,
8573 p_comment in varchar2,
8574 p_msl_id in number,
8575 p_ses_basic_pay in number default NULL) is
8576
8577 l_person_extra_info_id number;
8578 l_object_version_number number;
8579 l_per_ei_data per_people_extra_info%rowtype;
8580
8581 CURSOR people_ext_cur (person number) is
8582 SELECT person_extra_info_id, object_version_number
8583 FROM PER_people_EXTRA_INFO
8584 WHERE person_ID = person
8585 and information_type = 'GHR_US_PER_MASS_ACTIONS';
8586
8587 l_proc varchar2(72) := g_package || '.ins_upd_per_ses_extra_info';
8588 l_eff_date date;
8589
8590 begin
8591 g_proc := 'ins_upd_per_ses_extra_info';
8592 hr_utility.set_location('Entering ' || l_proc,5);
8593 if p_effective_date > sysdate then
8594 l_eff_date := sysdate;
8595 else
8596 l_eff_date := p_effective_date;
8597 end if;
8598
8599 ghr_history_fetch.fetch_peopleei
8600 (p_person_id => p_person_id
8601 ,p_information_type => 'GHR_US_PER_MASS_ACTIONS'
8602 ,p_date_effective => l_eff_date
8603 ,p_per_ei_data => l_per_ei_data);
8604
8605 l_person_extra_info_id := l_per_ei_data.person_extra_info_id;
8606 l_object_version_number := l_per_ei_data.object_version_number;
8607
8608 if l_person_extra_info_id is null then
8609 for per_ext_rec in people_ext_cur(p_person_id)
8610 loop
8611 l_person_extra_info_id := per_ext_rec.person_extra_info_id;
8612 l_object_version_number := per_ext_rec.object_version_number;
8613 end loop;
8614 end if;
8615
8616 if l_person_extra_info_id is not null then
8617 ghr_person_extra_info_api.update_person_extra_info
8618 (P_PERSON_EXTRA_INFO_ID => l_person_extra_info_id
8619 ,P_EFFECTIVE_DATE => trunc(l_eff_date)
8620 ,P_OBJECT_VERSION_NUMBER => l_object_version_number
8621 ,p_pei_INFORMATION3 => p_sel_flag
8622 ,p_pei_INFORMATION4 => p_comment
8623 ,p_pei_INFORMATION5 => to_char(p_msl_id)
8624 ,p_pei_information10 => NULL
8625 ,p_pei_information11 => to_char(p_ses_basic_pay)
8626 ,P_PEI_INFORMATION_CATEGORY => 'GHR_US_PER_MASS_ACTIONS');
8627 else
8628 ghr_person_extra_info_api.create_person_extra_info
8629 (P_pERSON_ID => p_PERSON_id
8630 ,P_INFORMATION_TYPE => 'GHR_US_PER_MASS_ACTIONS'
8631 ,P_EFFECTIVE_DATE => trunc(l_eff_date)
8632 ,p_pei_INFORMATION3 => p_sel_flag
8633 ,p_pei_INFORMATION4 => p_comment
8634 ,p_pei_INFORMATION5 => to_char(p_msl_id)
8635 ,p_pei_information10 =>NULL
8636 ,p_pei_information11 => to_char(p_ses_basic_pay)
8637 ,P_PEI_INFORMATION_CATEGORY => 'GHR_US_PER_MASS_ACTIONS'
8638 ,P_pERSON_EXTRA_INFO_ID => l_pERSON_extra_info_id
8639 ,P_OBJECT_VERSION_NUMBER => l_object_version_number);
8640 end if;
8641
8642 ---Commented the following two lines to remove Validation functionality on Person.
8643 -- ghr_validate_perwsepi.validate_perwsepi(p_person_id);
8644 -- ghr_validate_perwsepi.update_person_user_type(p_person_id);
8645
8646 hr_utility.set_location('Exiting ' || l_proc,10);
8647 exception
8648 when msl_error then raise;
8649 when others then
8650 pr('Error in '||l_proc);
8651 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
8652 l_mslerrbuf := 'Error in '||l_proc||' Sql Err is '|| sqlerrm(sqlcode);
8653 raise msl_error;
8654 end ins_upd_per_ses_extra_info;
8655
8656
8657 function check_select_flg_ses(p_person_id in number,
8658 p_action in varchar2,
8659 p_effective_date in date,
8660 p_mass_salary_id in number,
8661 p_sel_flg in out nocopy varchar2,
8662 p_ses_basic_pay in out nocopy number
8663 )
8664 return boolean IS
8665
8666 l_per_ei_data per_people_extra_info%rowtype;
8667 l_comments varchar2(250);
8668 l_sel_flag varchar2(3);
8669 l_line number := 0;
8670 l_proc varchar2(72) := g_package || '.check_select_flg_ses';
8671 l_ses_basic_pay ghr_mass_actions_preview.to_basic_pay%type;
8672 l_temp_ses_basic_pay number;
8673 l_increase_percent number;
8674 begin
8675
8676 g_proc := 'check_select_flg_ses';
8677 l_temp_ses_basic_pay := p_ses_basic_pay;
8678
8679 hr_utility.set_location('Entering ' || l_proc,5);
8680
8681 get_extra_info_comments(p_person_id,p_effective_date,l_sel_flag,l_comments,p_mass_salary_id,l_increase_percent,l_ses_basic_pay); -- Added by Sundar 3843306
8682
8683 -------- Initialize the comments
8684 -- Sundar 3337361 Included GM Error, To basic pay < From basic pay in the condition
8685 -- Now all the messages have MSL as a prefix. Rest of the conditions are alo
8686 -- included for the old records which may still have old message.
8687 IF l_comments is not null THEN
8688 --Bug#4093705 Added ltrim function to verify the System generated Comments as few comments
8689 -- might start with Blank Spaces. Removed NVL condition as control comes here
8690 -- only when l_comments has Non Null value.
8691 IF substr(ltrim(l_comments),1,8) = 'Exceeded'
8692 OR substr(ltrim(l_comments),1,3) = 'MSL'
8693 OR substr(ltrim(l_comments),1,5) = 'Error'
8694 OR substr(ltrim(l_comments),1,13) = 'The From Side'
8695 THEN
8696 ins_upd_per_ses_extra_info
8697 (p_person_id,p_effective_date, l_sel_flag, null,p_mass_salary_id,l_ses_basic_pay);
8698 END IF;
8699 END IF;
8700 -- Bug 3843306 If Increase percent is entered from Preview screen, the same should be retrieved
8701 -- and not the one entered in Grade screen.
8702
8703 IF l_ses_basic_pay IS NOT NULL THEN
8704 p_ses_basic_pay := l_ses_basic_pay;
8705 END IF;
8706
8707 if l_sel_flag is null then
8708 p_sel_flg := 'Y';
8709 else
8710 p_sel_flg := l_sel_flag;
8711 end if;
8712
8713 l_line := 15;
8714 if p_action IN ('SHOW','REPORT') THEN
8715 return TRUE;
8716 elsif p_action = 'CREATE' THEN
8717 if p_sel_flg = 'Y' THEN
8718 return TRUE;
8719 else
8720 return FALSE;
8721 end if;
8722 end if;
8723 exception
8724 when msl_error then raise;
8725 when others then
8726 p_ses_basic_pay := l_temp_ses_basic_pay ;
8727 hr_utility.set_location('Error in '||l_proc||' Err is '||sqlerrm(sqlcode),20);
8728 l_mslerrbuf := 'Error in '||l_proc||' @'||to_char(l_line)||' Sql Err is '|| sqlerrm(sqlcode);
8729 raise msl_error;
8730 end check_select_flg_ses;
8731
8732
8733 END GHR_MSL_PKG;