source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOED01.m@ 1211

Last change on this file since 1211 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.9 KB
Line 
1OCXOED01 ;SLC/RJS,CLA - Rule Editor (Rule Display) ;10/29/98 12:37
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32**;Dec 17,1997
3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
4 ;
5S ;
6 Q
7EN(OCXR0) ;
8 ;
9 N OCXACT,OCXRD
10 F K OCXRD,OCXACT S (OCXRD,OCXACT)="" D GETDATA(OCXR0,.OCXRD),DISP(OCXR0,.OCXRD,.OCXACT) Q:$$EN^OCXOED02(OCXR0,.OCXRD,.OCXACT)
11 ;
12 Q
13 ;
14DISP(OCXR0,OCXRD,OCXACT) ;
15 ;
16 N OCXTHLN,OCXTNLN,OCXTRLN,OCXTULN,OCXTNLN,OCXPREV,OCXNDX
17 ;
18 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)
19 ;
20 W @IOF,OCXTNLN
21 W !,$$CENTER($$FIELD("Rule Edit Screen"),80),!
22 W " ",$$OPT^OCXOEDT("Edit Rule","EDRULE","02",.OCXACT,OCXR0,"ER")
23 W " ",$$FIELD("Rule:")," ",$$DATA($G(OCXRD("RUL",OCXR0,.01,"E")),30)
24 W " ",$$FIELD("Status:")," ",$$DATA($G(OCXRD("RUL",OCXR0,.02,"E")),10)
25 ;
26 W !!,$$SEP("Event/Element Definitions"),!
27 S OCXR1=0 F S OCXR1=$O(OCXRD("RUL",OCXR0,"ELE",OCXR1)) Q:'OCXR1 D
28 .N OCORD,OCXTYP,OCXNDX,OCXSYM,OCXTRAN,OCXR2,OCXNAM
29 .S OCXSYM=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.01,"E"))
30 .S OCXTYP=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.02,"I")) Q:OCXTYP
31 .S OCXTRAN=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,1,"E")),OCXNDX=$O(OCXRD("ORD",999),-1)\1+1
32 .S OCXRD("ORD",OCXNDX,0)=OCXR1,OCXRD("ORD",OCXNDX,1)=OCXSYM,OCXRD("ORD",OCXNDX,2)=OCXTRAN
33 ;
34 S OCXR1=0 F S OCXR1=$O(OCXRD("RUL",OCXR0,"ELE",OCXR1)) Q:'OCXR1 D
35 .S OCXSYM=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.01,"E"))
36 .S OCXTYP=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.02,"I")) Q:'OCXTYP
37 .S OCXTRAN=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,2,"E"))
38 .S OCXR2=$O(OCXRD("ORD",0)) F S OCXPREV=OCXR2,OCXR2=$O(OCXRD("ORD",OCXR2)) Q:'OCXPREV D
39 ..S OCXNAM=$G(OCXRD("ORD",OCXPREV,1)) I $L(OCXNAM),(OCXTRAN[OCXNAM) S OCXNDX=$$BTW(OCXPREV,OCXR2)
40 .S OCXRD("ORD",OCXNDX,0)=OCXR1,OCXRD("ORD",OCXNDX,1)=OCXSYM,OCXRD("ORD",OCXNDX,2)=OCXTRAN
41 ;
42 S OCXNDX=0 F S OCXNDX=$O(OCXRD("ORD",OCXNDX)) Q:'OCXNDX D
43 .N OCXTYP,OCXR1
44 .S OCXR1=+$G(OCXRD("ORD",OCXNDX,0)) Q:'OCXR1
45 .W !
46 .W " ",$$OPT^OCXOEDT("T"_OCXR1,"EDRELE","02",.OCXACT,OCXR0_","_OCXR1)," "
47 .S OCXTYP=$G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.02,"I"))
48 .I OCXTYP W $$FIELD("*")
49 .I 'OCXTYP W " "
50 .W $G(OCXRD("RUL",OCXR0,"ELE",OCXR1,.01,"E"))
51 .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))
52 .;
53 W !
54 W !," ",$$OPT^OCXOEDT("Add Element","EOPT","02",.OCXACT,"""ADD"","_OCXR0,"AE")
55 W " ",$$OPT^OCXOEDT("Delete Element","EOPT","02",.OCXACT,"""DEL"","_OCXR0,"DE")
56 ;
57 W !!,$$SEP("Relation Descriptions"),!
58 S OCXR1=0 F S OCXR1=$O(OCXRD("RUL",OCXR0,"REL",OCXR1)) Q:'OCXR1 D
59 .W !
60 .W " ",$$OPT^OCXOEDT("R"_OCXR1,"EDRREL","02",.OCXACT,OCXR0_","_OCXR1)
61 .W " ",$$DATA($J(OCXR1,2)_". ",5)
62 .N OCXWORD,OCXEXP
63 .S OCXEXP=$G(OCXRD("RUL",OCXR0,"REL",OCXR1,1,"E"))
64 .S OCXSC1=$G(OCXRD("RUL",OCXR0,"REL",OCXR1,7,"E"))
65 .F OCXWORD=1:1:$L(OCXEXP," ") W:($X>70) !," " W $P(OCXEXP," ",OCXWORD)," "
66 .I $L(OCXSC1) W $$FIELD(" ("_OCXSC1_")")
67 W !
68 W !," ",$$OPT^OCXOEDT("Add Relation","ROPT","02",.OCXACT,"""ADD"","_OCXR0,"AR")
69 W " ",$$OPT^OCXOEDT("Delete Relation","ROPT","02",.OCXACT,"""DEL"","_OCXR0,"DR")
70 ;
71 Q
72 ;
73XLATE(X) ;
74 N N S N=$E(X,$L(X))
75 Q (+X)_" "_$S((N="S"):"Seconds",(N="M"):"Minutes",(N="H"):"Hours",(N="D"):"Days",1:"???")
76 ;
77BTW(X,Y) S:'Y Y=999 Q (Y-((Y-X)/2))
78 ;
79 ;
80CENTER(X,M) ;
81 N SP S SP="",$P(SP," ",80)=" " Q $E(SP,1,((M\2)-($L(X)\2)))_X
82 ;
83SEP(OCXHDR) ;
84 ;
85 N SPACES S SPACES="",$P(SPACES," ",80-$L(OCXHDR))=" " Q OCXTNLN_OCXTHLN_OCXTULN_$G(OCXHDR)_SPACES_OCXTNLN
86 ;
87FIELD(OCXHDR) ;
88 ;
89 Q OCXTHLN_$G(OCXHDR)_OCXTNLN
90 ;
91DATA(OCXVAL,OCXLEN) ;
92 ;
93 N SPACES S SPACES="",$P(SPACES," ",OCXLEN+5)=" ",OCXVAL=$G(OCXVAL)
94 I ($L(OCXVAL)>OCXLEN) Q $E(OCXVAL,1,OCXLEN-3)_"..."
95 Q $E((OCXVAL_SPACES),1,OCXLEN)
96 ;
97GETDATA(OCXD0,OCXD) ;
98 ;
99 N OCXDIQ,OCXX
100 S OCXDIQ="" D DIQ("^OCXS(860.2,",OCXD0,"IEN",.OCXDIQ)
101 M OCXD("RUL")=OCXDIQ(860.2) K OCXDIQ S OCXDIQ=""
102 S OCXX=0 F S OCXX=$O(^OCXS(860.2,OCXD0,"C",OCXX)) Q:'OCXX W "." D
103 .D GETMULT(OCXD0,OCXX,"C","ELE",860.21,.OCXD)
104 .D GETELEM(OCXD0,OCXX,"C","ELE",860.21,.OCXD)
105 S OCXX=0 F S OCXX=$O(^OCXS(860.2,OCXD0,"R",OCXX)) Q:'OCXX W "." D
106 .D GETMULT(OCXD0,OCXX,"R","REL",860.22,.OCXD)
107 Q
108 ;
109GETMULT(OCXD0,OCXD1,OCXSUB,OCXSLOT,OCXSUBD,OCXD) ;
110 ;
111 N OCXDIQ
112 S OCXDIQ="" D DIQ("^OCXS(860.2,"_OCXD0_","""_OCXSUB_""",",OCXD1,"IEN",.OCXDIQ)
113 M OCXD("RUL",OCXD0,OCXSLOT)=OCXDIQ(OCXSUBD) K OCXDIQ S OCXDIQ=""
114 Q
115 ;
116GETELEM(OCXD0,OCXD1,OCXSUB,OCXSLOT,OCXSUBD,OCXD) ;
117 ;
118 N OCXDIQ,OCXELE
119 S OCXELE=$G(OCXD("RUL",OCXD0,"ELE",OCXD1,1,"I")) Q:'OCXELE
120 S OCXDIQ="" D DIQ("^OCXS(860.3,",OCXELE,"IEN",.OCXDIQ)
121 M OCXD("RUL",OCXD0,"ELE",OCXD1,1,"SRC")=OCXDIQ(860.3,OCXELE) K OCXDIQ S OCXDIQ=""
122 Q
123 ;
124DIC(OCXDIC,OCXDIC0,OCXDICA,OCXX,OCXDICS,OCXDR) ;
125 ;
126 N DIC,X,Y
127 S DIC=$G(OCXDIC) Q:'$L(DIC) -1
128 S DIC(0)=$G(OCXDIC0) S:$L($G(OCXX)) X=OCXX
129 S:$L($G(OCXDICS)) DIC("S")=OCXDICS
130 S:$L($G(OCXDICA)) DIC("A")=OCXDICA
131 S:$L($G(OCXDR)) DIC("DR")=OCXDR
132 D ^DIC Q:(Y<1) 0 Q Y
133 ;
134DIQ(DIC,DA,OCXDIQ0,OCXARY) ;
135 N DR,DIQ S DR=".01:99999",DIQ="OCXARY(",DIQ(0)=$G(OCXDIQ0) D EN^DIQ1
136 Q
137 ;
Note: See TracBrowser for help on using the repository browser.