0% found this document useful (0 votes)
13 views

AP Invoice With Hold Details Query

Uploaded by

vkadavul
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

AP Invoice With Hold Details Query

Uploaded by

vkadavul
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

select

trading_partner,
batch_name,
invoice_num,
vou_number,
PO_NUMBER,
TERM,
Invoice_date,
due_date,
gross_amount,
amount_remaining,
hold_reason,
HOLD_DATE,
round(sysdate-hold_date,0) hold_days
from
(
SELECT --distinct ---pda.po_distribution_id,
---DISTINCT
pv.vendor_name trading_partner,
aba.batch_name,
ai.invoice_num,
ai.DOC_SEQUENCE_VALUE vou_number,
ph.segment1 PO_NUMBER,
ATT.NAME TERM,
ai.Invoice_date,
aps.due_date,
aps.gross_amount,aps.amount_remaining,
aha.hold_reason,
MAX (TRUNC (aha.hold_date)) HOLD_DATE
-- MAX (TRUNC (aha.last_update_date)) Hold_Update_date,
FROM AP_holds_all aha,
po_line_locations_all pll,
PO_HEADERS_ALL ph,
PO_LINES_ALL PL,
PO_DISTRIBUTIONS_ALL pda,
PO_VENDORS pv,
AP_invoices_all ai,
ap_payment_schedules_all aps,
ap_terms_tl att,
ap_batches_all aba
--AP_INVOICE_DISTRIBUTIONS_ALL aida
WHERE pll.line_location_id = aha.line_location_id
--AND AHa.RELEASE_LOOKUP_CODE IS NULL
AND PLL.PO_LINE_ID = PL.PO_LINE_ID(+)
AND pda.po_header_id = pl.po_header_id
AND pda.po_header_id = ph.po_header_id
AND ph.po_header_id = pl.po_header_id
and pda.po_line_id = pl.po_line_id
--AND pda.po_distribution_id(+) = aida.po_distribution_id
AND ai.invoice_id = aha.Invoice_id
AND pv.vendor_id = ai.vendor_id
AND ai.invoice_id = aps.invoice_id
and ai.terms_id = att.term_id
and att.language = 'US'
and ai.batch_id = aba.batch_id
and aha.org_id in ( :1)
AND ai.invoice_num in (:2 )
--and aha.hold_lookup_code = 'QTY ORD'
group by
pv.vendor_name,
aba.batch_name,
ai.invoice_num,
ai.DOC_SEQUENCE_VALUE,
ph.segment1,
att.name,
ai.Invoice_date,
aps.due_date,
aps.gross_amount,
aps.amount_remaining,
aha.hold_reason
)

You might also like