DBA Data[Home] [Help]

PACKAGE: APPS.ARP_PS_UTIL

Source


1 PACKAGE ARP_PS_UTIL AS
2 /* $Header: ARCUPSS.pls 120.8 2006/12/20 18:51:03 mraymond ship $*/
3 --
4 /*===========================================================================+
5  | PROCEDURE                                                                 |
6  |    update_reverse_actions                                                 |
7  |                                                                           |
8  | DESCRIPTION                                                               |
9  |    This procedure performs all actions to modify the passed in            |
10  |    user defined application record and prepares to update payment schedule|
11  |    table                                                                  |
12  |                                                                           |
13  | ARGUMENTS  : IN:                                                          |
14  |                  p_app_rec - Application Record structure                 |
15  |                  p_module_name _ Name of module that called this procedure|
16  |                  p_module_version - Version of module that called this    |
17  |                                     procedure                             |
18  |              OUT:                                                         |
19  |                                                                           |
20  | RETURNS    : NONE                                                         |
21  |                                                                           |
22  | MODIFICATION HISTORY - Created by Ganesh Vaidee - 04/25/95                |
23  |                                                                           |
24  +===========================================================================*/
25 PROCEDURE update_reverse_actions(
26                 p_app_rec         IN arp_global.app_rec_type,
27                 p_module_name     IN VARCHAR2,
28                 p_module_version  IN VARCHAR2);
29 --
30 /*===========================================================================+
31  | PROCEDURE                                                                 |
32  |    update_receipt_related_columns                                         |
33  |                                                                           |
34  | DESCRIPTION                                                               |
35  |      This procedure updates the receipt related rows of a payment schedule|
36  |      The passed in PS ID is assumed to belong to a receipt. The procedure |
37  |      sets the gl_date and gl_date_closed and amount applied. The procedure|
38  |      should be called whenever a receipt is applied to an invoice.        |
39  |      The procedure also return the acctd_amount_applied to populate the   |
40  |      acctd_amount_applied_from column during AR_RA row insertion          |
41  |                                                                           |
42  | PARAMETERS :                                                              |
43  |         IN : p_payment_schedule_id - payment_schedule_id of payment       |
44  |              schedule                                                     |
45  |              p_gldate - GL date of the receipt                            |
46  |              p_apply_date - Apply Date of the receipt                     |
47  |              p_amount_applied - Amount of the receipt applied to the      |
48  |                                 invoice.                                  |
49  |              p_module_name - Name of module that called this routine      |
50  |              p_module_version - Version of module that called this routine|
51  |        OUT NOCOPY : p_acctd_amount_applied_out - Accounted amount applied used to|
52  |                         populate acctd_amount_applied_from in AR_RA table |
53  |                                                                           |
54  | HISTORY - Created By - Ganesh Vaidee - 08/24/1995                         |
55  |                                                                           |
56  +===========================================================================*/
57 PROCEDURE update_receipt_related_columns(
58                 p_ps_id   IN ar_payment_schedules.payment_schedule_id%TYPE,
59                 p_amount_applied IN ar_payment_schedules.amount_applied%TYPE,
60                 p_apply_date IN ar_payment_schedules.gl_date%TYPE,
61                 p_gl_date IN ar_payment_schedules.gl_date%TYPE,
62                 p_acctd_amount_applied  OUT NOCOPY
63                  ar_receivable_applications.acctd_amount_applied_from%TYPE,
64                 p_ps_rec IN ar_payment_schedules%ROWTYPE);
65 --
66 -- deleted 'DEFAULT NULL' for p_ps_rec Rowtype attribute -bug460979 for Oracle8
67 --
68 /*===========================================================================+
69  | PROCEDURE                                                                 |
70  |    update_invoice_related_columns   (original)                            |
71  |                                                                           |
72  | DESCRIPTION                                                               |
73  |      This procedure updates the invoice related rows of a payment schedule|
74  |      The passed in PS ID is assumed to belong to a invoice. The procedure |
75  |      sets the gl_date and gl_date_closed and amount(s) applied. The       |
76  |      procedure should be called whenever a receipt is applied to an       |
77  |      invoice. The procedure also returns the acctd_amount_applied,        |
78  |      acctd_earned_discount_taken, acctd_unearned_discount_taken columns,  |
79  |      line_applied, tax_applied, freight_applied, charges_applied columns  |
80  |      to populate the RA columns during AR_RA row insertion                |
81  |      insertion          						     |
82  |
83  |       NOTE:  This version will not call etax ever.  Use overloaded
84  |        version if etax call for discounts is required
85  | PARAMETERS :                                                              |
86  |    IN : p_app_type            - Indicates the type of application         |
87  |                                 Valid values are CASH for receipt         |
88  |                                 application and CM fro credit memo appln. |
89  |         p_payment_schedule_id - payment_schedule_id of payment            |
90  |                                 schedule                                  |
91  |         p_gldate              - GL date of the receipt                    |
92  |         p_apply_date          - Apply Date of the receipt                 |
93  |         p_amount_applied      - Amount of the receipt applied to the      |
94  |                                 invoice                                   |
95  |         p_discount_taken_earned   - Earned discount taken(NULL if CM      |
96  |                                     appln                                 |
97  |         p_discount_taken_unearned - Unearned discount taken(NULL if CM    |
98  |                                     appln                                 |
99  |         p_ps_rec                  - Payment Schedule record, If this field|
100  |                                     is not null, the PS record is not     |
101  |                                     fetched using p_ps_id. This PS record |
102  |                                     is used                               |
103  |   OUT NOCOPY : p_acctd_amount_applied     - Accounted amount applied used to     |
104  |                                      populate acctd_amount_applied_from in|
105  |                                      AR_RA table                          |
106  |         p_acctd_discount_taken_earned - Accounted discount taken earned to|
107  |                                      populate acctd_discount_taken_earned |
108  |                                      AR_RA table. This field is not       |
109  |                                      populated if application is of type  |
110  |                                      CM. It is NULL is app. type is CM.   |
111  |         p_acctd_disc_taken_unearned - Accounted discount taken unearned to|
112  |                                      populate acctd_discount_taken_uneard |
113  |                                      AR_RA table. This field is not       |
114  |                                      populated if application is of type  |
115  |                                      CM. It is NULL is app. type is CM.   |
116  |         p_tax_applied              - Part of the applied amount applied to|
117  |                                      tax                                  |
118  |         p_freight_applied          - Part of the applied amount applied to|
119  |                                      freight                              |
120  |         p_line_applied             - Part of the applied amount applied to|
121  |                                      lines                                |
122  |         p_charges_applied          - Part of the applied amount applied to|
123  |                                      receivable charges                   |
124  |                                                                           |
125  | HISTORY - Created By - Ganesh Vaidee - 08/24/1995                         |
126  |                                                                           |
127  |   29-AUG-05   M Raymond          4566510 - Changed p_line_ediscounted,
128  |                                    p_line_uediscounted, p_tax_ediscounted,
129  |                                    and p_tax_uediscounted to IN OUT NOCOPY
130  |                                    so I can pass in discounts when
131  |                                    already prorated by etax.
132  |   19-DEC-06   M Raymond          5677984 - adding overloaded version of this
133  |                                    procedure (see definition below)
134  +===========================================================================*/
135 PROCEDURE update_invoice_related_columns(
136                 p_app_type  IN VARCHAR2,
137                 p_ps_id     IN ar_payment_schedules.payment_schedule_id%TYPE,
138                 p_amount_applied          IN ar_payment_schedules.amount_applied%TYPE,
139                 p_discount_taken_earned   IN ar_payment_schedules.discount_taken_earned%TYPE,
140                 p_discount_taken_unearned IN ar_payment_schedules.discount_taken_unearned%TYPE,
141                 p_apply_date              IN ar_payment_schedules.gl_date%TYPE,
142                 p_gl_date                 IN ar_payment_schedules.gl_date%TYPE,
143                 p_acctd_amount_applied    OUT NOCOPY ar_receivable_applications.acctd_amount_applied_to%TYPE,
144                 p_acctd_earned_discount_taken OUT NOCOPY ar_receivable_applications.earned_discount_taken%TYPE,
145                 p_acctd_unearned_disc_taken   OUT NOCOPY ar_receivable_applications.acctd_unearned_discount_taken%TYPE,
146                 p_line_applied     OUT NOCOPY ar_receivable_applications.line_applied%TYPE,
147                 p_tax_applied      OUT NOCOPY ar_receivable_applications.tax_applied%TYPE,
148                 p_freight_applied  OUT NOCOPY ar_receivable_applications.freight_applied%TYPE,
149                 p_charges_applied  OUT NOCOPY ar_receivable_applications.receivables_charges_applied%TYPE,
150                 p_line_ediscounted IN OUT NOCOPY ar_receivable_applications.line_applied%TYPE,
151                 p_tax_ediscounted  IN OUT NOCOPY ar_receivable_applications.tax_applied%TYPE,
152                 p_freight_ediscounted  OUT NOCOPY ar_receivable_applications.freight_applied%TYPE,
153                 p_charges_ediscounted  OUT NOCOPY ar_receivable_applications.receivables_charges_applied%TYPE,
154                 p_line_uediscounted   IN OUT NOCOPY ar_receivable_applications.line_applied%TYPE,
155                 p_tax_uediscounted    IN OUT NOCOPY ar_receivable_applications.tax_applied%TYPE,
156                 p_freight_uediscounted OUT NOCOPY ar_receivable_applications.freight_applied%TYPE,
157                 p_charges_uediscounted OUT NOCOPY ar_receivable_applications.receivables_charges_applied%TYPE,
158                 p_rule_set_id          OUT NOCOPY number,
159                 p_ps_rec               IN  ar_payment_schedules%ROWTYPE);
160 
161 /*===========================================================================+
162  | PROCEDURE                                                                 |
163  |    update_invoice_related_columns (overloaded)                                         |
164  |                                                                           |
165  | DESCRIPTION                                                               |
166  |      This procedure is a wrapper for the original one of same name
167  |      with two additional parameters.  This allows us to control
168  |      use of etax calls inside this routine and mask the out parameter
169  |      for receivable_application_id from calls that do not require it.
170  |      You should use this signature for receipt applications.  Others
171  |      may not require or need the etax call functionality.
172  |                                                                           |
173  | PARAMETERS :                                                              |
174  |    IN : p_app_type            - Indicates the type of application         |
175  |                                 Valid values are CASH for receipt         |
176  |                                 application and CM fro credit memo appln. |
177  |         p_payment_schedule_id - payment_schedule_id of payment            |
178  |                                 schedule                                  |
179  |         p_gldate              - GL date of the receipt                    |
180  |         p_apply_date          - Apply Date of the receipt                 |
181  |         p_amount_applied      - Amount of the receipt applied to the      |
182  |                                 invoice                                   |
183  |         p_discount_taken_earned   - Earned discount taken(NULL if CM      |
184  |                                     appln                                 |
185  |         p_discount_taken_unearned - Unearned discount taken(NULL if CM    |
186  |                                     appln                                 |
187  |         p_ps_rec                  - Payment Schedule record, If this field|
188  |                                     is not null, the PS record is not     |
189  |                                     fetched using p_ps_id. This PS record |
190  |                                     is used                               |
191  |         p_cash_receipt_id          - CR ID (if null, do not call etax)
192  |
193  |   OUT NOCOPY : p_acctd_amount_applied     - Accounted amount applied used to     |
194  |                                      populate acctd_amount_applied_from in|
195  |                                      AR_RA table                          |
196  |         p_acctd_discount_taken_earned - Accounted discount taken earned to|
197  |                                      populate acctd_discount_taken_earned |
198  |                                      AR_RA table. This field is not       |
199  |                                      populated if application is of type  |
200  |                                      CM. It is NULL is app. type is CM.   |
201  |         p_acctd_disc_taken_unearned - Accounted discount taken unearned to|
202  |                                      populate acctd_discount_taken_uneard |
203  |                                      AR_RA table. This field is not       |
204  |                                      populated if application is of type  |
205  |                                      CM. It is NULL is app. type is CM.   |
206  |         p_tax_applied              - Part of the applied amount applied to|
207  |                                      tax                                  |
208  |         p_freight_applied          - Part of the applied amount applied to|
209  |                                      freight                              |
210  |         p_line_applied             - Part of the applied amount applied to|
211  |                                      lines                                |
212  |         p_charges_applied          - Part of the applied amount applied to|
213  |                                      receivable charges
214  |         p_ra_app_id                - receivable app ID returned from etax
215  |                                      logic.
216  |         p_gt_id                    - ID related to SLA accounting data.
217  |
218  | HISTORY - Created By - mraymond - 12/19/2006                         |
219  |                                                                           |
220  |   19-DEC-06   M Raymond          5677984 - adding parameters for
221  |                                    cash_receipt_id, ra_app_id, and gt_id
222  |                                    to update_invoice_related_columns
223  |                                    to facilitate etax disc proration.
224  +===========================================================================*/
225 PROCEDURE update_invoice_related_columns(
226                 p_app_type  IN VARCHAR2,
227                 p_ps_id     IN ar_payment_schedules.payment_schedule_id%TYPE,
228                 p_amount_applied          IN ar_payment_schedules.amount_applied%TYPE,
229                 p_discount_taken_earned   IN ar_payment_schedules.discount_taken_earned%TYPE,
230                 p_discount_taken_unearned IN ar_payment_schedules.discount_taken_unearned%TYPE,
231                 p_apply_date              IN ar_payment_schedules.gl_date%TYPE,
232                 p_gl_date                 IN ar_payment_schedules.gl_date%TYPE,
233                 p_acctd_amount_applied    OUT NOCOPY ar_receivable_applications.acctd_amount_applied_to%TYPE,
234                 p_acctd_earned_discount_taken OUT NOCOPY ar_receivable_applications.earned_discount_taken%TYPE,
235                 p_acctd_unearned_disc_taken   OUT NOCOPY ar_receivable_applications.acctd_unearned_discount_taken%TYPE,
236                 p_line_applied     OUT NOCOPY ar_receivable_applications.line_applied%TYPE,
237                 p_tax_applied      OUT NOCOPY ar_receivable_applications.tax_applied%TYPE,
238                 p_freight_applied  OUT NOCOPY ar_receivable_applications.freight_applied%TYPE,
239                 p_charges_applied  OUT NOCOPY ar_receivable_applications.receivables_charges_applied%TYPE,
240                 p_line_ediscounted IN OUT NOCOPY ar_receivable_applications.line_applied%TYPE,
241                 p_tax_ediscounted  IN OUT NOCOPY ar_receivable_applications.tax_applied%TYPE,
242                 p_freight_ediscounted  OUT NOCOPY ar_receivable_applications.freight_applied%TYPE,
243                 p_charges_ediscounted  OUT NOCOPY ar_receivable_applications.receivables_charges_applied%TYPE,
244                 p_line_uediscounted   IN OUT NOCOPY ar_receivable_applications.line_applied%TYPE,
245                 p_tax_uediscounted    IN OUT NOCOPY ar_receivable_applications.tax_applied%TYPE,
246                 p_freight_uediscounted OUT NOCOPY ar_receivable_applications.freight_applied%TYPE,
247                 p_charges_uediscounted OUT NOCOPY ar_receivable_applications.receivables_charges_applied%TYPE,
248                 p_rule_set_id          OUT NOCOPY number,
249                 p_ps_rec               IN  ar_payment_schedules%ROWTYPE,
250                 p_cash_receipt_id      IN ar_receivable_applications_all.cash_receipt_id%TYPE,
251                 p_ra_app_id            OUT NOCOPY ar_receivable_applications.receivable_application_id%TYPE,
252                 p_gt_id                OUT NOCOPY NUMBER);
253 
254 
255 --
256 -- deleted 'DEFAULT NULL' for p_ps_rec Rowtype attribute -bug460979 for Oracle8
257 
258 /*===========================================================================+
259  | PROCEDURE                                                                 |
260  |    update_cm_related_columns                                              |
261  |                                                                           |
262  | DESCRIPTION                                                               |
263  |      This procedure updates the CM      related rows of a payment schedule|
264  |      The passed in PS ID is assumed to belong to a CM. The procedure      |
265  |      sets the gl_date and gl_date_closed and amount(s) applied. The       |
266  |      procedure should be called whenever a receipt is applied to an       |
267  |      invoice.                                                             |
268  |                                                                           |
269  | PARAMETERS :                                                              |
270  |    IN : p_payment_schedule_id - payment_schedule_id of Credir Memo        |
271  |         p_gldate              - GL date of the receipt                    |
272  |         p_apply_date          - Apply Date of the receipt                 |
273  |         p_amount_applied      - Amount of the CM      applied to the      |
274  |                                 invoice                                   |
275  |         p_ps_rec              - Payment Schedule record, If this field    |
276  |                                 is not null, the PS record is not         |
277  |                                 fetched using p_ps_id. This PS record     |
278  |                                 is used                                   |
279  |         p_update_credit_flag  - For CM refunds, to indicate if amount     |
280  |				   credited should be updated                |
281  |   OUT NOCOPY : p_acctd_amount_applied  - Accounted amount applied used to        |
282  |                                   populate acctd_amount_applied_from in   |
283  |                                   AR_RA table                             |
284  |         p_tax_applied           - Part of the applied amount applied to   |
285  |                                   tax, This field will populate           |
286  |                                   TAX_REMAINING in RA table               |
287  |         p_freight_applied       - Part of the applied amount applied to   |
288  |                                   freight, This field will populate       |
289  |                                   FREIGHT_REMAINING in RA table           |
290  |         p_line_applied          - Part of the applied amount applied to   |
291  |                                   lines, This field will populate         |
292  |                                   LINE_REMAINING in RA table              |
293  |         p_charges_applied       - Part of the applied amount applied to   |
294  |                                   receivable charges, This field will     |
295  |                                   populate CHARGES_REMAINING in RA        |
296  |                                   table                                   |
297  |                                                                           |
298  | HISTORY - Created By - Ganesh Vaidee - 08/24/1995                         |
299  |                                                                           |
300  +===========================================================================*/
301 PROCEDURE update_cm_related_columns(
302                 p_ps_id   IN ar_payment_schedules.payment_schedule_id%TYPE,
303                 p_amount_applied IN ar_payment_schedules.amount_applied%TYPE,
304                 p_line_applied IN ar_receivable_applications.line_applied%TYPE,
305                 p_tax_applied IN ar_receivable_applications.tax_applied%TYPE,
306                 p_freight_applied IN
307                             ar_receivable_applications.freight_applied%TYPE,
308                 p_charges_applied  IN
309                    ar_receivable_applications.receivables_charges_applied%TYPE,
310                 p_apply_date IN ar_payment_schedules.gl_date%TYPE,
311                 p_gl_date IN ar_payment_schedules.gl_date%TYPE,
312                 p_acctd_amount_applied  OUT NOCOPY
313                         ar_receivable_applications.acctd_amount_applied_to%TYPE,
314                 p_ps_rec IN ar_payment_schedules%ROWTYPE,
315 		p_update_credit_flag IN VARCHAR2 DEFAULT NULL );
316 --
317 /*===========================================================================+
318  | PROCEDURE                                                                 |
319  |    update_adj_related_columns                                             |
320  |                                                                           |
321  | DESCRIPTION                                                               |
322  |      This procedure updates the Adjustments related rows of a PS record   |
323  |      The passed in PS ID is assumed to belong to an adjustment. Procedure |
324  |      sets the gl_date and gl_date_closed and amount(s) applied. The       |
325  |      procedure should be called whenever an invoice is adjusted.          |
326  |                                                                           |
327  | PARAMETERS :                                                              |
328  |   IN :  p_payment_schedule_id - payment_schedule_id of payment            |
329  |                                 schedule                                  |
330  |         p_gldate              - GL date of the receipt                    |
331  |         p_apply_date          - Apply Date of the receipt                 |
332  |         p_tax_adjusted        - Part of the adjusted amount to be applied |
333  |                                 to tax                                    |
334  |         p_freight_applied     - Part of the adjusted amount to be applied |
335  |                                 to freight                                |
336  |         p_line_applied        - Part of the adjusted amount to be applied |
337  |                                 to lines                                  |
338  |         p_charges_applied     - Part of the adjusted amount to be applied |
339  |                                 to receivable charges                     |
340  |         p_amount_adjusted_pending - Amount adjsuted pending if any.       |
341  |                                                                           |
342  | NOTES - At present this is an overloaded procedure                        |
343  |                                                                           |
344  | HISTORY - Created By - Ganesh Vaidee - 08/24/1995                         |
345  |                                                                           |
346  +===========================================================================*/
347 PROCEDURE update_adj_related_columns(
348                 p_ps_id            IN ar_payment_schedules.payment_schedule_id%TYPE,
349                 p_line_adjusted    IN ar_receivable_applications.line_applied%TYPE,
350                 p_tax_adjusted     IN ar_receivable_applications.tax_applied%TYPE,
351                 p_freight_adjusted IN ar_receivable_applications.freight_applied%TYPE,
352                 p_charges_adjusted IN ar_receivable_applications.receivables_charges_applied%TYPE,
353                 p_amount_adjusted_pending IN ar_payment_schedules.amount_adjusted_pending%TYPE,
354                 p_apply_date       IN ar_payment_schedules.gl_date%TYPE,
355                 p_gl_date          IN ar_payment_schedules.gl_date%TYPE,
356                 p_acctd_amount_adjusted  OUT NOCOPY ar_receivable_applications.acctd_amount_applied_to%TYPE,
357                 p_ps_rec           IN  OUT NOCOPY ar_payment_schedules%ROWTYPE);
358 
359 -- deleted 'DEFAULT NULL' for p_ps_rec Rowtype attribute -bug460979 for Oracle8
360 --
361 /*===========================================================================+
362  | PROCEDURE                                                                 |
363  |    update_adj_related_columns                                             |
364  |                                                                           |
365  | DESCRIPTION                                                               |
366  |      This procedure updates the Adjustments related rows of a PS record   |
367  |      The passed in PS ID is assumed to belong to an adjustment. Procedure |
368  |      sets the gl_date and gl_date_closed and amount(s) applied. The       |
369  |      procedure should be called whenever an invoice is adjusted.          |
370  |      In case of an invoice adjustment, the procedure also calculates the  |
371  |      line_adjusted, tax_adjusted, charges_adjusted and freight_adjusted   |
372  |      amounts.                                                             |
373  |                                                                           |
374  | SCOPE - PUBLIC                                                            |
375  |                                                                           |
376  | PARAMETERS :                                                              |
377  |   IN :  p_payment_schedule_id - payment_schedule_id of payment            |
378  |                                 schedule                                  |
379  |         p_type                - Adjustment type - valid values are        |
380  |                                 'INVOICE', 'FREIGHT', 'TAX', 'LINE',      |
381  |                                 'CHARGES', NULL(In case of pendings only) |
382  |                                 There is no explicit check to make sure   |
383  |                                 that the type value is one of the above   |
384  |         p_gldate              - GL date of the receipt                    |
385  |         p_apply_date          - Apply Date of the receipt                 |
386  |         p_amount_adjusted     - Amount adjusted if type is not 'INVOICE'  |
387  |         p_amount_adjusted_pending - Amount adjusted pending if any.       |
388  |   IN :  p_line_adjusted       - Line adjusted - In case of INVOICE adj.   |
389  |         p_tax_adjusted        - Tax  adjusted - In case of INVOICE adj.   |
390  |         p_charges_adjusted    - charges adjusted - In case of INVOICE adj.|
391  |         p_freight_adjusted    - freight adjusted - In case of INVOICE adj.|
392  |                                                                           |
393  | EXTERNAL PROCEDURES/FUNCTION						     |
394  |        arp_util.calc_acctd_amount and arp_util.debug                      |
395  |        arp_ps_pkg.fetch_p and arp_ps_pkg.update_p                         |
396  |                                                                           |
397  | NOTES - At present this is an overloaded procedure                        |
398  |                                                                           |
399  | HISTORY - Created By - Ganesh Vaidee - 08/24/1995                         |
400  | 02/03/2000   Saloni Shah     Modified parameter p_freight_adjusted to be  |
401  |				IN OUT NOCOPY in update_adj_related_columns         |
402  |                                                                           |
403  +===========================================================================*/
404 PROCEDURE update_adj_related_columns(
405                 p_ps_id           IN ar_payment_schedules.payment_schedule_id%TYPE,
406                 p_type            IN ar_adjustments.type%TYPE,
407                 p_amount_adjusted IN ar_payment_schedules.amount_adjusted%TYPE,
408                 p_amount_adjusted_pending IN ar_payment_schedules.amount_adjusted_pending%TYPE,
409                 p_line_adjusted    IN OUT NOCOPY ar_receivable_applications.line_applied%TYPE,
410                 p_tax_adjusted     IN OUT NOCOPY ar_receivable_applications.tax_applied%TYPE,
411                 p_freight_adjusted IN OUT NOCOPY ar_receivable_applications.freight_applied%TYPE,
412                 p_charges_adjusted IN OUT NOCOPY ar_receivable_applications.receivables_charges_applied%TYPE,
413                 p_apply_date       IN ar_payment_schedules.gl_date%TYPE,
414                 p_gl_date          IN ar_payment_schedules.gl_date%TYPE,
415                 p_acctd_amount_adjusted OUT NOCOPY ar_receivable_applications.acctd_amount_applied_to%TYPE,
416                 p_ps_rec           IN OUT NOCOPY ar_payment_schedules%ROWTYPE);
417 --
418 -- deleted 'DEFAULT NULL' for p_ps_rec Rowtype attribute -bug460979 for Oracle8
419 
420 /*===========================================================================+
421  | PROCEDURE                                                                 |
422  |    Get gl_date_closed and actual_date_closed                              |
423  |                                                                           |
424  | DESCRIPTION                                                               |
425  |      Determines gl_date_closed and actual_date_closed for a payment       |
426  |      schedule. For each of the two, it returns the greatest date from     |
427  |      ar_receivable_applications, ar_adjustments, and the input current    |
428  |      date. If it finds no values for a date, a null string is returned.   |
429  |                                                                           |
430  |      NOTE: This function does not correctly handle applications for future|
431  |      items or future cash receipts. If an application or adjustment that  |
432  |      closes an item has gl_date/apply_date less than the item's           |
433  |      gl_date/trx_date or the cash receipt's gl_date/deposit_date, then the|
434  |      gl_date_closed/actual_date_closed should be the greatest dates - the |
435  |      ones from the item or cash receipt. The dates returned by armclps    |
436  |      will be less than the correct ones because this function selects     |
437  |      only from ar_receivable_applications, ar_adjustments and the input   |
438  |      "current" dates.
439  |                                                                           |
440  |                                                                           |
441  | SCOPE - PUBLIC                                                            |
442  |                                                                           |
443  | PARAMETERS : p_payment_schedule_id - payment_schedule_id of payment       |
444  |              schedule                                                     |
445  |              p_gl_reversal_date - gl_date of current uncommitted          |
446  |                                   transaction                             |
447  |              p_reversal_date - apply date of current uncommitted xtion    |
448  |              p_gl_date_closed - greatest of ar_adjustments.gl_date,       |
449  |                                ar_receivable_applications.gl_date, and    |
450  |                                current_gl_date.                           |
451  |              p_actual_date_closed - (output) greatest of                  |
452  |                                   ar_adjustments.apply_date,              |
453  |                                   ar_receivable_applications.apply_date,  |
454  |                                   and current_apply_date.                 |
455  |                                                                           |
456  +===========================================================================*/
457 PROCEDURE get_closed_dates( p_ps_id 		IN NUMBER,
458                            p_gl_reversal_date 	IN DATE,
459                            p_reversal_date 	IN DATE,
460                            p_gl_date_closed 	OUT NOCOPY DATE,
461                            p_actual_date_closed OUT NOCOPY DATE ,
462                            p_app_type 		IN CHAR );
463 
464 /*===========================================================================+
465  | PROCEDURE                                                                 |
466  |    populate_closed_dates                                                  |
467  |                                                                           |
468  | DESCRIPTION                                                               |
469  |      This procedure takes in a payment schedule record structure, gl_date |
470  |      apply_date, application type and populates the payment schedule      |
471  |      record structure with gl_date_closed and   actual_date_closed        |
472  |                                                                           |
473  | SCOPE - PUBLIC                                                            |
474  |                                                                           |
475  | PARAMETERS :                                                              |
476  |    IN : p_gldate              - GL date of the receipt                    |
477  |         p_apply_date          - Apply Date of the receipt                 |
478  |         p_app_type            - Application Type - 'CASH', 'CM', 'INV'    |
479  |                                 'ADJ'                                     |
480  | IN/OUT: p_ps_rec               - Payment Schedule record                  |
481  |                                 PS id to be populated in input PS record  |
482  |                                                                           |
483  | EXTERNAL PROCEDURES/FUNCTION                                              |
484  |        get_closed_dates - This procedure is in this package               |
485  |                                                                           |
486  | NOTES - Expectes PS id to be populated in input PS record                 |
487  |                                                                           |
488  | HISTORY - Created By - Ganesh Vaidee - 08/24/1995                         |
489  | 16-APR-98 GJWANG       Bug Fix: 653643 declare this as public procedure   |
490  |                                                                           |
491  +===========================================================================*/
492 PROCEDURE populate_closed_dates(
493               p_gl_date IN ar_payment_schedules.gl_date%TYPE,
494               p_apply_date IN ar_payment_schedules.gl_date%TYPE,
495               p_app_type  IN VARCHAR2,
496               p_ps_rec IN OUT NOCOPY ar_payment_schedules%ROWTYPE );
497 
498 
499 END ARP_PS_UTIL;