[Home] [Help]
PACKAGE BODY: APPS.GHR_CORR_CANC_SF52
Source
1 Package Body GHR_CORR_CANC_SF52 as
2 /* $Header: ghcorcan.pkb 120.17.12010000.5 2008/10/21 09:11:04 vmididho ship $ */
3 --
4 --
5 -- ----------------------------------------------------------------------------
6 -- |--------------------------< <Ghr_Corr_Canc_SF52> >--------------------------|
7 -- ----------------------------------------------------------------------------
8 --
9
10 --
11 TYPE pa_req_info is record (
12 pa_request_id ghr_pa_requests.pa_request_id%type,
13 object_version_number ghr_pa_requests.object_version_number%type,
14 status ghr_pa_requests.status%type,
15 row_id varchar2(20),
16 cancel_legal_authority ghr_pa_requests.first_action_la_code1%type
17 );
18
19 cursor c_get_sf52 (c_pa_request_id in number) is
20 select
21 *
22 from ghr_pa_requests
23 where pa_request_id = c_pa_request_id;
24
25 --
26
27 -- Declaring local procedures and functions
28 Procedure delete_element_entry(
29 p_hist_rec in ghr_pa_history%rowtype,
30 p_del_mode in varchar2 default hr_api.g_delete_next_change,
31 p_cannot_cancel out nocopy Boolean) ;
32
33 Procedure delete_eleentval( p_hist_rec in ghr_pa_history%rowtype) ;
34 Procedure delete_peop_row(
35 p_person_id in varchar2,
36 p_dt_mode in varchar2,
37 p_date_effective in date) ;
38 Procedure delete_asgn_row(
39 p_assignment_id in varchar2,
40 p_dt_mode in varchar2,
41 p_date_effective in date) ;
42 Procedure delete_peopei_row( p_person_extra_info_id in varchar2) ;
43 Procedure delete_asgnei_row( p_assignment_extra_info_id in varchar2) ;
44 Procedure delete_posnei_row( p_position_extra_info_id in varchar2) ;
45 Procedure delete_address_row(p_address_id in varchar2) ;
46 Procedure delete_person_analyses_row ( p_person_analysis_id in number);
47
48 Procedure delete_appl_row(
49 p_table_name in varchar2,
50 p_table_pk_id in varchar2,
51 p_dt_mode in varchar2,
52 p_date_effective in date) ;
53 Procedure delete_hist_row (
54 p_row_id in rowid);
55 Procedure delete_hist_row (
56 p_pa_history_id in ghr_pa_history.pa_history_id%type);
57 Procedure apply_correction(
58 p_sf52rec_correct in ghr_pa_requests%rowtype,
59 p_corr_pa_request_id in ghr_pa_requests.pa_request_id%type,
60 p_sf52rec in out nocopy ghr_pa_requests%rowtype ) ;
61 Procedure apply_noa_corrections(
62 p_sf52_data in ghr_pa_requests%rowtype,
63 p_sf52_data_result in out nocopy ghr_pa_requests%rowtype );
64 Procedure Undo_Mark_Cancel(
65 p_sf52_data in ghr_pa_requests%rowtype);
66
67 Procedure what_to_do( p_datetrack_table in boolean,
68 p_pre_record_exists in boolean,
69 p_interv_on_table in boolean,
70 p_interv_on_eff_date in boolean,
71 p_rec_created_flag in boolean,
72 p_can_delete out nocopy boolean,
73 p_last_row out nocopy boolean,
74 p_cannot_cancel out nocopy boolean) ;
75
76 Procedure convert_shadow_to_sf52 (
77 p_shadow in ghr_pa_request_shadow%rowtype,
78 p_sf52 out nocopy ghr_pa_requests%rowtype);
79
80 Procedure IF_ZAP_ELE_ENT(
81 p_element_entry_id in number,
82 p_effective_start_date in date,
83 p_pa_history_id in number,
84 p_result out nocopy Boolean);
85
86 -- VSM [Procedures for delete subsequent correction functionality]
87 Procedure Process_Cancel (
88 p_sf52_data in out nocopy ghr_pa_requests%rowtype);
89
90 Procedure Cancel_subs_correction (
91 p_corr_sf52_detail in out nocopy pa_req_info,
92 p_which_noa in number);
93
94 -- Bug#2521744
95 -- This procedure will delete the first datetrack row for the
96 -- other pay elements/other elements whereever necessary.
97 Procedure delete_other_pay_entries(p_hist_rec in ghr_pa_history%rowtype,
98 p_element_name in varchar2);
99
100 -- This procedure will get the other pay component values
101 -- at the time of intervening correction.
102 PROCEDURE get_sf52_to_othpays_for_ia
103 (p_sf52_ia_rec in out nocopy ghr_pa_requests%rowtype);
104 -- End of Bug#2521744
105
106 Function get_sf52_ovn ( p_pa_request_id in number) return number;
107 --
108
109
110
111 ----- End of Local procedure declaration -------
112
113 -- ---------------------------------------------------------------------------
114 -- |--------------------------< cancel_term_sf52>---------------------------|
115 -- ---------------------------------------------------------------------------
116 -- {Start Of Comments}
117 --
118 -- Description:
119 -- This procedure cancels a termination sf52.
120 --
121 -- Pre-Requisities:
122 -- None.
123 --
124 -- In Parameters:
125 -- p_sf52_data -> ghr_pa_requests record of the cancellation sf52.
126 --
127 -- Post Success:
128 -- The termination sf52 will have been cancelled.
129 --
130 -- Post Failure:
131 -- No failure conditions.
132 --
133 -- Developer Implementation Notes:
134 -- None
135 --
136 -- Access Status:
137 -- Internal Development Use Only.
138 --
139 -- {End Of Comments}
140 -- ---------------------------------------------------------------------------
141
142 Procedure cancel_term_SF52 ( p_sf52_data in out nocopy ghr_pa_requests%rowtype) is
143
144 -- this cursor gets the rowids from ghr_pa_history for the given pa_request_id.
145 cursor c_hist ( c_pa_request_id number,
146 c_noa_id number) is
147 select
148 rowid row_id, table_name,pa_history_id,information5
149 ,information9, information10
150 from ghr_pa_history
151 where pa_request_id = c_pa_request_id
152 and nature_of_action_id = c_noa_id
153 for update of person_id
154 order by pa_history_id desc; -- Bug# 1316321
155
156
157 cursor c_follow_rec( c_table_name ghr_pa_history.table_name%type,
158 c_pk_id ghr_pa_history.information1%type,
159 c_pa_history_id ghr_pa_history.pa_history_id%type) is
160 select pa_history_id
161 from ghr_pa_history
162 where table_name = c_table_name
163 and information1 = c_pk_id
164 and pa_history_id > c_pa_history_id;
165
166
167 cursor c_hist_sevpay ( c_pa_request_id number,
168 c_table_name ghr_pa_history.table_name%type) IS
169 select *
170 from ghr_pa_history
171 where pa_request_id = c_pa_request_id
172 and table_name = c_table_name;
173
174
175 l_buf number;
176 l_follow_rec boolean;
177 l_hist_pre ghr_pa_history%rowtype;
178 l_hist_rec ghr_pa_history%rowtype;
179 l_hist_sevpay ghr_pa_history%rowtype;
180 l_cannot_cancel_sevpay boolean;
181 l_interv_on_table boolean;
182 l_interv_on_eff_date boolean;
183 l_hist_data_as_of_date ghr_pa_history%rowtype;
184 l_session_var ghr_history_api.g_session_var_type;
185 l_agency_ei_data ghr_pa_request_extra_info%rowtype;
186 l_imm_asg_sf52 ghr_api.asg_sf52_type;
187 l_imm_asg_non_sf52 ghr_api.asg_non_sf52_type;
188 l_imm_asg_nte_dates ghr_api.asg_nte_dates_type;
189 l_imm_per_sf52 ghr_api.per_sf52_type;
190 l_imm_per_group1 ghr_api.per_group1_type;
191 l_imm_per_group2 ghr_api.per_group2_type;
192 l_imm_per_scd_info ghr_api.per_scd_info_type;
193 l_imm_per_retained_grade ghr_api.per_retained_grade_type;
194 l_imm_per_probations ghr_api.per_probations_type;
195 l_imm_per_sep_retire ghr_api.per_sep_retire_type;
196 l_imm_per_security ghr_api.per_security_type;
197 -- Bug#4486823 RRR changes
198 l_imm_per_service_oblig ghr_api.per_service_oblig_type;
199 l_imm_per_conversions ghr_api.per_conversions_type;
200 -- 4352589 BEN_EIT Changes
201 l_imm_per_benefit_info ghr_api.per_benefit_info_type;
202 l_imm_per_uniformed_services ghr_api.per_uniformed_services_type;
203 l_imm_pos_oblig ghr_api.pos_oblig_type;
204 l_imm_pos_grp2 ghr_api.pos_grp2_type;
205 l_imm_pos_grp1 ghr_api.pos_grp1_type;
206 l_imm_pos_valid_grade ghr_api.pos_valid_grade_type;
207 l_imm_pos_car_prog ghr_api.pos_car_prog_type;
208 l_imm_loc_info ghr_api.loc_info_type;
209 l_imm_wgi ghr_api.within_grade_increase_type;
210 l_imm_gov_awards ghr_api.government_awards_type;
211 l_imm_recruitment_bonus ghr_api.recruitment_bonus_type;
212 l_imm_relocation_bonus ghr_api.relocation_bonus_type;
213 l_imm_student_loan_repay ghr_api.student_loan_repay_type;
214 --Pradeep
215 l_imm_mddds_special_pay ghr_api.mddds_special_pay_type;
216 l_imm_premium_pay_ind ghr_api.premium_pay_ind_type;
217
218 l_imm_extra_info_rec ghr_api.extra_info_rec_type ;
219 l_imm_sf52_from_data ghr_api.prior_sf52_data_type;
220 l_imm_personal_info ghr_api.personal_info_type;
221 l_imm_generic_extra_info_rec ghr_api.generic_extra_info_rec_type ;
222 l_imm_agency_sf52 ghr_api.agency_sf52_type;
223 l_agency_code varchar2(50);
224 l_imm_perf_appraisal ghr_api.performance_appraisal_type;
225 l_imm_conduct_performance ghr_api.conduct_performance_type;
226 l_imm_payroll_type ghr_api.government_payroll_type;
227 l_imm_par_term_retained_grade ghr_api.par_term_retained_grade_type;
228 l_imm_entitlement ghr_api.entitlement_type;
229 -- Bug#2759379 Added FEGLI Record
230 l_imm_fegli ghr_api.fegli_type;
231 l_imm_foreign_lang_prof_pay ghr_api.foreign_lang_prof_pay_type;
232 -- Bug#3385386 Added FTA Record
233 l_imm_fta ghr_api.fta_type;
234 l_imm_edp_pay ghr_api.edp_pay_type;
235 l_imm_hazard_pay ghr_api.hazard_pay_type;
236 l_imm_health_benefits ghr_api.health_benefits_type;
237 l_imm_danger_pay ghr_api.danger_pay_type;
238 l_imm_imminent_danger_pay ghr_api.imminent_danger_pay_type;
239 l_imm_living_quarters_allow ghr_api.living_quarters_allow_type;
240 l_imm_post_diff_amt ghr_api.post_diff_amt_type;
241 l_imm_post_diff_percent ghr_api.post_diff_percent_type;
242 l_imm_sep_maintenance_allow ghr_api.sep_maintenance_allow_type;
243 l_imm_supplemental_post_allow ghr_api.supplemental_post_allow_type;
244 l_imm_temp_lodge_allow ghr_api.temp_lodge_allow_type;
245 l_imm_premium_pay ghr_api.premium_pay_type;
246 l_imm_retirement_annuity ghr_api.retirement_annuity_type;
247 l_imm_severance_pay ghr_api.severance_pay_type;
248 l_imm_thrift_saving_plan ghr_api.thrift_saving_plan;
249 l_imm_retention_allow_review ghr_api.retention_allow_review_type;
250 l_imm_health_ben_pre_tax ghr_api.health_ben_pre_tax_type;
251 l_imm_per_race_ethnic_info ghr_api.per_race_ethnic_type; -- Bug 4724337 Race or National Origin changes
252 --Bug# 6312144
253 l_imm_ipa_benefits_cont ghr_api.per_ipa_ben_cont_info_type;
254 l_imm_retirement_info ghr_api.per_retirement_info_type;
255
256 l_sf52_data ghr_pa_requests%rowtype;
257 l_sf52_data_rec ghr_pa_requests%rowtype;
258 l_health_plan varchar2(30);
259 l_error_flag boolean;
260 l_return_status varchar2(30);
261
262 l_position_definition_id number;
263 l_pos_name varchar2(2000);
264 l_valid_grades_changed_warning boolean;
265 l_object_version_number number;
266 l_effective_start_date date;
267 l_effective_end_date date;
268
269 l_result varchar2(30);
270 l_proc varchar2(30):='cancel_term_SF52';
271 --
272
273 Begin
274
275 hr_utility.set_location( 'entering : ' || l_proc, 10);
276 l_sf52_data_rec := p_sf52_data;
277 --
278 --
279 -- reinitialise session variables
280 ghr_history_api.reinit_g_session_var;
281 -- set values of session variables
282
283 l_session_var.pa_request_id := p_sf52_data.pa_request_id;
284 l_session_var.noa_id := p_sf52_data.second_noa_id;
285 -- No triggers should be fired as cancellation can not be corrected or cancelled
286 -- so none of the changes will be saved.
287 l_session_var.fire_trigger := 'N';
288 l_session_var.date_Effective := p_sf52_data.effective_date;
289 l_session_var.person_id := p_sf52_data.person_id;
290 l_session_var.program_name := 'sf50';
291 l_session_var.assignment_id := p_sf52_data.employee_assignment_id;
292 l_session_var.altered_pa_request_id := p_sf52_data.altered_pa_request_id;
293 l_session_var.noa_id_correct := p_sf52_data.second_noa_id;
294 ghr_history_api.set_g_session_var(l_session_var);
295
296 ghr_process_Sf52.Fetch_extra_info(
297 p_pa_request_id => p_sf52_data.pa_request_id,
298 p_noa_id => p_sf52_data.second_noa_id,
299 p_agency_ei => TRUE,
300 p_sf52_ei_data => l_agency_ei_data,
301 p_result => l_result);
302
303 l_sf52_data := p_sf52_data;
304 -- all corrections will have the original sf52 information in the 2nd noa columns, so
305 -- copy that information to 1st noa columns.
306 ghr_process_sf52.copy_2ndNoa_to_1stNoa(l_sf52_data);
307 -- null the second noa columns since we don't want anything to be done with these now.
308 ghr_process_sf52.null_2ndNoa_cols(l_sf52_data);
309 ghr_sf52_pre_update.populate_record_groups (
310 p_pa_request_rec => l_sf52_data,
311 p_generic_ei_rec => l_agency_ei_data,
312 p_imm_asg_sf52 => l_imm_asg_sf52,
313 p_imm_asg_non_sf52 => l_imm_asg_non_sf52,
314 p_imm_asg_nte_dates => l_imm_asg_nte_dates,
315 p_imm_per_sf52 => l_imm_per_sf52,
316 p_imm_per_group1 => l_imm_per_group1,
317 p_imm_per_group2 => l_imm_per_group2,
318 p_imm_per_scd_info => l_imm_per_scd_info,
319 p_imm_per_retained_grade => l_imm_per_retained_grade,
320 p_imm_per_probations => l_imm_per_probations,
321 p_imm_per_sep_retire => l_imm_per_sep_retire,
322 p_imm_per_security => l_imm_per_security,
323 --Bug#4486823 RRR Changes
324 p_imm_per_service_oblig => l_imm_per_service_oblig,
325 p_imm_per_conversions => l_imm_per_conversions,
326 -- 4352589 BEN_EIT Changes
327 p_imm_per_benefit_info => l_imm_per_benefit_info,
328 p_imm_per_uniformed_services => l_imm_per_uniformed_services,
329 p_imm_pos_oblig => l_imm_pos_oblig,
330 p_imm_pos_grp2 => l_imm_pos_grp2,
331 p_imm_pos_grp1 => l_imm_pos_grp1,
332 p_imm_pos_valid_grade => l_imm_pos_valid_grade,
333 p_imm_pos_car_prog => l_imm_pos_car_prog,
334 p_imm_loc_info => l_imm_loc_info,
335 p_imm_wgi => l_imm_wgi,
336 p_imm_gov_awards => l_imm_gov_awards,
337 p_imm_recruitment_bonus => l_imm_recruitment_bonus,
338 p_imm_relocation_bonus => l_imm_relocation_bonus,
339 p_imm_student_loan_repay => l_imm_student_loan_repay,
340 p_imm_per_race_ethnic_info => l_imm_per_race_ethnic_info, -- Bug 4724337 Race or National Origin changes
341 --Pradeep
342 p_imm_mddds_special_pay => l_imm_mddds_special_pay,
343 p_imm_premium_pay_ind => l_imm_premium_pay_ind,
344
345 p_imm_perf_appraisal => l_imm_perf_appraisal,
346 p_imm_conduct_performance => l_imm_conduct_performance,
347 p_imm_payroll_type => l_imm_payroll_type,
348 p_imm_extra_info_rec => l_imm_extra_info_rec,
349 p_imm_sf52_from_data => l_imm_sf52_from_data,
350 p_imm_personal_info => l_imm_personal_info,
351 p_imm_generic_extra_info_rec => l_imm_generic_extra_info_rec,
352 p_imm_agency_sf52 => l_imm_agency_sf52,
353 p_agency_code => l_agency_code,
354 p_imm_par_term_retained_grade => l_imm_par_term_retained_grade,
355 p_imm_entitlement => l_imm_entitlement,
356 -- Bug#2759379 Added FEGLI Record
357 p_imm_fegli => l_imm_fegli,
358 p_imm_foreign_lang_prof_pay => l_imm_foreign_lang_prof_pay,
359 -- Bug#3385386 Added FTA Record
360 p_imm_fta => l_imm_fta,
361 p_imm_edp_pay => l_imm_edp_pay,
362 p_imm_hazard_pay => l_imm_hazard_pay,
363 p_imm_health_benefits => l_imm_health_benefits,
364 p_imm_danger_pay => l_imm_danger_pay,
365 p_imm_imminent_danger_pay => l_imm_imminent_danger_pay,
366 p_imm_living_quarters_allow => l_imm_living_quarters_allow,
367 p_imm_post_diff_amt => l_imm_post_diff_amt,
368 p_imm_post_diff_percent => l_imm_post_diff_percent,
369 p_imm_sep_maintenance_allow => l_imm_sep_maintenance_allow,
370 p_imm_supplemental_post_allow => l_imm_supplemental_post_allow,
371 p_imm_temp_lodge_allow => l_imm_temp_lodge_allow,
372 p_imm_premium_pay => l_imm_premium_pay,
373 p_imm_retirement_annuity => l_imm_retirement_annuity,
374 p_imm_severance_pay => l_imm_severance_pay,
375 p_imm_thrift_saving_plan => l_imm_thrift_saving_plan,
376 p_imm_retention_allow_review => l_imm_retention_allow_review,
377 p_imm_health_ben_pre_tax => l_imm_health_ben_pre_tax,
378 --Bug# 6312144 RPA EIT Benefits
379 p_imm_ipa_benefits_cont => l_imm_ipa_benefits_cont,
380 p_imm_retirement_info => l_imm_retirement_info
381 );
382 --
383 ghr_api.retrieve_element_entry_value
384 ( p_element_name => 'Health Benefits'
385 ,p_input_value_name => 'Health Plan'
386 ,p_assignment_id => l_sf52_data.employee_assignment_id
387 ,p_effective_date => trunc(l_sf52_data.effective_date)
388 ,p_value => l_health_plan
389 ,p_multiple_error_flag => l_error_flag
390 );
391 --
392 GHR_AGENCY_CHECK.AGENCY_CHECK(
393 p_pa_request_rec => l_sf52_data,
394 p_asg_sf52 => l_imm_asg_sf52,
395 p_asg_non_sf52 => l_imm_asg_non_sf52,
396 p_asg_nte_dates => l_imm_asg_nte_dates,
397 p_per_sf52 => l_imm_per_sf52,
398 p_per_group1 => l_imm_per_group1,
399 p_per_group2 => l_imm_per_group2,
400 p_per_scd_info => l_imm_per_scd_info,
401 p_per_retained_grade => l_imm_per_retained_grade,
402 p_per_probations => l_imm_per_probations,
403 p_per_sep_Retire => l_imm_per_sep_retire,
404 p_per_security => l_imm_per_security,
405 p_per_conversions => l_imm_per_conversions,
406 p_per_uniformed_services => l_imm_per_uniformed_services,
407 p_pos_oblig => l_imm_pos_oblig,
408 p_pos_grp2 => l_imm_pos_grp2,
409 p_pos_grp1 => l_imm_pos_grp1,
410 p_pos_valid_grade => l_imm_pos_valid_grade,
411 p_pos_car_prog => l_imm_pos_car_prog,
412 p_loc_info => l_imm_loc_info,
413 p_wgi => l_imm_wgi,
414 p_recruitment_bonus => l_imm_recruitment_bonus,
415 p_relocation_bonus => l_imm_relocation_bonus ,
416 p_sf52_from_data => l_imm_sf52_from_data,
417 p_personal_info => l_imm_personal_info,
418 p_gov_awards_type => l_imm_gov_awards,
419 p_perf_appraisal_type => l_imm_perf_appraisal,
420 p_payroll_type => l_imm_payroll_type,
421 p_conduct_perf_type => l_imm_conduct_performance,
422 p_agency_code => l_agency_code,
423 p_agency_sf52 => l_imm_agency_sf52,
424 p_health_plan => l_health_plan,
425 p_entitlement => l_imm_entitlement,
426 p_foreign_lang_prof_pay => l_imm_foreign_lang_prof_pay,
427 p_edp_pay => l_imm_edp_pay,
428 p_hazard_pay => l_imm_hazard_pay,
429 p_health_benefits => l_imm_health_benefits,
430 p_danger_pay => l_imm_danger_pay,
431 p_imminent_danger_pay => l_imm_imminent_danger_pay,
432 p_living_quarters_allow => l_imm_living_quarters_allow,
433 p_post_diff_amt => l_imm_post_diff_amt,
434 p_post_diff_percent => l_imm_post_diff_percent,
435 p_sep_maintenance_allow => l_imm_sep_maintenance_allow,
436 p_supplemental_post_allow => l_imm_supplemental_post_allow,
437 p_temp_lodge_allow => l_imm_temp_lodge_allow,
438 p_premium_pay => l_imm_premium_pay,
439 p_retirement_annuity => l_imm_retirement_annuity,
440 p_severance_pay => l_imm_severance_pay,
441 p_thrift_saving_plan => l_imm_thrift_saving_plan,
442 p_retention_allow_review => l_imm_retention_allow_review,
443 p_health_ben_pre_tax => l_imm_health_ben_pre_tax,
444 p_per_benefit_info => l_imm_per_benefit_info,
445 p_imm_retirement_info => l_imm_retirement_info );--Bug# 7131104
446
447 -- call to cancel termination moved after history handling. Bug# 1316321
448
449 -- if this was a 352 termination, then the following special handling is required.
450 if p_sf52_data.second_noa_code = '352' then
451 -- null out end_date for position
452
453 -- Added by Edward Nunez (Position Date Track Changes Phase 2).
454 /*
455 -- Deleting of Position Rows handled by code below ref bug 2983738.
456 -- Need to delete end dated position record only if it's MTO -- Sundar 2835138
457 IF (UPPER(SUBSTR(p_sf52_data.request_number,1,3)) = 'MTO') THEN
458 -- End 2835138
459 SELECT name, object_version_number
460 INTO l_pos_name, l_object_version_number
461 FROM hr_all_positions_f
462 WHERE position_id = p_sf52_data.from_position_id
463 AND (p_sf52_data.effective_date - 1) BETWEEN effective_start_date
464 AND effective_end_date;
465 hr_position_api.delete_position
466 (p_position_id => p_sf52_data.from_position_id,
467 p_object_version_number => l_object_version_number,
468 p_effective_date => p_sf52_data.effective_date - 1,
469 p_effective_start_date => l_effective_start_date,
470 p_effective_end_date => l_effective_end_date,
471 p_datetrack_mode => 'DELETE_NEXT_CHANGE'
472 );
473 END IF; -- If MTO
474 */
475 --
476
477 /* -- Commented out by Edward Nunez (Position Date Track changes Phase 2).
478 UPDATE per_positions
479 SET date_end = null
480 WHERE position_id = p_sf52_data.from_position_id;
481 */
482
483 SELECT *
484 INTO l_hist_rec
485 FROM ghr_pa_history
486 WHERE pa_request_id = p_sf52_data.altered_pa_request_id
487 AND information5 = 'GHR_US_PER_SEPARATE_RETIRE'
488 AND table_name = ghr_history_api.g_peopei_table
489 AND nature_of_action_id = (select nature_of_action_id from ghr_nature_of_actions where
490 code = '352');
491 ghr_history_api.fetch_history_info(
492 p_table_name => ghr_history_api.g_peopei_table,
493 p_hist_data => l_hist_pre,
494 p_pa_history_id => l_hist_rec.pa_history_id,
495 p_table_pk_id => l_hist_rec.information1,
496 p_person_id => p_sf52_data.person_id,
497 p_date_effective => p_sf52_data.effective_date,
498 p_result_code => l_return_status);
499 if (l_return_status is not null) then
500 -- there were no prevalues for this record
501 hr_utility.set_location('no pre-values'|| l_proc,15);
502 -- only delete application table if there are no following records.
503 open c_follow_rec( c_table_name => l_hist_rec.table_name,
504 c_pk_id => l_hist_rec.information1,
505 c_pa_history_id => l_hist_rec.pa_history_id);
506 fetch c_follow_rec into l_buf;
507 if c_follow_rec%NOTFOUND then
508 hr_utility.set_location('no following records. Deleting appl table. '|| l_proc,915);
509 delete_appl_row(
510 p_table_name => ghr_history_api.g_peopei_table,
511 p_table_pk_id => l_hist_rec.information1,
512 p_dt_mode => null,
513 p_date_effective => l_hist_rec.effective_date);
514 end if;
515 close c_follow_rec;
516
517 else
518 -- there is a pre record, so apply it to the history table and to the application table.
519 ghr_history_cascade.cascade_history_data (
520 p_table_name => l_hist_rec.table_name,
521 p_person_id => l_hist_rec.person_id,
522 p_pre_record => l_hist_pre,
523 p_post_record => l_hist_rec,
524 p_cascade_type => 'cancel',
525 p_interv_on_table => l_interv_on_table,
526 p_interv_on_eff_date => l_interv_on_eff_date,
527 p_hist_data_as_of_date => l_hist_data_as_of_date);
528 ghr_history_cascade.cascade_appl_table_data (
529 p_table_name => l_hist_rec.table_name,
530 p_person_id => l_hist_rec.person_id,
531 p_pre_record => l_hist_pre,
532 p_post_record => l_hist_rec,
533 p_cascade_type => 'cancel',
534 p_interv_on_table => l_interv_on_table,
535 p_interv_on_eff_date => l_interv_on_eff_date,
536 p_hist_data_as_of_date => l_hist_data_as_of_date);
537
538 end if;
539
540 end if;
541
542 -- Bug#2082535
543 Open c_hist_sevpay(p_sf52_data.altered_pa_request_id,ghr_history_api.g_eleent_table);
544 fetch c_hist_sevpay into l_hist_sevpay;
545 if c_hist_sevpay%notfound then
546 -- raise error;
547 close c_hist_sevpay;
548 else
549
550 delete_element_entry( p_hist_rec => l_hist_sevpay,
551 p_del_mode => hr_api.g_zap,
552 p_cannot_cancel => l_cannot_cancel_sevpay);
553
554 if l_cannot_cancel_sevpay then
555 -- raise error
556 hr_utility.set_location('ERROR: Cannot Cancel'|| l_proc,35);
557 hr_utility.set_message(8301,'GHR_38212_CANNOT_CANCEL');
558 hr_utility.raise_error;
559 else
560 hr_utility.set_location('Delete rows.'|| l_proc,40);
561 delete_hist_row ( l_hist_sevpay.pa_history_id);
562 delete_eleentval( l_hist_sevpay);
563 end if;
564 close c_hist_sevpay;
565 end if;
566
567 -- Bug#2082535
568
569 -- delete all history records for the termination that is being cancelled.
570 -- if an address table record is encountered, then set application
571 -- table to what it currently should be according to history.
572 hr_utility.set_location( l_proc, 20);
573 for l_hist in c_hist( p_sf52_data.altered_pa_request_id,
574 l_session_var.noa_id_correct)
575 loop
576 hr_utility.set_location(' LOOP history_id(' || l_hist.pa_history_id || ')', 25);
577 exit when c_hist%notfound;
578 -- Bug#3780671 Added the Assignment Extra Info condition as
579 -- the EIT "GHR_US_ASG_NTE_DATES" requires the process similar to
580 -- Address table.
581 IF (l_hist.table_name = ghr_history_api.g_addres_table) OR
582 (l_hist.table_name = 'PER_ASSIGNMENT_EXTRA_INFO' and
583 l_hist.information5 = 'GHR_US_ASG_NTE_DATES') THEN
584
585 SELECT *
586 INTO l_hist_rec
587 FROM ghr_pa_history
588 WHERE pa_history_id = l_hist.pa_history_id;
589
590 hr_utility.set_location('Non 352 and Address '||l_hist.table_name,26);
591 -- Bug#3780671 Passed the parameter l_hist.table_name instead of Address table
592 -- to handle PER_ASSIGNMENT_EXTRA_INFO table.
593 ghr_history_api.fetch_history_info(
594 p_table_name => l_hist.table_name,
595 p_hist_data => l_hist_pre,
596 p_pa_history_id => l_hist_rec.pa_history_id,
597 p_table_pk_id => l_hist_rec.information1,
598 p_person_id => p_sf52_data.person_id,
599 p_date_effective => p_sf52_data.effective_date,
600 p_result_code => l_return_status);
601 if (l_return_status is not null) then
602 -- there were no prevalues for this record
603 hr_utility.set_location('no pre-values'|| l_proc,15);
604 -- only delete application table if there are no following records.
605 open c_follow_rec( c_table_name => l_hist_rec.table_name,
606 c_pk_id => l_hist_rec.information1,
607 c_pa_history_id => l_hist_rec.pa_history_id);
608 fetch c_follow_rec into l_buf;
609 if c_follow_rec%NOTFOUND then
610 -- Bug#3780671 Passed the parameter l_hist.table_name instead of Address table
611 -- to handle PER_ASSIGNMENT_EXTRA_INFO table.
612 delete_appl_row(
613 p_table_name => l_hist.table_name,
614 p_table_pk_id => l_hist_rec.information1,
615 p_dt_mode => null,
616 p_date_effective => l_hist_rec.effective_date);
617 end if;
618 close c_follow_rec;
619 else
620 -- there is a pre record, so apply it to the history table and to the application table.
621 ghr_history_cascade.cascade_history_data (
622 p_table_name => l_hist_rec.table_name,
623 p_person_id => l_hist_rec.person_id,
624 p_pre_record => l_hist_pre,
625 p_post_record => l_hist_rec,
626 p_cascade_type => 'cancel',
627 p_interv_on_table => l_interv_on_table,
628 p_interv_on_eff_date => l_interv_on_eff_date,
629 p_hist_data_as_of_date => l_hist_data_as_of_date);
630 delete_hist_row( l_hist.row_id);
631 ghr_history_cascade.cascade_appl_table_data (
632 p_table_name => l_hist_rec.table_name,
633 p_person_id => l_hist_rec.person_id,
634 p_pre_record => l_hist_pre,
635 p_post_record => l_hist_rec,
636 p_cascade_type => 'cancel',
637 p_interv_on_table => l_interv_on_table,
638 p_interv_on_eff_date => l_interv_on_eff_date,
639 p_hist_data_as_of_date => l_hist_data_as_of_date);
640 end if;
641
642 -- else
643 hr_utility.set_location('Non 352 and delete_hist_row '||l_proc,27);
644 -- delete_hist_row( l_hist.row_id);
645 end if;
646 end loop;
647
648 -- delete all history records for the termination that is being cancelled.
649 -- if an address table record is encountered, then set application
650 -- table to what it currently should be according to history.
651 hr_utility.set_location( l_proc, 20);
652 for l_hist in c_hist( p_sf52_data.altered_pa_request_id,
653 l_session_var.noa_id_correct)
654 loop
655 exit when c_hist%notfound;
656 delete_hist_row( l_hist.row_id);
657 end loop;
658
659 -- Moved after history handling due to bug# 1316321
660 -- call core HR api to cancel the termination.
661 hrempter.cancel_termination(
662 p_person_id => p_sf52_data.person_id,
663 p_Actual_termination_date => p_sf52_data.effective_date
664 );
665 -- added to resolve bug#2205014
666 -- Commented the following procedure call as this is included in hrempter.cancel_termination
667 -- through Core HR Bug#3889294
668 /* hr_per_type_usage_internal.cancel_person_type_usage
669 (p_effective_date => p_sf52_data.effective_date + 1
670 ,p_person_id => p_sf52_data.person_id
671 ,p_system_person_type => 'EX_EMP');
672 */
673
674
675 ghr_agency_update.ghr_agency_upd(
676 p_pa_request_rec => l_sf52_data,
677 p_asg_sf52 => l_imm_asg_sf52,
678 p_asg_non_sf52 => l_imm_asg_non_sf52,
679 p_asg_nte_dates => l_imm_asg_nte_dates,
680 p_per_sf52 => l_imm_per_sf52,
681 p_per_group1 => l_imm_per_group1,
682 p_per_group2 => l_imm_per_group2,
683 p_per_scd_info => l_imm_per_scd_info,
684 p_per_retained_grade => l_imm_per_retained_grade,
685 p_per_probations => l_imm_per_probations,
686 p_per_sep_Retire => l_imm_per_sep_retire,
687 p_per_security => l_imm_per_security,
688 p_per_conversions => l_imm_per_conversions,
689 p_per_uniformed_services => l_imm_per_uniformed_services,
690 p_pos_oblig => l_imm_pos_oblig,
691 p_pos_grp2 => l_imm_pos_grp2,
692 p_pos_grp1 => l_imm_pos_grp1,
693 p_pos_valid_grade => l_imm_pos_valid_grade,
694 p_pos_car_prog => l_imm_pos_car_prog,
695 p_loc_info => l_imm_loc_info,
696 p_wgi => l_imm_wgi,
697 p_recruitment_bonus => l_imm_recruitment_bonus,
698 p_relocation_bonus => l_imm_relocation_bonus ,
699 p_sf52_from_data => l_imm_sf52_from_data,
700 p_personal_info => l_imm_personal_info,
701 p_gov_awards_type => l_imm_gov_awards,
702 p_perf_appraisal_type => l_imm_perf_appraisal,
703 p_payroll_type => l_imm_payroll_type,
704 p_conduct_perf_type => l_imm_conduct_performance,
705 p_agency_code => l_agency_code,
706 p_agency_sf52 => l_imm_agency_sf52,
707 p_entitlement => l_imm_entitlement,
708 p_foreign_lang_prof_pay => l_imm_foreign_lang_prof_pay,
709 p_edp_pay => l_imm_edp_pay,
710 p_hazard_pay => l_imm_hazard_pay,
711 p_health_benefits => l_imm_health_benefits,
712 p_danger_pay => l_imm_danger_pay,
713 p_imminent_danger_pay => l_imm_imminent_danger_pay,
714 p_living_quarters_allow => l_imm_living_quarters_allow,
715 p_post_diff_amt => l_imm_post_diff_amt,
716 p_post_diff_percent => l_imm_post_diff_percent,
717 p_sep_maintenance_allow => l_imm_sep_maintenance_allow,
718 p_supplemental_post_allow => l_imm_supplemental_post_allow,
719 p_temp_lodge_allow => l_imm_temp_lodge_allow,
720 p_premium_pay => l_imm_premium_pay,
721 p_retirement_annuity => l_imm_retirement_annuity,
722 p_severance_pay => l_imm_severance_pay,
723 p_thrift_saving_plan => l_imm_thrift_saving_plan,
724 p_retention_allow_review => l_imm_retention_allow_review,
725 p_health_ben_pre_tax => l_imm_health_ben_pre_tax,
726 p_per_benefit_info => l_imm_per_benefit_info,
727 p_imm_retirement_info => l_imm_retirement_info); --Bug# 7131104
728
729 -- call post_sf52_cancel to handle notifications, marking pa_requests cancelled, etc.
730 hr_utility.set_location( l_proc, 30);
731 ghr_sf52_post_update.post_sf52_cancel(
732 p_pa_request_id => p_sf52_data.pa_request_id,
733 p_effective_date => l_session_var.date_effective,
734 p_object_version_number => p_sf52_data.object_version_number,
735 p_from_position_id => p_sf52_data.from_position_id,
736 p_to_position_id => p_sf52_data.to_position_id,
737 p_agency_code => p_sf52_data.agency_code);
738
739 hr_utility.set_location( 'leaving : ' || l_proc, 40);
740 exception when others then
741 --
742 -- Reset IN OUT parameters and set OUT parameters
743 --
744 p_sf52_data := l_sf52_data_rec;
745 raise;
746 end cancel_term_SF52;
747
748 -- ---------------------------------------------------------------------------
749 -- |--------------------------< cancel_appt_sf52>---------------------------|
750 -- ---------------------------------------------------------------------------
751 -- {Start Of Comments}
752 --
753 -- Description:
754 -- This procedure cancels an appointment sf52.
755 --
756 -- Pre-Requisities:
757 -- None.
758 --
759 -- In Parameters:
760 -- p_sf52_data -> ghr_pa_requests record of the cancellation sf52.
761 --
762 -- Post Success:
763 -- The appointment sf52 will have been cancelled.
764 --
765 -- Post Failure:
766 -- No failure conditions.
767 --
768 -- Developer Implementation Notes:
769 -- None
770 --
771 -- Access Status:
772 -- Internal Development Use Only.
773 --
774 -- {End Of Comments}
775 -- ---------------------------------------------------------------------------
776
777 Procedure Cancel_Appt_SF52( p_sf52_data in out nocopy ghr_pa_requests%rowtype) is
778
779 l_session_var ghr_history_api.g_session_var_type;
780 l_hist_post ghr_pa_history%rowtype;
781 l_business_group_id number;
782 l_u_prh_object_version_number number;
783 l_i_pa_routing_history_id number;
784 l_i_prh_object_version_number number;
785 l_agency_ei_data ghr_pa_request_extra_info%rowtype;
786 l_imm_asg_sf52 ghr_api.asg_sf52_type;
787 l_imm_asg_non_sf52 ghr_api.asg_non_sf52_type;
788 l_imm_asg_nte_dates ghr_api.asg_nte_dates_type;
789 l_imm_per_sf52 ghr_api.per_sf52_type;
790 l_imm_per_group1 ghr_api.per_group1_type;
791 l_imm_per_group2 ghr_api.per_group2_type;
792 l_imm_per_scd_info ghr_api.per_scd_info_type;
793 l_imm_per_retained_grade ghr_api.per_retained_grade_type;
794 l_imm_per_probations ghr_api.per_probations_type;
795 l_imm_per_sep_retire ghr_api.per_sep_retire_type;
796 l_imm_per_security ghr_api.per_security_type;
797 -- Bug#4486823 RRR changes
798 l_imm_per_service_oblig ghr_api.per_service_oblig_type;
799 l_imm_per_conversions ghr_api.per_conversions_type;
800 -- 4352589 BEN_EIT Changes
801 l_imm_per_benefit_info ghr_api.per_benefit_info_type;
802 l_imm_per_uniformed_services ghr_api.per_uniformed_services_type;
803 l_imm_pos_oblig ghr_api.pos_oblig_type;
804 l_imm_pos_grp2 ghr_api.pos_grp2_type;
805 l_imm_pos_grp1 ghr_api.pos_grp1_type;
806 l_imm_pos_valid_grade ghr_api.pos_valid_grade_type;
807 l_imm_pos_car_prog ghr_api.pos_car_prog_type;
808 l_imm_loc_info ghr_api.loc_info_type;
809 l_imm_wgi ghr_api.within_grade_increase_type;
810 l_imm_gov_awards ghr_api.government_awards_type;
811 l_imm_recruitment_bonus ghr_api.recruitment_bonus_type;
812 l_imm_relocation_bonus ghr_api.relocation_bonus_type;
813 l_imm_student_loan_repay ghr_api.student_loan_repay_type;
814 --Pradeep
815 l_imm_mddds_special_pay ghr_api.mddds_special_pay_type;
816 l_imm_premium_pay_ind ghr_api.premium_pay_ind_type;
817
818 l_imm_extra_info_rec ghr_api.extra_info_rec_type ;
819 l_imm_sf52_from_data ghr_api.prior_sf52_data_type;
820 l_imm_personal_info ghr_api.personal_info_type;
821 l_imm_generic_extra_info_rec ghr_api.generic_extra_info_rec_type ;
822 l_imm_agency_sf52 ghr_api.agency_sf52_type;
823 l_agency_code varchar2(50);
824 l_imm_perf_appraisal ghr_api.performance_appraisal_type;
825 l_imm_conduct_performance ghr_api.conduct_performance_type;
826 l_imm_payroll_type ghr_api.government_payroll_type;
827 l_imm_par_term_retained_grade ghr_api.par_term_retained_grade_type;
828 l_imm_entitlement ghr_api.entitlement_type;
829 -- Bug#2759379 Added FEGLI Record
830 l_imm_fegli ghr_api.fegli_type;
831 l_imm_foreign_lang_prof_pay ghr_api.foreign_lang_prof_pay_type;
832 -- Bug#3385386 Added FTA Record
833 l_imm_fta ghr_api.fta_type;
834 l_imm_edp_pay ghr_api.edp_pay_type;
835 l_imm_hazard_pay ghr_api.hazard_pay_type;
836 l_imm_health_benefits ghr_api.health_benefits_type;
837 l_imm_danger_pay ghr_api.danger_pay_type;
838 l_imm_imminent_danger_pay ghr_api.imminent_danger_pay_type;
839 l_imm_living_quarters_allow ghr_api.living_quarters_allow_type;
840 l_imm_post_diff_amt ghr_api.post_diff_amt_type;
841 l_imm_post_diff_percent ghr_api.post_diff_percent_type;
842 l_imm_sep_maintenance_allow ghr_api.sep_maintenance_allow_type;
843 l_imm_supplemental_post_allow ghr_api.supplemental_post_allow_type;
844 l_imm_temp_lodge_allow ghr_api.temp_lodge_allow_type;
845 l_imm_premium_pay ghr_api.premium_pay_type;
846 l_imm_retirement_annuity ghr_api.retirement_annuity_type;
847 l_imm_severance_pay ghr_api.severance_pay_type;
848 l_imm_thrift_saving_plan ghr_api.thrift_saving_plan;
849 l_imm_retention_allow_review ghr_api.retention_allow_review_type;
850 l_imm_health_ben_pre_tax ghr_api.health_ben_pre_tax_type;
851 l_imm_per_race_ethnic_info ghr_api.per_race_ethnic_type; -- Bug 4724337 Race or National Origin changes
852 l_sf52_data ghr_pa_requests%rowtype;
853 l_sf52_data_rec ghr_pa_requests%rowtype;
854 l_health_plan varchar2(30);
855 l_error_flag boolean;
856 l_return_status varchar2(30);
857 l_result varchar2(30);
858 -- JH CAO
859 l_cao_effective_date date;
860 l_cancel_effective_date date;
861
862 --Bug# 6312144
863 l_imm_ipa_benefits_cont ghr_api.per_ipa_ben_cont_info_type;
864 l_imm_retirement_info ghr_api.per_retirement_info_type;
865
866
867
868 -- this cursor gets the business_group_id for the person_id/effective_date passed.
869 cursor c_bg ( c_person_id number,
870 c_as_on_date date) is
871 select
872 business_group_id
873 from per_people_f
874 where person_id = c_person_id and
875 c_as_on_date between effective_start_date and effective_end_date;
876
877 -- this cursor gets the ghr_pa_history rows (with the rowid included) for the person_id specified and locks
878 -- the rows for update.
879 -- note that it selects all the records that were effective on or after the effective_date passed.
880 -- also note that it orders by dml_operation, in order to ensure that updated rows are handled
881 -- before inserted rows. This is necessary for the way we are handling the setting of extra info tables
882 -- back to what they were prior to the appointment. If updated rows were handled before inserted rows, then
883 -- the cascade_appl_table_data call may fail since it will be trying to fetch a pre-record for the
884 -- updated row, but the pre-record has been deleted since we handled inserted rows first.
885 cursor c_hist (c_person_id number,
886 c_eff_date date) is
887 select
888 pah.rowid row_id,
889 pah.*
890 from ghr_pa_history pah
891 where person_id = c_person_id and
892 (effective_date > c_eff_date or
893 (effective_date = c_eff_date and pa_request_id is not NULL))
894 for update of person_id
895 order by dml_operation desc;
896
897 -- this cursor gets the ghr_pa_request rows (with the rowid included) for the person_id passed and locks
898 -- the rows for update.
899 -- It returns all pa request rows that were effective on or after the effective date passed, as long as the
900 -- pa request has been approved.
901 cursor c_par ( c_person_id number,
902 c_eff_date date) is
903 select
904 par.rowid,
905 par.*
906 from ghr_pa_requests par
907 where person_id = c_person_id and
908 effective_date >= c_eff_date and
909 pa_notification_id is not null and
910 approval_date is not null
911 for update of person_id;
912
913 l_pos_name varchar2(2000);
914 l_object_version_number number;
915 l_effective_start_date date;
916 l_effective_end_date date;
917
918 --
919 l_proc varchar2(30):='cancel_appt_sf52';
920
921 Begin
922
923 hr_utility.set_location(' Entering : ' || l_proc, 10);
924 l_sf52_data_rec := p_sf52_data;
925
926
927 -- reinitialise session variables
928 ghr_history_api.reinit_g_session_var;
929
930 -- set values of session variables
931 l_session_var.pa_request_id := p_sf52_data.pa_request_id;
932 l_session_var.noa_id := p_sf52_data.second_noa_id;
933 -- No triggers should be fired as cancellation can not be corrected or cancelled
934 -- so none of the changes will be saved.
935 l_session_var.fire_trigger := 'N';
936 l_session_var.date_Effective := p_sf52_data.effective_date;
937 l_session_var.person_id := p_sf52_data.person_id;
938 l_session_var.program_name := 'sf50';
939 l_session_var.altered_pa_request_id := p_sf52_data.altered_pa_request_id;
940 l_session_var.noa_id_correct := p_sf52_data.second_noa_id;
941 l_session_var.assignment_id := p_sf52_data.employee_assignment_id;
942
943 ghr_history_api.set_g_session_var(l_session_var);
944
945 ghr_process_Sf52.Fetch_extra_info(
946 p_pa_request_id => p_sf52_data.pa_request_id,
947 p_noa_id => p_sf52_data.second_noa_id,
948 p_agency_ei => TRUE,
949 p_sf52_ei_data => l_agency_ei_data,
950 p_result => l_result);
951
952 l_sf52_data := p_sf52_data;
953 -- all corrections will have the original sf52 information in the 2nd noa columns, so
954 -- copy that information to 1st noa columns.
955 ghr_process_sf52.copy_2ndNoa_to_1stNoa(l_sf52_data);
956 -- null the second noa columns since we don't want anything to be done with these now.
957 ghr_process_sf52.null_2ndNoa_cols(l_sf52_data);
958
959 ghr_sf52_pre_update.populate_record_groups (
960 p_pa_request_rec => l_sf52_data,
961 p_generic_ei_rec => l_agency_ei_data,
962 p_imm_asg_sf52 => l_imm_asg_sf52,
963 p_imm_asg_non_sf52 => l_imm_asg_non_sf52,
964 p_imm_asg_nte_dates => l_imm_asg_nte_dates,
965 p_imm_per_sf52 => l_imm_per_sf52,
966 p_imm_per_group1 => l_imm_per_group1,
967 p_imm_per_group2 => l_imm_per_group2,
968 p_imm_per_scd_info => l_imm_per_scd_info,
969 p_imm_per_retained_grade => l_imm_per_retained_grade,
970 p_imm_per_probations => l_imm_per_probations,
971 p_imm_per_sep_retire => l_imm_per_sep_retire,
972 p_imm_per_security => l_imm_per_security,
973 --Bug#4486823 RRR Changes
974 p_imm_per_service_oblig => l_imm_per_service_oblig,
975 p_imm_per_conversions => l_imm_per_conversions,
976 -- 4352589 BEN_EIT Changes
977 p_imm_per_benefit_info => l_imm_per_benefit_info,
978 p_imm_per_uniformed_services => l_imm_per_uniformed_services,
979 p_imm_pos_oblig => l_imm_pos_oblig,
980 p_imm_pos_grp2 => l_imm_pos_grp2,
981 p_imm_pos_grp1 => l_imm_pos_grp1,
982 p_imm_pos_valid_grade => l_imm_pos_valid_grade,
983 p_imm_pos_car_prog => l_imm_pos_car_prog,
984 p_imm_loc_info => l_imm_loc_info,
985 p_imm_wgi => l_imm_wgi,
986 p_imm_gov_awards => l_imm_gov_awards,
987 p_imm_recruitment_bonus => l_imm_recruitment_bonus,
988 p_imm_relocation_bonus => l_imm_relocation_bonus,
989 p_imm_student_loan_repay => l_imm_student_loan_repay,
990 p_imm_per_race_ethnic_info => l_imm_per_race_ethnic_info, -- Bug 4724337 Race or National Origin changes
991 --Pradeep
992 p_imm_mddds_special_pay => l_imm_mddds_special_pay,
993 p_imm_premium_pay_ind => l_imm_premium_pay_ind,
994
995 p_imm_perf_appraisal => l_imm_perf_appraisal,
996 p_imm_conduct_performance => l_imm_conduct_performance,
997 p_imm_payroll_type => l_imm_payroll_type,
998 p_imm_extra_info_rec => l_imm_extra_info_rec,
999 p_imm_sf52_from_data => l_imm_sf52_from_data,
1000 p_imm_personal_info => l_imm_personal_info,
1001 p_imm_generic_extra_info_rec => l_imm_generic_extra_info_rec,
1002 p_imm_agency_sf52 => l_imm_agency_sf52,
1003 p_agency_code => l_agency_code,
1004 p_imm_par_term_retained_grade => l_imm_par_term_retained_grade,
1005 p_imm_entitlement => l_imm_entitlement,
1006 -- Bug#2759379 Added FEGLI Record
1007 p_imm_fegli => l_imm_fegli,
1008 p_imm_foreign_lang_prof_pay => l_imm_foreign_lang_prof_pay,
1009 -- Bug#3385386 Added FTA Record
1010 p_imm_fta => l_imm_fta,
1011 p_imm_edp_pay => l_imm_edp_pay,
1012 p_imm_hazard_pay => l_imm_hazard_pay,
1013 p_imm_health_benefits => l_imm_health_benefits,
1014 p_imm_danger_pay => l_imm_danger_pay,
1015 p_imm_imminent_danger_pay => l_imm_imminent_danger_pay,
1016 p_imm_living_quarters_allow => l_imm_living_quarters_allow,
1017 p_imm_post_diff_amt => l_imm_post_diff_amt,
1018 p_imm_post_diff_percent => l_imm_post_diff_percent,
1019 p_imm_sep_maintenance_allow => l_imm_sep_maintenance_allow,
1020 p_imm_supplemental_post_allow => l_imm_supplemental_post_allow,
1021 p_imm_temp_lodge_allow => l_imm_temp_lodge_allow,
1022 p_imm_premium_pay => l_imm_premium_pay,
1023 p_imm_retirement_annuity => l_imm_retirement_annuity,
1024 p_imm_severance_pay => l_imm_severance_pay,
1025 p_imm_thrift_saving_plan => l_imm_thrift_saving_plan,
1026 p_imm_retention_allow_review => l_imm_retention_allow_review,
1027 p_imm_health_ben_pre_tax => l_imm_health_ben_pre_tax,
1028 --Bug #6312144 RPA EIT Benefits
1029 p_imm_ipa_benefits_cont => l_imm_ipa_benefits_cont,
1030 p_imm_retirement_info => l_imm_retirement_info);
1031
1032 ghr_api.retrieve_element_entry_value
1033 ( p_element_name => 'Health Benefits'
1034 ,p_input_value_name => 'Health Plan'
1035 ,p_assignment_id => l_sf52_data.employee_assignment_id
1036 ,p_effective_date => trunc(l_sf52_data.effective_date)
1037 ,p_value => l_health_plan
1038 ,p_multiple_error_flag => l_error_flag
1039 );
1040
1041
1042 GHR_AGENCY_CHECK.AGENCY_CHECK(
1043 p_pa_request_rec => l_sf52_data,
1044 p_asg_sf52 => l_imm_asg_sf52,
1045 p_asg_non_sf52 => l_imm_asg_non_sf52,
1046 p_asg_nte_dates => l_imm_asg_nte_dates,
1047 p_per_sf52 => l_imm_per_sf52,
1048 p_per_group1 => l_imm_per_group1,
1049 p_per_group2 => l_imm_per_group2,
1050 p_per_scd_info => l_imm_per_scd_info,
1051 p_per_retained_grade => l_imm_per_retained_grade,
1052 p_per_probations => l_imm_per_probations,
1053 p_per_sep_Retire => l_imm_per_sep_retire,
1054 p_per_security => l_imm_per_security,
1055 p_per_conversions => l_imm_per_conversions,
1056 p_per_uniformed_services => l_imm_per_uniformed_services,
1057 p_pos_oblig => l_imm_pos_oblig,
1058 p_pos_grp2 => l_imm_pos_grp2,
1059 p_pos_grp1 => l_imm_pos_grp1,
1060 p_pos_valid_grade => l_imm_pos_valid_grade,
1061 p_pos_car_prog => l_imm_pos_car_prog,
1062 p_loc_info => l_imm_loc_info,
1063 p_wgi => l_imm_wgi,
1064 p_recruitment_bonus => l_imm_recruitment_bonus,
1065 p_relocation_bonus => l_imm_relocation_bonus ,
1066 p_sf52_from_data => l_imm_sf52_from_data,
1067 p_personal_info => l_imm_personal_info,
1068 p_gov_awards_type => l_imm_gov_awards,
1069 p_perf_appraisal_type => l_imm_perf_appraisal,
1070 p_payroll_type => l_imm_payroll_type,
1071 p_conduct_perf_type => l_imm_conduct_performance,
1072 p_agency_code => l_agency_code,
1073 p_agency_sf52 => l_imm_agency_sf52,
1074 p_health_plan => l_health_plan,
1075 p_entitlement => l_imm_entitlement,
1076 p_foreign_lang_prof_pay => l_imm_foreign_lang_prof_pay,
1077 p_edp_pay => l_imm_edp_pay,
1078 p_hazard_pay => l_imm_hazard_pay,
1079 p_health_benefits => l_imm_health_benefits,
1080 p_danger_pay => l_imm_danger_pay,
1081 p_imminent_danger_pay => l_imm_imminent_danger_pay,
1082 p_living_quarters_allow => l_imm_living_quarters_allow,
1083 p_post_diff_amt => l_imm_post_diff_amt,
1084 p_post_diff_percent => l_imm_post_diff_percent,
1085 p_sep_maintenance_allow => l_imm_sep_maintenance_allow,
1086 p_supplemental_post_allow => l_imm_supplemental_post_allow,
1087 p_temp_lodge_allow => l_imm_temp_lodge_allow,
1088 p_premium_pay => l_imm_premium_pay,
1089 p_retirement_annuity => l_imm_retirement_annuity,
1090 p_severance_pay => l_imm_severance_pay,
1091 p_thrift_saving_plan => l_imm_thrift_saving_plan,
1092 p_retention_allow_review => l_imm_retention_allow_review,
1093 p_health_ben_pre_tax => l_imm_health_ben_pre_tax,
1094 p_per_benefit_info => l_imm_per_benefit_info,
1095 p_imm_retirement_info => l_imm_retirement_info); --Bug# 7131104
1096
1097 -- Segment which calls do_cancel_hire moved after history handling. Bug# 1295751.
1098
1099 hr_utility.set_location( l_proc, 40);
1100 for l_hist in c_hist( p_sf52_data.person_id,
1101 p_sf52_data.effective_date)
1102 loop
1103 hr_utility.set_location( 'GOT HERE!!!!: ' || l_proc, 59);
1104 exit when c_hist%notfound;
1105 delete_hist_row( l_hist.row_id);
1106 hr_utility.set_location( 'checking if table needs deleting: ' || l_hist.table_name|| l_proc, 58);
1107 -- Delete all extraInfo table records which were created by the SF52.
1108 if upper(l_hist.table_name) in (upper(ghr_history_api.g_peopei_table),
1109 upper(ghr_history_api.g_posnei_table),
1110 upper(ghr_history_api.g_asgnei_table),
1111 upper(ghr_history_api.g_addres_table),
1112 upper(ghr_history_api.g_perana_table)) then
1113 hr_utility.set_location( 'table_name qualifies: ' || l_hist.table_name|| l_proc, 57);
1114 if l_hist.DML_operation = ghr_history_api.g_ins_operation then
1115 hr_utility.set_location( 'delete appl row table_name: ' || l_hist.table_name|| l_proc, 51);
1116 hr_utility.set_location( 'delete appl row information1: ' || l_hist.information1|| l_proc, 52);
1117 hr_utility.set_location( 'delete appl row effective_date: ' || l_hist.effective_date|| l_proc, 53);
1118 delete_appl_row(
1119 p_table_name => l_hist.table_name,
1120 p_table_pk_id => l_hist.information1,
1121 p_dt_mode => null,
1122 p_date_effective => l_hist.effective_date);
1123 elsif l_hist.DML_operation = ghr_history_api.g_upd_operation then
1124 l_hist_post.information1 := l_hist.information1;
1125 l_hist_post.person_id := l_hist.person_id;
1126 hr_utility.set_location(l_proc || 'l_hist.information1: ' || l_hist.information1, 1200);
1127 hr_utility.set_location(l_proc || 'l_hist.table_name: ' || l_hist.table_name, 1210);
1128 hr_utility.set_location(l_proc || 'l_hist.person_id: ' || l_hist.person_id, 1220);
1129 ghr_history_cascade.cascade_appl_table_data(
1130 p_table_name => l_hist.table_name,
1131 p_person_id => l_hist.person_id,
1132 p_pre_record => null,
1133 p_post_record => l_hist_post,
1134 p_cascade_type => null,
1135 p_interv_on_table => null,
1136 p_interv_on_eff_date => null,
1137 p_hist_data_as_of_date => null);
1138 end if;
1139 end if;
1140 end loop;
1141
1142 -- Moved this segment to be executed after history deletion handling.
1143 -- Bug# 1295751.
1144 hr_utility.set_location( l_proc, 20);
1145 open c_bg (p_sf52_data.person_id, p_sf52_data.effective_date);
1146 fetch c_bg into l_business_group_id;
1147 if c_bg%notfound then
1148 close c_bg;
1149 hr_utility.set_message(8301,'GHR_38210_BUSINESS_GROUP_NFND');
1150 hr_utility.raise_error;
1151 --raise error
1152 end if;
1153 hr_utility.set_location( l_proc, 30);
1154 -- Check if need to call cancel_hire_or_apl.lock_per_row ???
1155 -- call core HR api to cancel the hire.
1156 --*****************************************************************************
1157 -- Added as per Rohini's suggestion to fix bug#3106101
1158 pay_us_tax_internal.maintain_us_employee_taxes (
1159 p_effective_date => p_sf52_data.effective_date
1160 ,p_datetrack_mode => 'ZAP'
1161 ,p_assignment_id => l_sf52_data.employee_assignment_id
1162 ,p_delete_routine => 'ASSIGNMENT' );
1163
1164 -- to fix bug 3106101
1165 --*****************************************************************************
1166
1167 -- JH CAO
1168 -- Bug 2989431 New User Hook GHR_AGENCY_CHECK.CANCEL_HIRE_CAO
1169 GHR_AGENCY_CHECK.CANCEL_HIRE_CAO(
1170 p_pa_request_rec => l_sf52_data,
1171 p_asg_sf52 => l_imm_asg_sf52,
1172 p_asg_non_sf52 => l_imm_asg_non_sf52,
1173 p_asg_nte_dates => l_imm_asg_nte_dates,
1174 p_per_sf52 => l_imm_per_sf52,
1175 p_per_group1 => l_imm_per_group1,
1176 p_per_group2 => l_imm_per_group2,
1177 p_per_scd_info => l_imm_per_scd_info,
1178 p_per_retained_grade => l_imm_per_retained_grade,
1179 p_per_probations => l_imm_per_probations,
1180 p_per_sep_Retire => l_imm_per_sep_retire,
1181 p_per_security => l_imm_per_security,
1182 p_per_conversions => l_imm_per_conversions,
1183 p_per_uniformed_services => l_imm_per_uniformed_services,
1184 p_pos_oblig => l_imm_pos_oblig,
1185 p_pos_grp2 => l_imm_pos_grp2,
1186 p_pos_grp1 => l_imm_pos_grp1,
1187 p_pos_valid_grade => l_imm_pos_valid_grade,
1188 p_pos_car_prog => l_imm_pos_car_prog,
1189 p_loc_info => l_imm_loc_info,
1190 p_wgi => l_imm_wgi,
1191 p_recruitment_bonus => l_imm_recruitment_bonus,
1192 p_relocation_bonus => l_imm_relocation_bonus ,
1193 p_sf52_from_data => l_imm_sf52_from_data,
1194 p_personal_info => l_imm_personal_info,
1195 p_gov_awards_type => l_imm_gov_awards,
1196 p_perf_appraisal_type => l_imm_perf_appraisal,
1197 p_payroll_type => l_imm_payroll_type,
1198 p_conduct_perf_type => l_imm_conduct_performance,
1199 p_agency_code => l_agency_code,
1200 p_agency_sf52 => l_imm_agency_sf52,
1201 p_health_plan => l_health_plan,
1202 p_entitlement => l_imm_entitlement,
1203 p_foreign_lang_prof_pay => l_imm_foreign_lang_prof_pay,
1204 p_edp_pay => l_imm_edp_pay,
1205 p_hazard_pay => l_imm_hazard_pay,
1206 p_health_benefits => l_imm_health_benefits,
1207 p_danger_pay => l_imm_danger_pay,
1208 p_imminent_danger_pay => l_imm_imminent_danger_pay,
1209 p_living_quarters_allow => l_imm_living_quarters_allow,
1210 p_post_diff_amt => l_imm_post_diff_amt,
1211 p_post_diff_percent => l_imm_post_diff_percent,
1212 p_sep_maintenance_allow => l_imm_sep_maintenance_allow,
1213 p_supplemental_post_allow => l_imm_supplemental_post_allow,
1214 p_temp_lodge_allow => l_imm_temp_lodge_allow,
1215 p_premium_pay => l_imm_premium_pay,
1216 p_retirement_annuity => l_imm_retirement_annuity,
1217 p_severance_pay => l_imm_severance_pay,
1218 p_thrift_saving_plan => l_imm_thrift_saving_plan,
1219 p_retention_allow_review => l_imm_retention_allow_review,
1220 p_health_ben_pre_tax => l_imm_health_ben_pre_tax,
1221 p_cao_effective_date => l_cao_effective_date
1222 );
1223
1224 IF l_cao_effective_date IS NOT NULL THEN
1225 l_cancel_effective_date := l_cao_effective_date;
1226 ELSE
1227 l_cancel_effective_date := p_sf52_data.effective_date;
1228 END IF;
1229
1230 per_cancel_hire_or_apl_pkg.do_cancel_hire(
1231 p_person_id => p_sf52_data.person_id,
1232 p_date_start => l_cancel_effective_date,
1233 p_end_of_time => hr_api.g_eot,
1234 p_business_group_id => l_business_group_id,
1235 p_period_of_service_id => null
1236 );
1237 -- End segment for bug# 1295751
1238
1239 ghr_agency_update.ghr_agency_upd(
1240 p_pa_request_rec => l_sf52_data,
1241 p_asg_sf52 => l_imm_asg_sf52,
1242 p_asg_non_sf52 => l_imm_asg_non_sf52,
1243 p_asg_nte_dates => l_imm_asg_nte_dates,
1244 p_per_sf52 => l_imm_per_sf52,
1245 p_per_group1 => l_imm_per_group1,
1246 p_per_group2 => l_imm_per_group2,
1247 p_per_scd_info => l_imm_per_scd_info,
1248 p_per_retained_grade => l_imm_per_retained_grade,
1249 p_per_probations => l_imm_per_probations,
1250 p_per_sep_Retire => l_imm_per_sep_retire,
1251 p_per_security => l_imm_per_security,
1252 p_per_conversions => l_imm_per_conversions,
1253 p_per_uniformed_services => l_imm_per_uniformed_services,
1254 p_pos_oblig => l_imm_pos_oblig,
1255 p_pos_grp2 => l_imm_pos_grp2,
1256 p_pos_grp1 => l_imm_pos_grp1,
1257 p_pos_valid_grade => l_imm_pos_valid_grade,
1258 p_pos_car_prog => l_imm_pos_car_prog,
1259 p_loc_info => l_imm_loc_info,
1260 p_wgi => l_imm_wgi,
1261 p_recruitment_bonus => l_imm_recruitment_bonus,
1262 p_relocation_bonus => l_imm_relocation_bonus ,
1263 p_sf52_from_data => l_imm_sf52_from_data,
1264 p_personal_info => l_imm_personal_info,
1265 p_gov_awards_type => l_imm_gov_awards,
1266 p_perf_appraisal_type => l_imm_perf_appraisal,
1267 p_payroll_type => l_imm_payroll_type,
1268 p_conduct_perf_type => l_imm_conduct_performance,
1269 p_agency_code => l_agency_code,
1270 p_agency_sf52 => l_imm_agency_sf52,
1271 p_entitlement => l_imm_entitlement,
1272 p_foreign_lang_prof_pay => l_imm_foreign_lang_prof_pay,
1273 p_edp_pay => l_imm_edp_pay,
1274 p_hazard_pay => l_imm_hazard_pay,
1275 p_health_benefits => l_imm_health_benefits,
1276 p_danger_pay => l_imm_danger_pay,
1277 p_imminent_danger_pay => l_imm_imminent_danger_pay,
1278 p_living_quarters_allow => l_imm_living_quarters_allow,
1279 p_post_diff_amt => l_imm_post_diff_amt,
1280 p_post_diff_percent => l_imm_post_diff_percent,
1281 p_sep_maintenance_allow => l_imm_sep_maintenance_allow,
1282 p_supplemental_post_allow => l_imm_supplemental_post_allow,
1283 p_temp_lodge_allow => l_imm_temp_lodge_allow,
1284 p_premium_pay => l_imm_premium_pay,
1285 p_retirement_annuity => l_imm_retirement_annuity,
1286 p_severance_pay => l_imm_severance_pay,
1287 p_thrift_saving_plan => l_imm_thrift_saving_plan,
1288 p_retention_allow_review => l_imm_retention_allow_review,
1289 p_health_ben_pre_tax => l_imm_health_ben_pre_tax,
1290 p_per_benefit_info => l_imm_per_benefit_info,
1291 p_imm_retirement_info => l_imm_retirement_info); --Bug# 7131104
1292
1293 hr_utility.set_location( l_proc, 50);
1294 ghr_sf52_post_update.post_sf52_cancel(
1295 p_pa_request_id => p_sf52_data.pa_request_id,
1296 p_effective_date => l_session_var.date_effective,
1297 p_object_version_number => p_sf52_data.object_version_number,
1298 p_from_position_id => p_sf52_data.from_position_id,
1299 p_to_position_id => p_sf52_data.to_position_id,
1300 p_agency_code => p_sf52_data.agency_code);
1301
1302 --
1303 -- Mark all the SF52s cancelled which were created after Appt. SF52
1304 --
1305 hr_utility.set_location( l_proc, 110);
1306 for l_par in c_par( p_sf52_data.person_id,
1307 p_sf52_data.effective_date)
1308 loop
1309 hr_utility.set_location( l_proc, 111);
1310 exit when c_par%notfound;
1311 -- mark delete
1312 if l_par.first_noa_code not in ('001' , '002') then
1313 -- no need to do anything with cancellation/correction actions as they
1314 -- already will not appear in cancellation/correction form.
1315 -- EDWARD NUNEZ 03/03/2000
1316 -- NOTE: To fix bug# 1222525 please change following line
1317 -- "if l_par.first_noa_cancel_or_correct is null then" to
1318 -- "if l_par.first_noa_cancel_or_correct is null OR
1319 -- NVL(l_par.first_noa_cancel_or_correct, '***') = 'CORRECT' then"
1320 if l_par.first_noa_cancel_or_correct is null or
1321 NVL(l_par.first_noa_cancel_or_correct, '***') = 'CORRECT'
1322 then
1323 l_par.first_noa_cancel_or_correct := ghr_history_api.g_cancel;
1324 end if;
1325 end if;
1326 if l_par.second_noa_code is not NULL then
1327 -- handle dual actions
1328 if l_par.second_noa_cancel_or_correct is null then
1329 l_par.second_noa_cancel_or_correct := ghr_history_api.g_cancel;
1330 end if;
1331 end if;
1332
1333 -- Special handling is required for the termination action 352.
1334 -- Added by VVL
1335
1336 if (l_par.first_noa_code = '352') then
1337 -- null out end_date for position
1338
1339 SELECT name, object_version_number
1340 INTO l_pos_name, l_object_version_number
1341 FROM hr_all_positions_f
1342 WHERE position_id = l_par.from_position_id
1343 AND (l_par.effective_date - 1) BETWEEN effective_start_date
1344 AND effective_end_date;
1345 hr_position_api.delete_position
1346 (p_position_id => l_par.from_position_id,
1347 p_object_version_number => l_object_version_number,
1348 p_effective_date => l_par.effective_date - 1,
1349 p_effective_start_date => l_effective_start_date,
1350 p_effective_end_date => l_effective_end_date,
1351 p_datetrack_mode => 'DELETE_NEXT_CHANGE'
1352 );
1353 end if;
1354 --Added by VVL
1355 ghr_sf52_api.update_Sf52(
1356 p_pa_request_id => l_par.pa_request_id,
1357 p_par_object_version_number => l_par.object_version_number,
1358 p_first_noa_cancel_or_correct => l_par.first_noa_cancel_or_correct,
1359 p_second_noa_cancel_or_correct => l_par.second_noa_cancel_or_correct,
1360 p_u_prh_object_version_number => l_u_prh_object_version_number,
1361 p_i_pa_routing_history_id => l_i_pa_routing_history_id,
1362 p_i_prh_object_version_number => l_i_prh_object_version_number,
1363 p_u_action_taken => 'NONE'
1364 );
1365 End loop;
1366
1367 hr_utility.set_location( l_proc, 80);
1368
1369 hr_utility.set_location(' Leaving ' || l_proc, 100);
1370 Exception when others then
1371 --
1372 -- Reset IN OUT parameters and set OUT parameters
1373 --
1374 p_sf52_data := l_sf52_data_rec;
1375 raise;
1376
1377 End Cancel_Appt_SF52;
1378
1379 -- ---------------------------------------------------------------------------
1380 -- |--------------------------< cancel_correction_sf52>-----------------------|
1381 -- ---------------------------------------------------------------------------
1382 -- {Start Of Comments}
1383 --
1384 -- Description:
1385 -- This procedure cancels a correction sf52.
1386 --
1387 -- Pre-Requisities:
1388 -- None.
1389 --
1390 -- In Parameters:
1391 -- p_sf52_data -> ghr_pa_requests record of the correction sf52.
1392 --
1393 -- Post Success:
1394 -- The correction sf52 will have been cancelled.
1395 --
1396 -- Post Failure:
1397 -- No failure conditions.
1398 --
1399 -- Developer Implementation Notes:
1400 -- At this point, cancellation of a correction sf52 is handled just the same as a cancellation
1401 -- of a normal sf52. So, this procedure just calls the cancel_other_family_sf52 procedure.
1402 --
1403 -- Access Status:
1404 -- Internal Development Use Only.
1405 --
1406 -- {End Of Comments}
1407 -- ---------------------------------------------------------------------------
1408 Procedure Cancel_Correction_SF52 ( p_sf52_data in out nocopy ghr_pa_requests%rowtype) is
1409 l_proc varchar2(30):='Cancel_Correction_SF52';
1410 l_sf52_data ghr_pa_requests%rowtype;
1411 Begin
1412 hr_utility.set_location('entering : ' || l_proc, 10);
1413 l_sf52_data := p_sf52_data;
1414 Cancel_Other_Family_Sf52 (p_sf52_data);
1415 hr_utility.set_location('leaving : ' || l_proc, 20);
1416 exception when others then
1417 --
1418 -- Reset IN OUT parameters and set OUT parameters
1419 --
1420 p_sf52_data := l_sf52_data;
1421 raise;
1422 End Cancel_Correction_SF52;
1423
1424 -- ---------------------------------------------------------------------------
1425 -- |--------------------------< cancel_other_family_sf52>---------------------|
1426 -- ---------------------------------------------------------------------------
1427 -- {Start Of Comments}
1428 --
1429 -- Description:
1430 -- This procedure handles a cancellation of a 'normal' sf52.
1431 --
1432 -- Pre-Requisities:
1433 -- None.
1434 --
1435 -- In Parameters:
1436 -- p_sf52_data -> ghr_pa_requests record of the correction sf52.
1437 -- Post Success:
1438 -- The cancellation will have been applied.
1439 --
1440 -- Post Failure:
1441 -- No failure conditions.
1442 --
1443 -- Developer Implementation Notes:
1444 -- None.
1445 --
1446 -- Access Status:
1447 -- Internal Development Use Only.
1448 --
1449 -- {End Of Comments}
1450 -- ---------------------------------------------------------------------------
1451
1452 PROCEDURE Cancel_Other_Family_Sf52 ( p_sf52_data in out nocopy ghr_pa_requests%rowtype) AS
1453 l_buf number;
1454 l_eff_date date;
1455 l_proc varchar2(72) := 'Cancel_Other_Family_Sf52' ;
1456 l_date_eff_rec pay_element_entry_values_f%rowtype;
1457 l_hist_dummy ghr_pa_history%rowtype;
1458 l_hist_rec ghr_pa_requests%rowtype;
1459 l_hist_address_rec ghr_pa_history%rowtype;
1460 l_hist_pre ghr_pa_history%rowtype;
1461 l_hist_data_as_of_date ghr_pa_history%rowtype;
1462 l_return_status varchar2(100);
1463 l_interv_on_table boolean;
1464 l_interv_on_eff_date boolean;
1465 l_pre_record boolean;
1466 l_can_delete boolean;
1467 l_last_row boolean;
1468 l_cannot_cancel boolean;
1469 l_datetrack_table boolean;
1470 l_datetrack_mode varchar2(30);
1471 l_session_var ghr_history_api.g_session_var_type;
1472 l_result_code varchar2(30);
1473 l_rec_created_flag boolean;
1474 l_del_mode varchar2(30);
1475 l_agency_ei_data ghr_pa_request_extra_info%rowtype;
1476 l_imm_asg_sf52 ghr_api.asg_sf52_type;
1477 l_imm_asg_non_sf52 ghr_api.asg_non_sf52_type;
1478 l_imm_asg_nte_dates ghr_api.asg_nte_dates_type;
1479 l_imm_per_sf52 ghr_api.per_sf52_type;
1480 l_imm_per_group1 ghr_api.per_group1_type;
1481 l_imm_per_group2 ghr_api.per_group2_type;
1482 l_imm_per_scd_info ghr_api.per_scd_info_type;
1483 l_imm_per_retained_grade ghr_api.per_retained_grade_type;
1484 l_imm_per_probations ghr_api.per_probations_type;
1485 l_imm_per_sep_retire ghr_api.per_sep_retire_type;
1486 l_imm_per_security ghr_api.per_security_type;
1487 -- Bug#4486823 RRR changes
1488 l_imm_per_service_oblig ghr_api.per_service_oblig_type;
1489 l_imm_per_conversions ghr_api.per_conversions_type;
1490 -- 4352589 BEN_EIT Changes
1491 l_imm_per_benefit_info ghr_api.per_benefit_info_type;
1492 l_imm_per_uniformed_services ghr_api.per_uniformed_services_type;
1493 l_imm_pos_oblig ghr_api.pos_oblig_type;
1494 l_imm_pos_grp2 ghr_api.pos_grp2_type;
1495 l_imm_pos_grp1 ghr_api.pos_grp1_type;
1496 l_imm_pos_valid_grade ghr_api.pos_valid_grade_type;
1497 l_imm_pos_car_prog ghr_api.pos_car_prog_type;
1498 l_imm_loc_info ghr_api.loc_info_type;
1499 l_imm_wgi ghr_api.within_grade_increase_type;
1500 l_imm_gov_awards ghr_api.government_awards_type;
1501 l_imm_recruitment_bonus ghr_api.recruitment_bonus_type;
1502 l_imm_relocation_bonus ghr_api.relocation_bonus_type;
1503 l_imm_student_loan_repay ghr_api.student_loan_repay_type;
1504 --Pradeep
1505 l_imm_mddds_special_pay ghr_api.mddds_special_pay_type;
1506 l_imm_premium_pay_ind ghr_api.premium_pay_ind_type;
1507
1508 l_imm_extra_info_rec ghr_api.extra_info_rec_type ;
1509 l_imm_sf52_from_data ghr_api.prior_sf52_data_type;
1510 l_imm_personal_info ghr_api.personal_info_type;
1511 l_imm_generic_extra_info_rec ghr_api.generic_extra_info_rec_type ;
1512 l_imm_agency_sf52 ghr_api.agency_sf52_type;
1513 l_agency_code varchar2(50);
1514 l_imm_perf_appraisal ghr_api.performance_appraisal_type;
1515 l_imm_conduct_performance ghr_api.conduct_performance_type;
1516 l_imm_payroll_type ghr_api.government_payroll_type;
1517 l_imm_par_term_retained_grade ghr_api.par_term_retained_grade_type;
1518 l_imm_entitlement ghr_api.entitlement_type;
1519 -- Bug#2759379 Added FEGLI Record
1520 l_imm_fegli ghr_api.fegli_type;
1521 l_imm_foreign_lang_prof_pay ghr_api.foreign_lang_prof_pay_type;
1522 -- Bug#3385386 Added FTA Record
1523 l_imm_fta ghr_api.fta_type;
1524 l_imm_edp_pay ghr_api.edp_pay_type;
1525 l_imm_hazard_pay ghr_api.hazard_pay_type;
1526 l_imm_health_benefits ghr_api.health_benefits_type;
1527 l_imm_danger_pay ghr_api.danger_pay_type;
1528 l_imm_imminent_danger_pay ghr_api.imminent_danger_pay_type;
1529 l_imm_living_quarters_allow ghr_api.living_quarters_allow_type;
1530 l_imm_post_diff_amt ghr_api.post_diff_amt_type;
1531 l_imm_post_diff_percent ghr_api.post_diff_percent_type;
1532 l_imm_sep_maintenance_allow ghr_api.sep_maintenance_allow_type;
1533 l_imm_supplemental_post_allow ghr_api.supplemental_post_allow_type;
1534 l_imm_temp_lodge_allow ghr_api.temp_lodge_allow_type;
1535 l_imm_premium_pay ghr_api.premium_pay_type;
1536 l_imm_retirement_annuity ghr_api.retirement_annuity_type;
1537 l_imm_severance_pay ghr_api.severance_pay_type;
1538 l_imm_thrift_saving_plan ghr_api.thrift_saving_plan;
1539 l_imm_retention_allow_review ghr_api.retention_allow_review_type;
1540 l_imm_health_ben_pre_tax ghr_api.health_ben_pre_tax_type;
1541 l_imm_per_race_ethnic_info ghr_api.per_race_ethnic_type; -- Bug 4724337 Race or National Origin changes
1542 l_sf52_data ghr_pa_requests%rowtype;
1543 l_sf52_data_rec ghr_pa_requests%rowtype;
1544 l_health_plan varchar2(30);
1545 l_error_flag boolean;
1546 l_pa_history_id number;
1547 l_result boolean;
1548 l_deleted boolean;
1549 l_system_type per_person_types.system_person_type%type;
1550 l_prior_noa_code ghr_nature_of_actions.code%type;
1551 l_noa_family_code ghr_families.noa_family_code%type;
1552 l_prior_asg_id per_assignments_f.assignment_id%type; --Bug# 5442674
1553
1554 -- bug #6312144
1555 l_imm_ipa_benefits_cont ghr_api.per_ipa_ben_cont_info_type;
1556 l_imm_retirement_info ghr_api.per_retirement_info_type;
1557
1558
1559 -- this cursor retrieves the ghr_pa_history row for the pa_request_id and noa_id given.
1560 -- note that this cursor orders by table name, this is due to the fact that we need to
1561 -- handle PAY_ELEMENT_ENTRY_VALUES_F history records before PAY_ELEMENT_ENTRIES_F history
1562 -- records due to the parent-child relationship of these two tables. Fetch_history routine
1563 -- for elements relies on the parent record in history being intact.
1564 cursor c_history_info (cp_pa_request_id in ghr_pa_requests.pa_request_id%type,
1565 cp_noa_id in ghr_pa_requests.first_noa_id%type) is
1566 SELECT *
1567 FROM GHR_PA_HISTORY
1568 WHERE pa_request_id = cp_pa_request_id
1569 AND nature_of_action_id = cp_noa_id
1570 ORDER BY DECODE(table_name, 'PAY_ELEMENT_ENTRY_VALUES_F', -2,
1571 'PAY_ELEMENT_ENTRIES_F', -1,
1572 pa_history_id) asc;
1573
1574 --start of bug #5900178
1575 -- Added this below cursor for the bug#5900178 to validate whether per_person_analyses
1576 --record is available for updation or not if it is available it will be continue otherwise
1577 --- it wont continue for cascading
1578 cursor chk_perana_exists(p_person_analysis_id in per_person_analyses.person_analysis_id%type)
1579 is
1580 SELECT 1
1581 FROM PER_PERSON_ANALYSES
1582 WHERE person_analysis_id = p_person_analysis_id;
1583
1584 m_perana varchar2(1);
1585 l_rec_exists boolean;
1586 --end of bug #5900178
1587
1588 -- Bug#2780976 Modified the cursor c_prior_person_type
1589 -- Bug# 5442674 Modified the select statement
1590 Cursor c_prior_person_type is
1591 Select paf.assignment_id
1592 from per_assignments_f paf
1593 where paf.person_id = p_sf52_data.person_id
1594 and paf.assignment_type='E'
1595 and p_sf52_data.effective_date-1 between paf.effective_start_date and paf.effective_end_date;
1596
1597 Cursor c_prior_noa_code is
1598 Select par.first_noa_code,
1599 par.first_noa_id
1600 from ghr_pa_requests par
1601 where par.pa_request_id = p_sf52_data.altered_pa_request_id;
1602
1603 Cursor c_noa_family(p_noa_id in number) is
1604 Select fam.noa_family_code
1605 from ghr_noa_families nof,
1606 ghr_families fam
1607 where nof.nature_of_action_id = p_noa_id
1608 and fam.noa_family_code = nof.noa_family_code
1609 and nvl(fam.proc_method_flag,hr_api.g_varchar2) = 'Y'
1610 and p_sf52_data.effective_date
1611 between nvl(fam.start_date_active,p_sf52_data.effective_date)
1612 and nvl(fam.end_date_active,p_sf52_data.effective_date);
1613
1614 cursor c_follow_rec( c_table_name ghr_pa_history.table_name%type,
1615 c_pk_id ghr_pa_history.information1%type,
1616 c_pa_history_id ghr_pa_history.pa_history_id%type) is
1617 select pa_history_id
1618 from ghr_pa_history
1619 where table_name = c_table_name
1620 and information1 = c_pk_id
1621 and pa_history_id > c_pa_history_id;
1622
1623
1624 cursor c_hist_address ( c_pa_request_id number,
1625 c_noa_id number) is
1626 select
1627 rowid row_id, table_name,pa_history_id,information5
1628 ,information9, information10
1629 from ghr_pa_history
1630 where pa_request_id = c_pa_request_id
1631 and table_name = ghr_history_api.g_addres_table
1632 and nature_of_action_id = c_noa_id
1633 for update of person_id
1634 order by pa_history_id desc;
1635 --
1636 Cursor Cur_bg(p_person_id NUMBER,
1637 p_eff_date DATE) is
1638 Select distinct business_group_id bg
1639 from per_assignments_f
1640 where person_id = p_person_id
1641 and p_eff_date between effective_start_date
1642 and effective_end_date;
1643 --
1644 ll_bg_id NUMBER;
1645 ll_pay_basis VARCHAR2(80);
1646 ll_effective_date DATE;
1647 l_new_element_name VARCHAR2(80);
1648 --
1649 -- Bug#2521744 Declared 2 variables,2 cursors.
1650 l_element_name VARCHAR2(80);
1651 l_element_name1 VARCHAR2(80);
1652 l_bus_group_id NUMBER;
1653
1654 CURSOR c_element_name(p_element_link_id NUMBER) IS
1655 SELECT elt.element_name
1656 FROM PAY_ELEMENT_LINKS_F ell,PAY_ELEMENT_TYPES_F elt
1657 WHERE ell.ELEMENT_type_id = elt.element_type_id
1658 AND ell.element_link_id = p_element_link_id;
1659 --
1660 -- Created the following cursor to handle same day other pay actions.
1661 CURSOR c_element_name1(p_element_entry_id NUMBER) IS
1662 SELECT elt.element_name
1663 FROM PAY_ELEMENT_LINKS_F ell,
1664 PAY_ELEMENT_TYPES_F elt,
1665 pay_element_entries_f ele
1666 WHERE ell.ELEMENT_type_id = elt.element_type_id
1667 AND ele.element_type_id = elt.element_type_id
1668 AND ell.element_link_id = ele.element_link_id
1669 AND ele.element_entry_id = p_element_entry_id;
1670 -- end of 2521744;
1671 --
1672 BEGIN
1673 -- hr_utility.trace_on(null,'venkat');
1674 hr_utility.set_location('Entering '|| l_proc,5);
1675 l_sf52_data_rec := p_sf52_data;
1676 -- Initialization
1677 --
1678 l_sf52_data_rec := p_sf52_data;
1679 For BG_rec in Cur_BG(l_sf52_data_rec.person_id,
1680 l_sf52_data_rec.effective_date)
1681 Loop
1682 ll_bg_id :=BG_rec.bg;
1683 End Loop;
1684 -- Effective_date
1685 ll_effective_date := l_sf52_data_rec.effective_date;
1686 -- Pick pay basis from PAR
1687
1688 for noa_family_rec in c_noa_family(p_sf52_data.second_noa_id) loop
1689 l_noa_family_code := noa_family_rec.noa_family_code;
1690 end loop;
1691 If nvl(l_noa_family_code,hr_api.g_varchar2) = 'CONV_APP' then
1692 hr_utility.set_location('CAncel of conversion',1);
1693 -- check to see if the person was an EX_EMP prior to the effective
1694 -- date of this action.
1695 for prior_person_type in c_prior_person_type loop
1696 l_prior_asg_id := prior_person_type.assignment_id; --Bug# 5442674
1697 exit;
1698 end loop;
1699 for prior_noa_code in c_prior_noa_code loop
1700 l_prior_noa_code := prior_noa_code.first_noa_code;
1701 end loop;
1702 End if;
1703 hr_utility.set_location('Family Code' || l_noa_family_code,1000);
1704 hr_utility.set_location('Second NOA Code' || p_sf52_data.second_noa_code,1000);
1705 hr_utility.set_location('Prior Assignment Id' || l_prior_asg_id,1001);
1706 hr_utility.set_location('Assignment Id' || l_sf52_data_rec.employee_assignment_id,1002);
1707 If nvl(l_noa_family_code,hr_api.g_varchar2) = 'CONV_APP' and
1708 nvl(l_prior_asg_id,hr_api.g_number) <> l_sf52_data_rec.employee_assignment_id and --Bug# 5442674
1709 nvl(l_prior_noa_code,hr_api.g_varchar2) <> '002' then
1710
1711 hr_utility.set_location('Cancel of Ex_EMP conversion',1);
1712 ghr_corr_canc_sf52.cancel_appt_sf52(p_sf52_data);
1713 Else
1714 -- reinitialise session variables
1715 ghr_history_api.reinit_g_session_var;
1716 -- set values of session variables
1717 l_session_var.pa_request_id := p_sf52_data.pa_request_id;
1718 l_session_var.noa_id := p_sf52_data.second_noa_id;
1719 l_session_var.fire_trigger := 'Y';
1720 l_session_var.date_Effective := p_sf52_data.effective_date;
1721 l_session_var.person_id := p_sf52_data.person_id;
1722 l_session_var.program_name := 'sf50';
1723 l_session_var.altered_pa_request_id := p_sf52_data.altered_pa_request_id;
1724 l_session_var.noa_id_correct := p_sf52_data.second_noa_id;
1725 l_session_var.assignment_id := p_sf52_data.employee_assignment_id;
1726
1727 ghr_history_api.set_g_session_var(l_session_var);
1728
1729 ghr_process_Sf52.Fetch_extra_info(
1730 p_pa_request_id => p_sf52_data.pa_request_id,
1731 p_noa_id => p_sf52_data.second_noa_id,
1732 p_agency_ei => TRUE,
1733 p_sf52_ei_data => l_agency_ei_data,
1734 p_result => l_result_code);
1735
1736 l_sf52_data := p_sf52_data;
1737 -- all corrections will have the original sf52 information in the 2nd noa columns, so
1738 -- copy that information to 1st noa columns.
1739 ghr_process_sf52.copy_2ndNoa_to_1stNoa(l_sf52_data);
1740 -- null the second noa columns since we don't want anything to be done with these now.
1741 ghr_process_sf52.null_2ndNoa_cols(l_sf52_data);
1742
1743 ghr_sf52_pre_update.populate_record_groups (
1744 p_pa_request_rec => l_sf52_data,
1745 p_generic_ei_rec => l_agency_ei_data,
1746 p_imm_asg_sf52 => l_imm_asg_sf52,
1747 p_imm_asg_non_sf52 => l_imm_asg_non_sf52,
1748 p_imm_asg_nte_dates => l_imm_asg_nte_dates,
1749 p_imm_per_sf52 => l_imm_per_sf52,
1750 p_imm_per_group1 => l_imm_per_group1,
1751 p_imm_per_group2 => l_imm_per_group2,
1752 p_imm_per_scd_info => l_imm_per_scd_info,
1753 p_imm_per_retained_grade => l_imm_per_retained_grade,
1754 p_imm_per_probations => l_imm_per_probations,
1755 p_imm_per_sep_retire => l_imm_per_sep_retire,
1756 p_imm_per_security => l_imm_per_security,
1757 --Bug#4486823 RRR Changes
1758 p_imm_per_service_oblig => l_imm_per_service_oblig,
1759 p_imm_per_conversions => l_imm_per_conversions,
1760 -- 4352589 BEN_EIT Changes
1761 p_imm_per_benefit_info => l_imm_per_benefit_info,
1762 p_imm_per_uniformed_services => l_imm_per_uniformed_services,
1763 p_imm_pos_oblig => l_imm_pos_oblig,
1764 p_imm_pos_grp2 => l_imm_pos_grp2,
1765 p_imm_pos_grp1 => l_imm_pos_grp1,
1766 p_imm_pos_valid_grade => l_imm_pos_valid_grade,
1767 p_imm_pos_car_prog => l_imm_pos_car_prog,
1768 p_imm_loc_info => l_imm_loc_info,
1769 p_imm_wgi => l_imm_wgi,
1770 p_imm_gov_awards => l_imm_gov_awards,
1771 p_imm_recruitment_bonus => l_imm_recruitment_bonus,
1772 p_imm_relocation_bonus => l_imm_relocation_bonus,
1773 p_imm_student_loan_repay => l_imm_student_loan_repay,
1774 p_imm_per_race_ethnic_info => l_imm_per_race_ethnic_info, -- Bug 4724337 Race or National Origin changes
1775 --Pradeep
1776 p_imm_mddds_special_pay => l_imm_mddds_special_pay,
1777 p_imm_premium_pay_ind => l_imm_premium_pay_ind,
1778
1779 p_imm_perf_appraisal => l_imm_perf_appraisal,
1780 p_imm_conduct_performance => l_imm_conduct_performance,
1781 p_imm_payroll_type => l_imm_payroll_type,
1782 p_imm_extra_info_rec => l_imm_extra_info_rec,
1783 p_imm_sf52_from_data => l_imm_sf52_from_data,
1784 p_imm_personal_info => l_imm_personal_info,
1785 p_imm_generic_extra_info_rec => l_imm_generic_extra_info_rec,
1786 p_imm_agency_sf52 => l_imm_agency_sf52,
1787 p_agency_code => l_agency_code,
1788 p_imm_par_term_retained_grade => l_imm_par_term_retained_grade,
1789 p_imm_entitlement => l_imm_entitlement,
1790 -- Bug#2759379 Added FEGLI Record
1791 p_imm_fegli => l_imm_fegli,
1792 p_imm_foreign_lang_prof_pay => l_imm_foreign_lang_prof_pay,
1793 -- Bug#3385386 Added FTA Record
1794 p_imm_fta => l_imm_fta,
1795 p_imm_edp_pay => l_imm_edp_pay,
1796 p_imm_hazard_pay => l_imm_hazard_pay,
1797 p_imm_health_benefits => l_imm_health_benefits,
1798 p_imm_danger_pay => l_imm_danger_pay,
1799 p_imm_imminent_danger_pay => l_imm_imminent_danger_pay,
1800 p_imm_living_quarters_allow => l_imm_living_quarters_allow,
1801 p_imm_post_diff_amt => l_imm_post_diff_amt,
1802 p_imm_post_diff_percent => l_imm_post_diff_percent,
1803 p_imm_sep_maintenance_allow => l_imm_sep_maintenance_allow,
1804 p_imm_supplemental_post_allow => l_imm_supplemental_post_allow,
1805 p_imm_temp_lodge_allow => l_imm_temp_lodge_allow,
1806 p_imm_premium_pay => l_imm_premium_pay,
1807 p_imm_retirement_annuity => l_imm_retirement_annuity,
1808 p_imm_severance_pay => l_imm_severance_pay,
1809 p_imm_thrift_saving_plan => l_imm_thrift_saving_plan,
1810 p_imm_retention_allow_review => l_imm_retention_allow_review,
1811 p_imm_health_ben_pre_tax => l_imm_health_ben_pre_tax,
1812 --Bug# 6312144 RPA EIT Benefits
1813 p_imm_ipa_benefits_cont => l_imm_ipa_benefits_cont,
1814 p_imm_retirement_info => l_imm_retirement_info);
1815
1816 --
1817 ghr_api.retrieve_element_entry_value
1818 ( p_element_name => 'Health Benefits'
1819 ,p_input_value_name => 'Health Plan'
1820 ,p_assignment_id => l_sf52_data.employee_assignment_id
1821 ,p_effective_date => trunc(l_sf52_data.effective_date)
1822 ,p_value => l_health_plan
1823 ,p_multiple_error_flag => l_error_flag
1824 );
1825
1826 GHR_AGENCY_CHECK.AGENCY_CHECK(
1827 p_pa_request_rec => l_sf52_data,
1828 p_asg_sf52 => l_imm_asg_sf52,
1829 p_asg_non_sf52 => l_imm_asg_non_sf52,
1830 p_asg_nte_dates => l_imm_asg_nte_dates,
1831 p_per_sf52 => l_imm_per_sf52,
1832 p_per_group1 => l_imm_per_group1,
1833 p_per_group2 => l_imm_per_group2,
1834 p_per_scd_info => l_imm_per_scd_info,
1835 p_per_retained_grade => l_imm_per_retained_grade,
1836 p_per_probations => l_imm_per_probations,
1837 p_per_sep_Retire => l_imm_per_sep_retire,
1838 p_per_security => l_imm_per_security,
1839 p_per_conversions => l_imm_per_conversions,
1840 p_per_uniformed_services => l_imm_per_uniformed_services,
1841 p_pos_oblig => l_imm_pos_oblig,
1842 p_pos_grp2 => l_imm_pos_grp2,
1843 p_pos_grp1 => l_imm_pos_grp1,
1844 p_pos_valid_grade => l_imm_pos_valid_grade,
1845 p_pos_car_prog => l_imm_pos_car_prog,
1846 p_loc_info => l_imm_loc_info,
1847 p_wgi => l_imm_wgi,
1848 p_recruitment_bonus => l_imm_recruitment_bonus,
1849 p_relocation_bonus => l_imm_relocation_bonus ,
1850 p_sf52_from_data => l_imm_sf52_from_data,
1851 p_personal_info => l_imm_personal_info,
1852 p_gov_awards_type => l_imm_gov_awards,
1853 p_perf_appraisal_type => l_imm_perf_appraisal,
1854 p_payroll_type => l_imm_payroll_type,
1855 p_conduct_perf_type => l_imm_conduct_performance,
1856 p_agency_code => l_agency_code,
1857 p_agency_sf52 => l_imm_agency_sf52,
1858 p_health_plan => l_health_plan,
1859 p_entitlement => l_imm_entitlement,
1860 p_foreign_lang_prof_pay => l_imm_foreign_lang_prof_pay,
1861 p_edp_pay => l_imm_edp_pay,
1862 p_hazard_pay => l_imm_hazard_pay,
1863 p_health_benefits => l_imm_health_benefits,
1864 p_danger_pay => l_imm_danger_pay,
1865 p_imminent_danger_pay => l_imm_imminent_danger_pay,
1866 p_living_quarters_allow => l_imm_living_quarters_allow,
1867 p_post_diff_amt => l_imm_post_diff_amt,
1868 p_post_diff_percent => l_imm_post_diff_percent,
1869 p_sep_maintenance_allow => l_imm_sep_maintenance_allow,
1870 p_supplemental_post_allow => l_imm_supplemental_post_allow,
1871 p_temp_lodge_allow => l_imm_temp_lodge_allow,
1872 p_premium_pay => l_imm_premium_pay,
1873 p_retirement_annuity => l_imm_retirement_annuity,
1874 p_severance_pay => l_imm_severance_pay,
1875 p_thrift_saving_plan => l_imm_thrift_saving_plan,
1876 p_retention_allow_review => l_imm_retention_allow_review,
1877 p_health_ben_pre_tax => l_imm_health_ben_pre_tax,
1878 p_per_benefit_info => l_imm_per_benefit_info,
1879 p_imm_retirement_info => l_imm_retirement_info); --Bug# 7131104
1880 -- Bug#2347658
1881 --Cancel address records in a different style for Correction to Separation action.
1882 IF (l_noa_family_code = 'SEPARATION') Then
1883 FOR l_hist IN c_hist_address(p_sf52_data.altered_pa_request_id, p_sf52_data.second_noa_id)
1884 LOOP
1885 SELECT *
1886 INTO l_hist_address_rec
1887 FROM ghr_pa_history
1888 WHERE pa_history_id = l_hist.pa_history_id;
1889
1890 ghr_history_api.fetch_history_info(
1891 p_table_name => ghr_history_api.g_addres_table,
1892 p_hist_data => l_hist_pre,
1893 p_pa_history_id => l_hist_address_rec.pa_history_id,
1894 p_table_pk_id => l_hist_address_rec.information1,
1895 p_person_id => p_sf52_data.person_id,
1896 p_date_effective => p_sf52_data.effective_date,
1897 p_result_code => l_return_status);
1898 if (l_return_status is not null) then
1899 -- there were no prevalues for this record
1900 -- only delete application table if there are no following records.
1901 open c_follow_rec( c_table_name => l_hist_address_rec.table_name,
1902 c_pk_id => l_hist_address_rec.information1,
1903 c_pa_history_id => l_hist_address_rec.pa_history_id);
1904 fetch c_follow_rec into l_buf;
1905 if c_follow_rec%NOTFOUND then
1906 delete_appl_row(
1907 p_table_name => ghr_history_api.g_addres_table,
1908 p_table_pk_id => l_hist_address_rec.information1,
1909 p_dt_mode => null,
1910 p_date_effective => l_hist_address_rec.effective_date);
1911 end if;
1912 close c_follow_rec;
1913 else
1914 -- there is a pre record, so apply it to the history table and to the application table.
1915 ghr_history_cascade.cascade_history_data (
1916 p_table_name => l_hist_address_rec.table_name,
1917 p_person_id => l_hist_address_rec.person_id,
1918 p_pre_record => l_hist_pre,
1919 p_post_record => l_hist_address_rec,
1920 p_cascade_type => 'cancel',
1921 p_interv_on_table => l_interv_on_table,
1922 p_interv_on_eff_date => l_interv_on_eff_date,
1923 p_hist_data_as_of_date => l_hist_data_as_of_date);
1924 delete_hist_row( l_hist.row_id);
1925 ghr_history_cascade.cascade_appl_table_data (
1926 p_table_name => l_hist_address_rec.table_name,
1927 p_person_id => l_hist_address_rec.person_id,
1928 p_pre_record => l_hist_pre,
1929 p_post_record => l_hist_address_rec,
1930 p_cascade_type => 'cancel',
1931 p_interv_on_table => l_interv_on_table,
1932 p_interv_on_eff_date => l_interv_on_eff_date,
1933 p_hist_data_as_of_date => l_hist_data_as_of_date);
1934 end if;
1935 END LOOP;
1936 END IF;
1937 -- Bug#2347658 (End of fix)
1938
1939 -- loop thru all history records for the NOA that is being cancelled.
1940 FOR l_hist_rec in c_history_info(p_sf52_data.altered_pa_request_id, p_sf52_data.second_noa_id) LOOP
1941 hr_utility.set_location('Entering LOOP'|| l_proc,10);
1942 l_pre_record := TRUE;
1943 l_datetrack_table := TRUE;
1944 -- initialize pre-record to all nulls
1945 l_hist_pre := l_hist_dummy;
1946 -- get pre-record for the record fetched
1947 hr_utility.set_location('before fetch history info',12345);
1948 ghr_history_api.fetch_history_info(
1949 p_table_name => l_hist_rec.table_name,
1950 p_hist_data => l_hist_pre,
1951 p_pa_history_id => l_hist_rec.pa_history_id,
1952 p_table_pk_id => l_hist_rec.information1,
1953 p_person_id => l_hist_rec.person_id,
1954 p_date_effective => l_hist_rec.effective_date,
1955 p_result_code => l_return_status);
1956 hr_utility.set_location('after fetch history info',12345);
1957 hr_utility.set_location('status is'||l_return_status,12345);
1958 hr_utility.set_location('hist id'||l_hist_rec.pa_history_id,12345);
1959 hr_utility.set_location('person id'||l_hist_rec.person_id,12345);
1960 hr_utility.set_location('eff_date is '||l_hist_rec.effective_date,12345);
1961
1962 if (l_return_status is not null) then
1963 -- there were no prevalues for this record
1964 hr_utility.set_location('no pre-values'|| l_proc,15);
1965 l_pre_record := FALSE;
1966 else
1967 -- Debug statements
1968 hr_utility.set_location('Pre Value - pa_history_id ' || l_hist_pre.pa_history_id, 16);
1969 hr_utility.set_location('Pre Value - effective_date ' || l_hist_pre.effective_date, 17);
1970 hr_utility.set_location('Information1 : ' || l_hist_pre.information1, 18);
1971 hr_utility.set_location('Information2 : ' || l_hist_pre.information2, 19);
1972
1973 end if;
1974 -- all mappings are such that information2 always corresponds to effective_start_date. If this
1975 -- column is null, then the row concerns a non-datetrack table. If it is not null, then this row
1976 -- concerns a datetrack table.
1977 if (l_hist_rec.information2 is null) then
1978 hr_utility.set_location('datetrack table'|| l_proc,20);
1979 l_datetrack_table := FALSE;
1980 end if;
1981 -- PAY_ELEMENT_ENTRY needs to be handled differently
1982 if lower(l_hist_rec.table_name) = lower(ghr_history_api.g_eleent_table) then
1983 hr_utility.set_location('Processing element entry record'|| l_proc,25);
1984 if l_hist_rec.DML_operation = ghr_history_api.g_ins_operation then
1985 hr_utility.set_location('Record was created'|| l_proc,30);
1986 -- Call Delete_element_entry;
1987 -- delete all entry values from history;
1988 -- VSM Changes made for BUG # 611161
1989 -- To be able to delete this entry we have to pass previous record and
1990 -- ask to delete next change.
1991 -- If there is no pre-record then Call IF_ZAP_ELE_ENT to find if we need to zap
1992 -- the entry.
1993 l_result := FALSE;
1994 l_del_mode := hr_api.g_delete_next_change;
1995 if l_return_status is not null then
1996 hr_utility.set_location(' Call IF_ZAP_ELE_ENT' || l_proc, 31);
1997 If l_session_var.noa_id_correct is not null and l_sf52_data.first_noa_code = '866' then
1998 IF_ZAP_ELE_ENT(
1999 p_element_entry_id => l_hist_rec.information1,
2000 p_effective_start_date => l_hist_rec.effective_date + 1,
2001 p_pa_history_id => l_hist_rec.pa_history_id,
2002 p_result => l_result);
2003 if l_result then
2004 -- ie can zap the element;
2005
2006 hr_utility.set_location(' ZAP Mode set ' || l_proc, 32);
2007 l_del_mode := hr_api.g_zap;
2008 -- As there is no pre record. copy current row in pre record
2009 l_hist_pre := l_hist_rec;
2010 end if;
2011 Else
2012 IF_ZAP_ELE_ENT(
2013 p_element_entry_id => l_hist_rec.information1,
2014 p_effective_start_date => l_hist_rec.effective_date,
2015 p_pa_history_id => l_hist_rec.pa_history_id,
2016 p_result => l_result);
2017 if l_result then
2018 -- ie can zap the element;
2019
2020 hr_utility.set_location(' ZAP Mode set ' || l_proc, 32);
2021 l_del_mode := hr_api.g_zap;
2022 -- As there is no pre record. copy current row in pre record
2023 l_hist_pre := l_hist_rec;
2024 end if;
2025 End if;
2026 end if;
2027
2028 if l_return_status is null or l_result then
2029 -- ie previous row exists or this is the only row.
2030 delete_element_entry( p_hist_rec => l_hist_pre,
2031 p_del_mode => l_del_mode,
2032 p_cannot_cancel => l_cannot_cancel);
2033 if l_cannot_cancel then
2034 -- raise error
2035 hr_utility.set_location('ERROR: Cannot Cancel'|| l_proc,35);
2036 hr_utility.set_message(8301,'GHR_38212_CANNOT_CANCEL');
2037 hr_utility.raise_error;
2038 else
2039 hr_utility.set_location('Delete rows.'|| l_proc,40);
2040 delete_hist_row ( l_hist_rec.pa_history_id);
2041 delete_eleentval( l_hist_rec);
2042 end if;
2043 else
2044 --Bug#2521744 Added the following code
2045 for element_name_rec in c_element_name(l_hist_rec.information7)
2046 loop
2047 l_element_name := element_name_rec.element_name;
2048 exit;
2049 end loop;
2050 hr_utility.set_location('element_name '||l_element_name,10);
2051 delete_other_pay_entries(p_hist_rec => l_hist_rec,
2052 p_element_name => l_element_name);
2053 --Bug#2521744 testing
2054 end if;
2055 else
2056 hr_utility.set_location('Record was not created.'|| l_proc,45);
2057 null;
2058 end if;
2059 -- Delete history record
2060 delete_hist_row ( l_hist_rec.pa_history_id);
2061
2062 -- PAY_ELEMENT_ENTRY_VALUE needs to be handled differently
2063 elsif lower(l_hist_rec.table_name) = lower (ghr_history_api.g_eleevl_table) then
2064 hr_utility.set_location('Processing element entry value record'|| l_proc,47);
2065 if l_hist_rec.DML_operation = ghr_history_api.g_upd_operation then
2066 hr_utility.set_location('Record was updated' || l_proc,48);
2067 if (l_pre_record = FALSE) then
2068 -- Bug#2521744 Added if condition
2069 for element_name_rec1 in c_element_name1(l_hist_rec.information5)
2070 loop
2071 l_element_name1 := element_name_rec1.element_name;
2072 exit;
2073 end loop;
2074 fnd_profile.get('PER_BUSINESS_GROUP_ID',l_bus_group_id);
2075 l_element_name1 := pqp_fedhr_uspay_int_utils.return_old_element_name
2076 (l_element_name1,l_bus_group_id,l_hist_rec.effective_date);
2077
2078 hr_utility.set_location('element_name '||l_element_name1,10);
2079 IF l_element_name1 IN ('Retention Allowance','Supervisory Differential',
2080 'AUO','Availability Pay','Other Pay') then
2081 hr_utility.set_location('Inside Oth pay elt val condition',15);
2082 NULL;
2083 Else
2084 -- raise error. Must have a pre in order to cancel.
2085 hr_utility.set_location('ERROR: Cannot Cancel'|| l_proc,35);
2086 hr_utility.set_message(8301,'GHR_38212_CANNOT_CANCEL');
2087 hr_utility.raise_error;
2088 End IF;
2089 -- End of Bug#2521744
2090 else
2091 -- get date_effective row from table. See if it is different than the value of the
2092 -- action we are cancelling. If it is different, then there are intervening actions on
2093 -- the same date and the update should not be applied to pay_element_entry_values_f table.
2094 -- If it is the same, then there are no intervening actions on the same date and the
2095 -- update should be applied.
2096 ghr_history_fetch.get_date_eff_eleevl(p_element_entry_value_id => l_hist_pre.information1,
2097 p_date_effective => l_hist_rec.effective_date,
2098 p_element_entry_data => l_date_eff_rec,
2099 p_result_code => l_result_code,
2100 p_pa_history_id => l_pa_history_id);
2101 if l_result_code is not null then
2102 -- this should never be the case
2103 -- raise error.
2104 hr_utility.set_location( l_proc, 50);
2105 hr_utility.set_message(8301,'GHR_38361_ELEMENT_ROW_NFND');
2106 hr_utility.raise_error;
2107 end if;
2108 hr_utility.set_location( 'l_hist_rec.pa_history_id: ' || l_hist_rec.pa_history_id || l_proc, 1150);
2109 hr_utility.set_location( 'l_pa_history_id: ' || l_pa_history_id || l_proc, 1250);
2110 if (l_hist_rec.pa_history_id = l_pa_history_id) then
2111
2112 -- update element_entry_value here.
2113 -- update application table with pre-values
2114 update_eleentval (p_hist_pre => l_hist_pre);
2115 end if;
2116 end if;
2117 end if;
2118 -- Delete history record
2119 delete_hist_row ( l_hist_rec.pa_history_id);
2120 else
2121 hr_utility.set_location('Processing non element entry table'|| l_proc,50);
2122 -- cascade changes thru history table
2123 ghr_history_cascade.cascade_history_data (
2124 p_table_name => l_hist_rec.table_name,
2125 p_person_id => l_hist_rec.person_id,
2126 p_pre_record => l_hist_pre,
2127 p_post_record => l_hist_rec,
2128 p_cascade_type => 'cancel',
2129 p_interv_on_table => l_interv_on_table,
2130 p_interv_on_eff_date => l_interv_on_eff_date,
2131 p_hist_data_as_of_date => l_hist_data_as_of_date);
2132
2133 -- Determine if this record was created or updated.
2134 if l_datetrack_table then
2135 hr_utility.set_location('In Cancel - Date track table' ,1);
2136 if l_hist_rec.DML_operation = ghr_history_api.g_ins_operation then
2137 hr_utility.set_location('in Cancel - DML - Ins' ,1);
2138 l_rec_created_flag := TRUE;
2139
2140 -- if this sf50 updated the row, then the pre must have the same date.
2141 -- The triggers work such that we will only have update from sf50 operation
2142 -- when the effective_date is the same. If the pre has a different effective
2143 -- date, then the original row that was created must have been deleted due to
2144 -- a cancellation. In this case, the current row becomes the row that was created
2145 -- by the sf52. So, we must set the rec_created_flag to true for this row. Note
2146 -- this stands true with date tracked tables only as with non-date tracked tables there
2147 -- is only one row in a record, so this case will never occur.
2148 elsif l_hist_rec.DML_operation = ghr_history_api.g_upd_operation then
2149 hr_utility.set_location('in Cancel - DML - Upd' ,1);
2150 if l_hist_rec.effective_date <> l_hist_pre.effective_date then
2151 l_rec_created_flag := TRUE;
2152 hr_utility.set_location('in Cancel - Created' ,1);
2153 else
2154 l_rec_created_flag := FALSE;
2155 hr_utility.set_location('in Cancel - Not Created' ,1);
2156 end if;
2157 end if;
2158 else
2159 hr_utility.set_location('In Cancel - Not a Date track table' ,1);
2160 l_rec_created_flag := (l_hist_rec.DML_operation = ghr_history_api.g_ins_operation);
2161 end if;
2162
2163 what_to_do(
2164 p_datetrack_table => l_datetrack_table,
2165 p_pre_record_exists => l_pre_record,
2166 p_interv_on_table => l_interv_on_table,
2167 p_interv_on_eff_date => l_interv_on_eff_date,
2168 p_rec_created_flag => l_rec_created_flag,
2169 p_can_delete => l_can_delete,
2170 p_last_row => l_last_row,
2171 p_cannot_cancel => l_cannot_cancel);
2172 If l_interv_on_table then
2173 hr_utility.set_location('what to do' || ' interv on table',1);
2174 else
2175 hr_utility.set_location('what to do ' || 'no interv on table',1);
2176 end if;
2177 If l_interv_on_eff_date then
2178 hr_utility.set_location('what to do' || ' interv on eff',1);
2179 else
2180 hr_utility.set_location('what to do ' || 'no interv on eff' ,1);
2181 end if;
2182
2183 if (l_cannot_cancel = TRUE) then
2184 hr_utility.set_location('ERROR: Cannot cancel'|| l_proc,55);
2185 -- error, cannot cancel
2186 hr_utility.set_message(8301,'GHR_38212_CANNOT_CANCEL');
2187 hr_utility.raise_error;
2188 end if;
2189
2190 -- use flags to determine datetrack_mode, if needed.
2191 -- delete row under conditions outlined below.
2192 l_deleted := FALSE;
2193 l_datetrack_mode := null;
2194 if (l_can_delete = TRUE) then
2195 hr_utility.set_location('CAN delete'|| l_proc,60);
2196 if (l_datetrack_table = TRUE) then
2197 hr_utility.set_location('Datetrack table'|| l_proc,65);
2198 if (l_pre_record = FALSE and l_last_row = TRUE) then
2199 hr_utility.set_location('Only Row'|| l_proc,70);
2200 l_datetrack_mode := hr_api.g_zap;
2201 else
2202 hr_utility.set_location('Not Only Row'|| l_proc,75);
2203 l_datetrack_mode := hr_api.g_delete_next_change;
2204
2205 end if;
2206 end if;
2207 hr_utility.set_location('after what to do Del Mode ' || l_datetrack_mode,1);
2208 -- only do the delete if this is a datetrack table or if it is the only row of a
2209 -- non datetrack table. In all other cases, cascade will properly handle it.
2210
2211 if (l_datetrack_table = TRUE or (l_last_row = TRUE and l_pre_record = FALSE)) then
2212 hr_utility.set_location('Deleting Application row'|| l_proc,80);
2213 l_deleted := TRUE;
2214 delete_appl_row( p_table_name => l_hist_rec.table_name,
2215 p_table_pk_id => l_hist_rec.information1,
2216 p_dt_mode => l_datetrack_mode,
2217 p_date_effective => l_hist_rec.effective_date);
2218 hr_utility.set_location('Hist Rec Eff . Date ' || l_hist_rec.effective_date,1);
2219
2220 end if;
2221 end if;
2222 -- Delete history record
2223 delete_hist_row ( l_hist_rec.pa_history_id);
2224 -- cascade changes thru application table, if the application table record was not already deleted above.
2225 if (l_deleted = FALSE)
2226 or (l_datetrack_mode = hr_api.g_delete_next_change) then
2227 if (l_deleted = FALSE) then
2228 hr_utility.set_location('deleted is false : Bef cascade appl_table',1);
2229 else
2230
2231 hr_utility.set_location('delete next change : Bef cascade appl_table',1);
2232 end if;
2233 -- Sundar Bug#2872298 Cascade should not occur if records are already deleted and
2234 -- delete mode in DELETE_NEXT_CHANGE
2235 IF (l_deleted = TRUE) AND (l_datetrack_mode = hr_api.g_delete_next_change) --AND (p_sf52_data.second_noa_code = '790')
2236 THEN
2237 NULL;
2238 ELSE
2239 --5900178
2240 l_rec_exists := TRUE;
2241 IF l_hist_rec.table_name = 'PER_PERSON_ANALYSES' THEN
2242 hr_utility.set_location('In per_person_analyses record checking',997);
2243 OPEN chk_perana_exists(p_person_analysis_id => l_hist_rec.information1);
2244 FETCH chk_perana_exists into m_perana;
2245 IF chk_perana_exists%NOTFOUND THEN
2246 hr_utility.set_location('In per_person_analyses record checking--notfound',996);
2247 l_rec_exists := FALSE;
2248 END IF;
2249 CLOSE chk_perana_exists;
2250 END IF;
2251
2252 IF l_rec_exists THEN
2253 ghr_history_cascade.cascade_appl_table_data (
2254 p_table_name => l_hist_rec.table_name,
2255 p_person_id => l_hist_rec.person_id,
2256 p_pre_record => l_hist_pre,
2257 p_post_record => l_hist_rec,
2258 p_cascade_type => 'cancel',
2259 p_interv_on_table => l_interv_on_table,
2260 p_interv_on_eff_date => l_interv_on_eff_date,
2261 p_hist_data_as_of_date => l_hist_data_as_of_date);
2262 END IF;
2263 END IF;
2264
2265 end if;
2266 end if;
2267 END LOOP;
2268 hr_utility.set_location('Exited Loop'|| l_proc,85);
2269
2270 ghr_agency_update.ghr_agency_upd(
2271 p_pa_request_rec => l_sf52_data,
2272 p_asg_sf52 => l_imm_asg_sf52,
2273 p_asg_non_sf52 => l_imm_asg_non_sf52,
2274 p_asg_nte_dates => l_imm_asg_nte_dates,
2275 p_per_sf52 => l_imm_per_sf52,
2276 p_per_group1 => l_imm_per_group1,
2277 p_per_group2 => l_imm_per_group2,
2278 p_per_scd_info => l_imm_per_scd_info,
2279 p_per_retained_grade => l_imm_per_retained_grade,
2280 p_per_probations => l_imm_per_probations,
2281 p_per_sep_Retire => l_imm_per_sep_retire,
2282 p_per_security => l_imm_per_security,
2283 p_per_conversions => l_imm_per_conversions,
2284 p_per_uniformed_services => l_imm_per_uniformed_services,
2285 p_pos_oblig => l_imm_pos_oblig,
2286 p_pos_grp2 => l_imm_pos_grp2,
2287 p_pos_grp1 => l_imm_pos_grp1,
2288 p_pos_valid_grade => l_imm_pos_valid_grade,
2289 p_pos_car_prog => l_imm_pos_car_prog,
2290 p_loc_info => l_imm_loc_info,
2291 p_wgi => l_imm_wgi,
2292 p_recruitment_bonus => l_imm_recruitment_bonus,
2293 p_relocation_bonus => l_imm_relocation_bonus ,
2294 p_sf52_from_data => l_imm_sf52_from_data,
2295 p_personal_info => l_imm_personal_info,
2296 p_gov_awards_type => l_imm_gov_awards,
2297 p_perf_appraisal_type => l_imm_perf_appraisal,
2298 p_payroll_type => l_imm_payroll_type,
2299 p_conduct_perf_type => l_imm_conduct_performance,
2300 p_agency_code => l_agency_code,
2301 p_agency_sf52 => l_imm_agency_sf52,
2302 p_entitlement => l_imm_entitlement,
2303 p_foreign_lang_prof_pay => l_imm_foreign_lang_prof_pay,
2304 p_edp_pay => l_imm_edp_pay,
2305 p_hazard_pay => l_imm_hazard_pay,
2306 p_health_benefits => l_imm_health_benefits,
2307 p_danger_pay => l_imm_danger_pay,
2308 p_imminent_danger_pay => l_imm_imminent_danger_pay,
2309 p_living_quarters_allow => l_imm_living_quarters_allow,
2310 p_post_diff_amt => l_imm_post_diff_amt,
2311 p_post_diff_percent => l_imm_post_diff_percent,
2312 p_sep_maintenance_allow => l_imm_sep_maintenance_allow,
2313 p_supplemental_post_allow => l_imm_supplemental_post_allow,
2314 p_temp_lodge_allow => l_imm_temp_lodge_allow,
2315 p_premium_pay => l_imm_premium_pay,
2316 p_retirement_annuity => l_imm_retirement_annuity,
2317 p_severance_pay => l_imm_severance_pay,
2318 p_thrift_saving_plan => l_imm_thrift_saving_plan,
2319 p_retention_allow_review => l_imm_retention_allow_review,
2320 p_health_ben_pre_tax => l_imm_health_ben_pre_tax,
2321 p_per_benefit_info => l_imm_per_benefit_info,
2322 p_imm_retirement_info => l_imm_retirement_info); --Bug# 7131104
2323
2324 -- call post_sf52_cancel to handle notifications, marking pa_requests cancelled, etc.
2325 ghr_sf52_post_update.post_sf52_cancel(
2326 p_pa_request_id => p_sf52_data.pa_request_id,
2327 p_effective_date => l_session_var.date_effective,
2328 p_object_version_number => p_sf52_data.object_version_number,
2329 p_from_position_id => p_sf52_data.from_position_id,
2330 p_to_position_id => p_sf52_data.to_position_id,
2331 p_agency_code => p_sf52_data.agency_code);
2332
2333 hr_utility.set_location( l_proc, 90);
2334 Undo_Mark_Cancel ( p_sf52_data => p_sf52_data);
2335 hr_utility.set_location( 'Leaving ' || l_proc, 100);
2336 End if;
2337 Exception when others then
2338 --
2339 -- Reset IN OUT parameters and set OUT parameters
2340 --
2341 p_sf52_data := l_sf52_data_rec;
2342 raise;
2343
2344 END Cancel_Other_Family_Sf52 ;
2345
2346 -- ---------------------------------------------------------------------------
2347 -- |--------------------------< correction_sf52>------------------------------|
2348 -- ---------------------------------------------------------------------------
2349 -- {Start Of Comments}
2350 --
2351 -- Description:
2352 -- This procedure handles a correction sf52.
2353 --
2354 -- Pre-Requisities:
2355 -- None.
2356 --
2357 -- In Parameters:
2358 -- p_sf52_data -> ghr_pa_requests record of the correction sf52.
2359 -- Post Success:
2360 -- The correction will have been applied.
2361 --
2362 -- Post Failure:
2363 -- No failure conditions.
2364 --
2365 -- Developer Implementation Notes:
2366 -- None.
2367 --
2368 -- Access Status:
2369 -- Internal Development Use Only.
2370 --
2371 -- {End Of Comments}
2372 -- ---------------------------------------------------------------------------
2373
2374 -- This is a sf52 wrapper procedure. It gets the sf52 and the sf52 extra info
2375 -- record and calls db_update procedures.
2376 Procedure correction_sf52( p_sf52_data in ghr_pa_requests%rowtype,
2377 p_process_type in varchar2 default 'CURRENT',
2378 p_capped_other_pay in number default null ) is
2379
2380 l_sf52_data_result ghr_pa_requests%rowtype;
2381 l_sf52 ghr_pa_requests%rowtype;
2382 l_root_sf52 ghr_pa_requests%rowtype;
2383
2384 l_pa_request_id number;
2385 l_today date :=sysdate;
2386 l_session_var ghr_history_api.g_session_var_type;
2387 l_sf52_ei_data ghr_pa_request_extra_info%rowtype;
2388 l_agency_ei_data ghr_pa_request_extra_info%rowtype;
2389 l_sf52_data ghr_pa_requests%rowtype;
2390 l_sf52_data1 ghr_pa_requests%rowtype;
2391 l_shadow_data ghr_pa_request_shadow%rowtype;
2392 l_result varchar2(1000);
2393
2394 -- this cursor gets the noa_family_code for noa_id (nature of action ID) passed.
2395 cursor c_fam (c_noa_id number) is
2396 select
2397 fams.noa_family_code
2398 from ghr_noa_families noafam,
2399 ghr_families fams
2400 where noafam.nature_of_action_id = c_noa_id and
2401 noafam.enabled_flag = 'Y' and
2402 fams.noa_family_code = noafam.noa_family_code and
2403 fams.enabled_flag = 'Y' and
2404 fams.update_hr_flag = 'Y';
2405
2406 cursor c_get_root (c_pa_request_id in number) is
2407 select *
2408 from ghr_pa_requests
2409 connect by pa_request_id = prior altered_pa_request_id
2410 start with pa_request_id = c_pa_request_id
2411 order by level desc;
2412
2413 cursor c_get_hist_id (c_pa_request_id in number) is
2414 select
2415 min(pa_history_id)
2416 from ghr_pa_history
2417 where pa_request_id = c_pa_request_id;
2418
2419 cursor get_shadow (c_pa_request_id in number) is
2420 select *
2421 from ghr_pa_request_shadow
2422 where pa_request_id = c_pa_request_id;
2423
2424 l_proc varchar2(30):='correction_sf52';
2425 l_people_data per_all_people_f%rowtype;
2426
2427 Procedure Refresh_Cascade_Name( p_sf52_rec in out nocopy ghr_pa_requests%rowtype,
2428 p_shadow_rec in out nocopy ghr_pa_request_shadow%rowtype) is
2429
2430 l_result_code varchar2(30);
2431 l_people_data per_all_people_f%rowtype;
2432 l_hist_id number;
2433 l_proc varchar2(40):='Refresh_Cascade_Name';
2434 l_capped_other_pay number := hr_api.g_number;
2435
2436 cursor get_hist is
2437 select pa_history_id
2438 from ghr_pa_history
2439 where pa_request_id = p_sf52_rec.altered_pa_request_id and
2440 nature_of_action_id = p_sf52_rec.second_noa_id;
2441
2442 l_sf52_rec ghr_pa_requests%rowtype;
2443 l_shadow_rec ghr_pa_request_shadow%rowtype;
2444 Begin
2445
2446 hr_utility.set_location( 'Entering ' || l_proc, 10);
2447 l_sf52_rec := p_sf52_rec;
2448 l_shadow_rec := p_shadow_rec;
2449
2450 open get_hist;
2451 fetch get_hist into l_hist_id;
2452 close get_hist;
2453 hr_utility.set_location( 'Fetched Hist id' || l_proc, 15);
2454
2455 ghr_history_fetch.fetch_people(
2456 p_person_id => p_sf52_data.person_id,
2457 p_date_effective => p_sf52_data.effective_date,
2458 p_pa_history_id => l_hist_id,
2459 p_altered_pa_request_id => p_sf52_data.altered_pa_request_id,
2460 p_noa_id_corrected => p_sf52_data.second_noa_id,
2461 p_people_data => l_people_data,
2462 p_result_code => l_result_code
2463 );
2464
2465 if l_result_code is NULL then
2466 hr_utility.set_location( 'People Data Found' || l_proc, 20);
2467
2468 if nvl(p_sf52_rec.employee_first_name, hr_api.g_varchar2) = nvl(p_shadow_rec.employee_first_name , hr_api.g_varchar2) and
2469 nvl(p_sf52_rec.employee_last_name , hr_api.g_varchar2) = nvl(p_shadow_rec.employee_last_name , hr_api.g_varchar2) and
2470 nvl(p_sf52_rec.employee_middle_names,hr_api.g_varchar2) = nvl(p_shadow_rec.employee_middle_names, hr_api.g_varchar2) then
2471
2472 hr_utility.set_location( 'Refresh Name ' || l_proc, 30);
2473 p_sf52_rec.employee_first_name := l_people_data.first_name;
2474 p_sf52_rec.employee_last_name := l_people_data.last_name;
2475 p_sf52_rec.employee_middle_names := l_people_data.middle_names;
2476
2477 p_shadow_rec.employee_first_name := l_people_data.first_name;
2478 p_shadow_rec.employee_last_name := l_people_data.last_name;
2479 p_shadow_rec.employee_middle_names := l_people_data.middle_names;
2480 end if;
2481
2482 hr_utility.set_location( 'Check SSN ' || l_proc, 35);
2483 if nvl(p_sf52_rec.employee_national_identifier, hr_api.g_varchar2) = nvl(p_shadow_rec.employee_national_identifier, hr_api.g_varchar2) then
2484 hr_utility.set_location( 'Refresh SSN ' || l_proc, 40);
2485 p_sf52_rec.employee_national_identifier := l_people_data.national_identifier;
2486 hr_utility.set_location( 'Refresh SSN ' || l_proc, 41);
2487 p_shadow_rec.employee_national_identifier := l_people_data.national_identifier;
2488 end if;
2489
2490 hr_utility.set_location( 'check DOB ' || l_proc, 45);
2491 if nvl(p_sf52_rec.employee_date_of_birth, hr_api.g_date) = nvl(p_shadow_rec.employee_date_of_birth, hr_api.g_date) then
2492 hr_utility.set_location( 'Refresh DOB ' || l_proc, 50);
2493 p_sf52_rec.employee_date_of_birth := l_people_data.date_of_birth;
2494 hr_utility.set_location( 'Refresh DOB ' || l_proc, 51);
2495 p_shadow_rec.employee_date_of_birth := l_people_data.date_of_birth;
2496 end if;
2497
2498 end if;
2499 hr_utility.set_location( 'Leaving ' || l_proc, 100);
2500 Exception when others then
2501 --
2502 -- Reset IN OUT parameters and set OUT parameters
2503 --
2504 p_sf52_rec := l_sf52_rec;
2505 p_shadow_rec := l_shadow_rec;
2506 raise;
2507
2508 End;
2509
2510 begin
2511
2512 hr_utility.set_location('Entering:'|| l_proc, 5);
2513 -- reinitialise session variables
2514 ghr_history_api.reinit_g_session_var;
2515
2516 -- set values of session variables
2517 l_session_var.pa_request_id := p_sf52_data.pa_request_id;
2518 l_session_var.noa_id := p_sf52_data.second_noa_id;
2519 l_session_var.fire_trigger := 'Y';
2520 l_session_var.date_Effective := p_sf52_data.effective_date;
2521 l_session_var.person_id := p_sf52_data.person_id;
2522 l_session_var.program_name := 'sf50';
2523 l_session_var.altered_pa_request_id := p_sf52_data.altered_pa_request_id;
2524 l_session_var.noa_id_correct := p_sf52_data.second_noa_id;
2525 l_session_var.assignment_id := p_sf52_data.employee_assignment_id;
2526 ghr_history_api.set_g_session_var(l_session_var);
2527
2528
2529 -- .47
2530
2531 -- Refresh Correction and shadow for Employee Name
2532 open get_shadow( p_sf52_data.pa_request_id);
2533 fetch get_shadow into l_shadow_data;
2534 close get_shadow;
2535
2536 l_sf52_data := p_sf52_data;
2537 IF (l_sf52_data.second_noa_code <> '780') then
2538 Refresh_Cascade_Name( p_sf52_rec => l_sf52_data,
2539 p_shadow_rec => l_shadow_data);
2540
2541 ghr_process_sf52.update_rfrs_values(p_sf52_data => l_sf52_data,
2542 p_shadow_data => l_shadow_data);
2543 END IF;
2544
2545 l_sf52_data1 := l_sf52_data;
2546 -- .47
2547
2548 /* .47
2549 -- get root sf52 for this correction
2550 hr_utility.set_location(l_proc, 102);
2551 open c_get_root (p_sf52_data.altered_pa_request_id);
2552 fetch c_get_root into l_root_sf52;
2553 if c_get_root%notfound then
2554 hr_utility.set_location(l_proc, 103);
2555 close c_get_root ;
2556 hr_utility.set_message(8301,'GHR_38493_ROOT_SF52_NFND');
2557 hr_utility.raise_error;
2558 else
2559 close c_get_root ;
2560 end if;
2561
2562 -- refresh root sf52 and its correction
2563 -- get pa_history_id for the root pa_request_id
2564 open c_get_hist_id( l_root_sf52.pa_request_id);
2565 fetch c_get_hist_id into l_session_var.pa_history_id;
2566 if c_get_hist_id%notfound then
2567 -- raise error;
2568 close c_get_hist_id;
2569 else
2570 close c_get_hist_id;
2571 end if;
2572 -- We are setting pa_history_id in session var to be able to fetch
2573 -- Pre-record values of the root SF52 for refresh purpose.
2574 -- It'll be reset after refresh has been done
2575
2576 ghr_history_api.set_g_session_var(l_session_var);
2577 ghr_process_sf52.refresh_req_shadow(p_sf52_data => l_root_sf52,
2578 p_shadow_data => l_shadow_data);
2579 ghr_process_sf52.redo_pay_calc( p_sf52_rec => l_root_sf52);
2580 ghr_process_sf52.update_rfrs_values(p_sf52_data => l_root_sf52,
2581 p_shadow_data => l_shadow_data);
2582
2583 -- reset pa_history_id in session variable.
2584 l_session_var.pa_history_id := null;
2585 ghr_history_api.set_g_session_var(l_session_var);
2586
2587 -- .47
2588 */
2589
2590
2591 -- fetch the noa_family_code for the original noa in the correction chain; second_noa_id contains the
2592 -- noa_id of the original noa in the chain).
2593 open c_fam(l_sf52_data.second_noa_id);
2594 fetch c_fam into l_sf52_data.noa_family_code;
2595 if c_fam%NOTFOUND then
2596 close c_fam;
2597 hr_utility.set_message(8301,'GHR_38211_NOA_FAMILY_NOTFOUND');
2598 hr_utility.raise_error;
2599 end if;
2600 close c_fam;
2601
2602
2603 -- build up the sf52_data record by calling apply_noa_corrections.
2604 -- when this completes, l_sf52_data_result will contain the data of the original
2605 -- sf52, with all corrections in the correction chain applied onto it.
2606 -- apply_noa_corrections ensures that name/dob/ssn are retained from the last correction ie the one being processed.
2607 hr_utility.set_location('from_step_or_rate right before apply_noa_corrections: '|| l_sf52_data.from_step_or_rate || l_proc, 915);
2608 ghr_process_sf52.print_sf52(' l_sf52_data before apply_noa ',l_sf52_data);
2609 ghr_process_sf52.print_sf52(' l_sf52_data_result before apply_noa ',l_sf52_data_result);
2610 apply_noa_corrections( l_sf52_data, l_sf52_data_result );
2611 ghr_process_sf52.print_sf52(' l_sf52_data after apply_noa ',l_sf52_data);
2612 ghr_process_sf52.print_sf52(' l_sf52_data_result after apply_noa ',l_sf52_data_result);
2613
2614 ghr_process_Sf52.Fetch_extra_info(
2615 p_pa_request_id => l_sf52_data.pa_request_id,
2616 p_noa_id => l_sf52_data.second_noa_id,
2617 p_sf52_ei_data => l_sf52_ei_data,
2618 p_result => l_result);
2619
2620 ghr_process_Sf52.Fetch_extra_info(
2621 p_pa_request_id => l_sf52_data.pa_request_id,
2622 p_noa_id => l_sf52_data.second_noa_id,
2623 p_agency_ei => TRUE,
2624 p_sf52_ei_data => l_agency_ei_data,
2625 p_result => l_result);
2626
2627 -- check for future action
2628 hr_utility.set_location('national_identifier right before update sf52: '|| l_sf52_data_result.employee_national_identifier || l_proc, 915);
2629 hr_utility.set_location('from_step_or_rate right before update sf52: '|| l_sf52_data_result.from_step_or_rate || l_proc, 915);
2630 hr_utility.set_location('to_step_or_rate right before update sf52: '|| l_sf52_data_result.to_step_or_rate || l_proc, 915);
2631
2632 ghr_history_api.display_g_session_var;
2633 -- Check if atleast the min. required items exist in the pa_request
2634 ghr_sf52_validn_pkg.prelim_req_chk_for_update_hr(p_pa_request_rec => l_sf52_data_result);
2635 if (l_session_var.date_Effective > l_today) then
2636 -- issue savepoint
2637 savepoint single_Action_sf52;
2638
2639 ghr_sf52_update.main( p_pa_request_rec => l_sf52_data_result,
2640 p_pa_request_ei_rec => l_sf52_ei_data,
2641 p_generic_ei_rec => l_agency_ei_data,
2642 p_capped_other_pay => p_capped_other_pay);
2643 -- rollback to savepoint
2644 rollback to single_action_sf52;
2645 else
2646 --RP
2647 ghr_sf52_update.main( p_pa_request_rec => l_sf52_data_result,
2648 p_pa_request_ei_rec => l_sf52_ei_data,
2649 p_generic_ei_rec => l_agency_ei_data,
2650 p_capped_other_pay => p_capped_other_pay);
2651 hr_utility.set_location('to_position_id right before update sf52: '|| l_sf52_data_result.to_position_id || l_proc, 915);
2652 hr_utility.set_location('After main update :'|| l_proc, 20);
2653 ghr_sf52_post_update.Post_sf52_process(
2654 p_pa_request_id => p_sf52_data.pa_request_id,
2655 p_effective_date => l_session_var.date_effective,
2656 p_object_version_number => l_sf52_data1.object_version_number,
2657 p_from_position_id => l_sf52_data_result.from_position_id,
2658 p_to_position_id => l_sf52_data_result.to_position_id,
2659 p_agency_code => l_sf52_data_result.agency_code,
2660 p_sf52_data_result => l_sf52_data_result,
2661 p_called_from => 'CORRECTION_SF52'
2662 );
2663
2664 end if;
2665 hr_utility.set_location(' Leaving:'||l_proc, 10);
2666 end correction_sf52;
2667
2668 -- ---------------------------------------------------------------------------
2669 -- |--------------------------< delete_hist_row>------------------------------|
2670 -- ---------------------------------------------------------------------------
2671 -- {Start Of Comments}
2672 --
2673 -- Description:
2674 -- This procedure deletes a row in ghr_pa_history for the rowid passed.
2675 --
2676 -- Pre-Requisities:
2677 -- None.
2678 --
2679 -- In Parameters:
2680 -- p_row_id -> rowid of the row to be deleted in
2681 -- ghr_pa_history.
2682 -- Post Success:
2683 -- The row will have been deleted.
2684 --
2685 -- Post Failure:
2686 -- No failure conditions.
2687 --
2688 -- Developer Implementation Notes:
2689 -- None.
2690 --
2691 -- Access Status:
2692 -- Internal Development Use Only.
2693 --
2694 -- {End Of Comments}
2695 -- ---------------------------------------------------------------------------
2696
2697 Procedure delete_hist_row ( p_row_id in rowid) is
2698 l_proc varchar2(30):='delete_hist_row';
2699 Begin
2700 hr_utility.set_location( 'Entering : ' || l_proc, 10);
2701 delete ghr_pa_history
2702 where rowid = p_row_id;
2703 hr_utility.set_location( 'Leaving : ' || l_proc, 20);
2704 End delete_hist_row;
2705
2706 -- ---------------------------------------------------------------------------
2707 -- |--------------------------< delete_hist_row>------------------------------|
2708 -- ---------------------------------------------------------------------------
2709 -- {Start Of Comments}
2710 --
2711 -- Description:
2712 -- This procedure deletes a row in ghr_pa_history for the pa_history_id passed.
2713 --
2714 -- Pre-Requisities:
2715 -- None.
2716 --
2717 -- In Parameters:
2718 -- p_pa_history_id -> pa_history_id
2719 -- of the row to be deleted in ghr_pa_history.
2720 -- Post Success:
2721 -- The row will have been deleted.
2722 --
2723 -- Post Failure:
2724 -- No failure conditions.
2725 --
2726 -- Developer Implementation Notes:
2727 -- None.
2728 --
2729 -- Access Status:
2730 -- Internal Development Use Only.
2731 --
2732 -- {End Of Comments}
2733 -- ---------------------------------------------------------------------------
2734
2735 Procedure delete_hist_row ( p_pa_history_id in ghr_pa_history.pa_history_id%type) is
2736 l_proc varchar2(30):='delete_hist_row';
2737 Begin
2738 hr_utility.set_location( 'Entering : ' || l_proc, 30);
2739 delete ghr_pa_history
2740 where pa_history_id = p_pa_history_id;
2741 hr_utility.set_location( 'Leaving : ' || l_proc, 40);
2742 End delete_hist_row;
2743
2744 -- ---------------------------------------------------------------------------
2745 -- |--------------------------< apply_correction>-----------------------------|
2746 -- ---------------------------------------------------------------------------
2747 -- {Start Of Comments}
2748 --
2749 -- Description:
2750 -- This procedure applies a correction by copying the fields from the
2751 -- p_sf52rec_correct record to p_sf52rec record and puts the result in
2752 -- sf52rec_result.
2753 --
2754 -- Pre-Requisities:
2755 -- None.
2756 --
2757 -- In Parameters:
2758 -- p_sf52_rec_correct -> the ghr_pa_requests record that we are
2759 -- copying from.
2760 -- p_corr_pa_request_id -> the pa_request_id of the correction
2761 -- that is currently being processed.
2762 -- p_sf52rec -> results of the applied correction are put
2763 -- here.
2764 -- Post Success:
2765 -- The correction will have been applied and the result put in p_sf52rec.
2766 --
2767 -- Post Failure:
2768 -- No failure conditions.
2769 --
2770 -- Developer Implementation Notes:
2771 -- Note that a lot of thought went into determining which fields should be copied and
2772 -- which fields should not be copied. (Need to re-visit this comment to put in details of
2773 -- why certain fields were included and others not included).
2774 --
2775 -- Access Status:
2776 -- Internal Development Use Only.
2777 --
2778 -- {End Of Comments}
2779 -- ---------------------------------------------------------------------------
2780
2781 -- This procedure copies the fields from the p_sf52rec_correct record to
2782 -- p_sf52rec record and puts te result in sf52rec_result.
2783 PROCEDURE apply_correction (
2784 p_sf52rec_correct in ghr_pa_requests%rowtype,
2785 p_corr_pa_request_id in ghr_pa_requests.pa_request_id%type,
2786 p_sf52rec in out nocopy ghr_pa_requests%rowtype ) is
2787
2788 l_proc varchar2(30):='apply_correction';
2789 l_sf52rec ghr_pa_requests%rowtype;
2790
2791 -- Begin Bug# 5014663
2792 l_asg_ei_data per_assignment_extra_info%rowtype;
2793 l_award_salary number;
2794 l_temp_award_amount number;
2795 -- End Bug# 5014663
2796 BEGIN
2797 hr_utility.set_location('Entering:'|| l_proc, 5);
2798 l_sf52rec := p_sf52rec;
2799 hr_utility.set_location('pre par: rec_correct pa_request id=' || p_sf52rec_correct.pa_request_id,6);
2800 hr_utility.set_location('pre par: rec pa_request id=' || p_sf52rec.pa_request_id,7);
2801 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.pa_request_id , p_sf52rec.pa_request_id );
2802 hr_utility.set_location('post par: rec_correct pa_request id=' || p_sf52rec_correct.pa_request_id,6);
2803 hr_utility.set_location('post par: rec pa_request id=' || p_sf52rec.pa_request_id,7);
2804 -- the following two fields are not filled in because they are derived.
2805 -- ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.pa_notification_id , p_sf52rec.pa_notification_id );
2806 -- ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.noa_family_code , p_sf52rec.noa_family_code );
2807 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.academic_discipline , p_sf52rec.academic_discipline );
2808 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.agency_code , p_sf52rec.agency_code );
2809 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.altered_pa_request_id , p_sf52rec.altered_pa_request_id );
2810 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.annuitant_indicator , p_sf52rec.annuitant_indicator );
2811 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.annuitant_indicator_desc , p_sf52rec.annuitant_indicator_desc );
2812 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.appropriation_code1 , p_sf52rec.appropriation_code1 );
2813 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.appropriation_code2 , p_sf52rec.appropriation_code2 );
2814 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.approval_date , p_sf52rec.approval_date );
2815 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.approving_official_work_title , p_sf52rec.approving_official_work_title );
2816 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.award_uom , p_sf52rec.award_uom );
2817 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.bargaining_unit_status , p_sf52rec.bargaining_unit_status );
2818 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.citizenship , p_sf52rec.citizenship );
2819 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.duty_station_code , p_sf52rec.duty_station_code );
2820 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.duty_station_desc , p_sf52rec.duty_station_desc );
2821 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.duty_station_id , p_sf52rec.duty_station_id );
2822 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.duty_station_location_id , p_sf52rec.duty_station_location_id );
2823 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.education_level , p_sf52rec.education_level );
2824 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.effective_date , p_sf52rec.effective_date );
2825 hr_utility.set_location('pre: rec_correct assignment id=' || p_sf52rec_correct.employee_assignment_id,6);
2826 hr_utility.set_location('pre: rec assignment id=' || p_sf52rec.employee_assignment_id,7);
2827 hr_utility.set_location('pre: rec_correct pa_request id=' || p_sf52rec_correct.pa_request_id,6);
2828 hr_utility.set_location('pre: rec pa_request id=' || p_sf52rec.pa_request_id,7);
2829 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.employee_assignment_id , p_sf52rec.employee_assignment_id );
2830 hr_utility.set_location('post: rec_correct assignment id=' || p_sf52rec_correct.employee_assignment_id,8);
2831 hr_utility.set_location('post: rec assignment id=' || p_sf52rec.employee_assignment_id,9);
2832 hr_utility.set_location('post: rec_correct pa_request id=' || p_sf52rec_correct.pa_request_id,6);
2833 hr_utility.set_location('post: rec pa_request id=' || p_sf52rec.pa_request_id,7);
2834 hr_utility.set_location('post: national_identifier=' || p_sf52rec.employee_national_identifier,7);
2835 hr_utility.set_location('post: reccorrect national_identifier =' || p_sf52rec_correct.employee_national_identifier,7);
2836 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.employee_date_of_birth , p_sf52rec.employee_date_of_birth );
2837 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.employee_dept_or_agency , p_sf52rec.employee_dept_or_agency );
2838 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.employee_first_name , p_sf52rec.employee_first_name );
2839 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.employee_last_name , p_sf52rec.employee_last_name );
2840 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.employee_middle_names , p_sf52rec.employee_middle_names );
2841 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.employee_national_identifier , p_sf52rec.employee_national_identifier );
2842 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.fegli , p_sf52rec.fegli );
2843 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.fegli_desc , p_sf52rec.fegli_desc );
2844 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_action_la_code1 , p_sf52rec.first_action_la_code1 );
2845 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_action_la_code2 , p_sf52rec.first_action_la_code2 );
2846 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_action_la_desc1 , p_sf52rec.first_action_la_desc1 );
2847 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_action_la_desc2 , p_sf52rec.first_action_la_desc2 );
2848 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_noa_cancel_or_correct , p_sf52rec.first_noa_cancel_or_correct );
2849 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_noa_code , p_sf52rec.first_noa_code );
2850 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_noa_desc , p_sf52rec.first_noa_desc );
2851 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_noa_id , p_sf52rec.first_noa_id );
2852 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_noa_pa_request_id , p_sf52rec.first_noa_pa_request_id );
2853 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.flsa_category , p_sf52rec.flsa_category );
2854 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.forwarding_address_line1 , p_sf52rec.forwarding_address_line1 );
2855 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.forwarding_address_line2 , p_sf52rec.forwarding_address_line2 );
2856 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.forwarding_address_line3 , p_sf52rec.forwarding_address_line3 );
2857 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.forwarding_country , p_sf52rec.forwarding_country );
2858 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.forwarding_postal_code , p_sf52rec.forwarding_postal_code );
2859 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.forwarding_region_2 , p_sf52rec.forwarding_region_2 );
2860 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.forwarding_town_or_city , p_sf52rec.forwarding_town_or_city );
2861 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_adj_basic_pay , p_sf52rec.from_adj_basic_pay );
2862 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_position_org_line1 , p_sf52rec.from_position_org_line1 );
2863 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_agency_code , p_sf52rec.from_agency_code );
2864 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_agency_desc , p_sf52rec.from_agency_desc );
2865 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_basic_pay , p_sf52rec.from_basic_pay );
2866 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_grade_or_level , p_sf52rec.from_grade_or_level );
2867 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_locality_adj , p_sf52rec.from_locality_adj );
2868 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_occ_code , p_sf52rec.from_occ_code );
2869 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_office_symbol , p_sf52rec.from_office_symbol );
2870 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_other_pay_amount , p_sf52rec.from_other_pay_amount );
2871 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_pay_basis , p_sf52rec.from_pay_basis );
2872 hr_utility.set_location('correct ' || p_sf52rec_correct.from_pay_plan,1);
2873 hr_utility.set_location('sf52rec ' || p_sf52rec.from_pay_plan,1);
2874 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_pay_plan , p_sf52rec.from_pay_plan );
2875 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_position_id , p_sf52rec.from_position_id );
2876 -- this is informational only and is not needed
2877 -- ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_position_name , p_sf52rec.from_position_name );
2878 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_position_number , p_sf52rec.from_position_number );
2879 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_position_seq_no , p_sf52rec.from_position_seq_no );
2880 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_position_title , p_sf52rec.from_position_title );
2881 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_step_or_rate , p_sf52rec.from_step_or_rate );
2882 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.from_total_salary , p_sf52rec.from_total_salary );
2883 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.functional_class , p_sf52rec.functional_class );
2884 -- Bug#4694896
2885 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.input_pay_rate_determinant , p_sf52rec.input_pay_rate_determinant );
2886 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.pay_rate_determinant , p_sf52rec.pay_rate_determinant );
2887 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.personnel_office_id , p_sf52rec.personnel_office_id );
2888 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.person_id , p_sf52rec.person_id );
2889 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.position_occupied , p_sf52rec.position_occupied );
2890 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.resign_and_retire_reason_desc , p_sf52rec.resign_and_retire_reason_desc );
2891 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.retirement_plan , p_sf52rec.retirement_plan );
2892 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.retirement_plan_desc , p_sf52rec.retirement_plan_desc );
2893 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.service_comp_date , p_sf52rec.service_comp_date );
2894 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.supervisory_status , p_sf52rec.supervisory_status );
2895 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.tenure , p_sf52rec.tenure );
2896 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_grade_id , p_sf52rec.to_grade_id );
2897 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_office_symbol , p_sf52rec.to_office_symbol );
2898 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_job_id , p_sf52rec.to_job_id );
2899 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_occ_code , p_sf52rec.to_occ_code );
2900
2901 -- this is informational only and is not needed
2902 -- ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_position_name , p_sf52rec.to_position_name );
2903 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_step_or_rate , p_sf52rec.to_step_or_rate );
2904 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_total_salary , p_sf52rec.to_total_salary );
2905 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_other_pay_amount , p_sf52rec.to_other_pay_amount );
2906 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_availability_pay , p_sf52rec.to_availability_pay );
2907 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_ap_premium_pay_indicator , p_sf52rec.to_ap_premium_pay_indicator );
2908 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_auo_premium_pay_indicator , p_sf52rec.to_auo_premium_pay_indicator );
2909 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_au_overtime , p_sf52rec.to_au_overtime );
2910 --VSM .49
2911 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_basic_pay , p_sf52rec.to_basic_pay );
2912 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_locality_adj , p_sf52rec.to_locality_adj );
2913 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_adj_basic_pay , p_sf52rec.to_adj_basic_pay );
2914 -- VSM .49
2915 /*
2916 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_position_org_line1 , p_sf52rec.to_position_org_line1 );
2917 -- Sundar 15Dec2003 Bug 3191676 Copy other orglines too.
2918 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_position_org_line2 , p_sf52rec.to_position_org_line2 );
2919 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_position_org_line3 , p_sf52rec.to_position_org_line3 );
2920 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_position_org_line4 , p_sf52rec.to_position_org_line4 );
2921 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_position_org_line5 , p_sf52rec.to_position_org_line5 );
2922 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.to_position_org_line6 , p_sf52rec.to_position_org_line6 );
2923 -- End Bug 3191676 */
2924 -- Above lines commented by Sundar for Bug 2681726 They've been moved below.
2925 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.veterans_preference , p_sf52rec.veterans_preference );
2926 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.veterans_pref_for_rif , p_sf52rec.veterans_pref_for_rif );
2927 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.veterans_status , p_sf52rec.veterans_status );
2928 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.work_schedule_desc , p_sf52rec.work_schedule_desc );
2929 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.year_degree_attained , p_sf52rec.year_degree_attained );
2930 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_noa_information1 , p_sf52rec.first_noa_information1 );
2931 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_noa_information2 , p_sf52rec.first_noa_information2 );
2932 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_noa_information3 , p_sf52rec.first_noa_information3 );
2933 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_noa_information4 , p_sf52rec.first_noa_information4 );
2934 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_noa_information5 , p_sf52rec.first_noa_information5 );
2935 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_lac1_information1 , p_sf52rec.first_lac1_information1 );
2936 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_lac1_information2 , p_sf52rec.first_lac1_information2 );
2937 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_lac1_information3 , p_sf52rec.first_lac1_information3 );
2938 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_lac1_information4 , p_sf52rec.first_lac1_information4 );
2939 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_lac1_information5 , p_sf52rec.first_lac1_information5 );
2940 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_lac2_information1 , p_sf52rec.first_lac2_information1 );
2941 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_lac2_information2 , p_sf52rec.first_lac2_information2 );
2942 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_lac2_information3 , p_sf52rec.first_lac2_information3 );
2943 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_lac2_information4 , p_sf52rec.first_lac2_information4 );
2944 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.first_lac2_information5 , p_sf52rec.first_lac2_information5 );
2945 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute_category , p_sf52rec.attribute_category );
2946 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute1 , p_sf52rec.attribute1 );
2947 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute2 , p_sf52rec.attribute2 );
2948 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute3 , p_sf52rec.attribute3 );
2949 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute4 , p_sf52rec.attribute4 );
2950 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute5 , p_sf52rec.attribute5 );
2951 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute6 , p_sf52rec.attribute6 );
2952 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute7 , p_sf52rec.attribute7 );
2953 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute8 , p_sf52rec.attribute8 );
2954 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute9 , p_sf52rec.attribute9 );
2955 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute10 , p_sf52rec.attribute10 );
2956 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute11 , p_sf52rec.attribute11 );
2957 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute12 , p_sf52rec.attribute12 );
2958 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute13 , p_sf52rec.attribute13 );
2959 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute14 , p_sf52rec.attribute14 );
2960 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute15 , p_sf52rec.attribute15 );
2961 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute16 , p_sf52rec.attribute16 );
2962 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute17 , p_sf52rec.attribute17 );
2963 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute18 , p_sf52rec.attribute18 );
2964 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute19 , p_sf52rec.attribute19 );
2965 ghr_history_conv_rg.copy_field_value( p_sf52rec_correct.attribute20 , p_sf52rec.attribute20 );
2966
2967
2968 -- the following fields should only be copied if the position_id changed, otherwise original values should be
2969 -- retained.
2970 if ( p_sf52rec_correct.to_position_id is not null ) then
2971 hr_utility.set_location(' Position id changed :'||l_proc, 20);
2972 p_sf52rec.to_position_id := p_sf52rec_correct.to_position_id ;
2973 p_sf52rec.to_organization_id := p_sf52rec_correct.to_organization_id ;
2974 p_sf52rec.to_pay_plan := p_sf52rec_correct.to_pay_plan ;
2975 p_sf52rec.to_position_title := p_sf52rec_correct.to_position_title ;
2976 p_sf52rec.to_position_number := p_sf52rec_correct.to_position_number ;
2977 p_sf52rec.to_position_seq_no := p_sf52rec_correct.to_position_seq_no ;
2978 p_sf52rec.to_grade_or_level := p_sf52rec_correct.to_grade_or_level ;
2979 /*
2980 p_sf52rec.to_basic_pay := p_sf52rec_correct.to_basic_pay ;
2981 p_sf52rec.to_locality_adj := p_sf52rec_correct.to_locality_adj ;
2982 p_sf52rec.to_adj_basic_pay := p_sf52rec_correct.to_adj_basic_pay ;
2983 */
2984 p_sf52rec.to_pay_basis := p_sf52rec_correct.to_pay_basis ;
2985
2986 -- Populating position org lines (Bug# 948208)
2987 -- Bug 3343579 Commented the following IF condition.
2988
2989 -- IF (p_sf52rec.to_position_org_line1 IS NULL) THEN
2990 p_sf52rec.to_position_org_line1 := p_sf52rec_correct.to_position_org_line1;
2991 p_sf52rec.to_position_org_line2 := p_sf52rec_correct.to_position_org_line2;
2992 p_sf52rec.to_position_org_line3 := p_sf52rec_correct.to_position_org_line3;
2993 p_sf52rec.to_position_org_line4 := p_sf52rec_correct.to_position_org_line4;
2994 p_sf52rec.to_position_org_line5 := p_sf52rec_correct.to_position_org_line5;
2995 p_sf52rec.to_position_org_line6 := p_sf52rec_correct.to_position_org_line6;
2996 -- END IF;
2997
2998 end if;
2999 p_sf52rec.custom_pay_calc_flag := p_sf52rec_correct.custom_pay_calc_flag;
3000
3001 -- Below Added by Sundar for Bug 3191676 and 2681726
3002 IF ( p_sf52rec_correct.first_noa_code = '790') THEN
3003 p_sf52rec.to_position_org_line1 := p_sf52rec_correct.to_position_org_line1;
3004 p_sf52rec.to_position_org_line2 := p_sf52rec_correct.to_position_org_line2;
3005 p_sf52rec.to_position_org_line3 := p_sf52rec_correct.to_position_org_line3;
3006 p_sf52rec.to_position_org_line4 := p_sf52rec_correct.to_position_org_line4;
3007 p_sf52rec.to_position_org_line5 := p_sf52rec_correct.to_position_org_line5;
3008 p_sf52rec.to_position_org_line6 := p_sf52rec_correct.to_position_org_line6;
3009 ELSIF ( p_sf52rec_correct.first_noa_code = '352') THEN
3010 p_sf52rec.to_position_org_line1 := p_sf52rec_correct.to_position_org_line1;
3011 END IF;
3012 -- End Bug 3191676 and 2681726
3013
3014 -- work_schedule and part_time_hours are interdependent, part_time_hours should also
3015 -- be copied when work_schedule changes.
3016 if ( p_sf52rec_correct.work_schedule <> p_sf52rec.work_schedule
3017 AND p_sf52rec_correct.work_schedule is not null ) then
3018 hr_utility.set_location(' Work Schedule changed :'||l_proc, 30);
3019 p_sf52rec.work_schedule := p_sf52rec_correct.work_schedule ;
3020 p_sf52rec.part_time_hours := p_sf52rec_correct.part_time_hours ;
3021 elsif (p_sf52rec_correct.part_time_hours <> p_sf52rec.part_time_hours) then
3022 hr_utility.set_location(' Part Time hours changed :'||l_proc, 30);
3023 p_sf52rec.part_time_hours := p_sf52rec_correct.part_time_hours ;
3024 end if;
3025
3026 if (p_corr_pa_request_id = p_sf52rec_correct.pa_request_id) then
3027 -- these fields should retain value of correction currently being processed. Any values from previous
3028 -- corrections are ignored.
3029 hr_utility.set_location(' Last correction :'||l_proc, 35);
3030 p_sf52rec.routing_group_id := p_sf52rec_correct.routing_group_id ;
3031 p_sf52rec.proposed_effective_asap_flag := p_sf52rec_correct.proposed_effective_asap_flag ;
3032 p_sf52rec.additional_info_person_id := p_sf52rec_correct.additional_info_person_id ;
3033 p_sf52rec.additional_info_tel_number := p_sf52rec_correct.additional_info_tel_number ;
3034 p_sf52rec.authorized_by_person_id := p_sf52rec_correct.authorized_by_person_id ;
3035 p_sf52rec.authorized_by_title := p_sf52rec_correct.authorized_by_title ;
3036 p_sf52rec.concurrence_date := p_sf52rec_correct.concurrence_date ;
3037 p_sf52rec.notepad := p_sf52rec_correct.notepad ;
3038 p_sf52rec.proposed_effective_date := p_sf52rec_correct.proposed_effective_date ;
3039 p_sf52rec.requested_by_person_id := p_sf52rec_correct.requested_by_person_id ;
3040 p_sf52rec.requested_by_title := p_sf52rec_correct.requested_by_title ;
3041 p_sf52rec.requested_date := p_sf52rec_correct.requested_date ;
3042 p_sf52rec.requesting_office_remarks_desc := p_sf52rec_correct.requesting_office_remarks_desc ;
3043 p_sf52rec.requesting_office_remarks_flag := p_sf52rec_correct.requesting_office_remarks_flag ;
3044 p_sf52rec.request_number := p_sf52rec_correct.request_number ;
3045
3046 p_sf52rec.employee_first_name := p_sf52rec_correct.employee_first_name ;
3047 p_sf52rec.employee_last_name := p_sf52rec_correct.employee_last_name ;
3048 p_sf52rec.employee_middle_names := p_sf52rec_correct.employee_middle_names ;
3049 p_sf52rec.employee_national_identifier := p_sf52rec_correct.employee_national_identifier ;
3050 p_sf52rec.employee_date_of_birth := p_sf52rec_correct.employee_date_of_birth ;
3051
3052 end if;
3053 -- added by skutteti on 14-oct-98 to take care of the new requirements for
3054 -- percentages on awards and other pay
3055 if p_sf52rec_correct.award_amount is not null or
3056 p_sf52rec_correct.award_percentage is not null then
3057 p_sf52rec.award_amount := p_sf52rec_correct.award_amount;
3058 p_sf52rec.award_percentage := p_sf52rec_correct.award_percentage;
3059 else
3060 ghr_history_conv_rg.copy_field_value(p_sf52rec_correct.award_percentage,p_sf52rec.award_percentage);
3061 IF p_sf52rec.award_percentage IS NOT NULL THEN
3062 -- Begin Bug# 5014663
3063 ghr_history_fetch.fetch_asgei(
3064 p_assignment_id => p_sf52rec.employee_assignment_id,
3065 p_information_type => 'GHR_US_ASG_SF52',
3066 p_date_effective => p_sf52rec.effective_date,
3067 p_asg_ei_data => l_asg_ei_data);
3068
3069 ghr_pay_calc.award_amount_calc (
3070 p_position_id => p_sf52rec.from_position_id
3071 ,p_pay_plan => p_sf52rec.from_pay_plan
3072 ,p_award_percentage => p_sf52rec.award_percentage
3073 ,p_user_table_id => p_sf52rec.from_pay_table_identifier
3074 ,p_grade_or_level => p_sf52rec.from_grade_or_level
3075 ,p_effective_date => p_sf52rec.effective_date
3076 ,p_basic_pay => p_sf52rec.from_basic_pay
3077 ,p_adj_basic_pay => p_sf52rec.from_adj_basic_pay
3078 ,p_duty_station_id => p_sf52rec.duty_station_id
3079 ,p_prd => l_asg_ei_data.aei_information6
3080 ,p_pay_basis => p_sf52rec.from_pay_basis
3081 ,p_person_id => p_sf52rec.person_id
3082 ,p_award_amount => l_temp_award_amount
3083 ,p_award_salary => l_award_salary
3084 );
3085 ghr_history_conv_rg.copy_field_value(l_temp_award_amount,p_sf52rec.award_amount);
3086 ELSE
3087 ghr_history_conv_rg.copy_field_value(p_sf52rec_correct.award_amount,p_sf52rec.award_amount);
3088 END IF;
3089 -- End Bug# 5014663
3090
3091 end if;
3092 if p_sf52rec_correct.to_supervisory_differential is not null or
3093 p_sf52rec_correct.to_supervisory_diff_percentage is not null then
3094 p_sf52rec.to_supervisory_differential := p_sf52rec_correct.to_supervisory_differential;
3095 p_sf52rec.to_supervisory_diff_percentage := p_sf52rec_correct.to_supervisory_diff_percentage;
3096 else
3097 ghr_history_conv_rg.copy_field_value(p_sf52rec_correct.to_supervisory_differential,
3098 p_sf52rec.to_supervisory_differential);
3099 ghr_history_conv_rg.copy_field_value(p_sf52rec_correct.to_supervisory_diff_percentage,
3100 p_sf52rec.to_supervisory_diff_percentage);
3101 end if;
3102 if p_sf52rec_correct.to_retention_allowance is not null or
3103 p_sf52rec_correct.to_retention_allow_percentage is not null then
3104 p_sf52rec.to_retention_allowance := p_sf52rec_correct.to_retention_allowance;
3105 p_sf52rec.to_retention_allow_percentage := p_sf52rec_correct.to_retention_allow_percentage;
3106 else
3107 ghr_history_conv_rg.copy_field_value(p_sf52rec_correct.to_retention_allowance,
3108 p_sf52rec.to_retention_allowance);
3109 ghr_history_conv_rg.copy_field_value(p_sf52rec_correct.to_retention_allow_percentage,
3110 p_sf52rec.to_retention_allow_percentage);
3111 end if;
3112 if p_sf52rec_correct.to_staffing_differential is not null or
3113 p_sf52rec_correct.to_staffing_diff_percentage is not null then
3114 p_sf52rec.to_staffing_differential := p_sf52rec_correct.to_staffing_differential;
3115 p_sf52rec.to_staffing_diff_percentage := p_sf52rec_correct.to_staffing_diff_percentage;
3116 else
3117 ghr_history_conv_rg.copy_field_value(p_sf52rec_correct.to_staffing_differential,
3118 p_sf52rec.to_staffing_differential);
3119 ghr_history_conv_rg.copy_field_value(p_sf52rec_correct.to_staffing_diff_percentage,
3120 p_sf52rec.to_staffing_diff_percentage);
3121 end if;
3122
3123 hr_utility.set_location(' Leaving:'||l_proc, 40);
3124 Exception when others then
3125 --
3126 -- Reset IN OUT parameters and set OUT parameters
3127 --
3128 p_sf52rec := l_sf52rec;
3129 raise;
3130 End apply_correction ;
3131
3132 -- --------------------------------------------------------------------------------
3133 -- |--------------------------< apply_noa_corrections>-----------------------------|
3134 -- --------------------------------------------------------------------------------
3135 -- {Start Of Comments}
3136 --
3137 -- Description:
3138 -- This procedure finds the original sf52 record and the intermediate incremental
3139 -- changes. The intermediate incremental changes are applied in sequence to
3140 -- arrive at final corrected record.
3141 --
3142 -- Pre-Requisities:
3143 -- None.
3144 --
3145 -- In Parameters:
3146 -- p_sf52_data -> the ghr_pa_requests record for the
3147 -- correction we are currently processing.
3148 -- p_sf52_data_result -> the ghr_pa_requests record that will hold the final
3149 -- corrected data for all corrections in the correction
3150 -- chain upon successful completion of this procedure.
3151 -- Post Success:
3152 -- All the corrections in the correction chain will have been applied and the
3153 -- result put in p_sf52_data_result.
3154 --
3155 -- Post Failure:
3156 -- No failure conditions.
3157 --
3158 -- Developer Implementation Notes:
3159 -- None.
3160 --
3161 -- Access Status:
3162 -- Internal Development Use Only.
3163 --
3164 -- {End Of Comments}
3165 -- ---------------------------------------------------------------------------
3166
3167 Procedure apply_noa_corrections( p_sf52_data in ghr_pa_requests%rowtype,
3168 p_sf52_data_result in out nocopy ghr_pa_requests%rowtype ) is
3169
3170 l_sf52_data_orig ghr_pa_requests%rowtype;
3171 l_sf52_data_step ghr_pa_requests%rowtype;
3172 l_sf52_ia_rec ghr_pa_requests%rowtype;
3173 l_sf52_dummy ghr_pa_requests%rowtype;
3174 l_sf52_cursor_step_indx number;
3175 l_session_var ghr_history_api.g_session_var_type;
3176 -- Bug#5435374 added l_session_var1.
3177 l_session_var1 ghr_history_api.g_session_var_type;
3178 l_capped_other_pay number := hr_api.g_number;
3179 l_retro_eff_date ghr_pa_requests.effective_date%type;
3180 l_retro_pa_request_id ghr_pa_requests.pa_request_id%type;
3181 l_retro_first_noa ghr_nature_of_actions.code%type;
3182 l_retro_second_noa ghr_nature_of_actions.code%type;
3183 l_sf52_data_result ghr_pa_requests%rowtype;
3184 -- Bug#3543213 Created l_dummy variable
3185 l_dummy VARCHAR2(30);
3186 -- this cursor selects all rows in the correction chain from ghr_pa_requests
3187 cursor l_sf52_cursor is
3188 select *
3189 from ghr_pa_requests
3190 connect by prior altered_pa_request_id = pa_request_id
3191 start with pa_request_id = p_sf52_data.pa_request_id
3192 order by level desc;
3193
3194 cursor c_orig_details_for_ia is
3195 select pa_request_id,pa_notification_id,person_id,
3196 effective_date,from_position_id,
3197 to_position_id
3198 from ghr_pa_requests
3199 where pa_request_id = p_sf52_data.altered_pa_request_id;
3200
3201 cursor c_get_hist_id (c_pa_request_id in number) is
3202 select
3203 min(pa_history_id)
3204 from ghr_pa_history
3205 where pa_request_id = c_pa_request_id;
3206
3207 -- Bug#5435374
3208 l_pos_ei_grade_data per_position_extra_info%rowtype;
3209
3210 cursor c_grade_kff (grd_id number) is
3211 select gdf.segment1
3212 ,gdf.segment2
3213 from per_grades grd,
3214 per_grade_definitions gdf
3215 where grd.grade_id = grd_id
3216 and grd.grade_definition_id = gdf.grade_definition_id;
3217
3218 --bug #6356058 start
3219 l_core_chg_avbl number;
3220 l_prev_request_id number;
3221 l_curr_pa_history_id number;
3222 l_pos_ei_grp1_data per_position_extra_info%rowtype;
3223 cursor core_chg_check(p_to_position_id in number,
3224 p_effective_date in date)
3225 is
3226 select 1
3227 from ghr_pa_history hist_1
3228 where pa_request_id is null
3229 and hist_1.pa_history_id > (select min(pa_history_id)
3230 from ghr_pa_history
3231 where pa_request_id = l_prev_request_id)
3232 and hist_1.pa_history_id < nvl(l_curr_pa_history_id,999999999)
3233 and information1 in (select position_extra_info_id
3234 from per_position_extra_info
3235 where position_id = p_to_position_id
3236 and information_type in ('GHR_US_POS_GRP1'))
3237 and effective_date = p_effective_date
3238 and table_name = 'PER_POSITION_EXTRA_INFO';
3239 --bug #6356058 start
3240
3241
3242
3243 l_shadow_data ghr_pa_request_shadow%rowtype;
3244 l_proc varchar2(30):='apply_noa_corrections';
3245 begin
3246 hr_utility.set_location('Entering:'|| l_proc, 5);
3247 l_sf52_data_result := p_sf52_data_result;
3248 ghr_history_api.get_g_session_var(l_session_var);
3249 -- loop through all corrections in the correction chain, incrementally applying them by
3250 -- calling apply_corrections procedure.
3251 open l_sf52_cursor ;
3252 l_sf52_cursor_step_indx := 0;
3253 loop
3254 -- initialize l_sf52_data_step to nulls;
3255 l_sf52_data_step := l_sf52_dummy;
3256 -- l_sf52_data_step holds intermediate incremental values for final corrected record that is
3257 -- being built.
3258 fetch l_sf52_cursor into l_sf52_data_step;
3259 exit when l_sf52_cursor%notfound;
3260 l_sf52_cursor_step_indx := l_sf52_cursor_step_indx +1;
3261 if ( l_sf52_cursor_step_indx = 1) then
3262 --Bug # 6356058 start
3263 l_prev_request_id := l_sf52_data_step.pa_request_id;
3264 --Bug # 6356058 end
3265 hr_utility.set_location('Fetch l_sf52_data_step original :'|| l_proc, 10);
3266 l_sf52_data_orig := l_sf52_data_step;
3267 p_sf52_data_result := l_sf52_data_step;
3268 hr_utility.set_location('assignment_id of original =' || l_sf52_data_step.employee_assignment_id, 14);
3269 hr_utility.set_location('from grd or leveloriginal =' || l_sf52_data_step.from_grade_or_level, 14);
3270
3271 hr_utility.set_location(l_proc || 'pa_request_id of original= ' || l_sf52_data_step.pa_request_id,26);
3272 -- .47
3273 -- refresh root sf52 and its correction
3274 -- get pa_history_id for the root pa_request_id
3275 open c_get_hist_id( l_sf52_data_step.pa_request_id);
3276 fetch c_get_hist_id into l_session_var.pa_history_id;
3277 if c_get_hist_id%notfound then
3278 -- raise error;
3279 close c_get_hist_id;
3280 else
3281 close c_get_hist_id;
3282 end if;
3283 -- We are setting pa_history_id in session var to be able to fetch
3284 -- Pre-record values of the root SF52 for refresh purpose.
3285 -- It'll be reset after refresh has been done
3286
3287 ghr_history_api.set_g_session_var(l_session_var);
3288 ghr_process_sf52.refresh_req_shadow(p_sf52_data => p_sf52_data_result,
3289 p_shadow_data => l_shadow_data);
3290 ghr_process_sf52.redo_pay_calc( p_sf52_rec => p_sf52_data_result,
3291 p_capped_other_pay => l_capped_other_pay);
3292
3293 -- reset pa_history_id in session variable.
3294 l_session_var.pa_history_id := null;
3295 ghr_history_api.set_g_session_var(l_session_var);
3296 -- .47
3297 -- Bug#3543213 For PRD U,V and NOA 894(Pay Adjustment) get the PRD Value from assignment
3298 IF p_sf52_data_result.first_noa_code = '894' AND
3299 p_sf52_data_result.pay_rate_determinant IN ('U','V') THEN
3300 ghr_pa_requests_pkg.get_SF52_asg_ddf_details
3301 (p_assignment_id => p_sf52_data_result.employee_assignment_id
3302 ,p_date_effective => p_sf52_data_result.effective_date
3303 ,p_tenure => l_dummy
3304 ,p_annuitant_indicator => l_dummy
3305 ,p_pay_rate_determinant => p_sf52_data_result.pay_rate_determinant
3306 ,p_work_schedule => l_dummy
3307 ,p_part_time_hours => l_dummy);
3308 END IF;
3309 -- End of Bug#3543213
3310
3311 -- check if original action in correction chain was a dual action. If so, determine which of
3312 -- the two actions this correction is for and call ghr_process_sf52.assign_new_rg to null out columns not having
3313 -- to do with the noa we are correcting.
3314 if (p_sf52_data_result.second_noa_id is not null) then
3315 hr_utility.set_location('original sf52 is dual action :'|| l_proc, 11);
3316 if (p_sf52_data.second_noa_id = p_sf52_data_result.second_noa_id) then
3317 hr_utility.set_location('Correcting second action in dual action:'|| l_proc, 12);
3318 ghr_process_sf52.assign_new_rg(p_action_num => 2,
3319 p_pa_req => p_sf52_data_result);
3320 else
3321 hr_utility.set_location('Correcting first action in dual action:'|| l_proc, 13);
3322 ghr_process_sf52.assign_new_rg(p_action_num => 1,
3323 p_pa_req => p_sf52_data_result);
3324 -- if first action is 893, then we need to derive to_columns as both actions of
3325 -- the dual action potentially could have changed the to fields (in particular,
3326 -- to_step_or_rate) so we need to determine what the to_fields should be or the first action.
3327 if (p_sf52_data_result.first_noa_code = 893) then
3328 ghr_process_sf52.derive_to_columns(p_sf52_data => p_sf52_data_result);
3329 end if;
3330 end if;
3331 end if;
3332 -- Nullfy columns which must not be passed
3333 p_sf52_data_result.pa_notification_id := NULL;
3334 p_sf52_data_result.agency_code := NULL;
3335 p_sf52_data_result.approval_date := NULL;
3336 p_sf52_data_result.approving_official_work_title:= NULL;
3337 p_sf52_data_result.employee_dept_or_agency := NULL;
3338 p_sf52_data_result.from_agency_code := NULL;
3339 p_sf52_data_result.from_agency_desc := NULL;
3340 p_sf52_data_result.from_office_symbol := NULL;
3341 p_sf52_data_result.personnel_office_id := NULL;
3342 p_sf52_data_result.to_office_symbol := NULL;
3343 else
3344 l_retro_pa_request_id := NULL;
3345 hr_utility.set_location('Fetch l_sf52_data_step loop :'|| l_proc, 15);
3346 -- all corrections will have the original sf52 information in the 2nd noa columns, so
3347 -- copy that information to 1st noa columns.
3348 hr_utility.set_location('from grd or levelbefcp2to1 =' || l_sf52_data_step.from_grade_or_level, 14);
3349 ghr_process_sf52.copy_2ndNoa_to_1stNoa(l_sf52_data_step);
3350 -- null the second noa columns since we don't want anything to be done with these now.
3351 hr_utility.set_location('from grd or levelaftcp2to1 =' || l_sf52_data_step.from_grade_or_level, 14);
3352 ghr_process_sf52.null_2ndNoa_cols(l_sf52_data_step);
3353 hr_utility.set_location('from grd or levelaftnull2noa =' || l_sf52_data_step.from_grade_or_level, 14);
3354 hr_utility.set_location(l_proc || 'pa_request_id before correction= ' || l_sf52_data_step.pa_request_id,16);
3355 hr_utility.set_location(l_proc || 'assignment id before correction= ' || l_sf52_data_step.employee_assignment_id,17);
3356 hr_utility.set_location('from grd or levelbef appcorr =' || l_sf52_data_step.from_grade_or_level, 14);
3357 ghr_process_sf52.print_sf52('l_sf52_step bef apply_correction',
3358 l_sf52_data_step );
3359 ghr_process_sf52.print_sf52('result bef copy_ia_rec_on_result',
3360 p_sf52_data_result );
3361 -- Start Intervening Actions Processing
3362 -- Processing added to assign the From side details to
3363 -- To side if it is a Intervening action and
3364 -- Original action from position_id = to position id
3365 -- Fetch the original action details
3366 FOR c_orig_det_rec in c_orig_details_for_ia
3367 LOOP
3368 hr_utility.set_location('Inside the orig_details for loop' ,15);
3369 hr_utility.set_location('orig pa_request_id'||c_orig_det_rec.pa_request_id ,15);
3370 hr_utility.set_location('orig pa_notification_id'||c_orig_det_rec.pa_notification_id ,15);
3371 hr_utility.set_location('orig person_id'||c_orig_det_rec.person_id ,15);
3372 hr_utility.set_location('orig from_position_id'||c_orig_det_rec.from_position_id ,15);
3373 hr_utility.set_location('orig to_position_id'||c_orig_det_rec.to_position_id ,15);
3374 hr_utility.set_location('orig effective_date'||c_orig_det_rec.effective_date ,15);
3375 --BUG #7216635 added the parameter p_noa_id_correct
3376 GHR_APPROVED_PA_REQUESTS.determine_ia(
3377 p_pa_request_id => c_orig_det_rec.pa_request_id,
3378 p_pa_notification_id => c_orig_det_rec.pa_notification_id,
3379 p_person_id => c_orig_det_rec.person_id,
3380 p_effective_date => c_orig_det_rec.effective_date,
3381 p_noa_id_correct => l_session_var.noa_id_correct,
3382 p_retro_pa_request_id => l_retro_pa_request_id,
3383 p_retro_eff_date => l_retro_eff_date,
3384 p_retro_first_noa => l_retro_first_noa,
3385 p_retro_second_noa => l_retro_second_noa);
3386 hr_utility.set_location('retro effective_date is '||l_retro_eff_date ,16);
3387 -- Bug#2521744 Splitting the single if condition into 2 separate if conditions.
3388 IF l_retro_eff_date is NOT NULL THEN
3389 IF c_orig_det_rec.from_position_id
3390 = c_orig_det_rec.to_position_id THEN
3391 -- copy the from details
3392 hr_utility.set_location('Its a Intervening Action ' ,16);
3393 hr_utility.set_location('pa_request_id passed to get_sf52_to_det '||p_sf52_data.pa_request_id ,17);
3394
3395 get_sf52_to_details_for_ia
3396 (p_pa_request_id => p_sf52_data.pa_request_id,
3397 p_retro_eff_date => l_retro_eff_date,
3398 p_sf52_ia_rec => p_sf52_data_result);
3399 ghr_process_sf52.print_sf52('result aft get_sf52_to_details_for_ia',
3400 p_sf52_data_result );
3401 get_sf52_to_othpays_for_ia(p_sf52_ia_rec => p_sf52_data_result);
3402 ghr_process_sf52.print_sf52('reslt aft get_sf52_to_other_pay_det_for_ia',
3403 p_sf52_data_result );
3404 ELSE
3405 -- Verify whether the original action is one of the salary change actions
3406 -- If yes, check whether the other pay related elements are present or not
3407 -- as on the effective date. If they are not present, set that other pay comp
3408 -- to_value as null.
3409 get_sf52_to_othpays_for_ia(p_sf52_ia_rec => p_sf52_data_result);
3410 ghr_process_sf52.print_sf52('Aft get_sf52_to_other_pay_det_for_ia in else',
3411 p_sf52_data_result );
3412 END IF;
3413
3414
3415 END IF;
3416 --bug #6356058 start
3417 IF p_sf52_data_result.from_position_id = p_sf52_data_result.to_position_id THEN
3418 IF l_retro_pa_request_id IS NOT NULL THEN
3419 l_prev_request_id := l_retro_pa_request_id;
3420 end if;
3421 open c_get_hist_id(l_sf52_data_step.pa_request_id);
3422 fetch c_get_hist_id into l_curr_pa_history_id;
3423 close c_get_hist_id;
3424 open core_chg_check( p_sf52_data_result.to_position_id,
3425 c_orig_det_rec.effective_date);
3426 fetch core_chg_check into l_core_chg_avbl;
3427 if core_chg_check%found then
3428 ghr_history_api.get_g_session_var(l_session_var);
3429 ghr_history_api.reinit_g_session_var;
3430 l_session_var1.date_Effective := l_session_var.date_Effective;
3431 l_session_var1.person_id := l_session_var.person_id;
3432 l_session_var1.assignment_id := l_session_var.assignment_id;
3433 l_session_var1.fire_trigger := 'N';
3434 l_session_var1.program_name := 'sf50';
3435 ghr_history_api.set_g_session_var(l_session_var1);
3436 ghr_history_fetch.fetch_positionei(
3437 p_position_id => p_sf52_data_result.to_position_id,
3438 p_information_type => 'GHR_US_POS_GRP1',
3439 p_date_effective => p_sf52_data_result.effective_date,
3440 p_pos_ei_data => l_pos_ei_grp1_data);
3441 p_sf52_data_result.supervisory_status := l_pos_ei_grp1_data.poei_information16;
3442 p_sf52_data_result.part_time_hours := l_pos_ei_grp1_data.poei_information23;
3443 ghr_history_api.reinit_g_session_var;
3444 ghr_history_api.set_g_session_var(l_session_var);
3445 end if;
3446 close core_chg_check;
3447 END IF;
3448 --bug #6356058 end
3449 END LOOP;
3450 --bug #6356058
3451 l_prev_request_id := l_sf52_data_step.pa_request_id;
3452 hr_utility.set_location('Out side the orig_details for loop' ,17);
3453 -- End Intervening Actions Processing
3454
3455 apply_correction( p_sf52rec_correct => l_sf52_data_step,
3456 p_corr_pa_request_id => p_sf52_data.pa_request_id,
3457 p_sf52rec => p_sf52_data_result );
3458
3459 -- Recalculating Retention Allowance
3460 -- Recalculate Retention allowance if it is a OTHER_PAY action
3461 -- and Correction of Intervening Action
3462 if p_sf52_data_result.noa_family_code = 'OTHER_PAY' and
3463 l_retro_eff_date is NOT NULL and
3464 p_sf52_data_result.to_retention_allow_percentage is not null then
3465 --Modified for FWS
3466 IF p_sf52_data_result.to_pay_basis ='PH' THEN
3467 p_sf52_data_result.to_retention_allowance :=
3468 TRUNC(p_sf52_data_result.to_basic_pay * p_sf52_data_result.to_retention_allow_percentage/100,2);
3469 ELSE
3470 p_sf52_data_result.to_retention_allowance :=
3471 TRUNC(p_sf52_data_result.to_basic_pay * p_sf52_data_result.to_retention_allow_percentage/100,0);
3472 END IF;
3473
3474 p_sf52_data_result.to_other_pay_amount :=
3475 nvl(p_sf52_data_result.to_au_overtime,0) +
3476 nvl(p_sf52_data_result.to_availability_pay,0) +
3477 nvl(p_sf52_data_result.to_retention_allowance,0) +
3478 nvl(p_sf52_data_result.to_supervisory_differential,0) +
3479 nvl(p_sf52_data_result.to_staffing_differential,0);
3480 p_sf52_data_result.to_total_salary :=
3481 p_sf52_data_result.to_adj_basic_pay + p_sf52_data_result.to_other_pay_amount;
3482 if p_sf52_data_result.to_other_pay_amount = 0 then
3483 p_sf52_data_result.to_other_pay_amount := null;
3484 end if;
3485 end if;
3486 hr_utility.set_location( l_proc || 'assignment_id after correction=' || p_sf52_data_result.employee_assignment_id ,18);
3487 hr_utility.set_location('Applied corrections :'|| l_proc, 20);
3488 end if;
3489 end loop;
3490 close l_sf52_cursor;
3491
3492 -- Bug#5435374 If the from and to position ids are same, verify the pay plan, grade details.
3493 IF p_sf52_data_result.from_position_id = p_sf52_data_result.to_position_id THEN
3494
3495 -- Reinitializing the session variables to get the valid grade as on the
3496 -- effective date.
3497 ghr_history_api.get_g_session_var(l_session_var);
3498 ghr_history_api.reinit_g_session_var;
3499 l_session_var1.date_Effective := l_session_var.date_Effective;
3500 l_session_var1.person_id := l_session_var.person_id;
3501 l_session_var1.assignment_id := l_session_var.assignment_id;
3502 l_session_var1.fire_trigger := 'N';
3503 l_session_var1.program_name := 'sf50';
3504 ghr_history_api.set_g_session_var(l_session_var1);
3505
3506 -- Retrieve the Grade info from the POI history table
3507 ghr_history_fetch.fetch_positionei(
3508 p_position_id => p_sf52_data_result.to_position_id,
3509 p_information_type => 'GHR_US_POS_VALID_GRADE',
3510 p_date_effective => p_sf52_data_result.effective_date,
3511 p_pos_ei_data => l_pos_ei_grade_data);
3512
3513 -- Reset the session variables after getting the date effective valid grade
3514 -- to continue with the correction process.
3515 ghr_history_api.reinit_g_session_var;
3516 ghr_history_api.set_g_session_var(l_session_var);
3517
3518 IF l_pos_ei_grade_data.position_extra_info_id IS NOT NULL THEN
3519 hr_utility.set_location('GL: to grd id:'||p_sf52_data_result.to_grade_id,30);
3520 hr_utility.set_location('GL: pos ei grd:'||l_pos_ei_grade_data.poei_information3,40);
3521 IF l_pos_ei_grade_data.poei_information3 <> p_sf52_data_result.to_grade_id THEN
3522 --Bug# 5638869
3523 --p_sf52_data_result.to_grade_id := l_pos_ei_grade_data.poei_information3;
3524 l_pos_ei_grade_data.poei_information3 := p_sf52_data_result.to_grade_id;
3525 --Bug# 5638869
3526 FOR c_grade_kff_rec IN c_grade_kff (p_sf52_data_result.to_grade_id)
3527 LOOP
3528 hr_utility.set_location('GL: Inside setting pay plan grade',60);
3529 p_sf52_data_result.to_pay_plan := c_grade_kff_rec.segment1 ;
3530 p_sf52_data_result.to_grade_or_level := c_grade_kff_rec.segment2;
3531 EXIT;
3532 END LOOP;
3533 END IF;
3534 END IF;
3535 END IF;
3536 -- Bug#5435374 End of the fix.
3537
3538 hr_utility.set_location(' Leaving:'||l_proc, 25);
3539 Exception when others then
3540 --
3541 -- Reset IN OUT parameters and set OUT parameters
3542 --
3543 p_sf52_data_result := l_sf52_data_result;
3544 raise;
3545 end apply_noa_corrections;
3546
3547 -- ---------------------------------------------------------------------------
3548 -- |--------------------------< what_to_do>-----------------------------------|
3549 -- ---------------------------------------------------------------------------
3550 -- {Start Of Comments}
3551 --
3552 -- Description:
3553 -- This procedure sets p_can_delete, p_last_row, and p_cannot_cancel flags
3554 -- according to the data it was passed.
3555 --
3556 -- Pre-Requisities:
3557 -- None.
3558 --
3559 -- In Parameters:
3560 -- p_datetrack_table -> boolean that indicates if this is a datetrack table or not.
3561 -- p_pre_record_exists -> boolean that indicates if a pre-value was found for this history record.
3562 -- p_interv_on_table -> boolean that indicates if there are intervening changes to this row.
3563 -- p_interv_on_eff_date -> boolean that indicates if there are intervening changes to this row on the
3564 -- same date.
3565 -- p_rec_created_flag -> boolean that indicates if this record was created by this action.
3566 -- p_can_delete -> output flag that indicates if this row can be deleted.
3567 -- p_last_row -> output flag that indicates if this row is the last row in history (there are
3568 -- no following records).
3569 -- p_cannot_cancel -> output flag that indicates if this row can be cancelled or not.
3570 --
3571 -- Post Success:
3572 -- p_can_delete, p_last_row, and p_rec_created_flag will be set appropriately.
3573 --
3574 -- Post Failure:
3575 -- No failure conditions.
3576 --
3577 -- Developer Implementation Notes:
3578 -- None.
3579 --
3580 -- Access Status:
3581 -- Internal Development Use Only.
3582 --
3583 -- {End Of Comments}
3584 -- ---------------------------------------------------------------------------
3585
3586 PROCEDURE what_to_do( p_datetrack_table in boolean,
3587 p_pre_record_exists in boolean,
3588 p_interv_on_table in boolean,
3589 p_interv_on_eff_date in boolean,
3590 p_rec_created_flag in boolean,
3591 p_can_delete out nocopy boolean,
3592 p_last_row out nocopy boolean,
3593 p_cannot_cancel out nocopy boolean) IS
3594 l_proc varchar2(72) := 'what_to_do?';
3595 BEGIN
3596 hr_utility.set_location('Entering '|| l_proc,5);
3597 -- initialize output parms.
3598 p_can_delete := FALSE;
3599 p_last_row := FALSE;
3600 p_cannot_cancel := FALSE;
3601 if (p_datetrack_table = TRUE) then
3602 hr_utility.set_location('Datetrack table '|| l_proc,10);
3603 -- this is a datetrack table
3604 if (p_pre_record_exists = FALSE) then
3605 hr_utility.set_location('no pre'|| l_proc,15);
3606 if (p_interv_on_eff_date = FALSE) then
3607 hr_utility.set_location('no following records on same date'|| l_proc,20);
3608 if (p_interv_on_table = TRUE) then
3609 -- datetrack tables with no pre cannot be cancelled if they have following records in history.
3610 hr_utility.set_location(' Following records on later date'|| l_proc,45);
3611 p_cannot_cancel := TRUE;
3612 else
3613 hr_utility.set_location('NO Following records on later date'|| l_proc,70);
3614 -- there is no pre and no following records, so we CAN cancel and we CAN delete. And this is
3615 -- the last row in history.
3616 p_can_delete := TRUE;
3617 p_last_row := TRUE;
3618 end if;
3619 else
3620 hr_utility.set_location('Following records on same date'|| l_proc,75);
3621 -- datetrack tables with no pre cannot be cancelled if they have following records in history.
3622 p_cannot_cancel := TRUE;
3623 end if;
3624 else
3625 -- there is a pre_record
3626 hr_utility.set_location('has pre'|| l_proc,25);
3627 if (p_interv_on_eff_date = FALSE) then
3628 hr_utility.set_location(' no following recs on same date'|| l_proc,30);
3629 if (p_rec_created_flag = TRUE) then
3630 hr_utility.set_location('record created = TRUE'|| l_proc,35);
3631 p_can_delete := TRUE;
3632 end if;
3633 if (p_interv_on_table = FALSE) then
3634 hr_utility.set_location(' no following recs at all'|| l_proc,40);
3635 p_last_row := TRUE;
3636 end if;
3637 end if;
3638 end if;
3639 else
3640 -- this is a non datetrack table
3641 hr_utility.set_location(' non datetrack table'|| l_proc,50);
3642 -- assume there is always a pre-record for datetrack tables. It is just all nulls.
3643 if (p_interv_on_table = FALSE) then
3644 hr_utility.set_location('no following recs '|| l_proc,60);
3645 if (p_rec_created_flag = TRUE) then
3646 hr_utility.set_location('record created = Y '|| l_proc,65);
3647 p_can_delete := TRUE;
3648 p_last_row := TRUE;
3649 end if;
3650 end if;
3651 end if;
3652 exception when others then
3653 --
3654 -- Reset IN OUT parameters and set OUT parameters
3655 --
3656 p_can_delete := null;
3657 p_last_row := null;
3658 p_cannot_cancel := null;
3659 raise;
3660 END what_to_do;
3661
3662 -- ---------------------------------------------------------------------------
3663 -- |--------------------------< delete_element_entry>--------------------------|
3664 -- ---------------------------------------------------------------------------
3665 -- {Start Of Comments}
3666 --
3667 -- Description:
3668 -- This procedure deletes an element entry.
3669 --
3670 -- Pre-Requisities:
3671 -- None.
3672 --
3673 -- In Parameters:
3674 -- p_hist_rec -> element entry to be deleted (ghr_pa_history%rowtype).
3675 -- p_cannot_cancel -> boolean indicates if there is some problem with deleting this element (the action
3676 -- cannot be cancelled).
3677 --
3678 -- Post Success:
3679 -- element entry will have been deleted. p_cannot_cancel will be false.
3680 --
3681 -- Post Failure:
3682 -- p_cannot_cancel will be true.
3683 --
3684 -- Developer Implementation Notes:
3685 -- None.
3686 --
3687 -- Access Status:
3688 -- Internal Development Use Only.
3689 --
3690 -- {End Of Comments}
3691 -- ---------------------------------------------------------------------------
3692
3693 Procedure delete_element_entry( p_hist_rec in ghr_pa_history%rowtype,
3694 p_del_mode in varchar2 default hr_api.g_delete_next_change,
3695 p_cannot_cancel out nocopy Boolean) is
3696 l_del_warning boolean;
3697 -- this cursor selects the element_entry_id and object_version_number from
3698 -- pay_element_entries_f for the element_entry_id and date_effective passed.
3699 cursor c_elmt ( cp_element_entry_id number,
3700 cp_date_Effective date) is
3701 select element_entry_id,
3702 object_version_number
3703 from pay_element_entries_f
3704 where element_entry_id = cp_element_entry_id and
3705 cp_date_effective between effective_start_date and effective_end_date;
3706 l_c_elmt c_elmt%rowtype;
3707 l_eff_start_date date;
3708 l_eff_end_date date;
3709 l_proc varchar2(30):='delete_element_entry';
3710 Begin
3711 hr_utility.set_location( 'Entering : ' || l_proc, 10);
3712 hr_utility.set_location( ' info 1 : ' || p_hist_rec.information1 || l_proc, 11);
3713 hr_utility.set_location( ' info 2 : ' || p_hist_rec.information2 || l_proc, 12);
3714
3715 p_cannot_cancel := FALSE;
3716 open c_elmt (p_hist_rec.information1,
3717 to_date(p_hist_rec.information2, ghr_history_conv_rg.g_hist_date_format));
3718 fetch c_elmt into l_c_elmt;
3719 if c_elmt%notfound then
3720 hr_utility.set_location( l_proc, 20);
3721 close c_elmt;
3722 p_cannot_cancel := TRUE;
3723 else
3724 close c_elmt;
3725 hr_utility.set_location( l_proc, 30);
3726
3727 hr_utility.set_location( 'effective date ' || p_hist_rec.information2, 31);
3728 hr_utility.set_location( 'element entry id ' || l_c_elmt.element_entry_id, 32);
3729 hr_utility.set_location( 'ovn ' || l_c_elmt.object_version_number, 33);
3730
3731 PY_element_entry_api.delete_element_entry(
3732 p_datetrack_delete_mode => nvl(p_del_mode, hr_api.g_delete_next_change),
3733 p_effective_date => to_date(p_hist_rec.information2, ghr_history_conv_rg.g_hist_date_format),
3734 p_element_entry_id => l_c_elmt.element_entry_id,
3735 p_object_version_number => l_c_elmt.object_version_number,
3736 p_effective_start_date => l_eff_start_date,
3737 p_effective_end_date => l_eff_end_date,
3738 p_delete_warning => l_del_warning);
3739 if l_del_warning then
3740 hr_utility.set_location( 'Warning ' || l_proc, 39);
3741 end if;
3742
3743 --added
3744 end if;
3745 hr_utility.set_location( 'Leaving : ' || l_proc, 40);
3746 exception when others then
3747 --
3748 -- Reset IN OUT parameters and set OUT parameters
3749 --
3750 p_cannot_cancel := null;
3751 raise;
3752 End delete_element_entry;
3753
3754 -- ---------------------------------------------------------------------------
3755 -- |--------------------------< update_eleentval>--------------------------|
3756 -- ---------------------------------------------------------------------------
3757 -- {Start Of Comments}
3758 --
3759 -- Description:
3760 -- This procedure updates an element entry value.
3761 --
3762 -- Pre-Requisities:
3763 -- None.
3764 --
3765 -- In Parameters:
3766 -- p_hist_pre -> value to update element entry value to (ghr_pa_history%rowtype).
3767 --
3768 -- Post Success:
3769 -- element entry value will have been updated.
3770 --
3771 -- Post Failure:
3772 -- User message will have been displayed explaining why the element_entry_value couldn't be
3773 -- updated.
3774 --
3775 -- Developer Implementation Notes:
3776 -- Note that this is used in other packages as well. Changes to this procedure will have effects on the other
3777 -- packages using this procedure.
3778 --
3779 -- Access Status:
3780 -- Internal Development Use Only.
3781 --
3782 -- {End Of Comments}
3783 -- ---------------------------------------------------------------------------
3784
3785 PROCEDURE update_eleentval( p_hist_pre in ghr_pa_history%rowtype) IS
3786 -- this cursor selects the input value name given the input_value_id and effective date.
3787
3788 CURSOR c_input_value (cp_input_value_id in number
3789 ,cp_eff_date in date
3790 ,p_bg_id in NUMBER)
3791 IS
3792 SELECT IPV.NAME
3793 FROM PAY_INPUT_VALUES_F IPV
3794 WHERE TRUNC(cp_eff_date)
3795 BETWEEN IPV.EFFECTIVE_START_DATE AND IPV.EFFECTIVE_END_DATE
3796 AND IPV.INPUT_VALUE_ID = cp_input_value_id;
3797 -- AND (IPV.BUSINESS_GROUP_ID IS NULL OR IPV.BUSINESS_GROUP_ID=P_BG_ID);
3798
3799 -- this cursor selects the element name given the element_entry_id and effective date.
3800 CURSOR c_element_name( cp_element_entry_id in number
3801 ,cp_eff_date in date
3802 ,p_bg_id IN number)
3803 IS
3804 SELECT ELT.ELEMENT_NAME
3805 FROM PAY_ELEMENT_TYPES_F ELT,
3806 PAY_ELEMENT_LINKS_F ELL,
3807 PAY_ELEMENT_ENTRIES_F ELE
3808 WHERE TRUNC(cp_eff_date) BETWEEN ELT.EFFECTIVE_START_DATE
3809 AND ELT.EFFECTIVE_END_DATE
3810 AND TRUNC(cp_eff_date) BETWEEN ELL.EFFECTIVE_START_DATE
3811 AND ELL.EFFECTIVE_END_DATE
3812 AND TRUNC(cp_eff_date) BETWEEN ELE.EFFECTIVE_START_DATE
3813 AND ELE.EFFECTIVE_END_DATE
3814 AND ELE.ELEMENT_ENTRY_ID = cp_element_entry_id
3815 AND ELL.ELEMENT_LINK_ID = ELE.ELEMENT_LINK_ID
3816 AND ELT.ELEMENT_TYPE_ID = ELL.ELEMENT_TYPE_ID
3817 AND (ELT.BUSINESS_GROUP_ID is null OR ELT.BUSINESS_GROUP_ID = p_bg_id);
3818
3819 -- this cursor gets the assignment id given the primary key, efective_start_date, effective_end_date and
3820 -- table name. (ghr_pa_history views are structured such that ghr_pa_history.information1 is always the primary
3821 -- key, information2 is always the effective_start_date, and information3 is always the effective_end_date).
3822 cursor c_asgmt_id( cp_information1 in ghr_pa_history.information1%type,
3823 cp_information2 in ghr_pa_history.information2%type,
3824 cp_information3 in ghr_pa_history.information3%type,
3825 cp_table_name in ghr_pa_history.table_name%type) IS
3826 SELECT ASSIGNMENT_ID
3827 FROM GHR_PA_HISTORY
3828 WHERE INFORMATION1 = cp_information1
3829 AND INFORMATION2 = cp_information2
3830 AND INFORMATION3 = cp_information3
3831 AND TABLE_NAME = cp_table_name
3832 ORDER BY PROCESS_DATE DESC; -- Line Added by ENUNEZ (04/11/2000) bug# 1235958
3833
3834 l_ipv_name pay_input_values_f.name%type;
3835 l_element_name pay_element_types_f.element_name%type;
3836 l_proc_warn boolean;
3837 l_proc varchar2(30):='update_eleentval';
3838 l_eff_date date;
3839 l_asg_id number;
3840 l_value1 pay_element_entry_values_f.screen_entry_value%type;
3841
3842 cursor c_ipv (ele_name in varchar2
3843 ,input_name in varchar2
3844 ,eff_date in date
3845 ,p_bg_id in number) is
3846 select ipv.uom
3847 from pay_element_types_f elt,
3848 pay_input_values_f ipv
3849 where trunc(eff_date) between elt.effective_start_date
3850 and elt.effective_end_date
3851 and trunc(eff_date) between ipv.effective_start_date
3852 and ipv.effective_end_date
3853 and elt.element_type_id = ipv.element_type_id
3854 and upper(elt.element_name) = upper(ele_name)
3855 and upper(ipv.name) = upper(input_name);
3856 -- and (elt.business_group_id is NULL or elt.business_group_id =p_bg_id);
3857 --
3858 -- Payroll Integration Changes
3859 --
3860 CURSOR Cur_bg(p_person_id NUMBER,
3861 p_eff_date DATE)
3862 IS
3863 SELECT business_group_id bg
3864 FROM per_assignments_f
3865 WHERE person_id = p_person_id
3866 AND p_eff_Date between effective_start_Date
3867 AND effective_end_Date;
3868
3869 ll_bg_id NUMBER;
3870 l_new_element_name VARCHAR2(80);
3871 --*****************************************************************************
3872 --- to fix bug 3102049
3873 CURSOR cur_is_old_ele_name(p_ele_name IN VARCHAR2)
3874 IS
3875 SELECT pcv_information1 ele_name
3876 FROM pqp_configuration_Values
3877 WHERE pcv_information_category='PQP_FEDHR_ELEMENT'
3878 AND business_group_id is NULL and legislation_code='US'
3879 AND upper(pcv_information1)=upper(p_ele_name);
3880
3881 l_ele_name VARCHAR2(80);
3882 --*****************************************************************************
3883 --
3884 BEGIN
3885 --
3886 hr_utility.set_location( 'Entering : ' || l_proc, 10);
3887 hr_utility.set_location( 'information4 : ' || p_hist_pre.information4 || l_proc, 11);
3888 hr_utility.set_location( 'Effective Date : ' || p_hist_pre.information2 || l_proc, 12);
3889 hr_utility.set_location( 'Business Group id : ' || ll_bg_id, 100000002);
3890 --
3891 --Payroll Integration Changes
3892 --
3893 FOR bg_rec IN Cur_bg(p_hist_pre.person_id,
3894 p_hist_pre.effective_date)
3895 LOOP
3896 ll_bg_id := bg_rec.bg;
3897 END LOOP;
3898
3899 IF ll_bg_id is null THEN
3900 ll_bg_id := fnd_profile.value('PER_BUSINESS_GROUP_ID');
3901 END IF;
3902
3903
3904 hr_utility.set_location( 'information4 : ' || p_hist_pre.information4 || l_proc, 11);
3905 hr_utility.set_location( 'Effective Date : ' || p_hist_pre.information2 || l_proc, 12);
3906 hr_utility.set_location( 'Business Group id : ' || ll_bg_id, 100000002);
3907
3908 l_eff_date := to_date(p_hist_pre.information2, ghr_history_api.g_hist_date_format);
3909 hr_utility.set_location('Converted eff Date: ' || l_eff_date || l_proc,18);
3910 -- get input value name.
3911 open c_input_value( cp_input_value_id => p_hist_pre.information4,
3912 cp_eff_date => l_eff_date,
3913 p_bg_id => ll_bg_id);
3914 hr_utility.set_location('After open cursor: ' || l_proc,19);
3915 fetch c_input_value into l_ipv_name;
3916 hr_utility.set_location('After fetch cursor: ' || l_proc,21);
3917 if c_input_value%NOTFOUND then
3918 hr_utility.set_location( 'input_value_name notfound : ' || l_proc, 20);
3919 close c_input_value;
3920 hr_utility.set_message(8301,'GHR_38270_INPUT_VALUE_NAME_NF');
3921 hr_utility.raise_error;
3922 end if;
3923 close c_input_value;
3924 hr_utility.set_location( 'Open element name cursor: ' || l_proc, 30);
3925 -- get element name.
3926 open c_element_name( cp_element_entry_id => p_hist_pre.information5,
3927 cp_eff_date => l_eff_date,
3928 p_bg_id => ll_bg_id);
3929 hr_utility.set_location('Fetch element name cursor: ' || l_proc, 31);
3930 fetch c_element_name into l_element_name;
3931 hr_utility.set_location('After Fetch element name cursor: ' || l_proc, 32);
3932 if c_element_name%NOTFOUND then
3933 hr_utility.set_location( 'element_name notfound : ' || l_proc, 40);
3934 close c_element_name;
3935 hr_utility.set_message(8301,'GHR_38271_ELEMENT_NAME_NOTFND');
3936 hr_utility.raise_error;
3937 end if;
3938 close c_element_name;
3939 -- get assignment id.
3940 open c_asgmt_id (cp_information1 => p_hist_pre.information1,
3941 cp_information2 => p_hist_pre.information2,
3942 cp_information3 => p_hist_pre.information3,
3943 cp_table_name => ghr_history_api.g_eleevl_table);
3944 fetch c_asgmt_id into l_asg_id;
3945 if c_asgmt_id%NOTFOUND then
3946 hr_utility.set_location( 'assignment_id notfound : ' || l_proc, 41);
3947 close c_asgmt_id;
3948 hr_utility.set_message(8301,'GHR_38362_ASGMT_ID_NOTFND');
3949 hr_utility.raise_error;
3950 end if;
3951
3952 hr_utility.set_location('Element Assignment ID: ' || p_hist_pre.assignment_id || l_proc, 36);
3953 hr_utility.set_location('Element name: ' || l_element_name || l_proc, 37);
3954 hr_utility.set_location('IPV Name: ' || l_ipv_name || l_proc, 38);
3955 -- UOM error for date input values
3956 hr_utility.set_location('p_hist_pre.information6: '
3957 || p_hist_pre.information6 || l_proc, 38);
3958 l_value1 := p_hist_pre.information6;
3959 hr_utility.set_location('l_value1: ' || l_value1 || l_proc, 38);
3960 FOR c_ipv_rec IN c_ipv(l_element_name,l_ipv_name,l_eff_date,ll_bg_id) LOOP
3961 IF c_ipv_rec.uom = 'D' THEN
3962 l_value1 := fnd_date.date_to_displaydate(fnd_date.canonical_to_date(l_value1));
3963 hr_utility.set_location('l_value1: ' || l_value1 || l_proc, 38);
3964 END IF;
3965 END LOOP;
3966 ---*****************************************************************************
3967 --- Check if the element name is new element name or hard coded ele name
3968 --- to fix bug 3102049
3969 FOR old_ele_name IN cur_is_old_ele_name(l_element_name)
3970 LOOP
3971 l_ele_name := old_ele_name.ele_name;
3972 END LOOP;
3973
3974 IF l_ele_name is not null THEN
3975 l_new_element_name := l_element_name;
3976 ELSE
3977 l_new_element_name := pqp_fedhr_uspay_int_utils.return_old_element_name(
3978 l_element_name,
3979 ll_bg_id,
3980 l_eff_date);
3981 END IF;
3982 --- to fix bug 3102049
3983 ---*****************************************************************************
3984 ghr_element_api.process_sf52_element
3985 (p_assignment_id => l_asg_id
3986 ,p_element_name => l_new_element_name
3987 ,p_input_value_name1 => l_ipv_name
3988 ,p_value1 => l_value1
3989 ,p_effective_date => l_eff_date
3990 ,p_process_warning => l_proc_warn
3991 );
3992 /*To be included after Martin Reid's element api handles the create and update warning
3993 if l_proc_warn = FALSE then
3994 hr_utility.set_message(8301,'GHR_99999_FL_TO_UPD_ELEMENT_FOR_CANC');
3995 hr_utility.raise_error;
3996 end if;
3997 */
3998 hr_utility.set_location( 'Leaving : ' || l_proc, 50);
3999 END update_eleentval;
4000
4001 -- ---------------------------------------------------------------------------
4002 -- |--------------------------< delete_eleentval>-----------------------------|
4003 -- ---------------------------------------------------------------------------
4004 -- {Start Of Comments}
4005 --
4006 -- Description:
4007 -- This procedure deletes an element entry value from history table.
4008 --
4009 -- Pre-Requisities:
4010 -- None.
4011 --
4012 -- In Parameters:
4013 -- p_hist_rec -> element entry value to delete (ghr_pa_history%rowtype).
4014 --
4015 -- Post Success:
4016 -- element entry value will have been deleted rom history.
4017 --
4018 -- Post Failure:
4019 -- no failure conditions.
4020 --
4021 -- Developer Implementation Notes:
4022 -- None.
4023 --
4024 -- Access Status:
4025 -- Internal Development Use Only.
4026 --
4027 -- {End Of Comments}
4028 -- ---------------------------------------------------------------------------
4029
4030 Procedure delete_eleentval( p_hist_rec in ghr_pa_history%rowtype) is
4031 -- this cursor gets the rowid of the history_rec for the ghr_pa_history row passed
4032 -- to us.
4033 cursor c_hist is
4034 select rowid row_id
4035 from ghr_pa_history
4036 where table_name = ghr_history_api.g_eleevl_table and
4037 pa_request_id = p_hist_rec.pa_request_id and
4038 nature_of_action_id = p_hist_rec.nature_of_action_id
4039 for update of table_name;
4040 l_proc varchar2(30):='delete_eleentval';
4041 Begin
4042 hr_utility.set_location( 'Entering : ' || l_proc, 10);
4043 for c_data in c_hist
4044 loop
4045 delete_hist_row( c_data.row_id);
4046 end loop;
4047 hr_utility.set_location( 'Leaving : ' || l_proc, 20);
4048 end delete_eleentval;
4049
4050 -- ---------------------------------------------------------------------------
4051 -- |--------------------------< delete_peop_row>------------------------------|
4052 -- ---------------------------------------------------------------------------
4053 -- {Start Of Comments}
4054 --
4055 -- Description:
4056 -- This procedure deletes a row from per_people_f table.
4057 --
4058 -- Pre-Requisities:
4059 -- None.
4060 --
4061 -- In Parameters:
4062 -- p_person_id -> person_id to be deleted.
4063 -- p_dt_mode -> datetrack delete mode.
4064 -- p_date_effective -> effective date of delete.
4065 --
4066 -- Post Success:
4067 -- per_people_f row will have been deleted.
4068 --
4069 -- Post Failure:
4070 -- message will have been displayed to user explaining why the delete could not be completed.
4071 --
4072 -- Developer Implementation Notes:
4073 -- None.
4074 --
4075 -- Access Status:
4076 -- Internal Development Use Only.
4077 --
4078 -- {End Of Comments}
4079 -- ---------------------------------------------------------------------------
4080
4081 PROCEDURE delete_peop_row( p_person_id in varchar2,
4082 p_dt_mode in varchar2,
4083 p_date_effective in date) IS
4084 l_proc varchar2(72) := 'delete_per_people_f_row';
4085 l_ovn number;
4086 l_effective_start_date date;
4087 l_effective_end_date date;
4088 cursor c_get_ovn (cp_person_id in number,
4089 cp_date_effective in date) is
4090 SELECT object_version_number
4091 FROM PER_PEOPLE_F
4092 WHERE person_id = cp_person_id
4093 AND cp_date_effective between effective_start_date and effective_end_date;
4094 BEGIN
4095 hr_utility.set_location( 'Entering : ' || l_proc, 10);
4096 if (p_dt_mode = hr_api.g_delete_next_change) then
4097 open c_get_ovn(p_person_id, p_date_effective -1);
4098 fetch c_get_ovn into l_ovn;
4099 if c_get_ovn%NOTFOUND then
4100 -- can't delete without object_version_number.
4101 close c_get_ovn;
4102 hr_utility.set_message(8301,'GHR_38213_PEOPLE_OVN_NOTFOUND');
4103 hr_utility.raise_error;
4104 -- raise error;
4105 end if;
4106 per_per_del.del(
4107 p_person_id => p_person_id,
4108 p_effective_start_date => l_effective_start_date,
4109 p_effective_end_date => l_effective_end_date,
4110 p_object_version_number => l_ovn,
4111 p_effective_date => p_date_effective -1,
4112 p_datetrack_mode => p_dt_mode);
4113 elsif (p_dt_mode = hr_api.g_zap) then
4114 open c_get_ovn(p_person_id, p_date_effective );
4115 fetch c_get_ovn into l_ovn;
4116 if c_get_ovn%NOTFOUND then
4117 -- raise error;
4118 -- can't delete without object_version_number.
4119 close c_get_ovn;
4120 hr_utility.set_message(8301,'GHR_38213_PEOPLE_OVN_NOTFOUND');
4121 hr_utility.raise_error;
4122 end if;
4123 per_per_del.del(
4124 p_person_id => p_person_id,
4125 p_effective_start_date => l_effective_start_date,
4126 p_effective_end_date => l_effective_end_date,
4127 p_object_version_number => l_ovn,
4128 p_effective_date => p_date_effective,
4129 p_datetrack_mode => p_dt_mode );
4130 else
4131 -- raise error, unacceptable datetrack mode
4132 hr_utility.set_message(8301,'GHR_38216_INVALID_DT_MODE_PPL');
4133 hr_utility.raise_error;
4134 end if;
4135 hr_utility.set_location( 'Leaving : ' || l_proc, 20);
4136 END delete_peop_row;
4137
4138 -- Added Procedure delete_posn_row. ENUNEZ 11-MAY-2000, it didnt exist before as position used to
4139 -- be a non datetracked table. Bug# 1252481
4140 PROCEDURE delete_posn_row( p_position_id in varchar2,
4141 p_dt_mode in varchar2,
4142 p_date_effective in date) IS
4143 l_proc varchar2(72) := 'delete_hr_all_positions_f_row';
4144 l_ovn number;
4145 l_effective_start_date date;
4146 l_effective_end_date date;
4147 cursor c_get_ovn (cp_position_id in number,
4148 cp_date_effective in date) is
4149 SELECT object_version_number
4150 FROM HR_ALL_POSITIONS_F
4151 WHERE position_id = cp_position_id
4152 AND cp_date_effective between effective_start_date and effective_end_date;
4153
4154 -- Bug 3786467 Procedure to update position name in hr_all_positions_f_tl
4155
4156 PROCEDURE ghr_regenerate_position_name(p_position_id IN hr_all_positions_f.position_id%type) IS
4157 CURSOR c_position(c_position_id IN hr_all_positions_f.position_id%type) is
4158 SELECT psf.position_definition_id
4159 FROM hr_all_positions_f psf
4160 WHERE position_id = c_position_id
4161 AND effective_end_date = hr_api.g_eot
4162 FOR UPDATE;
4163 --
4164 l_position_definition_id number;
4165 BEGIN
4166 IF (p_position_id IS NOT NULL) THEN
4167 --
4168 OPEN c_position(p_position_id);
4169 FETCH c_position INTO l_position_definition_id;
4170 --
4171 IF (c_position%FOUND) THEN
4172 --
4173 hr_pft_upd.upd_tl
4174 ( p_language_code => 'US'
4175 , p_position_id => p_position_id
4176 , p_position_definition_id => l_position_definition_id
4177 );
4178 --
4179 END IF;
4180 --
4181 CLOSE c_position;
4182 --
4183 END IF;
4184 END ghr_regenerate_position_name;
4185 BEGIN
4186 hr_utility.set_location( 'Entering : ' || l_proc, 10);
4187 if (p_dt_mode = hr_api.g_delete_next_change) then
4188 open c_get_ovn(p_position_id, p_date_effective -1);
4189 fetch c_get_ovn into l_ovn;
4190 if c_get_ovn%NOTFOUND then
4191 -- can't delete without object_version_number.
4192 close c_get_ovn;
4193 hr_utility.set_message(8301,'GHR_38504_POS_OVN_NOTFOUND');
4194 hr_utility.raise_error;
4195 -- raise error;
4196 end if;
4197 hr_psf_del.del(
4198 p_position_id => p_position_id,
4199 p_effective_start_date => l_effective_start_date,
4200 p_effective_end_date => l_effective_end_date,
4201 p_object_version_number => l_ovn,
4202 p_effective_date => p_date_effective -1,
4203 p_datetrack_mode => p_dt_mode);
4204 -- Regenerate Position Bug 3786467.
4205 hr_utility.set_location('Entered ghr regenerate position',15);
4206 ghr_regenerate_position_name(p_position_id);
4207 elsif (p_dt_mode = hr_api.g_zap) then
4208 open c_get_ovn(p_position_id, p_date_effective );
4209 fetch c_get_ovn into l_ovn;
4210 if c_get_ovn%NOTFOUND then
4211 -- raise error;
4212 -- can't delete without object_version_number.
4213 close c_get_ovn;
4214 hr_utility.set_message(8301,'GHR_38504_POS_OVN_NOTFOUND');
4215 hr_utility.raise_error;
4216 end if;
4217 hr_psf_del.del(
4218 p_position_id => p_position_id,
4219 p_effective_start_date => l_effective_start_date,
4220 p_effective_end_date => l_effective_end_date,
4221 p_object_version_number => l_ovn,
4222 p_effective_date => p_date_effective,
4223 p_datetrack_mode => p_dt_mode );
4224 -- Regenerate Position Bug 3786467
4225 hr_utility.set_location('Entered ghr regenerate position',15);
4226 ghr_regenerate_position_name(p_position_id);
4227 else
4228 -- raise error, unacceptable datetrack mode
4229 hr_utility.set_message(8301,'GHR_38216_INVALID_DT_MODE_PPL');
4230 hr_utility.raise_error;
4231 end if;
4232 hr_utility.set_location( 'Leaving : ' || l_proc, 20);
4233 END delete_posn_row;
4234
4235 -- ---------------------------------------------------------------------------
4236 -- |--------------------------< delete_asgn_row>------------------------------|
4237 -- ---------------------------------------------------------------------------
4238 -- {Start Of Comments}
4239 --
4240 -- Description:
4241 -- This procedure deletes a row from per_people_f table.
4242 --
4243 -- Pre-Requisities:
4244 -- None.
4245 --
4246 -- In Parameters:
4247 -- p_assignment_id -> assignment_id to be deleted.
4248 -- p_dt_mode -> datetrack delete mode.
4249 -- p_date_effective -> effective date of delete.
4250 --
4251 -- Post Success:
4252 -- per_assignments_f row will have been deleted.
4253 --
4254 -- Post Failure:
4255 -- message will have been displayed to user explaining why the delete could not be completed.
4256 --
4257 -- Developer Implementation Notes:
4258 -- None.
4259 --
4260 -- Access Status:
4261 -- Internal Development Use Only.
4262 --
4263 -- {End Of Comments}
4264 -- ---------------------------------------------------------------------------
4265
4266 PROCEDURE delete_asgn_row( p_assignment_id in varchar2,
4267 p_dt_mode in varchar2,
4268 p_date_effective in date) IS
4269 l_proc varchar2(72) := 'delete_per_assignments_f_row';
4270 l_ovn number;
4271 l_effective_start_date date;
4272 l_effective_end_date date;
4273 l_validation_start_date date;
4274 l_validation_end_date date;
4275 l_business_group_id number;
4276 l_org_now_no_manager_warning boolean;
4277 -- this cursor gets the object_version_number given the assignment_id and effective_date.
4278 cursor c_get_ovn (cp_assignment_id in number,
4279 cp_date_effective in date) is
4280 SELECT object_version_number
4281 FROM PER_ASSIGNMENTS_F
4282 WHERE assignment_id = cp_assignment_id
4283 AND cp_date_effective between effective_start_date and effective_end_date;
4284
4285 Cursor Cur_proposal_exists (p_assignment_id IN NUMBER,
4286 p_eff_date IN DATE) is
4287 Select ppp.pay_proposal_id proposal_id
4288 ,ppp.object_version_number ovn
4289 from per_pay_proposals ppp
4290 where ppp.assignment_id = p_assignment_id
4291 and change_date <= p_eff_date;
4292
4293 l_pay_proposal_id NUMBER;
4294 -- sal admin fields
4295 l_sal_admin_ovn number;
4296
4297 l_payroll_warn boolean;
4298 l_approve_warn boolean;
4299 l_sal_warn boolean;
4300 l_date_warn boolean;
4301 --
4302 l_asg_del_ovn NUMBER;
4303 --l_org_now_no_manager_warning BOOLEAN;
4304 l_payroll_value NUMBER;
4305 l_ele_entry_id NUMBER;
4306 ll_payroll_value NUMBER;
4307 ll_value NUMBER;
4308 l_pay_intg BOOLEAN:=FALSE;
4309
4310 BEGIN
4311 hr_utility.set_location( 'Entering : ' || l_proc, 10);
4312 if (p_dt_mode = hr_api.g_delete_next_change) then
4313 open c_get_ovn(p_assignment_id, p_date_effective -1);
4314 fetch c_get_ovn into l_ovn;
4315 if c_get_ovn%NOTFOUND then
4316 -- can't delete without object_version_number.
4317 -- raise error;
4318 close c_get_ovn;
4319 hr_utility.set_message(8301,'GHR_38215_ASSG_OVN_NOTFOUND');
4320 hr_utility.raise_error;
4321 end if;
4322 per_asg_del.del(
4323 p_assignment_id => p_assignment_id,
4324 p_effective_start_date => l_effective_start_date,
4325 p_effective_end_date => l_effective_end_date,
4326 p_validation_start_date => l_validation_start_date,
4327 p_validation_end_date => l_validation_end_date,
4328 p_business_group_id => l_business_group_id,
4329 p_object_version_number => l_ovn,
4330 p_effective_date => p_date_effective -1,
4331 p_datetrack_mode => p_dt_mode,
4332 p_org_now_no_manager_warning => l_org_now_no_manager_warning );
4333 elsif (p_dt_mode = hr_api.g_zap) then
4334 open c_get_ovn(p_assignment_id, p_date_effective );
4335 fetch c_get_ovn into l_ovn;
4336 if c_get_ovn%NOTFOUND then
4337 -- can't delete without object_version_number.
4338 -- raise error;
4339 close c_get_ovn;
4340 hr_utility.set_message(8301,'GHR_38215_ASSG_OVN_NOTFOUND');
4341 hr_utility.raise_error;
4342 end if;
4343 -- Payroll Integration Changes
4344 ----**********************************************************************
4345 -- CHECK # :- Existence of PAYROLL Product
4346 ----**********************************************************************
4347 IF (hr_utility.chk_product_install('GHR','US') = TRUE
4348 and hr_utility.chk_product_install('PAY', 'US') = TRUE
4349 and fnd_profile.value('HR_USER_TYPE')='INT')
4350 THEN
4351 l_pay_intg:=TRUE;
4352 ELSE
4353 l_pay_intg:=FALSE;
4354 END IF;
4355 ----**********************************************************************
4356 IF l_pay_intg THEN
4357
4358 For Proposal_rec IN Cur_proposal_exists
4359 (p_assignment_id,p_date_effective-1)
4360 Loop
4361 l_pay_proposal_id := proposal_rec.proposal_id;
4362 l_sal_admin_ovn := proposal_rec.ovn;
4363 End Loop;
4364
4365 hr_utility.set_location('l_hist basic value not null '||ll_value,100000);
4366
4367 per_asg_del.del(
4368 p_assignment_id => p_assignment_id,
4369 p_effective_start_date => l_effective_start_date,
4370 p_effective_end_date => l_effective_end_date,
4371 p_validation_start_date => l_validation_start_date,
4372 p_validation_end_date => l_validation_end_date,
4373 p_business_group_id => l_business_group_id,
4374 p_object_version_number => l_ovn,
4375 p_effective_date => (p_date_effective -1),
4376 p_datetrack_mode => 'DELETE_NEXT_CHANGE',
4377 p_org_now_no_manager_warning => l_org_now_no_manager_warning );
4378
4379 /* hr_maintain_proposal_api.delete_salary_proposal
4380 (
4381 p_pay_proposal_id => l_pay_proposal_id ,
4382 p_business_group_id => l_business_group_id ,
4383 p_object_version_number => l_sal_admin_ovn ,
4384 p_validate => FALSE ,
4385 p_salary_warning => l_sal_warn
4386 ); */
4387
4388 per_pay_proposals_populate.GET_ELEMENT_ID(
4389 p_assignment_id => p_assignment_id,
4390 p_business_group_id => l_business_group_id,
4391 p_change_date => p_date_effective -1,
4392 p_payroll_value => l_payroll_value,
4393 p_element_entry_id => l_ele_entry_id );
4394
4395 hr_utility.set_location(' The Entry value '||ll_payroll_value,12345);
4396 hr_utility.set_location(' The Entry id '||l_ele_entry_id,12345);
4397
4398 hr_entry_api.delete_element_entry
4399 ('DELETE_NEXT_CHANGE',
4400 p_date_effective - 1,
4401 l_ele_entry_id );
4402
4403 ELSE
4404 per_asg_del.del(
4405 p_assignment_id => p_assignment_id,
4406 p_effective_start_date => l_effective_start_date,
4407 p_effective_end_date => l_effective_end_date,
4408 p_validation_start_date => l_validation_start_date,
4409 p_validation_end_date => l_validation_end_date,
4410 p_business_group_id => l_business_group_id,
4411 p_object_version_number => l_ovn,
4412 p_effective_date => p_date_effective,
4413 p_datetrack_mode => p_dt_mode,
4414 p_org_now_no_manager_warning => l_org_now_no_manager_warning );
4415 END IF;
4416 else
4417 -- raise error, unacceptable datetrack mode
4418 hr_utility.set_message(8301,'GHR_38214_INVALID_DT_MODE_ASSG');
4419 hr_utility.raise_error;
4420 end if;
4421 hr_utility.set_location( 'Leaving : ' || l_proc, 20);
4422 END delete_asgn_row;
4423
4424 -- ---------------------------------------------------------------------------
4425 -- |--------------------------< delete_peopei_row>----------------------------|
4426 -- ---------------------------------------------------------------------------
4427 -- {Start Of Comments}
4428 --
4429 -- Description:
4430 -- This procedure deletes a row from per_people_extra_info table.
4431 --
4432 -- Pre-Requisities:
4433 -- None.
4434 --
4435 -- In Parameters:
4436 -- p_person_extra_info_id -> person_extra_info_id to be deleted.
4437 --
4438 -- Post Success:
4439 -- per_person_extra_info row will have been deleted.
4440 --
4441 -- Post Failure:
4442 -- message will have been displayed to user explaining why the delete could not be completed.
4443 --
4444 -- Developer Implementation Notes:
4445 -- None.
4446 --
4447 -- Access Status:
4448 -- Internal Development Use Only.
4449 --
4450 -- {End Of Comments}
4451 -- ---------------------------------------------------------------------------
4452
4453 PROCEDURE delete_peopei_row( p_person_extra_info_id in varchar2) IS
4454 l_proc varchar2(72) := 'delete_per_people_extra_info_row';
4455 l_ovn number;
4456 cursor c_get_ovn (cp_person_extra_info_id in number) is
4457 SELECT object_version_number
4458 FROM PER_PEOPLE_EXTRA_INFO
4459 WHERE person_extra_info_id = cp_person_extra_info_id ;
4460 BEGIN
4461 hr_utility.set_location( 'Entering : ' || l_proc, 10);
4462 open c_get_ovn(p_person_extra_info_id);
4463 fetch c_get_ovn into l_ovn;
4464 if c_get_ovn%NOTFOUND then
4465 -- can't do delete without object_version_number.
4466 close c_get_ovn;
4467 return;
4468 -- if record is not there means it has already been deleted thru core form.
4469 -- hr_utility.set_message(8301,'GHR_38217_PEI_OVN_NOTFOUND');
4470 -- hr_utility.raise_error;
4471 end if;
4472 pe_pei_del.del(
4473 p_person_extra_info_id => p_person_extra_info_id,
4474 p_object_version_number => l_ovn);
4475 hr_utility.set_location( 'Leaving : ' || l_proc, 20);
4476 END delete_peopei_row;
4477
4478 -- ---------------------------------------------------------------------------
4479 -- |--------------------------< delete_asgnei_row>----------------------------|
4480 -- ---------------------------------------------------------------------------
4481 -- {Start Of Comments}
4482 --
4483 -- Description:
4484 -- This procedure deletes a row from per_assignment_extra_info table.
4485 --
4486 -- Pre-Requisities:
4487 -- None.
4488 --
4489 -- In Parameters:
4490 -- p_assignment_extra_info_id -> assignment_extra_info_id to be deleted.
4491 --
4492 -- Post Success:
4493 -- per_assignment_extra_info row will have been deleted.
4494 --
4495 -- Post Failure:
4496 -- message will have been displayed to user explaining why the delete could not be completed.
4497 --
4498 -- Developer Implementation Notes:
4499 -- None.
4500 --
4501 -- Access Status:
4502 -- Internal Development Use Only.
4503 --
4504 -- {End Of Comments}
4505 -- ---------------------------------------------------------------------------
4506
4507 PROCEDURE delete_asgnei_row( p_assignment_extra_info_id in varchar2) IS
4508 l_proc varchar2(72) := 'delete_per_assignment_extra_info_row';
4509 l_ovn number;
4510 -- this cursor gets the object_version_number for the assignment_extra_info_id passed.
4511 cursor c_get_ovn (cp_assignment_extra_info_id in number) is
4512 SELECT object_version_number
4513 FROM PER_ASSIGNMENT_EXTRA_INFO
4514 WHERE assignment_extra_info_id = cp_assignment_extra_info_id ;
4515 BEGIN
4516 hr_utility.set_location( 'Entering : ' || l_proc, 10);
4517 open c_get_ovn(p_assignment_extra_info_id);
4518 fetch c_get_ovn into l_ovn;
4519 if c_get_ovn%NOTFOUND then
4520 -- can't do delete without object_version_number.
4521 close c_get_ovn;
4522 return;
4523 -- if record is not there means it has already been deleted thru core form.
4524 -- hr_utility.set_message(8301,'GHR_38218_ASGEI_OVN_NOTFOUND');
4525 -- hr_utility.raise_error;
4526 end if;
4527 pe_aei_del.del(
4528 p_assignment_extra_info_id => p_assignment_extra_info_id,
4529 p_object_version_number => l_ovn);
4530 hr_utility.set_location( 'Leaving : ' || l_proc, 20);
4531 END delete_asgnei_row;
4532
4533 -- ---------------------------------------------------------------------------
4534 -- |--------------------------< delete_posnei_row>----------------------------|
4535 -- ---------------------------------------------------------------------------
4536 -- {Start Of Comments}
4537 --
4538 -- Description:
4539 -- This procedure deletes a row from per_position_extra_info table.
4540 --
4541 -- Pre-Requisities:
4542 -- None.
4543 --
4544 -- In Parameters:
4545 -- p_position_extra_info_id -> position_extra_info_id to be deleted.
4546 --
4547 -- Post Success:
4548 -- per_position_extra_info row will have been deleted.
4549 --
4550 -- Post Failure:
4551 -- message will have been displayed to user explaining why the delete could not be completed.
4552 --
4553 -- Developer Implementation Notes:
4554 -- None.
4555 --
4556 -- Access Status:
4557 -- Internal Development Use Only.
4558 --
4559 -- {End Of Comments}
4560 -- ---------------------------------------------------------------------------
4561 PROCEDURE delete_posnei_row( p_position_extra_info_id in varchar2) IS
4562 l_proc varchar2(72) := 'delete_per_position_extra_info_row';
4563 l_ovn number;
4564 -- this cursor gets the object_version_number for the position_extra_info_id passed.
4565 cursor c_get_ovn (cp_position_extra_info_id in number) is
4566 SELECT object_version_number
4567 FROM PER_POSITION_EXTRA_INFO
4568 WHERE position_extra_info_id = cp_position_extra_info_id ;
4569 BEGIN
4570 hr_utility.set_location( 'Entering : ' || l_proc, 10);
4571 open c_get_ovn(p_position_extra_info_id);
4572 fetch c_get_ovn into l_ovn;
4573 if c_get_ovn%NOTFOUND then
4574 -- can't do delete without object_version_number.
4575 close c_get_ovn;
4576 return;
4577 -- if record is not there means it has already been deleted thru core form.
4578 -- hr_utility.set_message(8301,'GHR_38218_ASGEI_OVN_NOTFOUND');
4579 -- hr_utility.raise_error;
4580 end if;
4581 pe_poi_del.del(
4582 p_position_extra_info_id => p_position_extra_info_id,
4583 p_object_version_number => l_ovn);
4584 hr_utility.set_location( 'Leaving : ' || l_proc, 20);
4585 END delete_posnei_row;
4586
4587 -- ---------------------------------------------------------------------------
4588 -- |--------------------------< delete_address_row>----------------------------|
4589 -- ---------------------------------------------------------------------------
4590 -- {Start Of Comments}
4591 --
4592 -- Description:
4593 -- This procedure deletes a row from per_addresses table.
4594 --
4595 -- Pre-Requisities:
4596 -- None.
4597 --
4598 -- In Parameters:
4599 -- p_address_id -> address_id to be deleted.
4600 --
4601 -- Post Success:
4602 -- per_addresses row will have been deleted.
4603 --
4604 -- Post Failure:
4605 -- message will have been displayed to user explaining why the delete could not be completed.
4606 --
4607 -- Developer Implementation Notes:
4608 -- None.
4609 --
4610 -- Access Status:
4611 -- Internal Development Use Only.
4612 --
4613 -- {End Of Comments}
4614 -- ---------------------------------------------------------------------------
4615
4616 PROCEDURE delete_address_row( p_address_id in varchar2) IS
4617
4618 l_proc varchar2(72) := 'delete_per_addresses_row';
4619 l_ovn number;
4620 cursor c_get_ovn (cp_address_id in number) is
4621 SELECT object_version_number
4622 FROM PER_ADDRESSES
4623 WHERE address_id = cp_address_id ;
4624
4625 BEGIN
4626 hr_utility.set_location( 'Entering : ' || l_proc, 10);
4627 open c_get_ovn(p_address_id);
4628 fetch c_get_ovn into l_ovn;
4629 if c_get_ovn%NOTFOUND then
4630 -- can't do delete without object_version_number.
4631 close c_get_ovn;
4632 return;
4633 -- if record is not there means it has already been deleted thru core form.
4634 -- hr_utility.set_message(8301,'GHR_38220_ADDRESS_OVN_NOTFOUND');
4635 -- hr_utility.raise_error;
4636 end if;
4637 hr_utility.set_location('*Deleting p_address_id:' || p_address_id, 12);
4638 per_add_del.del(
4639 p_address_id => p_address_id,
4640 p_object_version_number => l_ovn);
4641 hr_utility.set_location( 'Leaving : ' || l_proc, 20);
4642 END delete_address_row;
4643
4644 -- ---------------------------------------------------------------------------
4645 -- |--------------------------< delete_person_analyses_row>-------------------|
4646 -- ---------------------------------------------------------------------------
4647 -- {Start Of Comments}
4648 --
4649 -- Description:
4650 -- This procedure deletes a row from per_person_analyses table.
4651 --
4652 -- Pre-Requisities:
4653 -- None.
4654 --
4655 -- In Parameters:
4656 -- p_person_analysis_id -> person_analysis_id to be deleted.
4657 --
4658 -- Post Success:
4659 -- per_person_analyses row will have been deleted.
4660 --
4661 -- Post Failure:
4662 -- message will have been displayed to user explaining why the delete could not be completed.
4663 --
4664 -- Developer Implementation Notes:
4665 -- None.
4666 --
4667 -- Access Status:
4668 -- Internal Development Use Only.
4669 --
4670 -- {End Of Comments}
4671 -- ---------------------------------------------------------------------------
4672
4673 PROCEDURE delete_person_analyses_row ( p_person_analysis_id in number) is
4674
4675 l_proc varchar2(72) := 'delete_person_analyses_row';
4676 l_ovn number;
4677 cursor c_get_ovn (cp_person_analysis_id in number) is
4678 SELECT object_version_number
4679 FROM PER_PERSON_ANALYSES
4680 WHERE person_analysis_id = cp_person_analysis_id ;
4681
4682 Begin
4683 hr_utility.set_location( 'Entering : ' || l_proc, 10);
4684 open c_get_ovn(p_person_analysis_id);
4685 fetch c_get_ovn into l_ovn;
4686 if c_get_ovn%NOTFOUND then
4687 -- can't do delete without object_version_number.
4688 -- raise error;
4689 close c_get_ovn;
4690 return;
4691 -- if record is not there means it has already been deleted thru core form.
4692 -- hr_utility.set_message(8301,'GHR_38272_PERSON_ANALYSE_OV_NF');
4693 -- hr_utility.raise_error;
4694 end if;
4695
4696 per_pea_del.del(
4697 p_person_analysis_id => p_person_analysis_id,
4698 p_object_version_number => l_ovn);
4699
4700 End delete_person_analyses_row;
4701
4702 -- ---------------------------------------------------------------------------
4703 -- |--------------------------< delete_appl_row>------------------------------|
4704 -- ---------------------------------------------------------------------------
4705 -- {Start Of Comments}
4706 --
4707 -- Description:
4708 -- This procedure deletes a row from the corresponding application table.
4709 --
4710 -- Pre-Requisities:
4711 -- None.
4712 --
4713 -- In Parameters:
4714 -- p_table_name -> name of table to be deleted from.
4715 -- p_table_pk_id -> pk_id of row to be deleted.
4716 -- p_dt_mode -> datetrack delete mode.
4717 -- p_date_effective -> effective date of delete.
4718 --
4719 -- Post Success:
4720 -- specified application table row will have been deleted.
4721 --
4722 -- Post Failure:
4723 -- message will have been displayed to user explaining why the delete could not be completed.
4724 --
4725 -- Developer Implementation Notes:
4726 -- None.
4727 --
4728 -- Access Status:
4729 -- Internal Development Use Only.
4730 --
4731 -- {End Of Comments}
4732 -- ---------------------------------------------------------------------------
4733 PROCEDURE delete_appl_row( p_table_name in varchar2,
4734 p_table_pk_id in varchar2,
4735 p_dt_mode in varchar2,
4736 p_date_effective in date) IS
4737 l_proc varchar2(72) := 'delete_appl_row';
4738 BEGIN
4739 hr_utility.set_location( 'Entering : ' || l_proc, 10);
4740 hr_utility.set_location(' P_TABLE_NAME:' || p_table_name, 15);
4741 if (lower(p_table_name) = lower(ghr_history_api.g_peop_table)) then
4742 delete_peop_row( p_person_id => p_table_pk_id,
4743 p_dt_mode => p_dt_mode,
4744 p_date_effective => p_date_effective);
4745 -- Added Handling of Position table. Bug# 1252481 11-MAY-2000
4746 elsif (lower(p_table_name) = lower(ghr_history_api.g_posn_table)) then
4747 delete_posn_row( p_position_id => p_table_pk_id,
4748 p_dt_mode => p_dt_mode,
4749 p_date_effective => p_date_effective);
4750 elsif (lower(p_table_name) = lower(ghr_history_api.g_asgn_table)) then
4751 delete_asgn_row( p_assignment_id => p_table_pk_id,
4752 p_dt_mode => p_dt_mode,
4753 p_date_effective => p_date_effective);
4754 elsif (lower(p_table_name) = lower(ghr_history_api.g_peopei_table)) then
4755 delete_peopei_row( p_person_extra_info_id => p_table_pk_id);
4756 elsif (lower(p_table_name) = lower(ghr_history_api.g_asgnei_table)) then
4757 delete_asgnei_row( p_assignment_extra_info_id => p_table_pk_id);
4758 elsif (lower(p_table_name) = lower(ghr_history_api.g_posnei_table)) then
4759 delete_posnei_row( p_position_extra_info_id => p_table_pk_id);
4760 elsif (lower(p_table_name) = lower(ghr_history_api.g_addres_table)) then
4761 delete_address_row( p_address_id => p_table_pk_id);
4762 elsif (lower(p_table_name) = lower(ghr_history_api.g_perana_table)) then
4763 delete_person_analyses_row( p_person_analysis_id => p_table_pk_id);
4764 end if;
4765 hr_utility.set_location( 'Leaving : ' || l_proc, 20);
4766 END delete_appl_row;
4767
4768 -- ---------------------------------------------------------------------------
4769 -- |--------------------------< undo_mark_cancel>------------------------------|
4770 -- ---------------------------------------------------------------------------
4771 -- {Start Of Comments}
4772 --
4773 -- Description:
4774 -- This procedure makes the parent sf52 available for cancellation/correction. This
4775 -- is needed in the case where a correction is cancelled and the parent sf52 has
4776 -- been marked as unavailable for correction/cancellation. This procedure will mark it
4777 -- available again.
4778 --
4779 -- Pre-Requisities:
4780 -- None.
4781 --
4782 -- In Parameters:
4783 -- p_sf52_data -> ghr_pa_requests row of the cancellation being processed.
4784 --
4785 -- Post Success:
4786 -- If this is a cancellation of correction, the parent sf52 will have been marked as
4787 -- available for cancellation/correction again.
4788 --
4789 -- Post Failure:
4790 -- Exception will have ben raised and message displayed.
4791 --
4792 -- Developer Implementation Notes:
4793 -- None.
4794 --
4795 -- Access Status:
4796 -- Internal Development Use Only.
4797 --
4798 -- {End Of Comments}
4799 -- ---------------------------------------------------------------------------
4800
4801 Procedure Undo_Mark_Cancel ( p_sf52_data in ghr_pa_requests%rowtype) is
4802 cursor get_req (cp_pa_request_id number) is
4803 select
4804 pa_request_id,
4805 altered_pa_request_id,
4806 first_noa_id,
4807 second_noa_id,
4808 object_version_number ovn
4809 from ghr_pa_requests
4810 where pa_request_id = cp_pa_request_id;
4811 l_proc varchar2(30):='Undo_Mark_Cancel';
4812 l_sf52_data get_req%rowtype;
4813 Begin
4814 hr_utility.set_location( 'Entering ' || l_proc, 10);
4815 if p_sf52_data.altered_pa_request_id is not null then
4816 -- if it is a correction/cancellation it'll have altered_pa_request_id
4817 hr_utility.set_location( l_proc, 20);
4818 -- fetch cancelled/corrected pa_request record
4819 open get_req( p_sf52_data.altered_pa_request_id);
4820 fetch get_req into l_sf52_data;
4821 if get_req%notfound then
4822 -- this must never happen until data has been corrupted.
4823 hr_utility.set_location( 'Error ' || l_proc, 30);
4824 hr_utility.set_message(8301 , 'GHR_38278_PARENT_SF52_NOT_FND');
4825 hr_utility.raise_error;
4826 end if;
4827 close get_req;
4828 -- Only if a correction is canceled following logic must be executed to mark
4829 -- parent SF52 available for cancellation/correction.
4830 if l_sf52_data.altered_pa_request_id is not null then
4831 hr_utility.set_location( l_proc, 40);
4832 open get_req(l_sf52_data.altered_pa_request_id);
4833 fetch get_req into l_sf52_data;
4834 if get_req%notfound then
4835 hr_utility.set_location( 'Error ' || l_proc , 50);
4836 hr_utility.set_message(8301 , 'GHR_38278_PARENT_SF52_NOT_FND');
4837 hr_utility.raise_error;
4838 end if;
4839 close get_req;
4840 if l_sf52_data.first_noa_id = p_sf52_data.second_noa_id then
4841 hr_utility.set_location( l_proc, 60);
4842 ghr_par_upd.upd
4843 (p_pa_request_id => l_sf52_data.pa_request_id,
4844 p_object_version_number => l_sf52_data.ovn,
4845 p_first_noa_cancel_or_correct => NULL,
4846 p_first_noa_pa_request_id => NULL
4847 );
4848 elsif l_sf52_data.second_noa_id = p_sf52_data.second_noa_id then
4849 hr_utility.set_location( l_proc, 70);
4850 ghr_par_upd.upd
4851 (p_pa_request_id => l_sf52_data.pa_request_id,
4852 p_object_version_number => l_sf52_data.ovn,
4853 p_second_noa_cancel_or_correct => NULL,
4854 p_second_noa_pa_request_id => NULL
4855 );
4856 else
4857 -- This must never be the case where parent SF52 has different
4858 -- NOACs then the correction/cancellation.
4859 hr_utility.set_location( l_proc, 80);
4860 hr_utility.set_message(8301 , 'GHR_38279_PARENT_NOA_IS_DIFF');
4861 hr_utility.raise_error;
4862 null;
4863 end if;
4864 end if;
4865 hr_utility.set_location( l_proc, 90);
4866 end if;
4867 hr_utility.set_location( 'Leaving ' || l_proc, 100);
4868
4869 End Undo_Mark_Cancel;
4870
4871 Procedure convert_shadow_to_sf52 (
4872 p_shadow in ghr_pa_request_shadow%rowtype,
4873 p_sf52 out nocopy ghr_pa_requests%rowtype) is
4874 l_sf52 ghr_pa_requests%rowtype;
4875 Begin
4876
4877 l_sf52 := p_sf52;
4878 p_sf52.pa_request_id := p_shadow.pa_request_id ;
4879 p_sf52.academic_discipline := p_shadow.academic_discipline ;
4880 p_sf52.annuitant_indicator := p_shadow.annuitant_indicator ;
4881 p_sf52.appropriation_code1 := p_shadow.appropriation_code1 ;
4882 p_sf52.appropriation_code2 := p_shadow.appropriation_code2 ;
4883 p_sf52.bargaining_unit_status := p_shadow.bargaining_unit_status ;
4884 p_sf52.citizenship := p_shadow.citizenship ;
4885 -- p_sf52.duty_station_code := p_shadow.duty_station_code ;
4886 p_sf52.duty_station_location_id := p_shadow.duty_station_location_id ;
4887 p_sf52.education_level := p_shadow.education_level ;
4888 -- p_sf52.employee_assignment_id := p_shadow.employee_assignment_id ;
4889 p_sf52.fegli := p_shadow.fegli ;
4890 p_sf52.flsa_category := p_shadow.flsa_category ;
4891 p_sf52.forwarding_address_line1 := p_shadow.forwarding_address_line1 ;
4892 p_sf52.forwarding_address_line2 := p_shadow.forwarding_address_line2 ;
4893 p_sf52.forwarding_address_line3 := p_shadow.forwarding_address_line3 ;
4894 p_sf52.forwarding_country_short_name := p_shadow.forwarding_country_short_name;
4895 p_sf52.forwarding_postal_code := p_shadow.forwarding_postal_code ;
4896 p_sf52.forwarding_region_2 := p_shadow.forwarding_region_2 ;
4897 p_sf52.forwarding_town_or_city := p_shadow.forwarding_town_or_city ;
4898 p_sf52.functional_class := p_shadow.functional_class ;
4899 p_sf52.part_time_hours := p_shadow.part_time_hours ;
4900 p_sf52.pay_rate_determinant := p_shadow.pay_rate_determinant ;
4901 p_sf52.position_occupied := p_shadow.position_occupied ;
4902 p_sf52.retirement_plan := p_shadow.retirement_plan ;
4903 p_sf52.service_comp_date := p_shadow.service_comp_date ;
4904 p_sf52.supervisory_status := p_shadow.supervisory_status ;
4905 p_sf52.tenure := p_shadow.tenure ;
4906 p_sf52.to_ap_premium_pay_indicator := p_shadow.to_ap_premium_pay_indicator ;
4907 p_sf52.to_auo_premium_pay_indicator := p_shadow.to_auo_premium_pay_indicator ;
4908 -- p_sf52.to_au_overtime := p_shadow.to_au_overtime ;
4909 -- p_sf52.to_availability_pay := p_shadow.to_availability_pay ;
4910 p_sf52.to_occ_code := p_shadow.to_occ_code ;
4911 -- p_sf52.to_other_pay_amount := p_shadow.to_other_pay_amount ;
4912 p_sf52.to_position_id := p_shadow.to_position_id ;
4913 p_sf52.to_retention_allowance := p_shadow.to_retention_allowance ;
4914 p_sf52.to_retention_allow_percentage := p_shadow.to_retention_allow_percentage;
4915 p_sf52.to_staffing_differential := p_shadow.to_staffing_differential ;
4916 p_sf52.to_staffing_diff_percentage := p_shadow.to_staffing_diff_percentage ;
4917 p_sf52.to_step_or_rate := p_shadow.to_step_or_rate ;
4918 p_sf52.to_supervisory_differential := p_shadow.to_supervisory_differential ;
4919 p_sf52.to_supervisory_diff_percentage := p_shadow.to_supervisory_diff_percentage ;
4920 p_sf52.veterans_preference := p_shadow.veterans_preference ;
4921 p_sf52.veterans_pref_for_rif := p_shadow.veterans_pref_for_rif ;
4922 p_sf52.veterans_status := p_shadow.veterans_status ;
4923 p_sf52.work_schedule := p_shadow.work_schedule ;
4924 p_sf52.year_degree_attained := p_shadow.year_degree_attained ;
4925 exception when others then
4926 --
4927 -- Reset IN OUT parameters and set OUT parameters
4928 --
4929 p_sf52 := null;
4930 raise;
4931
4932 End;
4933
4934 Procedure convert_sf52_to_shadow (
4935 p_sf52 in ghr_pa_requests%rowtype,
4936 p_shadow out nocopy ghr_pa_request_shadow%rowtype
4937 ) is
4938
4939 Begin
4940
4941 p_shadow.pa_request_id := p_sf52.pa_request_id ;
4942 p_shadow.academic_discipline := p_sf52.academic_discipline ;
4943 p_shadow.annuitant_indicator := p_sf52.annuitant_indicator ;
4944 p_shadow.appropriation_code1 := p_sf52.appropriation_code1 ;
4945 p_shadow.appropriation_code2 := p_sf52.appropriation_code2 ;
4946 p_shadow.bargaining_unit_status := p_sf52.bargaining_unit_status ;
4947 p_shadow.citizenship := p_sf52.citizenship ;
4948 -- p_shadow.duty_station_code := p_sf52.duty_station_code ;
4949 p_shadow.duty_station_location_id := p_sf52.duty_station_location_id ;
4950 p_shadow.education_level := p_sf52.education_level ;
4951 -- p_shadow.employee_assignment_id := p_sf52.employee_assignment_id ;
4952 p_shadow.fegli := p_sf52.fegli ;
4953 p_shadow.flsa_category := p_sf52.flsa_category ;
4954 p_shadow.forwarding_address_line1 := p_sf52.forwarding_address_line1 ;
4955 p_shadow.forwarding_address_line2 := p_sf52.forwarding_address_line2 ;
4956 p_shadow.forwarding_address_line3 := p_sf52.forwarding_address_line3 ;
4957 p_shadow.forwarding_country_short_name := p_sf52.forwarding_country_short_name;
4958 p_shadow.forwarding_postal_code := p_sf52.forwarding_postal_code ;
4959 p_shadow.forwarding_region_2 := p_sf52.forwarding_region_2 ;
4960 p_shadow.forwarding_town_or_city := p_sf52.forwarding_town_or_city ;
4961 p_shadow.functional_class := p_sf52.functional_class ;
4962 p_shadow.part_time_hours := p_sf52.part_time_hours ;
4963 p_shadow.pay_rate_determinant := p_sf52.pay_rate_determinant ;
4964 p_shadow.position_occupied := p_sf52.position_occupied ;
4965 p_shadow.retirement_plan := p_sf52.retirement_plan ;
4966 p_shadow.service_comp_date := p_sf52.service_comp_date ;
4967 p_shadow.supervisory_status := p_sf52.supervisory_status ;
4968 p_shadow.tenure := p_sf52.tenure ;
4969 p_shadow.to_ap_premium_pay_indicator := p_sf52.to_ap_premium_pay_indicator ;
4970 p_shadow.to_auo_premium_pay_indicator := p_sf52.to_auo_premium_pay_indicator ;
4971 -- p_shadow.to_au_overtime := p_sf52.to_au_overtime ;
4972 -- p_shadow.to_availability_pay := p_sf52.to_availability_pay ;
4973 p_shadow.to_occ_code := p_sf52.to_occ_code ;
4974 -- p_shadow.to_other_pay_amount := p_sf52.to_other_pay_amount ;
4975 p_shadow.to_position_id := p_sf52.to_position_id ;
4976 p_shadow.to_retention_allowance := p_sf52.to_retention_allowance ;
4977 p_shadow.to_retention_allow_percentage := p_sf52.to_retention_allow_percentage;
4978 p_shadow.to_staffing_differential := p_sf52.to_staffing_differential ;
4979 p_shadow.to_staffing_diff_percentage := p_sf52.to_staffing_diff_percentage ;
4980
4981 p_shadow.to_step_or_rate := p_sf52.to_step_or_rate ;
4982 p_shadow.to_supervisory_differential := p_sf52.to_supervisory_differential ;
4983 p_shadow.to_supervisory_diff_percentage := p_sf52.to_supervisory_diff_percentage ;
4984 p_shadow.veterans_preference := p_sf52.veterans_preference ;
4985 p_shadow.veterans_pref_for_rif := p_sf52.veterans_pref_for_rif ;
4986 p_shadow.veterans_status := p_sf52.veterans_status ;
4987 p_shadow.work_schedule := p_sf52.work_schedule ;
4988 p_shadow.year_degree_attained := p_sf52.year_degree_attained ;
4989 exception when others then
4990 --
4991 -- Reset IN OUT parameters and set OUT parameters
4992 --
4993 p_shadow := null;
4994 raise;
4995
4996 End;
4997
4998 Procedure build_corrected_sf52(p_pa_request_id in number,
4999 p_noa_code_correct in varchar2,
5000 p_sf52_data_result in out nocopy ghr_pa_requests%rowtype,
5001 p_called_from in varchar2 default null ) is
5002
5003 l_sf52_data_orig ghr_pa_requests%rowtype;
5004 l_sf52_data_step ghr_pa_requests%rowtype;
5005 l_sf52_data_result_rec ghr_pa_requests%rowtype;
5006 l_sf52_dummy ghr_pa_requests%rowtype;
5007 l_sf52_cursor_step_indx number;
5008 l_capped_other_pay number := hr_api.g_number;
5009
5010 -- this cursor selects all rows in the correction chain from ghr_pa_requests
5011 cursor l_sf52_cursor is
5012 select *
5013 from ghr_pa_requests
5014 connect by prior altered_pa_request_id = pa_request_id
5015 start with pa_request_id = p_pa_request_id
5016 order by level desc;
5017 l_shadow_data ghr_pa_request_shadow%rowtype;
5018 l_proc varchar2(30):='build_corrected_sf52';
5019
5020 --Bug 2141522
5021 l_session_var ghr_history_api.g_session_var_type;
5022 -- Bug#5435374 added l_session_var1.
5023 l_session_var1 ghr_history_api.g_session_var_type;
5024 l_session_sf52_rec ghr_pa_requests%rowtype;
5025 cursor c_rpa is
5026 select *
5027 from ghr_pa_requests
5028 where pa_request_id = p_pa_request_id;
5029 --Bug 2141522
5030 cursor c_orig_details_for_ia is
5031 select pa_request_id,pa_notification_id,person_id,
5032 effective_date,from_position_id,
5033 to_position_id
5034 from ghr_pa_requests
5035 where pa_request_id in (
5036 select altered_pa_request_id from
5037 ghr_pa_requests where pa_request_id = p_pa_request_id);
5038
5039 -- Bug#5435374
5040 l_pos_ei_grade_data per_position_extra_info%rowtype;
5041
5042 cursor c_grade_kff (grd_id number) is
5043 select gdf.segment1
5044 ,gdf.segment2
5045 from per_grades grd,
5046 per_grade_definitions gdf
5047 where grd.grade_id = grd_id
5048 and grd.grade_definition_id = gdf.grade_definition_id;
5049
5050 l_retro_eff_date date;
5051 l_retro_pa_request_id ghr_pa_requests.pa_request_id%type;
5052 l_retro_first_noa ghr_nature_of_actions.code%type;
5053 l_retro_second_noa ghr_nature_of_actions.code%type;
5054 l_sf52_ia_rec ghr_pa_requests%rowtype;
5055
5056
5057 begin
5058 hr_utility.set_location('Entering:'|| l_proc, 5);
5059 l_sf52_data_result_rec := p_sf52_data_result;
5060 -- ghr_history_api.get_g_session_var(l_session_var);
5061 --Bug 2141522
5062 -- set values of session variables
5063 open c_rpa;
5064 fetch c_rpa into l_session_sf52_rec;
5065 close c_rpa;
5066
5067 l_session_var.pa_request_id := p_pa_request_id;
5068 l_session_var.noa_id := l_session_sf52_rec.second_noa_id;
5069 l_session_var.fire_trigger := 'N';
5070 l_session_var.date_Effective := l_session_sf52_rec.effective_date;
5071 l_session_var.person_id := l_session_sf52_rec.person_id;
5072 l_session_var.program_name := 'sf50';
5073 l_session_var.assignment_id := l_session_sf52_rec.employee_assignment_id;
5074 l_session_var.altered_pa_request_id := l_session_sf52_rec.altered_pa_request_id;
5075 l_session_var.noa_id_correct := l_session_sf52_rec.second_noa_id;
5076 ghr_history_api.set_g_session_var(l_session_var);
5077 --Bug 2141522
5078
5079 -- loop through all corrections in the correction chain, incrementally applying them by
5080 -- calling apply_corrections procedure.
5081 open l_sf52_cursor ;
5082 l_sf52_cursor_step_indx := 0;
5083 loop
5084 -- initialize l_sf52_data_step to nulls;
5085 l_sf52_data_step := l_sf52_dummy;
5086 -- l_sf52_data_step holds intermediate incremental values for final corrected record that is
5087 -- being built.
5088 fetch l_sf52_cursor into l_sf52_data_step;
5089 exit when l_sf52_cursor%notfound;
5090 l_sf52_cursor_step_indx := l_sf52_cursor_step_indx +1;
5091 if ( l_sf52_cursor_step_indx = 1) then
5092 hr_utility.set_location('Fetch l_sf52_data_step original :'|| l_proc, 10);
5093 l_sf52_data_orig := l_sf52_data_step;
5094 p_sf52_data_result := l_sf52_data_step;
5095 -- Bug 3228557 Added the following IF condition. In case of NPA Printing
5096 -- Pass parameter 'NPA' to the procedure call to refresh_req_shadow.
5097 IF NVL(p_called_from,hr_api.g_varchar2) = 'NPA' THEN
5098 hr_utility.set_location('Inside NPA printing',10);
5099 ghr_process_sf52.refresh_req_shadow(p_sf52_data=>p_sf52_data_result,
5100 p_shadow_data=>l_shadow_data,
5101 p_process_type => 'NPA');
5102 ELSE
5103 hr_utility.set_location('Calling Refresh_req_shadow ',10);
5104 ghr_process_sf52.refresh_req_shadow(p_sf52_data=>p_sf52_data_result,
5105 p_shadow_data=>l_shadow_data);
5106 END IF;
5107 -- Bug 3228557 Skip Pay Calculation in case of NPA report printing.
5108 IF nvl(p_called_from,hr_api.g_varchar2) NOT IN ('FROM_PAYCAL','NPA') THEN
5109 ghr_process_sf52.redo_pay_calc( p_sf52_rec => p_sf52_data_result,
5110 p_capped_other_pay => l_capped_other_pay);
5111 END IF;
5112 hr_utility.set_location('assignment_id of original =' || l_sf52_data_step.employee_assignment_id, 14);
5113 hr_utility.set_location(l_proc || 'pa_request_id of original= ' || l_sf52_data_step.pa_request_id,26);
5114 -- check if original action in correction chain was a dual action. If so, determine which of
5115 -- the two actions this correction is for and call ghr_process_sf52.assign_new_rg to null out columns not having
5116 -- to do with the noa we are correcting.
5117 if (p_sf52_data_result.second_noa_id is not null) then
5118 hr_utility.set_location('original sf52 is dual action :'|| l_proc, 11);
5119 ---- commented the below if condition because is is compared against NOAC Code
5120 ---- Dual action correction need to be tested.
5121 ---- if (p_noa_code_correct = p_sf52_data_result.second_noa_id) then
5122 if (p_noa_code_correct = p_sf52_data_result.second_noa_code) then
5123 hr_utility.set_location('Correcting second action in dual action:'|| l_proc, 12);
5124 ghr_process_sf52.assign_new_rg(p_action_num => 2,
5125 p_pa_req => p_sf52_data_result);
5126 else
5127 hr_utility.set_location('Correcting first action in dual action:'|| l_proc, 13);
5128 ghr_process_sf52.assign_new_rg(p_action_num => 1,
5129 p_pa_req => p_sf52_data_result);
5130 -- if first action is 893, then we need to derive to_columns as both actions of
5131 -- the dual action potentially could have changed the to fields (in particular,
5132 -- to_step_or_rate) so we need to determine what the to_fields should be or the first action.
5133 if (p_sf52_data_result.first_noa_code = 893) then
5134 ghr_process_sf52.derive_to_columns(p_sf52_data => p_sf52_data_result);
5135 end if;
5136 end if;
5137 end if;
5138 -- Nullfy columns which must not be passed
5139 p_sf52_data_result.pa_notification_id := NULL;
5140 p_sf52_data_result.agency_code := NULL;
5141 p_sf52_data_result.approval_date := NULL;
5142 p_sf52_data_result.approving_official_work_title:= NULL;
5143 p_sf52_data_result.employee_dept_or_agency := NULL;
5144 p_sf52_data_result.from_agency_code := NULL;
5145 p_sf52_data_result.from_agency_desc := NULL;
5146 p_sf52_data_result.from_office_symbol := NULL;
5147 p_sf52_data_result.personnel_office_id := NULL;
5148 p_sf52_data_result.to_office_symbol := NULL;
5149 else
5150 hr_utility.set_location('Fetch l_sf52_data_step loop :'|| l_proc, 15);
5151 -- all corrections will have the original sf52 information in the 2nd noa columns, so
5152 -- copy that information to 1st noa columns.
5153 ghr_process_sf52.copy_2ndNoa_to_1stNoa(l_sf52_data_step);
5154 -- null the second noa columns since we don't want anything to be done with these now.
5155 ghr_process_sf52.null_2ndNoa_cols(l_sf52_data_step);
5156 hr_utility.set_location(l_proc || 'pa_request_id before correction= ' || l_sf52_data_step.pa_request_id,16);
5157 hr_utility.set_location(l_proc || 'assignment id before correction= ' || l_sf52_data_step.employee_assignment_id,17);
5158 -- Start Intervening Actions Processing
5159 -- Processing added to assign the From side details to
5160 -- To side if it is a Intervening action and
5161 -- Original action from position_id = to position id
5162 -- Fetch the original action details
5163 FOR c_orig_det_rec in c_orig_details_for_ia
5164 LOOP
5165 hr_utility.set_location('Inside the orig_details for loop' ,15);
5166 hr_utility.set_location('orig pa_request_id'||c_orig_det_rec.pa_request_id ,15);
5167 hr_utility.set_location('orig pa_notification_id'||c_orig_det_rec.pa_notification_id ,15);
5168 hr_utility.set_location('orig person_id'||c_orig_det_rec.person_id ,15);
5169 hr_utility.set_location('orig from_position_id'||c_orig_det_rec.from_position_id ,15);
5170 hr_utility.set_location('orig to_position_id'||c_orig_det_rec.to_position_id ,15);
5171 hr_utility.set_location('orig effective_date'||c_orig_det_rec.effective_date ,15);
5172 --BUG #7216635 added the parameter p_noa_id_correct
5173 GHR_APPROVED_PA_REQUESTS.determine_ia(
5174 p_pa_request_id => c_orig_det_rec.pa_request_id,
5175 p_pa_notification_id => c_orig_det_rec.pa_notification_id,
5176 p_person_id => c_orig_det_rec.person_id,
5177 p_effective_date => c_orig_det_rec.effective_date,
5178 p_noa_id_correct => l_session_var.noa_id_correct,
5179 p_retro_pa_request_id => l_retro_pa_request_id,
5180 p_retro_eff_date => l_retro_eff_date,
5181 p_retro_first_noa => l_retro_first_noa,
5182 p_retro_second_noa => l_retro_second_noa);
5183 hr_utility.set_location('retro effective_date is '||l_retro_eff_date ,16);
5184 -- Bug#2521744 Splitting the single if condition into 2 separate if conditions.
5185 IF l_retro_eff_date is NOT NULL THEN
5186 IF c_orig_det_rec.from_position_id
5187 = c_orig_det_rec.to_position_id THEN
5188 -- copy the from details
5189 -- copy the from details
5190 hr_utility.set_location('Its a Intervening Action ' ,16);
5191 hr_utility.set_location('pa_request_id passed to get_sf52_to_det '||p_pa_request_id ,17);
5192
5193 get_sf52_to_details_for_ia
5194 (p_pa_request_id => p_pa_request_id,
5195 p_retro_eff_date => l_retro_eff_date,
5196 p_sf52_ia_rec => p_sf52_data_result);
5197 get_sf52_to_othpays_for_ia(p_sf52_ia_rec => p_sf52_data_result);
5198 ghr_process_sf52.print_sf52('result aft get_sf52_to_details_for_ia',
5199 p_sf52_data_result );
5200 ELSE
5201 -- Verify whether the original action is one of the salary change actions
5202 -- If yes, check whether the other pay related elements are present or not
5203 -- as on the effective date. If they are not present, set that other pay comp
5204 -- to_value as null.
5205 get_sf52_to_othpays_for_ia(p_sf52_ia_rec => p_sf52_data_result);
5206 ghr_process_sf52.print_sf52('Aft get_sf52_to_other_pay_det_for_ia in else',
5207 p_sf52_data_result );
5208 END IF;
5209 END IF;
5210 END LOOP;
5211 ghr_process_sf52.print_sf52('step aft get_sf52_to_details_for_ia',
5212 l_sf52_data_step);
5213 apply_correction( p_sf52rec_correct => l_sf52_data_step,
5214 p_corr_pa_request_id => p_pa_request_id,
5215 p_sf52rec => p_sf52_data_result );
5216
5217 if (l_sf52_data_step.first_noa_code = '352') then
5218 p_sf52_data_result.to_position_org_line1 :=
5219 ghr_pa_requests_pkg2.get_agency_code_to(
5220 p_pa_request_id => l_sf52_data_step.pa_request_id,
5221 p_noa_id => l_sf52_data_step.first_noa_id);
5222 -- Bug#2681726 In case of Realignment print all the Position Org Lines.
5223 elsif (l_sf52_data_step.first_noa_code = '790' ) then
5224 ghr_pa_requests_pkg.get_rei_org_lines(
5225 p_pa_request_id => p_sf52_data_result.pa_request_id,
5226 p_organization_id => p_sf52_data_result.to_organization_id,
5227 p_position_org_line1 => p_sf52_data_result.to_position_org_line1,
5228 p_position_org_line2 => p_sf52_data_result.to_position_org_line2,
5229 p_position_org_line3 => p_sf52_data_result.to_position_org_line3,
5230 p_position_org_line4 => p_sf52_data_result.to_position_org_line4,
5231 p_position_org_line5 => p_sf52_data_result.to_position_org_line5,
5232 p_position_org_line6 => p_sf52_data_result.to_position_org_line6);
5233 end if;
5234
5235 -- Recalculating Retention Allowance
5236 -- Recalculate Retention allowance if it is a OTHER_PAY action
5237 -- and Correction of Intervening Action
5238 if p_sf52_data_result.noa_family_code = 'OTHER_PAY' and
5239 l_retro_eff_date is NOT NULL and
5240 p_sf52_data_result.to_retention_allow_percentage is not null then
5241 --Modified for FWS
5242 IF p_sf52_data_result.to_pay_basis ='PH' THEN
5243 p_sf52_data_result.to_retention_allowance :=
5244 TRUNC(p_sf52_data_result.to_basic_pay * p_sf52_data_result.to_retention_allow_percentage/100,2);
5245 ELSE
5246 p_sf52_data_result.to_retention_allowance :=
5247 TRUNC(p_sf52_data_result.to_basic_pay * p_sf52_data_result.to_retention_allow_percentage/100,0);
5248 END IF;
5249 --FWS END
5250 p_sf52_data_result.to_other_pay_amount :=
5251 nvl(p_sf52_data_result.to_au_overtime,0) +
5252 nvl(p_sf52_data_result.to_availability_pay,0) +
5253 nvl(p_sf52_data_result.to_retention_allowance,0) +
5254 nvl(p_sf52_data_result.to_supervisory_differential,0) +
5255 nvl(p_sf52_data_result.to_staffing_differential,0);
5256 p_sf52_data_result.to_total_salary :=
5257 p_sf52_data_result.to_adj_basic_pay + p_sf52_data_result.to_other_pay_amount;
5258 if p_sf52_data_result.to_other_pay_amount = 0 then
5259 p_sf52_data_result.to_other_pay_amount := null;
5260 end if;
5261 end if;
5262 hr_utility.set_location( l_proc || 'assignment_id after correction=' || p_sf52_data_result.employee_assignment_id ,18);
5263 hr_utility.set_location('Applied corrections :'|| l_proc, 20);
5264 end if;
5265 end loop;
5266 close l_sf52_cursor;
5267
5268 -- Bug#5435374 If the from and to position ids are same, verify the grade details.
5269 IF p_sf52_data_result.from_position_id = p_sf52_data_result.to_position_id THEN
5270
5271 -- Reinitializing the session variables to get the valid grade as on the
5272 -- effective date.
5273 ghr_history_api.get_g_session_var(l_session_var);
5274 ghr_history_api.reinit_g_session_var;
5275 l_session_var1.date_Effective := l_session_var.date_Effective;
5276 l_session_var1.person_id := l_session_var.person_id;
5277 l_session_var1.assignment_id := l_session_var.assignment_id;
5278 l_session_var1.fire_trigger := 'N';
5279 l_session_var1.program_name := 'sf50';
5280 ghr_history_api.set_g_session_var(l_session_var1);
5281
5282 -- Retrieve the Grade info from the POI history table
5283 ghr_history_fetch.fetch_positionei(
5284 p_position_id => p_sf52_data_result.to_position_id,
5285 p_information_type => 'GHR_US_POS_VALID_GRADE',
5286 p_date_effective => p_sf52_data_result.effective_date,
5287 p_pos_ei_data => l_pos_ei_grade_data);
5288
5289 -- Reset the session variables after getting the date effective grade value.
5290 ghr_history_api.reinit_g_session_var;
5291 ghr_history_api.set_g_session_var(l_session_var);
5292
5293 IF l_pos_ei_grade_data.position_extra_info_id IS NOT NULL THEN
5294 hr_utility.set_location('GL: to grd id:'||p_sf52_data_result.to_grade_id,30);
5295 hr_utility.set_location('GL: pos ei grd:'||l_pos_ei_grade_data.poei_information3,40);
5296 IF l_pos_ei_grade_data.poei_information3 <> p_sf52_data_result.to_grade_id THEN
5297 --Bug# 5638869
5298 --p_sf52_data_result.to_grade_id := l_pos_ei_grade_data.poei_information3;
5299 l_pos_ei_grade_data.poei_information3 := p_sf52_data_result.to_grade_id;
5300 --Bug# 5638869
5301 FOR c_grade_kff_rec IN c_grade_kff (p_sf52_data_result.to_grade_id)
5302 LOOP
5303 p_sf52_data_result.to_pay_plan := c_grade_kff_rec.segment1 ;
5304 p_sf52_data_result.to_grade_or_level := c_grade_kff_rec.segment2;
5305 EXIT;
5306 END LOOP;
5307 END IF;
5308 END IF;
5309 END IF;
5310 -- Bug#5435374 End of bug fix.
5311
5312 ghr_process_sf52.print_sf52('Result after apply_correction ' , p_sf52_data_result);
5313
5314 hr_utility.set_location(' Leaving:'||l_proc, 25);
5315 exception when others then
5316 --
5317 -- Reset IN OUT parameters and set OUT parameters
5318 --
5319 p_sf52_data_result := l_sf52_data_result_rec;
5320 raise;
5321
5322 end build_corrected_sf52;
5323
5324 -- Following 4 procedures and functions are created to handle correction RPAs
5325 -- In reports.
5326
5327 Procedure populate_corrected_sf52(p_pa_request_id in number,
5328 p_noa_code_correct in varchar2)
5329 is
5330 l_session_var ghr_history_api.g_session_var_type;
5331 l_sf52_data ghr_pa_requests%ROWTYPE;
5332
5333
5334 FUNCTION get_record_category(p_sf52_record IN ghr_pa_requests%ROWTYPE)
5335 RETURN NUMBER IS
5336 CURSOR c_noa_fam_code(c_noa_id NUMBER) is
5337 select fam.noa_family_code family_code
5338 from ghr_noa_families fam
5339 where fam.nature_of_action_id = c_noa_id;
5340
5341 l_found VARCHAR2(10) := 'FALSE';
5342 l_proc VARCHAR2(30) := 'get_record_category';
5343
5344 BEGIN
5345 hr_utility.set_location('Entering: '||l_proc,0);
5346 IF p_sf52_record.from_position_id IS NOT NULL AND
5347 p_sf52_record.from_position_title IS NOT NULL AND
5348 p_sf52_record.from_position_number IS NOT NULL AND
5349 -- p_sf52_record.from_position_seq_no IS NOT NULL AND
5350 p_sf52_record.from_pay_plan IS NOT NULL AND
5351 p_sf52_record.from_grade_or_level IS NOT NULL AND
5352 p_sf52_record.from_step_or_rate IS NOT NULL AND
5353 p_sf52_record.from_pay_basis IS NOT NULL AND
5354 p_sf52_record.from_basic_pay IS NOT NULL AND
5355 p_sf52_record.from_adj_basic_pay IS NOT NULL AND
5356 p_sf52_record.from_locality_adj IS NOT NULL AND
5357 p_sf52_record.from_total_salary IS NOT NULL AND
5358 p_sf52_record.to_position_id IS NOT NULL AND
5359 p_sf52_record.to_position_title IS NOT NULL AND
5360 p_sf52_record.to_position_number IS NOT NULL AND
5361 -- p_sf52_record.to_position_seq_no IS NOT NULL AND
5362 p_sf52_record.to_pay_plan IS NOT NULL AND
5363 p_sf52_record.to_grade_or_level IS NOT NULL AND
5364 p_sf52_record.to_step_or_rate IS NOT NULL AND
5365 p_sf52_record.to_pay_basis IS NOT NULL AND
5366 p_sf52_record.to_basic_pay IS NOT NULL AND
5367 p_sf52_record.to_adj_basic_pay IS NOT NULL AND
5368 p_sf52_record.to_locality_adj IS NOT NULL AND
5369 p_sf52_record.to_total_salary IS NOT NULL THEN
5370 hr_utility.set_location('Leaving: '||l_proc,10);
5371 -- Added the following code as there are some 2 category corr. to Other Pay
5372 -- actions where all the above fields are not null. but, still the record belongs
5373 -- to 2nd category if the correction is dummy correction. In this case,
5374 -- to_au_overtime/to_availability pay is null.
5375 FOR noa_fam_rec IN c_noa_fam_code(p_sf52_record.second_noa_id)
5376 LOOP
5377 hr_utility.set_location(' OTHER PAY Family Code = '||noa_fam_rec.family_code,15);
5378 IF noa_fam_rec.family_code IN ('OTHER_PAY') THEN
5379 l_found := 'TRUE';
5380 EXIT;
5381 END IF;
5382 END LOOP;
5383 IF l_found = 'TRUE' THEN
5384 IF (p_sf52_record.second_noa_code = '818' AND p_sf52_record.to_au_overtime IS NULL) OR
5385 (p_sf52_record.second_noa_code = '819' AND p_sf52_record.to_availability_pay IS NULL) THEN
5386 Return 2;
5387 ELSE
5388 Return 3;
5389 END IF;
5390 ELSE
5391 Return 3;
5392 END IF;
5393
5394 ELSIF
5395 p_sf52_record.from_position_id IS NOT NULL AND
5396 p_sf52_record.from_position_title IS NOT NULL AND
5397 p_sf52_record.from_position_number IS NOT NULL AND
5398 -- p_sf52_record.from_position_seq_no IS NOT NULL AND
5399 p_sf52_record.from_pay_plan IS NOT NULL AND
5400 p_sf52_record.from_grade_or_level IS NOT NULL AND
5401 p_sf52_record.from_step_or_rate IS NOT NULL AND
5402 p_sf52_record.from_pay_basis IS NOT NULL AND
5403 p_sf52_record.from_basic_pay IS NOT NULL AND
5404 p_sf52_record.from_adj_basic_pay IS NOT NULL AND
5405 p_sf52_record.from_locality_adj IS NOT NULL AND
5406 p_sf52_record.from_total_salary IS NOT NULL THEN
5407 -- For correction to Separation actions also, from side data is
5408 -- NOT NULL and TO SIDE DATA IS NULL. So, in such case, return
5409 -- value should be 3.
5410 IF p_sf52_record.to_position_id IS NULL AND
5411 p_sf52_record.to_position_title IS NULL AND
5412 p_sf52_record.to_position_number IS NULL AND
5413 -- p_sf52_record.to_position_seq_no IS NULL AND
5414 p_sf52_record.to_pay_plan IS NULL AND
5415 p_sf52_record.to_grade_or_level IS NULL AND
5416 p_sf52_record.to_step_or_rate IS NULL AND
5417 p_sf52_record.to_pay_basis IS NULL AND
5418 p_sf52_record.to_basic_pay IS NULL AND
5419 p_sf52_record.to_adj_basic_pay IS NULL AND
5420 p_sf52_record.to_locality_adj IS NULL AND
5421 p_sf52_record.to_total_salary IS NULL THEN
5422 FOR noa_fam_rec IN c_noa_fam_code(p_sf52_record.second_noa_id)
5423 LOOP
5424 hr_utility.set_location(' SEP Family Code = '||noa_fam_rec.family_code,15);
5425 IF noa_fam_rec.family_code IN ('SEPARATION','NON_PAY_DUTY_STATUS',
5426 'AWARD','GHR_INCENTIVE') THEN
5427 l_found := 'TRUE';
5428 EXIT;
5429 END IF;
5430 END LOOP;
5431 IF l_found = 'TRUE' THEN
5432 hr_utility.set_location('Leaving: '||l_proc,20);
5433 Return 3;
5434 ELSE
5435 hr_utility.set_location('Leaving: '||l_proc,30);
5436 Return 2;
5437 END IF;
5438 ELSE
5439 hr_utility.set_location('Leaving: '||l_proc,40);
5440 Return 2;
5441 END IF;
5442 ELSE
5443 -- For correction to Appointment actions also, from side data is
5444 -- NULL and TO SIDE DATA IS NOT NULL. So, in such case, return
5445 -- value should be 3.
5446 IF p_sf52_record.from_position_id IS NULL AND
5447 p_sf52_record.from_position_title IS NULL AND
5448 p_sf52_record.from_position_number IS NULL AND
5449 -- p_sf52_record.from_position_seq_no IS NULL AND
5450 p_sf52_record.from_pay_plan IS NULL AND
5451 p_sf52_record.from_grade_or_level IS NULL AND
5452 p_sf52_record.from_step_or_rate IS NULL AND
5453 p_sf52_record.from_pay_basis IS NULL AND
5454 p_sf52_record.from_basic_pay IS NULL AND
5455 p_sf52_record.from_adj_basic_pay IS NULL AND
5456 p_sf52_record.from_locality_adj IS NULL AND
5457 p_sf52_record.from_total_salary IS NULL AND
5458 p_sf52_record.to_position_id IS NOT NULL AND
5459 p_sf52_record.to_position_title IS NOT NULL AND
5460 p_sf52_record.to_position_number IS NOT NULL AND
5461 -- p_sf52_record.to_position_seq_no IS NOT NULL AND
5462 p_sf52_record.to_pay_plan IS NOT NULL AND
5463 p_sf52_record.to_grade_or_level IS NOT NULL AND
5464 p_sf52_record.to_step_or_rate IS NOT NULL AND
5465 p_sf52_record.to_pay_basis IS NOT NULL AND
5466 p_sf52_record.to_basic_pay IS NOT NULL AND
5467 p_sf52_record.to_adj_basic_pay IS NOT NULL AND
5468 p_sf52_record.to_locality_adj IS NOT NULL AND
5469 p_sf52_record.to_total_salary IS NOT NULL THEN
5470 hr_utility.set_location('Leaving: '||l_proc,40);
5471 Return 3;
5472 ELSE
5473 hr_utility.set_location('Leaving: '||l_proc,50);
5474 Return 1;
5475 END IF;
5476 END IF;
5477 END get_record_category;
5478
5479 BEGIN
5480 -- Get the CORRECTION RPA record from ghr_pa_requests table.
5481 SELECT *
5482 INTO l_sf52_data
5483 FROM ghr_pa_requests
5484 WHERE pa_request_id = p_pa_request_id;
5485 -- Check the record's category..
5486 -- If record belongs to category 1 or 2 then call build_corrected_sf52 with NPA parameter.
5487 -- BUG#3958914 Added the OR Conidtions
5488 IF (get_record_category(l_sf52_data) IN (1,2) OR
5489 ( l_sf52_data.appropriation_code1 IS NULL OR l_sf52_data.appropriation_code2 IS NULL OR
5490 l_sf52_data.annuitant_indicator is NULL OR l_sf52_data.fegli is NULL OR
5491 l_sf52_data.retirement_plan is NULL OR l_sf52_data.service_comp_date IS NULL OR
5492 l_sf52_data.tenure IS NULL OR l_sf52_data.veterans_preference IS NULL OR
5493 l_sf52_data.veterans_pref_for_rif IS NULL
5494 )
5495 )THEN
5496 l_session_var.pa_request_id := l_sf52_data.pa_request_id;
5497 l_session_var.noa_id := l_sf52_data.second_noa_id;
5498 -- No triggers should be fired as cancellation can not be corrected or cancelled
5499 -- so none of the changes will be saved.
5500 l_session_var.fire_trigger := 'N';
5501 l_session_var.date_Effective := l_sf52_data.effective_date;
5502 l_session_var.person_id := l_sf52_data.person_id;
5503 l_session_var.program_name := 'GHRSF50';
5504 l_session_var.assignment_id := l_sf52_data.employee_assignment_id;
5505 l_session_var.altered_pa_request_id := l_sf52_data.altered_pa_request_id;
5506 l_session_var.noa_id_correct := l_sf52_data.second_noa_id;
5507 ghr_history_api.set_g_session_var(l_session_var);
5508 ---Bug 5220727
5509 IF l_sf52_data.second_noa_code <> '825' then
5510 build_corrected_sf52(p_pa_request_id, p_noa_code_correct, sf52_corr_rec,'NPA');
5511 ELSE
5512 sf52_corr_rec := l_sf52_data;
5513 END IF;
5514 ELSE
5515 hr_utility.set_location('assinging the original record',20);
5516 sf52_corr_rec := l_sf52_data;
5517 END IF;
5518 end populate_corrected_sf52;
5519
5520 Function get_date_column(p_value in varchar2) return date is
5521 p_rows integer;
5522 l_cursor integer;
5523 begin
5524 l_cursor := dbms_sql.open_cursor;
5525 dbms_sql.parse(l_cursor,
5526 'begin ' ||
5527 ' ghr_corr_canc_sf52.l_date_result := ghr_corr_canc_sf52.sf52_corr_rec.' || p_value || '; ' ||
5528 'end;', dbms_sql.v7);
5529 p_rows := dbms_sql.execute(l_cursor);
5530 dbms_sql.close_cursor(l_cursor);
5531 return l_date_result;
5532 end get_date_column;
5533
5534 Function get_number_column(p_value in varchar2) return number is
5535 p_rows integer;
5536 l_cursor integer;
5537 begin
5538 l_cursor := dbms_sql.open_cursor;
5539 dbms_sql.parse(l_cursor,
5540 'begin ' ||
5541 ' ghr_corr_canc_sf52.l_number_result := ghr_corr_canc_sf52.sf52_corr_rec.' || p_value || '; ' ||
5542 'end;', dbms_sql.v7);
5543 p_rows := dbms_sql.execute(l_cursor);
5544 dbms_sql.close_cursor(l_cursor);
5545 return l_number_result;
5546 end get_number_column;
5547
5548 Function get_varchar2_column(p_value in varchar2) return varchar2 is
5549 p_rows integer;
5550 l_cursor integer;
5551 begin
5552 l_cursor := dbms_sql.open_cursor;
5553 dbms_sql.parse(l_cursor,
5554 'begin ' ||
5555 ' ghr_corr_canc_sf52.l_varchar2_result := ghr_corr_canc_sf52.sf52_corr_rec.' || p_value || '; ' ||
5556 'end;', dbms_sql.v7);
5557 p_rows := dbms_sql.execute(l_cursor);
5558 dbms_sql.close_cursor(l_cursor);
5559 return l_varchar2_result;
5560 end get_varchar2_column;
5561
5562
5563 -- Procedure IF_ZAP_ELE_ENT
5564 -- Description : This procedure will be called from Cancel_Other_Family
5565 -- when we know that there does not exist a pre-record (by looking into history)
5566 -- for element_entry table and it needs to figure out if it can zap the element entry or not
5567 -- Logic : If element entry type is Non-recurring then it can be zapped
5568 -- But re-curring elements can be zapped only if there are no following records in history table
5569 -- for element entry values ie only one transaction touched element entry and element entry values
5570 --
5571 Procedure IF_ZAP_ELE_ENT(
5572 p_element_entry_id in number,
5573 p_effective_start_date in date,
5574 p_pa_history_id in number,
5575 p_result out nocopy Boolean) is
5576
5577 cursor c_get_ele_ent
5578 (cp_element_entry_id in number,
5579 cp_effective_start_date in date) is
5580 select
5581 pet.effective_start_date,
5582 pet.effective_end_date,
5583 pet.processing_type
5584 from
5585 pay_element_types_f pet, pay_element_links_f pel, pay_element_entries_f pee
5586 where pee.element_entry_id = cp_element_entry_id and
5587 pee.element_link_id = pel.element_link_id and
5588 pet.element_type_id = pel.element_type_id and
5589 cp_effective_start_date between pee.effective_start_date and pee.effective_end_date and
5590 cp_effective_start_date between pet.effective_start_date and pet.effective_end_date and
5591 cp_effective_start_date between pel.effective_start_date and pel.effective_end_date ;
5592
5593 /* cursor get_root_min_hist_id (cp_pa_history_id in number) is
5594 select min(pa_history_id)
5595 from ghr_pa_history
5596 where pa_request_id = (select min(pa_request_id)
5597 from ghr_pa_requests
5598 start with pa_request_id = (select pa_request_id -- Bug# 1253981
5599 from ghr_pa_history
5600 where pa_history_id = cp_pa_history_id)
5601 connect by prior altered_pa_request_id = pa_request_id)
5602 -- connect by pa_request_id = altered_pa_request_id)
5603 and nature_of_action_id = (select nature_of_action_id
5604 from ghr_pa_history
5605 where pa_history_id = cp_pa_history_id); */
5606
5607 -- Bug 3694358
5608 -- In the cursor get_root_min_hist_id, start with - connect by is removed as it always returns the original
5609 -- action as the min. and no need to loop through all the correction actions and find the min pa_request_id
5610 /*Bug 6868486 below cursor changed*/
5611 cursor get_root_min_hist_id (cp_pa_history_id in number) is
5612 select min(pa_history_id)
5613 from ghr_pa_history
5614 where pa_request_id = (select pa_request_id -- Bug# 1253981
5615 from ghr_pa_history
5616 where pa_history_id = cp_pa_history_id);
5617
5618 -- Bug 3694358
5619 -- Changed connect by pa_request_id = altered_pa_request_id
5620 -- to connect by altered_pa_request_id = pa_request_id
5621 -- This cursor will fetch element entr value records, for a given element entry, that
5622 -- were created after the c_root_hist_id
5623 Cursor c_history(
5624 c_information1 varchar2,
5625 c_effective_date date,
5626 c_root_hist_id number) is
5627 Select pa_history_id
5628 from ghr_pa_history pah
5629 where table_name = ghr_history_api.g_eleevl_table
5630 and information5 = c_information1
5631 and (effective_date > c_effective_date or
5632 (effective_date = c_effective_date and
5633 c_root_hist_id <
5634 (select min(pa_history_id)
5635 from ghr_pa_history
5636 where pa_request_id =
5637 (select min(pa_request_id)
5638 from ghr_pa_requests
5639 connect by prior altered_pa_request_id = pa_request_id
5640 start with pa_request_id = pah.pa_request_id))));
5641
5642 l_ele c_get_ele_ent%rowtype;
5643 l_root_hist_id number;
5644 l_dummy number;
5645 l_ret_val Boolean:=FALSE;
5646 l_proc varchar2(30):='IF_ZAP_ELE_ENT';
5647 Begin
5648
5649 hr_utility.set_location('Entering : ' || l_proc, 5);
5650 -- Find Element Type
5651 open c_get_ele_ent(
5652 p_element_entry_id,
5653 p_effective_start_date);
5654 fetch c_get_ele_ent into l_ele;
5655 if c_get_ele_ent%notfound then
5656 close c_get_ele_ent;
5657 -- This case must not happen.
5658 -- Not raising error. As it must be handled in calling routine
5659 hr_utility.set_location(' Could not find Element Type. Must not happen !!' || l_proc, 10);
5660 l_ret_val := FALSE;
5661 else
5662 if l_ele.processing_type = 'N' then
5663 -- Non-recurring elemnt can be zapped.
5664 close c_get_ele_ent;
5665 l_ret_val := TRUE;
5666 hr_utility.set_location('Non recurring CAN ZAP' || l_proc, 20);
5667 else
5668 -- For recurring
5669 close c_get_ele_ent;
5670 open get_root_min_hist_id (p_pa_history_id);
5671 fetch get_root_min_hist_id into l_root_hist_id;
5672 if get_root_min_hist_id%notfound then
5673 close get_root_min_hist_id;
5674 hr_utility.set_location(' Root Hist ID Not found!! Must not happen' || l_proc, 30);
5675 l_ret_val := FALSE;
5676 else
5677 close get_root_min_hist_id;
5678 hr_utility.set_location(' Fetching successor,if any, from history' || l_proc, 40);
5679 open c_history(
5680 c_information1 => p_element_entry_id,
5681 c_effective_date => p_effective_start_date,
5682 c_root_hist_id => l_root_hist_id);
5683 fetch c_history into l_dummy;
5684 l_ret_val := c_history%notfound;
5685 end if;
5686 end if;
5687 end if;
5688 p_result := l_ret_val;
5689 hr_utility.set_location(' Leaving : ' || l_proc, 100);
5690 Exception when others then
5691 --
5692 -- Reset IN OUT parameters and set OUT parameters
5693 --
5694 p_result := null;
5695 raise;
5696
5697 End IF_ZAP_ELE_ENT;
5698
5699 -- VSM
5700 Procedure Cancel_Routine (p_sf52_data in out nocopy ghr_pa_requests%rowtype) is
5701
5702 l_proc varchar2(30):='cancel_routine';
5703 l_sf52_data_rec ghr_pa_requests%rowtype;
5704
5705 --
5706
5707 -- This cursor would fetch active chain of subsequent corrections.
5708 cursor c_get_subs_corr (c_pa_request_id in number,
5709 c_noa_id in number) is
5710 select
5711 pa_request_id
5712 ,object_version_number
5713 ,status
5714 ,rowid row_id
5715 from ghr_pa_requests
5716 where (level = 1 or ( level > 1 and
5717 nvl(second_noa_cancel_or_correct, '@#$') <> ghr_history_api.g_cancel)) and
5718 first_noa_code <> '001' and
5719 nvl(status, '@!#') <> 'CANCELED'
5720 start with pa_request_id = c_pa_request_id
5721 connect by prior pa_request_id = altered_pa_request_id and
5722 prior c_noa_id = second_noa_id;
5723
5724
5725 TYPE array_pa_req is table of pa_req_info index by binary_integer;
5726 l_subsequent_pa_req array_pa_req;
5727 l_count number:=0;
5728 l_rev_count number;
5729 l_noa_id ghr_pa_requests.first_noa_id%type;
5730 l_sf52_canc ghr_pa_requests%rowtype;
5731 l_sf52 ghr_pa_requests%rowtype;
5732 l_canc_pa_request_id ghr_pa_requests.pa_request_id%type;
5733 l_username varchar2(30):=fnd_global.user_name;
5734 l_null_sf52 ghr_pa_requests%rowtype;
5735 l_ovn number;
5736 l_which_noa number;
5737 --
5738 Begin
5739 hr_utility.set_location( 'Entering : ' || l_proc, 10);
5740 hr_utility.set_location( 'PA_Request_id : ' || p_sf52_data.pa_request_id || ' ' || l_proc, 15);
5741 l_sf52_data_rec := p_sf52_data;
5742
5743 -- Fetch Original SF50 being cancelled
5744 for v_get_sf52 in c_get_sf52 ( p_sf52_data.altered_pa_request_id)
5745 loop
5746 l_sf52 := v_get_sf52;
5747 exit;
5748 end loop;
5749
5750 --
5751 --
5752
5753 l_noa_id := p_sf52_data.second_noa_id;
5754
5755 -- >> Build array of subsequent corrections;
5756 for v_pa_req in c_get_subs_corr ( p_sf52_data.altered_pa_request_id, p_sf52_data.second_noa_id)
5757 loop
5758 hr_utility.set_location( 'Sub Pa_request_id : ' || v_pa_req.pa_request_id || ' ' || l_proc, 20);
5759 l_count := l_count + 1;
5760 l_subsequent_pa_req(l_count).pa_request_id := v_pa_req.pa_request_id;
5761 l_subsequent_pa_req(l_count).object_version_number := v_pa_req.object_version_number;
5762 l_subsequent_pa_req(l_count).status := v_pa_req.status;
5763 l_subsequent_pa_req(l_count).row_id := v_pa_req.row_id;
5764 l_subsequent_pa_req(l_count).cancel_legal_authority := p_sf52_data.first_action_la_code1;
5765 end loop;
5766
5767 l_rev_count := l_count;
5768
5769 if l_count = 0 then
5770 hr_utility.set_location('Subsequent SF52 Tree is blank. Error !!!! ' || l_proc, 40);
5771 hr_utility.set_message(8301 , 'GHR_99999_CANC_SF52_NOT_FOUND');
5772 hr_utility.raise_error;
5773 end if;
5774
5775
5776 hr_utility.set_location(' Start Process Subsequent SF52 ' || l_proc , 60);
5777 while l_rev_count > 0
5778 loop
5779 l_sf52_canc := l_null_sf52;
5780 if l_rev_count = 1 then
5781 -- original SF52;
5782 hr_utility.set_location('Processing Original SF52 ' || l_proc , 70);
5783 l_sf52_canc := p_sf52_data;
5784 -- Cancel SF52
5785 Process_Cancel( p_sf52_Data => l_sf52_canc);
5786 elsif nvl(l_subsequent_pa_req(l_rev_count).status, 'CANCELED') = 'CANCELED' then
5787 -- No Action required
5788 hr_utility.set_location('No Action Req. for SF52 : ' ||
5789 l_subsequent_pa_req(l_rev_count).pa_request_id || ' ' || l_proc , 80);
5790 elsif nvl(l_subsequent_pa_req(l_rev_count).status, 'CANCELED') <> 'UPDATE_HR_COMPLETE' then
5791 -- SF52 has not been processed
5792 -- Soft Cancel this SF52
5793 -- No need to re-fetch object_version_number. As this must be last SF52 in the chain and
5794 -- OVN must not change since last fetch
5795 hr_utility.set_location('Soft Cancelling SF52 : ' ||
5796 l_subsequent_pa_req(l_rev_count).pa_request_id || ' ' || l_proc , 90);
5797 ghr_sf52_api.end_sf52(
5798 p_pa_request_id => l_sf52.pa_request_id
5799 ,p_user_name => l_username
5800 ,p_par_object_version_number => l_subsequent_pa_req(l_rev_count).object_version_number
5801 ,p_action_taken => 'CANCELED'
5802 );
5803 else
5804 -- Call Cancel_correction
5805 hr_utility.set_location('Calling Cancel_subs_correction for SF52 : ' ||
5806 l_subsequent_pa_req(l_rev_count).pa_request_id || ' ' || l_proc , 100);
5807 if l_sf52_canc.first_noa_code = p_sf52_data.second_noa_code then
5808 hr_utility.set_location('Ist NOA CODE '|| l_proc , 105);
5809 l_which_noa := 1;
5810 else
5811 hr_utility.set_location('2nd NOA CODE '|| l_proc , 105);
5812 l_which_noa := 2;
5813 end if;
5814
5815 Cancel_subs_correction (
5816 p_corr_sf52_detail => l_subsequent_pa_req(l_rev_count),
5817 p_which_noa => l_which_noa);
5818 end if;
5819 l_rev_count := l_rev_count - 1;
5820 end loop;
5821
5822 hr_utility.set_location('Fetching original SF52 ' || l_proc , 110);
5823
5824 -- Set column values in the SF50 being Cancelled;
5825 -- copy first/second_noa_canc_pa_request_id to first/second_noa_pa_request_id
5826 -- set first/second_noa_canel_correct_flag = 'ghr_history_api.g_cancel
5827
5828 l_sf52.object_version_number := get_sf52_ovn ( p_pa_request_id => l_sf52.pa_request_id);
5829
5830 if l_sf52.first_noa_code = p_sf52_data.second_noa_code then
5831 if l_sf52.first_noa_canc_pa_request_id is not null then
5832 hr_utility.set_location('Reset First_noa_canel_or_correct ' || l_proc , 120);
5833 ghr_par_upd.upd(
5834 p_pa_request_id => l_sf52.pa_request_id
5835 ,p_object_version_number => l_sf52.object_version_number
5836 ,p_first_noa_pa_request_id => l_sf52.first_noa_canc_pa_request_id
5837 ,p_first_noa_cancel_or_correct => ghr_history_api.g_cancel
5838 );
5839
5840 end if;
5841 else
5842 if l_sf52.second_noa_canc_pa_request_id is not null then
5843 hr_utility.set_location('Reset Second_noa_canel_or_correct ' || l_proc , 120);
5844 ghr_par_upd.upd(
5845 p_pa_request_id => l_sf52.pa_request_id
5846 ,p_object_version_number => l_sf52.object_version_number
5847 ,p_second_noa_pa_request_id => l_sf52.second_noa_canc_pa_request_id
5848 ,p_second_noa_cancel_or_correct => ghr_history_api.g_cancel
5849 );
5850 end if;
5851 end if;
5852
5853 hr_utility.set_location(' Leaving ' || l_proc , 200);
5854 Exception when others then
5855 --
5856 -- Reset IN OUT parameters and set OUT parameters
5857 --
5858 p_sf52_data := l_sf52_data_rec;
5859 raise;
5860
5861
5862 End Cancel_routine;
5863
5864 Procedure Process_Cancel (
5865 p_sf52_data in out nocopy ghr_pa_requests%rowtype) is
5866
5867 l_noa_family_code varchar2(30);
5868 l_proc varchar2(30):='Process_Cancel';
5869 l_prev_sf52_data ghr_pa_requests%rowtype;
5870 l_sf52_data ghr_pa_requests%rowtype;
5871
5872 l_posn_eff_start_date date;
5873 l_posn_eff_end_date date;
5874 l_prior_posn_ovn number;
5875
5876
5877 -- Cursor to fetch noa_codes for given pa_request_id
5878 cursor c_sf52 (c_pa_request_id in number) is
5879 select
5880 *
5881 from ghr_pa_requests
5882 where pa_request_id = c_pa_request_id;
5883
5884 -- cursor to fetch noa_family_code for the given noa_id.
5885 cursor c_fam (c_noa_id in number) is
5886 select
5887 fams.noa_family_code
5888 from ghr_noa_families noafam,
5889 ghr_families fams
5890 where noafam.nature_of_action_id = c_noa_id and
5891 noafam.enabled_flag = 'Y' and
5892 fams.noa_family_code = noafam.noa_family_code and
5893 fams.enabled_flag = 'Y' and
5894 fams.update_hr_flag = 'Y';
5895
5896 -- Start of Bug# 5195518
5897
5898 Cursor get_fehb_life_events(p_person_id in number,
5899 p_business_group_id in number,
5900 p_effective_date in date)
5901 is
5902 select per_in_ler_id, ptnl_ler_for_per_stat_cd
5903 from ben_per_in_ler pil,
5904 ben_ler_f lf,
5905 ben_ptnl_ler_for_per ptnl
5906 where pil.person_id = p_person_id
5907 and pil.business_group_id = p_business_group_id
5908 and pil.lf_evt_ocrd_dt = p_effective_date
5909 and pil.PER_IN_LER_STAT_CD IN ('PROCD','STRTD')
5910 and lf.ler_id = pil.ler_id
5911 and pil.ptnl_ler_for_per_id = ptnl.ptnl_ler_for_per_id
5912 and name <> 'Unrestricted'
5913 and p_effective_date between lf.effective_start_date
5914 and lf.effective_end_date;
5915
5916 Cursor get_tsp_life_events(p_person_id in number,
5917 p_business_group_id in number,
5918 p_effective_date in date)
5919 is
5920 select per_in_ler_id,PER_IN_LER_STAT_CD
5921 from ben_per_in_ler pil,ben_ler_f lf
5922 where pil.person_id = p_person_id
5923 and pil.business_group_id = p_business_group_id
5924 and pil.lf_evt_ocrd_dt = p_effective_date
5925 and PER_IN_LER_STAT_CD IN ('PROCD','STRTD')
5926 and lf.ler_id = pil.ler_id
5927 and name = 'Unrestricted'
5928 and p_effective_date between lf.effective_start_date
5929 and lf.effective_end_date;
5930
5931 Cursor c_chk_pa_request(p_person_id in number
5932 ,p_effective_date in date)
5933 is
5934 select 1
5935 from ghr_pa_requests par
5936 where person_id = p_person_id
5937 and effective_date <= p_effective_date
5938 and first_noa_code not in ('100')
5939 and pa_notification_id is not null
5940 and not exists (select 1
5941 from ghr_pa_requests b
5942 where person_id = p_person_id
5943 and altered_pa_request_id = par.pa_request_id
5944 and first_noa_code = '001'
5945 and second_noa_code = par.first_noa_code);
5946
5947
5948 Cursor c_bg_id(c_person_id per_all_people_f.person_id%type,
5949 c_effective_date per_all_people_f.effective_start_date%type)
5950 is
5951 select business_group_id bg_id
5952 from per_all_people_f
5953 where person_id = c_person_id
5954 and c_effective_date between effective_start_date
5955 and effective_end_date;
5956
5957 Cursor c_get_pgm_id(c_prog_name ben_pgm_f.name%type,
5958 c_business_group_id ben_pgm_f.business_group_id%type,
5959 c_effective_date ben_pgm_f.effective_start_date%type)
5960 is
5961 select pgm.pgm_id
5962 from ben_pgm_f pgm
5963 where pgm.name = c_prog_name
5964 and pgm.business_group_id = c_business_group_id
5965 and c_effective_date between effective_start_date and effective_end_date;
5966
5967 Cursor c_get_enrt_rslt(p_person_id per_all_people_f.person_id%type,
5968 p_pgm_id ben_pgm_f.pgm_id%type,
5969 p_per_in_ler_id ben_per_in_ler.per_in_ler_id%type,
5970 p_effective_date date)
5971 is
5972 select prtt_enrt_rslt_id,
5973 object_version_number,
5974 effective_start_date,
5975 enrt_cvg_thru_dt
5976 from ben_prtt_enrt_rslt_f
5977 where person_id = p_person_id
5978 and pgm_id = p_pgm_id
5979 and per_in_ler_id = p_per_in_ler_id
5980 and p_effective_date between effective_start_date and effective_end_date
5981 and enrt_cvg_strt_dt >= p_effective_date;
5982
5983
5984
5985
5986 l_bg_id number;
5987 l_effective_start_date date;
5988 l_effective_end_date date;
5989 l_object_version_number number;
5990 l_pgm_id number;
5991 l_deenrtsp boolean;
5992 l_datetrack_mode varchar2(30);
5993 --End of Bug# 5195518
5994 Begin
5995
5996 -- Cancellation
5997 hr_utility.set_location( 'Entering ' || l_proc, 10);
5998 l_sf52_data := p_sf52_data;
5999 -- get first_noa_code and second_noa_code for the pa_request that this cancellation is being
6000 -- applied to.
6001 open c_sf52( p_sf52_data.altered_pa_request_id);
6002 fetch c_sf52 into l_prev_sf52_data;
6003 if not c_sf52%found then
6004 close c_sf52;
6005 -- original SF52 not found
6006 hr_utility.set_location(' Parent of pa_request_id : ' ||
6007 p_sf52_data.pa_request_id || ' Not Found. !! ERROR !! ' || l_proc , 20);
6008 hr_utility.set_message(8301 , 'GHR_38221_CORR_SF50_NOT_FOUND');
6009 ghr_api.g_api_dml := FALSE;
6010 hr_utility.raise_error;
6011 -- raise error
6012 else
6013 hr_utility.set_location( l_proc, 30);
6014 if l_prev_sf52_data.first_noa_code = '002' then
6015 -- Cancellation of the correction
6016 hr_utility.set_location( l_proc, 40);
6017 ghr_corr_canc_sf52.Cancel_Correction_SF52( p_sf52_data);
6018 else
6019 -------------------------------------------------
6020 -- JH Bug 2983738 Position Hiring Status Changes Generic to All Cancellations.
6021 -------------------------------------------------
6022 --l_posn_eff_start_date date;
6023 --l_posn_eff_end_date date;
6024 --l_prior_posn_ovn number;
6025
6026 hr_utility.set_location('JH Hiring Status Start'|| l_proc,45);
6027 hr_utility.set_location('First NOA code = '||l_sf52_data.first_noa_code || l_proc,45);
6028
6029 IF l_sf52_data.first_noa_code = '001' THEN
6030 hr_utility.set_location('From Posn ID = '||to_char(l_sf52_data.from_position_id)|| l_proc,45);
6031 hr_utility.set_location('Effective Date = '||l_sf52_data.effective_date|| l_proc,45);
6032 -- Tests for Position in Non-Active status ON the effective Date.
6033 posn_not_active(p_position_id => l_sf52_data.from_position_id
6034 ,p_effective_date => l_sf52_data.effective_date
6035 ,p_posn_eff_start_date => l_posn_eff_start_date
6036 ,p_posn_eff_end_date => l_posn_eff_end_date
6037 ,p_prior_posn_ovn => l_prior_posn_ovn);
6038
6039 IF l_posn_eff_start_date IS NULL THEN
6040 -- Test if user manually set position to non-active day AFTER the effective date.
6041 posn_not_active(p_position_id => l_sf52_data.from_position_id
6042 ,p_effective_date => l_sf52_data.effective_date+1
6043 ,p_posn_eff_start_date => l_posn_eff_start_date
6044 ,p_posn_eff_end_date => l_posn_eff_end_date
6045 ,p_prior_posn_ovn => l_prior_posn_ovn);
6046 END IF;
6047
6048 hr_utility.set_location('Hiring Status Start/End : '||l_posn_eff_start_date||'/'||l_posn_eff_end_date,45);
6049
6050 IF l_posn_eff_start_date IS NOT NULL THEN
6051 hr_utility.set_location('Hiring Status - Calling Delete API',45);
6052 hr_position_api.delete_position(p_validate => FALSE
6053 ,p_position_id => to_number(l_sf52_data.from_position_id)
6054 ,p_effective_date => l_posn_eff_start_date-1
6055 ,p_effective_start_date => l_posn_eff_start_date
6056 ,p_effective_end_date => l_posn_eff_end_date
6057 ,p_object_version_number => l_prior_posn_ovn
6058 ,p_datetrack_mode => 'DELETE_NEXT_CHANGE');
6059 END IF;
6060 hr_utility.set_location('Hiring Status - Exiting',45);
6061 END IF; -- Cancellations Bug 2983738
6062
6063
6064
6065 hr_utility.set_location( l_proc, 50);
6066 open c_fam( p_sf52_data.second_noa_id);
6067 fetch c_fam into
6068 l_noa_family_code;
6069 if c_fam%notfound then
6070 -- error
6071 close c_fam;
6072 hr_utility.set_message(8301,'GHR_38211_NOA_FAMILY_NOTFOUND');
6073 hr_utility.raise_error;
6074 else
6075 close c_fam;
6076 end if;
6077 -- Bug # 5195518
6078 IF l_noa_family_code in ('APP','CONV_APP','SEPARATION') THEN
6079 FOR l_cur_bg_id IN c_bg_id(p_sf52_data.person_id, p_sf52_data.effective_date)
6080 LOOP
6081 l_bg_id := l_cur_bg_id.bg_id;
6082 END LOOP;
6083 IF ghr_utility.is_ghr_ben_fehb = 'TRUE' THEN
6084 For rec_le in get_fehb_life_events(p_person_id => p_sf52_data.person_id,
6085 p_business_group_id => l_bg_id,
6086 p_effective_date => p_sf52_data.effective_date)
6087 loop
6088
6089 ben_back_out_life_event.back_out_life_events
6090 (p_per_in_ler_id => rec_le.per_in_ler_id,
6091 p_business_group_id => l_bg_id,
6092 p_bckt_stat_cd => rec_le.ptnl_ler_for_per_stat_cd,
6093 p_copy_only => 'N' ,
6094 p_effective_date => p_sf52_data.effective_date);
6095 end loop;
6096 END IF;
6097 END IF;
6098 --Checking whether it is reappointment after separation
6099 -- it should not be deenrolled for reappointment.
6100 /* For rec_pa_req in c_chk_pa_request(p_person_id => p_sf52_data.person_id
6101 ,p_effective_date => p_sf52_data.effective_date)
6102 loop
6103 l_deenrtsp := TRUE;
6104 end loop;
6105
6106 IF l_deenrtsp then
6107 l_datetrack_mode := hr_api.g_delete_next_change;
6108 ELSE
6109 l_datetrack_mode := hr_api.g_zap;
6110 END IF; */
6111
6112
6113 hr_utility.set_location('p_sf52_data.effective_date'||p_sf52_data.effective_date,1000);
6114 IF l_noa_family_code in ('APP','CONV_APP') THEN
6115 IF ghr_utility.is_ghr_ben_tsp = 'TRUE' THEN
6116 For rec_le in get_tsp_life_events(p_person_id => p_sf52_data.person_id,
6117 p_business_group_id => l_bg_id,
6118 p_effective_date => p_sf52_data.effective_date)
6119 loop
6120
6121 for pgm_rec in c_get_pgm_id('Federal Thrift Savings Plan (TSP)', l_bg_id, p_sf52_data.effective_date)
6122 loop
6123 l_pgm_id := pgm_rec.pgm_id;
6124 exit;
6125 end loop;
6126
6127
6128 for enrt_rec in c_get_enrt_rslt(p_person_id => p_sf52_data.person_id,
6129 p_pgm_id => l_pgm_id,
6130 p_per_in_ler_id => rec_le.per_in_ler_id,
6131 p_effective_date => p_sf52_data.effective_date)
6132 loop
6133 IF enrt_rec.effective_start_date = p_sf52_data.effective_date THEN
6134
6135 l_object_version_number := enrt_rec.object_version_number;
6136 ben_prtt_enrt_result_api.delete_enrollment
6137 (p_validate => false
6138 ,p_per_in_ler_id => rec_le.per_in_ler_id
6139 ,p_prtt_enrt_rslt_id => enrt_rec.prtt_enrt_rslt_id
6140 ,p_business_group_id => l_bg_id
6141 ,p_effective_start_date => l_effective_start_date
6142 ,p_effective_end_date => l_effective_end_date
6143 ,p_object_version_number => l_object_version_number
6144 ,p_effective_date => enrt_rec.effective_start_date
6145 ,p_datetrack_mode => hr_api.g_zap
6146 ,p_enrt_cvg_thru_dt => enrt_rec.enrt_cvg_thru_dt
6147 ,p_multi_row_validate => FALSE);
6148 END IF;
6149 end loop;
6150 end loop;
6151 END IF;
6152 END IF;
6153 -- End of Bug # 5195518
6154 if l_noa_family_code = 'APP' then
6155 -- must be checked for the appt. family
6156 -- Cancellation of an appointment
6157 hr_utility.set_location( l_proc, 60);
6158 ghr_corr_canc_sf52.Cancel_Appt_SF52( p_sf52_data);
6159 null;
6160 elsif l_noa_family_code = 'SEPARATION' then
6161 -- cancellation of termination
6162 hr_utility.set_location( l_proc, 70);
6163 ghr_corr_canc_sf52.cancel_term_sf52( p_sf52_data);
6164 -- elsif l_noa_code like '9%' then
6165 -- -- user defined families not supported by update to database
6166 -- -- should generate a message and raise_error here.
6167 -- hr_utility.set_location( l_proc, 80);
6168 -- NULL;
6169 -- user defined NOA would be treated as any other family in cancel_other_family_sf52
6170 -- if these don't belong to special families (APP/SEPARATION)
6171 else
6172 hr_utility.set_location( l_proc, 90);
6173 ghr_corr_canc_sf52.Cancel_Other_Family_Sf52( p_sf52_data);
6174 end if;
6175
6176
6177
6178
6179 end if;
6180 end if;
6181 close c_sf52;
6182 Exception when others then
6183 --
6184 -- Reset IN OUT parameters and set OUT parameters
6185 --
6186 p_sf52_data := l_sf52_data;
6187 raise;
6188 End Process_Cancel;
6189
6190 Procedure Cancel_subs_correction (
6191 p_corr_sf52_detail in out nocopy pa_req_info,
6192 p_which_noa in number) is
6193
6194 l_proc varchar2(30):='Cancel_subs_correction';
6195 l_ovn number;
6196 l_canc_pa_request_id number;
6197 l_noa_id number;
6198 l_username varchar2(30);
6199 l_dummy_number number;
6200 l_sf52_canc ghr_pa_requests%rowtype;
6201 l_corr_sf52_detail pa_req_info;
6202
6203 cursor c_get_asg_id is
6204 select employee_assignment_id
6205 from ghr_pa_requests
6206 where pa_request_id in
6207 ( select altered_pa_request_id from
6208 ghr_pa_requests where
6209 pa_request_id = p_corr_sf52_detail.pa_request_id);
6210 l_asg_id per_assignments_f.assignment_id%type;
6211
6212
6213 Begin
6214
6215 -- create cancellation;
6216 hr_utility.set_location(' Call ghr_cancel_sf52 ' || p_corr_sf52_detail.pa_request_id ||
6217 l_proc , 80);
6218 l_corr_sf52_detail := p_corr_sf52_detail;
6219 -- Start Bug 2542417
6220 -- Fetching employee_assignment_id to pass in ghr_sf52_api.update_sf52
6221 -- In the Cancellation of Subsequent corrections assignment id is
6222 -- missing in call to get_cop in ghr_sf52_api.update_sf52
6223 -- This passing of l_asg_id in the call below fixes the issue
6224 for c_get_asg_rec in c_get_asg_id LOOP
6225 l_asg_id := c_get_asg_rec.employee_assignment_id;
6226 exit;
6227 END LOOP;
6228 hr_utility.set_location(' l_asg_id is ' || l_asg_id || ' ' || l_proc , 90);
6229 -- End Bug 2542417
6230
6231
6232 -- l_username := fnd_global.user_name;
6233 l_username := fnd_profile.value('USERNAME');
6234 -- Bug#5260624 If the profile value returns NULL, get it from fnd_global.
6235 IF l_username is NULL THEN
6236 l_username := fnd_global.user_name;
6237 END IF;
6238
6239 l_ovn := NULL;
6240
6241 for v_get_sf52 in c_get_sf52 ( p_corr_sf52_detail.pa_request_id)
6242 loop
6243 l_ovn := v_get_sf52.object_version_number;
6244 l_noa_id := v_get_sf52.second_noa_id;
6245 exit;
6246 end loop;
6247
6248 if l_ovn is NULL then
6249 hr_utility.set_message(8301 , 'GHR_99999_SF52_NOT_FOUND');
6250 hr_utility.raise_error;
6251 end if;
6252
6253 hr_utility.set_location(' User name ' || l_username || ' ' || l_proc , 90);
6254
6255 l_canc_pa_request_id := ghr_approved_pa_requests.ghr_cancel_sf52(
6256 p_pa_request_id => p_corr_sf52_detail.pa_request_id
6257 ,p_par_object_version_number => l_ovn
6258 ,p_noa_id => l_noa_id
6259 ,p_which_noa => p_which_noa
6260 ,p_row_id => p_corr_sf52_detail.row_id
6261 ,p_username => l_username
6262 ,p_cancel_legal_authority => p_corr_sf52_detail.cancel_legal_authority);
6263
6264 -- fetch cancel sf52;
6265 if nvl(l_canc_pa_request_id, 0 ) = 0 then
6266 hr_utility.set_location(' Cancellation SF52 not created!! ERROR !! ' || l_proc , 90);
6267 hr_utility.set_message(8301 , 'GHR_99999_CREA_CANC_52_FAIL');
6268 hr_utility.raise_error;
6269 end if;
6270 for v_get_sf52 in c_get_sf52(l_canc_pa_request_id)
6271 loop
6272 l_sf52_canc := v_get_sf52;
6273 exit;
6274 end loop;
6275 if l_sf52_canc.pa_request_id is NULL then
6276 hr_utility.set_location(' Fetch Cancel SF52 failed. ERROR !! ' || l_proc , 100);
6277 hr_utility.set_message(8301 , 'GHR_99999_SF52_NOT_FOUND');
6278 hr_utility.raise_error;
6279 end if;
6280
6281 -- Call update_sf52
6282 -- This is a recursive call as Process_SF52 is called from ghr_sf52_api.update_sf52
6283 hr_utility.set_location(' BEGIN Update_SF52 for pa_request_id : ' ||
6284 l_sf52_canc.pa_request_id || ' ' || l_proc , 110);
6285 hr_utility.set_location('l_dummy_number '||to_char(l_dummy_number),120);
6286 hr_utility.set_location('l_OVN '||to_char(l_sf52_canc.object_version_number),130);
6287 hr_utility.set_location('l_ASG '||to_char(l_asg_id),140);
6288 ghr_sf52_api.update_sf52(
6289 p_pa_request_id => l_sf52_canc.pa_request_id
6290 ,p_employee_assignment_id => l_asg_id
6291 -- OUT parameters
6292 ,p_par_object_version_number => l_sf52_canc.object_version_number
6293 ,p_u_prh_object_version_number=> l_dummy_number
6294 ,p_i_pa_routing_history_id => l_dummy_number
6295 ,p_i_prh_object_version_number=> l_dummy_number
6296 ,p_u_action_taken => 'UPDATE_HR'
6297 ,p_u_approval_status => 'APPROVE'
6298 );
6299
6300 hr_utility.set_location(' END Update_SF52 for pa_request_id : ' ||
6301 l_sf52_canc.pa_request_id || ' ' || l_proc , 120);
6302
6303 -- Nullify Second_noa_pa_request_id from Correction SF52 beinf cancelled
6304 ghr_par_upd.upd(
6305 p_pa_request_id => p_corr_sf52_detail.pa_request_id
6306 ,p_object_version_number => l_ovn
6307 ,p_second_noa_pa_request_id => NULL);
6308
6309 -- Delete GHR_Routing_History
6310 delete from ghr_pa_routing_history
6311 where pa_request_id = l_sf52_canc.pa_request_id;
6312
6313 -- Delete Pa_request_EI_shadow data
6314 delete ghr_pa_request_ei_shadow
6315 where pa_request_id = l_sf52_canc.pa_request_id;
6316
6317 -- Delete Cancelation SF50 Shadow row
6318 hr_utility.set_location(' Deleting Shadow ' || l_sf52_canc.pa_request_id || ' ' || l_proc , 130);
6319 Delete from ghr_pa_request_shadow
6320 where pa_request_id = l_sf52_canc.pa_request_id;
6321
6322 -- Delete Pa_request_EI data
6323 -- for l_sf52_canc.pa_request_id;
6324 delete ghr_pa_request_extra_info
6325 where pa_request_id = l_sf52_canc.pa_request_id;
6326
6327 -- Delete pa_reques row
6328 l_sf52_canc.object_version_number := get_sf52_ovn( l_sf52_canc.pa_request_id);
6329
6330 hr_utility.set_location(' Deleting Pa Request ' || l_sf52_canc.pa_request_id || ' ' || l_proc , 140);
6331 ghr_par_del.del(
6332 p_pa_request_id => l_sf52_canc.pa_request_id,
6333 p_object_version_number => l_sf52_canc.object_version_number);
6334
6335 hr_utility.set_location(' Leaving ' || l_proc , 200);
6336 Exception when others then
6337 --
6338 -- Reset IN OUT parameters and set OUT parameters
6339 --
6340 p_corr_sf52_detail := l_corr_sf52_detail;
6341 raise;
6342
6343 End Cancel_subs_correction;
6344 -- VSM
6345
6346 -- Bug#2521744 Added the following procedure
6347 -- LOGIC :
6348 -- Check for the element passed to this procedure.
6349 -- If element = 'OTHER PAY' THEN
6350 -- Check whether another other pay action processed on the same effective date;
6351 -- IF processed then
6352 -- fetch the other pay value using history id and element entry id.
6353 -- update the pay_element_entry_values_f table with the correct value.
6354 -- ELSE
6355 -- Delete the rows from pay_element_entry_values_f, pay_element_entries_f tables;
6356 -- END If;
6357 -- ELSIF element IN ('Retention Allowance', 'Supervisory Differential,'AUO','Availability Pay' Then
6358 -- Delete the rows from pay_element_entry_values_f, pay_element_entries_f tables;
6359 -- ELSE
6360 -- Delete the rows from pay_element_entry_values_f, pay_element_entries_f tables with id and effective start date;
6361 -- END If;
6362
6363 Procedure delete_other_pay_entries(p_hist_rec in ghr_pa_history%rowtype,
6364 p_element_name IN VARCHAR2 ) IS
6365
6366 l_history_exists BOOLEAN := FALSE;
6367 l_hist_rec ghr_pa_history%rowtype;
6368 l_future_othpay_effective_date DATE;
6369 l_bus_group_id NUMBER;
6370 l_element_name VARCHAR2(80);
6371
6372 CURSOR c_history_record IS
6373 SELECT *
6374 FROM ghr_pa_history
6375 WHERE table_name = 'PAY_ELEMENT_ENTRIES_F'
6376 AND information1 = p_hist_rec.information1
6377 AND information2 = p_hist_rec.information2
6378 AND nvl(pa_request_id,0) <> nvl(p_hist_rec.pa_request_id,0);
6379
6380
6381 -- CURSOR to verify whether any future other pay action is existing or not.
6382 CURSOR c_future_other_pay_exists(p_assignment_id NUMBER,p_effective_date DATE) IS
6383 SELECT min(effective_date) effective_date
6384 FROM ghr_pa_requests
6385 where noa_family_code = 'OTHER_PAY'
6386 and pa_notification_id is not null
6387 and effective_date > p_effective_date
6388 and status = 'UPDATE_HR_COMPLETE'
6389 and employee_assignment_id = p_assignment_id
6390 and NVL(first_noa_cancel_or_correct,'C') <> 'CANCEL';
6391
6392
6393 BEGIN
6394 hr_utility.set_location('Entering Delete Oth Pay Entr '||p_element_name,0);
6395
6396 fnd_profile.get('PER_BUSINESS_GROUP_ID',l_bus_group_id);
6397 l_element_name := pqp_fedhr_uspay_int_utils.return_old_element_name
6398 (p_element_name,l_bus_group_id,p_hist_rec.effective_date);
6399 hr_utility.set_location('l_element_name IS '||l_element_name,10);
6400 IF l_element_name = 'Other Pay' THEN
6401 Open c_history_record;
6402 Fetch c_history_record into l_hist_rec;
6403 IF c_history_record%NOTFOUND THEN
6404 l_history_exists := FALSE;
6405 ELSE
6406 l_history_exists := TRUE;
6407 END IF;
6408 Close c_history_record;
6409
6410
6411 IF l_history_exists THEN
6412 hr_utility.set_location('Same day action',70);
6413 ELSE
6414 -- Check whether any future dated OTHER PAY Actions exists or not
6415 FOR future_other_pay IN c_future_other_pay_exists(p_hist_rec.information5,p_hist_rec.effective_date)
6416 LOOP
6417 l_future_othpay_effective_date := future_other_pay.effective_date;
6418 END LOOP;
6419 -- IF any Future other pay action exists,
6420 -- Delete the other pay element from this effective date to the future
6421 -- other pay action (effective date - 1).
6422 -- Else
6423 -- Delete the Other Pay element with this element entry ID.
6424 -- End If;
6425 IF l_future_othpay_effective_date IS NOT NULL THEN
6426 hr_utility.set_location(' Inside Future Other Pay Exists',20);
6427 -- DELETE THE RECORD FROM PAY_ELEMENT_ENTRY_VALUES_F;
6428 DELETE pay_element_entry_values_f
6429 where element_entry_id = p_hist_rec.information1
6430 AND effective_start_date BETWEEN fnd_date.canonical_to_date(p_hist_rec.information2)
6431 AND (l_future_othpay_effective_date - 1) ;
6432
6433 hr_utility.set_location(' After deleting Other pay element entries',30);
6434 -- DELETE THE RECORD FROM PAY_ELEMENT_ENTRIES_F;
6435 DELETE PAY_ELEMENT_ENTRIES_F
6436 where element_entry_id = p_hist_rec.information1
6437 AND effective_start_date BETWEEN fnd_date.canonical_to_date(p_hist_rec.information2)
6438 AND (l_future_othpay_effective_date - 1) ;
6439
6440 -- DELETE THE HISTORY RECORDS with the same element entry ID created after the current
6441 -- action and prior to the next other pay action.
6442 DELETE ghr_pa_history
6443 WHERE (information5 = p_hist_rec.information1
6444 OR information1 = p_hist_rec.information1)
6445 AND effective_date BETWEEN (fnd_date.canonical_to_date(p_hist_rec.information2) + 1)
6446 AND (l_future_othpay_effective_date - 1);
6447
6448 ELSE
6449 hr_utility.set_location(' No Future Other Pay Action exists.',40);
6450 -- DELETE THE RECORD FROM PAY_ELEMENT_ENTRY_VALUES_F;
6451 DELETE pay_element_entry_values_f
6452 where element_entry_id = p_hist_rec.information1;
6453
6454
6455 -- DELETE THE RECORD FROM PAY_ELEMENT_ENTRIES_F;
6456 DELETE PAY_ELEMENT_ENTRIES_F
6457 where element_entry_id = p_hist_rec.information1;
6458
6459 -- DELETE THE HISTORY RECORDS with the same element entry ID created after the
6460 -- current other pay action.
6461 DELETE ghr_pa_history
6462 WHERE (information5 = p_hist_rec.information1 OR information1 = p_hist_rec.information1)
6463 AND effective_date > (fnd_date.canonical_to_date(p_hist_rec.information2) + 1);
6464
6465 END IF;
6466 END IF;
6467 ELSIF l_element_name IN ('Retention Allowance','Supervisory Differential','AUO',
6468 'Availability Pay') THEN
6469 -- DELETE THE RECORD FROM PAY_ELEMENT_ENTRY_VALUES_F;
6470
6471 DELETE pay_element_entry_values_f
6472 where element_entry_id = p_hist_rec.information1;
6473 -- AND effective_start_date = fnd_date.canonical_to_date(p_hist_rec.information2);
6474
6475 -- DELETE THE RECORD FROM PAY_ELEMENT_ENTRIES_F;
6476
6477 DELETE PAY_ELEMENT_ENTRIES_F
6478 where element_entry_id = p_hist_rec.information1;
6479 -- AND effective_start_date = fnd_date.canonical_to_date(p_hist_rec.information2);
6480
6481 hr_utility.set_location('Leaving delete_other_pay_entries',170);
6482 ELSE
6483 hr_utility.set_location('Elements Other than OTHER PAY '||p_element_name,110);
6484
6485 -- DELETE THE RECORD FROM PAY_ELEMENT_ENTRY_VALUES_F;
6486
6487 DELETE pay_element_entry_values_f
6488 where element_entry_id = p_hist_rec.information1
6489 AND effective_start_date = fnd_date.canonical_to_date(p_hist_rec.information2);
6490
6491 -- DELETE THE RECORD FROM PAY_ELEMENT_ENTRIES_F;
6492
6493 DELETE PAY_ELEMENT_ENTRIES_F
6494 where element_entry_id = p_hist_rec.information1
6495 AND effective_start_date = fnd_date.canonical_to_date(p_hist_rec.information2);
6496
6497 hr_utility.set_location('Leaving delete_other_pay_entries',70);
6498 END IF;
6499
6500 EXCEPTION
6501 WHEN OTHERS THEN
6502 hr_utility.set_location('ERROR: '||sqlerrm,80);
6503 hr_utility.set_location('Leaving delete_other_pay_entries',90);
6504 END delete_other_pay_entries;
6505 --
6506 -- Bug#2521744 Added the above procedure
6507
6508
6509 Function get_sf52_ovn ( p_pa_request_id in number) return number is
6510
6511 cursor c_get_sf52 (c_pa_request_id in number) is
6512 select
6513 object_version_number
6514 from ghr_pa_requests
6515 where pa_request_id = c_pa_request_id;
6516
6517 l_ovn number;
6518 l_proc varchar2(30):='get_sf52_ovn';
6519 Begin
6520 hr_utility.set_location( 'Entering ' || l_proc, 10);
6521 for v_get_sf52 in c_get_sf52 (p_pa_request_id)
6522 loop
6523 l_ovn := v_get_sf52.object_version_number;
6524 end loop;
6525 hr_utility.set_location( 'Leaving ' || l_proc, 20);
6526
6527 return l_ovn;
6528 End get_sf52_ovn;
6529
6530 PROCEDURE get_sf52_to_details_for_ia
6531 (p_pa_request_id in ghr_pa_requests.pa_request_id%type,
6532 p_retro_eff_date in ghr_pa_requests.effective_date%type,
6533 p_sf52_ia_rec in out nocopy ghr_pa_requests%rowtype)
6534 IS
6535
6536 CURSOR c_from_data IS
6537 SELECT * FROM ghr_pa_requests
6538 WHERE pa_request_id = p_pa_request_id;
6539
6540 CURSOR c_grade_id(c_business_group_id per_grades.business_group_id%type,
6541 c_pay_plan per_grades.name%type,
6542 c_grade per_grades.name%type,
6543 c_effective_date per_grades.date_from%type) IS
6544 SELECT grade_id
6545 FROM per_grades
6546 WHERE business_group_id = c_business_group_id
6547 AND substr(name,1,2) = c_pay_plan
6548 AND substr(name,length(name)-1) = c_grade
6549 AND c_effective_date BETWEEN NVL(date_from,to_date('01/01/1951','dd/mm/yyyy')) AND NVL(date_to,to_date('31/12/4712','dd/mm/yyyy'));
6550
6551 l_proc varchar2(30):='get_sf52_to_details_for_ia';
6552 l_dummy_varchar varchar2(30);
6553 l_sf52_ia_rec ghr_pa_requests%rowtype;
6554 l_business_group_id per_grades.business_group_id%type;
6555
6556 BEGIN
6557 -- First assign the current From pos items to To pos items
6558 hr_utility.set_location( 'Entering ' || l_proc, 5);
6559 l_sf52_ia_rec := p_sf52_ia_rec;
6560 FOR c_sf52_data IN c_from_data LOOP
6561 hr_utility.set_location( 'Assigning the from side to sf52_ia_rec ' || l_proc, 5);
6562 p_sf52_ia_rec.to_position_id := c_sf52_data.from_position_id;
6563 p_sf52_ia_rec.to_position_title := c_sf52_data.from_position_title;
6564 p_sf52_ia_rec.to_position_number := c_sf52_data.from_position_number;
6565 p_sf52_ia_rec.TO_POSITION_SEQ_NO := c_sf52_data.FROM_POSITION_SEQ_NO;
6566 p_sf52_ia_rec.to_occ_code := c_sf52_data.from_occ_code;
6567 p_sf52_ia_rec.to_office_symbol := c_sf52_data.from_office_symbol;
6568 -- Bug#4696860 Added the following IF Condition.
6569 IF NOT (c_sf52_data.noa_family_code IN ('AWARD','GHR_INCENTIVE') OR
6570 ghr_pa_requests_pkg.GET_NOA_PM_FAMILY(c_sf52_data.second_noa_id) IN ('AWARD','GHR_INCENTIVE')) THEN
6571 p_sf52_ia_rec.to_pay_basis := c_sf52_data.from_pay_basis;
6572 p_sf52_ia_rec.to_total_salary := c_sf52_data.from_total_salary;
6573 p_sf52_ia_rec.to_other_pay_amount := c_sf52_data.from_other_pay_amount;
6574 p_sf52_ia_rec.to_adj_basic_pay := c_sf52_data.from_adj_basic_pay;
6575 p_sf52_ia_rec.to_basic_pay := c_sf52_data.from_basic_pay;
6576 p_sf52_ia_rec.to_grade_or_level := c_sf52_data.from_grade_or_level;
6577 p_sf52_ia_rec.to_locality_adj := c_sf52_data.from_locality_adj;
6578 p_sf52_ia_rec.to_pay_plan := c_sf52_data.from_pay_plan;
6579 p_sf52_ia_rec.to_step_or_rate := c_sf52_data.from_step_or_rate;
6580 END IF;
6581 -- Bug 4086845 Need to assign grade id
6582 fnd_profile.get('PER_BUSINESS_GROUP_ID',l_business_group_id);
6583 IF p_sf52_ia_rec.to_pay_plan IS NOT NULL AND
6584 p_sf52_ia_rec.to_grade_or_level IS NOT NULL THEN
6585 FOR l_get_grade_id IN c_grade_id(l_business_group_id,p_sf52_ia_rec.to_pay_plan,
6586 p_sf52_ia_rec.to_grade_or_level,c_sf52_data.effective_date) LOOP
6587 p_sf52_ia_rec.to_grade_id := l_get_grade_id.grade_id;
6588 hr_utility.set_location( 'Grade ID ' || p_sf52_ia_rec.to_grade_id, 6);
6589 END LOOP;
6590 END IF;
6591 -- End Bug 4086845
6592
6593 -- Bug 2970608 - Do not copy from side pos org details to side for 790 action
6594 IF nvl(p_sf52_ia_rec.first_noa_code,hr_api.g_varchar2) <> '790' THEN
6595 p_sf52_ia_rec.to_position_org_line1 := c_sf52_data.from_position_org_line1;
6596 p_sf52_ia_rec.to_position_org_line2 := c_sf52_data.from_position_org_line2;
6597 p_sf52_ia_rec.to_position_org_line3 := c_sf52_data.from_position_org_line3;
6598 p_sf52_ia_rec.to_position_org_line4 := c_sf52_data.from_position_org_line4;
6599 p_sf52_ia_rec.to_position_org_line5 := c_sf52_data.from_position_org_line5;
6600 p_sf52_ia_rec.to_position_org_line6 := c_sf52_data.from_position_org_line6;
6601 -- Bug 2639509
6602 -- From postion org lines should be in sync with To Postion Org Lines
6603 p_sf52_ia_rec.from_position_org_line1 := c_sf52_data.from_position_org_line1;
6604 p_sf52_ia_rec.from_position_org_line2 := c_sf52_data.from_position_org_line2;
6605 p_sf52_ia_rec.from_position_org_line3 := c_sf52_data.from_position_org_line3;
6606 p_sf52_ia_rec.from_position_org_line4 := c_sf52_data.from_position_org_line4;
6607 p_sf52_ia_rec.from_position_org_line5 := c_sf52_data.from_position_org_line5;
6608 p_sf52_ia_rec.from_position_org_line6 := c_sf52_data.from_position_org_line6;
6609 END IF;
6610 -- Get position ddf data related to from_position_id
6611 ghr_pa_requests_pkg.get_SF52_pos_ddf_details
6612 (p_position_id => c_sf52_data.from_position_id
6613 ,p_date_effective => c_sf52_data.effective_date
6614 ,p_flsa_category => p_sf52_ia_rec.flsa_category
6615 ,p_bargaining_unit_status => p_sf52_ia_rec.bargaining_unit_status
6616 ,p_work_schedule => p_sf52_ia_rec.work_schedule
6617 ,p_functional_class => p_sf52_ia_rec.functional_class
6618 ,p_supervisory_status => p_sf52_ia_rec.supervisory_status
6619 ,p_position_occupied => p_sf52_ia_rec.position_occupied
6620 ,p_appropriation_code1 => p_sf52_ia_rec.appropriation_code1
6621 ,p_appropriation_code2 => p_sf52_ia_rec.appropriation_code2
6622 ,p_personnel_office_id => p_sf52_ia_rec.personnel_office_id
6623 ,p_office_symbol => l_dummy_varchar
6624 ,p_part_time_hours => p_sf52_ia_rec.part_time_hours);
6625 EXIT;
6626 END LOOP;
6627 hr_utility.set_location( 'Leaving' || l_proc, 20);
6628 Exception when others then
6629 --
6630 -- Reset IN OUT parameters and set OUT parameters
6631 --
6632 p_sf52_ia_rec := l_sf52_ia_rec;
6633 raise;
6634
6635 END get_sf52_to_details_for_ia;
6636
6637 -- Bug#2521744
6638 -- This procedure will get the other pay component values
6639 -- at the time of intervening correction.
6640 PROCEDURE get_sf52_to_othpays_for_ia
6641 (p_sf52_ia_rec in out nocopy ghr_pa_requests%rowtype) IS
6642
6643 CURSOR C_element_exists(p_element_name IN VARCHAR2,
6644 p_assignment_id IN number,
6645 p_effective_date IN DATE) IS
6646 SELECT '1'
6647 FROM pay_element_types_f elt
6648 ,pay_element_entries_f ele
6649 WHERE elt.element_type_id = ele.element_type_id
6650 AND elt.element_name= p_element_name
6651 AND ele.assignment_id = p_assignment_id
6652 AND elt.business_group_id is NULL
6653 AND p_effective_date BETWEEN elt.effective_start_date AND elt.effective_end_date
6654 AND p_effective_date BETWEEN ele.effective_start_date AND ele.effective_end_date;
6655
6656
6657 cursor c_noa_fam_code(p_noa_id ghr_nature_of_actions.nature_of_action_id%type) is
6658 select fam.noa_family_code
6659 from ghr_noa_families fam
6660 where fam.nature_of_action_id = p_noa_id;
6661
6662
6663 l_proc varchar2(30):='get_sf52_to_othpays_for_ia';
6664 l_dummy_varchar varchar2(1);
6665 l_sf52_ia_rec ghr_pa_requests%rowtype;
6666 l_noa_id ghr_nature_of_actions.nature_of_action_id%type;
6667 l_noa_fam_code ghr_noa_families.noa_family_code%type;
6668
6669 BEGIN
6670 -- First assign the current From pos items to To pos items
6671 hr_utility.set_location( 'Entering ' || l_proc, 5);
6672 l_sf52_ia_rec := p_sf52_ia_rec;
6673 -- Bug#2521744 Added by VVL for testing the correction process.
6674 -- for Other pay Elements update nulls as nulls.
6675 -- Added the following code to check whether the Family is Salary change family or not
6676 -- Depending on that, assign the values of Other Pay components(Retention, Supervisory, AUO etc.)
6677 IF p_sf52_ia_rec.first_noa_code IN ('001','002') THEN
6678 l_noa_id := p_sf52_ia_rec.second_noa_id;
6679 ELSE
6680 l_noa_id := p_sf52_ia_rec.first_noa_id;
6681 END IF;
6682
6683 FOR noa_fam_rec in c_noa_fam_code(l_noa_id) loop
6684 l_noa_fam_code := noa_fam_rec.noa_family_code;
6685 IF l_noa_fam_code like 'GHR_SAL%' THEN
6686 EXIT;
6687 END IF;
6688 END LOOP;
6689 hr_utility.set_location('NOA Family Code '||l_noa_fam_code,10000);
6690 IF (p_sf52_ia_rec.first_noa_code IN ('810','818','819') OR
6691 p_sf52_ia_rec.second_noa_code IN ('810','818','819') OR
6692 l_noa_fam_code like 'GHR_SAL%'
6693 ) THEN
6694 -- Check for Retention Allowance Element
6695 Open C_element_exists('Retention Allowance',p_sf52_ia_rec.employee_assignment_id,p_sf52_ia_rec.effective_date);
6696 Fetch c_element_exists into l_dummy_varchar;
6697 IF c_element_exists%NOTFOUND THEN
6698 p_sf52_ia_rec.to_retention_allowance := NULL;
6699 p_sf52_ia_rec.to_retention_allow_percentage := NULL;
6700 END IF;
6701 close c_element_exists;
6702
6703 -- Check for Supervisory Differential Element
6704 Open C_element_exists('Supervisory Differential',p_sf52_ia_rec.employee_assignment_id,p_sf52_ia_rec.effective_date);
6705 Fetch c_element_exists into l_dummy_varchar;
6706 IF c_element_exists%NOTFOUND THEN
6707 p_sf52_ia_rec.to_Supervisory_Differential := NULL;
6708 p_sf52_ia_rec.to_Supervisory_Diff_percentage := NULL;
6709 END IF;
6710 close c_element_exists;
6711
6712 -- Check for AUO Element
6713 Open C_element_exists('AUO',p_sf52_ia_rec.employee_assignment_id,p_sf52_ia_rec.effective_date);
6714 Fetch c_element_exists into l_dummy_varchar;
6715 IF c_element_exists%NOTFOUND THEN
6716 p_sf52_ia_rec.to_au_overtime := NULL;
6717 p_sf52_ia_rec.to_auo_premium_pay_indicator := NULL;
6718 END IF;
6719 close c_element_exists;
6720 -- Check for Availability Pay Element
6721
6722 Open C_element_exists('Availability Pay',p_sf52_ia_rec.employee_assignment_id,p_sf52_ia_rec.effective_date);
6723 Fetch c_element_exists into l_dummy_varchar;
6724 IF c_element_exists%NOTFOUND THEN
6725 p_sf52_ia_rec.to_availability_pay := NULL;
6726 p_sf52_ia_rec.to_ap_premium_pay_indicator := NULL;
6727 END IF;
6728 close c_element_exists;
6729 END IF;
6730 -- End of Bug#2521744 Changes.
6731 hr_utility.set_location( 'Leaving' || l_proc, 20);
6732
6733 EXCEPTION
6734 WHEN OTHERS THEN
6735 --
6736 -- Reset IN OUT parameters and set OUT parameters
6737 --
6738 p_sf52_ia_rec := l_sf52_ia_rec;
6739 RAISE;
6740
6741 END get_sf52_to_othpays_for_ia;
6742
6743
6744 -- JH Bug 2983738 Position Hiring Status Changes.
6745 PROCEDURE posn_not_active(p_position_id in number
6746 ,p_effective_date in date
6747 ,p_posn_eff_start_date OUT NOCOPY date
6748 ,p_posn_eff_end_date OUT NOCOPY date
6749 ,p_prior_posn_ovn OUT NOCOPY number)
6750 IS
6751
6752 CURSOR c_posn IS
6753 select apf.effective_start_date, apf.effective_end_date
6754 from HR_ALL_POSITIONS_F apf
6755 where apf.position_id = p_position_id
6756 and apf.availability_status_id <> 1
6757 and p_effective_date between apf.effective_start_date and apf.effective_end_date;
6758
6759 CURSOR c_prior_posn IS
6760 select apf.object_version_number
6761 from HR_ALL_POSITIONS_F apf
6762 where apf.position_id = p_position_id
6763 and p_posn_eff_start_date-1 between apf.effective_start_date and apf.effective_end_date;
6764
6765 BEGIN
6766 -- Note OVN returned is for Prior Record
6767 FOR c_posn_rec IN c_posn LOOP
6768 p_posn_eff_start_date := c_posn_rec.effective_start_date;
6769 p_posn_eff_end_date := c_posn_rec.effective_end_date;
6770 END LOOP;
6771
6772 FOR c_prior_posn_rec IN c_prior_posn LOOP
6773 p_prior_posn_ovn := c_prior_posn_rec.object_version_number;
6774 END LOOP;
6775
6776 END posn_not_active;
6777
6778
6779 End;