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

Re: Alert - for Gross Profit Calculation with Invoice Documents

$
0
0

Hi,

 

Try this query for row level GP. Let me know your feedback

 

SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[GrssProfSC], T1.[Price], case when T3.[AvgPrice] = '0' then 100 else
(T1.[GrssProfSC] /  T1.[Price] ) * 100 end as ' GP%%' FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OITW T3 ON T2.ItemCode = T3.ItemCode WHERE T0.[cardcode]  =[%0] GROUP BY T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription],T1.[Price],T1.[GrssProfSC],T3.[AvgPrice]

having (case when T3.[AvgPrice] = '0' then 100 else
(T1.[GrssProfSC] /  T1.[Price] ) * 100 end ) <= 5

 

 

Thanks & Regards,

Nagarajan


Viewing all articles
Browse latest Browse all 9080

Trending Articles



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