DBA Data[Home] [Help]

APPS.AR_AME_CMWF_API SQL Statements

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

Line: 24

    SELECT org_id
    FROM   ra_cm_requests_all
    WHERE  request_id = p_item_key;
Line: 142

    SELECT org_id
    FROM   ra_cm_requests_all
    WHERE  request_id = p_item_key;
Line: 186

    SELECT 1
    FROM  wf_roles
    WHERE orig_system = 'PER'
    AND   orig_system_id = p_employee_id
    AND   status = 'ACTIVE'
    AND   (expiration_date IS NULL OR
           sysdate < expiration_date)
    AND   rownum < 2;
Line: 216

    SELECT supervisor_id
    FROM  per_all_assignments_f
    WHERE  person_id = l_employee_id
    AND    per_all_assignments_f.primary_flag = 'Y'
    AND    per_all_assignments_f.assignment_type in ('E','C')
    AND    per_all_assignments_f.assignment_status_type_id
             NOT IN
             (SELECT assignment_status_type_id
              FROM  per_assignment_status_types
              WHERE  per_system_status = 'TERM_ASSIGN');
Line: 291

        SELECT employee_id
        FROM   fnd_user
        WHERE  user_id = p_user_id;
Line: 336

        SELECT user_id
        FROM   fnd_user
        WHERE  employee_id = p_employee_id
        AND    NVL(end_date,sysdate) >= sysdate ;
Line: 522

    SELECT user_id
    FROM   fnd_user
    WHERE  user_name = p_user_name;
Line: 567

    InsertTrxNotes (
      x_customer_call_id       => NULL,
      x_customer_call_topic_id => NULL,
      x_action_id              => NULL,
      x_customer_trx_id        => l_customer_trx_id,
      x_note_type              => 'MAINTAIN',
      x_text                   => l_note_text,
      x_note_id                => l_note_id);
Line: 619

    SELECT count(*)
    FROM   ar_approval_user_limits aul
    WHERE  aul.reason_code   = l_reason_code
    AND    aul.currency_code = l_currency_code
    AND    aul.primary_flag  = p_primary_flag
    AND    user_id = p_employee_id
    ORDER BY - aul.amount_from;
Line: 830

    g_debug_mesg := 'call AME updateApprovalStatus - ' ||
     'l_approver_user_id: ' || l_approver_user_id ||
     ' l_approver_employee_id: ' || l_approver_employee_id;
Line: 835

    ame_api.updateApprovalStatus2(
      applicationIdIn    => c_application_id,
      transactionIdIn    => p_item_key,
      approvalStatusIn   => p_response,
      approverPersonIdIn => l_approver_employee_id,
      approverUserIdIn   => l_approver_user_id,
      transactionTypeIn  => l_transaction_type);
Line: 843

    g_debug_mesg := 'Returned successfully from updateApprovalStatus!';
Line: 980

    SELECT name, display_name
    FROM   wf_users
    WHERE  orig_system = 'PER'
    AND    orig_system_id = l_requestor_id;
Line: 986

    SELECT name, display_name
    FROM   wf_users
    WHERE  orig_system = 'FND_USR'
    AND    orig_system_id = l_requestor_id;
Line: 1258

    SELECT r.request_id,
           r.customer_trx_id,
           r.total_amount,
           r.cm_reason_code,
           l.meaning,
           r.created_by,
           r.comments,
           r.line_credits_flag,
           r.line_amount,
           r.tax_amount,
           r.freight_amount,
           r.ORIG_TRX_NUMBER,
           r.TAX_EX_CERT_NUM,
	   r.internal_comment
    FROM   ar_lookups l, ra_cm_requests r
    WHERE  r.request_id = p_item_key
    AND    r.cm_reason_code = l.lookup_code
    AND    l.lookup_type = 'CREDIT_MEMO_REASON';
Line: 1377

    SELECT   sum(ps.amount_line_items_original),
             sum(ps.tax_original),
             sum(ps.freight_original),
             sum(ps.amount_due_original),
             ps.invoice_currency_code
    FROM     ar_payment_schedules ps
    WHERE    ps.customer_trx_id = p_customer_trx_id
    GROUP BY ps.invoice_currency_code ;
Line: 1449

    SELECT url, transaction_url, activities_url
    FROM   ra_cm_requests
    WHERE  request_id = p_item_key;
