close Warning: Can't use blame annotator:
svn blame failed on WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGREGAZL.m: 'GenericSWIGWrapper' object has no attribute '_wrap'

source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGREGAZL.m@ 861

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

revised back to 6/30/08 version

File size: 6.3 KB
RevLine 
1DGREGAZL ;ALB/DW - ZIP LINKING UTILITY ; 5/27/04 10:54am
2 ;;5.3;Registration;**522,560,581,730**;Aug 13, 1993;Build 2
3 ;
4EN(RESULT,DFN) ;Let user edit zip+4, city, state, county based on zip-linking
5 ; Output: RESULT(field#) = User Input External ^ Internal
6 K RESULT
7 N DGIND,DGTOT
8 I $G(DFN)="" S RESULT=-1 Q
9 N DGR,DGDFLT,DGALW,DGZIP,DGN
10 S DGN=""
11 I $$FOREIGN() D Q
12 . D FRGNEDT(.DGR,DFN)
13 . I $G(DGR)=-1 S RESULT=-1 Q
14 . F DGN=.1112,.114,.115,.117 S RESULT(DGN)=$G(DGR(DGN))
15 S DGZIP=$$ZIP(DFN)
16 I DGZIP=-1 S RESULT=-1 Q
17 S RESULT(.1112)=DGZIP
18 S DGIND=$$CITY(.DGR,DGZIP,DFN)
19 I DGIND=$G(DGTOT)+1 S DGIND=""
20 I $G(DGR)=-1 S RESULT=-1 Q
21 S RESULT(.114)=$G(DGR)
22 S DGALW=$$ALWEDT^DGREGDD1($G(DUZ),DGZIP)
23 I DGALW=1 D
24 . K DGR D STCNTY(.DGR,DGZIP,DFN,DGIND)
25 . I $G(DGR)=-1 S RESULT=-1 Q
26 . S RESULT(.115)=$G(DGR(.115))
27 . S RESULT(.117)=$G(DGR(.117))
28 I DGALW=0 D
29 . I DGZIP'="" D LINK(.DGDFLT,DGZIP,1)
30 . S RESULT(.115)=$G(DGDFLT(.115))
31 . S RESULT(.117)=$G(DGDFLT(.117))
32 Q
33ZIP(DFN) ;Let user input zip+4
34ZAGN N DIR,DTOUT,DUOUT,DIROUT,DGDATA
35 S DIR(0)="2,.1112"
36 S DA=DFN
37 D ^DIR
38 I $D(DTOUT) Q -1
39 I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G ZAGN
40 S DGZIP=$G(Y)
41 ;allow bogus zip:
42 I $D(^XUSEC("EAS GMT COUNTY EDIT",+DUZ)) Q DGZIP
43 I DGZIP="" Q DGZIP
44 D POSTALB^XIPUTIL(DGZIP,.DGDATA)
45 ;DG*730
46 I $G(DGDATA(1,"CITY ABBREVIATION"))'="",$G(DGDATA(1,"CITY ABBREVIATION"))=$G(DGDATA(2,"CITY")) S DGDATA=1 K DGDATA(2)
47 I $D(DGDATA("ERROR")) D G ZAGN
48 . W $C(7)," ??"
49 Q DGZIP
50CITY(RESULT,ZIP,DFN) ;Base on zip, let user input city(#.114)
51 ; Input:
52 ; ZIP - user input zip for the patient primary address
53 ; DFN - Interal entry number of Patient File (#2)
54 ; Output:RESULT=-1 (input error or times or ^ out)
55 ; or =user input city
56 ; Array index # of selected city.
57 K RESULT
58 N DGDATA,DIR,DA,Y,DTOUT,DUOUT,DIROUT,DGIND
59 N DGCITY,DGST,DGCNTY,DGABRV,DGN,DGECH,DGSOC
60 N DOLDCITY,DGSAME,DGELEVEN
61 S DGIND=""
62 D POSTALB^XIPUTIL(ZIP,.DGDATA)
63 ;DG*730
64 I $G(DGDATA(1,"CITY ABBREVIATION"))'="",$G(DGDATA(1,"CITY ABBREVIATION"))=$G(DGDATA(2,"CITY")) S DGDATA=1 K DGDATA(2)
65 D FIELD^DID(2,.114,"N","LABEL","DGCITY")
66 S DGN=""
67 I '$D(DGDATA("ERROR")) D
68 . S DOLDCITY=$$GET1^DIQ(2,DFN_",",.114)
69 . S DGSAME=0
70 . F S DGN=$O(DGDATA(DGN)) Q:DGN="" D
71 .. S DGABRV=$G(DGDATA(DGN,"CITY ABBREVIATION"))
72 .. I DOLDCITY'="",DGABRV=DOLDCITY S DGSAME=1
73 .. I DGABRV="" S DGABRV=$P($G(DGDATA(DGN,"CITY")),"*",1)
74 .. I DOLDCITY'="",DGABRV=DOLDCITY S DGSAME=1
75 .. I $G(DGDATA(DGN,"CITY"))["*" S:DGABRV'="" DGABRV=DGABRV_"*"
76 .. S DGECH=DGN_":"_DGABRV
77 .. S DGSOC=$S($G(DGSOC)="":DGECH,1:DGSOC_";"_DGECH)
78 .. S DGTOT=DGN
79 .I 'DGSAME S DGELEVEN=$G(^DPT(DFN,.11)) D
80 ..Q:$P(DGELEVEN,U,6)'=$G(DGDATA(DGTOT,"POSTAL CODE"))
81 ..Q:$P(DGELEVEN,U,14)'="VAMC"
82 ..Q:$P(DGELEVEN,U,15)'=$$GETSITE^DGMTU4($G(DUZ))
83 ..Q:$P(DGELEVEN,U,17)'>.5
84 ..S DGN=DGTOT+1,DGECH=DGN_":"_DOLDCITY,DGSOC=DGSOC_";"_DGECH
85 .;
86 . I $D(^XUSEC("EAS GMT COUNTY EDIT",+DUZ)) D
87 .. S DGSOC=$G(DGSOC)_";"_99_":"_"FREE TEXT"
88 . S DIR(0)="SO^"_$G(DGSOC)
89 . ;if zip '= zip on file, default = ""; else default=city on file
90 . ;I ($G(DFN)'="")&($E(ZIP,1,5)=$$GET1^DIQ(2,DFN_",",.116)) D
91 . S DIR("B")=$$GET1^DIQ(2,DFN_",",.114)
92 . S DIR("A")=$G(DGCITY("LABEL"))
93CAGN1 . D ^DIR
94 . I $D(DTOUT) S RESULT=-1 Q
95 . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G CAGN1
96 . S RESULT=$P($G(Y(0)),"*")
97 . S DGIND=$G(Y)
98 I ($G(Y)=99)!($D(DGDATA("ERROR"))) D
99CAGN2 . I '$D(^XUSEC("EAS GMT COUNTY EDIT",+DUZ)) Q
100 . N DIR,X,Y
101 . S DIR(0)="2,.114"
102 . S DA=DFN
103 . D ^DIR
104 . I $D(DTOUT) S RESULT=-1 Q
105 . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G CAGN2
106 . S RESULT=$G(Y)
107 I $L($G(RESULT))>15 S RESULT=$E(RESULT,1,15)
108 Q DGIND
109 ;
110LINK(RESULT,ZIP,DGN) ;From zip, get the linked state,county
111 K RESULT
112 N DGDATA,CNTYIEN
113 S CNTYIEN=""
114 S DGN=$G(DGN)
115 I (DGN="")&($$MLT^DGREGDD1(ZIP)) S DGN=1
116 I (DGN=99)&($$MLT^DGREGDD1(ZIP)) S DGN=1
117 I (DGN="")!(DGN=99) Q
118 D POSTALB^XIPUTIL(ZIP,.DGDATA)
119 S:$G(DGDATA(DGN,"STATE POINTER"))'="" CNTYIEN=$$FIND1^DIC(5.01,","_$G(DGDATA(DGN,"STATE POINTER"))_",","MOXQ",$E($G(DGDATA(DGN,"FIPS CODE")),3,5),"C")
120 D:'CNTYIEN ;could be duplicate county codes in subfile #5.01
121 .Q:'$D(^DIC(5,+$G(DGDATA(DGN,"STATE POINTER")),1))
122 .Q:$E($G(DGDATA(DGN,"FIPS CODE")),3,5)=""
123 .S CNTYIEN=$O(^DIC(5,$G(DGDATA(DGN,"STATE POINTER")),1,"C",$E($G(DGDATA(DGN,"FIPS CODE")),3,5),""))
124 S RESULT(.115)=$G(DGDATA(DGN,"STATE"))_U_$G(DGDATA(DGN,"STATE POINTER"))
125 S RESULT(.117)=$G(DGDATA(DGN,"COUNTY"))_U_$G(CNTYIEN)_U_$E($G(DGDATA(DGN,"FIPS CODE")),3,5)
126 Q
127 ;
128STCNTY(RESULT,ZIP,DFN,DGNUM) ;Based on zip,input state (#.115) and county (#.117)
129 K RESULT
130 S DGNUM=$G(DGNUM)
131 N DGN,DGDFLT,DGST,POP,DIR,X,Y,DTOUT,DUOUT,DIROUT
132 S POP=0
133 D LINK(.DGDFLT,ZIP,DGNUM)
134 F DGN=.115,.117 Q:POP D
135SCAGN . I DGN=.115 S DIR(0)=2_","_DGN
136 . I ($G(DGST)="")&(DGN=.117) Q
137 . I DGN=.117 S DIR(0)="POA^DIC(5,DGST,1,:AEMQ"
138 . S DIR("B")=$P($G(DGDFLT(DGN)),U)
139 . D ^DIR
140 . I $D(DTOUT) S POP=1 Q
141 . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G SCAGN
142 . S RESULT(DGN)=$P($G(Y),U,2)_U_$P($G(Y),U)
143 . I DGN=.115 S DGST=$P($G(Y),U)
144 . I DGN=.117 S RESULT(.117)=$$CNTY(DGST,$P($G(RESULT(.117)),U,2))
145 I POP=1 S RESULT=-1
146 Q
147CNTY(DGST,DGCIEN) ;Return county name and code
148 ;Input:state number and county IEN
149 ;Output: CountyName^CountyIEN^CountyCode
150 I ($G(DGST)="")!($G(DGCIEN)="") S RESULT=-1 Q RESULT
151 N DGR,RESULT
152 S DGR=$G(^DIC(5,DGST,1,DGCIEN,0))
153 S RESULT=$P($G(DGR),U)_U_DGCIEN_U_$P($G(DGR),U,3)
154 Q RESULT
155FOREIGN() ;Manila (Philippines) doesn't need zip linking.
156 ;Output: 1 - area need no zip linking
157 ; 0 - zip-linking area
158 I $$STA^XUAF4(+$$KSP^XUPARAM("INST"))=358 Q 1
159 ;;;I $$STA^XUAF4(+$$KSP^XUPARAM("INST"))=500 Q 1 ;;HERE TEST
160 Q 0
161FRGNEDT(DGINPUT,DFN) ;Edit zip+4, city, state, county for no zip-linking area
162 K DGINPUT
163 N DGN,DIR,DTOUT,DUOUT,DIROUT,X,Y,POP,DGST
164 S POP=0
165 F DGN=.1112,.114,.115,.117 Q:POP D
166FAGN . I ($G(DGST)="")&(DGN=.117) Q
167 . S DIR(0)=2_","_DGN
168 . I DGN=.117 D
169 .. S DIR(0)="POA^DIC(5,DGST,1,:AEMQ"
170 .. S DIR("B")=$$GET1^DIQ(2,DFN_",",.117)
171 . I DGN'=.117 S DA=DFN
172 . D ^DIR
173 . I $D(DTOUT) S POP=1 Q
174 . I $D(DUOUT)!$D(DIROUT) D UPCT^DGREGAED G FAGN
175 . I (DGN=.114)!(DGN=.1112) S DGINPUT(DGN)=$G(Y)
176 . I (DGN=.115) D
177 .. S DGST=$P($G(Y),U)
178 .. I DGST=$$GET1^DIQ(2,DFN_",",.115,"I") D
179 ... S DGINPUT(.115)=$$GET1^DIQ(2,DFN_",",.115)_U_DGST
180 .. I DGST'=$$GET1^DIQ(2,DFN_",",.115,"I") D
181 ... S DGINPUT(.115)=$P($G(Y(0)),U)_U_DGST
182 . I DGN=.117 S DGINPUT(DGN)=$P($G(Y),U,2)_U_$P($G(Y),U)
183 I POP=1 S RESULT=-1
184 Q
Note: See TracBrowser for help on using the repository browser.