229: l_template_name VARCHAR2(80);
230:
231: BEGIN
232: --
233: hr_utility.set_location('pay_ca_user_init_dedn.get_template_id',1);
234: --
235: if p_calc_rule_code = 'FLT' then
236: l_template_name := 'Flat Amount Deduction';
237: --l_template_name := 'Test Flat Amount Deductions';
237: --l_template_name := 'Test Flat Amount Deductions';
238: elsif p_calc_rule_code = 'PCT' then
239: l_template_name := 'Percent of Earnings Deduction';
240: else
241: hr_utility.set_location('pay_ca_user_init_dedn.get_template_id',2);
242: hr_utility.set_message(801,'HR_XXXXX_INVALID_CALC_RULE_DEDN');
243: hr_utility.raise_error;
244: end if;
245: --
238: elsif p_calc_rule_code = 'PCT' then
239: l_template_name := 'Percent of Earnings Deduction';
240: else
241: hr_utility.set_location('pay_ca_user_init_dedn.get_template_id',2);
242: hr_utility.set_message(801,'HR_XXXXX_INVALID_CALC_RULE_DEDN');
243: hr_utility.raise_error;
244: end if;
245: --
246: hr_utility.set_location('pay_ca_user_init_dedn.get_template_id',3);
239: l_template_name := 'Percent of Earnings Deduction';
240: else
241: hr_utility.set_location('pay_ca_user_init_dedn.get_template_id',2);
242: hr_utility.set_message(801,'HR_XXXXX_INVALID_CALC_RULE_DEDN');
243: hr_utility.raise_error;
244: end if;
245: --
246: hr_utility.set_location('pay_ca_user_init_dedn.get_template_id',3);
247: hr_utility.trace('Template Name is :'||l_template_name||'****'||
242: hr_utility.set_message(801,'HR_XXXXX_INVALID_CALC_RULE_DEDN');
243: hr_utility.raise_error;
244: end if;
245: --
246: hr_utility.set_location('pay_ca_user_init_dedn.get_template_id',3);
247: hr_utility.trace('Template Name is :'||l_template_name||'****'||
248: 'Legislation is :'||p_legislation_code);
249: --
250: select template_id
243: hr_utility.raise_error;
244: end if;
245: --
246: hr_utility.set_location('pay_ca_user_init_dedn.get_template_id',3);
247: hr_utility.trace('Template Name is :'||l_template_name||'****'||
248: 'Legislation is :'||p_legislation_code);
249: --
250: select template_id
251: into l_template_id
254: and legislation_code = p_legislation_code
255: and business_group_id is NULL
256: and template_type = 'T';
257: --
258: hr_utility.set_location('pay_ca_user_init_dedn.get_template_id',4);
259: --
260: RETURN l_template_id;
261: --
262: END get_template_id;
271: l_installed VARCHAR2(1) := 'N';
272:
273: BEGIN
274: --
275: hr_utility.set_location('pay_ca_user_init_dedn.chk_ca_pay_installed',1);
276: --
277: BEGIN
278: select 'Y'
279: into l_installed
285: l_installed := 'N';
286:
287: END;
288: --
289: hr_utility.set_location('pay_ca_user_init_dedn.chk_ca_pay_installed',2);
290: --
291: RETURN (l_installed);
292: --
293: END chk_ca_pay_installed;
299: -- Main Procedure
300:
301: BEGIN
302: --
303: -- hr_utility.trace_on('Y', 'RANJANA');
304: --
305: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',1);
306: --
307: -- Set session date
301: BEGIN
302: --
303: -- hr_utility.trace_on('Y', 'RANJANA');
304: --
305: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',1);
306: --
307: -- Set session date
308: pay_db_pay_setup.set_session_date(nvl(p_ele_eff_start_date, sysdate));
309: --
309: --
310: g_eff_start_date := NVL(p_ele_eff_start_date, sysdate);
311: g_eff_end_date := NVL(p_ele_eff_end_date, c_end_of_time);
312: --
313: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',2);
314: --
315: ---------------------------- Check Element Name ---------------------------
316: --
317: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_deduction',25);
313: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',2);
314: --
315: ---------------------------- Check Element Name ---------------------------
316: --
317: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_deduction',25);
318: --
319: BEGIN
320: select 'Y'
321: into l_reserved
329:
330: END;
331: --
332: if l_reserved = 'Y' then
333: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_deduction',26);
334: hr_utility.set_message(801,'HR_7564_ALL_RES_WORDS');
335: hr_utility.raise_error;
336: end if;
337: --
330: END;
331: --
332: if l_reserved = 'Y' then
333: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_deduction',26);
334: hr_utility.set_message(801,'HR_7564_ALL_RES_WORDS');
335: hr_utility.raise_error;
336: end if;
337: --
338: ---------------------------- Get Source Template ID -----------------------
331: --
332: if l_reserved = 'Y' then
333: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_deduction',26);
334: hr_utility.set_message(801,'HR_7564_ALL_RES_WORDS');
335: hr_utility.raise_error;
336: end if;
337: --
338: ---------------------------- Get Source Template ID -----------------------
339: --
336: end if;
337: --
338: ---------------------------- Get Source Template ID -----------------------
339: --
340: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',3);
341: --
342: l_source_template_id := get_template_id(
343: p_legislation_code => g_template_leg_code,
344: p_calc_rule_code => p_ele_calc_rule_code);
344: p_calc_rule_code => p_ele_calc_rule_code);
345: --
346: ------------------------ Set Arrearage Creation ---------------------------
347: --
348: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',4);
349: --
350: if p_ele_insuff_funds_code in ('A', 'APD') then
351: l_arrearage_create := 'Y';
352: else
354: end if;
355: --
356: ------------------------ Set Total Owed Creation --------------------------
357: --
358: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',5);
359: --
360: if UPPER(p_ele_stop_rule) = 'TOTAL REACHED' then
361: l_total_owed_create := 'Y';
362: else
372: end if;
373: --
374: ---------------------------- Create User Structure ------------------------
375: --
376: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',6);
377: --
378: -- The Configuration Flex segments are as follows:
379: -- Config 1 - exclusion rule - create Arrearage related structures if 'Y'
380: -- Config 2 - exclusion rule - create Total Owed related structures if 'Y'
396: ,p_object_version_number => l_object_version_number);
397: --
398: ---------------------- Get Element Type ID of new Template-----------------
399: --
400: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',7);
401: --
402: select element_type_id, object_version_number
403: into l_element_type_id, l_ele_obj_ver_number
404: from pay_shadow_element_types
420: end if;
421: --
422: ---------------------------- Update Shadow Structure ----------------------
423: --
424: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',8);
425: --
426: if p_ben_class_id IS NOT NULL then
427: select benefit_classification_name
428: into l_ben_class_name
458: --
459: --
460: -- Update user-specified Classification on Special Features Element.
461: --
462: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',9);
463: --
464: pay_shadow_element_api.update_shadow_element
465: (p_validate => false
466: ,p_effective_date => p_ele_eff_start_date
471: --
472: --
473: -- Update user-specified Classification Special Inputs if it exists.
474: --
475: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',10);
476: --
477: if p_ele_processing_type = 'R' then
478: pay_shadow_element_api.update_shadow_element
479: (p_validate => false
485: end if;
486: --
487: ---------------------------- Generate Core Objects ------------------------
488: --
489: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',11);
490: --
491: if chk_ca_pay_installed = 'Y' then
492: l_hr_only := FALSE;
493: else
493: else
494: l_hr_only := TRUE;
495: end if;
496: --
497: hr_utility.trace('HR ONLY is :'||chk_ca_pay_installed);
498: --
499: pay_element_template_api.generate_part1
500: (p_validate => false
501: ,p_effective_date => p_ele_eff_start_date
502: ,p_hr_only => l_hr_only
503: ,p_hr_to_payroll => false
504: ,p_template_id => l_template_id);
505: --
506: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',12);
507: --
508: if l_hr_only = FALSE then
509: pay_element_template_api.generate_part2
510: (p_validate => false
513: end if;
514: --
515: -------------------- Get Element Type ID of Base Element ------------------
516: --
517: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',13);
518: --
519: select element_type_id
520: into l_base_element_type_id
521: from pay_element_types_f
523: and business_group_id + 0 = p_bg_id;
524: --
525: ------------------ Get Balance Type IDs to update Flex Info ---------------
526: --
527: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',14);
528: --
529: select ptco.core_object_id
530: into l_pri_bal_id
531: from pay_shadow_balance_types psbt,
534: and psbt.balance_name = p_ele_name
535: and ptco.template_id = psbt.template_id
536: and ptco.shadow_object_id = psbt.balance_type_id;
537: --
538: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',15);
539: --
540: if l_arrearage_create = 'Y' then
541: select ptco.core_object_id
542: into l_arr_bal_id
560: l_not_taken_bal_id := '';
561: l_arr_bal_id := '';
562: end if;
563: --
564: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',16);
565: --
566: if l_total_owed_create = 'Y' then
567: select ptco.core_object_id
568: into l_accr_bal_id
575: else
576: l_accr_bal_id := '';
577: end if;
578: --
579: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',17);
580: --
581: update pay_element_types_f
582: set element_information10 = l_pri_bal_id,
583: element_information11 = l_accr_bal_id,
644: pay_ca_user_init_earn.update_jd_level_on_balance(l_template_id);
645: --
646: ------------------ Conclude Create_User_Init_Deduction Main -----------------
647: --
648: hr_utility.set_location('pay_ca_user_init_dedn.create_user_init_deduction',18);
649: --
650: RETURN l_base_element_type_id;
651: --
652: END create_user_init_deduction;
751: l_template_name VARCHAR2(80);
752:
753: BEGIN
754: --
755: hr_utility.set_location('pay_ca_user_init_garn.get_template_id',1);
756: --
757: l_template_name := 'Generic Involuntary Deduction';
758: --
759: hr_utility.set_location('pay_ca_user_init_garn.get_template_id',3);
755: hr_utility.set_location('pay_ca_user_init_garn.get_template_id',1);
756: --
757: l_template_name := 'Generic Involuntary Deduction';
758: --
759: hr_utility.set_location('pay_ca_user_init_garn.get_template_id',3);
760: hr_utility.trace('Template Name is :'||l_template_name||'****'||
761: 'Legislation is :'||p_legislation_code);
762: --
763: select template_id
756: --
757: l_template_name := 'Generic Involuntary Deduction';
758: --
759: hr_utility.set_location('pay_ca_user_init_garn.get_template_id',3);
760: hr_utility.trace('Template Name is :'||l_template_name||'****'||
761: 'Legislation is :'||p_legislation_code);
762: --
763: select template_id
764: into l_template_id
767: and legislation_code = p_legislation_code
768: and business_group_id is NULL
769: and template_type = 'T';
770: --
771: hr_utility.set_location('pay_ca_user_init_garn.get_template_id',4);
772: --
773: RETURN l_template_id;
774: --
775: END get_template_id;
784: l_installed VARCHAR2(1) := 'N';
785:
786: BEGIN
787: --
788: hr_utility.set_location('pay_ca_user_init_garn.chk_ca_pay_installed',1);
789: --
790: BEGIN
791: select 'Y'
792: into l_installed
798: l_installed := 'N';
799:
800: END;
801: --
802: hr_utility.set_location('pay_ca_user_init_garn.chk_ca_pay_installed',2);
803: --
804: RETURN (l_installed);
805: --
806: END chk_ca_pay_installed;
812: -- Main Procedure
813:
814: BEGIN
815: --
816: -- hr_utility.trace_on('Y', 'RANJANA');
817: --
818: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',1);
819: --
820: -- Set session date
814: BEGIN
815: --
816: -- hr_utility.trace_on('Y', 'RANJANA');
817: --
818: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',1);
819: --
820: -- Set session date
821: pay_db_pay_setup.set_session_date(nvl(p_ele_eff_start_date, sysdate));
822: --
822: --
823: g_eff_start_date := NVL(p_ele_eff_start_date, sysdate);
824: g_eff_end_date := NVL(p_ele_eff_end_date, c_end_of_time);
825: --
826: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',2);
827: --
828: ---------------------------- Check Element Name ---------------------------
829: --
830: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_garnishment',25);
826: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',2);
827: --
828: ---------------------------- Check Element Name ---------------------------
829: --
830: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_garnishment',25);
831: --
832: BEGIN
833: select 'Y'
834: into l_reserved
842:
843: END;
844: --
845: if l_reserved = 'Y' then
846: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_garnishment',26);
847:
848: hr_utility.set_message(801,'HR_7564_ALL_RES_WORDS');
849: hr_utility.raise_error;
850: end if;
844: --
845: if l_reserved = 'Y' then
846: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_garnishment',26);
847:
848: hr_utility.set_message(801,'HR_7564_ALL_RES_WORDS');
849: hr_utility.raise_error;
850: end if;
851: --
852: ---------------------------- Get Source Template ID -----------------------
845: if l_reserved = 'Y' then
846: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_garnishment',26);
847:
848: hr_utility.set_message(801,'HR_7564_ALL_RES_WORDS');
849: hr_utility.raise_error;
850: end if;
851: --
852: ---------------------------- Get Source Template ID -----------------------
853: --
850: end if;
851: --
852: ---------------------------- Get Source Template ID -----------------------
853: --
854: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',3);
855: --
856: l_source_template_id := get_template_id(
857: p_legislation_code => g_template_leg_code);
858: --
857: p_legislation_code => g_template_leg_code);
858: --
859: ---------------------- Get Element Type ID of new Template-----------------
860: --
861: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',7);
862: --
863: pay_element_template_api.create_user_structure
864: (p_validate => false
865: ,p_effective_date => p_ele_eff_start_date
911: and element_name = p_ele_name||' Special Inputs';
912: --
913: ---------------------------- Update Shadow Structure ----------------------
914: --
915: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',8);
916: --
917: -- Update user-specified Classification, Processing Type and Standard Link.
918: --
919: pay_shadow_element_api.update_shadow_element
944: --
945: --
946: -- Update user-specified Classification on ISpecial Features Element.
947: --
948: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',9);
949:
950:
951: --
952: pay_shadow_element_api.update_shadow_element
981: --
982: --
983: -- Update user-specified Classification Special Inputs if it exists.
984: --
985: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',11);
986:
987: --
988: pay_shadow_element_api.update_shadow_element
989: (p_validate => false
1002: --
1003: --
1004: -- Update user-specified Classification on Fees Element.
1005: --
1006: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',12);
1007:
1008: --
1009: pay_shadow_element_api.update_shadow_element
1010: (p_validate => false
1023: --
1024: --
1025: -- Update user-specified Classification on, last but not least, Verifier Element.
1026: --
1027: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',13);
1028:
1029: --
1030: pay_shadow_element_api.update_shadow_element
1031: (p_validate => false
1045: --
1046: ---------------------------- Generate Core Objects ------------------------
1047: --
1048: --
1049: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',14);
1050:
1051: --
1052: if chk_ca_pay_installed = 'Y' then
1053: l_hr_only := FALSE;
1054: else
1055: l_hr_only := TRUE;
1056: end if;
1057: --
1058: hr_utility.trace('HR ONLY is :'||chk_ca_pay_installed);
1059: --
1060: pay_element_template_api.generate_part1
1061: (p_validate => false
1062: ,p_effective_date => p_ele_eff_start_date
1063: ,p_hr_only => l_hr_only
1064: ,p_hr_to_payroll => false
1065: ,p_template_id => l_template_id);
1066: --
1067: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',12);
1068:
1069: --
1070: if l_hr_only = FALSE then
1071: pay_element_template_api.generate_part2
1075: end if;
1076: --
1077: -------------------- Get Element Type ID of Base Element ------------------
1078: --
1079: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',13);
1080:
1081: --
1082: select element_type_id
1083: into l_base_element_type_id
1092: and business_group_id + 0 = p_bg_id;
1093: --
1094: ------------------ Get Balance Type IDs to update Flex Info ---------------
1095: --
1096: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',14);
1097:
1098: --
1099: select ptco.core_object_id
1100: into l_pri_bal_id
1158: and psbt.balance_name = p_ele_name||' Arrears'
1159: and ptco.template_id = psbt.template_id
1160: and ptco.shadow_object_id = psbt.balance_type_id;
1161: --
1162: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',17);
1163:
1164: --
1165: update pay_element_types_f
1166: set element_information10 = l_pri_bal_id,
1224: pay_ca_user_init_earn.update_jd_level_on_balance(l_template_id);
1225: --
1226: ------------------ Conclude Create_User_Init_Deduction Main -----------------
1227: --
1228: hr_utility.set_location('pay_ca_user_init_garn.create_user_init_garnishment',18);
1229: --
1230: RETURN l_base_element_type_id;
1231: --
1232: END create_user_init_garnishment;
1260: l_del_val_end := nvl(p_del_val_end_date, c_end_of_time);
1261: l_del_val_start := nvl(p_del_val_start_date, sysdate);
1262: l_del_sess_date := nvl(p_del_sess_date, sysdate);
1263: --
1264: hr_utility.set_location('pay_ca_user_init_dedn.delete_user_init_deduction',1);
1265: --
1266: select template_id
1267: into l_template_id
1268: from pay_element_templates
1269: where base_name = p_ele_name
1270: and business_group_id = p_business_group_id
1271: and template_type = 'U';
1272: --
1273: hr_utility.set_location('pay_ca_user_init_dedn.delete_user_init_deduction',2);
1274: --
1275: begin
1276: delete from pay_element_type_usages_f
1277: where element_type_id in ( select element_type_id
1278: from pay_element_types_f
1279: where element_name = p_ele_name
1280: and business_group_id = p_business_group_id );
1281: --
1282: hr_utility.set_location('pay_ca_user_init_dedn.delete_user_init_deduction',3);
1283: --
1284: exception
1285: when others then
1286: null;
1289: (p_validate => false
1290: ,p_drop_formula_packages => true
1291: ,p_template_id => l_template_id);
1292: --
1293: hr_utility.set_location('pay_ca_user_init_dedn.delete_user_init_deduction',4);
1294: --
1295: END delete_user_init_deduction;
1296: --
1297: ------------------------- Deletion procedures -----------------------------
1324: l_del_val_end := nvl(p_del_val_end_date, c_end_of_time);
1325: l_del_val_start := nvl(p_del_val_start_date, sysdate);
1326: l_del_sess_date := nvl(p_del_sess_date, sysdate);
1327: --
1328: hr_utility.set_location('pay_ca_user_init_garn.delete_user_init_garnishment',1);
1329: --
1330: select template_id
1331: into l_template_id
1332: from pay_element_templates
1333: where base_name = p_ele_name
1334: and business_group_id = p_business_group_id
1335: and template_type = 'U';
1336: --
1337: hr_utility.set_location('pay_ca_user_init_garn.delete_user_init_garnishment',2);
1338: --
1339: begin
1340: delete from pay_element_type_usages_f
1341: where element_type_id in ( select element_type_id
1342: from pay_element_types_f
1343: where element_name = p_ele_name
1344: and business_group_id = p_business_group_id );
1345: --
1346: hr_utility.set_location('pay_ca_user_init_dedn.delete_user_init_deduction',3
1347: );
1348: --
1349: exception
1350: when others then
1355: (p_validate => false
1356: ,p_drop_formula_packages => true
1357: ,p_template_id => l_template_id);
1358: --
1359: hr_utility.set_location('pay_ca_user_init_garn.delete_user_init_garnishment',3);
1360: --
1361: END delete_user_init_garnishment;
1362: --
1363: END pay_ca_user_init_dedn;