DBA Data[Home] [Help]

APPS.HR_GENERATE_PRETAX SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 66

10 Jul 1997 mmukherj   40.15   502307  Updated do_defined_balances
                                       procedure.Included business_group_id
                                       in where condition while checking
                                       pay_defined_balnce has already exist
                                       for that balance_name for that busines_
                                       group_id or not
21 Jul 1997 mmukherj    40.16          Added some comments in do_defined_balances
                                       procedure related to Bug no 502307.  No
                                       other change in the code. Changed the
                                       select statement of the same proceduer
                                       to avoid using index on
                                       business_group_id.
30 Apr 1998 pmadore     40.17          Added additonal input values, formula
                                       result rules, elements, and balances to
                                       support the Employer match components
                                       of a pretax deduction in category of
                                       Deferred Comp 401k.
                                       The logic to create these objects
                                       depends upon the values of a new
                                       parameter to the main package function:
                                       p_ele_er_match
10 Mar 1999 ahanda      40.19          Changed GRE_ITD to ASG_ITD as GRE_ITD
                                       is already there in suffixes(26) and
                                       ASG_ITD is missing in the
                                       pretax_deduction_template. Bug 820068
16-jun-1999 achauhan   110.10          Replaced dbms_output with hr_utility
09-jul-1999 vmehta     110.11          Added check for legislation_code
                                       while retrieving classification for
                                       employer match   BUG 912994
27-oct-1999 dscully                    Added check for legislation_code while
                                       looking up skip rules
12-Jul-2000 kthirmiy   110.14          Added ELEMENT_INFORMATION_CATEGORY=
                                             'US_EMPLOYER LIABILITIES'
                                       while updating PAY_ELEMENT_TYPES_F for
                                       pretax ER element to show the desc flex
                                       field in the element description screen
                                       for pretax ER element
*******************************************************************************
22-JAN-2002 ahanda     115.13          Added call to create defined bal for
                                       Assignment Payments.
23-DEC-2002 tclewis    115.15          11.5.9 performance fixes and inspected
                                       file to add nocopy directive.  I found
                                       no procedures requireing it.
27-DEC-2002 meshah     115.16          fixed gscc warnings/errors.
*******************************************************************************/

/*
This package contains calls to core API used to insert records comprising an
entire pretax deduction template.  Migration to published (ie. supported) api
from core is an essential move when these become available.

The procedures responsible for creating
appropriate records based on data entered on the Deductions form
must perform simple logic to determine the exact attributes required for the
deductions template.  We do this to keep extraneous information
to a minimum - especially regarding input values and formula
result rules.  Attributes (and their determining factors) are:

- skip rules (Classification)
- status processing rules (Calculation Method)
- input values (Classification/Category, Calculation Method)
- formula result rules (Calculation Method)
*/

--
------------------------- upgrade_deduction_template ------------------------
--

FUNCTION pretax_deduction_template (
		p_ele_name 		in varchar2,
		p_ele_reporting_name 	in varchar2,
		p_ele_description 	in varchar2 	default NULL,
		p_ele_classification 	in varchar2,
		p_ben_class_id	 	in number,
		p_ele_category 		in varchar2	default NULL,
		p_ele_processing_type 	in varchar2,
		p_ele_priority 		in number	default NULL,
		p_ele_standard_link 	in varchar2 	default 'N',
		p_ele_proc_runtype 	in varchar2,
		p_ele_start_rule   	in varchar2,
		p_ele_stop_rule		in varchar2,
		p_ele_ee_bond		in varchar2	default 'N',
		p_ele_amount_rule	in varchar2,
		p_ele_paytab_name	in varchar2	default NULL,
		p_ele_paytab_col   	in varchar2	default NULL,
		p_ele_paytab_row_type	in varchar2	default NULL,
		p_ele_arrearage		in varchar2	default 'N',
		p_ele_partial_dedn	in varchar2	default 'N',
		p_mix_flag		in varchar2	default NULL,
		p_ele_er_match		in varchar2	default 'N',
		p_ele_eff_start_date	in date     	default NULL,
		p_ele_eff_end_date	in date     	default NULL,
		p_bg_id			in number) RETURN NUMBER IS

-- global vars

TYPE text_table IS TABLE OF VARCHAR2(2000) INDEX BY BINARY_INTEGER;
Line: 323

v_ele_type_id		NUMBER(9); 	-- insertion of element type.
Line: 327

v_shadow_ele_type_id	NUMBER(9); -- Populated by insertion of element type.
Line: 329

v_inputs_ele_type_id	NUMBER(9); -- Populated by insertion of element type.
Line: 332

v_bal_type_id		NUMBER(9);	-- Pop'd by insertion of balance type.
Line: 338

