采购收货单已对账未开票查询
小于 1 分钟
--1. 在营销单据增加自定义字段:是否对账 代码:U_SFDZ --2. 是否对账字段默认设置为N --3. 采购人员对账后需要更新该字段为Y
代码示例
SELECT T0.[Docentry] as'单据编号', T0.[DocDate], T0.[CardCode], T0.[CardName], T1.[ItemCode]
, T1.[Dscription], T4.[SlpName] AS 采购员, T1.[UseBaseUn], T1.[Quantity], T1.[Price]
, T1.[VatPrcnt], T1.[DiscPrcnt], T1.[LineTotal], T0.[DocDate], T0.[DocStatus]
, T0.[Comments], T1.[WhsCode], T1.[OpenQty] AS'未开票'
FROM OPDN T0
INNER JOIN PDN1 T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode]
INNER JOIN OITB T3 ON T2.[ItmsGrpCod] = T3.[ItmsGrpCod]
INNER JOIN OSLP T4 ON T0.[SlpCode] = T4.[SlpCode]
WHERE T0.[DocDate]>=[%0] AND T0.[DocDate]<=[%1] AND T0.[U_SFDZ]='Y' AND T1.[OpenQty] >0
ORDER BY T0.[Docentry] DESC