DBA Data[Home] [Help]

APPS.AR_RECEIPT_API_PUB SQL Statements

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

Line: 17

pg_update_claim_amount	 NUMBER; /* Bug 4170060 for rct to rct applications */
Line: 578

        select nvl(RECEIPT_CREATION_RULE_CODE,'MANUAL')
        into   l_rec_creation_rule_code
        from  AR_RECEIPT_METHODS
        where receipt_method_id = l_receipt_method_id;
Line: 732

          arp_proc_receipts2.insert_cash_receipt(
  						l_currency_code,
						l_amount,
						l_customer_id,
						l_receipt_number,
						l_receipt_date,
						l_gl_date,
						l_maturity_date,
						p_comments,
						l_exchange_rate_type,
						l_exchange_rate,
						l_exchange_rate_date,
						NULL,  --batch_id
						l_attribute_rec.attribute_category,
						l_attribute_rec.attribute1,
						l_attribute_rec.attribute2,
						l_attribute_rec.attribute3,
						l_attribute_rec.attribute4,
						l_attribute_rec.attribute5,
						l_attribute_rec.attribute6,
						l_attribute_rec.attribute7,
						l_attribute_rec.attribute8,
						l_attribute_rec.attribute9,
						l_attribute_rec.attribute10,
						l_attribute_rec.attribute11,
						l_attribute_rec.attribute12,
						l_attribute_rec.attribute13,
						l_attribute_rec.attribute14,
						l_attribute_rec.attribute15,
						l_override_remit_account_flag,
						l_remit_bank_acct_use_id ,
                                                l_customer_bank_account_id ,
						l_customer_site_use_id,
						l_customer_receipt_reference ,
						l_factor_discount_amount ,
						l_deposit_date,
						l_receipt_method_id,
						l_doc_sequence_value,
						l_doc_sequence_id,
						l_ussgl_transaction_code ,
                                                NULL,   --Vat_tax_id
						l_anticipated_clearing_date ,
                                                l_customer_bank_branch_id,
                                                l_postmark_date,
						l_global_attribute_rec.global_attribute1,
						l_global_attribute_rec.global_attribute2,
						l_global_attribute_rec.global_attribute3,
						l_global_attribute_rec.global_attribute4,
						l_global_attribute_rec.global_attribute5,
						l_global_attribute_rec.global_attribute6,
						l_global_attribute_rec.global_attribute7,
						l_global_attribute_rec.global_attribute8,
						l_global_attribute_rec.global_attribute9,
						l_global_attribute_rec.global_attribute10,
						l_global_attribute_rec.global_attribute11,
						l_global_attribute_rec.global_attribute12,
						l_global_attribute_rec.global_attribute13,
						l_global_attribute_rec.global_attribute14,
						l_global_attribute_rec.global_attribute15,
						l_global_attribute_rec.global_attribute16,
						l_global_attribute_rec.global_attribute17,
						l_global_attribute_rec.global_attribute18,
						l_global_attribute_rec.global_attribute19,
						l_global_attribute_rec.global_attribute20,
						l_global_attribute_rec.global_attribute_category,
                                                p_issuer_name,
                                                trunc(p_issue_date), /* Bug fix 3135407 */
                                                p_issuer_bank_branch_id,
                                                null,  -- application_notes
						l_cr_id,
						l_ps_id,
						l_row_id,
						'RAPI',
						p_api_version
                                                ,p_called_from
						,l_legal_entity_id /* R12 LE updtake */
                                                ,l_payment_trxn_extension_id /* payment uptake */
				           );
Line: 826

                       FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','ARP_PROC_RECEIPTS2.INSERT_CASH_RECEIPT : '||SQLERRM);
Line: 1319

           select COUNT(*) into l_gt from ra_customer_trx_lines_gt where customer_trx_id=p_customer_trx_id;
Line: 1322

      delete FROM ra_customer_trx_lines_gt where customer_trx_id=p_customer_trx_id;
Line: 2264

     select count(1) into l_count from ar_llca_trx_errors_gt
     where customer_trx_id = p_customer_trx_id;
Line: 2448

       ar_receipt_val_pvt.validate_llca_insert_ad(
	p_cash_receipt_id        => l_cash_receipt_id
	,p_customer_trx_id       => l_customer_trx_id
        ,p_customer_trx_line_id  => l_customer_trx_line_id
	,p_cr_unapp_amount       => l_cr_unapp_amount
        ,p_llca_type             => l_llca_type
        ,p_group_id              => l_group_id
        ,p_line_amount           => l_line_amount
	,p_tax_amount            => l_tax_amount
	,p_freight_amount        => l_freight_amount
	,p_charges_amount        => l_charges_amount
	,p_line_discount         => l_line_discount
	,p_tax_discount          => l_tax_discount
	,p_freight_discount      => l_freight_discount
	,p_amount_applied        => l_amount_applied
	,p_amount_applied_from   => l_amount_applied_from
	,p_trans_to_receipt_rate => l_trans_to_receipt_rate
	,p_invoice_currency_code => l_trx_currency_code
	,p_receipt_currency_code => l_cr_currency_code
	,p_earned_discount       => l_discount_earned_allowed
	,p_unearned_discount     => l_discount_unearned
	,p_max_discount          => l_discount_max_allowed
	,p_line_items_original	 => l_line_items_original
	,p_line_items_remaining	 => l_line_items_remaining
	,p_tax_original		 => l_tax_original
	,p_tax_remaining	 => l_tax_remaining
	,p_freight_original	 => l_freight_original
	,p_freight_remaining	 => l_freight_remaining
	,p_rec_charges_charged	 => l_rec_charges_charged
	,p_rec_charges_remaining => l_rec_charges_remaining
	,p_attribute_category	 => l_line_attribute_rec.attribute_category
	,p_attribute1		 => l_line_attribute_rec.attribute1
        ,p_attribute2		 => l_line_attribute_rec.attribute2
        ,p_attribute3		 => l_line_attribute_rec.attribute3
        ,p_attribute4	  	 => l_line_attribute_rec.attribute4
        ,p_attribute5		 => l_line_attribute_rec.attribute5
        ,p_attribute6		 => l_line_attribute_rec.attribute6
        ,p_attribute7		 => l_line_attribute_rec.attribute7
        ,p_attribute8		 => l_line_attribute_rec.attribute8
        ,p_attribute9		 => l_line_attribute_rec.attribute9
        ,p_attribute10		 => l_line_attribute_rec.attribute10
        ,p_attribute11		 => l_line_attribute_rec.attribute11
        ,p_attribute12		 => l_line_attribute_rec.attribute12
        ,p_attribute13		 => l_line_attribute_rec.attribute13
        ,p_attribute14		 => l_line_attribute_rec.attribute14
        ,p_attribute15		 => l_line_attribute_rec.attribute15
        ,p_comments		 => p_comments
	,p_return_status	 => l_llca_return_status
	,p_msg_count		 => l_llca_msg_count
	,p_msg_data		 => l_llca_msg_data
	);
Line: 2538

     ar_receipt_val_pvt.validate_llca_insert_app(
	p_cash_receipt_id       => l_cash_receipt_id
	,p_customer_trx_id       => l_customer_trx_id
        ,p_disc_earn_allowed     => l_discount_earned_allowed
        ,p_disc_max_allowed      => l_discount_max_allowed
	,p_return_status	 => l_llca_app_return_status
	,p_msg_count		 => l_llca_app_msg_count
	,p_msg_data		 => l_llca_app_msg_data
         );
