1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
|
**---- Display the layout
select iruser, ;
SUM((IIF(irsrc='F' AND BLGRP!='35VNL' AND irqty<0,1,0)) + (IIF(irsrc='P' AND BLGRP!='35VNL',1,0)) + ((IIF(irsrc='T' AND BLGRP!='35VNL' ;
AND irqty>0,1,0)) + (IIF(irsrc='G' AND BLGRP!='35VNL' AND irqty<0,1,0)) + ;
(IIF(irsrc='D' AND irqty<0 AND blgrp!='35VNL',1,0)) + (IIF(irsrc='W' AND irqty<0 AND blgrp!='35VNL',1,0)) + (IIF(irsrc='J' AND BLGRP!='35VNL' AND ;
irqty<0,1,0)) + (IIF(irsrc='H' AND irqty<0 AND blgrp!='35VNL',1,0)))) as total_lines, ;
sum(IIF(irsrc='F' AND BLGRP!='35VNL' AND irqty<0,1,0)) as cuts, ;
SUM(IIF(irsrc='P' AND BLGRP!='35VNL' ,1,0)) as po_lines_recvd, ;
sum(IIF(irsrc='T' AND BLGRP!='35VNL' AND irqty>0,1,0)) as xe_lines_recvd, ;
SUM(IIF(irsrc='G' AND BLGRP!='35VNL' AND irqty<0,1,0)) as staged_lines, ;
SUM(IIF(irsrc='D' AND BLGRP!='35VNL' AND irqty<0 AND ohviac!="1",1,0)) as shipped_lines, ;
SUM(IIF(irsrc='D' AND BLGRP!='35VNL' AND irqty<0 AND ohviac="1" AND olloc=oliloc AND olord_=ohord_ and olrel_=ohrel_,1,0)) as willcall_lines, ;
SUM(IIF(irsrc='W' AND BLGRP!='35VNL' AND irqty<0,1,0)) as shipped_xe_lines, ;
SUM(IIF(irsrc='J' AND BLGRP!='35VNL' AND irqty<0,1,0)) as consolidated_lines, ;
SUM(IIF(irsrc='H' AND BLGRP!='35VNL' AND irqty<0,1,0)) as moved_lines ;
from cItemrech, cBinloc, cUserfile, cUserxtra, cprempm, cOohead, cOoline ;
where (irloc=41 OR irloc=57) AND irbin=blbin AND irloc=blloc AND (usloc=41 OR usloc=57) AND usid=iruser AND usxid=usid AND ;
ememp_=usxemp_ and (emloc!=38 AND emloc!=96) AND blgrp!='SAMPL' AND ohco=olco AND ohloc=olloc AND ohord_=olord_ and ohrel_=olrel_ and ;
irooco=olco and iroolo=olloc and irord_=olord_ and irrel_=olrel_ and irooco=ohco AND iroolo=ohloc AND irord_=ohord_ and irrel_=ohrel_ and ;
(oliloc=41 OR oliloc=57) AND olcust=ohcust AND ircust=olcust AND ircust=ohcust ;
group by usxemp_ ;
order by iruser into cursor cResultsIR readwrite
****************************************************************************************************************************************
*----------> Detail Code Next
SELECT cItemrech.irky, cOoline.olidky, cItemrech.irseq_, cOoline.olseq_, cItemrech.irloc, cItemrech.irsrc, cItemrech.iruser, cOohead.ohviac, cItemrech.irord_, cItemrech.irrel_, cItemrech.iritem, cItemrech.irqty, cItemrech.irbin ;
FROM cItemrech, cBinloc, cUserfile, cprempm, cUserxtra, cOoline, cOohead ;
where (irloc=41 or irloc=57) AND blgrp!='35VNL' AND BLGRP NOT LIKE 'XXXX%' AND irbin=blbin AND irloc=blloc AND ;
(usloc=41 OR usloc=57) AND (emloc!=96 AND EMLOC!=38) AND usxid=usid AND ememp_=usxemp_ AND ;
usid=iruser AND irsrc in('F', 'P', 'T', 'G', 'D', 'W', 'J', 'H') AND ohco=olco AND ohloc=olloc AND ohord_=olord_ and ohrel_=olrel_ and ;
irooco=olco and iroolo=olloc and irord_=olord_ and irrel_=olrel_ and (oliloc=41 OR oliloc=57) AND olcust=ohcust AND ircust=olcust AND ircust=ohcust ;
order by irsrc, iruser into cursor cDetails readwrite
COPY TO "C:\pm_user\pacmat_user_details-"+Stuff(Stuff(Dtoc(ldDate),6,1,"_"),3,1,"_")+".xls" TYPE xl5
|