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