Query to extract AP ( Payables ) owed amount based on supplier

 select 

aia.invoice_num ,

ap.vendor_name,

apsa.amount_remaining unpaid_amount,

aipa.AMOUNT paid_amount,

ac.check_number document_number

from 

ap_suppliers ap,

ap_invoices_all aia,

ap_payment_schedules_all apsa,

ap_invoice_payments_all aipa,

ap_checks_all          ac

where 1=1 

and apsa.invoice_id=aia.invoice_id

and aipa.invoice_id(+)=aia.invoice_id

and aipa.check_id = ac.check_id(+)

and aia.vendor_id=ap.vendor_id 

AND aia.payment_status_flag in ('N','P')

AND apsa.amount_remaining != 0 and

aia.vendor_id = :vendor_id 

and aia.PAYMENT_STATUS_FLAG in ('N','P')

and aia.CANCELLED_DATE is null

Comments

Popular posts from this blog

opaque schema xsd (standard file used in OIC)

DOCUMENTATION ON SANDBOX and PERSONALIZATION

SQL,PLSQL interview practice and DSA patterns