Line: 2709

		update ar_activity_details
	         set source_table = 'RA',
		     source_id = llca_ra_rec.receivable_application_id
	       where source_id is null
	         and nvl(current_activity_flag, 'Y') = 'Y' -- Bug 7241111
	         and cash_receipt_id = l_cash_receipt_id
	         and customer_trx_line_id in (select customer_trx_line_id
						from ra_customer_trx_lines
	                                    where customer_trx_id = l_customer_trx_id);
Line: 2720

                 delete from ar_llca_trx_lines_gt
                 where customer_trx_id = l_customer_trx_id;
Line: 3071

         SELECT application_ref_type,
                secondary_application_ref_id,
                amount_applied
         INTO   l_application_ref_type,
                l_secondary_app_ref_id,
                l_amount_applied
         FROM   ar_receivable_applications
         WHERE  receivable_application_id = l_receivable_application_id;
Line: 3135

	-- LLCA - Delete the activity record if llca exists. We need to modify the LLCA update
	-- logic to preserve the previous record details on AR_ACTIVITY_DETAILS instead of
	--- removing it.  Open bug exist for this issue.
	/*
	delete from ar_activity_details ad
	where ad.cash_receipt_id  = l_cash_receipt_id
        and  ad.customer_trx_line_id in
		(select customer_trx_line_id from ra_customer_trx_lines
		 where customer_trx_id = l_customer_trx_id);
Line: 3148

INSERT INTO AR_ACTIVITY_DETAILS(
                                CASH_RECEIPT_ID,
                                CUSTOMER_TRX_LINE_ID,
                                ALLOCATED_RECEIPT_AMOUNT,
                                AMOUNT,
                                TAX,
                                FREIGHT,
                                CHARGES,
                                LAST_UPDATE_DATE,
                                LAST_UPDATED_BY,
                                LINE_DISCOUNT,
                                TAX_DISCOUNT,
                                FREIGHT_DISCOUNT,
                                LINE_BALANCE,
                                TAX_BALANCE,
                                CREATION_DATE,
                                CREATED_BY,
                                LAST_UPDATE_LOGIN,
                                COMMENTS,
                                APPLY_TO,
                                ATTRIBUTE1,
                                ATTRIBUTE2,
                                ATTRIBUTE3,
                                ATTRIBUTE4,
                                ATTRIBUTE5,
                                ATTRIBUTE6,
                                ATTRIBUTE7,
                                ATTRIBUTE8,
                                ATTRIBUTE9,
                                ATTRIBUTE10,
                                ATTRIBUTE11,
                                ATTRIBUTE12,
                                ATTRIBUTE13,
                                ATTRIBUTE14,
                                ATTRIBUTE15,
                                ATTRIBUTE_CATEGORY,
                                GROUP_ID,
                                REFERENCE1,
                                REFERENCE2,
                                REFERENCE3,
                                REFERENCE4,
                                REFERENCE5,
                                OBJECT_VERSION_NUMBER,
                                CREATED_BY_MODULE,
                                SOURCE_ID,
                                SOURCE_TABLE,
                                LINE_ID,
			        CURRENT_ACTIVITY_FLAG)
                        SELECT
                                LLD.CASH_RECEIPT_ID,
                                LLD.CUSTOMER_TRX_LINE_ID,
                                LLD.ALLOCATED_RECEIPT_AMOUNT*-1,
                                LLD.AMOUNT*-1,
                                LLD.TAX*-1,
                                LLD.FREIGHT*-1,
                                LLD.CHARGES*-1,
                                LLD.LAST_UPDATE_DATE,
                                LLD.LAST_UPDATED_BY,
                                LLD.LINE_DISCOUNT,
                                LLD.TAX_DISCOUNT,
                                LLD.FREIGHT_DISCOUNT,
                                LLD.LINE_BALANCE,
                                LLD.TAX_BALANCE,
                                LLD.CREATION_DATE,
                                LLD.CREATED_BY,
                                LLD.LAST_UPDATE_LOGIN,
                                LLD.COMMENTS,
                                LLD.APPLY_TO,
                                LLD.ATTRIBUTE1,
                                LLD.ATTRIBUTE2,
                                LLD.ATTRIBUTE3,
                                LLD.ATTRIBUTE4,
                                LLD.ATTRIBUTE5,
                                LLD.ATTRIBUTE6,
                                LLD.ATTRIBUTE7,
                                LLD.ATTRIBUTE8,
                                LLD.ATTRIBUTE9,
                                LLD.ATTRIBUTE10,
                                LLD.ATTRIBUTE11,
                                LLD.ATTRIBUTE12,
                                LLD.ATTRIBUTE13,
                                LLD.ATTRIBUTE14,
                                LLD.ATTRIBUTE15,
                                LLD.ATTRIBUTE_CATEGORY,
                                LLD.GROUP_ID,
                                LLD.REFERENCE1,
                                LLD.REFERENCE2,
                                LLD.REFERENCE3,
                                LLD.REFERENCE4,
                                LLD.REFERENCE5,
                                LLD.OBJECT_VERSION_NUMBER,
                                LLD.CREATED_BY_MODULE,
                                LLD.SOURCE_ID,
                                LLD.SOURCE_TABLE,
                                ar_Activity_details_s.nextval,
                                'R'
                        FROM ar_Activity_details LLD
		        where LLD.cash_receipt_id = l_cash_receipt_id
			and nvl(LLD.CURRENT_ACTIVITY_FLAG, 'Y') = 'Y'
			and  LLD.customer_trx_line_id in
			(select customer_trx_line_id
			from ra_customer_trx_lines
			where customer_trx_id = l_customer_trx_id);
Line: 3252

		   UPDATE ar_Activity_details dtl
		     set CURRENT_ACTIVITY_FLAG = 'N'
			where dtl.cash_receipt_id = l_cash_receipt_id
			and nvl(dtl.CURRENT_ACTIVITY_FLAG, 'Y') = 'Y'
			and  dtl.customer_trx_line_id in
			(select customer_trx_line_id
			from ra_customer_trx_lines
			where customer_trx_id = l_customer_trx_id);
Line: 3425

     SELECT cr.receipt_number,
	    cr.amount,
            cr.currency_code,
            rm.merchant_ref,
            rc.creation_status,
            ba.bank_branch_id,
            ba.bank_account_num,
	    ba.bank_account_name,
            ba.inactive_date,
            cr.unique_reference   --bug 3672953
     FROM   ar_cash_receipts cr,
            ar_receipt_methods rm,
	    ar_receipt_classes rc,
            ap_bank_accounts ba
     WHERE  cr.cash_receipt_id = p_cash_receipt_id
       AND  cr.customer_bank_account_id = ba.bank_account_id
       AND  cr.receipt_method_id = rm.receipt_method_id
       and  rm.receipt_class_id = rc.receipt_class_id;
Line: 3558

        select 'ARI_'||ar_payment_server_ord_num_s.nextval
        into l_payment_server_order_num
        from dual;
Line: 3687

        ARP_CASH_RECEIPTS_PKG.update_p(l_cr_rec, p_cash_receipt_id);
Line: 3690

             arp_standard.debug('Apply: ' || 'CR rec updated with payment server auth code');
Line: 3820

     SELECT cr.receipt_number,
            cr.amount,
            cr.currency_code,
            rm.PAYMENT_CHANNEL_CODE,       /* NEW ADDED */
            rc.creation_status,            /* AR USE */
            cr.org_id,
            party.party_id,
            cr.pay_from_customer,
            cr.customer_site_use_id,
            cr.payment_trxn_extension_id,
            cr.receipt_date,
            pr.home_country
     FROM   ar_cash_receipts_all cr,
            ar_receipt_methods rm,
            ar_receipt_classes rc,
            hz_cust_accounts hca,
            hz_parties    party,
            /* Need to pass country code for SEPA specific receipts */
            ce_bank_acct_uses bau,
            ce_bank_accounts cba,
            hz_parties bank,
	    hz_organization_profiles pr
     WHERE  cr.cash_receipt_id = p_cash_receipt_id
     AND    hca.cust_account_id = cr.pay_from_customer
     AND    party.party_id = hca.party_id
     AND    rm.receipt_method_id = cr.receipt_method_id
     AND    rc.receipt_class_id = rm.receipt_class_id
     AND    bau.bank_acct_use_id = cr.remit_bank_acct_use_id
     AND    cba.bank_account_id = bau.bank_account_id
     AND    bank.party_id = cba.bank_id
     AND    pr.party_id = bank.party_id;
