SELECT A.SETID , A.CNTRCT_ID ,A.VERSION_NBR , A.INV_ITEM_ID , E.CATEGORY_CD , A.CNTRCT_LINE_NBR , A.DESCR254_MIXED , A.ITM_ID_VNDR , A.VNDR_CATALOG_ID , A.MFG_ID FROM PS_CNTRCT_LINE A , PS_CNTRCT_HDR D , PS_ITM_CAT_TBL E WHERE D.CNTRCT_PROC_OPT <> 'MFG' AND A.CATEGORY_ID <> ' ' AND A.UNIT_OF_MEASURE <> ' ' AND A.DESCR254_MIXED <> ' ' AND A.LINE_STATUS = 'O' AND D.VERSION_STATUS = 'C' AND A.SETID = D.SETID AND A.CNTRCT_ID = D.CNTRCT_ID AND A.VERSION_NBR = D.VERSION_NBR AND A.ITM_SETID = E.SETID AND A.CATEGORY_ID = E.CATEGORY_ID AND EXISTS ( SELECT 'X' FROM PS_CNTRCT_LINE_UOM B , PS_CNTRCT_LN_SHIP C WHERE B.SETID = A.SETID AND B.CNTRCT_ID = A.CNTRCT_ID AND B.VERSION_NBR = A.VERSION_NBR AND B.CNTRCT_LINE_NBR = A.CNTRCT_LINE_NBR AND C.SETID = A.SETID AND C.CNTRCT_ID = A.CNTRCT_ID AND C.VERSION_NBR = A.VERSION_NBR AND C.CNTRCT_LINE_NBR = A.CNTRCT_LINE_NBR AND B.VNDR_LOC <> ' ' AND C.QTY_SCHED <> 0) AND E.EFFDT = ( SELECT MAX(F.EFFDT) FROM PS_ITM_CAT_TBL F WHERE E.SETID = F.SETID AND E.CATEGORY_TYPE = F.CATEGORY_TYPE AND E.CATEGORY_CD = F.CATEGORY_CD AND E.CATEGORY_ID = F.CATEGORY_ID AND F.EFFDT <= %CurrentDateIn) UNION ALL SELECT A.SETID , A.CNTRCT_ID ,A.VERSION_NBR , A.INV_ITEM_ID , E.CATEGORY_CD , A.CNTRCT_LINE_NBR , A.DESCR254_MIXED , A.ITM_ID_VNDR , A.VNDR_CATALOG_ID , A.MFG_ID FROM PS_CNTRCT_LINE A , PS_CNTRCT_HDR D , PS_ITM_CAT_TBL E WHERE D.CNTRCT_PROC_OPT = 'MFG' AND A.CATEGORY_ID <> ' ' AND A.UNIT_OF_MEASURE <> ' ' AND A.DESCR254_MIXED <> ' ' AND A.LINE_STATUS = 'O' AND D.VERSION_STATUS = 'C' AND A.SETID = D.SETID AND A.CNTRCT_ID = D.CNTRCT_ID AND A.VERSION_NBR = D.VERSION_NBR AND A.ITM_SETID = E.SETID AND A.CATEGORY_ID = E.CATEGORY_ID AND EXISTS ( SELECT 'X' FROM PS_CNTRCT_LINE_UOM B WHERE B.SETID = A.SETID AND B.CNTRCT_ID = A.CNTRCT_ID AND B.VERSION_NBR = A.VERSION_NBR AND B.CNTRCT_LINE_NBR = A.CNTRCT_LINE_NBR) AND E.EFFDT = ( SELECT MAX(F.EFFDT) FROM PS_ITM_CAT_TBL F WHERE E.SETID = F.SETID AND E.CATEGORY_TYPE = F.CATEGORY_TYPE AND E.CATEGORY_CD = F.CATEGORY_CD AND E.CATEGORY_ID = F.CATEGORY_ID AND F.EFFDT <= %CurrentDateIn)
|