[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.40.12020000.12 2013/03/26 13:26:33 sgmaram 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 --10100628
14 FUNCTION IS_ARCHIVED (p_payroll_action_id IN NUMBER,
15 p_action_information_category IN VARCHAR2,
16 p_action_information1 IN VARCHAR2)
17 RETURN VARCHAR2 IS
18
19 CURSOR cur_archived
20 IS
21 select 'Y' from
22 PAY_ACTION_INFORMATION
23 where ACTION_INFORMATION_CATEGORY = p_action_information_category
24 and ACTION_INFORMATION1 = p_action_information1
25 and ACTION_CONTEXT_ID = p_payroll_action_id;
26
27 CURSOR cur_addr
28 IS
29 select 'Y' from
30 PAY_ACTION_INFORMATION
31 where ACTION_INFORMATION_CATEGORY = p_action_information_category
32 and ACTION_INFORMATION26 = p_action_information1
33 and ACTION_CONTEXT_ID = p_payroll_action_id;
34
35
36 l_archived VARCHAR2(1) := 'N';
37
38 BEGIN
39
40 l_archived := 'N';
41
42 IF p_action_information_category = 'ADDRESS DETAILS' THEN
43 OPEN cur_addr;
44 FETCH cur_addr INTO l_archived;
45 CLOSE cur_addr;
46 ELSE
47 OPEN cur_archived;
48 FETCH cur_archived INTO l_archived;
49 CLOSE cur_archived;
50 END IF;
51
52 RETURN l_archived;
53
54 END IS_ARCHIVED;
55 --10100628
56
57 --
58 --------------------------------------------------------------------------------
59 -- GET_ALL_PARAMETERS
60 --------------------------------------------------------------------------------
61 PROCEDURE get_all_parameters(p_payroll_action_id IN NUMBER
62 ,p_business_group_id OUT NOCOPY NUMBER
63 ,p_start_date OUT NOCOPY DATE
64 ,p_end_date OUT NOCOPY DATE
65 ,p_legal_employer OUT NOCOPY NUMBER
66 ,p_payroll_type OUT NOCOPY VARCHAR2
67 ,p_seq_no OUT NOCOPY VARCHAR2
68 ,p_prev_corr_year OUT NOCOPY VARCHAR2
69 ,p_er_only OUT NOCOPY VARCHAR2) IS --10100628
70 --
71 CURSOR csr_parameter_info (c_payroll_action_id NUMBER) IS
72 SELECT get_parameters(c_payroll_action_id, 'Legal_Employer')
73 ,get_parameters(c_payroll_action_id, 'Payroll_Type')
74 ,get_parameters(c_payroll_action_id, 'Sequence_Number')
75 ,start_date
76 ,effective_date
77 ,business_group_id
78 --,NVL(to_char(fnd_date.canonical_to_date(pay_nl_wage_report_pkg.get_parameters(c_payroll_action_id, 'CORR_YR')),'RRRR'),-9999) --10100628
79 ,NVL(pay_nl_wage_report_pkg.get_parameters(c_payroll_action_id, 'CORR_YR'),'N') --10100628
80 ,NVL(pay_nl_wage_report_pkg.get_parameters(c_payroll_action_id, 'ER_ONLY'),'N') --10100628
81 FROM pay_payroll_actions
82 WHERE payroll_action_id = c_payroll_action_id;
83 --
84 BEGIN
85 --
86 OPEN csr_parameter_info (p_payroll_action_id);
87 FETCH csr_parameter_info INTO p_legal_employer
88 ,p_payroll_type
89 ,p_seq_no
90 ,p_start_date
91 ,p_end_date
92 ,p_business_group_id
93 ,p_prev_corr_year
94 ,p_er_only; --10100628
95 CLOSE csr_parameter_info;
96
97 IF p_payroll_type = 'YEARLY' THEN
98 p_start_date := to_date('01-01-'||to_char(p_end_date,'YYYY'),'dd-mm-yyyy');
99 p_end_date := to_date('31-12-'||to_char(p_end_date,'YYYY'),'dd-mm-yyyy');
100 END IF;
101
102 --10100628
103 IF p_prev_corr_year = 'Y' THEN
104 p_prev_corr_year := to_char(p_end_date,'RRRR');
105 ELSIF p_prev_corr_year = 'N' THEN
106 p_prev_corr_year := '-9999';
107 END IF;
108 --10100628
109 --
110 END;
111 --------------------------------------------------------------------------------
112 -- GET_PARAMETERS
113 --------------------------------------------------------------------------------
114 FUNCTION get_parameters(p_payroll_action_id IN NUMBER,
115 p_token_name IN VARCHAR2) RETURN VARCHAR2 IS
116 CURSOR csr_parameter_info IS
117 SELECT SUBSTR(legislative_parameters,
118 INSTR(legislative_parameters,p_token_name)+(LENGTH(p_token_name)+1),
119 INSTR(legislative_parameters,' ',INSTR(legislative_parameters,p_token_name))
120 -(INSTR(legislative_parameters,p_token_name)+(LENGTH(p_token_name)+1)))
121 FROM pay_payroll_actions
122 WHERE payroll_action_id = p_payroll_action_id;
123 --
124 l_token_value VARCHAR2(50);
125 --
126 BEGIN
127 --
128 OPEN csr_parameter_info;
129 FETCH csr_parameter_info INTO l_token_value;
130 CLOSE csr_parameter_info;
131 return(l_token_value);
132 END get_parameters;
133
134
135
136 FUNCTION get_parameters1(p_payroll_action_id IN NUMBER,
137 p_token_name IN VARCHAR2) RETURN VARCHAR2 IS
138 CURSOR csr_parameter_info IS
139 SELECT SUBSTR(legislative_parameters,
140 INSTR(legislative_parameters,p_token_name)+(LENGTH(p_token_name)+1),
141 INSTR(legislative_parameters,' ',INSTR(legislative_parameters,p_token_name))
142 -(INSTR(legislative_parameters,p_token_name)+(LENGTH(p_token_name)+1)))
143 FROM pay_payroll_actions
144 WHERE payroll_action_id = p_payroll_action_id;
145 --
146 l_token_value VARCHAR2(50);
147 --
148 BEGIN
149 --
150 OPEN csr_parameter_info;
151 FETCH csr_parameter_info INTO l_token_value;
152 CLOSE csr_parameter_info;
153
154 l_token_value := NVL(l_token_value, '-9999');
155
156 return(l_token_value);
157 END get_parameters1;
158
159 --------------------------------------------------------------------------------
160 -- RANGE_CODE
161 --------------------------------------------------------------------------------
162 PROCEDURE archive_range_code(p_actid IN NUMBER
163 ,sqlstr OUT NOCOPY VARCHAR2)
164 IS
165 --
166 BEGIN
167 --
168 -- Return Range Cursor
169 -- Note: There must be one and only one entry of :payroll_action_id in
170 -- the string, and the statement must be ordered by person_id
171 --
172 sqlstr := 'select distinct person_id '||
173 'from per_people_f ppf, '||
174 'pay_payroll_actions ppa '||
175 'where ppa.payroll_action_id = :payroll_action_id '||
176 'and ppa.business_group_id = ppf.business_group_id '||
177 'order by ppf.person_id';
178 --
179 EXCEPTION
180 WHEN OTHERS THEN
181 -- Return cursor that selects no rows
182 sqlstr := 'select 1 '||
183 '/* ERROR - Employer Details Fetch failed with: '||
184 sqlerrm(sqlcode)||' */ '||
185 'from dual where to_char(:payroll_action_id) = dummy';
186 hr_utility.set_location(' Leaving: range code',110);
187 END archive_range_code;
188 --------------------------------------------------------------------------------
189 -- get_defined_balance_id pay_nl_wage_report_pkg.get_defined_balance_id
190 --------------------------------------------------------------------------------
191 FUNCTION get_defined_balance_id(p_balance_name VARCHAR2
192 ,p_database_item_suffix VARCHAR2) RETURN NUMBER IS
193 --
194 CURSOR csr_get_bal_info(c_balance_name VARCHAR2
195 ,c_database_item_suffix VARCHAR2) IS
196 SELECT pdb.defined_balance_id
197 FROM pay_balance_types pbt
198 ,pay_balance_dimensions pbd
199 ,pay_defined_balances pdb
200 WHERE pbt.balance_name = c_balance_name
201 AND pbt.legislation_code = 'NL'
202 AND pbd.database_item_suffix = c_database_item_suffix
203 AND pbd.legislation_code = 'NL'
204 AND pdb.balance_type_id = pbt.balance_type_id
205 AND pdb.balance_dimension_id = pbd.balance_dimension_id;
206 --
207 l_defined_bal_id NUMBER;
208 --
209 --
210 BEGIN
211 --
212 l_defined_bal_id := 0;
213 --
214 OPEN csr_get_bal_info(p_balance_name,p_database_item_suffix);
215 FETCH csr_get_bal_info INTO l_defined_bal_id;
216 CLOSE csr_get_bal_info;
217 --
218 RETURN(l_defined_bal_id);
219 --
220 END get_defined_balance_id;
221 --
222 --------------------------------------------------------------------------------
223 -- populate_balance_table pay_nl_wage_report_pkg.populate_balance_table
224 --------------------------------------------------------------------------------
225 PROCEDURE populate_nom_balance_table(p_payroll_type VARCHAR2) IS
226 --
227 --
228 l_index NUMBER;
229 l_asg_ptd VARCHAR2(30);
230 l_asg_adj_ptd VARCHAR2(30);
231 l_asg_corr_ptd VARCHAR2(30);
232 l_asg_sit_ptd VARCHAR2(30);
233 l_asg_sit_adj_ptd VARCHAR2(30);
234 l_asg_sit_corr_ptd VARCHAR2(30);
235 --
236 BEGIN
237 --
238 l_asg_ptd := '_ASG_PTD';
239 l_asg_adj_ptd := '_ASG_ADJ_PTD';
240 l_asg_corr_ptd := '_ASG_REPORT_CORR_PTD';
241 l_asg_sit_ptd := '_ASG_SIT_PTD';
242 l_asg_sit_adj_ptd := '_ASG_SIT_ADJ_PTD';
243 l_asg_sit_corr_ptd := '_ASG_SIT_REPORT_CORR_PTD';
244 --
245 IF g_retro_type = 'NEW' THEN
246 l_asg_adj_ptd := NULL;
247 l_asg_corr_ptd := '_ASG_BDATE_PTD';
248 l_asg_sit_adj_ptd := NULL;
249 l_asg_sit_corr_ptd := '_ASG_BDATE_SIT_PTD';
250 END IF;
251 --
252 IF p_payroll_type = 'YEARLY' THEN
253 l_asg_ptd := '_ASG_TU_YTD';
254 l_asg_adj_ptd := NULL;
255 l_asg_corr_ptd := '_ASG_TU_YTD';
256 l_asg_sit_ptd := '_ASG_TU_SIT_YTD';
257 l_asg_sit_adj_ptd := NULL;
258 l_asg_sit_corr_ptd := '_ASG_TU_SIT_YTD';
259 END IF;
260 --
261 g_nom_bal_def_table.delete;
262 l_index := 1;
263 --
264 g_nom_bal_def_table(l_index).balance_name := 'Standard Taxable Income'; --1
265 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
266 g_nom_bal_def_table(l_index).context := NULL;
267 g_nom_bal_def_table(l_index).context_val := NULL;
268 l_index := l_index + 1;
269 --
270 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Taxable Income Current Quarter';
271 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
272 g_nom_bal_def_table(l_index).context := NULL;
273 g_nom_bal_def_table(l_index).context_val := NULL;
274 l_index := l_index + 1;
275 --
276 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Taxable Income Current Quarter';
277 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
278 g_nom_bal_def_table(l_index).context := NULL;
279 g_nom_bal_def_table(l_index).context_val := NULL;
280 l_index := l_index + 1;
281 --
282 g_nom_bal_def_table(l_index).balance_name := 'SI Income Standard Tax';
283 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
284 g_nom_bal_def_table(l_index).context := NULL;
285 g_nom_bal_def_table(l_index).context_val := NULL;
286 l_index := l_index + 1;
287 --
288 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Standard Tax'; --5
289 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
290 g_nom_bal_def_table(l_index).context := NULL;
291 g_nom_bal_def_table(l_index).context_val := NULL;
292 l_index := l_index + 1;
293 --
294 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Standard Tax';
295 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
296 g_nom_bal_def_table(l_index).context := NULL;
297 g_nom_bal_def_table(l_index).context_val := NULL;
298 l_index := l_index + 1;
299 --
300 g_nom_bal_def_table(l_index).balance_name := 'SI Income Special Tax';
301 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
302 g_nom_bal_def_table(l_index).context := NULL;
303 g_nom_bal_def_table(l_index).context_val := NULL;
304 l_index := l_index + 1;
305 --
306 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Special Tax';
307 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
308 g_nom_bal_def_table(l_index).context := NULL;
309 g_nom_bal_def_table(l_index).context_val := NULL;
310 l_index := l_index + 1;
311 --
312 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Special Tax';
313 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
314 g_nom_bal_def_table(l_index).context := NULL;
315 g_nom_bal_def_table(l_index).context_val := NULL;
316 l_index := l_index + 1;
317 --
318 g_nom_bal_def_table(l_index).balance_name := 'SI Income Non Taxable'; --10
319 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
320 g_nom_bal_def_table(l_index).context := NULL;
321 g_nom_bal_def_table(l_index).context_val := NULL;
322 l_index := l_index + 1;
323 --
324 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Non Taxable';
325 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
326 g_nom_bal_def_table(l_index).context := NULL;
327 g_nom_bal_def_table(l_index).context_val := NULL;
328 l_index := l_index + 1;
329 --
330 g_nom_bal_def_table(l_index).balance_name := 'Retro SI Income Non Taxable';
331 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
332 g_nom_bal_def_table(l_index).context := NULL;
333 g_nom_bal_def_table(l_index).context_val := NULL;
334 l_index := l_index + 1;
335 --
336 g_nom_bal_def_table(l_index).balance_name := 'Special Taxable Income';
337 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
338 g_nom_bal_def_table(l_index).context := NULL;
339 g_nom_bal_def_table(l_index).context_val := NULL;
340 l_index := l_index + 1;
341 --
342 g_nom_bal_def_table(l_index).balance_name := 'Retro Special Taxable Income';
343 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
344 g_nom_bal_def_table(l_index).context := NULL;
345 g_nom_bal_def_table(l_index).context_val := NULL;
346 l_index := l_index + 1;
347 --
348 g_nom_bal_def_table(l_index).balance_name := 'Retro Special Taxable Income'; --15
349 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
350 g_nom_bal_def_table(l_index).context := NULL;
351 g_nom_bal_def_table(l_index).context_val := NULL;
352 l_index := l_index + 1;
353 --
354 g_nom_bal_def_table(l_index).balance_name := 'Holiday Allowance Payment';
355 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
356 g_nom_bal_def_table(l_index).context := NULL;
357 g_nom_bal_def_table(l_index).context_val := NULL;
358 l_index := l_index + 1;
359 --
360 g_nom_bal_def_table(l_index).balance_name := 'Reservation Holiday Allowance';
361 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
362 g_nom_bal_def_table(l_index).context := NULL;
363 g_nom_bal_def_table(l_index).context_val := NULL;
364 l_index := l_index + 1;
365 --
366 g_nom_bal_def_table(l_index).balance_name := 'Additional Period Wage';
367 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
368 g_nom_bal_def_table(l_index).context := NULL;
369 g_nom_bal_def_table(l_index).context_val := NULL;
370 l_index := l_index + 1;
371 --
372 g_nom_bal_def_table(l_index).balance_name := 'Reservation Additional Period Wage';
373 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
374 g_nom_bal_def_table(l_index).context := NULL;
375 g_nom_bal_def_table(l_index).context_val := NULL;
376 l_index := l_index + 1;
377 --
378 g_nom_bal_def_table(l_index).balance_name := 'Wage In Money Standard Tax SI'; --20
379 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
380 g_nom_bal_def_table(l_index).context := NULL;
381 g_nom_bal_def_table(l_index).context_val := NULL;
382 l_index := l_index + 1;
383 --
384 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Standard Tax SI';
385 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
386 g_nom_bal_def_table(l_index).context := NULL;
387 g_nom_bal_def_table(l_index).context_val := NULL;
388 l_index := l_index + 1;
389 --
390 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Standard Tax SI';
391 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
392 g_nom_bal_def_table(l_index).context := NULL;
393 g_nom_bal_def_table(l_index).context_val := NULL;
394 l_index := l_index + 1;
395 --
396 g_nom_bal_def_table(l_index).balance_name := 'Wage In Money Special Tax SI';
397 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
398 g_nom_bal_def_table(l_index).context := NULL;
399 g_nom_bal_def_table(l_index).context_val := NULL;
400 l_index := l_index + 1;
401 --
402 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Special Tax SI';
403 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
404 g_nom_bal_def_table(l_index).context := NULL;
405 g_nom_bal_def_table(l_index).context_val := NULL;
406 l_index := l_index + 1;
407 --
408 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Special Tax SI'; --25
409 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
410 g_nom_bal_def_table(l_index).context := NULL;
411 g_nom_bal_def_table(l_index).context_val := NULL;
412 l_index := l_index + 1;
413 --
414 g_nom_bal_def_table(l_index).balance_name := 'Wage In Kind Standard Tax SI';
415 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
416 g_nom_bal_def_table(l_index).context := NULL;
417 g_nom_bal_def_table(l_index).context_val := NULL;
418 l_index := l_index + 1;
419 --
420 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Standard Tax SI';
421 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
422 g_nom_bal_def_table(l_index).context := NULL;
423 g_nom_bal_def_table(l_index).context_val := NULL;
424 l_index := l_index + 1;
425 --
426 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Standard Tax SI';
427 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
428 g_nom_bal_def_table(l_index).context := NULL;
429 g_nom_bal_def_table(l_index).context_val := NULL;
430 l_index := l_index + 1;
431 --
432 g_nom_bal_def_table(l_index).balance_name := 'Wage In Kind Special Tax SI';
433 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
434 g_nom_bal_def_table(l_index).context := NULL;
435 g_nom_bal_def_table(l_index).context_val := NULL;
436 l_index := l_index + 1;
437 --
438 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Special Tax SI'; --30
439 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
440 g_nom_bal_def_table(l_index).context := NULL;
441 g_nom_bal_def_table(l_index).context_val := NULL;
442 l_index := l_index + 1;
443 --
444 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Special Tax SI';
445 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
446 g_nom_bal_def_table(l_index).context := NULL;
447 g_nom_bal_def_table(l_index).context_val := NULL;
448 l_index := l_index + 1;
449 --
450 g_nom_bal_def_table(l_index).balance_name := 'Tips and Fund Payments Standard Tax SI';
451 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
452 g_nom_bal_def_table(l_index).context := NULL;
453 g_nom_bal_def_table(l_index).context_val := NULL;
454 l_index := l_index + 1;
455 --
456 g_nom_bal_def_table(l_index).balance_name := 'Retro Tips and Fund Payments Standard Tax SI';
457 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
458 g_nom_bal_def_table(l_index).context := NULL;
459 g_nom_bal_def_table(l_index).context_val := NULL;
460 l_index := l_index + 1;
461 --
462 g_nom_bal_def_table(l_index).balance_name := 'Retro Tips and Fund Payments Standard Tax SI';
463 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
464 g_nom_bal_def_table(l_index).context := NULL;
465 g_nom_bal_def_table(l_index).context_val := NULL;
466 l_index := l_index + 1;
467 --
468 g_nom_bal_def_table(l_index).balance_name := 'Tips and Fund Payments Special Tax SI'; --35
469 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
470 g_nom_bal_def_table(l_index).context := NULL;
471 g_nom_bal_def_table(l_index).context_val := NULL;
472 l_index := l_index + 1;
473 --
474 g_nom_bal_def_table(l_index).balance_name := 'Retro Tips and Fund Payments Special Tax SI';
475 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
476 g_nom_bal_def_table(l_index).context := NULL;
477 g_nom_bal_def_table(l_index).context_val := NULL;
478 l_index := l_index + 1;
479 --
480 g_nom_bal_def_table(l_index).balance_name := 'Retro Tips and Fund Payments Special Tax SI';
481 g_nom_bal_def_table(l_index).database_item_suffix := NULL;
482 g_nom_bal_def_table(l_index).context := NULL;
483 g_nom_bal_def_table(l_index).context_val := NULL;
484 l_index := l_index + 1;
485 --
486 g_nom_bal_def_table(l_index).balance_name := 'Overtime';
487 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
488 g_nom_bal_def_table(l_index).context := NULL;
489 g_nom_bal_def_table(l_index).context_val := NULL;
490 l_index := l_index + 1;
491 --
492 g_nom_bal_def_table(l_index).balance_name := 'Standard Tax Deduction';
493 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
494 g_nom_bal_def_table(l_index).context := NULL;
495 g_nom_bal_def_table(l_index).context_val := NULL;
496 l_index := l_index + 1;
497 --
498 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Tax Deduction Current Quarter'; --40
499 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
500 g_nom_bal_def_table(l_index).context := NULL;
501 g_nom_bal_def_table(l_index).context_val := NULL;
502 l_index := l_index + 1;
503 --
504 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Tax Deduction Current Quarter';
505 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
506 g_nom_bal_def_table(l_index).context := NULL;
507 g_nom_bal_def_table(l_index).context_val := NULL;
508 l_index := l_index + 1;
509 --
510 g_nom_bal_def_table(l_index).balance_name := 'Special Tax Deduction';
511 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
512 g_nom_bal_def_table(l_index).context := NULL;
513 g_nom_bal_def_table(l_index).context_val := NULL;
514 l_index := l_index + 1;
515 --
516 g_nom_bal_def_table(l_index).balance_name := 'Retro Special Tax Deduction';
517 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
518 g_nom_bal_def_table(l_index).context := NULL;
519 g_nom_bal_def_table(l_index).context_val := NULL;
520 l_index := l_index + 1;
521 --
522 g_nom_bal_def_table(l_index).balance_name := 'Retro Special Tax Deduction';
523 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
524 g_nom_bal_def_table(l_index).context := NULL;
525 g_nom_bal_def_table(l_index).context_val := NULL;
526 l_index := l_index + 1;
527 --
528 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution'; --45
529 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
530 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
531 g_nom_bal_def_table(l_index).context_val := 'WAOB';
532 l_index := l_index + 1;
533 --
534 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
535 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
536 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
537 g_nom_bal_def_table(l_index).context_val := 'WAOB';
538 l_index := l_index + 1;
539 --
540 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
541 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
542 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
543 g_nom_bal_def_table(l_index).context_val := 'WAOB';
544 l_index := l_index + 1;
545 --
546 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution';
547 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
548 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
549 g_nom_bal_def_table(l_index).context_val := 'WGA';
550 l_index := l_index + 1;
551 --
552 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
553 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
554 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
555 g_nom_bal_def_table(l_index).context_val := 'WGA';
556 l_index := l_index + 1;
557 --
558 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution'; --50
559 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
560 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
561 g_nom_bal_def_table(l_index).context_val := 'WGA';
562 l_index := l_index + 1;
563 --
564 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution';
565 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
566 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
567 g_nom_bal_def_table(l_index).context_val := 'IVA';
568 l_index := l_index + 1;
569 --
570 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
571 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
572 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
573 g_nom_bal_def_table(l_index).context_val := 'IVA';
574 l_index := l_index + 1;
575 --
576 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
577 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
578 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
579 g_nom_bal_def_table(l_index).context_val := 'IVA';
580 l_index := l_index + 1;
581 --
582 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution';
583 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
584 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
585 g_nom_bal_def_table(l_index).context_val := 'WAOD';
586 l_index := l_index + 1;
587 --
588 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution'; --55
589 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
590 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
591 g_nom_bal_def_table(l_index).context_val := 'WAOD';
592 l_index := l_index + 1;
593 --
594 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
595 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
596 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
597 g_nom_bal_def_table(l_index).context_val := 'WAOD';
598 l_index := l_index + 1;
599 --
600 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution';
601 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
602 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
603 g_nom_bal_def_table(l_index).context_val := 'WEWE';
604 l_index := l_index + 1;
605 --
606 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
607 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
608 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
609 g_nom_bal_def_table(l_index).context_val := 'WEWE';
610 l_index := l_index + 1;
611 --
612 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
613 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
614 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
615 g_nom_bal_def_table(l_index).context_val := 'WEWE';
616 l_index := l_index + 1;
617 --
618 g_nom_bal_def_table(l_index).balance_name :='Wage Report SI Contribution'; --60
619 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
620 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
621 g_nom_bal_def_table(l_index).context_val := 'WEWA';
622 l_index := l_index + 1;
623 --
624 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
625 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
626 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
627 g_nom_bal_def_table(l_index).context_val := 'WEWA';
628 l_index := l_index + 1;
629 --
630 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
631 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
632 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
633 g_nom_bal_def_table(l_index).context_val := 'WEWA';
634 l_index := l_index + 1;
635 --
636 g_nom_bal_def_table(l_index).balance_name := 'Wage Report SI Contribution';
637 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
638 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
639 g_nom_bal_def_table(l_index).context_val := 'UFO';
640 l_index := l_index + 1;
641 --
642 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution';
643 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
644 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
645 g_nom_bal_def_table(l_index).context_val := 'UFO';
646 l_index := l_index + 1;
647 --
648 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro SI Contribution'; --65
649 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
650 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
651 g_nom_bal_def_table(l_index).context_val := 'UFO';
652 l_index := l_index + 1;
653 --
654 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Employee SI Contribution'; --66
655 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
656 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
657 g_nom_bal_def_table(l_index).context_val := 'ZVW';
658 l_index := l_index + 1;
659 --
660 g_nom_bal_def_table(l_index).balance_name :='Wage Report Retro Employee SI Contribution';
661 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
662 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
663 g_nom_bal_def_table(l_index).context_val := 'ZVW';
664 l_index := l_index + 1;
665 --
666 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro Employee SI Contribution'; --68
667 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
668 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
669 g_nom_bal_def_table(l_index).context_val := 'ZVW';
670 l_index := l_index + 1;
671 --
672 g_nom_bal_def_table(l_index).balance_name := 'Tax Travel Allowance';
673 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
674 g_nom_bal_def_table(l_index).context := NULL;
675 g_nom_bal_def_table(l_index).context_val := NULL;
676 l_index := l_index + 1;
677 --
678 g_nom_bal_def_table(l_index).balance_name := 'Labour Tax Reduction'; -- 70
679 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
680 g_nom_bal_def_table(l_index).context := NULL;
681 g_nom_bal_def_table(l_index).context_val := NULL;
682 l_index := l_index + 1;
683 --
684 g_nom_bal_def_table(l_index).balance_name := 'Retro Labour Tax Reduction';
685 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
686 g_nom_bal_def_table(l_index).context := NULL;
687 g_nom_bal_def_table(l_index).context_val := NULL;
688 l_index := l_index + 1;
689 --
690 g_nom_bal_def_table(l_index).balance_name := 'Retro Labour Tax Reduction';
691 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
692 g_nom_bal_def_table(l_index).context := NULL;
693 g_nom_bal_def_table(l_index).context_val := NULL;
694 l_index := l_index + 1;
695 --
696 g_nom_bal_def_table(l_index).balance_name := 'Real Social Insurance Days';
697 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
698 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
699 g_nom_bal_def_table(l_index).context_val := 'ZVW';
700 l_index := l_index + 1;
701 --
702 g_nom_bal_def_table(l_index).balance_name := 'Retro Real Social Insurance Days';
703 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
704 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
705 g_nom_bal_def_table(l_index).context_val := 'ZVW';
706 l_index := l_index + 1;
707 --
708 g_nom_bal_def_table(l_index).balance_name := 'Retro Real Social Insurance Days'; -- 75
709 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
710 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
711 g_nom_bal_def_table(l_index).context_val := 'ZVW';
712 l_index := l_index + 1;
713 --
714 g_nom_bal_def_table(l_index).balance_name := 'Hours Worked';
715 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
716 g_nom_bal_def_table(l_index).context := NULL;
717 g_nom_bal_def_table(l_index).context_val := NULL;
718 l_index := l_index + 1;
719 --
720 g_nom_bal_def_table(l_index).balance_name := 'Tax Sea Days Discount';
721 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
722 g_nom_bal_def_table(l_index).context := NULL;
723 g_nom_bal_def_table(l_index).context_val := NULL;
724 l_index := l_index + 1;
725 --
726 g_nom_bal_def_table(l_index).balance_name := 'WWB Allowance Paid Alimony';
727 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
728 g_nom_bal_def_table(l_index).context := NULL;
729 g_nom_bal_def_table(l_index).context_val := NULL;
730 l_index := l_index + 1;
731 --
732 g_nom_bal_def_table(l_index).balance_name := 'Directly Paid Alimony';
733 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
734 g_nom_bal_def_table(l_index).context := NULL;
735 g_nom_bal_def_table(l_index).context_val := NULL;
736 l_index := l_index + 1;
737 --
738 g_nom_bal_def_table(l_index).balance_name := 'Employer SI Contribution Non Taxable'; --80
739 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
740 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
741 g_nom_bal_def_table(l_index).context_val := 'ZVW';
742 l_index := l_index + 1;
743 --
744 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer SI Contribution Non Taxable';
745 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
746 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
747 g_nom_bal_def_table(l_index).context_val := 'ZVW';
748 l_index := l_index + 1;
749 --
750 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer SI Contribution Non Taxable'; -- 82
751 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
752 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
753 g_nom_bal_def_table(l_index).context_val := 'ZVW';
754 l_index := l_index + 1;
755 --
756 g_nom_bal_def_table(l_index).balance_name := 'Employer ZVW Contribution Special Tax';
757 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
758 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
759 g_nom_bal_def_table(l_index).context_val := 'ZVW';
760 l_index := l_index + 1;
761 --
762 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer ZVW Contribution Special Tax';
763 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
764 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
765 g_nom_bal_def_table(l_index).context_val := 'ZVW';
766 l_index := l_index + 1;
767 --
768 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer ZVW Contribution Special Tax'; --85
769 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
770 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
771 g_nom_bal_def_table(l_index).context_val := 'ZVW';
772 l_index := l_index + 1;
773 --
774 g_nom_bal_def_table(l_index).balance_name := 'Employer ZVW Contribution Standard Tax';
775 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
776 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
777 g_nom_bal_def_table(l_index).context_val := 'ZVW';
778 l_index := l_index + 1;
779 --
780 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer ZVW Contribution Standard Tax'; -- 87
781 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
782 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
783 g_nom_bal_def_table(l_index).context_val := 'ZVW';
784 l_index := l_index + 1;
785 --
786 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer ZVW Contribution Standard Tax';
787 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
788 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
789 g_nom_bal_def_table(l_index).context_val := 'ZVW';
790 l_index := l_index + 1;
791 --
792 g_nom_bal_def_table(l_index).balance_name := 'Employer SI Contribution';
793 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
794 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
795 g_nom_bal_def_table(l_index).context_val := 'ZVW';
796 l_index := l_index + 1;
797 --
798 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer SI Contribution';
799 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd; -- 90
800 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
801 g_nom_bal_def_table(l_index).context_val := 'ZVW';
802 l_index := l_index + 1;
803 --
804 g_nom_bal_def_table(l_index).balance_name := 'Retro Employer SI Contribution'; -- 91
805 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
806 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
807 g_nom_bal_def_table(l_index).context_val := 'ZVW';
808 l_index := l_index + 1;
809 --
810 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Taxable Income'; -- 92
811 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
812 g_nom_bal_def_table(l_index).context := NULL;
813 g_nom_bal_def_table(l_index).context_val := NULL;
814 l_index := l_index + 1;
815 --
816 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Taxable Income';
817 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_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 --
822 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Tax Deduction'; -- 94
823 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
824 g_nom_bal_def_table(l_index).context := NULL;
825 g_nom_bal_def_table(l_index).context_val := NULL;
826 l_index := l_index + 1;
827 --
828 g_nom_bal_def_table(l_index).balance_name := 'Retro Standard Tax Deduction'; -- 95
829 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
830 g_nom_bal_def_table(l_index).context := NULL;
831 g_nom_bal_def_table(l_index).context_val := NULL;
832 l_index := l_index + 1;
833 -- Wage In Money
834 g_nom_bal_def_table(l_index).balance_name := 'Wage In Money Standard Tax Only'; --96
835 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
836 g_nom_bal_def_table(l_index).context := NULL;
837 g_nom_bal_def_table(l_index).context_val := NULL;
838 l_index := l_index + 1;
839 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Standard Tax Only'; -- 97
840 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
841 g_nom_bal_def_table(l_index).context := NULL;
842 g_nom_bal_def_table(l_index).context_val := NULL;
843 l_index := l_index + 1;
844 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Standard Tax Only';
845 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
846 g_nom_bal_def_table(l_index).context := NULL;
847 g_nom_bal_def_table(l_index).context_val := NULL;
848 l_index := l_index + 1;
849 --
850 g_nom_bal_def_table(l_index).balance_name := 'Wage In Money Special Tax Only';
851 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
852 g_nom_bal_def_table(l_index).context := NULL;
853 g_nom_bal_def_table(l_index).context_val := NULL;
854 l_index := l_index + 1;
855 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Special Tax Only'; --100
856 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
857 g_nom_bal_def_table(l_index).context := NULL;
858 g_nom_bal_def_table(l_index).context_val := NULL;
859 l_index := l_index + 1;
860 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Money Special Tax Only'; -- 101
861 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
862 g_nom_bal_def_table(l_index).context := NULL;
863 g_nom_bal_def_table(l_index).context_val := NULL;
864 l_index := l_index + 1;
865 -- Wage In Kind
866 g_nom_bal_def_table(l_index).balance_name := 'Wage In Kind Standard Tax Only'; -- 102
867 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
868 g_nom_bal_def_table(l_index).context := NULL;
869 g_nom_bal_def_table(l_index).context_val := NULL;
870 l_index := l_index + 1;
871 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Standard Tax Only';
872 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
873 g_nom_bal_def_table(l_index).context := NULL;
874 g_nom_bal_def_table(l_index).context_val := NULL;
875 l_index := l_index + 1;
876 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Standard Tax Only';
877 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
878 g_nom_bal_def_table(l_index).context := NULL;
879 g_nom_bal_def_table(l_index).context_val := NULL;
880 l_index := l_index + 1;
881 --
882 g_nom_bal_def_table(l_index).balance_name := 'Wage In Kind Special Tax Only'; --105
883 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
884 g_nom_bal_def_table(l_index).context := NULL;
885 g_nom_bal_def_table(l_index).context_val := NULL;
886 l_index := l_index + 1;
887 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Special Tax Only';
888 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
889 g_nom_bal_def_table(l_index).context := NULL;
890 g_nom_bal_def_table(l_index).context_val := NULL;
891 l_index := l_index + 1;
892 g_nom_bal_def_table(l_index).balance_name := 'Retro Wage In Kind Special Tax Only'; -- 107
893 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
894 g_nom_bal_def_table(l_index).context := NULL;
895 g_nom_bal_def_table(l_index).context_val := NULL;
896 l_index := l_index + 1;
897 --
898 g_nom_bal_def_table(l_index).balance_name := 'Value Private Usage Company Car'; --108
899 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
900 g_nom_bal_def_table(l_index).context := NULL;
901 g_nom_bal_def_table(l_index).context_val := NULL;
902 l_index := l_index + 1;
903 g_nom_bal_def_table(l_index).balance_name := 'Employee Value Private Usage Company Car'; --109
904 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
905 g_nom_bal_def_table(l_index).context := NULL;
906 g_nom_bal_def_table(l_index).context_val := NULL;
907 l_index := l_index + 1;
908 g_nom_bal_def_table(l_index).balance_name := 'Child Care Employer Contribution'; -- 110
909 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
910 g_nom_bal_def_table(l_index).context := NULL;
911 g_nom_bal_def_table(l_index).context_val := NULL;
912 l_index := l_index + 1;
913 g_nom_bal_def_table(l_index).balance_name := 'Employee Life Savings Contribution'; -- 111
914 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
915 g_nom_bal_def_table(l_index).context := NULL;
916 g_nom_bal_def_table(l_index).context_val := NULL;
917 l_index := l_index + 1;
918 g_nom_bal_def_table(l_index).balance_name := 'Life Cycle Leave Discount'; -- 112
919 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
920 g_nom_bal_def_table(l_index).context := NULL;
921 g_nom_bal_def_table(l_index).context_val := NULL;
922 l_index := l_index + 1;
923 g_nom_bal_def_table(l_index).balance_name := 'Paid Disability Allowance'; -- 113
924 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
925 g_nom_bal_def_table(l_index).context := NULL;
926 g_nom_bal_def_table(l_index).context_val := NULL;
927 l_index := l_index + 1;
928 --
929 g_nom_bal_def_table(l_index).balance_name := 'Standard Tax Correction'; -- 114
930 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
931 g_nom_bal_def_table(l_index).context := NULL;
932 g_nom_bal_def_table(l_index).context_val := NULL;
933 l_index := l_index + 1;
934 g_nom_bal_def_table(l_index).balance_name := 'Special Tax Correction'; -- 115
935 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
936 g_nom_bal_def_table(l_index).context := NULL;
937 g_nom_bal_def_table(l_index).context_val := NULL;
938 l_index := l_index + 1;
939 --
940 g_nom_bal_def_table(l_index).balance_name := 'Retro Tax Travel Allowance'; -- 116
941 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
942 g_nom_bal_def_table(l_index).context := NULL;
943 g_nom_bal_def_table(l_index).context_val := NULL;
944 l_index := l_index + 1;
945 g_nom_bal_def_table(l_index).balance_name := 'Retro Tax Travel Allowance'; -- 117
946 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
947 g_nom_bal_def_table(l_index).context := NULL;
948 g_nom_bal_def_table(l_index).context_val := NULL;
949 l_index := l_index + 1;
950 g_nom_bal_def_table(l_index).balance_name := 'Retro Additional Period Wage'; -- 118
951 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
952 g_nom_bal_def_table(l_index).context := NULL;
953 g_nom_bal_def_table(l_index).context_val := NULL;
954 l_index := l_index + 1;
955 g_nom_bal_def_table(l_index).balance_name := 'Retro Additional Period Wage'; -- 119
956 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
957 g_nom_bal_def_table(l_index).context := NULL;
958 g_nom_bal_def_table(l_index).context_val := NULL;
959 l_index := l_index + 1;
960 g_nom_bal_def_table(l_index).balance_name := 'Retro Life Cycle Leave Discount'; -- 120
961 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_corr_ptd;
962 g_nom_bal_def_table(l_index).context := NULL;
963 g_nom_bal_def_table(l_index).context_val := NULL;
964 l_index := l_index + 1;
965 g_nom_bal_def_table(l_index).balance_name := 'Retro Life Cycle Leave Discount'; -- 121
966 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_adj_ptd;
967 g_nom_bal_def_table(l_index).context := NULL;
968 g_nom_bal_def_table(l_index).context_val := NULL;
969 l_index := l_index + 1;
970 g_nom_bal_def_table(l_index).balance_name := 'Employer Life Savings Contribution'; -- 122
971 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_ptd;
972 g_nom_bal_def_table(l_index).context := NULL;
973 g_nom_bal_def_table(l_index).context_val := NULL;
974 l_index := l_index + 1;
975 --
976 --LC 2010--begin
977 g_nom_bal_def_table(l_index).balance_name := 'Actual SI Base'; --123
978 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
979 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
980 g_nom_bal_def_table(l_index).context_val := 'WAOB';
981 l_index := l_index + 1;
982 --
983 g_nom_bal_def_table(l_index).balance_name :='Retro Actual SI Base'; --124
984 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
985 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
986 g_nom_bal_def_table(l_index).context_val := 'WAOB';
987 l_index := l_index + 1;
988 --
989 g_nom_bal_def_table(l_index).balance_name := 'Retro Actual SI Base'; --125
990 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
991 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
992 g_nom_bal_def_table(l_index).context_val := 'WAOB';
993 l_index := l_index + 1;
994 --
995 g_nom_bal_def_table(l_index).balance_name := 'Actual SI Base'; --126
996 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
997 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
998 g_nom_bal_def_table(l_index).context_val := 'WGA';
999 l_index := l_index + 1;
1000 --
1001 g_nom_bal_def_table(l_index).balance_name :='Retro Actual SI Base'; --127
1002 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
1003 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1004 g_nom_bal_def_table(l_index).context_val := 'WGA';
1005 l_index := l_index + 1;
1006 --
1007 g_nom_bal_def_table(l_index).balance_name := 'Retro Actual SI Base'; --128
1008 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
1009 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1010 g_nom_bal_def_table(l_index).context_val := 'WGA';
1011 l_index := l_index + 1;
1012 --
1013 g_nom_bal_def_table(l_index).balance_name := 'Actual SI Base'; --129
1014 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
1015 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1016 g_nom_bal_def_table(l_index).context_val := 'IVA';
1017 l_index := l_index + 1;
1018 --
1019 g_nom_bal_def_table(l_index).balance_name :='Retro Actual SI Base'; --130
1020 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
1021 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1022 g_nom_bal_def_table(l_index).context_val := 'IVA';
1023 l_index := l_index + 1;
1024 --
1025 g_nom_bal_def_table(l_index).balance_name := 'Retro Actual SI Base'; --131
1026 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
1027 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1028 g_nom_bal_def_table(l_index).context_val := 'IVA';
1029 l_index := l_index + 1;
1030 --
1031 g_nom_bal_def_table(l_index).balance_name := 'Actual SI Base'; --132
1032 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
1033 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1034 g_nom_bal_def_table(l_index).context_val := 'WAOD';
1035 l_index := l_index + 1;
1036 --
1037 g_nom_bal_def_table(l_index).balance_name :='Retro Actual SI Base'; --133
1038 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
1039 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1040 g_nom_bal_def_table(l_index).context_val := 'WAOD';
1041 l_index := l_index + 1;
1042 --
1043 g_nom_bal_def_table(l_index).balance_name := 'Retro Actual SI Base'; --134
1044 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
1045 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1046 g_nom_bal_def_table(l_index).context_val := 'WAOD';
1047 l_index := l_index + 1;
1048 --
1049 g_nom_bal_def_table(l_index).balance_name := 'Actual SI Base'; --135
1050 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
1051 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1052 g_nom_bal_def_table(l_index).context_val := 'WEWE';
1053 l_index := l_index + 1;
1054 --
1055 g_nom_bal_def_table(l_index).balance_name :='Retro Actual SI Base'; --136
1056 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
1057 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1058 g_nom_bal_def_table(l_index).context_val := 'WEWE';
1059 l_index := l_index + 1;
1060 --
1061 g_nom_bal_def_table(l_index).balance_name := 'Retro Actual SI Base'; --137
1062 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
1063 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1064 g_nom_bal_def_table(l_index).context_val := 'WEWE';
1065 l_index := l_index + 1;
1066 --
1067 g_nom_bal_def_table(l_index).balance_name := 'Actual SI Base'; --138
1068 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
1069 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1070 g_nom_bal_def_table(l_index).context_val := 'UFO';
1071 l_index := l_index + 1;
1072 --
1073 g_nom_bal_def_table(l_index).balance_name :='Retro Actual SI Base'; --139
1074 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
1075 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1076 g_nom_bal_def_table(l_index).context_val := 'UFO';
1077 l_index := l_index + 1;
1078 --
1079 g_nom_bal_def_table(l_index).balance_name := 'Retro Actual SI Base'; --140
1080 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
1081 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1082 g_nom_bal_def_table(l_index).context_val := 'UFO';
1083 l_index := l_index + 1;
1084 --
1085 g_nom_bal_def_table(l_index).balance_name := 'Actual SI Base'; --141
1086 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
1087 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1088 g_nom_bal_def_table(l_index).context_val := 'WEWA';
1089 l_index := l_index + 1;
1090 --
1091 g_nom_bal_def_table(l_index).balance_name :='Retro Actual SI Base'; --142
1092 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
1093 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1094 g_nom_bal_def_table(l_index).context_val := 'WEWA';
1095 l_index := l_index + 1;
1096 --
1097 g_nom_bal_def_table(l_index).balance_name := 'Retro Actual SI Base'; --143
1098 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
1099 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1100 g_nom_bal_def_table(l_index).context_val := 'WEWA';
1101 l_index := l_index + 1;
1102 --LC 2010--end
1103 --LC 2013 --BEGIN
1104 --
1105 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Employee SI Contribution'; --144
1106 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
1107 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1108 g_nom_bal_def_table(l_index).context_val := 'ZVWL';
1109 l_index := l_index + 1;
1110 --
1111 g_nom_bal_def_table(l_index).balance_name :='Wage Report Retro Employee SI Contribution'; --145
1112 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
1113 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1114 g_nom_bal_def_table(l_index).context_val := 'ZVWL';
1115 l_index := l_index + 1;
1116 --
1117 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro Employee SI Contribution'; --146
1118 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
1119 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1120 g_nom_bal_def_table(l_index).context_val := 'ZVWL';
1121 l_index := l_index + 1;
1122 --
1123 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Employer SI Contribution'; --147
1124 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
1125 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1126 g_nom_bal_def_table(l_index).context_val := 'ZVWS';
1127 l_index := l_index + 1;
1128 --
1129 g_nom_bal_def_table(l_index).balance_name :='Wage Report Retro Employer SI Contribution'; --148
1130 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
1131 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1132 g_nom_bal_def_table(l_index).context_val := 'ZVWS';
1133 l_index := l_index + 1;
1134 --
1135 g_nom_bal_def_table(l_index).balance_name := 'Wage Report Retro Employer SI Contribution'; --149
1136 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
1137 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1138 g_nom_bal_def_table(l_index).context_val := 'ZVWS';
1139 l_index := l_index + 1;
1140 --
1141 g_nom_bal_def_table(l_index).balance_name := 'Real Social Insurance Days';--150
1142 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
1143 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1144 g_nom_bal_def_table(l_index).context_val := 'ZVWS';
1145 l_index := l_index + 1;
1146 --
1147 g_nom_bal_def_table(l_index).balance_name := 'Retro Real Social Insurance Days';
1148 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
1149 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1150 g_nom_bal_def_table(l_index).context_val := 'ZVWS';
1151 l_index := l_index + 1;
1152 --
1153 g_nom_bal_def_table(l_index).balance_name := 'Retro Real Social Insurance Days'; -- 152
1154 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
1155 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1156 g_nom_bal_def_table(l_index).context_val := 'ZVWS';
1157 l_index := l_index + 1;
1158 --
1159 g_nom_bal_def_table(l_index).balance_name := 'Real Social Insurance Days';--153
1160 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_ptd;
1161 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1162 g_nom_bal_def_table(l_index).context_val := 'ZVWL';
1163 l_index := l_index + 1;
1164 --
1165 g_nom_bal_def_table(l_index).balance_name := 'Retro Real Social Insurance Days';
1166 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_corr_ptd;
1167 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1168 g_nom_bal_def_table(l_index).context_val := 'ZVWL';
1169 l_index := l_index + 1;
1170 --
1171 g_nom_bal_def_table(l_index).balance_name := 'Retro Real Social Insurance Days'; -- 155
1172 g_nom_bal_def_table(l_index).database_item_suffix := l_asg_sit_adj_ptd;
1173 g_nom_bal_def_table(l_index).context := 'SOURCE_TEXT';
1174 g_nom_bal_def_table(l_index).context_val := 'ZVWL';
1175 --
1176 --LC 2013 --END
1177 --
1178 FOR i in g_nom_bal_def_table.FIRST..g_nom_bal_def_table.LAST LOOP
1179 g_nom_bal_def_table(i).defined_balance_id := get_defined_balance_id(g_nom_bal_def_table(i).balance_name
1180 ,g_nom_bal_def_table(i).database_item_suffix);
1181 END LOOP;
1182 --
1183 END populate_nom_balance_table;
1184 --
1185 --------------------------------------------------------------------------------
1186 -- populate_col_balance_values pay_nl_wage_report_pkg.populate_col_balance_values
1187 --------------------------------------------------------------------------------
1188 PROCEDURE populate_col_balance_values(p_col_bal_def_table IN OUT NOCOPY BAL_COL_TABLE
1189 ,p_tax_unit_id IN NUMBER
1190 ,p_effective_date IN DATE
1191 ,p_balance_date IN DATE
1192 ,p_type IN VARCHAR2
1193 ,p_si_provider IN VARCHAR2
1194 ,p_ass_action_id IN NUMBER) IS
1195 --
1196 l_balance_date DATE;
1197 l_context_id NUMBER;
1198 l_tax_unit_id NUMBER;
1199 l_date_earned DATE;
1200 l_source_text VARCHAR2(30);
1201 l_source_text2 VARCHAR2(30);
1202 --
1203 CURSOR cur_act_contexts(p_context_name VARCHAR2 )IS
1204 SELECT ffc.context_id
1205 FROM ff_contexts ffc
1206 WHERE ffc.context_name = p_context_name;
1207 --
1208 BEGIN
1209 --
1210 --##--Fnd_file.put_line(FND_FILE.LOG,'#### balance value ');
1211 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_effective_date '||p_effective_date);
1212 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_tax_unit_id '||p_tax_unit_id);
1213 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_col_bal_def_table.count '||p_col_bal_def_table.count);
1214 --
1215 FOR i IN p_col_bal_def_table.FIRST..p_col_bal_def_table.LAST LOOP
1216 p_col_bal_def_table(i).balance_value := 0;
1217 p_col_bal_def_table(i).balance_value2 := 0;
1218 IF p_col_bal_def_table(i).defined_balance_id <> 0 AND
1219 p_type IN ('CORRECTION','COMPLETE') THEN
1220 l_balance_date := NULL;
1221 l_context_id := NULL;
1222 l_source_text := NULL;
1223 l_source_text2 := NULL;
1224 l_date_earned := p_balance_date;
1225 l_tax_unit_id := p_tax_unit_id;
1226 --
1227 IF p_col_bal_def_table(i).database_item_suffix LIKE '%/_REP/_%' ESCAPE '/'
1228 OR p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_BDATE/_%' ESCAPE '/' THEN
1229 l_date_earned := p_effective_date;
1230 l_balance_date := p_balance_date;
1231 END IF;
1232 --
1233 IF p_col_bal_def_table(i).database_item_suffix LIKE '%/_ADJ/_%' ESCAPE '/' THEN
1234 l_balance_date := p_balance_date;
1235 END IF;
1236 --
1237 IF p_col_bal_def_table(i).database_item_suffix LIKE '%/_SIT/_%' ESCAPE '/' THEN
1238 OPEN cur_act_contexts('SOURCE_TEXT');
1239 FETCH cur_act_contexts INTO l_context_id;
1240 CLOSE cur_act_contexts;
1241 l_source_text := p_col_bal_def_table(i).context_val;
1242 END IF;
1243 --
1244 IF p_col_bal_def_table(i).database_item_suffix LIKE '%/_SIP/_%' ESCAPE '/' THEN
1245 OPEN cur_act_contexts('SOURCE_TEXT');
1246 FETCH cur_act_contexts INTO l_context_id;
1247 CLOSE cur_act_contexts;
1248 l_source_text := p_col_bal_def_table(i).context_val;
1249 --
1250 OPEN cur_act_contexts('SOURCE_TEXT2');
1251 FETCH cur_act_contexts INTO l_context_id;
1252 CLOSE cur_act_contexts;
1253 l_source_text2 := p_si_provider;
1254 END IF;
1255 --
1256 BEGIN
1257 p_col_bal_def_table(i).balance_value := pay_balance_pkg.get_value
1258 (p_defined_balance_id => p_col_bal_def_table(i).defined_balance_id
1259 ,p_assignment_action_id => p_ass_action_id
1260 ,p_tax_unit_id => l_tax_unit_id
1261 ,p_jurisdiction_code => NULL
1262 ,p_source_id => NULL
1263 ,p_source_text => l_source_text
1264 ,p_tax_group => NULL
1265 ,p_date_earned => l_date_earned
1266 ,p_get_rr_route => NULL
1267 ,p_get_rb_route => NULL
1268 ,p_source_text2 => l_source_text2
1269 ,p_source_number => NULL
1270 ,p_time_def_id => NULL
1271 ,p_balance_date => l_balance_date
1272 ,p_payroll_id => NULL);
1273 EXCEPTION
1274 WHEN OTHERS THEN
1275 p_col_bal_def_table(i).balance_value := 0;
1276 --##--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);
1277 --Fnd_file.put_line(FND_FILE.LOG,'## p_defined_balance_id ' || p_col_bal_def_table(i).defined_balance_id);
1278 --Fnd_file.put_line(FND_FILE.LOG,'## l_tax_unit_id ' || l_tax_unit_id);
1279 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text ' || l_source_text);
1280 --Fnd_file.put_line(FND_FILE.LOG,'## l_date_earned ' || l_date_earned);
1281 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text2 ' || l_source_text2);
1282 --Fnd_file.put_line(FND_FILE.LOG,'## l_balance_date ' || l_balance_date);
1283 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
1284 END;
1285 --##--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);
1286 --##--Fnd_file.put_line(FND_FILE.LOG,'######### Defined_balance_id : '||p_col_bal_def_table(i).defined_balance_id);
1287 END IF;
1288 --
1289 IF p_col_bal_def_table(i).defined_balance_id2 <> 0 AND
1290 p_type IN ('CORR_BALANCE','CORRECTION') THEN
1291 l_balance_date := NULL;
1292 l_context_id := NULL;
1293 l_source_text := NULL;
1294 l_source_text2 := NULL;
1295 l_date_earned := p_balance_date;
1296 l_tax_unit_id := p_tax_unit_id;
1297 --
1298 IF p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_REP/_%' ESCAPE '/'
1299 OR p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_BDATE/_%' ESCAPE '/' THEN
1300 l_date_earned := p_effective_date;
1301 l_balance_date := p_balance_date;
1302 END IF;
1303 --
1304 IF p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_ADJ/_%' ESCAPE '/' THEN
1305 l_balance_date := p_balance_date;
1306 END IF;
1307 --
1308 IF p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_SIT/_%' ESCAPE '/' THEN
1309 OPEN cur_act_contexts('SOURCE_TEXT');
1310 FETCH cur_act_contexts INTO l_context_id;
1311 CLOSE cur_act_contexts;
1312 l_source_text := p_col_bal_def_table(i).context_val;
1313 END IF;
1314 --
1315 IF p_col_bal_def_table(i).database_item_suffix2 LIKE '%/_SIP/_%' ESCAPE '/' THEN
1316 OPEN cur_act_contexts('SOURCE_TEXT');
1317 FETCH cur_act_contexts INTO l_context_id;
1318 CLOSE cur_act_contexts;
1319 l_source_text := p_col_bal_def_table(i).context_val;
1320 --
1321 OPEN cur_act_contexts('SOURCE_TEXT2');
1322 FETCH cur_act_contexts INTO l_context_id;
1323 CLOSE cur_act_contexts;
1324 l_source_text2 := p_si_provider;
1325 END IF;
1326 --
1327 BEGIN
1328 p_col_bal_def_table(i).balance_value2 := pay_balance_pkg.get_value
1329 (p_defined_balance_id => p_col_bal_def_table(i).defined_balance_id2
1330 ,p_assignment_action_id => p_ass_action_id
1331 ,p_tax_unit_id => l_tax_unit_id
1332 ,p_jurisdiction_code => NULL
1333 ,p_source_id => NULL
1334 ,p_source_text => l_source_text
1335 ,p_tax_group => NULL
1336 ,p_date_earned => l_date_earned
1337 ,p_get_rr_route => NULL
1338 ,p_get_rb_route => NULL
1339 ,p_source_text2 => l_source_text2
1340 ,p_source_number => NULL
1341 ,p_time_def_id => NULL
1342 ,p_balance_date => l_balance_date
1343 ,p_payroll_id => NULL);
1344 EXCEPTION
1345 WHEN OTHERS THEN
1346 p_col_bal_def_table(i).balance_value2 := 0;
1347 --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);
1348 --Fnd_file.put_line(FND_FILE.LOG,'## p_defined_balance_id ' || p_col_bal_def_table(i).defined_balance_id2);
1349 --Fnd_file.put_line(FND_FILE.LOG,'## l_tax_unit_id ' || l_tax_unit_id);
1350 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text ' || l_source_text);
1351 --Fnd_file.put_line(FND_FILE.LOG,'## l_date_earned ' || l_date_earned);
1352 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text2 ' || l_source_text2);
1353 --Fnd_file.put_line(FND_FILE.LOG,'## l_balance_date ' || l_balance_date);
1354 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
1355 END;
1356 --##--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);
1357 --##--Fnd_file.put_line(FND_FILE.LOG,'######### Defined_balance_id : '||p_col_bal_def_table(i).defined_balance_id2);
1358 END IF;
1359 END LOOP;
1360 END populate_col_balance_values;
1361 --
1362 --------------------------------------------------------------------------------
1363 -- populate_col_balance_table pay_nl_wage_report_pkg.populate_col_balance_table
1364 --------------------------------------------------------------------------------
1365 PROCEDURE populate_col_balance_table(p_payroll_type VARCHAR2
1366 ,p_effective_date DATE
1367 ,p_payroll_action_id NUMBER
1368 ,p_swmf_col_bal_def_table IN OUT NOCOPY BAL_COL_TABLE) IS
1369 --
1370 x NUMBER;
1371 y NUMBER;
1372 l_tu_payroll_ptd VARCHAR2(30);
1373 l_tu_payroll_adj_ptd VARCHAR2(30);
1374 l_tu_payroll_corr_ptd VARCHAR2(30);
1375 l_tu_sit_payroll_ptd VARCHAR2(30);
1376 l_tu_sit_payroll_adj_ptd VARCHAR2(30);
1377 l_tu_sit_payroll_corr_ptd VARCHAR2(30);
1378 --
1379 CURSOR csr_chk_corr_ele_exists(c_pay_act_id NUMBER) IS
1380 SELECT 'Y'
1381 FROM DUAL
1382 WHERE EXISTS (SELECT /*+ ORDERED */ 1
1383 FROM pay_assignment_actions paa
1384 ,pay_action_information pai
1385 WHERE paa.payroll_action_id = c_pay_act_id
1386 AND pai.action_context_id = paa.assignment_action_id
1387 AND pai.action_context_type = 'AAP'
1388 AND pai.action_information_category = 'NL_WR_NOMINATIVE_REPORT_ADD'
1389 AND pai.action_information11 = 'Y');
1390 --
1391 l_curr_exits varchar2(1);
1392 --
1393 BEGIN
1394 --MONTHLY
1395 OPEN csr_chk_corr_ele_exists(p_payroll_action_id);
1396 FETCH csr_chk_corr_ele_exists INTO l_curr_exits;
1397 CLOSE csr_chk_corr_ele_exists;
1398 --
1399 --Fnd_file.put_line(FND_FILE.LOG,'#### l_curr_exits '||l_curr_exits);
1400 --
1401 IF p_payroll_type = 'MONTH' THEN
1402 l_tu_payroll_ptd := '_TU_MONTH_PTD';
1403 l_tu_payroll_adj_ptd := '_TU_MONTH_ADJ_PTD';
1404 l_tu_payroll_corr_ptd := '_TU_MONTH_REP_CORR_PTD';
1405 l_tu_sit_payroll_ptd := '_TU_SIT_MONTH_PTD';
1406 l_tu_sit_payroll_adj_ptd := '_TU_SIT_MONTH_ADJ_PTD';
1407 l_tu_sit_payroll_corr_ptd := '_TU_SIT_MONTH_REP_CORR_PTD';
1408 IF NVL(l_curr_exits,'N') = 'N' THEN
1409 l_tu_payroll_adj_ptd := '_TU_MONTH_PTD';
1410 l_tu_payroll_corr_ptd := NULL;
1411 l_tu_sit_payroll_adj_ptd := '_TU_SIT_MONTH_PTD';
1412 l_tu_sit_payroll_corr_ptd := NULL;
1413 END IF;
1414 IF g_retro_type = 'NEW' THEN
1415 l_tu_payroll_adj_ptd := NULL;
1416 l_tu_payroll_corr_ptd := '_TU_MONTH_BDATE_PTD';
1417 l_tu_sit_payroll_adj_ptd := NULL;
1418 l_tu_sit_payroll_corr_ptd := '_TU_SIT_MONTH_BDATE_PTD';
1419 END IF;
1420 ELSIF p_payroll_type = 'LMONTH' THEN
1421 l_tu_payroll_ptd := '_TU_LMONTH_PTD';
1422 l_tu_payroll_adj_ptd := '_TU_LMONTH_ADJ_PTD';
1423 l_tu_payroll_corr_ptd := '_TU_LMONTH_REP_CORR_PTD';
1424 l_tu_sit_payroll_ptd := '_TU_SIT_LMONTH_PTD';
1425 l_tu_sit_payroll_adj_ptd := '_TU_SIT_LMONTH_ADJ_PTD';
1426 l_tu_sit_payroll_corr_ptd := '_TU_SIT_LMONTH_REP_CORR_PTD';
1427 IF NVL(l_curr_exits,'N') = 'N' THEN
1428 l_tu_payroll_adj_ptd := '_TU_LMONTH_PTD';
1429 l_tu_payroll_corr_ptd := NULL;
1430 l_tu_sit_payroll_adj_ptd := '_TU_SIT_LMONTH_PTD';
1431 l_tu_sit_payroll_corr_ptd := NULL;
1432 END IF;
1433 IF g_retro_type = 'NEW' THEN
1434 l_tu_payroll_adj_ptd := NULL;
1435 l_tu_payroll_corr_ptd := '_TU_LMONTH_BDATE_PTD';
1436 l_tu_sit_payroll_adj_ptd := NULL;
1437 l_tu_sit_payroll_corr_ptd := '_TU_SIT_LMONTH_BDATE_PTD';
1438 END IF;
1439 ELSIF p_payroll_type = 'WEEK' THEN
1440 l_tu_payroll_ptd := '_TU_WEEKLY_PTD';
1441 l_tu_payroll_adj_ptd := '_TU_WEEKLY_PTD';
1442 l_tu_payroll_corr_ptd := NULL;
1443 l_tu_sit_payroll_ptd := '_TU_SIT_WEEKLY_PTD';
1444 l_tu_sit_payroll_adj_ptd := '_TU_SIT_WEEKLY_PTD';
1445 l_tu_sit_payroll_corr_ptd := NULL;
1446 END IF;
1447 --
1448 --Fnd_file.put_line(FND_FILE.LOG,' Populating Balanace Table for Collective Report');
1449 g_col_bal_def_table.delete;
1450 x:=1;
1451 g_col_bal_def_table(x).balance_name := 'Standard Taxable Income'; --1
1452 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1453 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1454 g_col_bal_def_table(x).context := NULL;
1455 g_col_bal_def_table(x).context_val := NULL;
1456 x := x+1;
1457 g_col_bal_def_table(x).balance_name := 'Retro Standard Taxable Income Current Quarter';
1458 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1459 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1460 g_col_bal_def_table(x).context := NULL;
1461 g_col_bal_def_table(x).context_val := NULL;
1462 x := x+1;
1463 g_col_bal_def_table(x).balance_name := 'Special Taxable Income';
1464 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1465 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1466 g_col_bal_def_table(x).context := NULL;
1467 g_col_bal_def_table(x).context_val := NULL;
1468 x := x+1;
1469 g_col_bal_def_table(x).balance_name := 'Retro Special Taxable Income';
1470 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1471 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1472 g_col_bal_def_table(x).context := NULL;
1473 g_col_bal_def_table(x).context_val := NULL;
1474 x := x+1;
1475 g_col_bal_def_table(x).balance_name := 'Retro Standard Taxable Income'; --5
1476 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1477 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1478 g_col_bal_def_table(x).context := NULL;
1479 g_col_bal_def_table(x).context_val := NULL;
1480 x := x+1;
1481 g_col_bal_def_table(x).balance_name := 'SI Income Standard Tax'; --6
1482 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1483 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1484 g_col_bal_def_table(x).context := NULL;
1485 g_col_bal_def_table(x).context_val := NULL;
1486 x := x+1;
1487 g_col_bal_def_table(x).balance_name := 'Retro SI Income Standard Tax';
1488 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1489 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1490 g_col_bal_def_table(x).context := NULL;
1491 g_col_bal_def_table(x).context_val := NULL;
1492 x := x+1;
1493 g_col_bal_def_table(x).balance_name := 'SI Income Special Tax';
1494 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1495 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1496 g_col_bal_def_table(x).context := NULL;
1497 g_col_bal_def_table(x).context_val := NULL;
1498 x := x+1;
1499 g_col_bal_def_table(x).balance_name := 'Retro SI Income Special Tax';
1500 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1501 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1502 g_col_bal_def_table(x).context := NULL;
1503 g_col_bal_def_table(x).context_val := NULL;
1504 x := x+1;
1505 g_col_bal_def_table(x).balance_name := 'SI Income Non Taxable'; -- 10
1506 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1507 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1508 g_col_bal_def_table(x).context := NULL;
1509 g_col_bal_def_table(x).context_val := NULL;
1510 x := x+1;
1511 g_col_bal_def_table(x).balance_name := 'Retro SI Income Non Taxable'; --11
1512 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1513 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1514 g_col_bal_def_table(x).context := NULL;
1515 g_col_bal_def_table(x).context_val := NULL;
1516 x := x+1;
1517 g_col_bal_def_table(x).balance_name := 'Actual SI Base Employer';
1518 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1519 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1520 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1521 g_col_bal_def_table(x).context_val := 'WAOB' ;
1522 x := x+1;
1523 g_col_bal_def_table(x).balance_name := 'Retro Actual SI Base Employer';
1524 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1525 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1526 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1527 g_col_bal_def_table(x).context_val := 'WAOB';
1528 x := x+1;
1529 g_col_bal_def_table(x).balance_name := 'Actual SI Base';
1530 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1531 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1532 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1533 g_col_bal_def_table(x).context_val := 'WAOD' ;
1534 x := x+1;
1535 g_col_bal_def_table(x).balance_name := 'Retro Actual SI Base'; -- 15
1536 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1537 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1538 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1539 g_col_bal_def_table(x).context_val := 'WAOD';
1540 x := x+1;
1541 g_col_bal_def_table(x).balance_name := 'Actual SI Base'; --16
1542 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1543 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1544 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1545 g_col_bal_def_table(x).context_val := 'WEWE' ;
1546 x := x+1;
1547 g_col_bal_def_table(x).balance_name := 'Retro Actual SI Base';
1548 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1549 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1550 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1551 g_col_bal_def_table(x).context_val := 'WEWE' ;
1552 x := x+1;
1553 g_col_bal_def_table(x).balance_name := 'Actual SI Base'; --18
1554 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1555 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1556 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1557 g_col_bal_def_table(x).context_val := 'UFO' ;
1558 x := x+1;
1559 g_col_bal_def_table(x).balance_name := 'Retro Actual SI Base'; --19
1560 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1561 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1562 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1563 g_col_bal_def_table(x).context_val := 'UFO' ;
1564 x := x+1;
1565 g_col_bal_def_table(x).balance_name := 'Employer ZVW Contribution Standard Tax';
1566 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1567 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1568 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1569 g_col_bal_def_table(x).context_val := 'ZVW' ; --20
1570 x := x+1;
1571 g_col_bal_def_table(x).balance_name := 'Employer ZVW Contribution Special Tax';
1572 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1573 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1574 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1575 g_col_bal_def_table(x).context_val := 'ZVW' ;
1576 x := x+1;
1577 g_col_bal_def_table(x).balance_name := 'Employer SI Contribution Non Taxable';
1578 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1579 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1580 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1581 g_col_bal_def_table(x).context_val := 'ZVW' ;
1582 x := x+1;
1583 g_col_bal_def_table(x).balance_name := 'Employer SI Contribution';
1584 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1585 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1586 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1587 g_col_bal_def_table(x).context_val := 'ZVW' ;
1588 x := x+1;
1589 g_col_bal_def_table(x).balance_name := 'Retro Employer ZVW Contribution Standard Tax';
1590 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1591 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1592 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1593 g_col_bal_def_table(x).context_val := 'ZVW' ;
1594 x := x+1;
1595 g_col_bal_def_table(x).balance_name := 'Retro Employer ZVW Contribution Special Tax';
1596 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1597 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1598 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1599 g_col_bal_def_table(x).context_val := 'ZVW' ; --25
1600 x := x+1;
1601 g_col_bal_def_table(x).balance_name := 'Retro Employer SI Contribution Non Taxable';
1602 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1603 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1604 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1605 g_col_bal_def_table(x).context_val := 'ZVW' ;
1606 x := x+1;
1607 g_col_bal_def_table(x).balance_name := 'Retro Employer SI Contribution';
1608 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1609 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1610 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1611 g_col_bal_def_table(x).context_val := 'ZVW' ; --27
1612 x := x+1;
1613 g_col_bal_def_table(x).balance_name := 'Standard Tax Deduction'; --28
1614 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1615 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1616 g_col_bal_def_table(x).context := NULL;
1617 g_col_bal_def_table(x).context_val := NULL;
1618 x := x+1;
1619 g_col_bal_def_table(x).balance_name := 'Retro Standard Tax Deduction Current Quarter';
1620 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1621 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1622 g_col_bal_def_table(x).context := NULL;
1623 g_col_bal_def_table(x).context_val := NULL ;
1624 x := x+1;
1625 g_col_bal_def_table(x).balance_name := 'Special Tax Deduction'; --30
1626 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1627 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1628 g_col_bal_def_table(x).context := NULL;
1629 g_col_bal_def_table(x).context_val := NULL ;
1630 x := x+1;
1631 g_col_bal_def_table(x).balance_name := 'Retro Special Tax Deduction'; --31
1632 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1633 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1634 g_col_bal_def_table(x).context := NULL;
1635 g_col_bal_def_table(x).context_val := NULL ;
1636 x := x+1;
1637 g_col_bal_def_table(x).balance_name := 'Retro Standard Tax Deduction'; --32
1638 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1639 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1640 g_col_bal_def_table(x).context := NULL;
1641 g_col_bal_def_table(x).context_val := NULL ;
1642 x := x+1;
1643 g_col_bal_def_table(x).balance_name := 'Major Issue Flat Rate Tax Deduction'; --33
1644 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1645 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1646 g_col_bal_def_table(x).context := NULL;
1647 g_col_bal_def_table(x).context_val := NULL ;
1648 x := x+1;
1649 g_col_bal_def_table(x).balance_name := 'Retro Major Issue Flat Rate Tax Deduction';--34
1650 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1651 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1652 g_col_bal_def_table(x).context := NULL;
1653 g_col_bal_def_table(x).context_val := NULL ;
1654 x := x+1;
1655 g_col_bal_def_table(x).balance_name := 'Single Rate Special Target Tax Deduction'; --35
1656 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1657 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1658 g_col_bal_def_table(x).context := NULL;
1659 g_col_bal_def_table(x).context_val := NULL ;
1660 x := x+1;
1661 g_col_bal_def_table(x).balance_name := 'Retro Single Rate Special Target Tax Deduction';
1662 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1663 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1664 g_col_bal_def_table(x).context := NULL;
1665 g_col_bal_def_table(x).context_val := NULL ;
1666 x := x+1;
1667 g_col_bal_def_table(x).balance_name := 'Wage Saving Tax Deduction'; --37
1668 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1669 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1670 g_col_bal_def_table(x).context := NULL;
1671 g_col_bal_def_table(x).context_val := NULL ;
1672 x := x+1;
1673 g_col_bal_def_table(x).balance_name := 'Retro Wage Saving Tax Deduction'; --38
1674 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1675 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1676 g_col_bal_def_table(x).context := NULL;
1677 g_col_bal_def_table(x).context_val := NULL ;
1678 x := x+1;
1679 g_col_bal_def_table(x).balance_name := 'Premium Saving Tax Deduction';
1680 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1681 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1682 g_col_bal_def_table(x).context := NULL;
1683 g_col_bal_def_table(x).context_val := NULL ;
1684 x := x+1;
1685 g_col_bal_def_table(x).balance_name := 'Retro Premium Saving Tax Deduction'; --40
1686 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1687 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1688 g_col_bal_def_table(x).context := NULL;
1689 g_col_bal_def_table(x).context_val := NULL ;
1690 x := x+1;
1691 g_col_bal_def_table(x).balance_name := 'Single Rate Exceptional Payment Tax Deduction'; --41
1692 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1693 g_col_bal_def_table(x).database_item_suffix2 := NULL; -- Bug# 5754707
1694 g_col_bal_def_table(x).context := NULL;
1695 g_col_bal_def_table(x).context_val := NULL ;
1696 x := x+1;
1697 g_col_bal_def_table(x).balance_name := 'Retro Single Rate Exceptional Payment Tax Deduction'; --42
1698 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1699 g_col_bal_def_table(x).database_item_suffix2 := NULL; -- Bug# 5754707
1700 g_col_bal_def_table(x).context := NULL;
1701 g_col_bal_def_table(x).context_val := NULL ;
1702 x := x+1;
1703 g_col_bal_def_table(x).balance_name := 'Gross Up Rate Exceptional Payment Tax Deduction'; --43
1704 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1705 g_col_bal_def_table(x).database_item_suffix2 := NULL; -- Bug# 5754707
1706 g_col_bal_def_table(x).context := NULL;
1707 g_col_bal_def_table(x).context_val := NULL;
1708 x := x+1;
1709 g_col_bal_def_table(x).balance_name := 'Retro Gross Up Rate Exceptional Payment Tax Deduction';
1710 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1711 g_col_bal_def_table(x).database_item_suffix2 := NULL; -- Bug# 5754707
1712 g_col_bal_def_table(x).context := NULL;
1713 g_col_bal_def_table(x).context_val := NULL ;
1714 x := x+1;
1715 g_col_bal_def_table(x).balance_name := 'National Holiday Gift Tax Deduction'; --45
1716 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1717 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1718 g_col_bal_def_table(x).context := NULL;
1719 g_col_bal_def_table(x).context_val := NULL ;
1720 x := x+1;
1721 g_col_bal_def_table(x).balance_name := 'Retro National Holiday Gift Tax Deduction';
1722 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1723 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1724 g_col_bal_def_table(x).context := NULL;
1725 g_col_bal_def_table(x).context_val := NULL ;
1726 x := x+1;
1727 g_col_bal_def_table(x).balance_name := 'Gross Up Rate Exceeding Allowance Tax Deduction'; --47
1728 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1729 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1730 g_col_bal_def_table(x).context := NULL;
1731 g_col_bal_def_table(x).context_val := NULL ;
1732 x := x+1;
1733 g_col_bal_def_table(x).balance_name := 'Retro Gross Up Rate Exceeding Allowance Tax Deduction';
1734 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1735 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1736 g_col_bal_def_table(x).context := NULL;
1737 g_col_bal_def_table(x).context_val := NULL ;
1738 x := x+1;
1739 g_col_bal_def_table(x).balance_name := 'Pre Pension Tax Deduction'; -- 49
1740 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1741 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1742 g_col_bal_def_table(x).context := NULL;
1743 g_col_bal_def_table(x).context_val := NULL ;
1744 x := x+1;
1745 g_col_bal_def_table(x).balance_name := 'Retro Pre Pension Tax Deduction'; --50
1746 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1747 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1748 g_col_bal_def_table(x).context := NULL;
1749 g_col_bal_def_table(x).context_val := NULL;
1750 x := x+1;
1751 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Paid Parental Leave';
1752 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1753 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1754 g_col_bal_def_table(x).context := NULL;
1755 g_col_bal_def_table(x).context_val := NULL ;
1756 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
1757 g_col_bal_def_table(x).database_item_suffix := NULL;
1758 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1759 END IF;
1760 x := x+1;
1761 g_col_bal_def_table(x).balance_name := 'Retro Wage Tax Subsidy Paid Parental Leave';
1762 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1763 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1764 g_col_bal_def_table(x).context := NULL;
1765 g_col_bal_def_table(x).context_val := NULL ;
1766 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
1767 g_col_bal_def_table(x).database_item_suffix := NULL;
1768 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1769 END IF;
1770 x := x+1;
1771 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Long Term Unemployed'; -- 53
1772 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1773 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1774 g_col_bal_def_table(x).context := NULL;
1775 g_col_bal_def_table(x).context_val := NULL;
1776 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
1777 g_col_bal_def_table(x).database_item_suffix := NULL;
1778 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1779 END IF;
1780 x := x+1;
1781 g_col_bal_def_table(x).balance_name := 'Retro Wage Tax Subsidy Long Term Unemployed'; --54
1782 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1783 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1784 g_col_bal_def_table(x).context := NULL;
1785 g_col_bal_def_table(x).context_val := NULL ;
1786 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
1787 g_col_bal_def_table(x).database_item_suffix := NULL;
1788 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1789 END IF;
1790 x := x+1;
1791 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Arbo Non Profit'; -- 55 ---problem starts here..
1792 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1793 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1794 g_col_bal_def_table(x).context := NULL;
1795 g_col_bal_def_table(x).context_val := NULL ;
1796 x := x+1;
1797 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Sea Going EES'; --56
1798 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1799 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1800 g_col_bal_def_table(x).context := NULL;
1801 g_col_bal_def_table(x).context_val := NULL ;
1802 x := x+1;
1803 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Education'; --57
1804 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1805 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1806 g_col_bal_def_table(x).context := NULL;
1807 g_col_bal_def_table(x).context_val := NULL;
1808 x := x+1;
1809 g_col_bal_def_table(x).balance_name := 'Retro Wage Tax Subsidy Education'; -- 58
1810 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1811 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1812 g_col_bal_def_table(x).context := NULL;
1813 g_col_bal_def_table(x).context_val := NULL;
1814 x := x+1;
1815 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Research'; --59
1816 g_col_bal_def_table(x).database_item_suffix := NULL; -- Bug# 5754707
1817 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1818 g_col_bal_def_table(x).context := NULL;
1819 g_col_bal_def_table(x).context_val := NULL;
1820 x := x+1;
1821 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; --60
1822 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1823 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1824 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1825 g_col_bal_def_table(x).context_val := 'WAOB' ;
1826 x := x+1;
1827 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --61
1828 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1829 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1830 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1831 g_col_bal_def_table(x).context_val := 'WAOB' ;
1832 x := x+1;
1833 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; --62
1834 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1835 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1836 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1837 g_col_bal_def_table(x).context_val := 'WGA' ;
1838 x := x+1;
1839 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --63
1840 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1841 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1842 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1843 g_col_bal_def_table(x).context_val := 'WGA' ;
1844 x := x+1;
1845 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; -- 64
1846 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1847 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1848 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1849 g_col_bal_def_table(x).context_val := 'IVA' ;
1850 x := x+1;
1851 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --65
1852 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1853 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1854 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1855 g_col_bal_def_table(x).context_val := 'IVA' ;
1856 x := x+1;
1857 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; --66
1858 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1859 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1860 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1861 g_col_bal_def_table(x).context_val := 'WAOD' ;
1862 x := x+1;
1863 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --67
1864 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1865 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1866 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1867 g_col_bal_def_table(x).context_val := 'WAOD' ;
1868 x := x+1;
1869 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; --68
1870 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1871 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1872 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1873 g_col_bal_def_table(x).context_val := 'WEWE' ;
1874 x := x+1;
1875 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --69
1876 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1877 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1878 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1879 g_col_bal_def_table(x).context_val := 'WEWE' ;
1880 x := x+1;
1881 g_col_bal_def_table(x).balance_name := 'Wage Report SI Contribution'; --70
1882 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1883 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1884 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1885 g_col_bal_def_table(x).context_val := 'UFO' ;
1886 x := x+1;
1887 g_col_bal_def_table(x).balance_name := 'Wage Report Retro SI Contribution'; --71
1888 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1889 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1890 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1891 g_col_bal_def_table(x).context_val := 'UFO' ;
1892 x := x+1;
1893 g_col_bal_def_table(x).balance_name := 'Wage Report Employee SI Contribution'; --72
1894 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
1895 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1896 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1897 g_col_bal_def_table(x).context_val := 'ZVW' ;
1898 x := x+1;
1899 g_col_bal_def_table(x).balance_name := 'Wage Report Retro Employee SI Contribution'; --73
1900 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
1901 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
1902 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
1903 g_col_bal_def_table(x).context_val := 'ZVW' ;
1904 x := x+1;
1905 g_col_bal_def_table(x).balance_name := 'Labour Handicap Discount'; --74
1906 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1907 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1908 g_col_bal_def_table(x).context := NULL;
1909 g_col_bal_def_table(x).context_val := NULL;
1910 x := x+1;
1911 g_col_bal_def_table(x).balance_name := 'Retro Labour Handicap Discount'; --75
1912 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1913 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1914 g_col_bal_def_table(x).context := NULL;
1915 g_col_bal_def_table(x).context_val := NULL;
1916 x := x+1;
1917 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy EVC'; --76
1918 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1919 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1920 g_col_bal_def_table(x).context := NULL;
1921 g_col_bal_def_table(x).context_val := NULL;
1922 x := x+1;
1923 g_col_bal_def_table(x).balance_name := 'Retro Wage Tax Subsidy EVC'; -- 77
1924 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1925 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1926 g_col_bal_def_table(x).context := NULL;
1927 g_col_bal_def_table(x).context_val := NULL;
1928 x := x+1;
1929 g_col_bal_def_table(x).balance_name := 'Standard Tax Correction'; --78
1930 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1931 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1932 g_col_bal_def_table(x).context := NULL;
1933 g_col_bal_def_table(x).context_val := NULL;
1934 x := x+1;
1935 g_col_bal_def_table(x).balance_name := 'Special Tax Correction'; --79
1936 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1937 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1938 g_col_bal_def_table(x).context := NULL;
1939 g_col_bal_def_table(x).context_val := NULL;
1940 x := x+1;
1941 g_col_bal_def_table(x).balance_name := 'Life Cycle Leave Discount'; --80
1942 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1943 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1944 g_col_bal_def_table(x).context := NULL;
1945 g_col_bal_def_table(x).context_val := NULL;
1946 x := x+1;
1947 g_col_bal_def_table(x).balance_name := 'Retro Life Cycle Leave Discount'; -- 81
1948 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1949 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1950 g_col_bal_def_table(x).context := NULL;
1951 g_col_bal_def_table(x).context_val := NULL;
1952 --
1953 --LC 2010-- begin
1954 IF p_effective_date >= TO_DATE('01012010','DDMMYYYY') THEN
1955 x := x+1;
1956 g_col_bal_def_table(x).balance_name := 'Discount due to Labour Handicap'; --82
1957 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1958 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1959 g_col_bal_def_table(x).context := NULL;
1960 g_col_bal_def_table(x).context_val := NULL;
1961 x := x+1;
1962 g_col_bal_def_table(x).balance_name := 'Retro Discount due to Labour Handicap'; --83
1963 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1964 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1965 g_col_bal_def_table(x).context := NULL;
1966 g_col_bal_def_table(x).context_val := NULL;
1967 x := x+1;
1968 g_col_bal_def_table(x).balance_name := 'Discount for Hired Old Employees'; --84
1969 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1970 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1971 g_col_bal_def_table(x).context := NULL;
1972 g_col_bal_def_table(x).context_val := NULL;
1973 x := x+1;
1974 g_col_bal_def_table(x).balance_name := 'Retro Discount for Hired Old Employees'; --85
1975 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1976 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1977 g_col_bal_def_table(x).context := NULL;
1978 g_col_bal_def_table(x).context_val := NULL;
1979 x := x+1;
1980 g_col_bal_def_table(x).balance_name := 'Discount for Old Employees'; --86
1981 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1982 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1983 g_col_bal_def_table(x).context := NULL;
1984 g_col_bal_def_table(x).context_val := NULL;
1985 x := x+1;
1986 g_col_bal_def_table(x).balance_name := 'Retro Discount for Old Employees'; --87
1987 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
1988 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
1989 g_col_bal_def_table(x).context := NULL;
1990 g_col_bal_def_table(x).context_val := NULL;
1991 x := x+1;
1992 g_col_bal_def_table(x).balance_name := 'Total Contribution Wage for PMA'; --88
1993 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
1994 g_col_bal_def_table(x).database_item_suffix2 := NULL;
1995 g_col_bal_def_table(x).context := NULL;
1996 g_col_bal_def_table(x).context_val := NULL;
1997 x := x+1;
1998 g_col_bal_def_table(x).balance_name := 'Retro Total Contribution Wage for PMA'; --89
1999 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
2000 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
2001 g_col_bal_def_table(x).context := NULL;
2002 g_col_bal_def_table(x).context_val := NULL;
2003 END IF;
2004 --LC 2010-- end
2005 --
2006 --LC 2013 --BEGIN
2007 IF p_effective_date >= TO_DATE('01012013','DDMMYYYY') THEN
2008 x := x+1;
2009 g_col_bal_def_table(x).balance_name := 'Wage Report Employee SI Contribution'; --90
2010 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
2011 g_col_bal_def_table(x).database_item_suffix2 := NULL;
2012 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
2013 g_col_bal_def_table(x).context_val := 'ZVWL';
2014 x := x+1;
2015 g_col_bal_def_table(x).balance_name := 'Wage Report Retro Employee SI Contribution'; --91
2016 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
2017 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
2018 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
2019 g_col_bal_def_table(x).context_val := 'ZVWL';
2020
2021 x := x+1;
2022 g_col_bal_def_table(x).balance_name := 'Wage Report Employer SI Contribution'; --92
2023 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_ptd;
2024 g_col_bal_def_table(x).database_item_suffix2 := NULL;
2025 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
2026 g_col_bal_def_table(x).context_val := 'ZVWS';
2027 x := x+1;
2028 g_col_bal_def_table(x).balance_name := 'Wage Report Retro Employer SI Contribution'; --93
2029 g_col_bal_def_table(x).database_item_suffix := l_tu_sit_payroll_adj_ptd;
2030 g_col_bal_def_table(x).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
2031 g_col_bal_def_table(x).context := 'SOURCE_TEXT';
2032 g_col_bal_def_table(x).context_val := 'ZVWS';
2033 END IF;
2034 --LC 2013 --END
2035
2036 --10188214
2037 IF to_char(p_effective_date,'RRRR') = '2010' THEN
2038
2039 x := x+1;
2040 g_col_bal_def_table(x).balance_name := 'Wage Tax Subsidy Increasing Education Level'; --94
2041 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_ptd;
2042 g_col_bal_def_table(x).database_item_suffix2 := NULL;
2043 g_col_bal_def_table(x).context := NULL;
2044 g_col_bal_def_table(x).context_val := NULL;
2045 x := x+1;
2046 g_col_bal_def_table(x).balance_name := 'Retro Wage Tax Subsidy Increasing Education Level'; -- 95
2047 g_col_bal_def_table(x).database_item_suffix := l_tu_payroll_adj_ptd;
2048 g_col_bal_def_table(x).database_item_suffix2 := l_tu_payroll_corr_ptd;
2049 g_col_bal_def_table(x).context := NULL;
2050 g_col_bal_def_table(x).context_val := NULL;
2051
2052 END IF;
2053
2054 --10188214
2055
2056 FOR i in g_col_bal_def_table.FIRST..g_col_bal_def_table.LAST LOOP
2057 IF g_col_bal_def_table(i).database_item_suffix IS NOT NULL THEN
2058 g_col_bal_def_table(i).defined_balance_id := get_defined_balance_id(g_col_bal_def_table(i).balance_name
2059 ,g_col_bal_def_table(i).database_item_suffix);
2060 ELSE
2061 g_col_bal_def_table(i).defined_balance_id := 0;
2062 END IF;
2063 IF g_col_bal_def_table(i).database_item_suffix2 IS NOT NULL THEN
2064 g_col_bal_def_table(i).defined_balance_id2 := get_defined_balance_id(g_col_bal_def_table(i).balance_name
2065 ,g_col_bal_def_table(i).database_item_suffix2);
2066 ELSE
2067 g_col_bal_def_table(i).defined_balance_id2 := 0;
2068 END IF;
2069 --Fnd_file.put_line(FND_FILE.LOG,i ||' : '||g_col_bal_def_table(i).defined_balance_id || i || ' :2: ' || g_col_bal_def_table(i).defined_balance_id);
2070 END LOOP;
2071 --
2072 --
2073 IF p_payroll_type = 'MONTH' THEN
2074 l_tu_sit_payroll_ptd := '_TU_SIP_MONTH_PTD';
2075 l_tu_sit_payroll_adj_ptd := '_TU_SIP_MONTH_ADJ_PTD';
2076 l_tu_sit_payroll_corr_ptd := '_TU_SIP_MONTH_REP_CORR_PTD';
2077 IF NVL(l_curr_exits,'N') = 'N' THEN
2078 l_tu_sit_payroll_adj_ptd := '_TU_SIP_MONTH_PTD';
2079 l_tu_sit_payroll_corr_ptd := NULL;
2080 END IF;
2081 IF g_retro_type = 'NEW' THEN
2082 l_tu_sit_payroll_adj_ptd := NULL;
2083 l_tu_sit_payroll_corr_ptd := '_TU_SIP_MONTH_BDATE_PTD';
2084 END IF;
2085 ELSIF p_payroll_type = 'LMONTH' THEN
2086 l_tu_sit_payroll_ptd := '_TU_SIP_LMONTH_PTD';
2087 l_tu_sit_payroll_adj_ptd := '_TU_SIP_LMONTH_ADJ_PTD';
2088 l_tu_sit_payroll_corr_ptd := '_TU_SIP_LMONTH_REP_CORR_PTD';
2089 IF NVL(l_curr_exits,'N') = 'N' THEN
2090 l_tu_sit_payroll_adj_ptd := '_TU_SIP_LMONTH_PTD';
2091 l_tu_sit_payroll_corr_ptd := NULL;
2092 END IF;
2093 IF g_retro_type = 'NEW' THEN
2094 l_tu_sit_payroll_adj_ptd := NULL;
2095 l_tu_sit_payroll_corr_ptd := '_TU_SIP_LMONTH_BDATE_PTD';
2096 END IF;
2097 ELSIF p_payroll_type = 'WEEK' THEN
2098 l_tu_sit_payroll_ptd := '_TU_SIP_WEEKLY_PTD';
2099 l_tu_sit_payroll_adj_ptd := '_TU_SIP_WEEKLY_PTD';
2100 l_tu_sit_payroll_corr_ptd := NULL;
2101 END IF;
2102 --
2103 --p_swmf_col_bal_def_table.delete;
2104 --Fnd_file.put_line(FND_FILE.LOG,' Populating Balanace Table for SWMF');
2105 y := 1;
2106 p_swmf_col_bal_def_table(y).balance_name := 'Actual SI Base';--1
2107 p_swmf_col_bal_def_table(y).database_item_suffix := l_tu_sit_payroll_ptd;
2108 p_swmf_col_bal_def_table(y).database_item_suffix2 := NULL;
2109 p_swmf_col_bal_def_table(y).context := 'SOURCE_TEXT';
2110 p_swmf_col_bal_def_table(y).context_val := 'WEWA' ;
2111 y := y+1;
2112 p_swmf_col_bal_def_table(y).balance_name := 'Retro Actual SI Base';
2113 p_swmf_col_bal_def_table(y).database_item_suffix := l_tu_sit_payroll_adj_ptd;
2114 p_swmf_col_bal_def_table(y).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
2115 p_swmf_col_bal_def_table(y).context := 'SOURCE_TEXT';
2116 p_swmf_col_bal_def_table(y).context_val := 'WEWA' ;
2117 y := y+1;
2118 p_swmf_col_bal_def_table(y).balance_name := 'Wage Report SI Contribution';
2119 p_swmf_col_bal_def_table(y).database_item_suffix := l_tu_sit_payroll_ptd;
2120 p_swmf_col_bal_def_table(y).database_item_suffix2 := NULL;
2121 p_swmf_col_bal_def_table(y).context := 'SOURCE_TEXT';
2122 p_swmf_col_bal_def_table(y).context_val := 'WEWA' ;
2123 y := y+1;
2124 p_swmf_col_bal_def_table(y).balance_name := 'Wage Report Retro SI Contribution'; --4
2125 p_swmf_col_bal_def_table(y).database_item_suffix := l_tu_sit_payroll_adj_ptd;
2126 p_swmf_col_bal_def_table(y).database_item_suffix2 := l_tu_sit_payroll_corr_ptd;
2127 p_swmf_col_bal_def_table(y).context := 'SOURCE_TEXT';
2128 p_swmf_col_bal_def_table(y).context_val := 'WEWA' ;
2129 --
2130 FOR i in p_swmf_col_bal_def_table.FIRST..p_swmf_col_bal_def_table.LAST LOOP
2131 IF p_swmf_col_bal_def_table(i).database_item_suffix IS NOT NULL THEN
2132 p_swmf_col_bal_def_table(i).defined_balance_id := get_defined_balance_id(p_swmf_col_bal_def_table(i).balance_name
2133 ,p_swmf_col_bal_def_table(i).database_item_suffix);
2134 ELSE
2135 p_swmf_col_bal_def_table(i).defined_balance_id := 0;
2136 END IF;
2137 IF p_swmf_col_bal_def_table(i).database_item_suffix2 IS NOT NULL THEN
2138 p_swmf_col_bal_def_table(i).defined_balance_id2 := get_defined_balance_id(p_swmf_col_bal_def_table(i).balance_name
2139 ,p_swmf_col_bal_def_table(i).database_item_suffix2);
2140 ELSE
2141 p_swmf_col_bal_def_table(i).defined_balance_id2 := 0;
2142 END IF;
2143 END LOOP;
2144 --Fnd_file.put_line(FND_FILE.LOG,' Populated Balanace Tables');
2145 --
2146 END populate_col_balance_table;
2147 --
2148 --------------------------------------------------------------------------------
2149 -- populate_coll_bal_table pay_nl_wage_report_pkg.populate_coll_bal_table
2150 --------------------------------------------------------------------------------
2151 PROCEDURE populate_coll_bal_table(p_actid IN NUMBER
2152 ,p_tax_unit_id IN NUMBER
2153 ,p_effective_date IN DATE
2154 ,p_balance_date IN DATE
2155 ,p_type IN VARCHAR2
2156 ,p_ass_action_id IN NUMBER
2157 ,p_payroll_type IN VARCHAR2
2158 ,p_emp_total IN OUT NOCOPY NUMBER
2159 ,p_collXMLTable OUT NOCOPY tXMLTable) IS
2160 --
2161 CURSOR csr_get_org_tax_data(c_org_id NUMBER
2162 ,c_payroll_type VARCHAR2) IS
2163 SELECT fnd_date.canonical_to_date(org_information1) start_date
2164 ,fnd_date.canonical_to_date(org_information2) end_date
2165 ,org_information3
2166 ,fnd_number.canonical_to_number(org_information4) amount
2167 ,org_information5 frequency
2168 ,org_information6
2169 FROM hr_organization_information
2170 WHERE organization_id = c_org_id
2171 AND org_information_context = 'NL_ORG_FLAT_RATE_TAXATION'
2172 -- AND org_information3 = '1' -- Bug# 5754707
2173 AND org_information6 = c_payroll_type
2174 ORDER BY fnd_date.canonical_to_date(org_information1);
2175 --Bug 14125837 begin
2176 CURSOR csr_get_org_corr_data(c_org_id NUMBER
2177 ,c_payroll_type VARCHAR2
2178 ,c_balance_date DATE) IS
2179 SELECT fnd_date.canonical_to_date (org_information1) start_date
2180 ,fnd_date.canonical_to_date (org_information2) end_date
2181 ,org_information3 tag_name
2182 ,fnd_number.canonical_to_number (org_information4) amount
2183 ,org_information5 frequency
2184 FROM hr_organization_information
2185 WHERE organization_id = c_org_id
2186 AND org_information_context = 'NL_ORG_WR_PREV_YR_CORRECTION'
2187 AND org_information6 = c_payroll_type
2188 AND c_balance_date BETWEEN fnd_date.canonical_to_date (org_information1)
2189 AND nvl (fnd_date.canonical_to_date (org_information2)
2190 ,hr_general.end_of_time)
2191 ORDER BY fnd_date.canonical_to_date (org_information1);
2192 --Bug 14125837 end
2193 CURSOR csr_get_no_pay_period(c_payroll_type VARCHAR2) IS
2194 SELECT number_per_fiscal_year
2195 FROM per_time_period_types
2196 WHERE period_type = DECODE(c_payroll_type,'MONTH','Calendar Month','WEEK','Week','LMONTH','Lunar Month');
2197 --
2198 y NUMBER ;
2199 l_flat_rate_taxation NUMBER := 0;
2200 l_major_issue_flat_rate NUMBER := 0;
2201 l_single_rate_exp_pay NUMBER := 0;
2202 l_wage_tax_subsidy NUMBER := 0;
2203 l_flat_tax_holidays NUMBER := 0;
2204 l_flat_tax_pre_pension NUMBER := 0; /* 7533686 */
2205 l_no_pay_period NUMBER;
2206 l_flat_tax_lca NUMBER := 0; --10370520
2207 --bug 14125837 begin
2208 l_corr_ehlnbestkar NUMBER := NULL;
2209 l_corr_ehbmverg NUMBER := NULL;
2210 l_corr_avond NUMBER := NULL;
2211 l_corr_pkagh NUMBER := NULL;
2212 l_corr_pknwarbvoudwn NUMBER := NULL;
2213 l_corr_pkindnstoudwn NUMBER := NULL;
2214 l_amount NUMBER := 0;
2215 --bug 14125837 end
2216 --10100628
2217 CURSOR C_PREV_CORR_COLL_VAL(p_payroll_action_id NUMBER, p_date DATE)
2218 IS
2219 SELECT
2220 --fnd_date.canonical_to_date(paei.AEI_INFORMATION1) start_date
2221 --,fnd_date.canonical_to_date(paei.AEI_INFORMATION2) end_date
2222 SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION3)) LnLbPh
2223 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION4)) LnSV
2224 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION5)) LnTabBB
2225 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION6)) VakBsl
2226 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION7)) OpgRchtVakBsl
2227 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION8)) ExtrSal
2228 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION9)) OpgRchtExtrSal
2229 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION10)) LnInGld
2230 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION11)) WrdLn
2231 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION12)) LnOwrk
2232 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION13)) IngLbPh
2233 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION14)) PrWAOAof
2234 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION15)) PrWAOAok
2235 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION16)) PrAWF
2236 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION17)) PrWgf
2237 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION18)) PrUFO
2238 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION19)) BijdrZvw
2239 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION20)) VergZvw
2240 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION21)) Reisk
2241 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION22)) VerrArbKrt
2242 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION23)) AantSV
2243 --,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION24)) AantVerlU --10100628
2244 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION25)) LvLpReg
2245 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION26)) LvLpRegToeg
2246 --10100628
2247 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION24)) PrLnWao
2248 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION27)) PrLnWaoWga
2249 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION28)) PrLnWwAwf
2250 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION29)) PrLnUfo
2251 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION30)) PrLnPrSectFnds
2252 --10100628
2253 FROM per_assignment_extra_info paei
2254 WHERE
2255 paei.aei_information_category = 'NL_WR_PREV_CORR'
2256 AND p_date BETWEEN fnd_date.canonical_to_date(paei.aei_information1)
2257 AND nvl(fnd_date.canonical_to_date(paei.aei_information2),to_date('31-12-4712','dd-mm-yyyy'))
2258 AND EXISTS
2259 (
2260 SELECT 1
2261 from
2262 pay_assignment_actions paa
2263 where
2264 paa.payroll_action_id = p_payroll_action_id
2265 and paa.action_status = 'C'
2266 and paa.assignment_id = paei.assignment_id
2267 );
2268
2269 l_co_col_LnLbPh NUMBER := 0;
2270 l_co_col_LnSV NUMBER := 0;
2271 l_co_col_LnTabBB NUMBER := 0;
2272 l_co_col_VakBsl NUMBER := 0;
2273 l_co_col_OpgRchtVakBsl NUMBER := 0;
2274 l_co_col_ExtrSal NUMBER := 0;
2275 l_co_col_OpgRchtExtrSal NUMBER := 0;
2276 l_co_col_LnInGld NUMBER := 0;
2277 l_co_col_WrdLn NUMBER := 0;
2278 l_co_col_LnOwrk NUMBER := 0;
2279 l_co_col_IngLbPh NUMBER := 0;
2280 l_co_col_PrWAOAof NUMBER := 0;
2281 l_co_col_PrWAOAok NUMBER := 0;
2282 l_co_col_PrAWF NUMBER := 0;
2283 l_co_col_PrWgf NUMBER := 0;
2284 l_co_col_PrUFO NUMBER := 0;
2285 l_co_col_BijdrZvw NUMBER := 0;
2286 l_co_col_VergZvw NUMBER := 0;
2287 l_co_col_Reisk NUMBER := 0;
2288 l_co_col_VerrArbKrt NUMBER := 0;
2289 l_co_col_AantSV NUMBER := 0;
2290 l_co_col_AantVerlU NUMBER := 0;
2291 l_co_col_LvLpReg NUMBER := 0;
2292 l_co_col_LvLpRegToeg NUMBER := 0;
2293 --10100628
2294 l_co_col_PrLnWao NUMBER := 0;
2295 l_co_col_PrLnWaoWga NUMBER := 0;
2296 l_co_col_PrLnWwAwf NUMBER := 0;
2297 l_co_col_PrLnUfo NUMBER := 0;
2298 l_co_col_PrLnPrSectFnds NUMBER := 0;
2299 --10100628
2300
2301 l_prev_corr_yr VARCHAR2(100);
2302 --10100628
2303
2304 l_employer_tax_high_wages NUMBER := 0;
2305 --16514249
2306
2307
2308 l_taxable_income NUMBER := 0;
2309
2310 FUNCTION get_lca_details(p_taxable_income IN NUMBER
2311 ,p_date IN DATE
2312 ,p_payroll_type IN VARCHAR2
2313 ,p_tax_unit_id IN NUMBER
2314 ,p_actid IN NUMBER
2315 ,p_ass_action_id IN NUMBER)
2316 RETURN NUMBER
2317 IS
2318
2319 /* Cursor to fetch Org LCA information as of Balance Date */
2320
2321 CURSOR csr_get_org_lca_data(c_org_id NUMBER,
2322 c_date DATE) IS
2323 SELECT org_information2 method
2324 ,fnd_number.canonical_to_number (org_information3) amount
2325 FROM hr_organization_information
2326 WHERE organization_id = c_org_id
2327 AND org_information_context = 'NL_ORG_LCA_INFO'
2328 AND org_information1 = to_char(c_date,'YYYY');
2329 ----
2330 CURSOR csr_global_value(c_global_name VARCHAR2,
2331 c_effective_date DATE) IS
2332 SELECT fnd_number.canonical_to_number (global_value)
2333 FROM ff_globals_f
2334 WHERE global_name = c_global_name
2335 AND legislation_code = 'NL'
2336 AND c_effective_date BETWEEN effective_start_date
2337 AND effective_end_date;
2338 ----
2339 CURSOR csr_get_cp_parameters(c_payroll_action_id NUMBER) IS
2340 SELECT get_parameters (c_payroll_action_id
2341 ,'Sequence_Number') seq_no
2342 ,start_date
2343 ,business_group_id
2344 FROM pay_payroll_actions
2345 WHERE payroll_action_id = c_payroll_action_id;
2346 ----
2347 CURSOR csr_get_no_pay_period(c_payroll_type VARCHAR2) IS
2348 SELECT number_per_fiscal_year
2349 FROM per_time_period_types
2350 WHERE period_type = DECODE(c_payroll_type,'MONTH','Calendar Month','WEEK','Week','LMONTH','Lunar Month');
2351 ----
2352 CURSOR csr_get_ytd_values(c_bg_id IN NUMBER
2353 ,c_date IN DATE
2354 ,c_payroll_type IN VARCHAR2
2355 ,c_tax_unit_id IN NUMBER) IS
2356 SELECT sum (CASE
2357 WHEN info.action_information2 = 'TotLnLbPh'
2358 THEN fnd_number.canonical_to_number (nvl (action_information6
2359 ,0)) END) taxableincome
2360 ,sum (CASE
2361 WHEN info.action_information2 = 'EhOvsFrfWrkkstrg'
2362 THEN fnd_number.canonical_to_number (nvl (action_information6
2363 ,0)) END) lcatax
2364 ,min (fnd_date.canonical_to_date (info.action_information3)) startdate
2365 ,max (fnd_date.canonical_to_date (info.action_information4)) enddate
2366 ,count (DISTINCT generator.request_id) wagereports
2367 FROM pay_action_information info
2368 ,pay_payroll_actions generator
2369 ,pay_payroll_actions datalock
2370 WHERE info.action_context_id = generator.payroll_action_id
2371 AND info.action_information2 IN ('TotLnLbPh','EhOvsFrfWrkkstrg')
2372 AND datalock.report_type = 'NL_WAGES_REP_LOCK'
2373 AND datalock.business_group_id = c_bg_id
2374 AND datalock.action_status = 'C'
2375 AND to_char (generator.effective_date
2376 ,'YYYY') = to_char (c_date
2377 ,'YYYY')
2378 AND generator.effective_date <= c_date
2379 AND get_parameters (generator.payroll_action_id
2380 ,'Legal_Employer') = c_tax_unit_id
2381 AND get_parameters (generator.payroll_action_id
2382 ,'Payroll_Type') = c_payroll_type
2383 AND get_parameters (datalock.payroll_action_id
2384 ,'REQUEST_ID') = generator.payroll_action_id;
2385 ----
2386
2387 r_get_org_lca_data csr_get_org_lca_data%ROWTYPE;
2388 r_get_ytd_values csr_get_ytd_values%ROWTYPE;
2389 l_lca_tax_rate NUMBER :=0;
2390 l_lca_threshold_rate NUMBER :=0;
2391 l_lca_tax NUMBER :=0;
2392 l_lca_threshold NUMBER :=0;
2393 l_lca_payments NUMBER :=0;
2394 l_lca_payments_ytd NUMBER :=0;
2395 l_lca_taxable NUMBER :=0;
2396 l_number_of_periods NUMBER :=0;
2397 l_seq_no NUMBER :=0;
2398 l_bg_id NUMBER :=0;
2399 l_taxable_income_ytd NUMBER :=0;
2400 l_lca_tax_paid_ytd NUMBER :=0;
2401 l_recalculation VARCHAR2(1) :='N';
2402 l_start_date DATE;
2403 l_balance_name pay_balance_types.balance_name%TYPE := 'LCA Payments';
2404 l_balance_dim_ptd pay_balance_dimensions.database_item_suffix%TYPE;
2405 l_balance_dim_ytd pay_balance_dimensions.database_item_suffix%TYPE;
2406 l_lca_payments_bal_id pay_defined_balances.defined_balance_id%TYPE;
2407 l_action_info_id pay_action_information.action_information_id%TYPE;
2408 l_ovn pay_action_information.object_version_number%type;
2409 BEGIN
2410 hr_utility.set_location('Entering get_lca_details',1);
2411 OPEN csr_get_org_lca_data(p_tax_unit_id, p_date);
2412 FETCH csr_get_org_lca_data INTO r_get_org_lca_data;
2413 IF csr_get_org_lca_data%NOTFOUND THEN
2414 CLOSE csr_get_org_lca_data;
2415 RETURN 0;
2416 END IF;
2417 CLOSE csr_get_org_lca_data;
2418
2419 OPEN csr_global_value('NL_LCA_THRESHOLD_RATE',p_date);
2420 FETCH csr_global_value INTO l_lca_threshold_rate;
2421 CLOSE csr_global_value;
2422
2423 OPEN csr_get_cp_parameters(p_actid);
2424 FETCH csr_get_cp_parameters INTO l_seq_no,l_start_date,l_bg_id;
2425 CLOSE csr_get_cp_parameters;
2426
2427 OPEN csr_global_value('NL_LCA_TAX_RATE',p_date);
2428 FETCH csr_global_value INTO l_lca_tax_rate;
2429 CLOSE csr_global_value;
2430
2431 IF p_payroll_type = 'MONTH' THEN
2432 l_balance_dim_ptd := '_TU_MONTH_PTD';
2433 l_balance_dim_ytd := '_TU_MONTH_YTD';
2434 ELSIF p_payroll_type = 'LMONTH' THEN
2435 l_balance_dim_ptd := '_TU_LMONTH_PTD';
2436 l_balance_dim_ytd := '_TU_LMONTH_YTD';
2437 ELSIF p_payroll_type = 'WEEK' THEN
2438 l_balance_dim_ptd := '_TU_WEEKLY_PTD';
2439 l_balance_dim_ytd := '_TU_WEEK_YTD'; --13974145
2440 END IF;
2441
2442 l_lca_payments_bal_id := get_defined_balance_id(l_balance_name,l_balance_dim_ptd);
2443 l_lca_payments := pay_balance_pkg.get_value
2444 (p_defined_balance_id => l_lca_payments_bal_id
2445 ,p_assignment_action_id => p_ass_action_id
2446 ,p_tax_unit_id => p_tax_unit_id
2447 ,p_jurisdiction_code => NULL
2448 ,p_source_id => NULL
2449 ,p_source_text => NULL
2450 ,p_tax_group => NULL
2451 ,p_date_earned => NULL
2452 ,p_get_rr_route => NULL
2453 ,p_get_rb_route => NULL
2454 ,p_source_text2 => NULL
2455 ,p_source_number => NULL
2456 ,p_time_def_id => NULL
2457 ,p_balance_date => p_date
2458 ,p_payroll_id => NULL);
2459
2460 --------------------------------------------------------------------------------
2461 IF r_get_org_lca_data.method=1 THEN
2462 hr_utility.set_location('Method 1 Normal calculation',100);
2463 l_lca_threshold := ROUND(GREATEST(p_taxable_income,0) * l_lca_threshold_rate/100);
2464 l_lca_taxable := ROUND(GREATEST(l_lca_payments - l_lca_threshold,0));
2465 l_lca_tax := ROUND(l_lca_taxable * l_lca_tax_rate/100);
2466
2467 --------------------------------------------------------------------------------
2468 ELSIF r_get_org_lca_data.method in (2,3) THEN
2469 /* Last period Recalculation */
2470 IF (p_payroll_type='WEEK' AND TRUNC(p_date+7,'YYYY')>TRUNC(p_date,'YYYY'))
2471 OR (p_payroll_type='LMONTH' AND TRUNC(p_date+27,'YYYY')>TRUNC(p_date,'YYYY'))
2472 OR (p_payroll_type='MONTH' AND TRUNC(p_date+31,'YYYY')>TRUNC(p_date,'YYYY')) THEN
2473 hr_utility.set_location('Recalculation',400);
2474 l_recalculation := 'Y';
2475 l_taxable_income_ytd := p_taxable_income;
2476 /* Fetch YTD Values from previous Locked Wage Report Archives*/
2477 OPEN csr_get_ytd_values(c_bg_id => l_bg_id
2478 ,c_date => p_date
2479 ,c_payroll_type => p_payroll_type
2480 ,c_tax_unit_id => p_tax_unit_id);
2481 FETCH csr_get_ytd_values INTO r_get_ytd_values;
2482 IF csr_get_ytd_values%FOUND THEN
2483 l_taxable_income_ytd := l_taxable_income_ytd+r_get_ytd_values.taxableincome;
2484 l_lca_tax_paid_ytd := r_get_ytd_values.lcatax;
2485 END IF;
2486 CLOSE csr_get_ytd_values;
2487
2488 /* Fetch LCA Payments YTD Value */
2489 l_lca_payments_bal_id := get_defined_balance_id(l_balance_name,l_balance_dim_ytd);
2490
2491 l_lca_payments_ytd := pay_balance_pkg.get_value
2492 (p_defined_balance_id => l_lca_payments_bal_id
2493 ,p_assignment_action_id => p_ass_action_id
2494 ,p_tax_unit_id => p_tax_unit_id
2495 ,p_jurisdiction_code => NULL
2496 ,p_source_id => NULL
2497 ,p_source_text => NULL
2498 ,p_tax_group => NULL
2499 ,p_date_earned => NULL
2500 ,p_get_rr_route => NULL
2501 ,p_get_rb_route => NULL
2502 ,p_source_text2 => NULL
2503 ,p_source_number => NULL
2504 ,p_time_def_id => NULL
2505 ,p_balance_date => p_date
2506 ,p_payroll_id => NULL);
2507 /* Recalculation Computation*/
2508 l_lca_threshold := ROUND(GREATEST(l_taxable_income_ytd,0) * l_lca_threshold_rate/100);
2509 l_lca_taxable := ROUND(GREATEST(l_lca_payments_ytd - l_lca_threshold,0));
2510 l_lca_tax := ROUND(l_lca_taxable * l_lca_tax_rate/100) - ROUND(l_lca_tax_paid_ytd);
2511
2512 --------------------------------------------------------------------------------
2513 ELSE
2514 /* Other Periods */
2515 IF r_get_org_lca_data.method =2 THEN
2516 /* Method 2*/
2517 hr_utility.set_location('Method 2 Normal calculation',200);
2518 OPEN csr_get_no_pay_period(p_payroll_type);
2519 FETCH csr_get_no_pay_period INTO l_number_of_periods;
2520 CLOSE csr_get_no_pay_period;
2521
2522 l_lca_threshold := ROUND((GREATEST(r_get_org_lca_data.amount,0) *
2523 l_lca_threshold_rate/100)/l_number_of_periods);
2524 l_lca_taxable := ROUND(GREATEST(l_lca_payments - l_lca_threshold,0));
2525 l_lca_tax := ROUND(l_lca_taxable * l_lca_tax_rate/100);
2526
2527 --------------------------------------------------------------------------------
2528 ELSIF r_get_org_lca_data.method =3 THEN
2529 /* Method 3*/
2530 /* Fetch LCA Payments YTD Value */
2531 hr_utility.set_location('Method 3 Normal calculation',300);
2532 l_lca_payments_bal_id := get_defined_balance_id(l_balance_name,l_balance_dim_ytd);
2533
2534 l_lca_payments_ytd := pay_balance_pkg.get_value
2535 (p_defined_balance_id => l_lca_payments_bal_id
2536 ,p_assignment_action_id => p_ass_action_id
2537 ,p_tax_unit_id => p_tax_unit_id
2538 ,p_jurisdiction_code => NULL
2539 ,p_source_id => NULL
2540 ,p_source_text => NULL
2541 ,p_tax_group => NULL
2542 ,p_date_earned => NULL
2543 ,p_get_rr_route => NULL
2544 ,p_get_rb_route => NULL
2545 ,p_source_text2 => NULL
2546 ,p_source_number => NULL
2547 ,p_time_def_id => NULL
2548 ,p_balance_date => p_date
2549 ,p_payroll_id => NULL);
2550
2551 l_lca_threshold := ROUND(GREATEST(r_get_org_lca_data.amount,0) * l_lca_threshold_rate/100);
2552 l_lca_taxable := ROUND(GREATEST(l_lca_payments_ytd - l_lca_threshold,0));
2553 l_lca_tax := ROUND(l_lca_taxable * l_lca_tax_rate/100);
2554
2555 /* Fetch YTD Values from previous Locked Wage Report Archives*/
2556 OPEN csr_get_ytd_values(c_bg_id => l_bg_id
2557 ,c_date => p_date
2558 ,c_payroll_type => p_payroll_type
2559 ,c_tax_unit_id => p_tax_unit_id);
2560 FETCH csr_get_ytd_values INTO r_get_ytd_values;
2561 IF csr_get_ytd_values%FOUND THEN
2562 l_lca_tax := ROUND(l_lca_tax - NVL(r_get_ytd_values.lcatax,0));
2563 END IF;
2564 CLOSE csr_get_ytd_values;
2565 --------------------------------------------------------------------------------
2566 END IF;
2567 END IF;
2568 END IF;
2569 hr_utility.set_location('Archiving LCA details',800);
2570 /* Archive the LCA variables for audit */
2571 pay_action_information_api.create_action_information
2572 (
2573 p_action_information_id => l_action_info_id
2574 , p_action_context_id => p_actid
2575 , p_action_context_type => 'PA'
2576 , p_object_version_number => l_ovn
2577 , p_assignment_id => NULL
2578 , p_effective_date => p_date --Effective or End Date
2579 , p_source_id => NULL
2580 , p_source_text => NULL
2581 , p_tax_unit_id => p_tax_unit_id
2582 , p_action_information_category => 'NL_LCA_TAX'
2583 , p_action_information1 => r_get_org_lca_data.method -- Method
2584 , p_action_information2 => p_payroll_type -- Payroll type
2585 , p_action_information3 => fnd_number.number_to_canonical(NVL(l_lca_tax,0)) --LCA Tax computed for this period
2586 , p_action_information4 => fnd_number.number_to_canonical(NVL(r_get_ytd_values.lcatax,0)) --LCA Tax computed till prev period
2587 , p_action_information5 => fnd_number.number_to_canonical(NVL(l_lca_payments,0)) --Period LCA Paid
2588 , p_action_information6 => fnd_number.number_to_canonical(NVL(l_lca_payments_ytd,0)) --LCA Paid YTD
2589 , p_action_information7 => fnd_number.number_to_canonical(NVL(l_lca_taxable,0)) --Taxable LCA
2590 , p_action_information8 => fnd_number.number_to_canonical(NVL(l_lca_threshold,0)) --LCA Tax free threshold
2591 , p_action_information9 => fnd_number.number_to_canonical(NVL(p_taxable_income,0)) --Period Taxable Income
2592 , p_action_information10 => fnd_number.number_to_canonical(NVL(r_get_ytd_values.taxableincome,0)) -- Taxable Income computed till prev period
2593 , p_action_information11 => fnd_date.date_to_canonical(r_get_ytd_values.startdate) --Previous Records Start Date
2594 , p_action_information12 => fnd_date.date_to_canonical(r_get_ytd_values.enddate) --Previous Records End Date
2595 , p_action_information13 => fnd_number.number_to_canonical(NVL(r_get_ytd_values.wagereports,0)) --Count of Prev. records
2596
2597 , p_action_information26 => fnd_number.number_to_canonical(NVL(l_lca_threshold_rate,1)) --Threshold Rate
2598 , p_action_information27 => fnd_number.number_to_canonical(NVL(l_lca_tax_rate,1)) --LCA Tax Rate
2599 , p_action_information28 => l_recalculation --Recalculation flag
2600 , p_action_information29 => fnd_number.number_to_canonical(NVL(l_seq_no,0)) --Sequence
2601 , p_action_information30 => fnd_date.date_to_canonical(l_start_date) --Start Date
2602 );
2603 hr_utility.set_location('Leaving get_lca_details',900);
2604 RETURN NVL(l_lca_tax,0);
2605 EXCEPTION
2606 WHEN OTHERS THEN
2607 hr_utility.set_location(sqlerrm(sqlcode),999);
2608 END get_lca_details;
2609
2610
2611 BEGIN
2612 --
2613 y:=1;
2614 p_emp_total := 0;
2615 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);
2616 --
2617 OPEN csr_get_no_pay_period(p_payroll_type);
2618 FETCH csr_get_no_pay_period INTO l_no_pay_period;
2619 CLOSE csr_get_no_pay_period;
2620 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~~~ l_no_pay_period '||l_no_pay_period||' ');
2621 --
2622
2623 --10100628
2624 l_prev_corr_yr := pay_nl_wage_report_pkg.get_parameters1(p_actid,'CORR_YR');
2625 IF l_prev_corr_yr <> '-9999' THEN
2626
2627 OPEN C_PREV_CORR_COLL_VAL(p_actid, p_balance_date);
2628 FETCH C_PREV_CORR_COLL_VAL INTO
2629 l_co_col_LnLbPh
2630 ,l_co_col_LnSV
2631 ,l_co_col_LnTabBB
2632 ,l_co_col_VakBsl
2633 ,l_co_col_OpgRchtVakBsl
2634 ,l_co_col_ExtrSal
2635 ,l_co_col_OpgRchtExtrSal
2636 ,l_co_col_LnInGld
2637 ,l_co_col_WrdLn
2638 ,l_co_col_LnOwrk
2639 ,l_co_col_IngLbPh
2640 ,l_co_col_PrWAOAof
2641 ,l_co_col_PrWAOAok
2642 ,l_co_col_PrAWF
2643 ,l_co_col_PrWgf
2644 ,l_co_col_PrUFO
2645 ,l_co_col_BijdrZvw
2646 ,l_co_col_VergZvw
2647 ,l_co_col_Reisk
2648 ,l_co_col_VerrArbKrt
2649 ,l_co_col_AantSV
2650 --,l_co_col_AantVerlU --10100628
2651 ,l_co_col_LvLpReg
2652 ,l_co_col_LvLpRegToeg
2653 --10100628
2654 ,l_co_col_PrLnWao
2655 ,l_co_col_PrLnWaoWga
2656 ,l_co_col_PrLnWwAwf
2657 ,l_co_col_PrLnUfo
2658 ,l_co_col_PrLnPrSectFnds;
2659 --10100628
2660 CLOSE C_PREV_CORR_COLL_VAL;
2661
2662 END IF;
2663 --10100628
2664
2665
2666 l_flat_rate_taxation := 0;
2667 -- Bug# 5754707, For Loop modified for all types of Look-up codes.
2668 FOR csr_rec in csr_get_org_tax_data(p_tax_unit_id,p_payroll_type) LOOP
2669
2670 --10100628 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
2671 --10100628
2672 IF csr_rec.org_information3 = '1' AND p_balance_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
2673 IF csr_rec.frequency = 'P' THEN
2674 l_flat_rate_taxation := csr_rec.amount;
2675 ELSIF csr_rec.frequency = 'A' THEN
2676 l_flat_rate_taxation := csr_rec.amount/l_no_pay_period;
2677 END IF;
2678 END IF;
2679
2680 --10100628 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
2681 --10100628
2682 IF csr_rec.org_information3 = '2' AND p_balance_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
2683 IF csr_rec.frequency = 'P' THEN
2684 l_major_issue_flat_rate := csr_rec.amount;
2685 ELSIF csr_rec.frequency = 'A' THEN
2686 l_major_issue_flat_rate := csr_rec.amount/l_no_pay_period;
2687 END IF;
2688 END IF;
2689
2690 --10100628 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
2691 --10100628
2692 IF csr_rec.org_information3 = '3' AND p_balance_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
2693 IF csr_rec.frequency = 'P' THEN
2694 l_single_rate_exp_pay := csr_rec.amount;
2695 ELSIF csr_rec.frequency = 'A' THEN
2696 l_single_rate_exp_pay := csr_rec.amount/l_no_pay_period;
2697 END IF;
2698 END IF;
2699
2700 --10100628 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
2701 --10100628
2702 IF csr_rec.org_information3 = '4' AND p_balance_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
2703 IF csr_rec.frequency = 'P' THEN
2704 l_wage_tax_subsidy := csr_rec.amount;
2705 ELSIF csr_rec.frequency = 'A' THEN
2706 l_wage_tax_subsidy := csr_rec.amount/l_no_pay_period;
2707 END IF;
2708 END IF;
2709
2710 /**** Bug 6610259 ****/
2711 --10100628 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
2712 --10100628
2713 IF csr_rec.org_information3 = '5' AND p_balance_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
2714 IF csr_rec.frequency = 'P' THEN
2715 l_flat_tax_holidays := csr_rec.amount;
2716 ELSIF csr_rec.frequency = 'A' THEN
2717 l_flat_tax_holidays := csr_rec.amount/l_no_pay_period;
2718 END IF;
2719 END IF;
2720
2721 /* 7533686 */
2722 --10100628 IF csr_rec.org_information3 = '6' AND p_effective_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
2723 --10100628
2724 IF csr_rec.org_information3 = '6' AND p_balance_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
2725 IF csr_rec.frequency = 'P' THEN
2726 l_flat_tax_pre_pension := csr_rec.amount;
2727 ELSIF csr_rec.frequency = 'A' THEN
2728 l_flat_tax_pre_pension := csr_rec.amount/l_no_pay_period;
2729 END IF;
2730 END IF;
2731
2732 --10370520
2733 IF csr_rec.org_information3 = '7' AND p_balance_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,fnd_date.canonical_to_date('4712/12/31')) THEN
2734 IF csr_rec.frequency = 'P' THEN
2735 l_flat_tax_lca := csr_rec.amount;
2736 ELSIF csr_rec.frequency = 'A' THEN
2737 l_flat_tax_lca := csr_rec.amount/l_no_pay_period;
2738 END IF;
2739 END IF;
2740 --10370520
2741
2742 --Changes for Employer Tax High Wages 16514249
2743 IF csr_rec.org_information3 = '8' AND p_balance_date BETWEEN csr_rec.start_date AND NVL(csr_rec.end_date,hr_general.end_of_time) THEN
2744 l_employer_tax_high_wages := csr_rec.amount;
2745 END IF;
2746 --16514249
2747
2748 END LOOP;
2749 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~~~ l_flat_rate_taxation '||l_flat_rate_taxation||' ');
2750 --bug 14125837 begin
2751 IF l_prev_corr_yr <> '-9999' AND to_char(p_balance_date,'RRRR') <> to_char(sysdate,'RRRR') THEN
2752
2753 FOR csr_rec2 in csr_get_org_corr_data(p_tax_unit_id,p_payroll_type,p_balance_date) LOOP
2754
2755 IF csr_rec2.frequency = 'P' THEN
2756 l_amount := csr_rec2.amount;
2757 ELSIF csr_rec2.frequency = 'A' THEN
2758 l_amount := csr_rec2.amount/l_no_pay_period;
2759 END IF;
2760
2761 CASE csr_rec2.tag_name
2762 WHEN 'EHLNBESTKAR' THEN l_corr_ehlnbestkar := l_amount;
2763 WHEN 'EHBMVERG' THEN l_corr_ehbmverg := l_amount;
2764 WHEN 'AVOND' THEN l_corr_avond := l_amount;
2765 WHEN 'PKAGH' THEN l_corr_pkagh := l_amount;
2766 WHEN 'PKNWARBVOUDWN' THEN l_corr_pknwarbvoudwn := l_amount;
2767 WHEN 'PKINDNSTOUDWN' THEN l_corr_pkindnstoudwn := l_amount;
2768 END CASE;
2769
2770 END LOOP;
2771 END IF;
2772 --bug 14125837 end
2773 --
2774 p_collXMLTable(y).TagName := 'TotLnLbPh'; -- 1..5
2775 p_collXMLTable(y).Mandatory:= 'Y';
2776 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotLnLbPh'));
2777 p_collXMLTable(y).Tagvalue := 0;
2778 FOR i in 1..5 LOOP
2779 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2780 + g_col_bal_def_table(i).balance_value2;
2781 END LOOP;
2782
2783 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_LnLbPh,0); --10100628
2784 l_taxable_income := ROUND(NVL(p_collXMLTable(y).Tagvalue,0)); --LCA
2785 --
2786 y:= y+1;
2787 p_collXMLTable(y).TagName := 'TotLnSV'; -- 6..11
2788 p_collXMLTable(y).Mandatory:= 'Y';
2789 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotLnSV'));
2790 p_collXMLTable(y).Tagvalue := 0;
2791 FOR i in 6..11 LOOP
2792 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2793 + g_col_bal_def_table(i).balance_value2;
2794 END LOOP;
2795
2796 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_LnSV,0); --10100628
2797
2798 --
2799 -- LC 2013 -- BEGIN
2800 IF p_effective_date < to_date('01012013','DDMMYYYY') THEN
2801 y:= y+1;
2802 p_collXMLTable(y).TagName := 'PrLnWAOAof'; --12..13
2803 p_collXMLTable(y).Mandatory:= 'Y';
2804 IF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
2805 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAof'));
2806 ELSE
2807 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAof_2006'));
2808 END IF;
2809 p_collXMLTable(y).Tagvalue := 0;
2810 FOR i in 12..13 LOOP
2811 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2812 + g_col_bal_def_table(i).balance_value2;
2813 END LOOP;
2814 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_PrLnWao,0); --10100628
2815
2816 --
2817 -- LC 2010 -- begin
2818 IF p_effective_date >= to_date('01012010','DDMMYYYY') THEN
2819 y:= y+1;
2820 p_collXMLTable(y).TagName := 'PrLnWaoPma'; -- 88..89
2821 p_collXMLTable(y).Mandatory:= 'Y';
2822 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWaoPma'));
2823 p_collXMLTable(y).Tagvalue:=0;
2824 FOR i in 88..89 LOOP
2825 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2826 + g_col_bal_def_table(i).balance_value2;
2827 END LOOP;
2828 END IF;
2829 -- LC 2010 -- end
2830 --
2831 --LC 2012 changes begin. <PrLnWAOAok> Tag is obsolete and replaced with <TotPrLnWgaWhk>
2832 IF g_public_org_flag = 'N' AND g_risk_cover_flag = 'Y' THEN
2833 y:= y+1;
2834 IF p_effective_date < to_date('01012012','DDMMYYYY') THEN
2835 p_collXMLTable(y).TagName := 'PrLnWAOAok'; -- 14..15
2836 ELSE
2837 p_collXMLTable(y).TagName := 'TotPrLnWgaWhk'; -- 14..15
2838 END IF;
2839 p_collXMLTable(y).Mandatory:= 'Y';
2840 IF p_effective_date >= to_date('01012012','DDMMYYYY') THEN
2841 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotPrLnWgaWhk'));
2842 ELSIF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
2843 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok'));
2844 ELSE
2845 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok_2006'));
2846 END IF;
2847 p_collXMLTable(y).Tagvalue:=0;
2848 --IF g_public_org_flag <> 'N' OR g_risk_cover_flag <> 'Y' THEN
2849 ELSE
2850 y:= y+1;
2851 IF p_effective_date < to_date('01012012','DDMMYYYY') THEN
2852 p_collXMLTable(y).TagName := 'PrLnWAOAok'; -- 14..15
2853 ELSE
2854 p_collXMLTable(y).TagName := 'TotPrLnWgaWhk'; -- 14..15
2855 END IF;
2856 p_collXMLTable(y).Mandatory:= 'Y';
2857 IF p_effective_date >= to_date('01012012','DDMMYYYY') THEN
2858 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotPrLnWgaWhk'));
2859 ELSIF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
2860 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok'));
2861 ELSE
2862 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok_2006'));
2863 END IF;
2864 p_collXMLTable(y).Tagvalue:=0;
2865 FOR i in 14..15 LOOP
2866 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2867 + g_col_bal_def_table(i).balance_value2;
2868 END LOOP;
2869 END IF;
2870 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_PrLnWaoWga,0); --10100628
2871 --LC 2012 changes end
2872 --
2873 IF g_public_org_flag = 'N' THEN
2874 y:= y+1;
2875 p_collXMLTable(y).TagName := 'PrLnAWF'; -- 16..17
2876 p_collXMLTable(y).Mandatory:= 'Y';
2877 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnAWF'));
2878 p_collXMLTable(y).Tagvalue:=0;
2879 FOR i in 16..17 LOOP
2880 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2881 + g_col_bal_def_table(i).balance_value2;
2882 END LOOP;
2883 ELSE
2884 y:= y+1;
2885 p_collXMLTable(y).TagName := 'PrLnAWF'; -- 16..17
2886 p_collXMLTable(y).Mandatory:= 'Y';
2887 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnAWF'));
2888 p_collXMLTable(y).Tagvalue:=0;
2889 END IF;
2890 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_PrLnWwAwf,0); --10100628
2891
2892 --
2893 y:= y+1;
2894 p_collXMLTable(y).TagName := 'TotVergZvw'; --20..27
2895 p_collXMLTable(y).Mandatory:= 'Y';
2896 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotVergZvw'));
2897 p_collXMLTable(y).Tagvalue:=0;
2898 FOR i in 20..27 LOOP
2899 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2900 + g_col_bal_def_table(i).balance_value2;
2901 END LOOP;
2902 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_VergZvw,0); --10100628
2903
2904 END IF;
2905 -- LC 2013 -- END
2906 --
2907 --IF g_public_org_flag = 'Y' THEN
2908 y:= y+1;
2909 p_collXMLTable(y).TagName := 'PrLnUFO'; --18..19
2910 p_collXMLTable(y).Mandatory:= 'Y';
2911 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnUFO'));
2912 p_collXMLTable(y).Tagvalue:=0;
2913 FOR i in 18..19 LOOP
2914 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2915 + g_col_bal_def_table(i).balance_value2;
2916 END LOOP;
2917
2918 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_PrLnUfo,0); --10100628
2919
2920 --END IF;
2921
2922 --p_emp_total := p_emp_total ;
2923 --
2924 y:= y+1;
2925 p_collXMLTable(y).TagName := 'IngLbPh'; --28..32
2926 p_collXMLTable(y).Mandatory:= 'Y';
2927 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('IngLbPh'));
2928 p_collXMLTable(y).Tagvalue:=0;
2929 FOR i in 28..32 LOOP
2930 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2931 + g_col_bal_def_table(i).balance_value2;
2932 END LOOP;
2933 FOR i in 78..79 LOOP
2934 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2935 + g_col_bal_def_table(i).balance_value2;
2936 END LOOP;
2937 FOR i in 80..81 LOOP -- Subtracting LCLD
2938 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue - (g_col_bal_def_table(i).balance_value
2939 + g_col_bal_def_table(i).balance_value2);
2940 END LOOP;
2941 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_IngLbPh,0); --10100628
2942
2943 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2944 --
2945 y:= y+1;
2946 p_collXMLTable(y).TagName := 'EHPubUitk'; -- 33..34
2947 p_collXMLTable(y).Mandatory:= 'N';
2948 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHPubUitk'));
2949 p_collXMLTable(y).Tagvalue:= l_major_issue_flat_rate; -- Bug# 5754707
2950 /* FOR i in 33..34 LOOP
2951 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2952 + g_col_bal_def_table(i).balance_value2;
2953 END LOOP; */ -- Commented the FOR loop as part of fix to Bug# 5754707
2954 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2955 --
2956 y:= y+1;
2957 p_collXMLTable(y).TagName := 'EHLnBestKar'; --35..36
2958 p_collXMLTable(y).Mandatory:= 'N';
2959 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHLnBestKar'));
2960 p_collXMLTable(y).Tagvalue:=0;
2961 --bug 14125837 begin
2962 IF l_corr_ehlnbestkar IS NOT NULL THEN
2963 p_collXMLTable(y).Tagvalue:=l_corr_ehlnbestkar;
2964 ELSE
2965 FOR i in 35..36 LOOP
2966 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2967 + g_col_bal_def_table(i).balance_value2;
2968 END LOOP;
2969 END IF;
2970 --bug 14125837 end
2971 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2972 --
2973 --LC 2012 changes begin. <EHSpLn> Tag is obsolete
2974 y:= y+1;
2975 p_collXMLTable(y).TagName := 'EHSpLn'; -- 37..38
2976 p_collXMLTable(y).Mandatory:= 'N';
2977 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHSpLn'));
2978 p_collXMLTable(y).Tagvalue:=0;
2979 IF p_effective_date < to_date('01012012','DDMMYYYY') THEN
2980 FOR i in 37..38 LOOP
2981 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2982 + g_col_bal_def_table(i).balance_value2;
2983 END LOOP;
2984 END IF;
2985 --LC 2012 changes end
2986 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
2987 --
2988 y:= y+1;
2989 p_collXMLTable(y).TagName := 'EHSpPr'; --39..40
2990 p_collXMLTable(y).Mandatory:= 'N';
2991 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHSpPr'));
2992 p_collXMLTable(y).Tagvalue:=0;
2993
2994 IF p_effective_date < to_date('01012008','DDMMYYYY') THEN
2995 FOR i in 39..40 LOOP --Dutch Year End Changes 08 This Tag is obsolete as of 08 Wage Report
2996 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
2997 + g_col_bal_def_table(i).balance_value2;
2998 END LOOP;
2999 END IF;
3000 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3001 --
3002 y:= y+1;
3003 p_collXMLTable(y).TagName := 'EHLnNat'; --41-44
3004 p_collXMLTable(y).Mandatory:= 'N';
3005 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHLnNat'));
3006 p_collXMLTable(y).Tagvalue:= l_single_rate_exp_pay; -- Bug# 5754707
3007 /*FOR i in 41..44 LOOP
3008 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3009 + g_col_bal_def_table(i).balance_value2;
3010 END LOOP; */ -- Commented the code as per Bug# 5754707
3011 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3012 --
3013 y:= y+1;
3014 p_collXMLTable(y).TagName := 'EHFeest'; -- 45..46
3015 p_collXMLTable(y).Mandatory:= 'N';
3016 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHFeest'));
3017 p_collXMLTable(y).Tagvalue:=0;
3018 p_collXMLTable(y).Tagvalue := l_flat_tax_holidays; /*** Bug 6610259 ***/
3019 /*FOR i in 45..46 LOOP
3020 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3021 + g_col_bal_def_table(i).balance_value2;
3022 END LOOP;*/
3023 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3024 --
3025 y:= y+1;
3026 p_collXMLTable(y).TagName := 'EHBmVerg'; --47..48
3027 p_collXMLTable(y).Mandatory:= 'N';
3028 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHBmVerg'));
3029 p_collXMLTable(y).Tagvalue:=0;
3030 --bug 14125837 begin
3031 IF l_corr_ehbmverg IS NOT NULL THEN
3032 p_collXMLTable(y).Tagvalue:=l_corr_ehbmverg;
3033 ELSE
3034 FOR i in 47..48 LOOP
3035 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3036 + g_col_bal_def_table(i).balance_value2;
3037 END LOOP;
3038 END IF;
3039 --bug 14125837 end
3040 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3041 --
3042 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
3043 y:= y+1;
3044 p_collXMLTable(y).TagName := 'EHGebrAuto';
3045 p_collXMLTable(y).Mandatory:= 'N';
3046 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHGebrAuto'));
3047 p_collXMLTable(y).Tagvalue:= l_flat_rate_taxation;
3048 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue); --13722974
3049 END IF;
3050 --
3051 y:= y+1;
3052 p_collXMLTable(y).TagName := 'EHVUT'; -- 49..50
3053 p_collXMLTable(y).Mandatory:= 'N';
3054 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHVUT'));
3055 p_collXMLTable(y).Tagvalue:=0;
3056 p_collXMLTable(y).Tagvalue := l_flat_tax_pre_pension; /* 7533686 */
3057 /*
3058 FOR i in 49..50 LOOP
3059 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3060 + g_col_bal_def_table(i).balance_value2;
3061 END LOOP; */
3062
3063 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3064 --
3065 --10370520
3066 --
3067 IF l_flat_tax_lca=0 THEN
3068 l_flat_tax_lca := get_lca_details(
3069 p_taxable_income => l_taxable_income
3070 ,p_date => p_balance_date
3071 ,p_payroll_type => p_payroll_type
3072 ,p_tax_unit_id => p_tax_unit_id
3073 ,p_actid => p_actid
3074 ,p_ass_action_id => p_ass_action_id);
3075 END IF;
3076
3077 y:= y+1;
3078 p_collXMLTable(y).TagName := 'EhOvsFrfWrkkstrg';
3079 p_collXMLTable(y).Mandatory:= 'N';
3080 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EhOvsFrfWrkkstrg'));
3081 p_collXMLTable(y).Tagvalue:=0;
3082 p_collXMLTable(y).Tagvalue := l_flat_tax_lca;
3083 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3084 --
3085 --10370520
3086
3087 --Employer High Wage Tax Changes 16514249
3088 IF p_effective_date >= TO_DATE('01012013','DDMMYYYY') AND NVL(l_employer_tax_high_wages,0) <> 0 THEN
3089 y:= y+1;
3090 p_collXMLTable(y).TagName := 'PsehHgLn';
3091 p_collXMLTable(y).Mandatory:= 'N';
3092 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PsehHgLn'));
3093 p_collXMLTable(y).Tagvalue := NVL(l_employer_tax_high_wages,0);
3094 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3095 END IF;
3096 --End of Employer High Wage Tax Changes 16514249
3097
3098 IF p_effective_date < TO_DATE('01012007','DDMMYYYY') THEN
3099 y:= y+1;
3100 p_collXMLTable(y).TagName := 'AVBetOV'; -- 51..52
3101 p_collXMLTable(y).Mandatory:= 'N';
3102 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVBetOV'));
3103 p_collXMLTable(y).Tagvalue:=0;
3104 FOR i in 51..52 LOOP
3105 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3106 + g_col_bal_def_table(i).balance_value2;
3107 END LOOP;
3108 p_collXMLTable(y).Tagvalue:=p_collXMLTable(y).Tagvalue * -1;
3109 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
3110 --
3111 y:= y+1;
3112 p_collXMLTable(y).TagName := 'AVLgdWerkl'; -- 53..54
3113 p_collXMLTable(y).Mandatory:= 'N';
3114 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVLgdWerkl'));
3115 p_collXMLTable(y).Tagvalue:=0;
3116 FOR i in 53..54 LOOP
3117 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3118 + g_col_bal_def_table(i).balance_value2;
3119 END LOOP;
3120 p_collXMLTable(y).Tagvalue:=p_collXMLTable(y).Tagvalue * -1;
3121 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
3122 END IF;
3123 --
3124 y:= y+1;
3125 p_collXMLTable(y).TagName := 'AVArboNP'; -- 55
3126 p_collXMLTable(y).Mandatory:= 'N';
3127 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVArboNP'));
3128 p_collXMLTable(y).Tagvalue:=0;
3129 IF p_effective_date < to_date('01012008','DDMMYYYY') THEN
3130 p_collXMLTable(y).Tagvalue:= g_col_bal_def_table(55).balance_value ;
3131 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
3132 END IF;
3133 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
3134 --
3135 y:= y+1;
3136 p_collXMLTable(y).TagName := 'AVZeev'; -- 56
3137 p_collXMLTable(y).Mandatory:= 'N';
3138 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVZeev'));
3139 p_collXMLTable(y).Tagvalue:=0;
3140 p_collXMLTable(y).Tagvalue:= g_col_bal_def_table(56).balance_value ;
3141 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
3142 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
3143 y:= y+1;
3144 p_collXMLTable(y).TagName := 'AVOnd'; -- 57..58
3145 p_collXMLTable(y).Mandatory:= 'N';
3146 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVOnd'));
3147 p_collXMLTable(y).Tagvalue:=0;
3148 --bug 14125837 begin
3149 IF l_corr_avond IS NOT NULL THEN
3150 p_collXMLTable(y).Tagvalue:=l_corr_avond;
3151 ELSE
3152 FOR i in 57..58 LOOP
3153 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3154 + g_col_bal_def_table(i).balance_value2;
3155 END LOOP;
3156 FOR i in 76..77 LOOP
3157 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3158 + g_col_bal_def_table(i).balance_value2;
3159 END LOOP;
3160
3161 --10188214
3162 IF to_char(p_effective_date,'RRRR') = '2010' THEN
3163 FOR i in 94..95 LOOP
3164 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3165 + g_col_bal_def_table(i).balance_value2;
3166 END LOOP;
3167 END IF;
3168 --10188214
3169 END IF;
3170 --bug 14125837 end
3171
3172 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
3173 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
3174 --
3175 y:= y+1;
3176 p_collXMLTable(y).TagName := 'VrlAVSO'; --59
3177 p_collXMLTable(y).Mandatory:= 'N';
3178 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('VrlAVSO'));
3179 p_collXMLTable(y).Tagvalue:=l_wage_tax_subsidy; -- Bug# 5754707
3180 --p_collXMLTable(y).Tagvalue:= g_col_bal_def_table(59).balance_value ; -- Bug# 5754707
3181 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
3182 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
3183 --
3184 y:= y+1;
3185 p_collXMLTable(y).TagName := 'PrWAOAof'; -- 60..65 WAOB WGA IVA
3186 p_collXMLTable(y).Mandatory:= 'N';
3187 IF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
3188 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAof'));
3189 ELSE
3190 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAof_2006'));
3191 END IF;
3192 p_collXMLTable(y).Tagvalue:=0;
3193 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_PrWAOAof,0); --10100628
3194
3195 FOR i in 60..65 LOOP
3196 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3197 + g_col_bal_def_table(i).balance_value2;
3198 END LOOP;
3199 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3200 --
3201 --LC 2012 changes begin. <PrWAOAok> Tag is obsolete and replaced with <TotPrWgaWhk>
3202 IF g_public_org_flag = 'Y' AND g_risk_cover_flag = 'Y' THEN
3203 y:= y+1;
3204 IF p_effective_date < to_date('01012012','DDMMYYYY') THEN
3205 p_collXMLTable(y).TagName := 'PrWAOAok'; -- 66..67 WAOD
3206 ELSE
3207 p_collXMLTable(y).TagName := 'TotPrWgaWhk';
3208 END IF;
3209 p_collXMLTable(y).Mandatory:= 'Y';
3210 IF p_effective_date >= to_date('01012012','DDMMYYYY') THEN
3211 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotPrWgaWhk'));
3212 ELSIF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
3213 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok'));
3214 ELSE
3215 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok_2006'));
3216 END IF;
3217 p_collXMLTable(y).Tagvalue:=0;
3218 ELSIF g_public_org_flag = 'N' AND g_risk_cover_flag = 'Y' THEN
3219 y:= y+1;
3220 IF p_effective_date < to_date('01012012','DDMMYYYY') THEN
3221 p_collXMLTable(y).TagName := 'PrWAOAok'; -- 66..67 WAOD
3222 ELSE
3223 p_collXMLTable(y).TagName := 'TotPrWgaWhk';
3224 END IF;
3225 p_collXMLTable(y).Mandatory:= 'Y';
3226 IF p_effective_date >= to_date('01012012','DDMMYYYY') THEN
3227 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotPrWgaWhk'));
3228 ELSIF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
3229 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok'));
3230 ELSE
3231 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok_2006'));
3232 END IF;
3233 p_collXMLTable(y).Tagvalue:=0;
3234 ELSE
3235 y:= y+1;
3236 IF p_effective_date < to_date('01012012','DDMMYYYY') THEN
3237 p_collXMLTable(y).TagName := 'PrWAOAok'; -- 66..67 WAOD
3238 ELSE
3239 p_collXMLTable(y).TagName := 'TotPrWgaWhk';
3240 END IF;
3241 p_collXMLTable(y).Mandatory:= 'N';
3242 IF p_effective_date >= to_date('01012012','DDMMYYYY') THEN
3243 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotPrWgaWhk'));
3244 ELSIF p_effective_date >= to_date('01012007','DDMMYYYY') THEN
3245 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok'));
3246 ELSE
3247 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok_2006'));
3248 END IF;
3249 p_collXMLTable(y).Tagvalue:=0;
3250 FOR i in 66..67 LOOP
3251 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3252 + g_col_bal_def_table(i).balance_value2;
3253 END LOOP;
3254 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_PrWAOAok,0); --10100628
3255
3256 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3257 END IF;
3258 --
3259 IF g_public_org_flag = 'N' THEN
3260 y:= y+1;
3261 p_collXMLTable(y).TagName := 'PrAWF'; -- 68..69 WEWE
3262 p_collXMLTable(y).Mandatory:= 'N';
3263 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrAWF'));
3264 p_collXMLTable(y).Tagvalue:=0;
3265 FOR i in 68..69 LOOP
3266 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3267 + g_col_bal_def_table(i).balance_value2;
3268 END LOOP;
3269 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_PrAWF,0); --13096099
3270 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3271 END IF;
3272 --p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_PrAWF,0); --10100628 --13096099
3273
3274 --
3275 IF g_public_org_flag = 'Y' THEN
3276 y:= y+1;
3277 p_collXMLTable(y).TagName := 'PrUFO'; -- 70..71 UFO
3278 p_collXMLTable(y).Mandatory:= 'N';
3279 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrUFO'));
3280 p_collXMLTable(y).Tagvalue:=0;
3281 FOR i in 70..71 LOOP
3282 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3283 + g_col_bal_def_table(i).balance_value2;
3284 END LOOP;
3285 --p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue); Bug No - 5226068
3286 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_PrUFO,0); --13096099
3287 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3288 END IF;
3289 --p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_PrUFO,0); --10100628 --13096099
3290
3291 -- LC 2013 -- BEGIN
3292 IF p_effective_date < to_date('01012013','DDMMYYYY') THEN
3293 --
3294 y:= y+1;
3295 p_collXMLTable(y).TagName := 'IngBijdrZvw'; -- 72..73 ZVW
3296 p_collXMLTable(y).Mandatory:= 'N';
3297 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('IngBijdrZvw'));
3298 p_collXMLTable(y).Tagvalue:=0;
3299 FOR i in 72..73 LOOP
3300 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3301 + g_col_bal_def_table(i).balance_value2;
3302 END LOOP;
3303 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_BijdrZvw,0); --10100628
3304
3305 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3306 --
3307 ELSE
3308 --
3309 y:= y+1;
3310 p_collXMLTable(y).TagName := 'IngBijdrZvw'; -- 90..91 ZVWL
3311 p_collXMLTable(y).Mandatory:= 'Y';
3312 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('IngBijdrZvw'));
3313 p_collXMLTable(y).Tagvalue:=0;
3314 FOR i in 90..91 LOOP
3315 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3316 + g_col_bal_def_table(i).balance_value2;
3317 END LOOP;
3318 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_BijdrZvw,0);
3319 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3320 --
3321 y:= y+1;
3322 hr_utility.set_location(y,2);
3323 p_collXMLTable(y).TagName := 'TotWghZvw'; -- 92..93 ZVWS
3324 p_collXMLTable(y).Mandatory:= 'Y';
3325 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotWghZvw'));
3326 p_collXMLTable(y).Tagvalue:=0;
3327 FOR i in 92..93 LOOP
3328 hr_utility.set_location(g_col_bal_def_table(i).balance_value || ' '||+ g_col_bal_def_table(i).balance_value2,100.01);
3329 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3330 + g_col_bal_def_table(i).balance_value2;
3331 END LOOP;
3332 p_collXMLTable(y).Tagvalue := p_collXMLTable(y).Tagvalue + NVL(l_co_col_VergZvw,0);
3333 p_emp_total := p_emp_total + ROUND(p_collXMLTable(y).Tagvalue);
3334 --
3335 END IF;
3336 -- LC 2013 -- END
3337
3338
3339 -- LC 2010 -- begin
3340 IF p_effective_date >= to_date('01012010','DDMMYYYY') THEN
3341
3342 y:= y+1;
3343 p_collXMLTable(y).TagName := 'PkAgh'; -- 82..83
3344 p_collXMLTable(y).Mandatory:= 'N';
3345 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PkAgh'));
3346 p_collXMLTable(y).Tagvalue:=0;
3347 --bug 14125837 begin
3348 IF l_corr_pkagh IS NOT NULL THEN
3349 p_collXMLTable(y).Tagvalue:=l_corr_pkagh;
3350 ELSE
3351 FOR i in 82..83 LOOP
3352 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3353 + g_col_bal_def_table(i).balance_value2;
3354 END LOOP;
3355 END IF;
3356 --bug 14125837 end
3357
3358 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
3359 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
3360
3361 y:= y+1;
3362 p_collXMLTable(y).TagName := 'PkNwArbvOudWn'; -- 84..85
3363 p_collXMLTable(y).Mandatory:= 'N';
3364 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PkNwArbvOudWn'));
3365 p_collXMLTable(y).Tagvalue:=0;
3366 --bug 14125837 begin
3367 IF l_corr_pknwarbvoudwn IS NOT NULL THEN
3368 p_collXMLTable(y).Tagvalue:=l_corr_pknwarbvoudwn;
3369 ELSE
3370 FOR i in 84..85 LOOP
3371 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3372 + g_col_bal_def_table(i).balance_value2;
3373 END LOOP;
3374 END IF;
3375 --bug 14125837 end
3376
3377 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
3378 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
3379
3380 --LC 2013 --BEGIN
3381 IF p_effective_date < to_date('01012013','DDMMYYYY') then
3382 y:= y+1;
3383 p_collXMLTable(y).TagName := 'PkInDnstOudWn'; -- 86..87
3384 p_collXMLTable(y).Mandatory:= 'N';
3385 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PkInDnstOudWn'));
3386 p_collXMLTable(y).Tagvalue:=0;
3387 --bug 14125837 begin
3388 IF l_corr_pkindnstoudwn IS NOT NULL THEN
3389 p_collXMLTable(y).Tagvalue:=l_corr_pkindnstoudwn;
3390 ELSE
3391 FOR i in 86..87 LOOP
3392 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3393 + g_col_bal_def_table(i).balance_value2;
3394 END LOOP;
3395 END IF;
3396 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
3397 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
3398 --bug 14125837 end
3399 END IF;
3400 --LC 2013 --END
3401 ELSE
3402 y:= y+1;
3403 p_collXMLTable(y).TagName := 'AGHKort'; -- 74..75
3404 p_collXMLTable(y).Mandatory:= 'N';
3405 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AGHKort'));
3406 p_collXMLTable(y).Tagvalue:=0;
3407 FOR i in 74..75 LOOP
3408 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue + g_col_bal_def_table(i).balance_value
3409 + g_col_bal_def_table(i).balance_value2;
3410 END LOOP;
3411 p_collXMLTable(y).Tagvalue:= p_collXMLTable(y).Tagvalue * -1;
3412 p_emp_total := p_emp_total - ROUND(p_collXMLTable(y).Tagvalue);
3413 END IF;
3414 -- LC 2010 -- end
3415 --
3416 y:= y+1;
3417 p_collXMLTable(y).TagName := 'TotTeBet';
3418 p_collXMLTable(y).Mandatory:= 'Y';
3419 p_collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotTeBet'));
3420 p_collXMLTable(y).Tagvalue:= p_emp_total;
3421 --
3422 --
3423 --FOR i in p_collXMLTable.first..p_collXMLTable.last LOOP
3424 --Fnd_file.put_line(FND_FILE.LOG,'#######~~~~'||p_collXMLTable(i).TagName||' '||p_collXMLTable(i).Tagvalue||' ');
3425 --END LOOP;
3426 END populate_coll_bal_table;
3427 --
3428 --------------------------------------------------------------------------------
3429 -- populate_nom_balance_values pay_nl_wage_report_pkg.populate_nom_balance_values
3430 --------------------------------------------------------------------------------
3431 PROCEDURE populate_nom_balance_values(p_master_assignment_action_id NUMBER
3432 ,p_assignment_action_id NUMBER
3433 ,p_effective_date DATE
3434 ,p_tax_unit_id NUMBER
3435 ,p_type VARCHAR2
3436 ,p_record_type VARCHAR2
3437 ,p_corr_used IN OUT NOCOPY VARCHAR2
3438 ,p_balance_values IN OUT NOCOPY Bal_Value) IS
3439 --
3440 l_balance_date DATE;
3441 l_context_id NUMBER;
3442 l_source_text VARCHAR2(50);
3443 l_source_text2 VARCHAR2(50);
3444 l_assignment_action_id NUMBER;
3445 l_context VARCHAR2(1);
3446 l_tax_unit_id NUMBER;
3447 --
3448 CURSOR cur_act_contexts(p_context_name VARCHAR2 )IS
3449 SELECT ffc.context_id
3450 FROM ff_contexts ffc
3451 WHERE ffc.context_name = p_context_name;
3452 --
3453 CURSOR csr_chk_corr_ele_exists(c_ass_act_id NUMBER) IS
3454 SELECT 'Y'
3455 FROM DUAL
3456 WHERE EXISTS (SELECT /*+ ORDERED */ 1
3457 FROM pay_assignment_actions bal_assact
3458 -- ,pay_payroll_actions bact
3459 ,pay_assignment_actions assact
3460 -- ,pay_payroll_actions pact
3461 ,pay_element_types_f adj_petf
3462 ,pay_run_results adj_prr
3463 WHERE bal_assact.assignment_action_id = c_ass_act_id -- assignment_action_id
3464 --and bal_assact.payroll_action_id = bact.payroll_action_id
3465 --and assact.payroll_action_id = pact.payroll_action_id
3466 --and pact.time_period_id = bact.time_period_id
3467 --and assact.action_sequence <= bal_assact.action_sequence
3468 and assact.assignment_id = bal_assact.assignment_id
3469 AND adj_prr.assignment_action_id = assact.assignment_action_id
3470 AND adj_prr.status in ('P','PA')
3471 AND adj_petf.element_type_id = adj_prr.element_type_id
3472 AND adj_petf.element_name = 'New Wage Report Override'
3473 AND adj_petf.legislation_code = 'NL');
3474 --
3475 l_corr_ele_exists VARCHAR2(1);
3476 --
3477 BEGIN
3478 --
3479 l_corr_ele_exists := 'N';
3480 p_balance_values.delete;
3481 OPEN csr_chk_corr_ele_exists(p_assignment_action_id);
3482 FETCH csr_chk_corr_ele_exists INTO l_corr_ele_exists;
3483 IF csr_chk_corr_ele_exists%NOTFOUND THEN
3484 l_corr_ele_exists := 'N';
3485 ELSE
3486 p_corr_used := 'Y';
3487 END IF;
3488 CLOSE csr_chk_corr_ele_exists;
3489 --##--Fnd_file.put_line(FND_FILE.LOG,'#### balance value ');
3490 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_master_assignment_action_id '||p_master_assignment_action_id);
3491 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_assignment_action_id '||p_assignment_action_id);
3492 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_effective_date '||p_effective_date);
3493 --##--Fnd_file.put_line(FND_FILE.LOG,'#### p_tax_unit_id '||p_tax_unit_id);
3494 --##--Fnd_file.put_line(FND_FILE.LOG,'#### g_nom_bal_def_table.count '||g_nom_bal_def_table.count);
3495 --##--Fnd_file.put_line(FND_FILE.LOG,'#### l_corr_ele_exists '||l_corr_ele_exists);
3496 FOR i IN g_nom_bal_def_table.FIRST..g_nom_bal_def_table.LAST LOOP
3497 p_balance_values(i).balance_value := 0;
3498 IF l_corr_ele_exists = 'N' AND (g_nom_bal_def_table(i).database_item_suffix like '%ADJ%'
3499 OR g_nom_bal_def_table(i).database_item_suffix like '%CORR%') THEN
3500 IF g_nom_bal_def_table(i).database_item_suffix like '%SIT%ADJ%' THEN
3501 g_nom_bal_def_table(i).database_item_suffix := '_ASG_SIT_PTD';
3502 ELSIF g_nom_bal_def_table(i).database_item_suffix like '%ADJ%' THEN
3503 g_nom_bal_def_table(i).database_item_suffix := '_ASG_PTD';
3504 ELSIF g_nom_bal_def_table(i).database_item_suffix like '%SIT%CORR%' THEN
3505 g_nom_bal_def_table(i).database_item_suffix := 'CORR_SI';
3506 ELSIF g_nom_bal_def_table(i).database_item_suffix like '%CORR%' THEN
3507 g_nom_bal_def_table(i).database_item_suffix := 'CORR';
3508 ELSE
3509 g_nom_bal_def_table(i).database_item_suffix := NULL;
3510 g_nom_bal_def_table(i).defined_balance_id := 0;
3511 END IF;
3512 ELSIF l_corr_ele_exists = 'Y' AND g_nom_bal_def_table(i).balance_name LIKE '%Retro%' THEN
3513 IF g_nom_bal_def_table(i).database_item_suffix like '_ASG_SIT_PTD' THEN
3514 g_nom_bal_def_table(i).database_item_suffix := '_ASG_SIT_ADJ_PTD';
3515 ELSIF g_nom_bal_def_table(i).database_item_suffix like '_ASG_PTD' THEN
3516 g_nom_bal_def_table(i).database_item_suffix := '_ASG_ADJ_PTD';
3517 ELSIF g_nom_bal_def_table(i).database_item_suffix like 'CORR_SI' THEN
3518 g_nom_bal_def_table(i).database_item_suffix := '_ASG_SIT_REPORT_CORR_PTD';
3519 ELSIF g_nom_bal_def_table(i).database_item_suffix like 'CORR' THEN
3520 g_nom_bal_def_table(i).database_item_suffix := '_ASG_REPORT_CORR_PTD';
3521 END IF;
3522 END IF;
3523 IF g_nom_bal_def_table(i).database_item_suffix IS NOT NULL THEN
3524 g_nom_bal_def_table(i).defined_balance_id := get_defined_balance_id(g_nom_bal_def_table(i).balance_name
3525 ,g_nom_bal_def_table(i).database_item_suffix);
3526 END IF;
3527 IF g_nom_bal_def_table(i).defined_balance_id <> 0 AND
3528 (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
3529 --(p_record_type <> 'HR' OR g_nom_bal_def_table(i).database_item_suffix not in ('_ASG_REPORT_CORR_PTD','_ASG_ADJ_PTD'))
3530 l_assignment_action_id := p_assignment_action_id;
3531 l_context := 'N';
3532 l_balance_date := NULL;
3533 l_context_id := NULL;
3534 l_source_text := NULL;
3535 l_source_text2 := NULL;
3536 --
3537 IF g_nom_bal_def_table(i).database_item_suffix LIKE '%/_REPORT/_%' ESCAPE '/' OR
3538 g_nom_bal_def_table(i).database_item_suffix LIKE '%/_BDATE/_%' ESCAPE '/' THEN
3539 l_balance_date := p_effective_date;
3540 l_assignment_action_id := p_master_assignment_action_id;
3541 l_context := 'Y';
3542 END IF;
3543 --
3544 IF g_nom_bal_def_table(i).database_item_suffix LIKE '%/_SIT/_%' ESCAPE '/' THEN
3545 OPEN cur_act_contexts('SOURCE_TEXT');
3546 FETCH cur_act_contexts INTO l_context_id;
3547 CLOSE cur_act_contexts;
3548 l_source_text := g_nom_bal_def_table(i).context_val;
3549 l_context := 'Y';
3550 END IF;
3551 --
3552 IF g_nom_bal_def_table(i).database_item_suffix LIKE '%/_SIP/_%' ESCAPE '/' THEN
3553 OPEN cur_act_contexts('SOURCE_TEXT2');
3554 FETCH cur_act_contexts INTO l_context_id;
3555 CLOSE cur_act_contexts;
3556 l_source_text2 := g_nom_bal_def_table(i).context_val;
3557 l_context := 'Y';
3558 END IF;
3559 --
3560 IF g_nom_bal_def_table(i).database_item_suffix LIKE '%/_TU/_%' ESCAPE '/' THEN
3561 l_tax_unit_id := p_tax_unit_id;
3562 l_context := 'Y';
3563 END IF;
3564 --
3565 IF l_assignment_action_id = 0 OR l_assignment_action_id is NULL THEN
3566 p_balance_values(i).balance_value := 0;
3567 ELSE
3568 IF l_context = 'Y' THEN
3569 BEGIN
3570 p_balance_values(i).balance_value := pay_balance_pkg.get_value
3571 (p_defined_balance_id => g_nom_bal_def_table(i).defined_balance_id
3572 ,p_assignment_action_id => l_assignment_action_id
3573 ,p_tax_unit_id => l_tax_unit_id
3574 ,p_jurisdiction_code => NULL
3575 ,p_source_id => l_context_id
3576 ,p_source_text => l_source_text
3577 ,p_tax_group => NULL
3578 ,p_date_earned => NULL
3579 ,p_get_rr_route => NULL
3580 ,p_get_rb_route => NULL
3581 ,p_source_text2 => l_source_text2
3582 ,p_source_number => NULL
3583 ,p_time_def_id => NULL
3584 ,p_balance_date => l_balance_date
3585 ,p_payroll_id => NULL);
3586 --##--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);
3587 --##--Fnd_file.put_line(FND_FILE.LOG,'#########defined_balance_id :'||g_nom_bal_def_table(i).defined_balance_id);
3588 EXCEPTION
3589 WHEN OTHERS THEN
3590 p_balance_values(i).balance_value := 0;
3591 --##--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);
3592 --Fnd_file.put_line(FND_FILE.LOG,'## p_defined_balance_id ' || g_nom_bal_def_table(i).defined_balance_id);
3593 --Fnd_file.put_line(FND_FILE.LOG,'## l_assignment_action_id ' || l_assignment_action_id);
3594 --Fnd_file.put_line(FND_FILE.LOG,'## l_tax_unit_id ' || l_tax_unit_id);
3595 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text ' || l_source_text);
3596 --Fnd_file.put_line(FND_FILE.LOG,'## l_source_text2 ' || l_source_text2);
3597 --Fnd_file.put_line(FND_FILE.LOG,'## l_balance_date ' || l_balance_date);
3598 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
3599 END;
3600 ELSE --IF g_nom_bal_def_table(i).database_item_suffix <> '_ASG_ADJ_PTD' THEN
3601 BEGIN
3602 p_balance_values(i).balance_value := pay_balance_pkg.get_value(g_nom_bal_def_table(i).defined_balance_id
3603 ,p_assignment_action_id);
3604 --##--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);
3605 --##--Fnd_file.put_line(FND_FILE.LOG,'#########defined_balance_id :'||g_nom_bal_def_table(i).defined_balance_id);
3606 EXCEPTION
3607 WHEN OTHERS THEN
3608 p_balance_values(i).balance_value := 0;
3609 --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);
3610 --Fnd_file.put_line(FND_FILE.LOG,'## p_defined_balance_id ' || g_nom_bal_def_table(i).defined_balance_id);
3611 --Fnd_file.put_line(FND_FILE.LOG,'## l_assignment_action_id ' || l_assignment_action_id);
3612 END;
3613 END IF;
3614 END IF;
3615 END IF;
3616 END LOOP;
3617 --
3618 END populate_nom_balance_values;
3619 /*--------------------------------------------------------------------------------
3620 -- Function to retrieve correction balance for a period
3621 --------------------------------------------------------------------------------
3622 FUNCTION get_corr_bal(p_tax_unit_id IN NUMBER,p_date IN DATE) RETURN NUMBER IS
3623 BEGIN
3624 RETURN 100;
3625 END get_corr_bal;*/
3626 --------------------------------------------------------------------------------
3627 -- SET_COMPANY_TYPE_GLOBALS
3628 --------------------------------------------------------------------------------
3629 PROCEDURE set_company_type(p_actid IN NUMBER) IS
3630 --
3631 CURSOR csr_get_le_info (p_organization_id NUMBER) IS
3632 SELECT hoi.org_information2 org_id
3633 ,hoi.org_information5 Public_Org
3634 ,hoi.org_information6 Own_Risk_Cover
3635 FROM hr_organization_information hoi
3636 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
3637 AND hoi.organization_id = p_organization_id
3638 AND EXISTS (SELECT 1
3639 FROM hr_organization_information hoi1
3640 WHERE hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
3641 AND hoi1.org_information_context = 'CLASS'
3642 AND hoi1.organization_id = hoi.organization_id);
3643 /*SELECT hoi.org_information2 org_id
3644 ,hoi.org_information5 Public_Org
3645 ,hoi.org_information6 Own_Risk_Cover
3646 FROM hr_organization_information hoi
3647 ,hr_organization_information hoi1
3648 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
3649 AND hoi.organization_id = hoi1.organization_id
3650 AND hoi1.organization_id = p_organization_id
3651 AND hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
3652 AND hoi1.org_information_context = 'CLASS';*/
3653 --
3654 CURSOR csr_own_risk_cover(c_employer_id NUMBER
3655 ,c_business_group_id NUMBER) IS
3656 SELECT hoi.org_information5 Own_Risk_Cover
3657 ,hoi.org_information6 Contract_Code_Mapping
3658 FROM hr_organization_units hou
3659 ,hr_organization_information hoi
3660 WHERE hoi.org_information_context = 'NL_ORG_WR_INFO'
3661 AND hou.business_group_id = c_business_group_id
3662 AND hou.organization_id = hoi.organization_id
3663 AND hou.organization_id = c_employer_id;
3664 --
3665 CURSOR csr_public_org_flag(c_employer_id NUMBER
3666 ,c_business_group_id NUMBER) IS
3667 SELECT hoi.org_information17 Public_Org
3668 FROM hr_organization_units hou,hr_organization_information hoi
3669 WHERE hoi.org_information_context = 'NL_ORG_INFORMATION'
3670 AND hou.business_group_id = c_business_group_id
3671 AND hou.organization_id = hoi.organization_id
3672 AND hou.organization_id = c_employer_id;
3673 --
3674 CURSOR csr_retro_date(c_business_group_id NUMBER) IS
3675 select fnd_date.canonical_to_date(org_information5)
3676 from hr_organization_information
3677 where organization_id = c_business_group_id
3678 AND org_information_context = 'NL_BG_INFO';
3679 --
3680 l_start_date DATE;
3681 l_end_date DATE;
3682 l_seq_no VARCHAR2(50);
3683 l_tax_unit_id NUMBER;
3684 l_payroll_type VARCHAR2(80);
3685 l_business_group_id hr_all_organization_units.business_group_id%TYPE;
3686 l_hr_tax_unit hr_all_organization_units.organization_id%TYPE;
3687 l_risk_cover_flag hr_lookups.lookup_type%TYPE;
3688 l_date DATE;
3689 l_prev_corr_year VARCHAR2(100); --10100628
3690 l_er_only VARCHAR2(10); --10100628
3691 --
3692 BEGIN
3693 --
3694 pay_nl_wage_report_pkg.get_all_parameters(p_actid
3695 ,l_business_group_id
3696 ,l_start_date
3697 ,l_end_date
3698 ,l_tax_unit_id
3699 ,l_payroll_type
3700 ,l_seq_no
3701 ,l_prev_corr_year
3702 ,l_er_only); --10100628
3703 --
3704 g_public_org_flag := NULL;
3705 g_risk_cover_flag := NULL;
3706 l_hr_tax_unit := NULL;
3707 g_retro_type := 'OLD';
3708 g_effective_date := l_end_date;
3709 --
3710 OPEN csr_get_le_info(l_tax_unit_id);
3711 FETCH csr_get_le_info INTO l_hr_tax_unit,g_public_org_flag,g_risk_cover_flag;
3712 CLOSE csr_get_le_info;
3713 --
3714 IF g_public_org_flag IS NULL THEN
3715 OPEN csr_public_org_flag(NVL(l_hr_tax_unit,l_tax_unit_id),l_business_group_id);
3716 FETCH csr_public_org_flag INTO g_public_org_flag;
3717 CLOSE csr_public_org_flag;
3718 END IF;
3719 --
3720 --IF g_risk_cover_flag IS NULL THEN
3721 OPEN csr_own_risk_cover(NVL(l_hr_tax_unit,l_tax_unit_id),l_business_group_id);
3722 FETCH csr_own_risk_cover INTO l_risk_cover_flag,g_contract_code_mapping;
3723 CLOSE csr_own_risk_cover;
3724 --END IF;
3725 --
3726 OPEN csr_retro_date(l_business_group_id);
3727 FETCH csr_retro_date INTO l_date;
3728 CLOSE csr_retro_date;
3729 --
3730 g_public_org_flag := NVL(g_public_org_flag,'N');
3731 g_risk_cover_flag := NVL(NVL(g_risk_cover_flag,l_risk_cover_flag),'N');
3732 g_contract_code_mapping := NVL(g_contract_code_mapping,'NL_EMPLOYMENT_CATG');
3733 --
3734 IF l_date <= l_start_date THEN
3735 g_retro_type := 'NEW';
3736 END IF;
3737
3738 --10100628
3739 IF l_prev_corr_year <> '-9999' THEN
3740 g_retro_type := 'NEW';
3741 END IF;
3742 --10100628
3743
3744 --
3745 END set_company_type;
3746 --------------------------------------------------------------------------------
3747 -- INITIALIZE_CODE pay_nl_wage_report_pkg.archive_init_code
3748 --------------------------------------------------------------------------------
3749 PROCEDURE archive_init_code(p_actid IN NUMBER) IS
3750 l_payroll_type VARCHAR2(80);
3751 BEGIN
3752 --
3753 set_company_type(p_actid);
3754 ---Done for the yearly report
3755 l_payroll_type := TO_CHAR(get_parameters(p_actid,'Payroll_Type'));
3756 populate_nom_balance_table(l_payroll_type);
3757 --
3758 END archive_init_code;
3759
3760 --10100628
3761 PROCEDURE arch_deinit_prev_corr_yr (p_actid IN NUMBER
3762 ,p_business_group_id IN NUMBER
3763 ,p_tax_unit_id IN NUMBER
3764 ,p_payroll_type IN VARCHAR2
3765 ,p_seq_no IN VARCHAR2
3766 ,p_prev_corr_year IN VARCHAR2)
3767 IS
3768 -- DECLARE LOCAL VARIABLES
3769 l_ovn pay_action_information.object_version_number%type;
3770 l_action_info_id pay_action_information.action_information_id%type;
3771 l_business_group_id hr_all_organization_units.business_group_id%type;
3772 l_seq_no VARCHAR2(50);
3773 l_emp_total number;
3774 l_tax_unit_id NUMBER;
3775 l_payroll_type VARCHAR2(80);
3776 --CURSORS
3777 -- Employer's contact and telephone number
3778 CURSOR csr_get_empr_contact(c_employer_id NUMBER
3779 ,c_business_group_id NUMBER) IS
3780 SELECT hoi.org_information1 sender_id
3781 ,hoi.org_information2 contact_name
3782 ,hoi.org_information3 contact_num
3783 FROM hr_organization_units hou,hr_organization_information hoi
3784 WHERE hoi.org_information_context = 'NL_ORG_WR_INFO'
3785 AND hou.business_group_id = c_business_group_id
3786 AND hou.organization_id = hoi.organization_id
3787 AND hou.organization_id = c_employer_id;
3788 --
3789 -- Employer Tax reg name and Tax reg number
3790 CURSOR csr_tax_details(c_employer_id NUMBER
3791 ,c_business_group_id NUMBER) IS
3792 SELECT hoi.org_information14 tax_rep_name
3793 ,hoi.org_information4 tax_reg_num
3794 FROM hr_organization_units hou
3795 ,hr_organization_information hoi
3796 WHERE hoi.org_information_context = 'NL_ORG_INFORMATION'
3797 AND hou.business_group_id = c_business_group_id
3798 AND hou.organization_id = hoi.organization_id
3799 AND hou.organization_id = c_employer_id;
3800 --
3801 CURSOR csr_le_hr_mapping_chk (p_organization_id NUMBER) IS
3802 SELECT hoi.org_information1 tax_ref_no
3803 ,hoi.org_information2 org_id
3804 ,hoi.org_information3 tax_rep_name
3805 FROM hr_organization_information hoi
3806 ,hr_organization_information hoi1
3807 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
3808 AND hoi.organization_id = hoi1.organization_id
3809 AND hoi1.organization_id = p_organization_id
3810 AND hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
3811 AND hoi1.org_information_context = 'CLASS';
3812 -- Period dates for Employee records
3813 -- cursor to get distinct start date and end date for the records archived
3814 -- CURSOR VARIABLES
3815 l_empr_contact csr_get_empr_contact%ROWTYPE;
3816 l_tax_details csr_tax_details%ROWTYPE;
3817 --l_period_dates csr_period_dates%ROWTYPE;
3818 --l_get_sect_risk_grp csr_get_sect_risk_grp%ROWTYPE;
3819 l_date DATE;
3820 l_c_base_mon_fd NUMBER;
3821 l_con_mon_fd NUMBER;
3822 l_corr_bal NUMBER;
3823 --l_ret_cor_period csr_ret_cor_period%ROWTYPE;
3824 l_sector_flag VARCHAR2(1);
3825 l_sip_sector hr_organization_information.org_information1%TYPE;
3826 l_risk_grp hr_organization_information.org_information1%TYPE;
3827 l_c_base_mon_fd_z VARCHAR2(1);
3828 --
3829 --#
3830 --
3831 empr_flag VARCHAR2(1);
3832 empe_flag VARCHAR2(1);
3833 l_exception_flag VARCHAR2(1);
3834 l_awf VARCHAR2(1);
3835 l_tax_ref_no hr_organization_information.org_information1%TYPE;
3836 l_tax_rep_name hr_organization_information.org_information3%TYPE;
3837 l_hr_tax_unit hr_all_organization_units.organization_id%TYPE;
3838 --#
3839 --
3840 --
3841 --csr_employer_info_rec csr_employer_info%ROWTYPE;
3842 l_first_emp VARCHAR2(1);
3843 y NUMBER;
3844 l_sector hr_organization_information.org_information1%TYPE;
3845 l_risk_group hr_organization_information.org_information1%TYPE;
3846 p_swmf_col_bal_def_table BAL_COL_TABLE;
3847 l_val NUMBER;
3848 l_curr_ass_action_id NUMBER;
3849 l_period_ass_action_id NUMBER;
3850 --
3851 l_prev_ass_act_id NUMBER;
3852 l_prev_end_date DATE;
3853 l_prev_corr_bal NUMBER;
3854 --
3855 l_start_date DATE;
3856 l_end_date DATE;
3857
3858 l_prev_corr_year VARCHAR2(100); --13106837
3859 l_er_only VARCHAR2(10); --13106837
3860
3861 --
3862 BEGIN
3863
3864 /*Delete all data archived for the current payroll_action_id - to handle assignment level retry*/
3865 DELETE pay_action_information
3866 WHERE action_context_id = p_actid
3867 AND action_context_type = 'PA';
3868 --
3869 empr_flag := 'N';
3870 empe_flag := 'N';
3871 l_exception_flag := 'N';
3872 --
3873 set_company_type(p_actid);
3874
3875 IF p_prev_corr_year <> '-9999' THEN
3876 l_start_date := to_date('01-01-'||p_prev_corr_year, 'dd-mm-rrrr');
3877 l_end_date := to_date('31-12-'||p_prev_corr_year, 'dd-mm-rrrr');
3878 END IF;
3879
3880 --13106837
3881 --
3882 pay_nl_wage_report_pkg.get_all_parameters(p_actid
3883 ,l_business_group_id
3884 ,l_start_date
3885 ,l_end_date
3886 ,l_tax_unit_id
3887 ,l_payroll_type
3888 ,l_seq_no
3889 ,l_prev_corr_year
3890 ,l_er_only);
3891 --
3892 --13106837
3893
3894 OPEN csr_le_hr_mapping_chk(p_tax_unit_id);
3895 FETCH csr_le_hr_mapping_chk INTO l_tax_ref_no,l_hr_tax_unit,l_tax_rep_name;
3896 CLOSE csr_le_hr_mapping_chk;
3897 --
3898 -- Get Contact Name and Telephone number
3899 OPEN csr_get_empr_contact(NVL(l_hr_tax_unit,p_tax_unit_id),p_business_group_id);
3900 FETCH csr_get_empr_contact INTO l_empr_contact;
3901 CLOSE csr_get_empr_contact;
3902 -- Get Tax reg num and Tax rep name
3903 OPEN csr_tax_details(NVL(l_hr_tax_unit,p_tax_unit_id),p_business_group_id);
3904 FETCH csr_tax_details INTO l_tax_details;
3905 CLOSE csr_tax_details;
3906 --
3907 l_tax_details.tax_rep_name := NVL(l_tax_rep_name,l_tax_details.tax_rep_name);
3908 l_tax_details.tax_reg_num := NVL(l_tax_ref_no,l_tax_details.tax_reg_num);
3909 --
3910 --Archiving Employee Data NL_WR_EMPLOYER_INFO
3911 --Fnd_file.put_line(FND_FILE.LOG,' Archiving NL_WR_EMPLOYER_INFO deinit code ');
3912 pay_action_information_api.create_action_information
3913 (
3914 p_action_information_id => l_action_info_id
3915 , p_action_context_id => p_actid
3916 , p_action_context_type => 'PA'
3917 , p_object_version_number => l_ovn
3918 , p_assignment_id => NULL
3919 , p_effective_date => l_end_date
3920 , p_source_id => NULL
3921 , p_source_text => NULL
3922 , p_tax_unit_id => p_tax_unit_id
3923 , p_action_information_category => 'NL_WR_EMPLOYER_INFO'
3924 , p_action_information1 => p_tax_unit_id
3925 , p_action_information2 => substr(l_empr_contact.sender_id||l_tax_details.tax_reg_num,1,32)
3926 , p_action_information3 => fnd_date.date_to_canonical(sysdate)
3927 , p_action_information4 => substr(l_empr_contact.contact_name,1,35)
3928 , p_action_information5 => substr(l_seq_no,1,6)
3929 , p_action_information6 => substr(l_empr_contact.contact_num,1,25) --abraghun--7668628-- LC 2009 : Format changed from X(14) to X(25)
3930 , p_action_information7 => 'SWO00361ORACLE' --'BEL00361ORACLE' --Bug#: 7338209
3931 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12)
3932 , p_action_information9 => substr(l_tax_details.tax_rep_name,1,200)
3933 , p_action_information10 => fnd_date.date_to_canonical(l_start_date)
3934 , p_action_information11 => fnd_date.date_to_canonical(l_end_date)
3935 , p_action_information12 => g_contract_code_mapping
3936 --LC2010--
3937 , p_action_information13 => 'SWO00361'
3938 , p_action_information14 => 'Oracle Payroll');
3939 --LC2010--
3940 --Fnd_file.put_line(FND_FILE.LOG,' Archived NL_WR_EMPLOYER_INFO deinit code ');
3941 --
3942
3943 --Fnd_file.put_line(FND_FILE.LOG,' Leaving Deinit Code');
3944
3945 EXCEPTION
3946 WHEN OTHERS THEN
3947 -- Return cursor that selects no rows
3948 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
3949 hr_utility.set_location(sqlerrm(sqlcode),110);
3950 END arch_deinit_prev_corr_yr;
3951 --10100628
3952
3953 --------------------------------------------------------------------------------
3954 -- ARCHIVE_DEINIT_CODE_YEARLY
3955 --------------------------------------------------------------------------------
3956 PROCEDURE archive_deinit_code_yearly(p_actid IN NUMBER
3957 ,p_business_group_id IN NUMBER
3958 ,p_start_date IN DATE
3959 ,p_end_date IN DATE
3960 ,p_tax_unit_id IN NUMBER
3961 ,p_payroll_type IN VARCHAR2
3962 ,p_seq_no IN VARCHAR2)
3963 IS
3964 -- DECLARE LOCAL VARIABLES
3965 l_ovn pay_action_information.object_version_number%type;
3966 l_action_info_id pay_action_information.action_information_id%type;
3967 l_business_group_id hr_all_organization_units.business_group_id%type;
3968 l_start_date DATE;
3969 l_end_date DATE;
3970 l_seq_no VARCHAR2(50);
3971 l_emp_total number;
3972 l_tax_unit_id NUMBER;
3973 l_payroll_type VARCHAR2(80);
3974 --CURSORS
3975 -- Employer's contact and telephone number
3976 CURSOR csr_get_empr_contact(c_employer_id NUMBER
3977 ,c_business_group_id NUMBER) IS
3978 SELECT hoi.org_information1 sender_id
3979 ,hoi.org_information2 contact_name
3980 ,hoi.org_information3 contact_num
3981 FROM hr_organization_units hou,hr_organization_information hoi
3982 WHERE hoi.org_information_context = 'NL_ORG_WR_INFO'
3983 AND hou.business_group_id = c_business_group_id
3984 AND hou.organization_id = hoi.organization_id
3985 AND hou.organization_id = c_employer_id;
3986 --
3987 -- Employer Tax reg name and Tax reg number
3988 CURSOR csr_tax_details(c_employer_id NUMBER
3989 ,c_business_group_id NUMBER) IS
3990 SELECT hoi.org_information14 tax_rep_name
3991 ,hoi.org_information4 tax_reg_num
3992 FROM hr_organization_units hou
3993 ,hr_organization_information hoi
3994 WHERE hoi.org_information_context = 'NL_ORG_INFORMATION'
3995 AND hou.business_group_id = c_business_group_id
3996 AND hou.organization_id = hoi.organization_id
3997 AND hou.organization_id = c_employer_id;
3998 --
3999 CURSOR csr_le_hr_mapping_chk (p_organization_id NUMBER) IS
4000 SELECT hoi.org_information1 tax_ref_no
4001 ,hoi.org_information2 org_id
4002 ,hoi.org_information3 tax_rep_name
4003 FROM hr_organization_information hoi
4004 ,hr_organization_information hoi1
4005 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
4006 AND hoi.organization_id = hoi1.organization_id
4007 AND hoi1.organization_id = p_organization_id
4008 AND hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
4009 AND hoi1.org_information_context = 'CLASS';
4010 -- Period dates for Employee records
4011 -- cursor to get distinct start date and end date for the records archived
4012 -- CURSOR VARIABLES
4013 l_empr_contact csr_get_empr_contact%ROWTYPE;
4014 l_tax_details csr_tax_details%ROWTYPE;
4015 --l_period_dates csr_period_dates%ROWTYPE;
4016 --l_get_sect_risk_grp csr_get_sect_risk_grp%ROWTYPE;
4017 l_date DATE;
4018 l_c_base_mon_fd NUMBER;
4019 l_con_mon_fd NUMBER;
4020 l_corr_bal NUMBER;
4021 --l_ret_cor_period csr_ret_cor_period%ROWTYPE;
4022 l_sector_flag VARCHAR2(1);
4023 l_sip_sector hr_organization_information.org_information1%TYPE;
4024 l_risk_grp hr_organization_information.org_information1%TYPE;
4025 l_c_base_mon_fd_z VARCHAR2(1);
4026 --
4027 --#
4028 --
4029 empr_flag VARCHAR2(1);
4030 empe_flag VARCHAR2(1);
4031 l_exception_flag VARCHAR2(1);
4032 l_awf VARCHAR2(1);
4033 l_tax_ref_no hr_organization_information.org_information1%TYPE;
4034 l_tax_rep_name hr_organization_information.org_information3%TYPE;
4035 l_hr_tax_unit hr_all_organization_units.organization_id%TYPE;
4036 --#
4037 --
4038 --
4039 --csr_employer_info_rec csr_employer_info%ROWTYPE;
4040 l_first_emp VARCHAR2(1);
4041 y NUMBER;
4042 l_sector hr_organization_information.org_information1%TYPE;
4043 l_risk_group hr_organization_information.org_information1%TYPE;
4044 p_swmf_col_bal_def_table BAL_COL_TABLE;
4045 l_val NUMBER;
4046 l_curr_ass_action_id NUMBER;
4047 l_period_ass_action_id NUMBER;
4048 --
4049 l_prev_ass_act_id NUMBER;
4050 l_prev_end_date DATE;
4051 l_prev_corr_bal NUMBER;
4052 --
4053 --
4054 BEGIN
4055 --hr_utility.trace_on(null,'NL_WR');
4056 --Fnd_file.put_line(FND_FILE.LOG,' Entering deinit code ');
4057 /*Delete all data archived for the current payroll_action_id - to handle assignment level retry*/
4058 DELETE pay_action_information
4059 WHERE action_context_id = p_actid
4060 AND action_context_type = 'PA';
4061 --
4062 empr_flag := 'N';
4063 empe_flag := 'N';
4064 l_exception_flag := 'N';
4065 --
4066 set_company_type(p_actid);
4067 OPEN csr_le_hr_mapping_chk(p_tax_unit_id);
4068 FETCH csr_le_hr_mapping_chk INTO l_tax_ref_no,l_hr_tax_unit,l_tax_rep_name;
4069 CLOSE csr_le_hr_mapping_chk;
4070 --
4071 -- Get Contact Name and Telephone number
4072 OPEN csr_get_empr_contact(NVL(l_hr_tax_unit,p_tax_unit_id),p_business_group_id);
4073 FETCH csr_get_empr_contact INTO l_empr_contact;
4074 CLOSE csr_get_empr_contact;
4075 -- Get Tax reg num and Tax rep name
4076 OPEN csr_tax_details(NVL(l_hr_tax_unit,p_tax_unit_id),p_business_group_id);
4077 FETCH csr_tax_details INTO l_tax_details;
4078 CLOSE csr_tax_details;
4079 --
4080 l_tax_details.tax_rep_name := NVL(l_tax_rep_name,l_tax_details.tax_rep_name);
4081 l_tax_details.tax_reg_num := NVL(l_tax_ref_no,l_tax_details.tax_reg_num);
4082 --
4083 --Archiving Employee Data NL_WR_EMPLOYER_INFO
4084 --Fnd_file.put_line(FND_FILE.LOG,' Archiving NL_WR_EMPLOYER_INFO deinit code ');
4085 pay_action_information_api.create_action_information
4086 (
4087 p_action_information_id => l_action_info_id
4088 , p_action_context_id => p_actid
4089 , p_action_context_type => 'PA'
4090 , p_object_version_number => l_ovn
4091 , p_assignment_id => NULL
4092 , p_effective_date => p_end_date
4093 , p_source_id => NULL
4094 , p_source_text => NULL
4095 , p_tax_unit_id => p_tax_unit_id
4096 , p_action_information_category => 'NL_WR_EMPLOYER_INFO'
4097 , p_action_information1 => p_tax_unit_id
4098 , p_action_information2 => substr(l_empr_contact.sender_id||l_tax_details.tax_reg_num,1,32)
4099 , p_action_information3 => fnd_date.date_to_canonical(sysdate)
4100 , p_action_information4 => substr(l_empr_contact.contact_name,1,35)
4101 , p_action_information5 => substr(l_seq_no,1,6)
4102 , p_action_information6 => substr(l_empr_contact.contact_num,1,25) --abraghun--7668628-- LC 2009 : Format changed from X(14) to X(25)
4103 , p_action_information7 => 'SWO00361ORACLE' --'BEL00361ORACLE' --Bug#: 7338209
4104 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12)
4105 , p_action_information9 => substr(l_tax_details.tax_rep_name,1,200)
4106 , p_action_information10 => fnd_date.date_to_canonical(GREATEST(p_start_date,trunc(p_end_date,'Y')))
4107 , p_action_information11 => fnd_date.date_to_canonical(p_end_date)
4108 , p_action_information12 => g_contract_code_mapping
4109 --LC2010--
4110 , p_action_information13 => 'SWO00361'
4111 , p_action_information14 => 'Oracle Payroll');
4112 --LC2010--
4113 --Fnd_file.put_line(FND_FILE.LOG,' Archived NL_WR_EMPLOYER_INFO deinit code ');
4114 --
4115
4116 --Fnd_file.put_line(FND_FILE.LOG,' Leaving Deinit Code');
4117 --#
4118 EXCEPTION
4119 WHEN OTHERS THEN
4120 -- Return cursor that selects no rows
4121 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
4122 hr_utility.set_location(sqlerrm(sqlcode),110);
4123 END archive_deinit_code_yearly;
4124 --------------------------------------------------------------------------------
4125 -- DEINITIALIZE_CODE pay_nl_wage_report_pkg.archive_deinit_code
4126 --------------------------------------------------------------------------------
4127 PROCEDURE archive_deinit_code(p_actid IN NUMBER)
4128 IS
4129 -- DECLARE LOCAL VARIABLES
4130 l_ovn pay_action_information.object_version_number%type;
4131 l_action_info_id pay_action_information.action_information_id%type;
4132 l_business_group_id hr_all_organization_units.business_group_id%type;
4133 l_start_date DATE;
4134 l_end_date DATE;
4135 l_seq_no VARCHAR2(50);
4136 l_emp_total number;
4137 l_tax_unit_id NUMBER;
4138 l_payroll_type VARCHAR2(80);
4139 --abraghun--7668628-- Validatation Local Variables--
4140 l_NR_LnLbPh NUMBER;
4141 l_NR_LnSV NUMBER;
4142 l_NR_IngLbPh NUMBER;
4143 l_NR_PrWAOAof NUMBER;
4144 l_NR_PrWAOAok NUMBER;
4145 l_NR_PrAWF NUMBER;
4146 l_NR_PrWgf NUMBER;
4147 l_NR_PrUFO NUMBER;
4148 l_NR_BijdrZvw NUMBER;
4149 l_NR_VergZvw NUMBER;
4150
4151 l_CR_TotLnLbPh NUMBER;
4152 l_CR_TotLnSV NUMBER;
4153 l_CR_PrLnUFO NUMBER;
4154 l_CR_PrLnAWF NUMBER;
4155 l_CR_PrLnWAOAok NUMBER;
4156 l_CR_PrLnWAOAof NUMBER;
4157 l_CR_TotVergZvw NUMBER;
4158 l_CR_IngLbPh NUMBER;
4159 l_CR_PrWAOAof NUMBER;
4160 l_CR_PrWAOAok NUMBER;
4161 l_CR_PrAWF NUMBER;
4162 l_CR_PrWgf NUMBER;
4163 l_CR_PrUFO NUMBER;
4164 l_CR_IngBijdrZvw NUMBER;
4165
4166 --l_CR_TotTeBet NUMBER;
4167 --l_CR_TotTeBet_Sum NUMBER;
4168 --l_CR_Saldo_Sum NUMBER;
4169 --l_CR_TotGen NUMBER;
4170
4171 -- l_SWMF_Sect_Count NUMBER;
4172 -- l_SWMF_RisGrp_Count NUMBER;
4173 -- l_SWMF_PrWgf NUMBER;
4174 l_SWMF_PrLnWgf NUMBER;
4175
4176 --abraghun--7668628-- Validatation Local Variables End --
4177
4178 --CURSORS
4179 --abraghun--7668628-- Validation Cursors
4180 CURSOR csr_nominative_sum (c_payroll_action_id IN NUMBER) IS
4181 SELECT
4182 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(pai.ACTION_INFORMATION5) ,0)))) LnLbPh,
4183 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(pai.ACTION_INFORMATION6) ,0)))) LnSV,
4184 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(pai.ACTION_INFORMATION15),0)))) IngLbPh,
4185 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(pai.ACTION_INFORMATION16),0)))) PrWAOAof,
4186 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(pai.ACTION_INFORMATION17),0)))) PrWAOAok,
4187 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(pai.ACTION_INFORMATION18),0)))) PrAWF,
4188 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(pai.ACTION_INFORMATION19),0)))) PrWgf,
4189 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(pai.ACTION_INFORMATION20),0)))) PrUFO,
4190 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(pai.ACTION_INFORMATION21),0)))) BijdrZvw,
4191 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(pai.ACTION_INFORMATION22),0)))) VergZvw
4192 FROM PAY_ACTION_INFORMATION pai
4193 WHERE ACTION_CONTEXT_ID IN
4194 (SELECT ASSIGNMENT_ACTION_ID
4195 FROM PAY_ASSIGNMENT_ACTIONS paa
4196 WHERE PAYROLL_ACTION_ID=c_payroll_action_id)
4197 AND ACTION_INFORMATION_CATEGORY='NL_WR_NOMINATIVE_REPORT'
4198 AND ACTION_INFORMATION1='INITIAL';
4199
4200 CURSOR csr_swmf_sum (c_payroll_action_id IN NUMBER) IS
4201 /* SELECT
4202 COUNT(pai.ACTION_INFORMATION7) Sect,
4203 COUNT(pai.ACTION_INFORMATION8) RisGrp,
4204 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(ACTION_INFORMATION10),0)))) PrWgf,
4205 fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(ACTION_INFORMATION9),0)))) PrLnWgf
4206 FROM pay_action_information pai
4207 WHERE ACTION_CONTEXT_ID IN
4208 (SELECT ASSIGNMENT_ACTION_ID
4209 FROM PAY_ASSIGNMENT_ACTIONS paa
4210 WHERE PAYROLL_ACTION_ID=c_payroll_action_id)
4211 AND ACTION_INFORMATION_CATEGORY ='NL_WR_SWMF_SECTOR_RISK_GROUP';
4212 --AND ACTION_INFORMATION1='SWMF'
4213 */
4214 SELECT fnd_number.number_to_canonical(ROUND(SUM(NVL(fnd_number.canonical_to_number(PAI1.ACTION_INFORMATION9),0)))) PrLnWgf
4215 FROM pay_action_information PAI1, pay_action_information PAI2
4216 WHERE PAI1.action_context_id = c_payroll_action_id
4217 AND PAI1.action_context_id = PAI2.action_context_id
4218 AND PAI2.action_context_type = 'PA'
4219 AND PAI2.action_information_category = 'NL_WR_EMPLOYER_INFO'
4220 AND PAI1.action_information_category ='NL_WR_SWMF_SECTOR_RISK_GROUP'
4221 AND PAI1.ACTION_INFORMATION1 ='SWMF'
4222 AND PAI1.action_information5 = PAI2.action_information10
4223 AND PAI1.action_information6 = PAI2.action_information11;
4224
4225 /*
4226 Cursor for Employee Record Mismatch Identification
4227 BSN/Sofi/NumIV Uniqueness Checks (0036,0037,1036,1037)
4228 Dropped due to Performance considerations
4229
4230 CURSOR csr_er_mismatch(c_payroll_action_id IN NUMBER,
4231 c_payroll_type VARCHAR2) IS
4232 SELECT * FROM
4233 (SELECT
4234 ACTION_CONTEXT_ID ER_assactid,
4235 TAX_UNIT_ID ER_tax_unit_id,
4236 ACTION_INFORMATION10||ACTION_INFORMATION11||ACTION_INFORMATION9 ER_name,
4237 ACTION_INFORMATION4 ER_assignment_number,
4238 ACTION_INFORMATION8 Sofi,
4239 ACTION_INFORMATION5 PersNr,
4240 ACTION_INFORMATION18 NumIV,
4241 EFFECTIVE_DATE ER_eff_date,
4242 ASSIGNMENT_ID ER_assignment_id,
4243 count(*) over(partition by ACTION_INFORMATION18,ACTION_INFORMATION8) NumIVSofi,
4244 count(*) over(partition by ACTION_INFORMATION18,ACTION_INFORMATION5) NumIVPersNr
4245 FROM pay_action_information pai
4246 WHERE ACTION_CONTEXT_ID IN
4247 (SELECT ASSIGNMENT_ACTION_ID
4248 FROM PAY_ASSIGNMENT_ACTIONS paa
4249 WHERE PAYROLL_ACTION_ID=c_payroll_action_id)
4250 AND ACTION_INFORMATION_CATEGORY = 'NL_WR_EMPLOYMENT_INFO'
4251 AND ACTION_INFORMATION1=c_payroll_type)
4252 WHERE (NumIVPersNr+NumIVSofi)>2;
4253 */
4254
4255
4256 --abraghun--7668628-- Cursor to find Correction Reports with same period as Normal Report.
4257 -- Cursor for Check0022
4258
4259 CURSOR csr_period_overlap (c_payroll_action_id IN NUMBER) IS
4260 SELECT
4261 fnd_date.canonical_to_date(pai1.action_information2) start_date
4262 ,fnd_date.canonical_to_date(pai1.action_information3) end_date
4263 FROM pay_action_information pai1,
4264 pay_action_information pai2
4265 ,pay_assignment_actions paa
4266 WHERE pai1.action_context_type = 'AAP'
4267 AND pai2.action_context_type = 'AAP'
4268 AND pai1.action_information_category = 'NL_WR_EMPLOYMENT_INFO'
4269 AND pai2.action_information_category = 'NL_WR_EMPLOYMENT_INFO'
4270 AND pai1.action_context_id = paa.assignment_action_id
4271 AND pai2.action_context_id = paa.assignment_action_id
4272 AND paa.payroll_action_id = c_payroll_action_id
4273 AND pai1.action_information1 = 'INITIAL'
4274 AND pai2.action_information1 <>'INITIAL'
4275 AND pai1.action_information2 = pai2.action_information2
4276 AND pai1.action_information3 = pai2.action_information3;
4277
4278 --abraghun--7668628-- Validation Cursors End
4279
4280 -- Employer's contact and telephone number
4281 CURSOR csr_get_empr_contact(c_employer_id NUMBER
4282 ,c_business_group_id NUMBER) IS
4283 SELECT hoi.org_information1 sender_id
4284 ,hoi.org_information2 contact_name
4285 ,hoi.org_information3 contact_num
4286 FROM hr_organization_units hou,hr_organization_information hoi
4287 WHERE hoi.org_information_context = 'NL_ORG_WR_INFO'
4288 AND hou.business_group_id = c_business_group_id
4289 AND hou.organization_id = hoi.organization_id
4290 AND hou.organization_id = c_employer_id;
4291 --
4292 -- Employer Tax reg name and Tax reg number
4293 CURSOR csr_tax_details(c_employer_id NUMBER
4294 ,c_business_group_id NUMBER) IS
4295 SELECT hoi.org_information14 tax_rep_name
4296 ,hoi.org_information4 tax_reg_num
4297 FROM hr_organization_units hou
4298 ,hr_organization_information hoi
4299 WHERE hoi.org_information_context = 'NL_ORG_INFORMATION'
4300 AND hou.business_group_id = c_business_group_id
4301 AND hou.organization_id = hoi.organization_id
4302 AND hou.organization_id = c_employer_id;
4303 --
4304 -- Period dates for Employee records
4305 -- cursor to get distinct start date and end date for the records archived
4306 CURSOR csr_period_dates(c_pact_id NUMBER) IS
4307 SELECT DISTINCT pai.Action_Information2 Start_date
4308 ,pai.action_information3 End_date
4309 FROM pay_assignment_actions paa
4310 ,pay_action_information pai
4311 WHERE paa.payroll_action_id = c_pact_id
4312 AND paa.assignment_action_id = pai.action_context_id
4313 AND pai.action_information_category = 'NL_WR_EMPLOYMENT_INFO'
4314 AND pai.action_information1 IN ('INITIAL','CORRECTION','CORRECT')
4315 AND pai.action_context_type = 'AAP';
4316 --
4317 -- Employeer Sector and Risk Group
4318 CURSOR csr_get_sect_risk_grp(c_employer_id NUMBER
4319 ,c_effective_date DATE
4320 ,c_business_group_id NUMBER) IS
4321 SELECT distinct hoi1.org_information5 sector
4322 ,hoi1.org_information6 risk_group
4323 ,hoi1.organization_id
4324 FROM hr_organization_information hoi1
4325 ,hr_organization_information hoi2
4326 ,hr_organization_information hoi3
4327 ,per_org_structure_versions posv
4328 WHERE hoi2.org_information4 = hoi1.organization_id
4329 AND hoi1.org_information5 IS NOT NULL
4330 AND hoi1.org_information6 IS NOT NULL
4331 AND hoi2.org_information_context= 'NL_SIP'
4332 AND hoi1.org_information_context= 'NL_UWV'
4333 AND hoi3.organization_id = c_business_group_id
4334 AND hoi3.org_information_context= 'NL_BG_INFO'
4335 --AND hoi2.org_information7 = 'Y'
4336 AND hr_nl_org_info.Get_Tax_Org_Id(posv.ORG_STRUCTURE_VERSION_ID ,hoi2.organization_id) = c_employer_id
4337 AND posv.ORGANIZATION_STRUCTURE_ID = TO_NUMBER(hoi3.org_information1)
4338 AND c_effective_date BETWEEN posv.date_from
4339 AND nvl(posv.date_to,to_date('31-12-4712','dd-mm-yyyy'))
4340 AND c_effective_date BETWEEN fnd_date.canonical_to_date(hoi2.org_information1)
4341 AND nvl(fnd_date.canonical_to_date(hoi2.org_information2),to_date('31-12-4712','dd-mm-yyyy'))
4342 AND EXISTS (SELECT 1
4343 FROM hr_organization_information hoi4
4344 WHERE hoi4.organization_id = hoi1.organization_id
4345 AND hoi4.org_information_context = 'NL_SIT'
4346 AND ORG_INFORMATION4 = 'WEWA')
4347 ORDER BY 1,2;
4348 --
4349 -- Correction balance total periods
4350 CURSOR csr_ret_cor_period(c_pact_id NUMBER) IS
4351 SELECT DISTINCT fnd_date.canonical_to_date(pai.Action_Information2) Start_date
4352 ,fnd_date.canonical_to_date(pai.action_information3) End_date
4353 FROM pay_assignment_actions paa
4354 ,pay_action_information pai
4355 WHERE paa.payroll_action_id = c_pact_id
4356 AND paa.assignment_action_id = pai.action_context_id
4357 AND pai.action_information_category = 'NL_WR_EMPLOYMENT_INFO'
4358 AND pai.action_information1 IN ('INITIAL','CORRECTION','CORRECT')
4359 AND pai.action_context_type = 'AAP'
4360 AND pai.action_information17 = 'PAY';
4361 --
4362 --
4363 /* CURSOR csr_le_hr_mapping_chk (p_organization_id NUMBER) IS
4364 SELECT hoi.org_information2 org_id
4365 ,hoi.org_information5 Public_Org
4366 ,hoi.org_information6 Own_Risk_Cover
4367 FROM hr_organization_information hoi
4368 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
4369 AND hoi.organization_id = p_organization_id
4370 AND EXISTS (SELECT 1
4371 FROM hr_organization_information hoi1
4372 WHERE hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
4373 AND hoi1.org_information_context = 'CLASS'
4374 AND hoi1.organization_id = hoi.organization_id); */
4375 CURSOR csr_le_hr_mapping_chk (p_organization_id NUMBER) IS
4376 SELECT hoi.org_information1 tax_ref_no
4377 ,hoi.org_information2 org_id
4378 ,hoi.org_information3 tax_rep_name
4379 FROM hr_organization_information hoi
4380 ,hr_organization_information hoi1
4381 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
4382 AND hoi.organization_id = hoi1.organization_id
4383 AND hoi1.organization_id = p_organization_id
4384 AND hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
4385 AND hoi1.org_information_context = 'CLASS';
4386 --
4387 -- CURSOR VARIABLES
4388 l_empr_contact csr_get_empr_contact%ROWTYPE;
4389 l_tax_details csr_tax_details%ROWTYPE;
4390 --l_period_dates csr_period_dates%ROWTYPE;
4391 l_get_sect_risk_grp csr_get_sect_risk_grp%ROWTYPE;
4392 l_date DATE;
4393 l_c_base_mon_fd NUMBER;
4394 l_con_mon_fd NUMBER;
4395 l_corr_bal NUMBER;
4396 l_ret_cor_period csr_ret_cor_period%ROWTYPE;
4397 l_sector_flag VARCHAR2(1);
4398 l_sip_sector hr_organization_information.org_information1%TYPE;
4399 l_risk_grp hr_organization_information.org_information1%TYPE;
4400 l_c_base_mon_fd_z VARCHAR2(1);
4401 --
4402 --#
4403 CURSOR csr_get_PA_exception_info(p_payroll_action_id IN NUMBER) IS
4404 SELECT pai_p.action_information4 Message
4405 ,fnd_date.date_to_displaydate(fnd_date.canonical_to_date(pai_p.action_information5)) Dt
4406 ,pai_p.action_information6 Description
4407 ,substr(pai_p.action_information7,1,30) E_Name
4408 ,substr(pai_p.action_information8,1,30) E_Number
4409 ,pai_p.action_context_type cxt
4410 FROM pay_action_information pai_p
4411 WHERE pai_p.action_context_id = p_payroll_action_id
4412 AND pai_p.action_information_category = 'NL_WR_EXCEPTION_REPORT'
4413 AND pai_p.action_context_type = 'PA'
4414 ORDER BY pai_p.action_information8 asc;
4415 --
4416 CURSOR csr_get_AAP_exception_info(p_payroll_action_id IN NUMBER) IS
4417 SELECT pai_p.action_information4 Message
4418 ,fnd_date.date_to_displaydate(fnd_date.canonical_to_date(pai_p.action_information5)) Dt
4419 ,pai_p.action_information6 Description
4420 ,substr(pai_p.action_information7,1,30) E_Name
4421 ,substr(pai_p.action_information8,1,30) E_Number
4422 ,pai_p.action_context_type cxt
4423 FROM pay_assignment_actions paa
4424 ,pay_action_information pai_p
4425 WHERE paa.payroll_action_id = p_payroll_action_id
4426 AND pai_p.action_context_id = paa.assignment_action_id
4427 AND pai_p.action_information_category = 'NL_WR_EXCEPTION_REPORT'
4428 AND pai_p.action_context_type = 'AAP'
4429 ORDER BY pai_p.action_information8 asc;
4430 --
4431 empr_flag VARCHAR2(1);
4432 empe_flag VARCHAR2(1);
4433 l_exception_flag VARCHAR2(1);
4434 l_awf VARCHAR2(1);
4435 l_tax_ref_no hr_organization_information.org_information1%TYPE;
4436 l_tax_rep_name hr_organization_information.org_information3%TYPE;
4437 l_hr_tax_unit hr_all_organization_units.organization_id%TYPE;
4438 --#
4439 --
4440 CURSOR csr_get_pactid IS
4441 SELECT DISTINCT paa1.payroll_action_id
4442 FROM pay_assignment_actions paa
4443 ,pay_action_interlocks pal
4444 ,pay_assignment_actions paa1
4445 WHERE paa.payroll_action_id = p_actid
4446 AND paa.assignment_action_id = pal.locking_action_id
4447 AND pal.locked_action_id = paa1.assignment_action_id
4448 ORDER BY paa1.payroll_action_id DESC;
4449 --
4450 CURSOR csr_employer_info(c_category VARCHAR2
4451 ,c_pactid NUMBER) IS
4452 SELECT pai.*
4453 FROM pay_action_information pai
4454 WHERE pai.action_context_type = 'PA'
4455 AND pai.action_context_id = c_pactid
4456 AND pai.action_information_category = c_category;
4457 --
4458 CURSOR csr_swmf_employer_info(c_legal_employer NUMBER
4459 ,c_start_date DATE
4460 ,c_end_date DATE) IS
4461 SELECT action_information7
4462 ,action_information8
4463 ,sum(fnd_number.canonical_to_number(action_information9)) action_information9
4464 ,sum(fnd_number.canonical_to_number(action_information10))action_information10
4465 FROM pay_action_information pai
4466 ,pay_payroll_actions ppa
4467 WHERE ppa.report_type = 'NL_WAGES_REP_ARCHIVE'
4468 AND ppa.report_qualifier = 'NL'
4469 AND ppa.action_type = 'X'
4470 AND ppa.action_status = 'C'
4471 AND INSTR(ppa.legislative_parameters,'Payroll_Type=WEEK') <> 0
4472 AND INSTR(ppa.legislative_parameters,'Legal_Employer='||c_legal_employer) <> 0
4473 AND ppa.effective_date BETWEEN c_start_date
4474 AND c_end_date
4475 AND pai.action_context_type = 'PA'
4476 AND pai.action_context_id = ppa.payroll_action_id
4477 AND pai.action_information_category = 'NL_WR_SWMF_SECTOR_RISK_GROUP'
4478 AND EXISTS ( SELECT 1
4479 FROM pay_assignment_actions paa1
4480 ,pay_action_interlocks ai
4481 ,pay_assignment_actions paa2
4482 WHERE paa1.payroll_action_id = p_actid
4483 AND paa1.assignment_action_id = ai.locking_action_id
4484 AND ai.locked_action_id = paa2.assignment_action_id
4485 AND paa2.payroll_action_id = ppa.payroll_action_id)
4486 GROUP BY action_information7,action_information8;
4487 --
4488 CURSOR csr_payroll_get_action_id(c_payroll_action_id NUMBER) IS
4489 SELECT max(locked_action_id)
4490 FROM pay_assignment_actions paa
4491 ,pay_payroll_actions ppa
4492 ,pay_action_interlocks pai
4493 WHERE ppa.payroll_action_id = c_payroll_action_id
4494 AND paa.payroll_action_id = ppa.payroll_action_id
4495 AND pai.locking_action_id = paa.assignment_action_id;
4496 --
4497 CURSOR csr_payroll_get_action_id2(c_payroll_action_id NUMBER
4498 ,c_start_date DATE
4499 ,c_end_date DATE) IS
4500 SELECT max(paa2.assignment_action_id)
4501 FROM pay_assignment_actions paa
4502 ,pay_payroll_actions ppa
4503 ,pay_action_interlocks pai
4504 ,pay_assignment_actions paa1
4505 ,pay_assignment_actions paa2
4506 ,pay_payroll_actions ppa2
4507 WHERE ppa.payroll_action_id = c_payroll_action_id
4508 AND paa.payroll_action_id = ppa.payroll_action_id
4509 AND pai.locking_action_id = paa.assignment_action_id
4510 AND paa1.assignment_action_id = pai.locked_action_id
4511 AND paa1.assignment_id = paa2.assignment_id
4512 AND paa2.payroll_action_id = ppa2.payroll_action_id
4513 AND ppa.business_group_id = ppa2.business_group_id
4514 AND ppa2.effective_date between c_start_date and c_end_date
4515 AND ppa2.action_type in ('R','Q')
4516 AND ppa2.action_status = 'C';
4517 --
4518 CURSOR csr_get_prev_period(c_ass_act_id NUMBER) IS
4519 SELECT paa2.assignment_action_id, ptp2.end_date
4520 FROM pay_assignment_actions paa1
4521 ,pay_payroll_actions ppa1
4522 ,pay_assignment_actions paa2
4523 ,pay_payroll_actions ppa2
4524 ,per_time_periods ptp1
4525 ,per_time_periods ptp2
4526 ,pay_all_payrolls_f ppf1
4527 ,pay_all_payrolls_f ppf2
4528 WHERE paa1.assignment_action_id = c_ass_act_id
4529 AND paa1.payroll_action_id = ppa1.payroll_action_id
4530 AND ppa1.payroll_id = ppf1.payroll_id
4531 AND ppa1.time_period_id = ptp1.time_period_id
4532 AND ppf1.period_type = 'Calendar Month'
4533 AND ppf1.period_type = ppf2.period_type
4534 AND paa1.tax_unit_id = paa2.tax_unit_id
4535 AND paa2.payroll_action_id = ppa2.payroll_action_id
4536 AND ppa2.payroll_id = ppf2.payroll_id
4537 AND ppa2.time_period_id = ptp2.time_period_id
4538 AND ptp2.end_date < ptp1.end_date
4539 ORDER BY 2 DESC;
4540
4541 --
4542 csr_employer_info_rec csr_employer_info%ROWTYPE;
4543 l_first_emp VARCHAR2(1);
4544 y NUMBER;
4545 l_sector hr_organization_information.org_information1%TYPE;
4546 l_risk_group hr_organization_information.org_information1%TYPE;
4547 p_swmf_col_bal_def_table BAL_COL_TABLE;
4548 l_val NUMBER;
4549 l_curr_ass_action_id NUMBER;
4550 l_period_ass_action_id NUMBER;
4551 --
4552 l_prev_ass_act_id NUMBER;
4553 l_prev_end_date DATE;
4554 l_prev_corr_bal NUMBER;
4555 --
4556 l_prev_corr_year VARCHAR2(100); --10100628
4557
4558 --10100628
4559 -- Correction balance total periods
4560 CURSOR csr_ret_cor_period1(c_pact_id NUMBER) IS
4561 SELECT DISTINCT pai.Action_Information2 Start_date
4562 ,pai.action_information3 End_date
4563 FROM pay_assignment_actions paa
4564 ,pay_action_information pai
4565 WHERE paa.payroll_action_id = c_pact_id
4566 AND paa.assignment_action_id = pai.action_context_id
4567 AND pai.action_information_category = 'NL_WR_EMPLOYMENT_INFO'
4568 AND pai.action_information1 IN ('CORRECTION','CORRECT')
4569 AND pai.action_context_type = 'AAP'
4570 AND pai.action_information17 = 'PAY'
4571 ORDER BY 1;
4572 --
4573 --10100628
4574
4575 --10100628
4576 CURSOR C_ER_ONLY_PD (p_tax_unit_id NUMBER, c_payroll_type VARCHAR2, p_start_date DATE)
4577 IS
4578 SELECT NVL(org_information7,'N')
4579 --10100628
4580 /*distinct fnd_date.canonical_to_date(org_information1) start_date
4581 ,fnd_date.canonical_to_date(org_information2) end_date
4582 ,org_information3
4583 ,fnd_number.canonical_to_number(org_information4) amount
4584 ,org_information5 frequency
4585 ,org_information6 */
4586 --10100628
4587 FROM hr_organization_information
4588 WHERE organization_id = p_tax_unit_id
4589 AND org_information_context = 'NL_ORG_FLAT_RATE_TAXATION'
4590 AND org_information6 = c_payroll_type
4591 AND p_start_date BETWEEN fnd_date.canonical_to_date(org_information1)
4592 AND NVL(fnd_date.canonical_to_date(org_information2),fnd_date.canonical_to_date('4712/12/31'))
4593 ORDER BY fnd_date.canonical_to_date(org_information1);
4594
4595 CURSOR C_ER_PYRLS(p_tax_unit_id NUMBER, p_bg_id NUMBER, p_start_date DATE, p_payroll_type VARCHAR2)
4596 IS
4597 select PAYROLL_ID
4598 from pay_payrolls_f
4599 where
4600 PRL_INFORMATION1 = to_char(p_tax_unit_id)
4601 AND BUSINESS_GROUP_ID = p_bg_id
4602 AND PERIOD_TYPE = DECODE(p_payroll_type,'MONTH','Calendar Month','WEEK','Week','LMONTH','Lunar Month')
4603 AND p_start_date BETWEEN EFFECTIVE_START_DATE AND EFFECTIVE_END_DATE;
4604
4605 -- bug 14125837 begin
4606 /*CURSOR C_ER_CORR_PD(p_payroll_id NUMBER, p_start_date DATE, p_end_date DATE, p_tax_unit_id NUMBER, c_payroll_type VARCHAR2) --10100628
4607 IS
4608 SELECT DISTINCT START_DATE, END_DATE
4609 from per_time_periods
4610 where
4611 PAYROLL_ID = p_payroll_id
4612 --AND p_start_date BETWEEN START_DATE AND END_DATE
4613 AND (START_DATE BETWEEN p_start_date AND p_end_date
4614 OR
4615 END_DATE BETWEEN p_start_date AND p_end_date
4616 )
4617 AND
4618 EXISTS
4619 (
4620 SELECT 1
4621 FROM hr_organization_information
4622 WHERE organization_id = p_tax_unit_id
4623 AND org_information_context = 'NL_ORG_FLAT_RATE_TAXATION'
4624 AND org_information6 = c_payroll_type
4625 AND START_DATE BETWEEN fnd_date.canonical_to_date(org_information1)
4626 AND NVL(fnd_date.canonical_to_date(org_information2),fnd_date.canonical_to_date('4712/12/31'))
4627 AND NVL(org_information7,'N') = 'Y'
4628 )
4629 ORDER by 1 asc; */
4630 CURSOR C_ER_CORR_PD(p_payroll_id NUMBER, p_start_date DATE, p_end_date DATE, p_tax_unit_id NUMBER, c_payroll_type VARCHAR2) --10100628
4631 IS
4632 SELECT DISTINCT START_DATE, END_DATE
4633 from per_time_periods
4634 where
4635 PAYROLL_ID = p_payroll_id
4636 --AND p_start_date BETWEEN START_DATE AND END_DATE
4637 AND (START_DATE BETWEEN p_start_date AND p_end_date
4638 OR
4639 END_DATE BETWEEN p_start_date AND p_end_date
4640 )
4641 AND
4642 EXISTS
4643 (
4644 SELECT 1
4645 FROM hr_organization_information
4646 WHERE organization_id = p_tax_unit_id
4647 AND (
4648 (
4649 org_information_context = 'NL_ORG_FLAT_RATE_TAXATION'
4650 AND nvl (org_information7
4651 ,'N') = 'Y'
4652 )
4653 OR (
4654 org_information_context = 'NL_ORG_WR_PREV_YR_CORRECTION'
4655 )
4656 )
4657 AND org_information6 = c_payroll_type
4658 AND start_date BETWEEN fnd_date.canonical_to_date (org_information1)
4659 AND nvl (fnd_date.canonical_to_date (org_information2)
4660 ,fnd_date.canonical_to_date ('4712/12/31'))
4661
4662 )
4663 ORDER by 1 asc;
4664 --bug 14125837 end
4665
4666 CURSOR C_ASG_ACT_ID(p_bg_id NUMBER, p_tax_unit_id NUMBER, p_pd_start_date DATE, p_pd_end_date DATE)
4667 IS
4668 select max(paa.assignment_action_id)
4669 from
4670 pay_payroll_actions ppa,
4671 pay_assignment_actions paa,
4672 pay_payrolls_f ppf
4673 where
4674 ppa.payroll_action_id = paa.payroll_action_id
4675 AND ppa.business_group_id = p_bg_id
4676 AND ppa.action_type IN ('R','Q')
4677 AND paa.ACTION_STATUS IN ('C','S') -- 10228241
4678 AND ppa.ACTION_STATUS = 'C'
4679 AND ppf.payroll_id = ppa.payroll_id
4680 AND PRL_INFORMATION1 = to_char(p_tax_unit_id)
4681 AND ppa.EFFECTIVE_DATE BETWEEN ppf.EFFECTIVE_START_DATE AND ppf.EFFECTIVE_END_DATE
4682 and ppa.EFFECTIVE_DATE between p_pd_start_date and p_pd_end_date;
4683
4684 l_er_only VARCHAR2(10); --10100628
4685 l_pyrl_id number; --10100628
4686 l_pd_start_date date; --10100628
4687 --10100628
4688
4689 --10100628
4690 CURSOR C_PREV_CORR_YR_WTFUND(p_payroll_action_id NUMBER, p_date DATE)
4691 IS
4692 SELECT
4693 SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION17)) PrWgf
4694 ,SUM(fnd_number.canonical_to_number(paei.AEI_INFORMATION30)) PrLnPrSectFnds
4695 FROM per_assignment_extra_info paei
4696 WHERE
4697 paei.aei_information_category = 'NL_WR_PREV_CORR'
4698 AND p_date BETWEEN fnd_date.canonical_to_date(paei.aei_information1)
4699 AND nvl(fnd_date.canonical_to_date(paei.aei_information2),to_date('31-12-4712','dd-mm-yyyy'))
4700 AND EXISTS
4701 (
4702 SELECT 1
4703 from
4704 pay_assignment_actions paa
4705 where
4706 paa.payroll_action_id = p_payroll_action_id
4707 and paa.action_status = 'C'
4708 and paa.assignment_id = paei.assignment_id
4709 );
4710
4711 l_co_col_PrWgf NUMBER :=0;
4712 l_co_col_PrLnPrSectFnds NUMBER :=0;
4713 --10100628
4714
4715 BEGIN
4716 -- hr_utility.trace_on(null,'NL_WR');
4717 --Fnd_file.put_line(FND_FILE.LOG,' Entering deinit code ');
4718 /*Delete all data archived for the current payroll_action_id - to handle assignment level retry*/
4719 DELETE pay_action_information
4720 WHERE action_context_id = p_actid
4721 AND action_context_type = 'PA';
4722 --
4723 empr_flag := 'N';
4724 empe_flag := 'N';
4725 l_exception_flag := 'N';
4726 --
4727 --Fnd_file.put_line(FND_FILE.LOG,' 0 ');
4728 pay_nl_wage_report_pkg.get_all_parameters(p_actid
4729 ,l_business_group_id
4730 ,l_start_date
4731 ,l_end_date
4732 ,l_tax_unit_id
4733 ,l_payroll_type
4734 ,l_seq_no
4735 ,l_prev_corr_year
4736 ,l_er_only); --10100628
4737 --Fnd_file.put_line(FND_FILE.LOG,' 1 ');
4738 set_company_type(p_actid);
4739 --10100628
4740 IF l_prev_corr_year <> '-9999' THEN
4741
4742 arch_deinit_prev_corr_yr(p_actid
4743 ,l_business_group_id
4744 ,l_tax_unit_id
4745 ,l_payroll_type
4746 ,l_seq_no
4747 ,l_prev_corr_year);
4748 --10100628
4749
4750 ELSIF l_payroll_type = 'YEARLY' THEN --10100628
4751 archive_deinit_code_yearly(p_actid
4752 ,l_business_group_id
4753 ,l_start_date
4754 ,l_end_date
4755 ,l_tax_unit_id
4756 ,l_payroll_type
4757 ,l_seq_no);
4758 --Fnd_file.put_line(FND_FILE.LOG,' 2 ');
4759 ELSIF l_payroll_type <> 'FOUR_WEEK' THEN
4760 --
4761 l_tax_rep_name := NULL;
4762 l_tax_ref_no := NULL;
4763 l_hr_tax_unit := NULL;
4764 --
4765 --Fnd_file.put_line(FND_FILE.LOG,' 3 ');
4766 OPEN csr_le_hr_mapping_chk(l_tax_unit_id);
4767 FETCH csr_le_hr_mapping_chk INTO l_tax_ref_no,l_hr_tax_unit,l_tax_rep_name;
4768 CLOSE csr_le_hr_mapping_chk;
4769 --
4770 --Fnd_file.put_line(FND_FILE.LOG,' 4 ');
4771 populate_col_balance_table(l_payroll_type,l_end_date,p_actid,p_swmf_col_bal_def_table);
4772 l_emp_total := 0;
4773 --
4774 --Fnd_file.put_line(FND_FILE.LOG,' 5 ');
4775 -- Get Contact Name and Telephone number
4776 OPEN csr_get_empr_contact(NVL(l_hr_tax_unit,l_tax_unit_id),l_business_group_id);
4777 FETCH csr_get_empr_contact INTO l_empr_contact;
4778 CLOSE csr_get_empr_contact;
4779 --Fnd_file.put_line(FND_FILE.LOG,' 6 ');
4780 --
4781 -- Get Tax reg num and Tax rep name
4782 OPEN csr_tax_details(NVL(l_hr_tax_unit,l_tax_unit_id),l_business_group_id);
4783 FETCH csr_tax_details INTO l_tax_details;
4784 CLOSE csr_tax_details;
4785 --Fnd_file.put_line(FND_FILE.LOG,' 7 ');
4786 --
4787 l_tax_details.tax_rep_name := NVL(l_tax_rep_name,l_tax_details.tax_rep_name);
4788 l_tax_details.tax_reg_num := NVL(l_tax_ref_no,l_tax_details.tax_reg_num);
4789 --
4790 OPEN csr_payroll_get_action_id(p_actid);
4791 FETCH csr_payroll_get_action_id INTO l_curr_ass_action_id;
4792 CLOSE csr_payroll_get_action_id;
4793 --Fnd_file.put_line(FND_FILE.LOG,' 8 ');
4794 --
4795 --
4796 --
4797 IF l_empr_contact.sender_id IS NULL THEN
4798 pay_action_information_api.create_action_information
4799 (
4800 p_action_information_id => l_action_info_id
4801 , p_action_context_id => p_actid
4802 , p_action_context_type => 'PA'
4803 , p_object_version_number => l_ovn
4804 , p_assignment_id => NULL
4805 , p_effective_date => l_end_date
4806 , p_source_id => NULL
4807 , p_source_text => NULL
4808 , p_tax_unit_id => l_tax_unit_id
4809 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4810 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_SENDER_ID')
4811 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
4812 , p_action_information6 => 'Sender ID is null'
4813 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
4814 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
4815 END IF;
4816 --
4817 IF l_empr_contact.contact_name IS NULL THEN
4818 pay_action_information_api.create_action_information
4819 (
4820 p_action_information_id => l_action_info_id
4821 , p_action_context_id => p_actid
4822 , p_action_context_type => 'PA'
4823 , p_object_version_number => l_ovn
4824 , p_assignment_id => NULL
4825 , p_effective_date => l_end_date
4826 , p_source_id => NULL
4827 , p_source_text => NULL
4828 , p_tax_unit_id => l_tax_unit_id
4829 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4830 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_PERSON_NM')
4831 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
4832 , p_action_information6 => 'Contact Person is null'
4833 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
4834 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
4835 END IF;
4836 --
4837 IF l_empr_contact.contact_num IS NULL THEN
4838 pay_action_information_api.create_action_information
4839 (
4840 p_action_information_id => l_action_info_id
4841 , p_action_context_id => p_actid
4842 , p_action_context_type => 'PA'
4843 , p_object_version_number => l_ovn
4844 , p_assignment_id => NULL
4845 , p_effective_date => l_end_date
4846 , p_source_id => NULL
4847 , p_source_text => NULL
4848 , p_tax_unit_id => l_tax_unit_id
4849 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4850 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_CONTACT_NO')
4851 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
4852 , p_action_information6 => 'Contact Number is null'
4853 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
4854 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
4855 END IF;
4856 --
4857 IF l_tax_details.tax_reg_num IS NULL THEN
4858 pay_action_information_api.create_action_information
4859 (
4860 p_action_information_id => l_action_info_id
4861 , p_action_context_id => p_actid
4862 , p_action_context_type => 'PA'
4863 , p_object_version_number => l_ovn
4864 , p_assignment_id => NULL
4865 , p_effective_date => l_end_date
4866 , p_source_id => NULL
4867 , p_source_text => NULL
4868 , p_tax_unit_id => l_tax_unit_id
4869 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4870 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_TAX_NO')
4871 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
4872 , p_action_information6 => 'Tax Registration Number is null'
4873 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
4874 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
4875 END IF;
4876 --
4877 IF hr_ni_chk_pkg.chk_nat_id_format(l_tax_details.tax_reg_num,'DDDDDDDDDADD') <> upper(l_tax_details.tax_reg_num) OR
4878 substr(l_tax_details.tax_reg_num,10,1) <> 'L' THEN
4879 pay_action_information_api.create_action_information
4880 (
4881 p_action_information_id => l_action_info_id
4882 , p_action_context_id => p_actid
4883 , p_action_context_type => 'PA'
4884 , p_object_version_number => l_ovn
4885 , p_assignment_id => NULL
4886 , p_effective_date => l_end_date
4887 , p_source_id => NULL
4888 , p_source_text => NULL
4889 , p_tax_unit_id => l_tax_unit_id
4890 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4891 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_TAX_FORMAT')
4892 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
4893 , p_action_information6 => 'Tax Registration Number is not in the format 111111111L11'
4894 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
4895 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
4896 END IF;
4897 --
4898 IF l_tax_details.tax_rep_name IS NULL THEN
4899 pay_action_information_api.create_action_information
4900 (
4901 p_action_information_id => l_action_info_id
4902 , p_action_context_id => p_actid
4903 , p_action_context_type => 'PA'
4904 , p_object_version_number => l_ovn
4905 , p_assignment_id => NULL
4906 , p_effective_date => l_end_date
4907 , p_source_id => NULL
4908 , p_source_text => NULL
4909 , p_tax_unit_id => l_tax_unit_id
4910 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
4911 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_TAX_NAME')
4912 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
4913 , p_action_information6 => 'Tax Reporting Name is null'
4914 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
4915 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
4916 END IF;
4917 --
4918 --Archiving Employee Data NL_WR_EMPLOYER_INFO
4919 --Fnd_file.put_line(FND_FILE.LOG,' Archiving NL_WR_EMPLOYER_INFO deinit code ');
4920 pay_action_information_api.create_action_information
4921 (
4922 p_action_information_id => l_action_info_id
4923 , p_action_context_id => p_actid
4924 , p_action_context_type => 'PA'
4925 , p_object_version_number => l_ovn
4926 , p_assignment_id => NULL
4927 , p_effective_date => l_end_date
4928 , p_source_id => NULL
4929 , p_source_text => NULL
4930 , p_tax_unit_id => l_tax_unit_id
4931 , p_action_information_category => 'NL_WR_EMPLOYER_INFO'
4932 , p_action_information1 => l_tax_unit_id
4933 , p_action_information2 => substr(l_empr_contact.sender_id||l_tax_details.tax_reg_num,1,32)
4934 , p_action_information3 => fnd_date.date_to_canonical(sysdate)
4935 , p_action_information4 => substr(l_empr_contact.contact_name,1,35)
4936 , p_action_information5 => substr(l_seq_no,1,6)
4937 , p_action_information6 => substr(l_empr_contact.contact_num,1,25) --abraghun--7668628 -- LC 2009: Phone format changed from X(14) to X(25)
4938 , p_action_information7 => 'SWO00361ORACLE' --'BEL00361ORACLE' --Bug#: 7338209
4939 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12)
4940 , p_action_information9 => substr(l_tax_details.tax_rep_name,1,200)
4941 , p_action_information10 => fnd_date.date_to_canonical(l_start_date)
4942 , p_action_information11 => fnd_date.date_to_canonical(l_end_date)
4943 , p_action_information12 => g_contract_code_mapping
4944 --LC2010--
4945 , p_action_information13 => 'SWO00361'
4946 , p_action_information14 => 'Oracle Payroll');
4947 --LC2010--
4948 --Fnd_file.put_line(FND_FILE.LOG,' Archived NL_WR_EMPLOYER_INFO deinit code ');
4949 --
4950 FOR l_period_dates_rec IN csr_period_dates(p_actid) LOOP
4951 --Fnd_file.put_line(FND_FILE.LOG,' In csr_period_dates '||l_period_dates_rec.End_date);
4952 l_date := fnd_date.canonical_to_date(l_period_dates_rec.End_date);
4953 IF l_date >= l_start_date AND l_date <= l_end_date THEN -- COMPLETE RECORD
4954 --Fnd_file.put_line(FND_FILE.LOG,' If Current Period -- COMPLETE ');
4955 --Fnd_file.put_line(FND_FILE.LOG,' Calling populate_coll_bal_table for COMPLETE ');
4956 populate_coll_bal_table(p_actid => p_actid
4957 ,p_tax_unit_id => l_tax_unit_id
4958 ,p_effective_date => l_date
4959 ,p_balance_date => l_date
4960 ,p_type => 'COMPLETE'
4961 ,p_ass_action_id => l_curr_ass_action_id
4962 ,p_payroll_type => l_payroll_type
4963 ,p_emp_total => l_emp_total
4964 ,p_collXMLTable => collXMLTable);
4965 --Fnd_file.put_line(FND_FILE.LOG,' Populated coll table in deinit code '||collXMLTable.LAST );
4966 l_sector_flag := 'N';
4967 --Sector Risk Group NOT to be archived for public sector company.
4968 --Fnd_file.put_line(FND_FILE.LOG,' Checking Sector Risk Group Information');
4969 IF g_public_org_flag = 'N' THEN
4970 -- Employer Sector and Risk Group
4971 l_sip_sector := NULL;
4972 l_risk_grp := NULL;
4973 l_c_base_mon_fd := 0;
4974 l_con_mon_fd := 0;
4975 l_c_base_mon_fd_z := 'N';
4976 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
4977 l_sip_sector := NVL(l_sip_sector,l_get_sect_risk_grp.sector);
4978 l_risk_grp := NVL(l_risk_grp,l_get_sect_risk_grp.risk_group);
4979 IF l_sip_sector <> l_get_sect_risk_grp.sector OR l_risk_grp <> l_get_sect_risk_grp.risk_group THEN
4980 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Sector Risk Group Information');
4981 pay_action_information_api.create_action_information
4982 ( p_action_information_id => l_action_info_id
4983 , p_action_context_id => p_actid
4984 , p_action_context_type => 'PA'
4985 , p_object_version_number => l_ovn
4986 , p_assignment_id => NULL
4987 , p_effective_date => l_end_date
4988 , p_source_id => NULL
4989 , p_source_text => NULL
4990 ,p_tax_unit_id => l_tax_unit_id
4991 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
4992 , p_action_information1 => 'SWMF'
4993 , p_action_information2 => NULL
4994 , p_action_information5 => l_period_dates_rec.start_date
4995 , p_action_information6 => l_period_dates_rec.End_date
4996 , p_action_information7 => substr(l_sip_sector,1,3)
4997 , p_action_information8 => substr(l_risk_grp,1,2)
4998 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
4999 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd )));
5000 l_sip_sector := l_get_sect_risk_grp.sector;
5001 l_risk_grp := l_get_sect_risk_grp.risk_group;
5002 l_emp_total := l_emp_total + ROUND(l_con_mon_fd); --12804323
5003 l_sector_flag := 'Y';
5004 IF l_c_base_mon_fd = 0 THEN
5005 l_c_base_mon_fd_z := 'Y';
5006 END IF;
5007 l_c_base_mon_fd := 0;
5008 l_con_mon_fd := 0;
5009 END IF;
5010 --Fnd_file.put_line(FND_FILE.LOG,' Calling swmf balance ');
5011 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);
5012 --Fnd_file.put_line(FND_FILE.LOG,' Got swmf balance ');
5013 FOR i in 1..2 LOOP
5014 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;
5015 END LOOP;
5016 --
5017 FOR i in 3..4 LOOP
5018 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;
5019 END LOOP;
5020 --
5021 END LOOP;
5022 IF l_sip_sector IS NOT NULL OR l_risk_grp IS NOT NULL THEN
5023 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Sector Risk Group Information');
5024 pay_action_information_api.create_action_information
5025 ( p_action_information_id => l_action_info_id
5026 , p_action_context_id => p_actid
5027 , p_action_context_type => 'PA'
5028 , p_object_version_number => l_ovn
5029 , p_assignment_id => NULL
5030 , p_effective_date => l_end_date
5031 , p_source_id => NULL
5032 , p_source_text => NULL
5033 ,p_tax_unit_id => l_tax_unit_id
5034 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
5035 , p_action_information1 => 'SWMF'
5036 , p_action_information2 => NULL
5037 , p_action_information5 => l_period_dates_rec.start_date
5038 , p_action_information6 => l_period_dates_rec.End_date
5039 , p_action_information7 => substr(l_sip_sector,1,3)
5040 , p_action_information8 => substr(l_risk_grp,1,2)
5041 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
5042 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd )));
5043 --l_sip_sector := l_get_sect_risk_grp.sector;
5044 --l_risk_grp := l_get_sect_risk_grp.risk_group;
5045 l_emp_total := l_emp_total + ROUND(l_con_mon_fd); --12804323
5046 l_sector_flag := 'Y' ;
5047 IF l_c_base_mon_fd = 0 THEN
5048 l_c_base_mon_fd_z := 'Y';
5049 END IF;
5050 l_c_base_mon_fd := 0;
5051 l_con_mon_fd := 0;
5052 END IF;
5053 --
5054 END IF;
5055 --
5056 l_awf := 'N';
5057 --Fnd_file.put_line(FND_FILE.LOG,' Start loop for collXMLTable');
5058 FOR i IN collXMLTable.FIRST..collXMLTable.LAST LOOP
5059 --##--Fnd_file.put_line(FND_FILE.LOG,'#########'||'COMPLETE '||collXMLTable(i).TagName||' '||collXMLTable(i).TagValue||' '||collXMLTable(i).Mandatory);
5060 l_val := NULL;
5061 IF collXMLTable(i).Mandatory = 'Y' or collXMLTable(i).TagValue <> 0 THEN
5062 IF collXMLTable(i).TagName = 'TotTeBet' THEN
5063 l_val := l_emp_total;
5064 END IF;
5065 pay_action_information_api.create_action_information
5066 ( p_action_information_id => l_action_info_id
5067 , p_action_context_id => p_actid
5068 , p_action_context_type => 'PA'
5069 , p_object_version_number => l_ovn
5070 , p_tax_unit_id => l_tax_unit_id
5071 , p_assignment_id => NULL
5072 , p_effective_date => l_end_date
5073 , p_source_id => NULL
5074 , p_source_text => NULL
5075 , p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
5076 , p_action_information1 => 'COMPLETE'
5077 , p_action_information2 => collXMLTable(i).TagName
5078 , p_action_information3 => l_period_dates_rec.start_date
5079 , p_action_information4 => l_period_dates_rec.End_date
5080 , p_action_information5 => collXMLTable(i).TagDesc
5081 , p_action_information6 => fnd_number.number_to_canonical(ROUND(NVL(l_val,collXMLTable(i).TagValue))));
5082 IF collXMLTable(i).TagName = 'PrLnAWF' AND collXMLTable(i).TagValue <> 0 THEN
5083 l_awf := 'Y';
5084 END IF;
5085 END IF;
5086 --abraghun--7668628--Validation Data Capture--
5087
5088 IF collXMLTable(i).TagName = 'TotLnLbPh' THEN
5089 l_CR_TotLnLbPh := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5090 ELSIF collXMLTable(i).TagName = 'TotLnSV' THEN
5091 l_CR_TotLnSV := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5092 ELSIF collXMLTable(i).TagName = 'PrLnWAOAof' THEN
5093 l_CR_PrLnWAOAof := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5094 --LC 2012 begin. <PrLnWAOAok> Tag is obsolete and replaced with <TotPrLnWgaWhk>
5095 ELSIF collXMLTable(i).TagName IN ('PrLnWAOAok','TotPrLnWgaWhk') THEN
5096 l_CR_PrLnWAOAok := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5097 --LC 2012 end.
5098 ELSIF collXMLTable(i).TagName = 'PrLnAWF' THEN
5099 l_CR_PrLnAWF := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5100 ELSIF collXMLTable(i).TagName = 'PrLnUFO' THEN
5101 l_CR_PrLnUFO := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5102 --LC 2013 begin. <TotVergZvw> Tag is obsolete and replaced with <TotWghZvw>
5103 ELSIF collXMLTable(i).TagName in ('TotVergZvw','TotWghZvw') THEN
5104 l_CR_TotVergZvw := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5105 --LC 2013 end.
5106 ELSIF collXMLTable(i).TagName = 'IngLbPh' THEN
5107 l_CR_IngLbPh := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5108 ELSIF collXMLTable(i).TagName = 'PrWAOAof' THEN
5109 l_CR_PrWAOAof := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5110 --LC 2012 begin. <PrWAOAok> Tag is obsolete and replaced with <TotPrWgaWhk>
5111 ELSIF collXMLTable(i).TagName IN ('PrWAOAok','TotPrWgaWhk') THEN
5112 l_CR_PrWAOAok := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5113 --LC 2012 end.
5114 ELSIF collXMLTable(i).TagName = 'PrAWF' THEN
5115 l_CR_PrAWF := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5116 ELSIF collXMLTable(i).TagName = 'PrWgf' THEN
5117 l_CR_PrWgf := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5118 ELSIF collXMLTable(i).TagName = 'PrUFO' THEN
5119 l_CR_PrUFO := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5120 ELSIF collXMLTable(i).TagName = 'IngBijdrZvw' THEN
5121 l_CR_IngBijdrZvw := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5122 /* ELSIF collXMLTable(i).TagName = 'TotTeBet' THEN
5123 l_CR_TotTeBet := fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue));
5124 */
5125 END IF;
5126
5127 /*
5128 --abraghun--7668628-- Data Capture for Check0010
5129 IF collXMLTable(i).TagName IN
5130 ('IngLbPh',
5131 'EHPubUitk',
5132 'EHLnBestKar',
5133 'EHSpLn',
5134 'EHSpPr',
5135 'EHLnNat',
5136 'EHFeest',
5137 'EHBmVerg',
5138 'EHVUT',
5139 'PrWAOAof',
5140 'PrWAOAok',
5141 'PrAWF',
5142 'PrUFO',
5143 'IngBijdrZvw') THEN
5144
5145 l_CR_TotTeBet_Sum := fnd_number.number_to_canonical(
5146 fnd_number.canonical_to_number(NVL(l_CR_TotTeBet_Sum,0))
5147 +ROUND(collXMLTable(i).TagValue));
5148
5149 ELSIF collXMLTable(i).TagName IN
5150 ('AVBetOV',
5151 'AVLgdWerkl',
5152 'AVArboNP',
5153 'AVZeev',
5154 'AVOnd',
5155 'AGHKort',
5156 'VrlAVSO') THEN
5157 l_CR_TotTeBet_Sum := fnd_number.number_to_canonical(
5158 fnd_number.canonical_to_number(NVL(l_CR_TotTeBet_Sum,0))
5159 -ROUND(collXMLTable(i).TagValue));
5160
5161 END IF;
5162
5163
5164 */
5165
5166 --abraghun--7668628--Validation Data Capture End--
5167
5168 END LOOP;
5169
5170
5171 --
5172 IF g_public_org_flag = 'N' THEN
5173 IF l_sector_flag = 'N' THEN
5174 pay_action_information_api.create_action_information
5175 (
5176 p_action_information_id => l_action_info_id
5177 , p_action_context_id => p_actid
5178 , p_action_context_type => 'PA'
5179 , p_object_version_number => l_ovn
5180 , p_assignment_id => NULL
5181 , p_effective_date => l_end_date
5182 , p_source_id => NULL
5183 , p_source_text => NULL
5184 , p_tax_unit_id => l_tax_unit_id
5185 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
5186 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_SECTOR')
5187 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
5188 , p_action_information6 => 'Mandatory check on Sector'
5189 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
5190 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
5191 --
5192 pay_action_information_api.create_action_information
5193 (
5194 p_action_information_id => l_action_info_id
5195 , p_action_context_id => p_actid
5196 , p_action_context_type => 'PA'
5197 , p_object_version_number => l_ovn
5198 , p_assignment_id => NULL
5199 , p_effective_date => l_end_date
5200 , p_source_id => NULL
5201 , p_source_text => NULL
5202 , p_tax_unit_id => l_tax_unit_id
5203 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
5204 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_RISK_GROUP')
5205 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
5206 , p_action_information6 => 'No Risk Group'
5207 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
5208 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
5209 END IF;
5210 --
5211 IF l_awf <> 'N' AND l_c_base_mon_fd_z = 'Y' THEN
5212 pay_action_information_api.create_action_information
5213 (
5214 p_action_information_id => l_action_info_id
5215 , p_action_context_id => p_actid
5216 , p_action_context_type => 'PA'
5217 , p_object_version_number => l_ovn
5218 , p_assignment_id => NULL
5219 , p_effective_date => l_end_date
5220 , p_source_id => NULL
5221 , p_source_text => NULL
5222 , p_tax_unit_id => l_tax_unit_id
5223 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
5224 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_BASE_WEWE') -- Message Code should have been '%_WEWA'
5225 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
5226 , p_action_information6 => 'Waiting Money Fund contribution base is zero'
5227 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
5228 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
5229 END IF;
5230 --
5231 IF l_awf = 'N' AND l_c_base_mon_fd_z <> 'Y' THEN
5232 pay_action_information_api.create_action_information
5233 (
5234 p_action_information_id => l_action_info_id
5235 , p_action_context_id => p_actid
5236 , p_action_context_type => 'PA'
5237 , p_object_version_number => l_ovn
5238 , p_assignment_id => NULL
5239 , p_effective_date => l_end_date
5240 , p_source_id => NULL
5241 , p_source_text => NULL
5242 , p_tax_unit_id => l_tax_unit_id
5243 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
5244 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_AWF')
5245 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
5246 , p_action_information6 => 'AWF contribution base is zero'
5247 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
5248 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
5249 END IF;
5250 END IF;
5251 --#
5252 --Correction total balance
5253 l_prev_ass_act_id := NULL;
5254 --Fnd_file.put_line(FND_FILE.LOG,'Fetching prev period act_id -- CORR_BALANCE ');
5255 OPEN csr_get_prev_period(l_curr_ass_action_id);
5256 FETCH csr_get_prev_period INTO l_prev_ass_act_id, l_prev_end_date;
5257 CLOSE csr_get_prev_period;
5258 --Fnd_file.put_line(FND_FILE.LOG,'Prev period End Date -- CORR_BALANCE '||fnd_date.date_to_canonical(l_prev_end_date));
5259 --Fnd_file.put_line(FND_FILE.LOG,'Prev period act_id -- CORR_BALANCE '||fnd_number.number_to_canonical(l_prev_ass_act_id));
5260 FOR l_ret_cor_period IN csr_ret_cor_period(p_actid) LOOP
5261 --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));
5262 populate_coll_bal_table(p_actid => p_actid
5263 ,p_tax_unit_id => l_tax_unit_id
5264 ,p_effective_date=> l_end_date
5265 ,p_balance_date => l_ret_cor_period.End_date
5266 ,p_type => 'CORR_BALANCE'
5267 ,p_ass_action_id => l_curr_ass_action_id
5268 ,p_payroll_type => l_payroll_type
5269 ,p_emp_total => l_corr_bal
5270 ,p_collXMLTable => collXMLTable);
5271 --Fnd_file.put_line(FND_FILE.LOG,'corr balance -- CORR_BALANCE '||fnd_number.number_to_canonical(l_corr_bal));
5272 IF l_prev_ass_act_id IS NOT NULL THEN
5273 populate_coll_bal_table(p_actid => p_actid
5274 ,p_tax_unit_id => l_tax_unit_id
5275 ,p_effective_date=> l_prev_end_date
5276 ,p_balance_date => l_ret_cor_period.End_date
5277 ,p_type => 'CORR_BALANCE'
5278 ,p_ass_action_id => l_prev_ass_act_id
5279 ,p_payroll_type => l_payroll_type
5280 ,p_emp_total => l_prev_corr_bal
5281 ,p_collXMLTable => collXMLTable);
5282 l_corr_bal := l_corr_bal - NVL(l_prev_corr_bal,0);
5283 --Fnd_file.put_line(FND_FILE.LOG,'Prev corr balance -- CORR_BALANCE '||fnd_number.number_to_canonical(l_prev_corr_bal));
5284 END IF;
5285
5286 --Fnd_file.put_line(FND_FILE.LOG,' Checking Sector Risk Group Information');
5287 IF g_public_org_flag = 'N' THEN
5288 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
5289 --Fnd_file.put_line(FND_FILE.LOG,' Calling swmf balance -- CORR_BALANCE');
5290 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);
5291 --Fnd_file.put_line(FND_FILE.LOG,' Got swmf balance ');
5292 FOR i in 3..4 LOOP
5293 l_corr_bal := l_corr_bal + p_swmf_col_bal_def_table(i).balance_value + p_swmf_col_bal_def_table(i).balance_value2;
5294 END LOOP;
5295 --
5296 IF l_prev_ass_act_id IS NOT NULL THEN
5297 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);
5298 --Fnd_file.put_line(FND_FILE.LOG,' Got swmf balance for prev period');
5299 FOR i in 3..4 LOOP
5300 l_corr_bal := l_corr_bal - (p_swmf_col_bal_def_table(i).balance_value + p_swmf_col_bal_def_table(i).balance_value2);
5301 END LOOP;
5302 END IF;
5303 --
5304 END LOOP;
5305 --
5306 END IF;
5307 l_emp_total := l_emp_total + ROUND(l_corr_bal); --12804323
5308 --Fnd_file.put_line(FND_FILE.LOG,'Archiving NL_WR_COLLECTIVE_REPORT - CORR_BALANCE ');
5309 pay_action_information_api.create_action_information
5310 ( p_action_information_id => l_action_info_id
5311 , p_action_context_id => p_actid
5312 , p_action_context_type => 'PA'
5313 , p_object_version_number => l_ovn
5314 , p_tax_unit_id => l_tax_unit_id
5315 , p_assignment_id => NULL
5316 , p_effective_date => l_end_date
5317 , p_source_id => NULL
5318 , p_source_text => NULL
5319 , p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
5320 , p_action_information1 => 'CORR_BALANCE'
5321 , p_action_information2 => 'Saldo'
5322 , p_action_information3 => fnd_date.date_to_canonical(l_ret_cor_period.start_date)
5323 , p_action_information4 => fnd_date.date_to_canonical(l_ret_cor_period.End_date)
5324 , p_action_information5 => HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('Saldo'))
5325 , p_action_information6 => fnd_number.number_to_canonical(ROUND(l_corr_bal)));
5326 /*
5327 --abraghun--7668628-- Validation Data Capture --Check0011 -Begins
5328 l_CR_Saldo_Sum := fnd_number.number_to_canonical(
5329 fnd_number.canonical_to_number(NVL(l_CR_Saldo_Sum,0))
5330 +ROUND(l_corr_bal));
5331 --abraghun--7668628-- Validation Data Capture --Check0011 -Ends
5332 */
5333 END LOOP;
5334 -- Employer general total
5335 --Fnd_file.put_line(FND_FILE.LOG,'Archiving NL_WR_COLLECTIVE_REPORT - TOTAL ');
5336 pay_action_information_api.create_action_information
5337 (p_action_information_id => l_action_info_id
5338 ,p_action_context_id => p_actid
5339 ,p_action_context_type => 'PA'
5340 ,p_object_version_number => l_ovn
5341 ,p_tax_unit_id => l_tax_unit_id
5342 ,p_assignment_id => NULL
5343 ,p_effective_date => l_end_date
5344 ,p_source_id => NULL
5345 ,p_source_text => NULL
5346 ,p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
5347 ,p_action_information1 => 'TOTAL'
5348 ,p_action_information2 => 'TotGen' -- TAG NAME
5349 ,p_action_information3 => l_period_dates_rec.start_date
5350 ,p_action_information4 => l_period_dates_rec.End_date
5351 ,p_action_information5 => HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotGen')) -- TAG DESCRIPTION
5352 ,p_action_information6 => fnd_number.number_to_canonical(ROUND(l_emp_total)));
5353 /*
5354 --abraghun--7668628-- Validataion Data Capture --Check0011 -Begins
5355 l_CR_TotGen := fnd_number.number_to_canonical(ROUND(l_emp_total));
5356 --abraghun--7668628-- Validataion Data Capture --Check0011 -Ends
5357 */
5358 ELSE
5359 --Fnd_file.put_line(FND_FILE.LOG,' ELSE (Correction Period) -- CORRECTION ');
5360 OPEN csr_payroll_get_action_id2(p_actid
5361 ,fnd_date.canonical_to_date(l_period_dates_rec.start_date)
5362 ,fnd_date.canonical_to_date(l_period_dates_rec.End_date));
5363 FETCH csr_payroll_get_action_id2 INTO l_period_ass_action_id;
5364 CLOSE csr_payroll_get_action_id2;
5365 --Fnd_file.put_line(FND_FILE.LOG,'Calling populate_coll_bal_table -- CORRECTION ');
5366 populate_coll_bal_table(p_actid => p_actid
5367 ,p_tax_unit_id => l_tax_unit_id
5368 ,p_effective_date => l_end_date
5369 ,p_balance_date => l_date
5370 ,p_type => 'CORRECTION'
5371 ,p_ass_action_id => l_period_ass_action_id -- pass that months action id
5372 ,p_payroll_type => l_payroll_type
5373 ,p_emp_total => l_emp_total
5374 ,p_collXMLTable => collXMLTable);
5375 -- Employer Sector and Risk Group
5376 l_sector_flag := 'N';
5377 --Sector Risk Group NOT to be archived for public sector company. -vv
5378 --Fnd_file.put_line(FND_FILE.LOG,' Checking Sector Risk Group Information');
5379 IF g_public_org_flag = 'N' THEN
5380 l_sip_sector := NULL;
5381 l_risk_grp := NULL;
5382 l_c_base_mon_fd := 0;
5383 l_con_mon_fd := 0;
5384 l_c_base_mon_fd_z := 'N';
5385 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
5386 l_sip_sector := NVL(l_sip_sector,l_get_sect_risk_grp.sector);
5387 l_risk_grp := NVL(l_risk_grp,l_get_sect_risk_grp.risk_group);
5388 IF l_sip_sector <> l_get_sect_risk_grp.sector OR l_risk_grp <> l_get_sect_risk_grp.risk_group THEN
5389 --Fnd_file.put_line(FND_FILE.LOG,'Archiving NL_WR_SWMF_SECTOR_RISK_GROUP -- CORRECTION');
5390 pay_action_information_api.create_action_information
5391 (
5392 p_action_information_id => l_action_info_id
5393 , p_action_context_id => p_actid
5394 , p_action_context_type => 'PA'
5395 , p_object_version_number => l_ovn
5396 , p_assignment_id => NULL
5397 , p_effective_date => l_end_date
5398 , p_source_id => NULL
5399 , p_source_text => NULL
5400 ,p_tax_unit_id => l_tax_unit_id
5401 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
5402 , p_action_information1 => 'SWMF'
5403 , p_action_information2 => NULL
5404 , p_action_information5 => l_period_dates_rec.start_date
5405 , p_action_information6 => l_period_dates_rec.End_date
5406 , p_action_information7 => substr(l_sip_sector,1,3)
5407 , p_action_information8 => substr(l_risk_grp,1,2)
5408 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
5409 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd)));
5410 l_sip_sector := l_get_sect_risk_grp.sector;
5411 l_risk_grp := l_get_sect_risk_grp.risk_group;
5412 l_emp_total := l_emp_total + ROUND(l_con_mon_fd); --12804323
5413 l_sector_flag := 'Y';
5414 IF l_c_base_mon_fd = 0 THEN
5415 l_c_base_mon_fd_z := 'Y';
5416 END IF;
5417 l_c_base_mon_fd := 0;
5418 l_con_mon_fd := 0;
5419 END IF;
5420 --Fnd_file.put_line(FND_FILE.LOG,' Calling swmf balance -- CORRECTION');
5421 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);
5422 --Fnd_file.put_line(FND_FILE.LOG,' Got swmf balance ');
5423 l_c_base_mon_fd := 0;
5424 l_con_mon_fd := 0;
5425 FOR i in 1..2 LOOP
5426 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;
5427 END LOOP;
5428 --
5429 FOR i in 3..4 LOOP
5430 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;
5431 END LOOP;
5432 --l_emp_total := l_emp_total + l_con_mon_fd;
5433 --
5434 END LOOP;
5435 IF l_sip_sector IS NOT NULL OR l_risk_grp IS NOT NULL THEN
5436 pay_action_information_api.create_action_information
5437 (
5438 p_action_information_id => l_action_info_id
5439 , p_action_context_id => p_actid
5440 , p_action_context_type => 'PA'
5441 , p_object_version_number => l_ovn
5442 , p_assignment_id => NULL
5443 , p_effective_date => l_end_date
5444 , p_source_id => NULL
5445 , p_source_text => NULL
5446 ,p_tax_unit_id => l_tax_unit_id
5447 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
5448 , p_action_information1 => 'SWMF'
5449 , p_action_information2 => NULL
5450 , p_action_information5 => l_period_dates_rec.start_date
5451 , p_action_information6 => l_period_dates_rec.End_date
5452 , p_action_information7 => substr(l_sip_sector,1,3)
5453 , p_action_information8 => substr(l_risk_grp,1,2)
5454 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
5455 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd)));
5456 --l_sip_sector := l_get_sect_risk_grp.sector;
5457 --l_risk_grp := l_get_sect_risk_grp.risk_group;
5458 l_emp_total := l_emp_total + ROUND(l_con_mon_fd); --12804323
5459 l_sector_flag := 'Y';
5460 IF l_c_base_mon_fd = 0 THEN
5461 l_c_base_mon_fd_z := 'Y';
5462 END IF;
5463 END IF;
5464 --
5465 END IF;
5466 l_awf := 'N';
5467 FOR i IN collXMLTable.FIRST..collXMLTable.LAST LOOP
5468 l_val := NULL;
5469 IF collXMLTable(i).Mandatory = 'Y' or collXMLTable(i).TagValue <> 0 THEN
5470 --##--Fnd_file.put_line(FND_FILE.LOG,'#########'||'CORRECTION '||collXMLTable(i).TagName||' '||collXMLTable(i).TagValue||' '||collXMLTable(i).Mandatory);
5471 IF collXMLTable(i).TagName = 'TotTeBet' THEN
5472 l_val := l_emp_total;
5473 END IF;
5474 pay_action_information_api.create_action_information
5475 (
5476 p_action_information_id => l_action_info_id
5477 , p_action_context_id => p_actid
5478 , p_action_context_type => 'PA'
5479 , p_object_version_number => l_ovn
5480 , p_tax_unit_id => l_tax_unit_id
5481 , p_assignment_id => NULL
5482 , p_effective_date => l_end_date
5483 , p_source_id => NULL
5484 , p_source_text => NULL
5485 , p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
5486 , p_action_information1 => 'CORRECTION'
5487 , p_action_information2 => collXMLTable(i).TagName
5488 , p_action_information3 => l_period_dates_rec.start_date
5489 , p_action_information4 => l_period_dates_rec.End_date
5490 , p_action_information5 => collXMLTable(i).TagDesc
5491 , p_action_information6 => fnd_number.number_to_canonical(ROUND(NVL(l_val,collXMLTable(i).TagValue))));
5492 IF collXMLTable(i).TagName = 'PrLnAWF' AND collXMLTable(i).TagValue <> 0 THEN
5493 l_awf := 'Y';
5494 END IF;
5495 END IF;
5496 END LOOP;
5497 --
5498 IF g_public_org_flag = 'N' THEN
5499 IF l_sector_flag = 'N' THEN
5500 pay_action_information_api.create_action_information
5501 (
5502 p_action_information_id => l_action_info_id
5503 , p_action_context_id => p_actid
5504 , p_action_context_type => 'PA'
5505 , p_object_version_number => l_ovn
5506 , p_assignment_id => NULL
5507 , p_effective_date => l_end_date
5508 , p_source_id => NULL
5509 , p_source_text => NULL
5510 , p_tax_unit_id => l_tax_unit_id
5511 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
5512 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_SECTOR')
5513 , p_action_information5 => l_period_dates_rec.End_date
5514 , p_action_information6 => 'Mandatory check on Sector'
5515 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
5516 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
5517 --
5518 pay_action_information_api.create_action_information
5519 (
5520 p_action_information_id => l_action_info_id
5521 , p_action_context_id => p_actid
5522 , p_action_context_type => 'PA'
5523 , p_object_version_number => l_ovn
5524 , p_assignment_id => NULL
5525 , p_effective_date => l_end_date
5526 , p_source_id => NULL
5527 , p_source_text => NULL
5528 , p_tax_unit_id => l_tax_unit_id
5529 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
5530 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_RISK_GROUP')
5531 , p_action_information5 => l_period_dates_rec.End_date
5532 , p_action_information6 => 'No Risk Group'
5533 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
5534 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
5535 END IF;
5536 --
5537 IF l_awf <> 'N' AND l_c_base_mon_fd_z = 'Y' THEN
5538 pay_action_information_api.create_action_information
5539 (
5540 p_action_information_id => l_action_info_id
5541 , p_action_context_id => p_actid
5542 , p_action_context_type => 'PA'
5543 , p_object_version_number => l_ovn
5544 , p_assignment_id => NULL
5545 , p_effective_date => l_end_date
5546 , p_source_id => NULL
5547 , p_source_text => NULL
5548 , p_tax_unit_id => l_tax_unit_id
5549 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
5550 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_BASE_WEWE') -- Message Code should have been '%_WEWA'
5551 , p_action_information5 => l_period_dates_rec.End_date
5552 , p_action_information6 => 'Waiting Money Fund contribution base is zero'
5553 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
5554 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
5555 END IF;
5556 --
5557 IF l_awf = 'N' AND l_c_base_mon_fd_z <> 'Y' THEN
5558 pay_action_information_api.create_action_information
5559 (
5560 p_action_information_id => l_action_info_id
5561 , p_action_context_id => p_actid
5562 , p_action_context_type => 'PA'
5563 , p_object_version_number => l_ovn
5564 , p_assignment_id => NULL
5565 , p_effective_date => l_end_date
5566 , p_source_id => NULL
5567 , p_source_text => NULL
5568 , p_tax_unit_id => l_tax_unit_id
5569 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
5570 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_AWF')
5571 , p_action_information5 => l_period_dates_rec.End_date
5572 , p_action_information6 => 'AWF contribution base is zero'
5573 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
5574 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
5575 END IF;
5576 --
5577 END IF;
5578 --#
5579 END IF;
5580 END LOOP;
5581 --
5582 END IF;
5583 --
5584
5585 --10100628
5586 IF l_prev_corr_year <> '-9999' AND l_ER_ONLY = 'N' THEN
5587
5588 populate_col_balance_table(l_payroll_type,l_end_date,p_actid,p_swmf_col_bal_def_table);
5589 l_emp_total := 0;
5590
5591 FOR ret_period IN csr_ret_cor_period1(p_actid) LOOP
5592
5593 --Fnd_file.put_line(FND_FILE.LOG,' ELSE (Correction Period) -- CORRECTION ');
5594 OPEN csr_payroll_get_action_id2(p_actid
5595 ,fnd_date.canonical_to_date(ret_period.start_date)
5596 ,fnd_date.canonical_to_date(ret_period.End_date));
5597 FETCH csr_payroll_get_action_id2 INTO l_period_ass_action_id;
5598 CLOSE csr_payroll_get_action_id2;
5599
5600 --10100628
5601 OPEN C_PREV_CORR_YR_WTFUND(p_actid, fnd_date.canonical_to_date(ret_period.End_date));
5602 FETCH C_PREV_CORR_YR_WTFUND INTO l_co_col_PrWgf, l_co_col_PrLnPrSectFnds;
5603 CLOSE C_PREV_CORR_YR_WTFUND;
5604 --10100628
5605
5606 --Fnd_file.put_line(FND_FILE.LOG,'Calling populate_coll_bal_table -- CORRECTION ');
5607
5608
5609 populate_coll_bal_table(p_actid => p_actid
5610 ,p_tax_unit_id => l_tax_unit_id
5611 ,p_effective_date => l_end_date
5612 ,p_balance_date => fnd_date.canonical_to_date(ret_period.End_date)
5613 ,p_type => 'CORRECTION'
5614 ,p_ass_action_id => l_period_ass_action_id -- pass that months action id
5615 ,p_payroll_type => l_payroll_type
5616 ,p_emp_total => l_emp_total
5617 ,p_collXMLTable => collXMLTable);
5618 -- Employer Sector and Risk Group
5619
5620 l_sector_flag := 'N';
5621 --Sector Risk Group NOT to be archived for public sector company. -vv
5622 --Fnd_file.put_line(FND_FILE.LOG,' Checking Sector Risk Group Information');
5623
5624
5625 IF g_public_org_flag = 'N' THEN
5626
5627 l_sip_sector := NULL;
5628 l_risk_grp := NULL;
5629 l_c_base_mon_fd := 0;
5630 l_con_mon_fd := 0;
5631 l_c_base_mon_fd_z := 'N';
5632
5633
5634 FOR l_get_sect_risk_grp in csr_get_sect_risk_grp(NVL(l_hr_tax_unit,l_tax_unit_id),fnd_date.canonical_to_date(ret_period.End_date),l_business_group_id) LOOP
5635 l_sip_sector := NVL(l_sip_sector,l_get_sect_risk_grp.sector);
5636 l_risk_grp := NVL(l_risk_grp,l_get_sect_risk_grp.risk_group);
5637 IF l_sip_sector <> l_get_sect_risk_grp.sector OR l_risk_grp <> l_get_sect_risk_grp.risk_group THEN
5638
5639
5640 --Fnd_file.put_line(FND_FILE.LOG,'Archiving NL_WR_SWMF_SECTOR_RISK_GROUP -- CORRECTION');
5641 pay_action_information_api.create_action_information
5642 (
5643 p_action_information_id => l_action_info_id
5644 , p_action_context_id => p_actid
5645 , p_action_context_type => 'PA'
5646 , p_object_version_number => l_ovn
5647 , p_assignment_id => NULL
5648 , p_effective_date => l_end_date
5649 , p_source_id => NULL
5650 , p_source_text => NULL
5651 ,p_tax_unit_id => l_tax_unit_id
5652 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
5653 , p_action_information1 => 'SWMF'
5654 , p_action_information2 => NULL
5655 , p_action_information5 => ret_period.start_date
5656 , p_action_information6 => ret_period.End_date
5657 , p_action_information7 => substr(l_sip_sector,1,3)
5658 , p_action_information8 => substr(l_risk_grp,1,2)
5659 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
5660 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd)));
5661 l_sip_sector := l_get_sect_risk_grp.sector;
5662 l_risk_grp := l_get_sect_risk_grp.risk_group;
5663 l_emp_total := l_emp_total + ROUND(l_con_mon_fd); --12804323
5664 l_sector_flag := 'Y';
5665 IF l_c_base_mon_fd = 0 THEN
5666 l_c_base_mon_fd_z := 'Y';
5667 END IF;
5668 l_c_base_mon_fd := 0;
5669 l_con_mon_fd := 0;
5670 END IF;
5671 --Fnd_file.put_line(FND_FILE.LOG,' Calling swmf balance -- CORRECTION');
5672
5673
5674 populate_col_balance_values(p_swmf_col_bal_def_table,l_tax_unit_id,l_end_date,fnd_date.canonical_to_date(ret_period.End_date),'CORRECTION',l_get_sect_risk_grp.organization_id,l_period_ass_action_id);
5675
5676
5677 --Fnd_file.put_line(FND_FILE.LOG,' Got swmf balance ');
5678 l_c_base_mon_fd := 0;
5679 l_con_mon_fd := 0;
5680 FOR i in 1..2 LOOP
5681 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;
5682 END LOOP;
5683
5684 l_c_base_mon_fd := l_c_base_mon_fd + NVL(l_co_col_PrLnPrSectFnds,0); --10100628
5685
5686 --
5687 FOR i in 3..4 LOOP
5688 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;
5689 END LOOP;
5690
5691 l_con_mon_fd := l_con_mon_fd + NVL(l_co_col_PrWgf,0); --10100628
5692
5693 --l_emp_total := l_emp_total + l_con_mon_fd;
5694 --
5695 END LOOP;
5696
5697 IF l_sip_sector IS NOT NULL OR l_risk_grp IS NOT NULL THEN
5698 pay_action_information_api.create_action_information
5699 (
5700 p_action_information_id => l_action_info_id
5701 , p_action_context_id => p_actid
5702 , p_action_context_type => 'PA'
5703 , p_object_version_number => l_ovn
5704 , p_assignment_id => NULL
5705 , p_effective_date => l_end_date
5706 , p_source_id => NULL
5707 , p_source_text => NULL
5708 ,p_tax_unit_id => l_tax_unit_id
5709 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
5710 , p_action_information1 => 'SWMF'
5711 , p_action_information2 => NULL
5712 , p_action_information5 => ret_period.start_date
5713 , p_action_information6 => ret_period.End_date
5714 , p_action_information7 => substr(l_sip_sector,1,3)
5715 , p_action_information8 => substr(l_risk_grp,1,2)
5716 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
5717 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd)));
5718 --l_sip_sector := l_get_sect_risk_grp.sector;
5719 --l_risk_grp := l_get_sect_risk_grp.risk_group;
5720 l_emp_total := l_emp_total + ROUND(l_con_mon_fd); --12804323
5721 l_sector_flag := 'Y';
5722 IF l_c_base_mon_fd = 0 THEN
5723 l_c_base_mon_fd_z := 'Y';
5724 END IF;
5725 END IF;
5726 --
5727 END IF;
5728 l_awf := 'N';
5729
5730 FOR i IN collXMLTable.FIRST..collXMLTable.LAST LOOP
5731 l_val := NULL;
5732
5733
5734 IF collXMLTable(i).Mandatory = 'Y' or collXMLTable(i).TagValue <> 0 THEN
5735 --##--Fnd_file.put_line(FND_FILE.LOG,'#########'||'CORRECTION '||collXMLTable(i).TagName||' '||collXMLTable(i).TagValue||' '||collXMLTable(i).Mandatory);
5736 IF collXMLTable(i).TagName = 'TotTeBet' THEN
5737 l_val := l_emp_total;
5738 END IF;
5739 pay_action_information_api.create_action_information
5740 (
5741 p_action_information_id => l_action_info_id
5742 , p_action_context_id => p_actid
5743 , p_action_context_type => 'PA'
5744 , p_object_version_number => l_ovn
5745 , p_tax_unit_id => l_tax_unit_id
5746 , p_assignment_id => NULL
5747 , p_effective_date => l_end_date
5748 , p_source_id => NULL
5749 , p_source_text => NULL
5750 , p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
5751 , p_action_information1 => 'CORRECTION'
5752 , p_action_information2 => collXMLTable(i).TagName
5753 , p_action_information3 => ret_period.start_date
5754 , p_action_information4 => ret_period.End_date
5755 , p_action_information5 => collXMLTable(i).TagDesc
5756 , p_action_information6 => fnd_number.number_to_canonical(ROUND(NVL(l_val,collXMLTable(i).TagValue))));
5757 IF collXMLTable(i).TagName = 'PrLnAWF' AND collXMLTable(i).TagValue <> 0 THEN
5758 l_awf := 'Y';
5759 END IF;
5760 END IF;
5761 END LOOP;
5762 --
5763
5764 END LOOP;
5765 --#
5766 END IF;
5767 --10100628
5768
5769 --10100628
5770
5771 IF l_prev_corr_year <> '-9999' AND l_ER_ONLY = 'Y' THEN
5772
5773 l_pd_start_date := to_date('01-01-0001','dd-mm-rrrr'); --10100628
5774
5775 populate_col_balance_table(l_payroll_type,l_end_date,p_actid,p_swmf_col_bal_def_table);
5776 l_emp_total := 0;
5777
5778 --10100628
5779 --FOR rec_ER_ONLY_PD IN C_ER_ONLY_PD(l_tax_unit_id, l_payroll_type, l_prev_corr_year)
5780 --LOOP
5781
5782 OPEN C_ER_PYRLS(l_tax_unit_id, l_business_group_id, l_start_date, l_payroll_type);
5783 FETCH C_ER_PYRLS INTO l_pyrl_id;
5784 CLOSE C_ER_PYRLS;
5785
5786 FOR rec_ER_CORR_PD IN C_ER_CORR_PD(l_pyrl_id, l_start_date, l_end_date, l_tax_unit_id, l_payroll_type)
5787 LOOP
5788
5789 IF l_pd_start_date <> rec_ER_CORR_PD.start_date THEN --10100628
5790
5791 --10100628
5792 OPEN C_PREV_CORR_YR_WTFUND(p_actid, l_end_date);
5793 FETCH C_PREV_CORR_YR_WTFUND INTO l_co_col_PrWgf, l_co_col_PrLnPrSectFnds;
5794 CLOSE C_PREV_CORR_YR_WTFUND;
5795 --10100628
5796
5797 pay_action_information_api.create_action_information (
5798 p_action_information_id => l_action_info_id
5799 ,p_action_context_id => p_actid
5800 ,p_action_context_type => 'PA'
5801 ,p_object_version_number => l_ovn
5802 ,p_assignment_id => NULL
5803 ,p_effective_date => l_end_date
5804 ,p_source_id => NULL
5805 ,p_source_text => NULL
5806 ,p_tax_unit_id => l_tax_unit_id
5807 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
5808 ,p_action_information1 => 'CORRECT'
5809 ,p_action_information2 => fnd_date.date_to_canonical(rec_ER_CORR_PD.start_date)
5810 ,p_action_information3 => fnd_date.date_to_canonical(rec_ER_CORR_PD.end_date)
5811 );
5812
5813 OPEN C_ASG_ACT_ID(l_business_group_id, l_tax_unit_id, rec_ER_CORR_PD.start_date, rec_ER_CORR_PD.end_date);
5814 FETCH C_ASG_ACT_ID INTO l_period_ass_action_id;
5815 CLOSE C_ASG_ACT_ID;
5816
5817 populate_coll_bal_table(p_actid => p_actid
5818 ,p_tax_unit_id => l_tax_unit_id
5819 ,p_effective_date => l_end_date
5820 ,p_balance_date => rec_ER_CORR_PD.End_date
5821 ,p_type => 'CORRECTION'
5822 ,p_ass_action_id => l_period_ass_action_id -- pass that months action id
5823 ,p_payroll_type => l_payroll_type
5824 ,p_emp_total => l_emp_total
5825 ,p_collXMLTable => collXMLTable);
5826
5827 l_sector_flag := 'N';
5828 --Sector Risk Group NOT to be archived for public sector company. -vv
5829 --Fnd_file.put_line(FND_FILE.LOG,' Checking Sector Risk Group Information');
5830
5831 IF g_public_org_flag = 'N' THEN
5832
5833 l_sip_sector := NULL;
5834 l_risk_grp := NULL;
5835 l_c_base_mon_fd := 0;
5836 l_con_mon_fd := 0;
5837 l_c_base_mon_fd_z := 'N';
5838
5839 FOR l_get_sect_risk_grp in csr_get_sect_risk_grp(NVL(l_hr_tax_unit,l_tax_unit_id),rec_ER_CORR_PD.End_date,l_business_group_id) LOOP
5840 l_sip_sector := NVL(l_sip_sector,l_get_sect_risk_grp.sector);
5841 l_risk_grp := NVL(l_risk_grp,l_get_sect_risk_grp.risk_group);
5842 IF l_sip_sector <> l_get_sect_risk_grp.sector OR l_risk_grp <> l_get_sect_risk_grp.risk_group THEN
5843
5844
5845 --Fnd_file.put_line(FND_FILE.LOG,'Archiving NL_WR_SWMF_SECTOR_RISK_GROUP -- CORRECTION');
5846 pay_action_information_api.create_action_information
5847 (
5848 p_action_information_id => l_action_info_id
5849 , p_action_context_id => p_actid
5850 , p_action_context_type => 'PA'
5851 , p_object_version_number => l_ovn
5852 , p_assignment_id => NULL
5853 , p_effective_date => l_end_date
5854 , p_source_id => NULL
5855 , p_source_text => NULL
5856 ,p_tax_unit_id => l_tax_unit_id
5857 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
5858 , p_action_information1 => 'SWMF'
5859 , p_action_information2 => NULL
5860 , p_action_information5 => fnd_date.date_to_canonical(rec_ER_CORR_PD.start_date)
5861 , p_action_information6 => fnd_date.date_to_canonical(rec_ER_CORR_PD.End_date)
5862 , p_action_information7 => substr(l_sip_sector,1,3)
5863 , p_action_information8 => substr(l_risk_grp,1,2)
5864 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
5865 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd)));
5866 l_sip_sector := l_get_sect_risk_grp.sector;
5867 l_risk_grp := l_get_sect_risk_grp.risk_group;
5868 l_emp_total := l_emp_total + ROUND(l_con_mon_fd); --12804323
5869 l_sector_flag := 'Y';
5870 IF l_c_base_mon_fd = 0 THEN
5871 l_c_base_mon_fd_z := 'Y';
5872 END IF;
5873 l_c_base_mon_fd := 0;
5874 l_con_mon_fd := 0;
5875 END IF;
5876 --Fnd_file.put_line(FND_FILE.LOG,' Calling swmf balance -- CORRECTION');
5877
5878
5879 populate_col_balance_values(p_swmf_col_bal_def_table,l_tax_unit_id,l_end_date,rec_ER_CORR_PD.End_date,'CORRECTION',l_get_sect_risk_grp.organization_id,l_period_ass_action_id);
5880
5881
5882 --Fnd_file.put_line(FND_FILE.LOG,' Got swmf balance ');
5883 l_c_base_mon_fd := 0;
5884 l_con_mon_fd := 0;
5885 FOR i in 1..2 LOOP
5886 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;
5887 END LOOP;
5888 l_c_base_mon_fd := l_c_base_mon_fd + NVL(l_co_col_PrLnPrSectFnds,0); --10100628
5889 --
5890 FOR i in 3..4 LOOP
5891 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;
5892 END LOOP;
5893 l_con_mon_fd := l_con_mon_fd + NVL(l_co_col_PrWgf,0); --10100628
5894
5895 --l_emp_total := l_emp_total + l_con_mon_fd;
5896 --
5897 END LOOP;
5898
5899 IF l_sip_sector IS NOT NULL OR l_risk_grp IS NOT NULL THEN
5900 pay_action_information_api.create_action_information
5901 (
5902 p_action_information_id => l_action_info_id
5903 , p_action_context_id => p_actid
5904 , p_action_context_type => 'PA'
5905 , p_object_version_number => l_ovn
5906 , p_assignment_id => NULL
5907 , p_effective_date => l_end_date
5908 , p_source_id => NULL
5909 , p_source_text => NULL
5910 ,p_tax_unit_id => l_tax_unit_id
5911 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
5912 , p_action_information1 => 'SWMF'
5913 , p_action_information2 => NULL
5914 , p_action_information5 => fnd_date.date_to_canonical(rec_ER_CORR_PD.start_date)
5915 , p_action_information6 => fnd_date.date_to_canonical(rec_ER_CORR_PD.End_date)
5916 , p_action_information7 => substr(l_sip_sector,1,3)
5917 , p_action_information8 => substr(l_risk_grp,1,2)
5918 , p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
5919 , p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd)));
5920 --l_sip_sector := l_get_sect_risk_grp.sector;
5921 --l_risk_grp := l_get_sect_risk_grp.risk_group;
5922 l_emp_total := l_emp_total + ROUND(l_con_mon_fd); --12804323
5923 l_sector_flag := 'Y';
5924 IF l_c_base_mon_fd = 0 THEN
5925 l_c_base_mon_fd_z := 'Y';
5926 END IF;
5927 END IF;
5928 --
5929 END IF;
5930 l_awf := 'N';
5931
5932 FOR i IN collXMLTable.FIRST..collXMLTable.LAST LOOP
5933 l_val := NULL;
5934
5935
5936 IF collXMLTable(i).Mandatory = 'Y' or collXMLTable(i).TagValue <> 0 THEN
5937 --##--Fnd_file.put_line(FND_FILE.LOG,'#########'||'CORRECTION '||collXMLTable(i).TagName||' '||collXMLTable(i).TagValue||' '||collXMLTable(i).Mandatory);
5938 IF collXMLTable(i).TagName = 'TotTeBet' THEN
5939 l_val := l_emp_total;
5940 END IF;
5941 pay_action_information_api.create_action_information
5942 (
5943 p_action_information_id => l_action_info_id
5944 , p_action_context_id => p_actid
5945 , p_action_context_type => 'PA'
5946 , p_object_version_number => l_ovn
5947 , p_tax_unit_id => l_tax_unit_id
5948 , p_assignment_id => NULL
5949 , p_effective_date => l_end_date
5950 , p_source_id => NULL
5951 , p_source_text => NULL
5952 , p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
5953 , p_action_information1 => 'CORRECTION'
5954 , p_action_information2 => collXMLTable(i).TagName
5955 , p_action_information3 => fnd_date.date_to_canonical(rec_ER_CORR_PD.start_date)
5956 , p_action_information4 => fnd_date.date_to_canonical(rec_ER_CORR_PD.End_date)
5957 , p_action_information5 => collXMLTable(i).TagDesc
5958 , p_action_information6 => fnd_number.number_to_canonical(ROUND(NVL(l_val,collXMLTable(i).TagValue))));
5959 IF collXMLTable(i).TagName = 'PrLnAWF' AND collXMLTable(i).TagValue <> 0 THEN
5960 l_awf := 'Y';
5961 END IF;
5962 END IF;
5963 END LOOP;
5964 --
5965 END IF; --10100628
5966 l_pd_start_date := rec_ER_CORR_PD.start_date; --10100628
5967
5968 END LOOP;
5969
5970 --10100628
5971 --END LOOP;
5972
5973 END IF;
5974
5975
5976 --10100628
5977
5978
5979 l_sector := NULL;
5980 l_risk_group := NULL;
5981 IF l_payroll_type = 'FOUR_WEEK' THEN
5982 --
5983 l_first_emp := 'Y' ;
5984 --
5985 FOR csr_get_pactid_rec IN csr_get_pactid LOOP
5986 IF l_first_emp = 'Y' THEN
5987 --
5988 l_first_emp := 'N' ;
5989 --
5990 OPEN csr_employer_info('NL_WR_EMPLOYER_INFO',csr_get_pactid_rec.payroll_action_id);
5991 FETCH csr_employer_info INTO csr_employer_info_rec;
5992 --
5993 pay_action_information_api.create_action_information
5994 (
5995 p_action_information_id => l_action_info_id
5996 , p_action_context_id => p_actid
5997 , p_action_context_type => 'PA'
5998 , p_object_version_number => l_ovn
5999 , p_assignment_id => NULL
6000 , p_effective_date => l_end_date
6001 , p_source_id => NULL
6002 , p_source_text => NULL
6003 , p_tax_unit_id => l_tax_unit_id
6004 , p_action_information_category => 'NL_WR_EMPLOYER_INFO'
6005 , p_action_information1 => csr_employer_info_rec.action_information1
6006 , p_action_information2 => csr_employer_info_rec.action_information2
6007 , p_action_information3 => fnd_date.date_to_canonical(sysdate)
6008 , p_action_information4 => csr_employer_info_rec.action_information4
6009 , p_action_information5 => substr(l_seq_no,1,6)
6010 , p_action_information6 => csr_employer_info_rec.action_information6
6011 , p_action_information7 => csr_employer_info_rec.action_information7
6012 , p_action_information8 => csr_employer_info_rec.action_information8
6013 , p_action_information9 => csr_employer_info_rec.action_information9
6014 , p_action_information10 => fnd_date.date_to_canonical(l_start_date)
6015 , p_action_information11 => fnd_date.date_to_canonical(l_end_date)
6016 , p_action_information12 => csr_employer_info_rec.action_information12);
6017 --
6018 CLOSE csr_employer_info;
6019 --
6020 FOR csr_exception_info_rec IN csr_employer_info('NL_WR_EXCEPTION_REPORT',csr_get_pactid_rec.payroll_action_id) LOOP
6021 pay_action_information_api.create_action_information
6022 (
6023 p_action_information_id => l_action_info_id
6024 , p_action_context_id => p_actid
6025 , p_action_context_type => 'PA'
6026 , p_object_version_number => l_ovn
6027 , p_assignment_id => NULL
6028 , p_effective_date => l_end_date
6029 , p_source_id => NULL
6030 , p_source_text => NULL
6031 , p_tax_unit_id => l_tax_unit_id
6032 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6033 , p_action_information4 => csr_exception_info_rec.action_information4
6034 , p_action_information5 => csr_exception_info_rec.action_information5
6035 , p_action_information6 => csr_exception_info_rec.action_information6
6036 , p_action_information7 => csr_exception_info_rec.action_information7
6037 , p_action_information8 => csr_exception_info_rec.action_information8);
6038 END LOOP;
6039 --
6040 y:= 1;
6041 collXMLTable(y).TagName := 'TotLnLbPh';
6042 collXMLTable(y).Mandatory:= 'Y';
6043 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotLnLbPh'));
6044 collXMLTable(y).Tagvalue := 0;
6045 --
6046 y:= y+1;
6047 collXMLTable(y).TagName := 'TotLnSV';
6048 collXMLTable(y).Mandatory:= 'Y';
6049 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotLnSV'));
6050 collXMLTable(y).Tagvalue := 0;
6051 --
6052 y:= y+1;
6053 collXMLTable(y).TagName := 'PrLnWAOAof';
6054 collXMLTable(y).Mandatory:= 'Y';
6055 IF l_end_date >= to_date('01012007','DDMMYYYY') THEN
6056 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAof'));
6057 ELSE
6058 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAof_2006'));
6059 END IF;
6060 collXMLTable(y).Tagvalue := 0;
6061 --
6062 y:= y+1;
6063 --LC 2012 begin. <PrLnWAOAok> Tag is obsolete and replaced with <TotPrLnWgaWhk>
6064 IF l_end_date < to_date('01012012', 'DDMMYYYY') THEN
6065 collXMLTable(y).TagName := 'PrLnWAOAok';
6066 ELSE
6067 collXMLTable(y).TagName := 'TotPrLnWgaWhk';
6068 END IF;
6069 collXMLTable(y).Mandatory:= 'Y';
6070 IF l_end_date >= to_date('01012012', 'DDMMYYYY') THEN
6071 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotPrLnWgaWhk'));
6072 ELSIF l_end_date >= to_date('01012007','DDMMYYYY') THEN
6073 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok'));
6074 ELSE
6075 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnWAOAok_2006'));
6076 END IF;
6077 --LC 2012 end.
6078 collXMLTable(y).Tagvalue := 0;
6079 --
6080 y:= y+1;
6081 collXMLTable(y).TagName := 'PrLnAWF';
6082 collXMLTable(y).Mandatory:= 'Y';
6083 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnAWF'));
6084 collXMLTable(y).Tagvalue := 0;
6085 --
6086 y:= y+1;
6087 collXMLTable(y).TagName := 'PrLnUFO';
6088 collXMLTable(y).Mandatory:= 'Y';
6089 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrLnUFO'));
6090 collXMLTable(y).Tagvalue := 0;
6091 --
6092 y:= y+1;
6093 collXMLTable(y).TagName := 'TotVergZvw';
6094 collXMLTable(y).Mandatory:= 'Y';
6095 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotVergZvw'));
6096 collXMLTable(y).Tagvalue := 0;
6097 --
6098 y:= y+1;
6099 collXMLTable(y).TagName := 'IngLbPh';
6100 collXMLTable(y).Mandatory:= 'Y';
6101 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('IngLbPh'));
6102 collXMLTable(y).Tagvalue := 0;
6103 --
6104 y:= y+1;
6105 collXMLTable(y).TagName := 'EHPubUitk';
6106 collXMLTable(y).Mandatory:= 'N';
6107 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHPubUitk'));
6108 collXMLTable(y).Tagvalue := 0;
6109 --
6110 y:= y+1;
6111 collXMLTable(y).TagName := 'EHLnBestKar';
6112 collXMLTable(y).Mandatory:= 'N';
6113 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHLnBestKar'));
6114 collXMLTable(y).Tagvalue := 0;
6115 --
6116 y:= y+1;
6117 collXMLTable(y).TagName := 'EHSpLn';
6118 collXMLTable(y).Mandatory:= 'N';
6119 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHSpLn'));
6120 collXMLTable(y).Tagvalue := 0;
6121 --
6122 y:= y+1;
6123 collXMLTable(y).TagName := 'EHSpPr';
6124 collXMLTable(y).Mandatory:= 'N';
6125 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHSpPr'));
6126 collXMLTable(y).Tagvalue := 0;
6127 --
6128 y:= y+1;
6129 collXMLTable(y).TagName := 'EHLnNat';
6130 collXMLTable(y).Mandatory:= 'N';
6131 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHLnNat'));
6132 collXMLTable(y).Tagvalue := 0;
6133 --
6134 y:= y+1;
6135 collXMLTable(y).TagName := 'EHFeest';
6136 collXMLTable(y).Mandatory:= 'N';
6137 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHFeest'));
6138 collXMLTable(y).Tagvalue := 0;
6139 --
6140 y:= y+1;
6141 collXMLTable(y).TagName := 'EHBmVerg';
6142 collXMLTable(y).Mandatory:= 'N';
6143 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHBmVerg'));
6144 collXMLTable(y).Tagvalue := 0;
6145 --
6146 y:= y+1; -- new added
6147 collXMLTable(y).TagName := 'EHGebrAuto';
6148 collXMLTable(y).Mandatory:= 'N';
6149 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHGebrAuto'));
6150 collXMLTable(y).Tagvalue := 0;
6151 --
6152 y:= y+1;
6153 collXMLTable(y).TagName := 'EHVUT';
6154 collXMLTable(y).Mandatory:= 'N';
6155 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('EHVUT'));
6156 collXMLTable(y).Tagvalue := 0;
6157 --
6158 y:= y+1;
6159 collXMLTable(y).TagName := 'AVBetOV';
6160 collXMLTable(y).Mandatory:= 'N';
6161 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVBetOV'));
6162 collXMLTable(y).Tagvalue := 0;
6163 --
6164 y:= y+1;
6165 collXMLTable(y).TagName := 'AVLgdWerkl';
6166 collXMLTable(y).Mandatory:= 'N';
6167 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVLgdWerkl'));
6168 collXMLTable(y).Tagvalue := 0;
6169 --
6170 y:= y+1;
6171 collXMLTable(y).TagName := 'AVArboNP';
6172 collXMLTable(y).Mandatory:= 'N';
6173 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVArboNP'));
6174 collXMLTable(y).Tagvalue := 0;
6175 --
6176 y:= y+1;
6177 collXMLTable(y).TagName := 'AVZeev';
6178 collXMLTable(y).Mandatory:= 'N';
6179 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVZeev'));
6180 collXMLTable(y).Tagvalue := 0;
6181 --
6182 y:= y+1;
6183 collXMLTable(y).TagName := 'AVOnd';
6184 collXMLTable(y).Mandatory:= 'N';
6185 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AVOnd'));
6186 collXMLTable(y).Tagvalue := 0;
6187 --
6188 y:= y+1;
6189 collXMLTable(y).TagName := 'VrlAVSO';
6190 collXMLTable(y).Mandatory:= 'N';
6191 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('VrlAVSO'));
6192 collXMLTable(y).Tagvalue := 0;
6193 --
6194 y:= y+1;
6195 collXMLTable(y).TagName := 'PrWAOAof';
6196 collXMLTable(y).Mandatory:= 'N';
6197 IF l_end_date >= to_date('01012007','DDMMYYYY') THEN
6198 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAof'));
6199 ELSE
6200 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAof_2006'));
6201 END IF;
6202 collXMLTable(y).Tagvalue := 0;
6203 --
6204 y:= y+1;
6205 --LC 2012 begin. <PrWAOAok> Tag is obsolete and replaced with <TotPrWgaWhk>
6206 IF l_end_date < to_date('01012012' ,'DDMMYYYY') THEN
6207 collXMLTable(y).TagName := 'PrWAOAok';
6208 ELSE
6209 collXMLTable(y).TagName := 'TotPrWgaWhk';
6210 END IF;
6211 collXMLTable(y).Mandatory:= 'Y';
6212 IF l_end_date >= to_date('01012012' ,'DDMMYYYY') THEN
6213 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotPrWgaWhk'));
6214 ELSIF l_end_date >= to_date('01012007','DDMMYYYY') THEN
6215 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok'));
6216 ELSE
6217 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrWAOAok_2006'));
6218 END IF;
6219 --LC 2012 end.
6220 collXMLTable(y).Tagvalue := 0;
6221 --
6222 y:= y+1;
6223 collXMLTable(y).TagName := 'PrAWF';
6224 collXMLTable(y).Mandatory:= 'N';
6225 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrAWF'));
6226 collXMLTable(y).Tagvalue := 0;
6227 --
6228 y:= y+1;
6229 collXMLTable(y).TagName := 'PrUFO';
6230 collXMLTable(y).Mandatory:= 'N';
6231 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('PrUFO'));
6232 collXMLTable(y).Tagvalue := 0;
6233 --
6234 y:= y+1;
6235 collXMLTable(y).TagName := 'IngBijdrZvw';
6236 collXMLTable(y).Mandatory:= 'N';
6237 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('IngBijdrZvw'));
6238 collXMLTable(y).Tagvalue := 0;
6239 --
6240 y:= y+1;
6241 collXMLTable(y).TagName := 'AGHKort';
6242 collXMLTable(y).Mandatory:= 'N';
6243 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('AGHKort'));
6244 collXMLTable(y).Tagvalue := 0;
6245 --
6246 y:= y+1;
6247 collXMLTable(y).TagName := 'TotTeBet';
6248 collXMLTable(y).Mandatory:= 'Y';
6249 collXMLTable(y).TagDesc := HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotTeBet'));
6250 collXMLTable(y).Tagvalue := 0;
6251 --
6252 END IF;
6253 --
6254 FOR csr_collective_info_rec IN csr_employer_info('NL_WR_COLLECTIVE_REPORT',csr_get_pactid_rec.payroll_action_id) LOOP
6255 --
6256 IF csr_collective_info_rec.action_information1 = 'COMPLETE' THEN
6257 --
6258 IF csr_collective_info_rec.action_information2 = 'TotLnLbPh' THEN
6259 collXMLTable(1).Tagvalue:= NVL(collXMLTable(1).Tagvalue,0)
6260 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6261 ELSIF csr_collective_info_rec.action_information2 = 'TotLnSV' THEN
6262 collXMLTable(2).Tagvalue:= NVL(collXMLTable(2).Tagvalue,0)
6263 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6264 ELSIF csr_collective_info_rec.action_information2 = 'PrLnWAOAof' THEN
6265 collXMLTable(3).Tagvalue:= NVL(collXMLTable(3).Tagvalue,0)
6266 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6267 --LC 2012 begin. <PrLnWAOAok> Tag is obsolete and replaced with <TotPrLnWgaWhk>
6268 ELSIF csr_collective_info_rec.action_information2 IN ('PrLnWAOAok','TotPrLnWgaWhk') THEN
6269 collXMLTable(4).Tagvalue:= NVL(collXMLTable(4).Tagvalue,0)
6270 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6271 --LC 2012 end
6272 ELSIF csr_collective_info_rec.action_information2 = 'PrLnAWF' THEN
6273 collXMLTable(5).Tagvalue:= NVL(collXMLTable(5).Tagvalue,0)
6274 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6275 ELSIF csr_collective_info_rec.action_information2 = 'PrLnUFO' THEN
6276 collXMLTable(6).Tagvalue:= NVL(collXMLTable(6).Tagvalue,0)
6277 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6278 --LC 2013 begin. <TotVergZvw> Tag is obsolete and replaced with <TotWghZvw>
6279 ELSIF csr_collective_info_rec.action_information2 in ('TotVergZvw','TotWghZvw') THEN
6280 collXMLTable(7).Tagvalue:= NVL(collXMLTable(7).Tagvalue,0)
6281 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6282 --LC 2013 end.
6283 ELSIF csr_collective_info_rec.action_information2 = 'IngLbPh' THEN
6284 collXMLTable(8).Tagvalue:= NVL(collXMLTable(8).Tagvalue,0)
6285 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6286 ELSIF csr_collective_info_rec.action_information2 = 'EHPubUitk' THEN
6287 collXMLTable(9).Tagvalue:= NVL(collXMLTable(9).Tagvalue,0)
6288 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6289 ELSIF csr_collective_info_rec.action_information2 = 'EHLnBestKar' THEN
6290 collXMLTable(10).Tagvalue:= NVL(collXMLTable(10).Tagvalue,0)
6291 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6292 --LC 2012 begin. <EHSpLn> Tag is obsolete
6293 ELSIF l_end_date < to_date('01012012' ,'DDMMYYYY') AND csr_collective_info_rec.action_information2 = 'EHSpLn' THEN
6294 collXMLTable(11).Tagvalue:= NVL(collXMLTable(11).Tagvalue,0)
6295 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6296 --LC 2012 end.
6297 ELSIF csr_collective_info_rec.action_information2 = 'EHSpPr' THEN
6298 collXMLTable(12).Tagvalue:= NVL(collXMLTable(12).Tagvalue,0)
6299 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6300 ELSIF csr_collective_info_rec.action_information2 = 'EHLnNat' THEN
6301 collXMLTable(13).Tagvalue:= NVL(collXMLTable(13).Tagvalue,0)
6302 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6303 ELSIF csr_collective_info_rec.action_information2 = 'EHFeest' THEN
6304 collXMLTable(14).Tagvalue:= NVL(collXMLTable(14).Tagvalue,0)
6305 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6306 ELSIF csr_collective_info_rec.action_information2 = 'EHBmVerg' THEN
6307 collXMLTable(15).Tagvalue:= NVL(collXMLTable(15).Tagvalue,0)
6308 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6309 ELSIF csr_collective_info_rec.action_information2 = 'EHGebrAuto' AND l_end_date >= TO_DATE('01012007','DDMMYYYY') THEN -- EHGebrAuto
6310 collXMLTable(16).Tagvalue:= NVL(collXMLTable(16).Tagvalue,0)
6311 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6312 ELSIF csr_collective_info_rec.action_information2 = 'EHVUT' THEN
6313 collXMLTable(17).Tagvalue:= NVL(collXMLTable(17).Tagvalue,0)
6314 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6315 ELSIF csr_collective_info_rec.action_information2 = 'AVBetOV' AND l_end_date < TO_DATE('01012007','DDMMYYYY') THEN
6316 collXMLTable(18).Tagvalue:= NVL(collXMLTable(18).Tagvalue,0)
6317 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6318 ELSIF csr_collective_info_rec.action_information2 = 'AVLgdWerkl' AND l_end_date < TO_DATE('01012007','DDMMYYYY') THEN
6319 collXMLTable(19).Tagvalue:= NVL(collXMLTable(19).Tagvalue,0)
6320 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6321 ELSIF csr_collective_info_rec.action_information2 = 'AVArboNP' THEN
6322 collXMLTable(20).Tagvalue:= NVL(collXMLTable(20).Tagvalue,0)
6323 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6324 ELSIF csr_collective_info_rec.action_information2 = 'AVZeev' THEN
6325 collXMLTable(21).Tagvalue:= NVL(collXMLTable(21).Tagvalue,0)
6326 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6327 ELSIF csr_collective_info_rec.action_information2 = 'AVOnd' THEN
6328 collXMLTable(22).Tagvalue:= NVL(collXMLTable(22).Tagvalue,0)
6329 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6330 ELSIF csr_collective_info_rec.action_information2 = 'VrlAVSO' THEN
6331 collXMLTable(23).Tagvalue:= NVL(collXMLTable(23).Tagvalue,0)
6332 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6333 ELSIF csr_collective_info_rec.action_information2 = 'PrWAOAof' THEN
6334 collXMLTable(24).Tagvalue:= NVL(collXMLTable(24).Tagvalue,0)
6335 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6336 --LC 2012 begin. <PrWAOAok> Tag is obsolete and replaced with <TotPrWgaWhk>
6337 ELSIF csr_collective_info_rec.action_information2 IN ('PrWAOAok','TotPrWgaWhk') THEN
6338 collXMLTable(25).Tagvalue:= NVL(collXMLTable(25).Tagvalue,0)
6339 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6340 --LC 2012 end.
6341 ELSIF csr_collective_info_rec.action_information2 = 'PrAWF' THEN
6342 collXMLTable(26).Tagvalue:= NVL(collXMLTable(26).Tagvalue,0)
6343 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6344 ELSIF csr_collective_info_rec.action_information2 = 'PrUFO' THEN
6345 collXMLTable(27).Tagvalue:= NVL(collXMLTable(27).Tagvalue,0)
6346 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6347 ELSIF csr_collective_info_rec.action_information2 = 'IngBijdrZvw' THEN
6348 collXMLTable(28).Tagvalue:= NVL(collXMLTable(28).Tagvalue,0)
6349 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6350 ELSIF csr_collective_info_rec.action_information2 = 'AGHKort' THEN
6351 collXMLTable(29).Tagvalue:= NVL(collXMLTable(29).Tagvalue,0)
6352 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6353 ELSIF csr_collective_info_rec.action_information2 = 'TotTeBet' THEN
6354 collXMLTable(30).Tagvalue:= NVL(collXMLTable(30).Tagvalue,0)
6355 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6356 END IF;
6357 --
6358 ELSIF csr_collective_info_rec.action_information1 = 'TOTAL' THEN
6359 l_emp_total := NVL(l_emp_total,0)
6360 + fnd_number.canonical_to_number(csr_collective_info_rec.action_information6);
6361 END IF;
6362 --
6363 END LOOP;
6364 --
6365 --
6366 END LOOP;
6367 --
6368 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
6369 --
6370 l_sector := csr_swmf_info_rec.action_information7;
6371 l_risk_group := csr_swmf_info_rec.action_information8;
6372 l_c_base_mon_fd := csr_swmf_info_rec.action_information9;
6373 l_con_mon_fd := csr_swmf_info_rec.action_information10;
6374 --
6375 pay_action_information_api.create_action_information
6376 (p_action_information_id => l_action_info_id
6377 ,p_action_context_id => p_actid
6378 ,p_action_context_type => 'PA'
6379 ,p_object_version_number => l_ovn
6380 ,p_assignment_id => NULL
6381 ,p_effective_date => l_end_date
6382 ,p_source_id => NULL
6383 ,p_source_text => NULL
6384 ,p_tax_unit_id => l_tax_unit_id
6385 ,p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
6386 ,p_action_information1 => 'SWMF'
6387 ,p_action_information2 => NULL
6388 ,p_action_information5 => fnd_date.date_to_canonical(l_start_date)
6389 ,p_action_information6 => fnd_date.date_to_canonical(l_end_date)
6390 ,p_action_information7 => l_sector
6391 ,p_action_information8 => l_risk_group
6392 ,p_action_information9 => fnd_number.number_to_canonical(ROUND(l_c_base_mon_fd))
6393 ,p_action_information10 => fnd_number.number_to_canonical(ROUND(l_con_mon_fd )));
6394 END LOOP;
6395 --
6396 FOR i IN collXMLTable.FIRST..collXMLTable.LAST LOOP
6397 IF collXMLTable(i).Mandatory = 'Y' or collXMLTable(i).TagValue <> 0 THEN
6398 pay_action_information_api.create_action_information
6399 ( p_action_information_id => l_action_info_id
6400 , p_action_context_id => p_actid
6401 , p_action_context_type => 'PA'
6402 , p_object_version_number => l_ovn
6403 , p_tax_unit_id => l_tax_unit_id
6404 , p_assignment_id => NULL
6405 , p_effective_date => l_end_date
6406 , p_source_id => NULL
6407 , p_source_text => NULL
6408 , p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
6409 , p_action_information1 => 'COMPLETE'
6410 , p_action_information2 => collXMLTable(i).TagName
6411 , p_action_information3 => fnd_date.date_to_canonical(l_start_date)
6412 , p_action_information4 => fnd_date.date_to_canonical(l_end_date)
6413 , p_action_information5 => collXMLTable(i).TagDesc
6414 , p_action_information6 => fnd_number.number_to_canonical(ROUND(collXMLTable(i).TagValue)));
6415 END IF;
6416 END LOOP;
6417 --
6418 pay_action_information_api.create_action_information
6419 (p_action_information_id => l_action_info_id
6420 ,p_action_context_id => p_actid
6421 ,p_action_context_type => 'PA'
6422 ,p_object_version_number => l_ovn
6423 ,p_tax_unit_id => l_tax_unit_id
6424 ,p_assignment_id => NULL
6425 ,p_effective_date => l_end_date
6426 ,p_source_id => NULL
6427 ,p_source_text => NULL
6428 ,p_action_information_category => 'NL_WR_COLLECTIVE_REPORT'
6429 ,p_action_information1 => 'TOTAL'
6430 ,p_action_information2 => 'TotGen' -- TAG NAME
6431 ,p_action_information3 => fnd_date.date_to_canonical(l_start_date)
6432 ,p_action_information4 => fnd_date.date_to_canonical(l_end_date)
6433 ,p_action_information5 => HR_GENERAL.decode_lookup('NL_FORM_LABELS',UPPER('TotGen')) -- TAG DESCRIPTION
6434 ,p_action_information6 => fnd_number.number_to_canonical(ROUND(l_emp_total)));
6435 --
6436 END IF;
6437 --abraghun--7668628--Validation Procedure
6438 --# Validation Procedure - Check and Raise Exceptions--
6439 OPEN csr_nominative_sum(p_actid);
6440 FETCH csr_nominative_sum INTO
6441 l_NR_LnLbPh,
6442 l_NR_LnSV,
6443 l_NR_IngLbPh,
6444 l_NR_PrWAOAof,
6445 l_NR_PrWAOAok,
6446 l_NR_PrAWF,
6447 l_NR_PrWgf,
6448 l_NR_PrUFO,
6449 l_NR_BijdrZvw,
6450 l_NR_VergZvw;
6451 CLOSE csr_nominative_sum;
6452
6453
6454 OPEN csr_swmf_sum(p_actid);
6455 FETCH csr_swmf_sum INTO
6456 -- l_SWMF_Sect_Count,
6457 -- l_SWMF_RisGrp_Count,
6458 -- l_SWMF_PrWgf,
6459 l_SWMF_PrLnWgf;
6460 CLOSE csr_swmf_sum;
6461
6462 /*
6463 16 Dec 2008
6464 The validation for the BSN SOFI number duplication will not be done due to
6465 performance reasons. As the person form itself throws a Warning anyway in
6466 case of duplicate SOFI number.
6467
6468 Hence Check0036, Check0037, Check1036, Check1037 are not performed
6469
6470 --abraghun--7668628-- AAP level Validations --
6471
6472 FOR er_mismatch IN csr_er_mismatch(p_actid,'INITIAL') LOOP
6473 --abraghun--7668628--Check0036
6474 IF(er_mismatch.NumIVSofi>1) THEN
6475 pay_action_information_api.create_action_information
6476 (
6477 p_action_information_id => l_action_info_id
6478 , p_action_context_id => er_mismatch.ER_assactid
6479 , p_action_context_type => 'AAP'
6480 , p_object_version_number => l_ovn
6481 , p_assignment_id => er_mismatch.ER_assignment_id
6482 , p_effective_date => er_mismatch.ER_eff_date
6483 , p_source_id => NULL
6484 , p_source_text => NULL
6485 , p_tax_unit_id => er_mismatch.ER_tax_unit_id
6486 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6487 , p_action_information4 => 'Check0036 failed: Sofi('||er_mismatch.Sofi||') and NumIV('||er_mismatch.NumIV||') combination is not unique'
6488 , p_action_information5 => fnd_date.date_to_canonical(er_mismatch.ER_eff_date)
6489 , p_action_information6 => 'Check0036 failed'
6490 , p_action_information7 => er_mismatch.ER_name
6491 , p_action_information8 => er_mismatch.ER_assignment_number);
6492 END IF;
6493 --abraghun--7668628--Check0037
6494 IF(er_mismatch.NumIVPersNr>1) THEN
6495 pay_action_information_api.create_action_information
6496 (
6497 p_action_information_id => l_action_info_id
6498 , p_action_context_id => er_mismatch.ER_assactid
6499 , p_action_context_type => 'AAP'
6500 , p_object_version_number => l_ovn
6501 , p_assignment_id => er_mismatch.ER_assignment_id
6502 , p_effective_date => er_mismatch.ER_eff_date
6503 , p_source_id => NULL
6504 , p_source_text => NULL
6505 , p_tax_unit_id => er_mismatch.ER_tax_unit_id
6506 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6507 , p_action_information4 => 'Check0037 failed: PersNr('||er_mismatch.PersNr||') and NumIV('||er_mismatch.NumIV||') combination is not unique'
6508 , p_action_information5 => fnd_date.date_to_canonical(er_mismatch.ER_eff_date)
6509 , p_action_information6 => 'Check0037 failed'
6510 , p_action_information7 => er_mismatch.ER_name
6511 , p_action_information8 => er_mismatch.ER_assignment_number);
6512 END IF;
6513 END LOOP;
6514
6515 FOR er_mismatch IN csr_er_mismatch(p_actid,'WITHDRAWAL') LOOP
6516 --abraghun--7668628--Check1036
6517 IF(er_mismatch.NumIVSofi>1) THEN
6518 pay_action_information_api.create_action_information
6519 (
6520 p_action_information_id => l_action_info_id
6521 , p_action_context_id => er_mismatch.ER_assactid
6522 , p_action_context_type => 'AAP'
6523 , p_object_version_number => l_ovn
6524 , p_assignment_id => er_mismatch.ER_assignment_id
6525 , p_effective_date => er_mismatch.ER_eff_date
6526 , p_source_id => NULL
6527 , p_source_text => NULL
6528 , p_tax_unit_id => er_mismatch.ER_tax_unit_id
6529 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6530 , p_action_information4 => 'Check1036 failed: In Withdrawal, Sofi('||er_mismatch.Sofi||') and NumIV('||er_mismatch.NumIV||') combination is not unique'
6531 , p_action_information5 => fnd_date.date_to_canonical(er_mismatch.ER_eff_date)
6532 , p_action_information6 => 'Check1036 failed'
6533 , p_action_information7 => er_mismatch.ER_name
6534 , p_action_information8 => er_mismatch.ER_assignment_number);
6535 END IF;
6536 --abraghun--7668628--Check1037
6537 IF(er_mismatch.NumIVPersNr>1) THEN
6538 pay_action_information_api.create_action_information
6539 (
6540 p_action_information_id => l_action_info_id
6541 , p_action_context_id => er_mismatch.ER_assactid
6542 , p_action_context_type => 'AAP'
6543 , p_object_version_number => l_ovn
6544 , p_assignment_id => er_mismatch.ER_assignment_id
6545 , p_effective_date => er_mismatch.ER_eff_date
6546 , p_source_id => NULL
6547 , p_source_text => NULL
6548 , p_tax_unit_id => er_mismatch.ER_tax_unit_id
6549 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6550 , p_action_information4 => 'Check1037 failed: In Withdrawal, PersNr('||er_mismatch.PersNr||') and NumIV('||er_mismatch.NumIV||') combination is not unique'
6551 , p_action_information5 => fnd_date.date_to_canonical(er_mismatch.ER_eff_date)
6552 , p_action_information6 => 'Check1037 failed'
6553 , p_action_information7 => er_mismatch.ER_name
6554 , p_action_information8 => er_mismatch.ER_assignment_number);
6555 END IF;
6556 END LOOP;
6557 */
6558 --abraghun--7668628-- PA Level Validations--
6559
6560 --abraghun--7668628--Check0001
6561 IF l_CR_TotLnLbPh <> l_NR_LnLbPh THEN
6562 fnd_message.set_name('PER','HR_373533_NL_TOTAL_EQUAL');
6563 fnd_message.set_token('TAG1','TotLnLbPh');
6564 fnd_message.set_token('TAGVAL1',l_CR_TotLnLbPh);
6565 fnd_message.set_token('TAG2','LnLbPh');
6566 fnd_message.set_token('TAGVAL2',l_NR_LnLbPh);
6567
6568 pay_action_information_api.create_action_information
6569 (
6570 p_action_information_id => l_action_info_id
6571 , p_action_context_id => p_actid
6572 , p_action_context_type => 'PA'
6573 , p_object_version_number => l_ovn
6574 , p_assignment_id => NULL
6575 , p_effective_date => l_end_date
6576 , p_source_id => NULL
6577 , p_source_text => NULL
6578 , p_tax_unit_id => l_tax_unit_id
6579 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6580 , p_action_information4 => '0001 - '||fnd_message.get
6581 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6582 , p_action_information6 => '0001 - '||'Tag TotLnLbPh, (Total wage for taxes). The total amount of wages should be the same as the sum of the individual amounts of wage for taxes.'
6583 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6584 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6585 END IF;
6586 --
6587 --abraghun--7668628--Check0002
6588 IF l_CR_TotLnSV <> l_NR_LnSV THEN
6589 fnd_message.set_name('PER','HR_373533_NL_TOTAL_EQUAL');
6590 fnd_message.set_token('TAG1','TotLnSV');
6591 fnd_message.set_token('TAGVAL1',l_CR_TotLnSV);
6592 fnd_message.set_token('TAG2','LnSV');
6593 fnd_message.set_token('TAGVAL2',l_NR_LnSV);
6594
6595 pay_action_information_api.create_action_information
6596 (
6597 p_action_information_id => l_action_info_id
6598 , p_action_context_id => p_actid
6599 , p_action_context_type => 'PA'
6600 , p_object_version_number => l_ovn
6601 , p_assignment_id => NULL
6602 , p_effective_date => l_end_date
6603 , p_source_id => NULL
6604 , p_source_text => NULL
6605 , p_tax_unit_id => l_tax_unit_id
6606 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6607 , p_action_information4 => '0002 - '||fnd_message.get
6608 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6609 , p_action_information6 => '0002 - '||'Tag TotLnSV, (Total SI wage). The total amount of SI wages should be the same as the sum of the individual amounts of SI wages.'
6610 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6611 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6612 END IF;
6613 --
6614 --abraghun--7668628--Check0003
6615 IF l_CR_IngLbPh <> l_NR_IngLbPh THEN
6616 fnd_message.set_name('PER','HR_373533_NL_TOTAL_EQUAL');
6617 fnd_message.set_token('TAG1','IngLbPh');
6618 fnd_message.set_token('TAGVAL1',l_CR_IngLbPh);
6619 fnd_message.set_token('TAG2','IngLbPh');
6620 fnd_message.set_token('TAGVAL2',l_NR_IngLbPh);
6621 pay_action_information_api.create_action_information
6622 (
6623 p_action_information_id => l_action_info_id
6624 , p_action_context_id => p_actid
6625 , p_action_context_type => 'PA'
6626 , p_object_version_number => l_ovn
6627 , p_assignment_id => NULL
6628 , p_effective_date => l_end_date
6629 , p_source_id => NULL
6630 , p_source_text => NULL
6631 , p_tax_unit_id => l_tax_unit_id
6632 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6633 , p_action_information4 => '0003 - '||fnd_message.get
6634 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6635 , p_action_information6 => '0003 - '||'Tag IngLbPh, (Deducted Tax). The total amount of deducted tax should be the same as the sum of the individual amounts of deducted Tax.'
6636 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6637 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6638 END IF;
6639 --
6640 --abraghun--7668628--Check0006
6641 IF l_CR_PrAWF <> l_NR_PrAWF THEN
6642 fnd_message.set_name('PER','HR_373533_NL_TOTAL_EQUAL');
6643 fnd_message.set_token('TAG1','PrAWF');
6644 fnd_message.set_token('TAGVAL1',l_CR_PrAWF);
6645 fnd_message.set_token('TAG2','PrAWF');
6646 fnd_message.set_token('TAGVAL2',l_NR_PrAWF);
6647 pay_action_information_api.create_action_information
6648 (
6649 p_action_information_id => l_action_info_id
6650 , p_action_context_id => p_actid
6651 , p_action_context_type => 'PA'
6652 , p_object_version_number => l_ovn
6653 , p_assignment_id => NULL
6654 , p_effective_date => l_end_date
6655 , p_source_id => NULL
6656 , p_source_text => NULL
6657 , p_tax_unit_id => l_tax_unit_id
6658 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6659 , p_action_information4 => '0006 - '||fnd_message.get
6660 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6661 , p_action_information6 => '0006 - '||'Tag PrAWF, (Total Contribution WeWe (EE+ER)). The total amount of contribution should be the same as the sum of the individual amounts of WeWe contribution employer + employee.'
6662 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6663 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6664 END IF;
6665 --
6666 --abraghun--7668628--Check0008
6667 IF l_CR_PrUFO <> l_NR_PrUFO THEN
6668 fnd_message.set_name('PER','HR_373533_NL_TOTAL_EQUAL');
6669 fnd_message.set_token('TAG1','PrUFO');
6670 fnd_message.set_token('TAGVAL1',l_CR_PrUFO);
6671 fnd_message.set_token('TAG2','PrUFO');
6672 fnd_message.set_token('TAGVAL2',l_NR_PrUFO);
6673 pay_action_information_api.create_action_information
6674 (
6675 p_action_information_id => l_action_info_id
6676 , p_action_context_id => p_actid
6677 , p_action_context_type => 'PA'
6678 , p_object_version_number => l_ovn
6679 , p_assignment_id => NULL
6680 , p_effective_date => l_end_date
6681 , p_source_id => NULL
6682 , p_source_text => NULL
6683 , p_tax_unit_id => l_tax_unit_id
6684 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6685 , p_action_information4 => '0008 - '||fnd_message.get
6686 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6687 , p_action_information6 => '0008 - '||'Tag PrUFO, (Contribution UFO). The total amount of contribution should be the same as the sum of the individual amounts of contribution UFO.'
6688 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6689 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6690 END IF;
6691 --
6692 --abraghun--7668628--Check0009
6693 IF l_CR_TotVergZvw <> l_NR_VergZvw THEN
6694 fnd_message.set_name('PER','HR_373533_NL_TOTAL_EQUAL');
6695 --16506014
6696 IF TO_CHAR(l_end_date,'YYYY')>=2013 THEN
6697 fnd_message.set_token('TAG1','TotWghZvw');
6698 fnd_message.set_token('TAG2','WghZvw');
6699 ELSE
6700 fnd_message.set_token('TAG1','TotVergZvw');
6701 fnd_message.set_token('TAG2','VergZvw');
6702 END IF;
6703 --16506014
6704 fnd_message.set_token('TAGVAL1',l_CR_TotVergZvw);
6705 fnd_message.set_token('TAGVAL2',l_NR_VergZvw);
6706 pay_action_information_api.create_action_information
6707 (
6708 p_action_information_id => l_action_info_id
6709 , p_action_context_id => p_actid
6710 , p_action_context_type => 'PA'
6711 , p_object_version_number => l_ovn
6712 , p_assignment_id => NULL
6713 , p_effective_date => l_end_date
6714 , p_source_id => NULL
6715 , p_source_text => NULL
6716 , p_tax_unit_id => l_tax_unit_id
6717 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6718 , p_action_information4 => '0009 - '||fnd_message.get
6719 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6720 , p_action_information6 => '0009 - '||'Tag TotVergZvw/TotWghZvw, (Total amount Zvw allowance). The total amount of Zvw allowance should be the same as the sum of the individual amounts of Zvw allowance.'
6721 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6722 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6723 END IF;
6724 --
6725 /*
6726 --abraghun--7668628--Check0010
6727 IF l_CR_TotTeBet <> l_CR_TotTeBet_Sum THEN
6728
6729 fnd_message.set_name('PER','HR_373541_NL_TOTTEBET_CHECK');
6730 fnd_message.set_token('TAGVAL1',l_CR_TotTeBet);
6731 fnd_message.set_token('TAGVAL2',l_CR_TotTeBet_Sum);
6732 pay_action_information_api.create_action_information
6733 (
6734 p_action_information_id => l_action_info_id
6735 , p_action_context_id => p_actid
6736 , p_action_context_type => 'PA'
6737 , p_object_version_number => l_ovn
6738 , p_assignment_id => NULL
6739 , p_effective_date => l_end_date
6740 , p_source_id => NULL
6741 , p_source_text => NULL
6742 , p_tax_unit_id => l_tax_unit_id
6743 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6744 , p_action_information4 => '0010 - '||fnd_message.get
6745 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6746 , p_action_information6 => '0010 - '||'Tag TotTeBet, (Total amount to be paid payroll period). The total amount should be the correct sum of the individual total amounts.'
6747 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6748 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6749 END IF;
6750 --
6751 */
6752 /*
6753 --abraghun--7668628--Check0011
6754 IF l_CR_TotGen <>fnd_number.number_to_canonical(
6755 fnd_number.canonical_to_number(l_CR_TotTeBet)+
6756 fnd_number.canonical_to_number(l_CR_Saldo_Sum)) THEN
6757
6758 fnd_message.set_name('PER','HR_373542_NL_TOTGEN_CHECK');
6759 fnd_message.set_token('TAGVAL1',l_CR_TotGen);
6760 fnd_message.set_token('TAGVAL2',l_CR_TotTeBet);
6761 fnd_message.set_token('TAGVAL3',l_CR_Saldo_Sum);
6762
6763 pay_action_information_api.create_action_information
6764 (
6765 p_action_information_id => l_action_info_id
6766 , p_action_context_id => p_actid
6767 , p_action_context_type => 'PA'
6768 , p_object_version_number => l_ovn
6769 , p_assignment_id => NULL
6770 , p_effective_date => l_end_date
6771 , p_source_id => NULL
6772 , p_source_text => NULL
6773 , p_tax_unit_id => l_tax_unit_id
6774 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6775 , p_action_information4 => '0011 - '||fnd_message.get
6776 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6777 , p_action_information6 => '0011 - '||'Tag TotGen, (General Total). The total amount should be the correct sum of the total amounts of the normal period and the correction periods.'
6778 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6779 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6780 END IF;
6781 */
6782 --
6783 --abraghun--7668628--Check0012
6784 IF l_CR_IngBijdrZvw <> l_NR_BijdrZvw THEN
6785 fnd_message.set_name('PER','HR_373533_NL_TOTAL_EQUAL');
6786 fnd_message.set_token('TAG1','IngBijdrZvw');
6787 fnd_message.set_token('TAGVAL1',l_CR_IngBijdrZvw);
6788 fnd_message.set_token('TAG2','BijdrZvw');
6789 fnd_message.set_token('TAGVAL2',l_NR_BijdrZvw);
6790 pay_action_information_api.create_action_information
6791 (
6792 p_action_information_id => l_action_info_id
6793 , p_action_context_id => p_actid
6794 , p_action_context_type => 'PA'
6795 , p_object_version_number => l_ovn
6796 , p_assignment_id => NULL
6797 , p_effective_date => l_end_date
6798 , p_source_id => NULL
6799 , p_source_text => NULL
6800 , p_tax_unit_id => l_tax_unit_id
6801 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6802 , p_action_information4 => '0012 - '||fnd_message.get
6803 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6804 , p_action_information6 => '0012 - '||'Tag IngBijdrZvw, (Total of deducted contribution Zvw). The total amount of contribution Zvw should be the same as the sum of the individual amounts of contribution Zvw.'
6805 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6806 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6807 END IF;
6808 --
6809 --abraghun--7668628--Check0016
6810 IF l_CR_PrWAOAof <> l_NR_PrWAOAof THEN
6811 fnd_message.set_name('PER','HR_373533_NL_TOTAL_EQUAL');
6812 fnd_message.set_token('TAG1','PrWAOAof');
6813 fnd_message.set_token('TAGVAL1',l_CR_PrWAOAof);
6814 fnd_message.set_token('TAG2','PrWAOAof');
6815 fnd_message.set_token('TAGVAL2',l_NR_PrWAOAof);
6816 pay_action_information_api.create_action_information
6817 (
6818 p_action_information_id => l_action_info_id
6819 , p_action_context_id => p_actid
6820 , p_action_context_type => 'PA'
6821 , p_object_version_number => l_ovn
6822 , p_assignment_id => NULL
6823 , p_effective_date => l_end_date
6824 , p_source_id => NULL
6825 , p_source_text => NULL
6826 , p_tax_unit_id => l_tax_unit_id
6827 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6828 , p_action_information4 => '0016 - '||fnd_message.get
6829 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6830 , p_action_information6 => '0016 - '||'Tag PrWAOAof, (Total contribution WAO/WGA/IVA). The total amount of contributions should be the same as the sum of the individual amounts of contribution WAO/WGA/IVA.'
6831 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6832 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6833 END IF;
6834 --
6835 --abraghun--7668628--Check0021
6836 IF l_CR_PrWAOAok <> l_NR_PrWAOAok THEN
6837 fnd_message.set_name('PER','HR_373533_NL_TOTAL_EQUAL');
6838 IF l_end_date >= to_date('01012012' ,'DDMMYYYY') THEN
6839 fnd_message.set_token('TAG1','TotPrLnWgaWhk'); --LC 2012, local variables retained
6840 ELSE
6841 fnd_message.set_token('TAG1','PrWAOAok');
6842 END IF;
6843 fnd_message.set_token('TAGVAL1',l_CR_PrWAOAok);
6844 IF l_end_date >= to_date('01012012' ,'DDMMYYYY') THEN
6845 fnd_message.set_token('TAG2','PrWgaWhk'); --LC 2012, local variables retained
6846 ELSE
6847 fnd_message.set_token('TAG2','PrWAOAok');
6848 END IF;
6849 fnd_message.set_token('TAGVAL2',l_NR_PrWAOAok);
6850 pay_action_information_api.create_action_information
6851 (
6852 p_action_information_id => l_action_info_id
6853 , p_action_context_id => p_actid
6854 , p_action_context_type => 'PA'
6855 , p_object_version_number => l_ovn
6856 , p_assignment_id => NULL
6857 , p_effective_date => l_end_date
6858 , p_source_id => NULL
6859 , p_source_text => NULL
6860 , p_tax_unit_id => l_tax_unit_id
6861 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6862 , p_action_information4 => '0021 - '||fnd_message.get
6863 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6864 , p_action_information6 => '0021 - '||'Tag PrWAOAok, (Total contribution general WAO/WGA Differentiated). The total amount of contributions should be the same as the sum of the individual amounts of WAO/WGA Differentiated.'
6865 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6866 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6867 END IF;
6868 --
6869 --abraghun--7668628--Check0018
6870 IF l_CR_PrWgf <> l_NR_PrWgf THEN
6871 fnd_message.set_name('PER','HR_373533_NL_TOTAL_EQUAL');
6872 fnd_message.set_token('TAG1','PrWgf');
6873 fnd_message.set_token('TAGVAL1',l_CR_PrWgf);
6874 fnd_message.set_token('TAG2','PrWgf');
6875 fnd_message.set_token('TAGVAL2',l_NR_PrWgf);
6876 pay_action_information_api.create_action_information
6877 (
6878 p_action_information_id => l_action_info_id
6879 , p_action_context_id => p_actid
6880 , p_action_context_type => 'PA'
6881 , p_object_version_number => l_ovn
6882 , p_assignment_id => NULL
6883 , p_effective_date => l_end_date
6884 , p_source_id => NULL
6885 , p_source_text => NULL
6886 , p_tax_unit_id => l_tax_unit_id
6887 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6888 , p_action_information4 => '0018 - '||fnd_message.get
6889 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6890 , p_action_information6 => '0018 - '||'Tag PrWgf, (Total contribution waiting money fund). The total amount of contribution should be the same as the sum of the individual amounts of contribution waiting money fund.'
6891 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6892 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6893 END IF;
6894 --
6895 --
6896 --abraghun--7668628--Check0022
6897 FOR overlap IN csr_period_overlap(p_actid) LOOP
6898 fnd_message.set_name('PER','HR_373540_NL_PERIOD_OVERLAP');
6899 fnd_message.set_token('TAGVAL1',overlap.start_date);
6900 fnd_message.set_token('TAGVAL2',overlap.end_date);
6901 pay_action_information_api.create_action_information
6902 (
6903 p_action_information_id => l_action_info_id
6904 , p_action_context_id => p_actid
6905 , p_action_context_type => 'PA'
6906 , p_object_version_number => l_ovn
6907 , p_assignment_id => NULL
6908 , p_effective_date => l_end_date
6909 , p_source_id => NULL
6910 , p_source_text => NULL
6911 , p_tax_unit_id => l_tax_unit_id
6912 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6913 , p_action_information4 => '0022 - '||fnd_message.get
6914 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6915 , p_action_information6 => '0022 - '||'The start and end dates of the correction period cannot be the same as the start and end dates of the normal period.'
6916 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6917 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6918 END LOOP;
6919 --
6920 --abraghun--7668628--Check0025
6921 IF l_CR_PrLnWAOAof > l_CR_PrLnWAOAok THEN
6922 fnd_message.set_name('PER','HR_373536_NL_TOTAL_LTEQ');
6923 fnd_message.set_token('TAG1','PrLnWAOAof');
6924 fnd_message.set_token('TAGVAL1',l_CR_PrLnWAOAof);
6925 IF l_end_date >= to_date('01012012' ,'DDMMYYYY') THEN
6926 fnd_message.set_token('TAG2','TotPrLnWgaWhk'); --LC 2012, local variables retained
6927 ELSE
6928 fnd_message.set_token('TAG2','PrLnWAOAok');
6929 END IF;
6930 fnd_message.set_token('TAGVAL2',l_CR_PrLnWAOAok);
6931 pay_action_information_api.create_action_information
6932 (
6933 p_action_information_id => l_action_info_id
6934 , p_action_context_id => p_actid
6935 , p_action_context_type => 'PA'
6936 , p_object_version_number => l_ovn
6937 , p_assignment_id => NULL
6938 , p_effective_date => l_end_date
6939 , p_source_id => NULL
6940 , p_source_text => NULL
6941 , p_tax_unit_id => l_tax_unit_id
6942 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6943 , p_action_information4 => '0025 - '||fnd_message.get
6944 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6945 , p_action_information6 => '0025 - '||'The total amount of "Contribution base WAO/IVA/WGA" (Tag PrLnWAOAof) has to be equal to or less than the total amount of "Contribution base general WAO/WGA Differentiated" (Tag PrLnWAOAok).'
6946 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6947 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6948 END IF;
6949 --
6950
6951 --abraghun--7668628--Check0029
6952 IF l_CR_PrLnAWF > l_SWMF_PrLnWgf THEN
6953 fnd_message.set_name('PER','HR_373536_NL_TOTAL_LTEQ');
6954 fnd_message.set_token('TAG1','PrLnAWF');
6955 fnd_message.set_token('TAGVAL1',l_CR_PrLnAWF );
6956 fnd_message.set_token('TAG2','PrLnWgf');
6957 fnd_message.set_token('TAGVAL2',l_SWMF_PrLnWgf);
6958 pay_action_information_api.create_action_information
6959 (
6960 p_action_information_id => l_action_info_id
6961 , p_action_context_id => p_actid
6962 , p_action_context_type => 'PA'
6963 , p_object_version_number => l_ovn
6964 , p_assignment_id => NULL
6965 , p_effective_date => l_end_date
6966 , p_source_id => NULL
6967 , p_source_text => NULL
6968 , p_tax_unit_id => l_tax_unit_id
6969 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6970 , p_action_information4 => '0029 - '||fnd_message.get
6971 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6972 , p_action_information6 => '0029 - '||'The total amount of "Contribution base WeWe (AWF)" (Tag PrLnAWF) has to be equal to or less than the sum of the total amounts of "Contribution base Waiting money fund" (Tag PrLnWgf).'
6973 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
6974 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
6975 END IF;
6976 --
6977
6978 --abraghun--7668628--Check0026
6979 IF l_CR_PrWAOAof> 0 AND l_CR_PrLnWAOAof= 0 THEN
6980 fnd_message.set_name('PER','HR_373534_NL_TOTAL_GT_ZERO');
6981 fnd_message.set_token('TAG1','PrWAOAof');
6982 fnd_message.set_token('TAGVAL1',l_CR_PrWAOAof);
6983 fnd_message.set_token('TAG2','PrLnWAOAof');
6984
6985 pay_action_information_api.create_action_information
6986 (
6987 p_action_information_id => l_action_info_id
6988 , p_action_context_id => p_actid
6989 , p_action_context_type => 'PA'
6990 , p_object_version_number => l_ovn
6991 , p_assignment_id => NULL
6992 , p_effective_date => l_end_date
6993 , p_source_id => NULL
6994 , p_source_text => NULL
6995 , p_tax_unit_id => l_tax_unit_id
6996 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
6997 , p_action_information4 => '0026 - '||fnd_message.get
6998 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
6999 , p_action_information6 => '0026 - '||'When the amount of "Total contribution WAO/WGA/IVA" (Tag PrWAOAof) is greater than zero, the amount of "Contribution base WAO/IVA/WGA" (Tag PrLnWAOAof) cannot be equal to zero.'
7000 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
7001 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
7002 END IF;
7003 --
7004 --abraghun--7668628--Check0028
7005 IF l_CR_PrWAOAok > 0 AND l_CR_PrLnWAOAok = 0 THEN
7006 fnd_message.set_name('PER','HR_373534_NL_TOTAL_GT_ZERO');
7007 IF l_end_date >= to_date('01012012' ,'DDMMYYYY') THEN
7008 fnd_message.set_token('TAG1','TotPrWgaWhk'); --LC 2012, local variables retained
7009 ELSE
7010 fnd_message.set_token('TAG1','PrWAOAok');
7011 END IF;
7012 fnd_message.set_token('TAGVAL1',l_CR_PrWAOAok);
7013 IF l_end_date >= to_date('01012012' ,'DDMMYYYY') THEN
7014 fnd_message.set_token('TAG2','TotPrLnWgaWhk'); --LC 2012, local variables retained
7015 ELSE
7016 fnd_message.set_token('TAG2','PrLnWAOAok');
7017 END IF;
7018 pay_action_information_api.create_action_information
7019 (
7020 p_action_information_id => l_action_info_id
7021 , p_action_context_id => p_actid
7022 , p_action_context_type => 'PA'
7023 , p_object_version_number => l_ovn
7024 , p_assignment_id => NULL
7025 , p_effective_date => l_end_date
7026 , p_source_id => NULL
7027 , p_source_text => NULL
7028 , p_tax_unit_id => l_tax_unit_id
7029 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7030 , p_action_information4 => '0028 - '||fnd_message.get
7031 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
7032 , p_action_information6 => '0028 - '||'When the amount of "Total contribution general WAO/WGA Differentiated" (Tag PrWAOAok) is greater than zero,'||
7033 ' the amount of "Contribution base general WAO/WGA Differentiated" (Tag PrLnWAOAok) cannot be equal to zero.'
7034 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
7035 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
7036 END IF;
7037 --
7038 --abraghun--7668628--Check0030
7039 IF l_CR_PrAWF > 0 AND l_CR_PrLnAWF = 0 THEN
7040 fnd_message.set_name('PER','HR_373534_NL_TOTAL_GT_ZERO');
7041 fnd_message.set_token('TAG1','PrAWF');
7042 fnd_message.set_token('TAGVAL1',l_CR_PrAWF);
7043 fnd_message.set_token('TAG2','PrLnAWF');
7044 pay_action_information_api.create_action_information
7045 (
7046 p_action_information_id => l_action_info_id
7047 , p_action_context_id => p_actid
7048 , p_action_context_type => 'PA'
7049 , p_object_version_number => l_ovn
7050 , p_assignment_id => NULL
7051 , p_effective_date => l_end_date
7052 , p_source_id => NULL
7053 , p_source_text => NULL
7054 , p_tax_unit_id => l_tax_unit_id
7055 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7056 , p_action_information4 => '0030 - '||fnd_message.get
7057 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
7058 , p_action_information6 => '0030 - '||'When the amount of "Total Contribution WeWe (AWF)" (Tag PrAWF) is greater than zero, the amount of "Contribution base WeWe (AWF)" (Tag PrLnAWF) cannot be equal to zero.'
7059 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
7060 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
7061 END IF;
7062 --
7063 --abraghun--7668628--Check0031
7064 IF l_CR_PrUFO > 0 AND l_CR_PrLnUFO = 0 THEN
7065 fnd_message.set_name('PER','HR_373534_NL_TOTAL_GT_ZERO');
7066 fnd_message.set_token('TAG1','PrUFO');
7067 fnd_message.set_token('TAGVAL1',l_CR_PrUFO);
7068 fnd_message.set_token('TAG2','PrLnUFO');
7069 pay_action_information_api.create_action_information
7070 (
7071 p_action_information_id => l_action_info_id
7072 , p_action_context_id => p_actid
7073 , p_action_context_type => 'PA'
7074 , p_object_version_number => l_ovn
7075 , p_assignment_id => NULL
7076 , p_effective_date => l_end_date
7077 , p_source_id => NULL
7078 , p_source_text => NULL
7079 , p_tax_unit_id => l_tax_unit_id
7080 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7081 , p_action_information4 => '0031 - '||fnd_message.get
7082 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
7083 , p_action_information6 => '0031 - '||'When the amount of "Total contribution UFO" (Tag PrUFO) is greater than zero, the amount of "Contribution base UFO" (Tag PrLnUFO) cannot be equal to zero.'
7084 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
7085 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
7086 END IF;
7087 --
7088 --abraghun--7668628--Check0035
7089 IF l_CR_PrWgf >0 AND l_SWMF_PrLnWgf=0 THEN
7090 fnd_message.set_name('PER','HR_373534_NL_TOTAL_GT_ZERO');
7091 fnd_message.set_token('TAG1','PrWgf');
7092 fnd_message.set_token('TAGVAL1',l_CR_PrWgf);
7093 fnd_message.set_token('TAG2','PrLnWgf');
7094 pay_action_information_api.create_action_information
7095 (
7096 p_action_information_id => l_action_info_id
7097 , p_action_context_id => p_actid
7098 , p_action_context_type => 'PA'
7099 , p_object_version_number => l_ovn
7100 , p_assignment_id => NULL
7101 , p_effective_date => l_end_date
7102 , p_source_id => NULL
7103 , p_source_text => NULL
7104 , p_tax_unit_id => l_tax_unit_id
7105 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7106 , p_action_information4 => '0035 - '||fnd_message.get
7107 , p_action_information5 => fnd_date.date_to_canonical(l_end_date)
7108 , p_action_information6 => '0035 - '||'When the amount of "Total contribution waiting money fund" (Tag PrWgf) is greater than zero, the amount of "Contribution base Waiting money fund" (Tag PrLnWgf) cannot be equal to zero.'
7109 , p_action_information7 => substr(l_tax_details.tax_rep_name,1,200)
7110 , p_action_information8 => substr(l_tax_details.tax_reg_num,1,12));
7111 END IF;
7112 --
7113
7114 --abraghun--7668628-- Validation Procedure - Check and Raise Exceptions Ends--
7115
7116 --# Exception Report
7117 FND_FILE.PUT_LINE(fnd_file.output,rpad('-',80,'-') || rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_EXCEPTION_REPORT'),20,' ') || rpad('-',80,'-'));
7118 FND_FILE.PUT_LINE(fnd_file.output,rpad(' ',180,' '));
7119 --
7120 FOR csr_excpetion_rec IN csr_get_PA_exception_info(p_actid) LOOP
7121 --
7122 l_exception_flag := 'Y' ;
7123 --
7124 IF empr_flag = 'N' THEN
7125 --
7126 FND_FILE.PUT_LINE(fnd_file.output,rpad('-',180,'-'));
7127 FND_FILE.PUT_LINE(fnd_file.output,rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_EMPLOYER_NAME'),32,' ') ||
7128 rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_EXCEPTION'),148,' '));
7129 FND_FILE.PUT_LINE(fnd_file.output,rpad('-',180,'-'));
7130 empr_flag :='Y';
7131 END IF;
7132 --
7133 FND_FILE.PUT_LINE(fnd_file.output,rpad(csr_excpetion_rec.E_Name,32,' ') || csr_excpetion_rec.Message);
7134 --
7135 END LOOP;
7136 --
7137 FOR csr_excpetion_rec IN csr_get_AAP_exception_info(p_actid) LOOP
7138 --
7139 l_exception_flag := 'Y' ;
7140 --
7141 IF empe_flag = 'N' THEN
7142 --
7143 FND_FILE.PUT_LINE(fnd_file.output,rpad('-',180,'-'));
7144 FND_FILE.PUT_LINE(fnd_file.output,rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_ASSIGNMENT_NUMBER'),22,' ') ||
7145 rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_NAME'),32,' ') ||
7146 rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_DATE'),13,' ') ||
7147 rpad(hr_general.decode_lookup('NL_FORM_LABELS','WR_EXCEPTION'),113,' '));
7148 FND_FILE.PUT_LINE(fnd_file.output,rpad('-',180,'-'));
7149 empe_flag := 'Y';
7150 END IF;
7151 --
7152 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);
7153 --
7154 END LOOP;
7155 --
7156 IF l_exception_flag = 'N' THEN
7157 FND_FILE.PUT_LINE(fnd_file.output , hr_general.decode_lookup('NL_FORM_LABELS','WR_NO_VALIDATION_ERRORS'));
7158 END IF;
7159 --Fnd_file.put_line(FND_FILE.LOG,' Leaving Deinit Code');
7160 --#
7161 EXCEPTION
7162 WHEN OTHERS THEN
7163 -- Return cursor that selects no rows
7164 -- Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
7165 hr_utility.set_location(sqlerrm(sqlcode),110);
7166 END archive_deinit_code;
7167 --------------------------------------------------------------------------------
7168 -- ACTION_CREATION_CODE
7169 --------------------------------------------------------------------------------
7170 PROCEDURE archive_action_creation (p_actid IN NUMBER
7171 ,stperson IN NUMBER
7172 ,endperson IN NUMBER
7173 ,chunk IN NUMBER) IS
7174 --
7175 CURSOR csr_assignments(stperson NUMBER
7176 ,endperson NUMBER
7177 ,c_start_date DATE
7178 ,c_end_date DATE
7179 ,c_business_group_id NUMBER
7180 ,c_payroll_type VARCHAR2
7181 ,c_tax_unit_id NUMBER
7182 ,c_paid_flag VARCHAR2) IS
7183 SELECT asl.assignment_id assignment_id
7184 ,paa.assignment_action_id assignment_action_id
7185 FROM per_all_assignments_f asl
7186 ,pay_all_payrolls_f ppf
7187 ,pay_payroll_actions ppa
7188 ,pay_assignment_actions paa
7189 ,per_time_periods ptp
7190 WHERE asl.person_id BETWEEN stperson AND endperson and
7191 ppf.payroll_id = asl.payroll_id
7192 AND ((ppf.period_type = 'Calendar Month'
7193 AND c_payroll_type = 'MONTH') OR
7194 (ppf.period_type = 'Week' AND c_payroll_type = 'WEEK')OR
7195 (ppf.period_type = 'Lunar Month' AND c_payroll_type = 'LMONTH'))
7196 AND ppf.payroll_id = ppa.payroll_id
7197 AND ppa.action_type in ('R','Q')
7198 AND ppa.action_status = 'C'
7199 AND paa.source_action_id IS NULL
7200 AND paa.tax_unit_id = c_tax_unit_id
7201 AND ppa.time_period_id = ptp.time_period_id
7202 AND c_end_date BETWEEN ptp.start_date
7203 AND ptp.end_date
7204 AND ppa.payroll_action_id = paa.payroll_action_id
7205 AND paa.assignment_id = asl.assignment_id
7206 AND asl.effective_start_date <= c_end_date
7207 AND asl.effective_end_date >= c_start_date
7208 AND c_end_date BETWEEN ppf.effective_start_date
7209 AND ppf.effective_end_date
7210 AND asl.business_group_id = ppa.business_group_id
7211 AND ppa.business_group_id = c_business_group_id
7212 AND (EXISTS (SELECT 1
7213 FROM pay_assignment_actions paa1
7214 ,pay_run_results prr
7215 WHERE paa1.source_action_id = paa.assignment_action_id
7216 AND prr.assignment_action_id = paa1.assignment_action_id))
7217 UNION
7218 SELECT asl.assignment_id assignment_id
7219 ,NULL assignment_action_id
7220 FROM per_all_assignments_f asl
7221 ,pay_all_payrolls_f ppf
7222 WHERE asl.person_id BETWEEN stperson AND endperson
7223 AND c_paid_flag = 'N'
7224 AND ppf.payroll_id = asl.payroll_id
7225 AND asl.assignment_type = 'E'
7226 AND asl.business_group_id = c_business_group_id
7227 AND ((ppf.period_type = 'Calendar Month'--,'Lunar Month')
7228 AND c_payroll_type = 'MONTH') OR
7229 (ppf.period_type = 'Week' AND c_payroll_type = 'WEEK')OR
7230 (ppf.period_type = 'Lunar Month' AND c_payroll_type = 'LMONTH'))
7231 AND asl.effective_start_date <= c_end_date
7232 AND asl.effective_end_date >= c_start_date
7233 AND c_end_date BETWEEN ppf.effective_start_date
7234 AND ppf.effective_end_date
7235 AND ppf.prl_information_category = 'NL'
7236 AND ((asl.establishment_id = c_tax_unit_id ) OR
7237 (asl.establishment_id IS NULL AND ppf.PRL_INFORMATION1 = c_tax_unit_id))
7238 ORDER BY 1;
7239 --
7240 CURSOR csr_le_hr_mapping_chk (p_organization_id NUMBER) IS
7241 SELECT hoi.org_information2 org_id
7242 ,hoi.org_information4 paid_flag
7243 FROM hr_organization_information hoi
7244 WHERE hoi.org_information_context = 'NL_LE_TAX_DETAILS'
7245 AND hoi.organization_id = p_organization_id
7246 AND EXISTS (SELECT 1
7247 FROM hr_organization_information hoi1
7248 WHERE hoi1.org_information1 = 'HR_LEGAL_EMPLOYER'
7249 AND hoi1.org_information_context = 'CLASS'
7250 AND hoi1.organization_id = hoi.organization_id);
7251 --
7252 CURSOR csr_get_empr_contact(c_employer_id NUMBER
7253 ,c_business_group_id NUMBER) IS
7254 SELECT hoi.org_information4 paid_flag
7255 FROM hr_organization_units hou,hr_organization_information hoi
7256 WHERE hoi.org_information_context = 'NL_ORG_WR_INFO'
7257 AND hou.business_group_id = c_business_group_id
7258 AND hou.organization_id = hoi.organization_id
7259 AND hou.organization_id = c_employer_id;
7260 --
7261 l_actid NUMBER;
7262 l_legal_employer hr_all_organization_units.organization_id%type;
7263 l_start_date DATE;
7264 l_end_date DATE;
7265 l_business_group_id NUMBER;
7266 l_chk_assignment_id NUMBER;
7267 l_payroll_type VARCHAR2(10);
7268 l_seq_no VARCHAR2(15);
7269 l_paid_flag VARCHAR2(15);
7270 l_hr_tax_unit hr_all_organization_units.organization_id%TYPE;
7271 --
7272 CURSOR csr_persons(stperson NUMBER
7273 ,endperson NUMBER
7274 ,c_start_date DATE
7275 ,c_end_date DATE
7276 ,c_business_group_id NUMBER
7277 ,c_payroll_type VARCHAR2
7278 ,c_tax_unit_id NUMBER) IS
7279 SELECT MAX(paa.assignment_action_id) assignment_action_id
7280 ,paa.assignment_id
7281 ,paaf.person_id
7282 ,ppa1.effective_date
7283 ,paaf.primary_flag
7284 FROM pay_payroll_actions ppa
7285 ,pay_payroll_actions ppa1
7286 ,pay_assignment_actions paa
7287 ,per_all_assignments_f paaf
7288 WHERE ppa.report_type = 'NL_WAGES_REP_LOCK'
7289 AND ppa.report_qualifier = 'NL'
7290 AND ppa.action_type = 'X'
7291 AND ppa.action_status = 'C'
7292 AND ppa1.report_type = 'NL_WAGES_REP_ARCHIVE'
7293 AND ppa1.report_qualifier = 'NL'
7294 AND ppa1.action_type = 'X'
7295 AND ppa1.action_status = 'C'
7296 AND INSTR(ppa.legislative_parameters,'REQUEST_ID='||ppa1.payroll_action_id ) <> 0
7297 AND INSTR(ppa1.legislative_parameters,'Payroll_Type=WEEK') <> 0
7298 AND ppa1.effective_date BETWEEN c_start_date
7299 AND c_end_date
7300 AND ppa1.payroll_action_id = paa.payroll_action_id
7301 AND paa.assignment_id = paaf.assignment_id
7302 AND paa.tax_unit_id = c_tax_unit_id
7303 AND paaf.person_id BETWEEN stperson
7304 AND endperson
7305 AND paaf.effective_start_date <= ppa1.effective_date
7306 AND paaf.effective_end_date >= ppa1.start_date
7307 AND paaf.business_group_id = c_business_group_id
7308 AND paaf.business_group_id = ppa.business_group_id
7309 AND ppa1.business_group_id = ppa.business_group_id
7310 GROUP BY paa.assignment_id
7311 ,paaf.person_id
7312 ,ppa1.effective_date
7313 ,paaf.primary_flag
7314 ORDER BY paaf.person_id
7315 ,paaf.primary_flag DESC
7316 ,ppa1.effective_date DESC;
7317 ---for yearly report
7318 CURSOR csr_assignments_yearly(stperson NUMBER
7319 ,endperson NUMBER
7320 ,c_start_date DATE
7321 ,c_end_date DATE
7322 ,c_business_group_id NUMBER
7323 ,c_payroll_type VARCHAR2
7324 ,c_tax_unit_id NUMBER
7325 ,c_paid_flag VARCHAR2) IS
7326 SELECT DISTINCT asl.assignment_id assignment_id
7327 ,paa.assignment_action_id assignment_action_id
7328 FROM per_all_assignments_f asl
7329 ,pay_payroll_actions ppa
7330 ,pay_assignment_actions paa
7331 ,per_time_periods ptp
7332 WHERE asl.person_id BETWEEN stperson AND endperson and
7333 ppa.payroll_id = asl.payroll_id
7334 AND ppa.action_type in ('R','Q')
7335 AND ppa.action_status = 'C'
7336 AND paa.source_action_id IS NULL
7337 AND paa.tax_unit_id = c_tax_unit_id
7338 AND ppa.time_period_id = ptp.time_period_id
7339 AND to_char(ptp.end_date,'RRRR') = to_char(c_start_date,'RRRR')
7340 AND ppa.payroll_action_id = paa.payroll_action_id
7341 AND paa.assignment_id = asl.assignment_id
7342 AND asl.effective_start_date <= c_end_date
7343 AND asl.effective_end_date >= c_start_date
7344 AND asl.business_group_id = ppa.business_group_id
7345 AND ppa.business_group_id = c_business_group_id
7346 AND (EXISTS (SELECT 1
7347 FROM pay_assignment_actions paa1
7348 ,pay_run_results prr
7349 WHERE paa1.source_action_id = paa.assignment_action_id
7350 AND prr.assignment_action_id = paa1.assignment_action_id))
7351 UNION
7352 SELECT asl.assignment_id assignment_id
7353 ,NULL assignment_action_id
7354 FROM per_all_assignments_f asl
7355 ,pay_all_payrolls_f ppf
7356 WHERE asl.person_id BETWEEN stperson AND endperson
7357 AND c_paid_flag = 'N'
7358 AND ppf.payroll_id = asl.payroll_id
7359 AND asl.assignment_type = 'E'
7360 AND asl.business_group_id = c_business_group_id
7361 AND asl.effective_start_date <= c_end_date
7362 AND asl.effective_end_date >= c_start_date
7363 AND ppf.effective_end_date >= c_start_date
7364 AND ppf.prl_information_category = 'NL'
7365 AND ((asl.establishment_id = c_tax_unit_id ) OR
7366 (asl.establishment_id IS NULL AND ppf.PRL_INFORMATION1 = c_tax_unit_id))
7367 ORDER BY 1,2 desc;
7368 --
7369 l_chk_person_id NUMBER;
7370 --
7371 --10100628
7372 CURSOR cur_valid_assign
7373 (stperson NUMBER
7374 ,endperson NUMBER
7375 ,c_start_date DATE
7376 ,c_end_date DATE
7377 ,c_business_group_id NUMBER
7378 ,c_payroll_type VARCHAR2
7379 ,c_tax_unit_id NUMBER
7380 ,c_paid_flag VARCHAR2
7381 ,p_prev_corr_year VARCHAR2)
7382 IS
7383 SELECT asl.assignment_id assignment_id
7384 ,paa.assignment_action_id assignment_action_id
7385 FROM per_all_assignments_f asl
7386 ,pay_all_payrolls_f ppf
7387 ,pay_payroll_actions ppa
7388 ,pay_assignment_actions paa
7389 ,per_time_periods ptp
7390 WHERE asl.person_id between stperson AND endperson and
7391 ppf.payroll_id = asl.payroll_id
7392 AND ((ppf.period_type = 'Calendar Month'
7393 AND c_payroll_type = 'MONTH') OR
7394 (ppf.period_type = 'Week' AND c_payroll_type = 'WEEK')OR
7395 (ppf.period_type = 'Lunar Month' AND c_payroll_type = 'LMONTH'))
7396 AND ppf.payroll_id = ppa.payroll_id
7397 AND ppa.action_type in ('R','Q')
7398 AND ppa.action_status = 'C'
7399 AND paa.source_action_id IS NULL
7400 AND paa.tax_unit_id = c_tax_unit_id
7401 AND ppa.time_period_id = ptp.time_period_id
7402 AND (ptp.start_date BETWEEN c_start_date AND c_end_date
7403 OR
7404 ptp.end_date BETWEEN c_start_date AND c_end_date
7405 )
7406 AND ppa.payroll_action_id = paa.payroll_action_id
7407 AND paa.assignment_id = asl.assignment_id
7408 AND asl.effective_start_date <= c_end_date
7409 AND asl.effective_end_date >= c_start_date
7410 AND c_end_date BETWEEN ppf.effective_start_date
7411 AND ppf.effective_end_date
7412 AND asl.business_group_id = ppa.business_group_id
7413 AND ppa.business_group_id = c_business_group_id
7414 AND (EXISTS (SELECT 1
7415 FROM pay_assignment_actions paa1
7416 ,pay_run_results prr
7417 WHERE paa1.source_action_id = paa.assignment_action_id
7418 AND prr.assignment_action_id = paa1.assignment_action_id))
7419 AND EXISTS
7420 --10100628
7421 (
7422 SELECT 1
7423 FROM per_assignment_extra_info
7424 WHERE assignment_id = asl.assignment_id
7425 AND aei_information_category = 'NL_WR_PREV_CORR'
7426 AND ptp.start_date BETWEEN fnd_date.canonical_to_date(aei_information1)
7427 AND nvl(fnd_date.canonical_to_date(aei_information2),to_date('31-12-4712','dd-mm-yyyy'))
7428 )
7429 --10100628
7430 /* ( SELECT 1
7431 FROM pay_run_results rr1 -- Retro element
7432 ,pay_element_span_usages esu
7433 ,pay_retro_component_usages rcu
7434 ,pay_retro_components rc
7435 ,pay_element_entries_f pee1
7436 ,pay_assignment_actions paa1
7437 ,pay_payroll_actions ppa1
7438 ,per_time_periods ptp
7439 WHERE paa1.source_action_id = paa.assignment_action_id
7440 --AND paa1.assignment_action_id = paa.assignment_action_id
7441 AND rr1.assignment_action_id = paa1.assignment_action_id
7442 AND rr1.element_entry_id = pee1.element_entry_id
7443 AND pee1.creator_type = 'RR'
7444 AND rr1.element_type_id = esu.retro_element_type_id
7445 AND esu.retro_component_usage_id = rcu.retro_component_usage_id
7446 AND rcu.creator_type = 'ET' -- check
7447 AND rcu.retro_component_id = rc.retro_component_id
7448 AND rc.legislation_code = 'NL'
7449 AND rc.short_name = 'Standard'
7450 AND ppa.effective_date between pee1.effective_start_date and pee1.effective_end_date
7451 AND paa1.payroll_action_id = ppa1.payroll_action_id
7452 AND ptp.payroll_id = ppa1.payroll_id
7453 AND rr1.start_date BETWEEN ptp.start_date and ptp.end_date
7454 AND to_char(ptp.end_date,'RRRR') = p_prev_corr_year
7455 ) */ --10100628
7456 UNION
7457 SELECT asl.assignment_id assignment_id
7458 ,NULL assignment_action_id
7459 FROM per_all_assignments_f asl
7460 ,pay_all_payrolls_f ppf
7461 WHERE asl.person_id BETWEEN stperson AND endperson
7462 AND c_paid_flag = 'N'
7463 AND ppf.payroll_id = asl.payroll_id
7464 AND asl.assignment_type = 'E'
7465 AND asl.business_group_id = c_business_group_id
7466 AND ppf.period_type = 'Calendar Month'
7467 AND asl.effective_start_date <= c_end_date
7468 AND asl.effective_end_date >= c_start_date
7469 AND c_end_date BETWEEN ppf.effective_start_date
7470 AND ppf.effective_end_date
7471 AND ppf.prl_information_category = 'NL'
7472 AND ((asl.establishment_id = c_tax_unit_id ) OR
7473 (asl.establishment_id IS NULL AND ppf.PRL_INFORMATION1 = c_tax_unit_id))
7474 ORDER BY 1,2 DESC NULLS LAST; --10100628
7475 --10100628
7476
7477 l_prev_corr_year VARCHAR2(100); --10100628
7478 l_er_only VARCHAR2(10); --10100628
7479
7480 BEGIN
7481 --
7482 get_all_parameters (p_actid
7483 ,l_business_group_id
7484 ,l_start_date
7485 ,l_end_date
7486 ,l_legal_employer
7487 ,l_payroll_type
7488 ,l_seq_no
7489 ,l_prev_corr_year
7490 ,l_er_only); --10100628
7491 --
7492 l_paid_flag := NULL;
7493 l_hr_tax_unit := NULL;
7494 --
7495 OPEN csr_le_hr_mapping_chk(l_legal_employer);
7496 FETCH csr_le_hr_mapping_chk INTO l_hr_tax_unit,l_paid_flag;
7497 CLOSE csr_le_hr_mapping_chk;
7498 --
7499 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~l_paid_flag :'||l_paid_flag);
7500 --
7501 IF l_paid_flag IS NULL THEN
7502 OPEN csr_get_empr_contact(NVL(l_hr_tax_unit,l_legal_employer),l_business_group_id);
7503 FETCH csr_get_empr_contact INTO l_paid_flag;
7504 CLOSE csr_get_empr_contact;
7505 END IF;
7506 --
7507 l_paid_flag := NVL(l_paid_flag,'N');
7508 --
7509 IF l_payroll_type = 'FOUR_WEEK' THEN
7510 l_chk_person_id := 0;
7511 FOR csr_persons_rec IN csr_persons(stperson
7512 ,endperson
7513 ,l_start_date
7514 ,l_end_date
7515 ,l_business_group_id
7516 ,l_payroll_type
7517 ,l_legal_employer )LOOP
7518 IF csr_persons_rec.person_id <> l_chk_person_id THEN
7519 --
7520 l_chk_person_id := csr_persons_rec.person_id;
7521 --
7522 SELECT pay_assignment_actions_s.NEXTVAL
7523 INTO l_actid
7524 FROM dual;
7525 -- CREATE THE ARCHIVE ASSIGNMENT ACTION
7526 hr_nonrun_asact.insact(lockingactid => l_actid
7527 ,assignid => csr_persons_rec.assignment_id
7528 ,pactid => p_actid
7529 ,chunk => chunk
7530 ,greid => l_legal_employer);
7531 --
7532 END IF;
7533 hr_nonrun_asact.insint(l_actid,csr_persons_rec.assignment_action_id);
7534 END LOOP;
7535 ELSIF l_payroll_type = 'YEARLY' THEN ---- for yearly report
7536
7537 l_chk_assignment_id := 0;
7538 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
7539 IF csr_rec.assignment_id <> l_chk_assignment_id THEN
7540 l_chk_assignment_id := csr_rec.assignment_id;
7541 SELECT pay_assignment_actions_s.NEXTVAL
7542 INTO l_actid
7543 FROM dual;
7544 --Fnd_file.put_line(FND_FILE.LOG,'#######~~csr_rec.assignment_action_id :'||l_actid||','||csr_rec.assignment_action_id);
7545 -- CREATE THE ARCHIVE ASSIGNMENT ACTION FOR THE MASTER ASSIGNMENT ACTION
7546 hr_nonrun_asact.insact(lockingactid => l_actid
7547 ,assignid => csr_rec.assignment_id
7548 ,pactid => p_actid
7549 ,chunk => chunk
7550 ,greid => l_legal_employer);
7551 --
7552 END IF;
7553 IF csr_rec.assignment_action_id IS NOT NULL THEN
7554 --Fnd_file.put_line(FND_FILE.LOG,'#######~~hr_nonrun_asact.insint');
7555 hr_nonrun_asact.insint(l_actid,csr_rec.assignment_action_id);
7556 END IF;
7557 END LOOP;
7558 --10100628
7559 ELSIF l_prev_corr_year <> '-9999' THEN
7560
7561 l_chk_assignment_id := 0;
7562 --
7563 FOR csr_rec IN cur_valid_assign(stperson,endperson,l_start_date,l_end_date,l_business_group_id,l_payroll_type,l_legal_employer,l_paid_flag,l_prev_corr_year) LOOP
7564 IF csr_rec.assignment_id <> l_chk_assignment_id THEN
7565 l_chk_assignment_id := csr_rec.assignment_id;
7566
7567 IF csr_rec.assignment_action_id IS NOT NULL THEN --10100628
7568 SELECT pay_assignment_actions_s.NEXTVAL
7569 INTO l_actid
7570 FROM dual;
7571 -- CREATE THE ARCHIVE ASSIGNMENT ACTION FOR THE MASTER ASSIGNMENT ACTION
7572 hr_nonrun_asact.insact(lockingactid => l_actid
7573 ,assignid => csr_rec.assignment_id
7574 ,pactid => p_actid
7575 ,chunk => chunk
7576 ,greid => l_legal_employer);
7577 --
7578 --END IF; --10100628
7579
7580 --IF csr_rec.assignment_action_id IS NOT NULL THEN 10100628
7581 hr_nonrun_asact.insint(l_actid,csr_rec.assignment_action_id);
7582 END IF; --10100628
7583 END IF;
7584 END LOOP;
7585 --10100628
7586 ELSE
7587 l_chk_assignment_id := 0;
7588 --
7589 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
7590 IF csr_rec.assignment_id <> l_chk_assignment_id THEN
7591 l_chk_assignment_id := csr_rec.assignment_id;
7592 SELECT pay_assignment_actions_s.NEXTVAL
7593 INTO l_actid
7594 FROM dual;
7595 -- CREATE THE ARCHIVE ASSIGNMENT ACTION FOR THE MASTER ASSIGNMENT ACTION
7596 hr_nonrun_asact.insact(lockingactid => l_actid
7597 ,assignid => csr_rec.assignment_id
7598 ,pactid => p_actid
7599 ,chunk => chunk
7600 ,greid => l_legal_employer);
7601 --
7602 END IF;
7603 IF csr_rec.assignment_action_id IS NOT NULL THEN
7604 hr_nonrun_asact.insint(l_actid,csr_rec.assignment_action_id);
7605 END IF;
7606 END LOOP;
7607 END IF;
7608 --
7609 END archive_action_creation;
7610 --------------------------------------------------------------------------------
7611 -- LOCK_ACTION_CREATION
7612 --------------------------------------------------------------------------------
7613 PROCEDURE lock_action_creation (p_actid IN NUMBER
7614 ,stperson IN NUMBER
7615 ,endperson IN NUMBER
7616 ,chunk IN NUMBER) IS
7617 --
7618 CURSOR csr_assignment_actions(p_arc_pactid NUMBER) IS
7619 SELECT paa.assignment_action_id
7620 ,paa.assignment_id
7621 FROM pay_assignment_actions paa
7622 ,per_all_assignments_f paaf
7623 ,pay_payroll_actions ppa
7624 WHERE paa.payroll_action_id = p_arc_pactid
7625 AND paa.payroll_action_id = ppa.payroll_action_id
7626 AND paaf.person_id BETWEEN stperson
7627 AND endperson
7628 AND paa.assignment_id = paaf.assignment_id
7629 AND ppa.effective_date BETWEEN paaf.effective_start_date
7630 AND paaf.effective_end_date
7631 ORDER BY paa.assignment_action_id;
7632 --
7633 l_actid NUMBER;
7634 l_arc_pactid NUMBER;
7635 --
7636 BEGIN
7637 --
7638 --hr_utility.trace_on(null,'NL_WR');
7639 --
7640 l_arc_pactid := TO_NUMBER(get_parameters(p_actid,'REQUEST_ID'));
7641 --
7642 FOR csr_rec IN csr_assignment_actions(l_arc_pactid) LOOP
7643 --
7644 SELECT pay_assignment_actions_s.NEXTVAL
7645 INTO l_actid
7646 FROM dual;
7647 --
7648 hr_nonrun_asact.insact(lockingactid => l_actid
7649 ,assignid => csr_rec.assignment_id
7650 ,pactid => p_actid
7651 ,chunk => chunk);
7652 --
7653 hr_nonrun_asact.insint( lockingactid => l_actid
7654 ,lockedactid => csr_rec.assignment_action_id );
7655 --
7656 END LOOP;
7657 --
7658 END lock_action_creation;
7659 --
7660 --------------------------------------------------------------------------------
7661 -- GET_SCL_DATA
7662 --------------------------------------------------------------------------------
7663 PROCEDURE get_scl_data(p_scl_id IN NUMBER
7664 ,p_effective_date IN DATE
7665 ,p_income_code IN OUT NOCOPY VARCHAR2
7666 ,p_work_pattern IN OUT NOCOPY VARCHAR2
7667 ,p_wage_tax_discount IN OUT NOCOPY VARCHAR2
7668 ,p_wage_tax_table IN OUT NOCOPY VARCHAR2
7669 ,p_wage_aow IN OUT NOCOPY VARCHAR2
7670 ,p_wage_wajong IN OUT NOCOPY VARCHAR2
7671 ,p_emp_loan IN OUT NOCOPY VARCHAR2
7672 ,p_transportation IN OUT NOCOPY VARCHAR2
7673 ,p_chk IN OUT NOCOPY VARCHAR2)
7674 IS
7675 --
7676 CURSOR csr_get_scl_seg(c_scl_id NUMBER) IS
7677 SELECT decode(segment4,'Y','J',segment4) wage_tax_discount
7678 ,decode(segment6,'R','J','I','N','S','N') work_pattern
7679 ,segment8 income_code
7680 ,segment11 wage_tax_table
7681 --,decode(INSTR(NVL(segment10,'00'),'01'),0,(decode(INSTR(segment13,'02'),0,1,3)),2) company_car_use --01/02
7682 ,decode(INSTR(NVL(segment10,'00'),'71'),0,'N','J') wage_aow
7683 ,decode(INSTR(NVL(segment10,'00'),'72'),0,'N','J') wage_wajong
7684 ,decode(INSTR(NVL(segment10,'00'),'43'),0,'N','J') emp_loan
7685 ,decode(INSTR(NVL(segment10,'00'),'03'),0,'N','J') transportation
7686 FROM hr_soft_coding_keyflex
7687 WHERE soft_coding_keyflex_id = c_scl_id;
7688 --
7689 l_wage_tax_discount hr_soft_coding_keyflex.segment13%type;
7690 l_work_pattern hr_soft_coding_keyflex.segment13%type;
7691 l_income_code hr_soft_coding_keyflex.segment13%type;
7692 l_wage_tax_table hr_soft_coding_keyflex.segment13%type;
7693 l_wage_aow hr_soft_coding_keyflex.segment13%type;
7694 l_wage_wajong hr_soft_coding_keyflex.segment13%type;
7695 l_emp_loan hr_soft_coding_keyflex.segment13%type;
7696 l_transportation hr_soft_coding_keyflex.segment13%type;
7697 --
7698 BEGIN
7699 --
7700 OPEN csr_get_scl_seg(p_scl_id);
7701 FETCH csr_get_scl_seg INTO l_wage_tax_discount
7702 ,l_work_pattern
7703 ,l_income_code
7704 ,l_wage_tax_table
7705 -- ,l_company_car_use
7706 ,l_wage_aow
7707 ,l_wage_wajong
7708 ,l_emp_loan
7709 ,l_transportation;
7710 CLOSE csr_get_scl_seg;
7711 --
7712 p_chk := 'N';
7713 l_wage_tax_table := NVL(l_wage_tax_table,940);
7714 l_wage_tax_discount := NVL(l_wage_tax_discount,'N');
7715 l_work_pattern := NVL(l_work_pattern,'N');
7716 IF p_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
7717 l_work_pattern := NULL;
7718 p_work_pattern := NULL;
7719 END IF;
7720 --
7721 IF p_wage_tax_discount <> l_wage_tax_discount OR
7722 p_work_pattern <> l_work_pattern OR
7723 p_income_code <> l_income_code OR
7724 p_wage_tax_table <> l_wage_tax_table OR
7725 p_wage_aow <> l_wage_aow OR
7726 p_wage_wajong <> l_wage_wajong OR
7727 p_emp_loan <> l_emp_loan OR
7728 p_transportation <> l_transportation THEN
7729 p_chk := 'Y';
7730 END IF;
7731 p_wage_tax_discount := l_wage_tax_discount;
7732 p_work_pattern := l_work_pattern ;
7733 p_income_code := l_income_code ;
7734 p_wage_tax_table := l_wage_tax_table ;
7735 p_wage_aow := l_wage_aow ;
7736 p_wage_wajong := l_wage_wajong ;
7737 p_emp_loan := l_emp_loan ;
7738 p_transportation := l_transportation ;
7739 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_wage_tax_discount :'||p_wage_tax_discount);
7740 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_work_pattern :'||p_work_pattern);
7741 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_income_code :'||p_income_code);
7742 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_wage_tax_table :'||p_wage_tax_table);
7743 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_wage_aow :'||p_wage_aow);
7744 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_wage_wajong :'||p_wage_wajong);
7745 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_emp_loan :'||p_emp_loan);
7746 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~p_transportation :'||p_transportation);
7747 --
7748 END get_scl_data;
7749 --
7750 --
7751 --------------------------------------------------------------------------------
7752 -- ARCHIVE_EMP_ADDRESS
7753 --------------------------------------------------------------------------------
7754 PROCEDURE archive_emp_address(p_assactid NUMBER
7755 ,p_person_id NUMBER
7756 ,p_assignment_id NUMBER
7757 ,p_assignment_number VARCHAR2
7758 ,p_name VARCHAR2
7759 ,p_tax_unit_id NUMBER
7760 ,p_m_act_info_id NUMBER
7761 ,p_arc_eff_date DATE
7762 ,p_eff_date DATE
7763 ,p_type VARCHAR2
7764 ,p_prev_corr_year VARCHAR2) IS --10100628
7765 --
7766 CURSOR csr_get_emp_address(c_person_id NUMBER
7767 ,c_effective_date DATE) IS
7768 SELECT addr.style
7769 ,addr.address_line1 address_line1
7770 ,addr.address_line2 address_line2
7771 ,addr.address_line3 address_line3
7772 ,addr.town_or_city town_or_city
7773 ,UPPER(addr.postal_code) postal_code
7774 ,addr.region_1 street_name
7775 ,addr.region_2 region_2
7776 ,addr.region_3 PO_Box_number
7777 ,addr.country country
7778 ,addr.telephone_number_1 telephone_number_1
7779 ,addr.telephone_number_2 telephone_number_2
7780 ,addr.telephone_number_3 telephone_number_3
7781 ,addr.add_information13 House_Number
7782 ,addr.add_information14 House_Number_Addition
7783 FROM per_addresses addr
7784 WHERE addr.person_id = c_person_id
7785 AND addr.primary_flag = 'Y'
7786 AND c_effective_date BETWEEN addr.date_from AND
7787 nvl(addr.date_to,fnd_date.canonical_to_date('4712/12/31'))
7788 ORDER BY 1 DESC;
7789 --
7790 l_addr csr_get_emp_address%ROWTYPE;
7791 l_ovn pay_action_information.object_version_number%type;
7792 l_action_info_id pay_action_information.action_information_id%type;
7793 l_address_flag VARCHAR2(1) := 'N';
7794 l_address_type VARCHAR2(30);
7795 l_arc_y_n VARCHAR2(1) := 'N';
7796 --
7797 BEGIN
7798 --
7799 --10100628
7800 IF p_prev_corr_year <> '-9999' THEN
7801 OPEN csr_get_emp_address(p_person_id, to_date('31-12-4712','dd-mm-rrrr'));
7802 ELSE
7803 OPEN csr_get_emp_address(p_person_id,p_eff_date);
7804 END IF;
7805 --10100628
7806
7807 --OPEN csr_get_emp_address(p_person_id,p_eff_date); --10100628
7808 FETCH csr_get_emp_address INTO l_addr;
7809 IF csr_get_emp_address%FOUND THEN
7810 l_address_flag := 'Y';
7811 IF l_addr.country = 'NL' THEN
7812 l_address_type := 'EMPLOYEE';
7813 ELSE
7814 l_address_type := 'EMPLOYEE FOREIGN';
7815 END IF;
7816 --#
7817 IF p_type IN ('INITIAL','CORRECTION') THEN
7818 --
7819 IF (l_addr.style = 'NL' AND l_addr.street_name IS NULL) OR
7820 (l_addr.style <> 'NL' AND l_addr.address_line1 IS NULL)THEN
7821 pay_action_information_api.create_action_information
7822 (
7823 p_action_information_id => l_action_info_id
7824 , p_action_context_id => p_assactid
7825 , p_action_context_type => 'AAP'
7826 , p_object_version_number => l_ovn
7827 , p_assignment_id => p_assignment_id
7828 , p_effective_date => p_arc_eff_date
7829 , p_source_id => NULL
7830 , p_source_text => NULL
7831 , p_tax_unit_id => p_tax_unit_id
7832 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7833 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_STREET')
7834 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
7835 , p_action_information6 => 'Street name missing in the address'
7836 , p_action_information7 => p_name
7837 , p_action_information8 => p_assignment_number);
7838 END IF;
7839 --
7840 IF l_addr.town_or_city IS NULL THEN
7841 pay_action_information_api.create_action_information
7842 (
7843 p_action_information_id => l_action_info_id
7844 , p_action_context_id => p_assactid
7845 , p_action_context_type => 'AAP'
7846 , p_object_version_number => l_ovn
7847 , p_assignment_id => p_assignment_id
7848 , p_effective_date => p_arc_eff_date
7849 , p_source_id => NULL
7850 , p_source_text => NULL
7851 , p_tax_unit_id => p_tax_unit_id
7852 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7853 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_CITY')
7854 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
7855 , p_action_information6 => 'City name missing in the address'
7856 , p_action_information7 => p_name
7857 , p_action_information8 => p_assignment_number);
7858 END IF;
7859 --
7860 IF l_addr.postal_code IS NULL AND l_addr.style = 'NL' THEN
7861 pay_action_information_api.create_action_information
7862 (
7863 p_action_information_id => l_action_info_id
7864 , p_action_context_id => p_assactid
7865 , p_action_context_type => 'AAP'
7866 , p_object_version_number => l_ovn
7867 , p_assignment_id => p_assignment_id
7868 , p_effective_date => p_arc_eff_date
7869 , p_source_id => NULL
7870 , p_source_text => NULL
7871 , p_tax_unit_id => p_tax_unit_id
7872 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7873 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_PO_CODE')
7874 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
7875 , p_action_information6 => 'Postal Code missing in address'
7876 , p_action_information7 => p_name
7877 , p_action_information8 => p_assignment_number);
7878 END IF;
7879 --
7880 IF l_addr.country IS NULL THEN
7881 pay_action_information_api.create_action_information
7882 (
7883 p_action_information_id => l_action_info_id
7884 , p_action_context_id => p_assactid
7885 , p_action_context_type => 'AAP'
7886 , p_object_version_number => l_ovn
7887 , p_assignment_id => p_assignment_id
7888 , p_effective_date => p_arc_eff_date
7889 , p_source_id => NULL
7890 , p_source_text => NULL
7891 , p_tax_unit_id => p_tax_unit_id
7892 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7893 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_COUNTRY')
7894 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
7895 , p_action_information6 => 'Country is missing in address'
7896 , p_action_information7 => p_name
7897 , p_action_information8 => p_assignment_number);
7898 END IF;
7899 --
7900 END IF;
7901 --#
7902 IF l_addr.style = 'NL' THEN
7903 --#
7904 IF p_type IN ('INITIAL','CORRECTION') THEN
7905 --
7906 IF hr_ni_chk_pkg.chk_nat_id_format(l_addr.postal_code,'DDDD AA') = upper(l_addr.postal_code) OR
7907 hr_ni_chk_pkg.chk_nat_id_format(l_addr.postal_code,'DDDDAA') = upper(l_addr.postal_code) THEN
7908 NULL;
7909 ELSE
7910 pay_action_information_api.create_action_information
7911 (
7912 p_action_information_id => l_action_info_id
7913 , p_action_context_id => p_assactid
7914 , p_action_context_type => 'AAP'
7915 , p_object_version_number => l_ovn
7916 , p_assignment_id => p_assignment_id
7917 , p_effective_date => p_arc_eff_date
7918 , p_source_id => NULL
7919 , p_source_text => NULL
7920 , p_tax_unit_id => p_tax_unit_id
7921 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
7922 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_PO_FORMAT')
7923 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
7924 , p_action_information6 => 'Postal Code is not in the format 9999XX'
7925 , p_action_information7 => p_name
7926 , p_action_information8 => p_assignment_number);
7927 END IF;
7928 --
7929 END IF;
7930 --#
7931 --10100628
7932 IF p_prev_corr_year <> '-9999' THEN
7933 l_arc_y_n := IS_ARCHIVED(p_assactid, 'ADDRESS DETAILS', 'INITIAL');
7934 IF p_type = 'INITIAL' THEN
7935 IF l_arc_y_n = 'N' THEN
7936 pay_action_information_api.create_action_information (
7937 p_action_information_id => l_action_info_id
7938 ,p_action_context_id => p_assactid
7939 ,p_action_context_type => 'AAP'
7940 ,p_object_version_number => l_ovn
7941 ,p_assignment_id => p_assignment_id
7942 ,p_effective_date => p_arc_eff_date
7943 ,p_source_id => NULL
7944 ,p_source_text => NULL
7945 ,p_tax_unit_id => p_tax_unit_id
7946 ,p_action_information_category => 'ADDRESS DETAILS'
7947 ,p_action_information1 => p_person_id
7948 ,p_action_information5 => substr(l_addr.House_Number,1,5)
7949 ,p_action_information6 => substr(l_addr.House_Number_Addition,1,4)
7950 ,p_action_information8 => l_addr.town_or_city --substr(l_addr.town_or_city,1,24)
7951 ,p_action_information9 => substr(l_addr.street_name,1,24)
7952 ,p_action_information11 => TRIM(substr(l_addr.address_line1||' '||l_addr.PO_Box_number,1,35)) -- Location
7953 ,p_action_information12 => REPLACE(l_addr.postal_code,' ','')
7954 ,p_action_information13 => l_addr.country
7955 ,p_action_information14 => l_address_type
7956 ,p_action_information26 => p_type
7957 ,p_action_information27 => p_m_act_info_id); -- add ADD_INFORMATION13 and ADD_INFORMATION14
7958 END IF;
7959 ELSE
7960 pay_action_information_api.create_action_information (
7961 p_action_information_id => l_action_info_id
7962 ,p_action_context_id => p_assactid
7963 ,p_action_context_type => 'AAP'
7964 ,p_object_version_number => l_ovn
7965 ,p_assignment_id => p_assignment_id
7966 ,p_effective_date => p_arc_eff_date
7967 ,p_source_id => NULL
7968 ,p_source_text => NULL
7969 ,p_tax_unit_id => p_tax_unit_id
7970 ,p_action_information_category => 'ADDRESS DETAILS'
7971 ,p_action_information1 => p_person_id
7972 ,p_action_information5 => substr(l_addr.House_Number,1,5)
7973 ,p_action_information6 => substr(l_addr.House_Number_Addition,1,4)
7974 ,p_action_information8 => l_addr.town_or_city --substr(l_addr.town_or_city,1,24)
7975 ,p_action_information9 => substr(l_addr.street_name,1,24)
7976 ,p_action_information11 => TRIM(substr(l_addr.address_line1||' '||l_addr.PO_Box_number,1,35)) -- Location
7977 ,p_action_information12 => REPLACE(l_addr.postal_code,' ','')
7978 ,p_action_information13 => l_addr.country
7979 ,p_action_information14 => l_address_type
7980 ,p_action_information26 => 'CORRECT' --p_type 10100628
7981 ,p_action_information27 => p_m_act_info_id); -- add ADD_INFORMATION13 and ADD_INFORMATION14
7982 END IF;
7983 ELSE
7984 --10100628
7985
7986 pay_action_information_api.create_action_information (
7987 p_action_information_id => l_action_info_id
7988 ,p_action_context_id => p_assactid
7989 ,p_action_context_type => 'AAP'
7990 ,p_object_version_number => l_ovn
7991 ,p_assignment_id => p_assignment_id
7992 ,p_effective_date => p_arc_eff_date
7993 ,p_source_id => NULL
7994 ,p_source_text => NULL
7995 ,p_tax_unit_id => p_tax_unit_id
7996 ,p_action_information_category => 'ADDRESS DETAILS'
7997 ,p_action_information1 => p_person_id
7998 ,p_action_information5 => substr(l_addr.House_Number,1,5)
7999 ,p_action_information6 => substr(l_addr.House_Number_Addition,1,4)
8000 ,p_action_information8 => l_addr.town_or_city --substr(l_addr.town_or_city,1,24)
8001 ,p_action_information9 => substr(l_addr.street_name,1,24)
8002 ,p_action_information11 => TRIM(substr(l_addr.address_line1||' '||l_addr.PO_Box_number,1,35)) -- Location
8003 ,p_action_information12 => REPLACE(l_addr.postal_code,' ','')
8004 ,p_action_information13 => l_addr.country
8005 ,p_action_information14 => l_address_type
8006 ,p_action_information26 => p_type
8007 ,p_action_information27 => p_m_act_info_id); -- add ADD_INFORMATION13 and ADD_INFORMATION14
8008 END IF; --10100628
8009
8010 ELSE
8011 IF l_addr.country <> 'NL' THEN
8012 --10100628
8013 IF p_prev_corr_year <> '-9999' THEN
8014 l_arc_y_n := IS_ARCHIVED(p_assactid, 'ADDRESS DETAILS', 'INITIAL');
8015 IF p_type = 'INITIAL' THEN
8016 IF l_arc_y_n = 'N' THEN
8017 pay_action_information_api.create_action_information (
8018 p_action_information_id => l_action_info_id
8019 ,p_action_context_id => p_assactid
8020 ,p_action_context_type => 'AAP'
8021 ,p_object_version_number => l_ovn
8022 ,p_assignment_id => p_assignment_id
8023 ,p_effective_date => p_arc_eff_date
8024 ,p_source_id => NULL
8025 ,p_source_text => NULL
8026 ,p_tax_unit_id => p_tax_unit_id
8027 ,p_action_information_category => 'ADDRESS DETAILS'
8028 ,p_action_information1 => p_person_id
8029 ,p_action_information5 => SUBSTR(l_addr.address_line1,1,24) -- street
8030 ,p_action_information6 => SUBSTR(l_addr.address_line2,1,9) -- house nr
8031 ,p_action_information7 => SUBSTR(l_addr.address_line3,1,35) -- location
8032 ,p_action_information8 => SUBSTR(l_addr.town_or_city,1,50)
8033 ,p_action_information9 => l_addr.street_name --SUBSTR(l_addr.street_name,1,24) -- region
8034 ,p_action_information12 => SUBSTR(l_addr.postal_code,1,9)
8035 ,p_action_information13 => SUBSTR(l_addr.country,1,2)
8036 ,p_action_information14 => l_address_type
8037 ,p_action_information26 => p_type
8038 ,p_action_information27 => p_m_act_info_id); -- add tel numbers also
8039 END IF;
8040 ELSE
8041 pay_action_information_api.create_action_information (
8042 p_action_information_id => l_action_info_id
8043 ,p_action_context_id => p_assactid
8044 ,p_action_context_type => 'AAP'
8045 ,p_object_version_number => l_ovn
8046 ,p_assignment_id => p_assignment_id
8047 ,p_effective_date => p_arc_eff_date
8048 ,p_source_id => NULL
8049 ,p_source_text => NULL
8050 ,p_tax_unit_id => p_tax_unit_id
8051 ,p_action_information_category => 'ADDRESS DETAILS'
8052 ,p_action_information1 => p_person_id
8053 ,p_action_information5 => SUBSTR(l_addr.address_line1,1,24) -- street
8054 ,p_action_information6 => SUBSTR(l_addr.address_line2,1,9) -- house nr
8055 ,p_action_information7 => SUBSTR(l_addr.address_line3,1,35) -- location
8056 ,p_action_information8 => SUBSTR(l_addr.town_or_city,1,50)
8057 ,p_action_information9 => l_addr.street_name --SUBSTR(l_addr.street_name,1,24) -- region
8058 ,p_action_information12 => SUBSTR(l_addr.postal_code,1,9)
8059 ,p_action_information13 => SUBSTR(l_addr.country,1,2)
8060 ,p_action_information14 => l_address_type
8061 ,p_action_information26 => 'CORRECT' --p_type 10100628
8062 ,p_action_information27 => p_m_act_info_id); -- add tel numbers also
8063 END IF;
8064 ELSE
8065 --10100628
8066
8067 pay_action_information_api.create_action_information (
8068 p_action_information_id => l_action_info_id
8069 ,p_action_context_id => p_assactid
8070 ,p_action_context_type => 'AAP'
8071 ,p_object_version_number => l_ovn
8072 ,p_assignment_id => p_assignment_id
8073 ,p_effective_date => p_arc_eff_date
8074 ,p_source_id => NULL
8075 ,p_source_text => NULL
8076 ,p_tax_unit_id => p_tax_unit_id
8077 ,p_action_information_category => 'ADDRESS DETAILS'
8078 ,p_action_information1 => p_person_id
8079 ,p_action_information5 => SUBSTR(l_addr.address_line1,1,24) -- street
8080 ,p_action_information6 => SUBSTR(l_addr.address_line2,1,9) -- house nr
8081 ,p_action_information7 => SUBSTR(l_addr.address_line3,1,35) -- location
8082 ,p_action_information8 => SUBSTR(l_addr.town_or_city,1,50)
8083 ,p_action_information9 => l_addr.street_name --SUBSTR(l_addr.street_name,1,24) -- region
8084 ,p_action_information12 => SUBSTR(l_addr.postal_code,1,9)
8085 ,p_action_information13 => SUBSTR(l_addr.country,1,2)
8086 ,p_action_information14 => l_address_type
8087 ,p_action_information26 => p_type
8088 ,p_action_information27 => p_m_act_info_id); -- add tel numbers also
8089 END IF;--10100628
8090
8091 END IF;
8092 END IF;
8093 END IF;
8094 CLOSE csr_get_emp_address;
8095 --#
8096 --abraghun--7668628--Check0050 already exists.
8097 --
8098 IF l_address_flag = 'N' AND p_type IN ('INITIAL','CORRECTION') THEN
8099 pay_action_information_api.create_action_information
8100 (
8101 p_action_information_id => l_action_info_id
8102 , p_action_context_id => p_assactid
8103 , p_action_context_type => 'AAP'
8104 , p_object_version_number => l_ovn
8105 , p_assignment_id => p_assignment_id
8106 , p_effective_date => p_arc_eff_date
8107 , p_source_id => NULL
8108 , p_source_text => NULL
8109 , p_tax_unit_id => p_tax_unit_id
8110 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
8111 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_ADDRESS')
8112 , p_action_information5 => fnd_date.date_to_canonical(p_eff_date)
8113 , p_action_information6 => 'Address details are null'
8114 , p_action_information7 => p_name
8115 , p_action_information8 => p_assignment_number);
8116 END IF;
8117 --#
8118 END archive_emp_address;
8119 --
8120 --------------------------------------------------------------------------------
8121 -- ARCHIVE_SECTOR_RISK_GROUP
8122 --------------------------------------------------------------------------------
8123 FUNCTION archive_sector_risk_group( p_actid NUMBER
8124 ,p_assignment_id NUMBER
8125 ,p_effective_date DATE
8126 ,p_tax_unit_id NUMBER
8127 ,p_mas_act_info_id NUMBER
8128 ,p_start_date DATE
8129 ,p_end_date DATE
8130 ,p_emp_start_date DATE
8131 ,p_emp_end_date DATE
8132 ,p_payroll_type VARCHAR2) RETURN VARCHAR2 IS
8133 --
8134 CURSOR csr_get_emp_risk_grp(c_assignment_id NUMBER) IS
8135 SELECT DISTINCT hoi.organization_id
8136 ,hoi.org_information5 sector
8137 ,hoi.org_information6 risk_group
8138 ,fnd_date.canonical_to_date(aei.AEI_INFORMATION1) start_date
8139 ,fnd_date.canonical_to_date(aei.AEI_INFORMATION2) end_date
8140 FROM hr_organization_information hoi
8141 ,per_assignment_extra_info aei
8142 WHERE hoi.organization_id = nvl( aei.aei_information8,HR_NL_ORG_INFO.Get_SI_Provider_Info(aei.assignment_id,aei.AEI_INFORMATION3))
8143 AND aei.assignment_id = c_assignment_id
8144 AND aei.information_type = 'NL_SII'
8145 AND aei.aei_information3 IN ('WW','AMI','ZW','WAO')
8146 AND hoi.org_information5 IS NOT NULL
8147 AND hoi.org_information6 IS NOT NULL
8148 AND hoi.org_information_context= 'NL_UWV'
8149 ORDER BY 2,3;
8150 /*SELECT DISTINCT organization_id
8151 ,org_information5 sector
8152 ,org_information6 risk_group
8153 FROM hr_organization_information
8154 WHERE organization_id IN (SELECT HR_NL_ORG_INFO.Get_SI_Provider_Info(assignment_id,AEI_INFORMATION3)
8155 FROM per_assignment_extra_info
8156 WHERE assignment_id = c_assignment_id
8157 AND information_type = 'NL_SII'
8158 AND aei_information3 IN ('WW','AMI'))
8159 AND org_information5 IS NOT NULL
8160 AND org_information6 IS NOT NULL
8161 AND org_information_context= 'NL_UWV';*/
8162 --AND rownum < 6;
8163 --
8164 l_action_info_id pay_action_information.action_information_id%TYPE;
8165 l_ovn pay_action_information.object_version_number%type;
8166 l_srg_flag VARCHAR2(1);
8167 l_srg_flag_52 VARCHAR2(1);
8168 l_start_date DATE;
8169 l_end_date DATE;
8170 l_sector VARCHAR2(30);
8171 l_risk_grp VARCHAR2(30);
8172
8173 --
8174 BEGIN
8175 --
8176 l_srg_flag := 'N';
8177 l_srg_flag_52 := 'N';
8178 l_start_date := p_start_date;
8179 l_end_date := p_end_date;
8180 l_sector := 'X';
8181 l_risk_grp := 'X';
8182 --
8183 IF p_emp_start_date BETWEEN p_start_date AND p_end_date THEN
8184 l_start_date := p_emp_start_date;
8185 END IF;
8186 IF p_emp_end_date BETWEEN p_start_date AND p_end_date THEN
8187 l_end_date := p_emp_end_date;
8188 END IF;
8189 --
8190 FOR l_rec IN csr_get_emp_risk_grp(p_assignment_id) LOOP
8191 IF ( (NVL(l_rec.end_date,l_end_date) >= l_end_date) OR
8192 (p_payroll_type = 'YEARLY' AND NVL(l_rec.end_date,l_end_date) >= l_start_date))
8193 AND l_rec.start_date <= l_end_date
8194 AND l_sector <> l_rec.sector AND l_risk_grp <> l_rec.risk_group THEN
8195 --IF NVL(l_rec.end_date,l_end_date) >= l_start_date AND l_rec.start_date <= l_end_date THEN
8196 /*IF l_rec.start_date BETWEEN p_start_date AND p_end_date AND
8197 l_rec.start_date >= NVL(l_start_date,l_rec.start_date)THEN
8198 l_start_date := l_rec.start_date;
8199 END IF;
8200 IF l_rec.end_date BETWEEN p_start_date AND p_end_date AND
8201 l_rec.start_date >= NVL(l_end_date,l_rec.start_date)THEN
8202 l_end_date := l_rec.end_date;
8203 END IF;*/
8204 --
8205 pay_action_information_api.create_action_information (
8206 p_action_information_id => l_action_info_id
8207 , p_action_context_id => p_actid
8208 , p_action_context_type => 'AAP'
8209 , p_object_version_number => l_ovn
8210 , p_assignment_id => p_assignment_id
8211 , p_effective_date => p_effective_date
8212 , p_source_id => NULL
8213 , p_source_text => NULL
8214 ,p_tax_unit_id => p_tax_unit_id
8215 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
8216 , p_action_information1 => 'SECTOR_RISK_GROUP'
8217 , p_action_information2 => p_mas_act_info_id
8218 , p_action_information5 => fnd_date.date_to_canonical(l_start_date)
8219 , p_action_information6 => fnd_date.date_to_canonical(LEAST(l_end_date,NVL(l_rec.end_date,l_end_date)))
8220 , p_action_information7 => l_rec.sector
8221 , p_action_information8 => l_rec.risk_group
8222 , p_action_information9 => NULL
8223 , p_action_information10 => NULL);
8224 --
8225 l_srg_flag := 'Y';
8226 IF l_rec.sector = '52' THEN
8227 l_srg_flag_52 := 'Y';
8228 END IF;
8229 --
8230 l_risk_grp := l_rec.risk_group;
8231 l_sector := l_rec.sector;
8232 --
8233 END IF;
8234 --
8235 END LOOP;
8236 /*OPEN csr_get_emp_risk_grp(p_assignment_id);
8237 FETCH csr_get_emp_risk_grp INTO l_sector_rec;
8238 IF csr_get_emp_risk_grp%found THEN
8239 pay_action_information_api.create_action_information (
8240 p_action_information_id => l_action_info_id
8241 , p_action_context_id => p_actid
8242 , p_action_context_type => 'AAP'
8243 , p_object_version_number => l_ovn
8244 , p_assignment_id => p_assignment_id
8245 , p_effective_date => p_effective_date
8246 , p_source_id => NULL
8247 , p_source_text => NULL
8248 ,p_tax_unit_id => p_tax_unit_id
8249 , p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
8250 , p_action_information1 => 'SECTOR_RISK_GROUP'
8251 , p_action_information2 => p_mas_act_info_id
8252 , p_action_information5 => fnd_date.date_to_canonical(p_start_date)
8253 , p_action_information6 => fnd_date.date_to_canonical(p_end_date)
8254 , p_action_information7 => l_sector_rec.sector
8255 , p_action_information8 => l_sector_rec.risk_group
8256 , p_action_information9 => NULL
8257 , p_action_information10 => NULL);
8258 --
8259 l_srg_flag := 'Y';
8260 IF l_sector_rec.sector = '52' THEN
8261 l_srg_flag_52 := 'Y';
8262 END IF;
8263 END IF;
8264 CLOSE csr_get_emp_risk_grp; */
8265 --
8266 IF l_srg_flag_52 = 'Y' THEN
8267 l_srg_flag := 'Z';
8268 END IF;
8269 --
8270 RETURN l_srg_flag;
8271 --
8272 END archive_sector_risk_group;
8273 --
8274 --------------------------------------------------------------------------------
8275 -- GET_NOMINATIVE_DATA
8276 --------------------------------------------------------------------------------
8277 PROCEDURE get_nominative_data(p_bal_tab Bal_Value
8278 ,p_nom_bal_value IN OUT NOCOPY Bal_Value) IS
8279 --
8280 BEGIN
8281 --
8282 FOR i in 1..36 LOOP --LC 2010-- increased from 29 to 36
8283 p_nom_bal_value(i).balance_value := 0;
8284 END LOOP;
8285 --
8286 FOR i in 1..3 LOOP -- Wage LB/PH
8287 p_nom_bal_value(1).balance_value := p_nom_bal_value(1).balance_value + p_bal_tab(i).balance_value;
8288 END LOOP;
8289 FOR i in 92..93 LOOP
8290 p_nom_bal_value(1).balance_value := p_nom_bal_value(1).balance_value + p_bal_tab(i).balance_value;
8291 END LOOP;
8292 FOR i in 13..15 LOOP
8293 p_nom_bal_value(1).balance_value := p_nom_bal_value(1).balance_value + p_bal_tab(i).balance_value;
8294 END LOOP;
8295 --
8296 FOR i in 4..12 LOOP -- SI Income
8297 p_nom_bal_value(2).balance_value := p_nom_bal_value(2).balance_value + p_bal_tab(i).balance_value;
8298 END LOOP;
8299 --
8300 FOR i in 13..15 LOOP -- 'SP RATE TAXABLE INCOME'
8301 p_nom_bal_value(3).balance_value := p_nom_bal_value(3).balance_value + p_bal_tab(i).balance_value;
8302 END LOOP;
8303 --
8304 p_nom_bal_value(4).balance_value := p_bal_tab(16).balance_value; -- 'HOLIDAY ALLW'
8305 p_nom_bal_value(5).balance_value := p_bal_tab(17).balance_value; -- 'RESERVATION HOLIDAY ALLW'
8306 p_nom_bal_value(6).balance_value := p_bal_tab(18).balance_value + p_bal_tab(118).balance_value
8307 + p_bal_tab(119).balance_value; -- 'ADDITIONAL PERIOD WAGE'
8308 p_nom_bal_value(7).balance_value := p_bal_tab(19).balance_value; -- 'R ADDITIONAL PERIOD WAGE'
8309 --
8310 FOR i in 20..25 LOOP -- 'WAGE_MONEY'
8311 p_nom_bal_value(8).balance_value := p_nom_bal_value(8).balance_value + p_bal_tab(i).balance_value;
8312 END LOOP;
8313 --Bug# 7110638
8314 /*FOR i in 96..101 LOOP
8315 p_nom_bal_value(8).balance_value := p_nom_bal_value(8).balance_value + p_bal_tab(i).balance_value;
8316 END LOOP;*/
8317 --Bug# 7110638
8318 --
8319 FOR i in 26..31 LOOP -- 'WAGE_KIND'
8320 p_nom_bal_value(9).balance_value := p_nom_bal_value(9).balance_value + p_bal_tab(i).balance_value;
8321 END LOOP;
8322 --
8323 --Bug# 7110638
8324 /*FOR i in 102..107 LOOP
8325 p_nom_bal_value(9).balance_value := p_nom_bal_value(9).balance_value + p_bal_tab(i).balance_value;
8326 END LOOP;*/
8327 --Bug# 7110638
8328 --
8329 p_nom_bal_value(10).balance_value := p_bal_tab(38).balance_value; -- 'OT_WAGE'
8330 --
8331 FOR i in 39..44 LOOP -- 'WAGE_TAX'
8332 p_nom_bal_value(11).balance_value := p_nom_bal_value(11).balance_value + p_bal_tab(i).balance_value;
8333 END LOOP;
8334 FOR i in 94..95 LOOP
8335 p_nom_bal_value(11).balance_value := p_nom_bal_value(11).balance_value + p_bal_tab(i).balance_value;
8336 END LOOP;
8337 FOR i in 114..115 LOOP
8338 p_nom_bal_value(11).balance_value := p_nom_bal_value(11).balance_value + p_bal_tab(i).balance_value;
8339 END LOOP;
8340 --
8341 FOR i in 45..53 LOOP -- 'WAO_CONTRBUTION_AOF' all 16 WAOB - WGA - IVA 45..53
8342 p_nom_bal_value(12).balance_value := p_nom_bal_value(12).balance_value + p_bal_tab(i).balance_value;
8343 END LOOP;
8344 --
8345 IF g_public_org_flag = 'N' AND g_risk_cover_flag = 'Y' THEN
8346 p_nom_bal_value(13).balance_value := 0;
8347 ELSIF g_public_org_flag = 'Y' AND g_risk_cover_flag = 'Y' THEN
8348 p_nom_bal_value(13).balance_value := 0;
8349 ELSE
8350 FOR i in 54..56 LOOP -- 'WAO_CONTRBUTION_AOK' all 16 WAOD
8351 p_nom_bal_value(13).balance_value := p_nom_bal_value(13).balance_value + p_bal_tab(i).balance_value;
8352 END LOOP;
8353 END IF;
8354 --
8355 IF g_public_org_flag = 'Y' THEN
8356 p_nom_bal_value(14).balance_value := NULL;
8357 ELSE
8358 FOR i in 57..59 LOOP -- 'WW_AWF' WEWE all emp
8359 p_nom_bal_value(14).balance_value := p_nom_bal_value(14).balance_value + p_bal_tab(i).balance_value;
8360 END LOOP;
8361 END IF;
8362 --
8363 IF g_public_org_flag = 'Y' THEN
8364 p_nom_bal_value(15).balance_value := NULL;
8365 ELSE
8366 FOR i in 60..62 LOOP -- 'c_WAITING_MONEY_FUND' all 16 - WEWA
8367 p_nom_bal_value(15).balance_value := p_nom_bal_value(15).balance_value + p_bal_tab(i).balance_value;
8368 END LOOP;
8369 END IF;
8370 --
8371 IF g_public_org_flag = 'Y' THEN
8372 FOR i in 63..65 LOOP -- 'UFO_CONTRIBUTION' all 16 UFO 63..65
8373 p_nom_bal_value(16).balance_value := p_nom_bal_value(16).balance_value + p_bal_tab(i).balance_value;
8374 END LOOP;
8375 ELSE
8376 p_nom_bal_value(16).balance_value := NULL;
8377 END IF;
8378 --
8379 --LC 2013 --BEGIN
8380 IF to_char(g_effective_date,'YYYY') >= '2013' THEN
8381 FOR i in 144..146 LOOP -- 'ZVWL_CONTRIBUTION' all empe zvwl -different balances 144..146
8382 p_nom_bal_value(17).balance_value := p_nom_bal_value(17).balance_value + p_bal_tab(i).balance_value;
8383 END LOOP;
8384 ELSE
8385 FOR i in 66..68 LOOP -- 'ZVW_CONTRIBUTION' -- all emp ZVW 66..68
8386 p_nom_bal_value(17).balance_value := p_nom_bal_value(17).balance_value + p_bal_tab(i).balance_value;
8387 END LOOP;
8388 END IF;
8389 --
8390 IF to_char(g_effective_date,'YYYY') >= '2013' THEN
8391 FOR i in 147..149 LOOP -- 'ZVWS_ALLW' all empr zvws -different balances 147..149
8392 p_nom_bal_value(18).balance_value := p_nom_bal_value(18).balance_value + p_bal_tab(i).balance_value;
8393 END LOOP;
8394 ELSE
8395 FOR i in 80..91 LOOP -- 'ZVW_ALLW' all empr zvw -different balances 80..91
8396 p_nom_bal_value(18).balance_value := p_nom_bal_value(18).balance_value + p_bal_tab(i).balance_value;
8397 END LOOP;
8398 END IF;
8399 --LC 2013 --END
8400 --
8401 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;
8402 --
8403 FOR i in 70..72 LOOP -- 'LABOUR DISC'
8404 p_nom_bal_value(20).balance_value := p_nom_bal_value(20).balance_value + p_bal_tab(i).balance_value;
8405 END LOOP;
8406 --p_nom_bal_value(20).balance_value := p_nom_bal_value(20).balance_value * -1;
8407 IF to_char(g_effective_date,'YYYY') >= '2013' THEN -- 'SI_DAYS' for ZVWL/ZVWS
8408 FOR i in 150..155 LOOP
8409 p_nom_bal_value(21).balance_value := p_nom_bal_value(21).balance_value + p_bal_tab(i).balance_value;
8410 END LOOP;
8411 ELSE
8412 FOR i in 73..75 LOOP -- 'SI_DAYS' for ZVW
8413 p_nom_bal_value(21).balance_value := p_nom_bal_value(21).balance_value + p_bal_tab(i).balance_value;
8414 END LOOP;
8415 END IF;
8416 p_nom_bal_value(21).balance_value := ROUND(p_nom_bal_value(21).balance_value);
8417 --
8418 p_nom_bal_value(22).balance_value := ROUND(p_bal_tab(76).balance_value); -- 'NO_HOURS'
8419 p_nom_bal_value(23).balance_value := p_bal_tab(77).balance_value; -- 'AMOUNT_SEE_DISCONT_DAYS'
8420 p_nom_bal_value(24).balance_value := p_bal_tab(78).balance_value; -- 'WWB-ALL_ALIMONY'
8421 p_nom_bal_value(25).balance_value := p_bal_tab(79).balance_value; -- 'DIRECTLY_PAID_ALIMONY'
8422 --
8423 p_nom_bal_value(26).balance_value := ROUND(p_bal_tab(108).balance_value); -- 'Private Company Car '
8424 p_nom_bal_value(27).balance_value := p_bal_tab(109).balance_value; -- 'Employee Private Company Car'
8425 p_nom_bal_value(28).balance_value := p_bal_tab(110).balance_value; -- 'Contribution Child Care'
8426 p_nom_bal_value(29).balance_value := p_bal_tab(111).balance_value + p_bal_tab(122).balance_value; -- 'Life Saving Scheme'
8427 p_nom_bal_value(30).balance_value := p_bal_tab(112).balance_value + p_bal_tab(120).balance_value
8428 + p_bal_tab(121).balance_value; -- 'Life Cycle Leave Discount'
8429 p_nom_bal_value(31).balance_value := p_bal_tab(113).balance_value; -- 'Paid Disability Allowance'
8430 --
8431 p_nom_bal_value(11).balance_value := p_nom_bal_value(11).balance_value - NVL(p_nom_bal_value(30).balance_value,0);
8432 --
8433 --LC 2010 -- begin
8434 -- Changed 123..131 to 123..125 to remove IVA and WGA and have only WAOB.
8435 FOR i in 123..125 LOOP -- 'Employee Contribution Base WAOB 123..125
8436 p_nom_bal_value(32).balance_value := p_nom_bal_value(32).balance_value + p_bal_tab(i).balance_value;
8437 END LOOP;
8438 --
8439 IF g_public_org_flag = 'N' AND g_risk_cover_flag = 'Y' THEN
8440 p_nom_bal_value(33).balance_value := 0;
8441 ELSIF g_public_org_flag = 'Y' AND g_risk_cover_flag = 'Y' THEN
8442 p_nom_bal_value(33).balance_value := 0;
8443 ELSE
8444 FOR i in 132..134 LOOP -- 'Employee Contribution base general WAO/WGA Differentiated 132..134
8445 p_nom_bal_value(33).balance_value := p_nom_bal_value(33).balance_value + p_bal_tab(i).balance_value;
8446 END LOOP;
8447 END IF;
8448 --
8449 IF g_public_org_flag = 'Y' THEN
8450 p_nom_bal_value(34).balance_value := 0;
8451 ELSE
8452 FOR i in 135..137 LOOP -- 'Employee Contribution base WW_AWF- WEWE all emp
8453 p_nom_bal_value(34).balance_value := p_nom_bal_value(34).balance_value + p_bal_tab(i).balance_value;
8454 END LOOP;
8455 END IF;
8456 --
8457 IF g_public_org_flag = 'Y' THEN
8458 p_nom_bal_value(35).balance_value := 0;
8459 ELSE
8460 FOR i in 141..143 LOOP -- 'Contribution base WAITING_MONEY_FUND' - WEWA
8461 p_nom_bal_value(35).balance_value := p_nom_bal_value(35).balance_value + p_bal_tab(i).balance_value;
8462 END LOOP;
8463 END IF;
8464 --
8465 -- IF g_public_org_flag = 'Y' THEN
8466 FOR i in 138..140 LOOP -- Employee UFO_CONTRIBUTION' all 16 UFO
8467 p_nom_bal_value(36).balance_value := p_nom_bal_value(36).balance_value + p_bal_tab(i).balance_value;
8468 END LOOP;
8469 -- ELSE
8470 -- p_nom_bal_value(36).balance_value := 0;
8471 -- END IF;
8472 --
8473 --LC 2010 -- end
8474 --archive_nominative_date
8475 --
8476 END get_nominative_data;
8477 --
8478 --------------------------------------------------------------------------------
8479 -- ARCHIVE_NOMINATIVE_DATA
8480 --------------------------------------------------------------------------------
8481 PROCEDURE archive_nominative_data(p_assactid NUMBER
8482 ,p_assignment_id NUMBER
8483 ,p_tax_unit_id NUMBER
8484 ,p_effective_date DATE
8485 ,p_date DATE
8486 ,p_type VARCHAR2
8487 ,p_master_action_info_id NUMBER
8488 ,p_name VARCHAR2
8489 ,p_corr_used VARCHAR2
8490 ,p_payroll_type VARCHAR2
8491 ,p_nom_bal_value IN OUT NOCOPY Bal_Value
8492 ,p_prev_corr_year VARCHAR2) IS --10100628
8493 --
8494 l_ovn pay_action_information.object_version_number%type;
8495 l_action_info_id pay_action_information.action_information_id%type;
8496 l_arc_y_n VARCHAR2(1) := 'N'; --10100628
8497 --
8498 --10100628
8499 CURSOR C_PREV_CORR_DATA(p_asg_id NUMBER, p_date DATE)
8500 IS
8501 SELECT
8502 fnd_date.canonical_to_date(AEI_INFORMATION1) start_date
8503 ,fnd_date.canonical_to_date(AEI_INFORMATION2) end_date
8504 ,fnd_number.canonical_to_number(AEI_INFORMATION3) LnLbPh
8505 ,fnd_number.canonical_to_number(AEI_INFORMATION4) LnSV
8506 ,fnd_number.canonical_to_number(AEI_INFORMATION5) LnTabBB
8507 ,fnd_number.canonical_to_number(AEI_INFORMATION6) VakBsl
8508 ,fnd_number.canonical_to_number(AEI_INFORMATION7) OpgRchtVakBsl
8509 ,fnd_number.canonical_to_number(AEI_INFORMATION8) ExtrSal
8510 ,fnd_number.canonical_to_number(AEI_INFORMATION9) OpgRchtExtrSal
8511 ,fnd_number.canonical_to_number(AEI_INFORMATION10) LnInGld
8512 ,fnd_number.canonical_to_number(AEI_INFORMATION11) WrdLn
8513 ,fnd_number.canonical_to_number(AEI_INFORMATION12) LnOwrk
8514 ,fnd_number.canonical_to_number(AEI_INFORMATION13) IngLbPh
8515 ,fnd_number.canonical_to_number(AEI_INFORMATION14) PrWAOAof
8516 ,fnd_number.canonical_to_number(AEI_INFORMATION15) PrWAOAok
8517 ,fnd_number.canonical_to_number(AEI_INFORMATION16) PrAWF
8518 ,fnd_number.canonical_to_number(AEI_INFORMATION17) PrWgf
8519 ,fnd_number.canonical_to_number(AEI_INFORMATION18) PrUFO
8520 ,fnd_number.canonical_to_number(AEI_INFORMATION19) BijdrZvw
8521 ,fnd_number.canonical_to_number(AEI_INFORMATION20) VergZvw
8522 ,fnd_number.canonical_to_number(AEI_INFORMATION21) Reisk
8523 ,fnd_number.canonical_to_number(AEI_INFORMATION22) VerrArbKrt
8524 ,fnd_number.canonical_to_number(AEI_INFORMATION23) AantSV
8525 --,fnd_number.canonical_to_number(AEI_INFORMATION24) AantVerlU
8526 ,fnd_number.canonical_to_number(AEI_INFORMATION25) LvLpReg
8527 ,fnd_number.canonical_to_number(AEI_INFORMATION26) LvLpRegToeg
8528 --10100628
8529 ,fnd_number.canonical_to_number(AEI_INFORMATION24) PrLnWao
8530 ,fnd_number.canonical_to_number(AEI_INFORMATION27) PrLnWaoWga
8531 ,fnd_number.canonical_to_number(AEI_INFORMATION28) PrLnWwAwf
8532 ,fnd_number.canonical_to_number(AEI_INFORMATION29) PrLnUfo
8533 ,fnd_number.canonical_to_number(AEI_INFORMATION30) PrLnPrSectFnds
8534 --10100628
8535 FROM per_assignment_extra_info
8536 WHERE assignment_id = p_asg_id
8537 AND aei_information_category = 'NL_WR_PREV_CORR'
8538 AND p_date BETWEEN fnd_date.canonical_to_date(aei_information1)
8539 AND nvl(fnd_date.canonical_to_date(aei_information2),to_date('31-12-4712','dd-mm-yyyy'))
8540 ORDER BY 1 ASC;
8541
8542 l_co_start_date DATE;
8543 l_co_end_date DATE;
8544 l_co_LnLbPh NUMBER;
8545 l_co_LnSV NUMBER;
8546 l_co_LnTabBB NUMBER;
8547 l_co_VakBsl NUMBER;
8548 l_co_OpgRchtVakBsl NUMBER;
8549 l_co_ExtrSal NUMBER;
8550 l_co_OpgRchtExtrSal NUMBER;
8551 l_co_LnInGld NUMBER;
8552 l_co_WrdLn NUMBER;
8553 l_co_LnOwrk NUMBER;
8554 l_co_IngLbPh NUMBER;
8555 l_co_PrWAOAof NUMBER;
8556 l_co_PrWAOAok NUMBER;
8557 l_co_PrAWF NUMBER;
8558 l_co_PrWgf NUMBER;
8559 l_co_PrUFO NUMBER;
8560 l_co_BijdrZvw NUMBER;
8561 l_co_VergZvw NUMBER;
8562 l_co_Reisk NUMBER;
8563 l_co_VerrArbKrt NUMBER;
8564 l_co_AantSV NUMBER;
8565 l_co_AantVerlU NUMBER;
8566 l_co_LvLpReg NUMBER;
8567 l_co_LvLpRegToeg NUMBER;
8568 --10100628
8569 l_co_PrLnWao NUMBER;
8570 l_co_PrLnWaoWga NUMBER;
8571 l_co_PrLnWwAwf NUMBER;
8572 l_co_PrLnUfo NUMBER;
8573 l_co_PrLnPrSectFnds NUMBER;
8574 --10100628
8575
8576 --10100628
8577
8578 BEGIN
8579
8580 IF p_nom_bal_value(14).balance_value <> 0 AND p_nom_bal_value(16).balance_value <> 0 THEN
8581 pay_action_information_api.create_action_information
8582 (
8583 p_action_information_id => l_action_info_id
8584 , p_action_context_id => p_assactid
8585 , p_action_context_type => 'AAP'
8586 , p_object_version_number => l_ovn
8587 , p_assignment_id => p_assignment_id
8588 , p_effective_date => p_effective_date
8589 , p_source_id => NULL
8590 , p_source_text => NULL
8591 , p_tax_unit_id => p_tax_unit_id
8592 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
8593 , p_action_information4 => fnd_message.get_string('PER','HR_NL_UFO_AND_AWF')
8594 , p_action_information5 => fnd_date.date_to_canonical(p_date)
8595 , p_action_information6 => 'UFO Contributions and AWF Contributions exist'
8596 , p_action_information7 => p_name
8597 , p_action_information8 => p_assignment_id);
8598 END IF;
8599 --
8600 IF p_nom_bal_value(14).balance_value <> 0 AND p_nom_bal_value(15).balance_value = 0 THEN
8601 pay_action_information_api.create_action_information
8602 (
8603 p_action_information_id => l_action_info_id
8604 , p_action_context_id => p_assactid
8605 , p_action_context_type => 'AAP'
8606 , p_object_version_number => l_ovn
8607 , p_assignment_id => p_assignment_id
8608 , p_effective_date => p_effective_date
8609 , p_source_id => NULL
8610 , p_source_text => NULL
8611 , p_tax_unit_id => p_tax_unit_id
8612 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
8613 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_WEWA')
8614 , p_action_information5 => fnd_date.date_to_canonical(p_date)
8615 , p_action_information6 => 'Waiting Money Fund contribution is zero'
8616 , p_action_information7 => p_name
8617 , p_action_information8 => p_assignment_id);
8618 END IF;
8619 --
8620 IF p_nom_bal_value(14).balance_value = 0 AND p_nom_bal_value(15).balance_value <> 0 THEN
8621 pay_action_information_api.create_action_information
8622 (
8623 p_action_information_id => l_action_info_id
8624 , p_action_context_id => p_assactid
8625 , p_action_context_type => 'AAP'
8626 , p_object_version_number => l_ovn
8627 , p_assignment_id => p_assignment_id
8628 , p_effective_date => p_effective_date
8629 , p_source_id => NULL
8630 , p_source_text => NULL
8631 , p_tax_unit_id => p_tax_unit_id
8632 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
8633 , p_action_information4 => fnd_message.get_string('PER','HR_NL_ZERO_WEWE')
8634 , p_action_information5 => fnd_date.date_to_canonical(p_date)
8635 , p_action_information6 => 'AWF contribution is zero'
8636 , p_action_information7 => p_name
8637 , p_action_information8 => p_assignment_id);
8638 END IF;
8639 --#
8640 -- Optional fields to be supressed in the report - hence passing NULL instead of 0 -vv
8641 FOR i IN 23..25 LOOP
8642 IF (p_nom_bal_value(i).balance_value = 0 ) THEN
8643 p_nom_bal_value(i).balance_value := NULL;
8644 END IF;
8645 END LOOP;
8646 --
8647 IF g_effective_date < TO_DATE('01012007','DDMMYYYY') THEN
8648 p_nom_bal_value(30).balance_value := NULL;
8649 p_nom_bal_value(31).balance_value := NULL;
8650 ELSE
8651 --p_nom_bal_value(28).balance_value := NULL; Bug 5902666
8652 p_nom_bal_value(28).balance_value := 0; --Bug 5902666
8653 p_nom_bal_value(15).balance_value := p_nom_bal_value(15).balance_value + p_nom_bal_value(30).balance_value;
8654 END IF;
8655 --
8656 IF p_payroll_type = 'YEARLY' THEN
8657 p_nom_bal_value(4).balance_value := NULL;
8658 p_nom_bal_value(5).balance_value := NULL;
8659 p_nom_bal_value(6).balance_value := NULL;
8660 p_nom_bal_value(7).balance_value := NULL;
8661 p_nom_bal_value(8).balance_value := NULL;
8662 p_nom_bal_value(9).balance_value := NULL;
8663 p_nom_bal_value(10).balance_value := NULL;
8664 p_nom_bal_value(21).balance_value := NULL;
8665 p_nom_bal_value(22).balance_value := NULL;
8666 p_nom_bal_value(28).balance_value := NULL;
8667 --p_nom_bal_value(30).balance_value := NULL; --ENh# 6968464
8668 p_nom_bal_value(31).balance_value := NULL;
8669 END IF;
8670 --
8671
8672 --10100628
8673 IF p_prev_corr_year <> '-9999' THEN
8674
8675 OPEN C_PREV_CORR_DATA(p_assignment_id, p_date);
8676 FETCH C_PREV_CORR_DATA INTO
8677 l_co_start_date
8678 ,l_co_end_date
8679 ,l_co_LnLbPh
8680 ,l_co_LnSV
8681 ,l_co_LnTabBB
8682 ,l_co_VakBsl
8683 ,l_co_OpgRchtVakBsl
8684 ,l_co_ExtrSal
8685 ,l_co_OpgRchtExtrSal
8686 ,l_co_LnInGld
8687 ,l_co_WrdLn
8688 ,l_co_LnOwrk
8689 ,l_co_IngLbPh
8690 ,l_co_PrWAOAof
8691 ,l_co_PrWAOAok
8692 ,l_co_PrAWF
8693 ,l_co_PrWgf
8694 ,l_co_PrUFO
8695 ,l_co_BijdrZvw
8696 ,l_co_VergZvw
8697 ,l_co_Reisk
8698 ,l_co_VerrArbKrt
8699 ,l_co_AantSV
8700 --,l_co_AantVerlU --10100628
8701 ,l_co_LvLpReg
8702 ,l_co_LvLpRegToeg
8703 --10100628
8704 ,l_co_PrLnWao
8705 ,l_co_PrLnWaoWga
8706 ,l_co_PrLnWwAwf
8707 ,l_co_PrLnUfo
8708 ,l_co_PrLnPrSectFnds;
8709 --10100628
8710 CLOSE C_PREV_CORR_DATA;
8711
8712 p_nom_bal_value(1).balance_value := p_nom_bal_value(1).balance_value + NVL(l_co_LnLbPh,0);
8713 p_nom_bal_value(2).balance_value := p_nom_bal_value(2).balance_value + NVL(l_co_LnSV,0);
8714 p_nom_bal_value(3).balance_value := p_nom_bal_value(3).balance_value + NVL(l_co_LnTabBB,0);
8715 p_nom_bal_value(4).balance_value := p_nom_bal_value(4).balance_value + NVL(l_co_VakBsl,0);
8716 p_nom_bal_value(5).balance_value := p_nom_bal_value(5).balance_value + NVL(l_co_OpgRchtVakBsl,0);
8717 p_nom_bal_value(6).balance_value := p_nom_bal_value(6).balance_value + NVL(l_co_ExtrSal,0);
8718 p_nom_bal_value(7).balance_value := p_nom_bal_value(7).balance_value + NVL(l_co_OpgRchtExtrSal,0);
8719 p_nom_bal_value(8).balance_value := p_nom_bal_value(8).balance_value + NVL(l_co_LnInGld,0);
8720 p_nom_bal_value(9).balance_value := p_nom_bal_value(9).balance_value + NVL(l_co_WrdLn,0);
8721 p_nom_bal_value(10).balance_value := p_nom_bal_value(10).balance_value + NVL(l_co_LnOwrk,0);
8722 p_nom_bal_value(11).balance_value := p_nom_bal_value(11).balance_value + NVL(l_co_IngLbPh,0);
8723 p_nom_bal_value(12).balance_value := p_nom_bal_value(12).balance_value + NVL(l_co_PrWAOAof,0);
8724 p_nom_bal_value(13).balance_value := p_nom_bal_value(13).balance_value + NVL(l_co_PrWAOAok,0);
8725 p_nom_bal_value(14).balance_value := p_nom_bal_value(14).balance_value + NVL(l_co_PrAWF,0);
8726 p_nom_bal_value(15).balance_value := p_nom_bal_value(15).balance_value + NVL(l_co_PrWgf,0);
8727 p_nom_bal_value(16).balance_value := p_nom_bal_value(16).balance_value + NVL(l_co_PrUFO,0);
8728 p_nom_bal_value(17).balance_value := p_nom_bal_value(17).balance_value + NVL(l_co_BijdrZvw,0);
8729 p_nom_bal_value(18).balance_value := p_nom_bal_value(18).balance_value + NVL(l_co_VergZvw,0);
8730 p_nom_bal_value(19).balance_value := p_nom_bal_value(19).balance_value + NVL(l_co_Reisk,0);
8731 p_nom_bal_value(20).balance_value := p_nom_bal_value(20).balance_value + NVL(l_co_VerrArbKrt,0);
8732 p_nom_bal_value(21).balance_value := p_nom_bal_value(21).balance_value + NVL(l_co_AantSV,0);
8733 --p_nom_bal_value(22).balance_value := p_nom_bal_value(22).balance_value + NVL(l_co_AantVerlU,0); --10100628
8734 --p_nom_bal_value(23).balance_value := p_nom_bal_value(23).balance_value +
8735 --p_nom_bal_value(24).balance_value := p_nom_bal_value(24).balance_value +
8736 --p_nom_bal_value(25).balance_value := p_nom_bal_value(25).balance_value +
8737
8738 --p_nom_bal_value(26).balance_value := p_nom_bal_value(26).balance_value +
8739 --p_nom_bal_value(27).balance_value := p_nom_bal_value(27).balance_value +
8740 --p_nom_bal_value(28).balance_value := p_nom_bal_value(28).balance_value +
8741 p_nom_bal_value(29).balance_value := p_nom_bal_value(29).balance_value + NVL(l_co_LvLpReg,0);
8742 p_nom_bal_value(30).balance_value := p_nom_bal_value(30).balance_value + NVL(l_co_LvLpRegToeg,0);
8743 --p_nom_bal_value(31).balance_value := p_nom_bal_value(31).balance_value +
8744
8745 --10100628
8746 p_nom_bal_value(32).balance_value := p_nom_bal_value(32).balance_value + NVL(l_co_PrLnWao,0);
8747 p_nom_bal_value(33).balance_value := p_nom_bal_value(33).balance_value + NVL(l_co_PrLnWaoWga,0);
8748 p_nom_bal_value(34).balance_value := p_nom_bal_value(34).balance_value + NVL(l_co_PrLnWwAwf,0);
8749 p_nom_bal_value(35).balance_value := p_nom_bal_value(35).balance_value + NVL(l_co_PrLnPrSectFnds,0);
8750 p_nom_bal_value(36).balance_value := p_nom_bal_value(36).balance_value + NVL(l_co_PrLnUfo,0);
8751 --10100628
8752
8753 END IF;
8754 --10100628
8755
8756 --10100628
8757 IF p_prev_corr_year <> '-9999' THEN
8758 l_arc_y_n := IS_ARCHIVED(p_assactid, 'NL_WR_NOMINATIVE_REPORT', 'INITIAL');
8759 IF p_type = 'INITIAL' THEN
8760 IF l_arc_y_n = 'N' THEN
8761 pay_action_information_api.create_action_information (
8762 p_action_information_id => l_action_info_id
8763 , p_action_context_id => p_assactid
8764 , p_action_context_type => 'AAP'
8765 , p_object_version_number => l_ovn
8766 , p_assignment_id => p_assignment_id
8767 , p_effective_date => p_effective_date
8768 , p_action_information_category => 'NL_WR_NOMINATIVE_REPORT'
8769 , p_tax_unit_id => p_tax_unit_id
8770 , p_action_information1 => p_type
8771 , p_action_information2 => p_master_action_info_id
8772 , p_action_information5 => fnd_number.number_to_canonical(p_nom_bal_value(1).balance_value)
8773 , p_action_information6 => fnd_number.number_to_canonical(p_nom_bal_value(2).balance_value)
8774 , p_action_information7 => fnd_number.number_to_canonical(p_nom_bal_value(3).balance_value) -- 'SP RATE TAXABLE INCOME'
8775 , p_action_information8 => fnd_number.number_to_canonical(p_nom_bal_value(4).balance_value) -- 'HOLIDAY ALLW' ** Not req for YEarly report
8776 , p_action_information9 => fnd_number.number_to_canonical(p_nom_bal_value(5).balance_value) -- 'RESERVATION HOLIDAY ALLW' ** Not req for YEarly report
8777 , p_action_information10 => fnd_number.number_to_canonical(p_nom_bal_value(6).balance_value) -- 'ADDITIONAL PERIOD WAGE' ** Not req for YEarly report
8778 , p_action_information11 => fnd_number.number_to_canonical(p_nom_bal_value(7).balance_value) -- 'R ADDITIONAL PERIOD WAGE' ** Not req for YEarly report
8779 , p_action_information12 => fnd_number.number_to_canonical(p_nom_bal_value(8).balance_value) -- 'WAGE_MONEY' ** Not req for YEarly report
8780 , p_action_information13 => fnd_number.number_to_canonical(p_nom_bal_value(9).balance_value) -- 'WAGE_KIND' ** Not req for YEarly report
8781 , p_action_information14 => fnd_number.number_to_canonical(p_nom_bal_value(10).balance_value) -- 'OT_WAGE' ** Not req for YEarly report
8782 , p_action_information15 => fnd_number.number_to_canonical(p_nom_bal_value(11).balance_value) -- 'WAGE_TAX'
8783 , p_action_information16 => fnd_number.number_to_canonical(p_nom_bal_value(12).balance_value) -- 'WAO_CONTRBUTION_AOF'
8784 , p_action_information17 => fnd_number.number_to_canonical(p_nom_bal_value(13).balance_value) -- 'WAO_CONTRBUTION_AOK'
8785 , p_action_information18 => fnd_number.number_to_canonical(p_nom_bal_value(14).balance_value) -- 'WW_AWF'
8786 , p_action_information19 => fnd_number.number_to_canonical(p_nom_bal_value(15).balance_value) -- 'c_WAITING_MONEY_FUND'
8787 , p_action_information20 => fnd_number.number_to_canonical(p_nom_bal_value(16).balance_value) -- 'UFO_CONTRIBUTION'
8788 , p_action_information21 => fnd_number.number_to_canonical(p_nom_bal_value(17).balance_value) -- 'ZVW_CONTRIBUTION'
8789 , p_action_information22 => fnd_number.number_to_canonical(p_nom_bal_value(18).balance_value) -- 'ZVW_ALLW'
8790 , p_action_information23 => fnd_number.number_to_canonical(p_nom_bal_value(19).balance_value) -- 'TRAVEL ALLW'
8791 , p_action_information24 => fnd_number.number_to_canonical(p_nom_bal_value(20).balance_value) -- 'LABOUR DISC'
8792 , p_action_information25 => fnd_number.number_to_canonical(GREATEST(p_nom_bal_value(21).balance_value,0)) -- 'SI_DAYS' ** Not req for YEarly report --16506014
8793 , p_action_information26 => fnd_number.number_to_canonical(p_nom_bal_value(22).balance_value) -- 'NO_HOURS' ** Not req for YEarly report
8794 , p_action_information27 => fnd_number.number_to_canonical(p_nom_bal_value(23).balance_value) -- 'AMOUNT_SEE_DISCONT_DAYS'
8795 , p_action_information28 => fnd_number.number_to_canonical(p_nom_bal_value(24).balance_value) -- 'WWB-ALL_ALIMONY'
8796 , p_action_information29 => fnd_number.number_to_canonical(p_nom_bal_value(25).balance_value)); -- 'DIRECTLY_PAID_ALIMONY');
8797 --
8798 END IF;
8799 ELSE
8800 pay_action_information_api.create_action_information (
8801 p_action_information_id => l_action_info_id
8802 , p_action_context_id => p_assactid
8803 , p_action_context_type => 'AAP'
8804 , p_object_version_number => l_ovn
8805 , p_assignment_id => p_assignment_id
8806 , p_effective_date => p_effective_date
8807 , p_action_information_category => 'NL_WR_NOMINATIVE_REPORT'
8808 , p_tax_unit_id => p_tax_unit_id
8809 , p_action_information1 => 'CORRECT' --p_type 10100628
8810 , p_action_information2 => p_master_action_info_id
8811 , p_action_information5 => fnd_number.number_to_canonical(p_nom_bal_value(1).balance_value)
8812 , p_action_information6 => fnd_number.number_to_canonical(p_nom_bal_value(2).balance_value)
8813 , p_action_information7 => fnd_number.number_to_canonical(p_nom_bal_value(3).balance_value) -- 'SP RATE TAXABLE INCOME'
8814 , p_action_information8 => fnd_number.number_to_canonical(p_nom_bal_value(4).balance_value) -- 'HOLIDAY ALLW' ** Not req for YEarly report
8815 , p_action_information9 => fnd_number.number_to_canonical(p_nom_bal_value(5).balance_value) -- 'RESERVATION HOLIDAY ALLW' ** Not req for YEarly report
8816 , p_action_information10 => fnd_number.number_to_canonical(p_nom_bal_value(6).balance_value) -- 'ADDITIONAL PERIOD WAGE' ** Not req for YEarly report
8817 , p_action_information11 => fnd_number.number_to_canonical(p_nom_bal_value(7).balance_value) -- 'R ADDITIONAL PERIOD WAGE' ** Not req for YEarly report
8818 , p_action_information12 => fnd_number.number_to_canonical(p_nom_bal_value(8).balance_value) -- 'WAGE_MONEY' ** Not req for YEarly report
8819 , p_action_information13 => fnd_number.number_to_canonical(p_nom_bal_value(9).balance_value) -- 'WAGE_KIND' ** Not req for YEarly report
8820 , p_action_information14 => fnd_number.number_to_canonical(p_nom_bal_value(10).balance_value) -- 'OT_WAGE' ** Not req for YEarly report
8821 , p_action_information15 => fnd_number.number_to_canonical(p_nom_bal_value(11).balance_value) -- 'WAGE_TAX'
8822 , p_action_information16 => fnd_number.number_to_canonical(p_nom_bal_value(12).balance_value) -- 'WAO_CONTRBUTION_AOF'
8823 , p_action_information17 => fnd_number.number_to_canonical(p_nom_bal_value(13).balance_value) -- 'WAO_CONTRBUTION_AOK'
8824 , p_action_information18 => fnd_number.number_to_canonical(p_nom_bal_value(14).balance_value) -- 'WW_AWF'
8825 , p_action_information19 => fnd_number.number_to_canonical(p_nom_bal_value(15).balance_value) -- 'c_WAITING_MONEY_FUND'
8826 , p_action_information20 => fnd_number.number_to_canonical(p_nom_bal_value(16).balance_value) -- 'UFO_CONTRIBUTION'
8827 , p_action_information21 => fnd_number.number_to_canonical(p_nom_bal_value(17).balance_value) -- 'ZVW_CONTRIBUTION'
8828 , p_action_information22 => fnd_number.number_to_canonical(p_nom_bal_value(18).balance_value) -- 'ZVW_ALLW'
8829 , p_action_information23 => fnd_number.number_to_canonical(p_nom_bal_value(19).balance_value) -- 'TRAVEL ALLW'
8830 , p_action_information24 => fnd_number.number_to_canonical(p_nom_bal_value(20).balance_value) -- 'LABOUR DISC'
8831 , p_action_information25 => fnd_number.number_to_canonical(p_nom_bal_value(21).balance_value) -- 'SI_DAYS' ** Not req for YEarly report
8832 , p_action_information26 => fnd_number.number_to_canonical(p_nom_bal_value(22).balance_value) -- 'NO_HOURS' ** Not req for YEarly report
8833 , p_action_information27 => fnd_number.number_to_canonical(p_nom_bal_value(23).balance_value) -- 'AMOUNT_SEE_DISCONT_DAYS'
8834 , p_action_information28 => fnd_number.number_to_canonical(p_nom_bal_value(24).balance_value) -- 'WWB-ALL_ALIMONY'
8835 , p_action_information29 => fnd_number.number_to_canonical(p_nom_bal_value(25).balance_value)); -- 'DIRECTLY_PAID_ALIMONY');
8836 --
8837 END IF;
8838
8839 l_arc_y_n := IS_ARCHIVED(p_assactid, 'NL_WR_NOMINATIVE_REPORT_ADD', 'INITIAL');
8840 IF p_type = 'INITIAL' THEN
8841 IF l_arc_y_n = 'N' THEN
8842 pay_action_information_api.create_action_information (
8843 p_action_information_id => l_action_info_id
8844 , p_action_context_id => p_assactid
8845 , p_action_context_type => 'AAP'
8846 , p_object_version_number => l_ovn
8847 , p_assignment_id => p_assignment_id
8848 , p_effective_date => p_effective_date
8849 , p_action_information_category => 'NL_WR_NOMINATIVE_REPORT_ADD'
8850 , p_tax_unit_id => p_tax_unit_id
8851 , p_action_information1 => p_type
8852 , p_action_information2 => p_master_action_info_id
8853 , p_action_information5 => fnd_number.number_to_canonical(p_nom_bal_value(26).balance_value) -- 'Private Company Car'
8854 , p_action_information6 => fnd_number.number_to_canonical(p_nom_bal_value(27).balance_value) -- 'Employee Private Company Car'
8855 , p_action_information7 => fnd_number.number_to_canonical(p_nom_bal_value(28).balance_value) -- 'Contribution Child Care' ** Not req for YEarly report
8856 , p_action_information8 => fnd_number.number_to_canonical(p_nom_bal_value(29).balance_value) -- 'Life Saving Scheme'
8857 , 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
8858 , p_action_information10 => fnd_number.number_to_canonical(p_nom_bal_value(31).balance_value)
8859 , p_action_information11 => NVL(p_corr_used,'N') -- 'Allowance paid on top of paid disability' ** Not req for YEarly report
8860 --LC 2010--begin
8861 , p_action_information12 => fnd_number.number_to_canonical(p_nom_bal_value(32).balance_value) --PrLnWao
8862 , p_action_information13 => fnd_number.number_to_canonical(p_nom_bal_value(33).balance_value) --PrLnWaoWga
8863 , p_action_information14 => fnd_number.number_to_canonical(p_nom_bal_value(34).balance_value) --PrLnWwAwf
8864 , p_action_information15 => fnd_number.number_to_canonical(p_nom_bal_value(35).balance_value) --PrLnPrSectFnds
8865 , p_action_information16 => fnd_number.number_to_canonical(p_nom_bal_value(36).balance_value) --PrLnUfo
8866 );
8867 --LC 2010--end
8868 --
8869 END IF;
8870 ELSE
8871 pay_action_information_api.create_action_information (
8872 p_action_information_id => l_action_info_id
8873 , p_action_context_id => p_assactid
8874 , p_action_context_type => 'AAP'
8875 , p_object_version_number => l_ovn
8876 , p_assignment_id => p_assignment_id
8877 , p_effective_date => p_effective_date
8878 , p_action_information_category => 'NL_WR_NOMINATIVE_REPORT_ADD'
8879 , p_tax_unit_id => p_tax_unit_id
8880 , p_action_information1 => 'CORRECT' --p_type 10100628
8881 , p_action_information2 => p_master_action_info_id
8882 , p_action_information5 => fnd_number.number_to_canonical(p_nom_bal_value(26).balance_value) -- 'Private Company Car'
8883 , p_action_information6 => fnd_number.number_to_canonical(p_nom_bal_value(27).balance_value) -- 'Employee Private Company Car'
8884 , p_action_information7 => fnd_number.number_to_canonical(p_nom_bal_value(28).balance_value) -- 'Contribution Child Care' ** Not req for YEarly report
8885 , p_action_information8 => fnd_number.number_to_canonical(p_nom_bal_value(29).balance_value) -- 'Life Saving Scheme'
8886 , 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
8887 , p_action_information10 => fnd_number.number_to_canonical(p_nom_bal_value(31).balance_value)
8888 , p_action_information11 => NVL(p_corr_used,'N') -- 'Allowance paid on top of paid disability' ** Not req for YEarly report
8889 --LC 2010--begin
8890 , p_action_information12 => fnd_number.number_to_canonical(p_nom_bal_value(32).balance_value) --PrLnWao
8891 , p_action_information13 => fnd_number.number_to_canonical(p_nom_bal_value(33).balance_value) --PrLnWaoWga
8892 , p_action_information14 => fnd_number.number_to_canonical(p_nom_bal_value(34).balance_value) --PrLnWwAwf
8893 , p_action_information15 => fnd_number.number_to_canonical(p_nom_bal_value(35).balance_value) --PrLnPrSectFnds
8894 , p_action_information16 => fnd_number.number_to_canonical(p_nom_bal_value(36).balance_value) --PrLnUfo
8895 );
8896 --LC 2010--end
8897 --
8898 END IF;
8899
8900 ELSE
8901 --10100628
8902
8903 pay_action_information_api.create_action_information (
8904 p_action_information_id => l_action_info_id
8905 , p_action_context_id => p_assactid
8906 , p_action_context_type => 'AAP'
8907 , p_object_version_number => l_ovn
8908 , p_assignment_id => p_assignment_id
8909 , p_effective_date => p_effective_date
8910 , p_action_information_category => 'NL_WR_NOMINATIVE_REPORT'
8911 , p_tax_unit_id => p_tax_unit_id
8912 , p_action_information1 => p_type
8913 , p_action_information2 => p_master_action_info_id
8914 , p_action_information5 => fnd_number.number_to_canonical(p_nom_bal_value(1).balance_value)
8915 , p_action_information6 => fnd_number.number_to_canonical(p_nom_bal_value(2).balance_value)
8916 , p_action_information7 => fnd_number.number_to_canonical(p_nom_bal_value(3).balance_value) -- 'SP RATE TAXABLE INCOME'
8917 , p_action_information8 => fnd_number.number_to_canonical(p_nom_bal_value(4).balance_value) -- 'HOLIDAY ALLW' ** Not req for YEarly report
8918 , p_action_information9 => fnd_number.number_to_canonical(p_nom_bal_value(5).balance_value) -- 'RESERVATION HOLIDAY ALLW' ** Not req for YEarly report
8919 , p_action_information10 => fnd_number.number_to_canonical(p_nom_bal_value(6).balance_value) -- 'ADDITIONAL PERIOD WAGE' ** Not req for YEarly report
8920 , p_action_information11 => fnd_number.number_to_canonical(p_nom_bal_value(7).balance_value) -- 'R ADDITIONAL PERIOD WAGE' ** Not req for YEarly report
8921 , p_action_information12 => fnd_number.number_to_canonical(p_nom_bal_value(8).balance_value) -- 'WAGE_MONEY' ** Not req for YEarly report
8922 , p_action_information13 => fnd_number.number_to_canonical(p_nom_bal_value(9).balance_value) -- 'WAGE_KIND' ** Not req for YEarly report
8923 , p_action_information14 => fnd_number.number_to_canonical(p_nom_bal_value(10).balance_value) -- 'OT_WAGE' ** Not req for YEarly report
8924 , p_action_information15 => fnd_number.number_to_canonical(p_nom_bal_value(11).balance_value) -- 'WAGE_TAX'
8925 , p_action_information16 => fnd_number.number_to_canonical(p_nom_bal_value(12).balance_value) -- 'WAO_CONTRBUTION_AOF'
8926 , p_action_information17 => fnd_number.number_to_canonical(p_nom_bal_value(13).balance_value) -- 'WAO_CONTRBUTION_AOK'
8927 , p_action_information18 => fnd_number.number_to_canonical(p_nom_bal_value(14).balance_value) -- 'WW_AWF'
8928 , p_action_information19 => fnd_number.number_to_canonical(p_nom_bal_value(15).balance_value) -- 'c_WAITING_MONEY_FUND'
8929 , p_action_information20 => fnd_number.number_to_canonical(p_nom_bal_value(16).balance_value) -- 'UFO_CONTRIBUTION'
8930 , p_action_information21 => fnd_number.number_to_canonical(p_nom_bal_value(17).balance_value) -- 'ZVW_CONTRIBUTION'
8931 , p_action_information22 => fnd_number.number_to_canonical(p_nom_bal_value(18).balance_value) -- 'ZVW_ALLW'
8932 , p_action_information23 => fnd_number.number_to_canonical(p_nom_bal_value(19).balance_value) -- 'TRAVEL ALLW'
8933 , p_action_information24 => fnd_number.number_to_canonical(p_nom_bal_value(20).balance_value) -- 'LABOUR DISC'
8934 , p_action_information25 => fnd_number.number_to_canonical(p_nom_bal_value(21).balance_value) -- 'SI_DAYS' ** Not req for YEarly report
8935 , p_action_information26 => fnd_number.number_to_canonical(p_nom_bal_value(22).balance_value) -- 'NO_HOURS' ** Not req for YEarly report
8936 , p_action_information27 => fnd_number.number_to_canonical(p_nom_bal_value(23).balance_value) -- 'AMOUNT_SEE_DISCONT_DAYS'
8937 , p_action_information28 => fnd_number.number_to_canonical(p_nom_bal_value(24).balance_value) -- 'WWB-ALL_ALIMONY'
8938 , p_action_information29 => fnd_number.number_to_canonical(p_nom_bal_value(25).balance_value)); -- 'DIRECTLY_PAID_ALIMONY');
8939 --
8940 pay_action_information_api.create_action_information (
8941 p_action_information_id => l_action_info_id
8942 , p_action_context_id => p_assactid
8943 , p_action_context_type => 'AAP'
8944 , p_object_version_number => l_ovn
8945 , p_assignment_id => p_assignment_id
8946 , p_effective_date => p_effective_date
8947 , p_action_information_category => 'NL_WR_NOMINATIVE_REPORT_ADD'
8948 , p_tax_unit_id => p_tax_unit_id
8949 , p_action_information1 => p_type
8950 , p_action_information2 => p_master_action_info_id
8951 , p_action_information5 => fnd_number.number_to_canonical(p_nom_bal_value(26).balance_value) -- 'Private Company Car'
8952 , p_action_information6 => fnd_number.number_to_canonical(p_nom_bal_value(27).balance_value) -- 'Employee Private Company Car'
8953 , p_action_information7 => fnd_number.number_to_canonical(p_nom_bal_value(28).balance_value) -- 'Contribution Child Care' ** Not req for YEarly report
8954 , p_action_information8 => fnd_number.number_to_canonical(p_nom_bal_value(29).balance_value) -- 'Life Saving Scheme'
8955 , 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
8956 , p_action_information10 => fnd_number.number_to_canonical(p_nom_bal_value(31).balance_value)
8957 , p_action_information11 => NVL(p_corr_used,'N') -- 'Allowance paid on top of paid disability' ** Not req for YEarly report
8958 --LC 2010--begin
8959 , p_action_information12 => fnd_number.number_to_canonical(p_nom_bal_value(32).balance_value) --PrLnWao
8960 , p_action_information13 => fnd_number.number_to_canonical(p_nom_bal_value(33).balance_value) --PrLnWaoWga
8961 , p_action_information14 => fnd_number.number_to_canonical(p_nom_bal_value(34).balance_value) --PrLnWwAwf
8962 , p_action_information15 => fnd_number.number_to_canonical(p_nom_bal_value(35).balance_value) --PrLnPrSectFnds
8963 , p_action_information16 => fnd_number.number_to_canonical(p_nom_bal_value(36).balance_value) --PrLnUfo
8964 );
8965 --LC 2010--end
8966 --
8967 END IF;
8968
8969 END archive_nominative_data;
8970 --------------------------------------------------------------------------------
8971 -- GET_ASSIGNMENT_EXTRA_INFO
8972 --------------------------------------------------------------------------------
8973 PROCEDURE get_assignment_extra_info(p_assignment_id IN NUMBER
8974 ,p_surrogate_key IN NUMBER
8975 ,p_eff_date IN DATE
8976 ,p_start_date IN DATE
8977 ,p_end_date IN DATE
8978 ,p_labour_rel_code IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
8979 ,p_ins_duty_code IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
8980 ,p_FZ_Code IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
8981 ,p_handicapped_code IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
8982 ,p_wao_insured IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
8983 ,p_ww_insured IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
8984 ,p_zw_insured IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
8985 ,p_zvw_situation IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
8986 /*LC 2010*/ ,p_marginal_empl IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
8987 /*LC 2010*/ ,p_wm_old_rule IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
8988 /*LC 2013*/ ,p_temp_tax_discount IN OUT NOCOPY PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type
8989 ,p_chk IN OUT NOCOPY VARCHAR2) IS
8990 --
8991 CURSOR csr_get_ass_extra_info(c_a_extra_info_id NUMBER) IS
8992 SELECT fnd_date.canonical_to_date(aei_information1) start_date
8993 ,fnd_date.canonical_to_date(aei_information2) end_date
8994 ,aei_information3 info1
8995 ,aei_information15 info2
8996 ,aei_information_category
8997 FROM per_assignment_extra_info
8998 WHERE assignment_extra_info_id = c_a_extra_info_id
8999 AND aei_information_category IN ('NL_LBR','NL_INF','NL_TML','NL_LHI','NL_SII',
9000 'NL_MEI','NL_WMR','NL_TTD'); /*LC 2010 and LC 2013*/
9001 --
9002 CURSOR csr_get_all_ass_extra_info(c_assignment_id NUMBER) IS
9003 SELECT fnd_date.canonical_to_date(aei_information1) start_date
9004 ,fnd_date.canonical_to_date(aei_information2) end_date
9005 ,aei_information3 info1
9006 ,aei_information15 info2
9007 ,aei_information_category
9008 FROM per_assignment_extra_info
9009 WHERE assignment_id = c_assignment_id
9010 AND aei_information_category IN ('NL_LBR','NL_INF','NL_TML','NL_LHI','NL_SII',
9011 'NL_MEI','NL_WMR','NL_TTD') /*LC 2010 and LC 2013*/
9012 --9257875
9013 /* AND p_end_date BETWEEN fnd_date.canonical_to_date(aei_information1)
9014 AND nvl(fnd_date.canonical_to_date(aei_information2),to_date('31-12-4712','dd-mm-yyyy')) */
9015 --9257875
9016
9017 --10377795 START. Commented above code.
9018 AND fnd_date.date_to_canonical (p_end_date) BETWEEN aei_information1
9019 AND nvl(aei_information2,fnd_date.date_to_canonical(to_date('31-12-4712','dd-mm-yyyy')))
9020 --10377795 END
9021 ORDER BY 1 DESC;
9022 --
9023 --rsahai--Labour Handicapped discount - New Code 7 Changes : 2009 changes - START
9024 CURSOR csr_all_ass_extra_info_code6_9(c_assignment_id NUMBER) IS
9025 SELECT aei_information3 info1
9026 FROM per_assignment_extra_info
9027 WHERE assignment_id = c_assignment_id
9028 AND aei_information_category = 'NL_LHI'
9029 AND p_end_date BETWEEN fnd_date.canonical_to_date(aei_information1)
9030 AND nvl(fnd_date.canonical_to_date(aei_information2),to_date('31-12-4712','dd-mm-yyyy'))
9031 AND aei_information3 not in ('0','1','2','3','4');
9032
9033 CURSOR csr_get_ass_bdate(c_assignment_id NUMBER) IS
9034 select papf.date_of_birth, TRUNC(MONTHS_BETWEEN(p_end_date,papf.date_of_birth)/12) Age
9035 from
9036 per_all_people_f papf,
9037 per_all_assignments_f paaf
9038 where paaf.assignment_id = c_assignment_id
9039 AND papf.person_id = paaf.person_id
9040 AND p_end_date between paaf.effective_start_date and paaf.effective_end_date
9041 AND p_end_date between papf.effective_start_date and papf.effective_end_date
9042 AND papf.date_of_birth is not null;
9043 --rsahai--Labour Handicapped discount - New Code 7 Changes : 2009 changes - End
9044 --
9045 l_labour_rel_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9046 l_ins_duty_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9047 l_FZ_Code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9048 l_handicapped_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9049 l_wao_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9050 l_ww_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9051 l_zw_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9052 l_zvw_situation PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9053 l_labour_rel_code1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9054 l_ins_duty_code1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9055 l_FZ_Code1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9056 l_handicapped_code1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9057 l_wao_insured1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9058 l_ww_insured1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9059 l_zw_insured1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9060 l_zvw_situation1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9061 --rsahai--Labour Handicapped discount - New Code 7 Changes : 2009 changes - START
9062 l_handicapped_code_new PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9063 l_bdate date;
9064 l_age number;
9065 --rsahai--Labour Handicapped discount - New Code 7 Changes : 2009 changes - END
9066 l_marginal_empl PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9067 l_wm_old_rule PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9068 l_marginal_empl1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9069 l_wm_old_rule1 PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
9070
9071 l_temp_tax_discount PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type; /*LC 2013*/
9072
9073 --
9074 BEGIN
9075 --
9076 l_labour_rel_code1 := p_labour_rel_code ;
9077 l_ins_duty_code1 := p_ins_duty_code ;
9078 l_FZ_Code1 := p_FZ_Code ;
9079 l_handicapped_code1 := p_handicapped_code;
9080 l_wao_insured1 := NVL(p_wao_insured,'N');
9081 l_ww_insured1 := NVL(p_ww_insured,'N');
9082 l_zw_insured1 := NVL(p_zw_insured,'N');
9083 l_zvw_situation1 := p_zvw_situation;
9084 l_marginal_empl1 := p_marginal_empl; /*LC 2010*/
9085 l_wm_old_rule1 := p_wm_old_rule; /*LC 2010*/
9086 --
9087 l_labour_rel_code := NULL;
9088 l_ins_duty_code := NULL;
9089 l_FZ_Code := NULL;
9090 l_handicapped_code := NULL;
9091 l_wao_insured := NULL;
9092 l_ww_insured := NULL;
9093 l_zw_insured := NULL;
9094 l_zvw_situation := NULL;
9095 l_marginal_empl := NULL; /*LC 2010*/
9096 l_wm_old_rule := NULL; /*LC 2010*/
9097 l_temp_tax_discount := NULL; /*LC 2013*/
9098
9099 --rsahai--Labour Handicapped discount - New Code 7 Changes : 2009 changes - START
9100 l_handicapped_code_new := NULL;
9101 l_bdate := NULL;
9102 l_age := NULL;
9103 --rsahai--Labour Handicapped discount - New Code 7 Changes : 2009 changes - END
9104
9105 --
9106 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ Inside get_assignment_extra_info'||p_assignment_id);
9107 IF p_surrogate_key IS NULL THEN
9108 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_surrogate_key is null');
9109 FOR i in csr_get_all_ass_extra_info(p_assignment_id) LOOP
9110 IF p_eff_date BETWEEN i.start_date AND NVL(i.end_date,fnd_date.canonical_to_date('4712/12/31'))
9111 OR p_end_date BETWEEN i.start_date AND NVL(i.end_date,fnd_date.canonical_to_date('4712/12/31')) --9257875
9112 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
9113 --
9114 IF i.aei_information_category = 'NL_LBR' AND l_labour_rel_code IS NULL THEN
9115 l_labour_rel_code := i.info1;
9116 ELSIF i.aei_information_category = 'NL_INF' AND l_ins_duty_code IS NULL THEN
9117 l_ins_duty_code := i.info1;
9118 ELSIF i.aei_information_category = 'NL_TML' AND l_FZ_Code IS NULL THEN
9119 l_FZ_Code := i.info1;
9120 ELSIF i.aei_information_category = 'NL_LHI' AND l_handicapped_code IS NULL THEN
9121 l_handicapped_code := i.info1;
9122 ELSIF i.aei_information_category = 'NL_TTD' THEN /* LC 2013 Begin*/
9123 IF i.info1 IN ('1','2') AND l_temp_tax_discount IS NULL THEN
9124 l_temp_tax_discount := 'J';
9125 ELSE
9126 l_temp_tax_discount := 'N';
9127 END IF; /* LC 2013 End*/
9128 ELSIF i.aei_information_category = 'NL_SII' THEN
9129 IF i.info1 IN ('AMI','WAO') AND l_wao_insured IS NULL THEN
9130 l_wao_insured := 'J';
9131 END IF;
9132 IF i.info1 IN ('AMI','WW') AND l_ww_insured IS NULL THEN
9133 l_ww_insured := 'J';
9134 END IF;
9135 IF i.info1 IN ('AMI','ZW') AND l_zw_insured IS NULL THEN
9136 l_zw_insured := 'J';
9137 END IF;
9138 IF i.info1 IN ('AMI','ZVW','ZVWS','ZVWL') AND l_zvw_situation IS NULL THEN
9139 l_zvw_situation := i.info2;
9140 END IF;
9141 --LC 2010--begin
9142 ELSIF i.aei_information_category = 'NL_MEI' THEN
9143 IF i.info1='Y' THEN
9144 l_marginal_empl := 'J';
9145 END IF;
9146 ELSIF i.aei_information_category = 'NL_WMR' THEN
9147 IF i.info1='Y' THEN
9148 l_wm_old_rule := 'J';
9149 END IF;
9150 --LC 2010--end
9151 --
9152 END IF;
9153 END IF;
9154 END LOOP;
9155 ELSE
9156 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_surrogate_key is not null');
9157 FOR i in csr_get_ass_extra_info(p_surrogate_key) LOOP
9158 --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
9159 IF i.aei_information_category = 'NL_LBR' THEN
9160 l_labour_rel_code := i.info1;
9161 ELSIF i.aei_information_category = 'NL_INF' THEN
9162 l_ins_duty_code := i.info1;
9163 ELSIF i.aei_information_category = 'NL_TML' THEN
9164 l_FZ_Code := i.info1;
9165 ELSIF i.aei_information_category = 'NL_LHI' THEN
9166 l_handicapped_code := i.info1;
9167 ELSIF i.aei_information_category = 'NL_TTD' THEN /* LC 2013 Begin*/
9168 IF i.info1 IN ('1','2') AND l_temp_tax_discount IS NULL THEN
9169 l_temp_tax_discount := 'J';
9170 ELSE
9171 l_temp_tax_discount := 'N';
9172 END IF; /* LC 2013 End*/
9173 ELSIF i.aei_information_category = 'NL_SII' THEN
9174 l_wao_insured := 'N';
9175 l_ww_insured := 'N';
9176 l_zw_insured := 'N';
9177 IF i.info1 IN ('AMI','WAO') THEN
9178 l_wao_insured := 'J';
9179 END IF;
9180 IF i.info1 IN ('AMI','WW') THEN
9181 l_ww_insured := 'J';
9182 END IF;
9183 IF i.info1 IN ('AMI','ZW') THEN
9184 l_zw_insured := 'J';
9185 END IF;
9186 IF i.info1 IN ('AMI','ZVW','ZVWS','ZVWL') THEN
9187 l_zvw_situation := i.info2;
9188 END IF;
9189 --LC 2010--begin
9190 ELSIF i.aei_information_category = 'NL_MEI' THEN
9191 IF i.info1='Y' THEN
9192 l_marginal_empl := 'J';
9193 END IF;
9194 ELSIF i.aei_information_category = 'NL_WMR' THEN
9195 IF i.info1='Y' THEN
9196 l_wm_old_rule := 'J';
9197 END IF;
9198 --LC 2010--end
9199 END IF;
9200 --END IF;
9201 END LOOP;
9202 END IF;
9203
9204 --LC 2012
9205 IF l_zvw_situation = 'J' AND p_end_date >= TO_DATE('01012012','DDMMYYYY') THEN
9206 l_zvw_situation := NULL;
9207 END IF;
9208 --LC 2012
9209
9210 --rsahai--Labour Handicapped discount - New Code 7 Changes : 2009 changes - START
9211
9212 OPEN csr_all_ass_extra_info_code6_9(p_assignment_id);
9213 FETCH csr_all_ass_extra_info_code6_9 INTO l_handicapped_code_new;
9214 CLOSE csr_all_ass_extra_info_code6_9;
9215
9216 OPEN csr_get_ass_bdate(p_assignment_id);
9217 FETCH csr_get_ass_bdate INTO l_bdate, l_age;
9218 CLOSE csr_get_ass_bdate;
9219
9220 IF l_handicapped_code_new is NULL AND l_age >= 62 AND l_age < 65
9221 THEN
9222 l_handicapped_code := '7';
9223 ELSIF l_handicapped_code_new IS NOT NULL
9224 THEN
9225 l_handicapped_code := l_handicapped_code_new;
9226 END IF;
9227
9228 --rsahai--Labour Handicapped discount - New Code 7 Changes : 2009 changes - END
9229 --
9230 p_labour_rel_code := l_labour_rel_code ;
9231 p_ins_duty_code := l_ins_duty_code ;
9232 p_FZ_Code := l_FZ_Code ;
9233 p_handicapped_code := l_handicapped_code;
9234 p_wao_insured := NVL(l_wao_insured,'N');
9235 p_ww_insured := NVL(l_ww_insured,'N');
9236 p_zw_insured := NVL(l_zw_insured,'N');
9237 p_zvw_situation := l_zvw_situation;
9238 p_marginal_empl := l_marginal_empl; /*LC 2010*/
9239 p_wm_old_rule := l_wm_old_rule; /*LC 2010*/
9240 p_temp_tax_discount:= NVL(l_temp_tax_discount,'N'); /*LC 2013*/
9241 p_chk := 'N';
9242 IF nvl(p_labour_rel_code,'X') <> nvl(l_labour_rel_code1,'X') OR
9243 nvl(p_ins_duty_code,'X') <> nvl(l_ins_duty_code1,'X') OR
9244 nvl(p_FZ_Code,'X') <> nvl(l_FZ_Code1,'X') OR
9245 nvl(p_handicapped_code,'X') <> nvl(l_handicapped_code1,'X') OR
9246 nvl(p_wao_insured,'X') <> nvl(l_wao_insured1,'X') OR
9247 nvl(p_ww_insured,'X') <> nvl(l_ww_insured1,'X') OR
9248 nvl(p_zw_insured,'X') <> nvl(l_zw_insured1,'X') OR
9249 nvl(p_zvw_situation,'X') <> nvl(l_zvw_situation1,'X') OR
9250 nvl(p_marginal_empl,'X') <> nvl(l_marginal_empl1,'X') OR /*LC 2010*/
9251 nvl(p_wm_old_rule,'X') <> nvl(l_wm_old_rule1,'X') OR /*LC 2010*/
9252 nvl(p_temp_tax_discount,'X')<> nvl(l_temp_tax_discount,'X') THEN /*LC 2013*/
9253 p_chk := 'Y';
9254 END IF;
9255 --
9256 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_labour_rel_code '||p_labour_rel_code );
9257 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_ins_duty_code '||p_ins_duty_code );
9258 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_FZ_Code '||p_FZ_Code );
9259 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_handicapped_code'||p_handicapped_code);
9260 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_wao_insured '||p_wao_insured );
9261 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_ww_insured '||p_ww_insured );
9262 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_zw_insured '||p_zw_insured );
9263 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_zvw_situation '||p_zvw_situation );
9264 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_marginal_empl '||p_marginal_empl );
9265 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~~ p_wm_old_rule '||p_wm_old_rule );
9266 --
9267 END get_assignment_extra_info;
9268 --
9269 --------------------------------------------------------------------------------
9270 -- COPY
9271 --------------------------------------------------------------------------------
9272 PROCEDURE copy(p_copy_from IN OUT NOCOPY pay_interpreter_pkg.t_detailed_output_table_type
9273 ,p_from IN NUMBER
9274 ,p_copy_to IN OUT NOCOPY pay_interpreter_pkg.t_detailed_output_table_type
9275 ,p_to IN NUMBER) IS
9276 BEGIN
9277 --
9278 p_copy_to(p_to).dated_table_id := p_copy_from(p_from).dated_table_id;
9279 p_copy_to(p_to).datetracked_event := p_copy_from(p_from).datetracked_event;
9280 p_copy_to(p_to).surrogate_key := p_copy_from(p_from).surrogate_key;
9281 p_copy_to(p_to).update_type := p_copy_from(p_from).update_type;
9282 p_copy_to(p_to).column_name := p_copy_from(p_from).column_name;
9283 p_copy_to(p_to).effective_date := p_copy_from(p_from).effective_date;
9284 p_copy_to(p_to).old_value := p_copy_from(p_from).old_value;
9285 p_copy_to(p_to).new_value := p_copy_from(p_from).new_value;
9286 p_copy_to(p_to).change_values := p_copy_from(p_from).change_values;
9287 p_copy_to(p_to).proration_type := p_copy_from(p_from).proration_type;
9288 p_copy_to(p_to).change_mode := p_copy_from(p_from).change_mode;
9289 p_copy_to(p_to).element_entry_id := p_copy_from(p_from).element_entry_id;
9290 --
9291 END copy;
9292 --
9293 --------------------------------------------------------------------------------
9294 -- SORT_CHANGES
9295 --------------------------------------------------------------------------------
9296 PROCEDURE sort_changes(p_detail_tab IN OUT NOCOPY pay_interpreter_pkg.t_detailed_output_table_type) IS
9297 --
9298 l_temp_table pay_interpreter_pkg.t_detailed_output_table_type;
9299 --
9300 BEGIN
9301 IF p_detail_tab.count > 0 THEN
9302 FOR i IN p_detail_tab.first..p_detail_tab.last LOOP
9303 --x := i + 1;
9304 FOR j IN i+1..p_detail_tab.last LOOP
9305 IF p_detail_tab(j).effective_date < p_detail_tab(i).effective_date THEN
9306 copy(p_detail_tab,j,l_temp_table,1);
9307 copy(p_detail_tab,i,p_detail_tab,j);
9308 copy(l_temp_table,1,p_detail_tab,i);
9309 END IF;
9310 END LOOP;
9311 END LOOP;
9312 END IF;
9313 --
9314 /*IF p_detail_tab.count > 0 THEN
9315 FOR i IN p_detail_tab.first..p_detail_tab.last LOOP
9316 --##--Fnd_file.put_line(FND_FILE.LOG,'#######~Record : '||i);
9317 --##--Fnd_file.put_line(FND_FILE.LOG,'#######dated_table_id : '||p_detail_tab(i).dated_table_id);
9318 --##--Fnd_file.put_line(FND_FILE.LOG,'#######datetracked_event : '||p_detail_tab(i).datetracked_event);
9319 --##--Fnd_file.put_line(FND_FILE.LOG,'#######surrogate_key : '||p_detail_tab(i).surrogate_key);
9320 --##--Fnd_file.put_line(FND_FILE.LOG,'#######update_type : '||p_detail_tab(i).update_type);
9321 --##--Fnd_file.put_line(FND_FILE.LOG,'#######column_name : '||p_detail_tab(i).column_name);
9322 --##--Fnd_file.put_line(FND_FILE.LOG,'#######effective_date : '||p_detail_tab(i).effective_date);
9323 --##--Fnd_file.put_line(FND_FILE.LOG,'#######old_value : '||p_detail_tab(i).old_value);
9324 --##--Fnd_file.put_line(FND_FILE.LOG,'#######new_value : '||p_detail_tab(i).new_value);
9325 --##--Fnd_file.put_line(FND_FILE.LOG,'#######change_values : '||p_detail_tab(i).change_values);
9326 --##--Fnd_file.put_line(FND_FILE.LOG,'#######proration_type : '||p_detail_tab(i).proration_type);
9327 --##--Fnd_file.put_line(FND_FILE.LOG,'#######change_mode : '||p_detail_tab(i).change_mode);
9328 --##--Fnd_file.put_line(FND_FILE.LOG,'#######element_entry_id : '||p_detail_tab(i).element_entry_id);
9329 END LOOP;
9330 END IF;*/
9331 --
9332 END sort_changes;
9333 --
9334 --------------------------------------------------------------------------------
9335 -- GET_ASSIGNMENT_CHANGES
9336 --------------------------------------------------------------------------------
9337 PROCEDURE get_assignment_changes(p_assignment_id IN NUMBER
9338 ,p_start_date IN DATE
9339 ,p_end_date IN DATE
9340 ,p_ass_start_date IN DATE
9341 ,p_event_group_id IN pay_event_groups.event_group_id%TYPE
9342 ,p_detail_tab IN OUT NOCOPY pay_interpreter_pkg.t_detailed_output_table_type) IS
9343 CURSOR csr_get_element_entries(c_assignment_id NUMBER
9344 ,c_eff_date DATE) IS
9345 SELECT peef.element_entry_id
9346 FROM pay_element_entries_f peef
9347 ,pay_element_types_f pet
9348 WHERE pet.element_name IN ('Holiday Coupons','Incidental Income Decrease','Additional Allowance','Company Car Private Usage')
9349 AND pet.legislation_code = 'NL'
9350 AND peef.assignment_id = c_assignment_id
9351 AND peef.element_type_id = pet.element_type_id
9352 AND c_eff_date BETWEEN peef.effective_start_date
9353 AND peef.effective_end_date
9354 AND c_eff_date BETWEEN pet.effective_start_date
9355 AND pet.effective_end_date;
9356 --
9357 CURSOR csr_get_table_id(c_table_name VARCHAR2) IS
9358 SELECT dated_table_id
9359 FROM pay_dated_tables
9360 WHERE TABLE_NAME = c_table_name;
9361 --
9362 CURSOR csr_get_eit_effective_date(c_a_extra_info_id NUMBER) IS
9363 SELECT fnd_date.canonical_to_date(aei_information1) start_date
9364 FROM per_assignment_extra_info
9365 WHERE assignment_extra_info_id = c_a_extra_info_id
9366 AND aei_information_category IN ('NL_LBR','NL_INF','NL_TML','NL_LHI','NL_SII'--);
9367 ,'NL_MEI','NL_WMR'); /*LC 2010*/
9368 --
9369 l_proration_dates pay_interpreter_pkg.t_proration_dates_table_type;
9370 l_proration_changes pay_interpreter_pkg.t_proration_type_table_type;
9371 l_detail_tab pay_interpreter_pkg.t_detailed_output_table_type;
9372 l_pro_type_tab pay_interpreter_pkg.t_proration_type_table_type;
9373 --
9374 l_index NUMBER;
9375 l_cnt NUMBER;
9376 l_eff_date DATE;
9377 l_table1 pay_dated_tables.dated_table_id%type;
9378 l_table2 pay_dated_tables.dated_table_id%type;
9379 l_table3 pay_dated_tables.dated_table_id%type;
9380 --
9381 BEGIN
9382 --
9383 OPEN csr_get_table_id('PAY_ELEMENT_ENTRIES_F');
9384 FETCH csr_get_table_id INTO l_table1;
9385 CLOSE csr_get_table_id;
9386 --
9387 OPEN csr_get_table_id('PAY_ELEMENT_ENTRY_VALUES_F');
9388 FETCH csr_get_table_id INTO l_table2;
9389 CLOSE csr_get_table_id;
9390 --
9391 OPEN csr_get_table_id('PER_ASSIGNMENT_EXTRA_INFO');
9392 FETCH csr_get_table_id INTO l_table3;
9393 CLOSE csr_get_table_id;
9394 --
9395 --##--Fnd_file.put_line(FND_FILE.LOG,'#######dated_table_id PAY_ELEMENT_ENTRIES_F : '||l_table1);
9396 --##--Fnd_file.put_line(FND_FILE.LOG,'#######dated_table_id PAY_ELEMENT_ENTRY_VALUES_F : '||l_table1);
9397 --##--Fnd_file.put_line(FND_FILE.LOG,'#######dated_table_id PER_ASSIGNMENT_EXTRA_INFO : '||l_table1);
9398 l_cnt := 1;
9399 FOR c_rec IN csr_get_element_entries(p_assignment_id,p_end_date) LOOP
9400 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Calling interpretor for element_entry_id : '||c_rec.element_entry_id);
9401 BEGIN
9402 pay_interpreter_pkg.entry_affected(
9403 p_element_entry_id => c_rec.element_entry_id
9404 ,p_assignment_action_id => NULL
9405 ,p_assignment_id => p_assignment_id
9406 ,p_mode => 'REPORTS'
9407 ,p_process => 'P'
9408 ,p_event_group_id => p_event_group_id
9409 ,p_process_mode => 'ENTRY_CREATION_DATE' --ENTRY_CREATION_DATE
9410 ,p_start_date => p_start_date - 1
9411 ,p_end_date => p_end_date + 1
9412 ,t_detailed_output => l_detail_tab
9413 ,t_proration_dates => l_proration_dates
9414 ,t_proration_change_type => l_proration_changes
9415 ,t_proration_type => l_pro_type_tab );
9416 EXCEPTION
9417 WHEN NO_DATA_FOUND THEN
9418 l_detail_tab.delete;
9419 --##--Fnd_file.put_line(FND_FILE.LOG,'####### in Exception NO_DATA_FOUND Elements');
9420 WHEN OTHERS THEN
9421 l_detail_tab.delete;
9422 --##--Fnd_file.put_line(FND_FILE.LOG,'####### in Exception OTHERS Elements');
9423 END;
9424 --
9425 l_index := p_detail_tab.count;
9426 --##--Fnd_file.put_line(FND_FILE.LOG,'####### No of records fetched : '||l_detail_tab.count);
9427 IF l_detail_tab.count <> 0 THEN
9428 FOR i IN l_detail_tab.first..l_detail_tab.last LOOP
9429 IF (l_cnt = 1 OR (l_detail_tab(i).dated_table_id = l_table1 OR l_detail_tab(i).dated_table_id = l_table2))
9430 AND l_detail_tab(i).effective_date <= p_end_date THEN
9431 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Table : '||l_detail_tab(i).dated_table_id);
9432 --##--Fnd_file.put_line(FND_FILE.LOG,'####### column : '||l_detail_tab(i).column_name);
9433 IF l_detail_tab(i).column_name LIKE 'AEI_INFORMATION%' OR
9434 l_detail_tab(i).dated_table_id = l_table3 THEN
9435 OPEN csr_get_eit_effective_date(l_detail_tab(i).surrogate_key);
9436 FETCH csr_get_eit_effective_date INTO l_eff_date;
9437 IF csr_get_eit_effective_date%FOUND THEN
9438 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Element entry effective date : '||l_eff_date);
9439 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
9440 l_index := l_index + 1;
9441 p_detail_tab(l_index).dated_table_id := l_detail_tab(i).dated_table_id;
9442 p_detail_tab(l_index).datetracked_event := l_detail_tab(i).datetracked_event;
9443 p_detail_tab(l_index).surrogate_key := l_detail_tab(i).surrogate_key;
9444 p_detail_tab(l_index).update_type := l_detail_tab(i).update_type;
9445 p_detail_tab(l_index).column_name := l_detail_tab(i).column_name;
9446 p_detail_tab(l_index).effective_date := GREATEST(l_eff_date,p_ass_start_date);
9447 p_detail_tab(l_index).old_value := l_detail_tab(i).old_value;
9448 p_detail_tab(l_index).new_value := l_detail_tab(i).new_value;
9449 p_detail_tab(l_index).change_values := l_detail_tab(i).change_values;
9450 p_detail_tab(l_index).proration_type := l_detail_tab(i).proration_type;
9451 p_detail_tab(l_index).change_mode := l_detail_tab(i).change_mode;
9452 END IF;
9453 END IF;
9454 CLOSE csr_get_eit_effective_date;
9455 ELSIF l_detail_tab(i).effective_date >= to_date('01-01-'||to_char(p_start_date,'YYYY'),'dd-mm-yyyy') THEN
9456 l_index := l_index + 1;
9457 p_detail_tab(l_index).dated_table_id := l_detail_tab(i).dated_table_id;
9458 p_detail_tab(l_index).datetracked_event := l_detail_tab(i).datetracked_event;
9459 p_detail_tab(l_index).surrogate_key := l_detail_tab(i).surrogate_key;
9460 p_detail_tab(l_index).update_type := l_detail_tab(i).update_type;
9461 p_detail_tab(l_index).column_name := l_detail_tab(i).column_name;
9462 p_detail_tab(l_index).effective_date := GREATEST(l_detail_tab(i).effective_date,p_ass_start_date);
9463 p_detail_tab(l_index).old_value := l_detail_tab(i).old_value;
9464 p_detail_tab(l_index).new_value := l_detail_tab(i).new_value;
9465 p_detail_tab(l_index).change_values := l_detail_tab(i).change_values;
9466 p_detail_tab(l_index).proration_type := l_detail_tab(i).proration_type;
9467 p_detail_tab(l_index).change_mode := l_detail_tab(i).change_mode;
9468 IF (l_detail_tab(i).dated_table_id = l_table1 OR l_detail_tab(i).dated_table_id = l_table2) THEN
9469 p_detail_tab(l_index).element_entry_id:= l_detail_tab(i).element_entry_id;
9470 END IF;
9471 END IF;
9472 END IF;
9473 END LOOP;
9474 END IF;
9475 l_cnt := l_cnt + 1;
9476 END LOOP;
9477 IF l_cnt = 1 THEN
9478 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Calling interpretor for assignment : '||p_assignment_id);
9479 BEGIN
9480 pay_interpreter_pkg.entry_affected(
9481 p_element_entry_id => NULL
9482 ,p_assignment_action_id => NULL
9483 ,p_assignment_id => p_assignment_id
9484 ,p_mode => 'REPORTS'
9485 ,p_process => 'P'
9486 ,p_event_group_id => p_event_group_id
9487 ,p_process_mode => 'ENTRY_CREATION_DATE' --ENTRY_CREATION_DATE
9488 ,p_start_date => p_start_date
9489 ,p_end_date => p_end_date
9490 ,t_detailed_output => l_detail_tab
9491 ,t_proration_dates => l_proration_dates
9492 ,t_proration_change_type => l_proration_changes
9493 ,t_proration_type => l_pro_type_tab );
9494 EXCEPTION
9495 WHEN NO_DATA_FOUND THEN
9496 l_detail_tab.delete;
9497 --##--Fnd_file.put_line(FND_FILE.LOG,'####### in Exception NO_DATA_FOUND ');
9498 WHEN OTHERS THEN
9499 l_detail_tab.delete;
9500 --##--Fnd_file.put_line(FND_FILE.LOG,'####### in Exception OTHERS ');
9501 END;
9502 --##--Fnd_file.put_line(FND_FILE.LOG,'####### No of records fetched : '||l_detail_tab.count);
9503 --
9504 l_index := p_detail_tab.count;
9505 IF l_detail_tab.count <> 0 THEN
9506 FOR i IN l_detail_tab.first..l_detail_tab.last LOOP
9507 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Table : '||l_detail_tab(i).dated_table_id);
9508 --##--Fnd_file.put_line(FND_FILE.LOG,'####### column : '||l_detail_tab(i).column_name);
9509 IF l_detail_tab(i).effective_date <= p_end_date THEN
9510 IF l_detail_tab(i).column_name LIKE 'AEI_INFORMATION%'
9511 OR l_detail_tab(i).dated_table_id = l_table3 THEN
9512 --Fnd_file.put_line(FND_FILE.LOG,'~~~~~ get_assignment_changes 14');
9513 OPEN csr_get_eit_effective_date(l_detail_tab(i).surrogate_key);
9514 FETCH csr_get_eit_effective_date INTO l_eff_date;
9515 IF csr_get_eit_effective_date%FOUND THEN
9516 --##--Fnd_file.put_line(FND_FILE.LOG,'####### Element entry effective date : '||l_eff_date);
9517 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
9518 l_index := l_index + 1;
9519 p_detail_tab(l_index).dated_table_id := l_detail_tab(i).dated_table_id;
9520 p_detail_tab(l_index).datetracked_event := l_detail_tab(i).datetracked_event;
9521 p_detail_tab(l_index).surrogate_key := l_detail_tab(i).surrogate_key;
9522 p_detail_tab(l_index).update_type := l_detail_tab(i).update_type;
9523 p_detail_tab(l_index).column_name := l_detail_tab(i).column_name;
9524 p_detail_tab(l_index).effective_date := GREATEST(l_eff_date,p_ass_start_date);
9525 p_detail_tab(l_index).old_value := l_detail_tab(i).old_value;
9526 p_detail_tab(l_index).new_value := l_detail_tab(i).new_value;
9527 p_detail_tab(l_index).change_values := l_detail_tab(i).change_values;
9528 p_detail_tab(l_index).proration_type := l_detail_tab(i).proration_type;
9529 p_detail_tab(l_index).change_mode := l_detail_tab(i).change_mode;
9530 END IF;
9531 END IF;
9532 CLOSE csr_get_eit_effective_date;
9533 ELSIF l_detail_tab(i).effective_date >= to_date('01-01-'||to_char(p_start_date,'YYYY'),'dd-mm-yyyy') THEN
9534 l_index := l_index + 1;
9535 p_detail_tab(l_index).dated_table_id := l_detail_tab(i).dated_table_id;
9536 p_detail_tab(l_index).datetracked_event := l_detail_tab(i).datetracked_event;
9537 p_detail_tab(l_index).surrogate_key := l_detail_tab(i).surrogate_key;
9538 p_detail_tab(l_index).update_type := l_detail_tab(i).update_type;
9539 p_detail_tab(l_index).column_name := l_detail_tab(i).column_name;
9540 p_detail_tab(l_index).effective_date := GREATEST(l_detail_tab(i).effective_date,p_ass_start_date);
9541 p_detail_tab(l_index).old_value := l_detail_tab(i).old_value;
9542 p_detail_tab(l_index).new_value := l_detail_tab(i).new_value;
9543 p_detail_tab(l_index).change_values := l_detail_tab(i).change_values;
9544 p_detail_tab(l_index).proration_type := l_detail_tab(i).proration_type;
9545 p_detail_tab(l_index).change_mode := l_detail_tab(i).change_mode;
9546 END IF;
9547 END IF;
9548 END LOOP;
9549 END IF;
9550 END IF;
9551 EXCEPTION
9552 WHEN OTHERS THEN
9553 --Fnd_file.put_line(FND_FILE.LOG,' in Exception get_assignment_changes');
9554 FND_FILE.PUT_LINE(fnd_file.output,'Exception at Assignment ID: '||p_assignment_id||' Error : '||sqlerrm(sqlcode));
9555 --NULL;--10377795
9556 END get_assignment_changes;
9557 --
9558 --------------------------------------------------------------------------------
9559 -- GET_ASSIGNMENT_CHANGES
9560 --------------------------------------------------------------------------------
9561 PROCEDURE remove_withdrawal_period_chg(p_rec_changes_init IN Rec_Changes
9562 ,p_rec_changes IN OUT NOCOPY Rec_Changes) IS
9563 l_period_start_date DATE;
9564 l_cnt NUMBER;
9565 BEGIN
9566 p_rec_changes.delete;
9567 l_period_start_date := TO_DATE('01-01-0001','dd-mm-yyyy');
9568 l_cnt := 1;
9569 FOR i IN p_rec_changes_init.first..p_rec_changes_init.last LOOP
9570 --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);
9571 IF p_rec_changes_init(i).effective_date >= to_date('01-01-2006','dd-mm-yyyy') THEN
9572 IF p_rec_changes_init(i).period_start_date <> l_period_start_date THEN
9573 -- OR p_rec_changes_init(i).retro = 'WITHDRAWAL' THEN
9574 p_rec_changes(l_cnt).dated_table_id := p_rec_changes_init(i).dated_table_id;
9575 p_rec_changes(l_cnt).datetracked_event := p_rec_changes_init(i).datetracked_event;
9576 p_rec_changes(l_cnt).surrogate_key := p_rec_changes_init(i).surrogate_key;
9577 p_rec_changes(l_cnt).update_type := p_rec_changes_init(i).update_type;
9578 p_rec_changes(l_cnt).column_name := p_rec_changes_init(i).column_name;
9579 p_rec_changes(l_cnt).effective_date := p_rec_changes_init(i).effective_date;
9580 p_rec_changes(l_cnt).old_value := p_rec_changes_init(i).old_value;
9581 p_rec_changes(l_cnt).new_value := p_rec_changes_init(i).new_value;
9582 p_rec_changes(l_cnt).change_values := p_rec_changes_init(i).change_values;
9583 p_rec_changes(l_cnt).proration_type := p_rec_changes_init(i).proration_type;
9584 p_rec_changes(l_cnt).change_mode := p_rec_changes_init(i).change_mode;
9585 p_rec_changes(l_cnt).period_start_date := p_rec_changes_init(i).period_start_date;
9586 p_rec_changes(l_cnt).period_end_date := p_rec_changes_init(i).period_end_date;
9587 p_rec_changes(l_cnt).retro := p_rec_changes_init(i).retro;
9588 l_cnt := l_cnt + 1;
9589 IF p_rec_changes_init(i).retro = 'WITHDRAWAL' THEN
9590 l_period_start_date := p_rec_changes_init(i).period_start_date;
9591 END IF;
9592 END IF;
9593 END IF;
9594 END LOOP;
9595 END remove_withdrawal_period_chg;
9596 --------------------------------------------------------------------------------
9597 -- CHK_EVENTS
9598 --------------------------------------------------------------------------------
9599 PROCEDURE chk_events(p_assactid NUMBER
9600 ,p_assignment_id NUMBER
9601 ,p_effective_date DATE
9602 ,p_business_gr_id NUMBER
9603 ,l_tax_unit_id NUMBER
9604 ,p_chk_start_date DATE
9605 ,p_chk_end_date DATE
9606 ,p_payroll_type VARCHAR2
9607 ,p_prev_corr_year VARCHAR2) IS --10100628
9608 --
9609 --
9610 CURSOR csr_get_emp_data(c_assignment_id NUMBER
9611 ,c_effective_date DATE) IS
9612 SELECT pap.person_id
9613 ,pap.national_identifier sofi_number
9614 ,pap.employee_number
9615 ,pap.nationality
9616 ,pap.date_of_birth dob
9617 ,pap.pre_name_adjunct prefix
9618 ,pap.last_name
9619 ,UPPER(replace(replace(pap.per_information1,'.',''),' ','')) initials
9620 ,decode(pap.sex,'M',1,'F',2,NULL) gender
9621 ,paaf.assignment_id
9622 ,paaf.change_reason
9623 ,paaf.assignment_number
9624 ,paaf.assignment_sequence
9625 ,paaf.employment_category
9626 ,paaf.employee_category
9627 ,paaf.collective_agreement_id
9628 ,paaf.effective_start_date
9629 ,paaf.soft_coding_keyflex_id
9630 ,paaf.assignment_status_type_id
9631 ,paaf.payroll_id
9632 ,paaf.primary_flag
9633 FROM per_all_assignments_f paaf
9634 ,per_all_people_f pap
9635 WHERE paaf.assignment_id = c_assignment_id
9636 AND paaf.person_id = pap.person_id
9637 AND c_effective_date BETWEEN paaf.effective_start_date
9638 AND paaf.effective_end_date
9639 AND c_effective_date BETWEEN pap.effective_start_date
9640 AND pap.effective_end_date;
9641 --
9642 /*CURSOR csr_emp_termination_date(c_assignment_id NUMBER) IS
9643 SELECT pps.date_start emp_start_date
9644 ,pps.actual_termination_date emp_termination_date
9645 ,paaf.primary_flag
9646 FROM per_all_assignments_f paaf
9647 ,per_periods_of_service pps
9648 WHERE paaf.assignment_id = c_assignment_id
9649 AND pps.person_id = paaf.person_id
9650 AND pps.period_of_service_id = paaf.period_of_service_id;*/
9651 --
9652 CURSOR csr_get_cao_code(c_collective_agreement_id NUMBER) IS
9653 SELECT pca.cag_information1
9654 FROM per_collective_agreements pca
9655 WHERE pca.collective_agreement_id = c_collective_agreement_id
9656 AND pca.cag_information_category= 'NL';
9657 --
9658 CURSOR csr_chk_emp_reported(c_assignment_id NUMBER) IS
9659 SELECT 'Y'
9660 FROM DUAL
9661 WHERE EXISTS(SELECT /*+ ORDERED */ 1
9662 FROM pay_assignment_actions paa
9663 ,pay_payroll_actions ppa
9664 ,pay_action_interlocks pai
9665 ,pay_assignment_actions pal
9666 ,pay_payroll_actions ppl
9667 WHERE paa.assignment_id = c_assignment_id
9668 AND paa.payroll_action_id = ppa.payroll_action_id
9669 AND ppa.report_type = 'NL_WAGES_REP_ARCHIVE'
9670 AND ppa.report_qualifier = 'NL'
9671 AND ppa.report_category = 'ARCHIVE'
9672 AND ppa.action_status ='C'
9673 AND paa.assignment_action_id = pai.locked_action_id
9674 AND pai.locking_action_id = pal.assignment_action_id
9675 AND pal.payroll_action_id = ppl.payroll_action_id
9676 AND ppl.report_type = 'NL_WAGES_REP_LOCK'
9677 AND ppl.report_qualifier = 'NL'
9678 AND ppl.report_category = 'ARCHIVE'
9679 AND ppl.action_status ='C');
9680 --
9681 --
9682 CURSOR csr_get_element_details(c_ass_act_id NUMBER
9683 ,c_effective_date DATE) IS
9684 SELECT prr.rowid row_id
9685 ,prr.element_entry_id
9686 ,min(decode(piv.name, 'Report Type', rrv.RESULT_VALUE, null)) Retro_type
9687 ,min(decode(piv.name, 'Period', rrv.RESULT_VALUE, null)) Period
9688 FROM pay_run_results prr
9689 ,pay_run_result_values rrv
9690 ,pay_input_values_f piv
9691 ,pay_element_types_f pet
9692 WHERE prr.run_result_id = rrv.run_result_id
9693 AND rrv.input_value_id + 0 = piv.input_value_id
9694 AND piv.element_type_id = pet.element_type_id
9695 AND prr.element_type_id = pet.element_type_id
9696 AND prr.assignment_action_id = c_ass_act_id
9697 AND pet.element_name = 'New Wage Report Override'
9698 AND pet.legislation_code = 'NL'
9699 AND c_effective_date BETWEEN piv.effective_start_date AND piv.effective_end_date
9700 AND c_effective_date BETWEEN pet.effective_start_date AND pet.effective_end_date
9701 GROUP BY prr.rowid
9702 ,prr.element_entry_id
9703 ORDER BY 4,3 DESC;
9704 --
9705 CURSOR csr_get_retro_periods(c_assignment_action_id NUMBER
9706 ,c_date DATE) IS
9707 SELECT DISTINCT ptp.start_date start_date
9708 ,ptp.end_date end_date
9709 FROM pay_run_results prr
9710 ,pay_element_entries_f pee
9711 ,pay_assignment_actions paa
9712 ,pay_payroll_actions ppa
9713 ,per_time_periods ptp
9714 WHERE prr.assignment_action_id = paa.assignment_action_id
9715 AND prr.element_type_id = pee.element_type_id
9716 AND pee.creator_type IN ('RR','EE')
9717 AND pee.assignment_id = paa.assignment_id
9718 AND paa.assignment_action_id = c_assignment_action_id
9719 AND prr.start_date > c_date
9720 AND paa.payroll_action_id = ppa.payroll_action_id
9721 AND ptp.payroll_id = ppa.payroll_id
9722 AND prr.start_date BETWEEN ptp.start_date and ptp.end_date
9723 ORDER by 1;
9724 --
9725 /*CURSOR csr_get_corr_retro_periods(c_assignment_action_id NUMBER
9726 ,c_assignment_id NUMBER
9727 ,c_effective_date DATE) IS
9728 SELECT rr1.start_date , rc.short_name,rr1.element_entry_id
9729 ,rr1.end_date
9730 FROM pay_run_results rr1 -- Retro element
9731 ,pay_run_results rr2 -- Normal Element
9732 ,pay_element_span_usages esu
9733 ,pay_retro_component_usages rcu
9734 ,pay_retro_components rc
9735 ,pay_element_entries_f pee1
9736 ,pay_element_entries_f pee2
9737 ,pay_retro_assignments pra
9738 ,pay_retro_entries pre
9739 WHERE rr1.assignment_action_id = c_assignment_action_id
9740 AND rr2.assignment_action_id = rr1.assignment_action_id
9741 AND rr1.element_type_id = esu.retro_element_type_id
9742 AND esu.retro_component_usage_id = rcu.retro_component_usage_id
9743 AND rcu.creator_id = rr2.element_type_id
9744 AND rcu.creator_type = 'ET' -- check
9745 AND rr1.element_entry_id = pee1.element_entry_id
9746 AND pee1.creator_type = 'RR'
9747 AND pee1.creator_id = pra.retro_assignment_action_id
9748 AND pra.assignment_id = c_assignment_id
9749 -- AND pra.assignment_id = pee1.assignment_id
9750 AND pra.retro_assignment_id = pre.retro_assignment_id
9751 AND rr2.element_entry_id = pee2.element_entry_id
9752 AND pee2.element_entry_id = pre.element_entry_id
9753 AND pre.retro_component_id = rc.retro_component_id
9754 AND rc.legislation_code = 'NL'
9755 AND rc.short_name = 'Standard'
9756 AND c_effective_date between pee1.effective_start_date and pee1.effective_end_date
9757 AND c_effective_date between pee2.effective_start_date and pee2.effective_end_date;*/
9758 --
9759 CURSOR csr_get_corr_retro_periods(c_assignment_action_id NUMBER
9760 ,c_effective_date DATE) IS
9761 SELECT DISTINCT ptp.start_date
9762 ,ptp.end_date
9763 FROM pay_run_results rr1 -- Retro element
9764 ,pay_element_span_usages esu
9765 ,pay_retro_component_usages rcu
9766 ,pay_retro_components rc
9767 ,pay_element_entries_f pee1
9768 ,pay_assignment_actions paa
9769 ,pay_payroll_actions ppa
9770 ,per_time_periods ptp
9771 WHERE paa.assignment_action_id = c_assignment_action_id
9772 AND rr1.assignment_action_id = paa.assignment_action_id
9773 AND rr1.element_entry_id = pee1.element_entry_id
9774 AND pee1.creator_type = 'RR'
9775 AND rr1.element_type_id = esu.retro_element_type_id
9776 AND esu.retro_component_usage_id = rcu.retro_component_usage_id
9777 AND rcu.creator_type = 'ET' -- check
9778 AND rcu.retro_component_id = rc.retro_component_id
9779 AND rc.legislation_code = 'NL'
9780 AND rc.short_name = 'Standard'
9781 AND c_effective_date between pee1.effective_start_date and pee1.effective_end_date
9782 AND paa.payroll_action_id = ppa.payroll_action_id
9783 AND ptp.payroll_id = ppa.payroll_id
9784 AND rr1.start_date BETWEEN ptp.start_date and ptp.end_date
9785 ORDER BY 1;
9786
9787 /*SELECT rr.start_date
9788 ,rr.end_date
9789 FROM pay_run_results rr
9790 ,pay_element_span_usages esu
9791 ,pay_retro_component_usages rcu
9792 ,pay_retro_components rc
9793 WHERE rr.assignment_action_id = c_assignment_action_id
9794 AND rr.element_type_id = esu.retro_element_type_id
9795 AND esu.retro_component_usage_id = rcu.retro_component_usage_id
9796 AND rcu.retro_component_id = rc.retro_component_id
9797 AND rc.legislation_code = 'NL'
9798 AND rc.short_name = 'Standard';*/
9799 --
9800 CURSOR csr_get_assignment_action_id(c_assignment_id NUMBER
9801 ,c_date DATE) IS
9802 SELECT max(paa.assignment_action_id) assignment_action_id
9803 FROM pay_assignment_actions paa
9804 ,pay_payroll_actions ppa
9805 ,per_time_periods ptp
9806 WHERE paa.assignment_id = c_assignment_id
9807 AND ppa.payroll_action_id = paa.payroll_action_id
9808 AND ppa.action_type IN ('R','Q')
9809 AND paa.ACTION_STATUS IN ('C','S') -- 10228241
9810 AND ppa.ACTION_STATUS = 'C'
9811 --AND ppa.date_earned between c_start_date AND c_end_date;
9812 AND ppa.time_period_id = ptp.time_period_id
9813 AND c_date BETWEEN ptp.start_date AND ptp.end_date;
9814 --
9815 CURSOR csr_get_assignment_action_id2(c_assignment_id NUMBER
9816 ,c_date DATE) IS
9817 SELECT --max(paa.assignment_action_id) assignment_action_id --11731857
9818 fnd_number.canonical_to_number(substr(max(lpad(NVL(paa.action_sequence,0),15,'0')||paa.assignment_action_id),16)) assignment_action_id --11731857
9819 FROM pay_assignment_actions paa
9820 ,pay_payroll_actions ppa
9821 ,per_time_periods ptp
9822 WHERE paa.assignment_id = c_assignment_id
9823 AND ppa.payroll_action_id = paa.payroll_action_id
9824 AND ppa.action_type IN ('R','Q','I','B')
9825 AND paa.ACTION_STATUS IN ('C','S') -- 10228241
9826 AND ppa.ACTION_STATUS = 'C'
9827 -- AND ppa.date_earned between c_start_date AND c_end_date;
9828 AND ppa.time_period_id = ptp.time_period_id
9829 AND c_date BETWEEN ptp.start_date AND ptp.end_date;
9830 --
9831 CURSOR csr_get_shared_types(c_code VARCHAR2
9832 ,c_business_gr_id NUMBER
9833 ,c_lookup VARCHAR2) IS
9834 SELECT business_group_id,system_type_cd
9835 FROM per_shared_types
9836 WHERE lookup_type = c_lookup --'NL_NATIONALITY'
9837 AND information1 = c_code
9838 AND (business_group_id = c_business_gr_id
9839 OR business_group_id is NULL)
9840 ORDER BY 1;
9841 --
9842 CURSOR csr_get_period(c_payroll_id NUMBER,c_date DATE) IS
9843 SELECT ptp.start_date,ptp.end_date
9844 FROM per_time_periods ptp
9845 WHERE ptp.payroll_id = c_payroll_id
9846 AND c_date between ptp.start_date and ptp.end_date;
9847 --
9848 CURSOR csr_get_table_id(c_table_name VARCHAR2) IS
9849 SELECT dated_table_id
9850 FROM pay_dated_tables
9851 WHERE TABLE_NAME = c_table_name; -- in ('PAY_ELEMENT_ENTRY_VALUES_F','PAY_ELEMENT_ENTRIES_F');
9852 --
9853 CURSOR csr_get_element_det(c_element_name VARCHAR2
9854 ,c_input_val_name VARCHAR2
9855 ,c_assignment_id NUMBER
9856 ,c_eff_date DATE) IS
9857 SELECT peev.screen_entry_value
9858 FROM pay_element_types_f pet
9859 ,pay_input_values_f piv
9860 ,pay_element_entries_f peef
9861 ,pay_element_entry_values_f peev
9862 WHERE pet.element_name = c_element_name
9863 AND pet.element_type_id = piv.element_type_id
9864 AND piv.name = c_input_val_name
9865 AND pet.legislation_code = 'NL'
9866 AND piv.legislation_code = 'NL'
9867 AND peef.assignment_id = c_assignment_id
9868 AND peef.element_entry_id = peev.element_entry_id
9869 AND peef.element_type_id = pet.element_type_id
9870 AND peev.input_value_id = piv.input_value_id
9871 AND c_eff_date BETWEEN piv.effective_start_date
9872 AND piv.effective_end_date
9873 AND c_eff_date BETWEEN pet.effective_start_date
9874 AND pet.effective_end_date
9875 AND c_eff_date BETWEEN peev.effective_start_date
9876 AND peev.effective_end_date
9877 AND c_eff_date BETWEEN peef.effective_start_date
9878 AND peef.effective_end_date;
9879 --
9880 CURSOR csr_get_element_name2(c_element_entry_value_id NUMBER
9881 ,c_eff_date DATE) IS
9882 SELECT pet.element_name
9883 ,peev.screen_entry_value
9884 FROM pay_element_types_f pet
9885 ,pay_element_entries_f peef
9886 ,pay_element_entry_values_f peev
9887 WHERE peev.element_entry_value_id = c_element_entry_value_id
9888 AND peev.element_entry_id = peef.element_entry_id
9889 AND peef.element_type_id = pet.element_type_id
9890 AND pet.legislation_code = 'NL'
9891 AND c_eff_date BETWEEN pet.effective_start_date
9892 AND pet.effective_end_date
9893 AND c_eff_date BETWEEN peev.effective_start_date
9894 AND peev.effective_end_date
9895 AND c_eff_date BETWEEN peef.effective_start_date
9896 AND peef.effective_end_date;
9897 --
9898 CURSOR csr_get_element_name1(c_element_entry_id NUMBER
9899 ,c_eff_date DATE) IS
9900 SELECT pet.element_name
9901 ,peev.screen_entry_value
9902 FROM pay_element_types_f pet
9903 ,pay_element_entries_f peef
9904 ,pay_element_entry_values_f peev
9905 WHERE peef.element_entry_id = c_element_entry_id
9906 AND peev.element_entry_id = peef.element_entry_id
9907 AND peef.element_type_id = pet.element_type_id
9908 AND pet.legislation_code = 'NL'
9909 AND c_eff_date BETWEEN pet.effective_start_date
9910 AND pet.effective_end_date
9911 AND c_eff_date BETWEEN peev.effective_start_date
9912 AND peev.effective_end_date
9913 AND c_eff_date BETWEEN peef.effective_start_date
9914 AND peef.effective_end_date; /*assuming one input value*/
9915 --
9916 CURSOR csr_get_eit_cao(c_assignment_id NUMBER) IS
9917 SELECT aei_information5
9918 FROM per_assignment_extra_info
9919 WHERE assignment_id = c_assignment_id
9920 AND aei_information_category IN ('NL_CADANS_INFO');
9921 --
9922 CURSOR csr_ass_start_date(c_assignment_id NUMBER) IS
9923 SELECT min(effective_start_date)
9924 --,decode(max(effective_end_date),to_date('31-12-4712','dd-mm-yyyy'),null,max(effective_end_date))
9925 FROM per_all_assignments_F paaf
9926 ,PER_ASSIGNMENT_STATUS_TYPES ast
9927 WHERE paaf.assignment_id = c_assignment_id
9928 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
9929 AND ast.per_system_status = 'ACTIVE_ASSIGN';
9930 --
9931 CURSOR csr_ass_end_date(c_assignment_id NUMBER) IS
9932 SELECT decode(max(effective_end_date),to_date('31-12-4712','dd-mm-yyyy'),null,max(effective_end_date))
9933 FROM per_all_assignments_F paaf
9934 ,PER_ASSIGNMENT_STATUS_TYPES ast
9935 WHERE paaf.assignment_id = c_assignment_id
9936 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
9937 AND ast.per_system_status <> 'TERM_ASSIGN';
9938 --
9939 CURSOR csr_ass_end_date2(c_assignment_id NUMBER) IS
9940 SELECT min(effective_start_date)
9941 FROM per_all_assignments_F paaf
9942 ,PER_ASSIGNMENT_STATUS_TYPES ast
9943 WHERE paaf.assignment_id = c_assignment_id
9944 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
9945 AND ast.per_system_status = 'TERM_ASSIGN';
9946
9947 /* 8328995 */
9948 cursor csr_numiv_override(p_asg_id number) is
9949 select aei_information1 NUMIV_OVERRIDE
9950 from per_assignment_extra_info
9951 where assignment_id = p_asg_id
9952 and aei_information_category = 'NL_NUMIV_OVERRIDE';
9953 l_numiv_override NUMBER;
9954
9955
9956 -- /*LC 2010 */ begin
9957 CURSOR csr_get_small_job_detail(c_assignment_action_id NUMBER
9958 ,c_eff_date DATE) IS
9959 SELECT prrv.result_value
9960 FROM pay_run_result_values prrv
9961 ,pay_input_values_f piv
9962 ,pay_element_types_f pet
9963 ,pay_run_results prr
9964 WHERE pet.element_name = 'Small Job Indicator'
9965 AND pet.element_type_id = piv.element_type_id
9966 AND piv.name = 'Exempt Small Jobs'
9967 AND pet.legislation_code = 'NL'
9968 AND piv.legislation_code = 'NL'
9969 AND prrv.input_value_id = piv.input_value_id
9970 AND prr.run_result_id = prrv.run_result_id
9971 AND prr.element_type_id = pet.element_type_id
9972 AND prr.assignment_action_id = c_assignment_action_id
9973 AND prr.status in ('P','PA')
9974 AND c_eff_date BETWEEN piv.effective_start_date
9975 AND piv.effective_end_date
9976 AND c_eff_date BETWEEN pet.effective_start_date
9977 AND pet.effective_end_date;
9978
9979 CURSOR csr_get_other_assignments(c_assg_id NUMBER
9980 ,c_start_date DATE
9981 ,c_end_date DATE
9982 ,c_business_group_id NUMBER
9983 ,c_tax_unit_id NUMBER
9984 ,c_payroll_type VARCHAR2) IS
9985 SELECT distinct asl.assignment_id assignment_id
9986 FROM per_all_assignments_f asl
9987 ,per_all_assignments_f asl2
9988 ,pay_all_payrolls_f ppf
9989 ,pay_payroll_actions ppa
9990 ,pay_assignment_actions paa
9991 ,per_time_periods ptp
9992 WHERE asl.person_id = asl2.person_id
9993 AND asl2.assignment_id = c_assg_id
9994 AND ppf.payroll_id = asl.payroll_id
9995 AND ((ppf.period_type = 'Calendar Month' AND c_payroll_type = 'MONTH') OR
9996 (ppf.period_type = 'Week' AND c_payroll_type = 'WEEK') OR
9997 (ppf.period_type = 'Lunar Month' AND c_payroll_type = 'LMONTH'))
9998 AND ppf.payroll_id = ppa.payroll_id
9999 AND ppa.action_type in ('R','Q')
10000 AND ppa.action_status = 'C'
10001 AND paa.source_action_id IS NULL
10002 AND paa.tax_unit_id = c_tax_unit_id
10003 AND ppa.business_group_id = c_business_group_id
10004 AND ppa.time_period_id = ptp.time_period_id
10005 AND c_end_date BETWEEN ptp.start_date
10006 AND ptp.end_date
10007 AND ppa.payroll_action_id = paa.payroll_action_id
10008 AND paa.assignment_id = asl.assignment_id
10009 AND asl.effective_start_date <= c_end_date
10010 AND asl.effective_end_date >= c_start_date
10011 AND c_end_date BETWEEN ppf.effective_start_date
10012 AND ppf.effective_end_date;
10013 -- /*LC 2010 */ end
10014 --
10015 --soft_coding_keyflex_id
10016 l_nationality per_shared_types.INFORMATION1%type;
10017 l_assignment_catg per_shared_types.INFORMATION1%type;
10018 l_assignment_catg_old per_shared_types.INFORMATION1%type;
10019 l_emp_rec csr_get_emp_data%rowtype;
10020 l_rec_changes Rec_Changes;
10021 l_rec_changes_init Rec_Changes;
10022 l_master_action_info_id pay_action_information.action_information_id%type;
10023 l_action_info_id pay_action_information.action_information_id%TYPE;
10024 l_period_start_date DATE;
10025 l_period_end_date DATE;
10026 l_rec_start_date DATE;
10027 l_emp_end_date DATE;
10028 -- SCL Segment variables
10029 l_income_code hr_soft_coding_keyflex.segment1%type;
10030 l_work_pattern hr_soft_coding_keyflex.segment1%type;
10031 l_wage_tax_discount hr_soft_coding_keyflex.segment1%type;
10032 l_wage_tax_table hr_soft_coding_keyflex.segment1%type;
10033 l_wage_aow hr_soft_coding_keyflex.segment1%type;
10034 l_wage_wajong hr_soft_coding_keyflex.segment1%type;
10035 l_emp_loan hr_soft_coding_keyflex.segment1%type;
10036 l_transportation hr_soft_coding_keyflex.segment1%type;
10037 --
10038 l_labour_rel_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
10039 l_ins_duty_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
10040 l_FZ_Code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
10041 l_handicapped_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
10042 l_wao_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
10043 l_ww_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
10044 l_zw_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
10045 l_zvw_situation PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
10046 l_zvw_defaulted VARCHAR2(1);
10047 l_zvw_small_jobs VARCHAR2(1);/* LC 2010*/
10048 l_marginal_empl PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;/* LC 2010*/
10049 l_wm_old_rule PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;/* LC 2010*/
10050 l_temp_tax_discount PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;/* LC 2013*/
10051 --
10052 l_small_job pay_run_result_values.result_value%TYPE; /*LC 2010*/
10053 l_assg_small_job pay_run_result_values.result_value%TYPE; /*LC 2010*/
10054 --
10055 l_detail_tab pay_interpreter_pkg.t_detailed_output_table_type;
10056 l_event_group_id pay_event_groups.event_group_id%TYPE;
10057 l_assignment_id NUMBER;
10058 l_event_group_name VARCHAR2(50) := 'NL_WAGES_REPORT_EVG';
10059 l_chk VARCHAR2(2);
10060 l_chg_pending VARCHAR2(2);
10061 --l_chk_primary VARCHAR2(2);
10062 l_chk_emp_reported VARCHAR2(1);
10063 l_archive_emp_info VARCHAR2(1);
10064 p_date DATE;
10065 l_retro VARCHAR2(10);
10066 l_type VARCHAR2(10);
10067 l_ovn pay_action_information.object_version_number%type;
10068 l_cao_code per_collective_agreements.CAG_INFORMATION1%type;
10069 l_old_cao_code per_collective_agreements.CAG_INFORMATION1%type;
10070 l_bal_value Bal_Value;
10071 l_nom_bal_value Bal_Value;
10072 l_ret_table Ret_Table;
10073 l_assignment_action_id NUMBER;
10074 l_master_assignment_action_id NUMBER;
10075 l_other_assignment_action_id NUMBER; /*LC 2010*/
10076 l_retro_type VARCHAR2(10);
10077 l_retro_done VARCHAR2(10);
10078 ele_end_date DATE;
10079 l_surrogate_key NUMBER;
10080 l_bg NUMBER;
10081 l_table1 pay_dated_tables.dated_table_id%type;
10082 l_table2 pay_dated_tables.dated_table_id%type;
10083 l_table3 pay_dated_tables.dated_table_id%type;
10084 l_ass_start_date DATE;
10085 l_ass_end_date DATE;
10086 --
10087 l_holiday_coupen pay_element_entry_values_f.screen_entry_value%TYPE;
10088 l_income_increase pay_element_entry_values_f.screen_entry_value%TYPE;
10089 l_add_allowance pay_element_entry_values_f.screen_entry_value%TYPE;
10090 l_company_car_use pay_element_entry_values_f.screen_entry_value%TYPE;
10091 l_val pay_element_entry_values_f.screen_entry_value%TYPE;
10092 l_element_name VARCHAR2(30);
10093 --
10094 l_cnt1 NUMBER;
10095 l_cnt2 NUMBER;
10096 l_cnt3 NUMBER;
10097 r_index NUMBER;
10098 --
10099 l_srg_flag VARCHAR2(1);
10100 l_corr_used VARCHAR2(1);
10101 --
10102 CURSOR get_scl_id(c_assignment_id NUMBER
10103 ,c_start_date DATE) IS
10104 SELECT paaf.soft_coding_keyflex_id
10105 FROM per_all_assignments_f paaf
10106 WHERE assignment_id = c_assignment_id
10107 AND c_start_date BETWEEN paaf.effective_start_date
10108 AND paaf.effective_end_date;
10109 --
10110 CURSOR csr_get_col_agreement_id (c_assignment_id NUMBER
10111 ,c_eff_date DATE) IS
10112 SELECT collective_agreement_id
10113 FROM per_All_assignments_F
10114 WHERE assignment_id = c_assignment_id
10115 AND c_eff_date BETWEEN effective_start_date AND effective_end_date;
10116 --
10117 l_scl_id per_all_assignments_f.soft_coding_keyflex_id%TYPE;
10118 --
10119 l_initial_flag VARCHAR2(1);
10120 l_emp_seq per_all_Assignments_f.assignment_number%type;
10121 --
10122 l_num_over_clash NUMBER:=0; /* 9764359 */
10123 l_arc_y_n VARCHAR2(1) := 'N'; --10100628
10124
10125 --10100628
10126 CURSOR c_corr_pd_prev_yrs(p_asg_id NUMBER, p_start_date DATE, p_end_date DATE)
10127 IS
10128 select distinct ptp.start_date, ptp.end_date
10129 from
10130 pay_payroll_actions ppa,
10131 pay_assignment_actions paa,
10132 per_time_periods ptp
10133 where
10134 ppa.action_type in ('R', 'Q')
10135 and ppa.payroll_action_id = paa.payroll_action_id
10136 and paa.assignment_id = p_asg_id
10137 and ppa.EFFECTIVE_DATE between p_start_date and p_end_date
10138 and ptp.TIME_PERIOD_ID = ppa.TIME_PERIOD_ID
10139 and ptp.PAYROLL_ID = ppa.payroll_id
10140 AND ppa.action_type IN ('R','Q')
10141 AND paa.ACTION_STATUS = 'C'
10142 AND ppa.ACTION_STATUS = 'C'
10143 AND paa.source_action_id IS NOT NULL
10144 AND EXISTS
10145 (
10146 SELECT 1
10147 FROM per_assignment_extra_info
10148 WHERE assignment_id = paa.assignment_id
10149 AND aei_information_category = 'NL_WR_PREV_CORR'
10150 AND ptp.start_date BETWEEN fnd_date.canonical_to_date(aei_information1)
10151 AND nvl(fnd_date.canonical_to_date(aei_information2),to_date('31-12-4712','dd-mm-yyyy'))
10152 )
10153 order by ptp.start_date Asc;
10154 --10100628
10155
10156
10157 BEGIN
10158 --Fnd_file.put_line(FND_FILE.LOG,' Start chk_events');
10159 --Fnd_file.put_line(FND_FILE.LOG,' Assignment ID :'||p_assignment_id);
10160 l_assignment_id := p_assignment_id;
10161 -- Correction Record Starts
10162 l_event_group_id := pqp_utilities.get_event_group_id(p_business_group_id => p_business_gr_id
10163 ,p_event_group_name => l_event_group_name);
10164 -- Fetch assignment start date and end date
10165 --OPEN csr_emp_termination_date(l_assignment_id);
10166 --FETCH csr_emp_termination_date INTO l_ass_start_date,l_ass_end_date,l_chk_primary;
10167 --CLOSE csr_emp_termination_date;
10168 --IF NVL(l_chk_primary,'N') <> 'Y' THEN
10169
10170
10171 OPEN csr_ass_start_date(l_assignment_id);
10172 FETCH csr_ass_start_date INTO l_ass_start_date;
10173 CLOSE csr_ass_start_date;
10174 --
10175 OPEN csr_ass_end_date(l_assignment_id);
10176 FETCH csr_ass_end_date INTO l_ass_end_date;
10177 CLOSE csr_ass_end_date;
10178 --
10179 /*IF l_ass_start_date IS NULL AND l_ass_end_date IS NULL THEN -- Bug - 5868094
10180 OPEN csr_ass_end_date2(l_assignment_id);
10181 FETCH csr_ass_end_date2 INTO l_ass_end_date;
10182 CLOSE csr_ass_end_date2;
10183 l_ass_start_date := l_ass_end_date;
10184 END IF;*/
10185 --
10186 --END IF;
10187 --Invoke the date track interpreter only for Monthly Payroll
10188 IF p_payroll_type = 'MONTH' OR p_payroll_type = 'LMONTH' THEN
10189 --Fnd_file.put_line(FND_FILE.LOG,' Call Interpretor '||l_assignment_id);
10190 get_assignment_changes(l_assignment_id
10191 ,p_chk_start_date
10192 ,p_chk_end_date
10193 ,l_ass_start_date
10194 ,l_event_group_id
10195 ,l_detail_tab);
10196 --Fnd_file.put_line(FND_FILE.LOG,' Total Change Records :'||l_detail_tab.COUNT);
10197 --Fnd_file.put_line(FND_FILE.LOG,' Change Records for Assignment : '||l_assignment_id);
10198 sort_changes(l_detail_tab);
10199 --
10200 OPEN csr_get_table_id('PAY_ELEMENT_ENTRIES_F');
10201 FETCH csr_get_table_id INTO l_table1;
10202 CLOSE csr_get_table_id;
10203 --
10204 OPEN csr_get_table_id('PAY_ELEMENT_ENTRY_VALUES_F');
10205 FETCH csr_get_table_id INTO l_table2;
10206 CLOSE csr_get_table_id;
10207 --
10208 OPEN csr_get_table_id('PER_ASSIGNMENT_EXTRA_INFO');
10209 FETCH csr_get_table_id INTO l_table3;
10210 CLOSE csr_get_table_id;
10211 --
10212 OPEN csr_get_emp_data(l_assignment_id,LEAST(p_chk_end_date,NVL(l_ass_end_date,p_chk_end_date)));
10213 FETCH csr_get_emp_data INTO l_emp_rec;
10214 CLOSE csr_get_emp_data;
10215 --
10216 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5','NL6') THEN
10217 l_emp_rec.change_reason := NULL;
10218 END IF;
10219 --
10220 l_period_start_date := to_date('01-01-0001','dd-mm-yyyy');
10221 l_period_end_date := to_date('01-01-0001','dd-mm-yyyy');
10222 l_rec_start_date := to_date('01-01-0001','dd-mm-yyyy');
10223 --
10224 r_index := 1;
10225 --
10226 l_master_assignment_action_id := NULL;
10227 l_assignment_action_id := NULL;
10228 OPEN csr_get_assignment_action_id(l_assignment_id,p_chk_start_date);
10229 FETCH csr_get_assignment_action_id INTO l_master_assignment_action_id;
10230 CLOSE csr_get_assignment_action_id;
10231 --
10232 --Fnd_file.put_line(FND_FILE.LOG,' Checking retro for Assignment_action_id :'||l_master_assignment_action_id);
10233 --
10234 l_retro_done := 'N';
10235 IF l_master_assignment_action_id IS NOT NULL THEN
10236 FOR l_element_rec in csr_get_element_details(l_master_assignment_action_id,p_chk_end_date) LOOP
10237 l_retro_type := 'HR';
10238 ele_end_date := fnd_date.canonical_to_date(l_element_rec.period);
10239 --
10240 IF l_element_rec.Retro_type = 'WITHDRAWAL' AND l_element_rec.period IS NOT NULL THEN
10241 OPEN csr_get_period(l_emp_rec.payroll_id, ele_end_date);
10242 FETCH csr_get_period INTO l_period_start_date,l_period_end_date;
10243 CLOSE csr_get_period;
10244 --Fnd_file.put_line(FND_FILE.LOG,' WITHDRAWAL For Period : '||l_period_start_date);
10245 IF l_rec_start_date < l_period_start_date THEN
10246 l_ret_table(r_index).start_date := l_period_start_date;
10247 l_ret_table(r_index).end_date := l_period_end_date;
10248 l_ret_table(r_index).retro_type := l_element_rec.retro_type;--l_retro_type;
10249 r_index := r_index + 1;
10250 l_rec_start_date := l_period_start_date;
10251 END IF;
10252 ELSIF l_element_rec.Retro_type = 'CORRECTION' AND g_retro_type = 'OLD' THEN
10253 IF l_retro_done = 'N' THEN
10254 FOR csr_retro_rec IN csr_get_retro_periods(l_master_assignment_action_id,l_rec_start_date) LOOP
10255 IF l_element_rec.period IS NULL THEN
10256 l_ret_table(r_index).start_date := csr_retro_rec.start_date;
10257 l_ret_table(r_index).end_date := csr_retro_rec.end_date;
10258 l_ret_table(r_index).retro_type := 'PAY';--l_retro_type;
10259 r_index := r_index + 1;
10260 l_rec_start_date := csr_retro_rec.start_date;
10261 l_retro_done := 'Y';
10262 ELSIF csr_retro_rec.end_date = ele_end_date THEN
10263 l_ret_table(r_index).start_date := csr_retro_rec.start_date;
10264 l_ret_table(r_index).end_date := csr_retro_rec.end_date;
10265 l_ret_table(r_index).retro_type := 'PAY';--l_retro_type;
10266 r_index := r_index + 1;
10267 l_rec_start_date := csr_retro_rec.start_date;
10268 END IF;
10269 END LOOP;
10270 END IF;
10271 END IF;
10272 END LOOP;
10273 END IF;
10274 --
10275 IF g_retro_type = 'NEW' AND p_prev_corr_year = '-9999' THEN --10100628
10276 FOR csr_retro_rec in csr_get_corr_retro_periods(l_master_assignment_action_id,p_chk_end_date) LOOP
10277 l_ret_table(r_index).start_date := csr_retro_rec.start_date;
10278 l_ret_table(r_index).end_date := csr_retro_rec.end_date;
10279 l_ret_table(r_index).retro_type := 'PAY';--l_retro_type;
10280 r_index := r_index + 1;
10281 END LOOP;
10282 ELSIF p_prev_corr_year <> '-9999' THEN --10100628
10283 FOR csr_retro_rec in c_corr_pd_prev_yrs(p_assignment_id ,p_chk_start_date, p_chk_end_date) LOOP
10284 l_ret_table(r_index).start_date := csr_retro_rec.start_date;
10285 l_ret_table(r_index).end_date := csr_retro_rec.end_date;
10286 l_ret_table(r_index).retro_type := 'PAY';
10287 r_index := r_index + 1;
10288 END LOOP;
10289 END IF;
10290 -- 10100628
10291
10292 --
10293 --Fnd_file.put_line(FND_FILE.LOG,' Retro table count : '||l_ret_table.count);
10294 --Fnd_file.put_line(FND_FILE.LOG,' Hr table count : '||l_detail_tab.count);
10295 --
10296 l_cnt3 := 0;
10297 l_cnt1 := 1;
10298 l_cnt2 := 1;
10299 --
10300 l_period_start_date := to_date('01-01-0001','dd-mm-yyyy');
10301 l_period_end_date := to_date('01-01-0001','dd-mm-yyyy');
10302 --
10303 --Fnd_file.put_line(FND_FILE.LOG,' Merging retro and HR data table: ');
10304 LOOP
10305 EXIT WHEN l_detail_tab.count < l_cnt1 OR l_ret_table.count < l_cnt2;
10306 l_cnt3 := l_cnt3 + 1;
10307 IF l_detail_tab(l_cnt1).effective_date < l_ret_table(l_cnt2).start_date THEN
10308 IF l_detail_tab(l_cnt1).effective_date < l_period_start_date
10309 OR l_detail_tab(l_cnt1).effective_date > l_period_end_date THEN
10310 --
10311 --Fnd_file.put_line(FND_FILE.LOG,' Payroll : '||l_emp_rec.payroll_id);
10312 IF l_emp_rec.payroll_id IS NULL THEN
10313 EXIT;
10314 END IF;
10315 --
10316 OPEN csr_get_period(l_emp_rec.payroll_id, l_detail_tab(l_cnt1).effective_date);
10317 FETCH csr_get_period INTO l_period_start_date,l_period_end_date;
10318 CLOSE csr_get_period;
10319 --
10320 l_retro := 'HR';
10321 --
10322 END IF;
10323 --
10324 l_rec_changes_init(l_cnt3).dated_table_id := l_detail_tab(l_cnt1).dated_table_id;
10325 l_rec_changes_init(l_cnt3).datetracked_event := l_detail_tab(l_cnt1).datetracked_event;
10326 l_rec_changes_init(l_cnt3).surrogate_key := l_detail_tab(l_cnt1).surrogate_key;
10327 l_rec_changes_init(l_cnt3).update_type := l_detail_tab(l_cnt1).update_type;
10328 l_rec_changes_init(l_cnt3).column_name := l_detail_tab(l_cnt1).column_name;
10329 l_rec_changes_init(l_cnt3).effective_date := l_detail_tab(l_cnt1).effective_date;
10330 l_rec_changes_init(l_cnt3).old_value := l_detail_tab(l_cnt1).old_value;
10331 l_rec_changes_init(l_cnt3).new_value := l_detail_tab(l_cnt1).new_value;
10332 l_rec_changes_init(l_cnt3).change_values := l_detail_tab(l_cnt1).change_values;
10333 l_rec_changes_init(l_cnt3).proration_type := l_detail_tab(l_cnt1).proration_type;
10334 l_rec_changes_init(l_cnt3).change_mode := l_detail_tab(l_cnt1).change_mode;
10335 l_rec_changes_init(l_cnt3).period_start_date := l_period_start_date;
10336 l_rec_changes_init(l_cnt3).period_end_date := l_period_end_date;
10337 l_rec_changes_init(l_cnt3).retro := l_retro;
10338 --
10339 l_cnt1 := l_cnt1 + 1;
10340 --
10341 ELSIF l_detail_tab(l_cnt1).effective_date > l_ret_table(l_cnt2).end_date THEN
10342 l_rec_changes_init(l_cnt3).dated_table_id := NULL;
10343 l_rec_changes_init(l_cnt3).datetracked_event := NULL;
10344 l_rec_changes_init(l_cnt3).surrogate_key := NULL;
10345 l_rec_changes_init(l_cnt3).update_type := 'RETRO';
10346 l_rec_changes_init(l_cnt3).column_name := NULL;
10347 l_rec_changes_init(l_cnt3).effective_date := l_ret_table(l_cnt2).start_date;
10348 l_rec_changes_init(l_cnt3).old_value := NULL;
10349 l_rec_changes_init(l_cnt3).new_value := NULL;
10350 l_rec_changes_init(l_cnt3).change_values := NULL;
10351 l_rec_changes_init(l_cnt3).proration_type := NULL;
10352 l_rec_changes_init(l_cnt3).change_mode := NULL;
10353 l_rec_changes_init(l_cnt3).period_start_date := l_ret_table(l_cnt2).start_date;
10354 l_rec_changes_init(l_cnt3).period_end_date := l_ret_table(l_cnt2).end_date;
10355 l_rec_changes_init(l_cnt3).retro := l_ret_table(l_cnt2).retro_type;
10356 l_period_start_date := l_ret_table(l_cnt2).start_date;
10357 l_period_end_date := l_ret_table(l_cnt2).end_date;
10358 l_retro := l_ret_table(l_cnt2).retro_type;
10359 l_cnt2 := l_cnt2 + 1;
10360 ELSE
10361 l_rec_changes_init(l_cnt3).dated_table_id := l_detail_tab(l_cnt1).dated_table_id;
10362 l_rec_changes_init(l_cnt3).datetracked_event := l_detail_tab(l_cnt1).datetracked_event;
10363 l_rec_changes_init(l_cnt3).surrogate_key := l_detail_tab(l_cnt1).surrogate_key;
10364 l_rec_changes_init(l_cnt3).update_type := l_detail_tab(l_cnt1).update_type;
10365 l_rec_changes_init(l_cnt3).column_name := l_detail_tab(l_cnt1).column_name;
10366 l_rec_changes_init(l_cnt3).effective_date := l_detail_tab(l_cnt1).effective_date;
10367 l_rec_changes_init(l_cnt3).old_value := l_detail_tab(l_cnt1).old_value;
10368 l_rec_changes_init(l_cnt3).new_value := l_detail_tab(l_cnt1).new_value;
10369 l_rec_changes_init(l_cnt3).change_values := l_detail_tab(l_cnt1).change_values;
10370 l_rec_changes_init(l_cnt3).proration_type := l_detail_tab(l_cnt1).proration_type;
10371 l_rec_changes_init(l_cnt3).change_mode := l_detail_tab(l_cnt1).change_mode;
10372 l_rec_changes_init(l_cnt3).period_start_date := l_ret_table(l_cnt2).start_date;
10373 l_rec_changes_init(l_cnt3).period_end_date := l_ret_table(l_cnt2).end_date;
10374 l_rec_changes_init(l_cnt3).retro := l_ret_table(l_cnt2).retro_type;
10375 l_period_start_date := l_ret_table(l_cnt2).start_date;
10376 l_period_end_date := l_ret_table(l_cnt2).end_date;
10377 l_retro := l_ret_table(l_cnt2).retro_type;
10378 l_cnt1 := l_cnt1 + 1;
10379 l_cnt2 := l_cnt2 + 1;
10380 END IF;
10381 END LOOP;
10382 --
10383 LOOP EXIT WHEN l_detail_tab.count < l_cnt1 ;
10384 IF l_detail_tab(l_cnt1).effective_date < l_period_start_date
10385 OR l_detail_tab(l_cnt1).effective_date > l_period_end_date THEN
10386 -- chk if employee doesn't have a payroll
10387 --Fnd_file.put_line(FND_FILE.LOG,' Payroll : '||l_emp_rec.payroll_id);
10388 IF l_emp_rec.payroll_id IS NULL THEN
10389 EXIT;
10390 END IF;
10391 --
10392 OPEN csr_get_period(l_emp_rec.payroll_id, l_detail_tab(l_cnt1).effective_date);
10393 FETCH csr_get_period INTO l_period_start_date,l_period_end_date;
10394 CLOSE csr_get_period;
10395 --
10396 l_retro := 'HR';
10397 --
10398 END IF;
10399 --
10400 l_cnt3 := l_cnt3 + 1;
10401 l_rec_changes_init(l_cnt3).dated_table_id := l_detail_tab(l_cnt1).dated_table_id;
10402 l_rec_changes_init(l_cnt3).datetracked_event := l_detail_tab(l_cnt1).datetracked_event;
10403 l_rec_changes_init(l_cnt3).surrogate_key := l_detail_tab(l_cnt1).surrogate_key;
10404 l_rec_changes_init(l_cnt3).update_type := l_detail_tab(l_cnt1).update_type;
10405 l_rec_changes_init(l_cnt3).column_name := l_detail_tab(l_cnt1).column_name;
10406 l_rec_changes_init(l_cnt3).effective_date := l_detail_tab(l_cnt1).effective_date;
10407 l_rec_changes_init(l_cnt3).old_value := l_detail_tab(l_cnt1).old_value;
10408 l_rec_changes_init(l_cnt3).new_value := l_detail_tab(l_cnt1).new_value;
10409 l_rec_changes_init(l_cnt3).change_values := l_detail_tab(l_cnt1).change_values;
10410 l_rec_changes_init(l_cnt3).proration_type := l_detail_tab(l_cnt1).proration_type;
10411 l_rec_changes_init(l_cnt3).change_mode := l_detail_tab(l_cnt1).change_mode;
10412 l_rec_changes_init(l_cnt3).period_start_date := l_period_start_date;
10413 l_rec_changes_init(l_cnt3).period_end_date := l_period_end_date;
10414 l_rec_changes_init(l_cnt3).retro := l_retro;
10415 --
10416 l_cnt1 := l_cnt1 + 1;
10417 END LOOP;
10418 --
10419 LOOP EXIT WHEN l_ret_table.count < l_cnt2;
10420 --
10421 l_cnt3 := l_cnt3 + 1;
10422 l_rec_changes_init(l_cnt3).dated_table_id := NULL;
10423 l_rec_changes_init(l_cnt3).datetracked_event := NULL;
10424 l_rec_changes_init(l_cnt3).surrogate_key := NULL;
10425 l_rec_changes_init(l_cnt3).update_type := 'RETRO';
10426 l_rec_changes_init(l_cnt3).column_name := NULL;
10427 l_rec_changes_init(l_cnt3).effective_date := l_ret_table(l_cnt2).start_date;
10428 l_rec_changes_init(l_cnt3).old_value := NULL;
10429 l_rec_changes_init(l_cnt3).new_value := NULL;
10430 l_rec_changes_init(l_cnt3).change_values := NULL;
10431 l_rec_changes_init(l_cnt3).proration_type := NULL;
10432 l_rec_changes_init(l_cnt3).change_mode := NULL;
10433 l_rec_changes_init(l_cnt3).period_start_date := l_ret_table(l_cnt2).start_date;
10434 l_rec_changes_init(l_cnt3).period_end_date := l_ret_table(l_cnt2).end_date;
10435 l_rec_changes_init(l_cnt3).retro := l_ret_table(l_cnt2).retro_type;
10436 l_cnt2 := l_cnt2 + 1;
10437 --
10438 END LOOP;
10439 --Fnd_file.put_line(FND_FILE.LOG,' Total Records in Merged Table : '||l_rec_changes_init.count);
10440 --
10441 IF l_rec_changes_init.count <> 0 THEN
10442 remove_withdrawal_period_chg(l_rec_changes_init,l_rec_changes);
10443 END IF;
10444 --
10445 END IF; -- IF p_payroll_type = 'MONTH' OR 'LMONTH'
10446 --
10447 l_emp_end_date := NULL;
10448 IF l_ass_end_date <= p_chk_end_date THEN
10449 l_emp_end_date := l_ass_end_date;
10450 END IF;
10451 p_date := LEAST(p_chk_end_date,NVL(l_emp_end_date,p_chk_end_date));
10452 --l_start_date :=
10453 IF l_rec_changes.COUNT <> 0 THEN
10454 p_date := l_rec_changes(1).effective_date;
10455 END IF;
10456 --Fnd_file.put_line(FND_FILE.LOG,' Get employee Data on : '||p_date);
10457 OPEN csr_get_emp_data(l_assignment_id,p_date);
10458 FETCH csr_get_emp_data INTO l_emp_rec;
10459 CLOSE csr_get_emp_data;
10460 --
10461 l_emp_seq := NULL;
10462 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
10463 l_emp_seq := l_emp_rec.assignment_sequence;
10464 END IF;
10465 --
10466 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5','NL6') THEN
10467 l_emp_rec.change_reason := NULL;
10468 END IF;
10469 --
10470 OPEN csr_get_shared_types(l_emp_rec.nationality,p_business_gr_id,'NL_NATIONALITY');
10471 FETCH csr_get_shared_types INTO l_bg,l_nationality;
10472 CLOSE csr_get_shared_types;
10473 --
10474 IF g_contract_code_mapping = 'NL_EMPLOYMENT_CATG' THEN
10475 OPEN csr_get_shared_types(l_emp_rec.employment_category,p_business_gr_id,g_contract_code_mapping);
10476 FETCH csr_get_shared_types INTO l_bg,l_assignment_catg;
10477 CLOSE csr_get_shared_types;
10478 ELSE
10479 OPEN csr_get_shared_types(l_emp_rec.employee_category,p_business_gr_id,g_contract_code_mapping);
10480 FETCH csr_get_shared_types INTO l_bg,l_assignment_catg;
10481 CLOSE csr_get_shared_types;
10482 END IF;
10483 --
10484 l_income_code := 'N';
10485 l_work_pattern := 'N';
10486 l_wage_tax_discount := 'N';
10487 l_wage_tax_table := 'N';
10488 l_wage_aow := 'N';
10489 l_wage_wajong := 'N';
10490 l_emp_loan := 'N';
10491 l_transportation := 'N';
10492 --Fnd_file.put_line(FND_FILE.LOG,' Get scl Data '||l_emp_rec.soft_coding_keyflex_id);
10493 get_scl_data(l_emp_rec.soft_coding_keyflex_id
10494 ,p_chk_end_date
10495 ,l_income_code
10496 ,l_work_pattern -- specific income code.
10497 ,l_wage_tax_discount
10498 --,l_company_car_use
10499 ,l_wage_tax_table
10500 ,l_wage_aow
10501 ,l_wage_wajong
10502 ,l_emp_loan
10503 ,l_transportation
10504 ,l_chk);
10505 --
10506 l_surrogate_key := NULL;
10507 --Fnd_file.put_line(FND_FILE.LOG,' Get Assignment EIT Data :'||l_assignment_id||' l_surrogate_key :'||l_surrogate_key);
10508 get_assignment_extra_info(l_assignment_id -- pick data for p_date
10509 ,l_surrogate_key
10510 ,p_date
10511 ,p_chk_start_date
10512 ,p_chk_end_date
10513 ,l_labour_rel_code
10514 ,l_ins_duty_code
10515 ,l_FZ_Code
10516 ,l_handicapped_code
10517 ,l_wao_insured
10518 ,l_ww_insured
10519 ,l_zw_insured
10520 ,l_zvw_situation
10521 ,l_marginal_empl /* LC 2010*/
10522 ,l_wm_old_rule /* LC 2010*/
10523 ,l_temp_tax_discount /* LC 2010*/
10524 ,l_chk);
10525 --LC 2012 begin.
10526 IF p_effective_date < TO_DATE('01012012','DDMMYYYY') THEN
10527 --LC 2010--begin
10528 l_zvw_small_jobs := NULL;
10529 l_small_job := NULL;
10530 FOR assignments IN csr_get_other_assignments(p_assignment_id
10531 ,p_chk_start_date
10532 ,p_chk_end_date
10533 ,p_business_gr_id
10534 ,l_tax_unit_id
10535 ,p_payroll_type) LOOP
10536
10537 l_other_assignment_action_id := NULL;
10538 l_assg_small_job := NULL;
10539 OPEN csr_get_assignment_action_id(assignments.assignment_id,p_chk_start_date);
10540 FETCH csr_get_assignment_action_id INTO l_other_assignment_action_id;
10541 CLOSE csr_get_assignment_action_id;
10542
10543 IF l_other_assignment_action_id IS NOT NULL THEN
10544 OPEN csr_get_small_job_detail(l_other_assignment_action_id,p_date);
10545 FETCH csr_get_small_job_detail INTO l_assg_small_job;
10546 CLOSE csr_get_small_job_detail;
10547 END IF;
10548
10549 IF l_assg_small_job IS NOT NULL THEN
10550 IF l_assg_small_job = 'N' THEN
10551 l_small_job := 'N';
10552 EXIT;
10553 ELSIF (l_small_job = 'F' OR l_small_job IS NULL) AND l_assg_small_job = 'F' THEN
10554 l_small_job := 'F';
10555 END IF;
10556 END IF;
10557 END LOOP;
10558
10559 IF l_small_job = 'F' THEN
10560 IF l_zvw_situation <> 'J' OR l_zvw_situation IS NULL THEN
10561 l_zvw_situation := 'J';
10562 l_zvw_small_jobs := 'D'; --Defaulted
10563 END IF;
10564 IF l_ins_duty_code <> 'F' THEN
10565 l_ins_duty_code := l_ins_duty_code||'F'; --Append F
10566 END IF;
10567 ELSIF l_small_job = 'N' AND l_zvw_situation ='J' THEN
10568 l_zvw_small_jobs := 'W'; --Warning
10569 END IF;
10570 --LC 2010--end
10571 END IF;
10572 --LC 2012 end
10573 --
10574 l_zvw_defaulted := NULL;
10575 IF l_zvw_situation IS NULL THEN
10576 l_zvw_situation := 'A';
10577 l_zvw_defaulted := 'Y';
10578 END IF;
10579 --
10580 OPEN csr_get_element_det('Holiday Coupons','Receiving Coupons',l_assignment_id,p_date);
10581 FETCH csr_get_element_det INTO l_holiday_coupen;
10582 CLOSE csr_get_element_det;
10583 IF l_holiday_coupen = 'Y' THEN
10584 l_holiday_coupen := 'J';
10585 END IF;
10586 --
10587 OPEN csr_get_element_det('Incidental Income Decrease','Decrease Code',l_assignment_id,p_date);
10588 FETCH csr_get_element_det INTO l_income_increase;
10589 CLOSE csr_get_element_det;
10590 --
10591 OPEN csr_get_element_det('Additional Allowance','Receiving Allowance',l_assignment_id,p_date);
10592 FETCH csr_get_element_det INTO l_add_allowance;
10593 CLOSE csr_get_element_det;
10594 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
10595 l_add_allowance := NULL;
10596 ELSIF l_add_allowance = 'Y' THEN
10597 l_add_allowance := 'J';
10598 END IF;
10599 --
10600 OPEN csr_get_element_det('Company Car Private Usage','Code Usage',l_assignment_id,p_date);
10601 FETCH csr_get_element_det INTO l_company_car_use;
10602 CLOSE csr_get_element_det;
10603 --
10604 --Fnd_file.put_line(FND_FILE.LOG,' Get Element Data :');
10605 --Fnd_file.put_line(FND_FILE.LOG,' l_holiday_coupen :'||l_holiday_coupen);
10606 --Fnd_file.put_line(FND_FILE.LOG,' l_income_increase :'||l_income_increase);
10607 --Fnd_file.put_line(FND_FILE.LOG,' l_add_allowance :'||l_add_allowance);
10608 --Fnd_file.put_line(FND_FILE.LOG,' l_company_car_use :'||l_company_car_use);
10609 --
10610 IF l_emp_rec.collective_agreement_id IS NULL THEN
10611 OPEN csr_get_eit_cao(l_emp_rec.assignment_id);
10612 FETCH csr_get_eit_cao INTO l_cao_code;
10613 CLOSE csr_get_eit_cao;
10614 --Fnd_file.put_line(FND_FILE.LOG,' Collective Agreement id null get from eit :'||l_cao_code);
10615 ELSE
10616 OPEN csr_get_cao_code(l_emp_rec.collective_agreement_id);
10617 FETCH csr_get_cao_code INTO l_cao_code;
10618 CLOSE csr_get_cao_code;
10619 --Fnd_file.put_line(FND_FILE.LOG,' Collective Agreement id not null get from collective agreement table. :'||l_cao_code);
10620 END IF;
10621 l_old_cao_code := l_cao_code;
10622 l_archive_emp_info := 'Y';
10623 l_initial_flag := 'N';
10624 --
10625 l_type := 'CORRECTION';
10626 --
10627 l_chk_emp_reported := 'N';
10628 l_period_start_date := TO_DATE('01-01-0001','dd-mm-yyyy');
10629 IF l_rec_changes.COUNT <> 0 THEN
10630 FOR i IN l_rec_changes.FIRST..l_rec_changes.LAST LOOP
10631 --
10632 IF l_rec_changes(i).retro = 'WITHDRAWAL' THEN
10633 OPEN csr_get_emp_data(l_assignment_id,l_rec_changes(i).effective_date);
10634 FETCH csr_get_emp_data INTO l_emp_rec;
10635 CLOSE csr_get_emp_data;
10636 --
10637 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5','NL6') THEN
10638 l_emp_rec.change_reason := NULL;
10639 END IF;
10640 --
10641 --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);
10642 l_emp_end_date := NULL;
10643 IF l_ass_end_date <= l_rec_changes(i).period_end_date THEN
10644 l_emp_end_date := l_ass_end_date;
10645 END IF;
10646 --
10647 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
10648 l_type := 'INITIAL';
10649 ELSIF l_chk_emp_reported = 'N' OR g_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN
10650 l_type := 'CORRECTION';
10651 ELSE
10652 l_type := 'CORRECT';
10653 END IF;
10654 --Fnd_file.put_line(FND_FILE.LOG,' l_type :'||l_type);
10655 --Fnd_file.put_line(FND_FILE.LOG,' g_effective_date :'||fnd_date.date_to_canonical(g_effective_date));
10656 --
10657 /* 8328995 */
10658 l_numiv_override:=null;
10659 OPEN csr_numiv_override(p_assignment_id);
10660 FETCH csr_numiv_override INTO l_numiv_override;
10661 CLOSE csr_numiv_override;
10662
10663 pay_action_information_api.create_action_information (
10664 p_action_information_id => l_master_action_info_id
10665 ,p_action_context_id => p_assactid
10666 ,p_action_context_type => 'AAP'
10667 ,p_object_version_number => l_ovn
10668 ,p_assignment_id => l_emp_rec.assignment_id
10669 ,p_effective_date => p_effective_date
10670 ,p_source_id => NULL
10671 ,p_source_text => NULL
10672 ,p_tax_unit_id => l_tax_unit_id
10673 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
10674 ,p_action_information1 => 'WITHDRAWAL'
10675 ,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')))
10676 ,p_action_information3 => fnd_date.date_to_canonical(l_rec_changes(i).period_end_date)
10677 ,p_action_information4 => l_emp_rec.assignment_number
10678 ,p_action_information5 => l_emp_rec.employee_number
10679 ,p_action_information6 => substr(l_emp_rec.change_reason,3)
10680 ,p_action_information8 => l_emp_rec.sofi_number
10681 ,p_action_information7 => l_emp_rec.person_id
10682 ,p_action_information9 => l_emp_rec.Initials
10683 ,p_action_information10 => l_emp_rec.prefix
10684 ,p_action_information11 => l_emp_rec.last_name
10685 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
10686 ,p_action_information13 => l_nationality
10687 ,p_action_information14 => l_emp_rec.gender
10688 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
10689 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
10690 ,p_action_information17 => l_rec_changes(i).retro
10691 ,p_action_information18 => nvl(l_numiv_override,l_emp_seq)); -- 8328995
10692
10693 /* 9764359 */
10694 --
10695 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: chk_events 1 ');
10696 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before l_num_over_clash: '|| to_char(l_num_over_clash));
10697 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before l_emp_rec.assignment_id: '|| l_emp_rec.assignment_id);
10698 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before Sequencs: '|| nvl(l_numiv_override,l_emp_seq));
10699 l_num_over_clash:=HR_NL_ASG_EXTRA_INFO_CHECKS.ASG_CHECK_NUMIV_OVERRIDE(l_emp_rec.assignment_id,nvl(l_numiv_override,l_emp_seq));
10700 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: After l_num_over_clash: '|| to_char(l_num_over_clash));
10701 --
10702 IF l_num_over_clash=1 THEN
10703 pay_action_information_api.create_action_information
10704 (
10705 p_action_information_id => l_action_info_id
10706 , p_action_context_id => p_assactid
10707 , p_action_context_type => 'AAP'
10708 , p_object_version_number => l_ovn
10709 , p_assignment_id => NULL
10710 , p_effective_date => p_effective_date
10711 , p_source_id => NULL
10712 , p_source_text => NULL
10713 , p_tax_unit_id => l_tax_unit_id
10714 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
10715 , p_action_information4 => fnd_message.get_string('PER','HR_373547_NUMIV_OVERRIDE')
10716 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
10717 , p_action_information6 => 'Num IV override Already Used'
10718 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
10719 , p_action_information8 => l_emp_rec.assignment_number);
10720 END IF;
10721 --
10722 ELSE
10723 --
10724 --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);
10725 --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);
10726 IF l_type <> 'INITIAL' AND
10727 l_rec_changes(i).effective_date BETWEEN p_chk_start_date AND p_chk_end_date AND
10728 l_rec_changes(i).effective_date <> GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date) AND
10729 l_archive_emp_info <> 'N'THEN
10730 --
10731 --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);
10732 l_emp_end_date := NULL;
10733 IF l_ass_end_date <= l_rec_changes(i).period_end_date THEN
10734 l_emp_end_date := l_ass_end_date;
10735 END IF;
10736 OPEN csr_get_emp_data(l_assignment_id,NVL(l_emp_end_date,p_chk_end_date));
10737 FETCH csr_get_emp_data INTO l_emp_rec;
10738 CLOSE csr_get_emp_data;
10739 --
10740 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5','NL6') THEN
10741 l_emp_rec.change_reason := NULL;
10742 END IF;
10743 --
10744 /* 8328995 */
10745 l_numiv_override:=null;
10746 OPEN csr_numiv_override(p_assignment_id);
10747 FETCH csr_numiv_override INTO l_numiv_override;
10748 CLOSE csr_numiv_override;
10749 --10100628
10750
10751 IF p_prev_corr_year <> '-9999' THEN
10752 l_arc_y_n := IS_ARCHIVED(p_assactid, 'NL_WR_EMPLOYMENT_INFO', 'INITIAL');
10753 IF l_arc_y_n = 'N' THEN
10754 pay_action_information_api.create_action_information (
10755 p_action_information_id => l_master_action_info_id
10756 ,p_action_context_id => p_assactid
10757 ,p_action_context_type => 'AAP'
10758 ,p_object_version_number => l_ovn
10759 ,p_assignment_id => l_emp_rec.assignment_id
10760 ,p_effective_date => p_effective_date
10761 ,p_source_id => NULL
10762 ,p_source_text => NULL
10763 ,p_tax_unit_id => l_tax_unit_id
10764 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
10765 ,p_action_information1 => 'INITIAL'
10766 ,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')))
10767 ,p_action_information3 => fnd_date.date_to_canonical(l_rec_changes(i).period_end_date)
10768 ,p_action_information4 => l_emp_rec.assignment_number
10769 ,p_action_information5 => l_emp_rec.employee_number
10770 ,p_action_information6 => substr(l_emp_rec.change_reason,3)
10771 ,p_action_information8 => l_emp_rec.sofi_number
10772 ,p_action_information7 => l_emp_rec.person_id
10773 ,p_action_information9 => l_emp_rec.Initials
10774 ,p_action_information10 => l_emp_rec.prefix
10775 ,p_action_information11 => l_emp_rec.last_name
10776 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
10777 ,p_action_information13 => l_nationality
10778 ,p_action_information14 => l_emp_rec.gender
10779 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)
10780 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
10781 ,p_action_information17 => l_rec_changes(i).retro
10782 ,p_action_information18 => nvl(l_numiv_override,l_emp_seq)); -- 8328995
10783
10784 END IF;
10785 ELSE
10786 --10100628
10787 pay_action_information_api.create_action_information (
10788 p_action_information_id => l_master_action_info_id
10789 ,p_action_context_id => p_assactid
10790 ,p_action_context_type => 'AAP'
10791 ,p_object_version_number => l_ovn
10792 ,p_assignment_id => l_emp_rec.assignment_id
10793 ,p_effective_date => p_effective_date
10794 ,p_source_id => NULL
10795 ,p_source_text => NULL
10796 ,p_tax_unit_id => l_tax_unit_id
10797 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
10798 ,p_action_information1 => 'INITIAL'
10799 ,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')))
10800 ,p_action_information3 => fnd_date.date_to_canonical(l_rec_changes(i).period_end_date)
10801 ,p_action_information4 => l_emp_rec.assignment_number
10802 ,p_action_information5 => l_emp_rec.employee_number
10803 ,p_action_information6 => substr(l_emp_rec.change_reason,3)
10804 ,p_action_information8 => l_emp_rec.sofi_number
10805 ,p_action_information7 => l_emp_rec.person_id
10806 ,p_action_information9 => l_emp_rec.Initials
10807 ,p_action_information10 => l_emp_rec.prefix
10808 ,p_action_information11 => l_emp_rec.last_name
10809 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
10810 ,p_action_information13 => l_nationality
10811 ,p_action_information14 => l_emp_rec.gender
10812 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)
10813 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
10814 ,p_action_information17 => l_rec_changes(i).retro
10815 ,p_action_information18 => nvl(l_numiv_override,l_emp_seq)); -- 8328995
10816
10817 END IF; --10100628
10818 /* 9764359 */
10819 --
10820 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: chk_events 2 ');
10821 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before l_num_over_clash: '|| to_char(l_num_over_clash));
10822 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before l_emp_rec.assignment_id: '|| l_emp_rec.assignment_id);
10823 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before Sequencs: '|| nvl(l_numiv_override,l_emp_seq));
10824 l_num_over_clash:=HR_NL_ASG_EXTRA_INFO_CHECKS.ASG_CHECK_NUMIV_OVERRIDE(l_emp_rec.assignment_id,nvl(l_numiv_override,l_emp_seq));
10825 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: After l_num_over_clash: '|| to_char(l_num_over_clash));
10826 --
10827 IF l_num_over_clash=1 THEN
10828 pay_action_information_api.create_action_information
10829 (
10830 p_action_information_id => l_action_info_id
10831 , p_action_context_id => p_assactid
10832 , p_action_context_type => 'AAP'
10833 , p_object_version_number => l_ovn
10834 , p_assignment_id => NULL
10835 , p_effective_date => p_effective_date
10836 , p_source_id => NULL
10837 , p_source_text => NULL
10838 , p_tax_unit_id => l_tax_unit_id
10839 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
10840 , p_action_information4 => fnd_message.get_string('PER','HR_373547_NUMIV_OVERRIDE')
10841 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
10842 , p_action_information6 => 'Num IV override Already Used'
10843 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
10844 , p_action_information8 => l_emp_rec.assignment_number);
10845 END IF;
10846 --
10847 --
10848 l_archive_emp_info := 'N';
10849 --
10850 OPEN get_scl_id(l_emp_rec.assignment_id,GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date));
10851 FETCH get_scl_id INTO l_scl_id;
10852 CLOSE get_scl_id;
10853 --
10854 l_income_code := 'N';
10855 l_work_pattern := 'N';
10856 l_wage_tax_discount := 'N';
10857 l_wage_tax_table := 'N';
10858 l_wage_aow := 'N';
10859 l_wage_wajong := 'N';
10860 l_emp_loan := 'N';
10861 l_transportation := 'N';
10862 --
10863 get_scl_data(l_scl_id --l_emp_rec.soft_coding_keyflex_id
10864 ,p_chk_end_date
10865 ,l_income_code
10866 ,l_work_pattern -- specific income code.
10867 ,l_wage_tax_discount
10868 --,l_company_car_use
10869 ,l_wage_tax_table
10870 ,l_wage_aow
10871 ,l_wage_wajong
10872 ,l_emp_loan
10873 ,l_transportation
10874 ,l_chk);
10875 --
10876 l_surrogate_key := NULL;
10877 get_assignment_extra_info(l_assignment_id
10878 ,l_surrogate_key
10879 ,GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date)
10880 ,p_chk_start_date
10881 ,p_chk_end_date
10882 ,l_labour_rel_code
10883 ,l_ins_duty_code
10884 ,l_FZ_Code
10885 ,l_handicapped_code
10886 ,l_wao_insured
10887 ,l_ww_insured
10888 ,l_zw_insured
10889 ,l_zvw_situation
10890 ,l_marginal_empl /* LC 2010*/
10891 ,l_wm_old_rule /* LC 2010*/
10892 ,l_temp_tax_discount /* LC 2010*/
10893 ,l_chk);
10894 --LC 2012 begin
10895 IF p_effective_date < TO_DATE('01012012','DDMMYYYY') THEN
10896 --LC 2010--begin
10897 l_zvw_small_jobs := NULL;
10898 l_small_job := NULL;
10899 FOR assignments IN csr_get_other_assignments(l_assignment_id
10900 ,p_chk_start_date
10901 ,p_chk_end_date
10902 ,p_business_gr_id
10903 ,l_tax_unit_id
10904 ,p_payroll_type) LOOP
10905
10906 l_other_assignment_action_id := NULL;
10907 l_assg_small_job := NULL;
10908 OPEN csr_get_assignment_action_id(assignments.assignment_id,p_chk_start_date);
10909 FETCH csr_get_assignment_action_id INTO l_other_assignment_action_id;
10910 CLOSE csr_get_assignment_action_id;
10911
10912 IF l_other_assignment_action_id IS NOT NULL THEN
10913 OPEN csr_get_small_job_detail(l_other_assignment_action_id,GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date));
10914 FETCH csr_get_small_job_detail INTO l_assg_small_job;
10915 CLOSE csr_get_small_job_detail;
10916 END IF;
10917
10918 IF l_assg_small_job IS NOT NULL THEN
10919 IF l_assg_small_job = 'N' THEN
10920 l_small_job := 'N';
10921 EXIT;
10922 ELSIF (l_small_job = 'F' OR l_small_job IS NULL) AND l_assg_small_job = 'F' THEN
10923 l_small_job := 'F';
10924 END IF;
10925 END IF;
10926 END LOOP;
10927
10928 IF l_small_job = 'F' THEN
10929 IF l_zvw_situation <> 'J' OR l_zvw_situation IS NULL THEN
10930 l_zvw_situation := 'J';
10931 l_zvw_small_jobs := 'D'; --Defaulted
10932 END IF;
10933 IF l_ins_duty_code <> 'F' THEN
10934 l_ins_duty_code := l_ins_duty_code||'F'; --Append F
10935 END IF;
10936 ELSIF l_small_job = 'N' AND l_zvw_situation ='J' THEN
10937 l_zvw_small_jobs := 'W'; --Warning
10938 END IF;
10939 --LC 2010--end
10940 END IF;
10941 --LC 2012 end
10942 --
10943 l_zvw_defaulted := NULL;
10944 IF l_zvw_situation IS NULL THEN
10945 l_zvw_situation := 'A';
10946 l_zvw_defaulted := 'Y';
10947 END IF;
10948 --
10949 OPEN csr_get_element_det('Holiday Coupons','Receiving Coupons',l_assignment_id,GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date));
10950 FETCH csr_get_element_det INTO l_holiday_coupen;
10951 CLOSE csr_get_element_det;
10952 IF l_holiday_coupen = 'Y' THEN
10953 l_holiday_coupen := 'J';
10954 END IF;
10955 --
10956 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));
10957 FETCH csr_get_element_det INTO l_income_increase;
10958 CLOSE csr_get_element_det;
10959 --
10960 OPEN csr_get_element_det('Additional Allowance','Receiving Allowance',l_assignment_id,GREATEST(l_rec_changes(i).period_start_date,l_ass_start_date));
10961 FETCH csr_get_element_det INTO l_add_allowance;
10962 CLOSE csr_get_element_det;
10963 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
10964 l_add_allowance := NULL;
10965 ELSIF l_add_allowance = 'Y' THEN
10966 l_add_allowance := 'J';
10967 END IF;
10968 --
10969 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));
10970 FETCH csr_get_element_det INTO l_company_car_use;
10971 CLOSE csr_get_element_det;
10972 --
10973 --Fnd_file.put_line(FND_FILE.LOG,' Creating NL_WR_INCOME_PERIOD Infor Record for Type : INITIAL');
10974 --10100628
10975 IF p_prev_corr_year <> '-9999' THEN
10976 l_arc_y_n := IS_ARCHIVED(p_assactid, 'NL_WR_INCOME_PERIOD', 'INITIAL');
10977 IF l_arc_y_n = 'N' THEN
10978
10979 pay_action_information_api.create_action_information (
10980 p_action_information_id => l_action_info_id
10981 , p_action_context_id => p_assactid
10982 , p_action_context_type => 'AAP'
10983 , p_object_version_number => l_ovn
10984 , p_assignment_id => l_emp_rec.assignment_id
10985 , p_effective_date => p_effective_date
10986 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
10987 , p_tax_unit_id => l_tax_unit_id
10988 , p_action_information1 => 'INITIAL'
10989 , p_action_information2 => l_master_action_info_id
10990 , 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')))
10991 , p_action_information6 => l_income_code
10992 , p_action_information7 => l_labour_rel_code
10993 , p_action_information8 => l_ins_duty_code
10994 , p_action_information9 => l_assignment_catg
10995 , p_action_information10 => l_FZ_Code
10996 , p_action_information11 => l_work_pattern
10997 , p_action_information12 => l_cao_code
10998 , p_action_information13 => l_handicapped_code
10999 , p_action_information14 => l_wage_tax_discount
11000 , p_action_information15 => l_company_car_use
11001 , p_action_information16 => l_wage_tax_table
11002 , p_action_information17 => l_wao_insured
11003 , p_action_information18 => l_ww_insured
11004 , p_action_information19 => l_zw_insured
11005 , p_action_information20 => NVL(l_zvw_situation,'A')
11006 , p_action_information21 => l_holiday_coupen
11007 , p_action_information22 => l_wage_aow
11008 , p_action_information23 => l_wage_wajong
11009 , p_action_information24 => l_emp_loan
11010 , p_action_information25 => l_transportation
11011 , p_action_information26 => l_income_increase
11012 , p_action_information27 => l_add_allowance
11013 , p_action_information28 => l_marginal_empl/* LC 2010*/
11014 , p_action_information29 => l_wm_old_rule/* LC 2010*/
11015 , p_action_information30 => l_temp_tax_discount);/* LC 2013*/ --IndTijdHk
11016 END IF;
11017 ELSE
11018 --10100628
11019
11020 pay_action_information_api.create_action_information (
11021 p_action_information_id => l_action_info_id
11022 , p_action_context_id => p_assactid
11023 , p_action_context_type => 'AAP'
11024 , p_object_version_number => l_ovn
11025 , p_assignment_id => l_emp_rec.assignment_id
11026 , p_effective_date => p_effective_date
11027 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
11028 , p_tax_unit_id => l_tax_unit_id
11029 , p_action_information1 => 'INITIAL'
11030 , p_action_information2 => l_master_action_info_id
11031 , 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')))
11032 , p_action_information6 => l_income_code
11033 , p_action_information7 => l_labour_rel_code
11034 , p_action_information8 => l_ins_duty_code
11035 , p_action_information9 => l_assignment_catg
11036 , p_action_information10 => l_FZ_Code
11037 , p_action_information11 => l_work_pattern
11038 , p_action_information12 => l_cao_code
11039 , p_action_information13 => l_handicapped_code
11040 , p_action_information14 => l_wage_tax_discount
11041 , p_action_information15 => l_company_car_use
11042 , p_action_information16 => l_wage_tax_table
11043 , p_action_information17 => l_wao_insured
11044 , p_action_information18 => l_ww_insured
11045 , p_action_information19 => l_zw_insured
11046 , p_action_information20 => NVL(l_zvw_situation,'A')
11047 , p_action_information21 => l_holiday_coupen
11048 , p_action_information22 => l_wage_aow
11049 , p_action_information23 => l_wage_wajong
11050 , p_action_information24 => l_emp_loan
11051 , p_action_information25 => l_transportation
11052 , p_action_information26 => l_income_increase
11053 , p_action_information27 => l_add_allowance
11054 , p_action_information28 => l_marginal_empl/* LC 2010*/
11055 , p_action_information29 => l_wm_old_rule/* LC 2010*/
11056 , p_action_information30 => l_temp_tax_discount);/* LC 2013*/ --IndTijdHk
11057 END IF; --10100628
11058 --
11059 l_initial_flag := 'Y';
11060 l_type := 'INITIAL';
11061 --
11062 END IF;
11063
11064 l_chk := 'Y';
11065 IF l_rec_changes(i).update_type = 'U' AND
11066 l_rec_changes(i).column_name = 'EFFECTIVE_START_DATE' AND
11067 l_rec_changes(i).dated_table_id NOT IN (l_table1,l_table2) AND
11068 l_chg_pending = 'N' THEN
11069 l_chk := 'N';
11070 END IF;
11071 --
11072 IF l_chk = 'Y' THEN
11073 IF l_rec_changes(i).column_name = 'COLLECTIVE_AGREEMENT_ID' THEN
11074 l_emp_rec.collective_agreement_id := l_rec_changes(i).new_value;
11075 IF l_rec_changes(i).new_value IS NULL THEN
11076 OPEN csr_get_col_agreement_id(l_assignment_id,l_rec_changes(i).effective_date);
11077 FETCH csr_get_col_agreement_id INTO l_emp_rec.collective_agreement_id;
11078 CLOSE csr_get_col_agreement_id;
11079 END IF;
11080 l_cao_code := NULL;
11081 OPEN csr_get_cao_code(l_emp_rec.collective_agreement_id);
11082 FETCH csr_get_cao_code INTO l_cao_code;
11083 CLOSE csr_get_cao_code;
11084 IF NVL(l_old_cao_code,-1) = NVL(l_cao_code,-1) THEN
11085 l_chk := 'N';
11086 END IF;
11087 IF p_date = l_rec_changes(i).effective_date THEN
11088 l_chk := 'Y';
11089 END IF;
11090 l_old_cao_code := l_cao_code;
11091 --Fnd_file.put_line(FND_FILE.LOG,' Change in collective agreement ID New val :'||l_cao_code);
11092 --
11093 ELSIF l_rec_changes(i).column_name = 'CHANGE_REASON' THEN
11094 --Fnd_file.put_line(FND_FILE.LOG,' Change in change_reason New val :'||l_rec_changes(i).new_value);
11095 --l_emp_rec.CHANGE_REASON := l_rec_changes(i).new_value;
11096 IF l_rec_changes(i).new_value IN ('NL1','NL2','NL3','NL4','NL5') THEN
11097 l_emp_rec.CHANGE_REASON := l_rec_changes(i).new_value;
11098 END IF;
11099 IF l_chg_pending <> 'Y' THEN
11100 l_chk := 'N';
11101 ELSE
11102 l_chk := 'Y';
11103 END IF;
11104 --ELSIF l_rec_changes(i).column_name = 'EMPLOYMENT_CATEGORY' THEN
11105 ELSIF (g_contract_code_mapping = 'NL_EMPLOYMENT_CATG' AND l_rec_changes(i).column_name = 'EMPLOYMENT_CATEGORY') OR
11106 (g_contract_code_mapping = 'NL_EMPLOYEE_CATG' AND l_rec_changes(i).column_name = 'EMPLOYEE_CATEGORY') THEN
11107 l_emp_rec.employment_category := l_rec_changes(i).new_value; -- only certain category changes needs to be monitored
11108 l_assignment_catg_old := l_assignment_catg;
11109 OPEN csr_get_shared_types(l_emp_rec.employment_category,p_business_gr_id,g_contract_code_mapping);
11110 FETCH csr_get_shared_types INTO l_bg,l_assignment_catg;
11111 CLOSE csr_get_shared_types;
11112 IF l_assignment_catg_old <> 'O' AND
11113 l_assignment_catg_old <> 'B' AND
11114 l_assignment_catg <> 'O' AND
11115 l_assignment_catg <> 'B' AND
11116 l_assignment_catg <> l_assignment_catg_old AND
11117 l_income_code NOT IN ('11','12','13','14','15','18')THEN
11118 l_chk := 'N';
11119 END IF;
11120 IF p_date = l_rec_changes(i).effective_date THEN
11121 l_chk := 'Y';
11122 END IF;
11123 --Fnd_file.put_line(FND_FILE.LOG,' Change in assignment category New val :'||l_assignment_catg);
11124 --
11125 ELSIF ((g_contract_code_mapping = 'NL_EMPLOYMENT_CATG' AND l_rec_changes(i).column_name = 'EMPLOYEE_CATEGORY') OR
11126 (g_contract_code_mapping = 'NL_EMPLOYEE_CATG' AND l_rec_changes(i).column_name = 'EMPLOYMENT_CATEGORY')) AND
11127 l_chg_pending = 'N' THEN
11128 l_chk := 'N';
11129
11130 ELSIF l_rec_changes(i).column_name = 'ASSIGNMENT_STATUS_TYPE_ID' THEN
11131 l_emp_rec.ASSIGNMENT_STATUS_TYPE_ID := l_rec_changes(i).new_value;
11132 ELSIF l_rec_changes(i).column_name = 'SOFT_CODING_KEYFLEX_ID' THEN
11133 SELECT soft_coding_keyflex_id
11134 INTO l_emp_rec.soft_coding_keyflex_id
11135 FROM per_all_assignments_f
11136 WHERE assignment_id = l_assignment_id
11137 AND l_rec_changes(i).effective_date BETWEEN effective_start_date AND effective_end_date;
11138 --
11139 --Fnd_file.put_line(FND_FILE.LOG,' Change in SCL New val :'||l_rec_changes(i).new_value);
11140 get_scl_data(l_emp_rec.soft_coding_keyflex_id
11141 ,p_chk_end_date
11142 ,l_income_code
11143 ,l_work_pattern -- income code
11144 ,l_wage_tax_discount
11145 -- ,l_company_car_use
11146 ,l_wage_tax_table
11147 ,l_wage_aow
11148 ,l_wage_wajong
11149 ,l_emp_loan
11150 ,l_transportation
11151 ,l_chk);
11152 IF p_date = l_rec_changes(i).effective_date THEN
11153 l_chk := 'Y';
11154 END IF;
11155 --Fnd_file.put_line(FND_FILE.LOG,' Change in SCL New val :'||l_rec_changes(i).new_value||l_chk);
11156 ELSIF (l_rec_changes(i).column_name LIKE 'AEI_INFORMATION%')
11157 OR l_rec_changes(i).dated_table_id = l_table3 THEN
11158 --Fnd_file.put_line(FND_FILE.LOG,' Change in EIT New val :'||l_rec_changes(i).surrogate_key);
11159 IF i <> l_rec_changes.count THEN
11160 IF l_rec_changes(i).dated_table_id <> l_rec_changes(i+1).dated_table_id OR
11161 l_rec_changes(i).effective_date <> l_rec_changes(i+1).effective_date THEN
11162 get_assignment_extra_info(l_assignment_id
11163 ,NULL --l_rec_changes(i).surrogate_key
11164 ,l_rec_changes(i).effective_date
11165 ,l_rec_changes(i).period_start_date
11166 ,l_rec_changes(i).period_end_date
11167 ,l_labour_rel_code
11168 ,l_ins_duty_code
11169 ,l_FZ_Code
11170 ,l_handicapped_code
11171 ,l_wao_insured
11172 ,l_ww_insured
11173 ,l_zw_insured
11174 ,l_zvw_situation
11175 ,l_marginal_empl
11176 ,l_wm_old_rule
11177 ,l_temp_tax_discount
11178 ,l_chk);
11179 --LC 2012 begin
11180 IF p_effective_date < TO_DATE('01012012','DDMMYYYY') THEN
11181 --LC 2010--begin
11182 l_zvw_small_jobs := NULL;
11183 l_small_job := NULL;
11184 FOR assignments IN csr_get_other_assignments(l_assignment_id
11185 ,l_rec_changes(i).period_start_date
11186 ,l_rec_changes(i).period_end_date
11187 ,p_business_gr_id
11188 ,l_tax_unit_id
11189 ,p_payroll_type) LOOP
11190 l_other_assignment_action_id := NULL;
11191 l_assg_small_job := NULL;
11192 OPEN csr_get_assignment_action_id(assignments.assignment_id,l_rec_changes(i).period_start_date);
11193 FETCH csr_get_assignment_action_id INTO l_other_assignment_action_id;
11194 CLOSE csr_get_assignment_action_id;
11195
11196 IF l_other_assignment_action_id IS NOT NULL THEN
11197 OPEN csr_get_small_job_detail(l_other_assignment_action_id,l_rec_changes(i).effective_date);
11198 FETCH csr_get_small_job_detail INTO l_assg_small_job;
11199 CLOSE csr_get_small_job_detail;
11200 END IF;
11201
11202 IF l_assg_small_job IS NOT NULL THEN
11203 IF l_assg_small_job = 'N' THEN
11204 l_small_job := 'N';
11205 EXIT;
11206 ELSIF (l_small_job = 'F' OR l_small_job IS NULL) AND l_assg_small_job = 'F' THEN
11207 l_small_job := 'F';
11208 END IF;
11209 END IF;
11210 END LOOP;
11211
11212
11213 IF l_small_job = 'F' THEN
11214 IF l_zvw_situation <> 'J' OR l_zvw_situation IS NULL THEN
11215 l_zvw_situation := 'J';
11216 l_zvw_small_jobs := 'D'; --Defaulted
11217 END IF;
11218 IF l_ins_duty_code <> 'F' THEN
11219 l_ins_duty_code := l_ins_duty_code||'F'; --Append F
11220 END IF;
11221 ELSIF l_small_job = 'N' AND l_zvw_situation ='J' THEN
11222 l_zvw_small_jobs := 'W'; --Warning
11223 END IF;
11224 --LC 2010--end
11225 END IF;
11226 --LC 2012 end
11227 --
11228 l_zvw_defaulted := NULL;
11229 IF l_zvw_situation IS NULL THEN
11230 l_zvw_situation := 'A';
11231 l_zvw_defaulted := 'Y';
11232 END IF;
11233 --
11234 IF p_date = l_rec_changes(i).effective_date THEN
11235 l_chk := 'Y';
11236 END IF;
11237 ELSE
11238 l_chk := 'N';
11239 --Fnd_file.put_line(FND_FILE.LOG,' IGNORING CHANGE : Next change on same effective date and same table');
11240 END IF;
11241 ELSE
11242 get_assignment_extra_info(l_assignment_id
11243 ,NULL--l_rec_changes(i).surrogate_key
11244 ,l_rec_changes(i).effective_date
11245 ,l_rec_changes(i).period_start_date
11246 ,l_rec_changes(i).period_end_date
11247 ,l_labour_rel_code
11248 ,l_ins_duty_code
11249 ,l_FZ_Code
11250 ,l_handicapped_code
11251 ,l_wao_insured
11252 ,l_ww_insured
11253 ,l_zw_insured
11254 ,l_zvw_situation
11255 ,l_marginal_empl
11256 ,l_wm_old_rule
11257 ,l_temp_tax_discount
11258 ,l_chk);
11259 --LC 2012 begin
11260 IF p_effective_date < TO_DATE('01012012','DDMMYYYY') THEN
11261 --LC 2010--begin
11262 l_zvw_small_jobs := NULL;
11263 l_small_job := NULL;
11264 FOR assignments IN csr_get_other_assignments(l_assignment_id
11265 ,l_rec_changes(i).period_start_date
11266 ,l_rec_changes(i).period_end_date
11267 ,p_business_gr_id
11268 ,l_tax_unit_id
11269 ,p_payroll_type) LOOP
11270
11271 l_other_assignment_action_id := NULL;
11272 l_assg_small_job := NULL;
11273 OPEN csr_get_assignment_action_id(assignments.assignment_id,l_rec_changes(i).period_start_date);
11274 FETCH csr_get_assignment_action_id INTO l_other_assignment_action_id;
11275 CLOSE csr_get_assignment_action_id;
11276
11277 IF l_other_assignment_action_id IS NOT NULL THEN
11278 OPEN csr_get_small_job_detail(l_other_assignment_action_id,l_rec_changes(i).effective_date);
11279 FETCH csr_get_small_job_detail INTO l_assg_small_job;
11280 CLOSE csr_get_small_job_detail;
11281 END IF;
11282
11283 IF l_assg_small_job IS NOT NULL THEN
11284 IF l_assg_small_job = 'N' THEN
11285 l_small_job := 'N';
11286 EXIT;
11287 ELSIF (l_small_job = 'F' OR l_small_job IS NULL) AND l_assg_small_job = 'F' THEN
11288 l_small_job := 'F';
11289 END IF;
11290 END IF;
11291 END LOOP;
11292 IF l_small_job = 'F' THEN
11293 IF l_zvw_situation <> 'J' OR l_zvw_situation IS NULL THEN
11294 l_zvw_situation := 'J';
11295 l_zvw_small_jobs := 'D'; --Defaulted
11296 END IF;
11297 IF l_ins_duty_code <> 'F' THEN
11298 l_ins_duty_code := l_ins_duty_code||'F'; --Append F
11299 END IF;
11300 ELSIF l_small_job = 'N' AND l_zvw_situation ='J' THEN
11301 l_zvw_small_jobs := 'W'; --Warning
11302 END IF;
11303 --LC 2010--end
11304 END IF;
11305 --LC 2012 end
11306 --
11307 l_zvw_defaulted := NULL;
11308 IF l_zvw_situation IS NULL THEN
11309 l_zvw_situation := 'A';
11310 l_zvw_defaulted := 'Y';
11311 END IF;
11312 --
11313 IF p_date = l_rec_changes(i).effective_date THEN
11314 l_chk := 'Y';
11315 END IF;
11316 END IF;
11317 ELSIF l_rec_changes(i).dated_table_id = l_table1 THEN
11318 OPEN csr_get_element_name1(l_rec_changes(i).surrogate_key,l_rec_changes(i).effective_date);
11319 FETCH csr_get_element_name1 INTO l_element_name, l_val;
11320 CLOSE csr_get_element_name1;
11321 IF l_element_name IN ('Holiday Coupons','Additional Allowance') AND
11322 l_val = 'Y' THEN
11323 l_val := 'J';
11324 END IF;
11325 --
11326 IF l_element_name = 'Holiday Coupons' THEN
11327 IF NVL(l_holiday_coupen,'X') = l_val THEN
11328 l_chk := 'N';
11329 END IF;
11330 l_holiday_coupen := l_val;
11331 ELSIF l_element_name = 'Incidental Income Decrease' THEN
11332 IF NVL(l_income_increase,'X') = l_val THEN
11333 l_chk := 'N';
11334 END IF;
11335 l_income_increase := l_val;
11336 ELSIF l_element_name = 'Additional Allowance' THEN
11337 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
11338 l_val := NULL;
11339 l_chk := 'N';
11340 ELSIF NVL(l_add_allowance,'X') = l_val THEN
11341 l_chk := 'N';
11342 END IF;
11343 l_add_allowance := l_val;
11344 ELSIF l_element_name = 'Company Car Private Usage' THEN
11345 IF NVL(l_company_car_use,'X') = l_val THEN
11346 l_chk := 'N';
11347 END IF;
11348 l_company_car_use := l_val;
11349 ELSE
11350 l_chk := 'N';
11351 END IF;
11352 IF p_date = l_rec_changes(i).effective_date THEN
11353 l_chk := 'Y';
11354 END IF;
11355 --Fnd_file.put_line(FND_FILE.LOG,' Change in Element entry New val :'||l_rec_changes(i).surrogate_key||l_chk);
11356 --
11357 ELSIF l_rec_changes(i).dated_table_id = l_table2 THEN
11358 OPEN csr_get_element_name2(l_rec_changes(i).surrogate_key,l_rec_changes(i).effective_date);
11359 FETCH csr_get_element_name2 INTO l_element_name, l_val;
11360 CLOSE csr_get_element_name2;
11361 IF l_element_name IN ('Holiday Coupons','Additional Allowance') AND
11362 l_val = 'Y' THEN
11363 l_val := 'J';
11364 END IF;
11365 --
11366 IF l_element_name = 'Holiday Coupons' THEN
11367 IF NVL(l_holiday_coupen,'X') = l_val THEN
11368 l_chk := 'N';
11369 END IF;
11370 l_holiday_coupen := l_val;
11371 ELSIF l_element_name = 'Incidental Income Decrease' THEN
11372 IF NVL(l_income_increase,'X') = l_val THEN
11373 l_chk := 'N';
11374 END IF;
11375 l_income_increase := l_val;
11376 ELSIF l_element_name = 'Additional Allowance' THEN
11377 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
11378 l_val := NULL;
11379 l_chk := 'N';
11380 ELSIF NVL(l_add_allowance,'X') = l_val THEN
11381 l_chk := 'N';
11382 END IF;
11383 l_add_allowance := l_val;
11384 ELSIF l_element_name = 'Company Car Private Usage' THEN
11385 IF NVL(l_company_car_use,'X') = l_val THEN
11386 l_chk := 'N';
11387 END IF;
11388 l_company_car_use := l_val;
11389 ELSE
11390 l_chk := 'N';
11391 END IF;
11392 IF p_date = l_rec_changes(i).effective_date THEN
11393 l_chk := 'Y';
11394 END IF;
11395 --Fnd_file.put_line(FND_FILE.LOG,' Change in Element entry values New val :'||l_rec_changes(i).surrogate_key||l_chk);
11396 --
11397 END IF;
11398 --
11399 IF l_chg_pending = 'Y' THEN
11400 l_chk := 'Y';
11401 END IF;
11402 --
11403 IF i <> l_rec_changes.count THEN
11404 IF l_rec_changes(i).effective_date = l_rec_changes(i + 1).effective_date THEN
11405 --Fnd_file.put_line(FND_FILE.LOG,' IGNORING CHANGE : Next change on same effective date');
11406 l_chk := 'N';
11407 l_chg_pending := 'Y';
11408 END IF;
11409 END IF;
11410 --
11411 /*IF i <> l_rec_changes.count AND
11412 l_rec_changes(i).effective_date BETWEEN p_chk_start_date AND p_chk_end_date AND
11413 l_rec_changes(i).update_type = 'C' AND
11414 l_rec_changes(i).dated_table_id <> l_table3 THEN
11415 --Fnd_file.put_line(FND_FILE.LOG,' IGNORING CHANGE : Correction in current period');
11416 l_chk := 'N';
11417 END IF; */
11418 --
11419 IF l_chk = 'Y' THEN
11420 IF l_period_start_date <> l_rec_changes(i).period_start_date
11421 --OR l_rec_changes(i).column_name = 'CHANGE_REASON'
11422 THEN
11423 l_period_start_date := l_rec_changes(i).period_start_date;
11424 l_period_end_date := l_rec_changes(i).period_end_date;
11425 --
11426 --archive employment info and address context
11427 --
11428 IF l_chk_emp_reported = 'N' AND g_effective_date < TO_DATE('01012007','DDMMYYYY') THEN --## for removing correction rec
11429 OPEN csr_chk_emp_reported(l_emp_rec.assignment_id);
11430 FETCH csr_chk_emp_reported INTO l_chk_emp_reported;
11431 IF csr_chk_emp_reported%notfound THEN
11432 l_chk_emp_reported := 'N';
11433 END IF;
11434 CLOSE csr_chk_emp_reported;
11435 END IF;
11436 --
11437 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
11438 l_type := 'INITIAL';
11439 ELSIF l_chk_emp_reported = 'N' OR g_effective_date >= TO_DATE('01012007','DDMMYYYY') THEN --## for removing correction rec
11440 l_type := 'CORRECTION';
11441 ELSE
11442 l_type := 'CORRECT';
11443 END IF;
11444
11445 IF p_prev_corr_year <> '-9999' THEN --10100628
11446 l_type := 'CORRECTION';
11447 END IF;
11448
11449 --Fnd_file.put_line(FND_FILE.LOG,' l_type :'||l_type);
11450 --Fnd_file.put_line(FND_FILE.LOG,' g_effective_date :'||fnd_date.date_to_canonical(g_effective_date));
11451 --
11452 l_emp_end_date := NULL;
11453 IF l_ass_end_date <= l_period_end_date THEN
11454 l_emp_end_date := l_ass_end_date;
11455 END IF;
11456 --
11457 IF l_type = 'INITIAL' THEN
11458 OPEN csr_get_emp_data(l_assignment_id,NVL(l_emp_end_date,p_chk_end_date));
11459 FETCH csr_get_emp_data INTO l_emp_rec;
11460 CLOSE csr_get_emp_data;
11461 ELSE
11462 OPEN csr_get_emp_data(l_assignment_id,l_rec_changes(i).effective_date);
11463 FETCH csr_get_emp_data INTO l_emp_rec;
11464 CLOSE csr_get_emp_data;
11465 END IF;
11466 --
11467 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5','NL6') THEN
11468 l_emp_rec.change_reason := NULL;
11469 END IF;
11470 --
11471 IF l_archive_emp_info <> 'N' THEN
11472 --Fnd_file.put_line(FND_FILE.LOG,' Creating NL_WR_EMPLOYMENT_INFO INfor Record for Type :'||l_type||' Date :'||l_period_start_date);
11473 /* 8328995 */
11474 l_numiv_override:=null;
11475 OPEN csr_numiv_override(p_assignment_id);
11476 FETCH csr_numiv_override INTO l_numiv_override;
11477 CLOSE csr_numiv_override;
11478
11479 --10100628
11480 IF p_prev_corr_year <> '-9999' THEN
11481 l_arc_y_n := IS_ARCHIVED(p_assactid, 'NL_WR_EMPLOYMENT_INFO', 'INITIAL');
11482 IF l_type = 'INITIAL' THEN
11483 IF l_arc_y_n = 'N' THEN
11484 pay_action_information_api.create_action_information (
11485 p_action_information_id => l_master_action_info_id
11486 ,p_action_context_id => p_assactid
11487 ,p_action_context_type => 'AAP'
11488 ,p_object_version_number => l_ovn
11489 ,p_assignment_id => l_emp_rec.assignment_id
11490 ,p_effective_date => p_effective_date
11491 ,p_source_id => NULL
11492 ,p_source_text => NULL
11493 ,p_tax_unit_id => l_tax_unit_id
11494 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
11495 ,p_action_information1 => l_type
11496 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(l_period_start_date,trunc(l_period_end_date,'Y')))
11497 ,p_action_information3 => fnd_date.date_to_canonical(l_period_end_date)
11498 ,p_action_information4 => l_emp_rec.assignment_number
11499 ,p_action_information5 => l_emp_rec.employee_number
11500 ,p_action_information6 => substr(l_emp_rec.change_reason,3)
11501 ,p_action_information8 => l_emp_rec.sofi_number
11502 ,p_action_information7 => l_emp_rec.person_id
11503 ,p_action_information9 => l_emp_rec.Initials
11504 ,p_action_information10 => l_emp_rec.prefix
11505 ,p_action_information11 => l_emp_rec.last_name
11506 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
11507 ,p_action_information13 => l_nationality
11508 ,p_action_information14 => l_emp_rec.gender
11509 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
11510 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
11511 ,p_action_information17 => l_rec_changes(i).retro
11512 ,p_action_information18 => nvl(l_numiv_override,l_emp_seq)); -- 8328995
11513 END IF;
11514 ELSE
11515 pay_action_information_api.create_action_information (
11516 p_action_information_id => l_master_action_info_id
11517 ,p_action_context_id => p_assactid
11518 ,p_action_context_type => 'AAP'
11519 ,p_object_version_number => l_ovn
11520 ,p_assignment_id => l_emp_rec.assignment_id
11521 ,p_effective_date => p_effective_date
11522 ,p_source_id => NULL
11523 ,p_source_text => NULL
11524 ,p_tax_unit_id => l_tax_unit_id
11525 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
11526 ,p_action_information1 => 'CORRECT' --l_type --10100628
11527 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(l_period_start_date,trunc(l_period_end_date,'Y')))
11528 ,p_action_information3 => fnd_date.date_to_canonical(l_period_end_date)
11529 ,p_action_information4 => l_emp_rec.assignment_number
11530 ,p_action_information5 => l_emp_rec.employee_number
11531 ,p_action_information6 => substr(l_emp_rec.change_reason,3)
11532 ,p_action_information8 => l_emp_rec.sofi_number
11533 ,p_action_information7 => l_emp_rec.person_id
11534 ,p_action_information9 => l_emp_rec.Initials
11535 ,p_action_information10 => l_emp_rec.prefix
11536 ,p_action_information11 => l_emp_rec.last_name
11537 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
11538 ,p_action_information13 => l_nationality
11539 ,p_action_information14 => l_emp_rec.gender
11540 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
11541 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
11542 ,p_action_information17 => l_rec_changes(i).retro
11543 ,p_action_information18 => nvl(l_numiv_override,l_emp_seq)); -- 8328995
11544 END IF;
11545 ELSE
11546 --10100628
11547 pay_action_information_api.create_action_information (
11548 p_action_information_id => l_master_action_info_id
11549 ,p_action_context_id => p_assactid
11550 ,p_action_context_type => 'AAP'
11551 ,p_object_version_number => l_ovn
11552 ,p_assignment_id => l_emp_rec.assignment_id
11553 ,p_effective_date => p_effective_date
11554 ,p_source_id => NULL
11555 ,p_source_text => NULL
11556 ,p_tax_unit_id => l_tax_unit_id
11557 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
11558 ,p_action_information1 => l_type
11559 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(l_period_start_date,trunc(l_period_end_date,'Y')))
11560 ,p_action_information3 => fnd_date.date_to_canonical(l_period_end_date)
11561 ,p_action_information4 => l_emp_rec.assignment_number
11562 ,p_action_information5 => l_emp_rec.employee_number
11563 ,p_action_information6 => substr(l_emp_rec.change_reason,3)
11564 ,p_action_information8 => l_emp_rec.sofi_number
11565 ,p_action_information7 => l_emp_rec.person_id
11566 ,p_action_information9 => l_emp_rec.Initials
11567 ,p_action_information10 => l_emp_rec.prefix
11568 ,p_action_information11 => l_emp_rec.last_name
11569 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
11570 ,p_action_information13 => l_nationality
11571 ,p_action_information14 => l_emp_rec.gender
11572 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
11573 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
11574 ,p_action_information17 => l_rec_changes(i).retro
11575 ,p_action_information18 => nvl(l_numiv_override,l_emp_seq)); -- 8328995
11576
11577 END IF; --10100628
11578
11579
11580 /* 9764359 */
11581 --
11582 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: chk_events 3 ');
11583 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before l_num_over_clash: '|| to_char(l_num_over_clash));
11584 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before l_emp_rec.assignment_id: '|| l_emp_rec.assignment_id);
11585 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before Sequencs: '|| nvl(l_numiv_override,l_emp_seq));
11586 l_num_over_clash:=HR_NL_ASG_EXTRA_INFO_CHECKS.ASG_CHECK_NUMIV_OVERRIDE(l_emp_rec.assignment_id,nvl(l_numiv_override,l_emp_seq));
11587 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: After l_num_over_clash: '|| to_char(l_num_over_clash));
11588 --
11589 IF l_num_over_clash=1 THEN
11590 pay_action_information_api.create_action_information
11591 (
11592 p_action_information_id => l_action_info_id
11593 , p_action_context_id => p_assactid
11594 , p_action_context_type => 'AAP'
11595 , p_object_version_number => l_ovn
11596 , p_assignment_id => NULL
11597 , p_effective_date => p_effective_date
11598 , p_source_id => NULL
11599 , p_source_text => NULL
11600 , p_tax_unit_id => l_tax_unit_id
11601 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11602 , p_action_information4 => fnd_message.get_string('PER','HR_373547_NUMIV_OVERRIDE')
11603 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
11604 , p_action_information6 => 'Num IV override Already Used'
11605 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11606 , p_action_information8 => l_emp_rec.assignment_number);
11607 END IF;
11608 --
11609 --Check0044 Check1044
11610 IF l_emp_rec.sofi_number is null AND l_emp_rec.employee_number is null THEN
11611 --
11612 pay_action_information_api.create_action_information
11613 (
11614 p_action_information_id => l_action_info_id
11615 , p_action_context_id => p_assactid
11616 , p_action_context_type => 'AAP'
11617 , p_object_version_number => l_ovn
11618 , p_assignment_id => l_emp_rec.assignment_id
11619 , p_effective_date => p_effective_date
11620 , p_source_id => NULL
11621 , p_source_text => NULL
11622 , p_tax_unit_id => l_tax_unit_id
11623 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11624 , p_action_information4 => '0044/1044 - '||fnd_message.get_string('PER','HR_373537_NL_EMPNO_MANDATORY')
11625 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
11626 , p_action_information6 => '0044/1044 - '||'When the "BSN/Sofi-number" (Tag SofiNr) is not reported the record "Employee number" (Tag PersNr) is mandatory.'
11627 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11628 , p_action_information8 => l_emp_rec.assignment_number);
11629 --
11630 END IF;
11631
11632
11633 --abraghun--7668628--Check0046 Check0047 Check0048 Check0049
11634 IF l_emp_rec.sofi_number is not null AND l_wage_tax_table <> 940 THEN
11635 fnd_message.set_name('PER','HR_373535_NL_NON940_MANDATORY');
11636
11637 --abraghun--7668628--Check0046
11638 IF l_emp_rec.last_name is null THEN
11639 --
11640 fnd_message.set_token('TAGVAL1',l_wage_tax_table);
11641 fnd_message.set_token('TAG2','SignNm');
11642
11643 pay_action_information_api.create_action_information
11644 (
11645 p_action_information_id => l_action_info_id
11646 , p_action_context_id => p_assactid
11647 , p_action_context_type => 'AAP'
11648 , p_object_version_number => l_ovn
11649 , p_assignment_id => l_emp_rec.assignment_id
11650 , p_effective_date => p_effective_date
11651 , p_source_id => NULL
11652 , p_source_text => NULL
11653 , p_tax_unit_id => l_tax_unit_id
11654 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11655 , p_action_information4 => '0046 - '||fnd_message.get
11656 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
11657 , p_action_information6 => '0046 - '||'When "BSN/Sofi-number" (Tag SofiNr) is reported and "Code wage tax table" (Tag LbTab) is not equal to 940 the "Last Name" (Tag SignNm) cannot be empty / is mandatory.'
11658 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11659 , p_action_information8 => l_emp_rec.assignment_number);
11660 --
11661 END IF;
11662
11663 --abraghun--7668628--Check0047
11664 IF l_emp_rec.dob is null THEN
11665 --
11666 fnd_message.set_token('TAGVAL1',l_wage_tax_table);
11667 fnd_message.set_token('TAG2','Gebdat');
11668
11669 pay_action_information_api.create_action_information
11670 (
11671 p_action_information_id => l_action_info_id
11672 , p_action_context_id => p_assactid
11673 , p_action_context_type => 'AAP'
11674 , p_object_version_number => l_ovn
11675 , p_assignment_id => l_emp_rec.assignment_id
11676 , p_effective_date => p_effective_date
11677 , p_source_id => NULL
11678 , p_source_text => NULL
11679 , p_tax_unit_id => l_tax_unit_id
11680 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11681 , p_action_information4 => '0047 - '||fnd_message.get
11682 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
11683 , p_action_information6 => '0047 - '||'When "BSN/Sofi-number" (Tag SofiNr) is reported and "Code wage tax table" (Tag LbTab) is not equal to 940 the "Date of birth" (Tag Gebdat) cannot be empty / is mandatory.'
11684 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11685 , p_action_information8 => l_emp_rec.assignment_number);
11686 --
11687 END IF;
11688
11689 --abraghun--7668628--Check0048
11690 IF l_nationality is null THEN
11691 --
11692 fnd_message.set_token('TAGVAL1',l_wage_tax_table);
11693 fnd_message.set_token('TAG2','Nat');
11694
11695 pay_action_information_api.create_action_information
11696 (
11697 p_action_information_id => l_action_info_id
11698 , p_action_context_id => p_assactid
11699 , p_action_context_type => 'AAP'
11700 , p_object_version_number => l_ovn
11701 , p_assignment_id => l_emp_rec.assignment_id
11702 , p_effective_date => p_effective_date
11703 , p_source_id => NULL
11704 , p_source_text => NULL
11705 , p_tax_unit_id => l_tax_unit_id
11706 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11707 , p_action_information4 => '0048 - '||fnd_message.get
11708 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
11709 , p_action_information6 => '0048 - '||'When "BSN/Sofi-number" (Tag SofiNr) is reported and "Code wage tax table" (Tag LbTab) is not equal to 940 the "Nationality" (Tag Nat) cannot be empty / is mandatory.'
11710 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11711 , p_action_information8 => l_emp_rec.assignment_number);
11712 --
11713 END IF;
11714
11715 --abraghun--7668628--Check0049
11716 IF l_emp_rec.gender is null THEN
11717 --
11718 fnd_message.set_token('TAGVAL1',l_wage_tax_table);
11719 fnd_message.set_token('TAG2','Gesl');
11720
11721 pay_action_information_api.create_action_information
11722 (
11723 p_action_information_id => l_action_info_id
11724 , p_action_context_id => p_assactid
11725 , p_action_context_type => 'AAP'
11726 , p_object_version_number => l_ovn
11727 , p_assignment_id => l_emp_rec.assignment_id
11728 , p_effective_date => p_effective_date
11729 , p_source_id => NULL
11730 , p_source_text => NULL
11731 , p_tax_unit_id => l_tax_unit_id
11732 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11733 , p_action_information4 => '0049 - '||fnd_message.get
11734 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
11735 , p_action_information6 => '0049 - '||'When "BSN/Sofi-number" (Tag SofiNr) is reported and "Code wage tax table" (Tag LbTab) is not equal to 940 the "Gender" (Tag Gesl) cannot be empty / is mandatory.'
11736 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11737 , p_action_information8 => l_emp_rec.assignment_number);
11738 --
11739 END IF;
11740 END IF;
11741 --
11742 --abraghun--7668628--Check0039
11743 IF l_ass_start_date > l_period_end_date THEN
11744 fnd_message.set_name('PER','HR_373543_NL_DATE_LTEQ');
11745 fnd_message.set_token('TAG1','DatAanv');
11746 fnd_message.set_token('TAGVAL1',fnd_date.date_to_canonical(l_ass_start_date));
11747 fnd_message.set_token('TAG2','DatEindTv');
11748 fnd_message.set_token('TAGVAL2',fnd_date.date_to_canonical(l_period_end_date));
11749 --
11750 pay_action_information_api.create_action_information
11751 (
11752 p_action_information_id => l_action_info_id
11753 , p_action_context_id => p_assactid
11754 , p_action_context_type => 'AAP'
11755 , p_object_version_number => l_ovn
11756 , p_assignment_id => l_emp_rec.assignment_id
11757 , p_effective_date => p_effective_date
11758 , p_source_id => NULL
11759 , p_source_text => NULL
11760 , p_tax_unit_id => l_tax_unit_id
11761 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11762 , p_action_information4 => '0039 - '||fnd_message.get
11763 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
11764 , p_action_information6 => '0039 - '||'The "Start date income relation" (Tag DatAanv) has to be lower than or equal to the "End date period" (Tag DatEindTv) within one report or one correction report.'
11765 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11766 , p_action_information8 => l_emp_rec.assignment_number);
11767 --
11768 END IF;
11769 --
11770 --
11771 --abraghun--7668628--Check0040
11772
11773 --abraghun--8552196--Mistake in Validation Corrected
11774 --Old: (DatEind>=DatAanvTv)
11775 --New: (DatEind<=DatEindTv)
11776
11777
11778 IF l_emp_end_date is not null
11779 --and l_emp_end_date < GREATEST(l_period_start_date,trunc(l_period_end_date,'Y')) THEN
11780 and l_emp_end_date > l_period_end_date THEN
11781
11782 --fnd_message.set_name('PER','HR_373544_NL_DATE_GTEQ');
11783 fnd_message.set_name('PER','HR_373543_NL_DATE_LTEQ');
11784 fnd_message.set_token('TAG1','DatEind');
11785 fnd_message.set_token('TAGVAL1',fnd_date.date_to_canonical(l_emp_end_date));
11786 --fnd_message.set_token('TAG2','DatAanvTv');
11787 --fnd_message.set_token('TAGVAL2',fnd_date.date_to_canonical(GREATEST(l_period_start_date,trunc(l_period_end_date,'Y'))));
11788 fnd_message.set_token('TAG2','DatEindTv');
11789 fnd_message.set_token('TAGVAL2',fnd_date.date_to_canonical(l_period_end_date));
11790
11791
11792 pay_action_information_api.create_action_information
11793 (
11794 p_action_information_id => l_action_info_id
11795 , p_action_context_id => p_assactid
11796 , p_action_context_type => 'AAP'
11797 , p_object_version_number => l_ovn
11798 , p_assignment_id => l_emp_rec.assignment_id
11799 , p_effective_date => p_effective_date
11800 , p_source_id => NULL
11801 , p_source_text => NULL
11802 , p_tax_unit_id => l_tax_unit_id
11803 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11804 , p_action_information4 => '0040 - '||fnd_message.get
11805 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
11806 --, p_action_information6 => '0040 - '||'The "End date income relation" (Tag DatEind) has to be higher than or equal to the "Start date period" (Tag DatAanvTv) within one report or one correction report.'
11807 , p_action_information6 => '0040 - '||'The "End date income relation" (Tag DatEind) has to be lower than or equal to the "End date period" (Tag DatEindTv) within one report or one correction report.'
11808 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11809 , p_action_information8 => l_emp_rec.assignment_number);
11810 --
11811 END IF;
11812 --
11813 --abraghun--7668628--Check0041
11814 IF l_emp_end_date is not null and l_emp_end_date < l_ass_start_date THEN
11815 --
11816 fnd_message.set_name('PER','HR_373544_NL_DATE_GTEQ');
11817 fnd_message.set_token('TAG1','DatEind');
11818 fnd_message.set_token('TAGVAL1',fnd_date.date_to_canonical(l_emp_end_date));
11819 fnd_message.set_token('TAG2','DatAanv');
11820 fnd_message.set_token('TAGVAL2',fnd_date.date_to_canonical(l_ass_start_date));
11821
11822 pay_action_information_api.create_action_information
11823 (
11824 p_action_information_id => l_action_info_id
11825 , p_action_context_id => p_assactid
11826 , p_action_context_type => 'AAP'
11827 , p_object_version_number => l_ovn
11828 , p_assignment_id => l_emp_rec.assignment_id
11829 , p_effective_date => p_effective_date
11830 , p_source_id => NULL
11831 , p_source_text => NULL
11832 , p_tax_unit_id => l_tax_unit_id
11833 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11834 , p_action_information4 => '0041 - '||fnd_message.get
11835 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
11836 , p_action_information6 => '0041 - '||'The "End date income relation" (Tag DatEind) has to be higher than or equal to the "Start date income relation" (Tag DatAanv).'
11837 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11838 , p_action_information8 => l_emp_rec.assignment_number);
11839 --
11840 END IF;
11841 --
11842 --abraghun--7668628--Check0042
11843 IF l_emp_rec.change_reason is not null AND l_labour_rel_code <> 11 THEN
11844 --
11845 pay_action_information_api.create_action_information
11846 (
11847 p_action_information_id => l_action_info_id
11848 , p_action_context_id => p_assactid
11849 , p_action_context_type => 'AAP'
11850 , p_object_version_number => l_ovn
11851 , p_assignment_id => l_emp_rec.assignment_id
11852 , p_effective_date => p_effective_date
11853 , p_source_id => NULL
11854 , p_source_text => NULL
11855 , p_tax_unit_id => l_tax_unit_id
11856 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11857 , p_action_information4 => '0042 - '||fnd_message.get_string('PER','HR_373545_NL_RDNEINDFLX_CHECK1')
11858 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
11859 , p_action_information6 => '0042 - '||'The "Code reason end of Income relation Flex worker" is only allowed when the "Code kind of labour relation" (Tag CdAard) is equal to 11.'
11860 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11861 , p_action_information8 => l_emp_rec.assignment_number);
11862 --
11863 END IF;
11864 --
11865 --abraghun--7668628--Check0043
11866 IF l_emp_rec.change_reason is not null AND l_emp_end_date is null THEN
11867 --
11868 pay_action_information_api.create_action_information
11869 (
11870 p_action_information_id => l_action_info_id
11871 , p_action_context_id => p_assactid
11872 , p_action_context_type => 'AAP'
11873 , p_object_version_number => l_ovn
11874 , p_assignment_id => l_emp_rec.assignment_id
11875 , p_effective_date => p_effective_date
11876 , p_source_id => NULL
11877 , p_source_text => NULL
11878 , p_tax_unit_id => l_tax_unit_id
11879 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11880 , p_action_information4 => '0043 - '||fnd_message.get_string('PER','HR_373546_NL_RDNEINDFLX_CHECK2')
11881 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
11882 , p_action_information6 => '0043 - '||'The "Code reason end of Income relation Flex worker" is only allowed when the "End date income relation" (Tag DatEind) is reported.'
11883 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11884 , p_action_information8 => l_emp_rec.assignment_number);
11885 --
11886 END IF;
11887 --
11888 --abraghun--7668628--validation ends
11889
11890 END IF;
11891 l_archive_emp_info := 'Y';
11892 --
11893 --IF l_type = 'INITIAL' OR l_type = 'CORRECTION' THEN
11894 -- archive employee address
11895 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Employee Address Record for Type :'||l_type);
11896 IF l_type = 'INITIAL' OR l_type = 'CORRECTION' THEN
11897 archive_emp_address(p_assactid
11898 ,l_emp_rec.person_id
11899 ,l_emp_rec.assignment_id
11900 ,l_emp_rec.assignment_number
11901 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11902 ,l_tax_unit_id
11903 ,l_master_action_info_id
11904 ,p_effective_date
11905 ,NVL(l_emp_end_date,l_period_end_date)
11906 ,l_type
11907 ,p_prev_corr_year); --10100628
11908 ELSE
11909 archive_emp_address(p_assactid
11910 ,l_emp_rec.person_id
11911 ,l_emp_rec.assignment_id
11912 ,l_emp_rec.assignment_number
11913 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11914 ,l_tax_unit_id
11915 ,l_master_action_info_id
11916 ,p_effective_date
11917 ,l_rec_changes(i).effective_date
11918 ,l_type
11919 ,p_prev_corr_year); --10100628
11920 END IF;
11921 -- archive sector information for assignment
11922 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Sector Risk Group Record for Type :'||l_type);
11923 l_srg_flag := archive_sector_risk_group(p_assactid
11924 ,l_emp_rec.assignment_id
11925 ,p_effective_date
11926 ,l_tax_unit_id
11927 ,l_master_action_info_id
11928 ,l_period_start_date
11929 ,l_period_end_date
11930 ,l_ass_start_date
11931 ,l_emp_end_date
11932 ,p_payroll_type);
11933 --#
11934 IF l_srg_flag = 'N' AND (l_wao_insured = 'Y' OR l_ww_insured = 'Y' OR l_zw_insured = 'Y') THEN
11935 --
11936 pay_action_information_api.create_action_information
11937 (
11938 p_action_information_id => l_action_info_id
11939 , p_action_context_id => p_assactid
11940 , p_action_context_type => 'AAP'
11941 , p_object_version_number => l_ovn
11942 , p_assignment_id => l_emp_rec.assignment_id
11943 , p_effective_date => p_effective_date
11944 , p_source_id => NULL
11945 , p_source_text => NULL
11946 , p_tax_unit_id => l_tax_unit_id
11947 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
11948 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_ASG_RISK_GRP')
11949 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
11950 , p_action_information6 => 'Assignment has no Sector or Risk Group'
11951 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11952 , p_action_information8 => l_emp_rec.assignment_number);
11953 --
11954 END IF;
11955 --#
11956 --
11957 --archive nominative info
11958 l_assignment_action_id := NULL;
11959 OPEN csr_get_assignment_action_id2(l_assignment_id,l_period_start_date);
11960 FETCH csr_get_assignment_action_id2 INTO l_assignment_action_id;
11961 CLOSE csr_get_assignment_action_id2;
11962 --
11963 IF l_rec_changes(i).retro = 'PAY' OR l_type = 'INITIAL' OR l_type = 'CORRECTION' THEN
11964 l_corr_used := 'N';
11965 populate_nom_balance_values(l_master_assignment_action_id
11966 ,l_assignment_action_id
11967 ,l_period_end_date
11968 ,l_tax_unit_id
11969 ,l_type
11970 ,l_rec_changes(i).retro
11971 ,l_corr_used
11972 ,l_bal_value);
11973 --
11974 get_nominative_data(l_bal_value,l_nom_bal_value);
11975 --
11976 --Fnd_file.put_line(FND_FILE.LOG,' Creating NL_WR_NOMINATIVE_REPORT Record for Type :'||l_type);
11977 archive_nominative_data(p_assactid
11978 ,l_emp_rec.assignment_id
11979 ,l_tax_unit_id
11980 ,p_effective_date
11981 ,l_rec_changes(i).effective_date
11982 ,l_type
11983 ,l_master_action_info_id
11984 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
11985 ,l_corr_used
11986 ,p_payroll_type
11987 ,l_nom_bal_value
11988 ,p_prev_corr_year); --10100628
11989 END IF;
11990 --
11991 l_chk_emp_reported := 'Y';
11992 --END IF;
11993 END IF;
11994 l_chg_pending := 'N';
11995 --
11996 --IF l_rec_changes(i).column_name <> 'CHANGE_REASON' OR
11997 -- l_rec_changes(i).column_name IS NOT NULL THEN
11998 --LC 2012 begin
11999 IF p_effective_date < TO_DATE('01012012','DDMMYYYY') THEN
12000 --LC 2010--begins
12001 IF l_zvw_small_jobs = 'D' THEN
12002 pay_action_information_api.create_action_information
12003 (
12004 p_action_information_id => l_action_info_id
12005 , p_action_context_id => p_assactid
12006 , p_action_context_type => 'AAP'
12007 , p_object_version_number => l_ovn
12008 , p_assignment_id => l_emp_rec.assignment_id
12009 , p_effective_date => p_effective_date
12010 , p_source_id => NULL
12011 , p_source_text => NULL
12012 , p_tax_unit_id => l_tax_unit_id
12013 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12014 , p_action_information4 => fnd_message.get_string('PER','HR_373549_NL_ZVW_J_DEFAULT')
12015 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
12016 , p_action_information6 => 'Contribution Exempt Small Job is applicable. Therefore, the ZVW code is set to J.'
12017 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12018 , p_action_information8 => l_emp_rec.assignment_number);
12019 END IF;
12020 IF l_zvw_small_jobs = 'W' THEN
12021 pay_action_information_api.create_action_information
12022 (
12023 p_action_information_id => l_action_info_id
12024 , p_action_context_id => p_assactid
12025 , p_action_context_type => 'AAP'
12026 , p_object_version_number => l_ovn
12027 , p_assignment_id => l_emp_rec.assignment_id
12028 , p_effective_date => p_effective_date
12029 , p_source_id => NULL
12030 , p_source_text => NULL
12031 , p_tax_unit_id => l_tax_unit_id
12032 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12033 , p_action_information4 => fnd_message.get_string('PER','HR_373550_NL_ZVW_J_WARNING')
12034 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
12035 , p_action_information6 => 'The ZVW code is set to J when Contribution Exempt Small Job is not applicable.'
12036 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12037 , p_action_information8 => l_emp_rec.assignment_number);
12038 END IF;
12039 --LC 2010--ends
12040 END IF;
12041 --LC 2012 end
12042
12043 --#
12044 IF l_zvw_defaulted = 'Y' THEN
12045 pay_action_information_api.create_action_information
12046 (
12047 p_action_information_id => l_action_info_id
12048 , p_action_context_id => p_assactid
12049 , p_action_context_type => 'AAP'
12050 , p_object_version_number => l_ovn
12051 , p_assignment_id => l_emp_rec.assignment_id
12052 , p_effective_date => p_effective_date
12053 , p_source_id => NULL
12054 , p_source_text => NULL
12055 , p_tax_unit_id => l_tax_unit_id
12056 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12057 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_ZVW_CODE_INSURED')
12058 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
12059 , p_action_information6 => 'Code ZVW is defaulted to - A'
12060 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12061 , p_action_information8 => l_emp_rec.assignment_number);
12062 END IF;
12063 --
12064 --abraghun--7668628--Check0053 -- already exists.
12065 --
12066 IF l_income_code IN (11,12,13,14,15,18) AND l_labour_rel_code IS NULL THEN
12067 pay_action_information_api.create_action_information
12068 (
12069 p_action_information_id => l_action_info_id
12070 , p_action_context_id => p_assactid
12071 , p_action_context_type => 'AAP'
12072 , p_object_version_number => l_ovn
12073 , p_assignment_id => l_emp_rec.assignment_id
12074 , p_effective_date => p_effective_date
12075 , p_source_id => NULL
12076 , p_source_text => NULL
12077 , p_tax_unit_id => l_tax_unit_id
12078 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12079 , p_action_information4 => '0053 - '||fnd_message.get_string('PER','HR_NL_INVALID_LABOR_CODE')
12080 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
12081 , p_action_information6 => '0053 - '||'Labor Relation code is null'
12082 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12083 , p_action_information8 => l_emp_rec.assignment_number);
12084 END IF;
12085 --
12086 --abraghun--7668628--Check0055 - already exists.
12087 --
12088 IF l_income_code IN (11,12,13,14,15,18) AND l_assignment_catg IS NULL THEN
12089 pay_action_information_api.create_action_information
12090 (
12091 p_action_information_id => l_action_info_id
12092 , p_action_context_id => p_assactid
12093 , p_action_context_type => 'AAP'
12094 , p_object_version_number => l_ovn
12095 , p_assignment_id => l_emp_rec.assignment_id
12096 , p_effective_date => p_effective_date
12097 , p_source_id => NULL
12098 , p_source_text => NULL
12099 , p_tax_unit_id => l_tax_unit_id
12100 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12101 , p_action_information4 => '0055 - '||fnd_message.get_string('PER','HR_NL_INVALID_CONTRACT_CODE')
12102 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
12103 , p_action_information6 => '0055 - '||'Code contract for limited or unlimited time is null'
12104 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12105 , p_action_information8 => l_emp_rec.assignment_number);
12106 END IF;
12107 --
12108 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
12109 pay_action_information_api.create_action_information
12110 (
12111 p_action_information_id => l_action_info_id
12112 , p_action_context_id => p_assactid
12113 , p_action_context_type => 'AAP'
12114 , p_object_version_number => l_ovn
12115 , p_assignment_id => l_emp_rec.assignment_id
12116 , p_effective_date => p_effective_date
12117 , p_source_id => NULL
12118 , p_source_text => NULL
12119 , p_tax_unit_id => l_tax_unit_id
12120 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12121 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_WORK_PATTERN')
12122 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
12123 , p_action_information6 => 'Indication regular work pattern is null'
12124 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12125 , p_action_information8 => l_emp_rec.assignment_number);
12126 END IF;
12127 --
12128 IF l_srg_flag = 'Z' AND l_FZ_Code IS NULL THEN
12129 pay_action_information_api.create_action_information
12130 (
12131 p_action_information_id => l_action_info_id
12132 , p_action_context_id => p_assactid
12133 , p_action_context_type => 'AAP'
12134 , p_object_version_number => l_ovn
12135 , p_assignment_id => l_emp_rec.assignment_id
12136 , p_effective_date => p_effective_date
12137 , p_source_id => NULL
12138 , p_source_text => NULL
12139 , p_tax_unit_id => l_tax_unit_id
12140 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12141 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_TEMP_LABOR_CODE')
12142 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
12143 , p_action_information6 => 'Temp Labor Code is null'
12144 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12145 , p_action_information8 => l_emp_rec.assignment_number);
12146 END IF;
12147 --
12148 IF l_company_car_use = 4 AND g_effective_date > to_date('01012007','ddmmyyyy') THEN
12149 pay_action_information_api.create_action_information
12150 (
12151 p_action_information_id => l_action_info_id
12152 , p_action_context_id => p_assactid
12153 , p_action_context_type => 'AAP'
12154 , p_object_version_number => l_ovn
12155 , p_assignment_id => l_emp_rec.assignment_id
12156 , p_effective_date => p_effective_date
12157 , p_source_id => NULL
12158 , p_source_text => NULL
12159 , p_tax_unit_id => l_tax_unit_id
12160 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12161 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_COMPANY_CAR_USE')
12162 , p_action_information5 => fnd_date.date_to_canonical(l_rec_changes(i).effective_date)
12163 , p_action_information6 => 'Company Car Usage code invalid'
12164 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12165 , p_action_information8 => l_emp_rec.assignment_number);
12166 END IF;
12167 --#
12168 --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));
12169
12170 --10100628
12171 IF p_prev_corr_year <> '-9999' THEN
12172 l_arc_y_n := IS_ARCHIVED(p_assactid, 'NL_WR_INCOME_PERIOD', 'INITIAL');
12173 IF l_type = 'INITIAL' THEN
12174 IF l_arc_y_n = 'N' THEN
12175 pay_action_information_api.create_action_information (
12176 p_action_information_id => l_action_info_id
12177 , p_action_context_id => p_assactid
12178 , p_action_context_type => 'AAP'
12179 , p_object_version_number => l_ovn
12180 , p_assignment_id => l_emp_rec.assignment_id
12181 , p_effective_date => p_effective_date
12182 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
12183 , p_tax_unit_id => l_tax_unit_id
12184 , p_action_information1 => l_type
12185 , p_action_information2 => l_master_action_info_id
12186 , 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')))
12187 , p_action_information6 => l_income_code
12188 , p_action_information7 => l_labour_rel_code
12189 , p_action_information8 => l_ins_duty_code
12190 , p_action_information9 => l_assignment_catg
12191 , p_action_information10 => l_FZ_Code
12192 , p_action_information11 => l_work_pattern
12193 , p_action_information12 => l_cao_code
12194 , p_action_information13 => l_handicapped_code
12195 , p_action_information14 => l_wage_tax_discount
12196 , p_action_information15 => l_company_car_use
12197 , p_action_information16 => l_wage_tax_table
12198 , p_action_information17 => l_wao_insured
12199 , p_action_information18 => l_ww_insured
12200 , p_action_information19 => l_zw_insured
12201 , p_action_information20 => NVL(l_zvw_situation,'A')
12202 , p_action_information21 => l_holiday_coupen
12203 , p_action_information22 => l_wage_aow
12204 , p_action_information23 => l_wage_wajong
12205 , p_action_information24 => l_emp_loan
12206 , p_action_information25 => l_transportation
12207 , p_action_information26 => l_income_increase
12208 , p_action_information27 => l_add_allowance
12209 , p_action_information28 => l_marginal_empl/*LC 2010*/
12210 , p_action_information29 => l_wm_old_rule/*LC 2010*/
12211 , p_action_information30 => l_temp_tax_discount);/* LC 2013*/
12212 END IF;
12213 ELSE
12214 pay_action_information_api.create_action_information (
12215 p_action_information_id => l_action_info_id
12216 , p_action_context_id => p_assactid
12217 , p_action_context_type => 'AAP'
12218 , p_object_version_number => l_ovn
12219 , p_assignment_id => l_emp_rec.assignment_id
12220 , p_effective_date => p_effective_date
12221 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
12222 , p_tax_unit_id => l_tax_unit_id
12223 , p_action_information1 => 'CORRECT' --l_type 10100628
12224 , p_action_information2 => l_master_action_info_id
12225 , 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')))
12226 , p_action_information6 => l_income_code
12227 , p_action_information7 => l_labour_rel_code
12228 , p_action_information8 => l_ins_duty_code
12229 , p_action_information9 => l_assignment_catg
12230 , p_action_information10 => l_FZ_Code
12231 , p_action_information11 => l_work_pattern
12232 , p_action_information12 => l_cao_code
12233 , p_action_information13 => l_handicapped_code
12234 , p_action_information14 => l_wage_tax_discount
12235 , p_action_information15 => l_company_car_use
12236 , p_action_information16 => l_wage_tax_table
12237 , p_action_information17 => l_wao_insured
12238 , p_action_information18 => l_ww_insured
12239 , p_action_information19 => l_zw_insured
12240 , p_action_information20 => NVL(l_zvw_situation,'A')
12241 , p_action_information21 => l_holiday_coupen
12242 , p_action_information22 => l_wage_aow
12243 , p_action_information23 => l_wage_wajong
12244 , p_action_information24 => l_emp_loan
12245 , p_action_information25 => l_transportation
12246 , p_action_information26 => l_income_increase
12247 , p_action_information27 => l_add_allowance
12248 , p_action_information28 => l_marginal_empl/*LC 2010*/
12249 , p_action_information29 => l_wm_old_rule/*LC 2010*/
12250 , p_action_information30 => l_temp_tax_discount);/* LC 2013*/
12251 END IF;
12252 ELSE
12253 --10100628
12254 pay_action_information_api.create_action_information (
12255 p_action_information_id => l_action_info_id
12256 , p_action_context_id => p_assactid
12257 , p_action_context_type => 'AAP'
12258 , p_object_version_number => l_ovn
12259 , p_assignment_id => l_emp_rec.assignment_id
12260 , p_effective_date => p_effective_date
12261 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
12262 , p_tax_unit_id => l_tax_unit_id
12263 , p_action_information1 => l_type
12264 , p_action_information2 => l_master_action_info_id
12265 , 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')))
12266 , p_action_information6 => l_income_code
12267 , p_action_information7 => l_labour_rel_code
12268 , p_action_information8 => l_ins_duty_code
12269 , p_action_information9 => l_assignment_catg
12270 , p_action_information10 => l_FZ_Code
12271 , p_action_information11 => l_work_pattern
12272 , p_action_information12 => l_cao_code
12273 , p_action_information13 => l_handicapped_code
12274 , p_action_information14 => l_wage_tax_discount
12275 , p_action_information15 => l_company_car_use
12276 , p_action_information16 => l_wage_tax_table
12277 , p_action_information17 => l_wao_insured
12278 , p_action_information18 => l_ww_insured
12279 , p_action_information19 => l_zw_insured
12280 , p_action_information20 => NVL(l_zvw_situation,'A')
12281 , p_action_information21 => l_holiday_coupen
12282 , p_action_information22 => l_wage_aow
12283 , p_action_information23 => l_wage_wajong
12284 , p_action_information24 => l_emp_loan
12285 , p_action_information25 => l_transportation
12286 , p_action_information26 => l_income_increase
12287 , p_action_information27 => l_add_allowance
12288 , p_action_information28 => l_marginal_empl/*LC 2010*/
12289 , p_action_information29 => l_wm_old_rule/*LC 2010*/
12290 , p_action_information30 => l_temp_tax_discount);/* LC 2013*/
12291 END IF; --10100628
12292
12293 --abraghun--7668628--Validation Code
12294 --abraghun--7668628--Check0054
12295 IF l_income_code=18 AND l_labour_rel_code <> 18 THEN
12296 pay_action_information_api.create_action_information
12297 (
12298 p_action_information_id => l_action_info_id
12299 , p_action_context_id => p_assactid
12300 , p_action_context_type => 'AAP'
12301 , p_object_version_number => l_ovn
12302 , p_assignment_id => l_emp_rec.assignment_id
12303 , p_effective_date => p_effective_date
12304 , p_source_id => NULL
12305 , p_source_text => NULL
12306 , p_tax_unit_id => l_tax_unit_id
12307 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12308 , p_action_information4 => '0054 - '||fnd_message.get_string('PER','HR_373539_NL_CDAARD_CHECK')
12309 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12310 , p_action_information6 => '0054 - '||'The "Code kind of labour relation" (Tag CdAard) has to be 18 when "Income Code" (Tag SrtIV) is equal to 18.'
12311 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12312 , p_action_information8 => l_emp_rec.assignment_number);
12313 END IF;
12314 --
12315 --abraghun--7668628--Check0056
12316 --
12317 IF l_income_code IN (11,12,13,14,15,17,18) AND l_cao_code IS NULL THEN
12318
12319 --HR_373531_NL_SRTIV_MANDATORY When SrtIV is equal to SRTIV, TAG is mandatory.
12320 fnd_message.set_name('PER','HR_373531_NL_SRTIV_MANDATORY');
12321 fnd_message.set_token('SRTIV',l_income_code);
12322 fnd_message.set_token('TAG','CAO');
12323
12324
12325 pay_action_information_api.create_action_information
12326 (
12327 p_action_information_id => l_action_info_id
12328 , p_action_context_id => p_assactid
12329 , p_action_context_type => 'AAP'
12330 , p_object_version_number => l_ovn
12331 , p_assignment_id => l_emp_rec.assignment_id
12332 , p_effective_date => p_effective_date
12333 , p_source_id => NULL
12334 , p_source_text => NULL
12335 , p_tax_unit_id => l_tax_unit_id
12336 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12337 , p_action_information4 => '0056 - '||fnd_message.get
12338 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12339 , p_action_information6 => '0056 - '||'When the "Income Code" (Tag SrtIV) is equal to 11, 12, 13, 14, 15, 17 or 18, the "Code CAO" (Tag CAO) is mandatory.'
12340 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12341 , p_action_information8 => l_emp_rec.assignment_number);
12342 END IF;
12343
12344 --abraghun--8552196--Check0057 Check0058 Check0059 Removed--
12345 /* Commenting out Starts
12346 --abraghun--7668628--Check0057 Check0058 Check0059--
12347 --
12348 IF (months_between(l_period_end_date,l_emp_rec.dob)/12)>=65 THEN
12349 --abraghun--7668628--Check0057
12350 IF l_wao_insured = 'J' THEN
12351 fnd_message.set_name('PER','HR_373532_NL_AGE65_CHECKS');
12352 fnd_message.set_token('AGE',ROUND(months_between(l_period_end_date,l_emp_rec.dob)/12));
12353 fnd_message.set_token('TAG','IndWAO');
12354 pay_action_information_api.create_action_information
12355 (
12356 p_action_information_id => l_action_info_id
12357 , p_action_context_id => p_assactid
12358 , p_action_context_type => 'AAP'
12359 , p_object_version_number => l_ovn
12360 , p_assignment_id => l_emp_rec.assignment_id
12361 , p_effective_date => p_effective_date
12362 , p_source_id => NULL
12363 , p_source_text => NULL
12364 , p_tax_unit_id => l_tax_unit_id
12365 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12366 , p_action_information4 => '0057 - '||fnd_message.get
12367 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12368 , p_action_information6 => '0057 - '||'When the employee reaches the age of 65 in the current period (the age is 65 on the last day of the period), the "Indication WAO/IVA/WGA insured" (Tag IndWAO) cannot be equal to "J".'
12369 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12370 , p_action_information8 => l_emp_rec.assignment_number);
12371 END IF;
12372 --abraghun--7668628--Check0058
12373 IF l_ww_insured = 'J' THEN
12374 fnd_message.set_name('PER','HR_373532_NL_AGE65_CHECKS');
12375 fnd_message.set_token('AGE',ROUND(months_between(l_period_end_date,l_emp_rec.dob)/12));
12376 fnd_message.set_token('TAG','IndWW');
12377 pay_action_information_api.create_action_information
12378 (
12379 p_action_information_id => l_action_info_id
12380 , p_action_context_id => p_assactid
12381 , p_action_context_type => 'AAP'
12382 , p_object_version_number => l_ovn
12383 , p_assignment_id => l_emp_rec.assignment_id
12384 , p_effective_date => p_effective_date
12385 , p_source_id => NULL
12386 , p_source_text => NULL
12387 , p_tax_unit_id => l_tax_unit_id
12388 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12389 , p_action_information4 => '0058 - '||fnd_message.get
12390 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12391 , p_action_information6 => '0058 - '||'When the employee reaches the age of 65 in the current period (the age is 65 on the last day of the period), the "Indication WW insured" (Tag IndWW) cannot be equal to "J".'
12392 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12393 , p_action_information8 => l_emp_rec.assignment_number);
12394 END IF;
12395 --abraghun--7668628--Check0059
12396 IF l_zw_insured = 'J' THEN
12397 fnd_message.set_name('PER','HR_373532_NL_AGE65_CHECKS');
12398 fnd_message.set_token('AGE',ROUND(months_between(l_period_end_date,l_emp_rec.dob)/12));
12399 fnd_message.set_token('TAG','IndZW');
12400 pay_action_information_api.create_action_information
12401 (
12402 p_action_information_id => l_action_info_id
12403 , p_action_context_id => p_assactid
12404 , p_action_context_type => 'AAP'
12405 , p_object_version_number => l_ovn
12406 , p_assignment_id => l_emp_rec.assignment_id
12407 , p_effective_date => p_effective_date
12408 , p_source_id => NULL
12409 , p_source_text => NULL
12410 , p_tax_unit_id => l_tax_unit_id
12411 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12412 , p_action_information4 => '0059 - '||fnd_message.get
12413 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12414 , p_action_information6 => '0059 - '||'When the employee reaches the age of 65 in the current period (the age is 65 on the last day of the period), the "Indication ZW insured" (Tag IndZW) cannot be equal to "J".'
12415 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12416 , p_action_information8 => l_emp_rec.assignment_number);
12417
12418 END IF;
12419 END IF;
12420
12421 Commenting out Ends-- */
12422 --abraghun--8552196--Check0057 Check0058 Check0059 Removed--
12423
12424 /*
12425 --abraghun--7668628--Check0060
12426 IF l_wage_tax_table in (221,224,225) AND NVL(l_zvw_situation,'A')<>'G' THEN
12427
12428 fnd_message.set_name('PER','HR_373538_NL_CDZVW_CHECKS');
12429 fnd_message.set_token('TAGVAL1','G');
12430 fnd_message.set_token('TAGVAL2',l_wage_tax_table);
12431
12432 pay_action_information_api.create_action_information
12433 (
12434 p_action_information_id => l_action_info_id
12435 , p_action_context_id => p_assactid
12436 , p_action_context_type => 'AAP'
12437 , p_object_version_number => l_ovn
12438 , p_assignment_id => l_emp_rec.assignment_id
12439 , p_effective_date => p_effective_date
12440 , p_source_id => NULL
12441 , p_source_text => NULL
12442 , p_tax_unit_id => l_tax_unit_id
12443 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12444 , p_action_information4 => '0060 - '||fnd_message.get
12445 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12446 , p_action_information6 => '0060 - '||'The "Indication insurance situation Zvw" (Tag CdZvw) can only be equal to "G" when "Code wage tax table" (Tag LbTab) is equal to 221, 224 or 225.'
12447 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12448 , p_action_information8 => l_emp_rec.assignment_number);
12449 --abraghun--7668628--Check0061
12450 ELSIF l_wage_tax_table =220 AND NVL(l_zvw_situation,'A')<>'H' THEN
12451
12452 fnd_message.set_name('PER','HR_373538_NL_CDZVW_CHECKS');
12453 fnd_message.set_token('TAGVAL1','H');
12454 fnd_message.set_token('TAGVAL2',l_wage_tax_table);
12455
12456 pay_action_information_api.create_action_information
12457 (
12458 p_action_information_id => l_action_info_id
12459 , p_action_context_id => p_assactid
12460 , p_action_context_type => 'AAP'
12461 , p_object_version_number => l_ovn
12462 , p_assignment_id => l_emp_rec.assignment_id
12463 , p_effective_date => p_effective_date
12464 , p_source_id => NULL
12465 , p_source_text => NULL
12466 , p_tax_unit_id => l_tax_unit_id
12467 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12468 , p_action_information4 => '0061 - '||fnd_message.get
12469 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12470 , p_action_information6 => '0061 - '||'The "Indication insurance situation Zvw" (Tag CdZvw) can only be equal to "H" when "Code wage tax table" (Tag LbTab) is equal to 220.'
12471 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12472 , p_action_information8 => l_emp_rec.assignment_number);
12473
12474 END IF;
12475 */
12476 --abraghun--7668628--Validation Code Ends
12477 --
12478 l_initial_flag := 'N';
12479 --
12480 END IF;
12481 END IF;
12482 END IF;
12483 --
12484 END LOOP;
12485 END IF;
12486 IF l_rec_changes.COUNT = 0 OR l_type <> 'INITIAL' OR l_initial_flag = 'Y' THEN
12487 l_type := 'INITIAL';
12488 --Fnd_file.put_line(FND_FILE.LOG,' No HR or Payroll Change : Creating NL_WR_EMPLOYMENT_INFO Information Record for Type :'||l_type);
12489 -- archive employment Information
12490 l_emp_end_date := NULL;
12491 IF l_ass_end_date <= p_chk_end_date THEN
12492 l_emp_end_date := l_ass_end_date;
12493 END IF;
12494 --
12495 IF l_initial_flag <> 'Y' THEN
12496 /* 8328995 */
12497 l_numiv_override:=null;
12498 OPEN csr_numiv_override(p_assignment_id);
12499 FETCH csr_numiv_override INTO l_numiv_override;
12500 CLOSE csr_numiv_override;
12501
12502
12503 --10100628
12504 IF p_prev_corr_year <> '-9999' THEN
12505 l_arc_y_n := IS_ARCHIVED(p_assactid, 'NL_WR_EMPLOYMENT_INFO', 'INITIAL');
12506 IF l_type = 'INITIAL' THEN
12507 IF l_arc_y_n = 'N' THEN
12508 pay_action_information_api.create_action_information (
12509 p_action_information_id => l_master_action_info_id
12510 ,p_action_context_id => p_assactid
12511 ,p_action_context_type => 'AAP'
12512 ,p_object_version_number => l_ovn
12513 ,p_assignment_id => l_emp_rec.assignment_id
12514 ,p_effective_date => p_effective_date
12515 ,p_source_id => NULL
12516 ,p_source_text => NULL
12517 ,p_tax_unit_id => l_tax_unit_id
12518 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
12519 ,p_action_information1 => l_type
12520 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(p_chk_start_date,trunc(p_chk_end_date,'Y')))
12521 ,p_action_information3 => fnd_date.date_to_canonical(p_chk_end_date)
12522 ,p_action_information4 => l_emp_rec.assignment_number
12523 ,p_action_information5 => l_emp_rec.employee_number
12524 ,p_action_information8 => l_emp_rec.sofi_number
12525 ,p_action_information6 => substr(l_emp_rec.change_reason,3)
12526 ,p_action_information7 => l_emp_rec.person_id
12527 ,p_action_information9 => l_emp_rec.Initials
12528 ,p_action_information10 => l_emp_rec.prefix
12529 ,p_action_information11 => l_emp_rec.last_name
12530 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
12531 ,p_action_information13 => l_nationality
12532 ,p_action_information14 => l_emp_rec.gender
12533 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
12534 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
12535 ,p_action_information17 => NULL
12536 ,p_action_information18 => nvl(l_numiv_override,l_emp_seq)); -- 8328995
12537 END IF;
12538 ELSE
12539 pay_action_information_api.create_action_information (
12540 p_action_information_id => l_master_action_info_id
12541 ,p_action_context_id => p_assactid
12542 ,p_action_context_type => 'AAP'
12543 ,p_object_version_number => l_ovn
12544 ,p_assignment_id => l_emp_rec.assignment_id
12545 ,p_effective_date => p_effective_date
12546 ,p_source_id => NULL
12547 ,p_source_text => NULL
12548 ,p_tax_unit_id => l_tax_unit_id
12549 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
12550 ,p_action_information1 => 'CORRECT' --l_type 10100628
12551 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(p_chk_start_date,trunc(p_chk_end_date,'Y')))
12552 ,p_action_information3 => fnd_date.date_to_canonical(p_chk_end_date)
12553 ,p_action_information4 => l_emp_rec.assignment_number
12554 ,p_action_information5 => l_emp_rec.employee_number
12555 ,p_action_information8 => l_emp_rec.sofi_number
12556 ,p_action_information6 => substr(l_emp_rec.change_reason,3)
12557 ,p_action_information7 => l_emp_rec.person_id
12558 ,p_action_information9 => l_emp_rec.Initials
12559 ,p_action_information10 => l_emp_rec.prefix
12560 ,p_action_information11 => l_emp_rec.last_name
12561 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
12562 ,p_action_information13 => l_nationality
12563 ,p_action_information14 => l_emp_rec.gender
12564 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
12565 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
12566 ,p_action_information17 => NULL
12567 ,p_action_information18 => nvl(l_numiv_override,l_emp_seq)); -- 8328995
12568 END IF;
12569 ELSE
12570 --10100628
12571 pay_action_information_api.create_action_information (
12572 p_action_information_id => l_master_action_info_id
12573 ,p_action_context_id => p_assactid
12574 ,p_action_context_type => 'AAP'
12575 ,p_object_version_number => l_ovn
12576 ,p_assignment_id => l_emp_rec.assignment_id
12577 ,p_effective_date => p_effective_date
12578 ,p_source_id => NULL
12579 ,p_source_text => NULL
12580 ,p_tax_unit_id => l_tax_unit_id
12581 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
12582 ,p_action_information1 => l_type
12583 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(p_chk_start_date,trunc(p_chk_end_date,'Y')))
12584 ,p_action_information3 => fnd_date.date_to_canonical(p_chk_end_date)
12585 ,p_action_information4 => l_emp_rec.assignment_number
12586 ,p_action_information5 => l_emp_rec.employee_number
12587 ,p_action_information8 => l_emp_rec.sofi_number
12588 ,p_action_information6 => substr(l_emp_rec.change_reason,3)
12589 ,p_action_information7 => l_emp_rec.person_id
12590 ,p_action_information9 => l_emp_rec.Initials
12591 ,p_action_information10 => l_emp_rec.prefix
12592 ,p_action_information11 => l_emp_rec.last_name
12593 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
12594 ,p_action_information13 => l_nationality
12595 ,p_action_information14 => l_emp_rec.gender
12596 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
12597 ,p_action_information16 => fnd_date.date_to_canonical(l_emp_end_date)
12598 ,p_action_information17 => NULL
12599 ,p_action_information18 => nvl(l_numiv_override,l_emp_seq)); -- 8328995
12600 END IF; --10100628
12601
12602
12603 /* 9764359 */
12604 --
12605 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: chk_events 4 ');
12606 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before l_num_over_clash: '|| to_char(l_num_over_clash));
12607 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before l_emp_rec.assignment_id: '|| l_emp_rec.assignment_id);
12608 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before Sequencs: '|| nvl(l_numiv_override,l_emp_seq));
12609
12610 l_num_over_clash:=HR_NL_ASG_EXTRA_INFO_CHECKS.ASG_CHECK_NUMIV_OVERRIDE(l_emp_rec.assignment_id,nvl(l_numiv_override,l_emp_seq));
12611 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: After l_num_over_clash: '|| to_char(l_num_over_clash));
12612 --
12613 IF l_num_over_clash=1 THEN
12614 pay_action_information_api.create_action_information
12615 (
12616 p_action_information_id => l_action_info_id
12617 , p_action_context_id => p_assactid
12618 , p_action_context_type => 'AAP'
12619 , p_object_version_number => l_ovn
12620 , p_assignment_id => NULL
12621 , p_effective_date => p_effective_date
12622 , p_source_id => NULL
12623 , p_source_text => NULL
12624 , p_tax_unit_id => l_tax_unit_id
12625 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12626 , p_action_information4 => fnd_message.get_string('PER','HR_373547_NUMIV_OVERRIDE')
12627 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12628 , p_action_information6 => 'Num IV override Already Used'
12629 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12630 , p_action_information8 => l_emp_rec.assignment_number);
12631 END IF;
12632 --
12633
12634 --abraghun--7668628--Validation begins
12635 --
12636 --abraghun--7668628--Check0044 Check1044
12637 IF l_emp_rec.sofi_number is null AND l_emp_rec.employee_number is null THEN
12638 --
12639 pay_action_information_api.create_action_information
12640 (
12641 p_action_information_id => l_action_info_id
12642 , p_action_context_id => p_assactid
12643 , p_action_context_type => 'AAP'
12644 , p_object_version_number => l_ovn
12645 , p_assignment_id => l_emp_rec.assignment_id
12646 , p_effective_date => p_effective_date
12647 , p_source_id => NULL
12648 , p_source_text => NULL
12649 , p_tax_unit_id => l_tax_unit_id
12650 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12651 , p_action_information4 => '0044/1044 - '||fnd_message.get_string('PER','HR_373537_NL_EMPNO_MANDATORY')
12652 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12653 , p_action_information6 => '0044/1044 - '||'When the "BSN/Sofi-number" (Tag SofiNr) is not reported the record "Employee number" (Tag PersNr) is mandatory.'
12654 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12655 , p_action_information8 => l_emp_rec.assignment_number);
12656 --
12657 END IF;
12658
12659 --abraghun--7668628--Check0046 Check0047 Check0048 Check0049
12660 IF l_emp_rec.sofi_number is not null AND l_wage_tax_table <> 940 THEN
12661 fnd_message.set_name('PER','HR_373535_NL_NON940_MANDATORY');
12662
12663 --abraghun--7668628--Check0046
12664 IF l_emp_rec.last_name is null THEN
12665 --
12666 fnd_message.set_token('TAGVAL1',l_wage_tax_table);
12667 fnd_message.set_token('TAG2','SignNm');
12668
12669 pay_action_information_api.create_action_information
12670 (
12671 p_action_information_id => l_action_info_id
12672 , p_action_context_id => p_assactid
12673 , p_action_context_type => 'AAP'
12674 , p_object_version_number => l_ovn
12675 , p_assignment_id => l_emp_rec.assignment_id
12676 , p_effective_date => p_effective_date
12677 , p_source_id => NULL
12678 , p_source_text => NULL
12679 , p_tax_unit_id => l_tax_unit_id
12680 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12681 , p_action_information4 => '0046 - '||fnd_message.get
12682 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12683 , p_action_information6 => '0046 - '||'When "BSN/Sofi-number" (Tag SofiNr) is reported and "Code wage tax table" (Tag LbTab) is not equal to 940 the "Last Name" (Tag SignNm) cannot be empty / is mandatory.'
12684 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12685 , p_action_information8 => l_emp_rec.assignment_number);
12686 --
12687 END IF;
12688
12689 --abraghun--7668628--Check0047
12690 IF l_emp_rec.dob is null THEN
12691 --
12692 fnd_message.set_token('TAGVAL1',l_wage_tax_table);
12693 fnd_message.set_token('TAG2','Gebdat');
12694
12695 pay_action_information_api.create_action_information
12696 (
12697 p_action_information_id => l_action_info_id
12698 , p_action_context_id => p_assactid
12699 , p_action_context_type => 'AAP'
12700 , p_object_version_number => l_ovn
12701 , p_assignment_id => l_emp_rec.assignment_id
12702 , p_effective_date => p_effective_date
12703 , p_source_id => NULL
12704 , p_source_text => NULL
12705 , p_tax_unit_id => l_tax_unit_id
12706 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12707 , p_action_information4 => '0047 - '||fnd_message.get
12708 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12709 , p_action_information6 => '0047 - '||'When "BSN/Sofi-number" (Tag SofiNr) is reported and "Code wage tax table" (Tag LbTab) is not equal to 940 the "Date of birth" (Tag Gebdat) cannot be empty / is mandatory.'
12710 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12711 , p_action_information8 => l_emp_rec.assignment_number);
12712 --
12713 END IF;
12714
12715 --abraghun--7668628--Check0048
12716 IF l_nationality is null THEN
12717 --
12718 fnd_message.set_token('TAGVAL1',l_wage_tax_table);
12719 fnd_message.set_token('TAG2','Nat');
12720
12721 pay_action_information_api.create_action_information
12722 (
12723 p_action_information_id => l_action_info_id
12724 , p_action_context_id => p_assactid
12725 , p_action_context_type => 'AAP'
12726 , p_object_version_number => l_ovn
12727 , p_assignment_id => l_emp_rec.assignment_id
12728 , p_effective_date => p_effective_date
12729 , p_source_id => NULL
12730 , p_source_text => NULL
12731 , p_tax_unit_id => l_tax_unit_id
12732 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12733 , p_action_information4 => '0048 - '||fnd_message.get
12734 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12735 , p_action_information6 => '0048 - '||'When "BSN/Sofi-number" (Tag SofiNr) is reported and "Code wage tax table" (Tag LbTab) is not equal to 940 the "Nationality" (Tag Nat) cannot be empty / is mandatory.'
12736 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12737 , p_action_information8 => l_emp_rec.assignment_number);
12738 --
12739 END IF;
12740
12741 --abraghun--7668628--Check0049
12742 IF l_emp_rec.gender is null THEN
12743 --
12744 fnd_message.set_token('TAGVAL1',l_wage_tax_table);
12745 fnd_message.set_token('TAG2','Gesl');
12746
12747 pay_action_information_api.create_action_information
12748 (
12749 p_action_information_id => l_action_info_id
12750 , p_action_context_id => p_assactid
12751 , p_action_context_type => 'AAP'
12752 , p_object_version_number => l_ovn
12753 , p_assignment_id => l_emp_rec.assignment_id
12754 , p_effective_date => p_effective_date
12755 , p_source_id => NULL
12756 , p_source_text => NULL
12757 , p_tax_unit_id => l_tax_unit_id
12758 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12759 , p_action_information4 => '0049 - '||fnd_message.get
12760 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12761 , p_action_information6 => '0049 - '||'When "BSN/Sofi-number" (Tag SofiNr) is reported and "Code wage tax table" (Tag LbTab) is not equal to 940 the "Gender" (Tag Gesl) cannot be empty / is mandatory.'
12762 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12763 , p_action_information8 => l_emp_rec.assignment_number);
12764 --
12765 END IF;
12766 END IF;
12767 --
12768 --abraghun--7668628--Check0039
12769 IF l_ass_start_date > p_chk_end_date THEN
12770 --
12771 fnd_message.set_name('PER','HR_373543_NL_DATE_LTEQ');
12772 fnd_message.set_token('TAG1','DatAanv');
12773 fnd_message.set_token('TAGVAL1',fnd_date.date_to_canonical(l_ass_start_date));
12774 fnd_message.set_token('TAG2','DatEindTv');
12775 fnd_message.set_token('TAGVAL2',fnd_date.date_to_canonical(p_chk_end_date));
12776
12777 pay_action_information_api.create_action_information
12778 (
12779 p_action_information_id => l_action_info_id
12780 , p_action_context_id => p_assactid
12781 , p_action_context_type => 'AAP'
12782 , p_object_version_number => l_ovn
12783 , p_assignment_id => l_emp_rec.assignment_id
12784 , p_effective_date => p_effective_date
12785 , p_source_id => NULL
12786 , p_source_text => NULL
12787 , p_tax_unit_id => l_tax_unit_id
12788 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12789 , p_action_information4 => '0039 - '||fnd_message.get
12790 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12791 , p_action_information6 => '0039 - '||'The "Start date income relation" (Tag DatAanv) has to be lower than or equal to the "End date period" (Tag DatEindTv) within one report or one correction report.'
12792 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12793 , p_action_information8 => l_emp_rec.assignment_number);
12794 --
12795 END IF;
12796 --
12797 --
12798 --abraghun--7668628--Check0040
12799
12800 --abraghun--8552196--Mistake in Validation Corrected
12801 --Old: (DatEind>=DatAanvTv)
12802 --New: (DatEind<=DatEindTv)
12803
12804 IF l_emp_end_date is not null
12805 --and l_emp_end_date < GREATEST(p_chk_start_date,trunc(p_chk_end_date,'Y')) THEN
12806 and l_emp_end_date > p_chk_end_date THEN
12807
12808 --fnd_message.set_name('PER','HR_373544_NL_DATE_GTEQ');
12809 fnd_message.set_name('PER','HR_373543_NL_DATE_LTEQ');
12810 fnd_message.set_token('TAG1','DatEind');
12811 fnd_message.set_token('TAGVAL1',fnd_date.date_to_canonical(l_emp_end_date));
12812 --fnd_message.set_token('TAG2','DatAanvTv');
12813 --fnd_message.set_token('TAGVAL2',fnd_date.date_to_canonical(GREATEST(p_chk_start_date,trunc(p_chk_end_date,'Y'))));
12814 fnd_message.set_token('TAG2','DatEindTv');
12815 fnd_message.set_token('TAGVAL2',fnd_date.date_to_canonical(p_chk_end_date));
12816
12817 --
12818 pay_action_information_api.create_action_information
12819 (
12820 p_action_information_id => l_action_info_id
12821 , p_action_context_id => p_assactid
12822 , p_action_context_type => 'AAP'
12823 , p_object_version_number => l_ovn
12824 , p_assignment_id => l_emp_rec.assignment_id
12825 , p_effective_date => p_effective_date
12826 , p_source_id => NULL
12827 , p_source_text => NULL
12828 , p_tax_unit_id => l_tax_unit_id
12829 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12830 , p_action_information4 => '0040 - '||fnd_message.get
12831 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12832 --, p_action_information6 => '0040 - '||'The "End date income relation" (Tag DatEind) has to be higher than or equal to the "Start date period" (Tag DatAanvTv) within one report or one correction report.'
12833 , p_action_information6 => '0040 - '||'The "End date income relation" (Tag DatEind) has to be lower than or equal to the "End date period" (Tag DatEindTv) within one report or one correction report.'
12834 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12835 , p_action_information8 => l_emp_rec.assignment_number);
12836 --
12837 END IF;
12838 --
12839 --abraghun--7668628--Check0041
12840 IF l_emp_end_date is not null and l_emp_end_date < l_ass_start_date THEN
12841 --
12842 fnd_message.set_name('PER','HR_373544_NL_DATE_GTEQ');
12843 fnd_message.set_token('TAG1','DatEind');
12844 fnd_message.set_token('TAGVAL1',fnd_date.date_to_canonical(l_emp_end_date));
12845 fnd_message.set_token('TAG2','DatAanv');
12846 fnd_message.set_token('TAGVAL2',fnd_date.date_to_canonical(l_ass_start_date));
12847
12848 pay_action_information_api.create_action_information
12849 (
12850 p_action_information_id => l_action_info_id
12851 , p_action_context_id => p_assactid
12852 , p_action_context_type => 'AAP'
12853 , p_object_version_number => l_ovn
12854 , p_assignment_id => l_emp_rec.assignment_id
12855 , p_effective_date => p_effective_date
12856 , p_source_id => NULL
12857 , p_source_text => NULL
12858 , p_tax_unit_id => l_tax_unit_id
12859 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12860 , p_action_information4 => '0041 - '||fnd_message.get
12861 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12862 , p_action_information6 => '0041 - '||'The "End date income relation" (Tag DatEind) has to be higher than or equal to the "Start date income relation" (Tag DatAanv).'
12863 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12864 , p_action_information8 => l_emp_rec.assignment_number);
12865 --
12866 END IF;
12867 --
12868 --abraghun--7668628--Check0042
12869 IF l_emp_rec.change_reason is not null AND l_labour_rel_code <> 11 THEN
12870 --
12871 pay_action_information_api.create_action_information
12872 (
12873 p_action_information_id => l_action_info_id
12874 , p_action_context_id => p_assactid
12875 , p_action_context_type => 'AAP'
12876 , p_object_version_number => l_ovn
12877 , p_assignment_id => l_emp_rec.assignment_id
12878 , p_effective_date => p_effective_date
12879 , p_source_id => NULL
12880 , p_source_text => NULL
12881 , p_tax_unit_id => l_tax_unit_id
12882 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12883 , p_action_information4 => '0042 - '||fnd_message.get_string('PER','HR_373545_NL_RDNEINDFLX_CHECK1')
12884 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12885 , p_action_information6 => '0042 - '||'The "Code reason end of Income relation Flex worker" is only allowed when the "Code kind of labour relation" (Tag CdAard) is equal to 11.'
12886 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12887 , p_action_information8 => l_emp_rec.assignment_number);
12888 --
12889 END IF;
12890 --
12891 --abraghun--7668628--Check0043
12892 IF l_emp_rec.change_reason is not null AND l_emp_end_date is null THEN
12893 --
12894 pay_action_information_api.create_action_information
12895 (
12896 p_action_information_id => l_action_info_id
12897 , p_action_context_id => p_assactid
12898 , p_action_context_type => 'AAP'
12899 , p_object_version_number => l_ovn
12900 , p_assignment_id => l_emp_rec.assignment_id
12901 , p_effective_date => p_effective_date
12902 , p_source_id => NULL
12903 , p_source_text => NULL
12904 , p_tax_unit_id => l_tax_unit_id
12905 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12906 , p_action_information4 => '0043 - '||fnd_message.get_string('PER','HR_373546_NL_RDNEINDFLX_CHECK2')
12907 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12908 , p_action_information6 => '0043 - '||'The "Code reason end of Income relation Flex worker" is only allowed when the "End date income relation" (Tag DatEind) is reported.'
12909 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12910 , p_action_information8 => l_emp_rec.assignment_number);
12911 --
12912 END IF;
12913 --abraghun--7668628--validation ends
12914
12915
12916 END IF;
12917 -- archive address information
12918 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Employee Address Record for Type :'||l_type);
12919 archive_emp_address(p_assactid
12920 ,l_emp_rec.person_id
12921 ,l_emp_rec.assignment_id
12922 ,l_emp_rec.assignment_number
12923 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12924 ,l_tax_unit_id
12925 ,l_master_action_info_id
12926 ,p_effective_date
12927 ,NVL(l_emp_end_date,p_effective_date)
12928 ,l_type
12929 ,p_prev_corr_year); --10100628
12930 -- archive sector information for assignment
12931 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Sector Risk Group Record for Type :'||l_type);
12932 l_srg_flag := archive_sector_risk_group(p_assactid
12933 ,l_emp_rec.assignment_id
12934 ,p_effective_date
12935 ,l_tax_unit_id
12936 ,l_master_action_info_id
12937 ,p_chk_start_date
12938 ,p_chk_end_date
12939 ,l_ass_start_date
12940 ,l_emp_end_date
12941 ,p_payroll_type);
12942 --#
12943 IF l_srg_flag = 'N' AND (l_wao_insured = 'Y' OR l_ww_insured = 'Y' OR l_zw_insured = 'Y') THEN
12944 --
12945 pay_action_information_api.create_action_information
12946 (
12947 p_action_information_id => l_action_info_id
12948 , p_action_context_id => p_assactid
12949 , p_action_context_type => 'AAP'
12950 , p_object_version_number => l_ovn
12951 , p_assignment_id => l_emp_rec.assignment_id
12952 , p_effective_date => p_effective_date
12953 , p_source_id => NULL
12954 , p_source_text => NULL
12955 , p_tax_unit_id => l_tax_unit_id
12956 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12957 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_ASG_RISK_GRP')
12958 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12959 , p_action_information6 => 'Assignment has no Sector or Risk Group'
12960 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12961 , p_action_information8 => l_emp_rec.assignment_number);
12962 --
12963 END IF;
12964 --#
12965 --LC 2012 begin
12966 IF p_effective_date < TO_DATE('01012012','DDMMYYYY') THEN
12967 --LC 2010--begins
12968 IF l_zvw_small_jobs = 'D' THEN
12969 pay_action_information_api.create_action_information
12970 (
12971 p_action_information_id => l_action_info_id
12972 , p_action_context_id => p_assactid
12973 , p_action_context_type => 'AAP'
12974 , p_object_version_number => l_ovn
12975 , p_assignment_id => l_emp_rec.assignment_id
12976 , p_effective_date => p_effective_date
12977 , p_source_id => NULL
12978 , p_source_text => NULL
12979 , p_tax_unit_id => l_tax_unit_id
12980 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
12981 , p_action_information4 => fnd_message.get_string('PER','HR_373549_NL_ZVW_J_DEFAULT')
12982 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
12983 , p_action_information6 => 'Contribution Exempt Small Job is applicable. Therefore, the ZVW code is set to J.'
12984 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
12985 , p_action_information8 => l_emp_rec.assignment_number);
12986 END IF;
12987 IF l_zvw_small_jobs = 'W' THEN
12988 pay_action_information_api.create_action_information
12989 (
12990 p_action_information_id => l_action_info_id
12991 , p_action_context_id => p_assactid
12992 , p_action_context_type => 'AAP'
12993 , p_object_version_number => l_ovn
12994 , p_assignment_id => l_emp_rec.assignment_id
12995 , p_effective_date => p_effective_date
12996 , p_source_id => NULL
12997 , p_source_text => NULL
12998 , p_tax_unit_id => l_tax_unit_id
12999 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13000 , p_action_information4 => fnd_message.get_string('PER','HR_373550_NL_ZVW_J_WARNING')
13001 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13002 , p_action_information6 => 'The ZVW code is set to J when Contribution Exempt Small Job is not applicable.'
13003 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13004 , p_action_information8 => l_emp_rec.assignment_number);
13005 END IF;
13006 --LC 2010--ends
13007 END IF;
13008 --LC 2012 end
13009 --#
13010 IF l_zvw_defaulted = 'Y' THEN
13011 pay_action_information_api.create_action_information
13012 (
13013 p_action_information_id => l_action_info_id
13014 , p_action_context_id => p_assactid
13015 , p_action_context_type => 'AAP'
13016 , p_object_version_number => l_ovn
13017 , p_assignment_id => l_emp_rec.assignment_id
13018 , p_effective_date => p_effective_date
13019 , p_source_id => NULL
13020 , p_source_text => NULL
13021 , p_tax_unit_id => l_tax_unit_id
13022 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13023 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_ZVW_CODE_INSURED')
13024 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13025 , p_action_information6 => 'Code ZVW is defaulted to - A'
13026 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13027 , p_action_information8 => l_emp_rec.assignment_number);
13028 END IF;
13029 --
13030 --abraghun--8552196--Check0053 - Prefixed Errorcode to existing Error message.
13031 IF l_income_code IN (11,12,13,14,15,18) AND l_labour_rel_code IS NULL THEN
13032 pay_action_information_api.create_action_information
13033 (
13034 p_action_information_id => l_action_info_id
13035 , p_action_context_id => p_assactid
13036 , p_action_context_type => 'AAP'
13037 , p_object_version_number => l_ovn
13038 , p_assignment_id => l_emp_rec.assignment_id
13039 , p_effective_date => p_effective_date
13040 , p_source_id => NULL
13041 , p_source_text => NULL
13042 , p_tax_unit_id => l_tax_unit_id
13043 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13044 , p_action_information4 => '0053 - '||fnd_message.get_string('PER','HR_NL_INVALID_LABOR_CODE')
13045 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13046 , p_action_information6 => '0053 - '||'Labor Relation code is null'
13047 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13048 , p_action_information8 => l_emp_rec.assignment_number);
13049 END IF;
13050 --
13051 --abraghun--8552196--Check0055 - Prefixed Errorcode to existing Error message.
13052 IF l_income_code IN (11,12,13,14,15,18) AND l_assignment_catg IS NULL THEN
13053 pay_action_information_api.create_action_information
13054 (
13055 p_action_information_id => l_action_info_id
13056 , p_action_context_id => p_assactid
13057 , p_action_context_type => 'AAP'
13058 , p_object_version_number => l_ovn
13059 , p_assignment_id => l_emp_rec.assignment_id
13060 , p_effective_date => p_effective_date
13061 , p_source_id => NULL
13062 , p_source_text => NULL
13063 , p_tax_unit_id => l_tax_unit_id
13064 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13065 , p_action_information4 => '0055 - '||fnd_message.get_string('PER','HR_NL_INVALID_CONTRACT_CODE')
13066 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13067 , p_action_information6 => '0055 - '||'Code contract for limited or unlimited time is null'
13068 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13069 , p_action_information8 => l_emp_rec.assignment_number);
13070 END IF;
13071 --
13072 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
13073 pay_action_information_api.create_action_information
13074 (
13075 p_action_information_id => l_action_info_id
13076 , p_action_context_id => p_assactid
13077 , p_action_context_type => 'AAP'
13078 , p_object_version_number => l_ovn
13079 , p_assignment_id => l_emp_rec.assignment_id
13080 , p_effective_date => p_effective_date
13081 , p_source_id => NULL
13082 , p_source_text => NULL
13083 , p_tax_unit_id => l_tax_unit_id
13084 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13085 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_WORK_PATTERN')
13086 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13087 , p_action_information6 => 'Indication regular work pattern is null'
13088 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13089 , p_action_information8 => l_emp_rec.assignment_number);
13090 END IF;
13091 --
13092 IF l_srg_flag = 'Z' AND l_FZ_Code IS NULL THEN
13093 pay_action_information_api.create_action_information
13094 (
13095 p_action_information_id => l_action_info_id
13096 , p_action_context_id => p_assactid
13097 , p_action_context_type => 'AAP'
13098 , p_object_version_number => l_ovn
13099 , p_assignment_id => l_emp_rec.assignment_id
13100 , p_effective_date => p_effective_date
13101 , p_source_id => NULL
13102 , p_source_text => NULL
13103 , p_tax_unit_id => l_tax_unit_id
13104 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13105 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_TEMP_LABOR_CODE')
13106 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13107 , p_action_information6 => 'Temp Labor Code is null'
13108 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13109 , p_action_information8 => l_emp_rec.assignment_number);
13110 END IF;
13111 --
13112 IF l_company_car_use = 4 AND g_effective_date > to_date('01012007','ddmmyyyy') THEN
13113 pay_action_information_api.create_action_information
13114 (
13115 p_action_information_id => l_action_info_id
13116 , p_action_context_id => p_assactid
13117 , p_action_context_type => 'AAP'
13118 , p_object_version_number => l_ovn
13119 , p_assignment_id => l_emp_rec.assignment_id
13120 , p_effective_date => p_effective_date
13121 , p_source_id => NULL
13122 , p_source_text => NULL
13123 , p_tax_unit_id => l_tax_unit_id
13124 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13125 , p_action_information4 => fnd_message.get_string('PER','HR_NL_INVALID_COMPANY_CAR_USE')
13126 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13127 , p_action_information6 => 'Company Car Usage code invalid'
13128 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13129 , p_action_information8 => l_emp_rec.assignment_number);
13130 END IF;
13131 --#
13132 IF l_initial_flag <> 'Y' THEN
13133 --archive Income period information
13134 --Fnd_file.put_line(FND_FILE.LOG,' Archiving NL_WR_INCOME_PERIOD Record for Type :'||l_type);
13135
13136 IF p_prev_corr_year <> '-9999' THEN
13137 l_arc_y_n := IS_ARCHIVED(p_assactid, 'NL_WR_INCOME_PERIOD', 'INITIAL');
13138 IF l_type = 'INITIAL' THEN
13139 IF l_arc_y_n = 'N' THEN
13140 pay_action_information_api.create_action_information (
13141 p_action_information_id => l_action_info_id
13142 , p_action_context_id => p_assactid
13143 , p_action_context_type => 'AAP'
13144 , p_object_version_number => l_ovn
13145 , p_assignment_id => l_emp_rec.assignment_id
13146 , p_effective_date => p_effective_date
13147 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
13148 , p_tax_unit_id => l_tax_unit_id
13149 , p_action_information1 => l_type
13150 , p_action_information2 => l_master_action_info_id
13151 , p_action_information5 => fnd_date.date_to_canonical(GREATEST(GREATEST(p_chk_start_date,l_ass_start_date),trunc(p_chk_end_date,'Y')))
13152 , p_action_information6 => l_income_code
13153 , p_action_information7 => l_labour_rel_code
13154 , p_action_information8 => l_ins_duty_code
13155 , p_action_information9 => l_assignment_catg
13156 , p_action_information10 => l_FZ_Code
13157 , p_action_information11 => l_work_pattern
13158 , p_action_information12 => l_cao_code
13159 , p_action_information13 => l_handicapped_code
13160 , p_action_information14 => l_wage_tax_discount
13161 , p_action_information15 => l_company_car_use
13162 , p_action_information16 => l_wage_tax_table
13163 , p_action_information17 => l_wao_insured
13164 , p_action_information18 => l_ww_insured
13165 , p_action_information19 => l_zw_insured
13166 , p_action_information20 => NVL(l_zvw_situation,'A')
13167 , p_action_information21 => l_holiday_coupen--'holiday coupen'
13168 , p_action_information22 => l_wage_aow
13169 , p_action_information23 => l_wage_wajong
13170 , p_action_information24 => l_emp_loan
13171 , p_action_information25 => l_transportation
13172 , p_action_information26 => l_income_increase--'INCOME DECREASE' -- A1
13173 , p_action_information27 => l_add_allowance--'ADDITIONAL ALLW');
13174 , p_action_information28 => l_marginal_empl/*LC 2010*/ --PMA
13175 , p_action_information29 => l_wm_old_rule/*LC 2010*/ --WgldOudRegl
13176 , p_action_information30 => l_temp_tax_discount);/* LC 2013*/ --IndTijdHk
13177 END IF;
13178 ELSE
13179 pay_action_information_api.create_action_information (
13180 p_action_information_id => l_action_info_id
13181 , p_action_context_id => p_assactid
13182 , p_action_context_type => 'AAP'
13183 , p_object_version_number => l_ovn
13184 , p_assignment_id => l_emp_rec.assignment_id
13185 , p_effective_date => p_effective_date
13186 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
13187 , p_tax_unit_id => l_tax_unit_id
13188 , p_action_information1 => 'CORRECT' --l_type 10100628
13189 , p_action_information2 => l_master_action_info_id
13190 , p_action_information5 => fnd_date.date_to_canonical(GREATEST(GREATEST(p_chk_start_date,l_ass_start_date),trunc(p_chk_end_date,'Y')))
13191 , p_action_information6 => l_income_code
13192 , p_action_information7 => l_labour_rel_code
13193 , p_action_information8 => l_ins_duty_code
13194 , p_action_information9 => l_assignment_catg
13195 , p_action_information10 => l_FZ_Code
13196 , p_action_information11 => l_work_pattern
13197 , p_action_information12 => l_cao_code
13198 , p_action_information13 => l_handicapped_code
13199 , p_action_information14 => l_wage_tax_discount
13200 , p_action_information15 => l_company_car_use
13201 , p_action_information16 => l_wage_tax_table
13202 , p_action_information17 => l_wao_insured
13203 , p_action_information18 => l_ww_insured
13204 , p_action_information19 => l_zw_insured
13205 , p_action_information20 => NVL(l_zvw_situation,'A')
13206 , p_action_information21 => l_holiday_coupen--'holiday coupen'
13207 , p_action_information22 => l_wage_aow
13208 , p_action_information23 => l_wage_wajong
13209 , p_action_information24 => l_emp_loan
13210 , p_action_information25 => l_transportation
13211 , p_action_information26 => l_income_increase--'INCOME DECREASE' -- A1
13212 , p_action_information27 => l_add_allowance--'ADDITIONAL ALLW');
13213 , p_action_information28 => l_marginal_empl/*LC 2010*/ --PMA
13214 , p_action_information29 => l_wm_old_rule/*LC 2010*/ --WgldOudRegl
13215 , p_action_information30 => l_temp_tax_discount);/* LC 2013*/ --IndTijdHk
13216 END IF;
13217
13218 ELSE
13219 --10100628
13220 pay_action_information_api.create_action_information (
13221 p_action_information_id => l_action_info_id
13222 , p_action_context_id => p_assactid
13223 , p_action_context_type => 'AAP'
13224 , p_object_version_number => l_ovn
13225 , p_assignment_id => l_emp_rec.assignment_id
13226 , p_effective_date => p_effective_date
13227 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
13228 , p_tax_unit_id => l_tax_unit_id
13229 , p_action_information1 => l_type
13230 , p_action_information2 => l_master_action_info_id
13231 , p_action_information5 => fnd_date.date_to_canonical(GREATEST(GREATEST(p_chk_start_date,l_ass_start_date),trunc(p_chk_end_date,'Y')))
13232 , p_action_information6 => l_income_code
13233 , p_action_information7 => l_labour_rel_code
13234 , p_action_information8 => l_ins_duty_code
13235 , p_action_information9 => l_assignment_catg
13236 , p_action_information10 => l_FZ_Code
13237 , p_action_information11 => l_work_pattern
13238 , p_action_information12 => l_cao_code
13239 , p_action_information13 => l_handicapped_code
13240 , p_action_information14 => l_wage_tax_discount
13241 , p_action_information15 => l_company_car_use
13242 , p_action_information16 => l_wage_tax_table
13243 , p_action_information17 => l_wao_insured
13244 , p_action_information18 => l_ww_insured
13245 , p_action_information19 => l_zw_insured
13246 , p_action_information20 => NVL(l_zvw_situation,'A')
13247 , p_action_information21 => l_holiday_coupen--'holiday coupen'
13248 , p_action_information22 => l_wage_aow
13249 , p_action_information23 => l_wage_wajong
13250 , p_action_information24 => l_emp_loan
13251 , p_action_information25 => l_transportation
13252 , p_action_information26 => l_income_increase--'INCOME DECREASE' -- A1
13253 , p_action_information27 => l_add_allowance--'ADDITIONAL ALLW');
13254 , p_action_information28 => l_marginal_empl/*LC 2010*/ --PMA
13255 , p_action_information29 => l_wm_old_rule/*LC 2010*/ --WgldOudRegl
13256 , p_action_information30 => l_temp_tax_discount);/* LC 2013*/ --IndTijdHk
13257 END IF; --10100628
13258 --abraghun--7668628--Validation Code
13259 --abraghun--7668628--Check0054
13260 IF l_income_code=18 AND l_labour_rel_code <> 18 THEN
13261 pay_action_information_api.create_action_information
13262 (
13263 p_action_information_id => l_action_info_id
13264 , p_action_context_id => p_assactid
13265 , p_action_context_type => 'AAP'
13266 , p_object_version_number => l_ovn
13267 , p_assignment_id => l_emp_rec.assignment_id
13268 , p_effective_date => p_effective_date
13269 , p_source_id => NULL
13270 , p_source_text => NULL
13271 , p_tax_unit_id => l_tax_unit_id
13272 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13273 , p_action_information4 => '0054 - '||fnd_message.get_string('PER','HR_373539_NL_CDAARD_CHECK')
13274 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13275 , p_action_information6 => '0054 - '||'The "Code kind of labour relation" (Tag CdAard) has to be 18 when "Income Code" (Tag SrtIV) is equal to 18.'
13276 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13277 , p_action_information8 => l_emp_rec.assignment_number);
13278 END IF;
13279 --
13280 --abraghun--7668628--Check0056
13281 --
13282 IF l_income_code IN (11,12,13,14,15,17,18) AND l_cao_code IS NULL THEN
13283 fnd_message.set_name('PER','HR_373531_NL_SRTIV_MANDATORY');
13284 fnd_message.set_token('SRTIV',l_income_code);
13285 fnd_message.set_token('TAG','CAO');
13286 pay_action_information_api.create_action_information
13287 (
13288 p_action_information_id => l_action_info_id
13289 , p_action_context_id => p_assactid
13290 , p_action_context_type => 'AAP'
13291 , p_object_version_number => l_ovn
13292 , p_assignment_id => l_emp_rec.assignment_id
13293 , p_effective_date => p_effective_date
13294 , p_source_id => NULL
13295 , p_source_text => NULL
13296 , p_tax_unit_id => l_tax_unit_id
13297 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13298 , p_action_information4 => '0056 - '||fnd_message.get
13299 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13300 , p_action_information6 => '0056 - '||'When the "Income Code" (Tag SrtIV) is equal to 11, 12, 13, 14, 15, 17 or 18, the "Code CAO" (Tag CAO) is mandatory.'
13301 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13302 , p_action_information8 => l_emp_rec.assignment_number);
13303 END IF;
13304 --
13305 --abraghun--8552196--Check0057 Check0058 Check0059 Removed--
13306 /*Commenting out Starts
13307 --abraghun--7668628--Check0057 Check0058 Check0059--
13308 --
13309
13310 IF (months_between(p_effective_date,l_emp_rec.dob)/12)>=65 THEN
13311
13312 --abraghun--7668628--Check0057
13313 IF l_wao_insured = 'J' THEN
13314 fnd_message.set_name('PER','HR_373532_NL_AGE65_CHECKS');
13315 fnd_message.set_token('AGE',ROUND(months_between(p_effective_date,l_emp_rec.dob)/12));
13316 fnd_message.set_token('TAG','IndWAO');
13317 pay_action_information_api.create_action_information
13318 (
13319 p_action_information_id => l_action_info_id
13320 , p_action_context_id => p_assactid
13321 , p_action_context_type => 'AAP'
13322 , p_object_version_number => l_ovn
13323 , p_assignment_id => l_emp_rec.assignment_id
13324 , p_effective_date => p_effective_date
13325 , p_source_id => NULL
13326 , p_source_text => NULL
13327 , p_tax_unit_id => l_tax_unit_id
13328 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13329 , p_action_information4 => '0057 - '||fnd_message.get
13330 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13331 , p_action_information6 => '0057 - '||'When the employee reaches the age of 65 in the current period (the age is 65 on the last day of the period), the "Indication WAO/IVA/WGA insured" (Tag IndWAO) cannot be equal to "J".'
13332 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13333 , p_action_information8 => l_emp_rec.assignment_number);
13334 END IF;
13335 --abraghun--7668628--Check0058
13336 IF l_ww_insured = 'J' THEN
13337 fnd_message.set_name('PER','HR_373532_NL_AGE65_CHECKS');
13338 fnd_message.set_token('AGE',ROUND(months_between(p_effective_date,l_emp_rec.dob)/12));
13339 fnd_message.set_token('TAG','IndWW');
13340 pay_action_information_api.create_action_information
13341 (
13342 p_action_information_id => l_action_info_id
13343 , p_action_context_id => p_assactid
13344 , p_action_context_type => 'AAP'
13345 , p_object_version_number => l_ovn
13346 , p_assignment_id => l_emp_rec.assignment_id
13347 , p_effective_date => p_effective_date
13348 , p_source_id => NULL
13349 , p_source_text => NULL
13350 , p_tax_unit_id => l_tax_unit_id
13351 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13352 , p_action_information4 => '0058 - '||fnd_message.get
13353 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13354 , p_action_information6 => '0058 - '||'When the employee reaches the age of 65 in the current period (the age is 65 on the last day of the period), the "Indication WW insured" (Tag IndWW) cannot be equal to "J".'
13355 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13356 , p_action_information8 => l_emp_rec.assignment_number);
13357 END IF;
13358 --abraghun--7668628--Check0059
13359 IF l_zw_insured = 'J' THEN
13360 fnd_message.set_name('PER','HR_373532_NL_AGE65_CHECKS');
13361 fnd_message.set_token('AGE',ROUND(months_between(p_effective_date,l_emp_rec.dob)/12));
13362 fnd_message.set_token('TAG','IndZW');
13363 pay_action_information_api.create_action_information
13364 (
13365 p_action_information_id => l_action_info_id
13366 , p_action_context_id => p_assactid
13367 , p_action_context_type => 'AAP'
13368 , p_object_version_number => l_ovn
13369 , p_assignment_id => l_emp_rec.assignment_id
13370 , p_effective_date => p_effective_date
13371 , p_source_id => NULL
13372 , p_source_text => NULL
13373 , p_tax_unit_id => l_tax_unit_id
13374 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13375 , p_action_information4 => '0059 - '||fnd_message.get
13376 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13377 , p_action_information6 => '0059 - '||'When the employee reaches the age of 65 in the current period (the age is 65 on the last day of the period), the "Indication ZW insured" (Tag IndZW) cannot be equal to "J".'
13378 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13379 , p_action_information8 => l_emp_rec.assignment_number);
13380
13381 END IF;
13382 END IF;
13383 Commneting out Ends */
13384 --abraghun--8552196--Check0057 Check0058 Check0059 Removed--
13385 --
13386 /*
13387 --abraghun--7668628--Check0060
13388 IF l_wage_tax_table in (221,224,225) AND NVL(l_zvw_situation,'A')<>'G' THEN
13389 fnd_message.set_name('PER','HR_373538_NL_CDZVW_CHECKS');
13390 fnd_message.set_token('TAGVAL1','G');
13391 fnd_message.set_token('TAGVAL2',l_wage_tax_table);
13392
13393 pay_action_information_api.create_action_information
13394 (
13395 p_action_information_id => l_action_info_id
13396 , p_action_context_id => p_assactid
13397 , p_action_context_type => 'AAP'
13398 , p_object_version_number => l_ovn
13399 , p_assignment_id => l_emp_rec.assignment_id
13400 , p_effective_date => p_effective_date
13401 , p_source_id => NULL
13402 , p_source_text => NULL
13403 , p_tax_unit_id => l_tax_unit_id
13404 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13405 , p_action_information4 => '0060 - '||fnd_message.get
13406 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13407 , p_action_information6 => '0060 - '||'The "Indication insurance situation Zvw" (Tag CdZvw) can only be equal to "G" when "Code wage tax table" (Tag LbTab) is equal to 221, 224 or 225.'
13408 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13409 , p_action_information8 => l_emp_rec.assignment_number);
13410 --abraghun--7668628--Check0061
13411 ELSIF l_wage_tax_table =220 AND NVL(l_zvw_situation,'A')<>'H' THEN
13412
13413 fnd_message.set_name('PER','HR_373538_NL_CDZVW_CHECKS');
13414 fnd_message.set_token('TAGVAL1','H');
13415 fnd_message.set_token('TAGVAL2',l_wage_tax_table);
13416
13417 pay_action_information_api.create_action_information
13418 (
13419 p_action_information_id => l_action_info_id
13420 , p_action_context_id => p_assactid
13421 , p_action_context_type => 'AAP'
13422 , p_object_version_number => l_ovn
13423 , p_assignment_id => l_emp_rec.assignment_id
13424 , p_effective_date => p_effective_date
13425 , p_source_id => NULL
13426 , p_source_text => NULL
13427 , p_tax_unit_id => l_tax_unit_id
13428 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13429 , p_action_information4 => '0061 - '||fnd_message.get
13430 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
13431 , p_action_information6 => '0061 - '||'The "Indication insurance situation Zvw" (Tag CdZvw) can only be equal to "H" when "Code wage tax table" (Tag LbTab) is equal to 220.'
13432 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13433 , p_action_information8 => l_emp_rec.assignment_number);
13434
13435 END IF;
13436 */
13437 --abraghun--7668628--Validation Code Ends
13438
13439 END IF;
13440 --archive nominative info
13441 OPEN csr_get_assignment_action_id2(l_assignment_id,p_chk_start_date);
13442 FETCH csr_get_assignment_action_id2 INTO l_master_assignment_action_id;
13443 CLOSE csr_get_assignment_action_id2;
13444 --Fnd_file.put_line(FND_FILE.LOG,' Calling populate_nom_balance_values for Type :'||l_type);
13445 l_corr_used := 'N';
13446 populate_nom_balance_values(l_master_assignment_action_id
13447 ,l_master_assignment_action_id
13448 ,p_chk_end_date
13449 ,l_tax_unit_id
13450 ,l_type
13451 ,'HR'
13452 ,l_corr_used
13453 ,l_bal_value);
13454 --Fnd_file.put_line(FND_FILE.LOG,' Calling get_nominative_data for Type :'||l_type);
13455 get_nominative_data(l_bal_value,l_nom_bal_value);
13456 --Fnd_file.put_line(FND_FILE.LOG,' Archiving NL_WR_NOMINATIVE Record for Type :'||l_type);
13457 archive_nominative_data(p_assactid
13458 ,l_emp_rec.assignment_id
13459 ,l_tax_unit_id
13460 ,p_effective_date
13461 ,p_effective_date
13462 ,l_type
13463 ,l_master_action_info_id
13464 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
13465 ,l_corr_used
13466 ,p_payroll_type
13467 ,l_nom_bal_value
13468 ,p_prev_corr_year); --10100628
13469 END IF;
13470 --Fnd_file.put_line(FND_FILE.LOG,' Leaving chk_events');
13471 EXCEPTION
13472 WHEN OTHERS THEN
13473 --Fnd_file.put_line(FND_FILE.LOG,' Others. Assignment :'||l_assignment_id);
13474 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
13475 FND_FILE.PUT_LINE(fnd_file.output,'Exception at Assignment ID: '||l_assignment_id||' Error : '||sqlerrm(sqlcode));
13476 --NULL;--10377795
13477 END chk_events;
13478 --------------------------------------------------------------------------------
13479 -- ARCHIVE_CONSOLIDATE
13480 --------------------------------------------------------------------------------
13481 PROCEDURE archive_consolidate(p_assactid NUMBER
13482 ,p_assignment_id NUMBER
13483 ,p_effective_date DATE
13484 ,p_business_gr_id NUMBER
13485 ,l_tax_unit_id NUMBER
13486 ,p_start_date DATE
13487 ,p_end_date DATE
13488 ,p_payroll_type VARCHAR2) IS
13489 --
13490 CURSOR csr_action_info(c_category VARCHAR2
13491 ,c_type VARCHAR2
13492 ,c_assignment_id NUMBER) IS
13493 SELECT pai.*
13494 FROM pay_action_interlocks pal
13495 ,pay_action_information pai
13496 WHERE pal.locking_action_id = p_assactid
13497 AND pal.locked_action_id = pai.action_context_id
13498 AND pai.action_context_type = 'AAP'
13499 AND pai.action_information_category = c_category
13500 AND pai.assignment_id = c_assignment_id
13501 AND pai.action_information1 = c_type
13502 ORDER BY pai.effective_date DESC;
13503 --
13504 CURSOR csr_get_income_start_date(c_assactid NUMBER
13505 ,c_assignment_id NUMBER) IS
13506 SELECT MIN(fnd_date.canonical_to_date(action_information5))
13507 FROM pay_action_interlocks pal
13508 ,pay_action_information pai
13509 WHERE pal.locking_action_id = c_assactid
13510 AND pal.locked_action_id = pai.action_context_id
13511 AND pai.action_context_type = 'AAP'
13512 AND pai.action_information_category = 'NL_WR_INCOME_PERIOD'
13513 AND pai.assignment_id = c_assignment_id
13514 AND pai.action_information1 = 'INITIAL';
13515 --
13516 CURSOR csr_get_sector_start_date(c_assactid NUMBER
13517 ,c_assignment_id NUMBER
13518 ,c_sector VARCHAR2
13519 ,c_risk_grp VARCHAR2) IS
13520 SELECT MIN(fnd_date.canonical_to_date(action_information5))
13521 FROM pay_action_interlocks pal
13522 ,pay_action_information pai
13523 WHERE pal.locking_action_id = c_assactid
13524 AND pal.locked_action_id = pai.action_context_id
13525 AND pai.action_context_type = 'AAP'
13526 AND pai.action_information_category = 'NL_WR_SWMF_SECTOR_RISK_GROUP'
13527 AND pai.assignment_id = c_assignment_id
13528 AND pai.action_information1 = 'SECTOR_RISK_GROUP'
13529 AND pai.action_information7 = c_sector
13530 AND pai.action_information8 = c_risk_grp;
13531 --
13532 CURSOR csr_exception_info(c_category VARCHAR2
13533 ,c_assactid NUMBER) IS
13534 SELECT pai.*
13535 FROM pay_action_information pai
13536 WHERE pai.action_context_id = c_assactid
13537 AND pai.action_context_type = 'AAP'
13538 AND pai.action_information_category = c_category;
13539 --
13540 CURSOR csr_ip_srg_info(c_category VARCHAR2
13541 ,c_type VARCHAR2
13542 ,c_actinfid NUMBER) IS
13543 SELECT pai.*
13544 FROM pay_action_information pai
13545 WHERE pai.action_context_type = 'AAP'
13546 AND pai.action_information2 = fnd_number.number_to_canonical(c_actinfid)
13547 AND pai.action_information_category = c_category
13548 AND pai.action_information1 = c_type ;
13549 --
13550 CURSOR csr_address_info(c_category VARCHAR2
13551 ,c_type VARCHAR2
13552 ,c_actinfid NUMBER
13553 ,c_action_context_id NUMBER) IS
13554 SELECT pai.*
13555 FROM pay_action_information pai
13556 WHERE pai.action_context_type = 'AAP'
13557 AND pai.action_information27 = fnd_number.number_to_canonical(c_actinfid)
13558 AND pai.action_context_id = c_action_context_id
13559 AND pai.action_information_category = c_category
13560 AND pai.action_information26 = c_type ;
13561 --
13562 CURSOR csr_nominative_info(c_category VARCHAR2
13563 ,c_type VARCHAR2
13564 ,c_assactid NUMBER) IS
13565 select sum(fnd_number.canonical_to_number(pai.action_information5)) sum5
13566 ,sum(fnd_number.canonical_to_number(pai.action_information6)) sum6
13567 ,sum(fnd_number.canonical_to_number(pai.action_information7)) sum7
13568 ,sum(fnd_number.canonical_to_number(pai.action_information8)) sum8
13569 ,sum(fnd_number.canonical_to_number(pai.action_information9)) sum9
13570 ,sum(fnd_number.canonical_to_number(pai.action_information10)) sum10
13571 ,sum(fnd_number.canonical_to_number(pai.action_information11)) sum11
13572 ,sum(fnd_number.canonical_to_number(pai.action_information12)) sum12
13573 ,sum(fnd_number.canonical_to_number(pai.action_information13)) sum13
13574 ,sum(fnd_number.canonical_to_number(pai.action_information14)) sum14
13575 ,sum(fnd_number.canonical_to_number(pai.action_information15)) sum15
13576 ,sum(fnd_number.canonical_to_number(pai.action_information16)) sum16
13577 ,sum(fnd_number.canonical_to_number(pai.action_information17)) sum17
13578 ,sum(fnd_number.canonical_to_number(pai.action_information18)) sum18
13579 ,sum(fnd_number.canonical_to_number(pai.action_information19)) sum19
13580 ,sum(fnd_number.canonical_to_number(pai.action_information20)) sum20
13581 ,sum(fnd_number.canonical_to_number(pai.action_information21)) sum21
13582 ,sum(fnd_number.canonical_to_number(pai.action_information22)) sum22
13583 ,sum(fnd_number.canonical_to_number(pai.action_information23)) sum23
13584 ,sum(fnd_number.canonical_to_number(pai.action_information24)) sum24
13585 ,sum(fnd_number.canonical_to_number(pai.action_information25)) sum25
13586 ,sum(fnd_number.canonical_to_number(pai.action_information26)) sum26
13587 ,sum(fnd_number.canonical_to_number(pai.action_information27)) sum27
13588 ,sum(fnd_number.canonical_to_number(pai.action_information28)) sum28
13589 ,sum(fnd_number.canonical_to_number(pai.action_information29)) sum29
13590 ,sum(fnd_number.canonical_to_number(pai.action_information30)) sum30
13591 from pay_action_interlocks pal
13592 ,pay_action_information pai
13593 where pal.locking_action_id = c_assactid
13594 AND pal.locked_action_id = pai.action_context_id
13595 AND pai.action_context_type = 'AAP'
13596 AND pai.action_information_category = c_category
13597 AND pai.action_information1 = c_type ;
13598 --
13599 l_ovn pay_action_information.object_version_number%TYPE;
13600 l_action_info_id pay_action_information.action_information_id%TYPE;
13601 l_master_action_info_id pay_action_information.action_information_id%TYPE;
13602 l_empt_action_info_id pay_action_information.action_information_id%TYPE;
13603 l_action_context_id pay_action_information.action_context_id%TYPE;
13604 l_date DATE;
13605 --
13606 BEGIN
13607 --
13608 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN ARCHIVE_CODE');
13609 --
13610 FOR csr_action_info_rec IN csr_action_info('NL_WR_EMPLOYMENT_INFO','INITIAL',p_assignment_id) LOOP
13611 --
13612 l_empt_action_info_id := csr_action_info_rec.action_information_id;
13613 l_action_context_id := csr_action_info_rec.action_context_id;
13614 --
13615 pay_action_information_api.create_action_information (
13616 p_action_information_id => l_master_action_info_id
13617 ,p_action_context_id => p_assactid
13618 ,p_action_context_type => 'AAP'
13619 ,p_object_version_number => l_ovn
13620 ,p_assignment_id => csr_action_info_rec.assignment_id
13621 ,p_effective_date => p_effective_date
13622 ,p_source_id => NULL
13623 ,p_source_text => NULL
13624 ,p_tax_unit_id => l_tax_unit_id
13625 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
13626 ,p_action_information1 => 'INITIAL'
13627 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(p_start_date,trunc(p_end_date,'Y')))
13628 ,p_action_information3 => fnd_date.date_to_canonical(p_end_date)
13629 ,p_action_information4 => csr_action_info_rec.action_information4
13630 ,p_action_information5 => csr_action_info_rec.action_information5
13631 ,p_action_information6 => csr_action_info_rec.action_information6
13632 ,p_action_information7 => csr_action_info_rec.action_information7
13633 ,p_action_information8 => csr_action_info_rec.action_information8
13634 ,p_action_information9 => csr_action_info_rec.action_information9
13635 ,p_action_information10 => csr_action_info_rec.action_information10
13636 ,p_action_information11 => csr_action_info_rec.action_information11
13637 ,p_action_information12 => csr_action_info_rec.action_information12
13638 ,p_action_information13 => csr_action_info_rec.action_information13
13639 ,p_action_information14 => csr_action_info_rec.action_information14
13640 ,p_action_information15 => csr_action_info_rec.action_information15
13641 ,p_action_information16 => csr_action_info_rec.action_information16
13642 ,p_action_information17 => csr_action_info_rec.action_information17
13643 ,p_action_information18 => csr_action_info_rec.action_information18);
13644 --
13645 FOR csr_exception_info_rec IN csr_exception_info('NL_WR_EXCEPTION_REPORT',csr_action_info_rec.action_context_id) LOOP
13646 pay_action_information_api.create_action_information
13647 (
13648 p_action_information_id => l_action_info_id
13649 , p_action_context_id => p_assactid
13650 , p_action_context_type => 'AAP'
13651 , p_object_version_number => l_ovn
13652 , p_assignment_id => p_assignment_id
13653 , p_effective_date => p_effective_date
13654 , p_source_id => NULL
13655 , p_source_text => NULL
13656 , p_tax_unit_id => l_tax_unit_id
13657 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
13658 , p_action_information4 => csr_exception_info_rec.action_information4
13659 , p_action_information5 => csr_exception_info_rec.action_information5
13660 , p_action_information6 => csr_exception_info_rec.action_information6
13661 , p_action_information7 => csr_exception_info_rec.action_information7
13662 , p_action_information8 => csr_exception_info_rec.action_information8);
13663 END LOOP;
13664 --
13665 EXIT;
13666 --
13667 END LOOP;
13668 --
13669 FOR csr_ip_info_rec IN csr_ip_srg_info('NL_WR_INCOME_PERIOD','INITIAL',l_empt_action_info_id) LOOP
13670 --
13671 OPEN csr_get_income_start_date(p_assactid,p_assignment_id);
13672 FETCH csr_get_income_start_date INTO l_date;
13673 CLOSE csr_get_income_start_date;
13674 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN NL_WR_INCOME_PERIOD');
13675 --Fnd_file.put_line(FND_FILE.LOG,'~~## l_empt_action_info_id '||l_empt_action_info_id);
13676 pay_action_information_api.create_action_information (
13677 p_action_information_id => l_action_info_id
13678 ,p_action_context_id => p_assactid
13679 ,p_action_context_type => 'AAP'
13680 ,p_object_version_number => l_ovn
13681 ,p_assignment_id => csr_ip_info_rec.assignment_id
13682 ,p_effective_date => p_effective_date
13683 ,p_source_id => NULL
13684 ,p_source_text => NULL
13685 ,p_tax_unit_id => l_tax_unit_id
13686 ,p_action_information_category => 'NL_WR_INCOME_PERIOD'
13687 ,p_action_information1 => 'INITIAL'
13688 ,p_action_information2 => fnd_number.number_to_canonical(l_master_action_info_id)
13689 ,p_action_information3 => csr_ip_info_rec.action_information3
13690 ,p_action_information4 => csr_ip_info_rec.action_information4
13691 ,p_action_information5 => fnd_date.date_to_canonical(l_date) --fnd_date.date_to_canonical(p_start_date)
13692 ,p_action_information6 => csr_ip_info_rec.action_information6
13693 ,p_action_information7 => csr_ip_info_rec.action_information7
13694 ,p_action_information8 => csr_ip_info_rec.action_information8
13695 ,p_action_information9 => csr_ip_info_rec.action_information9
13696 ,p_action_information10 => csr_ip_info_rec.action_information10
13697 ,p_action_information11 => csr_ip_info_rec.action_information11
13698 ,p_action_information12 => csr_ip_info_rec.action_information12
13699 ,p_action_information13 => csr_ip_info_rec.action_information13
13700 ,p_action_information14 => csr_ip_info_rec.action_information14
13701 ,p_action_information15 => csr_ip_info_rec.action_information15
13702 ,p_action_information16 => csr_ip_info_rec.action_information16
13703 ,p_action_information17 => csr_ip_info_rec.action_information17
13704 ,p_action_information18 => csr_ip_info_rec.action_information18
13705 ,p_action_information19 => csr_ip_info_rec.action_information19
13706 ,p_action_information20 => csr_ip_info_rec.action_information20
13707 ,p_action_information21 => csr_ip_info_rec.action_information21
13708 ,p_action_information22 => csr_ip_info_rec.action_information22
13709 ,p_action_information23 => csr_ip_info_rec.action_information23
13710 ,p_action_information24 => csr_ip_info_rec.action_information24
13711 ,p_action_information25 => csr_ip_info_rec.action_information25
13712 ,p_action_information26 => csr_ip_info_rec.action_information26
13713 ,p_action_information27 => csr_ip_info_rec.action_information27);
13714 --
13715 END LOOP;
13716 --
13717 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
13718 --
13719 OPEN csr_get_sector_start_date(p_assactid,p_assignment_id,csr_srg_info_rec.action_information7,csr_srg_info_rec.action_information8);
13720 FETCH csr_get_sector_start_date INTO l_date;
13721 CLOSE csr_get_sector_start_date;
13722 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN NL_WR_SWMF_SECTOR_RISK_GROUP');
13723 pay_action_information_api.create_action_information (
13724 p_action_information_id => l_action_info_id
13725 ,p_action_context_id => p_assactid
13726 ,p_action_context_type => 'AAP'
13727 ,p_object_version_number => l_ovn
13728 ,p_assignment_id => csr_srg_info_rec.assignment_id
13729 ,p_effective_date => p_effective_date
13730 ,p_source_id => NULL
13731 ,p_source_text => NULL
13732 ,p_tax_unit_id => l_tax_unit_id
13733 ,p_action_information_category => 'NL_WR_SWMF_SECTOR_RISK_GROUP'
13734 ,p_action_information1 => 'SECTOR_RISK_GROUP'
13735 ,p_action_information2 => fnd_number.number_to_canonical(l_master_action_info_id)
13736 ,p_action_information5 => fnd_date.date_to_canonical(l_date)--fnd_date.date_to_canonical(p_start_date)
13737 ,p_action_information6 => csr_srg_info_rec.action_information6--fnd_date.date_to_canonical(p_end_date)
13738 ,p_action_information7 => csr_srg_info_rec.action_information7
13739 ,p_action_information8 => csr_srg_info_rec.action_information8
13740 ,p_action_information9 => csr_srg_info_rec.action_information9
13741 ,p_action_information10 => csr_srg_info_rec.action_information10);
13742 --
13743 END LOOP;
13744 --
13745 FOR csr_address_info_rec IN csr_address_info('ADDRESS DETAILS','INITIAL',l_empt_action_info_id,l_action_context_id) LOOP
13746 --
13747 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN ADD Det');
13748 pay_action_information_api.create_action_information (
13749 p_action_information_id => l_action_info_id
13750 ,p_action_context_id => p_assactid
13751 ,p_action_context_type => 'AAP'
13752 ,p_object_version_number => l_ovn
13753 ,p_assignment_id => csr_address_info_rec.assignment_id
13754 ,p_effective_date => p_effective_date
13755 ,p_source_id => NULL
13756 ,p_source_text => NULL
13757 ,p_tax_unit_id => l_tax_unit_id
13758 ,p_action_information_category => 'ADDRESS DETAILS'
13759 ,p_action_information1 => csr_address_info_rec.action_information1
13760 ,p_action_information5 => csr_address_info_rec.action_information5
13761 ,p_action_information6 => csr_address_info_rec.action_information6
13762 ,p_action_information7 => csr_address_info_rec.action_information7
13763 ,p_action_information8 => csr_address_info_rec.action_information8
13764 ,p_action_information9 => csr_address_info_rec.action_information9
13765 ,p_action_information10 => csr_address_info_rec.action_information10
13766 ,p_action_information11 => csr_address_info_rec.action_information11
13767 ,p_action_information12 => csr_address_info_rec.action_information12
13768 ,p_action_information13 => csr_address_info_rec.action_information13
13769 ,p_action_information14 => csr_address_info_rec.action_information14
13770 ,p_action_information26 => 'INITIAL'
13771 ,p_action_information27 => fnd_number.number_to_canonical(l_master_action_info_id));
13772 --
13773 END LOOP;
13774 --
13775 FOR csr_nominative_info_rec IN csr_nominative_info('NL_WR_NOMINATIVE_REPORT','INITIAL',p_assactid) LOOP
13776 --
13777 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN NL_WR_NOMINATIVE_REPORT');
13778 pay_action_information_api.create_action_information (
13779 p_action_information_id => l_action_info_id
13780 ,p_action_context_id => p_assactid
13781 ,p_action_context_type => 'AAP'
13782 ,p_object_version_number => l_ovn
13783 ,p_assignment_id => p_assignment_id
13784 ,p_effective_date => p_effective_date
13785 ,p_source_id => NULL
13786 ,p_source_text => NULL
13787 ,p_tax_unit_id => l_tax_unit_id
13788 ,p_action_information_category => 'NL_WR_NOMINATIVE_REPORT'
13789 ,p_action_information1 => 'INITIAL'
13790 ,p_action_information2 => fnd_number.number_to_canonical(l_master_action_info_id)
13791 ,p_action_information3 => NULL
13792 ,p_action_information4 => NULL
13793 ,p_action_information5 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum5,2))
13794 ,p_action_information6 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum6,2))
13795 ,p_action_information7 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum7,2))
13796 ,p_action_information8 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum8,2))
13797 ,p_action_information9 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum9,2))
13798 ,p_action_information10 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum10,2))
13799 ,p_action_information11 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum11,2))
13800 ,p_action_information12 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum12,2))
13801 ,p_action_information13 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum13,2))
13802 ,p_action_information14 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum14,2))
13803 ,p_action_information15 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum15,2))
13804 ,p_action_information16 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum16,2))
13805 ,p_action_information17 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum17,2))
13806 ,p_action_information18 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum18,2))
13807 ,p_action_information19 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum19,2))
13808 ,p_action_information20 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum20,2))
13809 ,p_action_information21 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum21,2))
13810 ,p_action_information22 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum22,2))
13811 ,p_action_information23 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum23,2))
13812 ,p_action_information24 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum24,2))
13813 ,p_action_information25 => fnd_number.number_to_canonical(csr_nominative_info_rec.sum25)
13814 ,p_action_information26 => fnd_number.number_to_canonical(csr_nominative_info_rec.sum26)
13815 ,p_action_information27 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum27,2))
13816 ,p_action_information28 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum28,2))
13817 ,p_action_information29 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum29,2))
13818 ,p_action_information30 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum30,2)));
13819 --
13820 END LOOP;
13821 --
13822 FOR csr_nominative_info_rec IN csr_nominative_info('NL_WR_NOMINATIVE_REPORT_ADD','INITIAL',p_assactid) LOOP
13823 --
13824 --Fnd_file.put_line(FND_FILE.LOG,'~~## IN NL_WR_NOMINATIVE_REPORT');
13825 pay_action_information_api.create_action_information (
13826 p_action_information_id => l_action_info_id
13827 ,p_action_context_id => p_assactid
13828 ,p_action_context_type => 'AAP'
13829 ,p_object_version_number => l_ovn
13830 ,p_assignment_id => p_assignment_id
13831 ,p_effective_date => p_effective_date
13832 ,p_source_id => NULL
13833 ,p_source_text => NULL
13834 ,p_tax_unit_id => l_tax_unit_id
13835 ,p_action_information_category => 'NL_WR_NOMINATIVE_REPORT_ADD'
13836 ,p_action_information1 => 'INITIAL'
13837 ,p_action_information2 => fnd_number.number_to_canonical(l_master_action_info_id)
13838 ,p_action_information3 => NULL
13839 ,p_action_information4 => NULL
13840 ,p_action_information5 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum5,2))
13841 ,p_action_information6 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum6,2))
13842 ,p_action_information7 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum7,2))
13843 ,p_action_information8 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum8,2))
13844 ,p_action_information9 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum9,2))
13845 ,p_action_information10 => fnd_number.number_to_canonical(ROUND(csr_nominative_info_rec.sum10,2)));
13846 --
13847 END LOOP;
13848 --
13849 END archive_consolidate;
13850 --------------------------------------------------------------------------------
13851 -- POPULATE_NOM_BALNC_VAL_YRLY
13852 --------------------------------------------------------------------------------
13853 PROCEDURE populate_nom_balnc_val_yrly(p_master_assignment_action_id NUMBER
13854 ,p_assignment_action_id NUMBER
13855 ,p_effective_date DATE
13856 ,p_tax_unit_id NUMBER
13857 ,p_type VARCHAR2
13858 ,p_record_type VARCHAR2
13859 ,p_corr_used IN OUT NOCOPY VARCHAR2
13860 ,p_balance_values IN OUT NOCOPY Bal_Value) IS --SR2
13861 --
13862 l_balance_date DATE;
13863 l_context_id NUMBER;
13864 l_source_text VARCHAR2(50);
13865 l_source_text2 VARCHAR2(50);
13866 l_assignment_action_id NUMBER;
13867 l_context VARCHAR2(1);
13868 l_tax_unit_id NUMBER;
13869 --
13870 CURSOR cur_act_contexts(p_context_name VARCHAR2 )IS
13871 SELECT ffc.context_id
13872 FROM ff_contexts ffc
13873 WHERE ffc.context_name = p_context_name;
13874 --
13875 BEGIN
13876 --
13877 p_balance_values.delete;
13878 FOR i IN g_nom_bal_def_table.FIRST..g_nom_bal_def_table.LAST LOOP
13879 p_balance_values(i).balance_value := 0;
13880 /*IF g_nom_bal_def_table(i).database_item_suffix IS NOT NULL THEN
13881 g_nom_bal_def_table(i).defined_balance_id := get_defined_balance_id(g_nom_bal_def_table(i).balance_name
13882 ,g_nom_bal_def_table(i).database_item_suffix);
13883 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);
13884 END IF;*/
13885 IF g_nom_bal_def_table(i).defined_balance_id <> 0 THEN
13886 Fnd_file.put_line(FND_FILE.LOG,'#### Point 1');
13887 l_assignment_action_id := p_assignment_action_id;
13888 l_context := 'N';
13889 l_balance_date := NULL;
13890 l_context_id := NULL;
13891 l_source_text := NULL;
13892 l_source_text2 := NULL;
13893 l_tax_unit_id := p_tax_unit_id;
13894 --
13895 IF g_nom_bal_def_table(i).database_item_suffix LIKE '%/_SIT/_%' ESCAPE '/' THEN
13896 OPEN cur_act_contexts('SOURCE_TEXT');
13897 FETCH cur_act_contexts INTO l_context_id;
13898 CLOSE cur_act_contexts;
13899 l_source_text := g_nom_bal_def_table(i).context_val;
13900 l_context := 'Y';
13901 END IF;
13902 --
13903 Fnd_file.put_line(FND_FILE.LOG,'#### p_assignment_action_id '||p_assignment_action_id);
13904 IF p_assignment_action_id = 0 OR p_assignment_action_id is NULL THEN
13905 p_balance_values(i).balance_value := 0;
13906 ELSE
13907 IF l_context = 'Y' THEN
13908 BEGIN
13909 Fnd_file.put_line(FND_FILE.LOG,'#### Point 2');
13910 p_balance_values(i).balance_value := pay_balance_pkg.get_value
13911 (p_defined_balance_id => g_nom_bal_def_table(i).defined_balance_id
13912 ,p_assignment_action_id => l_assignment_action_id
13913 ,p_tax_unit_id => p_tax_unit_id
13914 ,p_jurisdiction_code => NULL
13915 ,p_source_id => l_context_id
13916 ,p_source_text => l_source_text
13917 ,p_tax_group => NULL
13918 ,p_date_earned => NULL
13919 ,p_get_rr_route => NULL
13920 ,p_get_rb_route => NULL
13921 ,p_source_text2 => l_source_text2
13922 ,p_source_number => NULL
13923 ,p_time_def_id => NULL
13924 ,p_balance_date => l_balance_date
13925 ,p_payroll_id => NULL);
13926 Fnd_file.put_line(FND_FILE.LOG,'#########p_balance_values(i).balance_value'||p_balance_values(i).balance_value);
13927 EXCEPTION
13928 WHEN OTHERS THEN
13929 p_balance_values(i).balance_value := 0;
13930 END;
13931 ELSE
13932 BEGIN
13933 Fnd_file.put_line(FND_FILE.LOG,'#### Point 3');
13934 p_balance_values(i).balance_value := pay_balance_pkg.get_value
13935 (p_defined_balance_id => g_nom_bal_def_table(i).defined_balance_id
13936 ,p_assignment_action_id => l_assignment_action_id
13937 ,p_tax_unit_id => p_tax_unit_id
13938 ,p_jurisdiction_code => NULL
13939 ,p_source_id => NULL
13940 ,p_source_text => NULL
13941 ,p_tax_group => NULL
13942 ,p_date_earned => NULL
13943 ,p_get_rr_route => NULL
13944 ,p_get_rb_route => NULL
13945 ,p_source_text2 => NULL
13946 ,p_source_number => NULL
13947 ,p_time_def_id => NULL
13948 ,p_balance_date => NULL
13949 ,p_payroll_id => NULL);
13950 Fnd_file.put_line(FND_FILE.LOG,'#########'||p_balance_values(i).balance_value);
13951 EXCEPTION
13952 WHEN OTHERS THEN
13953 p_balance_values(i).balance_value := 0;
13954 END;
13955 END IF;
13956 END IF;
13957 END IF;
13958 END LOOP;
13959 --
13960 END populate_nom_balnc_val_yrly;
13961 --------------------------------------------------------------------------------
13962 -- ARCHIVE_YEAR_END
13963 --------------------------------------------------------------------------------
13964 PROCEDURE archive_year_end(p_assactid NUMBER
13965 ,p_assignment_id NUMBER
13966 ,p_effective_date DATE
13967 ,p_business_gr_id NUMBER
13968 ,p_tax_unit_id NUMBER
13969 ,p_chk_start_date DATE
13970 ,p_chk_end_date DATE
13971 ,p_payroll_type VARCHAR2) IS
13972
13973
13974 CURSOR csr_get_emp_data(c_assignment_id NUMBER
13975 ,c_effective_date DATE) IS
13976 SELECT pap.person_id
13977 ,pap.national_identifier sofi_number
13978 ,pap.employee_number
13979 ,pap.nationality
13980 ,pap.date_of_birth dob
13981 ,pap.pre_name_adjunct prefix
13982 ,pap.last_name
13983 ,UPPER(replace(replace(pap.per_information1,'.',''),' ','')) initials
13984 ,decode(pap.sex,'M',1,'F',2,NULL) gender
13985 ,paaf.assignment_id
13986 ,paaf.change_reason
13987 ,paaf.assignment_number
13988 ,paaf.assignment_sequence
13989 ,paaf.employment_category
13990 ,paaf.employee_category
13991 ,paaf.collective_agreement_id
13992 ,paaf.effective_start_date
13993 ,paaf.soft_coding_keyflex_id
13994 ,paaf.assignment_status_type_id
13995 ,paaf.payroll_id
13996 ,paaf.primary_flag
13997 FROM per_all_assignments_f paaf
13998 ,per_all_people_f pap
13999 WHERE paaf.assignment_id = c_assignment_id
14000 AND paaf.person_id = pap.person_id
14001 AND c_effective_date BETWEEN paaf.effective_start_date
14002 AND paaf.effective_end_date
14003 AND c_effective_date BETWEEN pap.effective_start_date
14004 AND pap.effective_end_date;
14005 --
14006 CURSOR csr_get_cao_code(c_collective_agreement_id NUMBER) IS
14007 SELECT pca.cag_information1
14008 FROM per_collective_agreements pca
14009 WHERE pca.collective_agreement_id = c_collective_agreement_id
14010 AND pca.cag_information_category= 'NL';
14011 --
14012 CURSOR csr_get_assignment_action_id(c_assignment_id NUMBER
14013 ,c_date DATE) IS
14014 SELECT max(paa.assignment_action_id) assignment_action_id
14015 FROM pay_assignment_actions paa
14016 ,pay_payroll_actions ppa
14017 ,per_time_periods ptp
14018 WHERE paa.assignment_id = c_assignment_id
14019 AND ppa.payroll_action_id = paa.payroll_action_id
14020 AND ppa.action_type IN ('R','Q')
14021 AND paa.ACTION_STATUS IN ('C','S') -- 10228241
14022 AND ppa.ACTION_STATUS = 'C'
14023 --AND ppa.date_earned between c_start_date AND c_end_date;
14024 AND ppa.time_period_id = ptp.time_period_id
14025 AND c_date BETWEEN ptp.start_date AND ptp.end_date;
14026 --
14027 CURSOR csr_get_assignment_action_id2(c_assignment_id NUMBER
14028 ,c_date DATE
14029 ,c_end_date DATE) IS
14030 SELECT --max(paa.assignment_action_id) assignment_action_id
14031 fnd_number.canonical_to_number(substr(max(lpad(NVL(paa.action_sequence,0),15,'0')||paa.assignment_action_id),16)) assignment_action_id --11731857
14032 FROM pay_assignment_actions paa
14033 ,pay_payroll_actions ppa
14034 ,per_time_periods ptp
14035 WHERE paa.assignment_id = c_assignment_id
14036 AND ppa.payroll_action_id = paa.payroll_action_id
14037 AND ppa.action_type IN ('R','Q','I','B')
14038 AND paa.ACTION_STATUS IN ('C','S') -- 10228241
14039 AND ppa.ACTION_STATUS = 'C'
14040 -- AND ppa.date_earned between c_start_date AND c_end_date;
14041 AND ppa.time_period_id = ptp.time_period_id
14042 AND ptp.end_date BETWEEN c_date AND c_end_date;
14043 --
14044 CURSOR csr_get_shared_types(c_code VARCHAR2
14045 ,c_business_gr_id NUMBER
14046 ,c_lookup VARCHAR2) IS
14047 SELECT business_group_id,system_type_cd
14048 FROM per_shared_types
14049 WHERE lookup_type = c_lookup --'NL_NATIONALITY'
14050 AND information1 = c_code
14051 AND (business_group_id = c_business_gr_id
14052 OR business_group_id is NULL)
14053 ORDER BY 1;
14054 --
14055 CURSOR csr_get_period(c_payroll_id NUMBER,c_date DATE) IS
14056 SELECT ptp.start_date,ptp.end_date
14057 FROM per_time_periods ptp
14058 WHERE ptp.payroll_id = c_payroll_id
14059 AND c_date between ptp.start_date and ptp.end_date;
14060 --
14061 CURSOR csr_get_element_det(c_element_name VARCHAR2
14062 ,c_input_val_name VARCHAR2
14063 ,c_assignment_id NUMBER
14064 ,c_eff_date DATE) IS
14065 SELECT peev.screen_entry_value
14066 FROM pay_element_types_f pet
14067 ,pay_input_values_f piv
14068 ,pay_element_entries_f peef
14069 ,pay_element_entry_values_f peev
14070 WHERE pet.element_name = c_element_name
14071 AND pet.element_type_id = piv.element_type_id
14072 AND piv.name = c_input_val_name
14073 AND pet.legislation_code = 'NL'
14074 AND piv.legislation_code = 'NL'
14075 AND peef.assignment_id = c_assignment_id
14076 AND peef.element_entry_id = peev.element_entry_id
14077 AND peef.element_type_id = pet.element_type_id
14078 AND peev.input_value_id = piv.input_value_id
14079 AND c_eff_date BETWEEN piv.effective_start_date
14080 AND piv.effective_end_date
14081 AND c_eff_date BETWEEN pet.effective_start_date
14082 AND pet.effective_end_date
14083 AND c_eff_date BETWEEN peev.effective_start_date
14084 AND peev.effective_end_date
14085 AND c_eff_date BETWEEN peef.effective_start_date
14086 AND peef.effective_end_date;
14087 --
14088 CURSOR csr_get_element_name2(c_element_entry_value_id NUMBER
14089 ,c_eff_date DATE) IS
14090 SELECT pet.element_name
14091 ,peev.screen_entry_value
14092 FROM pay_element_types_f pet
14093 ,pay_element_entries_f peef
14094 ,pay_element_entry_values_f peev
14095 WHERE peev.element_entry_value_id = c_element_entry_value_id
14096 AND peev.element_entry_id = peef.element_entry_id
14097 AND peef.element_type_id = pet.element_type_id
14098 AND pet.legislation_code = 'NL'
14099 AND c_eff_date BETWEEN pet.effective_start_date
14100 AND pet.effective_end_date
14101 AND c_eff_date BETWEEN peev.effective_start_date
14102 AND peev.effective_end_date
14103 AND c_eff_date BETWEEN peef.effective_start_date
14104 AND peef.effective_end_date;
14105 --
14106 CURSOR csr_get_element_name1(c_element_entry_id NUMBER
14107 ,c_eff_date DATE) IS
14108 SELECT pet.element_name
14109 ,peev.screen_entry_value
14110 FROM pay_element_types_f pet
14111 ,pay_element_entries_f peef
14112 ,pay_element_entry_values_f peev
14113 WHERE peef.element_entry_id = c_element_entry_id
14114 AND peev.element_entry_id = peef.element_entry_id
14115 AND peef.element_type_id = pet.element_type_id
14116 AND pet.legislation_code = 'NL'
14117 AND c_eff_date BETWEEN pet.effective_start_date
14118 AND pet.effective_end_date
14119 AND c_eff_date BETWEEN peev.effective_start_date
14120 AND peev.effective_end_date
14121 AND c_eff_date BETWEEN peef.effective_start_date
14122 AND peef.effective_end_date; /*assuming one input value*/
14123 --
14124 CURSOR csr_get_eit_cao(c_assignment_id NUMBER) IS
14125 SELECT aei_information5
14126 FROM per_assignment_extra_info
14127 WHERE assignment_id = c_assignment_id
14128 AND aei_information_category IN ('NL_CADANS_INFO');
14129 --
14130 CURSOR csr_ass_start_date(c_assignment_id NUMBER) IS
14131 SELECT min(effective_start_date)
14132 --,decode(max(effective_end_date),to_date('31-12-4712','dd-mm-yyyy'),null,max(effective_end_date))
14133 FROM per_all_assignments_F paaf
14134 ,PER_ASSIGNMENT_STATUS_TYPES ast
14135 WHERE paaf.assignment_id = c_assignment_id
14136 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
14137 AND ast.per_system_status = 'ACTIVE_ASSIGN';
14138 --
14139 CURSOR csr_ass_end_date(c_assignment_id NUMBER) IS
14140 SELECT decode(max(effective_end_date),to_date('31-12-4712','dd-mm-yyyy'),null,max(effective_end_date))
14141 FROM per_all_assignments_F paaf
14142 ,PER_ASSIGNMENT_STATUS_TYPES ast
14143 WHERE paaf.assignment_id = c_assignment_id
14144 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
14145 AND ast.per_system_status <> 'TERM_ASSIGN';
14146 --
14147 CURSOR csr_ass_end_date2(c_assignment_id NUMBER) IS
14148 SELECT min(effective_start_date)
14149 FROM per_all_assignments_F paaf
14150 ,PER_ASSIGNMENT_STATUS_TYPES ast
14151 WHERE paaf.assignment_id = c_assignment_id
14152 AND paaf.assignment_status_type_id = ast.assignment_status_type_id
14153 AND ast.per_system_status = 'TERM_ASSIGN';
14154 --
14155 -- /*LC 2010 */ begin
14156 CURSOR csr_get_small_job_detail(c_assignment_action_id NUMBER
14157 ,c_eff_date DATE) IS
14158 SELECT prrv.result_value
14159 FROM pay_run_result_values prrv
14160 ,pay_input_values_f piv
14161 ,pay_element_types_f pet
14162 ,pay_run_results prr
14163 WHERE pet.element_name = 'Small Job Indicator'
14164 AND pet.element_type_id = piv.element_type_id
14165 AND piv.name = 'Exempt Small Jobs'
14166 AND pet.legislation_code = 'NL'
14167 AND piv.legislation_code = 'NL'
14168 AND prrv.input_value_id = piv.input_value_id
14169 AND prr.run_result_id = prrv.run_result_id
14170 AND prr.element_type_id = pet.element_type_id
14171 AND prr.assignment_action_id = c_assignment_action_id
14172 AND prr.status in ('P','PA')
14173 AND c_eff_date BETWEEN piv.effective_start_date
14174 AND piv.effective_end_date
14175 AND c_eff_date BETWEEN pet.effective_start_date
14176 AND pet.effective_end_date;
14177
14178 CURSOR csr_get_other_assignments(c_assg_id NUMBER
14179 ,c_start_date DATE
14180 ,c_end_date DATE
14181 ,c_business_group_id NUMBER
14182 ,c_tax_unit_id NUMBER) IS
14183 SELECT distinct asl.assignment_id assignment_id
14184 FROM per_all_assignments_f asl
14185 ,per_all_assignments_f asl2
14186 ,pay_payroll_actions ppa
14187 ,pay_assignment_actions paa
14188 ,per_time_periods ptp
14189 WHERE asl.person_id = asl2.person_id
14190 AND asl2.assignment_id = c_assg_id
14191 AND ppa.payroll_id = asl.payroll_id
14192 AND ppa.action_type in ('R','Q')
14193 AND ppa.action_status = 'C'
14194 AND paa.source_action_id IS NULL
14195 AND paa.tax_unit_id = c_tax_unit_id
14196 AND ppa.business_group_id = c_business_group_id
14197 AND ppa.time_period_id = ptp.time_period_id
14198 AND to_char(ptp.end_date,'RRRR') = to_char(c_start_date,'RRRR')
14199 AND ppa.payroll_action_id = paa.payroll_action_id
14200 AND paa.assignment_id = asl.assignment_id
14201 AND asl.effective_start_date <= c_end_date
14202 AND asl.effective_end_date >= c_start_date;
14203 -- /*LC 2010 */ end
14204 /* 8328995 */
14205 cursor csr_numiv_override(p_asg_id number) is
14206 select aei_information1 NUMIV_OVERRIDE
14207 from per_assignment_extra_info
14208 where assignment_id = p_asg_id
14209 and aei_information_category = 'NL_NUMIV_OVERRIDE';
14210 l_numiv_override NUMBER;
14211
14212 --soft_coding_keyflex_id
14213 l_nationality per_shared_types.INFORMATION1%type;
14214 l_assignment_catg per_shared_types.INFORMATION1%type;
14215 l_assignment_catg_old per_shared_types.INFORMATION1%type;
14216 l_emp_rec csr_get_emp_data%rowtype;
14217 l_rec_changes Rec_Changes;
14218 l_rec_changes_init Rec_Changes;
14219 l_master_action_info_id pay_action_information.action_information_id%type;
14220 l_action_info_id pay_action_information.action_information_id%TYPE;
14221 l_period_start_date DATE;
14222 l_period_end_date DATE;
14223 l_rec_start_date DATE;
14224 l_emp_end_date DATE;
14225 -- SCL Segment variables
14226 l_income_code hr_soft_coding_keyflex.segment1%type;
14227 l_work_pattern hr_soft_coding_keyflex.segment1%type;
14228 l_wage_tax_discount hr_soft_coding_keyflex.segment1%type;
14229 l_wage_tax_table hr_soft_coding_keyflex.segment1%type;
14230 l_wage_aow hr_soft_coding_keyflex.segment1%type;
14231 l_wage_wajong hr_soft_coding_keyflex.segment1%type;
14232 l_emp_loan hr_soft_coding_keyflex.segment1%type;
14233 l_transportation hr_soft_coding_keyflex.segment1%type;
14234 --
14235 l_labour_rel_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
14236 l_ins_duty_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
14237 l_FZ_Code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
14238 l_handicapped_code PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
14239 l_wao_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
14240 l_ww_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
14241 l_zw_insured PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
14242 l_zvw_situation PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;
14243 l_zvw_defaulted VARCHAR2(1);
14244 l_zvw_small_jobs VARCHAR2(1);/* LC 2010*/
14245 l_marginal_empl PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;/* LC 2010*/
14246 l_wm_old_rule PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;/* LC 2010*/
14247 l_temp_tax_discount PER_ASSIGNMENT_EXTRA_INFO.AEI_INFORMATION1%type;/* LC 2013*/
14248 --
14249 l_small_job pay_run_result_values.result_value%TYPE; /*LC 2010*/
14250 l_assg_small_job pay_run_result_values.result_value%TYPE; /*LC 2010*/
14251 --
14252 l_assignment_id NUMBER;
14253 l_chk VARCHAR2(2);
14254 p_date DATE;
14255 l_retro VARCHAR2(10);
14256 l_type VARCHAR2(10);
14257 l_ovn pay_action_information.object_version_number%type;
14258 l_cao_code per_collective_agreements.CAG_INFORMATION1%type;
14259 l_old_cao_code per_collective_agreements.CAG_INFORMATION1%type;
14260 l_bal_value Bal_Value;
14261 l_nom_bal_value Bal_Value;
14262 l_ret_table Ret_Table;
14263 l_assignment_action_id NUMBER;
14264 l_master_assignment_action_id NUMBER;
14265 l_other_assignment_action_id NUMBER; /*LC 2010*/
14266 ele_end_date DATE;
14267 l_bg NUMBER;
14268 l_table1 pay_dated_tables.dated_table_id%type;
14269 l_table2 pay_dated_tables.dated_table_id%type;
14270 l_table3 pay_dated_tables.dated_table_id%type;
14271 l_ass_start_date DATE;
14272 l_ass_end_date DATE;
14273 --
14274 l_holiday_coupen pay_element_entry_values_f.screen_entry_value%TYPE;
14275 l_income_increase pay_element_entry_values_f.screen_entry_value%TYPE;
14276 l_add_allowance pay_element_entry_values_f.screen_entry_value%TYPE;
14277 l_company_car_use pay_element_entry_values_f.screen_entry_value%TYPE;
14278 l_val pay_element_entry_values_f.screen_entry_value%TYPE;
14279 l_element_name VARCHAR2(30);
14280 --
14281 l_cnt1 NUMBER;
14282 l_cnt2 NUMBER;
14283 l_cnt3 NUMBER;
14284 --
14285 l_srg_flag VARCHAR2(1);
14286 l_corr_used VARCHAR2(1);
14287 --
14288 CURSOR get_scl_id(c_assignment_id NUMBER
14289 ,c_start_date DATE) IS
14290 SELECT paaf.soft_coding_keyflex_id
14291 FROM per_all_assignments_f paaf
14292 WHERE assignment_id = c_assignment_id
14293 AND c_start_date BETWEEN paaf.effective_start_date
14294 AND paaf.effective_end_date;
14295 --
14296 CURSOR csr_get_col_agreement_id (c_assignment_id NUMBER
14297 ,c_eff_date DATE) IS
14298 SELECT collective_agreement_id
14299 FROM per_All_assignments_F
14300 WHERE assignment_id = c_assignment_id
14301 AND c_eff_date BETWEEN effective_start_date AND effective_end_date;
14302 --
14303 --
14304 l_asg_id NUMBER;
14305 l_pay_act_id NUMBER;
14306 --
14307 l_scl_id per_all_assignments_f.soft_coding_keyflex_id%TYPE;
14308 --
14309 l_initial_flag VARCHAR2(1);
14310 l_emp_seq per_all_Assignments_f.assignment_number%type;
14311 --
14312 l_num_over_clash NUMBER:=0; /* 9764359 */
14313 BEGIN
14314 --Fnd_file.put_line(FND_FILE.LOG,' Start chk_events');
14315 --Fnd_file.put_line(FND_FILE.LOG,' Assignment ID :'||p_assignment_id);
14316 l_assignment_id := p_assignment_id;
14317 --
14318 OPEN csr_ass_start_date(l_assignment_id);
14319 FETCH csr_ass_start_date INTO l_ass_start_date;
14320 CLOSE csr_ass_start_date;
14321 --
14322 OPEN csr_ass_end_date(l_assignment_id);
14323 FETCH csr_ass_end_date INTO l_ass_end_date;
14324 CLOSE csr_ass_end_date;
14325 --
14326 l_emp_end_date := NULL;
14327 IF l_ass_end_date <= p_chk_end_date THEN
14328 l_emp_end_date := l_ass_end_date;
14329 END IF;
14330 p_date := LEAST(p_chk_end_date,NVL(l_emp_end_date,p_chk_end_date));
14331 --Fnd_file.put_line(FND_FILE.LOG,' Get employee Data on : '||p_date);
14332 OPEN csr_get_emp_data(l_assignment_id,p_date);
14333 FETCH csr_get_emp_data INTO l_emp_rec;
14334 CLOSE csr_get_emp_data;
14335 --
14336 l_emp_seq := NULL;
14337 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
14338 l_emp_seq := l_emp_rec.assignment_sequence;
14339 END IF;
14340 --
14341 IF l_emp_rec.change_reason NOT IN ('NL1','NL2','NL3','NL4','NL5','NL6') THEN
14342 l_emp_rec.change_reason := NULL;
14343 END IF;
14344 --
14345 OPEN csr_get_shared_types(l_emp_rec.nationality,p_business_gr_id,'NL_NATIONALITY');
14346 FETCH csr_get_shared_types INTO l_bg,l_nationality;
14347 CLOSE csr_get_shared_types;
14348 --
14349 l_type := 'INITIAL';
14350 /* 8328995 */
14351 l_numiv_override:=null;
14352 OPEN csr_numiv_override(p_assignment_id);
14353 FETCH csr_numiv_override INTO l_numiv_override;
14354 CLOSE csr_numiv_override;
14355
14356 pay_action_information_api.create_action_information (
14357 p_action_information_id => l_master_action_info_id
14358 ,p_action_context_id => p_assactid
14359 ,p_action_context_type => 'AAP'
14360 ,p_object_version_number => l_ovn
14361 ,p_assignment_id => l_emp_rec.assignment_id
14362 ,p_effective_date => p_effective_date
14363 ,p_source_id => NULL
14364 ,p_source_text => NULL
14365 ,p_tax_unit_id => p_tax_unit_id
14366 ,p_action_information_category => 'NL_WR_EMPLOYMENT_INFO'
14367 ,p_action_information1 => l_type
14368 ,p_action_information2 => fnd_date.date_to_canonical(GREATEST(p_chk_start_date,trunc(p_chk_end_date,'Y')))
14369 ,p_action_information3 => fnd_date.date_to_canonical(p_chk_end_date)
14370 ,p_action_information4 => l_emp_rec.assignment_number
14371 ,p_action_information5 => l_emp_rec.employee_number
14372 ,p_action_information6 => substr(l_emp_rec.change_reason,3)
14373 ,p_action_information8 => l_emp_rec.sofi_number
14374 ,p_action_information7 => l_emp_rec.person_id
14375 ,p_action_information9 => NULL -- l_emp_rec.Initials
14376 ,p_action_information10 => NULL -- l_emp_rec.prefix
14377 ,p_action_information11 => l_emp_rec.last_name
14378 ,p_action_information12 => fnd_date.date_to_canonical(l_emp_rec.dob)
14379 ,p_action_information13 => NULL -- l_nationality
14380 ,p_action_information14 => NULL -- l_emp_rec.gender
14381 ,p_action_information15 => fnd_date.date_to_canonical(l_ass_start_date)-- assignment_start_date
14382 ,p_action_information16 => fnd_date.date_to_canonical(l_ass_end_date)
14383 ,p_action_information17 => NULL
14384 ,p_action_information18 => nvl(l_numiv_override,l_emp_seq)); -- 8328995
14385
14386 /* 9764359 */
14387 --
14388 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: archive_year_end 1');
14389 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before l_num_over_clash: '|| to_char(l_num_over_clash));
14390 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before l_emp_rec.assignment_id: '|| l_emp_rec.assignment_id);
14391 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: before Sequencs: '|| nvl(l_numiv_override,l_emp_seq));
14392 l_num_over_clash:=HR_NL_ASG_EXTRA_INFO_CHECKS.ASG_CHECK_NUMIV_OVERRIDE(l_emp_rec.assignment_id,nvl(l_numiv_override,l_emp_seq));
14393 -- Fnd_file.put_line(FND_FILE.LOG,' NUMIV: After l_num_over_clash: '|| to_char(l_num_over_clash));
14394 --
14395 IF l_num_over_clash=1 THEN
14396 pay_action_information_api.create_action_information
14397 (
14398 p_action_information_id => l_action_info_id
14399 , p_action_context_id => p_assactid
14400 , p_action_context_type => 'AAP'
14401 , p_object_version_number => l_ovn
14402 , p_assignment_id => NULL
14403 , p_effective_date => p_effective_date
14404 , p_source_id => NULL
14405 , p_source_text => NULL
14406 , p_tax_unit_id => p_tax_unit_id
14407 , p_action_information_category => 'NL_WR_EXCEPTION_REPORT'
14408 , p_action_information4 => fnd_message.get_string('PER','HR_373547_NUMIV_OVERRIDE')
14409 , p_action_information5 => fnd_date.date_to_canonical(p_effective_date)
14410 , p_action_information6 => 'Num IV override Already Used'
14411 , p_action_information7 => l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
14412 , p_action_information8 => l_emp_rec.assignment_number);
14413 END IF;
14414 --
14415
14416 IF g_contract_code_mapping = 'NL_EMPLOYMENT_CATG' THEN
14417 OPEN csr_get_shared_types(l_emp_rec.employment_category,p_business_gr_id,g_contract_code_mapping);
14418 FETCH csr_get_shared_types INTO l_bg,l_assignment_catg;
14419 CLOSE csr_get_shared_types;
14420 ELSE
14421 OPEN csr_get_shared_types(l_emp_rec.employee_category,p_business_gr_id,g_contract_code_mapping);
14422 FETCH csr_get_shared_types INTO l_bg,l_assignment_catg;
14423 CLOSE csr_get_shared_types;
14424 END IF;
14425 --
14426 l_income_code := 'N';
14427 l_work_pattern := 'N';
14428 l_wage_tax_discount := 'N';
14429 l_wage_tax_table := 'N';
14430 l_wage_aow := 'N';
14431 l_wage_wajong := 'N';
14432 l_emp_loan := 'N';
14433 l_transportation := 'N';
14434 --Fnd_file.put_line(FND_FILE.LOG,' Get scl Data '||l_emp_rec.soft_coding_keyflex_id);
14435 get_scl_data(l_emp_rec.soft_coding_keyflex_id
14436 ,p_chk_end_date
14437 ,l_income_code
14438 ,l_work_pattern
14439 ,l_wage_tax_discount
14440 ,l_wage_tax_table
14441 ,l_wage_aow
14442 ,l_wage_wajong
14443 ,l_emp_loan
14444 ,l_transportation
14445 ,l_chk);
14446 --Fnd_file.put_line(FND_FILE.LOG,' Get Assignment EIT Data :'||l_assignment_id);
14447 get_assignment_extra_info(l_assignment_id -- pick data for p_date
14448 ,NULL
14449 ,p_date
14450 ,p_chk_start_date
14451 ,p_chk_end_date
14452 ,l_labour_rel_code
14453 ,l_ins_duty_code
14454 ,l_FZ_Code
14455 ,l_handicapped_code
14456 ,l_wao_insured
14457 ,l_ww_insured
14458 ,l_zw_insured
14459 ,l_zvw_situation
14460 ,l_marginal_empl /* LC 2010*/
14461 ,l_wm_old_rule /* LC 2010*/
14462 ,l_temp_tax_discount /* LC 2013*/
14463 ,l_chk);
14464 --
14465 --LC 2012 begin
14466 IF p_effective_date < TO_DATE('01012012','DDMMYYYY') THEN
14467 --LC 2010--begin
14468 l_zvw_small_jobs := NULL;
14469 l_small_job := NULL;
14470 FOR assignments IN csr_get_other_assignments(l_assignment_id
14471 ,p_chk_start_date
14472 ,p_chk_end_date
14473 ,p_business_gr_id
14474 ,p_tax_unit_id) LOOP
14475
14476 l_other_assignment_action_id := NULL;
14477 l_assg_small_job := NULL;
14478 OPEN csr_get_assignment_action_id(assignments.assignment_id,p_chk_start_date);
14479 FETCH csr_get_assignment_action_id INTO l_other_assignment_action_id;
14480 CLOSE csr_get_assignment_action_id;
14481
14482 IF l_other_assignment_action_id IS NOT NULL THEN
14483 OPEN csr_get_small_job_detail(l_other_assignment_action_id,p_date);
14484 FETCH csr_get_small_job_detail INTO l_assg_small_job;
14485 CLOSE csr_get_small_job_detail;
14486 END IF;
14487
14488 IF l_assg_small_job IS NOT NULL THEN
14489 IF l_assg_small_job = 'N' THEN
14490 l_small_job := 'N';
14491 EXIT;
14492 ELSIF (l_small_job = 'F' OR l_small_job IS NULL) AND l_assg_small_job = 'F' THEN
14493 l_small_job := 'F';
14494 END IF;
14495 END IF;
14496 END LOOP;
14497 IF l_small_job = 'F' THEN
14498 IF l_zvw_situation <> 'J' OR l_zvw_situation IS NULL THEN
14499 l_zvw_situation := 'J';
14500 l_zvw_small_jobs := 'D'; --Defaulted to J
14501 END IF;
14502 IF l_ins_duty_code <> 'F' THEN
14503 l_ins_duty_code := l_ins_duty_code||'F'; --Append F
14504 END IF;
14505 ELSIF l_small_job = 'N' AND l_zvw_situation ='J' THEN
14506 l_zvw_small_jobs := 'W'; --Warning because of J when no Small Job Excempt
14507 END IF;
14508 --LC 2010--end
14509 END IF;
14510 --LC 2012 end
14511 --
14512 l_zvw_defaulted := NULL;
14513 IF l_zvw_situation IS NULL THEN
14514 l_zvw_situation := 'A';
14515 l_zvw_defaulted := 'Y';
14516 END IF;
14517 --
14518 /*OPEN csr_get_element_det('Holiday Coupons','Receiving Coupons',l_assignment_id,p_date);
14519 FETCH csr_get_element_det INTO l_holiday_coupen;
14520 CLOSE csr_get_element_det;
14521 IF l_holiday_coupen = 'Y' THEN
14522 l_holiday_coupen := 'J';
14523 END IF;
14524 --
14525 OPEN csr_get_element_det('Incidental Income Decrease','Decrease Code',l_assignment_id,p_date);
14526 FETCH csr_get_element_det INTO l_income_increase;
14527 CLOSE csr_get_element_det;
14528 --
14529 OPEN csr_get_element_det('Additional Allowance','Receiving Allowance',l_assignment_id,p_date);
14530 FETCH csr_get_element_det INTO l_add_allowance;
14531 CLOSE csr_get_element_det;
14532 IF p_chk_end_date >= TO_DATE('01012007','DDMMYYYY') THEN
14533 l_add_allowance := NULL;
14534 ELSIF l_add_allowance = 'Y' THEN
14535 l_add_allowance := 'J';
14536 END IF; */
14537 --
14538 OPEN csr_get_element_det('Company Car Private Usage','Code Usage',l_assignment_id,p_date);
14539 FETCH csr_get_element_det INTO l_company_car_use;
14540 CLOSE csr_get_element_det;
14541 --
14542 --Fnd_file.put_line(FND_FILE.LOG,' Get Element Data :');
14543 --Fnd_file.put_line(FND_FILE.LOG,' l_company_car_use :'||l_company_car_use);
14544 --
14545 /* IF l_emp_rec.collective_agreement_id IS NULL THEN
14546 OPEN csr_get_eit_cao(l_emp_rec.assignment_id);
14547 FETCH csr_get_eit_cao INTO l_cao_code;
14548 CLOSE csr_get_eit_cao;
14549 --Fnd_file.put_line(FND_FILE.LOG,' Collective Agreement id null get from eit :'||l_cao_code);
14550 ELSE
14551 OPEN csr_get_cao_code(l_emp_rec.collective_agreement_id);
14552 FETCH csr_get_cao_code INTO l_cao_code;
14553 CLOSE csr_get_cao_code;
14554 --Fnd_file.put_line(FND_FILE.LOG,' Collective Agreement id not null get from collective agreement table. :'||l_cao_code);
14555 END IF;*/
14556
14557 pay_action_information_api.create_action_information (
14558 p_action_information_id => l_action_info_id
14559 , p_action_context_id => p_assactid
14560 , p_action_context_type => 'AAP'
14561 , p_object_version_number => l_ovn
14562 , p_assignment_id => l_emp_rec.assignment_id
14563 , p_effective_date => p_effective_date
14564 , p_action_information_category => 'NL_WR_INCOME_PERIOD'
14565 , p_tax_unit_id => p_tax_unit_id
14566 , p_action_information1 => l_type
14567 , p_action_information2 => l_master_action_info_id
14568 , p_action_information5 => fnd_date.date_to_canonical(GREATEST(GREATEST(p_chk_start_date,l_ass_start_date),trunc(p_chk_end_date,'Y')))
14569 , p_action_information6 => l_income_code
14570 , p_action_information7 => l_labour_rel_code
14571 , p_action_information8 => l_ins_duty_code
14572 , p_action_information9 => l_assignment_catg
14573 , p_action_information10 => l_FZ_Code
14574 , p_action_information11 => NULL -- l_work_pattern
14575 , p_action_information12 => NULL -- l_cao_code
14576 , p_action_information13 => l_handicapped_code
14577 , p_action_information14 => l_wage_tax_discount
14578 , p_action_information15 => l_company_car_use
14579 , p_action_information16 => l_wage_tax_table
14580 , p_action_information17 => l_wao_insured
14581 , p_action_information18 => l_ww_insured
14582 , p_action_information19 => l_zw_insured
14583 , p_action_information20 => NVL(l_zvw_situation,'A')
14584 , p_action_information21 => NULL -- l_holiday_coupen
14585 , p_action_information22 => l_wage_aow
14586 , p_action_information23 => l_wage_wajong
14587 , p_action_information24 => l_emp_loan
14588 , p_action_information25 => l_transportation
14589 , p_action_information26 => NULL -- l_income_increase
14590 , p_action_information27 => NULL -- l_add_allowance);
14591 , p_action_information28 => l_marginal_empl/* LC 2010*/
14592 , p_action_information29 => l_wm_old_rule /* LC 2010*/
14593 , p_action_information30 => l_temp_tax_discount); /* LC 2013*/
14594
14595 --Fnd_file.put_line(FND_FILE.LOG,' Creating NL_WR_EMPLOYMENT_INFO INfor Record for Type :'||l_type||' Date :'||l_period_start_date);
14596 --
14597 -- archive employee address not required for YEarly report
14598 /*archive_emp_address(p_assactid -- address not req for year end rep
14599 ,l_emp_rec.person_id
14600 ,l_emp_rec.assignment_id
14601 ,l_emp_rec.assignment_number
14602 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
14603 ,p_tax_unit_id
14604 ,l_master_action_info_id
14605 ,p_effective_date
14606 ,NVL(l_emp_end_date,p_chk_end_date)
14607 ,l_type);*/
14608 -- archive sector information for assignment
14609 --Fnd_file.put_line(FND_FILE.LOG,' Archiving Sector Risk Group Record for Type :'||l_type);
14610 l_srg_flag := archive_sector_risk_group(p_assactid
14611 ,l_emp_rec.assignment_id
14612 ,p_effective_date
14613 ,p_tax_unit_id
14614 ,l_master_action_info_id
14615 ,p_chk_start_date
14616 ,p_chk_end_date
14617 ,l_ass_start_date
14618 ,l_emp_end_date
14619 ,p_payroll_type);
14620 --archive nominative info
14621 l_assignment_action_id := NULL;
14622 OPEN csr_get_assignment_action_id2(l_emp_rec.assignment_id,p_chk_start_date,p_chk_end_date);
14623 FETCH csr_get_assignment_action_id2 INTO l_assignment_action_id;
14624 CLOSE csr_get_assignment_action_id2;
14625 Fnd_file.put_line(FND_FILE.LOG,' l_assignment_action_id in year-end:'||l_assignment_action_id); --
14626 populate_nom_balnc_val_yrly(l_assignment_action_id
14627 ,l_assignment_action_id
14628 ,l_period_end_date
14629 ,p_tax_unit_id
14630 ,l_type
14631 ,'HR'
14632 ,l_corr_used
14633 ,l_bal_value);
14634 Fnd_file.put_line(FND_FILE.LOG,' l_bal_value :'||l_bal_value(1).balance_value||','||l_bal_value(2).balance_value); --
14635 get_nominative_data(l_bal_value,l_nom_bal_value);
14636 --
14637 Fnd_file.put_line(FND_FILE.LOG,' l_nom_bal_value :'||l_nom_bal_value(1).balance_value);
14638 archive_nominative_data(p_assactid
14639 ,l_emp_rec.assignment_id
14640 ,p_tax_unit_id
14641 ,p_effective_date
14642 ,p_effective_date
14643 ,l_type
14644 ,l_master_action_info_id
14645 ,l_emp_rec.prefix || l_emp_rec.last_name || l_emp_rec.Initials
14646 ,l_corr_used
14647 ,p_payroll_type
14648 ,l_nom_bal_value
14649 ,'-9999'); --10100628
14650 EXCEPTION
14651 WHEN OTHERS THEN
14652 --Fnd_file.put_line(FND_FILE.LOG,' Others. Assignment :'||l_assignment_id);
14653 --Fnd_file.put_line(FND_FILE.LOG,'## SQLERR ' || sqlerrm(sqlcode));
14654 FND_FILE.PUT_LINE(fnd_file.output,'Exception at Assignment ID: '||l_assignment_id||' Error : '||sqlerrm(sqlcode));
14655 --NULL;--10377795
14656
14657 END archive_year_end;
14658 --------------------------------------------------------------------------------
14659 -- ARCHIVE_CODE
14660 --------------------------------------------------------------------------------
14661 PROCEDURE archive_code (p_assactid in number,
14662 p_effective_date in date) IS
14663 --
14664 l_assignment_id per_all_assignments_f.assignment_id%type;
14665 l_business_group_id NUMBER;
14666 l_pactid NUMBER;
14667 l_end_date DATE;
14668 l_start_date DATE;
14669 l_tax_unit_id NUMBER;
14670 l_payroll_type VARCHAR2(10);
14671 l_seq_no VARCHAR2(15);
14672 l_prev_corr_year VARCHAR2(100); --10100628
14673 --
14674
14675 --10100628
14676 CURSOR cur_assign ( p_assignment_id NUMBER
14677 ,p_start_date DATE
14678 ,p_end_date DATE
14679 ,p_prev_corr_year VARCHAR2)
14680 IS
14681 select max(paa.assignment_action_id) assignment_action_id, ptp.start_date, ptp.end_date
14682 from
14683 pay_payroll_actions ppa,
14684 pay_assignment_actions paa,
14685 per_time_periods ptp
14686 where
14687 ppa.action_type in ('R', 'Q')
14688 and ppa.payroll_action_id = paa.payroll_action_id
14689 and paa.assignment_id = p_assignment_id
14690 and ppa.EFFECTIVE_DATE between p_start_date and p_end_date
14691 and ptp.TIME_PERIOD_ID = ppa.TIME_PERIOD_ID
14692 and ptp.PAYROLL_ID = ppa.payroll_id
14693 AND ppa.action_type IN ('R','Q')
14694 AND paa.ACTION_STATUS = 'C'
14695 AND ppa.ACTION_STATUS = 'C'
14696 AND paa.source_action_id IS NOT NULL
14697 AND EXISTS
14698 --10100628
14699 (
14700 SELECT 1
14701 FROM per_assignment_extra_info
14702 WHERE assignment_id = paa.assignment_id
14703 AND aei_information_category = 'NL_WR_PREV_CORR'
14704 AND ptp.start_date BETWEEN fnd_date.canonical_to_date(aei_information1)
14705 AND nvl(fnd_date.canonical_to_date(aei_information2),to_date('31-12-4712','dd-mm-yyyy'))
14706 )
14707 --10100628
14708 /*
14709 ( SELECT 1
14710 FROM pay_run_results rr1 -- Retro element
14711 ,pay_element_span_usages esu
14712 ,pay_retro_component_usages rcu
14713 ,pay_retro_components rc
14714 ,pay_element_entries_f pee1
14715 ,pay_assignment_actions paa1
14716 ,pay_payroll_actions ppa1
14717 ,per_time_periods ptp
14718 WHERE --paa1.source_action_id = paa.assignment_action_id
14719 paa1.assignment_action_id = paa.assignment_action_id
14720 AND rr1.assignment_action_id = paa1.assignment_action_id
14721 AND rr1.element_entry_id = pee1.element_entry_id
14722 AND pee1.creator_type = 'RR'
14723 AND rr1.element_type_id = esu.retro_element_type_id
14724 AND esu.retro_component_usage_id = rcu.retro_component_usage_id
14725 AND rcu.creator_type = 'ET' -- check
14726 AND rcu.retro_component_id = rc.retro_component_id
14727 AND rc.legislation_code = 'NL'
14728 AND rc.short_name = 'Standard'
14729 AND ppa.effective_date between pee1.effective_start_date and pee1.effective_end_date
14730 AND paa1.payroll_action_id = ppa1.payroll_action_id
14731 AND ptp.payroll_id = ppa1.payroll_id
14732 AND rr1.start_date BETWEEN ptp.start_date and ptp.end_date
14733 AND to_char(ptp.end_date,'RRRR') = p_prev_corr_year
14734 )
14735 */
14736 --10100628
14737 group by ptp.start_date, ptp.end_date
14738 order by ptp.start_date;
14739
14740 CURSOR cur_retro_entry ( c_assignment_action_id NUMBER
14741 ,c_effective_date DATE)
14742 IS
14743 SELECT DISTINCT ptp.start_date
14744 ,ptp.end_date
14745 FROM pay_run_results rr1
14746 ,pay_element_span_usages esu
14747 ,pay_retro_component_usages rcu
14748 ,pay_retro_components rc
14749 ,pay_element_entries_f pee1
14750 ,pay_assignment_actions paa
14751 ,pay_payroll_actions ppa
14752 ,per_time_periods ptp
14753 WHERE paa.assignment_action_id = c_assignment_action_id
14754 AND rr1.assignment_action_id = paa.assignment_action_id
14755 AND rr1.element_entry_id = pee1.element_entry_id
14756 AND pee1.creator_type = 'RR'
14757 AND rr1.element_type_id = esu.retro_element_type_id
14758 AND esu.retro_component_usage_id = rcu.retro_component_usage_id
14759 AND rcu.creator_type = 'ET'
14760 AND rcu.retro_component_id = rc.retro_component_id
14761 AND rc.legislation_code = 'NL'
14762 AND rc.short_name = 'Standard'
14763 AND c_effective_date between pee1.effective_start_date and pee1.effective_end_date
14764 AND paa.payroll_action_id = ppa.payroll_action_id
14765 AND ptp.payroll_id = ppa.payroll_id
14766 AND rr1.start_date BETWEEN ptp.start_date and ptp.end_date
14767 ORDER BY 1;
14768 --10100628
14769
14770 l_er_only VARCHAR2(10);
14771
14772 BEGIN
14773 -- get Employee data
14774 --hr_utility.trace_on(null,'NL_WR');
14775 --
14776 --Fnd_file.put_line(FND_FILE.LOG,' Entering Archive Code for Assignment :'||p_assactid);
14777 select payroll_action_id,assignment_id
14778 into l_pactid, l_assignment_id
14779 from pay_assignment_actions
14780 where assignment_action_id = p_assactid;
14781 --
14782 get_all_parameters (l_pactid
14783 ,l_business_group_id
14784 ,l_start_date
14785 ,l_end_date
14786 ,l_tax_unit_id
14787 ,l_payroll_type
14788 ,l_seq_no
14789 ,l_prev_corr_year
14790 ,l_er_only); --10100628
14791 --
14792
14793 IF l_payroll_type = 'FOUR_WEEK' THEN
14794 --Fnd_file.put_line(FND_FILE.LOG,' Calling archive_consolidate');
14795 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);
14796 ELSIF l_payroll_type = 'YEARLY' THEN
14797 --Fnd_file.put_line(FND_FILE.LOG,' Calling archive_year_end');
14798 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);
14799 --10100628
14800 ELSIF l_prev_corr_year <> '-9999' THEN
14801 --l_end_date := to_date('31-12-'||l_prev_corr_year,'dd-mm-rrrr'); 10100628
14802 FOR rec_asg IN cur_assign(l_assignment_id, l_start_date, l_end_date, l_prev_corr_year) LOOP
14803
14804 chk_events(p_assactid,l_assignment_id,l_end_date,l_business_group_id,l_tax_unit_id,rec_asg.start_date,rec_asg.end_date,l_payroll_type, l_prev_corr_year); --10100628
14805 END LOOP;
14806 --10100628
14807 ELSE
14808 --Fnd_file.put_line(FND_FILE.LOG,' Calling chk_events');
14809 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, l_prev_corr_year); --10100628
14810 END IF;
14811 --Fnd_file.put_line(FND_FILE.LOG,' Leaving Archive Code');
14812 --
14813 END archive_code;
14814 --
14815 --------------------------------------------------------------------------------
14816 -- GET_ARCHIVE_DETAILS
14817 --------------------------------------------------------------------------------
14818 FUNCTION get_archive_details(p_actid IN NUMBER) RETURN VARCHAR2
14819 IS
14820 --
14821 CURSOR csr_get_org_name (c_payroll_action_id NUMBER) IS
14822 SELECT action_information9
14823 FROM pay_action_information pai
14824 WHERE action_context_id = c_payroll_action_id
14825 AND action_context_type = 'PA'
14826 AND action_information_category = 'NL_WR_EMPLOYER_INFO';
14827 --
14828 CURSOR csr_chk_exception (c_payroll_action_id NUMBER) IS
14829 SELECT 'EXCEPTION'
14830 FROM DUAL
14831 WHERE EXISTS (SELECT 1
14832 FROM pay_action_information pai
14833 WHERE action_context_id = c_payroll_action_id
14834 AND action_information_category = 'NL_WR_EXCEPTION_REPORT')
14835 OR EXISTS (SELECT 1
14836 FROM pay_assignment_actions paa
14837 ,pay_action_information pai
14838 WHERE paa.payroll_action_id = c_payroll_action_id
14839 AND pai.action_context_id = paa.assignment_action_id
14840 AND pai.action_information_category = 'NL_WR_EXCEPTION_REPORT');
14841 --
14842 l_business_group_id NUMBER;
14843 l_end_date DATE;
14844 l_start_date DATE;
14845 l_tax_unit_id NUMBER;
14846 l_payroll_type VARCHAR2(10);
14847 l_seq_no VARCHAR2(15);
14848 l_return_string VARCHAR2(1000);
14849 l_tax_rep_name PAY_ACTION_INFORMATION.ACTION_INFORMATION7%TYPE;
14850 l_exception VARCHAR2(20);
14851 l_prev_corr_year VARCHAR2(100); --10100628
14852 l_er_only VARCHAR2(10);
14853 --
14854 BEGIN
14855 --
14856 pay_nl_wage_report_pkg.get_all_parameters(p_actid
14857 ,l_business_group_id
14858 ,l_start_date
14859 ,l_end_date
14860 ,l_tax_unit_id
14861 ,l_payroll_type
14862 ,l_seq_no
14863 ,l_prev_corr_year
14864 ,l_er_only); --10100628
14865 --
14866 OPEN csr_get_org_name(p_actid);
14867 FETCH csr_get_org_name INTO l_tax_rep_name;
14868 CLOSE csr_get_org_name;
14869 --
14870 l_exception := 'NOEXCEPTION';
14871 OPEN csr_chk_exception(p_actid);
14872 FETCH csr_chk_exception INTO l_exception;
14873 CLOSE csr_chk_exception;
14874 --
14875 l_return_string := rpad(fnd_date.date_to_displaydate(l_start_date),15)||'- '||rpad(fnd_date.date_to_displaydate(l_end_date),15);
14876 l_return_string := l_return_string ||'- '||rpad(HR_GENERAL.decode_lookup('NL_WR_PERIOD_TYPE',l_payroll_type),40);
14877 l_return_string := l_return_string ||'- '||rpad(l_tax_rep_name,40);
14878 l_return_string := l_return_string ||'- '||rpad(HR_GENERAL.decode_lookup('NL_FORM_LABELS',l_exception),25);
14879 --
14880 RETURN(l_return_string);
14881 --
14882 END get_archive_details;
14883 --
14884 FUNCTION get_archived_taxable_income(p_bg_id IN NUMBER
14885 ,p_year IN NUMBER
14886 ,p_tax_unit_id IN NUMBER)
14887 RETURN NUMBER IS
14888
14889 CURSOR csr_get_archived_value(c_bg_id IN NUMBER
14890 ,c_year IN NUMBER
14891 ,c_tax_unit_id IN NUMBER) IS
14892
14893 SELECT sum (fnd_number.canonical_to_number(nvl (action_information6,0))) taxableincome
14894 FROM pay_action_information info
14895 ,pay_payroll_actions generator
14896 ,pay_payroll_actions datalock
14897 WHERE info.action_context_id = generator.payroll_action_id
14898 AND info.action_information2 = 'TotLnLbPh'
14899 AND datalock.report_type = 'NL_WAGES_REP_LOCK'
14900 AND datalock.business_group_id = c_bg_id
14901 AND datalock.action_status = 'C'
14902 AND to_char (generator.effective_date,'YYYY') = c_year
14903 AND pay_nl_wage_report_pkg.get_parameters (generator.payroll_action_id
14904 ,'Legal_Employer') = c_tax_unit_id
14905 AND pay_nl_wage_report_pkg.get_parameters (datalock.payroll_action_id
14906 ,'REQUEST_ID') = generator.payroll_action_id ;
14907
14908 r_get_archived_value csr_get_archived_value%ROWTYPE;
14909 BEGIN
14910
14911 OPEN csr_get_archived_value(c_bg_id => p_bg_id
14912 ,c_year => p_year-1
14913 ,c_tax_unit_id => p_tax_unit_id);
14914 FETCH csr_get_archived_value INTO r_get_archived_value;
14915 IF csr_get_archived_value%NOTFOUND THEN
14916 CLOSE csr_get_archived_value;
14917 RETURN 0;
14918 END IF;
14919 CLOSE csr_get_archived_value;
14920 RETURN NVL(r_get_archived_value.taxableincome,0);
14921
14922 END get_archived_taxable_income;
14923
14924 END pay_nl_wage_report_pkg;