94: --
95:
96: l_proc VARCHAR2(100) := 'pay_gb_payroll_rules.validate_update';
97: BEGIN
98: hr_utility.trace('Entering '||l_proc);
99: hr_utility.trace('p_effective_date='||fnd_date.date_to_displaydate(p_effective_date));
100: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
101: hr_utility.trace('p_payroll_id='||p_payroll_id);
102: hr_utility.trace('p_payroll_name='||p_payroll_name);
95:
96: l_proc VARCHAR2(100) := 'pay_gb_payroll_rules.validate_update';
97: BEGIN
98: hr_utility.trace('Entering '||l_proc);
99: hr_utility.trace('p_effective_date='||fnd_date.date_to_displaydate(p_effective_date));
100: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
101: hr_utility.trace('p_payroll_id='||p_payroll_id);
102: hr_utility.trace('p_payroll_name='||p_payroll_name);
103: hr_utility.trace('p_soft_coding_keyflex_id_in='||p_soft_coding_keyflex_id_in);
96: l_proc VARCHAR2(100) := 'pay_gb_payroll_rules.validate_update';
97: BEGIN
98: hr_utility.trace('Entering '||l_proc);
99: hr_utility.trace('p_effective_date='||fnd_date.date_to_displaydate(p_effective_date));
100: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
101: hr_utility.trace('p_payroll_id='||p_payroll_id);
102: hr_utility.trace('p_payroll_name='||p_payroll_name);
103: hr_utility.trace('p_soft_coding_keyflex_id_in='||p_soft_coding_keyflex_id_in);
104: hr_utility.trace('Fetching PAYE Ref for new scl id='|| p_soft_coding_keyflex_id_in);
97: BEGIN
98: hr_utility.trace('Entering '||l_proc);
99: hr_utility.trace('p_effective_date='||fnd_date.date_to_displaydate(p_effective_date));
100: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
101: hr_utility.trace('p_payroll_id='||p_payroll_id);
102: hr_utility.trace('p_payroll_name='||p_payroll_name);
103: hr_utility.trace('p_soft_coding_keyflex_id_in='||p_soft_coding_keyflex_id_in);
104: hr_utility.trace('Fetching PAYE Ref for new scl id='|| p_soft_coding_keyflex_id_in);
105: OPEN get_paye_ref(p_soft_coding_keyflex_id_in);
98: hr_utility.trace('Entering '||l_proc);
99: hr_utility.trace('p_effective_date='||fnd_date.date_to_displaydate(p_effective_date));
100: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
101: hr_utility.trace('p_payroll_id='||p_payroll_id);
102: hr_utility.trace('p_payroll_name='||p_payroll_name);
103: hr_utility.trace('p_soft_coding_keyflex_id_in='||p_soft_coding_keyflex_id_in);
104: hr_utility.trace('Fetching PAYE Ref for new scl id='|| p_soft_coding_keyflex_id_in);
105: OPEN get_paye_ref(p_soft_coding_keyflex_id_in);
106: FETCH get_paye_ref INTO l_new_paye_ref;
99: hr_utility.trace('p_effective_date='||fnd_date.date_to_displaydate(p_effective_date));
100: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
101: hr_utility.trace('p_payroll_id='||p_payroll_id);
102: hr_utility.trace('p_payroll_name='||p_payroll_name);
103: hr_utility.trace('p_soft_coding_keyflex_id_in='||p_soft_coding_keyflex_id_in);
104: hr_utility.trace('Fetching PAYE Ref for new scl id='|| p_soft_coding_keyflex_id_in);
105: OPEN get_paye_ref(p_soft_coding_keyflex_id_in);
106: FETCH get_paye_ref INTO l_new_paye_ref;
107: CLOSE get_paye_ref;
100: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
101: hr_utility.trace('p_payroll_id='||p_payroll_id);
102: hr_utility.trace('p_payroll_name='||p_payroll_name);
103: hr_utility.trace('p_soft_coding_keyflex_id_in='||p_soft_coding_keyflex_id_in);
104: hr_utility.trace('Fetching PAYE Ref for new scl id='|| p_soft_coding_keyflex_id_in);
105: OPEN get_paye_ref(p_soft_coding_keyflex_id_in);
106: FETCH get_paye_ref INTO l_new_paye_ref;
107: CLOSE get_paye_ref;
108: --
105: OPEN get_paye_ref(p_soft_coding_keyflex_id_in);
106: FETCH get_paye_ref INTO l_new_paye_ref;
107: CLOSE get_paye_ref;
108: --
109: hr_utility.trace('New Paye Ref is '||l_new_paye_ref);
110: --
111: hr_utility.trace('Fetching current payroll details');
112: OPEN get_current_details;
113: FETCH get_current_details INTO l_cur_scl_id, l_cur_eff_start, l_cur_eff_end;
107: CLOSE get_paye_ref;
108: --
109: hr_utility.trace('New Paye Ref is '||l_new_paye_ref);
110: --
111: hr_utility.trace('Fetching current payroll details');
112: OPEN get_current_details;
113: FETCH get_current_details INTO l_cur_scl_id, l_cur_eff_start, l_cur_eff_end;
114: CLOSE get_current_details;
115: --
112: OPEN get_current_details;
113: FETCH get_current_details INTO l_cur_scl_id, l_cur_eff_start, l_cur_eff_end;
114: CLOSE get_current_details;
115: --
116: hr_utility.trace('Currrent l_cur_scl_id='||l_cur_scl_id);
117: hr_utility.trace('Currrent l_cur_eff_start='||fnd_date.date_to_displaydate(l_cur_eff_start));
118: hr_utility.trace('Currrent l_cur_eff_end='||fnd_date.date_to_displaydate(l_cur_eff_end));
119: --
120: hr_utility.trace('Fetching Current PAYE Ref.');
113: FETCH get_current_details INTO l_cur_scl_id, l_cur_eff_start, l_cur_eff_end;
114: CLOSE get_current_details;
115: --
116: hr_utility.trace('Currrent l_cur_scl_id='||l_cur_scl_id);
117: hr_utility.trace('Currrent l_cur_eff_start='||fnd_date.date_to_displaydate(l_cur_eff_start));
118: hr_utility.trace('Currrent l_cur_eff_end='||fnd_date.date_to_displaydate(l_cur_eff_end));
119: --
120: hr_utility.trace('Fetching Current PAYE Ref.');
121: OPEN get_paye_ref(l_cur_scl_id);
114: CLOSE get_current_details;
115: --
116: hr_utility.trace('Currrent l_cur_scl_id='||l_cur_scl_id);
117: hr_utility.trace('Currrent l_cur_eff_start='||fnd_date.date_to_displaydate(l_cur_eff_start));
118: hr_utility.trace('Currrent l_cur_eff_end='||fnd_date.date_to_displaydate(l_cur_eff_end));
119: --
120: hr_utility.trace('Fetching Current PAYE Ref.');
121: OPEN get_paye_ref(l_cur_scl_id);
122: FETCH get_paye_ref INTO l_cur_paye_ref;
116: hr_utility.trace('Currrent l_cur_scl_id='||l_cur_scl_id);
117: hr_utility.trace('Currrent l_cur_eff_start='||fnd_date.date_to_displaydate(l_cur_eff_start));
118: hr_utility.trace('Currrent l_cur_eff_end='||fnd_date.date_to_displaydate(l_cur_eff_end));
119: --
120: hr_utility.trace('Fetching Current PAYE Ref.');
121: OPEN get_paye_ref(l_cur_scl_id);
122: FETCH get_paye_ref INTO l_cur_paye_ref;
123: CLOSE get_paye_ref;
124: hr_utility.trace('Current PAYE Ref is '||l_cur_paye_ref);
120: hr_utility.trace('Fetching Current PAYE Ref.');
121: OPEN get_paye_ref(l_cur_scl_id);
122: FETCH get_paye_ref INTO l_cur_paye_ref;
123: CLOSE get_paye_ref;
124: hr_utility.trace('Current PAYE Ref is '||l_cur_paye_ref);
125: --
126: hr_utility.trace('Fetching fiest start date and last end date of the payroll');
127: OPEN get_min_max_dates;
128: FETCH get_min_max_dates INTO l_first_eff_start, l_last_eff_end;
122: FETCH get_paye_ref INTO l_cur_paye_ref;
123: CLOSE get_paye_ref;
124: hr_utility.trace('Current PAYE Ref is '||l_cur_paye_ref);
125: --
126: hr_utility.trace('Fetching fiest start date and last end date of the payroll');
127: OPEN get_min_max_dates;
128: FETCH get_min_max_dates INTO l_first_eff_start, l_last_eff_end;
129: CLOSE get_min_max_dates;
130: hr_utility.trace('l_first_eff_start='||fnd_date.date_to_displaydate(l_first_eff_start));
126: hr_utility.trace('Fetching fiest start date and last end date of the payroll');
127: OPEN get_min_max_dates;
128: FETCH get_min_max_dates INTO l_first_eff_start, l_last_eff_end;
129: CLOSE get_min_max_dates;
130: hr_utility.trace('l_first_eff_start='||fnd_date.date_to_displaydate(l_first_eff_start));
131: hr_utility.trace('l_last_eff_end='||fnd_date.date_to_displaydate(l_last_eff_end));
132: --
133: IF p_datetrack_mode = hr_api.g_correction THEN
134: hr_utility.trace('Datetrack Action is Correction.');
127: OPEN get_min_max_dates;
128: FETCH get_min_max_dates INTO l_first_eff_start, l_last_eff_end;
129: CLOSE get_min_max_dates;
130: hr_utility.trace('l_first_eff_start='||fnd_date.date_to_displaydate(l_first_eff_start));
131: hr_utility.trace('l_last_eff_end='||fnd_date.date_to_displaydate(l_last_eff_end));
132: --
133: IF p_datetrack_mode = hr_api.g_correction THEN
134: hr_utility.trace('Datetrack Action is Correction.');
135: --
130: hr_utility.trace('l_first_eff_start='||fnd_date.date_to_displaydate(l_first_eff_start));
131: hr_utility.trace('l_last_eff_end='||fnd_date.date_to_displaydate(l_last_eff_end));
132: --
133: IF p_datetrack_mode = hr_api.g_correction THEN
134: hr_utility.trace('Datetrack Action is Correction.');
135: --
136: IF l_new_paye_ref <> l_cur_paye_ref THEN
137: hr_utility.trace('PAYE Refs is changing, validating the change');
138: --
133: IF p_datetrack_mode = hr_api.g_correction THEN
134: hr_utility.trace('Datetrack Action is Correction.');
135: --
136: IF l_new_paye_ref <> l_cur_paye_ref THEN
137: hr_utility.trace('PAYE Refs is changing, validating the change');
138: --
139: hr_utility.trace('Fetching Previous PAYE Ref');
140: OPEN get_prev_details;
141: FETCH get_prev_details INTO l_prev_scl_id;
135: --
136: IF l_new_paye_ref <> l_cur_paye_ref THEN
137: hr_utility.trace('PAYE Refs is changing, validating the change');
138: --
139: hr_utility.trace('Fetching Previous PAYE Ref');
140: OPEN get_prev_details;
141: FETCH get_prev_details INTO l_prev_scl_id;
142: CLOSE get_prev_details;
143: --
140: OPEN get_prev_details;
141: FETCH get_prev_details INTO l_prev_scl_id;
142: CLOSE get_prev_details;
143: --
144: hr_utility.trace('l_prev_scl_id = '||l_prev_scl_id);
145: OPEN get_paye_ref(l_prev_scl_id);
146: FETCH get_paye_ref INTO l_prev_paye_ref;
147: CLOSE get_paye_ref;
148: --
145: OPEN get_paye_ref(l_prev_scl_id);
146: FETCH get_paye_ref INTO l_prev_paye_ref;
147: CLOSE get_paye_ref;
148: --
149: hr_utility.trace('l_prev_paye_ref = '||l_prev_paye_ref);
150: --
151: IF l_prev_paye_ref <> l_new_paye_ref AND
152: l_cur_eff_start <> l_first_eff_start AND
153: to_char(l_cur_eff_start, 'DD-MM') <> '06-04' THEN
150: --
151: IF l_prev_paye_ref <> l_new_paye_ref AND
152: l_cur_eff_start <> l_first_eff_start AND
153: to_char(l_cur_eff_start, 'DD-MM') <> '06-04' THEN
154: hr_utility.trace('New PAYE Ref does not match the previous ');
155: hr_utility.trace('PAYE Ref and current effective start date ');
156: hr_utility.trace('is not the first effective start date and ');
157: hr_utility.trace('current effective date is not start of a ');
158: hr_utility.trace('tax year therefore raise an error message.');
151: IF l_prev_paye_ref <> l_new_paye_ref AND
152: l_cur_eff_start <> l_first_eff_start AND
153: to_char(l_cur_eff_start, 'DD-MM') <> '06-04' THEN
154: hr_utility.trace('New PAYE Ref does not match the previous ');
155: hr_utility.trace('PAYE Ref and current effective start date ');
156: hr_utility.trace('is not the first effective start date and ');
157: hr_utility.trace('current effective date is not start of a ');
158: hr_utility.trace('tax year therefore raise an error message.');
159: --
152: l_cur_eff_start <> l_first_eff_start AND
153: to_char(l_cur_eff_start, 'DD-MM') <> '06-04' THEN
154: hr_utility.trace('New PAYE Ref does not match the previous ');
155: hr_utility.trace('PAYE Ref and current effective start date ');
156: hr_utility.trace('is not the first effective start date and ');
157: hr_utility.trace('current effective date is not start of a ');
158: hr_utility.trace('tax year therefore raise an error message.');
159: --
160: l_span_start := hr_gbbal.span_start(l_cur_eff_start);
153: to_char(l_cur_eff_start, 'DD-MM') <> '06-04' THEN
154: hr_utility.trace('New PAYE Ref does not match the previous ');
155: hr_utility.trace('PAYE Ref and current effective start date ');
156: hr_utility.trace('is not the first effective start date and ');
157: hr_utility.trace('current effective date is not start of a ');
158: hr_utility.trace('tax year therefore raise an error message.');
159: --
160: l_span_start := hr_gbbal.span_start(l_cur_eff_start);
161: l_span_end := hr_gbbal.span_end(l_cur_eff_start);
154: hr_utility.trace('New PAYE Ref does not match the previous ');
155: hr_utility.trace('PAYE Ref and current effective start date ');
156: hr_utility.trace('is not the first effective start date and ');
157: hr_utility.trace('current effective date is not start of a ');
158: hr_utility.trace('tax year therefore raise an error message.');
159: --
160: l_span_start := hr_gbbal.span_start(l_cur_eff_start);
161: l_span_end := hr_gbbal.span_end(l_cur_eff_start);
162: --
166: substr(fnd_date.date_to_canonical(l_span_end), 1, 4));
167: fnd_message.raise_error;
168: END IF;
169: --
170: hr_utility.trace('Change as at the start date is ok, Checking end date');
171: --
172: hr_utility.trace('Fetching Next PAYE Ref');
173: OPEN get_next_details;
174: FETCH get_next_details INTO l_next_scl_id;
168: END IF;
169: --
170: hr_utility.trace('Change as at the start date is ok, Checking end date');
171: --
172: hr_utility.trace('Fetching Next PAYE Ref');
173: OPEN get_next_details;
174: FETCH get_next_details INTO l_next_scl_id;
175: CLOSE get_next_details;
176: --
173: OPEN get_next_details;
174: FETCH get_next_details INTO l_next_scl_id;
175: CLOSE get_next_details;
176: --
177: hr_utility.trace('l_next_scl_id = '||l_next_scl_id);
178: OPEN get_paye_ref(l_next_scl_id);
179: FETCH get_paye_ref INTO l_next_paye_ref;
180: CLOSE get_paye_ref;
181: --
178: OPEN get_paye_ref(l_next_scl_id);
179: FETCH get_paye_ref INTO l_next_paye_ref;
180: CLOSE get_paye_ref;
181: --
182: hr_utility.trace('l_next_paye_ref = '||l_next_paye_ref);
183: --
184: IF l_next_paye_ref <> l_new_paye_ref AND
185: l_cur_eff_end <> l_last_eff_end AND
186: to_char(l_cur_eff_end, 'DD-MM') <> '05-04' THEN
183: --
184: IF l_next_paye_ref <> l_new_paye_ref AND
185: l_cur_eff_end <> l_last_eff_end AND
186: to_char(l_cur_eff_end, 'DD-MM') <> '05-04' THEN
187: hr_utility.trace('New PAYE Ref does not match the next ');
188: hr_utility.trace('PAYE Ref and current effective end date ');
189: hr_utility.trace('is not the last effective end date and ');
190: hr_utility.trace('current effective date is not end of a ');
191: hr_utility.trace('tax year therefore raise an error message.');
184: IF l_next_paye_ref <> l_new_paye_ref AND
185: l_cur_eff_end <> l_last_eff_end AND
186: to_char(l_cur_eff_end, 'DD-MM') <> '05-04' THEN
187: hr_utility.trace('New PAYE Ref does not match the next ');
188: hr_utility.trace('PAYE Ref and current effective end date ');
189: hr_utility.trace('is not the last effective end date and ');
190: hr_utility.trace('current effective date is not end of a ');
191: hr_utility.trace('tax year therefore raise an error message.');
192: --
185: l_cur_eff_end <> l_last_eff_end AND
186: to_char(l_cur_eff_end, 'DD-MM') <> '05-04' THEN
187: hr_utility.trace('New PAYE Ref does not match the next ');
188: hr_utility.trace('PAYE Ref and current effective end date ');
189: hr_utility.trace('is not the last effective end date and ');
190: hr_utility.trace('current effective date is not end of a ');
191: hr_utility.trace('tax year therefore raise an error message.');
192: --
193: l_span_start := hr_gbbal.span_start(l_cur_eff_end);
186: to_char(l_cur_eff_end, 'DD-MM') <> '05-04' THEN
187: hr_utility.trace('New PAYE Ref does not match the next ');
188: hr_utility.trace('PAYE Ref and current effective end date ');
189: hr_utility.trace('is not the last effective end date and ');
190: hr_utility.trace('current effective date is not end of a ');
191: hr_utility.trace('tax year therefore raise an error message.');
192: --
193: l_span_start := hr_gbbal.span_start(l_cur_eff_end);
194: l_span_end := hr_gbbal.span_end(l_cur_eff_end);
187: hr_utility.trace('New PAYE Ref does not match the next ');
188: hr_utility.trace('PAYE Ref and current effective end date ');
189: hr_utility.trace('is not the last effective end date and ');
190: hr_utility.trace('current effective date is not end of a ');
191: hr_utility.trace('tax year therefore raise an error message.');
192: --
193: l_span_start := hr_gbbal.span_start(l_cur_eff_end);
194: l_span_end := hr_gbbal.span_end(l_cur_eff_end);
195: --
199: substr(fnd_date.date_to_canonical(l_span_end), 1, 4));
200: fnd_message.raise_error;
201: END IF;
202: --
203: hr_utility.trace('Change as at the end date is ok too.');
204: --
205:
206: -- START CHECK - Termination Assignment exists at the Effective start date
207: IF (l_prev_paye_ref <> l_new_paye_ref AND
250: END IF; -- Date track mode is correction
251: --
252: IF p_datetrack_mode = hr_api.g_update
253: OR p_datetrack_mode = hr_api.g_update_override THEN
254: hr_utility.trace('Datetrack Action is Update or Update Override.');
255: --
256: IF l_new_paye_ref <> l_cur_paye_ref THEN
257: hr_utility.trace('PAYE Refs is changing, validating the change');
258: --
253: OR p_datetrack_mode = hr_api.g_update_override THEN
254: hr_utility.trace('Datetrack Action is Update or Update Override.');
255: --
256: IF l_new_paye_ref <> l_cur_paye_ref THEN
257: hr_utility.trace('PAYE Refs is changing, validating the change');
258: --
259: IF l_cur_paye_ref <> l_new_paye_ref AND
260: p_effective_date <> l_first_eff_start AND
261: to_char(p_effective_date, 'DD-MM') <> '06-04' THEN
258: --
259: IF l_cur_paye_ref <> l_new_paye_ref AND
260: p_effective_date <> l_first_eff_start AND
261: to_char(p_effective_date, 'DD-MM') <> '06-04' THEN
262: hr_utility.trace('New PAYE Ref does not match the current ');
263: hr_utility.trace('PAYE Ref and new effective start date ');
264: hr_utility.trace('is not the first effective start date and ');
265: hr_utility.trace('new effective date is not start of a ');
266: hr_utility.trace('tax year therefore raise an error message.');
259: IF l_cur_paye_ref <> l_new_paye_ref AND
260: p_effective_date <> l_first_eff_start AND
261: to_char(p_effective_date, 'DD-MM') <> '06-04' THEN
262: hr_utility.trace('New PAYE Ref does not match the current ');
263: hr_utility.trace('PAYE Ref and new effective start date ');
264: hr_utility.trace('is not the first effective start date and ');
265: hr_utility.trace('new effective date is not start of a ');
266: hr_utility.trace('tax year therefore raise an error message.');
267: --
260: p_effective_date <> l_first_eff_start AND
261: to_char(p_effective_date, 'DD-MM') <> '06-04' THEN
262: hr_utility.trace('New PAYE Ref does not match the current ');
263: hr_utility.trace('PAYE Ref and new effective start date ');
264: hr_utility.trace('is not the first effective start date and ');
265: hr_utility.trace('new effective date is not start of a ');
266: hr_utility.trace('tax year therefore raise an error message.');
267: --
268: l_span_start := hr_gbbal.span_start(p_effective_date);
261: to_char(p_effective_date, 'DD-MM') <> '06-04' THEN
262: hr_utility.trace('New PAYE Ref does not match the current ');
263: hr_utility.trace('PAYE Ref and new effective start date ');
264: hr_utility.trace('is not the first effective start date and ');
265: hr_utility.trace('new effective date is not start of a ');
266: hr_utility.trace('tax year therefore raise an error message.');
267: --
268: l_span_start := hr_gbbal.span_start(p_effective_date);
269: l_span_end := hr_gbbal.span_end(p_effective_date);
262: hr_utility.trace('New PAYE Ref does not match the current ');
263: hr_utility.trace('PAYE Ref and new effective start date ');
264: hr_utility.trace('is not the first effective start date and ');
265: hr_utility.trace('new effective date is not start of a ');
266: hr_utility.trace('tax year therefore raise an error message.');
267: --
268: l_span_start := hr_gbbal.span_start(p_effective_date);
269: l_span_end := hr_gbbal.span_end(p_effective_date);
270: --
274: substr(fnd_date.date_to_canonical(l_span_end), 1, 4));
275: fnd_message.raise_error;
276: END IF;
277: --
278: hr_utility.trace('Change as at the new effective date ok, no need to check as at the effective end date');
279: --
280:
281: -- START CHECK - Termination Assignment exists at the Effective start date
282: IF l_cur_paye_ref <> l_new_paye_ref AND
304: END IF; -- PAYE Ref Changing
305: END IF; -- Date track update or update override
306: --
307: IF p_datetrack_mode = hr_api.g_update_change_insert THEN
308: hr_utility.trace('Datetrack Action is Update Change Insert.');
309: --
310: IF l_new_paye_ref <> l_cur_paye_ref THEN
311: hr_utility.trace('PAYE Refs is changing, validating the change');
312: --
307: IF p_datetrack_mode = hr_api.g_update_change_insert THEN
308: hr_utility.trace('Datetrack Action is Update Change Insert.');
309: --
310: IF l_new_paye_ref <> l_cur_paye_ref THEN
311: hr_utility.trace('PAYE Refs is changing, validating the change');
312: --
313: IF l_cur_paye_ref <> l_new_paye_ref AND
314: p_effective_date <> l_first_eff_start AND
315: to_char(p_effective_date, 'DD-MM') <> '06-04' THEN
312: --
313: IF l_cur_paye_ref <> l_new_paye_ref AND
314: p_effective_date <> l_first_eff_start AND
315: to_char(p_effective_date, 'DD-MM') <> '06-04' THEN
316: hr_utility.trace('New PAYE Ref does not match the current ');
317: hr_utility.trace('PAYE Ref and new effective start date ');
318: hr_utility.trace('is not the first effective start date and ');
319: hr_utility.trace('new effective date is not start of a ');
320: hr_utility.trace('tax year therefore raise an error message.');
313: IF l_cur_paye_ref <> l_new_paye_ref AND
314: p_effective_date <> l_first_eff_start AND
315: to_char(p_effective_date, 'DD-MM') <> '06-04' THEN
316: hr_utility.trace('New PAYE Ref does not match the current ');
317: hr_utility.trace('PAYE Ref and new effective start date ');
318: hr_utility.trace('is not the first effective start date and ');
319: hr_utility.trace('new effective date is not start of a ');
320: hr_utility.trace('tax year therefore raise an error message.');
321: --
314: p_effective_date <> l_first_eff_start AND
315: to_char(p_effective_date, 'DD-MM') <> '06-04' THEN
316: hr_utility.trace('New PAYE Ref does not match the current ');
317: hr_utility.trace('PAYE Ref and new effective start date ');
318: hr_utility.trace('is not the first effective start date and ');
319: hr_utility.trace('new effective date is not start of a ');
320: hr_utility.trace('tax year therefore raise an error message.');
321: --
322: l_span_start := hr_gbbal.span_start(p_effective_date);
315: to_char(p_effective_date, 'DD-MM') <> '06-04' THEN
316: hr_utility.trace('New PAYE Ref does not match the current ');
317: hr_utility.trace('PAYE Ref and new effective start date ');
318: hr_utility.trace('is not the first effective start date and ');
319: hr_utility.trace('new effective date is not start of a ');
320: hr_utility.trace('tax year therefore raise an error message.');
321: --
322: l_span_start := hr_gbbal.span_start(p_effective_date);
323: l_span_end := hr_gbbal.span_end(p_effective_date);
316: hr_utility.trace('New PAYE Ref does not match the current ');
317: hr_utility.trace('PAYE Ref and new effective start date ');
318: hr_utility.trace('is not the first effective start date and ');
319: hr_utility.trace('new effective date is not start of a ');
320: hr_utility.trace('tax year therefore raise an error message.');
321: --
322: l_span_start := hr_gbbal.span_start(p_effective_date);
323: l_span_end := hr_gbbal.span_end(p_effective_date);
324: --
328: substr(fnd_date.date_to_canonical(l_span_end), 1, 4));
329: fnd_message.raise_error;
330: END IF;
331: --
332: hr_utility.trace('Change as at the new effective date ok, Checking as at the effective end date');
333: --
334: --
335: hr_utility.trace('Fetching Next PAYE Ref');
336: OPEN get_next_details;
331: --
332: hr_utility.trace('Change as at the new effective date ok, Checking as at the effective end date');
333: --
334: --
335: hr_utility.trace('Fetching Next PAYE Ref');
336: OPEN get_next_details;
337: FETCH get_next_details INTO l_next_scl_id;
338: CLOSE get_next_details;
339: --
336: OPEN get_next_details;
337: FETCH get_next_details INTO l_next_scl_id;
338: CLOSE get_next_details;
339: --
340: hr_utility.trace('l_next_scl_id = '||l_next_scl_id);
341: OPEN get_paye_ref(l_next_scl_id);
342: FETCH get_paye_ref INTO l_next_paye_ref;
343: CLOSE get_paye_ref;
344: --
341: OPEN get_paye_ref(l_next_scl_id);
342: FETCH get_paye_ref INTO l_next_paye_ref;
343: CLOSE get_paye_ref;
344: --
345: hr_utility.trace('l_next_paye_ref = '||l_next_paye_ref);
346: --
347: IF l_next_paye_ref <> l_new_paye_ref AND
348: l_cur_eff_end <> l_last_eff_end AND
349: to_char(l_cur_eff_end, 'DD-MM') <> '05-04' THEN
346: --
347: IF l_next_paye_ref <> l_new_paye_ref AND
348: l_cur_eff_end <> l_last_eff_end AND
349: to_char(l_cur_eff_end, 'DD-MM') <> '05-04' THEN
350: hr_utility.trace('New PAYE Ref does not match the next ');
351: hr_utility.trace('PAYE Ref and current effective end date ');
352: hr_utility.trace('is not the last effective end date and ');
353: hr_utility.trace('current effective date is not end of a ');
354: hr_utility.trace('tax year therefore raise an error message.');
347: IF l_next_paye_ref <> l_new_paye_ref AND
348: l_cur_eff_end <> l_last_eff_end AND
349: to_char(l_cur_eff_end, 'DD-MM') <> '05-04' THEN
350: hr_utility.trace('New PAYE Ref does not match the next ');
351: hr_utility.trace('PAYE Ref and current effective end date ');
352: hr_utility.trace('is not the last effective end date and ');
353: hr_utility.trace('current effective date is not end of a ');
354: hr_utility.trace('tax year therefore raise an error message.');
355: --
348: l_cur_eff_end <> l_last_eff_end AND
349: to_char(l_cur_eff_end, 'DD-MM') <> '05-04' THEN
350: hr_utility.trace('New PAYE Ref does not match the next ');
351: hr_utility.trace('PAYE Ref and current effective end date ');
352: hr_utility.trace('is not the last effective end date and ');
353: hr_utility.trace('current effective date is not end of a ');
354: hr_utility.trace('tax year therefore raise an error message.');
355: --
356: l_span_start := hr_gbbal.span_start(l_cur_eff_end);
349: to_char(l_cur_eff_end, 'DD-MM') <> '05-04' THEN
350: hr_utility.trace('New PAYE Ref does not match the next ');
351: hr_utility.trace('PAYE Ref and current effective end date ');
352: hr_utility.trace('is not the last effective end date and ');
353: hr_utility.trace('current effective date is not end of a ');
354: hr_utility.trace('tax year therefore raise an error message.');
355: --
356: l_span_start := hr_gbbal.span_start(l_cur_eff_end);
357: l_span_end := hr_gbbal.span_end(l_cur_eff_end);
350: hr_utility.trace('New PAYE Ref does not match the next ');
351: hr_utility.trace('PAYE Ref and current effective end date ');
352: hr_utility.trace('is not the last effective end date and ');
353: hr_utility.trace('current effective date is not end of a ');
354: hr_utility.trace('tax year therefore raise an error message.');
355: --
356: l_span_start := hr_gbbal.span_start(l_cur_eff_end);
357: l_span_end := hr_gbbal.span_end(l_cur_eff_end);
358: --
362: substr(fnd_date.date_to_canonical(l_span_end), 1, 4));
363: fnd_message.raise_error;
364: END IF;
365: --
366: hr_utility.trace('Change as at the end date is ok too.');
367: --
368:
369: -- START CHECK - Termination Assignment exists at the Effective start date
370: IF (l_cur_paye_ref <> l_new_paye_ref AND
411: END IF; -- PAYE Ref Changing
412: END IF; -- Date track update change insert
413: --
414:
415: hr_utility.trace('No problem with this update/correction.');
416: hr_utility.trace('Leaving pay_gb_payroll_rules.validate_update');
417: END validate_update;
418:
419: PROCEDURE validate_delete(p_effective_date IN DATE
412: END IF; -- Date track update change insert
413: --
414:
415: hr_utility.trace('No problem with this update/correction.');
416: hr_utility.trace('Leaving pay_gb_payroll_rules.validate_update');
417: END validate_update;
418:
419: PROCEDURE validate_delete(p_effective_date IN DATE
420: ,p_datetrack_mode IN VARCHAR2
499: --
500:
501: l_proc VARCHAR2(100) := 'pay_gb_payroll_rules.validate_delete';
502: BEGIN
503: hr_utility.trace('Entering '||l_proc);
504: hr_utility.trace('p_effective_date='||fnd_date.date_to_displaydate(p_effective_date));
505: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
506: hr_utility.trace('p_payroll_id='||p_payroll_id);
507: --
500:
501: l_proc VARCHAR2(100) := 'pay_gb_payroll_rules.validate_delete';
502: BEGIN
503: hr_utility.trace('Entering '||l_proc);
504: hr_utility.trace('p_effective_date='||fnd_date.date_to_displaydate(p_effective_date));
505: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
506: hr_utility.trace('p_payroll_id='||p_payroll_id);
507: --
508: hr_utility.trace('Fetching current payroll details');
501: l_proc VARCHAR2(100) := 'pay_gb_payroll_rules.validate_delete';
502: BEGIN
503: hr_utility.trace('Entering '||l_proc);
504: hr_utility.trace('p_effective_date='||fnd_date.date_to_displaydate(p_effective_date));
505: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
506: hr_utility.trace('p_payroll_id='||p_payroll_id);
507: --
508: hr_utility.trace('Fetching current payroll details');
509: OPEN get_current_details;
502: BEGIN
503: hr_utility.trace('Entering '||l_proc);
504: hr_utility.trace('p_effective_date='||fnd_date.date_to_displaydate(p_effective_date));
505: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
506: hr_utility.trace('p_payroll_id='||p_payroll_id);
507: --
508: hr_utility.trace('Fetching current payroll details');
509: OPEN get_current_details;
510: FETCH get_current_details INTO l_cur_scl_id, l_cur_eff_end;
504: hr_utility.trace('p_effective_date='||fnd_date.date_to_displaydate(p_effective_date));
505: hr_utility.trace('p_datetrack_mode='||p_datetrack_mode);
506: hr_utility.trace('p_payroll_id='||p_payroll_id);
507: --
508: hr_utility.trace('Fetching current payroll details');
509: OPEN get_current_details;
510: FETCH get_current_details INTO l_cur_scl_id, l_cur_eff_end;
511: CLOSE get_current_details;
512: --
509: OPEN get_current_details;
510: FETCH get_current_details INTO l_cur_scl_id, l_cur_eff_end;
511: CLOSE get_current_details;
512: --
513: hr_utility.trace('Currrent l_cur_scl_id='||l_cur_scl_id);
514: hr_utility.trace('Currrent l_cur_eff_end='||fnd_date.date_to_displaydate(l_cur_eff_end));
515: --
516: hr_utility.trace('Fetching Current PAYE Ref.');
517: OPEN get_paye_ref(l_cur_scl_id);
510: FETCH get_current_details INTO l_cur_scl_id, l_cur_eff_end;
511: CLOSE get_current_details;
512: --
513: hr_utility.trace('Currrent l_cur_scl_id='||l_cur_scl_id);
514: hr_utility.trace('Currrent l_cur_eff_end='||fnd_date.date_to_displaydate(l_cur_eff_end));
515: --
516: hr_utility.trace('Fetching Current PAYE Ref.');
517: OPEN get_paye_ref(l_cur_scl_id);
518: FETCH get_paye_ref INTO l_cur_paye_ref;
512: --
513: hr_utility.trace('Currrent l_cur_scl_id='||l_cur_scl_id);
514: hr_utility.trace('Currrent l_cur_eff_end='||fnd_date.date_to_displaydate(l_cur_eff_end));
515: --
516: hr_utility.trace('Fetching Current PAYE Ref.');
517: OPEN get_paye_ref(l_cur_scl_id);
518: FETCH get_paye_ref INTO l_cur_paye_ref;
519: CLOSE get_paye_ref;
520: hr_utility.trace('Current PAYE Ref is '||l_cur_paye_ref);
516: hr_utility.trace('Fetching Current PAYE Ref.');
517: OPEN get_paye_ref(l_cur_scl_id);
518: FETCH get_paye_ref INTO l_cur_paye_ref;
519: CLOSE get_paye_ref;
520: hr_utility.trace('Current PAYE Ref is '||l_cur_paye_ref);
521: --
522: hr_utility.trace('Fetching fiest start date and last end date of the payroll');
523: OPEN get_min_max_dates;
524: FETCH get_min_max_dates INTO l_first_eff_start, l_last_eff_end;
518: FETCH get_paye_ref INTO l_cur_paye_ref;
519: CLOSE get_paye_ref;
520: hr_utility.trace('Current PAYE Ref is '||l_cur_paye_ref);
521: --
522: hr_utility.trace('Fetching fiest start date and last end date of the payroll');
523: OPEN get_min_max_dates;
524: FETCH get_min_max_dates INTO l_first_eff_start, l_last_eff_end;
525: CLOSE get_min_max_dates;
526: hr_utility.trace('l_first_eff_start='||fnd_date.date_to_displaydate(l_first_eff_start));
522: hr_utility.trace('Fetching fiest start date and last end date of the payroll');
523: OPEN get_min_max_dates;
524: FETCH get_min_max_dates INTO l_first_eff_start, l_last_eff_end;
525: CLOSE get_min_max_dates;
526: hr_utility.trace('l_first_eff_start='||fnd_date.date_to_displaydate(l_first_eff_start));
527: hr_utility.trace('l_last_eff_end='||fnd_date.date_to_displaydate(l_last_eff_end));
528: --
529: IF p_datetrack_mode = hr_api.g_delete_next_change THEN
530: hr_utility.trace('Datetrack Mode is Delete next change.');
523: OPEN get_min_max_dates;
524: FETCH get_min_max_dates INTO l_first_eff_start, l_last_eff_end;
525: CLOSE get_min_max_dates;
526: hr_utility.trace('l_first_eff_start='||fnd_date.date_to_displaydate(l_first_eff_start));
527: hr_utility.trace('l_last_eff_end='||fnd_date.date_to_displaydate(l_last_eff_end));
528: --
529: IF p_datetrack_mode = hr_api.g_delete_next_change THEN
530: hr_utility.trace('Datetrack Mode is Delete next change.');
531: hr_utility.trace('Fetching end date of next instance.');
526: hr_utility.trace('l_first_eff_start='||fnd_date.date_to_displaydate(l_first_eff_start));
527: hr_utility.trace('l_last_eff_end='||fnd_date.date_to_displaydate(l_last_eff_end));
528: --
529: IF p_datetrack_mode = hr_api.g_delete_next_change THEN
530: hr_utility.trace('Datetrack Mode is Delete next change.');
531: hr_utility.trace('Fetching end date of next instance.');
532: OPEN get_next_details;
533: FETCH get_next_details INTO l_next_eff_end;
534: CLOSE get_next_details;
527: hr_utility.trace('l_last_eff_end='||fnd_date.date_to_displaydate(l_last_eff_end));
528: --
529: IF p_datetrack_mode = hr_api.g_delete_next_change THEN
530: hr_utility.trace('Datetrack Mode is Delete next change.');
531: hr_utility.trace('Fetching end date of next instance.');
532: OPEN get_next_details;
533: FETCH get_next_details INTO l_next_eff_end;
534: CLOSE get_next_details;
535: --
532: OPEN get_next_details;
533: FETCH get_next_details INTO l_next_eff_end;
534: CLOSE get_next_details;
535: --
536: hr_utility.trace('l_next_eff_date='||fnd_date.date_to_displaydate(l_next_eff_end));
537: hr_utility.trace('Fetching PAYE Ref on next to next instance.');
538: OPEN get_next_to_next_details;
539: FETCH get_next_to_next_details INTO l_next_to_next_scl_id;
540: CLOSE get_next_to_next_details;
533: FETCH get_next_details INTO l_next_eff_end;
534: CLOSE get_next_details;
535: --
536: hr_utility.trace('l_next_eff_date='||fnd_date.date_to_displaydate(l_next_eff_end));
537: hr_utility.trace('Fetching PAYE Ref on next to next instance.');
538: OPEN get_next_to_next_details;
539: FETCH get_next_to_next_details INTO l_next_to_next_scl_id;
540: CLOSE get_next_to_next_details;
541: hr_utility.trace('l_next_to_next_scl_id='||l_next_to_next_scl_id);
537: hr_utility.trace('Fetching PAYE Ref on next to next instance.');
538: OPEN get_next_to_next_details;
539: FETCH get_next_to_next_details INTO l_next_to_next_scl_id;
540: CLOSE get_next_to_next_details;
541: hr_utility.trace('l_next_to_next_scl_id='||l_next_to_next_scl_id);
542: --
543: OPEN get_paye_ref(l_next_to_next_scl_id);
544: FETCH get_paye_ref INTO l_next_to_next_paye_ref;
545: CLOSE get_paye_ref;
542: --
543: OPEN get_paye_ref(l_next_to_next_scl_id);
544: FETCH get_paye_ref INTO l_next_to_next_paye_ref;
545: CLOSE get_paye_ref;
546: hr_utility.trace('l_next_to_next_paye_ref='||l_next_to_next_paye_ref);
547: --
548: IF l_next_to_next_paye_ref <> l_cur_paye_ref AND
549: l_next_eff_end <> l_last_eff_end AND
550: to_char(l_next_eff_end, 'DD-MM') <> '05-04' THEN
548: IF l_next_to_next_paye_ref <> l_cur_paye_ref AND
549: l_next_eff_end <> l_last_eff_end AND
550: to_char(l_next_eff_end, 'DD-MM') <> '05-04' THEN
551: --
552: hr_utility.trace('Current PAYE Ref does not match the PAYE ');
553: hr_utility.trace('Ref on next to next instance and next effective ');
554: hr_utility.trace('end date is not the last effective end date and ');
555: hr_utility.trace('next effective end date is not end of a ');
556: hr_utility.trace('tax year therefore raise an error message.');
549: l_next_eff_end <> l_last_eff_end AND
550: to_char(l_next_eff_end, 'DD-MM') <> '05-04' THEN
551: --
552: hr_utility.trace('Current PAYE Ref does not match the PAYE ');
553: hr_utility.trace('Ref on next to next instance and next effective ');
554: hr_utility.trace('end date is not the last effective end date and ');
555: hr_utility.trace('next effective end date is not end of a ');
556: hr_utility.trace('tax year therefore raise an error message.');
557: --
550: to_char(l_next_eff_end, 'DD-MM') <> '05-04' THEN
551: --
552: hr_utility.trace('Current PAYE Ref does not match the PAYE ');
553: hr_utility.trace('Ref on next to next instance and next effective ');
554: hr_utility.trace('end date is not the last effective end date and ');
555: hr_utility.trace('next effective end date is not end of a ');
556: hr_utility.trace('tax year therefore raise an error message.');
557: --
558: l_span_start := hr_gbbal.span_start(l_next_eff_end);
551: --
552: hr_utility.trace('Current PAYE Ref does not match the PAYE ');
553: hr_utility.trace('Ref on next to next instance and next effective ');
554: hr_utility.trace('end date is not the last effective end date and ');
555: hr_utility.trace('next effective end date is not end of a ');
556: hr_utility.trace('tax year therefore raise an error message.');
557: --
558: l_span_start := hr_gbbal.span_start(l_next_eff_end);
559: l_span_end := hr_gbbal.span_end(l_next_eff_end);
552: hr_utility.trace('Current PAYE Ref does not match the PAYE ');
553: hr_utility.trace('Ref on next to next instance and next effective ');
554: hr_utility.trace('end date is not the last effective end date and ');
555: hr_utility.trace('next effective end date is not end of a ');
556: hr_utility.trace('tax year therefore raise an error message.');
557: --
558: l_span_start := hr_gbbal.span_start(l_next_eff_end);
559: l_span_end := hr_gbbal.span_end(l_next_eff_end);
560: --
590: -- END CHECK - Termination Assignment exists at the Effective start date
591:
592: END IF; -- Datetrack mode is Remove next change
593: --
594: hr_utility.trace('No problem with this delete.');
595: hr_utility.trace('Leaving pay_gb_payroll_rules.validate_delete');
596: END validate_delete;
597:
598: END;
591:
592: END IF; -- Datetrack mode is Remove next change
593: --
594: hr_utility.trace('No problem with this delete.');
595: hr_utility.trace('Leaving pay_gb_payroll_rules.validate_delete');
596: END validate_delete;
597:
598: END;