Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: OCXOED01

OCXOED01.m

Go to the documentation of this file.
OCXOED01 ;SLC/RJS,CLA - Rule Editor (Rule 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(OCXR0) ;
 ;
 N OCXACT,OCXRD
 F  K OCXRD,OCXACT S (OCXRD,OCXACT)="" D GETDATA(OCXR0,.OCXRD),DISP(OCXR0,.OCXRD,.OCXACT) Q:$$EN^OCXOED02(OCXR0,.OCXRD,.OCXACT)
 ;
 Q
 ;
DISP(OCXR0,OCXRD,OCXACT) ;
 ;
 N OCXTHLN,OCXTNLN,OCXTRLN,OCXTULN,OCXTNLN,OCXPREV,OCXNDX
 ;
 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 @IOF,OCXTNLN
 W !,$$CENTER($$FIELD("Rule Edit Screen"),80),!
 W "  ",$$OPT^OCXOEDT("Edit Rule","EDRULE","02",.OCXACT,OCXR0,"ER")
 W "  ",$$FIELD("Rule:")," ",$$DATA($G(OCXRD("RUL",OCXR0,.01,"E")),30)
 W "  ",$$FIELD("Status:")," ",$$DATA($G(OCXRD("RUL",OCXR0,.02,"E")),10)
 ;
 W !!,$$SEP("Event/Element Definitions"),!
 S OCXR1=0 F  S OCXR1=$O(OCXRD("RUL",OCXR0,"ELE",OCXR1)) Q:'OCXR1  D
 .N OCORD,OCXTYP,OCXNDX,OCXSYM,OCXTRAN,OCXR2,OCXNAM
 .S OCXSYM=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.01,"E"))
 .S OCXTYP=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.02,"I")) Q:OCXTYP
 .S OCXTRAN=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,1,"E")),OCXNDX=$O(OCXRD("ORD",999),-1)\1+1
 .S OCXRD("ORD",OCXNDX,0)=OCXR1,OCXRD("ORD",OCXNDX,1)=OCXSYM,OCXRD("ORD",OCXNDX,2)=OCXTRAN
 ;
 S OCXR1=0 F  S OCXR1=$O(OCXRD("RUL",OCXR0,"ELE",OCXR1)) Q:'OCXR1  D
 .S OCXSYM=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.01,"E"))
 .S OCXTYP=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.02,"I")) Q:'OCXTYP
 .S OCXTRAN=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,2,"E"))
 .S OCXR2=$O(OCXRD("ORD",0)) F  S OCXPREV=OCXR2,OCXR2=$O(OCXRD("ORD",OCXR2)) Q:'OCXPREV  D
 ..S OCXNAM=$G(OCXRD("ORD",OCXPREV,1)) I $L(OCXNAM),(OCXTRAN[OCXNAM) S OCXNDX=$$BTW(OCXPREV,OCXR2)
 .S OCXRD("ORD",OCXNDX,0)=OCXR1,OCXRD("ORD",OCXNDX,1)=OCXSYM,OCXRD("ORD",OCXNDX,2)=OCXTRAN
 ;
 S OCXNDX=0 F  S OCXNDX=$O(OCXRD("ORD",OCXNDX)) Q:'OCXNDX  D
 .N OCXTYP,OCXR1
 .S OCXR1=+$G(OCXRD("ORD",OCXNDX,0)) Q:'OCXR1
 .W !
 .W " ",$$OPT^OCXOEDT("T"_OCXR1,"EDRELE","02",.OCXACT,OCXR0_","_OCXR1)," "
 .S OCXTYP=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.02,"I"))
 .I OCXTYP W $$FIELD("*")
 .I 'OCXTYP W " "
 .W $G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.01,"E"))
 .I $L($G(OCXRD("RUL",OCXR0,"ELE",OCXR1,1,"SRC",2,"E"))) W $$FIELD(" From: "),$$DATA($G(OCXRD("RUL",OCXR0,"ELE",OCXR1,1,"SRC",2,"E")),(90-$X))
 .;
 W !
 W !,"    ",$$OPT^OCXOEDT("Add Element","EOPT","02",.OCXACT,"""ADD"","_OCXR0,"AE")
 W "    ",$$OPT^OCXOEDT("Delete Element","EOPT","02",.OCXACT,"""DEL"","_OCXR0,"DE")
 ;
 W !!,$$SEP("Relation Descriptions"),!
 S OCXR1=0 F  S OCXR1=$O(OCXRD("RUL",OCXR0,"REL",OCXR1)) Q:'OCXR1  D
 .W !
 .W "  ",$$OPT^OCXOEDT("R"_OCXR1,"EDRREL","02",.OCXACT,OCXR0_","_OCXR1)
 .W "  ",$$DATA($J(OCXR1,2)_". ",5)
 .N OCXWORD,OCXEXP
 .S OCXEXP=$G(OCXRD("RUL",OCXR0,"REL",OCXR1,1,"E"))
 .S OCXSC1=$G(OCXRD("RUL",OCXR0,"REL",OCXR1,7,"E"))
 .F OCXWORD=1:1:$L(OCXEXP," ")  W:($X>70) !,"               " W $P(OCXEXP," ",OCXWORD)," "
 .I $L(OCXSC1) W $$FIELD(" ("_OCXSC1_")")
 W !
 W !,"  ",$$OPT^OCXOEDT("Add Relation","ROPT","02",.OCXACT,"""ADD"","_OCXR0,"AR")
 W "  ",$$OPT^OCXOEDT("Delete Relation","ROPT","02",.OCXACT,"""DEL"","_OCXR0,"DR")
 ;
 Q
 ;
XLATE(X) ;
 N N S N=$E(X,$L(X))
 Q (+X)_" "_$S((N="S"):"Seconds",(N="M"):"Minutes",(N="H"):"Hours",(N="D"):"Days",1:"???")
 ;
BTW(X,Y) S:'Y Y=999 Q (Y-((Y-X)/2))
 ;
 ;
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,OCXD) ;
 ;
 N OCXDIQ,OCXX
 S OCXDIQ="" D DIQ("^OCXS(860.2,",OCXD0,"IEN",.OCXDIQ)
 M OCXD("RUL")=OCXDIQ(860.2) K OCXDIQ S OCXDIQ=""
 S OCXX=0 F  S OCXX=$O(^OCXS(860.2,OCXD0,"C",OCXX)) Q:'OCXX  W "." D
 .D GETMULT(OCXD0,OCXX,"C","ELE",860.21,.OCXD)
 .D GETELEM(OCXD0,OCXX,"C","ELE",860.21,.OCXD)
 S OCXX=0 F  S OCXX=$O(^OCXS(860.2,OCXD0,"R",OCXX)) Q:'OCXX  W "." D
 .D GETMULT(OCXD0,OCXX,"R","REL",860.22,.OCXD)
 Q
 ;
GETMULT(OCXD0,OCXD1,OCXSUB,OCXSLOT,OCXSUBD,OCXD) ;
 ;
 N OCXDIQ
 S OCXDIQ="" D DIQ("^OCXS(860.2,"_OCXD0_","""_OCXSUB_""",",OCXD1,"IEN",.OCXDIQ)
 M OCXD("RUL",OCXD0,OCXSLOT)=OCXDIQ(OCXSUBD) K OCXDIQ S OCXDIQ=""
 Q
 ;
GETELEM(OCXD0,OCXD1,OCXSUB,OCXSLOT,OCXSUBD,OCXD) ;
 ;
 N OCXDIQ,OCXELE
 S OCXELE=$G(OCXD("RUL",OCXD0,"ELE",OCXD1,1,"I")) Q:'OCXELE
 S OCXDIQ="" D DIQ("^OCXS(860.3,",OCXELE,"IEN",.OCXDIQ)
 M OCXD("RUL",OCXD0,"ELE",OCXD1,1,"SRC")=OCXDIQ(860.3,OCXELE) K OCXDIQ S OCXDIQ=""
 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
 ;
DIQ(DIC,DA,OCXDIQ0,OCXARY) ;
 N DR,DIQ S DR=".01:99999",DIQ="OCXARY(",DIQ(0)=$G(OCXDIQ0) D EN^DIQ1
 Q
 ;