VAFCMGB3 ;ALB/JRP,LTL,PTD-DEMOGRAPHIC MERGE SCREENS ;07/10/98
 ;;5.3;Registration;**149,477,479**;Aug 13, 1993
 ;
 ;NOTE: This routine contains line tags used to build the display
 ;      screen for a List Manager interface.  Refer to routine
 ;      VAFCMGB for a description of input/output variables.
 ;
GROUP4 ;Line tag to build logical group number four
 ;
 ;Group group contains the following fields
 ;  .301, .302, .323, 391, 1901
 ;
 ;Column width is limited to 29 characters
 ;
 ;Declare variables
 N IENS,TARGET,MESSAGE,LINE,DATA,LOCAL,REMOTE,DIFF
 S TARGET="^TMP(""VAFC-MERGE-TO"","_$J_",""DATA"")"
 S MESSAGE="^TMP(""VAFC-MERGE-TO"","_$J_",""MESSAGE"")"
 ;Initialize global locations
 K @TARGET,@MESSAGE
 ;Set group index
 S @VALMAR@("GRP",4)=VALMCNT
 ;Get local data for patient
 D GETDATA^VAFCMGU0(VAFCDFN,4,TARGET,MESSAGE)
 ;Build display
 S IENS=VAFCDFN_","
 ;Patient Type
 ;S LOCAL=$$LOCAL^VAFCMGB0(2,391,IENS,TARGET) ;**477
 ;S LOCAL=$E(LOCAL,1,29)
 ;S REMOTE=$$REMOTE^VAFCMGB0(2,391)
 ;S REMOTE=$E(REMOTE,1,29)
 ;S DIFF=$$DIFFCHK^VAFCMGB0(2,391,IENS,TARGET)
 ;S LINE=$S(DIFF:"**",1:"  ")
 ;S:DIFF&($P($G(@VAFCARR@(2,391)),U,2)) LINE="->"
 ;S DATA="Type: "_LOCAL
 ;S LINE=$$INSERT^VAFCMGU0(DATA,LINE,11)
 ;S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,50)
 ;S @VALMAR@("IDX",VALMCNT,18)=""
 ;I (DIFF) D
 ;.S @VALMAR@("E2F",19,1)="2^391"
 ;.S @VALMAR@("E2G",19)=4
 ;I ('DIFF) D
 ;.K @VALMAR@("E2F",19)
 ;.K @VALMAR@("E2G",19)
 ;W:(+$G(VAFCDOTS)) "."
 ;S VALMCNT=VALMCNT+1
 ;Veteran
 S LOCAL=$$LOCAL^VAFCMGB0(2,1901,IENS,TARGET)
 S LOCAL=$E(LOCAL,1,29)
 S REMOTE=$$REMOTE^VAFCMGB0(2,1901)
 S REMOTE=$E(REMOTE,1,29)
 S DIFF=$$DIFFCHK^VAFCMGB0(2,1901,IENS,TARGET)
 S LINE=$S(DIFF:"**",1:"  ")
 S:DIFF&($P($G(@VAFCARR@(2,1901)),U,2)) LINE="->"
 S DATA="Veteran: "_LOCAL
 S LINE=$$INSERT^VAFCMGU0(DATA,LINE,8)
 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,50)
 S (@VALMAR@("IDX",VALMCNT,18),@VALMAR@("IDX",VALMCNT+1,18))=""
 ;I (DIFF) D
 ;.S @VALMAR@("E2F",20,1)="2^1901"
 ;.S @VALMAR@("E2G",20)=4
 ;I ('DIFF) D
 ;.K @VALMAR@("E2F",20)
 ;.K @VALMAR@("E2G",20)
 W:(+$G(VAFCDOTS)) "."
 S VALMCNT=VALMCNT+1 ;**479 changed +2 to +1
 ;Service connected and percentage
 S LOCAL=$$LOCAL^VAFCMGB0(2,.301,IENS,TARGET)
 S LOCAL("SC")=$E(LOCAL,1,29)
 S REMOTE=$$REMOTE^VAFCMGB0(2,.301)
 S REMOTE("SC")=$E(REMOTE,1,29)
 S DIFF=$$DIFFCHK^VAFCMGB0(2,.301,IENS,TARGET)
 S LOCAL("SC%")=$$LOCAL^VAFCMGB0(2,.302,IENS,TARGET)
 S REMOTE("SC%")=$$REMOTE^VAFCMGB0(2,.302)
 S:('DIFF) DIFF=$$DIFFCHK^VAFCMGB0(2,.302,IENS,TARGET)
 S:((LOCAL("SC%")="<No Data Found>")&(LOCAL("SC")="NO")) LOCAL("SC%")="N/A"
 S:((REMOTE("SC%")="<No Data Found>")&(REMOTE("SC%")="NO")) REMOTE("SC%")="N/A"
 S REMOTE("SC")=REMOTE("SC")_"  "_REMOTE("SC%")
 S LINE=$S(DIFF:"**",1:"  ")
 S:DIFF&($P($G(@VAFCARR@(2,.301)),U,2)) LINE="->"
 S DATA="SC: "_LOCAL("SC")_"  SC%: "_LOCAL("SC%")
 S LINE=$$INSERT^VAFCMGU0(DATA,LINE,13)
 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE("SC"),LINE,50)
 ;S DATA="SC %: "_LOCAL("SC%")
 ;S LINE=$$INSERT^VAFCMGU0(DATA,"",11)
 ;S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE("SC%"),LINE,54)
 S @VALMAR@("IDX",VALMCNT,18)=""
 ;S @VALMAR@("IDX",VALMCNT+1,21)=""
 ;S @VALMAR@("IDX",VALMCNT+2,21)=""
 ;I (DIFF) D
 ;.S @VALMAR@("E2F",21,1)="2^.301"
 ;.S @VALMAR@("E2F",21,2)="2^.302"
 ;.S @VALMAR@("E2G",21)=4
 ;I ('DIFF) D
 ;.K @VALMAR@("E2F",21)
 ;.K @VALMAR@("E2G",21)
 W:(+$G(VAFCDOTS)) "."
 S VALMCNT=VALMCNT+1
 ;Period of service
 S LOCAL=$$LOCAL^VAFCMGB0(2,.323,IENS,TARGET)
 S LOCAL=$E(LOCAL,1,29)
 S REMOTE=$$REMOTE^VAFCMGB0(2,.323)
 S REMOTE=$E(REMOTE,1,29)
 S DIFF=$$DIFFCHK^VAFCMGB0(2,.323,IENS,TARGET)
 S LINE=$S(DIFF:"**",1:"  ")
 S:DIFF&($P($G(@VAFCARR@(2,.323)),U,2)) LINE="->"
 S DATA="POS: "_LOCAL
 S LINE=$$INSERT^VAFCMGU0(DATA,LINE,12)
 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,50)
 S @VALMAR@("IDX",VALMCNT,18)=""
 ;I (DIFF) D
 ;.S @VALMAR@("E2F",22,1)="2^.323"
 ;.S @VALMAR@("E2G",22)=4
 ;I ('DIFF) D
 ;.K @VALMAR@("E2F",22)
 ;.K @VALMAR@("E2G",22)
 W:(+$G(VAFCDOTS)) "."
 S VALMCNT=VALMCNT+1
 ;Primary Eligibility Code
 S LOCAL=$$LOCAL^VAFCMGB0(2,.361,IENS,TARGET)
 S REMOTE=$$REMOTE^VAFCMGB0(2,.361)
 S DIFF=$$DIFFCHK^VAFCMGB0(2,.361,IENS,TARGET)
 S LINE=$S(DIFF:"**",1:"  ")
 S:DIFF&($P($G(@VAFCARR@(2,.361)),U,2)) LINE="->"
 S DATA="Prim Elig Code: "_LOCAL
 S LINE=$$INSERT^VAFCMGU0(DATA,LINE,3)
 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,50)
 S @VALMAR@("IDX",VALMCNT,18)=""
 S VALMCNT=VALMCNT+1
 ;Date of eligibility status
 S LOCAL=$$LOCAL^VAFCMGB0(2,.3612,IENS,TARGET)
 S REMOTE=$$FMTE^XLFDT($$REMOTE^VAFCMGB0(2,.3612),1)
 S DIFF=$$DIFFCHK^VAFCMGB0(2,.3612,IENS,TARGET)
 S LINE=$S(DIFF:"**",1:"  ")
 S:DIFF&($P($G(@VAFCARR@(2,.3612)),U,2)) LINE="->"
 S DATA="Date Verified: "_LOCAL
 S LINE=$$INSERT^VAFCMGU0(DATA,LINE,3)
 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,50)
 S @VALMAR@("IDX",VALMCNT,18)=""
 S VALMCNT=VALMCNT+1
 ;Verification method
 S LOCAL=$$LOCAL^VAFCMGB0(2,.3615,IENS,TARGET)
 S REMOTE=$$REMOTE^VAFCMGB0(2,.3615)
 S DIFF=$$DIFFCHK^VAFCMGB0(2,.3615,IENS,TARGET)
 S LINE=$S(DIFF:"**",1:"  ")
 S:DIFF&($P($G(@VAFCARR@(2,.3615)),U,2)) LINE="->"
 S DATA="Verification method: "
 S LINE=$$INSERT^VAFCMGU0(DATA,LINE,3)
 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0("",LINE,50)
 S @VALMAR@("IDX",VALMCNT,18)=""
 S VALMCNT=VALMCNT+1
 S LINE="",LINE=$$INSERT^VAFCMGU0(LOCAL,LINE,3)
 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,50)
 S @VALMAR@("IDX",VALMCNT,18)=""
 S VALMCNT=VALMCNT+1
 ;Who verified locally (no remote data sent)
 S LOCAL=$$LOCAL^VAFCMGB0(2,.3616,IENS,TARGET)
 S REMOTE="<Not Available>"
 S LINE="  "
 S DATA="Who verified: "_LOCAL
 S LINE=$$INSERT^VAFCMGU0(DATA,LINE,3)
 S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,50)
 S @VALMAR@("IDX",VALMCNT,18)=""
 S VALMCNT=VALMCNT+1
 ;If PATIENT ELIGIBILITIES multiple contains EMPLOYEE, display local data (no remote data sent).
 S LOCAL=$O(^DIC(8,"B","EMPLOYEE",0)) I LOCAL D
 .Q:'$D(^DPT(VAFCDFN,"E",LOCAL,0))
 .;Else patient is an employee
 .S REMOTE="<Not Available>",LINE="  ",DATA="Other Eligibility: EMPLOYEE"
 .S LINE=$$INSERT^VAFCMGU0(DATA,LINE,3)
 .S @VALMAR@(VALMCNT,0)=$$INSERT^VAFCMGU0(REMOTE,LINE,50)
 .S @VALMAR@("IDX",VALMCNT,18)=""
 ;Done - cleanup global locations used
 K @TARGET,@MESSAGE
 Q
