DBA Data[Home] [Help]

APPS.ARP_PROCESS_DIST SQL Statements

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

Line: 269

 |    Inserts two records to backout the existing dist record.	             |
 |    This procedure is called if backout is required and the dist's         |
 |    code_combination_id has changed.	 		      	             |
 |                                                                           |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |    arp_util.debug                                                         |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 |		      p_old_dist_rec					     |
 |		      p_new_dist_rec					     |
 |                    p_header_gl_date                                       |
 |                    p_trx_date                                             |
 |                    p_invoicing_rule_id                                    |
 |		      p_exchange_rate					     |
 |		      p_currency_code					     |
 |		      p_precision					     |
 |		      p_mau						     |
 |              OUT:                                                         |
 |                    None						     |
 |          IN/ OUT:							     |
 |                    None						     |
 |                                                                           |
 | RETURNS    : NONE                                                         |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |     19-JUL-95  Charlie Tomberg     Created                                |
 |     08-NOV-95  Martin Johnson      Made cust_trx_line_salesrep_id and     |
 |                                      gl_posted_date null for new dist.    |
 |                                      Call validate_and_default_gl_date()  |
 |                                      to get gl_date.                      |
 |                                                                           |
 +===========================================================================*/

PROCEDURE backout_ccid(
               p_old_dist_rec      IN ra_cust_trx_line_gl_dist%rowtype,
               p_new_dist_rec      IN ra_cust_trx_line_gl_dist%rowtype,
               p_header_gl_date    IN date,
               p_trx_date          IN date,
               p_invoicing_rule_id IN ra_customer_trx.invoicing_rule_id%type,
               p_exchange_rate     IN ra_customer_trx.exchange_rate%type,
               p_currency_code     IN fnd_currencies.currency_code%type,
               p_precision         IN fnd_currencies.precision%type,
               p_mau               IN
                                  fnd_currencies.minimum_accountable_unit%type
                      )  IS

   l_cust_trx_line_gl_dist_id
                   ra_cust_trx_line_gl_dist.cust_trx_line_gl_dist_id%type;
Line: 339

    |    insert the new row    |
    +--------------------------*/


   /*---------------------------------------------------------------+
    |    If a new value was specified in the dist rec passed into   |
    |    update_dist() use that value. Otherwise, use the  	    |
    |    value from the original dist line.               	    |
    +---------------------------------------------------------------*/

   arp_ctlgd_pkg.merge_dist_recs( l_old_dist_rec,
                                  l_new_dist_rec,
                                  l_new_dist_rec);
Line: 372

    |    Call the table handler to insert the new dist record   |
    +-----------------------------------------------------------*/

   arp_ctlgd_pkg.insert_p( l_new_dist_rec,
                           l_cust_trx_line_gl_dist_id,
                           p_exchange_rate,
                           p_currency_code,
                           p_precision,
                           p_mau);
Line: 391

      ARP_CTLGD_PKG.update_p( l_orig_dist_rec ,
                                l_old_dist_rec.cust_trx_line_gl_dist_id );
Line: 420

   arp_ctlgd_pkg.insert_p( l_old_dist_rec,
                           l_cust_trx_line_gl_dist_id,
                           p_exchange_rate,
                           p_currency_code,
                           p_precision,
                           p_mau);
Line: 459

 |    Inserts one record to backout the existing dist record.		     |
 |    This procedure is called if backout is required and the amount or      |
 |    percent of a dist record has changed.				     |
 |                                                                           |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |    arp_util.debug                                                         |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 | 		      p_old_dist_rec					     |
 | 		      p_new_dist_rec					     |
 |                    p_header_gl_date                                       |
 |                    p_trx_date                                             |
 |                    p_invoicing_rule_id                                    |
 |		      p_exchange_rate					     |
 |		      p_currency_code					     |
 |		      p_precision					     |
 |		      p_mau						     |
 |              OUT:                                                         |
 |                    None						     |
 |          IN/ OUT:							     |
 |                    None						     |
 |                                                                           |
 | RETURNS    : NONE                                                         |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |     19-JUL-95  Charlie Tomberg     Created                                |
 |     08-NOV-95  Martin Johnson      Made cust_trx_line_salesrep_id and     |
 |                                      gl_posted_date null for new dist.    |
 |                                      Call validate_and_default_gl_date()  |
 |                                      to get gl_date.                      |
 |                                                                           |
 +===========================================================================*/