Line: 1636

    SELECT rct.bill_to_site_use_id,
           rct.bill_to_customer_id,
           substrb(party.party_name,1,50),
           bill_to_cust.account_number,
           rct.trx_number
    FROM   hz_cust_accounts bill_to_cust,
           hz_parties party,
           ra_customer_trx  rct
    WHERE  rct.customer_trx_id = p_customer_trx_id
    AND    rct.bill_to_customer_id = bill_to_cust.cust_account_id
    AND     bill_to_cust.party_id = party.party_id ;
Line: 1649

    SELECT substrb(party.party_name,1,50),
           ship_to_cust.account_number
    FROM   hz_cust_accounts ship_to_cust,
           hz_parties  party,
           ra_customer_trx  rct
    WHERE  rct.customer_trx_id = p_customer_trx_id
    AND    rct.ship_to_customer_id   = ship_to_cust.cust_account_id
    AND    ship_to_cust.party_id = party.party_id;
Line: 1727

    SELECT  collector_id, name
    FROM    ar_collectors
    WHERE   employee_id = p_employee_id;
Line: 1937

    SELECT invoicing_rule_id
    FROM ra_customer_trx
    WHERE customer_trx_id = p_cust_trx_id;
Line: 2358

    SELECT employee_id, user_id
    FROM   fnd_user
    WHERE  user_name = p_user_name;
Line: 2776

    SELECT supervisor_id
    FROM   per_all_assignments_f
    WHERE  person_id = p_employee_id
    AND    primary_flag = 'Y' -- get primary assgt
    AND    assignment_type = 'E' -- ensure emp assgt, not applicant assgt
    AND    trunc(sysdate) BETWEEN effective_start_date
                          AND     effective_end_date;
Line: 3469

  SELECT aul.amount_to, aul.amount_from INTO  l_amount_to, l_amount_from
  FROM ar_approval_user_limits aul
  WHERE aul.user_id     = p_approver_id
  AND aul.reason_code   = p_reason_code
  AND aul.currency_code = p_currency_code ;
Line: 3530

      SELECT payment_schedule_id, due_date, amount_in_dispute, dispute_date
        FROM ar_payment_schedules ps
       WHERE ps.customer_trx_id = p_customer_trx_id;
Line: 3562

        SELECT total_amount  * -1
          into remove_from_dispute_amt
          from ra_cm_requests
         WHERE request_id = l_request_id;
Line: 3583

                arp_process_cutil.update_ps
                     (p_ps_id=> ps_rec.payment_schedule_id,
	              p_due_date=> ps_rec.due_date,
                      p_amount_in_dispute=> new_dispute_amt,
                      p_dispute_date=> new_dispute_date,
                      p_update_dff => 'N',
	              p_attribute_category=>NULL,
	              p_attribute1=>NULL,
	              p_attribute2=>NULL,
	              p_attribute3=>NULL,
	              p_attribute4=>NULL,
	              p_attribute5=>NULL,
	              p_attribute6=>NULL,
	              p_attribute7=>NULL,
	              p_attribute8=>NULL,
	              p_attribute9=>NULL,
	              p_attribute10=>NULL,
	              p_attribute11=>NULL,
	              p_attribute12=>NULL,
	              p_attribute13=>NULL,
	              p_attribute14=>NULL,
	              p_attribute15=>NULL );
Line: 3830

        SELECT orig_system_id, display_name
	INTO l_approver_id, l_approver_display_name
        FROM wf_users
        WHERE orig_system = 'PER'
        AND   name = l_approver_user_name;
Line: 3895

/*7367350 Changed procedure to insert note in Invoice maintenance notes.
          A new note is inserted in for internal comment     */
PROCEDURE InsertSubmissionNotes(p_item_type        IN  VARCHAR2,
                                p_item_key         IN  VARCHAR2,
                                p_actid            IN  NUMBER,
                                p_funcmode         IN  VARCHAR2,
                                p_result           OUT NOCOPY VARCHAR2) IS

  l_document_id                NUMBER;
Line: 3922

  g_debug_mesg := 'Entered INSERTSUBMISSIONNOTES';
Line: 3924

     arp_standard.debug('InsertSubmissionNotes: ' || g_debug_mesg);
Line: 3978

        SELECT meaning into l_reason_meaning
        from ar_lookups
        WHERE lookup_type = 'CREDIT_MEMO_REASON'
          and lookup_code = l_reason_code;
