Monday, 31 October 2011

PO_RECEIPT_TAX_FINAL_QRY

/* Formatted on 17-08-2011 12:57:30 (QP5 v5.115.810.9015) */
  SELECT   hou.name Operting_unit,
           (SELECT   ood.organization_code
              FROM   org_organization_definitions ood
             WHERE   ood.organization_id = rsh.organization_id
                     AND ood.OPERATING_UNIT = hou.organization_id)
              Organization_Code,
           (SELECT   ood.organization_name
              FROM   org_organization_definitions ood
             WHERE   ood.organization_id = rsh.organization_id
                     AND ood.OPERATING_UNIT = hou.organization_id)
              Organization_Name,
           rsh.SHIPMENT_HEADER_ID,
           TO_NUMBER (pha.segment1) po_no,
           TO_NUMBER (rsh.RECEIPT_NUM) Receipt_No,
           plla.SHIPMENT_NUM,
           jir.TAX_LINE_NO,
           jir.TAX_NAME,
           jir.TAX_RATE,
           jir.TAX_TYPE,
           jir.PRECEDENCE_1,
           jir.PRECEDENCE_2,
           jir.PRECEDENCE_3,
           jir.PRECEDENCE_4,
           jir.PRECEDENCE_5,
           jir.CURRENCY,
           jir.MODVAT_FLAG,
           jir.THIRD_PARTY_FLAG,
           jir.TAX_AMOUNT
    FROM   rcv_shipment_headers rsh,
           rcv_shipment_lines rsl,
           ja.ja_in_receipt_tax_lines jir,
           po_headers_all pha,
           po_lines_all pla,
           po_line_locations_all plla,
           hr_operating_units hou
   WHERE       rsh.shipment_header_id = rsl.shipment_header_id
           AND jir.shipment_header_id = rsh.shipment_header_id
           AND rsl.shipment_line_id = jir.shipment_line_id
           AND pha.org_id = pla.org_id
           AND pha.po_header_id = pla.po_header_id
           AND pha.po_header_id = rsl.po_header_id
           AND pha.org_id = pla.org_id
           AND plla.org_id = pla.org_id
           AND pla.po_header_id = plla.po_header_id
           AND pla.po_line_id = plla.po_line_id
           AND pla.po_line_id = rsl.po_line_id
           AND rsl.po_line_location_id = plla.line_location_id
           AND hou.organization_id = pha.org_id
           AND TRUNC (jir.CREATION_DATE) BETWEEN '01-Aug-2011' --AND  '05-APR-2011'
                                             AND  '13-Aug-2011'
           AND HOU.SET_OF_BOOKS_ID=5
ORDER BY   TO_NUMBER (pha.segment1),
           TO_NUMBER (rsh.RECEIPT_NUM),
           plla.SHIPMENT_NUM,
           jir.TAX_LINE_NO

No comments:

Post a Comment