DBA Data[Home] [Help]

APPS.AR_AUTOREC_API SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 124

      select payment_schedule_id,
      receipt_number rec_num,
      cash_receipt_id rec_id,
      amount_due_remaining amt
      from AR_RECEIPTS_GT gt
      where payment_schedule_id <> -99999
      order by amt;
Line: 227

/* CALL TO INSERT BATCH FROM MAIN */

    insert_batch(
       l_gl_date,
       l_batch_date,
       l_receipt_class_id,
       l_receipt_method_id,
       l_currency_code,
       l_approve_flag,
       l_format_flag,
       l_create_flag,
       o_batch_id
      );
Line: 243

     select batch_date ,gl_date ,  currency_code, receipt_method_id
      into  l_batch_date,l_gl_date,l_currency_code, l_receipt_method_id
      from  AR_BATCHES
      where batch_id = p_batch_id;
Line: 268

   insert_exceptions(
   p_batch_id =>-333,
   p_request_id =>l_request_id,
   p_exception_code => 'NO_BATCH',
   p_additional_message => 'error during insert batch' );
Line: 299

	select_valid_invoices
	   (  p_trx_date_l =>fnd_date.canonical_to_date(p_trx_date_l),
	      p_trx_date_h =>fnd_date.canonical_to_date(p_trx_date_h),
	      p_due_date_l =>fnd_date.canonical_to_date(p_due_date_l),
	      p_due_date_h =>fnd_date.canonical_to_date(p_due_date_h),
	      p_trx_num_l =>p_trx_num_l,
	      p_trx_num_h => p_trx_num_h,
	      p_doc_num_l =>p_doc_num_l,
	      p_doc_num_h => p_doc_num_h,
	      p_customer_number_l => p_customer_number_l,  --Bug6734688
	      p_customer_number_h => p_customer_number_h,  --Bug6734688
	      p_customer_name_l => p_customer_name_l,  --Bug6734688
	      p_customer_name_h => p_customer_name_h,  --Bug6734688
	      p_batch_id => o_batch_id,
	      p_approve_only_flag => 'N',
	      p_receipt_method_id => l_receipt_method_id,
	      p_payment_schedule_id =>op_payment_schedule_id,
	      p_customer_trx_id =>op_customer_trx_id,
	      p_cash_receipt_id =>op_cash_receipt_id,
	      p_paying_customer_id =>op_paying_customer_id,
	      p_paying_site_use_id =>op_paying_site_use_id,
	      p_payment_server_order_num =>op_payment_server_order_num,
	      p_due_date => op_due_date,
	      p_amount_due_remaining =>op_amount_due_remaining,
	      p_cust_bank_account_id  =>op_cust_bank_account_id,
	      p_cust_min_amt =>op_cust_min_amt,
	      p_payment_trxn_extension_id =>op_payment_trxn_extension_id,
	      p_payment_channel_code =>op_payment_channel_code,
	      p_instrument_type =>op_instrument_type,
	      p_return_status =>op_return_status
	       );
Line: 334

      update ar_payment_schedules
      set selected_for_receipt_batch_id = o_batch_id
      where payment_schedule_id  in (select PAYMENT_SCHEDULE_ID from AR_RECEIPTS_GT);
Line: 338

      arp_standard.debug ( 'NO of PS rows updated =  '|| to_char(SQL%ROWCOUNT));
Line: 342

             arp_standard.debug ( 'NO of PS rows updated =  '|| to_char(SQL%ROWCOUNT));
Line: 345

        update ar_batches SET
               batch_applied_status = 'COMPLETED_CREATION'
               where batch_id = o_batch_id;
Line: 369

        select_valid_invoices
           (  p_trx_date_l =>fnd_date.canonical_to_date(p_trx_date_l),
              p_trx_date_h =>fnd_date.canonical_to_date(p_trx_date_h),
              p_due_date_l =>fnd_date.canonical_to_date(p_due_date_l),
              p_due_date_h =>fnd_date.canonical_to_date(p_due_date_h),
              p_trx_num_l =>p_trx_num_l,
              p_trx_num_h => p_trx_num_h,
              p_doc_num_l =>p_doc_num_l,
              p_doc_num_h => p_doc_num_h,
	      p_customer_number_l => p_customer_number_l,  --Bug6734688
	      p_customer_number_h => p_customer_number_h,  --Bug6734688
	      p_customer_name_l => p_customer_name_l,  --Bug6734688
	      p_customer_name_h => p_customer_name_h,  --Bug6734688
              p_batch_id => o_batch_id,
              p_approve_only_flag => 'N',
              p_receipt_method_id => l_receipt_method_id,
              p_payment_schedule_id =>op_payment_schedule_id,
              p_customer_trx_id =>op_customer_trx_id,
              p_cash_receipt_id =>op_cash_receipt_id,
              p_paying_customer_id =>op_paying_customer_id,
              p_paying_site_use_id =>op_paying_site_use_id,
              p_payment_server_order_num =>op_payment_server_order_num,
              p_due_date => op_due_date,
              p_amount_due_remaining =>op_amount_due_remaining,
              p_cust_bank_account_id  =>op_cust_bank_account_id,
              p_cust_min_amt =>op_cust_min_amt,
              p_payment_trxn_extension_id =>op_payment_trxn_extension_id,
              p_payment_channel_code =>op_payment_channel_code,
              p_instrument_type =>op_instrument_type,
              p_return_status =>op_return_status
               );
Line: 404

      update ar_payment_schedules
      set selected_for_receipt_batch_id = o_batch_id
      where payment_schedule_id  in (select PAYMENT_SCHEDULE_ID from AR_RECEIPTS_GT);
Line: 408

      arp_standard.debug ( 'NO of PS rows updated =  '|| to_char(SQL%ROWCOUNT));
Line: 410

      update ar_batches SET
      batch_applied_status = 'COMPLETED_CREATION'
      where batch_id = o_batch_id;
Line: 421

           arp_standard.debug('Selecting invoices for approval');
Line: 425

        select_valid_invoices
           (  p_trx_date_l =>fnd_date.canonical_to_date(p_trx_date_l),
              p_trx_date_h =>fnd_date.canonical_to_date(p_trx_date_h),
              p_due_date_l =>fnd_date.canonical_to_date(p_due_date_l),
              p_due_date_h =>fnd_date.canonical_to_date(p_due_date_h),
              p_trx_num_l =>p_trx_num_l,
              p_trx_num_h => p_trx_num_h,
              p_doc_num_l =>p_doc_num_l,
              p_doc_num_h => p_doc_num_h,
	      p_customer_number_l => p_customer_number_l,  --Bug6734688
	      p_customer_number_h => p_customer_number_h,  --Bug6734688
	      p_customer_name_l => p_customer_name_l,  --Bug6734688
	      p_customer_name_h => p_customer_name_h,  --Bug6734688
              p_batch_id => o_batch_id,
              p_approve_only_flag => 'A',
              p_receipt_method_id => l_receipt_method_id,
              p_payment_schedule_id =>op_payment_schedule_id,
              p_customer_trx_id =>op_customer_trx_id,
              p_cash_receipt_id =>op_cash_receipt_id,
              p_paying_customer_id =>op_paying_customer_id,
              p_paying_site_use_id =>op_paying_site_use_id,
              p_payment_server_order_num =>op_payment_server_order_num,
              p_due_date => op_due_date,
              p_amount_due_remaining =>op_amount_due_remaining,
              p_cust_bank_account_id  =>op_cust_bank_account_id,
              p_cust_min_amt =>op_cust_min_amt,
              p_payment_trxn_extension_id =>op_payment_trxn_extension_id,
              p_payment_channel_code =>op_payment_channel_code,
              p_instrument_type =>op_instrument_type,
              p_return_status =>op_return_status
               );
Line: 493

select decode(rc.confirm_flag,'Y','AUTORECAPI',null),nvl(rm.RECEIPT_CREATION_RULE_CODE,'MANUAL')
       ,nvl(rm.receipt_inherit_inv_num_flag,'N')
INTO   l_called_from,l_rec_creation_rule_code,l_rec_inher_inv_num_flag
from   ar_receipt_classes rc,
       ar_receipt_methods rm
where rm.receipt_method_id = l_receipt_method_id
and rm.receipt_class_id = rc.receipt_class_id;
Line: 523

   excecute ps.selected_for_receipt_batch_id is null
   ---------------------------------------------------*/
   arp_view_constants.set_ps_selected_in_batch('Y');
Line: 561

                        insert_exceptions(
                           p_batch_id   =>o_batch_id,
                           p_request_id =>l_request_id,
                           p_payment_schedule_id => PS.payment_schedule_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => al_count||al_msg_data
                             );
