IVMUM2 ;ALB/SEK - ADD NEW DEPENDENT TO INCOME PERSON FILE ; 12 MAY 94
;;2.0;INCOME VERIFICATION MATCH;**1,17**;21-OCT-94
;;Per VHA Directive 10-93-142, this routine should not be modified.
;
EN ; this routine will add entries to INCOME PERSON file (408.13) for
; new dependents (spouse/children). if IVM demo data (name, dob,
; ssn, sex) is different than VAMC data, 408.13 will be changed to
; contain the IVM data. the MEANS TEST CHANGES file (408.41) will
; contain both values.
;
; current year is date of means test.
; income year is calendar year before date of means test.
; meant test status is based on income year data.
;
INPIEN ; get INCOME PERSON IEN
; if PATIENT RELATION IEN not in ZDP
; add dependent to INCOME PERSON file if dependent not found
; dependent found if dob, sex, & relationship (408.12) match
;
; Input DFN IEN of file #2
; IVMSEG dependent's ZDP segment
;
; ivmflg1=1 have 408.13 ien when exit (found or added)
; ivmflg2=1 dep record must be added to 408.12
; ivmflg5=1 spouse ZDP incomplete(not dependent) - always spouse records
S (IVMFLG1,IVMFLG2,IVMFLG5)=0
S DGPRI=$P(IVMSEG,"^",7) ; ien of patient relation file
;
S IVMNM=$$FMNAME^HLFNC($P(IVMSEG,"^",2)),IVMSEX=$P(IVMSEG,"^",3),IVMDOB=$$FMDATE^HLFNC($P(IVMSEG,"^",4)),IVMSSN=$P(IVMSEG,"^",5)
S IVMEFFDT=$$FMDATE^HLFNC($P(IVMSEG,"^",9)),IVMRELN=$P(IVMSEG,"^",6)
;
I IVMSPCHV="S"&((IVMNM']"")!(IVMSEX']"")!(IVMDOB']"")) S IVMFLG5=1 Q
I 'DGPRI G NOIEN
;
; if ien of patient relation file (dgpri) transmitted by IVM Center
; and found in 408.12, get ien of income person. if IVM demo data
; is different, change in 408.13 & add to 408.41
; ivmprn is 0 node of 408.12
; dgipi is ien of 408.13
S IVMPRN=$G(^DGPR(408.12,+DGPRI,0))
I IVMPRN]"" D GETIPI Q:$D(IVMFERR) S DGIPI=+$P($P(IVMPRN,"^",3),";"),IVMFLG1=1,IVMRELO=$P(IVMPRN,"^",2) D AUDITP^IVMUM9,AUDIT^IVMUM9 Q
;
NOIEN ; ien of patient relation file is not transmitted or transmitted and
; not found
; check if dependent in income person file
; if dependent not found in 408.13, setup ivmstr = 0 node of 408.13
; subscript of array IVMAR is ien of 408.12 transmitted by IVM Center or
; created or found by upload.
;
S DGPRI=0 F S DGPRI=$O(^DGPR(408.12,"B",DFN,DGPRI)) Q:'DGPRI D Q:IVMFLG1!($D(IVMFERR))
.D GETIP
.Q:$D(IVMFERR)!($D(IVMAR(DGPRI)))!(IVMRELO=1)
.I IVMSEX=IVMSEX13&(IVMDOB=IVMDOB13)&(IVMRELN=IVMRELO) S IVMFLG1=1,IVMAR(DGPRI)=""
.Q
;
; found dependent in 408.13. if demo data different, change in 408.13
; and add in 408.41
Q:$D(IVMFERR)
I IVMFLG1 S DGIPI=+$P($P(IVMPRN,"^",3),";") D AUDITP^IVMUM9,AUDIT1^IVMUM9 Q
;
; dependent not found. add record to 408.13
I 'IVMFLG1 D
.S $P(IVMSTR,"^")=IVMNM,$P(IVMSTR,"^",2)=IVMSEX,$P(IVMSTR,"^",3)=IVMDOB,$P(IVMSTR,"^",9)=IVMSSN
.D ADDDEP
Q
;
ADDDEP ; add dependent to 408.13 file
; In - DFN=IEN of File #2
; DGRP0ND=0 node of 408.13
;Out - DGIPI=408.13 IEN
;
S DGRP0ND=IVMSTR
K DINUM
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
;
; if can't create stub notify site & IVM Center
I DGIPI'>0 D Q
.S (IVMTEXT(6),HLERR)="Can't create stub for file 408.13"
.D ERRBULL^IVMPREC7,MAIL^IVMUFNC()
.S IVMFERR=""
L +^DGPR(408.13,+DGIPI) S ^DGPR(408.13,+DGIPI,0)=DGRP0ND D IX1^DIK L -^DGPR(408.13,+DGIPI)
S IVMFLG2=1 ; added dep to 408.13 must add to 408.12
K DIK,DIC
Q
;
;
GETIP ; if can't find 408.12 record notify site & IVM Center
S IVMPRN=$G(^DGPR(408.12,+DGPRI,0))
S IVMRELO=$P(IVMPRN,"^",2)
I IVMPRN']"" D Q
.S (IVMTEXT(6),HLERR)="Can't find 408.12 record "_DGPRI
.D ERRBULL^IVMPREC7,MAIL^IVMUFNC()
.S IVMFERR=""
Q:IVMRELO=1
;
GETIPI ; ivmseg13 is 0 node of income person file
; get demo data in 408.13 & 408.12
S IVMSEG13=$$DEM^DGMTU1(DGPRI)
I IVMSEG13']"" D Q
.S (IVMTEXT(6),HLERR)="Can't find 408.13 record"
.D ERRBULL^IVMPREC7,MAIL^IVMUFNC()
.S IVMFERR=""
S IVMSEX13=$P(IVMSEG13,"^",2),IVMDOB13=$P(IVMSEG13,"^",3),IVMSSN13=$P(IVMSEG13,"^",9)
S IVMNM13=$P(IVMSEG13,"^")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIVMUM2 4178 printed Nov 22, 2024@17:13:03 Page 2
IVMUM2 ;ALB/SEK - ADD NEW DEPENDENT TO INCOME PERSON FILE ; 12 MAY 94
+1 ;;2.0;INCOME VERIFICATION MATCH;**1,17**;21-OCT-94
+2 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+3 ;
EN ; this routine will add entries to INCOME PERSON file (408.13) for
+1 ; new dependents (spouse/children). if IVM demo data (name, dob,
+2 ; ssn, sex) is different than VAMC data, 408.13 will be changed to
+3 ; contain the IVM data. the MEANS TEST CHANGES file (408.41) will
+4 ; contain both values.
+5 ;
+6 ; current year is date of means test.
+7 ; income year is calendar year before date of means test.
+8 ; meant test status is based on income year data.
+9 ;
INPIEN ; get INCOME PERSON IEN
+1 ; if PATIENT RELATION IEN not in ZDP
+2 ; add dependent to INCOME PERSON file if dependent not found
+3 ; dependent found if dob, sex, & relationship (408.12) match
+4 ;
+5 ; Input DFN IEN of file #2
+6 ; IVMSEG dependent's ZDP segment
+7 ;
+8 ; ivmflg1=1 have 408.13 ien when exit (found or added)
+9 ; ivmflg2=1 dep record must be added to 408.12
+10 ; ivmflg5=1 spouse ZDP incomplete(not dependent) - always spouse records
+11 SET (IVMFLG1,IVMFLG2,IVMFLG5)=0
+12 ; ien of patient relation file
SET DGPRI=$PIECE(IVMSEG,"^",7)
+13 ;
+14 SET IVMNM=$$FMNAME^HLFNC($PIECE(IVMSEG,"^",2))
SET IVMSEX=$PIECE(IVMSEG,"^",3)
SET IVMDOB=$$FMDATE^HLFNC($PIECE(IVMSEG,"^",4))
SET IVMSSN=$PIECE(IVMSEG,"^",5)
+15 SET IVMEFFDT=$$FMDATE^HLFNC($PIECE(IVMSEG,"^",9))
SET IVMRELN=$PIECE(IVMSEG,"^",6)
+16 ;
+17 IF IVMSPCHV="S"&((IVMNM']"")!(IVMSEX']"")!(IVMDOB']""))
SET IVMFLG5=1
QUIT
+18 IF 'DGPRI
GOTO NOIEN
+19 ;
+20 ; if ien of patient relation file (dgpri) transmitted by IVM Center
+21 ; and found in 408.12, get ien of income person. if IVM demo data
+22 ; is different, change in 408.13 & add to 408.41
+23 ; ivmprn is 0 node of 408.12
+24 ; dgipi is ien of 408.13
+25 SET IVMPRN=$GET(^DGPR(408.12,+DGPRI,0))
+26 IF IVMPRN]""
DO GETIPI
if $DATA(IVMFERR)
QUIT
SET DGIPI=+$PIECE($PIECE(IVMPRN,"^",3),";")
SET IVMFLG1=1
SET IVMRELO=$PIECE(IVMPRN,"^",2)
DO AUDITP^IVMUM9
DO AUDIT^IVMUM9
QUIT
+27 ;
NOIEN ; ien of patient relation file is not transmitted or transmitted and
+1 ; not found
+2 ; check if dependent in income person file
+3 ; if dependent not found in 408.13, setup ivmstr = 0 node of 408.13
+4 ; subscript of array IVMAR is ien of 408.12 transmitted by IVM Center or
+5 ; created or found by upload.
+6 ;
+7 SET DGPRI=0
FOR
SET DGPRI=$ORDER(^DGPR(408.12,"B",DFN,DGPRI))
if 'DGPRI
QUIT
Begin DoDot:1
+8 DO GETIP
+9 if $DATA(IVMFERR)!($DATA(IVMAR(DGPRI)))!(IVMRELO=1)
QUIT
+10 IF IVMSEX=IVMSEX13&(IVMDOB=IVMDOB13)&(IVMRELN=IVMRELO)
SET IVMFLG1=1
SET IVMAR(DGPRI)=""
+11 QUIT
End DoDot:1
if IVMFLG1!($DATA(IVMFERR))
QUIT
+12 ;
+13 ; found dependent in 408.13. if demo data different, change in 408.13
+14 ; and add in 408.41
+15 if $DATA(IVMFERR)
QUIT
+16 IF IVMFLG1
SET DGIPI=+$PIECE($PIECE(IVMPRN,"^",3),";")
DO AUDITP^IVMUM9
DO AUDIT1^IVMUM9
QUIT
+17 ;
+18 ; dependent not found. add record to 408.13
+19 IF 'IVMFLG1
Begin DoDot:1
+20 SET $PIECE(IVMSTR,"^")=IVMNM
SET $PIECE(IVMSTR,"^",2)=IVMSEX
SET $PIECE(IVMSTR,"^",3)=IVMDOB
SET $PIECE(IVMSTR,"^",9)=IVMSSN
+21 DO ADDDEP
End DoDot:1
+22 QUIT
+23 ;
ADDDEP ; add dependent to 408.13 file
+1 ; In - DFN=IEN of File #2
+2 ; DGRP0ND=0 node of 408.13
+3 ;Out - DGIPI=408.13 IEN
+4 ;
+5 SET DGRP0ND=IVMSTR
+6 KILL DINUM
+7 SET (DIK,DIC)="^DGPR(408.13,"
SET DIC(0)="L"
SET DLAYGO=408.13
SET X=$PIECE(DGRP0ND,"^")
KILL DD,DO
DO FILE^DICN
SET (DGIPI,DA)=+Y
KILL DLAYGO
+8 ;
+9 ; if can't create stub notify site & IVM Center
+10 IF DGIPI'>0
Begin DoDot:1
+11 SET (IVMTEXT(6),HLERR)="Can't create stub for file 408.13"
+12 DO ERRBULL^IVMPREC7
DO MAIL^IVMUFNC()
+13 SET IVMFERR=""
End DoDot:1
QUIT
+14 LOCK +^DGPR(408.13,+DGIPI)
SET ^DGPR(408.13,+DGIPI,0)=DGRP0ND
DO IX1^DIK
LOCK -^DGPR(408.13,+DGIPI)
+15 ; added dep to 408.13 must add to 408.12
SET IVMFLG2=1
+16 KILL DIK,DIC
+17 QUIT
+18 ;
+19 ;
GETIP ; if can't find 408.12 record notify site & IVM Center
+1 SET IVMPRN=$GET(^DGPR(408.12,+DGPRI,0))
+2 SET IVMRELO=$PIECE(IVMPRN,"^",2)
+3 IF IVMPRN']""
Begin DoDot:1
+4 SET (IVMTEXT(6),HLERR)="Can't find 408.12 record "_DGPRI
+5 DO ERRBULL^IVMPREC7
DO MAIL^IVMUFNC()
+6 SET IVMFERR=""
End DoDot:1
QUIT
+7 if IVMRELO=1
QUIT
+8 ;
GETIPI ; ivmseg13 is 0 node of income person file
+1 ; get demo data in 408.13 & 408.12
+2 SET IVMSEG13=$$DEM^DGMTU1(DGPRI)
+3 IF IVMSEG13']""
Begin DoDot:1
+4 SET (IVMTEXT(6),HLERR)="Can't find 408.13 record"
+5 DO ERRBULL^IVMPREC7
DO MAIL^IVMUFNC()
+6 SET IVMFERR=""
End DoDot:1
QUIT
+7 SET IVMSEX13=$PIECE(IVMSEG13,"^",2)
SET IVMDOB13=$PIECE(IVMSEG13,"^",3)
SET IVMSSN13=$PIECE(IVMSEG13,"^",9)
+8 SET IVMNM13=$PIECE(IVMSEG13,"^")
+9 QUIT