VistA-FOIAVistA/r/ORDER_ENTRY_RESULTS_REPORTI.../OCXOEDT.m

80 lines
2.7 KiB
Mathematica

OCXOEDT ;SLC/RJS,CLA - Rule Editor (Main Routine) ;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 ;
;
N OCXY,OCXTHLN,OCXTNLN,OCXTRLN,OCXTULN
;
;
I '$D(IOF) S IOP="HOME" D ^%ZIS K IOP
D RM(0),EN^OCXOED15
;
Q
;
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
;
CONV ;
;
S OCXR0=0 F S OCXR0=$O(^OCXS(860.2,OCXR0)) Q:'OCXR0 D
.W !,$P(^OCXS(860.2,OCXR0,0),U,1)
.S OCXVAL=$G(^OCXS(860.2,OCXR0,"C",0))
.I $L(OCXVAL),(OCXVAL["P") W !,?5,OCXVAL S OCXVAL=$P(OCXVAL,"P",1)_$P(OCXVAL,"P",2) W " ",OCXVAL S ^OCXS(860.2,OCXR0,"C",0)=OCXVAL
.S OCXVAL=$G(^OCXS(860.2,OCXR0,"R",0))
.I $L(OCXVAL),(OCXVAL["P") W !,?5,OCXVAL S OCXVAL=$P(OCXVAL,"P",1)_$P(OCXVAL,"P",2) W " ",OCXVAL S ^OCXS(860.2,OCXR0,"R",0)=OCXVAL
.;S OCXD1=0 F S OCXD1=$O(^OCXS(860.2,OCXR0,"C",OCXD1)) Q:'OCXD1 D
.;.S OCXVAL=^OCXS(860.2,OCXR0,"C",OCXD1,0)
.;.W !,?10,$P(^OCXS(860.3,+$P(OCXVAL,U,2),0),U,1)," ",OCXVAL S $P(OCXVAL,U,3)=0 W " ",OCXVAL
.;.S ^OCXS(860.2,OCXR0,"C",OCXD1,0)=OCXVAL
;
Q
;
RM(X) X ^%ZOSF("RM") Q
;
OPT(OCXSUB,OCXLN,OCXRTN,OCXACT,OCXPAR,OCXSYN) ;
;
N OCXSUBC
Q:$D(OCXACT(OCXSUB)) ""
S OCXSUBC=$TR(OCXSUB,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
S OCXACT("B",OCXSUB)=""
S OCXACT(OCXSUBC)="D "_OCXLN_"^OCXOED"_OCXRTN_$S($L($G(OCXPAR)):"("_$G(OCXPAR)_")",1:"")
I $L($G(OCXSYN)) D Q OCXTHLN_OCXTRLN_" "_OCXSYN_" "_OCXSUB_" "_OCXTNLN
.S OCXSUBC=$TR(OCXSYN,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
.S OCXACT(OCXSUBC)="D "_OCXLN_"^OCXOED"_OCXRTN_$S($L($G(OCXPAR)):"("_$G(OCXPAR)_")",1:"")
.S OCXACT("B",OCXSUBC)=""
Q OCXTHLN_OCXTRLN_" "_OCXSUB_" "_OCXTNLN
;
GETOPT(OCXACT) ;
;
N OCXOPT,OCXTHLN,OCXTNLN,OCXTRLN,OCXTULN
;
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)
;
W !!,OCXTHLN,"Option List -> "
;
S OCXOPT="" F S OCXOPT=$O(OCXACT("B",OCXOPT)) Q:'$L(OCXOPT) D
.W:($X>70) !," " W OCXOPT W:$L($O(OCXACT("B",OCXOPT))) ", "
;
W !!,OCXTNLN,"Choose an Option: " R OCXOPT:DTIME E Q U
Q:'$L(OCXOPT) U
Q:(OCXOPT[U) U
;
S OCXOPT=$TR(OCXOPT,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
;
Q:$D(OCXACT(OCXOPT)) OCXACT(OCXOPT)
;
I '($E($O(OCXACT(OCXOPT)),1,$L(OCXOPT))=OCXOPT) W !!,"Selection not in list... " H 2 Q ""
I ($E($O(OCXACT($O(OCXACT(OCXOPT)))),1,$L(OCXOPT))=OCXOPT) W !!,"Selection is ambiguous and matches more than one option... " H 2 Q ""
;
Q OCXACT($O(OCXACT(OCXOPT)))
;