DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_SG_PERSONAL_PAY_METHOD_API

Source


1 PACKAGE BODY hr_sg_personal_pay_method_api AS
2 /* $Header: hrsgwrpm.pkb 115.2 2002/12/03 06:56:18 apunekar ship $ */
3 /*
4  +==========================================================================================
5  |              Copyright (c) 1999 Oracle Corporation Ltd
6  |                           All rights reserved.
7  +==========================================================================================
8  |SQL Script File Name : HR SG WR PM . PKB
9  |                Name : hr_sg_personal_pay_method_api
10  |         Description : Personal Pay method API Wrapper for sg
11  |
12  |   Name           Date         Version Bug     Text
13  |   -------------- ----------   ------- -----   ----
14  |   makelly        27-JUL-2000  115.0           Created for sg
15      apunekar       01-MAY-2001  115.1  1554453  p_priority made compulsory IN parameter.
16      Apunekar       02-DEC-2002  115.2  2689189  Added Nocopy to out and in out parameters
17  |
18  |NOTES
19  +==========================================================================================
20 */
21 
22 
23 --
24 g_package  VARCHAR2(33) := 'hr_sg_personal_pay_method_api.';
25 --
26 -- ----------------------------------------------------------------------------
27 -- |-------------------------< check_sg_insert_legislation >------------------|
28 -- ----------------------------------------------------------------------------
29 --
30 -- {Start Of Comments}
31 --
32 -- Description:
33 --   This private procedure ensures that the legislation rule for the
34 --   for the personal payment method being inserted is the
35 --   of the required business process.
36 --
37 -- Prerequisites:
38 --   None.
39 --
40 -- In Parameters:
41 --   Name                           Reqd Type     Description
42 --   p_personal_payment_method_id   Yes  number   Id of personal payment
43 --                                                method being deleted.
44 --   p_effective_date               Yes  date     The session date.
45 --
46 -- Post Success:
47 --   The procedure returns control back to the calling process.
48 --
49 -- Post Failure:
50 --   The process raises an error and stops execution.
51 --
52 -- Access Status:
53 --   Private.
54 --
55 -- {End Of Comments}
56 --
57 PROCEDURE check_sg_insert_legislation
58   (p_assignment_id          IN     NUMBER
59   ,p_effective_date         IN OUT NOCOPY DATE
60   ) IS
61   --
62   -- Declare cursors and local variables
63   --
64   l_proc                VARCHAR2(72) := g_package||'check_sg_insert_egislation';
65   l_valid               VARCHAR2(150);
66   l_effective_date      DATE;
67   c_leg_code            CONSTANT VARCHAR2(2) := 'SG';
68   --
69   CURSOR legsel IS
70     SELECT  pbg.legislation_code
71     FROM    per_business_groups pbg,
72             per_assignments_f   asg
73     WHERE   pbg.business_group_id   = asg.business_group_id
74     AND     asg.assignment_id       = p_assignment_id
75     AND     p_effective_date BETWEEN asg.effective_start_date AND asg.effective_end_date;
76   --
77 BEGIN
78   hr_utility.set_location('Entering:'|| l_proc, 5);
79   --
80   -- Check that p_assignment_id and p_effective_date are not null as they
81   -- are used by the cursor to validate the business group.
82   --
83   hr_api.mandatory_arg_error
84     (p_api_name       => l_proc,
85      p_argument       => 'assignment_id',
86      p_argument_value => p_assignment_id);
87   --
88   hr_api.mandatory_arg_error
89     (p_api_name       => l_proc,
90      p_argument       => 'effective_date',
91      p_argument_value => p_effective_date);
92   --
93   hr_utility.set_location(l_proc, 6);
94   --
95   -- Ensure that the legislation rule for the employee assignment
96   -- business group is that of sg.
97   --
98   OPEN  legsel;
99   FETCH legsel
100   INTO  l_valid;
101   --
102   IF legsel%notfound THEN
103     CLOSE legsel;
104     hr_utility.set_message(801, 'HR_7348_ASSIGNMENT_INVALID');
105     hr_utility.raise_error;
106   END IF;
107   IF legsel%found AND l_valid <> c_leg_code THEN
108     CLOSE legsel;
109     hr_utility.set_message(801, 'HR_7898_PPM_BUS_GRP_INVALID');
110     hr_utility.raise_error;
111   END IF;
112   --
113   CLOSE legsel;
114   hr_utility.set_location(l_proc, 7);
115   --
116   -- Assign out parameter after truncating the date by using a local
117   -- variable.
118   --
119   l_effective_date := TRUNC(p_effective_date);
120   p_effective_date := l_effective_date;
121   --
122   hr_utility.set_location('Leaving:'|| l_proc, 8);
123   --
124 END check_sg_insert_legislation;
125 
126 -- ----------------------------------------------------------------------------
127 -- |-------------------------< check_sg_update_legislation >------------------|
128 -- ----------------------------------------------------------------------------
129 --
130 -- {Start Of Comments}
131 --
132 -- Description:
133 --   This private procedure ensures that the legislation rule for the
134 --   for the personal payment method being updated or deleted is the
135 --   of the required business process.
136 --
137 -- Prerequisites:
138 --   None.
139 --
140 -- In Parameters:
141 --   Name                           Reqd Type       Description
142 --   p_personal_payment_method_id   Yes  number     Id of personal payment
143 --                                                  method being deleted.
144 --   p_effective_date               Yes  date       The session date.
145 --
146 -- Post Success:
147 --   The procedure returns control back to the calling process.
148 --
149 -- Post Failure:
150 --   The process raises an error and stops execution.
151 --
152 -- Access Status:
153 --   Private.
154 --
155 -- {End Of Comments}
156 --
157 PROCEDURE check_sg_update_legislation
158   ( p_personal_payment_method_id    IN  pay_personal_payment_methods_f.personal_payment_method_id%type
159     ,p_effective_date               IN  DATE
160   ) IS
161   --
162   -- Declare cursors and local variables
163   --
164   l_proc                VARCHAR2(72) := g_package||'check_sg_update_legislation';
165   l_valid               VARCHAR2(150);
166   c_leg_code            CONSTANT VARCHAR2(2) := 'SG';
167   --
168   CURSOR legsel IS
169     SELECT  pbg.legislation_code
170     FROM    per_business_groups pbg,
171             pay_personal_payment_methods_f ppm
172     WHERE   pbg.business_group_id           = ppm.business_group_id
173     AND     ppm.personal_payment_method_id  = p_personal_payment_method_id
174     AND     p_effective_date BETWEEN ppm.effective_start_date AND ppm.effective_end_date;
175 --
176 BEGIN
177   --
178   -- Ensure that the legislation rule for the employee assignment business
179   -- group is that of sg.
180   --
181   hr_utility.set_location('Entering:'|| l_proc, 10);
182   OPEN  legsel;
183   FETCH legsel
184   INTO  l_valid;
185   --
186   IF legsel%notfound THEN
187     CLOSE legsel;
188     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
189     hr_utility.raise_error;
190   END IF;
191   IF legsel%found AND l_valid <> c_leg_code THEN
192     hr_utility.set_message(801, 'HR_7898_PPM_BUS_GRP_INVALID');
193     hr_utility.raise_error;
194   END IF;
195   --
196   CLOSE legsel;
197   hr_utility.set_location('Leaving:'|| l_proc, 20);
198   --
199 END check_sg_update_legislation;
200 --
201 -- ----------------------------------------------------------------------------
202 -- |--------------------< create_sg_personal_pay_method >---------------------|
203 -- ----------------------------------------------------------------------------
204 --
205 PROCEDURE create_sg_personal_pay_method
206   (p_validate                      IN     BOOLEAN  DEFAULT FALSE
207   ,p_effective_date                IN     DATE
208   ,p_assignment_id                 IN     NUMBER
209   ,p_org_payment_method_id         IN     NUMBER
210   ,p_bank_account_number           IN     VARCHAR2
211   ,p_bank_account_name             IN     VARCHAR2
212   ,p_bank_account_type             IN     VARCHAR2
213   ,p_bank_code                     IN     VARCHAR2
214   ,p_bank_name                     IN     VARCHAR2
215   ,p_branch_code                   IN     VARCHAR2
216   ,p_branch_name                   IN     VARCHAR2 DEFAULT null
217   ,p_amount                        IN     NUMBER   DEFAULT null
218   ,p_percentage                    IN     NUMBER   DEFAULT null
219   ,p_priority                      IN     NUMBER
220   ,p_comments                      IN     VARCHAR2 DEFAULT null
221   ,p_attribute_category            IN     VARCHAR2 DEFAULT null
222   ,p_attribute1                    IN     VARCHAR2 DEFAULT null
223   ,p_attribute2                    IN     VARCHAR2 DEFAULT null
224   ,p_attribute3                    IN     VARCHAR2 DEFAULT null
225   ,p_attribute4                    IN     VARCHAR2 DEFAULT null
226   ,p_attribute5                    IN     VARCHAR2 DEFAULT null
227   ,p_attribute6                    IN     VARCHAR2 DEFAULT null
228   ,p_attribute7                    IN     VARCHAR2 DEFAULT null
229   ,p_attribute8                    IN     VARCHAR2 DEFAULT null
230   ,p_attribute9                    IN     VARCHAR2 DEFAULT null
231   ,p_attribute10                   IN     VARCHAR2 DEFAULT null
232   ,p_attribute11                   IN     VARCHAR2 DEFAULT null
233   ,p_attribute12                   IN     VARCHAR2 DEFAULT null
234   ,p_attribute13                   IN     VARCHAR2 DEFAULT null
235   ,p_attribute14                   IN     VARCHAR2 DEFAULT null
236   ,p_attribute15                   IN     VARCHAR2 DEFAULT null
237   ,p_attribute16                   IN     VARCHAR2 DEFAULT null
238   ,p_attribute17                   IN     VARCHAR2 DEFAULT null
239   ,p_attribute18                   IN     VARCHAR2 DEFAULT null
240   ,p_attribute19                   IN     VARCHAR2 DEFAULT null
241   ,p_attribute20                   IN     VARCHAR2 DEFAULT null
242   ,p_payee_type                    IN     VARCHAR2 DEFAULT null
243   ,p_payee_id                      IN     NUMBER   DEFAULT null
244   ,p_personal_payment_method_id    OUT    NOCOPY NUMBER
245   ,p_external_account_id           OUT    NOCOPY NUMBER
246   ,p_object_version_number         OUT    NOCOPY NUMBER
247   ,p_effective_start_date          OUT    NOCOPY DATE
248   ,p_effective_end_date            OUT    NOCOPY DATE
249   ,p_comment_id                    OUT    NOCOPY NUMBER
250   ) is
251   --
252   -- Declare cursors and local variables
253   --
254   l_proc                VARCHAR2(72) := g_package||'create_sg_personal_pay_method';
255   l_valid               VARCHAR2(150);
256   l_effective_date      DATE;
257   --
258 BEGIN
259   hr_utility.set_location('Entering:'|| l_proc, 5);
260   --
261   --
262   l_effective_date := p_effective_date;
263   --
264   check_sg_insert_legislation
265   (p_assignment_id   => p_assignment_id
266   ,p_effective_date  => l_effective_date);
267   --
268   hr_utility.set_location(l_proc, 7);
269   --
270   -- Call the business process to create the personal payment method
271   --
272   hr_personal_pay_method_api.create_personal_pay_method
273   (p_validate                      => p_validate
274   ,p_effective_date                => l_effective_date
275   ,p_assignment_id                 => p_assignment_id
276   ,p_org_payment_method_id         => p_org_payment_method_id
277   ,p_amount                        => p_amount
278   ,p_percentage                    => p_percentage
279   ,p_priority                      => p_priority
280   ,p_comments                      => p_comments
281   ,p_attribute_category            => p_attribute_category
282   ,p_attribute1                    => p_attribute1
283   ,p_attribute2                    => p_attribute2
284   ,p_attribute3                    => p_attribute3
285   ,p_attribute4                    => p_attribute4
286   ,p_attribute5                    => p_attribute5
287   ,p_attribute6                    => p_attribute6
288   ,p_attribute7                    => p_attribute7
289   ,p_attribute8                    => p_attribute8
290   ,p_attribute9                    => p_attribute9
291   ,p_attribute10                   => p_attribute10
292   ,p_attribute11                   => p_attribute11
293   ,p_attribute12                   => p_attribute12
294   ,p_attribute13                   => p_attribute13
295   ,p_attribute14                   => p_attribute14
296   ,p_attribute15                   => p_attribute15
297   ,p_attribute16                   => p_attribute16
298   ,p_attribute17                   => p_attribute17
299   ,p_attribute18                   => p_attribute18
300   ,p_attribute19                   => p_attribute19
301   ,p_attribute20                   => p_attribute20
302   ,p_territory_code                => 'SG'
303   ,p_segment1                      => p_bank_account_number
304   ,p_segment2                      => p_bank_account_name
305   ,p_segment3                      => p_bank_account_type
306   ,p_segment4                      => p_bank_code
307   ,p_segment5                      => p_bank_name
308   ,p_segment6                      => p_branch_code
309   ,p_segment7                      => p_branch_name
310   ,p_payee_type                    => p_payee_type
311   ,p_payee_id                      => p_payee_id
312   ,p_personal_payment_method_id    => p_personal_payment_method_id
313   ,p_external_account_id           => p_external_account_id
314   ,p_object_version_number         => p_object_version_number
315   ,p_effective_start_date          => p_effective_start_date
316   ,p_effective_end_date            => p_effective_end_date
317   ,p_comment_id                    => p_comment_id
318   );
319   --
320   hr_utility.set_location(' Leaving:'||l_proc, 8);
321 END create_sg_personal_pay_method;
322 -- ----------------------------------------------------------------------------
323 -- |--------------------< update_sg_personal_pay_method >---------------------|
324 -- ----------------------------------------------------------------------------
325 --
326 PROCEDURE update_sg_personal_pay_method
327   (p_validate                      IN     BOOLEAN  DEFAULT FALSE
328   ,p_effective_date                IN     DATE
329   ,p_datetrack_update_mode         IN     VARCHAR2
330   ,p_personal_payment_method_id    IN     NUMBER
331   ,p_object_version_number         IN OUT NOCOPY NUMBER
332   ,p_bank_account_number           IN     VARCHAR2 DEFAULT hr_api.g_varchar2
333   ,p_bank_account_name             IN     VARCHAR2 DEFAULT hr_api.g_varchar2
334   ,p_bank_account_type             IN     VARCHAR2 DEFAULT hr_api.g_varchar2
335   ,p_bank_code                     IN     VARCHAR2 DEFAULT hr_api.g_varchar2
336   ,p_bank_name                     IN     VARCHAR2 DEFAULT hr_api.g_varchar2
337   ,p_branch_code                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
338   ,p_branch_name                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
339   ,p_amount                        IN     NUMBER   DEFAULT hr_api.g_number
340   ,p_comments                      IN     VARCHAR2 DEFAULT hr_api.g_varchar2
341   ,p_percentage                    IN     NUMBER   DEFAULT hr_api.g_number
342   ,p_priority                      IN     NUMBER   DEFAULT hr_api.g_number
343   ,p_attribute_category            IN     VARCHAR2 DEFAULT hr_api.g_varchar2
344   ,p_attribute1                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
345   ,p_attribute2                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
346   ,p_attribute3                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
347   ,p_attribute4                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
348   ,p_attribute5                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
349   ,p_attribute6                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
350   ,p_attribute7                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
351   ,p_attribute8                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
352   ,p_attribute9                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
353   ,p_attribute10                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
354   ,p_attribute11                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
355   ,p_attribute12                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
356   ,p_attribute13                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
357   ,p_attribute14                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
358   ,p_attribute15                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
359   ,p_attribute16                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
360   ,p_attribute17                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
361   ,p_attribute18                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
362   ,p_attribute19                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
363   ,p_attribute20                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
364   ,p_payee_type                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
365   ,p_payee_id                      IN     NUMBER   DEFAULT hr_api.g_number
366   ,p_comment_id                    OUT    NOCOPY NUMBER
367   ,p_external_account_id           OUT    NOCOPY NUMBER
368   ,p_effective_start_date          OUT    NOCOPY DATE
369   ,p_effective_end_date            OUT    NOCOPY DATE
370   ) is
371   --
372   -- Declare cursors and local variables
373   --
374   l_proc                VARCHAR2(72) :=  g_package||'update_sg_personal_pay_method';
375   --
376 BEGIN
377   hr_utility.set_location('Entering:'|| l_proc, 5);
378   --
379   -- Ensure that the legislation rule for the employee assignment business
380   -- group is 'SG'.
381   --
382   check_sg_update_legislation
383   (p_personal_payment_method_id => p_personal_payment_method_id
384   ,p_effective_date             => p_effective_date);
385   --
386   hr_utility.set_location(l_proc, 6);
387   --
388   -- Call the business process to update the personal payment method
389   --
390 hr_personal_pay_method_api.update_personal_pay_method
391   (p_validate                      => p_validate
392   ,p_effective_date                => trunc(p_effective_date)
393   ,p_datetrack_update_mode         => p_datetrack_update_mode
394   ,p_personal_payment_method_id    => p_personal_payment_method_id
395   ,p_object_version_number         => p_object_version_number
396   ,p_amount                        => p_amount
397   ,p_comments                      => p_comments
398   ,p_percentage                    => p_percentage
399   ,p_priority                      => p_priority
400   ,p_attribute_category            => p_attribute_category
401   ,p_attribute1                    => p_attribute1
402   ,p_attribute2                    => p_attribute2
403   ,p_attribute3                    => p_attribute3
404   ,p_attribute4                    => p_attribute4
405   ,p_attribute5                    => p_attribute5
406   ,p_attribute6                    => p_attribute6
407   ,p_attribute7                    => p_attribute7
408   ,p_attribute8                    => p_attribute8
409   ,p_attribute9                    => p_attribute9
410   ,p_attribute10                   => p_attribute10
411   ,p_attribute11                   => p_attribute11
412   ,p_attribute12                   => p_attribute12
413   ,p_attribute13                   => p_attribute13
414   ,p_attribute14                   => p_attribute14
415   ,p_attribute15                   => p_attribute15
416   ,p_attribute16                   => p_attribute16
417   ,p_attribute17                   => p_attribute17
418   ,p_attribute18                   => p_attribute18
419   ,p_attribute19                   => p_attribute19
420   ,p_attribute20                   => p_attribute20
421   ,p_territory_code                => 'SG'
422   ,p_segment1                      => p_bank_account_number
423   ,p_segment2                      => p_bank_account_name
424   ,p_segment3                      => p_bank_account_type
425   ,p_segment4                      => p_bank_code
426   ,p_segment5                      => p_bank_name
427   ,p_segment6                      => p_branch_code
428   ,p_segment7                      => p_branch_name
429   ,p_payee_type                    => p_payee_type
430   ,p_payee_id                      => p_payee_id
431   ,p_comment_id                    => p_comment_id
432   ,p_external_account_id           => p_external_account_id
433   ,p_effective_start_date          => p_effective_start_date
434   ,p_effective_end_date            => p_effective_end_date
435   );
436   --
437   hr_utility.set_location(' Leaving:'||l_proc, 7);
438 END update_sg_personal_pay_method;
439 
440 END hr_sg_personal_pay_method_api;