Quantcast
Channel: SCN : Unanswered Discussions - Reporting and Printing
Viewing all articles
Browse latest Browse all 776

Creating a query with Order#, Delivery# (if it exists) and Invoice #

$
0
0

I am trying a good while to create a query showing order number and its detail and the relevant delivery docket number (if it exists) and the order number based on a order delivery date. I have used the below that works for others but it is causing a problem with orders that went straight to invoice as for instance these orders with no delivery docket have the same digits as other order delivery dockets. I can get the joins to work. Please help Gordon Du solution to similar request: SELECT distinct T0.[DocDueDate], T0.[CardName],T0.[DocNum],T3.[SuppCatNum], T0.[CardName], T1.[Dscription], T3.[FrgnName], T1.[Quantity], T2.[SlpName],T5.[descript],T7.docnum 'Invoice #',T9.docnum 'Delivery#', T0.DocNum 'SO#' FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry LEFT JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode INNER JOIN OITM T3 ON T1.ItemCode = T3.ItemCode INNER JOIN OCRD T4 ON T0.CardCode = T4.CardCode LEFT JOIN OTER T5 ON T4.Territory = T5.territryID LEFT join dln1 T8 on T8.baseentry = t0.docentry and t1.linenum = T8.baseline LEFT join odln T9 on T9.docentry = T8.docentry LEFT JOIN INV1 T6 ON T6.BaseEntry=T9.DocEntry LEFT JOIN OINV T7 ON T7.DocEntry=T6.DocEntry WHERE  T0.[DocDueDate] =[%0] and t8.trgetentry is null As stated, I am seeing old orders without delivery dockets mixed into orders that match the old order number with their delivery dockets. Please help. I want to see all orders, regardless of the process stage they are at.


Viewing all articles
Browse latest Browse all 776

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>