cancel
Showing results for 
Search instead for 
Did you mean: 

Modify Query about sales order

anser
Explorer
0 Kudos

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]

Accepted Solutions (0)

Answers (0)