[Home] [Help]
PACKAGE BODY: APPS.PAY_PAYROLL_API
Source
1 package body pay_payroll_api as
2 /* $Header: pyprlapi.pkb 120.7 2008/02/05 05:34:12 salogana noship $ */
3 /*
4 NOTES
5 */
6
7 /*---------------------------------------------------------------------------*/
8 /*-------------------------- constant definitions ---------------------------*/
9 /*---------------------------------------------------------------------------*/
10
11 /*---------------------------------------------------------------------------*/
12 /*---------------------------- Payroll API types ----------------------------*/
13 /*---------------------------------------------------------------------------*/
14
15 /*---------------------------------------------------------------------------*/
16 /*--------------------------- Payroll API globals ---------------------------*/
17 /*---------------------------------------------------------------------------*/
18 --g_package varchar2(33) := ' pay_payroll_api.';
19 g_exists varchar2(1);
20 g_legislation_code fnd_territories.territory_code%type;
21 -- The following global variable is to be used by
22 -- the set_base_key_value and pre_insert procedures.
23 --
24 g_payroll_id_i number default null;
25
26
27 --
28 /*---------------------------------------------------------------------------*/
29 /*------------------ global functions and procedures ------------------------*/
30 /*---------------------------------------------------------------------------*/
31
32 --
33 -- ------------------------------------------------------------------
34 -- |------------------< update_cost_concat_segs >--------------------|
35 -- ------------------------------------------------------------------
36 -- {Start Of Comments}
37 --
38 -- Description:
39 -- When required this procedure updates the PAY_COST_ALLOCATION_KEYFLEX
40 -- table after the flexfield segments have been inserted to keep
41 -- the concatenated segment string up-to-date.
42 --
43 -- Prerequisites:
44 -- A row must exist in the PAY_COST_ALLOCATION_KEYFLEX table for the
45 -- given cost_allocation_keyflex_id.
46 --
47 -- In Parameters:
48 -- Name Reqd Type Description
49 -- p_cost_alloc_keyflex_id Yes number The primary key
50 -- p_concat_segments Yes varchar2 Concatenated String
51 --
52 -- Post Success:
53 -- If required the row is updated and committed.
54 --
55 -- Post Failure:
56 -- The procedure will raise an error.
57 --
58 -- Access Status:
59 -- Internal use only.
60 --
61 -- {End Of Comments}
62 --
63 procedure update_cost_concat_segs
64 (p_cost_alloc_keyflex_id in number
65 ,p_concat_segments in varchar2
66 ) is
67 --
68 CURSOR csr_chk_cost is
69 SELECT null
70 FROM PAY_COST_ALLOCATION_KEYFLEX
71 where cost_allocation_keyflex_id = p_cost_alloc_keyflex_id
72 and (concatenated_segments <> p_concat_segments
73 or concatenated_segments is null);
74 --
75 l_exists varchar2(30);
76 l_proc varchar2(72) := g_package||'update_cost_concat_segs';
77 --
78 procedure update_cost_concat_segs_auto
79 (p_cost_alloc_keyflex_id in number
80 ,p_concat_segments in varchar2
81 ) is
82 PRAGMA AUTONOMOUS_TRANSACTION;
83 --
84 CURSOR csr_cost_lock is
85 SELECT null
86 FROM PAY_COST_ALLOCATION_KEYFLEX
87 where cost_allocation_keyflex_id = p_cost_alloc_keyflex_id
88 for update nowait;
89 --
90 l_exists varchar2(30);
91 l_proc varchar2(72) :=g_package||'update_cost_concat_segs_auto';
92 --
93 begin
94 hr_utility.set_location('Entering:'|| l_proc, 10);
95 --
96 -- The outer procedure has already establish that an update is
97 -- required. This sub-procedure uses an autonomous transaction
98 -- to ensure that any commits do not impact the main transaction.
99 -- If the row is successfully locked then continue and update the
100 -- row. If the row cannot be locked then another transaction must
101 -- be performing the update. So it is acceptable for this
102 -- transaction to silently trap the error and continue.
103 --
104 -- Note: It is necessary to perform the lock test because in
105 -- a batch data upload scenario multiple sessions could be
106 -- attempting to insert or update the same Key Flexfield
107 -- combination at the same time. Just directly updating the row,
108 -- without first locking, can cause sessions to hang and reduce
109 -- batch throughput.
110 --
111 open csr_cost_lock;
112 fetch csr_cost_lock into l_exists;
113 if csr_cost_lock%found then
114 close csr_cost_lock;
115 hr_utility.set_location(l_proc, 20);
116 --
117 -- Lock obtained by this transaction, updating the concatenated
118 -- segment string should be performed.
119 --
120 update PAY_COST_ALLOCATION_KEYFLEX
121 set concatenated_segments = p_concat_segments
122 where cost_allocation_keyflex_id = p_cost_alloc_keyflex_id
123 and (concatenated_segments <> p_concat_segments
124 or concatenated_segments is null);
125 --
126 -- Commit this change so the change is immediately visible to
127 -- other transactions. Also ensuring that it is not undone if
128 -- the main transaction is rolled back. This commit is only
129 -- acceptable inside an API because it is being performed
130 -- inside an autonomous transaction and AOL code has
131 -- previously inserted the Key Flexfield combination row in
132 -- another autonomous transaction.
133 commit;
134 else
135 close csr_cost_lock;
136 end if;
137 --
138 hr_utility.set_location('Leaving:'|| l_proc, 30);
139 Exception
140 When HR_Api.Object_Locked then
141 --
142 -- This autonomous transaction was unable to lock the row.
143 -- It can be assumed that another transaction has locked the
144 -- row and is performing the update. Hence the error can
145 -- be suppressed without raising it to the end user.
146 --
147 hr_utility.set_location('Leaving:'|| l_proc, 40);
148 end update_cost_concat_segs_auto;
149 begin
150 hr_utility.set_location('Entering:'|| l_proc, 10);
151 --
152 -- First find out if it is necessary to update the concatenated
153 -- segment string column. This select is being done to avoid the
154 -- performance unnecessary overhead of set-up an autonomous
155 -- transaction when an update is not required. Updates are only
156 -- expected immediately after the combination row was first
157 -- inserted.
158 --
159 open csr_chk_cost;
160 fetch csr_chk_cost into l_exists;
161 if csr_chk_cost%found then
162 close csr_chk_cost;
163 update_cost_concat_segs_auto
164 (p_cost_alloc_keyflex_id => p_cost_alloc_keyflex_id
165 ,p_concat_segments => p_concat_segments
166 );
167 else
168 close csr_chk_cost;
169 end if;
170 --
171 hr_utility.set_location('Leaving:'|| l_proc, 40);
172 --
173 end update_cost_concat_segs;
174
175
176 --We are not using this procedure. But it may be useful in the future.
177 --
178 -- ------------------------------------------------------------------
179 -- |------------------< update_soft_concat_segs >--------------------|
180 -- ------------------------------------------------------------------
181 -- {Start Of Comments}
182 --
183 -- Description:
184 -- When required this procedure updates the HR_SOFT_CODING_KEYFLEX
185 -- table after the flexfield segments have been inserted to keep
186 -- the concatenated segment string up-to-date.
187 --
188 -- Prerequisites:
189 -- A row must exist in the HR_SOFT_CODING_KEYFLEX table for the
190 -- given soft_coding_keyflex_id.
191 --
192 -- In Parameters:
193 -- Name Reqd Type Description
194 -- p_soft_coding_keyflex_id Yes number The primary key
195 -- p_concat_segments Yes varchar2 Concatenated String
196 --
197 -- Post Success:
198 -- If required the row is updated and committed.
199 --
200 -- Post Failure:
201 -- The procedure will raise an error.
202 --
203 -- Access Status:
204 -- Internal use only.
205 --
206 -- {End Of Comments}
207 --
208 procedure update_soft_concat_segs
209 (p_soft_coding_keyflex_id in number
210 ,p_concat_segments in varchar2
211 ) is
212 --
213 CURSOR csr_chk_soft is
214 SELECT null
215 FROM HR_SOFT_CODING_KEYFLEX
216 where soft_coding_keyflex_id = p_soft_coding_keyflex_id
217 and (concatenated_segments <> p_concat_segments
218 or concatenated_segments is null);
219 --
220 l_exists varchar2(30);
221 l_proc varchar2(72) := g_package||'update_soft_concat_segs';
222 --
223 procedure update_soft_concat_segs_auto
224 (p_soft_coding_keyflex_id in number
225 ,p_concat_segments in varchar2
226 ) is
227 PRAGMA AUTONOMOUS_TRANSACTION;
228 --
229 CURSOR csr_soft_lock is
230 SELECT null
231 FROM HR_SOFT_CODING_KEYFLEX
232 where soft_coding_keyflex_id = p_soft_coding_keyflex_id
233 for update nowait;
234 --
235 l_exists varchar2(30);
236 l_proc varchar2(72) :=g_package||'update_soft_concat_segs_auto';
237 --
238 begin
239 hr_utility.set_location('Entering:'|| l_proc, 10);
240 --
241 -- The outer procedure has already establish that an update is
242 -- required. This sub-procedure uses an autonomous transaction
243 -- to ensure that any commits do not impact the main transaction.
244 -- If the row is successfully locked then continue and update the
245 -- row. If the row cannot be locked then another transaction must
246 -- be performing the update. So it is acceptable for this
247 -- transaction to silently trap the error and continue.
248 --
249 -- Note: It is necessary to perform the lock test because in
250 -- a batch data upload scenario multiple sessions could be
251 -- attempting to insert or update the same Key Flexfield
252 -- combination at the same time. Just directly updating the row,
253 -- without first locking, can cause sessions to hang and reduce
254 -- batch throughput.
255 --
256 open csr_soft_lock;
257 fetch csr_soft_lock into l_exists;
258 if csr_soft_lock%found then
259 close csr_soft_lock;
260 hr_utility.set_location(l_proc, 20);
261 --
262 -- Lock obtained by this transaction, updating the concatenated
263 -- segment string should be performed.
264 --
265 update HR_SOFT_CODING_KEYFLEX
266 set concatenated_segments = p_concat_segments
267 where soft_coding_keyflex_id = p_soft_coding_keyflex_id
268 and (concatenated_segments <> p_concat_segments
269 or concatenated_segments is null);
270 --
271 -- Commit this change so the change is immediately visible to
272 -- other transactions. Also ensuring that it is not undone if
273 -- the main transaction is rolled back. This commit is only
274 -- acceptable inside an API because it is being performed
275 -- inside an autonomous transaction and AOL code has
276 -- previously inserted the Key Flexfield combination row in
277 -- another autonomous transaction.
278 commit;
279 else
280 close csr_soft_lock;
281 end if;
282 --
283 hr_utility.set_location('Leaving:'|| l_proc, 30);
284 Exception
285 When HR_Api.Object_Locked then
286 --
287 -- This autonomous transaction was unable to lock the row.
288 -- It can be assumed that another transaction has locked the
289 -- row and is performing the update. Hence the error can
290 -- be suppressed without raising it to the end user.
291 --
292 hr_utility.set_location('Leaving:'|| l_proc, 40);
293 end update_soft_concat_segs_auto;
294 begin
295 hr_utility.set_location('Entering:'|| l_proc, 10);
296 --
297 -- First find out if it is necessary to update the concatenated
298 -- segment string column. This select is being done to avoid the
299 -- performance unnecessary overhead of set-up an autonomous
300 -- transaction when an update is not required. Updates are only
301 -- expected immediately after the combination row was first
302 -- inserted.
303 --
304 open csr_chk_soft;
305 fetch csr_chk_soft into l_exists;
306 if csr_chk_soft%found then
307 close csr_chk_soft;
308 update_soft_concat_segs_auto
309 (p_soft_coding_keyflex_id => p_soft_coding_keyflex_id
310 ,p_concat_segments => p_concat_segments
311 );
312 else
313 close csr_chk_soft;
314 end if;
315 --
316 hr_utility.set_location('Leaving:'|| l_proc, 40);
317 --
318 end update_soft_concat_segs;
319
320 procedure create_payroll
321 (
322 p_validate in boolean default false,
323 p_effective_date in date,
324 p_payroll_name in varchar2,
325 p_consolidation_set_id in number,
326 p_period_type in varchar2,
327 p_first_period_end_date in date,
328 p_number_of_years in number,
329 p_payroll_type in varchar2 default null,
330 p_pay_date_offset in number default 0,
331 p_direct_deposit_date_offset in number default 0,
332 p_pay_advice_date_offset in number default 0,
333 p_cut_off_date_offset in number default 0,
334 p_midpoint_offset in number default null,
335 p_default_payment_method_id in number default null,
336 p_cost_alloc_keyflex_id_in in number default null,
337 p_susp_account_keyflex_id_in in number default null,
338 p_negative_pay_allowed_flag in varchar2 default 'N',
339 p_gl_set_of_books_id in number default null,
340 p_soft_coding_keyflex_id_in in number default null,
341 p_comments in varchar2 default null,
342 p_attribute_category in varchar2 default null,
343 p_attribute1 in varchar2 default null,
344 p_attribute2 in varchar2 default null,
345 p_attribute3 in varchar2 default null,
346 p_attribute4 in varchar2 default null,
347 p_attribute5 in varchar2 default null,
348 p_attribute6 in varchar2 default null,
349 p_attribute7 in varchar2 default null,
350 p_attribute8 in varchar2 default null,
351 p_attribute9 in varchar2 default null,
352 p_attribute10 in varchar2 default null,
353 p_attribute11 in varchar2 default null,
354 p_attribute12 in varchar2 default null,
355 p_attribute13 in varchar2 default null,
356 p_attribute14 in varchar2 default null,
357 p_attribute15 in varchar2 default null,
358 p_attribute16 in varchar2 default null,
359 p_attribute17 in varchar2 default null,
360 p_attribute18 in varchar2 default null,
361 p_attribute19 in varchar2 default null,
362 p_attribute20 in varchar2 default null,
363 p_arrears_flag in varchar2 default 'N',
364 p_period_reset_years in varchar2 default null,
365 p_multi_assignments_flag in varchar2 default null,
366 p_organization_id in number default null,
367 p_prl_information1 in varchar2 default null,
368 p_prl_information2 in varchar2 default null,
369 p_prl_information3 in varchar2 default null,
370 p_prl_information4 in varchar2 default null,
374 p_prl_information8 in varchar2 default null,
371 p_prl_information5 in varchar2 default null,
372 p_prl_information6 in varchar2 default null,
373 p_prl_information7 in varchar2 default null,
375 p_prl_information9 in varchar2 default null,
376 p_prl_information10 in varchar2 default null,
377 p_prl_information11 in varchar2 default null,
378 p_prl_information12 in varchar2 default null,
379 p_prl_information13 in varchar2 default null,
380 p_prl_information14 in varchar2 default null,
381 p_prl_information15 in varchar2 default null,
382 p_prl_information16 in varchar2 default null,
383 p_prl_information17 in varchar2 default null,
384 p_prl_information18 in varchar2 default null,
385 p_prl_information19 in varchar2 default null,
386 p_prl_information20 in varchar2 default null,
387 p_prl_information21 in varchar2 default null,
388 p_prl_information22 in varchar2 default null,
389 p_prl_information23 in varchar2 default null,
390 p_prl_information24 in varchar2 default null,
391 p_prl_information25 in varchar2 default null,
392 p_prl_information26 in varchar2 default null,
393 p_prl_information27 in varchar2 default null,
394 p_prl_information28 in varchar2 default null,
395 p_prl_information29 in varchar2 default null,
396 p_prl_information30 in varchar2 default null,
397
398 p_cost_segment1 in varchar2 default null,
399 p_cost_segment2 in varchar2 default null,
400 p_cost_segment3 in varchar2 default null,
401 p_cost_segment4 in varchar2 default null,
402 p_cost_segment5 in varchar2 default null,
403 p_cost_segment6 in varchar2 default null,
404 p_cost_segment7 in varchar2 default null,
405 p_cost_segment8 in varchar2 default null,
406 p_cost_segment9 in varchar2 default null,
407 p_cost_segment10 in varchar2 default null,
408 p_cost_segment11 in varchar2 default null,
409 p_cost_segment12 in varchar2 default null,
410 p_cost_segment13 in varchar2 default null,
411 p_cost_segment14 in varchar2 default null,
412 p_cost_segment15 in varchar2 default null,
413 p_cost_segment16 in varchar2 default null,
414 p_cost_segment17 in varchar2 default null,
415 p_cost_segment18 in varchar2 default null,
416 p_cost_segment19 in varchar2 default null,
417 p_cost_segment20 in varchar2 default null,
418 p_cost_segment21 in varchar2 default null,
419 p_cost_segment22 in varchar2 default null,
420 p_cost_segment23 in varchar2 default null,
421 p_cost_segment24 in varchar2 default null,
422 p_cost_segment25 in varchar2 default null,
423 p_cost_segment26 in varchar2 default null,
424 p_cost_segment27 in varchar2 default null,
425 p_cost_segment28 in varchar2 default null,
426 p_cost_segment29 in varchar2 default null,
427 p_cost_segment30 in varchar2 default null,
428 p_cost_concat_segments_in in varchar2 default null,
429
430 p_susp_segment1 in varchar2 default null,
431 p_susp_segment2 in varchar2 default null,
432 p_susp_segment3 in varchar2 default null,
433 p_susp_segment4 in varchar2 default null,
434 p_susp_segment5 in varchar2 default null,
435 p_susp_segment6 in varchar2 default null,
436 p_susp_segment7 in varchar2 default null,
437 p_susp_segment8 in varchar2 default null,
438 p_susp_segment9 in varchar2 default null,
439 p_susp_segment10 in varchar2 default null,
440 p_susp_segment11 in varchar2 default null,
441 p_susp_segment12 in varchar2 default null,
442 p_susp_segment13 in varchar2 default null,
443 p_susp_segment14 in varchar2 default null,
444 p_susp_segment15 in varchar2 default null,
445 p_susp_segment16 in varchar2 default null,
446 p_susp_segment17 in varchar2 default null,
447 p_susp_segment18 in varchar2 default null,
448 p_susp_segment19 in varchar2 default null,
449 p_susp_segment20 in varchar2 default null,
450 p_susp_segment21 in varchar2 default null,
451 p_susp_segment22 in varchar2 default null,
452 p_susp_segment23 in varchar2 default null,
453 p_susp_segment24 in varchar2 default null,
454 p_susp_segment25 in varchar2 default null,
455 p_susp_segment26 in varchar2 default null,
456 p_susp_segment27 in varchar2 default null,
457 p_susp_segment28 in varchar2 default null,
458 p_susp_segment29 in varchar2 default null,
459 p_susp_segment30 in varchar2 default null,
460 p_susp_concat_segments_in in varchar2 default null,
461
465 p_scl_segment4 in varchar2 default null,
462 p_scl_segment1 in varchar2 default null,
463 p_scl_segment2 in varchar2 default null,
464 p_scl_segment3 in varchar2 default null,
466 p_scl_segment5 in varchar2 default null,
467 p_scl_segment6 in varchar2 default null,
468 p_scl_segment7 in varchar2 default null,
469 p_scl_segment8 in varchar2 default null,
470 p_scl_segment9 in varchar2 default null,
471 p_scl_segment10 in varchar2 default null,
472 p_scl_segment11 in varchar2 default null,
473 p_scl_segment12 in varchar2 default null,
474 p_scl_segment13 in varchar2 default null,
475 p_scl_segment14 in varchar2 default null,
476 p_scl_segment15 in varchar2 default null,
477 p_scl_segment16 in varchar2 default null,
478 p_scl_segment17 in varchar2 default null,
479 p_scl_segment18 in varchar2 default null,
480 p_scl_segment19 in varchar2 default null,
481 p_scl_segment20 in varchar2 default null,
482 p_scl_segment21 in varchar2 default null,
483 p_scl_segment22 in varchar2 default null,
484 p_scl_segment23 in varchar2 default null,
485 p_scl_segment24 in varchar2 default null,
486 p_scl_segment25 in varchar2 default null,
487 p_scl_segment26 in varchar2 default null,
488 p_scl_segment27 in varchar2 default null,
489 p_scl_segment28 in varchar2 default null,
490 p_scl_segment29 in varchar2 default null,
491 p_scl_segment30 in varchar2 default null,
492 p_scl_concat_segments_in in varchar2 default null,
493
494 p_workload_shifting_level in varchar2 default 'N',
495 p_payslip_view_date_offset in number default null,
496
497 p_payroll_id out nocopy number,
498 p_org_pay_method_usage_id out nocopy number,
499 p_prl_object_version_number out nocopy number,
500 p_opm_object_version_number out nocopy number,
501 p_prl_effective_start_date out nocopy date,
502 p_prl_effective_end_date out nocopy date,
503 p_opm_effective_start_date out nocopy date,
504 p_opm_effective_end_date out nocopy date,
505 p_comment_id out nocopy number,
506
507 p_cost_alloc_keyflex_id_out out nocopy number,
508 p_susp_account_keyflex_id_out out nocopy number,
509 p_soft_coding_keyflex_id_out out nocopy number,
510
511 p_cost_concat_segments_out out nocopy varchar2,
512 p_susp_concat_segments_out out nocopy varchar2,
513 p_scl_concat_segments_out out nocopy varchar2
514
515 ) is
516
517 l_effective_date date;
518 l_first_period_end_date date;
519
520 l_payroll_id pay_all_payrolls_f.payroll_id%type;
521 l_object_version_number pay_all_payrolls_f.object_version_number%type;
522 l_effective_start_date pay_all_payrolls_f.effective_start_date%type;
523 l_effective_end_date pay_all_payrolls_f.effective_end_date%type;
524 c_eot constant date := to_date('4712/12/31','YYYY/MM/DD');
525 l_opm_object_version_number number;
526 l_created_by pay_all_payrolls_f.created_by%TYPE;
527 l_creation_date pay_all_payrolls_f.creation_date%TYPE;
528 l_last_update_date pay_all_payrolls_f.last_update_date%TYPE := sysdate;
529 l_last_updated_by pay_all_payrolls_f.last_updated_by%TYPE := fnd_global.user_id;
530 l_last_update_login pay_all_payrolls_f.last_update_login%TYPE := fnd_global.login_id;
531 l_comment_id pay_all_payrolls_f.comment_id%TYPE := p_comment_id;
532 l_prl_information_category pay_all_payrolls_f.prl_information_category%TYPE := null;
533 l_org_pay_method_usage_id number;
534 l_workload_shifting_level varchar2(30) :='N';
535 l_dummy number(15);
536
537
538
539 l_proc varchar2(72) := g_package||'create_payroll';
540
541 l_cost_id_flex_num fnd_id_flex_segments.id_flex_num%TYPE;
542 l_susp_id_flex_num fnd_id_flex_segments.id_flex_num%TYPE;
543 l_scl_id_flex_num fnd_id_flex_segments.id_flex_num%TYPE;
544 l_business_group_id pay_all_payrolls_f.business_group_id%TYPE;
545 l_legislation_code varchar2(150);
546
547 l_cost_concat_segments PAY_COST_ALLOCATION_KEYFLEX.concatenated_segments%TYPE := p_cost_concat_segments_in;
548 l_susp_concat_segments PAY_COST_ALLOCATION_KEYFLEX.concatenated_segments%TYPE := p_susp_concat_segments_in;
549 l_scl_concat_segments HR_SOFT_CODING_KEYFLEX.concatenated_segments%TYPE := p_scl_concat_segments_in;
550
551 l_cost_allocation_keyflex_id PAY_ALL_PAYROLLS_F.COST_ALLOCATION_KEYFLEX_ID%TYPE := p_cost_alloc_keyflex_id_in;
552 l_suspense_account_keyflex_id PAY_ALL_PAYROLLS_F.SUSPENSE_ACCOUNT_KEYFLEX_ID%TYPE := p_susp_account_keyflex_id_in;
553 l_soft_coding_keyflex_id PAY_ALL_PAYROLLS_F.SOFT_CODING_KEYFLEX_ID%TYPE := p_soft_coding_keyflex_id_in;
554
555
556 --Cursor for fetching the Cost allocation structure id from the business group.
557 cursor csr_cost_id_flex_num(c_business_group_id PER_BUSINESS_GROUPS_PERF.business_group_id%TYPE) is
561
558 select bg.cost_allocation_structure
559 from PER_BUSINESS_GROUPS_PERF bg
560 where bg.business_group_id = c_business_group_id;
562
563 --Cursor for fetching the Soft coding structure id from the business group.
564 cursor csr_soft_id_flex_num(c_legislation_code pay_legislation_rules.legislation_code%TYPE) is
565 select lr.rule_mode
566 from pay_legislation_rules lr
567 where lr.legislation_code = c_legislation_code
568 and upper(lr.rule_type) = 'S';
569
570 --Cursor for checking whether the given Cost Keyflex id is there or not
571 cursor csr_cost_alloc_exists(c_cost_allocation_keyflex_id PAY_ALL_PAYROLLS_F.COST_ALLOCATION_KEYFLEX_ID%TYPE) is
572 select pca.cost_allocation_keyflex_id
573 from pay_cost_allocation_keyflex pca
574 where pca.cost_allocation_keyflex_id = c_cost_allocation_keyflex_id;
575
576 --Cursor for checking whether the given Soft coding Keyflex id is there or not.
577 cursor csr_soft_coding_exists(c_soft_coding_keyflex_id HR_SOFT_CODING_KEYFLEX.SOFT_CODING_KEYFLEX_ID%TYPE) is
578 select scl.soft_coding_keyflex_id
579 from HR_SOFT_CODING_KEYFLEX scl
580 where scl.soft_coding_keyflex_id = c_soft_coding_keyflex_id;
581
582 begin
583
584 hr_utility.set_location(' Entering:'||l_proc, 10);
585
586 --Truncate the time component from the date field.
587
588 l_effective_date := trunc(p_effective_date);
589 l_first_period_end_date := trunc(p_first_period_end_date);
590
591 l_effective_start_date := l_effective_date;
592 l_effective_end_date := c_eot;
593
594 l_created_by := l_last_updated_by;
595 l_creation_date := l_last_update_date;
596
597 --
598 -- Standard savepoint.
599 --
600 savepoint create_payroll;
601
602 --
603 --Get the business group id.
604 --
605 pay_pay_bus.chk_consolidation_set_id(p_consolidation_set_id,l_business_group_id);
606
607 --
608 --Get the Legislation code.
609 --
610 l_legislation_code := hr_api.return_legislation_code(l_business_group_id);
611
612 --
613 -- Validate the business group and set the CLIENT_INFO.
614 --
615 hr_api.validate_bus_grp_id
616 (p_business_group_id => l_business_group_id
617 ,p_associated_column1 => 'PAY_ALL_PAYROLLS_F'
618 || '.BUSINESS_GROUP_ID');
619
620 --
621 --Checking whether the specified cost allocation kff ID is there.
622 --If it is not there, it will raise an error.
623 --
624 if(p_cost_alloc_keyflex_id_in is not null) then
625 --
626 open csr_cost_alloc_exists(p_cost_alloc_keyflex_id_in);
627 fetch csr_cost_alloc_exists into l_dummy;
628 if (csr_cost_alloc_exists%NOTFOUND) then
629 --
630 close csr_cost_alloc_exists;
631 fnd_message.set_name('PAY','PAY_33085_INVALID_FK');
632 fnd_message.set_token('COLUMN','COST_ALLOCATION_KEYFLEX_ID');
633 fnd_message.set_token('TABLE','PAY_COST_ALLOCATION_KEYFLEX');
634 fnd_message.raise_error;
635 --
636 end if;
637 close csr_cost_alloc_exists;
638 --
639 end if;
640
641 --
642 --Checking whether the specified suspence account kff ID is there.
643 --If it is not there, it will raise an error.
644 --
645 if (p_susp_account_keyflex_id_in is not null) then
646 --
647 open csr_cost_alloc_exists(p_susp_account_keyflex_id_in);
648 fetch csr_cost_alloc_exists into l_dummy;
649 if (csr_cost_alloc_exists%NOTFOUND) then
650 --
651 close csr_cost_alloc_exists;
652 fnd_message.set_name('PAY','PAY_33085_INVALID_FK');
653 fnd_message.set_token('COLUMN','SUSPENSE_ACCOUNT_KEYFLEX_ID');
654 fnd_message.set_token('TABLE','PAY_COST_ALLOCATION_KEYFLEX');
655 fnd_message.raise_error;
656 --
657 end if;
658 close csr_cost_alloc_exists;
659 --
660 end if;
661
662 --
663 --Checking whether the specified soft coding kff ID is there.
664 --If it is not there, it will raise an error.
665 --
666 if(p_soft_coding_keyflex_id_in is not null) then
667 --
668 open csr_soft_coding_exists(p_soft_coding_keyflex_id_in);
669 fetch csr_soft_coding_exists into l_dummy;
670 if (csr_soft_coding_exists%NOTFOUND) then
671 --
672 close csr_soft_coding_exists;
673 fnd_message.set_name('PAY','PAY_33085_INVALID_FK');
674 fnd_message.set_token('COLUMN','SOFT_CODING_KEYFLEX_ID');
675 fnd_message.set_token('TABLE','HR_SOFT_CODING_KEYFLEX');
676 fnd_message.raise_error;
677 --
678 end if;
679 close csr_soft_coding_exists;
680 --
681 end if;
682
683 --
684 -- Call Before Process User Hook
685 --
686 begin
687 pay_payroll_bk1.create_payroll_b
688 (p_effective_date => l_effective_date
689 ,p_payroll_name => p_payroll_name
690 ,p_payroll_type => p_payroll_type
691 ,p_period_type => p_period_type
692 ,p_first_period_end_date => l_first_period_end_date
693 ,p_number_of_years => p_number_of_years
694 ,p_pay_date_offset => p_pay_date_offset
695 ,p_direct_deposit_date_offset => p_direct_deposit_date_offset
696 ,p_pay_advice_date_offset => p_pay_advice_date_offset
700 ,p_consolidation_set_id => p_consolidation_set_id
697 ,p_cut_off_date_offset => p_cut_off_date_offset
698 ,p_midpoint_offset => p_midpoint_offset
699 ,p_default_payment_method_id => p_default_payment_method_id
701 ,p_cost_alloc_keyflex_id_in => p_cost_alloc_keyflex_id_in
702 ,p_susp_account_keyflex_id_in => p_susp_account_keyflex_id_in
703 ,p_negative_pay_allowed_flag => p_negative_pay_allowed_flag
704 ,p_gl_set_of_books_id => p_gl_set_of_books_id
705 ,p_soft_coding_keyflex_id_in => p_soft_coding_keyflex_id_in
706 ,p_comments => p_comments
707 ,p_attribute_category => p_attribute_category
708 ,p_attribute1 => p_attribute1
709 ,p_attribute2 => p_attribute2
710 ,p_attribute3 => p_attribute3
711 ,p_attribute4 => p_attribute4
712 ,p_attribute5 => p_attribute5
713 ,p_attribute6 => p_attribute6
714 ,p_attribute7 => p_attribute7
715 ,p_attribute8 => p_attribute8
716 ,p_attribute9 => p_attribute9
717 ,p_attribute10 => p_attribute10
718 ,p_attribute11 => p_attribute11
719 ,p_attribute12 => p_attribute12
720 ,p_attribute13 => p_attribute13
721 ,p_attribute14 => p_attribute14
722 ,p_attribute15 => p_attribute15
723 ,p_attribute16 => p_attribute16
724 ,p_attribute17 => p_attribute17
725 ,p_attribute18 => p_attribute18
726 ,p_attribute19 => p_attribute19
727 ,p_attribute20 => p_attribute20
728 ,p_arrears_flag => p_arrears_flag
729 ,p_period_reset_years => p_period_reset_years
730 ,p_multi_assignments_flag => p_multi_assignments_flag
731 ,p_organization_id => p_organization_id
732 ,p_prl_information1 => p_prl_information1
733 ,p_prl_information2 => p_prl_information2
734 ,p_prl_information3 => p_prl_information3
735 ,p_prl_information4 => p_prl_information4
736 ,p_prl_information5 => p_prl_information5
737 ,p_prl_information6 => p_prl_information6
738 ,p_prl_information7 => p_prl_information7
739 ,p_prl_information8 => p_prl_information8
740 ,p_prl_information9 => p_prl_information9
741 ,p_prl_information10 => p_prl_information10
742 ,p_prl_information11 => p_prl_information11
743 ,p_prl_information12 => p_prl_information12
744 ,p_prl_information13 => p_prl_information13
745 ,p_prl_information14 => p_prl_information14
746 ,p_prl_information15 => p_prl_information15
747 ,p_prl_information16 => p_prl_information16
748 ,p_prl_information17 => p_prl_information17
749 ,p_prl_information18 => p_prl_information18
750 ,p_prl_information19 => p_prl_information19
751 ,p_prl_information20 => p_prl_information20
752 ,p_prl_information21 => p_prl_information21
753 ,p_prl_information22 => p_prl_information22
754 ,p_prl_information23 => p_prl_information23
755 ,p_prl_information24 => p_prl_information24
756 ,p_prl_information25 => p_prl_information25
757 ,p_prl_information26 => p_prl_information26
758 ,p_prl_information27 => p_prl_information27
759 ,p_prl_information28 => p_prl_information28
760 ,p_prl_information29 => p_prl_information29
761 ,p_prl_information30 => p_prl_information30
762
763 ,p_cost_segment1 => p_cost_segment1
764 ,p_cost_segment2 => p_cost_segment2
765 ,p_cost_segment3 => p_cost_segment3
766 ,p_cost_segment4 => p_cost_segment4
767 ,p_cost_segment5 => p_cost_segment5
768 ,p_cost_segment6 => p_cost_segment6
769 ,p_cost_segment7 => p_cost_segment7
770 ,p_cost_segment8 => p_cost_segment8
771 ,p_cost_segment9 => p_cost_segment9
772 ,p_cost_segment10 => p_cost_segment10
773 ,p_cost_segment11 => p_cost_segment11
774 ,p_cost_segment12 => p_cost_segment12
775 ,p_cost_segment13 => p_cost_segment13
776 ,p_cost_segment14 => p_cost_segment14
777 ,p_cost_segment15 => p_cost_segment15
778 ,p_cost_segment16 => p_cost_segment16
779 ,p_cost_segment17 => p_cost_segment17
780 ,p_cost_segment18 => p_cost_segment18
781 ,p_cost_segment19 => p_cost_segment19
782 ,p_cost_segment20 => p_cost_segment20
783 ,p_cost_segment21 => p_cost_segment21
784 ,p_cost_segment22 => p_cost_segment22
785 ,p_cost_segment23 => p_cost_segment23
786 ,p_cost_segment24 => p_cost_segment24
787 ,p_cost_segment25 => p_cost_segment25
788 ,p_cost_segment26 => p_cost_segment26
789 ,p_cost_segment27 => p_cost_segment27
790 ,p_cost_segment28 => p_cost_segment28
791 ,p_cost_segment29 => p_cost_segment29
792 ,p_cost_segment30 => p_cost_segment30
793 ,p_cost_concat_segments_in => p_cost_concat_segments_in
794
798 ,p_susp_segment4 => p_susp_segment4
795 ,p_susp_segment1 => p_susp_segment1
796 ,p_susp_segment2 => p_susp_segment2
797 ,p_susp_segment3 => p_susp_segment3
799 ,p_susp_segment5 => p_susp_segment5
800 ,p_susp_segment6 => p_susp_segment6
801 ,p_susp_segment7 => p_susp_segment7
802 ,p_susp_segment8 => p_susp_segment8
803 ,p_susp_segment9 => p_susp_segment9
804 ,p_susp_segment10 => p_susp_segment10
805 ,p_susp_segment11 => p_susp_segment11
806 ,p_susp_segment12 => p_susp_segment12
807 ,p_susp_segment13 => p_susp_segment13
808 ,p_susp_segment14 => p_susp_segment14
809 ,p_susp_segment15 => p_susp_segment15
810 ,p_susp_segment16 => p_susp_segment16
811 ,p_susp_segment17 => p_susp_segment17
812 ,p_susp_segment18 => p_susp_segment18
813 ,p_susp_segment19 => p_susp_segment19
814 ,p_susp_segment20 => p_susp_segment20
815 ,p_susp_segment21 => p_susp_segment21
816 ,p_susp_segment22 => p_susp_segment22
817 ,p_susp_segment23 => p_susp_segment23
818 ,p_susp_segment24 => p_susp_segment24
819 ,p_susp_segment25 => p_susp_segment25
820 ,p_susp_segment26 => p_susp_segment26
821 ,p_susp_segment27 => p_susp_segment27
822 ,p_susp_segment28 => p_susp_segment28
823 ,p_susp_segment29 => p_susp_segment29
824 ,p_susp_segment30 => p_susp_segment30
825 ,p_susp_concat_segments_in => p_susp_concat_segments_in
826
827 ,p_scl_segment1 => p_scl_segment1
828 ,p_scl_segment2 => p_scl_segment2
829 ,p_scl_segment3 => p_scl_segment3
830 ,p_scl_segment4 => p_scl_segment4
831 ,p_scl_segment5 => p_scl_segment5
832 ,p_scl_segment6 => p_scl_segment6
833 ,p_scl_segment7 => p_scl_segment7
834 ,p_scl_segment8 => p_scl_segment8
835 ,p_scl_segment9 => p_scl_segment9
836 ,p_scl_segment10 => p_scl_segment10
837 ,p_scl_segment11 => p_scl_segment11
838 ,p_scl_segment12 => p_scl_segment12
839 ,p_scl_segment13 => p_scl_segment13
840 ,p_scl_segment14 => p_scl_segment14
841 ,p_scl_segment15 => p_scl_segment15
842 ,p_scl_segment16 => p_scl_segment16
843 ,p_scl_segment17 => p_scl_segment17
844 ,p_scl_segment18 => p_scl_segment18
845 ,p_scl_segment19 => p_scl_segment19
846 ,p_scl_segment20 => p_scl_segment20
847 ,p_scl_segment21 => p_scl_segment21
848 ,p_scl_segment22 => p_scl_segment22
849 ,p_scl_segment23 => p_scl_segment23
850 ,p_scl_segment24 => p_scl_segment24
851 ,p_scl_segment25 => p_scl_segment25
852 ,p_scl_segment26 => p_scl_segment26
853 ,p_scl_segment27 => p_scl_segment27
854 ,p_scl_segment28 => p_scl_segment28
855 ,p_scl_segment29 => p_scl_segment29
856 ,p_scl_segment30 => p_scl_segment30
857 ,p_scl_concat_segments_in => p_scl_concat_segments_in
858 ,p_business_group_id => l_business_group_id
859 ,p_workload_shifting_level => p_workload_shifting_level
860 ,p_payslip_view_date_offset => p_payslip_view_date_offset
861 );
862 exception
863 when hr_api.cannot_find_prog_unit then
864 hr_api.cannot_find_prog_unit_error
865 (p_module_name => 'create_payroll'
866 ,p_hook_type => 'BP'
867 );
868 end;
869
870 --
871 --Insert the segment values in to the respective KeyFlexFields table
872 --and get the Combination_id of the inserted row.
873 --
874 if (p_cost_alloc_keyflex_id_in is null)
875 and (p_cost_segment1 is not null or
876 p_cost_segment2 is not null or p_cost_segment3 is not null or
877 p_cost_segment4 is not null or p_cost_segment5 is not null or
878 p_cost_segment6 is not null or p_cost_segment7 is not null or
879 p_cost_segment8 is not null or p_cost_segment9 is not null or
880 p_cost_segment10 is not null or p_cost_segment11 is not null or
881 p_cost_segment12 is not null or p_cost_segment13 is not null or
882 p_cost_segment14 is not null or p_cost_segment15 is not null or
883 p_cost_segment16 is not null or p_cost_segment17 is not null or
884 p_cost_segment18 is not null or p_cost_segment19 is not null or
885 p_cost_segment20 is not null or p_cost_segment21 is not null or
886 p_cost_segment22 is not null or p_cost_segment23 is not null or
887 p_cost_segment24 is not null or p_cost_segment25 is not null or
888 p_cost_segment26 is not null or p_cost_segment27 is not null or
889 p_cost_segment28 is not null or p_cost_segment29 is not null or
890 p_cost_segment30 is not null or
891 p_cost_concat_segments_in is not null) then
892 --
893 --
894 -- Fetch the ID_FLEX_NUM from the specified business group.
895 --
896 open csr_cost_id_flex_num(l_business_group_id);
897 fetch csr_cost_id_flex_num into l_cost_id_flex_num;
898 close csr_cost_id_flex_num;
899
900 hr_kflex_utility.ins_or_sel_keyflex_comb(
904 ,p_segment1 => p_cost_segment1
901 p_appl_short_name => 'PAY'
902 ,p_flex_code => 'COST'
903 ,p_flex_num => l_cost_id_flex_num
905 ,p_segment2 => p_cost_segment2
906 ,p_segment3 => p_cost_segment3
907 ,p_segment4 => p_cost_segment4
908 ,p_segment5 => p_cost_segment5
909 ,p_segment6 => p_cost_segment6
910 ,p_segment7 => p_cost_segment7
911 ,p_segment8 => p_cost_segment8
912 ,p_segment9 => p_cost_segment9
913 ,p_segment10 => p_cost_segment10
914 ,p_segment11 => p_cost_segment11
915 ,p_segment12 => p_cost_segment12
916 ,p_segment13 => p_cost_segment13
917 ,p_segment14 => p_cost_segment14
918 ,p_segment15 => p_cost_segment15
919 ,p_segment16 => p_cost_segment16
920 ,p_segment17 => p_cost_segment17
921 ,p_segment18 => p_cost_segment18
922 ,p_segment19 => p_cost_segment19
923 ,p_segment20 => p_cost_segment20
924 ,p_segment21 => p_cost_segment21
925 ,p_segment22 => p_cost_segment22
926 ,p_segment23 => p_cost_segment23
927 ,p_segment24 => p_cost_segment24
928 ,p_segment25 => p_cost_segment25
929 ,p_segment26 => p_cost_segment26
930 ,p_segment27 => p_cost_segment27
931 ,p_segment28 => p_cost_segment28
932 ,p_segment29 => p_cost_segment29
933 ,p_segment30 => p_cost_segment30
934 ,p_concat_segments_in => p_cost_concat_segments_in
935 ,p_ccid => l_cost_allocation_keyflex_id
936 ,p_concat_segments_out => l_cost_concat_segments
937 );
938
939 --Calling the update_cost_concat_segs to update the concat segments into the row.
940 update_cost_concat_segs(p_cost_alloc_keyflex_id => l_cost_allocation_keyflex_id
941 ,p_concat_segments => l_cost_concat_segments);
942 --
943 end if;
944 --
945 --Insert the segment values in to the respective KeyFlexFields table
946 --and get the Combination_id of the inserted row.
947 --
948 if (p_susp_account_keyflex_id_in is null)
949 and (p_susp_segment1 is not null or p_susp_segment2 is not null or
950 p_susp_segment3 is not null or p_susp_segment4 is not null or
951 p_susp_segment5 is not null or p_susp_segment6 is not null or
952 p_susp_segment7 is not null or p_susp_segment8 is not null or
953 p_susp_segment9 is not null or p_susp_segment10 is not null or
954 p_susp_segment11 is not null or p_susp_segment12 is not null or
955 p_susp_segment13 is not null or p_susp_segment14 is not null or
956 p_susp_segment15 is not null or p_susp_segment16 is not null or
957 p_susp_segment17 is not null or p_susp_segment18 is not null or
958 p_susp_segment19 is not null or p_susp_segment20 is not null or
959 p_susp_segment21 is not null or p_susp_segment22 is not null or
960 p_susp_segment23 is not null or p_susp_segment24 is not null or
961 p_susp_segment25 is not null or p_susp_segment26 is not null or
962 p_susp_segment27 is not null or p_susp_segment28 is not null or
963 p_susp_segment29 is not null or p_susp_segment30 is not null or
964 p_susp_concat_segments_in is not null) then
965 --
966 --
967 -- Fetch the ID_FLEX_NUM from the specified business group.
968 --
969 open csr_cost_id_flex_num(l_business_group_id);
970 fetch csr_cost_id_flex_num into l_susp_id_flex_num;
971 close csr_cost_id_flex_num;
972
973 hr_kflex_utility.ins_or_sel_keyflex_comb(
974 p_appl_short_name => 'PAY'
975 ,p_flex_code => 'COST'
976 ,p_flex_num => l_susp_id_flex_num
977 ,p_segment1 => p_susp_segment1
978 ,p_segment2 => p_susp_segment2
979 ,p_segment3 => p_susp_segment3
980 ,p_segment4 => p_susp_segment4
981 ,p_segment5 => p_susp_segment5
982 ,p_segment6 => p_susp_segment6
983 ,p_segment7 => p_susp_segment7
984 ,p_segment8 => p_susp_segment8
985 ,p_segment9 => p_susp_segment9
986 ,p_segment10 => p_susp_segment10
987 ,p_segment11 => p_susp_segment11
988 ,p_segment12 => p_susp_segment12
989 ,p_segment13 => p_susp_segment13
990 ,p_segment14 => p_susp_segment14
991 ,p_segment15 => p_susp_segment15
992 ,p_segment16 => p_susp_segment16
993 ,p_segment17 => p_susp_segment17
994 ,p_segment18 => p_susp_segment18
995 ,p_segment19 => p_susp_segment19
996 ,p_segment20 => p_susp_segment20
997 ,p_segment21 => p_susp_segment21
998 ,p_segment22 => p_susp_segment22
999 ,p_segment23 => p_susp_segment23
1000 ,p_segment24 => p_susp_segment24
1001 ,p_segment25 => p_susp_segment25
1002 ,p_segment26 => p_susp_segment26
1003 ,p_segment27 => p_susp_segment27
1004 ,p_segment28 => p_susp_segment28
1005 ,p_segment29 => p_susp_segment29
1006 ,p_segment30 => p_susp_segment30
1007 ,p_concat_segments_in => p_susp_concat_segments_in
1008 ,p_ccid => l_suspense_account_keyflex_id
1009 ,p_concat_segments_out => l_susp_concat_segments
1010 );
1014 end if;
1011 update_cost_concat_segs(p_cost_alloc_keyflex_id => l_suspense_account_keyflex_id
1012 ,p_concat_segments => l_susp_concat_segments);
1013 --
1015 --
1016 if (p_soft_coding_keyflex_id_in is null)
1017 and(p_scl_segment1 is not null or p_scl_segment2 is not null or
1018 p_scl_segment3 is not null or p_scl_segment4 is not null or
1019 p_scl_segment5 is not null or p_scl_segment6 is not null or
1020 p_scl_segment7 is not null or p_scl_segment8 is not null or
1021 p_scl_segment9 is not null or p_scl_segment10 is not null or
1022 p_scl_segment11 is not null or p_scl_segment12 is not null or
1023 p_scl_segment13 is not null or p_scl_segment14 is not null or
1024 p_scl_segment15 is not null or p_scl_segment16 is not null or
1025 p_scl_segment17 is not null or p_scl_segment18 is not null or
1026 p_scl_segment19 is not null or p_scl_segment20 is not null or
1027 p_scl_segment21 is not null or p_scl_segment22 is not null or
1028 p_scl_segment23 is not null or p_scl_segment24 is not null or
1029 p_scl_segment25 is not null or p_scl_segment26 is not null or
1030 p_scl_segment27 is not null or p_scl_segment28 is not null or
1031 p_scl_segment29 is not null or p_scl_segment30 is not null or
1032 p_scl_concat_segments_in is not null ) then
1033 --
1034 --
1035 -- Fetch the ID_FLEX_NUM from the legislation code.
1036 --
1037 open csr_soft_id_flex_num(l_legislation_code);
1038 fetch csr_soft_id_flex_num into l_scl_id_flex_num;
1039 close csr_soft_id_flex_num;
1040
1041 hr_kflex_utility.ins_or_sel_keyflex_comb(
1042 p_appl_short_name => 'PER'
1043 ,p_flex_code => 'SCL'
1044 ,p_flex_num => l_scl_id_flex_num
1045 ,p_segment1 => p_scl_segment1
1046 ,p_segment2 => p_scl_segment2
1047 ,p_segment3 => p_scl_segment3
1048 ,p_segment4 => p_scl_segment4
1049 ,p_segment5 => p_scl_segment5
1050 ,p_segment6 => p_scl_segment6
1051 ,p_segment7 => p_scl_segment7
1052 ,p_segment8 => p_scl_segment8
1053 ,p_segment9 => p_scl_segment9
1054 ,p_segment10 => p_scl_segment10
1055 ,p_segment11 => p_scl_segment11
1056 ,p_segment12 => p_scl_segment12
1057 ,p_segment13 => p_scl_segment13
1058 ,p_segment14 => p_scl_segment14
1059 ,p_segment15 => p_scl_segment15
1060 ,p_segment16 => p_scl_segment16
1061 ,p_segment17 => p_scl_segment17
1062 ,p_segment18 => p_scl_segment18
1063 ,p_segment19 => p_scl_segment19
1064 ,p_segment20 => p_scl_segment20
1065 ,p_segment21 => p_scl_segment21
1066 ,p_segment22 => p_scl_segment22
1067 ,p_segment23 => p_scl_segment23
1068 ,p_segment24 => p_scl_segment24
1069 ,p_segment25 => p_scl_segment25
1070 ,p_segment26 => p_scl_segment26
1071 ,p_segment27 => p_scl_segment27
1072 ,p_segment28 => p_scl_segment28
1073 ,p_segment29 => p_scl_segment29
1074 ,p_segment30 => p_scl_segment30
1075 ,p_concat_segments_in => p_scl_concat_segments_in
1076 ,p_ccid => l_soft_coding_keyflex_id
1077 ,p_concat_segments_out => l_scl_concat_segments
1078 );
1079 --Need to call this procedure in the future if it's required to populate the
1080 --concatenated segments when the individual segments are given.
1081 --update_soft_concat_segs(p_soft_coding_keyflex_id => l_soft_coding_keyflex_id
1082 -- ,p_concat_segments => l_scl_concat_segments);
1083
1084 --
1085 end if;
1086
1087 -- Checking whether the user is passed any value to any
1088 -- one of the segment values.If any value is there then need to
1089 -- derive the information category.
1090 if ((p_prl_information1 is not null) or (p_prl_information2 is not null) or
1091 (p_prl_information3 is not null) or (p_prl_information4 is not null) or
1092 (p_prl_information5 is not null) or (p_prl_information6 is not null) or
1093 (p_prl_information7 is not null) or (p_prl_information8 is not null) or
1094 (p_prl_information9 is not null) or (p_prl_information10 is not null) or
1095 (p_prl_information11 is not null) or (p_prl_information12 is not null) or
1096 (p_prl_information13 is not null) or (p_prl_information14 is not null) or
1097 (p_prl_information15 is not null) or (p_prl_information16 is not null) or
1098 (p_prl_information17 is not null) or (p_prl_information18 is not null) or
1099 (p_prl_information19 is not null) or (p_prl_information20 is not null) or
1100 (p_prl_information21 is not null) or (p_prl_information22 is not null) or
1104 (p_prl_information29 is not null) or (p_prl_information30 is not null)) then
1101 (p_prl_information23 is not null) or (p_prl_information24 is not null) or
1102 (p_prl_information25 is not null) or (p_prl_information26 is not null) or
1103 (p_prl_information27 is not null) or (p_prl_information28 is not null) or
1105 --
1106 l_prl_information_category := l_legislation_code;
1107 --
1108 end if;
1109
1110 pay_pay_ins.ins(
1111 p_effective_date => l_effective_date,
1112 p_consolidation_set_id => p_consolidation_set_id,
1113 p_period_type => p_period_type,
1114 p_cut_off_date_offset => p_cut_off_date_offset,
1115 p_direct_deposit_date_offset => p_direct_deposit_date_offset,
1116 p_first_period_end_date => l_first_period_end_date,
1117 p_negative_pay_allowed_flag => p_negative_pay_allowed_flag,
1118 p_number_of_years => p_number_of_years,
1119 p_pay_advice_date_offset => p_pay_advice_date_offset,
1120 p_pay_date_offset => p_pay_date_offset,
1121 p_payroll_name => p_payroll_name,
1122 p_workload_shifting_level => p_workload_shifting_level,
1123 p_default_payment_method_id => p_default_payment_method_id,
1124 p_cost_allocation_keyflex_id => l_cost_allocation_keyflex_id,
1125 p_suspense_account_keyflex_id=> l_suspense_account_keyflex_id,
1126 p_gl_set_of_books_id => p_gl_set_of_books_id,
1127 p_soft_coding_keyflex_id => l_soft_coding_keyflex_id,
1128 p_organization_id => p_organization_id,
1129 p_comments => p_comments,
1130 p_midpoint_offset => p_midpoint_offset,
1131 p_attribute_category => p_attribute_category,
1132 p_attribute1 => p_attribute1,
1133 p_attribute2 => p_attribute2,
1134 p_attribute3 => p_attribute3,
1135 p_attribute4 => p_attribute4,
1136 p_attribute5 => p_attribute5,
1137 p_attribute6 => p_attribute6,
1138 p_attribute7 => p_attribute7,
1139 p_attribute8 => p_attribute8,
1140 p_attribute9 => p_attribute9,
1141 p_attribute10 => p_attribute10,
1142 p_attribute11 => p_attribute11,
1143 p_attribute12 => p_attribute12,
1144 p_attribute13 => p_attribute13,
1145 p_attribute14 => p_attribute14,
1146 p_attribute15 => p_attribute15,
1147 p_attribute16 => p_attribute16,
1148 p_attribute17 => p_attribute17,
1149 p_attribute18 => p_attribute18,
1150 p_attribute19 => p_attribute19,
1151 p_attribute20 => p_attribute20,
1152 p_arrears_flag => p_arrears_flag,
1153 p_payroll_type => p_payroll_type,
1154 p_prl_information_category => l_prl_information_category,
1155 p_prl_information1 => p_prl_information1,
1156 p_prl_information2 => p_prl_information2,
1157 p_prl_information3 => p_prl_information3,
1158 p_prl_information4 => p_prl_information4,
1159 p_prl_information5 => p_prl_information5,
1160 p_prl_information6 => p_prl_information6,
1161 p_prl_information7 => p_prl_information7,
1162 p_prl_information8 => p_prl_information8,
1163 p_prl_information9 => p_prl_information9,
1164 p_prl_information10 => p_prl_information10,
1165 p_prl_information11 => p_prl_information11,
1166 p_prl_information12 => p_prl_information12,
1167 p_prl_information13 => p_prl_information13,
1168 p_prl_information14 => p_prl_information14,
1169 p_prl_information15 => p_prl_information15,
1170 p_prl_information16 => p_prl_information16,
1171 p_prl_information17 => p_prl_information17,
1172 p_prl_information18 => p_prl_information18,
1173 p_prl_information19 => p_prl_information19,
1174 p_prl_information20 => p_prl_information20,
1175 p_prl_information21 => p_prl_information21,
1176 p_prl_information22 => p_prl_information22,
1177 p_prl_information23 => p_prl_information23,
1178 p_prl_information24 => p_prl_information24,
1179 p_prl_information25 => p_prl_information25,
1180 p_prl_information26 => p_prl_information26,
1181 p_prl_information27 => p_prl_information27,
1182 p_prl_information28 => p_prl_information28,
1183 p_prl_information29 => p_prl_information29,
1184 p_prl_information30 => p_prl_information30,
1185 p_multi_assignments_flag => p_multi_assignments_flag,
1186 p_period_reset_years => p_period_reset_years,
1187
1188 p_payslip_view_date_offset => p_payslip_view_date_offset,
1189
1190 p_payroll_id => l_payroll_id,
1191 p_object_version_number => l_object_version_number,
1192 p_effective_start_date => l_effective_start_date,
1193 p_effective_end_date => l_effective_end_date,
1194 p_comment_id => l_comment_id
1195 );
1196
1197 --Added to insert the payroll_id along with the payment method into the
1198 --pay_org_payment_methods_f table.
1199
1200 if(p_default_payment_method_id is not null) then
1201 --
1202 hr_utility.set_location(l_proc, 90);
1203 l_org_pay_method_usage_id := hr_ppvol.ins_pmu(
1204 l_effective_start_date,
1205 l_effective_end_date,
1209 end if;
1206 l_payroll_id,
1207 p_default_payment_method_id);
1208 --
1210
1211 begin
1212 --
1213 hr_utility.trace('The value of p_cost_alloc_keyflex_id_in Before user-hook : '||p_cost_alloc_keyflex_id_in);
1214 pay_payroll_bk1.create_payroll_a
1215 (p_effective_date => l_effective_date
1216 ,p_payroll_name => p_payroll_name
1217 ,p_payroll_type => p_payroll_type
1218 ,p_period_type => p_period_type
1219 ,p_first_period_end_date => l_first_period_end_date
1220 ,p_number_of_years => p_number_of_years
1221 ,p_pay_date_offset => p_pay_date_offset
1222 ,p_direct_deposit_date_offset => p_direct_deposit_date_offset
1223 ,p_pay_advice_date_offset => p_pay_advice_date_offset
1224 ,p_cut_off_date_offset => p_cut_off_date_offset
1225 ,p_midpoint_offset => p_midpoint_offset
1226 ,p_default_payment_method_id => p_default_payment_method_id
1227 ,p_consolidation_set_id => p_consolidation_set_id
1228 ,p_cost_alloc_keyflex_id_in => l_cost_allocation_keyflex_id
1229 ,p_susp_account_keyflex_id_in => l_suspense_account_keyflex_id
1230 ,p_negative_pay_allowed_flag => p_negative_pay_allowed_flag
1231 ,p_gl_set_of_books_id => p_gl_set_of_books_id
1232 ,p_soft_coding_keyflex_id_in => l_soft_coding_keyflex_id
1233 ,p_comments => p_comments
1234 ,p_attribute_category => p_attribute_category
1235 ,p_attribute1 => p_attribute1
1236 ,p_attribute2 => p_attribute2
1237 ,p_attribute3 => p_attribute3
1238 ,p_attribute4 => p_attribute4
1239 ,p_attribute5 => p_attribute5
1240 ,p_attribute6 => p_attribute6
1241 ,p_attribute7 => p_attribute7
1242 ,p_attribute8 => p_attribute8
1243 ,p_attribute9 => p_attribute9
1244 ,p_attribute10 => p_attribute10
1245 ,p_attribute11 => p_attribute11
1246 ,p_attribute12 => p_attribute12
1247 ,p_attribute13 => p_attribute13
1248 ,p_attribute14 => p_attribute14
1249 ,p_attribute15 => p_attribute15
1250 ,p_attribute16 => p_attribute16
1251 ,p_attribute17 => p_attribute17
1252 ,p_attribute18 => p_attribute18
1253 ,p_attribute19 => p_attribute19
1254 ,p_attribute20 => p_attribute20
1255 ,p_arrears_flag => p_arrears_flag
1256 ,p_period_reset_years => p_period_reset_years
1257 ,p_multi_assignments_flag => p_multi_assignments_flag
1258 ,p_organization_id => p_organization_id
1259 ,p_prl_information1 => p_prl_information1
1260 ,p_prl_information2 => p_prl_information2
1261 ,p_prl_information3 => p_prl_information3
1262 ,p_prl_information4 => p_prl_information4
1263 ,p_prl_information5 => p_prl_information5
1264 ,p_prl_information6 => p_prl_information6
1265 ,p_prl_information7 => p_prl_information7
1266 ,p_prl_information8 => p_prl_information8
1267 ,p_prl_information9 => p_prl_information9
1268 ,p_prl_information10 => p_prl_information10
1269 ,p_prl_information11 => p_prl_information11
1270 ,p_prl_information12 => p_prl_information12
1271 ,p_prl_information13 => p_prl_information13
1272 ,p_prl_information14 => p_prl_information14
1273 ,p_prl_information15 => p_prl_information15
1274 ,p_prl_information16 => p_prl_information16
1275 ,p_prl_information17 => p_prl_information17
1276 ,p_prl_information18 => p_prl_information18
1277 ,p_prl_information19 => p_prl_information19
1278 ,p_prl_information20 => p_prl_information20
1279 ,p_prl_information21 => p_prl_information21
1280 ,p_prl_information22 => p_prl_information22
1281 ,p_prl_information23 => p_prl_information23
1282 ,p_prl_information24 => p_prl_information24
1283 ,p_prl_information25 => p_prl_information25
1284 ,p_prl_information26 => p_prl_information26
1285 ,p_prl_information27 => p_prl_information27
1286 ,p_prl_information28 => p_prl_information28
1287 ,p_prl_information29 => p_prl_information29
1288 ,p_prl_information30 => p_prl_information30
1289
1290 ,p_cost_segment1 => p_cost_segment1
1291 ,p_cost_segment2 => p_cost_segment2
1292 ,p_cost_segment3 => p_cost_segment3
1293 ,p_cost_segment4 => p_cost_segment4
1294 ,p_cost_segment5 => p_cost_segment5
1295 ,p_cost_segment6 => p_cost_segment6
1296 ,p_cost_segment7 => p_cost_segment7
1297 ,p_cost_segment8 => p_cost_segment8
1298 ,p_cost_segment9 => p_cost_segment9
1299 ,p_cost_segment10 => p_cost_segment10
1300 ,p_cost_segment11 => p_cost_segment11
1301 ,p_cost_segment12 => p_cost_segment12
1302 ,p_cost_segment13 => p_cost_segment13
1303 ,p_cost_segment14 => p_cost_segment14
1304 ,p_cost_segment15 => p_cost_segment15
1305 ,p_cost_segment16 => p_cost_segment16
1306 ,p_cost_segment17 => p_cost_segment17
1310 ,p_cost_segment21 => p_cost_segment21
1307 ,p_cost_segment18 => p_cost_segment18
1308 ,p_cost_segment19 => p_cost_segment19
1309 ,p_cost_segment20 => p_cost_segment20
1311 ,p_cost_segment22 => p_cost_segment22
1312 ,p_cost_segment23 => p_cost_segment23
1313 ,p_cost_segment24 => p_cost_segment24
1314 ,p_cost_segment25 => p_cost_segment25
1315 ,p_cost_segment26 => p_cost_segment26
1316 ,p_cost_segment27 => p_cost_segment27
1317 ,p_cost_segment28 => p_cost_segment28
1318 ,p_cost_segment29 => p_cost_segment29
1319 ,p_cost_segment30 => p_cost_segment30
1320 ,p_cost_concat_segments_in => p_cost_concat_segments_in
1321
1322 ,p_susp_segment1 => p_susp_segment1
1323 ,p_susp_segment2 => p_susp_segment2
1324 ,p_susp_segment3 => p_susp_segment3
1325 ,p_susp_segment4 => p_susp_segment4
1326 ,p_susp_segment5 => p_susp_segment5
1327 ,p_susp_segment6 => p_susp_segment6
1328 ,p_susp_segment7 => p_susp_segment7
1329 ,p_susp_segment8 => p_susp_segment8
1330 ,p_susp_segment9 => p_susp_segment9
1331 ,p_susp_segment10 => p_susp_segment10
1332 ,p_susp_segment11 => p_susp_segment11
1333 ,p_susp_segment12 => p_susp_segment12
1334 ,p_susp_segment13 => p_susp_segment13
1335 ,p_susp_segment14 => p_susp_segment14
1336 ,p_susp_segment15 => p_susp_segment15
1337 ,p_susp_segment16 => p_susp_segment16
1338 ,p_susp_segment17 => p_susp_segment17
1339 ,p_susp_segment18 => p_susp_segment18
1340 ,p_susp_segment19 => p_susp_segment19
1341 ,p_susp_segment20 => p_susp_segment20
1342 ,p_susp_segment21 => p_susp_segment21
1343 ,p_susp_segment22 => p_susp_segment22
1344 ,p_susp_segment23 => p_susp_segment23
1345 ,p_susp_segment24 => p_susp_segment24
1346 ,p_susp_segment25 => p_susp_segment25
1347 ,p_susp_segment26 => p_susp_segment26
1348 ,p_susp_segment27 => p_susp_segment27
1349 ,p_susp_segment28 => p_susp_segment28
1350 ,p_susp_segment29 => p_susp_segment29
1351 ,p_susp_segment30 => p_susp_segment30
1352 ,p_susp_concat_segments_in => p_susp_concat_segments_in
1353
1354 ,p_scl_segment1 => p_scl_segment1
1355 ,p_scl_segment2 => p_scl_segment2
1356 ,p_scl_segment3 => p_scl_segment3
1357 ,p_scl_segment4 => p_scl_segment4
1358 ,p_scl_segment5 => p_scl_segment5
1359 ,p_scl_segment6 => p_scl_segment6
1360 ,p_scl_segment7 => p_scl_segment7
1361 ,p_scl_segment8 => p_scl_segment8
1362 ,p_scl_segment9 => p_scl_segment9
1363 ,p_scl_segment10 => p_scl_segment10
1364 ,p_scl_segment11 => p_scl_segment11
1365 ,p_scl_segment12 => p_scl_segment12
1366 ,p_scl_segment13 => p_scl_segment13
1367 ,p_scl_segment14 => p_scl_segment14
1368 ,p_scl_segment15 => p_scl_segment15
1369 ,p_scl_segment16 => p_scl_segment16
1370 ,p_scl_segment17 => p_scl_segment17
1371 ,p_scl_segment18 => p_scl_segment18
1372 ,p_scl_segment19 => p_scl_segment19
1373 ,p_scl_segment20 => p_scl_segment20
1374 ,p_scl_segment21 => p_scl_segment21
1375 ,p_scl_segment22 => p_scl_segment22
1376 ,p_scl_segment23 => p_scl_segment23
1377 ,p_scl_segment24 => p_scl_segment24
1378 ,p_scl_segment25 => p_scl_segment25
1379 ,p_scl_segment26 => p_scl_segment26
1380 ,p_scl_segment27 => p_scl_segment27
1381 ,p_scl_segment28 => p_scl_segment28
1382 ,p_scl_segment29 => p_scl_segment29
1383 ,p_scl_segment30 => p_scl_segment30
1384 ,p_scl_concat_segments_in => p_scl_concat_segments_in
1385
1386 ,p_workload_shifting_level => p_workload_shifting_level
1387 ,p_payslip_view_date_offset => p_payslip_view_date_offset
1388
1389 ,p_cost_concat_segments_out => p_cost_concat_segments_out
1390 ,p_susp_concat_segments_out => p_susp_concat_segments_out
1391 ,p_scl_concat_segments_out => p_scl_concat_segments_out
1392
1393 ,p_cost_alloc_keyflex_id_out => p_cost_alloc_keyflex_id_out
1394 ,p_susp_account_keyflex_id_out => p_susp_account_keyflex_id_out
1395 ,p_soft_coding_keyflex_id_out => p_soft_coding_keyflex_id_out
1396
1397 ,p_business_group_id => l_business_group_id
1398
1399 ,p_payroll_id => l_payroll_id
1400 ,p_org_pay_method_usage_id => l_org_pay_method_usage_id
1401 ,p_prl_object_version_number => l_object_version_number
1402 ,p_opm_object_version_number => l_object_version_number
1403 ,p_prl_effective_start_date => l_effective_start_date
1404 ,p_prl_effective_end_date => l_effective_end_date
1405 ,p_opm_effective_start_date => l_effective_start_date
1406 ,p_opm_effective_end_date => l_effective_end_date
1407 ,p_comment_id => p_comment_id
1408 );
1409 exception
1410 when hr_api.cannot_find_prog_unit then
1414 );
1411 hr_api.cannot_find_prog_unit_error
1412 (p_module_name => 'create_payroll'
1413 ,p_hook_type => 'AP'
1415 --
1416 end;
1417
1418 if(p_validate) then
1419 --
1420 raise hr_api.validate_enabled;
1421 --
1422 end if;
1423 --
1424 -- Create time periods for the created payroll.
1425 --
1426 hr_utility.set_location(l_proc, 20);
1427 hr_payrolls.create_payroll_proc_periods(l_payroll_id,
1428 l_last_update_date,
1429 l_last_updated_by,
1430 l_last_update_login,
1431 l_created_by,
1432 l_creation_date,
1433 l_effective_date);
1434
1435 --
1436 -- Note that we are returning dummy object version id values
1437 -- because we don't currently have these columns on these
1438 -- tables.
1439 --
1440 hr_utility.set_location(l_proc, 100);
1441
1442 p_payroll_id := l_payroll_id;
1443 p_comment_id := l_comment_id;
1444 p_org_pay_method_usage_id := l_org_pay_method_usage_id;
1445 p_opm_object_version_number := l_object_version_number;
1446 p_prl_effective_start_date := l_effective_start_date;
1447 p_prl_effective_end_date := l_effective_end_date;
1448 p_opm_effective_start_date := l_effective_start_date;
1449 p_opm_effective_end_date := l_effective_end_date;
1450 p_prl_object_version_number := l_object_version_number;
1451
1452 --
1453 --Setting the out parameters
1454 --
1455 if(p_cost_alloc_keyflex_id_in is not null) then
1456 --
1457 p_cost_alloc_keyflex_id_out := p_cost_alloc_keyflex_id_in;
1458 p_cost_concat_segments_out := null;
1459 else
1460 p_cost_alloc_keyflex_id_out := l_cost_allocation_keyflex_id;
1461 p_cost_concat_segments_out := l_cost_concat_segments;
1462 --
1463 end if;
1464 --
1465 if(p_susp_account_keyflex_id_in is not null) then
1466 --
1467 p_susp_account_keyflex_id_out := p_susp_account_keyflex_id_in;
1468 p_susp_concat_segments_out := null;
1469 else
1470 p_susp_account_keyflex_id_out := l_suspense_account_keyflex_id;
1471 p_susp_concat_segments_out := l_susp_concat_segments;
1472 --
1473 end if;
1474 --
1475 if(p_soft_coding_keyflex_id_in is not null) then
1476 --
1477 p_soft_coding_keyflex_id_out := p_soft_coding_keyflex_id_in;
1478 p_scl_concat_segments_out := null;
1479 else
1480 p_soft_coding_keyflex_id_out := l_soft_coding_keyflex_id;
1481 p_scl_concat_segments_out := l_scl_concat_segments;
1482 --
1483 end if;
1484 --
1485 hr_utility.set_location(' Leaving:'||l_proc, 70);
1486 --
1487 exception
1488 when hr_api.validate_enabled then
1489 --
1490 --Must remove all work done by this procedure.
1491 --
1492 rollback to create_payroll;
1493
1494 p_payroll_id := null;
1495 p_org_pay_method_usage_id := null;
1496 p_prl_object_version_number := null;
1497 p_opm_object_version_number := null;
1498 p_prl_effective_start_date := null;
1499 p_prl_effective_end_date := null;
1500 p_opm_effective_start_date := null;
1501 p_opm_effective_end_date := null;
1502 p_comment_id := null;
1503
1504 p_cost_concat_segments_out := null;
1505 p_susp_concat_segments_out := null;
1506 p_scl_concat_segments_out := null;
1507 p_cost_alloc_keyflex_id_out := null;
1508 p_susp_account_keyflex_id_out := null;
1509 p_soft_coding_keyflex_id_out := null;
1510
1511
1512 when others then
1513 --
1514 -- Must remove all work done by this procedure.
1515 --
1516 rollback to create_payroll;
1517
1518 p_payroll_id := null;
1519 p_org_pay_method_usage_id := null;
1520 p_prl_object_version_number := null;
1521 p_opm_object_version_number := null;
1522 p_prl_effective_start_date := null;
1523 p_prl_effective_end_date := null;
1524 p_opm_effective_start_date := null;
1525 p_opm_effective_end_date := null;
1526 p_comment_id := null;
1527
1528 p_cost_concat_segments_out := null;
1529 p_susp_concat_segments_out := null;
1530 p_scl_concat_segments_out := null;
1531 p_cost_alloc_keyflex_id_out := null;
1532 p_susp_account_keyflex_id_out := null;
1533 p_soft_coding_keyflex_id_out := null;
1534
1535 raise;
1536
1537 end create_payroll;
1538
1539 --
1540 -- ----------------------------------------------------------------------------
1541 -- |----------------------------< update_payroll >-----------------------------|
1542 -- ----------------------------------------------------------------------------
1543 --
1544 procedure update_payroll
1545 (
1546 p_validate in boolean default false,
1547 p_effective_date in date,
1548 p_datetrack_mode in varchar2,
1549 p_payroll_name in varchar2 default hr_api.g_varchar2,
1553 p_cost_alloc_keyflex_id_in in number default hr_api.g_number,
1550 p_number_of_years in number default hr_api.g_number,
1551 p_default_payment_method_id in number default hr_api.g_number,
1552 p_consolidation_set_id in number default hr_api.g_number,
1554 p_susp_account_keyflex_id_in in number default hr_api.g_number,
1555 p_negative_pay_allowed_flag in varchar2 default hr_api.g_varchar2,
1556 p_soft_coding_keyflex_id_in in number default hr_api.g_number,
1557 p_comments in varchar2 default hr_api.g_varchar2,
1558 p_attribute_category in varchar2 default hr_api.g_varchar2,
1559 p_attribute1 in varchar2 default hr_api.g_varchar2,
1560 p_attribute2 in varchar2 default hr_api.g_varchar2,
1561 p_attribute3 in varchar2 default hr_api.g_varchar2,
1562 p_attribute4 in varchar2 default hr_api.g_varchar2,
1563 p_attribute5 in varchar2 default hr_api.g_varchar2,
1564 p_attribute6 in varchar2 default hr_api.g_varchar2,
1565 p_attribute7 in varchar2 default hr_api.g_varchar2,
1566 p_attribute8 in varchar2 default hr_api.g_varchar2,
1567 p_attribute9 in varchar2 default hr_api.g_varchar2,
1568 p_attribute10 in varchar2 default hr_api.g_varchar2,
1569 p_attribute11 in varchar2 default hr_api.g_varchar2,
1570 p_attribute12 in varchar2 default hr_api.g_varchar2,
1571 p_attribute13 in varchar2 default hr_api.g_varchar2,
1572 p_attribute14 in varchar2 default hr_api.g_varchar2,
1573 p_attribute15 in varchar2 default hr_api.g_varchar2,
1574 p_attribute16 in varchar2 default hr_api.g_varchar2,
1575 p_attribute17 in varchar2 default hr_api.g_varchar2,
1576 p_attribute18 in varchar2 default hr_api.g_varchar2,
1577 p_attribute19 in varchar2 default hr_api.g_varchar2,
1578 p_attribute20 in varchar2 default hr_api.g_varchar2,
1579 p_arrears_flag in varchar2 default hr_api.g_varchar2,
1580 p_multi_assignments_flag in varchar2 default hr_api.g_varchar2,
1581 p_prl_information1 in varchar2 default hr_api.g_varchar2,
1582 p_prl_information2 in varchar2 default hr_api.g_varchar2,
1583 p_prl_information3 in varchar2 default hr_api.g_varchar2,
1584 p_prl_information4 in varchar2 default hr_api.g_varchar2,
1585 p_prl_information5 in varchar2 default hr_api.g_varchar2,
1586 p_prl_information6 in varchar2 default hr_api.g_varchar2,
1587 p_prl_information7 in varchar2 default hr_api.g_varchar2,
1588 p_prl_information8 in varchar2 default hr_api.g_varchar2,
1589 p_prl_information9 in varchar2 default hr_api.g_varchar2,
1590 p_prl_information10 in varchar2 default hr_api.g_varchar2,
1591 p_prl_information11 in varchar2 default hr_api.g_varchar2,
1592 p_prl_information12 in varchar2 default hr_api.g_varchar2,
1593 p_prl_information13 in varchar2 default hr_api.g_varchar2,
1594 p_prl_information14 in varchar2 default hr_api.g_varchar2,
1595 p_prl_information15 in varchar2 default hr_api.g_varchar2,
1596 p_prl_information16 in varchar2 default hr_api.g_varchar2,
1597 p_prl_information17 in varchar2 default hr_api.g_varchar2,
1598 p_prl_information18 in varchar2 default hr_api.g_varchar2,
1599 p_prl_information19 in varchar2 default hr_api.g_varchar2,
1600 p_prl_information20 in varchar2 default hr_api.g_varchar2,
1601 p_prl_information21 in varchar2 default hr_api.g_varchar2,
1602 p_prl_information22 in varchar2 default hr_api.g_varchar2,
1603 p_prl_information23 in varchar2 default hr_api.g_varchar2,
1604 p_prl_information24 in varchar2 default hr_api.g_varchar2,
1605 p_prl_information25 in varchar2 default hr_api.g_varchar2,
1606 p_prl_information26 in varchar2 default hr_api.g_varchar2,
1607 p_prl_information27 in varchar2 default hr_api.g_varchar2,
1608 p_prl_information28 in varchar2 default hr_api.g_varchar2,
1609 p_prl_information29 in varchar2 default hr_api.g_varchar2,
1610 p_prl_information30 in varchar2 default hr_api.g_varchar2,
1611
1612 p_cost_segment1 in varchar2 default hr_api.g_varchar2,
1613 p_cost_segment2 in varchar2 default hr_api.g_varchar2,
1614 p_cost_segment3 in varchar2 default hr_api.g_varchar2,
1615 p_cost_segment4 in varchar2 default hr_api.g_varchar2,
1616 p_cost_segment5 in varchar2 default hr_api.g_varchar2,
1617 p_cost_segment6 in varchar2 default hr_api.g_varchar2,
1618 p_cost_segment7 in varchar2 default hr_api.g_varchar2,
1619 p_cost_segment8 in varchar2 default hr_api.g_varchar2,
1620 p_cost_segment9 in varchar2 default hr_api.g_varchar2,
1621 p_cost_segment10 in varchar2 default hr_api.g_varchar2,
1622 p_cost_segment11 in varchar2 default hr_api.g_varchar2,
1626 p_cost_segment15 in varchar2 default hr_api.g_varchar2,
1623 p_cost_segment12 in varchar2 default hr_api.g_varchar2,
1624 p_cost_segment13 in varchar2 default hr_api.g_varchar2,
1625 p_cost_segment14 in varchar2 default hr_api.g_varchar2,
1627 p_cost_segment16 in varchar2 default hr_api.g_varchar2,
1628 p_cost_segment17 in varchar2 default hr_api.g_varchar2,
1629 p_cost_segment18 in varchar2 default hr_api.g_varchar2,
1630 p_cost_segment19 in varchar2 default hr_api.g_varchar2,
1631 p_cost_segment20 in varchar2 default hr_api.g_varchar2,
1632 p_cost_segment21 in varchar2 default hr_api.g_varchar2,
1633 p_cost_segment22 in varchar2 default hr_api.g_varchar2,
1634 p_cost_segment23 in varchar2 default hr_api.g_varchar2,
1635 p_cost_segment24 in varchar2 default hr_api.g_varchar2,
1636 p_cost_segment25 in varchar2 default hr_api.g_varchar2,
1637 p_cost_segment26 in varchar2 default hr_api.g_varchar2,
1638 p_cost_segment27 in varchar2 default hr_api.g_varchar2,
1639 p_cost_segment28 in varchar2 default hr_api.g_varchar2,
1640 p_cost_segment29 in varchar2 default hr_api.g_varchar2,
1641 p_cost_segment30 in varchar2 default hr_api.g_varchar2,
1642 p_cost_concat_segments_in in varchar2 default hr_api.g_varchar2,
1643
1644 p_susp_segment1 in varchar2 default hr_api.g_varchar2,
1645 p_susp_segment2 in varchar2 default hr_api.g_varchar2,
1646 p_susp_segment3 in varchar2 default hr_api.g_varchar2,
1647 p_susp_segment4 in varchar2 default hr_api.g_varchar2,
1648 p_susp_segment5 in varchar2 default hr_api.g_varchar2,
1649 p_susp_segment6 in varchar2 default hr_api.g_varchar2,
1650 p_susp_segment7 in varchar2 default hr_api.g_varchar2,
1651 p_susp_segment8 in varchar2 default hr_api.g_varchar2,
1652 p_susp_segment9 in varchar2 default hr_api.g_varchar2,
1653 p_susp_segment10 in varchar2 default hr_api.g_varchar2,
1654 p_susp_segment11 in varchar2 default hr_api.g_varchar2,
1655 p_susp_segment12 in varchar2 default hr_api.g_varchar2,
1656 p_susp_segment13 in varchar2 default hr_api.g_varchar2,
1657 p_susp_segment14 in varchar2 default hr_api.g_varchar2,
1658 p_susp_segment15 in varchar2 default hr_api.g_varchar2,
1659 p_susp_segment16 in varchar2 default hr_api.g_varchar2,
1660 p_susp_segment17 in varchar2 default hr_api.g_varchar2,
1661 p_susp_segment18 in varchar2 default hr_api.g_varchar2,
1662 p_susp_segment19 in varchar2 default hr_api.g_varchar2,
1663 p_susp_segment20 in varchar2 default hr_api.g_varchar2,
1664 p_susp_segment21 in varchar2 default hr_api.g_varchar2,
1665 p_susp_segment22 in varchar2 default hr_api.g_varchar2,
1666 p_susp_segment23 in varchar2 default hr_api.g_varchar2,
1667 p_susp_segment24 in varchar2 default hr_api.g_varchar2,
1668 p_susp_segment25 in varchar2 default hr_api.g_varchar2,
1669 p_susp_segment26 in varchar2 default hr_api.g_varchar2,
1670 p_susp_segment27 in varchar2 default hr_api.g_varchar2,
1671 p_susp_segment28 in varchar2 default hr_api.g_varchar2,
1672 p_susp_segment29 in varchar2 default hr_api.g_varchar2,
1673 p_susp_segment30 in varchar2 default hr_api.g_varchar2,
1674 p_susp_concat_segments_in in varchar2 default hr_api.g_varchar2,
1675
1676 p_scl_segment1 in varchar2 default hr_api.g_varchar2,
1677 p_scl_segment2 in varchar2 default hr_api.g_varchar2,
1678 p_scl_segment3 in varchar2 default hr_api.g_varchar2,
1679 p_scl_segment4 in varchar2 default hr_api.g_varchar2,
1680 p_scl_segment5 in varchar2 default hr_api.g_varchar2,
1681 p_scl_segment6 in varchar2 default hr_api.g_varchar2,
1682 p_scl_segment7 in varchar2 default hr_api.g_varchar2,
1683 p_scl_segment8 in varchar2 default hr_api.g_varchar2,
1684 p_scl_segment9 in varchar2 default hr_api.g_varchar2,
1685 p_scl_segment10 in varchar2 default hr_api.g_varchar2,
1686 p_scl_segment11 in varchar2 default hr_api.g_varchar2,
1687 p_scl_segment12 in varchar2 default hr_api.g_varchar2,
1688 p_scl_segment13 in varchar2 default hr_api.g_varchar2,
1689 p_scl_segment14 in varchar2 default hr_api.g_varchar2,
1690 p_scl_segment15 in varchar2 default hr_api.g_varchar2,
1691 p_scl_segment16 in varchar2 default hr_api.g_varchar2,
1692 p_scl_segment17 in varchar2 default hr_api.g_varchar2,
1693 p_scl_segment18 in varchar2 default hr_api.g_varchar2,
1694 p_scl_segment19 in varchar2 default hr_api.g_varchar2,
1695 p_scl_segment20 in varchar2 default hr_api.g_varchar2,
1696 p_scl_segment21 in varchar2 default hr_api.g_varchar2,
1697 p_scl_segment22 in varchar2 default hr_api.g_varchar2,
1698 p_scl_segment23 in varchar2 default hr_api.g_varchar2,
1699 p_scl_segment24 in varchar2 default hr_api.g_varchar2,
1700 p_scl_segment25 in varchar2 default hr_api.g_varchar2,
1704 p_scl_segment29 in varchar2 default hr_api.g_varchar2,
1701 p_scl_segment26 in varchar2 default hr_api.g_varchar2,
1702 p_scl_segment27 in varchar2 default hr_api.g_varchar2,
1703 p_scl_segment28 in varchar2 default hr_api.g_varchar2,
1705 p_scl_segment30 in varchar2 default hr_api.g_varchar2,
1706 p_scl_concat_segments_in in varchar2 default hr_api.g_varchar2,
1707
1708 p_workload_shifting_level in varchar2 default hr_api.g_varchar2,
1709 p_payslip_view_date_offset in number default hr_api.g_number,
1710
1711 p_payroll_id in out nocopy number,
1712 p_object_version_number in out nocopy number,
1713
1714 p_effective_start_date out nocopy date,
1715 p_effective_end_date out nocopy date,
1716 p_cost_alloc_keyflex_id_out out nocopy number,
1717 p_susp_account_keyflex_id_out out nocopy number,
1718 p_soft_coding_keyflex_id_out out nocopy number,
1719
1720 p_comment_id out nocopy number,
1721 p_cost_concat_segments_out out nocopy varchar2,
1722 p_susp_concat_segments_out out nocopy varchar2,
1723 p_scl_concat_segments_out out nocopy varchar2
1724
1725 ) is
1726
1727 l_effective_date date;
1728 l_object_version_number pay_all_payrolls_f.object_version_number%type;
1729 l_payroll_id pay_all_payrolls_f.payroll_id%type;
1730 l_proc varchar2(72) := g_package||'update_payroll';
1731 l_effective_start_date pay_all_payrolls_f.effective_start_date%type;
1732 l_effective_end_date pay_all_payrolls_f.effective_end_date%type;
1733 l_dummy number(15);
1734 l_dummy_char varchar2(1);
1735
1736 l_cost_id_flex_num fnd_id_flex_segments.id_flex_num%TYPE;
1737 l_susp_id_flex_num fnd_id_flex_segments.id_flex_num%TYPE;
1738 l_scl_id_flex_num fnd_id_flex_segments.id_flex_num%TYPE;
1739 l_business_group_id pay_all_payrolls_f.business_group_id%TYPE;
1740 l_prl_information_category pay_all_payrolls_f.prl_information_category%TYPE := hr_api.g_varchar2;
1741 l_legislation_code varchar2(150);
1742
1743 l_cost_concat_segments PAY_COST_ALLOCATION_KEYFLEX.concatenated_segments%TYPE ;
1744 l_susp_concat_segments PAY_COST_ALLOCATION_KEYFLEX.concatenated_segments%TYPE ;
1745 l_scl_concat_segments HR_SOFT_CODING_KEYFLEX.concatenated_segments%TYPE;
1746
1747 l_cost_allocation_keyflex_id PAY_ALL_PAYROLLS_F.COST_ALLOCATION_KEYFLEX_ID%TYPE := p_cost_alloc_keyflex_id_in;
1748 l_suspense_account_keyflex_id PAY_ALL_PAYROLLS_F.SUSPENSE_ACCOUNT_KEYFLEX_ID%TYPE := p_susp_account_keyflex_id_in;
1749 l_soft_coding_keyflex_id PAY_ALL_PAYROLLS_F.SOFT_CODING_KEYFLEX_ID%TYPE := p_soft_coding_keyflex_id_in;
1750
1751 l_cost_flag boolean := false;
1752 l_susp_flag boolean := false;
1753 l_soft_flag boolean := false;
1754
1755 --
1756 --Cursor for getting the Cost allocation structure id from business group id.
1757 --
1758 cursor csr_cost_id_flex_num(c_business_group_id PER_BUSINESS_GROUPS_PERF.business_group_id%TYPE ) is
1759 select bg.cost_allocation_structure
1760 from PER_BUSINESS_GROUPS_PERF bg
1761 where bg.business_group_id = c_business_group_id;
1762
1763 --
1764 --Cursor for getting the Soft coding structure id from business group id.
1765 --
1766 cursor csr_soft_id_flex_num(c_legislation_code pay_legislation_rules.legislation_code%TYPE ) is
1767 select lr.rule_mode
1768 from pay_legislation_rules lr
1769 where lr.legislation_code = c_legislation_code
1770 and upper(lr.rule_type) = 'S';
1771
1772 --
1773 --Cursor for checking whether the given Cost Keyflex id is there or not.
1774 --
1775 cursor csr_cost_alloc_exists(c_cost_allocation_keyflex_id PAY_ALL_PAYROLLS_F.COST_ALLOCATION_KEYFLEX_ID%TYPE) is
1776 select pca.cost_allocation_keyflex_id
1777 from pay_cost_allocation_keyflex pca
1778 where pca.cost_allocation_keyflex_id = c_cost_allocation_keyflex_id;
1779
1780 --
1781 --Cursor for checking whether the given Soft coding Keyflex id is there or not.
1782 --
1783 cursor csr_soft_coding_exists(c_soft_coding_keyflex_id HR_SOFT_CODING_KEYFLEX.SOFT_CODING_KEYFLEX_ID%TYPE) is
1784 select scl.soft_coding_keyflex_id
1785 from HR_SOFT_CODING_KEYFLEX scl
1786 where scl.soft_coding_keyflex_id = c_soft_coding_keyflex_id;
1787
1788 --
1789 --Cursor for getting the business group id from the payroll id.
1790 --
1791 cursor csr_get_bg_grp(c_payroll_id PAY_ALL_PAYROLLS_F.payroll_id%TYPE) is
1792 select prl.business_group_id
1793 from PAY_ALL_PAYROLLS_F prl
1794 where prl.payroll_id = c_payroll_id
1795 and trunc(p_effective_date)
1796 between prl.effective_start_date and prl.effective_end_date;
1797
1798 --
1799 --Cursor for checking the payroll is valid or not
1800 --
1801 cursor csr_chk_payroll is
1802 select null
1803 from pay_all_payrolls_f prl
1804 where prl.payroll_id = p_payroll_id
1805 and trunc(p_effective_date)
1806 between prl.effective_start_date and prl.effective_end_date;
1807
1808 --
1809 --Cursor for getting the cost allocation keyflex id from the PAY_ALL_PAYROLLS_F
1810 --
1811 cursor csr_get_costKFF is
1812 select cost_allocation_keyflex_id
1813 from PAY_ALL_PAYROLLS_F prl
1814 where prl.payroll_id = p_payroll_id
1815 and trunc(p_effective_date)
1816 between prl.effective_start_date and prl.effective_end_date;
1817
1818 --
1822 select suspense_account_keyflex_id
1819 --Cursor for getting the suspense account keyflex id from the PAY_ALL_PAYROLLS_F
1820 --
1821 cursor csr_get_suspenseKFF is
1823 from PAY_ALL_PAYROLLS_F prl
1824 where prl.payroll_id = p_payroll_id
1825 and trunc(p_effective_date)
1826 between prl.effective_start_date and prl.effective_end_date;
1827
1828 --
1829 --Cursor for getting the soft coding keyflex id from the PAY_ALL_PAYROLLS_F
1830 --
1831 cursor csr_get_softKFF is
1832 select soft_coding_keyflex_id
1833 from PAY_ALL_PAYROLLS_F prl
1834 where prl.payroll_id = p_payroll_id
1835 and trunc(p_effective_date)
1836 between prl.effective_start_date and prl.effective_end_date;
1837
1838 begin
1839 --
1840 hr_utility.set_location(' Entering:'||l_proc, 10);
1841 --
1842 -- Truncate the date parameters.
1843 --
1844 l_effective_date := trunc(p_effective_date);
1845 l_object_version_number := p_object_version_number;
1846 l_payroll_id := p_payroll_id;
1847
1848 --
1849 -- Standard savepoint.
1850 --
1851 savepoint update_payroll;
1852
1853 --
1854 --check whether the payroll is existing or not.
1855 --
1856 open csr_chk_payroll;
1857 fetch csr_chk_payroll into l_dummy_char;
1858 if(csr_chk_payroll%NOTFOUND)then
1859 --
1860 close csr_chk_payroll;
1861 fnd_message.set_name('PAY', 'HR_51043_PRL_DOES_NOT_EXIST');
1862 fnd_message.raise_error;
1863 --
1864 end if;
1865 close csr_chk_payroll;
1866
1867 --
1868 --Get the Business Group id from the payroll id.
1869 --
1870 if(p_consolidation_set_id = hr_api.g_number) then
1871 --
1872 open csr_get_bg_grp(l_payroll_id);
1873 fetch csr_get_bg_grp into l_business_group_id;
1874 close csr_get_bg_grp;
1875 else
1876 pay_pay_bus.chk_consolidation_set_id(p_consolidation_set_id,l_business_group_id);
1877 --
1878 end if;
1879
1880 --
1881 --Get the Legislation code.
1882 --
1883 l_legislation_code := hr_api.return_legislation_code(l_business_group_id);
1884
1885 --
1886 -- Validate the business group id.
1887 --
1888 hr_api.validate_bus_grp_id
1889 (p_business_group_id => L_business_group_id
1890 ,p_associated_column1 => 'PAY_ALL_PAYROLLS_F'
1891 || '.BUSINESS_GROUP_ID');
1892
1893 hr_multi_message.end_validation_set;
1894
1895 --
1896 --Checking whether the specified cost allocation kff ID is there.
1897 --If it is not there, it will raise an error.
1898 --
1899 if (( p_cost_alloc_keyflex_id_in is not null )
1900 and (p_cost_alloc_keyflex_id_in <> hr_api.g_number)) then
1901 --
1902 open csr_cost_alloc_exists(p_cost_alloc_keyflex_id_in);
1903 fetch csr_cost_alloc_exists into l_dummy;
1904 if (csr_cost_alloc_exists%NOTFOUND) then
1905 --
1906 close csr_cost_alloc_exists;
1907 fnd_message.set_name('PAY','PAY_33085_INVALID_FK');
1908 fnd_message.set_token('COLUMN','COST_ALLOCATION_KEYFLEX_ID');
1909 fnd_message.set_token('TABLE','PAY_COST_ALLOCATION_KEYFLEX');
1910 fnd_message.raise_error;
1911 --
1912 end if;
1913 close csr_cost_alloc_exists;
1914 --
1915 end if;
1916 --
1917 --Checking whether the specified suspence account kff ID is there.
1918 --If it is not there, it will raise an error.
1919 --
1920 if((p_susp_account_keyflex_id_in is not null)
1921 and (p_susp_account_keyflex_id_in <> hr_api.g_number)) then
1922 open csr_cost_alloc_exists(p_susp_account_keyflex_id_in);
1923 fetch csr_cost_alloc_exists into l_dummy;
1924 if (csr_cost_alloc_exists%NOTFOUND) then
1925 --
1926 close csr_cost_alloc_exists;
1927 fnd_message.set_name('PAY','PAY_33085_INVALID_FK');
1928 fnd_message.set_token('COLUMN','SUSPENSE_ACCOUNT_KEYFLEX_ID');
1929 fnd_message.set_token('TABLE','PAY_COST_ALLOCATION_KEYFLEX');
1930 fnd_message.raise_error;
1931 --
1932 end if;
1933 close csr_cost_alloc_exists;
1934 --
1935 end if;
1936
1937 --
1938 --Checking whether the specified soft coding kff ID is there.
1939 --If it is not there, it will raise an error.
1940 --
1941 if((p_soft_coding_keyflex_id_in is not null)
1942 and (p_soft_coding_keyflex_id_in <>hr_api.g_number))then
1943 --
1944 open csr_soft_coding_exists(p_soft_coding_keyflex_id_in);
1945 fetch csr_soft_coding_exists into l_dummy;
1946 if (csr_soft_coding_exists%NOTFOUND) then
1947 --
1948 close csr_soft_coding_exists;
1949 fnd_message.set_name('PAY','PAY_33085_INVALID_FK');
1950 fnd_message.set_token('COLUMN','SOFT_CODING_KEYFLEX_ID');
1951 fnd_message.set_token('TABLE','HR_SOFT_CODING_KEYFLEX');
1952 fnd_message.raise_error;
1953 --
1954 end if;
1955 close csr_soft_coding_exists;
1956 --
1957 end if;
1958
1959 begin
1960 --
1961 pay_payroll_bk2.update_payroll_b
1962 (p_effective_date => l_effective_date
1963 ,p_datetrack_mode => p_datetrack_mode
1964 ,p_payroll_id => l_payroll_id
1965 ,p_object_version_number => l_object_version_number
1966 ,p_payroll_name => p_payroll_name
1967 ,p_number_of_years => p_number_of_years
1968 ,p_default_payment_method_id => p_default_payment_method_id
1972 ,p_negative_pay_allowed_flag => p_negative_pay_allowed_flag
1969 ,p_consolidation_set_id => p_consolidation_set_id
1970 ,p_cost_alloc_keyflex_id_in => p_cost_alloc_keyflex_id_in
1971 ,p_susp_account_keyflex_id_in => p_susp_account_keyflex_id_in
1973 ,p_soft_coding_keyflex_id_in => p_soft_coding_keyflex_id_in
1974 ,p_comments => p_comments
1975 ,p_attribute_category => p_attribute_category
1976 ,p_attribute1 => p_attribute1
1977 ,p_attribute2 => p_attribute2
1978 ,p_attribute3 => p_attribute3
1979 ,p_attribute4 => p_attribute4
1980 ,p_attribute5 => p_attribute5
1981 ,p_attribute6 => p_attribute6
1982 ,p_attribute7 => p_attribute7
1983 ,p_attribute8 => p_attribute8
1984 ,p_attribute9 => p_attribute9
1985 ,p_attribute10 => p_attribute10
1986 ,p_attribute11 => p_attribute11
1987 ,p_attribute12 => p_attribute12
1988 ,p_attribute13 => p_attribute13
1989 ,p_attribute14 => p_attribute14
1990 ,p_attribute15 => p_attribute15
1991 ,p_attribute16 => p_attribute16
1992 ,p_attribute17 => p_attribute17
1993 ,p_attribute18 => p_attribute18
1994 ,p_attribute19 => p_attribute19
1995 ,p_attribute20 => p_attribute20
1996 ,p_arrears_flag => p_arrears_flag
1997 ,p_multi_assignments_flag => p_multi_assignments_flag
1998 ,p_prl_information1 => p_prl_information1
1999 ,p_prl_information2 => p_prl_information2
2000 ,p_prl_information3 => p_prl_information3
2001 ,p_prl_information4 => p_prl_information4
2002 ,p_prl_information5 => p_prl_information5
2003 ,p_prl_information6 => p_prl_information6
2004 ,p_prl_information7 => p_prl_information7
2005 ,p_prl_information8 => p_prl_information8
2006 ,p_prl_information9 => p_prl_information9
2007 ,p_prl_information10 => p_prl_information10
2008 ,p_prl_information11 => p_prl_information11
2009 ,p_prl_information12 => p_prl_information12
2010 ,p_prl_information13 => p_prl_information13
2011 ,p_prl_information14 => p_prl_information14
2012 ,p_prl_information15 => p_prl_information15
2013 ,p_prl_information16 => p_prl_information16
2014 ,p_prl_information17 => p_prl_information17
2015 ,p_prl_information18 => p_prl_information18
2016 ,p_prl_information19 => p_prl_information19
2017 ,p_prl_information20 => p_prl_information20
2018 ,p_prl_information21 => p_prl_information21
2019 ,p_prl_information22 => p_prl_information22
2020 ,p_prl_information23 => p_prl_information23
2021 ,p_prl_information24 => p_prl_information24
2022 ,p_prl_information25 => p_prl_information25
2023 ,p_prl_information26 => p_prl_information26
2024 ,p_prl_information27 => p_prl_information27
2025 ,p_prl_information28 => p_prl_information28
2026 ,p_prl_information29 => p_prl_information29
2027 ,p_prl_information30 => p_prl_information30
2028
2029 ,p_cost_segment1 => p_cost_segment1
2030 ,p_cost_segment2 => p_cost_segment2
2031 ,p_cost_segment3 => p_cost_segment3
2032 ,p_cost_segment4 => p_cost_segment4
2033 ,p_cost_segment5 => p_cost_segment5
2034 ,p_cost_segment6 => p_cost_segment6
2035 ,p_cost_segment7 => p_cost_segment7
2036 ,p_cost_segment8 => p_cost_segment8
2037 ,p_cost_segment9 => p_cost_segment9
2038 ,p_cost_segment10 => p_cost_segment10
2039 ,p_cost_segment11 => p_cost_segment11
2040 ,p_cost_segment12 => p_cost_segment12
2041 ,p_cost_segment13 => p_cost_segment13
2042 ,p_cost_segment14 => p_cost_segment14
2043 ,p_cost_segment15 => p_cost_segment15
2044 ,p_cost_segment16 => p_cost_segment16
2045 ,p_cost_segment17 => p_cost_segment17
2046 ,p_cost_segment18 => p_cost_segment18
2047 ,p_cost_segment19 => p_cost_segment19
2048 ,p_cost_segment20 => p_cost_segment20
2049 ,p_cost_segment21 => p_cost_segment21
2050 ,p_cost_segment22 => p_cost_segment22
2051 ,p_cost_segment23 => p_cost_segment23
2052 ,p_cost_segment24 => p_cost_segment24
2053 ,p_cost_segment25 => p_cost_segment25
2054 ,p_cost_segment26 => p_cost_segment26
2055 ,p_cost_segment27 => p_cost_segment27
2056 ,p_cost_segment28 => p_cost_segment28
2057 ,p_cost_segment29 => p_cost_segment29
2058 ,p_cost_segment30 => p_cost_segment30
2059 ,p_cost_concat_segments_in => p_cost_concat_segments_in
2060
2061 ,p_susp_segment1 => p_susp_segment1
2062 ,p_susp_segment2 => p_susp_segment2
2063 ,p_susp_segment3 => p_susp_segment3
2064 ,p_susp_segment4 => p_susp_segment4
2065 ,p_susp_segment5 => p_susp_segment5
2066 ,p_susp_segment6 => p_susp_segment6
2070 ,p_susp_segment10 => p_susp_segment10
2067 ,p_susp_segment7 => p_susp_segment7
2068 ,p_susp_segment8 => p_susp_segment8
2069 ,p_susp_segment9 => p_susp_segment9
2071 ,p_susp_segment11 => p_susp_segment11
2072 ,p_susp_segment12 => p_susp_segment12
2073 ,p_susp_segment13 => p_susp_segment13
2074 ,p_susp_segment14 => p_susp_segment14
2075 ,p_susp_segment15 => p_susp_segment15
2076 ,p_susp_segment16 => p_susp_segment16
2077 ,p_susp_segment17 => p_susp_segment17
2078 ,p_susp_segment18 => p_susp_segment18
2079 ,p_susp_segment19 => p_susp_segment19
2080 ,p_susp_segment20 => p_susp_segment20
2081 ,p_susp_segment21 => p_susp_segment21
2082 ,p_susp_segment22 => p_susp_segment22
2083 ,p_susp_segment23 => p_susp_segment23
2084 ,p_susp_segment24 => p_susp_segment24
2085 ,p_susp_segment25 => p_susp_segment25
2086 ,p_susp_segment26 => p_susp_segment26
2087 ,p_susp_segment27 => p_susp_segment27
2088 ,p_susp_segment28 => p_susp_segment28
2089 ,p_susp_segment29 => p_susp_segment29
2090 ,p_susp_segment30 => p_susp_segment30
2091 ,p_susp_concat_segments_in => p_susp_concat_segments_in
2092
2093 ,p_scl_segment1 => p_scl_segment1
2094 ,p_scl_segment2 => p_scl_segment2
2095 ,p_scl_segment3 => p_scl_segment3
2096 ,p_scl_segment4 => p_scl_segment4
2097 ,p_scl_segment5 => p_scl_segment5
2098 ,p_scl_segment6 => p_scl_segment6
2099 ,p_scl_segment7 => p_scl_segment7
2100 ,p_scl_segment8 => p_scl_segment8
2101 ,p_scl_segment9 => p_scl_segment9
2102 ,p_scl_segment10 => p_scl_segment10
2103 ,p_scl_segment11 => p_scl_segment11
2104 ,p_scl_segment12 => p_scl_segment12
2105 ,p_scl_segment13 => p_scl_segment13
2106 ,p_scl_segment14 => p_scl_segment14
2107 ,p_scl_segment15 => p_scl_segment15
2108 ,p_scl_segment16 => p_scl_segment16
2109 ,p_scl_segment17 => p_scl_segment17
2110 ,p_scl_segment18 => p_scl_segment18
2111 ,p_scl_segment19 => p_scl_segment19
2112 ,p_scl_segment20 => p_scl_segment20
2113 ,p_scl_segment21 => p_scl_segment21
2114 ,p_scl_segment22 => p_scl_segment22
2115 ,p_scl_segment23 => p_scl_segment23
2116 ,p_scl_segment24 => p_scl_segment24
2117 ,p_scl_segment25 => p_scl_segment25
2118 ,p_scl_segment26 => p_scl_segment26
2119 ,p_scl_segment27 => p_scl_segment27
2120 ,p_scl_segment28 => p_scl_segment28
2121 ,p_scl_segment29 => p_scl_segment29
2122 ,p_scl_segment30 => p_scl_segment30
2123 ,p_scl_concat_segments_in => p_scl_concat_segments_in
2124
2125 ,p_business_group_id => l_business_group_id
2126
2127 ,p_workload_shifting_level => p_workload_shifting_level
2128 ,p_payslip_view_date_offset => p_payslip_view_date_offset
2129
2130 );
2131
2132 exception
2133 when hr_api.cannot_find_prog_unit then
2134 hr_api.cannot_find_prog_unit_error
2135 (p_module_name => 'update_payroll'
2136 ,p_hook_type => 'BP');
2137 --
2138 end;
2139
2140 if (p_cost_alloc_keyflex_id_in = hr_api.g_number) and
2141 (p_cost_segment1 <> hr_api.g_varchar2 or p_cost_segment2 <> hr_api.g_varchar2 or
2142 p_cost_segment3 <> hr_api.g_varchar2 or p_cost_segment4 <> hr_api.g_varchar2 or
2143 p_cost_segment5 <> hr_api.g_varchar2 or p_cost_segment6 <> hr_api.g_varchar2 or
2144 p_cost_segment7 <> hr_api.g_varchar2 or p_cost_segment8 <> hr_api.g_varchar2 or
2145 p_cost_segment9 <> hr_api.g_varchar2 or p_cost_segment10 <> hr_api.g_varchar2 or
2146 p_cost_segment11 <> hr_api.g_varchar2 or p_cost_segment12 <> hr_api.g_varchar2 or
2147 p_cost_segment13 <> hr_api.g_varchar2 or p_cost_segment14 <> hr_api.g_varchar2 or
2148 p_cost_segment15 <> hr_api.g_varchar2 or p_cost_segment16 <> hr_api.g_varchar2 or
2149 p_cost_segment17 <> hr_api.g_varchar2 or p_cost_segment18 <> hr_api.g_varchar2 or
2150 p_cost_segment19 <> hr_api.g_varchar2 or p_cost_segment20 <> hr_api.g_varchar2 or
2151 p_cost_segment21 <> hr_api.g_varchar2 or p_cost_segment22 <> hr_api.g_varchar2 or
2152 p_cost_segment23 <> hr_api.g_varchar2 or p_cost_segment24 <> hr_api.g_varchar2 or
2153 p_cost_segment25 <> hr_api.g_varchar2 or p_cost_segment26 <> hr_api.g_varchar2 or
2154 p_cost_segment27 <> hr_api.g_varchar2 or p_cost_segment28 <> hr_api.g_varchar2 or
2155 p_cost_segment29 <> hr_api.g_varchar2 or p_cost_segment30 <> hr_api.g_varchar2 or
2156 p_cost_concat_segments_in <> hr_api.g_varchar2)
2157 then
2158 --
2159 --
2160 --Retrieve the COSTING keyflex ID and structure identifier.
2161 --
2162
2163 open csr_get_costKFF;
2164 fetch csr_get_costKFF into l_cost_allocation_keyflex_id;
2165 if(csr_get_costKFF%NOTFOUND) then
2166 --
2167 close csr_get_costKFF;
2168 fnd_message.set_name('PAY', 'HR_INVALID_PAYROLL_ID');
2169 fnd_message.raise_error;
2170 --
2171 end if;
2172 close csr_get_costKFF;
2173
2174 open csr_cost_id_flex_num(l_business_group_id);
2178 --
2175 fetch csr_cost_id_flex_num into l_cost_id_flex_num;
2176 close csr_cost_id_flex_num;
2177
2179 --Make the flag true
2180 --
2181 l_cost_flag := true;
2182
2183 hr_kflex_utility.upd_or_sel_keyflex_comb(
2184 p_appl_short_name => 'PAY'
2185 ,p_flex_code => 'COST'
2186 ,p_flex_num => l_cost_id_flex_num
2187 ,p_ccid => l_cost_allocation_keyflex_id
2188 ,p_segment1 => p_cost_segment1
2189 ,p_segment2 => p_cost_segment2
2190 ,p_segment3 => p_cost_segment3
2191 ,p_segment4 => p_cost_segment4
2192 ,p_segment5 => p_cost_segment5
2193 ,p_segment6 => p_cost_segment6
2194 ,p_segment7 => p_cost_segment7
2195 ,p_segment8 => p_cost_segment8
2196 ,p_segment9 => p_cost_segment9
2197 ,p_segment10 => p_cost_segment10
2198 ,p_segment11 => p_cost_segment11
2199 ,p_segment12 => p_cost_segment12
2200 ,p_segment13 => p_cost_segment13
2201 ,p_segment14 => p_cost_segment14
2202 ,p_segment15 => p_cost_segment15
2203 ,p_segment16 => p_cost_segment16
2204 ,p_segment17 => p_cost_segment17
2205 ,p_segment18 => p_cost_segment18
2206 ,p_segment19 => p_cost_segment19
2207 ,p_segment20 => p_cost_segment20
2208 ,p_segment21 => p_cost_segment21
2209 ,p_segment22 => p_cost_segment22
2210 ,p_segment23 => p_cost_segment23
2211 ,p_segment24 => p_cost_segment24
2212 ,p_segment25 => p_cost_segment25
2213 ,p_segment26 => p_cost_segment26
2214 ,p_segment27 => p_cost_segment27
2215 ,p_segment28 => p_cost_segment28
2216 ,p_segment29 => p_cost_segment29
2217 ,p_segment30 => p_cost_segment30
2218 ,p_concat_segments_in => p_cost_concat_segments_in
2219 ,p_concat_segments_out => p_cost_concat_segments_out
2220 );
2221 --Calling the update_cost_concat_segs to update the concat segments into the row.
2222 update_cost_concat_segs(p_cost_alloc_keyflex_id => l_cost_allocation_keyflex_id
2223 ,p_concat_segments => p_cost_concat_segments_out);
2224 p_cost_alloc_keyflex_id_out := l_cost_allocation_keyflex_id;
2225 --
2226 end if;
2227
2228 if (p_susp_account_keyflex_id_in = hr_api.g_number) and
2229 (p_susp_segment1 <> hr_api.g_varchar2 or p_susp_segment2 <> hr_api.g_varchar2 or
2230 p_susp_segment3 <> hr_api.g_varchar2 or p_susp_segment4 <> hr_api.g_varchar2 or
2231 p_susp_segment5 <> hr_api.g_varchar2 or p_susp_segment6 <> hr_api.g_varchar2 or
2232 p_susp_segment7 <> hr_api.g_varchar2 or p_susp_segment8 <> hr_api.g_varchar2 or
2233 p_susp_segment9 <> hr_api.g_varchar2 or p_susp_segment10 <> hr_api.g_varchar2 or
2234 p_susp_segment11 <> hr_api.g_varchar2 or p_susp_segment12 <> hr_api.g_varchar2 or
2235 p_susp_segment13 <> hr_api.g_varchar2 or p_susp_segment14 <> hr_api.g_varchar2 or
2236 p_susp_segment15 <> hr_api.g_varchar2 or p_susp_segment16 <> hr_api.g_varchar2 or
2237 p_susp_segment17 <> hr_api.g_varchar2 or p_susp_segment18 <> hr_api.g_varchar2 or
2238 p_susp_segment19 <> hr_api.g_varchar2 or p_susp_segment20 <> hr_api.g_varchar2 or
2239 p_susp_segment21 <> hr_api.g_varchar2 or p_susp_segment22 <> hr_api.g_varchar2 or
2240 p_susp_segment23 <> hr_api.g_varchar2 or p_susp_segment24 <> hr_api.g_varchar2 or
2241 p_susp_segment25 <> hr_api.g_varchar2 or p_susp_segment26 <> hr_api.g_varchar2 or
2242 p_susp_segment27 <> hr_api.g_varchar2 or p_susp_segment28 <> hr_api.g_varchar2 or
2243 p_susp_segment29 <> hr_api.g_varchar2 or p_susp_segment30 <> hr_api.g_varchar2 or
2244 p_susp_concat_segments_in <> hr_api.g_varchar2)
2245 then
2246 --
2247 --
2248 --Retrieve the suspense account keyflex ID and structure identifier.
2249 --
2250 open csr_get_suspenseKFF;
2251 fetch csr_get_suspenseKFF into l_suspense_account_keyflex_id;
2252 if(csr_get_suspenseKFF%NOTFOUND) then
2253 --
2254 close csr_get_suspenseKFF;
2255 fnd_message.set_name('PAY', 'HR_INVALID_PAYROLL_ID');
2256 fnd_message.raise_error;
2257 --
2258 end if;
2259 close csr_get_suspenseKFF;
2260
2261 open csr_cost_id_flex_num(l_business_group_id);
2262 fetch csr_cost_id_flex_num into l_susp_id_flex_num;
2263 Close csr_cost_id_flex_num;
2264
2265 --
2266 --Make the flag true.
2267 --
2268 l_susp_flag := true;
2269
2270 hr_kflex_utility.upd_or_sel_keyflex_comb(
2271 p_appl_short_name => 'PAY'
2272 ,p_flex_code => 'COST'
2273 ,p_flex_num => l_susp_id_flex_num
2274 ,p_ccid => l_suspense_account_keyflex_id
2275 ,p_segment1 => p_susp_segment1
2276 ,p_segment2 => p_susp_segment2
2277 ,p_segment3 => p_susp_segment3
2278 ,p_segment4 => p_susp_segment4
2279 ,p_segment5 => p_susp_segment5
2280 ,p_segment6 => p_susp_segment6
2281 ,p_segment7 => p_susp_segment7
2282 ,p_segment8 => p_susp_segment8
2283 ,p_segment9 => p_susp_segment9
2284 ,p_segment10 => p_susp_segment10
2285 ,p_segment11 => p_susp_segment11
2286 ,p_segment12 => p_susp_segment12
2287 ,p_segment13 => p_susp_segment13
2288 ,p_segment14 => p_susp_segment14
2289 ,p_segment15 => p_susp_segment15
2293 ,p_segment19 => p_susp_segment19
2290 ,p_segment16 => p_susp_segment16
2291 ,p_segment17 => p_susp_segment17
2292 ,p_segment18 => p_susp_segment18
2294 ,p_segment20 => p_susp_segment20
2295 ,p_segment21 => p_susp_segment21
2296 ,p_segment22 => p_susp_segment22
2297 ,p_segment23 => p_susp_segment23
2298 ,p_segment24 => p_susp_segment24
2299 ,p_segment25 => p_susp_segment25
2300 ,p_segment26 => p_susp_segment26
2301 ,p_segment27 => p_susp_segment27
2302 ,p_segment28 => p_susp_segment28
2303 ,p_segment29 => p_susp_segment29
2304 ,p_segment30 => p_susp_segment30
2305 ,p_concat_segments_in => p_susp_concat_segments_in
2306 ,p_concat_segments_out => p_susp_concat_segments_out
2307 );
2308 update_cost_concat_segs(p_cost_alloc_keyflex_id => l_suspense_account_keyflex_id
2309 ,p_concat_segments => p_susp_concat_segments_out);
2310 p_susp_account_keyflex_id_out := l_suspense_account_keyflex_id;
2311
2312 --
2313 end if;
2314
2315 if (p_soft_coding_keyflex_id_in = hr_api.g_number) and
2316 (p_scl_segment1 <> hr_api.g_varchar2 or p_scl_segment2 <> hr_api.g_varchar2 or
2317 p_scl_segment3 <> hr_api.g_varchar2 or p_scl_segment4 <> hr_api.g_varchar2 or
2318 p_scl_segment5 <> hr_api.g_varchar2 or p_scl_segment6 <> hr_api.g_varchar2 or
2319 p_scl_segment7 <> hr_api.g_varchar2 or p_scl_segment8 <> hr_api.g_varchar2 or
2320 p_scl_segment9 <> hr_api.g_varchar2 or p_scl_segment10 <> hr_api.g_varchar2 or
2321 p_scl_segment11 <> hr_api.g_varchar2 or p_scl_segment12 <> hr_api.g_varchar2 or
2322 p_scl_segment13 <> hr_api.g_varchar2 or p_scl_segment14 <> hr_api.g_varchar2 or
2323 p_scl_segment15 <> hr_api.g_varchar2 or p_scl_segment16 <> hr_api.g_varchar2 or
2324 p_scl_segment17 <> hr_api.g_varchar2 or p_scl_segment18 <> hr_api.g_varchar2 or
2325 p_scl_segment19 <> hr_api.g_varchar2 or p_scl_segment20 <> hr_api.g_varchar2 or
2326 p_scl_segment21 <> hr_api.g_varchar2 or p_scl_segment22 <> hr_api.g_varchar2 or
2327 p_scl_segment23 <> hr_api.g_varchar2 or p_scl_segment24 <> hr_api.g_varchar2 or
2328 p_scl_segment25 <> hr_api.g_varchar2 or p_scl_segment26 <> hr_api.g_varchar2 or
2329 p_scl_segment27 <> hr_api.g_varchar2 or p_scl_segment28 <> hr_api.g_varchar2 or
2330 p_scl_segment29 <> hr_api.g_varchar2 or p_scl_segment30 <> hr_api.g_varchar2 or
2331 p_scl_concat_segments_in <> hr_api.g_varchar2)
2332 then
2333 --
2334 --
2335 --Retrieve the soft account keyflex ID and structure identifier.
2336 --
2337 open csr_get_softKFF;
2338 fetch csr_get_softKFF into l_soft_coding_keyflex_id;
2339 if(csr_get_softKFF%NOTFOUND) then
2340 --
2341 close csr_get_softKFF;
2342 fnd_message.set_name('PAY', 'HR_INVALID_PAYROLL_ID');
2343 fnd_message.raise_error;
2344 --
2345 end if;
2346 close csr_get_softKFF;
2347
2348 open csr_soft_id_flex_num(l_legislation_code);
2349 fetch csr_soft_id_flex_num into l_scl_id_flex_num;
2350 close csr_soft_id_flex_num;
2351
2352 --
2353 --Make the flag true.
2354 --
2355 l_soft_flag := true;
2356
2357 hr_kflex_utility.upd_or_sel_keyflex_comb(
2358 p_appl_short_name => 'PER'
2359 ,p_flex_code => 'SCL'
2360 ,p_flex_num => l_scl_id_flex_num
2361 ,p_ccid => l_soft_coding_keyflex_id
2362 ,p_segment1 => p_scl_segment1
2363 ,p_segment2 => p_scl_segment2
2364 ,p_segment3 => p_scl_segment3
2365 ,p_segment4 => p_scl_segment4
2366 ,p_segment5 => p_scl_segment5
2367 ,p_segment6 => p_scl_segment6
2368 ,p_segment7 => p_scl_segment7
2369 ,p_segment8 => p_scl_segment8
2370 ,p_segment9 => p_scl_segment9
2371 ,p_segment10 => p_scl_segment10
2372 ,p_segment11 => p_scl_segment11
2373 ,p_segment12 => p_scl_segment12
2374 ,p_segment13 => p_scl_segment13
2375 ,p_segment14 => p_scl_segment14
2376 ,p_segment15 => p_scl_segment15
2377 ,p_segment16 => p_scl_segment16
2378 ,p_segment17 => p_scl_segment17
2379 ,p_segment18 => p_scl_segment18
2380 ,p_segment19 => p_scl_segment19
2381 ,p_segment20 => p_scl_segment20
2382 ,p_segment21 => p_scl_segment21
2383 ,p_segment22 => p_scl_segment22
2384 ,p_segment23 => p_scl_segment23
2385 ,p_segment24 => p_scl_segment24
2386 ,p_segment25 => p_scl_segment25
2387 ,p_segment26 => p_scl_segment26
2388 ,p_segment27 => p_scl_segment27
2389 ,p_segment28 => p_scl_segment28
2390 ,p_segment29 => p_scl_segment29
2391 ,p_segment30 => p_scl_segment30
2392 ,p_concat_segments_in => p_scl_concat_segments_in
2393 ,p_concat_segments_out => p_scl_concat_segments_out
2394 );
2395 --Need to call this procedure in the future if it's required to update the
2396 --concatenated segments when the individual segments are given.
2397
2398 --update_soft_concat_segs(p_soft_coding_keyflex_id => l_soft_coding_keyflex_id
2399 -- ,p_concat_segments => p_scl_concat_segments_out);
2400 p_soft_coding_keyflex_id_out := l_soft_coding_keyflex_id;
2401
2402 --
2403 end if;
2407 (p_prl_information7 <> hr_api.g_varchar2) or (p_prl_information8 <> hr_api.g_varchar2) or
2404 if ((p_prl_information1 <> hr_api.g_varchar2) or (p_prl_information2 <> hr_api.g_varchar2) or
2405 (p_prl_information3 <> hr_api.g_varchar2) or (p_prl_information4 <> hr_api.g_varchar2) or
2406 (p_prl_information5 <> hr_api.g_varchar2) or (p_prl_information6 <> hr_api.g_varchar2) or
2408 (p_prl_information9 <> hr_api.g_varchar2) or (p_prl_information10 <> hr_api.g_varchar2) or
2409 (p_prl_information11 <> hr_api.g_varchar2) or (p_prl_information12 <> hr_api.g_varchar2) or
2410 (p_prl_information13 <> hr_api.g_varchar2) or (p_prl_information14 <> hr_api.g_varchar2) or
2411 (p_prl_information15 <> hr_api.g_varchar2) or (p_prl_information16 <> hr_api.g_varchar2) or
2412 (p_prl_information17 <> hr_api.g_varchar2) or (p_prl_information18 <> hr_api.g_varchar2) or
2413 (p_prl_information19 <> hr_api.g_varchar2) or (p_prl_information20 <> hr_api.g_varchar2) or
2414 (p_prl_information21 <> hr_api.g_varchar2) or (p_prl_information22 <> hr_api.g_varchar2) or
2415 (p_prl_information23 <> hr_api.g_varchar2) or (p_prl_information24 <> hr_api.g_varchar2) or
2416 (p_prl_information25 <> hr_api.g_varchar2) or (p_prl_information26 <> hr_api.g_varchar2) or
2417 (p_prl_information27 <> hr_api.g_varchar2) or (p_prl_information28 <> hr_api.g_varchar2) or
2418 (p_prl_information29 <> hr_api.g_varchar2) or (p_prl_information30 <> hr_api.g_varchar2)) then
2419 --
2420 l_prl_information_category := l_legislation_code;
2421 --
2422 end if;
2423
2424 pay_pay_upd.upd
2425 (p_effective_date => l_effective_date
2426 ,p_datetrack_mode => p_datetrack_mode
2427 ,p_payroll_id => l_payroll_id
2428 ,p_object_version_number => l_object_version_number
2429 ,p_consolidation_set_id => p_consolidation_set_id
2430 ,p_negative_pay_allowed_flag => p_negative_pay_allowed_flag
2431 ,p_number_of_years => p_number_of_years
2432 ,p_payroll_name => p_payroll_name
2433 ,p_default_payment_method_id => p_default_payment_method_id
2434 ,p_cost_allocation_keyflex_id => l_cost_allocation_keyflex_id
2435 ,p_suspense_account_keyflex_id => l_suspense_account_keyflex_id
2436 ,p_soft_coding_keyflex_id => l_soft_coding_keyflex_id
2437 ,p_comments => p_comments
2438 ,p_attribute_category => p_attribute_category
2439 ,p_attribute1 => p_attribute1
2440 ,p_attribute2 => p_attribute2
2441 ,p_attribute3 => p_attribute3
2442 ,p_attribute4 => p_attribute4
2443 ,p_attribute5 => p_attribute5
2444 ,p_attribute6 => p_attribute6
2445 ,p_attribute7 => p_attribute7
2446 ,p_attribute8 => p_attribute8
2447 ,p_attribute9 => p_attribute9
2448 ,p_attribute10 => p_attribute10
2449 ,p_attribute11 => p_attribute11
2450 ,p_attribute12 => p_attribute12
2451 ,p_attribute13 => p_attribute13
2452 ,p_attribute14 => p_attribute14
2453 ,p_attribute15 => p_attribute15
2454 ,p_attribute16 => p_attribute16
2455 ,p_attribute17 => p_attribute17
2456 ,p_attribute18 => p_attribute18
2457 ,p_attribute19 => p_attribute19
2458 ,p_attribute20 => p_attribute20
2459 ,p_arrears_flag => p_arrears_flag
2460 ,p_prl_information_category => l_prl_information_category
2461 ,p_prl_information1 => p_prl_information1
2462 ,p_prl_information2 => p_prl_information2
2463 ,p_prl_information3 => p_prl_information3
2464 ,p_prl_information4 => p_prl_information4
2465 ,p_prl_information5 => p_prl_information5
2466 ,p_prl_information6 => p_prl_information6
2467 ,p_prl_information7 => p_prl_information7
2468 ,p_prl_information8 => p_prl_information8
2469 ,p_prl_information9 => p_prl_information9
2470 ,p_prl_information10 => p_prl_information10
2471 ,p_prl_information11 => p_prl_information11
2472 ,p_prl_information12 => p_prl_information12
2473 ,p_prl_information13 => p_prl_information13
2474 ,p_prl_information14 => p_prl_information14
2475 ,p_prl_information15 => p_prl_information15
2476 ,p_prl_information16 => p_prl_information16
2477 ,p_prl_information17 => p_prl_information17
2478 ,p_prl_information18 => p_prl_information18
2479 ,p_prl_information19 => p_prl_information19
2480 ,p_prl_information20 => p_prl_information20
2481 ,p_prl_information21 => p_prl_information21
2482 ,p_prl_information22 => p_prl_information22
2483 ,p_prl_information23 => p_prl_information23
2484 ,p_prl_information24 => p_prl_information24
2485 ,p_prl_information25 => p_prl_information25
2486 ,p_prl_information26 => p_prl_information26
2487 ,p_prl_information27 => p_prl_information27
2488 ,p_prl_information28 => p_prl_information28
2489 ,p_prl_information29 => p_prl_information29
2490 ,p_prl_information30 => p_prl_information30
2491 /* Added multi_assignment_flag field to update the value of that flag */
2492 ,p_multi_assignments_flag => p_multi_assignments_flag
2493 ,p_workload_shifting_level => p_workload_shifting_level
2497 ,p_effective_end_date => l_effective_end_date
2494 ,p_payslip_view_date_offset => p_payslip_view_date_offset
2495
2496 ,p_effective_start_date => l_effective_start_date
2498 ,p_comment_id => p_comment_id);
2499
2500 hr_payrolls.create_payroll_proc_periods
2501 (l_payroll_id,
2502 null, -- last_update_date
2503 null, -- last_updated_by
2504 null, -- last_update_login
2505 null, -- created_by
2506 null, -- creation_date
2507 l_effective_date -- effective_date
2508 );
2509
2510 begin
2511 pay_payroll_bk2.update_payroll_a
2512 (p_effective_date => l_effective_date
2513 ,p_datetrack_mode => p_datetrack_mode
2514 ,p_payroll_id => l_payroll_id
2515 ,p_object_version_number => l_object_version_number
2516 ,p_payroll_name => p_payroll_name
2517 ,p_number_of_years => p_number_of_years
2518 ,p_default_payment_method_id => p_default_payment_method_id
2519 ,p_consolidation_set_id => p_consolidation_set_id
2520 ,p_cost_alloc_keyflex_id_in => l_cost_allocation_keyflex_id
2521 ,p_susp_account_keyflex_id_in => l_suspense_account_keyflex_id
2522 ,p_negative_pay_allowed_flag => p_negative_pay_allowed_flag
2523 ,p_soft_coding_keyflex_id_in => l_soft_coding_keyflex_id
2524 ,p_comments => p_comments
2525 ,p_attribute_category => p_attribute_category
2526 ,p_attribute1 => p_attribute1
2527 ,p_attribute2 => p_attribute2
2528 ,p_attribute3 => p_attribute3
2529 ,p_attribute4 => p_attribute4
2530 ,p_attribute5 => p_attribute5
2531 ,p_attribute6 => p_attribute6
2532 ,p_attribute7 => p_attribute7
2533 ,p_attribute8 => p_attribute8
2534 ,p_attribute9 => p_attribute9
2535 ,p_attribute10 => p_attribute10
2536 ,p_attribute11 => p_attribute11
2537 ,p_attribute12 => p_attribute12
2538 ,p_attribute13 => p_attribute13
2539 ,p_attribute14 => p_attribute14
2540 ,p_attribute15 => p_attribute15
2541 ,p_attribute16 => p_attribute16
2542 ,p_attribute17 => p_attribute17
2543 ,p_attribute18 => p_attribute18
2544 ,p_attribute19 => p_attribute19
2545 ,p_attribute20 => p_attribute20
2546 ,p_arrears_flag => p_arrears_flag
2547 ,p_multi_assignments_flag => p_multi_assignments_flag
2548 ,p_prl_information1 => p_prl_information1
2549 ,p_prl_information2 => p_prl_information2
2550 ,p_prl_information3 => p_prl_information3
2551 ,p_prl_information4 => p_prl_information4
2552 ,p_prl_information5 => p_prl_information5
2553 ,p_prl_information6 => p_prl_information6
2554 ,p_prl_information7 => p_prl_information7
2555 ,p_prl_information8 => p_prl_information8
2556 ,p_prl_information9 => p_prl_information9
2557 ,p_prl_information10 => p_prl_information10
2558 ,p_prl_information11 => p_prl_information11
2559 ,p_prl_information12 => p_prl_information12
2560 ,p_prl_information13 => p_prl_information13
2561 ,p_prl_information14 => p_prl_information14
2562 ,p_prl_information15 => p_prl_information15
2563 ,p_prl_information16 => p_prl_information16
2564 ,p_prl_information17 => p_prl_information17
2565 ,p_prl_information18 => p_prl_information18
2566 ,p_prl_information19 => p_prl_information19
2567 ,p_prl_information20 => p_prl_information20
2568 ,p_prl_information21 => p_prl_information21
2569 ,p_prl_information22 => p_prl_information22
2570 ,p_prl_information23 => p_prl_information23
2571 ,p_prl_information24 => p_prl_information24
2572 ,p_prl_information25 => p_prl_information25
2573 ,p_prl_information26 => p_prl_information26
2574 ,p_prl_information27 => p_prl_information27
2575 ,p_prl_information28 => p_prl_information28
2576 ,p_prl_information29 => p_prl_information29
2577 ,p_prl_information30 => p_prl_information30
2578
2579 ,p_cost_segment1 => p_cost_segment1
2580 ,p_cost_segment2 => p_cost_segment2
2581 ,p_cost_segment3 => p_cost_segment3
2582 ,p_cost_segment4 => p_cost_segment4
2583 ,p_cost_segment5 => p_cost_segment5
2584 ,p_cost_segment6 => p_cost_segment6
2585 ,p_cost_segment7 => p_cost_segment7
2586 ,p_cost_segment8 => p_cost_segment8
2587 ,p_cost_segment9 => p_cost_segment9
2588 ,p_cost_segment10 => p_cost_segment10
2589 ,p_cost_segment11 => p_cost_segment11
2590 ,p_cost_segment12 => p_cost_segment12
2591 ,p_cost_segment13 => p_cost_segment13
2592 ,p_cost_segment14 => p_cost_segment14
2593 ,p_cost_segment15 => p_cost_segment15
2594 ,p_cost_segment16 => p_cost_segment16
2595 ,p_cost_segment17 => p_cost_segment17
2596 ,p_cost_segment18 => p_cost_segment18
2597 ,p_cost_segment19 => p_cost_segment19
2598 ,p_cost_segment20 => p_cost_segment20
2602 ,p_cost_segment24 => p_cost_segment24
2599 ,p_cost_segment21 => p_cost_segment21
2600 ,p_cost_segment22 => p_cost_segment22
2601 ,p_cost_segment23 => p_cost_segment23
2603 ,p_cost_segment25 => p_cost_segment25
2604 ,p_cost_segment26 => p_cost_segment26
2605 ,p_cost_segment27 => p_cost_segment27
2606 ,p_cost_segment28 => p_cost_segment28
2607 ,p_cost_segment29 => p_cost_segment29
2608 ,p_cost_segment30 => p_cost_segment30
2609 ,p_cost_concat_segments_in => p_cost_concat_segments_in
2610
2611 ,p_susp_segment1 => p_susp_segment1
2612 ,p_susp_segment2 => p_susp_segment2
2613 ,p_susp_segment3 => p_susp_segment3
2614 ,p_susp_segment4 => p_susp_segment4
2615 ,p_susp_segment5 => p_susp_segment5
2616 ,p_susp_segment6 => p_susp_segment6
2617 ,p_susp_segment7 => p_susp_segment7
2618 ,p_susp_segment8 => p_susp_segment8
2619 ,p_susp_segment9 => p_susp_segment9
2620 ,p_susp_segment10 => p_susp_segment10
2621 ,p_susp_segment11 => p_susp_segment11
2622 ,p_susp_segment12 => p_susp_segment12
2623 ,p_susp_segment13 => p_susp_segment13
2624 ,p_susp_segment14 => p_susp_segment14
2625 ,p_susp_segment15 => p_susp_segment15
2626 ,p_susp_segment16 => p_susp_segment16
2627 ,p_susp_segment17 => p_susp_segment17
2628 ,p_susp_segment18 => p_susp_segment18
2629 ,p_susp_segment19 => p_susp_segment19
2630 ,p_susp_segment20 => p_susp_segment20
2631 ,p_susp_segment21 => p_susp_segment21
2632 ,p_susp_segment22 => p_susp_segment22
2633 ,p_susp_segment23 => p_susp_segment23
2634 ,p_susp_segment24 => p_susp_segment24
2635 ,p_susp_segment25 => p_susp_segment25
2636 ,p_susp_segment26 => p_susp_segment26
2637 ,p_susp_segment27 => p_susp_segment27
2638 ,p_susp_segment28 => p_susp_segment28
2639 ,p_susp_segment29 => p_susp_segment29
2640 ,p_susp_segment30 => p_susp_segment30
2641 ,p_susp_concat_segments_in => p_susp_concat_segments_in
2642
2643 ,p_scl_segment1 => p_scl_segment1
2644 ,p_scl_segment2 => p_scl_segment2
2645 ,p_scl_segment3 => p_scl_segment3
2646 ,p_scl_segment4 => p_scl_segment4
2647 ,p_scl_segment5 => p_scl_segment5
2648 ,p_scl_segment6 => p_scl_segment6
2649 ,p_scl_segment7 => p_scl_segment7
2650 ,p_scl_segment8 => p_scl_segment8
2651 ,p_scl_segment9 => p_scl_segment9
2652 ,p_scl_segment10 => p_scl_segment10
2653 ,p_scl_segment11 => p_scl_segment11
2654 ,p_scl_segment12 => p_scl_segment12
2655 ,p_scl_segment13 => p_scl_segment13
2656 ,p_scl_segment14 => p_scl_segment14
2657 ,p_scl_segment15 => p_scl_segment15
2658 ,p_scl_segment16 => p_scl_segment16
2659 ,p_scl_segment17 => p_scl_segment17
2660 ,p_scl_segment18 => p_scl_segment18
2661 ,p_scl_segment19 => p_scl_segment19
2662 ,p_scl_segment20 => p_scl_segment20
2663 ,p_scl_segment21 => p_scl_segment21
2664 ,p_scl_segment22 => p_scl_segment22
2665 ,p_scl_segment23 => p_scl_segment23
2666 ,p_scl_segment24 => p_scl_segment24
2667 ,p_scl_segment25 => p_scl_segment25
2668 ,p_scl_segment26 => p_scl_segment26
2669 ,p_scl_segment27 => p_scl_segment27
2670 ,p_scl_segment28 => p_scl_segment28
2671 ,p_scl_segment29 => p_scl_segment29
2672 ,p_scl_segment30 => p_scl_segment30
2673 ,p_scl_concat_segments_in => p_scl_concat_segments_in
2674
2675 ,p_workload_shifting_level => p_workload_shifting_level
2676 ,p_payslip_view_date_offset => p_payslip_view_date_offset
2677
2678 ,p_cost_concat_segments_out => p_cost_concat_segments_out
2679 ,p_susp_concat_segments_out => p_susp_concat_segments_out
2680 ,p_scl_concat_segments_out => p_scl_concat_segments_out
2681
2682 ,p_effective_start_date => l_effective_start_date
2683 ,p_effective_end_date => l_effective_end_date
2684 ,p_comment_id => p_comment_id
2685 ,p_cost_alloc_keyflex_id_out => p_cost_alloc_keyflex_id_out
2686 ,p_susp_account_keyflex_id_out => p_susp_account_keyflex_id_out
2687 ,p_soft_coding_keyflex_id_out => p_soft_coding_keyflex_id_out
2688 ,p_business_group_id => l_business_group_id
2689
2690 );
2691
2692 exception
2693 when hr_api.cannot_find_prog_unit then
2694 hr_api.cannot_find_prog_unit_error
2695 (p_module_name => 'update_payroll'
2696 ,p_hook_type => 'AP'
2697 );
2698 --
2699 end;
2700
2701 if(p_validate) then
2702 --
2703 raise hr_api.validate_enabled;
2704 --
2705 end if;
2706 --
2707 -- Set all IN OUT and OUT parameters with out values
2708 --
2709 p_object_version_number := l_object_version_number;
2710 p_effective_start_date := l_effective_start_date;
2714
2711 p_effective_end_date := l_effective_end_date;
2712 p_comment_id := p_comment_id;
2713 p_payroll_id := l_payroll_id;
2715 --
2716 --If the user doesn't specify any id then to return to the user
2717 --need to query from the table
2718 --
2719 if ((p_cost_alloc_keyflex_id_in = hr_api.g_number) and (l_cost_flag = false)) then
2720 --
2721 open csr_get_costKFF;
2722 fetch csr_get_costKFF into p_cost_alloc_keyflex_id_out;
2723 close csr_get_costKFF;
2724 --
2725 end if;
2726 --
2727 if ((p_susp_account_keyflex_id_in = hr_api.g_number) and (l_susp_flag = false))then
2728 --
2729 open csr_get_suspenseKFF;
2730 fetch csr_get_suspenseKFF into p_susp_account_keyflex_id_out;
2731 close csr_get_suspenseKFF;
2732 --
2733 end if;
2734 --
2735 if ((p_soft_coding_keyflex_id_in = hr_api.g_number) and (l_soft_flag = false))then
2736 --
2737 open csr_get_softKFF;
2738 fetch csr_get_softKFF into p_soft_coding_keyflex_id_out;
2739 close csr_get_softKFF;
2740 --
2741 end if;
2742 --
2743 hr_utility.set_location(' Leaving:'||l_proc, 70);
2744 exception
2745 when hr_api.validate_enabled then
2746 --
2747 -- Must remove all work done by this procedure.
2748 --
2749 rollback to update_payroll;
2750
2751 p_object_version_number := l_object_version_number;
2752 p_effective_start_date := null;
2753 p_effective_end_date := null;
2754 p_comment_id := null;
2755 p_payroll_id := l_payroll_id;
2756
2757 p_cost_concat_segments_out := null;
2758 p_susp_concat_segments_out := null;
2759 p_scl_concat_segments_out := null;
2760 p_cost_alloc_keyflex_id_out := null;
2761 p_susp_account_keyflex_id_out:= null;
2762 p_soft_coding_keyflex_id_out := null;
2763
2764 when others then
2765 --
2766 -- Must remove all work done by this procedure.
2767 --
2768 rollback to update_payroll;
2769 p_object_version_number := l_object_version_number;
2770 p_effective_start_date := null;
2771 p_effective_end_date := null;
2772 p_comment_id := null;
2773 p_payroll_id := l_payroll_id;
2774
2775 p_cost_concat_segments_out := null;
2776 p_susp_concat_segments_out := null;
2777 p_scl_concat_segments_out := null;
2778 p_cost_alloc_keyflex_id_out := null;
2779 p_susp_account_keyflex_id_out:= null;
2780 p_soft_coding_keyflex_id_out := null;
2781
2782 raise;
2783 --
2784 end update_payroll;
2785
2786 --
2787 -- ----------------------------------------------------------------------------
2788 -- |----------------------------< delete_payroll >-----------------------------|
2789 -- ----------------------------------------------------------------------------
2790
2791 Procedure delete_payroll
2792 (p_validate in boolean default false,
2793 p_effective_date in date,
2794 p_datetrack_mode in varchar2,
2795 p_payroll_id in number,
2796 p_object_version_number in out nocopy number,
2797 p_effective_start_date out nocopy date,
2798 p_effective_end_date out nocopy date
2799 ) is
2800
2801 l_effective_date date;
2802 l_object_version_number pay_all_payrolls_f.object_version_number%type;
2803 l_effective_start_date pay_all_payrolls_f.effective_start_date%TYPE;
2804 l_effective_end_date pay_all_payrolls_f.effective_end_date%TYPE;
2805 l_proc varchar2(72) := g_package||'delete_payroll';
2806
2807 begin
2808 --
2809
2810 hr_utility.set_location(' Entering:'||l_proc, 10);
2811
2812 l_effective_date := trunc(p_effective_date);
2813 l_object_version_number := p_object_version_number;
2814
2815 savepoint delete_payroll;
2816 begin
2817 --
2818 pay_payroll_bk3.delete_payroll_b
2819 ( p_effective_date => l_effective_date
2820 ,p_datetrack_mode => p_datetrack_mode
2821 ,p_payroll_id => p_payroll_id
2822 ,p_object_version_number => l_object_version_number
2823 );
2824 exception
2825 when hr_api.cannot_find_prog_unit then
2826 hr_api.cannot_find_prog_unit_error
2827 (p_module_name => 'delete_payroll'
2828 ,p_hook_type => 'BP'
2829 );
2830 --
2831 end;
2832 pay_pay_del.del(
2833 p_effective_date => l_effective_date
2834 ,p_datetrack_mode => p_datetrack_mode
2835 ,p_payroll_id => p_payroll_id
2836 ,p_object_version_number => l_object_version_number
2837 ,p_effective_start_date => l_effective_start_date
2838 ,p_effective_end_date => l_effective_end_date
2839 );
2840
2841 begin
2842 --
2843 pay_payroll_bk3.delete_payroll_a
2844 (p_effective_date => l_effective_date
2845 ,p_datetrack_mode => p_datetrack_mode
2846 ,p_payroll_id => p_payroll_id
2847 ,p_object_version_number => l_object_version_number
2848 ,p_effective_start_date => l_effective_start_date
2852 when hr_api.cannot_find_prog_unit then
2849 ,p_effective_end_date => l_effective_end_date
2850 );
2851 exception
2853 hr_api.cannot_find_prog_unit_error
2854 (p_module_name => 'delete_payroll'
2855 ,p_hook_type => 'AP'
2856 );
2857 --
2858 end;
2859 --
2860 -- When in validation only mode raise the Validate_Enabled exception
2861 --
2862 if p_validate then
2863 raise hr_api.validate_enabled;
2864 end if;
2865 --
2866
2867 --populate the out parameters.
2868 p_object_version_number := l_object_version_number;
2869 p_effective_start_date := l_effective_start_date;
2870 p_effective_end_date := l_effective_end_date;
2871
2872 hr_utility.set_location(' Leaving:'||l_proc, 70);
2873
2874 exception
2875 when hr_api.validate_enabled then
2876 --
2877 -- Must remove all work done by this procedure.
2878 --
2879 rollback to delete_payroll;
2880 p_effective_start_date := null;
2881 p_effective_end_date := null;
2882
2883 when others then
2884 --
2885 -- Must remove all work done by this procedure.
2886 --
2887 rollback to delete_payroll;
2888 p_effective_start_date := null;
2889 p_effective_end_date := null;
2890 raise;
2891
2892 --
2893 end delete_payroll;
2894 --
2895
2896 -------------------------------- create_payroll -------------------------------
2897 /*
2898 NAME
2899 create_payroll
2900 DESCRIPTION
2901 Creates a Payroll and associated time periods.
2902 NOTES
2903 <none>
2904 */
2905
2906 procedure create_payroll
2907 (
2908 p_validate in boolean default false,
2909 p_effective_date in date,
2910 p_payroll_name in varchar2,
2911 p_payroll_type in varchar2 default null,
2912 p_period_type in varchar2,
2913 p_first_period_end_date in date,
2914 p_number_of_years in number,
2915 p_pay_date_offset in number default 0,
2916 p_direct_deposit_date_offset in number default 0,
2917 p_pay_advice_date_offset in number default 0,
2918 p_cut_off_date_offset in number default 0,
2919 p_midpoint_offset in number default null,
2920 p_default_payment_method_id in number default null,
2921 p_consolidation_set_id in number,
2922 p_cost_allocation_keyflex_id in number default null,
2923 p_suspense_account_keyflex_id in number default null,
2924 p_negative_pay_allowed_flag in varchar2 default 'N',
2925 p_gl_set_of_books_id in number default null,
2926 p_soft_coding_keyflex_id in number default null,
2927 p_comments in varchar2 default null,
2928 p_attribute_category in varchar2 default null,
2929 p_attribute1 in varchar2 default null,
2930 p_attribute2 in varchar2 default null,
2931 p_attribute3 in varchar2 default null,
2932 p_attribute4 in varchar2 default null,
2933 p_attribute5 in varchar2 default null,
2934 p_attribute6 in varchar2 default null,
2935 p_attribute7 in varchar2 default null,
2936 p_attribute8 in varchar2 default null,
2937 p_attribute9 in varchar2 default null,
2938 p_attribute10 in varchar2 default null,
2939 p_attribute11 in varchar2 default null,
2940 p_attribute12 in varchar2 default null,
2941 p_attribute13 in varchar2 default null,
2942 p_attribute14 in varchar2 default null,
2943 p_attribute15 in varchar2 default null,
2944 p_attribute16 in varchar2 default null,
2945 p_attribute17 in varchar2 default null,
2946 p_attribute18 in varchar2 default null,
2947 p_attribute19 in varchar2 default null,
2948 p_attribute20 in varchar2 default null,
2949 p_arrears_flag in varchar2 default 'N',
2950 p_period_reset_years in varchar2 default null,
2951 p_multi_assignments_flag in varchar2 default null,
2952 p_organization_id in number default null,
2953 p_prl_information_category in varchar2 default null,
2954 p_prl_information1 in varchar2 default null,
2955 p_prl_information2 in varchar2 default null,
2956 p_prl_information3 in varchar2 default null,
2957 p_prl_information4 in varchar2 default null,
2958 p_prl_information5 in varchar2 default null,
2959 p_prl_information6 in varchar2 default null,
2960 p_prl_information7 in varchar2 default null,
2961 p_prl_information8 in varchar2 default null,
2962 p_prl_information9 in varchar2 default null,
2963 p_prl_information10 in varchar2 default null,
2964 p_prl_information11 in varchar2 default null,
2965 p_prl_information12 in varchar2 default null,
2966 p_prl_information13 in varchar2 default null,
2970 p_prl_information17 in varchar2 default null,
2967 p_prl_information14 in varchar2 default null,
2968 p_prl_information15 in varchar2 default null,
2969 p_prl_information16 in varchar2 default null,
2971 p_prl_information18 in varchar2 default null,
2972 p_prl_information19 in varchar2 default null,
2973 p_prl_information20 in varchar2 default null,
2974 p_prl_information21 in varchar2 default null,
2975 p_prl_information22 in varchar2 default null,
2976 p_prl_information23 in varchar2 default null,
2977 p_prl_information24 in varchar2 default null,
2978 p_prl_information25 in varchar2 default null,
2979 p_prl_information26 in varchar2 default null,
2980 p_prl_information27 in varchar2 default null,
2981 p_prl_information28 in varchar2 default null,
2982 p_prl_information29 in varchar2 default null,
2983 p_prl_information30 in varchar2 default null,
2984
2985 p_payroll_id out nocopy number,
2986 p_org_pay_method_usage_id out nocopy number,
2987 p_prl_object_version_number out nocopy number,
2988 p_opm_object_version_number out nocopy number,
2989 p_prl_effective_start_date out nocopy date,
2990 p_prl_effective_end_date out nocopy date,
2991 p_opm_effective_start_date out nocopy date,
2992 p_opm_effective_end_date out nocopy date,
2993 p_comment_id out nocopy number
2994 ) is
2995
2996 l_payroll_id number;
2997 l_org_pay_method_usage_id number;
2998 l_prl_object_version_number number;
2999 l_opm_object_version_number number;
3000 l_prl_effective_start_date date;
3001 l_prl_effective_end_date date;
3002 l_opm_effective_start_date date;
3003 l_opm_effective_end_date date;
3004 l_comment_id number;
3005
3006 l_business_group_id PAY_ALL_PAYROLLS_F.business_group_id%TYPE;
3007 l_legislation_code varchar2(150);
3008
3009 l_cost_allocation_keyflex_id PAY_ALL_PAYROLLS_F.COST_ALLOCATION_KEYFLEX_ID%TYPE ;
3010 l_suspense_account_keyflex_id PAY_ALL_PAYROLLS_F.SUSPENSE_ACCOUNT_KEYFLEX_ID%TYPE ;
3011 l_soft_coding_keyflex_id PAY_ALL_PAYROLLS_F.SOFT_CODING_KEYFLEX_ID%TYPE ;
3012
3013 l_cost_concat_segments PAY_COST_ALLOCATION_KEYFLEX.concatenated_segments%TYPE ;
3014 l_susp_concat_segments PAY_COST_ALLOCATION_KEYFLEX.concatenated_segments%TYPE ;
3015 l_scl_concat_segments HR_SOFT_CODING_KEYFLEX.concatenated_segments%TYPE;
3016
3017 begin
3018
3019 --Get the business group id from the consolidation set id.
3020 pay_pay_bus.chk_consolidation_set_id(p_consolidation_set_id,l_business_group_id);
3021
3022 --Get the Legislation code.
3023 l_legislation_code := hr_api.return_legislation_code(l_business_group_id);
3024 if(l_legislation_code <> p_prl_information_category) then
3025 fnd_message.set_name('PAY', 'PAY_33275_INFOCATEGORY_INVALID');
3026 fnd_message.raise_error;
3027 end if;
3028
3029 pay_payroll_api.create_payroll(
3030
3031 p_validate => p_validate
3032 ,p_effective_date => p_effective_date
3033 ,p_payroll_name => p_payroll_name
3034 ,p_consolidation_set_id => p_consolidation_set_id
3035 ,p_period_type => p_period_type
3036 ,p_first_period_end_date => p_first_period_end_date
3037 ,p_number_of_years => p_number_of_years
3038 ,p_payroll_type => p_payroll_type
3039 ,p_pay_date_offset => p_pay_date_offset
3040 ,p_direct_deposit_date_offset => p_direct_deposit_date_offset
3041 ,p_pay_advice_date_offset => p_pay_advice_date_offset
3042 ,p_cut_off_date_offset => p_cut_off_date_offset
3043 ,p_midpoint_offset => p_midpoint_offset
3044 ,p_default_payment_method_id => p_default_payment_method_id
3045 ,p_cost_alloc_keyflex_id_in => p_cost_allocation_keyflex_id
3046 ,p_susp_account_keyflex_id_in => p_suspense_account_keyflex_id
3047 ,p_negative_pay_allowed_flag => p_negative_pay_allowed_flag
3048 ,p_gl_set_of_books_id => p_gl_set_of_books_id
3049 ,p_soft_coding_keyflex_id_in => p_soft_coding_keyflex_id
3050 ,p_comments => p_comments
3051 ,p_attribute_category => p_attribute_category
3052 ,p_attribute1 => p_attribute1
3053 ,p_attribute2 => p_attribute2
3054 ,p_attribute3 => p_attribute3
3055 ,p_attribute4 => p_attribute4
3056 ,p_attribute5 => p_attribute5
3057 ,p_attribute6 => p_attribute6
3058 ,p_attribute7 => p_attribute7
3059 ,p_attribute8 => p_attribute8
3060 ,p_attribute9 => p_attribute9
3061 ,p_attribute10 => p_attribute10
3062 ,p_attribute11 => p_attribute11
3063 ,p_attribute12 => p_attribute12
3064 ,p_attribute13 => p_attribute13
3065 ,p_attribute14 => p_attribute14
3066 ,p_attribute15 => p_attribute15
3067 ,p_attribute16 => p_attribute16
3068 ,p_attribute17 => p_attribute17
3069 ,p_attribute18 => p_attribute18
3070 ,p_attribute19 => p_attribute19
3071 ,p_attribute20 => p_attribute20
3072 ,p_arrears_flag => p_arrears_flag
3073 ,p_period_reset_years => p_period_reset_years
3074 ,p_multi_assignments_flag => p_multi_assignments_flag
3075 ,p_organization_id => p_organization_id
3076 ,p_prl_information1 => p_prl_information1
3077 ,p_prl_information2 => p_prl_information2
3078 ,p_prl_information3 => p_prl_information3
3079 ,p_prl_information4 => p_prl_information4
3083 ,p_prl_information8 => p_prl_information8
3080 ,p_prl_information5 => p_prl_information5
3081 ,p_prl_information6 => p_prl_information6
3082 ,p_prl_information7 => p_prl_information7
3084 ,p_prl_information9 => p_prl_information9
3085 ,p_prl_information10 => p_prl_information10
3086 ,p_prl_information11 => p_prl_information11
3087 ,p_prl_information12 => p_prl_information12
3088 ,p_prl_information13 => p_prl_information13
3089 ,p_prl_information14 => p_prl_information14
3090 ,p_prl_information15 => p_prl_information15
3091 ,p_prl_information16 => p_prl_information16
3092 ,p_prl_information17 => p_prl_information17
3093 ,p_prl_information18 => p_prl_information18
3094 ,p_prl_information19 => p_prl_information19
3095 ,p_prl_information20 => p_prl_information20
3096 ,p_prl_information21 => p_prl_information21
3097 ,p_prl_information22 => p_prl_information22
3098 ,p_prl_information23 => p_prl_information23
3099 ,p_prl_information24 => p_prl_information24
3100 ,p_prl_information25 => p_prl_information25
3101 ,p_prl_information26 => p_prl_information26
3102 ,p_prl_information27 => p_prl_information27
3103 ,p_prl_information28 => p_prl_information28
3104 ,p_prl_information29 => p_prl_information29
3105 ,p_prl_information30 => p_prl_information30
3106
3107 ,p_payroll_id => l_payroll_id
3108 ,p_org_pay_method_usage_id => l_org_pay_method_usage_id
3109 ,p_prl_object_version_number => l_prl_object_version_number
3110 ,p_opm_object_version_number => l_opm_object_version_number
3111 ,p_prl_effective_start_date => l_prl_effective_start_date
3112 ,p_prl_effective_end_date => l_prl_effective_end_date
3113 ,p_opm_effective_start_date => l_opm_effective_start_date
3114 ,p_opm_effective_end_date => l_opm_effective_end_date
3115 ,p_comment_id => l_comment_id
3116
3117 ,p_cost_alloc_keyflex_id_out => l_cost_allocation_keyflex_id
3118 ,p_susp_account_keyflex_id_out => l_suspense_account_keyflex_id
3119 ,p_soft_coding_keyflex_id_out => l_soft_coding_keyflex_id
3120
3121 ,p_cost_concat_segments_out => l_cost_concat_segments
3122 ,p_susp_concat_segments_out => l_susp_concat_segments
3123 ,p_scl_concat_segments_out => l_scl_concat_segments
3124
3125 );
3126 p_payroll_id := l_payroll_id;
3127 p_org_pay_method_usage_id := l_org_pay_method_usage_id;
3128 p_prl_object_version_number := l_prl_object_version_number;
3129 p_opm_object_version_number := l_opm_object_version_number;
3130 p_prl_effective_start_date := l_prl_effective_start_date;
3131 p_prl_effective_end_date := l_prl_effective_end_date;
3132 p_opm_effective_start_date := l_opm_effective_start_date;
3133 p_opm_effective_end_date := p_opm_effective_end_date;
3134 p_comment_id := p_comment_id;
3135
3136 end create_payroll;
3137 --
3138 -- ----------------------------------------------------------------------------
3139 -- |---------------------------< update_payroll >-----------------------------|
3140 -- ----------------------------------------------------------------------------
3141 --
3142 -- Description
3143 -- This procedure updates a payroll and the associated tables.
3144 -------------------------------------------------------------------------------
3145 procedure update_payroll
3146 (
3147 p_validate in boolean default false,
3148 p_effective_date in date,
3149 p_datetrack_mode in varchar2,
3150 p_payroll_id in out nocopy number,
3151 p_object_version_number in out nocopy number,
3152 p_payroll_name in varchar2 default hr_api.g_varchar2,
3153 p_number_of_years in number default hr_api.g_number,
3154 p_default_payment_method_id in number default hr_api.g_number,
3155 p_consolidation_set_id in number default hr_api.g_number,
3156 p_cost_allocation_keyflex_id in number default hr_api.g_number,
3157 p_suspense_account_keyflex_id in number default hr_api.g_number,
3158 p_negative_pay_allowed_flag in varchar2 default hr_api.g_varchar2,
3159 p_soft_coding_keyflex_id in number default hr_api.g_number,
3160 p_comments in varchar2 default hr_api.g_varchar2,
3161 p_attribute_category in varchar2 default hr_api.g_varchar2,
3162 p_attribute1 in varchar2 default hr_api.g_varchar2,
3163 p_attribute2 in varchar2 default hr_api.g_varchar2,
3164 p_attribute3 in varchar2 default hr_api.g_varchar2,
3165 p_attribute4 in varchar2 default hr_api.g_varchar2,
3166 p_attribute5 in varchar2 default hr_api.g_varchar2,
3167 p_attribute6 in varchar2 default hr_api.g_varchar2,
3168 p_attribute7 in varchar2 default hr_api.g_varchar2,
3169 p_attribute8 in varchar2 default hr_api.g_varchar2,
3170 p_attribute9 in varchar2 default hr_api.g_varchar2,
3171 p_attribute10 in varchar2 default hr_api.g_varchar2,
3172 p_attribute11 in varchar2 default hr_api.g_varchar2,
3173 p_attribute12 in varchar2 default hr_api.g_varchar2,
3174 p_attribute13 in varchar2 default hr_api.g_varchar2,
3175 p_attribute14 in varchar2 default hr_api.g_varchar2,
3176 p_attribute15 in varchar2 default hr_api.g_varchar2,
3177 p_attribute16 in varchar2 default hr_api.g_varchar2,
3181 p_attribute20 in varchar2 default hr_api.g_varchar2,
3178 p_attribute17 in varchar2 default hr_api.g_varchar2,
3179 p_attribute18 in varchar2 default hr_api.g_varchar2,
3180 p_attribute19 in varchar2 default hr_api.g_varchar2,
3182 p_arrears_flag in varchar2 default hr_api.g_varchar2,
3183 p_multi_assignments_flag in varchar2 default hr_api.g_varchar2,
3184 p_prl_information_category in varchar2 default hr_api.g_varchar2,
3185 p_prl_information1 in varchar2 default hr_api.g_varchar2,
3186 p_prl_information2 in varchar2 default hr_api.g_varchar2,
3187 p_prl_information3 in varchar2 default hr_api.g_varchar2,
3188 p_prl_information4 in varchar2 default hr_api.g_varchar2,
3189 p_prl_information5 in varchar2 default hr_api.g_varchar2,
3190 p_prl_information6 in varchar2 default hr_api.g_varchar2,
3191 p_prl_information7 in varchar2 default hr_api.g_varchar2,
3192 p_prl_information8 in varchar2 default hr_api.g_varchar2,
3193 p_prl_information9 in varchar2 default hr_api.g_varchar2,
3194 p_prl_information10 in varchar2 default hr_api.g_varchar2,
3195 p_prl_information11 in varchar2 default hr_api.g_varchar2,
3196 p_prl_information12 in varchar2 default hr_api.g_varchar2,
3197 p_prl_information13 in varchar2 default hr_api.g_varchar2,
3198 p_prl_information14 in varchar2 default hr_api.g_varchar2,
3199 p_prl_information15 in varchar2 default hr_api.g_varchar2,
3200 p_prl_information16 in varchar2 default hr_api.g_varchar2,
3201 p_prl_information17 in varchar2 default hr_api.g_varchar2,
3202 p_prl_information18 in varchar2 default hr_api.g_varchar2,
3203 p_prl_information19 in varchar2 default hr_api.g_varchar2,
3204 p_prl_information20 in varchar2 default hr_api.g_varchar2,
3205 p_prl_information21 in varchar2 default hr_api.g_varchar2,
3206 p_prl_information22 in varchar2 default hr_api.g_varchar2,
3207 p_prl_information23 in varchar2 default hr_api.g_varchar2,
3208 p_prl_information24 in varchar2 default hr_api.g_varchar2,
3209 p_prl_information25 in varchar2 default hr_api.g_varchar2,
3210 p_prl_information26 in varchar2 default hr_api.g_varchar2,
3211 p_prl_information27 in varchar2 default hr_api.g_varchar2,
3212 p_prl_information28 in varchar2 default hr_api.g_varchar2,
3213 p_prl_information29 in varchar2 default hr_api.g_varchar2,
3214 p_prl_information30 in varchar2 default hr_api.g_varchar2,
3215 p_prl_effective_start_date out nocopy date,
3216 p_prl_effective_end_date out nocopy date,
3217 p_comment_id out nocopy number
3218 ) is
3219 --
3220 l_proc varchar2(72) := g_package||'update_payroll';
3221
3222 l_payroll_id PAY_ALL_PAYROLLS_F.payroll_id%TYPE := p_payroll_id;
3223 l_object_version_number PAY_ALL_PAYROLLS_F.object_version_number%TYPE := p_object_version_number;
3224 l_prl_effective_start_date date;
3225 l_prl_effective_end_date date;
3226 l_comment_id number;
3227
3228 l_business_group_id PAY_ALL_PAYROLLS_F.business_group_id%TYPE;
3229 l_legislation_code varchar2(150);
3230
3231 l_cost_allocation_keyflex_id PAY_ALL_PAYROLLS_F.COST_ALLOCATION_KEYFLEX_ID%TYPE ;
3232 l_suspense_account_keyflex_id PAY_ALL_PAYROLLS_F.SUSPENSE_ACCOUNT_KEYFLEX_ID%TYPE ;
3233 l_soft_coding_keyflex_id PAY_ALL_PAYROLLS_F.SOFT_CODING_KEYFLEX_ID%TYPE ;
3234
3235 l_cost_concat_segments PAY_COST_ALLOCATION_KEYFLEX.concatenated_segments%TYPE ;
3236 l_susp_concat_segments PAY_COST_ALLOCATION_KEYFLEX.concatenated_segments%TYPE ;
3237 l_scl_concat_segments HR_SOFT_CODING_KEYFLEX.concatenated_segments%TYPE;
3238
3239 cursor csr_get_BG is
3240 select business_group_id
3241 from PAY_ALL_PAYROLLS_F
3242 where payroll_id = p_payroll_id;
3243 begin
3244 --
3245 hr_utility.set_location('Entering:'||l_proc, 5);
3246 hr_utility.trace('p_effective_date : '||to_char(p_effective_date));
3247 --Get the business group id from the payroll id.
3248 if (p_consolidation_set_id = hr_api.g_number) then
3249 open csr_get_BG;
3250 fetch csr_get_BG into l_business_group_id;
3251 if (csr_get_BG % NOTFOUND) then
3252 close csr_get_BG;
3253 fnd_message.set_name('PAY', 'PAY_KR_INV_CS_BG');
3254 fnd_message.raise_error;
3255 end if;
3256 close csr_get_BG;
3257 else
3258 pay_pay_bus.chk_consolidation_set_id(p_consolidation_set_id, l_business_group_id);
3259 end if;
3260
3261 --Get the Legislation code.
3262 l_legislation_code := hr_api.return_legislation_code(l_business_group_id);
3263
3264 if(l_legislation_code <> p_prl_information_category and
3265 p_prl_information_category <> hr_api.g_varchar2) then
3266 fnd_message.set_name('PAY', 'PAY_33275_INFOCATEGORY_INVALID');
3267 fnd_message.raise_error;
3268 end if;
3269
3270 pay_payroll_api.update_payroll(
3271 p_validate => p_validate
3272 ,p_effective_date => p_effective_date
3273 ,p_datetrack_mode => p_datetrack_mode
3274 ,p_payroll_name => p_payroll_name
3278 ,p_cost_alloc_keyflex_id_in => p_cost_allocation_keyflex_id
3275 ,p_consolidation_set_id => p_consolidation_set_id
3276 ,p_number_of_years => p_number_of_years
3277 ,p_default_payment_method_id => p_default_payment_method_id
3279 ,p_susp_account_keyflex_id_in => p_suspense_account_keyflex_id
3280 ,p_negative_pay_allowed_flag => p_negative_pay_allowed_flag
3281 ,p_soft_coding_keyflex_id_in => p_soft_coding_keyflex_id
3282 ,p_comments => p_comments
3283 ,p_attribute_category => p_attribute_category
3284 ,p_attribute1 => p_attribute1
3285 ,p_attribute2 => p_attribute2
3286 ,p_attribute3 => p_attribute3
3287 ,p_attribute4 => p_attribute4
3288 ,p_attribute5 => p_attribute5
3289 ,p_attribute6 => p_attribute6
3290 ,p_attribute7 => p_attribute7
3291 ,p_attribute8 => p_attribute8
3292 ,p_attribute9 => p_attribute9
3293 ,p_attribute10 => p_attribute10
3294 ,p_attribute11 => p_attribute11
3295 ,p_attribute12 => p_attribute12
3296 ,p_attribute13 => p_attribute13
3297 ,p_attribute14 => p_attribute14
3298 ,p_attribute15 => p_attribute15
3299 ,p_attribute16 => p_attribute16
3300 ,p_attribute17 => p_attribute17
3301 ,p_attribute18 => p_attribute18
3302 ,p_attribute19 => p_attribute19
3303 ,p_attribute20 => p_attribute20
3304 ,p_arrears_flag => p_arrears_flag
3305 ,p_multi_assignments_flag => p_multi_assignments_flag
3306 ,p_prl_information1 => p_prl_information1
3307 ,p_prl_information2 => p_prl_information2
3308 ,p_prl_information3 => p_prl_information3
3309 ,p_prl_information4 => p_prl_information4
3310 ,p_prl_information5 => p_prl_information5
3311 ,p_prl_information6 => p_prl_information6
3312 ,p_prl_information7 => p_prl_information7
3313 ,p_prl_information8 => p_prl_information8
3314 ,p_prl_information9 => p_prl_information9
3315 ,p_prl_information10 => p_prl_information10
3316 ,p_prl_information11 => p_prl_information11
3317 ,p_prl_information12 => p_prl_information12
3318 ,p_prl_information13 => p_prl_information13
3319 ,p_prl_information14 => p_prl_information14
3320 ,p_prl_information15 => p_prl_information15
3321 ,p_prl_information16 => p_prl_information16
3322 ,p_prl_information17 => p_prl_information17
3323 ,p_prl_information18 => p_prl_information18
3324 ,p_prl_information19 => p_prl_information19
3325 ,p_prl_information20 => p_prl_information20
3326 ,p_prl_information21 => p_prl_information21
3327 ,p_prl_information22 => p_prl_information22
3328 ,p_prl_information23 => p_prl_information23
3329 ,p_prl_information24 => p_prl_information24
3330 ,p_prl_information25 => p_prl_information25
3331 ,p_prl_information26 => p_prl_information26
3332 ,p_prl_information27 => p_prl_information27
3333 ,p_prl_information28 => p_prl_information28
3334 ,p_prl_information29 => p_prl_information29
3335 ,p_prl_information30 => p_prl_information30
3336
3337 ,p_payroll_id => l_payroll_id
3338 ,p_object_version_number => l_object_version_number
3339 ,p_effective_start_date => l_prl_effective_start_date
3340 ,p_effective_end_date => l_prl_effective_end_date
3341 ,p_comment_id => l_comment_id
3342
3343 ,p_cost_alloc_keyflex_id_out => l_cost_allocation_keyflex_id
3344 ,p_susp_account_keyflex_id_out => l_suspense_account_keyflex_id
3345 ,p_soft_coding_keyflex_id_out => l_soft_coding_keyflex_id
3346
3347 ,p_cost_concat_segments_out => l_cost_concat_segments
3348 ,p_susp_concat_segments_out => l_susp_concat_segments
3349 ,p_scl_concat_segments_out => l_scl_concat_segments
3350
3351 );
3352 p_payroll_id := l_payroll_id;
3353 p_object_version_number := l_object_version_number;
3354 p_prl_effective_start_date := l_prl_effective_start_date;
3355 p_prl_effective_end_date := l_prl_effective_end_date;
3356 p_comment_id := l_comment_id;
3357
3358 hr_utility.set_location('Leaving:'||l_proc, 5);
3359 --
3360 end update_payroll;
3361 -- ----------------------------------------------------------------------------
3362 -- |---------------------------< lock_payroll >-------------------------------|
3363 -- ----------------------------------------------------------------------------
3364 --
3365 -- Description
3366 -- This procedure locks a payroll while update and delete.
3367 -------------------------------------------------------------------------------
3368 Procedure lock_payroll
3369 (
3370 p_effective_date in date
3371 ,p_datetrack_mode in varchar2
3372 ,p_payroll_id in number
3373 ,p_object_version_number in number
3374 ,p_validation_start_date out nocopy date
3375 ,p_validation_end_date out nocopy date
3376 ) is
3377 --
3378
3379 l_proc varchar2(72) := g_package||'lock_payroll';
3380 l_validation_start_date date;
3381 l_validation_end_date date;
3382 --
3383 Begin
3384 hr_utility.set_location('Entering:'||l_proc, 5);
3385 pay_pay_shd.lck(
3386 p_effective_date
3387 ,p_datetrack_mode
3388 ,p_payroll_id
3389 ,p_object_version_number
3390 ,l_validation_start_date
3391 ,l_validation_end_date
3392 );
3393 p_validation_start_date := l_validation_start_date;
3394 p_validation_end_date := l_validation_end_date;
3395
3396 End lock_payroll;
3400 -- ----------------------------------------------------------------------------
3397 --
3398 -- ----------------------------------------------------------------------------
3399 -- |------------------------< set_base_key_value >----------------------------|
3401 procedure set_base_key_value
3402 (p_payroll_id in number) is
3403 --
3404 l_proc varchar2(72) := g_package||'set_base_key_value';
3405 --
3406 Begin
3407 hr_utility.set_location('Entering:'||l_proc, 10);
3408 --
3409 --g_payroll_id_i := p_payroll_id;
3410 pay_pay_ins.set_base_key_value(p_payroll_id);
3411 --
3412 hr_utility.set_location(' Leaving:'||l_proc, 20);
3413 End set_base_key_value;
3414 --
3415 -- ----------------------------------------------------------------------------
3416 -- |------------------------< return_api_dml_status >-------------------------|
3417 -- ----------------------------------------------------------------------------
3418 --
3419 -- Description
3420 -- This function will return the current g_api_dml private global
3421 -- boolean status.
3422 -- The g_api_dml status determines if at the time of the function
3423 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
3424 -- is being issued from within an api.
3425 -- If the status is TRUE then a dml statement is being issued from
3426 -- within this entity api.
3427 -- This function is primarily to support database triggers which
3428 -- need to maintain the object_version_number for non-supported
3429 -- dml statements (i.e. dml statement issued outside of the api layer).
3430 -------------------------------------------------------------------------------
3431 Function return_api_dml_status Return Boolean Is
3432 --
3433 Begin
3434 --
3435 hr_utility.trace('entered return_api_dml_status');
3436 return pay_pay_shd.return_api_dml_status;
3437 --
3438 End return_api_dml_status;
3439 --
3440 --
3441 end pay_payroll_api;
3442