Line: 3997

	  select meaning into l_comment_type
 	  from ar_lookups
	  where  LOOKUP_TYPE='AR_COMMENT_CLASSIFICATION'
	  AND    LOOKUP_CODE='C';
Line: 4004

    /*bug 7367350 Changes to insert internla commen notes in invoice maintenance */
    IF  l_internal_comment  is NOT NULL then
	  select meaning into l_comment_type
 	  from ar_lookups
	  where  LOOKUP_TYPE='AR_COMMENT_CLASSIFICATION'
	  AND    LOOKUP_CODE='I';
Line: 4012

	  		   InsertTrxNotes(NULL,
                        NULL,
                        NULL,
                        l_customer_trx_id,
                        'MAINTAIN',
                        l_note_text1,
                        l_note_id);
Line: 4022

         InsertTrxNotes(NULL,
                        NULL,
                        NULL,
                        l_customer_trx_id,
                        'MAINTAIN',
                        l_note_text,
                        l_note_id);
Line: 4062

        proc_name => 'INSERTSUBMISSIONNOTES',
        arg1      => p_item_type,
        arg2      => p_item_key,
        arg3      => p_funcmode,
        arg4      => to_char(p_actid),
        arg5      => g_debug_mesg);
Line: 4071

END InsertSubmissionNotes;
Line: 4074

PROCEDURE InsertApprovalReminderNotes(p_item_type        IN  VARCHAR2,
                                     p_item_key         IN  VARCHAR2,
                                     p_actid            IN  NUMBER,
                                     p_funcmode         IN  VARCHAR2,
                                     p_result           OUT NOCOPY VARCHAR2) IS

  l_document_id                NUMBER;
Line: 4090

  g_debug_mesg := 'Entered INSERTAPPROVALREMINDERNOTES';
Line: 4092

     arp_standard.debug('InsertApprovalReminderNotes: ' || g_debug_mesg);
Line: 4129

         InsertTrxNotes(NULL,
                        NULL,
                        NULL,
                        l_customer_trx_id,
                        'MAINTAIN',
                        l_note_text,
                        l_note_id);
Line: 4167

        proc_name => 'INSERTAPPROVALREMINDERNOTES',
        arg1      => p_item_type,
        arg2      => p_item_key,
        arg3      => p_funcmode,
        arg4      => to_char(p_actid),
        arg5      => g_debug_mesg);
Line: 4176

END InsertApprovalReminderNotes;
Line: 4179

PROCEDURE InsertEscalationNotes     (p_item_type        IN  VARCHAR2,
                                     p_item_key         IN  VARCHAR2,
                                     p_actid            IN  NUMBER,
                                     p_funcmode         IN  VARCHAR2,
                                     p_result           OUT NOCOPY VARCHAR2) IS

  l_document_id                NUMBER;
Line: 4195

  g_debug_mesg := 'Entered INSERTESCAlATIONNOTES';
Line: 4197

     arp_standard.debug('InsertEscalationNotes: ' || g_debug_mesg);
Line: 4235

         InsertTrxNotes(NULL,
                        NULL,
                        NULL,
                        l_customer_trx_id,
                        'MAINTAIN',
                        l_note_text,
                        l_note_id);
Line: 4273

        proc_name => 'INSERTESCALATIONNOTES',
        arg1      => p_item_type,
        arg2      => p_item_key,
        arg3      => p_funcmode,
        arg4      => to_char(p_actid),
        arg5      => g_debug_mesg);
Line: 4282

END InsertEscalationNotes;
Line: 4285

PROCEDURE InsertRequestManualNotes  (p_item_type        IN  VARCHAR2,
                                     p_item_key         IN  VARCHAR2,
                                     p_actid            IN  NUMBER,
                                     p_funcmode         IN  VARCHAR2,
                                     p_result           OUT NOCOPY VARCHAR2) IS

  l_document_id                NUMBER;
Line: 4302

  g_debug_mesg := 'Entered INSERTREQUESTMANUALNOTES';
Line: 4304

     arp_standard.debug('InsertRequestManualNotes: ' || g_debug_mesg);
Line: 4329

     SELECT display_name INTO l_role_display_name
     FROM wf_roles
     WHERE name = l_receivable_role;
Line: 4343

         InsertTrxNotes(NULL,
                        NULL,
                        NULL,
                        l_customer_trx_id,
                        'MAINTAIN',
                        l_note_text,
                        l_note_id);
