miércoles, 2 de abril de 2014

Query para obtener estado de facturas por interface de Payables


SELECT AII.SOURCE,
       AII.VENDOR_NUM,
       AII.INVOICE_NUM,
       AII.INVOICE_DATE,
       AII.INVOICE_AMOUNT,
       AII.GROUP_ID,
       AII.PO_NUMBER,
       AII.STATUS,
       AIR.PARENT_TABLE,
       AIR.CREATION_DATE,
       AIR.REJECT_LOOKUP_CODE 
  FROM AP.AP_INVOICES_INTERFACE AII
 inner join AP.AP_INVOICE_LINES_INTERFACE AILI
 on AILI.INVOICE_ID =AII.INVOICE_ID
 LEFT OUTER JOIN AP.AP_INTERFACE_REJECTIONS AIR
 ON AIR.PARENT_ID = AII.INVOICE_ID
 or AIR.PARENT_ID =AILI.INVOICE_LINE_ID

 where AII.invoice_num = '&INVOICE_NUMBER'

1 comentario: