Monday, 12 November 2012

Relationship between Invoice and Payments, Taxes, Checks


SELECT
v.vendor_id,
v.invoice_id,
v.invoice_amount,
p.amount                PaymentAmount,
idv.amount*awt.tax_rate/100 Tax_amount,
c.amount                CheckAmount,
c.check_id              CheckID

FROM
AP_INVOICES_All                v,
AP_INVOICE_DISTRIBUTIONS_V    idv,
AP_AWT_TAX_RATES_ALL          awt,
Ap_CHECKS_All                 c,
AP_INVOICE_PAYMENTS_ALL       p


WHERE
         awt.tax_name(+)=idv.awt_group_name
and      c.check_id=p.check_id
and      v.invoice_id=p.invoice_id
and      v.invoice_id=idv.invoice_id

and v.invoice_date between '1-jan-2009' and '30-jan-2010'
and v.vendor_id='0000'
and v.invoice_type_lookup_code='STANDARD'

No comments:

Post a Comment