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

Re: Delivery query text field not showing not showing in corresponding order in report

$
0
0

Hi,

 

Try this query:

 

select t0.docnum,t0.cardname,t0.NumAtCard,t0.Comments,

convert(varchar,t0.docduedate,103) as Date,t1.itemcode,t1.dscription,t2.WhsCode,t2.OnHand as After_DELIVERY_STOCKQTY,

t1.Price,t1.linetotal,t1.vatsum,t1.baseref as SO,t1.quantity,(select sum(t5.inqty)-sum(t5.outqty)) as BEFORE_DELIVERY_STOCKQTY,t6.baseref as SQ,

(SELECT distinct TOP 1 isnull(Street,'') FROM CRD1 WHERE CardCode=T0.CardCode AND AdresType='B')+

(SELECT distinct TOP 1 isnull(BLOCK,'') FROM CRD1 WHERE CardCode=T0.CardCode AND AdresType='B') +

(SELECT distinct TOP 1 isnull(CITY,'') FROM CRD1 WHERE CardCode=T0.CardCode AND AdresType='B') +

(SELECT distinct TOP 1 isnull(State,'') FROM CRD1 WHERE CardCode=T0.CardCode AND AdresType='B') +

(SELECT distinct TOP 1 isnull(ZipCode,'') FROM CRD1 WHERE CardCode=T0.CardCode AND AdresType='B') as Address,

T3.SeriesName AS SERIES

from ODLN t0 inner join DLN1 t1 on t0.DocEntry=t1.DocEntry

inner join OITW t2 on t1.ItemCode=t2.ItemCode and t1.WhsCode =t2.WhsCode

inner JOIN NNM1 T3 ON T0.Series=T3.Series

inner JOIN DLN10 T4 ON T0.DocEntry=T4.DocEntry

inner join OINM t5 on t1.ItemCode=t5.ItemCode

inner join RDR1 t6 on t1.BaseEntry =t6.DocEntry

where t2.WhsCode ='OPEN' and t0.DocNum= [%0]

group by t0.docnum,t0.cardname,t0.NumAtCard,t0.Comments,t0.docduedate,t1.itemcode,t1.dscription,t2.WhsCode,t2.OnHand,t1.Price,

t1.linetotal,t1.vatsum,t1.baseref,t1.quantity,T0.CardCode,T3.SeriesName,t6.baseref

 

union

select t0.docnum,t0.cardname,t0.NumAtCard,t0.Comments,

convert(varchar,t0.docduedate,103) as Date,Cast(T4.LineText  as nvarchar (200))  AS LINETEXT  ,' ',' ','0 ',

'0 ','0','0',' ','0','0 ',' ',

' '+

' ' +

' ' +

' ' +

' ',

' '

from ODLN t0 inner join DLN1 t1 on t0.DocEntry=t1.DocEntry

inner join OITW t2 on t1.ItemCode=t2.ItemCode and t1.WhsCode =t2.WhsCode

inner JOIN NNM1 T3 ON T0.Series=T3.Series

inner JOIN DLN10 T4 ON T0.DocEntry=T4.DocEntry

inner join OINM t5 on t1.ItemCode=t5.ItemCode

inner join RDR1 t6 on t1.BaseEntry =t6.DocEntry

where t2.WhsCode='OPEN' and t0.DocNum = [%0]

group by t0.docnum,t0.cardname,t0.NumAtCard,t0.Comments,t0.docduedate,t1.dscription,t2.WhsCode,t2.OnHand,t1.Price,

t1.linetotal,t1.vatsum,t1.baseref,t1.quantity,T0.CardCode,T3.SeriesName,t6.baseref,Cast(T4.LineText  as nvarchar (200))

 

Note: Add your warehouse code and docnum

 

Thanks & Regards,

Nagarajan


Viewing all articles
Browse latest Browse all 9076

Trending Articles



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