Line: 3990

                SELECT decode(summ.status,   NULL,   'N',   'Y') AUTHORIZED_FLAG
                   into l_auth_flag
                 FROM iby_trxn_summaries_all summ,
                      iby_fndcpt_tx_operations op
                WHERE summ.transactionid = op.transactionid
                      AND reqtype = 'ORAPMTREQ'
                      AND status IN(0,    100)
                      AND trxntypeid IN(2,   3, 20)
                      AND op.trxn_extension_id = p_payment_trxn_extension_id
                      AND summ.trxnmid =
                           (SELECT MAX(trxnmid)
                                FROM iby_trxn_summaries_all
                            WHERE transactionid = summ.transactionid
                            AND reqtype = 'ORAPMTREQ'
                            AND status IN(0, 100)
                            AND trxntypeid IN(2,    3,   20));
Line: 4015

                  select AUTHORIZATION_ID
                   into l_auth_id
                   from IBY_TRXN_EXT_AUTHS_V
                   where TRXN_EXTENSION_ID = p_payment_trxn_extension_id;
Line: 4026

                  ARP_CASH_RECEIPTS_PKG.update_p(l_cr_rec, p_cash_receipt_id);
Line: 4028

                 arp_standard.debug('CR rec updated with auth_id and auth code ');
Line: 4109

               ARP_CASH_RECEIPTS_PKG.update_p(l_cr_rec, p_cash_receipt_id);
Line: 4112

                 arp_standard.debug('CR rec updated with auth_id and auth code ');
Line: 4398

     SELECT party.party_id
     INTO   l_party_id
     FROM   hz_cust_accounts hca,
            hz_parties    party
     WHERE  hca.party_id = party.party_id
     AND    hca.cust_account_id = l_customer_id ;
Line: 4405

     SELECT INSTR_ASSIGNMENT_ID
     INTO  l_assignment_id
     from  iby_fndcpt_tx_extensions
     where trxn_extension_id = l_payment_trxn_extension_id;
Line: 4414

	SELECT i.start_date, i.end_date
	INTO   l_start_date, l_end_date
	FROM   iby_fndcpt_tx_extensions x, iby_pmt_instr_uses_all i
	WHERE  x.instr_assignment_id = i.instrument_payment_use_id
	AND    x.trxn_extension_id = p_payment_trxn_extension_id
	AND    x.INSTR_ASSIGNMENT_ID = l_assignment_id;
Line: 4603

                  SELECT INSTR_ASSIGNMENT_ID
                   into   l_assignment_id
                   FROM   iby_fndcpt_tx_extensions
                   where  trxn_extension_id = l_init_extension_id;
Line: 4609

                  SELECT party.party_id
                  INTO      l_party_id
                  FROM   hz_cust_accounts hca,
                               hz_parties    party
                  WHERE  hca.party_id = party.party_id
                   AND    hca.cust_account_id = l_customer_id ;
Line: 4616

                        SELECT payment_channel_code
     		INTO   l_payment_channel_code
    		 from ar_receipt_methods
    		 where receipt_method_id = p_receipt_method_id;
Line: 4624

	SELECT i.start_date, i.end_date
	INTO   l_start_date, l_end_date
	FROM   iby_fndcpt_tx_extensions x, iby_pmt_instr_uses_all i
	WHERE  x.instr_assignment_id = i.instrument_payment_use_id
	AND    x.trxn_extension_id = p_payment_trxn_extension_id
	AND    x.INSTR_ASSIGNMENT_ID = l_assignment_id;
Line: 4714

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

        select cr.payment_trxn_extension_id into l_trxn_extn_id
        from ar_Cash_receipts cr, ar_cash_receipt_history crh
        where cr.cash_receipt_id=crh.cash_receipt_id
        and   crh.current_record_flag= 'Y'
        and   crh.status = 'REMITTED'
        and cr.cash_receipt_id = p_cash_receipt_id;
Line: 5835

            Select receipt_method_id
    	    INTO   l_receipt_method_id
	    FROM   ar_cash_receipts
	    WHERE  cash_receipt_id  = l_cash_receipt_id ;
Line: 5926

	delete from ar_activity_details
        where cash_receipt_id  = l_cash_receipt_id;
Line: 5932

INSERT INTO AR_ACTIVITY_DETAILS(
                                CASH_RECEIPT_ID,
                                CUSTOMER_TRX_LINE_ID,
                                ALLOCATED_RECEIPT_AMOUNT,
                                AMOUNT,
                                TAX,
                                FREIGHT,
                                CHARGES,
                                LAST_UPDATE_DATE,
                                LAST_UPDATED_BY,
                                LINE_DISCOUNT,
                                TAX_DISCOUNT,
                                FREIGHT_DISCOUNT,
                                LINE_BALANCE,
                                TAX_BALANCE,
                                CREATION_DATE,
                                CREATED_BY,
                                LAST_UPDATE_LOGIN,
                                COMMENTS,
                                APPLY_TO,
                                ATTRIBUTE1,
                                ATTRIBUTE2,
                                ATTRIBUTE3,
                                ATTRIBUTE4,
                                ATTRIBUTE5,
                                ATTRIBUTE6,
                                ATTRIBUTE7,
                                ATTRIBUTE8,
                                ATTRIBUTE9,
                                ATTRIBUTE10,
                                ATTRIBUTE11,
                                ATTRIBUTE12,
                                ATTRIBUTE13,
                                ATTRIBUTE14,
                                ATTRIBUTE15,
                                ATTRIBUTE_CATEGORY,
                                GROUP_ID,
                                REFERENCE1,
                                REFERENCE2,
                                REFERENCE3,
                                REFERENCE4,
                                REFERENCE5,
                                OBJECT_VERSION_NUMBER,
                                CREATED_BY_MODULE,
                                SOURCE_ID,
                                SOURCE_TABLE,
                                LINE_ID,
			        CURRENT_ACTIVITY_FLAG)
                        SELECT
                                LLD.CASH_RECEIPT_ID,
                                LLD.CUSTOMER_TRX_LINE_ID,
                                LLD.ALLOCATED_RECEIPT_AMOUNT*-1,
                                LLD.AMOUNT*-1,
                                LLD.TAX*-1,
                                LLD.FREIGHT*-1,
                                LLD.CHARGES*-1,
                                LLD.LAST_UPDATE_DATE,
                                LLD.LAST_UPDATED_BY,
                                LLD.LINE_DISCOUNT,
                                LLD.TAX_DISCOUNT,
                                LLD.FREIGHT_DISCOUNT,
                                LLD.LINE_BALANCE,
                                LLD.TAX_BALANCE,
                                LLD.CREATION_DATE,
                                LLD.CREATED_BY,
                                LLD.LAST_UPDATE_LOGIN,
                                LLD.COMMENTS,
                                LLD.APPLY_TO,
                                LLD.ATTRIBUTE1,
                                LLD.ATTRIBUTE2,
                                LLD.ATTRIBUTE3,
                                LLD.ATTRIBUTE4,
                                LLD.ATTRIBUTE5,
                                LLD.ATTRIBUTE6,
                                LLD.ATTRIBUTE7,
                                LLD.ATTRIBUTE8,
                                LLD.ATTRIBUTE9,
                                LLD.ATTRIBUTE10,
                                LLD.ATTRIBUTE11,
                                LLD.ATTRIBUTE12,
                                LLD.ATTRIBUTE13,
                                LLD.ATTRIBUTE14,
                                LLD.ATTRIBUTE15,
                                LLD.ATTRIBUTE_CATEGORY,
                                LLD.GROUP_ID,
                                LLD.REFERENCE1,
                                LLD.REFERENCE2,
                                LLD.REFERENCE3,
                                LLD.REFERENCE4,
                                LLD.REFERENCE5,
                                LLD.OBJECT_VERSION_NUMBER,
                                LLD.CREATED_BY_MODULE,
                                LLD.SOURCE_ID,
                                LLD.SOURCE_TABLE,
                                ar_Activity_details_s.nextval,
                                'R'
                        FROM ar_Activity_details LLD
		        where LLD.cash_receipt_id = l_cash_receipt_id
			and nvl(LLD.CURRENT_ACTIVITY_FLAG, 'Y') = 'Y';
