跳至主要內容

送货单格式

五六零网校大约 1 分钟

效果图

销售
销售

示例代码

SELECT N'送货单号: ', convert(nvarchar(20), T0.[DocNum])
	, NULL, NULL, NULL, NULL, NULL
	, NULL, NULL
FROM ODLN T0
WHERE T0.[DocNum] = '[%1]'
UNION ALL
SELECT N'业务伙伴目录编号', N'业务伙伴描述', N'客户订单号', N'数量', N'单位'
	, N'净重/KG', N'毛重/KG', N'总箱数', N'备注'
UNION ALL
SELECT T1.[SubCatNum], T1.[Dscription], T1.[U_KHDDH], CAST(T1.[Quantity] AS nvarchar(max)), T1.[unitMsr]
	, T1.[U_JZ], T1.[U_mz], T1.[U_XHorZXS], T1.[U_remark]
FROM ODLN T0
	INNER JOIN DLN1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE T0.[DocNum] = '[%1]'
UNION ALL
SELECT N'箱数 '
	, convert(nvarchar(20), SUM(CAST(ISNULL(T1.[U_XHorZXS], 0) AS int)))
	, NULL, NULL, NULL, NULL, NULL
	, NULL, NULL
FROM ODLN T0
	INNER JOIN DLN1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE T0.[DocNum] = '[%1]'
UNION ALL
SELECT N'合计数量 '
	, convert(nvarchar(20), SUM(T1.[Quantity]))
	, NULL, NULL, NULL, NULL, NULL
	, NULL, NULL
FROM ODLN T0
	INNER JOIN DLN1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE T0.[DocNum] = '[%1]'
UNION ALL
SELECT N'合计净重/KG '
	, convert(nvarchar(20), SUM(CAST(ISNULL(T1.[U_JZ], 0) AS int)))
	, NULL, NULL, NULL, NULL, NULL
	, NULL, NULL
FROM ODLN T0
	INNER JOIN DLN1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE T0.[DocNum] = '[%1]'
UNION ALL
SELECT N'合计净重/KG '
	, convert(nvarchar(20), SUM(CAST(ISNULL(T1.[U_MZ], 0) AS numeric(19, 6))))
	, NULL, NULL, NULL, NULL, NULL
	, NULL, NULL
FROM ODLN T0
	INNER JOIN DLN1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE T0.[DocNum] = '[%1]'