DBA Data[Home] [Help]

PACKAGE: APPS.PAY_QPQ_API

Source


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