Line: 4381

        proc_name => 'INSERTREQUESTMANUALNOTES',
        arg1      => p_item_type,
        arg2      => p_item_key,
        arg3      => p_funcmode,
        arg4      => to_char(p_actid),
        arg5      => g_debug_mesg);
Line: 4390

END InsertRequestManualNotes;
Line: 4393

PROCEDURE InsertCompletedManualNotes(p_item_type        IN  VARCHAR2,
                                     p_item_key         IN  VARCHAR2,
                                     p_actid            IN  NUMBER,
                                     p_funcmode         IN  VARCHAR2,
                                     p_result           OUT NOCOPY VARCHAR2) IS

  l_document_id                NUMBER;
Line: 4407

  l_last_updated_by     NUMBER;
Line: 4408

  l_last_update_login   NUMBER;
Line: 4413

  g_debug_mesg := 'Entered INSERTCOMPLETEDMANUALNOTES';
Line: 4415

     arp_standard.debug('InsertCompletedManualNotes: ' || g_debug_mesg);
Line: 4431

    l_last_updated_by   := ARP_GLOBAL.user_id;
Line: 4432

    l_last_update_login := ARP_GLOBAL.last_update_login ;
Line: 4451

    SELECT display_name INTO l_role_display_name
    FROM wf_roles
    WHERE   name = l_receivable_role;
Line: 4467

    InsertTrxNotes(NULL,
                   NULL,
                   NULL,
                   l_customer_trx_id,
                   'MAINTAIN',
                   l_note_text,
                   l_note_id);
Line: 4476

     update ra_cm_requests
	set status = 'COMPLETE',
	    approval_date = SYSDATE,
            last_updated_by = l_last_updated_by,
            last_update_date = SYSDATE,
            last_update_login = l_last_update_login
	WHERE request_id = p_item_key;
Line: 4513

        proc_name => 'INSERTCOMPLETEDMANUALNOTES',
        arg1      => p_item_type,
        arg2      => p_item_key,
        arg3      => p_funcmode,
        arg4      => to_char(p_actid),
        arg5      => g_debug_mesg);
Line: 4522

END InsertCompletedManualNotes;
Line: 4525

PROCEDURE InsertRequestApprovalNotes(p_item_type        IN  VARCHAR2,
                                     p_item_key         IN  VARCHAR2,
                                     p_actid            IN  NUMBER,
                                     p_funcmode         IN  VARCHAR2,
                                     p_result           OUT NOCOPY VARCHAR2) IS

  l_document_id                NUMBER;
Line: 4540

  g_debug_mesg := 'Entered INSERTREQUESTAPPROVALNOTES';
Line: 4542

     arp_standard.debug('InsertRequestApprovalNotes: ' || g_debug_mesg);
Line: 4580

         InsertTrxNotes(NULL,
                        NULL,
                        NULL,
                        l_customer_trx_id,
                        'MAINTAIN',
                        l_note_text,
                        l_note_id);
Line: 4618

        proc_name => 'INSERTREQUESTAPPROVALNOTES',
        arg1      => p_item_type,
        arg2      => p_item_key,
        arg3      => p_funcmode,
        arg4      => to_char(p_actid),
        arg5      => g_debug_mesg);
Line: 4627

END InsertRequestApprovalNotes;
Line: 4630

PROCEDURE InsertApprovedResponseNotes(p_item_type        IN  VARCHAR2,
                                      p_item_key         IN  VARCHAR2,
                                      p_actid            IN  NUMBER,
                                      p_funcmode         IN  VARCHAR2,
                                      p_result           OUT NOCOPY VARCHAR2) IS

  l_document_id                NUMBER;
Line: 4649

  g_debug_mesg := 'Entered INSERTAPPROVEDRESPONSENOTES';
Line: 4651

     arp_standard.debug('InsertApprovedResponseNotes: ' || g_debug_mesg);
Line: 4661

  g_debug_mesg   := 'Insert Approved Response notes';
Line: 4698

    InsertTrxNotes(NULL,
                   NULL,
                   NULL,
                   l_customer_trx_id,
                   'MAINTAIN',
                   l_note_text,
                   l_note_id);
Line: 4720

    g_debug_mesg := 'InsertApprovedResponseNotes - return from RecordResponse';
Line: 4723

       arp_standard.debug('InsertApprovedResponseNotes: ' || g_debug_mesg);
