DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_JP_ENTRIES_PKG

Source


4 -- Constant values used to remove Japanese characters(Temporary solution).
1 Package Body pay_jp_entries_pkg as
2 /* $Header: pyjpetr.pkb 120.1.12010000.2 2010/01/26 07:28:57 keyazawa ship $ */
3 --
5 --
6 c_si_elm_name          constant pay_element_types_f.element_name%TYPE := 'COM_SI_INFO';
7 c_li_elm_name          constant pay_element_types_f.element_name%TYPE := 'COM_LI_INFO';
8 c_ci_elm_name          constant pay_element_types_f.element_name%TYPE := 'COM_CI_EXCLUDE_INFO';
9 c_hi_elm_name          constant pay_element_types_f.element_name%TYPE := 'COM_HI_QUALIFY_INFO';
10 c_wp_elm_name          constant pay_element_types_f.element_name%TYPE := 'COM_WP_QUALIFY_INFO';
11 c_wpf_elm_name         constant pay_element_types_f.element_name%TYPE := 'COM_WPF_QUALIFY_INFO';
12 c_ui_elm_name          constant pay_element_types_f.element_name%TYPE := 'COM_EI_QUALIFY_INFO';
13 c_hi_sal_elm_name      constant pay_element_types_f.element_name%TYPE := 'SAL_HI_PREM_PROC';
14 c_wp_sal_elm_name      constant pay_element_types_f.element_name%TYPE := 'SAL_WP_PREM_PROC';
15 c_ui_sal_elm_name      constant pay_element_types_f.element_name%TYPE := 'SAL_EI_PREM_PROC';
16 c_hi_bon_elm_name      constant pay_element_types_f.element_name%TYPE := 'BON_HI_PREM_PROC';
17 c_hi_bon2_elm_name     constant pay_element_types_f.element_name%TYPE := 'BON_HI_PREM_PROC';
18 c_wp_bon_elm_name      constant pay_element_types_f.element_name%TYPE := 'BON_WP_PREM_PROC';
19 c_wp_bon2_elm_name     constant pay_element_types_f.element_name%TYPE := 'BON_WP_PREM_PROC';
23 c_wp_comp_elm_name     constant pay_element_types_f.element_name%TYPE := 'COM_WP_SMR_INFO';
20 c_ui_bon_elm_name      constant pay_element_types_f.element_name%TYPE := 'BON_EI_PREM_PROC';
21 c_ui_sp_bon_elm_name   constant pay_element_types_f.element_name%TYPE := 'SPB_EI_PREM_PROC';
22 c_hi_comp_elm_name     constant pay_element_types_f.element_name%TYPE := 'COM_HI_SMR_INFO';
24 c_itax_elm_name        constant pay_element_types_f.element_name%TYPE := 'COM_ITX_INFO';
25 c_depends_elm_name     constant pay_element_types_f.element_name%TYPE := 'YEA_DEP_EXM_PROC';
26 c_insprems_elm_name    constant pay_element_types_f.element_name%TYPE := 'YEA_INS_PREM_SPOUSE_SP_EXM_INFO';
27 c_adj_elm_name         constant pay_element_types_f.element_name%TYPE := 'YEA_ADJ_INFO';
28 c_housing_elm_name     constant pay_element_types_f.element_name%TYPE := 'YEA_HOUSING_LOAN_TAX_CREDIT';
29 c_hld_elm_name	constant pay_element_types_f.element_name%TYPE := 'YEA_HOUSING_LOAN_INFO';
30 c_pjob_elm_name        constant pay_element_types_f.element_name%TYPE := 'YEA_PREV_EMP_INFO';
31 c_ltax_elm_name        constant pay_element_types_f.element_name%TYPE := 'COM_LTX_INFO';
32 c_term_elm_name        constant pay_element_types_f.element_name%TYPE := 'COM_TRM_INFO';
33 c_sp_ltax_elm_name     constant pay_element_types_f.element_name%TYPE := 'TRM_LTX_SP_WITHHOLD_PROC';
34 c_nonresident_elm_name constant pay_element_types_f.element_name%TYPE := 'COM_NRES_INFO';
35 --- Used by PAYJPCMA.fmx ---------------
36 c_cma_train_elm_name   constant pay_element_types_f.element_name%TYPE := 'SAL_CMA_PUBLIC_TRANSPORT_INFO';
37 c_cma_car_elm_name     constant pay_element_types_f.element_name%TYPE := 'SAL_CMA_PRIVATE_TRANSPORT_INFO';
38 --
39 -- Current Element Entry Row Hander "pay_ele_shd" does not comply with API
40 -- strategy. "pay_ele_shd" is like API, but not API. So this package
41 -- used in PAYJPTAX form implement part of real API to use DTCSAPI library.
42 --
43 g_old_rec		pay_element_entries_f%ROWTYPE;             -- Global record definition
44 g_package		varchar2(33) := '  pay_jp_entries_pkg.';   -- Global package name
45 --
46 -- ----------------------------------------------------------------------------
47 -- |------------------------< element_name >----------------------------------|
48 -- ----------------------------------------------------------------------------
49 --
50 -- This function returns element_name corresponding to element_code.
51 -- This is temporary solution in R11i.
52 --
53 Function element_name(
54 	p_element_code		in  varchar2) return varchar2
55 Is
56 	l_element_name	pay_element_types_f.element_name%TYPE;
57 Begin
58 	--- Used by PAYJPTAX.fmx ---------------
59 	if p_element_code = 'SI' then
60 		l_element_name := c_si_elm_name;
61 	elsif p_element_code = 'LI' then
62 		l_element_name := c_li_elm_name;
63 	elsif p_element_code = 'CI' then
64 		l_element_name := c_ci_elm_name;
65 	elsif p_element_code = 'HI' then
66 		l_element_name := c_hi_elm_name;
67 	elsif p_element_code = 'WP' then
68 		l_element_name := c_wp_elm_name;
69 	elsif p_element_code = 'WPF' then
70 		l_element_name := c_wpf_elm_name;
71 	elsif p_element_code = 'UI' then
72 		l_element_name := c_ui_elm_name;
73 	elsif p_element_code = 'HI_SAL' then
74 		l_element_name := c_hi_sal_elm_name;
75 	elsif p_element_code = 'WP_SAL' then
76 		l_element_name := c_wp_sal_elm_name;
77 	elsif p_element_code = 'UI_SAL' then
78 		l_element_name := c_ui_sal_elm_name;
79 	elsif p_element_code IN ('HI_BON', 'HI_BON2') then
80 		IF pay_jp_formula_function_pkg.get_jp_parameter('MIGRATION', 'TOTAL_REWARD_SYSTEM') = 'Y' THEN
81 			l_element_name := c_hi_bon2_elm_name;
82 		ELSE
83 			l_element_name := c_hi_bon_elm_name;
84 		END IF;
85 	elsif p_element_code IN ('WP_BON', 'WP_BON2') then
86 		IF pay_jp_formula_function_pkg.get_jp_parameter('MIGRATION', 'TOTAL_REWARD_SYSTEM') = 'Y' THEN
87 			l_element_name := c_wp_bon2_elm_name;
88 		ELSE
89 			l_element_name := c_wp_bon_elm_name;
90 		END IF;
91 	elsif p_element_code = 'UI_BON' then
92 		l_element_name := c_ui_bon_elm_name;
93 	elsif p_element_code = 'UI_SP_BON' then
94 		l_element_name := c_ui_sp_bon_elm_name;
95 	elsif p_element_code = 'HI_COMP' then
96 		l_element_name := c_hi_comp_elm_name;
97 	elsif p_element_code = 'WP_COMP' then
98 		l_element_name := c_wp_comp_elm_name;
99 	elsif p_element_code = 'ITAX' then
100 		l_element_name := c_itax_elm_name;
101 	elsif p_element_code = 'NONRESIDENT' then
102 		l_element_name := c_nonresident_elm_name;
103 	elsif p_element_code = 'DEPENDS' then
104 		l_element_name := c_depends_elm_name;
105 	elsif p_element_code = 'INSPREMS' then
106 		l_element_name := c_insprems_elm_name;
107         elsif p_element_code = 'ADJ' then
108                 l_element_name := c_adj_elm_name;
109 	elsif p_element_code = 'HOUSING' then
110 		l_element_name := c_housing_elm_name;
111 	elsif p_element_code = 'HLD' then
112 		l_element_name := c_hld_elm_name;
113 	elsif p_element_code = 'PJOB' then
114 		l_element_name := c_pjob_elm_name;
115 	elsif p_element_code = 'LTAX' then
116 		l_element_name := c_ltax_elm_name;
117 	elsif p_element_code = 'TERM' then
118 		l_element_name := c_term_elm_name;
119 	elsif p_element_code = 'SP_LTAX' then
120 		l_element_name := c_sp_ltax_elm_name;
121 	--- Used by PAYJPCMA.fmx ---------------
122 	elsif p_element_code = 'TRAIN_VALUES' then
123 		l_element_name := c_cma_train_elm_name;
124 	elsif p_element_code = 'CAR_VALUES' then
125 		l_element_name := c_cma_car_elm_name;
126 	end if;
127 	--
128 	-- Return.
129 	--
130 	return	l_element_name;
131 End element_name;
132 --
136 --
133 -- ----------------------------------------------------------------------------
134 -- |------------------------< derive_attributes >-----------------------------|
135 -- ----------------------------------------------------------------------------
137 -- This procedure returns element and input value attributes for p_elm_code_tbl
138 -- input parameters like INPUT_CURRENCY_CODE, UOM etc.
139 -- p_business_group_id must be not null.
140 --
141 Procedure derive_attributes(
142 	p_elm_code_tbl		in     elm_code_tbl,
143 	p_effective_date	in     date,
144 	p_business_group_id	in     number,
145 	p_elm_rec_tbl	 out nocopy    elm_rec_tbl,
146 	p_iv_rec_tbl	 out nocopy    iv_rec_tbl)
147 Is
148 	l_index		number;
149 	l_elm_rec	pay_element_types_f%ROWTYPE;
150   l_effective_date date;
151 	Cursor csr_iv(
152     p_element_type_id number,
153     p_eff_date date) is
154 		select	piv.input_value_id,
155 			piv.display_sequence,
156 			piv.uom,
157 			piv.mandatory_flag
158 		from	pay_input_values_f	piv
159 		where	piv.element_type_id = p_element_type_id
160 		and	p_eff_date
161 			between piv.effective_start_date and piv.effective_end_date;
162 Begin
163 	l_index := p_elm_code_tbl.first;
164 	--
165 	-- Fetch element attributes.
166 	--
167 	while l_index is not NULL loop
168   --
169     l_effective_date := p_effective_date;
170     if p_elm_code_tbl(l_index) = 'HLD' then
171     --
172       l_effective_date := greatest(p_effective_date,to_date('2009/04/01','YYYY/MM/DD'));
173     --
174     end if;
175   --
176 		l_elm_rec := hr_jp_id_pkg.element_type_rec(element_name(p_elm_code_tbl(l_index)),
177 						p_business_group_id,NULL,l_effective_date,'FALSE');
178 		--
179 		-- When not found, raise error.
180 		--
181 		if l_elm_rec.element_type_id is NULL then
182 			hr_utility.set_message(801,'HR_7478_PLK_INCONSISTENT_ELE');
183 			hr_utility.set_message_token('ELEMENT_TYPE_ID',NULL);
184 			hr_utility.set_message_token('ELEMENT_NAME',p_elm_code_tbl(l_index));
185 			hr_utility.raise_error;
186 		else
187 			p_elm_rec_tbl(l_elm_rec.element_type_id).element_code			:= p_elm_code_tbl(l_index);
188 			p_elm_rec_tbl(l_elm_rec.element_type_id).input_currency_code		:= l_elm_rec.input_currency_code;
189 			p_elm_rec_tbl(l_elm_rec.element_type_id).multiple_entries_allowed_flag	:= l_elm_rec.multiple_entries_allowed_flag;
190 		end if;
191 		--
192 		-- Fetch input value attributes.
193 		--
194 		for l_rec in csr_iv(
195       l_elm_rec.element_type_id,
196       l_effective_date) loop
197 			p_iv_rec_tbl(l_rec.input_value_id).element_type_id	:= l_elm_rec.element_type_id;
198 			p_iv_rec_tbl(l_rec.input_value_id).display_sequence	:= l_rec.display_sequence;
199 			p_iv_rec_tbl(l_rec.input_value_id).uom			:= l_rec.uom;
200 			p_iv_rec_tbl(l_rec.input_value_id).mandatory_flag	:= l_rec.mandatory_flag;
201 		end loop;
202 		--
203 		-- Increment counter.
204 		--
205 		l_index := p_elm_code_tbl.next(l_index);
206 	end loop;
207 End derive_attributes;
208 --
209 -- ----------------------------------------------------------------------------
210 -- |------------------------< derive_format_mask >----------------------------|
211 -- ----------------------------------------------------------------------------
212 --
213 -- Derive format mask for p_iv_rec_tbl input parameter.
214 -- This procedure is designed to reduce network traffic because
215 -- fnd_currency.get_format_mask function accesses to DB.
216 --
217 Procedure derive_format_mask(
218 	p_elm_rec_tbl		in     elm_rec_tbl,
219 	p_iv_rec_tbl		in out nocopy iv_rec_tbl)
220 Is
221 	l_index		number;
222 Begin
223 	l_index := p_iv_rec_tbl.first;
224 	while l_index is not NULL loop
225 		--
226 		-- Only supported with uom = 'M'(Money) currently.
227 		--
228 		if p_iv_rec_tbl(l_index).uom = 'M' then
229 			if p_iv_rec_tbl(l_index).max_length is not NULL then
230 				p_iv_rec_tbl(l_index).format_mask := fnd_currency.get_format_mask(
231 									p_elm_rec_tbl(p_iv_rec_tbl(l_index).element_type_id).input_currency_code,
232 									p_iv_rec_tbl(l_index).max_length);
233 			end if;
234 		end if;
235 		--
236 		-- Increment counter.
237 		--
238 		l_index := p_iv_rec_tbl.next(l_index);
239 	end loop;
240 End derive_format_mask;
241 --
242 -- ----------------------------------------------------------------------------
243 -- |-----------------------------< chk_entry >--------------------------------|
244 -- ----------------------------------------------------------------------------
245 --
246 -- This procedure checks checks entry can be created or not.
247 -- This procedure is interface for hr_entry.check_element_entry procedure.
248 --
249 Procedure chk_entry(
250 	p_element_entry_id	in     number,
251 	p_assignment_id		in     number,
252 	p_element_link_id	in     number,
253 	p_entry_type		in     varchar2,
254 	p_original_entry_id	in     number   default null,
255 	p_target_entry_id	in     number   default null,
256 	p_effective_date	in     date,
257 	p_validation_start_date	in     date,
258 	p_validation_end_date	in     date,
259 	p_effective_start_date	in out nocopy date,
260 	p_effective_end_date	in out nocopy date,
261 	p_usage			in     varchar2,
262 	p_dt_update_mode	in     varchar2,
263 	p_dt_delete_mode	in     varchar2)
264 Is
265 Begin
266 	hr_entry.chk_element_entry(
267 		p_element_entry_id	=> p_element_entry_id,
268 		p_original_entry_id	=> p_original_entry_id,
272 		p_entry_type		=> p_entry_type,
269 		p_session_date		=> p_effective_date,
270 		p_element_link_id	=> p_element_link_id,
271 		p_assignment_id		=> p_assignment_id,
273 		p_effective_start_date	=> p_effective_start_date,
274 		p_effective_end_date	=> p_effective_end_date,
275 		p_validation_start_date	=> p_validation_start_date,
276 		p_validation_end_date	=> p_validation_end_date,
277 		p_dt_update_mode	=> p_dt_update_mode,
278 		p_dt_delete_mode	=> p_dt_delete_mode,
279 		p_usage			=> p_usage,
280 		p_target_entry_id	=> p_target_entry_id);
281 End chk_entry;
282 --
283 -- ----------------------------------------------------------------------------
284 -- |---------------------< derive_default_values >----------------------------|
285 -- ----------------------------------------------------------------------------
286 --
287 -- This procedure derive default values for p_element_code input parameter.
288 --
289 Procedure derive_default_values(
290 	p_assignment_id		in     number,
291 	p_element_code		in     varchar2,
292 	p_business_group_id	in     varchar2,
293 	p_entry_type            in     varchar2,
294 	p_element_link_id	out nocopy    number,
295 	p_ev_rec_tbl		out nocopy    ev_rec_tbl,
296 	p_effective_date	in     date,
297 	p_effective_start_date	in out nocopy date,
298 	p_effective_end_date	in out nocopy date)
299 Is
300 	l_element_type_id	number;
301 	l_counter		number;
302 	Cursor csr_default_value is
303 		select	piv.input_value_id,
304 			piv.display_sequence,
305 			decode(piv.hot_default_flag,
306 					'Y',nvl(pliv.default_value,piv.default_value),
307 					pliv.default_value)	DEFAULT_VALUE,
308 			decode(piv.lookup_type,NULL,NULL,
309 				hr_general.decode_lookup(
310 						piv.lookup_type,
311 						decode(piv.hot_default_flag,
312 							'Y',nvl(pliv.default_value,piv.default_value),
313 							pliv.default_value)))	D_DEFAULT_VALUE
314 		from	pay_input_values_f	piv,
315 			pay_link_input_values_f	pliv
316 		where	pliv.element_link_id = p_element_link_id
317 		and	p_effective_date
318 			between pliv.effective_start_date and pliv.effective_end_date
319 		and	piv.input_value_id = pliv.input_value_id
320 		and	p_effective_date
321 			between piv.effective_start_date and piv.effective_end_date
322 		order by piv.display_sequence;
323 Begin
324 	--
325 	-- Fetch eligible element_link_id for the assignment.
326 	--
327 	l_element_type_id	:= hr_jp_id_pkg.element_type_id(element_name(p_element_code),p_business_group_id);
328 	p_element_link_id	:= hr_entry_api.get_link(
329 					p_assignment_id		=> p_assignment_id,
330 					p_element_type_id	=> l_element_type_id,
331 					p_session_date		=> p_effective_date);
332 	if p_element_link_id is NULL then
333 		hr_utility.set_message(801,'HR_7027_ELE_ENTRY_EL_NOT_EXST');
334 		hr_utility.set_message_token('DATE',fnd_date.date_to_displaydate(p_effective_date));
335 		hr_utility.raise_error;
336 	end if;
337 	--
338 	-- At first, checks whether the entry is available.
339 	--
340 	chk_entry(
341 		p_element_entry_id	=> NULL,
342 		p_assignment_id		=> p_assignment_id,
343 		p_element_link_id	=> p_element_link_id,
344 		p_entry_type		=> p_entry_type,
345 		p_effective_date	=> p_effective_date,
346 		p_validation_start_date	=> NULL,
347 		p_validation_end_date	=> NULL,
348 		p_effective_start_date	=> p_effective_start_date,
349 		p_effective_end_date	=> p_effective_end_date,
350 		p_usage			=> 'INSERT',
351 		p_dt_update_mode	=> NULL,
352 		p_dt_delete_mode	=> NULL);
353 	--
354 	-- If entry is available, fetch default values.
355 	-- Must initialize varray variables.
356 	--
357 	l_counter	:= 0;
358 --	p_ev_rec_tbl	:= ev_rec_tbl();
359 	for l_rec in csr_default_value loop
360 		l_counter := l_counter + 1;
361 --		p_ev_rec_tbl.extend;
362 		--
363 		-- Japanese element entry specific routine.
364 		-- These would be moved to PERSON datetrack DDF in R12.
365 		--
366 		if l_rec.default_value is not NULL then
367 			if (p_element_code = 'SI' and l_rec.display_sequence in (1,3,6))
368 			or (p_element_code = 'LI' and l_rec.display_sequence in (2,5))
369 			or (p_element_code = 'ITAX' and l_rec.display_sequence = 2) then
370 				l_rec.d_default_value := hr_jp_general_pkg.decode_org(to_number(l_rec.default_value));
371 			elsif (p_element_code = 'LTAX' and l_rec.display_sequence = 2)
372 			or    (p_element_code = 'SP_LTAX' and l_rec.display_sequence = 1) then
373 				l_rec.d_default_value := hr_jp_general_pkg.decode_district(substrb(l_rec.d_default_value,1,5));
374 			end if;
375 		end if;
376 		p_ev_rec_tbl(l_counter).input_value_id	:= l_rec.input_value_id;
377 		p_ev_rec_tbl(l_counter).entry_value	:= l_rec.default_value;
378 		p_ev_rec_tbl(l_counter).d_entry_value	:= l_rec.d_default_value;
379 	end loop;
380 End derive_default_values;
381 --
382 -- ----------------------------------------------------------------------------
383 -- |-----------------------------< chk_formula >------------------------------|
384 -- ----------------------------------------------------------------------------
385 --
386 -- This procedure execute formula validation for input value.
387 --
388 Procedure chk_formula(
389 	p_formula_id		in  number,
390 	p_entry_value		in  varchar2,
391 	p_business_group_id	in  number,
392 	p_assignment_id		in  number,
393 	p_date_earned		in  date,
394 	p_formula_status out nocopy varchar2,
395 	p_formula_message out nocopy varchar2)
396 Is
397 	l_counter	NUMBER := 0;
398 	l_inputs	ff_exec.inputs_t;
399 	l_outputs	ff_exec.outputs_t;
400 	Cursor csr_fdi is
401 		select	item_name						NAME,
402 			decode(data_type,'T','TEXT','N','NUMBER','D','DATE')	DATATYPE,
406 		and	p_date_earned
403 			decode(usage,'U','CONTEXT','INPUT')			CLASS
404 		from	ff_fdi_usages_f
405 		where	formula_id = p_formula_id
407 			between effective_start_date and effective_end_date;
408 BEGIN
409 	--
410 	-- Initialize formula informations.
411 	--
412 	ff_exec.init_formula(
413 			p_formula_id		=> p_formula_id,
414 			p_effective_date	=> p_date_earned,
415 			p_inputs		=> l_inputs,
416 			p_outputs		=> l_outputs);
417 	--
418 	-- Setup input variables.
419 	--
420 	l_counter := l_inputs.first;
421 	while l_counter is not NULL loop
422 		if l_inputs(l_counter).name = 'BUSINESS_GROUP_ID' then
423 			l_inputs(l_counter).value := fnd_number.number_to_canonical(p_business_group_id);
424 		elsif l_inputs(l_counter).name = 'ASSIGNMENT_ID' then
425 			l_inputs(l_counter).value := fnd_number.number_to_canonical(p_assignment_id);
426 		elsif l_inputs(l_counter).name = 'DATE_EARNED' then
427 			l_inputs(l_counter).value := fnd_date.date_to_canonical(p_date_earned);
428 		elsif l_inputs(l_counter).name = 'ENTRY_VALUE' then
429 			l_inputs(l_counter).value := p_entry_value;
430 		end if;
431 		l_counter := l_inputs.next(l_counter);
432 	end loop;
433 	--
434 	-- Execute formula. Formula unexpected error is raised by ffexec,
435 	-- so not necessary to handle error.
436 	--
437 	ff_exec.run_formula(
438 			p_inputs		=> l_inputs,
439 			p_outputs		=> l_outputs,
440 			p_use_dbi_cache		=> FALSE);
441 	--
442 	-- Setup output variables.
443 	--
444 	l_counter := l_outputs.first;
445 	while l_counter is not NULL loop
446 		if l_outputs(l_counter).name = 'FORMULA_STATUS' then
447 			p_formula_status := l_outputs(l_counter).value;
448 		elsif l_outputs(l_counter).name = 'FORMULA_MESSAGE' then
449 			p_formula_message := l_outputs(l_counter).value;
450 		end if;
451 		l_counter := l_outputs.next(l_counter);
452 	end loop;
453 End chk_formula;
454 --
455 -- ----------------------------------------------------------------------------
456 -- |---------------------------< chk_entry_value >----------------------------|
457 -- ----------------------------------------------------------------------------
458 --
459 -- This function can not validate "user enterable flag".
460 -- Never call this procedure when p_display_value is NULL on Forms
461 -- WHEN-VALIDATE-ITEM trigger which will raise unexpected error.
462 -- Remeber hot defaulted value is not validated.
463 --
464 Procedure chk_entry_value(
465 	p_element_link_id	in     number,
466 	p_input_value_id	in     number,
467 	p_effective_date	in     date,
468 	p_business_group_id     in     number,
469 	p_assignment_id         in     number,
470 	p_user_value		in out nocopy varchar2,
471 	p_canonical_value out nocopy    varchar2,
472 	p_hot_defaulted	 out nocopy    boolean,
473 	p_min_max_warning out nocopy    boolean,
474 	p_user_min_value out nocopy    varchar2,
475 	p_user_max_value out nocopy    varchar2,
476 	p_formula_warning out nocopy    boolean,
477 	p_formula_message out nocopy    varchar2)
478 Is
479 	l_min_max_status	varchar2(1);
480 	l_formula_status	varchar2(1);
481 	Cursor csr_iv is
482 		select	pivtl.name,
483 			piv.uom,
484 			piv.mandatory_flag,
485 			piv.hot_default_flag,
486 			piv.lookup_type,
487 			decode(piv.hot_default_flag,
488 					'Y',nvl(pliv.default_value,piv.default_value),
489 					pliv.default_value)	DEFAULT_VALUE,
490 --			decode(piv.lookup_type,NULL,NULL,
491 --				hr_general.decode_lookup(
492 --						piv.lookup_type,
493 --						decode(piv.hot_default_flag,
494 --							'Y',nvl(pliv.default_value,piv.default_value),
495 --							pliv.default_value)))	D_DEFAULT_VALUE,
496 			decode(piv.hot_default_flag,
497 					'Y',nvl(pliv.min_value,piv.min_value),
498 					pliv.min_value)		MIN_VALUE,
499 			decode(piv.hot_default_flag,
500 					'Y',nvl(pliv.max_value,piv.max_value),
501 					pliv.max_value)		MAX_VALUE,
502 			piv.formula_id,
503 			decode(piv.hot_default_flag,
504 					'Y',nvl(pliv.warning_or_error,piv.warning_or_error),
505 					pliv.warning_or_error)	WARNING_OR_ERROR,
506 			pet.input_currency_code
507 		from	pay_element_types_f	pet,
508 			pay_input_values_f_tl	pivtl,
509 			pay_input_values_f	piv,
510 			pay_link_input_values_f	pliv
511 		where	pliv.element_link_id = p_element_link_id
512 		and	pliv.input_value_id = p_input_value_id
513 		and	p_effective_date
514 			between pliv.effective_start_date and pliv.effective_end_date
515 		and	piv.input_value_id = pliv.input_value_id
516 		and	p_effective_date
517 			between piv.effective_start_date and piv.effective_end_date
518 		and	pivtl.input_value_id = piv.input_value_id
519 		and	pivtl.language = userenv('LANG')
520 		and	pet.element_type_id = piv.element_type_id
521 		and	p_effective_date
522 			between pet.effective_start_date and pet.effective_end_date;
523 	l_rec	csr_iv%ROWTYPE;
524 	l_d_uom	hr_lookups.meaning%TYPE;
525 Begin
526 	--
527 	-- Initialize output variables.
528 	--
529 	p_canonical_value	:= NULL;
530 	p_hot_defaulted		:= FALSE;
531 	p_min_max_warning	:= FALSE;
532 	p_user_min_value	:= NULL;
533 	p_user_max_value	:= NULL;
534 	p_formula_warning	:= FALSE;
535 	p_formula_message	:= NULL;
536 	--
537 	-- When p_input_value_id is not NULL then validate.
538 	--
539 	If p_input_value_id is not NULL then
540 		--
541 		-- Fetch input value attributes.
542 		--
543 		open csr_iv;
544 		fetch csr_iv into l_rec;
545 		If csr_iv%NOTFOUND then
546 			close csr_iv;
547 			hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
551 		End If;
548 			hr_utility.set_message_token('PROCEDURE','hr_entry.check_format');
549 			hr_utility.set_message_token('STEP','1');
550 			hr_utility.raise_error;
552 		close csr_iv;
553 		--
554 		-- When user entered value is NULL.
555 		--
556 		If p_user_value is NULL then
557 			--
558 			-- Mandatory Validation.
559 			--
560 			If l_rec.mandatory_flag = 'Y' then
561 				--
562 				-- When not hot defaulted.
563 				--
564 				If l_rec.hot_default_flag = 'N' then
565 					hr_utility.set_message(801,'HR_6127_ELE_ENTRY_VALUE_MAND');
566 					hr_utility.set_message_token('INPUT_VALUE_NAME',l_rec.name);
567 					hr_utility.raise_error;
568 				--
569 				-- When hot defaulted.
570 				--
571 				Else
572 					If l_rec.default_value is NULL then
573 						hr_utility.set_message(801,'HR_6128_ELE_ENTRY_MAND_HOT');
574 						hr_utility.set_message_token('INPUT_VALUE_NAME',l_rec.name);
575 						hr_utility.raise_error;
576 					Else
577 						p_canonical_value := l_rec.default_value;
578 						hr_chkfmt.changeformat(
579 							input		=> p_canonical_value,
580 							output		=> p_user_value,
581 							format		=> l_rec.uom,
582 							curcode		=> l_rec.input_currency_code);
583 					End If;
584 				End If;
585 			End If;
586 		End If;
587 		--
588 		-- When p_user_value is not NULL.
589 		-- Hot defaulted value is validated again in the following routine.
590 		--
591 		If p_user_value is not NULL then
592 			--
593 			-- Check format validation(format, min and max validations).
594 			-- Hot defaulted value is validated again for range validation.
595 			--
596 			Begin
597 				hr_chkfmt.checkformat(
598 					value		=> p_user_value,
599 					format		=> l_rec.uom,
600 					output		=> p_canonical_value,
601 					minimum		=> l_rec.min_value,
602 					maximum		=> l_rec.max_value,
603 					nullok		=> 'Y',
604 					rgeflg		=> l_min_max_status,
605 					curcode		=> l_rec.input_currency_code);
606 			Exception
607 				--
608 				-- In case the value input is incorrect format.
609 				--
610 				when others then
611 					l_d_uom := hr_general.decode_lookup('UNITS',l_rec.uom);
612 					hr_utility.set_message(801,'PAY_6306_INPUT_VALUE_FORMAT');
613 					hr_utility.set_message_token('UNIT_OF_MEASURE',l_d_uom);
614 					hr_utility.raise_error;
615 			End;
616 			--
617 			-- Format min_value and max_value for output parameters.
618 			-- These parameters should be used for message only.
619 			--
620 			If l_rec.min_value is not NULL then
621 				hr_chkfmt.changeformat(
622 					input		=> l_rec.min_value,
623 					output		=> p_user_min_value,
624 					format		=> l_rec.uom,
625 					curcode		=> l_rec.input_currency_code);
626 			End If;
627 			If l_rec.max_value is not NULL then
628 				hr_chkfmt.changeformat(
629 					input		=> l_rec.max_value,
630 					output		=> p_user_max_value,
631 					format		=> l_rec.uom,
632 					curcode		=> l_rec.input_currency_code);
633 			End If;
634 			--
635 			-- If warning_or_error = 'E'(Error) and l_min_max_status = 'F'(Fatal),
636 			-- then raise error. In case of 'W'(Warning), Forms should warn to user
637 			-- with fnd_message.warn procedure.
638 			--
639 			If l_min_max_status = 'F' and l_rec.warning_or_error = 'E' then
640 				hr_utility.set_message(801,'PAY_JP_INPUTV_OUT_OF_RANGE');
641 				hr_utility.set_message_token('MIN_VALUE',p_user_min_value);
642 				hr_utility.set_message_token('MAX_VALUE',p_user_max_value);
643 				hr_utility.raise_error;
644 			End If;
645 			--
646 			-- Execute formula validation.
647 			--
648 			If l_rec.formula_id is not NULL then
649 				chk_formula(
650 					p_formula_id		=> l_rec.formula_id,
651 					p_entry_value		=> p_canonical_value,
652 					p_business_group_id	=> p_business_group_id,
653 					p_assignment_id		=> p_assignment_id,
654 					p_date_earned		=> p_effective_date,
655 					p_formula_status	=> l_formula_status,
656 					p_formula_message	=> p_formula_message);
657 			End If;
658 			--
659 			-- If warning_or_error = 'E'(Error) and l_formula_status = 'E'(Error),
660 			-- then raise error. In case of 'W'(Warning), Forms should warn to user
661 			-- with fnd_message.warn procedure.
662 			--
663 			If l_formula_status = 'E' and l_rec.warning_or_error = 'E' then
664 				hr_utility.set_message(801,'HR_ELE_ENTRY_FORMULA_HINT');
665 				hr_utility.set_message_token('FORMULA_TEXT',p_formula_message);
666 				hr_utility.raise_error;
667 			End If;
668 			--
669 			-- In case lookup_type validation is applied.
670 			--
671 			If l_rec.lookup_type is not NULL then
672 				--
673 				-- Lookup_type validation with effective_date.
674 				--
675 				If hr_api.not_exists_in_hr_lookups(
676 						p_effective_date	=> p_effective_date,
677 						p_lookup_type		=> l_rec.lookup_type,
678 						p_lookup_code		=> p_canonical_value) then
679 					hr_utility.set_message(801,'HR_7033_ELE_ENTRY_LKUP_INVLD');
680 					hr_utility.set_message_token('LOOKUP_TYPE',l_rec.lookup_type);
681 					hr_utility.raise_error;
682 				End If;
683 			End If;
684 		End If;
685 		--
686 		-- Set output variables.
687 		--
688 		If l_min_max_status = 'F' then
689 			p_min_max_warning := TRUE;
690 		End If;
691 		If l_formula_status = 'E' then
692 			p_formula_warning := TRUE;
693 		End If;
694 		If l_rec.hot_default_flag = 'Y' and p_canonical_value = l_rec.default_value then
695 			p_hot_defaulted := TRUE;
696 		End If;
697 	--
701 		p_user_value := NULL;
698 	-- When p_input_value_id is NULL.
699 	--
700 	Else
702 	End If;
703 End chk_entry_value;
704 --
705 -- ----------------------------------------------------------------------------
706 -- |--------------------------< find_dt_upd_modes >---------------------------|
707 -- ----------------------------------------------------------------------------
708 --
709 -- Mandatory procedure to use DTCSAPI.pll forms library. This procedure returns
710 -- which datetrack modes are available when updating.
711 --
712 Procedure find_dt_upd_modes
713 	(p_effective_date	in  date,
714 	 p_base_key_value	in  number,
715 	 p_correction	 out nocopy boolean,
716 	 p_update	 out nocopy boolean,
717 	 p_update_override out nocopy boolean,
718 	 p_update_change_insert out nocopy boolean)
719 Is
720 --
721   l_proc 	varchar2(72) := g_package||'find_dt_upd_modes';
722 --
723   l_entry_type		pay_element_entries_f.entry_type%TYPE;
724   l_processing_type	pay_element_types_f.processing_type%TYPE;
725 --
726   Cursor C_Sel1 Is
727     select  pee.entry_type,
728             pet.processing_type
729     from    pay_element_types_f		pet,
730             pay_element_links_f		pel,
731             pay_element_entries_f	pee
732     where   pee.element_entry_id = p_base_key_value
733     and     p_effective_date
734             between pee.effective_start_date and pee.effective_end_date
735     and     pel.element_link_id = pee.element_link_id
736     and     p_effective_date
737             between pel.effective_start_date and pel.effective_end_date
738     and     pet.element_type_id = pel.element_type_id
739     and     p_effective_date
740             between pet.effective_start_date and pet.effective_end_date;
741 --
742 Begin
743   hr_utility.set_location('Entering:'||l_proc, 5);
744   Open  C_Sel1;
745   Fetch C_Sel1 Into l_entry_type,
746 		    l_processing_type;
747   If C_Sel1%notfound then
748     Close C_Sel1;
749     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
750     hr_utility.set_message_token('PROCEDURE', l_proc);
751     hr_utility.set_message_token('STEP','10');
752     hr_utility.raise_error;
753   End If;
754   Close C_Sel1;
755 --
756   If l_processing_type = 'N' or
757      l_entry_type <> 'E' then
758     p_correction		:= true;
759     p_update			:= false;
760     p_update_override		:= false;
761     p_update_change_insert	:= false;
762   Else
763     --
764     -- Call the corresponding datetrack api
765     --
766     dt_api.find_dt_upd_modes
767 	(p_effective_date	=> p_effective_date,
768 	 p_base_table_name	=> 'pay_element_entries_f',
769 	 p_base_key_column	=> 'element_entry_id',
770 	 p_base_key_value	=> p_base_key_value,
771 	 p_correction		=> p_correction,
772 	 p_update		=> p_update,
773 	 p_update_override	=> p_update_override,
774 	 p_update_change_insert	=> p_update_change_insert);
775   End If;
776   --
777     hr_utility.set_location(' Leaving:'||l_proc, 10);
778 End find_dt_upd_modes;
779 --
780 -- ----------------------------------------------------------------------------
781 -- |--------------------------< find_dt_del_modes >---------------------------|
782 -- ----------------------------------------------------------------------------
783 --
784 -- Mandatory procedure to use DTCSAPI.pll forms library. This procedure returns
785 -- which datetrack modes are available when deleting.
786 --
787 Procedure find_dt_del_modes
788 	(p_effective_date	in  date,
789 	 p_base_key_value	in  number,
790 	 p_zap		 out nocopy boolean,
791 	 p_delete	 out nocopy boolean,
792 	 p_future_change out nocopy boolean,
793 	 p_delete_next_change out nocopy boolean)
794 Is
795 --
796   l_proc 		varchar2(72) 	:= g_package||'find_dt_del_modes';
797 --
798   l_parent_key_value1	number;
799   l_parent_key_value2	number;
800   l_entry_type		pay_element_entries_f.entry_type%TYPE;
804     select  pee.assignment_id,
801   l_processing_type	pay_element_types_f.processing_type%TYPE;
802 --
803   Cursor C_Sel1 Is
805             pee.element_link_id,
806             pee.entry_type,
807             pet.processing_type
808     from    pay_element_types_f		pet,
809             pay_element_links_f		pel,
810             pay_element_entries_f	pee
811     where   pee.element_entry_id = p_base_key_value
812     and     p_effective_date
813             between pee.effective_start_date and pee.effective_end_date
814     and     pel.element_link_id = pee.element_link_id
815     and     p_effective_date
816             between pel.effective_start_date and pel.effective_end_date
817     and     pet.element_type_id = pel.element_type_id
818     and     p_effective_date
819             between pet.effective_start_date and pet.effective_end_date;
820 --
821 Begin
822   hr_utility.set_location('Entering:'||l_proc, 5);
823   Open  C_Sel1;
824   Fetch C_Sel1 Into l_parent_key_value1,
825 		    l_parent_key_value2,
826 		    l_entry_type,
827 		    l_processing_type;
828   If C_Sel1%notfound then
829     Close C_Sel1;
830     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
831     hr_utility.set_message_token('PROCEDURE', l_proc);
832     hr_utility.set_message_token('STEP','10');
833     hr_utility.raise_error;
834   End If;
835   Close C_Sel1;
836 --
837   If l_processing_type = 'N' or
838      l_entry_type <> 'E' then
839     p_zap			:= true;
840     p_delete			:= false;
841     p_future_change		:= false;
842     p_delete_next_change	:= false;
843   Else
844     --
845     -- Call the corresponding datetrack api
846     --
847     dt_api.find_dt_del_modes
848 	(p_effective_date	=> p_effective_date,
849 	 p_base_table_name	=> 'pay_element_entries_f',
850 	 p_base_key_column	=> 'element_entry_id',
851 	 p_base_key_value	=> p_base_key_value,
852 	 p_parent_table_name1	=> 'per_all_assignments_f',
853 	 p_parent_key_column1	=> 'assignment_id',
854 	 p_parent_key_value1	=> l_parent_key_value1,
855 	 p_parent_table_name2	=> 'pay_element_links_f',
856 	 p_parent_key_column2	=> 'element_link_id',
857 	 p_parent_key_value2	=> l_parent_key_value2,
858 	 p_zap			=> p_zap,
859 	 p_delete		=> p_delete,
860 	 p_future_change	=> p_future_change,
861 	 p_delete_next_change	=> p_delete_next_change);
862   End If;
863   --
864   hr_utility.set_location(' Leaving:'||l_proc, 10);
865 End find_dt_del_modes;
866 --
867 -- ----------------------------------------------------------------------------
868 -- |-------------------------------< ins_lck >--------------------------------|
869 -- ----------------------------------------------------------------------------
870 --
871 -- Optional procedure to use DTCSAPI.pll forms library. This procedure is
872 -- used to lock parent tables when inserting not to violate locking ladder.
873 --
874 Procedure ins_lck
875 	(p_effective_date	 in  date,
876 	 p_datetrack_mode	 in  varchar2,
877 	 p_rec	 		 in  pay_element_entries_f%ROWTYPE,
878 	 p_validation_start_date out nocopy date,
879 	 p_validation_end_date	 out nocopy date)
880 Is
881 --
882   l_proc		  varchar2(72) := g_package||'ins_lck';
883   l_validation_start_date date;
884   l_validation_end_date	  date;
885 --
886 Begin
887   hr_utility.set_location('Entering:'||l_proc, 5);
888   --
889   -- Validate the datetrack mode getting the validation start
890   -- and end dates for the specified datetrack operation.
891   --
892   dt_api.validate_dt_mode
893         (p_effective_date          => p_effective_date,
894          p_datetrack_mode          => p_datetrack_mode,
895          p_base_table_name         => 'pay_element_entries_f',
896          p_base_key_column         => 'element_entry_id',
897          p_base_key_value          => p_rec.element_entry_id,
898          p_parent_table_name1      => 'per_all_assignments_f',
899          p_parent_key_column1      => 'assignment_id',
900          p_parent_key_value1       => p_rec.assignment_id,
901          p_parent_table_name2      => 'pay_element_links_f',
902          p_parent_key_column2      => 'element_link_id',
903          p_parent_key_value2       => p_rec.element_link_id,
904          p_enforce_foreign_locking => true,
905          p_validation_start_date   => l_validation_start_date,
906          p_validation_end_date     => l_validation_end_date);
907   --
908   --
909   --
910   -- Set the validation start and end date OUT arguments
911   --
912   p_validation_start_date := l_validation_start_date;
913   p_validation_end_date   := l_validation_end_date;
914   --
915   hr_utility.set_location(' Leaving:'||l_proc, 15);
916 End ins_lck;
917 --
918 -- ----------------------------------------------------------------------------
919 -- |---------------------------------< lck >----------------------------------|
920 -- ----------------------------------------------------------------------------
921 --
922 -- Mandatory procedure to use DTCSAPI.pll forms library. This procedure is
923 -- used to lock parent and child tables when updating or deleting not to violate
924 -- locking ladder.
925 --
926 Procedure lck
927 	(p_effective_date	 in  date,
928 	 p_datetrack_mode	 in  varchar2,
929 	 p_element_entry_id	 in  number,
930 	 p_object_version_number in  number,
931 	 p_validation_start_date out nocopy date,
932 	 p_validation_end_date	 out nocopy date)
933 Is
934 --
935   l_proc		  varchar2(72) := g_package||'lck';
936   l_validation_start_date date;
937   l_validation_end_date	  date;
938   l_object_invalid 	  exception;
942   -- ensuring that the object version numbers match.
939   l_argument		  varchar2(30);
940   --
941   -- Cursor C_Sel1 selects the current locked row as of session date
943   --
944   Cursor C_Sel1 is
945     select  *
946     from    pay_element_entries_f
947     where   element_entry_id = p_element_entry_id
948     and	    p_effective_date  between effective_start_date
949                               and     effective_end_date
950     for update nowait;
951   --
952   -- The following code is not supported in this package.
953   --
954   -- Cursor C_Sel3 select comment text
955   --
956   -- Cursor C_Sel3 is
957   --   select hc.comment_text
958   --   from   hr_comments hc
959   --   where  hc.comment_id = g_old_rec.comment_id;
960   --
961 Begin
962   hr_utility.set_location('Entering:'||l_proc, 5);
963   --
964   -- Ensure that all the mandatory arguments are not null
965   --
966   hr_api.mandatory_arg_error(p_api_name       => l_proc,
967                              p_argument       => 'effective_date',
968                              p_argument_value => p_effective_date);
969   --
970   hr_api.mandatory_arg_error(p_api_name       => l_proc,
971                              p_argument       => 'datetrack_mode',
972                              p_argument_value => p_datetrack_mode);
973   --
974   hr_api.mandatory_arg_error(p_api_name       => l_proc,
975                              p_argument       => 'element_entry_id',
976                              p_argument_value => p_element_entry_id);
977   --
978   hr_api.mandatory_arg_error(p_api_name       => l_proc,
979                              p_argument       => 'object_version_number',
980                              p_argument_value => p_object_version_number);
981   --
982   -- Check to ensure the datetrack mode is not INSERT.
983   --
984   If (p_datetrack_mode <> 'INSERT') then
985     --
986     -- We must select and lock the current row.
987     --
988     Open  C_Sel1;
989     Fetch C_Sel1 Into g_old_rec;
990     If C_Sel1%notfound then
991       Close C_Sel1;
992       --
993       -- The primary key is invalid therefore we must error
994       --
995       hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
996       hr_utility.raise_error;
997       --
998     End If;
999     Close C_Sel1;
1000     --
1001     -- Check if the set object version number is the same as the existing
1002     -- object version number
1003     --
1004     If (p_object_version_number <> g_old_rec.object_version_number) Then
1005         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
1006         hr_utility.raise_error;
1007     End If;
1008     hr_utility.set_location(l_proc, 15);
1009     --
1010     -- Providing we are doing an update and a comment_id exists then
1011     -- we select the comment text.
1012     --
1013     -- The following code is not supported in this package.
1014     --
1015     -- If ((g_old_rec.comment_id is not null)             and
1016     --     (p_datetrack_mode = 'UPDATE'                   or
1017     --      p_datetrack_mode = 'CORRECTION'               or
1018     --      p_datetrack_mode = 'UPDATE_OVERRIDE'          or
1019     --      p_datetrack_mode = 'UPDATE_CHANGE_INSERT')) then
1020     --   Open C_Sel3;
1021     --   Fetch C_Sel3 Into g_old_rec.comment_text;
1022     --   If C_Sel3%notfound then
1023     --     --
1024     --     -- The comment_text for the specified comment_id does not exist.
1025     --     -- We must error due to data integrity problems.
1026     --     --
1027     --     Close C_Sel3;
1028     --     hr_utility.set_message(801, 'HR_7202_COMMENT_TEXT_NOT_EXIST');
1029     --     hr_utility.raise_error;
1030     --   End If;
1031     --   Close C_Sel3;
1032     -- End If;
1033     --
1034     -- Validate the datetrack mode mode getting the validation start
1035     -- and end dates for the specified datetrack operation.
1036     --
1037     hr_utility.set_location('Entering validation_dt_mode', 15);
1038     dt_api.validate_dt_mode
1039         (p_effective_date          => p_effective_date,
1040          p_datetrack_mode          => p_datetrack_mode,
1041          p_base_table_name         => 'pay_element_entries_f',
1042          p_base_key_column         => 'element_entry_id',
1043          p_base_key_value          => p_element_entry_id,
1044          p_parent_table_name1      => 'per_all_assignments_f',
1045          p_parent_key_column1      => 'assignment_id',
1046          p_parent_key_value1       => g_old_rec.assignment_id,
1047          p_parent_table_name2      => 'pay_element_links_f',
1048          p_parent_key_column2      => 'element_link_id',
1049          p_parent_key_value2       => g_old_rec.element_link_id,
1050          p_enforce_foreign_locking => true,
1051          p_validation_start_date   => l_validation_start_date,
1052          p_validation_end_date     => l_validation_end_date);
1053   Else
1054     --
1055     -- We are doing a datetrack 'INSERT' which is illegal within this
1056     -- procedure therefore we must error (note: to lck on insert the
1057     -- private procedure ins_lck should be called).
1058     --
1059     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1060     hr_utility.set_message_token('PROCEDURE', l_proc);
1061     hr_utility.set_message_token('STEP','20');
1062     hr_utility.raise_error;
1063     --
1064   End If;
1065   --
1066   -- Set the validation start and end date OUT arguments
1067   --
1068   p_validation_start_date := l_validation_start_date;
1069   p_validation_end_date   := l_validation_end_date;
1070   --
1071   hr_utility.set_location(' Leaving:'||l_proc, 30);
1072 --
1076   When HR_Api.Object_Locked then
1073 -- We need to trap the ORA LOCK exception
1074 --
1075 Exception
1077     --
1078     -- The object is locked therefore we need to supply a meaningful
1079     -- error message.
1080     --
1081     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
1082     hr_utility.set_message_token('TABLE_NAME', 'pay_element_entries_f');
1083     hr_utility.raise_error;
1084   When l_object_invalid then
1085     --
1086     -- The object doesn't exist or is invalid
1087     --
1088     hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
1089     hr_utility.set_message_token('TABLE_NAME', 'pay_element_entries_f');
1090     hr_utility.raise_error;
1091 End lck;
1092 --
1093 -- ----------------------------------------------------------------------------
1094 -- |---------------------------< init_varray >--------------------------------|
1095 -- ----------------------------------------------------------------------------
1096 --
1097 -- Currently not used because forms6 can not handle varray correctly.
1098 --
1099 Procedure init_varray(
1100 	p_ev_rec_tbl		in out nocopy ev_rec_tbl)
1101 Is
1102 	l_counter	number;
1103 Begin
1104 	--
1105 	-- Initialize if null.
1106 	--
1107 --	if p_ev_rec_tbl is NULL then
1108 --		p_ev_rec_tbl := ev_rec_tbl();
1109 --	end if;
1110 	--
1111 	-- Extend varray variable up to g_iv_max global variable.
1112 	--
1113 	l_counter := p_ev_rec_tbl.count;
1114 	for i in l_counter + 1..g_iv_max loop
1115 --		p_ev_rec_tbl.extend;
1116 		p_ev_rec_tbl(i).input_value_id := NULL;
1117 	end loop;
1118 End init_varray;
1119 --
1120 -- ----------------------------------------------------------------------------
1121 -- |-------------------------------< ins >------------------------------------|
1122 -- ----------------------------------------------------------------------------
1123 --
1124 -- Procedure which issues insert dml.
1125 --
1126 Procedure ins(
1127 	p_validate		in  boolean,
1128 	p_effective_date	in  date,
1129 	p_assignment_id		in  number,
1130 	p_element_link_id	in  number,
1131 	p_ev_rec_tbl		in  ev_rec_tbl,
1132 	p_attribute_tbl		in  attribute_tbl,
1133 	p_business_group_id	in  number,
1134 	p_element_entry_id out nocopy number,
1135 	p_effective_start_date out nocopy date,
1136 	p_effective_end_date out nocopy date,
1137 	p_object_version_number out nocopy number)
1138 Is
1139 	l_warning		BOOLEAN;
1140 	l_ev_rec_tbl		ev_rec_tbl := p_ev_rec_tbl;
1141 Begin
1142 	init_varray(l_ev_rec_tbl);
1143 	py_element_entry_api.create_element_entry(
1144 		P_VALIDATE			=> p_validate,
1145 		P_EFFECTIVE_DATE		=> p_effective_date,
1146 		P_BUSINESS_GROUP_ID		=> p_business_group_id,
1147 /*		P_ORIGINAL_ENTRY_ID		=> NULL,*/
1148 		P_ASSIGNMENT_ID			=> p_assignment_id,
1149 		P_ELEMENT_LINK_ID		=> p_element_link_id,
1150 		P_ENTRY_TYPE			=> 'E',
1151 /*		P_COST_ALLOCATION_KEYFLEX_ID	=> NULL,
1152 		P_UPDATING_ACTION_ID		=> NULL,
1153 		P_COMMENT_ID			=> NULL,
1154 		P_REASON			=> NULL,
1155 		P_TARGET_ENTRY_ID		=> NULL,
1156 		P_SUBPRIORITY			=> NULL,
1157 		P_DATE_EARNED			=> NULL,
1158 		P_PERSONAL_PAYMENT_METHOD_ID	=> NULL,*/
1159 		P_ATTRIBUTE_CATEGORY		=> p_attribute_tbl.attribute_category,
1160 		P_ATTRIBUTE1			=> p_attribute_tbl.attribute(1),
1161 		P_ATTRIBUTE2			=> p_attribute_tbl.attribute(2),
1162 		P_ATTRIBUTE3			=> p_attribute_tbl.attribute(3),
1163 		P_ATTRIBUTE4			=> p_attribute_tbl.attribute(4),
1164 		P_ATTRIBUTE5			=> p_attribute_tbl.attribute(5),
1165 		P_ATTRIBUTE6			=> p_attribute_tbl.attribute(6),
1166 		P_ATTRIBUTE7			=> p_attribute_tbl.attribute(7),
1167 		P_ATTRIBUTE8			=> p_attribute_tbl.attribute(8),
1168 		P_ATTRIBUTE9			=> p_attribute_tbl.attribute(9),
1169 		P_ATTRIBUTE10			=> p_attribute_tbl.attribute(10),
1170 		P_ATTRIBUTE11			=> p_attribute_tbl.attribute(11),
1171 		P_ATTRIBUTE12			=> p_attribute_tbl.attribute(12),
1172 		P_ATTRIBUTE13			=> p_attribute_tbl.attribute(13),
1173 		P_ATTRIBUTE14			=> p_attribute_tbl.attribute(14),
1174 		P_ATTRIBUTE15			=> p_attribute_tbl.attribute(15),
1175 		P_ATTRIBUTE16			=> p_attribute_tbl.attribute(16),
1176 		P_ATTRIBUTE17			=> p_attribute_tbl.attribute(17),
1177 		P_ATTRIBUTE18			=> p_attribute_tbl.attribute(18),
1178 		P_ATTRIBUTE19			=> p_attribute_tbl.attribute(19),
1179 		P_ATTRIBUTE20			=> p_attribute_tbl.attribute(20),
1180 		P_INPUT_VALUE_ID1		=> l_ev_rec_tbl(1).input_value_id,
1181 		P_INPUT_VALUE_ID2		=> l_ev_rec_tbl(2).input_value_id,
1182 		P_INPUT_VALUE_ID3		=> l_ev_rec_tbl(3).input_value_id,
1183 		P_INPUT_VALUE_ID4		=> l_ev_rec_tbl(4).input_value_id,
1184 		P_INPUT_VALUE_ID5		=> l_ev_rec_tbl(5).input_value_id,
1185 		P_INPUT_VALUE_ID6		=> l_ev_rec_tbl(6).input_value_id,
1186 		P_INPUT_VALUE_ID7		=> l_ev_rec_tbl(7).input_value_id,
1187 		P_INPUT_VALUE_ID8		=> l_ev_rec_tbl(8).input_value_id,
1188 		P_INPUT_VALUE_ID9		=> l_ev_rec_tbl(9).input_value_id,
1189 		P_INPUT_VALUE_ID10		=> l_ev_rec_tbl(10).input_value_id,
1190 		P_INPUT_VALUE_ID11		=> l_ev_rec_tbl(11).input_value_id,
1191 		P_INPUT_VALUE_ID12		=> l_ev_rec_tbl(12).input_value_id,
1192 		P_INPUT_VALUE_ID13		=> l_ev_rec_tbl(13).input_value_id,
1193 		P_INPUT_VALUE_ID14		=> l_ev_rec_tbl(14).input_value_id,
1194 		P_INPUT_VALUE_ID15		=> l_ev_rec_tbl(15).input_value_id,
1195 		P_ENTRY_VALUE1			=> l_ev_rec_tbl(1).entry_value,
1196 		P_ENTRY_VALUE2			=> l_ev_rec_tbl(2).entry_value,
1197 		P_ENTRY_VALUE3			=> l_ev_rec_tbl(3).entry_value,
1198 		P_ENTRY_VALUE4			=> l_ev_rec_tbl(4).entry_value,
1199 		P_ENTRY_VALUE5			=> l_ev_rec_tbl(5).entry_value,
1200 		P_ENTRY_VALUE6			=> l_ev_rec_tbl(6).entry_value,
1201 		P_ENTRY_VALUE7			=> l_ev_rec_tbl(7).entry_value,
1202 		P_ENTRY_VALUE8			=> l_ev_rec_tbl(8).entry_value,
1203 		P_ENTRY_VALUE9			=> l_ev_rec_tbl(9).entry_value,
1207 		P_ENTRY_VALUE13			=> l_ev_rec_tbl(13).entry_value,
1204 		P_ENTRY_VALUE10			=> l_ev_rec_tbl(10).entry_value,
1205 		P_ENTRY_VALUE11			=> l_ev_rec_tbl(11).entry_value,
1206 		P_ENTRY_VALUE12			=> l_ev_rec_tbl(12).entry_value,
1208 		P_ENTRY_VALUE14			=> l_ev_rec_tbl(14).entry_value,
1209 		P_ENTRY_VALUE15			=> l_ev_rec_tbl(15).entry_value,
1210 		P_EFFECTIVE_START_DATE		=> p_effective_start_date,
1211 		P_EFFECTIVE_END_DATE		=> p_effective_end_date,
1212 		P_ELEMENT_ENTRY_ID		=> p_element_entry_id,
1213 		P_OBJECT_VERSION_NUMBER		=> p_object_version_number,
1214 		P_CREATE_WARNING		=> l_warning);
1215 End ins;
1216 --
1217 -- ----------------------------------------------------------------------------
1218 -- |-------------------------------< upd >------------------------------------|
1219 -- ----------------------------------------------------------------------------
1220 --
1221 -- Procedure which issues update dml.
1222 --
1223 Procedure upd(
1224 	p_validate		in     boolean,
1225 	p_effective_date	in     date,
1226 	p_datetrack_update_mode	in     varchar2,
1227 	p_element_entry_id	in     number,
1228 	p_object_version_number	in out nocopy number,
1229 	p_ev_rec_tbl		in     ev_rec_tbl,
1230 	p_attribute_tbl		in     attribute_tbl,
1231 	p_business_group_id	in     number,
1232 	p_effective_start_date out nocopy    date,
1233 	p_effective_end_date out nocopy    date)
1234 Is
1235 	l_warning		BOOLEAN;
1236 	l_ev_rec_tbl		ev_rec_tbl := p_ev_rec_tbl;
1237 Begin
1238 	init_varray(l_ev_rec_tbl);
1239 	py_element_entry_api.update_element_entry(
1240 		P_VALIDATE			=> p_validate,
1241 		P_DATETRACK_UPDATE_MODE		=> p_datetrack_update_mode,
1242 		P_EFFECTIVE_DATE		=> p_effective_date,
1243 		P_BUSINESS_GROUP_ID		=> p_business_group_id,
1244 		P_ELEMENT_ENTRY_ID		=> p_element_entry_id,
1245 		P_OBJECT_VERSION_NUMBER		=> p_object_version_number,
1246 		P_ATTRIBUTE_CATEGORY		=> p_attribute_tbl.attribute_category,
1247 		P_ATTRIBUTE1			=> p_attribute_tbl.attribute(1),
1248 		P_ATTRIBUTE2			=> p_attribute_tbl.attribute(2),
1249 		P_ATTRIBUTE3			=> p_attribute_tbl.attribute(3),
1250 		P_ATTRIBUTE4			=> p_attribute_tbl.attribute(4),
1251 		P_ATTRIBUTE5			=> p_attribute_tbl.attribute(5),
1252 		P_ATTRIBUTE6			=> p_attribute_tbl.attribute(6),
1253 		P_ATTRIBUTE7			=> p_attribute_tbl.attribute(7),
1254 		P_ATTRIBUTE8			=> p_attribute_tbl.attribute(8),
1255 		P_ATTRIBUTE9			=> p_attribute_tbl.attribute(9),
1256 		P_ATTRIBUTE10			=> p_attribute_tbl.attribute(10),
1257 		P_ATTRIBUTE11			=> p_attribute_tbl.attribute(11),
1258 		P_ATTRIBUTE12			=> p_attribute_tbl.attribute(12),
1259 		P_ATTRIBUTE13			=> p_attribute_tbl.attribute(13),
1260 		P_ATTRIBUTE14			=> p_attribute_tbl.attribute(14),
1261 		P_ATTRIBUTE15			=> p_attribute_tbl.attribute(15),
1262 		P_ATTRIBUTE16			=> p_attribute_tbl.attribute(16),
1263 		P_ATTRIBUTE17			=> p_attribute_tbl.attribute(17),
1264 		P_ATTRIBUTE18			=> p_attribute_tbl.attribute(18),
1265 		P_ATTRIBUTE19			=> p_attribute_tbl.attribute(19),
1266 		P_ATTRIBUTE20			=> p_attribute_tbl.attribute(20),
1267 		P_INPUT_VALUE_ID1		=> l_ev_rec_tbl(1).input_value_id,
1268 		P_INPUT_VALUE_ID2		=> l_ev_rec_tbl(2).input_value_id,
1269 		P_INPUT_VALUE_ID3		=> l_ev_rec_tbl(3).input_value_id,
1270 		P_INPUT_VALUE_ID4		=> l_ev_rec_tbl(4).input_value_id,
1271 		P_INPUT_VALUE_ID5		=> l_ev_rec_tbl(5).input_value_id,
1272 		P_INPUT_VALUE_ID6		=> l_ev_rec_tbl(6).input_value_id,
1273 		P_INPUT_VALUE_ID7		=> l_ev_rec_tbl(7).input_value_id,
1274 		P_INPUT_VALUE_ID8		=> l_ev_rec_tbl(8).input_value_id,
1275 		P_INPUT_VALUE_ID9		=> l_ev_rec_tbl(9).input_value_id,
1276 		P_INPUT_VALUE_ID10		=> l_ev_rec_tbl(10).input_value_id,
1277 		P_INPUT_VALUE_ID11		=> l_ev_rec_tbl(11).input_value_id,
1278 		P_INPUT_VALUE_ID12		=> l_ev_rec_tbl(12).input_value_id,
1279 		P_INPUT_VALUE_ID13		=> l_ev_rec_tbl(13).input_value_id,
1280 		P_INPUT_VALUE_ID14		=> l_ev_rec_tbl(14).input_value_id,
1281 		P_INPUT_VALUE_ID15		=> l_ev_rec_tbl(15).input_value_id,
1282 		P_ENTRY_VALUE1			=> l_ev_rec_tbl(1).entry_value,
1283 		P_ENTRY_VALUE2			=> l_ev_rec_tbl(2).entry_value,
1284 		P_ENTRY_VALUE3			=> l_ev_rec_tbl(3).entry_value,
1285 		P_ENTRY_VALUE4			=> l_ev_rec_tbl(4).entry_value,
1286 		P_ENTRY_VALUE5			=> l_ev_rec_tbl(5).entry_value,
1287 		P_ENTRY_VALUE6			=> l_ev_rec_tbl(6).entry_value,
1288 		P_ENTRY_VALUE7			=> l_ev_rec_tbl(7).entry_value,
1289 		P_ENTRY_VALUE8			=> l_ev_rec_tbl(8).entry_value,
1290 		P_ENTRY_VALUE9			=> l_ev_rec_tbl(9).entry_value,
1291 		P_ENTRY_VALUE10			=> l_ev_rec_tbl(10).entry_value,
1292 		P_ENTRY_VALUE11			=> l_ev_rec_tbl(11).entry_value,
1293 		P_ENTRY_VALUE12			=> l_ev_rec_tbl(12).entry_value,
1294 		P_ENTRY_VALUE13			=> l_ev_rec_tbl(13).entry_value,
1295 		P_ENTRY_VALUE14			=> l_ev_rec_tbl(14).entry_value,
1296 		P_ENTRY_VALUE15			=> l_ev_rec_tbl(15).entry_value,
1297 		P_EFFECTIVE_START_DATE		=> p_effective_start_date,
1298 		P_EFFECTIVE_END_DATE		=> p_effective_end_date,
1299 		P_UPDATE_WARNING		=> l_warning);
1300 End upd;
1301 --
1302 -- ----------------------------------------------------------------------------
1303 -- |-------------------------------< del >------------------------------------|
1304 -- ----------------------------------------------------------------------------
1305 --
1306 -- Procedure which issues delete dml.
1307 --
1308 Procedure del(
1309 	p_validate		in     boolean,
1310 	p_effective_date	in     date,
1311 	p_datetrack_delete_mode	in     varchar2,
1312 	p_element_entry_id	in     number,
1313 	p_object_version_number	in out nocopy number,
1314 	p_effective_start_date out nocopy    date,
1315 	p_effective_end_date out nocopy    date)
1316 Is
1317 	l_warning		BOOLEAN;
1318 Begin
1319 	py_element_entry_api.delete_element_entry(
1320 		P_VALIDATE			=> p_validate,
1321 		P_DATETRACK_DELETE_MODE		=> p_datetrack_delete_mode,
1322 		P_EFFECTIVE_DATE		=> p_effective_date,
1323 		P_ELEMENT_ENTRY_ID		=> p_element_entry_id,
1324 		P_OBJECT_VERSION_NUMBER		=> p_object_version_number,
1325 		P_EFFECTIVE_START_DATE		=> p_effective_start_date,
1326 		P_EFFECTIVE_END_DATE		=> p_effective_end_date,
1327 		P_DELETE_WARNING		=> l_warning);
1328 End del;
1329 --
1330 End pay_jp_entries_pkg;