v_payval_id		NUMBER(9);	-- ID of payval for bal feed insert.
Line: 378

SELECT /*+ no_merge(pbf) */
       bc.CLASSIFICATION_ID, pbf.BUSINESS_GROUP_ID,
       pbf.LEGISLATION_CODE, pbf.BALANCE_TYPE_ID,
       pbf.INPUT_VALUE_ID, pbf.SCALE, pbf.ELEMENT_TYPE_ID
FROM PAY_BALANCE_FEEDS_V pbf,
     pay_balance_classifications bc
WHERE NVL(pbf.BALANCE_INITIALIZATION_FLAG,'N') = 'N'
AND ((pbf.BUSINESS_GROUP_ID IS NULL OR pbf.BUSINESS_GROUP_ID = p_bg_id)
      AND (pbf.LEGISLATION_CODE IS NULL OR pbf.LEGISLATION_CODE = 'US'))
and (pbf.BALANCE_NAME = 'Regular Earnings')
and bc.balance_type_id = pbf.balance_type_id
order by pbf.element_name;
Line: 460

  select business_group_id
  into   v_business_group_id
  from   per_business_groups
  where  upper(name) = upper(p_bg_name);
Line: 471

      select dimension_name, balance_dimension_id
      into dim_name, dim_id
      from pay_balance_dimensions
      where database_item_suffix = suffixes(i)
      and legislation_code = g_template_leg_code
      and business_group_id IS NULL;
Line: 480

/* added line to include business_group_id in the where clause of the select
statement below. So that it checkes the existence of data for a the given
business_group_id Bug No: 502307.
*/
      SELECT	count(0)
      INTO  	already_exists
      FROM  	pay_defined_balances 	db,
            	pay_balance_types 	bt
      WHERE  	db.balance_type_id 	= bt.balance_type_id
      AND  	upper(bt.balance_name) 	= upper(p_bal_name)
      AND       bt.business_group_id + 0  = v_business_group_id
      AND  	db.balance_dimension_id	= dim_id;
Line: 657

  SELECT 	FF.formula_text,
		FF.formula_type_id
  INTO		v_skeleton_formula_text,
 		v_skeleton_formula_type_id
  FROM		ff_formulas_f	FF
  WHERE		FF.formula_name		= 'PRETAX_WITHHOLDING_FORMULA'
  AND		FF.business_group_id 	IS NULL
  AND		FF.legislation_code	= 'US'
  AND		g_eff_start_date	>= FF.effective_start_date
  AND		g_eff_start_date	<= FF.effective_end_date;
Line: 703

  SELECT 	ff_formulas_s.nextval
  INTO		v_new_ele_formula_id
  FROM	 	sys.dual;
Line: 711

  INSERT INTO ff_formulas_f (	FORMULA_ID,
				EFFECTIVE_START_DATE,
			 	EFFECTIVE_END_DATE,
				BUSINESS_GROUP_ID,
				LEGISLATION_CODE,
				FORMULA_TYPE_ID,
				FORMULA_NAME,
				DESCRIPTION,
				FORMULA_TEXT,
				STICKY_FLAG,
				LAST_UPDATE_DATE,
				LAST_UPDATED_BY,
				LAST_UPDATE_LOGIN,
				CREATED_BY,
				CREATION_DATE)
values (
	v_new_ele_formula_id,
 	g_eff_start_date,
	g_eff_end_date,
	p_ff_bg_id,
	NULL,
	v_skeleton_formula_type_id,
	v_new_ele_formula_name,
	p_ff_desc,
	v_new_ele_formula_text,
	'N',
	NULL,
	NULL,
	NULL,
	-1,
	g_eff_start_date);
Line: 761

    UPDATE	ff_formulas_f
    SET		formula_name	= v_new_ele_formula_name,
		formula_text	= v_new_ele_formula_text
    WHERE	formula_id	= v_new_ele_formula_id
    AND		business_group_id = p_ff_bg_id
    AND		g_eff_start_date BETWEEN effective_start_date
                                                         AND effective_end_date;
Line: 769

    UPDATE	ff_formulas_f
    SET		formula_text	= v_new_ele_formula_text
    WHERE	formula_id	= v_new_ele_formula_id
    AND		business_group_id = p_ff_bg_id
    AND		g_eff_start_date BETWEEN effective_start_date
                                                         AND effective_end_date;
Line: 781

select count(0)
into l_count_already
from ff_formulas_f
where upper(formula_name) like upper('%'||l_placehold_ele_name||'%');
Line: 798

  SELECT 	ff_formulas_s.nextval
  INTO		v_orig_ele_formula_id
  FROM	 	sys.dual;
