Hi Expert,
Can someone help?
I am trying to create a query to display:
- Only Supplier information for past 3 years (2014, 2015, 2016)
- Total Purchase Value (Monthly)
- Total Sales Value (monthly) of the items purchased from the supplier.
I have created the below query
| select | distinct dbo.OPDN.DocEntry, dbo.OPDN.DocNum, dbo.OPDN.DocType, dbo.OPDN.DocDate, dbo.OPDN.CardCode, dbo.OPDN.CardName, dbo.OPDN.DocTotalSy, |
| YEAR(dbo.OPDN.DocDate) AS Year, | |
| CASE Month(dbo.OPDN.DocDate) | |
| WHEN 1 THEN 'Jan' WHEN 2 THEN 'Feb' WHEN 3 THEN 'Mar' WHEN 4 THEN 'Apr' WHEN 5 THEN 'May' WHEN 6 THEN 'Jun' WHEN 7 THEN 'Jul' WHEN 8 THEN 'Aug' | |
| WHEN 9 THEN 'Sep' WHEN 10 THEN 'Oct' WHEN 11 THEN 'Nov' WHEN 12 THEN 'Dec' END AS 'Month', dbo.OPDN.DocTotal | |
| FROM | dbo.OPDN INNER JOIN |
| dbo.PDN1 ON dbo.OPDN.DocEntry = dbo.PDN1.DocEntry | |
| WHERE | (DATEDIFF(year, GETDATE(), OPDN.DocDate) >= - 2) |
The above gives the total from the Good Receipt PO which i have connected via Excel using Pivot table and filtering the cardcord and YEAR. User want to find out what is the total SOLD of per items purchased.
for example on the Good receipt PO supplier T0035 ordered qty 100 of item A0001, only qty 80 were sold.
As well as the above query i require the total sale of the items from the Supplier.
can someone please assist me with this please?