source: FOIAVistA/tag/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGADDUTL.m@ 1208

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

initial load of FOIAVistA 6/30/08 version

File size: 6.6 KB
Line 
1DGADDUTL ;ALB/PHH,EG-PATIENT ADDRESS; 12/06/2005
2 ;;5.3;Registration;**658,695,730**;Aug 13, 1993;Build 2
3 Q
4ADDR ; validate/edit Patient address (entry for DG ADDRESS UPDATE option)
5 N %,QUIT,DIC,Y,DFN,USERSEL
6ADDRLOOP ;
7 W !!
8 K DIC,Y,DFN,USERSEL
9 S DIC="^DPT(",DIC(0)="AEMZQ",DIC("A")="Veteran Name/SSN: " D ^DIC
10 I $D(DTOUT)!($D(DUOUT)) Q
11 Q:Y'>0
12 ;
13 S DFN=+Y,QUIT=0
14 F D Q:QUIT
15 .W !!,"Do you want to update the (P)ermanent Address, (T)emporary Address, or (B)oth? "
16 .R USERSEL:300
17 .I '$T S USERSEL="^"
18 .I USERSEL["^"!(USERSEL="") S QUIT=1 Q
19 .S USERSEL=$TR(USERSEL,"ptb","PTB")
20 .I USERSEL'="P",USERSEL'="T",USERSEL'="B" D Q
21 ..W !,"Invalid selection!"
22 .I USERSEL="P"!(USERSEL="B") W ! D UPDATE(DFN,"PERM")
23 .I USERSEL="T"!(USERSEL="B") D UPDATE(DFN,"TEMP")
24 .S QUIT=1
25 G ADDRLOOP
26ADD(DFN) ; validate/edit Patient address (entry point for routine DGREG)
27 ; Input -- DFN
28 ;
29 N RETVAL,ADDYN
30 S (RETVAL,ADDYN)=0
31 F D Q:ADDYN
32 .S ADDYN=$$ADDYN("Do you want to validate/edit the Patient's Address")
33 .S RETVAL=ADDYN
34 .I ADDYN'=1,ADDYN'=2 S (ADDYN,RETVAL)=0
35 .I 'ADDYN W !?5,"Enter 'YES' to validate/edit Patient's Address or 'NO' to continue."
36 I ADDYN=1,$G(DFN)'="",$D(^DPT(DFN,0)) D
37 .D UPDATE(DFN,"PERM")
38 .S RETVAL=1
39 Q RETVAL
40ADDYN(PROMPT) ; Yes/No Prompt to Edit/Validate Address
41 ; Input -- None
42 ; Output -- 1 = YES
43 ; 2 = NO
44 ; -1 = Aborted
45 ;
46 N %
47 W !,PROMPT
48 D YN^DICN
49 Q %
50UPDATE(DFN,TYPE) ; Update the Address
51 ; Input -- TYPE = "PERM" for Permanent Address
52 ; = "TEMP" for Temporary Address
53 ; Output -- None
54 ;
55 I TYPE'="PERM",TYPE'="TEMP" Q
56 I TYPE="PERM" D
57 .W !
58 .N FLG S (FLG(1),FLG(2))=1
59 .D ADDRED(DFN,.FLG)
60 ;
61 I TYPE="TEMP" D
62 .D EDITTADR(DFN)
63 Q
64UPDDTTM(DFN,TYPE) ; Update the PATIENT file #2 with the current date and time
65 ;
66 N %H,%,X,%Y,%D,%M,%I,ADDDTTM,DIE,DA,DR
67 D NOW^%DTC
68 S ADDDTTM=%,DIE="^DPT(",DA=DFN
69 ;
70 ; If it's the Temporary Address, the field is .12113
71 ; If not, it should be the Permanent Address and the default field is .118
72 S DR=$S(TYPE="TEMP":".12113///^S X=ADDDTTM",1:".118///^S X=ADDDTTM")
73 D ^DIE
74 Q
75ADDRED(DFN,FLG) ; Address Edit (Code copied from DGREGAED and modified)
76 ;Input:
77 ; DFN (required) - Interal Entry # of Patient File (#2)
78 ; FLG (optional) - Flags of 1 or 0; if null, 0 is assumed. Details:
79 ; FLG(1) - if 1, let user edit phone numbers (field #.131 and #.132)
80 ; FLG(2) - if 1, display before & after address for user confirmation
81 K EASZIPLK
82 N DGINPUT,I,X,Y,%
83 I $G(DFN)="" Q
84 ;I ($G(DFN)'?.N) Q
85 S FLG(1)=$G(FLG(1)),FLG(2)=$G(FLG(2))
86 D INPUT^DGREGAED(.DGINPUT,DFN)
87 I $G(DGINPUT)=-1 Q
88 I $G(FLG(2))=1 D COMPARE^DGREGAED(.DGINPUT,DFN)
89 I '$$CONFIRM^DGREGAED() W !,"Change aborted." D EOP^DGREGAED Q
90 N DGPRIOR
91 D GETPRIOR(DFN,.DGPRIOR)
92 D SAVE^DGREGAED(.DGINPUT,DFN)
93 Q:'$$FILEYN(.DGPRIOR,.DGINPUT)
94 D GETUPDTS(DFN,.DGINPUT)
95 D UPDADDLG(DFN,.DGPRIOR,.DGINPUT)
96 ; Update the Date/Time Stamp
97 D UPDDTTM(DFN,TYPE)
98 Q
99GETPRIOR(DFN,DGPRIOR) ; Get prior address fields.
100 N DGCURR,DGN,DGARRY,DGCIEN,DGST,DGCNTY
101 D GETS^DIQ(2,DFN_",",".111;.112;.113;.114;.115;.117;.1112;.131;.132;.121;.118;.119;.12;.122","I","DGCURR")
102 F DGN=.111,.112,.113,.114,.115,.117,.1112,.131,.132,.121,.118,.119,.12,.122 D
103 . S DGARRY("OLD",DGN)=$G(DGCURR(2,DFN_",",DGN,"I"))
104 M DGPRIOR=DGARRY("OLD")
105 Q
106GETUPDTS(DFN,DGINPUT) ; Get current address fields.
107 N DGCURR,DGN,DGARRY
108 D GETS^DIQ(2,DFN_",",".118;.119;.12;.122","I","DGCURR")
109 F DGN=.118,.119,.12,.122 D
110 . S DGARRY("NEW",DGN)=$G(DGCURR(2,DFN_",",DGN,"I"))
111 M DGINPUT=DGARRY("NEW")
112 Q
113FILEYN(DGOLD,DGNEW) ; Determine whether or not to file to #301.7
114 N RETVAL
115 S RETVAL=0
116 D
117 .I DGOLD(.111)'=$G(DGNEW(.111)) S RETVAL=1 Q
118 .I DGOLD(.112)'=$G(DGNEW(.112)) S RETVAL=1 Q
119 .I DGOLD(.114)'=$G(DGNEW(.114)) S RETVAL=1 Q
120 .I DGOLD(.115)'=$P($G(DGNEW(.115)),"^",2) S RETVAL=1 Q
121 .I DGOLD(.1112)'=$G(DGNEW(.1112)) S RETVAL=1 Q
122 .I DGOLD(.117)'=$P($G(DGNEW(.117)),"^",2) S RETVAL=1 Q
123 .I DGOLD(.131)'=$G(DGNEW(.131)) S RETVAL=1 Q
124 Q RETVAL
125UPDADDLG(DFN,DGPRIOR,DGINPUT) ; Update the IVM ADDRESS CHANGE LOG file #301.7
126 ;
127 N DGDATA
128 ; Zero node:
129 S DGDATA(.01)=DGINPUT(.118)
130 S DGDATA(1)=DFN
131 S DGDATA(2)=DGINPUT(.122)
132 S DGDATA(3)=DGINPUT(.119)
133 S DGDATA(3.5)=DGINPUT(.12)
134 ;
135 ; One node:
136 S DGDATA(4)=DGPRIOR(.118)
137 S DGDATA(5)=DGPRIOR(.122)
138 S DGDATA(6)=DGPRIOR(.12)
139 S DGDATA(7)=DGPRIOR(.119)
140 S DGDATA(8)=DGPRIOR(.131)
141 S DGDATA(9)=DGPRIOR(.111)
142 S DGDATA(10)=DGPRIOR(.112)
143 S DGDATA(11)=DGPRIOR(.114)
144 S DGDATA(12)=DGPRIOR(.117)
145 S DGDATA(13)=DGPRIOR(.115)
146 S DGDATA(14)=DGPRIOR(.1112)
147 ;
148 I $$ADD^DGENDBS(301.7,,.DGDATA) ;
149 Q
150EDITTADR(DFN) ; Edit Temporary Address
151 N DGPRIOR,DGCH,DGRPAN,DGDR,DGRPS
152 I $G(DFN)="" Q
153 ;I ($G(DFN)'?.N) Q
154 ;
155 ; Get the current Temporary Address and display it
156 D GETTADR(DFN,.DGPRIOR)
157 D DISPTADR(DFN,.DGPRIOR)
158 W !!
159 ;
160 S DGCH=5,DGRPAN="1,2,3,4,5,",DGDR="",DGRPS=1
161 D CHOICE^DGRPP
162 D ^DGRPE
163 ; Update the Date/Time Stamp
164 D UPDDTTM(DFN,TYPE)
165 Q
166GETTADR(DFN,DGPRIOR) ; Get prior temporary address fields.
167 N DGCURR,DGN,DGARRY,DGCIEN,DGST,DGCNTY
168 D GETS^DIQ(2,DFN_",",".1211;.1212;.1213;.1214;.1215;.1216;.1217;.1218;.12105;.1219;.12111;.12112;.12113;.12114","I","DGCURR")
169 F DGN=.1211,.1212,.1213,.1214,.1215,.1216,.1217,.1218,.12105,.1219,.12111,.12112,.12113,.12114 D
170 .S DGARRY("OLD",DGN)=$G(DGCURR(2,DFN_",",DGN,"I"))
171 M DGPRIOR=DGARRY("OLD")
172 Q
173DISPTADR(DFN,DGARRY) ; Display Temporary Address
174 N DGADRACT,DGADR1,DGADR2,DGADR3,DGCITY,DGSTATE,DGZIP
175 N DGCOUNTY,DGPHONE,DGFROMDT,DGTODT
176 ;
177 S DGADRACT=$G(DGARRY(.12105))
178 S DGADR1=$G(DGARRY(.1211))
179 S DGADR2=$G(DGARRY(.1212))
180 S DGADR3=$G(DGARRY(.1213))
181 S DGCITY=$G(DGARRY(.1214))
182 S DGSTATE=$G(DGARRY(.1215))
183 S DGZIP=$G(DGARRY(.1216))
184 S DGCOUNTY=$G(DGARRY(.12111))
185 I DGCOUNTY'="",DGSTATE'="",$D(^DIC(5,DGSTATE,1,DGCOUNTY,0)) D
186 .S DGCOUNTY=$P(^DIC(5,DGSTATE,1,DGCOUNTY,0),"^")_" ("_$P(^DIC(5,DGSTATE,1,DGCOUNTY,0),"^",4)_")"
187 I DGADRACT'="Y" S DGCOUNTY="NOT APPLICABLE"
188 I DGSTATE'="",$D(^DIC(5,DGSTATE,0)) S DGSTATE=$P(^DIC(5,DGSTATE,0),"^",2)
189 S DGPHONE=$G(DGARRY(.1219))
190 S DGFROMDT=$$FMTE^XLFDT($G(DGARRY(.1217)))
191 S DGTODT=$$FMTE^XLFDT($G(DGARRY(.1218)))
192 ;
193 W !!,"Temporary Address: "
194 I DGADRACT="Y" D
195 .W:DGADR1'="" !?9,DGADR1
196 .W:DGADR2'="" !?9,DGADR2
197 .W:DGADR3'="" !?9,DGADR3
198 .W !?9,$S(DGCITY'="":DGCITY,1:"")_","_$S(DGSTATE'="":DGSTATE,1:"")_" "_$S(DGZIP'="":DGZIP,1:"")
199 .W !," County: "_DGCOUNTY
200 .W !," Phone: "_DGPHONE
201 .W !,"From/To: "_$P(DGFROMDT,",")_","_$P(DGFROMDT,", ",2)_"-"_$P(DGTODT,",")_","_$P(DGTODT,", ",2)
202 ;
203 I $G(DGARRY(.12105))="N" D
204 .W:$G(DGARRY(.1211))="" !?9,"NO TEMPORARY ADDRESS"
205 .W:$G(DGARRY(.1212))="" !?9,""
206 .W !," County: NOT APPLICABLE"
207 .W !," Phone: NOT APPLICABLE"
208 .W !,"From/To: NOT APPLICABLE"
209 Q
Note: See TracBrowser for help on using the repository browser.