SELECT
aia.invoice_num
, pv.vendor_name
, pa.segment1 Project_Number
, ph.segment1 PO_number
, aida.description
, aia.SOURCE
, glcc.CONCATENATED_SEGMENTS Account
, TRUNC (aida.accounting_date)
, aia.invoice_amount
, aida.amount dist_amount
, aida.period_name
, aia.pay_group_lookup_code
, aida.posted_flag
FROM ap_invoices_all aia,
ap_invoice_distributions_all aida,
gl_code_combinations_kfv glcc,
ap_suppliers pv,
po_headers_all ph,
po_distributions_all pd,
pa_projects_all pa
WHERE aia.invoice_id = aida.invoice_id
AND pv.vendor_id = aia.vendor_id
AND pa.project_id = aida.project_id
AND pd.po_header_id = ph.po_header_id(+)
AND aida.po_distribution_id = pd.po_distribution_id(+)
AND aida.DIST_CODE_COMBINATION_ID = glcc.code_combination_id
AND aia.invoice_num = NVL (:p_inv_num, aia.invoice_num)
AND glcc.segment1 = Nvl(:P_COMPANY,glcc.segment1)
AND TRUNC (aida.accounting_date) BETWEEN NVL (:p_from_date,
TRUNC (aida.accounting_date)
)
AND NVL (:p_to_date,
TRUNC (aida.accounting_date)
)
AND pa.segment1 BETWEEN nvl(:P_PROJECT_NUMBER_FROM,pa.segment1 ) and nvl(:P_PROJECT_NUMBER_TO,pa.segment1 )----Added by Nagaraju 17-may-2007
AND pv.vendor_id =nvl(:P_VENDOR_ID ,pv.vendor_id)
aia.invoice_num
, pv.vendor_name
, pa.segment1 Project_Number
, ph.segment1 PO_number
, aida.description
, aia.SOURCE
, glcc.CONCATENATED_SEGMENTS Account
, TRUNC (aida.accounting_date)
, aia.invoice_amount
, aida.amount dist_amount
, aida.period_name
, aia.pay_group_lookup_code
, aida.posted_flag
FROM ap_invoices_all aia,
ap_invoice_distributions_all aida,
gl_code_combinations_kfv glcc,
ap_suppliers pv,
po_headers_all ph,
po_distributions_all pd,
pa_projects_all pa
WHERE aia.invoice_id = aida.invoice_id
AND pv.vendor_id = aia.vendor_id
AND pa.project_id = aida.project_id
AND pd.po_header_id = ph.po_header_id(+)
AND aida.po_distribution_id = pd.po_distribution_id(+)
AND aida.DIST_CODE_COMBINATION_ID = glcc.code_combination_id
AND aia.invoice_num = NVL (:p_inv_num, aia.invoice_num)
AND glcc.segment1 = Nvl(:P_COMPANY,glcc.segment1)
AND TRUNC (aida.accounting_date) BETWEEN NVL (:p_from_date,
TRUNC (aida.accounting_date)
)
AND NVL (:p_to_date,
TRUNC (aida.accounting_date)
)
AND pa.segment1 BETWEEN nvl(:P_PROJECT_NUMBER_FROM,pa.segment1 ) and nvl(:P_PROJECT_NUMBER_TO,pa.segment1 )----Added by Nagaraju 17-may-2007
AND pv.vendor_id =nvl(:P_VENDOR_ID ,pv.vendor_id)
No comments:
Post a Comment