Sunday, 28 April 2013

QUERY TO FIND THE ISO ORDER AGAINST SHIP DISCREPANCY QTY

SELECT   (SELECT   nvl(SUM (quantity),0)
            FROM   rcv_shipment_headers rsh,
                   rcv_shipment_lines rsl,
                   rcv_transactions rt
           WHERE       rt.shipment_header_id = rsh.shipment_header_id
                   AND rsh.shipment_header_id = rsl.shipment_header_id
                   AND rt.shipment_line_id = rsl.shipment_line_id
                   AND rsh.shipment_num = :shipment_num
                   AND rt.transaction_type = 'RECEIVE')
            rcv_qty,                           /* rcv transaction interface */
         (SELECT   nvl(SUM (quantity),0)
            FROM   rcv_transactions_interface rt, rcv_shipment_headers rsh
           WHERE   rsh.shipment_header_id = rt.shipment_header_id
                   AND rsh.shipment_num = :shipment_num)
            interface_qty,
         (SELECT   NVL (SUM (SHIPPED_QUANTITY), 0)
            FROM   wsh_delivery_details wdd, wsh_delivery_assignments wda
           WHERE       wdd.delivery_detail_id = wda.delivery_detail_id
                   AND wdd.released_status = 'C'
                   AND wdd.INV_INTERFACED_FLAG = 'Y'
                   AND to_char(wda.delivery_id) =:shipment_num)
            order_qty
  FROM   DUAL

No comments:

Post a Comment