source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORY2342.m@ 861

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

initial load of WorldVistAEHR

File size: 4.4 KB
Line 
1ORY2342 ;SLC/RJS,CLA - OCX PACKAGE RULE TRANSPORT ROUTINE (Delete after Install of OR*3*234) ;MAY 13,2005 at 09:31
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**234**;Dec 17,1997
3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
4 ;
5S ;
6 ; Record Utilities
7 Q
8 ;
9ADDREC(OCXCREF) ;
10 ;
11 N QUIT,OCXDD,OCXDA,OCXGREF,OCXNAME
12 S OCXDD=$O(@OCXCREF@("")) Q:'OCXDD 0
13 S OCXNAME=$G(@OCXCREF@(OCXDD,.01,"E"))
14 ;
15 W " record missing..."
16 I (OCXFLAG["D") Q 0
17 ;
18 S OCXDA=0 D CREATE(OCXCREF,OCXDD,.OCXDA,0)
19 S:$L(OCXNAME) ^TMP("OCXRULE",$J,"A",+OCXDD,OCXNAME)=""
20 ;
21 Q 0
22 ;
23CREATE(OCXCREF,OCXDD,OCXDA,OCXLVL) ;
24 ;
25 N OCXFLD,OCXGREF,OCXKEY
26 ;
27 I $L(OCXDA),'(OCXDA=+OCXDA) W !!,"Unresolved subscript." Q
28 ;
29 S OCXKEY=@OCXCREF@(OCXDD,.01,"E")
30 S OCXGREF=$$GETREF(+OCXDD,.OCXDA,OCXLVL) Q:'$L(OCXGREF)
31 I 'OCXDA D
32 .S OCXDA=$O(^TMP("OCXRULE",$J,"B",+OCXDD,OCXKEY,0)) Q:OCXDA
33 .S OCXDA=$O(@(OCXGREF_""" "")"),-1)+1
34 .F OCXDA=OCXDA:1 Q:'$D(@(OCXGREF_OCXDA_",0)"))
35 .I $D(@(OCXGREF_OCXDA_",0)")) S OCXDA=0
36 ;
37 I 'OCXDA W !!,"Error adding record..." Q
38 ;
39 I '$D(@(OCXGREF_"0)")) S @(OCXGREF_"0)")=U_$$FILEHDR^OCXSENDD(+OCXDD)_U_U
40 ;
41 S OCXFLD=0 F S OCXFLD=$O(@OCXCREF@(OCXDD,OCXFLD)) Q:'OCXFLD Q:(OCXFLD[":") I '$$EXFLD^ORY2341(+OCXDD,OCXFLD) D
42 .I $L($G(@OCXCREF@(OCXDD,OCXFLD,"E"))) D DIE(OCXDD,OCXGREF,OCXFLD,@OCXCREF@(OCXDD,OCXFLD,"E"),.OCXDA,OCXLVL)
43 .I $O(@OCXCREF@(OCXDD,OCXFLD,0)) D WORD(OCXDD,OCXGREF,OCXFLD,.OCXDA,OCXCREF)
44 ;
45 D PUSH(.OCXDA)
46 S OCXFLD="" F S OCXFLD=$O(@OCXCREF@(OCXDD,OCXFLD)) Q:'$L(OCXFLD) I (OCXFLD[":") D
47 .S OCXDA=$P(OCXFLD,":",2) W ! D CREATE($$APPEND(OCXCREF,OCXDD),OCXFLD,.OCXDA,OCXLVL+1)
48 D POP(.OCXDA)
49 Q
50 ;
51LOADWORD(RREF,OCXDD,OCXFLD,OCXSUB) ;
52 ;
53 N QUIT,DDPATH,INDEX,OCXDA,OCXGREF
54 S DDPATH=$P($P($$APPEND(RREF,OCXDD),"(",2),")",1)
55 F INDEX=1:1:$L(DDPATH,",") S OCXDA($L(DDPATH,",")-INDEX)=+$P($P(DDPATH,",",INDEX),":",2)
56 S OCXDA=$G(OCXDA(0)) K OCXDA(0)
57 Q:(OCXFLAG["D") 0
58 I (OCXFLAG["A") S QUIT=$$READ("Y"," Do you want to reload the local '"_$$FIELD^OCXSENDD(+OCXDD,+OCXFLD,"LABEL")_"' field ?","YES") Q:'QUIT (QUIT[U)
59 S OCXGREF=$$GETREF(+OCXDD,.OCXDA,$L(DDPATH,",")-1) Q:'$L(OCXGREF)
60 D WORD(OCXDD,OCXGREF,OCXFLD,.OCXDA,RREF)
61 Q 0
62 ;
63GETREF(OCXDD,OCXDA,OCXLVL) ;
64 ;
65 Q:'OCXDD ""
66 ;
67 N OCXIENS,OCXERR,OCXX
68 S OCXIENS=$$IENS^DILF(.OCXDA),OCXERR=""
69 S OCXX=$$ROOT^DILFD(OCXDD,OCXIENS,0,OCXERR)
70 Q OCXX
71 ;
72WORD(DD,GREF,FLD,DA,RREF) ;
73 ;
74 N SUB,GLROOT,LINE
75 S SUB=$P($$FIELD^OCXSENDD(+DD,FLD,"GLOBAL SUBSCRIPT LOCATION"),";",1) S:'(SUB=+SUB) SUB=""""_SUB_""""
76 S GLROOT=GREF_DA_","_SUB_")" K @GLROOT
77 S LINE=0 F S LINE=$O(@RREF@(DD,FLD,LINE)) Q:'LINE D
78 .S @GLROOT@($O(@GLROOT@(""),-1)+1,0)=@RREF@(DD,FLD,LINE)
79 S LINE=$O(@GLROOT@(""),-1),@GLROOT@(0)=U_U_LINE_U_LINE_U_$$DATE("T")_U
80 ;
81 Q
82 ;
83DATE(X) N %DT,Y S %DT="" D ^%DT Q +Y
84 ;
85DIE(OCXDD,OCXDIC,OCXFLD,OCXVAL,OCXDA,OCXLVL) ;
86 ;
87 N DIC,DIE,X,Y,DR,DA,OCXDVAL,OCXPTR,OCXGREF,D0,OCXSCR
88 S (D0,DA)=OCXDA,(DIC,DIE)=OCXDIC,DR=""
89 S:OCXLVL D0=OCXDA(1),DR="S DA(1)="_(+D0)_",D0="_(+D0)_";"
90 S:OCXVAL="?" OCXVAL="? " S DR=DR_OCXFLD_"///^S X=OCXVAL"
91 I '(OCXVAL="@") W !,?(OCXLVL*5),$$FIELD^OCXSENDD(+OCXDD,OCXFLD,"LABEL"),": ",OCXVAL
92 ;
93 I '(OCXVAL="@") D
94 .N OCXIEN,SHORT
95 .S OCXPTR=+$P($$FIELD^OCXSENDD(+OCXDD,OCXFLD,"SPECIFIER"),"P",2)
96 .Q:'OCXPTR
97 .S OCXGREF="^"_$$FIELD^OCXSENDD(+OCXDD,OCXFLD,"POINTER")
98 .I '($E(OCXGREF,1,4)="^OCX"),'(OCXGREF="^ORD(100.9,"),'(OCXGREF="^ORD(100.8,") Q
99 .Q:$$DIC(OCXGREF,OCXVAL,0)
100 .S OCXIEN=$$DIC(OCXGREF,OCXVAL,1)
101 .S ^TMP("OCXRULE",$J,"B",OCXPTR,OCXVAL,OCXIEN)=""
102 ;
103 S OCXSCR=1
104 D ^DIE
105 ;
106 ; I $D(Y) -> DIE FILER ERROR
107 I $D(Y) W " ^DIE filer data error..." S OCXDIER=$G(OCXDIER)+1
108 I '$D(Y) W " ...Correct data Filed"
109 ;
110 Q
111 ;
112DIC(DIC,X,OCXADD) N OCXSCR S DIC(0)="",OCXSCR=1 S:OCXADD DIC(0)="L" D ^DIC Q:(+Y>0) +Y Q 0
113 ;
114PUSH(OCXDA) ;
115 N OCXSUB S OCXSUB="" F S OCXSUB=$O(OCXDA(OCXSUB),-1) Q:'OCXSUB S OCXDA(OCXSUB+1)=OCXDA(OCXSUB)
116 S OCXDA(1)=OCXDA,OCXDA=0
117 Q
118 ;
119POP(OCXDA) ;
120 N OCXSUB S OCXSUB="" F S OCXSUB=$O(OCXDA(OCXSUB)) Q:'OCXSUB S OCXDA(OCXSUB)=$G(OCXDA(OCXSUB+1))
121 S OCXDA=OCXDA(1) K OCXDA($O(OCXDA(""),-1))
122 Q
123 ;
124APPEND(ARRAY,OCXSUB) ;
125 S:'(OCXSUB=+OCXSUB) OCXSUB=""""_OCXSUB_""""
126 Q:'(ARRAY["(") ARRAY_"("_OCXSUB_")"
127 Q $E(ARRAY,1,$L(ARRAY)-1)_","_OCXSUB_")"
128 ;
129READ(OCXZ0,OCXZA,OCXZB,OCXZL) ;
130 N OCXLINE,DIR,DTOUT,DUOUT,DIRUT,DIROUT
131 Q:'$L($G(OCXZ0)) U
132 S DIR(0)=OCXZ0
133 S:$L($G(OCXZA)) DIR("A")=OCXZA
134 S:$L($G(OCXZB)) DIR("B")=OCXZB
135 F OCXLINE=1:1:($G(OCXZL)-1) W !
136 D ^DIR
137 I $D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT) Q U
138 Q Y
139 ;
140PAUSE() W " Press Enter " R X:DTIME W ! Q (X[U)
141 ;
Note: See TracBrowser for help on using the repository browser.