DBA Data[Home] [Help]

PACKAGE: APPS.PAY_QPQ_API

Source


1 Package pay_qpq_api AUTHID CURRENT_USER as
2 /* $Header: pyqpqrhi.pkh 115.11 2004/03/09 06:28:28 swinton ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                    Global Record Type Specification                      |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9   (payroll_action_id          number(9)
10   ,business_group_id          number(15)
11   ,consolidation_set_id       number(9)
12   ,action_status              varchar2(9)    -- Increased from length 1 to 9
13   ,effective_date             date
14   ,comments                   varchar2(2000)
15   ,current_task               varchar2(30)
16   ,legislative_parameters     varchar2(240)
17   ,run_type_id                number(9)
18   ,date_earned                date
19   ,pay_advice_date            date
20   ,pay_advice_message         varchar2(240)
21   ,object_version_number      number(9)
22   );
23 --
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< use_qpay_excl_model >------------------------|
27 -- ----------------------------------------------------------------------------
28 -- {Start Of Comments}
29 --
30 -- Description:
31 --   Determines whether the new QuickPay Exclusions model is available for
32 --   use.
33 --
34 -- Pre Conditions:
35 --   None.
36 --
37 -- In Arguments:
38 --   None.
39 --
40 -- Post Success:
41 --   The function returns 'Y' if the new QuickPay Exclusions model is
42 --   available for use, and 'N' if the obsolete QuickPay Inclusions model is
43 --   still being used.
44 --
45 -- Post Failure:
46 --   An exception will be raised if the QuickPay upgrade is currently being
47 --   processed.
48 --
49 -- Access Status:
50 --   Public.
51 --
52 -- {End Of Comments}
53 --
54 function use_qpay_excl_model return varchar2;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |--------------------------< chk_asg_on_payroll >--------------------------|
58 -- ----------------------------------------------------------------------------
59 -- {Start Of Comments}
60 --
61 -- Description:
62 --   Validates that the assignment is on a payroll as of the current effective
63 --   date. Used to validate navigation to the QuickPay Form in a Taskflow.
64 --
65 -- Pre Conditions:
66 --   A row has been inserted into fnd_sessions for the current database
67 --   session. p_assignment_id is known to exist in the HR schema.
68 --
69 -- In Arguments:
70 --   p_assignment_id is set to the id of the current assignment. This is a
71 --   mandatory argument.
72 --
73 -- Post Success:
74 --   End normally if the assignment is on a payroll as of the current effective
75 --   date.
76 --
77 -- Post Failure:
78 --   An application error is raised if the assignment does not have a payroll
79 --   component as of the current effective date.
80 --
81 -- Access Status:
82 --   Public.
83 --
84 -- {End Of Comments}
85 --
86 procedure chk_asg_on_payroll
87   (p_assignment_id  in pay_assignment_actions.assignment_id%TYPE
88   );
89 --
90 -- ----------------------------------------------------------------------------
91 -- |---------------------------< chk_new_eff_date >---------------------------|
92 -- ----------------------------------------------------------------------------
93 -- {Start Of Comments}
94 --
95 -- Description:
96 --   Validates that the assignment is on a payroll as of the proposed new
97 --   effective date. Used to validate the new session effective date when the
98 --   user has called the Alter Effective Date Form from the QuickPay Form.
99 --
100 -- Pre Conditions:
101 --   p_assignment_id is known to exist in the HR schema.
102 --
103 -- In Arguments:
104 --   p_assignment_id is set to the id of the current assignment. This is a
105 --   mandatory argument.
106 --   p_new_date is the proposed new effective date.
107 --   (All the parameters are varchar2 because this procedure will be called
108 --   via the Forms4 Forms_ddl built_in.)
109 --
110 -- Post Success:
111 --   End normally if the assignment is on a payroll as of p_new_date.
112 --
113 -- Post Failure:
114 --   An application error is raised if the assignment does not exists as of
115 --   p_new_date, or does not have a payroll component as of p_new_date.
116 --
117 -- Access Status:
118 --   Public.
119 --
120 -- {End Of Comments}
121 --
122 procedure chk_new_eff_date
123   (p_assignment_id in varchar2
124   ,p_new_date      in varchar2
125   );
126 --
127 -- ----------------------------------------------------------------------------
128 -- |-----------------------------< chk_eff_date >-----------------------------|
129 -- ----------------------------------------------------------------------------
130 -- {Start Of Comments}
131 --
132 -- Description:
133 --   Validates the QuickPay Run Payroll Process effective_date. This is known
134 --   to the user as date paid. Checks the assignment has a payroll component
135 --   as of the QuickPay Run's effective_date and that a time period exists for
136 --   that payroll as of the same date.
137 --
138 -- Pre Conditions:
139 --   p_assignment_id is known to a valid assignment in the HR schema.
140 --
141 -- In Arguments:
142 --   p_effective_date the date paid for the QuickPay Run Payroll Process.
143 --   p_assignment_id the assignment to check.
144 --   p_legislation_code must be set to the assignment' business group
145 --   legislation.
146 --   p_recal_date_earned indicates if the default value for date_earned
147 --   should be re-calulated.
148 --
149 -- Post Success:
150 --   p_payroll_id is set to the assignment's payroll component as of
151 --   p_effective_date.
152 --   p_time_period_id and p_period_name are set from the corresponding
153 --   attributes of the time periods entity, for the period which exists as
154 --   of p_effective_date for the payroll p_payroll_id.
155 --   If p_effective_date is valid and p_recal_date_earned is true then
156 --   p_new_date_earned will be set to the recommended default value for
157 --   date earned. The exact value returned depends on the p_legislation_code.
158 --
159 -- Post Failure:
160 --   An application error message is raised if:
161 --      1) The assignment does not have a payroll component as of
162 --         p_effective_date.
163 --   or 2) There is no time period for the Assignment's payroll as of
164 --         p_effective_date.
165 --   If an error is raised the values of p_payroll_id, p_time_period_id and
166 --   p_period_name will be undefined because the end of the procedure will
167 --   not have been reached.
168 --
169 -- Access Status:
170 --   Public.
171 --
172 -- {End Of Comments}
173 --
174 procedure chk_eff_date
175   (p_effective_date    in     pay_payroll_actions.effective_date%TYPE
176   ,p_assignment_id     in     pay_assignment_actions.assignment_id%TYPE
177   ,p_legislation_code  in     per_business_groups.legislation_code%TYPE
178   ,p_recal_date_earned in     boolean
179   ,p_payroll_id           out nocopy pay_payroll_actions.payroll_id%TYPE
180   ,p_time_period_id       out nocopy pay_payroll_actions.time_period_id%TYPE
181   ,p_period_name          out nocopy per_time_periods.period_name%TYPE
182   ,p_new_date_earned      out nocopy pay_payroll_actions.date_earned%TYPE
183   );
184 --
185 -- ----------------------------------------------------------------------------
186 -- |----------------------------< chk_date_earned >---------------------------|
187 -- ----------------------------------------------------------------------------
188 -- {Start Of Comments}
189 --
190 -- Description:
191 --   Validates the date_earned for a QuickPay Run Payroll Process. Checks the
192 --   assignment has a payroll component as of date earned and that a time
193 --   period exists for that payroll as of date earned.
194 --
195 -- Pre Conditions:
196 --   p_assignment_id is known to a valid assignment in the HR schema.
197 --
198 -- In Arguments:
199 --   p_date_earned the date to check.
200 --   p_assignment_id is the assignment to check.
201 --   p_effective_date is mandatory when the legislation is 'GB'. When
202 --   validating p_date_earned for other legislations this procedure does not
203 --   use the p_effective_date value.
204 --
205 -- Post Success:
206 --   Ends normally if the assignment has payroll component as of date earned
207 --   and that a time period exists for that payroll as of date earned.
208 --
209 -- Post Failure:
210 --   An application error message is raised if:
211 --      1) The assignment does not have a payroll component as of
212 --         p_date_earned.
213 --   or 2) There is no time period for the Assignment's payroll as of
214 --         p_date_earned.
215 --   If an error is raised the values of p_payroll_id, p_time_period_id and
216 --   p_period_name will be undefined because the end of the procedure will
217 --   not have been reached.
218 --
219 -- Access Status:
220 --   Public.
221 --
222 -- {End Of Comments}
223 --
224 procedure chk_date_earned
225   (p_date_earned       in pay_payroll_actions.date_earned%TYPE
226   ,p_assignment_id     in pay_assignment_actions.assignment_id%TYPE
227   ,p_legislation_code  in per_business_groups.legislation_code%TYPE
228   ,p_effective_date    in pay_payroll_actions.effective_date%TYPE
229   );
230 --
231 -- ----------------------------------------------------------------------------
232 -- |-------------------------< chk_for_con_request >--------------------------|
233 -- ----------------------------------------------------------------------------
234 -- {Start Of Comments}
235 --
236 -- Description:
237 --   This procedure is used to check that an AOL request is not waiting to run
238 --   or still running on concurrent manager queue.
239 --
240 -- Pre Conditions:
241 --   None.
242 --
243 -- In Arguments:
244 --   p_payroll_action_id set to the id of an existing Payroll Process.
245 --
246 -- Post Success:
247 --   There is no concurrent request still waiting or running on the AOL
248 --   concurrent manager.
249 --
250 -- Post Failure:
251 --   An application error is raised if there is a request still waiting or
252 --   running on the AOL concurrent manager.
253 --
254 -- Access Status:
255 --   Public.
256 --
257 -- {End Of Comments}
258 --
259 procedure chk_for_con_request
260   (p_payroll_action_id in pay_payroll_actions.payroll_action_id%TYPE
261   );
262 --
263 -- ----------------------------------------------------------------------------
264 -- |------------------------< return_api_dml_status >-------------------------|
265 -- ----------------------------------------------------------------------------
266 -- {Start Of Comments}
267 --
268 -- Description:
269 --   This function will return the current g_api_dml private global
270 --   boolean status.
271 --   The g_api_dml status determines if at the time of the function
272 --   being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
273 --   is being issued from within an api.
274 --   If the status is TRUE then a dml statement is being issued from
275 --   within this entity api.
276 --   This function is primarily to support database triggers which
277 --   need to maintain the object_version_number for non-supported
278 --   dml statements (i.e. dml statement issued outside of the api layer).
279 --
280 -- Pre Conditions:
281 --   None.
282 --
283 -- In Arguments:
284 --   None.
285 --
286 -- Post Success:
287 --   Processing continues.
288 --   If the function returns a TRUE value then, dml is being executed from
289 --   within this api.
290 --
291 -- Post Failure:
292 --   None.
293 --
294 -- {End Of Comments}
295 --
296 function return_api_dml_status Return Boolean;
297 --
298 -- ----------------------------------------------------------------------------
299 -- |---------------------------------< lck >----------------------------------|
300 -- ----------------------------------------------------------------------------
301 -- {Start Of Comments}
302 --
303 -- Description:
304 --   The Lck process has two main functions to perform. Firstly, a row to be
305 --   updated or deleted must be locked. The locking of the row will only be
306 --   successful if the row is not currently locked by another user, the
307 --   specified object version numbers match and there is no AOL request
308 --   waiting or still running on the concurrent manager for this QuickPay Run.
309 --   Secondly, during the locking of the row, the row is selected into the
310 --   g_old_rec data structure which enables the current row values from the
311 --   server to be available to the api.
312 --
313 -- Pre Conditions:
314 --   None.
315 --
316 -- In Arguments:
317 --   All the arguments to the Lck process are mandatory.
318 --   p_payroll_action_id is set to the id of the QuickPay Pre-payment Payroll
319 --   Process.
320 --   p_p_object_version_number is set to the object_version_number for the
321 --   Payroll Process.
322 --   p_a_object_version_number is set to the object_version_number for the
323 --   Assignment Process.
324 --
325 -- Post Success:
326 --   The lock will only be successful if the Payroll Process is for a
327 --   QuickPay Run.
328 --   On successful completion of the Lck process the row to be updated or
329 --   deleted will be locked and selected into the global data structure
330 --   g_old_rec.
331 --
332 -- Post Failure:
333 --   The Lck process can fail for four reasons:
334 --   1) When attempting to lock the row the row could already be locked by
335 --      another user. This will raise the HR_7165_OBJECT_LOCKED error.
336 --   2) The row which is required to be locked doesn't exist in the HR Schema.
337 --      This error is trapped and reported using the message name
338 --      'HR_7155_OBJECT_INVALID'.
339 --   3) The row although existing in the HR Schema has a different object
340 --      version number than the object version number specified.
341 --      This error is trapped and reported using the message name
342 --      'HR_7155_OBJECT_INVALID'.
343 --   4) An error is raised if an AOL concurrent request is waiting to run or
344 --      still running on the concurrent manager for this QuickPay Run.
345 --
346 -- Access Status:
347 --   Public.
348 --
349 -- {End Of Comments}
350 --
351 procedure lck
352   (p_payroll_action_id        in pay_payroll_actions.payroll_action_id%TYPE
353   ,p_p_object_version_number  in pay_payroll_actions.object_version_number%TYPE
354   ,p_a_object_version_number  in
355                              pay_assignment_actions.object_version_number%TYPE
356   );
357 --
358 -- ----------------------------------------------------------------------------
359 -- |---------------------------------< ins >----------------------------------|
360 -- ----------------------------------------------------------------------------
361 -- {Start Of Comments}
362 --
363 -- Description:
364 --   This procedure is the record interface insert business process
365 --   for the QuickPay Run entity. The role of this process is to
366 --   insert fully validated rows, into the HR schema passing back to the
367 --   calling process, any system generated values (e.g. primary and object
368 --   version number attributes). The processing of this procedure is as
369 --   follows:
370 --   1) If the p_validate argument has been set to true then a savepoint is
371 --      issued.
372 --   2) The controlling validation process insert_validate is then executed
373 --      which will execute all private and public validation business rule
374 --      processes.
375 --   3) The pre_insert business process is then executed which enables any
376 --      logic to be processed before the insert dml process is executed.
377 --   4) The insert_dml process will physical perform the insert dml into the
378 --      specified entity.
379 --   5) The post_insert business process is then executed which enables any
380 --      logic to be processed after the insert dml process.
384 --
381 --   6) If the p_validate argument has been set to true an exception is raised
382 --      which is handled and processed by performing a rollback to the
383 --      savepoint which was issued at the beginning of the Ins process.
385 -- Pre Conditions:
386 --   The following attributes in p_rec are not for external issue. If these
387 --   values are set they will be overwritten: payroll_action_id,
388 --   action_status, current_task and object_version_number.
389 --   The following attributes in p_rec are mandatory: business_group_id,
390 --   effective_date, date_earned and consolidation_set_id.
391 --
392 -- In Arguments:
393 --   p_validate
394 --     Determines if the business process is to be validated. Setting this
395 --     boolean value to true will invoke the process to be validated. The
396 --     default is false. The validation is controlled by a savepoint and
397 --     rollback mechanism. The savepoint is issued at the beginning of the
398 --     business process and is rollbacked at the end of the business process
399 --     when all the processing has been completed. The rollback is controlled
400 --     by raising and handling the exception hr_api.validate_enabled. We use
401 --     the exception because, by raising the exception with the business
402 --     process, we can exit successfully without having any of the 'OUT'
403 --     arguments being set.
404 --   p_rec
405 --     Contains the attributes of the QuickPay Run Payroll Process.
406 --     N.B. p_rec.effective_date is known to the end use as date paid.
407 --   p_assignment_id
408 --     Is set to the assignment the QuickPay Run Assignment Process is to be
409 --     created for. This is a mandatory argument.
410 --
411 -- Post Success:
412 --   Fully validated rows will be inserted for a QuickPay Run Payroll
413 --   Process, QuickPay Run Assignment Process and QuickPay Inclusions without
414 --   being committed. If the p_validate argument has been set to true
415 --   then all the work will be rolled back.
416 --   p_rec
417 --     The primary key and object version number details for the inserted
418 --     QuickPay Run Payroll Process will be returned in p_rec.
419 --   p_assignment_action_id
420 --     will be set to the primary key value of the inserted QuickPay Run
421 --     Assignment Process.
422 --   p_a_object_version_number
423 --     will be set to the object version number of the inserted QuickPay Run
424 --     Assignment Process.
425 --
426 -- Post Failure:
427 --   If an error has occurred, an error message will be supplied with the work
428 --   rolled back. A failure will occur if any of the following conditions are
429 --   found:
430 --     1) All of the mandatory arguments have not been set.
431 --     2) The p_rec.business_group_id business group does not exist.
432 --     3) The assignment does not exist in the QuickPay Run business_group_id
433 --        as of p_rec.effective_date.
434 --     4) A consolidation_set does not exist with an id of
435 --        p_rec.consolidation_set_id.
436 --     5) The p_rec.consolidation_set_id does exist but it is not in the same
437 --        business group as the QuickPay Run.
438 --     6) The assignment does not have a payroll component as of
439 --        p_rec.effective_date or p_rec.date_earned.
440 --     7) There is no time period for the Assignment's payroll as of
441 --        p_rec.effective_date or p_rec.date_earned.
442 --     8) The assignment does not exist on the same payroll as of
443 --        p_rec.date_earned and p_rec.effective_date.
444 --     9) If the business group is for a US legislation and
445 --        p_rec.legislative_parameters is not set to ('R' or 'S') then an error
446 --        will be raised. For any non-US legislation and
447 --        p_rec.legislative_parameters is not null then an error is raised.
448 --
449 -- Access Status:
450 --   Public.
451 --
452 -- {End Of Comments}
453 --
454 procedure ins
455   (p_rec                     in out nocopy g_rec_type
456   ,p_assignment_id           in     number
457   ,p_assignment_action_id       out nocopy number
458   ,p_a_object_version_number    out nocopy number
459   ,p_validate                in     boolean default false
460   );
461 --
462 -- ----------------------------------------------------------------------------
463 -- |---------------------------------< ins >----------------------------------|
464 -- ----------------------------------------------------------------------------
465 -- {Start Of Comments}
466 --
467 -- Description:
468 --   This procedure is the attribute interface for the QuickPay Pre-payment
469 --   insert business. It is the outermost layer. The role of this process is
470 --   to insert fully validated rows into the HR schema passing back to the
471 --   calling process, any system generated values (e.g. the primary key and
472 --   the object version numbers).The processing of this procedure is as
473 --   follows:
474 --     1) The attributes are converted into a local record structure by
475 --        calling the convert_defs function.
476 --     2) After the conversion has taken place, the corresponding record ins
477 --        interface business process is executed.
478 --     3) OUT arguments are then set to their corresponding record arguments.
479 --
480 -- Pre Conditions:
481 --   None.
482 --
483 -- In Arguments:
484 --   p_validate
485 --     Determines if the business process is to be validated. Setting this
486 --     Boolean value to true will invoke the process to be validated.
487 --     The default is false.
488 --
489 -- Post Success:
493 --   then all the work will be rolled back.
490 --   Fully validated rows will be inserted for a QuickPay Run Payroll
491 --   Process, QuickPay Run Assignment Process and QuickPay Inclusions without
492 --   being committed. If the p_validate argument has been set to true
494 --   p_payroll_action_id
495 --     will be set to the primary key value of the inserted
496 --     QuickPay Run Payroll Process.
497 --   p_p_object_version_number
498 --     will be set to the object version number of the inserted QuickPay Run
499 --     Process.
500 --   p_assignment_action_id
501 --     will be set to the primary key value of the inserted QuickPay Run
502 --     Assignment Process.
503 --   p_a_object_version_number
504 --     will be set to the object version number of the inserted QuickPay Run
505 --     Assignment Process.
506 --
507 -- Post Failure:
508 --   If an error has occurred, an error message will be supplied with the work
509 --   rolled back. Refer to the ins record interface for details of possible
510 --   failures.
511 --
512 -- Access Status:
513 --   Public.
514 --
515 -- {End Of Comments}
516 --
517 procedure ins
518   (p_business_group_id       in     number
519   ,p_assignment_id           in     number
520   ,p_consolidation_set_id    in     number
521   ,p_effective_date          in     date
522   ,p_legislative_parameters  in     varchar2  default null
523   ,p_run_type_id             in     number    default null
524   ,p_date_earned             in     date
525   ,p_pay_advice_date         in     date      default null
526   ,p_pay_advice_message      in     varchar2  default null
527   ,p_comments                in     varchar2  default null
528   ,p_payroll_action_id          out nocopy number
529   ,p_p_object_version_number    out nocopy number
530   ,p_assignment_action_id       out nocopy number
531   ,p_a_object_version_number    out nocopy number
532   ,p_validate                in     boolean   default false
533   );
534 --
535 -- ----------------------------------------------------------------------------
536 -- |---------------------------------< upd >----------------------------------|
537 -- ----------------------------------------------------------------------------
538 -- {Start Of Comments}
539 --
540 -- Description:
541 --   This procedure is the record interface for the QuickPay Pre-payment
542 --   update business process. The role of this process is to update a fully
543 --   validated row for the HR schema passing back to the calling process, any
544 --   system generated values (e.g. object version number attribute). This
545 --   process is the main backbone of the upd business process. The processing
546 --   of this procedure is as follows:
547 --   1) If the p_validate argument has been set to true then a savepoint
548 --      is issued.
549 --   2) The row to be updated is then locked and selected into the record
550 --      structure g_old_rec.
551 --   3) Because on update arguments which are not part of the update do not
552 --      have to be defaulted, we need to build up the updated row by
553 --      converting any system defaulted arguments to their corresponding
554 --      database value.
555 --   4) The controlling validation process update_validate is then executed
556 --      which will execute all private and public validation business rule
557 --      processes.
558 --   5) The pre_update business process is then executed which enables any
559 --      logic to be processed before the update dml process is executed.
560 --   6) The update_dml process will physical perform the update dml into the
561 --      specified entity.
562 --   7) The post_update business process is then executed which enables any
563 --      logic to be processed after the update dml process.
564 --   8) If the p_validate argument has been set to true an exception is
565 --      raised which is handled and processed by performing a rollback to
566 --      the savepoint which was issued at the beginning of the upd process.
567 --
568 -- Pre Conditions:
569 --   None.
570 --
571 -- In Arguments:
572 --   p_validate
573 --     Determines if the business process is to be validated. Setting this
574 --     boolean value to true will invoke the process to be validated. The
575 --     default is false. The validation is controlled by a savepoint and
576 --     rollback mechanism. The savepoint is issued at the beginning of the
577 --     business process and is rollbacked at the end of the business process
578 --     when all the processing has been completed. The rollback is controlled
579 --     by raising and handling the exception hr_api.validate_enabled. We use
580 --     the exception because, by raising the exception with the business
581 --     process, we can exit successfully without having any of the 'OUT'
582 --     arguments being set.
583 --   p_assignment_action_id
584 --     Set to the id of the associated QuickPay Run Assignment Process.
585 --   p_a_object_version_number
586 --     Set to the object version number of the associated QuickPay Run
587 --     Assignment Process.
588 --
589 -- Post Success:
590 --   The specified row will be fully validated and updated without being
591 --   committed. If the p_validate argument has been set to true then all the
592 --   work will be rolled back.
593 --   p_rec.object_version_number will be set with the new object_version_number
594 --   for the QuickPay Run Payroll Process.
595 --
596 -- Post Failure:
597 --   If an error has occurred, an error message will be supplied with the work
601 --        concurrent manager for this QuickPay Run.
598 --   rolled back. A failure will occur if any of the business rules/conditions
599 --   are found:
600 --     1) An AOL concurrent request is waiting to run or still running on the
602 --     2) The QuickPay Run Payroll Process current_task is not null.
603 --     3) If the action_status is being updated the only valid change is from
604 --        'C' (Complete) to 'M' (Mark for Retry). Any other attempted change
605 --        to the action_status will result in an error being raised.
606 --     4) Regardless of the action_status value, the caller has attempted to
607 --        update one of the non updateable attributes. (business_group_id,
608 --        effective_date, current_task, date_earned).
609 --     5) A consolidation_set does not exist with an id of
610 --        p_rec.consolidation_set_id.
611 --     6) The p_rec.consolidation_set_id does exist but it is not in the same
612 --        business group as the QuickPay Run.
613 --     7) The QuickPay Run business group is for a US legislation and
614 --        legislative_parameters is not set to 'R' or 'S'.
615 --     8) The business group is for a US legislation and the caller
616 --        has attempted to update legislation_parameters when the action status
617 --        is Complete.
618 --     9) The business group is for any non-US legislation and
619 --        p_legislative_parameters is not null.
620 --
621 -- Access Status:
622 --   Public.
623 --
624 -- {End Of Comments}
625 --
626 procedure upd
627   (p_rec                     in out nocopy g_rec_type
628   ,p_assignment_action_id    in     number
629   ,p_a_object_version_number in     number
630   ,p_validate                in     boolean default false
631   );
632 --
633 -- ----------------------------------------------------------------------------
634 -- |---------------------------------< upd >----------------------------------|
635 -- ----------------------------------------------------------------------------
636 -- {Start Of Comments}
637 --
638 -- Description:
639 --   This procedure is the attribute interface for the QuickPay Run update
640 --   business process.
641 --   The role of this process is to update a fully validated row into the HR
642 --   schema passing back to the calling process, any system generated values
643 --   (e.g. object version number attributes). The processing of this
644 --   procedure is as follows:
645 --   1) The attributes are converted into a local record structure by
646 --      calling the convert_defs function.
647 --   2) After the conversion has taken place, the corresponding record upd
648 --      interface business process is executed.
649 --   3) OUT arguments are then set to their corresponding record arguments.
650 --
651 -- Pre Conditions:
652 --   None.
653 --
654 -- In Arguments:
655 --   p_validate
656 --     Determines if the business process is to be validated. Setting this
657 --     Boolean value to true will invoke the process to be validated.
658 --     The default is false.
659 --
660 -- Post Success:
661 --   The specified row will be fully validated and updated without being
662 --   committed. If the p_validate argument has been set to true then all the
663 --   work will be rolled back.
664 --   p_p_object_version_number will be set with the new object_version_number
665 --   for the QuickPay Run Payroll Process.
666 --
667 -- Post Failure:
668 --   If an error has occurred, an error message will be supplied with the work
669 --   rolled back. Refer to the upd record interface for details of possible
670 --   failures.
671 --
672 -- Access Status:
673 --   Public.
674 --
675 -- {End Of Comments}
676 --
677 procedure upd
678   (p_payroll_action_id       in     number
679   ,p_consolidation_set_id    in     number   default hr_api.g_number
680   ,p_legislative_parameters  in     varchar2 default hr_api.g_varchar2
681   ,p_run_type_id             in     number   default hr_api.g_number
682   ,p_pay_advice_date         in     date     default hr_api.g_date
683   ,p_pay_advice_message      in     varchar2 default hr_api.g_varchar2
684   ,p_action_status           in     varchar2 default hr_api.g_varchar2
685   ,p_comments                in     varchar2 default hr_api.g_varchar2
686   ,p_assignment_action_id    in     number
687   ,p_p_object_version_number in out nocopy number
688   ,p_a_object_version_number in     number
689   ,p_validate                in     boolean  default false
690   );
691 --
692 -- ----------------------------------------------------------------------------
693 -- |---------------------------------< del >----------------------------------|
694 -- ----------------------------------------------------------------------------
695 -- {Start Of Comments}
696 --
697 -- Description:
698 --   This procedure is the record interface for the delete business process
699 --   for the QuickPay Run entity. The role of this process is to
700 --   delete a QuickPay Run definition from the HR schema. This process is the
701 --   main backbone of the del business process. The processing of this
702 --   procedure is as follows:
703 --   1) If the p_validate argument has been set to true then a savepoint is
704 --      issued.
705 --   2) The controlling validation process delete_validate is then executed
706 --      which will execute all private and public validation business rule
707 --      processes.
708 --   3) The pre_delete business process is then executed which enables any
709 --      logic to be processed before the delete dml process is executed.
713 --      logic to be processed after the delete dml process.
710 --   4) The delete_dml process will physical perform the delete dml for the
711 --      specified rows.
712 --   5) The post_delete business process is then executed which enables any
714 --   6) If the p_validate argument has been set to true an exception is raised
715 --      which is handled and processed by performing a rollback to the
716 --      savepoint which was issued at the beginning of the del process.
717 --
718 -- Pre Conditions:
719 --   The main arguments to the business process have to be in the record
720 --   format.
721 --
722 -- In Arguments:
723 --   p_validate
724 --     Determines if the business process is to be validated. Setting this
725 --     boolean value to true will invoke the process to be validated. The
726 --     default is false. The validation is controlled by a savepoint and
727 --     rollback mechanism. The savepoint is issued at the beginning of the
728 --     business process and is rollbacked at the end of the business process
729 --     when all the processing has been completed. The rollback is controlled
730 --     by raising and handling the exception hr_api.validate_enabled. We use
731 --     the exception because, by raising the exception with the business
732 --     process, we can exit successfully without having any of the 'OUT'
733 --     arguments being set.
734 --   p_rec
735 --     The only components which must be set in the record structure are
736 --     the primary key (p_rec.payroll_action_id) and the Payroll Process
737 --     object version number (p_rec.object_version_number).
738 --   p_a_object_version_number
739 --     Must be set to the current object version number for the QuickPay Run
740 --     Assignment Process.
741 --   If the Payroll or Assignment Process object version number does not
742 --   match the current value in the database the deletion of the whole
743 --   QuickPay Run definition will not be allowed.
744 --
745 -- Post Success:
746 --   The specified QuickPay Run will be fully validated and deleted without
747 --   being committed. If the p_validate argument has been set to true then all
748 --   the work will be rolled back.
749 --
750 -- Post Failure:
751 --   If an error has occurred, an error message will be supplied with the work
752 --   rolled back. A failure will occur if any of the business rules/conditions
753 --   are found:
754 --     1) An AOL concurrent request is waiting to run or still running on the
755 --        concurrent manager for this QuickPay Run.
756 --     2) The QuickPay Run Payroll Process current_task is not null.
757 --     3) The Payroll or Assignment Process object version numbers do not
758 --        match the current values in the database.
759 --     4) There is another Assignment Process locking the QuickPay Run
760 --        Assignment Process which has not been marked for retry.
761 --
762 -- Access Status:
763 --   Public.
764 --
765 -- {End Of Comments}
766 --
767 procedure del
768   (p_rec                      in g_rec_type
769   ,p_a_object_version_number  in number
770   ,p_validate                 in boolean default false
771   );
772 --
773 -- ----------------------------------------------------------------------------
774 -- |---------------------------------< del >----------------------------------|
775 -- ----------------------------------------------------------------------------
776 -- {Start Of Comments}
777 --
778 -- Description:
779 --   This procedure is the attribute interface for the delete business
780 --   process for the QuickPay Run entity and is the outermost layer.
781 --   The role of this process is to validate and delete the specified rows
782 --   from the HR schema. The processing of this procedure is as follows:
783 --   1) The attributes are converted into a local record structure by
784 --      explicitly coding the attribute arguments into the g_rec_type
785 --      datatype.
786 --   2) After the conversion has taken place, the corresponding record del
787 --      interface business process is executed.
788 --
789 -- Pre Conditions:
790 --
791 -- In Arguments:
792 --   p_payroll_action_id
793 --     Set the primary key of the QuickPay Run Payroll Process.
794 --   p_p_object_version_number
795 --     Set the current object version number of the QuickPay Run Payroll
796 --     Process.
797 --   p_a_object_version_number
798 --     Set to the current object version number of the QuickPay Run Assignment
799 --     Process.
800 --   p_validate
801 --     Determines if the business process is to be validated. Setting this
802 --     Boolean value to true will invoke the process to be validated.
803 --     The default is false.
804 --
805 -- Post Success:
806 --   The specified row will be fully validated and deleted for the specified
807 --   entity without being committed (or rollbacked depending on the
808 --   p_validate status).
809 --
810 -- Post Failure:
811 --   If an error has occurred, an error message will be supplied with the work
812 --   rolled back. Refer to the del record interface for details of possible
813 --   failures.
814 --
815 -- Access Status:
816 --   Public.
817 --
818 -- {End Of Comments}
819 --
820 Procedure del
821   (p_payroll_action_id        in number
822   ,p_p_object_version_number  in number
823   ,p_a_object_version_number  in number
824   ,p_validate                 in boolean default false
825   );
826 --
830 -- {Start Of Comments}
827 -- ----------------------------------------------------------------------------
828 -- |------------------------------< default_values >--------------------------|
829 -- ----------------------------------------------------------------------------
831 --
832 -- Description:
833 --   This procedure returns the QuickPay Run default values which are provided
834 --   on the Form. It also returns various translatable prompts which are
835 --   used by the Form.
836 --
837 -- Pre Conditions:
838 --   This procedure assumes the following is true:
839 --     1) p_assignment_id is an assignment which exists in the HR schema.
840 --     2) The assignment exists in the same business group as the current
841 --        Forms session.
842 --     3) The assignment has a not null payroll components as of the
843 --        current effective date or as of trunc(sysdate).
844 --
845 -- In Arguments:
846 --   p_assignment_id
847 --     Is set to the id of the assignment, as in the current Taskflow context.
848 --
849 -- Post Success:
850 --   The values for some of the out arguments depends on the assignment's
851 --   business group legislation.
852 --   p_df_effective_date, p_df_date_earned and p_period_name will be null if
853 --   no time period exists for the assignment's payroll, as of the Forms
854 --   session effective date. If there is no row in fnd_sessions for this
855 --   database session, trunc(sysdate) will be used to find a matching time
856 --   period.
857 --   If a time period definition does exist the date values depend on the
858 --   assignment's business group legislation:
859 --   For 'GB' legislation:
860 --     p_df_effective_date
861 --       The regular payment date for the matching period.
862 --     p_df_date_earned
863 --       The earliest of the following dates will be used:
864 --         1) The end date of the matching time period.
865 --         2) The final date for which the assignment is on this payroll.
866 --            (This will always be less than or equal to the end date of
867 --            the assignment.)
868 --            If for some reason the assignment has transferred from the
869 --            current payroll more than once in this period, the first
870 --            leaving date will be taken.
871 --
872 --   For all other legislations (not 'GB'):
873 --     p_df_effective_date
874 --       Set to the current Forms session effective date. If there is no
875 --       corresponding row in fnd_sessions for this database session, this
876 --       argument will be set to trunc(sysdate).
877 --     p_df_date_earned
878 --       Set to the ame value as p_df_effective_date.
879 --
880 --   The following attributes are always set with the stated values,
881 --   regardless of the business group's legislation:
882 --     p_period_name
883 --       If the assignment's payroll has a time period definition which spans
884 --       the effective date (p_eff_date), this argument will be set to the
885 --       users period name for that period. If there is no matching time period
886 --       this argument will be null.
887 --     p_consolidation_set_id
888 --       Set to the id of the default consolidation set for the assignment's
889 --       payroll as of the effective_date.
890 --     p_consolidation_set_name
891 --       Set to the user name description corresponding to
892 --       p_consolidation_set_id.
893 --     p_unprocessed_status
894 --       Set to the user description for an Unprocessed assignment process.
895 --     p_mark_for_retry_status
896 --       Set to the user description for a Marked for retry assignment process.
897 --     p_complete_status
898 --       Set to the user description for a Completed assignment process.
899 --     p_in_error_status
900 --       Set to the user description for an In error assignment process.
901 --     p_start_run_prompt
902 --       Set to the user button prompt for starting a QuickPay Run which has
903 --       a status of Unprocessed.
904 --     p_start_pre_prompt
905 --       Set to the user button prompt for starting a QuickPay Pre-payment
906 --       which has a status of Unprocessed.
907 --     p_retry_run_prompt
908 --       Set to the user button prompt for re-doing a QuickPay Run which has a
909 --       status of In Error, complete or Marked for Retry.
910 --     p_start_arc_prompt
911 --       Set to the user button prompt for starting a QuickPay Archival
912 --       which has a status of Unprocessed.
913 --     p_retry_arc_prompt
914 --       Set to the user button prompt for re-doing a QuickPay Archival which has a
915 --       status of In Error, complete or Marked for Retry.
916 --     p_qp_run_user_name
917 --       Set to the user description of a QuickPay Run Payroll Process.
918 --
919 -- Post Failure:
920 --   An error will be raised if any of the status or button prompts can be
921 --   found.
922 --
923 -- Access Status:
924 --   Public.
925 --
926 -- {End Of Comments}
927 --
928 Procedure default_values
929   (p_assignment_id          in     pay_assignment_actions.assignment_id%TYPE
930   ,p_df_effective_date         out nocopy pay_payroll_actions.
931                                                   effective_date%TYPE
932   ,p_df_date_earned            out nocopy pay_payroll_actions.date_earned%TYPE
933   ,p_period_name               out nocopy per_time_periods.period_name%TYPE
934   ,p_consolidation_set_id      out nocopy pay_consolidation_sets.
935                                                   consolidation_set_id%TYPE
939   ,p_mark_for_retry_status     out nocopy varchar2
936   ,p_consolidation_set_name    out nocopy pay_consolidation_sets.
937                                                   consolidation_set_name%TYPE
938   ,p_unprocessed_status        out nocopy varchar2
940   ,p_complete_status           out nocopy varchar2
941   ,p_in_error_status           out nocopy varchar2
942   ,p_start_run_prompt          out nocopy varchar2
943   ,p_start_pre_prompt          out nocopy varchar2
944   ,p_retry_run_prompt          out nocopy varchar2
945   ,p_rerun_pre_prompt          out nocopy varchar2
946   ,p_start_arc_prompt          out nocopy varchar2
947   ,p_retry_arc_prompt          out nocopy varchar2
948   ,p_qp_run_user_name          out nocopy varchar2
949   );
950 --
951 -- ----------------------------------------------------------------------------
952 -- |--------------------------< start_quickpay_process >----------------------|
953 -- ----------------------------------------------------------------------------
954 --
955 -- {Start Of Comments}
956 --
957 -- Description:
958 --   Submits a QuickPay Run or QuickPay Pre-payment process to the AOL
959 --   concurrent manager. The type of process is worked out internally. It
960 --   depends on the action_type and action_status.
961 --
962 -- Pre Conditions:
963 --   None.
964 --
965 -- In Arguments:
966 --   p_payroll_action_id
967 --     Set to the id of a QuickPay Run or QuickPay Pre-payment Payroll Process,
968 --     which already exists in the database.
969 --   p_p_object_version_number
970 --     Set to the current object version number for the Payroll Process.
971 --   p_a_object_version_number
972 --     Set to the current object version number for the Assignment Process.
973 --   All the arguments are mandatory.
974 --
975 -- Post Success:
976 --   An AOL process request was successfully submitted to the concurrent
977 --   manager and the request_id was updated on the pay_payroll_actions table.
978 --   If this procedure call is successful the caller code must issue a commit.
979 --   This must be done otherwise the concurrent manager will not start the
980 --   request running.
981 --
982 -- Post Failure:
983 --   An error will be raised if:
984 --     1) A QuickPay Run or QuickPay Pre-payment Payroll Process could not be
985 --        found in the database with an id of p_payroll_action_id.
986 --     2) The Payroll or Assignment Process object version numbers do not
987 --        match the current values in the database.
988 --     3) An AOL concurrent request is waiting to run or still running on the
989 --        concurrent manager for this QuickPay Run or QuickPay Pre-payment.
990 --
991 -- Access Status:
992 --   Public.
993 --
994 -- {End Of Comments}
995 procedure start_quickpay_process
996   (p_payroll_action_id       in pay_payroll_actions.payroll_action_id%TYPE
997   ,p_p_object_version_number in pay_payroll_actions.object_version_number%TYPE
998   ,p_a_object_version_number in pay_assignment_actions.object_version_number%TYPE
999   ,p_status                  in out nocopy varchar2
1000   );
1001 --
1002 -- ----------------------------------------------------------------------------
1003 -- |--------------------------< wait_quickpay_process >-----------------------|
1004 -- ----------------------------------------------------------------------------
1005 --
1006 -- {Start Of Comments}
1007 --
1008 -- Description:
1009 --   Waits for the QuickPay Run or QuickPay Pre-payment process to finish
1010 --   running on the AOL concurrent manager. If the maximum wait time is
1011 --   reached, this procedure will end successfully before the process has
1012 --   finished.
1013 --
1014 -- Pre Conditions:
1015 --   A call to start_quickpay_process has been done and a commit has been
1016 --   issued.
1017 --
1018 -- In Arguments:
1019 --   p_payroll_action_id
1020 --     Is the id of a QuickPay Run or QuickPay Pre-payment Payroll Process.
1021 --     This is a mandatory argument.
1022 --
1023 -- Post Success:
1024 --   p_display_run_number
1025 --     Set to Payroll Process display_run_number attribute.
1026 --   p_a_action_status
1027 --     Set to current Assignment Process action_status attribute.
1028 --   p_process_info
1029 --     Set to 'PROCESS_NOT_STARTED', 'PROCESS_RUNNING' or 'PROCESS_FINISHED'.
1030 --   p_request_id
1031 --     Set to the AOL concurrent request this procedure has been waiting to
1032 --     finish.
1033 --
1034 -- Post Failure:
1035 --   An error will be raised if a payroll_action does not exist with an id
1036 --   of p_payroll_action_id.
1037 --
1038 -- Access Status:
1039 --   Public.
1040 --
1041 -- {End Of Comments}
1042 --
1043 procedure wait_quickpay_process
1044   (p_payroll_action_id  in     pay_payroll_actions.payroll_action_id%TYPE
1045   ,p_display_run_number    out nocopy pay_payroll_actions.
1046                                                  display_run_number%TYPE
1047   ,p_a_action_status       out nocopy pay_assignment_actions.action_status%TYPE
1048   ,p_process_info          out nocopy varchar2
1049   ,p_request_id            out nocopy pay_payroll_actions.request_id%TYPE
1050   );
1051 --
1052 
1053 end pay_qpq_api;