cancel
Showing results for 
Search instead for 
Did you mean: 

Purchase Order Alerts-Sort By Group

harsha_r
Newcomer
0 Kudos
137

Dear Friends

Any one help me to modify flowing query for sort out based on supplier group called '' Import vendor'' for po alert management .

SELECT T0."DocNum", T2."CardCode", T2."CardName", T3."U_NAME", T1."ItemCode", T1."Dscription", T1.[OcrCode] AS "Cost Center" ,T4.WhsCode,T4.WhsName,T1."Quantity", T0.[CreateDate] ,T0.[DocTime]
FROM OPOR T0
INNER JOIN DLN1 T1 ON T0."DocEntry" = T1."DocEntry"
INNER JOIN OCRD T2 ON T0."CardCode" = T2."CardCode"
INNER JOIN OUSR T3 ON T0."UserSign" = T3."USERID"
INNER JOIN OWHS T4 ON T4.WhsCode = T1.WhsCode
WHERE CAST(T0."CreateDate" AS DATE) = CAST(GETDATE() AS DATE)
AND CASE WHEN T0."DocTime" < '999' THEN LEFT(T0."DocTime",1) ELSE LEFT(T0."DocTime",2) END = DATEPART(HOUR, DateAdd(MINUTE,-1,Getdate()))
AND RIGHT(T0."DocTime",2) = DATEPART(MINUTE, DateAdd(MINUTE,-1,Getdate()))

Accepted Solutions (0)

Answers (0)