PSOEN145 ;BIR/RTR-Patch 145 Environment check routine ;08/15/03
 ;;7.0;OUTPATIENT PHARMACY;**145,268**;DEC 1997;Build 9
 Q:'XPDENV
 N X1,X2,Y
 L +^XTMP("SDPSO145"):$S(+$G(^DD("DILOCKTM"))>0:+^DD("DILOCKTM"),1:3) I '$T W !!,"Cannot load this build, someone else is either installing it now,",!,"or the Post-Init for this build is currently running from another install.",! S XPDABORT=2 Q
 I $G(^XTMP("SDPSO145","PSOTINIT")) W !!,"Cannot load this build, the Post-Init has already been",!,"queued by another process.",! S XPDABORT=2 L -^XTMP("SDPSO145") Q
 W !,"This build contains a post-install that will populate the TPB ELIGIBILITY",!,"(#52.91) File, and the TPB INSTITUTION LETTERS (#52.92) File.",!
 K %DT D NOW^%DTC S %DT="RAEX",%DT(0)=%,%DT("A")="Queue the Post-Install to run at what Date@Time: "
 D ^%DT K %DT I $D(DTOUT)!(Y<0) W !!,"Cannot install patch without queuing the post-install, install aborted!",! S XPDABORT=2 L -^XTMP("SDPSO145") Q
 S ^XTMP("SDPSO145","PSOTINIT")=Y
 S X1=DT,X2=+60 D C^%DTC S ^XTMP("SDPSO145",0)=$G(X)_"^"_DT
 L -^XTMP("SDPSO145")
 Q
TEST ;
 Q:'$G(XPDENV)
 W !,"This build contains a post-install that will populate the TPB ELIGIBILITY",!,"(#52.91) File, and the TPB INSTITUTION LETTERS (#52.92) File.",!
 K %DT D NOW^%DTC S %DT="RAEX",%DT(0)=%,%DT("A")="Queue the Post-Install to run at what Date@Time: "
 D ^%DT K %DT I $D(DTOUT)!(Y<0) W !!,"Cannot install patch without queuing the post-install, install aborted!",! S XPDABORT=2 Q
 S @XPDGREF@("PSOPINIT")=Y
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOEN145   1522     printed  Sep 23, 2025@20:03:47                                                                                                                                                                                                    Page 2
PSOEN145  ;BIR/RTR-Patch 145 Environment check routine ;08/15/03
 +1       ;;7.0;OUTPATIENT PHARMACY;**145,268**;DEC 1997;Build 9
 +2        if 'XPDENV
               QUIT 
 +3        NEW X1,X2,Y
 +4        LOCK +^XTMP("SDPSO145"):$SELECT(+$GET(^DD("DILOCKTM"))>0:+^DD("DILOCKTM"),1:3)
           IF '$TEST
               WRITE !!,"Cannot load this build, someone else is either installing it now,",!,"or the Post-Init for this build is currently running from another install.",!
               SET XPDABORT=2
               QUIT 
 +5        IF $GET(^XTMP("SDPSO145","PSOTINIT"))
               WRITE !!,"Cannot load this build, the Post-Init has already been",!,"queued by another process.",!
               SET XPDABORT=2
               LOCK -^XTMP("SDPSO145")
               QUIT 
 +6        WRITE !,"This build contains a post-install that will populate the TPB ELIGIBILITY",!,"(#52.91) File, and the TPB INSTITUTION LETTERS (#52.92) File.",!
 +7        KILL %DT
           DO NOW^%DTC
           SET %DT="RAEX"
           SET %DT(0)=%
           SET %DT("A")="Queue the Post-Install to run at what Date@Time: "
 +8        DO ^%DT
           KILL %DT
           IF $DATA(DTOUT)!(Y<0)
               WRITE !!,"Cannot install patch without queuing the post-install, install aborted!",!
               SET XPDABORT=2
               LOCK -^XTMP("SDPSO145")
               QUIT 
 +9        SET ^XTMP("SDPSO145","PSOTINIT")=Y
 +10       SET X1=DT
           SET X2=+60
           DO C^%DTC
           SET ^XTMP("SDPSO145",0)=$GET(X)_"^"_DT
 +11       LOCK -^XTMP("SDPSO145")
 +12       QUIT 
TEST      ;
 +1        if '$GET(XPDENV)
               QUIT 
 +2        WRITE !,"This build contains a post-install that will populate the TPB ELIGIBILITY",!,"(#52.91) File, and the TPB INSTITUTION LETTERS (#52.92) File.",!
 +3        KILL %DT
           DO NOW^%DTC
           SET %DT="RAEX"
           SET %DT(0)=%
           SET %DT("A")="Queue the Post-Install to run at what Date@Time: "
 +4        DO ^%DT
           KILL %DT
           IF $DATA(DTOUT)!(Y<0)
               WRITE !!,"Cannot install patch without queuing the post-install, install aborted!",!
               SET XPDABORT=2
               QUIT 
 +5        SET @XPDGREF@("PSOPINIT")=Y
 +6        QUIT