You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Select CASE WHEN (ISNULL(SUM(AA.Quantidade),0)) <0 THEN 0 ELSE ISNULL(SUM(AA.Quantidade),0) END as'Empenho MI', AA.DocEntryAS'N° Pedido', AA.ItemCodeas'Cod. Item', AA.BatchNumas'N° Lote'FROM
FROM IBT1 INNER JOIN RDR1 ONRDR1.DocEntry=IBT1.BsDocEntryANDRDR1.LineNum=IBT1.BsDocLine
INNER JOIN ORDR ONRDR1.DocEntry=ORDR.DocEntry
WHEREIBT1.BsDocTypeIN(17) and Direction =1ANDIBT1.BsDocEntryIN (SELECT DocEntry FROM OINV WHERE CANCELED <>'Y') ANDRDR1.LineStatus='O'ANDRDR1.WhsCode='500'
--AND IBT1.BsDocEntry = '12162' and IBT1.ItemCode = 'PA.01.03.0097' and IBT1.BatchNum = '38599'
GROUP BYIBT1.ItemCode, IBT1.BatchNum, IBT1.BsDocEntry
FROM IBT1 INNER JOIN RDR1 ONRDR1.DocEntry=IBT1.BaseEntryANDRDR1.LineNum=IBT1.BaseLinNum
INNER JOIN ORDR ONORDR.DocEntry=RDR1.DocEntry
WHEREIBT1.BaseTypeIN(17) and Direction =2ANDIBT1.BaseEntryIN (SELECT DocEntry FROM OINV WHERE CANCELED <>'Y') ANDRDR1.LineStatus='O'ANDRDR1.WhsCode='500'
--and IBT1.BaseEntry = '12162' and IBT1.ItemCode = 'PA.01.03.0097' and IBT1.BatchNum = '38599'
GROUP BYIBT1.ItemCode, IBT1.BatchNum, IBT1.BaseEntry
) AA GROUP BYAA.ItemCode, AA.BatchNum, AA.DocEntry