Line: 804

 INSERT INTO ff_formulas_f (	FORMULA_ID,
				EFFECTIVE_START_DATE,
			 	EFFECTIVE_END_DATE,
				BUSINESS_GROUP_ID,
				LEGISLATION_CODE,
				FORMULA_TYPE_ID,
				FORMULA_NAME,
				DESCRIPTION,
				FORMULA_TEXT,
				STICKY_FLAG,
				LAST_UPDATE_DATE,
				LAST_UPDATED_BY,
				LAST_UPDATE_LOGIN,
				CREATED_BY,
				CREATION_DATE)
values (
 	v_orig_ele_formula_id,
 	g_eff_start_date,
	g_eff_end_date,
	p_ff_bg_id,
	NULL,
	v_skeleton_formula_type_id,
	v_orig_ele_formula_name,
	p_ff_desc,
	v_orig_ele_formula_text,
	'N',
	NULL,
	NULL,
	NULL,
	-1,
	g_eff_start_date);
Line: 887

  SELECT 	FF.formula_text,
		FF.formula_type_id
  INTO		v_skeleton_formula_text,
 		v_skeleton_formula_type_id
  FROM		ff_formulas_f	FF
  WHERE	FF.formula_name	= 'PRETAX_CALCULATION_FORMULA'
  AND		FF.business_group_id 	IS NULL
  AND		FF.legislation_code	= 'US'
  AND		g_eff_start_date 		>= FF.effective_start_date
  AND		g_eff_start_date		<= FF.effective_end_date;
Line: 1079

  SELECT 	ff_formulas_s.nextval
  INTO		v_new_ele_formula_id
  FROM	 	sys.dual;
Line: 1085

  INSERT INTO ff_formulas_f (	FORMULA_ID,
				EFFECTIVE_START_DATE,
			 	EFFECTIVE_END_DATE,
				BUSINESS_GROUP_ID,
				LEGISLATION_CODE,
				FORMULA_TYPE_ID,
				FORMULA_NAME,
				DESCRIPTION,
				FORMULA_TEXT,
				STICKY_FLAG,
				LAST_UPDATE_DATE,
				LAST_UPDATED_BY,
				LAST_UPDATE_LOGIN,
				CREATED_BY,
				CREATION_DATE)
values (
	v_new_ele_formula_id,
 	g_eff_start_date,
	g_eff_end_date,
	p_ff_bg_id,
	NULL,
	v_skeleton_formula_type_id,
	v_new_ele_formula_name,
	p_ff_desc,
	v_new_ele_formula_text,
	'N',
	NULL,
	NULL,
	NULL,
	-1,
	g_eff_start_date);
Line: 1135

    UPDATE	ff_formulas_f
    SET		formula_name	= v_new_ele_formula_name,
		formula_text	= v_new_ele_formula_text
    WHERE	formula_id	= v_new_ele_formula_id
    AND		business_group_id = p_ff_bg_id
    AND		g_eff_start_date BETWEEN effective_start_date
                                                         AND effective_end_date;
Line: 1144

    UPDATE	ff_formulas_f
    SET		formula_text	= v_new_ele_formula_text
    WHERE	formula_id	= v_new_ele_formula_id
    AND		business_group_id = p_ff_bg_id
    AND		g_eff_start_date BETWEEN effective_start_date
                                                         AND effective_end_date;
Line: 1156

select count(0)
into l_count_already
from ff_formulas_f
where upper(formula_name) like upper('%'||l_placehold_ele_name||'%');
Line: 1172

  SELECT 	ff_formulas_s.nextval
  INTO		v_orig_ele_formula_id
  FROM	 	sys.dual;
Line: 1178

 INSERT INTO ff_formulas_f (	FORMULA_ID,
				EFFECTIVE_START_DATE,
			 	EFFECTIVE_END_DATE,
				BUSINESS_GROUP_ID,
				LEGISLATION_CODE,
				FORMULA_TYPE_ID,
				FORMULA_NAME,
				DESCRIPTION,
				FORMULA_TEXT,
				STICKY_FLAG,
				LAST_UPDATE_DATE,
				LAST_UPDATED_BY,
				LAST_UPDATE_LOGIN,
				CREATED_BY,
				CREATION_DATE)
values (
 	v_orig_ele_formula_id,
 	g_eff_start_date,
	g_eff_end_date,
	p_ff_bg_id,
	NULL,
	v_skeleton_formula_type_id,
	v_orig_ele_formula_name,
	p_ff_desc,
	v_orig_ele_formula_text,
	'N',
	NULL,
	NULL,
	NULL,
	-1,
	g_eff_start_date);
Line: 1291

. Manually update DDF segments on various associated element types.