Line: 6032

		   UPDATE ar_Activity_details dtl
		     set CURRENT_ACTIVITY_FLAG = 'N'
			where dtl.cash_receipt_id = l_cash_receipt_id
			and nvl(dtl.CURRENT_ACTIVITY_FLAG, 'Y') = 'Y';
Line: 6078

				select count(*) into l_exist_flag
				from AR_MISC_CASH_DISTRIBUTIONS_ALL mcd, ar_cash_receipt_history_all rh
				where rh.cash_receipt_id = l_cash_receipt_id
				and mcd.cash_receipt_id = rh.cash_receipt_id
				and mcd.cash_receipt_history_id = rh.cash_receipt_history_id
				and mcd.request_id = arp_global.request_id
				and rh.postable_flag = 'Y'
				and mcd.posting_control_id = -3
				and mcd.event_id is null;
Line: 7065

         SELECT applied_payment_schedule_id
              , secondary_application_ref_id
              , amount_applied
         INTO   l_applied_ps_id
              , l_sec_app_ref_id
              , l_amount_applied
         FROM   ar_receivable_applications
         WHERE  receivable_application_id = p_receivable_application_id;
Line: 7121

           /* Bug 4170060 do not update with claim balance for partial
	      rct to rct applications */
           IF (NVL(p_called_from,'RAPI') = 'APPLY_OPEN_RECEIPT' AND
	       NVL(pg_update_claim_amount,0) <> 0) THEN
              NULL;
Line: 7127

              arp_process_application.update_claim(
                p_claim_id      =>  l_sec_app_ref_id
              , p_invoice_ps_id =>  NULL
              , p_customer_trx_id => NULL
              , p_amount        =>  0
              , p_amount_applied => l_amount_applied
              , p_apply_date    =>  trunc(SYSDATE)
              , p_cash_receipt_id => l_cash_receipt_id
              , p_receipt_number => l_receipt_number
              , p_action_type   => 'U'
              , x_claim_reason_code_id => l_claim_reason_code_id
              , x_claim_reason_name => l_claim_reason_name
              , x_claim_number => l_claim_number
              , x_return_status =>  l_clm_return_status
              , x_msg_count     =>  x_msg_count
              , x_msg_data      =>  x_msg_data);
Line: 7676

		SELECT term_id
		INTO l_term_id
		FROM ap_terms_bat_pay_terms_v
		WHERE term_id = p_terms_id;
Line: 8167

        SELECT applied_payment_schedule_id, application_ref_id
	INTO   l_applied_ps_id, l_application_ref_id
	FROM   ar_receivable_applications
  	WHERE  receivable_application_id = l_receivable_application_id;
Line: 9246

            /* 5955921 Replaced select statement */
             SELECT tax_account_ccid
              INTO   l_tax_account_id
             FROM zx_accounts
             WHERE  tax_account_entity_id = l_vat_tax_id
              AND  tax_account_entity_code = 'RATES'
              AND  internal_organization_id = l_org_id;
Line: 9254

	     /*SELECT tax_account_id
             INTO   l_tax_account_id
             FROM   ar_vat_tax
             WHERE  vat_tax_id = l_vat_tax_id;*/
Line: 9283

       select pay_from_customer,customer_site_use_id
       into   l_customer_id,l_customer_site_use_id
       from ar_cash_receipts
       --where payment_trxn_extension_id = l_payment_trxn_extension_id;
Line: 9341

         arp_process_misc_receipts.insert_misc_receipt(
	                       p_currency_code
                                       => l_currency_code,
	                       p_amount
                                       => p_amount,
	                       p_receivables_trx_id
                                       => l_receivables_trx_id,
	                       p_misc_payment_source
                                       => p_misc_payment_source,
	                       p_receipt_number
                                       => l_receipt_number,
	                       p_receipt_date
                                       => l_receipt_date,
	                       p_gl_date
                                       => l_gl_date,
	                       p_comments
                                       => p_comments,
	                       p_exchange_rate_type
                                       => l_exchange_rate_type,
	                       p_exchange_rate
                                       => l_exchange_rate,
                               p_exchange_date
                                       => l_exchange_date,
		               p_batch_id
                                       => null,
	                       p_attribute_category
                                       => l_attribute_rec.attribute_category,
	                       p_attribute1
                                       => l_attribute_rec.attribute1,
	                       p_attribute2
                                       => l_attribute_rec.attribute2,
	                       p_attribute3
                                       => l_attribute_rec.attribute3,
	                       p_attribute4
                                       => l_attribute_rec.attribute4,
	                       p_attribute5
                                       => l_attribute_rec.attribute5,
	                       p_attribute6
                                       => l_attribute_rec.attribute6,
	                       p_attribute7
                                       => l_attribute_rec.attribute7,
	                       p_attribute8
                                       => l_attribute_rec.attribute8,
	                       p_attribute9
                                       => l_attribute_rec.attribute9,
	                       p_attribute10
                                       => l_attribute_rec.attribute10,
	                       p_attribute11
                                       => l_attribute_rec.attribute11,
	                       p_attribute12
                                       => l_attribute_rec.attribute12,
	                       p_attribute13
                                       => l_attribute_rec.attribute13,
                               p_attribute14
                                       => l_attribute_rec.attribute14,
	                       p_attribute15
                                       => l_attribute_rec.attribute15,
	                       p_remittance_bank_account_id
                                       => l_remit_bank_acct_use_id,
	                       p_deposit_date
                                       => l_deposit_date,
	                       p_receipt_method_id
                                       => l_receipt_method_id,
	                       p_doc_sequence_value
                                       => l_doc_sequence_value,
	                       p_doc_sequence_id
                                       => l_doc_sequence_id,
	                       p_distribution_set_id
                                       => l_distribution_set_id,
	                       p_reference_type
                                       => p_reference_type,
	                       p_reference_id
                                       => l_reference_id,
	                       p_vat_tax_id
                                       => l_vat_tax_id,
                               p_ussgl_transaction_code
                                       => p_ussgl_transaction_code,
	                       p_anticipated_clearing_date
                                       => l_anticipated_clearing_date, /* Bug fix 3135407 */
	                       p_global_attribute1
                                       => l_global_attribute_rec.global_attribute1,
	                       p_global_attribute2
                                       => l_global_attribute_rec.global_attribute2,
	                       p_global_attribute3
                                       => l_global_attribute_rec.global_attribute3,
	                       p_global_attribute4
                                       => l_global_attribute_rec.global_attribute4,
	                       p_global_attribute5
                                       => l_global_attribute_rec.global_attribute5,
	                       p_global_attribute6
                                       => l_global_attribute_rec.global_attribute6,
	                       p_global_attribute7
                                       => l_global_attribute_rec.global_attribute7,
	                       p_global_attribute8
                                       => l_global_attribute_rec.global_attribute8,
	                       p_global_attribute9
                                       => l_global_attribute_rec.global_attribute9,
	                       p_global_attribute10
                                       => l_global_attribute_rec.global_attribute10,
	                       p_global_attribute11
                                       => l_global_attribute_rec.global_attribute11,
	                       p_global_attribute12
                                       => l_global_attribute_rec.global_attribute12,
	                       p_global_attribute13
                                       => l_global_attribute_rec.global_attribute13,
                               p_global_attribute14
                                       => l_global_attribute_rec.global_attribute14,
	                       p_global_attribute15
                                       => l_global_attribute_rec.global_attribute15,
	                       p_global_attribute16
                                       => l_global_attribute_rec.global_attribute16,
	                       p_global_attribute17
                                       => l_global_attribute_rec.global_attribute17,
	                       p_global_attribute18
                                       => l_global_attribute_rec.global_attribute18,
	                       p_global_attribute19
                                       => l_global_attribute_rec.global_attribute19,
	                       p_global_attribute20
                                       => l_global_attribute_rec.global_attribute20,
	                       p_global_attribute_category
                                     => l_global_attribute_rec.global_attribute_category,
 	                       p_cr_id
                                       => p_misc_receipt_id,
	                       p_row_id
                                       => l_row_id,
	                       p_form_name
                                       => 'RAPI',
	                       p_form_version
                                       => p_api_version,
                               p_tax_rate
                                       => l_tax_rate,
                               p_gl_tax_acct
                                       => l_tax_account_id ,/* Bug fix 2300268 */
                               p_crh_id
                                       => l_crh_id, /* Bug fix 2742388 */
			       p_legal_entity_id => l_legal_entity_id, /* R12 LE uptake */
                               p_payment_trxn_extension_id => l_copy_pmt_trxn_extension_id
                                );
