DBA Data[Home] [Help]

PACKAGE BODY: APPS.PY_SE_TAX_CARD

Source


1 PACKAGE BODY PY_SE_TAX_CARD AS
2 /* $Header: pysetaxc.pkb 120.0.12000000.1 2007/04/24 06:32:07 rsahai noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  CONSTANT varchar2(33) := '  hr_se_taxcard_api.';
7 g_debug BOOLEAN := hr_utility.debug_enabled;
8 --
9 -- ----------------------------------------------------------------------------
10 -- |--------------------------< create_taxcard >----------------------------|
11 -- ----------------------------------------------------------------------------
12 -- {Start Of Comments}
13 --
14 -- Description:
15 --	This API will insert a tax card entry for a swedish Assignment.
16 --	This API delegates to the create_element_entry procedure of the
17 --	pay_element_entry_api package.
18 --
19 -- Prerequisites:
20 --	The element entry (of element type 'Tax Card') and the corresponding
21 --	element link should exist for the given assignment and business group.
22 --
23 -- In Parameters:
24 --	Name			Reqd	Type	 Description
25 --	p_legislation_code	Yes 	VARCHAR2 Legislation code.
26 --	p_effective_date	Yes 	DATE	 The effective date of the
27 --						 change.
28 --	p_assignment_id		Yes 	VARCHAR2 Id of the assignment.
29 --	p_person_id		Yes 	VARCHAR2 Id of the person.
30 --	p_business_group_id	Yes 	VARCHAR2 Id of the business group.
31 --	p_tax_percentage		NUMBER   Element entry value
32 --	p_tax_free_threshold		NUMBER   Element entry value
33 --	p_calculation_sum		NUMBER	 Element entry value
34 --	p_method_of_receipt	Yes	VARCHAR2 Element entry value
35 --	p_tax_column			VARCHAR2 Element entry value
36 --	p_tax_card_type		yes	VARCHAR2 Element entry value
37 --	p_tax_table_number		VARCHAR2 Element entry value
38 --	p_calculation_code    	        VARCHAR2 Element entry value.
39 --	p_element_entry_id	 	VARCHAR2 Id of the element entry.
40 --	p_element_link_id		VARCHAR2 Id of the element link.
41 --
42 -- Post Success:
43 --
44 --	The API successfully updates the tax card entry.
45 --
46 -- Post Failure:
47 --   The API will raise an error.
48 --
49 -- Access Status:
50 --   Private. For Internal Development Use only.
51 --
52 -- {End Of Comments}
53 --
54   PROCEDURE insert_taxcard (
55    	p_legislation_code		IN 	VARCHAR2
56 	,p_effective_date		IN	DATE
57 	,p_assignment_id		IN	VARCHAR2
58 	,p_person_id			IN	VARCHAR2
59 	,p_business_group_id	IN	VARCHAR2
60 	,p_tax_percentage		IN	NUMBER   	DEFAULT NULL
61 	,p_tax_free_threshold	IN	NUMBER		DEFAULT NULL
62 	,p_calculation_sum		IN	NUMBER		DEFAULT NULL
63 	,p_method_of_receipt	IN	VARCHAR2	DEFAULT NULL
64 	,p_tax_column			IN	VARCHAR2	DEFAULT NULL
65 	,p_tax_card_type		IN	VARCHAR2	DEFAULT NULL
66 	,p_tax_table_number		IN	VARCHAR2	DEFAULT NULL
67 	,p_calculation_code		IN	VARCHAR2	DEFAULT NULL
68 	) IS
69 	-- Declarations here
70 	l_start_date		DATE;
71 	l_end_date		DATE;
72 	l_warning		BOOLEAN;
73 	l_element_entry_id	NUMBER(15);
74 	l_tax_percentage		pay_element_entry_values_f.screen_entry_value%TYPE;
75     l_tax_free_threshold 	pay_element_entry_values_f.screen_entry_value%TYPE;
76     l_calculation_sum 		pay_element_entry_values_f.screen_entry_value%TYPE;
77     l_tax_column 			pay_element_entry_values_f.screen_entry_value%TYPE;
78     l_tax_table_number      pay_element_entry_values_f.screen_entry_value%TYPE;
79     l_calculation_code      pay_element_entry_values_f.screen_entry_value%TYPE;
80     l_method_of_receipt     pay_element_entry_values_f.screen_entry_value%TYPE;
81 	l_ovn			NUMBER(9);
82 	l_element_link_id	pay_element_links_f.element_link_id%TYPE;
83 	l_element_type_id	pay_element_types_f.element_type_id%TYPE;
84 	l_input_value_id1	pay_input_values_f.input_value_id%TYPE;
85 	l_input_value_id2	pay_input_values_f.input_value_id%TYPE;
86 	l_input_value_id3	pay_input_values_f.input_value_id%TYPE;
87 	l_input_value_id4	pay_input_values_f.input_value_id%TYPE;
88 	l_input_value_id5	pay_input_values_f.input_value_id%TYPE;
89 	l_input_value_id6	pay_input_values_f.input_value_id%TYPE;
90 	l_input_value_id7	pay_input_values_f.input_value_id%TYPE;
91 	l_input_value_id8	pay_input_values_f.input_value_id%TYPE;
92 
93 	l_var varchar2(200);
94 
95 
96 	CURSOR input_values_csr IS
97 		SELECT
98 		et.element_type_id,
99 		MIN(DECODE(iv.name, 'Tax Percentage', iv.input_value_id, null)) iv1,
100 		MIN(DECODE(iv.name, 'Tax Free Threshold', iv.input_value_id, null)) iv2,
101 		MIN(DECODE(iv.name, 'Calculation Sum', iv.input_value_id, null)) iv3,
102 		MIN(DECODE(iv.name, 'Method of Receipt', iv.input_value_id, null)) iv4,
103 		MIN(DECODE(iv.name, 'Tax Column', iv.input_value_id, null)) iv5,
104 		MIN(DECODE(iv.name, 'Tax Card Type', iv.input_value_id, null)) iv6,
105 		MIN(DECODE(iv.name, 'Tax Table Number', iv.input_value_id, null)) iv7,
106 		MIN(DECODE(iv.name, 'Calculation Code', iv.input_value_id, null)) iv8
107 		FROM
108 		pay_element_types_f et,
109 		pay_input_values_f iv
110 		WHERE et.element_name = 'Tax Card'
111 		AND et.legislation_code = 'SE'
112 		AND et.business_group_id is null
113 		AND fnd_date.canonical_to_date(p_effective_date) BETWEEN
114 			et.effective_start_date AND et.effective_end_date
115 		AND iv.element_type_id = et.element_type_id
116 		AND fnd_date.canonical_to_date(p_effective_date)
117 			BETWEEN iv.effective_start_date AND iv.effective_end_date
118 		GROUP BY
119 			et.element_type_id;
120 
121 	l_proc    varchar2(72) := g_package||'insert_taxcard';
122 
123 	CURSOR CSR_CHECK_FND_SESSION
124 		is
125 	select session_id
126 	from fnd_sessions
127 	where session_id = userenv('sessionid')
128 	and effective_date = p_effective_date;
129 
130 	LR_CHECK_FND_SESSION CSR_CHECK_FND_SESSION%ROWTYPE;
131 
132 	BEGIN
133 --		if g_debug then
134 			hr_utility.set_location('Entering:'|| l_proc, 1);
135 --		end if;
136 		--Insert row into fnd_Sessions table.
137 		OPEN  CSR_CHECK_FND_SESSION;
138 	        FETCH CSR_CHECK_FND_SESSION INTO LR_CHECK_FND_SESSION;
139        		IF CSR_CHECK_FND_SESSION%notfound
140         	    THEN
141               INSERT INTO fnd_sessions(session_id, effective_date) VALUES(userenv('sessionid'), p_effective_date);
142         	    END IF;
143     		CLOSE CSR_CHECK_FND_SESSION;
144 
145 			hr_utility.set_location( l_proc, 10);
146 		-- fetch element link id from Swedish tax upload package
147 		l_element_link_id := pay_se_tax_card.get_element_link_id(
148 						p_assignment_id, p_business_group_id,
149 						fnd_date.date_to_canonical(p_effective_date),
150 						'Tax Card');
151 --		if g_debug then
152 			hr_utility.set_location('Entering:'|| l_proc, 2);
153 --		end if;
154 		-- fetch all input value id's
155 		OPEN input_values_csr;
156 		FETCH input_values_csr INTO l_element_type_id, l_input_value_id1, l_input_value_id2,
157 			l_input_value_id3, l_input_value_id4, l_input_value_id5, l_input_value_id6,
158 			l_input_value_id7, l_input_value_id8;
159 		CLOSE input_values_csr;
160 			hr_utility.set_location(l_proc, 3);
161 
162 --		if g_debug then
163 			hr_utility.set_location( l_proc, 4);
164 --		end if;
165 		--all validations for swedish tax card are included here
166 	    --1. Method of Receipt: This will be always Manual
167         --2. Tax Card Type:
168         -- 'A Tax Card' - All fields will be enabled - Tax Table Number, Tax Column OR Tax Percentage, either one combination to be (M)
169         --'A  F Tax Card' - All fields will be enabled - Tax Table Number, Tax Column  OR Tax Percentage, either one combination to be (M)
170         --'F Tax Card' - All fields will be disabled.
171         --'No Tax Card' - 'Tax Percentage', 'Tax Table Number' will be enabled.
172         --'Tax at Source' - 'Tax Percentage', 'Tax Table Number' will be enabled.
173         -- 'Tax Free With Threshold' - 'Tax Percentage', 'Tax Table Number', 'Tax Free Threshold'(M) will be enabled.
174         -- 3. Tax Percentage: Min  Max values - 0 to 100
175 
176 		--If taxcard type is "NTC" or "TF" , then the tax percentage need not be stored.
177     l_tax_percentage		:=p_tax_percentage;
178     l_tax_free_threshold 	:=p_tax_free_threshold;
179     l_calculation_sum 		:=p_calculation_sum;
180     l_tax_column 			:=p_tax_column;
181     l_tax_table_number      :=p_tax_table_number;
182     l_calculation_code      :=p_calculation_code;
183     l_method_of_receipt     :='M';
184 			hr_utility.set_location(l_proc, 5);
185 		IF  (p_tax_card_type = 'A') THEN
186               IF (p_tax_table_number is null and p_tax_column is null and p_tax_percentage is null) THEN
187 		                 fnd_message.set_name('PER','HR_377232_SE_ATAXC_MAN_FIELDS');
188                          hr_utility.raise_error;
189 	           ELSIF (p_tax_percentage is null AND (p_tax_table_number is null OR p_tax_column is null)) THEN
190      	                 fnd_message.set_name('PER','HR_377232_SE_ATAXC_MAN_FIELDS');
191                          hr_utility.raise_error;
192   			hr_utility.set_location(l_proc, 6);
193                END IF;
194          ELSIF(p_tax_card_type = 'AF') THEN
195                IF (p_tax_table_number is null and p_tax_column is null and p_tax_percentage is null) THEN
196 		                 fnd_message.set_name('PER','HR_377232_SE_ATAXC_MAN_FIELDS');
197                          hr_utility.raise_error;
198 			hr_utility.set_location(l_proc, 7);
199 	           ELSIF (p_tax_percentage is null AND (p_tax_table_number is null OR p_tax_column is null)) THEN
200                      fnd_message.set_name('PER','HR_377232_SE_ATAXC_MAN_FIELDS');
201                      hr_utility.raise_error;
202 			hr_utility.set_location(l_proc, 8);
203                END IF;
204          ElSIF (p_tax_card_type = 'TFT') THEN
205              IF (p_tax_free_threshold is NULL) THEN
206                    fnd_message.set_name('PER','HR_377233_SE_TFT_PERCENTAGE');
207                    hr_utility.raise_error;
208 
209              ELSE
210 		       l_calculation_sum :=null;
211 		       l_tax_column := null;
212 		       l_calculation_code :=null;
213 
214              END IF;
215 
216          ElSIF (p_tax_card_type = 'F') THEN
217                 l_tax_percentage	:=null;
218 		        l_tax_free_threshold :=null;
219 		        l_calculation_sum :=null;
220 		        l_tax_column := null;
221 		        l_tax_table_number :=null;
222 		        l_calculation_code :=null;
223 
224          ElSIF (p_tax_card_type = 'TS') THEN
225 		        l_tax_free_threshold :=null;
226 		        l_calculation_sum :=null;
227 		        l_tax_column := null;
228 		        l_calculation_code :=null;
229 
230          ElSIF (p_tax_card_type = 'NTC') THEN
231 		        l_tax_free_threshold :=null;
232 		        l_calculation_sum :=null;
233 		        l_tax_column := null;
234                 l_calculation_code :=null;
235 
236          END IF;
237 
238 
239 
240 
241 		/*IF  p_tax_card_type = 'NTC'  THEN
242 			l_tax_percentage := null;
243 		ELSE
244 			l_tax_percentage := p_tax_percentage;
245 		END IF;*/
246 
247 		if g_debug then
248 			hr_utility.set_location('Entering:'|| l_proc, 4);
249 		end if;
250 		-- insert records into pay_element_entries_f and pay_element_entry_values_f
251 		pay_element_entry_api.create_element_entry
252 		(p_effective_date		=> p_effective_date
253 		,p_business_group_id	=> p_business_group_id
254 		,p_assignment_id		=> p_assignment_id
255 		,p_element_link_id		=> l_element_link_id
256 		,p_entry_type 			=> 'E'
257 		,p_input_value_id1		=> l_input_value_id1
258 		,p_input_value_id2		=> l_input_value_id2
259 		,p_input_value_id3		=> l_input_value_id3
260 		,p_input_value_id4		=> l_input_value_id4
261 		,p_input_value_id5		=> l_input_value_id5
262 		,p_input_value_id6		=> l_input_value_id6
263 		,p_input_value_id7		=> l_input_value_id7
264 		,p_input_value_id8		=> l_input_value_id8
265 		,p_entry_value1 		=> l_tax_percentage
266 		,p_entry_value2     	=> l_tax_free_threshold
267 		,p_entry_value3		    => l_calculation_sum
268 		,p_entry_value4	        => l_method_of_receipt
269 		,p_entry_value5			=> l_tax_column
270 		,p_entry_value6		    => p_tax_card_type
271 		,p_entry_value7	    	=> l_tax_table_number
272 		,p_entry_value8 		=> l_calculation_code
273 		,p_effective_start_date	=> l_start_date
274 		,p_effective_end_date	=> l_end_date
275 		,p_element_entry_id		=> l_element_entry_id
276 		,p_object_version_number => l_ovn
277 		,p_create_warning		=> l_warning
278 		);
279 
280 		if g_debug then
281 			hr_utility.set_location('Entering:'|| l_proc, 5);
282 		end if;
283 		 -- Do not COMMIT here. COMMIT should be done thru the OAF Application only.
284 	EXCEPTION
285 	WHEN OTHERS THEN
286 		RAISE;
287 	END insert_taxcard;
288 --
289 -- ----------------------------------------------------------------------------
290 -- |--------------------------< update_taxcard >----------------------------|
291 -- ----------------------------------------------------------------------------
292 -- {Start Of Comments}
293 --
294 -- Description:
295 --	This API will update the tax card entry for a swedish Assignment.
296 --	This API delegates to the update_element_entry procedure of the
297 --	pay_element_entry_api package.
298 --
299 -- Prerequisites:
300 --	The element entry (of element type 'Tax Card') and the corresponding
301 --	element link should exist for the given assignment and business group.
302 --
303 -- In Parameters:
304 --	Name			Reqd	Type	 Description
305 --	p_legislation_code	Yes 	VARCHAR2 Legislation code.
306 --	p_effective_date	Yes 	DATE	 The effective date of the
307 --						 change.
308 --	p_assignment_id		Yes 	VARCHAR2 Id of the assignment.
309 --	p_person_id		Yes 	VARCHAR2 Id of the person.
310 --	p_business_group_id	Yes 	VARCHAR2 Id of the business group.
311 --	p_tax_percentage		NUMBER   Element entry value
312 --	p_tax_free_threshold		NUMBER   Element entry value
313 --	p_calculation_sum		NUMBER	 Element entry value
314 --	p_method_of_receipt	Yes	VARCHAR2 Element entry value
315 --	p_tax_column			VARCHAR2 Element entry value
316 --	p_tax_card_type		yes	VARCHAR2 Element entry value
317 --	p_tax_table_number		VARCHAR2 Element entry value
318 --	p_calculation_code    	        VARCHAR2 Element entry value.
319 --	p_element_entry_id	 	VARCHAR2 Id of the element entry.
320 --	p_element_link_id		VARCHAR2 Id of the element link.
321 --	p_object_version_number	Yes 	VARCHAR2 Version number of the element
322 --						 entry record.
323 --	p_input_value_id1		VARCHAR2 Id of the input value 1 for the
324 --						 element.
325 --	p_input_value_id2		VARCHAR2 Id of the input value 2 for the
326 --						 element.
327 --	p_input_value_id3		VARCHAR2 Id of the input value 3 for the
328 --						 element.
329 --	p_input_value_id4		VARCHAR2 Id of the input value 4 for the
330 --						 element.
331 --	p_input_value_id5		VARCHAR2 Id of the input value 5 for the
332 --						 element.
333 --	p_input_value_id6		VARCHAR2 Id of the input value 6 for the
334 --						 element.
335 --	p_input_value_id7		VARCHAR2 Id of the input value 7 for the
336 --						 element.
337 --	p_input_value_id8		VARCHAR2 Id of the input value 8 for the
338 --						 element.
339 --	p_datetrack_update_mode		VARCHAR2 The date track update mode for
340 --						 the record
341 --
342 --
343 -- Post Success:
344 --
345 --	The API successfully updates the tax card entry.
346 --
347 -- Post Failure:
348 --   The API will raise an error.
349 --
350 -- Access Status:
351 --   Private. For Internal Development Use only.
352 --
353 -- {End Of Comments}
354 --
355   PROCEDURE update_taxcard (
356 	p_legislation_code		IN	VARCHAR2
357 	,p_effective_date		IN	DATE
358 	,p_assignment_id		IN	VARCHAR2
359 	,p_person_id			IN	VARCHAR2
360 	,p_business_group_id	IN	VARCHAR2
361 	,p_tax_percentage		IN	NUMBER   	DEFAULT NULL
362 	,p_tax_free_threshold	IN	NUMBER		DEFAULT NULL
363 	,p_calculation_sum		IN	NUMBER		DEFAULT NULL
364 	,p_method_of_receipt	IN	VARCHAR2	DEFAULT NULL
365 	,p_tax_column			IN	VARCHAR2	DEFAULT NULL
366 	,p_tax_card_type		IN	VARCHAR2	DEFAULT NULL
367 	,p_tax_table_number		IN	VARCHAR2	DEFAULT NULL
368 	,p_calculation_code		IN	VARCHAR2	DEFAULT NULL
369 	,p_element_entry_id		IN	VARCHAR2
370 	,p_element_link_id		IN	VARCHAR2
371 	,p_object_version_number	IN	VARCHAR2
372 	,p_input_value_id1		IN	VARCHAR2	DEFAULT NULL
373 	,p_input_value_id2		IN	VARCHAR2	DEFAULT NULL
374 	,p_input_value_id3		IN	VARCHAR2	DEFAULT NULL
375 	,p_input_value_id4		IN	VARCHAR2	DEFAULT NULL
376 	,p_input_value_id5		IN	VARCHAR2	DEFAULT NULL
377 	,p_input_value_id6		IN	VARCHAR2	DEFAULT NULL
378 	,p_input_value_id7		IN	VARCHAR2	DEFAULT NULL
379 	,p_input_value_id8		IN	VARCHAR2	DEFAULT NULL
380 	,p_datetrack_update_mode	IN	VARCHAR2	DEFAULT NULL
381 	) IS
382 
383 	l_start_date		DATE;
384 	l_end_date		    DATE;
385 	l_warning		    BOOLEAN;
386 	l_element_entry_id	NUMBER(15);
387 	l_ovn			    NUMBER(9);
388 
389 	l_tax_percentage		pay_element_entry_values_f.screen_entry_value%TYPE;
390     l_tax_free_threshold 	pay_element_entry_values_f.screen_entry_value%TYPE;
391     l_calculation_sum 		pay_element_entry_values_f.screen_entry_value%TYPE;
392     l_tax_column 			pay_element_entry_values_f.screen_entry_value%TYPE;
393     l_tax_table_number      pay_element_entry_values_f.screen_entry_value%TYPE;
394     l_calculation_code      pay_element_entry_values_f.screen_entry_value%TYPE;
395     l_method_of_receipt     pay_element_entry_values_f.screen_entry_value%TYPE;
396 
397 	l_proc    varchar2(72) := g_package||'update_taxcard';
398 	BEGIN
399 	if g_debug then
400 		hr_utility.set_location('Entering:'|| l_proc, 1);
401 	end if;
402 
403 	--l_start_date := sysdate;
404 	l_element_entry_id :=  to_number(p_element_entry_id);
405 	l_ovn := to_number(p_object_version_number);
406 
407 	 --1. Method of Receipt: This will be always Manual
408         --2. Tax Card Type:
409         -- 'A Tax Card' - All fields will be enabled - Tax Table Number, Tax Column OR Tax Percentage, either one combination to be (M)
410         --'A  F Tax Card' - All fields will be enabled - Tax Table Number, Tax Column  OR Tax Percentage, either one combination to be (M)
411         --'F Tax Card' - All fields will be disabled.
412         --'No Tax Card' - 'Tax Percentage', 'Tax Table Number' will be enabled.
413         --'Tax at Source' - 'Tax Percentage', 'Tax Table Number' will be enabled.
414         -- 'Tax Free With Threshold' - 'Tax Percentage', 'Tax Table Number', 'Tax Free Threshold'(M) will be enabled.
415         -- 3. Tax Percentage: Min  Max values - 0 to 100
416 
417 		--If taxcard type is "NTC"  then the tax percentage need not be stored.
418     l_tax_percentage		:= p_tax_percentage;
419     l_tax_free_threshold 	:= p_tax_free_threshold;
420     l_calculation_sum 		:= p_calculation_sum;
421     l_tax_column 			:= p_tax_column;
422     l_tax_table_number      := p_tax_table_number;
423     l_calculation_code      := p_calculation_code;
424     l_method_of_receipt     :='M';
425 
426 
427 		IF  (p_tax_card_type = 'A') THEN
428               IF (p_tax_table_number is null and p_tax_column is null and p_tax_percentage is null) THEN
429 		                 fnd_message.set_name('PER','HR_377232_SE_ATAXC_MAN_FIELDS');
430                          hr_utility.raise_error;
431 	           ELSIF (p_tax_percentage = null AND (p_tax_table_number = null OR p_tax_column = null)) THEN
432      	                 fnd_message.set_name('PER','HR_377232_SE_ATAXC_MAN_FIELDS');
433                          hr_utility.raise_error;
434                END IF;
435          ELSIF(p_tax_card_type = 'AF') THEN
436                IF (p_tax_table_number is null and p_tax_column is null and p_tax_percentage is null) THEN
437                          fnd_message.set_name('PER','HR_377232_SE_ATAXC_MAN_FIELDS');
438                          hr_utility.raise_error;
439 	           ELSIF (p_tax_percentage is null AND (p_tax_table_number is null OR p_tax_column is null)) THEN
440                      fnd_message.set_name('PER','HR_377232_SE_ATAXC_MAN_FIELDS');
441                      hr_utility.raise_error;
442                END IF;
443          ElSIF (p_tax_card_type = 'TFT') THEN
444              IF (p_tax_free_threshold is NULL) THEN
445                    fnd_message.set_name('PER','HR_377233_SE_TFT_PERCENTAGE');
446                    hr_utility.raise_error;
447 
448              ELSE
449 		       l_calculation_sum :=null;
450 		       l_tax_column := null;
451 		       l_calculation_code :=null;
452 
453              END IF;
454 
455          ElSIF (p_tax_card_type = 'F') THEN
456                 l_tax_percentage	:=null;
457 		        l_tax_free_threshold :=null;
458 		        l_calculation_sum :=null;
459 		        l_tax_column := null;
460 		        l_tax_table_number :=null;
461 		        l_calculation_code :=null;
462 
463          ElSIF (p_tax_card_type = 'TS') THEN
464 		        l_tax_free_threshold :=null;
465 		        l_calculation_sum :=null;
466 		        l_tax_column := null;
467 		        l_calculation_code :=null;
468 
469          ElSIF (p_tax_card_type = 'NTC') THEN
470 		        l_tax_free_threshold :=null;
471 		        l_calculation_sum :=null;
472 		        l_tax_column := null;
473                 l_calculation_code :=null;
474 
475          END IF;
476 
477 
478 
479 
480 	/*--If taxcard type is "NTC" or "TF" , then the tax percentage need not be stored.
481 	IF  p_tax_card_type = 'NTC'  OR p_tax_card_type = 'TFT' THEN
482 			l_tax_percentage := null;
483 		ELSE
484 			l_tax_percentage := p_tax_percentage;
485 		END IF; */
486 
487 	if g_debug then
488 		hr_utility.set_location('Entering:'|| l_proc, 2);
489 	end if;
490 
491 	-- insert records into pay_element_entries_f and pay_element_entry_values_f
492 
493 	pay_element_entry_api.update_element_entry
494 	     (p_validate			=>  FALSE
495 	     ,p_object_version_number		=>  l_ovn
496 	     ,p_update_warning			=>  l_warning
497 	     ,p_datetrack_update_mode		=>  p_datetrack_update_mode
498 	     ,p_effective_date			=>  p_effective_date
499 	     ,p_business_group_id		=> p_business_group_id
500 	     ,p_input_value_id1			=> p_input_value_id1
501 	     ,p_input_value_id2			=> p_input_value_id2
502 	     ,p_input_value_id3			=> p_input_value_id3
503 	     ,p_input_value_id4			=> p_input_value_id4
504 	     ,p_input_value_id5			=> p_input_value_id5
505 	     ,p_input_value_id6			=> p_input_value_id6
506 	     ,p_input_value_id7			=> p_input_value_id7
507 	     ,p_input_value_id8			=> p_input_value_id8
508 	     ,p_entry_value1		    => l_tax_percentage
509 	     ,p_entry_value2   		    => l_tax_free_threshold
510 	     ,p_entry_value3		    => l_calculation_sum
511 	     ,p_entry_value4		    => l_method_of_receipt
512 	     ,p_entry_value5			=> l_tax_column
513 	     ,p_entry_value6		    => p_tax_card_type
514          ,p_entry_value7		    => l_tax_table_number
515 	     ,p_entry_value8	  	    => l_calculation_code
516 	     ,p_effective_start_date	=> l_start_date
517 	     ,p_effective_end_date		=> l_end_date
518 	     ,p_element_entry_id		=> l_element_entry_id
519 	     ,p_cost_allocation_keyflex_id	=> hr_api.g_number
520 	     ,p_updating_action_id		=> hr_api.g_number
521 	     ,p_original_entry_id		=> hr_api.g_number
522 	     ,p_creator_type			=> hr_api.g_varchar2
523 	     ,p_comment_id			=> hr_api.g_number
524 	     ,p_creator_id			=> hr_api.g_number
525 	     ,p_reason				=> hr_api.g_varchar2
526 	     ,p_subpriority			=> hr_api.g_number
527 	     ,p_date_earned			=> hr_api.g_date
528 	     ,p_personal_payment_method_id	=> hr_api.g_number
529 	     ,p_attribute_category		=> hr_api.g_varchar2
530 	     ,p_attribute1			=> hr_api.g_varchar2
531 	     ,p_attribute2			=> hr_api.g_varchar2
532 	     ,p_attribute3			=> hr_api.g_varchar2
533 	     ,p_attribute4			=> hr_api.g_varchar2
534 	     ,p_attribute5			=> hr_api.g_varchar2
535 	     ,p_attribute6			=> hr_api.g_varchar2
536 	     ,p_attribute7			=> hr_api.g_varchar2
537 	     ,p_attribute8			=> hr_api.g_varchar2
538 	     ,p_attribute9			=> hr_api.g_varchar2
539 	     ,p_attribute10			=> hr_api.g_varchar2
540 	     ,p_attribute11			=> hr_api.g_varchar2
541 	     ,p_attribute12			=> hr_api.g_varchar2
542 	     ,p_attribute13			=> hr_api.g_varchar2
543 	     ,p_attribute14			=> hr_api.g_varchar2
544 	     ,p_attribute15			=> hr_api.g_varchar2
545 	     ,p_attribute16			=> hr_api.g_varchar2
546 	     ,p_attribute17			=> hr_api.g_varchar2
547 	     ,p_attribute18			=> hr_api.g_varchar2
548 	     ,p_attribute19			=> hr_api.g_varchar2
549 	     ,p_attribute20			=> hr_api.g_varchar2
550 	     ,p_updating_action_type		=> hr_api.g_varchar2
551 	     ,p_entry_information_category	=> hr_api.g_varchar2
552 	     ,p_entry_information1		=> hr_api.g_varchar2
553 	     ,p_entry_information2		=> hr_api.g_varchar2
554 	     ,p_entry_information3		=> hr_api.g_varchar2
555 	     ,p_entry_information4		=> hr_api.g_varchar2
556 	     ,p_entry_information5		=> hr_api.g_varchar2
557 	     ,p_entry_information6		=> hr_api.g_varchar2
558 	     ,p_entry_information7		=> hr_api.g_varchar2
559 	     ,p_entry_information8		=> hr_api.g_varchar2
560 	     ,p_entry_information9		=> hr_api.g_varchar2
561 	     ,p_entry_information10		=> hr_api.g_varchar2
562 	     ,p_entry_information11		=> hr_api.g_varchar2
563 	     ,p_entry_information12		=> hr_api.g_varchar2
564 	     ,p_entry_information13		=> hr_api.g_varchar2
565 	     ,p_entry_information14		=> hr_api.g_varchar2
566 	     ,p_entry_information15		=> hr_api.g_varchar2
567 	     ,p_entry_information16		=> hr_api.g_varchar2
568 	     ,p_entry_information17		=> hr_api.g_varchar2
569 	     ,p_entry_information18		=> hr_api.g_varchar2
570 	     ,p_entry_information19		=> hr_api.g_varchar2
571 	     ,p_entry_information20		=> hr_api.g_varchar2
572 	     ,p_entry_information21		=> hr_api.g_varchar2
573 	     ,p_entry_information22		=> hr_api.g_varchar2
574 	     ,p_entry_information23		=> hr_api.g_varchar2
575 	     ,p_entry_information24		=> hr_api.g_varchar2
576 	     ,p_entry_information25		=> hr_api.g_varchar2
577 	     ,p_entry_information26		=> hr_api.g_varchar2
578 	     ,p_entry_information27		=> hr_api.g_varchar2
579 	     ,p_entry_information28		=> hr_api.g_varchar2
580 	     ,p_entry_information29		=> hr_api.g_varchar2
581 	     ,p_entry_information30		=> hr_api.g_varchar2);
582 
583 	if g_debug then
584 		hr_utility.set_location('Entering:'|| l_proc, 3);
585 	end if;
586 	-- Do not COMMIT here. COMMIT should be done from the OAF Application Only.
587 	EXCEPTION
588 	WHEN OTHERS THEN
589 		RAISE;
590 
591 	END update_taxcard;
592 --
593 -- ----------------------------------------------------------------------------
594 -- |--------------------------< find_dt_upd_modes >----------------------------|
595 -- ----------------------------------------------------------------------------
596 -- {Start Of Comments}
597 --
598 -- Description:
599 --   This API returns the DT modes for pay_element_entries_f for a given
600 --	element_entry_id (base key value) on a specified date
601 --
602 -- Prerequisites:
603 --   The element_entry (p_base_key_value) must exist as of the effective date
604 --   of the change (p_effective_date).
605 --
606 -- In Parameters:
607 --	Name			Reqd	Type	Description
608 --	p_effective_date	Yes	DATE    The effective date of the
609 --                                             	change.
610 --	p_base_key_value	Yes 	NUMBER	ID of the element entry.
611 --
612 --
613 -- Post Success:
614 --
615 --   The API sets the following out parameters:
616 --
617 --	Name			Type	Description
618 --	p_correction		BOOLEAN	True if correction mode is valid.
619 --	p_update		BOOLEAN	True if update mode is valid.
620 --	p_update_override	BOOLEAN	True if update override mode is valid.
621 --	p_update_change_insert	BOOLEAN	True if update change insert mode is
622 --					valid.
623 --	p_update_start_date	DATE	Start date for Update record.
624 --	p_update_end_date	DATE	End date for Update record.
625 --	p_override_start_date	DATE	Start date for Override.
626 --	p_override_end_date	DATE	End date for Overrride.
627 --	p_upd_chg_start_date	DATE	Start date for Update Change.
628 --	p_upd_chg_end_date	DATE	End date for Update Change.
629 
630 -- Post Failure:
631 --   The API will raise an error.
632 --
633 -- Access Status:
634 --   Private. For Internal Development Use only.
635 --
636 -- {End Of Comments}
637 --
638 	PROCEDURE find_dt_upd_modes
639 		(p_effective_date		IN  DATE
640 		 ,p_base_key_value		IN  NUMBER
641 		 ,p_correction			OUT NOCOPY BOOLEAN
642 		 ,p_update			OUT NOCOPY BOOLEAN
643 		 ,p_update_override		OUT NOCOPY BOOLEAN
644 		 ,p_update_change_insert	OUT NOCOPY BOOLEAN
645 		 ,p_correction_start_date	OUT NOCOPY DATE
646 		 ,p_correction_end_date		OUT NOCOPY DATE
647 		 ,p_update_start_date		OUT NOCOPY DATE
648 		 ,p_update_end_date		OUT NOCOPY DATE
649 		 ,p_override_start_date		OUT NOCOPY DATE
650 		 ,p_override_end_date		OUT NOCOPY DATE
651 		 ,p_upd_chg_start_date		OUT NOCOPY DATE
652 		 ,p_upd_chg_end_date		OUT NOCOPY DATE
653 		 ) IS
654 
655 	l_proc 	varchar2(72) := g_package||'find_dt_upd_modes';
656 
657 	BEGIN
658 	if g_debug then
659 		hr_utility.set_location('Entering:'|| l_proc, 1);
660 	end if;
661 	  --
662 	  -- Call the corresponding datetrack api
663 	  --
664 	  dt_api.find_dt_upd_modes_and_dates(
665 		p_effective_date		=> p_effective_date
666 		,p_base_table_name		=> 'pay_element_entries_f'
667 		,p_base_key_column		=> 'ELEMENT_ENTRY_ID'
668 		,p_base_key_value		=> p_base_key_value
669 		,p_correction			=> p_correction
670 		,p_update			=> p_update
671 		,p_update_override		=> p_update_override
672 		,p_update_change_insert		=> p_update_change_insert
673 		,p_correction_start_date	=> p_correction_start_date
674 		,p_correction_end_date		=> p_correction_end_date
675 		,p_update_start_date		=> p_update_start_date
676 		,p_update_end_date		=> p_update_end_date
677 		,p_override_start_date		=> p_override_start_date
678 		,p_override_end_date		=> p_override_end_date
679 		,p_upd_chg_start_date		=> p_upd_chg_start_date
680 		,p_upd_chg_end_date		=> p_upd_chg_end_date);
681 	if g_debug then
682 		hr_utility.set_location('Entering:'|| l_proc, 2);
683 	end if;
684 	  --
685 	  --hr_utility.set_location(' Leaving:'||l_proc, 10);
686 	EXCEPTION
687 		WHEN OTHERS THEN
688 	RAISE;
689 	END find_dt_upd_modes;
690 --
691 -- -----------------------------------------------------------------------------
692 -- |--------------------------< get_global_value >-----------------------------|
693 -- -----------------------------------------------------------------------------
694 --
695 -- {Start of Comments}
696 --
697 -- Description:
698 --   Returns the value for the global on a given date.
699 --
700 -- Prerequisites:
701 --   None
702 --
703 -- In Parameters
704 --	Name			Reqd	Type		Description
705 --	p_global_name		Yes	VARCHAR2	Assignment id
706 --	p_legislation_code	Yes	VARCHAR2	Legislation Code
707 --	p_effective_date	Yes	DATE     	Effective date
708 --
709 -- Post Success:
710 --	 The value of the global of type FF_GLOBALS_F.GLOBAL_VALUE is returned
711 --
712 -- Post Failure:
713 --   An error is raised
714 --
715 -- Access Status:
716 --   Internal Development Use Only
717 --
718 -- {End of Comments}
719 --
720 	FUNCTION get_global_value(
721 		p_global_name 		VARCHAR2,
722 		p_legislation_code 	VARCHAR2,
723 		p_effective_date 	DATE)
724 		RETURN ff_globals_f.global_value%TYPE IS
725 
726 	CURSOR csr_globals IS
727 		SELECT global_value
728 		FROM ff_globals_f
729 		WHERE global_name = p_global_name
730 		AND legislation_code = p_legislation_code
731 		AND business_group_id  IS NULL
732 		AND p_effective_date BETWEEN effective_start_date AND effective_end_date;
733 
734 	l_global_value ff_globals_f.global_value%TYPE;
735 	l_proc    varchar2(72) := g_package||'get_global_value';
736 
737 	BEGIN
738 		if g_debug then
739 			hr_utility.set_location('Entering:'|| l_proc, 1);
740 		end if;
741 
742 		OPEN csr_globals;
743 			FETCH csr_globals INTO l_global_value;
744 		CLOSE csr_globals;
745 
746 		if g_debug then
747 			hr_utility.set_location('Entering:'|| l_proc, 2);
748 		end if;
749 
750 		RETURN l_global_value;
751 	END get_global_value;
752 
753 END py_se_tax_card;
754