source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DDSZ2.m@ 1006

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

initial load of WorldVistAEHR

File size: 3.8 KB
Line 
1DDSZ2 ;SFISC/MKO-LOAD SCR, NAV, AND ORDER INFO ;11:40 AM 26 Aug 1999
2 ;;22.0;VA FileMan;**8**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4EN(SC,N,O,RNAV) ;
5 ;Input:
6 ; DDSPG
7 ; DDSREFS
8 ;
9 D SCR(.SC),NAV(.N,.RNAV),ORD(.O)
10 D:$D(RNAV) RNAV(.RNAV,.O)
11 Q
12 ;
13SCR(SC) ;Move image from SC to global
14 N C,P,R,S
15 Q:'$D(SC)
16 S R=0 F S R=$O(SC(R)) Q:'R D
17 . F C=1:1 Q:$E(SC(R),C)'=" "
18 . S @DDSREFS@("X",DDSPG,R-1,C-1)=$TR($E(SC(R),C,999),$C(0)," ")
19 . I $D(SC(R))=11 D
20 .. S S="",P=0
21 .. F S P=$O(SC(R,P)) Q:'P S S=S_(P-C+1)_";"_(SC(R,P)-C+1)_";U"_U
22 .. S:S?.E1"^" S=$E(S,1,$L(S)-1)
23 .. S:S]"" @DDSREFS@("X",DDSPG,R-1,C-1,"A")=S
24 Q
25 ;
26NAV(N,RNAV) ;
27 N B,D1,D2,F,LN
28 S N(9999,1)="0,0"
29 ;
30 S D1="" F S D1=$O(N(D1)) Q:D1="" D
31 . S D2="" F S D2=$O(N(D1,D2)) Q:D2="" D
32 .. S F=$P(N(D1,D2),","),B=$P(N(D1,D2),",",2),LN=""
33 .. D NAV1(.N,.RNAV,D1,D2,.LN)
34 .. S @DDSREFS@(DDSPG,B,F,"N")=LN
35 .. S:$D(DDSMUL(B,F)) $P(@DDSREFS@(DDSPG,B,F,"N"),U,11)=1
36 Q
37 ;
38NAV1(N,RNAV,D1,D2,LN) ;Setup "N" for navigation
39 N E1,E2,I
40 ;
41 S E1=$S($O(N(D1),-1)]"":$O(N(D1),-1),1:$O(N(""),-1))
42 S E2=D2
43 I $D(N(E1,E2))[0 S E2=$S($O(N(E1,E2),-1)]"":$O(N(E1,E2),-1),1:$O(N(E1,E2)))
44 I E1]"",E2]"" D
45 . N RBO
46 . S RBO=$P(N(E1,E2),",",3)
47 . I RBO,$D(RNAV(RBO,E1))#2 D Q:E2=""
48 .. S E2="" F S E2=$O(RNAV(RBO,E1,E2)) Q:E2="" Q:RNAV(RBO,E1,E2)'[","
49 . S $P(LN,U)=$P(N(E1,E2),",",1,2)
50 ;
51 S E1=$S($O(N(D1))]"":$O(N(D1)),1:$O(N("")))
52 S E2=D2
53 I $D(N(E1,E2))[0 S E2=$S($O(N(E1,E2),-1)]"":$O(N(E1,E2),-1),1:$O(N(E1,E2)))
54 I E1]"",E2]"" D
55 . N RBO
56 . S RBO=$P(N(E1,E2),",",3)
57 . I RBO,$D(RNAV(RBO,E1))#2 D Q:E2=""
58 .. S E2="" F S E2=$O(RNAV(RBO,E1,E2)) Q:E2="" Q:RNAV(RBO,E1,E2)'[","
59 . S $P(LN,U,2)=$P(N(E1,E2),",",1,2)
60 ;
61 S E1=D1,E2=$O(N(D1,D2))
62 I E2="" S E1=$S($O(N(E1))]"":$O(N(E1)),1:$O(N(""))),E2=$O(N(E1,""))
63 I E1]"",E2]"" S $P(LN,U,3)=$P(N(E1,E2),",",1,2)
64 ;
65 S E1=D1,E2=$S($O(N(E1,D2),-1)]"":$O(N(E1,D2),-1),1:"")
66 I E2="" S E1=$S($O(N(E1),-1)]"":$O(N(E1),-1),1:$O(N(""),-1)),E2=$S($O(N(E1,""),-1)]"":$O(N(E1,""),-1),1:"")
67 I E1]"",E2]"" S $P(LN,U,4)=$P(N(E1,E2),",",1,2)
68 ;
69 F I=1:1:4 S:$P($P(LN,U,I),",",2)=B!'$P($P(LN,U,I),",",2) $P(LN,U,I)=+$P(LN,U,I)
70 Q
71 ;
72ORD(O) ;Setup field order info
73 N B,BO,BP,F,FO,FP
74 S (BO,FO)="" F S BO=$O(O(BO)) Q:BO="" S FO=$O(O(BO,"")) Q:FO]""
75 S:FO="" BO=$O(O(""))
76 S B=+$G(O(+BO)),F=+$G(O(+BO,+FO))
77 S @DDSREFS@(DDSPG,"FIRST")=F_","_B
78 ;
79 S (BP,FP)=0
80 S BO="" F S BO=$O(O(BO)) Q:BO="" D
81 . S B=+O(BO),F=0
82 . S FO=$O(O(BO,"")) S:FO]"" F=O(BO,FO)
83 . S $P(@DDSREFS@(DDSPG,B),U,9)=F
84 . S:$P(O(BO),U,2)]"" $P(@DDSREFS@(DDSPG,B),U,10)=$S($P(O(BO),U,2)="FIRST":F,1:$P(O(BO),U,2))
85 . S FO="" F S FO=$O(O(BO,FO)) Q:FO="" D
86 .. S F=O(BO,FO)
87 .. S $P(@DDSREFS@(DDSPG,BP,FP,"N"),U,5)=F_$S(B'=BP:","_B,1:"")
88 .. S FP=F,BP=B
89 S $P(@DDSREFS@(DDSPG,BP,FP,"N"),U,5)=0
90 Q
91 ;
92RNAV(DDSRNAV,DDSO) ;Setup nav and fo info for rep blocks
93 N DDSBO,DDSN,B,D1,D2,DN,F,F1,FO,LN,NX,RT
94 S DDSBO="" F S DDSBO=$O(DDSRNAV(DDSBO)) Q:DDSBO="" D
95 . ;N %X,%Y K DDSN S %X="DDSRNAV("_DDSBO_",",%Y="DDSN(" D %XY^%RCR
96 . K DDSN M DDSN=DDSRNAV(DDSBO)
97 . S D1="" F S D1=$O(DDSN(D1)) Q:D1="" D:$D(DDSN(D1))#2
98 .. S B=DDSN(D1)
99 .. S D2="" F S D2=$O(DDSN(D1,D2)) Q:D2="" D
100 ... S F=DDSN(D1,D2),LN="" Q:F[","
101 ... D NAV1(.DDSN,.DDSRNAV,D1,D2,.LN)
102 ... S $P(@DDSREFS@(DDSPG,B,F,"N"),U,6,9)=LN
103 . ;
104 . S B=+$G(DDSO(+DDSBO)) Q:'B
105 . S FO=$O(DDSO(DDSBO,"")) Q:FO=""
106 . S (F,F1)=DDSO(DDSBO,FO)
107 . F S FO=$O(DDSO(DDSBO,FO)) Q:FO="" D
108 .. S $P(@DDSREFS@(DDSPG,B,F,"N"),U,10)=DDSO(DDSBO,FO)
109 .. S F=DDSO(DDSBO,FO)
110 . S $P(@DDSREFS@(DDSPG,B,F,"N"),U,10)=F1_",+1"
111 . ;
112 . S DN=0
113 . S F=0 F S F=$O(@DDSREFS@(DDSPG,B,F)) Q:DN=2!(F="") D
114 .. S LN=$G(@DDSREFS@(DDSPG,B,F,"N")) Q:LN=""
115 .. S RT=$P(LN,U,3),NX=$P(LN,U,5)
116 .. S:RT[","!'RT DN=DN+1
117 .. S:NX[","!'NX DN=DN+1
118 . ;
119 . S F=0 F S F=$O(@DDSREFS@(DDSPG,B,F)) Q:F="" D
120 .. S $P(@DDSREFS@(DDSPG,B,F,"N"),U,3)=RT
121 .. S $P(@DDSREFS@(DDSPG,B,F,"N"),U,5)=NX
122 Q
Note: See TracBrowser for help on using the repository browser.