Line: 4763

        proc_name => 'INSERTAPPROVEDRESPONSENOTES',
        arg1      => p_item_type,
        arg2      => p_item_key,
        arg3      => p_funcmode,
        arg4      => to_char(p_actid),
        arg5      => g_debug_mesg);
Line: 4772

END InsertApprovedResponseNotes;
Line: 4775

PROCEDURE InsertRejectedResponseNotes(p_item_type        IN  VARCHAR2,
                                      p_item_key         IN  VARCHAR2,
                                      p_actid            IN  NUMBER,
                                      p_funcmode         IN  VARCHAR2,
                                      p_result           OUT NOCOPY VARCHAR2) IS

  l_document_id                NUMBER;
Line: 4789

  l_last_updated_by     NUMBER;
Line: 4790

  l_last_update_login   NUMBER;
Line: 4797

  g_debug_mesg := 'Entered INSERTREJECTEDRESPONSENOTES';
Line: 4799

     arp_standard.debug('InsertRejectedResponseNotes: ' || g_debug_mesg);
Line: 4811

  l_last_updated_by := ARP_GLOBAL.user_id;
Line: 4812

  l_last_update_login := ARP_GLOBAL.last_update_login ;
Line: 4815

  g_debug_mesg   := 'Insert Rejected Response notes';
Line: 4852

         InsertTrxNotes(NULL,
                        NULL,
                        NULL,
                        l_customer_trx_id,
                        'MAINTAIN',
                        l_note_text,
                        l_note_id);
Line: 4862

     UPDATE ra_cm_requests
     SET status = 'NOT_APPROVED',
         last_updated_by = l_last_updated_by,
         last_update_date = SYSDATE,
         last_update_login = l_last_update_login
     WHERE request_id = p_item_key;
Line: 4885

    g_debug_mesg := 'InsertRejectedResponseNotes -return from updt Approval';
Line: 4887

       arp_standard.debug('InsertRejectedResponseNotes: ' || g_debug_mesg);
Line: 4928

        proc_name => 'INSERTREJECTEDRESPONSENOTES',
        arg1      => p_item_type,
        arg2      => p_item_key,
        arg3      => p_funcmode,
        arg4      => to_char(p_actid),
        arg5      => g_debug_mesg);
Line: 4938

END InsertRejectedResponseNotes;
Line: 4941

PROCEDURE InsertSuccessfulAPINotes(p_item_type        IN  VARCHAR2,
                                   p_item_key         IN  VARCHAR2,
                                   p_actid            IN  NUMBER,
                                   p_funcmode         IN  VARCHAR2,
                                   p_result           OUT NOCOPY VARCHAR2) IS

  l_document_id                NUMBER;
Line: 4957

  g_debug_mesg := 'Entered INSERTSUCCESFULAPINOTES';
Line: 4959

     arp_standard.debug('InsertSuccessfulAPINotes: ' || g_debug_mesg);
Line: 4984

 /* Get trx number for CM and the insert into note text */


    fnd_message.set_name('AR', 'AR_WF_COMPLETED_SUCCESSFUL');
Line: 4997

         InsertTrxNotes(NULL,
                        NULL,
                        NULL,
                        l_customer_trx_id,
                        'MAINTAIN',
                        l_note_text,
                        l_note_id);
Line: 5035

        proc_name => 'INSERTSUCCESSFULAPINOTES',
        arg1      => p_item_type,
        arg2      => p_item_key,
        arg3      => p_funcmode,
        arg4      => to_char(p_actid),
        arg5      => g_debug_mesg);
Line: 5044

END InsertSuccessfulAPINotes;
Line: 5047

PROCEDURE InsertNotes(p_item_type        IN  VARCHAR2,
                      p_item_key         IN  VARCHAR2,
                      p_actid            IN  NUMBER,
                      p_funcmode         IN  VARCHAR2,
                      p_result           OUT NOCOPY VARCHAR2) IS


  l_customer_id                NUMBER;
Line: 5070

  g_debug_mesg := 'Entered INSERTNOTES';
Line: 5072

     arp_standard.debug('InsertNotes: ' || g_debug_mesg);
Line: 5120

         InsertTrxNotes(NULL,
                        NULL,
                        NULL,
                        l_customer_trx_id,
                        'MAINTAIN',
                        'Credit Memo request was approved by receivable role.',
                        l_note_id);
Line: 5158

        proc_name => 'INSERTNOTES',
        arg1      => p_item_type,
        arg2      => p_item_key,
        arg3      => p_funcmode,
        arg4      => to_char(p_actid),
        arg5      => g_debug_mesg);