PROCEDURE backout_amount(
               p_old_dist_rec      IN ra_cust_trx_line_gl_dist%rowtype,
               p_new_dist_rec      IN ra_cust_trx_line_gl_dist%rowtype,
               p_header_gl_date    IN date,
               p_trx_date          IN date,
               p_invoicing_rule_id IN ra_customer_trx.invoicing_rule_id%type,
               p_exchange_rate     IN ra_customer_trx.exchange_rate%type,
               p_currency_code     IN fnd_currencies.currency_code%type,
               p_precision         IN fnd_currencies.precision%type,
               p_mau               IN
                                  fnd_currencies.minimum_accountable_unit%type
                        )  IS


   l_cust_trx_line_gl_dist_id
                   ra_cust_trx_line_gl_dist.cust_trx_line_gl_dist_id%type;
Line: 537

    |    update_dist(), use that value. Otherwise, use the	    |
    |    value from the original dist record.                	    |
    +---------------------------------------------------------------*/

   arp_ctlgd_pkg.merge_dist_recs( l_old_dist_rec,
                                  l_new_dist_rec,
                                  l_old_dist_rec);
Line: 546

   |  Force insert_p() to recalculate the accounted amount  |
   |  instead of using the value from the old dist record.  |
   +--------------------------------------------------------*/

   l_old_dist_rec.acctd_amount := null;
Line: 573

   arp_ctlgd_pkg.insert_p( l_old_dist_rec,
                           l_cust_trx_line_gl_dist_id,
                           p_exchange_rate,
                           p_currency_code,
                           p_precision,
                           p_mau);
Line: 677

 |    val_insert_dist		               		                     |
 |                                                                           |
 | DESCRIPTION                                                               |
 |    Does validation necessary when a new dist is inserted.		     |
 |                                                                           |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |    arp_util.debug                                                         |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 |                    p_dist_rec					     |
 |              OUT:                                                         |
 |                    None                                                   |
 |                                                                           |
 | RETURNS    : NONE                                                         |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |     19-JUL-95  Charlie Tomberg     Created                                |
 |                                                                           |
 +===========================================================================*/


PROCEDURE val_insert_dist ( p_dist_rec IN ra_cust_trx_line_gl_dist%rowtype ) IS


BEGIN

   arp_util.debug('arp_process_dist.val_insert_dist()+');
Line: 710

   arp_util.debug('arp_process_dist.val_val_insert_dist()-');
Line: 720

               'EXCEPTION:  arp_process_dist.val_insert_dist()');
Line: 722

        arp_util.debug('---------- val_insert_dist() ---------');
Line: 731

 |    val_update_dist		          	                             |
 |                                                                           |
 | DESCRIPTION                                                               |
 |    Does validation that is required when a dist is updated.		     |
 |                                                                           |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |    arp_util.debug                                                         |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 |	  	      p_dist_rec					     |
 |              OUT:                                                         |
 |                    None                                                   |
 |                                                                           |
 | RETURNS    : NONE                                                         |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |     19-JUL-95  Charlie Tomberg     Created                                |
 |                                                                           |
 +===========================================================================*/

PROCEDURE val_update_dist ( p_dist_rec IN  ra_cust_trx_line_gl_dist%rowtype )
                       IS


BEGIN

   arp_util.debug('arp_process_dist.val_update_dist()+');
Line: 764

   arp_util.debug('arp_process_dist.val_val_update_dist()-');
Line: 774

               'EXCEPTION:  arp_process_dist.val_update_dist()');
Line: 777

        arp_util.debug('---------- val_update_dist() ---------');
