[Home] [Help]
PACKAGE BODY: APPS.PAY_IN_TAX_DECLARATION
Source
1 PACKAGE body pay_in_tax_declaration AS
2 /* $Header: pyintaxd.pkb 120.26.12020000.14 2013/02/18 13:46:02 anchhetr ship $ */
3 --
4 -- Global Variables Section
5 --
6 g_legislation_code VARCHAR2(3);
7 g_approval_info_type VARCHAR2(40);
8 g_element_value_list t_element_values_tab;
9 g_80dd_values t_entry_details_tab;
10 g_80g_values t_entry_details_tab;
11 g_insurace_values t_entry_details_tab;
12 g_80cce_values t_entry_details_tab;
13 g_list_index NUMBER;
14 g_80dd_index NUMBER;
15 g_80g_index NUMBER;
16 g_insurace_index NUMBER;
17 g_80cce_index NUMBER;
18 g_assignment_id per_all_assignments_f.assignment_id%TYPE;
19 g_index_assignment_id per_all_assignments_f.assignment_id%TYPE;
20 g_is_valid BOOLEAN;
21 g_index_values_valid BOOLEAN;
22 g_package CONSTANT VARCHAR2(100) := 'pay_in_tax_declaration.';
23 g_debug BOOLEAN;
24 L_80CCG_INVESTMENT_DATE DATE;
25 --
26 -- The following type is declared to store all
27 -- the inputs values of tax elements.
28 --
29 type t_input_values_rec is record
30 (input_name pay_input_values_f.name%TYPE
31 ,input_value_id pay_input_values_f.input_value_id%TYPE
32 ,input_value pay_element_entry_values.screen_entry_value%TYPE);
33
34 type t_input_values_tab is table of t_input_values_rec
35 index by binary_integer;
36 --
37 --------------------------------------------------------------------------
38 -- --
39 -- Name : IS_LOCKING_PERIOD --
40 -- Type : PROCEDURE --
41 -- Access : Public --
42 -- Description : The procedure is responsible for returning the --
43 -- freeze period details like start date, along with --
44 -- a flag to indicate if it is the freeze period. --
45 -- --
46 -- Parameters : --
47 -- IN : p_person_id per_people_f.person_id%TYPE --
48 -- OUT : p_locked VARCHAR2 --
49 -- p_lock_start DATE --
50 -- --
51 -- Change History : --
52 --------------------------------------------------------------------------
53 -- Rev# Date Userid Description --
54 --------------------------------------------------------------------------
55 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
56 -- 1.0 25-Sep-2007 RSAHARAY Parameter p_person_id replaced with --
57 -- p_assignment_id --
58 -- 1.1 01-Oct-2007 RSAHARAY Reverted to the initial IN parameters --
59 -- Modified the CURSOR --
60 -- csr_locking_period_details --
61 --------------------------------------------------------------------------
62 PROCEDURE is_locking_period
63 (p_person_id IN per_people_f.person_id%TYPE
64 ,p_locked OUT NOCOPY VARCHAR2
65 ,p_lock_start OUT NOCOPY DATE)
66 IS
67 --
68 CURSOR csr_locking_period_details(c_person_id IN NUMBER)
69 IS
70 SELECT nvl(org.org_information1, 'N') locking_period
71 , nvl(org.org_information3, 0) window_period
72 , fnd_date.canonical_to_date(org.org_information2) locking_period_start
73 , TRUNC(SYSDATE - start_date) hire_duration
74 FROM hr_organization_information org
75 , per_people_f person
76 , per_assignments_f assign
77 , hr_soft_coding_keyflex scl
78 WHERE org.org_information_context = 'PER_IN_TAX_DECL_DETAILS'
79 AND person.person_id = c_person_id
80 AND assign.person_id = person.person_id
81 AND assign.soft_coding_keyflex_id = scl.soft_coding_keyflex_id
82 AND assign.primary_flag = 'Y'
83 AND org.organization_id = nvl(scl.segment1, person.business_group_id)
84 AND SYSDATE BETWEEN person.effective_start_date
85 AND person.effective_end_date
86 AND SYSDATE BETWEEN assign.effective_start_date
87 AND assign.effective_end_date;
88 --
89 l_proc VARCHAR2(120);
90 l_locking_period VARCHAR2(2);
91 l_window_period NUMBER;
92 l_hire_duration NUMBER;
93 l_procedure VARCHAR(100);
94 l_message VARCHAR2(250);
95 --
96 BEGIN
97 --
98 l_procedure := g_package || 'is_locking_period';
99 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
100
101 IF g_debug THEN
102 pay_in_utils.trace('**************************************************','********************');
103 pay_in_utils.trace('p_person_id',p_person_id);
104 pay_in_utils.trace('**************************************************','********************');
105 END IF;
106 p_locked := 'Y';
107 --
108
109 --
110 OPEN csr_locking_period_details(p_person_id);
111 FETCH csr_locking_period_details INTO l_locking_period
112 , l_window_period
113 , p_lock_start
114 , l_hire_duration;
115 CLOSE csr_locking_period_details;
116 --
117 pay_in_utils.set_location(g_debug, l_proc, 20);
118 --
119 -- If locking period if its a new hire falling within the window period
120 -- if so allow him access to declare his tax. For all other cases deny
121 -- access.
122 -- If declaration period allow access.
123 --
124 IF l_locking_period = 'Y' THEN
125 --
126 -- locking period logic
127 --
128 IF l_hire_duration < l_window_period THEN
129 --
130 pay_in_utils.set_location(g_debug, l_proc, 30);
131 --
132 p_locked := 'N';
133 --
134 END IF;
135 --
136 pay_in_utils.set_location(g_debug, l_proc, 40);
137 --
138 ELSE
139 --
140 -- Declaration period logic.
141 --
142 pay_in_utils.set_location(g_debug, l_proc, 50);
143 --
144 p_locked := 'N';
145 --
146 END IF;
147
148 IF g_debug THEN
149 pay_in_utils.trace('**************************************************','********************');
150 pay_in_utils.trace('p_locked ',p_locked);
151 pay_in_utils.trace('p_lock_start ',p_lock_start);
152 pay_in_utils.trace('**************************************************','********************');
153 END IF;
154
155 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
156
157 --
158 END is_locking_period;
159
160 --------------------------------------------------------------------------
161 -- --
162 -- Name : IS_APPROVED --
163 -- Type : PROCEDURE --
164 -- Access : Public --
165 -- Description : The procedure is responsible for returning the --
166 -- the flag stating if the employee tax declaration --
167 -- details have been approved or not. --
168 -- --
169 -- Parameters : --
170 -- IN : p_person_id per_people_f.person_id%TYPE --
171 -- p_effective_date DATE --
172 -- OUT : p_status VARCHAR2 --
173 -- --
174 -- Change History : --
175 --------------------------------------------------------------------------
176 -- Rev# Date Userid Description --
177 --------------------------------------------------------------------------
178 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
179 --------------------------------------------------------------------------
180 PROCEDURE is_approved
181 (p_person_id IN NUMBER
182 ,p_effective_date IN DATE default null
183 ,p_status OUT NOCOPY VARCHAR2)
184 IS
185 --
186 l_procedure VARCHAR(100);
187 l_message VARCHAR2(250);
188 l_effective_date DATE;
189 l_assignment_id per_assignments_f.assignment_id%TYPE;
190 l_extra_info_id per_assignment_extra_info.assignment_extra_info_id%TYPE;
191 --
192 BEGIN
193 --
194 l_procedure := g_package || 'is_approved';
195 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
196
197 IF g_debug THEN
198 pay_in_utils.trace('**************************************************','********************');
199 pay_in_utils.trace('p_person_id',p_person_id);
200 pay_in_utils.trace('p_effective_date',p_effective_date);
201 pay_in_utils.trace('**************************************************','********************');
202 END IF;
203 --
204 -- Get the currect effective date to be used.
205 --
206 l_effective_date:= pay_in_utils.get_effective_date(p_effective_date);
207 pay_in_utils.trace('l_effective_date ',l_effective_date);
208 pay_in_utils.set_location(g_debug,l_procedure,20);
209 --
210 -- Get the assignment Id for which to find the details.
211 --
212 l_assignment_id := pay_in_utils.get_assignment_id
213 (p_person_id
214 ,l_effective_date);
215 pay_in_utils.trace('l_assignment_id ',l_assignment_id);
216 pay_in_utils.set_location(g_debug,l_procedure,30);
217 --
218 -- Get the approval details for the above assignment ID
219 --
220 p_status := pay_in_tax_declaration.get_approval_status
221 (p_assignment_id => l_assignment_id
222 ,p_tax_year => pay_in_tax_declaration.get_tax_year(l_effective_date)
223 ,p_extra_info_id => l_extra_info_id);
224
225 IF g_debug THEN
226 pay_in_utils.trace('**************************************************','********************');
227 pay_in_utils.trace('p_status ', p_status);
228 pay_in_utils.trace('**************************************************','********************');
229 END IF;
230
231 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
232
233
234 END is_approved;
235
236 --------------------------------------------------------------------------
237 -- --
238 -- Name : GET_CITY_TYPE --
239 -- Type : FUNCTION --
240 -- Access : Public --
241 -- Description : The function is responsible for quering the city --
242 -- type of the primary address of the employee if the --
243 -- primary address is not available then return NA. --
244 -- --
245 -- Parameters : --
246 -- IN : p_person_id per_people_f.person_id%TYPE --
247 -- p_effective_date DATE --
248 -- RETURN : VARCHAR2 --
249 -- --
250 -- Change History : --
251 --------------------------------------------------------------------------
252 -- Rev# Date Userid Description --
253 --------------------------------------------------------------------------
254 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
255 --------------------------------------------------------------------------
256 FUNCTION get_city_type
257 (p_person_id IN NUMBER
258 ,p_effective_date IN DATE)
259 RETURN varchar2
260 IS
261 --
262 -- Cursor to get the city type from per_addresses
263 --
264 CURSOR csr_city_type
265 IS
266 SELECT add_information16
267 FROM per_addresses
268 WHERE person_id = p_person_id
269 AND primary_flag = 'Y'
270 AND style = 'IN'
271 AND p_effective_date BETWEEN date_from
272 AND NVL(date_to, hr_general.end_of_time);
273 --
274 l_lookup_code hr_lookups.lookup_code%TYPE;
275 l_procedure VARCHAR(100);
276 l_message VARCHAR2(250);
277
278 --
279 BEGIN
280 --
281 l_procedure := g_package || 'get_city_type';
282 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
283
284 IF g_debug THEN
285 pay_in_utils.trace('**************************************************','********************');
286 pay_in_utils.trace('p_person_id',p_person_id);
287 pay_in_utils.trace('p_effective_date',p_effective_date);
288 pay_in_utils.trace('**************************************************','********************');
289 END IF;
290 --
291 -- Comments should be of this form
292 --
293 OPEN csr_city_type;
294 FETCH csr_city_type INTO l_lookup_code;
295 --
296 IF csr_city_type%NOTFOUND THEN
297 l_lookup_code := 'NA';
298 pay_in_utils.trace('l_lookup_code ',l_lookup_code);
299 pay_in_utils.set_location(g_debug,l_procedure,20);
300 END IF;
301 --
302 CLOSE csr_city_type;
303 --
304 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
305
306 IF g_debug THEN
307 pay_in_utils.trace('**************************************************','********************');
308 pay_in_utils.trace('Decoded Lookup Code',hr_general.decode_lookup('IN_CITY_TYPE', l_lookup_code));
309 pay_in_utils.trace('**************************************************','********************');
310 END IF;
311
312
313 return hr_general.decode_lookup('IN_CITY_TYPE', l_lookup_code);
314
315
316
317 END get_city_type;
318
319 --------------------------------------------------------------------------
320 -- --
321 -- Name : GET_TAX_YEAR --
322 -- Type : FUNCTION --
323 -- Access : Public --
324 -- Description : The function is responsible returning the tax year --
325 -- created based on the effective date passed to it. --
326 -- --
327 -- Parameters : --
328 -- IN : p_effective_date DATE --
329 -- RETURN : VARCHAR2 --
330 -- --
331 -- Change History : --
332 --------------------------------------------------------------------------
333 -- Rev# Date Userid Description --
334 --------------------------------------------------------------------------
335 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
336 --------------------------------------------------------------------------
337 FUNCTION get_tax_year(p_effective_date IN DATE)
338 RETURN VARCHAR2
339 IS
340 --
341 l_procedure VARCHAR(100);
342 l_message VARCHAR2(250);
343 l_year NUMBER;
344 l_month NUMBER;
345 --
346 BEGIN
347 --
348 l_procedure := g_package || 'get_tax_year';
349 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
350
351 IF g_debug THEN
352 pay_in_utils.trace('**************************************************','********************');
353 pay_in_utils.trace('p_effective_date',p_effective_date);
354 pay_in_utils.trace('**************************************************','********************');
355 END IF;
356 --
357 -- Get the year and month for the effective date
358 --
359 l_year := to_number(to_char(p_effective_date, 'YYYY'));
360 l_month := to_number(to_char(p_effective_date, 'MM'));
361 pay_in_utils.trace('l_year ',l_year);
362 pay_in_utils.set_location(g_debug,l_procedure,20);
363 pay_in_utils.trace('l_month ',l_month);
364 pay_in_utils.set_location(g_debug,l_procedure,30);
365 --
366 -- If it is Jan, Feb or Mar it is current_year-1 and current_year.
367 --
368 IF l_month in (1, 2, 3) THEN
369 --
370 pay_in_utils.set_location(g_debug,l_procedure,40);
371 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,50);
372 RETURN (to_char(l_year-1)||'-'||to_char(l_year));
373 --
374 ELSE
375 --
376 -- Else it is current_year and current_year + 1
377 --
378 pay_in_utils.set_location(g_debug,l_procedure,60);
379 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,80);
380
381 IF g_debug THEN
382 pay_in_utils.trace('**************************************************','********************');
383 pay_in_utils.trace('Tax Year',(to_char(l_year)||'-'||to_char(l_year+1)));
384 pay_in_utils.trace('**************************************************','********************');
385 END IF;
386
387 RETURN (to_char(l_year)||'-'||to_char(l_year+1));
388 --
389 END IF;
390 --
391
392
393 END get_tax_year;
394
395 --------------------------------------------------------------------------
396 -- --
397 -- Name : GET_APPROVAL_STATUS --
398 -- Type : FUNCTION --
399 -- Access : Public --
400 -- Description : The procedure is responsible for returning the --
401 -- the flag stating if the employee tax declaration --
402 -- details have been approved or not. . --
403 -- --
404 -- Parameters : --
405 -- IN : p_assignment_id per_assignments_f.assignment_id --
406 -- p_tax_year VARCHAR2 --
407 -- p_extra_info_id assignment_extra_info_id --
408 -- RETURN : VARCHAR2 --
409 -- --
410 -- Change History : --
411 --------------------------------------------------------------------------
412 -- Rev# Date Userid Description --
413 --------------------------------------------------------------------------
414 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
415 --------------------------------------------------------------------------
416 FUNCTION get_approval_status
417 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
418 ,p_tax_year IN VARCHAR2
419 ,p_extra_info_id OUT NOCOPY per_assignment_extra_info.assignment_extra_info_id%TYPE)
420 RETURN VARCHAR2
421 IS
422 --
423 CURSOR csr_approval_details
424 IS
425 SELECT assignment_extra_info_id
426 , aei_information2 flag
427 FROM per_assignment_extra_info
428 WHERE assignment_id = p_assignment_id
429 AND information_type = g_approval_info_type
430 AND aei_information1 = p_tax_year
431 AND aei_information_category = g_approval_info_type;
432 --
433 l_found VARCHAR2(2);
434 l_procedure VARCHAR(100);
435 l_message VARCHAR2(250);
436
437 --
438 BEGIN
439 --
440 l_procedure := g_package || 'get_approval_status';
441 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
442
443 IF g_debug THEN
444 pay_in_utils.trace('**************************************************','********************');
445 pay_in_utils.trace('p_assignment_id',p_assignment_id);
446 pay_in_utils.trace('p_tax_year',p_tax_year);
447 pay_in_utils.trace('**************************************************','********************');
448 END IF;
449 --
450 OPEN csr_approval_details;
451 FETCH csr_approval_details INTO p_extra_info_id, l_found;
452 CLOSE csr_approval_details;
453 --
454 IF g_debug THEN
455 pay_in_utils.trace('**************************************************','********************');
456 pay_in_utils.trace('l_found',l_found);
457 pay_in_utils.trace('p_extra_info_id',p_extra_info_id);
458 pay_in_utils.trace('**************************************************','********************');
459 END IF;
460
461 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,20);
462
463 RETURN l_found;
464
465
466
467 --
468 END get_approval_status;
469
470 --------------------------------------------------------------------------
471 -- --
472 -- Name : GET_DONATION_TYPE --
473 -- Type : FUNCTION --
474 -- Access : Public --
475 -- Description : The function has the same code which is used to --
476 -- validate teh donation type details entered. Further --
477 -- is used to validate the same in self-service --
478 -- --
479 -- Parameters : --
480 -- IN : p_lookup_code VARCHAR2 --
481 -- RETURN : pay_user_column_instances_f.value%TYPE --
482 -- --
483 -- Change History : --
484 --------------------------------------------------------------------------
485 -- Rev# Date Userid Description --
486 --------------------------------------------------------------------------
487 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
488 --------------------------------------------------------------------------
489 FUNCTION get_donation_type(p_lookup_code IN VARCHAR2)
490 RETURN pay_user_column_instances_f.value%TYPE
491 IS
492 --
493 CURSOR csr_get_meaning
494 IS
495 SELECT cinstances.value
496 FROM pay_user_tables utab
497 , pay_user_columns ucols
498 , pay_user_rows_f urows
499 , pay_user_column_instances_f cinstances
500 WHERE utab.user_table_id = ucols.user_table_id
501 AND utab.user_table_id = urows.user_table_id
502 AND ucols.user_column_id = cinstances.user_column_id
503 AND urows.user_row_id = cinstances.user_row_id
504 AND utab.user_table_name = 'PER_IN_DONATION_DETAILS'
505 AND utab.legislation_code = 'IN'
506 AND ucols.user_column_name = 'Donation Type'
507 AND urows.row_low_range_or_name = p_lookup_code;
508 --
509 l_meaning pay_user_column_instances_f.value%TYPE;
510 l_procedure VARCHAR(100);
511 l_message VARCHAR2(250);
512
513 --
514 BEGIN
515 --
516 l_procedure := g_package || 'get_donation_type';
517 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
518
519 IF g_debug THEN
520 pay_in_utils.trace('**************************************************','********************');
521 pay_in_utils.trace('p_lookup_code',p_lookup_code);
522 pay_in_utils.trace('**************************************************','********************');
523 END IF;
524
525 OPEN csr_get_meaning;
526 FETCH csr_get_meaning INTO l_meaning;
527 CLOSE csr_get_meaning;
528
529 IF g_debug THEN
530 pay_in_utils.trace('**************************************************','********************');
531 pay_in_utils.trace('l_meaning',l_meaning);
532 pay_in_utils.trace('**************************************************','********************');
533 END IF;
534
535 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
536
537 RETURN l_meaning;
538
539
540 END get_donation_type;
541
542 --------------------------------------------------------------------------
543 -- --
544 -- Name : GET_PLANNED_VALUE --
545 -- Type : FUNCTION --
546 -- Access : Public --
547 -- Description : The function calculates the value of an element --
548 -- entries's input value on a date which is before the --
549 -- freeze date for the financial year. --
550 -- --
551 -- Parameters : --
552 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
553 -- p_actual_value VARCHAR2 --
554 -- p_ele_entry_id element_entry_id%TYPE --
555 -- p_input_value_id input_value_id%TYPE --
556 -- RETURN : VARCHAR2 --
557 -- --
558 -- Change History : --
559 --------------------------------------------------------------------------
560 -- Rev# Date Userid Description --
561 --------------------------------------------------------------------------
562 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
563 --------------------------------------------------------------------------
564 FUNCTION get_planned_value
565 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
566 ,p_actual_value IN VARCHAR2
567 ,p_ele_entry_id IN pay_element_entries_f.element_entry_id%TYPE
568 ,p_input_value_id IN pay_input_values_f.input_value_id%TYPE)
569 RETURN VARCHAR2
570 IS
571 --
572 CURSOR csr_entry_value(c_effective_date IN DATE)
573 IS
574 SELECT screen_entry_value
575 FROM pay_element_entry_values_f
576 WHERE element_entry_id = p_ele_entry_id
577 AND input_value_id = p_input_value_id
578 AND c_effective_date BETWEEN effective_start_date
579 AND effective_end_date;
580 --
581 l_procedure VARCHAR(100);
582 l_message VARCHAR2(250);
583 l_value pay_element_entry_values.screen_entry_value%TYPE;
584 l_locked VARCHAR2(2);
585 l_date_start DATE;
586 --
587 BEGIN
588
589 l_procedure := g_package || 'get_planned_value';
590 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
591
592 IF g_debug THEN
593 pay_in_utils.trace('**************************************************','********************');
594 pay_in_utils.trace('p_assignment_id',p_assignment_id);
595 pay_in_utils.trace('p_actual_value',p_actual_value);
596 pay_in_utils.trace('p_ele_entry_id',p_ele_entry_id);
597 pay_in_utils.trace('p_input_value_id',p_input_value_id);
598 pay_in_utils.trace('**************************************************','********************');
599 END IF;
600 --
601 is_locking_period
602 (p_person_id => pay_in_utils.get_person_id(p_assignment_id)
603 ,p_locked => l_locked
604 ,p_lock_start => l_date_start);
605 --
606 pay_in_utils.set_location(g_debug,l_procedure,20);
607 --
608 IF l_locked = 'N' THEN
609 --
610 pay_in_utils.set_location(g_debug,l_procedure,30);
611 l_value := p_actual_value;
612 --
613 ELSE
614 --
615 pay_in_utils.set_location(g_debug,l_procedure,40);
616 OPEN csr_entry_value(l_date_start-1);
617 FETCH csr_entry_value INTO l_value;
618 CLOSE csr_entry_value;
619
620 pay_in_utils.set_location(g_debug,l_procedure,50);
621
622 IF l_value IS NULL THEN
623 pay_in_utils.set_location(g_debug, l_procedure, 60);
624 OPEN csr_entry_value(SYSDATE);
625 FETCH csr_entry_value INTO l_value;
626 CLOSE csr_entry_value;
627 END IF;
628
629 pay_in_utils.set_location(g_debug, l_procedure, 70);
630 --
631 END IF;
632
633 IF g_debug THEN
634 pay_in_utils.trace('**************************************************','********************');
635 pay_in_utils.trace('l_value',l_value);
636 pay_in_utils.trace('**************************************************','********************');
637 END IF;
638
639 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,80);
640 --
641 RETURN l_value;
642
643
644 END get_planned_value;
645
646 --------------------------------------------------------------------------
647 -- --
648 -- Name : GET_VALUE --
649 -- Type : FUNCTION --
650 -- Access : Public --
651 -- Description : The function calculates the planned and the actual --
652 -- values of the following elements and stores then in --
653 -- the cache when the function is first called on sub- --
654 -- sequent calls it would used the cached value. --
655 -- 1. Rebates under Section 88 --
656 -- 2. Tuition Fee --
657 -- 3. Deductions under Chapter VI A and --
658 -- 4. Other Income --
659 -- --
660 -- Parameters : --
661 -- IN : p_assignment_id NUMBER --
662 -- p_element_name VARCHAR2 --
663 -- p_input_name VARCHAR2 --
664 -- p_effective_date DATE --
665 -- p_actual_value VARCHAR2 --
666 -- RETURN : VARCHAR2 --
667 -- --
668 -- Change History : --
669 --------------------------------------------------------------------------
670 -- Rev# Date Userid Description --
671 --------------------------------------------------------------------------
672 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
673 --------------------------------------------------------------------------
674 FUNCTION get_value
675 (p_assignment_id IN number
676 ,p_element_name IN varchar2
677 ,p_input_name IN varchar2
678 ,p_effective_date IN date
679 ,p_actual_value IN varchar2
680 )
681 RETURN VARCHAR2
682 IS
683 --
684 CURSOR csr_element_details(c_effective_date IN DATE)
685 IS
686 SELECT types.element_name
687 , inputs.name name
688 , value.screen_entry_value planned
689 , value.screen_entry_value actual
690 FROM per_assignments_f assgn
691 , pay_element_links_f link
692 , pay_element_types_f types
693 , pay_element_entries_f entries
694 , pay_element_entry_values_f value
695 , pay_input_values_f inputs
696 WHERE assgn.assignment_id = p_assignment_id
697 AND link.element_link_id = pay_in_utils.get_element_link_id(p_assignment_id
698 ,c_effective_date
699 ,types.element_type_id
700 )
701 AND (types.processing_type = 'R' OR assgn.payroll_id IS NOT NULL)
702 AND link.business_group_id = assgn.business_group_id
703 AND link.element_type_id = types.element_type_id
704 AND types.element_name in ( 'House Rent Information'
705 , 'Rebates under Section 88'
706 , 'Tuition Fee'
707 , 'Deduction under Section 80GG'
708 , 'Deduction under Section 80D'
709 , 'Deduction under Section 80DDB'
710 , 'Deduction under Section 80GGA'
711 , 'Deduction under Section 80E'
712 , 'Deduction under Section 80U' -- Check if it is really required
713 , 'Other Income'
714 , 'Deduction under Section 80CCF'
715 , 'Deduction under Section 80CCG'
716 , 'PF Information')
717 AND entries.element_type_id = types.element_type_id
718 AND entries.element_link_id = link.element_link_id
719 AND entries.assignment_id = assgn.assignment_id
720 AND entries.element_entry_id = value.element_entry_id
721 AND inputs.input_value_id = value.input_value_id
722 AND inputs.element_type_id = types.element_type_id
723 AND c_effective_date BETWEEN assgn.effective_start_date
724 AND assgn.effective_end_date
725 AND c_effective_date BETWEEN link.effective_start_date
726 AND link.effective_end_date
727 AND c_effective_date BETWEEN types.effective_start_date
728 AND types.effective_end_date
729 AND c_effective_date BETWEEN entries.effective_start_date
730 AND entries.effective_end_date
731 AND c_effective_date BETWEEN inputs.effective_start_date
732 AND inputs.effective_end_date
733 AND c_effective_date BETWEEN value.effective_start_date
734 AND value.effective_end_date
735 order by types.element_name, inputs.name;
736 --
737 l_procedure VARCHAR(100);
738 l_message VARCHAR2(250);
739 l_locked VARCHAR2(2);
740 l_date_start DATE;
741 iLoop NUMBER;
742 --
743 BEGIN
744 --
745 l_procedure := g_package || 'get_value';
746 pay_in_utils.set_location(g_debug, 'Entering: '||l_procedure, 10);
747 --
748 IF g_debug THEN
749 pay_in_utils.trace('**************************************************','********************');
750 pay_in_utils.trace('Assignment ID: ',p_assignment_id);
751 pay_in_utils.trace('Element Name: ', p_element_name);
752 pay_in_utils.trace('Input Name: ', p_input_name);
753 pay_in_utils.trace('Effective Date: ', p_effective_date);
754 pay_in_utils.trace('Actual Value? ', p_actual_value);
755 pay_in_utils.trace('**************************************************','********************');
756 END IF;
757 --
758 -- If the data in the global pl/sql table is valid
759 -- then check if the assignment id's are same for
760 -- the data in pl/sql table and the current assignment.
761 --
762 -- This is required in the case of superuser where in the
763 -- same session he might query the details for more than
764 -- one assignments.
765 --
766 IF g_is_valid THEN
767 IF g_assignment_id <> p_assignment_id THEN
768 --
769 -- If the details are invalid requery the details.
770 --
771 pay_in_utils.set_location(g_debug, l_procedure, 20);
772 g_is_valid := false;
773 --
774 END IF;
775 END IF;
776 --
777 IF g_is_valid = false THEN
778 --
779 -- Entering because of either of the following reasons:
780 -- 1) The pl/sql table doesn't have any data(first time).
781 -- 2) Data is being requeried for a different assignment.
782 --
783 pay_in_utils.set_location(g_debug, l_procedure, 30);
784 g_list_index := 0;
785 g_assignment_id := p_assignment_id;
786 --
787 FOR rec_element_details IN csr_element_details(p_effective_date) LOOP
788 --
789 IF g_debug THEN
790 hr_utility.trace(g_list_index||'...Input ->' || rec_element_Details.name ||' ['||rec_element_details.planned||']');
791 END IF;
792 g_element_value_list(g_list_index).element_name := rec_element_details.element_name;
793 g_element_value_list(g_list_index).input_name := rec_element_details.name;
794 g_element_value_list(g_list_index).planned_val := rec_element_details.planned;
795 g_element_value_list(g_list_index).actual_val := rec_element_details.actual;
796 g_list_index := g_list_index + 1;
797 --
798 END LOOP;
799 --
800 pay_in_utils.set_location(g_debug, l_procedure, 40);
801 --
802 is_locking_period
803 (p_person_id => pay_in_utils.get_person_id(p_assignment_id)
804 ,p_locked => l_locked
805 ,p_lock_start => l_date_start);
806 --
807 pay_in_utils.set_location(g_debug, l_procedure, 50);
808 --
809 IF l_locked = 'Y' THEN
810 --
811 pay_in_utils.set_location(g_debug, l_procedure, 60);
812 iLoop := 0;
813 --
814 FOR rec_element_details IN csr_element_details(l_date_start-1) LOOP
815 --
816 pay_in_utils.set_location(g_debug, l_procedure, 70);
817 --
818 IF (g_element_value_list(iLoop).element_name = rec_element_details.element_name
819 AND g_element_value_list(iLoop).input_name = rec_element_details.name) THEN
820 --
821 pay_in_utils.set_location(g_debug, l_procedure, 80);
822 g_element_value_list(iLoop).planned_val := rec_element_details.actual;
823 --
824 END IF;
825 --
826 iLoop := iLoop+1;
827 --
828 END LOOP;
829 --
830 END IF;
831 --
832 END IF;
833
834 IF g_debug THEN
835 hr_utility.trace('List Index: ' || g_list_index);
836 END IF;
837
838 IF g_list_index = 0 THEN
839 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,90);
840 pay_in_utils.trace('**************************************************','********************');
841 return null;
842 ELSE
843 FOR indx IN 0..g_list_index-1 LOOP /*Bug no : 13900632 */
844 IF (g_element_value_list(indx).element_name = p_element_name AND
845 g_element_value_list(indx).input_name = p_input_name)
846 THEN
847 IF g_debug THEN
848 hr_utility.trace('...Value[' || g_element_value_list(indx).actual_val || ']');
849 END IF;
850 IF p_actual_value = 'TRUE' THEN
851 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,100);
852 IF g_debug THEN
853 pay_in_utils.trace('**************************************************','********************');
854 pay_in_utils.trace('Actual Value ',g_element_value_list(indx).actual_val);
855 pay_in_utils.trace('**************************************************','********************');
856 END IF;
857 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,110);
858 return g_element_value_list(indx).actual_val;
859
860 ELSE
861 IF g_debug THEN
862 pay_in_utils.trace('**************************************************','********************');
863 pay_in_utils.trace('Planned Value ',g_element_value_list(indx).planned_val);
864 pay_in_utils.trace('**************************************************','********************');
865 END IF;
866 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,110);
867 return g_element_value_list(indx).planned_val;
868 END IF;
869 END IF;
870 END LOOP;
871 END IF;
872
873 pay_in_utils.trace('**************************************************','********************');
874 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,110);
875 return null;
876
877 END get_value;
878
879 --------------------------------------------------------------------------
880 -- --
881 -- Name : GET_NUMERIC_VALUE --
882 -- Type : FUNCTION --
883 -- Access : Public --
884 -- Description : The function calls get_value internally, but the --
885 -- value returned would be converted to number using --
886 -- to_number and the numeric value returned. --
887 -- --
888 -- Parameters : --
889 -- IN : p_assignment_id NUMBER --
890 -- p_element_name VARCHAR2 --
891 -- p_input_name VARCHAR2 --
892 -- p_effective_date DATE --
893 -- p_actual_value VARCHAR2 --
894 -- RETURN : NUMBER --
895 -- --
896 -- Change History : --
897 --------------------------------------------------------------------------
898 -- Rev# Date Userid Description --
899 --------------------------------------------------------------------------
900 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
901 --------------------------------------------------------------------------
902 FUNCTION get_numeric_value
903 (p_assignment_id IN number
904 ,p_element_name IN varchar2
905 ,p_input_name IN varchar2
906 ,p_effective_date IN date
907 ,p_actual_value IN varchar2
908 )
909 RETURN NUMBER
910 IS
911 l_procedure VARCHAR(100);
912 l_message VARCHAR2(250);
913
914 BEGIN
915
916 l_procedure := g_package || 'get_numeric_value';
917 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
918
919 IF g_debug THEN
920 pay_in_utils.trace('**************************************************','********************');
921 pay_in_utils.trace('Assignment ID: ',p_assignment_id);
922 pay_in_utils.trace('Element Name: ', p_element_name);
923 pay_in_utils.trace('Input Name: ', p_input_name);
924 pay_in_utils.trace('Effective Date: ', p_effective_date);
925 pay_in_utils.trace('Actual Value? ', p_actual_value);
926 pay_in_utils.trace('**************************************************','********************');
927 END IF;
928
929 IF g_debug THEN
930 pay_in_utils.trace('**************************************************','********************');
931 pay_in_utils.trace('Value: ',to_number(get_value(p_assignment_id,p_element_name,p_input_name,p_effective_date,p_actual_value)));
932 pay_in_utils.trace('**************************************************','********************');
933 END IF;
934 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,20);
935 return to_number(get_value
936 (p_assignment_id
937 ,p_element_name
938 ,p_input_name
939 ,p_effective_date
940 ,p_actual_value
941 )
942 );
943
944 END get_numeric_value;
945
946 --------------------------------------------------------------------------
947 -- --
948 -- Name : GET_LAST_UPDATED_DATE --
949 -- Type : FUNCTION --
950 -- Access : Public --
951 -- Description : The is called with one of these values and returns --
952 -- the last updated date of the associated element for --
953 -- element type in question. The valid element types --
954 -- are: --
955 -- 1. HOUSE --
956 -- 2. CHAPTER6 --
957 -- 3. SECTION88 --
958 -- 4. OTHER --
959 -- 5. ALL --
960 -- --
961 -- Parameters : --
962 -- IN : p_person_id NUMBER --
963 -- p_effective_date DATE --
964 -- p_element_type VARCHAR2 --
965 -- RETURN : NUMBER --
966 -- --
967 -- Change History : --
968 --------------------------------------------------------------------------
969 -- Rev# Date Userid Description --
970 --------------------------------------------------------------------------
971 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
972 --------------------------------------------------------------------------
973 FUNCTION get_last_updated_date
974 (p_person_id IN NUMBER
975 ,p_effective_date IN DATE
976 ,p_element_type IN VARCHAR2)
977 RETURN DATE
978 IS
979 CURSOR csr_get_date(c_element_name1 IN VARCHAR2
980 ,c_element_name2 IN VARCHAR2
981 ,c_element_name3 IN VARCHAR2
982 ,c_element_name4 IN VARCHAR2
983 ,c_element_name5 IN VARCHAR2
984 ,c_element_name6 IN VARCHAR2
985 ,c_element_name7 IN VARCHAR2
986 ,c_element_name8 IN VARCHAR2
987 ,c_element_name9 IN VARCHAR2
988 ,c_element_name10 IN VARCHAR2
989 ,c_element_name11 IN VARCHAR2
990 ,c_element_name12 IN VARCHAR2
991 ,c_element_name13 IN VARCHAR2
992 ,c_element_name14 IN VARCHAR2
993 ,c_element_name15 IN VARCHAR2)
994 IS
995 SELECT MAX(entries.last_update_date)
996 FROM pay_element_types_f ele
997 , pay_element_entries_f entries
998 , per_assignments_f assgn
999 WHERE ele.element_name in (c_element_name1
1000 ,c_element_name2
1001 ,c_element_name3
1002 ,c_element_name4
1003 ,c_element_name5
1004 ,c_element_name6
1005 ,c_element_name7
1006 ,c_element_name8
1007 ,c_element_name9
1008 ,c_element_name10
1009 ,c_element_name11
1010 ,c_element_name12
1011 ,c_element_name13
1012 ,c_element_name14
1013 ,c_element_name15)
1014 AND ele.legislation_code = 'IN'
1015 AND assgn.person_id = p_person_id
1016 AND entries.assignment_id = assgn.assignment_id
1017 AND entries.element_type_id = ele.element_type_id
1018 AND p_effective_date BETWEEN assgn.effective_start_date
1019 AND assgn.effective_end_date
1020 AND p_effective_date BETWEEN ele.effective_start_date
1021 AND ele.effective_end_date
1022 AND p_effective_date BETWEEN entries.effective_start_date
1023 AND entries.effective_end_date;
1024 --
1025 l_updated_date DATE;
1026 l_procedure VARCHAR(100);
1027 l_message VARCHAR2(250);
1028 l_element_name1 VARCHAR2(120);
1029 l_element_name2 VARCHAR2(120);
1030 l_element_name3 VARCHAR2(120);
1031 l_element_name4 VARCHAR2(120);
1032 l_element_name5 VARCHAR2(120);
1033 l_element_name6 VARCHAR2(120);
1034 l_element_name7 VARCHAR2(120);
1035 l_element_name8 VARCHAR2(120);
1036 l_element_name9 VARCHAR2(120);
1037 l_element_name10 VARCHAR2(120);
1038 l_element_name11 VARCHAR2(120);
1039 l_element_name12 VARCHAR2(120);
1040 l_element_name13 VARCHAR2(120);
1041 l_element_name14 VARCHAR2(120);
1042 l_element_name15 VARCHAR2(120);
1043
1044 --
1045 BEGIN
1046 --
1047 l_procedure := g_package || 'get_last_updated_date';
1048 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
1049
1050 IF g_debug THEN
1051 pay_in_utils.trace('**************************************************','********************');
1052 pay_in_utils.trace('p_person_id: ',p_person_id);
1053 pay_in_utils.trace('p_element_type: ', p_element_type);
1054 pay_in_utils.trace('Effective Date: ', p_effective_date);
1055 pay_in_utils.trace('**************************************************','********************');
1056 END IF;
1057
1058 --
1059 IF p_element_type = 'HOUSE' THEN
1060 pay_in_utils.set_location(g_debug, l_procedure, 20);
1061 l_element_name1 := 'House Rent Information';
1062 ELSIF p_element_type = 'CHAPTER6' THEN
1063 pay_in_utils.set_location(g_debug, l_procedure, 30);
1064 l_element_name1 := 'Deduction under Section 80GG';
1065 l_element_name2 := 'Deduction under Section 80DD';
1066 l_element_name3 := 'Deduction under Section 80G';
1067 l_element_name4 := 'Deduction under Section 80D';
1068 l_element_name5 := 'Deduction under Section 80DDB';
1069 l_element_name6 := 'Deduction under Section 80E';
1070 l_element_name7 := 'Deduction under Section 80GGA';
1071 l_element_name8 := 'Deduction under Section 80CCE';
1072 l_element_name9 := 'Life Insurance Premium';
1073 l_element_name10 := 'Deduction under Section 80CCF';
1074 l_element_name11 := 'Deduction under Section 80CCG';
1075 ELSIF p_element_type = 'SECTION88' THEN
1076 pay_in_utils.set_location(g_debug, l_procedure, 40);
1077 -- l_element_name1 := 'Rebates under Section 88';
1078 -- l_element_name2 := 'Tuition Fee';
1079 -- l_element_name3 := 'Life Insurance Premium';
1080 ELSIF p_element_type = 'OTHER' THEN
1081 pay_in_utils.set_location(g_debug, l_procedure, 50);
1082 l_element_name1 := 'Other Income';
1083 ELSIF p_element_type = 'ALL' THEN
1084 pay_in_utils.set_location(g_debug, l_procedure, 60);
1085 l_element_name1 := 'House Rent Information';
1086 l_element_name2 := 'Deduction under Section 80GG';
1087 l_element_name3 := 'Deduction under Section 80DD';
1088 l_element_name4 := 'Deduction under Section 80G';
1089 l_element_name5 := 'Rebates under Section 88';
1090 l_element_name6 := 'Tuition Fee';
1091 l_element_name7 := 'Life Insurance Premium';
1092 l_element_name8 := 'Other Income';
1093 l_element_name9 := 'Deduction under Section 80D';
1094 l_element_name10 := 'Deduction under Section 80DDB';
1095 l_element_name11 := 'Deduction under Section 80E';
1096 l_element_name12 := 'Deduction under Section 80GGA';
1097 l_element_name13 := 'Deduction under Section 80CCE';
1098 l_element_name14 := 'Deduction under Section 80CCF';
1099 l_element_name15 := 'Deduction under Section 80CCG';
1100 ELSE
1101 pay_in_utils.set_location(g_debug, l_procedure, 70);
1102 return null;
1103 END IF;
1104 --
1105 pay_in_utils.set_location(g_debug, l_procedure, 80);
1106 --
1107 OPEN csr_get_date(l_element_name1, l_element_name2, l_element_name3, l_element_name4,
1108 l_element_name5, l_element_name6, l_element_name7, l_element_name8,
1109 l_element_name9, l_element_name10, l_element_name11, l_element_name12, l_element_name13, l_element_name14,l_element_name15);
1110 FETCH csr_get_date INTO l_updated_date;
1111 CLOSE csr_get_date;
1112 --
1113 IF g_debug THEN
1114 pay_in_utils.trace('**************************************************','********************');
1115 pay_in_utils.trace('l_updated_date',l_updated_date);
1116 pay_in_utils.trace('**************************************************','********************');
1117 END IF;
1118
1119 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,90);
1120 --
1121 RETURN l_updated_date;
1122
1123
1124 END get_last_updated_date;
1125
1126
1127
1128
1129
1130
1131
1132 PROCEDURE get_element_entry_ids
1133 (p_element_type_id IN pay_element_types_f.element_type_id%TYPE
1134 ,p_effective_date IN DATE
1135 ,p_expected_entries IN NUMBER
1136 ,p_input_values OUT NOCOPY t_input_values_tab)
1137 IS
1138
1139 CURSOR csr_element_inputs
1140 (c_element_type_id IN pay_element_types_f.element_type_id%TYPE)
1141 IS
1142 SELECT inputs.name
1143 , inputs.input_value_id
1144 FROM pay_element_types_f types
1145 , pay_input_values_f inputs
1146 WHERE types.element_type_id = c_element_type_id
1147 AND inputs.element_type_id = types.element_type_id
1148 AND inputs.legislation_code = g_legislation_code
1149 AND sysdate BETWEEN types.effective_start_date
1150 AND types.effective_end_date
1151 AND sysdate BETWEEN inputs.effective_start_date
1152 AND inputs.effective_end_date
1153 ORDER BY inputs.display_sequence;
1154 --
1155 l_count NUMBER;
1156 l_procedure VARCHAR(100);
1157 l_message VARCHAR2(250);
1158 --
1159 BEGIN
1160 --
1161 l_procedure := g_package || 'get_element_entry_ids';
1162 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
1163
1164 IF g_debug THEN
1165 pay_in_utils.trace('**************************************************','********************');
1166 pay_in_utils.trace('p_expected_entries: ',p_expected_entries);
1167 pay_in_utils.trace('p_element_type_id: ', p_element_type_id);
1168 pay_in_utils.trace('Effective Date: ', p_effective_date);
1169 pay_in_utils.trace('**************************************************','********************');
1170 END IF;
1171 --
1172 -- Query the details to get all the entries for the
1173 -- element type in question and then store it in the pl/sql table.
1174 l_count := 0;
1175 FOR rec_input_values IN csr_element_inputs(p_element_type_id)
1176 LOOP
1177 --
1178 pay_in_utils.set_location(g_debug, l_procedure, 20);
1179 p_input_values(l_count).input_name := rec_input_values.name; -- Bug 12808748
1180 p_input_values(l_count).input_value_id := rec_input_values.input_value_id;
1181 IF g_debug THEN
1182 pay_in_utils.trace('Input Name: '|| rec_input_values.name,p_input_values(l_count).input_value_id);
1183 END IF;
1184 l_count := l_count+1;
1185 --
1186 END LOOP;
1187 --
1188 pay_in_utils.set_location(g_debug, l_procedure, 30);
1189 --
1190 IF l_count < p_expected_entries THEN
1191 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
1192 RETURN;
1193 END IF;
1194 --
1195
1196
1197 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,50);
1198
1199 END get_element_entry_ids;
1200
1201
1202
1203
1204 PROCEDURE get_entry_details
1205 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
1206 ,p_element_name IN pay_element_types_f.element_name%TYPE
1207 ,p_effective_date IN DATE
1208 ,p_element_type_id OUT NOCOPY pay_element_types_f.element_type_id%TYPE
1209 ,p_element_link_id OUT NOCOPY pay_element_links_f.element_link_id%TYPE
1210 ,p_element_entry_id OUT NOCOPY pay_element_entries_f.element_entry_id%TYPE
1211 ,p_expected_entries IN NUMBER
1212 ,p_business_group_id OUT NOCOPY per_business_groups.business_group_id%TYPE
1213 ,p_object_version_number OUT NOCOPY pay_element_entries_f.object_version_number%TYPE
1214 ,p_input_values OUT NOCOPY t_input_values_tab
1215 )
1216 IS
1217 --
1218 CURSOR csr_element_entry
1219 (c_element_link_id IN pay_element_links_f.element_link_id%TYPE
1220 ,c_assignment_id IN per_assignments_f.assignment_id%TYPE)
1221 IS
1222 SELECT entries.element_entry_id
1223 , links.element_type_id
1224 , links.business_group_id
1225 , entries.object_version_number
1226 FROM pay_element_entries_f entries
1227 , pay_element_links_f links
1228 WHERE entries.element_link_id = links.element_link_id
1229 AND entries.assignment_id = c_assignment_id
1230 AND links.element_link_id = c_element_link_id
1231 AND links.element_type_id = entries.element_type_id
1232 AND p_effective_date BETWEEN entries.effective_start_date
1233 AND entries.effective_end_date
1234 AND p_effective_date BETWEEN links.effective_start_date
1235 AND links.effective_end_date;
1236 --
1237 CURSOR csr_element_details
1238 (c_element_link_id IN pay_element_links_f.element_link_id%TYPE)
1239 IS
1240 SELECT links.element_type_id
1241 , links.business_group_id
1242 FROM pay_element_links_f links
1243 WHERE links.element_link_id = c_element_link_id
1244 AND p_effective_date BETWEEN links.effective_start_date
1245 AND links.effective_end_date;
1246 --
1247 l_procedure VARCHAR(100);
1248 l_message VARCHAR2(250);
1249 l_status VARCHAR2(30);
1250
1251 --
1252 BEGIN
1253 --
1254 l_procedure := g_package || 'get_entry_details';
1255 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
1256
1257 IF g_debug THEN
1258 pay_in_utils.trace('**************************************************','********************');
1259 pay_in_utils.trace('p_assignment_id: ',p_assignment_id);
1260 pay_in_utils.trace('p_element_name: ', p_element_name);
1261 pay_in_utils.trace('Effective Date: ', p_effective_date);
1262 pay_in_utils.trace('p_expected_entries: ', p_expected_entries);
1263 pay_in_utils.trace('**************************************************','********************');
1264 END IF;
1265 --
1266 -- Query the link details for the assignment
1267 -- If link doesn't exists then error out.
1268 l_status := pay_in_utils.chk_element_link
1269 (p_element_name => p_element_name
1270 ,p_assignment_id => p_assignment_id
1271 ,p_effective_date => p_effective_date
1272 ,p_element_link_id => p_element_link_id);
1273 --
1274 pay_in_utils.set_location(g_debug,l_procedure,20);
1275 --
1276 IF l_status <> 'SUCCESS' THEN
1277 --
1278 hr_utility.set_message(800, 'PER_IN_MISSING_LINK');
1279 hr_utility.set_message_token('ELEMENT_NAME',p_element_name);
1280 hr_utility.raise_error;
1281 --
1282 END IF;
1283 --
1284 pay_in_utils.set_location(g_debug,l_procedure,30);
1285 --
1286 -- Query the details of the element required to update/create
1287 -- the element entries.
1288 OPEN csr_element_entry(p_element_link_id, p_assignment_id);
1289 FETCH csr_element_entry INTO p_element_entry_id
1290 , p_element_type_id
1291 , p_business_group_id
1292 , p_object_version_number;
1293 --
1294 IF csr_element_entry%NOTFOUND THEN
1295 --
1296 pay_in_utils.set_location(g_debug, 'Alternate logic: ' || l_procedure, 40);
1297 OPEN csr_element_details(p_element_link_id);
1298 FETCH csr_element_details INTO p_element_type_id, p_business_group_id;
1299 CLOSE csr_element_details;
1300 --
1301 END IF;
1302 --
1303 CLOSE csr_element_entry;
1304 --
1305 pay_in_utils.set_location(g_debug,l_procedure,40);
1306 --
1307 IF g_debug THEN
1308 pay_in_utils.trace('**************************************************','********************');
1309 pay_in_utils.trace('Element Link ID: ', p_element_link_id);
1310 pay_in_utils.trace('Element Type ID: ', p_element_type_id);
1311 pay_in_utils.trace('Element Entry ID: ', p_element_entry_id);
1312 pay_in_utils.trace('Business Group : ', p_business_group_id);
1313 pay_in_utils.trace('p_object_version_number : ', p_object_version_number);
1314 pay_in_utils.trace('**************************************************','********************');
1315 --
1316 END IF;
1317 --
1318 pay_in_utils.set_location(g_debug,l_procedure,50);
1319 --
1320 -- Fetch all the input IDs into the pl/sql table
1321 -- These IDs would be used by the calling function.
1322 get_element_entry_ids(p_element_type_id
1323 ,p_effective_date
1324 ,p_expected_entries
1325 ,p_input_values);
1326 --
1327 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,60);
1328
1329 END get_entry_details;
1330
1331
1332
1333
1334 FUNCTION get_update_mode
1335 (p_element_entry_id IN pay_element_entries_f.element_entry_id%TYPE
1336 ,p_effective_date IN DATE)
1337 RETURN VARCHAR2
1338 IS
1339 --
1340 l_procedure VARCHAR(100);
1341 l_message VARCHAR2(250);
1342 l_correction BOOLEAN;
1343 l_update BOOLEAN;
1344 l_update_override BOOLEAN;
1345 l_update_change_insert BOOLEAN;
1346 l_update_mode VARCHAR2(30);
1347 --
1348 BEGIN
1349 --
1350 l_procedure := g_package || 'get_update_mode';
1351 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
1352
1353 IF g_debug THEN
1354 pay_in_utils.trace('**************************************************','********************');
1355 pay_in_utils.trace('p_element_entry_id: ',p_element_entry_id);
1356 pay_in_utils.trace('Effective Date: ', p_effective_date);
1357 pay_in_utils.trace('**************************************************','********************');
1358 END IF;
1359 --
1360 -- Use the dt_api to get the valid values for the update mode
1361 dt_api.find_dt_upd_modes
1362 (p_effective_date => p_effective_date
1363 ,p_base_table_name => 'pay_element_entries_f'
1364 ,p_base_key_column => 'element_entry_id'
1365 ,p_base_key_value => p_element_entry_id
1366 ,p_correction => l_correction
1367 ,p_update => l_update
1368 ,p_update_override => l_update_override
1369 ,p_update_change_insert=> l_update_change_insert);
1370 --
1371 pay_in_utils.set_location(g_debug, l_procedure, 20);
1372 --
1373 -- Check which flag has been set by DT_API.Find_DT_Upd_Modes
1374 -- Correction is always set to true hence check it's value at last
1375 -- as default. If effective start date is not same as effective date, then
1376 -- If any future row exists for element, then Update is false and Update
1377 -- override and Update Change Insert is set to true.
1378 -- If there are no future row exists then Update mode is used.
1379 --
1380 -- No need to use update_change_insert mode as both update_override
1381 -- and update_change_insert are always set to true or false.
1382 IF l_update THEN
1383 l_update_mode := hr_api.g_update;
1384 ELSIF l_update_override THEN
1385 l_update_mode := hr_api.g_update_override;
1386 ELSIF l_correction THEN
1387 l_update_mode := hr_api.g_correction;
1388 ELSE
1389 l_update_mode := hr_api.g_correction;
1390 END IF;
1391 --
1392
1393 IF g_debug THEN
1394 pay_in_utils.trace('**************************************************','********************');
1395 pay_in_utils.trace('l_update_mode : ',l_update_mode);
1396 pay_in_utils.trace('**************************************************','********************');
1397 END IF;
1398
1399 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,30);
1400
1401 RETURN l_update_mode;
1402
1403
1404 END get_update_mode;
1405
1406 --------------------------------------------------------------------------
1407 -- --
1408 -- Name : DECLARE_HOUSE_RENT --
1409 -- Type : PROCEDURE --
1410 -- Access : Public --
1411 -- Description : The procedure is responsible for storing the detials--
1412 -- in 'House Rent Information' element. --
1413 -- --
1414 -- Parameters : --
1415 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
1416 -- p_apr NUMBER --
1417 -- p_may NUMBER --
1418 -- p_jun NUMBER --
1419 -- p_jul NUMBER --
1420 -- p_aug NUMBER --
1421 -- p_sep NUMBER --
1422 -- p_oct NUMBER --
1423 -- p_nov NUMBER --
1424 -- p_dec NUMBER --
1425 -- p_jan NUMBER --
1426 -- p_feb NUMBER --
1427 -- p_mar NUMBER --
1428 -- p_effective_date DATE --
1429 -- OUT : p_warnings BOOLEAN --
1430 -- --
1431 -- Change History : --
1432 --------------------------------------------------------------------------
1433 -- Rev# Date Userid Description --
1434 --------------------------------------------------------------------------
1435 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
1436 --------------------------------------------------------------------------
1437 PROCEDURE declare_house_rent
1438 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
1439 ,p_apr IN NUMBER
1440 ,p_may IN NUMBER
1441 ,p_jun IN NUMBER
1442 ,p_jul IN NUMBER
1443 ,p_aug IN NUMBER
1444 ,p_sep IN NUMBER
1445 ,p_oct IN NUMBER
1446 ,p_nov IN NUMBER
1447 ,p_dec IN NUMBER
1448 ,p_jan IN NUMBER
1449 ,p_feb IN NUMBER
1450 ,p_mar IN NUMBER
1451 ,p_effective_date IN DATE DEFAULT NULL
1452 ,p_warnings OUT NOCOPY BOOLEAN)
1453 IS
1454 --
1455 l_procedure VARCHAR(100);
1456 l_message VARCHAR2(250);
1457 l_input_values t_input_values_tab;
1458 l_element_type_id pay_element_types_f.element_type_id%TYPE;
1459 l_element_link_id pay_element_links_f.element_link_id%TYPE;
1460 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
1461 l_business_group_id per_business_groups.business_group_id%TYPE;
1462 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
1463 l_effective_start_date DATE;
1464 l_effective_end_date DATE;
1465 l_effective_date DATE;
1466 l_assgn_start_date date;
1467 l_warnings VARCHAR2(6);
1468 l_change_date DATE;
1469 l_num number;
1470 l_del_objection_version_number pay_element_entries_f.object_version_number%TYPE;
1471 l_del_effective_start_date DATE;
1472 l_delete_entries varchar2(2);
1473 l_boolean boolean;
1474
1475 --
1476 cursor csr_element_entries(v_element_entry_id pay_element_entries_f.element_entry_id%TYPE
1477 ,v_element_type_id pay_element_types_f.element_type_id%TYPE
1478 , v_change_date DATE) is
1479 select effective_start_date,
1480 OBJECT_VERSION_NUMBER from pay_element_entries_f where
1481 assignment_id = p_assignment_id and
1482 element_type_id = v_element_type_id and
1483 element_entry_id = v_element_entry_id and
1484 (effective_start_Date >= v_change_date or
1485 v_change_date between effective_start_Date and effective_end_date)
1486 order by effective_start_date;
1487
1488
1489 cursor csr_entries (v_element_entry_id pay_element_entries_f.element_entry_id%TYPE
1490 ,v_element_type_id pay_element_types_f.element_type_id%TYPE
1491 , v_date DATE) is
1492 select 1
1493 from pay_element_entries_f where
1494 assignment_id = p_assignment_id and
1495 element_type_id = v_element_type_id and
1496 element_entry_id = v_element_entry_id and
1497 effective_start_date = v_date;
1498
1499 cursor csr_delete_existing_entries (v_element_entry_id pay_element_entries_f.element_entry_id%TYPE
1500 ,v_element_type_id pay_element_types_f.element_type_id%TYPE) is
1501 select effective_start_date,
1502 OBJECT_VERSION_NUMBER from pay_element_entries_f where
1503 assignment_id = p_assignment_id and
1504 element_type_id = v_element_type_id and
1505 element_entry_id = v_element_entry_id and
1506 rownum = 1;
1507
1508 --
1509 BEGIN
1510
1511 fnd_msg_pub.initialize; -- Bug 13767307
1512 l_procedure := g_package || 'declare_house_rent';
1513 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
1514
1515 IF g_debug THEN
1516 pay_in_utils.trace('**************************************************','********************');
1517 pay_in_utils.trace('p_assignment_id ',p_assignment_id);
1518 pay_in_utils.trace('p_apr ',p_apr);
1519 pay_in_utils.trace('p_may ',p_may);
1520 pay_in_utils.trace('p_jun ',p_jun);
1521 pay_in_utils.trace('p_jul ',p_jul);
1522 pay_in_utils.trace('p_aug ',p_aug);
1523 pay_in_utils.trace('p_sep ',p_sep);
1524 pay_in_utils.trace('p_oct ',p_oct);
1525 pay_in_utils.trace('p_nov ',p_nov);
1526 pay_in_utils.trace('p_dec ',p_dec);
1527 pay_in_utils.trace('p_jan ',p_jan);
1528 pay_in_utils.trace('p_feb ',p_feb);
1529 pay_in_utils.trace('p_mar ',p_mar);
1530 pay_in_utils.trace('p_effective_date ',p_effective_date);
1531 pay_in_utils.trace('**************************************************','********************');
1532 END IF;
1533 --
1534 l_change_date := pay_in_utils.get_effective_date(p_effective_date);
1535 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
1536 l_delete_entries := 'N';
1537 --
1538 select min(effective_start_date) into l_assgn_start_date from
1539 per_assignments_f where assignment_id = p_assignment_id
1540 and payroll_id is not null; /* bug: 16341134 */
1541 --
1542 get_entry_details(p_assignment_id => p_assignment_id
1543 ,p_element_name => 'House Rent Information'
1544 ,p_effective_date => l_effective_date
1545 ,p_element_type_id => l_element_type_id
1546 ,p_element_link_id => l_element_link_id
1547 ,p_element_entry_id => l_element_entry_id
1548 ,p_expected_entries => 12
1549 ,p_business_group_id => l_business_group_id
1550 ,p_object_version_number=> l_object_version_number
1551 ,p_input_values => l_input_values
1552 );
1553 --
1554 IF g_debug THEN
1555 pay_in_utils.trace('**************************************************','********************');
1556 pay_in_utils.trace('Element Type ID: ',l_element_type_id);
1557 pay_in_utils.trace('Element Entry ID: ', l_element_entry_id);
1558 pay_in_utils.trace('Business Group ID: ', l_business_group_id);
1559 pay_in_utils.trace('Object Version Number: ', l_object_version_number);
1560 pay_in_utils.trace('**************************************************','********************');
1561 END IF;
1562 --
1563 pay_in_utils.set_location(g_debug, l_procedure, 20);
1564 --
1565 if l_element_entry_id is not null then
1566 open csr_entries(l_element_entry_id,l_element_type_id,greatest(add_months(pay_in_utils.next_tax_year(l_effective_date),-12),l_assgn_start_date));
1567 fetch csr_entries into l_num;
1568 close csr_entries;
1569 if l_num is null then
1570 l_delete_entries := 'Y';
1571 open csr_delete_existing_entries (l_element_entry_id,l_element_type_id);
1572 fetch csr_delete_existing_entries into l_del_effective_start_date, l_del_objection_version_number;
1573 close csr_delete_existing_entries;
1574
1575 pay_element_entry_api.delete_element_entry
1576 (p_validate => FALSE
1577 ,p_datetrack_delete_mode => hr_api.g_zap
1578 ,p_effective_date => l_del_effective_start_date
1579 ,p_element_entry_id => l_element_entry_id
1580 ,p_object_version_number => l_del_objection_version_number
1581 ,p_effective_start_date => l_effective_start_date
1582 ,p_effective_end_date => l_effective_end_date
1583 ,p_delete_warning => l_boolean
1584 );
1585 end if;
1586 end if;
1587
1588
1589 IF (l_element_entry_id is null or l_delete_entries = 'Y') THEN
1590 --
1591 pay_in_utils.set_location(g_debug, l_procedure, 30);
1592 --
1593 -- In this case, we would have to create an element entry to the
1594 -- assignment and return the entry id, the rest would be handled
1595 -- by the update command in the calling procedure.
1596 -- Bug 12808748
1597 l_effective_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-12);
1598 l_effective_date := greatest(l_effective_date,l_assgn_start_date);
1599
1600 pay_element_entry_api.create_element_entry
1601 (p_effective_date => l_effective_date
1602 ,p_business_group_id => l_business_group_id
1603 ,p_assignment_id => p_assignment_id
1604 ,p_element_link_id => l_element_link_id
1605 ,p_entry_type => 'E'
1606 -- April
1607 ,p_input_value_id1 => l_input_values(0).input_value_id
1608 -- May
1609 ,p_input_value_id2 => l_input_values(1).input_value_id
1610 -- June
1611 ,p_input_value_id3 => l_input_values(2).input_value_id
1612 -- July
1613 ,p_input_value_id4 => l_input_values(3).input_value_id
1614 -- August
1615 ,p_input_value_id5 => l_input_values(4).input_value_id
1616 -- September
1617 ,p_input_value_id6 => l_input_values(5).input_value_id
1618 -- October
1619 ,p_input_value_id7 => l_input_values(6).input_value_id
1620 -- November
1621 ,p_input_value_id8 => l_input_values(7).input_value_id
1622 -- December
1623 ,p_input_value_id9 => l_input_values(8).input_value_id
1624 -- January
1625 ,p_input_value_id10 => l_input_values(9).input_value_id
1626 -- February
1627 ,p_input_value_id11 => l_input_values(10).input_value_id
1628 -- March
1629 ,p_input_value_id12 => l_input_values(11).input_value_id
1630 ,p_entry_value1 => p_apr
1631 ,p_entry_value2 => p_may
1632 ,p_entry_value3 => p_jun
1633 ,p_entry_value4 => p_jul
1634 ,p_entry_value5 => p_aug
1635 ,p_entry_value6 => p_sep
1636 ,p_entry_value7 => p_oct
1637 ,p_entry_value8 => p_nov
1638 ,p_entry_value9 => p_dec
1639 ,p_entry_value10 => p_jan
1640 ,p_entry_value11 => p_feb
1641 ,p_entry_value12 => p_mar
1642 ,p_effective_start_date => l_effective_start_date
1643 ,p_effective_end_date => l_effective_end_date
1644 ,p_element_entry_id => l_element_entry_id
1645 ,p_object_version_number => l_object_version_number
1646 ,p_create_warning => p_warnings
1647 );
1648 --
1649 pay_in_utils.set_location(g_debug, l_procedure, 40);
1650 --
1651 -- End date the entry as of the financial year end date
1652 --
1653 delete_declaration
1654 (p_element_entry_id => l_element_entry_id
1655 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
1656 ,p_warnings => l_warnings);
1657 --
1658 ELSE
1659 --
1660 pay_in_utils.set_location(g_debug, l_procedure, 50);
1661 --
1662 -- An element entry for this element already exists we have to
1663 -- update the element entry with the newly submitted date.
1664 --
1665 -- Bug 12808748
1666 if nvl(p_apr,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(0).input_name,l_effective_date),0) then
1667 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-12);
1668 elsif nvl(p_may,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(1).input_name,l_effective_date),0) then
1669 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-11);
1670 elsif nvl(p_jun,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(2).input_name,l_effective_date),0) then
1671 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-10);
1672 elsif nvl(p_jul,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(3).input_name,l_effective_date),0) then
1673 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-9);
1674 elsif nvl(p_aug,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(4).input_name,l_effective_date),0) then
1675 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-8);
1676 elsif nvl(p_sep,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(5).input_name,l_effective_date),0) then
1677 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-7);
1678 elsif nvl(p_oct,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(6).input_name,l_effective_date),0) then
1679 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-6);
1680 elsif nvl(p_nov,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(7).input_name,l_effective_date),0) then
1681 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-5);
1682 elsif nvl(p_dec,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(8).input_name,l_effective_date),0) then
1683 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-4);
1684 elsif nvl(p_jan,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(9).input_name,l_effective_date),0) then
1685 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-3);
1686 elsif nvl(p_feb,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(10).input_name,l_effective_date),0) then
1687 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-2);
1688 elsif nvl(p_mar,0) <> nvl(pay_in_utils.get_ee_value(l_element_entry_id,l_input_values(11).input_name,l_effective_date),0) then
1689 l_change_date := add_months(pay_in_utils.next_tax_year(l_effective_date),-1);
1690 end if;
1691
1692 if get_update_mode(l_element_entry_id,l_effective_date) <> 'CORRECTION' then
1693
1694 pay_element_entry_api.update_element_entry
1695 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
1696 ,l_effective_date)
1697 ,p_effective_date => l_effective_date
1698 ,p_business_group_id => l_business_group_id
1699 ,p_element_entry_id => l_element_entry_id
1700 ,p_object_version_number => l_object_version_number
1701 -- April
1702 ,p_input_value_id1 => l_input_values(0).input_value_id
1703 -- May
1704 ,p_input_value_id2 => l_input_values(1).input_value_id
1705 -- June
1706 ,p_input_value_id3 => l_input_values(2).input_value_id
1707 -- July
1708 ,p_input_value_id4 => l_input_values(3).input_value_id
1709 -- August
1710 ,p_input_value_id5 => l_input_values(4).input_value_id
1711 -- September
1712 ,p_input_value_id6 => l_input_values(5).input_value_id
1713 -- October
1714 ,p_input_value_id7 => l_input_values(6).input_value_id
1715 -- November
1716 ,p_input_value_id8 => l_input_values(7).input_value_id
1717 -- December
1718 ,p_input_value_id9 => l_input_values(8).input_value_id
1719 -- January
1720 ,p_input_value_id10 => l_input_values(9).input_value_id
1721 -- February
1722 ,p_input_value_id11 => l_input_values(10).input_value_id
1723 -- March
1724 ,p_input_value_id12 => l_input_values(11).input_value_id
1725 ,p_entry_value1 => p_apr
1726 ,p_entry_value2 => p_may
1727 ,p_entry_value3 => p_jun
1728 ,p_entry_value4 => p_jul
1729 ,p_entry_value5 => p_aug
1730 ,p_entry_value6 => p_sep
1731 ,p_entry_value7 => p_oct
1732 ,p_entry_value8 => p_nov
1733 ,p_entry_value9 => p_dec
1734 ,p_entry_value10 => p_jan
1735 ,p_entry_value11 => p_feb
1736 ,p_entry_value12 => p_mar
1737 ,p_effective_start_date => l_effective_start_date
1738 ,p_effective_end_date => l_effective_end_date
1739 ,p_update_warning => p_warnings
1740 );
1741 end if;
1742
1743 for i in csr_element_entries (l_element_entry_id,l_element_type_id,l_change_date) loop
1744
1745 pay_element_entry_api.update_element_entry
1746 (p_datetrack_update_mode => 'CORRECTION'
1747 ,p_effective_date => i.effective_start_date
1748 ,p_business_group_id => l_business_group_id
1749 ,p_element_entry_id => l_element_entry_id
1750 ,p_object_version_number => i.OBJECT_VERSION_NUMBER
1751 -- April
1752 ,p_input_value_id1 => l_input_values(0).input_value_id
1753 -- May
1754 ,p_input_value_id2 => l_input_values(1).input_value_id
1755 -- June
1756 ,p_input_value_id3 => l_input_values(2).input_value_id
1757 -- July
1758 ,p_input_value_id4 => l_input_values(3).input_value_id
1759 -- August
1760 ,p_input_value_id5 => l_input_values(4).input_value_id
1761 -- September
1762 ,p_input_value_id6 => l_input_values(5).input_value_id
1763 -- October
1764 ,p_input_value_id7 => l_input_values(6).input_value_id
1765 -- November
1766 ,p_input_value_id8 => l_input_values(7).input_value_id
1767 -- December
1768 ,p_input_value_id9 => l_input_values(8).input_value_id
1769 -- January
1770 ,p_input_value_id10 => l_input_values(9).input_value_id
1771 -- February
1772 ,p_input_value_id11 => l_input_values(10).input_value_id
1773 -- March
1774 ,p_input_value_id12 => l_input_values(11).input_value_id
1775 ,p_entry_value1 => p_apr
1776 ,p_entry_value2 => p_may
1777 ,p_entry_value3 => p_jun
1778 ,p_entry_value4 => p_jul
1779 ,p_entry_value5 => p_aug
1780 ,p_entry_value6 => p_sep
1781 ,p_entry_value7 => p_oct
1782 ,p_entry_value8 => p_nov
1783 ,p_entry_value9 => p_dec
1784 ,p_entry_value10 => p_jan
1785 ,p_entry_value11 => p_feb
1786 ,p_entry_value12 => p_mar
1787 ,p_effective_start_date => l_effective_start_date
1788 ,p_effective_end_date => l_effective_end_date
1789 ,p_update_warning => p_warnings
1790 );
1791 --
1792 end loop;
1793
1794 -- End of Bug 12808748
1795
1796 pay_in_utils.set_location(g_debug, l_procedure, 60);
1797 --
1798 IF l_effective_end_date <> (pay_in_utils.next_tax_year(l_effective_date)-1)
1799 THEN
1800 --
1801 -- End date the entry as of the financial year end date
1802 --
1803 delete_declaration
1804 (p_element_entry_id =>l_element_entry_id
1805 ,p_effective_date =>pay_in_utils.next_tax_year(l_effective_date)-1
1806 ,p_warnings =>l_warnings);
1807 --
1808 END IF;
1809 --
1810 END IF;
1811 --
1812 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
1813 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
1814 pay_in_utils.set_location(g_debug,l_procedure,70);
1815
1816 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,80);
1817 --
1818 EXCEPTION
1819 WHEN OTHERS THEN
1820 fnd_msg_pub.add_exc_msg
1821 (p_pkg_name => g_package
1822 ,p_procedure_name => 'declare_house_rent'
1823 ,p_error_text => substr(sqlerrm, 1, 240)
1824 );
1825 --
1826 END declare_house_rent;
1827
1828 --------------------------------------------------------------------------
1829 -- --
1830 -- Name : DECLARE_CHAPTER6A --
1831 -- Type : PROCEDURE --
1832 -- Access : Public --
1833 -- Description : The procedure calculates the value of permanent --
1834 -- disability 80u and then stores the detials in the --
1835 -- 'Deductions under Chapter VI A' element. --
1836 -- --
1837 -- Parameters : --
1838 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
1839 -- p_pension_fund_80ccc NUMBER --
1840 -- p_medical_insurance_prem_80d NUMBER --
1841 -- p_sec_80ddb_senior_citizen VARCHAR2 --
1842 -- p_disease_treatment_80ddb NUMBER --
1843 -- p_sec_80d_senior_citizen VARCHAR2 --
1844 -- p_higher_education_loan_80e NUMBER --
1845 -- p_claim_exemp_under_sec_80gg VARCHAR2 --
1846 -- p_donation_for_research_80gga NUMBER --
1847 -- p_int_on_gen_investment_80L NUMBER --
1848 -- p_int_on_securities_80L NUMBER --
1849 -- p_effective_date DATE --
1850 -- OUT : p_warnings BOOLEAN --
1851 -- --
1852 -- Change History : --
1853 --------------------------------------------------------------------------
1854 -- Rev# Date Userid Description --
1855 --------------------------------------------------------------------------
1856 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
1857 --------------------------------------------------------------------------
1858 PROCEDURE declare_chapter6a
1859 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
1860 ,p_pension_fund_80ccc IN NUMBER
1861 ,p_medical_insurance_prem_80d IN NUMBER
1862 ,p_sec_80ddb_senior_citizen IN VARCHAR2
1863 ,p_disease_treatment_80ddb IN NUMBER
1864 ,p_sec_80d_senior_citizen IN VARCHAR2
1865 ,p_higher_education_loan_80e IN NUMBER
1866 ,p_claim_exemp_under_sec_80gg IN VARCHAR2
1867 ,p_donation_for_research_80gga IN NUMBER
1868 ,p_int_on_gen_investment_80L IN NUMBER
1869 ,p_int_on_securities_80L IN NUMBER
1870 ,p_effective_date IN DATE DEFAULT NULL
1871 ,p_warnings OUT NOCOPY BOOLEAN)
1872 IS
1873 --
1874 l_procedure VARCHAR(100);
1875 l_message VARCHAR2(250);
1876 l_disability_proof VARCHAR2(2);
1877 l_permanent_disability_80u NUMBER;
1878 l_input_values t_input_values_tab;
1879 l_element_type_id pay_element_types_f.element_type_id%TYPE;
1880 l_element_link_id pay_element_links_f.element_link_id%TYPE;
1881 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
1882 l_business_group_id per_business_groups.business_group_id%TYPE;
1883 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
1884 l_effective_start_date DATE;
1885 l_effective_end_date DATE;
1886 l_effective_date DATE;
1887 l_endation_date DATE;
1888 l_category VARCHAR2(10);
1889 l_degree NUMBER;
1890 l_warnings VARCHAR2(6);
1891 --
1892 CURSOR get_permanent_disability_80u
1893 IS
1894 SELECT global_value
1895 FROM ff_globals_f
1896 WHERE global_name = 'IN_PERMANENT_PHYSICAL_DISABILITY_80U'
1897 AND legislation_code = g_legislation_code;
1898 BEGIN
1899 fnd_msg_pub.initialize; -- Bug 13767307
1900 l_procedure := g_package || 'declare_chapter6a';
1901 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
1902
1903 IF g_debug THEN
1904 pay_in_utils.trace('**************************************************','********************');
1905 pay_in_utils.trace('p_assignment_id',p_assignment_id);
1906 pay_in_utils.trace('p_pension_fund_80ccc',p_pension_fund_80ccc);
1907 pay_in_utils.trace('p_medical_insurance_prem_80d',p_medical_insurance_prem_80d);
1908 pay_in_utils.trace('p_sec_80ddb_senior_citizen',p_sec_80ddb_senior_citizen);
1909 pay_in_utils.trace('p_disease_treatment_80ddb',p_disease_treatment_80ddb);
1910 pay_in_utils.trace('p_sec_80d_senior_citizen',p_sec_80d_senior_citizen);
1911 pay_in_utils.trace('p_higher_education_loan_80e',p_higher_education_loan_80e);
1912 pay_in_utils.trace('p_claim_exemp_under_sec_80gg',p_claim_exemp_under_sec_80gg);
1913 pay_in_utils.trace('p_donation_for_research_80gga',p_donation_for_research_80gga);
1914 pay_in_utils.trace('p_int_on_gen_investment_80L',p_int_on_gen_investment_80L);
1915 pay_in_utils.trace('p_int_on_securities_80L',p_int_on_securities_80L);
1916 pay_in_utils.trace('p_effective_date',p_effective_date);
1917 pay_in_utils.trace('**************************************************','********************');
1918 END IF;
1919 --
1920 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
1921 --
1922 -- Permanent Disability 80u Calculation
1923 -- Permanent disability is calculated based on the details
1924 -- entered in per_disabilities_f by the user. If the
1925 -- disability proof is submitted then only the exemption
1926 -- amount is entered i.e., when l_disability_proof = 'Y'.
1927 l_permanent_disability_80u :=
1928 pay_in_tax_utils.get_disability_details
1929 (p_assignment_id => p_assignment_id
1930 ,p_date_earned => l_effective_date
1931 ,p_disable_catg => l_category
1932 ,p_disable_degree=> l_degree
1933 ,p_disable_proof => l_disability_proof
1934 );
1935 --
1936 l_permanent_disability_80u := 0;
1937 --
1938 IF (l_disability_proof = 'Y' AND l_degree >= 40 AND l_category IN ('BLIND','SA_VIS_IMP','LC','SA_HEA_IMP','LD','07','MI','AU','CP','MD'))
1939 THEN
1940 --
1941 OPEN get_permanent_disability_80u;
1942 FETCH get_permanent_disability_80u INTO l_permanent_disability_80u;
1943 CLOSE get_permanent_disability_80u;
1944 --
1945 END IF;
1946 --
1947
1948 get_entry_details(p_assignment_id => p_assignment_id
1949 ,p_element_name => 'Deductions under Chapter VI A'
1950 ,p_effective_date => l_effective_date
1951 ,p_element_type_id => l_element_type_id
1952 ,p_element_link_id => l_element_link_id
1953 ,p_element_entry_id => l_element_entry_id
1954 ,p_expected_entries => 11
1955 ,p_business_group_id => l_business_group_id
1956 ,p_object_version_number=> l_object_version_number
1957 ,p_input_values => l_input_values
1958 );
1959 --
1960 IF g_debug THEN
1961 pay_in_utils.trace('**************************************************','********************');
1962 pay_in_utils.trace('Element Type ID: ',l_element_type_id);
1963 pay_in_utils.trace('Element Entry ID: ',l_element_entry_id);
1964 pay_in_utils.trace('Business Group ID: ',l_business_group_id);
1965 pay_in_utils.trace('Object Version Number: ',l_object_version_number);
1966 pay_in_utils.trace('**************************************************','********************');
1967 END IF;
1968 --
1969 pay_in_utils.set_location(g_debug, l_procedure, 20);
1970 --
1971 IF l_element_entry_id is null THEN
1972 --
1973 pay_in_utils.set_location(g_debug, l_procedure, 30);
1974 --
1975 --
1976 -- In this case, we would have to create an element entry to the
1977 -- assignment and return the entry id, the rest would be handled
1978 -- by the update command in the calling procedure.
1979 --
1980 pay_element_entry_api.create_element_entry
1981 (p_effective_date => l_effective_date
1982 ,p_business_group_id => l_business_group_id
1983 ,p_assignment_id => p_assignment_id
1984 ,p_element_link_id => l_element_link_id
1985 ,p_entry_type => 'E'
1986 --Pension Fund 80CCC
1987 ,p_input_value_id1 => l_input_values(0).input_value_id
1988 --Medical Insurance Premium 80D
1989 ,p_input_value_id2 => l_input_values(1).input_value_id
1990 --Sec 80DDB Cover Senior Citizen
1991 ,p_input_value_id3 => l_input_values(2).input_value_id
1992 --Disease Treatment 80DDB
1993 ,p_input_value_id4 => l_input_values(3).input_value_id
1994 --Sec 80D Cover Senior Citizen
1995 ,p_input_value_id5 => l_input_values(4).input_value_id
1996 --Higher Education Loan 80E
1997 ,p_input_value_id6 => l_input_values(5).input_value_id
1998 --Claim Exemption under Sec 80GG
1999 ,p_input_value_id7 => l_input_values(6).input_value_id
2000 --Donation for Research 80GGA
2001 ,p_input_value_id8 => l_input_values(7).input_value_id
2002 --Int on Gen Investment 80L
2003 ,p_input_value_id9 => l_input_values(8).input_value_id
2004 --Int on Securities 80L
2005 ,p_input_value_id10 => l_input_values(9).input_value_id
2006 --Permanent Disability 80U
2007 ,p_input_value_id11 => l_input_values(10).input_value_id
2008 ,p_entry_value1 => p_pension_fund_80ccc
2009 ,p_entry_value2 => p_medical_insurance_prem_80d
2010 ,p_entry_value3 => p_sec_80ddb_senior_citizen
2011 ,p_entry_value4 => p_disease_treatment_80ddb
2012 ,p_entry_value5 => p_sec_80d_senior_citizen
2013 ,p_entry_value6 => p_higher_education_loan_80e
2014 ,p_entry_value7 => p_claim_exemp_under_sec_80gg
2015 ,p_entry_value8 => p_donation_for_research_80gga
2016 ,p_entry_value9 => p_int_on_gen_investment_80L
2017 ,p_entry_value10 => p_int_on_securities_80L
2018 ,p_entry_value11 => l_permanent_disability_80u
2019 ,p_effective_start_date => l_effective_start_date
2020 ,p_effective_end_date => l_effective_end_date
2021 ,p_element_entry_id => l_element_entry_id
2022 ,p_object_version_number => l_object_version_number
2023 ,p_create_warning => p_warnings
2024 );
2025 --
2026 pay_in_utils.set_location(g_debug, l_procedure, 40);
2027 --
2028 -- End date the entry as of the financial year end date
2029 --
2030 IF l_disability_proof = 'N' THEN
2031 --
2032 --
2033 pay_in_utils.set_location(g_debug, l_procedure, 45);
2034 --
2035 delete_declaration
2036 (p_element_entry_id => l_element_entry_id
2037 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
2038 ,p_warnings => l_warnings);
2039 --
2040 END IF;
2041 --
2042 ELSE
2043 --
2044 pay_in_utils.set_location(g_debug, l_procedure, 50);
2045 --
2046 --
2047 -- An element entry for this element already exists we have to
2048 -- update the element entry with the newly submitted date.
2049 --
2050 pay_element_entry_api.update_element_entry
2051 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
2052 ,l_effective_date)
2053 ,p_effective_date => l_effective_date
2054 ,p_business_group_id => l_business_group_id
2055 ,p_element_entry_id => l_element_entry_id
2056 ,p_object_version_number => l_object_version_number
2057 --Pension Fund 80CCC
2058 ,p_input_value_id1 => l_input_values(0).input_value_id
2059 --Medical Insurance Premium 80D
2060 ,p_input_value_id2 => l_input_values(1).input_value_id
2061 --Sec 80DDB Cover Senior Citizen
2062 ,p_input_value_id3 => l_input_values(2).input_value_id
2063 --Disease Treatment 80DDB
2064 ,p_input_value_id4 => l_input_values(3).input_value_id
2065 --Sec 80D Cover Senior Citizen
2066 ,p_input_value_id5 => l_input_values(4).input_value_id
2067 --Higher Education Loan 80E
2068 ,p_input_value_id6 => l_input_values(5).input_value_id
2069 --Claim Exemption under Sec 80GG
2070 ,p_input_value_id7 => l_input_values(6).input_value_id
2071 --Donation for Research 80GGA
2072 ,p_input_value_id8 => l_input_values(7).input_value_id
2073 --Int on Gen Investment 80L
2074 ,p_input_value_id9 => l_input_values(8).input_value_id
2075 --Int on Securities 80L
2076 ,p_input_value_id10 => l_input_values(9).input_value_id
2077 ,p_entry_value1 => p_pension_fund_80ccc
2078 ,p_entry_value2 => p_medical_insurance_prem_80d
2079 ,p_entry_value3 => p_sec_80ddb_senior_citizen
2080 ,p_entry_value4 => p_disease_treatment_80ddb
2081 ,p_entry_value5 => p_sec_80d_senior_citizen
2082 ,p_entry_value6 => p_higher_education_loan_80e
2083 ,p_entry_value7 => p_claim_exemp_under_sec_80gg
2084 ,p_entry_value8 => p_donation_for_research_80gga
2085 ,p_entry_value9 => p_int_on_gen_investment_80L
2086 ,p_entry_value10 => p_int_on_securities_80L
2087 ,p_effective_start_date => l_effective_start_date
2088 ,p_effective_end_date => l_effective_end_date
2089 ,p_update_warning => p_warnings
2090 );
2091 --
2092 --
2093 pay_in_utils.set_location(g_debug, l_procedure, 60);
2094 --
2095 l_endation_date := pay_in_utils.next_tax_year(l_effective_date);
2096 --
2097 IF l_effective_end_date <> (l_endation_date-1)
2098 THEN
2099 --
2100 -- End date the entry as of the financial year end date
2101 --
2102 pay_in_utils.set_location(g_debug, l_procedure, 70);
2103 --
2104 IF l_disability_proof = 'Y' THEN
2105 --
2106 --
2107 pay_in_utils.set_location(g_debug, l_procedure, 80);
2108 --
2109 pay_element_entry_api.update_element_entry
2110 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
2111 ,l_endation_date)
2112 ,p_effective_date => l_endation_date
2113 ,p_business_group_id => l_business_group_id
2114 ,p_element_entry_id => l_element_entry_id
2115 ,p_object_version_number => l_object_version_number
2116 --Pension Fund 80CCC
2117 ,p_input_value_id1 => l_input_values(0).input_value_id
2118 --Medical Insurance Premium 80D
2119 ,p_input_value_id2 => l_input_values(1).input_value_id
2120 --Sec 80DDB Cover Senior Citizen
2121 ,p_input_value_id3 => l_input_values(2).input_value_id
2122 --Disease Treatment 80DDB
2123 ,p_input_value_id4 => l_input_values(3).input_value_id
2124 --Sec 80D Cover Senior Citizen
2125 ,p_input_value_id5 => l_input_values(4).input_value_id
2126 --Higher Education Loan 80E
2127 ,p_input_value_id6 => l_input_values(5).input_value_id
2128 --Claim Exemption under Sec 80GG
2129 ,p_input_value_id7 => l_input_values(6).input_value_id
2130 --Donation for Research 80GGA
2131 ,p_input_value_id8 => l_input_values(7).input_value_id
2132 --Int on Gen Investment 80L
2133 ,p_input_value_id9 => l_input_values(8).input_value_id
2134 --Int on Securities 80L
2135 ,p_input_value_id10 => l_input_values(9).input_value_id
2136 ,p_entry_value1 => 0
2137 ,p_entry_value2 => 0
2138 ,p_entry_value3 => 'N'
2139 ,p_entry_value4 => 0
2140 ,p_entry_value5 => 'N'
2141 ,p_entry_value6 => 0
2142 ,p_entry_value7 => 'N'
2143 ,p_entry_value8 => 0
2144 ,p_entry_value9 => 0
2145 ,p_entry_value10 => 0
2146 ,p_effective_start_date => l_effective_start_date
2147 ,p_effective_end_date => l_effective_end_date
2148 ,p_update_warning => p_warnings
2149 );
2150 --
2151 ELSE
2152 --
2153 pay_in_utils.set_location(g_debug, l_procedure, 90);
2154 --
2155 delete_declaration
2156 (p_element_entry_id => l_element_entry_id
2157 ,p_effective_date => l_endation_date-1
2158 ,p_warnings => l_warnings);
2159 --
2160 END IF;
2161 --
2162 END IF;
2163 --
2164 END IF;
2165 --
2166 IF g_debug THEN
2167 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
2168 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
2169 END IF;
2170
2171 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
2172 --
2173 EXCEPTION
2174 WHEN OTHERS THEN
2175 fnd_msg_pub.add_exc_msg
2176 (p_pkg_name => g_package
2177 ,p_procedure_name => 'declare_chapter6a'
2178 ,p_error_text => substr(sqlerrm, 1, 240)
2179 );
2180 --
2181 END declare_chapter6a;
2182
2183 --------------------------------------------------------------------------
2184 -- --
2185 -- Name : DECLARE_SECTION88 --
2186 -- Type : PROCEDURE --
2187 -- Access : Public --
2188 -- Description : The procedure is responsible for storing the detials--
2189 -- in 'Rebates under Section 88' element. --
2190 -- --
2191 -- Parameters : --
2192 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
2193 -- p_public_provident_fund NUMBER --
2194 -- p_post_office_savings_scheme NUMBER --
2195 -- p_deposit_in_nsc_vi_issue NUMBER --
2196 -- p_deposit_in_nsc_viii_issue NUMBER --
2197 -- p_interest_on_nsc_reinvested NUMBER --
2198 -- p_house_loan_repayment NUMBER --
2199 -- p_notified_mutual_fund_or_uti NUMBER --
2200 -- p_national_housing_bank_scheme NUMBER --
2201 -- p_unit_linked_insurance_plan NUMBER --
2202 -- p_notified_annuity_plan NUMBER --
2203 -- p_notified_pension_fund NUMBER --
2204 -- p_public_sector_company_scheme NUMBER --
2205 -- p_approved_superannuation_fund NUMBER --
2206 -- p_infrastructure_bond NUMBER --
2207 -- p_effective_date DATE --
2208 -- OUT : p_warnings BOOLEAN --
2209 -- --
2210 -- Change History : --
2211 --------------------------------------------------------------------------
2212 -- Rev# Date Userid Description --
2213 --------------------------------------------------------------------------
2214 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
2215 -- 1.1 25-Apr-2005 VGSRINIV Nulled out for stat update(Bug 4251141)--
2216 --------------------------------------------------------------------------
2217 PROCEDURE declare_section88
2218 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
2219 ,p_deferred_annuity IN NUMBER
2220 ,p_senior_citizen_sav_scheme IN NUMBER
2221 ,p_public_provident_fund IN NUMBER
2222 ,p_post_office_savings_scheme IN NUMBER
2223 ,p_deposit_in_nsc_vi_issue IN NUMBER
2224 ,p_deposit_in_nsc_viii_issue IN NUMBER
2225 ,p_interest_on_nsc_reinvested IN NUMBER
2226 ,p_house_loan_repayment IN NUMBER
2227 ,p_notified_mutual_fund_or_uti IN NUMBER
2228 ,p_national_housing_bank_scheme IN NUMBER
2229 ,p_unit_linked_insurance_plan IN NUMBER
2230 ,p_notified_annuity_plan IN NUMBER
2231 ,p_notified_pension_fund IN NUMBER
2232 ,p_public_sector_company_scheme IN NUMBER
2233 ,p_approved_superannuation_fund IN NUMBER
2234 ,p_infrastructure_bond IN NUMBER
2235 ,p_effective_date IN DATE DEFAULT NULL
2236 ,p_warnings OUT NOCOPY BOOLEAN)
2237 IS
2238 --
2239 l_procedure VARCHAR(100);
2240 l_message VARCHAR2(250);
2241 l_input_values t_input_values_tab;
2242 l_element_type_id pay_element_types_f.element_type_id%TYPE;
2243 l_element_link_id pay_element_links_f.element_link_id%TYPE;
2244 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
2245 l_business_group_id per_business_groups.business_group_id%TYPE;
2246 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
2247 l_effective_start_date DATE;
2248 l_effective_end_date DATE;
2249 l_effective_date DATE;
2250 l_warnings VARCHAR2(6);
2251 --
2252 BEGIN
2253 fnd_msg_pub.initialize; -- Bug 13767307
2254 l_procedure := g_package || 'declare_section88';
2255 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
2256
2257 IF g_debug THEN
2258 pay_in_utils.trace('**************************************************','********************');
2259 pay_in_utils.trace('p_assignment_id',p_assignment_id);
2260 pay_in_utils.trace('p_deferred_annuity',p_deferred_annuity);
2261 pay_in_utils.trace('p_senior_citizen_sav_scheme',p_senior_citizen_sav_scheme);
2262 pay_in_utils.trace('p_public_provident_fund',p_public_provident_fund);
2263 pay_in_utils.trace('p_post_office_savings_scheme',p_post_office_savings_scheme);
2264 pay_in_utils.trace('p_deposit_in_nsc_vi_issue',p_deposit_in_nsc_vi_issue);
2265 pay_in_utils.trace('p_deposit_in_nsc_viii_issue',p_deposit_in_nsc_viii_issue);
2266 pay_in_utils.trace('p_interest_on_nsc_reinvested',p_interest_on_nsc_reinvested);
2267 pay_in_utils.trace('p_house_loan_repayment',p_house_loan_repayment);
2268 pay_in_utils.trace('p_notified_mutual_fund_or_uti',p_notified_mutual_fund_or_uti);
2269 pay_in_utils.trace('p_national_housing_bank_scheme',p_national_housing_bank_scheme);
2270 pay_in_utils.trace('p_unit_linked_insurance_plan',p_unit_linked_insurance_plan);
2271 pay_in_utils.trace('p_notified_annuity_plan',p_notified_annuity_plan);
2272 pay_in_utils.trace('p_notified_pension_fund',p_notified_pension_fund);
2273 pay_in_utils.trace('p_public_sector_company_scheme',p_public_sector_company_scheme);
2274 pay_in_utils.trace('p_approved_superannuation_fund',p_approved_superannuation_fund);
2275 pay_in_utils.trace('p_infrastructure_bond',p_infrastructure_bond);
2276 pay_in_utils.trace('p_effective_date',p_effective_date);
2277 pay_in_utils.trace('**************************************************','********************');
2278 END IF;
2279
2280
2281 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,20);
2282 --
2283 EXCEPTION
2284 WHEN OTHERS THEN
2285 fnd_msg_pub.add_exc_msg
2286 (p_pkg_name => g_package
2287 ,p_procedure_name => 'declare_section88'
2288 ,p_error_text => substr(sqlerrm, 1, 240)
2289 );
2290 --
2291 END declare_section88;
2292
2293 --------------------------------------------------------------------------
2294 -- --
2295 -- Name : DECLARE_OTHER_INCOME --
2296 -- Type : PROCEDURE --
2297 -- Access : Public --
2298 -- Description : The procedure is responsible for storing the --
2299 -- detials in 'Other Income' element. --
2300 -- --
2301 -- Parameters : --
2302 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
2303 -- p_income_from_house_property NUMBER --
2304 -- p_profit_and_gain_from_busines NUMBER --
2305 -- p_long_term_capital_gain NUMBER --
2306 -- p_short_term_capital_gain NUMBER --
2307 -- p_income_from_any_other_source NUMBER --
2308 -- p_tds_paid_on_other_income NUMBER --
2309 -- p_effective_date DATE --
2310 -- OUT : p_warnings BOOLEAN --
2311 -- --
2312 -- Change History : --
2313 --------------------------------------------------------------------------
2314 -- Rev# Date Userid Description --
2315 --------------------------------------------------------------------------
2316 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
2317 --------------------------------------------------------------------------
2318 PROCEDURE declare_other_income
2319 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
2320 ,p_income_from_house_property IN NUMBER
2321 ,p_profit_and_gain_from_busines IN NUMBER
2322 ,p_long_term_capital_gain IN NUMBER
2323 ,p_short_term_capital_gain IN NUMBER
2324 ,p_income_from_any_other_source IN NUMBER
2325 ,p_tds_paid_on_other_income IN NUMBER
2326 ,p_interest_on_deposits IN NUMBER
2327 ,p_effective_date IN DATE DEFAULT NULL
2328 ,p_warnings OUT NOCOPY BOOLEAN)
2329 IS
2330 --
2331 l_procedure VARCHAR(100);
2332 l_message VARCHAR2(250);
2333 l_input_values t_input_values_tab;
2334 l_element_type_id pay_element_types_f.element_type_id%TYPE;
2335 l_element_link_id pay_element_links_f.element_link_id%TYPE;
2336 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
2337 l_business_group_id per_business_groups.business_group_id%TYPE;
2338 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
2339 l_effective_start_date DATE;
2340 l_effective_end_date DATE;
2341 l_effective_date DATE;
2342 l_warnings VARCHAR2(6);
2343 --
2344 BEGIN
2345 fnd_msg_pub.initialize; -- Bug 13767307
2346 l_procedure := g_package || 'declare_other_income';
2347 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
2348
2349 IF g_debug THEN
2350 pay_in_utils.trace('**************************************************','********************');
2351 pay_in_utils.trace('p_assignment_id',p_assignment_id);
2352 pay_in_utils.trace('p_income_from_house_property ',p_income_from_house_property );
2353 pay_in_utils.trace('p_profit_and_gain_from_busines',p_profit_and_gain_from_busines);
2354 pay_in_utils.trace('p_long_term_capital_gain ',p_long_term_capital_gain );
2355 pay_in_utils.trace('p_short_term_capital_gain ',p_short_term_capital_gain);
2356 pay_in_utils.trace('p_income_from_any_other_source',p_income_from_any_other_source);
2357 pay_in_utils.trace('p_tds_paid_on_other_income ',p_tds_paid_on_other_income);
2358 pay_in_utils.trace('p_interest_on_deposits ',p_interest_on_deposits);
2359 pay_in_utils.trace('**************************************************','********************');
2360 END IF;
2361 --
2362 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
2363 --
2364 get_entry_details(p_assignment_id => p_assignment_id
2365 ,p_element_name => 'Other Income'
2366 ,p_effective_date => l_effective_date
2367 ,p_element_type_id => l_element_type_id
2368 ,p_element_link_id => l_element_link_id
2369 ,p_element_entry_id => l_element_entry_id
2370 ,p_expected_entries => 7
2371 ,p_business_group_id => l_business_group_id
2372 ,p_object_version_number=> l_object_version_number
2373 ,p_input_values => l_input_values
2374 );
2375 --
2376 IF g_debug THEN
2377 pay_in_utils.trace('Element Type ID: ', l_element_type_id);
2378 pay_in_utils.trace('Element Entry ID: ', l_element_entry_id);
2379 pay_in_utils.trace('Business Group ID: ', l_business_group_id);
2380 pay_in_utils.trace('Object Version Number: ', l_object_version_number);
2381 pay_in_utils.set_location(g_debug,l_procedure,20);
2382 END IF;
2383 --
2384 pay_in_utils.set_location(g_debug, l_procedure, 20);
2385 --
2386 IF l_element_entry_id is null THEN
2387 --
2388 pay_in_utils.set_location(g_debug, l_procedure, 30);
2389 --
2390 --
2391 -- In this case, we would have to create an element entry to the
2392 -- assignment and return the entry id, the rest would be handled
2393 -- by the update command in the calling procedure.
2394 --
2395 pay_element_entry_api.create_element_entry
2396 (p_effective_date => l_effective_date
2397 ,p_business_group_id => l_business_group_id
2398 ,p_assignment_id => p_assignment_id
2399 ,p_element_link_id => l_element_link_id
2400 ,p_entry_type => 'E'
2401 -- Income from House Property
2402 ,p_input_value_id1 => l_input_values(0).input_value_id
2403 -- Profit and Gain from Business
2404 ,p_input_value_id2 => l_input_values(1).input_value_id
2405 -- Long Term Capital Gain
2406 ,p_input_value_id3 => l_input_values(2).input_value_id
2407 -- Short Term Capital Gain
2408 ,p_input_value_id4 => l_input_values(3).input_value_id
2409 -- Income from any other sources
2410 ,p_input_value_id5 => l_input_values(4).input_value_id
2411 -- TDS Paid on Other Income
2412 ,p_input_value_id6 => l_input_values(5).input_value_id
2413 ,p_input_value_id7 => l_input_values(6).input_value_id
2414 ,p_entry_value1 => p_income_from_house_property
2415 ,p_entry_value2 => p_profit_and_gain_from_busines
2416 ,p_entry_value3 => p_long_term_capital_gain
2417 ,p_entry_value4 => p_short_term_capital_gain
2418 ,p_entry_value5 => p_income_from_any_other_source
2419 ,p_entry_value6 => p_tds_paid_on_other_income
2420 ,p_entry_value7 => p_interest_on_deposits
2421 ,p_effective_start_date => l_effective_start_date
2422 ,p_effective_end_date => l_effective_end_date
2423 ,p_element_entry_id => l_element_entry_id
2424 ,p_object_version_number => l_object_version_number
2425 ,p_create_warning => p_warnings
2426 );
2427 --
2428 pay_in_utils.set_location(g_debug, l_procedure, 40);
2429 --
2430 -- End date the entry as of the financial year end date
2431 --
2432 delete_declaration
2433 (p_element_entry_id => l_element_entry_id
2434 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
2435 ,p_warnings => l_warnings);
2436 --
2437 ELSE
2438 --
2439 pay_in_utils.set_location(g_debug, l_procedure, 50);
2440 --
2441 --
2442 -- An element entry for this element already exists we have to
2443 -- update the element entry with the newly submitted date.
2444 --
2445 pay_element_entry_api.update_element_entry
2446 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
2447 ,l_effective_date)
2448 ,p_effective_date => l_effective_date
2449 ,p_business_group_id => l_business_group_id
2450 ,p_element_entry_id => l_element_entry_id
2451 ,p_object_version_number => l_object_version_number
2452 -- Income from House Property
2453 ,p_input_value_id1 => l_input_values(0).input_value_id
2454 -- Profit and Gain from Business
2455 ,p_input_value_id2 => l_input_values(1).input_value_id
2456 -- Long Term Capital Gain
2457 ,p_input_value_id3 => l_input_values(2).input_value_id
2458 -- Short Term Capital Gain
2459 ,p_input_value_id4 => l_input_values(3).input_value_id
2460 -- Income from any other sources
2461 ,p_input_value_id5 => l_input_values(4).input_value_id
2462 -- TDS Paid on Other Income
2463 ,p_input_value_id6 => l_input_values(5).input_value_id
2464 ,p_input_value_id7 => l_input_values(6).input_value_id
2465 ,p_entry_value1 => p_income_from_house_property
2466 ,p_entry_value2 => p_profit_and_gain_from_busines
2467 ,p_entry_value3 => p_long_term_capital_gain
2468 ,p_entry_value4 => p_short_term_capital_gain
2469 ,p_entry_value5 => p_income_from_any_other_source
2470 ,p_entry_value6 => p_tds_paid_on_other_income
2471 ,p_entry_value7 => p_interest_on_deposits
2472 ,p_effective_start_date => l_effective_start_date
2473 ,p_effective_end_date => l_effective_end_date
2474 ,p_update_warning => p_warnings
2475 );
2476 --
2477 pay_in_utils.set_location(g_debug, l_procedure, 60);
2478 --
2479 IF l_effective_end_date <> (pay_in_utils.next_tax_year(l_effective_date)-1)
2480 THEN
2481 --
2482 -- End date the entry as of the financial year end date
2483 --
2484 delete_declaration
2485 (p_element_entry_id =>l_element_entry_id
2486 ,p_effective_date =>pay_in_utils.next_tax_year(l_effective_date)-1
2487 ,p_warnings =>l_warnings);
2488 --
2489 END IF;
2490 --
2491 END IF;
2492 --
2493 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
2494 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
2495 pay_in_utils.set_location(g_debug,l_procedure,70);
2496 --
2497
2498
2499 pay_in_utils.set_location(g_debug, 'Leaving: ' || l_procedure, 80);
2500 --
2501 EXCEPTION
2502 WHEN OTHERS THEN
2503 fnd_msg_pub.add_exc_msg
2504 (p_pkg_name => g_package
2505 ,p_procedure_name => 'declare_other_income'
2506 ,p_error_text => substr(sqlerrm, 1, 240)
2507 );
2508 --
2509 END declare_other_income;
2510
2511 --------------------------------------------------------------------------
2512 -- --
2513 -- Name : DECLARE_SECTION80DD --
2514 -- Type : PROCEDURE --
2515 -- Access : Public --
2516 -- Description : The procedure is responsible for storing the --
2517 -- detials in 'Deduction under Section 80DD' element. --
2518 -- --
2519 -- Parameters : --
2520 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
2521 -- p_disability_type VARCHAR2 --
2522 -- p_disability_percentage VARCHAR2 --
2523 -- p_treatment_amount NUMBER --
2524 -- p_effective_date DATE --
2525 -- p_element_entry_id element_entry_id%TYPE --
2526 -- OUT : p_warnings BOOLEAN --
2527 -- --
2528 -- Change History : --
2529 --------------------------------------------------------------------------
2530 -- Rev# Date Userid Description --
2531 --------------------------------------------------------------------------
2532 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
2533 --------------------------------------------------------------------------
2534 PROCEDURE declare_section80dd
2535 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
2536 ,p_disability_type IN VARCHAR2
2537 ,p_disability_percentage IN VARCHAR2
2538 ,p_treatment_amount IN NUMBER
2539 ,p_effective_date IN DATE default null
2540 ,p_element_entry_id IN pay_element_entries_f.element_entry_id%TYPE default null
2541 ,p_warnings OUT NOCOPY VARCHAR2)
2542 IS
2543 --
2544 l_procedure VARCHAR(100);
2545 l_message VARCHAR2(250);
2546 l_warnings BOOLEAN;
2547 l_input_values t_input_values_tab;
2548 l_element_type_id pay_element_types_f.element_type_id%TYPE;
2549 l_element_link_id pay_element_links_f.element_link_id%TYPE;
2550 l_element_entry_id pay_element_entries.element_entry_id%TYPE;
2551 l_business_group_id per_business_groups.business_group_id%TYPE;
2552 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
2553 l_effective_date DATE;
2554 l_effective_start_date DATE;
2555 l_effective_end_date DATE;
2556 --
2557 -- Added as a part of bug fix 4774108
2558 CURSOR csr_element_type_id(p_element_name VARCHAR2
2559 ,p_effective_date DATE)-- Added as a part of bug 4938573
2560 IS
2561 SELECT element_type_id
2562 FROM pay_element_types_f
2563 WHERE (legislation_code = 'IN' OR business_group_id = FND_PROFILE.VALUE('PER_BUSINESS_GROUP_ID'))
2564 AND element_name = p_element_name
2565 AND p_effective_date BETWEEN effective_start_date AND effective_end_date;
2566
2567 CURSOR csr_element_link_details
2568 (c_assignment_id IN per_assignments_f.assignment_id%TYPE
2569 ,c_effective_date IN DATE
2570 ,c_element_link_id IN NUMBER)
2571 IS
2572 SELECT types.element_type_id
2573 , links.element_link_id
2574 , assgn.business_group_id
2575 FROM per_assignments_f assgn
2576 , pay_element_links_f links
2577 , pay_element_types_f types
2578 WHERE assgn.assignment_id = c_assignment_id
2579 AND links.element_link_id = c_element_link_id
2580 AND (types.processing_type = 'R' OR assgn.payroll_id IS NOT NULL)
2581 AND links.business_group_id = assgn.business_group_id
2582 AND links.element_type_id = types.element_type_id
2583 AND types.element_name = 'Deduction under Section 80DD'
2584 AND c_effective_date BETWEEN assgn.effective_start_date
2585 AND assgn.effective_end_date
2586 AND c_effective_date BETWEEN links.effective_start_date
2587 AND links.effective_end_date
2588 AND c_effective_date BETWEEN types.effective_start_date
2589 AND types.effective_end_date;
2590 --
2591 CURSOR csr_element_entry_details
2592 (c_element_entry_id IN pay_element_entries_f.element_entry_id%TYPE
2593 ,c_effective_date IN DATE)
2594 IS
2595 SELECT entries.element_type_id
2596 , entries.object_version_number
2597 , assgn.business_group_id
2598 FROM pay_element_entries_f entries
2599 , per_assignments_f assgn
2600 WHERE entries.element_entry_id = c_element_entry_id
2601 AND entries.assignment_id = assgn.assignment_id
2602 AND c_effective_date BETWEEN entries.effective_start_date
2603 AND entries.effective_end_date
2604 AND c_effective_date BETWEEN assgn.effective_start_date
2605 AND assgn.effective_end_date;
2606 BEGIN
2607 --
2608
2609 fnd_msg_pub.initialize; -- Bug 13767307
2610 l_procedure := g_package || 'declare_section80dd';
2611 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
2612
2613 IF g_debug THEN
2614 pay_in_utils.trace('**************************************************','********************');
2615 pay_in_utils.trace('p_assignment_id',p_assignment_id);
2616 pay_in_utils.trace('p_disability_type ',p_disability_type );
2617 pay_in_utils.trace('p_disability_percentage',p_disability_percentage);
2618 pay_in_utils.trace('p_treatment_amount ',p_treatment_amount );
2619 pay_in_utils.trace('p_effective_date ',p_effective_date );
2620 pay_in_utils.trace('p_element_entry_id',p_element_entry_id);
2621 pay_in_utils.trace('**************************************************','********************');
2622 END IF;
2623
2624 p_warnings := 'FALSE';
2625
2626 --
2627 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
2628 -- Added for bug 3990922
2629 hr_session_utilities.insert_session_row(l_effective_date);
2630 --
2631 IF (NVL(p_element_entry_id, 0) = 0) THEN
2632 --
2633 pay_in_utils.set_location(g_debug, l_procedure, 20);
2634 --
2635 -- Added as a part of bug fix 4774108
2636 OPEN csr_element_type_id('Deduction under Section 80DD',l_effective_date);-- Added as a part of bug 4938573
2637 FETCH csr_element_type_id INTO l_element_type_id;
2638 CLOSE csr_element_type_id;
2639
2640 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
2641 ,l_effective_date-- Modified as a part of bug 4938573
2642 ,l_element_type_id
2643 );
2644
2645 OPEN csr_element_link_details(p_assignment_id
2646 ,l_effective_date
2647 ,l_element_link_id
2648 );
2649 FETCH csr_element_link_details INTO l_element_type_id
2650 , l_element_link_id
2651 , l_business_group_id;
2652 CLOSE csr_element_link_details;
2653 --
2654 IF l_element_link_id IS NULL THEN
2655 --
2656 hr_utility.set_message(800, 'PER_IN_MISSING_LINK');
2657 hr_utility.set_message_token('ELEMENT_NAME', 'Deduction under Section 80DD');
2658 hr_utility.raise_error;
2659 --
2660 END IF;
2661 --
2662 pay_in_utils.set_location(g_debug, l_procedure, 30);
2663 --
2664 IF g_debug THEN
2665 pay_in_utils.trace('Element Type ID: ', l_element_type_id);
2666 pay_in_utils.trace('Element Link ID: ', l_element_link_id);
2667 pay_in_utils.trace('Business Group ID: ', l_business_group_id);
2668 END IF;
2669 --
2670 -- Query the entry IDs required for creation of the element.
2671 get_element_entry_ids(l_element_type_id
2672 ,l_effective_date
2673 ,6
2674 ,l_input_values);
2675 --
2676 pay_in_utils.set_location(g_debug, l_procedure, 40);
2677 --
2678 -- In this case, we would have to create an element entry to the
2679 -- assignment and return the entry id, the rest would be handled
2680 -- by the update command in the calling procedure.
2681 hr_utility.trace('Disability Type= '||p_disability_type);
2682 pay_element_entry_api.create_element_entry
2683 (p_effective_date => l_effective_date
2684 ,p_business_group_id => l_business_group_id
2685 ,p_assignment_id => p_assignment_id
2686 ,p_element_link_id => l_element_link_id
2687 ,p_entry_type => 'E'
2688 -- Disability Type
2689 ,p_input_value_id1 => l_input_values(0).input_value_id
2690 -- Disability Percentage
2691 ,p_input_value_id2 => l_input_values(1).input_value_id
2692 -- Treatment Amount
2693 ,p_input_value_id3 => l_input_values(2).input_value_id
2694 ,p_entry_value1 => p_disability_type
2695 ,p_entry_value2 => p_disability_percentage
2696 ,p_entry_value3 => p_treatment_amount
2697 ,p_effective_start_date => l_effective_start_date
2698 ,p_effective_end_date => l_effective_end_date
2699 ,p_element_entry_id => l_element_entry_id
2700 ,p_object_version_number => l_object_version_number
2701 ,p_create_warning => l_warnings
2702 );
2703 --
2704 pay_in_utils.set_location(g_debug, l_procedure, 50);
2705 --
2706 -- End date the entry as of the financial year end date
2707 --
2708 delete_declaration
2709 (p_element_entry_id => l_element_entry_id
2710 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
2711 ,p_warnings => p_warnings);
2712 --
2713 ELSE
2714 --
2715 pay_in_utils.set_location(g_debug, l_procedure, 60);
2716 --
2717 OPEN csr_element_entry_details(p_element_entry_id
2718 ,l_effective_date);
2719 FETCH csr_element_entry_details INTO l_element_type_id
2720 , l_object_version_number
2721 , l_business_group_id;
2722 CLOSE csr_element_entry_details;
2723 --
2724 --
2725 -- Query the entry IDs required for creation of the element.
2726 get_element_entry_ids(l_element_type_id
2727 ,l_effective_date
2728 ,6
2729 ,l_input_values);
2730 --
2731 pay_in_utils.set_location(g_debug, l_procedure, 70);
2732 --
2733 -- An element entry for this element already exists we have to
2734 -- update the element entry with the newly submitted date.
2735 --
2736 pay_element_entry_api.update_element_entry
2737 (p_datetrack_update_mode => get_update_mode(p_element_entry_id
2738 ,l_effective_date)
2739 ,p_effective_date => l_effective_date
2740 ,p_business_group_id => l_business_group_id
2741 ,p_element_entry_id => p_element_entry_id
2742 ,p_object_version_number => l_object_version_number
2743 -- Disability Type
2744 ,p_input_value_id1 => l_input_values(0).input_value_id
2745 -- Disability Percentage
2746 ,p_input_value_id2 => l_input_values(1).input_value_id
2747 -- Treatment Amount
2748 ,p_input_value_id3 => l_input_values(2).input_value_id
2749 ,p_entry_value1 => p_disability_type
2750 ,p_entry_value2 => p_disability_percentage
2751 ,p_entry_value3 => p_treatment_amount
2752 ,p_effective_start_date => l_effective_start_date
2753 ,p_effective_end_date => l_effective_end_date
2754 ,p_update_warning => l_warnings
2755 );
2756 --
2757 IF g_debug THEN
2758 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
2759 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
2760 END IF;
2761 --
2762 pay_in_utils.set_location(g_debug, l_procedure, 80);
2763 --
2764 IF l_effective_end_date <> (pay_in_utils.next_tax_year(l_effective_date)-1)
2765 THEN
2766 --
2767 -- End date the entry as of the financial year end date
2768 --
2769 delete_declaration
2770 (p_element_entry_id =>l_element_entry_id
2771 ,p_effective_date =>pay_in_utils.next_tax_year(l_effective_date)-1
2772 ,p_warnings =>p_warnings);
2773 --
2774 END IF;
2775 --
2776 END IF;
2777 --
2778 IF l_warnings = TRUE THEN
2779 --
2780 p_warnings := 'TRUE';
2781 --
2782 END IF;
2783
2784
2785 pay_in_utils.set_location(g_debug, 'Leaving: ' || l_procedure, 90);
2786 --
2787 EXCEPTION
2788 WHEN OTHERS THEN
2789 fnd_msg_pub.add_exc_msg
2790 (p_pkg_name => g_package
2791 ,p_procedure_name => 'declare_section80dd'
2792 ,p_error_text => substr(sqlerrm, 1, 240)
2793 );
2794 --
2795 END declare_section80dd;
2796
2797 --------------------------------------------------------------------------
2798 -- --
2799 -- Name : DECLARE_SECTION80G --
2800 -- Type : PROCEDURE --
2801 -- Access : Public --
2802 -- Description : The procedure is responsible for storing the --
2803 -- detials in 'Deduction under Section 80G' element. --
2804 -- --
2805 -- Parameters : --
2806 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
2807 -- p_donation_type VARCHAR2 --
2808 -- p_donation_amount NUMBER --
2809 -- p_effective_date DATE --
2810 -- p_element_entry_id element_entry_id%TYPE --
2811 -- OUT : p_warnings BOOLEAN --
2812 -- --
2813 -- Change History : --
2814 --------------------------------------------------------------------------
2815 -- Rev# Date Userid Description --
2816 --------------------------------------------------------------------------
2817 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
2818 --------------------------------------------------------------------------
2819 PROCEDURE declare_section80g
2820 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
2821 ,p_donation_type IN VARCHAR2
2822 ,p_donation_amount IN NUMBER
2823 ,p_effective_date IN DATE default null
2824 ,p_element_entry_id IN pay_element_entries_f.element_entry_id%TYPE default null
2825 ,p_warnings OUT NOCOPY VARCHAR2)
2826 IS
2827 --
2828 l_procedure VARCHAR(100);
2829 l_message VARCHAR2(250);
2830 l_warnings BOOLEAN;
2831 l_input_values t_input_values_tab;
2832 l_element_type_id pay_element_types_f.element_type_id%TYPE;
2833 l_element_link_id pay_element_links_f.element_link_id%TYPE;
2834 l_element_entry_id pay_element_entries.element_entry_id%TYPE;
2835 l_business_group_id per_business_groups.business_group_id%TYPE;
2836 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
2837 l_effective_date DATE;
2838 l_effective_start_date DATE;
2839 l_effective_end_date DATE;
2840 --
2841 -- Added as a part of bug fix 4774108
2842 CURSOR csr_element_type_id(p_element_name VARCHAR2
2843 ,p_effective_date DATE -- Added as a part of bug 4938573
2844 )
2845 IS
2846 SELECT element_type_id
2847 FROM pay_element_types_f
2848 WHERE legislation_code = 'IN'
2849 AND element_name = p_element_name
2850 AND p_effective_date BETWEEN effective_start_date AND effective_end_date;
2851
2852 CURSOR csr_element_link_details
2853 (c_assignment_id IN per_assignments_f.assignment_id%TYPE
2854 ,c_effective_date IN DATE
2855 ,c_element_link_id IN NUMBER)
2856 IS
2857 SELECT types.element_type_id
2858 , link.element_link_id
2859 , assgn.business_group_id
2860 FROM per_assignments_f assgn
2861 , pay_element_links_f link
2862 , pay_element_types_f types
2863 WHERE assgn.assignment_id = c_assignment_id
2864 AND link.element_link_id = c_element_link_id
2865 AND (types.processing_type = 'R' OR assgn.payroll_id IS NOT NULL)
2866 AND link.business_group_id = assgn.business_group_id
2867 AND link.element_type_id = types.element_type_id
2868 AND types.element_name = 'Deduction under Section 80G'
2869 AND c_effective_date BETWEEN assgn.effective_start_date
2870 AND assgn.effective_end_date
2871 AND c_effective_date BETWEEN link.effective_start_date
2872 AND link.effective_end_date
2873 AND c_effective_date BETWEEN types.effective_start_date
2874 AND types.effective_end_date;
2875 --
2876 CURSOR csr_element_entry_details
2877 (c_element_entry_id IN pay_element_entries_f.element_entry_id%TYPE
2878 ,c_effective_date IN DATE)
2879 IS
2880 SELECT entries.element_type_id
2881 , entries.object_version_number
2882 , assgn.business_group_id
2883 FROM pay_element_entries_f entries
2884 , per_assignments_f assgn
2885 WHERE entries.element_entry_id = c_element_entry_id
2886 AND entries.assignment_id = assgn.assignment_id
2887 AND c_effective_date BETWEEN entries.effective_start_date
2888 AND entries.effective_end_date
2889 AND c_effective_date BETWEEN assgn.effective_start_date
2890 AND assgn.effective_end_date;
2891 BEGIN
2892 fnd_msg_pub.initialize; -- Bug 13767307
2893 l_procedure := g_package || 'declare_section80g';
2894 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
2895
2896 IF g_debug THEN
2897 pay_in_utils.trace('**************************************************','********************');
2898 pay_in_utils.trace('p_assignment_id',p_assignment_id);
2899 pay_in_utils.trace('p_donation_type ',p_donation_type );
2900 pay_in_utils.trace('p_donation_amount',p_donation_amount);
2901 pay_in_utils.trace('p_effective_date ',p_effective_date );
2902 pay_in_utils.trace('p_element_entry_id',p_element_entry_id);
2903 pay_in_utils.trace('**************************************************','********************');
2904 END IF;
2905
2906 p_warnings := 'FALSE';
2907
2908 --
2909 IF g_debug THEN
2910 --
2911 pay_in_utils.trace('Donation Type: ', p_donation_type);
2912 pay_in_utils.trace('Donation Amount: ', p_donation_amount);
2913 --
2914 END IF;
2915 --
2916 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
2917 -- Added for bug 3990922
2918 hr_session_utilities.insert_session_row(l_effective_date);
2919 --
2920 IF (NVL(p_element_entry_id, 0) = 0) THEN
2921 --
2922 pay_in_utils.set_location(g_debug, l_procedure, 20);
2923 --
2924 -- Added as a part of bug fix 4774108
2925 OPEN csr_element_type_id('Deduction under Section 80G',l_effective_date); -- Added as a part of bug 4938573
2926 FETCH csr_element_type_id INTO l_element_type_id;
2927 CLOSE csr_element_type_id;
2928
2929 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
2930 ,l_effective_date -- Modified as a part of bug 4938573
2931 ,l_element_type_id
2932 );
2933 OPEN csr_element_link_details(p_assignment_id
2934 ,l_effective_date
2935 ,l_element_link_id
2936 );
2937 FETCH csr_element_link_details INTO l_element_type_id
2938 , l_element_link_id
2939 , l_business_group_id;
2940 CLOSE csr_element_link_details;
2941 --
2942 pay_in_utils.set_location(g_debug, l_procedure, 30);
2943 --
2944 IF l_element_link_id IS NULL THEN
2945 --
2946 hr_utility.set_message(800, 'PER_IN_MISSING_LINK');
2947 hr_utility.set_message_token('ELEMENT_NAME', 'Deduction under Section 80G');
2948 hr_utility.raise_error;
2949 --
2950 END IF;
2951 --
2952 IF g_debug THEN
2953 pay_in_utils.trace('Element Type ID: ', l_element_type_id);
2954 pay_in_utils.trace('Element Link ID: ', l_element_link_id);
2955 pay_in_utils.trace('Business Group ID: ', l_business_group_id);
2956 END IF;
2957 --
2958 -- Query the entry IDs required for creation of the element.
2959 get_element_entry_ids(l_element_type_id
2960 ,l_effective_date
2961 ,5
2962 ,l_input_values);
2963 --
2964 pay_in_utils.set_location(g_debug, l_procedure, 40);
2965 --
2966 -- In this case, we would have to create an element entry to the
2967 -- assignment and return the entry id, the rest would be handled
2968 -- by the update command in the calling procedure.
2969 pay_element_entry_api.create_element_entry
2970 (p_effective_date => l_effective_date
2971 ,p_business_group_id => l_business_group_id
2972 ,p_assignment_id => p_assignment_id
2973 ,p_element_link_id => l_element_link_id
2974 ,p_entry_type => 'E'
2975 -- Donation Type
2976 ,p_input_value_id1 => l_input_values(0).input_value_id
2977 -- Donation Amount
2978 ,p_input_value_id2 => l_input_values(1).input_value_id
2979 ,p_entry_value1 => p_donation_type
2980 ,p_entry_value2 => p_donation_amount
2981 ,p_effective_start_date => l_effective_start_date
2982 ,p_effective_end_date => l_effective_end_date
2983 ,p_element_entry_id => l_element_entry_id
2984 ,p_object_version_number => l_object_version_number
2985 ,p_create_warning => l_warnings
2986 );
2987 --
2988 pay_in_utils.set_location(g_debug, l_procedure, 50);
2989 --
2990 -- End date the entry as of the financial year end date
2991 --
2992 delete_declaration
2993 (p_element_entry_id => l_element_entry_id
2994 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
2995 ,p_warnings => p_warnings);
2996 --
2997 ELSE
2998 --
2999 pay_in_utils.set_location(g_debug, l_procedure, 60);
3000 --
3001 OPEN csr_element_entry_details(p_element_entry_id
3002 ,l_effective_date);
3003 FETCH csr_element_entry_details INTO l_element_type_id
3004 , l_object_version_number
3005 , l_business_group_id;
3006 CLOSE csr_element_entry_details;
3007 --
3008 --
3009 -- Query the entry IDs required for creation of the element.
3010 get_element_entry_ids(l_element_type_id
3011 ,l_effective_date
3012 ,5
3013 ,l_input_values);
3014 --
3015 pay_in_utils.set_location(g_debug, l_procedure, 70);
3016 --
3017 -- An element entry for this element already exists we have to
3018 -- update the element entry with the newly submitted date.
3019 --
3020 pay_element_entry_api.update_element_entry
3021 (p_datetrack_update_mode => get_update_mode(p_element_entry_id
3022 ,l_effective_date)
3023 ,p_effective_date => l_effective_date
3024 ,p_business_group_id => l_business_group_id
3025 ,p_element_entry_id => p_element_entry_id
3026 ,p_object_version_number => l_object_version_number
3027 -- Donation Type
3028 ,p_input_value_id1 => l_input_values(0).input_value_id
3029 -- Donation Amount
3030 ,p_input_value_id2 => l_input_values(1).input_value_id
3031 ,p_entry_value1 => p_donation_type
3032 ,p_entry_value2 => p_donation_amount
3033 ,p_effective_start_date => l_effective_start_date
3034 ,p_effective_end_date => l_effective_end_date
3035 ,p_update_warning => l_warnings
3036 );
3037 --
3038 IF g_debug THEN
3039 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
3040 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
3041 END IF;
3042 --
3043 pay_in_utils.set_location(g_debug, l_procedure, 80);
3044 --
3045 IF l_effective_end_date <> (pay_in_utils.next_tax_year(l_effective_date)-1)
3046 THEN
3047 --
3048 -- End date the entry as of the financial year end date
3049 --
3050 delete_declaration
3051 (p_element_entry_id =>l_element_entry_id
3052 ,p_effective_date =>pay_in_utils.next_tax_year(l_effective_date)-1
3053 ,p_warnings =>p_warnings);
3054 --
3055 END IF;
3056 --
3057 END IF;
3058 --
3059 IF l_warnings = TRUE THEN
3060 --
3061 p_warnings := 'TRUE';
3062 --
3063 END IF;
3064
3065 pay_in_utils.set_location(g_debug, 'Leaving: ' || l_procedure, 90);
3066 --
3067 EXCEPTION
3068 WHEN OTHERS THEN
3069 fnd_msg_pub.add_exc_msg
3070 (p_pkg_name => g_package
3071 ,p_procedure_name => 'declare_section80g'
3072 ,p_error_text => substr(sqlerrm, 1, 240)
3073 );
3074 --
3075 END declare_section80g;
3076
3077 --------------------------------------------------------------------------
3078 -- --
3079 -- Name : DECLARE_LIFE_INSURANCE_PREMIUM --
3080 -- Type : PROCEDURE --
3081 -- Access : Public --
3082 -- Description : The procedure is responsible for storing the --
3083 -- detials in 'Life Insurance Premium' element. --
3084 -- --
3085 -- Parameters : --
3086 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
3087 -- p_premium_paid VARCHAR2 --
3088 -- p_sum_assured NUMBER --
3089 -- p_effective_date DATE --
3090 -- p_element_entry_id element_entry_id%TYPE --
3091 -- OUT : p_warnings BOOLEAN --
3092 -- --
3093 -- Change History : --
3094 --------------------------------------------------------------------------
3095 -- Rev# Date Userid Description --
3096 --------------------------------------------------------------------------
3097 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
3098 -- 1.1 02-Feb-2010 MDUBASI Added LIC Policy Number
3099 --------------------------------------------------------------------------
3100 PROCEDURE declare_life_insurance_premium
3101 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
3102 ,p_premium_paid IN VARCHAR2
3103 ,p_sum_assured IN NUMBER
3104 ,p_effective_date IN DATE default null
3105 ,p_element_entry_id IN pay_element_entries_f.element_entry_id%TYPE default null
3106 ,p_policy_number IN VARCHAR2
3107 ,p_policy_start_date IN DATE default null
3108 ,p_warnings OUT NOCOPY VARCHAR2)
3109 IS
3110 --
3111 l_procedure VARCHAR(100);
3112 l_message VARCHAR2(250);
3113 l_warnings BOOLEAN;
3114 l_input_values t_input_values_tab;
3115 l_element_type_id pay_element_types_f.element_type_id%TYPE;
3116 l_element_link_id pay_element_links_f.element_link_id%TYPE;
3117 l_element_entry_id pay_element_entries.element_entry_id%TYPE;
3118 l_business_group_id per_business_groups.business_group_id%TYPE;
3119 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
3120 l_effective_date DATE;
3121 l_effective_start_date DATE;
3122 l_effective_end_date DATE;
3123 --
3124 CURSOR csr_element_link_details
3125 (c_assignment_id IN per_assignments_f.assignment_id%TYPE
3126 ,c_effective_date IN DATE
3127 ,c_element_link_id IN NUMBER)
3128 IS
3129 SELECT types.element_type_id
3130 , link.element_link_id
3131 , assgn.business_group_id
3132 FROM per_assignments_f assgn
3133 , pay_element_links_f link
3134 , pay_element_types_f types
3135 WHERE assgn.assignment_id = c_assignment_id
3136 AND link.element_link_id = c_element_link_id
3137 AND (types.processing_type = 'R' OR assgn.payroll_id IS NOT NULL)
3138 AND link.business_group_id = assgn.business_group_id
3139 AND link.element_type_id = types.element_type_id
3140 AND types.element_name = 'Life Insurance Premium'
3141 AND c_effective_date BETWEEN assgn.effective_start_date
3142 AND assgn.effective_end_date
3143 AND c_effective_date BETWEEN link.effective_start_date
3144 AND link.effective_end_date
3145 AND c_effective_date BETWEEN types.effective_start_date
3146 AND types.effective_end_date;
3147 --
3148 CURSOR csr_element_entry_details
3149 (c_element_entry_id IN pay_element_entries_f.element_entry_id%TYPE
3150 ,c_effective_date IN DATE)
3151 IS
3152 SELECT entries.element_type_id
3153 , entries.object_version_number
3154 , assgn.business_group_id
3155 FROM pay_element_entries_f entries
3156 , per_assignments_f assgn
3157 WHERE entries.element_entry_id = c_element_entry_id
3158 AND entries.assignment_id = assgn.assignment_id
3159 AND c_effective_date BETWEEN entries.effective_start_date
3160 AND entries.effective_end_date
3161 AND c_effective_date BETWEEN assgn.effective_start_date
3162 AND assgn.effective_end_date;
3163 -- Added as a part of bug fix 4774108
3164 CURSOR csr_element_type_id(p_element_name VARCHAR2
3165 ,p_effective_date DATE
3166 )
3167 IS
3168 SELECT element_type_id
3169 FROM pay_element_types_f
3170 WHERE legislation_code = 'IN'
3171 AND element_name = p_element_name
3172 AND p_effective_date BETWEEN effective_start_date AND effective_end_date;
3173 BEGIN
3174 fnd_msg_pub.initialize; -- Bug 13767307
3175 l_procedure := g_package || 'declare_life_insurance_premium';
3176 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
3177
3178 IF g_debug THEN
3179 pay_in_utils.trace('**************************************************','********************');
3180 pay_in_utils.trace('p_assignment_id',p_assignment_id);
3181 pay_in_utils.trace('p_premium_paid ',p_premium_paid );
3182 pay_in_utils.trace('p_sum_assured',p_sum_assured);
3183 pay_in_utils.trace('p_effective_date ',p_effective_date );
3184 pay_in_utils.trace('p_element_entry_id',p_element_entry_id);
3185 pay_in_utils.trace('p_policy_number',p_policy_number);
3186 pay_in_utils.trace('p_policy_start_date',p_policy_start_date);
3187 pay_in_utils.trace('**************************************************','********************');
3188 END IF;
3189
3190 p_warnings := 'FALSE';
3191
3192 --
3193 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
3194 --
3195 IF (NVL(p_element_entry_id, 0) = 0) THEN
3196 --
3197 pay_in_utils.set_location(g_debug, l_procedure, 20);
3198 --
3199 -- Added as a part of bug fix 4774108
3200 OPEN csr_element_type_id('Life Insurance Premium',l_effective_date);
3201 FETCH csr_element_type_id INTO l_element_type_id;
3202 CLOSE csr_element_type_id;
3203
3204 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
3205 ,l_effective_date
3206 ,l_element_type_id
3207 );
3208 OPEN csr_element_link_details(p_assignment_id
3209 ,l_effective_date
3210 ,l_element_link_id);
3211 FETCH csr_element_link_details INTO l_element_type_id
3212 , l_element_link_id
3213 , l_business_group_id;
3214 CLOSE csr_element_link_details;
3215 --
3216 IF l_element_link_id IS NULL THEN
3217 --
3218 hr_utility.set_message(800, 'PER_IN_MISSING_LINK');
3219 hr_utility.set_message_token('ELEMENT_NAME', 'Life Insurance Premium');
3220 hr_utility.raise_error;
3221 --
3222 END IF;
3223 --
3224 pay_in_utils.set_location(g_debug, l_procedure, 30);
3225 --
3226 IF g_debug THEN
3227 pay_in_utils.trace('Element Type ID: ' , l_element_type_id);
3228 pay_in_utils.trace('Element Link ID: ' , l_element_link_id);
3229 pay_in_utils.trace('Business Group ID: ' , l_business_group_id);
3230 END IF;
3231 --
3232 -- Query the entry IDs required for creation of the element.
3233 get_element_entry_ids(l_element_type_id
3234 ,l_effective_date
3235 ,6
3236 ,l_input_values);
3237 --
3238 pay_in_utils.set_location(g_debug, l_procedure, 40);
3239 --
3240 -- In this case, we would have to create an element entry to the
3241 -- assignment and return the entry id, the rest would be handled
3242 -- by the update command in the calling procedure.
3243 pay_element_entry_api.create_element_entry
3244 (p_effective_date => l_effective_date
3245 ,p_business_group_id => l_business_group_id
3246 ,p_assignment_id => p_assignment_id
3247 ,p_element_link_id => l_element_link_id
3248 ,p_entry_type => 'E'
3249 -- Premium Paid
3250 ,p_input_value_id1 => l_input_values(0).input_value_id
3251 -- Sum Assured
3252 ,p_input_value_id2 => l_input_values(1).input_value_id
3253 -- Policy Number
3254 ,p_input_value_id3 => l_input_values(4).input_value_id
3255 --Policy Date
3256 -- TO_CHAR(to_date(p_effective_date,'YYYY-MM-DD'),'RRRR/MM/DD')
3257 ,p_input_value_id4 => l_input_values(5).input_value_id
3258 -- ,p_input_value_id4 => l_input_values(5).input_value_id
3259 ,p_entry_value1 => p_premium_paid
3260 ,p_entry_value2 => p_sum_assured
3261 ,p_entry_value3 => p_policy_number
3262 ,p_entry_value4 => p_policy_start_date
3263 ,p_effective_start_date => l_effective_start_date
3264 ,p_effective_end_date => l_effective_end_date
3265 ,p_element_entry_id => l_element_entry_id
3266 ,p_object_version_number => l_object_version_number
3267 ,p_create_warning => l_warnings
3268 );
3269 --
3270 pay_in_utils.set_location(g_debug, l_procedure, 50);
3271 --
3272 -- End date the entry as of the financial year end date
3273 --
3274 delete_declaration
3275 (p_element_entry_id => l_element_entry_id
3276 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
3277 ,p_warnings => p_warnings);
3278 --
3279 ELSE
3280 --
3281 pay_in_utils.set_location(g_debug, l_procedure, 60);
3282 --
3283 OPEN csr_element_entry_details(p_element_entry_id
3284 ,l_effective_date);
3285 FETCH csr_element_entry_details INTO l_element_type_id
3286 , l_object_version_number
3287 , l_business_group_id;
3288
3289 CLOSE csr_element_entry_details;
3290 --
3291 --
3292 -- Query the entry IDs required for creation of the element.
3293 get_element_entry_ids(l_element_type_id
3294 ,l_effective_date
3295 ,6
3296 ,l_input_values);
3297 --
3298 pay_in_utils.set_location(g_debug, l_procedure, 70);
3299 --
3300 -- An element entry for this element already exists we have to
3301 -- update the element entry with the newly submitted date.
3302 --
3303 pay_element_entry_api.update_element_entry
3304 (p_datetrack_update_mode => get_update_mode(p_element_entry_id
3305 ,l_effective_date)
3306 ,p_effective_date => l_effective_date
3307 ,p_business_group_id => l_business_group_id
3308 ,p_element_entry_id => p_element_entry_id
3309 ,p_object_version_number => l_object_version_number
3310 -- Premium Paid
3311 ,p_input_value_id1 => l_input_values(0).input_value_id
3312 -- Sum Assured
3313 ,p_input_value_id2 => l_input_values(1).input_value_id
3314 -- Policy Number
3315 ,p_input_value_id3 => l_input_values(4).input_value_id
3316 --Policy Start Date
3317 ,p_input_value_id4 => l_input_values(5).input_value_id
3318
3319 ,p_entry_value1 => p_premium_paid
3320 ,p_entry_value2 => p_sum_assured
3321 ,p_entry_value3 => p_policy_number
3322 ,p_entry_value4 => p_policy_start_date
3323 ,p_effective_start_date => l_effective_start_date
3324 ,p_effective_end_date => l_effective_end_date
3325 ,p_update_warning => l_warnings
3326 );
3327 --
3328 IF g_debug THEN
3329 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
3330 pay_in_utils.trace('Effective End Date: ' , l_effective_end_date);
3331 END IF;
3332 --
3333 pay_in_utils.set_location(g_debug, l_procedure, 80);
3334 --
3335 IF l_effective_end_date <> (pay_in_utils.next_tax_year(l_effective_date)-1)
3336 THEN
3337 --
3338 -- End date the entry as of the financial year end date
3339 --
3340 delete_declaration
3341 (p_element_entry_id =>l_element_entry_id
3342 ,p_effective_date =>pay_in_utils.next_tax_year(l_effective_date)-1
3343 ,p_warnings =>p_warnings);
3344 --
3345 END IF;
3346 --
3347 END IF;
3348 --
3349
3350 --
3351 IF l_warnings = TRUE THEN
3352 --
3353 p_warnings := 'TRUE';
3354 --
3355 END IF;
3356
3357
3358
3359 pay_in_utils.set_location(g_debug, 'Leaving: ' || l_procedure, 90);
3360
3361 EXCEPTION
3362 WHEN OTHERS THEN
3363 fnd_msg_pub.add_exc_msg
3364 (p_pkg_name => g_package
3365 ,p_procedure_name => 'declare_life_insurance_premium'
3366 ,p_error_text => substr(sqlerrm, 1, 240)
3367 );
3368 --
3369 END declare_life_insurance_premium;
3370
3371 --------------------------------------------------------------------------
3372 -- --
3373 -- Name : DECLARE_VPF --
3374 -- Type : PROCEDURE --
3375 -- Access : Public --
3376 -- Description : The procedure is responsible for storing the --
3377 -- detials in 'PF Information' element. --
3378 -- --
3379 -- Parameters : --
3380 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
3381 -- p_effective_date DATE --
3382 -- p_ee_vol_pf_amount NUMBER --
3383 -- p_ee_vol_pf_percent NUMBER --
3384 -- OUT : p_warnings BOOLEAN --
3385 -- --
3386 -- Change History : --
3387 --------------------------------------------------------------------------
3388 -- Rev# Date Userid Description --
3389 --------------------------------------------------------------------------
3390 -- 1.0 02-Feb-2010 mdubasi Initial Version --
3391 --------------------------------------------------------------------------
3392
3393 PROCEDURE declare_vpf
3394 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
3395 ,p_effective_date IN DATE DEFAULT NULL
3396 ,p_ee_vol_pf_amount IN NUMBER
3397 ,p_ee_vol_pf_percent IN NUMBER
3398 ,p_warnings OUT NOCOPY BOOLEAN)
3399 IS
3400 CURSOR c_vpf_update(c_element_entry_id pay_element_entries_f.element_entry_id%TYPE
3401 ,c_effective_date DATE)
3402 IS
3403 SELECT ee.effective_start_date
3404 FROM pay_element_entries_f ee
3405 WHERE ee.element_entry_id = c_element_entry_id
3406 AND c_effective_date BETWEEN ee.effective_start_date and ee.effective_end_date;
3407
3408 l_procedure VARCHAR(100);
3409 l_message VARCHAR2(250);
3410 l_input_values t_input_values_tab;
3411 l_element_type_id pay_element_types_f.element_type_id%TYPE;
3412 l_element_link_id pay_element_links_f.element_link_id%TYPE;
3413 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
3414 l_business_group_id per_business_groups.business_group_id%TYPE;
3415 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
3416 l_effective_start_date DATE;
3417 l_effective_end_date DATE;
3418 l_effective_date DATE;
3419 l_endation_date DATE;
3420 l_warnings VARCHAR2(6);
3421 l_current_date pay_element_entries_f.effective_start_date%TYPE;
3422 --
3423 BEGIN
3424 fnd_msg_pub.initialize; -- Bug 13767307
3425 l_procedure := g_package || 'declare_vpf';
3426 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
3427
3428 IF g_debug THEN
3429 pay_in_utils.trace('**************************************************','********************');
3430 pay_in_utils.trace('p_assignment_id',p_assignment_id);
3431 pay_in_utils.trace('p_effective_date ',p_effective_date );
3432 pay_in_utils.trace('p_ee_vol_pf_amount',p_ee_vol_pf_amount);
3433 pay_in_utils.trace('p_ee_vol_pf_percent',p_ee_vol_pf_percent);
3434 pay_in_utils.trace('**************************************************','********************');
3435 END IF;
3436 --
3437 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
3438
3439
3440 get_entry_details(p_assignment_id => p_assignment_id
3441 ,p_element_name => 'PF Information'
3442 ,p_effective_date => l_effective_date
3443 ,p_element_type_id => l_element_type_id
3444 ,p_element_link_id => l_element_link_id
3445 ,p_element_entry_id => l_element_entry_id
3446 ,p_expected_entries => 2
3447 ,p_business_group_id => l_business_group_id
3448 ,p_object_version_number=> l_object_version_number
3449 ,p_input_values => l_input_values
3450 );
3451 --
3452 IF g_debug THEN
3453 pay_in_utils.trace('Element Type ID: ' , l_element_type_id);
3454 pay_in_utils.trace('Element Entry ID: ' , l_element_entry_id);
3455 pay_in_utils.trace('Business Group ID: ' , l_business_group_id);
3456 pay_in_utils.trace('Object Version Number: ' , l_object_version_number);
3457 END IF;
3458
3459 --
3460 pay_in_utils.set_location(g_debug, l_procedure, 20);
3461 --
3462 IF l_element_entry_id is null THEN
3463 --
3464 pay_in_utils.set_location(g_debug, l_procedure, 30);
3465 --
3466 --
3467 -- In this case, we would have to create an element entry to the
3468 -- assignment and return the entry id, the rest would be handled
3469 -- by the update command in the calling procedure.
3470 --
3471 IF (p_ee_vol_pf_amount > 0 OR p_ee_vol_pf_percent > 0) THEN
3472 pay_element_entry_api.create_element_entry
3473 (p_effective_date => l_effective_date
3474 ,p_business_group_id => l_business_group_id
3475 ,p_assignment_id => p_assignment_id
3476 ,p_element_link_id => l_element_link_id
3477 ,p_entry_type => 'E'
3478 --PF Information
3479 ,p_input_value_id1 => l_input_values(0).input_value_id
3480 ,p_entry_value1 => p_ee_vol_pf_amount
3481 ,p_input_value_id2 => l_input_values(1).input_value_id
3482 ,p_entry_value2 => p_ee_vol_pf_percent
3483 ,p_effective_start_date => l_effective_start_date
3484 ,p_effective_end_date => l_effective_end_date
3485 ,p_element_entry_id => l_element_entry_id
3486 ,p_object_version_number => l_object_version_number
3487 ,p_create_warning => p_warnings
3488 );
3489 END IF;
3490 --
3491 pay_in_utils.set_location(g_debug, l_procedure, 40);
3492 --
3493 ELSE
3494 --
3495 pay_in_utils.set_location(g_debug, l_procedure, 50);
3496 --
3497 OPEN c_vpf_update(l_element_entry_id,l_effective_date);
3498 FETCH c_vpf_update into l_current_date;
3499 CLOSE c_vpf_update;
3500
3501 IF (trunc(l_current_date,'MM') = trunc(l_effective_date,'MM'))
3502 THEN
3503 l_effective_date := l_current_date;
3504 END IF;
3505 --
3506 -- An element entry for this element already exists we have to
3507 -- update the element entry with the newly submitted date.
3508 --
3509 IF (p_ee_vol_pf_amount > 0 OR p_ee_vol_pf_percent > 0) THEN
3510 pay_element_entry_api.update_element_entry
3511 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
3512 ,l_effective_date)
3513 ,p_effective_date => l_effective_date
3514 ,p_business_group_id => l_business_group_id
3515 ,p_element_entry_id => l_element_entry_id
3516 ,p_object_version_number => l_object_version_number
3517 --PF Information
3518 ,p_input_value_id1 => l_input_values(0).input_value_id
3519 ,p_entry_value1 => p_ee_vol_pf_amount
3520 ,p_input_value_id2 => l_input_values(1).input_value_id
3521 ,p_entry_value2 => p_ee_vol_pf_percent
3522 ,p_effective_start_date => l_effective_start_date
3523 ,p_effective_end_date => l_effective_end_date
3524 ,p_update_warning => p_warnings
3525 );
3526
3527 /* Bug 13887024 starts here*/
3528 /* ELSE
3529 delete_declaration
3530 (p_element_entry_id =>l_element_entry_id
3531 ,p_effective_date =>l_effective_date
3532 ,p_warnings =>l_warnings); */
3533 /*Bug 13887024 ends here*/
3534 END IF;
3535 --
3536 --
3537 pay_in_utils.set_location(g_debug, l_procedure, 60);
3538 --
3539
3540 --
3541 END IF;
3542 --
3543 IF g_debug THEN
3544 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
3545 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
3546 END IF;
3547
3548 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
3549 --
3550 EXCEPTION
3551 WHEN OTHERS THEN
3552 fnd_msg_pub.add_exc_msg
3553 (p_pkg_name => g_package
3554 ,p_procedure_name => 'declare_vpf'
3555 ,p_error_text => substr(sqlerrm, 1, 240)
3556 );
3557
3558 END;
3559
3560 --------------------------------------------------------------------------
3561 -- --
3562 -- Name : DECLARE_TUITION_FEE --
3563 -- Type : PROCEDURE --
3564 -- Access : Public --
3565 -- Description : The procedure is responsible for storing the --
3566 -- detials in 'Tuition Fee' element. --
3567 -- --
3568 -- Parameters : --
3569 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
3570 -- p_tuition_fee_for_child_1 NUMBER --
3571 -- p_tuition_fee_for_child_2 NUMBER --
3572 -- p_effective_date DATE --
3573 -- p_element_entry_id element_entry_id%TYPE --
3574 -- OUT : p_warnings BOOLEAN --
3575 -- --
3576 -- Change History : --
3577 --------------------------------------------------------------------------
3578 -- Rev# Date Userid Description --
3579 --------------------------------------------------------------------------
3580 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
3581 -- 1.1 25-Apr-2005 VGSRINIV Nulled out for Stat Update(Bug 4251141)--
3582 --------------------------------------------------------------------------
3583 PROCEDURE declare_tuition_fee
3584 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
3585 ,p_tuition_fee_for_child_1 IN NUMBER
3586 ,p_tuition_fee_for_child_2 IN NUMBER
3587 ,p_effective_date IN DATE DEFAULT NULL
3588 ,p_warnings OUT NOCOPY BOOLEAN)
3589 IS
3590 --
3591 l_procedure VARCHAR(100);
3592 l_message VARCHAR2(250);
3593 l_input_values t_input_values_tab;
3594 l_element_type_id pay_element_types_f.element_type_id%TYPE;
3595 l_element_link_id pay_element_links_f.element_link_id%TYPE;
3596 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
3597 l_business_group_id per_business_groups.business_group_id%TYPE;
3598 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
3599 l_effective_start_date DATE;
3600 l_effective_end_date DATE;
3601 l_effective_date DATE;
3602 l_warnings VARCHAR2(6);
3603 --
3604 BEGIN
3605 fnd_msg_pub.initialize; -- Bug 13767307
3606 l_procedure := g_package || 'declare_tuition_fee';
3607 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
3608
3609 IF g_debug THEN
3610 pay_in_utils.trace('**************************************************','********************');
3611 pay_in_utils.trace('p_assignment_id',p_assignment_id);
3612 pay_in_utils.trace('p_tuition_fee_for_child_1 ',p_tuition_fee_for_child_1 );
3613 pay_in_utils.trace('p_tuition_fee_for_child_2 ',p_tuition_fee_for_child_2 );
3614 pay_in_utils.trace('p_effective_date ',p_effective_date );
3615 pay_in_utils.trace('**************************************************','********************');
3616 END IF;
3617
3618 --
3619 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,20);
3620 --
3621 EXCEPTION
3622 WHEN OTHERS THEN
3623 fnd_msg_pub.add_exc_msg
3624 (p_pkg_name => g_package
3625 ,p_procedure_name => 'declare_tuition_fee'
3626 ,p_error_text => substr(sqlerrm, 1, 240)
3627 );
3628 --
3629 END declare_tuition_fee;
3630
3631 /* BUG 4251141: STAT UPDATE 2005 CHANGES START HERE */
3632
3633 --------------------------------------------------------------------------
3634 -- --
3635 -- Name : DECLARE_SECTION80CCE --
3636 -- Type : PROCEDURE --
3637 -- Access : Public --
3638 -- Description : The procedure is responsible for storing the --
3639 -- detials in 'Deduction under Section 80CCE' element. --
3640 -- --
3641 -- Parameters : --
3642 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
3643 -- p_investment_type VARCHAR2 --
3644 -- p_investment_amount NUMBER --
3645 -- p_effective_date DATE --
3646 -- p_element_entry_id element_entry_id%TYPE --
3647 -- OUT : p_warnings BOOLEAN --
3648 -- --
3649 -- Change History : --
3650 --------------------------------------------------------------------------
3651 -- Rev# Date Userid Description --
3652 --------------------------------------------------------------------------
3653 -- 1.0 14-Apr-2005 VGSRINIV Initial Version --
3654 --------------------------------------------------------------------------
3655
3656 PROCEDURE declare_section80cce
3657 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
3658 ,p_investment_type IN VARCHAR2
3659 ,p_investment_amount IN NUMBER
3660 ,p_effective_date IN DATE default null
3661 ,p_element_entry_id IN pay_element_entries_f.element_entry_id%TYPE DEFAULT NULL
3662 ,p_warnings OUT NOCOPY VARCHAR2)
3663 IS
3664 --
3665 l_procedure VARCHAR(100);
3666 l_message VARCHAR2(250);
3667 l_warnings BOOLEAN;
3668 l_input_values t_input_values_tab;
3669 l_element_type_id pay_element_types_f.element_type_id%TYPE;
3670 l_element_link_id pay_element_links_f.element_link_id%TYPE;
3671 l_element_entry_id pay_element_entries.element_entry_id%TYPE;
3672 l_business_group_id per_business_groups.business_group_id%TYPE;
3673 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
3674 l_effective_date DATE;
3675 l_effective_start_date DATE;
3676 l_effective_end_date DATE;
3677 l_ele_entry_id pay_element_entries.element_entry_id%TYPE;
3678 l_ovn pay_element_entries_f.object_version_number%TYPE;
3679 l_entry_value pay_element_entry_values_f.screen_entry_value%TYPE;
3680 l_element_name pay_element_types_f.element_name%TYPE;
3681 l_token1 VARCHAR2(240);
3682 --
3683 CURSOR csr_element_link_details
3684 (c_assignment_id IN per_assignments_f.assignment_id%TYPE
3685 ,c_effective_date IN DATE
3686 ,c_element_name IN pay_element_types_f.element_name%TYPE)
3687 IS
3688 SELECT types.element_type_id
3689 , link.element_link_id
3690 , assgn.business_group_id
3691 FROM per_assignments_f assgn
3692 , pay_element_links_f link
3693 , pay_element_types_f types
3694 WHERE assgn.assignment_id = c_assignment_id
3695 AND link.element_link_id = pay_in_utils.get_element_link_id(c_assignment_id
3696 ,c_effective_date
3697 ,types.element_type_id
3698 )
3699 AND (types.processing_type = 'R' OR assgn.payroll_id IS NOT NULL)
3700 AND link.business_group_id = assgn.business_group_id
3701 AND link.element_type_id = types.element_type_id
3702 AND types.element_name = c_element_name--'Deduction under Section 80CCE'
3703 AND c_effective_date BETWEEN assgn.effective_start_date
3704 AND assgn.effective_end_date
3705 AND c_effective_date BETWEEN link.effective_start_date
3706 AND link.effective_end_date
3707 AND c_effective_date BETWEEN types.effective_start_date
3708 AND types.effective_end_date;
3709 --
3710 CURSOR csr_element_entry_details
3711 (c_element_entry_id IN pay_element_entries_f.element_entry_id%TYPE
3712 ,c_effective_date IN DATE)
3713 IS
3714 SELECT entries.element_type_id
3715 , entries.object_version_number
3716 , assgn.business_group_id
3717 FROM pay_element_entries_f entries
3718 , per_assignments_f assgn
3719 WHERE entries.element_entry_id = c_element_entry_id
3720 AND entries.assignment_id = assgn.assignment_id
3721 AND c_effective_date BETWEEN entries.effective_start_date
3722 AND entries.effective_end_date
3723 AND c_effective_date BETWEEN assgn.effective_start_date
3724 AND assgn.effective_end_date;
3725
3726 CURSOR c_check_entry(c_element_name IN pay_element_types_f.element_name%TYPE
3727 ,c_effective_date IN DATE)
3728 IS
3729 SELECT entries.element_entry_id entry_id
3730 ,entries.object_version_number
3731 ,value2.screen_entry_value
3732 FROM per_assignments_f assgn
3733 , pay_element_links_f link
3734 , pay_element_types_f types
3735 , pay_element_entries_f entries
3736 , pay_element_entry_values_f value1
3737 , pay_input_values_f inputs1
3738 , pay_element_entry_values_f value2
3739 , pay_input_values_f inputs2
3740 WHERE assgn.assignment_id = p_assignment_id
3741 AND link.element_link_id = pay_in_utils.get_element_link_id(p_assignment_id
3742 ,c_effective_date
3743 ,types.element_type_id
3744 )
3745 AND (types.processing_type = 'R' OR assgn.payroll_id IS NOT NULL)
3746 AND link.business_group_id = assgn.business_group_id
3747 AND link.element_type_id = types.element_type_id
3748 AND types.element_name = c_element_name--'Deduction under Section 80CCE'
3749 AND entries.element_type_id = types.element_type_id
3750 AND entries.element_link_id = link.element_link_id
3751 AND entries.assignment_id = assgn.assignment_id
3752 AND value1.element_entry_id = entries.element_entry_id
3753 AND inputs1.input_value_id = value1.input_value_id
3754 AND inputs1.element_type_id = types.element_type_id
3755 AND inputs1.name = 'Component Name'
3756 AND value2.element_entry_id = entries.element_entry_id
3757 AND inputs2.input_value_id = value2.input_value_id
3758 AND inputs2.element_type_id = types.element_type_id
3759 AND inputs2.name = 'Investment Amount'
3760 AND c_effective_date BETWEEN assgn.effective_start_date AND assgn.effective_end_date
3761 AND c_effective_date BETWEEN link.effective_start_date AND link.effective_end_date
3762 AND c_effective_date BETWEEN types.effective_start_date AND types.effective_end_date
3763 AND c_effective_date BETWEEN entries.effective_start_date AND entries.effective_end_date
3764 AND c_effective_date BETWEEN inputs1.effective_start_date AND inputs1.effective_end_date
3765 AND c_effective_date BETWEEN value1.effective_start_date AND value1.effective_end_date
3766 AND c_effective_date BETWEEN inputs2.effective_start_date AND inputs2.effective_end_date
3767 AND c_effective_date BETWEEN value2.effective_start_date AND value2.effective_end_date
3768 AND value1.screen_entry_value = p_investment_type;
3769
3770 CURSOR c_screen_entry_value(p_effective_date DATE)
3771 IS
3772 SELECT peev.screen_entry_value
3773 FROM pay_element_entries_f peef,
3774 pay_input_values_f piv,
3775 pay_element_entry_values_f peev
3776 WHERE peef.element_entry_id = p_element_entry_id
3777 AND piv.element_type_id = peef.element_type_id
3778 AND piv.name = 'Component Name'
3779 AND peev.input_value_id = piv.input_value_id
3780 AND peev.element_entry_id = peef.element_entry_id
3781 AND piv.legislation_code = 'IN'
3782 AND p_effective_date BETWEEN peev.effective_start_date AND peev.effective_end_date
3783 AND p_effective_date BETWEEN piv.effective_start_date AND piv.effective_end_date
3784 AND p_effective_date BETWEEN peef.effective_start_date AND peef.effective_end_date;
3785
3786 BEGIN
3787 fnd_msg_pub.initialize; -- Bug 13767307
3788 l_procedure := g_package || 'declare_section80cce';
3789 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
3790
3791 IF g_debug THEN
3792 pay_in_utils.trace('**************************************************','********************');
3793 pay_in_utils.trace('p_assignment_id',p_assignment_id);
3794 pay_in_utils.trace('p_investment_type ',p_investment_type );
3795 pay_in_utils.trace('p_investment_amount',p_investment_amount);
3796 pay_in_utils.trace('p_effective_date ',p_effective_date );
3797 pay_in_utils.trace('p_element_entry_id',p_element_entry_id);
3798 pay_in_utils.trace('**************************************************','********************');
3799 END IF;
3800
3801 p_warnings := 'FALSE';
3802
3803
3804 --
3805 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
3806
3807 hr_session_utilities.insert_session_row(l_effective_date);
3808 --
3809 SELECT DECODE(p_investment_type
3810 ,'Pension Fund 80CCC','Pension Fund 80CCC'
3811 ,'Deferred Annuity','Deferred Annuity'
3812 ,'Senior Citizens Savings Scheme','Senior Citizens Savings Scheme'
3813 ,'Deduction under Section 80CCE'
3814 )
3815 INTO l_element_name
3816 FROM dual;
3817
3818 IF (p_element_entry_id IS NOT NULL)
3819 THEN
3820 OPEN c_screen_entry_value(l_effective_date);
3821 FETCH c_screen_entry_value INTO l_token1;
3822 CLOSE c_screen_entry_value;
3823
3824 IF (l_token1 <> p_investment_type)
3825 THEN
3826 --
3827 p_warnings := 'PER_IN_INVESTMENT_80CCE'||l_token1;
3828 RETURN;
3829 --
3830 END IF;
3831 END IF;
3832
3833 IF (NVL(p_element_entry_id, 0) = 0) THEN
3834 --
3835 pay_in_utils.set_location(g_debug, l_procedure, 20);
3836 --
3837 OPEN csr_element_link_details(p_assignment_id
3838 ,l_effective_date
3839 ,l_element_name);
3840 FETCH csr_element_link_details INTO l_element_type_id
3841 , l_element_link_id
3842 , l_business_group_id;
3843 CLOSE csr_element_link_details;
3844 --
3845 pay_in_utils.set_location(g_debug, l_procedure, 30);
3846 --
3847 IF l_element_link_id IS NULL THEN
3848 --
3849 hr_utility.set_message(800, 'PER_IN_MISSING_LINK');
3850 hr_utility.set_message_token('ELEMENT_NAME', l_element_name);--'Deduction under Section 80CCE');
3851 hr_utility.raise_error;
3852 --
3853 END IF;
3854 --
3855 IF g_debug THEN
3856 pay_in_utils.trace('Element Type ID: ', l_element_type_id);
3857 pay_in_utils.trace('Element Link ID: ', l_element_link_id);
3858 pay_in_utils.trace('Business Group ID: ', l_business_group_id);
3859 END IF;
3860 --
3861 -- Query the entry IDs required for creation of the element.
3862 get_element_entry_ids(l_element_type_id
3863 ,l_effective_date
3864 ,2
3865 ,l_input_values);
3866 --
3867 pay_in_utils.set_location(g_debug, l_procedure, 40);
3868
3869 -- Check if the element entry with same component is already present.
3870 -- If so then Update the same element by adding the investment amount
3871 -- to the existing one
3872 OPEN c_check_entry(l_element_name,l_effective_date);
3873 FETCH c_check_entry INTO l_ele_entry_id,l_ovn,l_entry_value;
3874 IF c_check_entry%FOUND THEN
3875
3876 pay_element_entry_api.update_element_entry
3877 (p_datetrack_update_mode => get_update_mode(l_ele_entry_id
3878 ,l_effective_date)
3879 ,p_effective_date => l_effective_date
3880 ,p_business_group_id => l_business_group_id
3881 ,p_element_entry_id => l_ele_entry_id
3882 ,p_object_version_number => l_ovn
3883 -- Investment Amount
3884 ,p_input_value_id1 => l_input_values(0).input_value_id
3885 -- Investment Type
3886 ,p_input_value_id2 => l_input_values(1).input_value_id
3887 ,p_entry_value1 => p_investment_amount+l_entry_value
3888 ,p_entry_value2 => p_investment_type
3889 ,p_effective_start_date => l_effective_start_date
3890 ,p_effective_end_date => l_effective_end_date
3891 ,p_update_warning => l_warnings
3892 );
3893
3894 IF l_effective_end_date <> (pay_in_utils.next_tax_year(l_effective_date)-1)
3895 THEN
3896 --
3897 -- End date the entry as of the financial year end date
3898 --
3899 delete_declaration
3900 (p_element_entry_id =>l_element_entry_id
3901 ,p_effective_date =>pay_in_utils.next_tax_year(l_effective_date)-1
3902 ,p_warnings =>p_warnings);
3903 --
3904 END IF;
3905
3906 ELSE /* If Element Entry does not exist */
3907 --
3908 -- In this case, we would have to create an element entry to the
3909 -- assignment and return the entry id, the rest would be handled
3910 -- by the update command in the calling procedure.
3911 pay_element_entry_api.create_element_entry
3912 (p_effective_date => l_effective_date
3913 ,p_business_group_id => l_business_group_id
3914 ,p_assignment_id => p_assignment_id
3915 ,p_element_link_id => l_element_link_id
3916 ,p_entry_type => 'E'
3917 -- Investment Amount
3918 ,p_input_value_id1 => l_input_values(0).input_value_id
3919 -- Investment Type
3920 ,p_input_value_id2 => l_input_values(1).input_value_id
3921 ,p_entry_value1 => p_investment_amount
3922 ,p_entry_value2 => p_investment_type
3923 ,p_effective_start_date => l_effective_start_date
3924 ,p_effective_end_date => l_effective_end_date
3925 ,p_element_entry_id => l_element_entry_id
3926 ,p_object_version_number => l_object_version_number
3927 ,p_create_warning => l_warnings
3928 );
3929 --
3930 pay_in_utils.set_location(g_debug, l_procedure, 50);
3931 --
3932 -- End date the entry as of the financial year end date
3933 --
3934 delete_declaration
3935 (p_element_entry_id => l_element_entry_id
3936 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
3937 ,p_warnings => p_warnings);
3938
3939 END IF;
3940 CLOSE c_check_entry;
3941 --
3942 ELSE
3943 --
3944 pay_in_utils.set_location(g_debug, l_procedure, 60);
3945 --
3946 OPEN csr_element_entry_details(p_element_entry_id
3947 ,l_effective_date);
3948 FETCH csr_element_entry_details INTO l_element_type_id
3949 , l_object_version_number
3950 , l_business_group_id;
3951 CLOSE csr_element_entry_details;
3952 --
3953 --
3954 -- Query the entry IDs required for creation of the element.
3955 get_element_entry_ids(l_element_type_id
3956 ,l_effective_date
3957 ,2
3958 ,l_input_values);
3959 --
3960 pay_in_utils.set_location(g_debug, l_procedure, 70);
3961 --
3962 -- An element entry for this element already exists we have to
3963 -- update the element entry with the newly submitted date.
3964 --
3965 pay_element_entry_api.update_element_entry
3966 (p_datetrack_update_mode => get_update_mode(p_element_entry_id
3967 ,l_effective_date)
3968 ,p_effective_date => l_effective_date
3969 ,p_business_group_id => l_business_group_id
3970 ,p_element_entry_id => p_element_entry_id
3971 ,p_object_version_number => l_object_version_number
3972 -- Investment Amount
3973 ,p_input_value_id1 => l_input_values(0).input_value_id
3974 -- Investment Type
3975 ,p_input_value_id2 => l_input_values(1).input_value_id
3976 ,p_entry_value1 => p_investment_amount
3977 ,p_entry_value2 => p_investment_type
3978 ,p_effective_start_date => l_effective_start_date
3979 ,p_effective_end_date => l_effective_end_date
3980 ,p_update_warning => l_warnings
3981 );
3982 --
3983 IF g_debug THEN
3984 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
3985 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
3986 END IF;
3987 --
3988 pay_in_utils.set_location(g_debug, l_procedure, 80);
3989 --
3990 IF l_effective_end_date <> (pay_in_utils.next_tax_year(l_effective_date)-1)
3991 THEN
3992 --
3993 -- End date the entry as of the financial year end date
3994 --
3995 delete_declaration
3996 (p_element_entry_id =>l_element_entry_id
3997 ,p_effective_date =>pay_in_utils.next_tax_year(l_effective_date)-1
3998 ,p_warnings =>p_warnings);
3999 --
4000 END IF;
4001 --
4002 END IF;
4003 --
4004 IF l_warnings = TRUE THEN
4005 --
4006 p_warnings := 'TRUE';
4007 --
4008 END IF;
4009 --
4010
4011 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,90);
4012 --
4013 EXCEPTION
4014 WHEN OTHERS THEN
4015 fnd_msg_pub.add_exc_msg
4016 (p_pkg_name => g_package
4017 ,p_procedure_name => 'declare_section80cce'
4018 ,p_error_text => substr(sqlerrm, 1, 240)
4019 );
4020 --
4021 END declare_section80cce;
4022
4023 --------------------------------------------------------------------------
4024 -- --
4025 -- Name : DECLARE_SECTION80GG --
4026 -- Type : PROCEDURE --
4027 -- Access : Public --
4028 -- Description : The procedure is responsible for storing the --
4029 -- detials in 'Deduction under Section 80GG' element. --
4030 -- --
4031 -- Parameters : --
4032 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
4033 -- p_effective_date DATE --
4034 -- p_claim_exemp_under_sec_80gg VARCHAR2 --
4035 -- OUT : p_warnings BOOLEAN --
4036 -- --
4037 -- Change History : --
4038 --------------------------------------------------------------------------
4039 -- Rev# Date Userid Description --
4040 --------------------------------------------------------------------------
4041 -- 1.0 14-Apr-2005 VGSRINIV Initial Version --
4042 --------------------------------------------------------------------------
4043
4044 PROCEDURE declare_section80gg
4045 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
4046 ,p_effective_date IN DATE DEFAULT NULL
4047 ,p_claim_exemp_under_sec_80gg IN VARCHAR2
4048 ,p_warnings OUT NOCOPY BOOLEAN)
4049 IS
4050
4051 l_procedure VARCHAR(100);
4052 l_message VARCHAR2(250);
4053 l_input_values t_input_values_tab;
4054 l_element_type_id pay_element_types_f.element_type_id%TYPE;
4055 l_element_link_id pay_element_links_f.element_link_id%TYPE;
4056 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
4057 l_business_group_id per_business_groups.business_group_id%TYPE;
4058 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
4059 l_effective_start_date DATE;
4060 l_effective_end_date DATE;
4061 l_effective_date DATE;
4062 l_endation_date DATE;
4063 l_warnings VARCHAR2(6);
4064 --
4065 BEGIN
4066 fnd_msg_pub.initialize; -- Bug 13767307
4067 l_procedure := g_package || 'declare_section80gg';
4068 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
4069
4070 IF g_debug THEN
4071 pay_in_utils.trace('**************************************************','********************');
4072 pay_in_utils.trace('p_assignment_id',p_assignment_id);
4073 pay_in_utils.trace('p_effective_date ',p_effective_date );
4074 pay_in_utils.trace('p_claim_exemp_under_sec_80gg',p_claim_exemp_under_sec_80gg);
4075 pay_in_utils.trace('**************************************************','********************');
4076 END IF;
4077 --
4078 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
4079
4080
4081 get_entry_details(p_assignment_id => p_assignment_id
4082 ,p_element_name => 'Deduction under Section 80GG'
4083 ,p_effective_date => l_effective_date
4084 ,p_element_type_id => l_element_type_id
4085 ,p_element_link_id => l_element_link_id
4086 ,p_element_entry_id => l_element_entry_id
4087 ,p_expected_entries => 1
4088 ,p_business_group_id => l_business_group_id
4089 ,p_object_version_number=> l_object_version_number
4090 ,p_input_values => l_input_values
4091 );
4092 --
4093 IF g_debug THEN
4094 pay_in_utils.trace('Element Type ID: ' , l_element_type_id);
4095 pay_in_utils.trace('Element Entry ID: ' , l_element_entry_id);
4096 pay_in_utils.trace('Business Group ID: ' , l_business_group_id);
4097 pay_in_utils.trace('Object Version Number: ' , l_object_version_number);
4098 END IF;
4099
4100 --
4101 pay_in_utils.set_location(g_debug, l_procedure, 20);
4102 --
4103 IF l_element_entry_id is null THEN
4104 --
4105 pay_in_utils.set_location(g_debug, l_procedure, 30);
4106 --
4107 --
4108 -- In this case, we would have to create an element entry to the
4109 -- assignment and return the entry id, the rest would be handled
4110 -- by the update command in the calling procedure.
4111 --
4112 pay_element_entry_api.create_element_entry
4113 (p_effective_date => l_effective_date
4114 ,p_business_group_id => l_business_group_id
4115 ,p_assignment_id => p_assignment_id
4116 ,p_element_link_id => l_element_link_id
4117 ,p_entry_type => 'E'
4118 --Claim Exemption under Sec 80GG
4119 ,p_input_value_id1 => l_input_values(0).input_value_id
4120 ,p_entry_value1 => p_claim_exemp_under_sec_80gg
4121 ,p_effective_start_date => l_effective_start_date
4122 ,p_effective_end_date => l_effective_end_date
4123 ,p_element_entry_id => l_element_entry_id
4124 ,p_object_version_number => l_object_version_number
4125 ,p_create_warning => p_warnings
4126 );
4127 --
4128 pay_in_utils.set_location(g_debug, l_procedure, 40);
4129 --
4130 -- End date the entry as of the financial year end date
4131 --
4132 --
4133 pay_in_utils.set_location(g_debug, l_procedure, 45);
4134 --
4135 delete_declaration
4136 (p_element_entry_id => l_element_entry_id
4137 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
4138 ,p_warnings => l_warnings);
4139 --
4140 --
4141 ELSE
4142 --
4143 pay_in_utils.set_location(g_debug, l_procedure, 50);
4144 --
4145 --
4146 -- An element entry for this element already exists we have to
4147 -- update the element entry with the newly submitted date.
4148 --
4149 pay_element_entry_api.update_element_entry
4150 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
4151 ,l_effective_date)
4152 ,p_effective_date => l_effective_date
4153 ,p_business_group_id => l_business_group_id
4154 ,p_element_entry_id => l_element_entry_id
4155 ,p_object_version_number => l_object_version_number
4156 --Claim Exemption under Sec 80GG
4157 ,p_input_value_id1 => l_input_values(0).input_value_id
4158 ,p_entry_value1 => p_claim_exemp_under_sec_80gg
4159 ,p_effective_start_date => l_effective_start_date
4160 ,p_effective_end_date => l_effective_end_date
4161 ,p_update_warning => p_warnings
4162 );
4163 --
4164 --
4165 pay_in_utils.set_location(g_debug, l_procedure, 60);
4166 --
4167 l_endation_date := pay_in_utils.next_tax_year(l_effective_date);
4168 --
4169 IF l_effective_end_date <> (l_endation_date - 1) THEN
4170 --
4171 -- End date the entry as of the financial year end date
4172 --
4173 delete_declaration
4174 (p_element_entry_id =>l_element_entry_id
4175 ,p_effective_date =>l_endation_date-1
4176 ,p_warnings =>l_warnings);
4177 --
4178 END IF;
4179 --
4180
4181 --
4182 END IF;
4183 --
4184 IF g_debug THEN
4185 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
4186 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
4187 END IF;
4188
4189 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
4190 --
4191 EXCEPTION
4192 WHEN OTHERS THEN
4193 fnd_msg_pub.add_exc_msg
4194 (p_pkg_name => g_package
4195 ,p_procedure_name => 'declare_section80gg'
4196 ,p_error_text => substr(sqlerrm, 1, 240)
4197 );
4198
4199 END;
4200
4201 --------------------------------------------------------------------------
4202 -- --
4203 -- Name : DECLARE_SECTION80E --
4204 -- Type : PROCEDURE --
4205 -- Access : Public --
4206 -- Description : The procedure is responsible for storing the --
4207 -- detials in 'Deduction under Section 80E' element. --
4208 -- --
4209 -- Parameters : --
4210 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
4211 -- p_effective_date DATE --
4212 -- p_higher_education_loan_80e NUMBER --
4213 -- OUT : p_warnings BOOLEAN --
4214 -- --
4215 -- Change History : --
4216 --------------------------------------------------------------------------
4217 -- Rev# Date Userid Description --
4218 --------------------------------------------------------------------------
4219 -- 1.0 14-Apr-2005 VGSRINIV Initial Version --
4220 --------------------------------------------------------------------------
4221
4222 PROCEDURE declare_section80e
4223 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
4224 ,p_effective_date IN DATE DEFAULT NULL
4225 ,p_higher_education_loan_80e IN NUMBER DEFAULT NULL
4226 ,p_warnings OUT NOCOPY BOOLEAN)
4227 IS
4228
4229 l_procedure VARCHAR(100);
4230 l_message VARCHAR2(250);
4231 l_input_values t_input_values_tab;
4232 l_element_type_id pay_element_types_f.element_type_id%TYPE;
4233 l_element_link_id pay_element_links_f.element_link_id%TYPE;
4234 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
4235 l_business_group_id per_business_groups.business_group_id%TYPE;
4236 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
4237 l_effective_start_date DATE;
4238 l_effective_end_date DATE;
4239 l_effective_date DATE;
4240 l_endation_date DATE;
4241 l_warnings VARCHAR2(6);
4242 --
4243 BEGIN
4244 fnd_msg_pub.initialize; -- Bug 13767307
4245 l_procedure := g_package || 'declare_section80e';
4246 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
4247
4248 IF g_debug THEN
4249 pay_in_utils.trace('**************************************************','********************');
4250 pay_in_utils.trace('p_assignment_id',p_assignment_id);
4251 pay_in_utils.trace('p_effective_date ',p_effective_date );
4252 pay_in_utils.trace('p_higher_education_loan_80e ',p_higher_education_loan_80e);
4253 pay_in_utils.trace('**************************************************','********************');
4254 END IF;
4255 --
4256 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
4257 --
4258
4259
4260 get_entry_details(p_assignment_id => p_assignment_id
4261 ,p_element_name => 'Deduction under Section 80E'
4262 ,p_effective_date => l_effective_date
4263 ,p_element_type_id => l_element_type_id
4264 ,p_element_link_id => l_element_link_id
4265 ,p_element_entry_id => l_element_entry_id
4266 ,p_expected_entries => 2
4267 ,p_business_group_id => l_business_group_id
4268 ,p_object_version_number=> l_object_version_number
4269 ,p_input_values => l_input_values
4270 );
4271 --
4272 IF g_debug THEN
4273 hr_utility.trace('Element Type ID: ' || l_element_type_id);
4274 hr_utility.trace('Element Entry ID: ' || l_element_entry_id);
4275 hr_utility.trace('Business Group ID: ' || l_business_group_id);
4276 hr_utility.trace('Object Version Number: ' || l_object_version_number);
4277 END IF;
4278 --
4279 pay_in_utils.set_location(g_debug, l_procedure, 20);
4280 --
4281 IF l_element_entry_id is null THEN
4282 --
4283 pay_in_utils.set_location(g_debug, l_procedure, 30);
4284 --
4285 --
4286 -- In this case, we would have to create an element entry to the
4287 -- assignment and return the entry id, the rest would be handled
4288 -- by the update command in the calling procedure.
4289 --
4290 pay_element_entry_api.create_element_entry
4291 (p_effective_date => l_effective_date
4292 ,p_business_group_id => l_business_group_id
4293 ,p_assignment_id => p_assignment_id
4294 ,p_element_link_id => l_element_link_id
4295 ,p_entry_type => 'E'
4296 --Claim Exemption under Sec 80E
4297 ,p_input_value_id1 => l_input_values(0).input_value_id
4298 ,p_entry_value1 => p_higher_education_loan_80e
4299 ,p_effective_start_date => l_effective_start_date
4300 ,p_effective_end_date => l_effective_end_date
4301 ,p_element_entry_id => l_element_entry_id
4302 ,p_object_version_number => l_object_version_number
4303 ,p_create_warning => p_warnings
4304 );
4305 --
4306 pay_in_utils.set_location(g_debug, l_procedure, 40);
4307 --
4308 -- End date the entry as of the financial year end date
4309 --
4310 --
4311 pay_in_utils.set_location(g_debug, l_procedure, 45);
4312 --
4313 delete_declaration
4314 (p_element_entry_id => l_element_entry_id
4315 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
4316 ,p_warnings => l_warnings);
4317 --
4318 --
4319 ELSE
4320 --
4321 pay_in_utils.set_location(g_debug, l_procedure, 50);
4322 --
4323 --
4324 -- An element entry for this element already exists we have to
4325 -- update the element entry with the newly submitted date.
4326 --
4327 IF p_higher_education_loan_80e > 0 THEN
4328
4329 pay_element_entry_api.update_element_entry
4330 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
4331 ,l_effective_date)
4332 ,p_effective_date => l_effective_date
4333 ,p_business_group_id => l_business_group_id
4334 ,p_element_entry_id => l_element_entry_id
4335 ,p_object_version_number => l_object_version_number
4336 --Claim Exemption under Sec 80E
4337 ,p_input_value_id1 => l_input_values(0).input_value_id
4338 ,p_entry_value1 => p_higher_education_loan_80e
4339 ,p_effective_start_date => l_effective_start_date
4340 ,p_effective_end_date => l_effective_end_date
4341 ,p_update_warning => p_warnings
4342 );
4343 --
4344 --
4345 pay_in_utils.set_location(g_debug, l_procedure, 60);
4346 --
4347 l_endation_date := pay_in_utils.next_tax_year(l_effective_date);
4348
4349 IF l_effective_end_date <> (l_endation_date - 1) THEN
4350 --
4351 -- End date the entry as of the financial year end date
4352 --
4353 delete_declaration
4354 (p_element_entry_id =>l_element_entry_id
4355 ,p_effective_date =>l_endation_date-1
4356 ,p_warnings =>l_warnings);
4357
4358 --
4359 END IF;
4360
4361 ELSE
4362
4363 delete_declaration
4364 (p_element_entry_id =>l_element_entry_id
4365 ,p_effective_date =>l_effective_date
4366 ,p_warnings =>l_warnings
4367 ,p_deletion_mode =>'PURGE'); /* Passing new parameter p_deletion_mode for 13105285*/
4368
4369 END IF;
4370 --
4371
4372 --
4373 END IF;
4374 --
4375 IF g_debug THEN
4376 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
4377 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
4378 END IF;
4379
4380 --
4381 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,80);
4382 --
4383 EXCEPTION
4384 WHEN OTHERS THEN
4385 fnd_msg_pub.add_exc_msg
4386 (p_pkg_name => g_package
4387 ,p_procedure_name => 'declare_section80e'
4388 ,p_error_text => substr(sqlerrm, 1, 240)
4389 );
4390
4391 END;
4392
4393 --------------------------------------------------------------------------
4394 -- --
4395 -- Name : DECLARE_SECTION80CCF --
4396 -- Type : PROCEDURE --
4397 -- Access : Public --
4398 -- Description : The procedure is responsible for storing the --
4399 -- detials in 'Deduction under Section 80CCF' element. --
4400 -- --
4401 -- Parameters : --
4402 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
4403 -- p_effective_date DATE --
4404 -- p_infrastructure_bonds_80ccf NUMBER --
4405 -- OUT : p_warnings BOOLEAN --
4406 -- --
4407 -- Change History : --
4408 --------------------------------------------------------------------------
4409 -- Rev# Date Userid Description --
4410 --------------------------------------------------------------------------
4411 -- 1.0 11-Mar-2010 MDUBASI Initial Version --
4412 --------------------------------------------------------------------------
4413
4414 PROCEDURE declare_section80ccf
4415 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
4416 ,p_effective_date IN DATE DEFAULT NULL
4417 ,p_infrastructure_bonds_80ccf IN NUMBER DEFAULT NULL
4418 ,p_warnings OUT NOCOPY BOOLEAN)
4419 IS
4420
4421 l_procedure VARCHAR(100);
4422 l_message VARCHAR2(250);
4423 l_input_values t_input_values_tab;
4424 l_element_type_id pay_element_types_f.element_type_id%TYPE;
4425 l_element_link_id pay_element_links_f.element_link_id%TYPE;
4426 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
4427 l_business_group_id per_business_groups.business_group_id%TYPE;
4428 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
4429 l_effective_start_date DATE;
4430 l_effective_end_date DATE;
4431 l_effective_date DATE;
4432 l_endation_date DATE;
4433 l_warnings VARCHAR2(6);
4434 --
4435 BEGIN
4436 fnd_msg_pub.initialize; -- Bug 13767307
4437 l_procedure := g_package || 'declare_section80ccf';
4438 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
4439
4440 IF g_debug THEN
4441 pay_in_utils.trace('**************************************************','********************');
4442 pay_in_utils.trace('p_assignment_id',p_assignment_id);
4443 pay_in_utils.trace('p_effective_date ',p_effective_date );
4444 pay_in_utils.trace('p_infrastructure_bonds_80ccf ',p_infrastructure_bonds_80ccf);
4445 pay_in_utils.trace('**************************************************','********************');
4446 END IF;
4447 --
4448 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
4449 --
4450
4451
4452 get_entry_details(p_assignment_id => p_assignment_id
4453 ,p_element_name => 'Deduction under Section 80CCF'
4454 ,p_effective_date => l_effective_date
4455 ,p_element_type_id => l_element_type_id
4456 ,p_element_link_id => l_element_link_id
4457 ,p_element_entry_id => l_element_entry_id
4458 ,p_expected_entries => 3
4459 ,p_business_group_id => l_business_group_id
4460 ,p_object_version_number=> l_object_version_number
4461 ,p_input_values => l_input_values
4462 );
4463 --
4464 IF g_debug THEN
4465 hr_utility.trace('Element Type ID: ' || l_element_type_id);
4466 hr_utility.trace('Element Entry ID: ' || l_element_entry_id);
4467 hr_utility.trace('Business Group ID: ' || l_business_group_id);
4468 hr_utility.trace('Object Version Number: ' || l_object_version_number);
4469 END IF;
4470 --
4471 pay_in_utils.set_location(g_debug, l_procedure, 20);
4472 --
4473 IF l_element_entry_id is null THEN
4474 --
4475 pay_in_utils.set_location(g_debug, l_procedure, 30);
4476 --
4477 --
4478 -- In this case, we would have to create an element entry to the
4479 -- assignment and return the entry id, the rest would be handled
4480 -- by the update command in the calling procedure.
4481 --
4482 pay_element_entry_api.create_element_entry
4483 (p_effective_date => l_effective_date
4484 ,p_business_group_id => l_business_group_id
4485 ,p_assignment_id => p_assignment_id
4486 ,p_element_link_id => l_element_link_id
4487 ,p_entry_type => 'E'
4488 --Claim Exemption under Sec 80CCF
4489 ,p_input_value_id1 => l_input_values(0).input_value_id
4490 ,p_entry_value1 => p_infrastructure_bonds_80ccf
4491 ,p_effective_start_date => l_effective_start_date
4492 ,p_effective_end_date => l_effective_end_date
4493 ,p_element_entry_id => l_element_entry_id
4494 ,p_object_version_number => l_object_version_number
4495 ,p_create_warning => p_warnings
4496 );
4497 --
4498 pay_in_utils.set_location(g_debug, l_procedure, 40);
4499 --
4500 -- End date the entry as of the financial year end date
4501 --
4502 --
4503 pay_in_utils.set_location(g_debug, l_procedure, 45);
4504 --
4505 delete_declaration
4506 (p_element_entry_id => l_element_entry_id
4507 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
4508 ,p_warnings => l_warnings);
4509 --
4510 --
4511 ELSE
4512 --
4513 pay_in_utils.set_location(g_debug, l_procedure, 50);
4514 --
4515 --
4516 -- An element entry for this element already exists we have to
4517 -- update the element entry with the newly submitted date.
4518 --
4519 IF p_infrastructure_bonds_80ccf > 0 THEN
4520
4521 pay_element_entry_api.update_element_entry
4522 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
4523 ,l_effective_date)
4524 ,p_effective_date => l_effective_date
4525 ,p_business_group_id => l_business_group_id
4526 ,p_element_entry_id => l_element_entry_id
4527 ,p_object_version_number => l_object_version_number
4528 --Claim Exemption under Sec 80CCF
4529 ,p_input_value_id1 => l_input_values(0).input_value_id
4530 ,p_entry_value1 => p_infrastructure_bonds_80ccf
4531 ,p_effective_start_date => l_effective_start_date
4532 ,p_effective_end_date => l_effective_end_date
4533 ,p_update_warning => p_warnings
4534 );
4535 --
4536 --
4537 pay_in_utils.set_location(g_debug, l_procedure, 60);
4538 --
4539 l_endation_date := pay_in_utils.next_tax_year(l_effective_date);
4540
4541 IF l_effective_end_date <> (l_endation_date - 1) THEN
4542 --
4543 -- End date the entry as of the financial year end date
4544 --
4545 delete_declaration
4546 (p_element_entry_id =>l_element_entry_id
4547 ,p_effective_date =>l_endation_date-1
4548 ,p_warnings =>l_warnings);
4549 --
4550 END IF;
4551
4552 ELSE
4553
4554 delete_declaration
4555 (p_element_entry_id =>l_element_entry_id
4556 ,p_effective_date =>l_effective_date
4557 ,p_warnings =>l_warnings
4558 ,p_deletion_mode => 'PURGE'); /* Passing new parameter p_deletion_mode for 13105285*/
4559
4560 END IF;
4561 --
4562
4563 --
4564 END IF;
4565 --
4566 IF g_debug THEN
4567 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
4568 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
4569 END IF;
4570
4571 --
4572 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,80);
4573 --
4574 EXCEPTION
4575 WHEN OTHERS THEN
4576 fnd_msg_pub.add_exc_msg
4577 (p_pkg_name => g_package
4578 ,p_procedure_name => 'declare_section80ccf'
4579 ,p_error_text => substr(sqlerrm, 1, 240)
4580 );
4581
4582 END declare_section80ccf;
4583
4584
4585 --------------------------------------------------------------------------
4586 -- --
4587 -- Name : DECLARE_SECTION80CCG --
4588 -- Type : PROCEDURE --
4589 -- Access : Public --
4590 -- Description : The procedure is responsible for storing the --
4591 -- detials in 'Deduction under Section 80CCG' element. --
4592 -- --
4593 -- Parameters : --
4594 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
4595 -- p_effective_date DATE --
4596 -- p_investment_amt_80ccg NUMBER --
4597 -- p_investment_date_80ccg DATE --
4598 -- OUT : p_warnings BOOLEAN --
4599 -- --
4600 -- Change History : --
4601 --------------------------------------------------------------------------
4602 -- Rev# Date Userid Description --
4603 --------------------------------------------------------------------------
4604 -- 1.0 11-Mar-2010 MDUBASI Initial Version --
4605 --------------------------------------------------------------------------
4606 PROCEDURE declare_section80ccg
4607 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
4608 ,p_effective_date IN DATE DEFAULT NULL
4609 ,p_investment_amt_80ccg IN NUMBER DEFAULT NULL
4610 ,p_investment_date_80ccg IN DATE DEFAULT NULL
4611 ,p_warnings OUT NOCOPY BOOLEAN)
4612 IS
4613 l_procedure VARCHAR(100);
4614 l_message VARCHAR2(250);
4615 l_input_values t_input_values_tab;
4616 l_element_type_id pay_element_types_f.element_type_id%TYPE;
4617 l_element_link_id pay_element_links_f.element_link_id%TYPE;
4618 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
4619 l_business_group_id per_business_groups.business_group_id%TYPE;
4620 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
4621 l_effective_start_date DATE;
4622 l_effective_end_date DATE;
4623 l_effective_date DATE;
4624 l_endation_date DATE;
4625 l_warnings VARCHAR2(6);
4626 --
4627 BEGIN
4628 fnd_msg_pub.initialize; -- Bug 13767307
4629 l_procedure := g_package || 'declare_section80ccg';
4630 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
4631
4632 IF g_debug THEN
4633 pay_in_utils.trace('**************************************************','********************');
4634 pay_in_utils.trace('p_assignment_id',p_assignment_id);
4635 pay_in_utils.trace('p_effective_date ',p_effective_date );
4636 pay_in_utils.trace('p_investment_amt_80ccg ',p_investment_amt_80ccg);
4637 pay_in_utils.trace('p_investment_date_80ccg ',p_investment_date_80ccg);
4638 pay_in_utils.trace('**************************************************','********************');
4639 END IF;
4640 --
4641 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
4642 --
4643
4644
4645 get_entry_details(p_assignment_id => p_assignment_id
4646 ,p_element_name => 'Deduction under Section 80CCG'
4647 ,p_effective_date => l_effective_date
4648 ,p_element_type_id => l_element_type_id
4649 ,p_element_link_id => l_element_link_id
4650 ,p_element_entry_id => l_element_entry_id
4651 ,p_expected_entries => 3
4652 ,p_business_group_id => l_business_group_id
4653 ,p_object_version_number=> l_object_version_number
4654 ,p_input_values => l_input_values
4655 );
4656 --
4657 IF g_debug THEN
4658 hr_utility.trace('Element Type ID: ' || l_element_type_id);
4659 hr_utility.trace('Element Entry ID: ' || l_element_entry_id);
4660 hr_utility.trace('Business Group ID: ' || l_business_group_id);
4661 hr_utility.trace('Object Version Number: ' || l_object_version_number);
4662 END IF;
4663 --
4664 pay_in_utils.set_location(g_debug, l_procedure, 20);
4665 --
4666 IF l_element_entry_id is null THEN
4667 --
4668 pay_in_utils.set_location(g_debug, l_procedure, 30);
4669 --
4670 --
4671 -- In this case, we would have to create an element entry to the
4672 -- assignment and return the entry id, the rest would be handled
4673 -- by the update command in the calling procedure.
4674 --
4675 pay_element_entry_api.create_element_entry
4676 (p_effective_date => l_effective_date
4677 ,p_business_group_id => l_business_group_id
4678 ,p_assignment_id => p_assignment_id
4679 ,p_element_link_id => l_element_link_id
4680 ,p_entry_type => 'E'
4681 ,p_input_value_id1 => l_input_values(0).input_value_id
4682 ,p_entry_value1 => p_investment_amt_80ccg
4683 ,p_input_value_id2 => l_input_values(2).input_value_id
4684 ,p_entry_value2 => p_investment_date_80ccg
4685 ,p_effective_start_date => l_effective_start_date
4686 ,p_effective_end_date => l_effective_end_date
4687 ,p_element_entry_id => l_element_entry_id
4688 ,p_object_version_number => l_object_version_number
4689 ,p_create_warning => p_warnings
4690 );
4691 --
4692 pay_in_utils.set_location(g_debug, l_procedure, 40);
4693 --
4694 -- End date the entry as of the financial year end date
4695 --
4696 --
4697 pay_in_utils.set_location(g_debug, l_procedure, 45);
4698 --
4699 delete_declaration
4700 (p_element_entry_id => l_element_entry_id
4701 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
4702 ,p_warnings => l_warnings);
4703 --
4704 --
4705 ELSE
4706 --
4707 pay_in_utils.set_location(g_debug, l_procedure, 50);
4708 --
4709 --
4710 -- An element entry for this element already exists we have to
4711 -- update the element entry with the newly submitted date.
4712 --
4713 IF p_investment_amt_80ccg > 0 THEN
4714
4715 pay_element_entry_api.update_element_entry
4716 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
4717 ,l_effective_date)
4718 ,p_effective_date => l_effective_date
4719 ,p_business_group_id => l_business_group_id
4720 ,p_element_entry_id => l_element_entry_id
4721 ,p_object_version_number => l_object_version_number
4722 --Claim Exemption under Sec 80CCG
4723 ,p_input_value_id1 => l_input_values(0).input_value_id
4724 ,p_entry_value1 => p_investment_amt_80ccg
4725 ,p_input_value_id2 => l_input_values(2).input_value_id
4726 ,p_entry_value2 => p_investment_date_80ccg
4727 ,p_effective_start_date => l_effective_start_date
4728 ,p_effective_end_date => l_effective_end_date
4729 ,p_update_warning => p_warnings
4730 );
4731 --
4732 --
4733 pay_in_utils.set_location(g_debug, l_procedure, 60);
4734 --
4735 l_endation_date := pay_in_utils.next_tax_year(l_effective_date);
4736
4737 IF l_effective_end_date <> (l_endation_date - 1) THEN
4738 --
4739 -- End date the entry as of the financial year end date
4740 --
4741 delete_declaration
4742 (p_element_entry_id =>l_element_entry_id
4743 ,p_effective_date =>l_endation_date-1
4744 ,p_warnings =>l_warnings);
4745 --
4746 END IF;
4747
4748 ELSE
4749
4750 delete_declaration
4751 (p_element_entry_id =>l_element_entry_id
4752 ,p_effective_date =>l_effective_date
4753 ,p_warnings =>l_warnings
4754 ,p_deletion_mode => 'PURGE'); /* Passing new parameter p_deletion_mode for 13105285*/
4755
4756 END IF;
4757 --
4758
4759 --
4760 END IF;
4761 --
4762 IF g_debug THEN
4763 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
4764 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
4765 END IF;
4766
4767 --
4768 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,80);
4769 --
4770 EXCEPTION
4771 WHEN OTHERS THEN
4772 fnd_msg_pub.add_exc_msg
4773 (p_pkg_name => g_package
4774 ,p_procedure_name => 'declare_section80ccg'
4775 ,p_error_text => substr(sqlerrm, 1, 240)
4776 );
4777
4778 END declare_section80ccg;
4779
4780
4781 --------------------------------------------------------------------------
4782 -- --
4783 -- Name : DECLARE_SECTION80GGA --
4784 -- Type : PROCEDURE --
4785 -- Access : Public --
4786 -- Description : The procedure is responsible for storing the --
4787 -- detials in 'Deduction under Section 80GGA' element. --
4788 -- --
4789 -- Parameters : --
4790 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
4791 -- p_effective_date DATE --
4792 -- p_donation_for_research_80gga NUMBER --
4793 -- OUT : p_warnings BOOLEAN --
4794 -- --
4795 -- Change History : --
4796 --------------------------------------------------------------------------
4797 -- Rev# Date Userid Description --
4798 --------------------------------------------------------------------------
4799 -- 1.0 14-Apr-2005 VGSRINIV Initial Version --
4800 --------------------------------------------------------------------------
4801
4802 PROCEDURE declare_section80gga
4803 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
4804 ,p_effective_date IN DATE DEFAULT NULL
4805 ,p_donation_for_research_80gga IN NUMBER DEFAULT NULL
4806 ,p_warnings OUT NOCOPY BOOLEAN)
4807 IS
4808
4809 l_procedure VARCHAR(100);
4810 l_message VARCHAR2(250);
4811 l_input_values t_input_values_tab;
4812 l_element_type_id pay_element_types_f.element_type_id%TYPE;
4813 l_element_link_id pay_element_links_f.element_link_id%TYPE;
4814 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
4815 l_business_group_id per_business_groups.business_group_id%TYPE;
4816 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
4817 l_effective_start_date DATE;
4818 l_effective_end_date DATE;
4819 l_effective_date DATE;
4820 l_endation_date DATE;
4821 l_warnings VARCHAR2(6);
4822 --
4823 BEGIN
4824 fnd_msg_pub.initialize; -- Bug 13767307
4825 l_procedure := g_package || 'declare_section80gga';
4826 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
4827
4828 IF g_debug THEN
4829 pay_in_utils.trace('**************************************************','********************');
4830 pay_in_utils.trace('p_assignment_id',p_assignment_id);
4831 pay_in_utils.trace('p_effective_date ',p_effective_date );
4832 pay_in_utils.trace('p_donation_for_research_80gga ',p_donation_for_research_80gga);
4833 pay_in_utils.trace('**************************************************','********************');
4834 END IF;
4835 --
4836 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
4837 --
4838 --
4839
4840 get_entry_details(p_assignment_id => p_assignment_id
4841 ,p_element_name => 'Deduction under Section 80GGA'
4842 ,p_effective_date => l_effective_date
4843 ,p_element_type_id => l_element_type_id
4844 ,p_element_link_id => l_element_link_id
4845 ,p_element_entry_id => l_element_entry_id
4846 ,p_expected_entries => 3
4847 ,p_business_group_id => l_business_group_id
4848 ,p_object_version_number=> l_object_version_number
4849 ,p_input_values => l_input_values
4850 );
4851 --
4852 IF g_debug THEN
4853 pay_in_utils.trace('Element Type ID: ' , l_element_type_id);
4854 pay_in_utils.trace('Element Entry ID: ' , l_element_entry_id);
4855 pay_in_utils.trace('Business Group ID: ' , l_business_group_id);
4856 pay_in_utils.trace('Object Version Number: ' , l_object_version_number);
4857 END IF;
4858
4859 --
4860 pay_in_utils.set_location(g_debug, l_procedure, 20);
4861 --
4862 IF l_element_entry_id is null THEN
4863 --
4864 pay_in_utils.set_location(g_debug, l_procedure, 30);
4865 --
4866 --
4867 -- In this case, we would have to create an element entry to the
4868 -- assignment and return the entry id, the rest would be handled
4869 -- by the update command in the calling procedure.
4870 --
4871 pay_element_entry_api.create_element_entry
4872 (p_effective_date => l_effective_date
4873 ,p_business_group_id => l_business_group_id
4874 ,p_assignment_id => p_assignment_id
4875 ,p_element_link_id => l_element_link_id
4876 ,p_entry_type => 'E'
4877 --Deduction under Sec 80GGA
4878 ,p_input_value_id1 => l_input_values(0).input_value_id
4879 ,p_entry_value1 => p_donation_for_research_80gga
4880 ,p_effective_start_date => l_effective_start_date
4881 ,p_effective_end_date => l_effective_end_date
4882 ,p_element_entry_id => l_element_entry_id
4883 ,p_object_version_number => l_object_version_number
4884 ,p_create_warning => p_warnings
4885 );
4886 --
4887 pay_in_utils.set_location(g_debug, l_procedure, 40);
4888 --
4889 -- End date the entry as of the financial year end date
4890 --
4891 --
4892 pay_in_utils.set_location(g_debug, l_procedure, 45);
4893 --
4894 delete_declaration
4895 (p_element_entry_id => l_element_entry_id
4896 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
4897 ,p_warnings => l_warnings);
4898 --
4899 --
4900 ELSE
4901 --
4902 pay_in_utils.set_location(g_debug, l_procedure, 50);
4903 --
4904 --
4905 -- An element entry for this element already exists we have to
4906 -- update the element entry with the newly submitted date.
4907 --
4908 IF p_donation_for_research_80gga > 0 THEN
4909
4910 pay_element_entry_api.update_element_entry
4911 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
4912 ,l_effective_date)
4913 ,p_effective_date => l_effective_date
4914 ,p_business_group_id => l_business_group_id
4915 ,p_element_entry_id => l_element_entry_id
4916 ,p_object_version_number => l_object_version_number
4917 --Deduction under Sec 80GGA
4918 ,p_input_value_id1 => l_input_values(0).input_value_id
4919 ,p_entry_value1 => p_donation_for_research_80gga
4920 ,p_effective_start_date => l_effective_start_date
4921 ,p_effective_end_date => l_effective_end_date
4922 ,p_update_warning => p_warnings
4923 );
4924 --
4925 --
4926 pay_in_utils.set_location(g_debug, l_procedure, 60);
4927 --
4928 l_endation_date := pay_in_utils.next_tax_year(l_effective_date);
4929 --
4930 IF l_effective_end_date <> (l_endation_date - 1) THEN
4931 --
4932 -- End date the entry as of the financial year end date
4933 --
4934 delete_declaration
4935 (p_element_entry_id =>l_element_entry_id
4936 ,p_effective_date =>l_endation_date-1
4937 ,p_warnings =>l_warnings);
4938 --
4939 END IF;
4940
4941 ELSE
4942
4943 delete_declaration
4944 (p_element_entry_id =>l_element_entry_id
4945 ,p_effective_date =>l_effective_date
4946 ,p_warnings =>l_warnings
4947 ,p_deletion_mode => 'PURGE'); /* Passing new parameter p_deletion_mode for 13105285*/
4948
4949 END IF;
4950
4951 --
4952 END IF;
4953 --
4954 IF g_debug THEN
4955 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
4956 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
4957 END IF;
4958 --
4959 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
4960 --
4961 EXCEPTION
4962 WHEN OTHERS THEN
4963 fnd_msg_pub.add_exc_msg
4964 (p_pkg_name => g_package
4965 ,p_procedure_name => 'declare_section80gga'
4966 ,p_error_text => substr(sqlerrm, 1, 240)
4967 );
4968
4969 END;
4970
4971 --------------------------------------------------------------------------
4972 -- --
4973 -- Name : DECLARE_SECTION80D --
4974 -- Type : PROCEDURE --
4975 -- Access : Public --
4976 -- Description : The procedure is responsible for storing the --
4977 -- detials in 'Deduction under Section 80D' element. --
4978 -- --
4979 -- Parameters : --
4980 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
4981 -- p_effective_date DATE --
4982 -- p_medical_insurance_prem_80d NUMBER --
4983 -- p_sec_80d_senior_citizen VARCHAR2 --
4984 -- OUT : p_warnings BOOLEAN --
4985 -- --
4986 -- Change History : --
4987 --------------------------------------------------------------------------
4988 -- Rev# Date Userid Description --
4989 --------------------------------------------------------------------------
4990 -- 1.0 14-Apr-2005 VGSRINIV Initial Version --
4991 --------------------------------------------------------------------------
4992
4993 PROCEDURE declare_section80d
4994 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
4995 ,p_effective_date IN DATE DEFAULT NULL
4996 ,p_medical_insurance_prem_80d IN NUMBER DEFAULT NULL
4997 ,p_sec_80d_senior_citizen IN VARCHAR2 DEFAULT NULL
4998 ,p_med_par_insurance_prem_80d IN NUMBER DEFAULT NULL
4999 ,p_sec_80d_par_senior_citizen IN VARCHAR2 DEFAULT NULL
5000 ,p_health_checkup_self IN NUMBER DEFAULT NULL
5001 ,p_health_checkup_parents IN NUMBER DEFAULT NULL
5002 ,p_warnings OUT NOCOPY BOOLEAN)
5003 IS
5004
5005 l_procedure VARCHAR(100);
5006 l_message VARCHAR2(250);
5007 l_input_values t_input_values_tab;
5008 l_element_type_id pay_element_types_f.element_type_id%TYPE;
5009 l_element_link_id pay_element_links_f.element_link_id%TYPE;
5010 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
5011 l_business_group_id per_business_groups.business_group_id%TYPE;
5012 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
5013 l_effective_start_date DATE;
5014 l_effective_end_date DATE;
5015 l_effective_date DATE;
5016 l_endation_date DATE;
5017 l_warnings VARCHAR2(6);
5018 --
5019 BEGIN
5020 fnd_msg_pub.initialize; -- Bug 13767307
5021 l_procedure := g_package || 'declare_section80d';
5022 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
5023
5024 IF g_debug THEN
5025 pay_in_utils.trace('**************************************************','********************');
5026 pay_in_utils.trace('p_assignment_id',p_assignment_id);
5027 pay_in_utils.trace('p_effective_date ',p_effective_date );
5028 pay_in_utils.trace('p_medical_insurance_prem_80d ',p_medical_insurance_prem_80d);
5029 pay_in_utils.trace('p_sec_80d_senior_citizen ',p_sec_80d_senior_citizen);
5030 pay_in_utils.trace('p_med_par_insurance_prem_80d ',p_med_par_insurance_prem_80d);
5031 pay_in_utils.trace('p_sec_80d_par_senior_citizen ',p_sec_80d_par_senior_citizen);
5032 pay_in_utils.trace('p_health_checkup_self ',p_health_checkup_self);
5033 pay_in_utils.trace('p_health_checkup_parents ',p_health_checkup_parents);
5034 pay_in_utils.trace('**************************************************','********************');
5035 END IF;
5036 --
5037 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
5038 --
5039 --
5040
5041 get_entry_details(p_assignment_id => p_assignment_id
5042 ,p_element_name => 'Deduction under Section 80D'
5043 ,p_effective_date => l_effective_date
5044 ,p_element_type_id => l_element_type_id
5045 ,p_element_link_id => l_element_link_id
5046 ,p_element_entry_id => l_element_entry_id
5047 ,p_expected_entries => 10
5048 ,p_business_group_id => l_business_group_id
5049 ,p_object_version_number=> l_object_version_number
5050 ,p_input_values => l_input_values
5051 );
5052 --
5053 IF g_debug THEN
5054 pay_in_utils.trace('Element Type ID: ' , l_element_type_id);
5055 pay_in_utils.trace('Element Entry ID: ' , l_element_entry_id);
5056 pay_in_utils.trace('Business Group ID: ' , l_business_group_id);
5057 pay_in_utils.trace('Object Version Number: ' , l_object_version_number);
5058 END IF;
5059 --
5060 pay_in_utils.set_location(g_debug, l_procedure, 20);
5061 --
5062 IF l_element_entry_id is null THEN
5063 --
5064 pay_in_utils.set_location(g_debug, l_procedure, 30);
5065 --
5066 --
5067 -- In this case, we would have to create an element entry to the
5068 -- assignment and return the entry id, the rest would be handled
5069 -- by the update command in the calling procedure.
5070 --
5071 pay_element_entry_api.create_element_entry
5072 (p_effective_date => l_effective_date
5073 ,p_business_group_id => l_business_group_id
5074 ,p_assignment_id => p_assignment_id
5075 ,p_element_link_id => l_element_link_id
5076 ,p_entry_type => 'E'
5077 --Deduction under Sec 80D
5078 ,p_input_value_id1 => l_input_values(0).input_value_id
5079 ,p_entry_value1 => p_medical_insurance_prem_80d
5080 ,p_input_value_id2 => l_input_values(2).input_value_id
5081 ,p_entry_value2 => p_sec_80d_senior_citizen
5082 ,p_input_value_id3 => l_input_values(4).input_value_id
5083 ,p_entry_value3 => p_med_par_insurance_prem_80d
5084 ,p_input_value_id4 => l_input_values(5).input_value_id
5085 ,p_entry_value4 => p_sec_80d_par_senior_citizen
5086 ,p_input_value_id5 => l_input_values(8).input_value_id
5087 ,p_entry_value5 => p_health_checkup_self
5088 ,p_input_value_id6 => l_input_values(9).input_value_id
5089 ,p_entry_value6 => p_health_checkup_parents
5090 ,p_effective_start_date => l_effective_start_date
5091 ,p_effective_end_date => l_effective_end_date
5092 ,p_element_entry_id => l_element_entry_id
5093 ,p_object_version_number => l_object_version_number
5094 ,p_create_warning => p_warnings
5095 );
5096 --
5097 pay_in_utils.set_location(g_debug, l_procedure, 40);
5098 --
5099 -- End date the entry as of the financial year end date
5100 --
5101 --
5102 pay_in_utils.set_location(g_debug, l_procedure, 45);
5103 --
5104 delete_declaration
5105 (p_element_entry_id => l_element_entry_id
5106 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
5107 ,p_warnings => l_warnings);
5108 --
5109 --
5110 ELSE
5111 --
5112 pay_in_utils.set_location(g_debug, l_procedure, 50);
5113 --
5114 --
5115 -- An element entry for this element already exists we have to
5116 -- update the element entry with the newly submitted date.
5117 --
5118
5119
5120 pay_element_entry_api.update_element_entry
5121 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
5122 ,l_effective_date)
5123 ,p_effective_date => l_effective_date
5124 ,p_business_group_id => l_business_group_id
5125 ,p_element_entry_id => l_element_entry_id
5126 ,p_object_version_number => l_object_version_number
5127 --Deduction under Sec 80D
5128 ,p_input_value_id1 => l_input_values(0).input_value_id
5129 ,p_entry_value1 => p_medical_insurance_prem_80d
5130 ,p_input_value_id2 => l_input_values(2).input_value_id
5131 ,p_entry_value2 => p_sec_80d_senior_citizen
5132 ,p_input_value_id3 => l_input_values(4).input_value_id
5133 ,p_entry_value3 => p_med_par_insurance_prem_80d
5134 ,p_input_value_id4 => l_input_values(5).input_value_id
5135 ,p_entry_value4 => p_sec_80d_par_senior_citizen
5136 ,p_input_value_id5 => l_input_values(8).input_value_id
5137 ,p_entry_value5 => p_health_checkup_self
5138 ,p_input_value_id6 => l_input_values(9).input_value_id
5139 ,p_entry_value6 => p_health_checkup_parents
5140 ,p_effective_start_date => l_effective_start_date
5141 ,p_effective_end_date => l_effective_end_date
5142 ,p_update_warning => p_warnings
5143 );
5144 --
5145 --
5146 pay_in_utils.set_location(g_debug, l_procedure, 60);
5147 --
5148 l_endation_date := pay_in_utils.next_tax_year(l_effective_date);
5149 --
5150 IF l_effective_end_date <> (l_endation_date - 1) THEN
5151 --
5152 -- End date the entry as of the financial year end date
5153 --
5154 delete_declaration
5155 (p_element_entry_id =>l_element_entry_id
5156 ,p_effective_date =>l_endation_date-1
5157 ,p_warnings =>l_warnings);
5158 --
5159 END IF;
5160
5161 --
5162
5163 --
5164 END IF;
5165 --
5166 IF g_debug THEN
5167 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
5168 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
5169 END IF;
5170 pay_in_utils.set_location(g_debug, l_procedure, 70);
5171 --
5172 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
5173 --
5174 EXCEPTION
5175 WHEN OTHERS THEN
5176 fnd_msg_pub.add_exc_msg
5177 (p_pkg_name => g_package
5178 ,p_procedure_name => 'declare_section80d'
5179 ,p_error_text => substr(sqlerrm, 1, 240)
5180 );
5181
5182 END;
5183
5184 --------------------------------------------------------------------------
5185 -- --
5186 -- Name : DECLARE_SECTION80DDB --
5187 -- Type : PROCEDURE --
5188 -- Access : Public --
5189 -- Description : The procedure is responsible for storing the --
5190 -- detials in 'Deduction under Section 80DDB' element. --
5191 -- --
5192 -- Parameters : --
5193 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
5194 -- p_effective_date DATE --
5195 -- p_disease_treatment_80ddb NUMBER --
5196 -- p_sec_80ddb_senior_citizen VARCHAR2 --
5197 -- OUT : p_warnings BOOLEAN --
5198 -- --
5199 -- Change History : --
5200 --------------------------------------------------------------------------
5201 -- Rev# Date Userid Description --
5202 --------------------------------------------------------------------------
5203 -- 1.0 14-Apr-2005 VGSRINIV Initial Version --
5204 --------------------------------------------------------------------------
5205 PROCEDURE declare_section80ddb
5206 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
5207 ,p_effective_date IN DATE DEFAULT NULL
5208 ,p_disease_treatment_80ddb IN NUMBER DEFAULT NULL
5209 ,p_sec_80ddb_senior_citizen IN VARCHAR2 DEFAULT NULL
5210 ,p_warnings OUT NOCOPY BOOLEAN)
5211 IS
5212
5213 l_procedure VARCHAR(100);
5214 l_message VARCHAR2(250);
5215 l_input_values t_input_values_tab;
5216 l_element_type_id pay_element_types_f.element_type_id%TYPE;
5217 l_element_link_id pay_element_links_f.element_link_id%TYPE;
5218 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
5219 l_business_group_id per_business_groups.business_group_id%TYPE;
5220 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
5221 l_effective_start_date DATE;
5222 l_effective_end_date DATE;
5223 l_effective_date DATE;
5224 l_endation_date DATE;
5225 l_warnings VARCHAR2(6);
5226 --
5227 BEGIN
5228 fnd_msg_pub.initialize; -- Bug 13767307
5229 l_procedure := g_package || 'declare_section80ddb';
5230 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
5231
5232 IF g_debug THEN
5233 pay_in_utils.trace('**************************************************','********************');
5234 pay_in_utils.trace('p_assignment_id',p_assignment_id);
5235 pay_in_utils.trace('p_effective_date ',p_effective_date );
5236 pay_in_utils.trace('p_disease_treatment_80ddb ',p_disease_treatment_80ddb);
5237 pay_in_utils.trace('p_sec_80ddb_senior_citizen ',p_sec_80ddb_senior_citizen);
5238 pay_in_utils.trace('**************************************************','********************');
5239 END IF;
5240 --
5241 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
5242 --
5243
5244 get_entry_details(p_assignment_id => p_assignment_id
5245 ,p_element_name => 'Deduction under Section 80DDB'
5246 ,p_effective_date => l_effective_date
5247 ,p_element_type_id => l_element_type_id
5248 ,p_element_link_id => l_element_link_id
5249 ,p_element_entry_id => l_element_entry_id
5250 ,p_expected_entries => 4
5251 ,p_business_group_id => l_business_group_id
5252 ,p_object_version_number=> l_object_version_number
5253 ,p_input_values => l_input_values
5254 );
5255 --
5256 IF g_debug THEN
5257 pay_in_utils.trace('Element Type ID: ' , l_element_type_id);
5258 pay_in_utils.trace('Element Entry ID: ' , l_element_entry_id);
5259 pay_in_utils.trace('Business Group ID: ' , l_business_group_id);
5260 pay_in_utils.trace('Object Version Number: ' , l_object_version_number);
5261 END IF;
5262 --
5263 pay_in_utils.set_location(g_debug, l_procedure, 20);
5264 --
5265 IF l_element_entry_id is null THEN
5266 --
5267 pay_in_utils.set_location(g_debug, l_procedure, 30);
5268 --
5269 --
5270 -- In this case, we would have to create an element entry to the
5271 -- assignment and return the entry id, the rest would be handled
5272 -- by the update command in the calling procedure.
5273 --
5274 pay_element_entry_api.create_element_entry
5275 (p_effective_date => l_effective_date
5276 ,p_business_group_id => l_business_group_id
5277 ,p_assignment_id => p_assignment_id
5278 ,p_element_link_id => l_element_link_id
5279 ,p_entry_type => 'E'
5280 --Deduction under Sec 80DDB
5281 ,p_input_value_id1 => l_input_values(0).input_value_id
5282 ,p_entry_value1 => p_disease_treatment_80ddb
5283 ,p_input_value_id2 => l_input_values(2).input_value_id
5284 ,p_entry_value2 => p_sec_80ddb_senior_citizen
5285 ,p_effective_start_date => l_effective_start_date
5286 ,p_effective_end_date => l_effective_end_date
5287 ,p_element_entry_id => l_element_entry_id
5288 ,p_object_version_number => l_object_version_number
5289 ,p_create_warning => p_warnings
5290 );
5291 --
5292 pay_in_utils.set_location(g_debug, l_procedure, 40);
5293 --
5294 -- End date the entry as of the financial year end date
5295 --
5296 --
5297 pay_in_utils.set_location(g_debug, l_procedure, 45);
5298 --
5299 delete_declaration
5300 (p_element_entry_id => l_element_entry_id
5301 ,p_effective_date => pay_in_utils.next_tax_year(l_effective_date)-1
5302 ,p_warnings => l_warnings);
5303 --
5304 --
5305 ELSE
5306 --
5307 pay_in_utils.set_location(g_debug, l_procedure, 50);
5308 --
5309 --
5310 -- An element entry for this element already exists we have to
5311 -- update the element entry with the newly submitted date.
5312 --
5313
5314 IF p_disease_treatment_80ddb > 0 THEN
5315
5316 pay_element_entry_api.update_element_entry
5317 (p_datetrack_update_mode => get_update_mode(l_element_entry_id
5318 ,l_effective_date)
5319 ,p_effective_date => l_effective_date
5320 ,p_business_group_id => l_business_group_id
5321 ,p_element_entry_id => l_element_entry_id
5322 ,p_object_version_number => l_object_version_number
5323 --Deduction under Sec 80DDB
5324 ,p_input_value_id1 => l_input_values(0).input_value_id
5325 ,p_entry_value1 => p_disease_treatment_80ddb
5326 ,p_input_value_id2 => l_input_values(2).input_value_id
5327 ,p_entry_value2 => p_sec_80ddb_senior_citizen
5328 ,p_effective_start_date => l_effective_start_date
5329 ,p_effective_end_date => l_effective_end_date
5330 ,p_update_warning => p_warnings
5331 );
5332 --
5333 --
5334 pay_in_utils.set_location(g_debug, l_procedure, 60);
5335 --
5336 l_endation_date := pay_in_utils.next_tax_year(l_effective_date);
5337 --
5338 IF l_effective_end_date <> (l_endation_date - 1) THEN
5339 --
5340 -- End date the entry as of the financial year end date
5341 --
5342 delete_declaration
5343 (p_element_entry_id =>l_element_entry_id
5344 ,p_effective_date =>l_endation_date-1
5345 ,p_warnings =>l_warnings);
5346 --
5347 END IF;
5348
5349 ELSE
5350
5351 delete_declaration
5352 (p_element_entry_id =>l_element_entry_id
5353 ,p_effective_date =>l_effective_date
5354 ,p_warnings =>l_warnings);
5355
5356 END IF;
5357
5358
5359 --
5360
5361 --
5362 END IF;
5363 --
5364 IF g_debug THEN
5365 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
5366 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
5367 END IF;
5368 pay_in_utils.set_location(g_debug, l_procedure, 70);
5369 --
5370 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,80);
5371 --
5372 EXCEPTION
5373 WHEN OTHERS THEN
5374 fnd_msg_pub.add_exc_msg
5375 (p_pkg_name => g_package
5376 ,p_procedure_name => 'declare_section80ddb'
5377 ,p_error_text => substr(sqlerrm, 1, 240)
5378 );
5379
5380 END;
5381
5382 --------------------------------------------------------------------------
5383 -- --
5384 -- Name : DECLARE_SECTION80U --
5385 -- Type : PROCEDURE --
5386 -- Access : Public --
5387 -- Description : The procedure is responsible for storing the --
5388 -- detials in 'Deduction under Section 80U' element. --
5389 -- --
5390 -- Parameters : --
5391 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
5392 -- p_effective_date DATE --
5393 -- OUT : p_warnings BOOLEAN --
5394 -- --
5395 -- Change History : --
5396 --------------------------------------------------------------------------
5397 -- Rev# Date Userid Description --
5398 --------------------------------------------------------------------------
5399 -- 1.0 14-Apr-2005 VGSRINIV Initial Version --
5400 --------------------------------------------------------------------------
5401
5402 PROCEDURE declare_section80U
5403 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
5404 ,p_effective_date IN DATE DEFAULT NULL
5405 ,p_warnings OUT NOCOPY BOOLEAN)
5406 IS
5407
5408 l_procedure VARCHAR(100);
5409 l_message VARCHAR2(250);
5410 l_input_values t_input_values_tab;
5411 l_element_type_id pay_element_types_f.element_type_id%TYPE;
5412 l_element_link_id pay_element_links_f.element_link_id%TYPE;
5413 l_element_entry_id pay_element_entries_f.element_entry_id%TYPE;
5414 l_business_group_id per_business_groups.business_group_id%TYPE;
5415 l_object_version_number pay_element_entries_f.object_version_number%TYPE;
5416 l_effective_start_date DATE;
5417 l_effective_end_date DATE;
5418 l_effective_date DATE;
5419 l_endation_date DATE;
5420 l_warnings VARCHAR2(6);
5421 --
5422 BEGIN
5423 fnd_msg_pub.initialize; -- Bug 13767307
5424 l_procedure := g_package || 'declare_section80U';
5425 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
5426
5427 IF g_debug THEN
5428 pay_in_utils.trace('**************************************************','********************');
5429 pay_in_utils.trace('p_assignment_id',p_assignment_id);
5430 pay_in_utils.trace('p_effective_date ',p_effective_date );
5431 pay_in_utils.trace('**************************************************','********************');
5432 END IF;
5433
5434 --
5435 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
5436 --
5437 --
5438
5439 get_entry_details(p_assignment_id => p_assignment_id
5440 ,p_element_name => 'Deduction under Section 80U'
5441 ,p_effective_date => l_effective_date
5442 ,p_element_type_id => l_element_type_id
5443 ,p_element_link_id => l_element_link_id
5444 ,p_element_entry_id => l_element_entry_id
5445 ,p_expected_entries => 1
5446 ,p_business_group_id => l_business_group_id
5447 ,p_object_version_number=> l_object_version_number
5448 ,p_input_values => l_input_values
5449 );
5450 --
5451 IF g_debug THEN
5452 pay_in_utils.trace('Element Type ID: ' , l_element_type_id);
5453 pay_in_utils.trace('Element Entry ID: ' , l_element_entry_id);
5454 pay_in_utils.trace('Business Group ID: ' , l_business_group_id);
5455 pay_in_utils.trace('Object Version Number: ' , l_object_version_number);
5456 END IF;
5457 --
5458 pay_in_utils.set_location(g_debug, l_procedure, 20);
5459 --
5460 IF l_element_entry_id is null THEN
5461 --
5462 pay_in_utils.set_location(g_debug, l_procedure, 30);
5463 --
5464 --
5465 -- In this case, we would have to create an element entry to the
5466 -- assignment and return the entry id, the rest would be handled
5467 -- by the update command in the calling procedure.
5468 --
5469 pay_element_entry_api.create_element_entry
5470 (p_effective_date => l_effective_date
5471 ,p_business_group_id => l_business_group_id
5472 ,p_assignment_id => p_assignment_id
5473 ,p_element_link_id => l_element_link_id
5474 ,p_entry_type => 'E'
5475 ,p_effective_start_date => l_effective_start_date
5476 ,p_effective_end_date => l_effective_end_date
5477 ,p_element_entry_id => l_element_entry_id
5478 ,p_object_version_number => l_object_version_number
5479 ,p_create_warning => p_warnings
5480 );
5481 --
5482 pay_in_utils.set_location(g_debug, l_procedure, 40);
5483 --
5484 END IF;
5485 --
5486 IF g_debug THEN
5487 pay_in_utils.trace('Effective Start Date: ', l_effective_start_date);
5488 pay_in_utils.trace('Effective End Date: ', l_effective_end_date);
5489 END IF;
5490 pay_in_utils.set_location(g_debug, l_procedure, 50);
5491
5492 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,60);
5493 --
5494 EXCEPTION
5495 WHEN OTHERS THEN
5496 fnd_msg_pub.add_exc_msg
5497 (p_pkg_name => g_package
5498 ,p_procedure_name => 'declare_section80u'
5499 ,p_error_text => substr(sqlerrm, 1, 240)
5500 );
5501
5502 END;
5503
5504 /* BUG 4251141: STAT UPDATE 2005 CHANGES END HERE */
5505
5506 PROCEDURE declare_tax
5507 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
5508 ,p_is_monthly_rent_changed IN VARCHAR2
5509 ,p_apr IN NUMBER default null
5510 ,p_may IN NUMBER default null
5511 ,p_jun IN NUMBER default null
5512 ,p_jul IN NUMBER default null
5513 ,p_aug IN NUMBER default null
5514 ,p_sep IN NUMBER default null
5515 ,p_oct IN NUMBER default null
5516 ,p_nov IN NUMBER default null
5517 ,p_dec IN NUMBER default null
5518 ,p_jan IN NUMBER default null
5519 ,p_feb IN NUMBER default null
5520 ,p_mar IN NUMBER default null
5521 ,p_is_chapter6a_changed IN VARCHAR2
5522 ,p_pension_fund_80ccc IN NUMBER default null
5523 ,p_medical_insurance_prem_80d IN NUMBER default null
5524 ,p_med_par_insurance_prem_80d IN NUMBER default NULL
5525 ,p_health_checkup_self IN NUMBER DEFAULT NULL
5526 ,p_health_checkup_parents IN NUMBER DEFAULT NULL
5527 ,p_80d_par_prem_changed IN VARCHAR2 DEFAULT NULL
5528 ,p_sec_80d_par_senior_citizen IN VARCHAR2 default null
5529 ,p_80d_par_snr_changed IN VARCHAR2 DEFAULT NULL
5530 ,p_sec_80ddb_senior_citizen IN VARCHAR2 default null
5531 ,p_disease_treatment_80ddb IN NUMBER default null
5532 ,p_sec_80d_senior_citizen IN VARCHAR2 default null
5533 ,p_higher_education_loan_80e IN NUMBER default null
5534 ,p_claim_exemp_under_sec_80gg IN VARCHAR2 default null
5535 ,p_donation_for_research_80gga IN NUMBER default null
5536 ,p_80gg_changed IN VARCHAR2 DEFAULT NULL
5537 ,p_80e_changed IN VARCHAR2 DEFAULT NULL
5538 ,p_80gga_changed IN VARCHAR2 DEFAULT NULL
5539 ,p_80d_changed IN VARCHAR2 DEFAULT NULL
5540 ,p_80d_hcs_changed IN VARCHAR2 DEFAULT NULL
5541 ,p_80d_hcp_changed IN VARCHAR2 DEFAULT NULL
5542 ,p_80dsc_planned_value IN VARCHAR2 DEFAULT NULL
5543 ,p_80ddb_changed IN VARCHAR2 DEFAULT NULL
5544 ,p_80ddbsc_planned_value IN VARCHAR2 DEFAULT NULL
5545 ,p_int_on_gen_investment_80L IN NUMBER default null
5546 ,p_int_on_securities_80L IN NUMBER default null
5547 ,p_80ccf_changed IN Varchar2 default null
5548 ,p_infrastructure_bonds_80ccf IN NUMBER default null
5549 ,p_ee_vol_pf_amount IN NUMBER default null
5550 ,p_ee_vol_pf_percent IN NUMBER default null
5551 ,p_ee_pf_amt_changed IN VARCHAR2 DEFAULT NULL
5552 ,p_ee_pf_percent_changed IN VARCHAR2 DEFAULT NULL
5553 ,p_is_section88_changed IN VARCHAR2 DEFAULT NULL
5554 ,p_deferred_annuity IN NUMBER default null
5555 ,p_senior_citizen_sav_scheme IN NUMBER default null
5556 ,p_public_provident_fund IN NUMBER default null
5557 ,p_post_office_savings_scheme IN NUMBER default null
5558 ,p_deposit_in_nsc_vi_issue IN NUMBER default null
5559 ,p_deposit_in_nsc_viii_issue IN NUMBER default null
5560 ,p_interest_on_nsc_reinvested IN NUMBER default null
5561 ,p_house_loan_repayment IN NUMBER default null
5562 ,p_notified_mutual_fund_or_uti IN NUMBER default null
5563 ,p_national_housing_bank_scheme IN NUMBER default null
5564 ,p_unit_linked_insurance_plan IN NUMBER default null
5565 ,p_notified_annuity_plan IN NUMBER default null
5566 ,p_notified_pension_fund IN NUMBER default null
5567 ,p_public_sector_company_scheme IN NUMBER default null
5568 ,p_approved_superannuation_fund IN NUMBER default null
5569 ,p_infrastructure_bond IN NUMBER default null
5570 ,p_tuition_fee_for_child_1 IN NUMBER default null
5571 ,p_tuition_fee_for_child_2 IN NUMBER default null
5572 ,p_is_other_income_changed IN VARCHAR2 DEFAULT NULL
5573 ,p_income_from_house_property IN NUMBER default null
5574 ,p_profit_and_gain_from_busines IN NUMBER default null
5575 ,p_long_term_capital_gain IN NUMBER default null
5576 ,p_short_term_capital_gain IN NUMBER default null
5577 ,p_income_from_any_other_source IN NUMBER default null
5578 ,p_tds_paid_on_other_income IN NUMBER default null
5579 ,p_interest_on_deposits IN NUMBER default null
5580 ,p_80ccg_amt_changed IN Varchar2 default null
5581 ,p_investment_amt_80ccg IN NUMBER default null
5582 ,p_80ccg_date_changed IN Varchar2 default null
5583 ,p_investment_date_80ccg IN DATE default null
5584 ,p_approved_flag IN VARCHAR2 default null
5585 ,p_comment_text IN VARCHAR2 default null
5586 ,p_effective_date IN DATE default null
5587 ,p_warnings OUT NOCOPY VARCHAR2)
5588 IS
5589 --
5590 l_effective_date DATE;
5591 l_procedure VARCHAR(100);
5592 l_message VARCHAR2(250);
5593 l_disability_proof VARCHAR2(2);
5594 l_permanent_disability_80u NUMBER;
5595 l_category VARCHAR2(10);
5596 l_degree NUMBER;
5597 l_declare_warn BOOLEAN;
5598
5599 CURSOR get_permanent_disability_80u
5600 IS
5601 SELECT global_value
5602 FROM ff_globals_f
5603 WHERE global_name = 'IN_PERMANENT_PHYSICAL_DISABILITY_80U'
5604 AND legislation_code = g_legislation_code;
5605 --
5606 BEGIN
5607 fnd_msg_pub.initialize; -- Bug 13767307
5608
5609 l_procedure := g_package || 'declare_tax';
5610 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
5611
5612 IF g_debug THEN
5613 pay_in_utils.trace('**************************************************','********************');
5614 pay_in_utils.trace ('p_assignment_id ',p_assignment_id);
5615 pay_in_utils.trace ('p_is_monthly_rent_changed ',p_is_monthly_rent_changed);
5616 pay_in_utils.trace ('p_apr ',p_apr);
5617 pay_in_utils.trace ('p_may ',p_may);
5618 pay_in_utils.trace ('p_jun ',p_jun);
5619 pay_in_utils.trace ('p_jul ',p_jul);
5620 pay_in_utils.trace ('p_aug ',p_aug);
5621 pay_in_utils.trace ('p_sep ',p_sep);
5622 pay_in_utils.trace ('p_oct ',p_oct);
5623 pay_in_utils.trace ('p_nov ',p_nov);
5624 pay_in_utils.trace ('p_dec ',p_dec);
5625 pay_in_utils.trace ('p_jan ',p_jan);
5626 pay_in_utils.trace ('p_feb ',p_feb);
5627 pay_in_utils.trace ('p_mar ',p_mar);
5628 pay_in_utils.trace ('p_is_chapter6a_changed ',p_is_chapter6a_changed);
5629 pay_in_utils.trace ('p_pension_fund_80ccc ',p_pension_fund_80ccc );
5630 pay_in_utils.trace ('p_medical_insurance_prem_80d ',p_medical_insurance_prem_80d);
5631 pay_in_utils.trace ('p_sec_80ddb_senior_citizen ',p_sec_80ddb_senior_citizen);
5632 pay_in_utils.trace ('p_disease_treatment_80ddb ',p_disease_treatment_80ddb);
5633 pay_in_utils.trace ('p_sec_80d_senior_citizen ',p_sec_80d_senior_citizen);
5634 pay_in_utils.trace ('p_higher_education_loan_80e ',p_higher_education_loan_80e);
5635 pay_in_utils.trace ('p_claim_exemp_under_sec_80gg ',p_claim_exemp_under_sec_80gg);
5636 pay_in_utils.trace ('p_donation_for_research_80gga ',p_donation_for_research_80gga);
5637 pay_in_utils.trace ('p_80gg_changed ',p_80gg_changed);
5638 pay_in_utils.trace ('p_80e_changed ',p_80e_changed);
5639 pay_in_utils.trace ('p_80gga_changed ',p_80gga_changed);
5640 pay_in_utils.trace ('p_80d_changed ',p_80d_changed);
5641 pay_in_utils.trace ('p_80d_hcs_changed ',p_80d_hcs_changed);
5642 pay_in_utils.trace ('p_80d_hcp_changed ',p_80d_hcp_changed);
5643 pay_in_utils.trace ('p_80dsc_planned_value ',p_80dsc_planned_value);
5644 pay_in_utils.trace ('p_80ddb_changed ',p_80ddb_changed);
5645 pay_in_utils.trace ('p_80ddbsc_planned_value ',p_80ddbsc_planned_value);
5646 pay_in_utils.trace ('p_int_on_gen_investment_80L ',p_int_on_gen_investment_80L);
5647 pay_in_utils.trace ('p_int_on_securities_80L ',p_int_on_securities_80L);
5648 pay_in_utils.trace ('p_80ccf_changed ',p_80ccf_changed);
5649 pay_in_utils.trace ('p_infrastructure_bonds_80ccf ',p_infrastructure_bonds_80ccf);
5650 pay_in_utils.trace ('p_ee_vol_pf_amount ',p_ee_vol_pf_amount);
5651 pay_in_utils.trace ('p_ee_pf_amt_changed ',p_ee_pf_amt_changed);
5652 pay_in_utils.trace ('p_ee_vol_pf_percent ',p_ee_vol_pf_percent);
5653 pay_in_utils.trace ('p_ee_pf_percent_changed ',p_ee_pf_percent_changed);
5654 pay_in_utils.trace ('p_is_section88_changed ',p_is_section88_changed);
5655 pay_in_utils.trace ('p_deferred_annuity ',p_deferred_annuity);
5656 pay_in_utils.trace ('p_senior_citizen_sav_scheme ',p_senior_citizen_sav_scheme);
5657 pay_in_utils.trace ('p_public_provident_fund ',p_public_provident_fund);
5658 pay_in_utils.trace ('p_post_office_savings_scheme ',p_post_office_savings_scheme);
5659 pay_in_utils.trace ('p_deposit_in_nsc_vi_issue ',p_deposit_in_nsc_vi_issue);
5660 pay_in_utils.trace ('p_deposit_in_nsc_viii_issue ',p_deposit_in_nsc_viii_issue);
5661 pay_in_utils.trace ('p_interest_on_nsc_reinvested ',p_interest_on_nsc_reinvested);
5662 pay_in_utils.trace ('p_house_loan_repayment ',p_house_loan_repayment);
5663 pay_in_utils.trace ('p_notified_mutual_fund_or_uti ',p_notified_mutual_fund_or_uti);
5664 pay_in_utils.trace ('p_national_housing_bank_scheme ',p_national_housing_bank_scheme);
5665 pay_in_utils.trace ('p_unit_linked_insurance_plan ',p_unit_linked_insurance_plan);
5666 pay_in_utils.trace ('p_notified_annuity_plan ',p_notified_annuity_plan);
5667 pay_in_utils.trace ('p_notified_pension_fund ',p_notified_pension_fund);
5668 pay_in_utils.trace ('p_public_sector_company_scheme ',p_public_sector_company_scheme );
5669 pay_in_utils.trace ('p_approved_superannuation_fund ',p_approved_superannuation_fund);
5670 pay_in_utils.trace ('p_infrastructure_bond ',p_infrastructure_bond);
5671 pay_in_utils.trace ('p_tuition_fee_for_child_1 ',p_tuition_fee_for_child_1);
5672 pay_in_utils.trace ('p_tuition_fee_for_child_2 ',p_tuition_fee_for_child_2);
5673 pay_in_utils.trace ('p_is_other_income_changed ',p_is_other_income_changed);
5674 pay_in_utils.trace ('p_income_from_house_property ',p_income_from_house_property);
5675 pay_in_utils.trace ('p_profit_and_gain_from_busines ',p_profit_and_gain_from_busines);
5676 pay_in_utils.trace ('p_long_term_capital_gain ',p_long_term_capital_gain);
5677 pay_in_utils.trace ('p_short_term_capital_gain ',p_short_term_capital_gain);
5678 pay_in_utils.trace ('p_income_from_any_other_source ',p_income_from_any_other_source);
5679 pay_in_utils.trace ('p_tds_paid_on_other_income ',p_tds_paid_on_other_income);
5680 pay_in_utils.trace ('p_interest_on_deposits ',p_interest_on_deposits);
5681 pay_in_utils.trace ('p_80ccg_amt_changed ',p_80ccg_amt_changed);
5682 pay_in_utils.trace ('p_investment_amt_80ccg ',p_investment_amt_80ccg);
5683 pay_in_utils.trace ('p_80ccg_date_changed ',p_80ccg_date_changed);
5684 pay_in_utils.trace ('p_investment_date_80ccg ',p_investment_date_80ccg);
5685 pay_in_utils.trace ('p_approved_flag ',p_approved_flag);
5686 pay_in_utils.trace ('p_comment_text ',p_comment_text);
5687 pay_in_utils.trace ('p_effective_date ',p_effective_date);
5688 pay_in_utils.trace('**************************************************','********************');
5689
5690 END IF;
5691 l_declare_warn := false;
5692 --
5693
5694 --
5695 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
5696 -- Added for bug 3990922
5697 hr_session_utilities.insert_session_row(l_effective_date);
5698 --
5699 --
5700 IF p_is_monthly_rent_changed = 'Y' THEN
5701 --
5702 pay_in_utils.set_location(g_debug, l_procedure, 20);
5703 --
5704 declare_house_rent
5705 (p_assignment_id => p_assignment_id
5706 ,p_effective_date => l_effective_date
5707 ,p_apr => p_apr
5708 ,p_may => p_may
5709 ,p_jun => p_jun
5710 ,p_jul => p_jul
5711 ,p_aug => p_aug
5712 ,p_sep => p_sep
5713 ,p_oct => p_oct
5714 ,p_nov => p_nov
5715 ,p_dec => p_dec
5716 ,p_jan => p_jan
5717 ,p_feb => p_feb
5718 ,p_mar => p_mar
5719 ,p_warnings => l_declare_warn);
5720 --
5721 pay_in_utils.set_location(g_debug, l_procedure, 30);
5722 --
5723 END IF;
5724 --
5725 pay_in_utils.set_location(g_debug, 'Entering: '||l_procedure, 40);
5726 --
5727
5728 IF p_is_chapter6a_changed = 'Y' THEN
5729 --
5730 pay_in_utils.set_location(g_debug, l_procedure, 50);
5731
5732
5733 IF p_80gg_changed = 'Y' THEN
5734
5735 declare_section80gg
5736 (p_assignment_id => p_assignment_id
5737 ,p_effective_date => l_effective_date
5738 ,p_claim_exemp_under_sec_80gg => p_claim_exemp_under_sec_80gg
5739 ,p_warnings => l_declare_warn);
5740
5741 END IF;
5742
5743 IF p_80e_changed = 'Y' THEN
5744
5745 declare_section80e
5746 (p_assignment_id => p_assignment_id
5747 ,p_effective_date => l_effective_date
5748 ,p_higher_education_loan_80e => p_higher_education_loan_80e
5749 ,p_warnings => l_declare_warn);
5750
5751 END IF;
5752
5753 IF p_80ccf_changed = 'Y' THEN
5754 declare_section80ccf
5755 (p_assignment_id => p_assignment_id
5756 ,p_effective_date => l_effective_date
5757 ,p_infrastructure_bonds_80ccf => p_infrastructure_bonds_80ccf
5758 ,p_warnings => l_declare_warn);
5759
5760 END IF;
5761
5762
5763 IF p_80ccg_amt_changed = 'Y' OR p_80ccg_date_changed ='Y' THEN
5764 declare_section80ccg
5765 (p_assignment_id => p_assignment_id
5766 ,p_effective_date => l_effective_date
5767 ,p_investment_amt_80ccg => p_investment_amt_80ccg
5768 ,p_investment_date_80ccg => p_investment_date_80ccg
5769 ,p_warnings => l_declare_warn);
5770
5771 END IF;
5772
5773
5774 IF p_80gga_changed = 'Y' THEN
5775
5776 declare_section80gga
5777 (p_assignment_id => p_assignment_id
5778 ,p_effective_date => l_effective_date
5779 ,p_donation_for_research_80gga => p_donation_for_research_80gga
5780 ,p_warnings => l_declare_warn);
5781
5782 END IF;
5783
5784 IF p_ee_pf_amt_changed = 'Y' OR p_ee_pf_percent_changed = 'Y' THEN
5785 declare_vpf
5786 (p_assignment_id => p_assignment_id
5787 ,p_effective_date => l_effective_date
5788 ,p_ee_vol_pf_amount => p_ee_vol_pf_amount
5789 ,p_ee_vol_pf_percent => p_ee_vol_pf_percent
5790 ,p_warnings => l_declare_warn);
5791 END IF;
5792
5793 IF p_80d_changed = 'Y'
5794 OR p_80d_hcs_changed = 'Y'
5795 OR p_80d_hcp_changed = 'Y'
5796 OR p_80d_par_prem_changed = 'Y'
5797 OR p_80d_par_snr_changed = 'Y'
5798 OR p_sec_80d_senior_citizen <> p_80dsc_planned_value THEN
5799
5800
5801 declare_section80d
5802 (p_assignment_id => p_assignment_id
5803 ,p_effective_date => l_effective_date
5804 ,p_medical_insurance_prem_80d => NVL (p_medical_insurance_prem_80d,0)
5805 ,p_sec_80d_senior_citizen => p_sec_80d_senior_citizen
5806 ,p_med_par_insurance_prem_80d => p_med_par_insurance_prem_80d
5807 ,p_health_checkup_self => p_health_checkup_self
5808 ,p_health_checkup_parents => p_health_checkup_parents
5809 ,p_sec_80d_par_senior_citizen => p_sec_80d_par_senior_citizen
5810 ,p_warnings => l_declare_warn);
5811
5812 END IF;
5813
5814 IF p_80ddb_changed = 'Y' OR p_sec_80ddb_senior_citizen <> p_80ddbsc_planned_value THEN
5815
5816 declare_section80ddb
5817 (p_assignment_id => p_assignment_id
5818 ,p_effective_date => l_effective_date
5819 ,p_disease_treatment_80ddb => p_disease_treatment_80ddb
5820 ,p_sec_80ddb_senior_citizen => p_sec_80ddb_senior_citizen
5821 ,p_warnings => l_declare_warn);
5822
5823 END IF;
5824
5825
5826 pay_in_utils.set_location(g_debug, l_procedure, 60);
5827
5828 END IF;
5829
5830 pay_in_utils.set_location(g_debug, 'Entering: '||l_procedure, 70);
5831
5832
5833 pay_in_utils.set_location(g_debug, l_procedure, 100);
5834
5835 IF p_is_other_income_changed = 'Y' THEN
5836 pay_in_utils.set_location(g_debug, l_procedure, 110);
5837 declare_other_income
5838 (p_assignment_id => p_assignment_id
5839 ,p_effective_date => l_effective_date
5840 ,p_income_from_house_property => p_income_from_house_property
5841 ,p_profit_and_gain_from_busines => p_profit_and_gain_from_busines
5842 ,p_long_term_capital_gain => p_long_term_capital_gain
5843 ,p_short_term_capital_gain => p_short_term_capital_gain
5844 ,p_income_from_any_other_source => p_income_from_any_other_source
5845 ,p_tds_paid_on_other_income => p_tds_paid_on_other_income
5846 ,p_interest_on_deposits => p_interest_on_deposits
5847 ,p_warnings => l_declare_warn);
5848 pay_in_utils.set_location(g_debug, l_procedure, 120);
5849 END IF;
5850 IF p_approved_flag is not null THEN
5851 pay_in_utils.set_location(g_debug, l_procedure, 130);
5852 approve_declaration
5853 (p_assignment_id => p_assignment_id
5854 ,p_approval_flag => p_approved_flag
5855 ,p_effective_date => l_effective_date
5856 ,p_comment_text => p_comment_text);
5857 pay_in_utils.set_location(g_debug, l_procedure, 140);
5858 END IF;
5859 IF l_declare_warn THEN
5860 p_warnings := 'TRUE';
5861 ELSE
5862 p_warnings := 'FALSE';
5863 END IF;
5864 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,150);
5865 EXCEPTION
5866 WHEN OTHERS THEN
5867 fnd_msg_pub.add_exc_msg
5868 (p_pkg_name => g_package
5869 ,p_procedure_name => 'declare_tax'
5870 ,p_error_text => substr(sqlerrm, 1, 240)
5871 );
5872
5873 END declare_tax;
5874
5875 --------------------------------------------------------------------------
5876 -- --
5877 -- Name : DELETE_DECLARATION --
5878 -- Type : PROCEDURE --
5879 -- Access : Public --
5880 -- Description : The procedure is responsible for deletion of --
5881 -- element entries as of the effective date. --
5882 -- --
5883 -- Parameters : --
5884 -- IN : p_element_entry_id element_entry_id%TYPE --
5885 -- p_effective_date DATE --
5886 -- OUT : p_warnings BOOLEAN --
5887 -- --
5888 -- Change History : --
5889 --------------------------------------------------------------------------
5890 -- Rev# Date Userid Description --
5891 --------------------------------------------------------------------------
5892 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
5893 --------------------------------------------------------------------------
5894 PROCEDURE delete_declaration
5895 (p_element_entry_id IN NUMBER
5896 ,p_effective_date IN DATE DEFAULT NULL
5897 ,p_warnings OUT NOCOPY VARCHAR2
5898 ,p_deletion_mode IN VARCHAR2 DEFAULT NULL)
5899 IS
5900 --
5901 l_effective_date DATE;
5902 l_effective_start_date DATE;
5903 l_effective_end_date DATE;
5904 l_object_version_number NUMBER;
5905 l_warnings BOOLEAN;
5906 l_procedure VARCHAR(100);
5907 l_message VARCHAR2(250);
5908 l_effective_end_date_check DATE;
5909 --
5910 CURSOR csr_entry_details(c_effective_date IN DATE)
5911 IS
5912 SELECT object_version_number
5913 ,effective_end_date
5914 FROM pay_element_entries_f
5915 WHERE element_entry_id = p_element_entry_id
5916 AND c_effective_date BETWEEN effective_start_date
5917 AND effective_end_date;
5918 --
5919 BEGIN
5920 fnd_msg_pub.initialize; -- Bug 13767307
5921 p_warnings := 'FALSE';
5922
5923 l_procedure := g_package || 'delete_declaration';
5924 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
5925
5926 IF g_debug THEN
5927 pay_in_utils.trace('**************************************************','********************');
5928 pay_in_utils.trace('Element Entry ID:',p_element_Entry_id);
5929 pay_in_utils.trace('Effective Date:',p_effective_date);
5930 pay_in_utils.trace('**************************************************','********************');
5931 END IF;
5932
5933 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
5934 --
5935 IF g_debug THEN
5936 pay_in_utils.trace('Calculate Effective Date: ' , l_effective_date);
5937 END IF;
5938 --
5939 OPEN csr_entry_details(l_effective_date);
5940 FETCH csr_entry_details INTO l_object_version_number
5941 ,l_effective_end_date_check;
5942 CLOSE csr_entry_details;
5943 --
5944 IF l_object_version_number is null
5945 or l_effective_end_date_check = l_effective_date THEN
5946 return;
5947 END IF;
5948 --
5949 pay_in_utils.set_location(g_debug, l_procedure, 40);
5950
5951 /* 13105285 Starts*/
5952
5953 IF (p_deletion_mode IS NOT NULL and upper(p_deletion_mode) ='PURGE' ) THEN
5954 pay_in_utils.trace('Inside If:',l_effective_date);
5955 pay_element_entry_api.delete_element_entry
5956 (p_validate => FALSE
5957 ,p_datetrack_delete_mode => hr_api.g_zap
5958 ,p_effective_date => l_effective_date
5959 ,p_element_entry_id => p_element_entry_id
5960 ,p_object_version_number => l_object_version_number
5961 ,p_effective_start_date => l_effective_start_date
5962 ,p_effective_end_date => l_effective_end_date
5963 ,p_delete_warning => l_warnings
5964 );
5965 ELSE
5966 pay_in_utils.trace('Inside Else:',l_effective_date);
5967 pay_element_entry_api.delete_element_entry
5968 (p_validate => FALSE
5969 ,p_datetrack_delete_mode => hr_api.g_delete
5970 ,p_effective_date => l_effective_date
5971 ,p_element_entry_id => p_element_entry_id
5972 ,p_object_version_number => l_object_version_number
5973 ,p_effective_start_date => l_effective_start_date
5974 ,p_effective_end_date => l_effective_end_date
5975 ,p_delete_warning => l_warnings
5976 );
5977 END IF;
5978 /* 13105285 Ends */
5979 pay_in_utils.set_location(g_debug, l_procedure, 50);
5980 --
5981 IF l_warnings = TRUE THEN
5982 --
5983 pay_in_utils.set_location(g_debug, l_procedure, 60);
5984 p_warnings := 'TRUE';
5985 --
5986 END IF;
5987
5988 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,70);
5989 --
5990 EXCEPTION
5991 WHEN OTHERS THEN
5992 fnd_msg_pub.add_exc_msg
5993 (p_pkg_name => g_package
5994 ,p_procedure_name => 'delete_declaration'
5995 ,p_error_text => substr(sqlerrm, 1, 240)
5996 );
5997 --
5998 END delete_declaration;
5999
6000 --------------------------------------------------------------------------
6001 -- --
6002 -- Name : APPROVE_DECLARATION --
6003 -- Type : PROCEDURE --
6004 -- Access : Public --
6005 -- Description : The procedure is responsible for approval of --
6006 -- tax declaration for the assignment in question. --
6007 -- --
6008 -- Parameters : --
6009 -- IN :p_assignment_id per_assignments_f.assignment_id%TYPE--
6010 -- p_approval_flag VARCHAR2 --
6011 -- p_effective_date DATE --
6012 -- p_comment_text VARCHAR2 --
6013 -- Change History : --
6014 --------------------------------------------------------------------------
6015 -- Rev# Date Userid Description --
6016 --------------------------------------------------------------------------
6017 -- 1.0 24-Sep-2004 PUCHIL Initial Version --
6018 --------------------------------------------------------------------------
6019 PROCEDURE approve_declaration
6020 (p_assignment_id IN per_assignments_f.assignment_id%TYPE
6021 ,p_approval_flag IN VARCHAR2
6022 ,p_effective_date IN DATE
6023 ,p_comment_text IN VARCHAR2)
6024 IS
6025 --
6026 l_procedure VARCHAR(100);
6027 l_message VARCHAR2(250);
6028 l_approval_status VARCHAR2(2);
6029 l_object_version_number NUMBER;
6030 l_extra_info_id per_assignment_extra_info.assignment_extra_info_id%TYPE;
6031 --
6032 CURSOR get_object_version(c_extra_info_id IN NUMBER)
6033 IS
6034 SELECT object_version_number
6035 FROM per_assignment_extra_info
6036 WHERE assignment_extra_info_id = c_extra_info_id;
6037 --
6038 BEGIN
6039 fnd_msg_pub.initialize; -- Bug 13767307
6040 l_procedure := g_package || 'approve_declaration';
6041 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
6042
6043 IF g_debug THEN
6044 pay_in_utils.trace('**************************************************','********************');
6045 pay_in_utils.trace('p_assignment_id',p_assignment_id);
6046 pay_in_utils.trace('p_effective_date ',p_effective_date );
6047 pay_in_utils.trace('p_approval_flag ',p_approval_flag);
6048 pay_in_utils.trace('p_comment_text ',p_comment_text);
6049 pay_in_utils.trace('**************************************************','********************');
6050 END IF;
6051
6052
6053 --
6054 l_approval_status := get_approval_status
6055 (p_assignment_id
6056 ,get_tax_year(p_effective_date)
6057 ,l_extra_info_id);
6058 --
6059 pay_in_utils.set_location(g_debug, l_procedure, 20);
6060 --
6061 IF l_approval_status is not null THEN
6062 --
6063 pay_in_utils.set_location(g_debug, l_procedure, 30);
6064 --
6065 OPEN get_object_version(l_extra_info_id);
6066 FETCH get_object_version INTO l_object_version_number;
6067 CLOSE get_object_version;
6068 --
6069 pay_in_utils.set_location(g_debug, l_procedure, 40);
6070 --
6071 hr_assignment_extra_info_api.update_assignment_extra_info
6072 (p_assignment_extra_info_id => l_extra_info_id
6073 ,p_object_version_number => l_object_version_number
6074 ,p_aei_information_category => g_approval_info_type
6075 ,p_aei_information1 => get_tax_year(p_effective_date)
6076 ,p_aei_information2 => p_approval_flag
6077 ,p_aei_information3 => substr(p_comment_text, 0, 150));
6078 --
6079 pay_in_utils.set_location(g_debug, l_procedure, 50);
6080 --
6081 ELSE
6082 --
6083 pay_in_utils.set_location(g_debug, l_procedure, 60);
6084 --
6085 hr_assignment_extra_info_api.create_assignment_extra_info
6086 (p_assignment_id => p_assignment_id
6087 ,p_information_type => g_approval_info_type
6088 ,p_aei_information_category => g_approval_info_type
6089 ,p_aei_information1 => get_tax_year(p_effective_date)
6090 ,p_aei_information2 => p_approval_flag
6091 ,p_aei_information3 => substr(p_comment_text, 0, 150)
6092 ,p_assignment_extra_info_id => l_extra_info_id
6093 ,p_object_version_number => l_object_version_number);
6094 --
6095 pay_in_utils.set_location(g_debug, l_procedure, 70);
6096 --
6097 END IF;
6098 --
6099 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,80);
6100 --
6101 EXCEPTION
6102 WHEN OTHERS THEN
6103 fnd_msg_pub.add_exc_msg
6104 (p_pkg_name => g_package
6105 ,p_procedure_name => 'approve_declaration'
6106 ,p_error_text => substr(sqlerrm, 1, 240)
6107 );
6108 --
6109 END approve_declaration;
6110
6111 -- Start changes to Enhancement 3886086(Web ADI)
6112
6113 --------------------------------------------------------------------------
6114 -- --
6115 -- Name : WEB_ADI_DECLARE_TAX --
6116 -- Type : PROCEDURE --
6117 -- Access : Public --
6118 -- Description : The procedure is responsible for storing the --
6119 -- details through WEB ADI . --
6120 -- --
6121 -- Parameters : --
6122 -- IN : p_assignment_id per_assignments_f.assignment_id%TYPE--
6123 -- p_effective_date DATE --
6124 -- p_warnings BOOLEAN --
6125 -- --
6126 -- Change History : --
6127 --------------------------------------------------------------------------
6128 -- Rev# Date Userid Description --
6129 --------------------------------------------------------------------------
6130 -- 1.1 20-Jun-2005 abhjain Added changes after stat update --
6131 --------------------------------------------------------------------------
6132
6133 PROCEDURE web_adi_declare_tax
6134 (p_assignment_id IN number
6135 ,p_effective_date IN date default null
6136 ,p_april IN number default null
6137 ,p_may IN number default null
6138 ,p_june IN number default null
6139 ,p_july IN number default null
6140 ,p_august IN number default null
6141 ,p_september IN number default null
6142 ,p_october IN number default null
6143 ,p_november IN number default null
6144 ,p_december IN number default null
6145 ,p_january IN number default null
6146 ,p_february IN number default null
6147 ,p_march IN number default null
6148 ,p_cce_ee_id1 IN number default null
6149 ,p_cce_component1 IN varchar2 default null
6150 ,p_investment_amount1 IN number default null
6151 ,p_cce_ee_id2 IN number default null
6152 ,p_cce_component2 IN varchar2 default null
6153 ,p_investment_amount2 IN number default null
6154 ,p_cce_ee_id3 IN number default null
6155 ,p_cce_component3 IN varchar2 default null
6156 ,p_investment_amount3 IN number default null
6157 ,p_cce_ee_id4 IN number default null
6158 ,p_cce_component4 IN varchar2 default null
6159 ,p_investment_amount4 IN number default null
6160 ,p_cce_ee_id5 IN number default null
6161 ,p_cce_component5 IN varchar2 default null
6162 ,p_investment_amount5 IN number default null
6163 ,p_cce_ee_id6 IN number default null
6164 ,p_cce_component6 IN varchar2 default null
6165 ,p_investment_amount6 IN number default null
6166 ,p_cce_ee_id7 IN number default null
6167 ,p_cce_component7 IN varchar2 default null
6168 ,p_investment_amount7 IN number default null
6169 ,p_cce_ee_id8 IN number default null
6170 ,p_cce_component8 IN varchar2 default null
6171 ,p_investment_amount8 IN number default null
6172 ,p_cce_ee_id9 IN number default null
6173 ,p_cce_component9 IN varchar2 default null
6174 ,p_investment_amount9 IN number default null
6175 ,p_cce_ee_id10 IN number default null
6176 ,p_cce_component10 IN varchar2 default null
6177 ,p_investment_amount10 IN number default null
6178 ,p_cce_ee_id11 IN number default null
6179 ,p_cce_component11 IN varchar2 default null
6180 ,p_investment_amount11 IN number default null
6181 ,p_cce_ee_id12 IN number default null
6182 ,p_cce_component12 IN varchar2 default null
6183 ,p_investment_amount12 IN number default null
6184 ,p_cce_ee_id13 IN number default null
6185 ,p_cce_component13 IN varchar2 default null
6186 ,p_investment_amount13 IN number default null
6187 ,p_cce_ee_id14 IN number default null
6188 ,p_cce_component14 IN varchar2 default null
6189 ,p_investment_amount14 IN number default null
6190 ,p_cce_ee_id15 IN number default null
6191 ,p_cce_component15 IN varchar2 default null
6192 ,p_investment_amount15 IN number default null
6193 ,p_cce_ee_id16 IN number default null
6194 ,p_cce_component16 IN varchar2 default null
6195 ,p_investment_amount16 IN number default null
6196 ,p_cce_ee_id17 IN number default null
6197 ,p_cce_component17 IN varchar2 default null
6198 ,p_investment_amount17 IN number default null
6199 ,p_cce_ee_id18 IN number default null
6200 ,p_cce_component18 IN varchar2 default null
6201 ,p_investment_amount18 IN number default null
6202 ,p_cce_ee_id19 IN number default null
6203 ,p_cce_component19 IN varchar2 default null
6204 ,p_investment_amount19 IN number default null
6205 ,p_cce_ee_id20 IN number default null
6206 ,p_cce_component20 IN varchar2 default null
6207 ,p_investment_amount20 IN number default null
6208 ,p_cce_ee_id21 IN number default null
6209 ,p_cce_component21 IN varchar2 default null
6210 ,p_investment_amount21 IN number default null
6211 ,p_higher_education_loan IN number default null
6212 ,p_donation_for_research IN number default null
6213 ,p_claim_exemption_sec_80gg IN varchar2 default null
6214 ,p_premium_amount IN number default null
6215 ,p_premium_covers_sc IN varchar2 default null
6216 ,p_treatment_amount IN number default null
6217 ,p_treatment_covers_sc IN varchar2 default null
6218 ,p_income_from_house_property IN number default null
6219 ,p_profit_and_gain IN number default null
6220 ,p_long_term_capital_gain IN number default null
6221 ,p_short_term_capital_gain IN number default null
6222 ,p_income_from_other_sources IN number default null
6223 ,p_tds_paid IN number default null
6224 ,p_disease_entry_id1 IN number default null
6225 ,p_disability_type1 IN varchar2 default null
6226 ,p_disability_percentage1 IN varchar2 default null
6227 ,p_treatment_amount1 IN number default null
6228 ,p_disease_entry_id2 IN number default null
6229 ,p_disability_type2 IN varchar2 default null
6230 ,p_disability_percentage2 IN varchar2 default null
6231 ,p_treatment_amount2 IN number default null
6232 ,p_donation_entry_id1 IN number default null
6233 ,p_donation_type1 IN varchar2 default null
6234 ,p_donation_amount1 IN number default null
6235 ,p_donation_entry_id2 IN number default null
6236 ,p_donation_type2 IN varchar2 default null
6237 ,p_donation_amount2 IN number default null
6238 ,p_lic_entry_id1 IN number default null
6239 ,p_premium_paid1 IN number default null
6240 ,p_sum_assured1 IN number default null
6241 ,p_lic_entry_id2 IN number default null
6242 ,p_premium_paid2 IN number default null
6243 ,p_sum_assured2 IN number default null
6244 ,p_lic_entry_id3 IN number default null
6245 ,p_premium_paid3 IN number default null
6246 ,p_sum_assured3 IN number default null
6247 ,p_lic_entry_id4 IN number default null
6248 ,p_premium_paid4 IN number default null
6249 ,p_sum_assured4 IN number default null
6250 ,p_lic_entry_id5 IN number default null
6251 ,p_premium_paid5 IN number default null
6252 ,p_sum_assured5 IN number default null
6253 ,p_comment_text IN varchar2 default NULL
6254 ,P_PERSON_ID IN number default null
6255 ,P_FULL_NAME IN varchar2 default NULL
6256 ,P_EMPLOYEE_NUMBER IN varchar2 default NULL
6257 ,P_ASSIGNMENT_NUMBER IN varchar2 default NULL
6258 ,P_DEPARTMENT IN varchar2 default NULL
6259 ,P_LAST_UPDATED_DATE IN date default null
6260 ,P_ORGANIZATION_ID IN number default null
6261 ,P_BUSINESS_GROUP_ID IN number default null
6262 ,P_START_DATE IN date default null
6263 ,P_GRADE_ID IN number default null
6264 ,P_JOB_ID IN number default null
6265 ,P_POSITION_ID IN number default null
6266 ,P_TAX_AREA_NUMBER IN varchar2 default NULL
6267 ,P_APPROVAL_STATUS IN varchar2 default NULL
6268 ,P_TAX_YEAR IN varchar2 default NULL
6269 ,p_parent_premium IN number default null
6270 ,p_parent_sc IN varchar2 default null
6271 ,p_isb_amount IN Number default null
6272 ,p_policy_number2 IN Varchar2 default null
6273 ,p_policy_number3 IN Varchar2 default null
6274 ,p_policy_number4 IN Varchar2 default null
6275 ,p_policy_number5 IN Varchar2 default null
6276 ,p_vpf_amount IN number default null
6277 ,p_vpf_percent IN number default null
6278 ,p_policy_number1 IN Varchar2 default null
6279 ,p_cce_ee_id22 IN number default null
6280 ,p_cce_component22 IN varchar2 default null
6281 ,p_investment_amount22 IN number default null
6282 ,p_cce_ee_id23 IN number default null
6283 ,p_cce_component23 IN varchar2 default null
6284 ,p_investment_amount23 IN number default null
6285 ,p_policy_number6 IN Varchar2 default null
6286 ,p_lic_entry_id6 IN number default null
6287 ,p_premium_paid6 IN number default null
6288 ,p_sum_assured6 IN number default null
6289 ,p_policy_number7 IN Varchar2 default null
6290 ,p_lic_entry_id7 IN number default null
6291 ,p_premium_paid7 IN number default null
6292 ,p_sum_assured7 IN number default null
6293 ,p_policy_number8 IN Varchar2 default null
6294 ,p_lic_entry_id8 IN number default null
6295 ,p_premium_paid8 IN number default null
6296 ,p_sum_assured8 IN number default null
6297 ,p_policy_number9 IN Varchar2 default null
6298 ,p_lic_entry_id9 IN number default null
6299 ,p_premium_paid9 IN number default null
6300 ,p_sum_assured9 IN number default null
6301 ,p_policy_number10 IN Varchar2 default null
6302 ,p_lic_entry_id10 IN number default null
6303 ,p_premium_paid10 IN number default null
6304 ,p_sum_assured10 IN number default null
6305 ,p_policy_number11 IN Varchar2 default null
6306 ,p_lic_entry_id11 IN number default null
6307 ,p_premium_paid11 IN number default null
6308 ,p_sum_assured11 IN number default null
6309 ,p_policy_number12 IN Varchar2 default null
6310 ,p_lic_entry_id12 IN number default null
6311 ,p_premium_paid12 IN number default null
6312 ,p_sum_assured12 IN number default null
6313 ,p_policy_start_date1 IN Varchar2 default null
6314 ,p_policy_start_date2 IN Varchar2 default null
6315 ,p_policy_start_date3 IN Varchar2 default null
6316 ,p_policy_start_date4 IN Varchar2 default null
6317 ,p_policy_start_date5 IN Varchar2 default null
6318 ,p_policy_start_date6 IN Varchar2 default null
6319 ,p_policy_start_date7 IN Varchar2 default null
6320 ,p_policy_start_date8 IN Varchar2 default null
6321 ,p_policy_start_date9 IN Varchar2 default null
6322 ,p_policy_start_date10 IN Varchar2 default null
6323 ,p_policy_start_date11 IN Varchar2 default null
6324 ,p_policy_start_date12 IN Varchar2 default null
6325 ,p_health_checkup IN number default null
6326 ,p_health_checkup_for_parents IN number default null
6327 ,P_SEC80TTA IN number default null
6328 ,P_SEC80CCG IN number default null
6329 ,P_80CCG_INVESTMENT_DATE IN Varchar2 default null
6330 )
6331 IS
6332 --
6333 l_effective_date DATE;
6334 l_procedure VARCHAR(100);
6335 l_message VARCHAR2(250);
6336 l_declare_warn BOOLEAN;
6337 l_warnings VARCHAR2(256);
6338 l_approved_flag VARCHAR2(10);
6339 l_count NUMBER;
6340 --
6341 -- Added as a part of bug fix for 4774108
6342 l_element_type_id NUMBER;
6343 l_element_link_id NUMBER;
6344
6345 CURSOR csr_element_type_id(p_element_name VARCHAR2)
6346 IS
6347 SELECT element_type_id
6348 FROM pay_element_types_f
6349 WHERE legislation_code = 'IN'
6350 AND element_name = p_element_name
6351 AND p_effective_date BETWEEN effective_start_date AND effective_end_date;
6352
6353 CURSOR csr_number_of_entries
6354 (c_assignment_id IN per_assignments_f.assignment_id%TYPE
6355 ,c_element_name IN pay_element_types_f.element_name%TYPE
6356 ,c_effective_date IN DATE
6357 ,c_element_link_id IN NUMBER)
6358 IS
6359 SELECT count(entries.element_entry_id)
6360 FROM per_assignments_f assgn
6361 , pay_element_links_f link
6362 , pay_element_types_f types
6363 , pay_element_entries_f entries
6364 WHERE assgn.assignment_id = c_assignment_id
6365 AND link.element_link_id = c_element_link_id
6366 AND (types.processing_type = 'R' OR assgn.payroll_id IS NOT NULL)
6367 AND link.business_group_id = assgn.business_group_id
6368 AND link.element_type_id = types.element_type_id
6369 AND types.element_name = c_element_name
6370 AND entries.element_type_id = types.element_type_id
6371 AND entries.element_link_id = link.element_link_id
6372 AND entries.assignment_id = assgn.assignment_id
6373 AND c_effective_date BETWEEN assgn.effective_start_date
6374 AND assgn.effective_end_date
6375 AND c_effective_date BETWEEN link.effective_start_date
6376 AND link.effective_end_date
6377 AND c_effective_date BETWEEN types.effective_start_date
6378 AND types.effective_end_date
6379 AND c_effective_date BETWEEN entries.effective_start_date
6380 AND entries.effective_end_date;
6381
6382
6383
6384
6385 PROCEDURE store_Disability
6386 (p_assignment_id IN number
6387 ,p_effective_date IN date default null
6388 ,p_disease_entry_id IN number default null
6389 ,p_disability_type IN varchar2 default null
6390 ,p_disability_percentage IN varchar2 default null
6391 ,p_treatment_amount IN number default null)
6392 IS
6393 l_procedure VARCHAR(100);
6394 l_message VARCHAR2(250);
6395
6396 BEGIN
6397
6398
6399 l_procedure := g_package || 'store_Disability';
6400 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
6401
6402 IF g_debug THEN
6403 pay_in_utils.trace('**************************************************','********************');
6404 pay_in_utils.trace('Disease Entry ID: ', p_disease_entry_id);
6405 pay_in_utils.trace('Disability _type: ', p_disability_type);
6406 pay_in_utils.trace('Disability Percentage: ',p_disability_percentage);
6407 pay_in_utils.trace('Treatment Amount: ' , p_treatment_amount);
6408 pay_in_utils.trace('**************************************************','********************');
6409 END IF;
6410
6411 pay_in_utils.set_location(g_debug,'Entering Section80dd', 20);
6412
6413 --
6414 declare_section80dd
6415 (p_assignment_id => p_assignment_id
6416 ,p_disability_type => p_disability_type
6417 ,p_disability_percentage => p_disability_percentage
6418 ,p_treatment_amount => p_treatment_amount
6419 ,p_effective_date => l_effective_date
6420 ,p_element_entry_id => p_disease_entry_id
6421 ,p_warnings => l_warnings);
6422 --
6423 pay_in_utils.set_location(g_debug,'Leaving Section80dd', 20);
6424
6425 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
6426 --
6427 END store_Disability;
6428
6429
6430
6431
6432 PROCEDURE store_Donation
6433 (p_assignment_id IN number
6434 ,p_effective_date IN date default null
6435 ,p_donation_entry_id IN number default null
6436 ,p_donation_type IN varchar2 default null
6437 ,p_donation_amount IN number default null)
6438 IS
6439 l_procedure VARCHAR(100);
6440
6441 BEGIN
6442
6443 l_procedure := g_package || 'store_Donation';
6444 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
6445
6446 IF g_debug THEN
6447 pay_in_utils.trace('**************************************************','********************');
6448 pay_in_utils.trace('Donation Entry ID: ', p_donation_entry_id);
6449 pay_in_utils.trace('Donation Type: ', p_donation_type);
6450 pay_in_utils.trace('Donation Amount: ', p_donation_amount);
6451 pay_in_utils.trace('**************************************************','********************');
6452 END IF;
6453
6454 pay_in_utils.set_location(g_debug,'Entering store_Donation', 20);
6455 --
6456 declare_section80g
6457 (p_assignment_id => p_assignment_id
6458 ,p_donation_type => p_donation_type
6459 ,p_donation_amount => p_donation_amount
6460 ,p_effective_date => p_effective_date
6461 ,p_element_entry_id => p_donation_entry_id
6462 ,p_warnings => l_warnings);
6463 --
6464 pay_in_utils.set_location(g_debug,'Leaving store_Donation', 20);
6465
6466 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
6467 --
6468 END store_Donation;
6469
6470
6471
6472 PROCEDURE store_LIC
6473 (p_assignment_id IN number
6474 ,p_effective_date IN date default null
6475 ,p_lic_entry_id IN number default null
6476 ,p_premium_paid IN number default null
6477 ,p_sum_assured IN number default null
6478 ,p_policy_number IN Varchar2 default null
6479 ,p_policy_start_date IN varchar2 default null)
6480 IS
6481 l_procedure VARCHAR(100);
6482 l_message VARCHAR2(250);
6483 l_policy_start_date DATE;
6484 BEGIN
6485
6486 l_procedure := g_package || 'store_LIC';
6487 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
6488
6489 IF g_debug THEN
6490 pay_in_utils.trace('**************************************************','********************');
6491 pay_in_utils.trace('LIC Entry ID: ' , p_lic_entry_id);
6492 pay_in_utils.trace('Premium Paid: ' , p_premium_paid);
6493 pay_in_utils.trace('Sum Assured: ' , p_sum_assured);
6494 pay_in_utils.trace('Policy Number: ', p_policy_number);
6495 pay_in_utils.trace('Policy Start Date: ', p_policy_start_date);
6496 pay_in_utils.trace('**************************************************','********************');
6497 END IF;
6498 --
6499 pay_in_utils.set_location(g_debug,'Entering store_LIC', 20);
6500
6501 BEGIN
6502 l_policy_start_date:=to_date(p_policy_start_date,'MM/DD/YYYY');
6503 EXCEPTION WHEN OTHERS THEN
6504 fnd_message.set_name('PER', 'PER_INVALID_POLICY_START_DATE');
6505 fnd_message.set_token('POLICY_START_DATE',p_policy_start_date, translate => true );
6506 hr_utility.raise_error;
6507 END;
6508
6509 declare_life_insurance_premium
6510 (p_assignment_id => p_assignment_id
6511 ,p_premium_paid => p_premium_paid
6512 ,p_sum_assured => p_sum_assured
6513 ,p_effective_date => p_effective_date
6514 ,p_element_entry_id => p_lic_entry_id
6515 ,p_policy_number => p_policy_number
6516 ,p_policy_start_date => l_policy_start_date
6517 ,p_warnings => l_warnings);
6518 --
6519 pay_in_utils.set_location(g_debug,'Leaving store_LIC', 30);
6520
6521 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
6522
6523 --
6524 END store_LIC;
6525
6526
6527
6528 PROCEDURE raise_message
6529 (p_token1 IN VARCHAR2
6530 ,p_token2 IN VARCHAR2)
6531 IS
6532 l_procedure VARCHAR(100);
6533 l_message VARCHAR2(250);
6534 BEGIN
6535
6536 l_procedure := g_package || 'raise_message';
6537 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
6538
6539 IF g_debug THEN
6540 pay_in_utils.trace('**************************************************','********************');
6541 pay_in_utils.trace('p_token1 : ' , p_token1);
6542 pay_in_utils.trace('p_token2 : ' , p_token2);
6543 pay_in_utils.trace('**************************************************','********************');
6544 END IF;
6545
6546 IF (INSTR(p_token1,'PER_IN_INVESTMENT_80CCE')= 1)
6547 THEN
6548 hr_utility.set_message(800, 'PER_IN_INVESTMENT_80CCE');
6549 hr_utility.set_message_token('FROM', SUBSTR(p_token1,LENGTH('PER_IN_INVESTMENT_80CCE') + 1));
6550 hr_utility.set_message_token('TO', p_token2);
6551 hr_utility.raise_error;
6552 END IF;
6553
6554 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,40);
6555
6556 END raise_message;
6557
6558
6559
6560 --
6561 BEGIN
6562
6563 --hr_utility.trace_on (null, 'ORACLE9999');
6564 l_procedure := g_package || 'web_adi_declare_tax';
6565 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
6566
6567
6568 IF g_debug THEN
6569 pay_in_utils.trace('**************************************************','********************');
6570 pay_in_utils.trace('p_assignment_id ',p_assignment_id);
6571 pay_in_utils.trace('p_effective_date ',p_effective_date);
6572 pay_in_utils.trace ('p_apr ',p_april);
6573 pay_in_utils.trace ('p_may ',p_may);
6574 pay_in_utils.trace ('p_jun ',p_june);
6575 pay_in_utils.trace ('p_jul ',p_july);
6576 pay_in_utils.trace ('p_aug ',p_august);
6577 pay_in_utils.trace ('p_sep ',p_september);
6578 pay_in_utils.trace ('p_oct ',p_october);
6579 pay_in_utils.trace ('p_nov ',p_november);
6580 pay_in_utils.trace ('p_dec ',p_december);
6581 pay_in_utils.trace ('p_jan ',p_january);
6582 pay_in_utils.trace ('p_feb ',p_february);
6583 pay_in_utils.trace ('p_mar ',p_march);
6584 pay_in_utils.trace('p_cce_ee_id1 ',p_cce_ee_id1);
6585 pay_in_utils.trace('p_cce_component1 ',p_cce_component1);
6586 pay_in_utils.trace('p_investment_amount1 ',p_investment_amount1);
6587 pay_in_utils.trace('p_cce_ee_id2 ',p_cce_ee_id2);
6588 pay_in_utils.trace('p_cce_component2 ',p_cce_component2);
6589 pay_in_utils.trace('p_investment_amount2 ',p_investment_amount2);
6590 pay_in_utils.trace('p_cce_ee_id3 ',p_cce_ee_id3);
6591 pay_in_utils.trace('p_cce_component3 ',p_cce_component3);
6592 pay_in_utils.trace('p_investment_amount3 ',p_investment_amount3);
6593 pay_in_utils.trace('p_cce_ee_id4 ',p_cce_ee_id4);
6594 pay_in_utils.trace('p_cce_component4 ',p_cce_component4);
6595 pay_in_utils.trace('p_investment_amount4 ',p_investment_amount4);
6596 pay_in_utils.trace('p_cce_ee_id5 ',p_cce_ee_id5);
6597 pay_in_utils.trace('p_cce_component5 ',p_cce_component5);
6598 pay_in_utils.trace('p_investment_amount5 ',p_investment_amount6);
6599 pay_in_utils.trace('p_cce_ee_id6 ',p_cce_ee_id6);
6600 pay_in_utils.trace('p_cce_component6 ',p_cce_component6);
6601 pay_in_utils.trace('p_investment_amount6 ',p_investment_amount6);
6602 pay_in_utils.trace('p_cce_ee_id7 ',p_cce_ee_id7);
6603 pay_in_utils.trace('p_cce_component7 ',p_cce_component7);
6604 pay_in_utils.trace('p_investment_amount7 ',p_investment_amount7);
6605 pay_in_utils.trace('p_cce_ee_id8 ',p_cce_ee_id8);
6606 pay_in_utils.trace('p_cce_component8 ',p_cce_component8);
6607 pay_in_utils.trace('p_investment_amount8 ',p_investment_amount8);
6608 pay_in_utils.trace('p_cce_ee_id9 ',p_cce_ee_id9);
6609 pay_in_utils.trace('p_cce_component9 ',p_cce_component9);
6610 pay_in_utils.trace('p_investment_amount9 ',p_investment_amount9);
6611 pay_in_utils.trace('p_cce_ee_id10 ',p_cce_ee_id10);
6612 pay_in_utils.trace('p_cce_component10 ',p_cce_component10);
6613 pay_in_utils.trace('p_investment_amount10 ',p_investment_amount10);
6614 pay_in_utils.trace('p_cce_ee_id11 ',p_cce_ee_id11);
6615 pay_in_utils.trace('p_cce_component11 ',p_cce_component11);
6616 pay_in_utils.trace('p_investment_amount11 ',p_investment_amount11);
6617 pay_in_utils.trace('p_cce_ee_id12 ',p_cce_ee_id12);
6618 pay_in_utils.trace('p_cce_component12 ',p_cce_component12);
6619 pay_in_utils.trace('p_investment_amount12 ',p_investment_amount12);
6620 pay_in_utils.trace('p_cce_ee_id13 ',p_cce_ee_id13);
6621 pay_in_utils.trace('p_cce_component13 ',p_cce_component13);
6622 pay_in_utils.trace('p_investment_amount13 ',p_investment_amount13);
6623 pay_in_utils.trace('p_cce_ee_id14 ',p_cce_ee_id14);
6624 pay_in_utils.trace('p_cce_component14 ',p_cce_component14);
6625 pay_in_utils.trace('p_investment_amount14 ',p_investment_amount14);
6626 pay_in_utils.trace('p_cce_ee_id15 ',p_cce_ee_id15);
6627 pay_in_utils.trace('p_cce_component15 ',p_cce_component15);
6628 pay_in_utils.trace('p_investment_amount15 ',p_investment_amount15);
6629 pay_in_utils.trace('p_cce_ee_id16 ',p_cce_ee_id16);
6630 pay_in_utils.trace('p_cce_component16 ',p_cce_component16);
6631 pay_in_utils.trace('p_investment_amount16 ',p_investment_amount16);
6632 pay_in_utils.trace('p_cce_ee_id17 ',p_cce_ee_id17);
6633 pay_in_utils.trace('p_cce_component17 ',p_cce_component17);
6634 pay_in_utils.trace('p_investment_amount17 ',p_investment_amount17);
6635 pay_in_utils.trace('p_cce_ee_id18 ',p_cce_ee_id18);
6636 pay_in_utils.trace('p_cce_component18 ',p_cce_component18);
6637 pay_in_utils.trace('p_investment_amount18 ',p_investment_amount18);
6638 pay_in_utils.trace('p_cce_ee_id19 ',p_cce_ee_id19);
6639 pay_in_utils.trace('p_cce_component19 ',p_cce_component19);
6640 pay_in_utils.trace('p_investment_amount19 ',p_investment_amount19);
6641 pay_in_utils.trace('p_cce_ee_id20 ',p_cce_ee_id20);
6642 pay_in_utils.trace('p_cce_component20 ',p_cce_component20);
6643 pay_in_utils.trace('p_investment_amount20 ',p_investment_amount20);
6644 pay_in_utils.trace('p_cce_ee_id21 ',p_cce_ee_id21);
6645 pay_in_utils.trace('p_cce_component21 ',p_cce_component21);
6646 pay_in_utils.trace('p_investment_amount21 ',p_investment_amount21);
6647 pay_in_utils.trace('p_higher_education_loan ',p_higher_education_loan);
6648 pay_in_utils.trace('p_donation_for_research ',p_donation_for_research);
6649 pay_in_utils.trace('p_claim_exemption_sec_80gg ',p_claim_exemption_sec_80gg);
6650 pay_in_utils.trace('p_premium_amount ',p_premium_amount);
6651 pay_in_utils.trace('p_premium_covers_sc ',p_premium_covers_sc);
6652 pay_in_utils.trace('p_treatment_amount ',p_treatment_amount);
6653 pay_in_utils.trace('p_treatment_covers_sc ',p_treatment_covers_sc);
6654 pay_in_utils.trace('p_income_from_house_property ',p_income_from_house_property);
6655 pay_in_utils.trace('p_profit_and_gain ',p_profit_and_gain);
6656 pay_in_utils.trace('p_long_term_capital_gain ',p_long_term_capital_gain);
6657 pay_in_utils.trace('p_short_term_capital_gain ',p_short_term_capital_gain);
6658 pay_in_utils.trace('p_income_from_other_sources ',p_income_from_other_sources);
6659 pay_in_utils.trace('p_tds_paid ',p_tds_paid);
6660 pay_in_utils.trace('p_disease_entry_id1 ',p_disease_entry_id1);
6661 pay_in_utils.trace('p_disability_type1 ',p_disability_type1);
6662 pay_in_utils.trace('p_disability_percentage1 ',p_disability_percentage1);
6663 pay_in_utils.trace('p_treatment_amount1 ',p_treatment_amount1);
6664 pay_in_utils.trace('p_disease_entry_id2 ',p_disease_entry_id2);
6665 pay_in_utils.trace('p_disability_type2 ',p_disability_type2);
6666 pay_in_utils.trace('p_disability_percentage2 ',p_disability_percentage2 );
6667 pay_in_utils.trace('p_treatment_amount2 ',p_treatment_amount2);
6668 pay_in_utils.trace('p_donation_entry_id1 ',p_donation_entry_id1);
6669 pay_in_utils.trace('p_donation_type1 ',p_donation_type1);
6670 pay_in_utils.trace('p_donation_amount1 ',p_donation_amount1);
6671 pay_in_utils.trace('p_donation_entry_id2 ',p_donation_amount1);
6672 pay_in_utils.trace('p_donation_type2 ',p_donation_type2);
6673 pay_in_utils.trace('p_donation_amount2 ',p_donation_amount2);
6674 pay_in_utils.trace('p_lic_entry_id1 ',p_lic_entry_id1);
6675 pay_in_utils.trace('p_premium_paid1 ',p_premium_paid1);
6676 pay_in_utils.trace('p_sum_assured1 ',p_sum_assured1);
6677 pay_in_utils.trace('p_policy_number1 ',p_policy_number1);
6678 pay_in_utils.trace('p_lic_entry_id2 ',p_lic_entry_id2);
6679 pay_in_utils.trace('p_premium_paid2 ',p_premium_paid2);
6680 pay_in_utils.trace('p_sum_assured2 ',p_sum_assured2);
6681 pay_in_utils.trace('p_policy_number2 ',p_policy_number2);
6682 pay_in_utils.trace('p_lic_entry_id3 ',p_lic_entry_id3);
6683 pay_in_utils.trace('p_premium_paid3 ',p_premium_paid3);
6684 pay_in_utils.trace('p_sum_assured3 ',p_sum_assured3);
6685 pay_in_utils.trace('p_policy_number3 ',p_policy_number3);
6686 pay_in_utils.trace('p_lic_entry_id4 ',p_lic_entry_id4);
6687 pay_in_utils.trace('p_premium_paid4 ',p_premium_paid4);
6688 pay_in_utils.trace('p_sum_assured4 ',p_sum_assured4);
6689 pay_in_utils.trace('p_policy_number4 ',p_policy_number4);
6690 pay_in_utils.trace('p_lic_entry_id5 ',p_lic_entry_id5);
6691 pay_in_utils.trace('p_premium_paid5 ',p_premium_paid5);
6692 pay_in_utils.trace('p_sum_assured5 ',p_sum_assured5);
6693 pay_in_utils.trace('p_policy_number5 ',p_policy_number5);
6694 pay_in_utils.trace('p_comment_text ',p_comment_text);
6695 pay_in_utils.trace('p_vpf_amount ',p_vpf_amount);
6696 pay_in_utils.trace('p_vpf_percent ',p_vpf_percent);
6697 pay_in_utils.trace('p_cce_ee_id22 ',p_cce_ee_id22);
6698 pay_in_utils.trace('p_cce_component22 ',p_cce_component22);
6699 pay_in_utils.trace('p_investment_amount22 ',p_investment_amount22);
6700 pay_in_utils.trace('p_cce_ee_id23 ',p_cce_ee_id23);
6701 pay_in_utils.trace('p_cce_component23 ',p_cce_component23);
6702 pay_in_utils.trace('p_investment_amount23 ',p_investment_amount23);
6703 pay_in_utils.trace('P_SEC80TTA ',P_SEC80TTA);
6704 pay_in_utils.trace('P_SEC80CCG ',P_SEC80CCG);
6705 pay_in_utils.trace('P_80CCG_INVESTMENT_DATE ',P_80CCG_INVESTMENT_DATE);
6706 pay_in_utils.trace('**************************************************','********************');
6707 END IF ;
6708
6709
6710
6711
6712 l_declare_warn := false;
6713 l_approved_flag := 'Y';
6714 --
6715 --
6716 l_effective_date := pay_in_utils.get_effective_date(p_effective_date);
6717 --
6718 declare_house_rent
6719 (p_assignment_id => p_assignment_id
6720 ,p_effective_date => l_effective_date
6721 ,p_apr => p_april
6722 ,p_may => p_may
6723 ,p_jun => p_june
6724 ,p_jul => p_july
6725 ,p_aug => p_august
6726 ,p_sep => p_september
6727 ,p_oct => p_october
6728 ,p_nov => p_november
6729 ,p_dec => p_december
6730 ,p_jan => p_january
6731 ,p_feb => p_february
6732 ,p_mar => p_march
6733 ,p_warnings => l_declare_warn);
6734 --
6735 pay_in_utils.set_location(g_debug, l_procedure, 20);
6736
6737 declare_other_income
6738 (p_assignment_id => p_assignment_id
6739 ,p_effective_date => l_effective_date
6740 ,p_income_from_house_property => p_income_from_house_property
6741 ,p_profit_and_gain_from_busines => p_profit_and_gain
6742 ,p_long_term_capital_gain => p_long_term_capital_gain
6743 ,p_short_term_capital_gain => p_short_term_capital_gain
6744 ,p_income_from_any_other_source => p_income_from_other_sources
6745 ,p_tds_paid_on_other_income => p_tds_paid
6746 ,p_interest_on_deposits => P_SEC80TTA
6747 ,p_warnings => l_declare_warn);
6748 --
6749 pay_in_utils.set_location(g_debug, l_procedure, 60);
6750 --
6751
6752 declare_section80e
6753 (p_assignment_id => p_assignment_id
6754 ,p_effective_date => l_effective_date
6755 ,p_higher_education_loan_80e => p_higher_education_loan
6756 ,p_warnings => l_declare_warn);
6757
6758
6759 --
6760 pay_in_utils.set_location(g_debug, l_procedure, 70);
6761 --
6762
6763 declare_section80ccf
6764 (p_assignment_id => p_assignment_id
6765 ,p_effective_date => l_effective_date
6766 ,p_infrastructure_bonds_80ccf => p_isb_amount
6767 ,p_warnings => l_declare_warn);
6768
6769
6770
6771
6772 BEGIN
6773 L_80CCG_INVESTMENT_DATE:=to_date(P_80CCG_INVESTMENT_DATE,'MM/DD/YYYY');
6774 EXCEPTION WHEN OTHERS THEN
6775 fnd_message.set_name('PER', 'PER_INVALID_INVESTMENT_DATE');
6776 fnd_message.set_token('INVESTMENT_DATE',P_80CCG_INVESTMENT_DATE, translate => true );
6777 hr_utility.raise_error;
6778 END;
6779
6780 declare_section80ccg
6781 (p_assignment_id => p_assignment_id
6782 ,p_effective_date => l_effective_date
6783 ,p_investment_amt_80ccg => P_SEC80CCG
6784 ,p_investment_date_80ccg => L_80CCG_INVESTMENT_DATE
6785 ,p_warnings => l_declare_warn);
6786
6787
6788 --
6789 pay_in_utils.set_location(g_debug, l_procedure, 75);
6790
6791
6792 declare_section80gga
6793 (p_assignment_id => p_assignment_id
6794 ,p_effective_date => l_effective_date
6795 ,p_donation_for_research_80gga => p_donation_for_research
6796 ,p_warnings => l_declare_warn);
6797
6798 --
6799 pay_in_utils.set_location(g_debug, l_procedure, 80);
6800 --
6801 declare_section80gg
6802 (p_assignment_id => p_assignment_id
6803 ,p_effective_date => l_effective_date
6804 ,p_claim_exemp_under_sec_80gg => p_claim_exemption_sec_80gg
6805 ,p_warnings => l_declare_warn);
6806 --
6807 pay_in_utils.set_location(g_debug, l_procedure, 90);
6808 --
6809 declare_section80d
6810 (p_assignment_id => p_assignment_id
6811 ,p_effective_date => l_effective_date
6812 ,p_medical_insurance_prem_80d => p_premium_amount
6813 ,p_sec_80d_senior_citizen => p_premium_covers_sc
6814 ,p_med_par_insurance_prem_80d => p_parent_premium
6815 ,p_sec_80d_par_senior_citizen => p_parent_sc
6816 ,p_health_checkup_self => p_health_checkup
6817 ,p_health_checkup_parents => p_health_checkup_for_parents
6818 ,p_warnings => l_declare_warn);
6819 --
6820 pay_in_utils.set_location(g_debug, l_procedure, 100);
6821 --
6822 declare_section80ddb
6823 (p_assignment_id => p_assignment_id
6824 ,p_effective_date => l_effective_date
6825 ,p_disease_treatment_80ddb => p_treatment_amount
6826 ,p_sec_80ddb_senior_citizen => p_treatment_covers_sc
6827 ,p_warnings => l_declare_warn);
6828 --
6829 pay_in_utils.set_location(g_debug, l_procedure, 110);
6830 --
6831 declare_vpf
6832 (p_assignment_id => p_assignment_id
6833 ,p_effective_date => l_effective_date
6834 ,p_ee_vol_pf_amount => p_vpf_amount
6835 ,p_ee_vol_pf_percent => p_vpf_percent
6836 ,p_warnings => l_declare_warn);
6837
6838 --
6839 pay_in_utils.set_location(g_debug, l_procedure, 120);
6840 --
6841 store_Disability(p_assignment_id, l_effective_date, p_disease_entry_id1, p_disability_type1, p_disability_percentage1, p_treatment_amount1);
6842 store_Disability(p_assignment_id, l_effective_date, p_disease_entry_id2, p_disability_type2, p_disability_percentage2, p_treatment_amount2);
6843
6844 --
6845 pay_in_utils.set_location(g_debug, l_procedure, 130);
6846 --
6847 store_Donation(p_assignment_id, l_effective_date, p_donation_entry_id1, p_donation_type1, p_donation_amount1);
6848 store_Donation(p_assignment_id, l_effective_date, p_donation_entry_id2, p_donation_type2, p_donation_amount2);
6849 --
6850 pay_in_utils.set_location(g_debug, l_procedure, 140);
6851 --
6852
6853 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id1, p_premium_paid1, p_sum_assured1, p_policy_number1,p_policy_start_date1);
6854 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id2, p_premium_paid2, p_sum_assured2, p_policy_number2,p_policy_start_date2);
6855 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id3, p_premium_paid3, p_sum_assured3, p_policy_number3,p_policy_start_date3);
6856 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id4, p_premium_paid4, p_sum_assured4, p_policy_number4,p_policy_start_date4);
6857 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id5, p_premium_paid5, p_sum_assured5, p_policy_number5,p_policy_start_date5);
6858
6859 --Bug No: 13702922 Added 7 more LIC policy for webadi
6860 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id6, p_premium_paid6, p_sum_assured6, p_policy_number6,p_policy_start_date6);
6861 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id7, p_premium_paid7, p_sum_assured7, p_policy_number7,p_policy_start_date7);
6862 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id8, p_premium_paid8, p_sum_assured8, p_policy_number8,p_policy_start_date8);
6863 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id9, p_premium_paid9, p_sum_assured9, p_policy_number9,p_policy_start_date9);
6864 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id10, p_premium_paid10, p_sum_assured10, p_policy_number10,p_policy_start_date10);
6865 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id11, p_premium_paid11, p_sum_assured11, p_policy_number11,p_policy_start_date11);
6866 store_LIC(p_assignment_id, l_effective_date, p_lic_entry_id12, p_premium_paid12, p_sum_assured12, p_policy_number12,p_policy_start_date12);
6867
6868
6869 pay_in_utils.set_location(g_debug, l_procedure, 150);
6870 --
6871 declare_section80cce(p_assignment_id, p_cce_component1, p_investment_amount1, p_effective_date, p_cce_ee_id1, l_warnings);
6872 raise_message(l_warnings,p_cce_component1);
6873 declare_section80cce(p_assignment_id, p_cce_component2, p_investment_amount2, p_effective_date, p_cce_ee_id2, l_warnings);
6874 raise_message(l_warnings,p_cce_component2);
6875 declare_section80cce(p_assignment_id, p_cce_component3, p_investment_amount3, p_effective_date, p_cce_ee_id3, l_warnings);
6876 raise_message(l_warnings,p_cce_component3);
6877 declare_section80cce(p_assignment_id, p_cce_component4, p_investment_amount4, p_effective_date, p_cce_ee_id4, l_warnings);
6878 raise_message(l_warnings,p_cce_component4);
6879 declare_section80cce(p_assignment_id, p_cce_component5, p_investment_amount5, p_effective_date, p_cce_ee_id5, l_warnings);
6880 raise_message(l_warnings,p_cce_component5);
6881 declare_section80cce(p_assignment_id, p_cce_component6, p_investment_amount6, p_effective_date, p_cce_ee_id6, l_warnings);
6882 raise_message(l_warnings,p_cce_component6);
6883 declare_section80cce(p_assignment_id, p_cce_component7, p_investment_amount7, p_effective_date, p_cce_ee_id7, l_warnings);
6884 raise_message(l_warnings,p_cce_component7);
6885 declare_section80cce(p_assignment_id, p_cce_component8, p_investment_amount8, p_effective_date, p_cce_ee_id8, l_warnings);
6886 raise_message(l_warnings,p_cce_component8);
6887 declare_section80cce(p_assignment_id, p_cce_component9, p_investment_amount9, p_effective_date, p_cce_ee_id9, l_warnings);
6888 raise_message(l_warnings,p_cce_component9);
6889 declare_section80cce(p_assignment_id, p_cce_component10, p_investment_amount10, p_effective_date, p_cce_ee_id10, l_warnings);
6890 raise_message(l_warnings,p_cce_component10);
6891 declare_section80cce(p_assignment_id, p_cce_component11, p_investment_amount11, p_effective_date, p_cce_ee_id11, l_warnings);
6892 raise_message(l_warnings,p_cce_component11);
6893 declare_section80cce(p_assignment_id, p_cce_component12, p_investment_amount12, p_effective_date, p_cce_ee_id12, l_warnings);
6894 raise_message(l_warnings,p_cce_component12);
6895 declare_section80cce(p_assignment_id, p_cce_component13, p_investment_amount13, p_effective_date, p_cce_ee_id13, l_warnings);
6896 raise_message(l_warnings,p_cce_component13);
6897 declare_section80cce(p_assignment_id, p_cce_component14, p_investment_amount14, p_effective_date, p_cce_ee_id14, l_warnings);
6898 raise_message(l_warnings,p_cce_component14);
6899 declare_section80cce(p_assignment_id, p_cce_component15, p_investment_amount15, p_effective_date, p_cce_ee_id15, l_warnings);
6900 raise_message(l_warnings,p_cce_component15);
6901 declare_section80cce(p_assignment_id, p_cce_component16, p_investment_amount16, p_effective_date, p_cce_ee_id16, l_warnings);
6902 raise_message(l_warnings,p_cce_component16);
6903 declare_section80cce(p_assignment_id, p_cce_component17, p_investment_amount17, p_effective_date, p_cce_ee_id17, l_warnings);
6904 raise_message(l_warnings,p_cce_component17);
6905 declare_section80cce(p_assignment_id, p_cce_component18, p_investment_amount18, p_effective_date, p_cce_ee_id18, l_warnings);
6906 raise_message(l_warnings,p_cce_component18);
6907 declare_section80cce(p_assignment_id, p_cce_component19, p_investment_amount19, p_effective_date, p_cce_ee_id19, l_warnings);
6908 raise_message(l_warnings,p_cce_component19);
6909 declare_section80cce(p_assignment_id, p_cce_component20, p_investment_amount20, p_effective_date, p_cce_ee_id20, l_warnings);
6910 raise_message(l_warnings,p_cce_component20);
6911 declare_section80cce(p_assignment_id, p_cce_component21, p_investment_amount21, p_effective_date, p_cce_ee_id21, l_warnings);
6912 raise_message(l_warnings,p_cce_component21);
6913 declare_section80cce(p_assignment_id, p_cce_component22, p_investment_amount22, p_effective_date, p_cce_ee_id22, l_warnings);
6914 raise_message(l_warnings,p_cce_component22);
6915 declare_section80cce(p_assignment_id, p_cce_component23, p_investment_amount23, p_effective_date, p_cce_ee_id23, l_warnings);
6916 raise_message(l_warnings,p_cce_component23);
6917
6918 l_count := 0;
6919 -- Added as a part of bug fix 4774108
6920 OPEN csr_element_type_id('Deduction under Section 80DD');
6921 FETCH csr_element_type_id INTO l_element_type_id;
6922 CLOSE csr_element_type_id;
6923
6924 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
6925 ,l_effective_date
6926 ,l_element_type_id
6927 );
6928
6929 OPEN csr_number_of_entries(p_assignment_id, 'Deduction under Section 80DD', l_effective_date,l_element_link_id);
6930 FETCH csr_number_of_entries INTO l_count;
6931 CLOSE csr_number_of_entries;
6932 --
6933 IF l_count > 2 THEN
6934 --
6935 l_approved_flag := 'N';
6936 --
6937 END IF;
6938 --
6939 pay_in_utils.set_location(g_debug, l_procedure, 160);
6940 --
6941 -- Added as a part of bug fix 4774108
6942 OPEN csr_element_type_id('Deduction under Section 80G');
6943 FETCH csr_element_type_id INTO l_element_type_id;
6944 CLOSE csr_element_type_id;
6945
6946 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
6947 ,l_effective_date
6948 ,l_element_type_id
6949 );
6950
6951 l_count := 0;
6952 OPEN csr_number_of_entries(p_assignment_id, 'Deduction under Section 80G',l_effective_date,l_element_link_id);
6953 FETCH csr_number_of_entries INTO l_count;
6954 CLOSE csr_number_of_entries;
6955 --
6956 IF l_count > 2 THEN
6957 --
6958 l_approved_flag := 'N';
6959 --
6960 END IF;
6961 --
6962 pay_in_utils.set_location(g_debug, l_procedure, 170);
6963 --
6964 l_count := 0;
6965 -- Added as a part of bug fix 4774108
6966 OPEN csr_element_type_id('Life Insurance Premium');
6967 FETCH csr_element_type_id INTO l_element_type_id;
6968 CLOSE csr_element_type_id;
6969
6970 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
6971 ,l_effective_date
6972 ,l_element_type_id
6973 );
6974
6975 OPEN csr_number_of_entries(p_assignment_id, 'Life Insurance Premium', l_effective_date,l_element_link_id);
6976 FETCH csr_number_of_entries INTO l_count;
6977 CLOSE csr_number_of_entries;
6978 --
6979 IF l_count > 12 THEN
6980 --
6981 l_approved_flag := 'N';
6982 --
6983 END IF;
6984 --
6985 pay_in_utils.set_location(g_debug, l_procedure, 180);
6986 --
6987 -- Added as a part of bug fix 4774108
6988 OPEN csr_element_type_id('Deduction under Section 80CCE');
6989 FETCH csr_element_type_id INTO l_element_type_id;
6990 CLOSE csr_element_type_id;
6991
6992 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
6993 ,l_effective_date
6994 ,l_element_type_id
6995 );
6996
6997 l_count := 0;
6998 OPEN csr_number_of_entries(p_assignment_id,'Deduction under Section 80CCE',l_effective_date,l_element_link_id);
6999 FETCH csr_number_of_entries INTO l_count;
7000 CLOSE csr_number_of_entries;
7001 --
7002 IF l_count > 19 THEN
7003 --
7004 l_approved_flag := 'N';
7005 --
7006 END IF;
7007 --
7008 pay_in_utils.set_location(g_debug, l_procedure, 190);
7009
7010 -- Added as a part of bug fix 4774108
7011 OPEN csr_element_type_id('Pension Fund 80CCC');
7012 FETCH csr_element_type_id INTO l_element_type_id;
7013 CLOSE csr_element_type_id;
7014
7015 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
7016 ,l_effective_date
7017 ,l_element_type_id
7018 );
7019
7020 l_count := 0;
7021 OPEN csr_number_of_entries(p_assignment_id, 'Pension Fund 80CCC', l_effective_date,l_element_link_id);
7022 FETCH csr_number_of_entries INTO l_count;
7023 CLOSE csr_number_of_entries;
7024 --
7025 IF l_count > 1 THEN
7026 --
7027 l_approved_flag := 'N';
7028 --
7029 END IF;
7030 --
7031 pay_in_utils.set_location(g_debug, l_procedure, 200);
7032
7033 l_count := 0;
7034 -- Added as a part of bug fix 4774108
7035 OPEN csr_element_type_id('Deferred Annuity');
7036 FETCH csr_element_type_id INTO l_element_type_id;
7037 CLOSE csr_element_type_id;
7038
7039 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
7040 ,l_effective_date
7041 ,l_element_type_id
7042 );
7043
7044 OPEN csr_number_of_entries(p_assignment_id, 'Deferred Annuity', l_effective_date,l_element_link_id);
7045 FETCH csr_number_of_entries INTO l_count;
7046 CLOSE csr_number_of_entries;
7047 --
7048 IF l_count > 1 THEN
7049 --
7050 l_approved_flag := 'N';
7051 --
7052 END IF;
7053
7054 l_count := 0;
7055 OPEN csr_element_type_id('Senior Citizens Savings Scheme');
7056 FETCH csr_element_type_id INTO l_element_type_id;
7057 CLOSE csr_element_type_id;
7058
7059 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
7060 ,l_effective_date
7061 ,l_element_type_id
7062 );
7063
7064 OPEN csr_number_of_entries(p_assignment_id, 'Senior Citizens Savings Scheme', l_effective_date,l_element_link_id);
7065 FETCH csr_number_of_entries INTO l_count;
7066 CLOSE csr_number_of_entries;
7067 --
7068 IF l_count > 1 THEN
7069 --
7070 l_approved_flag := 'N';
7071 --
7072 END IF;
7073 --
7074 pay_in_utils.set_location(g_debug, l_procedure, 210);
7075 --
7076 approve_declaration
7077 (p_assignment_id => p_assignment_id
7078 ,p_approval_flag => l_approved_flag
7079 ,p_effective_date => l_effective_date
7080 ,p_comment_text => p_comment_text);
7081 --
7082 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,220);
7083
7084 END web_adi_declare_tax;
7085
7086 --------------------------------------------------------------------------
7087 -- --
7088 -- Name : GET_VALUE --
7089 -- Type : PROCEDURE --
7090 -- Access : Public --
7091 -- Description : The procedure is responsible for getting values --
7092 -- of the input values in case of multiple element --
7093 -- of an element in tax declaration --
7094 -- --
7095 -- Parameters : --
7096 -- IN : p_assignment_id NUMBER --
7097 -- p_index NUMBER --
7098 -- p_element_name VARCHAR2 --
7099 -- p_input_name VARCHAR2 --
7100 -- p_effective_date DATE --
7101 -- --
7102 -- Change History : --
7103 --------------------------------------------------------------------------
7104 -- Rev# Date Userid Description --
7105 --------------------------------------------------------------------------
7106 -- 1.1 20-Jun-2005 abhjain Added changes after stat update --
7107 --------------------------------------------------------------------------
7108 FUNCTION get_value
7109 (p_assignment_id IN number
7110 ,p_index IN number
7111 ,p_element_name IN varchar2
7112 ,p_input_name IN varchar2
7113 ,p_effective_date IN date
7114 )
7115 RETURN VARCHAR2
7116 IS
7117 --
7118 CURSOR csr_get_80dd_values(p_element_link_id NUMBER)
7119 IS
7120 SELECT entries.element_entry_id entry_id
7121 , value1.screen_entry_value Disability_Type
7122 , value2.screen_entry_value Treatment_Amount
7123 , value3.screen_entry_value Disability_Percentage
7124 FROM per_assignments_f assgn
7125 , pay_element_links_f link
7126 , pay_element_types_f types
7127 , pay_element_entries_f entries
7128 , pay_element_entry_values_f value1
7129 , pay_input_values_f inputs1
7130 , pay_element_entry_values_f value2
7131 , pay_input_values_f inputs2
7132 , pay_element_entry_values_f value3
7133 , pay_input_values_f inputs3
7134 WHERE assgn.assignment_id = p_assignment_id
7135 AND link.element_link_id = p_element_link_id-- Changed for bug 4774108
7136 AND (types.processing_type = 'R' OR assgn.payroll_id IS NOT NULL)
7137 AND link.business_group_id = assgn.business_group_id
7138 AND link.element_type_id = types.element_type_id
7139 AND types.element_name = 'Deduction under Section 80DD'
7140 AND entries.element_type_id = types.element_type_id
7141 AND entries.element_link_id = link.element_link_id
7142 AND entries.assignment_id = assgn.assignment_id
7143 AND value1.element_entry_id = entries.element_entry_id
7144 AND inputs1.input_value_id = value1.input_value_id
7145 AND inputs1.element_type_id = types.element_type_id
7146 AND inputs1.name = 'Disability Type'
7147 AND value2.element_entry_id = entries.element_entry_id
7148 AND inputs2.input_value_id = value2.input_value_id
7149 AND inputs2.element_type_id = types.element_type_id
7150 AND inputs2.name = 'Treatment Amount'
7151 AND value3.element_entry_id = entries.element_entry_id
7152 AND inputs3.input_value_id = value3.input_value_id
7153 AND inputs3.element_type_id = types.element_type_id
7154 AND inputs3.name = 'Disability Percentage'
7155 AND p_effective_date BETWEEN assgn.effective_start_date
7156 AND assgn.effective_end_date
7157 AND p_effective_date BETWEEN link.effective_start_date
7158 AND link.effective_end_date
7159 AND p_effective_date BETWEEN types.effective_start_date
7160 AND types.effective_end_date
7161 AND p_effective_date BETWEEN entries.effective_start_date
7162 AND entries.effective_end_date
7163 AND p_effective_date BETWEEN inputs1.effective_start_date
7164 AND inputs1.effective_end_date
7165 AND p_effective_date BETWEEN value1.effective_start_date
7166 AND value1.effective_end_date
7167 AND p_effective_date BETWEEN inputs2.effective_start_date
7168 AND inputs2.effective_end_date
7169 AND p_effective_date BETWEEN value2.effective_start_date
7170 AND value2.effective_end_date
7171 AND p_effective_date BETWEEN inputs3.effective_start_date
7172 AND inputs3.effective_end_date
7173 AND p_effective_date BETWEEN value3.effective_start_date
7174 AND value3.effective_end_date;
7175 --
7176 CURSOR csr_get_80g_values(p_element_link_id NUMBER)
7177 IS
7178 SELECT entries.element_entry_id entry_id
7179 , value1.screen_entry_value Donation_Type
7180 , value2.screen_entry_value Donation_Amount
7181 FROM per_assignments_f assgn
7182 , pay_element_links_f link
7183 , pay_element_types_f types
7184 , pay_element_entries_f entries
7185 , pay_element_entry_values_f value1
7186 , pay_input_values_f inputs1
7187 , pay_element_entry_values_f value2
7188 , pay_input_values_f inputs2
7189 WHERE assgn.assignment_id = p_assignment_id
7190 AND link.element_link_id = p_element_link_id
7191 AND (types.processing_type = 'R' OR assgn.payroll_id IS NOT NULL)
7192 AND link.business_group_id = assgn.business_group_id
7193 AND link.element_type_id = types.element_type_id
7194 AND types.element_name = 'Deduction under Section 80G'
7195 AND entries.element_type_id = types.element_type_id
7196 AND entries.element_link_id = link.element_link_id
7197 AND entries.assignment_id = assgn.assignment_id
7198 AND value1.element_entry_id = entries.element_entry_id
7199 AND inputs1.input_value_id = value1.input_value_id
7200 AND inputs1.element_type_id = types.element_type_id
7201 AND inputs1.name = 'Donation Type'
7202 AND value2.element_entry_id = entries.element_entry_id
7203 AND inputs2.input_value_id = value2.input_value_id
7204 AND inputs2.element_type_id = types.element_type_id
7205 AND inputs2.name = 'Donation Amount'
7206 AND p_effective_date BETWEEN assgn.effective_start_date
7207 AND assgn.effective_end_date
7208 AND p_effective_date BETWEEN link.effective_start_date
7209 AND link.effective_end_date
7210 AND p_effective_date BETWEEN types.effective_start_date
7211 AND types.effective_end_date
7212 AND p_effective_date BETWEEN entries.effective_start_date
7213 AND entries.effective_end_date
7214 AND p_effective_date BETWEEN inputs1.effective_start_date
7215 AND inputs1.effective_end_date
7216 AND p_effective_date BETWEEN value1.effective_start_date
7217 AND value1.effective_end_date
7218 AND p_effective_date BETWEEN inputs2.effective_start_date
7219 AND inputs2.effective_end_date
7220 AND p_effective_date BETWEEN value2.effective_start_date
7221 AND value2.effective_end_date;
7222 --
7223 CURSOR csr_get_insurace_values(p_element_link_id NUMBER)
7224 IS
7225 SELECT entries.element_entry_id entry_id
7226 , value1.screen_entry_value Premium_Paid
7227 , value2.screen_entry_value Sum_Assured
7228 , value3.screen_entry_value Policy_Number
7229 , value4.screen_entry_value Policy_Start_Date
7230 FROM per_assignments_f assgn
7231 , pay_element_links_f link
7232 , pay_element_types_f types
7233 , pay_element_entries_f entries
7234 , pay_element_entry_values_f value1
7235 , pay_input_values_f inputs1
7236 , pay_element_entry_values_f value2
7237 , pay_input_values_f inputs2
7238 , pay_element_entry_values_f value3
7239 , pay_input_values_f inputs3
7240 , pay_element_entry_values_f value4
7241 , pay_input_values_f inputs4
7242 WHERE assgn.assignment_id = p_assignment_id
7243 AND link.element_link_id = p_element_link_id
7244 AND (types.processing_type = 'R' OR assgn.payroll_id IS NOT NULL)
7245 AND link.business_group_id = assgn.business_group_id
7246 AND link.element_type_id = types.element_type_id
7247 AND types.element_name = 'Life Insurance Premium'
7248 AND entries.element_type_id = types.element_type_id
7249 AND entries.element_link_id = link.element_link_id
7250 AND entries.assignment_id = assgn.assignment_id
7251 AND value1.element_entry_id = entries.element_entry_id
7252 AND inputs1.input_value_id = value1.input_value_id
7253 AND inputs1.element_type_id = types.element_type_id
7254 AND inputs1.name = 'Premium Paid'
7255 AND value2.element_entry_id = entries.element_entry_id
7256 AND inputs2.input_value_id = value2.input_value_id
7257 AND inputs2.element_type_id = types.element_type_id
7258 AND inputs2.name = 'Sum Assured'
7259 AND value3.element_entry_id = entries.element_entry_id
7260 AND inputs3.input_value_id = value3.input_value_id
7261 AND inputs3.element_type_id = types.element_type_id
7262 AND inputs3.name = 'Policy Number'
7263 AND value4.element_entry_id = entries.element_entry_id
7264 AND inputs4.input_value_id = value4.input_value_id
7265 AND inputs4.element_type_id = types.element_type_id
7266 AND inputs4.name = 'Policy Start Date'
7267 AND p_effective_date BETWEEN assgn.effective_start_date
7268 AND assgn.effective_end_date
7269 AND p_effective_date BETWEEN link.effective_start_date
7270 AND link.effective_end_date
7271 AND p_effective_date BETWEEN types.effective_start_date
7272 AND types.effective_end_date
7273 AND p_effective_date BETWEEN entries.effective_start_date
7274 AND entries.effective_end_date
7275 AND p_effective_date BETWEEN inputs1.effective_start_date
7276 AND inputs1.effective_end_date
7277 AND p_effective_date BETWEEN value1.effective_start_date
7278 AND value1.effective_end_date
7279 AND p_effective_date BETWEEN inputs2.effective_start_date
7280 AND inputs2.effective_end_date
7281 AND p_effective_date BETWEEN value2.effective_start_date
7282 AND value2.effective_end_date
7283 AND p_effective_date BETWEEN inputs3.effective_start_date
7284 AND inputs3.effective_end_date
7285 AND p_effective_date BETWEEN value3.effective_start_date
7286 AND value3.effective_end_date
7287 AND p_effective_date BETWEEN inputs4.effective_start_date
7288 AND inputs4.effective_end_date
7289 AND p_effective_date BETWEEN value4.effective_start_date
7290 AND value4.effective_end_date;
7291 --
7292 CURSOR csr_get_80cce_values(p_element_name VARCHAR2
7293 ,p_element_link_id NUMBER
7294 )
7295 IS
7296 SELECT entries.element_entry_id entry_id
7297 , value1.screen_entry_value Investment_Amount
7298 , value2.screen_entry_value Component_Name
7299 FROM per_assignments_f assgn
7300 , pay_element_links_f link
7301 , pay_element_types_f types
7302 , pay_element_entries_f entries
7303 , pay_element_entry_values_f value1
7304 , pay_input_values_f inputs1
7305 , pay_element_entry_values_f value2
7306 , pay_input_values_f inputs2
7307 WHERE assgn.assignment_id = p_assignment_id
7308 AND link.element_link_id = p_element_link_id
7309 AND (types.processing_type = 'R' OR assgn.payroll_id IS NOT NULL)
7310 AND link.business_group_id = assgn.business_group_id
7311 AND link.element_type_id = types.element_type_id
7312 AND types.element_name = p_element_name
7313 AND entries.element_type_id = types.element_type_id
7314 AND entries.element_link_id = link.element_link_id
7315 AND entries.assignment_id = assgn.assignment_id
7316 AND value1.element_entry_id = entries.element_entry_id
7317 AND inputs1.input_value_id = value1.input_value_id
7318 AND inputs1.element_type_id = types.element_type_id
7319 AND inputs1.name = 'Investment Amount'
7320 AND value2.element_entry_id = entries.element_entry_id
7321 AND inputs2.input_value_id = value2.input_value_id
7322 AND inputs2.element_type_id = types.element_type_id
7323 AND inputs2.name = 'Component Name'
7324 AND p_effective_date BETWEEN assgn.effective_start_date
7325 AND assgn.effective_end_date
7326 AND p_effective_date BETWEEN link.effective_start_date
7327 AND link.effective_end_date
7328 AND p_effective_date BETWEEN types.effective_start_date
7329 AND types.effective_end_date
7330 AND p_effective_date BETWEEN entries.effective_start_date
7331 AND entries.effective_end_date
7332 AND p_effective_date BETWEEN inputs1.effective_start_date
7333 AND inputs1.effective_end_date
7334 AND p_effective_date BETWEEN value1.effective_start_date
7335 AND value1.effective_end_date
7336 AND p_effective_date BETWEEN inputs2.effective_start_date
7337 AND inputs2.effective_end_date
7338 AND p_effective_date BETWEEN value2.effective_start_date
7339 AND value2.effective_end_date;
7340 --
7341 --Added as a part of bug fix 4774108
7342 CURSOR csr_element_type_id(p_element_name VARCHAR2)
7343 IS
7344 SELECT element_type_id
7345 FROM pay_element_types_f
7346 WHERE legislation_code = 'IN'
7347 AND element_name = p_element_name
7348 AND p_effective_date BETWEEN effective_start_date AND effective_end_date;
7349
7350 l_element_type_id NUMBER; --Added as a part of bug fix 4774108
7351 l_element_link_id NUMBER; --Added as a part of bug fix 4774108
7352 l_element_name pay_element_types_f.element_name%TYPE;--Added as a part of bug fix 4774108
7353 l_procedure VARCHAR(100);
7354 l_message VARCHAR2(250);
7355 BEGIN
7356 --
7357 l_procedure := g_package || 'get_value';
7358 pay_in_utils.set_location(g_debug,'Entering: '||l_procedure,10);
7359
7360
7361 IF g_debug THEN
7362 pay_in_utils.trace('**************************************************','********************');
7363 pay_in_utils.trace('p_assignment_id',p_assignment_id);
7364 pay_in_utils.trace('p_index',p_index);
7365 pay_in_utils.trace('p_element_name',p_element_name);
7366 pay_in_utils.trace('p_input_name',p_input_name);
7367 pay_in_utils.trace('p_effective_date',p_effective_date);
7368 pay_in_utils.trace('**************************************************','********************');
7369 END IF;
7370
7371
7372 IF g_index_assignment_id <> p_assignment_id THEN
7373 --
7374 pay_in_utils.set_location(g_debug, l_procedure, 20);
7375 g_index_values_valid := false;
7376 --
7377 END IF;
7378 --
7379 IF NOT g_index_values_valid THEN
7380 --
7381 -- Put the details in the appropriate table available
7382 -- for each of the elements.
7383 --
7384 g_80dd_values.DELETE;
7385 g_80g_values.DELETE;
7386 g_insurace_values.DELETE;
7387 g_80cce_values.DELETE;
7388 g_80dd_index := 0;
7389 g_80g_index := 0;
7390 g_insurace_index := 0;
7391 g_80cce_index := 0;
7392 pay_in_utils.set_location(g_debug, l_procedure, 30);
7393 --
7394 --Added as a part of bug fix 4774108
7395 OPEN csr_element_type_id('Deduction under Section 80DD');
7396 FETCH csr_element_type_id INTO l_element_type_id;
7397 CLOSE csr_element_type_id;
7398
7399 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
7400 ,p_effective_date
7401 ,l_element_type_id
7402 );
7403
7404 FOR rec IN csr_get_80dd_values(l_element_link_id) LOOP
7405 --
7406 pay_in_utils.set_location(g_debug, l_procedure, 40);
7407 g_80dd_values(g_80dd_index).entry_id := rec.entry_id;
7408 g_80dd_values(g_80dd_index).input1_value := rec.disability_type;
7409 g_80dd_values(g_80dd_index).input2_value := rec.treatment_amount;
7410 g_80dd_values(g_80dd_index).input3_value := rec.disability_percentage;
7411 g_80dd_index := g_80dd_index + 1;
7412 --
7413 END LOOP;
7414 --
7415 --Added as a part of bug fix 4774108
7416 OPEN csr_element_type_id('Deduction under Section 80G');
7417 FETCH csr_element_type_id INTO l_element_type_id;
7418 CLOSE csr_element_type_id;
7419
7420 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
7421 ,p_effective_date
7422 ,l_element_type_id
7423 );
7424
7425 FOR rec IN csr_get_80g_values(l_element_link_id)LOOP
7426 --
7427 pay_in_utils.set_location(g_debug, l_procedure, 50);
7428 g_80g_values(g_80g_index).entry_id := rec.entry_id;
7429 g_80g_values(g_80g_index).input1_value := rec.donation_type;
7430 g_80g_values(g_80g_index).input2_value := rec.donation_amount;
7431 g_80g_index := g_80g_index + 1;
7432 --
7433 END LOOP;
7434 --Added as a part of bug fix 4774108
7435 OPEN csr_element_type_id('Life Insurance Premium');
7436 FETCH csr_element_type_id INTO l_element_type_id;
7437 CLOSE csr_element_type_id;
7438
7439 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
7440 ,p_effective_date
7441 ,l_element_type_id
7442 );
7443
7444 FOR rec IN csr_get_insurace_values(l_element_link_id) LOOP
7445 --
7446 pay_in_utils.set_location(g_debug, l_procedure, 60);
7447 g_insurace_values(g_insurace_index).entry_id := rec.entry_id;
7448 g_insurace_values(g_insurace_index).input1_value := rec.premium_paid;
7449 g_insurace_values(g_insurace_index).input2_value := rec.sum_assured;
7450 g_insurace_values(g_insurace_index).input3_value := rec.policy_number;
7451 g_insurace_values(g_insurace_index).input4_value := to_char(fnd_date.canonical_to_date(rec.policy_start_date),'MM/DD/YYYY');
7452 g_insurace_index := g_insurace_index + 1;
7453 --
7454 END LOOP;
7455 --
7456 FOR i IN 1..4
7457 LOOP
7458 IF (i = 1) THEN
7459 l_element_name := 'Deduction under Section 80CCE';
7460 ELSIF (i = 2) THEN
7461 l_element_name := 'Pension Fund 80CCC';
7462 ELSIF (i = 3) THEN
7463 l_element_name := 'Deferred Annuity';
7464 ELSE
7465 l_element_name := 'Senior Citizens Savings Scheme';
7466 END IF;
7467
7468 --Added as a part of bug fix 4774108
7469 OPEN csr_element_type_id(l_element_name);
7470 FETCH csr_element_type_id INTO l_element_type_id;
7471 CLOSE csr_element_type_id;
7472
7473 l_element_link_id := pay_in_utils.get_element_link_id(p_assignment_id
7474 ,p_effective_date
7475 ,l_element_type_id
7476 );
7477
7478 FOR rec IN csr_get_80cce_values(l_element_name,l_element_link_id) LOOP
7479 --
7480 pay_in_utils.set_location(g_debug, l_procedure, 70);
7481 g_80cce_values(g_80cce_index).entry_id := rec.entry_id;
7482 g_80cce_values(g_80cce_index).input1_value := rec.Investment_Amount;
7483 g_80cce_values(g_80cce_index).input2_value := rec.Component_Name;
7484 g_80cce_index := g_80cce_index + 1;
7485 --
7486 END LOOP;
7487 END LOOP;
7488 --
7489 pay_in_utils.set_location(g_debug, l_procedure, 70);
7490 g_index_values_valid := true;
7491 g_index_assignment_id := p_assignment_id;
7492 --
7493 END IF;
7494 --
7495 IF p_element_name = 'Deduction under Section 80DD' THEN
7496 --
7497 pay_in_utils.set_location(g_debug, l_procedure, 80);
7498 IF p_index <= g_80dd_index AND g_80dd_values.exists(p_index-1) THEN
7499 --
7500 pay_in_utils.set_location(g_debug, l_procedure, 90);
7501 IF p_input_name = 'Disability Type' THEN
7502 pay_in_utils.set_location(g_debug, l_procedure, 100);
7503 IF g_debug THEN
7504 pay_in_utils.trace('**************************************************','********************');
7505 pay_in_utils.trace('Disablity Type',g_80dd_values(p_index-1).input1_value);
7506 pay_in_utils.trace('**************************************************','********************');
7507 END IF;
7508 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,110);
7509 RETURN g_80dd_values(p_index-1).input1_value;
7510
7511 ELSIF p_input_name = 'Treatment Amount' THEN
7512 IF g_debug THEN
7513 pay_in_utils.trace('**************************************************','********************');
7514 pay_in_utils.trace('Treatment Amount',g_80dd_values(p_index-1).input2_value);
7515 pay_in_utils.trace('**************************************************','********************');
7516 END IF;
7517 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,120);
7518 RETURN g_80dd_values(p_index-1).input2_value;
7519
7520 ELSIF p_input_name = 'Disability Percentage' THEN
7521 IF g_debug THEN
7522 pay_in_utils.trace('**************************************************','********************');
7523 pay_in_utils.trace('Disability Percentage',g_80dd_values(p_index-1).input3_value);
7524 pay_in_utils.trace('**************************************************','********************');
7525 END IF;
7526 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,130);
7527 pay_in_utils.set_location(g_debug, l_procedure, 120);
7528 RETURN g_80dd_values(p_index-1).input3_value;
7529
7530 ELSIF p_input_name = 'Element Entry Id' THEN
7531 IF g_debug THEN
7532 pay_in_utils.trace('**************************************************','********************');
7533 pay_in_utils.trace('Element ',g_80dd_values(p_index-1).entry_id);
7534 pay_in_utils.trace('**************************************************','********************');
7535 END IF;
7536 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,130);
7537 return g_80dd_values(p_index-1).entry_id;
7538 ELSE
7539 return NULL;
7540 END IF;
7541 ELSE
7542 pay_in_utils.set_location(g_debug, l_procedure, 130);
7543 return NULL;
7544 END IF;
7545
7546 ELSIF p_element_name = 'Deduction under Section 80G' THEN
7547 --
7548 pay_in_utils.set_location(g_debug, l_procedure, 140);
7549 IF p_index <= g_80g_index AND g_80g_values.exists(p_index-1) THEN
7550 --
7551 IF p_input_name = 'Donation Type' THEN
7552 IF g_debug THEN
7553 pay_in_utils.trace('**************************************************','********************');
7554 pay_in_utils.trace('Donation Type',g_80g_values(p_index-1).input1_value);
7555 pay_in_utils.trace('**************************************************','********************');
7556 END IF;
7557 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,140);
7558 return g_80g_values(p_index-1).input1_value;
7559
7560 ELSIF p_input_name = 'Donation Amount' THEN
7561 IF g_debug THEN
7562 pay_in_utils.trace('**************************************************','********************');
7563 pay_in_utils.trace('Donation Amount',g_80g_values(p_index-1).input2_value);
7564 pay_in_utils.trace('**************************************************','********************');
7565 END IF;
7566 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,150);
7567 return g_80g_values(p_index-1).input2_value;
7568
7569 ELSIF p_input_name = 'Element Entry Id' THEN
7570 IF g_debug THEN
7571 pay_in_utils.trace('**************************************************','********************');
7572 pay_in_utils.trace('Element Entry',g_80g_values(p_index-1).entry_id);
7573 pay_in_utils.trace('**************************************************','********************');
7574 END IF;
7575 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,160);
7576 return g_80g_values(p_index-1).entry_id;
7577 END IF;
7578
7579 ELSE
7580 pay_in_utils.set_location(g_debug, l_procedure, 180);
7581 return NULL;
7582 END IF;
7583 ELSIF p_element_name = 'Life Insurance Premium' THEN
7584 --
7585 pay_in_utils.set_location(g_debug, l_procedure, 190);
7586 IF p_index <= g_insurace_index AND g_insurace_values.exists(p_index-1) THEN
7587 --
7588 IF p_input_name = 'Premium Paid' THEN
7589 IF g_debug THEN
7590 pay_in_utils.trace('**************************************************','********************');
7591 pay_in_utils.trace('Premium Amount',g_insurace_values(p_index-1).input1_value);
7592 pay_in_utils.trace('**************************************************','********************');
7593 END IF;
7594 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,170);
7595 return g_insurace_values(p_index-1).input1_value;
7596
7597 ELSIF p_input_name = 'Sum Assured' THEN
7598 IF g_debug THEN
7599 pay_in_utils.trace('**************************************************','********************');
7600 pay_in_utils.trace('Sum Assured',g_insurace_values(p_index-1).input2_value);
7601 pay_in_utils.trace('**************************************************','********************');
7602 END IF;
7603 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,180);
7604 return g_insurace_values(p_index-1).input2_value;
7605
7606 ELSIF p_input_name = 'Policy Number' THEN
7607 IF g_debug THEN
7608 pay_in_utils.trace('**************************************************','********************');
7609 pay_in_utils.trace('Policy Number',g_insurace_values(p_index-1).input3_value);
7610 pay_in_utils.trace('**************************************************','********************');
7611 END IF;
7612 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,185);
7613 return g_insurace_values(p_index-1).input3_value;
7614
7615 ELSIF p_input_name = 'Policy Start Date' THEN
7616 IF g_debug THEN
7617 pay_in_utils.trace('**************************************************','********************');
7618 pay_in_utils.trace('Policy Start Date',g_insurace_values(p_index-1).input4_value);
7619 pay_in_utils.trace('**************************************************','********************');
7620 END IF;
7621 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,187);
7622 return g_insurace_values(p_index-1).input4_value;
7623
7624
7625 ELSIF p_input_name = 'Element Entry Id' THEN
7626 IF g_debug THEN
7627 pay_in_utils.trace('**************************************************','********************');
7628 pay_in_utils.trace('Element ',g_insurace_values(p_index-1).entry_id);
7629 pay_in_utils.trace('**************************************************','********************');
7630 END IF;
7631 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,190);
7632 return g_insurace_values(p_index-1).entry_id;
7633 END IF;
7634
7635 ELSE
7636 pay_in_utils.set_location(g_debug, l_procedure, 230);
7637 return NULL;
7638 END IF;
7639 ELSIF p_element_name = 'Deduction under Section 80CCE' THEN
7640 --
7641 pay_in_utils.set_location(g_debug, l_procedure, 240);
7642 IF p_index <= g_80cce_index AND g_80cce_values.exists(p_index-1) THEN
7643 --
7644 IF p_input_name = 'Investment Amount' THEN
7645 IF g_debug THEN
7646 pay_in_utils.trace('**************************************************','********************');
7647 pay_in_utils.trace('Investment Amount',g_80cce_values(p_index-1).input1_value);
7648 pay_in_utils.trace('**************************************************','********************');
7649 END IF;
7650 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,200);
7651 return g_80cce_values(p_index-1).input1_value;
7652
7653 ELSIF p_input_name = 'Component Name' THEN
7654 IF g_debug THEN
7655 pay_in_utils.trace('**************************************************','********************');
7656 pay_in_utils.trace('Component Name',g_80cce_values(p_index-1).input2_value);
7657 pay_in_utils.trace('**************************************************','********************');
7658 END IF;
7659 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,210);
7660 return g_80cce_values(p_index-1).input2_value;
7661
7662 ELSIF p_input_name = 'Element Entry Id' THEN
7663 IF g_debug THEN
7664 pay_in_utils.trace('**************************************************','********************');
7665 pay_in_utils.trace('Element',g_80cce_values(p_index-1).entry_id);
7666 pay_in_utils.trace('**************************************************','********************');
7667 END IF;
7668 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,220);
7669 pay_in_utils.set_location(g_debug, l_procedure, 270);
7670 return g_80cce_values(p_index-1).entry_id;
7671 END IF;
7672 ELSE
7673 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,230);
7674 return NULL;
7675 END IF;
7676 ELSE
7677 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,240);
7678 return null;
7679 END IF;
7680 --
7681 -- As per logic should not come here at all.
7682 return null;
7683 pay_in_utils.set_location(g_debug,'Leaving: '||l_procedure,250);
7684
7685 END get_value;
7686 -- End changes to Enhancement 3886086(Web ADI)
7687
7688
7689
7690 BEGIN
7691 --
7692 -- Global variable Initialization
7693 --
7694 g_legislation_code := 'IN';
7695 g_approval_info_type := 'PER_IN_TAX_DECL_DETAILS';
7696 g_is_valid := false;
7697
7698 -- Following lines added for Web ADI Support
7699 g_index_values_valid := false;
7700 g_index_assignment_id := 0;
7701 g_80dd_index := 0;
7702 g_80g_index := 0;
7703 g_insurace_index := 0;
7704 g_80cce_index := 0;
7705
7706
7707 END pay_in_tax_declaration;