Tuesday, 26 March 2013

To FInd the Undefine Customer in Receipt (OR) Null receipt customer in AR

 /* Formatted on 3/27/2013 1:13:18 PM (QP5 v5.114.809.3010) */
SELECT   DISTINCT gcc.segment1 Company,
                  bat.NAME batch_name,
                  arc.deposit_date deposit_date,
                  SUBSTRB (party.party_name, 1, 50) customer_name,
                  cust.ACCOUNT_NUMBER customer_number,
                  arc.receipt_number receipt_number,
                  arc.receipt_date receipt_date,
                  ara.status receipt_status,
                  ara.amount_applied receipt_amount,
                  gcc.concatenated_segments applied_gl_account,
                  ara.gl_date gl_date,
                  ara.apply_date applied_date,
                  trx.trx_number applied_trx_number,
                  trx.trx_date applied_trx_date
  FROM   ar_receivable_applications_all ara,
         ar_cash_receipts_all arc,
         ar_receipt_methods arm,
         hz_parties party,
         hz_cust_accounts cust,
         gl_code_combinations_kfv gcc,
         ra_customer_trx_all trx,
         ar_cash_receipt_history_all acrh,
         ar_batches_all bat,
         hr_operating_units hou
 WHERE       1 = 1
         AND arc.cash_receipt_id = ara.cash_receipt_id(+)
         AND arc.TYPE = 'CASH'
         AND ara.display = 'Y'
         AND ara.application_type = 'CASH'
         AND NVL (ara.confirmed_flag, 'Y') = 'Y'
         AND NVL (arc.confirmed_flag, 'Y') = 'Y'
         AND acrh.cash_receipt_id = arc.cash_receipt_id
         AND acrh.first_posted_record_flag = 'Y'
         AND cust.CUST_ACCOUNT_ID(+) = arc.pay_from_customer
         AND CUST.PARTY_ID = PARTY.PARTY_ID(+)
         AND arc.receipt_method_id = arm.receipt_method_id
         AND bat.batch_id(+) = acrh.batch_id
         AND gcc.code_combination_id = aCRH.ACCOUNT_CODE_COMBINATION_ID
         AND ara.applied_customer_trx_id = trx.customer_trx_id
         AND trx.org_id = hou.organization_id
         AND arc.receipt_number BETWEEN NVL (:p_in_cr_number,
                                             arc.receipt_number)
                                    AND  NVL (:p_in_cr_number_high,
                                              arc.receipt_number)
         AND gcc.segment1 BETWEEN NVL (:p_company_from, segment1)
                              AND  NVL (:p_company_to, segment1)
         AND party.party_name BETWEEN NVL (:p_in_customer_low,
                                           party.party_name)
                                  AND  NVL (:p_in_customer_high,
                                            party.party_name)
         AND bat.name BETWEEN NVL (:p_in_batch_low, bat.name)
                          AND  NVL (:p_in_batch_high, bat.name)
         --         AND arc.deposit_date BETWEEN NVL (:p_in_deposit_date_low,
         --                                           arc.deposit_date)
         --                                  AND  NVL (:p_in_deposit_date_high,
         --                                            arc.deposit_date)
         AND arc.status BETWEEN NVL (:p_in_status_low, arc.status)
                            AND  NVL (:p_in_status_high, arc.status)
         AND ara.gl_date BETWEEN NVL (:p_in_gl_date_low, ara.gl_date)
                             AND  NVL (:p_in_gl_date_high, ara.gl_date)
         AND DECODE (NVL (:p_in_currency, arc.currency_code),
                     'All', arc.currency_code,
                     NVL (:p_in_currency, arc.currency_code)) =
               arc.currency_code
      UNION
         ----- NULL CUSTOMER  ------
