[Home] [Help]
PACKAGE BODY: APPS.PER_BPA_BUS
Source
1 Package Body per_bpa_bus as
2 /* $Header: pebparhi.pkb 115.6 2002/12/02 13:36:46 apholt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_bpa_bus.'; -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code varchar2(150) default null;
14 g_processed_assignment_id number default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |---------------------< return_legislation_code >-------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 Function return_legislation_code
21 (p_processed_assignment_id in number
22 )
23 Return Varchar2 Is
24 --
25 -- Declare cursor
26 --
27 cursor csr_leg_code is
31 , per_bf_payroll_runs bpr
28 select pbg.legislation_code
29 from per_business_groups pbg
30 , per_bf_processed_assignments bpa
32 where bpa.processed_assignment_id = p_processed_assignment_id
33 and bpa.payroll_run_id = bpr.payroll_run_id
34 and pbg.business_group_id = bpr.business_group_id;
35 --
36 -- Declare local variables
37 --
38 l_legislation_code varchar2(150);
39 l_proc varchar2(72) := g_package||'return_legislation_code';
40 --
41 Begin
42 --
43 hr_utility.set_location('Entering:'|| l_proc, 10);
44 --
45 -- Ensure that all the mandatory parameter are not null
46 --
47 hr_api.mandatory_arg_error(p_api_name => l_proc
48 ,p_argument => 'PROCESSED_ASSIGNMENT_ID'
49 ,p_argument_value => p_processed_assignment_id);
50 --
51 if ( nvl(g_processed_assignment_id, hr_api.g_number)
52 = p_processed_assignment_id) then
53 --
54 -- The legislation code has already been found with a previous
55 -- call to this function. Just return the value in the global
56 -- variable.
57 --
58 l_legislation_code := g_legislation_code;
59 hr_utility.set_location(l_proc, 20);
60 else
61 --
62 -- The ID is different to the last call to this function
63 -- or this is the first call to this function.
64 --
65 open csr_leg_code;
66 fetch csr_leg_code into l_legislation_code;
67 --
68 if csr_leg_code%notfound then
69 --
70 -- The primary key is invalid therefore we must error
71 --
72 close csr_leg_code;
73 fnd_message.set_name('PER','HR_7220_INVALID_PRIMARY_KEY');
74 fnd_message.raise_error;
75 end if;
76 hr_utility.set_location(l_proc,30);
77 --
78 -- Set the global variables so the values are
79 -- available for the next call to this function.
80 --
81 close csr_leg_code;
82 g_processed_assignment_id := p_processed_assignment_id;
83 g_legislation_code := l_legislation_code;
84 end if;
85 hr_utility.set_location(' Leaving:'|| l_proc, 40);
86 return l_legislation_code;
87 end return_legislation_code;
88 --
89 -- ----------------------------------------------------------------------------
90 -- |------------------------------< chk_df >---------------------------------
91 --
92 -- ----------------------------------------------------------------------------
93 --
94 -- Description:
95 -- Validates all the Descriptive Flexfield values.
96 --
97 -- Prerequisites:
98 -- All other columns have been validated. Must be called as the
99 -- last step from insert_validate and update_validate.
100 --
101 -- In Arguments:
102 -- p_rec
103 --
104 -- Post Success:
105 -- If the Descriptive Flexfield structure column and data values are
106 -- all valid this procedure will end normally and processing will
107 -- continue.
108 --
109 -- Post Failure:
110 -- If the Descriptive Flexfield structure column value or any of
111 -- the data values are invalid then an application error is raised as
112 -- a PL/SQL exception.
113 --
114 -- Access Status:
115 -- Internal Row Handler Use Only.
116 --
117 -- ----------------------------------------------------------------------------
118 procedure chk_df
119 (p_rec in per_bpa_shd.g_rec_type
120 ) is
121 --
122 l_proc varchar2(72) := g_package || 'chk_df';
123 --
124 begin
125 hr_utility.set_location('Entering:'||l_proc,10);
126 --
127 if ((p_rec.processed_assignment_id is not null) and (
128 nvl(per_bpa_shd.g_old_rec.bpa_attribute_category, hr_api.g_varchar2) <>
129 nvl(p_rec.bpa_attribute_category, hr_api.g_varchar2) or
130 nvl(per_bpa_shd.g_old_rec.bpa_attribute1, hr_api.g_varchar2) <>
131 nvl(p_rec.bpa_attribute1, hr_api.g_varchar2) or
132 nvl(per_bpa_shd.g_old_rec.bpa_attribute2, hr_api.g_varchar2) <>
133 nvl(p_rec.bpa_attribute2, hr_api.g_varchar2) or
134 nvl(per_bpa_shd.g_old_rec.bpa_attribute3, hr_api.g_varchar2) <>
135 nvl(p_rec.bpa_attribute3, hr_api.g_varchar2) or
136 nvl(per_bpa_shd.g_old_rec.bpa_attribute4, hr_api.g_varchar2) <>
137 nvl(p_rec.bpa_attribute4, hr_api.g_varchar2) or
138 nvl(per_bpa_shd.g_old_rec.bpa_attribute5, hr_api.g_varchar2) <>
139 nvl(p_rec.bpa_attribute5, hr_api.g_varchar2) or
140 nvl(per_bpa_shd.g_old_rec.bpa_attribute6, hr_api.g_varchar2) <>
141 nvl(p_rec.bpa_attribute6, hr_api.g_varchar2) or
142 nvl(per_bpa_shd.g_old_rec.bpa_attribute7, hr_api.g_varchar2) <>
143 nvl(p_rec.bpa_attribute7, hr_api.g_varchar2) or
144 nvl(per_bpa_shd.g_old_rec.bpa_attribute8, hr_api.g_varchar2) <>
145 nvl(p_rec.bpa_attribute8, hr_api.g_varchar2) or
146 nvl(per_bpa_shd.g_old_rec.bpa_attribute9, hr_api.g_varchar2) <>
147 nvl(p_rec.bpa_attribute9, hr_api.g_varchar2) or
148 nvl(per_bpa_shd.g_old_rec.bpa_attribute10, hr_api.g_varchar2) <>
149 nvl(p_rec.bpa_attribute10, hr_api.g_varchar2) or
150 nvl(per_bpa_shd.g_old_rec.bpa_attribute11, hr_api.g_varchar2) <>
151 nvl(p_rec.bpa_attribute11, hr_api.g_varchar2) or
152 nvl(per_bpa_shd.g_old_rec.bpa_attribute12, hr_api.g_varchar2) <>
153 nvl(p_rec.bpa_attribute12, hr_api.g_varchar2) or
154 nvl(per_bpa_shd.g_old_rec.bpa_attribute13, hr_api.g_varchar2) <>
155 nvl(p_rec.bpa_attribute13, hr_api.g_varchar2) or
156 nvl(per_bpa_shd.g_old_rec.bpa_attribute14, hr_api.g_varchar2) <>
157 nvl(p_rec.bpa_attribute14, hr_api.g_varchar2) or
158 nvl(per_bpa_shd.g_old_rec.bpa_attribute15, hr_api.g_varchar2) <>
159 nvl(p_rec.bpa_attribute15, hr_api.g_varchar2) or
160 nvl(per_bpa_shd.g_old_rec.bpa_attribute16, hr_api.g_varchar2) <>
161 nvl(p_rec.bpa_attribute16, hr_api.g_varchar2) or
162 nvl(per_bpa_shd.g_old_rec.bpa_attribute17, hr_api.g_varchar2) <>
163 nvl(p_rec.bpa_attribute17, hr_api.g_varchar2) or
164 nvl(per_bpa_shd.g_old_rec.bpa_attribute18, hr_api.g_varchar2) <>
165 nvl(p_rec.bpa_attribute18, hr_api.g_varchar2) or
166 nvl(per_bpa_shd.g_old_rec.bpa_attribute19, hr_api.g_varchar2) <>
167 nvl(p_rec.bpa_attribute19, hr_api.g_varchar2) or
168 nvl(per_bpa_shd.g_old_rec.bpa_attribute20, hr_api.g_varchar2) <>
169 nvl(p_rec.bpa_attribute20, hr_api.g_varchar2) or
170 nvl(per_bpa_shd.g_old_rec.bpa_attribute21, hr_api.g_varchar2) <>
171 nvl(p_rec.bpa_attribute21, hr_api.g_varchar2) or
172 nvl(per_bpa_shd.g_old_rec.bpa_attribute22, hr_api.g_varchar2) <>
173 nvl(p_rec.bpa_attribute22, hr_api.g_varchar2) or
174 nvl(per_bpa_shd.g_old_rec.bpa_attribute23, hr_api.g_varchar2) <>
175 nvl(p_rec.bpa_attribute23, hr_api.g_varchar2) or
176 nvl(per_bpa_shd.g_old_rec.bpa_attribute24, hr_api.g_varchar2) <>
177 nvl(p_rec.bpa_attribute24, hr_api.g_varchar2) or
178 nvl(per_bpa_shd.g_old_rec.bpa_attribute25, hr_api.g_varchar2) <>
179 nvl(p_rec.bpa_attribute25, hr_api.g_varchar2) or
180 nvl(per_bpa_shd.g_old_rec.bpa_attribute26, hr_api.g_varchar2) <>
181 nvl(p_rec.bpa_attribute26, hr_api.g_varchar2) or
182 nvl(per_bpa_shd.g_old_rec.bpa_attribute27, hr_api.g_varchar2) <>
183 nvl(p_rec.bpa_attribute27, hr_api.g_varchar2) or
184 nvl(per_bpa_shd.g_old_rec.bpa_attribute28, hr_api.g_varchar2) <>
185 nvl(p_rec.bpa_attribute28, hr_api.g_varchar2) or
186 nvl(per_bpa_shd.g_old_rec.bpa_attribute29, hr_api.g_varchar2) <>
187 nvl(p_rec.bpa_attribute29, hr_api.g_varchar2) or
188 nvl(per_bpa_shd.g_old_rec.bpa_attribute30, hr_api.g_varchar2) <>
189 nvl(p_rec.bpa_attribute30, hr_api.g_varchar2) ))
190 or (p_rec.processed_assignment_id is null) then
191 --
192 -- Only execute the validation if absolutely necessary:
193 -- a) During update, the structure column value or any
194 -- of the attribute values have actually changed.
195 -- b) During insert.
196 --
197 hr_dflex_utility.ins_or_upd_descflex_attribs
198 (p_appl_short_name => 'PER'
199 ,p_descflex_name => 'PER_BF_PROCESSED_ASSIGNMENTS'
200 ,p_attribute_category => p_rec.bpa_attribute_category
201 ,p_attribute1_name => 'BPA_ATTRIBUTE1'
202 ,p_attribute1_value => p_rec.bpa_attribute1
203 ,p_attribute2_name => 'BPA_ATTRIBUTE2'
204 ,p_attribute2_value => p_rec.bpa_attribute2
205 ,p_attribute3_name => 'BPA_ATTRIBUTE3'
206 ,p_attribute3_value => p_rec.bpa_attribute3
207 ,p_attribute4_name => 'BPA_ATTRIBUTE4'
208 ,p_attribute4_value => p_rec.bpa_attribute4
209 ,p_attribute5_name => 'BPA_ATTRIBUTE5'
210 ,p_attribute5_value => p_rec.bpa_attribute5
211 ,p_attribute6_name => 'BPA_ATTRIBUTE6'
212 ,p_attribute6_value => p_rec.bpa_attribute6
213 ,p_attribute7_name => 'BPA_ATTRIBUTE7'
214 ,p_attribute7_value => p_rec.bpa_attribute7
215 ,p_attribute8_name => 'BPA_ATTRIBUTE8'
216 ,p_attribute8_value => p_rec.bpa_attribute8
217 ,p_attribute9_name => 'BPA_ATTRIBUTE9'
218 ,p_attribute9_value => p_rec.bpa_attribute9
219 ,p_attribute10_name => 'BPA_ATTRIBUTE10'
220 ,p_attribute10_value => p_rec.bpa_attribute10
221 ,p_attribute11_name => 'BPA_ATTRIBUTE11'
222 ,p_attribute11_value => p_rec.bpa_attribute11
223 ,p_attribute12_name => 'BPA_ATTRIBUTE12'
224 ,p_attribute12_value => p_rec.bpa_attribute12
225 ,p_attribute13_name => 'BPA_ATTRIBUTE13'
226 ,p_attribute13_value => p_rec.bpa_attribute13
227 ,p_attribute14_name => 'BPA_ATTRIBUTE14'
228 ,p_attribute14_value => p_rec.bpa_attribute14
229 ,p_attribute15_name => 'BPA_ATTRIBUTE15'
230 ,p_attribute15_value => p_rec.bpa_attribute15
231 ,p_attribute16_name => 'BPA_ATTRIBUTE16'
232 ,p_attribute16_value => p_rec.bpa_attribute16
233 ,p_attribute17_name => 'BPA_ATTRIBUTE17'
234 ,p_attribute17_value => p_rec.bpa_attribute17
235 ,p_attribute18_name => 'BPA_ATTRIBUTE18'
236 ,p_attribute18_value => p_rec.bpa_attribute18
237 ,p_attribute19_name => 'BPA_ATTRIBUTE19'
238 ,p_attribute19_value => p_rec.bpa_attribute19
239 ,p_attribute20_name => 'BPA_ATTRIBUTE20'
240 ,p_attribute20_value => p_rec.bpa_attribute20
241 ,p_attribute21_name => 'BPA_ATTRIBUTE21'
242 ,p_attribute21_value => p_rec.bpa_attribute21
243 ,p_attribute22_name => 'BPA_ATTRIBUTE22'
244 ,p_attribute22_value => p_rec.bpa_attribute22
245 ,p_attribute23_name => 'BPA_ATTRIBUTE23'
246 ,p_attribute23_value => p_rec.bpa_attribute23
247 ,p_attribute24_name => 'BPA_ATTRIBUTE24'
248 ,p_attribute24_value => p_rec.bpa_attribute24
249 ,p_attribute25_name => 'BPA_ATTRIBUTE25'
250 ,p_attribute25_value => p_rec.bpa_attribute25
251 ,p_attribute26_name => 'BPA_ATTRIBUTE26'
252 ,p_attribute26_value => p_rec.bpa_attribute26
253 ,p_attribute27_name => 'BPA_ATTRIBUTE27'
254 ,p_attribute27_value => p_rec.bpa_attribute27
255 ,p_attribute28_name => 'BPA_ATTRIBUTE28'
256 ,p_attribute28_value => p_rec.bpa_attribute28
257 ,p_attribute29_name => 'BPA_ATTRIBUTE29'
258 ,p_attribute29_value => p_rec.bpa_attribute29
259 ,p_attribute30_name => 'BPA_ATTRIBUTE30'
260 ,p_attribute30_value => p_rec.bpa_attribute30
261 );
262 end if;
263 --
264 hr_utility.set_location(' Leaving:'||l_proc,20);
265 end chk_df;
266 --
267 -- ----------------------------------------------------------------------------
268 -- |----------------------< check_non_updateable_args >-----------------------|
269 -- ----------------------------------------------------------------------------
270 -- {Start Of Comments}
271 --
272 -- Description:
273 -- This procedure is used to ensure that non updateable attributes have
274 -- not been updated. If an attribute has been updated an error is generated.
275 --
276 -- Pre Conditions:
280 -- In Arguments:
277 -- g_old_rec has been populated with details of the values currently in
278 -- the database.
279 --
281 -- p_rec has been populated with the updated values the user would like the
282 -- record set to.
283 --
284 -- Post Success:
285 -- Processing continues if all the non updateable attributes have not
286 -- changed.
287 --
288 -- Post Failure:
289 -- An application error is raised if any of the non updatable attributes
290 -- have been altered.
291 --
292 -- {End Of Comments}
293 -- ----------------------------------------------------------------------------
294 Procedure chk_non_updateable_args
295 (p_rec in per_bpa_shd.g_rec_type
296 ) IS
297 --
298 l_proc varchar2(72) := g_package || 'check_non_updateable_args';
299 l_error EXCEPTION;
300 l_argument varchar2(30);
301 --
302 Begin
303 hr_utility.set_location('Entering:'||l_proc,5);
304 --
305 -- Only proceed with the validation if a row exists for the current
306 -- record in the HR Schema.
307 --
308 IF NOT per_bpa_shd.api_updating
309 (p_processed_assignment_id => p_rec.processed_assignment_id
310 ,p_object_version_number => p_rec.object_version_number
311 ) THEN
312 hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
313 hr_utility.set_message_token('PROCEDURE ', l_proc);
314 hr_utility.set_message_token('STEP ', '5');
315 END IF;
316 --
317 hr_utility.set_location(l_proc,10);
318 --
319 IF nvl(p_rec.payroll_run_id, hr_api.g_number) <>
320 per_bpa_shd.g_old_rec.payroll_run_id then
321 l_argument:='payroll_run_id';
322 raise l_error;
323 END IF;
324 hr_utility.set_location(l_proc,20);
325 --
326 IF nvl(p_rec.assignment_id, hr_api.g_number) <>
327 per_bpa_shd.g_old_rec.assignment_id then
328 l_argument:='assigment_id';
329 raise l_error;
330 END IF;
331 hr_utility.set_location(l_proc,30);
332 --
333 --
334 EXCEPTION
335 WHEN l_error THEN
336 hr_api.argument_changed_error
337 (p_api_name => l_proc
338 ,p_argument => l_argument);
339 WHEN OTHERS THEN
340 RAISE;
341 hr_utility.set_location(' Leaving:'||l_proc,40);
342 End chk_non_updateable_args;
343 --
344 -- ----------------------------------------------------------------------------
345 -- |----------------------< chk_assignment_id >-------------------------------|
346 -- ----------------------------------------------------------------------------
347 -- {Start Of Comments}
348 --
349 -- Description:
350 -- Check to make sure the assignment exists and that it is valid on the
351 -- effective date.
352 --
353 -- Pre Conditions:
354 --
355 --
356 -- In Arguments:
357 -- p_assignment_id
358 -- p_effective_date
359 -- Post Success:
360 -- Processing continues.
361 --
362 -- Post Failure:
363 -- Processing is terminated and an application error is raised.
364 --
365 --
366 -- {End Of Comments}
367 -- ----------------------------------------------------------------------------
368 PROCEDURE chk_assignment_id
369 ( p_assignment_id IN NUMBER
370 , p_effective_date IN DATE
371 )
372 IS
373 --
374 CURSOR csr_get_asg_dates IS
375 SELECT effective_start_date, effective_end_date
376 FROM per_all_assignments_f
377 WHERE assignment_id = p_assignment_id
378 AND p_effective_date BETWEEN
379 effective_start_date and effective_end_date;
380 --
381 l_esd DATE;
382 l_eed DATE;
383 --
384 l_proc varchar2(72) := g_package||'chk_assignment_id';
385 BEGIN
386 hr_utility.set_location('Entering:'||l_proc, 5);
387 --
388 OPEN csr_get_asg_dates;
389 FETCH csr_get_asg_dates INTO l_esd, l_eed;
390 --
391 IF csr_get_asg_dates%NOTFOUND THEN
392 --
393 CLOSE csr_get_asg_dates ;
394 -- The assignment_id doesn't exist in the assignment table
395 -- for the specified time period, so error.
396 --
397 hr_utility.set_message(800,'HR_52934_NO_ASG_AVAIL');
398 hr_utility.raise_error;
399 --
400 END IF;
401 --
402 CLOSE csr_get_asg_dates ;
403 END chk_assignment_id;
404 -- ----------------------------------------------------------------------------
405 -- |----------------------< chk_payroll_run_id >------------------------------|
406 -- ----------------------------------------------------------------------------
407 -- {Start Of Comments}
408 --
409 -- Description:
410 -- Check to make sure the payroll run id exists.
411 --
412 -- Pre Conditions:
413 --
414 --
415 -- In Arguments:
416 -- p_payroll_run_id
417 -- Post Success:
418 -- Processing continues.
419 --
420 -- Post Failure:
421 -- Processing is terminated and an application error is raised.
422 --
423 --
424 -- {End Of Comments}
425 -- ----------------------------------------------------------------------------
426 PROCEDURE chk_payroll_run_id
427 ( p_payroll_run_id IN NUMBER
428 )
429 IS
430 --
431 CURSOR csr_get_run_dates IS
432 SELECT 1
433 FROM per_bf_payroll_runs
434 WHERE payroll_run_id = p_payroll_run_id;
435 --
436 l_temp VARCHAR2(1);
437 --
438 l_proc varchar2(72) := g_package||'chk_payroll_run_id';
439 BEGIN
440 hr_utility.set_location('Entering:'||l_proc, 5);
441 --
442 OPEN csr_get_run_dates;
443 FETCH csr_get_run_dates INTO l_temp;
444 --
445 IF csr_get_run_dates%NOTFOUND THEN
446 --
447 CLOSE csr_get_run_dates;
448 --
449 -- The payroll_run_id doesn't exist in the run table
450 -- so error
451 --
452 per_bpa_shd.constraint_error
453 (p_constraint_name => 'PER_BF_PROCESSED_ASSIGNS_FK1');
454 --
455 END IF;
456 CLOSE csr_get_run_dates;
457 --
458 --
459 END chk_payroll_run_id;
460 --
461 -- ----------------------------------------------------------------------------
462 -- |----------------------< chk_bg_are_same >---------------------------------|
463 -- ----------------------------------------------------------------------------
464 -- {Start Of Comments}
465 --
466 -- Description:
467 -- Check to make sure the business group of the assignment (assignment_id)
468 -- is the same as the business group of the payroll run (payroll run id).
469 --
470 -- Pre Conditions:
471 --
472 --
473 -- In Arguments:
474 -- p_payroll_run_id
475 -- p_assignment_id
476 -- p_effective_date
477 -- Post Success:
478 -- Processing continues.
479 --
480 -- Post Failure:
481 -- Processing is terminated and an application error is raised.
482 --
483 --
484 -- {End Of Comments}
485 -- ----------------------------------------------------------------------------
486 PROCEDURE chk_bg_are_same
487 ( p_payroll_run_id IN NUMBER
488 , p_assignment_id IN NUMBER
489 , p_effective_date IN DATE)
490 IS
491 --
492 CURSOR csr_get_payroll_run_bg IS
493 SELECT business_group_id
494 FROM per_bf_payroll_runs
495 WHERE payroll_run_id = p_payroll_run_id;
496 --
497 CURSOR csr_get_assignment_bg IS
498 SELECT business_group_id
499 FROM per_all_assignments_f
500 WHERE assignment_id = p_assignment_id
501 AND p_effective_date BETWEEN
502 effective_start_date AND effective_end_date;
503 --
504 l_asg_bg NUMBER;
505 l_run_bg NUMBER;
506 --
507 l_proc varchar2(72) := g_package||'chk_bg_are_same';
508 BEGIN
509 hr_utility.set_location('Entering:'||l_proc, 5);
510 --
511 OPEN csr_get_payroll_run_bg;
512 FETCH csr_get_payroll_run_bg INTO l_run_bg;
513 CLOSE csr_get_payroll_run_bg;
514 --
515 OPEN csr_get_assignment_bg;
516 FETCH csr_get_assignment_bg INTO l_asg_bg;
517 CLOSE csr_get_assignment_bg;
518 --
519 -- No need to check whether the id's are found as this will be revealed in
520 -- previous tests.
521 --
522 IF l_asg_bg <> l_run_bg THEN
523 --
524 -- The business groups of the assignment and payroll run differ, so error.
525 --
526 hr_utility.set_message(800,'HR_52936_DIFF_BGS');
527 hr_utility.raise_error;
528 --
529 END IF;
530 --
531 END chk_bg_are_same;
532 -- ----------------------------------------------------------------------------
533 -- -----------------------------< chk_child_rows >-----------------------------
534 -- ----------------------------------------------------------------------------
535 Procedure chk_child_rows
536 (p_processed_assignment_id in number
537 ) is
538 --
539 l_exists varchar2(1);
540 l_proc varchar2(72) := g_package || 'chk_child_rows';
541 --
542 -- Cursor to check if child rows exist in per_bf_balance_amounts
543 --
544 cursor csr_balance_amount is
545 select 'Y'
546 from per_bf_balance_amounts bba
547 where bba.processed_assignment_id = p_processed_assignment_id;
548 --
549 -- Cursor to check if child rows exist in per_bf_payment_details
550 --
551 cursor csr_payment_detail is
552 select 'Y'
553 from per_bf_payment_details bpd
554 where bpd.processed_assignment_id = p_processed_assignment_id;
555
556 --
557 BEGIN
558 hr_utility.set_location('Entering: '||l_proc, 10);
559 --
560 if p_processed_assignment_id is not null then
561 --
562 open csr_balance_amount;
563 fetch csr_balance_amount into l_exists;
564 if csr_balance_amount%FOUND then
565 --child row exists - raise error by calling constraint error
566 close csr_balance_amount;
567 per_bpa_shd.constraint_error('PER_BF_PROCESSED_ASSIGNS_BPAB');
568 end if;
569 close csr_balance_amount;
570 --
571 open csr_payment_detail;
572 fetch csr_payment_detail into l_exists;
573 if csr_payment_detail%FOUND then
574 --child row exists - raise error by calling constraint error
575 close csr_payment_detail;
576 per_bpa_shd.constraint_error('PER_BF_PROCESSED_ASSIGNS_BPAP');
577 end if;
578 close csr_payment_detail;
579 --
580 end if;
581 --
582 hr_utility.set_location('Leaving: '||l_proc,50);
583 --
584 END chk_child_rows;
585 --
586 -- ----------------------------------------------------------------------------
587 -- ----------------------------< chk_ids_unique >-----------------------------
588 -- ----------------------------------------------------------------------------
589 Procedure chk_ids_unique
590 (p_payroll_run_id in number,
591 p_assignment_id in number
592 ) is
593 --
594 l_exists varchar2(1);
595 l_proc varchar2(72) := g_package || 'chk_ids_unique';
596 --
597 -- Cursors to check PER_BF_PROCESSED_ASSIGNS_UK1
598 --
599 cursor csr_id_unique is
600 -- checks p_assignment_id and p_payroll_run_id are unique
601 select 'Y'
602 from per_bf_processed_assignments
603 where assignment_id = p_assignment_id
604 and payroll_run_id = p_payroll_run_id;
605 --
606 BEGIN
607 hr_utility.set_location('Entering: '||l_proc, 10);
608 --
609 hr_api.mandatory_arg_error(p_api_name => l_proc
610 ,p_argument => 'ASSIGNMENT_ID'
611 ,p_argument_value => p_assignment_id);
612 --
613 hr_api.mandatory_arg_error(p_api_name => l_proc
614 ,p_argument => 'PAYROLL_RUN_ID'
615 ,p_argument_value => p_payroll_run_id);
616 --
617 open csr_id_unique;
618 fetch csr_id_unique into l_exists;
619 if csr_id_unique%FOUND then
620 -- -ids are not unique - raise error by calling contraint error
621 close csr_id_unique;
622 per_bpa_shd.constraint_error('PER_BF_PROCESSED_ASSIGNS_UK1');
623 end if;
624 close csr_id_unique;
625 --
626 hr_utility.set_location(' Leaving: '||l_proc, 50);
627 --
628 end chk_ids_unique;
629 --
630 -- ----------------------------------------------------------------------------
631 -- |---------------------------< insert_validate >----------------------------|
632 -- ----------------------------------------------------------------------------
633 Procedure insert_validate
634 (p_effective_date in date
635 ,p_rec in per_bpa_shd.g_rec_type
636 ) is
637 --
638 l_proc varchar2(72) := g_package||'insert_validate';
639 --
640 Begin
641 hr_utility.set_location('Entering:'||l_proc, 5);
642 --
643 -- Call all supporting business operations
644 --
645 -- Note: The chk_payroll_run_id is before the set_security_group_id
646 -- to ensure that the payroll run exists.
647 --
648 chk_payroll_run_id
649 ( p_payroll_run_id => p_rec.payroll_run_id
650 );
651 -- Call parent set_security_group_id proc.
652 --
653 per_bpr_bus.set_security_group_id
654 (p_payroll_run_id => p_rec.payroll_run_id);
655 --
656 chk_assignment_id
657 ( p_assignment_id => p_rec.assignment_id
658 , p_effective_date => p_effective_date
659 );
660 --
661 chk_bg_are_same
662 ( p_payroll_run_id => p_rec.payroll_run_id
663 , p_assignment_id => p_rec.assignment_id
664 , p_effective_date => p_effective_date);
665 --
666 chk_ids_unique
667 ( p_payroll_run_id => p_rec.payroll_run_id
668 , p_assignment_id => p_rec.assignment_id);
669 --
670 -- Validate flexfields
671 -- ===================
672 chk_df(p_rec => p_rec);
673 --
674 hr_utility.set_location(' Leaving:'||l_proc, 10);
675 End insert_validate;
676 --
677 -- ----------------------------------------------------------------------------
678 -- |---------------------------< update_validate >----------------------------|
679 -- ----------------------------------------------------------------------------
680 Procedure update_validate
681 (p_effective_date in date
682 ,p_rec in per_bpa_shd.g_rec_type
683 ) is
684 --
685 l_proc varchar2(72) := g_package||'update_validate';
686 --
687 Begin
688 hr_utility.set_location('Entering:'||l_proc, 5);
689 --
690 -- Call parent set_security_group_id proc.
691 --
692 per_bpr_bus.set_security_group_id
693 (p_payroll_run_id => p_rec.payroll_run_id);
694 --
695 --
696 chk_non_updateable_args
697 ( p_rec => p_rec );
698 --
699 --
700 -- Validate flexfields
701 -- ===================
702 chk_df(p_rec => p_rec);
703 --
704 hr_utility.set_location(' Leaving:'||l_proc, 10);
705 End update_validate;
706 --
707 -- ----------------------------------------------------------------------------
708 -- |---------------------------< delete_validate >----------------------------|
709 -- ----------------------------------------------------------------------------
710 Procedure delete_validate
711 (p_rec in per_bpa_shd.g_rec_type
712 ) is
713 --
714 l_proc varchar2(72) := g_package||'delete_validate';
715 --
716 Begin
717 hr_utility.set_location('Entering:'||l_proc, 5);
718 --
719 -- Call all supporting business operations
720 --
721 chk_child_rows(p_processed_assignment_id => p_rec.processed_assignment_id);
722 --
723 hr_utility.set_location(' Leaving:'||l_proc, 10);
724 End delete_validate;
725 --
726 end per_bpa_bus;