Make direct calls to CORE_API packaged procedures to:
. Insert status proc rule of 'PROCESS' for Asst status type 'ACTIVE_ASSIGN'
and appropriate formula according to calculation method
. Setup calculation formula and status proc rule on calculator element.
. Setup withholding formula and status proc rule on base (withholding) element.
. Insert input values according to calculation method
. Insert formula result rules as appropriate for formula and amount rule.

-- In the case of deductions elements, the formulae are fully defined in advance
-- based on calculation rule only.  These pre-packaged formulae are seeded
-- as startup data - such that bg_id is NULL, in the appropriate legislation.
-- The formula_name will closely resemble the calc rule.
-- For deductions, formula is "pieced together" according to calc_rule
-- and other attributes.
-- To copy a formula from seed data to the customer business group, we can
-- select the formula_text LONG field into a VARCHAR2; the LONG field
Line: 1323

    UPDATE 	pay_element_types_f
    SET		element_information_category 	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype,
		element_information9		= p_mix_category,
		benefit_classification_id	= p_ben_class_id
    WHERE	element_type_id 		= dedn_ele_ids(1)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1334

    UPDATE 	pay_element_types_f
    SET		element_information_category 	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype,
		benefit_classification_id	= NULL
    WHERE	element_type_id 		= dedn_ele_ids(2)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1345

    UPDATE 	pay_element_types_f
    SET		element_information_category 	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype
    WHERE	element_type_id 		= dedn_ele_ids(4)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1355

    UPDATE 	pay_element_types_f
    SET		element_information_category 	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype
   WHERE	element_type_id 		= dedn_ele_ids(3)
   AND		business_group_id + 0 		= p_bg_id;
Line: 1372

  SELECT 	user_table_id
  INTO		v_paytab_id
  FROM		pay_user_tables
  WHERE		UPPER(user_table_name) 	= UPPER(p_paytab_name)
  AND		NVL(business_group_id, p_bg_id)	= p_bg_id;
Line: 1382

  SELECT	lookup_code
  INTO		v_row_code
  FROM		hr_lookups
  WHERE		UPPER(meaning) 	= UPPER(p_paytab_row_type)
  AND		lookup_type	= 'US_TABLE_ROW_TYPES';
Line: 1391

    UPDATE 	pay_element_types_f
    SET		element_information_category 	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3		= p_proc_runtype,
		element_information6		= p_paytab_name,
		element_information7		= v_row_code,
		element_information9		= p_mix_category,
		benefit_classification_id	= p_ben_class_id
    WHERE	element_type_id 		= dedn_ele_ids(1)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1404

    UPDATE 	pay_element_types_f
    SET		element_information_category 	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3		= p_proc_runtype,
		element_information6		= p_paytab_name,
		element_information7		= v_row_code,
		benefit_classification_id	= NULL
    WHERE	element_type_id 		= dedn_ele_ids(2)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1418

    UPDATE 	pay_element_types_f
    SET		element_information_category 	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3		= p_proc_runtype,
		element_information6		= p_paytab_name,
		element_information7		= v_row_code
    WHERE	element_type_id 		= dedn_ele_ids(4)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1431

    UPDATE 	pay_element_types_f
    SET		element_information_category 	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3		= p_proc_runtype,
		element_information6		= p_paytab_name,
		element_information7		= v_row_code
    WHERE	element_type_id 		= dedn_ele_ids(3)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1448

    UPDATE 	pay_element_types_f
    SET		element_information_category	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype,
		element_information9		= p_mix_category,
		benefit_classification_id	= p_ben_class_id
    WHERE	element_type_id 		= dedn_ele_ids(1)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1459

    UPDATE 	pay_element_types_f
    SET		element_information_category	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype,
		benefit_classification_id	= NULL
    WHERE	element_type_id 		= dedn_ele_ids(2)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1472

    UPDATE 	pay_element_types_f
    SET		element_information_category	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype
    WHERE	element_type_id 		= dedn_ele_ids(4)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1483

    UPDATE 	pay_element_types_f
    SET		element_information_category	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype
    WHERE	element_type_id 		= dedn_ele_ids(3)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1503

    UPDATE 	pay_element_types_f
    SET		element_information_category	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype,
		element_information9		= p_mix_category,
		benefit_classification_id	= p_ben_class_id
    WHERE	element_type_id 		= dedn_ele_ids(1)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1514

    UPDATE 	pay_element_types_f
    SET		element_information_category	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype,
		benefit_classification_id	= NULL
    WHERE	element_type_id 		= dedn_ele_ids(2)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1527

    UPDATE 	pay_element_types_f
    SET		element_information_category	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype
    WHERE	element_type_id 		= dedn_ele_ids(4)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1538

    UPDATE 	pay_element_types_f
    SET		element_information_category	= g_ele_info_cat,
		element_information1 		= p_ele_cat,
		element_information2		= p_partial_dedn,
		element_information3 		= p_proc_runtype
    WHERE	element_type_id 		= dedn_ele_ids(3)
    AND		business_group_id + 0 		= p_bg_id;