Line: 581

                       insert_exceptions(
                           p_batch_id   =>o_batch_id,
                           p_request_id =>l_request_id,
                           p_payment_schedule_id => PS.payment_schedule_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => al_count||al_msg_data
                             );
Line: 604

   arp_view_constants.set_ps_selected_in_batch( null);
Line: 637

             l_last_updated_by         NUMBER;
Line: 639

             l_last_update_login       NUMBER;
Line: 646

	  select distinct cr.cash_receipt_id cr_id,
      cr.payment_trxn_extension_id  pmt_trxn_id
      from ar_cash_receipts cr,
           ar_receipts_gt rec
      where rec.cash_receipt_id = cr.cash_receipt_id;
Line: 663

       l_last_updated_by := arp_standard.profile.last_update_login ;
Line: 665

       l_last_update_login := arp_standard.profile.last_update_login ;
Line: 707

                            insert_exceptions(
                           p_batch_id   =>o_batch_id,
                           p_request_id =>l_request_id,
                           p_cash_receipt_id => CREC.cr_id,
                           p_exception_code  => 'AR_CC_AUTH_FAILED',
                           p_additional_message => pl_count||pl_msg_data
                             );
Line: 715

/* update the error flag in ra_customer_trx */

                                     UPDATE ra_customer_trx
                                        SET cc_error_flag = 'Y',
                                            cc_error_code = l_response_error_code,
                                            cc_error_text = pl_msg_data,
                                            last_updated_by = l_last_updated_by,
                                            last_update_date = sysdate,
                                            last_update_login = l_last_update_login,
                                            request_id = l_request_id,
                                            program_application_id= l_program_application_id,
                                            program_id = l_program_id,
                                            program_update_date = sysdate
                                        WHERE customer_trx_id in (SELECT r.customer_trx_id
                                                                  FROM ar_receipts_gt r,
                                                                       ar_cash_receipts rec
                                                                  WHERE r.receipt_number = rec.receipt_number
                                                                  AND   rec.cash_receipt_id = CREC.cr_id);
Line: 734

                                 arp_standard.debug ( ' rows updated TRX  = ' || SQL%ROWCOUNT );
Line: 748

                              insert_exceptions(
                                    p_batch_id   =>o_batch_id,
                                    p_request_id =>l_request_id,
                                    p_cash_receipt_id => CREC.cr_id,
                                    p_exception_code  => 'AR_CC_AUTH_FAILED',
                                    p_additional_message => pl_count||pl_msg_data
                                    );
Line: 756

/* update the error flag in ra_customer_trx */

                                      UPDATE ra_customer_trx
                                         SET cc_error_flag = 'Y',
                                             cc_error_code = l_response_error_code,
                                             cc_error_text = pl_msg_data,
                                             last_updated_by = l_last_updated_by,
                                             last_update_date = sysdate,
                                             last_update_login = l_last_update_login,
                                             request_id = l_request_id,
                                             program_application_id= l_program_application_id,
                                             program_id = l_program_id,
                                             program_update_date = sysdate
                                        WHERE customer_trx_id in (SELECT r.customer_trx_id
                                                                  FROM ar_receipts_gt r,
                                                                       ar_cash_receipts rec
                                                                  WHERE r.receipt_number = rec.receipt_number
                                                                  AND   rec.cash_receipt_id = CREC.cr_id);
Line: 795

             l_last_updated_by         NUMBER;
Line: 797

             l_last_update_login       NUMBER;
Line: 810

       l_last_update_login := arp_standard.profile.last_update_login ;
Line: 815

               update ar_batches SET
               batch_applied_status = 'COMPLETED_APPROVAL'
               where batch_id = o_batch_id;
Line: 820

		update ar_cash_receipts SET
                creation_date = sysdate,
                created_by =  l_created_by,
                last_update_date = sysdate,
                last_updated_by =  l_created_by,
                last_update_login = l_last_update_login,
                request_id = l_request_id,
                program_application_id = l_program_application_id,
                program_id = l_program_id,
                program_update_date = sysdate
		WHERE cash_receipt_id in (
                select cash_receipt_id from
                AR_RECEIPTS_GT);
Line: 834

		arp_standard.debug ( 'NO of Receipts updated =  '|| to_char(SQL%ROWCOUNT));
Line: 851

		update ar_cash_receipt_history SET
                batch_id   = o_batch_id,
                created_by =  l_created_by,
                last_update_date = sysdate,
                last_updated_by =  l_created_by,
                last_update_login = l_last_update_login,
                request_id = l_request_id,
                program_application_id = l_program_application_id,
                program_id = l_program_id,
                program_update_date = sysdate
		WHERE cash_receipt_id in (
                select cash_receipt_id from
                AR_RECEIPTS_GT);
Line: 865

		arp_standard.debug ( 'NO of Receipts updated CRH =  '|| to_char(SQL%ROWCOUNT));
Line: 868

		update AR_payment_schedules  SET
                created_by =  l_created_by,
                last_update_date = sysdate,
                last_updated_by =  l_created_by,
                last_update_login = l_last_update_login,
                request_id = l_request_id,
                program_application_id = l_program_application_id,
                program_id = l_program_id,
                program_update_date = sysdate
		WHERE cash_receipt_id in (
                select cash_receipt_id from
                AR_RECEIPTS_GT);
Line: 881

		arp_standard.debug ( 'NO of Receipts updated  PS =  '|| to_char(SQL%ROWCOUNT));
Line: 884

		update ar_receivable_applications SET
                 created_by =  l_created_by,
                last_update_date = sysdate,
                last_updated_by =  l_created_by,
                last_update_login = l_last_update_login,
                request_id = l_request_id,
                program_application_id = l_program_application_id,
                program_id = l_program_id,
                program_update_date = sysdate
		WHERE cash_receipt_id in (
                select cash_receipt_id from
                AR_RECEIPTS_GT);
Line: 898

		update ar_payment_schedules
		 set selected_for_receipt_batch_id = NULL
		 where payment_schedule_id  in (select PAYMENT_SCHEDULE_ID from AR_RECEIPTS_GT);
Line: 904

		update ar_cash_receipts cr SET
                receipt_number = nvl((
                    select ps.trx_number
                    from
                      ar_receivable_applications app,
                      ar_payment_schedules ps
                    where
                      app.cash_receipt_id = cr.cash_receipt_id
                      and ps.customer_trx_id = app.applied_customer_trx_id
                      and app.status = 'APP'
                      and rownum =1),receipt_number)
		WHERE cash_receipt_id in (
                select cash_receipt_id from ar_receipts_gt)
                AND request_id = l_request_id;
Line: 919

		arp_standard.debug ( 'NO of Receipts updated =  '|| to_char(SQL%ROWCOUNT));
Line: 971

 |  PROCEDURE insert_batch                                                |
 |                                                                        |
 | DESCRIPTION                                                            |
 |                                                                        |
 |   This procedure is used to insert the batch record when called from   |
 |   srs. It also gets the other required parameters from sysparm         |
 |   and conc program                                                     |
 | PSEUDO CODE/LOGIC                                                      |
 |                                                                        |
 | PARAMETERS                                                             |
 |                                                                        |
 |                                                                        |
 | KNOWN ISSUES                                                           |
 |                                                                        |
 | NOTES                                                                  |
 |                                                                        |
 |                                                                        |
 | MODIFICATION HISTORY                                                   |
 | Date                     Author            Description of Changes      |
 | 16-JUL-2005              bichatte           Created                    |
 *=========================================================================*/


PROCEDURE insert_batch(
      p_gl_date                          IN  ar_cash_receipt_history.gl_date%TYPE DEFAULT NULL,
      p_batch_date                       IN  ar_cash_receipts.receipt_date%TYPE DEFAULT NULL,
      p_receipt_class_id                 IN  ar_receipt_classes.receipt_class_id%TYPE DEFAULT NULL,
      p_receipt_method_id                IN  ar_cash_receipts.receipt_method_id%TYPE DEFAULT NULL,
      p_currency_code                    IN  ar_cash_receipts.currency_code%TYPE DEFAULT NULL,
      p_approve_flag                     IN  ar_cash_receipts.confirmed_flag%TYPE DEFAULT NULL,
      p_format_flag                      IN  ar_cash_receipts.confirmed_flag%TYPE DEFAULT NULL,
      p_create_flag                      IN  ar_cash_receipts.confirmed_flag%TYPE DEFAULT NULL,
      p_batch_id                         OUT NOCOPY NUMBER
      ) IS
            l_batch_rec             ar_batches%ROWTYPE;
Line: 1036

/* insert the batch record here */

  IF PG_DEBUG in ('Y', 'C') THEN
     arp_standard.debug('autorecapi calling auto_batch ()+');
