DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PRTT_CLM_GD_R_SVC_TYP_API

Source


1 Package Body ben_PRTT_CLM_GD_R_SVC_TYP_api as
2 /* $Header: bepcgapi.pkb 115.4 2002/12/16 11:57:55 vsethi ship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  ben_PRTT_CLM_GD_R_SVC_TYP_api.';
7 
8 -- ----------------------------------------------------------------------------
9 -- |------------------------< check_remb_rqst_ctfn_rqs >----------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 
13 
14 Procedure check_remb_rqst_ctfn_rqs(
15     p_prtt_reimbmt_rqst_id in number    default null
16     ,p_pl_gd_or_svc_id      in number    default null
17     ,p_effective_date       in date
18     ,p_ctfn_rqd_flag        out nocopy varchar2 ) is
19 
20 l_proc varchar2(72) := g_package||'check_remb_rqst_ctfn_rqs';
21 
22 cursor c_pct_gdsvc is
23   select 'x' from
24   ben_pl_gd_r_svc_ctfn_f
25   where pl_gd_or_svc_id = p_pl_gd_or_svc_id
26     and p_effective_date  between
27         effective_start_date and
28         effective_end_date ;
29 
30 cursor c_pct_remb is
31   select 'x' from
32   ben_pl_gd_r_svc_ctfn_f pct,
33   ben_prtt_clm_gd_or_svc_typ pcg
34   where pcg.prtt_reimbmt_rqst_id = p_prtt_reimbmt_rqst_id
35     and pct.pl_gd_or_svc_id      = pcg.pl_gd_or_svc_id
36     and p_effective_date  between
37         pct.effective_start_date and
38         pct.effective_end_date ;
39 
40 l_dummy_var varchar2(1) ;
41 
42 begin
43 hr_utility.set_location('Entering:'|| l_proc, 10);
44 p_ctfn_rqd_flag := 'N' ;
45 if  p_prtt_reimbmt_rqst_id is not null then
46     open  c_pct_remb ;
47     fetch c_pct_remb into l_dummy_var ;
48     if  c_pct_remb%found then
49         p_ctfn_rqd_flag := 'Y' ;
50     end if ;
51     close c_pct_remb ;
52 else
53   open  c_pct_gdsvc ;
54     fetch c_pct_gdsvc into l_dummy_var ;
55     if  c_pct_gdsvc%found then
56         p_ctfn_rqd_flag := 'Y' ;
57     end if ;
58     close c_pct_gdsvc ;
59 
60 end if;
61 
62 hr_utility.set_location('Result:'||  p_ctfn_rqd_flag, 15);
63 hr_utility.set_location('Exiting:'|| l_proc, 10);
64 end check_remb_rqst_ctfn_rqs ;
65 
66 
67 -- ----------------------------------------------------------------------------
68 -- |------------------------< check_remb_rqst_ctfn_prvdd >----------------------|
69 -- ----------------------------------------------------------------------------
70 Procedure check_remb_rqst_ctfn_prvdd(
71     p_prtt_reimbmt_rqst_id         in number    default null
72      ,p_prtt_clm_gd_or_svc_typ_id   in number    default null
73      ,p_effective_date              in date
74      ,p_ctfn_pending_flag           out nocopy varchar2 ) is
75 
76 l_proc varchar2(72) := g_package||'check_remb_rqst_ctfn_prvdd';
77 
78 cursor c_pqc_gdsvc is
79   select 'x' from
80   ben_prtt_rmt_rqst_ctfn_prvdd_f
81   where prtt_clm_gd_or_svc_typ_id  = p_prtt_clm_gd_or_svc_typ_id
82     and reimbmt_ctfn_recd_dt is null
83     and p_effective_date  between
84         effective_start_date and
85         effective_end_date ;
86 
87 cursor c_pqc_prc  is
88   select 'x' from
89   ben_prtt_rmt_rqst_ctfn_prvdd_f pqc,
90   ben_prtt_clm_gd_or_svc_typ pcg
91   where pcg.prtt_reimbmt_rqst_id = p_prtt_reimbmt_rqst_id
92     and pqc.prtt_clm_gd_or_svc_typ_id  = pcg.prtt_clm_gd_or_svc_typ_id
93     and pqc.reimbmt_ctfn_recd_dt is null
94     and p_effective_date  between
95         pqc.effective_start_date and
96         pqc.effective_end_date ;
97 
98 l_dummy_var varchar2(1) ;
99 
100 begin
101 hr_utility.set_location('Entering:'|| l_proc, 10);
102 p_ctfn_pending_flag := 'N' ;
103 if  p_prtt_reimbmt_rqst_id is not null then
104     open  c_pqc_prc ;
105     fetch c_pqc_prc into l_dummy_var ;
106     if  c_pqc_prc%found then
107         p_ctfn_pending_flag := 'Y' ;
108     end if ;
109     close c_pqc_prc ;
110 else
111   open  c_pqc_gdsvc ;
112     fetch c_pqc_gdsvc into l_dummy_var ;
113     if  c_pqc_gdsvc%found then
114         p_ctfn_pending_flag := 'Y' ;
115     end if ;
116     close c_pqc_gdsvc ;
117 
118 end if;
119 
120 hr_utility.set_location('Result:'||  p_ctfn_pending_flag , 15);
121 hr_utility.set_location('Exiting:'|| l_proc, 10);
122 end check_remb_rqst_ctfn_prvdd ;
123 
124 
125 -- ----------------------------------------------------------------------------
126 -- |------------------------< write_remb_rqst_ctfn >----------------------|
127 -- ----------------------------------------------------------------------------
128 procedure write_remb_rqst_ctfn (
129            p_prtt_clm_gd_or_svc_typ_id    in number
130           ,p_pl_gd_r_svc_ctfn_id          in number
131           ,p_reimbmt_ctfn_rqd_flag        in varchar2
132           ,p_reimbmt_ctfn_typ_cd          in varchar2
133           ,p_prtt_enrt_actn_id            in Number default null
134           ,p_business_group_id            in number
135           ,p_ctfn_rqd_when_rl             in number
136           ,p_prtt_reimbmt_rqst_id         in number
137           ,p_effective_date               in Date  ) is
138 
139 
140    l_proc varchar2(72) := g_package||'write_remb_rqst_ctfn';
141    l_write_ctfn     boolean := TRUE;
142    l_outputs        ff_exec.outputs_t;
143    l_dummy_var      varchar2(1) ;
144    ---Cursor for formula
145   cursor c_asg is
146   select prc.pl_id,asg.assignment_id
147   from  ben_prtt_reimbmt_rqst_f prc ,
148         per_all_assignments_f  asg
149   where prc.prtt_reimbmt_rqst_id = p_prtt_reimbmt_rqst_id
150     and p_effective_date between
151         prc.effective_start_date and prc.effective_end_date
152     and asg.person_id = prc.submitter_person_id
153     and asg.assignment_type <> 'C'
154     and asg.primary_flag = 'Y'
155     and  p_effective_date between
156         asg.effective_start_date and asg.effective_end_date ;
157 
158   l_asg  c_asg%Rowtype ;
159 
160    --cursor to check the certifcate already exist
161    cursor c_pqc is
162    select 'x'
163    from  ben_prtt_rmt_rqst_ctfn_prvdd_f
164    where prtt_clm_gd_or_svc_typ_id   = p_prtt_clm_gd_or_svc_typ_id
165      and p_pl_gd_r_svc_ctfn_id       = p_pl_gd_r_svc_ctfn_id
166      and nvl(reimbmt_ctfn_typ_cd,-1) = nvl(p_reimbmt_ctfn_typ_cd ,-1)
167      and p_effective_date between effective_start_date
168      and effective_end_Date ;
169 
170    l_prtt_rmt_rqst_ctfn_prvdd_id number(15) ;
171    l_effective_start_date  date ;
172    l_effective_end_date   date ;
173    l_object_version_number number(9);
174 Begin
175    hr_utility.set_location ('Entering '||l_proc,10);
176    open c_pqc ;
177    fetch c_pqc into l_dummy_var ;
178    if c_pqc%found then
179       l_write_ctfn := FALSE ;
180       hr_utility.set_location('certifacte eixist '   , 11);
181    end if ;
182    close c_pqc ;
183    ---validate rule
184       hr_utility.set_location('formula'|| p_ctfn_rqd_when_rl  , 11);
185 
186    if l_write_ctfn and p_ctfn_rqd_when_rl is not null then
187       --pl id and assg id
188       open c_Asg ;
189       fetch c_asg into l_asg ;
190       close c_asg ;
191       hr_utility.set_location('calling formula' , 11);
192       --
193       l_outputs := benutils.formula
194                    (p_formula_id           => p_ctfn_rqd_when_rl
195                    ,p_pl_id                => l_asg.pl_id
196                    ,p_business_group_id    => p_business_group_id
197                    ,p_assignment_id        => l_asg.assignment_id
198                    ,p_enrt_ctfn_typ_cd     => p_reimbmt_ctfn_typ_cd
199                    ,p_effective_date       => p_effective_date);
200        --
201        if l_outputs(l_outputs.first).value = 'N' then
202           l_write_ctfn := FALSE;
203        end if;
204       null ;
205    end if ;
206   if l_write_ctfn then
207 
208       ben_reimbmt_ctfn_prvdd_api.create_reimbmt_ctfn_prvdd
209         (p_validate                         => false
210           ,p_prtt_rmt_rqst_ctfn_prvdd_id    => l_prtt_rmt_rqst_ctfn_prvdd_id
211           ,p_prtt_clm_gd_or_svc_typ_id      => p_prtt_clm_gd_or_svc_typ_id
212           ,p_pl_gd_r_svc_ctfn_id            => p_pl_gd_r_svc_ctfn_id
213           ,p_effective_start_date           => l_effective_start_date
214           ,p_effective_end_date             => l_effective_end_date
215           ,p_reimbmt_ctfn_rqd_flag          => p_reimbmt_ctfn_rqd_flag
216           ,p_business_group_id              => p_business_group_id
217           ,p_reimbmt_ctfn_typ_cd            => p_reimbmt_ctfn_typ_cd
218           ,p_object_version_number          => l_object_version_number
219           ,p_effective_date                 => p_effective_date
220         );
221 
222 
223   end if ;
224   hr_utility.set_location ('Leaving ' ||l_proc,10);
225 
226 End write_remb_rqst_ctfn ;
227 
228 
229 
230 -- ----------------------------------------------------------------------------
231 -- |------------------------< create_PRTT_CLM_GD_R_SVC_TYP >----------------------|
232 -- ----------------------------------------------------------------------------
233 --
234 procedure create_PRTT_CLM_GD_R_SVC_TYP
235   (p_validate                       in  boolean   default false
236   ,p_prtt_clm_gd_or_svc_typ_id      out nocopy number
237   ,p_prtt_reimbmt_rqst_id           in  number    default null
238   ,p_gd_or_svc_typ_id               in  number    default null
239   ,p_business_group_id              in  number    default null
240   ,p_pcg_attribute_category         in  varchar2  default null
241   ,p_pcg_attribute1                 in  varchar2  default null
242   ,p_pcg_attribute2                 in  varchar2  default null
243   ,p_pcg_attribute3                 in  varchar2  default null
244   ,p_pcg_attribute4                 in  varchar2  default null
245   ,p_pcg_attribute5                 in  varchar2  default null
246   ,p_pcg_attribute6                 in  varchar2  default null
247   ,p_pcg_attribute7                 in  varchar2  default null
248   ,p_pcg_attribute8                 in  varchar2  default null
249   ,p_pcg_attribute9                 in  varchar2  default null
250   ,p_pcg_attribute10                in  varchar2  default null
251   ,p_pcg_attribute11                in  varchar2  default null
252   ,p_pcg_attribute12                in  varchar2  default null
253   ,p_pcg_attribute13                in  varchar2  default null
254   ,p_pcg_attribute14                in  varchar2  default null
255   ,p_pcg_attribute15                in  varchar2  default null
256   ,p_pcg_attribute16                in  varchar2  default null
257   ,p_pcg_attribute17                in  varchar2  default null
258   ,p_pcg_attribute18                in  varchar2  default null
259   ,p_pcg_attribute19                in  varchar2  default null
260   ,p_pcg_attribute20                in  varchar2  default null
261   ,p_pcg_attribute21                in  varchar2  default null
262   ,p_pcg_attribute22                in  varchar2  default null
263   ,p_pcg_attribute23                in  varchar2  default null
264   ,p_pcg_attribute24                in  varchar2  default null
265   ,p_pcg_attribute25                in  varchar2  default null
266   ,p_pcg_attribute26                in  varchar2  default null
267   ,p_pcg_attribute27                in  varchar2  default null
268   ,p_pcg_attribute28                in  varchar2  default null
269   ,p_pcg_attribute29                in  varchar2  default null
270   ,p_pcg_attribute30                in  varchar2  default null
271   ,p_object_version_number          out nocopy number
272   ,p_pl_gd_or_svc_id                in  number    default null
273   ,p_effective_date                 in  date      default null
274   ) is
275   --
276   -- Declare cursors and local variables
277   --
278   l_prtt_clm_gd_or_svc_typ_id ben_prtt_clm_gd_or_svc_typ.prtt_clm_gd_or_svc_typ_id%TYPE;
279   l_proc varchar2(72) := g_package||'create_PRTT_CLM_GD_R_SVC_TYP';
280   l_object_version_number ben_prtt_clm_gd_or_svc_typ.object_version_number%TYPE;
281   --#### Tilak ####
282   l_ctfn_rqd_flag varchar2(30) ;
283 
284   cursor c_pct_gdsvc is
285   select *  from
286   ben_pl_gd_r_svc_ctfn_f
287   where pl_gd_or_svc_id = p_pl_gd_or_svc_id
288     and p_effective_date  between
289         effective_start_date and
290         effective_end_date ;
291   --
292 begin
293   --
294   hr_utility.set_location('Entering:'|| l_proc, 10);
295   --
296   -- Issue a savepoint if operating in validation only mode
297   --
298   savepoint create_PRTT_CLM_GD_R_SVC_TYP;
299   --
300   hr_utility.set_location(l_proc, 20);
301   --
302   -- Process Logic
303   --
304   begin
305     --
306     -- Start of API User Hook for the before hook of create_PRTT_CLM_GD_R_SVC_TYP
307     --
308     ben_PRTT_CLM_GD_R_SVC_TYP_bk1.create_PRTT_CLM_GD_R_SVC_TYP_b
309       (
310        p_prtt_reimbmt_rqst_id           =>  p_prtt_reimbmt_rqst_id
311       ,p_gd_or_svc_typ_id               =>  p_gd_or_svc_typ_id
312       ,p_business_group_id              =>  p_business_group_id
313       ,p_pcg_attribute_category         =>  p_pcg_attribute_category
314       ,p_pcg_attribute1                 =>  p_pcg_attribute1
315       ,p_pcg_attribute2                 =>  p_pcg_attribute2
316       ,p_pcg_attribute3                 =>  p_pcg_attribute3
317       ,p_pcg_attribute4                 =>  p_pcg_attribute4
318       ,p_pcg_attribute5                 =>  p_pcg_attribute5
319       ,p_pcg_attribute6                 =>  p_pcg_attribute6
320       ,p_pcg_attribute7                 =>  p_pcg_attribute7
321       ,p_pcg_attribute8                 =>  p_pcg_attribute8
322       ,p_pcg_attribute9                 =>  p_pcg_attribute9
323       ,p_pcg_attribute10                =>  p_pcg_attribute10
324       ,p_pcg_attribute11                =>  p_pcg_attribute11
325       ,p_pcg_attribute12                =>  p_pcg_attribute12
326       ,p_pcg_attribute13                =>  p_pcg_attribute13
327       ,p_pcg_attribute14                =>  p_pcg_attribute14
328       ,p_pcg_attribute15                =>  p_pcg_attribute15
329       ,p_pcg_attribute16                =>  p_pcg_attribute16
330       ,p_pcg_attribute17                =>  p_pcg_attribute17
331       ,p_pcg_attribute18                =>  p_pcg_attribute18
332       ,p_pcg_attribute19                =>  p_pcg_attribute19
333       ,p_pcg_attribute20                =>  p_pcg_attribute20
334       ,p_pcg_attribute21                =>  p_pcg_attribute21
335       ,p_pcg_attribute22                =>  p_pcg_attribute22
336       ,p_pcg_attribute23                =>  p_pcg_attribute23
337       ,p_pcg_attribute24                =>  p_pcg_attribute24
338       ,p_pcg_attribute25                =>  p_pcg_attribute25
339       ,p_pcg_attribute26                =>  p_pcg_attribute26
340       ,p_pcg_attribute27                =>  p_pcg_attribute27
341       ,p_pcg_attribute28                =>  p_pcg_attribute28
342       ,p_pcg_attribute29                =>  p_pcg_attribute29
343       ,p_pcg_attribute30                =>  p_pcg_attribute30
344       ,p_pl_gd_or_svc_id                =>  p_pl_gd_or_svc_id
345       );
346   exception
347     when hr_api.cannot_find_prog_unit then
348       hr_api.cannot_find_prog_unit_error
349         (
350          p_module_name => 'CREATE_PRTT_CLM_GD_R_SVC_TYP'
351         ,p_hook_type   => 'BP'
352         );
353     --
354     -- End of API User Hook for the before hook of create_PRTT_CLM_GD_R_SVC_TYP
355     --
356   end;
357   --
358   ben_pcg_ins.ins
359     (
360      p_prtt_clm_gd_or_svc_typ_id     => l_prtt_clm_gd_or_svc_typ_id
361     ,p_prtt_reimbmt_rqst_id          => p_prtt_reimbmt_rqst_id
362     ,p_gd_or_svc_typ_id              => p_gd_or_svc_typ_id
363     ,p_business_group_id             => p_business_group_id
364     ,p_pcg_attribute_category        => p_pcg_attribute_category
365     ,p_pcg_attribute1                => p_pcg_attribute1
366     ,p_pcg_attribute2                => p_pcg_attribute2
367     ,p_pcg_attribute3                => p_pcg_attribute3
368     ,p_pcg_attribute4                => p_pcg_attribute4
369     ,p_pcg_attribute5                => p_pcg_attribute5
370     ,p_pcg_attribute6                => p_pcg_attribute6
371     ,p_pcg_attribute7                => p_pcg_attribute7
372     ,p_pcg_attribute8                => p_pcg_attribute8
373     ,p_pcg_attribute9                => p_pcg_attribute9
374     ,p_pcg_attribute10               => p_pcg_attribute10
375     ,p_pcg_attribute11               => p_pcg_attribute11
376     ,p_pcg_attribute12               => p_pcg_attribute12
377     ,p_pcg_attribute13               => p_pcg_attribute13
378     ,p_pcg_attribute14               => p_pcg_attribute14
379     ,p_pcg_attribute15               => p_pcg_attribute15
380     ,p_pcg_attribute16               => p_pcg_attribute16
381     ,p_pcg_attribute17               => p_pcg_attribute17
382     ,p_pcg_attribute18               => p_pcg_attribute18
383     ,p_pcg_attribute19               => p_pcg_attribute19
384     ,p_pcg_attribute20               => p_pcg_attribute20
385     ,p_pcg_attribute21               => p_pcg_attribute21
386     ,p_pcg_attribute22               => p_pcg_attribute22
387     ,p_pcg_attribute23               => p_pcg_attribute23
388     ,p_pcg_attribute24               => p_pcg_attribute24
389     ,p_pcg_attribute25               => p_pcg_attribute25
390     ,p_pcg_attribute26               => p_pcg_attribute26
391     ,p_pcg_attribute27               => p_pcg_attribute27
392     ,p_pcg_attribute28               => p_pcg_attribute28
393     ,p_pcg_attribute29               => p_pcg_attribute29
394     ,p_pcg_attribute30               => p_pcg_attribute30
395     ,p_object_version_number         => l_object_version_number
396     ,p_pl_gd_or_svc_id               => p_pl_gd_or_svc_id
397     );
398   --
399   --#### Tilak ####
400   ---Check Cretification is required
401   check_remb_rqst_ctfn_rqs
402     (p_pl_gd_or_svc_id     => p_pl_gd_or_svc_id
403     ,p_effective_date      => p_effective_date
404     ,p_ctfn_rqd_flag       => l_ctfn_rqd_flag );
405 
406 
407   if l_ctfn_rqd_flag = 'Y' then
408      ----Create Certification
409      for  l_pct_gdsvc   in  c_pct_gdsvc loop
410           write_remb_rqst_ctfn (
411            p_prtt_clm_gd_or_svc_typ_id    => l_prtt_clm_gd_or_svc_typ_id
412           ,p_pl_gd_r_svc_ctfn_id          => l_pct_gdsvc.pl_gd_r_svc_ctfn_id
413           ,p_reimbmt_ctfn_rqd_flag        => l_pct_gdsvc.rqd_flag
414           ,p_reimbmt_ctfn_typ_cd          => l_pct_gdsvc.rmbmt_ctfn_typ_cd
415           ,p_prtt_enrt_actn_id            => null
416           ,p_business_group_id            => p_business_group_id
417           ,p_ctfn_rqd_when_rl             => l_pct_gdsvc.ctfn_rqd_when_rl
418           ,p_prtt_reimbmt_rqst_id         => p_prtt_reimbmt_rqst_id
419           ,p_effective_date               => p_effective_date );
420 
421      end loop ;
422   end if ;
423 
424 
425 
426   begin
427     --
428     -- Start of API User Hook for the after hook of create_PRTT_CLM_GD_R_SVC_TYP
429     --
430     ben_PRTT_CLM_GD_R_SVC_TYP_bk1.create_PRTT_CLM_GD_R_SVC_TYP_a
431       (
432        p_prtt_clm_gd_or_svc_typ_id      =>  l_prtt_clm_gd_or_svc_typ_id
433       ,p_prtt_reimbmt_rqst_id           =>  p_prtt_reimbmt_rqst_id
434       ,p_gd_or_svc_typ_id               =>  p_gd_or_svc_typ_id
435       ,p_business_group_id              =>  p_business_group_id
436       ,p_pcg_attribute_category         =>  p_pcg_attribute_category
437       ,p_pcg_attribute1                 =>  p_pcg_attribute1
438       ,p_pcg_attribute2                 =>  p_pcg_attribute2
439       ,p_pcg_attribute3                 =>  p_pcg_attribute3
440       ,p_pcg_attribute4                 =>  p_pcg_attribute4
441       ,p_pcg_attribute5                 =>  p_pcg_attribute5
442       ,p_pcg_attribute6                 =>  p_pcg_attribute6
443       ,p_pcg_attribute7                 =>  p_pcg_attribute7
444       ,p_pcg_attribute8                 =>  p_pcg_attribute8
445       ,p_pcg_attribute9                 =>  p_pcg_attribute9
446       ,p_pcg_attribute10                =>  p_pcg_attribute10
447       ,p_pcg_attribute11                =>  p_pcg_attribute11
448       ,p_pcg_attribute12                =>  p_pcg_attribute12
449       ,p_pcg_attribute13                =>  p_pcg_attribute13
450       ,p_pcg_attribute14                =>  p_pcg_attribute14
451       ,p_pcg_attribute15                =>  p_pcg_attribute15
452       ,p_pcg_attribute16                =>  p_pcg_attribute16
453       ,p_pcg_attribute17                =>  p_pcg_attribute17
454       ,p_pcg_attribute18                =>  p_pcg_attribute18
455       ,p_pcg_attribute19                =>  p_pcg_attribute19
456       ,p_pcg_attribute20                =>  p_pcg_attribute20
457       ,p_pcg_attribute21                =>  p_pcg_attribute21
458       ,p_pcg_attribute22                =>  p_pcg_attribute22
459       ,p_pcg_attribute23                =>  p_pcg_attribute23
460       ,p_pcg_attribute24                =>  p_pcg_attribute24
461       ,p_pcg_attribute25                =>  p_pcg_attribute25
462       ,p_pcg_attribute26                =>  p_pcg_attribute26
463       ,p_pcg_attribute27                =>  p_pcg_attribute27
464       ,p_pcg_attribute28                =>  p_pcg_attribute28
465       ,p_pcg_attribute29                =>  p_pcg_attribute29
466       ,p_pcg_attribute30                =>  p_pcg_attribute30
467       ,p_object_version_number          =>  l_object_version_number
468       ,p_pl_gd_or_svc_id                =>  p_pl_gd_or_svc_id
469       );
470   exception
471     when hr_api.cannot_find_prog_unit then
472       hr_api.cannot_find_prog_unit_error
473         (p_module_name => 'CREATE_PRTT_CLM_GD_R_SVC_TYP'
474         ,p_hook_type   => 'AP'
475         );
476     --
477     -- End of API User Hook for the after hook of create_PRTT_CLM_GD_R_SVC_TYP
478     --
479   end;
480   --
481   hr_utility.set_location(l_proc, 60);
482   --
483   -- When in validation only mode raise the Validate_Enabled exception
484   --
485   if p_validate then
486     raise hr_api.validate_enabled;
487   end if;
488   --
489   -- Set all output arguments
490   --
491   p_prtt_clm_gd_or_svc_typ_id := l_prtt_clm_gd_or_svc_typ_id;
492   p_object_version_number := l_object_version_number;
493   --
494   hr_utility.set_location(' Leaving:'||l_proc, 70);
495   --
496 exception
497   --
498   when hr_api.validate_enabled then
499     --
500     -- As the Validate_Enabled exception has been raised
501     -- we must rollback to the savepoint
502     --
503     ROLLBACK TO create_PRTT_CLM_GD_R_SVC_TYP;
504     --
505     -- Only set output warning arguments
506     -- (Any key or derived arguments must be set to null
507     -- when validation only mode is being used.)
508     --
509     p_prtt_clm_gd_or_svc_typ_id := null;
510     p_object_version_number  := null;
511     hr_utility.set_location(' Leaving:'||l_proc, 80);
512     --
513   when others then
514     --
515     -- A validation or unexpected error has occured
516     --
517     ROLLBACK TO create_PRTT_CLM_GD_R_SVC_TYP;
518     p_prtt_clm_gd_or_svc_typ_id := null;
519     p_object_version_number  := null;
520     hr_utility.set_location(' Leaving:'||l_proc, 90);
521     raise;
522     --
523 end create_PRTT_CLM_GD_R_SVC_TYP;
524 -- ----------------------------------------------------------------------------
525 -- |------------------------< update_PRTT_CLM_GD_R_SVC_TYP >--- ------------------|
526 -- ----------------------------------------------------------------------------
527 --
528 procedure update_PRTT_CLM_GD_R_SVC_TYP
529   (p_validate                       in  boolean   default false
530   ,p_prtt_clm_gd_or_svc_typ_id      in  number
531   ,p_prtt_reimbmt_rqst_id           in  number    default hr_api.g_number
532   ,p_gd_or_svc_typ_id               in  number    default hr_api.g_number
533   ,p_business_group_id              in  number    default hr_api.g_number
534   ,p_pcg_attribute_category         in  varchar2  default hr_api.g_varchar2
535   ,p_pcg_attribute1                 in  varchar2  default hr_api.g_varchar2
536   ,p_pcg_attribute2                 in  varchar2  default hr_api.g_varchar2
537   ,p_pcg_attribute3                 in  varchar2  default hr_api.g_varchar2
538   ,p_pcg_attribute4                 in  varchar2  default hr_api.g_varchar2
539   ,p_pcg_attribute5                 in  varchar2  default hr_api.g_varchar2
540   ,p_pcg_attribute6                 in  varchar2  default hr_api.g_varchar2
541   ,p_pcg_attribute7                 in  varchar2  default hr_api.g_varchar2
542   ,p_pcg_attribute8                 in  varchar2  default hr_api.g_varchar2
543   ,p_pcg_attribute9                 in  varchar2  default hr_api.g_varchar2
544   ,p_pcg_attribute10                in  varchar2  default hr_api.g_varchar2
545   ,p_pcg_attribute11                in  varchar2  default hr_api.g_varchar2
546   ,p_pcg_attribute12                in  varchar2  default hr_api.g_varchar2
547   ,p_pcg_attribute13                in  varchar2  default hr_api.g_varchar2
548   ,p_pcg_attribute14                in  varchar2  default hr_api.g_varchar2
549   ,p_pcg_attribute15                in  varchar2  default hr_api.g_varchar2
550   ,p_pcg_attribute16                in  varchar2  default hr_api.g_varchar2
551   ,p_pcg_attribute17                in  varchar2  default hr_api.g_varchar2
552   ,p_pcg_attribute18                in  varchar2  default hr_api.g_varchar2
553   ,p_pcg_attribute19                in  varchar2  default hr_api.g_varchar2
554   ,p_pcg_attribute20                in  varchar2  default hr_api.g_varchar2
555   ,p_pcg_attribute21                in  varchar2  default hr_api.g_varchar2
556   ,p_pcg_attribute22                in  varchar2  default hr_api.g_varchar2
557   ,p_pcg_attribute23                in  varchar2  default hr_api.g_varchar2
558   ,p_pcg_attribute24                in  varchar2  default hr_api.g_varchar2
559   ,p_pcg_attribute25                in  varchar2  default hr_api.g_varchar2
560   ,p_pcg_attribute26                in  varchar2  default hr_api.g_varchar2
561   ,p_pcg_attribute27                in  varchar2  default hr_api.g_varchar2
562   ,p_pcg_attribute28                in  varchar2  default hr_api.g_varchar2
563   ,p_pcg_attribute29                in  varchar2  default hr_api.g_varchar2
564   ,p_pcg_attribute30                in  varchar2  default hr_api.g_varchar2
565   ,p_object_version_number          in out nocopy number
566   ,p_pl_gd_or_svc_id                in number    default hr_api.g_number
567   ,p_effective_date                 in  date      default null
568   ) is
569   --
570   -- Declare cursors and local variables
571   --
572   l_proc varchar2(72) := g_package||'update_PRTT_CLM_GD_R_SVC_TYP';
573   l_object_version_number ben_prtt_clm_gd_or_svc_typ.object_version_number%TYPE;
574 
575    --#### Tilak ####
576   l_ctfn_rqd_flag varchar2(30) ;
577 
578   cursor c_pct_gdsvc is
579   select *  from
580   ben_pl_gd_r_svc_ctfn_f
581   where pl_gd_or_svc_id = p_pl_gd_or_svc_id
582     and p_effective_date  between
583         effective_start_date and
584         effective_end_date ;
585 
586   --
587 begin
588   --
589   hr_utility.set_location('Entering:'|| l_proc, 10);
590   --
591   -- Issue a savepoint if operating in validation only mode
592   --
593   savepoint update_PRTT_CLM_GD_R_SVC_TYP;
594   --
595   hr_utility.set_location(l_proc, 20);
596   --
597   -- Process Logic
598   --
599   l_object_version_number := p_object_version_number;
600   --
601   begin
602     --
603     -- Start of API User Hook for the before hook of update_PRTT_CLM_GD_R_SVC_TYP
604     --
605     ben_PRTT_CLM_GD_R_SVC_TYP_bk2.update_PRTT_CLM_GD_R_SVC_TYP_b
606       (
607        p_prtt_clm_gd_or_svc_typ_id      =>  p_prtt_clm_gd_or_svc_typ_id
608       ,p_prtt_reimbmt_rqst_id           =>  p_prtt_reimbmt_rqst_id
609       ,p_gd_or_svc_typ_id               =>  p_gd_or_svc_typ_id
610       ,p_business_group_id              =>  p_business_group_id
611       ,p_pcg_attribute_category         =>  p_pcg_attribute_category
612       ,p_pcg_attribute1                 =>  p_pcg_attribute1
613       ,p_pcg_attribute2                 =>  p_pcg_attribute2
614       ,p_pcg_attribute3                 =>  p_pcg_attribute3
615       ,p_pcg_attribute4                 =>  p_pcg_attribute4
616       ,p_pcg_attribute5                 =>  p_pcg_attribute5
617       ,p_pcg_attribute6                 =>  p_pcg_attribute6
618       ,p_pcg_attribute7                 =>  p_pcg_attribute7
619       ,p_pcg_attribute8                 =>  p_pcg_attribute8
620       ,p_pcg_attribute9                 =>  p_pcg_attribute9
621       ,p_pcg_attribute10                =>  p_pcg_attribute10
622       ,p_pcg_attribute11                =>  p_pcg_attribute11
623       ,p_pcg_attribute12                =>  p_pcg_attribute12
624       ,p_pcg_attribute13                =>  p_pcg_attribute13
625       ,p_pcg_attribute14                =>  p_pcg_attribute14
626       ,p_pcg_attribute15                =>  p_pcg_attribute15
627       ,p_pcg_attribute16                =>  p_pcg_attribute16
628       ,p_pcg_attribute17                =>  p_pcg_attribute17
629       ,p_pcg_attribute18                =>  p_pcg_attribute18
630       ,p_pcg_attribute19                =>  p_pcg_attribute19
631       ,p_pcg_attribute20                =>  p_pcg_attribute20
632       ,p_pcg_attribute21                =>  p_pcg_attribute21
633       ,p_pcg_attribute22                =>  p_pcg_attribute22
634       ,p_pcg_attribute23                =>  p_pcg_attribute23
635       ,p_pcg_attribute24                =>  p_pcg_attribute24
636       ,p_pcg_attribute25                =>  p_pcg_attribute25
637       ,p_pcg_attribute26                =>  p_pcg_attribute26
638       ,p_pcg_attribute27                =>  p_pcg_attribute27
639       ,p_pcg_attribute28                =>  p_pcg_attribute28
640       ,p_pcg_attribute29                =>  p_pcg_attribute29
641       ,p_pcg_attribute30                =>  p_pcg_attribute30
642       ,p_object_version_number          =>  p_object_version_number
643       ,p_pl_gd_or_svc_id                =>  p_pl_gd_or_svc_id
644       );
645   exception
646     when hr_api.cannot_find_prog_unit then
647       hr_api.cannot_find_prog_unit_error
648         (p_module_name => 'UPDATE_PRTT_CLM_GD_R_SVC_TYP'
649         ,p_hook_type   => 'BP'
650         );
651     --
652     -- End of API User Hook for the before hook of update_PRTT_CLM_GD_R_SVC_TYP
653     --
654   end;
655   --
656   ben_pcg_upd.upd
657     (
658      p_prtt_clm_gd_or_svc_typ_id     => p_prtt_clm_gd_or_svc_typ_id
659     ,p_prtt_reimbmt_rqst_id          => p_prtt_reimbmt_rqst_id
660     ,p_gd_or_svc_typ_id              => p_gd_or_svc_typ_id
661     ,p_business_group_id             => p_business_group_id
662     ,p_pcg_attribute_category        => p_pcg_attribute_category
663     ,p_pcg_attribute1                => p_pcg_attribute1
664     ,p_pcg_attribute2                => p_pcg_attribute2
665     ,p_pcg_attribute3                => p_pcg_attribute3
666     ,p_pcg_attribute4                => p_pcg_attribute4
667     ,p_pcg_attribute5                => p_pcg_attribute5
668     ,p_pcg_attribute6                => p_pcg_attribute6
669     ,p_pcg_attribute7                => p_pcg_attribute7
670     ,p_pcg_attribute8                => p_pcg_attribute8
671     ,p_pcg_attribute9                => p_pcg_attribute9
672     ,p_pcg_attribute10               => p_pcg_attribute10
673     ,p_pcg_attribute11               => p_pcg_attribute11
674     ,p_pcg_attribute12               => p_pcg_attribute12
675     ,p_pcg_attribute13               => p_pcg_attribute13
676     ,p_pcg_attribute14               => p_pcg_attribute14
677     ,p_pcg_attribute15               => p_pcg_attribute15
678     ,p_pcg_attribute16               => p_pcg_attribute16
679     ,p_pcg_attribute17               => p_pcg_attribute17
680     ,p_pcg_attribute18               => p_pcg_attribute18
681     ,p_pcg_attribute19               => p_pcg_attribute19
682     ,p_pcg_attribute20               => p_pcg_attribute20
683     ,p_pcg_attribute21               => p_pcg_attribute21
684     ,p_pcg_attribute22               => p_pcg_attribute22
685     ,p_pcg_attribute23               => p_pcg_attribute23
686     ,p_pcg_attribute24               => p_pcg_attribute24
687     ,p_pcg_attribute25               => p_pcg_attribute25
688     ,p_pcg_attribute26               => p_pcg_attribute26
689     ,p_pcg_attribute27               => p_pcg_attribute27
690     ,p_pcg_attribute28               => p_pcg_attribute28
691     ,p_pcg_attribute29               => p_pcg_attribute29
692     ,p_pcg_attribute30               => p_pcg_attribute30
693     ,p_object_version_number         => l_object_version_number
694     ,p_pl_gd_or_svc_id               => p_pl_gd_or_svc_id
695     );
696 
697 
698 
699   --#### Tilak ####
700   ---Check Cretification is required
701   check_remb_rqst_ctfn_rqs
702     (p_pl_gd_or_svc_id     => p_pl_gd_or_svc_id
703     ,p_effective_date      => p_effective_date
704     ,p_ctfn_rqd_flag       => l_ctfn_rqd_flag );
705 
706 
707   if l_ctfn_rqd_flag = 'Y' then
708      ----Create Certification
709      for l_pct_gdsvc   in  c_pct_gdsvc loop
710          write_remb_rqst_ctfn (
711            p_prtt_clm_gd_or_svc_typ_id    => p_prtt_clm_gd_or_svc_typ_id
712           ,p_pl_gd_r_svc_ctfn_id          => l_pct_gdsvc.pl_gd_r_svc_ctfn_id
713           ,p_reimbmt_ctfn_rqd_flag        => l_pct_gdsvc.rqd_flag
714           ,p_reimbmt_ctfn_typ_cd          => l_pct_gdsvc.rmbmt_ctfn_typ_cd
715           ,p_prtt_enrt_actn_id            => null
716           ,p_business_group_id            => p_business_group_id
717           ,p_ctfn_rqd_when_rl             => l_pct_gdsvc.ctfn_rqd_when_rl
718           ,p_prtt_reimbmt_rqst_id         => p_prtt_reimbmt_rqst_id
719           ,p_effective_date               => p_effective_date );
720      end loop ;
721   end if ;
722 
723 
724   --
725   begin
726     --
727     -- Start of API User Hook for the after hook of update_PRTT_CLM_GD_R_SVC_TYP
728     --
729     ben_PRTT_CLM_GD_R_SVC_TYP_bk2.update_PRTT_CLM_GD_R_SVC_TYP_a
730       (
731        p_prtt_clm_gd_or_svc_typ_id      =>  p_prtt_clm_gd_or_svc_typ_id
732       ,p_prtt_reimbmt_rqst_id           =>  p_prtt_reimbmt_rqst_id
733       ,p_gd_or_svc_typ_id               =>  p_gd_or_svc_typ_id
734       ,p_business_group_id              =>  p_business_group_id
735       ,p_pcg_attribute_category         =>  p_pcg_attribute_category
736       ,p_pcg_attribute1                 =>  p_pcg_attribute1
737       ,p_pcg_attribute2                 =>  p_pcg_attribute2
738       ,p_pcg_attribute3                 =>  p_pcg_attribute3
739       ,p_pcg_attribute4                 =>  p_pcg_attribute4
740       ,p_pcg_attribute5                 =>  p_pcg_attribute5
741       ,p_pcg_attribute6                 =>  p_pcg_attribute6
742       ,p_pcg_attribute7                 =>  p_pcg_attribute7
743       ,p_pcg_attribute8                 =>  p_pcg_attribute8
744       ,p_pcg_attribute9                 =>  p_pcg_attribute9
745       ,p_pcg_attribute10                =>  p_pcg_attribute10
746       ,p_pcg_attribute11                =>  p_pcg_attribute11
747       ,p_pcg_attribute12                =>  p_pcg_attribute12
748       ,p_pcg_attribute13                =>  p_pcg_attribute13
749       ,p_pcg_attribute14                =>  p_pcg_attribute14
750       ,p_pcg_attribute15                =>  p_pcg_attribute15
751       ,p_pcg_attribute16                =>  p_pcg_attribute16
752       ,p_pcg_attribute17                =>  p_pcg_attribute17
753       ,p_pcg_attribute18                =>  p_pcg_attribute18
754       ,p_pcg_attribute19                =>  p_pcg_attribute19
755       ,p_pcg_attribute20                =>  p_pcg_attribute20
756       ,p_pcg_attribute21                =>  p_pcg_attribute21
757       ,p_pcg_attribute22                =>  p_pcg_attribute22
758       ,p_pcg_attribute23                =>  p_pcg_attribute23
759       ,p_pcg_attribute24                =>  p_pcg_attribute24
760       ,p_pcg_attribute25                =>  p_pcg_attribute25
761       ,p_pcg_attribute26                =>  p_pcg_attribute26
762       ,p_pcg_attribute27                =>  p_pcg_attribute27
763       ,p_pcg_attribute28                =>  p_pcg_attribute28
764       ,p_pcg_attribute29                =>  p_pcg_attribute29
765       ,p_pcg_attribute30                =>  p_pcg_attribute30
766       ,p_object_version_number          =>  l_object_version_number
767       ,p_pl_gd_or_svc_id                =>  p_pl_gd_or_svc_id
768       );
769   exception
770     when hr_api.cannot_find_prog_unit then
771       hr_api.cannot_find_prog_unit_error
772         (p_module_name => 'UPDATE_PRTT_CLM_GD_R_SVC_TYP'
773         ,p_hook_type   => 'AP'
774         );
775     --
776     -- End of API User Hook for the after hook of update_PRTT_CLM_GD_R_SVC_TYP
777     --
778   end;
779   --
780   hr_utility.set_location(l_proc, 60);
781   --
782   -- When in validation only mode raise the Validate_Enabled exception
783   --
784   if p_validate then
785     raise hr_api.validate_enabled;
786   end if;
787   --
788   -- Set all output arguments
789   --
790   p_object_version_number := l_object_version_number;
791   --
792   hr_utility.set_location(' Leaving:'||l_proc, 70);
793   --
794 exception
795   --
796   when hr_api.validate_enabled then
797     --
798     -- As the Validate_Enabled exception has been raised
799     -- we must rollback to the savepoint
800     --
801     ROLLBACK TO update_PRTT_CLM_GD_R_SVC_TYP;
802     --
803     -- Only set output warning arguments
804     -- (Any key or derived arguments must be set to null
805     -- when validation only mode is being used.)
806     --
807     hr_utility.set_location(' Leaving:'||l_proc, 80);
808     --
809   when others then
810     --
811     -- A validation or unexpected error has occured
812     --
813     ROLLBACK TO update_PRTT_CLM_GD_R_SVC_TYP;
814     hr_utility.set_location(' Leaving:'||l_proc, 90);
815     raise;
816     --
817 end update_PRTT_CLM_GD_R_SVC_TYP;
818 -- ----------------------------------------------------------------------------
819 -- |------------------------< delete_PRTT_CLM_GD_R_SVC_TYP >----------------------|
820 -- ----------------------------------------------------------------------------
821 --
822 procedure delete_PRTT_CLM_GD_R_SVC_TYP
823   (p_validate                       in  boolean  default false
824   ,p_prtt_clm_gd_or_svc_typ_id      in  number
825   ,p_object_version_number          in out nocopy number
826   ,p_effective_date                 in  date      default null
827   ) is
828   --
829   -- Declare cursors and local variables
830   --
831   l_proc varchar2(72) := g_package||'update_PRTT_CLM_GD_R_SVC_TYP';
832   l_object_version_number ben_prtt_clm_gd_or_svc_typ.object_version_number%TYPE;
833   --
834 begin
835   --
836   hr_utility.set_location('Entering:'|| l_proc, 10);
837   --
838   -- Issue a savepoint if operating in validation only mode
839   --
840   savepoint delete_PRTT_CLM_GD_R_SVC_TYP;
841   --
842   hr_utility.set_location(l_proc, 20);
843   --
844   -- Process Logic
845   --
846   l_object_version_number := p_object_version_number;
847   --
848   --
849   begin
850     --
851     -- Start of API User Hook for the before hook of delete_PRTT_CLM_GD_R_SVC_TYP
852     --
853     ben_PRTT_CLM_GD_R_SVC_TYP_bk3.delete_PRTT_CLM_GD_R_SVC_TYP_b
854       (
855        p_prtt_clm_gd_or_svc_typ_id      =>  p_prtt_clm_gd_or_svc_typ_id
856       ,p_object_version_number          =>  p_object_version_number
857       );
858   exception
859     when hr_api.cannot_find_prog_unit then
860       hr_api.cannot_find_prog_unit_error
861         (p_module_name => 'DELETE_PRTT_CLM_GD_R_SVC_TYP'
862         ,p_hook_type   => 'BP'
863         );
864     --
865     -- End of API User Hook for the before hook of delete_PRTT_CLM_GD_R_SVC_TYP
866     --
867   end;
868   --
869   ben_pcg_del.del
870     (
871      p_prtt_clm_gd_or_svc_typ_id     => p_prtt_clm_gd_or_svc_typ_id
872     ,p_object_version_number         => l_object_version_number
873     );
874 
875   --
876   --#### tilak call for deleteing ####
877   --
878   begin
879     --
880     -- Start of API User Hook for the after hook of delete_PRTT_CLM_GD_R_SVC_TYP
881     --
882     ben_PRTT_CLM_GD_R_SVC_TYP_bk3.delete_PRTT_CLM_GD_R_SVC_TYP_a
883       (
884        p_prtt_clm_gd_or_svc_typ_id      =>  p_prtt_clm_gd_or_svc_typ_id
885       ,p_object_version_number          =>  l_object_version_number
886       );
887   exception
888     when hr_api.cannot_find_prog_unit then
889       hr_api.cannot_find_prog_unit_error
890         (p_module_name => 'DELETE_PRTT_CLM_GD_R_SVC_TYP'
891         ,p_hook_type   => 'AP'
892         );
893     --
894     -- End of API User Hook for the after hook of delete_PRTT_CLM_GD_R_SVC_TYP
895     --
896   end;
897   --
898   hr_utility.set_location(l_proc, 60);
899   --
900   -- When in validation only mode raise the Validate_Enabled exception
901   --
902   if p_validate then
903     raise hr_api.validate_enabled;
904   end if;
905   --
906   hr_utility.set_location(' Leaving:'||l_proc, 70);
907   --
908 exception
909   --
910   when hr_api.validate_enabled then
911     --
912     -- As the Validate_Enabled exception has been raised
913     -- we must rollback to the savepoint
914     --
915     ROLLBACK TO delete_PRTT_CLM_GD_R_SVC_TYP;
916     --
917     -- Only set output warning arguments
918     -- (Any key or derived arguments must be set to null
919     -- when validation only mode is being used.)
920     --
921     --
922   when others then
923     --
924     -- A validation or unexpected error has occured
925     --
926     ROLLBACK TO delete_PRTT_CLM_GD_R_SVC_TYP;
927     hr_utility.set_location(' Leaving:'||l_proc, 90);
928     raise;
929     --
930 end delete_PRTT_CLM_GD_R_SVC_TYP;
931 --
932 -- ----------------------------------------------------------------------------
933 -- |-------------------------------< lck >------------------------------------|
934 -- ----------------------------------------------------------------------------
935 --
936 procedure lck
937   (
938    p_prtt_clm_gd_or_svc_typ_id                   in     number
939   ,p_object_version_number          in     number
940   ) is
941   --
942   --
943   -- Declare cursors and local variables
944   --
945   l_proc varchar2(72) := g_package||'lck';
946   --
947 begin
948   --
949   hr_utility.set_location('Entering:'|| l_proc, 10);
950   --
951   ben_pcg_shd.lck
952     (
953       p_prtt_clm_gd_or_svc_typ_id                 => p_prtt_clm_gd_or_svc_typ_id
954      ,p_object_version_number      => p_object_version_number
955     );
956   --
957   hr_utility.set_location(' Leaving:'||l_proc, 70);
958   --
959 end lck;
960 --
961 end ben_PRTT_CLM_GD_R_SVC_TYP_api;