Line: 786

 |    val_delete_dist			                                     |
 |                                                                           |
 | DESCRIPTION                                                               |
 |    Does validation that is required when a dist is deleted.		     |
 |                                                                           |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |    arp_util.debug                                                         |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 |	  	      p_dist_rec					     |
 |              OUT:                                                         |
 |                    None                                                   |
 |                                                                           |
 | RETURNS    : NONE                                                         |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |     19-JUL-95  Charlie Tomberg     Created                                |
 |                                                                           |
 +===========================================================================*/

PROCEDURE val_delete_dist ( p_dist_rec IN ra_cust_trx_line_gl_dist%rowtype ) IS


BEGIN

   arp_util.debug('arp_process_dist.val_delete_dist()+');
Line: 818

   arp_util.debug('arp_process_dist.val_delete_dist()-');
Line: 827

        arp_util.debug('EXCEPTION:  arp_process_dist.val_delete_dist()');
Line: 830

        arp_util.debug('---------- val_update_dist() ---------');
Line: 840

 |    insert_dist							     |
 |                                                                           |
 | DESCRIPTION                                                               |
 |    Inserts a record into ra_cust_trx_line_gl_dist			     |
 |                                                                           |
 | SCOPE - PUBLIC                                                            |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |    arp_util.debug                                                         |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 |		      p_form_name					     |
 |		      p_form_version					     |
 |		      p_dist_rec					     |
 |		      p_cust_trx_line_gl_dist_id 			     |
 |		      p_exchange_rate					     |
 |		      p_currency_code					     |
 |		      p_precision					     |
 |		      p_mau						     |
 |              OUT:                                                         |
 |                    p_cust_trx_line_gl_dist_id                             |
 |          IN/ OUT:							     |
 |                    None						     |
 |                                                                           |
 | RETURNS    : NONE                                                         |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |     12-JUL-95  Charlie Tomberg     Created                                |
 |                                                                           |
 +===========================================================================*/


PROCEDURE insert_dist(
           p_form_name     IN varchar2,
           p_form_version  IN number,
           p_dist_rec	   IN ra_cust_trx_line_gl_dist%rowtype,
           p_exchange_rate IN ra_customer_trx.exchange_rate%type DEFAULT 1,
           p_currency_code IN fnd_currencies.currency_code%type  DEFAULT null,
           p_precision     IN fnd_currencies.precision%type      DEFAULT null,
           p_mau           IN fnd_currencies.minimum_accountable_unit%type
                              DEFAULT null,
           p_cust_trx_line_gl_dist_id  OUT NOCOPY
              ra_cust_trx_line_gl_dist.cust_trx_line_gl_dist_id%type)
                   IS


   l_cust_trx_line_gl_dist_id
                   ra_cust_trx_line_gl_dist.cust_trx_line_gl_dist_id%type;
Line: 895

      arp_util.debug('arp_process_dist.insert_dist()+');
Line: 908

      arp_process_dist.val_insert_dist(p_dist_rec);
Line: 917

      arp_ctlgd_pkg.insert_p( p_dist_rec,
                              p_cust_trx_line_gl_dist_id,
                              p_exchange_rate,
                              p_currency_code,
                              p_precision,
                              p_mau);
Line: 947

      arp_util.debug('arp_process_dist.insert_dist()-');
Line: 952

    arp_util.debug('EXCEPTION:  arp_process_dist.insert_dist()');
Line: 961

    arp_util.debug('---------- insert_dist() ---------');
Line: 980

 |    update_dist						    	     |
 |                                                                           |
 | DESCRIPTION                                                               |
 |    Updates a record in ra_cust_trx_line_gl_dist			     |
 |                                                                           |
 | SCOPE - PUBLIC                                                            |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |    arp_util.debug                                                         |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 |		      p_form_name					     |
 |		      p_form_version					     |
 |		      p_cust_trx_line_gl_dist_id  			     |
 |		      p_customer_trx_id		  			     |
 |		      p_dist_rec					     |
 |                    p_header_gl_date                                       |
 |                    p_trx_date                                             |
 |                    p_invoicing_rule_id                                    |
 |		      p_exchange_rate					     |
 |		      p_currency_code					     |
 |		      p_precision					     |
 |		      p_mau						     |
 |              OUT:                                                         |
 |		      p_backout_done_flag                                    |
 |          IN/ OUT:							     |
 |                    None						     |
 |                                                                           |
 | RETURNS    : NONE                                                         |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |     19-JUL-95  Charlie Tomberg     Created                                |
 |     07-NOV-95  Martin Johnson      Added OUT parameter p_backout_done_flag|
 |                                    Added IN parameters p_header_gl_date,  |
 |                                      p_trx_date, p_invoicing_rule_id      |
 |     28-MAY-03  Herve   Yu          Added XLA plug ins bug#2979254         |
 |                                                                           |
 +===========================================================================*/


