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

EASUM5.m

Go to the documentation of this file.
  1. EASUM5 ;ALB/SEK,MNH - ADD NEW INCOME RELATION FILE ENTRIES ;19 MAY 94 9:30am
  1. ;;1.0;ENROLLMENT APPLICATION SYSTEM;**113**;21-OCT-94 ;Build 53
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ;CLONED FROM IVMUM5
  1. ;
  1. EN ; this routine will add entries to INCOME RELATION file (408.22)
  1. ; will also inactivate VAMC dependents (spouse & children) who are not
  1. ; IVM dependents, by adding an inactivate entry into the EFFECTIVE DATE
  1. ; sub-file (multiple-408.1275) of the PATIENT RELATION file (#408.12)
  1. ;
  1. ; DFN Patient file IEN
  1. ; DGINI Individual Annual Income IEN
  1. ; DGIRI Income Relation IEN
  1. ; IVMSEG ZIR record for veteran or spouse or dependent
  1. ; IVM0 408.22 0 node pieces 5-7
  1. ; IVM01 0 node pieces 9-12
  1. ; IVM02 0 node piece 6
  1. ; IVM03 0 node piece 20 EAS*1*113
  1. ;
  1. N IVM0,IVM01,IVM02,IVM03
  1. S DGIRI=$$ADDIR^DGMTU2(DFN,DGINI)
  1. ;
  1. ; if can't create stub notify site & IVM Center
  1. I DGIRI'>0 D Q
  1. .S (IVMTEXT(6),HLERR)="Can't create stub for file 408.22"
  1. .D ERRBULL^IVMPREC7,MAIL^IVMUFNC()
  1. .S IVMFERR=""
  1. ;
  1. ; set "mt" node to annual means test ien
  1. D MT^DGMTSCU3(DGIRI,DGMTI)
  1. Q:IVMSPCHV="S"
  1. ;
  1. ; set number of dependent children (#.13) and dependent children(#.08)
  1. ; in income relation file (#408.22) based on active child dependents
  1. ; in patient relation file (#408.12).
  1. ; make IVM means test primary income test for year
  1. I IVMSPCHV="V" D Q:$D(IVMFERR)
  1. .S DA=IVMMTIEN,DIE="^DGMT(408.31,",DR="2////0" D ^DIE ; vamc mt
  1. .S DA=DGMTI,DIE="^DGMT(408.31,",DR="2////1" D ^DIE ; ivm mt
  1. .;S DR=DR_"0////^S X=IVM03;21" ;EAS*1*113
  1. .;
  1. .; inactivate VAMC dependents who are not IVM dependents
  1. .K DGREL("V")
  1. .I $D(DGREL) D INACTIVE Q:$D(IVMFERR)
  1. .;
  1. .D RESET^DGMTU11(DFN,DGLY,DGMTI)
  1. .I $P($G(^DGMT(408.22,DGIRI,0)),"^",8)="" D
  1. ..S DA=DGIRI,DR=".08////0;.13////@",DIE="^DGMT(408.22," D ^DIE
  1. ..K DA,DR,DIE
  1. .S IVM0=$P(IVMSEG,"^",2,4)
  1. I IVMSPCHV="C" S IVM01=$P(IVMSEG,"^",6,9),IVM02=$P(IVMSEG,"^",3),IVM02=$P(IVMSEG,"^",30),IVM03=$P(IVMSEG,"^",15) ; EAS*1*113
  1. S DIK="^DGMT(408.22,"
  1. L +^DGMT(408.22,DGIRI):5 S:IVMSPCHV="V" $P(^DGMT(408.22,DGIRI,0),"^",5,7)=IVM0 S:IVMSPCHV="C" $P(^DGMT(408.22,DGIRI,0),"^",9,12)=IVM01,$P(^(0),"^",6)=IVM02,$P(^(0),"^",20)=IVM03 S DA=DGIRI D IX1^DIK L -^DGMT(408.22,DGIRI) ;EAS*1*113
  1. K DA,DIK
  1. Q
  1. ;
  1. INACTIVE ; inactivate dependents not in IVM means test and kill
  1. ; corresponding dgrel
  1. I $D(DGREL("S")) S DA(1)=+DGREL("S") D K DGREL("S")
  1. .D CHKINACT
  1. .Q:IVMFLG6!($D(IVMFERR))
  1. .; if spouse was active before income year, add record with date
  1. .; of 12/31 of year before income year with active code 0
  1. .S X=$E(DGLY,1,3)-1_1231
  1. .D INACT1
  1. Q:'$D(DGREL)!($D(IVMFERR))
  1. S IVMACTR=0
  1. F S IVMACTR=$O(DGREL("C",IVMACTR)) Q:'IVMACTR S DA(1)=+DGREL("C",IVMACTR) D K DGREL("C",IVMACTR)
  1. .D CHKINACT
  1. .Q:IVMFLG6!($D(IVMFERR))
  1. .; if child was active before income year, add record with date
  1. .; of 12/31 of year before income year with active code 0
  1. .S X=$E(DGLY,1,3)-1_1231
  1. .D INACT1
  1. ;
  1. K IVMACTR,IVMDGLY,IVMFLG6,IVMYEAR
  1. Q
  1. ;
  1. CHKINACT ; if dependent was made active during income year
  1. ; add record for same date (add .08 time) with active code 0
  1. ;
  1. S IVMFLG6=0
  1. S IVMDGLY="" F S IVMDGLY=$O(^DGPR(408.12,DA(1),"E","B",IVMDGLY)) Q:IVMDGLY']"" D Q:IVMFLG6!($D(IVMFERR))
  1. .Q:$E(IVMDGLY,1,3)'=$E(DGLY,1,3)
  1. .S IVMYEAR=0 F S IVMYEAR=$O(^(IVMDGLY,IVMYEAR)) Q:IVMYEAR']"" D Q:IVMFLG6!($D(IVMFERR))
  1. ..I $P($G(^DGPR(408.12,DA(1),"E",IVMYEAR,0)),"^",2) D
  1. ...S X=IVMDGLY_.08 D INACT1 S IVMFLG6=1
  1. ...Q
  1. Q
  1. ;
  1. INACT1 ; add inactivate entry to 408.1275
  1. ;
  1. K DINUM
  1. S (DIK,DIC)="^DGPR(408.12,DA(1),""E"",",DIC(0)="L",DLAYGO=408.1275 K DD,DO D FILE^DICN S DA=+Y K DLAYGO
  1. ;
  1. ; if can't create stub notify site & IVM Center
  1. I DA'>0 D Q
  1. .S (IVMTEXT(6),HLERR)="Can't create stub for file 408.1275"
  1. .D ERRBULL^IVMPREC7,MAIL^IVMUFNC()
  1. .S IVMFERR=""
  1. L +^DGPR(408.12,+DGPRI):5 S $P(^DGPR(408.12,DA(1),"E",DA,0),"^",2,4)=0_"^"_1_"^"_DGMTI D IX1^DIK L -^DGPR(408.12,+DGPRI)
  1. K DA,DIC,DIK
  1. Q