您现在的位置:首页>>服务支持>>自助知识库>>用友U8
用友U810中现存量查询的SQL

:用友U810中现存量查询的SQL

:/*在常规情况下,现存量不能按照部门查询,如想对多个仓库同时查询有点麻烦,这条SQL可以解决*/
SELECT dbo.Warehouse.cWhCode AS 仓库编码,dbo.Warehouse.cWhName AS 仓库名称, dbo.Warehouse.cDepCode AS 部门编码,Dep.cDepName AS 部门名称,
         dbo.CurrentStock.cInvCode AS 存货编码,
         dbo.Inventory.cInvAddCode AS 存货代码,dbo.InventoryClass.cinvcname AS 存货分类,dbo.Inventory.cInvStd AS 规格型号,
         dbo.Inventory.cInvName AS 存货名称,Unit.cComUnitName AS 计量单位,
         dbo.Inventory.cInvDefine6 AS 自定义项6,dbo.Inventory.iInvSPrice AS 参考成本,
         SUM(ISNULL(dbo.CurrentStock.iQuantity, 0)) AS 现存量,
         dbo.Inventory.iInvSPrice*SUM(ISNULL(dbo.CurrentStock.iQuantity, 0)) AS 成本价值
FROM dbo.CurrentStock
         INNER JOIN dbo.Inventory ON dbo.CurrentStock.cInvCode = dbo.Inventory.cInvCode
         INNER JOIN dbo.Warehouse ON dbo.Warehouse.cWhCode = dbo.CurrentStock.cWhCode
         INNER JOIN dbo.ComputationUnit Unit ON dbo.Inventory.cComUnitCode = Unit.cComunitCode
         INNER JOIN InventoryClass ON left(Inventory.cInvCCode,6) = InventoryClass.cInvCCode
         INNER JOIN dbo.Department Dep ON dbo.Warehouse.cDepCode = Dep.cDepCode
GROUP BY dbo.Warehouse.cWhCode,dbo.Warehouse.cWhName, dbo.Warehouse.cDepCode, Dep.cDepName,
         dbo.CurrentStock.cInvCode,
         dbo.Inventory.cInvAddCode,dbo.InventoryClass.cinvcname,
         dbo.Inventory.cInvName,Unit.cComUnitName,
         dbo.Inventory.cInvDefine6,dbo.Inventory.iInvSPrice,
         dbo.Inventory.cInvStd,dbo.CurrentStock.cBatch, dbo.CurrentStock.cFree1
having  SUM(ISNULL(dbo.CurrentStock.iQuantity, 0)) >0
/*

上海企通数字科技有限公司,用心打造企业数字化!连续13年蝉联用友全国TOP10服务商,专业销售服务畅捷通、用友u8、用友NC等软件,欢迎咨询,咨询热线:400-820-8720,网址:http://www.cotong.com/

立即开启您的数字化转型体验之旅

免费体验

在线体验

X



*姓名:
*手机号:
公司:
职务:
邮箱:
需求描述:
 
400-780-9880