Line: 1548

END IF; -- Amount rule checks for formula insertion...
Line: 1552

Now create calc formula for element by selecting "skeleton" calculation formula
and performing string substitutions for element name in proper placeholders.
The formula is then inserted into the current business group.
Other placeholders will be substituted based on other attributes (ie.
balances and arrears).  When finished, the formula can be compiled.
*/

l_placeholder_ele_name	:= REPLACE(LTRIM(RTRIM(UPPER(p_ele_name))),' ','_');
Line: 1565

  select ff.formula_text
  into   l_calc_dedn_ff_text
  from   ff_formulas_f ff
  where  ff.formula_name = 'PRETAX_PERCENTAGE_FF_TEXT'
  and    ff.business_group_id is null
  and    ff.legislation_code = 'US'
  and    sysdate between ff.effective_start_date
                     and ff.effective_end_date;
Line: 1594

  select ff.formula_text
  into   l_calc_dedn_ff_text
  from   ff_formulas_f ff
  where  ff.formula_name = 'PRETAX_PAYROLL_TABLE_FF_TEXT'
  and    ff.business_group_id is null
  and    ff.legislation_code = 'US'
  and    sysdate between ff.effective_start_date
                     and ff.effective_end_date;
Line: 1616

  select ff.formula_text
  into   l_calc_dedn_ff_text
  from   ff_formulas_f ff
  where  ff.formula_name = 'PRETAX_BENEFIT_FF_TEXT'
  and    ff.business_group_id is null
  and    ff.legislation_code = 'US'
  and    sysdate between ff.effective_start_date
                     and ff.effective_end_date;
Line: 1637

  select ff.formula_text
  into   l_calc_dedn_ff_text
  from   ff_formulas_f ff
  where  ff.formula_name = 'PRETAX_FLAT_AMOUNT_FF_TEXT'
  and    ff.business_group_id is null
  and    ff.legislation_code = 'US'
  and    sysdate between ff.effective_start_date
                     and ff.effective_end_date;
Line: 1737

      UPDATE pay_status_processing_rules_f
      SET formula_id = v_calc_rule_formula_id
      WHERE status_processing_rule_id = already_exists
      AND p_eff_start_date BETWEEN effective_start_date
                                               AND effective_end_date;
Line: 1789

      UPDATE pay_status_processing_rules_f
      SET formula_id = v_wh_formula_id
      WHERE status_processing_rule_id = already_exists
      AND p_eff_start_date BETWEEN effective_start_date
                                               AND effective_end_date;
Line: 2139

      select max(display_sequence)
      into    dedn_base_seq
      from   pay_input_values_f
      where  element_type_id = dedn_ele_ids(1)
      and      g_eff_start_date	between effective_start_date
			and effective_end_date;
Line: 2182

		p_insert_update_flag		=> 'UPDATE',
		p_input_value_id 		=> dedn_base_iv_ids(h),
		p_rowid 			=> NULL,
		p_recurring_flag 		=> 'N',
		p_mandatory_flag 		=> dedn_base_iv_mand(h),
		p_hot_default_flag 		=> 'N',
		p_standard_link_flag 		=> 'N',
		p_classification_type 		=> 'N',
		p_name 				=> dedn_base_iv_names(h),
		p_uom 				=> dedn_base_iv_uom(h),
		p_min_value 			=> NULL,
		p_max_value 			=> NULL,
		p_default_value 		=> dedn_base_iv_dflt(h),
		p_lookup_type 			=> dedn_base_iv_lkp(h),
		p_formula_id 			=> NULL,
		p_generate_db_items_flag 	=> dedn_base_iv_dbi(h),
		p_warning_or_error 		=> NULL);
Line: 2250

		p_insert_update_flag		=> 'UPDATE',
		p_input_value_id 		=> dedn_base_iv_ids(h),
		p_rowid 			=> NULL,
		p_recurring_flag 		=> 'N',
		p_mandatory_flag 		=> dedn_base_iv_mand(h),
		p_hot_default_flag 		=> 'N',
		p_standard_link_flag 		=> 'N',
		p_classification_type 		=> 'N',
		p_name 				=> dedn_base_iv_names(h),
		p_uom 				=> dedn_base_iv_uom(h),
		p_min_value 			=> NULL,
		p_max_value 			=> NULL,
		p_default_value 		=> dedn_base_iv_dflt(h),
		p_lookup_type 			=> dedn_base_iv_lkp(h),
		p_formula_id 			=> NULL,
		p_generate_db_items_flag 	=> dedn_base_iv_dbi(h),
		p_warning_or_error 		=> NULL);
