DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_ISB_BUS

Source


1 Package Body pay_isb_bus as
2 /* $Header: pyisbrhi.pkb 115.3 2002/12/16 17:48:15 dsaxby ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_isb_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_social_benefit_id           number         default null;
15 --
16 -- ----------------------------------------------------------------------------
17 -- |---------------------------< chk_absence_date >---------------------------|
18 -- ----------------------------------------------------------------------------
19 procedure chk_absence_date( p_assignment_id         number,
20                             p_absence_start_date    date,
21                             p_absence_end_date      date) is
22     cursor c_absence_dates is
23         select  social_benefit_id
24         from    pay_ie_social_benefits_f isb
25         where   isb.assignment_id = p_assignment_id
26         and     (p_absence_start_date
27                 between isb.absence_start_date and isb.absence_end_date
28                 or  p_absence_end_date
29                 between isb.absence_start_date and isb.absence_end_date);
30     l_social_benefit_id     integer;
31 begin
32     open c_absence_dates;
33     fetch c_absence_dates into l_social_benefit_id;
34     if  c_absence_dates%found then
35         close c_absence_dates;
36         fnd_message.set_name('PAY','HR_IE_ABSENCE_EXISTS');
37         fnd_message.raise_error;
38     end if;
39     if  c_absence_dates%isopen then
40         close c_absence_dates;
41     end if;
42 exception
43     when others then
44         raise;
45 end chk_absence_date;
46 --
47 -- ----------------------------------------------------------------------------
48 -- |------------------------< chk_calculation_option >------------------------|
49 -- ----------------------------------------------------------------------------
50 procedure chk_calculation_option(p_calculation_option   in  pay_ie_social_benefits_f.calculation_option%type) is
51     cursor c_calculation_option is
52         select 1
53         from hr_lookups
54         where lookup_type = 'IE_CALC_OPTION'
55         and lookup_code = p_calculation_option
56         and enabled_flag = 'Y';
57     l_calculation_option_count  number;
58 begin
59     open c_calculation_option;
60     fetch c_calculation_option into l_calculation_option_count;
61     if  nvl(l_calculation_option_count,0) = 0 then
62         close c_calculation_option;
63         fnd_message.set_name('PAY','HR_IE_NO_VALID_CALC_OPTION');
64         fnd_message.raise_error;
65     end if;
66     if c_calculation_option%isopen then
67         close c_calculation_option;
68     end if;
69 exception
70     when others then
71         raise;
72 end chk_calculation_option;
73 --
74 -- ----------------------------------------------------------------------------
75 -- |---------------------------< chk_benefit_type >---------------------------|
76 -- ----------------------------------------------------------------------------
77 procedure chk_benefit_type(p_benefit_type   in  pay_ie_social_benefits_f.benefit_type%type) is
78     cursor c_benefit_type is
79         select  1
80         from    hr_lookups
81         where   lookup_type = 'IE_BENEFIT_TYPE'
82         and     lookup_code = p_benefit_type
83         and     enabled_flag = 'Y';
84     l_benefit_type_count    number;
85 begin
86         open    c_benefit_type;
87         fetch   c_benefit_type  into    l_benefit_type_count;
88         if p_benefit_type is not null then
89             if  nvl(l_benefit_type_count,0) = 0 then
90                 close   c_benefit_type;
91                 fnd_message.set_name('PAY','HR_IE_NO_VALID_BENEFIT_TYPE');
92                 fnd_message.raise_error;
93             end if;
94         end if;
95         if  c_benefit_type%isopen then
96             close   c_benefit_type;
97         end if;
98 exception
99     when others then
100         raise;
101 end chk_benefit_type;
102 --
103 -- ----------------------------------------------------------------------------
104 -- |---------------------------< chk_incident_id >---------------------------|
105 -- ----------------------------------------------------------------------------
106 procedure chk_incident_id(  p_incident_id   in  per_work_incidents.incident_id%type) is
107     cursor c_incident_id is
108         select  incident_id
109         from    per_work_incidents
110         where   incident_id = p_incident_id;
111     l_incident_id       integer;
112 begin
113     open    c_incident_id;
114     fetch   c_incident_id into  l_incident_id;
115     if p_incident_id is not null then
116         if  c_incident_id%notfound then
117             close c_incident_id;
118             fnd_message.set_name('PAY','HR_IE_NO_VALID_INCIDENT_ID');
119             fnd_message.raise_error;
120         end if;
121     end if;
122     if  c_incident_id%isopen then
123         close   c_incident_id;
124     end if;
125 exception
126     when others then
127         raise;
128 end chk_incident_id;
129 --
130 --  ---------------------------------------------------------------------------
131 --  |--------------------------< chk_paye_details >---------------------------|
132 --  ---------------------------------------------------------------------------
133 procedure chk_paye_details( p_effective_date    in  date,
134                             p_rec               in  pay_isb_shd.g_rec_type) is
135       cursor    c_paye_details is
136         select  paye_details_id
137         from    pay_ie_paye_details_f ipd
138         where   ipd.assignment_id = p_rec.assignment_id
139         and     (ipd.tax_basis = 'IE_CUMULATIVE'
140                 or ipd.tax_basis = 'IE_WEEK1_MONTH1')
141         and     p_effective_date between effective_start_date and effective_end_date;
142       l_paye_details    integer;
143 begin
144       open  c_paye_details;
145       fetch c_paye_details into l_paye_details;
146       if c_paye_details%notfound then
147         close c_paye_details;
148         fnd_message.set_name('PAY','HR_IE_PAYE_DETAILS_NULL');
149         fnd_message.raise_error;
150       end if;
151       if c_paye_details%isopen then
152         close c_paye_details;
153       end if;
154       --
155 exception
156     when others then
157         raise;
158 end chk_paye_details;
159 --
160 --  ---------------------------------------------------------------------------
161 --  |---------------------< chk_valid_absence_dates >-------------------------|
162 --  ---------------------------------------------------------------------------
163 procedure chk_valid_absence_dates(  p_absence_start_date    date,
164                                     p_absence_end_date      date) is
165 begin
166     if p_absence_start_date > nvl(p_absence_end_date, p_absence_start_date+1) then
167         fnd_message.set_name('PAY','HR_IE_START_END_DATES');
168         fnd_message.set_token('START',TO_CHAR(p_absence_start_date),TRUE);
169         fnd_message.set_token('END',TO_CHAR(p_absence_end_date),TRUE);
170         fnd_message.raise_error;
171     END IF;
172 end chk_valid_absence_dates;
173 --
174 -- ----------------------------------------------------------------------------
175 -- |---------------------< chk_calc_option_required >------------------------|
176 -- ----------------------------------------------------------------------------
177 procedure chk_calc_option_required(p_rec    in  pay_isb_shd.g_rec_type) is
178 begin
179     if  nvl(p_rec.benefit_amount,0) > 0 and p_rec.calculation_option is null then
180         fnd_message.set_name('PAY','HR_IE_CALC_OPTION_REQUIRED');
181         fnd_message.raise_error;
182     end if;
183 end chk_calc_option_required;
184 --
185 -- ----------------------------------------------------------------------------
186 -- |---------------------< chk_benefit_type_required >------------------------|
187 -- ----------------------------------------------------------------------------
188 procedure chk_benefit_type_required(p_rec   in  pay_isb_shd.g_rec_type) is
189 begin
190     if  nvl(p_rec.benefit_amount,0) > 0
191         and (p_rec.calculation_option = 'IE_OPTION1'  or
192              p_rec.calculation_option = 'IE_OPTION2'  or
193              p_rec.calculation_option = 'IE_OPTION3'  or
194              p_rec.calculation_option = 'IE_OPTION4')
195         and p_rec.benefit_type is null then
196         fnd_message.set_name('PAY','HR_IE_BENEFIT_TYPE_REQUIRED');
197         fnd_message.raise_error;
198     end if;
199 end;
200 --
201 -- ----------------------------------------------------------------------------
202 -- |----------------------< get_payroll_period_type >-------------------------|
203 -- ----------------------------------------------------------------------------
204 --
205 function get_payroll_period_type(p_assignment_id    pay_ie_social_benefits_f.assignment_id%type)
206 return varchar2 is
207     cursor c_payroll_period_type is
208         select  pay.period_type period_type
209         from    per_all_assignments_f asg,
210                 pay_all_payrolls_f pay
211         where   asg.payroll_id = pay.payroll_id
212         and     asg.assignment_id = p_assignment_id;
213         l_period_type            pay_all_payrolls.period_type%type;
214 begin
215         open c_payroll_period_type;
216         fetch c_payroll_period_type into l_period_type;
217         close c_payroll_period_type;
218         --
219         return l_period_type;
220 exception
221     when others then
222         raise;
223 end get_payroll_period_type;
224 --
225 --  ---------------------------------------------------------------------------
226 --  |----------------------< set_security_group_id >--------------------------|
227 --  ---------------------------------------------------------------------------
228 --
229 Procedure set_security_group_id
230   (p_social_benefit_id                    in number
231   ) is
232   --
233   -- Declare cursor
234   --
235   cursor csr_sec_grp is
236     select pbg.security_group_id
237       from per_business_groups pbg
238          , pay_ie_social_benefits_f isb
239          , per_all_assignments_f paf
240      where isb.social_benefit_id = p_social_benefit_id
241        and pbg.business_group_id = paf.business_group_id
242        and isb.assignment_id = paf.assignment_id;
243   --
244   -- Declare local variables
245   --
246   l_security_group_id number;
247   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
248   --
249 begin
250   --
251   hr_utility.set_location('Entering:'|| l_proc, 10);
252   --
253   -- Ensure that all the mandatory parameter are not null
254   --
255   hr_api.mandatory_arg_error
256     (p_api_name           => l_proc
257     ,p_argument           => 'social_benefit_id'
258     ,p_argument_value     => p_social_benefit_id
259     );
260   --
261   open csr_sec_grp;
262   fetch csr_sec_grp into l_security_group_id;
263   --
264   if csr_sec_grp%notfound then
265      --
266      close csr_sec_grp;
267      --
268      -- The primary key is invalid therefore we must error
269      --
270      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
271      fnd_message.raise_error;
272      --
273   end if;
274   close csr_sec_grp;
275   --
276   -- Set the security_group_id in CLIENT_INFO
277   --
278   hr_api.set_security_group_id
279     (p_security_group_id => l_security_group_id
280     );
281   --
282   hr_utility.set_location(' Leaving:'|| l_proc, 20);
283   --
284 end set_security_group_id;
285 --
286 --  ---------------------------------------------------------------------------
287 --  |---------------------< return_legislation_code >-------------------------|
288 --  ---------------------------------------------------------------------------
289 --
290 Function return_legislation_code
291   (p_social_benefit_id                    in     number
292   )
293   Return Varchar2 Is
294   --
295   -- Declare cursor
296   --
297   cursor csr_leg_code is
298     select pbg.legislation_code
299       from per_business_groups     pbg
300          , pay_ie_social_benefits_f isb
301          , per_all_assignments_f paf
302      where isb.social_benefit_id = p_social_benefit_id
303        and pbg.business_group_id = paf.business_group_id
304        and paf.assignment_id = isb.assignment_id;
305   --
306   -- Declare local variables
307   --
308   l_legislation_code  varchar2(150);
309   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
310   --
311 Begin
312   --
313   hr_utility.set_location('Entering:'|| l_proc, 10);
314   --
315   -- Ensure that all the mandatory parameter are not null
316   --
317   hr_api.mandatory_arg_error
318     (p_api_name           => l_proc
319     ,p_argument           => 'social_benefit_id'
320     ,p_argument_value     => p_social_benefit_id
321     );
322   --
323   if ( nvl(pay_isb_bus.g_social_benefit_id, hr_api.g_number)
324        = p_social_benefit_id) then
325     --
326     -- The legislation code has already been found with a previous
327     -- call to this function. Just return the value in the global
328     -- variable.
329     --
330     l_legislation_code := pay_isb_bus.g_legislation_code;
331     hr_utility.set_location(l_proc, 20);
332   else
333     --
334     -- The ID is different to the last call to this function
335     -- or this is the first call to this function.
336     --
337     open csr_leg_code;
338     fetch csr_leg_code into l_legislation_code;
339     --
340     if csr_leg_code%notfound then
341       --
342       -- The primary key is invalid therefore we must error
343       --
344       close csr_leg_code;
345       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
346       fnd_message.raise_error;
347     end if;
348     hr_utility.set_location(l_proc,30);
349     --
350     -- Set the global variables so the values are
351     -- available for the next call to this function.
352     --
353     close csr_leg_code;
354     pay_isb_bus.g_social_benefit_id           := p_social_benefit_id;
355     pay_isb_bus.g_legislation_code  := l_legislation_code;
356   end if;
357   hr_utility.set_location(' Leaving:'|| l_proc, 40);
358   return l_legislation_code;
359 end return_legislation_code;
360 --
361 -- ----------------------------------------------------------------------------
362 -- |-----------------------< chk_non_updateable_args >------------------------|
363 -- ----------------------------------------------------------------------------
364 -- {Start Of Comments}
365 --
366 -- Description:
367 --   This procedure is used to ensure that non updateable attributes have
368 --   not been updated. If an attribute has been updated an error is generated.
369 --
370 -- Pre Conditions:
371 --   g_old_rec has been populated with details of the values currently in
372 --   the database.
373 --
374 -- In Arguments:
375 --   p_rec has been populated with the updated values the user would like the
376 --   record set to.
377 --
378 -- Post Success:
382 -- Post Failure:
379 --   Processing continues if all the non updateable attributes have not
380 --   changed.
381 --
383 --   An application error is raised if any of the non updatable attributes
384 --   have been altered.
385 --
386 -- {End Of Comments}
387 -- ----------------------------------------------------------------------------
388 Procedure chk_non_updateable_args
389   (p_effective_date  in date
390   ,p_rec             in pay_isb_shd.g_rec_type
391   ) IS
392 --
393   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
394   l_error    EXCEPTION;
395   l_argument varchar2(30);
396 --
397 Begin
398   --
399   -- Only proceed with the validation if a row exists for the current
400   -- record in the HR Schema.
401   --
402   IF NOT pay_isb_shd.api_updating
403       (p_social_benefit_id                => p_rec.social_benefit_id
404       ,p_effective_date                   => p_effective_date
405       ,p_object_version_number            => p_rec.object_version_number
406       ) THEN
407      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
408      fnd_message.set_token('PROCEDURE ', l_proc);
409      fnd_message.set_token('STEP ', '5');
410      fnd_message.raise_error;
411   END IF;
412   --
413   -- EDIT_HERE: Add checks to ensure non-updateable args have
414   --            not been updated.
415   --
416   EXCEPTION
417     WHEN l_error THEN
418        hr_api.argument_changed_error
419          (p_api_name => l_proc
420          ,p_argument => l_argument);
421     WHEN OTHERS THEN
422        RAISE;
423 End chk_non_updateable_args;
424 --
425 -- ----------------------------------------------------------------------------
426 -- |--------------------------< dt_update_validate >--------------------------|
427 -- ----------------------------------------------------------------------------
428 -- {Start Of Comments}
429 --
430 -- Description:
431 --   This procedure is used for referential integrity of datetracked
432 --   parent entities when a datetrack update operation is taking place
433 --   and where there is no cascading of update defined for this entity.
434 --
435 -- Prerequisites:
436 --   This procedure is called from the update_validate.
437 --
438 -- In Parameters:
439 --
440 -- Post Success:
441 --   Processing continues.
442 --
443 -- Post Failure:
444 --
445 -- Developer Implementation Notes:
446 --   This procedure should not need maintenance unless the HR Schema model
447 --   changes.
448 --
449 -- Access Status:
450 --   Internal Row Handler Use Only.
451 --
452 -- {End Of Comments}
453 -- ----------------------------------------------------------------------------
454 Procedure dt_update_validate
455   (p_assignment_id                 in number default hr_api.g_number
456   ,p_datetrack_mode                in varchar2
457   ,p_validation_start_date         in date
458   ,p_validation_end_date           in date
459   ) Is
460 --
461   l_proc  varchar2(72) := g_package||'dt_update_validate';
462   l_integrity_error Exception;
463   l_table_name      all_tables.table_name%TYPE;
464 --
465 Begin
466   --
467   -- Ensure that the p_datetrack_mode argument is not null
468   --
469   hr_api.mandatory_arg_error
470     (p_api_name       => l_proc
471     ,p_argument       => 'datetrack_mode'
472     ,p_argument_value => p_datetrack_mode
473     );
474   --
475   -- Mode will be valid, as this is checked at the start of the upd.
476   --
477   -- Ensure the arguments are not null
478   --
479   hr_api.mandatory_arg_error
480     (p_api_name       => l_proc
481     ,p_argument       => 'validation_start_date'
482     ,p_argument_value => p_validation_start_date
483     );
484   --
485   hr_api.mandatory_arg_error
486     (p_api_name       => l_proc
487     ,p_argument       => 'validation_end_date'
488     ,p_argument_value => p_validation_end_date
489     );
490   --
491   If ((nvl(p_assignment_id, hr_api.g_number) <> hr_api.g_number) and
492       NOT (dt_api.check_min_max_dates
493             (p_base_table_name => 'per_all_assignments_f'
494             ,p_base_key_column => 'ASSIGNMENT_ID'
495             ,p_base_key_value  => p_assignment_id
496             ,p_from_date       => p_validation_start_date
497             ,p_to_date         => p_validation_end_date))) Then
498      l_table_name := 'all assignments';
499      raise l_integrity_error;
500   End If;
501   --
502 Exception
503   When l_integrity_error Then
504     --
505     -- A referential integrity check was violated therefore
506     -- we must error
507     --
508     fnd_message.set_name('PAY', 'HR_7216_DT_UPD_INTEGRITY_ERR');
509     fnd_message.set_token('TABLE_NAME', l_table_name);
510     fnd_message.raise_error;
511   When Others Then
512     --
513     -- An unhandled or unexpected error has occurred which
514     -- we must report
515     --
516     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
517     fnd_message.set_token('PROCEDURE', l_proc);
518     fnd_message.set_token('STEP','15');
519     fnd_message.raise_error;
520 End dt_update_validate;
521 --
525 -- {Start Of Comments}
522 -- ----------------------------------------------------------------------------
523 -- |--------------------------< dt_delete_validate >--------------------------|
524 -- ----------------------------------------------------------------------------
526 --
527 -- Description:
528 --   This procedure is used for referential integrity of datetracked
529 --   child entities when either a datetrack DELETE or ZAP is in operation
530 --   and where there is no cascading of delete defined for this entity.
531 --   For the datetrack mode of DELETE or ZAP we must ensure that no
532 --   datetracked child rows exist between the validation start and end
533 --   dates.
534 --
535 -- Prerequisites:
536 --   This procedure is called from the delete_validate.
537 --
538 -- In Parameters:
539 --
540 -- Post Success:
541 --   Processing continues.
542 --
543 -- Post Failure:
544 --   If a row exists by determining the returning Boolean value from the
545 --   generic dt_api.rows_exist function then we must supply an error via
546 --   the use of the local exception handler l_rows_exist.
547 --
548 -- Developer Implementation Notes:
549 --   This procedure should not need maintenance unless the HR Schema model
550 --   changes.
551 --
552 -- Access Status:
553 --   Internal Row Handler Use Only.
554 --
555 -- {End Of Comments}
556 -- ----------------------------------------------------------------------------
557 Procedure dt_delete_validate
558   (p_social_benefit_id                in number
559   ,p_datetrack_mode                   in varchar2
560   ,p_validation_start_date            in date
561   ,p_validation_end_date              in date
562   ) Is
563 --
564   l_proc        varchar2(72)    := g_package||'dt_delete_validate';
565   l_rows_exist  Exception;
566   l_table_name  all_tables.table_name%TYPE;
567 --
568 Begin
569   --
570   -- Ensure that the p_datetrack_mode argument is not null
571   --
572   hr_api.mandatory_arg_error
573     (p_api_name       => l_proc
574     ,p_argument       => 'datetrack_mode'
575     ,p_argument_value => p_datetrack_mode
576     );
577   --
578   -- Only perform the validation if the datetrack mode is either
579   -- DELETE or ZAP
580   --
581   If (p_datetrack_mode = hr_api.g_delete or
582       p_datetrack_mode = hr_api.g_zap) then
583     --
584     --
585     -- Ensure the arguments are not null
586     --
587     hr_api.mandatory_arg_error
588       (p_api_name       => l_proc
589       ,p_argument       => 'validation_start_date'
590       ,p_argument_value => p_validation_start_date
591       );
592     --
593     hr_api.mandatory_arg_error
594       (p_api_name       => l_proc
595       ,p_argument       => 'validation_end_date'
596       ,p_argument_value => p_validation_end_date
597       );
598     --
599     hr_api.mandatory_arg_error
600       (p_api_name       => l_proc
601       ,p_argument       => 'social_benefit_id'
602       ,p_argument_value => p_social_benefit_id
603       );
604     --
605   --
606     --
607   End If;
608   --
609 Exception
610   When l_rows_exist Then
611     --
612     -- A referential integrity check was violated therefore
613     -- we must error
614     --
615     fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
616     fnd_message.set_token('TABLE_NAME', l_table_name);
617     fnd_message.raise_error;
618   When Others Then
619     --
620     -- An unhandled or unexpected error has occurred which
621     -- we must report
622     --
623     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
624     fnd_message.set_token('PROCEDURE', l_proc);
625     fnd_message.set_token('STEP','15');
626     fnd_message.raise_error;
627   --
628 End dt_delete_validate;
629 --
630 -- ----------------------------------------------------------------------------
631 -- |---------------------------< insert_validate >----------------------------|
632 -- ----------------------------------------------------------------------------
633 Procedure insert_validate
634   (p_rec                   in pay_isb_shd.g_rec_type
635   ,p_effective_date        in date
636   ,p_datetrack_mode        in varchar2
637   ,p_validation_start_date in date
638   ,p_validation_end_date   in date
639   ) is
640 --
641   l_proc        varchar2(72) := g_package||'insert_validate';
642 --
643 Begin
644   hr_utility.set_location('Entering:'||l_proc, 5);
645   --Check the Absence Start Date is earlier than Abasence End Date
646   chk_valid_absence_dates(  p_absence_start_date    =>p_rec.absence_start_date,
647                             p_absence_end_date      =>p_rec.absence_end_date);
648 
649   --Check whether if these absence dates already exists in the database
650   --for this social_benefit_id
651   chk_absence_date( p_assignment_id         =>  p_rec.assignment_id,
652                     p_absence_start_date    =>  p_rec.absence_start_date,
653                     p_absence_end_date      =>  p_rec.absence_end_date);
654   --The Calculation Option is requred if benefit amount is positive
655   chk_calc_option_required(p_rec    =>  p_rec);
656   --The Benefit type is required when benefit amount is positive
660   chk_calculation_option(p_calculation_option   =>  p_rec.calculation_option);
657   --and calculation option is in (Option 2/Option 3/Option 4)
658   chk_benefit_type_required(p_rec   =>  p_rec);
659   --Check for valid Calculation Option
661   --
662   --Check for valid Benefit Type
663   chk_benefit_type(p_benefit_type   =>  p_rec.benefit_type);
664   --
665   --Check for valid Incident Type for the person selected
666   chk_incident_id(  p_incident_id   =>  p_rec.incident_id);
667   --
668   chk_paye_details( p_effective_date    =>  p_effective_date,
669                     p_rec               =>  p_rec);
670   --
671   hr_utility.set_location(' Leaving:'||l_proc, 10);
672 End insert_validate;
673 --
674 -- ----------------------------------------------------------------------------
675 -- |---------------------------< update_validate >----------------------------|
676 -- ----------------------------------------------------------------------------
677 Procedure update_validate
678   (p_rec                     in pay_isb_shd.g_rec_type
679   ,p_effective_date          in date
680   ,p_datetrack_mode          in varchar2
681   ,p_validation_start_date   in date
682   ,p_validation_end_date     in date
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   --Check the Absence Start Date is earlier than Abasence End Date
691     chk_valid_absence_dates(p_absence_start_date    =>p_rec.absence_start_date,
692                             p_absence_end_date      =>p_rec.absence_end_date);
693   --
694   --Check whether if these absence dates already exists in the database
695   --for this social_benefit_id
696     chk_absence_date(   p_assignment_id         =>  p_rec.assignment_id,
697                         p_absence_start_date    =>  p_rec.absence_start_date,
698                         p_absence_end_date      =>  p_rec.absence_end_date);
699   --The Calculation Option is requred if benefit amount is positive
700     chk_calc_option_required(p_rec  =>  p_rec);
701   --The Benefit type is required when benefit amount is positive
702   --and calculation option is in (Option 2/Option 3/Option 4)
703     chk_benefit_type_required(p_rec =>  p_rec);
704   --Check for valid Calculation Option
705     chk_calculation_option(p_calculation_option =>  p_rec.calculation_option);
706   --Check for valid Benefit Type
707     chk_benefit_type(p_benefit_type     =>  p_rec.benefit_type);
708   --
709   --Check for valid Incident Type for the person selected
710     chk_incident_id(    p_incident_id   =>  p_rec.incident_id);
711   --Check for paye details existance for option2/3/4
712     chk_paye_details(   p_effective_date    =>  p_effective_date,
713                         p_rec               =>  p_rec);
714   -- Call the datetrack update integrity operation
715   --
716   dt_update_validate
717     (p_assignment_id                  => p_rec.assignment_id
718     ,p_datetrack_mode                 => p_datetrack_mode
719     ,p_validation_start_date          => p_validation_start_date
720     ,p_validation_end_date            => p_validation_end_date
721     );
722   --
723   chk_non_updateable_args
724     (p_effective_date  => p_effective_date
725     ,p_rec             => p_rec
726     );
727   --
728   --
729   hr_utility.set_location(' Leaving:'||l_proc, 10);
730 End update_validate;
731 --
732 -- ----------------------------------------------------------------------------
733 -- |---------------------------< delete_validate >----------------------------|
734 -- ----------------------------------------------------------------------------
735 Procedure delete_validate
736   (p_rec                    in pay_isb_shd.g_rec_type
737   ,p_effective_date         in date
738   ,p_datetrack_mode         in varchar2
739   ,p_validation_start_date  in date
740   ,p_validation_end_date    in date
741   ) is
742 --
743   l_proc        varchar2(72) := g_package||'delete_validate';
744 --
745 Begin
746   hr_utility.set_location('Entering:'||l_proc, 5);
747   --
748   -- Call all supporting business operations
749   --
750   dt_delete_validate
751     (p_datetrack_mode                   => p_datetrack_mode
752     ,p_validation_start_date            => p_validation_start_date
753     ,p_validation_end_date              => p_validation_end_date
754     ,p_social_benefit_id                => p_rec.social_benefit_id
755     );
756   --
757   hr_utility.set_location(' Leaving:'||l_proc, 10);
758 End delete_validate;
759 --
760 end pay_isb_bus;