Line: 1053

              arp_rw_batches_pkg.insert_auto_batch(
                               l_row_id,
                               l_batch_id,
                               l_batch_rec.batch_date,
                               l_batch_rec.currency_code,
                               l_batch_name, --out
                               l_batch_rec.comments,
                               l_batch_rec.exchange_date,
                               l_batch_rec.exchange_rate,
                               l_batch_rec.exchange_rate_type,
                               l_batch_rec.gl_date,
                               l_batch_rec.media_reference,
                               l_batch_rec.receipt_class_id,
                               l_batch_rec.receipt_method_id,
                               l_batch_rec.attribute_category,
                               l_batch_rec.attribute1,
                               l_batch_rec.attribute2,
                               l_batch_rec.attribute3,
                               l_batch_rec.attribute4,
                               l_batch_rec.attribute5,
                               l_batch_rec.attribute6,
                               l_batch_rec.attribute7,
                               l_batch_rec.attribute8,
                               l_batch_rec.attribute9,
                               l_batch_rec.attribute10,
                               l_batch_rec.attribute11,
                               l_batch_rec.attribute12,
                               l_batch_rec.attribute13,
                               l_batch_rec.attribute14,
                               l_batch_rec.attribute15,
                               l_call_conc_request,
                               l_batch_applied_status, --Out
                               l_request_id,--OUT
                               'AUTORECSRS',
                               '1.0',
                               l_bank_account_id_low,
                               l_bank_account_id_high
                               );
Line: 1108

/* inserted the batch record end */



/* GET THE VALUES from SYSTEM PARAMETERS */

       IF PG_DEBUG in ('Y','C') THEN
          arp_standard.debug( 'get info from system parameters');
Line: 1119

              SELECT asp.site_required_flag,
                    asp.auto_rec_invoices_per_commit,
                    asp.auto_rec_receipts_per_commit,
                    gsob.currency_code,
                    asp.accounting_method
               INTO psite_required,
                    pinvoices_per_commit,
                    preceipts_per_commit,
                    pfunctional_currency,
                    pacc_method
               FROM ar_system_parameters asp,
                    gl_sets_of_books gsob,
                    ar_batches ab
              WHERE ab.batch_id = p_batch_id
                AND ab.set_of_books_id = gsob.set_of_books_id
                AND gsob.set_of_books_id = asp.set_of_books_id;
Line: 1159

     arp_standard.debug('Exception : insert_batch() ');
Line: 1162

END insert_batch;
Line: 1165

 | PUBLIC PROCEDURE SELECT_VALID_INVOICES                                 |
 |                                                                        |
 | DESCRIPTION                                                            |
 |                                                                        |
 |   This procedure is used to select the valied invoices and insert them |
 |   into the GT table AR_RECEIPTS_GT                                     |
 | PSEUDO CODE/LOGIC                                                      |
 |                                                                        |
 | PARAMETERS                                                             |
 |                                                                        |
 |                                                                        |
 | KNOWN ISSUES                                                           |
 |                                                                        |
 | NOTES                                                                  |
 |                                                                        |
 |                                                                        |
 | MODIFICATION HISTORY                                                   |
 | Date                     Author            Description of Changes      |
 | 16-JUL-2005              bichatte           Created                    |
 *=========================================================================*/

PROCEDURE select_valid_invoices(
                                p_trx_date_l                      IN ar_payment_schedules.trx_date%TYPE,
                                p_trx_date_h                      IN ar_payment_schedules.trx_date%TYPE,
                                p_due_date_l                      IN ar_payment_schedules.due_date%TYPE,
                                p_due_date_h                     IN ar_payment_schedules.due_date%TYPE,
                                p_trx_num_l                      IN ar_payment_schedules.trx_number%TYPE,
                                p_trx_num_h                      IN ar_payment_schedules.trx_number%TYPE,
                                p_doc_num_l                      IN ra_customer_trx.doc_sequence_value%TYPE,
                                p_doc_num_h                      IN ra_customer_trx.doc_sequence_value%TYPE,
				p_customer_number_l		 IN hz_cust_accounts.account_number%TYPE,  --Bug6734688
				p_customer_number_h		 IN hz_cust_accounts.account_number%TYPE,  --Bug6734688
				p_customer_name_l		 IN hz_parties.party_name%TYPE,  --Bug6734688
				p_customer_name_h		 IN hz_parties.party_name%TYPE,  --Bug6734688
                                p_batch_id                       IN ar_batches.batch_id%TYPE,
				p_approve_only_flag                  IN VARCHAR2 ,--Bug5344405
                                p_receipt_method_id              IN ar_receipt_methods.receipt_method_id%TYPE,
                                p_payment_schedule_id        OUT NOCOPY ar_payment_schedules.payment_schedule_id%TYPE,
                                p_customer_trx_id            OUT NOCOPY ar_payment_schedules.customer_trx_id%TYPE,
                                p_cash_receipt_id            OUT NOCOPY ar_cash_receipts.cash_receipt_id%TYPE,
                                p_paying_customer_id         OUT NOCOPY ar_payment_schedules.customer_id%TYPE,
                                p_paying_site_use_id         OUT NOCOPY hz_cust_site_uses.site_use_id%TYPE,
                                p_payment_server_order_num   OUT NOCOPY ra_customer_trx.payment_server_order_num%TYPE,
                                p_due_date                   OUT NOCOPY ar_payment_schedules.due_date%TYPE,
                                p_amount_due_remaining       OUT NOCOPY ar_payment_schedules.amount_due_remaining%TYPE,
                                p_cust_bank_account_id       OUT NOCOPY ra_customer_trx.customer_bank_account_id%TYPE,
                                p_cust_min_amt               OUT NOCOPY hz_cust_profile_amts.auto_rec_min_receipt_amount%TYPE,
                                p_payment_trxn_extension_id  OUT NOCOPY ra_customer_trx.payment_trxn_extension_id%TYPE,
                                p_payment_channel_code       OUT NOCOPY ar_receipt_methods.payment_channel_code%TYPE,
                                p_instrument_type              OUT NOCOPY IBY_PMT_INSTR_USES_ALL.instrument_type%TYPE,
                                p_return_status              OUT NOCOPY  VARCHAR2
                                 ) IS

                  trx_invoices INTEGER;
Line: 1254

    SELECT b.currency_code,
           b.batch_date,
           r.lead_days,
           r.receipt_creation_rule_code
    INTO   p_currency_code,
           p_batch_date,
           p_lead_days,
           p_creation_rule
    from   ar_batches b,
           ar_receipt_methods r
    WHERE  b.batch_id = p_batch_id
    AND    b.receipt_method_id = r.receipt_method_id
    AND   r.receipt_method_id = p_receipt_method_id;
Line: 1281

       SELECT /*+ leading(PS1) use_nl(ps,cust_cp,site_cp,cust_cpa,site_cpa,ct,x,u,p) rowid(ps) index_ffs(ps1) parallel_index(ps1) */
       ps.payment_schedule_id,
       ps.customer_trx_id,
       ps.cash_receipt_id,
       ct.paying_customer_id,
       ct.paying_site_use_id,
       ct.payment_trxn_extension_id,
       ps.due_date,
       AR_AUTOREC_API.Get_Invoice_Bal_After_Disc(ps.payment_schedule_id,:apply_date),
       ct.customer_bank_account_id,
       DECODE(:creation_rule,
              ''PER_CUSTOMER'', NVL(cust_cpa.auto_rec_min_receipt_amount,0),
              ''PER_CUSTOMER_DUE_DATE'', NVL(cust_cpa.auto_rec_min_receipt_amount,0),
              nvl(nvl(site_cpa.auto_rec_min_receipt_amount,cust_cpa.auto_rec_min_receipt_amount),0)),
       p.payment_channel_code,
       u.instrument_id
       FROM   hz_customer_profiles cust_cp,
              hz_customer_profiles site_cp,
              hz_cust_profile_amts cust_cpa,
              hz_cust_profile_amts site_cpa,
              ra_customer_trx ct,
              iby_fndcpt_tx_extensions x,
	      iby_pmt_instr_uses_all u,
	      iby_fndcpt_pmt_chnnls_b p,
              ar_payment_schedules ps,
	      ar_payment_schedules_all ps1 ';
Line: 1324

         l_sel_stmt := l_sel_stmt|| ' AND    ps.selected_for_receipt_batch_id = :batch_id';
Line: 1326

	 l_sel_stmt := l_sel_stmt|| ' AND    ps.selected_for_receipt_batch_id  IS NULL ';
Line: 1416

   l_sel_stmt := l_sel_stmt || ' FOR UPDATE OF ps.selected_for_receipt_batch_id ';
