Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 962

All sales transactions query need to add the inventory

$
0
0

Hello,

 

We have a query that allows us to select a range of dates for the sales transactions that have been processed during that period of time. However, we would like to add to this query the total quantity of stock on hand after the sale happened for each transaction.

 

Almost like the beginning inventory balance subtracted by the sale transaction at the end of the report.

 

SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T1.[WhsCode], T0.[TransId], T1.[ItemCode], T2.[CodeBars], T1.[Dscription], T4.[ItmsGrpNam], T1.[VendorNum] AS "MFG#", T5.[FirmName], T2.[CardCode], T6.[CardName], T1.[Quantity], T1.[Price], T2.[LastPurPrc], T3.[Price] AS "Price", T2.[LstEvlPric] AS "Last Evaluated Price", T1.[SlpCode], T7.[SlpName]

 

FROM [dbo].[OINV]  T0 INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode] INNER JOIN ITM1 T3 ON T2.[ItemCode] = T3.[ItemCode] AND T3.[PriceList] = '1' INNER JOIN OITB T4 ON T2.[ItmsGrpCod] = T4.[ItmsGrpCod] INNER JOIN OMRC T5 ON T2.[FirmCode] = T5.[FirmCode] INNER JOIN OCRD T6 ON T2.[CardCode] = T6.[CardCode]  INNER JOIN OSLP T7 ON T0.SlpCode = T7.SlpCode

 

WHERE T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%]

 

 

Your help is greatly appreciated.


Viewing all articles
Browse latest Browse all 962


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