DBA Data[Home] [Help]

APPS.ARP_PROCESS_MISC_RECEIPTS SQL Statements

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

Line: 21

 |    update_misc_receipt                              			     |
 |                                                                           |
 | DESCRIPTION                                                               |
 |    Entity handler that updates miscelleanous transactions.		     |
 |									     |
 | SCOPE - PUBLIC                                                            |
 |                                                                           |
 | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED 	                             |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY 						     |
 |									     |
 |    09-OCT-95	OSTEINME	created					     |
 |    13-NOV-96	 OSTEINME	added parameter anticipated_clearing_date    |
 |				for CE enhancement.			     |
 |				NOTE: This version of the file is not longer |
 |				compatible with 10.6 and prod15!	     |
 |    30-DEC-96 OSTEINME	added global descriptive flexfield parameters|
 |    04-DEC-97 KLAWRANC        Bug #590256.  Modified call to               |
 |                              calc_acctd_amount.  Now passes NULL for the  |
 |                              currency code parameter, therefore the acctd |
 |                              amount will be calculated based on the       |
 |                              functional currency.                         |
 |    04-FEB-98 KLAWRANC        Bug #546677.  Added check for amount change  |
 |                              before updating distributions table.         |
 |    21-MAY-98 KTANG           For all calls to calc_acctd_amount which     |
 |                              calculates header accounted amounts, if the  |
 |                              exchange_rate_type is not user, call         |
 |                              gl_currency_api.convert_amount instead. This |
 |                              is for triangulation.                        |
 |    26-JUL-99 GJWANG		Do not call accounting routine for update if |
 |                              misc rec has been posted		     |
 |    26-AUG-99 GJWANG		Bug 923425: check posting only on the current|
 |				cash receipt history  			     |
 |    09-MAY-02 RKADER          Bug #2322468. Rate adjustment fail when      |
 |                              rate type is changed from 'User' to another  |
 |                              rate type.                                   |
 |    26-SEP-02 RKADER          Bug #2561342: The GL date should not be      |
 |                              updated for the history record while a Misc  |
 |                              receipt is updated
 |    14-OCT-04 JBECKETT	Bug 3911642: Check for unposted entries      |
 |				is on ar_misc_cash_distributions not         |
 |				ar_cash_receipt_history as rows from the     |
 |				former are deleted/recreated.                |
 |    20-MAY-05 JBECKETT	Added p_legal_entity_id for R12 LE uptake    |
 +===========================================================================*/