Line: 1493

     arp_standard.debug( 'the select statemnt' || l_sel_stmt);
Line: 1558

  inst_stmt := 'insert into ar_receipts_gt values ( :psid_array,:trxid_array,:crid_array,
                                            :paycust_array,:paysite_array,:pmt_trxn_id_array,
                                            :duedate_array,:amtdue_array,:custbank_array,
                                            :cust_amt_array,null,:pmt_channel_array,:pmt_instr_array,null)';
Line: 1599

 arp_standard.debug( 'the select statemnt' || l_sel_stmt);
Line: 1604

END select_valid_invoices;
Line: 1645

	select ps.customer_id,
	       ps.customer_site_use_id,
	       ps.term_id,
	       ps.terms_sequence_number,
	       ps.trx_date,
	       ps.amount_due_original,
	       ps.amount_due_remaining,
	       ps.invoice_currency_code,
	       ps.discount_taken_unearned,
	       ps.discount_taken_earned,
	       ps.exchange_rate,
	       ctt.allow_overapplication_flag
	into
		l_customer_id,
		l_bill_to_site_use_id,
		l_term_id,
		l_installment,
		l_trx_date,
		l_amount_due_original,
		l_amount_due_remaining,
		l_trx_currency_code,
		l_discount_taken_unearned,
		l_discount_taken_earned,
		l_trx_exchange_rate,
		l_allow_overappln_flag
	from ar_payment_schedules ps,
	     ra_cust_trx_types ctt
	where ps.payment_schedule_id  = l_applied_payment_schedule_id
	      AND ps.cust_trx_type_id = ctt.cust_trx_type_id;
Line: 1796

SELECT receipt_creation_rule_code,receipt_class_id
INTO p_creation_rule,l_receipt_class_id
 FROM ar_receipt_methods
WHERE receipt_method_id = p_receipt_method_id;
Line: 1802

SELECT decode( confirm_flag, 'Y','AUTORECAPI',null)
INTO   l_called_from
FROM ar_receipt_classes
WHERE receipt_class_id = l_receipt_class_id;
Line: 1818

SQL> select distinct receipt_creation_rule_code
  2  from ar_receipt_methods;
Line: 1835

           SELECT DISTINCT payment_schedule_id
           FROM   ar_receipts_gt
           WHERE  PAYMENT_SCHEDULE_ID is not null;
Line: 1845

    select b.set_of_books_id,r.name,
           b.batch_date,
           b.currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,DECODE(exchange_rate_type,'User',exchange_rate,NULL)
           ,exchange_date
           ,exchange_rate_type
           /** Changes for Bug 7313058 End Here **/
           ,nvl(r.receipt_inherit_inv_num_flag,'N')
    into   p_set_of_books_id,
           p_name,
           p_batch_date,
           p_currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,p_exchange_rate
           ,p_exchange_date
	   ,p_exchange_rate_type
	   /** Changes for Bug 7313058 End Here **/
           ,l_rec_inher_inv_num_flag
    from   ar_batches b,
           ar_receipt_methods r
    where  b.batch_id = p_batch_id
    and    r.receipt_method_id = p_receipt_method_id
    and    b.receipt_method_id = r.receipt_method_id;
Line: 1897

                UPDATE AR_RECEIPTS_GT
                SET    RECEIPT_NUMBER  = p_receipt_method_id||'-'||l_doc_sequence_value
                WHERE  payment_schedule_id = cust1.payment_schedule_id;
Line: 1901

                arp_standard.debug (to_char(SQL%ROWCOUNT) || ' row(s) updated.');
Line: 1926

     update ar_receipts_gt arg
     set receipt_number = (select trx_number||decode(terms_sequence_number,1,'','-'||terms_sequence_number)
           from ar_payment_schedules ps
           where ps.payment_schedule_id = arg.payment_schedule_id
           and rownum = 1)
     where payment_schedule_id > 0;
Line: 1933

     arp_standard.debug (to_char(SQL%ROWCOUNT) || ' row(s) updated to set receipt_number.');
Line: 1958

select receipt_number rec_num,
customer_trx_id,
payment_schedule_id,
paying_customer_id pay_cust_id,
payment_trxn_extension_id pmt_trxn_ext_id,
paying_site_use_id pay_site_use_id,
sum(amount_due_remaining) amt
from AR_RECEIPTS_GT
group by receipt_number,customer_trx_id,payment_schedule_id,paying_customer_id,payment_trxn_extension_id, paying_site_use_id;
Line: 1989

  select 'ARZCAR_CUST_MIN_AMT'
  INTO  l_err_code
  from  dual
  WHERE  exists (select 1 from HZ_CUST_PROFILE_AMTS where cust_account_id = R2.pay_cust_id
  AND    auto_rec_min_receipt_amount > R2.amt
  AND    currency_code = p_currency_code); -- Currency_Code Condition Added for Bug:5488085
Line: 2000

                        insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_payment_schedule_id => R2.payment_schedule_id,
                           p_paying_customer_id =>R2.pay_cust_id,
                           p_exception_code  => l_err_code ,
                           p_additional_message => l_err_code
                             );
Line: 2008

       Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R2.rec_num);
Line: 2011

       Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R2.rec_num;
Line: 2024

   select nvl(terms_sequence_number,1)
   into l_installment
   from ar_payment_schedules
   where payment_schedule_id = R2.payment_schedule_id;
Line: 2062

   Update ar_receipts_gt set cash_receipt_id = l_cr_id
   where receipt_number = R2.rec_num
   and customer_trx_id = R2.customer_trx_id
   and payment_schedule_id = R2.payment_schedule_id;
Line: 2069

   Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R2.rec_num
                                and customer_trx_id = R2.customer_trx_id
                                and payment_schedule_id = R2.payment_schedule_id);
Line: 2074

   Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R2.rec_num
   and customer_trx_id = R2.customer_trx_id
   and payment_schedule_id = R2.payment_schedule_id;
Line: 2085

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R2.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 2104

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R2.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 2140

           SELECT paying_customer_id,payment_instrument
           FROM   AR_RECEIPTS_GT
           WHERE  PAYMENT_SCHEDULE_ID is not null
           Group by paying_customer_id,payment_instrument;
Line: 2152

    select b.set_of_books_id,r.name,
           b.batch_date,
           b.currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,DECODE(exchange_rate_type,'User',exchange_rate,NULL)
           ,exchange_date
           ,exchange_rate_type
           /** Changes for Bug 7313058 End Here **/
    into   p_set_of_books_id,
           p_name,
           p_batch_date,
           p_currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,p_exchange_rate
           ,p_exchange_date
	   ,p_exchange_rate_type
	   /** Changes for Bug 7313058 End Here **/
    from   ar_batches b,
           ar_receipt_methods r
    where  b.batch_id = p_batch_id
    and    r.receipt_method_id = p_receipt_method_id
    and    b.receipt_method_id = r.receipt_method_id;
Line: 2201

                UPDATE AR_RECEIPTS_GT
                SET    RECEIPT_NUMBER  = p_receipt_method_id||'-'||l_doc_sequence_value
                WHERE  paying_customer_id = cust2.paying_customer_id
                AND    payment_instrument = cust2.payment_instrument;
Line: 2206

                arp_standard.debug (to_char(SQL%ROWCOUNT) || ' row(s) updated.');
Line: 2251

select receipt_number rec_num,
paying_customer_id pay_cust_id,
sum(amount_due_remaining) amt
from AR_RECEIPTS_GT
group by receipt_number,paying_customer_id;
Line: 2278

  select 'ARZCAR_CUST_MIN_AMT'
  INTO  l_err_code
  from  dual
  WHERE  exists (select 1 from HZ_CUST_PROFILE_AMTS where cust_account_id = R1.pay_cust_id
  AND    auto_rec_min_receipt_amount > R1.amt
  AND    currency_code = p_currency_code); -- For Bug:5488085
Line: 2291

			select payment_schedule_id
			from AR_RECEIPTS_GT
			where receipt_number = R1.rec_num;
Line: 2296

			insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_payment_schedule_id => R1_inv.payment_schedule_id,
                           p_paying_customer_id =>R1.pay_cust_id,
                           p_exception_code  => l_err_code ,
                           p_additional_message => l_err_code
                             );
Line: 2306

       Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R1.rec_num);
Line: 2309

         Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R1.rec_num;
Line: 2322

    select payment_trxn_extension_id
    into   l_payment_trxn_extension_id
    from ar_receipts_gt
    where receipt_number = R1.rec_num
    and   paying_customer_id = R1.pay_cust_id
    and rownum = 1;
Line: 2362

   Update ar_receipts_gt set cash_receipt_id = l_cr_id
   where receipt_number = R1.rec_num;
Line: 2367

   Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R1.rec_num);
