DG53800P ;BHM/CKN - POST INSTALL ROUTINE TO UPDATE IPP FIELD IN TREATING FACILITY FILE 391.91 ; 3/17/09 12:17pm
;;5.3;PIMS;**1016**;JUN 30, 2012;Build 20
Q
EP ;MPIC_1490 - Post install routine entry point
N RESTART
S RESTART=0
I '$$CHECK() Q
D QUE
Q
QUE ;Queue the process
N ZTRTN,ZTDESC,ZTSK
S ZTRTN="PROCESS^DG53800P",ZTDESC="DG53800P - UPDATE IPP FIELD IN TREATING FACILITY FILE"
S ZTIO="",ZTDTH=$H
D ^%ZTLOAD
I $D(ZTSK) S ^XTMP("DG53800P","@@","TASK")=ZTSK W !,"Task: "_$G(ZTSK)
S:$D(ZTQUEUED) ZTREQ="@"
Q
CHECK() ;Initial check
D BMES^XPDUTL("Post install process to update IPP field in TREATING FACILITY FILE #391.91")
N INITSTRT
I '$D(^XTMP("DG53800P","@@","PROCESS INIT STARTED")) S (^XTMP("DG53800P","@@","PROCESS INIT STARTED"),^XTMP("DG53800P","@@","PROCESS STARTED"))=$$NOW^XLFDT() D BMES^XPDUTL("<<Process Started>>") Q 1
I $D(^XTMP("DG53800P","@@","PROCESS COMPLETED")) D BMES^XPDUTL("<<Process is already completed>>")
I $D(^XTMP("DG53800P","@@","PROCESS STOPPED")) D BMES^XPDUTL("<<Process stopped in previous run>>")
I 'RESTART Q 0
W ! S DIR(0)="Y",DIR("B")="Yes",DIR("A")="Do you want to complete the rerun" D ^DIR K DIR
I '+Y Q 0
S INITSTRT=$G(^XTMP("DG53800P","@@","PROCESS INIT STARTED"))
K ^XTMP("DG53800P","@@")
S ^XTMP("DG53800P","@@","PROCESS INIT STARTED")=$G(INITSTRT)
S ^XTMP("DG53800P","@@","PROCESS STARTED")=$$NOW^XLFDT()
D BMES^XPDUTL("<<Process Started>>") Q 1
PROCESS ;
N TFIEN,QFLG,INSTIEN,VAL,X,X1,X2
S QFLG=0,VAL=1
S X1=DT,X2=60 D C^%DTC
S ^XTMP("DG53800P",0)=X_"^"_$$DT^XLFDT_"^DG53800P - POST INSTALL - IPP FIELD UPDATE IN TREATING FACILITY FILE"
S INSTIEN=$O(^DIC(4,"D","200MH","")) ;Institution file ien for 200MH
S TFIEN=+$G(^XTMP("DG53800P","@@","CURRENT IEN"))
F S TFIEN=$O(^DGCN(391.91,"C",INSTIEN,TFIEN)) Q:+TFIEN=0!(QFLG) D
. I $D(^XTMP("DG53800P","@@","FORCE STOP")) S QFLG=1 Q
. S ^XTMP("DG53800P","@@","CURRENT IEN")=TFIEN
. S DIE="^DGCN(391.91,",DA=TFIEN,DR=".08///^S X=VAL"
. D ^DIE K DIE,DA,DR
I QFLG S ^XTMP("DG53800P","@@","PROCESS STOPPED")=$$NOW^XLFDT() Q
S ^XTMP("DG53800P","@@","PROCESS COMPLETED")=$$NOW^XLFDT()
D MAIL
Q
MAIL ;Send Mail message
N PATCH,SITE,STATN,SITENM,MSG,XMDUZ,XMSUB,XMTEXT,XMY
S PATCH="DG*5.3*800"
S SITE=$$SITE^VASITE,STATN=$P($G(SITE),"^",3),SITENM=$P($G(SITE),"^",2)
S (XMY(DUZ),XMY(.5))="",XMY("CHINTAN.NAIK@VA.GOV")="",XMY("PAULETTE.DAVIS@VA.GOV")=""
S XMDUZ="MPI PATCH MONITOR",XMTEXT="MSG("
S XMSUB="DG*5.3*800 - POST INIT - IPP FIELD UPDATE COMPLETE FOR SITE: "_STATN
S MSG(1)="The DG*5.3*800 post-init process to update the IN-PERSON PROOFED (#.08) field in the TREATING FACILITY LIST (#391.91) file completed successfully."
S MSG(1.5)=""
S MSG(2)="Patch: "_PATCH
S MSG(3)="Task: "_$G(^XTMP("DG53800P","@@","TASK"))
S MSG(4)=""
S MSG(5)="Site Station #: "_STATN
S MSG(6)="Site Name: "_SITENM
S MSG(7)=""
S MSG(8)="Process Started at: "_$$FMTE^XLFDT($G(^XTMP("DG53800P","@@","PROCESS INIT STARTED")),"5P")
S MSG(8.5)=""
S MSG(9)="Process Completed at: "_$$FMTE^XLFDT($G(^XTMP("DG53800P","@@","PROCESS COMPLETED")),"5P")
D ^XMD
Q
STRTAGN ;Re run of process in case of process is stopped
N RESTART
S RESTART=1
I '$$CHECK() Q
D QUE
Q
STOP ;Stop the process
W !!,"Stop process"
I '$D(^XTMP("DG53800P","@@","PROCESS STARTED")) W !,"<< No process is currently running >>" Q
I $D(^XTMP("DG53800P","@@","PROCESS COMPLETED")) W !,"<< Process already completed >>" Q
W !!,"Process is currently running."
W ! S DIR(0)="Y",DIR("B")="Yes",DIR("A")="Do you want to stop this process" D ^DIR K DIR
I +Y S ^XTMP("DG53800P","@@","FORCE STOP")=1
K DIR,Y
Q
DG53800P ;BHM/CKN - POST INSTALL ROUTINE TO UPDATE IPP FIELD IN TREATING FACILITY FILE 391.91 ; 3/17/09 12:17pm
+1 ;;5.3;PIMS;**1016**;JUN 30, 2012;Build 20
+2 QUIT
EP ;MPIC_1490 - Post install routine entry point
+1 NEW RESTART
+2 SET RESTART=0
+3 IF '$$CHECK()
QUIT
+4 DO QUE
+5 QUIT
QUE ;Queue the process
+1 NEW ZTRTN,ZTDESC,ZTSK
+2 SET ZTRTN="PROCESS^DG53800P"
SET ZTDESC="DG53800P - UPDATE IPP FIELD IN TREATING FACILITY FILE"
+3 SET ZTIO=""
SET ZTDTH=$HOROLOG
+4 DO ^%ZTLOAD
+5 IF $DATA(ZTSK)
SET ^XTMP("DG53800P","@@","TASK")=ZTSK
WRITE !,"Task: "_$GET(ZTSK)
+6 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+7 QUIT
CHECK() ;Initial check
+1 DO BMES^XPDUTL("Post install process to update IPP field in TREATING FACILITY FILE #391.91")
+2 NEW INITSTRT
+3 IF '$DATA(^XTMP("DG53800P","@@","PROCESS INIT STARTED"))
SET (^XTMP("DG53800P","@@","PROCESS INIT STARTED"),^XTMP("DG53800P","@@","PROCESS STARTED"))=$$NOW^XLFDT()
DO BMES^XPDUTL("<<Process Started>>")
QUIT 1
+4 IF $DATA(^XTMP("DG53800P","@@","PROCESS COMPLETED"))
DO BMES^XPDUTL("<<Process is already completed>>")
+5 IF $DATA(^XTMP("DG53800P","@@","PROCESS STOPPED"))
DO BMES^XPDUTL("<<Process stopped in previous run>>")
+6 IF 'RESTART
QUIT 0
+7 WRITE !
SET DIR(0)="Y"
SET DIR("B")="Yes"
SET DIR("A")="Do you want to complete the rerun"
DO ^DIR
KILL DIR
+8 IF '+Y
QUIT 0
+9 SET INITSTRT=$GET(^XTMP("DG53800P","@@","PROCESS INIT STARTED"))
+10 KILL ^XTMP("DG53800P","@@")
+11 SET ^XTMP("DG53800P","@@","PROCESS INIT STARTED")=$GET(INITSTRT)
+12 SET ^XTMP("DG53800P","@@","PROCESS STARTED")=$$NOW^XLFDT()
+13 DO BMES^XPDUTL("<<Process Started>>")
QUIT 1
PROCESS ;
+1 NEW TFIEN,QFLG,INSTIEN,VAL,X,X1,X2
+2 SET QFLG=0
SET VAL=1
+3 SET X1=DT
SET X2=60
DO C^%DTC
+4 SET ^XTMP("DG53800P",0)=X_"^"_$$DT^XLFDT_"^DG53800P - POST INSTALL - IPP FIELD UPDATE IN TREATING FACILITY FILE"
+5 ;Institution file ien for 200MH
SET INSTIEN=$ORDER(^DIC(4,"D","200MH",""))
+6 SET TFIEN=+$GET(^XTMP("DG53800P","@@","CURRENT IEN"))
+7 FOR
SET TFIEN=$ORDER(^DGCN(391.91,"C",INSTIEN,TFIEN))
IF +TFIEN=0!(QFLG)
QUIT
Begin DoDot:1
+8 IF $DATA(^XTMP("DG53800P","@@","FORCE STOP"))
SET QFLG=1
QUIT
+9 SET ^XTMP("DG53800P","@@","CURRENT IEN")=TFIEN
+10 SET DIE="^DGCN(391.91,"
SET DA=TFIEN
SET DR=".08///^S X=VAL"
+11 DO ^DIE
KILL DIE,DA,DR
End DoDot:1
+12 IF QFLG
SET ^XTMP("DG53800P","@@","PROCESS STOPPED")=$$NOW^XLFDT()
QUIT
+13 SET ^XTMP("DG53800P","@@","PROCESS COMPLETED")=$$NOW^XLFDT()
+14 DO MAIL
+15 QUIT
MAIL ;Send Mail message
+1 NEW PATCH,SITE,STATN,SITENM,MSG,XMDUZ,XMSUB,XMTEXT,XMY
+2 SET PATCH="DG*5.3*800"
+3 SET SITE=$$SITE^VASITE
SET STATN=$PIECE($GET(SITE),"^",3)
SET SITENM=$PIECE($GET(SITE),"^",2)
+4 SET (XMY(DUZ),XMY(.5))=""
SET XMY("CHINTAN.NAIK@VA.GOV")=""
SET XMY("PAULETTE.DAVIS@VA.GOV")=""
+5 SET XMDUZ="MPI PATCH MONITOR"
SET XMTEXT="MSG("
+6 SET XMSUB="DG*5.3*800 - POST INIT - IPP FIELD UPDATE COMPLETE FOR SITE: "_STATN
+7 SET MSG(1)="The DG*5.3*800 post-init process to update the IN-PERSON PROOFED (#.08) field in the TREATING FACILITY LIST (#391.91) file completed successfully."
+8 SET MSG(1.5)=""
+9 SET MSG(2)="Patch: "_PATCH
+10 SET MSG(3)="Task: "_$GET(^XTMP("DG53800P","@@","TASK"))
+11 SET MSG(4)=""
+12 SET MSG(5)="Site Station #: "_STATN
+13 SET MSG(6)="Site Name: "_SITENM
+14 SET MSG(7)=""
+15 SET MSG(8)="Process Started at: "_$$FMTE^XLFDT($GET(^XTMP("DG53800P","@@","PROCESS INIT STARTED")),"5P")
+16 SET MSG(8.5)=""
+17 SET MSG(9)="Process Completed at: "_$$FMTE^XLFDT($GET(^XTMP("DG53800P","@@","PROCESS COMPLETED")),"5P")
+18 DO ^XMD
+19 QUIT
STRTAGN ;Re run of process in case of process is stopped
+1 NEW RESTART
+2 SET RESTART=1
+3 IF '$$CHECK()
QUIT
+4 DO QUE
+5 QUIT
STOP ;Stop the process
+1 WRITE !!,"Stop process"
+2 IF '$DATA(^XTMP("DG53800P","@@","PROCESS STARTED"))
WRITE !,"<< No process is currently running >>"
QUIT
+3 IF $DATA(^XTMP("DG53800P","@@","PROCESS COMPLETED"))
WRITE !,"<< Process already completed >>"
QUIT
+4 WRITE !!,"Process is currently running."
+5 WRITE !
SET DIR(0)="Y"
SET DIR("B")="Yes"
SET DIR("A")="Do you want to stop this process"
DO ^DIR
KILL DIR
+6 IF +Y
SET ^XTMP("DG53800P","@@","FORCE STOP")=1
+7 KILL DIR,Y
+8 QUIT