1: PACKAGE BODY pay_ca_user_init_earn AS
2: /* $Header: pycauiet.pkb 120.1.12010000.2 2009/05/15 07:30:16 sneelapa ship $ */
3: /*
4: ******************************************************************
5: * *
16: * 500 Oracle Parkway, Redwood City, CA, 94065. *
17: * *
18: ******************************************************************
19:
20: Name : pay_ca_user_init_earn
21: Filename : pycauiet.pkb
22: Change List
23: -----------
24: Date Name Vers Bug No Description
348: l_template_name VARCHAR2(80);
349:
350: BEGIN
351: --
352: hr_utility.set_location('pay_ca_user_init_earn.get_template_id',1);
353: --
354: if p_calc_rule_code = 'FLT' then
355: l_template_name := 'Flat Amount Earning';
356: --l_template_name := 'Test Flat Amount Earnings';
361: l_template_name := 'Percent of Earnings Earning';
362: elsif p_calc_rule_code = 'NTG FLT' then
363: l_template_name := 'Net To Gross Earning';
364: else
365: hr_utility.set_location('pay_ca_user_init_earn.get_template_id',2);
366: hr_utility.set_message(801,'HR_XXXXX_INVALID_CALC_RULE_EARN');
367: hr_utility.raise_error;
368: end if;
369: --
366: hr_utility.set_message(801,'HR_XXXXX_INVALID_CALC_RULE_EARN');
367: hr_utility.raise_error;
368: end if;
369: --
370: hr_utility.set_location('pay_ca_user_init_earn.get_template_id',3);
371: hr_utility.trace('Template Name is :'||l_template_name||'****'||
372: 'Legislation is :'||p_legislation_code);
373: --
374: select template_id
378: and legislation_code = p_legislation_code
379: and business_group_id is NULL
380: and template_type = 'T';
381: --
382: hr_utility.set_location('pay_ca_user_init_earn.get_template_id',4);
383: --
384: RETURN l_template_id;
385: --
386: END get_template_id;
395: l_installed VARCHAR2(1) := 'N';
396:
397: BEGIN
398: --
399: hr_utility.set_location('pay_ca_user_init_earn.chk_ca_pay_installed',1);
400: --
401: BEGIN
402: select 'Y'
403: into l_installed
409: l_installed := 'N';
410:
411: END;
412: --
413: hr_utility.set_location('pay_ca_user_init_earn.chk_ca_pay_installed',2);
414: --
415: RETURN (l_installed);
416: --
417: END chk_ca_pay_installed;
427: --
428: --hr_utility.trace_on('y','ORACLE');
429:
430: --
431: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',1);
432: --
433: -- Set session date
434: pay_db_pay_setup.set_session_date(nvl(p_ele_eff_start_date, sysdate));
435: --
435: --
436: g_eff_start_date := NVL(p_ele_eff_start_date, sysdate);
437: g_eff_end_date := NVL(p_ele_eff_end_date, c_end_of_time);
438: --
439: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',2);
440: --
441: ---------------------------- Check Element Name ---------------------------
442: --
443: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',25);
439: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',2);
440: --
441: ---------------------------- Check Element Name ---------------------------
442: --
443: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',25);
444: --
445: BEGIN
446: select 'Y'
447: into l_reserved
455:
456: END;
457: --
458: if l_reserved = 'Y' then
459: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',26);
460: hr_utility.set_message(801,'HR_7564_ALL_RES_WORDS');
461: hr_utility.raise_error;
462: end if;
463: --
462: end if;
463: --
464: ---------------------------- Get Source Template ID -----------------------
465: --
466: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',3);
467: --
468: l_source_template_id := get_template_id(
469: p_legislation_code => g_template_leg_code,
470: p_calc_rule_code => p_ele_calc_rule_code);
470: p_calc_rule_code => p_ele_calc_rule_code);
471: --
472: --------------------- Set Separate Check Creation -------------------------
473: --
474: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',4);
475: --
476: if p_ele_classification = 'Supplemental Earnings' then
477: l_sep_check_create := 'Y';
478: l_skip_formula := 'SUPP_EARNINGS_SKIP';
482: end if;
483: --
484: ---------------------------- Create User Structure ------------------------
485: --
486: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',5);
487: --
488: -- The Configuration Flex segments are as follows:
489: -- Config 1 - exclusion rule - create Separate Check input value if 'Y'
490: -- Config 2 - input value default - update default value for Sep Check IV
518: ,p_object_version_number => l_object_version_number);
519: --
520: ---------------------- Get Element Type ID of new Template -----------------
521: --
522: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',6);
523: --
524: select element_type_id, object_version_number
525: into l_element_type_id, l_ele_obj_ver_number
526: from pay_shadow_element_types
547: end if;
548: --
549: ---------------------------- Update Shadow Structure ----------------------
550: --
551: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',7);
552: --
553: SELECT
554: DECODE(p_ele_classification,'Earnings','DE',
555: 'Supplemental Earnings','DE','Taxable Benefits','DE','')
601: --
602: -- Update user-specified Classification on Special Features Element.
603: -- Only for Non NTG elements.
604: --
605: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',8);
606: --
607: if p_ele_calc_rule_code <> 'NTG FLT' then
608: pay_shadow_element_api.update_shadow_element
609: (p_validate => false
621: --
622: -- Update user-specified Classification Special Inputs if it exists.
623: -- Only for Non NTG elements.
624: --
625: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',9);
626: --
627: if (p_ele_processing_type = 'R') and (p_ele_calc_rule_code <> 'NTG FLT') then
628: pay_shadow_element_api.update_shadow_element
629: (p_validate => false
636: end if;
637: --
638: ---------------------------- Generate Core Objects ------------------------
639: --
640: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',10);
641: --
642: if chk_ca_pay_installed = 'Y' then
643: l_hr_only := FALSE;
644: else
653: ,p_hr_only => l_hr_only
654: ,p_hr_to_payroll => false
655: ,p_template_id => l_template_id);
656: --
657: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',11);
658: --
659: if l_hr_only = FALSE then
660: pay_element_template_api.generate_part2
661: (p_validate => false
661: (p_validate => false
662: ,p_effective_date => p_ele_eff_start_date
663: ,p_template_id => l_template_id);
664: --
665: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',12);
666: --
667: end if;
668: --
669: -------------------- Get Element Type ID of Base Element ------------------
667: end if;
668: --
669: -------------------- Get Element Type ID of Base Element ------------------
670: --
671: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',13);
672: --
673: select element_type_id
674: into l_base_element_type_id
675: from pay_element_types_f
816: end if;
817: --
818: ------------------ Get Balance Type IDs to update Flex Info ---------------
819: --
820: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',14);
821: --
822: BEGIN
823: select ptco.core_object_id
824: into l_pri_bal_id
844: NULL;
845: END IF;
846: END;
847: --
848: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',15);
849: --
850: BEGIN
851: select ptco.core_object_id
852: into l_hrs_bal_id
856: and psbt.balance_name = p_ele_name||' Hours'
857: and ptco.template_id = psbt.template_id
858: and ptco.shadow_object_id = psbt.balance_type_id;
859: --
860: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',16);
861: --
862: EXCEPTION WHEN NO_DATA_FOUND THEN NULL;
863: END;
864: --
861: --
862: EXCEPTION WHEN NO_DATA_FOUND THEN NULL;
863: END;
864: --
865: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',17);
866: --
867: if (p_sep_check_option = 'N' and p_ele_calc_rule_code <> 'NTG FLT') then
868: update pay_element_types_f
869: set element_information10 = l_pri_bal_id,
1098: --
1099:
1100: ------------------ Conclude Create_User_Init_Earning Main -----------------
1101: --
1102: hr_utility.set_location('pay_ca_user_init_earn.create_user_init_earning',18);
1103: --
1104: RETURN l_base_element_type_id;
1105: --
1106: END create_user_init_earning;
1130: l_del_val_end := nvl(p_del_val_end_date, c_end_of_time);
1131: l_del_val_start := nvl(p_del_val_start_date, sysdate);
1132: l_del_sess_date := nvl(p_del_sess_date, sysdate);
1133: --
1134: hr_utility.set_location('pay_ca_user_init_earn.delete_user_init_earning',1);
1135: --
1136: select template_id
1137: into l_template_id
1138: from pay_element_templates
1139: where base_name = p_ele_name
1140: and business_group_id = p_business_group_id
1141: and template_type = 'U';
1142: --
1143: hr_utility.set_location('pay_ca_user_init_earn.delete_user_init_earning',2);
1144: --
1145: begin
1146: delete from pay_element_type_usages_f
1147: where element_type_id in ( select element_type_id
1150: element_name =
1151: p_ele_name ||' Special Inputs' )
1152: and business_group_id = p_business_group_id );
1153: --
1154: hr_utility.set_location('pay_ca_user_init_earn.delete_user_init_earning',3);
1155: --
1156: exception
1157: when others then
1158: null;
1162: (p_validate => false
1163: ,p_drop_formula_packages => true
1164: ,p_template_id => l_template_id);
1165: --
1166: hr_utility.set_location('pay_ca_user_init_earn.delete_user_init_earning',4);
1167: --
1168: END delete_user_init_earning;
1169: ------------------------------------------------------------------------
1170: -- PROCEDURE UPDATE_JD_LEVEL_ON_BALANCE
1236: l_seeded_ele_type_id NUMBER;
1237: l_nextval NUMBER;
1238: l_seeded_input_val_id NUMBER;
1239: l_status_pro_rule_id NUMBER;
1240: l_proc VARCHAR2(50) := 'pay_ca_user_init_earn.update_ntg_element';
1241:
1242: BEGIN
1243: --
1244: OPEN c_iter_formula_id;
1396: -1,
1397: sysdate);
1398: END update_ntg_element;
1399:
1400: END pay_ca_user_init_earn;