DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_UK_ELE_ENTRIES_PKG

Source


1 PACKAGE BODY PAY_UK_ELE_ENTRIES_PKG as
2 /* $Header: pygbeent.pkb 120.0.12010000.2 2009/05/12 12:12:20 jvaradra 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
22    				      in update_paye_entries to include x_entry_information1,
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
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    11-May-09  jvaradra        115.9   For bug 8485686
37                                       Variable pqp_gb_ad_ee.g_global_paye_validation is
38 						  intialized to 'N' and reset to 'Y' in the end
39 ==============================================================================*/
40 -----------------------------------------------------------------------------
41 -- Name                                                                    --
42 --   update_paye_entries                                                   --
43 -- Purpose                                                                 --
44 --   calls the hr_element_entry_api to perform updates to the PAYE element.--
45 -----------------------------------------------------------------------------
46 --
47 PROCEDURE update_paye_entries(
48                             x_dt_update_mode     varchar2,
49                             x_session_date       date,
50                             x_element_entry_id   number,
51                             x_input_value_id1    number,
52                             x_entry_value1       varchar2,
53                             x_input_value_id2    number,
54                             x_entry_value2       varchar2,
55                             x_input_value_id4    number,
56                             x_entry_value4       varchar2,
57                             x_input_value_id5    number,
58                             x_entry_value5       varchar2,
59                             x_input_value_id3    number,
60                             x_entry_value3       varchar2,
61                             x_input_value_id6    number,
62                             x_entry_value6       varchar2,
63                             x_entry_information1 varchar2,
64                             x_entry_information2 varchar2,
65                             x_entry_information_category varchar2,
66                             p_effective_end_date in out nocopy date)
67  IS
68 --
69        l_effective_end_date DATE;
70 
71        BEGIN
72 
73             -- For bug 8485686
74 		pqp_gb_ad_ee.g_global_paye_validation := 'N';
75 
76            hr_entry_api.update_element_entry
77              (p_dt_update_mode       => x_dt_update_mode,
78               p_session_date         => x_session_date,
79               p_element_entry_id     => x_element_entry_id,
80               p_input_value_id1      => x_input_value_id1,
81               P_entry_value1         => x_entry_value1,
82               p_input_value_id2      => x_input_value_id2,
83               P_entry_value2         => x_entry_value2,
84               p_input_value_id3      => x_input_value_id3,
85               P_entry_value3         => x_entry_value3,
86               p_input_value_id4      => x_input_value_id4,
87               P_entry_value4         => x_entry_value4,
88               p_input_value_id5      => x_input_value_id5,
89               P_entry_value5         => x_entry_value5,
90               p_input_value_id6      => x_input_value_id6,
91               P_entry_value6         => x_entry_value6,
92               P_entry_information1   => x_entry_information1,
93               P_entry_information2   => x_entry_information2,
94               P_entry_information_category => x_entry_information_category);
95 
96 
97             -- For bug 8485686
98 		pqp_gb_ad_ee.g_global_paye_validation := 'Y';
99 
100          select e.effective_end_date
101          into   l_effective_end_date
102          from pay_element_entries_f e
103          where e.element_entry_id = x_element_entry_id
104          and   x_session_date between e.effective_start_date and
105                                       e.effective_end_date;
106 
107           p_effective_end_date := l_effective_end_date;
108 
109        END update_paye_entries;
110 --
111 -----------------------------------------------------------------------------
112 -- Name                                                                    --
113 --   get_paye_formula_id                                                   --
114 -- Purpose                                                                 --
115 --   this function finds the formula id for the validation of the PAYE     --
116 --   tax_code element entry value.
117 -----------------------------------------------------------------------------
118 --
119 FUNCTION get_paye_formula_id RETURN NUMBER IS
120 
121   cursor c_formula is
122    select f.FORMULA_ID
123    from   ff_formulas_f f,
124           ff_formula_types t
125    where  t.FORMULA_TYPE_ID   = f.FORMULA_TYPE_ID
126      and    t.FORMULA_TYPE_NAME = 'Element Input Validation'
127      and    f.FORMULA_NAME      = 'TAX_CODE';
128 --
129   l_formula_id	NUMBER;
130 --
131 BEGIN
132 --
133   open c_formula;
134   fetch c_formula into l_formula_id;
135   if c_formula%notfound then
136   --
137     close c_formula;
138     --
139     fnd_message.set_name ('FF', 'FFX03A_FORMULA_NOT_FOUND');
140     fnd_message.set_token ('1','TAX_CODE');
141     fnd_message.raise_error;
142     --
143   end if;
144   close c_formula;
145   --
146   RETURN l_formula_id;
147 --
148 END get_paye_formula_id;
149 
150 -----------------------------------------------------------------------------
151 -- Name                                                                    --
152 --   update_ni_entries                                                     --
153 -- Purpose                                                                 --
154 --   calls the hr_element_entry_api to perform updates to the NI element.  --
155 -----------------------------------------------------------------------------
156 --
157 PROCEDURE update_ni_entries(
158                             x_dt_update_mode     varchar2,
159                             x_session_date       date,
160                             x_element_entry_id   number,
161                             x_input_value_id1    number,
162                             x_entry_value1       varchar2,
163                             x_input_value_id2    number,
164                             x_entry_value2       varchar2,
165                             x_input_value_id3    number,
166                             x_entry_value3       varchar2,
167                             x_input_value_id4    number,
168                             x_entry_value4       varchar2,
169                             x_input_value_id5    number,
170                             x_entry_value5       varchar2,
171                             x_input_value_id6    number,
172                             x_entry_value6       varchar2,
173                             x_input_value_id7    number,
174                             x_entry_value7       varchar2,
175                             x_input_value_id8    number,
176                             x_entry_value8       varchar2,
177                             P_effective_end_date IN OUT NOCOPY DATE)  IS
178 --
179 
180     l_effective_end_date DATE;
181     l_payroll_id         NUMBER;
182     l_start_date         DATE;
183 
184        BEGIN
185            hr_entry_api.update_element_entry
186              (p_dt_update_mode       => x_dt_update_mode,
187               p_session_date         => x_session_date,
188               p_element_entry_id     => x_element_entry_id,
189               p_input_value_id1      => x_input_value_id1,
190               P_entry_value1         => x_entry_value1,
191               p_input_value_id2      => x_input_value_id2,
192               P_entry_value2         => x_entry_value2,
193               p_input_value_id3      => x_input_value_id3,
194               P_entry_value3         => x_entry_value3,
195               p_input_value_id4      => x_input_value_id4,
196               P_entry_value4         => x_entry_value4,
197               p_input_value_id5      => x_input_value_id5,
198               P_entry_value5         => x_entry_value5,
199               p_input_value_id6      => x_input_value_id6,
200               P_entry_value6         => x_entry_value6,
201               p_input_value_id7      => x_input_value_id7,
202               P_entry_value7         => x_entry_value7,
203               p_input_value_id8      => x_input_value_id8,
204               P_entry_value8         => x_entry_value8
205            );
206 
207         /*****************************************/
208         /* Bug 2391897 -- see readme for details */
209         /*****************************************/
210         if (x_entry_value5 = 'Irregular Periods') OR (x_entry_value5 = 'Multiple Periods') Then
211            select ppf.payroll_id
212            into   l_payroll_id
213            from   pay_payrolls_f         ppf,
214                   per_assignments_f      paf,
215                   pay_element_entries_f  peef
216            where  peef.element_entry_id = x_element_entry_id
217              and  x_session_date between peef.effective_start_date and peef.effective_end_date
218              and  peef.assignment_id = paf.assignment_id
219              and  x_session_date between paf.effective_start_date and paf.effective_end_date
220              --BUG 2791911 Added one more condition
221              and  x_session_date between ppf.effective_start_date and ppf.effective_end_date
222              and  paf.payroll_id = ppf.payroll_id;
223 
224            select ptp.start_date
225            into   l_start_date
226 	   from   per_time_periods ptp
227            where  ptp.payroll_id =  l_payroll_id
228              and  ptp.start_date > x_session_date
229              and  rownum = 1;
230 
231             hr_entry_api.update_element_entry
232              (p_dt_update_mode       => 'UPDATE',
233               p_session_date         => l_start_date,
234               p_element_entry_id     => x_element_entry_id,
235               p_input_value_id1      => x_input_value_id1,
236               P_entry_value1         => x_entry_value1,
237               p_input_value_id2      => x_input_value_id2,
238               P_entry_value2         => x_entry_value2,
239               p_input_value_id3      => x_input_value_id3,
240               P_entry_value3         => x_entry_value3,
241               p_input_value_id4      => x_input_value_id4,
242               P_entry_value4         => x_entry_value4,
243               p_input_value_id5      => x_input_value_id5,
244               P_entry_value5         => 'Normal',
245               p_input_value_id6      => x_input_value_id6,
246               P_entry_value6         => 0,
247               p_input_value_id7      => x_input_value_id7,
248               P_entry_value7         => x_entry_value7,
249               p_input_value_id8      => x_input_value_id8,
250               P_entry_value8         => x_entry_value8
251            );
252          end if;
253 
254          select e.effective_end_date
255          into   l_effective_end_date
256          from pay_element_entries_f e
257          where e.element_entry_id = x_element_entry_id
258          and   x_session_date between e.effective_start_date and
259                                       e.effective_end_date;
260 --
261          p_effective_end_date := l_effective_end_date;
262 --
263        END update_ni_entries;
264 --
265 -----------------------------------------------------------------------------
266 END PAY_UK_ELE_ENTRIES_PKG;