SELECT
sum(rcvt.quantity) 接收事务处理汇总数--已排除退货
--rsh.receipt_num 收据号,
--pov.vendor_name 供应商名称,
--poh.segment1 采购订单,
--pol.line_num 订单行,
--PTL.LINE_TYPE 行类型,
--msi.segment1 物料编码,
--msi.description 物料描述,
--rcvt.unit_of_measure 计量单位,
--rcvt.quantity 数量,
--rcvt.transaction_date 处理日期,
--rcvt.subinventory 接收子库,
--mil.SEGMENT1 货位,
--DECODE(rcvt.transaction_type,'REJECT','拒绝','RETURN TO RECEIVING','退回至接收','DELIVER','交货','RECEIVE','接收','ACCEPT','接受','TRANSFER','转移','RETURN TO VENDOR','退回至供应商') 入库类型,
--rcvt.comments 备注,
--RCVT.RMA_REFERENCE RMA编号,
--RSH.BILL_OF_LADING 提单号,
--MTR.REASON_NAME 原因名称,
--MTR.DESCRIPTION 原因描述
FROM po.rcv_transactions rcvt
/*,po.rcv_shipment_headers rsh,
po.po_headers_all poh,
po.po_lines_all pol,
INV.MTL_TRANSACTION_REASONS MTR,
inv.mtl_system_items_b msi,
inv.MTL_ITEM_LOCATIONS mil,
po.po_vendors pov,
PO.PO_LINE_TYPES_TL PTL*/
WHERE rcvt.organization_id = X
/*AND rcvt.shipment_header_id = rsh.shipment_header_id
AND poh.po_header_id = rcvt.po_header_id
AND pol.po_line_id = rcvt.po_line_id
AND msi.organization_id = X
AND pol.item_id = msi.inventory_item_id
AND mil.inventory_location_id(+) = rcvt.locator_id
AND rsh.vendor_id = pov.vendor_id
AND rcvt.transaction_type in ('RECEIVE','RETURN TO VENDOR')
AND PTL.LANGUAGE = 'ZHS' AND PTL.LINE_TYPE_ID = POL.LINE_TYPE_ID
AND RCVT.REASON_ID=MTR.REASON_ID(+) */
AND trunc(rcvt.transaction_date) BETWEEN to_date('20**-01-01','yyyy-mm-dd') AND to_date('20**-01-31','yyyy-mm-dd') --在此输入时间范围