采购订单明细查询
小于 1 分钟
代码示例
SELECT T0.DocNum ,
T1.LineNum + 1 AS '行号' ,
T0.DocDate ,
T0.DocDueDate AS '交货日期' ,
T0.TaxDate ,
T0.CardCode ,
T0.CardName ,
( CASE WHEN T0.DocStatus = 'C'
AND T0.CANCELED = 'N'
AND T0.DocManClsd = 'N' THEN '已收货'
WHEN T0.DocStatus = 'O' THEN '未请'
WHEN T0.DocStatus = 'C'
AND T0.CANCELED = 'Y' THEN '已取消'
WHEN DocManClsd = 'Y'
AND DocStatus = 'C' THEN '手工关闭'
END ) AS '单据状态' ,
T1.ItemCode ,
T1.Dscription ,
Quantity ,
T1.OpenQty ,
T1.unitMsr ,
T1.PriceAfVAT AS '含税单价' ,
T1.GTotal ,
T1.NumPerMsr * T1.Quantity AS '库存单位数量' ,
t2.InvntryUom ,
t3.WhsName
FROM OPOR T0
INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
LEFT JOIN OITM t2 ON T1.ItemCode = t2.ItemCode
LEFT JOIN OWHS t3 ON t3.WhsCode = T1.WhsCode
SELECT T0.DocNum ,
T1.LineNum + 1 AS '行号' ,
T0.DocDate ,
T0.DocDueDate AS '交货日期' ,
T0.TaxDate ,
T0.CardCode ,
T0.CardName ,
( CASE WHEN T0.DocStatus = 'C'
AND T0.CANCELED = 'N'
AND T0.DocManClsd = 'N' THEN '已收货'
WHEN T0.DocStatus = 'O' THEN '未请'
WHEN T0.DocStatus = 'C'
AND T0.CANCELED = 'Y' THEN '已取消'
WHEN DocManClsd = 'Y'
AND DocStatus = 'C' THEN '手工关闭'
END ) AS '单据状态' ,
T1.ItemCode ,
T1.Dscription ,
Quantity ,
T1.OpenQty ,
T1.unitMsr ,
T1.PriceAfVAT AS '含税单价' ,
T1.GTotal ,
T1.NumPerMsr * T1.Quantity AS '库存单位数量' ,
t2.InvntryUom ,
t3.WhsName
FROM OPOR T0
INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
LEFT JOIN OITM t2 ON T1.ItemCode = t2.ItemCode
LEFT JOIN OWHS t3 ON t3.WhsCode = T1.WhsCode
WHERE ( T0.DocDate >= [%1]
OR [%1] = ''
)
AND ( T0.DocDate <= [%2]
OR [%2] = ''
)