Historical Stock Status Script
Views (4861)
We been suffering from Historical Stock Status report issues when it comes to customers with big inventory transactions, I am providing a script that recalculate the historical stock status for your items based on the IV10200 and IV10201 tables, it will allow you to estimate your inventories using a historical date:
Historical Stock Sttus Summary
- DECLARE @ASOFDATE DATETIME
- SET @ASOFDATE = '2016-12-31'
- SELECT
- ITEMNMBR AS [Item Number],
- TRXLOCTN AS [Location],
- SUM(Quantity) AS Quantity,
- SUM([Extended Cost]) AS [Total Cost]
- FROM
- (SELECT ITEMNMBR,
- (dbo.IV10200.QTYRECVD -
- ISNULL((SELECT SUM(QTYSOLD) FROM IV10201
- WHERE SRCRCTSEQNM = IV10200.RCTSEQNM
- AND ITEMNMBR = IV10200.ITEMNMBR
- AND DOCDATE <= @ASOFDATE), 0))
- AS [Quantity],
- UNITCOST *
- (dbo.IV10200.QTYRECVD -
- ISNULL((SELECT SUM(QTYSOLD) FROM IV10201
- WHERE SRCRCTSEQNM = IV10200.RCTSEQNM
- AND ITEMNMBR = IV10200.ITEMNMBR
- AND DOCDATE <= @ASOFDATE), 0))
- AS [Extended Cost],
- TRXLOCTN
- FROM dbo.IV10200 WHERE DATERECD <@ASOFDATE) AS SOURCE
- GROUP BY ITEMNMBR, TRXLOCTN
Hope that his helps!
Regards,
--
Mohammad R. Daoud MVP - MCT
MCP, MCBMSP, MCTS, MCBMSS
+962 - 79 - 999 65 85
me@mohdaoud.com
http://www.di.jo
This was originally posted here.
*This post is locked for comments