cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Closed DO Item with Invoice Number Query

kedalenechong
Participant
0 Likes
912

Hi All

Please help advise how to enhance this Query to show the actual Invoice Number of Closed Delivery Order.   Right now it is only showing internal Target Entry from DO.

SELECT T0."DocDate", T0.DocEntry, T0.[DocNum] 'DO No', T0.[CardCode], T0.[CardName], T1.[VisOrder] + 1 'LineNo.', T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[OpenQty], T2.Telephone as 'Sales Employee', T1.[TargetType], T1.[TrgetEntry] FROM ODLN T0 INNER JOIN DLN1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode] LEFT OUTER JOIN INV1 T3 on T1.[TargetType]=T3.[TrgetEntry] LEFT OUTER JOIN OINV T4 ON T4.[DocEntry] = T3.[DocEntry]
WHERE T0."DocStatus" = 'C'

 

 

Kedalene Chong

Accepted Solutions (0)

Answers (1)

Answers (1)

Hi, 

please check again your JOIN to INV1... 

LEFT OUTER JOIN INV1 T3 on T1.[TargetType]=T3.[DocEntry]
DocEntry is needed instead of TargetEntry

Hope that helps.

Greetings
Markus

 

0 Likes
Sorry... my mistake:
LEFT OUTER JOIN INV1 T3 on T1.[TrgetEntry]=T3.[DocEntry]
kedalenechong
Participant
0 Likes
SELECT T0."DocDate", T0.DocEntry, T0.[DocNum] 'DO No', T0.[CardCode], T0.[CardName], T1.[VisOrder] + 1 'LineNo.', T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[OpenQty], T2.Telephone as 'Sales Employee', T1.[TargetType], T1.[TrgetEntry], T4.DocNum FROM ODLN T0 INNER JOIN DLN1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode] LEFT OUTER JOIN INV1 T3 on T1.[TargetType]=T3.[TrgetEntry] LEFT OUTER JOIN OINV T4 ON T4.[DocEntry] = T1.[TrgetEntry] WHERE T0."DocStatus" = 'C'
kedalenechong
Participant
0 Likes
I managed to modify my Query and get the result
kedalenechong
Participant
0 Likes
Sorry how to accept your Answer as Solution