Line: 9496

                           'ARP_PROCESS_MISC_RECEIPTS.INSERT_MISC_RECEIPT : '||SQLERRM);
Line: 9963

     pg_update_claim_amount := l_reapply_amount * -1; /* Bug 4170060 */
Line: 10151

        arp_app_pkg.update_p(l_app_rec);
Line: 10158

        arp_app_pkg.update_p(l_app_rec);
Line: 10654

l_last_updated_by         NUMBER;
Line: 10656

l_last_update_login       NUMBER;
Line: 10668

select  cash_receipt_history_id,
        cash_receipt_id,
        reversal_gl_date,
        gl_date,
	ar_cash_receipt_history_s.nextval,
	batch_id,
	amount,
	cc_error_code,
	cc_error_text,
	cc_instrtype,
        'VALID'
from ar_rr_crh_gt;
Line: 10682

select crhgt.cash_receipt_id
from ar_rr_crh_gt crhgt
where crhgt.cash_receipt_id
 not in
(
   select crh.cash_receipt_id
   from ar_cash_receipt_history crh
   where crh.cash_receipt_id= crhgt.cash_receipt_id
   and crh.status = 'CONFIRMED'
   and crh.current_record_flag='Y'
   and crh.request_id =p_req_id
);
Line: 10714

        delete from ar_rr_crh_gt;
Line: 10720

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

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

  /*Insert into ar_rr_crh_gt select * from ar_cash_receipt_history*/
  FORALL i IN p_cash_receipts_id.cash_receipt_id.first..p_cash_receipts_id.cash_receipt_id.last
INSERT INTO AR_RR_CRH_GT
(
CASH_RECEIPT_HISTORY_ID,
CASH_RECEIPT_ID,
STATUS,
TRX_DATE,
AMOUNT,
FIRST_POSTED_RECORD_FLAG,
POSTABLE_FLAG,
FACTOR_FLAG,
GL_DATE,
CURRENT_RECORD_FLAG,
BATCH_ID,
ACCOUNT_CODE_COMBINATION_ID,
REVERSAL_GL_DATE,
REVERSAL_CASH_RECEIPT_HIST_ID,
FACTOR_DISCOUNT_AMOUNT,
BANK_CHARGE_ACCOUNT_CCID,
POSTING_CONTROL_ID,
REVERSAL_POSTING_CONTROL_ID,
GL_POSTED_DATE,
REVERSAL_GL_POSTED_DATE,
LAST_UPDATE_LOGIN,
ACCTD_AMOUNT,
ACCTD_FACTOR_DISCOUNT_AMOUNT,
CREATED_BY,
CREATION_DATE,
EXCHANGE_DATE,
EXCHANGE_RATE,
EXCHANGE_RATE_TYPE,
LAST_UPDATE_DATE,
PROGRAM_APPLICATION_ID,
PROGRAM_ID,
PROGRAM_UPDATE_DATE,
REQUEST_ID,
LAST_UPDATED_BY,
PRV_STAT_CASH_RECEIPT_HIST_ID,
CREATED_FROM,
REVERSAL_CREATED_FROM,
ATTRIBUTE1,
ATTRIBUTE2,
ATTRIBUTE3,
ATTRIBUTE4,
ATTRIBUTE5,
ATTRIBUTE6,
ATTRIBUTE7,
ATTRIBUTE8,
ATTRIBUTE9,
ATTRIBUTE10,
ATTRIBUTE11,
ATTRIBUTE12,
ATTRIBUTE13,
ATTRIBUTE14,
ATTRIBUTE15,
ATTRIBUTE_CATEGORY,
ORG_ID,
EVENT_ID,
CC_ERROR_CODE,
CC_ERROR_TEXT,
CC_INSTRTYPE
)
select
CASH_RECEIPT_HISTORY_ID,
CASH_RECEIPT_ID,
STATUS,
TRX_DATE,
AMOUNT,
FIRST_POSTED_RECORD_FLAG,
POSTABLE_FLAG,
FACTOR_FLAG,
GL_DATE,
CURRENT_RECORD_FLAG,
BATCH_ID,
ACCOUNT_CODE_COMBINATION_ID,
REVERSAL_GL_DATE,
REVERSAL_CASH_RECEIPT_HIST_ID,
FACTOR_DISCOUNT_AMOUNT,
BANK_CHARGE_ACCOUNT_CCID,
POSTING_CONTROL_ID,
REVERSAL_POSTING_CONTROL_ID,
GL_POSTED_DATE,
REVERSAL_GL_POSTED_DATE,
LAST_UPDATE_LOGIN,
ACCTD_AMOUNT,
ACCTD_FACTOR_DISCOUNT_AMOUNT,
CREATED_BY,
CREATION_DATE,
EXCHANGE_DATE,
EXCHANGE_RATE,
EXCHANGE_RATE_TYPE,
LAST_UPDATE_DATE,
PROGRAM_APPLICATION_ID,
PROGRAM_ID,
PROGRAM_UPDATE_DATE,
REQUEST_ID,
LAST_UPDATED_BY,
PRV_STAT_CASH_RECEIPT_HIST_ID,
CREATED_FROM,
REVERSAL_CREATED_FROM,
ATTRIBUTE1,
ATTRIBUTE2,
ATTRIBUTE3,
ATTRIBUTE4,
ATTRIBUTE5,
ATTRIBUTE6,
ATTRIBUTE7,
ATTRIBUTE8,
ATTRIBUTE9,
ATTRIBUTE10,
ATTRIBUTE11,
ATTRIBUTE12,
ATTRIBUTE13,
ATTRIBUTE14,
ATTRIBUTE15,
ATTRIBUTE_CATEGORY,
ORG_ID,
EVENT_ID,
p_cash_receipts_id.CC_ERROR_CODE(i),
p_cash_receipts_id.CC_ERROR_TEXT(i),
p_cash_receipts_id.CC_INSTRTYPE(i)
FROM ar_Cash_receipt_history
  where cash_receipt_id=p_cash_receipts_id.cash_receipt_id(i)
  and   current_record_flag = 'Y'
  and   status = 'REMITTED'
  and   NOT EXISTS (SELECT * FROM AR_RR_CRH_GT WHERE cash_receipt_id = p_cash_receipts_id.cash_receipt_id(i)); -- Bug 13549918