Line: 2370

   Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R1.rec_num;
Line: 2376

                        insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R1.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 2395

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R1.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 2427

           SELECT paying_site_use_id,payment_instrument
           FROM   AR_RECEIPTS_GT
           WHERE  PAYMENT_SCHEDULE_ID is not null
           Group by paying_site_use_id,payment_instrument;
Line: 2438

    select b.set_of_books_id,r.name,
           b.batch_date,
           b.currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,DECODE(exchange_rate_type,'User',exchange_rate,NULL)
           ,exchange_date
           ,exchange_rate_type
           /** Changes for Bug 7313058 End Here **/
    into   p_set_of_books_id,
           p_name,
           p_batch_date,
           p_currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,p_exchange_rate
           ,p_exchange_date
	   ,p_exchange_rate_type
	   /** Changes for Bug 7313058 End Here **/
    from   ar_batches b,
           ar_receipt_methods r
    where  b.batch_id = p_batch_id
    and    r.receipt_method_id = p_receipt_method_id
    and    b.receipt_method_id = r.receipt_method_id;
Line: 2490

                UPDATE AR_RECEIPTS_GT
                SET    RECEIPT_NUMBER  = p_receipt_method_id||'-'||l_doc_sequence_value
                WHERE  paying_site_use_id = cust3.paying_site_use_id
                AND    payment_instrument = cust3.payment_instrument;
Line: 2495

                arp_standard.debug (to_char(SQL%ROWCOUNT) || ' row(s) updated.');
Line: 2537

select receipt_number rec_num,
paying_customer_id pay_cust_id,
paying_site_use_id pay_site_id,
sum(amount_due_remaining) amt
from AR_RECEIPTS_GT
group by receipt_number,paying_customer_id,paying_site_use_id;
Line: 2566

  select 'ARZCAR_CUST_MIN_AMT'
  INTO  l_err_code
  from  dual
  WHERE  exists (select 1 from HZ_CUST_PROFILE_AMTS where cust_account_id = R3.pay_cust_id
  AND    auto_rec_min_receipt_amount > R3.amt
  AND    currency_code = p_currency_code); --For Bug:5488085
Line: 2579

			select payment_schedule_id
			from AR_RECEIPTS_GT
			where receipt_number = R3.rec_num;
Line: 2584

			insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_payment_schedule_id => R3_inv.payment_schedule_id,
                           p_paying_customer_id =>R3.pay_cust_id,
                           p_exception_code  => l_err_code ,
                           p_additional_message => l_err_code
                             );
Line: 2595

       Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R3.rec_num);
Line: 2598

       Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R3.rec_num;
Line: 2610

    select payment_trxn_extension_id
    into   l_payment_trxn_extension_id
    from ar_receipts_gt
    where receipt_number = R3.rec_num
    and   paying_customer_id = R3.pay_cust_id
    and   paying_site_use_id = R3.pay_site_id
    and rownum = 1;
Line: 2652

   Update ar_receipts_gt set cash_receipt_id = l_cr_id
   where receipt_number = R3.rec_num;
Line: 2657

   Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R3.rec_num);
Line: 2660

   Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R3.rec_num;
Line: 2666

                        insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R3.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 2686

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R3.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 2719

           SELECT paying_site_use_id ,due_date,payment_instrument
           FROM   ar_receipts_gt
           WHERE  payment_schedule_id is not null
           Group by paying_site_use_id,due_date,payment_instrument;
Line: 2730

    select b.set_of_books_id,r.name,
           b.batch_date,
           b.currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,DECODE(exchange_rate_type,'User',exchange_rate,NULL)
           ,exchange_date
           ,exchange_rate_type
           /** Changes for Bug 7313058 End Here **/
    into   p_set_of_books_id,
           p_name,
           p_batch_date,
           p_currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,p_exchange_rate
           ,p_exchange_date
	   ,p_exchange_rate_type
	   /** Changes for Bug 7313058 End Here **/
    from   ar_batches b,
           ar_receipt_methods r
    where  b.batch_id = p_batch_id
    and    r.receipt_method_id = p_receipt_method_id
    and    b.receipt_method_id = r.receipt_method_id;
Line: 2779

                UPDATE AR_RECEIPTS_GT
                SET    RECEIPT_NUMBER  = p_receipt_method_id||'-'||l_doc_sequence_value
                WHERE  due_date = cust4.due_date
                AND    payment_instrument = cust4.payment_instrument
                AND    paying_site_use_id = cust4.paying_site_use_id;
Line: 2785

                arp_standard.debug (to_char(SQL%ROWCOUNT) || ' row(s) updated.');
Line: 2823

select receipt_number rec_num,
paying_customer_id pay_cust_id,
paying_site_use_id pay_site_id,
due_date,
sum(amount_due_remaining) amt
from ar_receipts_gt
group by receipt_number,paying_customer_id,paying_site_use_id,due_date;
Line: 2853

  select 'ARZCAR_CUST_MIN_AMT'
  INTO  l_err_code
  from  dual
  WHERE  exists (select 1 from HZ_CUST_PROFILE_AMTS where cust_account_id = R4.pay_cust_id
  AND    auto_rec_min_receipt_amount > R4.amt
  AND    currency_code = p_currency_code);--For Bug:5488085
Line: 2866

			select payment_schedule_id
			from AR_RECEIPTS_GT
			where receipt_number = R4.rec_num;
Line: 2871

			insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_payment_schedule_id => R4_inv.payment_schedule_id,
                           p_paying_customer_id =>R4.pay_cust_id,
                           p_exception_code  => l_err_code ,
                           p_additional_message => l_err_code
                             );
Line: 2882

       Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R4.rec_num);
Line: 2885

       Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R4.rec_num;
Line: 2898

    select payment_trxn_extension_id
    into   l_payment_trxn_extension_id
    from ar_receipts_gt
    where receipt_number = R4.rec_num
    and   paying_customer_id = R4.pay_cust_id
    and   paying_site_use_id = R4.pay_site_id
    and   due_date = R4.due_date
    and rownum = 1;
Line: 2942

   Update ar_receipts_gt set cash_receipt_id = l_cr_id
   where receipt_number = R4.rec_num;
Line: 2947

   Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R4.rec_num);
Line: 2950

   Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R4.rec_num;
Line: 2956

                        insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R4.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 2979

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R4.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 3012

           SELECT paying_customer_id ,due_date,payment_instrument
           FROM   ar_receipts_gt
           WHERE  payment_schedule_id is not null
           Group by paying_customer_id ,due_date,payment_instrument;
Line: 3023

    select b.set_of_books_id,r.name,
           b.batch_date,
           b.currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,DECODE(exchange_rate_type,'User',exchange_rate,NULL)
           ,exchange_date
           ,exchange_rate_type
           /** Changes for Bug 7313058 End Here **/
    into   p_set_of_books_id,
           p_name,
           p_batch_date,
           p_currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,p_exchange_rate
           ,p_exchange_date
	   ,p_exchange_rate_type
	   /** Changes for Bug 7313058 End Here **/
    from   ar_batches b,
           ar_receipt_methods r
    where  b.batch_id = p_batch_id
    and    r.receipt_method_id = p_receipt_method_id
   and    b.receipt_method_id = r.receipt_method_id;
Line: 3073

                UPDATE AR_RECEIPTS_GT
                SET    RECEIPT_NUMBER  = p_receipt_method_id||'-'||l_doc_sequence_value
                WHERE  due_date = cust5.due_date
                AND    payment_instrument = cust5.payment_instrument;
Line: 3078

                arp_standard.debug (to_char(SQL%ROWCOUNT) || ' row(s) updated.');
Line: 3114

select receipt_number rec_num,
paying_customer_id pay_cust_id,
due_date,
sum(amount_due_remaining) amt
from ar_receipts_gt
group by receipt_number,paying_customer_id,due_date;
Line: 3143

  select 'ARZCAR_CUST_MIN_AMT'
  INTO  l_err_code
  from  dual
  WHERE  exists (select 1 from HZ_CUST_PROFILE_AMTS where cust_account_id = R5.pay_cust_id
  AND    auto_rec_min_receipt_amount > R5.amt
  AND    currency_code = p_currency_code); --For Bug:5488085
Line: 3156

			select payment_schedule_id
			from AR_RECEIPTS_GT
			where receipt_number = R5.rec_num;
Line: 3161

			insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_payment_schedule_id => R5_inv.payment_schedule_id,
                           p_paying_customer_id =>R5.pay_cust_id,
                           p_exception_code  => l_err_code ,
                           p_additional_message => l_err_code
                             );
Line: 3171

       Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R5.rec_num);
Line: 3174

       Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R5.rec_num;
