1 | OCXODSP2 ;SLC/RJS,CLA - Rule Display (Display an Element) ;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 | ;
|
---|
5 | EN(OCXD0,OCXTAB,OCXRM) ;
|
---|
6 | ;
|
---|
7 | N OCXD1,OCXD,OCXRD,OCXE,OCXSUB,OCXDF
|
---|
8 | ;
|
---|
9 | S OCXTAB=+$G(OCXTAB) S:'$G(OCXD0) OCXD0=+$$DIC("^OCXS(860.3,","AEMQ") Q:'OCXD0
|
---|
10 | ;
|
---|
11 | S OCXRD="" D DIQ("^OCXS(860.3,",OCXD0,.OCXRD)
|
---|
12 | F OCXSUB="COND" S OCXD1=0 F S OCXD1=$O(^OCXS(860.3,OCXD0,OCXSUB,OCXD1)) Q:'OCXD1 D
|
---|
13 | .S OCXD(0)=OCXD0,OCXD=OCXD1 D DIQ("^OCXS(860.3,"_OCXD0_","""_OCXSUB_""",",.OCXD,.OCXRD)
|
---|
14 | ;
|
---|
15 | W !
|
---|
16 | W ! D FIELD("Event-Element Name:",$G(OCXRD(860.3,OCXD0,.01,"E")),OCXTAB,OCXRM)
|
---|
17 | W ! D FIELD(" Data Context:",$G(OCXRD(860.3,OCXD0,.02,"E")),OCXTAB,OCXRM)
|
---|
18 | W ! D FIELD(" Compiled Routine:",$G(OCXRD(860.3,OCXD0,3,"E")),OCXTAB,OCXRM)
|
---|
19 | ;
|
---|
20 | S OCXD1=0 F S OCXD1=$O(OCXRD(860.31,OCXD1)) Q:'OCXD1 D
|
---|
21 | .N OUTSTR,OCXE,PARNUM,OCXFLD
|
---|
22 | .S PARNUM=$$PARNUM(+$G(OCXRD(860.31,OCXD1,2,"I")))
|
---|
23 | .S OUTSTR=""
|
---|
24 | .I '$D(OCXRD(860.31,OCXD1,1,"E")) S OUTSTR="** Error ** Primary Data Field Missing "
|
---|
25 | .I '$D(OCXRD(860.31,OCXD1,2,"E")) S OUTSTR="** Error ** Operator Missing "
|
---|
26 | .I (PARNUM=1) D
|
---|
27 | ..Q:'$D(OCXRD(860.31,OCXD1,1,"E")) Q:'$D(OCXRD(860.31,OCXD1,2,"E"))
|
---|
28 | ..S OUTSTR="|"_OCXRD(860.31,OCXD1,1,"E")_"| is '"_OCXRD(860.31,OCXD1,2,"E")_"'"
|
---|
29 | .I (PARNUM=2) D
|
---|
30 | ..N FLD2
|
---|
31 | ..Q:'$D(OCXRD(860.31,OCXD1,1,"E")) Q:'$D(OCXRD(860.31,OCXD1,2,"E"))
|
---|
32 | ..I $D(OCXRD(860.31,OCXD1,3,"E")) S FLD2="'"_OCXRD(860.31,OCXD1,3,"E")_"'"
|
---|
33 | ..E I $D(OCXRD(860.31,OCXD1,4,"E")) S FLD2="("_OCXRD(860.31,OCXD1,4,"E")_")"
|
---|
34 | ..E S OUTSTR="** Error ** Second Value Missing "
|
---|
35 | ..S OUTSTR="|"_OCXRD(860.31,OCXD1,1,"E")_"| "_OCXRD(860.31,OCXD1,2,"E")_" "_FLD2
|
---|
36 | .I (PARNUM=3) D
|
---|
37 | ..N FLD2,FLD3
|
---|
38 | ..Q:'$D(OCXRD(860.31,OCXD1,1,"E")) Q:'$D(OCXRD(860.31,OCXD1,2,"E"))
|
---|
39 | ..I $D(OCXRD(860.31,OCXD1,3,"E")) S FLD2="'"_OCXRD(860.31,OCXD1,3,"E")_"'"
|
---|
40 | ..E I $D(OCXRD(860.31,OCXD1,4,"E")) S FLD2="|"_OCXRD(860.31,OCXD1,4,"E")_"|"
|
---|
41 | ..E S OUTSTR="** Error ** Second Value Missing "
|
---|
42 | ..I $D(OCXRD(860.31,OCXD1,3.1,"E")) S FLD3="'"_OCXRD(860.31,OCXD1,3.1,"E")_"'"
|
---|
43 | ..E I $D(OCXRD(860.31,OCXD1,5,"E")) S FLD3="|"_OCXRD(860.31,OCXD1,5,"E")_"|"
|
---|
44 | ..E S OUTSTR="** Error ** Third Value Missing "
|
---|
45 | ..S OUTSTR="|"_OCXRD(860.31,OCXD1,1,"E")_"| "_OCXRD(860.31,OCXD1,2,"E")_" "_FLD2_" and "_FLD3
|
---|
46 | .;
|
---|
47 | .F OCXFLD=1,4,5 S:$D(OCXRD(860.31,OCXD1,OCXFLD,"I")) OCXDF(OCXRD(860.31,OCXD1,OCXFLD,"I"))=""
|
---|
48 | .;
|
---|
49 | .W ! D FIELD(" Expression #"_(+$G(OCXRD(860.31,OCXD1,.01,"E")))_": IF ",OUTSTR,OCXTAB,OCXRM)
|
---|
50 | ;
|
---|
51 | S OCXDF=0 F S OCXDF=$O(OCXDF(OCXDF)) Q:'OCXDF D EN^OCXODSP3(OCXDF,OCXTAB+OCXOFF,OCXRM,+$G(OCXRD(860.3,OCXD0,.02,"I")))
|
---|
52 | ;
|
---|
53 | Q
|
---|
54 | ;
|
---|
55 | PARNUM(OCXOPER) ;
|
---|
56 | ;
|
---|
57 | N OCXPF,OCXPFN
|
---|
58 | S OCXPF=$O(^OCXS(863.9,+OCXOPER,"PAR","B","OCXO GENERATE CODE FUNCTION",0)) Q:'OCXPF 0
|
---|
59 | S OCXPF=$G(^OCXS(863.9,+OCXOPER,"PAR",+OCXPF,"VAL"))
|
---|
60 | Q:'$L(OCXPF) 0
|
---|
61 | I OCXPF S OCXPFN=OCXPF
|
---|
62 | 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)
|
---|
63 | Q:'OCXPFN 0 Q +$O(^OCXS(863.7,+OCXPFN,"PAR",999),-1)
|
---|
64 | ;
|
---|
65 | FIELD(TITLE,STRING,TAB,MARGIN) ;
|
---|
66 | ;
|
---|
67 | W ?TAB,TITLE
|
---|
68 | ;
|
---|
69 | N PTR,SUBSTR,STRLEN
|
---|
70 | ;
|
---|
71 | S STRLEN=MARGIN-($L(TITLE)+TAB)-5
|
---|
72 | S SUBSTR="" F PTR=1:1:$L(STRING," ") D
|
---|
73 | .I ($L(SUBSTR)>STRLEN) W ?(TAB+$L(TITLE)+1),SUBSTR W:$L($P(STRING," ",PTR+1)) ! S SUBSTR=""
|
---|
74 | .S:$L(SUBSTR) SUBSTR=SUBSTR_" " S SUBSTR=SUBSTR_$P(STRING," ",PTR)
|
---|
75 | W:$L(SUBSTR) ?(TAB+$L(TITLE)+1),SUBSTR
|
---|
76 | Q
|
---|
77 | ;
|
---|
78 | DIC(OCXDIC,OCXDIC0,OCXDICA,OCXX,OCXDICS,OCXDR) ;
|
---|
79 | ;
|
---|
80 | N DIC,X,Y
|
---|
81 | S DIC=$G(OCXDIC) Q:'$L(DIC) -1
|
---|
82 | S DIC(0)=$G(OCXDIC0) S:$L($G(OCXX)) X=OCXX
|
---|
83 | S:$L($G(OCXDICS)) DIC("S")=OCXDICS
|
---|
84 | S:$L($G(OCXDICA)) DIC("A")=OCXDICA
|
---|
85 | S:$L($G(OCXDR)) DIC("DR")=OCXDR
|
---|
86 | D ^DIC Q:(Y<1) 0 Q Y
|
---|
87 | ;
|
---|
88 | ;
|
---|
89 | DIQ(DIC,DA,OCXARY) ;
|
---|
90 | ;
|
---|
91 | N DR,DIQ S DR=".01:99999",DIQ="OCXARY(",DIQ(0)="IEN" D EN^DIQ1
|
---|
92 | Q
|
---|
93 | ;
|
---|