[E-Bussiness Suite] Query Invoice Prepayment with Accountability Invoice


Deskripsi
      To display Accountability Invoice based on Invoice Prepayment, you can modified the filter.

Howto
select DISTINCT aia1.invoice_num
                ,pv.VENDOR_NAME
                ,aia1.amount_paid
                ,aia1.DESCRIPTION as Deskripsi_Prepayment
                ,aia1.GL_DATE as GL_Prepayment
                ,aia2.invoice_num as Invoice_PJ
                ,aia2.DESCRIPTION as Deskripsi_PJ
                ,(aida2.AMOUNT * -1) as Amount_PJ
                ,aia2.GL_DATE as GL_PJ
             
from ap_invoices_all aia1
    ,ap_invoice_distributions_all aida1
    ,ap_invoices_all aia2
    ,ap_invoice_distributions_all aida2
    ,po_vendors PV
 
where aia1.INVOICE_TYPE_LOOKUP_CODE = 'PREPAYMENT'
and aia1.GL_DATE >= to_date('01/01/2013','DD/MM/YYYY')
and aia1.GL_DATE <= to_date('31/12/2013','DD/MM/YYYY')
--and aia1.INVOICE_NUM = 'xxx'
--and aia1.VENDOR_ID = 'xxx'
and aia1.INVOICE_ID(+) = aida1.INVOICE_ID
and pv.VENDOR_ID = aia1.VENDOR_ID
and (aida1.REVERSAL_FLAG is null or aida1.REVERSAL_FLAG = 'N')
and aida2.PREPAY_DISTRIBUTION_ID(+) = aida1.INVOICE_DISTRIBUTION_ID
and aia2.INVOICE_ID(+) = aida2.INVOICE_ID
and (aida2.REVERSAL_FLAG is null or aida2.REVERSAL_FLAG = 'N')
--and aia2.vendor_id = 'xxx'
order by to_date(aia1.GL_DATE,'DD/MM/YYYY'),aia1.INVOICE_NUM;

Post a Comment

Harap gunakan bahasa yang baik dan sopan, terima kasih