Saturday, 21 January 2017

Invoice Payment Status Query

http://aporaclepayables.blogspot.com/2017/01/invoice-payment-status-query.html

select aia.DOC_SEQUENCE_VALUE,aia.INVOICE_NUM,
       aia.DESCRIPTION,
       aia.GL_DATE,
       aia.INVOICE_DATE,
       aia.invoice_amount,
     -- NVL(ai.AMOUNT_REMAINING,aia.AMOUNT_PAID) Total_Disp,
     coalesce(ai.AMOUNT_REMAINING,aia.amount_paid, aia.invoice_amount) Total_Disp,
  -- decode (ai.AMOUNT_REMAINING, null,aia.AMOUNT_PAID, null, aia.INVOICE_AMOUNT),
  aia.payment_status,
       al.SEGMENT1 Supplier_number,
       al.VENDOR_NAME,
       ala.VENDOR_SITE_CODE
  from ap_invoices_V aia, ap_suppliers al, ap_supplier_sites_all ala, ap_invoices_ready_to_pay_v ai
 where aia.VENDOR_ID = al.VENDOR_ID
   and aia.VENDOR_SITE_ID = ala.VENDOR_SITE_ID
   and aia.ORG_ID = ala.ORG_ID
   and ai.INVOICE_ID(+)=aia.INVOICE_ID
   and ai.ORG_ID(+)=aia.ORG_ID
   and aia.gl_date between '01-JUL-2016' and '31-DEC-2016'   --Date Paramteres
 

No comments:

Post a Comment