[Home] [Help]
PACKAGE BODY: APPS.PAY_KR_YEA_DON_EFILE_PKG
Source
1 package body pay_kr_yea_don_efile_pkg as
2 /* $Header: pykrydef.pkb 120.4 2012/01/19 10:15:38 rpahune ship $ */
3 --
4 -- Constants
5 --
6 c_package constant varchar2(31) := ' pay_kr_yea_don_efile_pkg.';
7 --
8 report_for_var varchar2(50);
9
10 procedure populate_a
11 ------------------------------------------------------------------------
12 is
13 l_proc varchar2(61) := c_package || 'populate_a';
14 --
15 cursor csr_a is
16 select count(distinct hoi2.org_information2||hoi3.org_information9)
17 from hr_organization_information hoi3,
18 hr_organization_information hoi2,
19 hr_organization_units bp2,
20 hr_organization_information hoi1,
21 hr_organization_units bp1
22 where bp1.organization_id = g_business_place_id
23 and hoi1.organization_id = bp1.organization_id
24 and hoi1.org_information_context = 'KR_BUSINESS_PLACE_REGISTRATION'
25 and bp2.business_group_id = bp1.business_group_id
26 and ( (report_for_var = 'A')
27 or ( (hoi2.organization_id in ( select posev.ORGANIZATION_ID_child
28 from PER_ORG_STRUCTURE_ELEMENTS posev
29 where posev.org_structure_version_id=(pay_magtape_generic.get_parameter_value('ORG_STRUC_VERSION_ID'))
30 and exists ( select null
31 from hr_organization_information
32 where organization_id = posev.ORGANIZATION_ID_child
33 and org_information_context = 'CLASS'
34 and org_information1 = 'KR_BUSINESS_PLACE'
35 )
36 start with ORGANIZATION_ID_PARENT = (decode(report_for_var,'S',null,'SUB',g_business_place_id))
37 connect by prior ORGANIZATION_ID_child = ORGANIZATION_ID_PARENT
38 )
39 )
40 or (hoi2.organization_id = g_business_place_id
41 )
42 )
43 )
44 and hoi2.organization_id = bp2.organization_id
45 and hoi2.org_information_context = 'KR_BUSINESS_PLACE_REGISTRATION'
46 and hoi2.org_information10 = hoi1.org_information10
47 and hoi3.organization_id = hoi2.organization_id
48 and hoi3.org_information_context = 'KR_INCOME_TAX_OFFICE'
49 and exists(
50 select null
51 from pay_assignment_actions paa,
52 pay_payroll_actions ppa
53 where ppa.report_type = 'YEA'
54 and ppa.report_qualifier = 'KR'
55 and ppa.business_group_id = bp1.business_group_id
56 -- Bug 3248513
57 and ( (ppa.report_category in (g_normal_yea, g_interim_yea, g_re_yea)) or (ppa.payroll_action_id = g_payroll_action_id) )
58 and to_number(to_char(ppa.effective_date, 'YYYY')) = g_target_year
59 --
60 and ppa.action_type in ('B','X')
61 and paa.payroll_action_id = ppa.payroll_action_id
62 and paa.tax_unit_id = bp2.organization_id
63 and paa.action_status = 'C');
64 begin
65 if g_business_place_id is null then
66 g_business_place_id := to_number(pay_magtape_generic.get_parameter_value('PRIMARY_BP_ID'));
67 report_for_var := pay_magtape_generic.get_parameter_value('REPORT_FOR');
68 --
69 open csr_a;
70 fetch csr_a into g_b_records;
71 close csr_a;
72 end if;
73 end populate_a;
74 ------------------------------------------------------------------------
75 -- Package initialization section
76 ------------------------------------------------------------------------
77 begin
78 declare
79 l_report_type varchar2(3);
80
81 begin
82 --
83 g_payroll_action_id := to_number(pay_magtape_generic.get_parameter_value('PAYROLL_ACTION_ID') );
84 g_target_year := to_number(pay_magtape_generic.get_parameter_value('TARGET_YEAR'));
85 g_assignment_set_id := to_number(pay_magtape_generic.get_parameter_value('ASSIGNMENT_SET_ID'));
86 --
87 if g_payroll_action_id is null then
88
89 l_report_type := pay_magtape_generic.get_parameter_value('REPORT_TYPE');
90
91 if l_report_type is null then
92 g_normal_yea := 'N';
93 g_interim_yea := 'I';
94 g_rep_period_code := '1'; -- Bug 9251570
95
96 elsif l_report_type = 'N' then
97 g_normal_yea := 'N';
98 g_rep_period_code := '1'; -- Bug 9251570
99
100 elsif l_report_type = 'I' then
101 g_interim_yea := 'I';
102 g_rep_period_code := '3'; -- Bug 9251570
103
104 elsif l_report_type = 'R' then
105 g_re_yea := 'R';
106 g_rep_period_code := '3'; -- Bug 9251570
107
108 elsif l_report_type = 'NI' then
109 g_normal_yea := 'N';
110 g_interim_yea := 'I';
111 g_rep_period_code := '1'; -- Bug 9251570
112
113 elsif l_report_type = 'NR' then
114 g_normal_yea := 'N';
115 g_re_yea := 'R';
116 g_rep_period_code := '1'; -- Bug 9251570
117
118 end if;
119 end if;
120 --
121 populate_a;
122 --
123 end;
124 end pay_kr_yea_don_efile_pkg;