Line: 3187

    select payment_trxn_extension_id
    into   l_payment_trxn_extension_id
    from ar_receipts_gt
    where receipt_number = R5.rec_num
    and   paying_customer_id = R5.pay_cust_id
    and due_date   = R5.due_date
    and rownum = 1;
Line: 3229

   Update ar_receipts_gt set cash_receipt_id = l_cr_id
   where receipt_number = R5.rec_num;
Line: 3234

   Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R5.rec_num);
Line: 3237

   Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R5.rec_num;
Line: 3243

                        insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R5.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 3265

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R5.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 3299

           select payment_channel_code,paying_customer_id,payment_trxn_extension_id
           from ar_receipts_gt where payment_schedule_id is not null
           group by payment_channel_code, paying_customer_id,payment_trxn_extension_id;
Line: 3310

    select b.set_of_books_id,r.name,
           b.batch_date,
           b.currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,DECODE(exchange_rate_type,'User',exchange_rate,NULL)
           ,exchange_date
           ,exchange_rate_type
           /** Changes for Bug 7313058 End Here **/
    into   p_set_of_books_id,
           p_name,
           p_batch_date,
           p_currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,p_exchange_rate
           ,p_exchange_date
	   ,p_exchange_rate_type
	   /** Changes for Bug 7313058 End Here **/
    from   ar_batches b,
           ar_receipt_methods r
    where  b.batch_id = p_batch_id
    and    r.receipt_method_id = p_receipt_method_id
    and    b.receipt_method_id = r.receipt_method_id;
Line: 3360

                UPDATE ar_receipts_gt
                SET    RECEIPT_NUMBER  = p_receipt_method_id||'-'||l_doc_sequence_value
                WHERE  payment_channel_code = cust6.payment_channel_code
                and    payment_trxn_extension_id = cust6.payment_trxn_extension_id;
Line: 3365

                arp_standard.debug (to_char(SQL%ROWCOUNT) || ' row(s) updated.');
Line: 3402

select receipt_number rec_num,
paying_customer_id pay_cust_id,
payment_trxn_extension_id pmt_trxn_ext_id,
sum(amount_due_remaining) amt
from ar_receipts_gt
group by receipt_number,paying_customer_id,customer_bank_account_id,payment_trxn_extension_id;
Line: 3428

  select 'ARZCAR_CUST_MIN_AMT'
  INTO  l_err_code
  from  dual
  WHERE  exists (select 1 from HZ_CUST_PROFILE_AMTS where cust_account_id = R6.pay_cust_id
  AND    auto_rec_min_receipt_amount > R6.amt
  AND    currency_code = p_currency_code);--For Bug:5488085
Line: 3441

			select payment_schedule_id
			from AR_RECEIPTS_GT
			where receipt_number = R6.rec_num;
Line: 3446

			insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_payment_schedule_id => R6_inv.payment_schedule_id,
                           p_paying_customer_id =>R6.pay_cust_id,
                           p_exception_code  => l_err_code ,
                           p_additional_message => l_err_code
                             );
Line: 3456

       Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R6.rec_num);
Line: 3459

       Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R6.rec_num;
Line: 3501

   Update ar_receipts_gt set cash_receipt_id = l_cr_id
   where receipt_number = R6.rec_num;
Line: 3506

   Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R6.rec_num);
Line: 3509

   Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R6.rec_num;
Line: 3514

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R6.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 3532

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R6.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 3565

           select payment_instrument,paying_customer_id,payment_trxn_extension_id
           from ar_receipts_gt where payment_schedule_id is not null
           group by payment_instrument,paying_customer_id,payment_trxn_extension_id;
Line: 3576

    select b.set_of_books_id,r.name,
           b.batch_date,
           b.currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,DECODE(exchange_rate_type,'User',exchange_rate,NULL)
           ,exchange_date
           ,exchange_rate_type
           /** Changes for Bug 7313058 End Here **/
    into   p_set_of_books_id,
           p_name,
           p_batch_date,
           p_currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,p_exchange_rate
           ,p_exchange_date
	   ,p_exchange_rate_type
	   /** Changes for Bug 7313058 End Here **/
    from   ar_batches b,
           ar_receipt_methods r
    where  b.batch_id = p_batch_id
    and    r.receipt_method_id = p_receipt_method_id
    and    b.receipt_method_id = r.receipt_method_id;
Line: 3626

                UPDATE ar_receipts_gt
                SET    RECEIPT_NUMBER  = p_receipt_method_id||'-'||l_doc_sequence_value
                WHERE  payment_instrument = cust7.payment_instrument
                and    payment_trxn_extension_id = cust7.payment_trxn_extension_id;
Line: 3631

                arp_standard.debug (to_char(SQL%ROWCOUNT) || ' row(s) updated.');
Line: 3668

select receipt_number rec_num,
paying_customer_id pay_cust_id,
payment_trxn_extension_id pmt_trxn_ext_id,
sum(amount_due_remaining) amt
from ar_receipts_gt
group by receipt_number,paying_customer_id,payment_trxn_extension_id;
Line: 3693

  select 'ARZCAR_CUST_MIN_AMT'
  INTO  l_err_code
  from  dual
  WHERE  exists (select 1 from HZ_CUST_PROFILE_AMTS where cust_account_id = R7.pay_cust_id
  AND    auto_rec_min_receipt_amount > R7.amt
  AND    currency_code = p_currency_code); --For Bug:5488085
Line: 3706

			select payment_schedule_id
			from AR_RECEIPTS_GT
			where receipt_number = R7.rec_num;
Line: 3711

			insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_payment_schedule_id => R7_inv.payment_schedule_id,
                           p_paying_customer_id =>R7.pay_cust_id,
                           p_exception_code  => l_err_code ,
                           p_additional_message => l_err_code
                             );
Line: 3721

       Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R7.rec_num);
Line: 3724

       Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R7.rec_num;
Line: 3766

   Update ar_receipts_gt set cash_receipt_id = l_cr_id
   where receipt_number = R7.rec_num;
Line: 3771

   Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R7.rec_num);
Line: 3774

   Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R7.rec_num;
Line: 3780

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R7.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 3797

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R7.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 3830

           select authorization_id,paying_customer_id,payment_trxn_extension_id
           from ar_receipts_gt where payment_schedule_id is not null
           group by authorization_id,paying_customer_id,payment_trxn_extension_id;
Line: 3841

    select b.set_of_books_id,r.name,
           b.batch_date,
           b.currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,DECODE(exchange_rate_type,'User',exchange_rate,NULL)
           ,exchange_date
           ,exchange_rate_type
           /** Changes for Bug 7313058 End Here **/
    into   p_set_of_books_id,
           p_name,
           p_batch_date,
           p_currency_code
           /** Changes for Bug 7313058 Start Here **/
           ,p_exchange_rate
           ,p_exchange_date
	   ,p_exchange_rate_type
	   /** Changes for Bug 7313058 End Here **/
    from   ar_batches b,
           ar_receipt_methods r
    where  b.batch_id = p_batch_id
    and    r.receipt_method_id = p_receipt_method_id
    and    b.receipt_method_id = r.receipt_method_id;
Line: 3891

                UPDATE ar_receipts_gt
                SET    RECEIPT_NUMBER  = p_receipt_method_id||'-'||l_doc_sequence_value
                WHERE  authorization_id = cust8.authorization_id
                and    payment_trxn_extension_id = cust8.payment_trxn_extension_id;
Line: 3896

                arp_standard.debug (to_char(SQL%ROWCOUNT) || ' row(s) updated.');
Line: 3933

select receipt_number rec_num,
paying_customer_id pay_cust_id,
payment_trxn_extension_id pmt_trxn_ext_id,
sum(amount_due_remaining) amt
from ar_receipts_gt
group by receipt_number,paying_customer_id,payment_trxn_extension_id;
Line: 3959

  select 'ARZCAR_CUST_MIN_AMT'
  INTO  l_err_code
  from  dual
  WHERE  exists (select 1 from HZ_CUST_PROFILE_AMTS where cust_account_id = R8.pay_cust_id
  AND    auto_rec_min_receipt_amount > R8.amt
  AND    currency_code = p_currency_code); --For Bug:5488085
Line: 3972

			select payment_schedule_id
			from AR_RECEIPTS_GT
			where receipt_number = R8.rec_num;
Line: 3977

			insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_payment_schedule_id => R8_inv.payment_schedule_id,
                           p_paying_customer_id =>R8.pay_cust_id,
                           p_exception_code  => l_err_code ,
                           p_additional_message => l_err_code
                             );
Line: 3987

       Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R8.rec_num);
Line: 3990

       Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R8.rec_num;
Line: 4031

   Update ar_receipts_gt set cash_receipt_id = l_cr_id
   where receipt_number = R8.rec_num;
