NURXPRE ;HIRMFO/FT-Nursing Service v4.0 Pre-initialization routine ;1/21/97  14:58
 ;;4.0;NURSING SERVICE;;Apr 25, 1997
 ;
 ; This routine contains the pre-initialization code for the Nursing
 ; Service package v4.0.
 ;
 D ^NURXENV I $G(XPDABORT) D KILL Q
 S NURPKG=+$$VERSION^XPDUTL("GMRV")
 I NURPKG<4 D BMES^XPDUTL("Vitals/Measurements v4.0 is required before you continue with this installation.") S XPDABORT=2 D KILL Q
 S NURPKG=+$$VERSION^XPDUTL("GMRY")
 I NURPKG<4 D BMES^XPDUTL("Intake/Output v4.0 is required before you continue with this installation.") S XPDABORT=2 D KILL Q
 D OFFLINE,KILLDD,NMSP
KILL ; kill variables
 K DA,DIC,DIE,DLAYGO,DR,NURCNT,NURDA,NURERROR,NURIEN,NURMSG,NURPATCH,NURPKG,NURSEQ,X,Y
 Q
OFFLINE ; Set Nursing switch to Off-Line
 S $P(^DIC(213.9,1,"OFF"),U,1)=1
 D BMES^XPDUTL("Setting Nursing software switch to OFF-LINE")
 Q
KILLDD ; Kill old data dictionary nodes that no longer apply
 ;
 ; old File 16 references
 K ^DD(210,21.71,9.3)
 K ^DD(210,21.71,9.4)
 ; old computed field code
 K ^DD(210,19,9.01)
 K ^DD(210,19,9.1)
 K ^DD(210,19,9.2)
 K ^DD(210,19,9.3)
 K ^DD(213.4,11,9.2)
 D BMES^XPDUTL("Killing old data dictionary nodes that are no longer needed.")
 Q
 ;
