1: package body hr_elements as
2: /* $Header: pyelemnt.pkb 120.1 2005/11/01 09:16:20 alogue noship $ */
3: g_debug boolean := hr_utility.debug_enabled;
4: --
5: /*
6: NAME
7: chk_element_name
40: end;
41: --
42: if v_validation_check = 'N' then
43: --
44: hr_utility.set_message(801,'PAY_6137_ELEMENT_DUP_NAME');
45: hr_utility.raise_error;
46: --
47: end if;
48: --
41: --
42: if v_validation_check = 'N' then
43: --
44: hr_utility.set_message(801,'PAY_6137_ELEMENT_DUP_NAME');
45: hr_utility.raise_error;
46: --
47: end if;
48: --
49: end chk_element_name;
89: -- end;
90: --
91: -- if v_validation_check = 'N' then
92: --
93: -- hr_utility.set_message(801,'PAY_6138_ELEMENT_DUP_REP_NAME');
94: -- hr_utility.raise_error;
95: --
96: -- end if;
97: --
90: --
91: -- if v_validation_check = 'N' then
92: --
93: -- hr_utility.set_message(801,'PAY_6138_ELEMENT_DUP_REP_NAME');
94: -- hr_utility.raise_error;
95: --
96: -- end if;
97: --
98: end chk_reporting_name;
131: v_validation_check := 'Y';
132: --
133: --
134: if g_debug then
135: hr_utility.set_location('hr_elements.chk_element_type', 1);
136: end if;
137: -- Check element name
138: hr_elements.chk_element_name(p_element_name,
139: p_element_type_id,
159: if p_recurring_flag = 'N' then
160: --
161: if p_standard_flag = 'Y' then
162: --
163: hr_utility.set_message(801,'PAY_6140_ELEMENT_NO_STANDARD');
164: hr_utility.raise_error;
165: --
166: -- **** 30.49 ***** Column removed from table.
167: -- elsif p_supplemental_run_flag = 'Y' then
160: --
161: if p_standard_flag = 'Y' then
162: --
163: hr_utility.set_message(801,'PAY_6140_ELEMENT_NO_STANDARD');
164: hr_utility.raise_error;
165: --
166: -- **** 30.49 ***** Column removed from table.
167: -- elsif p_supplemental_run_flag = 'Y' then
168: --
165: --
166: -- **** 30.49 ***** Column removed from table.
167: -- elsif p_supplemental_run_flag = 'Y' then
168: --
169: -- hr_utility.set_message(801,'PAY_6141_ELEMENT_NO_SUP_RUN');
170: -- hr_utility.raise_error;
171: --
172: elsif p_scndry_ent_allwd_flag = 'Y' then
173: --
166: -- **** 30.49 ***** Column removed from table.
167: -- elsif p_supplemental_run_flag = 'Y' then
168: --
169: -- hr_utility.set_message(801,'PAY_6141_ELEMENT_NO_SUP_RUN');
170: -- hr_utility.raise_error;
171: --
172: elsif p_scndry_ent_allwd_flag = 'Y' then
173: --
174: hr_utility.set_message(801,'PAY_6142_ELEMENT_NO_ADD_ENTRY');
170: -- hr_utility.raise_error;
171: --
172: elsif p_scndry_ent_allwd_flag = 'Y' then
173: --
174: hr_utility.set_message(801,'PAY_6142_ELEMENT_NO_ADD_ENTRY');
175: hr_utility.raise_error;
176: --
177: end if;
178: --
171: --
172: elsif p_scndry_ent_allwd_flag = 'Y' then
173: --
174: hr_utility.set_message(801,'PAY_6142_ELEMENT_NO_ADD_ENTRY');
175: hr_utility.raise_error;
176: --
177: end if;
178: --
179: end if;
181: -- only flag must be 'N'
182: --
183: If p_recurring_flag = 'R' and p_indirect_only_flag = 'Y' then
184: --
185: hr_utility.set_message(801,'PAY_6707_ELEMENT_NO_REC_IND');
186: hr_utility.raise_error;
187: --
188: elsif p_recurring_flag = 'R' and p_adjustment_only_flag = 'Y' then
189: --
182: --
183: If p_recurring_flag = 'R' and p_indirect_only_flag = 'Y' then
184: --
185: hr_utility.set_message(801,'PAY_6707_ELEMENT_NO_REC_IND');
186: hr_utility.raise_error;
187: --
188: elsif p_recurring_flag = 'R' and p_adjustment_only_flag = 'Y' then
189: --
190: hr_utility.set_message(801,'PAY_6712_ELEMENT_NO_REC_ADJ');
186: hr_utility.raise_error;
187: --
188: elsif p_recurring_flag = 'R' and p_adjustment_only_flag = 'Y' then
189: --
190: hr_utility.set_message(801,'PAY_6712_ELEMENT_NO_REC_ADJ');
191: hr_utility.raise_error;
192: --
193: end if;
194: --
187: --
188: elsif p_recurring_flag = 'R' and p_adjustment_only_flag = 'Y' then
189: --
190: hr_utility.set_message(801,'PAY_6712_ELEMENT_NO_REC_ADJ');
191: hr_utility.raise_error;
192: --
193: end if;
194: --
195: -- For a personnel element the Indirect Only Flag and the Adjustment Only
197: if p_process_in_run_flag = 'N' then
198: --
199: if p_indirect_only_flag = 'Y' then
200: --
201: hr_utility.set_message(801,'PAY_6143_ELEMENT_NO_INDIRECT');
202: hr_utility.raise_error;
203: --
204: elsif p_adjustment_only_flag = 'Y' then
205: --
198: --
199: if p_indirect_only_flag = 'Y' then
200: --
201: hr_utility.set_message(801,'PAY_6143_ELEMENT_NO_INDIRECT');
202: hr_utility.raise_error;
203: --
204: elsif p_adjustment_only_flag = 'Y' then
205: --
206: hr_utility.set_message(801,'PAY_6144_ELEMENT_NO_ADJUST');
202: hr_utility.raise_error;
203: --
204: elsif p_adjustment_only_flag = 'Y' then
205: --
206: hr_utility.set_message(801,'PAY_6144_ELEMENT_NO_ADJUST');
207: hr_utility.raise_error;
208: --
209: end if;
210: --
203: --
204: elsif p_adjustment_only_flag = 'Y' then
205: --
206: hr_utility.set_message(801,'PAY_6144_ELEMENT_NO_ADJUST');
207: hr_utility.raise_error;
208: --
209: end if;
210: --
211: end if;
217: -- them
218: if (p_classification_type = 'N') then
219: if (p_bus_grp_currency_code <> p_output_currency_code) then
220: --
221: hr_utility.set_message(801,'PAY_6145_ELEMENT_OUTPUT_CURR');
222: hr_utility.raise_error;
223: --
224: elsif (p_input_currency_code is null) then
225: --
218: if (p_classification_type = 'N') then
219: if (p_bus_grp_currency_code <> p_output_currency_code) then
220: --
221: hr_utility.set_message(801,'PAY_6145_ELEMENT_OUTPUT_CURR');
222: hr_utility.raise_error;
223: --
224: elsif (p_input_currency_code is null) then
225: --
226: hr_utility.set_message(801,'PAY_6585_ELEMENT_CURRENCY_MAN');
222: hr_utility.raise_error;
223: --
224: elsif (p_input_currency_code is null) then
225: --
226: hr_utility.set_message(801,'PAY_6585_ELEMENT_CURRENCY_MAN');
227: hr_utility.raise_error;
228: --
229: end if;
230: else -- if the classification is a non payments type
223: --
224: elsif (p_input_currency_code is null) then
225: --
226: hr_utility.set_message(801,'PAY_6585_ELEMENT_CURRENCY_MAN');
227: hr_utility.raise_error;
228: --
229: end if;
230: else -- if the classification is a non payments type
231: if (p_input_currency_code is null and p_output_currency_code is not null)
231: if (p_input_currency_code is null and p_output_currency_code is not null)
232: or (p_output_currency_code is null and p_input_Currency_Code is not null)
233: then
234: --
235: hr_utility.set_message(801,'PAY_6585_ELEMENT_CURRENCY_MAN');
236: hr_utility.raise_error;
237: --
238: end if;
239: end if;
232: or (p_output_currency_code is null and p_input_Currency_Code is not null)
233: then
234: --
235: hr_utility.set_message(801,'PAY_6585_ELEMENT_CURRENCY_MAN');
236: hr_utility.raise_error;
237: --
238: end if;
239: end if;
240: --
241: -- If the adjustment only flag is set to 'Y' then the multiply value flag
242: -- must be 'N'.
243: if p_adjustment_only_flag = 'Y' and p_multiply_value_flag = 'Y' then
244: --
245: hr_utility.set_message(801,'PAY_6904_ELEMENT_NO_AD_AND_MUL');
246: hr_utility.raise_error;
247: --
248: end if;
249: --
242: -- must be 'N'.
243: if p_adjustment_only_flag = 'Y' and p_multiply_value_flag = 'Y' then
244: --
245: hr_utility.set_message(801,'PAY_6904_ELEMENT_NO_AD_AND_MUL');
246: hr_utility.raise_error;
247: --
248: end if;
249: --
250: end chk_element_type;
288: v_validation_check varchar2(1) := 'Y';
289: l_no_process_update varchar2(1) := 'N';
290: --
291: begin
292: g_debug := hr_utility.debug_enabled;
293: --
294: -- Classification, Adjustment only flag, Indirect only flag,
295: -- Secondary entries allowed flag and Post termination rule cannot
296: -- be changed if there are any element links for the element.
313: and el.effective_start_date <= p_val_end_date
314: and el.effective_end_date >= p_val_start_date);
315: --
316: if g_debug then
317: hr_utility.set_location('hr_elements.chk_upd_element_type', 1);
318: end if;
319: --
320: exception
321: when NO_DATA_FOUND then NULL;
322: end;
323: --
324: if v_validation_check = 'N' then
325: --
326: hr_utility.set_message(801,'PAY_6147_ELEMENT_LINK_UPDATE');
327: hr_utility.raise_error;
328: --
329: end if;
330: --
323: --
324: if v_validation_check = 'N' then
325: --
326: hr_utility.set_message(801,'PAY_6147_ELEMENT_LINK_UPDATE');
327: hr_utility.raise_error;
328: --
329: end if;
330: --
331: -- The these fields can only be corrected and only if there is
331: -- The these fields can only be corrected and only if there is
332: -- only one record for the element type.
333: --
334: if (p_update_mode <> 'CORRECTION') then
335: hr_utility.set_message(801,'PAY_6460_ELEMENT_NO_PROC_CORR');
336: hr_utility.raise_error;
337: else
338: -- We need to check to see if the correction will last for the lifetime
339: -- of the element type
332: -- only one record for the element type.
333: --
334: if (p_update_mode <> 'CORRECTION') then
335: hr_utility.set_message(801,'PAY_6460_ELEMENT_NO_PROC_CORR');
336: hr_utility.raise_error;
337: else
338: -- We need to check to see if the correction will last for the lifetime
339: -- of the element type
340: --
356: when NO_DATA_FOUND then NULL;
357: end;
358: --
359: if (l_no_process_update = 'N') then
360: hr_utility.set_message(801,'PAY_6460_ELEMENT_NO_PROC_CORR');
361: hr_utility.raise_error;
362: end if;
363: --
364: end if;
357: end;
358: --
359: if (l_no_process_update = 'N') then
360: hr_utility.set_message(801,'PAY_6460_ELEMENT_NO_PROC_CORR');
361: hr_utility.raise_error;
362: end if;
363: --
364: end if;
365: --
376: -- id is null.
377: --
378: if (p_business_group_id is null) then
379: --
380: hr_utility.set_message(801,'PAY_6624_ELEMENT_NO_NAME_UPD');
381: hr_utility.raise_error;
382: --
383: end if;
384: --
377: --
378: if (p_business_group_id is null) then
379: --
380: hr_utility.set_message(801,'PAY_6624_ELEMENT_NO_NAME_UPD');
381: hr_utility.raise_error;
382: --
383: end if;
384: --
385: if (p_update_mode <> 'CORRECTION') then
382: --
383: end if;
384: --
385: if (p_update_mode <> 'CORRECTION') then
386: hr_utility.set_message(801,'PAY_6727_ELEMENT_NO_UPD_NAME');
387: hr_utility.raise_error;
388: else
389: -- We need to check to see if the correction will last for the lifetime
390: -- of the element type
383: end if;
384: --
385: if (p_update_mode <> 'CORRECTION') then
386: hr_utility.set_message(801,'PAY_6727_ELEMENT_NO_UPD_NAME');
387: hr_utility.raise_error;
388: else
389: -- We need to check to see if the correction will last for the lifetime
390: -- of the element type
391: --
407: when NO_DATA_FOUND then NULL;
408: end;
409: --
410: if (l_no_process_update = 'N') then
411: hr_utility.set_message(801,'PAY_6727_ELEMENT_NO_UPD_NAME');
412: hr_utility.raise_error;
413: end if;
414: --
415: end if;
408: end;
409: --
410: if (l_no_process_update = 'N') then
411: hr_utility.set_message(801,'PAY_6727_ELEMENT_NO_UPD_NAME');
412: hr_utility.raise_error;
413: end if;
414: --
415: end if;
416: end if;
424: p_processing_priority,
425: p_val_start_date,
426: p_val_end_date) = FALSE then
427: --
428: hr_utility.set_message(801,'PAY_6149_ELEMENT_PRIORITY_UPD');
429: hr_utility.raise_error;
430: --
431: end if;
432: --
425: p_val_start_date,
426: p_val_end_date) = FALSE then
427: --
428: hr_utility.set_message(801,'PAY_6149_ELEMENT_PRIORITY_UPD');
429: hr_utility.raise_error;
430: --
431: end if;
432: --
433: -- Indirect only, process in run and termination processing rule can
458: end;
459: --
460: if v_validation_check = 'N' then
461: --
462: hr_utility.set_message(801,'PAY_6912_ELEMENT_NO_FRR_UPD');
463: hr_utility.raise_error;
464: --
465: end if;
466: --
459: --
460: if v_validation_check = 'N' then
461: --
462: hr_utility.set_message(801,'PAY_6912_ELEMENT_NO_FRR_UPD');
463: hr_utility.raise_error;
464: --
465: end if;
466: --
467: begin
485: end;
486: --
487: if v_validation_check = 'N' then
488: --
489: hr_utility.set_message(801,'PAY_6909_ELEMENT_NO_UPD_RR');
490: hr_utility.raise_error;
491: --
492: end if;
493: --
486: --
487: if v_validation_check = 'N' then
488: --
489: hr_utility.set_message(801,'PAY_6909_ELEMENT_NO_UPD_RR');
490: hr_utility.raise_error;
491: --
492: end if;
493: --
494: end if;
511: --
512: v_validation_check varchar2(1) := 'Y';
513: --
514: begin
515: g_debug := hr_utility.debug_enabled;
516: --
517: -- Check from status processing rule end
518: begin
519: --
537: and fr.effective_start_date <= p_val_end_date
538: and fr.effective_end_date >= p_val_start_date);
539: --
540: if g_debug then
541: hr_utility.set_location('hr_elements.chk_upd_element_type', 3);
542: end if;
543: --
544: exception
545: when NO_DATA_FOUND then NULL;
571: and spr.effective_start_date <= p_val_end_date
572: and spr.effective_end_date >= p_val_start_date);
573: --
574: if g_debug then
575: hr_utility.set_location('hr_elements.chk_upd_element_type', 4);
576: end if;
577: --
578: exception
579: when OTHERS then NULL;
620: And effective_end_date >= p_val_start_date
621: and effective_start_date <= p_val_end_date;
622: --
623: begin
624: g_debug := hr_utility.debug_enabled;
625: --
626: v_validation_check := 'Y';
627: --
628: if g_debug then
625: --
626: v_validation_check := 'Y';
627: --
628: if g_debug then
629: hr_utility.set_location('hr_elements.chk_del_element_type', 1);
630: end if;
631: --
632: -- Check to see if any element links exist over the validation period
633: begin
645: end;
646: --
647: if v_validation_check = 'N' then
648: --
649: hr_utility.set_message(801,'PAY_6155_ELEMENT_NO_DEL_LINK');
650: hr_utility.raise_error;
651: --
652: end if;
653: --
646: --
647: if v_validation_check = 'N' then
648: --
649: hr_utility.set_message(801,'PAY_6155_ELEMENT_NO_DEL_LINK');
650: hr_utility.raise_error;
651: --
652: end if;
653: --
654: if g_debug then
651: --
652: end if;
653: --
654: if g_debug then
655: hr_utility.set_location('hr_elements.chk_del_element_type', 2);
656: end if;
657: --
658: -- We need to check the input values. Input values can be deleted but not
659: -- if any of the conditions regarding input value deletion are broached
661: p_val_start_date,
662: p_val_end_date) loop
663: --
664: if g_debug then
665: hr_utility.trace(to_char(iv_rec.input_value_id));
666: end if;
667: hr_input_values.chk_del_input_values(p_mode,
668: p_val_start_date,
669: p_val_end_date,
673: -- We cannot delete any element types if there are run results for them.
674: -- The effective date of run results is found from the payroll actions table.
675: --
676: if g_debug then
677: hr_utility.set_location('hr_elements.chk_del_element_type', 3);
678: end if;
679: --
680: begin
681: --
698: end;
699: --
700: if v_run_results_exist = 'Y' then
701: --
702: hr_utility.set_message(801,'PAY_6242_ELEMENTS_NO_DEL_RR');
703: hr_utility.raise_error;
704: --
705: end if;
706: --
699: --
700: if v_run_results_exist = 'Y' then
701: --
702: hr_utility.set_message(801,'PAY_6242_ELEMENTS_NO_DEL_RR');
703: hr_utility.raise_error;
704: --
705: end if;
706: --
707: -- Check to see if element is being used in an element set. This only need
724: end;
725: --
726: if v_element_rules_exist = 'Y' then
727: --
728: hr_utility.set_message(801,'PAY_6713_ELEMENT_NO_DEL_RULE');
729: hr_utility.raise_error;
730: --
731: end if;
732: end if;
725: --
726: if v_element_rules_exist = 'Y' then
727: --
728: hr_utility.set_message(801,'PAY_6713_ELEMENT_NO_DEL_RULE');
729: hr_utility.raise_error;
730: --
731: end if;
732: end if;
733: --
740: p_processing_priority,
741: p_val_start_date,
742: p_val_end_date) = FALSE then
743: --
744: hr_utility.set_message(801,'PAY_6914_ELEMENT_PRI_NCD');
745: hr_utility.raise_error;
746: --
747: end if;
748: --
741: p_val_start_date,
742: p_val_end_date) = FALSE then
743: --
744: hr_utility.set_message(801,'PAY_6914_ELEMENT_PRI_NCD');
745: hr_utility.raise_error;
746: --
747: end if;
748: --
749: end chk_del_element_type;
773: --
774: l_check_latest_balances boolean;
775: --
776: begin
777: g_debug := hr_utility.debug_enabled;
778: --
779: --
780: if g_debug then
781: hr_utility.set_location('hr_elements.ins_input_value', 1);
777: g_debug := hr_utility.debug_enabled;
778: --
779: --
780: if g_debug then
781: hr_utility.set_location('hr_elements.ins_input_value', 1);
782: end if;
783: --
784: -- Obtain sequence number for input value
785: select pay_input_values_s.nextval
787: from sys.dual;
788: --
789: --
790: if g_debug then
791: hr_utility.set_location('hr_elements.ins_input_value', 2);
792: end if;
793: --
794: -- Obtain Pay value name from hr_lookups
795: l_pay_value_name := hr_input_values.get_pay_value_name
798: c_user_id := fnd_global.user_id;
799: c_login_id := fnd_global.login_id;
800: --
801: if g_debug then
802: hr_utility.set_location('hr_elements.ins_input_value', 3);
803: end if;
804: --
805: -- Create PAY_VALUE for element type.
806: insert into pay_input_values_f
845: where et.element_type_id = p_element_type_id
846: and et.effective_start_date = p_val_start_date;
847: --
848: if SQL%NOTFOUND then
849: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
850: hr_utility.set_message_token('PROCEDURE','ins_input_value');
851: hr_utility.set_message_token('STEP','1');
852: hr_utility.raise_error;
853: end if;
846: and et.effective_start_date = p_val_start_date;
847: --
848: if SQL%NOTFOUND then
849: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
850: hr_utility.set_message_token('PROCEDURE','ins_input_value');
851: hr_utility.set_message_token('STEP','1');
852: hr_utility.raise_error;
853: end if;
854: --
847: --
848: if SQL%NOTFOUND then
849: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
850: hr_utility.set_message_token('PROCEDURE','ins_input_value');
851: hr_utility.set_message_token('STEP','1');
852: hr_utility.raise_error;
853: end if;
854: --
855: insert into PAY_INPUT_VALUES_F_TL (
848: if SQL%NOTFOUND then
849: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
850: hr_utility.set_message_token('PROCEDURE','ins_input_value');
851: hr_utility.set_message_token('STEP','1');
852: hr_utility.raise_error;
853: end if;
854: --
855: insert into PAY_INPUT_VALUES_F_TL (
856: INPUT_VALUE_ID,
880: where T.INPUT_VALUE_ID = v_input_value_id
881: and T.LANGUAGE = L.LANGUAGE_CODE);
882: --
883: if g_debug then
884: hr_utility.set_location('hr_elements.ins_input_value', 4);
885: end if;
886: --
887: -- if this record is in startup or generic mode then insert some ownerships
888: -- for it
984: l_dummy varchar2(1);
985: l_legislation_code varchar2(30) := null;
986: --
987: begin
988: g_debug := hr_utility.debug_enabled;
989: --
990: if g_debug then
991: hr_utility.set_location('hr_elements.ins_sub_class_rule', 1);
992: end if;
987: begin
988: g_debug := hr_utility.debug_enabled;
989: --
990: if g_debug then
991: hr_utility.set_location('hr_elements.ins_sub_class_rule', 1);
992: end if;
993: --
994: for subcr_rec in get_sub_classifications(p_classification_id) loop
995: --
1035: ,p_business_group_id
1036: ,l_legislation_code);
1037: --
1038: if SQL%NOTFOUND then
1039: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1040: hr_utility.set_message_token('PROCEDURE','ins_sub_classification_rule');
1041: hr_utility.set_message_token('STEP','1');
1042: hr_utility.raise_error;
1043: end if;
1036: ,l_legislation_code);
1037: --
1038: if SQL%NOTFOUND then
1039: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1040: hr_utility.set_message_token('PROCEDURE','ins_sub_classification_rule');
1041: hr_utility.set_message_token('STEP','1');
1042: hr_utility.raise_error;
1043: end if;
1044: --
1037: --
1038: if SQL%NOTFOUND then
1039: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1040: hr_utility.set_message_token('PROCEDURE','ins_sub_classification_rule');
1041: hr_utility.set_message_token('STEP','1');
1042: hr_utility.raise_error;
1043: end if;
1044: --
1045: -- if this record is in startup or generic mode then insert some ownerships
1038: if SQL%NOTFOUND then
1039: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1040: hr_utility.set_message_token('PROCEDURE','ins_sub_classification_rule');
1041: hr_utility.set_message_token('STEP','1');
1042: hr_utility.raise_error;
1043: end if;
1044: --
1045: -- if this record is in startup or generic mode then insert some ownerships
1046: -- for it
1096: p_val_end_date in date,
1097: p_startup_mode in varchar2) is
1098: --
1099: begin
1100: g_debug := hr_utility.debug_enabled;
1101: --
1102: -- Only create the default status processing rule and PAY_VALUE if the
1103: -- element is to be used by the payroll run.
1104: if p_process_in_run_flag = 'Y' and p_non_payments_flag = 'N' then
1147: p_val_end_date in date,
1148: p_startup_mode in varchar2) is
1149: --
1150: begin
1151: g_debug := hr_utility.debug_enabled;
1152: --
1153: if g_debug then
1154: hr_utility.set_location('hr_elements.del_formula_result_rules', 1);
1155: end if;
1150: begin
1151: g_debug := hr_utility.debug_enabled;
1152: --
1153: if g_debug then
1154: hr_utility.set_location('hr_elements.del_formula_result_rules', 1);
1155: end if;
1156: --
1157: if p_delete_mode = 'ZAP' then
1158: --
1174: --
1175: elsif p_delete_mode = 'DELETE' then
1176: --
1177: if g_debug then
1178: hr_utility.set_location('hr_elements.del_formula_result_rules', 2);
1179: end if;
1180: --
1181: -- delete all future records
1182: delete from pay_formula_result_rules_f
1230: and effective_end_date >= p_val_start_date
1231: for update;
1232: --
1233: begin
1234: g_debug := hr_utility.debug_enabled;
1235: --
1236: if g_debug then
1237: hr_utility.set_location('hr_elements.del_status_processing_rules', 1);
1238: end if;
1233: begin
1234: g_debug := hr_utility.debug_enabled;
1235: --
1236: if g_debug then
1237: hr_utility.set_location('hr_elements.del_status_processing_rules', 1);
1238: end if;
1239: --
1240: for spr_rec in get_sprs(p_element_type_id,
1241: p_val_start_date,
1269: --
1270: elsif p_delete_mode = 'DELETE' then
1271: --
1272: if g_debug then
1273: hr_utility.set_location('hr_elements.del_status_processing_rules', 2);
1274: end if;
1275: --
1276: -- delete all future records
1277: delete from pay_status_processing_rules_f
1313: p_startup_mode in varchar2) is
1314: --
1315: v_end_of_time date;
1316: begin
1317: g_debug := hr_utility.debug_enabled;
1318: --
1319: if g_debug then
1320: hr_utility.set_location('hr_elements.del_sub_classification_rules', 1);
1321: end if;
1316: begin
1317: g_debug := hr_utility.debug_enabled;
1318: --
1319: if g_debug then
1320: hr_utility.set_location('hr_elements.del_sub_classification_rules', 1);
1321: end if;
1322: --
1323: -- Delete the sub_classification_rules. The balance_feeds will have already
1324: -- been deleted as part of the delete input values procedure
1344: elsif p_delete_mode = 'DELETE' then
1345: --
1346: --
1347: if g_debug then
1348: hr_utility.set_location('hr_elements.del_sub_classification_rules', 2);
1349: end if;
1350: --
1351: -- delete all future records
1352: delete from pay_sub_classification_rules_f
1424: and iv.effective_end_date >= p_val_start_date
1425: for update;
1426: --
1427: begin
1428: g_debug := hr_utility.debug_enabled;
1429: --
1430: --
1431: if g_debug then
1432: hr_utility.set_location('hr_elements.del_3p_element_type', 1);
1428: g_debug := hr_utility.debug_enabled;
1429: --
1430: --
1431: if g_debug then
1432: hr_utility.set_location('hr_elements.del_3p_element_type', 1);
1433: end if;
1434: --
1435: -- Select all input values.
1436: -- Perform all 3p deletes for these input values then delete the input values
1447: --
1448: end loop;
1449: --
1450: if g_debug then
1451: hr_utility.set_location('hr_elements.del_3p_element_type', 2);
1452: end if;
1453: --
1454: --
1455: if p_delete_mode = 'ZAP' then
1472: elsif p_delete_mode = 'DELETE' then
1473: --
1474: --
1475: if g_debug then
1476: hr_utility.set_location('hr_elements.del_3p_element_type', 3);
1477: end if;
1478: --
1479: -- delete all future records
1480: delete from pay_input_values_f
1494: elsif p_delete_mode = 'DELETE_NEXT_CHANGE' then
1495: --
1496: --
1497: if g_debug then
1498: hr_utility.set_location('hr_elements.del_3p_element_type', 4);
1499: end if;
1500: --
1501: begin
1502: --
1518: if l_on_final_record = 'Y' then
1519: --
1520: --
1521: if g_debug then
1522: hr_utility.set_location('hr_elements.del_3p_element_type', 5);
1523: end if;
1524: --
1525: v_end_of_time := to_date('31/12/4712', 'DD/MM/YYYY');
1526: --
1576: --
1577: l_session_id number;
1578: --
1579: begin
1580: g_debug := hr_utility.debug_enabled;
1581: --
1582: if g_debug then
1583: hr_utility.set_location('ins_ownerships', 1);
1584: end if;
1579: begin
1580: g_debug := hr_utility.debug_enabled;
1581: --
1582: if g_debug then
1583: hr_utility.set_location('ins_ownerships', 1);
1584: end if;
1585: --
1586: insert into hr_application_ownerships
1587: (key_name,
1594: where ao.key_name = 'ELEMENT_TYPE_ID'
1595: and ao.key_value = p_element_type_id;
1596: --
1597: if SQL%NOTFOUND then
1598: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1599: hr_utility.set_message_token('PROCEDURE', 'ins_ownerships');
1600: hr_utility.set_message_token('STEP', '1');
1601: hr_utility.raise_error;
1602: end if;
1595: and ao.key_value = p_element_type_id;
1596: --
1597: if SQL%NOTFOUND then
1598: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1599: hr_utility.set_message_token('PROCEDURE', 'ins_ownerships');
1600: hr_utility.set_message_token('STEP', '1');
1601: hr_utility.raise_error;
1602: end if;
1603: --
1596: --
1597: if SQL%NOTFOUND then
1598: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1599: hr_utility.set_message_token('PROCEDURE', 'ins_ownerships');
1600: hr_utility.set_message_token('STEP', '1');
1601: hr_utility.raise_error;
1602: end if;
1603: --
1604:
1597: if SQL%NOTFOUND then
1598: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1599: hr_utility.set_message_token('PROCEDURE', 'ins_ownerships');
1600: hr_utility.set_message_token('STEP', '1');
1601: hr_utility.raise_error;
1602: end if;
1603: --
1604:
1605: end ins_ownerships;
1626: -- can use the whole period by setting the
1627: -- "FREQ_RULE_WHOLE_PERIOD".
1628: --
1629: --
1630: g_debug := hr_utility.debug_enabled;
1631: p_skip_element := 'N';
1632: --
1633: -- See if freq rule even comes into play here:
1634: --
1632: --
1633: -- See if freq rule even comes into play here:
1634: --
1635: if g_debug then
1636: hr_utility.set_location('check_element_freq', 45);
1637: end if;
1638: SELECT COUNT(0)
1639: INTO v_freq_rule_exists
1640: FROM pay_ele_payroll_freq_rules EPF
1670: -- Get period number in Month or Year according to number per fiscal year.
1671: -- ...into v_run_number...
1672: -- What we NEED is the actual PERIOD # w/in Month or Year.
1673: if g_debug then
1674: hr_utility.trace('v_number_per_fy='||to_char(v_number_per_fy));
1675: end if;
1676:
1677: IF v_number_per_fy < 12 THEN
1678: if g_debug then
1675: end if;
1676:
1677: IF v_number_per_fy < 12 THEN
1678: if g_debug then
1679: hr_utility.set_location('check_element_freq', 20);
1680: hr_utility.trace('v_period_end_date='||to_char(v_period_end_date,'YYYY/MM/DD'));
1681: hr_utility.trace('v_period_start_date='||to_char(v_period_start_date,'YYYY/MM/DD'));
1682: hr_utility.trace('p_passed_date='||to_char(p_passed_date,'YYYY/MM/DD'));
1683: end if;
1676:
1677: IF v_number_per_fy < 12 THEN
1678: if g_debug then
1679: hr_utility.set_location('check_element_freq', 20);
1680: hr_utility.trace('v_period_end_date='||to_char(v_period_end_date,'YYYY/MM/DD'));
1681: hr_utility.trace('v_period_start_date='||to_char(v_period_start_date,'YYYY/MM/DD'));
1682: hr_utility.trace('p_passed_date='||to_char(p_passed_date,'YYYY/MM/DD'));
1683: end if;
1684: --
1677: IF v_number_per_fy < 12 THEN
1678: if g_debug then
1679: hr_utility.set_location('check_element_freq', 20);
1680: hr_utility.trace('v_period_end_date='||to_char(v_period_end_date,'YYYY/MM/DD'));
1681: hr_utility.trace('v_period_start_date='||to_char(v_period_start_date,'YYYY/MM/DD'));
1682: hr_utility.trace('p_passed_date='||to_char(p_passed_date,'YYYY/MM/DD'));
1683: end if;
1684: --
1685: if p_whole_period_only in ('D','N') then
1678: if g_debug then
1679: hr_utility.set_location('check_element_freq', 20);
1680: hr_utility.trace('v_period_end_date='||to_char(v_period_end_date,'YYYY/MM/DD'));
1681: hr_utility.trace('v_period_start_date='||to_char(v_period_start_date,'YYYY/MM/DD'));
1682: hr_utility.trace('p_passed_date='||to_char(p_passed_date,'YYYY/MM/DD'));
1683: end if;
1684: --
1685: if p_whole_period_only in ('D','N') then
1686: SELECT COUNT(0)
1709: end if;
1710: --
1711: ELSIF v_number_per_fy > 13 THEN
1712: if g_debug then
1713: hr_utility.set_location('check_element_freq', 30);
1714: hr_utility.trace('v_period_end_date='||to_char(v_period_end_date,'YYYY/MM/DD'));
1715: hr_utility.trace('v_period_start_date='||to_char(v_period_start_date,'YYYY/MM/DD'));
1716: hr_utility.trace('p_passed_date='||to_char(p_passed_date,'YYYY/MM/DD'));
1717: end if;
1710: --
1711: ELSIF v_number_per_fy > 13 THEN
1712: if g_debug then
1713: hr_utility.set_location('check_element_freq', 30);
1714: hr_utility.trace('v_period_end_date='||to_char(v_period_end_date,'YYYY/MM/DD'));
1715: hr_utility.trace('v_period_start_date='||to_char(v_period_start_date,'YYYY/MM/DD'));
1716: hr_utility.trace('p_passed_date='||to_char(p_passed_date,'YYYY/MM/DD'));
1717: end if;
1718: --
1711: ELSIF v_number_per_fy > 13 THEN
1712: if g_debug then
1713: hr_utility.set_location('check_element_freq', 30);
1714: hr_utility.trace('v_period_end_date='||to_char(v_period_end_date,'YYYY/MM/DD'));
1715: hr_utility.trace('v_period_start_date='||to_char(v_period_start_date,'YYYY/MM/DD'));
1716: hr_utility.trace('p_passed_date='||to_char(p_passed_date,'YYYY/MM/DD'));
1717: end if;
1718: --
1719: if p_whole_period_only in ('D','N') then
1712: if g_debug then
1713: hr_utility.set_location('check_element_freq', 30);
1714: hr_utility.trace('v_period_end_date='||to_char(v_period_end_date,'YYYY/MM/DD'));
1715: hr_utility.trace('v_period_start_date='||to_char(v_period_start_date,'YYYY/MM/DD'));
1716: hr_utility.trace('p_passed_date='||to_char(p_passed_date,'YYYY/MM/DD'));
1717: end if;
1718: --
1719: if p_whole_period_only in ('D','N') then
1720: SELECT COUNT(0)
1743: end if;
1744: --
1745: ELSIF v_number_per_fy = 12 or v_number_per_fy = 13 THEN
1746: if g_debug then
1747: hr_utility.set_location('check_element_freq', 40);
1748: end if;
1749: p_skip_element := 'N';
1750: RETURN ;
1751: END IF;
1754: -- Check frequency rule:
1755: -- If none exists, then process!
1756: --
1757: if g_debug then
1758: hr_utility.trace('v_run_number='||to_char(v_run_number));
1759: hr_utility.set_location('check_element_freq', 50);
1760: end if;
1761: SELECT 'N'
1762: INTO p_skip_element
1755: -- If none exists, then process!
1756: --
1757: if g_debug then
1758: hr_utility.trace('v_run_number='||to_char(v_run_number));
1759: hr_utility.set_location('check_element_freq', 50);
1760: end if;
1761: SELECT 'N'
1762: INTO p_skip_element
1763: FROM pay_ele_payroll_freq_rules EPF,
1772:
1773: EXCEPTION
1774: WHEN NO_DATA_FOUND THEN
1775: if g_debug then
1776: hr_utility.set_location('check_element_freq', 60);
1777: end if;
1778: p_skip_element := 'Y';
1779: RETURN;
1780: