1 Package pay_ppm_bus as
2 /* $Header: pyppmrhi.pkh 120.0 2005/05/29 07:42:59 appldev noship $ */
3 --
4 -- ---------------------------------------------------------------------------
5 -- |---------------------< chk_external_account_id >------------------------|
6 -- ---------------------------------------------------------------------------
7 --
8 -- Description:
9 -- Checks that external account id is valid
10 --
11 -- Pre-conditions:
12 -- None
13 --
14 -- In Arguments:
15 -- p_personal_payment_method_id
16 -- p_org_payment_method_id
17 -- p_external_account_id
18 -- p_effective_date
19 -- p_object_version_number
20 --
21 -- Post Success:
22 -- Processing continues
23 --
24 -- Post Failure:
25 -- If any of the following cases are true then
26 -- an application error will be raised and processing is terminated
27 --
28 -- a) If related payment type is magnetic tape and external account id is
29 -- null
30 --
31 -- Access Status:
32 -- Internal Development Use Only.
33 --
34 procedure chk_external_account_id
35 (p_personal_payment_method_id in
36 pay_personal_payment_methods_f.personal_payment_method_id%TYPE
37 ,p_org_payment_method_id in
38 pay_personal_payment_methods_f.org_payment_method_id%TYPE
39 ,p_external_account_id in number
40 ,p_effective_date in date
41 ,p_object_version_number in
42 pay_personal_payment_methods_f.object_version_number%TYPE
43 );
44 -- ----------------------------------------------------------------------------
45 -- |----------------------< check_non_updateable_args >-----------------------|
46 -- ----------------------------------------------------------------------------
47 -- {Start Of Comments}
48 --
49 -- Description:
50 -- This procedure is used to ensure that non updatetable attributes have
51 -- not been updated. If an attribute has been updated an error is generated.
52 --
53 -- Pre Conditions:
54 -- g_old_rec has been populated with details of the values currently in
55 -- the database.
56 --
57 -- In Arguments:
58 -- p_rec has been populated with the updated values the user would like the
59 -- record set to.
60 --
61 -- Post Success:
62 -- Processing continues if all the non updateable attributes have not
63 -- changed.
64 --
65 -- Post Failure:
66 -- An application error is raised if any of the non updatable attributes
67 -- (business_group_id, personal_payment_method_id, assignment_id or
68 -- org_payment_method_id)
69 -- have been altered.
70 --
71 -- {End Of Comments}
72 Procedure check_non_updateable_args(p_rec in pay_ppm_shd.g_rec_type
73 ,p_effective_date in date);
74 -- ---------------------------------------------------------------------------
75 -- |---------------------------< chk_priority >----------------------------|
76 -- ---------------------------------------------------------------------------
77 --
78 -- Description:
79 -- Checks that a priority is valid.
80 --
81 -- Pre-conditions:
82 -- Must be an integer
83 --
84 -- In Arguments:
85 -- p_priority
86 -- p_personal_payment_method_id
87 -- p_org_payment_method_id
88 -- p_assignment_id
89 -- p_effective_date
90 -- p_object_version_number
91 --
92 -- Post Success:
93 -- Processing continues
94 --
95 -- Post Failure:
96 -- If the priority is not valid ie:
97 -- a) it is null or
98 -- b) If the balance type related to the person's Personal Payment Method
99 -- is Remunerative and
100 -- PRIORITY is not an integer between 1 and 99 or
101 -- c) If the balance type related to the person's Personal Payment Method
102 -- is Non_Remunerative and
103 -- PRIORITY is not 1 or
104 -- d) If the balance type related to the person's Personal Payment Method
105 -- is Remunerative and
106 -- PRIORITY is not unique between VALIDATION_START_DATE and
107 -- VALIDATION_END_DATE
108 -- then an application error will be raised and processing is terminated
109 --
110 -- Access Status:
111 -- Internal Development Use Only.
112 --
113 procedure chk_priority
114 (p_priority in
115 pay_personal_payment_methods_f.priority%TYPE
116 ,p_personal_payment_method_id in
117 pay_personal_payment_methods_f.personal_payment_method_id%TYPE
118 ,p_org_payment_method_id in
119 pay_personal_payment_methods_f.org_payment_method_id%TYPE
120 ,p_assignment_id in
121 pay_personal_payment_methods_f.assignment_id%TYPE
122 ,p_run_type_id in
123 pay_personal_payment_methods_f.run_type_id%TYPE
124 ,p_effective_date in date
125 ,p_object_version_number in
126 pay_personal_payment_methods_f.object_version_number%TYPE
127 ,p_validation_start_date in date
128 ,p_validation_end_date in date
129 );
130 -- ---------------------------------------------------------------------------
131 -- |---------------------< chk_amount_percent >----------------------------|
132 -- ---------------------------------------------------------------------------
133 --
134 -- Description:
135 -- Checks that amount and percentage are valid.
136 --
137 -- Pre-conditions:
138 -- None
139 --
140 -- In Arguments:
141 -- p_amount
142 -- p_percentage
143 -- p_personal_payment_method_id
144 -- p_org_payment_method_id
145 -- p_effective_date
146 -- p_object_version_number
147 --
148 -- Post Success:
149 -- Processing continues
150 --
151 -- Post Failure:
152 -- If any of the following cases are true then
153 -- an application error will be raised and processing is terminated
154 --
155 -- a) the balance type related to the persons personal payment method is
156 -- non-remunerative and the amount is not null
157 --
158 -- b) the balance type related to the persons personal payment method is
159 -- non-remunerative and the percentage is not 100
160 --
161 -- c) the percentage is not null and the amount is not null
162 --
163 -- d) the percentage is null and the amount is null
164 --
165 -- e) the amount is less than 0
166 --
167 -- f) the percentage is not between 0 and 100
168 --
169 -- Access Status:
170 -- Internal Development Use Only.
171 --
172 procedure chk_amount_percent
173 (p_amount in
174 pay_personal_payment_methods_f.amount%TYPE
175 ,p_percentage in
176 pay_personal_payment_methods_f.percentage%TYPE
177 ,p_personal_payment_method_id in
178 pay_personal_payment_methods_f.personal_payment_method_id%TYPE
179 ,p_org_payment_method_id in
180 pay_personal_payment_methods_f.org_payment_method_id%TYPE
181 ,p_effective_date in date
182 ,p_object_version_number in
183 pay_personal_payment_methods_f.object_version_number%TYPE
184 );
185 -- ---------------------------------------------------------------------------
186 -- |-------------------< chk_org_payment_method_id >-----------------------|
187 -- ---------------------------------------------------------------------------
188 --
189 -- Description:
190 -- Checks the validity of the org_payment_method_id entered by carrying
191 -- out the following:
192 -- - check that the organisation payment method is valid for the
193 -- related payment type
194 -- Note this is an insert only procedure.
195 --
196 -- Pre-conditions:
197 -- None
198 --
199 -- In Arguments:
200 -- p_business_group_id
201 -- p_personal_payment_method_id
202 -- p_org_payment_method_id
203 -- p_assignment_id
204 -- p_effective_date
205 -- p_object_version_number
206 --
207 -- Post Success:
208 -- If the org_payment_method_id is valid then
209 -- processing continues
210 --
211 -- Post Failure:
212 -- If any of the following cases are true then
213 -- an application error will be raised and processing is terminated
214 --
215 -- a) the organization payment method is not valid for the related payment
216 -- type where the territory code matches the legislation of the business
217 -- group or where no territory code is specified (currently just
218 -- Cash) then
219 --
220 -- Access Status:
221 -- Internal Development Use Only.
222 --
223 procedure chk_org_payment_method_id
224 (p_business_group_id in number
225 ,p_org_payment_method_id in number
226 ,p_effective_date in date
227 );
228 -- ---------------------------------------------------------------------------
229 -- |----------------------< chk_defined_balance_id >-----------------------|
230 -- ---------------------------------------------------------------------------
231 --
232 -- Description:
233 -- This procedure checks that, if the personal payment method is a
234 -- garnishment, then both payee id and payee type have been entered.
235 -- Conversely, if the personal payment method is not a garnishment, the
236 -- procedure ensures that both payee id and payee type are null.
237 --
238 -- Pre-conditions:
239 -- None
240 --
241 -- In Arguments:
242 -- p_org_payment_method_id
243 -- p_effective_date
244 -- p_object_version_number
245 -- p_payee_type
246 -- p_payee_id
247 --
248 -- Post Success:
249 -- If the personal payment method is a garnishment and both payee id and
250 -- payee type are not null, then processing continues.
251 -- If the personal payment method is not a garnishment and both payee id
252 -- and payee type are null, then processing continues.
253 --
254 -- Post Failure:
255 -- If any of the following cases are true then an application error will
256 -- be raised and processing terminated:
257 --
258 -- a) The personal payment method is a garnishment and either payee id
259 -- or payee type is null.
260 --
261 -- b) The personal payment method is not a garnishment and either payee
262 -- id or payee type is not null.
263 --
264 -- Access Status:
265 -- Internal Development Use Only.
266 --
267 -- ---------------------------------------------------------------------------
268 procedure chk_defined_balance_id
269 (p_business_group_id in number
270 ,p_assignment_id in number
271 ,p_personal_payment_method_id in number
272 ,p_org_payment_method_id in number
273 ,p_effective_date in date
274 ,p_object_version_number in number
275 ,p_payee_type in varchar2
276 ,p_payee_id in number
277 );
278 -- ---------------------------------------------------------------------------
279 -- |-----------------< return_effective_end_date >--------------------------|
280 -- ---------------------------------------------------------------------------
281 -- {Start Of Comments}
282 --
283 -- Description:
284 -- Sets the value of the proposed new effective_end_date
285 -- depending on the existence of future rows in
286 -- pay_personal_payment_methods_f which have the same priority
287 --
288 -- Pre-conditions:
289 -- None
290 --
291 -- In Arguments:
292 --
293 -- Post Success:
294 --
295 -- If any rows exist on pay_personal_payment_methods_f in the future
296 -- that have the same priority, for the same assignment, as p_priority then
297 --
298 -- a) If the earliest future effective start date -1 is less than
299 -- p_validation_end_date then
300 -- p_validation_end_date must be reset to the earliest
301 -- future effective start date - 1
302 --
303 -- b) The earliest future effective start date -1 is not less than
304 -- p_validation_end_date then
305 -- p_validation_end_date remains the same
306 --
307 -- If no future rows exist on pay_personal_payment_methods_f in the future
308 -- that have the same priority as p_priority then
309 -- p_validation_end_date remains the same
310 --
311 -- Post Failure:
312 --
313 -- Access Status:
314 -- Internal Development Use Only.
315 -- {End Of Comments}
316 -- ----------------------------------------------------------------------------
317 function return_effective_end_date
318 (p_datetrack_mode in varchar2,
319 p_effective_date in date,
320 p_personal_payment_method_id in number,
321 p_org_payment_method_id in number,
322 p_assignment_id in number,
323 p_run_type_id in number default null,
324 p_priority in number,
325 p_business_group_id in number,
326 p_payee_id in number default null,
327 p_payee_type in varchar2 default null,
328 p_validation_start_date in date,
329 p_validation_end_date in date)
330 return date;
331 --
332 -- ----------------------------------------------------------------------------
333 -- |---------------------------< insert_validate >----------------------------|
334 -- ----------------------------------------------------------------------------
335 -- {Start Of Comments}
336 --
337 -- Description:
338 -- This procedure controls the execution of all insert business rules
339 -- validation.
340 --
341 -- Pre Conditions:
342 -- This private procedure is called from ins procedure.
343 --
344 -- In Arguments:
345 -- A Pl/Sql record structre.
346 --
347 -- Post Success:
348 -- Processing continues.
349 --
350 -- Post Failure:
351 -- If a business rules fails the error will not be handled by this procedure
352 -- unless explicity coded.
353 --
354 -- Developer Implementation Notes:
355 -- For insert, your business rules should be coded within this procedure and
356 -- should ideally (unless really necessary) just be straight procedure or
357 -- function calls. Try and avoid using conditional branching logic.
358 --
359 -- Access Status:
360 -- Internal Table Handler Use Only.
361 --
362 -- {End Of Comments}
363 -- ----------------------------------------------------------------------------
364 Procedure insert_validate
365 (p_rec in pay_ppm_shd.g_rec_type,
366 p_effective_date in date,
367 p_datetrack_mode in varchar2,
368 p_validation_start_date in date,
369 p_validation_end_date in date);
370 --
371 -- ----------------------------------------------------------------------------
372 -- |---------------------------< update_validate >----------------------------|
373 -- ----------------------------------------------------------------------------
374 -- {Start Of Comments}
375 --
376 -- Description:
377 -- This procedure controls the execution of all update business rules
378 -- validation.
379 --
380 -- Pre Conditions:
381 -- This private procedure is called from upd procedure.
382 --
383 -- In Arguments:
384 -- A Pl/Sql record structre.
385 --
389 -- Post Failure:
386 -- Post Success:
387 -- Processing continues.
388 --
390 -- If a business rules fails the error will not be handled by this procedure
391 -- unless explicity coded.
392 --
393 -- Developer Implementation Notes:
394 -- For update, your business rules should be coded within this procedure and
395 -- should ideally (unless really necessary) just be straight procedure or
396 -- function calls. Try and avoid using conditional branching logic.
397 --
398 -- Access Status:
399 -- Internal Table Handler Use Only.
400 --
401 -- {End Of Comments}
402 -- ----------------------------------------------------------------------------
403 Procedure update_validate
404 (p_rec in pay_ppm_shd.g_rec_type,
405 p_effective_date in date,
406 p_datetrack_mode in varchar2,
407 p_validation_start_date in date,
408 p_validation_end_date in date);
409 --
410 -- ----------------------------------------------------------------------------
411 -- |---------------------------< delete_validate >----------------------------|
412 -- ----------------------------------------------------------------------------
413 -- {Start Of Comments}
414 --
415 -- Description:
416 -- This procedure controls the execution of all delete business rules
417 -- validation.
418 --
419 -- Pre Conditions:
420 -- This private procedure is called from del procedure.
421 --
422 -- In Arguments:
423 -- A Pl/Sql record structre.
424 --
425 -- Post Success:
426 -- Processing continues.
427 --
428 -- Post Failure:
429 -- If a business rules fails the error will not be handled by this procedure
430 -- unless explicity coded.
431 --
432 -- Developer Implementation Notes:
433 -- For delete, your business rules should be coded within this procedure and
434 -- should ideally (unless really necessary) just be straight procedure or
435 -- function calls. Try and avoid using conditional branching logic.
436 --
437 -- Access Status:
438 -- Internal Table Handler Use Only.
439 --
440 -- {End Of Comments}
441 -- ----------------------------------------------------------------------------
442 Procedure delete_validate
443 (p_rec in pay_ppm_shd.g_rec_type,
444 p_effective_date in date,
445 p_datetrack_mode in varchar2,
446 p_validation_start_date in date,
447 p_validation_end_date in date);
448 --
449 --
450 -- ---------------------------------------------------------------------------
451 -- |---------------------< return_legislation_code >-------------------------|
452 -- ---------------------------------------------------------------------------
453 --
454 -- Description:
455 -- Return the legislation code for a specific personal payment
456 --
457 -- Prerequisites:
458 -- The personal payment identified by p_personal_payment_method_id already exists.
459 --
460 -- In Arguments:
461 -- p_personal_payment_method_id
462 --
463 -- Post Success:
464 -- If the personal payment is found this function will return the personal payment's business
465 -- group legislation code.
466 --
467 -- Post Failure:
468 -- An error is raised if the personal payment does not exist.
469 --
470 -- Access Status:
471 -- Internal Development Use Only.
472 --
473 function return_legislation_code
474 (p_personal_payment_method_id in number
475 ) return varchar2;
476 --
477 -- ----------------------------------------------------------------------------
478 -- |-----------------------------< chk_ddf >----------------------------------|
479 -- ----------------------------------------------------------------------------
480 --
481 -- Description:
482 -- Validates all the Developer Descriptive Flexfield values.
483 --
484 -- Prerequisites:
485 -- All other columns have been validated. Must be called as the
486 -- second last step from insert_validate and update_validate.
487 --
488 -- In Arguments:
489 -- p_rec
490 --
491 -- Post Success:
492 -- If the Developer Descriptive Flexfield structure column and data values
493 -- are all valid this procedure will end normally and processing will
494 -- continue.
495 --
496 -- Post Failure:
497 -- If the Developer Descriptive Flexfield structure column value or any of
498 -- the data values are invalid then an application error is raised as
499 -- a PL/SQL exception.
500 --
501 -- Access Status:
502 -- Internal Row Handler Use Only.
503 --
504 -- ----------------------------------------------------------------------------
505 procedure chk_ddf
506 (p_rec in pay_ppm_shd.g_rec_type
507 );
508 --
509 -- -----------------------------------------------------------------------
510 -- |------------------------------< chk_df >-----------------------------|
511 -- -----------------------------------------------------------------------
512 --
513 -- Description:
514 -- Validates the all Descriptive Flexfield values.
515 --
516 -- Pre-conditions:
517 -- All other columns have been validated. Must be called as the
518 -- last step from insert_validate and update_validate.
519 --
520 -- In Arguments:
521 -- p_rec
522 --
523 -- Post Success:
524 -- If the Descriptive Flexfield structure column and data values are
528 -- Post Failure:
525 -- all valid this procedure will end normally and processing will
526 -- continue.
527 --
529 -- If the Descriptive Flexfield structure column value or any of
530 -- the data values are invalid then an application error is raised as
531 -- a PL/SQL exception.
532 --
533 -- Access Status:
534 -- Internal Development Use Only.
535 --
536 -- ---------------------------------------------------------------------------
537 procedure chk_df
538 (p_rec in pay_ppm_shd.g_rec_type
539 );
540 --
541 end pay_ppm_bus;