| 1 | IVMCM2 ;ALB/SEK,CKN - ADD NEW DCD DEPENDENT TO INCOME PERSON FILE ; 2/8/06 2:00pm | 
|---|
| 2 | ;;2.0;INCOME VERIFICATION MATCH;**17,105**;21-OCT-94;Build 2 | 
|---|
| 3 | ;;Per VHA Directive 10-93-142, this routine should not be modified. | 
|---|
| 4 | ; | 
|---|
| 5 | EN ; this routine will add entries to INCOME PERSON file (408.13) for | 
|---|
| 6 | ; new dependents (spouse/children).  if DCD demo data (name, dob, | 
|---|
| 7 | ; ssn, sex) is different than VAMC data, 408.13 will be changed to | 
|---|
| 8 | ; contain the DCD data.  the MEANS TEST CHANGES file (408.41) will | 
|---|
| 9 | ; contain both values. | 
|---|
| 10 | ; | 
|---|
| 11 | INPIEN ; get INCOME PERSON IEN | 
|---|
| 12 | ; if PATIENT RELATION IEN not in ZDP | 
|---|
| 13 | ;    add dependent to INCOME PERSON file if dependent not found | 
|---|
| 14 | ;    dependent found if dob, sex, & relationship (408.12) match | 
|---|
| 15 | ; | 
|---|
| 16 | ;     Input    DFN     IEN of file #2 | 
|---|
| 17 | ;              IVMSEG  dependent's ZDP segment | 
|---|
| 18 | ; | 
|---|
| 19 | ; ivmflg1=1 have 408.13 ien when exit (found or added) | 
|---|
| 20 | ; ivmflg2=1 dep record must be added to 408.12 | 
|---|
| 21 | ; ivmflg5=1 spouse ZDP incomplete(not dependent) - always spouse records | 
|---|
| 22 | S (IVMFLG1,IVMFLG2,IVMFLG5)=0 | 
|---|
| 23 | S DGPRI=$P(IVMSEG,"^",7) ; ien of patient relation file | 
|---|
| 24 | ; | 
|---|
| 25 | S IVMNM=$$FMNAME^HLFNC($P(IVMSEG,"^",2)),IVMSEX=$P(IVMSEG,"^",3),IVMDOB=$$FMDATE^HLFNC($P(IVMSEG,"^",4)),IVMSSN=$P(IVMSEG,"^",5) | 
|---|
| 26 | S IVMEFFDT=$$FMDATE^HLFNC($P(IVMSEG,"^",9)),IVMRELN=$P(IVMSEG,"^",6) | 
|---|
| 27 | S IVMSPMNM=$P(IVMSEG,"^",8) ;Spouse Maiden Name IVM*2*105 | 
|---|
| 28 | S IVMPSSNR=$P(IVMSEG,"^",10) ;Pseudo SSN Reason IVM*2*105 | 
|---|
| 29 | I IVMPSSNR]"",IVMPSSNR'="R",IVMPSSNR'="S",IVMPSSNR'="N" S IVMPSSNR="" | 
|---|
| 30 | ; | 
|---|
| 31 | I IVMSPCHV="S"&((IVMNM']"")!(IVMSEX']"")!(IVMDOB']"")) S IVMFLG5=1 Q | 
|---|
| 32 | I 'DGPRI G NOIEN | 
|---|
| 33 | ; | 
|---|
| 34 | ; if ien of patient relation file (dgpri) transmitted by IVM Center | 
|---|
| 35 | ; and found in 408.12, get ien of income person.  if DCD demo data | 
|---|
| 36 | ; is different, change in 408.13 & add to 408.41 | 
|---|
| 37 | ; ivmprn is 0 node of 408.12 | 
|---|
| 38 | ; dgipi is ien of 408.13 | 
|---|
| 39 | S IVMPRN=$G(^DGPR(408.12,+DGPRI,0)) | 
|---|
| 40 | I IVMPRN]"" D GETIPI Q:$D(IVMFERR)  S DGIPI=+$P($P(IVMPRN,"^",3),";"),IVMFLG1=1,IVMRELO=$P(IVMPRN,"^",2) D AUDITP^IVMCM9,AUDIT^IVMCM9 Q | 
|---|
| 41 | ; | 
|---|
| 42 | NOIEN ; ien of patient relation file is not transmitted or transmitted and | 
|---|
| 43 | ; not found | 
|---|
| 44 | ; check if dependent in income person file | 
|---|
| 45 | ; if dependent not found in 408.13, setup ivmstr =  0 node of 408.13 | 
|---|
| 46 | ; subscript of array IVMAR is ien of 408.12 transmitted by IVM Center or | 
|---|
| 47 | ; created or found by upload. | 
|---|
| 48 | ; | 
|---|
| 49 | S DGPRI=0 F  S DGPRI=$O(^DGPR(408.12,"B",DFN,DGPRI)) Q:'DGPRI  D  Q:IVMFLG1!($D(IVMFERR)) | 
|---|
| 50 | .D GETIP | 
|---|
| 51 | .Q:$D(IVMFERR)!($D(IVMAR(DGPRI)))!(IVMRELO=1) | 
|---|
| 52 | .I IVMSEX=IVMSEX13&(IVMDOB=IVMDOB13)&(IVMRELN=IVMRELO) S IVMFLG1=1,IVMAR(DGPRI)="" | 
|---|
| 53 | .Q | 
|---|
| 54 | ; | 
|---|
| 55 | ; found dependent in 408.13. if demo data different, change in 408.13 | 
|---|
| 56 | ; and add in 408.41 | 
|---|
| 57 | Q:$D(IVMFERR) | 
|---|
| 58 | I IVMFLG1 S DGIPI=+$P($P(IVMPRN,"^",3),";") D AUDITP^IVMCM9,AUDIT1^IVMCM9 Q | 
|---|
| 59 | ; | 
|---|
| 60 | ; dependent not found. add record to 408.13 | 
|---|
| 61 | I 'IVMFLG1 D | 
|---|
| 62 | .S $P(IVMSTR,"^")=IVMNM,$P(IVMSTR,"^",2)=IVMSEX,$P(IVMSTR,"^",3)=IVMDOB,$P(IVMSTR,"^",9)=IVMSSN,$P(IVMSTR,"^",10)=IVMPSSNR,$P(IVMSTR1,"^")=IVMSPMNM | 
|---|
| 63 | .D ADDDEP | 
|---|
| 64 | Q | 
|---|
| 65 | ; | 
|---|
| 66 | ADDDEP ; add dependent to 408.13 file | 
|---|
| 67 | ; In - DFN=IEN of File #2 | 
|---|
| 68 | ;      DGRP0ND=0 node of 408.13 | 
|---|
| 69 | ;      DGRP1ND=1 node of 408.13 | 
|---|
| 70 | ;Out - DGIPI=408.13 IEN | 
|---|
| 71 | ; | 
|---|
| 72 | N X,Y | 
|---|
| 73 | S DGRP0ND=IVMSTR | 
|---|
| 74 | S DGRP1ND=IVMSTR1 | 
|---|
| 75 | K DINUM | 
|---|
| 76 | S (DIK,DIC)="^DGPR(408.13,",DIC(0)="L",DLAYGO=408.13,X=$P(DGRP0ND,"^") K DD,DO D FILE^DICN S (DGIPI,DA)=+Y K DLAYGO | 
|---|
| 77 | ; | 
|---|
| 78 | ; if can't create stub notify site & IVM Center | 
|---|
| 79 | I DGIPI'>0 D  Q | 
|---|
| 80 | .S (IVMTEXT(6))="Can't create stub for file 408.13" | 
|---|
| 81 | .D PROB^IVMCMC(IVMTEXT(6)) | 
|---|
| 82 | .D ERRBULL^IVMPREC7,MAIL^IVMUFNC("DGMT MT/CT UPLOAD ALERTS") | 
|---|
| 83 | .S IVMFERR="" | 
|---|
| 84 | L +^DGPR(408.13,+DGIPI) S ^DGPR(408.13,+DGIPI,0)=DGRP0ND,^DGPR(408.13,+DGIPI,1)=DGRP1ND D IX1^DIK L -^DGPR(408.13,+DGIPI) | 
|---|
| 85 | S IVMFLG2=1 ; added dep to 408.13 must add to 408.12 | 
|---|
| 86 | K DIK,DIC | 
|---|
| 87 | Q | 
|---|
| 88 | ; | 
|---|
| 89 | ; | 
|---|
| 90 | GETIP ; if can't find 408.12 record notify site & IVM Center | 
|---|
| 91 | S IVMPRN=$G(^DGPR(408.12,+DGPRI,0)) | 
|---|
| 92 | S IVMRELO=$P(IVMPRN,"^",2) | 
|---|
| 93 | I IVMPRN']"" D  Q | 
|---|
| 94 | .S (IVMTEXT(6))="Can't find 408.12 record "_DGPRI | 
|---|
| 95 | .D PROB^IVMCMC(IVMTEXT(6)) | 
|---|
| 96 | .D ERRBULL^IVMPREC7,MAIL^IVMUFNC("DGMT MT/CT UPLOAD ALERTS") | 
|---|
| 97 | .S IVMFERR="" | 
|---|
| 98 | Q:IVMRELO=1 | 
|---|
| 99 | ; | 
|---|
| 100 | GETIPI ; ivmseg13 is 0 node of income person file | 
|---|
| 101 | ; get demo data in 408.13 & 408.12 | 
|---|
| 102 | S IVMSEG13=$$DEM^DGMTU1(DGPRI) | 
|---|
| 103 | S IVMSG131=$$DEM1^DGMTU1(DGPRI) ;Get node 1 | 
|---|
| 104 | I IVMSEG13']"" D  Q | 
|---|
| 105 | .S (IVMTEXT(6))="Can't find 408.13 record" | 
|---|
| 106 | .D PROB^IVMCMC(IVMTEXT(6)) | 
|---|
| 107 | .D ERRBULL^IVMPREC7,MAIL^IVMUFNC("DGMT MT/CT UPLOAD ALERTS") | 
|---|
| 108 | .S IVMFERR="" | 
|---|
| 109 | S IVMSEX13=$P(IVMSEG13,"^",2),IVMDOB13=$P(IVMSEG13,"^",3),IVMSSN13=$P(IVMSEG13,"^",9),IVMPSR13=$P(IVMSEG13,"^",10) | 
|---|
| 110 | S IVMSMN13=$P($G(IVMSG131),"^") | 
|---|
| 111 | S IVMNM13=$P(IVMSEG13,"^") | 
|---|
| 112 | Q | 
|---|