Wednesday, 5 October 2016

AP Payment Voucher Query

/********************************************** 
    Creation Date : 30 September, 2016
    Purpose       : AP Payment Voucher Query
    Module        : Payable
    Parameters    : Cheque No, Payment Voucher No
                    and Payment Date
    Created By    : Muhammad Waqas Khan
   
*********************************************/
SELECT CHK.DOC_SEQUENCE_VALUE "PAYMENT VOUCHER",
       CHK.CURRENCY_CODE "PAYMENT CURRENCY",
       CHK.CHECK_DATE "PAYMENT DATE",
       CHECK_NUMBER "PAYMENT NO.",
       CHK.FUTURE_PAY_DUE_DATE "CHECK_DATE", --MATURITY DATE
       CHK.PAYMENT_METHOD_CODE "PAYMENT TYPE",
       BNK.BANK_NAME "BANK NAME",
       CHK.BANK_ACCOUNT_NUM "BANK ACCOUNT NO.",
       CHK.VENDOR_NAME "PAID TO",
       CHK.AMOUNT "AMOUNT",
       AIA.INVOICE_NUM "INVOICE NO.",
       AIA.INVOICE_DATE "INVOICE DATE",
       AIA.DESCRIPTION "INVOICE DESCRIPTION",
       AIA.INVOICE_AMOUNT "INVOICE AMOUNT",
       SUPP_BANK.BANK_NAME "PAID TO BANK NAME",
       SUPP_BANK.BANK_ACCOUNT_NUM "PAID TO BANK ACCOUNT NO.",
       CHK.EXCHANGE_RATE CONVERSION_RATE,
       TO_CHAR((NVL(CHK.EXCHANGE_RATE, 1) * CHK.AMOUNT), '9,999.99') FUNCTIONAL_AMOUNT
  FROM AP_INVOICE_PAYMENTS_ALL IPA,
       AP_CHECKS_ALL CHK,
       AP_INVOICES_ALL AIA,
       FND_USER U,
       CE_BANK_ACCOUNTS BNKACC,
       CE_BANKS_V BNK,
       XLE_ENTITY_PROFILES LE,
       (SELECT APS.VENDOR_ID,
               HOP_BANK.ORGANIZATION_NAME BANK_NAME,
               IEBA.BANK_ACCOUNT_NUM
          FROM HZ_PARTIES               HZP,
               AP_SUPPLIERS             APS,
               IBY_EXTERNAL_PAYEES_ALL  HEPA,
               IBY_PMT_INSTR_USES_ALL   IPIUA,
               IBY_EXT_BANK_ACCOUNTS    IEBA,
               HZ_PARTIES               HZP_BANK,
               HZ_ORGANIZATION_PROFILES HOP_BANK
         WHERE HZP.PARTY_ID = APS.PARTY_ID
           AND HZP.PARTY_ID = HEPA.PAYEE_PARTY_ID
           AND HEPA.EXT_PAYEE_ID = IPIUA.EXT_PMT_PARTY_ID(+)
           AND IPIUA.INSTRUMENT_ID = IEBA.EXT_BANK_ACCOUNT_ID(+)
           AND IEBA.BANK_ID = HZP_BANK.PARTY_ID(+)
           AND HOP_BANK.PARTY_ID(+) = HZP_BANK.PARTY_ID
           AND HEPA.SUPPLIER_SITE_ID IS NULL) SUPP_BANK
 WHERE LE.LEGAL_ENTITY_ID = CHK.LEGAL_ENTITY_ID
   AND CHK.CHECK_ID = IPA.CHECK_ID
   AND BNK.BANK_PARTY_ID = BNKACC.BANK_ID
   AND BNKACC.BANK_ACCOUNT_NAME = CHK.BANK_ACCOUNT_NAME
   AND BNKACC.BANK_ACCOUNT_NUM = CHK.BANK_ACCOUNT_NUM
   AND AIA.INVOICE_ID = IPA.INVOICE_ID
   AND AIA.VENDOR_ID = SUPP_BANK.VENDOR_ID(+)
   AND CHK.CREATED_BY = U.USER_ID(+)
   AND CHK.LAST_UPDATED_BY = U.USER_ID(+)
   AND CHK.STATUS_LOOKUP_CODE <> 'VOIDED'
   --AND CHK.CHECK_NUMBER = '329'
      ------ PARAMETERS ----------------
   AND CHK.CHECK_NUMBER = NVL(:P_CHAQUE_NUMBER, CHK.CHECK_NUMBER)
   AND NVL(CHK.DOC_SEQUENCE_VALUE, 0) BETWEEN
       NVL(:P_VOUCHER_NO_FROM, NVL(CHK.DOC_SEQUENCE_VALUE, 0)) AND
       NVL(:P_VOUCHER_NO_TO, NVL(CHK.DOC_SEQUENCE_VALUE, 0))
   AND IPA.ORG_ID = NVL(:P_ORG_ID, IPA.ORG_ID)
   AND CHK.CHECK_DATE BETWEEN NVL(:FROM_DATE, CHK.CHECK_DATE) AND
       NVL(:TO_DATE, CHK.CHECK_DATE)
 ORDER BY CHK.DOC_SEQUENCE_VALUE,
          CHK.CHECK_NUMBER,
          AIA.INVOICE_NUM,
          AIA.INVOICE_DATE


2 comments:

  1. Good articles, Have you heard of LFDS (Le_Meridian Funding Service, Email: lfdsloans@outlook.com --WhatsApp Contact:+1-9893943740--lfdsloans@lemeridianfds.com) is as USA/UK funding service they grant me loan of $95,000.00 to launch my business and I have been paying them annually for two years now and I still have 2 years left although I enjoy working with them because they are genuine Loan lender who can give you any kind of loan.

    ReplyDelete
  2. DEAR APPLICANT,

    We offer Affordable loan at 3% interest rate available for local and international borrowers. We are certified,trustworthy, reliable, efficient, Fast and dynamic and a co-operate financier for real estate and any kinds of business financing,we offer the following:* Personal Loans * Student Loan * Business Loans * Consolidation Loan * Combination Loan* *Home Enhancement* Car Loan *Construction Loan e.t.c

    We are Christian organization founded, people in needs of assistance helps, such as financial help. So, if you go through financial difficulties or you are in any financial mess, and you need funds, to start you need your own business, or you need a loan to pay off your debts or pay your bills, start a nice business, or you will find it difficult, to obtain capital loan from local banks, for the Bible says , "" Anyone who asks, receives Luke 11.10, and who seeks, finds, and who knocks on the door, the door will be opened ", so do not miss this chance, because Jesus is the same yesterday, today, and forever more. Please this is for serious minded and God-fearing people.

    Fill the application form below for further information.

    Full Name:___________
    Sex:________
    Age:______
    Country:__________
    Address___________
    State: ________
    Tel:______
    Occupation: __________
    Monthly Income:___________
    Loan Amount Needed ($) :__________
    Amount in Words:
    Loan Duration:__________
    Pan Card or Voters Id No:__________

    We await your responds

    Regards
    Trust Bridge Financial Service
    E_mail: trustbridgefinancialservice943@yahoo.com

    ReplyDelete

Query to Find Receipt Class and its GL Combinition Query

SELECT ARC.NAME ReceiptClass,        ARC.CREATION_METHOD_CODE Creation_Mehthod,        DECODE (ARC.REMIT_METHOD_CODE,             ...