Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DG53426D

DG53426D.m

Go to the documentation of this file.
  1. DG53426D ;ALB/AEG - DG*5.3*426 POST-INSTALLATION ;2-19-02
  1. ;;5.3;Registration;**426,1015**;2-19-02;Build 21
  1. ;
  1. ; This routine is a modified version of IVMCMD in that it calls a
  1. ; modified version of IVMCMD1 called DG53426E which only deletes the
  1. ; records from the ANNUAL MEANS TEST file (#408.31). It does NOT
  1. ; send a 'delete' bulletin/notification to the local mail group. It
  1. ; will create a case record in the IVM Patient file (#301.5) and it
  1. ; does call the means test event driver and will call the post-install
  1. ; version of DGMTR.
  1. ;
  1. EN(MTIEN) ;
  1. ; This line tage will process an income test deletion request from
  1. ; the post-installation portion of patch DG*5.3*426.
  1. ;
  1. ; Input - MTIEN = IEN of REQUIRED test to be deleted in file 408.31.
  1. ;
  1. ; Output(s):
  1. ; Function Value: - 1 test deleted successfully.
  1. ; 0 test not deleted.
  1. ;
  1. ; init variables
  1. N DFN,DGERR,DGLINK,DGNODE0,DGDOT,DGTOT,DGDONE
  1. S DGDONE=0
  1. ;
  1. EN1 ; Get zeroth node of file 408.31 entry.
  1. S DGNODE0=$G(^DGMT(408.31,MTIEN,0))
  1. I 'DGNODE0 Q 1
  1. S DGDOT=$P($G(DGNODE0),U,1),DGTOT=$P($G(DGNODE0),U,19)
  1. S DFN=$P($G(DGNODE0),U,2),DGLINK=$P($G(^DGMT(408.31,MTIEN,2)),U,6)
  1. I DGTOT=2,DGLINK Q 0
  1. I DGTOT=1,DGLINK D I $G(DGERR) Q 0
  1. .D DELETE(DGLINK,DFN,DGDOT) ; delete copay
  1. D DELETE(MTIEN,DFN,DGDOT)
  1. Q DGDONE
  1. ;
  1. DELETE(MTIEN,DFN,DGDOT) ;delete a copay or MT
  1. ;
  1. ;Set DGMTP prior to deleting records
  1. S DGMTACT="DEL",DGMTI=MTIEN D PRIOR^DGMTEVT
  1. ; Individual annual Income array (DGINC)
  1. D ALL^DGMTU21(DFN,"VSC",DGDOT,"IR",MTIEN)
  1. ;
  1. DEL22 ; Delete veteran, spouse, & dependent entries from the Income Relation
  1. ; (#408.22) file:
  1. ;
  1. ; - Veteran #408.22 record IEN
  1. S DA=$G(DGINR("V")) D
  1. .Q:'DA
  1. .S DIK="^DGMT(408.22,"
  1. .L +^DGMT(408.22,DA):1
  1. .D ^DIK,IX1^DIK
  1. .L -^DGMT(408.22,DA)
  1. .K DA,DIK
  1. ;
  1. ; - Spouse 408.22 record
  1. S DA=$G(DGINR("S")) D
  1. .Q:'DA
  1. .S DIK="^DGMT(408.22,"
  1. .L +^DGMT(408.22,DA):1
  1. .D ^DIK,IX1^DIK
  1. .L -^DGMT(408.22,DA)
  1. .K DA,DIK
  1. ;
  1. ; - All Dependent Children entries in file 408.22
  1. S DGDEP=0
  1. F S DGDEP=$O(DGINR("C",DGDEP)) Q:'DGDEP D
  1. .S DA=$G(DGINR("C",DGDEP))
  1. .S DIK="^DGMT(408.22,"
  1. .L +^DGMT(408.22,DA):1
  1. .D ^DIK,IX1^DIK
  1. .K DA,DIK
  1. ;
  1. DEL21 ; Delete veteran, spouse, & dependent children entries from the
  1. ; Individual Annual Income (#408.21) file:
  1. S DA=$G(DGINC("V")) D
  1. .Q:'DA
  1. .S DIK="^DGMT(408.21,"
  1. .L +^DGMT(408.21,DA):1
  1. .D ^DIK,IX1^DIK
  1. .L -^DGMT(408.21,DA)
  1. .K DA,DIK
  1. ;
  1. ; Spouse
  1. S DA=$G(DGINC("S")) D
  1. .Q:'DA
  1. .S DIK="^DGMT(408.21,"
  1. .L +^DGMT(408.21,DA):1
  1. .D ^DIK,IX1^DIK
  1. .L -^DGMT(408.21,DA)
  1. .K DA,DIK
  1. ;
  1. ; ALL Depn. Children
  1. S DGDEP=0
  1. F S DGDEP=$O(DGINC("C",DGDEP)) Q:'DGDEP D
  1. .S DA=$G(DGINC("C",DGDEP)),DIK="^DGMT(408.21,"
  1. .L +^DGMT(408.21,DA):1
  1. .D ^DIK,IX1^DIK
  1. .L -^DGMT(408.21,DA)
  1. .K DA,DIK
  1. ;
  1. ; Logic for #408.12, #408.1275 & #408.13 file enties.
  1. D SETUPAR
  1. ;
  1. ; look for IVM Patient relation file entries. If no entries in "AIVM"
  1. ; x-ref, no dependent changes are required.
  1. S DG12="" F S DG12=$O(^DGPR(408.12,"AIVM",MTIEN,DG12)) Q:'DG12 D Q:$D(DGERR)
  1. .; if any entry cannot be found in 408.12 set DGERR
  1. .I $G(^DGPR(408.12,+DG12,0))']"" D Q
  1. ..S DGERR="" Q
  1. .;
  1. .; if only 1 record exists in the 408.1275 multiple then only 1
  1. .; dependent to delete
  1. .I $P($G(^DGPR(408.13,+DG12,"E",0)),U,4)=1 D Q
  1. ..;
  1. ..S DG13=$P($P($G(^DGPR(408.12,+DG12,0)),U,3),";")
  1. ..I $G(^DGPR(408.13,+DG13,0))']"" D Q
  1. ...S DGERR="" Q
  1. ..;
  1. ..; Delete 408.12 & 408.13 records for dependent
  1. ..S DA=DG12,DIK="^DGPR(408.12," D ^DIK,IX1^DIK K DA,DIK
  1. ..S DA=DG13,DIK="^DGPR(408.13," D ^DIK,IX1^DIK K DA,DIK
  1. ..Q
  1. .;
  1. .; Delete #408.1275 multi. entry from dependent and change demo
  1. .; data in 408.12 & 408.13 back to VAMC values. OR delete 408.1275
  1. .; entry from inactivated VAMC dependent.
  1. .; if no entry found in multiple --- set DGERR
  1. .S DG121="",DG121=$O(^DGPR(408.12,"AIVM",MTIEN,+DG12,DG121))
  1. .; if no entry is found in multiple set DGERR
  1. .I $G(^DGPR(408.12,+DG12,"E",+DG121,0))']"" D Q
  1. ..S DGERR="" Q
  1. .;
  1. .S DGVACMA=$P($G(^DGPR(408.12,+DG12,"E",+DG121,0)),U,2)
  1. .; Active depend?
  1. .I DGVACMA D
  1. ..S DR=".02////0",DA=+DG121,DA(1)=0
  1. ..S DIE="^DGPR(408.12,"_+DG12_",""E"","
  1. ..D ^DIE S DGVACMA=0 Q
  1. .;
  1. .S DA(1)=DG12,DA=DG121,DIK="^DGPR(408.12,"_DA(1)_",""E"","
  1. .D ^DIK K DA(1),DA,DIK
  1. .;
  1. .Q
  1. ;
  1. ; Complete the deletion of an income test.
  1. D EN^DG53426E
  1. ;
  1. ENQ Q
  1. ;
  1. ;
  1. SETUPAR ; Create data array DGMAR1() where
  1. ; 1 - Subscript is MT Changes Type (#408.42) file node where type
  1. ; of change = Name, DOB, SSN, Sex, Relationship.
  1. ; 2 - 1st piece is #408.12 or #408.13 file.
  1. ; 3 - 2nd piece is #408.12 or #408.13 file field number.
  1. ;
  1. F DG41=4:1 S DG411=$P($T(TYPECH+DG41),";;",2) Q:DG411="QUIT" D
  1. .S DGMAR($P(DG411,";"))=$P(DG411,";",2,3)
  1. K DG41,DG411
  1. Q
  1. DELTYPE(DFN,MTDATE,TYPE) ;
  1. ; Will delete any primary test for patient (DFN) for same income
  1. ; year as MTDATE for test of type = TYPE
  1. ;
  1. Q:'$G(DFN)
  1. Q:'$G(MTDATE)
  1. Q:'$G(TYPE)
  1. N DGNODE,DGYEAR,RET
  1. S DGYEAR=$E(MTDATE,1,3)_1230.99999
  1. D
  1. .S DGNODE=$$LST^DGMTU(DGDFN,DGYEAR,TYPE)
  1. .Q:'+DGNODE
  1. .I $E($P(DGNODE,U,2),1,3)'=$E(YEAR,1,3) Q
  1. .; Don't delete auto created Rx copay tests - they are deleted
  1. .; by deleting the MT that they are linked to.
  1. .I TYPE=2,+$P($G(^DGMT(408.31,+DGNODE,2)),U,6) Q
  1. .I $P(DGNODE,U,5),$P(DGNODE,U,5)'=1 I $$EN(+MTNODE) D
  1. ..S RET=$$LST^DGMTU(DGDFN,DT,DGTYPE)
  1. ..I $E($P(RET,U,2),1,3)'=$E(YEAR,1,3) S RET=""
  1. ..D ADD^IVMCMB(DGDFN,DGTYPE,"DELETE PRMYTEST",$P(DGNODE,U,2),$P(DGNODE,U,4),$P(RET,U,4))
  1. Q
  1. ;
  1. TYPECH ; Type of dependent change (#408.41/#408.42) file
  1. ; 1st piece - 408.42 table file node
  1. ; 2nd piece - file (#408.12 or 408.13)
  1. ; 3rd piece - 408.12 or 408.13 field
  1. ;;16;408.13;.01
  1. ;;17;408.13;.03
  1. ;;18;408.13;.09
  1. ;;19;408.13;.02
  1. ;;20;408.12;.02
  1. ;;QUIT
  1. Q