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

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

initial load of WorldVistAEHR

File size: 5.3 KB
RevLine 
[613]1DDSVALF ;SFISC/MKO-GET,PUT VALUES FOR FORM ONLY FIELDS ;11:30 AM 19 Apr 1999
2 ;;22.0;VA FileMan;**8**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5GET(DDSVFD,DDSVBK,DDSVPG,DDSPARM,DDSVDA) ;Get value
6 ;In: DDSPG = Current page
7 ; DDSBK = Current block
8 ; DDSPARM = "I" : internal, "E" : external form
9 ;
10 N DDSANS,DDSFLD,DDSVDDP,DIERR
11 I $D(DDSPG)[0 N DDSPG S DDSPG=0
12 I $D(DDSBK)[0 N DDSBK S DDSBK=0
13 S DDSANS=""
14 I $G(DDSPARM)'["I",$G(DDSPARM)'["E" S DDSPARM=$G(DDSPARM)_"I"
15 ;
16 S DDSFLD=$P($$GETFLD^DDSLIB($G(DDSVFD),$G(DDSVBK),$G(DDSVPG),DDS,$G(DDSPG),$G(DDSBK),"F"),",",1,2)
17 G:$G(DIERR) GETQ
18 ;
19 S DDSVFD=+DDSFLD,DDSVBK=+$P(DDSFLD,",",2)
20 ;
21 S DDSVDDP=+$P($G(^DIST(.404,DDSVBK,0)),U,2)
22 I DDSVDDP,$G(DDSVDA)]"" N DDSDA D
23 . I DDSVDA'["," S DDSVDA=$$IENS^DILF(.DDSVDA)
24 . E S:DDSVDA'?.E1"," DDSVDA=DDSVDA_","
25 . S DDSDA=DDSVDA
26 E I DDSVDDP,DDSVBK'=DDSBK N DDSDA D GL^DDS10(DDSVDDP,.DDSDAORG,"","",.DDSDA)
27 ;
28 I $D(@DDSREFT@("F0",DDSDA,DDSFLD,"D"))#2 S DDSANS=^("D") S:DDSPARM["E"&($D(^("X"))#2) DDSANS=^("X") G GETQ
29 ;
30 I "013"[$P(^DIST(.404,DDSVBK,40,DDSVFD,0),U,3) D BLD^DIALOG(520,"DD or caption-only") G GETQ
31 ;
32 ;Form-only fields
33 I $P($G(^DIST(.404,DDSVBK,40,DDSVFD,0)),U,3)=2 D G:$G(DIERR) GETQ
34 . I $P($G(^DIST(.404,DDSVBK,40,DDSVFD,20)),U)="" D Q
35 .. N P S P(1)="READ TYPE",P(2)="FIELD multiple of the BLOCK"
36 .. D BLD^DIALOG(3011,.P)
37 . D:$D(^DIST(.404,DDSVBK,40,DDSVFD,3))#2 DEF(^(3),$G(^(3.1)),.DDSANS)
38 . S (@DDSREFT@("F0",DDSDA,DDSFLD,"D"),^("O"))=DDSANS
39 . I DDSANS]"" D
40 .. D:$D(DDSANS(0))
41 ... S @DDSREFT@("F0",DDSDA,DDSFLD,"X")=$G(DDSANS(0,0),DDSANS(0))
42 ... S:DDSPARM["E" DDSANS=$G(DDSANS(0,0),DDSANS(0))
43 .. S $P(@DDSREFT@("F0",DDSDA,DDSFLD,"F"),U)=3,DDSCHG=1
44 ;
45 ;Computed fields
46 E S:$P($G(^DIST(.404,DDSVBK,40,DDSVFD,0)),U,3)=4 DDSANS=$$VAL^DDSCOMP(DDSVFD,DDSVBK,DDSDA)
47 ;
48GETQ D:$G(DIERR) ERR^DDSVALM("$$GET^DDSVALF")
49 Q DDSANS
50 ;
51PUT(DDSVFD,DDSVBK,DDSVPG,DDSVAL,DDSPARM,DDSVDA) ;Put value
52 N DIR,X,Y
53 N DDER,DDSFLD,DDSVDDP,DDSVX,DIERR
54 I $D(DDSPG)[0 N DDSPG S DDSPG=0
55 I $D(DDSBK)[0 N DDSBK S DDSBK=0
56 S:$D(DDSVAL)[0 DDSVAL=""
57 I $G(DDSPARM)'["I",$G(DDSPARM)'["E" S DDSPARM=$G(DDSPARM)_"E"
58 ;
59 S DDSFLD=$$GETFLD^DDSLIB($G(DDSVFD),$G(DDSVBK),$G(DDSVPG),DDS,DDSPG,DDSBK,"F")
60 G:$G(DIERR) PUTQ
61 S DDSVFD=+DDSFLD,DDSVBK=+$P(DDSFLD,",",2),DDSVPG=$P(DDSFLD,",",3)
62 S DDSFLD=$P(DDSFLD,",",1,2)
63 ;
64 S DDSVDDP=+$P($G(^DIST(.404,DDSVBK,0)),U,2)
65 I DDSVDDP,$G(DDSVDA)]"" N DDSDA D
66 . I DDSVDA'["," S DDSVDA=$$IENS^DILF(.DDSVDA)
67 . E S:DDSVDA'?.E1"," DDSVDA=DDSVDA_","
68 . S DDSDA=DDSVDA
69 E I DDSVDDP,DDSVBK'=DDSBK N DDSDA D GL^DDS10(DDSVDDP,.DDSDAORG,"","",.DDSDA)
70 ;
71 I $P(^DIST(.404,DDSVBK,40,DDSVFD,0),U,3)'=2 D BLD^DIALOG(520,"DD, computed, or caption-only") G PUTQ
72 ;
73 S DIR(0)=$P(^DIST(.404,DDSVBK,40,DDSVFD,20),U)_$P(^(20),U,2,3)
74 I DDSPARM["I",$E(DIR(0))="P"!(DIR(0)?1"DD".E) D
75 . N FIL,FILROOT,FLD
76 . S Y=DDSVAL
77 . I $E(DIR(0))="P" D
78 .. S FIL=$P($P(DIR(0),U,2),":")
79 .. I 'FIL S FILROOT=U_FIL,FIL=+$P($G(@(U_FIL_"0)")),U,2) Q:'FIL
80 .. E S FILROOT=$G(^DIC(FIL,0,"GL")) Q:FILROOT=""
81 .. S Y(0)=$P($G(@(FILROOT_Y_",0)")),U)
82 .. S Y(0)=$$EXTERNAL^DILFD(FIL,.01,"",Y(0))
83 . E D
84 .. N DV,I S FIL=$P($P(DIR(0),","),U,2),FLD=$P(DIR(0),",",2)
85 .. S DV=$P($G(^DD(FIL,FLD,0)),U,2)
86 .. F I="O","P","V","D","S" I DV[I S Y(0)=$$EXTERNAL^DILFD(FIL,FLD,"",Y) Q
87 E D G:$G(DDER) PUTQ
88 . I DDSVAL="" D Q
89 .. N DDSVREQ
90 .. S DDSVREQ=$P($G(@DDSREFT@(DDSVPG,DDSVBK,DDSVFD)),U)
91 .. S:DDSVREQ]"" DDSVREQ=$P($G(^DIST(.404,DDSVBK,40,DDSVFD,4)),U)
92 .. I DDSVREQ S DDER=1
93 .. E S Y=""
94 . S DIR("V")="",(X,DIR("B"))=DDSVAL
95 . S:DIR(0)?1"DD".E DIR(0)=$P(DIR(0),U,2,999)
96 . I $P(DIR(0),U)["P",$P($P(DIR(0),U,2),":",2)'["Z" D
97 .. N I
98 .. S I=$P(DIR(0),U,2) Q:$P(I,":",2)["Z"
99 .. S $P(I,":",2)=$P(I,":",2)_"Z"
100 .. S $P(DIR(0),U,2)=I
101 . D ^DIR
102 . I $E($P(DIR(0),U))="P" S Y=$P(Y,U)
103 ;
104 ;Update ^TMP
105 S DDSCHG=1
106 S (DDSVX,@DDSREFT@("F0",DDSDA,DDSFLD,"D"))=Y,^("F")=3 S:$D(Y(0))#2 (DDSVX,^("X"))=$S($D(Y(0,0))#2:Y(0,0),1:Y(0)) I $D(^("X"))#2,Y="" S (DDSVX,^("X"))=""
107 ;
108 ;Repaint field if it appears on the current page
109 I $D(@DDSREFS@("F0",DDSFLD,"L",DDSPG,DDSVBK,DDSVFD))#2 D
110 . N DY,DX,DDSVL,DDSVRJ,DDSX,DDSVREP
111 . S DDSVREP=$P($G(@DDSREFS@(DDSPG,DDSVBK)),U,7)
112 . S DY=+@DDSREFS@(DDSPG,DDSVBK,DDSVFD,"D"),DX=$P(^("D"),U,2),DDSVL=$P(^("D"),U,3),DDSVRJ=$P(^("D"),U,10)
113 . I $G(DDSVREP) D Q:DY=""
114 .. N DDSVSN,DDSVPDA,DDSVOFS
115 .. S DDSVPDA=$G(@DDSREFT@(DDSPG,DDSVBK)) I 'DDSVPDA S DY="" Q
116 .. S DDSVREP=$P($G(@DDSREFT@(DDSPG,DDSVBK,DDSVPDA)),U,2,999) I DDSVREP="" S DY="" Q
117 .. S DDSVSN=$G(@DDSREFT@(DDSPG,DDSVBK,DDSVPDA,"B",DDSDA)) I 'DDSVSN S DY="" Q
118 .. S DDSVOFS=DDSVSN-$P(DDSVREP,U,2)
119 .. I DDSVOFS'<0,DDSVOFS<$P(DDSVREP,U,5) S DY=DY+DDSVOFS
120 .. E S DY=""
121 . S DDSX=$P(DDGLVID,DDGLDEL)_$E(DDSVX,1,DDSVL)_$P(DDGLVID,DDGLDEL,10)
122 . X IOXY
123 . W $S(DDSVRJ:$J("",DDSVL-$L(DDSVX))_DDSX,1:DDSX_$J("",DDSVL-$L(DDSVX)))
124 ;
125 D
126 . N DDP,DDSDA S DDP=0,DDSDA="0,"
127 . D:$D(@DDSREFS@("PT",DDP,DDSFLD)) RPB^DDS7(DDP,DDSFLD,DDSPG)
128 . D:$D(@DDSREFS@("COMP",DDP,DDSFLD,DDSPG)) RPCF^DDSCOMP(DDSPG)
129 ;
130PUTQ D:$G(DIERR) ERR^DDSVALM("PUT^DDSVALF")
131 Q
132 ;
133DEF(DDSLN3,DDSLN31,Y) ;Get default
134 N DDER,DIR,X
135 Q:DDSLN3=""
136 ;
137 I DDSLN3'="!M" S Y=DDSLN3
138 E I DDSLN31'?."^" X DDSLN31 S:$D(Y)[0 Y=""
139 Q:Y=""
140 ;
141 S DIR(0)=$P(^DIST(.404,DDSVBK,40,DDSVFD,20),U)_$P(^(20),U,2,3)
142 S:DIR(0)?1"DD".E DIR(0)=$P(DIR(0),U,2,999)
143 S DIR("V")="",(X,DIR("B"))=Y
144 D ^DIR I DDER K Y S Y=""
145 ;
146 I Y]"",$E($P(DIR(0),U))="P" S Y=$P(Y,U)
147 Q
148 ;
Note: See TracBrowser for help on using the repository browser.