IVMPMTE ;ALB/KCL/CJM/JAN - MEANS TEST EVENT DRIVER INTERFACE ; 07-MAR-01
;;2.0;INCOME VERIFICATION MATCH;**1,9,17,39,49,89**;21-OCT-94
;;Per VHA Directive 10-93-142, this routine should not be modified.
;
; Input - DFN the patient's internal entry number.
; DGMTI the Means Test internal entry number.
; DGMTINF the Means Test Interactive/Non-interactive flag.
; DGMTACT the Means Test event type
; DGMTP annual Means Test 0th node prior to Add, Edit
; or Delete.
; DGMTA annual Means Test 0th node after Add, Edit or Delete.
;
; Output - None.
;
;
EN ; Entry point
N EVENTS,IVMDA
S EVENTS("IVM")=1
;
; Quit if supported Means Test variables are not defined
Q:'$D(DFN)!('$D(DGMTA))!('$D(DGMTP))!('$D(DGMTINF))!('$D(DGMTACT))
;
; - no processing required when uploading or deleting
; - an IVM-verified Means Test
Q:DGMTACT="UPL"!(DGMTACT="DUP")
I DGMTP]"",DGMTA]"",DGMTACT="DEL" Q
;
; Prevent DCD/other income tests uploaded from HEC to trigger a
; transmission back to HEC (quit if source of test isn't VAMC)
N DGST S DGST=$S(+DGMTA:+$P(DGMTA,U,23),1:+$P(DGMTP,U,23))
Q:$P($G(^DG(408.34,DGST,0)),"^")'="VAMC"&(DGMTACT'="CAT")
;
W:'DGMTINF !,"Checking Income Verification Match (IVM) for changes..."
S IVMMTDT=$S(DGMTA:+DGMTA,1:+DGMTP) Q:'IVMMTDT S IVMDT=$$LYR^DGMTSCU1(IVMMTDT)
S IVMNEW=0 S IVMDA=$O(^IVM(301.5,"APT",DFN,IVMDT,0)) I 'IVMDA S IVMNEW=1 ; Check for entry/previous year in IVM PATIENT file
I 'IVMNEW D CHK ; If entry in IVM PATIENT file check for Means Test changes
I IVMNEW,$$IVM^IVMUFNC(DFN,IVMMTDT),($E(IVMDT,1,3)=($E(DT,1,3)-1)) I $$LOG^IVMPLOG(DFN,IVMDT,.EVENTS) ; new & meets crtieria & current year
;
;log patient for transmission if patient meets DCD criteria
D LOGDCD^IVMCUC(DFN,IVMMTDT)
;
; Quit when uploading Future Means Tests
Q:$G(IVM1)>DT
;
; Update cross references when editing Future Dated Tests
I $D(DGMTI),+$G(DGMT0)>DT,$D(IVMDA) D
.I DGMTYPT=1,$P(^IVM(301.5,IVMDA,0),U,6)'="",+DGMTA'>DT S DATA(.06)="" I $$UPD^DGENDBS(301.5,IVMDA,.DATA) K DATA,^IVM(301.5,"AC",+DGMT0,IVMDA,DGMTI)
.I DGMTYPT=2,$P(^IVM(301.5,IVMDA,0),U,7)'="",+DGMTA'>DT S DATA(.07)="" I $$UPD^DGENDBS(301.5,IVMDA,.DATA) K DATA,^IVM(301.5,"AD",+DGMT0,IVMDA,DGMTI)
;
ENQ ; Cleanup
W:'DGMTINF "completed."
K DA,DIC,DIE,DLAYGO,DR,IVMDA,IVMDT,IVMFLG,IVMMTDT,IVMNEW,X,Y
Q
CHK ; Check if Means Test has been ADDED, DELETED, or EDITED
S IVMFLG=0
F X=1,2,3,4,5,7,10,12,15,18 Q:IVMFLG=1 D
.I $P(DGMTA,"^",X)'=$P(DGMTP,"^",X) S IVMFLG=1 I $$SETSTAT^IVMPLOG(IVMDA,.EVENTS) ; If MT changes then edit IVM PATIENT file
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIVMPMTE 2681 printed Dec 13, 2024@02:02:12 Page 2
IVMPMTE ;ALB/KCL/CJM/JAN - MEANS TEST EVENT DRIVER INTERFACE ; 07-MAR-01
+1 ;;2.0;INCOME VERIFICATION MATCH;**1,9,17,39,49,89**;21-OCT-94
+2 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+3 ;
+4 ; Input - DFN the patient's internal entry number.
+5 ; DGMTI the Means Test internal entry number.
+6 ; DGMTINF the Means Test Interactive/Non-interactive flag.
+7 ; DGMTACT the Means Test event type
+8 ; DGMTP annual Means Test 0th node prior to Add, Edit
+9 ; or Delete.
+10 ; DGMTA annual Means Test 0th node after Add, Edit or Delete.
+11 ;
+12 ; Output - None.
+13 ;
+14 ;
EN ; Entry point
+1 NEW EVENTS,IVMDA
+2 SET EVENTS("IVM")=1
+3 ;
+4 ; Quit if supported Means Test variables are not defined
+5 if '$DATA(DFN)!('$DATA(DGMTA))!('$DATA(DGMTP))!('$DATA(DGMTINF))!('$DATA(DGMTACT))
QUIT
+6 ;
+7 ; - no processing required when uploading or deleting
+8 ; - an IVM-verified Means Test
+9 if DGMTACT="UPL"!(DGMTACT="DUP")
QUIT
+10 IF DGMTP]""
IF DGMTA]""
IF DGMTACT="DEL"
QUIT
+11 ;
+12 ; Prevent DCD/other income tests uploaded from HEC to trigger a
+13 ; transmission back to HEC (quit if source of test isn't VAMC)
+14 NEW DGST
SET DGST=$SELECT(+DGMTA:+$PIECE(DGMTA,U,23),1:+$PIECE(DGMTP,U,23))
+15 if $PIECE($GET(^DG(408.34,DGST,0)),"^")'="VAMC"&(DGMTACT'="CAT")
QUIT
+16 ;
+17 if 'DGMTINF
WRITE !,"Checking Income Verification Match (IVM) for changes..."
+18 SET IVMMTDT=$SELECT(DGMTA:+DGMTA,1:+DGMTP)
if 'IVMMTDT
QUIT
SET IVMDT=$$LYR^DGMTSCU1(IVMMTDT)
+19 ; Check for entry/previous year in IVM PATIENT file
SET IVMNEW=0
SET IVMDA=$ORDER(^IVM(301.5,"APT",DFN,IVMDT,0))
IF 'IVMDA
SET IVMNEW=1
+20 ; If entry in IVM PATIENT file check for Means Test changes
IF 'IVMNEW
DO CHK
+21 ; new & meets crtieria & current year
IF IVMNEW
IF $$IVM^IVMUFNC(DFN,IVMMTDT)
IF ($EXTRACT(IVMDT,1,3)=($EXTRACT(DT,1,3)-1))
IF $$LOG^IVMPLOG(DFN,IVMDT,.EVENTS)
+22 ;
+23 ;log patient for transmission if patient meets DCD criteria
+24 DO LOGDCD^IVMCUC(DFN,IVMMTDT)
+25 ;
+26 ; Quit when uploading Future Means Tests
+27 if $GET(IVM1)>DT
QUIT
+28 ;
+29 ; Update cross references when editing Future Dated Tests
+30 IF $DATA(DGMTI)
IF +$GET(DGMT0)>DT
IF $DATA(IVMDA)
Begin DoDot:1
+31 IF DGMTYPT=1
IF $PIECE(^IVM(301.5,IVMDA,0),U,6)'=""
IF +DGMTA'>DT
SET DATA(.06)=""
IF $$UPD^DGENDBS(301.5,IVMDA,.DATA)
KILL DATA,^IVM(301.5,"AC",+DGMT0,IVMDA,DGMTI)
+32 IF DGMTYPT=2
IF $PIECE(^IVM(301.5,IVMDA,0),U,7)'=""
IF +DGMTA'>DT
SET DATA(.07)=""
IF $$UPD^DGENDBS(301.5,IVMDA,.DATA)
KILL DATA,^IVM(301.5,"AD",+DGMT0,IVMDA,DGMTI)
End DoDot:1
+33 ;
ENQ ; Cleanup
+1 if 'DGMTINF
WRITE "completed."
+2 KILL DA,DIC,DIE,DLAYGO,DR,IVMDA,IVMDT,IVMFLG,IVMMTDT,IVMNEW,X,Y
+3 QUIT
CHK ; Check if Means Test has been ADDED, DELETED, or EDITED
+1 SET IVMFLG=0
+2 FOR X=1,2,3,4,5,7,10,12,15,18
if IVMFLG=1
QUIT
Begin DoDot:1
+3 ; If MT changes then edit IVM PATIENT file
IF $PIECE(DGMTA,"^",X)'=$PIECE(DGMTP,"^",X)
SET IVMFLG=1
IF $$SETSTAT^IVMPLOG(IVMDA,.EVENTS)
End DoDot:1
+4 QUIT