PROCEDURE update_dist(
           p_form_name                 IN varchar2,
           p_form_version              IN number,
           p_backout_flag              IN boolean,
           p_cust_trx_line_gl_dist_id  IN
                    ra_cust_trx_line_gl_dist.cust_trx_line_gl_dist_id%type,
           p_customer_trx_id	       IN ra_customer_trx.customer_trx_id%type,
           p_dist_rec		       IN OUT NOCOPY ra_cust_trx_line_gl_dist%rowtype,
           p_header_gl_date            IN date,
           p_trx_date                  IN date,
           p_invoicing_rule_id         IN
                    ra_customer_trx.invoicing_rule_id%type,
           p_backout_done_flag         OUT NOCOPY boolean,
           p_exchange_rate             IN ra_customer_trx.exchange_rate%type
                                          DEFAULT 1,
           p_currency_code             IN fnd_currencies.currency_code%type
                                          DEFAULT null,
           p_precision                 IN fnd_currencies.precision%type
                                          DEFAULT null,
           p_mau                       IN
                                   fnd_currencies.minimum_accountable_unit%type
                                   DEFAULT null )
                   IS


   l_cust_trx_line_gl_dist_id
                   ra_cust_trx_line_gl_dist.cust_trx_line_gl_dist_id%type;
Line: 1070

      arp_util.debug('arp_process_dist.update_dist()+');
Line: 1089

      arp_process_dist.val_update_dist(p_dist_rec);
Line: 1119

         |  THEN  do a simple update				|
         |  ELSE IF   the ccid has changed			|
         |       THEN create two offsetting records		|
         |       ELSE IF   the amount has changed		|
         |            THEN create one offsetting record		|
         |            ELSE do a simple update			|
	 +------------------------------------------------------*/

      IF   (l_backout_flag = FALSE)
      THEN
 	      /*--------------------------------------+
               |  Do a simple update with no backout. |
               +--------------------------------------*/

 	      /*-----------------------------------------------+
               |  Break the link to ra_cust_trx_line_salesreps |
               |  if the amount or account has been changed    |
               +-----------------------------------------------*/

  /* Bug 4053374 Link should be kept intact */
  /*             IF      (
                          p_dist_rec.cust_trx_line_salesrep_id IS NOT NULL AND
                          (
                             l_amount_percent_changed_flag = TRUE  OR
                             l_ccid_changed_flag           = TRUE  OR
                             p_dist_rec.code_combination_id = -1
                          )
                       )
               THEN    p_dist_rec.cust_trx_line_salesrep_id := null;
Line: 1151

               |  Call the table handler to do a simple update  |
               +------------------------------------------------*/

               arp_util.debug('simple update - case 1');
Line: 1155

               arp_ctlgd_pkg.update_p( p_dist_rec,
                                       p_cust_trx_line_gl_dist_id,
                                       p_exchange_rate,
                                       p_currency_code,
                                       p_precision,
                                       p_mau);
Line: 1168

                   SELECT ctt.accounting_affect_flag,
                          ctt.type,
                          ct.previous_customer_trx_id
                     INTO
                          l_open_rec,
                          l_ctt_type,
                          l_previous_customer_trx_id
                     FROM ra_cust_trx_types ctt,
                          ra_customer_trx ct
                    WHERE ct.customer_trx_id   = p_customer_trx_id
                      AND ct.cust_trx_type_id  = ctt.cust_trx_type_id;
