Test 2

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

SELECT DISTINCT PHA.

ORG_ID ORGANIZATION,

PV.SEGMENT1 VENDOR_CODE, PV.VENDOR_NAME, PVSA.VENDOR_SITE_ID,


PVSA.VENDOR_SITE_CODE,

PHA.SEGMENT1 PO_NUMBER, PRA.RELEASE_NUM, PLLA.SHIPMENT_NUM, PLA.LINE_NUM,


MSI.SEGMENT1 ITEM_CODE, PLA.ITEM_DESCRIPTION, PLA.UNIT_MEAS_LOOKUP_CODE UOM,

PLA.UNIT_PRICE, PLLA.QUANTITY ORDER_QUANTITY, PLLA.QUANTITY_RECEIVED


QUANTITY_RECEIVED, (PLLA.QUANTITY - PLLA.QUANTITY_RECEIVED) PENDING_QUANTITY,

PLLA.NEED_BY_DATE SUPPLY_DATE,

NULL UNLOADING_LOCATION, NULL SUPPLIER_INVOICE_NO, NULL


SUPPLIER_INVOICE_DATE, NULL INVOICE_QUANTITY, NULL BIN_QUANTITY,

NULL TOTAL_AMOUNT, NULL FREIGHT,

(SELECT DISTINCT (NVL(ACTUAL_TAX_RATE,0))

FROM APPS.JAI_TAX_LINES

WHERE JT.ORG_ID = PHA.ORG_ID

AND TRX_ID = PRA.PO_RELEASE_ID

AND ENTITY_CODE IN ('PURCHASE_ORDER','RELEASE')

AND DET_FACTOR_ID = JT.DET_FACTOR_ID

AND TRX_LINE_NUMBER = JT.TRX_LINE_NUMBER

AND TRX_LOC_LINE_ID = PLLA.LINE_LOCATION_ID

AND TAX_RATE_CODE LIKE '%CGST%')CGST_RATE,

NULL CGST_AMOUNT,

(SELECT DISTINCT (NVL(ACTUAL_TAX_RATE,0))

FROM APPS.JAI_TAX_LINES

WHERE JT.ORG_ID = PHA.ORG_ID

AND TRX_ID = PRA.PO_RELEASE_ID

AND ENTITY_CODE IN ('PURCHASE_ORDER','RELEASE')

AND DET_FACTOR_ID = JT.DET_FACTOR_ID

AND TRX_LINE_NUMBER = JT.TRX_LINE_NUMBER

AND TRX_LOC_LINE_ID = PLLA.LINE_LOCATION_ID

AND TAX_RATE_CODE LIKE '%SGST%')SGST_RATE,

NULL SGST_AMOUNT,

(SELECT DISTINCT (NVL(ACTUAL_TAX_RATE,0))


FROM APPS.JAI_TAX_LINES

WHERE JT.ORG_ID = PHA.ORG_ID

AND TRX_ID = PRA.PO_RELEASE_ID

AND ENTITY_CODE IN ('PURCHASE_ORDER','RELEASE')

AND DET_FACTOR_ID = JT.DET_FACTOR_ID

AND TRX_LINE_NUMBER = JT.TRX_LINE_NUMBER

AND TRX_LOC_LINE_ID = PLLA.LINE_LOCATION_ID

AND TAX_RATE_CODE LIKE '%IGST%')IGST_RATE,

NULL IGST_AMOUNT, NULL LINE_TOTAL_AMOUNT, NULL INVOICE_TOTAL_AMOUNT, NULL


VEHICAL_NUMBER

FROM APPS.PO_VENDORS PV, APPS.PO_VENDOR_SITES_All PVSA, APPS.PO_HEADERS_ALL PHA,


APPS.PO_RELEASES_ALL PRA, APPS.PO_LINE_LOCATIONS_ALL PLLA, APPS.PO_LINES_ALL PLA,

APPS.MTL_SYSTEM_ITEMS_B MSI, APPS.JAI_TAX_LINES JT

WHERE PV.VENDOR_ID = PVSA.VENDOR_ID

AND PV.VENDOR_ID = PHA.VENDOR_ID

AND PHA.PO_HEADER_ID = PRA.PO_HEADER_ID

AND PHA.PO_HEADER_ID = PLLA.PO_HEADER_ID

AND PHA.PO_HEADER_ID = PLA.PO_HEADER_ID

AND PRA.PO_HEADER_ID = PLLA.PO_HEADER_ID

AND PRA.PO_RELEASE_ID = PLLA.PO_RELEASE_ID

AND PLA.PO_LINE_ID = PLLA.PO_LINE_ID

AND PLA.ITEM_ID = MSI.INVENTORY_ITEM_ID

AND PHA.ORG_ID = MSI.ORGANIZATION_ID

AND JT.TRX_ID = PRA.PO_RELEASE_ID

AND JT.TRX_LOC_LINE_ID = PLLA.LINE_LOCATION_ID

AND PHA.AUTHORIZATION_STATUS = 'APPROVED'

AND PRA.CLOSED_CODE IN ('OPEN')

AND PHA.ORG_ID = :ORG_ID

ORDER BY PLLA.NEED_BY_DATE, PRA.RELEASE_NUM DESC

You might also like