Line: 2334

      select max(display_sequence)
      into    dedn_wh_seq
      from   pay_input_values_f
      where  element_type_id = dedn_ele_ids(2)
      and    g_eff_start_date	between effective_start_date
			and effective_end_date;
Line: 2377

		p_insert_update_flag		=> 'UPDATE',
		p_input_value_id 		=> dedn_wh_iv_ids(k),
		p_rowid 			=> NULL,
		p_recurring_flag 		=> 'N',
		p_mandatory_flag 		=> dedn_wh_iv_mand(k),
		p_hot_default_flag 		=> 'N',
		p_standard_link_flag 		=> 'N',
		p_classification_type 		=> 'N',
		p_name 				=> dedn_wh_iv_names(k),
		p_uom 				=> dedn_wh_iv_uom(k),
		p_min_value 			=> NULL,
		p_max_value 			=> NULL,
		p_default_value 		=> dedn_wh_iv_dflt(k),
		p_lookup_type 			=> dedn_wh_iv_lkp(k),
		p_formula_id 			=> NULL,
		p_generate_db_items_flag 	=> dedn_wh_iv_dbi(k),
		p_warning_or_error 		=> NULL);
Line: 2445

		p_insert_update_flag		=> 'UPDATE',
		p_input_value_id 		=> dedn_wh_iv_ids(k),
		p_rowid 			=> NULL,
		p_recurring_flag 		=> 'N',
		p_mandatory_flag 		=> dedn_wh_iv_mand(k),
		p_hot_default_flag 		=> 'N',
		p_standard_link_flag 		=> 'N',
		p_classification_type 		=> 'N',
		p_name 				=> dedn_wh_iv_names(k),
		p_uom 				=> dedn_wh_iv_uom(k),
		p_min_value 			=> NULL,
		p_max_value 			=> NULL,
		p_default_value 		=> dedn_wh_iv_dflt(k),
		p_lookup_type 			=> dedn_wh_iv_lkp(k),
		p_formula_id 			=> NULL,
		p_generate_db_items_flag 	=> dedn_wh_iv_dbi(k),
		p_warning_or_error 		=> NULL);
Line: 2559

        select max(display_sequence)
        into    dedn_iv_seq
        from   pay_input_values_f
        where  element_type_id = dedn_ele_ids(3)
        and    g_eff_start_date	between effective_start_date
			and effective_end_date;
Line: 2604

		p_insert_update_flag		=> 'UPDATE',
		p_input_value_id 		=> dedn_si_iv_ids(siv),
		p_rowid 			=> NULL,
		p_recurring_flag		=> 'N',
		p_mandatory_flag 		=> dedn_si_iv_mand(siv),
		p_hot_default_flag 		=> 'N',
		p_standard_link_flag 		=> 'N',
		p_classification_type 		=> 'N',
		p_name 				=> dedn_si_iv_names(siv),
		p_uom 				=> dedn_si_iv_uom(siv),
		p_min_value 			=> NULL,
		p_max_value 			=> NULL,
		p_default_value 		=> dedn_si_iv_dflt(siv),
		p_lookup_type 			=> dedn_si_iv_lkp(siv),
		p_formula_id 			=> NULL,
		p_generate_db_items_flag 	=> dedn_si_iv_dbi(siv),
		p_warning_or_error 		=> NULL);
Line: 2672

		p_insert_update_flag		=> 'UPDATE',
		p_input_value_id 		=> dedn_si_iv_ids(siv),
		p_rowid 			=> NULL,
		p_recurring_flag		=> 'N',
		p_mandatory_flag 		=> dedn_si_iv_mand(siv),
		p_hot_default_flag 		=> 'N',
		p_standard_link_flag 		=> 'N',
		p_classification_type 		=> 'N',
		p_name 				=> dedn_si_iv_names(siv),
		p_uom 				=> dedn_si_iv_uom(siv),
		p_min_value 			=> NULL,
		p_max_value 			=> NULL,
		p_default_value 		=> dedn_si_iv_dflt(siv),
		p_lookup_type 			=> dedn_si_iv_lkp(siv),
		p_formula_id 			=> NULL,
		p_generate_db_items_flag 	=> dedn_si_iv_dbi(siv),
		p_warning_or_error 		=> NULL);
Line: 2795

       select max(display_sequence)
        into    dedn_iv_seq
        from   pay_input_values_f
        where  element_type_id = dedn_ele_ids(4)
        and    g_eff_start_date	between effective_start_date
				and effective_end_date;
