[Home] [Help]
PACKAGE BODY: APPS.PAY_UK_ELE_ENTRIES_PKG
Source
1 PACKAGE BODY PAY_UK_ELE_ENTRIES_PKG as
2 /* $Header: pygbeent.pkb 115.8 2003/02/19 05:24:14 asengar ship $ */
3 --
4 /*==========================================================================+
5 | Copyright (c) 1993 Oracle Corporation |
6 | Redwood Shores, California, USA |
7 | All rights reserved. |
8 +===========================================================================+
9 Name
10 pay_uk_ele_entries_pkg
11 Purpose
12 Supports the PAYE block in the NI block in the form PAYGBTAX.
13 Notes
14
15 History
16 19-AUG-94 H.Minton 40.0 Date created.
17 05-MAY-95 M.Roychowdhury 40.1 Changed to use explicit cursors
18 and added error message for missing formulas
19 14-JAN-97 T.Inekuku 40.5 Included new I. Value in update to
20 NI procedure.
21 06-OCT-00 G.Butler 115.1 Updated call to hr_entry_api.update_element_entry
22 in update_paye_entries to include x_entry_information1,
23 x_entry_information2, x_entry_information_category
24 06-JUN-02 K.Thampan 115.2 Updated the procedure update_ni_entries to
25 update the elment entry twice, but the second update
26 use start date of the next period.
27 10-Jun-02 K.Thampan 115.3 Add dbdrv command
28 17-Jul-02 K.Thampan 115.4 Update the procedure update_ni_entries so that it will
29 reset the process type to 'Normal' if the entry type
30 is Irregular Periods or Multiple Periods
31 19-Jul-02 K.Thampan 115.5 Force the second update_ni_entires to use
32 UPDATE mode
33 24-Jan-03 M.Ahmad 115.6 Added NOCOPY
34 19-Feb-03 A.Sengar 115.8 Added one condition in the select statement of the
35 PROCEDURE update_ni_entries.
36 ==============================================================================*/
37 -----------------------------------------------------------------------------
38 -- Name --
39 -- update_paye_entries --
40 -- Purpose --
41 -- calls the hr_element_entry_api to perform updates to the PAYE element.--
42 -----------------------------------------------------------------------------
43 --
44 PROCEDURE update_paye_entries(
45 x_dt_update_mode varchar2,
46 x_session_date date,
47 x_element_entry_id number,
48 x_input_value_id1 number,
49 x_entry_value1 varchar2,
50 x_input_value_id2 number,
51 x_entry_value2 varchar2,
52 x_input_value_id4 number,
53 x_entry_value4 varchar2,
54 x_input_value_id5 number,
55 x_entry_value5 varchar2,
56 x_input_value_id3 number,
57 x_entry_value3 varchar2,
58 x_input_value_id6 number,
59 x_entry_value6 varchar2,
60 x_entry_information1 varchar2,
61 x_entry_information2 varchar2,
62 x_entry_information_category varchar2,
63 p_effective_end_date in out nocopy date)
64 IS
65 --
66 l_effective_end_date DATE;
67
68 BEGIN
69 hr_entry_api.update_element_entry
70 (p_dt_update_mode => x_dt_update_mode,
71 p_session_date => x_session_date,
72 p_element_entry_id => x_element_entry_id,
73 p_input_value_id1 => x_input_value_id1,
74 P_entry_value1 => x_entry_value1,
75 p_input_value_id2 => x_input_value_id2,
76 P_entry_value2 => x_entry_value2,
77 p_input_value_id3 => x_input_value_id3,
78 P_entry_value3 => x_entry_value3,
79 p_input_value_id4 => x_input_value_id4,
80 P_entry_value4 => x_entry_value4,
81 p_input_value_id5 => x_input_value_id5,
82 P_entry_value5 => x_entry_value5,
83 p_input_value_id6 => x_input_value_id6,
84 P_entry_value6 => x_entry_value6,
85 P_entry_information1 => x_entry_information1,
86 P_entry_information2 => x_entry_information2,
87 P_entry_information_category => x_entry_information_category);
88 select e.effective_end_date
89 into l_effective_end_date
90 from pay_element_entries_f e
91 where e.element_entry_id = x_element_entry_id
92 and x_session_date between e.effective_start_date and
93 e.effective_end_date;
94
95 p_effective_end_date := l_effective_end_date;
96
97 END update_paye_entries;
98 --
99 -----------------------------------------------------------------------------
100 -- Name --
101 -- get_paye_formula_id --
102 -- Purpose --
103 -- this function finds the formula id for the validation of the PAYE --
104 -- tax_code element entry value.
105 -----------------------------------------------------------------------------
106 --
107 FUNCTION get_paye_formula_id RETURN NUMBER IS
108
109 cursor c_formula is
110 select f.FORMULA_ID
111 from ff_formulas_f f,
112 ff_formula_types t
113 where t.FORMULA_TYPE_ID = f.FORMULA_TYPE_ID
114 and t.FORMULA_TYPE_NAME = 'Element Input Validation'
115 and f.FORMULA_NAME = 'TAX_CODE';
116 --
117 l_formula_id NUMBER;
118 --
119 BEGIN
120 --
121 open c_formula;
122 fetch c_formula into l_formula_id;
123 if c_formula%notfound then
124 --
125 close c_formula;
126 --
127 fnd_message.set_name ('FF', 'FFX03A_FORMULA_NOT_FOUND');
128 fnd_message.set_token ('1','TAX_CODE');
129 fnd_message.raise_error;
130 --
131 end if;
132 close c_formula;
133 --
134 RETURN l_formula_id;
135 --
136 END get_paye_formula_id;
137
138 -----------------------------------------------------------------------------
139 -- Name --
140 -- update_ni_entries --
141 -- Purpose --
142 -- calls the hr_element_entry_api to perform updates to the NI element. --
143 -----------------------------------------------------------------------------
144 --
145 PROCEDURE update_ni_entries(
146 x_dt_update_mode varchar2,
147 x_session_date date,
148 x_element_entry_id number,
149 x_input_value_id1 number,
150 x_entry_value1 varchar2,
151 x_input_value_id2 number,
152 x_entry_value2 varchar2,
153 x_input_value_id3 number,
154 x_entry_value3 varchar2,
155 x_input_value_id4 number,
156 x_entry_value4 varchar2,
157 x_input_value_id5 number,
158 x_entry_value5 varchar2,
159 x_input_value_id6 number,
160 x_entry_value6 varchar2,
161 x_input_value_id7 number,
162 x_entry_value7 varchar2,
163 x_input_value_id8 number,
164 x_entry_value8 varchar2,
165 P_effective_end_date IN OUT NOCOPY DATE) IS
166 --
167
168 l_effective_end_date DATE;
169 l_payroll_id NUMBER;
170 l_start_date DATE;
171
172 BEGIN
173 hr_entry_api.update_element_entry
174 (p_dt_update_mode => x_dt_update_mode,
175 p_session_date => x_session_date,
176 p_element_entry_id => x_element_entry_id,
177 p_input_value_id1 => x_input_value_id1,
178 P_entry_value1 => x_entry_value1,
179 p_input_value_id2 => x_input_value_id2,
180 P_entry_value2 => x_entry_value2,
181 p_input_value_id3 => x_input_value_id3,
182 P_entry_value3 => x_entry_value3,
183 p_input_value_id4 => x_input_value_id4,
184 P_entry_value4 => x_entry_value4,
185 p_input_value_id5 => x_input_value_id5,
186 P_entry_value5 => x_entry_value5,
187 p_input_value_id6 => x_input_value_id6,
188 P_entry_value6 => x_entry_value6,
189 p_input_value_id7 => x_input_value_id7,
190 P_entry_value7 => x_entry_value7,
191 p_input_value_id8 => x_input_value_id8,
192 P_entry_value8 => x_entry_value8
193 );
194
195 /*****************************************/
196 /* Bug 2391897 -- see readme for details */
197 /*****************************************/
198 if (x_entry_value5 = 'Irregular Periods') OR (x_entry_value5 = 'Multiple Periods') Then
199 select ppf.payroll_id
200 into l_payroll_id
201 from pay_payrolls_f ppf,
202 per_assignments_f paf,
203 pay_element_entries_f peef
204 where peef.element_entry_id = x_element_entry_id
205 and x_session_date between peef.effective_start_date and peef.effective_end_date
206 and peef.assignment_id = paf.assignment_id
207 and x_session_date between paf.effective_start_date and paf.effective_end_date
208 --BUG 2791911 Added one more condition
209 and x_session_date between ppf.effective_start_date and ppf.effective_end_date
210 and paf.payroll_id = ppf.payroll_id;
211
212 select ptp.start_date
213 into l_start_date
214 from per_time_periods ptp
215 where ptp.payroll_id = l_payroll_id
216 and ptp.start_date > x_session_date
217 and rownum = 1;
218
219 hr_entry_api.update_element_entry
220 (p_dt_update_mode => 'UPDATE',
221 p_session_date => l_start_date,
222 p_element_entry_id => x_element_entry_id,
223 p_input_value_id1 => x_input_value_id1,
224 P_entry_value1 => x_entry_value1,
225 p_input_value_id2 => x_input_value_id2,
226 P_entry_value2 => x_entry_value2,
227 p_input_value_id3 => x_input_value_id3,
228 P_entry_value3 => x_entry_value3,
229 p_input_value_id4 => x_input_value_id4,
230 P_entry_value4 => x_entry_value4,
231 p_input_value_id5 => x_input_value_id5,
232 P_entry_value5 => 'Normal',
233 p_input_value_id6 => x_input_value_id6,
234 P_entry_value6 => 0,
235 p_input_value_id7 => x_input_value_id7,
236 P_entry_value7 => x_entry_value7,
237 p_input_value_id8 => x_input_value_id8,
238 P_entry_value8 => x_entry_value8
239 );
240 end if;
241
242 select e.effective_end_date
243 into l_effective_end_date
244 from pay_element_entries_f e
245 where e.element_entry_id = x_element_entry_id
246 and x_session_date between e.effective_start_date and
247 e.effective_end_date;
248 --
249 p_effective_end_date := l_effective_end_date;
250 --
251 END update_ni_entries;
252 --
253 -----------------------------------------------------------------------------
254 END PAY_UK_ELE_ENTRIES_PKG;