GMRVP59 ;BAY/KAM-Patch GMRV*5*9 Install Utility Routine ; 8/5/05 7:14am
 ;;5.0;GEN. MED. REC. - VITALS;**9**;Apr 15, 2003
 ;
ENV ;Main Entry point for Environment Check
 S XPDABORT=""
 D PROGCHK(.XPDABORT) ;checks programmer variables
 I XPDABORT="" K XPDABORT
 Q
PROGCHK(XPDABORT) ; checks for necessary programmer variables
 ;
 I '$G(DUZ)!($G(DUZ(0))'="@")!('$G(DT))!($G(U)'="^")  D
 . D BMES^XPDUTL("****")
 . D MES^XPDUTL("Your programming variables are not set up properly.")
 . D MES^XPDUTL("Installation aborted.")
 . D MES^XPDUTL("*****")
 . S XPDABORT=2
 Q
PRE ;Add 1 second to all entries in File 120.5 that do not contain a time
 ;entry in piece one
 N GMRIEN,DATETIME,X1,X2
 K ^XTMP("GMRVP59",$J)
 I '$G(DT) S DT=$$DT^XLFDT
 I '$D(^XTMP("GMRVP59")) S X1=DT,X2=+90 D C^%DTC S ^XTMP("GMRVP59",0)=$G(X)_"^"_DT
 S GMRIEN=""
 F  S GMRIEN=$O(^GMR(120.5,GMRIEN)) Q:GMRIEN=""!(GMRIEN'?1.N)  D
 . S DATETIME=$P($G(^GMR(120.5,GMRIEN,0)),"^")
 . I +$P(DATETIME,".",2)'>0 D
 .. S $P(^XTMP("GMRVP59",$J,120.5,GMRIEN),"^")=$G(DATETIME) ; Before
 .. N GMRFDA
 .. S DATETIME=$$FMADD^XLFDT(DATETIME,"","","",1)
 .. S $P(^XTMP("GMRVP59",$J,120.5,GMRIEN),"^",2)=$G(DATETIME) ; After
 .. S GMRFDA(120.5,GMRIEN_",",.01)=DATETIME
 .. D UPDATE^DIE("","GMRFDA")
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRVP59   1287     printed  Sep 23, 2025@19:33:25                                                                                                                                                                                                     Page 2
GMRVP59   ;BAY/KAM-Patch GMRV*5*9 Install Utility Routine ; 8/5/05 7:14am
 +1       ;;5.0;GEN. MED. REC. - VITALS;**9**;Apr 15, 2003
 +2       ;
ENV       ;Main Entry point for Environment Check
 +1        SET XPDABORT=""
 +2       ;checks programmer variables
           DO PROGCHK(.XPDABORT)
 +3        IF XPDABORT=""
               KILL XPDABORT
 +4        QUIT 
PROGCHK(XPDABORT) ; checks for necessary programmer variables
 +1       ;
 +2        IF '$GET(DUZ)!($GET(DUZ(0))'="@")!('$GET(DT))!($GET(U)'="^")
               Begin DoDot:1
 +3                DO BMES^XPDUTL("****")
 +4                DO MES^XPDUTL("Your programming variables are not set up properly.")
 +5                DO MES^XPDUTL("Installation aborted.")
 +6                DO MES^XPDUTL("*****")
 +7                SET XPDABORT=2
               End DoDot:1
 +8        QUIT 
PRE       ;Add 1 second to all entries in File 120.5 that do not contain a time
 +1       ;entry in piece one
 +2        NEW GMRIEN,DATETIME,X1,X2
 +3        KILL ^XTMP("GMRVP59",$JOB)
 +4        IF '$GET(DT)
               SET DT=$$DT^XLFDT
 +5        IF '$DATA(^XTMP("GMRVP59"))
               SET X1=DT
               SET X2=+90
               DO C^%DTC
               SET ^XTMP("GMRVP59",0)=$GET(X)_"^"_DT
 +6        SET GMRIEN=""
 +7        FOR 
               SET GMRIEN=$ORDER(^GMR(120.5,GMRIEN))
               if GMRIEN=""!(GMRIEN'?1.N)
                   QUIT 
               Begin DoDot:1
 +8                SET DATETIME=$PIECE($GET(^GMR(120.5,GMRIEN,0)),"^")
 +9                IF +$PIECE(DATETIME,".",2)'>0
                       Begin DoDot:2
 +10      ; Before
                           SET $PIECE(^XTMP("GMRVP59",$JOB,120.5,GMRIEN),"^")=$GET(DATETIME)
 +11                       NEW GMRFDA
 +12                       SET DATETIME=$$FMADD^XLFDT(DATETIME,"","","",1)
 +13      ; After
                           SET $PIECE(^XTMP("GMRVP59",$JOB,120.5,GMRIEN),"^",2)=$GET(DATETIME)
 +14                       SET GMRFDA(120.5,GMRIEN_",",.01)=DATETIME
 +15                       DO UPDATE^DIE("","GMRFDA")
                       End DoDot:2
               End DoDot:1
 +16       QUIT