Line: 2840

		p_insert_update_flag		=> 'UPDATE',
		p_input_value_id 		=> dedn_sf_iv_ids(sfv),
		p_rowid 			=> NULL,
		p_recurring_flag 		=> 'N',
		p_mandatory_flag 		=> dedn_sf_iv_mand(sfv),
		p_hot_default_flag 		=> 'N',
		p_standard_link_flag 		=> 'N',
		p_classification_type 		=> 'N',
		p_name 				=> dedn_sf_iv_names(sfv),
		p_uom 				=> dedn_sf_iv_uom(sfv),
		p_min_value 			=> NULL,
		p_max_value 			=> NULL,
		p_default_value	 		=> dedn_sf_iv_dflt(sfv),
		p_lookup_type 			=> dedn_sf_iv_lkp(sfv),
		p_formula_id 			=> NULL,
		p_generate_db_items_flag 	=> dedn_sf_iv_dbi(sfv),
		p_warning_or_error 		=> NULL);
Line: 2908

		p_insert_update_flag		=> 'UPDATE',
		p_input_value_id 		=> dedn_sf_iv_ids(sfv),
		p_rowid 			=> NULL,
		p_recurring_flag 		=> 'N',
		p_mandatory_flag 		=> dedn_sf_iv_mand(sfv),
		p_hot_default_flag 		=> 'N',
		p_standard_link_flag 		=> 'N',
		p_classification_type 		=> 'N',
		p_name 				=> dedn_sf_iv_names(sfv),
		p_uom 				=> dedn_sf_iv_uom(sfv),
		p_min_value 			=> NULL,
		p_max_value 			=> NULL,
		p_default_value	 		=> dedn_sf_iv_dflt(sfv),
		p_lookup_type 			=> dedn_sf_iv_lkp(sfv),
		p_formula_id 			=> NULL,
		p_generate_db_items_flag 	=> dedn_sf_iv_dbi(sfv),
		p_warning_or_error 		=> NULL);
Line: 3013

      select max(display_sequence)
      into    dedn_er_seq
      from   pay_input_values_f
      where  element_type_id = dedn_ele_ids(5)
      and    g_eff_start_date	between effective_start_date
			and effective_end_date;
Line: 3056

		p_insert_update_flag		=> 'UPDATE',
		p_input_value_id 		=> dedn_er_iv_ids(m),
		p_rowid 			=> NULL,
		p_recurring_flag 		=> 'N',
		p_mandatory_flag 		=> dedn_er_iv_mand(m),
		p_hot_default_flag 		=> 'N',
		p_standard_link_flag 		=> 'N',
		p_classification_type 		=> 'N',
		p_name 				=> dedn_er_iv_names(m),
		p_uom 				=> dedn_er_iv_uom(m),
		p_min_value 			=> NULL,
		p_max_value 			=> NULL,
		p_default_value 		=> dedn_er_iv_dflt(m),
		p_lookup_type 			=> dedn_er_iv_lkp(m),
		p_formula_id 			=> NULL,
		p_generate_db_items_flag 	=> dedn_er_iv_dbi(m),
		p_warning_or_error 		=> NULL);
Line: 3124

		p_insert_update_flag		=> 'UPDATE',
		p_input_value_id 		=> dedn_er_iv_ids(m),
		p_rowid 			=> NULL,
		p_recurring_flag 		=> 'N',
		p_mandatory_flag 		=> dedn_er_iv_mand(m),
		p_hot_default_flag 		=> 'N',
		p_standard_link_flag 		=> 'N',
		p_classification_type 		=> 'N',
		p_name 				=> dedn_er_iv_names(m),
		p_uom 				=> dedn_er_iv_uom(m),
		p_min_value 			=> NULL,
		p_max_value 			=> NULL,
		p_default_value 		=> dedn_er_iv_dflt(m),
		p_lookup_type 			=> dedn_er_iv_lkp(m),
		p_formula_id 			=> NULL,
		p_generate_db_items_flag 	=> dedn_er_iv_dbi(m),
		p_warning_or_error 		=> NULL);
Line: 3575

SELECT	pbc.balance_type_id
FROM	pay_balance_classifications pbc,
	pay_element_classifications pec,
	pay_balance_types pbt
WHERE  	nvl(pbc.business_group_id, p_busgrp_id) = p_busgrp_id
AND	nvl(pbc.legislation_code, 'US') = 'US'
AND	pbc.classification_id = pec.classification_id
AND	pec.classification_name = 'Pre-Tax Deductions'
AND	pec.business_group_id is null
AND	pec.legislation_code = 'US'
AND	pbc.balance_type_id = pbt.balance_type_id
AND	pbt.balance_name not in ('Net', 'Payments');
Line: 3646