Line: 10884

            arp_standard.debug('Records for update: ' || 'COUNT = 0 and LAST FETCH ');
Line: 10938

  UPDATE ar_cash_receipts SET
  CC_ERROR_FLAG ='Y',
  CC_ERROR_CODE = l_crh_upd.cc_error_code(i),
  CC_ERROR_TEXT = l_crh_upd.cc_error_text(i),
  LAST_UPDATE_DATE = sysdate,
  LAST_UPDATE_LOGIN = l_last_update_login,
  LAST_UPDATED_BY    = l_last_updated_by
  WHERE cash_receipt_id = l_crh_upd.cash_receipt_id(i)
  AND   l_crh_upd.cc_instrtype(i) in ('CREDITCARD','BANKACCOUNT')
  AND l_crh_upd.rec_status(i) ='VALID';
Line: 10954

  /*Update existing CRH record of remittance*/
  FORALL i in l_crh_upd.cash_receipt_history_id.first..l_crh_upd.cash_receipt_history_id.last
  update ar_cash_receipt_history set
    reversal_cash_receipt_hist_id = l_crh_upd.reversal_cash_receipt_hist_id(i),
                reversal_gl_date = l_crh_upd.reversal_gl_date(i),
                reversal_created_from = 'ARREVREM',
                current_record_flag = NULL,
                        last_update_date              = sysdate,
                        last_updated_by               = l_last_updated_by,
                        last_update_login             = l_last_update_login
                  WHERE cash_receipt_history_id = l_crh_upd.cash_receipt_history_id(i)
                  AND current_record_flag = 'Y'
                  AND status = 'REMITTED'
                  AND l_crh_upd.rec_status(i) = 'VALID';
Line: 10974

  /*Inserting new CRH record for CONFIRM State*/
  FORALL i in l_crh_upd.cash_receipt_history_id.first..l_crh_upd.cash_receipt_history_id.last
  Insert into ar_cash_receipt_history
  (
    CASH_RECEIPT_HISTORY_ID,
    CASH_RECEIPT_ID,
    STATUS,
    TRX_DATE,
    AMOUNT,
    FIRST_POSTED_RECORD_FLAG,
    POSTABLE_FLAG,
    FACTOR_FLAG,
    GL_DATE,
    CURRENT_RECORD_FLAG,
    BATCH_ID,
    ACCOUNT_CODE_COMBINATION_ID,
    REVERSAL_GL_DATE,
    REVERSAL_CASH_RECEIPT_HIST_ID,
    FACTOR_DISCOUNT_AMOUNT,
    BANK_CHARGE_ACCOUNT_CCID,
    POSTING_CONTROL_ID,
    REVERSAL_POSTING_CONTROL_ID,
    GL_POSTED_DATE,
    REVERSAL_GL_POSTED_DATE,
    LAST_UPDATE_LOGIN,
    ACCTD_AMOUNT,
    ACCTD_FACTOR_DISCOUNT_AMOUNT,
    CREATED_BY,
    CREATION_DATE,
    EXCHANGE_DATE,
    EXCHANGE_RATE,
    EXCHANGE_RATE_TYPE,
    LAST_UPDATE_DATE,
    PROGRAM_APPLICATION_ID,
    PROGRAM_ID,
    PROGRAM_UPDATE_DATE,
    REQUEST_ID,
    LAST_UPDATED_BY,
    PRV_STAT_CASH_RECEIPT_HIST_ID,
    CREATED_FROM,
    REVERSAL_CREATED_FROM,
    ATTRIBUTE1,
    ATTRIBUTE2,
    ATTRIBUTE3,
    ATTRIBUTE4,
    ATTRIBUTE5,
    ATTRIBUTE6,
    ATTRIBUTE7,
    ATTRIBUTE8,
    ATTRIBUTE9,
    ATTRIBUTE10,
    ATTRIBUTE11,
    ATTRIBUTE12,
    ATTRIBUTE13,
    ATTRIBUTE14,
    ATTRIBUTE15,
    ATTRIBUTE_CATEGORY,
    ORG_ID,
    EVENT_ID
   )
   SELECT
    l_crh_upd.reversal_cash_receipt_hist_id(i),
    CASH_RECEIPT_ID,
    STATUS,
    TRX_DATE,
    AMOUNT,
    'N',
    POSTABLE_FLAG,
    FACTOR_FLAG,
    l_crh_upd.reversal_gl_date(i),
    'Y',
    NULL,
    ACCOUNT_CODE_COMBINATION_ID,
    NULL,
    NULL,
    FACTOR_DISCOUNT_AMOUNT,
    BANK_CHARGE_ACCOUNT_CCID,
    -3,
    NULL,
    NULL,
    NULL,
    l_last_update_login,
    ACCTD_AMOUNT,
    ACCTD_FACTOR_DISCOUNT_AMOUNT,
    l_created_by,
    sysdate,
    EXCHANGE_DATE,
    EXCHANGE_RATE,
    EXCHANGE_RATE_TYPE,
    sysdate,
    l_PROGRAM_APPLICATION_ID,
    l_PROGRAM_ID,
    sysdate,
    l_request_id_bulk,
    l_last_updated_by,
    l_crh_upd.CASH_RECEIPT_HISTORY_ID(i),
    'ARREVREM',
    NULL,
    ATTRIBUTE1,
    ATTRIBUTE2,
    ATTRIBUTE3,
    ATTRIBUTE4,
    ATTRIBUTE5,
    ATTRIBUTE6,
    ATTRIBUTE7,
    ATTRIBUTE8,
    ATTRIBUTE9,
    ATTRIBUTE10,
    ATTRIBUTE11,
    ATTRIBUTE12,
    ATTRIBUTE13,
    ATTRIBUTE14,
    ATTRIBUTE15,
    ATTRIBUTE_CATEGORY,
    ORG_ID,
    NULL
  FROM AR_CASH_RECEIPT_HISTORY
  WHERE reversal_cash_receipt_hist_id=l_crh_upd.cash_receipt_history_id(i)
  AND l_crh_upd.rec_status(i)='VALID';
Line: 11095

       arp_util.debug('Inserted new CRH record for new status CONFIRM');
