您現(xiàn)在的位置:首頁(yè)>>服務(wù)支持>>自助知識(shí)庫(kù)>>用友U8
用友U810中現(xiàn)存量查詢的SQL

:用友U810中現(xiàn)存量查詢的SQL

:/*在常規(guī)情況下,現(xiàn)存量不能按照部門查詢,如想對(duì)多個(gè)倉(cāng)庫(kù)同時(shí)查詢有點(diǎn)麻煩,這條SQL可以解決*/
SELECT dbo.Warehouse.cWhCode AS 倉(cāng)庫(kù)編碼,dbo.Warehouse.cWhName AS 倉(cāng)庫(kù)名稱, dbo.Warehouse.cDepCode AS 部門編碼,Dep.cDepName AS 部門名稱,
         dbo.CurrentStock.cInvCode AS 存貨編碼,
         dbo.Inventory.cInvAddCode AS 存貨代碼,dbo.InventoryClass.cinvcname AS 存貨分類,dbo.Inventory.cInvStd AS 規(guī)格型號(hào),
         dbo.Inventory.cInvName AS 存貨名稱,Unit.cComUnitName AS 計(jì)量單位,
         dbo.Inventory.cInvDefine6 AS 自定義項(xiàng)6,dbo.Inventory.iInvSPrice AS 參考成本,
         SUM(ISNULL(dbo.CurrentStock.iQuantity, 0)) AS 現(xiàn)存量,
         dbo.Inventory.iInvSPrice*SUM(ISNULL(dbo.CurrentStock.iQuantity, 0)) AS 成本價(jià)值
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
/*

上海企通數(shù)字科技有限公司,用心打造企業(yè)數(shù)字化!連續(xù)13年蟬聯(lián)用友全國(guó)TOP10服務(wù)商,專業(yè)銷售服務(wù)暢捷通、用友u8、用友NC等軟件,歡迎咨詢,咨詢熱線:400-820-8720,網(wǎng)址:http://m.leafscars.cn/

立即開啟您的數(shù)字化轉(zhuǎn)型體驗(yàn)之旅

免費(fèi)體驗(yàn)

在線體驗(yàn)

X



*姓名:
*手機(jī)號(hào):
公司:
職務(wù):
郵箱:
需求描述:
?
400-780-9880