Line: 4036

   Update ar_payment_schedules set selected_for_receipt_batch_id = null
       where payment_schedule_id in (select payment_schedule_id from ar_receipts_gt
                                where receipt_number = R8.rec_num);
Line: 4039

   Update ar_receipts_gt set payment_schedule_id = -99999 where receipt_number = R8.rec_num;
Line: 4045

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R8.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 4062

                       insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>R8.pay_cust_id,
                           p_exception_code  => 'AUTORECERR',
                           p_additional_message => l_count||l_msg_data
                             );
Line: 4095

                 insert_exceptions(
                           p_batch_id   =>p_batch_id,
                           p_request_id =>l_request_id,
                           p_paying_customer_id =>-3,
                           p_exception_code  => 'AR_CC_AUTH_FAILED',
                           p_additional_message => SQLERRM
                             );
Line: 4115

 |  PROCEDURE insert_exceptions                                           |
 |                                                                        |
 | DESCRIPTION                                                            |
 |                                                                        |
 |   This procedure is used to insert the exception record when           |
 |                                                                        |
 | PSEUDO CODE/LOGIC                                                      |
 |                                                                        |
 | PARAMETERS                                                             |
 |                                                                        |
 |                                                                        |
 | KNOWN ISSUES                                                           |
 |                                                                        |
 | NOTES                                                                  |
 |                                                                        |
 |                                                                        |
 | MODIFICATION HISTORY                                                   |
 | Date                     Author            Description of Changes      |
 | 16-JUL-2005              bichatte           Created                    |
 *=========================================================================*/
PROCEDURE insert_exceptions(
             p_batch_id               IN  ar_batches.batch_id%TYPE DEFAULT NULL,
             p_request_id             IN  ar_cash_receipts.request_id%TYPE DEFAULT NULL,
             p_cash_receipt_id        IN  ar_cash_receipts.cash_receipt_id%TYPE DEFAULT NULL,
             p_payment_schedule_id    IN  ar_payment_schedules.payment_schedule_id%TYPE DEFAULT NULL,
             p_paying_customer_id     IN  ar_cash_receipts.pay_from_customer%TYPE DEFAULT NULL,
             p_paying_site_use_id     IN  ar_cash_receipts.customer_site_use_id%TYPE DEFAULT NULL,
             p_due_date               IN  ar_payment_schedules.due_date%TYPE DEFAULT NULL,
             p_cust_min_rec_amount    IN  NUMBER DEFAULT NULL,
             p_bank_min_rec_amount    IN NUMBER DEFAULT NULL,
             p_exception_code         IN VARCHAR2,
             p_additional_message     IN VARCHAR2
             ) IS



             l_request_id              NUMBER;
Line: 4152

             l_last_updated_by         NUMBER;
Line: 4154

             l_last_update_login       NUMBER;
Line: 4164

             arp_standard.debug( 'enter insert exceptions');
Line: 4183

       l_last_updated_by := arp_standard.profile.last_update_login ;
Line: 4185

       l_last_update_login := arp_standard.profile.last_update_login ;
Line: 4192

    select pay_from_customer
    into l_paying_customer_id
    from ar_cash_receipts
    where cash_receipt_id = p_cash_receipt_id;
Line: 4202

arp_standard.debug(  'value of l_last_updated_by  '      || l_last_updated_by );
Line: 4204

arp_standard.debug(  'value of l_last_update_login '     || l_last_update_login );
Line: 4211

 INSERT
        INTO ar_autorec_exceptions
            (batch_id,
             request_id,
             cash_receipt_id,
             payment_schedule_id,
             paying_customer_id,
             paying_site_use_id,
             due_date,
             cust_min_rec_amount,
             bank_min_rec_amount,
             exception_code,
             additional_message,
             last_update_date,
             last_updated_by,
             creation_date,
             created_by,
             last_update_login,
             program_application_id,
             program_id,
             program_update_date)
        SELECT
             p_batch_id,
             l_request_id,
             p_cash_receipt_id,
             p_payment_schedule_id,
             l_paying_customer_id,
             p_paying_site_use_id,
             p_due_date,
             p_cust_min_rec_amount,
             p_bank_min_rec_amount,
             p_exception_code,
             p_additional_message,
             sysdate,
             l_last_updated_by,
             sysdate,
             l_created_by,
             l_last_update_login,
             l_program_application_id,
             l_program_id,
             sysdate  FROM DUAL;
Line: 4261

      arp_standard.debug ( 'ERROR IN INSERT_AUTOREC_EXCEPTIONS' );
Line: 4265

END insert_exceptions;
Line: 4311

select org_id into l_org_id
from ar_batches_all
where batch_id = p_batch_id;
Line: 4356

   l_last_updated_by         NUMBER;
Line: 4358

   l_last_update_login       NUMBER;
Line: 4367

    l_last_updated_by := arp_standard.profile.last_update_login ;
Line: 4369

    l_last_update_login := arp_standard.profile.last_update_login ;
Line: 4375

UPDATE /*+ index(ct ra_customer_trx_u1) */ ra_customer_trx_all ct
SET cc_error_flag = 'Y',
  last_updated_by = l_last_updated_by,
  last_update_date = sysdate,
  last_update_login = l_last_update_login,
  request_id = l_request_id,
  program_application_id = l_program_application_id,
  program_id = l_program_id,
  program_update_date = sysdate
WHERE customer_trx_id in (
SELECT r.customer_trx_id
FROM ar_cash_receipts cr,
     ar_receipts_gt r,
  ar_cash_receipt_history crh,
  iby_trxn_extensions_v trxn_ext
WHERE cr.request_id = l_request_id
 AND r.cash_receipt_id = cr.cash_receipt_id
 AND crh.cash_receipt_id = cr.cash_receipt_id
 AND crh.status = 'CONFIRMED'
 AND crh.current_record_flag = 'Y'
 AND cr.payment_trxn_extension_id = trxn_ext.trxn_extension_id
 AND trxn_ext.authorized_flag = 'N'
 AND NOT EXISTS (SELECT 'x'
   FROM iby_fndcpt_tx_operations op,    iby_trxn_summaries_all summ
   WHERE cr.payment_trxn_extension_id = op.trxn_extension_id
   AND op.transactionid = summ.transactionid
   AND summ.reqtype in ('ORAPMTREQ','ORAPMTBATCHREQ')
   AND summ.status IN(0, 11, 100))
  );
Line: 4407

  INSERT INTO ar_autorec_exceptions
            (batch_id,
             request_id,
             cash_receipt_id,
             paying_customer_id,
             exception_code,
             additional_message,
             last_update_date,
             last_updated_by,
             creation_date,
             created_by,
             last_update_login,
             program_application_id,
             program_id,
             program_update_date)
        SELECT
             p_batch_id,
             l_request_id,
             cr.cash_receipt_id,
             cr.pay_from_customer,
             'AR_CC_AUTH_FAILED',
             'Failure in Authorization',
             sysdate,
             l_last_updated_by,
             sysdate,
             l_created_by,
             l_last_update_login,
             l_program_application_id,
             l_program_id,
             sysdate
          FROM ar_cash_receipts cr,
               ar_cash_receipt_history crh,
               iby_trxn_extensions_v trxn_ext
          WHERE cr.request_id = l_request_id
                AND crh.cash_receipt_id = cr.cash_receipt_id
                AND crh.status = 'CONFIRMED'
                AND crh.current_record_flag = 'Y'
                AND cr.payment_trxn_extension_id = trxn_ext.trxn_extension_id
                AND trxn_ext.authorized_flag = 'N'
                AND NOT EXISTS (SELECT 'x'
                  FROM iby_fndcpt_tx_operations op,    iby_trxn_summaries_all summ
                  WHERE cr.payment_trxn_extension_id = op.trxn_extension_id
                  AND op.transactionid = summ.transactionid
                  AND summ.reqtype in ('ORAPMTREQ','ORAPMTBATCHREQ')
                  AND summ.status IN(0, 11, 100));
Line: 4452

 fnd_file.put_line(FND_FILE.LOG,'insert into autorec_exceptions count : '||sql%rowcount);
Line: 4487

   payment_schedule_id before going in for the delete */

