on 04-17-2024 7:15 AM
Dear Team
I have a query as below which is showing list of Sales Orders with project code and open amount.
I want to modify this query to add 2 more columns i.e Sales Employee name and Estimated Profit (AED).
Estimated Profit (AED) is uder defined field in Sales Order.
kindly help to modify this query.
SELECT distinct(T0.[DocNum]), T0.[CANCELED], T0.[DocStatus], T0.[DocDate], T0.[CardName],T1.Project,Sum(T1.[LineTotal]) as 'Gross Total',
Sum(T1.[LineVat])'Tax Amount', Sum(T1.[LineTotal]+T1.[LineVat]) 'Total', Sum ((T1.[OpenQty] * T1.[Price]) * (CASE WHEN T0.DocCur = 'AED' THEN 1 ELSE T1.[Rate] END)) As 'Open Value' FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCTG T2 ON T0.GroupNum = T2.GroupNum WHERE (T1.[PROJECT] >= [%0] and T1.[PROJECT] <=[%1]) and T0.[CANCELED] ='N' GROUP BY T0.[DocNum], T0.[CANCELED], T0.[DocStatus], T0.[DocDate], T0.[CardName], T1.[Project]
User | Count |
---|---|
8 | |
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.