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

DGMTUTL3.m

Go to the documentation of this file.
  1. DGMTUTL3 ;ALB/GTS - Means Test generic utilities ; 12/16/05 2:53pm
  1. ;;5.3;Registration;**688**;Aug 13, 1993;Build 29
  1. ;
  1. VER(DGINC) ;* Return the version of Individual Annual Income records (0 or 1)
  1. ; Input: DGINC Individual Annual Income IEN Array
  1. ; Output: 1 - version 1 1010EZ form Feb, 2005
  1. ; 0 - version 0 1010EZ form pre Feb, 2005
  1. ; -1 - Annual Means Test record is associated and it is not a
  1. ; Means/Co-Pay test
  1. ;
  1. ; Example on input array:
  1. ; DGINC("D",#) = 408.21 record IENs for dependents. # 1 node
  1. ; for each Dependent
  1. ; DGINC("S") = 408.21 record IEN for active Spouse
  1. ; DGINC("V") = 408.21 record IEN for Veteran
  1. ;
  1. N MTVER,RECTYP,IAIIEN,CONVRT,FORM,IAIVER
  1. S MTVER=1 ;Version returned from API. If IAI rec's are for LTC tests,
  1. ; then VER exits and returns -1
  1. ;
  1. ;If a veteran DGINC node is not defined, then there is no IAI records
  1. ; for last year (current MT) and new (version 1) records will be entered
  1. ;QUIT!!
  1. I '$G(DGINC("V")) Q MTVER
  1. ;
  1. S CONVRT=-1 ;Indicates record is converted.
  1. ; (-1: LTC rec 0: 408.21/2.11 is null or 0;
  1. ; 1: 408.21/2.11 is 1)
  1. ; Version returned from IAIWALK. Any value of 0 causes VER to exit and return 0
  1. S IAIVER=1
  1. ;
  1. ;
  1. ; MTVER could be 0 because the IAI node is walked or is found to either
  1. ; have a 0 or null in 2.11. If 2.11 is null, the record has not been reviewed
  1. ; and a version not indicated.
  1. ;
  1. ; Check type of test associated with IAI records
  1. I (+$P($G(^DGMT(408.31,+$G(^DGMT(408.21,DGINC("V"),"MT")),0)),"^",19)>2) DO
  1. . W !!,"Income Records are for Long Term Care type tests. This data can not be edited."
  1. . S MTVER=-1
  1. ;
  1. Q:(MTVER=-1) MTVER ;QUIT if IAI records are for LTC type tests
  1. ;
  1. ; Quit loop if version is found to be 0 or the MT record has been
  1. ; verified and a version indicated
  1. F RECTYP="V","S","D" Q:(+MTVER=0) Q:(+CONVRT=1) DO
  1. . I RECTYP'="D" DO
  1. . . I $D(DGINC(RECTYP)) DO
  1. . . . S IAIIEN=DGINC(RECTYP)
  1. . . . ;Check 2.11 on related MT record in 408.31
  1. . . . ; (CONVRT=-1 : Conversion check not yet completed)
  1. . . . ;MTRECVER will return a value of 0 or 1 for CONVRT
  1. . . . D:(+CONVRT=-1) MTRECVER(IAIIEN,.FORM,.CONVRT) ;Assume all IAI rec's have #31 or don't
  1. . . . S:(CONVRT=1) MTVER=FORM ;If 408.31 rec has a version,
  1. . . . ; set MTVER and Quit with that value
  1. . . . I CONVRT=0 S IAIVER=$$IAIWALK(IAIIEN) ;IAIVER = 0 when version 0 IAI rec found
  1. . . . S:(IAIVER=0) MTVER=0
  1. . ;
  1. . ;Review Dependent IAI records
  1. . I RECTYP="D" DO
  1. . . N DEPNUM
  1. . . S DEPNUM=""
  1. . . ;QUIT 'D' IEN loop when all have been reviewed or related 408.31
  1. . . ; record has a version in 2.11
  1. . . F S DEPNUM=$O(DGINC("D",DEPNUM)) Q:DEPNUM="" Q:CONVRT=1 Q:IAIVER=0 DO
  1. . . . S IAIIEN=DGINC("D",DEPNUM)
  1. . . . ;Check 2.11 on related MT record in 408.31
  1. . . . ; (CONVRT=-1 : conversion check not yet completed)
  1. . . . ; MTRECVER will return a value of 0 or 1 for CONVRT
  1. . . . D:(+CONVRT=-1) MTRECVER(IAIIEN,.FORM,.CONVRT) ;Assume all IAI rec's have #31 or don't
  1. . . . S:(CONVRT=1) MTVER=FORM ;if 408.31 rec has a version, set MTVER and Quit with that value
  1. . . . I CONVRT=0 S IAIVER=$$IAIWALK(IAIIEN) ;IAIVER = 0 when version 0 IAI record is found
  1. . . . S:(IAIVER=0) MTVER=0
  1. Q MTVER
  1. ;
  1. MTRECVER(IAI,VER211,CONVRT) ;* Return the version indicated in 408.31 Means Test Version field (2.11)
  1. ; Input: IAI - Individual Annual Income entry IEN
  1. ;
  1. ; Output (passed by reference):
  1. ; VER211: 1 - version 1 1010EZ form Feb, 2005
  1. ; 0 - version 0 1010EZ form pre Feb, 2005
  1. ; NULL - version not indicated on 408.31
  1. ;
  1. ; CONVRT: 0 - Means Test Version field (2.11) is not defined
  1. ; 1 - Means Test Version field is defined with a value (0 or 1)
  1. ;
  1. S CONVRT=0
  1. S VER211=$P($G(^DGMT(408.31,+$G(^DGMT(408.21,IAI,"MT")),2)),"^",11)
  1. S:(VER211'["") CONVRT=1
  1. S VER211=+VER211
  1. Q
  1. ;
  1. IAIWALK(IAI) ;* Return the version per findings in 408.21 record
  1. ; Input: IAI - Individual Annual Income entry IEN
  1. ; Returned value:
  1. ; 0 - Record contains data defined for version 0 (pre Feb, 2005)
  1. ; Form (pce's 9-13, 15, 16)
  1. ; 1 - Record contains data defined for version 1 (Feb, 2005) Form
  1. ;
  1. N RECVER,IAIREC,NULLVAL,PCE
  1. S NULLVAL=""
  1. S PCE=""
  1. S RECVER=1
  1. S IAIREC=$G(^DGMT(408.21,IAI,0))
  1. F PCE=9:1:13,15,16 I $P(IAIREC,"^",PCE)'=NULLVAL S RECVER=0
  1. Q RECVER