Line: 1189

                       SELECT app.receivable_application_id app_id,
                              app.customer_trx_id           trx_id
                         FROM    ar_receivable_applications app
                        WHERE  app.applied_customer_trx_id  = l_previous_customer_trx_id
                          AND  app.customer_trx_id = p_customer_trx_id
			  AND  app.posting_control_id = -3
                          AND  NVL(app.confirmed_flag,'Y') = 'Y'
                          AND  EXISTS (SELECT 'x'
                                       FROM  ar_distributions ard
                                       WHERE  ard.source_table = 'RA'
                                       AND  ard.source_id    = app.receivable_application_id);
Line: 1212

                         arp_acct_main.Delete_Acct_Entry(l_ae_doc_rec);
Line: 1228

                 |  Insert 2 rows into ra_cust_trx_line_gl_dist   |
                 |       1. amount = -,		  |
                 |          ccid = 		  |
                 |       2. amount = ,	  |
                 |          ccid = 			  |
                 +------------------------------------------------*/

                backout_ccid(l_old_dist_rec,
                             p_dist_rec,
                             p_header_gl_date,
                             p_trx_date,
                             p_invoicing_rule_id,
                             p_exchange_rate,
                             p_currency_code,
                             p_precision,
                             p_mau);
Line: 1251

                     |  Insert one new row to backout the old amount. |
                     |  amount =  -      |
                     +------------------------------------------------*/

                     backout_amount(l_old_dist_rec,
                                    p_dist_rec,
                                    p_header_gl_date,
                                    p_trx_date,
                                    p_invoicing_rule_id,
                                    p_exchange_rate,
                                    p_currency_code,
                                    p_precision,
                                    p_mau);
Line: 1270

                     |  Do a simple update with no backout. |
                     |  Nothing of consequence has changed. |
                     +--------------------------------------*/

                     arp_util.debug('simple update - case 2');
Line: 1276

                     arp_ctlgd_pkg.update_p(p_dist_rec,
                                            p_cust_trx_line_gl_dist_id,
                                            p_exchange_rate,
                                            p_currency_code,
                                            p_precision,
                                            p_mau);
Line: 1313

     arp_util.debug('arp_process_dist.update_dist()-');
Line: 1322

    arp_util.debug('EXCEPTION:  arp_process_dist.update_dist()');
Line: 1323

    arp_util.debug('---------- parameters for update_dist() ---------');
Line: 1354

 |    delete_dist							     |
 |                                                                           |
 | DESCRIPTION                                                               |
 |    Deletes a record fromra_cust_trx_line_gl_dist.			     |
 |                                                                           |
 | SCOPE - PUBLIC                                                            |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |    arp_util.debug                                                         |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 |		      p_form_name					     |
 |		      p_form_version					     |
 |		      p_cust_trx_line_gl_dist_id 			     |
 |		      p_customer_trx_id 				     |
 |		      p_dist_rec					     |
 |              OUT:                                                         |
 |                    None						     |
 |          IN/ OUT:							     |
 |                    None						     |
 |                                                                           |
 | RETURNS    : NONE                                                         |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |     19-JUL-95  Charlie Tomberg     Created                                |
 |                                                                           |
 +===========================================================================*/


PROCEDURE delete_dist(
           p_form_name                 IN varchar2,
           p_form_version              IN number,
           p_cust_trx_line_gl_dist_id  IN
                    ra_cust_trx_line_gl_dist.cust_trx_line_gl_dist_id%type,
           p_customer_trx_id	       IN ra_customer_trx.customer_trx_id%type,
           p_dist_rec		       IN ra_cust_trx_line_gl_dist%rowtype)
                   IS


BEGIN

      arp_util.debug('arp_process_dist.delete_dist()+');
Line: 1410

      arp_process_dist.val_delete_dist(p_dist_rec);
Line: 1419

        |  call the table-handler to delete the dist record  |
        +----------------------------------------------------*/

      arp_ctlgd_pkg.delete_p( p_cust_trx_line_gl_dist_id );
Line: 1429

      arp_util.debug('arp_process_dist.delete_dist()-');
Line: 1438

    arp_util.debug('EXCEPTION:  arp_process_dist.delete_dist()');
Line: 1440

    arp_util.debug('---------- delete_dist() ---------');