Vous êtes sur la page 1sur 2

SELECT distinct pv.vendor_name suplier_name, rt.

transaction_type,
pvs.address_line1 supp_addr1,
pvs.address_line2 supp_addr2,
pvs.address_line3 supp_addr3,
pvs.city supp_city,
pvs.state supp_state,
pvs.zip supp_zip,
poh.segment1 po_number,
poh.creation_date po_creation_date,
poh.agent_id po_requester,
pap.full_name buyer,
rsh.receipt_num grn_number,
rsh.shipment_num shipment_number,
rsh.creation_date grn_date,
rsh.attribute1,
rsh.attribute2,
rsh.attribute3,
rsh.attribute4,
pol.unit_meas_lookup_code uom,
/*DECODE (pol.purchase_basis,
'SERVICES', pol.UNIT_PRICE,
pol.quantity
) po_line_qty,*/
DECODE (pol.line_type_id,
1020, pol.UNIT_PRICE,
pol.quantity
) po_line_qty,
/*DECODE (pol.purchase_basis,
'SERVICES', 1,
pol.UNIT_PRICE
) po_line_price,*/
DECODE (pol.line_type_id,
1020, pol.quantity,
pol.UNIT_PRICE
) po_line_price,
--rt.QUANTITY rcv_qty,
DECODE (pol.line_type_id,
1020, pol.UNIT_PRICE,
rt.QUANTITY
) rcv_qty,
(nvl(pol.UNIT_PRICE, 1) * rt.QUANTITY) tot_amount,
rt.organization_id,
pol.item_id,
pol.po_line_id,
pol.po_header_id,
ood.organization_name receiver_id,
hla.location_code LOCATION,
po_inq_sv.get_person_name (rsh.employee_id) receiver_name,
DECODE (pol.purchase_basis,
'GOODS', 'GOODS RECEIPT NOTE',
'SERVICES', 'WORK CONFIRMATION'
) header
, (select user_name from fnd_user where 1=1 and user_id = rsh.created_by)
created_by
, rsh.creation_date
, (select user_name from fnd_user where 1=1 and user_id =
rsh.last_updated_by) update_by
, rsh.last_update_date
FROM po_vendors pv,
po_vendor_sites_all pvs,
po_headers_all poh,
po_lines_all pol,
per_all_people_f pap,
rcv_shipment_headers rsh,
rcv_transactions rt,
org_organization_definitions ood,
hr_locations_all hla
WHERE poh.po_header_id = pol.po_header_id
AND pv.vendor_id = pvs.vendor_id
AND poh.vendor_id = pv.vendor_id
AND poh.vendor_site_id = pvs.vendor_site_id
AND poh.agent_id = pap.person_id
AND poh.po_header_id = rt.po_header_id
AND pol.po_line_id = rt.po_line_id
AND rsh.shipment_header_id = rt.shipment_header_id
AND rt.organization_id = ood.organization_id
-- AND ood.organization_code = NVL (:p_inv_org, ood.organization_code)
AND poh.ship_to_location_id = hla.location_id
AND rt.transaction_type = 'DELIVER'
AND ood.organization_code = NVL (:p_inv_org, ood.organization_code)
AND rsh.receipt_num BETWEEN NVL (:p_from_rcpt_num, rsh.receipt_num) AND NVL
(:p_to_rcpt_num, rsh.receipt_num)
and rt.INTERFACE_TRANSACTION_ID not in ('61171','61174','61177')
ORDER BY rsh.receipt_num

Vous aimerez peut-être aussi