ORKCHK ; slc/CLA - Main routine called by OE/RR to initiate order checks ;15-Jun-2010 21:16;PLS
;;3.0;ORDER ENTRY/RESULTS REPORTING;**6,32,94,105,123,1005,232,267,243,1010**;Dec 17, 1997;Build 47
; Modified - IHS/MSC/PLS - 06/15/2010 - Line EN+95
EN(ORKY,ORKDFN,ORKA,ORKMODE) ;initiate order checking
;ORKY: array of returned msgs in format: ornum^orderchk ien^clin danger^msg
;ORKDFN: patient dfn
;ORKA: array of order information in the format:
; orderable item ien|
; display group-filler app|
; nat'l id^nat'l text^nat'l code sys^local id^local text^local code sys|
; effective d/t|
; order number|
; filler data (LR: specimen ien, PS: meds prev ordered during this session in format med1^med2^...)
;ORKMODE: mode/event trigger (DISPLAY,SELECT,ACCEPT,SESSION,ALL,NOTIF)
; PS: meds previously ordered during this session med1^med2^...
;
N ORKQ,ORKN S ORKQ=0,ORKN=1
S:+$G(ORKDFN)<1 ORKY(ORKN)="^^^Order Checking Unavailable - invalid patient id",ORKQ=1,ORKN=ORKN+1
S:'$L($G(ORKMODE)) ORKY(ORKN)="^^^Order Checking Unavailable - invalid mode/event",ORKQ=1,ORKN=ORKN+1
Q:$G(ORKQ)=1
Q:+$G(ORKA)<1
N ORKX,ORKS,DNGR,ORENT,ORKENT,ORKNENT,ORNUM,ORKOFF,ORKTMODE
N ORKADUZ,ORKNDUZ,ORKI,ORKPRIM,ORKNMSG,ORKMSG,ORKLOG,ORKLD,ORKLI,ORKOI
N ORKDG,ORKLPS,ORKPSA,ORKCNT,ORKDGI
;
;save array of orders for use in session processing:
M ^TMP("ORKA",$J)=ORKA
;
;get patient's location flag (INPATIENT ONLY - outpt locations cannot be
;reliably determined, and many simultaneous outpt locations can occur):
N DFN,ORKLOC
S DFN=ORKDFN,VA200="" D OERR^VADPT
S ORKLOC=+$G(^DIC(42,+VAIN(4),44))
K VA200,VAIN
;
;get user's service/section flag:
N ORKSRV
S ORKSRV=$$GET1^DIQ(200,DUZ,29,"I") I +ORKSRV>0 S ORKSRV=$P(ORKSRV,U)
;
;log order check debug messages (or not)
S ORKLOG=$$GET^XPAR("DIV^SYS^PKG","ORK DEBUG ENABLE/DISABLE",1,"I")
I $G(ORKLOG)="D" K ^XTMP("ORKLOG") S ^XTMP("ORKLOG",0)=""
I +$P($G(^XTMP("ORKLOG",0)),U,3)>5000 K ^XTMP("ORKLOG")
;
;if SESSION mode & pharmacy order occurred in session get unsigned med orders
I ORKMODE="SESSION" D
.S ORKDG=$P(ORKA(1),"|",2)
.I $E($G(ORKDG),1,2)="PS" D
..S ORKDGI=0,ORKDGI=$O(^ORD(100.98,"B","PHARMACY",ORKDGI))
..K ^TMP("ORR",$J)
..D EN^ORQ1(DFN_";DPT(",ORKDGI,11,"","","",0,0)
..;store unsigned med orders in ^TMP("ORR",$J for processing in ORKPS
;
;main processing loop:
S ORKX="" F S ORKX=$O(ORKA(ORKX)) Q:ORKX="" D
.S ORKOI=$P(ORKA(ORKX),"|")
.;
.;log debug msgs if parameter is enabled:
.I $G(ORKLOG)="E" D
..S ORKLD=$$NOW^XLFDT
..S ORKLI=0
..I +$P($G(^XTMP("ORKLOG",0)),U,3)<1 S $P(^XTMP("ORKLOG",0),U,3)=0
..S ORKCNT=$P(^XTMP("ORKLOG",0),U,3)+1
..S ^XTMP("ORKLOG",0)=$$FMADD^XLFDT(ORKLD,3,"","","")_U_ORKLD_U_ORKCNT
..S ^XTMP("ORKLOG",ORKLD,ORKDFN,+$G(ORKOI),ORKMODE,DUZ,ORKLI)=ORKA(ORKX)
.;
.S ORKDG=$P(ORKA(ORKX),"|",2),ORKTMODE=""
.S ORKENT="USR^LOC.`"_+$G(ORKLOC)_"^SRV.`"_+$G(ORKSRV)_"^DIV^SYS^PKG"
.Q:'$L($G(ORKDG))
.;
.;if pharmacy order and multiple pharmacy orders in session add data node:
.I $E(ORKDG,1,2)="PS",($L($G(ORKPSA))) D
..S $P(ORKA(ORKX),"|",6)=ORKPSA
.;
.S ORNUM=$P(ORKA(ORKX),"|",5)
.; get correct DUZ for notification processing if in NOTIF mode:
.I ORKMODE="NOTIF" D
..S:+$G(ORNUM)>0 ORKNDUZ=$$ORDERER^ORQOR2(ORNUM) ;ordering provider
..S:+$G(ORNUM)<1 ORKNDUZ=$P($$PRIM^ORQPTQ4(ORKDFN),U) ;prim provider
..I +$G(ORKNDUZ)>0 D
...S ORKSRV=$$GET1^DIQ(200,ORKNDUZ,29,"I") I +ORKSRV>0 S ORKSRV=$P(ORKSRV,U)
...S ORKNENT="USR.`"_+ORKNDUZ_"^LOC.`"_+$G(ORKLOC)_"^SRV.`"_+$G(ORKSRV)_"^DIV^SYS^PKG"
..S:+$G(ORKNDUZ)<1 ORKNENT="LOC.`"_+$G(ORKLOC)_"^DIV^SYS^PKG"
.S ORENT=$S(ORKMODE="NOTIF":ORKNENT,1:ORKENT)
.;
.;If the order is a delayed release order (NOTIF) process all nodes.
.;If it is a renewal, edit or delayed signature order (ALL) process all
.;modes except SESSION which gets processed just before signature:
.I ORKMODE="NOTIF"!(ORKMODE="ALL") S ORKTMODE=ORKMODE D
..D EN^ORKCHK3(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE) ;DISPLAY
..D EN^ORKCHK4(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE) ;SELECT
..D EN^ORKCHK5(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE) ;ACCEPT
..I ORKMODE="NOTIF" D EN^ORKCHK6(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE) ;SESSION
..S ORKMODE=ORKTMODE
.;
.;Process regular orders/modes:
.I '$L($G(ORKTMODE)) D
..I ORKMODE="DISPLAY" D EN^ORKCHK3(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
..I ORKMODE="SELECT" D EN^ORKCHK4(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
..I ORKMODE="ACCEPT" D EN^ORKCHK5(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
..I ORKMODE="SESSION" D EN^ORKCHK6(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
..I ORKMODE="MANUAL" D EN^ORKCHKM(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE) ;IHS/MSC/DKM - Support for manual checks
;
;set messages into sorting array then into ORKY ORKS("ORK",clinical danger level,oi,msg)=ornum^order check ien^clin danger level^message
S ORKX="",ORKI=1
F S ORKX=$O(ORKS("ORK",ORKX)) Q:ORKX="" D
.S ORKY(ORKI)=$E(ORKS("ORK",ORKX),1,250)
.;
.;log debug msgs if parameter is enabled:
.I $G(ORKLOG)="E" D
..S ORKLI=$G(ORKLI)+1
..S ^XTMP("ORKLOG",$$NOW^XLFDT,ORKDFN,+$G(ORKOI),ORKMODE,DUZ,ORKLI)=ORKY(ORKI)
..S $P(^XTMP("ORKLOG",0),U,3)=$P($G(^XTMP("ORKLOG",0)),U,3)+1
.;
.;send moderate and high danger order checks for delayed orders as notifications:
.I ORKMODE="NOTIF" S DNGR=$P(ORKY(ORKI),U,3) I $G(DNGR)<3 D
..S ORKADUZ="",ORNUM=$P(ORKY(ORKI),U)
..S:+$G(ORKNDUZ)>0 ORKADUZ(ORKNDUZ)=""
..S ORKNMSG="Order check: "_$P(ORKY(ORKI),U,4)
..D EN^ORB3(54,ORKDFN,$G(ORNUM),.ORKADUZ,ORKNMSG,"")
.S ORKI=ORKI+1
;
K ^TMP("ORKA",$J),^TMP("ORR",$J)
I $G(ORKLOG)="E" D
.S ORKLI=$G(ORKLI)+1
.S ^XTMP("ORKLOG",$$NOW^XLFDT,ORKDFN,+$G(ORKOI),ORKMODE,DUZ,ORKLI)="LEAVING ORDER CHECKING"
.S $P(^XTMP("ORKLOG",0),U,3)=$P($G(^XTMP("ORKLOG",0)),U,3)+1
D CHKRMT
Q
;
OI2DD(ORPSA,OROI,ORPSPKG) ;rtn dispense drugs for a PS OI
N PSOI
Q:'$D(^ORD(101.43,OROI,0))
S PSOI=$P($P(^ORD(101.43,OROI,0),U,2),";")
Q:+$G(PSOI)<1
D DRG^PSSUTIL1(.ORPSA,PSOI,ORPSPKG)
Q
CHKRMT ;
N I,ORQFLAG
S ORQFLAG=1
S I=0 F S I=$O(ORKA(I)) Q:'I I $E($P(ORKA(I),"|",2),1,2)="PS"!($E($P(ORKA(I),"|",2),1,2)="RA") S ORQFLAG=0
Q:$G(ORQFLAG)
Q:'$$HAVEHDR^ORRDI1
Q:$$LDPTTVAL^ORRDI2($G(DFN))
Q:$P($G(^XTMP("ORRDI","PSOO",ORKDFN,0)),U,3)'<0&($P($G(^XTMP("ORRDI","ART",ORKDFN,0)),U,3)'<0)
I $G(ORKMODE)="ACCEPT" D
. N IFN
. S IFN=$O(ORKY(""),-1)+1
. S ORKY(IFN)="^99^2^Remote Order Checking not available - checks done on local data only"
. K ^TMP($J,"ORRDI") S ^TMP($J,"ORRDI",ORKDFN)=1
I $G(ORKMODE)="SESSION" D
. N I,IFN,ORARR
. S IFN=$O(ORKY(""),-1)
. S I=0 F S I=$O(ORKY(I)) Q:'I S ORARR(+ORKY(I))=""
. S I=0 F S I=$O(ORARR(I)) Q:'I S IFN=IFN+1,ORKY(IFN)=I_"^99^2^Remote Order Checking not available - checks done on local data only"
. K ^TMP($J,"ORRDI") S ^TMP($J,"ORRDI",ORKDFN)=1
Q
ORKCHK ; slc/CLA - Main routine called by OE/RR to initiate order checks ;15-Jun-2010 21:16;PLS
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**6,32,94,105,123,1005,232,267,243,1010**;Dec 17, 1997;Build 47
+2 ; Modified - IHS/MSC/PLS - 06/15/2010 - Line EN+95
EN(ORKY,ORKDFN,ORKA,ORKMODE) ;initiate order checking
+1 ;ORKY: array of returned msgs in format: ornum^orderchk ien^clin danger^msg
+2 ;ORKDFN: patient dfn
+3 ;ORKA: array of order information in the format:
+4 ; orderable item ien|
+5 ; display group-filler app|
+6 ; nat'l id^nat'l text^nat'l code sys^local id^local text^local code sys|
+7 ; effective d/t|
+8 ; order number|
+9 ; filler data (LR: specimen ien, PS: meds prev ordered during this session in format med1^med2^...)
+10 ;ORKMODE: mode/event trigger (DISPLAY,SELECT,ACCEPT,SESSION,ALL,NOTIF)
+11 ; PS: meds previously ordered during this session med1^med2^...
+12 ;
+13 NEW ORKQ,ORKN
SET ORKQ=0
SET ORKN=1
+14 IF +$GET(ORKDFN)<1
SET ORKY(ORKN)="^^^Order Checking Unavailable - invalid patient id"
SET ORKQ=1
SET ORKN=ORKN+1
+15 IF '$LENGTH($GET(ORKMODE))
SET ORKY(ORKN)="^^^Order Checking Unavailable - invalid mode/event"
SET ORKQ=1
SET ORKN=ORKN+1
+16 IF $GET(ORKQ)=1
QUIT
+17 IF +$GET(ORKA)<1
QUIT
+18 NEW ORKX,ORKS,DNGR,ORENT,ORKENT,ORKNENT,ORNUM,ORKOFF,ORKTMODE
+19 NEW ORKADUZ,ORKNDUZ,ORKI,ORKPRIM,ORKNMSG,ORKMSG,ORKLOG,ORKLD,ORKLI,ORKOI
+20 NEW ORKDG,ORKLPS,ORKPSA,ORKCNT,ORKDGI
+21 ;
+22 ;save array of orders for use in session processing:
+23 MERGE ^TMP("ORKA",$JOB)=ORKA
+24 ;
+25 ;get patient's location flag (INPATIENT ONLY - outpt locations cannot be
+26 ;reliably determined, and many simultaneous outpt locations can occur):
+27 NEW DFN,ORKLOC
+28 SET DFN=ORKDFN
SET VA200=""
DO OERR^VADPT
+29 SET ORKLOC=+$GET(^DIC(42,+VAIN(4),44))
+30 KILL VA200,VAIN
+31 ;
+32 ;get user's service/section flag:
+33 NEW ORKSRV
+34 SET ORKSRV=$$GET1^DIQ(200,DUZ,29,"I")
IF +ORKSRV>0
SET ORKSRV=$PIECE(ORKSRV,U)
+35 ;
+36 ;log order check debug messages (or not)
+37 SET ORKLOG=$$GET^XPAR("DIV^SYS^PKG","ORK DEBUG ENABLE/DISABLE",1,"I")
+38 IF $GET(ORKLOG)="D"
KILL ^XTMP("ORKLOG")
SET ^XTMP("ORKLOG",0)=""
+39 IF +$PIECE($GET(^XTMP("ORKLOG",0)),U,3)>5000
KILL ^XTMP("ORKLOG")
+40 ;
+41 ;if SESSION mode & pharmacy order occurred in session get unsigned med orders
+42 IF ORKMODE="SESSION"
Begin DoDot:1
+43 SET ORKDG=$PIECE(ORKA(1),"|",2)
+44 IF $EXTRACT($GET(ORKDG),1,2)="PS"
Begin DoDot:2
+45 SET ORKDGI=0
SET ORKDGI=$ORDER(^ORD(100.98,"B","PHARMACY",ORKDGI))
+46 KILL ^TMP("ORR",$JOB)
+47 DO EN^ORQ1(DFN_";DPT(",ORKDGI,11,"","","",0,0)
+48 ;store unsigned med orders in ^TMP("ORR",$J for processing in ORKPS
End DoDot:2
End DoDot:1
+49 ;
+50 ;main processing loop:
+51 SET ORKX=""
FOR
SET ORKX=$ORDER(ORKA(ORKX))
IF ORKX=""
QUIT
Begin DoDot:1
+52 SET ORKOI=$PIECE(ORKA(ORKX),"|")
+53 ;
+54 ;log debug msgs if parameter is enabled:
+55 IF $GET(ORKLOG)="E"
Begin DoDot:2
+56 SET ORKLD=$$NOW^XLFDT
+57 SET ORKLI=0
+58 IF +$PIECE($GET(^XTMP("ORKLOG",0)),U,3)<1
SET $PIECE(^XTMP("ORKLOG",0),U,3)=0
+59 SET ORKCNT=$PIECE(^XTMP("ORKLOG",0),U,3)+1
+60 SET ^XTMP("ORKLOG",0)=$$FMADD^XLFDT(ORKLD,3,"","","")_U_ORKLD_U_ORKCNT
+61 SET ^XTMP("ORKLOG",ORKLD,ORKDFN,+$GET(ORKOI),ORKMODE,DUZ,ORKLI)=ORKA(ORKX)
End DoDot:2
+62 ;
+63 SET ORKDG=$PIECE(ORKA(ORKX),"|",2)
SET ORKTMODE=""
+64 SET ORKENT="USR^LOC.`"_+$GET(ORKLOC)_"^SRV.`"_+$GET(ORKSRV)_"^DIV^SYS^PKG"
+65 IF '$LENGTH($GET(ORKDG))
QUIT
+66 ;
+67 ;if pharmacy order and multiple pharmacy orders in session add data node:
+68 IF $EXTRACT(ORKDG,1,2)="PS"
IF ($LENGTH($GET(ORKPSA)))
Begin DoDot:2
+69 SET $PIECE(ORKA(ORKX),"|",6)=ORKPSA
End DoDot:2
+70 ;
+71 SET ORNUM=$PIECE(ORKA(ORKX),"|",5)
+72 ; get correct DUZ for notification processing if in NOTIF mode:
+73 IF ORKMODE="NOTIF"
Begin DoDot:2
+74 ;ordering provider
IF +$GET(ORNUM)>0
SET ORKNDUZ=$$ORDERER^ORQOR2(ORNUM)
+75 ;prim provider
IF +$GET(ORNUM)<1
SET ORKNDUZ=$PIECE($$PRIM^ORQPTQ4(ORKDFN),U)
+76 IF +$GET(ORKNDUZ)>0
Begin DoDot:3
+77 SET ORKSRV=$$GET1^DIQ(200,ORKNDUZ,29,"I")
IF +ORKSRV>0
SET ORKSRV=$PIECE(ORKSRV,U)
+78 SET ORKNENT="USR.`"_+ORKNDUZ_"^LOC.`"_+$GET(ORKLOC)_"^SRV.`"_+$GET(ORKSRV)_"^DIV^SYS^PKG"
End DoDot:3
+79 IF +$GET(ORKNDUZ)<1
SET ORKNENT="LOC.`"_+$GET(ORKLOC)_"^DIV^SYS^PKG"
End DoDot:2
+80 SET ORENT=$SELECT(ORKMODE="NOTIF":ORKNENT,1:ORKENT)
+81 ;
+82 ;If the order is a delayed release order (NOTIF) process all nodes.
+83 ;If it is a renewal, edit or delayed signature order (ALL) process all
+84 ;modes except SESSION which gets processed just before signature:
+85 IF ORKMODE="NOTIF"!(ORKMODE="ALL")
SET ORKTMODE=ORKMODE
Begin DoDot:2
+86 ;DISPLAY
DO EN^ORKCHK3(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
+87 ;SELECT
DO EN^ORKCHK4(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
+88 ;ACCEPT
DO EN^ORKCHK5(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
+89 ;SESSION
IF ORKMODE="NOTIF"
DO EN^ORKCHK6(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
+90 SET ORKMODE=ORKTMODE
End DoDot:2
+91 ;
+92 ;Process regular orders/modes:
+93 IF '$LENGTH($GET(ORKTMODE))
Begin DoDot:2
+94 IF ORKMODE="DISPLAY"
DO EN^ORKCHK3(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
+95 IF ORKMODE="SELECT"
DO EN^ORKCHK4(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
+96 IF ORKMODE="ACCEPT"
DO EN^ORKCHK5(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
+97 IF ORKMODE="SESSION"
DO EN^ORKCHK6(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
+98 ;IHS/MSC/DKM - Support for manual checks
IF ORKMODE="MANUAL"
DO EN^ORKCHKM(.ORKS,ORKDFN,ORKA(ORKX),ORENT,ORKTMODE)
End DoDot:2
End DoDot:1
+99 ;
+100 ;set messages into sorting array then into ORKY ORKS("ORK",clinical danger level,oi,msg)=ornum^order check ien^clin danger level^message
+101 SET ORKX=""
SET ORKI=1
+102 FOR
SET ORKX=$ORDER(ORKS("ORK",ORKX))
IF ORKX=""
QUIT
Begin DoDot:1
+103 SET ORKY(ORKI)=$EXTRACT(ORKS("ORK",ORKX),1,250)
+104 ;
+105 ;log debug msgs if parameter is enabled:
+106 IF $GET(ORKLOG)="E"
Begin DoDot:2
+107 SET ORKLI=$GET(ORKLI)+1
+108 SET ^XTMP("ORKLOG",$$NOW^XLFDT,ORKDFN,+$GET(ORKOI),ORKMODE,DUZ,ORKLI)=ORKY(ORKI)
+109 SET $PIECE(^XTMP("ORKLOG",0),U,3)=$PIECE($GET(^XTMP("ORKLOG",0)),U,3)+1
End DoDot:2
+110 ;
+111 ;send moderate and high danger order checks for delayed orders as notifications:
+112 IF ORKMODE="NOTIF"
SET DNGR=$PIECE(ORKY(ORKI),U,3)
IF $GET(DNGR)<3
Begin DoDot:2
+113 SET ORKADUZ=""
SET ORNUM=$PIECE(ORKY(ORKI),U)
+114 IF +$GET(ORKNDUZ)>0
SET ORKADUZ(ORKNDUZ)=""
+115 SET ORKNMSG="Order check: "_$PIECE(ORKY(ORKI),U,4)
+116 DO EN^ORB3(54,ORKDFN,$GET(ORNUM),.ORKADUZ,ORKNMSG,"")
End DoDot:2
+117 SET ORKI=ORKI+1
End DoDot:1
+118 ;
+119 KILL ^TMP("ORKA",$JOB),^TMP("ORR",$JOB)
+120 IF $GET(ORKLOG)="E"
Begin DoDot:1
+121 SET ORKLI=$GET(ORKLI)+1
+122 SET ^XTMP("ORKLOG",$$NOW^XLFDT,ORKDFN,+$GET(ORKOI),ORKMODE,DUZ,ORKLI)="LEAVING ORDER CHECKING"
+123 SET $PIECE(^XTMP("ORKLOG",0),U,3)=$PIECE($GET(^XTMP("ORKLOG",0)),U,3)+1
End DoDot:1
+124 DO CHKRMT
+125 QUIT
+126 ;
OI2DD(ORPSA,OROI,ORPSPKG) ;rtn dispense drugs for a PS OI
+1 NEW PSOI
+2 IF '$DATA(^ORD(101.43,OROI,0))
QUIT
+3 SET PSOI=$PIECE($PIECE(^ORD(101.43,OROI,0),U,2),";")
+4 IF +$GET(PSOI)<1
QUIT
+5 DO DRG^PSSUTIL1(.ORPSA,PSOI,ORPSPKG)
+6 QUIT
CHKRMT ;
+1 NEW I,ORQFLAG
+2 SET ORQFLAG=1
+3 SET I=0
FOR
SET I=$ORDER(ORKA(I))
IF 'I
QUIT
IF $EXTRACT($PIECE(ORKA(I),"|",2),1,2)="PS"!($EXTRACT($PIECE(ORKA(I),"|",2),1,2)="RA")
SET ORQFLAG=0
+4 IF $GET(ORQFLAG)
QUIT
+5 IF '$$HAVEHDR^ORRDI1
QUIT
+6 IF $$LDPTTVAL^ORRDI2($GET(DFN))
QUIT
+7 IF $PIECE($GET(^XTMP("ORRDI","PSOO",ORKDFN,0)),U,3)'<0&($PIECE($GET(^XTMP("ORRDI","ART",ORKDFN,0)),U,3)'<0)
QUIT
+8 IF $GET(ORKMODE)="ACCEPT"
Begin DoDot:1
+9 NEW IFN
+10 SET IFN=$ORDER(ORKY(""),-1)+1
+11 SET ORKY(IFN)="^99^2^Remote Order Checking not available - checks done on local data only"
+12 KILL ^TMP($JOB,"ORRDI")
SET ^TMP($JOB,"ORRDI",ORKDFN)=1
End DoDot:1
+13 IF $GET(ORKMODE)="SESSION"
Begin DoDot:1
+14 NEW I,IFN,ORARR
+15 SET IFN=$ORDER(ORKY(""),-1)
+16 SET I=0
FOR
SET I=$ORDER(ORKY(I))
IF 'I
QUIT
SET ORARR(+ORKY(I))=""
+17 SET I=0
FOR
SET I=$ORDER(ORARR(I))
IF 'I
QUIT
SET IFN=IFN+1
SET ORKY(IFN)=I_"^99^2^Remote Order Checking not available - checks done on local data only"
+18 KILL ^TMP($JOB,"ORRDI")
SET ^TMP($JOB,"ORRDI",ORKDFN)=1
End DoDot:1
+19 QUIT