Line: 11109

      update ar_cash_receipt_history set
          request_id = l_request_id
                  WHERE cash_receipt_history_id = l_crh_upd.reversal_cash_receipt_hist_id(i)
                  AND current_record_flag = 'Y'
                  AND status = 'CONFIRMED'
                  AND l_crh_upd.rec_status(i)='VALID'
		  AND request_id = l_request_id_bulk;
Line: 11120

      update ar_batches set
	  control_count = control_count - 1,
	  control_amount= control_amount - l_crh_upd.amount(i)
                  WHERE batch_id = l_crh_upd.batch_id(i)
                  AND l_crh_upd.rec_status(i)='VALID';
Line: 11167

      INSERT INTO  ar_distributions (
                   line_id,
                   source_id,
                   source_table,
                   source_type,
                   source_type_secondary,
                   code_combination_id,
                   amount_dr,
                   amount_cr,
                   acctd_amount_dr,
                   acctd_amount_cr,
                   created_by,
                   creation_date,
                   last_updated_by,
                   last_update_date,
                   last_update_login,
                   source_id_secondary,
                   source_table_secondary,
                   currency_code        ,
                   currency_conversion_rate,
                   currency_conversion_type,
                   currency_conversion_date,
                   third_party_id,
                   third_party_sub_id,
                   tax_code_id,
                   location_segment_id,
                   taxable_entered_dr,
                   taxable_entered_cr,
                   taxable_accounted_dr,
                   taxable_accounted_cr,
                   tax_link_id,
                   reversed_source_id,
                   tax_group_code_id,
                   org_id,
                   ref_customer_trx_line_id,
                   ref_cust_trx_line_gl_dist_id,
                   ref_line_id,
                   from_amount_dr,
                   from_amount_cr,
                   from_acctd_amount_dr,
                   from_acctd_amount_cr,
                   ref_account_class,
                   activity_bucket,
                   ref_dist_ccid,
                   ref_mf_dist_flag
                 )
       select ar_distributions_s.nextval,
              l_crh_upd.reversal_Cash_receipt_hist_id(i),
              'CRH',
              ard.source_type,
              ard.source_type_secondary,
              ard.code_combination_id,
              decode(sign(nvl(ard.amount_dr,0)- nvl(ard.amount_cr,0)),-1,ard.amount_cr,NULL),
              decode(sign(nvl(ard.amount_cr,0)- nvl(ard.amount_dr,0)),-1,ard.amount_dr,NULL),
              decode(sign(nvl(ard.acctd_amount_dr,0)- nvl(ard.acctd_amount_cr,0)),-1,ard.acctd_amount_cr,NULL),
              decode(sign(nvl(ard.acctd_amount_cr,0)- nvl(ard.acctd_amount_dr,0)),-1,ard.acctd_amount_dr,NULL),
              arp_standard.profile.user_id,
              SYSDATE,
              arp_standard.profile.user_id,
              SYSDATE,
              arp_standard.profile.last_update_login,
              ard.source_id_secondary,
              ard.source_table_secondary,
              ard.currency_code        ,
              ard.currency_conversion_rate,
              ard.currency_conversion_type,
              ard.currency_conversion_date,
              ard.third_party_id,
              ard.third_party_sub_id,
              ard.tax_code_id,
              ard.location_segment_id,
              ard.taxable_entered_dr,
              ard.taxable_entered_cr,
              ard.taxable_accounted_dr,
              ard.taxable_accounted_cr,
              ard.tax_link_id,
              ard.reversed_source_id,
              ard.tax_group_code_id,
              ard.org_id,
              ard.ref_customer_trx_line_id,
              ard.ref_cust_trx_line_gl_dist_id,
              ard.ref_line_id,
              ard.from_amount_dr,
              ard.from_amount_cr,
              ard.from_acctd_amount_dr,
              ard.from_acctd_amount_cr,
              ard.ref_account_class,
              ard.activity_bucket,
              ard.ref_dist_ccid,
              ard.ref_mf_dist_flag
       FROM   ar_distributions ard,
              ar_Cash_receipt_history crh
       WHERE  ard.source_id=crh.cash_receipt_history_id
       and    ard.source_table = 'CRH'
       and    cash_receipt_history_id=l_crh_upd.cash_receipt_history_id(i)
       AND l_crh_upd.rec_status(i)='VALID';
Line: 11330

    update ar_cash_receipts
    SET last_update_date       = sysdate,
	request_id             = p_request_id
    WHERE cash_receipt_id in
     ( select cash_receipt_id
       from ar_create_receipts_gt
       where gt_id = p_gt_id
       and    request_id = p_request_id
       and return_error_status = 'S'
       and org_id = p_org_id );
Line: 11343

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

    update ar_cash_receipt_history SET
    last_update_date = sysdate,
    request_id = p_request_id
    WHERE cash_receipt_id in
     ( select cash_receipt_id
       from ar_create_receipts_gt
       where  gt_id = p_gt_id
       and    request_id = p_request_id
       and    return_error_status = 'S'
       and    org_id = p_org_id );
Line: 11358

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

    update AR_payment_schedules  SET
    last_update_date = sysdate,
    request_id = p_request_id
    WHERE cash_receipt_id in
     ( select cash_receipt_id
       from ar_create_receipts_gt
       where  gt_id = p_gt_id
       and    request_id = p_request_id
       and    return_error_status = 'S'
       and    org_id = p_org_id );
Line: 11373

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

    update ar_receivable_applications SET
    last_update_date = sysdate,
    request_id = p_request_id
    WHERE cash_receipt_id in
     ( select cash_receipt_id
       from ar_create_receipts_gt
       where  gt_id = p_gt_id
       and    request_id = p_request_id
       and    return_error_status = 'S'
       and    org_id = p_org_id );
Line: 11388

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

    select /*+ LEADING (GT) INDEX (GT AR_CREATE_RECEIPTS_GT_N2) USE_NL(GT RA)
		INDEX (RA AR_RECEIVABLE_APPLICATIONS_N1) */
	   min(gt.cash_receipt_id),
	   max(gt.cash_receipt_id),
	   min(ra.receivable_application_id),
	   max(ra.receivable_application_id)
    into l_from_doc_id,
	 l_to_doc_id,
	 l_from_ra_doc_id,
	 l_to_ra_doc_id
    from   ar_create_receipts_gt gt, ar_receivable_applications ra
    where  gt.cash_receipt_id = ra.cash_receipt_id
    AND    gt_id = p_gt_id
    and    gt.request_id = p_request_id
    and    return_error_status = 'S'
    and    gt.org_id = p_org_id ;
Line: 11536

   LAST_UPDATE_DATE               DBMS_SQL.DATE_TABLE,
   CREATION_DATE                  DBMS_SQL.DATE_TABLE,
   CREATED_BY                     DBMS_SQL.NUMBER_TABLE,
   LAST_UPDATE_LOGIN              DBMS_SQL.NUMBER_TABLE,
   PROGRAM_APPLICATION_ID         DBMS_SQL.NUMBER_TABLE,
   PROGRAM_ID                     DBMS_SQL.NUMBER_TABLE,
   PROGRAM_UPDATE_DATE            DBMS_SQL.DATE_TABLE,
   LAST_UPDATED_BY                DBMS_SQL.NUMBER_TABLE );
Line: 11551

SELECT org_id
FROM ar_create_receipts_gt
GROUP BY org_id;
Line: 11556

SELECT *
FROM ar_create_receipts_gt
WHERE org_id = p_c_org_id
AND   return_error_status IS NULL;
Line: 11595

    SELECT FND_CONCURRENT_REQUESTS_S.nextval
    INTO l_request_id
    FROM dual;
Line: 11637

	  l_rcpt_error_info_tab.BATCH_ID.DELETE;
