DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_AU_PERSONAL_PAY_METHOD_API

Source


1 PACKAGE BODY hr_au_personal_pay_method_api AS
2 /* $Header: hrauwrpm.pkb 120.0.12000000.2 2007/08/07 11:53:08 vamittal ship $ */
3 /*
4  +==========================================================================================
5  |              Copyright (c) 1999 Oracle Corporation Ltd
6  |                           All rights reserved.
7  +==========================================================================================
8  |SQL Script File Name : HR AU WR PM . PKB
9  |                Name : hr_au_personal_pay_method_api
10  |         Description : PErsonal Pay method API Wrapper for AU
11  |
12  |   Name           Date         Version Bug     Text
13  |   -------------- ----------   ------- -----   ----
14  |   sgoggin        11-JUN-1999  110.0           Created for AU
15  |   atopol         01-OCT-1999  115.0           Upgraded - No change
16  |   sclarke        18-APR-2000  115.1   1272358 Changed mapping of segments
17      apunekar       30-APR-2001  115.2   1723534 Removed the DEFAULT null criteria for p_amount,p_percentage                                                 and p_priority parameters.
18      apunekar       1-MAY-2001   115.3   1723534 p_amount,p_percentage made DEFAULT null.
19  |   apunekar       02-DEC-2002  115.4   2689173 Added Nocopy to out and in out parameters
20  |   vamittal       06-Aug-2007  115.5   6315194 Added parameter p_segment4 for Validating account Number
21 
22  |NOTES
23  +==========================================================================================
24 */
25 
26 
27 --
28 g_package  VARCHAR2(33) := 'hr_au_personal_pay_method_api.';
29 --
30 -- ----------------------------------------------------------------------------
31 -- |-------------------------< check_au_insert_legislation >------------------|
32 -- ----------------------------------------------------------------------------
33 --
34 -- {Start Of Comments}
35 --
36 -- Description:
37 --   This private procedure ensures that the legislation rule for the
38 --   for the personal payment method being inserted is the
39 --   of the required business process.
40 --
41 -- Prerequisites:
42 --   None.
43 --
44 -- In Parameters:
45 --   Name                           Reqd Type     Description
46 --   p_personal_payment_method_id   Yes  number   Id of personal payment
47 --                                                method being deleted.
48 --   p_effective_date               Yes  date     The session date.
49 --
50 -- Post Success:
51 --   The procedure returns control back to the calling process.
52 --
53 -- Post Failure:
54 --   The process raises an error and stops execution.
55 --
56 -- Access Status:
57 --   Private.
58 --
59 -- {End Of Comments}
60 --
61 PROCEDURE check_au_insert_legislation
62   (p_assignment_id          IN     NUMBER
63   ,p_effective_date         IN OUT NOCOPY DATE
64   ) IS
65   --
66   -- Declare cursors and local variables
67   --
68   l_proc                VARCHAR2(72) := g_package||'check_au_insert_egislation';
69   l_valid               VARCHAR2(150);
70   l_effective_date      DATE;
71   c_leg_code            CONSTANT VARCHAR2(2) := 'AU';
72   --
73   CURSOR legsel IS
74     SELECT  pbg.legislation_code
75     FROM    per_business_groups pbg,
76             per_assignments_f   asg
77     WHERE   pbg.business_group_id   = asg.business_group_id
78     AND     asg.assignment_id       = p_assignment_id
79     AND     p_effective_date BETWEEN asg.effective_start_date AND asg.effective_end_date;
80   --
81 BEGIN
82   hr_utility.set_location('Entering:'|| l_proc, 5);
83   --
84   -- Check that p_assignment_id and p_effective_date are not null as they
85   -- are used by the cursor to validate the business group.
86   --
87   hr_api.mandatory_arg_error
88     (p_api_name       => l_proc,
89      p_argument       => 'assignment_id',
90      p_argument_value => p_assignment_id);
91   --
92   hr_api.mandatory_arg_error
93     (p_api_name       => l_proc,
94      p_argument       => 'effective_date',
95      p_argument_value => p_effective_date);
96   --
97   hr_utility.set_location(l_proc, 6);
98   --
99   -- Ensure that the legislation rule for the employee assignment
100   -- business group is that of au.
101   --
102   OPEN  legsel;
103   FETCH legsel
104   INTO  l_valid;
105   --
106   IF legsel%notfound THEN
107     CLOSE legsel;
108     hr_utility.set_message(801, 'HR_7348_ASSIGNMENT_INVALID');
109     hr_utility.raise_error;
110   END IF;
111   IF legsel%found AND l_valid <> c_leg_code THEN
112     CLOSE legsel;
113     hr_utility.set_message(801, 'HR_7898_PPM_BUS_GRP_INVALID');
114     hr_utility.raise_error;
115   END IF;
116   --
117   CLOSE legsel;
118   hr_utility.set_location(l_proc, 7);
119   --
120   -- Assign out parameter after truncating the date by using a local
121   -- variable.
122   --
123   l_effective_date := TRUNC(p_effective_date);
124   p_effective_date := l_effective_date;
125   --
126   hr_utility.set_location('Leaving:'|| l_proc, 8);
127   --
128 END check_au_insert_legislation;
129 
130 -- ----------------------------------------------------------------------------
131 -- |-------------------------< check_au_update_legislation >------------------|
132 -- ----------------------------------------------------------------------------
133 --
134 -- {Start Of Comments}
135 --
136 -- Description:
137 --   This private procedure ensures that the legislation rule for the
138 --   for the personal payment method being updated or deleted is the
139 --   of the required business process.
140 --
141 -- Prerequisites:
142 --   None.
143 --
144 -- In Parameters:
145 --   Name                           Reqd Type       Description
146 --   p_personal_payment_method_id   Yes  number     Id of personal payment
147 --                                                  method being deleted.
148 --   p_effective_date               Yes  date       The session date.
149 --
150 -- Post Success:
151 --   The procedure returns control back to the calling process.
152 --
153 -- Post Failure:
154 --   The process raises an error and stops execution.
155 --
156 -- Access Status:
157 --   Private.
158 --
159 -- {End Of Comments}
160 --
161 PROCEDURE check_au_update_legislation
162   ( p_personal_payment_method_id    IN  pay_personal_payment_methods_f.personal_payment_method_id%type
163     ,p_effective_date               IN  DATE
164   ) IS
165   --
166   -- Declare cursors and local variables
167   --
168   l_proc                VARCHAR2(72) := g_package||'check_au_update_legislation';
169   l_valid               VARCHAR2(150);
170   c_leg_code            CONSTANT VARCHAR2(2) := 'AU';
171   --
172   CURSOR legsel IS
173     SELECT  pbg.legislation_code
174     FROM    per_business_groups pbg,
175             pay_personal_payment_methods_f ppm
176     WHERE   pbg.business_group_id           = ppm.business_group_id
177     AND     ppm.personal_payment_method_id  = p_personal_payment_method_id
178     AND     p_effective_date BETWEEN ppm.effective_start_date AND ppm.effective_end_date;
179 --
180 BEGIN
181   --
182   -- Ensure that the legislation rule for the employee assignment business
183   -- group is that of au.
184   --
185   hr_utility.set_location('Entering:'|| l_proc, 10);
186   OPEN  legsel;
187   FETCH legsel
188   INTO  l_valid;
189   --
190   IF legsel%notfound THEN
191     CLOSE legsel;
192     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
193     hr_utility.raise_error;
194   END IF;
195   IF legsel%found AND l_valid <> c_leg_code THEN
196     hr_utility.set_message(801, 'HR_7898_PPM_BUS_GRP_INVALID');
197     hr_utility.raise_error;
198   END IF;
199   --
200   CLOSE legsel;
201   hr_utility.set_location('Leaving:'|| l_proc, 20);
202   --
203 END check_au_update_legislation;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |--------------------< create_au_personal_pay_method >---------------------|
207 -- ----------------------------------------------------------------------------
208 --
209 PROCEDURE create_au_personal_pay_method
210   (p_validate                      IN     BOOLEAN  DEFAULT FALSE
211   ,p_effective_date                IN     DATE
212   ,p_assignment_id                 IN     NUMBER
213   ,p_org_payment_method_id         IN     NUMBER
214   ,p_bank_bsb_code                 IN     VARCHAR2
215   ,p_bank_account_number           IN     VARCHAR2
216   ,p_bank_account_name             IN     VARCHAR2
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_au_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_au_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                => 'AU'
303   ,p_segment1                      => p_bank_bsb_code
304   ,p_segment2                      => p_bank_account_number
305   ,p_segment3                      => p_bank_account_name
306   ,p_segment4                      => 'TRUE'  -- 6315194
307   ,p_payee_type                    => p_payee_type
308   ,p_payee_id                      => p_payee_id
309   ,p_personal_payment_method_id    => p_personal_payment_method_id
310   ,p_external_account_id           => p_external_account_id
311   ,p_object_version_number         => p_object_version_number
312   ,p_effective_start_date          => p_effective_start_date
313   ,p_effective_end_date            => p_effective_end_date
314   ,p_comment_id                    => p_comment_id
315   );
316   --
317   hr_utility.set_location(' Leaving:'||l_proc, 8);
318 END create_au_personal_pay_method;
319 -- ----------------------------------------------------------------------------
320 -- |--------------------< update_au_personal_pay_method >---------------------|
321 -- ----------------------------------------------------------------------------
322 --
323 PROCEDURE update_au_personal_pay_method
324   (p_validate                      IN     BOOLEAN  DEFAULT FALSE
325   ,p_effective_date                IN     DATE
326   ,p_datetrack_update_mode         IN     VARCHAR2
327   ,p_personal_payment_method_id    IN     NUMBER
328   ,p_object_version_number         IN OUT NOCOPY NUMBER
329   ,p_bank_bsb_code                 IN     VARCHAR2 DEFAULT hr_api.g_varchar2
330   ,p_bank_account_number           IN     VARCHAR2 DEFAULT hr_api.g_varchar2
331   ,p_bank_account_name             IN     VARCHAR2 DEFAULT hr_api.g_varchar2
332   ,p_amount                        IN     NUMBER   DEFAULT hr_api.g_number
333   ,p_comments                      IN     VARCHAR2 DEFAULT hr_api.g_varchar2
334   ,p_percentage                    IN     NUMBER   DEFAULT hr_api.g_number
335   ,p_priority                      IN     NUMBER   DEFAULT hr_api.g_number
336   ,p_attribute_category            IN     VARCHAR2 DEFAULT hr_api.g_varchar2
337   ,p_attribute1                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
338   ,p_attribute2                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
339   ,p_attribute3                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
340   ,p_attribute4                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
341   ,p_attribute5                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
342   ,p_attribute6                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
343   ,p_attribute7                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
344   ,p_attribute8                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
345   ,p_attribute9                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
346   ,p_attribute10                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
347   ,p_attribute11                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
348   ,p_attribute12                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
349   ,p_attribute13                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
350   ,p_attribute14                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
351   ,p_attribute15                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
352   ,p_attribute16                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
353   ,p_attribute17                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
354   ,p_attribute18                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
355   ,p_attribute19                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
356   ,p_attribute20                   IN     VARCHAR2 DEFAULT hr_api.g_varchar2
357   ,p_payee_type                    IN     VARCHAR2 DEFAULT hr_api.g_varchar2
358   ,p_payee_id                      IN     NUMBER   DEFAULT hr_api.g_number
359   ,p_comment_id                    OUT    NOCOPY NUMBER
360   ,p_external_account_id           OUT    NOCOPY NUMBER
361   ,p_effective_start_date          OUT    NOCOPY DATE
362   ,p_effective_end_date            OUT    NOCOPY DATE
363   ) is
364   --
365   -- Declare cursors and local variables
366   --
367   l_proc                VARCHAR2(72) :=  g_package||'update_au_personal_pay_method';
368   --
369 BEGIN
370   hr_utility.set_location('Entering:'|| l_proc, 5);
371   --
372   -- Ensure that the legislation rule for the employee assignment business
373   -- group is 'AU'.
374   --
375   check_au_update_legislation
376   (p_personal_payment_method_id => p_personal_payment_method_id
377   ,p_effective_date             => p_effective_date);
378   --
379   hr_utility.set_location(l_proc, 6);
380   --
381   -- Call the business process to update the personal payment method
382   --
383 hr_personal_pay_method_api.update_personal_pay_method
384   (p_validate                      => p_validate
385   ,p_effective_date                => trunc(p_effective_date)
386   ,p_datetrack_update_mode         => p_datetrack_update_mode
387   ,p_personal_payment_method_id    => p_personal_payment_method_id
388   ,p_object_version_number         => p_object_version_number
389   ,p_amount                        => p_amount
390   ,p_comments                      => p_comments
391   ,p_percentage                    => p_percentage
392   ,p_priority                      => p_priority
393   ,p_attribute_category            => p_attribute_category
394   ,p_attribute1                    => p_attribute1
395   ,p_attribute2                    => p_attribute2
396   ,p_attribute3                    => p_attribute3
397   ,p_attribute4                    => p_attribute4
398   ,p_attribute5                    => p_attribute5
399   ,p_attribute6                    => p_attribute6
400   ,p_attribute7                    => p_attribute7
401   ,p_attribute8                    => p_attribute8
402   ,p_attribute9                    => p_attribute9
403   ,p_attribute10                   => p_attribute10
404   ,p_attribute11                   => p_attribute11
405   ,p_attribute12                   => p_attribute12
406   ,p_attribute13                   => p_attribute13
407   ,p_attribute14                   => p_attribute14
408   ,p_attribute15                   => p_attribute15
409   ,p_attribute16                   => p_attribute16
410   ,p_attribute17                   => p_attribute17
411   ,p_attribute18                   => p_attribute18
412   ,p_attribute19                   => p_attribute19
413   ,p_attribute20                   => p_attribute20
414   ,p_territory_code                => 'AU'
415   ,p_segment1                      => p_bank_bsb_code
416   ,p_segment2                      => p_bank_account_number
417   ,p_segment3                      => p_bank_account_name
418   ,p_segment4                      => 'TRUE'  -- 6315194
419   ,p_payee_type                    => p_payee_type
420   ,p_payee_id                      => p_payee_id
421   ,p_comment_id                    => p_comment_id
422   ,p_external_account_id           => p_external_account_id
423   ,p_effective_start_date          => p_effective_start_date
424   ,p_effective_end_date            => p_effective_end_date
425   );
426   --
427   hr_utility.set_location(' Leaving:'||l_proc, 7);
428 END update_au_personal_pay_method;
429 
430 END hr_au_personal_pay_method_api;