Query for Unit Commision
I am trying to write a query show the per unit commission for an item on a Sales Order and put that value into a UDF.
I have got as far as getting a result on the document for a specific row, but I cannot get it to select for all rows on the document.
What I have is as follows:
SELECT (T0.Price* T0.Commission/100)
FROM RDR1 T0 INNER JOIN ORDR T1 ON T0.DocEntry = T1.DocEntry
WHERE T1.DocNum = $[$8.0] AND T0.ItemCode = $[$38.0]
It is the last part where I am trying to specify by itemcode that is proving troublesome. I have used a specific line number instead of ItemCode and that works.
Can someone help me on this?