Line: 11638

	  l_rcpt_error_info_tab.REQUEST_ID.DELETE;
Line: 11639

	  l_rcpt_error_info_tab.CASH_RECEIPT_ID.DELETE;
Line: 11640

	  l_rcpt_error_info_tab.RECEIPT_NUMBER.DELETE;
Line: 11641

	  l_rcpt_error_info_tab.RECEIPT_DATE.DELETE;
Line: 11642

	  l_rcpt_error_info_tab.CUSTOMER_TRX_ID.DELETE;
Line: 11643

	  l_rcpt_error_info_tab.TRXN_NUMBER.DELETE;
Line: 11644

	  l_rcpt_error_info_tab.PAYMENT_SCHEDULE_ID.DELETE;
Line: 11645

	  l_rcpt_error_info_tab.APPLIED_PAYMENT_SCHEDULE_ID.DELETE;
Line: 11646

	  l_rcpt_error_info_tab.PAYING_CUSTOMER_ID.DELETE;
Line: 11647

	  l_rcpt_error_info_tab.PAYING_SITE_USE_ID.DELETE;
Line: 11648

	  l_rcpt_error_info_tab.EXCEPTION_CODE.DELETE;
Line: 11649

	  l_rcpt_error_info_tab.ADDITIONAL_MESSAGE.DELETE;
Line: 11650

	  l_rcpt_error_info_tab.REMIT_BANK_ACCT_USE_ID.DELETE;
Line: 11651

	  l_rcpt_error_info_tab.LAST_UPDATE_DATE.DELETE;
Line: 11652

	  l_rcpt_error_info_tab.CREATION_DATE.DELETE;
Line: 11653

	  l_rcpt_error_info_tab.CREATED_BY.DELETE;
Line: 11654

	  l_rcpt_error_info_tab.LAST_UPDATE_LOGIN.DELETE;
Line: 11655

	  l_rcpt_error_info_tab.PROGRAM_APPLICATION_ID.DELETE;
Line: 11656

	  l_rcpt_error_info_tab.PROGRAM_ID.DELETE;
Line: 11657

	  l_rcpt_error_info_tab.PROGRAM_UPDATE_DATE.DELETE;
Line: 11658

	  l_rcpt_error_info_tab.LAST_UPDATED_BY.DELETE;
Line: 11662

	  l_cash_receipt_info_rec.cash_receipt_id.delete;
Line: 11663

	  l_cash_receipt_info_rec.receipt_number.delete;
Line: 11664

	  l_cash_receipt_info_rec.receipt_date.delete;
Line: 11665

	  l_cash_receipt_info_rec.gt_id.delete;
Line: 11666

	  l_cash_receipt_info_rec.request_id.delete;
Line: 11667

	  l_cash_receipt_info_rec.return_error_status.delete;
Line: 11668

	  l_cash_receipt_info_rec.org_id.delete;
Line: 11852

	UPDATE ar_create_receipts_gt
		SET request_id		= l_cash_receipt_info_rec.request_id(j),
		    cash_receipt_id	= l_cash_receipt_info_rec.cash_receipt_id(j),
		    return_error_status = l_cash_receipt_info_rec.return_error_status(j),
		    gt_id		= l_cash_receipt_info_rec.gt_id(j)
		WHERE receipt_number	= l_cash_receipt_info_rec.receipt_number(j)
		AND   receipt_date	= l_cash_receipt_info_rec.receipt_date(j)
		AND   org_id		= l_cash_receipt_info_rec.org_id(j);
Line: 11863

		INSERT INTO AR_CREATE_RECEIPTS_ERROR VALUES (
			NULL,
			l_rcpt_error_info_tab.request_id(k),
			l_rcpt_error_info_tab.cash_receipt_id(k),
			l_rcpt_error_info_tab.receipt_number(k),
			l_rcpt_error_info_tab.receipt_date(k),
			NULL,
			NULL,
			NULL,
			NULL,
			l_rcpt_error_info_tab.paying_customer_id(k),
			l_rcpt_error_info_tab.paying_site_use_id(k),
			l_rcpt_error_info_tab.exception_code(k),
			l_rcpt_error_info_tab.additional_message(k),
			l_rcpt_error_info_tab.remit_bank_acct_use_id(k),
			sysdate,
			sysdate,
			fnd_global.user_id,
			fnd_global.login_id,
			fnd_global.prog_appl_id,
			NULL,
			SYSDATE,
			fnd_global.user_id ) ;
Line: 11892

    END LOOP;--main select cursor loop
Line: 11999

 	         SELECT  nvl(pay_unrelated_invoices_flag,'N')
 	         INTO  l_pay_unrel_inv_flag
 	         FROM   ar_system_parameters;
Line: 12007

 	         SELECT pay_from_customer
 	               , receipt_date
 	         INTO  l_rec_customer_id
 	               , l_rec_date
 	         FROM  ar_cash_receipts
 	         WHERE cash_receipt_id = l_cash_receipt_id;
Line: 12022

 	               SELECT cust_acct.cust_account_id
 	                 INTO l_customer_id
 	                 FROM  hz_cust_accounts cust_acct,
 	                       hz_parties party
 	                WHERE cust_acct.party_id = party.party_id
 	                 and  cust_acct.cust_account_id = l_customer_id
 	                 and  cust_acct.status = 'A' ;
Line: 12038

 	              SELECT cust_acct.cust_account_id
 	               INTO  l_customer_id
 	               FROM hz_cust_accounts cust_acct,
 	                    hz_parties party
 	            WHERE cust_acct.party_id = party.party_id
 	               AND cust_acct.status = 'A'
 	               AND cust_acct.cust_account_id = l_customer_id
 	               AND cust_acct.cust_account_id in
 	                (
 	                 SELECT TO_NUMBER(l_rec_customer_id)
 	                 FROM dual
 	                 UNION
 	                 SELECT related_cust_account_id
 	                 FROM hz_cust_acct_relate r
 	                 WHERE r.cust_account_id = l_rec_customer_id
 	                   AND r.status = 'A'
 	                   AND r.bill_to_flag = 'Y'
 	                 UNION
 	                 SELECT rel.related_cust_account_id
 	                 FROM ar_paying_relationships_v rel,
 	                      hz_cust_accounts acc
 	                 WHERE rel.party_id = acc.party_id
 	                   AND acc.cust_account_id = l_rec_customer_id
 	                   AND l_rec_date BETWEEN effective_start_date
 	                                    AND effective_end_date
 	                 );
Line: 12080

 	        SELECT  site_uses.site_use_id
 	        INTO    l_location
 	        FROM    hz_cust_acct_sites acct_site,
 	                hz_party_sites party_site,
 	                hz_locations loc,
 	                hz_cust_site_uses site_uses
 	        WHERE   acct_site.cust_acct_site_id = site_uses.cust_acct_site_id
 	        AND     acct_site.party_site_id = party_site.party_site_id
 	       AND     loc.location_id = party_site.location_id
 	        AND     site_uses.site_use_code in ('BILL_TO','DRAWEE')
 	        AND     acct_site.cust_account_id = l_customer_id
 	        AND     site_uses.site_use_id=l_location;
Line: 12101

 	       |  Update receivable_application with new value|
 	      +-----------------------------------------------*/

 	     BEGIN
 	          UPDATE ar_receivable_applications
 	          SET    ON_ACCT_CUST_ID = l_customer_id,
 	                 ON_ACCT_CUST_SITE_USE_ID = l_location
 	          WHERE  cash_receipt_id = l_cash_receipt_id
 	          AND    receivable_application_id = l_receivable_application_id;