OCXOED09 ;SLC/RJS,CLA - Rule Editor (Element Expression Display) ;10/29/98 12:37
;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
;
;
S ;
;
Q
EN(OCXD0,OCXD1,OCXR1) ;
;
N OCXACT,OCXRD
F K OCXRD,OCXACT S (OCXRD,OCXACT)="" D DISP(OCXD0,OCXD1,.OCXRD,.OCXACT) Q:$$EN^OCXOED10(OCXD0,OCXD1,.OCXRD,.OCXACT)
;
Q
;
DISP(OCXD0,OCXD1,OCXRD,OCXACT) ;
;
N OCXTHLN,OCXTNLN,OCXTRLN,OCXTULN,OCXTNLN,OCXOPER
;
S OCXTNLN=$C(27,91,48,109),OCXTRLN=$C(27,91,55,109),OCXTULN=$C(27,91,52,109),OCXTHLN=$C(27,91,49,109)
;
D GETDATA(OCXD0,OCXD1,.OCXRD)
;
W @IOF,OCXTNLN
W !,$$CENTER($$FIELD("Element Expression Edit Screen"),80),!!
I $D(OCXRD("ELE",OCXD0,"C",OCXD1,1,"I")) D
.W " ",$$OPT^OCXOEDT("DF"_OCXRD("ELE",OCXD0,"C",OCXD1,1,"I"),"EDDF","10",.OCXACT,$G(OCXRD("ELE",OCXD0,"C",OCXD1,1,"I")))
W " ",$$FIELD("Data Field:")," ",$$DATA($G(OCXRD("ELE",OCXD0,"C",OCXD1,1,"E")),60)
W !
S OCXOPER=$G(OCXRD("ELE",OCXD0,"C",OCXD1,2,"I")) I +OCXOPER S OCXOPER=$P($G(^OCXS(863.9,+OCXOPER,0)),U,4) I $L(OCXOPER) W " ",$$FIELD(" Operator:")," ",$$DATA(OCXOPER,30) I 1
E W " ",$$FIELD(" Operator:")," ",$$DATA($G(OCXRD("ELE",OCXD0,"C",OCXD1,2,"E")),30)
I (+$G(OCXRD("ELE",OCXD0,"C",OCXD1,"PARNUM","I"))=2) D
.W !
.I $L($G(OCXRD("ELE",OCXD0,"C",OCXD1,3,"E"))) D Q
..W " ",$$FIELD(" Value:")," ",$$DATA($G(OCXRD("ELE",OCXD0,"C",OCXD1,3,"E")),60)
.W " ",$$OPT^OCXOEDT("DF"_$G(OCXRD("ELE",OCXD0,"C",OCXD1,4,"I")),"EDDF","10",.OCXACT,$G(OCXRD("ELE",OCXD0,"C",OCXD1,4,"I")))
.W " ",$$FIELD(" Data Field:")," ",$$DATA($G(OCXRD("ELE",OCXD0,"C",OCXD1,4,"E")),60)
I (+$G(OCXRD("ELE",OCXD0,"C",OCXD1,"PARNUM","I"))=3) D
.W !
.W !,$$CENTER("AND",80)
.W !
.I $L($G(OCXRD("ELE",OCXD0,"C",OCXD1,3.1,"E"))) D Q
..W " ",$$FIELD(" Value:")," ",$$DATA($G(OCXRD("ELE",OCXD0,"C",OCXD1,3.1,"E")),60)
.W " ",$$OPT^OCXOEDT("DF"_OCXRD("ELE",OCXD0,"C",OCXD1,5,"I"),"EDDF","10",.OCXACT,$G(OCXRD("ELE",OCXD0,"C",OCXD1,5,"I")))
.W " ",$$FIELD(" Data Field:")," ",$$DATA($G(OCXRD("ELE",OCXD0,"C",OCXD1,5,"E")),60)
W !!," ",$$OPT^OCXOEDT("Edit","EDEXP","10",.OCXACT,OCXD0_","_OCXD1)
;
Q
;
CENTER(X,M) ;
N SP S SP="",$P(SP," ",80)=" " Q $E(SP,1,((M\2)-($L(X)\2)))_X
;
SEP(OCXHDR) ;
;
N SPACES S SPACES="",$P(SPACES," ",80-$L(OCXHDR))=" " Q OCXTNLN_OCXTHLN_OCXTULN_$G(OCXHDR)_SPACES_OCXTNLN
;
FIELD(OCXHDR) ;
;
Q OCXTHLN_$G(OCXHDR)_OCXTNLN
;
DATA(OCXVAL,OCXLEN) ;
;
N SPACES S SPACES="",$P(SPACES," ",OCXLEN+5)=" ",OCXVAL=$G(OCXVAL)
I ($L(OCXVAL)>OCXLEN) Q $E(OCXVAL,1,OCXLEN-3)_"..."
Q $E((OCXVAL_SPACES),1,OCXLEN)
;
GETDATA(OCXD0,OCXD1,OCXD) ;
;
N OCXDIQ,OCXX,OCXDA,OCXOPER,OCXPF,OCXPFN
S OCXDIQ="",OCXDA=OCXD0 D DIQ("^OCXS(860.3,",.OCXDA,"IEN",.OCXDIQ)
M OCXD("ELE")=OCXDIQ(860.3) K OCXDIQ S OCXDIQ=""
S OCXDIQ="",OCXDA=OCXD1,OCXDA(1)=OCXD0 D DIQ("^OCXS(860.3,"_OCXD0_",""COND"",",.OCXDA,"IEN",.OCXDIQ)
M OCXD("ELE",OCXD0,"C")=OCXDIQ(860.31) K OCXDIQ S OCXDIQ=""
S OCXD("ELE",OCXD0,"C",OCXD1,"PARNUM","I")=$$PARNUM(+$G(OCXD("ELE",OCXD0,"C",OCXD1,2,"I")))
Q
PARNUM(OCXOPER) ;
;
N OCXPF,OCXPFN
S OCXPF=$O(^OCXS(863.9,+OCXOPER,"PAR","B","OCXO GENERATE CODE FUNCTION",0)) Q:'OCXPF 0
S OCXPF=$G(^OCXS(863.9,+OCXOPER,"PAR",+OCXPF,"VAL"))
Q:'$L(OCXPF) 0
I OCXPF S OCXPFN=OCXPF
E S OCXPFN=0 F S OCXPFN=$O(^OCXS(863.7,"B",$E(OCXPF,1,30),OCXPFN)) Q:'OCXPFN Q:($P($G(^OCXS(863.7,+OCXPFN,0)),U,1)=OCXPF)
Q:'OCXPFN 0 Q +$O(^OCXS(863.7,+OCXPFN,"PAR",999),-1)
;
DIC(OCXDIC,OCXDIC0,OCXDICA,OCXX,OCXDICS,OCXDR) ;
;
N DIC,X,Y
S DIC=$G(OCXDIC) Q:'$L(DIC) -1
S DIC(0)=$G(OCXDIC0) S:$L($G(OCXX)) X=OCXX
S:$L($G(OCXDICS)) DIC("S")=OCXDICS
S:$L($G(OCXDICA)) DIC("A")=OCXDICA
S:$L($G(OCXDR)) DIC("DR")=OCXDR
D ^DIC Q:(Y<1) 0 Q Y
;
DIQ(DIC,DA,OCXDIQ0,OCXARY) ;
N DR,DIQ S DR=".01:99999",DIQ="OCXARY(",DIQ(0)=$G(OCXDIQ0) D EN^DIQ1
Q
;
OCXOED09 ;SLC/RJS,CLA - Rule Editor (Element Expression Display) ;10/29/98 12:37
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
+2 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
+3 ;
+4 ;
S ;
+1 ;
+2 QUIT
EN(OCXD0,OCXD1,OCXR1) ;
+1 ;
+2 NEW OCXACT,OCXRD
+3 FOR
KILL OCXRD,OCXACT
SET (OCXRD,OCXACT)=""
DO DISP(OCXD0,OCXD1,.OCXRD,.OCXACT)
IF $$EN^OCXOED10(OCXD0,OCXD1,.OCXRD,.OCXACT)
QUIT
+4 ;
+5 QUIT
+6 ;
DISP(OCXD0,OCXD1,OCXRD,OCXACT) ;
+1 ;
+2 NEW OCXTHLN,OCXTNLN,OCXTRLN,OCXTULN,OCXTNLN,OCXOPER
+3 ;
+4 SET OCXTNLN=$CHAR(27,91,48,109)
SET OCXTRLN=$CHAR(27,91,55,109)
SET OCXTULN=$CHAR(27,91,52,109)
SET OCXTHLN=$CHAR(27,91,49,109)
+5 ;
+6 DO GETDATA(OCXD0,OCXD1,.OCXRD)
+7 ;
+8 WRITE @IOF,OCXTNLN
+9 WRITE !,$$CENTER($$FIELD("Element Expression Edit Screen"),80),!!
+10 IF $DATA(OCXRD("ELE",OCXD0,"C",OCXD1,1,"I"))
Begin DoDot:1
+11 WRITE " ",$$OPT^OCXOEDT("DF"_OCXRD("ELE",OCXD0,"C",OCXD1,1,"I"),"EDDF","10",.OCXACT,$GET(OCXRD("ELE",OCXD0,"C",OCXD1,1,"I")))
End DoDot:1
+12 WRITE " ",$$FIELD("Data Field:")," ",$$DATA($GET(OCXRD("ELE",OCXD0,"C",OCXD1,1,"E")),60)
+13 WRITE !
+14 SET OCXOPER=$GET(OCXRD("ELE",OCXD0,"C",OCXD1,2,"I"))
IF +OCXOPER
SET OCXOPER=$PIECE($GET(^OCXS(863.9,+OCXOPER,0)),U,4)
IF $LENGTH(OCXOPER)
WRITE " ",$$FIELD(" Operator:")," ",$$DATA(OCXOPER,30)
IF 1
+15 IF '$TEST
WRITE " ",$$FIELD(" Operator:")," ",$$DATA($GET(OCXRD("ELE",OCXD0,"C",OCXD1,2,"E")),30)
+16 IF (+$GET(OCXRD("ELE",OCXD0,"C",OCXD1,"PARNUM","I"))=2)
Begin DoDot:1
+17 WRITE !
+18 IF $LENGTH($GET(OCXRD("ELE",OCXD0,"C",OCXD1,3,"E")))
Begin DoDot:2
+19 WRITE " ",$$FIELD(" Value:")," ",$$DATA($GET(OCXRD("ELE",OCXD0,"C",OCXD1,3,"E")),60)
End DoDot:2
QUIT
+20 WRITE " ",$$OPT^OCXOEDT("DF"_$GET(OCXRD("ELE",OCXD0,"C",OCXD1,4,"I")),"EDDF","10",.OCXACT,$GET(OCXRD("ELE",OCXD0,"C",OCXD1,4,"I")))
+21 WRITE " ",$$FIELD(" Data Field:")," ",$$DATA($GET(OCXRD("ELE",OCXD0,"C",OCXD1,4,"E")),60)
End DoDot:1
+22 IF (+$GET(OCXRD("ELE",OCXD0,"C",OCXD1,"PARNUM","I"))=3)
Begin DoDot:1
+23 WRITE !
+24 WRITE !,$$CENTER("AND",80)
+25 WRITE !
+26 IF $LENGTH($GET(OCXRD("ELE",OCXD0,"C",OCXD1,3.1,"E")))
Begin DoDot:2
+27 WRITE " ",$$FIELD(" Value:")," ",$$DATA($GET(OCXRD("ELE",OCXD0,"C",OCXD1,3.1,"E")),60)
End DoDot:2
QUIT
+28 WRITE " ",$$OPT^OCXOEDT("DF"_OCXRD("ELE",OCXD0,"C",OCXD1,5,"I"),"EDDF","10",.OCXACT,$GET(OCXRD("ELE",OCXD0,"C",OCXD1,5,"I")))
+29 WRITE " ",$$FIELD(" Data Field:")," ",$$DATA($GET(OCXRD("ELE",OCXD0,"C",OCXD1,5,"E")),60)
End DoDot:1
+30 WRITE !!," ",$$OPT^OCXOEDT("Edit","EDEXP","10",.OCXACT,OCXD0_","_OCXD1)
+31 ;
+32 QUIT
+33 ;
CENTER(X,M) ;
+1 NEW SP
SET SP=""
SET $PIECE(SP," ",80)=" "
QUIT $EXTRACT(SP,1,((M\2)-($LENGTH(X)\2)))_X
+2 ;
SEP(OCXHDR) ;
+1 ;
+2 NEW SPACES
SET SPACES=""
SET $PIECE(SPACES," ",80-$LENGTH(OCXHDR))=" "
QUIT OCXTNLN_OCXTHLN_OCXTULN_$GET(OCXHDR)_SPACES_OCXTNLN
+3 ;
FIELD(OCXHDR) ;
+1 ;
+2 QUIT OCXTHLN_$GET(OCXHDR)_OCXTNLN
+3 ;
DATA(OCXVAL,OCXLEN) ;
+1 ;
+2 NEW SPACES
SET SPACES=""
SET $PIECE(SPACES," ",OCXLEN+5)=" "
SET OCXVAL=$GET(OCXVAL)
+3 IF ($LENGTH(OCXVAL)>OCXLEN)
QUIT $EXTRACT(OCXVAL,1,OCXLEN-3)_"..."
+4 QUIT $EXTRACT((OCXVAL_SPACES),1,OCXLEN)
+5 ;
GETDATA(OCXD0,OCXD1,OCXD) ;
+1 ;
+2 NEW OCXDIQ,OCXX,OCXDA,OCXOPER,OCXPF,OCXPFN
+3 SET OCXDIQ=""
SET OCXDA=OCXD0
DO DIQ("^OCXS(860.3,",.OCXDA,"IEN",.OCXDIQ)
+4 MERGE OCXD("ELE")=OCXDIQ(860.3)
KILL OCXDIQ
SET OCXDIQ=""
+5 SET OCXDIQ=""
SET OCXDA=OCXD1
SET OCXDA(1)=OCXD0
DO DIQ("^OCXS(860.3,"_OCXD0_",""COND"",",.OCXDA,"IEN",.OCXDIQ)
+6 MERGE OCXD("ELE",OCXD0,"C")=OCXDIQ(860.31)
KILL OCXDIQ
SET OCXDIQ=""
+7 SET OCXD("ELE",OCXD0,"C",OCXD1,"PARNUM","I")=$$PARNUM(+$GET(OCXD("ELE",OCXD0,"C",OCXD1,2,"I")))
+8 QUIT
PARNUM(OCXOPER) ;
+1 ;
+2 NEW OCXPF,OCXPFN
+3 SET OCXPF=$ORDER(^OCXS(863.9,+OCXOPER,"PAR","B","OCXO GENERATE CODE FUNCTION",0))
IF 'OCXPF
QUIT 0
+4 SET OCXPF=$GET(^OCXS(863.9,+OCXOPER,"PAR",+OCXPF,"VAL"))
+5 IF '$LENGTH(OCXPF)
QUIT 0
+6 IF OCXPF
SET OCXPFN=OCXPF
+7 IF '$TEST
SET OCXPFN=0
FOR
SET OCXPFN=$ORDER(^OCXS(863.7,"B",$EXTRACT(OCXPF,1,30),OCXPFN))
IF 'OCXPFN
QUIT
IF ($PIECE($GET(^OCXS(863.7,+OCXPFN,0)),U,1)=OCXPF)
QUIT
+8 IF 'OCXPFN
QUIT 0
QUIT +$ORDER(^OCXS(863.7,+OCXPFN,"PAR",999),-1)
+9 ;
DIC(OCXDIC,OCXDIC0,OCXDICA,OCXX,OCXDICS,OCXDR) ;
+1 ;
+2 NEW DIC,X,Y
+3 SET DIC=$GET(OCXDIC)
IF '$LENGTH(DIC)
QUIT -1
+4 SET DIC(0)=$GET(OCXDIC0)
IF $LENGTH($GET(OCXX))
SET X=OCXX
+5 IF $LENGTH($GET(OCXDICS))
SET DIC("S")=OCXDICS
+6 IF $LENGTH($GET(OCXDICA))
SET DIC("A")=OCXDICA
+7 IF $LENGTH($GET(OCXDR))
SET DIC("DR")=OCXDR
+8 DO ^DIC
IF (Y<1)
QUIT 0
QUIT Y
+9 ;
DIQ(DIC,DA,OCXDIQ0,OCXARY) ;
+1 NEW DR,DIQ
SET DR=".01:99999"
SET DIQ="OCXARY("
SET DIQ(0)=$GET(OCXDIQ0)
DO EN^DIQ1
+2 QUIT
+3 ;