VAFCMGA1 ;BIR/LTL-DEMOGRAPHIC MERGE SCREEN ACTIONS cont. ;24 Sep 96
 ;;5.3;Registration;**149,477**;Aug 13, 1993
 ;
 ;NOTE: The VAFCMGA* routines contain line tags used to implement
 ;      the actions of a List Manager user interface.  All line
 ;      tags assume that the following variables and arrays are
 ;      defined.
 ;
 ;Input  : VAFCDFN - Pointer to entry in PATIENT file (#2) to merge
 ;                   data into
 ;         VAFCARR - Array contain data to merge (full global reference)
 ;                   VAFCARR() should be set as follows:
 ;                     VAFCARR(File,Field) = Value
 ;                       Where File = File number Value is from
 ;                             Field = Field number Value is from
 ;                             Value = Info to merge
 ;                       Notes: Dates must be in FileMan format
 ;                            : Special considerations for Value
 ;                             "@"  - Displays <Data Deleted> and deletes
 ;                                       local value if merged
 ;                                "^text"  - Displays text and ignores
 ;                                           field if merged
 ;                                NULL  - Displays <No Data Found> and
 ;                                        ignores field if merged
 ;                                Doesn't exist  - Displays <UR>
 ;                                                 and ignores field
 ;                                                 if merged
 ;         VAFCFROM - Text denoting where merge data cam from (1-35)
 ;         VAFCEVDT - Date/time merge data was instantiated (FileMan)
 ;         All variables set by List Manager Interface
 ;         Display area and variables required List Manager interface
 ;         Display
 ;           VALMAR(Line,0) = Line of text in display
 ;         Indexes
 ;           VALMAR("IDX",Line,Entry) = ""
 ;           VALMAR("E2F",Entry,N) = File^Field
 ;             N => Allows for multiple fields per entry (starts with 1)
 ;           VALMAR("E2G",Entry) = Group entry is contained in
 ;           VALMAR("GRP",Group) = First line of group in display
 ;             Note: The E2F and E2G indexes are only set if the data
 ;                   to merge does not match the local data
 ;
UNDO ;Undo selected merges
 ;
 ;Input  : See above note on input variables
 ;Output : VALMAR() array will be rebuilt accordingly
 ;
 ;Declare variables
 N VAFCDOTS
 N ENTRY,IENS,FDAROOT,MSGROOT,QUOTE
 S FDAROOT="^TMP(""VAFC-UNDO"","_$J_",""FDA"")"
 S MSGROOT="^TMP(""VAFC-UNDO"","_$J_",""MSG"")"
 S QUOTE=$C(34)
 S IENS=VAFCDFN_","
 I '$O(@FDAROOT@(0)) S VALMSG="You haven't merged anything yet?!" G UNDOQ
 ;undo
 S VALMSG="Merge undone."
 N DGNOFDEL S DGNOFDEL=1 ;**477 stop NOK Name x-ref from firing.
 ;NEW EASZIPLK S EASZIPLK=1 ;**477 zipcode lookup for GMT
 D FILE^DIE("E",FDAROOT,MSGROOT)
 ;Rebuild required portion of display
 S VAFCDOTS=1
 F ENTRY=1:1:4 D RBLDGRP^VAFCMGB(ENTRY)
 ;No more differences
 S:('$D(@VALMAR@("E2F"))) VALMSG="** No differences found **"
 ;Done - refresh List Manager display
UNDOQ K @FDAROOT,@MSGROOT S VALMBCK="R"
 Q
 ;
PDAT ;remote pdat ;**477
 NEW DFN,ICN,VAFCDEL,VAFCDIR,VAFCFILE
 S DFN=VAFCDFN
 S ICN=+$$GETICN^MPIF001(DFN)
 S VALMBCK="" ;clear bottom portion of screen and prompt for action
 S VAFCDIR=$$GET^XPAR("SYS","VAFC HFS SCRATCH") ;hfs directory
 S VAFCFILE="VAFC"_DUZ_".DAT" ;file name for local pdat
 S IOM=132,IOSL=99999,IOST="P-DUMMY",IOF=""""""
 D OPEN^%ZISH("VAFC",VAFCDIR,VAFCFILE,"W") Q:POP  ;open up file
 U IO
 I ICN'="" D START^VAFCPDAT ;local pdat to file
 D CLOSE^%ZISH("VAFC") ;close up file
 K ^TMP("RGPDAT",$J) ;global array to hold pdat for listman
 S X=$$FTG^%ZISH(VAFCDIR,VAFCFILE,$NAME(^TMP("RGPDAT",$J,1)),3) ;file to global
 S VAFCDEL(VAFCFILE)="" ;list of file(s) to delete
 S X=$$DEL^%ZISH(VAFCDIR,$NA(VAFCDEL)) ;delete file
 I $D(^TMP("RGPDAT",$J)) D EN^RGEX04 ;list manager for remote pdat
 S VALMBCK="R" ;refresh screen
 Q
 ;
RAUD ;remote audit ;**477
 NEW DFN,ICN,VAFCBDT,VAFCEDT,VAFCDEL,VAFCDIR,VAFCFILE
 S DFN=VAFCDFN
 S ICN=+$$GETICN^MPIF001(DFN)
 S VALMBCK="" ;clear bottom portion of screen and prompt for action
 D ASK2^VAFCAUD I '$G(VAFCBDT)!'$G(VAFCEDT) Q  ;date range of local and remote audits
 S VAFCDIR=$$GET^XPAR("SYS","VAFC HFS SCRATCH") ;hfs directory
 S VAFCFILE="VAFC"_DUZ_".DAT" ;file name for local audit
 S IOM=132,IOSL=99999,IOST="P-DUMMY",IOF=""""""
 D OPEN^%ZISH("VAFC",VAFCDIR,VAFCFILE,"W") Q:POP  ;open up file
 U IO
 I '$O(^DIA(2,"B",DFN,0)) W !,"This patient has no audit data available."
 I $O(^DIA(2,"B",DFN,0)) S QFLG=1,RPCFLG=1 D START^VAFCAUD(DFN,VAFCBDT,VAFCEDT,RPCFLG) ;local audit to file
 D CLOSE^%ZISH("VAFC") ;close up file
 K ^TMP("VAFCRAUD",$J) ;global array to hold audit for listman
 S X=$$FTG^%ZISH(VAFCDIR,VAFCFILE,$NAME(^TMP("VAFCRAUD",$J,1)),3) ;file to global
 S VAFCDEL(VAFCFILE)="" ;list of file(s) to delete
 S X=$$DEL^%ZISH(VAFCDIR,$NA(VAFCDEL)) ;delete file
 I $D(^TMP("VAFCRAUD",$J)) D EN^VAFCLAU ;list manager for remote audit
 S VALMBCK="R" ;refresh screen
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAFCMGA1   5206     printed  Sep 23, 2025@20:37:41                                                                                                                                                                                                    Page 2
VAFCMGA1  ;BIR/LTL-DEMOGRAPHIC MERGE SCREEN ACTIONS cont. ;24 Sep 96
 +1       ;;5.3;Registration;**149,477**;Aug 13, 1993
 +2       ;
 +3       ;NOTE: The VAFCMGA* routines contain line tags used to implement
 +4       ;      the actions of a List Manager user interface.  All line
 +5       ;      tags assume that the following variables and arrays are
 +6       ;      defined.
 +7       ;
 +8       ;Input  : VAFCDFN - Pointer to entry in PATIENT file (#2) to merge
 +9       ;                   data into
 +10      ;         VAFCARR - Array contain data to merge (full global reference)
 +11      ;                   VAFCARR() should be set as follows:
 +12      ;                     VAFCARR(File,Field) = Value
 +13      ;                       Where File = File number Value is from
 +14      ;                             Field = Field number Value is from
 +15      ;                             Value = Info to merge
 +16      ;                       Notes: Dates must be in FileMan format
 +17      ;                            : Special considerations for Value
 +18      ;                             "@"  - Displays <Data Deleted> and deletes
 +19      ;                                       local value if merged
 +20      ;                                "^text"  - Displays text and ignores
 +21      ;                                           field if merged
 +22      ;                                NULL  - Displays <No Data Found> and
 +23      ;                                        ignores field if merged
 +24      ;                                Doesn't exist  - Displays <UR>
 +25      ;                                                 and ignores field
 +26      ;                                                 if merged
 +27      ;         VAFCFROM - Text denoting where merge data cam from (1-35)
 +28      ;         VAFCEVDT - Date/time merge data was instantiated (FileMan)
 +29      ;         All variables set by List Manager Interface
 +30      ;         Display area and variables required List Manager interface
 +31      ;         Display
 +32      ;           VALMAR(Line,0) = Line of text in display
 +33      ;         Indexes
 +34      ;           VALMAR("IDX",Line,Entry) = ""
 +35      ;           VALMAR("E2F",Entry,N) = File^Field
 +36      ;             N => Allows for multiple fields per entry (starts with 1)
 +37      ;           VALMAR("E2G",Entry) = Group entry is contained in
 +38      ;           VALMAR("GRP",Group) = First line of group in display
 +39      ;             Note: The E2F and E2G indexes are only set if the data
 +40      ;                   to merge does not match the local data
 +41      ;
UNDO      ;Undo selected merges
 +1       ;
 +2       ;Input  : See above note on input variables
 +3       ;Output : VALMAR() array will be rebuilt accordingly
 +4       ;
 +5       ;Declare variables
 +6        NEW VAFCDOTS
 +7        NEW ENTRY,IENS,FDAROOT,MSGROOT,QUOTE
 +8        SET FDAROOT="^TMP(""VAFC-UNDO"","_$JOB_",""FDA"")"
 +9        SET MSGROOT="^TMP(""VAFC-UNDO"","_$JOB_",""MSG"")"
 +10       SET QUOTE=$CHAR(34)
 +11       SET IENS=VAFCDFN_","
 +12       IF '$ORDER(@FDAROOT@(0))
               SET VALMSG="You haven't merged anything yet?!"
               GOTO UNDOQ
 +13      ;undo
 +14       SET VALMSG="Merge undone."
 +15      ;**477 stop NOK Name x-ref from firing.
           NEW DGNOFDEL
           SET DGNOFDEL=1
 +16      ;NEW EASZIPLK S EASZIPLK=1 ;**477 zipcode lookup for GMT
 +17       DO FILE^DIE("E",FDAROOT,MSGROOT)
 +18      ;Rebuild required portion of display
 +19       SET VAFCDOTS=1
 +20       FOR ENTRY=1:1:4
               DO RBLDGRP^VAFCMGB(ENTRY)
 +21      ;No more differences
 +22       if ('$DATA(@VALMAR@("E2F")))
               SET VALMSG="** No differences found **"
 +23      ;Done - refresh List Manager display
UNDOQ      KILL @FDAROOT,@MSGROOT
           SET VALMBCK="R"
 +1        QUIT 
 +2       ;
PDAT      ;remote pdat ;**477
 +1        NEW DFN,ICN,VAFCDEL,VAFCDIR,VAFCFILE
 +2        SET DFN=VAFCDFN
 +3        SET ICN=+$$GETICN^MPIF001(DFN)
 +4       ;clear bottom portion of screen and prompt for action
           SET VALMBCK=""
 +5       ;hfs directory
           SET VAFCDIR=$$GET^XPAR("SYS","VAFC HFS SCRATCH")
 +6       ;file name for local pdat
           SET VAFCFILE="VAFC"_DUZ_".DAT"
 +7        SET IOM=132
           SET IOSL=99999
           SET IOST="P-DUMMY"
           SET IOF=""""""
 +8       ;open up file
           DO OPEN^%ZISH("VAFC",VAFCDIR,VAFCFILE,"W")
           if POP
               QUIT 
 +9        USE IO
 +10      ;local pdat to file
           IF ICN'=""
               DO START^VAFCPDAT
 +11      ;close up file
           DO CLOSE^%ZISH("VAFC")
 +12      ;global array to hold pdat for listman
           KILL ^TMP("RGPDAT",$JOB)
 +13      ;file to global
           SET X=$$FTG^%ZISH(VAFCDIR,VAFCFILE,$NAME(^TMP("RGPDAT",$JOB,1)),3)
 +14      ;list of file(s) to delete
           SET VAFCDEL(VAFCFILE)=""
 +15      ;delete file
           SET X=$$DEL^%ZISH(VAFCDIR,$NAME(VAFCDEL))
 +16      ;list manager for remote pdat
           IF $DATA(^TMP("RGPDAT",$JOB))
               DO EN^RGEX04
 +17      ;refresh screen
           SET VALMBCK="R"
 +18       QUIT 
 +19      ;
RAUD      ;remote audit ;**477
 +1        NEW DFN,ICN,VAFCBDT,VAFCEDT,VAFCDEL,VAFCDIR,VAFCFILE
 +2        SET DFN=VAFCDFN
 +3        SET ICN=+$$GETICN^MPIF001(DFN)
 +4       ;clear bottom portion of screen and prompt for action
           SET VALMBCK=""
 +5       ;date range of local and remote audits
           DO ASK2^VAFCAUD
           IF '$GET(VAFCBDT)!'$GET(VAFCEDT)
               QUIT 
 +6       ;hfs directory
           SET VAFCDIR=$$GET^XPAR("SYS","VAFC HFS SCRATCH")
 +7       ;file name for local audit
           SET VAFCFILE="VAFC"_DUZ_".DAT"
 +8        SET IOM=132
           SET IOSL=99999
           SET IOST="P-DUMMY"
           SET IOF=""""""
 +9       ;open up file
           DO OPEN^%ZISH("VAFC",VAFCDIR,VAFCFILE,"W")
           if POP
               QUIT 
 +10       USE IO
 +11       IF '$ORDER(^DIA(2,"B",DFN,0))
               WRITE !,"This patient has no audit data available."
 +12      ;local audit to file
           IF $ORDER(^DIA(2,"B",DFN,0))
               SET QFLG=1
               SET RPCFLG=1
               DO START^VAFCAUD(DFN,VAFCBDT,VAFCEDT,RPCFLG)
 +13      ;close up file
           DO CLOSE^%ZISH("VAFC")
 +14      ;global array to hold audit for listman
           KILL ^TMP("VAFCRAUD",$JOB)
 +15      ;file to global
           SET X=$$FTG^%ZISH(VAFCDIR,VAFCFILE,$NAME(^TMP("VAFCRAUD",$JOB,1)),3)
 +16      ;list of file(s) to delete
           SET VAFCDEL(VAFCFILE)=""
 +17      ;delete file
           SET X=$$DEL^%ZISH(VAFCDIR,$NAME(VAFCDEL))
 +18      ;list manager for remote audit
           IF $DATA(^TMP("VAFCRAUD",$JOB))
               DO EN^VAFCLAU
 +19      ;refresh screen
           SET VALMBCK="R"
 +20       QUIT