DEFINE QUERY a FOR ttrcvdtl,podetail,porel,project,jobasmbl,plantwhse,poheader,puragent.
OPEN QUERY a
for EACH ttRcvDtl Exclusive-Lock,
each podetail no-lock where (podetail.Company = cur-comp and podetail.PONUM = ttrcvdtl.PONum and podetail.POLine = ttrcvdtl.POLine),
each PORel no-lock where (porel.company = cur-comp and porel.PONum = podetail.PONUM and porel.POLine = podetail.POLine),
each Project no-lock outer-join where (Project.Co mpany = cur-comp and Project.projectid = porel.ProjectID), each jobasmbl no-lock where JobAsmbl.Company = cur-comp and jobasmbl.JobNum = ttrcvdtl.JobNum and jobasmbl.AssemblySeq = ttrcvdtl.AssemblySeq,
each plantwhse no-lock where plantwhse.partnum = ttrcvdtl.partnum and plantwhse.Company = cur-comp, each poheader no-lock where poheader.ponum = ttrcvdtl.PONum and Poheader.Company = cur-comp,each puragent no-lock where puragent.BuyerID = poheader.BuyerID.
GET FIRST a.
DO:
Assign ttRcvDtl.ShortChar01 = Project.ProjectID
ttRcvDtl.Shortchar02 = Project.Description.
if plantwhse.PrimBin <> ""
then assign ttrcvdtl.BinNum = "Y". /* this allows us to bin assign parts that we are certain will always go to one location.*/
else if puragent.checkbox01 = True
then assign ttrcvdtl.BinNum = "SERVICE".
else if jobasmbl.checkbox05 = true
then assign ttRcvdtl.BinNum = "E".
else if (ttrcvdtl.ShortChar03 = "Shop for Field (shiploose)" or ttrcvdtl.ShortChar03 = "Shop/Fld")
then assign ttrcvdtl.BinNum = "SL".
else if podetail.ClassID = "TOOL"
then assign ttrcvdtl.BinNum = "T".
else if podetail.ClassID = "SOFT"
then assign ttrcvdtl.BinNum = "IT".
else if podetail.ClassID = "CMPT"
then assign ttrcvdtl.binnum = "IT".
else if Project.BinNum = ""
then assign ttRcvDtl.BinNum = "R".
else assign ttRcvDtl.BinNum = Project.BinNum.
pause.
GET NEXT a.
end.