Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 64797

Received and Sold Inventory value by vendor

$
0
0

The below query will give you the received and sold inventory values with including quantity received & sold, quantity received value & sold value based on the vendors.

SELECT Vendor
,ITEMNMBR
,[Received QTY]
,[Sold QTY]
,([Received QTY] – [Sold QTY]) [Remaining QTY]
,[Purchase Value]
,[Sold Value]
,([Purchase Value] – [Sold Value]) [Remaining Inventory Value]
FROM (
SELECT VENDORID AS Vendor
,ITEMNMBR
,(
SELECT SUM(QTYRECVD)
FROM IV10200
WHERE ITEMNMBR = A.ITEMNMBR
AND PCHSRCTY = 5
AND VENDORID = A.VENDORID
) AS [Received QTY]
,(
SELECT SUM(QTYSOLD)
FROM IV10200
WHERE ITEMNMBR = A.ITEMNMBR
AND PCHSRCTY = 5
AND VENDORID = A.VENDORID
) AS [Sold QTY]
,(
SELECT SUM(QTYRECVD * UNITCOST)
FROM IV10200
WHERE ITEMNMBR = A.ITEMNMBR
AND PCHSRCTY = 5
AND VENDORID = A.VENDORID
) AS [Purchase Value]
,(
SELECT SUM(QTYSOLD * UNITCOST)
FROM IV10200
WHERE ITEMNMBR = A.ITEMNMBR
AND PCHSRCTY = 5
AND VENDORID = A.VENDORID
) AS [Sold Value]
FROM IV10200 A
WHERE A.VENDORID <> ”
AND PCHSRCTY = 5
GROUP BY A.VENDORID
,A.ITEMNMBR
) PurchaseByVendor

Hope this helps!!!



Viewing all articles
Browse latest Browse all 64797

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>