48: 2377480 Legal Entity fetch per
49: assignment and not per
50: organization
51: J.N. Louw 28/02/2002 115.8 Added
52: hr_utility calls
53: Removed
54: record creation for
55: assignment with no
56: balance values
116: AS
117: -------------------------------------------------------------------------------
118: BEGIN -- MAIN --
119: -------------------------------------------------------------------------------
120: hr_utility.set_location('py_za_tax_reg.zvl',1);
121:
122: IF p_val IS NOT NULL THEN
123: IF p_val = 0 THEN
124: p_val := NULL;
124: p_val := NULL;
125: END IF;
126: END IF;
127:
128: hr_utility.set_location('py_za_tax_reg.zvl',2);
129:
130: EXCEPTION
131: WHEN OTHERS THEN
132: hr_utility.set_location('py_za_tax_reg.zvl',3);
128: hr_utility.set_location('py_za_tax_reg.zvl',2);
129:
130: EXCEPTION
131: WHEN OTHERS THEN
132: hr_utility.set_location('py_za_tax_reg.zvl',3);
133: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
134: hr_utility.raise_error;
135: -------------------------------------------------------------------------------
136: END zvl;
129:
130: EXCEPTION
131: WHEN OTHERS THEN
132: hr_utility.set_location('py_za_tax_reg.zvl',3);
133: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
134: hr_utility.raise_error;
135: -------------------------------------------------------------------------------
136: END zvl;
137:
130: EXCEPTION
131: WHEN OTHERS THEN
132: hr_utility.set_location('py_za_tax_reg.zvl',3);
133: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
134: hr_utility.raise_error;
135: -------------------------------------------------------------------------------
136: END zvl;
137:
138: -------------------------------------------------------------------------------
153: ------------
154: -------------------------------------------------------------------------------
155: BEGIN -- MAIN --
156: -------------------------------------------------------------------------------
157: hr_utility.set_location('py_za_tax_reg.valid_record',1);
158:
159: IF nvl(
160: to_char(
161: nvl(
167: )
168: , l_check_val
169: ) <> l_check_val
170: THEN
171: hr_utility.set_location('py_za_tax_reg.valid_record',2);
172: l_ret_val := TRUE;
173: END IF;
174:
175: hr_utility.set_location('py_za_tax_reg.valid_record',3);
171: hr_utility.set_location('py_za_tax_reg.valid_record',2);
172: l_ret_val := TRUE;
173: END IF;
174:
175: hr_utility.set_location('py_za_tax_reg.valid_record',3);
176: RETURN l_ret_val;
177:
178: EXCEPTION
179: WHEN OTHERS THEN
176: RETURN l_ret_val;
177:
178: EXCEPTION
179: WHEN OTHERS THEN
180: hr_utility.set_location('py_za_tax_reg.valid_record',4);
181: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
182: hr_utility.raise_error;
183: -------------------------------------------------------------------------------
184: END valid_record;
177:
178: EXCEPTION
179: WHEN OTHERS THEN
180: hr_utility.set_location('py_za_tax_reg.valid_record',4);
181: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
182: hr_utility.raise_error;
183: -------------------------------------------------------------------------------
184: END valid_record;
185:
178: EXCEPTION
179: WHEN OTHERS THEN
180: hr_utility.set_location('py_za_tax_reg.valid_record',4);
181: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
182: hr_utility.raise_error;
183: -------------------------------------------------------------------------------
184: END valid_record;
185:
186: -------------------------------------------------------------------------------
214:
215: -------------------------------------------------------------------------------
216: BEGIN -- MAIN --
217: -------------------------------------------------------------------------------
218: hr_utility.set_location('py_za_tax_reg.balance_id',1);
219:
220: OPEN csr_balance_id(p_balance_name);
221: FETCH csr_balance_id INTO l_retval;
222: CLOSE csr_balance_id;
220: OPEN csr_balance_id(p_balance_name);
221: FETCH csr_balance_id INTO l_retval;
222: CLOSE csr_balance_id;
223:
224: hr_utility.set_location('py_za_tax_reg.balance_id',2);
225: RETURN l_retval;
226:
227: EXCEPTION
228: WHEN OTHERS THEN
225: RETURN l_retval;
226:
227: EXCEPTION
228: WHEN OTHERS THEN
229: hr_utility.set_location('py_za_tax_reg.balance_id',3);
230: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
231: hr_utility.raise_error;
232: -------------------------------------------------------------------------------
233: END balance_id;
226:
227: EXCEPTION
228: WHEN OTHERS THEN
229: hr_utility.set_location('py_za_tax_reg.balance_id',3);
230: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
231: hr_utility.raise_error;
232: -------------------------------------------------------------------------------
233: END balance_id;
234:
227: EXCEPTION
228: WHEN OTHERS THEN
229: hr_utility.set_location('py_za_tax_reg.balance_id',3);
230: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
231: hr_utility.raise_error;
232: -------------------------------------------------------------------------------
233: END balance_id;
234:
235: -------------------------------------------------------------------------------
250: --
251: -------------------------------------------------------------------------------
252: BEGIN -- MAIN --
253: -------------------------------------------------------------------------------
254: hr_utility.set_location('py_za_tax_reg.ptd_value',1);
255: -- Check if the PTD value must be retrieved
256: --
257: IF g_retrieve_ptd THEN
258: hr_utility.set_location('py_za_tax_reg.ptd_value',2);
254: hr_utility.set_location('py_za_tax_reg.ptd_value',1);
255: -- Check if the PTD value must be retrieved
256: --
257: IF g_retrieve_ptd THEN
258: hr_utility.set_location('py_za_tax_reg.ptd_value',2);
259: -- PTD value of Site and Paye Amount not necessary
260: --
261: IF UPPER(p_balance_name) NOT IN ('SITE','PAYE') THEN
262: hr_utility.set_location('py_za_tax_reg.ptd_value',3);
258: hr_utility.set_location('py_za_tax_reg.ptd_value',2);
259: -- PTD value of Site and Paye Amount not necessary
260: --
261: IF UPPER(p_balance_name) NOT IN ('SITE','PAYE') THEN
262: hr_utility.set_location('py_za_tax_reg.ptd_value',3);
263: -- Is the assignment's action in the current period
264: --
265: IF g_end_period_id = p_action_period_id THEN
266: hr_utility.set_location('py_za_tax_reg.ptd_value',4);
262: hr_utility.set_location('py_za_tax_reg.ptd_value',3);
263: -- Is the assignment's action in the current period
264: --
265: IF g_end_period_id = p_action_period_id THEN
266: hr_utility.set_location('py_za_tax_reg.ptd_value',4);
267: -- Retrieve the value
268: --3491357
269: /*l_ptd_value := py_za_bal.calc_asg_tax_ptd_action (
270: p_asg_action_id
278: );
279: END IF;
280: END IF;
281: END IF;
282: hr_utility.set_location('py_za_tax_reg.ptd_value',5);
283: zvl(l_ptd_value);
284: hr_utility.set_location('py_za_tax_reg.ptd_value',6);
285: -- Return
286: RETURN l_ptd_value;
280: END IF;
281: END IF;
282: hr_utility.set_location('py_za_tax_reg.ptd_value',5);
283: zvl(l_ptd_value);
284: hr_utility.set_location('py_za_tax_reg.ptd_value',6);
285: -- Return
286: RETURN l_ptd_value;
287:
288: EXCEPTION
286: RETURN l_ptd_value;
287:
288: EXCEPTION
289: WHEN OTHERS THEN
290: hr_utility.set_location('py_za_tax_reg.ptd_value',7);
291: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
292: hr_utility.raise_error;
293: -------------------------------------------------------------------------------
294: END ptd_value;
287:
288: EXCEPTION
289: WHEN OTHERS THEN
290: hr_utility.set_location('py_za_tax_reg.ptd_value',7);
291: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
292: hr_utility.raise_error;
293: -------------------------------------------------------------------------------
294: END ptd_value;
295:
288: EXCEPTION
289: WHEN OTHERS THEN
290: hr_utility.set_location('py_za_tax_reg.ptd_value',7);
291: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
292: hr_utility.raise_error;
293: -------------------------------------------------------------------------------
294: END ptd_value;
295:
296: -------------------------------------------------------------------------------
310: --
311: -------------------------------------------------------------------------------
312: BEGIN -- MAIN --
313: -------------------------------------------------------------------------------
314: hr_utility.set_location('py_za_tax_reg.mtd_value',1);
315: -- Check if the MTD value must be retrieved
316: --
317: IF g_retrieve_mtd THEN
318: hr_utility.set_location('py_za_tax_reg.mtd_value',2);
314: hr_utility.set_location('py_za_tax_reg.mtd_value',1);
315: -- Check if the MTD value must be retrieved
316: --
317: IF g_retrieve_mtd THEN
318: hr_utility.set_location('py_za_tax_reg.mtd_value',2);
319: -- PTD value of Site and Paye Amount not necessary
320: --
321: IF UPPER(p_balance_name) NOT IN ('SITE','PAYE') THEN
322: hr_utility.set_location('py_za_tax_reg.mtd_value',3);
318: hr_utility.set_location('py_za_tax_reg.mtd_value',2);
319: -- PTD value of Site and Paye Amount not necessary
320: --
321: IF UPPER(p_balance_name) NOT IN ('SITE','PAYE') THEN
322: hr_utility.set_location('py_za_tax_reg.mtd_value',3);
323: -- Is the effective date of the action in the current period
324: --
325: IF p_effective_date between g_period_start_date
326: and g_period_end_date
324: --
325: IF p_effective_date between g_period_start_date
326: and g_period_end_date
327: THEN
328: hr_utility.set_location('py_za_tax_reg.mtd_value',4);
329: -- Retrieve the value
330: --3491357
331: /*l_mtd_value := py_za_bal.calc_asg_tax_mtd_action (
332: p_asg_action_id
340: );
341: END IF;
342: END IF;
343: END IF;
344: hr_utility.set_location('py_za_tax_reg.mtd_value',5);
345: zvl(l_mtd_value);
346: hr_utility.set_location('py_za_tax_reg.mtd_value',6);
347: -- Return
348: RETURN l_mtd_value;
342: END IF;
343: END IF;
344: hr_utility.set_location('py_za_tax_reg.mtd_value',5);
345: zvl(l_mtd_value);
346: hr_utility.set_location('py_za_tax_reg.mtd_value',6);
347: -- Return
348: RETURN l_mtd_value;
349:
350: EXCEPTION
348: RETURN l_mtd_value;
349:
350: EXCEPTION
351: WHEN OTHERS THEN
352: hr_utility.set_location('py_za_tax_reg.mtd_value',7);
353: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
354: hr_utility.raise_error;
355: -------------------------------------------------------------------------------
356: END mtd_value;
349:
350: EXCEPTION
351: WHEN OTHERS THEN
352: hr_utility.set_location('py_za_tax_reg.mtd_value',7);
353: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
354: hr_utility.raise_error;
355: -------------------------------------------------------------------------------
356: END mtd_value;
357:
350: EXCEPTION
351: WHEN OTHERS THEN
352: hr_utility.set_location('py_za_tax_reg.mtd_value',7);
353: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
354: hr_utility.raise_error;
355: -------------------------------------------------------------------------------
356: END mtd_value;
357:
358: -------------------------------------------------------------------------------
371: --
372: -------------------------------------------------------------------------------
373: BEGIN -- MAIN --
374: -------------------------------------------------------------------------------
375: hr_utility.set_location('py_za_tax_reg.ytd_value',1);
376: -- Check if the YTD value must be retrieved
377: --
378: IF g_retrieve_ytd THEN
379: hr_utility.set_location('py_za_tax_reg.ytd_value',2);
375: hr_utility.set_location('py_za_tax_reg.ytd_value',1);
376: -- Check if the YTD value must be retrieved
377: --
378: IF g_retrieve_ytd THEN
379: hr_utility.set_location('py_za_tax_reg.ytd_value',2);
380: -- Retrieve the value
381: --3491357
382: /*l_ytd_value := py_za_bal.calc_asg_tax_ytd_action (
383: p_asg_action_id
389: , p_balance_type_id
390: , '_ASG_TAX_YTD'
391: );
392: END IF;
393: hr_utility.set_location('py_za_tax_reg.ytd_value',3);
394: zvl(l_ytd_value);
395: hr_utility.set_location('py_za_tax_reg.ytd_value',4);
396: -- Return
397: RETURN l_ytd_value;
391: );
392: END IF;
393: hr_utility.set_location('py_za_tax_reg.ytd_value',3);
394: zvl(l_ytd_value);
395: hr_utility.set_location('py_za_tax_reg.ytd_value',4);
396: -- Return
397: RETURN l_ytd_value;
398:
399: EXCEPTION
397: RETURN l_ytd_value;
398:
399: EXCEPTION
400: WHEN OTHERS THEN
401: hr_utility.set_location('py_za_tax_reg.ytd_value',5);
402: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
403: hr_utility.raise_error;
404: -------------------------------------------------------------------------------
405: END ytd_value;
398:
399: EXCEPTION
400: WHEN OTHERS THEN
401: hr_utility.set_location('py_za_tax_reg.ytd_value',5);
402: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
403: hr_utility.raise_error;
404: -------------------------------------------------------------------------------
405: END ytd_value;
406:
399: EXCEPTION
400: WHEN OTHERS THEN
401: hr_utility.set_location('py_za_tax_reg.ytd_value',5);
402: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
403: hr_utility.raise_error;
404: -------------------------------------------------------------------------------
405: END ytd_value;
406:
407: -------------------------------------------------------------------------------
461: l_result_value csr_result_value%ROWTYPE;
462: -------------------------------------------------------------------------------
463: BEGIN -- MAIN --
464: -------------------------------------------------------------------------------
465: hr_utility.set_location('py_za_tax_reg.run_result_value',1);
466: OPEN csr_result_value;
467: FETCH csr_result_value INTO l_result_value;
468: CLOSE csr_result_value;
469: --
466: OPEN csr_result_value;
467: FETCH csr_result_value INTO l_result_value;
468: CLOSE csr_result_value;
469: --
470: hr_utility.set_location('py_za_tax_reg.run_result_value',2);
471: p_run_result_id := l_result_value.run_result_id;
472: RETURN l_result_value.result_value;
473: --
474: EXCEPTION
472: RETURN l_result_value.result_value;
473: --
474: EXCEPTION
475: WHEN OTHERS THEN
476: hr_utility.set_location('py_za_tax_reg.run_result_value',3);
477: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
478: hr_utility.raise_error;
479: -------------------------------------------------------------------------------
480: END run_result_value;
473: --
474: EXCEPTION
475: WHEN OTHERS THEN
476: hr_utility.set_location('py_za_tax_reg.run_result_value',3);
477: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
478: hr_utility.raise_error;
479: -------------------------------------------------------------------------------
480: END run_result_value;
481:
474: EXCEPTION
475: WHEN OTHERS THEN
476: hr_utility.set_location('py_za_tax_reg.run_result_value',3);
477: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
478: hr_utility.raise_error;
479: -------------------------------------------------------------------------------
480: END run_result_value;
481:
482: -------------------------------------------------------------------------------
513: l_result_value csr_result_value%ROWTYPE;
514: -------------------------------------------------------------------------------
515: BEGIN -- MAIN --
516: -------------------------------------------------------------------------------
517: hr_utility.set_location('py_za_tax_reg.run_result_value',4);
518: OPEN csr_result_value;
519: FETCH csr_result_value INTO l_result_value;
520: CLOSE csr_result_value;
521: --
518: OPEN csr_result_value;
519: FETCH csr_result_value INTO l_result_value;
520: CLOSE csr_result_value;
521: --
522: hr_utility.set_location('py_za_tax_reg.run_result_value',5);
523: RETURN l_result_value.result_value;
524: --
525: EXCEPTION
526: WHEN OTHERS THEN
523: RETURN l_result_value.result_value;
524: --
525: EXCEPTION
526: WHEN OTHERS THEN
527: hr_utility.set_location('py_za_tax_reg.run_result_value',6);
528: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
529: hr_utility.raise_error;
530: -------------------------------------------------------------------------------
531: END run_result_value;
524: --
525: EXCEPTION
526: WHEN OTHERS THEN
527: hr_utility.set_location('py_za_tax_reg.run_result_value',6);
528: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
529: hr_utility.raise_error;
530: -------------------------------------------------------------------------------
531: END run_result_value;
532:
525: EXCEPTION
526: WHEN OTHERS THEN
527: hr_utility.set_location('py_za_tax_reg.run_result_value',6);
528: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
529: hr_utility.raise_error;
530: -------------------------------------------------------------------------------
531: END run_result_value;
532:
533: -------------------------------------------------------------------------------
557: --
558: -------------------------------------------------------------------------------
559: BEGIN -- MAIN --
560: -------------------------------------------------------------------------------
561: hr_utility.set_location('py_za_tax_reg.decode_lookup_code',1);
562: OPEN csr_lookup_meaning;
563: FETCH csr_lookup_meaning INTO l_meaning;
564: CLOSE csr_lookup_meaning;
565:
562: OPEN csr_lookup_meaning;
563: FETCH csr_lookup_meaning INTO l_meaning;
564: CLOSE csr_lookup_meaning;
565:
566: hr_utility.set_location('py_za_tax_reg.decode_lookup_code',2);
567: RETURN l_meaning;
568:
569: EXCEPTION
570: WHEN OTHERS THEN
567: RETURN l_meaning;
568:
569: EXCEPTION
570: WHEN OTHERS THEN
571: hr_utility.set_location('py_za_tax_reg.decode_lookup_code',3);
572: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
573: hr_utility.raise_error;
574: -------------------------------------------------------------------------------
575: END decode_lookup_code;
568:
569: EXCEPTION
570: WHEN OTHERS THEN
571: hr_utility.set_location('py_za_tax_reg.decode_lookup_code',3);
572: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
573: hr_utility.raise_error;
574: -------------------------------------------------------------------------------
575: END decode_lookup_code;
576:
569: EXCEPTION
570: WHEN OTHERS THEN
571: hr_utility.set_location('py_za_tax_reg.decode_lookup_code',3);
572: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
573: hr_utility.raise_error;
574: -------------------------------------------------------------------------------
575: END decode_lookup_code;
576:
577: -------------------------------------------------------------------------------
594:
595: -------------------------------------------------------------------------------
596: BEGIN -- MAIN --
597: -------------------------------------------------------------------------------
598: hr_utility.set_location('py_za_tax_reg.assignment_tax_sta_dir',1);
599: --
600: l_tax_status := run_result_value (
601: p_element_name => 'ZA_Tax'
602: , p_value_name => 'Tax Status'
605: );
606: --
607: l_asg_tax_status_code := l_tax_status;
608: --
609: hr_utility.set_location('py_za_tax_reg.assignment_tax_sta_dir',2);
610: --
611: l_tax_status := decode_lookup_code (
612: p_lookup_type => 'ZA_TAX_STATUS'
613: , p_lookup_code => l_tax_status
613: , p_lookup_code => l_tax_status
614: , p_application_id => 800
615: );
616: --
617: hr_utility.set_location('py_za_tax_reg.assignment_tax_sta_dir',3);
618: --
619: IF l_run_result_id IS NOT NULL THEN
620: hr_utility.set_location('py_za_tax_reg.assignment_tax_sta_dir',4);
621: -- Find the directive value for the same result id
616: --
617: hr_utility.set_location('py_za_tax_reg.assignment_tax_sta_dir',3);
618: --
619: IF l_run_result_id IS NOT NULL THEN
620: hr_utility.set_location('py_za_tax_reg.assignment_tax_sta_dir',4);
621: -- Find the directive value for the same result id
622: l_dir_value := run_result_value (
623: p_value_name => 'Tax Directive Value'
624: , p_run_result_id => l_run_result_id
624: , p_run_result_id => l_run_result_id
625: );
626: END IF;
627: --
628: hr_utility.set_location('py_za_tax_reg.assignment_tax_sta_dir',5);
629: --
630: p_asg_tax_status := l_tax_status;
631: p_asg_dir_value := l_dir_value;
632: p_asg_tax_status_code := l_asg_tax_status_code;
633:
634:
635: EXCEPTION
636: WHEN OTHERS THEN
637: hr_utility.set_location('py_za_tax_reg.assignment_tax_sta_dir',6);
638: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
639: hr_utility.raise_error;
640: -------------------------------------------------------------------------------
641: END assignment_tax_sta_dir;
634:
635: EXCEPTION
636: WHEN OTHERS THEN
637: hr_utility.set_location('py_za_tax_reg.assignment_tax_sta_dir',6);
638: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
639: hr_utility.raise_error;
640: -------------------------------------------------------------------------------
641: END assignment_tax_sta_dir;
642:
635: EXCEPTION
636: WHEN OTHERS THEN
637: hr_utility.set_location('py_za_tax_reg.assignment_tax_sta_dir',6);
638: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
639: hr_utility.raise_error;
640: -------------------------------------------------------------------------------
641: END assignment_tax_sta_dir;
642:
643: -------------------------------------------------------------------------------
686:
687: -------------------------------------------------------------------------------
688: BEGIN -- MAIN --
689: -------------------------------------------------------------------------------
690: hr_utility.set_location('py_za_tax_reg.assignment_nature',1);
691: --
692: FOR v_asg_nature IN csr_asg_nature
693: ( c_assignment_id => p_assignment_id
694: , c_effective_date => p_effective_date
704: l_nature := 'A';
705:
706: END IF;
707: --
708: hr_utility.set_location('py_za_tax_reg.assignment_nature',2);
709: --
710: p_asg_nature := l_nature;
711:
712: EXCEPTION
710: p_asg_nature := l_nature;
711:
712: EXCEPTION
713: WHEN OTHERS THEN
714: hr_utility.set_location('py_za_tax_reg.assignment_nature',3);
715: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
716: hr_utility.raise_error;
717: -------------------------------------------------------------------------------
718: END assignment_nature;
711:
712: EXCEPTION
713: WHEN OTHERS THEN
714: hr_utility.set_location('py_za_tax_reg.assignment_nature',3);
715: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
716: hr_utility.raise_error;
717: -------------------------------------------------------------------------------
718: END assignment_nature;
719:
712: EXCEPTION
713: WHEN OTHERS THEN
714: hr_utility.set_location('py_za_tax_reg.assignment_nature',3);
715: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
716: hr_utility.raise_error;
717: -------------------------------------------------------------------------------
718: END assignment_nature;
719:
720: -------------------------------------------------------------------------------
734: l_balance_value NUMBER;
735: -------------------------------------------------------------------------------
736: BEGIN -- MAIN --
737: -------------------------------------------------------------------------------
738: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',1);
739: IF p_asg_tax_status = 'Seasonal Worker' THEN
740: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',2);
741: --
742: l_bal_type_id :=
736: BEGIN -- MAIN --
737: -------------------------------------------------------------------------------
738: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',1);
739: IF p_asg_tax_status = 'Seasonal Worker' THEN
740: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',2);
741: --
742: l_bal_type_id :=
743: balance_id (
744: p_balance_name => 'Total Seasonal Workers Days Worked'
742: l_bal_type_id :=
743: balance_id (
744: p_balance_name => 'Total Seasonal Workers Days Worked'
745: );
746: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',3);
747: l_balance_value :=
748: ytd_value (
749: p_asg_action_id => p_asg_action_id
750: , p_balance_type_id => l_bal_type_id
751: , p_effective_date => p_effective_date
752: );
753: END IF;
754:
755: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',4);
756: zvl(l_balance_value);
757: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',5);
758: -- Return
759: RETURN l_balance_value;
753: END IF;
754:
755: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',4);
756: zvl(l_balance_value);
757: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',5);
758: -- Return
759: RETURN l_balance_value;
760:
761: EXCEPTION
759: RETURN l_balance_value;
760:
761: EXCEPTION
762: WHEN OTHERS THEN
763: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',6);
764: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
765: hr_utility.raise_error;
766: -------------------------------------------------------------------------------
767: END assignment_dys_worked;
760:
761: EXCEPTION
762: WHEN OTHERS THEN
763: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',6);
764: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
765: hr_utility.raise_error;
766: -------------------------------------------------------------------------------
767: END assignment_dys_worked;
768:
761: EXCEPTION
762: WHEN OTHERS THEN
763: hr_utility.set_location('py_za_tax_reg.assignment_dys_worked',6);
764: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
765: hr_utility.raise_error;
766: -------------------------------------------------------------------------------
767: END assignment_dys_worked;
768:
769: -------------------------------------------------------------------------------
792: l_date per_all_assignments_f.effective_start_date%TYPE;
793: -------------------------------------------------------------------------------
794: BEGIN -- MAIN --
795: -------------------------------------------------------------------------------
796: hr_utility.set_location('py_za_tax_reg.assignment_start_date',1);
797: OPEN csr_assignment_start_date;
798: FETCH csr_assignment_start_date INTO l_date;
799: CLOSE csr_assignment_start_date;
800:
797: OPEN csr_assignment_start_date;
798: FETCH csr_assignment_start_date INTO l_date;
799: CLOSE csr_assignment_start_date;
800:
801: hr_utility.set_location('py_za_tax_reg.assignment_start_date',2);
802: RETURN l_date;
803:
804: EXCEPTION
805: WHEN OTHERS THEN
802: RETURN l_date;
803:
804: EXCEPTION
805: WHEN OTHERS THEN
806: hr_utility.set_location('py_za_tax_reg.assignment_start_date',3);
807: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
808: hr_utility.raise_error;
809: -------------------------------------------------------------------------------
810: END assignment_start_date;
803:
804: EXCEPTION
805: WHEN OTHERS THEN
806: hr_utility.set_location('py_za_tax_reg.assignment_start_date',3);
807: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
808: hr_utility.raise_error;
809: -------------------------------------------------------------------------------
810: END assignment_start_date;
811:
804: EXCEPTION
805: WHEN OTHERS THEN
806: hr_utility.set_location('py_za_tax_reg.assignment_start_date',3);
807: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
808: hr_utility.raise_error;
809: -------------------------------------------------------------------------------
810: END assignment_start_date;
811:
812: -------------------------------------------------------------------------------
835: l_date per_all_assignments_f.effective_start_date%TYPE;
836: -------------------------------------------------------------------------------
837: BEGIN -- MAIN --
838: -------------------------------------------------------------------------------
839: hr_utility.set_location('py_za_tax_reg.assignment_end_date',1);
840:
841: OPEN csr_assignment_end_date;
842: FETCH csr_assignment_end_date INTO l_date;
843: CLOSE csr_assignment_end_date;
841: OPEN csr_assignment_end_date;
842: FETCH csr_assignment_end_date INTO l_date;
843: CLOSE csr_assignment_end_date;
844:
845: hr_utility.set_location('py_za_tax_reg.assignment_end_date',2);
846: RETURN l_date;
847:
848: EXCEPTION
849: WHEN OTHERS THEN
846: RETURN l_date;
847:
848: EXCEPTION
849: WHEN OTHERS THEN
850: hr_utility.set_location('py_za_tax_reg.assignment_end_date',3);
851: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
852: hr_utility.raise_error;
853: -------------------------------------------------------------------------------
854: END assignment_end_date;
847:
848: EXCEPTION
849: WHEN OTHERS THEN
850: hr_utility.set_location('py_za_tax_reg.assignment_end_date',3);
851: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
852: hr_utility.raise_error;
853: -------------------------------------------------------------------------------
854: END assignment_end_date;
855:
848: EXCEPTION
849: WHEN OTHERS THEN
850: hr_utility.set_location('py_za_tax_reg.assignment_end_date',3);
851: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
852: hr_utility.raise_error;
853: -------------------------------------------------------------------------------
854: END assignment_end_date;
855:
856: -------------------------------------------------------------------------------
870: --
871: -------------------------------------------------------------------------------
872: BEGIN -- MAIN --
873: -------------------------------------------------------------------------------
874: hr_utility.set_location('py_za_tax_reg.include_assignment',1);
875: --
876: p_asg_end_date := assignment_end_date (p_assignment_id => p_asg_id);
877: -- Include ALL Assignments
878: --
876: p_asg_end_date := assignment_end_date (p_assignment_id => p_asg_id);
877: -- Include ALL Assignments
878: --
879: IF g_include_asg = 'A' THEN
880: hr_utility.set_location('py_za_tax_reg.include_assignment',2);
881: --
882: l_include := TRUE;
883: -- Include Terminated Assignments ONLY
884: --
882: l_include := TRUE;
883: -- Include Terminated Assignments ONLY
884: --
885: ELSIF g_include_asg = 'T' THEN
886: hr_utility.set_location('py_za_tax_reg.include_assignment',3);
887: --
888: IF p_asg_end_date < g_period_end_date THEN
889: hr_utility.set_location('py_za_tax_reg.include_assignment',4);
890: l_include := TRUE;
885: ELSIF g_include_asg = 'T' THEN
886: hr_utility.set_location('py_za_tax_reg.include_assignment',3);
887: --
888: IF p_asg_end_date < g_period_end_date THEN
889: hr_utility.set_location('py_za_tax_reg.include_assignment',4);
890: l_include := TRUE;
891: ELSE
892: hr_utility.set_location('py_za_tax_reg.include_assignment',5);
893: l_include := FALSE;
888: IF p_asg_end_date < g_period_end_date THEN
889: hr_utility.set_location('py_za_tax_reg.include_assignment',4);
890: l_include := TRUE;
891: ELSE
892: hr_utility.set_location('py_za_tax_reg.include_assignment',5);
893: l_include := FALSE;
894: END IF;
895: -- Include Current Assignments ONLY
896: --
894: END IF;
895: -- Include Current Assignments ONLY
896: --
897: ELSIF g_include_asg = 'C' THEN
898: hr_utility.set_location('py_za_tax_reg.include_assignment',6);
899: --
900: IF p_asg_end_date >= g_period_end_date THEN
901: hr_utility.set_location('py_za_tax_reg.include_assignment',7);
902: l_include := TRUE;
897: ELSIF g_include_asg = 'C' THEN
898: hr_utility.set_location('py_za_tax_reg.include_assignment',6);
899: --
900: IF p_asg_end_date >= g_period_end_date THEN
901: hr_utility.set_location('py_za_tax_reg.include_assignment',7);
902: l_include := TRUE;
903: ELSE
904: hr_utility.set_location('py_za_tax_reg.include_assignment',8);
905: l_include := FALSE;
900: IF p_asg_end_date >= g_period_end_date THEN
901: hr_utility.set_location('py_za_tax_reg.include_assignment',7);
902: l_include := TRUE;
903: ELSE
904: hr_utility.set_location('py_za_tax_reg.include_assignment',8);
905: l_include := FALSE;
906: END IF;
907: END IF;
908:
911: -- it's on or after the period end date
912: -- this will indicate a non terminated assignment
913: --
914: IF p_asg_end_date >= g_period_end_date THEN
915: hr_utility.set_location('py_za_tax_reg.include_assignment',9);
916: p_asg_end_date := NULL;
917: END IF;
918:
919: IF l_include THEN
916: p_asg_end_date := NULL;
917: END IF;
918:
919: IF l_include THEN
920: hr_utility.set_location('py_za_tax_reg.include_assignment',10);
921: p_asg_start_date := assignment_start_date (p_assignment_id => p_asg_id);
922: END IF;
923:
924: hr_utility.set_location('py_za_tax_reg.include_assignment',11);
920: hr_utility.set_location('py_za_tax_reg.include_assignment',10);
921: p_asg_start_date := assignment_start_date (p_assignment_id => p_asg_id);
922: END IF;
923:
924: hr_utility.set_location('py_za_tax_reg.include_assignment',11);
925: RETURN l_include;
926:
927: EXCEPTION
928: WHEN OTHERS THEN
925: RETURN l_include;
926:
927: EXCEPTION
928: WHEN OTHERS THEN
929: hr_utility.set_location('py_za_tax_reg.include_assignment',12);
930: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
931: hr_utility.raise_error;
932: -------------------------------------------------------------------------------
933: END include_assignment;
926:
927: EXCEPTION
928: WHEN OTHERS THEN
929: hr_utility.set_location('py_za_tax_reg.include_assignment',12);
930: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
931: hr_utility.raise_error;
932: -------------------------------------------------------------------------------
933: END include_assignment;
934:
927: EXCEPTION
928: WHEN OTHERS THEN
929: hr_utility.set_location('py_za_tax_reg.include_assignment',12);
930: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
931: hr_utility.raise_error;
932: -------------------------------------------------------------------------------
933: END include_assignment;
934:
935: -------------------------------------------------------------------------------
974: l_include := 'N';
975: END IF;
976: END IF;
977:
978: hr_utility.set_location('py_za_tax_reg.include_assignment',1);
979: RETURN l_include;
980:
981: EXCEPTION
982: WHEN OTHERS THEN
979: RETURN l_include;
980:
981: EXCEPTION
982: WHEN OTHERS THEN
983: hr_utility.set_location('py_za_tax_reg.include_assignment',2);
984: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
985: hr_utility.raise_error;
986: -------------------------------------------------------------------------------
987: END include_assignment;
980:
981: EXCEPTION
982: WHEN OTHERS THEN
983: hr_utility.set_location('py_za_tax_reg.include_assignment',2);
984: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
985: hr_utility.raise_error;
986: -------------------------------------------------------------------------------
987: END include_assignment;
988:
981: EXCEPTION
982: WHEN OTHERS THEN
983: hr_utility.set_location('py_za_tax_reg.include_assignment',2);
984: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
985: hr_utility.raise_error;
986: -------------------------------------------------------------------------------
987: END include_assignment;
988:
989: -------------------------------------------------------------------------------
1009:
1010: -------------------------------------------------------------------------------
1011: BEGIN -- MAIN --
1012: -------------------------------------------------------------------------------
1013: hr_utility.set_location('py_za_tax_reg.total_employees',1);
1014:
1015: OPEN csr_total_employees;
1016: FETCH csr_total_employees INTO l_tot_employees;
1017: CLOSE csr_total_employees;
1015: OPEN csr_total_employees;
1016: FETCH csr_total_employees INTO l_tot_employees;
1017: CLOSE csr_total_employees;
1018:
1019: hr_utility.set_location('py_za_tax_reg.total_employees',2);
1020: RETURN l_tot_employees;
1021:
1022: EXCEPTION
1023: WHEN OTHERS THEN
1020: RETURN l_tot_employees;
1021:
1022: EXCEPTION
1023: WHEN OTHERS THEN
1024: hr_utility.set_location('py_za_tax_reg.total_employees',3);
1025: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1026: hr_utility.raise_error;
1027: -------------------------------------------------------------------------------
1028: END total_employees;
1021:
1022: EXCEPTION
1023: WHEN OTHERS THEN
1024: hr_utility.set_location('py_za_tax_reg.total_employees',3);
1025: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1026: hr_utility.raise_error;
1027: -------------------------------------------------------------------------------
1028: END total_employees;
1029:
1022: EXCEPTION
1023: WHEN OTHERS THEN
1024: hr_utility.set_location('py_za_tax_reg.total_employees',3);
1025: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1026: hr_utility.raise_error;
1027: -------------------------------------------------------------------------------
1028: END total_employees;
1029:
1030: -------------------------------------------------------------------------------
1050:
1051: -------------------------------------------------------------------------------
1052: BEGIN -- MAIN --
1053: -------------------------------------------------------------------------------
1054: hr_utility.set_location('py_za_tax_reg.total_assignments',1);
1055:
1056: OPEN csr_total_assignments;
1057: FETCH csr_total_assignments INTO l_tot_assignments;
1058: CLOSE csr_total_assignments;
1056: OPEN csr_total_assignments;
1057: FETCH csr_total_assignments INTO l_tot_assignments;
1058: CLOSE csr_total_assignments;
1059:
1060: hr_utility.set_location('py_za_tax_reg.total_assignments',2);
1061: RETURN l_tot_assignments;
1062:
1063: EXCEPTION
1064: WHEN OTHERS THEN
1061: RETURN l_tot_assignments;
1062:
1063: EXCEPTION
1064: WHEN OTHERS THEN
1065: hr_utility.set_location('py_za_tax_reg.total_assignments',3);
1066: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1067: hr_utility.raise_error;
1068: -------------------------------------------------------------------------------
1069: END total_assignments;
1062:
1063: EXCEPTION
1064: WHEN OTHERS THEN
1065: hr_utility.set_location('py_za_tax_reg.total_assignments',3);
1066: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1067: hr_utility.raise_error;
1068: -------------------------------------------------------------------------------
1069: END total_assignments;
1070:
1063: EXCEPTION
1064: WHEN OTHERS THEN
1065: hr_utility.set_location('py_za_tax_reg.total_assignments',3);
1066: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1067: hr_utility.raise_error;
1068: -------------------------------------------------------------------------------
1069: END total_assignments;
1070:
1071:
1109: --
1110: -------------------------------------------------------------------------------
1111: BEGIN -- MAIN --
1112: -------------------------------------------------------------------------------
1113: hr_utility.set_location('py_za_tax_reg.set_period_details',1);
1114: IF g_start_period_id IS NULL THEN
1115: hr_utility.set_location('py_za_tax_reg.set_period_details',2);
1116:
1117: OPEN csr_min_time_period;
1111: BEGIN -- MAIN --
1112: -------------------------------------------------------------------------------
1113: hr_utility.set_location('py_za_tax_reg.set_period_details',1);
1114: IF g_start_period_id IS NULL THEN
1115: hr_utility.set_location('py_za_tax_reg.set_period_details',2);
1116:
1117: OPEN csr_min_time_period;
1118: FETCH csr_min_time_period INTO l_min_period_id;
1119: CLOSE csr_min_time_period;
1120:
1121: g_start_period_id := l_min_period_id;
1122: END IF;
1123: --
1124: hr_utility.set_location('py_za_tax_reg.set_period_details',3);
1125: --
1126: OPEN csr_period_details;
1127: FETCH csr_period_details INTO l_period_info;
1128: CLOSE csr_period_details;
1126: OPEN csr_period_details;
1127: FETCH csr_period_details INTO l_period_info;
1128: CLOSE csr_period_details;
1129: --
1130: hr_utility.set_location('py_za_tax_reg.set_period_details',4);
1131: --
1132: g_period_num := l_period_info.period_num;
1133: g_period_start_date := l_period_info.start_date;
1134: g_period_end_date := l_period_info.end_date;
1132: g_period_num := l_period_info.period_num;
1133: g_period_start_date := l_period_info.start_date;
1134: g_period_end_date := l_period_info.end_date;
1135: --
1136: hr_utility.set_location('py_za_tax_reg.set_period_details',5);
1137:
1138: EXCEPTION
1139: WHEN OTHERS THEN
1140: hr_utility.set_location('py_za_tax_reg.set_period_details',6);
1136: hr_utility.set_location('py_za_tax_reg.set_period_details',5);
1137:
1138: EXCEPTION
1139: WHEN OTHERS THEN
1140: hr_utility.set_location('py_za_tax_reg.set_period_details',6);
1141: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1142: hr_utility.raise_error;
1143: -------------------------------------------------------------------------------
1144: END set_period_details;
1137:
1138: EXCEPTION
1139: WHEN OTHERS THEN
1140: hr_utility.set_location('py_za_tax_reg.set_period_details',6);
1141: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1142: hr_utility.raise_error;
1143: -------------------------------------------------------------------------------
1144: END set_period_details;
1145:
1138: EXCEPTION
1139: WHEN OTHERS THEN
1140: hr_utility.set_location('py_za_tax_reg.set_period_details',6);
1141: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1142: hr_utility.raise_error;
1143: -------------------------------------------------------------------------------
1144: END set_period_details;
1145:
1146:
1169: --
1170: -------------------------------------------------------------------------------
1171: BEGIN -- MAIN --
1172: -------------------------------------------------------------------------------
1173: hr_utility.set_location('py_za_tax_reg.set_payroll_details',1);
1174:
1175: OPEN csr_payroll_name;
1176: FETCH csr_payroll_name INTO g_payroll_name;
1177: CLOSE csr_payroll_name;
1175: OPEN csr_payroll_name;
1176: FETCH csr_payroll_name INTO g_payroll_name;
1177: CLOSE csr_payroll_name;
1178:
1179: hr_utility.set_location('py_za_tax_reg.set_payroll_details',2);
1180:
1181: EXCEPTION
1182: WHEN OTHERS THEN
1183: hr_utility.set_location('py_za_tax_reg.set_payroll_details',3);
1179: hr_utility.set_location('py_za_tax_reg.set_payroll_details',2);
1180:
1181: EXCEPTION
1182: WHEN OTHERS THEN
1183: hr_utility.set_location('py_za_tax_reg.set_payroll_details',3);
1184: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1185: hr_utility.raise_error;
1186: -------------------------------------------------------------------------------
1187: END set_payroll_details;
1180:
1181: EXCEPTION
1182: WHEN OTHERS THEN
1183: hr_utility.set_location('py_za_tax_reg.set_payroll_details',3);
1184: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1185: hr_utility.raise_error;
1186: -------------------------------------------------------------------------------
1187: END set_payroll_details;
1188:
1181: EXCEPTION
1182: WHEN OTHERS THEN
1183: hr_utility.set_location('py_za_tax_reg.set_payroll_details',3);
1184: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1185: hr_utility.raise_error;
1186: -------------------------------------------------------------------------------
1187: END set_payroll_details;
1188:
1189: -------------------------------------------------------------------------------
1205: --
1206: -------------------------------------------------------------------------------
1207: BEGIN -- MAIN --
1208: -------------------------------------------------------------------------------
1209: hr_utility.set_location('py_za_tax_reg.set_globals',1);
1210: --
1211: SELECT
1212: pay_za_tax_registers_s.nextval
1213: INTO
1214: g_tax_register_id
1215: FROM
1216: dual;
1217: --
1218: hr_utility.set_location('py_za_tax_reg.set_globals',2);
1219: --
1220: g_payroll_id := p_payroll_id;
1221: g_start_period_id := p_start_period_id;
1222: g_end_period_id := p_end_period_id;
1221: g_start_period_id := p_start_period_id;
1222: g_end_period_id := p_end_period_id;
1223: g_include_asg := p_include;
1224: --
1225: hr_utility.set_location('py_za_tax_reg.set_globals',3);
1226: --
1227: IF p_retrieve_ptd = 'Y' THEN
1228: hr_utility.set_location('py_za_tax_reg.set_globals',4);
1229: g_retrieve_ptd := TRUE;
1224: --
1225: hr_utility.set_location('py_za_tax_reg.set_globals',3);
1226: --
1227: IF p_retrieve_ptd = 'Y' THEN
1228: hr_utility.set_location('py_za_tax_reg.set_globals',4);
1229: g_retrieve_ptd := TRUE;
1230: END IF;
1231: IF p_retrieve_mtd = 'Y' THEN
1232: hr_utility.set_location('py_za_tax_reg.set_globals',5);
1228: hr_utility.set_location('py_za_tax_reg.set_globals',4);
1229: g_retrieve_ptd := TRUE;
1230: END IF;
1231: IF p_retrieve_mtd = 'Y' THEN
1232: hr_utility.set_location('py_za_tax_reg.set_globals',5);
1233: g_retrieve_mtd := TRUE;
1234: END IF;
1235: IF p_retrieve_ytd = 'Y' THEN
1236: hr_utility.set_location('py_za_tax_reg.set_globals',6);
1232: hr_utility.set_location('py_za_tax_reg.set_globals',5);
1233: g_retrieve_mtd := TRUE;
1234: END IF;
1235: IF p_retrieve_ytd = 'Y' THEN
1236: hr_utility.set_location('py_za_tax_reg.set_globals',6);
1237: g_retrieve_ytd := TRUE;
1238: END IF;
1239: --
1240: hr_utility.set_location('py_za_tax_reg.set_globals',7);
1236: hr_utility.set_location('py_za_tax_reg.set_globals',6);
1237: g_retrieve_ytd := TRUE;
1238: END IF;
1239: --
1240: hr_utility.set_location('py_za_tax_reg.set_globals',7);
1241: --
1242: set_period_details;
1243: set_payroll_details;
1244: --set_company_details;
1242: set_period_details;
1243: set_payroll_details;
1244: --set_company_details;
1245: --
1246: hr_utility.set_location('py_za_tax_reg.set_globals',8);
1247:
1248: EXCEPTION
1249: WHEN OTHERS THEN
1250: hr_utility.set_location('py_za_tax_reg.set_globals',9);
1246: hr_utility.set_location('py_za_tax_reg.set_globals',8);
1247:
1248: EXCEPTION
1249: WHEN OTHERS THEN
1250: hr_utility.set_location('py_za_tax_reg.set_globals',9);
1251: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1252: hr_utility.raise_error;
1253: -------------------------------------------------------------------------------
1254: END set_globals;
1247:
1248: EXCEPTION
1249: WHEN OTHERS THEN
1250: hr_utility.set_location('py_za_tax_reg.set_globals',9);
1251: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1252: hr_utility.raise_error;
1253: -------------------------------------------------------------------------------
1254: END set_globals;
1255:
1248: EXCEPTION
1249: WHEN OTHERS THEN
1250: hr_utility.set_location('py_za_tax_reg.set_globals',9);
1251: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1252: hr_utility.raise_error;
1253: -------------------------------------------------------------------------------
1254: END set_globals;
1255:
1256: -------------------------------------------------------------------------------
1286: --
1287: -------------------------------------------------------------------------------
1288: BEGIN -- MAIN --
1289: -------------------------------------------------------------------------------
1290: hr_utility.set_location('py_za_tax_reg.ins_register',1);
1291: --
1292: INSERT INTO pay_za_tax_registers (
1293: tax_register_id
1294: , full_name
1335: , p_tot_mtd
1336: , p_tot_ytd
1337: );
1338: --
1339: hr_utility.set_location('py_za_tax_reg.ins_register',2);
1340: --
1341: EXCEPTION
1342: WHEN OTHERS THEN
1343: hr_utility.set_location('py_za_tax_reg.ins_register',3);
1339: hr_utility.set_location('py_za_tax_reg.ins_register',2);
1340: --
1341: EXCEPTION
1342: WHEN OTHERS THEN
1343: hr_utility.set_location('py_za_tax_reg.ins_register',3);
1344: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1345: hr_utility.raise_error;
1346: -------------------------------------------------------------------------------
1347: END ins_register;
1340: --
1341: EXCEPTION
1342: WHEN OTHERS THEN
1343: hr_utility.set_location('py_za_tax_reg.ins_register',3);
1344: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1345: hr_utility.raise_error;
1346: -------------------------------------------------------------------------------
1347: END ins_register;
1348:
1341: EXCEPTION
1342: WHEN OTHERS THEN
1343: hr_utility.set_location('py_za_tax_reg.ins_register',3);
1344: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1345: hr_utility.raise_error;
1346: -------------------------------------------------------------------------------
1347: END ins_register;
1348:
1349:
1356: AS
1357: -------------------------------------------------------------------------------
1358: BEGIN -- MAIN --
1359: -------------------------------------------------------------------------------
1360: hr_utility.set_location('py_za_tax_reg.clear_register',1);
1361: --
1362: DELETE
1363: FROM
1364: pay_za_tax_registers ztr
1364: pay_za_tax_registers ztr
1365: WHERE
1366: ztr.tax_register_id = p_id;
1367:
1368: hr_utility.set_location('py_za_tax_reg.clear_register',2);
1369:
1370: EXCEPTION
1371: WHEN OTHERS THEN
1372: hr_utility.set_location('py_za_tax_reg.clear_register',3);
1368: hr_utility.set_location('py_za_tax_reg.clear_register',2);
1369:
1370: EXCEPTION
1371: WHEN OTHERS THEN
1372: hr_utility.set_location('py_za_tax_reg.clear_register',3);
1373: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1374: hr_utility.raise_error;
1375: -------------------------------------------------------------------------------
1376: END clear_register;
1369:
1370: EXCEPTION
1371: WHEN OTHERS THEN
1372: hr_utility.set_location('py_za_tax_reg.clear_register',3);
1373: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1374: hr_utility.raise_error;
1375: -------------------------------------------------------------------------------
1376: END clear_register;
1377:
1370: EXCEPTION
1371: WHEN OTHERS THEN
1372: hr_utility.set_location('py_za_tax_reg.clear_register',3);
1373: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1374: hr_utility.raise_error;
1375: -------------------------------------------------------------------------------
1376: END clear_register;
1377:
1378: -------------------------------------------------------------------------------
1531:
1532: -------------------------------------------------------------------------------
1533: BEGIN -- Pre Process - MAIN --
1534: -------------------------------------------------------------------------------
1535: hr_utility.set_location('py_za_tax_reg.pre_process',1);
1536: --
1537: set_globals (
1538: p_payroll_id => p_payroll_id
1539: , p_start_period_id => p_start_period_id
1543: , p_retrieve_mtd => p_retrieve_mtd
1544: , p_retrieve_ytd => p_retrieve_ytd
1545: );
1546: --
1547: hr_utility.set_location('py_za_tax_reg.pre_process',2);
1548: ------------------------
1549: <
1550: ------------------------
1551: FOR v_assignments IN csr_processed_assignments
1554: , p_end_period_id => g_end_period_id
1555: , p_asg_id => p_assignment_id
1556: )
1557: LOOP
1558: hr_utility.set_location('py_za_tax_reg.pre_process',3);
1559: --
1560: IF include_assignment (
1561: p_asg_id => v_assignments.assignment_id
1562: , p_asg_start_date => l_asg_start_date
1562: , p_asg_start_date => l_asg_start_date
1563: , p_asg_end_date => l_asg_end_date
1564: )
1565: THEN
1566: hr_utility.set_location('py_za_tax_reg.pre_process',4);
1567: -- get assignment's tax status and directive value
1568: assignment_tax_sta_dir (
1569: p_assignment_id => v_assignments.assignment_id
1570: , p_asg_tax_status => l_asg_tax_status
1578: , p_effective_date => v_assignments.effective_date
1579: , p_asg_nature => l_nature
1580: );
1581: --
1582: hr_utility.set_location('py_za_tax_reg.pre_process',6);
1583: -- get assignment's seasonal days worked
1584: l_asg_dys_worked :=
1585: assignment_dys_worked (
1586: p_asg_tax_status => l_asg_tax_status
1587: , p_asg_action_id => v_assignments.assignment_action_id
1588: , p_effective_date => v_assignments.effective_date
1589: );
1590: --
1591: hr_utility.set_location('py_za_tax_reg.pre_process',7);
1592: -----------------
1593: <
1594: -----------------
1595: FOR v_bal IN csr_irp5_balances (
1598: , p_start_period_id => g_start_period_id
1599: , p_end_period_id => g_end_period_id
1600: )
1601: LOOP
1602: hr_utility.set_location('py_za_tax_reg.pre_process',8);
1603: --
1604: --get the correct SARS Code for directors and foreign income
1605: l_bal_code := py_za_tax_certificates.get_sars_code(
1606: p_sars_code => v_bal.bal_code
1616: , p_balance_name => v_bal.bal_name
1617: , p_effective_date => v_assignments.effective_date
1618: );
1619: --
1620: hr_utility.set_location('py_za_tax_reg.pre_process',9);
1621: --
1622: l_mtd_bal :=
1623: mtd_value (
1624: p_asg_action_id => v_assignments.assignment_action_id
1626: , p_balance_name => v_bal.bal_name
1627: , p_effective_date => v_assignments.effective_date
1628: );
1629: --
1630: hr_utility.set_location('py_za_tax_reg.pre_process',10);
1631: --
1632: l_ytd_bal :=
1633: ytd_value (
1634: p_asg_action_id => v_assignments.assignment_action_id
1635: , p_balance_type_id => v_bal.bal_id
1636: , p_effective_date => v_assignments.effective_date
1637: );
1638: --
1639: hr_utility.set_location('py_za_tax_reg.pre_process',11);
1640: --
1641: IF valid_record (
1642: p_ptd_bal => l_ptd_bal
1643: , p_mtd_bal => l_mtd_bal
1643: , p_mtd_bal => l_mtd_bal
1644: , p_ytd_bal => l_ytd_bal
1645: )
1646: THEN
1647: hr_utility.set_location('py_za_tax_reg.pre_process',12);
1648: -- Create the register record
1649: --
1650: ins_register (
1651: p_full_name => v_assignments.full_name
1673: END LOOP Balance_Values;
1674: END IF; -- Include Assignment
1675: END LOOP Processed_Assignments;
1676: --
1677: hr_utility.set_location('py_za_tax_reg.pre_process',13);
1678: ---------------------
1679: -- Set out Parameters
1680: ---------------------
1681: p_tax_register_id := g_tax_register_id;
1686: p_tot_employees := total_employees;
1687: p_tot_assignments := total_assignments;
1688: EXCEPTION
1689: WHEN OTHERS THEN
1690: hr_utility.set_location('py_za_tax_reg.pre_process',14);
1691: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1692: hr_utility.raise_error;
1693: -------------------------------------------------------------------------------
1694: END pre_process;-- END --
1687: p_tot_assignments := total_assignments;
1688: EXCEPTION
1689: WHEN OTHERS THEN
1690: hr_utility.set_location('py_za_tax_reg.pre_process',14);
1691: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1692: hr_utility.raise_error;
1693: -------------------------------------------------------------------------------
1694: END pre_process;-- END --
1695: -------------------------------------------------------------------------------
1688: EXCEPTION
1689: WHEN OTHERS THEN
1690: hr_utility.set_location('py_za_tax_reg.pre_process',14);
1691: hr_utility.set_message(801,'Sql Err Code: '||TO_CHAR(SQLCODE));
1692: hr_utility.raise_error;
1693: -------------------------------------------------------------------------------
1694: END pre_process;-- END --
1695: -------------------------------------------------------------------------------
1696: -------------------------------------------------------------------------------