PROCEDURE update_misc_receipt(
	p_cash_receipt_id	IN NUMBER,
	p_batch_id		IN NUMBER,
	p_currency_code		IN VARCHAR2,
	p_amount		IN NUMBER,
	p_receivables_trx_id	IN NUMBER,
	p_misc_payment_source	IN VARCHAR2,
	p_receipt_number	IN VARCHAR2,
	p_receipt_date		IN DATE,
	p_gl_date		IN DATE,
	p_comments		IN VARCHAR2,
	p_exchange_rate_type	IN VARCHAR2,
	p_exchange_rate		IN NUMBER,
	p_exchange_date		IN DATE,
	p_attribute_category	IN VARCHAR2,
	p_attribute1		IN VARCHAR2,
	p_attribute2		IN VARCHAR2,
	p_attribute3		IN VARCHAR2,
	p_attribute4		IN VARCHAR2,
	p_attribute5		IN VARCHAR2,
	p_attribute6		IN VARCHAR2,
	p_attribute7		IN VARCHAR2,
	p_attribute8		IN VARCHAR2,
	p_attribute9		IN VARCHAR2,
	p_attribute10		IN VARCHAR2,
	p_attribute11		IN VARCHAR2,
	p_attribute12		IN VARCHAR2,
	p_attribute13		IN VARCHAR2,
	p_attribute14		IN VARCHAR2,
	p_attribute15		IN VARCHAR2,
	p_remittance_bank_account_id  IN NUMBER,
	p_deposit_date		      IN DATE,
	p_receipt_method_id	      IN NUMBER,
	p_doc_sequence_value	      IN NUMBER,
	p_doc_sequence_id	      IN NUMBER,
	p_distribution_set_id	IN NUMBER,
	p_reference_type	IN VARCHAR2,
	p_reference_id		IN NUMBER,
	p_vat_tax_id		IN NUMBER,
        p_ussgl_transaction_code IN VARCHAR2,
-- ******* Rate Adjustment parameters: ********
	p_rate_adjust_gl_date	      IN DATE,
	p_new_exchange_date	      IN DATE,
	p_new_exchange_rate	      IN NUMBER,
	p_new_exchange_rate_type      IN VARCHAR2,
	p_gain_loss		      IN NUMBER,
	p_exchange_rate_attr_cat      IN VARCHAR2,
 	p_exchange_rate_attr1	      IN VARCHAR2,
 	p_exchange_rate_attr2	      IN VARCHAR2,
 	p_exchange_rate_attr3	      IN VARCHAR2,
 	p_exchange_rate_attr4	      IN VARCHAR2,
 	p_exchange_rate_attr5	      IN VARCHAR2,
 	p_exchange_rate_attr6	      IN VARCHAR2,
 	p_exchange_rate_attr7	      IN VARCHAR2,
 	p_exchange_rate_attr8	      IN VARCHAR2,
 	p_exchange_rate_attr9	      IN VARCHAR2,
 	p_exchange_rate_attr10	      IN VARCHAR2,
 	p_exchange_rate_attr11	      IN VARCHAR2,
 	p_exchange_rate_attr12	      IN VARCHAR2,
 	p_exchange_rate_attr13	      IN VARCHAR2,
 	p_exchange_rate_attr14	      IN VARCHAR2,
 	p_exchange_rate_attr15	      IN VARCHAR2,
--
-- ********* Reversal Info ***********
--
	p_reversal_date		IN DATE,
	p_reversal_gl_date	IN DATE,
	p_reversal_category	IN VARCHAR2,
	p_reversal_comments	IN VARCHAR2,
	p_reversal_reason_code  IN VARCHAR2,
--
-- ********* CashBook Expected Date (new in 10.7) ******
--
        p_anticipated_clearing_date IN DATE,
--
-- ******* Global Flexfield parameters *******
--
	p_global_attribute1		IN VARCHAR2,
	p_global_attribute2		IN VARCHAR2,
	p_global_attribute3		IN VARCHAR2,
	p_global_attribute4		IN VARCHAR2,
	p_global_attribute5		IN VARCHAR2,
	p_global_attribute6		IN VARCHAR2,
	p_global_attribute7		IN VARCHAR2,
	p_global_attribute8		IN VARCHAR2,
	p_global_attribute9		IN VARCHAR2,
	p_global_attribute10		IN VARCHAR2,
	p_global_attribute11		IN VARCHAR2,
	p_global_attribute12		IN VARCHAR2,
	p_global_attribute13		IN VARCHAR2,
	p_global_attribute14		IN VARCHAR2,
	p_global_attribute15		IN VARCHAR2,
	p_global_attribute16		IN VARCHAR2,
	p_global_attribute17		IN VARCHAR2,
	p_global_attribute18		IN VARCHAR2,
	p_global_attribute19		IN VARCHAR2,
	p_global_attribute20		IN VARCHAR2,
	p_global_attribute_category	IN VARCHAR2,
--
--
--
-- ******* Receipt State/Status Return information ******
--
	p_new_state		OUT NOCOPY VARCHAR2,
	p_new_state_dsp		OUT NOCOPY VARCHAR2,
	p_new_status		OUT NOCOPY VARCHAR2,
	p_new_status_dsp	OUT NOCOPY VARCHAR2,
--
	p_form_name		IN  varchar2,
	p_form_version		IN  varchar2,
        p_tax_rate		IN NUMBER,
        p_gl_tax_acct           IN  VARCHAR2, /* Bug fix 2300268 */
	p_legal_entity_id       IN  NUMBER ) IS

l_cr_rec		ar_cash_receipts%ROWTYPE;
Line: 207

     arp_debug.debug('arp_process_misc_receipts.update_misc_receipt()+');