UPDATE /*+ index(ct ra_customer_trx_u1) */ ra_customer_trx_all ct
SET cc_error_flag = null,
cc_error_code = null,
cc_error_text = null
WHERE customer_trx_id in (
SELECT r.customer_trx_id
FROM ar_cash_receipts cr,
     ar_receipts_gt r,
  ar_cash_receipt_history crh,
  iby_trxn_extensions_v trxn_ext
WHERE cr.request_id = l_request_id
 AND r.cash_receipt_id = cr.cash_receipt_id
 AND crh.cash_receipt_id = cr.cash_receipt_id
 AND crh.status = 'CONFIRMED'
 AND crh.current_record_flag = 'Y'
 AND cr.payment_trxn_extension_id = trxn_ext.trxn_extension_id
 AND trxn_ext.authorized_flag = 'Y'
 AND EXISTS (SELECT 'x'
   FROM iby_fndcpt_tx_operations op,    iby_trxn_summaries_all summ
   WHERE cr.payment_trxn_extension_id = op.trxn_extension_id
   AND op.transactionid = summ.transactionid
   AND summ.reqtype in ('ORAPMTREQ','ORAPMTBATCHREQ')
   AND summ.status IN(0, 11, 100))
  ) AND cc_error_flag = 'Y';
Line: 4514

fnd_file.put_line(FND_FILE.LOG,'receipt rows updated to reset cc_error_flag : '||sql%rowcount);
Line: 4516

delete from ar_autorec_exceptions
where cash_receipt_id in (
        SELECT
             cr.cash_receipt_id
          FROM ar_cash_receipts cr,
               ar_cash_receipt_history crh,
               iby_trxn_extensions_v trxn_ext
          WHERE cr.request_id = l_request_id
                AND crh.cash_receipt_id = cr.cash_receipt_id
                AND crh.status = 'CONFIRMED'
                AND crh.current_record_flag = 'Y'
                AND cr.payment_trxn_extension_id = trxn_ext.trxn_extension_id
                AND trxn_ext.authorized_flag = 'Y'
                AND EXISTS (SELECT 'x'
                  FROM iby_fndcpt_tx_operations op,    iby_trxn_summaries_all summ
                  WHERE cr.payment_trxn_extension_id = op.trxn_extension_id
                  AND op.transactionid = summ.transactionid
                  AND summ.reqtype in ('ORAPMTREQ','ORAPMTBATCHREQ')
                  AND summ.status IN(0, 11, 100))
) and request_id = l_request_id;
Line: 4537

fnd_file.put_line(FND_FILE.LOG,'rows deleted from ar_autorec_exceptions: '||sql%rowcount);
Line: 4553

             select ps.payment_schedule_id ps_id,
                       ps.trx_number trx_num,
                       nvl(ps.terms_sequence_number,1) inst_num,
                       ps.customer_trx_id trx_id,
                       r.receipt_number rec_num,
                       r.cash_receipt_id rec_id
             from ar_payment_schedules ps,
                    ra_customer_trx trx,
                    ar_receipts_gt r
             where trx.customer_trx_id = ps.customer_trx_id
             and    trx.cc_error_flag = 'Y'
             and    r.payment_schedule_id = ps.payment_schedule_id;
Line: 4654

           arp_standard.debug('delete the bad receipts');
Line: 4656

/* Start of delete XLA events code. Doing this is bulk */
    Begin
         IF PG_DEBUG in ('Y','C') THEN
             arp_standard.debug ( 'Start calling xla delete_bulk_events');
Line: 4660

	     arp_standard.debug ( 'Inserting into xla_events_int_gt...');
Line: 4663

	INSERT INTO xla_events_int_gt
           (event_id
	   ,ledger_id
	   ,entity_code
           ,application_id
           ,event_type_code
           ,entity_id
           ,event_number
           ,event_status_code
           ,process_status_code
           ,event_date
           ,transaction_date
           ,budgetary_control_flag
           ,reference_num_1
           ,reference_num_2
           ,reference_num_3
           ,reference_num_4
           ,reference_char_1
           ,reference_char_2
           ,reference_char_3
           ,reference_char_4
           ,reference_date_1
           ,reference_date_2
           ,reference_date_3
           ,reference_date_4
           ,on_hold_flag)
	( SELECT  event_id
	   ,ledger_id
	   ,entity_code
	   ,xte.application_id
	   ,event_type_code
	   ,xte.entity_id
	   ,event_number
	   ,event_status_code
	   ,process_status_code
	   ,TRUNC(event_date)
	   ,nvl(transaction_date, TRUNC(event_date))
	   ,'N'
	   ,reference_num_1
	   ,reference_num_2
	   ,reference_num_3
	   ,reference_num_4
	   ,reference_char_1
	   ,reference_char_2
	   ,reference_char_3
	   ,reference_char_4
	   ,reference_date_1
	   ,reference_date_2
	   ,reference_date_3
	   ,reference_date_4
	   ,on_hold_flag
	from  xla_transaction_entities_upg xte,
	      xla_events xe
	where xte.application_id = 222
	and   xte.entity_code    = 'RECEIPTS'
	and   xe.application_id  = 222
	and   xe.event_number    > 0
	and   xe.entity_id       = xte.entity_id
	and   xte.ledger_id  = ARP_STANDARD.sysparm.set_of_books_id
	and   NVL(xte.source_id_int_1, -99) IN
				(select distinct cash_receipt_id
		                 from ar_autorec_exceptions
				 where request_id = l_request_id));
Line: 4728

             arp_standard.debug ( 'rows inserted into xla gt table = '|| sql%rowcount);
Line: 4729

	     arp_standard.debug ( 'Calling xla_events_pub_pkg.delete_bulk_events()');
Line: 4732

	xla_events_pub_pkg.delete_bulk_events(222);
Line: 4735

             arp_standard.debug ( 'End calling xla delete_bulk_events');
Line: 4741

	     arp_standard.debug('Error in call to xla_events_pub_pkg.delete_bulk_events ' || sqlerrm);
Line: 4744

/* End of delete XLA events code */


           update ar_payment_schedules
           set selected_for_receipt_batch_id = null,
           gl_date_closed = TO_DATE('4712/12/31', 'YYYY/MM/DD'),
            status = 'OP'
           where payment_schedule_id in (
            select ps.payment_schedule_id
             from ar_payment_schedules ps,
                    ra_customer_trx trx
             where trx.customer_trx_id = ps.customer_trx_id
             and    trx.cc_error_flag = 'Y'
             and    trx.request_id = l_request_id);
Line: 4760

             arp_standard.debug ( ' rows updated PS = ' || SQL%ROWCOUNT );
Line: 4763

                delete from ar_payment_schedules
                where cash_receipt_id in (select distinct cash_receipt_id
               from ar_autorec_exceptions
               where request_id = l_request_id);
Line: 4769

             arp_standard.debug ( ' rows DELETED PS = ' || SQL%ROWCOUNT );
Line: 4772

		delete from ar_distributions
		where source_table = 'CRH'
		and source_id in ( select cash_receipt_history_id
		from ar_cash_receipt_history
		where cash_receipt_id in ( select distinct cash_receipt_id
                from ar_autorec_exceptions
                where request_id = l_request_id));
Line: 4781

             arp_standard.debug ( ' rows DELETED AR_DIST = ' || SQL%ROWCOUNT );
Line: 4784

		delete from ar_distributions
		where source_table = 'RA'
		and source_id in ( select receivable_application_id
		from ar_receivable_applications
		where cash_receipt_id in ( select distinct cash_receipt_id
                from ar_autorec_exceptions
                where request_id = l_request_id));
Line: 4793

             arp_standard.debug ( ' rows DELETED AR_DIST2 = ' || SQL%ROWCOUNT );
Line: 4796

		delete from ar_receivable_applications
		where cash_receipt_id in ( select distinct cash_receipt_id
                from ar_autorec_exceptions
                where request_id = l_request_id);
Line: 4802

             arp_standard.debug ( ' rows DELETED REC_APPS = ' || SQL%ROWCOUNT );
Line: 4804

		delete from ar_cash_receipt_history
		where cash_receipt_id in ( select distinct cash_receipt_id
                from ar_autorec_exceptions
                where request_id = l_request_id);
Line: 4810

             arp_standard.debug ( ' rows DELETED CRH = ' || SQL%ROWCOUNT );
Line: 4813

		delete from ar_cash_receipts
		where cash_receipt_id in ( select distinct cash_receipt_id
                from ar_autorec_exceptions
                where request_id = l_request_id);
Line: 4819

             arp_standard.debug ( ' rows DELETED CR  = ' || SQL%ROWCOUNT );
Line: 4861

select org_id into l_org_id
from ar_batches_all
where batch_id = p_batch_id;
Line: 4892

	  update ar_batches SET
	    batch_applied_status = 'COMPLETED_APPROVAL'
	    where batch_id = p_batch_id;
Line: 4898

	    update ar_batches SET
	    batch_applied_status = 'COMPLETED_APPROVAL'
	    where batch_id = p_batch_id;
Line: 4903

	    update ar_batches SET
	    batch_applied_status = 'COMPLETED_FORMAT'
	    where batch_id = p_batch_id;