SELECT	pbf.balance_type_id
FROM		pay_balance_feeds_f pbf,
		pay_balance_types pbt
WHERE  	pbf.input_value_id = p_src_iv_id
AND		nvl(pbf.business_group_id, p_busgrp_id) = p_busgrp_id
AND		nvl(pbf.legislation_code, 'US') = 'US'
AND		pbt.balance_type_id = pbf.balance_type_id
AND		pbt.balance_name not in ('Net', 'Payments');
Line: 3714

select	name
into	v_bg_name
from 	per_business_groups
where	business_group_id = p_bg_id;
Line: 3896

  SELECT 	FF.formula_id
  INTO		v_skip_formula_id
  FROM		ff_formulas_f 		FF
  WHERE		FF.formula_name		= 'CHAINED_SKIP_FORMULA'
  AND		FF.business_group_id 	IS NULL
  AND 		FF.legislation_code 	= g_template_leg_code
  AND 		p_ele_eff_start_date    >= FF.effective_start_date
  AND 		p_ele_eff_start_date	<= FF.effective_end_date;
Line: 3908

  SELECT 	FF.formula_id
  INTO		v_skip_formula_id
  FROM		ff_formulas_f 		FF
  WHERE		FF.formula_name		= 'THRESHOLD_SKIP_FORMULA'
  AND		FF.business_group_id 	IS NULL
  AND		FF.legislation_code 	= g_template_leg_code
  AND 		p_ele_eff_start_date    >= FF.effective_start_date
  AND 		p_ele_eff_start_date	<= FF.effective_end_date;
Line: 3921

  SELECT 	FF.formula_id
  INTO		v_skip_formula_id
  FROM		ff_formulas_f 		FF
  WHERE		FF.formula_name 	= 'FREQ_RULE_SKIP_FORMULA'
  AND		FF.business_group_id 	IS NULL
  AND		FF.legislation_code	= g_template_leg_code
  AND 		p_ele_eff_start_date    >= FF.effective_start_date
  AND 		p_ele_eff_start_date	<= FF.effective_end_date;
Line: 3955

select distinct(classification_id)
into   v_primary_class_id
from   pay_element_classifications
where  upper(classification_name) = upper(p_ele_classification)
and    business_group_id is null
and    legislation_code = 'US';
Line: 3974

SELECT 	default_low_priority,
	default_high_priority
INTO	v_class_lo_priority,
	v_class_hi_priority
FROM 	pay_element_classifications
WHERE	classification_id	= v_primary_class_id
AND	business_group_id	is null
AND	legislation_code	= 'US';
Line: 3991

select default_high_priority
into   l_invol_dflt_prio
from   pay_element_classifications
where  UPPER(classification_name) = UPPER(g_invol_class_name)
and    business_group_id is null
and    legislation_code = 'US';
Line: 4086

  select default_priority
  into v_emp_liab_dflt_prio
  from pay_element_classifications
  where classification_name = 'Employer Liabilities'
  /* added check for legislation_code BUG 912994 */
  and legislation_code = g_template_leg_code;
Line: 4148

   UPDATE 	pay_input_values_f
   SET    	mandatory_flag 	= 'X'
   WHERE  	element_type_id = v_ele_type_id
   AND    	name 		= v_pay_value_name;
Line: 4153

   SELECT input_value_id
   INTO   v_payval_id
   FROM   pay_input_values_f
   WHERE  element_type_id 	= v_ele_type_id
   AND    name 			= v_pay_value_name;
Line: 4212

  update pay_element_types_f
  set ELEMENT_INFORMATION_CATEGORY='US_EMPLOYER LIABILITIES' ,
      element_information10 = v_er_charge_baltype_id
  where element_type_id = dedn_ele_ids(5)
  and g_eff_start_date between effective_start_date and effective_end_date;
Line: 4503

UPDATE pay_element_types_f
SET    element_information10 = dedn_assoc_bal_ids(1), -- primary bal
       element_information11 = dedn_assoc_bal_ids(5), -- accrued bal
       element_information12 = dedn_assoc_bal_ids(6), -- arrears bal
       element_information13 = dedn_assoc_bal_ids(4), -- not taken bal
       element_information15 = dedn_assoc_bal_ids(7), -- able amount bal
       element_information16 = dedn_assoc_bal_ids(2), -- addl amount bal
       element_information17 = dedn_assoc_bal_ids(3), -- repl amount bal
       element_information18 = dedn_ele_ids(3), -- Special Inputs
       element_information19 = dedn_ele_ids(4), -- Special Features
       element_information20 = dedn_ele_ids(2)  -- Withholding ele
WHERE  element_type_id       = dedn_ele_ids(1)
AND    business_group_id + 0 = p_bg_id;