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

Re: Linking ORIN to ORDN

$
0
0

Thank you very much for the help. If there is a link between the credit note and return will they appear on the same line? I am looking through the results but do not see any returns with an associated credit memo. I modified your query to display all return documents, but none of them display the related credit memo. Please let me know if I am missing anything:

 

SELECT T1.[CardName] as 'Customer Name', T12.DocNum AS 'Return No', T12.DocDate as 'Return Date',

T7.DocNum as 'Credit Note No.', T7.DocDate as 'Credit Note date'

 

 

 

FROM RDR1 T0 

INNER JOIN ORDR T1 ON T0.DocEntry = T1.DocEntry 

Left outer join DLN1 T2 on T2.BaseEntry = T0.DocEntry and T2.BaseLine = T0.Linenum  

Left outer join ODLN T3 on T2.DocEntry = T3.DocEntry 

Left Outer join INV1 T4 on T4.BaseEntry = T3.DocEntry and T4.BaseLine = T2.Linenum  and T4.BaseType = 15  OR (T4.Basetype=17 and T4.BaseEntry=T0.DocEntry and T4.BaseLine=T0.LineNum) 

LEFT outer join RDN1 T11 on T11.BaseEntry = T2.DocEntry and T11.BaseLine = T2.LineNum 

LEFT outer join ORDN T12 on T11.DocEntry = T12.DocEntry 

left outer join OINV T5 on T5.DocEntry = T4.DocEntry 

left Outer join RIN1 T6 on T6.BaseEntry = T5.DocEntry and T6.BaseLine = T4.Linenum  

left outer join ORIN T7 on T6.DocEntry = T7.DocEntry 

left outer join OITM T8 on T0.ItemCode = T8.ItemCode 

left outer join OSLP T9 on T9.SlpCode = T1.SlpCode 

left outer join OHEM T10 on T10.empID = T1.OwnerCode 

 

WHERE T1.[DocDate] >=[%0] and  T1.[DocDate] <=[%1]  

AND T12.[DocNum] IS NOT NULL

 

 

 

GROUP BY T5.DocNum, T12.DocNum, T1.CardName, T5.DocDate, T5.DocStatus,T5.DocTotal,T5.PaidToDate , 

T7.DocNum , T7.DocDate , T12.DocDate


Viewing all articles
Browse latest Browse all 9129

Trending Articles