select inv.invoice_id,
hou.name operating_unit
,ledger.name company_name
,supp.vendor_name
,inv.invoice_num invoice_number
,loc.address1
,loc.address2
,loc.address3
,loc.city
,loc.state
,loc.county
,loc.country
,loc.postal_code
,chk.doc_sequence_value voucher_number
,chk.check_number check_number
,chk.check_date
,bnkacc.bank_account_num
,bnkacc.bank_account_name
,gcc.concatenated_segments liability_account
,chk.amount Payment_Amount
,aipa.amount amount_paid
from hr_operating_units hou
,gl_ledgers ledger
,ap_invoices_all inv
,ap_suppliers supp
,ap_supplier_sites_all supp_site
,hz_party_sites party_site
,hz_locations loc
,ap_invoice_payments_all aipa
,ap_checks_all chk
,ce_bank_accounts bnkacc
,gl_code_combinations_kfv gcc
where hou.set_of_books_id = ledger.ledger_id
and hou.organization_id = inv.org_id
and inv.vendor_id = supp.vendor_id
and supp.vendor_id = supp_site.vendor_id
and supp_site.party_site_id = party_site.party_site_id(+)
and party_site.location_id = loc.location_id(+)
and inv.invoice_id = aipa.invoice_id
and aipa.check_id = chk.check_id
and supp_site.vendor_site_id = chk.vendor_site_id
and bnkacc.bank_account_name = chk.bank_account_name
AND chk.status_lookup_code <> 'VOIDED'
--and bnkacc.bank_account_num = chk.bank_account_num
and inv.accts_pay_code_combination_id = gcc.code_combination_id
--and inv.invoice_num = 'ABCD12345'
--and chk.check_id = 123456789
--and supp.vendor_name = 'XX_VENDOR'
--and chk.bank_account_name = 'XX BANK ACCOUNT'
and inv.creation_date > '01-JAN-2021'
order by inv.invoice_id
No comments:
Post a Comment