source: FOIAVistA/trunk/r/ENROLLMENT_APPLICATION_SYSTEM-EAS/EASEZPV2.m@ 1590

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

initial load of FOIAVistA 6/30/08 version

File size: 5.8 KB
Line 
1EASEZPV2 ;ALB/AMA/GTS/CMF - GATHER VISTA MEANS TEST DATA TO PRINT FROM DG OPTIONS
2 ;;1.0;ENROLLMENT APPLICATION SYSTEM;**57,66**;Mar 15, 2001
3 ;
4V408(EASDFN,EASMTIEN) ;GATHER MEANS TEST DATA -- CALLED FROM VISTA^EASEZPVD
5 ; INPUT:
6 ; EASDFN - POINTER TO PATIENT FILE (#2)
7 ; EASMTIEN - MeansTestIEN (#408.31)
8 N MTIFN,MTDT,INCREL
9 S MTIFN=+$G(EASMTIEN)
10 S MTDT=$$GET1^DIQ(408.31,MTIFN_",",.01,"I")
11 ;
12 ;GET DATA FROM FILES 408.12, 408.13, 408.21, AND 408.22
13 D I408^EASEZPVI(EASDFN,MTDT,.INCREL)
14 I $D(INCREL)>1 D
15 . ;MODIFIED FROM A408^EASEZC2
16 . N IENS,B,FILE,M,MM,TYPE,IEN,NSD,FLD,IEN2
17 . N FFF,PERS,GRP,GRP1,SUBF,SUBIEN,WHERE
18 . S IENS=$G(INCREL(408,"V",1))
19 . ;ADD "INCOME YEAR" AND "DECLINES TO GIVE INFO" INTO ^TMP GLOBALS
20 . N EZTMPIEN
21 . S EZTMPIEN=$O(^TMP("EZDATA",$J,""),-1)+1
22 . S ^TMP("EZDATA",$J,EZTMPIEN)="408.21^408.21^.01^IIC;999^Income Year"
23 . S ^TMP("EZINDEX",$J,"A",408.21,408.21,.01,EZTMPIEN)=EZTMPIEN_"^APPLICANT INCOME YEAR"
24 . S EZTMPIEN=EZTMPIEN+1
25 . S ^TMP("EZDATA",$J,EZTMPIEN)="408.31^408.31^.14^IIC;998^Declines To Give Info"
26 . S ^TMP("EZINDEX",$J,"A",408.31,408.31,.14,EZTMPIEN)=EZTMPIEN_"^APPLICANT DECLINES TO GIVE INFO"
27 . I MTIFN>0 S B=0 D GET408(408.31,"A",MTIFN)
28 . S IEN=$P(IENS,U,3),IEN2=$P(IENS,U,4) ;EAS*66 - GENERATE ADJ EXP
29 . I +IEN,+IEN2 D GROSS^DGMTSCU4(IEN,EASDFN,MTDT,IEN2)
30 . ;
31 . I IENS S B=0 F FILE=408.12,2,408.21,408.22 D GET408(FILE,"A",IENS)
32 . ;MODIFIED FROM SP408^EASEZC2
33 . S IENS=$G(INCREL(408,"S",1))
34 . I IENS S B=0 F FILE=408.12,408.13,408.21,408.22 D GET408(FILE,"S",IENS)
35 . ;MODIFIED FROM C1N408^EASEZC2
36 . S (M,MM)=0 F S M=$O(INCREL(408,"C",M)) Q:'M D
37 . . ;DETERMINE IF ACTIVE
38 . . S IEN=+$P(INCREL(408,"C",M),U)
39 . . ;
40 . . S IEN=+$P(INCREL(408,"C",M),U,2)
41 . . S NSD="" F FLD=.01,.09,.03 D
42 . . . S FFF=408.13_U_408.13_U_FLD,VDATA=$$GET^EASEZC1(IEN,FFF)
43 . . . I FLD=.09 S VDATA=$$SSNOUT^EASEZT1(VDATA)
44 . . . I FLD=.03 S VDATA=$$XDATE^EASEZT1(VDATA)
45 . . . S NSD=NSD_VDATA_U
46 . . I MM=0 D I 1
47 . . . S MM=1
48 . . . S PERS("EZ","CHILD1",1)=NSD
49 . . . S PERS("EZ","CHILD1",1,"IENS")=INCREL(408,"C",M)
50 . . E D
51 . . . S PERS("EZ","CHILD(N)",MM)=NSD
52 . . . S PERS("EZ","CHILD(N)",MM,"IENS")=INCREL(408,"C",M)
53 . . . S MM=MM+1
54 . ;
55 . ;get identifying data for child in database
56 . F TYPE="CHILD1","CHILD(N)" S M=0 F S M=$O(PERS("EZ",TYPE,M)) Q:'M D
57 . . S IENS=$G(PERS("EZ",TYPE,M,"IENS")) Q:IENS=""
58 . . S GRP=$S(TYPE="CHILD1":"C1",1:"CN")
59 . . ;associate each ien with file/subfile
60 . . S B=0 F FILE=408.12,408.13,408.21,408.22 D
61 . . . S B=B+1,IEN=+$P(IENS,U,B) Q:'IEN
62 . . . I 'MTDT,((FILE=408.21)!(FILE=408.22)) Q
63 . . . D CONT
64 Q
65 ;
66GET408(FILE,SRCE,IENS) ;GATHER THE DATA FROM THE 408 FILES
67 ; INPUT:
68 ; FILE - FILE TO SEARCH
69 ; SRCE - SOURCE OF DATA ("A"PPLICANT, "S"POUSE)
70 ; IENS - IEN FROM THE INCREL ARRAY
71 ;
72 N IEN,FLD,MAP,VDATA,KEY
73 ;IF NO MEANS TEST, THEN DON'T GATHER ANY MONEY AMOUNTS
74 I 'MTDT,((FILE=408.21)!(FILE=408.22)) Q
75 S B=B+1,IEN=+$P(IENS,U,B) Q:'IEN Q:FILE=2
76 I (FILE=408.22),('MTIFN!($P($G(^DGMT(FILE,+IEN,"MT")),U)'=MTIFN)) Q
77 S FLD=0 F S FLD=$O(^TMP("EZINDEX",$J,SRCE,FILE,FILE,FLD)) Q:'FLD D
78 . S MAP=FILE_U_FILE_U_FLD
79 . S VDATA=$$GET^EASEZC1(IEN,MAP)
80 . I (FILE=408.31),(FLD=.14) D
81 . . I (VDATA="")!(VDATA=0) S VDATA="NO"
82 . . I VDATA=1 S VDATA="YES"
83 . I (FILE=408.21) D
84 . . I (FLD=.08) S VDATA=$$SUMSSI^EASEZT2(VDATA,IEN)
85 . . I (FLD=2.01) S VDATA=$$SUMCASH^EASEZT2(VDATA,IEN)
86 . . I (FLD=2.04) S VDATA=$$SUMPROP^EASEZT2(VDATA,IEN)
87 . . Q
88 . Q:VDATA=-1 Q:VDATA=""
89 . I (SRCE="S"),(FILE=408.13),(FLD=.09) S VDATA=$$SSNOUT^EASEZT1(VDATA)
90 . I (SRCE="S"),(FILE=408.13),(FLD=.03) S VDATA=$$XDATE^EASEZT1(VDATA)
91 . S KEY=0 F S KEY=$O(^TMP("EZINDEX",$J,SRCE,FILE,FILE,FLD,KEY)) Q:'KEY D
92 . . S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
93 . . I (FILE=408.21),(SRCE="A") D
94 . . . I ";2.01;2.03;2.04;"'[(";"_FLD_";") Q
95 . . . N TEXT,NEWKEY
96 . . . I FLD=2.01 S TEXT="APPLICANT CASH IN BANK2"
97 . . . I FLD=2.03 S TEXT="APPLICANT REAL PROPERTY LESS MORTGAGES2"
98 . . . I FLD=2.04 S TEXT="APPLICANT STOCKS BONDS ASSETS LESS DEBTS2"
99 . . . S NEWKEY=+$$KEY711^EASEZU1(TEXT)
100 . . . S ^TMP("EZDATA",$J,NEWKEY,1,2)=VDATA
101 ;
102 I (FILE=408.12),(SRCE="S") D
103 . S SUBF=408.1275
104 . S FLD=0 F S FLD=$O(^TMP("EZINDEX",$J,SRCE,FILE,SUBF,FLD)) Q:'FLD D
105 . . S SUBIEN=$$I1275^EASEZI(IEN)
106 . . S MAP=FILE_U_SUBF_U_FLD,WHERE=IEN_";"_SUBIEN
107 . . S VDATA=$$GET^EASEZC1(WHERE,MAP)
108 . . Q:VDATA=-1 Q:VDATA=""
109 . . S KEY=0 F S KEY=$O(^TMP("EZINDEX",$J,SRCE,FILE,SUBF,FLD,KEY)) Q:'KEY D
110 . . . S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
111 Q
112 ;
113CONT ;CONTINUATION OF CHILD FINANCIAL DATA
114 ;
115 I (FILE=408.22),('MTIFN!'IEN!($P($G(^DGMT(FILE,+IEN,"MT")),U)'=MTIFN)) Q
116 S FLD=0 F S FLD=$O(^TMP("EZINDEX",$J,GRP,FILE,FILE,FLD)) Q:FLD="" D
117 . S MAP=FILE_U_FILE_U_FLD
118 . S GRP1=GRP I (EASVRSN>5.99),(FILE=408.21),(".08;.14;.17"[FLD) S GRP1="CN"
119 . S VDATA=$$GET^EASEZC1(IEN,MAP)
120 . I (FILE=408.21) D
121 . . I (FLD=.08) S VDATA=$$SUMSSI^EASEZT2(VDATA,IEN)
122 . . I (FLD=2.01) S VDATA=$$SUMCASH^EASEZT2(VDATA,IEN)
123 . . I (FLD=2.04) S VDATA=$$SUMPROP^EASEZT2(VDATA,IEN)
124 . . Q
125 . Q:VDATA=-1 Q:VDATA=""
126 . I (FILE=408.13),(FLD=.09) S VDATA=$$SSNOUT^EASEZT1(VDATA)
127 . I (FILE=408.13),(FLD=.03) S VDATA=$$XDATE^EASEZT1(VDATA)
128 . ;store link in all 1010EZ elements associated with this file/subfile
129 . S KEY=$O(^TMP("EZINDEX",$J,GRP1,FILE,FILE,FLD,0)) Q:'KEY
130 . S MM=M I EASVRSN>5.99,FILE=408.21,".08;.14;.17"[FLD S:(TYPE="CHILD(N)") MM=M+1
131 . S ^TMP("EZDATA",$J,KEY,MM,2)=VDATA
132 ;get data in subfile #408.1275
133 I FILE=408.12 S SUBF=408.1275 D
134 . S FLD=0 F S FLD=$O(^TMP("EZINDEX",$J,GRP,FILE,SUBF,FLD)) Q:FLD="" D
135 . . S SUBIEN=$$I1275^EASEZI(IEN)
136 . . S MAP=FILE_U_SUBF_U_FLD,WHERE=IEN_";"_SUBIEN
137 . . S VDATA=$$GET^EASEZC1(WHERE,MAP)
138 . . Q:VDATA=-1 Q:VDATA=""
139 . . ;store link in all 1010EZ elements associated with this file/subfile
140 . . S KEY=0 F S KEY=$O(^TMP("EZINDEX",$J,GRP,FILE,SUBF,FLD,KEY)) Q:'KEY D
141 . . . S ^TMP("EZDATA",$J,KEY,MM,2)=VDATA
142 Q
Note: See TracBrowser for help on using the repository browser.