The following lines contain the word 'select', 'insert', 'update' or 'delete':
to update_shadow_element procedure
07-JUN-99 R. Murthy 115.4 Created exclusion rule for start
rule - if it is 'Earnings Threshold',
the template engine creates the input
value 'Threshold Amount', and the
element uses the skip rule
'THRESHOLD_SKIP_RULE'.
Update shadow structure also updates
the user-entered element reporting
name and benefit classification.
Added a check to see if the element
being created has the same name as
that of an existing balance (seeded or
otherwise). If yes, an error is
raised. This prevents users from
creating elements with reserved
words as names.
05-APR-00 RThirlby 115.6 Added call to new procedure
pay_ca_user_init_earn.update_jd_level-
_on_balance. This updates jurisdiction_
level on pay_balance_types for all
balances. Call added to create user-
_init_deduction. NB. THIS WILL NEED TO
BE ADDED TO CREATE_USER_INIT_GARNISH-
MENT WHEN GARNISHMENTS ARE ADDED TO
R11i.
11-APR-00 ACai 115.7 Replaced the code with Ver. 110.14 to include garnishment process for R11i.
11-APR-00 mmukherj 115.8 Added update and insert of footnote
and registration no for Year end info
11-APR-02 ssattini 115.9 Fixed the bug#2304888 and also
also added dbdrv.
11-APR-2002 SSattini 115.10 Corrected GSCC complaint.
18-FEB-2003 vpandya 115.11 ,12 Creating element type usages for
deduction elements which has tax proc
type is 'Regular'.
05-AUG-2003 ssouresr 115.13 Saving run balances for _GRE_RUN
_GRE_JD_RUN, _ASG_GRE_RUN and
_ASG_JD_GRE_RUN on pay_defined_balances
05-AUG-2003 ssouresr 115.14 Removed _GRE_RUN and _GRE_JD_RUN from
previous change as these dimensions are
not required for saving nonseeded
balances
26-SEP-2003 ssattini 115.15 Added update to set the
post_termination_rule to 'Last
Standard Process Date' for all
recurring elements. Fix for
bug#2219028.
18-MAY-2009 sapalani 115.16 5676728 Removed the skip formula
FREQ_RULE_SKIP_FORMULA from
deduction elements.
*/
--
--
----------------- create_element_type_usages -----------------
--
--
PROCEDURE create_element_type_usages (
p_element_name in varchar2,
p_bg_id in number,
p_ele_proc_run_type in varchar2 ) IS
cursor c_ele_tp_usg is
select pet.element_type_id
,prt.run_type_id
,'N' inclusion_flag
,pet.effective_start_date
,pet.effective_end_date
,pet.legislation_code
,pet.business_group_id
,NULL usage_type
from pay_element_types_f pet
,pay_run_types_f prt
where pet.element_name = p_element_name
and pet.business_group_id = p_bg_id
and prt.legislation_code = 'CA'
and ( prt.shortname like 'REG%' or
prt.shortname like 'NP%' or
prt.shortname like 'LS%' )
and prt.shortname <> 'REG_T4_RL1'
and prt.run_method = 'C'
and nvl(prt.srs_flag,'N') <> 'Y';
SELECT balance_dimension_id
FROM pay_balance_dimensions
WHERE dimension_name = 'Assignment within Government Reporting Entity Run'
AND legislation_code = 'CA';
SELECT balance_dimension_id
FROM pay_balance_dimensions
WHERE dimension_name = 'Assignment in JD within GRE Run'
AND legislation_code = 'CA';
l_base_element_type_id NUMBER(9); -- Populated by insertion of element type.
select template_id
into l_template_id
from pay_element_templates
where template_name = l_template_name
and legislation_code = p_legislation_code
and business_group_id is NULL
and template_type = 'T';
select 'Y'
into l_installed
from pay_balance_types
where upper(balance_name) = 'FED SUBJECT'
and legislation_code = 'CA';
select 'Y'
into l_reserved
from pay_balance_types
where upper(p_ele_name) = upper(balance_name)
and nvl(legislation_code, 'CA') = 'CA'
and nvl(business_group_id, p_bg_id) = p_bg_id;
select element_type_id, object_version_number
into l_element_type_id, l_ele_obj_ver_number
from pay_shadow_element_types
where template_id = l_template_id
and element_name = p_ele_name;
select element_type_id, object_version_number
into l_sf_element_type_id, l_sf_ele_obj_ver_number
from pay_shadow_element_types
where template_id = l_template_id
and element_name = p_ele_name||' Special Features';
select element_type_id, object_version_number
into l_si_element_type_id, l_si_ele_obj_ver_number
from pay_shadow_element_types
where template_id = l_template_id
and element_name = p_ele_name||' Special Inputs';
select benefit_classification_name
into l_ben_class_name
from ben_benefit_classifications
where benefit_classification_id = p_ben_class_id;
pay_shadow_element_api.update_shadow_element
(p_validate => false
,p_effective_date => p_ele_eff_start_date
,p_element_type_id => l_element_type_id
,p_classification_name => nvl(p_ele_classification, hr_api.g_varchar2)
,p_processing_type => nvl(p_ele_processing_type, hr_api.g_varchar2)
,p_standard_link_flag => nvl(p_ele_standard_link, hr_api.g_varchar2)
,p_description => p_ele_description
,p_reporting_name => p_ele_reporting_name
,p_benefit_classification_name => l_ben_class_name
,p_element_information_category => nvl(upper(g_template_leg_code||'_'||p_ele_classification), hr_api.g_varchar2)
,p_element_information1 => nvl(p_ele_category, hr_api.g_varchar2)
,p_element_information2 => nvl(p_ele_insuff_funds_code, hr_api.g_varchar2)
,p_element_information3 => nvl(p_ele_proc_runtype, hr_api.g_varchar2)
-- ,p_element_information18 => nvl(p_ele_t4a_footnote, hr_api.g_varchar2)
-- ,p_element_information19 => nvl(p_ele_rl1_footnote, hr_api.g_varchar2)
-- ,p_element_information20 => nvl(p_ele_registration_number, hr_api.g_varchar2)
-- ,p_element_information10 => l_pri_bal_id
-- ,p_element_information11 => l_accr_bal_id
-- ,p_element_information12 => l_arr_bal_id
-- ,p_element_information13 => l_not_taken_bal_id
,p_skip_formula => l_skip_formula
,p_object_version_number => l_ele_obj_ver_number);
pay_shadow_element_api.update_shadow_element
(p_validate => false
,p_effective_date => p_ele_eff_start_date
,p_element_type_id => l_sf_element_type_id
,p_classification_name => nvl(p_ele_classification, hr_api.g_varchar2)
,p_reporting_name => p_ele_reporting_name||' SF'
,p_object_version_number => l_sf_ele_obj_ver_number);
pay_shadow_element_api.update_shadow_element
(p_validate => false
,p_effective_date => p_ele_eff_start_date
,p_element_type_id => l_si_element_type_id
,p_classification_name => nvl(p_ele_classification, hr_api.g_varchar2)
,p_reporting_name => p_ele_reporting_name||' SI'
,p_object_version_number => l_si_ele_obj_ver_number);
select element_type_id
into l_base_element_type_id
from pay_element_types_f
where element_name = p_ele_name
and business_group_id + 0 = p_bg_id;
select ptco.core_object_id
into l_pri_bal_id
from pay_shadow_balance_types psbt,
pay_template_core_objects ptco
where psbt.template_id = l_template_id
and psbt.balance_name = p_ele_name
and ptco.template_id = psbt.template_id
and ptco.shadow_object_id = psbt.balance_type_id;
select ptco.core_object_id
into l_arr_bal_id
from pay_shadow_balance_types psbt,
pay_template_core_objects ptco
where psbt.template_id = l_template_id
and psbt.balance_name = p_ele_name||' Arrears'
and ptco.template_id = psbt.template_id
and ptco.shadow_object_id = psbt.balance_type_id;
select ptco.core_object_id
into l_not_taken_bal_id
from pay_shadow_balance_types psbt,
pay_template_core_objects ptco
where psbt.template_id = l_template_id
and psbt.balance_name = p_ele_name||' Not Taken'
and ptco.template_id = psbt.template_id
and ptco.shadow_object_id = psbt.balance_type_id;
select ptco.core_object_id
into l_accr_bal_id
from pay_shadow_balance_types psbt,
pay_template_core_objects ptco
where psbt.template_id = l_template_id
and psbt.balance_name = p_ele_name||' Accrued'
and ptco.template_id = psbt.template_id
and ptco.shadow_object_id = psbt.balance_type_id;
update pay_element_types_f
set element_information10 = l_pri_bal_id,
element_information11 = l_accr_bal_id,
element_information12 = l_arr_bal_id,
element_information13 = l_not_taken_bal_id,
element_information18 = p_ele_t4a_footnote,
element_information19 = p_ele_rl1_footnote,
element_information20 = p_ele_registration_number
where element_type_id = l_base_element_type_id
and business_group_id + 0 = p_bg_id;
update pay_element_types_f
set post_termination_rule = 'L'
where element_type_id = l_base_element_type_id
and business_group_id + 0 = p_bg_id;
UPDATE pay_defined_balances
SET save_run_balance = 'Y'
WHERE balance_type_id = l_pri_bal_id
AND balance_dimension_id IN
(l_asg_gre_run_dim_id,
l_asg_jd_gre_run_dim_id)
AND business_group_id = p_bg_id;
pay_ca_user_init_earn.update_jd_level_on_balance(l_template_id);
SELECT balance_dimension_id
FROM pay_balance_dimensions
WHERE dimension_name = 'Assignment within Government Reporting Entity Run'
AND legislation_code = 'CA';
SELECT balance_dimension_id
FROM pay_balance_dimensions
WHERE dimension_name = 'Assignment in JD within GRE Run'
AND legislation_code = 'CA';
l_base_element_type_id NUMBER(9); -- Populated by insertion of element type.
select template_id
into l_template_id
from pay_element_templates
where template_name = l_template_name
and legislation_code = p_legislation_code
and business_group_id is NULL
and template_type = 'T';
select 'Y'
into l_installed
from pay_balance_types
where upper(balance_name) = 'FED SUBJECT'
and legislation_code = 'CA';
select 'Y'
into l_reserved
from pay_balance_types
where upper(p_ele_name) = upper(balance_name)
and nvl(legislation_code, 'CA') = 'CA'
and nvl(business_group_id, p_bg_id) = p_bg_id;
select element_type_id, object_version_number
into l_element_type_id, l_ele_obj_ver_number
from pay_shadow_element_types
where template_id = l_template_id
and element_name = p_ele_name;
select element_type_id, object_version_number
into l_sf_element_type_id, l_sf_ele_obj_ver_number
from pay_shadow_element_types
where template_id = l_template_id
and element_name = p_ele_name||' Special Features';
select element_type_id, object_version_number
into l_sf2_element_type_id, l_sf2_ele_obj_ver_number
from pay_shadow_element_types
where template_id = l_template_id
and element_name = p_ele_name||' Special Features 2';
select element_type_id, object_version_number
into l_fee_element_type_id, l_fee_ele_obj_ver_number
from pay_shadow_element_types
where template_id = l_template_id
and element_name = p_ele_name||' Fees';
select element_type_id, object_version_number
into l_ver_element_type_id, l_ver_ele_obj_ver_number
from pay_shadow_element_types
where template_id = l_template_id
and element_name = p_ele_name||' Verifier';
select element_type_id, object_version_number
into l_si_element_type_id, l_si_ele_obj_ver_number
from pay_shadow_element_types
where template_id = l_template_id
and element_name = p_ele_name||' Special Inputs';
pay_shadow_element_api.update_shadow_element
(p_validate => false
,p_effective_date => p_ele_eff_start_date
,p_element_type_id => l_element_type_id
,p_classification_name => nvl(p_ele_classification, hr_api.g_varchar2)
,p_processing_type => nvl(p_ele_processing_type, hr_api.g_varchar2)
,p_standard_link_flag => nvl(p_ele_standard_link, hr_api.g_varchar2)
,p_description => p_ele_description
,p_reporting_name => p_ele_reporting_name
,p_benefit_classification_name => l_ben_class_name
,p_element_information_category => nvl(upper(g_template_leg_code||'_'||p_ele_classification), hr_api.g_varchar2)
,p_element_information1 => nvl(p_ele_category, hr_api.g_varchar2)
-- ,p_element_information2 => nvl(p_ele_insuff_funds_code, hr_api.g_varchar2)
,p_element_information2 => 'INV_DEDN' /* Default Value as all insuff funds prcessing on entry_information */
,p_element_information3 => nvl(p_ele_proc_runtype, hr_api.g_varchar2)
,p_element_information6 => upper('P3') /* Creating all with a low priority default */
-- ,p_element_information18 => nvl(p_ele_t4a_footnote, hr_api.g_varchar2)
-- ,p_element_information19 => nvl(p_ele_rl1_footnote, hr_api.g_varchar2)
-- ,p_element_information20 => nvl(p_ele_registration_number, hr_api.g_varchar2)
-- ,p_element_information10 => l_pri_bal_id
-- ,p_element_information11 => l_accr_bal_id
-- ,p_element_information12 => l_arr_bal_id
-- ,p_element_information13 => l_not_taken_bal_id
,p_skip_formula => l_skip_formula
,p_object_version_number => l_ele_obj_ver_number);
pay_shadow_element_api.update_shadow_element
(p_validate => false
,p_effective_date => p_ele_eff_start_date
,p_element_type_id => l_sf_element_type_id
,p_classification_name => nvl(p_ele_classification, hr_api.g_varchar2)
,p_reporting_name => p_ele_reporting_name||' SF'
,p_object_version_number => l_sf_ele_obj_ver_number
,p_element_information_category => nvl(upper(g_template_leg_code||'_'||p_ele_classification), hr_api.g_varchar2)
,p_element_information1 => nvl(p_ele_category, hr_api.g_varchar2)
-- ,p_element_information2 => nvl(p_ele_insuff_funds_code, hr_api.g_varchar2)
,p_element_information2 => 'INV_DEDN' /* Default Value as all insuff funds prcessing on entry_information */
,p_element_information3 => nvl(p_ele_proc_runtype, hr_api.g_varchar2)
,p_element_information6 => upper('P3') /* Creating all with a low priority default */
);
pay_shadow_element_api.update_shadow_element
(p_validate => false
,p_effective_date => p_ele_eff_start_date
,p_element_type_id => l_sf2_element_type_id
,p_classification_name => nvl(p_ele_classification, hr_api.g_varchar2)
,p_reporting_name => p_ele_reporting_name||' SF 2'
,p_object_version_number => l_sf2_ele_obj_ver_number
,p_element_information_category => nvl(upper(g_template_leg_code||'_'||p_ele_classification), hr_api.g_varchar2)
,p_element_information1 => nvl(p_ele_category, hr_api.g_varchar2)
-- ,p_element_information2 => nvl(p_ele_insuff_funds_code, hr_api.g_varchar2)
,p_element_information2 => 'INV_DEDN' /* Default Value as all insuff funds prcessing on entry_information */
,p_element_information3 => nvl(p_ele_proc_runtype, hr_api.g_varchar2)
,p_element_information6 => upper('P3') /* Creating all with a low priority default */
);
pay_shadow_element_api.update_shadow_element
(p_validate => false
,p_effective_date => p_ele_eff_start_date
,p_element_type_id => l_si_element_type_id
,p_classification_name => nvl(p_ele_classification, hr_api.g_varchar2)
,p_reporting_name => p_ele_reporting_name||' SI'
,p_object_version_number => l_si_ele_obj_ver_number
,p_element_information_category => nvl(upper(g_template_leg_code||'_'||p_ele_classification), hr_api.g_varchar2)
,p_element_information1 => nvl(p_ele_category, hr_api.g_varchar2)
-- ,p_element_information2 => nvl(p_ele_insuff_funds_code, hr_api.g_varchar2)
,p_element_information2 => 'INV_DEDN' /* Default Value as all insuff funds prcessing on entry_information */
,p_element_information3 => nvl(p_ele_proc_runtype, hr_api.g_varchar2)
,p_element_information6 => upper('P3') /* Creating all with a low priority default */
);
pay_shadow_element_api.update_shadow_element
(p_validate => false
,p_effective_date => p_ele_eff_start_date
,p_element_type_id => l_fee_element_type_id
,p_classification_name => nvl(p_ele_classification, hr_api.g_varchar2)
,p_reporting_name => p_ele_reporting_name||' Fees'
,p_object_version_number => l_fee_ele_obj_ver_number
,p_element_information_category => nvl(upper(g_template_leg_code||'_'||p_ele_classification), hr_api.g_varchar2)
,p_element_information1 => nvl(p_ele_category, hr_api.g_varchar2)
-- ,p_element_information2 => nvl(p_ele_insuff_funds_code, hr_api.g_varchar2)
,p_element_information2 => 'INV_DEDN' /* Default Value as all insuff funds prcessing on entry_information */
,p_element_information3 => nvl(p_ele_proc_runtype, hr_api.g_varchar2)
,p_element_information6 => upper('P3') /* Creating all with a low priority default */
);
pay_shadow_element_api.update_shadow_element
(p_validate => false
,p_effective_date => p_ele_eff_start_date
,p_element_type_id => l_ver_element_type_id
,p_classification_name => nvl(p_ele_classification, hr_api.g_varchar2)
,p_reporting_name => p_ele_reporting_name||' Verifier'
,p_object_version_number => l_ver_ele_obj_ver_number
,p_element_information_category => nvl(upper(g_template_leg_code||'_'||p_ele_classification), hr_api.g_varchar2)
,p_element_information1 => nvl(p_ele_category, hr_api.g_varchar2)
-- ,p_element_information2 => nvl(p_ele_insuff_funds_code, hr_api.g_varchar2)
,p_element_information2 => 'INV_DEDN' /* Default Value as all insuff funds prcessing on entry_information */
,p_element_information3 => nvl(p_ele_proc_runtype, hr_api.g_varchar2)
,p_element_information6 => upper('P3') /* Creating all with a low priority default */
);
select element_type_id
into l_base_element_type_id
from pay_element_types_f
where element_name = p_ele_name
and business_group_id + 0 = p_bg_id;
select element_type_id
into l_fee_element_type_id
from pay_element_types_f
where element_name = p_ele_name||' Fees'
and business_group_id + 0 = p_bg_id;
select ptco.core_object_id
into l_pri_bal_id
from pay_shadow_balance_types psbt,
pay_template_core_objects ptco
where psbt.template_id = l_template_id
and psbt.balance_name = p_ele_name
and ptco.template_id = psbt.template_id
and ptco.shadow_object_id = psbt.balance_type_id;
select ptco.core_object_id
into l_repl_bal_id
from pay_shadow_balance_types psbt,
pay_template_core_objects ptco
where psbt.template_id = l_template_id
and psbt.balance_name = p_ele_name||' Replacement'
and ptco.template_id = psbt.template_id
and ptco.shadow_object_id = psbt.balance_type_id;
select ptco.core_object_id
into l_addl_bal_id
from pay_shadow_balance_types psbt,
pay_template_core_objects ptco
where psbt.template_id = l_template_id
and psbt.balance_name = p_ele_name||' Additional'
and ptco.template_id = psbt.template_id
and ptco.shadow_object_id = psbt.balance_type_id;
select ptco.core_object_id
into l_not_taken_bal_id
from pay_shadow_balance_types psbt,
pay_template_core_objects ptco
where psbt.template_id = l_template_id
and psbt.balance_name = p_ele_name||' Not Taken'
and ptco.template_id = psbt.template_id
and ptco.shadow_object_id = psbt.balance_type_id;
select ptco.core_object_id
into l_accr_bal_id
from pay_shadow_balance_types psbt,
pay_template_core_objects ptco
where psbt.template_id = l_template_id
and psbt.balance_name = p_ele_name||' Accrued'
and ptco.template_id = psbt.template_id
and ptco.shadow_object_id = psbt.balance_type_id;
select ptco.core_object_id
into l_fees_bal_id
from pay_shadow_balance_types psbt,
pay_template_core_objects ptco
where psbt.template_id = l_template_id
and psbt.balance_name = p_ele_name||' Fees'
and ptco.template_id = psbt.template_id
and ptco.shadow_object_id = psbt.balance_type_id;
select ptco.core_object_id
into l_arr_bal_id
from pay_shadow_balance_types psbt,
pay_template_core_objects ptco
where psbt.template_id = l_template_id
and psbt.balance_name = p_ele_name||' Arrears'
and ptco.template_id = psbt.template_id
and ptco.shadow_object_id = psbt.balance_type_id;
update pay_element_types_f
set element_information10 = l_pri_bal_id,
element_information11 = l_accr_bal_id,
element_information12 = l_arr_bal_id,
element_information13 = l_not_taken_bal_id,
element_information17 = l_repl_bal_id,
element_information16 = l_addl_bal_id,
element_information15 = l_fees_bal_id,
element_information18 = p_ele_t4a_footnote,
element_information19 = p_ele_rl1_footnote,
element_information20 = p_ele_registration_number
where element_type_id = l_base_element_type_id
and business_group_id + 0 = p_bg_id;
update pay_element_types_f
set element_information10 = l_fees_bal_id
where element_type_id = l_fee_element_type_id
and business_group_id + 0 = p_bg_id;
UPDATE pay_defined_balances
SET save_run_balance = 'Y'
WHERE balance_type_id IN
(l_pri_bal_id,
l_fees_bal_id)
AND balance_dimension_id IN
(l_asg_gre_run_dim_id,
l_asg_jd_gre_run_dim_id)
AND business_group_id = p_bg_id;
pay_ca_user_init_earn.update_jd_level_on_balance(l_template_id);
PROCEDURE delete_user_init_deduction (
p_business_group_id in number,
p_ele_type_id in number,
p_ele_name in varchar2,
p_ele_priority in number,
p_ele_info_10 in varchar2 default null,
p_ele_info_12 in varchar2 default null,
p_del_sess_date in date,
p_del_val_start_date in date,
p_del_val_end_date in date) IS
-- local constants
c_end_of_time CONSTANT DATE := TO_DATE('4712/12/31','YYYY/MM/DD');
hr_utility.set_location('pay_ca_user_init_dedn.delete_user_init_deduction',1);
select template_id
into l_template_id
from pay_element_templates
where base_name = p_ele_name
and business_group_id = p_business_group_id
and template_type = 'U';
hr_utility.set_location('pay_ca_user_init_dedn.delete_user_init_deduction',2);
delete from pay_element_type_usages_f
where element_type_id in ( select element_type_id
from pay_element_types_f
where element_name = p_ele_name
and business_group_id = p_business_group_id );
hr_utility.set_location('pay_ca_user_init_dedn.delete_user_init_deduction',3);
pay_element_template_api.delete_user_structure
(p_validate => false
,p_drop_formula_packages => true
,p_template_id => l_template_id);
hr_utility.set_location('pay_ca_user_init_dedn.delete_user_init_deduction',4);
END delete_user_init_deduction;
PROCEDURE delete_user_init_garnishment (
p_business_group_id in number,
p_ele_type_id in number,
p_ele_name in varchar2,
p_ele_priority in number,
p_ele_info_10 in varchar2 default null,
p_ele_info_12 in varchar2 default null,
p_del_sess_date in date,
p_del_val_start_date in date,
p_del_val_end_date in date) IS
-- local constants
c_end_of_time CONSTANT DATE := TO_DATE('4712/12/31','YYYY/MM/DD');
hr_utility.set_location('pay_ca_user_init_garn.delete_user_init_garnishment',1);
select template_id
into l_template_id
from pay_element_templates
where base_name = p_ele_name
and business_group_id = p_business_group_id
and template_type = 'U';
hr_utility.set_location('pay_ca_user_init_garn.delete_user_init_garnishment',2);
delete from pay_element_type_usages_f
where element_type_id in ( select element_type_id
from pay_element_types_f
where element_name = p_ele_name
and business_group_id = p_business_group_id );
hr_utility.set_location('pay_ca_user_init_dedn.delete_user_init_deduction',3
);
pay_element_template_api.delete_user_structure
(p_validate => false
,p_drop_formula_packages => true
,p_template_id => l_template_id);
hr_utility.set_location('pay_ca_user_init_garn.delete_user_init_garnishment',3);
END delete_user_init_garnishment;