跳至主要內容

未清销售订单明细表

五六零网校小于 1 分钟

示例代码

SELECT T0.[DocNum], T0.[CardName], T0.[NumAtCard], T0.[DocDate], T0.[DocDueDate]
	, T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[OpenQty], T1.Delivrdqty
	, (
		SELECT t11.cardname
		FROM ocrd t11
			INNER JOIN oitm t12 ON t12.cardcode = t11.cardcode
		WHERE t12.itemcode = t1.itemcode
	) AS '首选供应商'
FROM ORDR T0
	INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
	INNER JOIN OITM T3 ON T1.[ItemCode] = T3.[ItemCode]
WHERE (t0.cardname = '[%0]'
		OR '[%0]' = '')
	AND  T0.[DocDate] >= [%1]
	AND  T0.[DocDate] <= '[%2]'
	AND T0.[CANCELED] = 'N'
	AND T0.[DocStatus] = 'O'
ORDER BY T0.[DocNum] DESC