Line: 208

     arp_debug.debug('update_misc_receipt: ' || '*****TAX RATE  ' || TO_CHAR(p_tax_rate));
Line: 296

   arp_debug.debug('*****BEGIN UPDATE cash_receipt_record ');
Line: 356

    arp_debug.debug(' *********AFTER UPDATE CR record: tax_rate' || TO_CHAR(l_cr_rec.tax_rate));
Line: 358

  arp_cash_receipts_pkg.update_p(l_cr_rec);
Line: 366

     The GL Date of the current record should not be updated in the
     CRH table. Commented out NOCOPY the following line.
  l_crh_rec.gl_date                     := p_gl_date; */
Line: 372

  arp_cr_history_pkg.update_p(l_crh_rec);
Line: 382

     /* Bug 1301583 : lock ar_distribution row only if an update
        needs to be done

        Bug 1494541 : lock the row before setting new values for
        l_dist_rec fields
     */

     arp_distributions_pkg.nowaitlock_fetch_pk(
                                l_crh_rec.cash_receipt_history_id,
                                'CRH',
                                l_source_type,
                                l_dist_rec);
Line: 413

     arp_distributions_pkg.update_p(l_dist_rec);
Line: 415

    /* need to insert records into the MRC table.  Calling new
       mrc engine */

      ar_mrc_engine2.maintain_mrc_data2(
                              p_event_mode => 'UPDATE',
                              p_table_name => 'AR_DISTRIBUTIONS',
                              p_mode       => 'SINGLE',
                              p_key_value  =>  l_dist_rec.line_id,
                              p_row_info   =>  l_dist_rec);
Line: 429

     procedure update_misc_dist */

  arp_proc_rct_util.update_misc_dist(
			p_cash_receipt_id,
			p_amount,
			l_acctd_amount,
			l_amount_changed_flag,
			p_distribution_set_id,
			p_receivables_trx_id,
			l_old_distribution_set_id,
			l_old_receivables_trx_id,
			p_gl_date,
			l_gl_date_changed_flag,
			p_currency_code,
			p_exchange_rate,
			p_receipt_date,
   			l_receipt_date_changed_flag,
			p_gl_tax_acct);
Line: 450

     ar_misc_cash_distributions as it is this accounting that is deleted/
     recreated. */
  SELECT count(*)
  INTO   l_unposted_count
  FROM   ar_misc_cash_distributions
  WHERE  cash_receipt_id = p_cash_receipt_id
  AND    posting_control_id = -3
  AND    reversal_gl_date IS NULL;
Line: 472

         arp_debug.debug(  'Update Misc Cash Receipt start () +');
Line: 484

      arp_acct_main.Delete_Acct_Entry(l_ae_doc_rec);
Line: 488

         arp_debug.debug(  'Update Misc Cash Receipt start () -');
Line: 568

    arp_rw_batches_check_pkg.update_batch_status(
		p_batch_id);
Line: 577

/*  SELECT receipt_status,
	 receipt_status_dsp,
	 state,
	 state_dsp
  INTO   p_new_status,
	 p_new_status_dsp,
	 p_new_state,
	 p_new_state_dsp
  FROM   AR_CASH_RECEIPTS_V
  WHERE  cash_receipt_id = p_cash_receipt_id;   */
Line: 588

  SELECT cr.status,
         l_cr_status.meaning,
         crh_current.status ,
         l_crh_status.meaning
  INTO   p_new_status,
         p_new_status_dsp,
         p_new_state,
         p_new_state_dsp
  FROM
        ar_cash_receipt_history crh_current,
        ar_cash_receipts        cr,
        ar_lookups              l_cr_status,
        ar_lookups              l_crh_status
  WHERE
        cr.cash_receipt_id = p_cash_receipt_id
  AND   l_cr_status.lookup_type = 'CHECK_STATUS'
  AND   l_cr_status.lookup_code = cr.status
  AND   l_crh_status.lookup_type = 'RECEIPT_CREATION_STATUS'
  AND   l_crh_status.lookup_code = crh_current.status
  AND   crh_current.cash_receipt_id     = cr.cash_receipt_id
  AND   crh_current.current_record_flag = 'Y';
