[Home] [Help]
PACKAGE BODY: APPS.PAY_NL_WAGE_REPORT_PKG
Source
1 PACKAGE BODY pay_nl_wage_report_pkg AS
2 /* $Header: pynlwrar.pkb 120.7.12010000.4 2008/09/30 07:23:20 rsahai ship $ */
3 --------------------------------------------------------------------------------
4 -- Global Variables
5 --------------------------------------------------------------------------------
6 --
7 g_public_org_flag hr_lookups.lookup_type%TYPE;
8 g_risk_cover_flag hr_lookups.lookup_type%TYPE;
9 g_contract_code_mapping hr_lookups.lookup_type%TYPE;
10 g_retro_type VARCHAR2(3);
11 g_effective_date DATE;
12 --
13 --------------------------------------------------------------------------------
14 -- GET_ALL_PARAMETERS
15 --------------------------------------------------------------------------------
16 PROCEDURE get_all_parameters(p_payroll_action_id IN NUMBER
17 ,p_business_group_id OUT NOCOPY NUMBER
18 ,p_start_date OUT NOCOPY DATE
19 ,p_end_date OUT NOCOPY DATE
20 ,p_legal_employer OUT NOCOPY NUMBER
21 ,p_payroll_type OUT NOCOPY VARCHAR2
22 ,p_seq_no OUT NOCOPY VARCHAR2) IS
23 --
24 CURSOR csr_parameter_info (c_payroll_action_id NUMBER) IS
25 SELECT get_parameters(c_payroll_action_id, 'Legal_Employer')
26 ,get_parameters(c_payroll_action_id, 'Payroll_Type')
27 ,get_parameters(c_payroll_action_id, 'Sequence_Number')
28 ,start_date
29 ,effective_date
30 ,business_group_id
31 FROM pay_payroll_actions
32 WHERE payroll_action_id = c_payroll_action_id;
33 --
34 BEGIN
35 --
36 OPEN csr_parameter_info (p_payroll_action_id);
37 FETCH csr_parameter_info INTO p_legal_employer
38 ,p_payroll_type
39 ,p_seq_no
40 ,p_start_date
41 ,p_end_date
42 ,p_business_group_id;
43 CLOSE csr_parameter_info;
44 IF p_payroll_type = 'YEARLY' THEN
45 p_start_date := to_date('01-01-'||to_char(p_end_date,'YYYY'),'dd-mm-yyyy');
46 p_end_date := to_date('31-12-'||to_char(p_end_date,'YYYY'),'dd-mm-yyyy');
47 END IF;
48 --
49 END;
50 --------------------------------------------------------------------------------
51 -- GET_PARAMETERS
52 --------------------------------------------------------------------------------
53 FUNCTION get_parameters(p_payroll_action_id IN NUMBER,
54 p_token_name IN VARCHAR2) RETURN VARCHAR2 IS
55 CURSOR csr_parameter_info IS
56 SELECT SUBSTR(legislative_parameters,
57 INSTR(legislative_parameters,p_token_name)+(LENGTH(p_token_name)+1),
58 INSTR(legislative_parameters,' ',INSTR(legislative_parameters,p_token_name))
59 -(INSTR(legislative_parameters,p_token_name)+(LENGTH(p_token_name)+1)))
60 FROM pay_payroll_actions
61 WHERE payroll_action_id = p_payroll_action_id;
62 --
63 l_token_value VARCHAR2(50);
64 --
65 BEGIN
66 --
67 OPEN csr_parameter_info;
68 FETCH csr_parameter_info INTO l_token_value;
69 CLOSE csr_parameter_info;
70 return(l_token_value);
71 END get_parameters;
72 --------------------------------------------------------------------------------
73 -- RANGE_CODE
74 --------------------------------------------------------------------------------
75 PROCEDURE archive_range_code(p_actid IN NUMBER
76 ,sqlstr OUT NOCOPY VARCHAR2)
77 IS
78 --
79 BEGIN
80 --
81 -- Return Range Cursor
82 -- Note: There must be one and only one entry of :payroll_action_id in
83 -- the string, and the statement must be ordered by person_id
84 --
85 sqlstr := 'select distinct person_id '||
86 'from per_people_f ppf, '||
87 'pay_payroll_actions ppa '||
88 'where ppa.payroll_action_id = :payroll_action_id '||
89 'and ppa.business_group_id = ppf.business_group_id '||
90 'order by ppf.person_id';
91 --
92 EXCEPTION
93 WHEN OTHERS THEN
94 -- Return cursor that selects no rows
95 sqlstr := 'select 1 '||
96 '/* ERROR - Employer Details Fetch failed with: '||
97 sqlerrm(sqlcode)||' */ '||
98 'from dual where to_char(:payroll_action_id) = dummy';
99 hr_utility.set_location(' Leaving: range code',110);
100 END archive_range_code;
101 --------------------------------------------------------------------------------
102 -- get_defined_balance_id pay_nl_wage_report_pkg.get_defined_balance_id
103 --------------------------------------------------------------------------------
104 FUNCTION get_defined_balance_id(p_balance_name VARCHAR2
105 ,p_database_item_suffix VARCHAR2) RETURN NUMBER IS
106 --
107 CURSOR csr_get_bal_info(c_balance_name VARCHAR2
108 ,c_database_item_suffix VARCHAR2) IS
109 SELECT pdb.defined_balance_id
110 FROM pay_balance_types pbt
111 ,pay_balance_dimensions pbd
112 ,pay_defined_balances pdb
113 WHERE pbt.balance_name = c_balance_name
114 AND pbt.legislation_code = 'NL'
115 AND pbd.database_item_suffix = c_database_item_suffix
116 AND pbd.legislation_code = 'NL'
117 AND pdb.balance_type_id = pbt.balance_type_id
118 AND pdb.balance_dimension_id = pbd.balance_dimension_id;
119 --
120 l_defined_bal_id NUMBER;
121 --
122 --
123 BEGIN
124 --
125 l_defined_bal_id := 0;
126 --
127 OPEN csr_get_bal_info(p_balance_name,p_database_item_suffix);
128 FETCH csr_get_bal_info INTO l_defined_bal_id;
129 CLOSE csr_get_bal_info;
130 --
131 RETURN(l_defined_bal_id);
132 --
133 END get_defined_balance_id;
134 --
135 --------------------------------------------------------------------------------
136 -- populate_balance_table pay_nl_wage_report_pkg.populate_balance_table
137 --------------------------------------------------------------------------------
138 PROCEDURE populate_nom_balance_table(p_payroll_type VARCHAR2) IS
139 --
140 --
141 l_index NUMBER;
142 l_asg_ptd VARCHAR2(30);
143 l_asg_adj_ptd VARCHAR2(30);
144 l_asg_corr_ptd VARCHAR2(30);
145 l_asg_sit_ptd VARCHAR2(30);
146 l_asg_sit_adj_ptd VARCHAR2(30);
147 l_asg_sit_corr_ptd VARCHAR2(30);
148 --
149 BEGIN
150 --
151 l_asg_ptd := '_ASG_PTD';
152 l_asg_adj_ptd := '_ASG_ADJ_PTD';
153 l_asg_corr_ptd := '_ASG_REPORT_CORR_PTD';
154 l_asg_sit_ptd := '_ASG_SIT_PTD';
155 l_asg_sit_adj_ptd := '_ASG_SIT_ADJ_PTD';
156 l_asg_sit_corr_ptd := '_ASG_SIT_REPORT_CORR_PTD';
157 --
158 IF g_retro_type = 'NEW' THEN
159 l_asg_adj_ptd := NULL;
160 l_asg_corr_ptd := '_ASG_BDATE_PTD';
161 l_asg_sit_adj_ptd := NULL;
162 l_asg_sit_corr_ptd := '_ASG_BDATE_SIT_PTD';
163 END IF;
164 --
165 IF p_payroll_type = 'YEARLY' THEN
166 l_asg_ptd := '_ASG_TU_YTD';
167 l_asg_adj_ptd := NULL;
168 l_asg_corr_ptd := '_ASG_TU_YTD';
169 l_asg_sit_ptd := '_ASG_TU_SIT_YTD';
170 l_asg_sit_adj_ptd := NULL;
171 l_asg_sit_corr_ptd := '_ASG_TU_SIT_YTD';
172 END IF;
173 --
174 g_nom_bal_def_table.delete;
175 l_index := 1;
176 --
177 g_nom_bal_def_table(l_index).balance_name := 'Standard Taxable Income'; --1
178 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
179 g_nom_bal_def_table(l_index).context := NULL;
180 g_nom_bal_def_table(l_index).context_val := NULL;
181 l_index := l_index + 1;
182 --
183 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Taxable Income Current Quarter';
184 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
185 g_nom_bal_def_table(l_index).context := NULL;
186 g_nom_bal_def_table(l_index).context_val := NULL;
187 l_index := l_index + 1;
188 --
189 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Taxable Income Current Quarter';
190 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
191 g_nom_bal_def_table(l_index).context := NULL;
192 g_nom_bal_def_table(l_index).context_val := NULL;
193 l_index := l_index + 1;
194 --
195 g_nom_bal_def_table(l_index).balance_name := 'SI Income Standard Tax';
196 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
197 g_nom_bal_def_table(l_index).context := NULL;
198 g_nom_bal_def_table(l_index).context_val := NULL;
199 l_index := l_index + 1;
200 --
201 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Standard Tax'; --5
202 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
203 g_nom_bal_def_table(l_index).context := NULL;
204 g_nom_bal_def_table(l_index).context_val := NULL;
205 l_index := l_index + 1;
206 --
207 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Standard Tax';
208 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
209 g_nom_bal_def_table(l_index).context := NULL;
210 g_nom_bal_def_table(l_index).context_val := NULL;
211 l_index := l_index + 1;
212 --
213 g_nom_bal_def_table(l_index).balance_name := 'SI Income Special Tax';
214 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
215 g_nom_bal_def_table(l_index).context := NULL;
216 g_nom_bal_def_table(l_index).context_val := NULL;
217 l_index := l_index + 1;
218 --
219 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Special Tax';
220 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
221 g_nom_bal_def_table(l_index).context := NULL;
222 g_nom_bal_def_table(l_index).context_val := NULL;
223 l_index := l_index + 1;
224 --
225 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Special Tax';
226 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
227 g_nom_bal_def_table(l_index).context := NULL;
228 g_nom_bal_def_table(l_index).context_val := NULL;
229 l_index := l_index + 1;
230 --
231 g_nom_bal_def_table(l_index).balance_name := 'SI Income Non Taxable'; --10
232 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
233 g_nom_bal_def_table(l_index).context := NULL;
234 g_nom_bal_def_table(l_index).context_val := NULL;
235 l_index := l_index + 1;
236 --
237 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Non Taxable';
238 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
239 g_nom_bal_def_table(l_index).context := NULL;
240 g_nom_bal_def_table(l_index).context_val := NULL;
241 l_index := l_index + 1;
242 --
243 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Non Taxable';
244 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
245 g_nom_bal_def_table(l_index).context := NULL;
246 g_nom_bal_def_table(l_index).context_val := NULL;
247 l_index := l_index + 1;
248 --
249 g_nom_bal_def_table(l_index).balance_name := 'Special Taxable Income';
250 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
251 g_nom_bal_def_table(l_index).context := NULL;
252 g_nom_bal_def_table(l_index).context_val := NULL;
253 l_index := l_index + 1;
254 --
255 g_nom_bal_def_table(l_index).balance_name := 'Retro Special Taxable Income';
256 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
257 g_nom_bal_def_table(l_index).context := NULL;
258 g_nom_bal_def_table(l_index).context_val := NULL;
259 l_index := l_index + 1;
260 --
261 g_nom_bal_def_table(l_index).balance_name := 'Retro Special Taxable Income'; --15
262 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
263 g_nom_bal_def_table(l_index).context := NULL;
264 g_nom_bal_def_table(l_index).context_val := NULL;
265 l_index := l_index + 1;
266 --
267 g_nom_bal_def_table(l_index).balance_name := 'Holiday Allowance Payment';
268 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
269 g_nom_bal_def_table(l_index).context := NULL;
270 g_nom_bal_def_table(l_index).context_val := NULL;
271 l_index := l_index + 1;
272 --
273 g_nom_bal_def_table(l_index).balance_name := 'Reservation Holiday Allowance';
274 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
275 g_nom_bal_def_table(l_index).context := NULL;
276 g_nom_bal_def_table(l_index).context_val := NULL;
277 l_index := l_index + 1;
278 --
279 g_nom_bal_def_table(l_index).balance_name := 'Additional Period Wage';
280 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
281 g_nom_bal_def_table(l_index).context := NULL;
282 g_nom_bal_def_table(l_index).context_val := NULL;
283 l_index := l_index + 1;
284 --
285 g_nom_bal_def_table(l_index).balance_name := 'Reservation Additional Period Wage';
286 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
287 g_nom_bal_def_table(l_index).context := NULL;
288 g_nom_bal_def_table(l_index).context_val := NULL;
289 l_index := l_index + 1;
290 --
291 g_nom_bal_def_table(l_index).balance_name := 'Wage In Money Standard Tax SI'; --20
292 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
293 g_nom_bal_def_table(l_index).context := NULL;
294 g_nom_bal_def_table(l_index).context_val := NULL;
295 l_index := l_index + 1;
296 --
297 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Standard Tax SI';
298 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
299 g_nom_bal_def_table(l_index).context := NULL;
300 g_nom_bal_def_table(l_index).context_val := NULL;
301 l_index := l_index + 1;
302 --
303 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Standard Tax SI';
304 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
305 g_nom_bal_def_table(l_index).context := NULL;
306 g_nom_bal_def_table(l_index).context_val := NULL;
307 l_index := l_index + 1;
308 --
309 g_nom_bal_def_table(l_index).balance_name := 'Wage In Money Special Tax SI';
310 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
311 g_nom_bal_def_table(l_index).context := NULL;
312 g_nom_bal_def_table(l_index).context_val := NULL;
313 l_index := l_index + 1;
314 --
315 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Special Tax SI';
316 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
317 g_nom_bal_def_table(l_index).context := NULL;
318 g_nom_bal_def_table(l_index).context_val := NULL;
319 l_index := l_index + 1;
320 --
321 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Special Tax SI'; --25
322 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
323 g_nom_bal_def_table(l_index).context := NULL;
324 g_nom_bal_def_table(l_index).context_val := NULL;
325 l_index := l_index + 1;
326 --
327 g_nom_bal_def_table(l_index).balance_name := 'Wage In Kind Standard Tax SI';
328 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
329 g_nom_bal_def_table(l_index).context := NULL;
330 g_nom_bal_def_table(l_index).context_val := NULL;
331 l_index := l_index + 1;
332 --
333 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Standard Tax SI';
334 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
335 g_nom_bal_def_table(l_index).context := NULL;
336 g_nom_bal_def_table(l_index).context_val := NULL;
337 l_index := l_index + 1;
338 --
339 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Standard Tax SI';
340 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
341 g_nom_bal_def_table(l_index).context := NULL;
342 g_nom_bal_def_table(l_index).context_val := NULL;
343 l_index := l_index + 1;
344 --
345 g_nom_bal_def_table(l_index).balance_name := 'Wage In Kind Special Tax SI';
346 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
347 g_nom_bal_def_table(l_index).context := NULL;
348 g_nom_bal_def_table(l_index).context_val := NULL;
349 l_index := l_index + 1;
350 --
351 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Special Tax SI'; --30
352 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
353 g_nom_bal_def_table(l_index).context := NULL;
354 g_nom_bal_def_table(l_index).context_val := NULL;
355 l_index := l_index + 1;
356 --
357 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Special Tax SI';
358 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
359 g_nom_bal_def_table(l_index).context := NULL;
360 g_nom_bal_def_table(l_index).context_val := NULL;
361 l_index := l_index + 1;
362 --
363 g_nom_bal_def_table(l_index).balance_name := 'Tips and Fund Payments Standard Tax SI';
364 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
365 g_nom_bal_def_table(l_index).context := NULL;
366 g_nom_bal_def_table(l_index).context_val := NULL;
367 l_index := l_index + 1;
368 --
369 g_nom_bal_def_table(l_index).balance_name := 'Retro Tips and Fund Payments Standard Tax SI';
370 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
371 g_nom_bal_def_table(l_index).context := NULL;
372 g_nom_bal_def_table(l_index).context_val := NULL;
373 l_index := l_index + 1;
374 --
375 g_nom_bal_def_table(l_index).balance_name := 'Retro Tips and Fund Payments Standard Tax SI';
376 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
377 g_nom_bal_def_table(l_index).context := NULL;
378 g_nom_bal_def_table(l_index).context_val := NULL;
379 l_index := l_index + 1;
380 --
381 g_nom_bal_def_table(l_index).balance_name := 'Tips and Fund Payments Special Tax SI'; --35
382 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
383 g_nom_bal_def_table(l_index).context := NULL;
384 g_nom_bal_def_table(l_index).context_val := NULL;
385 l_index := l_index + 1;
386 --
387 g_nom_bal_def_table(l_index).balance_name := 'Retro Tips and Fund Payments Special Tax SI';
388 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
389 g_nom_bal_def_table(l_index).context := NULL;
390 g_nom_bal_def_table(l_index).context_val := NULL;
391 l_index := l_index + 1;
392 --
393 g_nom_bal_def_table(l_index).balance_name := 'Retro Tips and Fund Payments Special Tax SI';
394 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
395 g_nom_bal_def_table(l_index).context := NULL;
396 g_nom_bal_def_table(l_index).context_val := NULL;
397 l_index := l_index + 1;
398 --
399 g_nom_bal_def_table(l_index).balance_name := 'Overtime';
400 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
401 g_nom_bal_def_table(l_index).context := NULL;
402 g_nom_bal_def_table(l_index).context_val := NULL;
403 l_index := l_index + 1;
404 --
405 g_nom_bal_def_table(l_index).balance_name := 'Standard Tax Deduction';
406 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
407 g_nom_bal_def_table(l_index).context := NULL;
408 g_nom_bal_def_table(l_index).context_val := NULL;
409 l_index := l_index + 1;
410 --
411 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Tax Deduction Current Quarter'; --40
412 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
413 g_nom_bal_def_table(l_index).context := NULL;
414 g_nom_bal_def_table(l_index).context_val := NULL;
415 l_index := l_index + 1;
416 --
417 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Tax Deduction Current Quarter';
418 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
419 g_nom_bal_def_table(l_index).context := NULL;
420 g_nom_bal_def_table(l_index).context_val := NULL;
421 l_index := l_index + 1;
422 --
423 g_nom_bal_def_table(l_index).balance_name := 'Special Tax Deduction';
424 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
425 g_nom_bal_def_table(l_index).context := NULL;
426 g_nom_bal_def_table(l_index).context_val := NULL;
427 l_index := l_index + 1;
428 --
429 g_nom_bal_def_table(l_index).balance_name := 'Retro Special Tax Deduction';
430 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
431 g_nom_bal_def_table(l_index).context := NULL;
432 g_nom_bal_def_table(l_index).context_val := NULL;
433 l_index := l_index + 1;
434 --
435 g_nom_bal_def_table(l_index).balance_name := 'Retro Special Tax Deduction';
436 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
437 g_nom_bal_def_table(l_index).context := NULL;
438 g_nom_bal_def_table(l_index).context_val := NULL;
439 l_index := l_index + 1;
440 --
441 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution'; --45
442 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
443 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
444 g_nom_bal_def_table(l_index).context_val := 'WAOB';
445 l_index := l_index + 1;
446 --
447 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
448 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
449 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
450 g_nom_bal_def_table(l_index).context_val := 'WAOB';
451 l_index := l_index + 1;
452 --
453 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
454 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
455 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
456 g_nom_bal_def_table(l_index).context_val := 'WAOB';
457 l_index := l_index + 1;
458 --
459 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution';
460 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
461 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
462 g_nom_bal_def_table(l_index).context_val := 'WGA';
463 l_index := l_index + 1;
464 --
465 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
466 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
467 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
468 g_nom_bal_def_table(l_index).context_val := 'WGA';
469 l_index := l_index + 1;
470 --
471 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution'; --50
472 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
473 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
474 g_nom_bal_def_table(l_index).context_val := 'WGA';
475 l_index := l_index + 1;
476 --
477 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution';
478 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
479 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
480 g_nom_bal_def_table(l_index).context_val := 'IVA';
481 l_index := l_index + 1;
482 --
483 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
484 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
485 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
486 g_nom_bal_def_table(l_index).context_val := 'IVA';
487 l_index := l_index + 1;
488 --
489 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
490 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
491 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
492 g_nom_bal_def_table(l_index).context_val := 'IVA';
493 l_index := l_index + 1;
494 --
495 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution';
496 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
497 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
498 g_nom_bal_def_table(l_index).context_val := 'WAOD';
499 l_index := l_index + 1;
500 --
501 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution'; --55
502 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
503 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
504 g_nom_bal_def_table(l_index).context_val := 'WAOD';
505 l_index := l_index + 1;
506 --
507 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
508 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
509 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
510 g_nom_bal_def_table(l_index).context_val := 'WAOD';
511 l_index := l_index + 1;
512 --
513 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution';
514 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
515 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
516 g_nom_bal_def_table(l_index).context_val := 'WEWE';
517 l_index := l_index + 1;
518 --
519 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
520 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
521 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
522 g_nom_bal_def_table(l_index).context_val := 'WEWE';
523 l_index := l_index + 1;
524 --
525 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
526 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
527 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
528 g_nom_bal_def_table(l_index).context_val := 'WEWE';
529 l_index := l_index + 1;
530 --
531 g_nom_bal_def_table(l_index).balance_name :='Wage Report SI Contribution'; --60
532 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
533 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
534 g_nom_bal_def_table(l_index).context_val := 'WEWA';
535 l_index := l_index + 1;
536 --
537 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
538 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
539 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
540 g_nom_bal_def_table(l_index).context_val := 'WEWA';
541 l_index := l_index + 1;
542 --
543 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
544 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
545 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
546 g_nom_bal_def_table(l_index).context_val := 'WEWA';
547 l_index := l_index + 1;
548 --
549 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution';
550 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
551 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
552 g_nom_bal_def_table(l_index).context_val := 'UFO';
553 l_index := l_index + 1;
554 --
555 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
556 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
557 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
558 g_nom_bal_def_table(l_index).context_val := 'UFO';
559 l_index := l_index + 1;
560 --
561 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution'; --65
562 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
563 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
564 g_nom_bal_def_table(l_index).context_val := 'UFO';
565 l_index := l_index + 1;
566 --
567 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Employee SI Contribution';
568 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
569 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
570 g_nom_bal_def_table(l_index).context_val := 'ZVW';
571 l_index := l_index + 1;
572 --
573 g_nom_bal_def_table(l_index).balance_name :='Wage Report Retro Employee SI Contribution';
574 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
575 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
576 g_nom_bal_def_table(l_index).context_val := 'ZVW';
577 l_index := l_index + 1;
578 --
579 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro Employee SI Contribution';
580 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
581 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
582 g_nom_bal_def_table(l_index).context_val := 'ZVW';
583 l_index := l_index + 1;
584 --
585 g_nom_bal_def_table(l_index).balance_name := 'Tax Travel Allowance';
586 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
587 g_nom_bal_def_table(l_index).context := NULL;
588 g_nom_bal_def_table(l_index).context_val := NULL;
589 l_index := l_index + 1;
590 --
591 g_nom_bal_def_table(l_index).balance_name := 'Labour Tax Reduction'; -- 70
592 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
593 g_nom_bal_def_table(l_index).context := NULL;
594 g_nom_bal_def_table(l_index).context_val := NULL;
595 l_index := l_index + 1;
596 --
597 g_nom_bal_def_table(l_index).balance_name := 'Retro Labour Tax Reduction';
598 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
599 g_nom_bal_def_table(l_index).context := NULL;
600 g_nom_bal_def_table(l_index).context_val := NULL;
601 l_index := l_index + 1;
602 --
603 g_nom_bal_def_table(l_index).balance_name := 'Retro Labour Tax Reduction';
604 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
605 g_nom_bal_def_table(l_index).context := NULL;
606 g_nom_bal_def_table(l_index).context_val := NULL;
607 l_index := l_index + 1;
608 --
609 g_nom_bal_def_table(l_index).balance_name := 'Real Social Insurance Days';
610 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
611 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
612 g_nom_bal_def_table(l_index).context_val := 'ZVW';
613 l_index := l_index + 1;
614 --
615 g_nom_bal_def_table(l_index).balance_name := 'Retro Real Social Insurance Days';
616 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
617 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
618 g_nom_bal_def_table(l_index).context_val := 'ZVW';
619 l_index := l_index + 1;
620 --
621 g_nom_bal_def_table(l_index).balance_name := 'Retro Real Social Insurance Days'; -- 75
622 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
623 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
624 g_nom_bal_def_table(l_index).context_val := 'ZVW';
625 l_index := l_index + 1;
626 --
627 g_nom_bal_def_table(l_index).balance_name := 'Hours Worked';
628 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
629 g_nom_bal_def_table(l_index).context := NULL;
630 g_nom_bal_def_table(l_index).context_val := NULL;
631 l_index := l_index + 1;
632 --
633 g_nom_bal_def_table(l_index).balance_name := 'Tax Sea Days Discount';
634 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
635 g_nom_bal_def_table(l_index).context := NULL;
636 g_nom_bal_def_table(l_index).context_val := NULL;
637 l_index := l_index + 1;
638 --
639 g_nom_bal_def_table(l_index).balance_name := 'WWB Allowance Paid Alimony';
640 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
641 g_nom_bal_def_table(l_index).context := NULL;
642 g_nom_bal_def_table(l_index).context_val := NULL;
643 l_index := l_index + 1;
644 --
645 g_nom_bal_def_table(l_index).balance_name := 'Directly Paid Alimony';
646 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
647 g_nom_bal_def_table(l_index).context := NULL;
648 g_nom_bal_def_table(l_index).context_val := NULL;
649 l_index := l_index + 1;
650 --
651 g_nom_bal_def_table(l_index).balance_name := 'Employer SI Contribution Non Taxable'; --80
652 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
653 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
654 g_nom_bal_def_table(l_index).context_val := 'ZVW';
655 l_index := l_index + 1;
656 --
657 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer SI Contribution Non Taxable';
658 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
659 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
660 g_nom_bal_def_table(l_index).context_val := 'ZVW';
661 l_index := l_index + 1;
662 --
663 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer SI Contribution Non Taxable'; -- 82
664 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
665 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
666 g_nom_bal_def_table(l_index).context_val := 'ZVW';
667 l_index := l_index + 1;
668 --
669 g_nom_bal_def_table(l_index).balance_name := 'Employer ZVW Contribution Special Tax';
670 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
671 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
672 g_nom_bal_def_table(l_index).context_val := 'ZVW';
673 l_index := l_index + 1;
674 --
675 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer ZVW Contribution Special Tax';
676 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
677 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
678 g_nom_bal_def_table(l_index).context_val := 'ZVW';
679 l_index := l_index + 1;
680 --
681 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer ZVW Contribution Special Tax'; --85
682 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
683 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
684 g_nom_bal_def_table(l_index).context_val := 'ZVW';
685 l_index := l_index + 1;
686 --
687 g_nom_bal_def_table(l_index).balance_name := 'Employer ZVW Contribution Standard Tax';
688 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
689 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
690 g_nom_bal_def_table(l_index).context_val := 'ZVW';
691 l_index := l_index + 1;
692 --
693 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer ZVW Contribution Standard Tax'; -- 87
694 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
695 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
696 g_nom_bal_def_table(l_index).context_val := 'ZVW';
697 l_index := l_index + 1;
698 --
699 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer ZVW Contribution Standard Tax';
700 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
701 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
702 g_nom_bal_def_table(l_index).context_val := 'ZVW';
703 l_index := l_index + 1;
704 --
705 g_nom_bal_def_table(l_index).balance_name := 'Employer SI Contribution';
706 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
707 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
708 g_nom_bal_def_table(l_index).context_val := 'ZVW';
709 l_index := l_index + 1;
710 --
711 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer SI Contribution';
712 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd; -- 90
713 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
714 g_nom_bal_def_table(l_index).context_val := 'ZVW';
715 l_index := l_index + 1;
716 --
717 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer SI Contribution'; -- 91
718 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
719 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
720 g_nom_bal_def_table(l_index).context_val := 'ZVW';
721 l_index := l_index + 1;
722 --
723 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Taxable Income'; -- 92
724 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
725 g_nom_bal_def_table(l_index).context := NULL;
726 g_nom_bal_def_table(l_index).context_val := NULL;
727 l_index := l_index + 1;
728 --
729 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Taxable Income';
730 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
731 g_nom_bal_def_table(l_index).context := NULL;
732 g_nom_bal_def_table(l_index).context_val := NULL;
733 l_index := l_index + 1;
734 --
735 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Tax Deduction'; -- 94
736 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
737 g_nom_bal_def_table(l_index).context := NULL;
738 g_nom_bal_def_table(l_index).context_val := NULL;
739 l_index := l_index + 1;
740 --
741 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Tax Deduction'; -- 95
742 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
743 g_nom_bal_def_table(l_index).context := NULL;
744 g_nom_bal_def_table(l_index).context_val := NULL;
745 l_index := l_index + 1;
746 -- Wage In Money
747 g_nom_bal_def_table(l_index).balance_name := 'Wage In Money Standard Tax Only'; --96
748 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
749 g_nom_bal_def_table(l_index).context := NULL;
750 g_nom_bal_def_table(l_index).context_val := NULL;
751 l_index := l_index + 1;
752 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Standard Tax Only'; -- 97
753 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
754 g_nom_bal_def_table(l_index).context := NULL;
755 g_nom_bal_def_table(l_index).context_val := NULL;
756 l_index := l_index + 1;
757 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Standard Tax Only';
758 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
759 g_nom_bal_def_table(l_index).context := NULL;
760 g_nom_bal_def_table(l_index).context_val := NULL;
761 l_index := l_index + 1;
762 --
763 g_nom_bal_def_table(l_index).balance_name := 'Wage In Money Special Tax Only';
764 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
765 g_nom_bal_def_table(l_index).context := NULL;
766 g_nom_bal_def_table(l_index).context_val := NULL;
767 l_index := l_index + 1;
768 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Special Tax Only'; --100
769 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
770 g_nom_bal_def_table(l_index).context := NULL;
771 g_nom_bal_def_table(l_index).context_val := NULL;
772 l_index := l_index + 1;
773 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Special Tax Only'; -- 101
774 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
775 g_nom_bal_def_table(l_index).context := NULL;
776 g_nom_bal_def_table(l_index).context_val := NULL;
777 l_index := l_index + 1;
778 -- Wage In Kind
779 g_nom_bal_def_table(l_index).balance_name := 'Wage In Kind Standard Tax Only'; -- 102
780 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
781 g_nom_bal_def_table(l_index).context := NULL;
782 g_nom_bal_def_table(l_index).context_val := NULL;
783 l_index := l_index + 1;
784 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Standard Tax Only';
785 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
786 g_nom_bal_def_table(l_index).context := NULL;
787 g_nom_bal_def_table(l_index).context_val := NULL;
788 l_index := l_index + 1;
789 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Standard Tax Only';
790 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
791 g_nom_bal_def_table(l_index).context := NULL;
792 g_nom_bal_def_table(l_index).context_val := NULL;
793 l_index := l_index + 1;
794 --
795 g_nom_bal_def_table(l_index).balance_name := 'Wage In Kind Special Tax Only'; --105
796 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
797 g_nom_bal_def_table(l_index).context := NULL;
798 g_nom_bal_def_table(l_index).context_val := NULL;
799 l_index := l_index + 1;
800 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Special Tax Only';
801 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
802 g_nom_bal_def_table(l_index).context := NULL;
803 g_nom_bal_def_table(l_index).context_val := NULL;
804 l_index := l_index + 1;
805 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Special Tax Only'; -- 107
806 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
807 g_nom_bal_def_table(l_index).context := NULL;
808 g_nom_bal_def_table(l_index).context_val := NULL;
809 l_index := l_index + 1;
810 --
811 g_nom_bal_def_table(l_index).balance_name := 'Value Private Usage Company Car'; --108
812 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
813 g_nom_bal_def_table(l_index).context := NULL;
814 g_nom_bal_def_table(l_index).context_val := NULL;
815 l_index := l_index + 1;
816 g_nom_bal_def_table(l_index).balance_name := 'Employee Value Private Usage Company Car'; --109
817 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
818 g_nom_bal_def_table(l_index).context := NULL;
819 g_nom_bal_def_table(l_index).context_val := NULL;
820 l_index := l_index + 1;
821 g_nom_bal_def_table(l_index).balance_name := 'Child Care Employer Contribution'; -- 110
822 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
823 g_nom_bal_def_table(l_index).context := NULL;
824 g_nom_bal_def_table(l_index).context_val := NULL;
825 l_index := l_index + 1;
826 g_nom_bal_def_table(l_index).balance_name := 'Employee Life Savings Contribution'; -- 111
827 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
828 g_nom_bal_def_table(l_index).context := NULL;
829 g_nom_bal_def_table(l_index).context_val := NULL;
830 l_index := l_index + 1;
831 g_nom_bal_def_table(l_index).balance_name := 'Life Cycle Leave Discount'; -- 112
832 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
833 g_nom_bal_def_table(l_index).context := NULL;
834 g_nom_bal_def_table(l_index).context_val := NULL;
835 l_index := l_index + 1;
836 g_nom_bal_def_table(l_index).balance_name := 'Paid Disability Allowance'; -- 113
837 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
838 g_nom_bal_def_table(l_index).context := NULL;
839 g_nom_bal_def_table(l_index).context_val := NULL;
840 l_index := l_index + 1;
841 --
842 g_nom_bal_def_table(l_index).balance_name := 'Standard Tax Correction'; -- 114
843 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
844 g_nom_bal_def_table(l_index).context := NULL;
845 g_nom_bal_def_table(l_index).context_val := NULL;
846 l_index := l_index + 1;
847 g_nom_bal_def_table(l_index).balance_name := 'Special Tax Correction'; -- 115
848 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
849 g_nom_bal_def_table(l_index).context := NULL;
850 g_nom_bal_def_table(l_index).context_val := NULL;
851 l_index := l_index + 1;
852 --
853 g_nom_bal_def_table(l_index).balance_name := 'Retro Tax Travel Allowance'; -- 116
854 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
855 g_nom_bal_def_table(l_index).context := NULL;
856 g_nom_bal_def_table(l_index).context_val := NULL;
857 l_index := l_index + 1;
858 g_nom_bal_def_table(l_index).balance_name := 'Retro Tax Travel Allowance'; -- 117
859 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
860 g_nom_bal_def_table(l_index).context := NULL;
861 g_nom_bal_def_table(l_index).context_val := NULL;
862 l_index := l_index + 1;
863 g_nom_bal_def_table(l_index).balance_name := 'Retro Additional Period Wage'; -- 118
864 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
865 g_nom_bal_def_table(l_index).context := NULL;
866 g_nom_bal_def_table(l_index).context_val := NULL;
867 l_index := l_index + 1;
868 g_nom_bal_def_table(l_index).balance_name := 'Retro Additional Period Wage'; -- 119
869 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
870 g_nom_bal_def_table(l_index).context := NULL;
871 g_nom_bal_def_table(l_index).context_val := NULL;
872 l_index := l_index + 1;
873 g_nom_bal_def_table(l_index).balance_name := 'Retro Life Cycle Leave Discount'; -- 120
874 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
875 g_nom_bal_def_table(l_index).context := NULL;
876 g_nom_bal_def_table(l_index).context_val := NULL;
877 l_index := l_index + 1;
878 g_nom_bal_def_table(l_index).balance_name := 'Retro Life Cycle Leave Discount'; -- 121
879 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
880 g_nom_bal_def_table(l_index).context := NULL;
881 g_nom_bal_def_table(l_index).context_val := NULL;
882 l_index := l_index + 1;
883 g_nom_bal_def_table(l_index).balance_name := 'Employer Life Savings Contribution'; -- 122
884 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
885 g_nom_bal_def_table(l_index).context := NULL;
886 g_nom_bal_def_table(l_index).context_val := NULL;
887 l_index := l_index + 1;
888 --
889 FOR i in g_nom_bal_def_table.FIRST..g_nom_bal_def_table.LAST LOOP
890 g_nom_bal_def_table(i).defined_balance_id := get_defined_balance_id(g_nom_bal_def_table(i).balance_name
891 ,g_nom_bal_def_table(i).database_item_suffix);
892 END LOOP;
893 --
894 END populate_nom_balance_table;
895 --
896 --------------------------------------------------------------------------------
897 -- populate_col_balance_values pay_nl_wage_report_pkg.populate_col_balance_values
898 --------------------------------------------------------------------------------
899 PROCEDURE populate_col_balance_values(p_col_bal_def_table IN OUT NOCOPY BAL_COL_TABLE
900 ,p_tax_unit_id IN NUMBER
901 ,p_effective_date IN DATE
902 ,p_balance_date IN DATE
903 ,p_type IN VARCHAR2
904 ,p_si_provider IN VARCHAR2
905 ,p_ass_action_id IN NUMBER) IS
906 --
907 l_balance_date DATE;
908 l_context_id NUMBER;
909 l_tax_unit_id NUMBER;
910 l_date_earned DATE;
911 l_source_text VARCHAR2(30);
912 l_source_text2 VARCHAR2(30);
913 --
914 CURSOR cur_act_contexts(p_context_name VARCHAR2 )IS
915 SELECT ffc.context_id
916 FROM ff_contexts ffc
917 WHERE ffc.context_name = p_context_name;
918 --
919 BEGIN
920 --
921 --##--Fnd_file.put_line(FND_FILE.LOG,'#### balance value ');
922 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_effective_date '||p_effective_date);
923 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_tax_unit_id '||p_tax_unit_id);
924 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_col_bal_def_table.count '||p_col_bal_def_table.count);
925 --
926 FOR i IN p_col_bal_def_table.FIRST..p_col_bal_def_table.LAST LOOP
927 p_col_bal_def_table(i).balance_value := 0;
928 p_col_bal_def_table(i).balance_value2 := 0;
929 IF p_col_bal_def_table(i).defined_balance_id <> 0 AND
930 p_type IN ('CORRECTION','COMPLETE') THEN
931 l_balance_date := NULL;
932 l_context_id := NULL;
933 l_source_text := NULL;
934 l_source_text2 := NULL;
935 l_date_earned := p_balance_date;
936 l_tax_unit_id := p_tax_unit_id;
937 --
938 IF p_col_bal_def_table(i).database_item_suffix LIKE '%/_REP/_%' ESCAPE '/'
939 OR p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_BDATE/_%' ESCAPE '/' THEN
940 l_date_earned := p_effective_date;
941 l_balance_date := p_balance_date;
942 END IF;
943 --
944 IF p_col_bal_def_table(i).database_item_suffix LIKE '%/_ADJ/_%' ESCAPE '/' THEN
945 l_balance_date := p_balance_date;
946 END IF;
947 --
948 IF p_col_bal_def_table(i).database_item_suffix LIKE '%/_SIT/_%' ESCAPE '/' THEN
949 OPEN cur_act_contexts('SOURCE_TEXT');
950 FETCH cur_act_contexts INTO l_context_id;
951 CLOSE cur_act_contexts;
952 l_source_text := p_col_bal_def_table(i).context_val;
953 END IF;
954 --
955 IF p_col_bal_def_table(i).database_item_suffix LIKE '%/_SIP/_%' ESCAPE '/' THEN
956 OPEN cur_act_contexts('SOURCE_TEXT');
957 FETCH cur_act_contexts INTO l_context_id;
958 CLOSE cur_act_contexts;
959 l_source_text := p_col_bal_def_table(i).context_val;
960 --
961 OPEN cur_act_contexts('SOURCE_TEXT2');
962 FETCH cur_act_contexts INTO l_context_id;
963 CLOSE cur_act_contexts;
964 l_source_text2 := p_si_provider;
965 END IF;
966 --
967 BEGIN
968 p_col_bal_def_table(i).balance_value := pay_balance_pkg.get_value
969 (p_defined_balance_id => p_col_bal_def_table(i).defined_balance_id
970 ,p_assignment_action_id => p_ass_action_id
971 ,p_tax_unit_id => l_tax_unit_id
972 ,p_jurisdiction_code => NULL
973 ,p_source_id => NULL
974 ,p_source_text => l_source_text
975 ,p_tax_group => NULL
976 ,p_date_earned => l_date_earned
977 ,p_get_rr_route => NULL
978 ,p_get_rb_route => NULL
979 ,p_source_text2 => l_source_text2
980 ,p_source_number => NULL
981 ,p_time_def_id => NULL
982 ,p_balance_date => l_balance_date
983 ,p_payroll_id => NULL);
984 EXCEPTION
985 WHEN OTHERS THEN
986 p_col_bal_def_table(i).balance_value := 0;
987 --##--Fnd_file.put_line(FND_FILE.LOG,'####'||p_type||' '||p_col_bal_def_table(i).balance_name||' '||p_col_bal_def_table(i).database_item_suffix||' '||p_col_bal_def_table(i).balance_value||' '||p_col_bal_def_table(i).context_val);
988 --Fnd_file.put_line(FND_FILE.LOG,'## p_defined_balance_id ' || p_col_bal_def_table(i).defined_balance_id);
989 --Fnd_file.put_line(FND_FILE.LOG,'## l_tax_unit_id ' || l_tax_unit_id);
990 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text ' || l_source_text);
991 --Fnd_file.put_line(FND_FILE.LOG,'## l_date_earned ' || l_date_earned);
992 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text2 ' || l_source_text2);
993 --Fnd_file.put_line(FND_FILE.LOG,'## l_balance_date ' || l_balance_date);
994 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
995 END;
996 --##--Fnd_file.put_line(FND_FILE.LOG,'#########'||p_type||' '||p_col_bal_def_table(i).balance_name||' '||p_col_bal_def_table(i).database_item_suffix||' '||p_col_bal_def_table(i).balance_value||' '||p_col_bal_def_table(i).context_val);
997 --##--Fnd_file.put_line(FND_FILE.LOG,'######### Defined_balance_id : '||p_col_bal_def_table(i).defined_balance_id);
998 END IF;
999 --
1000 IF p_col_bal_def_table(i).defined_balance_id2 <> 0 AND
1001 p_type IN ('CORR_BALANCE','CORRECTION') THEN
1002 l_balance_date := NULL;
1003 l_context_id := NULL;
1004 l_source_text := NULL;
1005 l_source_text2 := NULL;
1006 l_date_earned := p_balance_date;
1007 l_tax_unit_id := p_tax_unit_id;
1008 --
1009 IF p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_REP/_%' ESCAPE '/'
1010 OR p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_BDATE/_%' ESCAPE '/' THEN
1011 l_date_earned := p_effective_date;
1012 l_balance_date := p_balance_date;
1013 END IF;
1014 --
1015 IF p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_ADJ/_%' ESCAPE '/' THEN
1016 l_balance_date := p_balance_date;
1017 END IF;
1018 --
1019 IF p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_SIT/_%' ESCAPE '/' THEN
1020 OPEN cur_act_contexts('SOURCE_TEXT');
1021 FETCH cur_act_contexts INTO l_context_id;
1022 CLOSE cur_act_contexts;
1023 l_source_text := p_col_bal_def_table(i).context_val;
1024 END IF;
1025 --
1026 IF p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_SIP/_%' ESCAPE '/' THEN
1027 OPEN cur_act_contexts('SOURCE_TEXT');
1028 FETCH cur_act_contexts INTO l_context_id;
1029 CLOSE cur_act_contexts;
1030 l_source_text := p_col_bal_def_table(i).context_val;
1031 --
1032 OPEN cur_act_contexts('SOURCE_TEXT2');
1033 FETCH cur_act_contexts INTO l_context_id;
1034 CLOSE cur_act_contexts;
1035 l_source_text2 := p_si_provider;
1036 END IF;
1037 --
1038 BEGIN
1039 p_col_bal_def_table(i).balance_value2 := pay_balance_pkg.get_value
1040 (p_defined_balance_id => p_col_bal_def_table(i).defined_balance_id2
1041 ,p_assignment_action_id => p_ass_action_id
1042 ,p_tax_unit_id => l_tax_unit_id
1043 ,p_jurisdiction_code => NULL
1044 ,p_source_id => NULL
1045 ,p_source_text => l_source_text
1046 ,p_tax_group => NULL
1047 ,p_date_earned => l_date_earned
1048 ,p_get_rr_route => NULL
1049 ,p_get_rb_route => NULL
1050 ,p_source_text2 => l_source_text2
1051 ,p_source_number => NULL
1052 ,p_time_def_id => NULL
1053 ,p_balance_date => l_balance_date
1054 ,p_payroll_id => NULL);
1055 EXCEPTION
1056 WHEN OTHERS THEN
1057 p_col_bal_def_table(i).balance_value2 := 0;
1058 --Fnd_file.put_line(FND_FILE.LOG,'##'||p_type||' '||p_col_bal_def_table(i).balance_name||' '||p_col_bal_def_table(i).database_item_suffix2||' '||p_col_bal_def_table(i).balance_value2||' '||p_col_bal_def_table(i).context_val);
1059 --Fnd_file.put_line(FND_FILE.LOG,'## p_defined_balance_id ' || p_col_bal_def_table(i).defined_balance_id2);
1060 --Fnd_file.put_line(FND_FILE.LOG,'## l_tax_unit_id ' || l_tax_unit_id);
1061 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text ' || l_source_text);
1062 --Fnd_file.put_line(FND_FILE.LOG,'## l_date_earned ' || l_date_earned);
1063 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text2 ' || l_source_text2);
1064 --Fnd_file.put_line(FND_FILE.LOG,'## l_balance_date ' || l_balance_date);
1065 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
1066 END;
1067 --##--Fnd_file.put_line(FND_FILE.LOG,'#########'||p_type||' '||p_col_bal_def_table(i).balance_name||' '||p_col_bal_def_table(i).database_item_suffix2||' '||p_col_bal_def_table(i).balance_value2||' '||p_col_bal_def_table(i).context_val);
1068 --##--Fnd_file.put_line(FND_FILE.LOG,'######### Defined_balance_id : '||p_col_bal_def_table(i).defined_balance_id2);
1069 END IF;
1070 END LOOP;
1071 END populate_col_balance_values;
1072 --
1073 --------------------------------------------------------------------------------
1074 -- populate_col_balance_table pay_nl_wage_report_pkg.populate_col_balance_table
1075 --------------------------------------------------------------------------------
1076 PROCEDURE populate_col_balance_table(p_payroll_type VARCHAR2
1077 ,p_effective_date DATE
1078 ,p_payroll_action_id NUMBER
1079 ,p_swmf_col_bal_def_table IN OUT NOCOPY BAL_COL_TABLE) IS
1080 --
1081 x NUMBER;
1082 y NUMBER;
1083 l_tu_payroll_ptd VARCHAR2(30);
1084 l_tu_payroll_adj_ptd VARCHAR2(30);
1085 l_tu_payroll_corr_ptd VARCHAR2(30);
1086 l_tu_sit_payroll_ptd VARCHAR2(30);
1087 l_tu_sit_payroll_adj_ptd VARCHAR2(30);
1088 l_tu_sit_payroll_corr_ptd VARCHAR2(30);
1089 --
1090 CURSOR csr_chk_corr_ele_exists(c_pay_act_id NUMBER) IS
1091 SELECT 'Y'
1092 FROM DUAL
1093 WHERE EXISTS (SELECT /*+ ORDERED */ 1
1094 FROM pay_assignment_actions paa
1095 ,pay_action_information pai
1096 WHERE paa.payroll_action_id = c_pay_act_id
1097 AND pai.action_context_id = paa.assignment_action_id
1098 AND pai.action_context_type = 'AAP'
1099 AND pai.action_information_category = 'NL_WR_NOMINATIVE_REPORT_ADD'
1100 AND pai.action_information11 = 'Y');
1101 --
1102 l_curr_exits varchar2(1);
1103 --
1104 BEGIN
1105 --MONTHLY
1106 OPEN csr_chk_corr_ele_exists(p_payroll_action_id);
1107 FETCH csr_chk_corr_ele_exists INTO l_curr_exits;
1108 CLOSE csr_chk_corr_ele_exists;
1109 --
1110 --Fnd_file.put_line(FND_FILE.LOG,'#### l_curr_exits '||l_curr_exits);
1111 --
1112 IF p_payroll_type = 'MONTH' THEN
1113 l_tu_payroll_ptd := '_TU_MONTH_PTD';
1114 l_tu_payroll_adj_ptd := '_TU_MONTH_ADJ_PTD';
1115 l_tu_payroll_corr_ptd := '_TU_MONTH_REP_CORR_PTD';
1116 l_tu_sit_payroll_ptd := '_TU_SIT_MONTH_PTD';
1117 l_tu_sit_payroll_adj_ptd := '_TU_SIT_MONTH_ADJ_PTD';
1118 l_tu_sit_payroll_corr_ptd := '_TU_SIT_MONTH_REP_CORR_PTD';
1119 IF NVL(l_curr_exits,'N') = 'N' THEN
1120 l_tu_payroll_adj_ptd := '_TU_MONTH_PTD';
1121 l_tu_payroll_corr_ptd := NULL;
1122 l_tu_sit_payroll_adj_ptd := '_TU_SIT_MONTH_PTD';
1123 l_tu_sit_payroll_corr_ptd := NULL;
1124 END IF;
1125 IF g_retro_type = 'NEW' THEN
1126 l_tu_payroll_adj_ptd := NULL;
1127 l_tu_payroll_corr_ptd := '_TU_MONTH_BDATE_PTD';
1128 l_tu_sit_payroll_adj_ptd := NULL;
1129 l_tu_sit_payroll_corr_ptd := '_TU_SIT_MONTH_BDATE_PTD';
1130 END IF;
1131 ELSIF p_payroll_type = 'LMONTH' THEN
1132 l_tu_payroll_ptd := '_TU_LMONTH_PTD';
1133 l_tu_payroll_adj_ptd := '_TU_LMONTH_ADJ_PTD';
1134 l_tu_payroll_corr_ptd := '_TU_LMONTH_REP_CORR_PTD';
1135 l_tu_sit_payroll_ptd := '_TU_SIT_LMONTH_PTD';
1136 l_tu_sit_payroll_adj_ptd := '_TU_SIT_LMONTH_ADJ_PTD';
1137 l_tu_sit_payroll_corr_ptd := '_TU_SIT_LMONTH_REP_CORR_PTD';
1138 IF NVL(l_curr_exits,'N') = 'N' THEN
1139 l_tu_payroll_adj_ptd := '_TU_LMONTH_PTD';
1140 l_tu_payroll_corr_ptd := NULL;
1141 l_tu_sit_payroll_adj_ptd := '_TU_SIT_LMONTH_PTD';
1142 l_tu_sit_payroll_corr_ptd := NULL;
1143 END IF;
1144 IF g_retro_type = 'NEW' THEN
1145 l_tu_payroll_adj_ptd := NULL;
1146 l_tu_payroll_corr_ptd := '_TU_LMONTH_BDATE_PTD';
1147 l_tu_sit_payroll_adj_ptd := NULL;
1148 l_tu_sit_payroll_corr_ptd := '_TU_SIT_LMONTH_BDATE_PTD';
1149 END IF;
1150 ELSIF p_payroll_type = 'WEEK' THEN
1151 l_tu_payroll_ptd := '_TU_WEEKLY_PTD';
1152 l_tu_payroll_adj_ptd := '_TU_WEEKLY_PTD';
1153 l_tu_payroll_corr_ptd := NULL;
1154 l_tu_sit_payroll_ptd := '_TU_SIT_WEEKLY_PTD';
1155 l_tu_sit_payroll_adj_ptd := '_TU_SIT_WEEKLY_PTD';
1156 l_tu_sit_payroll_corr_ptd := NULL;
1157 END IF;
1158 --
1159 --Fnd_file.put_line(FND_FILE.LOG,' Populating Balanace Table for Collective Report');
1160 g_col_bal_def_table.delete;
1161 x:=1;
1162 g_col_bal_def_table(x).balance_name := 'Standard Taxable Income'; --1
1163 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1164 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1165 g_col_bal_def_table(x).context := NULL;
1166 g_col_bal_def_table(x).context_val := NULL;
1167 x := x+1;
1168 g_col_bal_def_table(x).balance_name := 'Retro Standard Taxable Income Current Quarter';
1169 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1170 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1171 g_col_bal_def_table(x).context := NULL;
1172 g_col_bal_def_table(x).context_val := NULL;
1173 x := x+1;
1174 g_col_bal_def_table(x).balance_name := 'Special Taxable Income';
1175 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1176 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1177 g_col_bal_def_table(x).context := NULL;
1178 g_col_bal_def_table(x).context_val := NULL;
1179 x := x+1;
1180 g_col_bal_def_table(x).balance_name := 'Retro Special Taxable Income';
1181 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1182 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1183 g_col_bal_def_table(x).context := NULL;
1184 g_col_bal_def_table(x).context_val := NULL;
1185 x := x+1;
1186 g_col_bal_def_table(x).balance_name := 'Retro Standard Taxable Income'; --5
1187 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1188 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1189 g_col_bal_def_table(x).context := NULL;
1190 g_col_bal_def_table(x).context_val := NULL;
1191 x := x+1;
1192 g_col_bal_def_table(x).balance_name := 'SI Income Standard Tax'; --6
1193 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1194 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1195 g_col_bal_def_table(x).context := NULL;
1196 g_col_bal_def_table(x).context_val := NULL;
1197 x := x+1;
1198 g_col_bal_def_table(x).balance_name := 'Retro SI Income Standard Tax';
1199 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1200 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1201 g_col_bal_def_table(x).context := NULL;
1202 g_col_bal_def_table(x).context_val := NULL;
1203 x := x+1;
1204 g_col_bal_def_table(x).balance_name := 'SI Income Special Tax';
1205 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1206 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1207 g_col_bal_def_table(x).context := NULL;
1208 g_col_bal_def_table(x).context_val := NULL;
1209 x := x+1;
1210 g_col_bal_def_table(x).balance_name := 'Retro SI Income Special Tax';
1211 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1212 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1213 g_col_bal_def_table(x).context := NULL;
1214 g_col_bal_def_table(x).context_val := NULL;
1215 x := x+1;
1216 g_col_bal_def_table(x).balance_name := 'SI Income Non Taxable'; -- 10
1217 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1218 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1219 g_col_bal_def_table(x).context := NULL;
1220 g_col_bal_def_table(x).context_val := NULL;
1221 x := x+1;
1222 g_col_bal_def_table(x).balance_name := 'Retro SI Income Non Taxable'; --11
1223 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1224 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1225 g_col_bal_def_table(x).context := NULL;
1226 g_col_bal_def_table(x).context_val := NULL;
1227 x := x+1;
1228 g_col_bal_def_table(x).balance_name := 'Actual SI Base Employer';
1229 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1230 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1231 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1232 g_col_bal_def_table(x).context_val := 'WAOB' ;
1233 x := x+1;
1234 g_col_bal_def_table(x).balance_name := 'Retro Actual SI Base Employer';
1235 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1236 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1237 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1238 g_col_bal_def_table(x).context_val := 'WAOB';
1239 x := x+1;
1240 g_col_bal_def_table(x).balance_name := 'Actual SI Base';
1241 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1242 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1243 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1244 g_col_bal_def_table(x).context_val := 'WAOD' ;
1245 x := x+1;
1246 g_col_bal_def_table(x).balance_name := 'Retro Actual SI Base'; -- 15
1247 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1248 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1249 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1250 g_col_bal_def_table(x).context_val := 'WAOD';
1251 x := x+1;
1252 g_col_bal_def_table(x).balance_name := 'Actual SI Base'; --16
1253 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1254 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1255 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1256 g_col_bal_def_table(x).context_val := 'WEWE' ;
1257 x := x+1;
1258 g_col_bal_def_table(x).balance_name := 'Retro Actual SI Base';
1259 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1260 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1261 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1262 g_col_bal_def_table(x).context_val := 'WEWE' ;
1263 x := x+1;
1264 g_col_bal_def_table(x).balance_name := 'Actual SI Base'; --18
1265 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1266 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1267 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1268 g_col_bal_def_table(x).context_val := 'UFO' ;
1269 x := x+1;
1270 g_col_bal_def_table(x).balance_name := 'Retro Actual SI Base'; --19
1271 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1272 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1273 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1274 g_col_bal_def_table(x).context_val := 'UFO' ;
1275 x := x+1;
1276 g_col_bal_def_table(x).balance_name := 'Employer ZVW Contribution Standard Tax';
1277 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1278 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1279 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1280 g_col_bal_def_table(x).context_val := 'ZVW' ; --20
1281 x := x+1;
1282 g_col_bal_def_table(x).balance_name := 'Employer ZVW Contribution Special Tax';
1283 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1284 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1285 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1286 g_col_bal_def_table(x).context_val := 'ZVW' ;
1287 x := x+1;
1288 g_col_bal_def_table(x).balance_name := 'Employer SI Contribution Non Taxable';
1289 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1290 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1291 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1292 g_col_bal_def_table(x).context_val := 'ZVW' ;
1293 x := x+1;
1294 g_col_bal_def_table(x).balance_name := 'Employer SI Contribution';
1295 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1296 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1297 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1298 g_col_bal_def_table(x).context_val := 'ZVW' ;
1299 x := x+1;
1300 g_col_bal_def_table(x).balance_name := 'Retro Employer ZVW Contribution Standard Tax';
1301 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1302 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1303 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1304 g_col_bal_def_table(x).context_val := 'ZVW' ;
1305 x := x+1;
1306 g_col_bal_def_table(x).balance_name := 'Retro Employer ZVW Contribution Special Tax';
1307 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1308 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1309 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1310 g_col_bal_def_table(x).context_val := 'ZVW' ; --25
1311 x := x+1;
1312 g_col_bal_def_table(x).balance_name := 'Retro Employer SI Contribution Non Taxable';
1313 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1314 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1315 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1316 g_col_bal_def_table(x).context_val := 'ZVW' ;
1317 x := x+1;
1318 g_col_bal_def_table(x).balance_name := 'Retro Employer SI Contribution';
1319 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1320 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1321 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1322 g_col_bal_def_table(x).context_val := 'ZVW' ; --27
1323 x := x+1;
1324 g_col_bal_def_table(x).balance_name := 'Standard Tax Deduction'; --28
1325 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1326 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1327 g_col_bal_def_table(x).context := NULL;
1328 g_col_bal_def_table(x).context_val := NULL;
1329 x := x+1;
1330 g_col_bal_def_table(x).balance_name := 'Retro Standard Tax Deduction Current Quarter';
1331 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1332 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1333 g_col_bal_def_table(x).context := NULL;
1334 g_col_bal_def_table(x).context_val := NULL ;
1335 x := x+1;
1336 g_col_bal_def_table(x).balance_name := 'Special Tax Deduction'; --30
1337 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1338 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1339 g_col_bal_def_table(x).context := NULL;
1340 g_col_bal_def_table(x).context_val := NULL ;
1341 x := x+1;
1342 g_col_bal_def_table(x).balance_name := 'Retro Special Tax Deduction'; --31
1343 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1344 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1345 g_col_bal_def_table(x).context := NULL;
1346 g_col_bal_def_table(x).context_val := NULL ;
1347 x := x+1;
1348 g_col_bal_def_table(x).balance_name := 'Retro Standard Tax Deduction'; --32
1349 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1350 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1351 g_col_bal_def_table(x).context := NULL;
1352 g_col_bal_def_table(x).context_val := NULL ;
1353 x := x+1;
1354 g_col_bal_def_table(x).balance_name := 'Major Issue Flat Rate Tax Deduction'; --33
1355 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1356 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1357 g_col_bal_def_table(x).context := NULL;
1358 g_col_bal_def_table(x).context_val := NULL ;
1359 x := x+1;
1360 g_col_bal_def_table(x).balance_name := 'Retro Major Issue Flat Rate Tax Deduction';--34
1361 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1362 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1363 g_col_bal_def_table(x).context := NULL;
1364 g_col_bal_def_table(x).context_val := NULL ;
1365 x := x+1;
1366 g_col_bal_def_table(x).balance_name := 'Single Rate Special Target Tax Deduction'; --35
1367 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1368 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1369 g_col_bal_def_table(x).context := NULL;
1370 g_col_bal_def_table(x).context_val := NULL ;
1371 x := x+1;
1372 g_col_bal_def_table(x).balance_name := 'Retro Single Rate Special Target Tax Deduction';
1373 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1374 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1375 g_col_bal_def_table(x).context := NULL;
1376 g_col_bal_def_table(x).context_val := NULL ;
1377 x := x+1;
1378 g_col_bal_def_table(x).balance_name := 'Wage Saving Tax Deduction'; --37
1379 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1380 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1381 g_col_bal_def_table(x).context := NULL;
1382 g_col_bal_def_table(x).context_val := NULL ;
1383 x := x+1;
1384 g_col_bal_def_table(x).balance_name := 'Retro Wage Saving Tax Deduction'; --38
1385 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1386 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1387 g_col_bal_def_table(x).context := NULL;
1388 g_col_bal_def_table(x).context_val := NULL ;
1389 x := x+1;
1390 g_col_bal_def_table(x).balance_name := 'Premium Saving Tax Deduction';
1391 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1392 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1393 g_col_bal_def_table(x).context := NULL;
1394 g_col_bal_def_table(x).context_val := NULL ;
1395 x := x+1;
1396 g_col_bal_def_table(x).balance_name := 'Retro Premium Saving Tax Deduction'; --40
1397 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1398 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1399 g_col_bal_def_table(x).context := NULL;
1400 g_col_bal_def_table(x).context_val := NULL ;
1401 x := x+1;
1402 g_col_bal_def_table(x).balance_name := 'Single Rate Exceptional Payment Tax Deduction'; --41
1403 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1404 g_col_bal_def_table(x).database_item_suffix2 := NULL; -- Bug# 5754707
1405 g_col_bal_def_table(x).context := NULL;
1406 g_col_bal_def_table(x).context_val := NULL ;
1407 x := x+1;
1408 g_col_bal_def_table(x).balance_name := 'Retro Single Rate Exceptional Payment Tax Deduction'; --42
1409 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1410 g_col_bal_def_table(x).database_item_suffix2 := NULL; -- Bug# 5754707
1411 g_col_bal_def_table(x).context := NULL;
1412 g_col_bal_def_table(x).context_val := NULL ;
1413 x := x+1;
1414 g_col_bal_def_table(x).balance_name := 'Gross Up Rate Exceptional Payment Tax Deduction'; --43
1415 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1416 g_col_bal_def_table(x).database_item_suffix2 := NULL; -- Bug# 5754707
1417 g_col_bal_def_table(x).context := NULL;
1418 g_col_bal_def_table(x).context_val := NULL;
1419 x := x+1;
1420 g_col_bal_def_table(x).balance_name := 'Retro Gross Up Rate Exceptional Payment Tax Deduction';
1421 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1422 g_col_bal_def_table(x).database_item_suffix2 := NULL; -- Bug# 5754707
1423 g_col_bal_def_table(x).context := NULL;
1424 g_col_bal_def_table(x).context_val := NULL ;
1425 x := x+1;
1426 g_col_bal_def_table(x).balance_name := 'National Holiday Gift Tax Deduction'; --45
1427 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1428 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1429 g_col_bal_def_table(x).context := NULL;
1430 g_col_bal_def_table(x).context_val := NULL ;
1431 x := x+1;
1432 g_col_bal_def_table(x).balance_name := 'Retro National Holiday Gift Tax Deduction';
1433 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1434 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1435 g_col_bal_def_table(x).context := NULL;
1436 g_col_bal_def_table(x).context_val := NULL ;
1437 x := x+1;
1438 g_col_bal_def_table(x).balance_name := 'Gross Up Rate Exceeding Allowance Tax Deduction'; --47
1439 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1440 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1441 g_col_bal_def_table(x).context := NULL;
1442 g_col_bal_def_table(x).context_val := NULL ;
1443 x := x+1;
1444 g_col_bal_def_table(x).balance_name := 'Retro Gross Up Rate Exceeding Allowance Tax Deduction';
1445 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1446 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1447 g_col_bal_def_table(x).context := NULL;
1448 g_col_bal_def_table(x).context_val := NULL ;
1449 x := x+1;
1450 g_col_bal_def_table(x).balance_name := 'Pre Pension Tax Deduction'; -- 49
1451 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1452 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1453 g_col_bal_def_table(x).context := NULL;
1454 g_col_bal_def_table(x).context_val := NULL ;
1455 x := x+1;
1456 g_col_bal_def_table(x).balance_name := 'Retro Pre Pension Tax Deduction'; --50
1457 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1458 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1459 g_col_bal_def_table(x).context := NULL;
1460 g_col_bal_def_table(x).context_val := NULL;
1461 x := x+1;
1462 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Paid Parental Leave';
1463 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1464 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1465 g_col_bal_def_table(x).context := NULL;
1466 g_col_bal_def_table(x).context_val := NULL ;
1467 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
1468 g_col_bal_def_table(x).database_item_suffix := NULL;
1469 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1470 END IF;
1471 x := x+1;
1472 g_col_bal_def_table(x).balance_name := 'Retro Wage Tax Subsidy Paid Parental Leave';
1473 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1474 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1475 g_col_bal_def_table(x).context := NULL;
1476 g_col_bal_def_table(x).context_val := NULL ;
1477 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
1478 g_col_bal_def_table(x).database_item_suffix := NULL;
1479 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1480 END IF;
1481 x := x+1;
1482 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Long Term Unemployed'; -- 53
1483 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1484 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1485 g_col_bal_def_table(x).context := NULL;
1486 g_col_bal_def_table(x).context_val := NULL;
1487 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
1488 g_col_bal_def_table(x).database_item_suffix := NULL;
1489 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1490 END IF;
1491 x := x+1;
1492 g_col_bal_def_table(x).balance_name := 'Retro Wage Tax Subsidy Long Term Unemployed'; --54
1493 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1494 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1495 g_col_bal_def_table(x).context := NULL;
1496 g_col_bal_def_table(x).context_val := NULL ;
1497 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
1498 g_col_bal_def_table(x).database_item_suffix := NULL;
1499 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1500 END IF;
1501 x := x+1;
1502 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Arbo Non Profit'; -- 55 ---problem starts here..
1503 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1504 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1505 g_col_bal_def_table(x).context := NULL;
1506 g_col_bal_def_table(x).context_val := NULL ;
1507 x := x+1;
1508 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Sea Going EES'; --56
1509 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1510 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1511 g_col_bal_def_table(x).context := NULL;
1512 g_col_bal_def_table(x).context_val := NULL ;
1513 x := x+1;
1514 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Education'; --57
1515 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1516 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1517 g_col_bal_def_table(x).context := NULL;
1518 g_col_bal_def_table(x).context_val := NULL;
1519 x := x+1;
1520 g_col_bal_def_table(x).balance_name := 'Retro Wage Tax Subsidy Education'; -- 58
1521 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1522 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1523 g_col_bal_def_table(x).context := NULL;
1524 g_col_bal_def_table(x).context_val := NULL;
1525 x := x+1;
1526 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Research'; --59
1527 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1528 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1529 g_col_bal_def_table(x).context := NULL;
1530 g_col_bal_def_table(x).context_val := NULL;
1531 x := x+1;
1532 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; --60
1533 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1534 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1535 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1536 g_col_bal_def_table(x).context_val := 'WAOB' ;
1537 x := x+1;
1538 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --61
1539 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1540 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1541 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1542 g_col_bal_def_table(x).context_val := 'WAOB' ;
1543 x := x+1;
1544 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; --62
1545 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1546 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1547 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1548 g_col_bal_def_table(x).context_val := 'WGA' ;
1549 x := x+1;
1550 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --63
1551 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1552 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1553 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1554 g_col_bal_def_table(x).context_val := 'WGA' ;
1555 x := x+1;
1556 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; -- 64
1557 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1558 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1559 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1560 g_col_bal_def_table(x).context_val := 'IVA' ;
1561 x := x+1;
1562 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --65
1563 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1564 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1565 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1566 g_col_bal_def_table(x).context_val := 'IVA' ;
1567 x := x+1;
1568 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; --66
1569 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1570 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1571 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1572 g_col_bal_def_table(x).context_val := 'WAOD' ;
1573 x := x+1;
1574 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --67
1575 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1576 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1577 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1578 g_col_bal_def_table(x).context_val := 'WAOD' ;
1579 x := x+1;
1580 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; --68
1581 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1582 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1583 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1584 g_col_bal_def_table(x).context_val := 'WEWE' ;
1585 x := x+1;
1586 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --69
1587 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1588 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1589 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1590 g_col_bal_def_table(x).context_val := 'WEWE' ;
1591 x := x+1;
1592 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; --70
1593 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1594 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1595 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1596 g_col_bal_def_table(x).context_val := 'UFO' ;
1597 x := x+1;
1598 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --71
1599 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1600 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1601 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1602 g_col_bal_def_table(x).context_val := 'UFO' ;
1603 x := x+1;
1604 g_col_bal_def_table(x).balance_name := 'Wage Report Employee SI Contribution'; --72
1605 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1606 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1607 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1608 g_col_bal_def_table(x).context_val := 'ZVW' ;
1609 x := x+1;
1610 g_col_bal_def_table(x).balance_name := 'Wage Report Retro Employee SI Contribution'; --73
1611 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1612 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1613 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1614 g_col_bal_def_table(x).context_val := 'ZVW' ;
1615 x := x+1;
1616 g_col_bal_def_table(x).balance_name := 'Labour Handicap Discount'; --74
1617 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1618 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1619 g_col_bal_def_table(x).context := NULL;
1620 g_col_bal_def_table(x).context_val := NULL;
1621 x := x+1;
1622 g_col_bal_def_table(x).balance_name := 'Retro Labour Handicap Discount'; --75
1623 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1624 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1625 g_col_bal_def_table(x).context := NULL;
1626 g_col_bal_def_table(x).context_val := NULL;
1627 x := x+1;
1628 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy EVC'; --76
1629 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1630 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1631 g_col_bal_def_table(x).context := NULL;
1632 g_col_bal_def_table(x).context_val := NULL;
1633 x := x+1;
1634 g_col_bal_def_table(x).balance_name := 'Retro Wage Tax Subsidy EVC'; -- 77
1635 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1636 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1637 g_col_bal_def_table(x).context := NULL;
1638 g_col_bal_def_table(x).context_val := NULL;
1639 x := x+1;
1640 g_col_bal_def_table(x).balance_name := 'Standard Tax Correction'; --78
1641 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1642 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1643 g_col_bal_def_table(x).context := NULL;
1644 g_col_bal_def_table(x).context_val := NULL;
1645 x := x+1;
1646 g_col_bal_def_table(x).balance_name := 'Special Tax Correction'; --79
1647 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1648 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1649 g_col_bal_def_table(x).context := NULL;
1650 g_col_bal_def_table(x).context_val := NULL;
1651 x := x+1;
1652 g_col_bal_def_table(x).balance_name := 'Life Cycle Leave Discount'; --80
1653 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1654 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1655 g_col_bal_def_table(x).context := NULL;
1656 g_col_bal_def_table(x).context_val := NULL;
1657 x := x+1;
1658 g_col_bal_def_table(x).balance_name := 'Retro Life Cycle Leave Discount'; -- 81
1659 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1660 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1661 g_col_bal_def_table(x).context := NULL;
1662 g_col_bal_def_table(x).context_val := NULL;
1663 --
1664 FOR i in g_col_bal_def_table.FIRST..g_col_bal_def_table.LAST LOOP
1665 IF g_col_bal_def_table(i).database_item_suffix IS NOT NULL THEN
1666 g_col_bal_def_table(i).defined_balance_id := get_defined_balance_id(g_col_bal_def_table(i).balance_name
1667 ,g_col_bal_def_table(i).database_item_suffix);
1668 ELSE
1669 g_col_bal_def_table(i).defined_balance_id := 0;
1670 END IF;
1671 IF g_col_bal_def_table(i).database_item_suffix2 IS NOT NULL THEN
1672 g_col_bal_def_table(i).defined_balance_id2 := get_defined_balance_id(g_col_bal_def_table(i).balance_name
1673 ,g_col_bal_def_table(i).database_item_suffix2);
1674 ELSE
1675 g_col_bal_def_table(i).defined_balance_id2 := 0;
1676 END IF;
1677 END LOOP;
1678 --
1679 --
1680 IF p_payroll_type = 'MONTH' THEN
1681 l_tu_sit_payroll_ptd := '_TU_SIP_MONTH_PTD';
1682 l_tu_sit_payroll_adj_ptd := '_TU_SIP_MONTH_ADJ_PTD';
1683 l_tu_sit_payroll_corr_ptd := '_TU_SIP_MONTH_REP_CORR_PTD';
1684 IF NVL(l_curr_exits,'N') = 'N' THEN
1685 l_tu_sit_payroll_adj_ptd := '_TU_SIP_MONTH_PTD';
1686 l_tu_sit_payroll_corr_ptd := NULL;
1687 END IF;
1688 IF g_retro_type = 'NEW' THEN
1689 l_tu_sit_payroll_adj_ptd := NULL;
1690 l_tu_sit_payroll_corr_ptd := '_TU_SIP_MONTH_BDATE_PTD';
1691 END IF;
1692 ELSIF p_payroll_type = 'LMONTH' THEN
1693 l_tu_sit_payroll_ptd := '_TU_SIP_LMONTH_PTD';
1694 l_tu_sit_payroll_adj_ptd := '_TU_SIP_LMONTH_ADJ_PTD';
1695 l_tu_sit_payroll_corr_ptd := '_TU_SIP_LMONTH_REP_CORR_PTD';
1696 IF NVL(l_curr_exits,'N') = 'N' THEN
1697 l_tu_sit_payroll_adj_ptd := '_TU_SIP_LMONTH_PTD';
1698 l_tu_sit_payroll_corr_ptd := NULL;
1699 END IF;
1700 IF g_retro_type = 'NEW' THEN
1701 l_tu_sit_payroll_adj_ptd := NULL;
1702 l_tu_sit_payroll_corr_ptd := '_TU_SIP_LMONTH_BDATE_PTD';
1703 END IF;
1704 ELSIF p_payroll_type = 'WEEK' THEN
1705 l_tu_sit_payroll_ptd := '_TU_SIP_WEEKLY_PTD';
1706 l_tu_sit_payroll_adj_ptd := '_TU_SIP_WEEKLY_PTD';
1707 l_tu_sit_payroll_corr_ptd := NULL;
1708 END IF;
1709 --
1710 --p_swmf_col_bal_def_table.delete;
1711 --Fnd_file.put_line(FND_FILE.LOG,' Populating Balanace Table for SWMF');
1712 y := 1;
1713 p_swmf_col_bal_def_table(y).balance_name := 'Actual SI Base';--1
1714 p_swmf_col_bal_def_table(y).database_item_suffix := l_tu_sit_payroll_ptd;
1715 p_swmf_col_bal_def_table(y).database_item_suffix2 := NULL;
1716 p_swmf_col_bal_def_table(y).context := 'SOURCE_TEXT';
1717 p_swmf_col_bal_def_table(y).context_val := 'WEWA' ;
1718 y := y+1;
1719 p_swmf_col_bal_def_table(y).balance_name := 'Retro Actual SI Base';
1720 p_swmf_col_bal_def_table(y).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1721 p_swmf_col_bal_def_table(y).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1722 p_swmf_col_bal_def_table(y).context := 'SOURCE_TEXT';
1723 p_swmf_col_bal_def_table(y).context_val := 'WEWA' ;
1724 y := y+1;
1725 p_swmf_col_bal_def_table(y).balance_name := 'Wage Report SI Contribution';
1726 p_swmf_col_bal_def_table(y).database_item_suffix := l_tu_sit_payroll_ptd;
1727 p_swmf_col_bal_def_table(y).database_item_suffix2 := NULL;
1728 p_swmf_col_bal_def_table(y).context := 'SOURCE_TEXT';
1729 p_swmf_col_bal_def_table(y).context_val := 'WEWA' ;
1730 y := y+1;
1731 p_swmf_col_bal_def_table(y).balance_name := 'Wage Report Retro SI Contribution'; --4
1732 p_swmf_col_bal_def_table(y).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1733 p_swmf_col_bal_def_table(y).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1734 p_swmf_col_bal_def_table(y).context := 'SOURCE_TEXT';
1735 p_swmf_col_bal_def_table(y).context_val := 'WEWA' ;
1736 --
1737 FOR i in p_swmf_col_bal_def_table.FIRST..p_swmf_col_bal_def_table.LAST LOOP
1738 IF p_swmf_col_bal_def_table(i).database_item_suffix IS NOT NULL THEN
1739 p_swmf_col_bal_def_table(i).defined_balance_id := get_defined_balance_id(p_swmf_col_bal_def_table(i).balance_name
1740 ,p_swmf_col_bal_def_table(i).database_item_suffix);
1741 ELSE
1742 p_swmf_col_bal_def_table(i).defined_balance_id := 0;
1743 END IF;
1744 IF p_swmf_col_bal_def_table(i).database_item_suffix2 IS NOT NULL THEN
1745 p_swmf_col_bal_def_table(i).defined_balance_id2 := get_defined_balance_id(p_swmf_col_bal_def_table(i).balance_name
1746 ,p_swmf_col_bal_def_table(i).database_item_suffix2);
1747 ELSE
1748 p_swmf_col_bal_def_table(i).defined_balance_id2 := 0;
1749 END IF;
1750 END LOOP;
1751 --Fnd_file.put_line(FND_FILE.LOG,' Populated Balanace Tables');
1752 --
1753 END populate_col_balance_table;
1754 --
1755 --------------------------------------------------------------------------------
1756 -- populate_coll_bal_table pay_nl_wage_report_pkg.populate_coll_bal_table
1757 --------------------------------------------------------------------------------
1758 PROCEDURE populate_coll_bal_table(p_actid IN NUMBER
1759 ,p_tax_unit_id IN NUMBER
1760 ,p_effective_date IN DATE
1761 ,p_balance_date IN DATE
1762 ,p_type IN VARCHAR2
1763 ,p_ass_action_id IN NUMBER
1764 ,p_payroll_type IN VARCHAR2
1765 ,p_emp_total IN OUT NOCOPY NUMBER
1766 ,p_collXMLTable OUT NOCOPY tXMLTable) IS
1767 --
1768 CURSOR csr_get_org_tax_data(c_org_id NUMBER
1769 ,c_payroll_type VARCHAR2) IS
1770 SELECT fnd_date.canonical_to_date(org_information1) start_date
1771 ,fnd_date.canonical_to_date(org_information2) end_date
1772 ,org_information3
1773 ,fnd_number.canonical_to_number(org_information4) amount
1774 ,org_information5 frequency
1775 ,org_information6
1776 FROM hr_organization_information
1777 WHERE organization_id = c_org_id
1778 AND org_information_context = 'NL_ORG_FLAT_RATE_TAXATION'
1779 -- AND org_information3 = '1' -- Bug# 5754707
1780 AND org_information6 = c_payroll_type
1781 ORDER BY fnd_date.canonical_to_date(org_information1);
1782 --
1783 CURSOR csr_get_no_pay_period(c_payroll_type VARCHAR2) IS
1784 SELECT number_per_fiscal_year
1785 FROM per_time_period_types
1786 WHERE period_type = DECODE(c_payroll_type,'MONTH','Calendar Month','WEEK','Week','LMONTH','Lunar Month');
1787 --
1788 y NUMBER ;
1789 l_flat_rate_taxation NUMBER := 0;
1790 l_major_issue_flat_rate NUMBER := 0;
1791 l_single_rate_exp_pay NUMBER := 0;
1792 l_wage_tax_subsidy NUMBER := 0;
1793 l_flat_tax_holidays NUMBER := 0;
1794 l_no_pay_period NUMBER;
1795 --
1796 BEGIN
1797 --
1798 y:=1;
1799 p_emp_total := 0;
1800 populate_col_balance_values(g_col_bal_def_table,p_tax_unit_id,p_effective_date,p_balance_date,p_type,NULL,p_ass_action_id);
1801 --
1802 OPEN csr_get_no_pay_period(p_payroll_type);
1803 FETCH csr_get_no_pay_period INTO l_no_pay_period;
1804 CLOSE csr_get_no_pay_period;
1805 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~~~ l_no_pay_period '||l_no_pay_period||' ');
1806 --
1807 l_flat_rate_taxation := 0;
1808 -- Bug# 5754707, For Loop modified for all types of Look-up codes.
1809 FOR csr_rec in csr_get_org_tax_data(p_tax_unit_id,p_payroll_type) LOOP
1810 IF csr_rec.org_information3 = '1' AND p_effective_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
1811 IF csr_rec.frequency = 'P' THEN
1812 l_flat_rate_taxation := csr_rec.amount;
1813 ELSIF csr_rec.frequency = 'A' THEN
1814 l_flat_rate_taxation := csr_rec.amount/l_no_pay_period;
1815 END IF;
1816 END IF;
1817
1818 IF csr_rec.org_information3 = '2' AND p_effective_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
1819 IF csr_rec.frequency = 'P' THEN
1820 l_major_issue_flat_rate := csr_rec.amount;
1821 ELSIF csr_rec.frequency = 'A' THEN
1822 l_major_issue_flat_rate := csr_rec.amount/l_no_pay_period;
1823 END IF;
1824 END IF;
1825
1826 IF csr_rec.org_information3 = '3' AND p_effective_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
1827 IF csr_rec.frequency = 'P' THEN
1828 l_single_rate_exp_pay := csr_rec.amount;
1829 ELSIF csr_rec.frequency = 'A' THEN
1830 l_single_rate_exp_pay := csr_rec.amount/l_no_pay_period;
1831 END IF;
1832 END IF;
1833
1834 IF csr_rec.org_information3 = '4' AND p_effective_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
1835 IF csr_rec.frequency = 'P' THEN
1836 l_wage_tax_subsidy := csr_rec.amount;
1837 ELSIF csr_rec.frequency = 'A' THEN
1838 l_wage_tax_subsidy := csr_rec.amount/l_no_pay_period;
1839 END IF;
1840 END IF;
1841
1842 /**** Bug 6610259 ****/
1843 IF csr_rec.org_information3 = '5' AND p_effective_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
1844 IF csr_rec.frequency = 'P' THEN
1845 l_flat_tax_holidays := csr_rec.amount;
1846 ELSIF csr_rec.frequency = 'A' THEN
1847 l_flat_tax_holidays := csr_rec.amount/l_no_pay_period;
1848 END IF;
1849 END IF;
1850
1851 END LOOP;
1852 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~~~ l_flat_rate_taxation '||l_flat_rate_taxation||' ');
1853 --
1854 p_collXMLTable(y).TagName := 'TotLnLbPh'; -- 1..5
1855 p_collXMLTable(y).Mandatory:= 'Y';
1856 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotLnLbPh'));
1857 p_collXMLTable(y).Tagvalue := 0;
1858 FOR i in 1..5 LOOP
1859 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
1860 + g_col_bal_def_table(i).balance_value2;
1861 END LOOP;
1862 --
1863 y:= y+1;
1864 p_collXMLTable(y).TagName := 'TotLnSV'; -- 6..11
1865 p_collXMLTable(y).Mandatory:= 'Y';
1866 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotLnSV'));
1867 p_collXMLTable(y).Tagvalue := 0;
1868 FOR i in 6..11 LOOP
1869 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
1870 + g_col_bal_def_table(i).balance_value2;
1871 END LOOP;
1872 --
1873 y:= y+1;
1874 p_collXMLTable(y).TagName := 'PrLnWAOAof'; --12..13
1875 p_collXMLTable(y).Mandatory:= 'Y';
1876 IF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
1877 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAof'));
1878 ELSE
1879 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAof_2006'));
1880 END IF;
1881 p_collXMLTable(y).Tagvalue := 0;
1882 FOR i in 12..13 LOOP
1883 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
1884 + g_col_bal_def_table(i).balance_value2;
1885 END LOOP;
1886 --
1887 IF g_public_org_flag = 'N' AND g_risk_cover_flag = 'Y' THEN
1888 y:= y+1;
1889 p_collXMLTable(y).TagName := 'PrLnWAOAok'; -- 14..15
1890 p_collXMLTable(y).Mandatory:= 'Y';
1891 IF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
1892 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok'));
1893 ELSE
1894 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok_2006'));
1895 END IF;
1896 p_collXMLTable(y).Tagvalue:=0;
1897 --IF g_public_org_flag <> 'N' OR g_risk_cover_flag <> 'Y' THEN
1898 ELSE
1899 y:= y+1;
1900 p_collXMLTable(y).TagName := 'PrLnWAOAok'; -- 14..15
1901 p_collXMLTable(y).Mandatory:= 'Y';
1902 IF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
1903 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok'));
1904 ELSE
1905 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok_2006'));
1906 END IF;
1907 p_collXMLTable(y).Tagvalue:=0;
1908 FOR i in 14..15 LOOP
1909 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
1910 + g_col_bal_def_table(i).balance_value2;
1911 END LOOP;
1912 END IF;
1913 --
1914 IF g_public_org_flag = 'N' THEN
1915 y:= y+1;
1916 p_collXMLTable(y).TagName := 'PrLnAWF'; -- 16..17
1917 p_collXMLTable(y).Mandatory:= 'Y';
1918 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnAWF'));
1919 p_collXMLTable(y).Tagvalue:=0;
1920 FOR i in 16..17 LOOP
1921 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
1922 + g_col_bal_def_table(i).balance_value2;
1923 END LOOP;
1924 ELSE
1925 y:= y+1;
1926 p_collXMLTable(y).TagName := 'PrLnAWF'; -- 16..17
1927 p_collXMLTable(y).Mandatory:= 'Y';
1928 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnAWF'));
1929 p_collXMLTable(y).Tagvalue:=0;
1930 END IF;
1931 --
1932 --IF g_public_org_flag = 'Y' THEN
1933 y:= y+1;
1934 p_collXMLTable(y).TagName := 'PrLnUFO'; --18..19
1935 p_collXMLTable(y).Mandatory:= 'Y';
1936 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnUFO'));
1937 p_collXMLTable(y).Tagvalue:=0;
1938 FOR i in 18..19 LOOP
1939 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
1940 + g_col_bal_def_table(i).balance_value2;
1941 END LOOP;
1942 --END IF;
1943 --
1944 y:= y+1;
1945 p_collXMLTable(y).TagName := 'TotVergZvw'; --20..27
1946 p_collXMLTable(y).Mandatory:= 'Y';
1947 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotVergZvw'));
1948 p_collXMLTable(y).Tagvalue:=0;
1949 FOR i in 20..27 LOOP
1950 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
1951 + g_col_bal_def_table(i).balance_value2;
1952 END LOOP;
1953 --p_emp_total := p_emp_total ;
1954 --
1955 y:= y+1;
1956 p_collXMLTable(y).TagName := 'IngLbPh'; --28..32
1957 p_collXMLTable(y).Mandatory:= 'Y';
1958 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('IngLbPh'));
1959 p_collXMLTable(y).Tagvalue:=0;
1960 FOR i in 28..32 LOOP
1961 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
1962 + g_col_bal_def_table(i).balance_value2;
1963 END LOOP;
1964 FOR i in 78..79 LOOP
1965 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
1966 + g_col_bal_def_table(i).balance_value2;
1967 END LOOP;
1968 FOR i in 80..81 LOOP -- Subtracting LCLD
1969 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue - (g_col_bal_def_table(i).balance_value
1970 + g_col_bal_def_table(i).balance_value2);
1971 END LOOP;
1972 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
1973 --
1974 y:= y+1;
1975 p_collXMLTable(y).TagName := 'EHPubUitk'; -- 33..34
1976 p_collXMLTable(y).Mandatory:= 'N';
1977 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHPubUitk'));
1978 p_collXMLTable(y).Tagvalue:= l_major_issue_flat_rate; -- Bug# 5754707
1979 /* FOR i in 33..34 LOOP
1980 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
1981 + g_col_bal_def_table(i).balance_value2;
1982 END LOOP; */ -- Commented the FOR loop as part of fix to Bug# 5754707
1983 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
1984 --
1985 y:= y+1;
1986 p_collXMLTable(y).TagName := 'EHLnBestKar'; --35..36
1987 p_collXMLTable(y).Mandatory:= 'N';
1988 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHLnBestKar'));
1989 p_collXMLTable(y).Tagvalue:=0;
1990 FOR i in 35..36 LOOP
1991 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
1992 + g_col_bal_def_table(i).balance_value2;
1993 END LOOP;
1994 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
1995 --
1996 y:= y+1;
1997 p_collXMLTable(y).TagName := 'EHSpLn'; -- 37..38
1998 p_collXMLTable(y).Mandatory:= 'N';
1999 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHSpLn'));
2000 p_collXMLTable(y).Tagvalue:=0;
2001 FOR i in 37..38 LOOP
2002 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2003 + g_col_bal_def_table(i).balance_value2;
2004 END LOOP;
2005 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2006 --
2007 y:= y+1;
2008 p_collXMLTable(y).TagName := 'EHSpPr'; --39..40
2009 p_collXMLTable(y).Mandatory:= 'N';
2010 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHSpPr'));
2011 p_collXMLTable(y).Tagvalue:=0;
2012
2013 IF p_effective_date < to_date('01012008','DDMMYYYY') THEN
2014 FOR i in 39..40 LOOP --Dutch Year End Changes 08 This Tag is obsolete as of 08 Wage Report
2015 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2016 + g_col_bal_def_table(i).balance_value2;
2017 END LOOP;
2018 END IF;
2019 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2020 --
2021 y:= y+1;
2022 p_collXMLTable(y).TagName := 'EHLnNat'; --41-44
2023 p_collXMLTable(y).Mandatory:= 'N';
2024 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHLnNat'));
2025 p_collXMLTable(y).Tagvalue:= l_single_rate_exp_pay; -- Bug# 5754707
2026 /*FOR i in 41..44 LOOP
2027 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2028 + g_col_bal_def_table(i).balance_value2;
2029 END LOOP; */ -- Commented the code as per Bug# 5754707
2030 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2031 --
2032 y:= y+1;
2033 p_collXMLTable(y).TagName := 'EHFeest'; -- 45..46
2034 p_collXMLTable(y).Mandatory:= 'N';
2035 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHFeest'));
2036 p_collXMLTable(y).Tagvalue:=0;
2037 p_collXMLTable(y).Tagvalue := l_flat_tax_holidays; /*** Bug 6610259 ***/
2038 /*FOR i in 45..46 LOOP
2039 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2040 + g_col_bal_def_table(i).balance_value2;
2041 END LOOP;*/
2042 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2043 --
2044 y:= y+1;
2045 p_collXMLTable(y).TagName := 'EHBmVerg'; --47..48
2046 p_collXMLTable(y).Mandatory:= 'N';
2047 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHBmVerg'));
2048 p_collXMLTable(y).Tagvalue:=0;
2049 FOR i in 47..48 LOOP
2050 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2051 + g_col_bal_def_table(i).balance_value2;
2052 END LOOP;
2053 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2054 --
2055 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
2056 y:= y+1;
2057 p_collXMLTable(y).TagName := 'EHGebrAuto';
2058 p_collXMLTable(y).Mandatory:= 'N';
2059 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHGebrAuto'));
2060 p_collXMLTable(y).Tagvalue:= l_flat_rate_taxation;
2061 END IF;
2062 --
2063 y:= y+1;
2064 p_collXMLTable(y).TagName := 'EHVUT'; -- 49..50
2065 p_collXMLTable(y).Mandatory:= 'N';
2066 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHVUT'));
2067 p_collXMLTable(y).Tagvalue:=0;
2068 FOR i in 49..50 LOOP
2069 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2070 + g_col_bal_def_table(i).balance_value2;
2071 END LOOP;
2072 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2073 --
2074 IF p_effective_date < TO_DATE('01012007','DDMMYYYY') THEN
2075 y:= y+1;
2076 p_collXMLTable(y).TagName := 'AVBetOV'; -- 51..52
2077 p_collXMLTable(y).Mandatory:= 'N';
2078 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVBetOV'));
2079 p_collXMLTable(y).Tagvalue:=0;
2080 FOR i in 51..52 LOOP
2081 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2082 + g_col_bal_def_table(i).balance_value2;
2083 END LOOP;
2084 p_collXMLTable(y).Tagvalue:=p_collXMLTable(y).Tagvalue * -1;
2085 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
2086 --
2087 y:= y+1;
2088 p_collXMLTable(y).TagName := 'AVLgdWerkl'; -- 53..54
2089 p_collXMLTable(y).Mandatory:= 'N';
2090 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVLgdWerkl'));
2091 p_collXMLTable(y).Tagvalue:=0;
2092 FOR i in 53..54 LOOP
2093 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2094 + g_col_bal_def_table(i).balance_value2;
2095 END LOOP;
2096 p_collXMLTable(y).Tagvalue:=p_collXMLTable(y).Tagvalue * -1;
2097 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
2098 END IF;
2099 --
2100 y:= y+1;
2101 p_collXMLTable(y).TagName := 'AVArboNP'; -- 55
2102 p_collXMLTable(y).Mandatory:= 'N';
2103 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVArboNP'));
2104 p_collXMLTable(y).Tagvalue:=0;
2105 IF p_effective_date < to_date('01012008','DDMMYYYY') THEN
2106 p_collXMLTable(y).Tagvalue:= g_col_bal_def_table(55).balance_value ;
2107 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
2108 END IF;
2109 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
2110 --
2111 y:= y+1;
2112 p_collXMLTable(y).TagName := 'AVZeev'; -- 56
2113 p_collXMLTable(y).Mandatory:= 'N';
2114 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVZeev'));
2115 p_collXMLTable(y).Tagvalue:=0;
2116 p_collXMLTable(y).Tagvalue:= g_col_bal_def_table(56).balance_value ;
2117 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
2118 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
2119 y:= y+1;
2120 p_collXMLTable(y).TagName := 'AVOnd'; -- 57..58
2121 p_collXMLTable(y).Mandatory:= 'N';
2122 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVOnd'));
2123 p_collXMLTable(y).Tagvalue:=0;
2124 p_collXMLTable(y).Tagvalue:=0;
2125 FOR i in 57..58 LOOP
2126 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2127 + g_col_bal_def_table(i).balance_value2;
2128 END LOOP;
2129 FOR i in 76..77 LOOP
2130 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2131 + g_col_bal_def_table(i).balance_value2;
2132 END LOOP;
2133 p_collXMLTable(y).Tagvalue:=p_collXMLTable(y).Tagvalue * -1;
2134 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
2135 --
2136 y:= y+1;
2137 p_collXMLTable(y).TagName := 'VrlAVSO'; --59
2138 p_collXMLTable(y).Mandatory:= 'N';
2139 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('VrlAVSO'));
2140 p_collXMLTable(y).Tagvalue:=l_wage_tax_subsidy; -- Bug# 5754707
2141 --p_collXMLTable(y).Tagvalue:= g_col_bal_def_table(59).balance_value ; -- Bug# 5754707
2142 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
2143 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
2144 --
2145 y:= y+1;
2146 p_collXMLTable(y).TagName := 'PrWAOAof'; -- 60..65 WAOB WGA IVA
2147 p_collXMLTable(y).Mandatory:= 'N';
2148 IF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
2149 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAof'));
2150 ELSE
2151 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAof_2006'));
2152 END IF;
2153 p_collXMLTable(y).Tagvalue:=0;
2154 FOR i in 60..65 LOOP
2155 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2156 + g_col_bal_def_table(i).balance_value2;
2157 END LOOP;
2158 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2159 --
2160 IF g_public_org_flag = 'Y' AND g_risk_cover_flag = 'Y' THEN
2161 y:= y+1;
2162 p_collXMLTable(y).TagName := 'PrWAOAok'; -- 66..67 WAOD
2163 p_collXMLTable(y).Mandatory:= 'Y';
2164 IF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
2165 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok'));
2166 ELSE
2167 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok_2006'));
2168 END IF;
2169 p_collXMLTable(y).Tagvalue:=0;
2170 ELSIF g_public_org_flag = 'N' AND g_risk_cover_flag = 'Y' THEN
2171 y:= y+1;
2172 p_collXMLTable(y).TagName := 'PrWAOAok'; -- 66..67 WAOD
2173 p_collXMLTable(y).Mandatory:= 'Y';
2174 IF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
2175 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok'));
2176 ELSE
2177 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok_2006'));
2178 END IF;
2179 p_collXMLTable(y).Tagvalue:=0;
2180 ELSE
2181 y:= y+1;
2182 p_collXMLTable(y).TagName := 'PrWAOAok'; -- 66..67 WAOD
2183 p_collXMLTable(y).Mandatory:= 'N';
2184 IF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
2185 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok'));
2186 ELSE
2187 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok_2006'));
2188 END IF;
2189 p_collXMLTable(y).Tagvalue:=0;
2190 FOR i in 66..67 LOOP
2191 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2192 + g_col_bal_def_table(i).balance_value2;
2193 END LOOP;
2194 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2195 END IF;
2196 --
2197 IF g_public_org_flag = 'N' THEN
2198 y:= y+1;
2199 p_collXMLTable(y).TagName := 'PrAWF'; -- 68..69 WEWE
2200 p_collXMLTable(y).Mandatory:= 'N';
2201 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrAWF'));
2202 p_collXMLTable(y).Tagvalue:=0;
2203 FOR i in 68..69 LOOP
2204 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2205 + g_col_bal_def_table(i).balance_value2;
2206 END LOOP;
2207 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2208 END IF;
2209 --
2210 IF g_public_org_flag = 'Y' THEN
2211 y:= y+1;
2212 p_collXMLTable(y).TagName := 'PrUFO'; -- 70..71 UFO
2213 p_collXMLTable(y).Mandatory:= 'N';
2214 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrUFO'));
2215 p_collXMLTable(y).Tagvalue:=0;
2216 FOR i in 70..71 LOOP
2217 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2218 + g_col_bal_def_table(i).balance_value2;
2219 END LOOP;
2220 --p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue); Bug No - 5226068
2221 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2222 END IF;
2223 --
2224 y:= y+1;
2225 p_collXMLTable(y).TagName := 'IngBijdrZvw'; -- 72..73 ZVW
2226 p_collXMLTable(y).Mandatory:= 'N';
2227 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('IngBijdrZvw'));
2228 p_collXMLTable(y).Tagvalue:=0;
2229 FOR i in 72..73 LOOP
2230 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2231 + g_col_bal_def_table(i).balance_value2;
2232 END LOOP;
2233 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2234 --
2235 y:= y+1;
2236 p_collXMLTable(y).TagName := 'AGHKort'; -- 74..75
2237 p_collXMLTable(y).Mandatory:= 'N';
2238 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AGHKort'));
2239 p_collXMLTable(y).Tagvalue:=0;
2240 FOR i in 74..75 LOOP
2241 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2242 + g_col_bal_def_table(i).balance_value2;
2243 END LOOP;
2244 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
2245 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
2246 --
2247 y:= y+1;
2248 p_collXMLTable(y).TagName := 'TotTeBet';
2249 p_collXMLTable(y).Mandatory:= 'Y';
2250 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotTeBet'));
2251 p_collXMLTable(y).Tagvalue:= p_emp_total;
2252 --
2253 --
2254 --FOR i in p_collXMLTable.first..p_collXMLTable.last LOOP
2255 -- --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~~~'||p_collXMLTable(i).TagName||' '||p_collXMLTable(i).Tagvalue||' ');
2256 --END LOOP;
2257 END populate_coll_bal_table;
2258 --
2259 --------------------------------------------------------------------------------
2260 -- populate_nom_balance_values pay_nl_wage_report_pkg.populate_nom_balance_values
2261 --------------------------------------------------------------------------------
2262 PROCEDURE populate_nom_balance_values(p_master_assignment_action_id NUMBER
2263 ,p_assignment_action_id NUMBER
2264 ,p_effective_date DATE
2265 ,p_tax_unit_id NUMBER
2266 ,p_type VARCHAR2
2267 ,p_record_type VARCHAR2
2268 ,p_corr_used IN OUT NOCOPY VARCHAR2
2269 ,p_balance_values IN OUT NOCOPY Bal_Value) IS
2270 --
2271 l_balance_date DATE;
2272 l_context_id NUMBER;
2273 l_source_text VARCHAR2(50);
2274 l_source_text2 VARCHAR2(50);
2275 l_assignment_action_id NUMBER;
2276 l_context VARCHAR2(1);
2277 l_tax_unit_id NUMBER;
2278 --
2279 CURSOR cur_act_contexts(p_context_name VARCHAR2 )IS
2280 SELECT ffc.context_id
2281 FROM ff_contexts ffc
2282 WHERE ffc.context_name = p_context_name;
2283 --
2284 CURSOR csr_chk_corr_ele_exists(c_ass_act_id NUMBER) IS
2285 SELECT 'Y'
2286 FROM DUAL
2287 WHERE EXISTS (SELECT /*+ ORDERED */ 1
2288 FROM pay_assignment_actions bal_assact
2289 -- ,pay_payroll_actions bact
2290 ,pay_assignment_actions assact
2291 -- ,pay_payroll_actions pact
2292 ,pay_element_types_f adj_petf
2293 ,pay_run_results adj_prr
2294 WHERE bal_assact.assignment_action_id = c_ass_act_id -- assignment_action_id
2295 --and bal_assact.payroll_action_id = bact.payroll_action_id
2296 --and assact.payroll_action_id = pact.payroll_action_id
2297 --and pact.time_period_id = bact.time_period_id
2298 --and assact.action_sequence <= bal_assact.action_sequence
2299 and assact.assignment_id = bal_assact.assignment_id
2300 AND adj_prr.assignment_action_id = assact.assignment_action_id
2301 AND adj_prr.status in ('P','PA')
2302 AND adj_petf.element_type_id = adj_prr.element_type_id
2303 AND adj_petf.element_name = 'New Wage Report Override'
2304 AND adj_petf.legislation_code = 'NL');
2305 --
2306 l_corr_ele_exists VARCHAR2(1);
2307 --
2308 BEGIN
2309 --
2310 l_corr_ele_exists := 'N';
2311 p_balance_values.delete;
2312 OPEN csr_chk_corr_ele_exists(p_assignment_action_id);
2313 FETCH csr_chk_corr_ele_exists INTO l_corr_ele_exists;
2314 IF csr_chk_corr_ele_exists%NOTFOUND THEN
2315 l_corr_ele_exists := 'N';
2316 ELSE
2317 p_corr_used := 'Y';
2318 END IF;
2319 CLOSE csr_chk_corr_ele_exists;
2320 --##--Fnd_file.put_line(FND_FILE.LOG,'#### balance value ');
2321 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_master_assignment_action_id '||p_master_assignment_action_id);
2322 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_assignment_action_id '||p_assignment_action_id);
2323 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_effective_date '||p_effective_date);
2324 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_tax_unit_id '||p_tax_unit_id);
2325 --##--Fnd_file.put_line(FND_FILE.LOG,'#### g_nom_bal_def_table.count '||g_nom_bal_def_table.count);
2326 --##--Fnd_file.put_line(FND_FILE.LOG,'#### l_corr_ele_exists '||l_corr_ele_exists);
2327 FOR i IN g_nom_bal_def_table.FIRST..g_nom_bal_def_table.LAST LOOP
2328 p_balance_values(i).balance_value := 0;
2329 IF l_corr_ele_exists = 'N' AND (g_nom_bal_def_table(i).database_item_suffix like '%ADJ%'
2330 OR g_nom_bal_def_table(i).database_item_suffix like '%CORR%') THEN
2331 IF g_nom_bal_def_table(i).database_item_suffix like '%SIT%ADJ%' THEN
2332 g_nom_bal_def_table(i).database_item_suffix := '_ASG_SIT_PTD';
2333 ELSIF g_nom_bal_def_table(i).database_item_suffix like '%ADJ%' THEN
2334 g_nom_bal_def_table(i).database_item_suffix := '_ASG_PTD';
2335 ELSIF g_nom_bal_def_table(i).database_item_suffix like '%SIT%CORR%' THEN
2336 g_nom_bal_def_table(i).database_item_suffix := 'CORR_SI';
2337 ELSIF g_nom_bal_def_table(i).database_item_suffix like '%CORR%' THEN
2338 g_nom_bal_def_table(i).database_item_suffix := 'CORR';
2339 ELSE
2340 g_nom_bal_def_table(i).database_item_suffix := NULL;
2341 g_nom_bal_def_table(i).defined_balance_id := 0;
2342 END IF;
2343 ELSIF l_corr_ele_exists = 'Y' AND g_nom_bal_def_table(i).balance_name LIKE '%Retro%' THEN
2344 IF g_nom_bal_def_table(i).database_item_suffix like '_ASG_SIT_PTD' THEN
2345 g_nom_bal_def_table(i).database_item_suffix := '_ASG_SIT_ADJ_PTD';
2346 ELSIF g_nom_bal_def_table(i).database_item_suffix like '_ASG_PTD' THEN
2347 g_nom_bal_def_table(i).database_item_suffix := '_ASG_ADJ_PTD';
2348 ELSIF g_nom_bal_def_table(i).database_item_suffix like 'CORR_SI' THEN
2349 g_nom_bal_def_table(i).database_item_suffix := '_ASG_SIT_REPORT_CORR_PTD';
2350 ELSIF g_nom_bal_def_table(i).database_item_suffix like 'CORR' THEN
2351 g_nom_bal_def_table(i).database_item_suffix := '_ASG_REPORT_CORR_PTD';
2352 END IF;
2353 END IF;
2354 IF g_nom_bal_def_table(i).database_item_suffix IS NOT NULL THEN
2355 g_nom_bal_def_table(i).defined_balance_id := get_defined_balance_id(g_nom_bal_def_table(i).balance_name
2356 ,g_nom_bal_def_table(i).database_item_suffix);
2357 END IF;
2358 IF g_nom_bal_def_table(i).defined_balance_id <> 0 AND
2359 (p_type <> 'INITIAL' OR g_nom_bal_def_table(i).database_item_suffix not in ('_ASG_REPORT_CORR_PTD','_ASG_SIT_REPORT_CORR_PTD','_ASG_BDATE_PTD','_ASG_SIT_BDATE_PTD')) THEN
2360 --(p_record_type <> 'HR' OR g_nom_bal_def_table(i).database_item_suffix not in ('_ASG_REPORT_CORR_PTD','_ASG_ADJ_PTD'))
2361 l_assignment_action_id := p_assignment_action_id;
2362 l_context := 'N';
2363 l_balance_date := NULL;
2364 l_context_id := NULL;
2365 l_source_text := NULL;
2366 l_source_text2 := NULL;
2367 --
2368 IF g_nom_bal_def_table(i).database_item_suffix LIKE '%/_REPORT/_%' ESCAPE '/' OR
2369 g_nom_bal_def_table(i).database_item_suffix LIKE '%/_BDATE/_%' ESCAPE '/' THEN
2370 l_balance_date := p_effective_date;
2371 l_assignment_action_id := p_master_assignment_action_id;
2372 l_context := 'Y';
2373 END IF;
2374 --
2375 IF g_nom_bal_def_table(i).database_item_suffix LIKE '%/_SIT/_%' ESCAPE '/' THEN
2376 OPEN cur_act_contexts('SOURCE_TEXT');
2377 FETCH cur_act_contexts INTO l_context_id;
2378 CLOSE cur_act_contexts;
2379 l_source_text := g_nom_bal_def_table(i).context_val;
2380 l_context := 'Y';
2381 END IF;
2382 --
2383 IF g_nom_bal_def_table(i).database_item_suffix LIKE '%/_SIP/_%' ESCAPE '/' THEN
2384 OPEN cur_act_contexts('SOURCE_TEXT2');
2385 FETCH cur_act_contexts INTO l_context_id;
2386 CLOSE cur_act_contexts;
2387 l_source_text2 := g_nom_bal_def_table(i).context_val;
2388 l_context := 'Y';
2389 END IF;
2390 --
2391 IF g_nom_bal_def_table(i).database_item_suffix LIKE '%/_TU/_%' ESCAPE '/' THEN
2392 l_tax_unit_id := p_tax_unit_id;
2393 l_context := 'Y';
2394 END IF;
2395 --
2396 IF l_assignment_action_id = 0 OR l_assignment_action_id is NULL THEN
2397 p_balance_values(i).balance_value := 0;
2398 ELSE
2399 IF l_context = 'Y' THEN
2400 BEGIN
2401 p_balance_values(i).balance_value := pay_balance_pkg.get_value
2402 (p_defined_balance_id => g_nom_bal_def_table(i).defined_balance_id
2403 ,p_assignment_action_id => l_assignment_action_id
2404 ,p_tax_unit_id => l_tax_unit_id
2405 ,p_jurisdiction_code => NULL
2406 ,p_source_id => l_context_id
2407 ,p_source_text => l_source_text
2408 ,p_tax_group => NULL
2409 ,p_date_earned => NULL
2410 ,p_get_rr_route => NULL
2411 ,p_get_rb_route => NULL
2412 ,p_source_text2 => l_source_text2
2413 ,p_source_number => NULL
2414 ,p_time_def_id => NULL
2415 ,p_balance_date => l_balance_date
2416 ,p_payroll_id => NULL);
2417 --##--Fnd_file.put_line(FND_FILE.LOG,'#########'||g_nom_bal_def_table(i).balance_name||' '||g_nom_bal_def_table(i).database_item_suffix||' '||p_balance_values(i).balance_value||' '||g_nom_bal_def_table(i).context_val);
2418 --##--Fnd_file.put_line(FND_FILE.LOG,'#########defined_balance_id :'||g_nom_bal_def_table(i).defined_balance_id);
2419 EXCEPTION
2420 WHEN OTHERS THEN
2421 p_balance_values(i).balance_value := 0;
2422 --##--Fnd_file.put_line(FND_FILE.LOG,'####'||p_type||' '||g_nom_bal_def_table(i).balance_name||' '||g_nom_bal_def_table(i).database_item_suffix||' '||g_nom_bal_def_table(i).context_val);
2423 --Fnd_file.put_line(FND_FILE.LOG,'## p_defined_balance_id ' || g_nom_bal_def_table(i).defined_balance_id);
2424 --Fnd_file.put_line(FND_FILE.LOG,'## l_assignment_action_id ' || l_assignment_action_id);
2425 --Fnd_file.put_line(FND_FILE.LOG,'## l_tax_unit_id ' || l_tax_unit_id);
2426 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text ' || l_source_text);
2427 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text2 ' || l_source_text2);
2428 --Fnd_file.put_line(FND_FILE.LOG,'## l_balance_date ' || l_balance_date);
2429 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
2430 END;
2431 ELSE --IF g_nom_bal_def_table(i).database_item_suffix <> '_ASG_ADJ_PTD' THEN
2432 BEGIN
2433 p_balance_values(i).balance_value := pay_balance_pkg.get_value(g_nom_bal_def_table(i).defined_balance_id
2434 ,p_assignment_action_id);
2435 --##--Fnd_file.put_line(FND_FILE.LOG,'#########'||g_nom_bal_def_table(i).balance_name||' '||g_nom_bal_def_table(i).database_item_suffix||' '||p_balance_values(i).balance_value||' '||g_nom_bal_def_table(i).context_val);
2436 --##--Fnd_file.put_line(FND_FILE.LOG,'#########defined_balance_id :'||g_nom_bal_def_table(i).defined_balance_id);
2437 EXCEPTION
2438 WHEN OTHERS THEN
2439 p_balance_values(i).balance_value := 0;
2440 --Fnd_file.put_line(FND_FILE.LOG,'##'||p_type||' '||g_nom_bal_def_table(i).balance_name||' '||g_nom_bal_def_table(i).database_item_suffix||' '||g_nom_bal_def_table(i).context_val);
2441 --Fnd_file.put_line(FND_FILE.LOG,'## p_defined_balance_id ' || g_nom_bal_def_table(i).defined_balance_id);
2442 --Fnd_file.put_line(FND_FILE.LOG,'## l_assignment_action_id ' || l_assignment_action_id);
2443 END;
2444 END IF;
2445 END IF;
2446 END IF;
2447 END LOOP;
2448 --
2449 END populate_nom_balance_values;
2450 /*--------------------------------------------------------------------------------
2451 -- Function to retrieve correction balance for a period
2452 --------------------------------------------------------------------------------
2453 FUNCTION get_corr_bal(p_tax_unit_id IN NUMBER,p_date IN DATE) RETURN NUMBER IS
2454 BEGIN
2455 RETURN 100;
2456 END get_corr_bal;*/
2457 --------------------------------------------------------------------------------
2458 -- SET_COMPANY_TYPE_GLOBALS
2459 --------------------------------------------------------------------------------
2460 PROCEDURE set_company_type(p_actid IN NUMBER) IS
2461 --
2462 CURSOR csr_get_le_info (p_organization_id NUMBER) IS
2463 SELECT hoi.org_information2 org_id
2464 ,hoi.org_information5 Public_Org
2465 ,hoi.org_information6 Own_Risk_Cover
2466 FROM hr_organization_information hoi
2467 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
2468 AND hoi.organization_id = p_organization_id
2469 AND EXISTS (SELECT 1
2470 FROM hr_organization_information hoi1
2471 WHERE hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
2472 AND hoi1.org_information_context = 'CLASS'
2473 AND hoi1.organization_id = hoi.organization_id);
2474 /*SELECT hoi.org_information2 org_id
2475 ,hoi.org_information5 Public_Org
2476 ,hoi.org_information6 Own_Risk_Cover
2477 FROM hr_organization_information hoi
2478 ,hr_organization_information hoi1
2479 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
2480 AND hoi.organization_id = hoi1.organization_id
2481 AND hoi1.organization_id = p_organization_id
2482 AND hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
2483 AND hoi1.org_information_context = 'CLASS';*/
2484 --
2485 CURSOR csr_own_risk_cover(c_employer_id NUMBER
2486 ,c_business_group_id NUMBER) IS
2487 SELECT hoi.org_information5 Own_Risk_Cover
2488 ,hoi.org_information6 Contract_Code_Mapping
2489 FROM hr_organization_units hou
2490 ,hr_organization_information hoi
2491 WHERE hoi.org_information_context = 'NL_ORG_WR_INFO'
2492 AND hou.business_group_id = c_business_group_id
2493 AND hou.organization_id = hoi.organization_id
2494 AND hou.organization_id = c_employer_id;
2495 --
2496 CURSOR csr_public_org_flag(c_employer_id NUMBER
2497 ,c_business_group_id NUMBER) IS
2498 SELECT hoi.org_information17 Public_Org
2499 FROM hr_organization_units hou,hr_organization_information hoi
2500 WHERE hoi.org_information_context = 'NL_ORG_INFORMATION'
2501 AND hou.business_group_id = c_business_group_id
2502 AND hou.organization_id = hoi.organization_id
2503 AND hou.organization_id = c_employer_id;
2504 --
2505 CURSOR csr_retro_date(c_business_group_id NUMBER) IS
2506 select fnd_date.canonical_to_date(org_information5)
2507 from hr_organization_information
2508 where organization_id = c_business_group_id
2509 AND org_information_context = 'NL_BG_INFO';
2510 --
2511 l_start_date DATE;
2512 l_end_date DATE;
2513 l_seq_no VARCHAR2(50);
2514 l_tax_unit_id NUMBER;
2515 l_payroll_type VARCHAR2(80);
2516 l_business_group_id hr_all_organization_units.business_group_id%TYPE;
2517 l_hr_tax_unit hr_all_organization_units.organization_id%TYPE;
2518 l_risk_cover_flag hr_lookups.lookup_type%TYPE;
2519 l_date DATE;
2520 --
2521 BEGIN
2522 --
2523 pay_nl_wage_report_pkg.get_all_parameters(p_actid
2524 ,l_business_group_id
2525 ,l_start_date
2526 ,l_end_date
2527 ,l_tax_unit_id
2528 ,l_payroll_type
2529 ,l_seq_no);
2530 --
2531 g_public_org_flag := NULL;
2532 g_risk_cover_flag := NULL;
2533 l_hr_tax_unit := NULL;
2534 g_retro_type := 'OLD';
2535 g_effective_date := l_end_date;
2536 --
2537 OPEN csr_get_le_info(l_tax_unit_id);
2538 FETCH csr_get_le_info INTO l_hr_tax_unit,g_public_org_flag,g_risk_cover_flag;
2539 CLOSE csr_get_le_info;
2540 --
2541 IF g_public_org_flag IS NULL THEN
2542 OPEN csr_public_org_flag(NVL(l_hr_tax_unit,l_tax_unit_id),l_business_group_id);
2543 FETCH csr_public_org_flag INTO g_public_org_flag;
2544 CLOSE csr_public_org_flag;
2545 END IF;
2546 --
2547 --IF g_risk_cover_flag IS NULL THEN
2548 OPEN csr_own_risk_cover(NVL(l_hr_tax_unit,l_tax_unit_id),l_business_group_id);
2549 FETCH csr_own_risk_cover INTO l_risk_cover_flag,g_contract_code_mapping;
2550 CLOSE csr_own_risk_cover;
2551 --END IF;
2552 --
2553 OPEN csr_retro_date(l_business_group_id);
2554 FETCH csr_retro_date INTO l_date;
2555 CLOSE csr_retro_date;
2556 --
2557 g_public_org_flag := NVL(g_public_org_flag,'N');
2558 g_risk_cover_flag := NVL(NVL(g_risk_cover_flag,l_risk_cover_flag),'N');
2559 g_contract_code_mapping := NVL(g_contract_code_mapping,'NL_EMPLOYMENT_CATG');
2560 --
2561 IF l_date <= l_start_date THEN
2562 g_retro_type := 'NEW';
2563 END IF;
2564 --
2565 END set_company_type;
2566 --------------------------------------------------------------------------------
2567 -- INITIALIZE_CODE pay_nl_wage_report_pkg.archive_init_code
2568 --------------------------------------------------------------------------------
2569 PROCEDURE archive_init_code(p_actid IN NUMBER) IS
2570 l_payroll_type VARCHAR2(80);
2571 BEGIN
2572 --
2573 set_company_type(p_actid);
2574 ---Done for the yearly report
2575 l_payroll_type := TO_CHAR(get_parameters(p_actid,'Payroll_Type'));
2576 populate_nom_balance_table(l_payroll_type);
2577 --
2578 END archive_init_code;
2579 --------------------------------------------------------------------------------
2580 -- ARCHIVE_DEINIT_CODE_YEARLY
2581 --------------------------------------------------------------------------------
2582 PROCEDURE archive_deinit_code_yearly(p_actid IN NUMBER
2583 ,p_business_group_id IN NUMBER
2584 ,p_start_date IN DATE
2585 ,p_end_date IN DATE
2586 ,p_tax_unit_id IN NUMBER
2587 ,p_payroll_type IN VARCHAR2
2588 ,p_seq_no IN VARCHAR2)
2589 IS
2590 -- DECLARE LOCAL VARIABLES
2591 l_ovn pay_action_information.object_version_number%type;
2592 l_action_info_id pay_action_information.action_information_id%type;
2593 l_business_group_id hr_all_organization_units.business_group_id%type;
2594 l_start_date DATE;
2595 l_end_date DATE;
2596 l_seq_no VARCHAR2(50);
2597 l_emp_total number;
2598 l_tax_unit_id NUMBER;
2599 l_payroll_type VARCHAR2(80);
2600 --CURSORS
2601 -- Employer's contact and telephone number
2602 CURSOR csr_get_empr_contact(c_employer_id NUMBER
2603 ,c_business_group_id NUMBER) IS
2604 SELECT hoi.org_information1 sender_id
2605 ,hoi.org_information2 contact_name
2606 ,hoi.org_information3 contact_num
2607 FROM hr_organization_units hou,hr_organization_information hoi
2608 WHERE hoi.org_information_context = 'NL_ORG_WR_INFO'
2609 AND hou.business_group_id = c_business_group_id
2610 AND hou.organization_id = hoi.organization_id
2611 AND hou.organization_id = c_employer_id;
2612 --
2613 -- Employer Tax reg name and Tax reg number
2614 CURSOR csr_tax_details(c_employer_id NUMBER
2615 ,c_business_group_id NUMBER) IS
2616 SELECT hoi.org_information14 tax_rep_name
2617 ,hoi.org_information4 tax_reg_num
2618 FROM hr_organization_units hou
2619 ,hr_organization_information hoi
2620 WHERE hoi.org_information_context = 'NL_ORG_INFORMATION'
2621 AND hou.business_group_id = c_business_group_id
2622 AND hou.organization_id = hoi.organization_id
2623 AND hou.organization_id = c_employer_id;
2624 --
2625 CURSOR csr_le_hr_mapping_chk (p_organization_id NUMBER) IS
2626 SELECT hoi.org_information1 tax_ref_no
2627 ,hoi.org_information2 org_id
2628 ,hoi.org_information3 tax_rep_name
2629 FROM hr_organization_information hoi
2630 ,hr_organization_information hoi1
2631 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
2632 AND hoi.organization_id = hoi1.organization_id
2633 AND hoi1.organization_id = p_organization_id
2634 AND hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
2635 AND hoi1.org_information_context = 'CLASS';
2636 -- Period dates for Employee records
2637 -- cursor to get distinct start date and end date for the records archived
2638 -- CURSOR VARIABLES
2639 l_empr_contact csr_get_empr_contact%ROWTYPE;
2640 l_tax_details csr_tax_details%ROWTYPE;
2641 --l_period_dates csr_period_dates%ROWTYPE;
2642 --l_get_sect_risk_grp csr_get_sect_risk_grp%ROWTYPE;
2643 l_date DATE;
2644 l_c_base_mon_fd NUMBER;
2645 l_con_mon_fd NUMBER;
2646 l_corr_bal NUMBER;
2647 --l_ret_cor_period csr_ret_cor_period%ROWTYPE;
2648 l_sector_flag VARCHAR2(1);
2649 l_sip_sector hr_organization_information.org_information1%TYPE;
2650 l_risk_grp hr_organization_information.org_information1%TYPE;
2651 l_c_base_mon_fd_z VARCHAR2(1);
2652 --
2653 --#
2654 --
2655 empr_flag VARCHAR2(1);
2656 empe_flag VARCHAR2(1);
2657 l_exception_flag VARCHAR2(1);
2658 l_awf VARCHAR2(1);
2659 l_tax_ref_no hr_organization_information.org_information1%TYPE;
2660 l_tax_rep_name hr_organization_information.org_information3%TYPE;
2661 l_hr_tax_unit hr_all_organization_units.organization_id%TYPE;
2662 --#
2663 --
2664 --
2665 --csr_employer_info_rec csr_employer_info%ROWTYPE;
2666 l_first_emp VARCHAR2(1);
2667 y NUMBER;
2668 l_sector hr_organization_information.org_information1%TYPE;
2669 l_risk_group hr_organization_information.org_information1%TYPE;
2670 p_swmf_col_bal_def_table BAL_COL_TABLE;
2671 l_val NUMBER;
2672 l_curr_ass_action_id NUMBER;
2673 l_period_ass_action_id NUMBER;
2674 --
2675 l_prev_ass_act_id NUMBER;
2676 l_prev_end_date DATE;
2677 l_prev_corr_bal NUMBER;
2678 --
2679 --
2680 BEGIN
2681 --hr_utility.trace_on(null,'NL_WR');
2682 --Fnd_file.put_line(FND_FILE.LOG,' Entering deinit code ');
2683 /*Delete all data archived for the current payroll_action_id - to handle assignment level retry*/
2684 DELETE pay_action_information
2685 WHERE action_context_id = p_actid
2686 AND action_context_type = 'PA';
2687 --
2688 empr_flag := 'N';
2689 empe_flag := 'N';
2690 l_exception_flag := 'N';
2691 --
2692 set_company_type(p_actid);
2693 OPEN csr_le_hr_mapping_chk(p_tax_unit_id);
2694 FETCH csr_le_hr_mapping_chk INTO l_tax_ref_no,l_hr_tax_unit,l_tax_rep_name;
2695 CLOSE csr_le_hr_mapping_chk;
2696 --
2697 -- Get Contact Name and Telephone number
2698 OPEN csr_get_empr_contact(NVL(l_hr_tax_unit,p_tax_unit_id),p_business_group_id);
2699 FETCH csr_get_empr_contact INTO l_empr_contact;
2700 CLOSE csr_get_empr_contact;
2701 -- Get Tax reg num and Tax rep name
2702 OPEN csr_tax_details(NVL(l_hr_tax_unit,p_tax_unit_id),p_business_group_id);
2703 FETCH csr_tax_details INTO l_tax_details;
2704 CLOSE csr_tax_details;
2705 --
2706 l_tax_details.tax_rep_name := NVL(l_tax_rep_name,l_tax_details.tax_rep_name);
2707 l_tax_details.tax_reg_num := NVL(l_tax_ref_no,l_tax_details.tax_reg_num);
2708 --
2709 --Archiving Employee Data NL_WR_EMPLOYER_INFO
2710 --Fnd_file.put_line(FND_FILE.LOG,' Archiving NL_WR_EMPLOYER_INFO deinit code ');
2711 pay_action_information_api.create_action_information
2712 (
2713 p_action_information_id => l_action_info_id
2714 , p_action_context_id => p_actid
2715 , p_action_context_type => 'PA'
2716 , p_object_version_number => l_ovn
2717 , p_assignment_id => NULL
2718 , p_effective_date => p_end_date
2719 , p_source_id => NULL
2720 , p_source_text => NULL
2721 , p_tax_unit_id => p_tax_unit_id
2722 , p_action_information_category => 'NL_WR_EMPLOYER_INFO'
2723 , p_action_information1 => p_tax_unit_id
2724 , p_action_information2 => substr(l_empr_contact.sender_id||l_tax_details.tax_reg_num,1,32)
2725 , p_action_information3 => fnd_date.date_to_canonical(sysdate)
2726 , p_action_information4 => substr(l_empr_contact.contact_name,1,35)
2727 , p_action_information5 => substr(l_seq_no,1,6)
2728 , p_action_information6 => substr(l_empr_contact.contact_num,1,14)
2729 , p_action_information7 => 'SWO00361ORACLE' --'BEL00361ORACLE' --Bug#: 7338209
2730 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12)
2731 , p_action_information9 => substr(l_tax_details.tax_rep_name,1,200)
2732 , p_action_information10 => fnd_date.date_to_canonical(GREATEST(p_start_date,trunc(p_end_date,'Y')))
2733 , p_action_information11 => fnd_date.date_to_canonical(p_end_date)
2734 , p_action_information12 => g_contract_code_mapping);
2735 --Fnd_file.put_line(FND_FILE.LOG,' Archived NL_WR_EMPLOYER_INFO deinit code ');
2736 --
2737
2738 --Fnd_file.put_line(FND_FILE.LOG,' Leaving Deinit Code');
2739 --#
2740 EXCEPTION
2741 WHEN OTHERS THEN
2742 -- Return cursor that selects no rows
2743 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
2744 hr_utility.set_location(sqlerrm(sqlcode),110);
2745 END archive_deinit_code_yearly;
2746 --------------------------------------------------------------------------------
2747 -- DEINITIALIZE_CODE pay_nl_wage_report_pkg.archive_deinit_code
2748 --------------------------------------------------------------------------------
2749 PROCEDURE archive_deinit_code(p_actid IN NUMBER)
2750 IS
2751 -- DECLARE LOCAL VARIABLES
2752 l_ovn pay_action_information.object_version_number%type;
2753 l_action_info_id pay_action_information.action_information_id%type;
2754 l_business_group_id hr_all_organization_units.business_group_id%type;
2755 l_start_date DATE;
2756 l_end_date DATE;
2757 l_seq_no VARCHAR2(50);
2758 l_emp_total number;
2759 l_tax_unit_id NUMBER;
2760 l_payroll_type VARCHAR2(80);
2761 --CURSORS
2762 -- Employer's contact and telephone number
2763 CURSOR csr_get_empr_contact(c_employer_id NUMBER
2764 ,c_business_group_id NUMBER) IS
2765 SELECT hoi.org_information1 sender_id
2766 ,hoi.org_information2 contact_name
2767 ,hoi.org_information3 contact_num
2768 FROM hr_organization_units hou,hr_organization_information hoi
2769 WHERE hoi.org_information_context = 'NL_ORG_WR_INFO'
2770 AND hou.business_group_id = c_business_group_id
2771 AND hou.organization_id = hoi.organization_id
2772 AND hou.organization_id = c_employer_id;
2773 --
2774 -- Employer Tax reg name and Tax reg number
2775 CURSOR csr_tax_details(c_employer_id NUMBER
2776 ,c_business_group_id NUMBER) IS
2777 SELECT hoi.org_information14 tax_rep_name
2778 ,hoi.org_information4 tax_reg_num
2779 FROM hr_organization_units hou
2780 ,hr_organization_information hoi
2781 WHERE hoi.org_information_context = 'NL_ORG_INFORMATION'
2782 AND hou.business_group_id = c_business_group_id
2783 AND hou.organization_id = hoi.organization_id
2784 AND hou.organization_id = c_employer_id;
2785 --
2786 -- Period dates for Employee records
2787 -- cursor to get distinct start date and end date for the records archived
2788 CURSOR csr_period_dates(c_pact_id NUMBER) IS
2789 SELECT DISTINCT pai.Action_Information2 Start_date
2790 ,pai.action_information3 End_date
2791 FROM pay_assignment_actions paa
2792 ,pay_action_information pai
2793 WHERE paa.payroll_action_id = c_pact_id
2794 AND paa.assignment_action_id = pai.action_context_id
2795 AND pai.action_information_category = 'NL_WR_EMPLOYMENT_INFO'
2796 AND pai.action_information1 IN ('INITIAL','CORRECTION','CORRECT')
2797 AND pai.action_context_type = 'AAP';
2798 --
2799 -- Employeer Sector and Risk Group
2800 CURSOR csr_get_sect_risk_grp(c_employer_id NUMBER
2801 ,c_effective_date DATE
2802 ,c_business_group_id NUMBER) IS
2803 SELECT distinct hoi1.org_information5 sector
2804 ,hoi1.org_information6 risk_group
2805 ,hoi1.organization_id
2806 FROM hr_organization_information hoi1
2807 ,hr_organization_information hoi2
2808 ,hr_organization_information hoi3
2809 ,per_org_structure_versions posv
2810 WHERE hoi2.org_information4 = hoi1.organization_id
2811 AND hoi1.org_information5 IS NOT NULL
2812 AND hoi1.org_information6 IS NOT NULL
2813 AND hoi2.org_information_context= 'NL_SIP'
2814 AND hoi1.org_information_context= 'NL_UWV'
2815 AND hoi3.organization_id = c_business_group_id
2816 AND hoi3.org_information_context= 'NL_BG_INFO'
2817 --AND hoi2.org_information7 = 'Y'
2818 AND hr_nl_org_info.Get_Tax_Org_Id(posv.ORG_STRUCTURE_VERSION_ID ,hoi2.organization_id) = c_employer_id
2819 AND posv.ORGANIZATION_STRUCTURE_ID = TO_NUMBER(hoi3.org_information1)
2820 AND c_effective_date BETWEEN posv.date_from
2821 AND nvl(posv.date_to,to_date('31-12-4712','dd-mm-yyyy'))
2822 AND c_effective_date BETWEEN fnd_date.canonical_to_date(hoi2.org_information1)
2823 AND nvl(fnd_date.canonical_to_date(hoi2.org_information2),to_date('31-12-4712','dd-mm-yyyy'))
2824 AND EXISTS (SELECT 1
2825 FROM hr_organization_information hoi4
2826 WHERE hoi4.organization_id = hoi1.organization_id
2827 AND hoi4.org_information_context = 'NL_SIT'
2828 AND ORG_INFORMATION4 = 'WEWA')
2829 ORDER BY 1,2;
2830 --
2831 -- Correction balance total periods
2832 CURSOR csr_ret_cor_period(c_pact_id NUMBER) IS
2833 SELECT DISTINCT fnd_date.canonical_to_date(pai.Action_Information2) Start_date
2834 ,fnd_date.canonical_to_date(pai.action_information3) End_date
2835 FROM pay_assignment_actions paa
2836 ,pay_action_information pai
2837 WHERE paa.payroll_action_id = c_pact_id
2838 AND paa.assignment_action_id = pai.action_context_id
2839 AND pai.action_information_category = 'NL_WR_EMPLOYMENT_INFO'
2840 AND pai.action_information1 IN ('INITIAL','CORRECTION','CORRECT')
2841 AND pai.action_context_type = 'AAP'
2842 AND pai.action_information17 = 'PAY';
2843 --
2844 --
2845 /* CURSOR csr_le_hr_mapping_chk (p_organization_id NUMBER) IS
2846 SELECT hoi.org_information2 org_id
2847 ,hoi.org_information5 Public_Org
2848 ,hoi.org_information6 Own_Risk_Cover
2849 FROM hr_organization_information hoi
2850 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
2851 AND hoi.organization_id = p_organization_id
2852 AND EXISTS (SELECT 1
2853 FROM hr_organization_information hoi1
2854 WHERE hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
2855 AND hoi1.org_information_context = 'CLASS'
2856 AND hoi1.organization_id = hoi.organization_id); */
2857 CURSOR csr_le_hr_mapping_chk (p_organization_id NUMBER) IS
2858 SELECT hoi.org_information1 tax_ref_no
2859 ,hoi.org_information2 org_id
2860 ,hoi.org_information3 tax_rep_name
2861 FROM hr_organization_information hoi
2862 ,hr_organization_information hoi1
2863 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
2864 AND hoi.organization_id = hoi1.organization_id
2865 AND hoi1.organization_id = p_organization_id
2866 AND hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
2867 AND hoi1.org_information_context = 'CLASS';
2868 --
2869 -- CURSOR VARIABLES
2870 l_empr_contact csr_get_empr_contact%ROWTYPE;
2871 l_tax_details csr_tax_details%ROWTYPE;
2872 --l_period_dates csr_period_dates%ROWTYPE;
2873 l_get_sect_risk_grp csr_get_sect_risk_grp%ROWTYPE;
2874 l_date DATE;
2875 l_c_base_mon_fd NUMBER;
2876 l_con_mon_fd NUMBER;
2877 l_corr_bal NUMBER;
2878 l_ret_cor_period csr_ret_cor_period%ROWTYPE;
2879 l_sector_flag VARCHAR2(1);
2880 l_sip_sector hr_organization_information.org_information1%TYPE;
2881 l_risk_grp hr_organization_information.org_information1%TYPE;
2882 l_c_base_mon_fd_z VARCHAR2(1);
2883 --
2884 --#
2885 CURSOR csr_get_PA_exception_info(p_payroll_action_id IN NUMBER) IS
2886 SELECT pai_p.action_information4 Message
2887 ,fnd_date.date_to_displaydate(fnd_date.canonical_to_date(pai_p.action_information5)) Dt
2888 ,pai_p.action_information6 Description
2889 ,substr(pai_p.action_information7,1,30) E_Name
2890 ,substr(pai_p.action_information8,1,30) E_Number
2891 ,pai_p.action_context_type cxt
2892 FROM pay_action_information pai_p
2893 WHERE pai_p.action_context_id = p_payroll_action_id
2894 AND pai_p.action_information_category = 'NL_WR_EXCEPTION_REPORT'
2895 AND pai_p.action_context_type = 'PA'
2896 ORDER BY pai_p.action_information8 asc;
2897 --
2898 CURSOR csr_get_AAP_exception_info(p_payroll_action_id IN NUMBER) IS
2899 SELECT pai_p.action_information4 Message
2900 ,fnd_date.date_to_displaydate(fnd_date.canonical_to_date(pai_p.action_information5)) Dt
2901 ,pai_p.action_information6 Description
2902 ,substr(pai_p.action_information7,1,30) E_Name
2903 ,substr(pai_p.action_information8,1,30) E_Number
2904 ,pai_p.action_context_type cxt
2905 FROM pay_assignment_actions paa
2906 ,pay_action_information pai_p
2907 WHERE paa.payroll_action_id = p_payroll_action_id
2908 AND pai_p.action_context_id = paa.assignment_action_id
2909 AND pai_p.action_information_category = 'NL_WR_EXCEPTION_REPORT'
2910 AND pai_p.action_context_type = 'AAP'
2911 ORDER BY pai_p.action_information8 asc;
2912 --
2913 empr_flag VARCHAR2(1);
2914 empe_flag VARCHAR2(1);
2915 l_exception_flag VARCHAR2(1);
2916 l_awf VARCHAR2(1);
2917 l_tax_ref_no hr_organization_information.org_information1%TYPE;
2918 l_tax_rep_name hr_organization_information.org_information3%TYPE;
2919 l_hr_tax_unit hr_all_organization_units.organization_id%TYPE;
2920 --#
2921 --
2922 CURSOR csr_get_pactid IS
2923 SELECT DISTINCT paa1.payroll_action_id
2924 FROM pay_assignment_actions paa
2925 ,pay_action_interlocks pal
2926 ,pay_assignment_actions paa1
2927 WHERE paa.payroll_action_id = p_actid
2928 AND paa.assignment_action_id = pal.locking_action_id
2929 AND pal.locked_action_id = paa1.assignment_action_id
2930 ORDER BY paa1.payroll_action_id DESC;
2931 --
2932 CURSOR csr_employer_info(c_category VARCHAR2
2933 ,c_pactid NUMBER) IS
2934 SELECT pai.*
2935 FROM pay_action_information pai
2936 WHERE pai.action_context_type = 'PA'
2937 AND pai.action_context_id = c_pactid
2938 AND pai.action_information_category = c_category;
2939 --
2940 CURSOR csr_swmf_employer_info(c_legal_employer NUMBER
2941 ,c_start_date DATE
2942 ,c_end_date DATE) IS
2943 SELECT action_information7
2944 ,action_information8
2945 ,sum(fnd_number.canonical_to_number(action_information9)) action_information9
2946 ,sum(fnd_number.canonical_to_number(action_information10))action_information10
2947 FROM pay_action_information pai
2948 ,pay_payroll_actions ppa
2949 WHERE ppa.report_type = 'NL_WAGES_REP_ARCHIVE'
2950 AND ppa.report_qualifier = 'NL'
2951 AND ppa.action_type = 'X'
2952 AND ppa.action_status = 'C'
2953 AND INSTR(ppa.legislative_parameters,'Payroll_Type=WEEK') <> 0
2954 AND INSTR(ppa.legislative_parameters,'Legal_Employer='||c_legal_employer) <> 0
2955 AND ppa.effective_date BETWEEN c_start_date
2956 AND c_end_date
2957 AND pai.action_context_type = 'PA'
2958 AND pai.action_context_id = ppa.payroll_action_id
2959 AND pai.action_information_category = 'NL_WR_SWMF_SECTOR_RISK_GROUP'
2960 AND EXISTS ( SELECT 1
2961 FROM pay_assignment_actions paa1
2962 ,pay_action_interlocks ai
2963 ,pay_assignment_actions paa2
2964 WHERE paa1.payroll_action_id = p_actid
2965 AND paa1.assignment_action_id = ai.locking_action_id
2966 AND ai.locked_action_id = paa2.assignment_action_id
2967 AND paa2.payroll_action_id = ppa.payroll_action_id)
2968 GROUP BY action_information7,action_information8;
2969 --
2970 CURSOR csr_payroll_get_action_id(c_payroll_action_id NUMBER) IS
2971 SELECT max(locked_action_id)
2972 FROM pay_assignment_actions paa
2973 ,pay_payroll_actions ppa
2974 ,pay_action_interlocks pai
2975 WHERE ppa.payroll_action_id = c_payroll_action_id
2976 AND paa.payroll_action_id = ppa.payroll_action_id
2977 AND pai.locking_action_id = paa.assignment_action_id;
2978 --
2979 CURSOR csr_payroll_get_action_id2(c_payroll_action_id NUMBER
2980 ,c_start_date DATE
2981 ,c_end_date DATE) IS
2982 SELECT max(paa2.assignment_action_id)
2983 FROM pay_assignment_actions paa
2984 ,pay_payroll_actions ppa
2985 ,pay_action_interlocks pai
2986 ,pay_assignment_actions paa1
2987 ,pay_assignment_actions paa2
2988 ,pay_payroll_actions ppa2
2989 WHERE ppa.payroll_action_id = c_payroll_action_id
2990 AND paa.payroll_action_id = ppa.payroll_action_id
2991 AND pai.locking_action_id = paa.assignment_action_id
2992 AND paa1.assignment_action_id = pai.locked_action_id
2993 AND paa1.assignment_id = paa2.assignment_id
2994 AND paa2.payroll_action_id = ppa2.payroll_action_id
2995 AND ppa.business_group_id = ppa2.business_group_id
2996 AND ppa2.effective_date between c_start_date and c_end_date
2997 AND ppa2.action_type in ('R','Q')
2998 AND ppa2.action_status = 'C';
2999 --
3000 CURSOR csr_get_prev_period(c_ass_act_id NUMBER) IS
3001 SELECT paa2.assignment_action_id, ptp2.end_date
3002 FROM pay_assignment_actions paa1
3003 ,pay_payroll_actions ppa1
3004 ,pay_assignment_actions paa2
3005 ,pay_payroll_actions ppa2
3006 ,per_time_periods ptp1
3007 ,per_time_periods ptp2
3008 ,pay_all_payrolls_f ppf1
3009 ,pay_all_payrolls_f ppf2
3010 WHERE paa1.assignment_action_id = c_ass_act_id
3011 AND paa1.payroll_action_id = ppa1.payroll_action_id
3012 AND ppa1.payroll_id = ppf1.payroll_id
3013 AND ppa1.time_period_id = ptp1.time_period_id
3014 AND ppf1.period_type = 'Calendar Month'
3015 AND ppf1.period_type = ppf2.period_type
3016 AND paa1.tax_unit_id = paa2.tax_unit_id
3017 AND paa2.payroll_action_id = ppa2.payroll_action_id
3018 AND ppa2.payroll_id = ppf2.payroll_id
3019 AND ppa2.time_period_id = ptp2.time_period_id
3020 AND ptp2.end_date < ptp1.end_date
3021 ORDER BY 2 DESC;
3022
3023 --
3024 csr_employer_info_rec csr_employer_info%ROWTYPE;
3025 l_first_emp VARCHAR2(1);
3026 y NUMBER;
3027 l_sector hr_organization_information.org_information1%TYPE;
3028 l_risk_group hr_organization_information.org_information1%TYPE;
3029 p_swmf_col_bal_def_table BAL_COL_TABLE;
3030 l_val NUMBER;
3031 l_curr_ass_action_id NUMBER;
3032 l_period_ass_action_id NUMBER;
3033 --
3034 l_prev_ass_act_id NUMBER;
3035 l_prev_end_date DATE;
3036 l_prev_corr_bal NUMBER;
3037 --
3038 BEGIN
3039 --hr_utility.trace_on(null,'NL_WR');
3040 --Fnd_file.put_line(FND_FILE.LOG,' Entering deinit code ');
3041 /*Delete all data archived for the current payroll_action_id - to handle assignment level retry*/
3042 DELETE pay_action_information
3043 WHERE action_context_id = p_actid
3044 AND action_context_type = 'PA';
3045 --
3046 empr_flag := 'N';
3047 empe_flag := 'N';
3048 l_exception_flag := 'N';
3049 --
3050 --Fnd_file.put_line(FND_FILE.LOG,' 0 ');
3051 pay_nl_wage_report_pkg.get_all_parameters(p_actid
3052 ,l_business_group_id
3053 ,l_start_date
3054 ,l_end_date
3055 ,l_tax_unit_id
3056 ,l_payroll_type
3057 ,l_seq_no);
3058 --Fnd_file.put_line(FND_FILE.LOG,' 1 ');
3059 set_company_type(p_actid);
3060 IF l_payroll_type = 'YEARLY' THEN --
3061 archive_deinit_code_yearly(p_actid
3062 ,l_business_group_id
3063 ,l_start_date
3064 ,l_end_date
3065 ,l_tax_unit_id
3066 ,l_payroll_type
3067 ,l_seq_no);
3068 --Fnd_file.put_line(FND_FILE.LOG,' 2 ');
3069 ELSIF l_payroll_type <> 'FOUR_WEEK' THEN
3070 --
3071 l_tax_rep_name := NULL;
3072 l_tax_ref_no := NULL;
3073 l_hr_tax_unit := NULL;
3074 --
3075 --Fnd_file.put_line(FND_FILE.LOG,' 3 ');
3076 OPEN csr_le_hr_mapping_chk(l_tax_unit_id);
3077 FETCH csr_le_hr_mapping_chk INTO l_tax_ref_no,l_hr_tax_unit,l_tax_rep_name;
3078 CLOSE csr_le_hr_mapping_chk;
3079 --
3080 --Fnd_file.put_line(FND_FILE.LOG,' 4 ');
3081 populate_col_balance_table(l_payroll_type,l_end_date,p_actid,p_swmf_col_bal_def_table);
3082 l_emp_total := 0;
3083 --
3084 --Fnd_file.put_line(FND_FILE.LOG,' 5 ');
3085 -- Get Contact Name and Telephone number
3086 OPEN csr_get_empr_contact(NVL(l_hr_tax_unit,l_tax_unit_id),l_business_group_id);
3087 FETCH csr_get_empr_contact INTO l_empr_contact;
3088 CLOSE csr_get_empr_contact;
3089 --Fnd_file.put_line(FND_FILE.LOG,' 6 ');
3090 --
3091 -- Get Tax reg num and Tax rep name
3092 OPEN csr_tax_details(NVL(l_hr_tax_unit,l_tax_unit_id),l_business_group_id);
3093 FETCH csr_tax_details INTO l_tax_details;
3094 CLOSE csr_tax_details;
3095 --Fnd_file.put_line(FND_FILE.LOG,' 7 ');
3096 --
3097 l_tax_details.tax_rep_name := NVL(l_tax_rep_name,l_tax_details.tax_rep_name);
3098 l_tax_details.tax_reg_num := NVL(l_tax_ref_no,l_tax_details.tax_reg_num);
3099 --
3100 OPEN csr_payroll_get_action_id(p_actid);
3101 FETCH csr_payroll_get_action_id INTO l_curr_ass_action_id;
3102 CLOSE csr_payroll_get_action_id;
3103 --Fnd_file.put_line(FND_FILE.LOG,' 8 ');
3104 --
3105 --
3106 --
3107 IF l_empr_contact.sender_id IS NULL THEN
3108 pay_action_information_api.create_action_information
3109 (
3110 p_action_information_id => l_action_info_id
3111 , p_action_context_id => p_actid
3112 , p_action_context_type => 'PA'
3113 , p_object_version_number => l_ovn
3114 , p_assignment_id => NULL
3115 , p_effective_date => l_end_date
3116 , p_source_id => NULL
3117 , p_source_text => NULL
3118 , p_tax_unit_id => l_tax_unit_id
3119 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3120 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_SENDER_ID')
3121 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
3122 , p_action_information6 => 'Sender ID is null'
3123 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3124 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3125 END IF;
3126 --
3127 IF l_empr_contact.contact_name IS NULL THEN
3128 pay_action_information_api.create_action_information
3129 (
3130 p_action_information_id => l_action_info_id
3131 , p_action_context_id => p_actid
3132 , p_action_context_type => 'PA'
3133 , p_object_version_number => l_ovn
3134 , p_assignment_id => NULL
3135 , p_effective_date => l_end_date
3136 , p_source_id => NULL
3137 , p_source_text => NULL
3138 , p_tax_unit_id => l_tax_unit_id
3139 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3140 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_PERSON_NM')
3141 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
3142 , p_action_information6 => 'Contact Person is null'
3143 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3144 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3145 END IF;
3146 --
3147 IF l_empr_contact.contact_num IS NULL THEN
3148 pay_action_information_api.create_action_information
3149 (
3150 p_action_information_id => l_action_info_id
3151 , p_action_context_id => p_actid
3152 , p_action_context_type => 'PA'
3153 , p_object_version_number => l_ovn
3154 , p_assignment_id => NULL
3155 , p_effective_date => l_end_date
3156 , p_source_id => NULL
3157 , p_source_text => NULL
3158 , p_tax_unit_id => l_tax_unit_id
3159 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3160 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_CONTACT_NO')
3161 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
3162 , p_action_information6 => 'Contact Number is null'
3163 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3164 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3165 END IF;
3166 --
3167 IF l_tax_details.tax_reg_num IS NULL THEN
3168 pay_action_information_api.create_action_information
3169 (
3170 p_action_information_id => l_action_info_id
3171 , p_action_context_id => p_actid
3172 , p_action_context_type => 'PA'
3173 , p_object_version_number => l_ovn
3174 , p_assignment_id => NULL
3175 , p_effective_date => l_end_date
3176 , p_source_id => NULL
3177 , p_source_text => NULL
3178 , p_tax_unit_id => l_tax_unit_id
3179 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3180 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_TAX_NO')
3181 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
3182 , p_action_information6 => 'Tax Registration Number is null'
3183 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3184 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3185 END IF;
3186 --
3187 IF hr_ni_chk_pkg.chk_nat_id_format(l_tax_details.tax_reg_num,'DDDDDDDDDADD') <> upper(l_tax_details.tax_reg_num) OR
3188 substr(l_tax_details.tax_reg_num,10,1) <> 'L' THEN
3189 pay_action_information_api.create_action_information
3190 (
3191 p_action_information_id => l_action_info_id
3192 , p_action_context_id => p_actid
3193 , p_action_context_type => 'PA'
3194 , p_object_version_number => l_ovn
3195 , p_assignment_id => NULL
3196 , p_effective_date => l_end_date
3197 , p_source_id => NULL
3198 , p_source_text => NULL
3199 , p_tax_unit_id => l_tax_unit_id
3200 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3201 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_TAX_FORMAT')
3202 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
3203 , p_action_information6 => 'Tax Registration Number is not in the format 111111111L11'
3204 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3205 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3206 END IF;
3207 --
3208 IF l_tax_details.tax_rep_name IS NULL THEN
3209 pay_action_information_api.create_action_information
3210 (
3211 p_action_information_id => l_action_info_id
3212 , p_action_context_id => p_actid
3213 , p_action_context_type => 'PA'
3214 , p_object_version_number => l_ovn
3215 , p_assignment_id => NULL
3216 , p_effective_date => l_end_date
3217 , p_source_id => NULL
3218 , p_source_text => NULL
3219 , p_tax_unit_id => l_tax_unit_id
3220 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3221 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_TAX_NAME')
3222 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
3223 , p_action_information6 => 'Tax Reporting Name is null'
3224 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3225 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3226 END IF;
3227 --
3228 --Archiving Employee Data NL_WR_EMPLOYER_INFO
3229 --Fnd_file.put_line(FND_FILE.LOG,' Archiving NL_WR_EMPLOYER_INFO deinit code ');
3230 pay_action_information_api.create_action_information
3231 (
3232 p_action_information_id => l_action_info_id
3233 , p_action_context_id => p_actid
3234 , p_action_context_type => 'PA'
3235 , p_object_version_number => l_ovn
3236 , p_assignment_id => NULL
3237 , p_effective_date => l_end_date
3238 , p_source_id => NULL
3239 , p_source_text => NULL
3240 , p_tax_unit_id => l_tax_unit_id
3241 , p_action_information_category => 'NL_WR_EMPLOYER_INFO'
3242 , p_action_information1 => l_tax_unit_id
3243 , p_action_information2 => substr(l_empr_contact.sender_id||l_tax_details.tax_reg_num,1,32)
3244 , p_action_information3 => fnd_date.date_to_canonical(sysdate)
3245 , p_action_information4 => substr(l_empr_contact.contact_name,1,35)
3246 , p_action_information5 => substr(l_seq_no,1,6)
3247 , p_action_information6 => substr(l_empr_contact.contact_num,1,14)
3248 , p_action_information7 => 'SWO00361ORACLE' --'BEL00361ORACLE' --Bug#: 7338209
3249 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12)
3250 , p_action_information9 => substr(l_tax_details.tax_rep_name,1,200)
3251 , p_action_information10 => fnd_date.date_to_canonical(l_start_date)
3252 , p_action_information11 => fnd_date.date_to_canonical(l_end_date)
3253 , p_action_information12 => g_contract_code_mapping);
3254 --Fnd_file.put_line(FND_FILE.LOG,' Archived NL_WR_EMPLOYER_INFO deinit code ');
3255 --
3256 FOR l_period_dates_rec IN csr_period_dates(p_actid) LOOP
3257 --Fnd_file.put_line(FND_FILE.LOG,' In csr_period_dates '||l_period_dates_rec.End_date);
3258 l_date := fnd_date.canonical_to_date(l_period_dates_rec.End_date);
3259 IF l_date >= l_start_date AND l_date <= l_end_date THEN -- COMPLETE RECORD
3260 --Fnd_file.put_line(FND_FILE.LOG,' If Current Period -- COMPLETE ');
3261 --Fnd_file.put_line(FND_FILE.LOG,' Calling populate_coll_bal_table for COMPLETE ');
3262 populate_coll_bal_table(p_actid => p_actid
3263 ,p_tax_unit_id => l_tax_unit_id
3264 ,p_effective_date => l_date
3265 ,p_balance_date => l_date
3266 ,p_type => 'COMPLETE'
3267 ,p_ass_action_id => l_curr_ass_action_id
3268 ,p_payroll_type => l_payroll_type
3269 ,p_emp_total => l_emp_total
3270 ,p_collXMLTable => collXMLTable);
3271 --Fnd_file.put_line(FND_FILE.LOG,' Populated coll table in deinit code '||collXMLTable.LAST );
3272 l_sector_flag := 'N';
3273 --Sector Risk Group NOT to be archived for public sector company.
3274 --Fnd_file.put_line(FND_FILE.LOG,' Checking Sector Risk Group Information');
3275 IF g_public_org_flag = 'N' THEN
3276 -- Employer Sector and Risk Group
3277 l_sip_sector := NULL;
3278 l_risk_grp := NULL;
3279 l_c_base_mon_fd := 0;
3280 l_con_mon_fd := 0;
3281 l_c_base_mon_fd_z := 'N';
3282 FOR l_get_sect_risk_grp in csr_get_sect_risk_grp(NVL(l_hr_tax_unit,l_tax_unit_id),l_date,l_business_group_id) LOOP
3283 l_sip_sector := NVL(l_sip_sector,l_get_sect_risk_grp.sector);
3284 l_risk_grp := NVL(l_risk_grp,l_get_sect_risk_grp.risk_group);
3285 IF l_sip_sector <> l_get_sect_risk_grp.sector OR l_risk_grp <> l_get_sect_risk_grp.risk_group THEN
3286 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Sector Risk Group Information');
3287 pay_action_information_api.create_action_information
3288 ( p_action_information_id => l_action_info_id
3289 , p_action_context_id => p_actid
3290 , p_action_context_type => 'PA'
3291 , p_object_version_number => l_ovn
3292 , p_assignment_id => NULL
3293 , p_effective_date => l_end_date
3294 , p_source_id => NULL
3295 , p_source_text => NULL
3296 ,p_tax_unit_id => l_tax_unit_id
3297 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
3298 , p_action_information1 => 'SWMF'
3299 , p_action_information2 => NULL
3300 , p_action_information5 => l_period_dates_rec.start_date
3301 , p_action_information6 => l_period_dates_rec.End_date
3302 , p_action_information7 => substr(l_sip_sector,1,3)
3303 , p_action_information8 => substr(l_risk_grp,1,2)
3304 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
3305 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd )));
3306 l_sip_sector := l_get_sect_risk_grp.sector;
3307 l_risk_grp := l_get_sect_risk_grp.risk_group;
3308 l_emp_total := l_emp_total + l_con_mon_fd;
3309 l_sector_flag := 'Y';
3310 IF l_c_base_mon_fd = 0 THEN
3311 l_c_base_mon_fd_z := 'Y';
3312 END IF;
3313 l_c_base_mon_fd := 0;
3314 l_con_mon_fd := 0;
3315 END IF;
3316 --Fnd_file.put_line(FND_FILE.LOG,' Calling swmf balance ');
3317 populate_col_balance_values(p_swmf_col_bal_def_table,l_tax_unit_id,l_date,l_date,'COMPLETE',l_get_sect_risk_grp.organization_id,l_curr_ass_action_id);
3318 --Fnd_file.put_line(FND_FILE.LOG,' Got swmf balance ');
3319 FOR i in 1..2 LOOP
3320 l_c_base_mon_fd := l_c_base_mon_fd + p_swmf_col_bal_def_table(i).balance_value + p_swmf_col_bal_def_table(i).balance_value2;
3321 END LOOP;
3322 --
3323 FOR i in 3..4 LOOP
3324 l_con_mon_fd := l_con_mon_fd + p_swmf_col_bal_def_table(i).balance_value + p_swmf_col_bal_def_table(i).balance_value2;
3325 END LOOP;
3326 --
3327 END LOOP;
3328 IF l_sip_sector IS NOT NULL OR l_risk_grp IS NOT NULL THEN
3329 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Sector Risk Group Information');
3330 pay_action_information_api.create_action_information
3331 ( p_action_information_id => l_action_info_id
3332 , p_action_context_id => p_actid
3333 , p_action_context_type => 'PA'
3334 , p_object_version_number => l_ovn
3335 , p_assignment_id => NULL
3336 , p_effective_date => l_end_date
3337 , p_source_id => NULL
3338 , p_source_text => NULL
3339 ,p_tax_unit_id => l_tax_unit_id
3340 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
3341 , p_action_information1 => 'SWMF'
3342 , p_action_information2 => NULL
3343 , p_action_information5 => l_period_dates_rec.start_date
3344 , p_action_information6 => l_period_dates_rec.End_date
3345 , p_action_information7 => substr(l_sip_sector,1,3)
3346 , p_action_information8 => substr(l_risk_grp,1,2)
3347 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
3348 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd )));
3349 --l_sip_sector := l_get_sect_risk_grp.sector;
3350 --l_risk_grp := l_get_sect_risk_grp.risk_group;
3351 l_emp_total := l_emp_total + l_con_mon_fd;
3352 l_sector_flag := 'Y' ;
3353 IF l_c_base_mon_fd = 0 THEN
3354 l_c_base_mon_fd_z := 'Y';
3355 END IF;
3356 l_c_base_mon_fd := 0;
3357 l_con_mon_fd := 0;
3358 END IF;
3359 --
3360 END IF;
3361 --
3362 l_awf := 'N';
3363 --Fnd_file.put_line(FND_FILE.LOG,' Start loop for collXMLTable');
3364 FOR i IN collXMLTable.FIRST..collXMLTable.LAST LOOP
3365 --##--Fnd_file.put_line(FND_FILE.LOG,'#########'||'COMPLETE '||collXMLTable(i).TagName||' '||collXMLTable(i).TagValue||' '||collXMLTable(i).Mandatory);
3366 l_val := NULL;
3367 IF collXMLTable(i).Mandatory = 'Y' or collXMLTable(i).TagValue <> 0 THEN
3368 IF collXMLTable(i).TagName = 'TotTeBet' THEN
3369 l_val := l_emp_total;
3370 END IF;
3371 pay_action_information_api.create_action_information
3372 ( p_action_information_id => l_action_info_id
3373 , p_action_context_id => p_actid
3374 , p_action_context_type => 'PA'
3375 , p_object_version_number => l_ovn
3376 , p_tax_unit_id => l_tax_unit_id
3377 , p_assignment_id => NULL
3378 , p_effective_date => l_end_date
3379 , p_source_id => NULL
3380 , p_source_text => NULL
3381 , p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
3382 , p_action_information1 => 'COMPLETE'
3383 , p_action_information2 => collXMLTable(i).TagName
3384 , p_action_information3 => l_period_dates_rec.start_date
3385 , p_action_information4 => l_period_dates_rec.End_date
3386 , p_action_information5 => collXMLTable(i).TagDesc
3387 , p_action_information6 => fnd_number.number_to_canonical(ROUND(NVL(l_val,collXMLTable(i).TagValue))));
3388 IF collXMLTable(i).TagName = 'PrLnAWF' AND collXMLTable(i).TagValue <> 0 THEN
3389 l_awf := 'Y';
3390 END IF;
3391 END IF;
3392 END LOOP;
3393 --
3394 IF g_public_org_flag = 'N' THEN
3395 IF l_sector_flag = 'N' THEN
3396 pay_action_information_api.create_action_information
3397 (
3398 p_action_information_id => l_action_info_id
3399 , p_action_context_id => p_actid
3400 , p_action_context_type => 'PA'
3401 , p_object_version_number => l_ovn
3402 , p_assignment_id => NULL
3403 , p_effective_date => l_end_date
3404 , p_source_id => NULL
3405 , p_source_text => NULL
3406 , p_tax_unit_id => l_tax_unit_id
3407 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3408 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_SECTOR')
3409 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
3410 , p_action_information6 => 'Mandatory check on Sector'
3411 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3412 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3413 --
3414 pay_action_information_api.create_action_information
3415 (
3416 p_action_information_id => l_action_info_id
3417 , p_action_context_id => p_actid
3418 , p_action_context_type => 'PA'
3419 , p_object_version_number => l_ovn
3420 , p_assignment_id => NULL
3421 , p_effective_date => l_end_date
3422 , p_source_id => NULL
3423 , p_source_text => NULL
3424 , p_tax_unit_id => l_tax_unit_id
3425 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3426 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_RISK_GROUP')
3427 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
3428 , p_action_information6 => 'No Risk Group'
3429 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3430 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3431 END IF;
3432 --
3433 IF l_awf <> 'N' AND l_c_base_mon_fd_z = 'Y' THEN
3434 pay_action_information_api.create_action_information
3435 (
3436 p_action_information_id => l_action_info_id
3437 , p_action_context_id => p_actid
3438 , p_action_context_type => 'PA'
3439 , p_object_version_number => l_ovn
3440 , p_assignment_id => NULL
3441 , p_effective_date => l_end_date
3442 , p_source_id => NULL
3443 , p_source_text => NULL
3444 , p_tax_unit_id => l_tax_unit_id
3445 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3446 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_BASE_WEWE') -- Message Code should have been '%_WEWA'
3447 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
3448 , p_action_information6 => 'Waiting Money Fund contribution base is zero'
3449 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3450 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3451 END IF;
3452 --
3453 IF l_awf = 'N' AND l_c_base_mon_fd_z <> 'Y' THEN
3454 pay_action_information_api.create_action_information
3455 (
3456 p_action_information_id => l_action_info_id
3457 , p_action_context_id => p_actid
3458 , p_action_context_type => 'PA'
3459 , p_object_version_number => l_ovn
3460 , p_assignment_id => NULL
3461 , p_effective_date => l_end_date
3462 , p_source_id => NULL
3463 , p_source_text => NULL
3464 , p_tax_unit_id => l_tax_unit_id
3465 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3466 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_AWF')
3467 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
3468 , p_action_information6 => 'AWF contribution base is zero'
3469 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3470 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3471 END IF;
3472 END IF;
3473 --#
3474 --Correction total balance
3475 l_prev_ass_act_id := NULL;
3476 --Fnd_file.put_line(FND_FILE.LOG,'Fetching prev period act_id -- CORR_BALANCE ');
3477 OPEN csr_get_prev_period(l_curr_ass_action_id);
3478 FETCH csr_get_prev_period INTO l_prev_ass_act_id, l_prev_end_date;
3479 CLOSE csr_get_prev_period;
3480 --Fnd_file.put_line(FND_FILE.LOG,'Prev period End Date -- CORR_BALANCE '||fnd_date.date_to_canonical(l_prev_end_date));
3481 --Fnd_file.put_line(FND_FILE.LOG,'Prev period act_id -- CORR_BALANCE '||fnd_number.number_to_canonical(l_prev_ass_act_id));
3482 FOR l_ret_cor_period IN csr_ret_cor_period(p_actid) LOOP
3483 --Fnd_file.put_line(FND_FILE.LOG,'Calling populate_coll_bal_table -- CORR_BALANCE '||fnd_date.date_to_canonical(l_ret_cor_period.End_date));
3484 populate_coll_bal_table(p_actid => p_actid
3485 ,p_tax_unit_id => l_tax_unit_id
3486 ,p_effective_date=> l_end_date
3487 ,p_balance_date => l_ret_cor_period.End_date
3488 ,p_type => 'CORR_BALANCE'
3489 ,p_ass_action_id => l_curr_ass_action_id
3490 ,p_payroll_type => l_payroll_type
3491 ,p_emp_total => l_corr_bal
3492 ,p_collXMLTable => collXMLTable);
3493 --Fnd_file.put_line(FND_FILE.LOG,'corr balance -- CORR_BALANCE '||fnd_number.number_to_canonical(l_corr_bal));
3494 IF l_prev_ass_act_id IS NOT NULL THEN
3495 populate_coll_bal_table(p_actid => p_actid
3496 ,p_tax_unit_id => l_tax_unit_id
3497 ,p_effective_date=> l_prev_end_date
3498 ,p_balance_date => l_ret_cor_period.End_date
3499 ,p_type => 'CORR_BALANCE'
3500 ,p_ass_action_id => l_prev_ass_act_id
3501 ,p_payroll_type => l_payroll_type
3502 ,p_emp_total => l_prev_corr_bal
3503 ,p_collXMLTable => collXMLTable);
3504 l_corr_bal := l_corr_bal - NVL(l_prev_corr_bal,0);
3505 --Fnd_file.put_line(FND_FILE.LOG,'Prev corr balance -- CORR_BALANCE '||fnd_number.number_to_canonical(l_prev_corr_bal));
3506 END IF;
3507
3508 --Fnd_file.put_line(FND_FILE.LOG,' Checking Sector Risk Group Information');
3509 IF g_public_org_flag = 'N' THEN
3510 FOR l_get_sect_risk_grp in csr_get_sect_risk_grp(NVL(l_hr_tax_unit,l_tax_unit_id),l_date,l_business_group_id) LOOP
3511 --Fnd_file.put_line(FND_FILE.LOG,' Calling swmf balance -- CORR_BALANCE');
3512 populate_col_balance_values(p_swmf_col_bal_def_table,l_tax_unit_id,l_end_date,l_ret_cor_period.End_date,'CORR_BALANCE',l_get_sect_risk_grp.organization_id,l_curr_ass_action_id);
3513 --Fnd_file.put_line(FND_FILE.LOG,' Got swmf balance ');
3514 FOR i in 3..4 LOOP
3515 l_corr_bal := l_corr_bal + p_swmf_col_bal_def_table(i).balance_value + p_swmf_col_bal_def_table(i).balance_value2;
3516 END LOOP;
3517 --
3518 IF l_prev_ass_act_id IS NOT NULL THEN
3519 populate_col_balance_values(p_swmf_col_bal_def_table,l_tax_unit_id,l_prev_end_date,l_ret_cor_period.End_date,'CORR_BALANCE',l_get_sect_risk_grp.organization_id,l_prev_ass_act_id);
3520 --Fnd_file.put_line(FND_FILE.LOG,' Got swmf balance for prev period');
3521 FOR i in 3..4 LOOP
3522 l_corr_bal := l_corr_bal - (p_swmf_col_bal_def_table(i).balance_value + p_swmf_col_bal_def_table(i).balance_value2);
3523 END LOOP;
3524 END IF;
3525 --
3526 END LOOP;
3527 --
3528 END IF;
3529 l_emp_total := l_emp_total + l_corr_bal;
3530 --Fnd_file.put_line(FND_FILE.LOG,'Archiving NL_WR_COLLECTIVE_REPORT - CORR_BALANCE ');
3531 pay_action_information_api.create_action_information
3532 ( p_action_information_id => l_action_info_id
3533 , p_action_context_id => p_actid
3534 , p_action_context_type => 'PA'
3535 , p_object_version_number => l_ovn
3536 , p_tax_unit_id => l_tax_unit_id
3537 , p_assignment_id => NULL
3538 , p_effective_date => l_end_date
3539 , p_source_id => NULL
3540 , p_source_text => NULL
3541 , p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
3542 , p_action_information1 => 'CORR_BALANCE'
3543 , p_action_information2 => 'Saldo'
3544 , p_action_information3 => fnd_date.date_to_canonical(l_ret_cor_period.start_date)
3545 , p_action_information4 => fnd_date.date_to_canonical(l_ret_cor_period.End_date)
3546 , p_action_information5 => HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('Saldo'))
3547 , p_action_information6 => fnd_number.number_to_canonical(ROUND(l_corr_bal)));
3548 END LOOP;
3549 -- Employer general total
3550 --Fnd_file.put_line(FND_FILE.LOG,'Archiving NL_WR_COLLECTIVE_REPORT - TOTAL ');
3551 pay_action_information_api.create_action_information
3552 (p_action_information_id => l_action_info_id
3553 ,p_action_context_id => p_actid
3554 ,p_action_context_type => 'PA'
3555 ,p_object_version_number => l_ovn
3556 ,p_tax_unit_id => l_tax_unit_id
3557 ,p_assignment_id => NULL
3558 ,p_effective_date => l_end_date
3559 ,p_source_id => NULL
3560 ,p_source_text => NULL
3561 ,p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
3562 ,p_action_information1 => 'TOTAL'
3563 ,p_action_information2 => 'TotGen' -- TAG NAME
3564 ,p_action_information3 => l_period_dates_rec.start_date
3565 ,p_action_information4 => l_period_dates_rec.End_date
3566 ,p_action_information5 => HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotGen')) -- TAG DESCRIPTION
3567 ,p_action_information6 => fnd_number.number_to_canonical(ROUND(l_emp_total)));
3568 ELSE
3569 --Fnd_file.put_line(FND_FILE.LOG,' ELSE (Correction Period) -- CORRECTION ');
3570 OPEN csr_payroll_get_action_id2(p_actid
3571 ,fnd_date.canonical_to_date(l_period_dates_rec.start_date)
3572 ,fnd_date.canonical_to_date(l_period_dates_rec.End_date));
3573 FETCH csr_payroll_get_action_id2 INTO l_period_ass_action_id;
3574 CLOSE csr_payroll_get_action_id2;
3575 --Fnd_file.put_line(FND_FILE.LOG,'Calling populate_coll_bal_table -- CORRECTION ');
3576 populate_coll_bal_table(p_actid => p_actid
3577 ,p_tax_unit_id => l_tax_unit_id
3578 ,p_effective_date => l_end_date
3579 ,p_balance_date => l_date
3580 ,p_type => 'CORRECTION'
3581 ,p_ass_action_id => l_period_ass_action_id -- pass that months action id
3582 ,p_payroll_type => l_payroll_type
3583 ,p_emp_total => l_emp_total
3584 ,p_collXMLTable => collXMLTable);
3585 -- Employer Sector and Risk Group
3586 l_sector_flag := 'N';
3587 --Sector Risk Group NOT to be archived for public sector company. -vv
3588 --Fnd_file.put_line(FND_FILE.LOG,' Checking Sector Risk Group Information');
3589 IF g_public_org_flag = 'N' THEN
3590 l_sip_sector := NULL;
3591 l_risk_grp := NULL;
3592 l_c_base_mon_fd := 0;
3593 l_con_mon_fd := 0;
3594 l_c_base_mon_fd_z := 'N';
3595 FOR l_get_sect_risk_grp in csr_get_sect_risk_grp(NVL(l_hr_tax_unit,l_tax_unit_id),l_date,l_business_group_id) LOOP
3596 l_sip_sector := NVL(l_sip_sector,l_get_sect_risk_grp.sector);
3597 l_risk_grp := NVL(l_risk_grp,l_get_sect_risk_grp.risk_group);
3598 IF l_sip_sector <> l_get_sect_risk_grp.sector OR l_risk_grp <> l_get_sect_risk_grp.risk_group THEN
3599 --Fnd_file.put_line(FND_FILE.LOG,'Archiving NL_WR_SWMF_SECTOR_RISK_GROUP -- CORRECTION');
3600 pay_action_information_api.create_action_information
3601 (
3602 p_action_information_id => l_action_info_id
3603 , p_action_context_id => p_actid
3604 , p_action_context_type => 'PA'
3605 , p_object_version_number => l_ovn
3606 , p_assignment_id => NULL
3607 , p_effective_date => l_end_date
3608 , p_source_id => NULL
3609 , p_source_text => NULL
3610 ,p_tax_unit_id => l_tax_unit_id
3611 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
3612 , p_action_information1 => 'SWMF'
3613 , p_action_information2 => NULL
3614 , p_action_information5 => l_period_dates_rec.start_date
3615 , p_action_information6 => l_period_dates_rec.End_date
3616 , p_action_information7 => substr(l_sip_sector,1,3)
3617 , p_action_information8 => substr(l_risk_grp,1,2)
3618 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
3619 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd)));
3620 l_sip_sector := l_get_sect_risk_grp.sector;
3621 l_risk_grp := l_get_sect_risk_grp.risk_group;
3622 l_emp_total := l_emp_total + l_con_mon_fd;
3623 l_sector_flag := 'Y';
3624 IF l_c_base_mon_fd = 0 THEN
3625 l_c_base_mon_fd_z := 'Y';
3626 END IF;
3627 l_c_base_mon_fd := 0;
3628 l_con_mon_fd := 0;
3629 END IF;
3630 --Fnd_file.put_line(FND_FILE.LOG,' Calling swmf balance -- CORRECTION');
3631 populate_col_balance_values(p_swmf_col_bal_def_table,l_tax_unit_id,l_end_date,l_date,'CORRECTION',l_get_sect_risk_grp.organization_id,l_period_ass_action_id);
3632 --Fnd_file.put_line(FND_FILE.LOG,' Got swmf balance ');
3633 l_c_base_mon_fd := 0;
3634 l_con_mon_fd := 0;
3635 FOR i in 1..2 LOOP
3636 l_c_base_mon_fd := l_c_base_mon_fd + p_swmf_col_bal_def_table(i).balance_value + p_swmf_col_bal_def_table(i).balance_value2;
3637 END LOOP;
3638 --
3639 FOR i in 3..4 LOOP
3640 l_con_mon_fd := l_con_mon_fd + p_swmf_col_bal_def_table(i).balance_value + p_swmf_col_bal_def_table(i).balance_value2;
3641 END LOOP;
3642 --l_emp_total := l_emp_total + l_con_mon_fd;
3643 --
3644 END LOOP;
3645 IF l_sip_sector IS NOT NULL OR l_risk_grp IS NOT NULL THEN
3646 pay_action_information_api.create_action_information
3647 (
3648 p_action_information_id => l_action_info_id
3649 , p_action_context_id => p_actid
3650 , p_action_context_type => 'PA'
3651 , p_object_version_number => l_ovn
3652 , p_assignment_id => NULL
3653 , p_effective_date => l_end_date
3654 , p_source_id => NULL
3655 , p_source_text => NULL
3656 ,p_tax_unit_id => l_tax_unit_id
3657 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
3658 , p_action_information1 => 'SWMF'
3659 , p_action_information2 => NULL
3660 , p_action_information5 => l_period_dates_rec.start_date
3661 , p_action_information6 => l_period_dates_rec.End_date
3662 , p_action_information7 => substr(l_sip_sector,1,3)
3663 , p_action_information8 => substr(l_risk_grp,1,2)
3664 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
3665 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd)));
3666 --l_sip_sector := l_get_sect_risk_grp.sector;
3667 --l_risk_grp := l_get_sect_risk_grp.risk_group;
3668 l_emp_total := l_emp_total + l_con_mon_fd;
3669 l_sector_flag := 'Y';
3670 IF l_c_base_mon_fd = 0 THEN
3671 l_c_base_mon_fd_z := 'Y';
3672 END IF;
3673 END IF;
3674 --
3675 END IF;
3676 l_awf := 'N';
3677 FOR i IN collXMLTable.FIRST..collXMLTable.LAST LOOP
3678 l_val := NULL;
3679 IF collXMLTable(i).Mandatory = 'Y' or collXMLTable(i).TagValue <> 0 THEN
3680 --##--Fnd_file.put_line(FND_FILE.LOG,'#########'||'CORRECTION '||collXMLTable(i).TagName||' '||collXMLTable(i).TagValue||' '||collXMLTable(i).Mandatory);
3681 IF collXMLTable(i).TagName = 'TotTeBet' THEN
3682 l_val := l_emp_total;
3683 END IF;
3684 pay_action_information_api.create_action_information
3685 (
3686 p_action_information_id => l_action_info_id
3687 , p_action_context_id => p_actid
3688 , p_action_context_type => 'PA'
3689 , p_object_version_number => l_ovn
3690 , p_tax_unit_id => l_tax_unit_id
3691 , p_assignment_id => NULL
3692 , p_effective_date => l_end_date
3693 , p_source_id => NULL
3694 , p_source_text => NULL
3695 , p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
3696 , p_action_information1 => 'CORRECTION'
3697 , p_action_information2 => collXMLTable(i).TagName
3698 , p_action_information3 => l_period_dates_rec.start_date
3699 , p_action_information4 => l_period_dates_rec.End_date
3700 , p_action_information5 => collXMLTable(i).TagDesc
3701 , p_action_information6 => fnd_number.number_to_canonical(ROUND(NVL(l_val,collXMLTable(i).TagValue))));
3702 IF collXMLTable(i).TagName = 'PrLnAWF' AND collXMLTable(i).TagValue <> 0 THEN
3703 l_awf := 'Y';
3704 END IF;
3705 END IF;
3706 END LOOP;
3707 --
3708 IF g_public_org_flag = 'N' THEN
3709 IF l_sector_flag = 'N' THEN
3710 pay_action_information_api.create_action_information
3711 (
3712 p_action_information_id => l_action_info_id
3713 , p_action_context_id => p_actid
3714 , p_action_context_type => 'PA'
3715 , p_object_version_number => l_ovn
3716 , p_assignment_id => NULL
3717 , p_effective_date => l_end_date
3718 , p_source_id => NULL
3719 , p_source_text => NULL
3720 , p_tax_unit_id => l_tax_unit_id
3721 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3722 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_SECTOR')
3723 , p_action_information5 => l_period_dates_rec.End_date
3724 , p_action_information6 => 'Mandatory check on Sector'
3725 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3726 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3727 --
3728 pay_action_information_api.create_action_information
3729 (
3730 p_action_information_id => l_action_info_id
3731 , p_action_context_id => p_actid
3732 , p_action_context_type => 'PA'
3733 , p_object_version_number => l_ovn
3734 , p_assignment_id => NULL
3735 , p_effective_date => l_end_date
3736 , p_source_id => NULL
3737 , p_source_text => NULL
3738 , p_tax_unit_id => l_tax_unit_id
3739 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3740 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_RISK_GROUP')
3741 , p_action_information5 => l_period_dates_rec.End_date
3742 , p_action_information6 => 'No Risk Group'
3743 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3744 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3745 END IF;
3746 --
3747 IF l_awf <> 'N' AND l_c_base_mon_fd_z = 'Y' THEN
3748 pay_action_information_api.create_action_information
3749 (
3750 p_action_information_id => l_action_info_id
3751 , p_action_context_id => p_actid
3752 , p_action_context_type => 'PA'
3753 , p_object_version_number => l_ovn
3754 , p_assignment_id => NULL
3755 , p_effective_date => l_end_date
3756 , p_source_id => NULL
3757 , p_source_text => NULL
3758 , p_tax_unit_id => l_tax_unit_id
3759 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3760 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_BASE_WEWE') -- Message Code should have been '%_WEWA'
3761 , p_action_information5 => l_period_dates_rec.End_date
3762 , p_action_information6 => 'Waiting Money Fund contribution base is zero'
3763 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3764 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3765 END IF;
3766 --
3767 IF l_awf = 'N' AND l_c_base_mon_fd_z <> 'Y' THEN
3768 pay_action_information_api.create_action_information
3769 (
3770 p_action_information_id => l_action_info_id
3771 , p_action_context_id => p_actid
3772 , p_action_context_type => 'PA'
3773 , p_object_version_number => l_ovn
3774 , p_assignment_id => NULL
3775 , p_effective_date => l_end_date
3776 , p_source_id => NULL
3777 , p_source_text => NULL
3778 , p_tax_unit_id => l_tax_unit_id
3779 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3780 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_AWF')
3781 , p_action_information5 => l_period_dates_rec.End_date
3782 , p_action_information6 => 'AWF contribution base is zero'
3783 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
3784 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
3785 END IF;
3786 --
3787 END IF;
3788 --#
3789 END IF;
3790 END LOOP;
3791 --
3792 END IF;
3793 --
3794 l_sector := NULL;
3795 l_risk_group := NULL;
3796 IF l_payroll_type = 'FOUR_WEEK' THEN
3797 --
3798 l_first_emp := 'Y' ;
3799 --
3800 FOR csr_get_pactid_rec IN csr_get_pactid LOOP
3801 IF l_first_emp = 'Y' THEN
3802 --
3803 l_first_emp := 'N' ;
3804 --
3805 OPEN csr_employer_info('NL_WR_EMPLOYER_INFO',csr_get_pactid_rec.payroll_action_id);
3806 FETCH csr_employer_info INTO csr_employer_info_rec;
3807 --
3808 pay_action_information_api.create_action_information
3809 (
3810 p_action_information_id => l_action_info_id
3811 , p_action_context_id => p_actid
3812 , p_action_context_type => 'PA'
3813 , p_object_version_number => l_ovn
3814 , p_assignment_id => NULL
3815 , p_effective_date => l_end_date
3816 , p_source_id => NULL
3817 , p_source_text => NULL
3818 , p_tax_unit_id => l_tax_unit_id
3819 , p_action_information_category => 'NL_WR_EMPLOYER_INFO'
3820 , p_action_information1 => csr_employer_info_rec.action_information1
3821 , p_action_information2 => csr_employer_info_rec.action_information2
3822 , p_action_information3 => fnd_date.date_to_canonical(sysdate)
3823 , p_action_information4 => csr_employer_info_rec.action_information4
3824 , p_action_information5 => substr(l_seq_no,1,6)
3825 , p_action_information6 => csr_employer_info_rec.action_information6
3826 , p_action_information7 => csr_employer_info_rec.action_information7
3827 , p_action_information8 => csr_employer_info_rec.action_information8
3828 , p_action_information9 => csr_employer_info_rec.action_information9
3829 , p_action_information10 => fnd_date.date_to_canonical(l_start_date)
3830 , p_action_information11 => fnd_date.date_to_canonical(l_end_date)
3831 , p_action_information12 => csr_employer_info_rec.action_information12);
3832 --
3833 CLOSE csr_employer_info;
3834 --
3835 FOR csr_exception_info_rec IN csr_employer_info('NL_WR_EXCEPTION_REPORT',csr_get_pactid_rec.payroll_action_id) LOOP
3836 pay_action_information_api.create_action_information
3837 (
3838 p_action_information_id => l_action_info_id
3839 , p_action_context_id => p_actid
3840 , p_action_context_type => 'PA'
3841 , p_object_version_number => l_ovn
3842 , p_assignment_id => NULL
3843 , p_effective_date => l_end_date
3844 , p_source_id => NULL
3845 , p_source_text => NULL
3846 , p_tax_unit_id => l_tax_unit_id
3847 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
3848 , p_action_information4 => csr_exception_info_rec.action_information4
3849 , p_action_information5 => csr_exception_info_rec.action_information5
3850 , p_action_information6 => csr_exception_info_rec.action_information6
3851 , p_action_information7 => csr_exception_info_rec.action_information7
3852 , p_action_information8 => csr_exception_info_rec.action_information8);
3853 END LOOP;
3854 --
3855 y:= 1;
3856 collXMLTable(y).TagName := 'TotLnLbPh';
3857 collXMLTable(y).Mandatory:= 'Y';
3858 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotLnLbPh'));
3859 collXMLTable(y).Tagvalue := 0;
3860 --
3861 y:= y+1;
3862 collXMLTable(y).TagName := 'TotLnSV';
3863 collXMLTable(y).Mandatory:= 'Y';
3864 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotLnSV'));
3865 collXMLTable(y).Tagvalue := 0;
3866 --
3867 y:= y+1;
3868 collXMLTable(y).TagName := 'PrLnWAOAof';
3869 collXMLTable(y).Mandatory:= 'Y';
3870 IF l_end_date >= to_date('01012007','DDMMYYYY') THEN
3871 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAof'));
3872 ELSE
3873 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAof_2006'));
3874 END IF;
3875 collXMLTable(y).Tagvalue := 0;
3876 --
3877 y:= y+1;
3878 collXMLTable(y).TagName := 'PrLnWAOAok';
3879 collXMLTable(y).Mandatory:= 'Y';
3880 IF l_end_date >= to_date('01012007','DDMMYYYY') THEN
3881 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok'));
3882 ELSE
3883 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok_2006'));
3884 END IF;
3885 collXMLTable(y).Tagvalue := 0;
3886 --
3887 y:= y+1;
3888 collXMLTable(y).TagName := 'PrLnAWF';
3889 collXMLTable(y).Mandatory:= 'Y';
3890 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnAWF'));
3891 collXMLTable(y).Tagvalue := 0;
3892 --
3893 y:= y+1;
3894 collXMLTable(y).TagName := 'PrLnUFO';
3895 collXMLTable(y).Mandatory:= 'Y';
3896 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnUFO'));
3897 collXMLTable(y).Tagvalue := 0;
3898 --
3899 y:= y+1;
3900 collXMLTable(y).TagName := 'TotVergZvw';
3901 collXMLTable(y).Mandatory:= 'Y';
3902 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotVergZvw'));
3903 collXMLTable(y).Tagvalue := 0;
3904 --
3905 y:= y+1;
3906 collXMLTable(y).TagName := 'IngLbPh';
3907 collXMLTable(y).Mandatory:= 'Y';
3908 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('IngLbPh'));
3909 collXMLTable(y).Tagvalue := 0;
3910 --
3911 y:= y+1;
3912 collXMLTable(y).TagName := 'EHPubUitk';
3913 collXMLTable(y).Mandatory:= 'N';
3914 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHPubUitk'));
3915 collXMLTable(y).Tagvalue := 0;
3916 --
3917 y:= y+1;
3918 collXMLTable(y).TagName := 'EHLnBestKar';
3919 collXMLTable(y).Mandatory:= 'N';
3920 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHLnBestKar'));
3921 collXMLTable(y).Tagvalue := 0;
3922 --
3923 y:= y+1;
3924 collXMLTable(y).TagName := 'EHSpLn';
3925 collXMLTable(y).Mandatory:= 'N';
3926 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHSpLn'));
3927 collXMLTable(y).Tagvalue := 0;
3928 --
3929 y:= y+1;
3930 collXMLTable(y).TagName := 'EHSpPr';
3931 collXMLTable(y).Mandatory:= 'N';
3932 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHSpPr'));
3933 collXMLTable(y).Tagvalue := 0;
3934 --
3935 y:= y+1;
3936 collXMLTable(y).TagName := 'EHLnNat';
3937 collXMLTable(y).Mandatory:= 'N';
3938 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHLnNat'));
3939 collXMLTable(y).Tagvalue := 0;
3940 --
3941 y:= y+1;
3942 collXMLTable(y).TagName := 'EHFeest';
3943 collXMLTable(y).Mandatory:= 'N';
3944 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHFeest'));
3945 collXMLTable(y).Tagvalue := 0;
3946 --
3947 y:= y+1;
3948 collXMLTable(y).TagName := 'EHBmVerg';
3949 collXMLTable(y).Mandatory:= 'N';
3950 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHBmVerg'));
3951 collXMLTable(y).Tagvalue := 0;
3952 --
3953 y:= y+1; -- new added
3954 collXMLTable(y).TagName := 'EHGebrAuto';
3955 collXMLTable(y).Mandatory:= 'N';
3956 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHGebrAuto'));
3957 collXMLTable(y).Tagvalue := 0;
3958 --
3959 y:= y+1;
3960 collXMLTable(y).TagName := 'EHVUT';
3961 collXMLTable(y).Mandatory:= 'N';
3962 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHVUT'));
3963 collXMLTable(y).Tagvalue := 0;
3964 --
3965 y:= y+1;
3966 collXMLTable(y).TagName := 'AVBetOV';
3967 collXMLTable(y).Mandatory:= 'N';
3968 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVBetOV'));
3969 collXMLTable(y).Tagvalue := 0;
3970 --
3971 y:= y+1;
3972 collXMLTable(y).TagName := 'AVLgdWerkl';
3973 collXMLTable(y).Mandatory:= 'N';
3974 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVLgdWerkl'));
3975 collXMLTable(y).Tagvalue := 0;
3976 --
3977 y:= y+1;
3978 collXMLTable(y).TagName := 'AVArboNP';
3979 collXMLTable(y).Mandatory:= 'N';
3980 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVArboNP'));
3981 collXMLTable(y).Tagvalue := 0;
3982 --
3983 y:= y+1;
3984 collXMLTable(y).TagName := 'AVZeev';
3985 collXMLTable(y).Mandatory:= 'N';
3986 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVZeev'));
3987 collXMLTable(y).Tagvalue := 0;
3988 --
3989 y:= y+1;
3990 collXMLTable(y).TagName := 'AVOnd';
3991 collXMLTable(y).Mandatory:= 'N';
3992 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVOnd'));
3993 collXMLTable(y).Tagvalue := 0;
3994 --
3995 y:= y+1;
3996 collXMLTable(y).TagName := 'VrlAVSO';
3997 collXMLTable(y).Mandatory:= 'N';
3998 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('VrlAVSO'));
3999 collXMLTable(y).Tagvalue := 0;
4000 --
4001 y:= y+1;
4002 collXMLTable(y).TagName := 'PrWAOAof';
4003 collXMLTable(y).Mandatory:= 'N';
4004 IF l_end_date >= to_date('01012007','DDMMYYYY') THEN
4005 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAof'));
4006 ELSE
4007 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAof_2006'));
4008 END IF;
4009 collXMLTable(y).Tagvalue := 0;
4010 --
4011 y:= y+1;
4012 collXMLTable(y).TagName := 'PrWAOAok';
4013 collXMLTable(y).Mandatory:= 'Y';
4014 IF l_end_date >= to_date('01012007','DDMMYYYY') THEN
4015 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok'));
4016 ELSE
4017 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok_2006'));
4018 END IF;
4019 collXMLTable(y).Tagvalue := 0;
4020 --
4021 y:= y+1;
4022 collXMLTable(y).TagName := 'PrAWF';
4023 collXMLTable(y).Mandatory:= 'N';
4024 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrAWF'));
4025 collXMLTable(y).Tagvalue := 0;
4026 --
4027 y:= y+1;
4028 collXMLTable(y).TagName := 'PrUFO';
4029 collXMLTable(y).Mandatory:= 'N';
4030 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrUFO'));
4031 collXMLTable(y).Tagvalue := 0;
4032 --
4033 y:= y+1;
4034 collXMLTable(y).TagName := 'IngBijdrZvw';
4035 collXMLTable(y).Mandatory:= 'N';
4036 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('IngBijdrZvw'));
4037 collXMLTable(y).Tagvalue := 0;
4038 --
4039 y:= y+1;
4040 collXMLTable(y).TagName := 'AGHKort';
4041 collXMLTable(y).Mandatory:= 'N';
4042 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AGHKort'));
4043 collXMLTable(y).Tagvalue := 0;
4044 --
4045 y:= y+1;
4046 collXMLTable(y).TagName := 'TotTeBet';
4047 collXMLTable(y).Mandatory:= 'Y';
4048 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotTeBet'));
4049 collXMLTable(y).Tagvalue := 0;
4050 --
4051 END IF;
4052 --
4053 FOR csr_collective_info_rec IN csr_employer_info('NL_WR_COLLECTIVE_REPORT',csr_get_pactid_rec.payroll_action_id) LOOP
4054 --
4055 IF csr_collective_info_rec.action_information1 = 'COMPLETE' THEN
4056 --
4057 IF csr_collective_info_rec.action_information2 = 'TotLnLbPh' THEN
4058 collXMLTable(1).Tagvalue:= NVL(collXMLTable(1).Tagvalue,0)
4059 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4060 ELSIF csr_collective_info_rec.action_information2 = 'TotLnSV' THEN
4061 collXMLTable(2).Tagvalue:= NVL(collXMLTable(2).Tagvalue,0)
4062 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4063 ELSIF csr_collective_info_rec.action_information2 = 'PrLnWAOAof' THEN
4064 collXMLTable(3).Tagvalue:= NVL(collXMLTable(3).Tagvalue,0)
4065 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4066 ELSIF csr_collective_info_rec.action_information2 = 'PrLnWAOAok' THEN
4067 collXMLTable(4).Tagvalue:= NVL(collXMLTable(4).Tagvalue,0)
4068 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4069 ELSIF csr_collective_info_rec.action_information2 = 'PrLnAWF' THEN
4070 collXMLTable(5).Tagvalue:= NVL(collXMLTable(5).Tagvalue,0)
4071 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4072 ELSIF csr_collective_info_rec.action_information2 = 'PrLnUFO' THEN
4073 collXMLTable(6).Tagvalue:= NVL(collXMLTable(6).Tagvalue,0)
4074 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4075 ELSIF csr_collective_info_rec.action_information2 = 'TotVergZvw' THEN
4076 collXMLTable(7).Tagvalue:= NVL(collXMLTable(7).Tagvalue,0)
4077 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4078 ELSIF csr_collective_info_rec.action_information2 = 'IngLbPh' THEN
4079 collXMLTable(8).Tagvalue:= NVL(collXMLTable(8).Tagvalue,0)
4080 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4081 ELSIF csr_collective_info_rec.action_information2 = 'EHPubUitk' THEN
4082 collXMLTable(9).Tagvalue:= NVL(collXMLTable(9).Tagvalue,0)
4083 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4084 ELSIF csr_collective_info_rec.action_information2 = 'EHLnBestKar' THEN
4085 collXMLTable(10).Tagvalue:= NVL(collXMLTable(10).Tagvalue,0)
4086 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4087 ELSIF csr_collective_info_rec.action_information2 = 'EHSpLn' THEN
4088 collXMLTable(11).Tagvalue:= NVL(collXMLTable(11).Tagvalue,0)
4089 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4090 ELSIF csr_collective_info_rec.action_information2 = 'EHSpPr' THEN
4091 collXMLTable(12).Tagvalue:= NVL(collXMLTable(12).Tagvalue,0)
4092 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4093 ELSIF csr_collective_info_rec.action_information2 = 'EHLnNat' THEN
4094 collXMLTable(13).Tagvalue:= NVL(collXMLTable(13).Tagvalue,0)
4095 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4096 ELSIF csr_collective_info_rec.action_information2 = 'EHFeest' THEN
4097 collXMLTable(14).Tagvalue:= NVL(collXMLTable(14).Tagvalue,0)
4098 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4099 ELSIF csr_collective_info_rec.action_information2 = 'EHBmVerg' THEN
4100 collXMLTable(15).Tagvalue:= NVL(collXMLTable(15).Tagvalue,0)
4101 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4102 ELSIF csr_collective_info_rec.action_information2 = 'EHGebrAuto' AND l_end_date >= TO_DATE('01012007','DDMMYYYY') THEN -- EHGebrAuto
4103 collXMLTable(16).Tagvalue:= NVL(collXMLTable(16).Tagvalue,0)
4104 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4105 ELSIF csr_collective_info_rec.action_information2 = 'EHVUT' THEN
4106 collXMLTable(17).Tagvalue:= NVL(collXMLTable(17).Tagvalue,0)
4107 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4108 ELSIF csr_collective_info_rec.action_information2 = 'AVBetOV' AND l_end_date < TO_DATE('01012007','DDMMYYYY') THEN
4109 collXMLTable(18).Tagvalue:= NVL(collXMLTable(18).Tagvalue,0)
4110 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4111 ELSIF csr_collective_info_rec.action_information2 = 'AVLgdWerkl' AND l_end_date < TO_DATE('01012007','DDMMYYYY') THEN
4112 collXMLTable(19).Tagvalue:= NVL(collXMLTable(19).Tagvalue,0)
4113 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4114 ELSIF csr_collective_info_rec.action_information2 = 'AVArboNP' THEN
4115 collXMLTable(20).Tagvalue:= NVL(collXMLTable(20).Tagvalue,0)
4116 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4117 ELSIF csr_collective_info_rec.action_information2 = 'AVZeev' THEN
4118 collXMLTable(21).Tagvalue:= NVL(collXMLTable(21).Tagvalue,0)
4119 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4120 ELSIF csr_collective_info_rec.action_information2 = 'AVOnd' THEN
4121 collXMLTable(22).Tagvalue:= NVL(collXMLTable(22).Tagvalue,0)
4122 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4123 ELSIF csr_collective_info_rec.action_information2 = 'VrlAVSO' THEN
4124 collXMLTable(23).Tagvalue:= NVL(collXMLTable(23).Tagvalue,0)
4125 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4126 ELSIF csr_collective_info_rec.action_information2 = 'PrWAOAof' THEN
4127 collXMLTable(24).Tagvalue:= NVL(collXMLTable(24).Tagvalue,0)
4128 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4129 ELSIF csr_collective_info_rec.action_information2 = 'PrWAOAok' THEN
4130 collXMLTable(25).Tagvalue:= NVL(collXMLTable(25).Tagvalue,0)
4131 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4132 ELSIF csr_collective_info_rec.action_information2 = 'PrAWF' THEN
4133 collXMLTable(26).Tagvalue:= NVL(collXMLTable(26).Tagvalue,0)
4134 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4135 ELSIF csr_collective_info_rec.action_information2 = 'PrUFO' THEN
4136 collXMLTable(27).Tagvalue:= NVL(collXMLTable(27).Tagvalue,0)
4137 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4138 ELSIF csr_collective_info_rec.action_information2 = 'IngBijdrZvw' THEN
4139 collXMLTable(28).Tagvalue:= NVL(collXMLTable(28).Tagvalue,0)
4140 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4141 ELSIF csr_collective_info_rec.action_information2 = 'AGHKort' THEN
4142 collXMLTable(29).Tagvalue:= NVL(collXMLTable(29).Tagvalue,0)
4143 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4144 ELSIF csr_collective_info_rec.action_information2 = 'TotTeBet' THEN
4145 collXMLTable(30).Tagvalue:= NVL(collXMLTable(30).Tagvalue,0)
4146 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4147 END IF;
4148 --
4149 ELSIF csr_collective_info_rec.action_information1 = 'TOTAL' THEN
4150 l_emp_total := NVL(l_emp_total,0)
4151 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
4152 END IF;
4153 --
4154 END LOOP;
4155 --
4156 --
4157 END LOOP;
4158 --
4159 FOR csr_swmf_info_rec IN csr_swmf_employer_info(l_tax_unit_id,l_start_date,l_end_date) LOOP --(csr_get_pactid_rec.payroll_action_id) LOOP
4160 --
4161 l_sector := csr_swmf_info_rec.action_information7;
4162 l_risk_group := csr_swmf_info_rec.action_information8;
4163 l_c_base_mon_fd := csr_swmf_info_rec.action_information9;
4164 l_con_mon_fd := csr_swmf_info_rec.action_information10;
4165 --
4166 pay_action_information_api.create_action_information
4167 (p_action_information_id => l_action_info_id
4168 ,p_action_context_id => p_actid
4169 ,p_action_context_type => 'PA'
4170 ,p_object_version_number => l_ovn
4171 ,p_assignment_id => NULL
4172 ,p_effective_date => l_end_date
4173 ,p_source_id => NULL
4174 ,p_source_text => NULL
4175 ,p_tax_unit_id => l_tax_unit_id
4176 ,p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
4177 ,p_action_information1 => 'SWMF'
4178 ,p_action_information2 => NULL
4179 ,p_action_information5 => fnd_date.date_to_canonical(l_start_date)
4180 ,p_action_information6 => fnd_date.date_to_canonical(l_end_date)
4181 ,p_action_information7 => l_sector
4182 ,p_action_information8 => l_risk_group
4183 ,p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
4184 ,p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd )));
4185 END LOOP;
4186 --
4187 FOR i IN collXMLTable.FIRST..collXMLTable.LAST LOOP
4188 IF collXMLTable(i).Mandatory = 'Y' or collXMLTable(i).TagValue <> 0 THEN
4189 pay_action_information_api.create_action_information
4190 ( p_action_information_id => l_action_info_id
4191 , p_action_context_id => p_actid
4192 , p_action_context_type => 'PA'
4193 , p_object_version_number => l_ovn
4194 , p_tax_unit_id => l_tax_unit_id
4195 , p_assignment_id => NULL
4196 , p_effective_date => l_end_date
4197 , p_source_id => NULL
4198 , p_source_text => NULL
4199 , p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
4200 , p_action_information1 => 'COMPLETE'
4201 , p_action_information2 => collXMLTable(i).TagName
4202 , p_action_information3 => fnd_date.date_to_canonical(l_start_date)
4203 , p_action_information4 => fnd_date.date_to_canonical(l_end_date)
4204 , p_action_information5 => collXMLTable(i).TagDesc
4205 , p_action_information6 => fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue)));
4206 END IF;
4207 END LOOP;
4208 --
4209 pay_action_information_api.create_action_information
4210 (p_action_information_id => l_action_info_id
4211 ,p_action_context_id => p_actid
4212 ,p_action_context_type => 'PA'
4213 ,p_object_version_number => l_ovn
4214 ,p_tax_unit_id => l_tax_unit_id
4215 ,p_assignment_id => NULL
4216 ,p_effective_date => l_end_date
4217 ,p_source_id => NULL
4218 ,p_source_text => NULL
4219 ,p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
4220 ,p_action_information1 => 'TOTAL'
4221 ,p_action_information2 => 'TotGen' -- TAG NAME
4222 ,p_action_information3 => fnd_date.date_to_canonical(l_start_date)
4223 ,p_action_information4 => fnd_date.date_to_canonical(l_end_date)
4224 ,p_action_information5 => HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotGen')) -- TAG DESCRIPTION
4225 ,p_action_information6 => fnd_number.number_to_canonical(ROUND(l_emp_total)));
4226 --
4227 END IF;
4228 --# Exception Report
4229 FND_FILE.PUT_LINE(fnd_file.output,rpad('-',80,'-') || rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_EXCEPTION_REPORT'),20,' ') || rpad('-',80,'-'));
4230 FND_FILE.PUT_LINE(fnd_file.output,rpad(' ',180,' '));
4231 --
4232 FOR csr_excpetion_rec IN csr_get_PA_exception_info(p_actid) LOOP
4233 --
4234 l_exception_flag := 'Y' ;
4235 --
4236 IF empr_flag = 'N' THEN
4237 --
4238 FND_FILE.PUT_LINE(fnd_file.output,rpad('-',180,'-'));
4239 FND_FILE.PUT_LINE(fnd_file.output,rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_EMPLOYER_NAME'),32,' ') ||
4240 rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_EXCEPTION'),148,' '));
4241 FND_FILE.PUT_LINE(fnd_file.output,rpad('-',180,'-'));
4242 empr_flag :='Y';
4243 END IF;
4244 --
4245 FND_FILE.PUT_LINE(fnd_file.output,rpad(csr_excpetion_rec.E_Name,32,' ') || csr_excpetion_rec.Message);
4246 --
4247 END LOOP;
4248 --
4249 FOR csr_excpetion_rec IN csr_get_AAP_exception_info(p_actid) LOOP
4250 --
4251 l_exception_flag := 'Y' ;
4252 --
4253 IF empe_flag = 'N' THEN
4254 --
4255 FND_FILE.PUT_LINE(fnd_file.output,rpad('-',180,'-'));
4256 FND_FILE.PUT_LINE(fnd_file.output,rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_ASSIGNMENT_NUMBER'),22,' ') ||
4257 rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_NAME'),32,' ') ||
4258 rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_DATE'),13,' ') ||
4259 rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_EXCEPTION'),113,' '));
4260 FND_FILE.PUT_LINE(fnd_file.output,rpad('-',180,'-'));
4261 empe_flag := 'Y';
4262 END IF;
4263 --
4264 FND_FILE.PUT_LINE(fnd_file.output,rpad(substr(csr_excpetion_rec.E_Number,1,20),22,' ') || rpad(csr_excpetion_rec.E_name,32,' ') || rpad(csr_excpetion_rec.dt,13,' ') || csr_excpetion_rec.Message);
4265 --
4266 END LOOP;
4267 --
4268 IF l_exception_flag = 'N' THEN
4269 FND_FILE.PUT_LINE(fnd_file.output , hr_general.decode_lookup('NL_FORM_LABELS','WR_NO_VALIDATION_ERRORS'));
4270 END IF;
4271 --Fnd_file.put_line(FND_FILE.LOG,' Leaving Deinit Code');
4272 --#
4273 EXCEPTION
4274 WHEN OTHERS THEN
4275 -- Return cursor that selects no rows
4276 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
4277 hr_utility.set_location(sqlerrm(sqlcode),110);
4278 END archive_deinit_code;
4279 --------------------------------------------------------------------------------
4280 -- ACTION_CREATION_CODE
4281 --------------------------------------------------------------------------------
4282 PROCEDURE archive_action_creation (p_actid IN NUMBER
4283 ,stperson IN NUMBER
4284 ,endperson IN NUMBER
4285 ,chunk IN NUMBER) IS
4286 --
4287 CURSOR csr_assignments(stperson NUMBER
4288 ,endperson NUMBER
4289 ,c_start_date DATE
4290 ,c_end_date DATE
4291 ,c_business_group_id NUMBER
4292 ,c_payroll_type VARCHAR2
4293 ,c_tax_unit_id NUMBER
4294 ,c_paid_flag VARCHAR2) IS
4295 SELECT asl.assignment_id assignment_id
4296 ,paa.assignment_action_id assignment_action_id
4297 FROM per_all_assignments_f asl
4298 ,pay_all_payrolls_f ppf
4299 ,pay_payroll_actions ppa
4300 ,pay_assignment_actions paa
4301 ,per_time_periods ptp
4302 WHERE asl.person_id BETWEEN stperson AND endperson and
4303 ppf.payroll_id = asl.payroll_id
4304 AND ((ppf.period_type = 'Calendar Month'
4305 AND c_payroll_type = 'MONTH') OR
4306 (ppf.period_type = 'Week' AND c_payroll_type = 'WEEK')OR
4307 (ppf.period_type = 'Lunar Month' AND c_payroll_type = 'LMONTH'))
4308 AND ppf.payroll_id = ppa.payroll_id
4309 AND ppa.action_type in ('R','Q')
4310 AND ppa.action_status = 'C'
4311 AND paa.source_action_id IS NULL
4312 AND paa.tax_unit_id = c_tax_unit_id
4313 AND ppa.time_period_id = ptp.time_period_id
4314 AND c_end_date BETWEEN ptp.start_date
4315 AND ptp.end_date
4316 AND ppa.payroll_action_id = paa.payroll_action_id
4317 AND paa.assignment_id = asl.assignment_id
4318 AND asl.effective_start_date <= c_end_date
4319 AND asl.effective_end_date >= c_start_date
4320 AND c_end_date BETWEEN ppf.effective_start_date
4321 AND ppf.effective_end_date
4322 AND asl.business_group_id = ppa.business_group_id
4323 AND ppa.business_group_id = c_business_group_id
4324 AND (EXISTS (SELECT 1
4325 FROM pay_assignment_actions paa1
4326 ,pay_run_results prr
4327 WHERE paa1.source_action_id = paa.assignment_action_id
4328 AND prr.assignment_action_id = paa1.assignment_action_id))
4329 UNION
4330 SELECT asl.assignment_id assignment_id
4331 ,NULL assignment_action_id
4332 FROM per_all_assignments_f asl
4333 ,pay_all_payrolls_f ppf
4334 WHERE asl.person_id BETWEEN stperson AND endperson
4335 AND c_paid_flag = 'N'
4336 AND ppf.payroll_id = asl.payroll_id
4337 AND asl.assignment_type = 'E'
4338 AND asl.business_group_id = c_business_group_id
4339 AND ((ppf.period_type = 'Calendar Month'--,'Lunar Month')
4340 AND c_payroll_type = 'MONTH') OR
4341 (ppf.period_type = 'Week' AND c_payroll_type = 'WEEK')OR
4342 (ppf.period_type = 'Lunar Month' AND c_payroll_type = 'LMONTH'))
4343 AND asl.effective_start_date <= c_end_date
4344 AND asl.effective_end_date >= c_start_date
4345 AND c_end_date BETWEEN ppf.effective_start_date
4346 AND ppf.effective_end_date
4347 AND ppf.prl_information_category = 'NL'
4348 AND ((asl.establishment_id = c_tax_unit_id ) OR
4349 (asl.establishment_id IS NULL AND ppf.PRL_INFORMATION1 = c_tax_unit_id))
4350 ORDER BY 1;
4351 --
4352 CURSOR csr_le_hr_mapping_chk (p_organization_id NUMBER) IS
4353 SELECT hoi.org_information2 org_id
4354 ,hoi.org_information4 paid_flag
4355 FROM hr_organization_information hoi
4356 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
4357 AND hoi.organization_id = p_organization_id
4358 AND EXISTS (SELECT 1
4359 FROM hr_organization_information hoi1
4360 WHERE hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
4361 AND hoi1.org_information_context = 'CLASS'
4362 AND hoi1.organization_id = hoi.organization_id);
4363 --
4364 CURSOR csr_get_empr_contact(c_employer_id NUMBER
4365 ,c_business_group_id NUMBER) IS
4366 SELECT hoi.org_information4 paid_flag
4367 FROM hr_organization_units hou,hr_organization_information hoi
4368 WHERE hoi.org_information_context = 'NL_ORG_WR_INFO'
4369 AND hou.business_group_id = c_business_group_id
4370 AND hou.organization_id = hoi.organization_id
4371 AND hou.organization_id = c_employer_id;
4372 --
4373 l_actid NUMBER;
4374 l_legal_employer hr_all_organization_units.organization_id%type;
4375 l_start_date DATE;
4376 l_end_date DATE;
4377 l_business_group_id NUMBER;
4378 l_chk_assignment_id NUMBER;
4379 l_payroll_type VARCHAR2(10);
4380 l_seq_no VARCHAR2(15);
4381 l_paid_flag VARCHAR2(15);
4382 l_hr_tax_unit hr_all_organization_units.organization_id%TYPE;
4383 --
4384 CURSOR csr_persons(stperson NUMBER
4385 ,endperson NUMBER
4386 ,c_start_date DATE
4387 ,c_end_date DATE
4388 ,c_business_group_id NUMBER
4389 ,c_payroll_type VARCHAR2
4390 ,c_tax_unit_id NUMBER) IS
4391 SELECT MAX(paa.assignment_action_id) assignment_action_id
4392 ,paa.assignment_id
4393 ,paaf.person_id
4394 ,ppa1.effective_date
4395 ,paaf.primary_flag
4396 FROM pay_payroll_actions ppa
4397 ,pay_payroll_actions ppa1
4398 ,pay_assignment_actions paa
4399 ,per_all_assignments_f paaf
4400 WHERE ppa.report_type = 'NL_WAGES_REP_LOCK'
4401 AND ppa.report_qualifier = 'NL'
4402 AND ppa.action_type = 'X'
4403 AND ppa.action_status = 'C'
4404 AND ppa1.report_type = 'NL_WAGES_REP_ARCHIVE'
4405 AND ppa1.report_qualifier = 'NL'
4406 AND ppa1.action_type = 'X'
4407 AND ppa1.action_status = 'C'
4408 AND INSTR(ppa.legislative_parameters,'REQUEST_ID='||ppa1.payroll_action_id ) <> 0
4409 AND INSTR(ppa1.legislative_parameters,'Payroll_Type=WEEK') <> 0
4410 AND ppa1.effective_date BETWEEN c_start_date
4411 AND c_end_date
4412 AND ppa1.payroll_action_id = paa.payroll_action_id
4413 AND paa.assignment_id = paaf.assignment_id
4414 AND paa.tax_unit_id = c_tax_unit_id
4415 AND paaf.person_id BETWEEN stperson
4416 AND endperson
4417 AND paaf.effective_start_date <= ppa1.effective_date
4418 AND paaf.effective_end_date >= ppa1.start_date
4419 AND paaf.business_group_id = c_business_group_id
4420 AND paaf.business_group_id = ppa.business_group_id
4421 AND ppa1.business_group_id = ppa.business_group_id
4422 GROUP BY paa.assignment_id
4423 ,paaf.person_id
4424 ,ppa1.effective_date
4425 ,paaf.primary_flag
4426 ORDER BY paaf.person_id
4427 ,paaf.primary_flag DESC
4428 ,ppa1.effective_date DESC;
4429 ---for yearly report
4430 CURSOR csr_assignments_yearly(stperson NUMBER
4431 ,endperson NUMBER
4432 ,c_start_date DATE
4433 ,c_end_date DATE
4434 ,c_business_group_id NUMBER
4435 ,c_payroll_type VARCHAR2
4436 ,c_tax_unit_id NUMBER
4437 ,c_paid_flag VARCHAR2) IS
4438 SELECT DISTINCT asl.assignment_id assignment_id
4439 ,paa.assignment_action_id assignment_action_id
4440 FROM per_all_assignments_f asl
4441 ,pay_payroll_actions ppa
4442 ,pay_assignment_actions paa
4443 ,per_time_periods ptp
4444 WHERE asl.person_id BETWEEN stperson AND endperson and
4445 ppa.payroll_id = asl.payroll_id
4446 AND ppa.action_type in ('R','Q')
4447 AND ppa.action_status = 'C'
4448 AND paa.source_action_id IS NULL
4449 AND paa.tax_unit_id = c_tax_unit_id
4450 AND ppa.time_period_id = ptp.time_period_id
4451 AND to_char(ptp.end_date,'RRRR') = to_char(c_start_date,'RRRR')
4452 AND ppa.payroll_action_id = paa.payroll_action_id
4453 AND paa.assignment_id = asl.assignment_id
4454 AND asl.effective_start_date <= c_end_date
4455 AND asl.effective_end_date >= c_start_date
4456 AND asl.business_group_id = ppa.business_group_id
4457 AND ppa.business_group_id = c_business_group_id
4458 AND (EXISTS (SELECT 1
4459 FROM pay_assignment_actions paa1
4460 ,pay_run_results prr
4461 WHERE paa1.source_action_id = paa.assignment_action_id
4462 AND prr.assignment_action_id = paa1.assignment_action_id))
4463 UNION
4464 SELECT asl.assignment_id assignment_id
4465 ,NULL assignment_action_id
4466 FROM per_all_assignments_f asl
4467 ,pay_all_payrolls_f ppf
4468 WHERE asl.person_id BETWEEN stperson AND endperson
4469 AND c_paid_flag = 'N'
4470 AND ppf.payroll_id = asl.payroll_id
4471 AND asl.assignment_type = 'E'
4472 AND asl.business_group_id = c_business_group_id
4473 AND asl.effective_start_date <= c_end_date
4474 AND asl.effective_end_date >= c_start_date
4475 AND ppf.effective_end_date >= c_start_date
4476 AND ppf.prl_information_category = 'NL'
4477 AND ((asl.establishment_id = c_tax_unit_id ) OR
4478 (asl.establishment_id IS NULL AND ppf.PRL_INFORMATION1 = c_tax_unit_id))
4479 ORDER BY 1,2 desc;
4480 --
4481 l_chk_person_id NUMBER;
4482 --
4483 BEGIN
4484 --
4485 get_all_parameters (p_actid
4486 ,l_business_group_id
4487 ,l_start_date
4488 ,l_end_date
4489 ,l_legal_employer
4490 ,l_payroll_type
4491 ,l_seq_no);
4492 --
4493 l_paid_flag := NULL;
4494 l_hr_tax_unit := NULL;
4495 --
4496 OPEN csr_le_hr_mapping_chk(l_legal_employer);
4497 FETCH csr_le_hr_mapping_chk INTO l_hr_tax_unit,l_paid_flag;
4498 CLOSE csr_le_hr_mapping_chk;
4499 --
4500 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~l_paid_flag :'||l_paid_flag);
4501 --
4502 IF l_paid_flag IS NULL THEN
4503 OPEN csr_get_empr_contact(NVL(l_hr_tax_unit,l_legal_employer),l_business_group_id);
4504 FETCH csr_get_empr_contact INTO l_paid_flag;
4505 CLOSE csr_get_empr_contact;
4506 END IF;
4507 --
4508 l_paid_flag := NVL(l_paid_flag,'N');
4509 --
4510 IF l_payroll_type = 'FOUR_WEEK' THEN
4511 l_chk_person_id := 0;
4512 FOR csr_persons_rec IN csr_persons(stperson
4513 ,endperson
4514 ,l_start_date
4515 ,l_end_date
4516 ,l_business_group_id
4517 ,l_payroll_type
4518 ,l_legal_employer )LOOP
4519 IF csr_persons_rec.person_id <> l_chk_person_id THEN
4520 --
4521 l_chk_person_id := csr_persons_rec.person_id;
4522 --
4523 SELECT pay_assignment_actions_s.NEXTVAL
4524 INTO l_actid
4525 FROM dual;
4526 -- CREATE THE ARCHIVE ASSIGNMENT ACTION
4527 hr_nonrun_asact.insact(lockingactid => l_actid
4528 ,assignid => csr_persons_rec.assignment_id
4529 ,pactid => p_actid
4530 ,chunk => chunk
4531 ,greid => l_legal_employer);
4532 --
4533 END IF;
4534 hr_nonrun_asact.insint(l_actid,csr_persons_rec.assignment_action_id);
4535 END LOOP;
4536 ELSIF l_payroll_type = 'YEARLY' THEN ---- for yearly report
4537
4538 l_chk_assignment_id := 0;
4539 FOR csr_rec IN csr_assignments_yearly(stperson,endperson,l_start_date,l_end_date,l_business_group_id,l_payroll_type,l_legal_employer,l_paid_flag) LOOP
4540 IF csr_rec.assignment_id <> l_chk_assignment_id THEN
4541 l_chk_assignment_id := csr_rec.assignment_id;
4542 SELECT pay_assignment_actions_s.NEXTVAL
4543 INTO l_actid
4544 FROM dual;
4545 --Fnd_file.put_line(FND_FILE.LOG,'#######~~csr_rec.assignment_action_id :'||l_actid||','||csr_rec.assignment_action_id);
4546 -- CREATE THE ARCHIVE ASSIGNMENT ACTION FOR THE MASTER ASSIGNMENT ACTION
4547 hr_nonrun_asact.insact(lockingactid => l_actid
4548 ,assignid => csr_rec.assignment_id
4549 ,pactid => p_actid
4550 ,chunk => chunk
4551 ,greid => l_legal_employer);
4552 --
4553 END IF;
4554 IF csr_rec.assignment_action_id IS NOT NULL THEN
4555 --Fnd_file.put_line(FND_FILE.LOG,'#######~~hr_nonrun_asact.insint');
4556 hr_nonrun_asact.insint(l_actid,csr_rec.assignment_action_id);
4557 END IF;
4558 END LOOP;
4559 ELSE
4560 l_chk_assignment_id := 0;
4561 --
4562 FOR csr_rec IN csr_assignments(stperson,endperson,l_start_date,l_end_date,l_business_group_id,l_payroll_type,l_legal_employer,l_paid_flag) LOOP
4563 IF csr_rec.assignment_id <> l_chk_assignment_id THEN
4564 l_chk_assignment_id := csr_rec.assignment_id;
4565 SELECT pay_assignment_actions_s.NEXTVAL
4566 INTO l_actid
4567 FROM dual;
4568 -- CREATE THE ARCHIVE ASSIGNMENT ACTION FOR THE MASTER ASSIGNMENT ACTION
4569 hr_nonrun_asact.insact(lockingactid => l_actid
4570 ,assignid => csr_rec.assignment_id
4571 ,pactid => p_actid
4572 ,chunk => chunk
4573 ,greid => l_legal_employer);
4574 --
4575 END IF;
4576 IF csr_rec.assignment_action_id IS NOT NULL THEN
4577 hr_nonrun_asact.insint(l_actid,csr_rec.assignment_action_id);
4578 END IF;
4579 END LOOP;
4580 END IF;
4581 --
4582 END archive_action_creation;
4583 --------------------------------------------------------------------------------
4584 -- LOCK_ACTION_CREATION
4585 --------------------------------------------------------------------------------
4586 PROCEDURE lock_action_creation (p_actid IN NUMBER
4587 ,stperson IN NUMBER
4588 ,endperson IN NUMBER
4589 ,chunk IN NUMBER) IS
4590 --
4591 CURSOR csr_assignment_actions(p_arc_pactid NUMBER) IS
4592 SELECT paa.assignment_action_id
4593 ,paa.assignment_id
4594 FROM pay_assignment_actions paa
4595 ,per_all_assignments_f paaf
4596 ,pay_payroll_actions ppa
4597 WHERE paa.payroll_action_id = p_arc_pactid
4598 AND paa.payroll_action_id = ppa.payroll_action_id
4599 AND paaf.person_id BETWEEN stperson
4600 AND endperson
4601 AND paa.assignment_id = paaf.assignment_id
4602 AND ppa.effective_date BETWEEN paaf.effective_start_date
4603 AND paaf.effective_end_date
4604 ORDER BY paa.assignment_action_id;
4605 --
4606 l_actid NUMBER;
4607 l_arc_pactid NUMBER;
4608 --
4609 BEGIN
4610 --
4611 --hr_utility.trace_on(null,'NL_WR');
4612 --
4613 l_arc_pactid := TO_NUMBER(get_parameters(p_actid,'REQUEST_ID'));
4614 --
4615 FOR csr_rec IN csr_assignment_actions(l_arc_pactid) LOOP
4616 --
4617 SELECT pay_assignment_actions_s.NEXTVAL
4618 INTO l_actid
4619 FROM dual;
4620 --
4621 hr_nonrun_asact.insact(lockingactid => l_actid
4622 ,assignid => csr_rec.assignment_id
4623 ,pactid => p_actid
4624 ,chunk => chunk);
4625 --
4626 hr_nonrun_asact.insint( lockingactid => l_actid
4627 ,lockedactid => csr_rec.assignment_action_id );
4628 --
4629 END LOOP;
4630 --
4631 END lock_action_creation;
4632 --
4633 --------------------------------------------------------------------------------
4634 -- GET_SCL_DATA
4635 --------------------------------------------------------------------------------
4636 PROCEDURE get_scl_data(p_scl_id IN NUMBER
4637 ,p_effective_date IN DATE
4638 ,p_income_code IN OUT NOCOPY VARCHAR2
4639 ,p_work_pattern IN OUT NOCOPY VARCHAR2
4640 ,p_wage_tax_discount IN OUT NOCOPY VARCHAR2
4641 ,p_wage_tax_table IN OUT NOCOPY VARCHAR2
4642 ,p_wage_aow IN OUT NOCOPY VARCHAR2
4643 ,p_wage_wajong IN OUT NOCOPY VARCHAR2
4644 ,p_emp_loan IN OUT NOCOPY VARCHAR2
4645 ,p_transportation IN OUT NOCOPY VARCHAR2
4646 ,p_chk IN OUT NOCOPY VARCHAR2)
4647 IS
4648 --
4649 CURSOR csr_get_scl_seg(c_scl_id NUMBER) IS
4650 SELECT decode(segment4,'Y','J',segment4) wage_tax_discount
4651 ,decode(segment6,'R','J','I','N','S','N') work_pattern
4652 ,segment8 income_code
4653 ,segment11 wage_tax_table
4654 --,decode(INSTR(NVL(segment10,'00'),'01'),0,(decode(INSTR(segment13,'02'),0,1,3)),2) company_car_use --01/02
4655 ,decode(INSTR(NVL(segment10,'00'),'71'),0,'N','J') wage_aow
4656 ,decode(INSTR(NVL(segment10,'00'),'72'),0,'N','J') wage_wajong
4657 ,decode(INSTR(NVL(segment10,'00'),'43'),0,'N','J') emp_loan
4658 ,decode(INSTR(NVL(segment10,'00'),'03'),0,'N','J') transportation
4659 FROM hr_soft_coding_keyflex
4660 WHERE soft_coding_keyflex_id = c_scl_id;
4661 --
4662 l_wage_tax_discount hr_soft_coding_keyflex.segment13%type;
4663 l_work_pattern hr_soft_coding_keyflex.segment13%type;
4664 l_income_code hr_soft_coding_keyflex.segment13%type;
4665 l_wage_tax_table hr_soft_coding_keyflex.segment13%type;
4666 l_wage_aow hr_soft_coding_keyflex.segment13%type;
4667 l_wage_wajong hr_soft_coding_keyflex.segment13%type;
4668 l_emp_loan hr_soft_coding_keyflex.segment13%type;
4669 l_transportation hr_soft_coding_keyflex.segment13%type;
4670 --
4671 BEGIN
4672 --
4673 OPEN csr_get_scl_seg(p_scl_id);
4674 FETCH csr_get_scl_seg INTO l_wage_tax_discount
4675 ,l_work_pattern
4676 ,l_income_code
4677 ,l_wage_tax_table
4678 -- ,l_company_car_use
4679 ,l_wage_aow
4680 ,l_wage_wajong
4681 ,l_emp_loan
4682 ,l_transportation;
4683 CLOSE csr_get_scl_seg;
4684 --
4685 p_chk := 'N';
4686 l_wage_tax_table := NVL(l_wage_tax_table,940);
4687 l_wage_tax_discount := NVL(l_wage_tax_discount,'N');
4688 l_work_pattern := NVL(l_work_pattern,'N');
4689 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
4690 l_work_pattern := NULL;
4691 p_work_pattern := NULL;
4692 END IF;
4693 --
4694 IF p_wage_tax_discount <> l_wage_tax_discount OR
4695 p_work_pattern <> l_work_pattern OR
4696 p_income_code <> l_income_code OR
4697 p_wage_tax_table <> l_wage_tax_table OR
4698 p_wage_aow <> l_wage_aow OR
4699 p_wage_wajong <> l_wage_wajong OR
4700 p_emp_loan <> l_emp_loan OR
4701 p_transportation <> l_transportation THEN
4702 p_chk := 'Y';
4703 END IF;
4704 p_wage_tax_discount := l_wage_tax_discount;
4705 p_work_pattern := l_work_pattern ;
4706 p_income_code := l_income_code ;
4707 p_wage_tax_table := l_wage_tax_table ;
4708 p_wage_aow := l_wage_aow ;
4709 p_wage_wajong := l_wage_wajong ;
4710 p_emp_loan := l_emp_loan ;
4711 p_transportation := l_transportation ;
4712 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_wage_tax_discount :'||p_wage_tax_discount);
4713 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_work_pattern :'||p_work_pattern);
4714 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_income_code :'||p_income_code);
4715 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_wage_tax_table :'||p_wage_tax_table);
4716 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_wage_aow :'||p_wage_aow);
4717 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_wage_wajong :'||p_wage_wajong);
4718 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_emp_loan :'||p_emp_loan);
4719 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_transportation :'||p_transportation);
4720 --
4721 END get_scl_data;
4722 --
4723 --
4724 --------------------------------------------------------------------------------
4725 -- ARCHIVE_EMP_ADDRESS
4726 --------------------------------------------------------------------------------
4727 PROCEDURE archive_emp_address(p_assactid NUMBER
4728 ,p_person_id NUMBER
4729 ,p_assignment_id NUMBER
4730 ,p_assignment_number VARCHAR2
4731 ,p_name VARCHAR2
4732 ,p_tax_unit_id NUMBER
4733 ,p_m_act_info_id NUMBER
4734 ,p_arc_eff_date DATE
4735 ,p_eff_date DATE
4736 ,p_type VARCHAR2) IS
4737 --
4738 CURSOR csr_get_emp_address(c_person_id NUMBER
4739 ,c_effective_date DATE) IS
4740 SELECT addr.style
4741 ,addr.address_line1 address_line1
4742 ,addr.address_line2 address_line2
4743 ,addr.address_line3 address_line3
4744 ,addr.town_or_city town_or_city
4745 ,UPPER(addr.postal_code) postal_code
4746 ,addr.region_1 street_name
4747 ,addr.region_2 region_2
4748 ,addr.region_3 PO_Box_number
4749 ,addr.country country
4750 ,addr.telephone_number_1 telephone_number_1
4751 ,addr.telephone_number_2 telephone_number_2
4752 ,addr.telephone_number_3 telephone_number_3
4753 ,addr.add_information13 House_Number
4754 ,addr.add_information14 House_Number_Addition
4755 FROM per_addresses addr
4756 WHERE addr.person_id = c_person_id
4757 AND addr.primary_flag = 'Y'
4758 AND c_effective_date BETWEEN addr.date_from AND
4759 nvl(addr.date_to,fnd_date.canonical_to_date('4712/12/31'))
4760 ORDER BY 1 DESC;
4761 --
4762 l_addr csr_get_emp_address%ROWTYPE;
4763 l_ovn pay_action_information.object_version_number%type;
4764 l_action_info_id pay_action_information.action_information_id%type;
4765 l_address_flag VARCHAR2(1) := 'N';
4766 l_address_type VARCHAR2(30);
4767 --
4768 BEGIN
4769 --
4770 OPEN csr_get_emp_address(p_person_id,p_eff_date);
4771 FETCH csr_get_emp_address INTO l_addr;
4772 IF csr_get_emp_address%FOUND THEN
4773 l_address_flag := 'Y';
4774 IF l_addr.country = 'NL' THEN
4775 l_address_type := 'EMPLOYEE';
4776 ELSE
4777 l_address_type := 'EMPLOYEE FOREIGN';
4778 END IF;
4779 --#
4780 IF p_type IN ('INITIAL','CORRECTION') THEN
4781 --
4782 IF (l_addr.style = 'NL' AND l_addr.street_name IS NULL) OR
4783 (l_addr.style <> 'NL' AND l_addr.address_line1 IS NULL)THEN
4784 pay_action_information_api.create_action_information
4785 (
4786 p_action_information_id => l_action_info_id
4787 , p_action_context_id => p_assactid
4788 , p_action_context_type => 'AAP'
4789 , p_object_version_number => l_ovn
4790 , p_assignment_id => p_assignment_id
4791 , p_effective_date => p_arc_eff_date
4792 , p_source_id => NULL
4793 , p_source_text => NULL
4794 , p_tax_unit_id => p_tax_unit_id
4795 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4796 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_STREET')
4797 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
4798 , p_action_information6 => 'Street name missing in the address'
4799 , p_action_information7 => p_name
4800 , p_action_information8 => p_assignment_number);
4801 END IF;
4802 --
4803 IF l_addr.town_or_city IS NULL THEN
4804 pay_action_information_api.create_action_information
4805 (
4806 p_action_information_id => l_action_info_id
4807 , p_action_context_id => p_assactid
4808 , p_action_context_type => 'AAP'
4809 , p_object_version_number => l_ovn
4810 , p_assignment_id => p_assignment_id
4811 , p_effective_date => p_arc_eff_date
4812 , p_source_id => NULL
4813 , p_source_text => NULL
4814 , p_tax_unit_id => p_tax_unit_id
4815 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4816 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_CITY')
4817 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
4818 , p_action_information6 => 'City name missing in the address'
4819 , p_action_information7 => p_name
4820 , p_action_information8 => p_assignment_number);
4821 END IF;
4822 --
4823 IF l_addr.postal_code IS NULL AND l_addr.style = 'NL' THEN
4824 pay_action_information_api.create_action_information
4825 (
4826 p_action_information_id => l_action_info_id
4827 , p_action_context_id => p_assactid
4828 , p_action_context_type => 'AAP'
4829 , p_object_version_number => l_ovn
4830 , p_assignment_id => p_assignment_id
4831 , p_effective_date => p_arc_eff_date
4832 , p_source_id => NULL
4833 , p_source_text => NULL
4834 , p_tax_unit_id => p_tax_unit_id
4835 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4836 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_PO_CODE')
4837 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
4838 , p_action_information6 => 'Postal Code missing in address'
4839 , p_action_information7 => p_name
4840 , p_action_information8 => p_assignment_number);
4841 END IF;
4842 --
4843 IF l_addr.country IS NULL THEN
4844 pay_action_information_api.create_action_information
4845 (
4846 p_action_information_id => l_action_info_id
4847 , p_action_context_id => p_assactid
4848 , p_action_context_type => 'AAP'
4849 , p_object_version_number => l_ovn
4850 , p_assignment_id => p_assignment_id
4851 , p_effective_date => p_arc_eff_date
4852 , p_source_id => NULL
4853 , p_source_text => NULL
4854 , p_tax_unit_id => p_tax_unit_id
4855 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4856 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_COUNTRY')
4857 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
4858 , p_action_information6 => 'Country is missing in address'
4859 , p_action_information7 => p_name
4860 , p_action_information8 => p_assignment_number);
4861 END IF;
4862 --
4863 END IF;
4864 --#
4865 IF l_addr.style = 'NL' THEN
4866 --#
4867 IF p_type IN ('INITIAL','CORRECTION') THEN
4868 --
4869 IF hr_ni_chk_pkg.chk_nat_id_format(l_addr.postal_code,'DDDD AA') = upper(l_addr.postal_code) OR
4870 hr_ni_chk_pkg.chk_nat_id_format(l_addr.postal_code,'DDDDAA') = upper(l_addr.postal_code) THEN
4871 NULL;
4872 ELSE
4873 pay_action_information_api.create_action_information
4874 (
4875 p_action_information_id => l_action_info_id
4876 , p_action_context_id => p_assactid
4877 , p_action_context_type => 'AAP'
4878 , p_object_version_number => l_ovn
4879 , p_assignment_id => p_assignment_id
4880 , p_effective_date => p_arc_eff_date
4881 , p_source_id => NULL
4882 , p_source_text => NULL
4883 , p_tax_unit_id => p_tax_unit_id
4884 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4885 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_PO_FORMAT')
4886 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
4887 , p_action_information6 => 'Postal Code is not in the format 9999XX'
4888 , p_action_information7 => p_name
4889 , p_action_information8 => p_assignment_number);
4890 END IF;
4891 --
4892 END IF;
4893 --#
4894 pay_action_information_api.create_action_information (
4895 p_action_information_id => l_action_info_id
4896 ,p_action_context_id => p_assactid
4897 ,p_action_context_type => 'AAP'
4898 ,p_object_version_number => l_ovn
4899 ,p_assignment_id => p_assignment_id
4900 ,p_effective_date => p_arc_eff_date
4901 ,p_source_id => NULL
4902 ,p_source_text => NULL
4903 ,p_tax_unit_id => p_tax_unit_id
4904 ,p_action_information_category => 'ADDRESS DETAILS'
4905 ,p_action_information1 => p_person_id
4906 ,p_action_information5 => substr(l_addr.House_Number,1,5)
4907 ,p_action_information6 => substr(l_addr.House_Number_Addition,1,4)
4908 ,p_action_information8 => l_addr.town_or_city --substr(l_addr.town_or_city,1,24)
4909 ,p_action_information9 => substr(l_addr.street_name,1,24)
4910 ,p_action_information11 => TRIM(substr(l_addr.address_line1||' '||l_addr.PO_Box_number,1,35)) -- Location
4911 ,p_action_information12 => REPLACE(l_addr.postal_code,' ','')
4912 ,p_action_information13 => l_addr.country
4913 ,p_action_information14 => l_address_type
4914 ,p_action_information26 => p_type
4915 ,p_action_information27 => p_m_act_info_id); -- add ADD_INFORMATION13 and ADD_INFORMATION14
4916 ELSE
4917 IF l_addr.country <> 'NL' THEN
4918 pay_action_information_api.create_action_information (
4919 p_action_information_id => l_action_info_id
4920 ,p_action_context_id => p_assactid
4921 ,p_action_context_type => 'AAP'
4922 ,p_object_version_number => l_ovn
4923 ,p_assignment_id => p_assignment_id
4924 ,p_effective_date => p_arc_eff_date
4925 ,p_source_id => NULL
4926 ,p_source_text => NULL
4927 ,p_tax_unit_id => p_tax_unit_id
4928 ,p_action_information_category => 'ADDRESS DETAILS'
4929 ,p_action_information1 => p_person_id
4930 ,p_action_information5 => SUBSTR(l_addr.address_line1,1,24) -- street
4931 ,p_action_information6 => SUBSTR(l_addr.address_line2,1,9) -- house nr
4932 ,p_action_information7 => SUBSTR(l_addr.address_line3,1,35) -- location
4933 ,p_action_information8 => SUBSTR(l_addr.town_or_city,1,50)
4934 ,p_action_information9 => l_addr.street_name --SUBSTR(l_addr.street_name,1,24) -- region
4935 ,p_action_information12 => SUBSTR(l_addr.postal_code,1,9)
4936 ,p_action_information13 => SUBSTR(l_addr.country,1,2)
4937 ,p_action_information14 => l_address_type
4938 ,p_action_information26 => p_type
4939 ,p_action_information27 => p_m_act_info_id); -- add tel numbers also
4940 END IF;
4941 END IF;
4942 END IF;
4943 CLOSE csr_get_emp_address;
4944 --#
4945 IF l_address_flag = 'N' AND p_type IN ('INITIAL','CORRECTION') THEN
4946 pay_action_information_api.create_action_information
4947 (
4948 p_action_information_id => l_action_info_id
4949 , p_action_context_id => p_assactid
4950 , p_action_context_type => 'AAP'
4951 , p_object_version_number => l_ovn
4952 , p_assignment_id => p_assignment_id
4953 , p_effective_date => p_arc_eff_date
4954 , p_source_id => NULL
4955 , p_source_text => NULL
4956 , p_tax_unit_id => p_tax_unit_id
4957 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4958 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_ADDRESS')
4959 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
4960 , p_action_information6 => 'Address details are null'
4961 , p_action_information7 => p_name
4962 , p_action_information8 => p_assignment_number);
4963 END IF;
4964 --#
4965 END archive_emp_address;
4966 --
4967 --------------------------------------------------------------------------------
4968 -- ARCHIVE_SECTOR_RISK_GROUP
4969 --------------------------------------------------------------------------------
4970 FUNCTION archive_sector_risk_group( p_actid NUMBER
4971 ,p_assignment_id NUMBER
4972 ,p_effective_date DATE
4973 ,p_tax_unit_id NUMBER
4974 ,p_mas_act_info_id NUMBER
4975 ,p_start_date DATE
4976 ,p_end_date DATE
4977 ,p_emp_start_date DATE
4978 ,p_emp_end_date DATE
4979 ,p_payroll_type VARCHAR2) RETURN VARCHAR2 IS
4980 --
4981 CURSOR csr_get_emp_risk_grp(c_assignment_id NUMBER) IS
4982 SELECT DISTINCT hoi.organization_id
4983 ,hoi.org_information5 sector
4984 ,hoi.org_information6 risk_group
4985 ,fnd_date.canonical_to_date(aei.AEI_INFORMATION1) start_date
4986 ,fnd_date.canonical_to_date(aei.AEI_INFORMATION2) end_date
4987 FROM hr_organization_information hoi
4988 ,per_assignment_extra_info aei
4989 WHERE hoi.organization_id = nvl( aei.aei_information8,HR_NL_ORG_INFO.Get_SI_Provider_Info(aei.assignment_id,aei.AEI_INFORMATION3))
4990 AND aei.assignment_id = c_assignment_id
4991 AND aei.information_type = 'NL_SII'
4992 AND aei.aei_information3 IN ('WW','AMI','ZW','WAO')
4993 AND hoi.org_information5 IS NOT NULL
4994 AND hoi.org_information6 IS NOT NULL
4995 AND hoi.org_information_context= 'NL_UWV'
4996 ORDER BY 2,3;
4997 /*SELECT DISTINCT organization_id
4998 ,org_information5 sector
4999 ,org_information6 risk_group
5000 FROM hr_organization_information
5001 WHERE organization_id IN (SELECT HR_NL_ORG_INFO.Get_SI_Provider_Info(assignment_id,AEI_INFORMATION3)
5002 FROM per_assignment_extra_info
5003 WHERE assignment_id = c_assignment_id
5004 AND information_type = 'NL_SII'
5005 AND aei_information3 IN ('WW','AMI'))
5006 AND org_information5 IS NOT NULL
5007 AND org_information6 IS NOT NULL
5008 AND org_information_context= 'NL_UWV';*/
5009 --AND rownum < 6;
5010 --
5011 l_action_info_id pay_action_information.action_information_id%TYPE;
5012 l_ovn pay_action_information.object_version_number%type;
5013 l_srg_flag VARCHAR2(1);
5014 l_srg_flag_52 VARCHAR2(1);
5015 l_start_date DATE;
5016 l_end_date DATE;
5017 l_sector VARCHAR2(30);
5018 l_risk_grp VARCHAR2(30);
5019
5020 --
5021 BEGIN
5022 --
5023 l_srg_flag := 'N';
5024 l_srg_flag_52 := 'N';
5025 l_start_date := p_start_date;
5026 l_end_date := p_end_date;
5027 l_sector := 'X';
5028 l_risk_grp := 'X';
5029 --
5030 IF p_emp_start_date BETWEEN p_start_date AND p_end_date THEN
5031 l_start_date := p_emp_start_date;
5032 END IF;
5033 IF p_emp_end_date BETWEEN p_start_date AND p_end_date THEN
5034 l_end_date := p_emp_end_date;
5035 END IF;
5036 --
5037 FOR l_rec IN csr_get_emp_risk_grp(p_assignment_id) LOOP
5038 IF ( (NVL(l_rec.end_date,l_end_date) >= l_end_date) OR
5039 (p_payroll_type = 'YEARLY' AND NVL(l_rec.end_date,l_end_date) >= l_start_date))
5040 AND l_rec.start_date <= l_end_date
5041 AND l_sector <> l_rec.sector AND l_risk_grp <> l_rec.risk_group THEN
5042 --IF NVL(l_rec.end_date,l_end_date) >= l_start_date AND l_rec.start_date <= l_end_date THEN
5043 /*IF l_rec.start_date BETWEEN p_start_date AND p_end_date AND
5044 l_rec.start_date >= NVL(l_start_date,l_rec.start_date)THEN
5045 l_start_date := l_rec.start_date;
5046 END IF;
5047 IF l_rec.end_date BETWEEN p_start_date AND p_end_date AND
5048 l_rec.start_date >= NVL(l_end_date,l_rec.start_date)THEN
5049 l_end_date := l_rec.end_date;
5050 END IF;*/
5051 --
5052 pay_action_information_api.create_action_information (
5053 p_action_information_id => l_action_info_id
5054 , p_action_context_id => p_actid
5055 , p_action_context_type => 'AAP'
5056 , p_object_version_number => l_ovn
5057 , p_assignment_id => p_assignment_id
5058 , p_effective_date => p_effective_date
5059 , p_source_id => NULL
5060 , p_source_text => NULL
5061 ,p_tax_unit_id => p_tax_unit_id
5062 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
5063 , p_action_information1 => 'SECTOR_RISK_GROUP'
5064 , p_action_information2 => p_mas_act_info_id
5065 , p_action_information5 => fnd_date.date_to_canonical(l_start_date)
5066 , p_action_information6 => fnd_date.date_to_canonical(LEAST(l_end_date,NVL(l_rec.end_date,l_end_date)))
5067 , p_action_information7 => l_rec.sector
5068 , p_action_information8 => l_rec.risk_group
5069 , p_action_information9 => NULL
5070 , p_action_information10 => NULL);
5071 --
5072 l_srg_flag := 'Y';
5073 IF l_rec.sector = '52' THEN
5074 l_srg_flag_52 := 'Y';
5075 END IF;
5076 --
5077 l_risk_grp := l_rec.risk_group;
5078 l_sector := l_rec.sector;
5079 --
5080 END IF;
5081 --
5082 END LOOP;
5083 /*OPEN csr_get_emp_risk_grp(p_assignment_id);
5084 FETCH csr_get_emp_risk_grp INTO l_sector_rec;
5085 IF csr_get_emp_risk_grp%found THEN
5086 pay_action_information_api.create_action_information (
5087 p_action_information_id => l_action_info_id
5088 , p_action_context_id => p_actid
5089 , p_action_context_type => 'AAP'
5090 , p_object_version_number => l_ovn
5091 , p_assignment_id => p_assignment_id
5092 , p_effective_date => p_effective_date
5093 , p_source_id => NULL
5094 , p_source_text => NULL
5095 ,p_tax_unit_id => p_tax_unit_id
5096 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
5097 , p_action_information1 => 'SECTOR_RISK_GROUP'
5098 , p_action_information2 => p_mas_act_info_id
5099 , p_action_information5 => fnd_date.date_to_canonical(p_start_date)
5100 , p_action_information6 => fnd_date.date_to_canonical(p_end_date)
5101 , p_action_information7 => l_sector_rec.sector
5102 , p_action_information8 => l_sector_rec.risk_group
5103 , p_action_information9 => NULL
5104 , p_action_information10 => NULL);
5105 --
5106 l_srg_flag := 'Y';
5107 IF l_sector_rec.sector = '52' THEN
5108 l_srg_flag_52 := 'Y';
5109 END IF;
5110 END IF;
5111 CLOSE csr_get_emp_risk_grp; */
5112 --
5113 IF l_srg_flag_52 = 'Y' THEN
5114 l_srg_flag := 'Z';
5115 END IF;
5116 --
5117 RETURN l_srg_flag;
5118 --
5119 END archive_sector_risk_group;
5120 --
5121 --------------------------------------------------------------------------------
5122 -- GET_NOMINATIVE_DATA
5123 --------------------------------------------------------------------------------
5124 PROCEDURE get_nominative_data(p_bal_tab Bal_Value
5125 ,p_nom_bal_value IN OUT NOCOPY Bal_Value) IS
5126 --
5127 BEGIN
5128 --
5129 FOR i in 1..29 LOOP
5130 p_nom_bal_value(i).balance_value := 0;
5131 END LOOP;
5132 --
5133 FOR i in 1..3 LOOP -- Wage LB/PH
5134 p_nom_bal_value(1).balance_value := p_nom_bal_value(1).balance_value + p_bal_tab(i).balance_value;
5135 END LOOP;
5136 FOR i in 92..93 LOOP
5137 p_nom_bal_value(1).balance_value := p_nom_bal_value(1).balance_value + p_bal_tab(i).balance_value;
5138 END LOOP;
5139 FOR i in 13..15 LOOP
5140 p_nom_bal_value(1).balance_value := p_nom_bal_value(1).balance_value + p_bal_tab(i).balance_value;
5141 END LOOP;
5142 --
5143 FOR i in 4..12 LOOP -- SI Income
5144 p_nom_bal_value(2).balance_value := p_nom_bal_value(2).balance_value + p_bal_tab(i).balance_value;
5145 END LOOP;
5146 --
5147 FOR i in 13..15 LOOP -- 'SP RATE TAXABLE INCOME'
5148 p_nom_bal_value(3).balance_value := p_nom_bal_value(3).balance_value + p_bal_tab(i).balance_value;
5149 END LOOP;
5150 --
5151 p_nom_bal_value(4).balance_value := p_bal_tab(16).balance_value; -- 'HOLIDAY ALLW'
5152 p_nom_bal_value(5).balance_value := p_bal_tab(17).balance_value; -- 'RESERVATION HOLIDAY ALLW'
5153 p_nom_bal_value(6).balance_value := p_bal_tab(18).balance_value + p_bal_tab(118).balance_value
5154 + p_bal_tab(119).balance_value; -- 'ADDITIONAL PERIOD WAGE'
5155 p_nom_bal_value(7).balance_value := p_bal_tab(19).balance_value; -- 'R ADDITIONAL PERIOD WAGE'
5156 --
5157 FOR i in 20..25 LOOP -- 'WAGE_MONEY'
5158 p_nom_bal_value(8).balance_value := p_nom_bal_value(8).balance_value + p_bal_tab(i).balance_value;
5159 END LOOP;
5160 --Bug# 7110638
5161 /*FOR i in 96..101 LOOP
5162 p_nom_bal_value(8).balance_value := p_nom_bal_value(8).balance_value + p_bal_tab(i).balance_value;
5163 END LOOP;*/
5164 --Bug# 7110638
5165 --
5166 FOR i in 26..31 LOOP -- 'WAGE_KIND'
5167 p_nom_bal_value(9).balance_value := p_nom_bal_value(9).balance_value + p_bal_tab(i).balance_value;
5168 END LOOP;
5169 --
5170 --Bug# 7110638
5171 /*FOR i in 102..107 LOOP
5172 p_nom_bal_value(9).balance_value := p_nom_bal_value(9).balance_value + p_bal_tab(i).balance_value;
5173 END LOOP;*/
5174 --Bug# 7110638
5175 --
5176 p_nom_bal_value(10).balance_value := p_bal_tab(38).balance_value; -- 'OT_WAGE'
5177 --
5178 FOR i in 39..44 LOOP -- 'WAGE_TAX'
5179 p_nom_bal_value(11).balance_value := p_nom_bal_value(11).balance_value + p_bal_tab(i).balance_value;
5180 END LOOP;
5181 FOR i in 94..95 LOOP
5182 p_nom_bal_value(11).balance_value := p_nom_bal_value(11).balance_value + p_bal_tab(i).balance_value;
5183 END LOOP;
5184 FOR i in 114..115 LOOP
5185 p_nom_bal_value(11).balance_value := p_nom_bal_value(11).balance_value + p_bal_tab(i).balance_value;
5186 END LOOP;
5187 --
5188 FOR i in 45..53 LOOP -- 'WAO_CONTRBUTION_AOF' all 16 WAOB - WGA - IVA 45..53
5189 p_nom_bal_value(12).balance_value := p_nom_bal_value(12).balance_value + p_bal_tab(i).balance_value;
5190 END LOOP;
5191 --
5192 IF g_public_org_flag = 'N' AND g_risk_cover_flag = 'Y' THEN
5193 p_nom_bal_value(13).balance_value := 0;
5194 ELSIF g_public_org_flag = 'Y' AND g_risk_cover_flag = 'Y' THEN
5195 p_nom_bal_value(13).balance_value := 0;
5196 ELSE
5197 FOR i in 54..56 LOOP -- 'WAO_CONTRBUTION_AOK' all 16 WAOD
5198 p_nom_bal_value(13).balance_value := p_nom_bal_value(13).balance_value + p_bal_tab(i).balance_value;
5199 END LOOP;
5200 END IF;
5201 --
5202 IF g_public_org_flag = 'Y' THEN
5203 p_nom_bal_value(14).balance_value := NULL;
5204 ELSE
5205 FOR i in 57..59 LOOP -- 'WW_AWF' WEWE all emp
5206 p_nom_bal_value(14).balance_value := p_nom_bal_value(14).balance_value + p_bal_tab(i).balance_value;
5207 END LOOP;
5208 END IF;
5209 --
5210 IF g_public_org_flag = 'Y' THEN
5211 p_nom_bal_value(15).balance_value := NULL;
5212 ELSE
5213 FOR i in 60..62 LOOP -- 'c_WAITING_MONEY_FUND' all 16 - WEWA
5214 p_nom_bal_value(15).balance_value := p_nom_bal_value(15).balance_value + p_bal_tab(i).balance_value;
5215 END LOOP;
5216 END IF;
5217 --
5218 IF g_public_org_flag = 'Y' THEN
5219 FOR i in 63..65 LOOP -- 'UFO_CONTRIBUTION' all 16 UFO 63..65
5220 p_nom_bal_value(16).balance_value := p_nom_bal_value(16).balance_value + p_bal_tab(i).balance_value;
5221 END LOOP;
5222 ELSE
5223 p_nom_bal_value(16).balance_value := NULL;
5224 END IF;
5225 --
5226 FOR i in 66..68 LOOP -- 'ZVW_CONTRIBUTION' -- all emp ZVW 66..68
5227 p_nom_bal_value(17).balance_value := p_nom_bal_value(17).balance_value + p_bal_tab(i).balance_value;
5228 END LOOP;
5229 --
5230 FOR i in 80..91 LOOP -- 'ZVW_ALLW' all empr zvw -different balances 80..91
5231 p_nom_bal_value(18).balance_value := p_nom_bal_value(18).balance_value + p_bal_tab(i).balance_value;
5232 END LOOP;
5233 --
5234 p_nom_bal_value(19).balance_value := p_bal_tab(69).balance_value + p_bal_tab(116).balance_value + p_bal_tab(117).balance_value;
5235 --
5236 FOR i in 70..72 LOOP -- 'LABOUR DISC'
5237 p_nom_bal_value(20).balance_value := p_nom_bal_value(20).balance_value + p_bal_tab(i).balance_value;
5238 END LOOP;
5239 --p_nom_bal_value(20).balance_value := p_nom_bal_value(20).balance_value * -1;
5240 --
5241 FOR i in 73..75 LOOP -- 'SI_DAYS'
5242 p_nom_bal_value(21).balance_value := p_nom_bal_value(21).balance_value + p_bal_tab(i).balance_value;
5243 END LOOP;
5244 p_nom_bal_value(21).balance_value := ROUND(p_nom_bal_value(21).balance_value);
5245 --
5246 p_nom_bal_value(22).balance_value := ROUND(p_bal_tab(76).balance_value); -- 'NO_HOURS'
5247 p_nom_bal_value(23).balance_value := p_bal_tab(77).balance_value; -- 'AMOUNT_SEE_DISCONT_DAYS'
5248 p_nom_bal_value(24).balance_value := p_bal_tab(78).balance_value; -- 'WWB-ALL_ALIMONY'
5249 p_nom_bal_value(25).balance_value := p_bal_tab(79).balance_value; -- 'DIRECTLY_PAID_ALIMONY'
5250 --
5251 p_nom_bal_value(26).balance_value := ROUND(p_bal_tab(108).balance_value); -- 'Private Company Car '
5252 p_nom_bal_value(27).balance_value := p_bal_tab(109).balance_value; -- 'Employee Private Company Car'
5253 p_nom_bal_value(28).balance_value := p_bal_tab(110).balance_value; -- 'Contribution Child Care'
5254 p_nom_bal_value(29).balance_value := p_bal_tab(111).balance_value + p_bal_tab(122).balance_value; -- 'Life Saving Scheme'
5255 p_nom_bal_value(30).balance_value := p_bal_tab(112).balance_value + p_bal_tab(120).balance_value
5256 + p_bal_tab(121).balance_value; -- 'Life Cycle Leave Discount'
5257 p_nom_bal_value(31).balance_value := p_bal_tab(113).balance_value; -- 'Paid Disability Allowance'
5258 --
5259 p_nom_bal_value(11).balance_value := p_nom_bal_value(11).balance_value - NVL(p_nom_bal_value(30).balance_value,0);
5260 --
5261 --archive_noinative_date
5262 --
5263 END get_nominative_data;
5264 --
5265 --------------------------------------------------------------------------------
5266 -- ARCHIVE_NOMINATIVE_DATA
5267 --------------------------------------------------------------------------------
5268 PROCEDURE archive_nominative_data(p_assactid NUMBER
5269 ,p_assignment_id NUMBER
5270 ,p_tax_unit_id NUMBER
5271 ,p_effective_date DATE
5272 ,p_date DATE
5273 ,p_type VARCHAR2
5274 ,p_master_action_info_id NUMBER
5275 ,p_name VARCHAR2
5276 ,p_corr_used VARCHAR2
5277 ,p_payroll_type VARCHAR2
5278 ,p_nom_bal_value IN OUT NOCOPY Bal_Value) IS
5279 --
5280 l_ovn pay_action_information.object_version_number%type;
5281 l_action_info_id pay_action_information.action_information_id%type;
5282 --
5283 BEGIN
5284 IF p_nom_bal_value(14).balance_value <> 0 AND p_nom_bal_value(16).balance_value <> 0 THEN
5285 pay_action_information_api.create_action_information
5286 (
5287 p_action_information_id => l_action_info_id
5288 , p_action_context_id => p_assactid
5289 , p_action_context_type => 'AAP'
5290 , p_object_version_number => l_ovn
5291 , p_assignment_id => p_assignment_id
5292 , p_effective_date => p_effective_date
5293 , p_source_id => NULL
5294 , p_source_text => NULL
5295 , p_tax_unit_id => p_tax_unit_id
5296 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
5297 , p_action_information4 => fnd_message.get_string('PER','HR_NL_UFO_AND_AWF')
5298 , p_action_information5 => fnd_date.date_to_canonical(p_date)
5299 , p_action_information6 => 'UFO Contributions and AWF Contributions exist'
5300 , p_action_information7 => p_name
5301 , p_action_information8 => p_assignment_id);
5302 END IF;
5303 --
5304 IF p_nom_bal_value(14).balance_value <> 0 AND p_nom_bal_value(15).balance_value = 0 THEN
5305 pay_action_information_api.create_action_information
5306 (
5307 p_action_information_id => l_action_info_id
5308 , p_action_context_id => p_assactid
5309 , p_action_context_type => 'AAP'
5310 , p_object_version_number => l_ovn
5311 , p_assignment_id => p_assignment_id
5312 , p_effective_date => p_effective_date
5313 , p_source_id => NULL
5314 , p_source_text => NULL
5315 , p_tax_unit_id => p_tax_unit_id
5316 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
5317 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_WEWA')
5318 , p_action_information5 => fnd_date.date_to_canonical(p_date)
5319 , p_action_information6 => 'Waiting Money Fund contribution is zero'
5320 , p_action_information7 => p_name
5321 , p_action_information8 => p_assignment_id);
5322 END IF;
5323 --
5324 IF p_nom_bal_value(14).balance_value = 0 AND p_nom_bal_value(15).balance_value <> 0 THEN
5325 pay_action_information_api.create_action_information
5326 (
5327 p_action_information_id => l_action_info_id
5328 , p_action_context_id => p_assactid
5329 , p_action_context_type => 'AAP'
5330 , p_object_version_number => l_ovn
5331 , p_assignment_id => p_assignment_id
5332 , p_effective_date => p_effective_date
5333 , p_source_id => NULL
5334 , p_source_text => NULL
5335 , p_tax_unit_id => p_tax_unit_id
5336 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
5337 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_WEWE')
5338 , p_action_information5 => fnd_date.date_to_canonical(p_date)
5339 , p_action_information6 => 'AWF contribution is zero'
5340 , p_action_information7 => p_name
5341 , p_action_information8 => p_assignment_id);
5342 END IF;
5343 --#
5344 -- Optional fields to be supressed in the report - hence passing NULL instead of 0 -vv
5345 FOR i IN 23..25 LOOP
5346 IF (p_nom_bal_value(i).balance_value = 0 ) THEN
5347 p_nom_bal_value(i).balance_value := NULL;
5348 END IF;
5349 END LOOP;
5350 --
5351 IF g_effective_date < TO_DATE('01012007','DDMMYYYY') THEN
5352 p_nom_bal_value(30).balance_value := NULL;
5353 p_nom_bal_value(31).balance_value := NULL;
5354 ELSE
5355 --p_nom_bal_value(28).balance_value := NULL; Bug 5902666
5356 p_nom_bal_value(28).balance_value := 0; --Bug 5902666
5357 p_nom_bal_value(15).balance_value := p_nom_bal_value(15).balance_value + p_nom_bal_value(30).balance_value;
5358 END IF;
5359 --
5360 IF p_payroll_type = 'YEARLY' THEN
5361 p_nom_bal_value(4).balance_value := NULL;
5362 p_nom_bal_value(5).balance_value := NULL;
5363 p_nom_bal_value(6).balance_value := NULL;
5364 p_nom_bal_value(7).balance_value := NULL;
5365 p_nom_bal_value(8).balance_value := NULL;
5366 p_nom_bal_value(9).balance_value := NULL;
5367 p_nom_bal_value(10).balance_value := NULL;
5368 p_nom_bal_value(21).balance_value := NULL;
5369 p_nom_bal_value(22).balance_value := NULL;
5370 p_nom_bal_value(28).balance_value := NULL;
5371 --p_nom_bal_value(30).balance_value := NULL; --ENh# 6968464
5372 p_nom_bal_value(31).balance_value := NULL;
5373 END IF;
5374 --
5375 pay_action_information_api.create_action_information (
5376 p_action_information_id => l_action_info_id
5377 , p_action_context_id => p_assactid
5378 , p_action_context_type => 'AAP'
5379 , p_object_version_number => l_ovn
5380 , p_assignment_id => p_assignment_id
5381 , p_effective_date => p_effective_date
5382 , p_action_information_category => 'NL_WR_NOMINATIVE_REPORT'
5383 , p_tax_unit_id => p_tax_unit_id
5384 , p_action_information1 => p_type
5385 , p_action_information2 => p_master_action_info_id
5386 , p_action_information5 => fnd_number.number_to_canonical(p_nom_bal_value(1).balance_value)
5387 , p_action_information6 => fnd_number.number_to_canonical(p_nom_bal_value(2).balance_value)
5388 , p_action_information7 => fnd_number.number_to_canonical(p_nom_bal_value(3).balance_value) -- 'SP RATE TAXABLE INCOME'
5389 , p_action_information8 => fnd_number.number_to_canonical(p_nom_bal_value(4).balance_value) -- 'HOLIDAY ALLW' ** Not req for YEarly report
5390 , p_action_information9 => fnd_number.number_to_canonical(p_nom_bal_value(5).balance_value) -- 'RESERVATION HOLIDAY ALLW' ** Not req for YEarly report
5391 , p_action_information10 => fnd_number.number_to_canonical(p_nom_bal_value(6).balance_value) -- 'ADDITIONAL PERIOD WAGE' ** Not req for YEarly report
5392 , p_action_information11 => fnd_number.number_to_canonical(p_nom_bal_value(7).balance_value) -- 'R ADDITIONAL PERIOD WAGE' ** Not req for YEarly report
5393 , p_action_information12 => fnd_number.number_to_canonical(p_nom_bal_value(8).balance_value) -- 'WAGE_MONEY' ** Not req for YEarly report
5394 , p_action_information13 => fnd_number.number_to_canonical(p_nom_bal_value(9).balance_value) -- 'WAGE_KIND' ** Not req for YEarly report
5395 , p_action_information14 => fnd_number.number_to_canonical(p_nom_bal_value(10).balance_value) -- 'OT_WAGE' ** Not req for YEarly report
5396 , p_action_information15 => fnd_number.number_to_canonical(p_nom_bal_value(11).balance_value) -- 'WAGE_TAX'
5397 , p_action_information16 => fnd_number.number_to_canonical(p_nom_bal_value(12).balance_value) -- 'WAO_CONTRBUTION_AOF'
5398 , p_action_information17 => fnd_number.number_to_canonical(p_nom_bal_value(13).balance_value) -- 'WAO_CONTRBUTION_AOK'
5399 , p_action_information18 => fnd_number.number_to_canonical(p_nom_bal_value(14).balance_value) -- 'WW_AWF'
5400 , p_action_information19 => fnd_number.number_to_canonical(p_nom_bal_value(15).balance_value) -- 'c_WAITING_MONEY_FUND'
5401 , p_action_information20 => fnd_number.number_to_canonical(p_nom_bal_value(16).balance_value) -- 'UFO_CONTRIBUTION'
5402 , p_action_information21 => fnd_number.number_to_canonical(p_nom_bal_value(17).balance_value) -- 'ZVW_CONTRIBUTION'
5403 , p_action_information22 => fnd_number.number_to_canonical(p_nom_bal_value(18).balance_value) -- 'ZVW_ALLW'
5404 , p_action_information23 => fnd_number.number_to_canonical(p_nom_bal_value(19).balance_value) -- 'TRAVEL ALLW'
5405 , p_action_information24 => fnd_number.number_to_canonical(p_nom_bal_value(20).balance_value) -- 'LABOUR DISC'
5406 , p_action_information25 => fnd_number.number_to_canonical(p_nom_bal_value(21).balance_value) -- 'SI_DAYS' ** Not req for YEarly report
5407 , p_action_information26 => fnd_number.number_to_canonical(p_nom_bal_value(22).balance_value) -- 'NO_HOURS' ** Not req for YEarly report
5408 , p_action_information27 => fnd_number.number_to_canonical(p_nom_bal_value(23).balance_value) -- 'AMOUNT_SEE_DISCONT_DAYS'
5409 , p_action_information28 => fnd_number.number_to_canonical(p_nom_bal_value(24).balance_value) -- 'WWB-ALL_ALIMONY'
5410 , p_action_information29 => fnd_number.number_to_canonical(p_nom_bal_value(25).balance_value)); -- 'DIRECTLY_PAID_ALIMONY');
5411 --
5412 pay_action_information_api.create_action_information (
5413 p_action_information_id => l_action_info_id
5414 , p_action_context_id => p_assactid
5415 , p_action_context_type => 'AAP'
5416 , p_object_version_number => l_ovn
5417 , p_assignment_id => p_assignment_id
5418 , p_effective_date => p_effective_date
5419 , p_action_information_category => 'NL_WR_NOMINATIVE_REPORT_ADD'
5420 , p_tax_unit_id => p_tax_unit_id
5421 , p_action_information1 => p_type
5422 , p_action_information2 => p_master_action_info_id
5423 , p_action_information5 => fnd_number.number_to_canonical(p_nom_bal_value(26).balance_value) -- 'Private Company Car'
5424 , p_action_information6 => fnd_number.number_to_canonical(p_nom_bal_value(27).balance_value) -- 'Employee Private Company Car'
5425 , p_action_information7 => fnd_number.number_to_canonical(p_nom_bal_value(28).balance_value) -- 'Contribution Child Care' ** Not req for YEarly report
5426 , p_action_information8 => fnd_number.number_to_canonical(p_nom_bal_value(29).balance_value) -- 'Life Saving Scheme'
5427 , p_action_information9 => fnd_number.number_to_canonical(p_nom_bal_value(30).balance_value) -- 'Applied Amount of Life Cycle Leave Discount' ** Not req for YEarly report
5428 , p_action_information10 => fnd_number.number_to_canonical(p_nom_bal_value(31).balance_value)
5429 , p_action_information11 => NVL(p_corr_used,'N')); -- 'Allowance paid on top of paid disability' ** Not req for YEarly report
5430 --
5431 END archive_nominative_data;
5432 --------------------------------------------------------------------------------
5433 -- GET_ASSIGNMENT_EXTRA_INFO
5434 --------------------------------------------------------------------------------
5435 PROCEDURE get_assignment_extra_info(p_assignment_id IN NUMBER
5436 ,p_surrogate_key IN NUMBER
5437 ,p_eff_date IN DATE
5438 ,p_start_date IN DATE
5439 ,p_end_date IN DATE
5440 ,p_labour_rel_code IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
5441 ,p_ins_duty_code IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
5442 ,p_FZ_Code IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
5443 ,p_handicapped_code IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
5444 ,p_wao_insured IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
5445 ,p_ww_insured IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
5446 ,p_zw_insured IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
5447 ,p_zvw_situation IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
5448 ,p_chk IN OUT NOCOPY VARCHAR2) IS
5449 --
5450 CURSOR csr_get_ass_extra_info(c_a_extra_info_id NUMBER) IS
5451 SELECT fnd_date.canonical_to_date(aei_information1) start_date
5452 ,fnd_date.canonical_to_date(aei_information2) end_date
5453 ,aei_information3 info1
5454 ,aei_information15 info2
5455 ,aei_information_category
5456 FROM per_assignment_extra_info
5457 WHERE assignment_extra_info_id = c_a_extra_info_id
5458 AND aei_information_category IN ('NL_LBR','NL_INF','NL_TML','NL_LHI','NL_SII');
5459 --
5460 CURSOR csr_get_all_ass_extra_info(c_assignment_id NUMBER) IS
5461 SELECT fnd_date.canonical_to_date(aei_information1) start_date
5462 ,fnd_date.canonical_to_date(aei_information2) end_date
5463 ,aei_information3 info1
5464 ,aei_information15 info2
5465 ,aei_information_category
5466 FROM per_assignment_extra_info
5467 WHERE assignment_id = c_assignment_id
5468 AND aei_information_category IN ('NL_LBR','NL_INF','NL_TML','NL_LHI','NL_SII')
5469 ORDER BY 1 DESC;
5470 --
5471 l_labour_rel_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5472 l_ins_duty_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5473 l_FZ_Code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5474 l_handicapped_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5475 l_wao_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5476 l_ww_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5477 l_zw_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5478 l_zvw_situation PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5479 l_labour_rel_code1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5480 l_ins_duty_code1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5481 l_FZ_Code1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5482 l_handicapped_code1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5483 l_wao_insured1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5484 l_ww_insured1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5485 l_zw_insured1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5486 l_zvw_situation1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
5487 --
5488 BEGIN
5489 --
5490 l_labour_rel_code1 := p_labour_rel_code ;
5491 l_ins_duty_code1 := p_ins_duty_code ;
5492 l_FZ_Code1 := p_FZ_Code ;
5493 l_handicapped_code1 := p_handicapped_code;
5494 l_wao_insured1 := NVL(p_wao_insured,'N');
5495 l_ww_insured1 := NVL(p_ww_insured,'N');
5496 l_zw_insured1 := NVL(p_zw_insured,'N');
5497 l_zvw_situation1 := p_zvw_situation;
5498 --
5499 l_labour_rel_code := NULL;
5500 l_ins_duty_code := NULL;
5501 l_FZ_Code := NULL;
5502 l_handicapped_code := NULL;
5503 l_wao_insured := NULL;
5504 l_ww_insured := NULL;
5505 l_zw_insured := NULL;
5506 l_zvw_situation := NULL;
5507 --
5508 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ Inside get_assignment_extra_info'||p_assignment_id);
5509 IF p_surrogate_key IS NULL THEN
5510 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_surrogate_key is null');
5511 FOR i in csr_get_all_ass_extra_info(p_assignment_id) LOOP
5512 IF p_eff_date BETWEEN i.start_date AND NVL(i.end_date,fnd_date.canonical_to_date('4712/12/31'))
5513 OR (i.start_date <= p_end_date AND NVL(i.end_date,p_end_date) >= p_start_date AND p_eff_date < fnd_date.canonical_to_date('2006/01/01')) THEN -- SR 5531106.992
5514 --
5515 IF i.aei_information_category = 'NL_LBR' AND l_labour_rel_code IS NULL THEN
5516 l_labour_rel_code := i.info1;
5517 ELSIF i.aei_information_category = 'NL_INF' AND l_ins_duty_code IS NULL THEN
5518 l_ins_duty_code := i.info1;
5519 ELSIF i.aei_information_category = 'NL_TML' AND l_FZ_Code IS NULL THEN
5520 l_FZ_Code := i.info1;
5521 ELSIF i.aei_information_category = 'NL_LHI' AND l_handicapped_code IS NULL THEN
5522 l_handicapped_code := i.info1;
5523 ELSIF i.aei_information_category = 'NL_SII' THEN
5524 IF i.info1 IN ('AMI','WAO') AND l_wao_insured IS NULL THEN
5525 l_wao_insured := 'J';
5526 END IF;
5527 IF i.info1 IN ('AMI','WW') AND l_ww_insured IS NULL THEN
5528 l_ww_insured := 'J';
5529 END IF;
5530 IF i.info1 IN ('AMI','ZW') AND l_zw_insured IS NULL THEN
5531 l_zw_insured := 'J';
5532 END IF;
5533 IF i.info1 IN ('AMI','ZVW') AND l_zvw_situation IS NULL THEN
5534 l_zvw_situation := i.info2;
5535 END IF;
5536 --
5537 END IF;
5538 END IF;
5539 END LOOP;
5540 ELSE
5541 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_surrogate_key is not null');
5542 FOR i in csr_get_ass_extra_info(p_surrogate_key) LOOP
5543 --IF p_eff_date BETWEEN i.start_date AND NVL(i.end_date,to_date('31124712','ddmmyyyy')) THEN--IF i.start_date <= p_end_date AND NVL(i.end_date,p_end_date) >= p_start_date THEN
5544 IF i.aei_information_category = 'NL_LBR' THEN
5545 l_labour_rel_code := i.info1;
5546 ELSIF i.aei_information_category = 'NL_INF' THEN
5547 l_ins_duty_code := i.info1;
5548 ELSIF i.aei_information_category = 'NL_TML' THEN
5549 l_FZ_Code := i.info1;
5550 ELSIF i.aei_information_category = 'NL_LHI' THEN
5551 l_handicapped_code := i.info1;
5552 ELSIF i.aei_information_category = 'NL_SII' THEN
5553 l_wao_insured := 'N';
5554 l_ww_insured := 'N';
5555 l_zw_insured := 'N';
5556 IF i.info1 IN ('AMI','WAO') THEN
5557 l_wao_insured := 'J';
5558 END IF;
5559 IF i.info1 IN ('AMI','WW') THEN
5560 l_ww_insured := 'J';
5561 END IF;
5562 IF i.info1 IN ('AMI','ZW') THEN
5563 l_zw_insured := 'J';
5564 END IF;
5565 IF i.info1 IN ('AMI','ZVW') THEN
5566 l_zvw_situation := i.info2;
5567 END IF;
5568 END IF;
5569 --END IF;
5570 END LOOP;
5571 END IF;
5572 --
5573 p_labour_rel_code := l_labour_rel_code ;
5574 p_ins_duty_code := l_ins_duty_code ;
5575 p_FZ_Code := l_FZ_Code ;
5576 p_handicapped_code := l_handicapped_code;
5577 p_wao_insured := NVL(l_wao_insured,'N');
5578 p_ww_insured := NVL(l_ww_insured,'N');
5579 p_zw_insured := NVL(l_zw_insured,'N');
5580 p_zvw_situation := l_zvw_situation;
5581 p_chk := 'N';
5582 IF nvl(p_labour_rel_code,'X') <> nvl(l_labour_rel_code1,'X') OR
5583 nvl(p_ins_duty_code,'X') <> nvl(l_ins_duty_code1,'X') OR
5584 nvl(p_FZ_Code,'X') <> nvl(l_FZ_Code1,'X') OR
5585 nvl(p_handicapped_code,'X') <> nvl(l_handicapped_code1,'X') OR
5586 nvl(p_wao_insured,'X') <> nvl(l_wao_insured1,'X') OR
5587 nvl(p_ww_insured,'X') <> nvl(l_ww_insured1,'X') OR
5588 nvl(p_zw_insured,'X') <> nvl(l_zw_insured1,'X') OR
5589 nvl(p_zvw_situation,'X') <> nvl(l_zvw_situation1,'X') THEN
5590 p_chk := 'Y';
5591 END IF;
5592 --
5593 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_labour_rel_code '||p_labour_rel_code );
5594 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_ins_duty_code '||p_ins_duty_code );
5595 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_FZ_Code '||p_FZ_Code );
5596 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_handicapped_code'||p_handicapped_code);
5597 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_wao_insured '||p_wao_insured );
5598 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_ww_insured '||p_ww_insured );
5599 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_zw_insured '||p_zw_insured );
5600 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_zvw_situation '||p_zvw_situation );
5601 --
5602 END get_assignment_extra_info;
5603 --
5604 --------------------------------------------------------------------------------
5605 -- COPY
5606 --------------------------------------------------------------------------------
5607 PROCEDURE copy(p_copy_from IN OUT NOCOPY pay_interpreter_pkg.t_detailed_output_table_type
5608 ,p_from IN NUMBER
5609 ,p_copy_to IN OUT NOCOPY pay_interpreter_pkg.t_detailed_output_table_type
5610 ,p_to IN NUMBER) IS
5611 BEGIN
5612 --
5613 p_copy_to(p_to).dated_table_id := p_copy_from(p_from).dated_table_id;
5614 p_copy_to(p_to).datetracked_event := p_copy_from(p_from).datetracked_event;
5615 p_copy_to(p_to).surrogate_key := p_copy_from(p_from).surrogate_key;
5616 p_copy_to(p_to).update_type := p_copy_from(p_from).update_type;
5617 p_copy_to(p_to).column_name := p_copy_from(p_from).column_name;
5618 p_copy_to(p_to).effective_date := p_copy_from(p_from).effective_date;
5619 p_copy_to(p_to).old_value := p_copy_from(p_from).old_value;
5620 p_copy_to(p_to).new_value := p_copy_from(p_from).new_value;
5621 p_copy_to(p_to).change_values := p_copy_from(p_from).change_values;
5622 p_copy_to(p_to).proration_type := p_copy_from(p_from).proration_type;
5623 p_copy_to(p_to).change_mode := p_copy_from(p_from).change_mode;
5624 p_copy_to(p_to).element_entry_id := p_copy_from(p_from).element_entry_id;
5625 --
5626 END copy;
5627 --
5628 --------------------------------------------------------------------------------
5629 -- SORT_CHANGES
5630 --------------------------------------------------------------------------------
5631 PROCEDURE sort_changes(p_detail_tab IN OUT NOCOPY pay_interpreter_pkg.t_detailed_output_table_type) IS
5632 --
5633 l_temp_table pay_interpreter_pkg.t_detailed_output_table_type;
5634 --
5635 BEGIN
5636 IF p_detail_tab.count > 0 THEN
5637 FOR i IN p_detail_tab.first..p_detail_tab.last LOOP
5638 --x := i + 1;
5639 FOR j IN i+1..p_detail_tab.last LOOP
5640 IF p_detail_tab(j).effective_date < p_detail_tab(i).effective_date THEN
5641 copy(p_detail_tab,j,l_temp_table,1);
5642 copy(p_detail_tab,i,p_detail_tab,j);
5643 copy(l_temp_table,1,p_detail_tab,i);
5644 END IF;
5645 END LOOP;
5646 END LOOP;
5647 END IF;
5648 --
5649 /*IF p_detail_tab.count > 0 THEN
5650 FOR i IN p_detail_tab.first..p_detail_tab.last LOOP
5651 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~Record : '||i);
5652 --##--Fnd_file.put_line(FND_FILE.LOG,'#######dated_table_id : '||p_detail_tab(i).dated_table_id);
5653 --##--Fnd_file.put_line(FND_FILE.LOG,'#######datetracked_event : '||p_detail_tab(i).datetracked_event);
5654 --##--Fnd_file.put_line(FND_FILE.LOG,'#######surrogate_key : '||p_detail_tab(i).surrogate_key);
5655 --##--Fnd_file.put_line(FND_FILE.LOG,'#######update_type : '||p_detail_tab(i).update_type);
5656 --##--Fnd_file.put_line(FND_FILE.LOG,'#######column_name : '||p_detail_tab(i).column_name);
5657 --##--Fnd_file.put_line(FND_FILE.LOG,'#######effective_date : '||p_detail_tab(i).effective_date);
5658 --##--Fnd_file.put_line(FND_FILE.LOG,'#######old_value : '||p_detail_tab(i).old_value);
5659 --##--Fnd_file.put_line(FND_FILE.LOG,'#######new_value : '||p_detail_tab(i).new_value);
5660 --##--Fnd_file.put_line(FND_FILE.LOG,'#######change_values : '||p_detail_tab(i).change_values);
5661 --##--Fnd_file.put_line(FND_FILE.LOG,'#######proration_type : '||p_detail_tab(i).proration_type);
5662 --##--Fnd_file.put_line(FND_FILE.LOG,'#######change_mode : '||p_detail_tab(i).change_mode);
5663 --##--Fnd_file.put_line(FND_FILE.LOG,'#######element_entry_id : '||p_detail_tab(i).element_entry_id);
5664 END LOOP;
5665 END IF;*/
5666 --
5667 END sort_changes;
5668 --
5669 --------------------------------------------------------------------------------
5670 -- GET_ASSIGNMENT_CHANGES
5671 --------------------------------------------------------------------------------
5672 PROCEDURE get_assignment_changes(p_assignment_id IN NUMBER
5673 ,p_start_date IN DATE
5674 ,p_end_date IN DATE
5675 ,p_ass_start_date IN DATE
5676 ,p_event_group_id IN pay_event_groups.event_group_id%TYPE
5677 ,p_detail_tab IN OUT NOCOPY pay_interpreter_pkg.t_detailed_output_table_type) IS
5678 CURSOR csr_get_element_entries(c_assignment_id NUMBER
5679 ,c_eff_date DATE) IS
5680 SELECT peef.element_entry_id
5681 FROM pay_element_entries_f peef
5682 ,pay_element_types_f pet
5683 WHERE pet.element_name IN ('Holiday Coupons','Incidental Income Decrease','Additional Allowance','Company Car Private Usage')
5684 AND pet.legislation_code = 'NL'
5685 AND peef.assignment_id = c_assignment_id
5686 AND peef.element_type_id = pet.element_type_id
5687 AND c_eff_date BETWEEN peef.effective_start_date
5688 AND peef.effective_end_date
5689 AND c_eff_date BETWEEN pet.effective_start_date
5690 AND pet.effective_end_date;
5691 --
5692 CURSOR csr_get_table_id(c_table_name VARCHAR2) IS
5693 SELECT dated_table_id
5694 FROM pay_dated_tables
5695 WHERE TABLE_NAME = c_table_name;
5696 --
5697 CURSOR csr_get_eit_effective_date(c_a_extra_info_id NUMBER) IS
5698 SELECT fnd_date.canonical_to_date(aei_information1) start_date
5699 FROM per_assignment_extra_info
5700 WHERE assignment_extra_info_id = c_a_extra_info_id
5701 AND aei_information_category IN ('NL_LBR','NL_INF','NL_TML','NL_LHI','NL_SII');
5702 --
5703 l_proration_dates pay_interpreter_pkg.t_proration_dates_table_type;
5704 l_proration_changes pay_interpreter_pkg.t_proration_type_table_type;
5705 l_detail_tab pay_interpreter_pkg.t_detailed_output_table_type;
5706 l_pro_type_tab pay_interpreter_pkg.t_proration_type_table_type;
5707 --
5708 l_index NUMBER;
5709 l_cnt NUMBER;
5710 l_eff_date DATE;
5711 l_table1 pay_dated_tables.dated_table_id%type;
5712 l_table2 pay_dated_tables.dated_table_id%type;
5713 l_table3 pay_dated_tables.dated_table_id%type;
5714 --
5715 BEGIN
5716 --
5717 OPEN csr_get_table_id('PAY_ELEMENT_ENTRIES_F');
5718 FETCH csr_get_table_id INTO l_table1;
5719 CLOSE csr_get_table_id;
5720 --
5721 OPEN csr_get_table_id('PAY_ELEMENT_ENTRY_VALUES_F');
5722 FETCH csr_get_table_id INTO l_table2;
5723 CLOSE csr_get_table_id;
5724 --
5725 OPEN csr_get_table_id('PER_ASSIGNMENT_EXTRA_INFO');
5726 FETCH csr_get_table_id INTO l_table3;
5727 CLOSE csr_get_table_id;
5728 --
5729 --##--Fnd_file.put_line(FND_FILE.LOG,'#######dated_table_id PAY_ELEMENT_ENTRIES_F : '||l_table1);
5730 --##--Fnd_file.put_line(FND_FILE.LOG,'#######dated_table_id PAY_ELEMENT_ENTRY_VALUES_F : '||l_table1);
5731 --##--Fnd_file.put_line(FND_FILE.LOG,'#######dated_table_id PER_ASSIGNMENT_EXTRA_INFO : '||l_table1);
5732 l_cnt := 1;
5733 FOR c_rec IN csr_get_element_entries(p_assignment_id,p_end_date) LOOP
5734 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Calling interpretor for element_entry_id : '||c_rec.element_entry_id);
5735 BEGIN
5736 pay_interpreter_pkg.entry_affected(
5737 p_element_entry_id => c_rec.element_entry_id
5738 ,p_assignment_action_id => NULL
5739 ,p_assignment_id => p_assignment_id
5740 ,p_mode => 'REPORTS'
5741 ,p_process => 'P'
5742 ,p_event_group_id => p_event_group_id
5743 ,p_process_mode => 'ENTRY_CREATION_DATE' --ENTRY_CREATION_DATE
5744 ,p_start_date => p_start_date - 1
5745 ,p_end_date => p_end_date + 1
5746 ,t_detailed_output => l_detail_tab
5747 ,t_proration_dates => l_proration_dates
5748 ,t_proration_change_type => l_proration_changes
5749 ,t_proration_type => l_pro_type_tab );
5750 EXCEPTION
5751 WHEN NO_DATA_FOUND THEN
5752 l_detail_tab.delete;
5753 --##--Fnd_file.put_line(FND_FILE.LOG,'####### in Exception NO_DATA_FOUND Elements');
5754 WHEN OTHERS THEN
5755 l_detail_tab.delete;
5756 --##--Fnd_file.put_line(FND_FILE.LOG,'####### in Exception OTHERS Elements');
5757 END;
5758 --
5759 l_index := p_detail_tab.count;
5760 --##--Fnd_file.put_line(FND_FILE.LOG,'####### No of records fetched : '||l_detail_tab.count);
5761 IF l_detail_tab.count <> 0 THEN
5762 FOR i IN l_detail_tab.first..l_detail_tab.last LOOP
5763 IF (l_cnt = 1 OR (l_detail_tab(i).dated_table_id = l_table1 OR l_detail_tab(i).dated_table_id = l_table2))
5764 AND l_detail_tab(i).effective_date <= p_end_date THEN
5765 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Table : '||l_detail_tab(i).dated_table_id);
5766 --##--Fnd_file.put_line(FND_FILE.LOG,'####### column : '||l_detail_tab(i).column_name);
5767 IF l_detail_tab(i).column_name LIKE 'AEI_INFORMATION%' OR
5768 l_detail_tab(i).dated_table_id = l_table3 THEN
5769 OPEN csr_get_eit_effective_date(l_detail_tab(i).surrogate_key);
5770 FETCH csr_get_eit_effective_date INTO l_eff_date;
5771 IF csr_get_eit_effective_date%FOUND THEN
5772 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Element entry effective date : '||l_eff_date);
5773 IF l_eff_date <= p_end_date AND l_eff_date >= to_date('01-01-'||to_char(p_start_date,'YYYY'),'dd-mm-yyyy') THEN
5774 l_index := l_index + 1;
5775 p_detail_tab(l_index).dated_table_id := l_detail_tab(i).dated_table_id;
5776 p_detail_tab(l_index).datetracked_event := l_detail_tab(i).datetracked_event;
5777 p_detail_tab(l_index).surrogate_key := l_detail_tab(i).surrogate_key;
5778 p_detail_tab(l_index).update_type := l_detail_tab(i).update_type;
5779 p_detail_tab(l_index).column_name := l_detail_tab(i).column_name;
5780 p_detail_tab(l_index).effective_date := GREATEST(l_eff_date,p_ass_start_date);
5781 p_detail_tab(l_index).old_value := l_detail_tab(i).old_value;
5782 p_detail_tab(l_index).new_value := l_detail_tab(i).new_value;
5783 p_detail_tab(l_index).change_values := l_detail_tab(i).change_values;
5784 p_detail_tab(l_index).proration_type := l_detail_tab(i).proration_type;
5785 p_detail_tab(l_index).change_mode := l_detail_tab(i).change_mode;
5786 END IF;
5787 END IF;
5788 CLOSE csr_get_eit_effective_date;
5789 ELSIF l_detail_tab(i).effective_date >= to_date('01-01-'||to_char(p_start_date,'YYYY'),'dd-mm-yyyy') THEN
5790 l_index := l_index + 1;
5791 p_detail_tab(l_index).dated_table_id := l_detail_tab(i).dated_table_id;
5792 p_detail_tab(l_index).datetracked_event := l_detail_tab(i).datetracked_event;
5793 p_detail_tab(l_index).surrogate_key := l_detail_tab(i).surrogate_key;
5794 p_detail_tab(l_index).update_type := l_detail_tab(i).update_type;
5795 p_detail_tab(l_index).column_name := l_detail_tab(i).column_name;
5796 p_detail_tab(l_index).effective_date := GREATEST(l_detail_tab(i).effective_date,p_ass_start_date);
5797 p_detail_tab(l_index).old_value := l_detail_tab(i).old_value;
5798 p_detail_tab(l_index).new_value := l_detail_tab(i).new_value;
5799 p_detail_tab(l_index).change_values := l_detail_tab(i).change_values;
5800 p_detail_tab(l_index).proration_type := l_detail_tab(i).proration_type;
5801 p_detail_tab(l_index).change_mode := l_detail_tab(i).change_mode;
5802 IF (l_detail_tab(i).dated_table_id = l_table1 OR l_detail_tab(i).dated_table_id = l_table2) THEN
5803 p_detail_tab(l_index).element_entry_id:= l_detail_tab(i).element_entry_id;
5804 END IF;
5805 END IF;
5806 END IF;
5807 END LOOP;
5808 END IF;
5809 l_cnt := l_cnt + 1;
5810 END LOOP;
5811 IF l_cnt = 1 THEN
5812 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Calling interpretor for assignment : '||p_assignment_id);
5813 BEGIN
5814 pay_interpreter_pkg.entry_affected(
5815 p_element_entry_id => NULL
5816 ,p_assignment_action_id => NULL
5817 ,p_assignment_id => p_assignment_id
5818 ,p_mode => 'REPORTS'
5819 ,p_process => 'P'
5820 ,p_event_group_id => p_event_group_id
5821 ,p_process_mode => 'ENTRY_CREATION_DATE' --ENTRY_CREATION_DATE
5822 ,p_start_date => p_start_date
5823 ,p_end_date => p_end_date
5824 ,t_detailed_output => l_detail_tab
5825 ,t_proration_dates => l_proration_dates
5826 ,t_proration_change_type => l_proration_changes
5827 ,t_proration_type => l_pro_type_tab );
5828 EXCEPTION
5829 WHEN NO_DATA_FOUND THEN
5830 l_detail_tab.delete;
5831 --##--Fnd_file.put_line(FND_FILE.LOG,'####### in Exception NO_DATA_FOUND ');
5832 WHEN OTHERS THEN
5833 l_detail_tab.delete;
5834 --##--Fnd_file.put_line(FND_FILE.LOG,'####### in Exception OTHERS ');
5835 END;
5836 --##--Fnd_file.put_line(FND_FILE.LOG,'####### No of records fetched : '||l_detail_tab.count);
5837 --
5838 l_index := p_detail_tab.count;
5839 IF l_detail_tab.count <> 0 THEN
5840 FOR i IN l_detail_tab.first..l_detail_tab.last LOOP
5841 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Table : '||l_detail_tab(i).dated_table_id);
5842 --##--Fnd_file.put_line(FND_FILE.LOG,'####### column : '||l_detail_tab(i).column_name);
5843 IF l_detail_tab(i).effective_date <= p_end_date THEN
5844 IF l_detail_tab(i).column_name LIKE 'AEI_INFORMATION%'
5845 OR l_detail_tab(i).dated_table_id = l_table3 THEN
5846 --Fnd_file.put_line(FND_FILE.LOG,'~~~~~ get_assignment_changes 14');
5847 OPEN csr_get_eit_effective_date(l_detail_tab(i).surrogate_key);
5848 FETCH csr_get_eit_effective_date INTO l_eff_date;
5849 IF csr_get_eit_effective_date%FOUND THEN
5850 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Element entry effective date : '||l_eff_date);
5851 IF l_eff_date <= p_end_date AND l_eff_date >= to_date('01-01-'||to_char(p_start_date,'YYYY'),'dd-mm-yyyy') THEN
5852 l_index := l_index + 1;
5853 p_detail_tab(l_index).dated_table_id := l_detail_tab(i).dated_table_id;
5854 p_detail_tab(l_index).datetracked_event := l_detail_tab(i).datetracked_event;
5855 p_detail_tab(l_index).surrogate_key := l_detail_tab(i).surrogate_key;
5856 p_detail_tab(l_index).update_type := l_detail_tab(i).update_type;
5857 p_detail_tab(l_index).column_name := l_detail_tab(i).column_name;
5858 p_detail_tab(l_index).effective_date := GREATEST(l_eff_date,p_ass_start_date);
5859 p_detail_tab(l_index).old_value := l_detail_tab(i).old_value;
5860 p_detail_tab(l_index).new_value := l_detail_tab(i).new_value;
5861 p_detail_tab(l_index).change_values := l_detail_tab(i).change_values;
5862 p_detail_tab(l_index).proration_type := l_detail_tab(i).proration_type;
5863 p_detail_tab(l_index).change_mode := l_detail_tab(i).change_mode;
5864 END IF;
5865 END IF;
5866 CLOSE csr_get_eit_effective_date;
5867 ELSIF l_detail_tab(i).effective_date >= to_date('01-01-'||to_char(p_start_date,'YYYY'),'dd-mm-yyyy') THEN
5868 l_index := l_index + 1;
5869 p_detail_tab(l_index).dated_table_id := l_detail_tab(i).dated_table_id;
5870 p_detail_tab(l_index).datetracked_event := l_detail_tab(i).datetracked_event;
5871 p_detail_tab(l_index).surrogate_key := l_detail_tab(i).surrogate_key;
5872 p_detail_tab(l_index).update_type := l_detail_tab(i).update_type;
5873 p_detail_tab(l_index).column_name := l_detail_tab(i).column_name;
5874 p_detail_tab(l_index).effective_date := GREATEST(l_detail_tab(i).effective_date,p_ass_start_date);
5875 p_detail_tab(l_index).old_value := l_detail_tab(i).old_value;
5876 p_detail_tab(l_index).new_value := l_detail_tab(i).new_value;
5877 p_detail_tab(l_index).change_values := l_detail_tab(i).change_values;
5878 p_detail_tab(l_index).proration_type := l_detail_tab(i).proration_type;
5879 p_detail_tab(l_index).change_mode := l_detail_tab(i).change_mode;
5880 END IF;
5881 END IF;
5882 END LOOP;
5883 END IF;
5884 END IF;
5885 EXCEPTION
5886 WHEN OTHERS THEN
5887 --Fnd_file.put_line(FND_FILE.LOG,' in Exception get_assignment_changes');
5888 NULL;
5889 END get_assignment_changes;
5890 --
5891 --------------------------------------------------------------------------------
5892 -- GET_ASSIGNMENT_CHANGES
5893 --------------------------------------------------------------------------------
5894 PROCEDURE remove_withdrawal_period_chg(p_rec_changes_init IN Rec_Changes
5895 ,p_rec_changes IN OUT NOCOPY Rec_Changes) IS
5896 l_period_start_date DATE;
5897 l_cnt NUMBER;
5898 BEGIN
5899 p_rec_changes.delete;
5900 l_period_start_date := TO_DATE('01-01-0001','dd-mm-yyyy');
5901 l_cnt := 1;
5902 FOR i IN p_rec_changes_init.first..p_rec_changes_init.last LOOP
5903 --Fnd_file.put_line(FND_FILE.LOG,' '||p_rec_changes_init(i).effective_date||' update type'||p_rec_changes_init(i).update_type||' retro'|| p_rec_changes_init(i).retro||' period start '||p_rec_changes_init(i).period_start_date);
5904 IF p_rec_changes_init(i).effective_date >= to_date('01-01-2006','dd-mm-yyyy') THEN
5905 IF p_rec_changes_init(i).period_start_date <> l_period_start_date THEN
5906 -- OR p_rec_changes_init(i).retro = 'WITHDRAWAL' THEN
5907 p_rec_changes(l_cnt).dated_table_id := p_rec_changes_init(i).dated_table_id;
5908 p_rec_changes(l_cnt).datetracked_event := p_rec_changes_init(i).datetracked_event;
5909 p_rec_changes(l_cnt).surrogate_key := p_rec_changes_init(i).surrogate_key;
5910 p_rec_changes(l_cnt).update_type := p_rec_changes_init(i).update_type;
5911 p_rec_changes(l_cnt).column_name := p_rec_changes_init(i).column_name;
5912 p_rec_changes(l_cnt).effective_date := p_rec_changes_init(i).effective_date;
5913 p_rec_changes(l_cnt).old_value := p_rec_changes_init(i).old_value;
5914 p_rec_changes(l_cnt).new_value := p_rec_changes_init(i).new_value;
5915 p_rec_changes(l_cnt).change_values := p_rec_changes_init(i).change_values;
5916 p_rec_changes(l_cnt).proration_type := p_rec_changes_init(i).proration_type;
5917 p_rec_changes(l_cnt).change_mode := p_rec_changes_init(i).change_mode;
5918 p_rec_changes(l_cnt).period_start_date := p_rec_changes_init(i).period_start_date;
5919 p_rec_changes(l_cnt).period_end_date := p_rec_changes_init(i).period_end_date;
5920 p_rec_changes(l_cnt).retro := p_rec_changes_init(i).retro;
5921 l_cnt := l_cnt + 1;
5922 IF p_rec_changes_init(i).retro = 'WITHDRAWAL' THEN
5923 l_period_start_date := p_rec_changes_init(i).period_start_date;
5924 END IF;
5925 END IF;
5926 END IF;
5927 END LOOP;
5928 END remove_withdrawal_period_chg;
5929 --------------------------------------------------------------------------------
5930 -- CHK_EVENTS
5931 --------------------------------------------------------------------------------
5932 PROCEDURE chk_events(p_assactid NUMBER
5933 ,p_assignment_id NUMBER
5934 ,p_effective_date DATE
5935 ,p_business_gr_id NUMBER
5936 ,l_tax_unit_id NUMBER
5937 ,p_chk_start_date DATE
5938 ,p_chk_end_date DATE
5939 ,p_payroll_type VARCHAR2) IS
5940 --
5941 --
5942 CURSOR csr_get_emp_data(c_assignment_id NUMBER
5943 ,c_effective_date DATE) IS
5944 SELECT pap.person_id
5945 ,pap.national_identifier sofi_number
5946 ,pap.employee_number
5947 ,pap.nationality
5948 ,pap.date_of_birth dob
5949 ,pap.pre_name_adjunct prefix
5950 ,pap.last_name
5951 ,UPPER(replace(replace(pap.per_information1,'.',''),' ','')) initials
5952 ,decode(pap.sex,'M',1,'F',2,NULL) gender
5953 ,paaf.assignment_id
5954 ,paaf.change_reason
5955 ,paaf.assignment_number
5956 ,paaf.assignment_sequence
5957 ,paaf.employment_category
5958 ,paaf.employee_category
5959 ,paaf.collective_agreement_id
5960 ,paaf.effective_start_date
5961 ,paaf.soft_coding_keyflex_id
5962 ,paaf.assignment_status_type_id
5963 ,paaf.payroll_id
5964 ,paaf.primary_flag
5965 FROM per_all_assignments_f paaf
5966 ,per_all_people_f pap
5967 WHERE paaf.assignment_id = c_assignment_id
5968 AND paaf.person_id = pap.person_id
5969 AND c_effective_date BETWEEN paaf.effective_start_date
5970 AND paaf.effective_end_date
5971 AND c_effective_date BETWEEN pap.effective_start_date
5972 AND pap.effective_end_date;
5973 --
5974 /*CURSOR csr_emp_termination_date(c_assignment_id NUMBER) IS
5975 SELECT pps.date_start emp_start_date
5976 ,pps.actual_termination_date emp_termination_date
5977 ,paaf.primary_flag
5978 FROM per_all_assignments_f paaf
5979 ,per_periods_of_service pps
5980 WHERE paaf.assignment_id = c_assignment_id
5981 AND pps.person_id = paaf.person_id
5982 AND pps.period_of_service_id = paaf.period_of_service_id;*/
5983 --
5984 CURSOR csr_get_cao_code(c_collective_agreement_id NUMBER) IS
5985 SELECT pca.cag_information1
5986 FROM per_collective_agreements pca
5987 WHERE pca.collective_agreement_id = c_collective_agreement_id
5988 AND pca.cag_information_category= 'NL';
5989 --
5990 CURSOR csr_chk_emp_reported(c_assignment_id NUMBER) IS
5991 SELECT 'Y'
5992 FROM DUAL
5993 WHERE EXISTS(SELECT /*+ ORDERED */ 1
5994 FROM pay_assignment_actions paa
5995 ,pay_payroll_actions ppa
5996 ,pay_action_interlocks pai
5997 ,pay_assignment_actions pal
5998 ,pay_payroll_actions ppl
5999 WHERE paa.assignment_id = c_assignment_id
6000 AND paa.payroll_action_id = ppa.payroll_action_id
6001 AND ppa.report_type = 'NL_WAGES_REP_ARCHIVE'
6002 AND ppa.report_qualifier = 'NL'
6003 AND ppa.report_category = 'ARCHIVE'
6004 AND ppa.action_status ='C'
6005 AND paa.assignment_action_id = pai.locked_action_id
6006 AND pai.locking_action_id = pal.assignment_action_id
6007 AND pal.payroll_action_id = ppl.payroll_action_id
6008 AND ppl.report_type = 'NL_WAGES_REP_LOCK'
6009 AND ppl.report_qualifier = 'NL'
6010 AND ppl.report_category = 'ARCHIVE'
6011 AND ppl.action_status ='C');
6012 --
6013 --
6014 CURSOR csr_get_element_details(c_ass_act_id NUMBER
6015 ,c_effective_date DATE) IS
6016 SELECT prr.rowid row_id
6017 ,prr.element_entry_id
6018 ,min(decode(piv.name, 'Report Type', rrv.RESULT_VALUE, null)) Retro_type
6019 ,min(decode(piv.name, 'Period', rrv.RESULT_VALUE, null)) Period
6020 FROM pay_run_results prr
6021 ,pay_run_result_values rrv
6022 ,pay_input_values_f piv
6023 ,pay_element_types_f pet
6024 WHERE prr.run_result_id = rrv.run_result_id
6025 AND rrv.input_value_id + 0 = piv.input_value_id
6026 AND piv.element_type_id = pet.element_type_id
6027 AND prr.element_type_id = pet.element_type_id
6028 AND prr.assignment_action_id = c_ass_act_id
6029 AND pet.element_name = 'New Wage Report Override'
6030 AND pet.legislation_code = 'NL'
6031 AND c_effective_date BETWEEN piv.effective_start_date AND piv.effective_end_date
6032 AND c_effective_date BETWEEN pet.effective_start_date AND pet.effective_end_date
6033 GROUP BY prr.rowid
6034 ,prr.element_entry_id
6035 ORDER BY 4,3 DESC;
6036 --
6037 CURSOR csr_get_retro_periods(c_assignment_action_id NUMBER
6038 ,c_date DATE) IS
6039 SELECT DISTINCT ptp.start_date start_date
6040 ,ptp.end_date end_date
6041 FROM pay_run_results prr
6042 ,pay_element_entries_f pee
6043 ,pay_assignment_actions paa
6044 ,pay_payroll_actions ppa
6045 ,per_time_periods ptp
6046 WHERE prr.assignment_action_id = paa.assignment_action_id
6047 AND prr.element_type_id = pee.element_type_id
6048 AND pee.creator_type IN ('RR','EE')
6049 AND pee.assignment_id = paa.assignment_id
6050 AND paa.assignment_action_id = c_assignment_action_id
6051 AND prr.start_date > c_date
6052 AND paa.payroll_action_id = ppa.payroll_action_id
6053 AND ptp.payroll_id = ppa.payroll_id
6054 AND prr.start_date BETWEEN ptp.start_date and ptp.end_date
6055 ORDER by 1;
6056 --
6057 /*CURSOR csr_get_corr_retro_periods(c_assignment_action_id NUMBER
6058 ,c_assignment_id NUMBER
6059 ,c_effective_date DATE) IS
6060 SELECT rr1.start_date , rc.short_name,rr1.element_entry_id
6061 ,rr1.end_date
6062 FROM pay_run_results rr1 -- Retro element
6063 ,pay_run_results rr2 -- Normal Element
6064 ,pay_element_span_usages esu
6065 ,pay_retro_component_usages rcu
6066 ,pay_retro_components rc
6067 ,pay_element_entries_f pee1
6068 ,pay_element_entries_f pee2
6069 ,pay_retro_assignments pra
6070 ,pay_retro_entries pre
6071 WHERE rr1.assignment_action_id = c_assignment_action_id
6072 AND rr2.assignment_action_id = rr1.assignment_action_id
6073 AND rr1.element_type_id = esu.retro_element_type_id
6074 AND esu.retro_component_usage_id = rcu.retro_component_usage_id
6075 AND rcu.creator_id = rr2.element_type_id
6076 AND rcu.creator_type = 'ET' -- check
6077 AND rr1.element_entry_id = pee1.element_entry_id
6078 AND pee1.creator_type = 'RR'
6079 AND pee1.creator_id = pra.retro_assignment_action_id
6080 AND pra.assignment_id = c_assignment_id
6081 -- AND pra.assignment_id = pee1.assignment_id
6082 AND pra.retro_assignment_id = pre.retro_assignment_id
6083 AND rr2.element_entry_id = pee2.element_entry_id
6084 AND pee2.element_entry_id = pre.element_entry_id
6085 AND pre.retro_component_id = rc.retro_component_id
6086 AND rc.legislation_code = 'NL'
6087 AND rc.short_name = 'Standard'
6088 AND c_effective_date between pee1.effective_start_date and pee1.effective_end_date
6089 AND c_effective_date between pee2.effective_start_date and pee2.effective_end_date;*/
6090 --
6091 CURSOR csr_get_corr_retro_periods(c_assignment_action_id NUMBER
6092 ,c_effective_date DATE) IS
6093 SELECT DISTINCT ptp.start_date
6094 ,ptp.end_date
6095 FROM pay_run_results rr1 -- Retro element
6096 ,pay_element_span_usages esu
6097 ,pay_retro_component_usages rcu
6098 ,pay_retro_components rc
6099 ,pay_element_entries_f pee1
6100 ,pay_assignment_actions paa
6101 ,pay_payroll_actions ppa
6102 ,per_time_periods ptp
6103 WHERE paa.assignment_action_id = c_assignment_action_id
6104 AND rr1.assignment_action_id = paa.assignment_action_id
6105 AND rr1.element_entry_id = pee1.element_entry_id
6106 AND pee1.creator_type = 'RR'
6107 AND rr1.element_type_id = esu.retro_element_type_id
6108 AND esu.retro_component_usage_id = rcu.retro_component_usage_id
6109 AND rcu.creator_type = 'ET' -- check
6110 AND rcu.retro_component_id = rc.retro_component_id
6111 AND rc.legislation_code = 'NL'
6112 AND rc.short_name = 'Standard'
6113 AND c_effective_date between pee1.effective_start_date and pee1.effective_end_date
6114 AND paa.payroll_action_id = ppa.payroll_action_id
6115 AND ptp.payroll_id = ppa.payroll_id
6116 AND rr1.start_date BETWEEN ptp.start_date and ptp.end_date
6117 ORDER BY 1;
6118
6119 /*SELECT rr.start_date
6120 ,rr.end_date
6121 FROM pay_run_results rr
6122 ,pay_element_span_usages esu
6123 ,pay_retro_component_usages rcu
6124 ,pay_retro_components rc
6125 WHERE rr.assignment_action_id = c_assignment_action_id
6126 AND rr.element_type_id = esu.retro_element_type_id
6127 AND esu.retro_component_usage_id = rcu.retro_component_usage_id
6128 AND rcu.retro_component_id = rc.retro_component_id
6129 AND rc.legislation_code = 'NL'
6130 AND rc.short_name = 'Standard';*/
6131 --
6132 CURSOR csr_get_assignment_action_id(c_assignment_id NUMBER
6133 ,c_date DATE) IS
6134 SELECT max(paa.assignment_action_id) assignment_action_id
6135 FROM pay_assignment_actions paa
6136 ,pay_payroll_actions ppa
6137 ,per_time_periods ptp
6138 WHERE paa.assignment_id = c_assignment_id
6139 AND ppa.payroll_action_id = paa.payroll_action_id
6140 AND ppa.action_type IN ('R','Q')
6141 AND paa.ACTION_STATUS = 'C'
6142 AND ppa.ACTION_STATUS = 'C'
6143 --AND ppa.date_earned between c_start_date AND c_end_date;
6144 AND ppa.time_period_id = ptp.time_period_id
6145 AND c_date BETWEEN ptp.start_date AND ptp.end_date;
6146 --
6147 CURSOR csr_get_assignment_action_id2(c_assignment_id NUMBER
6148 ,c_date DATE) IS
6149 SELECT max(paa.assignment_action_id) assignment_action_id
6150 FROM pay_assignment_actions paa
6151 ,pay_payroll_actions ppa
6152 ,per_time_periods ptp
6153 WHERE paa.assignment_id = c_assignment_id
6154 AND ppa.payroll_action_id = paa.payroll_action_id
6155 AND ppa.action_type IN ('R','Q','I','B')
6156 AND paa.ACTION_STATUS = 'C'
6157 AND ppa.ACTION_STATUS = 'C'
6158 -- AND ppa.date_earned between c_start_date AND c_end_date;
6159 AND ppa.time_period_id = ptp.time_period_id
6160 AND c_date BETWEEN ptp.start_date AND ptp.end_date;
6161 --
6162 CURSOR csr_get_shared_types(c_code VARCHAR2
6163 ,c_business_gr_id NUMBER
6164 ,c_lookup VARCHAR2) IS
6165 SELECT business_group_id,system_type_cd
6166 FROM per_shared_types
6167 WHERE lookup_type = c_lookup --'NL_NATIONALITY'
6168 AND information1 = c_code
6169 AND (business_group_id = c_business_gr_id
6170 OR business_group_id is NULL)
6171 ORDER BY 1;
6172 --
6173 CURSOR csr_get_period(c_payroll_id NUMBER,c_date DATE) IS
6174 SELECT ptp.start_date,ptp.end_date
6175 FROM per_time_periods ptp
6176 WHERE ptp.payroll_id = c_payroll_id
6177 AND c_date between ptp.start_date and ptp.end_date;
6178 --
6179 CURSOR csr_get_table_id(c_table_name VARCHAR2) IS
6180 SELECT dated_table_id
6181 FROM pay_dated_tables
6182 WHERE TABLE_NAME = c_table_name; -- in ('PAY_ELEMENT_ENTRY_VALUES_F','PAY_ELEMENT_ENTRIES_F');
6183 --
6184 CURSOR csr_get_element_det(c_element_name VARCHAR2
6185 ,c_input_val_name VARCHAR2
6186 ,c_assignment_id NUMBER
6187 ,c_eff_date DATE) IS
6188 SELECT peev.screen_entry_value
6189 FROM pay_element_types_f pet
6190 ,pay_input_values_f piv
6191 ,pay_element_entries_f peef
6192 ,pay_element_entry_values_f peev
6193 WHERE pet.element_name = c_element_name
6194 AND pet.element_type_id = piv.element_type_id
6195 AND piv.name = c_input_val_name
6196 AND pet.legislation_code = 'NL'
6197 AND piv.legislation_code = 'NL'
6198 AND peef.assignment_id = c_assignment_id
6199 AND peef.element_entry_id = peev.element_entry_id
6200 AND peef.element_type_id = pet.element_type_id
6201 AND peev.input_value_id = piv.input_value_id
6202 AND c_eff_date BETWEEN piv.effective_start_date
6203 AND piv.effective_end_date
6204 AND c_eff_date BETWEEN pet.effective_start_date
6205 AND pet.effective_end_date
6206 AND c_eff_date BETWEEN peev.effective_start_date
6207 AND peev.effective_end_date
6208 AND c_eff_date BETWEEN peef.effective_start_date
6209 AND peef.effective_end_date;
6210 --
6211 CURSOR csr_get_element_name2(c_element_entry_value_id NUMBER
6212 ,c_eff_date DATE) IS
6213 SELECT pet.element_name
6214 ,peev.screen_entry_value
6215 FROM pay_element_types_f pet
6216 ,pay_element_entries_f peef
6217 ,pay_element_entry_values_f peev
6218 WHERE peev.element_entry_value_id = c_element_entry_value_id
6219 AND peev.element_entry_id = peef.element_entry_id
6220 AND peef.element_type_id = pet.element_type_id
6221 AND pet.legislation_code = 'NL'
6222 AND c_eff_date BETWEEN pet.effective_start_date
6223 AND pet.effective_end_date
6224 AND c_eff_date BETWEEN peev.effective_start_date
6225 AND peev.effective_end_date
6226 AND c_eff_date BETWEEN peef.effective_start_date
6227 AND peef.effective_end_date;
6228 --
6229 CURSOR csr_get_element_name1(c_element_entry_id NUMBER
6230 ,c_eff_date DATE) IS
6231 SELECT pet.element_name
6232 ,peev.screen_entry_value
6233 FROM pay_element_types_f pet
6234 ,pay_element_entries_f peef
6235 ,pay_element_entry_values_f peev
6236 WHERE peef.element_entry_id = c_element_entry_id
6237 AND peev.element_entry_id = peef.element_entry_id
6238 AND peef.element_type_id = pet.element_type_id
6239 AND pet.legislation_code = 'NL'
6240 AND c_eff_date BETWEEN pet.effective_start_date
6241 AND pet.effective_end_date
6242 AND c_eff_date BETWEEN peev.effective_start_date
6243 AND peev.effective_end_date
6244 AND c_eff_date BETWEEN peef.effective_start_date
6245 AND peef.effective_end_date; /*assuming one input value*/
6246 --
6247 CURSOR csr_get_eit_cao(c_assignment_id NUMBER) IS
6248 SELECT aei_information5
6249 FROM per_assignment_extra_info
6250 WHERE assignment_id = c_assignment_id
6251 AND aei_information_category IN ('NL_CADANS_INFO');
6252 --
6253 CURSOR csr_ass_start_date(c_assignment_id NUMBER) IS
6254 SELECT min(effective_start_date)
6255 --,decode(max(effective_end_date),to_date('31-12-4712','dd-mm-yyyy'),null,max(effective_end_date))
6256 FROM per_all_assignments_F paaf
6257 ,PER_ASSIGNMENT_STATUS_TYPES ast
6258 WHERE paaf.assignment_id = c_assignment_id
6259 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
6260 AND ast.per_system_status = 'ACTIVE_ASSIGN';
6261 --
6262 CURSOR csr_ass_end_date(c_assignment_id NUMBER) IS
6263 SELECT decode(max(effective_end_date),to_date('31-12-4712','dd-mm-yyyy'),null,max(effective_end_date))
6264 FROM per_all_assignments_F paaf
6265 ,PER_ASSIGNMENT_STATUS_TYPES ast
6266 WHERE paaf.assignment_id = c_assignment_id
6267 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
6268 AND ast.per_system_status <> 'TERM_ASSIGN';
6269 --
6270 CURSOR csr_ass_end_date2(c_assignment_id NUMBER) IS
6271 SELECT min(effective_start_date)
6272 FROM per_all_assignments_F paaf
6273 ,PER_ASSIGNMENT_STATUS_TYPES ast
6274 WHERE paaf.assignment_id = c_assignment_id
6275 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
6276 AND ast.per_system_status = 'TERM_ASSIGN';
6277 --
6278 --soft_coding_keyflex_id
6279 l_nationality per_shared_types.INFORMATION1%type;
6280 l_assignment_catg per_shared_types.INFORMATION1%type;
6281 l_assignment_catg_old per_shared_types.INFORMATION1%type;
6282 l_emp_rec csr_get_emp_data%rowtype;
6283 l_rec_changes Rec_Changes;
6284 l_rec_changes_init Rec_Changes;
6285 l_master_action_info_id pay_action_information.action_information_id%type;
6286 l_action_info_id pay_action_information.action_information_id%TYPE;
6287 l_period_start_date DATE;
6288 l_period_end_date DATE;
6289 l_rec_start_date DATE;
6290 l_emp_end_date DATE;
6291 -- SCL Segment variables
6292 l_income_code hr_soft_coding_keyflex.segment1%type;
6293 l_work_pattern hr_soft_coding_keyflex.segment1%type;
6294 l_wage_tax_discount hr_soft_coding_keyflex.segment1%type;
6295 l_wage_tax_table hr_soft_coding_keyflex.segment1%type;
6296 l_wage_aow hr_soft_coding_keyflex.segment1%type;
6297 l_wage_wajong hr_soft_coding_keyflex.segment1%type;
6298 l_emp_loan hr_soft_coding_keyflex.segment1%type;
6299 l_transportation hr_soft_coding_keyflex.segment1%type;
6300 --
6301 l_labour_rel_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
6302 l_ins_duty_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
6303 l_FZ_Code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
6304 l_handicapped_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
6305 l_wao_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
6306 l_ww_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
6307 l_zw_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
6308 l_zvw_situation PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
6309 l_zvw_defaulted VARCHAR2(1);
6310 --
6311 l_detail_tab pay_interpreter_pkg.t_detailed_output_table_type;
6312 l_event_group_id pay_event_groups.event_group_id%TYPE;
6313 l_assignment_id NUMBER;
6314 l_event_group_name VARCHAR2(50) := 'NL_WAGES_REPORT_EVG';
6315 l_chk VARCHAR2(2);
6316 l_chg_pending VARCHAR2(2);
6317 --l_chk_primary VARCHAR2(2);
6318 l_chk_emp_reported VARCHAR2(1);
6319 l_archive_emp_info VARCHAR2(1);
6320 p_date DATE;
6321 l_retro VARCHAR2(10);
6322 l_type VARCHAR2(10);
6323 l_ovn pay_action_information.object_version_number%type;
6324 l_cao_code per_collective_agreements.CAG_INFORMATION1%type;
6325 l_old_cao_code per_collective_agreements.CAG_INFORMATION1%type;
6326 l_bal_value Bal_Value;
6327 l_nom_bal_value Bal_Value;
6328 l_ret_table Ret_Table;
6329 l_assignment_action_id NUMBER;
6330 l_master_assignment_action_id NUMBER;
6331 l_retro_type VARCHAR2(10);
6332 l_retro_done VARCHAR2(10);
6333 ele_end_date DATE;
6334 l_surrogate_key NUMBER;
6335 l_bg NUMBER;
6336 l_table1 pay_dated_tables.dated_table_id%type;
6337 l_table2 pay_dated_tables.dated_table_id%type;
6338 l_table3 pay_dated_tables.dated_table_id%type;
6339 l_ass_start_date DATE;
6340 l_ass_end_date DATE;
6341 --
6342 l_holiday_coupen pay_element_entry_values_f.screen_entry_value%TYPE;
6343 l_income_increase pay_element_entry_values_f.screen_entry_value%TYPE;
6344 l_add_allowance pay_element_entry_values_f.screen_entry_value%TYPE;
6345 l_company_car_use pay_element_entry_values_f.screen_entry_value%TYPE;
6346 l_val pay_element_entry_values_f.screen_entry_value%TYPE;
6347 l_element_name VARCHAR2(30);
6348 --
6349 l_cnt1 NUMBER;
6350 l_cnt2 NUMBER;
6351 l_cnt3 NUMBER;
6352 r_index NUMBER;
6353 --
6354 l_srg_flag VARCHAR2(1);
6355 l_corr_used VARCHAR2(1);
6356 --
6357 CURSOR get_scl_id(c_assignment_id NUMBER
6358 ,c_start_date DATE) IS
6359 SELECT paaf.soft_coding_keyflex_id
6360 FROM per_all_assignments_f paaf
6361 WHERE assignment_id = c_assignment_id
6362 AND c_start_date BETWEEN paaf.effective_start_date
6363 AND paaf.effective_end_date;
6364 --
6365 CURSOR csr_get_col_agreement_id (c_assignment_id NUMBER
6366 ,c_eff_date DATE) IS
6367 SELECT collective_agreement_id
6368 FROM per_All_assignments_F
6369 WHERE assignment_id = c_assignment_id
6370 AND c_eff_date BETWEEN effective_start_date AND effective_end_date;
6371 --
6372 l_scl_id per_all_assignments_f.soft_coding_keyflex_id%TYPE;
6373 --
6374 l_initial_flag VARCHAR2(1);
6375 l_emp_seq per_all_Assignments_f.assignment_number%type;
6376 --
6377 BEGIN
6378 --Fnd_file.put_line(FND_FILE.LOG,' Start chk_events');
6379 --Fnd_file.put_line(FND_FILE.LOG,' Assignment ID :'||p_assignment_id);
6380 l_assignment_id := p_assignment_id;
6381 -- Correction Record Starts
6382 l_event_group_id := pqp_utilities.get_event_group_id(p_business_group_id => p_business_gr_id
6383 ,p_event_group_name => l_event_group_name);
6384 -- Fetch assignment start date and end date
6385 --OPEN csr_emp_termination_date(l_assignment_id);
6386 --FETCH csr_emp_termination_date INTO l_ass_start_date,l_ass_end_date,l_chk_primary;
6387 --CLOSE csr_emp_termination_date;
6388 --IF NVL(l_chk_primary,'N') <> 'Y' THEN
6389 OPEN csr_ass_start_date(l_assignment_id);
6390 FETCH csr_ass_start_date INTO l_ass_start_date;
6391 CLOSE csr_ass_start_date;
6392 --
6393 OPEN csr_ass_end_date(l_assignment_id);
6394 FETCH csr_ass_end_date INTO l_ass_end_date;
6395 CLOSE csr_ass_end_date;
6396 --
6397 /*IF l_ass_start_date IS NULL AND l_ass_end_date IS NULL THEN -- Bug - 5868094
6398 OPEN csr_ass_end_date2(l_assignment_id);
6399 FETCH csr_ass_end_date2 INTO l_ass_end_date;
6400 CLOSE csr_ass_end_date2;
6401 l_ass_start_date := l_ass_end_date;
6402 END IF;*/
6403 --
6404 --END IF;
6405 --Invoke the date track interpreter only for Monthly Payroll
6406 IF p_payroll_type = 'MONTH' OR p_payroll_type = 'LMONTH' THEN
6407 --Fnd_file.put_line(FND_FILE.LOG,' Call Interpretor '||l_assignment_id);
6408 get_assignment_changes(l_assignment_id
6409 ,p_chk_start_date
6410 ,p_chk_end_date
6411 ,l_ass_start_date
6412 ,l_event_group_id
6413 ,l_detail_tab);
6414 --Fnd_file.put_line(FND_FILE.LOG,' Total Change Records :'||l_detail_tab.COUNT);
6415 --Fnd_file.put_line(FND_FILE.LOG,' Change Records for Assignment : '||l_assignment_id);
6416 sort_changes(l_detail_tab);
6417 --
6418 OPEN csr_get_table_id('PAY_ELEMENT_ENTRIES_F');
6419 FETCH csr_get_table_id INTO l_table1;
6420 CLOSE csr_get_table_id;
6421 --
6422 OPEN csr_get_table_id('PAY_ELEMENT_ENTRY_VALUES_F');
6423 FETCH csr_get_table_id INTO l_table2;
6424 CLOSE csr_get_table_id;
6425 --
6426 OPEN csr_get_table_id('PER_ASSIGNMENT_EXTRA_INFO');
6427 FETCH csr_get_table_id INTO l_table3;
6428 CLOSE csr_get_table_id;
6429 --
6430 OPEN csr_get_emp_data(l_assignment_id,LEAST(p_chk_end_date,NVL(l_ass_end_date,p_chk_end_date)));
6431 FETCH csr_get_emp_data INTO l_emp_rec;
6432 CLOSE csr_get_emp_data;
6433 --
6434 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5') THEN
6435 l_emp_rec.change_reason := NULL;
6436 END IF;
6437 --
6438 l_period_start_date := to_date('01-01-0001','dd-mm-yyyy');
6439 l_period_end_date := to_date('01-01-0001','dd-mm-yyyy');
6440 l_rec_start_date := to_date('01-01-0001','dd-mm-yyyy');
6441 --
6442 r_index := 1;
6443 --
6444 l_master_assignment_action_id := NULL;
6445 l_assignment_action_id := NULL;
6446 OPEN csr_get_assignment_action_id(l_assignment_id,p_chk_start_date);
6447 FETCH csr_get_assignment_action_id INTO l_master_assignment_action_id;
6448 CLOSE csr_get_assignment_action_id;
6449 --
6450 --Fnd_file.put_line(FND_FILE.LOG,' Checking retro for Assignment_action_id :'||l_master_assignment_action_id);
6451 --
6452 l_retro_done := 'N';
6453 IF l_master_assignment_action_id IS NOT NULL THEN
6454 FOR l_element_rec in csr_get_element_details(l_master_assignment_action_id,p_chk_end_date) LOOP
6455 l_retro_type := 'HR';
6456 ele_end_date := fnd_date.canonical_to_date(l_element_rec.period);
6457 --
6458 IF l_element_rec.Retro_type = 'WITHDRAWAL' AND l_element_rec.period IS NOT NULL THEN
6459 OPEN csr_get_period(l_emp_rec.payroll_id, ele_end_date);
6460 FETCH csr_get_period INTO l_period_start_date,l_period_end_date;
6461 CLOSE csr_get_period;
6462 --Fnd_file.put_line(FND_FILE.LOG,' WITHDRAWAL For Period : '||l_period_start_date);
6463 IF l_rec_start_date < l_period_start_date THEN
6464 l_ret_table(r_index).start_date := l_period_start_date;
6465 l_ret_table(r_index).end_date := l_period_end_date;
6466 l_ret_table(r_index).retro_type := l_element_rec.retro_type;--l_retro_type;
6467 r_index := r_index + 1;
6468 l_rec_start_date := l_period_start_date;
6469 END IF;
6470 ELSIF l_element_rec.Retro_type = 'CORRECTION' AND g_retro_type = 'OLD' THEN
6471 IF l_retro_done = 'N' THEN
6472 FOR csr_retro_rec IN csr_get_retro_periods(l_master_assignment_action_id,l_rec_start_date) LOOP
6473 IF l_element_rec.period IS NULL THEN
6474 l_ret_table(r_index).start_date := csr_retro_rec.start_date;
6475 l_ret_table(r_index).end_date := csr_retro_rec.end_date;
6476 l_ret_table(r_index).retro_type := 'PAY';--l_retro_type;
6477 r_index := r_index + 1;
6478 l_rec_start_date := csr_retro_rec.start_date;
6479 l_retro_done := 'Y';
6480 ELSIF csr_retro_rec.end_date = ele_end_date THEN
6481 l_ret_table(r_index).start_date := csr_retro_rec.start_date;
6482 l_ret_table(r_index).end_date := csr_retro_rec.end_date;
6483 l_ret_table(r_index).retro_type := 'PAY';--l_retro_type;
6484 r_index := r_index + 1;
6485 l_rec_start_date := csr_retro_rec.start_date;
6486 END IF;
6487 END LOOP;
6488 END IF;
6489 END IF;
6490 END LOOP;
6491 END IF;
6492 --
6493 IF g_retro_type = 'NEW' THEN
6494 FOR csr_retro_rec in csr_get_corr_retro_periods(l_master_assignment_action_id,p_chk_end_date) LOOP
6495 l_ret_table(r_index).start_date := csr_retro_rec.start_date;
6496 l_ret_table(r_index).end_date := csr_retro_rec.end_date;
6497 l_ret_table(r_index).retro_type := 'PAY';--l_retro_type;
6498 r_index := r_index + 1;
6499 END LOOP;
6500 END IF;
6501 --
6502 --Fnd_file.put_line(FND_FILE.LOG,' Retro table count : '||l_ret_table.count);
6503 --Fnd_file.put_line(FND_FILE.LOG,' Hr table count : '||l_detail_tab.count);
6504 --
6505 l_cnt3 := 0;
6506 l_cnt1 := 1;
6507 l_cnt2 := 1;
6508 --
6509 l_period_start_date := to_date('01-01-0001','dd-mm-yyyy');
6510 l_period_end_date := to_date('01-01-0001','dd-mm-yyyy');
6511 --
6512 --Fnd_file.put_line(FND_FILE.LOG,' Merging retro and HR data table: ');
6513 LOOP
6514 EXIT WHEN l_detail_tab.count < l_cnt1 OR l_ret_table.count < l_cnt2;
6515 l_cnt3 := l_cnt3 + 1;
6516 IF l_detail_tab(l_cnt1).effective_date < l_ret_table(l_cnt2).start_date THEN
6517 IF l_detail_tab(l_cnt1).effective_date < l_period_start_date
6518 OR l_detail_tab(l_cnt1).effective_date > l_period_end_date THEN
6519 --
6520 --Fnd_file.put_line(FND_FILE.LOG,' Payroll : '||l_emp_rec.payroll_id);
6521 IF l_emp_rec.payroll_id IS NULL THEN
6522 EXIT;
6523 END IF;
6524 --
6525 OPEN csr_get_period(l_emp_rec.payroll_id, l_detail_tab(l_cnt1).effective_date);
6526 FETCH csr_get_period INTO l_period_start_date,l_period_end_date;
6527 CLOSE csr_get_period;
6528 --
6529 l_retro := 'HR';
6530 --
6531 END IF;
6532 --
6533 l_rec_changes_init(l_cnt3).dated_table_id := l_detail_tab(l_cnt1).dated_table_id;
6534 l_rec_changes_init(l_cnt3).datetracked_event := l_detail_tab(l_cnt1).datetracked_event;
6535 l_rec_changes_init(l_cnt3).surrogate_key := l_detail_tab(l_cnt1).surrogate_key;
6536 l_rec_changes_init(l_cnt3).update_type := l_detail_tab(l_cnt1).update_type;
6537 l_rec_changes_init(l_cnt3).column_name := l_detail_tab(l_cnt1).column_name;
6538 l_rec_changes_init(l_cnt3).effective_date := l_detail_tab(l_cnt1).effective_date;
6539 l_rec_changes_init(l_cnt3).old_value := l_detail_tab(l_cnt1).old_value;
6540 l_rec_changes_init(l_cnt3).new_value := l_detail_tab(l_cnt1).new_value;
6541 l_rec_changes_init(l_cnt3).change_values := l_detail_tab(l_cnt1).change_values;
6542 l_rec_changes_init(l_cnt3).proration_type := l_detail_tab(l_cnt1).proration_type;
6543 l_rec_changes_init(l_cnt3).change_mode := l_detail_tab(l_cnt1).change_mode;
6544 l_rec_changes_init(l_cnt3).period_start_date := l_period_start_date;
6545 l_rec_changes_init(l_cnt3).period_end_date := l_period_end_date;
6546 l_rec_changes_init(l_cnt3).retro := l_retro;
6547 --
6548 l_cnt1 := l_cnt1 + 1;
6549 --
6550 ELSIF l_detail_tab(l_cnt1).effective_date > l_ret_table(l_cnt2).end_date THEN
6551 l_rec_changes_init(l_cnt3).dated_table_id := NULL;
6552 l_rec_changes_init(l_cnt3).datetracked_event := NULL;
6553 l_rec_changes_init(l_cnt3).surrogate_key := NULL;
6554 l_rec_changes_init(l_cnt3).update_type := 'RETRO';
6555 l_rec_changes_init(l_cnt3).column_name := NULL;
6556 l_rec_changes_init(l_cnt3).effective_date := l_ret_table(l_cnt2).start_date;
6557 l_rec_changes_init(l_cnt3).old_value := NULL;
6558 l_rec_changes_init(l_cnt3).new_value := NULL;
6559 l_rec_changes_init(l_cnt3).change_values := NULL;
6560 l_rec_changes_init(l_cnt3).proration_type := NULL;
6561 l_rec_changes_init(l_cnt3).change_mode := NULL;
6562 l_rec_changes_init(l_cnt3).period_start_date := l_ret_table(l_cnt2).start_date;
6563 l_rec_changes_init(l_cnt3).period_end_date := l_ret_table(l_cnt2).end_date;
6564 l_rec_changes_init(l_cnt3).retro := l_ret_table(l_cnt2).retro_type;
6565 l_period_start_date := l_ret_table(l_cnt2).start_date;
6566 l_period_end_date := l_ret_table(l_cnt2).end_date;
6567 l_retro := l_ret_table(l_cnt2).retro_type;
6568 l_cnt2 := l_cnt2 + 1;
6569 ELSE
6570 l_rec_changes_init(l_cnt3).dated_table_id := l_detail_tab(l_cnt1).dated_table_id;
6571 l_rec_changes_init(l_cnt3).datetracked_event := l_detail_tab(l_cnt1).datetracked_event;
6572 l_rec_changes_init(l_cnt3).surrogate_key := l_detail_tab(l_cnt1).surrogate_key;
6573 l_rec_changes_init(l_cnt3).update_type := l_detail_tab(l_cnt1).update_type;
6574 l_rec_changes_init(l_cnt3).column_name := l_detail_tab(l_cnt1).column_name;
6575 l_rec_changes_init(l_cnt3).effective_date := l_detail_tab(l_cnt1).effective_date;
6576 l_rec_changes_init(l_cnt3).old_value := l_detail_tab(l_cnt1).old_value;
6577 l_rec_changes_init(l_cnt3).new_value := l_detail_tab(l_cnt1).new_value;
6578 l_rec_changes_init(l_cnt3).change_values := l_detail_tab(l_cnt1).change_values;
6579 l_rec_changes_init(l_cnt3).proration_type := l_detail_tab(l_cnt1).proration_type;
6580 l_rec_changes_init(l_cnt3).change_mode := l_detail_tab(l_cnt1).change_mode;
6581 l_rec_changes_init(l_cnt3).period_start_date := l_ret_table(l_cnt2).start_date;
6582 l_rec_changes_init(l_cnt3).period_end_date := l_ret_table(l_cnt2).end_date;
6583 l_rec_changes_init(l_cnt3).retro := l_ret_table(l_cnt2).retro_type;
6584 l_period_start_date := l_ret_table(l_cnt2).start_date;
6585 l_period_end_date := l_ret_table(l_cnt2).end_date;
6586 l_retro := l_ret_table(l_cnt2).retro_type;
6587 l_cnt1 := l_cnt1 + 1;
6588 l_cnt2 := l_cnt2 + 1;
6589 END IF;
6590 END LOOP;
6591 --
6592 LOOP EXIT WHEN l_detail_tab.count < l_cnt1 ;
6593 IF l_detail_tab(l_cnt1).effective_date < l_period_start_date
6594 OR l_detail_tab(l_cnt1).effective_date > l_period_end_date THEN
6595 -- chk if employee doesn't have a payroll
6596 --Fnd_file.put_line(FND_FILE.LOG,' Payroll : '||l_emp_rec.payroll_id);
6597 IF l_emp_rec.payroll_id IS NULL THEN
6598 EXIT;
6599 END IF;
6600 --
6601 OPEN csr_get_period(l_emp_rec.payroll_id, l_detail_tab(l_cnt1).effective_date);
6602 FETCH csr_get_period INTO l_period_start_date,l_period_end_date;
6603 CLOSE csr_get_period;
6604 --
6605 l_retro := 'HR';
6606 --
6607 END IF;
6608 --
6609 l_cnt3 := l_cnt3 + 1;
6610 l_rec_changes_init(l_cnt3).dated_table_id := l_detail_tab(l_cnt1).dated_table_id;
6611 l_rec_changes_init(l_cnt3).datetracked_event := l_detail_tab(l_cnt1).datetracked_event;
6612 l_rec_changes_init(l_cnt3).surrogate_key := l_detail_tab(l_cnt1).surrogate_key;
6613 l_rec_changes_init(l_cnt3).update_type := l_detail_tab(l_cnt1).update_type;
6614 l_rec_changes_init(l_cnt3).column_name := l_detail_tab(l_cnt1).column_name;
6615 l_rec_changes_init(l_cnt3).effective_date := l_detail_tab(l_cnt1).effective_date;
6616 l_rec_changes_init(l_cnt3).old_value := l_detail_tab(l_cnt1).old_value;
6617 l_rec_changes_init(l_cnt3).new_value := l_detail_tab(l_cnt1).new_value;
6618 l_rec_changes_init(l_cnt3).change_values := l_detail_tab(l_cnt1).change_values;
6619 l_rec_changes_init(l_cnt3).proration_type := l_detail_tab(l_cnt1).proration_type;
6620 l_rec_changes_init(l_cnt3).change_mode := l_detail_tab(l_cnt1).change_mode;
6621 l_rec_changes_init(l_cnt3).period_start_date := l_period_start_date;
6622 l_rec_changes_init(l_cnt3).period_end_date := l_period_end_date;
6623 l_rec_changes_init(l_cnt3).retro := l_retro;
6624 --
6625 l_cnt1 := l_cnt1 + 1;
6626 END LOOP;
6627 --
6628 LOOP EXIT WHEN l_ret_table.count < l_cnt2;
6629 --
6630 l_cnt3 := l_cnt3 + 1;
6631 l_rec_changes_init(l_cnt3).dated_table_id := NULL;
6632 l_rec_changes_init(l_cnt3).datetracked_event := NULL;
6633 l_rec_changes_init(l_cnt3).surrogate_key := NULL;
6634 l_rec_changes_init(l_cnt3).update_type := 'RETRO';
6635 l_rec_changes_init(l_cnt3).column_name := NULL;
6636 l_rec_changes_init(l_cnt3).effective_date := l_ret_table(l_cnt2).start_date;
6637 l_rec_changes_init(l_cnt3).old_value := NULL;
6638 l_rec_changes_init(l_cnt3).new_value := NULL;
6639 l_rec_changes_init(l_cnt3).change_values := NULL;
6640 l_rec_changes_init(l_cnt3).proration_type := NULL;
6641 l_rec_changes_init(l_cnt3).change_mode := NULL;
6642 l_rec_changes_init(l_cnt3).period_start_date := l_ret_table(l_cnt2).start_date;
6643 l_rec_changes_init(l_cnt3).period_end_date := l_ret_table(l_cnt2).end_date;
6644 l_rec_changes_init(l_cnt3).retro := l_ret_table(l_cnt2).retro_type;
6645 l_cnt2 := l_cnt2 + 1;
6646 --
6647 END LOOP;
6648 --Fnd_file.put_line(FND_FILE.LOG,' Total Records in Merged Table : '||l_rec_changes_init.count);
6649 --
6650 IF l_rec_changes_init.count <> 0 THEN
6651 remove_withdrawal_period_chg(l_rec_changes_init,l_rec_changes);
6652 END IF;
6653 --
6654 END IF; -- IF p_payroll_type = 'MONTH' OR 'LMONTH'
6655 --
6656 l_emp_end_date := NULL;
6657 IF l_ass_end_date <= p_chk_end_date THEN
6658 l_emp_end_date := l_ass_end_date;
6659 END IF;
6660 p_date := LEAST(p_chk_end_date,NVL(l_emp_end_date,p_chk_end_date));
6661 --l_start_date :=
6662 IF l_rec_changes.COUNT <> 0 THEN
6663 p_date := l_rec_changes(1).effective_date;
6664 END IF;
6665 --Fnd_file.put_line(FND_FILE.LOG,' Get employee Data on : '||p_date);
6666 OPEN csr_get_emp_data(l_assignment_id,p_date);
6667 FETCH csr_get_emp_data INTO l_emp_rec;
6668 CLOSE csr_get_emp_data;
6669 --
6670 l_emp_seq := NULL;
6671 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
6672 l_emp_seq := l_emp_rec.assignment_sequence;
6673 END IF;
6674 --
6675 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5') THEN
6676 l_emp_rec.change_reason := NULL;
6677 END IF;
6678 --
6679 OPEN csr_get_shared_types(l_emp_rec.nationality,p_business_gr_id,'NL_NATIONALITY');
6680 FETCH csr_get_shared_types INTO l_bg,l_nationality;
6681 CLOSE csr_get_shared_types;
6682 --
6683 IF g_contract_code_mapping = 'NL_EMPLOYMENT_CATG' THEN
6684 OPEN csr_get_shared_types(l_emp_rec.employment_category,p_business_gr_id,g_contract_code_mapping);
6685 FETCH csr_get_shared_types INTO l_bg,l_assignment_catg;
6686 CLOSE csr_get_shared_types;
6687 ELSE
6688 OPEN csr_get_shared_types(l_emp_rec.employee_category,p_business_gr_id,g_contract_code_mapping);
6689 FETCH csr_get_shared_types INTO l_bg,l_assignment_catg;
6690 CLOSE csr_get_shared_types;
6691 END IF;
6692 --
6693 l_income_code := 'N';
6694 l_work_pattern := 'N';
6695 l_wage_tax_discount := 'N';
6696 l_wage_tax_table := 'N';
6697 l_wage_aow := 'N';
6698 l_wage_wajong := 'N';
6699 l_emp_loan := 'N';
6700 l_transportation := 'N';
6701 --Fnd_file.put_line(FND_FILE.LOG,' Get scl Data '||l_emp_rec.soft_coding_keyflex_id);
6702 get_scl_data(l_emp_rec.soft_coding_keyflex_id
6703 ,p_chk_end_date
6704 ,l_income_code
6705 ,l_work_pattern -- specific income code.
6706 ,l_wage_tax_discount
6707 --,l_company_car_use
6708 ,l_wage_tax_table
6709 ,l_wage_aow
6710 ,l_wage_wajong
6711 ,l_emp_loan
6712 ,l_transportation
6713 ,l_chk);
6714 --
6715 l_surrogate_key := NULL;
6716 --Fnd_file.put_line(FND_FILE.LOG,' Get Assignment EIT Data :'||l_assignment_id||' l_surrogate_key :'||l_surrogate_key);
6717 get_assignment_extra_info(l_assignment_id -- pick data for p_date
6718 ,l_surrogate_key
6719 ,p_date
6720 ,p_chk_start_date
6721 ,p_chk_end_date
6722 ,l_labour_rel_code
6723 ,l_ins_duty_code
6724 ,l_FZ_Code
6725 ,l_handicapped_code
6726 ,l_wao_insured
6727 ,l_ww_insured
6728 ,l_zw_insured
6729 ,l_zvw_situation
6730 ,l_chk);
6731 --
6732 l_zvw_defaulted := NULL;
6733 IF l_zvw_situation IS NULL THEN
6734 l_zvw_situation := 'A';
6735 l_zvw_defaulted := 'Y';
6736 END IF;
6737 --
6738 OPEN csr_get_element_det('Holiday Coupons','Receiving Coupons',l_assignment_id,p_date);
6739 FETCH csr_get_element_det INTO l_holiday_coupen;
6740 CLOSE csr_get_element_det;
6741 IF l_holiday_coupen = 'Y' THEN
6742 l_holiday_coupen := 'J';
6743 END IF;
6744 --
6745 OPEN csr_get_element_det('Incidental Income Decrease','Decrease Code',l_assignment_id,p_date);
6746 FETCH csr_get_element_det INTO l_income_increase;
6747 CLOSE csr_get_element_det;
6748 --
6749 OPEN csr_get_element_det('Additional Allowance','Receiving Allowance',l_assignment_id,p_date);
6750 FETCH csr_get_element_det INTO l_add_allowance;
6751 CLOSE csr_get_element_det;
6752 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
6753 l_add_allowance := NULL;
6754 ELSIF l_add_allowance = 'Y' THEN
6755 l_add_allowance := 'J';
6756 END IF;
6757 --
6758 OPEN csr_get_element_det('Company Car Private Usage','Code Usage',l_assignment_id,p_date);
6759 FETCH csr_get_element_det INTO l_company_car_use;
6760 CLOSE csr_get_element_det;
6761 --
6762 --Fnd_file.put_line(FND_FILE.LOG,' Get Element Data :');
6763 --Fnd_file.put_line(FND_FILE.LOG,' l_holiday_coupen :'||l_holiday_coupen);
6764 --Fnd_file.put_line(FND_FILE.LOG,' l_income_increase :'||l_income_increase);
6765 --Fnd_file.put_line(FND_FILE.LOG,' l_add_allowance :'||l_add_allowance);
6766 --Fnd_file.put_line(FND_FILE.LOG,' l_company_car_use :'||l_company_car_use);
6767 --
6768 IF l_emp_rec.collective_agreement_id IS NULL THEN
6769 OPEN csr_get_eit_cao(l_emp_rec.assignment_id);
6770 FETCH csr_get_eit_cao INTO l_cao_code;
6771 CLOSE csr_get_eit_cao;
6772 --Fnd_file.put_line(FND_FILE.LOG,' Collective Agreement id null get from eit :'||l_cao_code);
6773 ELSE
6774 OPEN csr_get_cao_code(l_emp_rec.collective_agreement_id);
6775 FETCH csr_get_cao_code INTO l_cao_code;
6776 CLOSE csr_get_cao_code;
6777 --Fnd_file.put_line(FND_FILE.LOG,' Collective Agreement id not null get from collective agreement table. :'||l_cao_code);
6778 END IF;
6779 l_old_cao_code := l_cao_code;
6780 l_archive_emp_info := 'Y';
6781 l_initial_flag := 'N';
6782 --
6783 l_type := 'CORRECTION';
6784 --
6785 l_chk_emp_reported := 'N';
6786 l_period_start_date := TO_DATE('01-01-0001','dd-mm-yyyy');
6787 IF l_rec_changes.COUNT <> 0 THEN
6788 FOR i IN l_rec_changes.FIRST..l_rec_changes.LAST LOOP
6789 --
6790 IF l_rec_changes(i).retro = 'WITHDRAWAL' THEN
6791 OPEN csr_get_emp_data(l_assignment_id,l_rec_changes(i).effective_date);
6792 FETCH csr_get_emp_data INTO l_emp_rec;
6793 CLOSE csr_get_emp_data;
6794 --
6795 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5') THEN
6796 l_emp_rec.change_reason := NULL;
6797 END IF;
6798 --
6799 --Fnd_file.put_line(FND_FILE.LOG,' Creating NL_WR_EMPLOYMENT_INFO Infor Record for Type : WITHDRAWAL '||' Date :'||l_rec_changes(i).period_start_date);
6800 l_emp_end_date := NULL;
6801 IF l_ass_end_date <= l_rec_changes(i).period_end_date THEN
6802 l_emp_end_date := l_ass_end_date;
6803 END IF;
6804 --
6805 IF l_rec_changes(i).effective_date BETWEEN p_chk_start_date AND p_chk_end_date THEN --p_chk_start_date >= l_period_start_date AND p_chk_start_date <= l_period_end_date THEN
6806 l_type := 'INITIAL';
6807 ELSIF l_chk_emp_reported = 'N' OR g_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
6808 l_type := 'CORRECTION';
6809 ELSE
6810 l_type := 'CORRECT';
6811 END IF;
6812 --Fnd_file.put_line(FND_FILE.LOG,' l_type :'||l_type);
6813 --Fnd_file.put_line(FND_FILE.LOG,' g_effective_date :'||fnd_date.date_to_canonical(g_effective_date));
6814 --
6815 pay_action_information_api.create_action_information (
6816 p_action_information_id => l_master_action_info_id
6817 ,p_action_context_id => p_assactid
6818 ,p_action_context_type => 'AAP'
6819 ,p_object_version_number => l_ovn
6820 ,p_assignment_id => l_emp_rec.assignment_id
6821 ,p_effective_date => p_effective_date
6822 ,p_source_id => NULL
6823 ,p_source_text => NULL
6824 ,p_tax_unit_id => l_tax_unit_id
6825 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
6826 ,p_action_information1 => 'WITHDRAWAL'
6827 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(l_rec_changes(i).period_start_date,trunc(l_rec_changes(i).period_end_date,'Y')))
6828 ,p_action_information3 => fnd_date.date_to_canonical(l_rec_changes(i).period_end_date)
6829 ,p_action_information4 => l_emp_rec.assignment_number
6830 ,p_action_information5 => l_emp_rec.employee_number
6831 ,p_action_information6 => l_emp_rec.change_reason
6832 ,p_action_information8 => l_emp_rec.sofi_number
6833 ,p_action_information7 => l_emp_rec.person_id
6834 ,p_action_information9 => l_emp_rec.Initials
6835 ,p_action_information10 => l_emp_rec.prefix
6836 ,p_action_information11 => l_emp_rec.last_name
6837 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
6838 ,p_action_information13 => l_nationality
6839 ,p_action_information14 => l_emp_rec.gender
6840 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
6841 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
6842 ,p_action_information17 => l_rec_changes(i).retro
6843 ,p_action_information18 => l_emp_seq);
6844 ELSE
6845 --
6846 --Fnd_file.put_line(FND_FILE.LOG,' Change in Table:'||l_rec_changes(i).dated_table_id||' Column '||l_rec_changes(i).column_name||' Type : '||l_rec_changes(i).update_type);
6847 --Fnd_file.put_line(FND_FILE.LOG,' Effective_date:'||l_rec_changes(i).effective_date||' start date '||l_rec_changes(i).period_start_date||' end date : '||l_rec_changes(i).period_end_date);
6848 IF l_type <> 'INITIAL' AND
6849 l_rec_changes(i).effective_date BETWEEN p_chk_start_date AND p_chk_end_date AND
6850 l_rec_changes(i).effective_date <> GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date) AND
6851 l_archive_emp_info <> 'N'THEN
6852 --
6853 --Fnd_file.put_line(FND_FILE.LOG,' Creating NL_WR_EMPLOYMENT_INFO Infor Record for Type : INITIAL'||' Date :'||l_rec_changes(i).period_start_date);
6854 l_emp_end_date := NULL;
6855 IF l_ass_end_date <= l_rec_changes(i).period_end_date THEN
6856 l_emp_end_date := l_ass_end_date;
6857 END IF;
6858 OPEN csr_get_emp_data(l_assignment_id,NVL(l_emp_end_date,p_chk_end_date));
6859 FETCH csr_get_emp_data INTO l_emp_rec;
6860 CLOSE csr_get_emp_data;
6861 --
6862 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5') THEN
6863 l_emp_rec.change_reason := NULL;
6864 END IF;
6865 --
6866 pay_action_information_api.create_action_information (
6867 p_action_information_id => l_master_action_info_id
6868 ,p_action_context_id => p_assactid
6869 ,p_action_context_type => 'AAP'
6870 ,p_object_version_number => l_ovn
6871 ,p_assignment_id => l_emp_rec.assignment_id
6872 ,p_effective_date => p_effective_date
6873 ,p_source_id => NULL
6874 ,p_source_text => NULL
6875 ,p_tax_unit_id => l_tax_unit_id
6876 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
6877 ,p_action_information1 => 'INITIAL'
6878 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(l_rec_changes(i).period_start_date,trunc(l_rec_changes(i).period_end_date,'Y')))
6879 ,p_action_information3 => fnd_date.date_to_canonical(l_rec_changes(i).period_end_date)
6880 ,p_action_information4 => l_emp_rec.assignment_number
6881 ,p_action_information5 => l_emp_rec.employee_number
6882 ,p_action_information6 => l_emp_rec.change_reason
6883 ,p_action_information8 => l_emp_rec.sofi_number
6884 ,p_action_information7 => l_emp_rec.person_id
6885 ,p_action_information9 => l_emp_rec.Initials
6886 ,p_action_information10 => l_emp_rec.prefix
6887 ,p_action_information11 => l_emp_rec.last_name
6888 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
6889 ,p_action_information13 => l_nationality
6890 ,p_action_information14 => l_emp_rec.gender
6891 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)
6892 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
6893 ,p_action_information17 => l_rec_changes(i).retro
6894 ,p_action_information18 => l_emp_seq);
6895 --
6896 l_archive_emp_info := 'N';
6897 --
6898 OPEN get_scl_id(l_emp_rec.assignment_id,GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date));
6899 FETCH get_scl_id INTO l_scl_id;
6900 CLOSE get_scl_id;
6901 --
6902 l_income_code := 'N';
6903 l_work_pattern := 'N';
6904 l_wage_tax_discount := 'N';
6905 l_wage_tax_table := 'N';
6906 l_wage_aow := 'N';
6907 l_wage_wajong := 'N';
6908 l_emp_loan := 'N';
6909 l_transportation := 'N';
6910 --
6911 get_scl_data(l_scl_id --l_emp_rec.soft_coding_keyflex_id
6912 ,p_chk_end_date
6913 ,l_income_code
6914 ,l_work_pattern -- specific income code.
6915 ,l_wage_tax_discount
6916 --,l_company_car_use
6917 ,l_wage_tax_table
6918 ,l_wage_aow
6919 ,l_wage_wajong
6920 ,l_emp_loan
6921 ,l_transportation
6922 ,l_chk);
6923 --
6924 l_surrogate_key := NULL;
6925 get_assignment_extra_info(l_assignment_id
6926 ,l_surrogate_key
6927 ,GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date)
6928 ,p_chk_start_date
6929 ,p_chk_end_date
6930 ,l_labour_rel_code
6931 ,l_ins_duty_code
6932 ,l_FZ_Code
6933 ,l_handicapped_code
6934 ,l_wao_insured
6935 ,l_ww_insured
6936 ,l_zw_insured
6937 ,l_zvw_situation
6938 ,l_chk);
6939 l_zvw_defaulted := NULL;
6940 IF l_zvw_situation IS NULL THEN
6941 l_zvw_situation := 'A';
6942 l_zvw_defaulted := 'Y';
6943 END IF;
6944 --
6945 OPEN csr_get_element_det('Holiday Coupons','Receiving Coupons',l_assignment_id,GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date));
6946 FETCH csr_get_element_det INTO l_holiday_coupen;
6947 CLOSE csr_get_element_det;
6948 IF l_holiday_coupen = 'Y' THEN
6949 l_holiday_coupen := 'J';
6950 END IF;
6951 --
6952 OPEN csr_get_element_det('Incidental Income Decrease','Decrease Code',l_assignment_id,GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date));
6953 FETCH csr_get_element_det INTO l_income_increase;
6954 CLOSE csr_get_element_det;
6955 --
6956 OPEN csr_get_element_det('Additional Allowance','Receiving Allowance',l_assignment_id,GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date));
6957 FETCH csr_get_element_det INTO l_add_allowance;
6958 CLOSE csr_get_element_det;
6959 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
6960 l_add_allowance := NULL;
6961 ELSIF l_add_allowance = 'Y' THEN
6962 l_add_allowance := 'J';
6963 END IF;
6964 --
6965 OPEN csr_get_element_det('Company Car Private Usage','Code Usage',l_assignment_id,GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date));
6966 FETCH csr_get_element_det INTO l_company_car_use;
6967 CLOSE csr_get_element_det;
6968 --
6969 --Fnd_file.put_line(FND_FILE.LOG,' Creating NL_WR_INCOME_PERIOD Infor Record for Type : INITIAL');
6970 pay_action_information_api.create_action_information (
6971 p_action_information_id => l_action_info_id
6972 , p_action_context_id => p_assactid
6973 , p_action_context_type => 'AAP'
6974 , p_object_version_number => l_ovn
6975 , p_assignment_id => l_emp_rec.assignment_id
6976 , p_effective_date => p_effective_date
6977 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
6978 , p_tax_unit_id => l_tax_unit_id
6979 , p_action_information1 => 'INITIAL'
6980 , p_action_information2 => l_master_action_info_id
6981 , p_action_information5 => fnd_date.date_to_canonical(GREATEST(GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date),trunc(l_rec_changes(i).period_end_date,'Y'))) /*** EOY 0708 ...Start Date Income Peiod ***/
6982 , p_action_information6 => l_income_code
6983 , p_action_information7 => l_labour_rel_code
6984 , p_action_information8 => l_ins_duty_code
6985 , p_action_information9 => l_assignment_catg
6986 , p_action_information10 => l_FZ_Code
6987 , p_action_information11 => l_work_pattern
6988 , p_action_information12 => l_cao_code
6989 , p_action_information13 => l_handicapped_code
6990 , p_action_information14 => l_wage_tax_discount
6991 , p_action_information15 => l_company_car_use
6992 , p_action_information16 => l_wage_tax_table
6993 , p_action_information17 => l_wao_insured
6994 , p_action_information18 => l_ww_insured
6995 , p_action_information19 => l_zw_insured
6996 , p_action_information20 => NVL(l_zvw_situation,'A')
6997 , p_action_information21 => l_holiday_coupen
6998 , p_action_information22 => l_wage_aow
6999 , p_action_information23 => l_wage_wajong
7000 , p_action_information24 => l_emp_loan
7001 , p_action_information25 => l_transportation
7002 , p_action_information26 => l_income_increase
7003 , p_action_information27 => l_add_allowance);
7004 --
7005 l_initial_flag := 'Y';
7006 l_type := 'INITIAL';
7007 --
7008 END IF;
7009 l_chk := 'Y';
7010 IF l_rec_changes(i).update_type = 'U' AND
7011 l_rec_changes(i).column_name = 'EFFECTIVE_START_DATE' AND
7012 l_rec_changes(i).dated_table_id NOT IN (l_table1,l_table2) AND
7013 l_chg_pending = 'N' THEN
7014 l_chk := 'N';
7015 END IF;
7016 --
7017 IF l_chk = 'Y' THEN
7018 IF l_rec_changes(i).column_name = 'COLLECTIVE_AGREEMENT_ID' THEN
7019 l_emp_rec.collective_agreement_id := l_rec_changes(i).new_value;
7020 IF l_rec_changes(i).new_value IS NULL THEN
7021 OPEN csr_get_col_agreement_id(l_assignment_id,l_rec_changes(i).effective_date);
7022 FETCH csr_get_col_agreement_id INTO l_emp_rec.collective_agreement_id;
7023 CLOSE csr_get_col_agreement_id;
7024 END IF;
7025 l_cao_code := NULL;
7026 OPEN csr_get_cao_code(l_emp_rec.collective_agreement_id);
7027 FETCH csr_get_cao_code INTO l_cao_code;
7028 CLOSE csr_get_cao_code;
7029 IF NVL(l_old_cao_code,-1) = NVL(l_cao_code,-1) THEN
7030 l_chk := 'N';
7031 END IF;
7032 IF p_date = l_rec_changes(i).effective_date THEN
7033 l_chk := 'Y';
7034 END IF;
7035 l_old_cao_code := l_cao_code;
7036 --Fnd_file.put_line(FND_FILE.LOG,' Change in collective agreement ID New val :'||l_cao_code);
7037 --
7038 ELSIF l_rec_changes(i).column_name = 'CHANGE_REASON' THEN
7039 --Fnd_file.put_line(FND_FILE.LOG,' Change in change_reason New val :'||l_rec_changes(i).new_value);
7040 --l_emp_rec.CHANGE_REASON := l_rec_changes(i).new_value;
7041 IF l_rec_changes(i).new_value IN ('NL1','NL2','NL3','NL4','NL5') THEN
7042 l_emp_rec.CHANGE_REASON := l_rec_changes(i).new_value;
7043 END IF;
7044 IF l_chg_pending <> 'Y' THEN
7045 l_chk := 'N';
7046 ELSE
7047 l_chk := 'Y';
7048 END IF;
7049 --ELSIF l_rec_changes(i).column_name = 'EMPLOYMENT_CATEGORY' THEN
7050 ELSIF (g_contract_code_mapping = 'NL_EMPLOYMENT_CATG' AND l_rec_changes(i).column_name = 'EMPLOYMENT_CATEGORY') OR
7051 (g_contract_code_mapping = 'NL_EMPLOYEE_CATG' AND l_rec_changes(i).column_name = 'EMPLOYEE_CATEGORY') THEN
7052 l_emp_rec.employment_category := l_rec_changes(i).new_value; -- only certain category changes needs to be monitored
7053 l_assignment_catg_old := l_assignment_catg;
7054 OPEN csr_get_shared_types(l_emp_rec.employment_category,p_business_gr_id,g_contract_code_mapping);
7055 FETCH csr_get_shared_types INTO l_bg,l_assignment_catg;
7056 CLOSE csr_get_shared_types;
7057 IF l_assignment_catg_old <> 'O' AND
7058 l_assignment_catg_old <> 'B' AND
7059 l_assignment_catg <> 'O' AND
7060 l_assignment_catg <> 'B' AND
7061 l_assignment_catg <> l_assignment_catg_old AND
7062 l_income_code NOT IN ('11','12','13','14','15','18')THEN
7063 l_chk := 'N';
7064 END IF;
7065 IF p_date = l_rec_changes(i).effective_date THEN
7066 l_chk := 'Y';
7067 END IF;
7068 --Fnd_file.put_line(FND_FILE.LOG,' Change in assignment category New val :'||l_assignment_catg);
7069 --
7070 ELSIF ((g_contract_code_mapping = 'NL_EMPLOYMENT_CATG' AND l_rec_changes(i).column_name = 'EMPLOYEE_CATEGORY') OR
7071 (g_contract_code_mapping = 'NL_EMPLOYEE_CATG' AND l_rec_changes(i).column_name = 'EMPLOYMENT_CATEGORY')) AND
7072 l_chg_pending = 'N' THEN
7073 l_chk := 'N';
7074
7075 ELSIF l_rec_changes(i).column_name = 'ASSIGNMENT_STATUS_TYPE_ID' THEN
7076 l_emp_rec.ASSIGNMENT_STATUS_TYPE_ID := l_rec_changes(i).new_value;
7077 ELSIF l_rec_changes(i).column_name = 'SOFT_CODING_KEYFLEX_ID' THEN
7078 SELECT soft_coding_keyflex_id
7079 INTO l_emp_rec.soft_coding_keyflex_id
7080 FROM per_all_assignments_f
7081 WHERE assignment_id = l_assignment_id
7082 AND l_rec_changes(i).effective_date BETWEEN effective_start_date AND effective_end_date;
7083 --
7084 --Fnd_file.put_line(FND_FILE.LOG,' Change in SCL New val :'||l_rec_changes(i).new_value);
7085 get_scl_data(l_emp_rec.soft_coding_keyflex_id
7086 ,p_chk_end_date
7087 ,l_income_code
7088 ,l_work_pattern -- income code
7089 ,l_wage_tax_discount
7090 -- ,l_company_car_use
7091 ,l_wage_tax_table
7092 ,l_wage_aow
7093 ,l_wage_wajong
7094 ,l_emp_loan
7095 ,l_transportation
7096 ,l_chk);
7097 IF p_date = l_rec_changes(i).effective_date THEN
7098 l_chk := 'Y';
7099 END IF;
7100 --Fnd_file.put_line(FND_FILE.LOG,' Change in SCL New val :'||l_rec_changes(i).new_value||l_chk);
7101 ELSIF (l_rec_changes(i).column_name LIKE 'AEI_INFORMATION%')
7102 OR l_rec_changes(i).dated_table_id = l_table3 THEN
7103 --Fnd_file.put_line(FND_FILE.LOG,' Change in EIT New val :'||l_rec_changes(i).surrogate_key);
7104 IF i <> l_rec_changes.count THEN
7105 IF l_rec_changes(i).dated_table_id <> l_rec_changes(i+1).dated_table_id OR
7106 l_rec_changes(i).effective_date <> l_rec_changes(i+1).effective_date THEN
7107 get_assignment_extra_info(l_assignment_id
7108 ,NULL --l_rec_changes(i).surrogate_key
7109 ,l_rec_changes(i).effective_date
7110 ,l_rec_changes(i).period_start_date
7111 ,l_rec_changes(i).period_end_date
7112 ,l_labour_rel_code
7113 ,l_ins_duty_code
7114 ,l_FZ_Code
7115 ,l_handicapped_code
7116 ,l_wao_insured
7117 ,l_ww_insured
7118 ,l_zw_insured
7119 ,l_zvw_situation
7120 ,l_chk);
7121 l_zvw_defaulted := NULL;
7122 IF l_zvw_situation IS NULL THEN
7123 l_zvw_situation := 'A';
7124 l_zvw_defaulted := 'Y';
7125 END IF;
7126 --
7127 IF p_date = l_rec_changes(i).effective_date THEN
7128 l_chk := 'Y';
7129 END IF;
7130 ELSE
7131 l_chk := 'N';
7132 --Fnd_file.put_line(FND_FILE.LOG,' IGNORING CHANGE : Next change on same effective date and same table');
7133 END IF;
7134 ELSE
7135 get_assignment_extra_info(l_assignment_id
7136 ,NULL--l_rec_changes(i).surrogate_key
7137 ,l_rec_changes(i).effective_date
7138 ,l_rec_changes(i).period_start_date
7139 ,l_rec_changes(i).period_end_date
7140 ,l_labour_rel_code
7141 ,l_ins_duty_code
7142 ,l_FZ_Code
7143 ,l_handicapped_code
7144 ,l_wao_insured
7145 ,l_ww_insured
7146 ,l_zw_insured
7147 ,l_zvw_situation
7148 ,l_chk);
7149 l_zvw_defaulted := NULL;
7150 IF l_zvw_situation IS NULL THEN
7151 l_zvw_situation := 'A';
7152 l_zvw_defaulted := 'Y';
7153 END IF;
7154 --
7155 IF p_date = l_rec_changes(i).effective_date THEN
7156 l_chk := 'Y';
7157 END IF;
7158 END IF;
7159 ELSIF l_rec_changes(i).dated_table_id = l_table1 THEN
7160 OPEN csr_get_element_name1(l_rec_changes(i).surrogate_key,l_rec_changes(i).effective_date);
7161 FETCH csr_get_element_name1 INTO l_element_name, l_val;
7162 CLOSE csr_get_element_name1;
7163 IF l_element_name IN ('Holiday Coupons','Additional Allowance') AND
7164 l_val = 'Y' THEN
7165 l_val := 'J';
7166 END IF;
7167 --
7168 IF l_element_name = 'Holiday Coupons' THEN
7169 IF NVL(l_holiday_coupen,'X') = l_val THEN
7170 l_chk := 'N';
7171 END IF;
7172 l_holiday_coupen := l_val;
7173 ELSIF l_element_name = 'Incidental Income Decrease' THEN
7174 IF NVL(l_income_increase,'X') = l_val THEN
7175 l_chk := 'N';
7176 END IF;
7177 l_income_increase := l_val;
7178 ELSIF l_element_name = 'Additional Allowance' THEN
7179 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
7180 l_val := NULL;
7181 l_chk := 'N';
7182 ELSIF NVL(l_add_allowance,'X') = l_val THEN
7183 l_chk := 'N';
7184 END IF;
7185 l_add_allowance := l_val;
7186 ELSIF l_element_name = 'Company Car Private Usage' THEN
7187 IF NVL(l_company_car_use,'X') = l_val THEN
7188 l_chk := 'N';
7189 END IF;
7190 l_company_car_use := l_val;
7191 ELSE
7192 l_chk := 'N';
7193 END IF;
7194 IF p_date = l_rec_changes(i).effective_date THEN
7195 l_chk := 'Y';
7196 END IF;
7197 --Fnd_file.put_line(FND_FILE.LOG,' Change in Element entry New val :'||l_rec_changes(i).surrogate_key||l_chk);
7198 --
7199 ELSIF l_rec_changes(i).dated_table_id = l_table2 THEN
7200 OPEN csr_get_element_name2(l_rec_changes(i).surrogate_key,l_rec_changes(i).effective_date);
7201 FETCH csr_get_element_name2 INTO l_element_name, l_val;
7202 CLOSE csr_get_element_name2;
7203 IF l_element_name IN ('Holiday Coupons','Additional Allowance') AND
7204 l_val = 'Y' THEN
7205 l_val := 'J';
7206 END IF;
7207 --
7208 IF l_element_name = 'Holiday Coupons' THEN
7209 IF NVL(l_holiday_coupen,'X') = l_val THEN
7210 l_chk := 'N';
7211 END IF;
7212 l_holiday_coupen := l_val;
7213 ELSIF l_element_name = 'Incidental Income Decrease' THEN
7214 IF NVL(l_income_increase,'X') = l_val THEN
7215 l_chk := 'N';
7216 END IF;
7217 l_income_increase := l_val;
7218 ELSIF l_element_name = 'Additional Allowance' THEN
7219 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
7220 l_val := NULL;
7221 l_chk := 'N';
7222 ELSIF NVL(l_add_allowance,'X') = l_val THEN
7223 l_chk := 'N';
7224 END IF;
7225 l_add_allowance := l_val;
7226 ELSIF l_element_name = 'Company Car Private Usage' THEN
7227 IF NVL(l_company_car_use,'X') = l_val THEN
7228 l_chk := 'N';
7229 END IF;
7230 l_company_car_use := l_val;
7231 ELSE
7232 l_chk := 'N';
7233 END IF;
7234 IF p_date = l_rec_changes(i).effective_date THEN
7235 l_chk := 'Y';
7236 END IF;
7237 --Fnd_file.put_line(FND_FILE.LOG,' Change in Element entry values New val :'||l_rec_changes(i).surrogate_key||l_chk);
7238 --
7239 END IF;
7240 --
7241 IF l_chg_pending = 'Y' THEN
7242 l_chk := 'Y';
7243 END IF;
7244 --
7245 IF i <> l_rec_changes.count THEN
7246 IF l_rec_changes(i).effective_date = l_rec_changes(i + 1).effective_date THEN
7247 --Fnd_file.put_line(FND_FILE.LOG,' IGNORING CHANGE : Next change on same effective date');
7248 l_chk := 'N';
7249 l_chg_pending := 'Y';
7250 END IF;
7251 END IF;
7252 --
7253 /*IF i <> l_rec_changes.count AND
7254 l_rec_changes(i).effective_date BETWEEN p_chk_start_date AND p_chk_end_date AND
7255 l_rec_changes(i).update_type = 'C' AND
7256 l_rec_changes(i).dated_table_id <> l_table3 THEN
7257 --Fnd_file.put_line(FND_FILE.LOG,' IGNORING CHANGE : Correction in current period');
7258 l_chk := 'N';
7259 END IF; */
7260 --
7261 IF l_chk = 'Y' THEN
7262 IF l_period_start_date <> l_rec_changes(i).period_start_date
7263 --OR l_rec_changes(i).column_name = 'CHANGE_REASON'
7264 THEN
7265 l_period_start_date := l_rec_changes(i).period_start_date;
7266 l_period_end_date := l_rec_changes(i).period_end_date;
7267 --
7268 --archive employment info and address context
7269 --
7270 IF l_chk_emp_reported = 'N' AND g_effective_date < TO_DATE('01012007','DDMMYYYY') THEN --## for removing correction rec
7271 OPEN csr_chk_emp_reported(l_emp_rec.assignment_id);
7272 FETCH csr_chk_emp_reported INTO l_chk_emp_reported;
7273 IF csr_chk_emp_reported%notfound THEN
7274 l_chk_emp_reported := 'N';
7275 END IF;
7276 CLOSE csr_chk_emp_reported;
7277 END IF;
7278 --
7279 IF l_rec_changes(i).effective_date BETWEEN p_chk_start_date AND p_chk_end_date THEN --p_chk_start_date >= l_period_start_date AND p_chk_start_date <= l_period_end_date THEN
7280 l_type := 'INITIAL';
7281 ELSIF l_chk_emp_reported = 'N' OR g_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN --## for removing correction rec
7282 l_type := 'CORRECTION';
7283 ELSE
7284 l_type := 'CORRECT';
7285 END IF;
7286 --Fnd_file.put_line(FND_FILE.LOG,' l_type :'||l_type);
7287 --Fnd_file.put_line(FND_FILE.LOG,' g_effective_date :'||fnd_date.date_to_canonical(g_effective_date));
7288 --
7289 l_emp_end_date := NULL;
7290 IF l_ass_end_date <= l_period_end_date THEN
7291 l_emp_end_date := l_ass_end_date;
7292 END IF;
7293 --
7294 IF l_type = 'INITIAL' THEN
7295 OPEN csr_get_emp_data(l_assignment_id,NVL(l_emp_end_date,p_chk_end_date));
7296 FETCH csr_get_emp_data INTO l_emp_rec;
7297 CLOSE csr_get_emp_data;
7298 ELSE
7299 OPEN csr_get_emp_data(l_assignment_id,l_rec_changes(i).effective_date);
7300 FETCH csr_get_emp_data INTO l_emp_rec;
7301 CLOSE csr_get_emp_data;
7302 END IF;
7303 --
7304 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5') THEN
7305 l_emp_rec.change_reason := NULL;
7306 END IF;
7307 --
7308 IF l_archive_emp_info <> 'N' THEN
7309 --Fnd_file.put_line(FND_FILE.LOG,' Creating NL_WR_EMPLOYMENT_INFO INfor Record for Type :'||l_type||' Date :'||l_period_start_date);
7310 pay_action_information_api.create_action_information (
7311 p_action_information_id => l_master_action_info_id
7312 ,p_action_context_id => p_assactid
7313 ,p_action_context_type => 'AAP'
7314 ,p_object_version_number => l_ovn
7315 ,p_assignment_id => l_emp_rec.assignment_id
7316 ,p_effective_date => p_effective_date
7317 ,p_source_id => NULL
7318 ,p_source_text => NULL
7319 ,p_tax_unit_id => l_tax_unit_id
7320 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
7321 ,p_action_information1 => l_type
7322 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(l_period_start_date,trunc(l_period_end_date,'Y')))
7323 ,p_action_information3 => fnd_date.date_to_canonical(l_period_end_date)
7324 ,p_action_information4 => l_emp_rec.assignment_number
7325 ,p_action_information5 => l_emp_rec.employee_number
7326 ,p_action_information6 => l_emp_rec.change_reason
7327 ,p_action_information8 => l_emp_rec.sofi_number
7328 ,p_action_information7 => l_emp_rec.person_id
7329 ,p_action_information9 => l_emp_rec.Initials
7330 ,p_action_information10 => l_emp_rec.prefix
7331 ,p_action_information11 => l_emp_rec.last_name
7332 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
7333 ,p_action_information13 => l_nationality
7334 ,p_action_information14 => l_emp_rec.gender
7335 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
7336 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
7337 ,p_action_information17 => l_rec_changes(i).retro
7338 ,p_action_information18 => l_emp_seq);
7339 END IF;
7340 l_archive_emp_info := 'Y';
7341 --
7342 --IF l_type = 'INITIAL' OR l_type = 'CORRECTION' THEN
7343 -- archive employee address
7344 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Employee Address Record for Type :'||l_type);
7345 IF l_type = 'INITIAL' OR l_type = 'CORRECTION' THEN
7346 archive_emp_address(p_assactid
7347 ,l_emp_rec.person_id
7348 ,l_emp_rec.assignment_id
7349 ,l_emp_rec.assignment_number
7350 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7351 ,l_tax_unit_id
7352 ,l_master_action_info_id
7353 ,p_effective_date
7354 ,NVL(l_emp_end_date,l_period_end_date)
7355 ,l_type);
7356 ELSE
7357 archive_emp_address(p_assactid
7358 ,l_emp_rec.person_id
7359 ,l_emp_rec.assignment_id
7360 ,l_emp_rec.assignment_number
7361 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7362 ,l_tax_unit_id
7363 ,l_master_action_info_id
7364 ,p_effective_date
7365 ,l_rec_changes(i).effective_date
7366 ,l_type);
7367 END IF;
7368 -- archive sector information for assignment
7369 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Sector Risk Group Record for Type :'||l_type);
7370 l_srg_flag := archive_sector_risk_group(p_assactid
7371 ,l_emp_rec.assignment_id
7372 ,p_effective_date
7373 ,l_tax_unit_id
7374 ,l_master_action_info_id
7375 ,l_period_start_date
7376 ,l_period_end_date
7377 ,l_ass_start_date
7378 ,l_emp_end_date
7379 ,p_payroll_type);
7380 --#
7381 IF l_srg_flag = 'N' AND (l_wao_insured = 'Y' OR l_ww_insured = 'Y' OR l_zw_insured = 'Y') THEN
7382 --
7383 pay_action_information_api.create_action_information
7384 (
7385 p_action_information_id => l_action_info_id
7386 , p_action_context_id => p_assactid
7387 , p_action_context_type => 'AAP'
7388 , p_object_version_number => l_ovn
7389 , p_assignment_id => l_emp_rec.assignment_id
7390 , p_effective_date => p_effective_date
7391 , p_source_id => NULL
7392 , p_source_text => NULL
7393 , p_tax_unit_id => l_tax_unit_id
7394 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7395 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_ASG_RISK_GRP')
7396 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
7397 , p_action_information6 => 'Assignment has no Sector or Risk Group'
7398 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7399 , p_action_information8 => l_emp_rec.assignment_number);
7400 --
7401 END IF;
7402 --#
7403 --
7404 --archive nominative info
7405 l_assignment_action_id := NULL;
7406 OPEN csr_get_assignment_action_id2(l_assignment_id,l_period_start_date);
7407 FETCH csr_get_assignment_action_id2 INTO l_assignment_action_id;
7408 CLOSE csr_get_assignment_action_id2;
7409 --
7410 IF l_rec_changes(i).retro = 'PAY' OR l_type = 'INITIAL' OR l_type = 'CORRECTION' THEN
7411 l_corr_used := 'N';
7412 populate_nom_balance_values(l_master_assignment_action_id
7413 ,l_assignment_action_id
7414 ,l_period_end_date
7415 ,l_tax_unit_id
7416 ,l_type
7417 ,l_rec_changes(i).retro
7418 ,l_corr_used
7419 ,l_bal_value);
7420 --
7421 get_nominative_data(l_bal_value,l_nom_bal_value);
7422 --
7423 --Fnd_file.put_line(FND_FILE.LOG,' Creating NL_WR_NOMINATIVE_REPORT Record for Type :'||l_type);
7424 archive_nominative_data(p_assactid
7425 ,l_emp_rec.assignment_id
7426 ,l_tax_unit_id
7427 ,p_effective_date
7428 ,l_rec_changes(i).effective_date
7429 ,l_type
7430 ,l_master_action_info_id
7431 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7432 ,l_corr_used
7433 ,p_payroll_type
7434 ,l_nom_bal_value);
7435 END IF;
7436 --
7437 l_chk_emp_reported := 'Y';
7438 --END IF;
7439 END IF;
7440 l_chg_pending := 'N';
7441 --
7442 --IF l_rec_changes(i).column_name <> 'CHANGE_REASON' OR
7443 -- l_rec_changes(i).column_name IS NOT NULL THEN
7444 --#
7445 IF l_zvw_defaulted = 'Y' THEN
7446 pay_action_information_api.create_action_information
7447 (
7448 p_action_information_id => l_action_info_id
7449 , p_action_context_id => p_assactid
7450 , p_action_context_type => 'AAP'
7451 , p_object_version_number => l_ovn
7452 , p_assignment_id => l_emp_rec.assignment_id
7453 , p_effective_date => p_effective_date
7454 , p_source_id => NULL
7455 , p_source_text => NULL
7456 , p_tax_unit_id => l_tax_unit_id
7457 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7458 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_ZVW_CODE_INSURED')
7459 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
7460 , p_action_information6 => 'Code ZVW is defaulted to - A'
7461 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7462 , p_action_information8 => l_emp_rec.assignment_number);
7463 END IF;
7464 --
7465 IF l_income_code IN (11,12,13,14,15,18) AND l_labour_rel_code IS NULL THEN
7466 pay_action_information_api.create_action_information
7467 (
7468 p_action_information_id => l_action_info_id
7469 , p_action_context_id => p_assactid
7470 , p_action_context_type => 'AAP'
7471 , p_object_version_number => l_ovn
7472 , p_assignment_id => l_emp_rec.assignment_id
7473 , p_effective_date => p_effective_date
7474 , p_source_id => NULL
7475 , p_source_text => NULL
7476 , p_tax_unit_id => l_tax_unit_id
7477 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7478 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_LABOR_CODE')
7479 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
7480 , p_action_information6 => 'Labor Relation code is null'
7481 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7482 , p_action_information8 => l_emp_rec.assignment_number);
7483 END IF;
7484 --
7485 IF l_income_code IN (11,12,13,14,15,18) AND l_assignment_catg IS NULL THEN
7486 pay_action_information_api.create_action_information
7487 (
7488 p_action_information_id => l_action_info_id
7489 , p_action_context_id => p_assactid
7490 , p_action_context_type => 'AAP'
7491 , p_object_version_number => l_ovn
7492 , p_assignment_id => l_emp_rec.assignment_id
7493 , p_effective_date => p_effective_date
7494 , p_source_id => NULL
7495 , p_source_text => NULL
7496 , p_tax_unit_id => l_tax_unit_id
7497 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7498 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_CONTRACT_CODE')
7499 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
7500 , p_action_information6 => 'Code contract for limited or unlimited time is null'
7501 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7502 , p_action_information8 => l_emp_rec.assignment_number);
7503 END IF;
7504 --
7505 IF l_income_code IN (11,12,13,14,15,18) AND l_work_pattern IS NULL AND g_effective_date < TO_DATE('01012007','DDMMYYYY') THEN
7506 pay_action_information_api.create_action_information
7507 (
7508 p_action_information_id => l_action_info_id
7509 , p_action_context_id => p_assactid
7510 , p_action_context_type => 'AAP'
7511 , p_object_version_number => l_ovn
7512 , p_assignment_id => l_emp_rec.assignment_id
7513 , p_effective_date => p_effective_date
7514 , p_source_id => NULL
7515 , p_source_text => NULL
7516 , p_tax_unit_id => l_tax_unit_id
7517 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7518 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_WORK_PATTERN')
7519 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
7520 , p_action_information6 => 'Indication regular work pattern is null'
7521 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7522 , p_action_information8 => l_emp_rec.assignment_number);
7523 END IF;
7524 --
7525 IF l_srg_flag = 'Z' AND l_FZ_Code IS NULL THEN
7526 pay_action_information_api.create_action_information
7527 (
7528 p_action_information_id => l_action_info_id
7529 , p_action_context_id => p_assactid
7530 , p_action_context_type => 'AAP'
7531 , p_object_version_number => l_ovn
7532 , p_assignment_id => l_emp_rec.assignment_id
7533 , p_effective_date => p_effective_date
7534 , p_source_id => NULL
7535 , p_source_text => NULL
7536 , p_tax_unit_id => l_tax_unit_id
7537 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7538 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_TEMP_LABOR_CODE')
7539 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
7540 , p_action_information6 => 'Temp Labor Code is null'
7541 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7542 , p_action_information8 => l_emp_rec.assignment_number);
7543 END IF;
7544 --
7545 IF l_company_car_use = 4 AND g_effective_date > to_date('01012007','ddmmyyyy') THEN
7546 pay_action_information_api.create_action_information
7547 (
7548 p_action_information_id => l_action_info_id
7549 , p_action_context_id => p_assactid
7550 , p_action_context_type => 'AAP'
7551 , p_object_version_number => l_ovn
7552 , p_assignment_id => l_emp_rec.assignment_id
7553 , p_effective_date => p_effective_date
7554 , p_source_id => NULL
7555 , p_source_text => NULL
7556 , p_tax_unit_id => l_tax_unit_id
7557 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7558 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_COMPANY_CAR_USE')
7559 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
7560 , p_action_information6 => 'Company Car Usage code invalid'
7561 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7562 , p_action_information8 => l_emp_rec.assignment_number);
7563 END IF;
7564 --#
7565 --Fnd_file.put_line(FND_FILE.LOG,' Creating NL_WR_INCOME_PERIOD INfor Record for Type :'||l_type||GREATEST(l_rec_changes(i).effective_date,l_ass_start_date));
7566 pay_action_information_api.create_action_information (
7567 p_action_information_id => l_action_info_id
7568 , p_action_context_id => p_assactid
7569 , p_action_context_type => 'AAP'
7570 , p_object_version_number => l_ovn
7571 , p_assignment_id => l_emp_rec.assignment_id
7572 , p_effective_date => p_effective_date
7573 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
7574 , p_tax_unit_id => l_tax_unit_id
7575 , p_action_information1 => l_type
7576 , p_action_information2 => l_master_action_info_id
7577 , p_action_information5 => fnd_date.date_to_canonical(GREATEST(GREATEST(l_rec_changes(i).effective_date,l_ass_start_date),trunc(l_rec_changes(i).period_end_date,'Y'))) /*** EOY 0708 ...Start Date Income Peiod ***/
7578 , p_action_information6 => l_income_code
7579 , p_action_information7 => l_labour_rel_code
7580 , p_action_information8 => l_ins_duty_code
7581 , p_action_information9 => l_assignment_catg
7582 , p_action_information10 => l_FZ_Code
7583 , p_action_information11 => l_work_pattern
7584 , p_action_information12 => l_cao_code
7585 , p_action_information13 => l_handicapped_code
7586 , p_action_information14 => l_wage_tax_discount
7587 , p_action_information15 => l_company_car_use
7588 , p_action_information16 => l_wage_tax_table
7589 , p_action_information17 => l_wao_insured
7590 , p_action_information18 => l_ww_insured
7591 , p_action_information19 => l_zw_insured
7592 , p_action_information20 => NVL(l_zvw_situation,'A')
7593 , p_action_information21 => l_holiday_coupen
7594 , p_action_information22 => l_wage_aow
7595 , p_action_information23 => l_wage_wajong
7596 , p_action_information24 => l_emp_loan
7597 , p_action_information25 => l_transportation
7598 , p_action_information26 => l_income_increase
7599 , p_action_information27 => l_add_allowance);
7600 --
7601 l_initial_flag := 'N';
7602 --
7603 END IF;
7604 END IF;
7605 END IF;
7606 --
7607 END LOOP;
7608 END IF;
7609 IF l_rec_changes.COUNT = 0 OR l_type <> 'INITIAL' OR l_initial_flag = 'Y' THEN
7610 l_type := 'INITIAL';
7611 --Fnd_file.put_line(FND_FILE.LOG,' No HR or Payroll Change : Creating NL_WR_EMPLOYMENT_INFO Information Record for Type :'||l_type);
7612 -- archive employment Information
7613 l_emp_end_date := NULL;
7614 IF l_ass_end_date <= p_chk_end_date THEN
7615 l_emp_end_date := l_ass_end_date;
7616 END IF;
7617 --
7618 IF l_initial_flag <> 'Y' THEN
7619 pay_action_information_api.create_action_information (
7620 p_action_information_id => l_master_action_info_id
7621 ,p_action_context_id => p_assactid
7622 ,p_action_context_type => 'AAP'
7623 ,p_object_version_number => l_ovn
7624 ,p_assignment_id => l_emp_rec.assignment_id
7625 ,p_effective_date => p_effective_date
7626 ,p_source_id => NULL
7627 ,p_source_text => NULL
7628 ,p_tax_unit_id => l_tax_unit_id
7629 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
7630 ,p_action_information1 => l_type
7631 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(p_chk_start_date,trunc(p_chk_end_date,'Y')))
7632 ,p_action_information3 => fnd_date.date_to_canonical(p_chk_end_date)
7633 ,p_action_information4 => l_emp_rec.assignment_number
7634 ,p_action_information5 => l_emp_rec.employee_number
7635 ,p_action_information8 => l_emp_rec.sofi_number
7636 ,p_action_information6 => l_emp_rec.change_reason
7637 ,p_action_information7 => l_emp_rec.person_id
7638 ,p_action_information9 => l_emp_rec.Initials
7639 ,p_action_information10 => l_emp_rec.prefix
7640 ,p_action_information11 => l_emp_rec.last_name
7641 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
7642 ,p_action_information13 => l_nationality
7643 ,p_action_information14 => l_emp_rec.gender
7644 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
7645 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
7646 ,p_action_information17 => NULL
7647 ,p_action_information18 => l_emp_seq);
7648 END IF;
7649 -- archive address information
7650 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Employee Address Record for Type :'||l_type);
7651 archive_emp_address(p_assactid
7652 ,l_emp_rec.person_id
7653 ,l_emp_rec.assignment_id
7654 ,l_emp_rec.assignment_number
7655 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7656 ,l_tax_unit_id
7657 ,l_master_action_info_id
7658 ,p_effective_date
7659 ,NVL(l_emp_end_date,p_effective_date)
7660 ,l_type);
7661 -- archive sector information for assignment
7662 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Sector Risk Group Record for Type :'||l_type);
7663 l_srg_flag := archive_sector_risk_group(p_assactid
7664 ,l_emp_rec.assignment_id
7665 ,p_effective_date
7666 ,l_tax_unit_id
7667 ,l_master_action_info_id
7668 ,p_chk_start_date
7669 ,p_chk_end_date
7670 ,l_ass_start_date
7671 ,l_emp_end_date
7672 ,p_payroll_type);
7673 --#
7674 IF l_srg_flag = 'N' AND (l_wao_insured = 'Y' OR l_ww_insured = 'Y' OR l_zw_insured = 'Y') THEN
7675 --
7676 pay_action_information_api.create_action_information
7677 (
7678 p_action_information_id => l_action_info_id
7679 , p_action_context_id => p_assactid
7680 , p_action_context_type => 'AAP'
7681 , p_object_version_number => l_ovn
7682 , p_assignment_id => l_emp_rec.assignment_id
7683 , p_effective_date => p_effective_date
7684 , p_source_id => NULL
7685 , p_source_text => NULL
7686 , p_tax_unit_id => l_tax_unit_id
7687 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7688 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_ASG_RISK_GRP')
7689 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
7690 , p_action_information6 => 'Assignment has no Sector or Risk Group'
7691 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7692 , p_action_information8 => l_emp_rec.assignment_number);
7693 --
7694 END IF;
7695 --#
7696 --#
7697 IF l_zvw_defaulted = 'Y' THEN
7698 pay_action_information_api.create_action_information
7699 (
7700 p_action_information_id => l_action_info_id
7701 , p_action_context_id => p_assactid
7702 , p_action_context_type => 'AAP'
7703 , p_object_version_number => l_ovn
7704 , p_assignment_id => l_emp_rec.assignment_id
7705 , p_effective_date => p_effective_date
7706 , p_source_id => NULL
7707 , p_source_text => NULL
7708 , p_tax_unit_id => l_tax_unit_id
7709 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7710 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_ZVW_CODE_INSURED')
7711 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
7712 , p_action_information6 => 'Code ZVW is defaulted to - A'
7713 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7714 , p_action_information8 => l_emp_rec.assignment_number);
7715 END IF;
7716 --
7717 IF l_income_code IN (11,12,13,14,15,18) AND l_labour_rel_code IS NULL THEN
7718 pay_action_information_api.create_action_information
7719 (
7720 p_action_information_id => l_action_info_id
7721 , p_action_context_id => p_assactid
7722 , p_action_context_type => 'AAP'
7723 , p_object_version_number => l_ovn
7724 , p_assignment_id => l_emp_rec.assignment_id
7725 , p_effective_date => p_effective_date
7726 , p_source_id => NULL
7727 , p_source_text => NULL
7728 , p_tax_unit_id => l_tax_unit_id
7729 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7730 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_LABOR_CODE')
7731 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
7732 , p_action_information6 => 'Labor Relation code is null'
7733 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7734 , p_action_information8 => l_emp_rec.assignment_number);
7735 END IF;
7736 --
7737 IF l_income_code IN (11,12,13,14,15,18) AND l_assignment_catg IS NULL THEN
7738 pay_action_information_api.create_action_information
7739 (
7740 p_action_information_id => l_action_info_id
7741 , p_action_context_id => p_assactid
7742 , p_action_context_type => 'AAP'
7743 , p_object_version_number => l_ovn
7744 , p_assignment_id => l_emp_rec.assignment_id
7745 , p_effective_date => p_effective_date
7746 , p_source_id => NULL
7747 , p_source_text => NULL
7748 , p_tax_unit_id => l_tax_unit_id
7749 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7750 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_CONTRACT_CODE')
7751 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
7752 , p_action_information6 => 'Code contract for limited or unlimited time is null'
7753 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7754 , p_action_information8 => l_emp_rec.assignment_number);
7755 END IF;
7756 --
7757 IF l_income_code IN (11,12,13,14,15,18) AND l_work_pattern IS NULL AND g_effective_date < TO_DATE('01012007','DDMMYYYY') THEN
7758 pay_action_information_api.create_action_information
7759 (
7760 p_action_information_id => l_action_info_id
7761 , p_action_context_id => p_assactid
7762 , p_action_context_type => 'AAP'
7763 , p_object_version_number => l_ovn
7764 , p_assignment_id => l_emp_rec.assignment_id
7765 , p_effective_date => p_effective_date
7766 , p_source_id => NULL
7767 , p_source_text => NULL
7768 , p_tax_unit_id => l_tax_unit_id
7769 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7770 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_WORK_PATTERN')
7771 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
7772 , p_action_information6 => 'Indication regular work pattern is null'
7773 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7774 , p_action_information8 => l_emp_rec.assignment_number);
7775 END IF;
7776 --
7777 IF l_srg_flag = 'Z' AND l_FZ_Code IS NULL THEN
7778 pay_action_information_api.create_action_information
7779 (
7780 p_action_information_id => l_action_info_id
7781 , p_action_context_id => p_assactid
7782 , p_action_context_type => 'AAP'
7783 , p_object_version_number => l_ovn
7784 , p_assignment_id => l_emp_rec.assignment_id
7785 , p_effective_date => p_effective_date
7786 , p_source_id => NULL
7787 , p_source_text => NULL
7788 , p_tax_unit_id => l_tax_unit_id
7789 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7790 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_TEMP_LABOR_CODE')
7791 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
7792 , p_action_information6 => 'Temp Labor Code is null'
7793 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7794 , p_action_information8 => l_emp_rec.assignment_number);
7795 END IF;
7796 --
7797 IF l_company_car_use = 4 AND g_effective_date > to_date('01012007','ddmmyyyy') THEN
7798 pay_action_information_api.create_action_information
7799 (
7800 p_action_information_id => l_action_info_id
7801 , p_action_context_id => p_assactid
7802 , p_action_context_type => 'AAP'
7803 , p_object_version_number => l_ovn
7804 , p_assignment_id => l_emp_rec.assignment_id
7805 , p_effective_date => p_effective_date
7806 , p_source_id => NULL
7807 , p_source_text => NULL
7808 , p_tax_unit_id => l_tax_unit_id
7809 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7810 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_COMPANY_CAR_USE')
7811 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
7812 , p_action_information6 => 'Company Car Usage code invalid'
7813 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7814 , p_action_information8 => l_emp_rec.assignment_number);
7815 END IF;
7816 --#
7817 IF l_initial_flag <> 'Y' THEN
7818 --archive Income period information
7819 --Fnd_file.put_line(FND_FILE.LOG,' Archiving NL_WR_INCOME_PERIOD Record for Type :'||l_type);
7820 pay_action_information_api.create_action_information (
7821 p_action_information_id => l_action_info_id
7822 , p_action_context_id => p_assactid
7823 , p_action_context_type => 'AAP'
7824 , p_object_version_number => l_ovn
7825 , p_assignment_id => l_emp_rec.assignment_id
7826 , p_effective_date => p_effective_date
7827 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
7828 , p_tax_unit_id => l_tax_unit_id
7829 , p_action_information1 => l_type
7830 , p_action_information2 => l_master_action_info_id
7831 , p_action_information5 => fnd_date.date_to_canonical(GREATEST(GREATEST(p_chk_start_date,l_ass_start_date),trunc(p_chk_end_date,'Y'))) /*** EOY 0708 ...Start Date Income Peiod ***/
7832 , p_action_information6 => l_income_code
7833 , p_action_information7 => l_labour_rel_code
7834 , p_action_information8 => l_ins_duty_code
7835 , p_action_information9 => l_assignment_catg
7836 , p_action_information10 => l_FZ_Code
7837 , p_action_information11 => l_work_pattern
7838 , p_action_information12 => l_cao_code
7839 , p_action_information13 => l_handicapped_code
7840 , p_action_information14 => l_wage_tax_discount
7841 , p_action_information15 => l_company_car_use
7842 , p_action_information16 => l_wage_tax_table
7843 , p_action_information17 => l_wao_insured
7844 , p_action_information18 => l_ww_insured
7845 , p_action_information19 => l_zw_insured
7846 , p_action_information20 => NVL(l_zvw_situation,'A')
7847 , p_action_information21 => l_holiday_coupen--'holiday coupen'
7848 , p_action_information22 => l_wage_aow
7849 , p_action_information23 => l_wage_wajong
7850 , p_action_information24 => l_emp_loan
7851 , p_action_information25 => l_transportation
7852 , p_action_information26 => l_income_increase--'INCOME DECREASE' -- A1
7853 , p_action_information27 => l_add_allowance);--'ADDITIONAL ALLW');
7854 END IF;
7855 --archive nominative info
7856 OPEN csr_get_assignment_action_id2(l_assignment_id,p_chk_start_date);
7857 FETCH csr_get_assignment_action_id2 INTO l_master_assignment_action_id;
7858 CLOSE csr_get_assignment_action_id2;
7859 --Fnd_file.put_line(FND_FILE.LOG,' Calling populate_nom_balance_values for Type :'||l_type);
7860 l_corr_used := 'N';
7861 populate_nom_balance_values(l_master_assignment_action_id
7862 ,l_master_assignment_action_id
7863 ,p_chk_end_date
7864 ,l_tax_unit_id
7865 ,l_type
7866 ,'HR'
7867 ,l_corr_used
7868 ,l_bal_value);
7869 --Fnd_file.put_line(FND_FILE.LOG,' Calling get_nominative_data for Type :'||l_type);
7870 get_nominative_data(l_bal_value,l_nom_bal_value);
7871 --Fnd_file.put_line(FND_FILE.LOG,' Archiving NL_WR_NOMINATIVE Record for Type :'||l_type);
7872 archive_nominative_data(p_assactid
7873 ,l_emp_rec.assignment_id
7874 ,l_tax_unit_id
7875 ,p_effective_date
7876 ,p_effective_date
7877 ,l_type
7878 ,l_master_action_info_id
7879 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
7880 ,l_corr_used
7881 ,p_payroll_type
7882 ,l_nom_bal_value);
7883 END IF;
7884 --Fnd_file.put_line(FND_FILE.LOG,' Leaving chk_events');
7885 EXCEPTION
7886 WHEN OTHERS THEN
7887 --Fnd_file.put_line(FND_FILE.LOG,' Others. Assignment :'||l_assignment_id);
7888 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
7889 NULL;
7890 END chk_events;
7891 --------------------------------------------------------------------------------
7892 -- ARCHIVE_CONSOLIDATE
7893 --------------------------------------------------------------------------------
7894 PROCEDURE archive_consolidate(p_assactid NUMBER
7895 ,p_assignment_id NUMBER
7896 ,p_effective_date DATE
7897 ,p_business_gr_id NUMBER
7898 ,l_tax_unit_id NUMBER
7899 ,p_start_date DATE
7900 ,p_end_date DATE
7901 ,p_payroll_type VARCHAR2) IS
7902 --
7903 CURSOR csr_action_info(c_category VARCHAR2
7904 ,c_type VARCHAR2
7905 ,c_assignment_id NUMBER) IS
7906 SELECT pai.*
7907 FROM pay_action_interlocks pal
7908 ,pay_action_information pai
7909 WHERE pal.locking_action_id = p_assactid
7910 AND pal.locked_action_id = pai.action_context_id
7911 AND pai.action_context_type = 'AAP'
7912 AND pai.action_information_category = c_category
7913 AND pai.assignment_id = c_assignment_id
7914 AND pai.action_information1 = c_type
7915 ORDER BY pai.effective_date DESC;
7916 --
7917 CURSOR csr_get_income_start_date(c_assactid NUMBER
7918 ,c_assignment_id NUMBER) IS
7919 SELECT MIN(fnd_date.canonical_to_date(action_information5))
7920 FROM pay_action_interlocks pal
7921 ,pay_action_information pai
7922 WHERE pal.locking_action_id = c_assactid
7923 AND pal.locked_action_id = pai.action_context_id
7924 AND pai.action_context_type = 'AAP'
7925 AND pai.action_information_category = 'NL_WR_INCOME_PERIOD'
7926 AND pai.assignment_id = c_assignment_id
7927 AND pai.action_information1 = 'INITIAL';
7928 --
7929 CURSOR csr_get_sector_start_date(c_assactid NUMBER
7930 ,c_assignment_id NUMBER
7931 ,c_sector VARCHAR2
7932 ,c_risk_grp VARCHAR2) IS
7933 SELECT MIN(fnd_date.canonical_to_date(action_information5))
7934 FROM pay_action_interlocks pal
7935 ,pay_action_information pai
7936 WHERE pal.locking_action_id = c_assactid
7937 AND pal.locked_action_id = pai.action_context_id
7938 AND pai.action_context_type = 'AAP'
7939 AND pai.action_information_category = 'NL_WR_SWMF_SECTOR_RISK_GROUP'
7940 AND pai.assignment_id = c_assignment_id
7941 AND pai.action_information1 = 'SECTOR_RISK_GROUP'
7942 AND pai.action_information7 = c_sector
7943 AND pai.action_information8 = c_risk_grp;
7944 --
7945 CURSOR csr_exception_info(c_category VARCHAR2
7946 ,c_assactid NUMBER) IS
7947 SELECT pai.*
7948 FROM pay_action_information pai
7949 WHERE pai.action_context_id = c_assactid
7950 AND pai.action_context_type = 'AAP'
7951 AND pai.action_information_category = c_category;
7952 --
7953 CURSOR csr_ip_srg_info(c_category VARCHAR2
7954 ,c_type VARCHAR2
7955 ,c_actinfid NUMBER) IS
7956 SELECT pai.*
7957 FROM pay_action_information pai
7958 WHERE pai.action_context_type = 'AAP'
7959 AND pai.action_information2 = fnd_number.number_to_canonical(c_actinfid)
7960 AND pai.action_information_category = c_category
7961 AND pai.action_information1 = c_type ;
7962 --
7963 CURSOR csr_address_info(c_category VARCHAR2
7964 ,c_type VARCHAR2
7965 ,c_actinfid NUMBER
7966 ,c_action_context_id NUMBER) IS
7967 SELECT pai.*
7968 FROM pay_action_information pai
7969 WHERE pai.action_context_type = 'AAP'
7970 AND pai.action_information27 = fnd_number.number_to_canonical(c_actinfid)
7971 AND pai.action_context_id = c_action_context_id
7972 AND pai.action_information_category = c_category
7973 AND pai.action_information26 = c_type ;
7974 --
7975 CURSOR csr_nominative_info(c_category VARCHAR2
7976 ,c_type VARCHAR2
7977 ,c_assactid NUMBER) IS
7978 select sum(fnd_number.canonical_to_number(pai.action_information5)) sum5
7979 ,sum(fnd_number.canonical_to_number(pai.action_information6)) sum6
7980 ,sum(fnd_number.canonical_to_number(pai.action_information7)) sum7
7981 ,sum(fnd_number.canonical_to_number(pai.action_information8)) sum8
7982 ,sum(fnd_number.canonical_to_number(pai.action_information9)) sum9
7983 ,sum(fnd_number.canonical_to_number(pai.action_information10)) sum10
7984 ,sum(fnd_number.canonical_to_number(pai.action_information11)) sum11
7985 ,sum(fnd_number.canonical_to_number(pai.action_information12)) sum12
7986 ,sum(fnd_number.canonical_to_number(pai.action_information13)) sum13
7987 ,sum(fnd_number.canonical_to_number(pai.action_information14)) sum14
7988 ,sum(fnd_number.canonical_to_number(pai.action_information15)) sum15
7989 ,sum(fnd_number.canonical_to_number(pai.action_information16)) sum16
7990 ,sum(fnd_number.canonical_to_number(pai.action_information17)) sum17
7991 ,sum(fnd_number.canonical_to_number(pai.action_information18)) sum18
7992 ,sum(fnd_number.canonical_to_number(pai.action_information19)) sum19
7993 ,sum(fnd_number.canonical_to_number(pai.action_information20)) sum20
7994 ,sum(fnd_number.canonical_to_number(pai.action_information21)) sum21
7995 ,sum(fnd_number.canonical_to_number(pai.action_information22)) sum22
7996 ,sum(fnd_number.canonical_to_number(pai.action_information23)) sum23
7997 ,sum(fnd_number.canonical_to_number(pai.action_information24)) sum24
7998 ,sum(fnd_number.canonical_to_number(pai.action_information25)) sum25
7999 ,sum(fnd_number.canonical_to_number(pai.action_information26)) sum26
8000 ,sum(fnd_number.canonical_to_number(pai.action_information27)) sum27
8001 ,sum(fnd_number.canonical_to_number(pai.action_information28)) sum28
8002 ,sum(fnd_number.canonical_to_number(pai.action_information29)) sum29
8003 from pay_action_interlocks pal
8004 ,pay_action_information pai
8005 where pal.locking_action_id = c_assactid
8006 AND pal.locked_action_id = pai.action_context_id
8007 AND pai.action_context_type = 'AAP'
8008 AND pai.action_information_category = c_category
8009 AND pai.action_information1 = c_type ;
8010 --
8011 l_ovn pay_action_information.object_version_number%TYPE;
8012 l_action_info_id pay_action_information.action_information_id%TYPE;
8013 l_master_action_info_id pay_action_information.action_information_id%TYPE;
8014 l_empt_action_info_id pay_action_information.action_information_id%TYPE;
8015 l_action_context_id pay_action_information.action_context_id%TYPE;
8016 l_date DATE;
8017 --
8018 BEGIN
8019 --
8020 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN ARCHIVE_CODE');
8021 --
8022 FOR csr_action_info_rec IN csr_action_info('NL_WR_EMPLOYMENT_INFO','INITIAL',p_assignment_id) LOOP
8023 --
8024 l_empt_action_info_id := csr_action_info_rec.action_information_id;
8025 l_action_context_id := csr_action_info_rec.action_context_id;
8026 --
8027 pay_action_information_api.create_action_information (
8028 p_action_information_id => l_master_action_info_id
8029 ,p_action_context_id => p_assactid
8030 ,p_action_context_type => 'AAP'
8031 ,p_object_version_number => l_ovn
8032 ,p_assignment_id => csr_action_info_rec.assignment_id
8033 ,p_effective_date => p_effective_date
8034 ,p_source_id => NULL
8035 ,p_source_text => NULL
8036 ,p_tax_unit_id => l_tax_unit_id
8037 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
8038 ,p_action_information1 => 'INITIAL'
8039 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(p_start_date,trunc(p_end_date,'Y')))
8040 ,p_action_information3 => fnd_date.date_to_canonical(p_end_date)
8041 ,p_action_information4 => csr_action_info_rec.action_information4
8042 ,p_action_information5 => csr_action_info_rec.action_information5
8043 ,p_action_information6 => csr_action_info_rec.action_information6
8044 ,p_action_information7 => csr_action_info_rec.action_information7
8045 ,p_action_information8 => csr_action_info_rec.action_information8
8046 ,p_action_information9 => csr_action_info_rec.action_information9
8047 ,p_action_information10 => csr_action_info_rec.action_information10
8048 ,p_action_information11 => csr_action_info_rec.action_information11
8049 ,p_action_information12 => csr_action_info_rec.action_information12
8050 ,p_action_information13 => csr_action_info_rec.action_information13
8051 ,p_action_information14 => csr_action_info_rec.action_information14
8052 ,p_action_information15 => csr_action_info_rec.action_information15
8053 ,p_action_information16 => csr_action_info_rec.action_information16
8054 ,p_action_information17 => csr_action_info_rec.action_information17
8055 ,p_action_information18 => csr_action_info_rec.action_information18);
8056 --
8057 FOR csr_exception_info_rec IN csr_exception_info('NL_WR_EXCEPTION_REPORT',csr_action_info_rec.action_context_id) LOOP
8058 pay_action_information_api.create_action_information
8059 (
8060 p_action_information_id => l_action_info_id
8061 , p_action_context_id => p_assactid
8062 , p_action_context_type => 'AAP'
8063 , p_object_version_number => l_ovn
8064 , p_assignment_id => p_assignment_id
8065 , p_effective_date => p_effective_date
8066 , p_source_id => NULL
8067 , p_source_text => NULL
8068 , p_tax_unit_id => l_tax_unit_id
8069 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
8070 , p_action_information4 => csr_exception_info_rec.action_information4
8071 , p_action_information5 => csr_exception_info_rec.action_information5
8072 , p_action_information6 => csr_exception_info_rec.action_information6
8073 , p_action_information7 => csr_exception_info_rec.action_information7
8074 , p_action_information8 => csr_exception_info_rec.action_information8);
8075 END LOOP;
8076 --
8077 EXIT;
8078 --
8079 END LOOP;
8080 --
8081 FOR csr_ip_info_rec IN csr_ip_srg_info('NL_WR_INCOME_PERIOD','INITIAL',l_empt_action_info_id) LOOP
8082 --
8083 OPEN csr_get_income_start_date(p_assactid,p_assignment_id);
8084 FETCH csr_get_income_start_date INTO l_date;
8085 CLOSE csr_get_income_start_date;
8086 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN NL_WR_INCOME_PERIOD');
8087 --Fnd_file.put_line(FND_FILE.LOG,'~~## l_empt_action_info_id '||l_empt_action_info_id);
8088 pay_action_information_api.create_action_information (
8089 p_action_information_id => l_action_info_id
8090 ,p_action_context_id => p_assactid
8091 ,p_action_context_type => 'AAP'
8092 ,p_object_version_number => l_ovn
8093 ,p_assignment_id => csr_ip_info_rec.assignment_id
8094 ,p_effective_date => p_effective_date
8095 ,p_source_id => NULL
8096 ,p_source_text => NULL
8097 ,p_tax_unit_id => l_tax_unit_id
8098 ,p_action_information_category => 'NL_WR_INCOME_PERIOD'
8099 ,p_action_information1 => 'INITIAL'
8100 ,p_action_information2 => fnd_number.number_to_canonical(l_master_action_info_id)
8101 ,p_action_information3 => csr_ip_info_rec.action_information3
8102 ,p_action_information4 => csr_ip_info_rec.action_information4
8103 ,p_action_information5 => fnd_date.date_to_canonical(l_date) --fnd_date.date_to_canonical(p_start_date)
8104 ,p_action_information6 => csr_ip_info_rec.action_information6
8105 ,p_action_information7 => csr_ip_info_rec.action_information7
8106 ,p_action_information8 => csr_ip_info_rec.action_information8
8107 ,p_action_information9 => csr_ip_info_rec.action_information9
8108 ,p_action_information10 => csr_ip_info_rec.action_information10
8109 ,p_action_information11 => csr_ip_info_rec.action_information11
8110 ,p_action_information12 => csr_ip_info_rec.action_information12
8111 ,p_action_information13 => csr_ip_info_rec.action_information13
8112 ,p_action_information14 => csr_ip_info_rec.action_information14
8113 ,p_action_information15 => csr_ip_info_rec.action_information15
8114 ,p_action_information16 => csr_ip_info_rec.action_information16
8115 ,p_action_information17 => csr_ip_info_rec.action_information17
8116 ,p_action_information18 => csr_ip_info_rec.action_information18
8117 ,p_action_information19 => csr_ip_info_rec.action_information19
8118 ,p_action_information20 => csr_ip_info_rec.action_information20
8119 ,p_action_information21 => csr_ip_info_rec.action_information21
8120 ,p_action_information22 => csr_ip_info_rec.action_information22
8121 ,p_action_information23 => csr_ip_info_rec.action_information23
8122 ,p_action_information24 => csr_ip_info_rec.action_information24
8123 ,p_action_information25 => csr_ip_info_rec.action_information25
8124 ,p_action_information26 => csr_ip_info_rec.action_information26
8125 ,p_action_information27 => csr_ip_info_rec.action_information27);
8126 --
8127 END LOOP;
8128 --
8129 FOR csr_srg_info_rec IN csr_ip_srg_info('NL_WR_SWMF_SECTOR_RISK_GROUP','SECTOR_RISK_GROUP',l_empt_action_info_id) LOOP
8130 --
8131 OPEN csr_get_sector_start_date(p_assactid,p_assignment_id,csr_srg_info_rec.action_information7,csr_srg_info_rec.action_information8);
8132 FETCH csr_get_sector_start_date INTO l_date;
8133 CLOSE csr_get_sector_start_date;
8134 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN NL_WR_SWMF_SECTOR_RISK_GROUP');
8135 pay_action_information_api.create_action_information (
8136 p_action_information_id => l_action_info_id
8137 ,p_action_context_id => p_assactid
8138 ,p_action_context_type => 'AAP'
8139 ,p_object_version_number => l_ovn
8140 ,p_assignment_id => csr_srg_info_rec.assignment_id
8141 ,p_effective_date => p_effective_date
8142 ,p_source_id => NULL
8143 ,p_source_text => NULL
8144 ,p_tax_unit_id => l_tax_unit_id
8145 ,p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
8146 ,p_action_information1 => 'SECTOR_RISK_GROUP'
8147 ,p_action_information2 => fnd_number.number_to_canonical(l_master_action_info_id)
8148 ,p_action_information5 => fnd_date.date_to_canonical(l_date)--fnd_date.date_to_canonical(p_start_date)
8149 ,p_action_information6 => csr_srg_info_rec.action_information6--fnd_date.date_to_canonical(p_end_date)
8150 ,p_action_information7 => csr_srg_info_rec.action_information7
8151 ,p_action_information8 => csr_srg_info_rec.action_information8
8152 ,p_action_information9 => csr_srg_info_rec.action_information9
8153 ,p_action_information10 => csr_srg_info_rec.action_information10);
8154 --
8155 END LOOP;
8156 --
8157 FOR csr_address_info_rec IN csr_address_info('ADDRESS DETAILS','INITIAL',l_empt_action_info_id,l_action_context_id) LOOP
8158 --
8159 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN ADD Det');
8160 pay_action_information_api.create_action_information (
8161 p_action_information_id => l_action_info_id
8162 ,p_action_context_id => p_assactid
8163 ,p_action_context_type => 'AAP'
8164 ,p_object_version_number => l_ovn
8165 ,p_assignment_id => csr_address_info_rec.assignment_id
8166 ,p_effective_date => p_effective_date
8167 ,p_source_id => NULL
8168 ,p_source_text => NULL
8169 ,p_tax_unit_id => l_tax_unit_id
8170 ,p_action_information_category => 'ADDRESS DETAILS'
8171 ,p_action_information1 => csr_address_info_rec.action_information1
8172 ,p_action_information5 => csr_address_info_rec.action_information5
8173 ,p_action_information6 => csr_address_info_rec.action_information6
8174 ,p_action_information7 => csr_address_info_rec.action_information7
8175 ,p_action_information8 => csr_address_info_rec.action_information8
8176 ,p_action_information9 => csr_address_info_rec.action_information9
8177 ,p_action_information10 => csr_address_info_rec.action_information10
8178 ,p_action_information11 => csr_address_info_rec.action_information11
8179 ,p_action_information12 => csr_address_info_rec.action_information12
8180 ,p_action_information13 => csr_address_info_rec.action_information13
8181 ,p_action_information14 => csr_address_info_rec.action_information14
8182 ,p_action_information26 => 'INITIAL'
8183 ,p_action_information27 => fnd_number.number_to_canonical(l_master_action_info_id));
8184 --
8185 END LOOP;
8186 --
8187 FOR csr_nominative_info_rec IN csr_nominative_info('NL_WR_NOMINATIVE_REPORT','INITIAL',p_assactid) LOOP
8188 --
8189 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN NL_WR_NOMINATIVE_REPORT');
8190 pay_action_information_api.create_action_information (
8191 p_action_information_id => l_action_info_id
8192 ,p_action_context_id => p_assactid
8193 ,p_action_context_type => 'AAP'
8194 ,p_object_version_number => l_ovn
8195 ,p_assignment_id => p_assignment_id
8196 ,p_effective_date => p_effective_date
8197 ,p_source_id => NULL
8198 ,p_source_text => NULL
8199 ,p_tax_unit_id => l_tax_unit_id
8200 ,p_action_information_category => 'NL_WR_NOMINATIVE_REPORT'
8201 ,p_action_information1 => 'INITIAL'
8202 ,p_action_information2 => fnd_number.number_to_canonical(l_master_action_info_id)
8203 ,p_action_information3 => NULL
8204 ,p_action_information4 => NULL
8205 ,p_action_information5 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum5,2))
8206 ,p_action_information6 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum6,2))
8207 ,p_action_information7 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum7,2))
8208 ,p_action_information8 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum8,2))
8209 ,p_action_information9 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum9,2))
8210 ,p_action_information10 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum10,2))
8211 ,p_action_information11 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum11,2))
8212 ,p_action_information12 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum12,2))
8213 ,p_action_information13 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum13,2))
8214 ,p_action_information14 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum14,2))
8215 ,p_action_information15 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum15,2))
8216 ,p_action_information16 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum16,2))
8217 ,p_action_information17 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum17,2))
8218 ,p_action_information18 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum18,2))
8219 ,p_action_information19 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum19,2))
8220 ,p_action_information20 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum20,2))
8221 ,p_action_information21 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum21,2))
8222 ,p_action_information22 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum22,2))
8223 ,p_action_information23 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum23,2))
8224 ,p_action_information24 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum24,2))
8225 ,p_action_information25 => fnd_number.number_to_canonical(csr_nominative_info_rec.sum25)
8226 ,p_action_information26 => fnd_number.number_to_canonical(csr_nominative_info_rec.sum26)
8227 ,p_action_information27 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum27,2))
8228 ,p_action_information28 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum28,2))
8229 ,p_action_information29 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum29,2)));
8230 --
8231 END LOOP;
8232 --
8233 FOR csr_nominative_info_rec IN csr_nominative_info('NL_WR_NOMINATIVE_REPORT_ADD','INITIAL',p_assactid) LOOP
8234 --
8235 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN NL_WR_NOMINATIVE_REPORT');
8236 pay_action_information_api.create_action_information (
8237 p_action_information_id => l_action_info_id
8238 ,p_action_context_id => p_assactid
8239 ,p_action_context_type => 'AAP'
8240 ,p_object_version_number => l_ovn
8241 ,p_assignment_id => p_assignment_id
8242 ,p_effective_date => p_effective_date
8243 ,p_source_id => NULL
8244 ,p_source_text => NULL
8245 ,p_tax_unit_id => l_tax_unit_id
8246 ,p_action_information_category => 'NL_WR_NOMINATIVE_REPORT_ADD'
8247 ,p_action_information1 => 'INITIAL'
8248 ,p_action_information2 => fnd_number.number_to_canonical(l_master_action_info_id)
8249 ,p_action_information3 => NULL
8250 ,p_action_information4 => NULL
8251 ,p_action_information5 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum5,2))
8252 ,p_action_information6 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum6,2))
8253 ,p_action_information7 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum7,2))
8254 ,p_action_information8 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum8,2))
8255 ,p_action_information9 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum9,2))
8256 ,p_action_information10 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum10,2)));
8257 --
8258 END LOOP;
8259 --
8260 END archive_consolidate;
8261 --------------------------------------------------------------------------------
8262 -- POPULATE_NOM_BALNC_VAL_YRLY
8263 --------------------------------------------------------------------------------
8264 PROCEDURE populate_nom_balnc_val_yrly(p_master_assignment_action_id NUMBER
8265 ,p_assignment_action_id NUMBER
8266 ,p_effective_date DATE
8267 ,p_tax_unit_id NUMBER
8268 ,p_type VARCHAR2
8269 ,p_record_type VARCHAR2
8270 ,p_corr_used IN OUT NOCOPY VARCHAR2
8271 ,p_balance_values IN OUT NOCOPY Bal_Value) IS --SR2
8272 --
8273 l_balance_date DATE;
8274 l_context_id NUMBER;
8275 l_source_text VARCHAR2(50);
8276 l_source_text2 VARCHAR2(50);
8277 l_assignment_action_id NUMBER;
8278 l_context VARCHAR2(1);
8279 l_tax_unit_id NUMBER;
8280 --
8281 CURSOR cur_act_contexts(p_context_name VARCHAR2 )IS
8282 SELECT ffc.context_id
8283 FROM ff_contexts ffc
8284 WHERE ffc.context_name = p_context_name;
8285 --
8286 BEGIN
8287 --
8288 p_balance_values.delete;
8289 FOR i IN g_nom_bal_def_table.FIRST..g_nom_bal_def_table.LAST LOOP
8290 p_balance_values(i).balance_value := 0;
8291 /*IF g_nom_bal_def_table(i).database_item_suffix IS NOT NULL THEN
8292 g_nom_bal_def_table(i).defined_balance_id := get_defined_balance_id(g_nom_bal_def_table(i).balance_name
8293 ,g_nom_bal_def_table(i).database_item_suffix);
8294 Fnd_file.put_line(FND_FILE.LOG,'#### g_nom_bal_def_table(i).defined_balance_id '||g_nom_bal_def_table(i).defined_balance_id);
8295 END IF;*/
8296 IF g_nom_bal_def_table(i).defined_balance_id <> 0 THEN
8297 Fnd_file.put_line(FND_FILE.LOG,'#### Point 1');
8298 l_assignment_action_id := p_assignment_action_id;
8299 l_context := 'N';
8300 l_balance_date := NULL;
8301 l_context_id := NULL;
8302 l_source_text := NULL;
8303 l_source_text2 := NULL;
8304 l_tax_unit_id := p_tax_unit_id;
8305 --
8306 IF g_nom_bal_def_table(i).database_item_suffix LIKE '%/_SIT/_%' ESCAPE '/' THEN
8307 OPEN cur_act_contexts('SOURCE_TEXT');
8308 FETCH cur_act_contexts INTO l_context_id;
8309 CLOSE cur_act_contexts;
8310 l_source_text := g_nom_bal_def_table(i).context_val;
8311 l_context := 'Y';
8312 END IF;
8313 --
8314 Fnd_file.put_line(FND_FILE.LOG,'#### p_assignment_action_id '||p_assignment_action_id);
8315 IF p_assignment_action_id = 0 OR p_assignment_action_id is NULL THEN
8316 p_balance_values(i).balance_value := 0;
8317 ELSE
8318 IF l_context = 'Y' THEN
8319 BEGIN
8320 Fnd_file.put_line(FND_FILE.LOG,'#### Point 2');
8321 p_balance_values(i).balance_value := pay_balance_pkg.get_value
8322 (p_defined_balance_id => g_nom_bal_def_table(i).defined_balance_id
8323 ,p_assignment_action_id => l_assignment_action_id
8324 ,p_tax_unit_id => p_tax_unit_id
8325 ,p_jurisdiction_code => NULL
8326 ,p_source_id => l_context_id
8327 ,p_source_text => l_source_text
8328 ,p_tax_group => NULL
8329 ,p_date_earned => NULL
8330 ,p_get_rr_route => NULL
8331 ,p_get_rb_route => NULL
8332 ,p_source_text2 => l_source_text2
8333 ,p_source_number => NULL
8334 ,p_time_def_id => NULL
8335 ,p_balance_date => l_balance_date
8336 ,p_payroll_id => NULL);
8337 Fnd_file.put_line(FND_FILE.LOG,'#########p_balance_values(i).balance_value'||p_balance_values(i).balance_value);
8338 EXCEPTION
8339 WHEN OTHERS THEN
8340 p_balance_values(i).balance_value := 0;
8341 END;
8342 ELSE
8343 BEGIN
8344 Fnd_file.put_line(FND_FILE.LOG,'#### Point 3');
8345 p_balance_values(i).balance_value := pay_balance_pkg.get_value
8346 (p_defined_balance_id => g_nom_bal_def_table(i).defined_balance_id
8347 ,p_assignment_action_id => l_assignment_action_id
8348 ,p_tax_unit_id => p_tax_unit_id
8349 ,p_jurisdiction_code => NULL
8350 ,p_source_id => NULL
8351 ,p_source_text => NULL
8352 ,p_tax_group => NULL
8353 ,p_date_earned => NULL
8354 ,p_get_rr_route => NULL
8355 ,p_get_rb_route => NULL
8356 ,p_source_text2 => NULL
8357 ,p_source_number => NULL
8358 ,p_time_def_id => NULL
8359 ,p_balance_date => NULL
8360 ,p_payroll_id => NULL);
8361 Fnd_file.put_line(FND_FILE.LOG,'#########'||p_balance_values(i).balance_value);
8362 EXCEPTION
8363 WHEN OTHERS THEN
8364 p_balance_values(i).balance_value := 0;
8365 END;
8366 END IF;
8367 END IF;
8368 END IF;
8369 END LOOP;
8370 --
8371 END populate_nom_balnc_val_yrly;
8372 --------------------------------------------------------------------------------
8373 -- ARCHIVE_YEAR_END
8374 --------------------------------------------------------------------------------
8375 PROCEDURE archive_year_end(p_assactid NUMBER
8376 ,p_assignment_id NUMBER
8377 ,p_effective_date DATE
8378 ,p_business_gr_id NUMBER
8379 ,p_tax_unit_id NUMBER
8380 ,p_chk_start_date DATE
8381 ,p_chk_end_date DATE
8382 ,p_payroll_type VARCHAR2) IS
8383
8384
8385 CURSOR csr_get_emp_data(c_assignment_id NUMBER
8386 ,c_effective_date DATE) IS
8387 SELECT pap.person_id
8388 ,pap.national_identifier sofi_number
8389 ,pap.employee_number
8390 ,pap.nationality
8391 ,pap.date_of_birth dob
8392 ,pap.pre_name_adjunct prefix
8393 ,pap.last_name
8394 ,UPPER(replace(replace(pap.per_information1,'.',''),' ','')) initials
8395 ,decode(pap.sex,'M',1,'F',2,NULL) gender
8396 ,paaf.assignment_id
8397 ,paaf.change_reason
8398 ,paaf.assignment_number
8399 ,paaf.assignment_sequence
8400 ,paaf.employment_category
8401 ,paaf.employee_category
8402 ,paaf.collective_agreement_id
8403 ,paaf.effective_start_date
8404 ,paaf.soft_coding_keyflex_id
8405 ,paaf.assignment_status_type_id
8406 ,paaf.payroll_id
8407 ,paaf.primary_flag
8408 FROM per_all_assignments_f paaf
8409 ,per_all_people_f pap
8410 WHERE paaf.assignment_id = c_assignment_id
8411 AND paaf.person_id = pap.person_id
8412 AND c_effective_date BETWEEN paaf.effective_start_date
8413 AND paaf.effective_end_date
8414 AND c_effective_date BETWEEN pap.effective_start_date
8415 AND pap.effective_end_date;
8416 --
8417 CURSOR csr_get_cao_code(c_collective_agreement_id NUMBER) IS
8418 SELECT pca.cag_information1
8419 FROM per_collective_agreements pca
8420 WHERE pca.collective_agreement_id = c_collective_agreement_id
8421 AND pca.cag_information_category= 'NL';
8422 --
8423 CURSOR csr_get_assignment_action_id(c_assignment_id NUMBER
8424 ,c_date DATE) IS
8425 SELECT max(paa.assignment_action_id) assignment_action_id
8426 FROM pay_assignment_actions paa
8427 ,pay_payroll_actions ppa
8428 ,per_time_periods ptp
8429 WHERE paa.assignment_id = c_assignment_id
8430 AND ppa.payroll_action_id = paa.payroll_action_id
8431 AND ppa.action_type IN ('R','Q')
8432 AND paa.ACTION_STATUS = 'C'
8433 AND ppa.ACTION_STATUS = 'C'
8434 --AND ppa.date_earned between c_start_date AND c_end_date;
8435 AND ppa.time_period_id = ptp.time_period_id
8436 AND c_date BETWEEN ptp.start_date AND ptp.end_date;
8437 --
8438 CURSOR csr_get_assignment_action_id2(c_assignment_id NUMBER
8439 ,c_date DATE
8440 ,c_end_date DATE) IS
8441 SELECT max(paa.assignment_action_id) assignment_action_id
8442 FROM pay_assignment_actions paa
8443 ,pay_payroll_actions ppa
8444 ,per_time_periods ptp
8445 WHERE paa.assignment_id = c_assignment_id
8446 AND ppa.payroll_action_id = paa.payroll_action_id
8447 AND ppa.action_type IN ('R','Q','I','B')
8448 AND paa.ACTION_STATUS = 'C'
8449 AND ppa.ACTION_STATUS = 'C'
8450 -- AND ppa.date_earned between c_start_date AND c_end_date;
8451 AND ppa.time_period_id = ptp.time_period_id
8452 AND ptp.end_date BETWEEN c_date AND c_end_date;
8453 --
8454 CURSOR csr_get_shared_types(c_code VARCHAR2
8455 ,c_business_gr_id NUMBER
8456 ,c_lookup VARCHAR2) IS
8457 SELECT business_group_id,system_type_cd
8458 FROM per_shared_types
8459 WHERE lookup_type = c_lookup --'NL_NATIONALITY'
8460 AND information1 = c_code
8461 AND (business_group_id = c_business_gr_id
8462 OR business_group_id is NULL)
8463 ORDER BY 1;
8464 --
8465 CURSOR csr_get_period(c_payroll_id NUMBER,c_date DATE) IS
8466 SELECT ptp.start_date,ptp.end_date
8467 FROM per_time_periods ptp
8468 WHERE ptp.payroll_id = c_payroll_id
8469 AND c_date between ptp.start_date and ptp.end_date;
8470 --
8471 CURSOR csr_get_element_det(c_element_name VARCHAR2
8472 ,c_input_val_name VARCHAR2
8473 ,c_assignment_id NUMBER
8474 ,c_eff_date DATE) IS
8475 SELECT peev.screen_entry_value
8476 FROM pay_element_types_f pet
8477 ,pay_input_values_f piv
8478 ,pay_element_entries_f peef
8479 ,pay_element_entry_values_f peev
8480 WHERE pet.element_name = c_element_name
8481 AND pet.element_type_id = piv.element_type_id
8482 AND piv.name = c_input_val_name
8483 AND pet.legislation_code = 'NL'
8484 AND piv.legislation_code = 'NL'
8485 AND peef.assignment_id = c_assignment_id
8486 AND peef.element_entry_id = peev.element_entry_id
8487 AND peef.element_type_id = pet.element_type_id
8488 AND peev.input_value_id = piv.input_value_id
8489 AND c_eff_date BETWEEN piv.effective_start_date
8490 AND piv.effective_end_date
8491 AND c_eff_date BETWEEN pet.effective_start_date
8492 AND pet.effective_end_date
8493 AND c_eff_date BETWEEN peev.effective_start_date
8494 AND peev.effective_end_date
8495 AND c_eff_date BETWEEN peef.effective_start_date
8496 AND peef.effective_end_date;
8497 --
8498 CURSOR csr_get_element_name2(c_element_entry_value_id NUMBER
8499 ,c_eff_date DATE) IS
8500 SELECT pet.element_name
8501 ,peev.screen_entry_value
8502 FROM pay_element_types_f pet
8503 ,pay_element_entries_f peef
8504 ,pay_element_entry_values_f peev
8505 WHERE peev.element_entry_value_id = c_element_entry_value_id
8506 AND peev.element_entry_id = peef.element_entry_id
8507 AND peef.element_type_id = pet.element_type_id
8508 AND pet.legislation_code = 'NL'
8509 AND c_eff_date BETWEEN pet.effective_start_date
8510 AND pet.effective_end_date
8511 AND c_eff_date BETWEEN peev.effective_start_date
8512 AND peev.effective_end_date
8513 AND c_eff_date BETWEEN peef.effective_start_date
8514 AND peef.effective_end_date;
8515 --
8516 CURSOR csr_get_element_name1(c_element_entry_id NUMBER
8517 ,c_eff_date DATE) IS
8518 SELECT pet.element_name
8519 ,peev.screen_entry_value
8520 FROM pay_element_types_f pet
8521 ,pay_element_entries_f peef
8522 ,pay_element_entry_values_f peev
8523 WHERE peef.element_entry_id = c_element_entry_id
8524 AND peev.element_entry_id = peef.element_entry_id
8525 AND peef.element_type_id = pet.element_type_id
8526 AND pet.legislation_code = 'NL'
8527 AND c_eff_date BETWEEN pet.effective_start_date
8528 AND pet.effective_end_date
8529 AND c_eff_date BETWEEN peev.effective_start_date
8530 AND peev.effective_end_date
8531 AND c_eff_date BETWEEN peef.effective_start_date
8532 AND peef.effective_end_date; /*assuming one input value*/
8533 --
8534 CURSOR csr_get_eit_cao(c_assignment_id NUMBER) IS
8535 SELECT aei_information5
8536 FROM per_assignment_extra_info
8537 WHERE assignment_id = c_assignment_id
8538 AND aei_information_category IN ('NL_CADANS_INFO');
8539 --
8540 CURSOR csr_ass_start_date(c_assignment_id NUMBER) IS
8541 SELECT min(effective_start_date)
8542 --,decode(max(effective_end_date),to_date('31-12-4712','dd-mm-yyyy'),null,max(effective_end_date))
8543 FROM per_all_assignments_F paaf
8544 ,PER_ASSIGNMENT_STATUS_TYPES ast
8545 WHERE paaf.assignment_id = c_assignment_id
8546 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
8547 AND ast.per_system_status = 'ACTIVE_ASSIGN';
8548 --
8549 CURSOR csr_ass_end_date(c_assignment_id NUMBER) IS
8550 SELECT decode(max(effective_end_date),to_date('31-12-4712','dd-mm-yyyy'),null,max(effective_end_date))
8551 FROM per_all_assignments_F paaf
8552 ,PER_ASSIGNMENT_STATUS_TYPES ast
8553 WHERE paaf.assignment_id = c_assignment_id
8554 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
8555 AND ast.per_system_status <> 'TERM_ASSIGN';
8556 --
8557 CURSOR csr_ass_end_date2(c_assignment_id NUMBER) IS
8558 SELECT min(effective_start_date)
8559 FROM per_all_assignments_F paaf
8560 ,PER_ASSIGNMENT_STATUS_TYPES ast
8561 WHERE paaf.assignment_id = c_assignment_id
8562 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
8563 AND ast.per_system_status = 'TERM_ASSIGN';
8564 --
8565 --soft_coding_keyflex_id
8566 l_nationality per_shared_types.INFORMATION1%type;
8567 l_assignment_catg per_shared_types.INFORMATION1%type;
8568 l_assignment_catg_old per_shared_types.INFORMATION1%type;
8569 l_emp_rec csr_get_emp_data%rowtype;
8570 l_rec_changes Rec_Changes;
8571 l_rec_changes_init Rec_Changes;
8572 l_master_action_info_id pay_action_information.action_information_id%type;
8573 l_action_info_id pay_action_information.action_information_id%TYPE;
8574 l_period_start_date DATE;
8575 l_period_end_date DATE;
8576 l_rec_start_date DATE;
8577 l_emp_end_date DATE;
8578 -- SCL Segment variables
8579 l_income_code hr_soft_coding_keyflex.segment1%type;
8580 l_work_pattern hr_soft_coding_keyflex.segment1%type;
8581 l_wage_tax_discount hr_soft_coding_keyflex.segment1%type;
8582 l_wage_tax_table hr_soft_coding_keyflex.segment1%type;
8583 l_wage_aow hr_soft_coding_keyflex.segment1%type;
8584 l_wage_wajong hr_soft_coding_keyflex.segment1%type;
8585 l_emp_loan hr_soft_coding_keyflex.segment1%type;
8586 l_transportation hr_soft_coding_keyflex.segment1%type;
8587 --
8588 l_labour_rel_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
8589 l_ins_duty_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
8590 l_FZ_Code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
8591 l_handicapped_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
8592 l_wao_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
8593 l_ww_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
8594 l_zw_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
8595 l_zvw_situation PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
8596 l_zvw_defaulted VARCHAR2(1);
8597 --
8598 l_assignment_id NUMBER;
8599 l_chk VARCHAR2(2);
8600 p_date DATE;
8601 l_retro VARCHAR2(10);
8602 l_type VARCHAR2(10);
8603 l_ovn pay_action_information.object_version_number%type;
8604 l_cao_code per_collective_agreements.CAG_INFORMATION1%type;
8605 l_old_cao_code per_collective_agreements.CAG_INFORMATION1%type;
8606 l_bal_value Bal_Value;
8607 l_nom_bal_value Bal_Value;
8608 l_ret_table Ret_Table;
8609 l_assignment_action_id NUMBER;
8610 l_master_assignment_action_id NUMBER;
8611 ele_end_date DATE;
8612 l_bg NUMBER;
8613 l_table1 pay_dated_tables.dated_table_id%type;
8614 l_table2 pay_dated_tables.dated_table_id%type;
8615 l_table3 pay_dated_tables.dated_table_id%type;
8616 l_ass_start_date DATE;
8617 l_ass_end_date DATE;
8618 --
8619 l_holiday_coupen pay_element_entry_values_f.screen_entry_value%TYPE;
8620 l_income_increase pay_element_entry_values_f.screen_entry_value%TYPE;
8621 l_add_allowance pay_element_entry_values_f.screen_entry_value%TYPE;
8622 l_company_car_use pay_element_entry_values_f.screen_entry_value%TYPE;
8623 l_val pay_element_entry_values_f.screen_entry_value%TYPE;
8624 l_element_name VARCHAR2(30);
8625 --
8626 l_cnt1 NUMBER;
8627 l_cnt2 NUMBER;
8628 l_cnt3 NUMBER;
8629 --
8630 l_srg_flag VARCHAR2(1);
8631 l_corr_used VARCHAR2(1);
8632 --
8633 CURSOR get_scl_id(c_assignment_id NUMBER
8634 ,c_start_date DATE) IS
8635 SELECT paaf.soft_coding_keyflex_id
8636 FROM per_all_assignments_f paaf
8637 WHERE assignment_id = c_assignment_id
8638 AND c_start_date BETWEEN paaf.effective_start_date
8639 AND paaf.effective_end_date;
8640 --
8641 CURSOR csr_get_col_agreement_id (c_assignment_id NUMBER
8642 ,c_eff_date DATE) IS
8643 SELECT collective_agreement_id
8644 FROM per_All_assignments_F
8645 WHERE assignment_id = c_assignment_id
8646 AND c_eff_date BETWEEN effective_start_date AND effective_end_date;
8647 --
8648 --
8649 l_asg_id NUMBER;
8650 l_pay_act_id NUMBER;
8651 --
8652 l_scl_id per_all_assignments_f.soft_coding_keyflex_id%TYPE;
8653 --
8654 l_initial_flag VARCHAR2(1);
8655 l_emp_seq per_all_Assignments_f.assignment_number%type;
8656 --
8657 BEGIN
8658 --Fnd_file.put_line(FND_FILE.LOG,' Start chk_events');
8659 --Fnd_file.put_line(FND_FILE.LOG,' Assignment ID :'||p_assignment_id);
8660 l_assignment_id := p_assignment_id;
8661 --
8662 OPEN csr_ass_start_date(l_assignment_id);
8663 FETCH csr_ass_start_date INTO l_ass_start_date;
8664 CLOSE csr_ass_start_date;
8665 --
8666 OPEN csr_ass_end_date(l_assignment_id);
8667 FETCH csr_ass_end_date INTO l_ass_end_date;
8668 CLOSE csr_ass_end_date;
8669 --
8670 l_emp_end_date := NULL;
8671 IF l_ass_end_date <= p_chk_end_date THEN
8672 l_emp_end_date := l_ass_end_date;
8673 END IF;
8674 p_date := LEAST(p_chk_end_date,NVL(l_emp_end_date,p_chk_end_date));
8675 --Fnd_file.put_line(FND_FILE.LOG,' Get employee Data on : '||p_date);
8676 OPEN csr_get_emp_data(l_assignment_id,p_date);
8677 FETCH csr_get_emp_data INTO l_emp_rec;
8678 CLOSE csr_get_emp_data;
8679 --
8680 l_emp_seq := NULL;
8681 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
8682 l_emp_seq := l_emp_rec.assignment_sequence;
8683 END IF;
8684 --
8685 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5') THEN
8686 l_emp_rec.change_reason := NULL;
8687 END IF;
8688 --
8689 OPEN csr_get_shared_types(l_emp_rec.nationality,p_business_gr_id,'NL_NATIONALITY');
8690 FETCH csr_get_shared_types INTO l_bg,l_nationality;
8691 CLOSE csr_get_shared_types;
8692 --
8693 l_type := 'INITIAL';
8694 pay_action_information_api.create_action_information (
8695 p_action_information_id => l_master_action_info_id
8696 ,p_action_context_id => p_assactid
8697 ,p_action_context_type => 'AAP'
8698 ,p_object_version_number => l_ovn
8699 ,p_assignment_id => l_emp_rec.assignment_id
8700 ,p_effective_date => p_effective_date
8701 ,p_source_id => NULL
8702 ,p_source_text => NULL
8703 ,p_tax_unit_id => p_tax_unit_id
8704 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
8705 ,p_action_information1 => l_type
8706 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(p_chk_start_date,trunc(p_chk_end_date,'Y')))
8707 ,p_action_information3 => fnd_date.date_to_canonical(p_chk_end_date)
8708 ,p_action_information4 => l_emp_rec.assignment_number
8709 ,p_action_information5 => l_emp_rec.employee_number
8710 ,p_action_information6 => l_emp_rec.change_reason
8711 ,p_action_information8 => l_emp_rec.sofi_number
8712 ,p_action_information7 => l_emp_rec.person_id
8713 ,p_action_information9 => NULL -- l_emp_rec.Initials
8714 ,p_action_information10 => NULL -- l_emp_rec.prefix
8715 ,p_action_information11 => l_emp_rec.last_name
8716 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
8717 ,p_action_information13 => NULL -- l_nationality
8718 ,p_action_information14 => NULL -- l_emp_rec.gender
8719 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
8720 ,p_action_information16 => fnd_date.date_to_canonical(l_ass_end_date)
8721 ,p_action_information17 => NULL
8722 ,p_action_information18 => l_emp_seq);
8723
8724 IF g_contract_code_mapping = 'NL_EMPLOYMENT_CATG' THEN
8725 OPEN csr_get_shared_types(l_emp_rec.employment_category,p_business_gr_id,g_contract_code_mapping);
8726 FETCH csr_get_shared_types INTO l_bg,l_assignment_catg;
8727 CLOSE csr_get_shared_types;
8728 ELSE
8729 OPEN csr_get_shared_types(l_emp_rec.employee_category,p_business_gr_id,g_contract_code_mapping);
8730 FETCH csr_get_shared_types INTO l_bg,l_assignment_catg;
8731 CLOSE csr_get_shared_types;
8732 END IF;
8733 --
8734 l_income_code := 'N';
8735 l_work_pattern := 'N';
8736 l_wage_tax_discount := 'N';
8737 l_wage_tax_table := 'N';
8738 l_wage_aow := 'N';
8739 l_wage_wajong := 'N';
8740 l_emp_loan := 'N';
8741 l_transportation := 'N';
8742 --Fnd_file.put_line(FND_FILE.LOG,' Get scl Data '||l_emp_rec.soft_coding_keyflex_id);
8743 get_scl_data(l_emp_rec.soft_coding_keyflex_id
8744 ,p_chk_end_date
8745 ,l_income_code
8746 ,l_work_pattern
8747 ,l_wage_tax_discount
8748 ,l_wage_tax_table
8749 ,l_wage_aow
8750 ,l_wage_wajong
8751 ,l_emp_loan
8752 ,l_transportation
8753 ,l_chk);
8754 --Fnd_file.put_line(FND_FILE.LOG,' Get Assignment EIT Data :'||l_assignment_id);
8755 get_assignment_extra_info(l_assignment_id -- pick data for p_date
8756 ,NULL
8757 ,p_date
8758 ,p_chk_start_date
8759 ,p_chk_end_date
8760 ,l_labour_rel_code
8761 ,l_ins_duty_code
8762 ,l_FZ_Code
8763 ,l_handicapped_code
8764 ,l_wao_insured
8765 ,l_ww_insured
8766 ,l_zw_insured
8767 ,l_zvw_situation
8768 ,l_chk);
8769 --
8770 l_zvw_defaulted := NULL;
8771 IF l_zvw_situation IS NULL THEN
8772 l_zvw_situation := 'A';
8773 l_zvw_defaulted := 'Y';
8774 END IF;
8775 --
8776 /*OPEN csr_get_element_det('Holiday Coupons','Receiving Coupons',l_assignment_id,p_date);
8777 FETCH csr_get_element_det INTO l_holiday_coupen;
8778 CLOSE csr_get_element_det;
8779 IF l_holiday_coupen = 'Y' THEN
8780 l_holiday_coupen := 'J';
8781 END IF;
8782 --
8783 OPEN csr_get_element_det('Incidental Income Decrease','Decrease Code',l_assignment_id,p_date);
8784 FETCH csr_get_element_det INTO l_income_increase;
8785 CLOSE csr_get_element_det;
8786 --
8787 OPEN csr_get_element_det('Additional Allowance','Receiving Allowance',l_assignment_id,p_date);
8788 FETCH csr_get_element_det INTO l_add_allowance;
8789 CLOSE csr_get_element_det;
8790 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
8791 l_add_allowance := NULL;
8792 ELSIF l_add_allowance = 'Y' THEN
8793 l_add_allowance := 'J';
8794 END IF; */
8795 --
8796 OPEN csr_get_element_det('Company Car Private Usage','Code Usage',l_assignment_id,p_date);
8797 FETCH csr_get_element_det INTO l_company_car_use;
8798 CLOSE csr_get_element_det;
8799 --
8800 --Fnd_file.put_line(FND_FILE.LOG,' Get Element Data :');
8801 --Fnd_file.put_line(FND_FILE.LOG,' l_company_car_use :'||l_company_car_use);
8802 --
8803 /* IF l_emp_rec.collective_agreement_id IS NULL THEN
8804 OPEN csr_get_eit_cao(l_emp_rec.assignment_id);
8805 FETCH csr_get_eit_cao INTO l_cao_code;
8806 CLOSE csr_get_eit_cao;
8807 --Fnd_file.put_line(FND_FILE.LOG,' Collective Agreement id null get from eit :'||l_cao_code);
8808 ELSE
8809 OPEN csr_get_cao_code(l_emp_rec.collective_agreement_id);
8810 FETCH csr_get_cao_code INTO l_cao_code;
8811 CLOSE csr_get_cao_code;
8812 --Fnd_file.put_line(FND_FILE.LOG,' Collective Agreement id not null get from collective agreement table. :'||l_cao_code);
8813 END IF;*/
8814
8815 pay_action_information_api.create_action_information (
8816 p_action_information_id => l_action_info_id
8817 , p_action_context_id => p_assactid
8818 , p_action_context_type => 'AAP'
8819 , p_object_version_number => l_ovn
8820 , p_assignment_id => l_emp_rec.assignment_id
8821 , p_effective_date => p_effective_date
8822 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
8823 , p_tax_unit_id => p_tax_unit_id
8824 , p_action_information1 => l_type
8825 , p_action_information2 => l_master_action_info_id
8826 , p_action_information5 => fnd_date.date_to_canonical(GREATEST(GREATEST(p_chk_start_date,l_ass_start_date),trunc(p_chk_end_date,'Y'))) /*** EOY 0708 ...Start Date Income Peiod ***/
8827 , p_action_information6 => l_income_code
8828 , p_action_information7 => l_labour_rel_code
8829 , p_action_information8 => l_ins_duty_code
8830 , p_action_information9 => l_assignment_catg
8831 , p_action_information10 => l_FZ_Code
8832 , p_action_information11 => NULL -- l_work_pattern
8833 , p_action_information12 => NULL -- l_cao_code
8834 , p_action_information13 => l_handicapped_code
8835 , p_action_information14 => l_wage_tax_discount
8836 , p_action_information15 => l_company_car_use
8837 , p_action_information16 => l_wage_tax_table
8838 , p_action_information17 => l_wao_insured
8839 , p_action_information18 => l_ww_insured
8840 , p_action_information19 => l_zw_insured
8841 , p_action_information20 => NVL(l_zvw_situation,'A')
8842 , p_action_information21 => NULL -- l_holiday_coupen
8843 , p_action_information22 => l_wage_aow
8844 , p_action_information23 => l_wage_wajong
8845 , p_action_information24 => l_emp_loan
8846 , p_action_information25 => l_transportation
8847 , p_action_information26 => NULL -- l_income_increase
8848 , p_action_information27 => NULL); -- l_add_allowance);
8849
8850 --Fnd_file.put_line(FND_FILE.LOG,' Creating NL_WR_EMPLOYMENT_INFO INfor Record for Type :'||l_type||' Date :'||l_period_start_date);
8851 --
8852 -- archive employee address not required for YEarly report
8853 /*archive_emp_address(p_assactid -- address not req for year end rep
8854 ,l_emp_rec.person_id
8855 ,l_emp_rec.assignment_id
8856 ,l_emp_rec.assignment_number
8857 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
8858 ,p_tax_unit_id
8859 ,l_master_action_info_id
8860 ,p_effective_date
8861 ,NVL(l_emp_end_date,p_chk_end_date)
8862 ,l_type);*/
8863 -- archive sector information for assignment
8864 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Sector Risk Group Record for Type :'||l_type);
8865 l_srg_flag := archive_sector_risk_group(p_assactid
8866 ,l_emp_rec.assignment_id
8867 ,p_effective_date
8868 ,p_tax_unit_id
8869 ,l_master_action_info_id
8870 ,p_chk_start_date
8871 ,p_chk_end_date
8872 ,l_ass_start_date
8873 ,l_emp_end_date
8874 ,p_payroll_type);
8875 --archive nominative info
8876 l_assignment_action_id := NULL;
8877 OPEN csr_get_assignment_action_id2(l_emp_rec.assignment_id,p_chk_start_date,p_chk_end_date);
8878 FETCH csr_get_assignment_action_id2 INTO l_assignment_action_id;
8879 CLOSE csr_get_assignment_action_id2;
8880 Fnd_file.put_line(FND_FILE.LOG,' l_assignment_action_id in year-end:'||l_assignment_action_id); --
8881 populate_nom_balnc_val_yrly(l_assignment_action_id
8882 ,l_assignment_action_id
8883 ,l_period_end_date
8884 ,p_tax_unit_id
8885 ,l_type
8886 ,'HR'
8887 ,l_corr_used
8888 ,l_bal_value);
8889 Fnd_file.put_line(FND_FILE.LOG,' l_bal_value :'||l_bal_value(1).balance_value||','||l_bal_value(2).balance_value); --
8890 get_nominative_data(l_bal_value,l_nom_bal_value);
8891 --
8892 Fnd_file.put_line(FND_FILE.LOG,' l_nom_bal_value :'||l_nom_bal_value(1).balance_value);
8893 archive_nominative_data(p_assactid
8894 ,l_emp_rec.assignment_id
8895 ,p_tax_unit_id
8896 ,p_effective_date
8897 ,p_effective_date
8898 ,l_type
8899 ,l_master_action_info_id
8900 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
8901 ,l_corr_used
8902 ,p_payroll_type
8903 ,l_nom_bal_value);
8904 EXCEPTION
8905 WHEN OTHERS THEN
8906 --Fnd_file.put_line(FND_FILE.LOG,' Others. Assignment :'||l_assignment_id);
8907 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
8908 NULL;
8909 END archive_year_end;
8910 --------------------------------------------------------------------------------
8911 -- ARCHIVE_CODE
8912 --------------------------------------------------------------------------------
8913 PROCEDURE archive_code (p_assactid in number,
8914 p_effective_date in date) IS
8915 --
8916 l_assignment_id per_all_assignments_f.assignment_id%type;
8917 l_business_group_id NUMBER;
8918 l_pactid NUMBER;
8919 l_end_date DATE;
8920 l_start_date DATE;
8921 l_tax_unit_id NUMBER;
8922 l_payroll_type VARCHAR2(10);
8923 l_seq_no VARCHAR2(15);
8924 --
8925 BEGIN
8926 -- get Employee data
8927 --hr_utility.trace_on(null,'NL_WR');
8928 --
8929 --Fnd_file.put_line(FND_FILE.LOG,' Entering Archive Code for Assignment :'||p_assactid);
8930 select payroll_action_id,assignment_id
8931 into l_pactid, l_assignment_id
8932 from pay_assignment_actions
8933 where assignment_action_id = p_assactid;
8934 --
8935 get_all_parameters (l_pactid
8936 ,l_business_group_id
8937 ,l_start_date
8938 ,l_end_date
8939 ,l_tax_unit_id
8940 ,l_payroll_type
8941 ,l_seq_no);
8942 --
8943 IF l_payroll_type = 'FOUR_WEEK' THEN
8944 --Fnd_file.put_line(FND_FILE.LOG,' Calling archive_consolidate');
8945 archive_consolidate(p_assactid,l_assignment_id,p_effective_date,l_business_group_id,l_tax_unit_id,l_start_date,l_end_date,l_payroll_type);
8946 ELSIF l_payroll_type = 'YEARLY' THEN
8947 --Fnd_file.put_line(FND_FILE.LOG,' Calling archive_year_end');
8948 archive_year_end(p_assactid,l_assignment_id,p_effective_date,l_business_group_id,l_tax_unit_id,l_start_date,l_end_date,l_payroll_type);
8949 ELSE
8950 --Fnd_file.put_line(FND_FILE.LOG,' Calling chk_events');
8951 chk_events(p_assactid,l_assignment_id,p_effective_date,l_business_group_id,l_tax_unit_id,l_start_date,l_end_date,l_payroll_type);
8952 END IF;
8953 --Fnd_file.put_line(FND_FILE.LOG,' Leaving Archive Code');
8954 --
8955 END archive_code;
8956 --
8957 --------------------------------------------------------------------------------
8958 -- GET_ARCHIVE_DETAILS
8959 --------------------------------------------------------------------------------
8960 FUNCTION get_archive_details(p_actid IN NUMBER) RETURN VARCHAR2
8961 IS
8962 --
8963 CURSOR csr_get_org_name (c_payroll_action_id NUMBER) IS
8964 SELECT action_information9
8965 FROM pay_action_information pai
8966 WHERE action_context_id = c_payroll_action_id
8967 AND action_context_type = 'PA'
8968 AND action_information_category = 'NL_WR_EMPLOYER_INFO';
8969 --
8970 CURSOR csr_chk_exception (c_payroll_action_id NUMBER) IS
8971 SELECT 'EXCEPTION'
8972 FROM DUAL
8973 WHERE EXISTS (SELECT 1
8974 FROM pay_action_information pai
8975 WHERE action_context_id = c_payroll_action_id
8976 AND action_information_category = 'NL_WR_EXCEPTION_REPORT')
8977 OR EXISTS (SELECT 1
8978 FROM pay_assignment_actions paa
8979 ,pay_action_information pai
8980 WHERE paa.payroll_action_id = c_payroll_action_id
8981 AND pai.action_context_id = paa.assignment_action_id
8982 AND pai.action_information_category = 'NL_WR_EXCEPTION_REPORT');
8983 --
8984 l_business_group_id NUMBER;
8985 l_end_date DATE;
8986 l_start_date DATE;
8987 l_tax_unit_id NUMBER;
8988 l_payroll_type VARCHAR2(10);
8989 l_seq_no VARCHAR2(15);
8990 l_return_string VARCHAR2(1000);
8991 l_tax_rep_name PAY_ACTION_INFORMATION.ACTION_INFORMATION7%TYPE;
8992 l_exception VARCHAR2(20);
8993 --
8994 BEGIN
8995 --
8996 pay_nl_wage_report_pkg.get_all_parameters(p_actid
8997 ,l_business_group_id
8998 ,l_start_date
8999 ,l_end_date
9000 ,l_tax_unit_id
9001 ,l_payroll_type
9002 ,l_seq_no);
9003 --
9004 OPEN csr_get_org_name(p_actid);
9005 FETCH csr_get_org_name INTO l_tax_rep_name;
9006 CLOSE csr_get_org_name;
9007 --
9008 l_exception := 'NOEXCEPTION';
9009 OPEN csr_chk_exception(p_actid);
9010 FETCH csr_chk_exception INTO l_exception;
9011 CLOSE csr_chk_exception;
9012 --
9013 l_return_string := rpad(fnd_date.date_to_displaydate(l_start_date),15)||'- '||rpad(fnd_date.date_to_displaydate(l_end_date),15);
9014 l_return_string := l_return_string ||'- '||rpad(HR_GENERAL.decode_lookup('NL_WR_PERIOD_TYPE',l_payroll_type),40);
9015 l_return_string := l_return_string ||'- '||rpad(l_tax_rep_name,40);
9016 l_return_string := l_return_string ||'- '||rpad(HR_GENERAL.decode_lookup('NL_FORM_LABELS',l_exception),25);
9017 --
9018 RETURN(l_return_string);
9019 --
9020 END get_archive_details;
9021 --
9022 END pay_nl_wage_report_pkg;