Quantcast
Channel: Microsoft Dynamics SL
Viewing all articles
Browse latest Browse all 14486

Forum Post: RE: Detail on location table

$
0
0

Hi Manuel,

Could you please try this below SQL Script.

SELECT  

TrnsfrDoc.BatNbr,

InvtID =RTRIM(INTran.InvtID)+' '+RTRIM(INTran.TranDesc),

--LotSerMst.LotSerNbr,

--INTran.InvtID,

--INTran.TranDesc,

INTran.TranAmt,

INTran.Qty,

Name=RTRIM(INTran.WhseLoc)+' '+RTRIM(LocTable.Descr),

INTran.WhseLoc,

--Nombre=LocTable.Descr,

TrnsfrDoc.RefNbr,

TrnsfrDoc.Comment,

TotalDays=DATEDIFF ( day, TrnsfrDoc.expecteddate , getdate() ),

Month=datepart(MM,TrnsfrDoc.TranDate),

Year=datepart(YYYY,TrnsfrDoc.TranDate),

TrnsfrDoc.TranDate,

TrnsfrDoc.expecteddate,

Loc1.QtyAvail,

Loc1.QtyOnHand

FROM

(

TrnsfrDoc INNER JOIN INTran ON TrnsfrDoc.BatNbr=INTran.BatNbr AND TrnsfrDoc.RefNbr=INTran.RefNbr

AND  INTran.AcctDist=0

--AND TrnsfrDoc.BatNbr='093242'

AND TrnsfrDoc.ToSiteID like ('PR%')

--AND INTran.WhseLoc ='11VTAS-042'

AND INTran.InvtID ='422COR'

AND INTran.InvtMult=1

AND INTran.Rlsed=1

)

INNER JOIN

(

Select SUM(Location.QtyOnHand) 'QtyOnHand',SUM(Location.QtyAvail) 'QtyAvail',Location.InvtId,Location.SiteID,Location.WhseLoc

from Location Inner Join INTran ON Location.InvtID=INTran.InvtId

AND Location.SiteID=INTran.SiteID AND Location.WhseLoc=INTran.WhseLoc AND Location.QtyOnHand <>0

Group by Location.InvtId,Location.SiteID,Location.WhseLoc

) As Loc1 ON Loc1.InvtID=INTran.InvtId AND Loc1.SiteID=INTran.SiteID AND Loc1.WhseLoc=INTran.WhseLoc

INNER JOIN LocTable on Loc1.SiteID=LocTable.SiteID AND Loc1.WhseLoc=LocTable.WhseLoc

INNER JOIN LotSerMst on Loc1.InvtID = LotSerMst.InvtID and Loc1.SiteID=LotSerMst.SiteID AND Loc1.WhseLoc=LotSerMst.WhseLoc

AND Loc1.InvtID=LotSerMst.InvtID and LotSerMst.QtyOnHand <> 0

I believe this Script may solve you problem.

Thanks,

Perumalsamy.R


Viewing all articles
Browse latest Browse all 14486

Trending Articles



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