Line: 614

         arp_debug.debug('EXCEPTION: arp_process_misc_receipts.update_misc_receipt');
Line: 619

     arp_debug.debug('arp_process_misc_receipts.update_misc_receipt()-');
Line: 622

END update_misc_receipt;
Line: 627

 |    insert_misc_receipt                             			     |
 |                                                                           |
 | DESCRIPTION                                                               |
 |    Creates a new misc receipt					     |
 |									     |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED 	                             |
 |                                                                           |
 | ARGUMENTS                                                                 |
 |    IN:								     |
 |    OUT:                                                                   |
 |                                                                           |
 | RETURNS    		                                                     |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY 						     |
 |									     |
 |    19-SEP-95	 OSTEINME	created					     |
 |    13-NOV-96	 OSTEINME	added parameter anticipated_clearing_date to |
 |				insert, update, and lock procedures for CE   |
 |				enhancement.				     |
 |				NOTE: This version of the file is not longer |
 |				compatible with 10.6 and prod15!	     |
 |    04-DEC-97 KLAWRANC        Bug #590256.  Modified call to               |
 |                              calc_acctd_amount.  Now passes NULL for the  |
 |                              currency code parameter, therefore the acctd |
 |                              amount will be calculated based on the       |
 |                              functional currency.                         |
 |    21-MAY-98 KTANG           For all calls to calc_acctd_amount which     |
 |                              calculates header accounted amounts, if the  |
 |                              exchange_rate_type is not user, call         |
 |                              gl_currency_api.convert_amount instead. This |
 |                              is for triangulation.                        |
 |                                                                           |
 |    27-NOV-98 GJWANG		Added parameter tax_rate when insert         |
 |    20-MAY-05 J Beckett	Added p_legal_entity_id for R12 LE uptake    |
 |    04-JAN-07 M Raymond    5728628 - Added logic to default LE if
 |                              it is passed in as null
 +===========================================================================*/


PROCEDURE insert_misc_receipt(
	p_currency_code		IN VARCHAR2,
	p_amount		IN NUMBER,
	p_receivables_trx_id	IN NUMBER,
	p_misc_payment_source	IN VARCHAR2,
	p_receipt_number	IN VARCHAR2,
	p_receipt_date		IN DATE,
	p_gl_date		IN DATE,
	p_comments		IN VARCHAR2,
	p_exchange_rate_type	IN VARCHAR2,
	p_exchange_rate		IN NUMBER,
	p_exchange_date		IN DATE,
	p_batch_id		IN NUMBER,
	p_attribute_category	IN VARCHAR2,
	p_attribute1		IN VARCHAR2,
	p_attribute2		IN VARCHAR2,
	p_attribute3		IN VARCHAR2,
	p_attribute4		IN VARCHAR2,
	p_attribute5		IN VARCHAR2,
	p_attribute6		IN VARCHAR2,
	p_attribute7		IN VARCHAR2,
	p_attribute8		IN VARCHAR2,
	p_attribute9		IN VARCHAR2,
	p_attribute10		IN VARCHAR2,
	p_attribute11		IN VARCHAR2,
	p_attribute12		IN VARCHAR2,
	p_attribute13		IN VARCHAR2,
	p_attribute14		IN VARCHAR2,
	p_attribute15		IN VARCHAR2,
	p_remittance_bank_account_id  IN NUMBER,
	p_deposit_date		      IN DATE,
	p_receipt_method_id	      IN NUMBER,
	p_doc_sequence_value	      IN NUMBER,
	p_doc_sequence_id	      IN NUMBER,
	p_distribution_set_id	IN NUMBER,
	p_reference_type	IN VARCHAR2,
	p_reference_id		IN NUMBER,
	p_vat_tax_id		IN NUMBER,
        p_ussgl_transaction_code IN VARCHAR2,
	p_anticipated_clearing_date IN DATE,
--
-- ******* Global Flexfield parameters *******
--
	p_global_attribute1		IN VARCHAR2,
	p_global_attribute2		IN VARCHAR2,
	p_global_attribute3		IN VARCHAR2,
	p_global_attribute4		IN VARCHAR2,
	p_global_attribute5		IN VARCHAR2,
	p_global_attribute6		IN VARCHAR2,
	p_global_attribute7		IN VARCHAR2,
	p_global_attribute8		IN VARCHAR2,
	p_global_attribute9		IN VARCHAR2,
	p_global_attribute10		IN VARCHAR2,
	p_global_attribute11		IN VARCHAR2,
	p_global_attribute12		IN VARCHAR2,
	p_global_attribute13		IN VARCHAR2,
	p_global_attribute14		IN VARCHAR2,
	p_global_attribute15		IN VARCHAR2,
	p_global_attribute16		IN VARCHAR2,
	p_global_attribute17		IN VARCHAR2,
	p_global_attribute18		IN VARCHAR2,
	p_global_attribute19		IN VARCHAR2,
	p_global_attribute20		IN VARCHAR2,
	p_global_attribute_category	IN VARCHAR2,
 	p_cr_id			OUT NOCOPY NUMBER,
	p_row_id		OUT NOCOPY VARCHAR2,
--
	p_form_name		IN  varchar2,
	p_form_version		IN  varchar2,
        p_tax_rate		IN  NUMBER,
        p_gl_tax_acct           IN  VARCHAR2 , /* Bug fix 2300268 */
        p_crh_id                OUT NOCOPY NUMBER,  /* Bug fix 2742388 */
	p_legal_entity_id       IN  NUMBER,
        p_payment_trxn_extension_id  IN ar_cash_receipts.payment_trxn_extension_id%TYPE ) IS
