跳至主要內容

已创建单据数量统计

五六零网校大约 6 分钟

已创建单据数量统计

SELECT N'今日新增' AS '分类', T0.[销售订单], T1.[交货], T2.[退货], T3.[预收款申请]
	, T4.[应收发票], T5.[应收贷项凭证], T6.[收款单], T7.[采购申请], T8.[采购订单]
	, T9.[采购收货], T10.[采购退货], T11.[预付款申请], T12.[应付发票], T13.[应付贷项凭证]
	, T14.[收款单], T15.[生产订单], T16.[生产发料], T17.[生产收货], T18.[库存发货]
	, T19.[库存收货], T20.[库存转储请求], T21.[库存转储], T22.[物料主数据], T23.[物料清单BOM]
FROM (
	SELECT COUNT(T0.[DocNum]) AS '销售订单'
	FROM ORDR T0
	WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
) T0, (
		SELECT COUNT(T0.[DocNum]) AS '交货'
		FROM ODLN T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T1, (
		SELECT COUNT(T0.[DocNum]) AS '退货'
		FROM ORDN T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T2, (
		SELECT COUNT(T0.[DocNum]) AS '预收款申请'
		FROM ODPI T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T3, (
		SELECT COUNT(T0.[DocNum]) AS '应收发票'
		FROM OINV T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T4, (
		SELECT COUNT(T0.[DocNum]) AS '应收贷项凭证'
		FROM ORIN T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T5, (
		SELECT COUNT(T0.[DocNum]) AS '收款单'
		FROM ORCT T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T6, (
		SELECT COUNT(T0.[DocNum]) AS '采购申请'
		FROM OPRQ T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T7, (
		SELECT COUNT(T0.[DocNum]) AS '采购订单'
		FROM OPOR T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T8, (
		SELECT COUNT(T0.[DocNum]) AS '采购收货'
		FROM OPDN T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T9, (
		SELECT COUNT(T0.[DocNum]) AS '采购退货'
		FROM ORPD T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T10, (
		SELECT COUNT(T0.[DocNum]) AS '预付款申请'
		FROM ODPO T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T11, (
		SELECT COUNT(T0.[DocNum]) AS '应付发票'
		FROM OPCH T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T12, (
		SELECT COUNT(T0.[DocNum]) AS '应付贷项凭证'
		FROM ORPC T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T13, (
		SELECT COUNT(T0.[DocNum]) AS '收款单'
		FROM OVPM T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T14, (
		SELECT COUNT(T0.[DocNum]) AS '生产订单'
		FROM OWOR T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T15, (
		SELECT COUNT(T0.[DocNum]) AS '生产发料'
		FROM OIGE T0
			INNER JOIN IGE1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '202'
			AND T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T16, (
		SELECT COUNT(T0.[DocNum]) AS '生产收货'
		FROM OIGN T0
			INNER JOIN IGN1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '202'
			AND T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T17, (
		SELECT COUNT(T0.[DocNum]) AS '库存发货'
		FROM OIGE T0
			INNER JOIN IGE1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '-1'
			AND T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T18, (
		SELECT COUNT(T0.[DocNum]) AS '库存收货'
		FROM OIGN T0
			INNER JOIN IGN1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '-1'
			AND T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T19, (
		SELECT COUNT(T0.[DocNum]) AS '库存转储请求'
		FROM OWTQ T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T20, (
		SELECT COUNT(T0.[DocNum]) AS '库存转储'
		FROM OWTR T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T21, (
		SELECT COUNT(T0.itemcode) AS '物料主数据'
		FROM OITM T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T22, (
		SELECT COUNT(T0.CODE) AS '物料清单BOM'
		FROM OITT T0
		WHERE T0.[CreateDate] =CONVERT(varchar(100), GETDATE(), 102)
	) T23
UNION ALL
SELECT N'截止昨日' AS '分类', T0.[销售订单], T1.[交货], T2.[退货], T3.[预收款申请]
	, T4.[应收发票], T5.[应收贷项凭证], T6.[收款单], T7.[采购申请], T8.[采购订单]
	, T9.[采购收货], T10.[采购退货], T11.[预付款申请], T12.[应付发票], T13.[应付贷项凭证]
	, T14.[收款单], T15.[生产订单], T16.[生产发料], T17.[生产收货], T18.[库存发货]
	, T19.[库存收货], T20.[库存转储请求], T21.[库存转储], T22.[物料主数据], T23.[物料清单BOM]
FROM (
	SELECT COUNT(T0.[DocNum]) AS '销售订单'
	FROM ORDR T0
	WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
) T0, (
		SELECT COUNT(T0.[DocNum]) AS '交货'
		FROM ODLN T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T1, (
		SELECT COUNT(T0.[DocNum]) AS '退货'
		FROM ORDN T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T2, (
		SELECT COUNT(T0.[DocNum]) AS '预收款申请'
		FROM ODPI T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T3, (
		SELECT COUNT(T0.[DocNum]) AS '应收发票'
		FROM OINV T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T4, (
		SELECT COUNT(T0.[DocNum]) AS '应收贷项凭证'
		FROM ORIN T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T5, (
		SELECT COUNT(T0.[DocNum]) AS '收款单'
		FROM ORCT T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T6, (
		SELECT COUNT(T0.[DocNum]) AS '采购申请'
		FROM OPRQ T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T7, (
		SELECT COUNT(T0.[DocNum]) AS '采购订单'
		FROM OPOR T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T8, (
		SELECT COUNT(T0.[DocNum]) AS '采购收货'
		FROM OPDN T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T9, (
		SELECT COUNT(T0.[DocNum]) AS '采购退货'
		FROM ORPD T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T10, (
		SELECT COUNT(T0.[DocNum]) AS '预付款申请'
		FROM ODPO T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T11, (
		SELECT COUNT(T0.[DocNum]) AS '应付发票'
		FROM OPCH T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T12, (
		SELECT COUNT(T0.[DocNum]) AS '应付贷项凭证'
		FROM ORPC T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T13, (
		SELECT COUNT(T0.[DocNum]) AS '收款单'
		FROM OVPM T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T14, (
		SELECT COUNT(T0.[DocNum]) AS '生产订单'
		FROM OWOR T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T15, (
		SELECT COUNT(T0.[DocNum]) AS '生产发料'
		FROM OIGE T0
			INNER JOIN IGE1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '202'
			AND T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T16, (
		SELECT COUNT(T0.[DocNum]) AS '生产收货'
		FROM OIGN T0
			INNER JOIN IGN1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '202'
			AND T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T17, (
		SELECT COUNT(T0.[DocNum]) AS '库存发货'
		FROM OIGE T0
			INNER JOIN IGE1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '-1'
			AND T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T18, (
		SELECT COUNT(T0.[DocNum]) AS '库存收货'
		FROM OIGN T0
			INNER JOIN IGN1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '-1'
			AND T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T19, (
		SELECT COUNT(T0.[DocNum]) AS '库存转储请求'
		FROM OWTQ T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T20, (
		SELECT COUNT(T0.[DocNum]) AS '库存转储'
		FROM OWTR T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T21, (
		SELECT COUNT(T0.itemcode) AS '物料主数据'
		FROM OITM T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T22, (
		SELECT COUNT(T0.CODE) AS '物料清单BOM'
		FROM OITT T0
		WHERE T0.[CreateDate] <CONVERT(varchar(100), GETDATE(), 102)
	) T23
UNION ALL
SELECT N'全部单据' AS '分类', T0.[销售订单], T1.[交货], T2.[退货], T3.[预收款申请]
	, T4.[应收发票], T5.[应收贷项凭证], T6.[收款单], T7.[采购申请], T8.[采购订单]
	, T9.[采购收货], T10.[采购退货], T11.[预付款申请], T12.[应付发票], T13.[应付贷项凭证]
	, T14.[收款单], T15.[生产订单], T16.[生产发料], T17.[生产收货], T18.[库存发货]
	, T19.[库存收货], T20.[库存转储请求], T21.[库存转储], T22.[物料主数据], T23.[物料清单BOM]
FROM (
	SELECT COUNT(T0.[DocNum]) AS '销售订单'
	FROM ORDR T0
) T0, (
		SELECT COUNT(T0.[DocNum]) AS '交货'
		FROM ODLN T0
	) T1, (
		SELECT COUNT(T0.[DocNum]) AS '退货'
		FROM ORDN T0
	) T2, (
		SELECT COUNT(T0.[DocNum]) AS '预收款申请'
		FROM ODPI T0
	) T3, (
		SELECT COUNT(T0.[DocNum]) AS '应收发票'
		FROM OINV T0
	) T4, (
		SELECT COUNT(T0.[DocNum]) AS '应收贷项凭证'
		FROM ORIN T0
	) T5, (
		SELECT COUNT(T0.[DocNum]) AS '收款单'
		FROM ORCT T0
	) T6, (
		SELECT COUNT(T0.[DocNum]) AS '采购申请'
		FROM OPRQ T0
	) T7, (
		SELECT COUNT(T0.[DocNum]) AS '采购订单'
		FROM OPOR T0
	) T8, (
		SELECT COUNT(T0.[DocNum]) AS '采购收货'
		FROM OPDN T0
	) T9, (
		SELECT COUNT(T0.[DocNum]) AS '采购退货'
		FROM ORPD T0
	) T10, (
		SELECT COUNT(T0.[DocNum]) AS '预付款申请'
		FROM ODPO T0
	) T11, (
		SELECT COUNT(T0.[DocNum]) AS '应付发票'
		FROM OPCH T0
	) T12, (
		SELECT COUNT(T0.[DocNum]) AS '应付贷项凭证'
		FROM ORPC T0
	) T13, (
		SELECT COUNT(T0.[DocNum]) AS '收款单'
		FROM OVPM T0
	) T14, (
		SELECT COUNT(T0.[DocNum]) AS '生产订单'
		FROM OWOR T0
	) T15, (
		SELECT COUNT(T0.[DocNum]) AS '生产发料'
		FROM OIGE T0
			INNER JOIN IGE1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '202'
	) T16, (
		SELECT COUNT(T0.[DocNum]) AS '生产收货'
		FROM OIGN T0
			INNER JOIN IGN1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '202'
	) T17, (
		SELECT COUNT(T0.[DocNum]) AS '库存发货'
		FROM OIGE T0
			INNER JOIN IGE1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '-1'
	) T18, (
		SELECT COUNT(T0.[DocNum]) AS '库存收货'
		FROM OIGN T0
			INNER JOIN IGN1 T1 ON T1.DocEntry = T0.DocEntry
		WHERE T1.[BaseType] = '-1'
	) T19, (
		SELECT COUNT(T0.[DocNum]) AS '库存转储请求'
		FROM OWTQ T0
	) T20, (
		SELECT COUNT(T0.[DocNum]) AS '库存转储'
		FROM OWTR T0
	) T21, (
		SELECT COUNT(T0.itemcode) AS '物料主数据'
		FROM OITM T0
	) T22, (
		SELECT COUNT(T0.CODE) AS '物料清单BOM'
		FROM OITT T0
	) T23