/* Formatted on 3/26/2013 12:30:47 PM (QP5 v5.114.809.3010) */
SELECT   gcc.segment1 Company,
         bat.NAME batch_name,
         arc.deposit_date deposit_date,
         NULL customer_name,
         NULL customer_number,
         arc.receipt_number receipt_number,
         arc.receipt_date receipt_date,
         arc.STATUS receipt_status,
         acrh.amount receipt_amount,
         gcc.concatenated_segments applied_gl_account,
         acrh.gl_date gl_date,
         NULL applied_date,
         NULL applied_trx_number,
         NULL applied_trx_date
  FROM   ar_cash_receipts_all arc,
         ar_cash_receipt_history_all acrh,
         ar_batches_all bat,
         gl_code_combinations_kfv gcc,
         ar_receipt_methods arm
 WHERE       1 = 1
         AND ARC.PAY_FROM_CUSTOMER IS NULL
         AND acrh.cash_receipt_id = arc.cash_receipt_id
         AND bat.batch_id(+) = acrh.batch_id
         --         AND arc.receipt_number in('1204298-UNITED TEL','300497-TRIANGLE','1202381-UNITED TEL')
         AND gcc.code_combination_id = aCRH.ACCOUNT_CODE_COMBINATION_ID
         AND arc.receipt_method_id = arm.receipt_method_id
         AND arc.receipt_number BETWEEN NVL (:p_in_cr_number,
                                             arc.receipt_number)
                                    AND  NVL (:p_in_cr_number_high,
                                              arc.receipt_number)
         AND gcc.segment1 BETWEEN NVL (:p_company_from, segment1)
                              AND  NVL (:p_company_to, segment1)
--         AND party.party_name BETWEEN NVL (:p_in_customer_low,
--                                           party.party_name)
--                                  AND  NVL (:p_in_customer_high,
--                                            party.party_name)
         AND bat.name BETWEEN NVL (:p_in_batch_low, bat.name)
                          AND  NVL (:p_in_batch_high, bat.name)
         --         AND arc.deposit_date BETWEEN NVL (:p_in_deposit_date_low,
         --                                           arc.deposit_date)
         --                                  AND  NVL (:p_in_deposit_date_high,
         --                                            arc.deposit_date)
         AND arc.status BETWEEN NVL (:p_in_status_low, arc.status)
                            AND  NVL (:p_in_status_high, arc.status)
         AND acrh.gl_date BETWEEN NVL (:p_in_gl_date_low, acrh.gl_date)
                              AND  NVL (:p_in_gl_date_high, acrh.gl_date)
         AND DECODE (NVL (:p_in_currency, arc.currency_code),
                     'All', arc.currency_code,
                     NVL (:p_in_currency, arc.currency_code)) =
               arc.currency_code
=====================================================================

SELECT   bat.NAME batch_name,
         arc.receipt_number receipt_number,
         acrh.gl_date gl_date,
         arc.deposit_date deposit_date,
         arc.STATUS receipt_status,
         acrh.amount receipt_amount,
--         arC.amount,
         gcc.concatenated_segments applied_gl_account,
         arc.receipt_date receipt_date
  FROM   ar_cash_receipts_all arc,
         ar_cash_receipt_history_all acrh,
         ar_batches_all bat,
         gl_code_combinations_kfv gcc,
         ar_receipt_methods arm
 WHERE       1 = 1
         and ARC.PAY_FROM_CUSTOMER  is NULL
         AND acrh.cash_receipt_id = arc.cash_receipt_id
         AND bat.batch_id(+) = acrh.batch_id
         AND gcc.code_combination_id = aCRH.ACCOUNT_CODE_COMBINATION_ID
         AND arc.receipt_method_id = arm.receipt_method_id
         AND acrh.gl_date BETWEEN NVL (:p_in_gl_date_low, acrh.gl_date)
                           AND  NVL (:p_in_gl_date_high, acrh.gl_date)
         AND gcc.segment1 BETWEEN NVL (:p_company_from, segment1)
                              AND  NVL (:p_company_to, segment1)

1 comment:

  1. Blogs and articles are two prevalent forms of online content that have reshaped the way information is disseminated and consumed in the digital era. VPN With Hulu Blogs are personal websites where individuals share their thoughts.

    ReplyDelete