154: l_total_unapp_acctd_amount NUMBER;
155: l_rec_in_doubt VARCHAR2(1):='N';
156: l_rid_reason VARCHAR2(2000):= null;
157: l_mult_pmt_types_msg VARCHAR2(2000):=
158: arp_standard.fnd_message('AR_RID_MULTIPLE_PMT_TYPES');
159: l_min_ref_amt_msg VARCHAR2(2000):=
160: arp_standard.fnd_message('AR_RID_OAPP_LT_MIN_REF_AMT');
161: l_split_term_with_bal_msg VARCHAR2(2000):=
162: arp_standard.fnd_message('AR_RID_SPLIT_TERM_WITH_BAL');
156: l_rid_reason VARCHAR2(2000):= null;
157: l_mult_pmt_types_msg VARCHAR2(2000):=
158: arp_standard.fnd_message('AR_RID_MULTIPLE_PMT_TYPES');
159: l_min_ref_amt_msg VARCHAR2(2000):=
160: arp_standard.fnd_message('AR_RID_OAPP_LT_MIN_REF_AMT');
161: l_split_term_with_bal_msg VARCHAR2(2000):=
162: arp_standard.fnd_message('AR_RID_SPLIT_TERM_WITH_BAL');
163: l_amt_lt_min_ref_amt_msg VARCHAR2(2000):=
164: arp_standard.fnd_message('AR_RID_OAPP_LT_MIN_REF_AMT');
158: arp_standard.fnd_message('AR_RID_MULTIPLE_PMT_TYPES');
159: l_min_ref_amt_msg VARCHAR2(2000):=
160: arp_standard.fnd_message('AR_RID_OAPP_LT_MIN_REF_AMT');
161: l_split_term_with_bal_msg VARCHAR2(2000):=
162: arp_standard.fnd_message('AR_RID_SPLIT_TERM_WITH_BAL');
163: l_amt_lt_min_ref_amt_msg VARCHAR2(2000):=
164: arp_standard.fnd_message('AR_RID_OAPP_LT_MIN_REF_AMT');
165: i NUMBER(15):= 0;
166:
160: arp_standard.fnd_message('AR_RID_OAPP_LT_MIN_REF_AMT');
161: l_split_term_with_bal_msg VARCHAR2(2000):=
162: arp_standard.fnd_message('AR_RID_SPLIT_TERM_WITH_BAL');
163: l_amt_lt_min_ref_amt_msg VARCHAR2(2000):=
164: arp_standard.fnd_message('AR_RID_OAPP_LT_MIN_REF_AMT');
165: i NUMBER(15):= 0;
166:
167: BEGIN
168: --
166:
167: BEGIN
168: --
169: IF PG_DEBUG in ('Y', 'C') THEN
170: arp_standard.debug('arp_process_returns.process_invoice_list()+ ');
171: END IF;
172: --
173: -- Check if there are any Invoices to process in the list
174: --
173: -- Check if there are any Invoices to process in the list
174: --
175: IF inv_info.COUNT = 0 THEN
176: IF PG_DEBUG in ('Y', 'C') THEN
177: arp_standard.debug('No Invoice in the list to process..');
178: END IF;
179: GOTO after_loop;
180: END IF;
181: --
186: WHILE i IS NOT NULL
187: LOOP
188: --
189: IF PG_DEBUG in ('Y', 'C') THEN
190: arp_standard.debug('INV Customer Trx ID [' || i || ']');
191: END IF;
192: --
193: FOR c01_rec IN c01 (i) LOOP
194: --
192: --
193: FOR c01_rec IN c01 (i) LOOP
194: --
195: IF PG_DEBUG in ('Y', 'C') THEN
196: arp_standard.debug('CM count [' || inv_info(i).num_of_cms || ']');
197: arp_standard.debug('Inv Balance [' || c01_rec.inv_balance || ']');
198: arp_standard.debug('PS count [' || c01_rec.ps_count || ']');
199: arp_standard.debug('Inv App Amount [' ||
200: c01_rec.inv_app_amount || ']');
193: FOR c01_rec IN c01 (i) LOOP
194: --
195: IF PG_DEBUG in ('Y', 'C') THEN
196: arp_standard.debug('CM count [' || inv_info(i).num_of_cms || ']');
197: arp_standard.debug('Inv Balance [' || c01_rec.inv_balance || ']');
198: arp_standard.debug('PS count [' || c01_rec.ps_count || ']');
199: arp_standard.debug('Inv App Amount [' ||
200: c01_rec.inv_app_amount || ']');
201: arp_standard.debug('Commitment Adj amt [' ||
194: --
195: IF PG_DEBUG in ('Y', 'C') THEN
196: arp_standard.debug('CM count [' || inv_info(i).num_of_cms || ']');
197: arp_standard.debug('Inv Balance [' || c01_rec.inv_balance || ']');
198: arp_standard.debug('PS count [' || c01_rec.ps_count || ']');
199: arp_standard.debug('Inv App Amount [' ||
200: c01_rec.inv_app_amount || ']');
201: arp_standard.debug('Commitment Adj amt [' ||
202: c01_rec.cmt_adj_amount || ']');
195: IF PG_DEBUG in ('Y', 'C') THEN
196: arp_standard.debug('CM count [' || inv_info(i).num_of_cms || ']');
197: arp_standard.debug('Inv Balance [' || c01_rec.inv_balance || ']');
198: arp_standard.debug('PS count [' || c01_rec.ps_count || ']');
199: arp_standard.debug('Inv App Amount [' ||
200: c01_rec.inv_app_amount || ']');
201: arp_standard.debug('Commitment Adj amt [' ||
202: c01_rec.cmt_adj_amount || ']');
203: arp_standard.debug('Adj amt [' || c01_rec.adj_amount || ']');
197: arp_standard.debug('Inv Balance [' || c01_rec.inv_balance || ']');
198: arp_standard.debug('PS count [' || c01_rec.ps_count || ']');
199: arp_standard.debug('Inv App Amount [' ||
200: c01_rec.inv_app_amount || ']');
201: arp_standard.debug('Commitment Adj amt [' ||
202: c01_rec.cmt_adj_amount || ']');
203: arp_standard.debug('Adj amt [' || c01_rec.adj_amount || ']');
204: arp_standard.debug('CM amt [' || c01_rec.cm_amount || ']');
205: END IF;
199: arp_standard.debug('Inv App Amount [' ||
200: c01_rec.inv_app_amount || ']');
201: arp_standard.debug('Commitment Adj amt [' ||
202: c01_rec.cmt_adj_amount || ']');
203: arp_standard.debug('Adj amt [' || c01_rec.adj_amount || ']');
204: arp_standard.debug('CM amt [' || c01_rec.cm_amount || ']');
205: END IF;
206: --
207: -- If adjustment exists then raise exception ***/
200: c01_rec.inv_app_amount || ']');
201: arp_standard.debug('Commitment Adj amt [' ||
202: c01_rec.cmt_adj_amount || ']');
203: arp_standard.debug('Adj amt [' || c01_rec.adj_amount || ']');
204: arp_standard.debug('CM amt [' || c01_rec.cm_amount || ']');
205: END IF;
206: --
207: -- If adjustment exists then raise exception ***/
208: --
206: --
207: -- If adjustment exists then raise exception ***/
208: --
209: IF c01_rec.adj_amount <> 0 THEN
210: arp_standard.debug('arp_process_returns.process_invoice_list : ' ||
211: 'adj_EXCEPTION customer_trx_id <' || c01_rec.inv_customer_trx_id ||
212: '>');
213: RAISE adj_exception;
214: END IF;
227: --
228: -- If Total Unapp amount > Applied amount then raise exception
229: --
230: IF l_total_unapp_amount > (c01_rec.inv_app_amount) THEN
231: arp_standard.debug('arp_process_returns.process_invoice_list : ' ||
232: 'overapp_EXCEPTION customer_trx_id <'
233: || c01_rec.inv_customer_trx_id || '>');
234: arp_standard.debug('Inv Balance : <' || c01_rec.inv_balance);
235: arp_standard.debug('Inv App Amount : <' || c01_rec.inv_app_amount);
230: IF l_total_unapp_amount > (c01_rec.inv_app_amount) THEN
231: arp_standard.debug('arp_process_returns.process_invoice_list : ' ||
232: 'overapp_EXCEPTION customer_trx_id <'
233: || c01_rec.inv_customer_trx_id || '>');
234: arp_standard.debug('Inv Balance : <' || c01_rec.inv_balance);
235: arp_standard.debug('Inv App Amount : <' || c01_rec.inv_app_amount);
236: arp_standard.debug('Cmt Adj Amount : <' || c01_rec.cmt_adj_amount);
237: arp_standard.debug('CM Amount : <' || c01_rec.cm_amount);
238: RAISE overapp_exception;
231: arp_standard.debug('arp_process_returns.process_invoice_list : ' ||
232: 'overapp_EXCEPTION customer_trx_id <'
233: || c01_rec.inv_customer_trx_id || '>');
234: arp_standard.debug('Inv Balance : <' || c01_rec.inv_balance);
235: arp_standard.debug('Inv App Amount : <' || c01_rec.inv_app_amount);
236: arp_standard.debug('Cmt Adj Amount : <' || c01_rec.cmt_adj_amount);
237: arp_standard.debug('CM Amount : <' || c01_rec.cm_amount);
238: RAISE overapp_exception;
239: END IF;
232: 'overapp_EXCEPTION customer_trx_id <'
233: || c01_rec.inv_customer_trx_id || '>');
234: arp_standard.debug('Inv Balance : <' || c01_rec.inv_balance);
235: arp_standard.debug('Inv App Amount : <' || c01_rec.inv_app_amount);
236: arp_standard.debug('Cmt Adj Amount : <' || c01_rec.cmt_adj_amount);
237: arp_standard.debug('CM Amount : <' || c01_rec.cm_amount);
238: RAISE overapp_exception;
239: END IF;
240:
233: || c01_rec.inv_customer_trx_id || '>');
234: arp_standard.debug('Inv Balance : <' || c01_rec.inv_balance);
235: arp_standard.debug('Inv App Amount : <' || c01_rec.inv_app_amount);
236: arp_standard.debug('Cmt Adj Amount : <' || c01_rec.cmt_adj_amount);
237: arp_standard.debug('CM Amount : <' || c01_rec.cm_amount);
238: RAISE overapp_exception;
239: END IF;
240:
241: --
316:
317: END IF; -- receipt_handling option
318: --
319: IF PG_DEBUG in ('Y', 'C') THEN
320: arp_standard.debug('Calling unapply_receipts...');
321: arp_standard.debug('Inv Customer Trx ID [' ||
322: c01_rec.inv_customer_trx_id || ']');
323: arp_standard.debug('RecHandOption [' ||
324: c01_rec.receipt_handling_option || ']');
317: END IF; -- receipt_handling option
318: --
319: IF PG_DEBUG in ('Y', 'C') THEN
320: arp_standard.debug('Calling unapply_receipts...');
321: arp_standard.debug('Inv Customer Trx ID [' ||
322: c01_rec.inv_customer_trx_id || ']');
323: arp_standard.debug('RecHandOption [' ||
324: c01_rec.receipt_handling_option || ']');
325: arp_standard.debug('Unapp amount [' || l_total_unapp_amount || ']');
319: IF PG_DEBUG in ('Y', 'C') THEN
320: arp_standard.debug('Calling unapply_receipts...');
321: arp_standard.debug('Inv Customer Trx ID [' ||
322: c01_rec.inv_customer_trx_id || ']');
323: arp_standard.debug('RecHandOption [' ||
324: c01_rec.receipt_handling_option || ']');
325: arp_standard.debug('Unapp amount [' || l_total_unapp_amount || ']');
326: arp_standard.debug('RID Reason [' || inv_info(i).rid_reason || ']');
327: IF inv_info(i).all_recs_in_doubt THEN
321: arp_standard.debug('Inv Customer Trx ID [' ||
322: c01_rec.inv_customer_trx_id || ']');
323: arp_standard.debug('RecHandOption [' ||
324: c01_rec.receipt_handling_option || ']');
325: arp_standard.debug('Unapp amount [' || l_total_unapp_amount || ']');
326: arp_standard.debug('RID Reason [' || inv_info(i).rid_reason || ']');
327: IF inv_info(i).all_recs_in_doubt THEN
328: arp_standard.debug('Rec In doubt ');
329: ELSE
322: c01_rec.inv_customer_trx_id || ']');
323: arp_standard.debug('RecHandOption [' ||
324: c01_rec.receipt_handling_option || ']');
325: arp_standard.debug('Unapp amount [' || l_total_unapp_amount || ']');
326: arp_standard.debug('RID Reason [' || inv_info(i).rid_reason || ']');
327: IF inv_info(i).all_recs_in_doubt THEN
328: arp_standard.debug('Rec In doubt ');
329: ELSE
330: arp_standard.debug('Rec NOT In doubt ');
324: c01_rec.receipt_handling_option || ']');
325: arp_standard.debug('Unapp amount [' || l_total_unapp_amount || ']');
326: arp_standard.debug('RID Reason [' || inv_info(i).rid_reason || ']');
327: IF inv_info(i).all_recs_in_doubt THEN
328: arp_standard.debug('Rec In doubt ');
329: ELSE
330: arp_standard.debug('Rec NOT In doubt ');
331: END IF;
332: END IF;
326: arp_standard.debug('RID Reason [' || inv_info(i).rid_reason || ']');
327: IF inv_info(i).all_recs_in_doubt THEN
328: arp_standard.debug('Rec In doubt ');
329: ELSE
330: arp_standard.debug('Rec NOT In doubt ');
331: END IF;
332: END IF;
333:
334: --
348: --
349: <
350: --
351: IF PG_DEBUG in ('Y', 'C') THEN
352: arp_standard.debug('arp_process_RETURNS.process_invoice_list()- ');
353: END IF;
354: EXCEPTION
355: WHEN OTHERS THEN
356: arp_standard.debug('EXCEPTION : arp_process_returns.process_invoice_list : ' || SQLERRM(SQLCODE));
352: arp_standard.debug('arp_process_RETURNS.process_invoice_list()- ');
353: END IF;
354: EXCEPTION
355: WHEN OTHERS THEN
356: arp_standard.debug('EXCEPTION : arp_process_returns.process_invoice_list : ' || SQLERRM(SQLCODE));
357: RAISE;
358: END process_invoice_list;
359:
360: /*========================================================================
422: l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
423: l_msg_count NUMBER;
424: l_msg_data VARCHAR2(2000);
425: l_app_comments ar_receivable_applications.comments%type :=
426: arp_standard.fnd_message('AR_RID_PROCESSED_AS_PER_REQ');
427: l_application_ref_type ar_receivable_applications.application_ref_type%type;
428: l_application_ref_id ar_receivable_applications.application_ref_id%type;
429: l_application_ref_num ar_receivable_applications.application_ref_num%type;
430: l_receivable_application_id ar_receivable_applications.receivable_application_id%type;
434: l_dff_rec ar_receipt_api_pub.attribute_rec_type;
435: l_party_id hz_parties.party_id%type;
436: BEGIN
437: IF PG_DEBUG in ('Y', 'C') THEN
438: arp_standard.debug('arp_process_returns.process_application_list()+ ');
439: END IF;
440: --
441: -- Check if there are any applications to process in the list
442: --
441: -- Check if there are any applications to process in the list
442: --
443: IF app_info.COUNT = 0 THEN
444: IF PG_DEBUG in ('Y', 'C') THEN
445: arp_standard.debug('No Application in the list to process..');
446: END IF;
447: GOTO after_loop;
448: END IF;
449: --
454: --
455: --
456: --
457: IF PG_DEBUG in ('Y', 'C') THEN
458: arp_standard.debug('INV Customer Trx ID [' ||
459: app_tab(i).applied_customer_trx_id || ']');
460: arp_standard.debug('rec_proc_option [' ||
461: app_info(i).rec_proc_option || ']');
462: arp_standard.debug('rec_in_doubt [' ||
456: --
457: IF PG_DEBUG in ('Y', 'C') THEN
458: arp_standard.debug('INV Customer Trx ID [' ||
459: app_tab(i).applied_customer_trx_id || ']');
460: arp_standard.debug('rec_proc_option [' ||
461: app_info(i).rec_proc_option || ']');
462: arp_standard.debug('rec_in_doubt [' ||
463: app_info(i).rec_in_doubt || ']');
464: arp_standard.debug('rec_currency_code [' ||
458: arp_standard.debug('INV Customer Trx ID [' ||
459: app_tab(i).applied_customer_trx_id || ']');
460: arp_standard.debug('rec_proc_option [' ||
461: app_info(i).rec_proc_option || ']');
462: arp_standard.debug('rec_in_doubt [' ||
463: app_info(i).rec_in_doubt || ']');
464: arp_standard.debug('rec_currency_code [' ||
465: app_info(i).rec_currency_code || ']');
466: arp_standard.debug('inv_currency_code [' ||
460: arp_standard.debug('rec_proc_option [' ||
461: app_info(i).rec_proc_option || ']');
462: arp_standard.debug('rec_in_doubt [' ||
463: app_info(i).rec_in_doubt || ']');
464: arp_standard.debug('rec_currency_code [' ||
465: app_info(i).rec_currency_code || ']');
466: arp_standard.debug('inv_currency_code [' ||
467: app_info(i).inv_currency_code || ']');
468: arp_standard.debug('rid_reason [' ||
462: arp_standard.debug('rec_in_doubt [' ||
463: app_info(i).rec_in_doubt || ']');
464: arp_standard.debug('rec_currency_code [' ||
465: app_info(i).rec_currency_code || ']');
466: arp_standard.debug('inv_currency_code [' ||
467: app_info(i).inv_currency_code || ']');
468: arp_standard.debug('rid_reason [' ||
469: app_info(i).rid_reason || ']');
470: arp_standard.debug('trx_number [' ||
464: arp_standard.debug('rec_currency_code [' ||
465: app_info(i).rec_currency_code || ']');
466: arp_standard.debug('inv_currency_code [' ||
467: app_info(i).inv_currency_code || ']');
468: arp_standard.debug('rid_reason [' ||
469: app_info(i).rid_reason || ']');
470: arp_standard.debug('trx_number [' ||
471: app_info(i).trx_number || ']');
472: END IF;
466: arp_standard.debug('inv_currency_code [' ||
467: app_info(i).inv_currency_code || ']');
468: arp_standard.debug('rid_reason [' ||
469: app_info(i).rid_reason || ']');
470: arp_standard.debug('trx_number [' ||
471: app_info(i).trx_number || ']');
472: END IF;
473: --
474: FOR c01_rec IN c01 (app_tab(i).applied_payment_schedule_id)
474: FOR c01_rec IN c01 (app_tab(i).applied_payment_schedule_id)
475: LOOP
476: --
477: IF PG_DEBUG in ('Y', 'C') THEN
478: arp_standard.debug('Inv Balance [' || c01_rec.inv_balance || ']');
479: arp_standard.debug('Inv Customer Trx Id [' || c01_rec.inv_customer_trx_id || ']');
480: END IF;
481: --
482: -- Compute reapply amount ** 1 **
475: LOOP
476: --
477: IF PG_DEBUG in ('Y', 'C') THEN
478: arp_standard.debug('Inv Balance [' || c01_rec.inv_balance || ']');
479: arp_standard.debug('Inv Customer Trx Id [' || c01_rec.inv_customer_trx_id || ']');
480: END IF;
481: --
482: -- Compute reapply amount ** 1 **
483: --
486:
487:
488:
489: IF PG_DEBUG in ('Y', 'C') THEN
490: arp_standard.debug(' l_reapply_amount [' || l_reapply_amount || ']');
491: END IF;
492:
493: IF l_reapply_amount > 0 THEN
494: --
506: --
507: END IF;
508:
509: IF PG_DEBUG in ('Y', 'C') THEN
510: arp_standard.debug(' l_new_apply_amount [' || l_new_apply_amount || ']');
511: END IF;
512:
513:
514: --
523: --
524: -- Re-apply to the application to the same invoice
525: --
526: IF PG_DEBUG in ('Y', 'C') THEN
527: arp_standard.debug('Re-apply back to invoice ps[' ||
528: app_tab(i).applied_payment_schedule_id ||'] : <' ||
529: l_reapply_amount|| '>');
530: END IF;
531: --
555:
556: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
557:
558: IF (l_msg_count = 1) THEN
559: arp_standard.debug('Apply: ' || l_MSG_DATA);
560: ELSIF(l_MSG_COUNT>1)THEN
561: LOOP
562: l_MSG_DATA:=FND_MSG_PUB.GET(p_encoded=>FND_API.G_FALSE);
563: IF (l_MSG_DATA IS NULL)THEN
562: l_MSG_DATA:=FND_MSG_PUB.GET(p_encoded=>FND_API.G_FALSE);
563: IF (l_MSG_DATA IS NULL)THEN
564: EXIT;
565: END IF;
566: arp_standard.debug('Apply : ' || l_MSG_DATA);
567: END LOOP;
568: END IF;
569:
570: arp_standard.debug('Apply failed');
566: arp_standard.debug('Apply : ' || l_MSG_DATA);
567: END LOOP;
568: END IF;
569:
570: arp_standard.debug('Apply failed');
571:
572: RAISE l_apply_failed;
573:
574: END IF;
593: --
594: IF app_info(i).cross_currency THEN
595: --
596: IF PG_DEBUG in ('Y', 'C') THEN
597: arp_standard.debug('Cross Currency');
598: arp_standard.debug('Re-apply Amount :' || l_reapply_amount);
599: arp_standard.debug('New-apply Amount :' || l_new_apply_amount);
600: arp_standard.debug('T->R Rate :' ||
601: app_tab(i).trans_to_receipt_rate);
594: IF app_info(i).cross_currency THEN
595: --
596: IF PG_DEBUG in ('Y', 'C') THEN
597: arp_standard.debug('Cross Currency');
598: arp_standard.debug('Re-apply Amount :' || l_reapply_amount);
599: arp_standard.debug('New-apply Amount :' || l_new_apply_amount);
600: arp_standard.debug('T->R Rate :' ||
601: app_tab(i).trans_to_receipt_rate);
602: arp_standard.debug('Currency REC :' ||
595: --
596: IF PG_DEBUG in ('Y', 'C') THEN
597: arp_standard.debug('Cross Currency');
598: arp_standard.debug('Re-apply Amount :' || l_reapply_amount);
599: arp_standard.debug('New-apply Amount :' || l_new_apply_amount);
600: arp_standard.debug('T->R Rate :' ||
601: app_tab(i).trans_to_receipt_rate);
602: arp_standard.debug('Currency REC :' ||
603: app_info(i).rec_currency_code);
596: IF PG_DEBUG in ('Y', 'C') THEN
597: arp_standard.debug('Cross Currency');
598: arp_standard.debug('Re-apply Amount :' || l_reapply_amount);
599: arp_standard.debug('New-apply Amount :' || l_new_apply_amount);
600: arp_standard.debug('T->R Rate :' ||
601: app_tab(i).trans_to_receipt_rate);
602: arp_standard.debug('Currency REC :' ||
603: app_info(i).rec_currency_code);
604: END IF;
598: arp_standard.debug('Re-apply Amount :' || l_reapply_amount);
599: arp_standard.debug('New-apply Amount :' || l_new_apply_amount);
600: arp_standard.debug('T->R Rate :' ||
601: app_tab(i).trans_to_receipt_rate);
602: arp_standard.debug('Currency REC :' ||
603: app_info(i).rec_currency_code);
604: END IF;
605: --
606: /***
616: l_new_apply_amount_fr;
617: --
618: ELSE
619: IF PG_DEBUG in ('Y', 'C') THEN
620: arp_standard.debug('Not Cross Currency');
621: arp_standard.debug('Old Amount Applied :' ||
622: app_tab(i).amount_applied );
623: arp_standard.debug('New Amount Applied :' ||
624: l_new_apply_amount);
617: --
618: ELSE
619: IF PG_DEBUG in ('Y', 'C') THEN
620: arp_standard.debug('Not Cross Currency');
621: arp_standard.debug('Old Amount Applied :' ||
622: app_tab(i).amount_applied );
623: arp_standard.debug('New Amount Applied :' ||
624: l_new_apply_amount);
625: END IF;
619: IF PG_DEBUG in ('Y', 'C') THEN
620: arp_standard.debug('Not Cross Currency');
621: arp_standard.debug('Old Amount Applied :' ||
622: app_tab(i).amount_applied );
623: arp_standard.debug('New Amount Applied :' ||
624: l_new_apply_amount);
625: END IF;
626: l_ch_apply_amount_fr := app_tab(i).amount_applied -
627: l_new_apply_amount;
627: l_new_apply_amount;
628: END IF;
629: --
630: IF PG_DEBUG in ('Y', 'C') THEN
631: arp_standard.debug('Change in App amount [' ||
632: app_tab(i).applied_payment_schedule_id ||'] : <' ||
633: l_ch_apply_amount_fr || '>');
634: END IF;
635: --
648: --
649: l_refunding := TRUE;
650: --
651: IF PG_DEBUG in ('Y', 'C') THEN
652: arp_standard.debug('Refunding...');
653: END IF;
654: --
655: -- Get receipt amount and old refund amounts from the receipt
656: --
660: x_refund_amount=>l_old_refund_amount,
661: x_rec_proc_option=> app_info(i).rec_proc_option);
662: --
663: IF PG_DEBUG in ('Y', 'C') THEN
664: arp_standard.debug('Cash Receipt Id ' ||
665: app_tab(i).cash_receipt_id ||'] : RecAmt<' ||
666: l_receipt_amount|| '>' );
667: arp_standard.debug('Old Refund Amount :[' ||
668: l_old_refund_amount ||']');
663: IF PG_DEBUG in ('Y', 'C') THEN
664: arp_standard.debug('Cash Receipt Id ' ||
665: app_tab(i).cash_receipt_id ||'] : RecAmt<' ||
666: l_receipt_amount|| '>' );
667: arp_standard.debug('Old Refund Amount :[' ||
668: l_old_refund_amount ||']');
669: END IF;
670: --
671: --
679: l_refund_amount := 0;
680: END IF;
681: --
682: IF PG_DEBUG in ('Y', 'C') THEN
683: arp_standard.debug('New Refund Amount [' || l_refund_amount || ']');
684: END IF;
685:
686: --GGADHAMS Added for Payment Refund
687: IF app_info(i).rec_in_doubt = 'N' AND
689: --
690: l_refunding := TRUE;
691: --
692: IF PG_DEBUG in ('Y', 'C') THEN
693: arp_standard.debug('Payment Refunding...');
694: END IF;
695: --
696: -- Get receipt amount and old refund amounts from the receipt
697: --
701: x_refund_amount=>l_old_refund_amount,
702: x_rec_proc_option=> app_info(i).rec_proc_option);
703: --
704: IF PG_DEBUG in ('Y', 'C') THEN
705: arp_standard.debug('Cash Receipt Id ' ||
706: app_tab(i).cash_receipt_id ||'] : RecAmt<' ||
707: l_receipt_amount|| '>' );
708: arp_standard.debug('Old Refund Amount :[' ||
709: l_old_refund_amount ||']');
704: IF PG_DEBUG in ('Y', 'C') THEN
705: arp_standard.debug('Cash Receipt Id ' ||
706: app_tab(i).cash_receipt_id ||'] : RecAmt<' ||
707: l_receipt_amount|| '>' );
708: arp_standard.debug('Old Refund Amount :[' ||
709: l_old_refund_amount ||']');
710: END IF;
711: --
712: --
720: l_pay_refund_amount := 0;
721: END IF;
722: --
723: IF PG_DEBUG in ('Y', 'C') THEN
724: arp_standard.debug('New Payment Refund Amount [' || l_pay_refund_amount || ']');
725: END IF;
726: --Added till here for Payment Refund
727: --
728:
732: --
733: l_on_account_amount := l_ch_apply_amount_fr - l_refund_amount - l_pay_refund_amount;
734: --
735: IF PG_DEBUG in ('Y', 'C') THEN
736: arp_standard.debug('On Account Amount [' ||
737: l_on_account_amount|| ']');
738: END IF;
739: --
740: --
742: --
743: IF l_refund_amount > 0 THEN
744: -- Apply to CCR
745: IF PG_DEBUG in ('Y', 'C') THEN
746: arp_standard.debug('Creating CCR application..');
747: arp_standard.debug('l_app_comments :[' || l_app_comments ||']');
748: END IF;
749: --
750: -- Initialize IN-OUT variables
743: IF l_refund_amount > 0 THEN
744: -- Apply to CCR
745: IF PG_DEBUG in ('Y', 'C') THEN
746: arp_standard.debug('Creating CCR application..');
747: arp_standard.debug('l_app_comments :[' || l_app_comments ||']');
748: END IF;
749: --
750: -- Initialize IN-OUT variables
751: --
786:
787: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
788:
789: IF (l_msg_count = 1) THEN
790: arp_standard.debug('ActivityApp: ' || l_MSG_DATA);
791: ELSIF(l_MSG_COUNT>1)THEN
792: LOOP
793: l_MSG_DATA:=FND_MSG_PUB.GET(p_encoded=>FND_API.G_FALSE);
794: IF (l_MSG_DATA IS NULL)THEN
793: l_MSG_DATA:=FND_MSG_PUB.GET(p_encoded=>FND_API.G_FALSE);
794: IF (l_MSG_DATA IS NULL)THEN
795: EXIT;
796: END IF;
797: arp_standard.debug('ActivityApp: ' || l_MSG_DATA);
798: END LOOP;
799: END IF;
800:
801: arp_standard.debug('ActivityApp failed');
797: arp_standard.debug('ActivityApp: ' || l_MSG_DATA);
798: END LOOP;
799: END IF;
800:
801: arp_standard.debug('ActivityApp failed');
802:
803: RAISE l_activity_app_failed;
804: END IF; -- Handle API errors
805: --
810: IF l_on_account_amount > 0 THEN
811: --
812: -- Apply to ON-ACCOUNT
813: IF PG_DEBUG in ('Y', 'C') THEN
814: arp_standard.debug('Creating ON-ACCOUNT application..');
815: arp_standard.debug('l_app_comments :[' || l_app_comments ||']');
816: arp_standard.debug('l_app_comments NVL:[' ||
817: NVL(app_info(i).rid_reason, l_app_comments) ||']');
818: END IF;
811: --
812: -- Apply to ON-ACCOUNT
813: IF PG_DEBUG in ('Y', 'C') THEN
814: arp_standard.debug('Creating ON-ACCOUNT application..');
815: arp_standard.debug('l_app_comments :[' || l_app_comments ||']');
816: arp_standard.debug('l_app_comments NVL:[' ||
817: NVL(app_info(i).rid_reason, l_app_comments) ||']');
818: END IF;
819: --
812: -- Apply to ON-ACCOUNT
813: IF PG_DEBUG in ('Y', 'C') THEN
814: arp_standard.debug('Creating ON-ACCOUNT application..');
815: arp_standard.debug('l_app_comments :[' || l_app_comments ||']');
816: arp_standard.debug('l_app_comments NVL:[' ||
817: NVL(app_info(i).rid_reason, l_app_comments) ||']');
818: END IF;
819: --
820: --
818: END IF;
819: --
820: --
821: IF l_refunding THEN
822: l_app_comments := arp_standard.fnd_message('AR_RID_TOTAL_REFUND_LIMIT');
823: END IF;
824: ar_receipt_api_pub.Apply_on_account(
825: p_api_version => 1.0,
826: x_return_status => l_return_status,
838: );
839: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
840:
841: IF (l_msg_count = 1) THEN
842: arp_standard.debug('OnaccountApp: ' || l_MSG_DATA);
843: ELSIF(l_MSG_COUNT>1)THEN
844: LOOP
845: l_MSG_DATA:=FND_MSG_PUB.GET(p_encoded=>FND_API.G_FALSE);
846: IF (l_MSG_DATA IS NULL)THEN
845: l_MSG_DATA:=FND_MSG_PUB.GET(p_encoded=>FND_API.G_FALSE);
846: IF (l_MSG_DATA IS NULL)THEN
847: EXIT;
848: END IF;
849: arp_standard.debug('OnaccountApp : ' || l_MSG_DATA);
850: END LOOP;
851: END IF;
852:
853: arp_standard.debug('OnaccountApp failed');
849: arp_standard.debug('OnaccountApp : ' || l_MSG_DATA);
850: END LOOP;
851: END IF;
852:
853: arp_standard.debug('OnaccountApp failed');
854:
855: RAISE l_on_account_app_failed;
856:
857: END IF;
865: IF l_pay_refund_amount > 0 THEN
866: --
867: -- Apply to PAYMENT REFUND
868: IF PG_DEBUG in ('Y', 'C') THEN
869: arp_standard.debug('Creating Payment Refund application..');
870: arp_standard.debug('l_app_comments :[' || l_app_comments ||']');
871: arp_standard.debug('l_app_comments NVL:[' ||
872: NVL(app_info(i).rid_reason, l_app_comments) ||']');
873: END IF;
866: --
867: -- Apply to PAYMENT REFUND
868: IF PG_DEBUG in ('Y', 'C') THEN
869: arp_standard.debug('Creating Payment Refund application..');
870: arp_standard.debug('l_app_comments :[' || l_app_comments ||']');
871: arp_standard.debug('l_app_comments NVL:[' ||
872: NVL(app_info(i).rid_reason, l_app_comments) ||']');
873: END IF;
874: --
867: -- Apply to PAYMENT REFUND
868: IF PG_DEBUG in ('Y', 'C') THEN
869: arp_standard.debug('Creating Payment Refund application..');
870: arp_standard.debug('l_app_comments :[' || l_app_comments ||']');
871: arp_standard.debug('l_app_comments NVL:[' ||
872: NVL(app_info(i).rid_reason, l_app_comments) ||']');
873: END IF;
874: --
875: ar_receipt_api_pub.activity_application(
896: );
897: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
898:
899: IF (l_msg_count = 1) THEN
900: arp_standard.debug('ActivityApp: ' || l_MSG_DATA);
901: ELSIF(l_MSG_COUNT>1)THEN
902: LOOP
903: l_MSG_DATA:=FND_MSG_PUB.GET(p_encoded=>FND_API.G_FALSE);
904: IF (l_MSG_DATA IS NULL)THEN
903: l_MSG_DATA:=FND_MSG_PUB.GET(p_encoded=>FND_API.G_FALSE);
904: IF (l_MSG_DATA IS NULL)THEN
905: EXIT;
906: END IF;
907: arp_standard.debug('ActivityApp: ' || l_MSG_DATA);
908: END LOOP;
909: END IF;
910:
911: arp_standard.debug('ActivityApp failed');
907: arp_standard.debug('ActivityApp: ' || l_MSG_DATA);
908: END LOOP;
909: END IF;
910:
911: arp_standard.debug('ActivityApp failed');
912:
913: RAISE l_activity_app_failed;
914: END IF; -- Handle API errors
915: --
925: --
926: <
927: --
928: IF PG_DEBUG in ('Y', 'C') THEN
929: arp_standard.debug('arp_process_RETURNS.process_application_list()- ');
930: END IF;
931: EXCEPTION
932: WHEN OTHERS THEN
933: arp_standard.debug('EXCEPTION : arp_process_returns.process_application_list : ' || SQLERRM(SQLCODE));
929: arp_standard.debug('arp_process_RETURNS.process_application_list()- ');
930: END IF;
931: EXCEPTION
932: WHEN OTHERS THEN
933: arp_standard.debug('EXCEPTION : arp_process_returns.process_application_list : ' || SQLERRM(SQLCODE));
934: RAISE;
935: END process_application_list;
936:
937: /*========================================================================
1045: l_ra_info app_info_type;
1046: l_rec_in_doubt VARCHAR2(1):='N';
1047: BEGIN
1048: IF PG_DEBUG in ('Y', 'C') THEN
1049: arp_standard.debug('arp_process_RETURNS.unapply_receipts()+ ');
1050: arp_standard.debug('p_inv_customer_trx_id :<' || p_inv_customer_trx_id ||'>');
1051: arp_standard.debug('rec_hand_option :<' || p_receipt_handling_option ||'>');
1052: END IF;
1053: --
1046: l_rec_in_doubt VARCHAR2(1):='N';
1047: BEGIN
1048: IF PG_DEBUG in ('Y', 'C') THEN
1049: arp_standard.debug('arp_process_RETURNS.unapply_receipts()+ ');
1050: arp_standard.debug('p_inv_customer_trx_id :<' || p_inv_customer_trx_id ||'>');
1051: arp_standard.debug('rec_hand_option :<' || p_receipt_handling_option ||'>');
1052: END IF;
1053: --
1054: --
1047: BEGIN
1048: IF PG_DEBUG in ('Y', 'C') THEN
1049: arp_standard.debug('arp_process_RETURNS.unapply_receipts()+ ');
1050: arp_standard.debug('p_inv_customer_trx_id :<' || p_inv_customer_trx_id ||'>');
1051: arp_standard.debug('rec_hand_option :<' || p_receipt_handling_option ||'>');
1052: END IF;
1053: --
1054: --
1055: --
1066: -- Need to add check receipt in doubt for PAY_REFUND
1067: IF c02_rec.rec_proc_option = 'REFUND' THEN
1068: --
1069: IF PG_DEBUG in ('Y', 'C') THEN
1070: arp_standard.debug('CC receipt with refund request ');
1071: END IF;
1072: --
1073: IF inv_info(p_inv_customer_trx_id).all_recs_in_doubt THEN
1074: --
1075: l_rec_in_doubt := 'Y';
1076: l_rid_reason := inv_info(p_inv_customer_trx_id).rid_reason;
1077: --
1078: IF PG_DEBUG in ('Y', 'C') THEN
1079: arp_standard.debug('All recs in doubt :<' || l_rid_reason ||'>');
1080: END IF;
1081: --
1082: ELSE
1083: --
1087: x_rec_proc_option => c02_rec.rec_proc_option);
1088: --
1089: --
1090: IF PG_DEBUG in ('Y', 'C') THEN
1091: arp_standard.debug('After RID chk :<' || l_rid_reason ||'>');
1092: END IF;
1093: --
1094: END IF;
1095: --
1099:
1100: IF c02_rec.rec_proc_option = 'PAY_REFUND' THEN
1101: --
1102: IF PG_DEBUG in ('Y', 'C') THEN
1103: arp_standard.debug('Non CC receipt with refund request ');
1104: END IF;
1105: --
1106: IF inv_info(p_inv_customer_trx_id).all_recs_in_doubt THEN
1107: --
1108: l_rec_in_doubt := 'Y';
1109: l_rid_reason := inv_info(p_inv_customer_trx_id).rid_reason;
1110: --
1111: IF PG_DEBUG in ('Y', 'C') THEN
1112: arp_standard.debug('All recs in doubt :<' || l_rid_reason ||'>');
1113: END IF;
1114: --
1115: ELSE
1116: --
1120: x_rec_proc_option=> c02_rec.rec_proc_option);
1121: --
1122: --
1123: IF PG_DEBUG in ('Y', 'C') THEN
1124: arp_standard.debug('After Non CC RID chk :<' || l_rid_reason ||'>');
1125: END IF;
1126: --
1127: END IF;
1128: --
1162: --
1163: add_ra_to_list(p_ra_info=>l_ra_info, p_ra_rec=>l_ra_rec);
1164: --
1165: IF PG_DEBUG in ('Y', 'C') THEN
1166: arp_standard.debug('rec_app_id :<' ||
1167: c02_rec.receivable_application_id ||'>');
1168: arp_standard.debug('rec_in_doubt :<' || l_rec_in_doubt ||'>');
1169: arp_standard.debug('rec_in_doubt_reason :<' ||
1170: l_rid_reason ||'>');
1164: --
1165: IF PG_DEBUG in ('Y', 'C') THEN
1166: arp_standard.debug('rec_app_id :<' ||
1167: c02_rec.receivable_application_id ||'>');
1168: arp_standard.debug('rec_in_doubt :<' || l_rec_in_doubt ||'>');
1169: arp_standard.debug('rec_in_doubt_reason :<' ||
1170: l_rid_reason ||'>');
1171: arp_standard.debug('rec_proc_option :<' ||
1172: c02_rec.rec_proc_option ||'>');
1165: IF PG_DEBUG in ('Y', 'C') THEN
1166: arp_standard.debug('rec_app_id :<' ||
1167: c02_rec.receivable_application_id ||'>');
1168: arp_standard.debug('rec_in_doubt :<' || l_rec_in_doubt ||'>');
1169: arp_standard.debug('rec_in_doubt_reason :<' ||
1170: l_rid_reason ||'>');
1171: arp_standard.debug('rec_proc_option :<' ||
1172: c02_rec.rec_proc_option ||'>');
1173: END IF;
1167: c02_rec.receivable_application_id ||'>');
1168: arp_standard.debug('rec_in_doubt :<' || l_rec_in_doubt ||'>');
1169: arp_standard.debug('rec_in_doubt_reason :<' ||
1170: l_rid_reason ||'>');
1171: arp_standard.debug('rec_proc_option :<' ||
1172: c02_rec.rec_proc_option ||'>');
1173: END IF;
1174: --
1175: -- Unapply the application
1184:
1185: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1186:
1187: IF (l_msg_count = 1) THEN
1188: arp_standard.debug('Unapply: ' || l_MSG_DATA);
1189: ELSIF(l_MSG_COUNT>1)THEN
1190: LOOP
1191: l_MSG_DATA:=FND_MSG_PUB.GET(p_encoded=>FND_API.G_FALSE);
1192: IF (l_MSG_DATA IS NULL)THEN
1191: l_MSG_DATA:=FND_MSG_PUB.GET(p_encoded=>FND_API.G_FALSE);
1192: IF (l_MSG_DATA IS NULL)THEN
1193: EXIT;
1194: END IF;
1195: arp_standard.debug('UNapply: ' || l_MSG_DATA);
1196: END LOOP;
1197: END IF;
1198:
1199: arp_standard.debug('Unapplication failed');
1195: arp_standard.debug('UNapply: ' || l_MSG_DATA);
1196: END LOOP;
1197: END IF;
1198:
1199: arp_standard.debug('Unapplication failed');
1200: RAISE l_unapply_failed;
1201: END IF;
1202:
1203: END LOOP;
1202:
1203: END LOOP;
1204:
1205: IF PG_DEBUG in ('Y', 'C') THEN
1206: arp_standard.debug('arp_process_RETURNS.unapply_receipts()- ');
1207: END IF;
1208: EXCEPTION
1209: WHEN OTHERS THEN
1210: arp_standard.debug('arp_process_returns.unapply_receipts : '
1206: arp_standard.debug('arp_process_RETURNS.unapply_receipts()- ');
1207: END IF;
1208: EXCEPTION
1209: WHEN OTHERS THEN
1210: arp_standard.debug('arp_process_returns.unapply_receipts : '
1211: || SQLERRM(SQLCODE));
1212: RAISE;
1213:
1214: END unapply_receipts;
1219:
1220: PROCEDURE add_invoice (p_customer_trx_id IN NUMBER) IS
1221: BEGIN
1222: IF PG_DEBUG in ('Y', 'C') THEN
1223: arp_standard.debug('arp_process_RETURNS.add_invoice()+ ');
1224: arp_standard.debug('p_customer_trx_id :<' || p_customer_trx_id ||'>');
1225: END IF;
1226:
1227: IF inv_info.EXISTS(p_customer_trx_id) THEN
1220: PROCEDURE add_invoice (p_customer_trx_id IN NUMBER) IS
1221: BEGIN
1222: IF PG_DEBUG in ('Y', 'C') THEN
1223: arp_standard.debug('arp_process_RETURNS.add_invoice()+ ');
1224: arp_standard.debug('p_customer_trx_id :<' || p_customer_trx_id ||'>');
1225: END IF;
1226:
1227: IF inv_info.EXISTS(p_customer_trx_id) THEN
1228: inv_info(p_customer_trx_id).num_of_cms :=
1231: inv_info(p_customer_trx_id).num_of_cms := 1;
1232: END IF;
1233:
1234: IF PG_DEBUG in ('Y', 'C') THEN
1235: arp_standard.debug('arp_process_RETURNS.add_invoice()- ');
1236: END IF;
1237: EXCEPTION
1238: WHEN OTHERS THEN
1239: arp_standard.debug('arp_process_returns.add_invoice : ' ||
1235: arp_standard.debug('arp_process_RETURNS.add_invoice()- ');
1236: END IF;
1237: EXCEPTION
1238: WHEN OTHERS THEN
1239: arp_standard.debug('arp_process_returns.add_invoice : ' ||
1240: SQLERRM(SQLCODE));
1241: RAISE;
1242: END;
1243:
1251: l_cnt NUMBER := app_info.COUNT;
1252: BEGIN
1253: --
1254: IF PG_DEBUG in ('Y', 'C') THEN
1255: arp_standard.debug('arp_process_RETURNS.add_ra_to_list()+ ');
1256: arp_standard.debug('count :<' || l_cnt ||'>');
1257: END IF;
1258: --
1259: l_cnt := l_cnt + 1;
1252: BEGIN
1253: --
1254: IF PG_DEBUG in ('Y', 'C') THEN
1255: arp_standard.debug('arp_process_RETURNS.add_ra_to_list()+ ');
1256: arp_standard.debug('count :<' || l_cnt ||'>');
1257: END IF;
1258: --
1259: l_cnt := l_cnt + 1;
1260: app_info(l_cnt) := p_ra_info;
1260: app_info(l_cnt) := p_ra_info;
1261: app_tab(l_cnt) := p_ra_rec;
1262: --
1263: IF PG_DEBUG in ('Y', 'C') THEN
1264: arp_standard.debug('arp_process_RETURNS.add_ra_to_list()- ');
1265: END IF;
1266: --
1267: EXCEPTION
1268: WHEN OTHERS THEN
1265: END IF;
1266: --
1267: EXCEPTION
1268: WHEN OTHERS THEN
1269: arp_standard.debug('arp_process_returns.add_ra_to_list : ' ||
1270: SQLERRM(SQLCODE));
1271: RAISE;
1272: END;
1273: --
1280:
1281: BEGIN
1282: --
1283: IF PG_DEBUG in ('Y', 'C') THEN
1284: arp_standard.debug('arp_process_RETURNS.get_total_cm_amount()+ ');
1285: arp_standard.debug('p_inv_customer_trx_id :<'
1286: || p_inv_customer_trx_id ||'>');
1287: END IF;
1288: --
1281: BEGIN
1282: --
1283: IF PG_DEBUG in ('Y', 'C') THEN
1284: arp_standard.debug('arp_process_RETURNS.get_total_cm_amount()+ ');
1285: arp_standard.debug('p_inv_customer_trx_id :<'
1286: || p_inv_customer_trx_id ||'>');
1287: END IF;
1288: --
1289: SELECT NVL(SUM(extended_amount) , 0)
1292: WHERE previous_customer_trx_id = p_inv_customer_trx_id
1293: AND request_id = p_request_id;
1294: --
1295: IF PG_DEBUG in ('Y', 'C') THEN
1296: arp_standard.debug('l_total_cm_amount :<'
1297: || l_total_cm_amount ||'>');
1298: arp_standard.debug('arp_process_RETURNS.get_total_cm_amount()- ');
1299: END IF;
1300: --
1294: --
1295: IF PG_DEBUG in ('Y', 'C') THEN
1296: arp_standard.debug('l_total_cm_amount :<'
1297: || l_total_cm_amount ||'>');
1298: arp_standard.debug('arp_process_RETURNS.get_total_cm_amount()- ');
1299: END IF;
1300: --
1301:
1302: RETURN l_total_cm_amount;
1301:
1302: RETURN l_total_cm_amount;
1303: EXCEPTION
1304: WHEN OTHERS THEN
1305: arp_standard.debug('EXCEPTION:arp_process_returns.get_total_cm_amount : '
1306: || SQLERRM(SQLCODE));
1307: RAISE;
1308:
1309: END get_total_cm_amount;
1321:
1322: BEGIN
1323: --
1324: IF PG_DEBUG in ('Y', 'C') THEN
1325: arp_standard.debug('arp_process_RETURNS.get_total_payment_types()+ ');
1326: arp_standard.debug('p_inv_customer_trx_id :<'
1327: || p_inv_customer_trx_id ||'>');
1328: END IF;
1329: --
1322: BEGIN
1323: --
1324: IF PG_DEBUG in ('Y', 'C') THEN
1325: arp_standard.debug('arp_process_RETURNS.get_total_payment_types()+ ');
1326: arp_standard.debug('p_inv_customer_trx_id :<'
1327: || p_inv_customer_trx_id ||'>');
1328: END IF;
1329: --
1330: SELECT
1346: l_total_payment_types := 0;
1347: END IF;
1348: --
1349: IF PG_DEBUG in ('Y', 'C') THEN
1350: arp_standard.debug('l_total_payment_types :<'
1351: || l_total_payment_types ||'>');
1352: arp_standard.debug('arp_process_RETURNS.get_total_payment_types()- ');
1353: END IF;
1354: --
1348: --
1349: IF PG_DEBUG in ('Y', 'C') THEN
1350: arp_standard.debug('l_total_payment_types :<'
1351: || l_total_payment_types ||'>');
1352: arp_standard.debug('arp_process_RETURNS.get_total_payment_types()- ');
1353: END IF;
1354: --
1355: RETURN l_total_payment_types;
1356: --
1355: RETURN l_total_payment_types;
1356: --
1357: EXCEPTION
1358: WHEN OTHERS THEN
1359: arp_standard.debug('EXCEPTION:arp_process_returns.get_total_payment_types : '
1360: || SQLERRM(SQLCODE));
1361: RAISE;
1362:
1363: END get_total_payment_types;
1373:
1374: BEGIN
1375: --
1376: IF PG_DEBUG in ('Y', 'C') THEN
1377: arp_standard.debug('arp_process_RETURNS.get_receipt_amounts()+ ');
1378: arp_standard.debug('p_cash_receipt_id :<'
1379: || p_cash_receipt_id ||'>');
1380: END IF;
1381: --
1374: BEGIN
1375: --
1376: IF PG_DEBUG in ('Y', 'C') THEN
1377: arp_standard.debug('arp_process_RETURNS.get_receipt_amounts()+ ');
1378: arp_standard.debug('p_cash_receipt_id :<'
1379: || p_cash_receipt_id ||'>');
1380: END IF;
1381: --
1382: x_receipt_amount := 0;
1406: END IF;
1407:
1408: --
1409: IF PG_DEBUG in ('Y', 'C') THEN
1410: arp_standard.debug('x_receipt_amount :<'
1411: || x_receipt_amount ||'>');
1412: arp_standard.debug('x_refund_amount :<'
1413: || x_refund_amount ||'>');
1414: arp_standard.debug('arp_process_RETURNS.get_receipt_amounts()- ');
1408: --
1409: IF PG_DEBUG in ('Y', 'C') THEN
1410: arp_standard.debug('x_receipt_amount :<'
1411: || x_receipt_amount ||'>');
1412: arp_standard.debug('x_refund_amount :<'
1413: || x_refund_amount ||'>');
1414: arp_standard.debug('arp_process_RETURNS.get_receipt_amounts()- ');
1415: END IF;
1416: --
1410: arp_standard.debug('x_receipt_amount :<'
1411: || x_receipt_amount ||'>');
1412: arp_standard.debug('x_refund_amount :<'
1413: || x_refund_amount ||'>');
1414: arp_standard.debug('arp_process_RETURNS.get_receipt_amounts()- ');
1415: END IF;
1416: --
1417:
1418: EXCEPTION
1418: EXCEPTION
1419: WHEN NO_DATA_FOUND THEN
1420: NULL;
1421: WHEN OTHERS THEN
1422: arp_standard.debug('EXCEPTION:arp_process_returns.get_receipt_amounts : '
1423: || SQLERRM(SQLCODE));
1424: RAISE;
1425: END;
1426:
1456: x_rec_proc_option IN VARCHAR2) IS
1457: BEGIN
1458: ---
1459: IF PG_DEBUG in ('Y', 'C') THEN
1460: arp_standard.debug('arp_process_RETURNS.check_rec_in_doubt()+ ');
1461: END IF;
1462: ---
1463: x_rec_in_doubt := 'N';
1464: x_rid_reason := null;
1466: --- For CC receipts, receipt should be remitted
1467: ---
1468: IF x_rec_proc_option = 'REFUND' THEN
1469: BEGIN
1470: SELECT 'Y', arp_standard.fnd_message('AR_RID_NOT_REMITTED_OR_CLEARED')
1471: INTO x_rec_in_doubt, x_rid_reason
1472: FROM dual
1473: WHERE
1474: (
1483: EXCEPTION
1484: WHEN NO_DATA_FOUND THEN
1485: NULL;
1486: WHEN OTHERS THEN
1487: arp_standard.debug('Unexpected error '||sqlerrm||
1488: ' occurred in arp_process_returns.check_rec_in_doubt');
1489: RAISE;
1490: END;
1491:
1490: END;
1491:
1492: ---
1493: IF PG_DEBUG in ('Y', 'C') THEN
1494: arp_standard.debug('After REFUND x_rec_in_doubt[x_rid_reason]: ' || x_rec_in_doubt ||
1495: '[' || x_rid_reason || ']');
1496: END IF;
1497:
1498: ELSIF x_rec_proc_option = 'PAY_REFUND' THEN
1499: ---
1500: --- For Non CC Receipts , receipt should be cleared
1501: ---
1502: BEGIN
1503: SELECT 'Y', arp_standard.fnd_message('AR_RID_NOT_CLEARED')
1504: INTO x_rec_in_doubt, x_rid_reason
1505: FROM dual
1506: WHERE
1507: (
1516: EXCEPTION
1517: WHEN NO_DATA_FOUND THEN
1518: NULL;
1519: WHEN OTHERS THEN
1520: arp_standard.debug('Unexpected error '||sqlerrm||
1521: ' occurred in arp_process_returns.check_rec_in_doubt');
1522: RAISE;
1523: END;
1524:
1523: END;
1524:
1525: ---
1526: IF PG_DEBUG in ('Y', 'C') THEN
1527: arp_standard.debug('After Non CC REFUND x_rec_in_doubt[x_rid_reason]: ' || x_rec_in_doubt ||
1528: '[' || x_rid_reason || ']');
1529: END IF;
1530: END IF;
1531:
1534: ---
1535: --- There should not be any Claims Investigation or CB special application
1536: ---
1537: BEGIN
1538: SELECT 'Y', arp_standard.fnd_message('AR_RID_CLAIM_OR_CB_APP_EXISTS')
1539: INTO x_rec_in_doubt, x_rid_reason
1540: FROM dual
1541: WHERE
1542: EXISTS
1550: EXCEPTION
1551: WHEN NO_DATA_FOUND THEN
1552: NULL;
1553: WHEN OTHERS THEN
1554: arp_standard.debug('Unexpected error '||sqlerrm||
1555: ' occurred in arp_process_returns.check_rec_in_doubt');
1556: RAISE;
1557: END;
1558:
1557: END;
1558:
1559: ---
1560: IF PG_DEBUG in ('Y', 'C') THEN
1561: arp_standard.debug('After CLAIMS x_rec_in_doubt[x_rid_reason]: ' ||
1562: x_rec_in_doubt || '[' || x_rid_reason || ']');
1563: END IF;
1564: ---
1565: ---
1565: ---
1566: --- Receipt should not be reversed
1567: ---
1568: BEGIN
1569: SELECT 'Y', arp_standard.fnd_message('AR_RID_RECEIPT_REVERSED')
1570: INTO x_rec_in_doubt, x_rid_reason
1571: FROM dual
1572: WHERE
1573: EXISTS
1580: EXCEPTION
1581: WHEN NO_DATA_FOUND THEN
1582: NULL;
1583: WHEN OTHERS THEN
1584: arp_standard.debug('Unexpected error '||sqlerrm||
1585: ' occurred in arp_process_returns.check_rec_in_doubt');
1586: RAISE;
1587: END;
1588:
1587: END;
1588:
1589: ---
1590: IF PG_DEBUG in ('Y', 'C') THEN
1591: arp_standard.debug('After DM reverse x_rec_in_doubt[x_rid_reason]: ' ||
1592: x_rec_in_doubt || '[' || x_rid_reason || ']');
1593: END IF;
1594: ---
1595: <
1594: ---
1595: <
1596: ---
1597: IF PG_DEBUG in ('Y', 'C') THEN
1598: arp_standard.debug('arp_process_RETURNS.check_rec_in_doubt()- ');
1599: END IF;
1600: ---
1601: EXCEPTION
1602: WHEN OTHERS THEN
1599: END IF;
1600: ---
1601: EXCEPTION
1602: WHEN OTHERS THEN
1603: arp_standard.debug('Unexpected error '||sqlerrm||
1604: ' occurred in arp_process_returns.check_rec_in_doubt');
1605: RAISE;
1606: END check_rec_in_doubt;
1607:
1631: l_count NUMBER;
1632: BEGIN
1633: ---
1634: IF PG_DEBUG in ('Y', 'C') THEN
1635: arp_standard.debug('arp_process_RETURNS.get_on_acct_cm_apps()+ ');
1636: arp_standard.debug('p_customer_trx_id :<'
1637: || p_customer_trx_id ||'>');
1638: END IF;
1639: ---
1632: BEGIN
1633: ---
1634: IF PG_DEBUG in ('Y', 'C') THEN
1635: arp_standard.debug('arp_process_RETURNS.get_on_acct_cm_apps()+ ');
1636: arp_standard.debug('p_customer_trx_id :<'
1637: || p_customer_trx_id ||'>');
1638: END IF;
1639: ---
1640: select count(*)
1648: and app.customer_trx_id = oncm.customer_trx_id
1649: and oncm.previous_customer_trx_id IS NULL;
1650: ---
1651: IF PG_DEBUG in ('Y', 'C') THEN
1652: arp_standard.debug('arp_process_RETURNS.get_on_acct_cm_apps()- ');
1653: END IF;
1654: ---
1655: RETURN l_count;
1656:
1655: RETURN l_count;
1656:
1657: EXCEPTION
1658: WHEN OTHERS THEN
1659: arp_standard.debug('Unexpected error '||sqlerrm||
1660: ' occurred in arp_process_returns.get_on_acct_cm_apps');
1661: RAISE;
1662: END get_on_acct_cm_apps;
1663:
1687: l_count NUMBER;
1688: BEGIN
1689: ---
1690: IF PG_DEBUG in ('Y', 'C') THEN
1691: arp_standard.debug('arp_process_RETURNS.get_neg_inv_apps()+ ');
1692: arp_standard.debug('p_customer_trx_id :<'
1693: || p_customer_trx_id ||'>');
1694: END IF;
1695: ---
1688: BEGIN
1689: ---
1690: IF PG_DEBUG in ('Y', 'C') THEN
1691: arp_standard.debug('arp_process_RETURNS.get_neg_inv_apps()+ ');
1692: arp_standard.debug('p_customer_trx_id :<'
1693: || p_customer_trx_id ||'>');
1694: END IF;
1695: ---
1696: select count(*)
1702: and app.display = 'Y'
1703: and app.amount_applied < 0;
1704: ---
1705: IF PG_DEBUG in ('Y', 'C') THEN
1706: arp_standard.debug('arp_process_RETURNS.get_neg_inv_apps()- ');
1707: END IF;
1708: ---
1709: RETURN l_count;
1710:
1709: RETURN l_count;
1710:
1711: EXCEPTION
1712: WHEN OTHERS THEN
1713: arp_standard.debug('Unexpected error '||sqlerrm||
1714: ' occurred in arp_process_returns.get_neg_inv_apps');
1715: RAISE;
1716: END get_neg_inv_apps;
1717:
1741: l_count NUMBER;
1742: BEGIN
1743: ---
1744: IF PG_DEBUG in ('Y', 'C') THEN
1745: arp_standard.debug('arp_process_RETURNS.get_llca_apps()+ ');
1746: arp_standard.debug('p_customer_trx_id :<'
1747: || p_customer_trx_id ||'>');
1748: END IF;
1749: ---
1742: BEGIN
1743: ---
1744: IF PG_DEBUG in ('Y', 'C') THEN
1745: arp_standard.debug('arp_process_RETURNS.get_llca_apps()+ ');
1746: arp_standard.debug('p_customer_trx_id :<'
1747: || p_customer_trx_id ||'>');
1748: END IF;
1749: ---
1750: select count(*)
1757: and aad.customer_trx_line_id = lines.customer_trx_line_id;
1758:
1759: ---
1760: IF PG_DEBUG in ('Y', 'C') THEN
1761: arp_standard.debug('arp_process_RETURNS.get_llca_apps()- ');
1762: END IF;
1763: ---
1764: RETURN l_count;
1765:
1764: RETURN l_count;
1765:
1766: EXCEPTION
1767: WHEN OTHERS THEN
1768: arp_standard.debug('Unexpected error '||sqlerrm||
1769: ' occurred in arp_process_returns.get_llca_apps');
1770: RAISE;
1771: END get_llca_apps;
1772:
1802: AS
1803: BEGIN
1804: ---
1805: IF PG_DEBUG in ('Y', 'C') THEN
1806: arp_standard.debug('arp_process_RETURNS.populate_dff_and_gdf()+ ');
1807: END IF;
1808: ---
1809: x_dff_rec.attribute_category:=p_ra_rec.attribute_category;
1810: x_dff_rec.attribute1 :=p_ra_rec.attribute1;
1847: x_gdf_rec.global_attribute20 :=p_ra_rec.global_attribute20;
1848: ---
1849: ---
1850: IF PG_DEBUG in ('Y', 'C') THEN
1851: arp_standard.debug('arp_process_RETURNS.populate_dff_and_gdf()- ');
1852: END IF;
1853: ---
1854: EXCEPTION
1855: WHEN OTHERS THEN
1852: END IF;
1853: ---
1854: EXCEPTION
1855: WHEN OTHERS THEN
1856: arp_standard.debug('Unexpected error '||sqlerrm||
1857: ' occurred in arp_process_returns.populate_dff_and_gdf');
1858: RAISE;
1859: END populate_dff_and_gdf;
1860:
1896:
1897: BEGIN
1898: ---
1899: IF PG_DEBUG in ('Y', 'C') THEN
1900: arp_standard.debug('arp_process_RETURNS.get_amount_applied()+ ');
1901: arp_standard.debug('Customer Trx Id : ' || p_customer_trx_id);
1902: arp_standard.debug('p_line_type : ' || p_line_type);
1903: END IF;
1904: --
1897: BEGIN
1898: ---
1899: IF PG_DEBUG in ('Y', 'C') THEN
1900: arp_standard.debug('arp_process_RETURNS.get_amount_applied()+ ');
1901: arp_standard.debug('Customer Trx Id : ' || p_customer_trx_id);
1902: arp_standard.debug('p_line_type : ' || p_line_type);
1903: END IF;
1904: --
1905: -- Adjust amount applied iff invoice is in the list created during validation
1898: ---
1899: IF PG_DEBUG in ('Y', 'C') THEN
1900: arp_standard.debug('arp_process_RETURNS.get_amount_applied()+ ');
1901: arp_standard.debug('Customer Trx Id : ' || p_customer_trx_id);
1902: arp_standard.debug('p_line_type : ' || p_line_type);
1903: END IF;
1904: --
1905: -- Adjust amount applied iff invoice is in the list created during validation
1906: --
1908: --
1909: IF amt_app_tab.EXISTS(p_customer_trx_id) THEN
1910: --
1911: IF PG_DEBUG in ('Y', 'C') THEN
1912: arp_standard.debug('Cache Hit...');
1913: END IF;
1914: --
1915: null;
1916: --
1916: --
1917: ELSE
1918: --
1919: IF PG_DEBUG in ('Y', 'C') THEN
1920: arp_standard.debug('Database Hit...');
1921: END IF;
1922: --
1923: --
1924: --
1968: l_total_amount := 0;
1969: END IF;
1970: ---
1971: IF PG_DEBUG in ('Y', 'C') THEN
1972: arp_standard.debug('Total Amount : ' || l_total_amount);
1973: arp_standard.debug('arp_process_RETURNS.get_amount_applied()- ');
1974: END IF;
1975: --
1976:
1969: END IF;
1970: ---
1971: IF PG_DEBUG in ('Y', 'C') THEN
1972: arp_standard.debug('Total Amount : ' || l_total_amount);
1973: arp_standard.debug('arp_process_RETURNS.get_amount_applied()- ');
1974: END IF;
1975: --
1976:
1977: RETURN l_total_amount;
1977: RETURN l_total_amount;
1978:
1979: EXCEPTION
1980: WHEN OTHERS THEN
1981: arp_standard.debug('Unexpected error '||sqlerrm||
1982: ' occurred in arp_process_returns.get_amount_applied');
1983: RAISE;
1984: END get_amount_applied;
1985: