Thursday, 8 November 2012

How to query Payables in Oracle



SELECT
v.vendor_id,
--v.invoice_id,
sum(v.invoice_amount)            Total_Invoice_Amount,
sum(idv.amount*awt.tax_rate/100) Total_Tax_Amount

FROM
Ap_Invoices_All             v,
AP_INVOICE_DISTRIBUTIONS_V idv,
AP_AWT_TAX_RATES_ALL        awt

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

and v.invoice_date between '11-jul-2009' and '31-Jun-2010'
and v.vendor_id='0000'
and v.invoice_type_lookup_code='STANDARD'
group by v.vendor_id;

No comments:

Post a Comment