ORVCOEND ;SPFO/AJB - VISTA CUTOVER ;Feb 17, 2021@13:27:53
;;3.0;ORDER ENTRY/RESULTS REPORTING;**529**;DEC 17, 1997;Build 17
Q
; see ORVCO for list of ICRs/DBIAs
THEGARDEN ; 'In this one of many possible worlds...'
N %,D0,D1,D2,DG,DIC,DICR,DILOCKTM,DISYS,DIW ; left over by ^xmd call
N XMDUN,XMDUZ,XMZ
; post master, message text location & subject
S XMDUZ=.5,XMTEXT="XMTEXT(",XMSUB="EHRM Cutover Task Status" ; subject
S XMY(+USR)="",XMY("andrew.bakke@domain.ext")="" ; recipients
; prepare the mail message
N DATA,I F I=1:1 S DATA=$P($T(MTXT+I),";;",2) Q:DATA="EOM" D
. N REPLACE,STR S REPLACE("[THREADS]")=@INF@("Threads"),REPLACE("[PFAC]")=$E(@INF@("PFAC"),1,49)
. S REPLACE("[USER]")=$P(@INF@("User"),U,3),REPLACE("[TITLE]")=$P(@INF@("Title"),U,2)
. S REPLACE("[START]")=@INF@("Start Time"),REPLACE("[STOP]")=@INF@("Stop Time"),REPLACE("[ELAPSED]")=$$CNVRT^ORVCO(@INF@("Elapsed"))
. S REPLACE("[FM]")=@INF@("FM Total"),REPLACE("[ACTUAL]")=@INF@("Actual")
. S STR="",$P(STR," ",$L(@INF@("Actual"))-$L(@INF@("Errors")))=" ",REPLACE("[ERRORS]")=STR_@INF@("Errors")
. S STR="",$P(STR," ",$L(@INF@("Actual"))-$L(@INF@("No Visits")))=" ",REPLACE("[NO VISITS]")=STR_@INF@("No Visits")
. S STR="",$P(STR," ",$L(@INF@("Actual"))-$L($G(@INF@("No Primary Care"))))=" ",REPLACE("[NO PRIMARY CARE]")=STR_$G(@INF@("No Primary Care"))
. S STR="",$P(STR," ",$L(@INF@("Actual"))-$L(@INF@("Test Patients")))=" ",REPLACE("[TEST PATIENTS]")=STR_@INF@("Test Patients")
. S STR="",$P(STR," ",$L(@INF@("Actual"))-$L(@INF@("Patients")))=" ",REPLACE("[PATIENTS]")=STR_@INF@("Patients")
. S STR="",$P(STR," ",$L(@INF@("Actual"))-$L(@INF@("Processed")))=" ",REPLACE("[PROCESSED]")=STR_@INF@("Processed")
. S STR="",$P(STR," ",$L(@INF@("Actual"))-$L($G(@INF@("Documents"))))=" ",REPLACE("[DOCUMENTS]")=STR_$G(@INF@("Documents"))
. I DATA["[DOCUMENTS]",'+CRD Q
. I DATA["[NO PRIMARY CARE]",'+RMD Q
. I DATA["[SUBTOTAL]" N X S $P(X,"-",$L(@INF@("FM Total")))="-" S REPLACE("[SUBTOTAL]")=X
. D ADD(.XMTEXT,.CNT,$$REPLACE^XLFSTR(DATA,.REPLACE)) ; add the line of data
; stopped or test mode
I +$G(ZTSTOP) D ADD(.XMTEXT,.CNT,""),ADD(.XMTEXT,.CNT,$$CJ^XLFSTR("[ Stopped by Task Manager ]",79))
I '+CRD D ADD(.XMTEXT,.CNT,""),ADD(.XMTEXT,.CNT,$$CJ^XLFSTR("[ Test Mode ]",79))
; timing data
D ADD(.XMTEXT,.CNT,"")
D ADD(.XMTEXT,.CNT,"Average Average")
D ADD(.XMTEXT,.CNT,"CPU Time per Patient [ms] Time per Thread [secs]")
S DATA="",$P(DATA,"=",80)="" D ADD(.XMTEXT,.CNT,DATA)
S DATA="" F S DATA=$O(@INF@(" Duration",DATA)) Q:DATA="" D
. N REPLACE,STR,VALUE S (REPLACE(" [CPU]"),REPLACE(" [SECS]"),REPLACE(" z"))=""
. S STR=$$SETSTR^VALM1($$REPLACE^XLFSTR(DATA,.REPLACE),"",1,$L($$REPLACE^XLFSTR(DATA,.REPLACE)))
. S VALUE=$FN(@INF@(" Duration",DATA)/@INF@("Actual"),"",2)
. S STR=$$SETSTR^VALM1(VALUE,STR,38-$L(VALUE),$L(VALUE))
. ; second column
. S DATA=$O(@INF@(" Duration",DATA)) I DATA="" D ADD(.XMTEXT,.CNT,STR) Q
. S STR=$$SETSTR^VALM1($$REPLACE^XLFSTR(DATA,.REPLACE),STR,40,$L($$REPLACE^XLFSTR(DATA,.REPLACE)))
. S VALUE=$FN(@INF@(" Duration",DATA)/@INF@("Threads"),"",0)
. S STR=$$SETSTR^VALM1(VALUE,STR,80-$L(VALUE),$L(VALUE))
. D ADD(.XMTEXT,.CNT,STR)
D ADD(.XMTEXT,.CNT,"")
I +@INF@("Errors") D
. D ADD(.XMTEXT,.CNT,"Error Data")
. D ADD(.XMTEXT,.CNT,"DFN Patient Error")
. S DATA="",$P(DATA,"=",80)="" D ADD(.XMTEXT,.CNT,DATA)
. S DATA=0 F S DATA=$O(@INF@("Errors",DATA)) Q:'+DATA D
. . N DFN,ERR,PTN,STR S DFN=$O(@INF@("Errors",DATA,"")),PTN=$O(@INF@("Errors",DATA,DFN,"")),ERR=@INF@("Errors",DATA,DFN,PTN)
. . S DFN=$S($L(DFN)'<13:$E(DFN,1,12)_"*",1:DFN),PTN=$S($L(PTN)'<28:$E(PTN,1,28)_"*",1:PTN),ERR=$E(ERR,1,35)
. . S STR=$$SETSTR^VALM1(DFN,"",1,$L(DFN))
. . S STR=$$SETSTR^VALM1(PTN,STR,15,$L(PTN))
. . S STR=$$SETSTR^VALM1(ERR,STR,45,$L(ERR))
. . D ADD(.XMTEXT,.CNT,STR)
. D ADD(.XMTEXT,.CNT,""),ADD(.XMTEXT,.CNT,$$CJ^XLFSTR("Please contact support for assistance in resolving the error"_$S(@INF@("Errors")>1:"s.",1:"."),80))
;
S CNT=0 F S CNT=$O(XMTEXT(CNT)) Q:'+CNT W !,XMTEXT(CNT)
; 'Signal transmitted, message received...'
D ^XMD
K @GBL,@INF ;clean up xtmp globals
I +$O(^XTMP("ORVCO",0)) Q ; quit if another job is still running
K ^XTMP("ORVCO",0) ; clean up the zero node
Q
ADD(LOC,CNT,DATA) ;
S CNT=+$G(CNT)+1,LOC(CNT)=DATA
Q
MTXT ; BODY OF MAIL MESSAGE
;;# of Threads: [THREADS]
;;
;;VistA Cutover Information for [PFAC]
;;Process initiated by: [USER]
;; Document Title: [TITLE]
;;
;; Start Time: [START]
;; Stop Time: [STOP]
;; Elapsed Time: [ELAPSED]
;;
;; # of Patients w/o Visits : [NO VISITS]
;; # of Patients w/o Primary Care : [NO PRIMARY CARE]
;; # of Test Patients : [TEST PATIENTS]
;; # of Patients w/ Visits : + [PATIENTS]
;; [SUBTOTAL]
;; # of Patients Evaluated : [ACTUAL]
;;
;; # of Patients Processed : [PROCESSED]
;; # of Documents Created : [DOCUMENTS]
;;
;; # of Errors Encountered : [ERRORS]
;;EOM
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORVCOEND 5254 printed Dec 13, 2024@02:34:49 Page 2
ORVCOEND ;SPFO/AJB - VISTA CUTOVER ;Feb 17, 2021@13:27:53
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**529**;DEC 17, 1997;Build 17
+2 QUIT
+3 ; see ORVCO for list of ICRs/DBIAs
THEGARDEN ; 'In this one of many possible worlds...'
+1 ; left over by ^xmd call
NEW %,D0,D1,D2,DG,DIC,DICR,DILOCKTM,DISYS,DIW
+2 NEW XMDUN,XMDUZ,XMZ
+3 ; post master, message text location & subject
+4 ; subject
SET XMDUZ=.5
SET XMTEXT="XMTEXT("
SET XMSUB="EHRM Cutover Task Status"
+5 ; recipients
SET XMY(+USR)=""
SET XMY("andrew.bakke@domain.ext")=""
+6 ; prepare the mail message
+7 NEW DATA,I
FOR I=1:1
SET DATA=$PIECE($TEXT(MTXT+I),";;",2)
if DATA="EOM"
QUIT
Begin DoDot:1
+8 NEW REPLACE,STR
SET REPLACE("[THREADS]")=@INF@("Threads")
SET REPLACE("[PFAC]")=$EXTRACT(@INF@("PFAC"),1,49)
+9 SET REPLACE("[USER]")=$PIECE(@INF@("User"),U,3)
SET REPLACE("[TITLE]")=$PIECE(@INF@("Title"),U,2)
+10 SET REPLACE("[START]")=@INF@("Start Time")
SET REPLACE("[STOP]")=@INF@("Stop Time")
SET REPLACE("[ELAPSED]")=$$CNVRT^ORVCO(@INF@("Elapsed"))
+11 SET REPLACE("[FM]")=@INF@("FM Total")
SET REPLACE("[ACTUAL]")=@INF@("Actual")
+12 SET STR=""
SET $PIECE(STR," ",$LENGTH(@INF@("Actual"))-$LENGTH(@INF@("Errors")))=" "
SET REPLACE("[ERRORS]")=STR_@INF@("Errors")
+13 SET STR=""
SET $PIECE(STR," ",$LENGTH(@INF@("Actual"))-$LENGTH(@INF@("No Visits")))=" "
SET REPLACE("[NO VISITS]")=STR_@INF@("No Visits")
+14 SET STR=""
SET $PIECE(STR," ",$LENGTH(@INF@("Actual"))-$LENGTH($GET(@INF@("No Primary Care"))))=" "
SET REPLACE("[NO PRIMARY CARE]")=STR_$GET(@INF@("No Primary Care"))
+15 SET STR=""
SET $PIECE(STR," ",$LENGTH(@INF@("Actual"))-$LENGTH(@INF@("Test Patients")))=" "
SET REPLACE("[TEST PATIENTS]")=STR_@INF@("Test Patients")
+16 SET STR=""
SET $PIECE(STR," ",$LENGTH(@INF@("Actual"))-$LENGTH(@INF@("Patients")))=" "
SET REPLACE("[PATIENTS]")=STR_@INF@("Patients")
+17 SET STR=""
SET $PIECE(STR," ",$LENGTH(@INF@("Actual"))-$LENGTH(@INF@("Processed")))=" "
SET REPLACE("[PROCESSED]")=STR_@INF@("Processed")
+18 SET STR=""
SET $PIECE(STR," ",$LENGTH(@INF@("Actual"))-$LENGTH($GET(@INF@("Documents"))))=" "
SET REPLACE("[DOCUMENTS]")=STR_$GET(@INF@("Documents"))
+19 IF DATA["[DOCUMENTS]"
IF '+CRD
QUIT
+20 IF DATA["[NO PRIMARY CARE]"
IF '+RMD
QUIT
+21 IF DATA["[SUBTOTAL]"
NEW X
SET $PIECE(X,"-",$LENGTH(@INF@("FM Total")))="-"
SET REPLACE("[SUBTOTAL]")=X
+22 ; add the line of data
DO ADD(.XMTEXT,.CNT,$$REPLACE^XLFSTR(DATA,.REPLACE))
End DoDot:1
+23 ; stopped or test mode
+24 IF +$GET(ZTSTOP)
DO ADD(.XMTEXT,.CNT,"")
DO ADD(.XMTEXT,.CNT,$$CJ^XLFSTR("[ Stopped by Task Manager ]",79))
+25 IF '+CRD
DO ADD(.XMTEXT,.CNT,"")
DO ADD(.XMTEXT,.CNT,$$CJ^XLFSTR("[ Test Mode ]",79))
+26 ; timing data
+27 DO ADD(.XMTEXT,.CNT,"")
+28 DO ADD(.XMTEXT,.CNT,"Average Average")
+29 DO ADD(.XMTEXT,.CNT,"CPU Time per Patient [ms] Time per Thread [secs]")
+30 SET DATA=""
SET $PIECE(DATA,"=",80)=""
DO ADD(.XMTEXT,.CNT,DATA)
+31 SET DATA=""
FOR
SET DATA=$ORDER(@INF@(" Duration",DATA))
if DATA=""
QUIT
Begin DoDot:1
+32 NEW REPLACE,STR,VALUE
SET (REPLACE(" [CPU]"),REPLACE(" [SECS]"),REPLACE(" z"))=""
+33 SET STR=$$SETSTR^VALM1($$REPLACE^XLFSTR(DATA,.REPLACE),"",1,$LENGTH($$REPLACE^XLFSTR(DATA,.REPLACE)))
+34 SET VALUE=$FNUMBER(@INF@(" Duration",DATA)/@INF@("Actual"),"",2)
+35 SET STR=$$SETSTR^VALM1(VALUE,STR,38-$LENGTH(VALUE),$LENGTH(VALUE))
+36 ; second column
+37 SET DATA=$ORDER(@INF@(" Duration",DATA))
IF DATA=""
DO ADD(.XMTEXT,.CNT,STR)
QUIT
+38 SET STR=$$SETSTR^VALM1($$REPLACE^XLFSTR(DATA,.REPLACE),STR,40,$LENGTH($$REPLACE^XLFSTR(DATA,.REPLACE)))
+39 SET VALUE=$FNUMBER(@INF@(" Duration",DATA)/@INF@("Threads"),"",0)
+40 SET STR=$$SETSTR^VALM1(VALUE,STR,80-$LENGTH(VALUE),$LENGTH(VALUE))
+41 DO ADD(.XMTEXT,.CNT,STR)
End DoDot:1
+42 DO ADD(.XMTEXT,.CNT,"")
+43 IF +@INF@("Errors")
Begin DoDot:1
+44 DO ADD(.XMTEXT,.CNT,"Error Data")
+45 DO ADD(.XMTEXT,.CNT,"DFN Patient Error")
+46 SET DATA=""
SET $PIECE(DATA,"=",80)=""
DO ADD(.XMTEXT,.CNT,DATA)
+47 SET DATA=0
FOR
SET DATA=$ORDER(@INF@("Errors",DATA))
if '+DATA
QUIT
Begin DoDot:2
+48 NEW DFN,ERR,PTN,STR
SET DFN=$ORDER(@INF@("Errors",DATA,""))
SET PTN=$ORDER(@INF@("Errors",DATA,DFN,""))
SET ERR=@INF@("Errors",DATA,DFN,PTN)
+49 SET DFN=$SELECT($LENGTH(DFN)'<13:$EXTRACT(DFN,1,12)_"*",1:DFN)
SET PTN=$SELECT($LENGTH(PTN)'<28:$EXTRACT(PTN,1,28)_"*",1:PTN)
SET ERR=$EXTRACT(ERR,1,35)
+50 SET STR=$$SETSTR^VALM1(DFN,"",1,$LENGTH(DFN))
+51 SET STR=$$SETSTR^VALM1(PTN,STR,15,$LENGTH(PTN))
+52 SET STR=$$SETSTR^VALM1(ERR,STR,45,$LENGTH(ERR))
+53 DO ADD(.XMTEXT,.CNT,STR)
End DoDot:2
+54 DO ADD(.XMTEXT,.CNT,"")
DO ADD(.XMTEXT,.CNT,$$CJ^XLFSTR("Please contact support for assistance in resolving the error"_$SELECT(@INF@("Errors")>1:"s.",1:"."),80))
End DoDot:1
+55 ;
+56 SET CNT=0
FOR
SET CNT=$ORDER(XMTEXT(CNT))
if '+CNT
QUIT
WRITE !,XMTEXT(CNT)
+57 ; 'Signal transmitted, message received...'
+58 DO ^XMD
+59 ;clean up xtmp globals
KILL @GBL,@INF
+60 ; quit if another job is still running
IF +$ORDER(^XTMP("ORVCO",0))
QUIT
+61 ; clean up the zero node
KILL ^XTMP("ORVCO",0)
+62 QUIT
ADD(LOC,CNT,DATA) ;
+1 SET CNT=+$GET(CNT)+1
SET LOC(CNT)=DATA
+2 QUIT
MTXT ; BODY OF MAIL MESSAGE
+1 ;;# of Threads: [THREADS]
+2 ;;
+3 ;;VistA Cutover Information for [PFAC]
+4 ;;Process initiated by: [USER]
+5 ;; Document Title: [TITLE]
+6 ;;
+7 ;; Start Time: [START]
+8 ;; Stop Time: [STOP]
+9 ;; Elapsed Time: [ELAPSED]
+10 ;;
+11 ;; # of Patients w/o Visits : [NO VISITS]
+12 ;; # of Patients w/o Primary Care : [NO PRIMARY CARE]
+13 ;; # of Test Patients : [TEST PATIENTS]
+14 ;; # of Patients w/ Visits : + [PATIENTS]
+15 ;; [SUBTOTAL]
+16 ;; # of Patients Evaluated : [ACTUAL]
+17 ;;
+18 ;; # of Patients Processed : [PROCESSED]
+19 ;; # of Documents Created : [DOCUMENTS]
+20 ;;
+21 ;; # of Errors Encountered : [ERRORS]
+22 ;;EOM