Oracle EBS-SQL (PO-11):检查采购订单退货数.sql

select msi.segment1                                    物料编码,
     --  msi.inventory_item_id return_item_id,
         msi.primary_unit_of_measure                   单位,
         msi.description                                        描述,
         pha.segment1                                      订单号,
         pha.TYPE_LOOKUP_CODE                         类型,
     -- pha.po_header_id,
         pv.vendor_name                             供应商名称,
    --  pv.vendor_id,
     --.po_line_id,
        pla.LINE_NUM                                              行,
   --  pll.LINE_LOCATION_ID,
        pll.quantity                                             行数量,
        rt.QUANTITY                                        交易数量,
    -- rt.TRANSACTION_ID rcv_transacion_id,

   --  rt.SHIPMENT_HEADER_ID,
  --   rt.SHIPMENT_LINE_ID,
  --   rt.DESTINATION_TYPE_CODE,
   --  RT.SUBSTITUTE_UNORDERED_CODE,
       RT.TRANSACTION_TYPE                         交易类型,

 --   RT.PO_REVISION_NUM,
      RT.PO_UNIT_PRICE                                      价格,
      rsh.RECEIPT_NUM                                     收据量,
      rsl.LINE_NUM                                        接据行号,
      RT.SUBINVENTORY                                      子库,
      RT.Transaction_Date                              交易日期 
from po.rcv_transactions               rt,
       po.po_line_locations_all        pll,
       po.Rcv_Shipment_Lines       Rsl,
       po.Rcv_Shipment_headers   rsh,
       po.po_lines_all                    pla,
       po.po_headers_all              pha,
       inv.mtl_system_items_b     msi,
       po.po_vendors                     pv
where pha.PO_HEADER_ID = pla.po_header_id                                       and
       pla.PO_LINE_ID = pll.PO_LINE_ID                                                   and

       pha.VENDOR_ID = pv.VENDOR_ID                                                  and
       pla.item_id = msi.inventory_item_id                                                and
       rt.PO_HEADER_ID = pha.PO_HEADER_ID                                         and
       rt.PO_LINE_ID = pla.PO_LINE_ID                                                    and
       rt.PO_LINE_LOCATION_ID = pll.LINE_LOCATION_ID                         and
       msi.organization_id = X                                                                  and

       trunc(RT.Transaction_Date) >= to_date('20**-01-01','yyyy-mm-dd') and
       trunc(rT.Transaction_Date)  < to_date('20**-01-32','yyyy-mm-dd')   and
       rt.TRANSACTION_TYPE = 'RETURN TO VENDOR'                                and
       RT.SHIPMENT_LINE_ID = RSL.SHIPMENT_LINE_ID                            and
       rsh.SHIPMENT_HEADER_ID = rsl.SHIPMENT_HEADER_ID                   and
       rt.SHIPMENT_HEADER_ID = rsh.SHIPMENT_HEADER_ID

posted on 2014-06-10 15:13  st.sun  阅读(728)  评论(0编辑  收藏  举报

导航