ORECS01 ;SLC/JDL-CPRS utility for Event Capture System; 2/10/03 13:04P
;;3.0;ORDER ENTRY/RESULTS REPORTING;**141,149**;Dec 17, 1997
;
CHKESSO(ORY,CHK) ;--1=ESSO installed on site 0=not installed
S ORY=$$PATCH^XPDUTL("XWB*1.1*26")
Q
;
VSITID(ORY,VSTSTR) ;--Return Visit IEN ptr to #9000010
;VSTSTR=HospLoc;DateTime;Category;PtIEN
N DTREF,PTID
S ORY=0
S DTREF=9999999-$P($P(VSTSTR,";",2),".")_"."_$P($P(VSTSTR,";",2),".",2)
S PTID=+$P(VSTSTR,";",4)
S:$D(^AUPNVSIT("AA",PTID,DTREF)) ORY=$O(^(DTREF,0))
Q
;
ECRPT(ORY,ORECARY) ;--EC report
Q:'$D(ORECARY)
D RPTEN^ECRRPC(.ORY,.ORECARY)
Q
;
ECPRINT(ORY,ORECARY) ;--Print ECS report to Device
Q:'$D(ORECARY)
D RPTEN^ECRRPC(.ORY,.ORECARY)
Q
;
GETDIV(ORY,USR) ;--Get user's division
S ORY=0
S:$G(DUZ(2)) ORY=DUZ(2)
Q
SAVPATH(ORY,ECPATH) ;--Save user's ECS path
N IX,VAL,NM,HADIT,LST,INST,LAST
S (IX,HADIT,INST,LAST)=0,(VAL,NM)=""
D GETLST^XPAR(.LST,DUZ_";VA(200,","ORWT TOOLS MENU")
S LAST=+$G(LST(LST))
F S IX=$O(LST(IX)) Q:('IX)!HADIT D
. S NM=$P($P(LST(IX),U,2),"=",1)
. I $$UP^XLFSTR(NM)="EVENT CAPTURE INTERFACE" S HADIT=$P(LST(IX),U)
S $P(ECPATH,"=",2)=$C(34)_$P(ECPATH,"=",2)_$C(34)
S ORY=$P(ECPATH,"=",2)
D:HADIT CHG^XPAR(DUZ_";VA(200,","ORWT TOOLS MENU",HADIT,ECPATH)
D:'HADIT ADD^XPAR(DUZ_";VA(200,","ORWT TOOLS MENU",LAST+1,ECPATH)
Q
ORECS01 ;SLC/JDL-CPRS utility for Event Capture System; 2/10/03 13:04P
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**141,149**;Dec 17, 1997
+2 ;
CHKESSO(ORY,CHK) ;--1=ESSO installed on site 0=not installed
+1 SET ORY=$$PATCH^XPDUTL("XWB*1.1*26")
+2 QUIT
+3 ;
VSITID(ORY,VSTSTR) ;--Return Visit IEN ptr to #9000010
+1 ;VSTSTR=HospLoc;DateTime;Category;PtIEN
+2 NEW DTREF,PTID
+3 SET ORY=0
+4 SET DTREF=9999999-$PIECE($PIECE(VSTSTR,";",2),".")_"."_$PIECE($PIECE(VSTSTR,";",2),".",2)
+5 SET PTID=+$PIECE(VSTSTR,";",4)
+6 IF $DATA(^AUPNVSIT("AA",PTID,DTREF))
SET ORY=$ORDER(^(DTREF,0))
+7 QUIT
+8 ;
ECRPT(ORY,ORECARY) ;--EC report
+1 IF '$DATA(ORECARY)
QUIT
+2 DO RPTEN^ECRRPC(.ORY,.ORECARY)
+3 QUIT
+4 ;
ECPRINT(ORY,ORECARY) ;--Print ECS report to Device
+1 IF '$DATA(ORECARY)
QUIT
+2 DO RPTEN^ECRRPC(.ORY,.ORECARY)
+3 QUIT
+4 ;
GETDIV(ORY,USR) ;--Get user's division
+1 SET ORY=0
+2 IF $GET(DUZ(2))
SET ORY=DUZ(2)
+3 QUIT
SAVPATH(ORY,ECPATH) ;--Save user's ECS path
+1 NEW IX,VAL,NM,HADIT,LST,INST,LAST
+2 SET (IX,HADIT,INST,LAST)=0
SET (VAL,NM)=""
+3 DO GETLST^XPAR(.LST,DUZ_";VA(200,","ORWT TOOLS MENU")
+4 SET LAST=+$GET(LST(LST))
+5 FOR
SET IX=$ORDER(LST(IX))
IF ('IX)!HADIT
QUIT
Begin DoDot:1
+6 SET NM=$PIECE($PIECE(LST(IX),U,2),"=",1)
+7 IF $$UP^XLFSTR(NM)="EVENT CAPTURE INTERFACE"
SET HADIT=$PIECE(LST(IX),U)
End DoDot:1
+8 SET $PIECE(ECPATH,"=",2)=$CHAR(34)_$PIECE(ECPATH,"=",2)_$CHAR(34)
+9 SET ORY=$PIECE(ECPATH,"=",2)
+10 IF HADIT
DO CHG^XPAR(DUZ_";VA(200,","ORWT TOOLS MENU",HADIT,ECPATH)
+11 IF 'HADIT
DO ADD^XPAR(DUZ_";VA(200,","ORWT TOOLS MENU",LAST+1,ECPATH)
+12 QUIT