Line: 5167

END InsertNotes;
Line: 5170

PROCEDURE InsertTrxNotes(x_customer_call_id          IN  NUMBER,
                           x_customer_call_topic_id    IN  NUMBER,
                           x_action_id                 IN  NUMBER,
                           x_customer_trx_id           IN  NUMBER,
                           x_note_type                 IN  VARCHAR2,
                           x_text                      IN  VARCHAR2,
                           x_note_id                   OUT NOCOPY NUMBER) IS

  l_last_updated_by     NUMBER;
Line: 5179

  l_last_update_date    date;
Line: 5180

  l_last_update_login   NUMBER;
Line: 5187

  g_debug_mesg := 'Entered INSERTTRXNOTES';
Line: 5189

     arp_standard.debug('InsertTrxNotes: ' || g_debug_mesg);
Line: 5202

  l_last_update_login     := ARP_GLOBAL.last_update_login;
Line: 5203

  l_last_update_date      := sysdate;
Line: 5204

  l_last_updated_by       := ARP_GLOBAL.USER_ID;
Line: 5208

  arp_notes_pkg.insert_cover(
    p_note_type              => x_note_type,
    p_text                   => x_text,
    p_customer_call_id       => NULL,
    p_customer_call_topic_id => NULL,
    p_call_action_id         => NULL,
    p_customer_trx_id        => x_customer_trx_id,
    p_note_id                => x_note_id,
    p_last_updated_by        => l_last_updated_by,
    p_last_update_date       => l_last_update_date,
    p_last_update_login      => l_last_update_login,
    p_created_by             => l_created_by,
    p_creation_date          => l_creation_date);
Line: 5223

  g_debug_mesg := 'INSERTTRXNOTES - notes inserted';
Line: 5225

     arp_standard.debug('InsertTrxNotes: ' || g_debug_mesg);
Line: 5234

        proc_name => 'INSERTTRXNOTES',
        arg1      => c_item_type,
        arg2      => NULL,
        arg3      => NULL,
        arg4      => NULL,
        arg5      => g_debug_mesg);
Line: 5243

END InsertTrxNotes;
Line: 5267

  l_last_updated_by     NUMBER;
Line: 5268

  l_last_update_login   NUMBER;
Line: 5293

    l_last_updated_by   := ARP_GLOBAL.user_id;
Line: 5294

    l_last_update_login := ARP_GLOBAL.last_update_login ;
Line: 5376

     SELECT cm_customer_trx_id INTO l_credit_memo_id
     FROM ra_cm_requests
     WHERE request_id = l_request_id;
Line: 5398

     UPDATE ra_cm_requests
     SET status='COMPLETE',
         approval_date     = SYSDATE,
         last_updated_by   = l_last_updated_by,
         last_update_date  = SYSDATE,
         last_update_login = l_last_update_login
     WHERE request_id = p_item_key;
Line: 5410

       SELECT trx_number INTO l_credit_memo_number
       FROM ra_customer_trx
       WHERE  customer_trx_id = l_credit_memo_id;
Line: 5446

     g_debug_mesg := 'last Updated By: '
                      || l_last_updated_by || ' '
                      || l_last_update_login;
Line: 5451

     UPDATE ra_cm_requests
     SET status='APPROVED_PEND_COMP',
         approval_date = SYSDATE,
         last_updated_by = l_last_updated_by,
         last_update_date = SYSDATE,
         last_update_login = l_last_update_login
     WHERE request_id = p_item_key;
Line: 5459

     g_debug_mesg := 'After Update';
Line: 5527

    SELECT COUNT(*)
    FROM ra_terms_lines
    WHERE term_id =
      (SELECT term_id
       FROM ra_customer_trx
       WHERE customer_trx_id = p_cust_trx_id);
Line: 5535

    SELECT invoicing_rule_id
    FROM   ra_customer_trx
    WHERE  customer_trx_id = p_cust_trx_id;
Line: 5711

    SELECT rsa.person_id
    FROM ra_customer_trx_all rcta, ra_salesreps_all rsa
    WHERE rcta.primary_salesrep_id = rsa.salesrep_id
    AND rcta.customer_trx_id = p_id;
Line: 5882

    SELECT customer_trx_id
    FROM   ra_customer_trx
    WHERE  customer_trx_id = p_credit_memo_id
    AND    previous_customer_trx_id IS NULL;