DBA Data[Home] [Help]

PACKAGE: APPS.ARP_PS_UTIL

Source


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