[Home] [Help]
PACKAGE BODY: APPS.PAY_VOID_REVERSAL_PKG
Source
1 PACKAGE BODY PAY_VOID_REVERSAL_PKG AS
2 /* $Header: pyvoidrv.pkb 120.1.12020000.1 2013/03/22 08:08:29 nvankadh noship $ */
3 /*
4 ******************************************************************
5 * *
6 * Copyright (C) 1993 Oracle Corporation UK Ltd., *
7 * Chertsey, England. *
8 * *
9 * All rights reserved. *
10 * *
11 * This material has been provided pursuant to an agreement *
12 * containing restrictions on its use. The material is also *
13 * protected by copyright law. No part of this material may *
14 * be copied or distributed, transmitted or transcribed, in *
15 * any form or by any means, electronic, mechanical, magnetic, *
16 * manual, or otherwise, or disclosed to third parties without *
17 * the express written permission of Oracle Corporation UK Ltd, *
18 * Oracle Park, Bittams Lane, Guildford Road, Chertsey, Surrey, *
19 * England. *
20 * *
21 ******************************************************************
22
23 ======================================================================
24
25 Change List
26 ===========
27
28 Version Date Author ER/CR No. Description of Change
29 -------+---------+----------+---------+-------------------------------
30 115.0 03/03/08 ckesanap 6820127 Created the file.
31 115.1 03/03/08 ckesanap 6820127 Changed the dbdrv phase to plb and
32 added date format mask to to_date()
33 ----------------------------------------------------------------------
34 */
35
36 -- ----------------------------------------------------------------------------
37 -- |---------------------------< checkwriter_wrapper >-------------------------|
38 -- ----------------------------------------------------------------------------
39 --
40 -- Description:
41 -- The wrapper function for the checkwriter concurrent program.
42 -- Derives the full set of parameters according to the group_id and
43 -- submits the SRS. After submitting the SRS, the child request is inserted
44 -- into pay_process_requests and wait for the request completion. Once the
45 -- request completes processing, the assignment set created for passing as
46 -- as a parameter is deleted.
47 --
48 -- ----------------------------------------------------------------------------
49 procedure check_writer_wrapper(p_end_date varchar2,
50 p_start_check_number varchar2,
51 p_overriding_check_date varchar2,
52 p_check_assignment_action varchar2,
53 p_group_id in number,
54 p_srs_request_id OUT NOCOPY number)
55 IS
56 TYPE check_details_rectype IS RECORD
57 ( payroll_action_id pay_payroll_actions.payroll_action_id%TYPE,
58 payroll_id pay_payroll_actions.payroll_id%TYPE,
59 org_payment_method_id pay_payroll_actions.org_payment_method_id%TYPE,
60 payment_type_id pay_payroll_actions.payment_type_id%TYPE,
61 effective_date pay_payroll_actions.effective_date%TYPE,
62 cheque_procedure pay_payroll_actions.cheque_procedure%TYPE,
63 cheque_report pay_payroll_actions.cheque_report%TYPE,
64 start_cheque_number pay_payroll_actions.start_cheque_number%TYPE,
65 start_date pay_payroll_actions.start_date%TYPE,
66 consolidation_set_id pay_payroll_actions.consolidation_set_id%TYPE,
67 payroll_name pay_all_payrolls_f.payroll_name%TYPE,
68 consolidation_set_name pay_consolidation_sets.consolidation_set_name%TYPE,
69 business_group_id pay_all_payrolls_f.business_group_id%TYPE,
70 assignment_id pay_assignment_actions.assignment_id%TYPE
71 );
72 --
73 check_details_rec check_details_rectype;
74 l_request_id number;
75 l_sort_sequence hr_lookups.meaning%TYPE;
76 l_check_style hr_lookups.meaning%TYPE;
77 l_curr_payroll_action_id pay_payroll_Actions.payroll_Action_id%type;
78 --
79 l_wait_outcome BOOLEAN;
80 l_phase VARCHAR2(80);
81 l_status VARCHAR2(80);
82 l_dev_phase VARCHAR2(80);
83 l_dev_status VARCHAR2(80);
84 l_message VARCHAR2(80);
85 --
86 p_asg_set_rowid varchar2(80);
87 p_asg_rowid varchar2(80);
88 l_asg_set_id number;
89 l_asg_set_name varchar2(100);
90 l_format varchar2(100);
91 --
92 CURSOR c_sequence is
93 select hr_assignment_sets_s.nextval
94 from dual;
95 --
96 CURSOR c_get_payrl_action(p_check_number varchar2) is
97 select payroll_action_id
98 from pay_assignment_Actions
99 where serial_number = p_check_number;
100 --
101 --
102 l_proc varchar2(72) := 'PAY_VOID_REVERSAL_PKG.CHECK_WRITER_WRAPPER';
103 --
104 begin
105
106 hr_utility.set_location('Entering: '||l_proc, 5);
107
108 l_request_id := 0;
109
110 --
111 open c_sequence;
112 fetch c_sequence into l_asg_set_id;
113 close c_sequence;
114 --
115
116 hr_utility.set_location(l_proc, 10);
117
118 fnd_profile.get('ICX_DATE_FORMAT_MASK', l_format);
119 if l_format is not null then
120 hr_utility.trace(l_format);
121 else
122 hr_utility.trace('Couldn''t get profile value. Setting to DD-MM-YYYY');
123 l_format := 'DD-MM-YYYY';
124 end if;
125
126 -- if group 1
127 -- Derive payroll name, consolidation set from pay_payroll_actions
128 -- Derive the previous check writer details from pay_payroll_actions
129 IF p_group_id = 1 THEN
130
131 hr_utility.set_location(l_proc, 20);
132
133 SELECT DISTINCT ppa.payroll_action_id
134 ,ppa.payroll_id
135 ,ppp.org_payment_method_id
136 ,ppa.payment_type_id
137 ,ppa.effective_date
138 ,ppa.cheque_procedure
139 ,ppa.cheque_report
140 ,ppa.start_cheque_number
141 ,ppa.start_date
142 ,ppa.consolidation_set_id
143 ,papf.payroll_name
144 ,pcs.consolidation_set_name
145 ,papf.business_group_id
146 ,paa.assignment_id
147 -- ,popmf.org_payment_method_name
148 INTO check_details_rec
149 FROM pay_payroll_actions ppa
150 ,pay_assignment_actions paa
151 ,pay_all_payrolls_f papf
152 ,pay_consolidation_sets pcs
153 ,pay_org_payment_methods_f popmf
154 ,pay_pre_payments ppp
155 WHERE paa.assignment_action_id = p_check_assignment_action
156 AND ppp.pre_payment_id = paa.pre_payment_id
157 AND ppa.payroll_action_id = paa.payroll_action_id
158 AND papf.payroll_id = ppa.payroll_id
159 AND pcs.consolidation_set_id = ppa.consolidation_set_id
160 AND (
161 (
162 ppa.org_payment_method_id = popmf.org_payment_method_id
163 )
164 OR (
165 popmf.org_payment_method_id IN
166 (
167 SELECT ppp.org_payment_method_id
168 FROM pay_pre_payments ppp
169 ,pay_assignment_actions paa
170 WHERE paa.payroll_action_id = ppa.payroll_action_id
171 AND paa.pre_payment_id = ppp.pre_payment_id
172 )
173 )
174 )
175 AND to_date (p_end_date
176 ,l_format) BETWEEN papf.effective_start_date
177 AND papf.effective_end_date
178 AND to_date (p_end_date
179 ,l_format) BETWEEN popmf.effective_start_date
180 AND popmf.effective_end_date;
181
182 hr_utility.set_location(l_proc, 30);
183
184 -- get the sort sequence
185 select lookup_code into l_sort_sequence
186 from hr_lookups
187 where lookup_type = 'CHEQUE_PROCEDURE'
188 and lookup_code = 'DEFAULT';
189 -- get the check style
190 select lookup_code into l_check_style
191 from hr_lookups
192 where lookup_type='CHEQUE_REPORT'
193 and lookup_code='PAYUSCHK';
194 --
195 END IF;
196
197 hr_utility.set_location(l_proc, 40);
198
199 -- Create Assignment Set and add this employee
200 l_asg_set_name := 'VR_asg_set_' || to_char(p_check_assignment_action)||l_asg_set_id;
201
202 HR_ASSIGNMENT_SETS_PKG.insert_row(
203 p_rowid => p_asg_set_rowid,
204 p_assignment_set_id => l_asg_set_id,
205 p_business_group_id => check_details_rec.business_group_id,
206 p_payroll_id => check_details_rec.payroll_id,
207 p_assignment_set_name => l_asg_set_name,
208 p_formula_id => null);
209
210 hr_utility.set_location(l_proc, 50);
211
212 -- Adding this assignment to the the assignment_set
213
214 HR_ASSIGNMENT_SET_AMDS_PKG.insert_row(
215 p_rowid => p_asg_rowid,
216 p_assignment_id => check_details_rec.assignment_id,
217 p_assignment_set_id => l_asg_set_id,
218 p_include_or_exclude => 'I');
219
220 hr_utility.set_location(l_proc, 60);
221
222 commit;
223
224
225 hr_utility.trace('Details for submitting the check writer');
226 hr_utility.trace('========================================');
227 hr_utility.trace('check_details_rec.consolidation_set_name ' || check_details_rec.consolidation_set_name);
228 hr_utility.trace('check_details_rec.start_date ' || fnd_date.date_to_canonical(check_details_rec.start_date));
229 hr_utility.trace('p_end_date ' || p_end_date);
230 hr_utility.trace('l_sort_sequence ' || l_sort_sequence);
231 hr_utility.trace('l_check_style ' || l_check_style);
232 hr_utility.trace('new check number ' || p_start_check_number);
233 hr_utility.trace('p_overriding_check_date ' || p_overriding_check_date);
234 hr_utility.trace('Assignment Set ' || l_asg_set_id);
235 hr_utility.trace('========================================');
236 hr_utility.trace('check_details_rec.payroll_name ' || check_details_rec.payroll_name);
237
238
239 -- Derive the values before
240 -- use this for date conversion
241 -- fnd_date.date_to_canonical(to_date(p_effective_date,'DD-MM-YYYY'))
242 -- use this for number conversion
243 -- to_number(check_details_rec.start_cheque_number,'9999999999999999')
244
245 l_request_id := fnd_request.submit_request (
246 application => 'PAY',
247 program => 'US_CHECK_OVERRIDE_PAYMENT',
248 description => null,
249 start_time => fnd_date.date_to_canonical(sysdate),
250 sub_request => null,
251 argument1 => 'CHEQUE', -- Process Name
252 argument2 => check_details_rec.payroll_id, -- Payroll
253 argument3 => check_details_rec.consolidation_set_id, --Consolidation Set
254 argument4 => fnd_date.date_to_canonical(check_details_rec.start_date), -- Start Date
255 argument5 => fnd_date.date_to_canonical(to_date(p_end_date,l_format)), -- End Date
256 argument6 => check_details_rec.payment_type_id, -- Payment Type Default = CHECK
257 argument7 => check_details_rec.org_payment_method_id, -- Payment Method
258 argument8 => check_details_rec.cheque_procedure, -- Sort Sequence
259 argument9 => check_details_rec.cheque_report, -- Check Style
260 argument10 => to_number(p_start_check_number,'99999999999999999'), -- Start Check Number
261 argument11 => null, -- End Check Number
262 argument12 => null, -- Action Parameter Group
266 );
263 argument13 => fnd_date.date_to_canonical(to_date(p_overriding_check_date,l_format)), -- Overriding Cheque Date
264 argument14 => l_asg_set_id, -- Assignment Set,
265 argument15 => 'CHQVNR' -- tell cheque writer its being called from VnR
267
268 hr_utility.set_location(l_proc, 70);
269
270 commit;
271
272 -- As we will wait for the request to get completed, insert the child request
273 -- in PAY_PROCESS_REQUESTS. The process monitor page will then display the request.
274
275 pay_flow_requests_pkg.insert_child_request(p_check_assignment_action,
276 l_request_id);
277
278 hr_utility.trace('Submitted request with ' || l_request_id);
279
280 -- Wait for this concurrent request to finish
281 l_wait_outcome := fnd_concurrent.wait_for_request(
282 request_id => l_request_id,
283 interval => 5,
284 phase => l_phase,
285 status => l_status,
286 dev_phase => l_dev_phase,
287 dev_status => l_dev_status,
288 message => l_message);
289
290 p_srs_request_id := l_request_id;
291
292 hr_utility.set_location(l_proc, 80);
293
294 /*
295 -- Get the payroll action for the check writer and update the assignment_set_id to null
296 open c_get_payrl_action(p_start_check_number);
297 fetch c_get_payrl_action into l_curr_payroll_action_id;
298 close c_get_payrl_action;
299
300 update pay_payroll_actions
301 set assignment_set_id = null,
302 last_update_date = sysdate,
303 last_updated_by = fnd_global.user_id,
304 last_update_login = fnd_global.login_id
305 where payroll_action_id = l_curr_payroll_action_id;
306 commit;
307
308 -- Delete the Assignment Id from the Asg Set amendments
309 HR_ASSIGNMENT_SET_AMDS_PKG.delete_row(p_asg_rowid);
310
311 commit;
312
313 -- Delete the assignment set
314 HR_ASSIGNMENT_SETS_PKG.delete_row(p_asg_set_rowid); */
315
316 commit;
317
318 hr_utility.set_location('Leaving: '||l_proc, 90);
319
320 exception
321 when others then
322 p_srs_request_id := -1;
323
324 END check_writer_wrapper;
325
326
327 -- ----------------------------------------------------------------------------
328 -- |-------------------------------< void_wrapper >----------------------------|
329 -- ----------------------------------------------------------------------------
330 --
331 -- Description:
332 -- The wrapper function for the Void Concurrent Program
333 -- Derives the full set of parameters based on the group_id
334 -- and submits the SRS
335 --
336 -- ----------------------------------------------------------------------------
337 procedure void_wrapper ( p_effective_date varchar2,
338 p_start_check_number varchar2,
339 p_reason varchar2,
340 p_check_assignment_action varchar2,
341 p_group_id in number,
342 p_srs_request_id OUT NOCOPY number)
343
344 IS
345
346 l_payroll_action_id pay_payroll_actions.payroll_action_id%TYPE ;
347 l_start_cheque_number pay_payroll_actions.start_cheque_number%TYPE;
348 l_request_id number;
349 --
350 l_wait_outcome BOOLEAN;
351 l_phase VARCHAR2(80);
352 l_status VARCHAR2(80);
353 l_dev_phase VARCHAR2(80);
354 l_dev_status VARCHAR2(80);
355 l_message VARCHAR2(80);
356 --
357 l_eff_date varchar2(80);
358 l_proc varchar2(72) := 'PAY_VOID_REVERSAL_PKG.VOID_WRAPPER';
359 l_format varchar2(100);
360 --
361 BEGIN
362 --
363
364 hr_utility.set_location('Entering: '||l_proc, 5);
365
366 l_request_id := 0;
367
368 -- if group 1
369 -- Derive payroll and check details from pay_payroll_actions
370 -- Assign all the relevant SRS params
371
372 IF p_group_id = 1 THEN
373
374 hr_utility.set_location(l_proc, 10);
375
376 select ppa.payroll_action_id, paa.serial_number
377 into l_payroll_action_id, l_start_cheque_number
378 from pay_payroll_actions ppa, pay_assignment_actions paa
379 where ppa.payroll_action_id = paa.payroll_action_id
380 and paa.assignment_action_id = p_check_assignment_action;
381
382 END IF;
383
384 hr_utility.set_location(l_proc, 21);
385
386 fnd_profile.get('ICX_DATE_FORMAT_MASK', l_format);
387 if l_format is not null then
388 hr_utility.trace(l_format);
389 else
390 hr_utility.trace('Couldn''t get profile value. Setting to DD-MM-YYYY');
391 l_format := 'DD-MM-YYYY';
392 end if;
393
394
395 -- Submit the SRS request
396 l_request_id := fnd_request.submit_request (
397 application => 'PAY',
398 program => 'PYVDUSPY',
399 description => null,
400 start_time => fnd_date.date_to_canonical(sysdate),
401 sub_request => null,
402 argument1 => l_payroll_action_id, -- Payroll Action Id
403 argument2 => fnd_date.date_to_canonical(to_date(p_effective_date,l_format)), -- Effective Date
404 argument3 => p_reason, -- Reason
405 argument4 => to_number(l_start_cheque_number,'9999999999999999'), -- Start Check Number
406 argument5 => to_number(l_start_cheque_number,'9999999999999999') -- End check number
407 );
408
409 hr_utility.set_location(l_proc, 30);
410
414
411 p_srs_request_id := l_request_id;
412
413 commit;
415 hr_utility.set_location('Leaving: '||l_proc, 40);
416
417 exception
418 when others then
419 p_srs_request_id := -1;
420
421 END void_wrapper;
422
423
424 -- ----------------------------------------------------------------------------
425 -- |-------------------------------< ext_man_pymt_wrapper >----------------------------|
426 -- ----------------------------------------------------------------------------
427 --
428 -- Description:
429 -- The wrapper procedure for the External Manual Payment Concurrent Program
430 -- Derives the full set of parameters based on the group_id
431 -- and submits the SRS
432 --
433 -- ----------------------------------------------------------------------------
434 procedure ext_man_pymt_wrapper( p_effective_date varchar2,
435 p_reason varchar2,
436 p_comments varchar2,
437 p_check_assignment_action varchar2,
438 p_group_id in number,
439 p_srs_request_id OUT NOCOPY number) IS
440
441 l_payroll_id pay_payroll_actions.payroll_id%TYPE;
442 l_assignment_id pay_assignment_actions.assignment_id%TYPE ;
443 l_prepayment_asg_action pay_assignment_actions.assignment_action_id%TYPE ;
444 l_serial_number pay_assignment_actions.serial_number%TYPE;
445 l_pre_payment_id pay_pre_payments.pre_payment_id%TYPE;
446 l_request_id number;
447 --
448 l_wait_outcome BOOLEAN;
449 l_phase VARCHAR2(80);
450 l_status VARCHAR2(80);
451 l_dev_phase VARCHAR2(80);
452 l_dev_status VARCHAR2(80);
453 l_message VARCHAR2(80);
454 --
455 l_eff_date varchar2(80);
456 l_proc varchar2(72) := 'PAY_VOID_REVERSAL_PKG.EXT_MAN_PYMT_WRAPPER';
457 l_format varchar2(100);
458 --
459 begin
460
461 hr_utility.set_location('Entering: '||l_proc, 5);
462
463 l_request_id := 0;
464
465 IF p_group_id = 1 THEN
466
467 hr_utility.set_location(l_proc, 10);
468
469 select distinct(paa.assignment_action_id),ppa.payroll_id,
470 paa.assignment_id, ppp.pre_payment_id, paa2.serial_number
471 into l_prepayment_asg_action, l_payroll_id, l_assignment_id,
472 l_pre_payment_id, l_serial_number
473 from pay_payroll_actions ppa, pay_assignment_actions paa,
474 pay_assignment_actions paa2, pay_all_payrolls_f papf,
475 pay_pre_payments ppp, pay_action_interlocks pal
476 where pal.locking_action_id = p_check_assignment_action
477 and paa2.assignment_action_id = p_check_assignment_action
478 and paa.assignment_action_id = pal.locked_action_id
479 and ppa.payroll_action_id = paa.payroll_action_id
480 and ppp.assignment_action_id = paa.assignment_action_id
481 and ppa.effective_date between papf.effective_start_date
482 and papf.effective_end_date
483 and ppp.pre_payment_id = paa2.pre_payment_id;
484
485 END IF;
486
487 fnd_profile.get('ICX_DATE_FORMAT_MASK', l_format);
488 if l_format is not null then
489 hr_utility.trace(l_format);
490 else
491 hr_utility.trace('Couldn''t get profile value. Setting to DD-MM-YYYY');
492 l_format := 'DD-MM-YYYY';
493 end if;
494
495 hr_utility.set_location(l_proc, 20);
496
497
498 l_request_id := fnd_request.submit_request (
499 application => 'PAY',
500 program => 'PYEXMNPT',
501 description => null,
502 start_time => fnd_date.date_to_canonical(sysdate),
503 sub_request => null,
504 argument1 => l_payroll_id, -- payroll_id
505 argument2 => fnd_date.date_to_canonical(to_date(p_effective_date,l_format)), -- effective_date
506 argument3 => l_prepayment_asg_action, -- assignment_action_id for pre payments
507 argument4 => l_assignment_id, -- assignment_id
508 argument5 => p_comments, -- comments
509 argument6 => l_serial_number, -- serial number
510 argument7 => l_pre_payment_id, -- pre payment id
511 argument8 => p_reason -- reason
512 );
513
514 hr_utility.set_location(l_proc, 30);
515
516 p_srs_request_id := l_request_id;
517 commit;
518
519 hr_utility.set_location('Leaving: '||l_proc, 40);
520
521 exception
522 when others then
523 p_srs_request_id := -1;
524
525 end ext_man_pymt_wrapper;
526
527
528 -- ----------------------------------------------------------------------------
529 -- |-------------------------------< reverse_payroll_wrapper >----------------------------|
530 -- ----------------------------------------------------------------------------
531 --
532 -- Description:
533 -- The wrapper procedure for the Payroll Reversal Concurrent Program
534 -- Derives the full set of parameters based on the group_id
535 -- and submits the SRS
536 --
537 -- ----------------------------------------------------------------------------
538 procedure reverse_payroll_wrapper ( p_effective_date varchar2,
539 p_check_assignment_action varchar2,
540 p_group_id in number,
541 p_srs_request_id OUT NOCOPY number)IS
542
543 TYPE payroll_action_rectype IS RECORD
544 ( payroll_id pay_payroll_actions.payroll_id%TYPE,
545 consolidation_set_id pay_payroll_actions.consolidation_set_id%TYPE,
546 business_group_id pay_all_payrolls_f.business_group_id%TYPE,
547 action_type pay_payroll_actions.action_type%TYPE,
548 action_status pay_payroll_actions.action_status%TYPE,
549 action_population_status pay_payroll_actions.action_population_status%TYPE
550 );
551 --
552 CURSOR get_pay_run_asg_action(p_check_assignment_action varchar2)
553 IS ( select pal2.locked_action_id
554 from pay_action_interlocks pal1,
555 pay_action_interlocks pal2
556 where pal1.locking_action_id = p_check_assignment_action
557 and pal1.locked_action_id = pal2.locking_action_id ) ;
558 --
559 payroll_action_rec payroll_action_rectype;
560 l_payroll_run_asg_action pay_assignment_actions.assignment_action_id%type;
561 l_request_id number;
562 l_temp number; -- dummy variable to collect value from select query that checks existance
563 --
564 l_wait_outcome BOOLEAN;
565 l_phase VARCHAR2(80);
566 l_status VARCHAR2(80);
567 l_dev_phase VARCHAR2(80);
568 l_dev_status VARCHAR2(80);
569 l_message VARCHAR2(80);
570 l_already_ran VARCHAR2(10);
571 --
572 l_eff_date varchar2(80);
573 l_proc varchar2(72) := 'PAY_VOID_REVERSAL_PKG.REVERSE_PAYROLL_WRAPPER';
574 l_format varchar2(100);
575 --
576 BEGIN
577
578 hr_utility.set_location('Entering: '||l_proc, 5);
579
580 l_request_id := 0;
581 l_already_ran := 'N';
582
583 select count(*)
584 into l_temp
585 from pay_payroll_actions
586 where action_type = 'V'
587 and action_status = 'P';
588
589 dbms_lock.sleep(5*l_temp);
590
591 fnd_profile.get('ICX_DATE_FORMAT_MASK', l_format);
592 if l_format is not null then
593 hr_utility.trace(l_format);
594 else
595 hr_utility.trace('Couldn''t get profile value. Setting to DD-MM-YYYY');
596 l_format := 'DD-MM-YYYY';
597 end if;
598
599
600 IF p_group_id = 1 THEN
601
602 open get_pay_run_asg_action(p_check_assignment_action);
603 fetch get_pay_run_asg_action into l_payroll_run_asg_action;
604 close get_pay_run_asg_action ;
605
606 hr_utility.set_location(l_proc, 10);
607
608 select ppa.payroll_id, ppa.consolidation_set_id,
609 papf.business_group_id,
610 ppa.action_type, ppa.action_status,
611 ppa.action_population_status
612 into payroll_action_rec
613 from pay_payroll_actions ppa, pay_assignment_actions paa,
614 pay_all_payrolls_f papf, pay_consolidation_sets pcs
615 where paa.assignment_action_id = l_payroll_run_asg_action
616 and ppa.payroll_action_id = paa.payroll_action_id
617 and papf.payroll_id = ppa.payroll_id
618 and pcs.consolidation_set_id = ppa.consolidation_set_id
619 and to_date(p_effective_date,l_format) between papf.effective_start_date and
620 papf.effective_end_date;
621
622 END IF;
623
624 hr_utility.set_location(l_proc, 20);
625
626 -- check if reversal is already run for this payroll action
627 -- typically happens when multiple cheque payments are attached to a single employee
628 begin
629 select distinct 1
630 into l_temp
631 from pay_assignment_actions ac2,
632 pay_payroll_actions pa2,
633 pay_action_interlocks pai
634 where pai.locked_action_id = l_payroll_run_asg_action
635 and ac2.assignment_action_id = pai.locking_action_id
636 and pa2.payroll_action_id = ac2.payroll_action_id
637 and pa2.action_type = 'V';
638 l_already_ran := 'Y';
639 exception
640 when others then
641 l_already_ran := 'N';
642 end;
643
644 if l_already_ran = 'N' then
645 l_request_id := fnd_request.submit_request (
646 application => 'PAY',
647 program => 'PYREVPAY',
648 description => null,
649 start_time => fnd_date.date_to_canonical(sysdate),
650 sub_request => null,
651 argument1 => 'V', -- action_type
652 argument2 => payroll_action_rec.business_group_id, -- business_group_id
653 argument3 => payroll_action_rec.consolidation_set_id, -- consolidation_set_id
654 argument4 => payroll_action_rec.payroll_id, -- payroll_id
655 argument5 => payroll_action_rec.action_population_status, -- action_population_status
656 argument6 => payroll_action_rec.action_status, -- action_status
657 argument7 => fnd_date.date_to_canonical(to_date(p_effective_date,l_format)), -- effective_date
658 argument8 => l_payroll_run_asg_action -- assignment_action_id for payroll run
659 );
660 hr_utility.set_location(l_proc, 30);
661 end if;
662
663 p_srs_request_id := l_request_id;
664
665 commit;
666
667 hr_utility.set_location('Leaving: '||l_proc, 40);
668
669 exception
670 when others then
671 p_srs_request_id := -1;
672
673 end reverse_payroll_wrapper;
674 --
675 END PAY_VOID_REVERSAL_PKG;