l_creation_status	ar_cash_receipt_history.status%TYPE;
Line: 760

     arp_debug.debug('arp_process_misc_receipts.insert_misc_receipt()+');
Line: 801

       select pay_from_customer,
              customer_bank_account_id,
              customer_site_use_id,
              payment_server_order_num,
              approval_code
       into   l_cr_rec.pay_from_customer,
              l_cr_rec.customer_bank_account_id,
              l_cr_rec.customer_site_use_id,
              l_cr_rec.payment_server_order_num,
              l_cr_rec.approval_code
       from   ar_cash_receipts
       where  cash_receipt_id = p_reference_id;
Line: 828

       select bill_to_customer_id,
              customer_bank_account_id,
              bill_to_site_use_id
       into   l_cr_rec.pay_from_customer,
              l_cr_rec.customer_bank_account_id,
              l_cr_rec.customer_site_use_id
       from   ra_customer_trx
       where  customer_trx_id = p_reference_id;
Line: 937

  arp_cash_receipts_pkg.insert_p(l_cr_rec);
Line: 942

  SELECT rowid
  INTO   p_row_id
  FROM   ar_cash_receipts
  WHERE  cash_receipt_id = l_cr_rec.cash_receipt_id;
Line: 974

  arp_proc_rct_util.insert_crh_rec(
			l_cr_rec,
			l_cr_rec.amount,
			l_acctd_amount,
			NULL,
			NULL,
			p_gl_date,
			l_creation_status,
			p_batch_id,
			l_ccid,
			NULL,
			l_crh_rec);
Line: 990

  arp_proc_rct_util.insert_dist_rec(
			l_cr_rec.amount,
			l_acctd_amount,
			l_crh_rec.cash_receipt_history_id,
			l_source_type,
			l_ccid );
Line: 999

  arp_proc_rct_util.insert_misc_dist(
			l_cr_rec.cash_receipt_id,
		      	p_gl_date,
			p_amount,
			p_currency_code,
			p_exchange_rate,
			l_acctd_amount,
			p_receipt_date,
			p_receivables_trx_id,
			p_distribution_set_id,
                        p_ussgl_transaction_code);
Line: 1048

    arp_rw_batches_check_pkg.update_batch_status(
		p_batch_id);
Line: 1053

     arp_debug.debug('arp_process_misc_receipts.insert_misc_receipt()-');
Line: 1059

         arp_debug.debug('Exception in insert_misc_receipt');
Line: 1063

END insert_misc_receipt;