Monday, 31 October 2011

po_loc_tax_details_v1

/* Formatted on 10-08-2011 15:17:46 (QP5 v5.115.810.9015) */
  SELECT   po.po_header_id,
           po.PO_LINE_ID,
           (SELECT   TO_NUMBER (poh.segment1)
              FROM   po_headers_all poh
             WHERE   poh.po_header_id = po.po_header_id)
              "PO NO",
           (SELECT   LINE_NUM
              FROM   po_lines_All
             WHERE   PO_LINE_ID = po.PO_LINE_ID)
              "Line No",
           tax.tax_id,
           tax.TAX_NAME,
           po.TAX_TYPE,
           tax.TAX_RATE,
           po.TAX_LINE_NO,
           po.PRECEDENCE_1,
           po.PRECEDENCE_2,
           po.PRECEDENCE_3,
           po.PRECEDENCE_4,
           po.PRECEDENCE_5,
           po.TAX_AMOUNT
    FROM   JA_IN_PO_LINE_LOCATION_TAXES po, JA_IN_TAX_CODES tax
   WHERE   po.TAX_ID = tax.TAX_ID
           AND po.PO_HEADER_ID IN
                    (SELECT   DISTINCT pha.po_header_id
                       FROM   PO_HEADERS_ALL PHA,
                              PO_VENDORS PV,
                              PO_VENDOR_SITES_ALL PVS,
                              HR_LOCATIONS H1,
                              PER_ALL_PEOPLE_F ppf,
                              org_organization_definitions ood
                      WHERE       PV.VENDOR_ID(+) = PHA.VENDOR_ID
                              AND PVS.VENDOR_SITE_ID(+) = PHA.VENDOR_SITE_ID
                              AND H1.LOCATION_ID(+) = PHA.SHIP_TO_LOCATION_ID
                              AND ppf.person_id(+) = PHA.AGENT_ID
                              AND pha.org_id = ood.operating_unit
                              AND TRUNC (pha.creation_date) BETWEEN '01-JUL-2011'
                                                                AND  '31-JUL-2011'
                              AND ood.set_of_books_id = 5)
ORDER BY   po.PO_HEADER_ID, po.PO_LINE_ID, po.TAX_LINE_NO

No comments:

Post a Comment