Oracle Ebs-sql (PO-16): Check purchase order fulfillment statistics. SQL

Source: Internet
Author: User

Select
E.full_name Buyer,
SUM (plla.quantity-plla.quantity_cancelled) Order quantity,
Sum (Plla. quantity_received) to complete the quantity,
Round (SUM (Plla). quantity_received) *100/sum (plla.quantity-plla.quantity_cancelled), 2) | | % ' percent complete
From
PO. Po_agents PA,
PO. Po_headers_all PHA,
PO. Po_lines_all PLA,
PO. Po_line_locations_all Plla,
PO. Po_vendors PV,
hr. Per_all_people_f E,
Inv.mtl_system_items_b MSI
where
pha.org_id = X
and (PHA. po_header_id = pla. PO_HEADER_ID)
and (PLA. Po_line_id=plla. PO_LINE_ID)
and (PHA. Agent_id=pa. AGENT_ID)
and (pha.org_id=pla.org_id)
and (msi.inventory_item_id = pla.item_id)
and (msi.organization_id in (x, y))
and (msi.organization_id = plla.ship_to_organization_id)
and (PHA. VENDOR_ID=PV. VENDOR_ID)
and (pha.agent_id=e.person_id (+)))
and NVL (PHA. Approved_flag, ' N ') = ' Y '
and NVL (Plla. Approved_flag, ' N ') = ' Y '
and NVL (PHA. Cancel_flag, ' n ') = ' n '
and NVL (PLA. Cancel_flag, ' n ') = ' n '
and NVL (Plla. Cancel_flag, ' n ') = ' n '
and Pha.type_lookup_code = ' standard '
and NVL (plla.need_by_date,plla.promised_date) between
To_date (' 20**-01-01 ', ' yyyy-mm-dd ') and to_date (' 20**-01-31 ', ' yyyy-mm-dd ')
GROUP BY
E.full_name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.