NMSP ; This subroutine changes the PACKAGE FILE LINK (#1) pointer value to
 ; the NUR*3.0*1/3/6/7/8/9/10 entries in the BUILD (#9.6) and INSTALL
 ; (#9.7) files to the NURSING SERVICE entry.
 ;
 Q:+$$VERSION^XPDUTL("NUR")>3  ;quit if v4.0 already installed.
 Q:'$D(^NURSF(210,0))  ;quit if virgin installation
 D FIND^DIC(9.4,"","","X","NUR","","C","","","NURIEN","NURERROR")
 S NURDA=$O(NURIEN("DILIST",2,0)) Q:'NURDA
 S NURDA=+$G(NURIEN("DILIST",2,+NURDA))
 D BUILD,INSTALL
 Q
BUILD ; stuff pointer for NURSING SERVICE in PACKAGE FILE LINK field (#1)
 ; of BUILD file (#9.6) for NUR*3.0*1/3/6/7/8/9/10 entries
 Q:'$G(NURDA)  ;quit if no package file pointer value
 F NURPATCH="NUR*3.0*1","NUR*3.0*3","NUR*3.0*6","NUR*3.0*7","NUR*3.0*8","NUR*3.0*9","NUR*3.0*10" D
 .K NURIEN,NURERROR
 .D FIND^DIC(9.6,"","","X",NURPATCH,"","B","","","NURIEN","NURERROR")
 .S NURSEQ=0
 .F  S NURSEQ=+$O(NURIEN("DILIST",2,NURSEQ)) Q:NURSEQ'>0  D
 ..S DA=+$G(NURIEN("DILIST",2,NURSEQ)) Q:DA'>0
 ..S DIE="^XPD(9.6,",DR="1////"_NURDA D ^DIE
 ..Q
 .Q
 Q
INSTALL ; stuff pointer for NURSING SERVICE in PACKAGE FILE LINK field (#1)
 ; of INSTALL file (#9.7) for NUR*3.0*1/3/6/7/8/9/10 entries
 Q:'$G(NURDA)  ;quit if no package file pointer value
 F NURPATCH="NUR*3.0*1","NUR*3.0*3","NUR*3.0*6","NUR*3.0*7","NUR*3.0*8","NUR*3.0*9","NUR*3.0*10" D
 .K NURIEN,NURERROR
 .D FIND^DIC(9.7,"","","X",NURPATCH,"","B","","","NURIEN","NURERROR")
 .S NURSEQ=0
 .F  S NURSEQ=+$O(NURIEN("DILIST",2,NURSEQ)) Q:NURSEQ'>0  D
 ..S DA=+$G(NURIEN("DILIST",2,NURSEQ)) Q:DA'>0
 ..S DIE="^XPD(9.7,",DR="1////"_NURDA D ^DIE
 ..Q
 .Q
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HNURXPRE   2863     printed  Sep 23, 2025@19:58:54                                                                                                                                                                                                     Page 2
NURXPRE   ;HIRMFO/FT-Nursing Service v4.0 Pre-initialization routine ;1/21/97  14:58
 +1       ;;4.0;NURSING SERVICE;;Apr 25, 1997
 +2       ;
 +3       ; This routine contains the pre-initialization code for the Nursing
 +4       ; Service package v4.0.
 +5       ;
 +6        DO ^NURXENV
           IF $GET(XPDABORT)
               DO KILL
               QUIT 
 +7        SET NURPKG=+$$VERSION^XPDUTL("GMRV")
 +8        IF NURPKG<4
               DO BMES^XPDUTL("Vitals/Measurements v4.0 is required before you continue with this installation.")
               SET XPDABORT=2
               DO KILL
               QUIT 
 +9        SET NURPKG=+$$VERSION^XPDUTL("GMRY")
 +10       IF NURPKG<4
               DO BMES^XPDUTL("Intake/Output v4.0 is required before you continue with this installation.")
               SET XPDABORT=2
               DO KILL
               QUIT 
 +11       DO OFFLINE
           DO KILLDD
           DO NMSP
KILL      ; kill variables
 +1        KILL DA,DIC,DIE,DLAYGO,DR,NURCNT,NURDA,NURERROR,NURIEN,NURMSG,NURPATCH,NURPKG,NURSEQ,X,Y
 +2        QUIT 
OFFLINE   ; Set Nursing switch to Off-Line
 +1        SET $PIECE(^DIC(213.9,1,"OFF"),U,1)=1
 +2        DO BMES^XPDUTL("Setting Nursing software switch to OFF-LINE")
 +3        QUIT 
KILLDD    ; Kill old data dictionary nodes that no longer apply
 +1       ;
 +2       ; old File 16 references
 +3        KILL ^DD(210,21.71,9.3)
 +4        KILL ^DD(210,21.71,9.4)
 +5       ; old computed field code
 +6        KILL ^DD(210,19,9.01)
 +7        KILL ^DD(210,19,9.1)
 +8        KILL ^DD(210,19,9.2)
 +9        KILL ^DD(210,19,9.3)
 +10       KILL ^DD(213.4,11,9.2)
 +11       DO BMES^XPDUTL("Killing old data dictionary nodes that are no longer needed.")
 +12       QUIT 
 +13      ;
NMSP      ; This subroutine changes the PACKAGE FILE LINK (#1) pointer value to
 +1       ; the NUR*3.0*1/3/6/7/8/9/10 entries in the BUILD (#9.6) and INSTALL
 +2       ; (#9.7) files to the NURSING SERVICE entry.
 +3       ;
 +4       ;quit if v4.0 already installed.
           if +$$VERSION^XPDUTL("NUR")>3
               QUIT 
 +5       ;quit if virgin installation
           if '$DATA(^NURSF(210,0))
               QUIT 
 +6        DO FIND^DIC(9.4,"","","X","NUR","","C","","","NURIEN","NURERROR")
 +7        SET NURDA=$ORDER(NURIEN("DILIST",2,0))
           if 'NURDA
               QUIT 
 +8        SET NURDA=+$GET(NURIEN("DILIST",2,+NURDA))
 +9        DO BUILD
           DO INSTALL
 +10       QUIT 
BUILD     ; stuff pointer for NURSING SERVICE in PACKAGE FILE LINK field (#1)
 +1       ; of BUILD file (#9.6) for NUR*3.0*1/3/6/7/8/9/10 entries
 +2       ;quit if no package file pointer value
           if '$GET(NURDA)
               QUIT 
 +3        FOR NURPATCH="NUR*3.0*1","NUR*3.0*3","NUR*3.0*6","NUR*3.0*7","NUR*3.0*8","NUR*3.0*9","NUR*3.0*10"
               Begin DoDot:1
 +4                KILL NURIEN,NURERROR
 +5                DO FIND^DIC(9.6,"","","X",NURPATCH,"","B","","","NURIEN","NURERROR")
 +6                SET NURSEQ=0
 +7                FOR 
                       SET NURSEQ=+$ORDER(NURIEN("DILIST",2,NURSEQ))
                       if NURSEQ'>0
                           QUIT 
                       Begin DoDot:2
 +8                        SET DA=+$GET(NURIEN("DILIST",2,NURSEQ))
                           if DA'>0
                               QUIT 
 +9                        SET DIE="^XPD(9.6,"
                           SET DR="1////"_NURDA
                           DO ^DIE
 +10                       QUIT 
                       End DoDot:2
 +11               QUIT 
               End DoDot:1
 +12       QUIT 
INSTALL   ; stuff pointer for NURSING SERVICE in PACKAGE FILE LINK field (#1)
 +1       ; of INSTALL file (#9.7) for NUR*3.0*1/3/6/7/8/9/10 entries
 +2       ;quit if no package file pointer value
           if '$GET(NURDA)
               QUIT 
 +3        FOR NURPATCH="NUR*3.0*1","NUR*3.0*3","NUR*3.0*6","NUR*3.0*7","NUR*3.0*8","NUR*3.0*9","NUR*3.0*10"
               Begin DoDot:1
 +4                KILL NURIEN,NURERROR
 +5                DO FIND^DIC(9.7,"","","X",NURPATCH,"","B","","","NURIEN","NURERROR")
 +6                SET NURSEQ=0
 +7                FOR 
                       SET NURSEQ=+$ORDER(NURIEN("DILIST",2,NURSEQ))
                       if NURSEQ'>0
                           QUIT 
                       Begin DoDot:2
 +8                        SET DA=+$GET(NURIEN("DILIST",2,NURSEQ))
                           if DA'>0
                               QUIT 
 +9                        SET DIE="^XPD(9.7,"
                           SET DR="1////"_NURDA
                           DO ^DIE
 +10                       QUIT 
                       End DoDot:2
 +11               QUIT 
               End DoDot:1
 +12       QUIT