采购申请请购单报表
小于 1 分钟
代码示例
SELECT T0.[DocNum], T0.[Requester] AS '申请者', T0.[TaxDate], T1.[ItemCode], T1.[Dscription]
, T1.[UseBaseUn] AS '单位', T1.[Quantity], T1.[PQTReqDate] AS '需求日期', T1.[OpenQty] AS '未清数量', TS.[Quantity] AS '采购订单量'
, TS.[DocStatus] AS '订单状态', TS.[CardName] AS '供应商'
FROM OPRQ T0
INNER JOIN PRQ1 T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode]
INNER JOIN OITB T3 ON T3.[ItmsGrpCod] = T2.[ItmsGrpCod]
LEFT JOIN (
SELECT T0.[DocStatus], T0.[CardName], T1.[Quantity], T1.[BaseEntry], T1.[BaseLine]
FROM OPOR T0
INNER JOIN POR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
) TS
ON TS.[BaseEntry] = T0.docentry
AND TS.[BaseLine] = T1.[LineNum]
WHERE (T1.[ItemCode] >= '[%0]'
OR '[%0]' = '')
AND (T1.[ItemCode] <= '[%1]'
OR '[%1]' = '')
AND (T0.[DocDate] >= '[%4]'
OR '[%4]' = '')
AND (T0.[DocDate] <= '[%11]'
OR '[%11]' = '')
AND (T0.[DocStatus] = '[%5]'
OR '[%5]' = '')
AND (T3.[ItmsGrpNam] = '[%6]'
OR '[%6]' = '')
AND (T0.[Requester] = '[%7]'
OR '[%7]' = '')
AND (T0.[DOCNUM] = [%10]
OR [%10] = '')
ORDER BY T0.[DocNum] DESC
复制
本文档使用 顶想云 构建