HLEVREP3 ;O-OIFO/LJA - Event Monitor REPORTS ;02/04/2004 14:42
;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
;
REMREQO ; Remote Requestable printout - [HLEV REMOTE REQUESTABLE LIST]
N BY,DIC,DIOEND,FLDS,HLEVRRQ
W @IOF,$$CJ^XLFSTR("Remote Requestable Monitors Report",IOM)
W !,$$REPEAT^XLFSTR("=",IOM)
W !,"Some monitors may be activated by remote server request. This option sorts"
W !,"all monitors by whether they are ""remote requestable""."
W !
S L="",DIC=776.1,BY="[HLEV REPORT MONITOR]",DIOEND="D RRQSUMM^HLEVREP3"
S FLDS="[HLEV REMOTE REQUESTABLE]"
D EN1^DIP
Q
;
RRQSUMM ; Remote request summary...
QUIT:'$D(HLEVRRQ("[NO]")) ;->
W !,"Fields having [NO] in the remote requestable field are not answered YES or"
W !,"NO. But, since the default action is NO, these blank fields are actually"
W !,"an implied NO (no remote requesting allowed.)"
I '$D(ZTQUEUED) D TELL^HLEVMST0("","0^0^0")
Q
;
REMREQ() ; Called by [HLEV REMOTE REQUESTABLE] print template
; Return whether entry is remote requestable
; HLEVRRQ newed at top of print template run...
S HLEVRRQ=$S(X=1:"YES",X=0:"NO",1:"[NO]")
S HLEVRRQ(HLEVRRQ)=$G(HLEVRRQ(HLEVRRQ))+1
Q HLEVRRQ
;
MONLOAD(HLEVIENJ) ; Load data into ^TMP...
N DATA,EXPL,LEN,MIEN,NO,PAGE,REF,SUB,SUM,SUMX,SUMY,TITLE,VAR
;
KILL ^TMP($J,"HLMON",+HLEVIENJ)
;
; Zero node
S DATA=$G(^HLEV(776,+$G(HLEVIENJ),0)) QUIT:DATA']"" ;->
D SET("START","Start",$$SDT^HLEVX001($P(DATA,U)))
D SET("DONE","Finish",$$SDT^HLEVX001($P(DATA,U,2)))
D SET("MONM","Monitor",$P($G(^HLEV(776.1,+$P(DATA,U,3),0)),U))
D SET("STATR","Status",$$STAT776($P(DATA,U,4)))
D SET("STATA","Appl",$P(DATA,U,5))
D SET("TIME","T-Stamp",$$SDT^HLEVX001($P(DATA,U,6)))
D SET("MAIL","Mail",$P(DATA,U,7))
D SET("ZTSK","Task",$P(DATA,U,8))
D SET("MST","Master",$P(DATA,U,9))
;
; Run Diary and Message Text...
F SUB=50,51 D
. S TITLE=$S(SUB=50:"RUN",1:"MSG")
. S MIEN=0
. F S MIEN=$O(^HLEV(776,+HLEVIENJ,SUB,MIEN)) Q:MIEN'>0 D
. . S NO=$O(^TMP($J,"HLMON",+HLEVIENJ,TITLE,":"),-1)+1
. . S ^TMP($J,"HLMON",+HLEVIENJ,TITLE,+NO)=^HLEV(776,+HLEVIENJ,SUB,MIEN,0)
;
; Variables...
S MIEN=0,SUMX="",SUMY=""
F S MIEN=$O(^HLEV(776,+HLEVIENJ,52,MIEN)) Q:MIEN'>0 D
. S REF=$G(^HLEV(776,+HLEVIENJ,52,+MIEN,0)) QUIT:$P(REF,U)']"" ;->
. S VAR=$P(REF,U),EXPL=$P(REF,U,2),EXPL=$S(EXPL]"":EXPL,1:REF)
. S DATA=$G(^HLEV(776,+HLEVIENJ,52,+MIEN,52))
. S ^TMP($J,"HLMON",+HLEVIENJ,"VD",VAR,EXPL)=DATA
.
. S LEN=$L(DATA) ; Length of data
. S LEN(1)=$L(EXPL) ; Length column header
. S LEN(2)=$S(LEN>LEN(1):LEN,1:LEN(1))+2 ; Largest length-data or header
. S LEN(3)=LEN+LEN(1)+3 ; Length - data + header
.
. S ^TMP($J,"HLMON",+HLEVIENJ,"VX",LEN(2),VAR,EXPL)=""
. S ^TMP($J,"HLMON",+HLEVIENJ,"VY",+LEN(3),VAR,EXPL)=""
.
. S $P(SUMX,U)=$P(SUMX,U)+1 ; # variables...
. S $P(SUMX,U,2)=$P(SUMX,U,2)+LEN(2)+2 ; Total columns required...
. I $P(SUMX,U,3)<(LEN(2)+1) S $P(SUMX,U,3)=LEN(2) ; Largest column
.
. S $P(SUMY,U)=$P(SUMY,U)+1
. S $P(SUMY,U,2)=$P(SUMY,U,2)+1
. I $P(SUMY,U,3)<(LEN(3)+1) S $P(SUMY,U,3)=LEN(3)
;
; # Var header, Line and Var data "pages"...
S LEN=0,PAGE=0,SUM=0
F S LEN=$O(^TMP($J,"HLMON",+HLEVIENJ,"VX",LEN)) Q:LEN'>0 D
. S:PAGE=0 PAGE=1
. I (SUM+LEN)>80 D
. . S PAGE=PAGE+1,SUM=0
. S SUM=SUM+LEN
S:PAGE $P(SUMX,U,4)=PAGE
;
I SUMX]"" S ^TMP($J,"HLMON",+HLEVIENJ,"VX")=SUMX
I SUMY]"" S ^TMP($J,"HLMON",+HLEVIENJ,"VY")=SUMY
;
Q
;
;
SET(STORE,TAG,VAL) ; Store value to be displayed...
S ^TMP($J,"HLMON",HLEVIENJ,STORE)=$S(VAL]"":1,1:"")_U_TAG_U_VAL
Q
;
STAT776(STAT) ; Return status for use on report...
QUIT STAT_U_$S(STAT="E":"Error",STAT="F":"Finish",STAT="Q":"Que'd",STAT="R":"Running",1:"")
;
CTRLMON ; Re/ask for monitor to display...
N IEN776,IENDATE,IENONE,IOINHI,IOINORM,LASTONE,WORK,X
S X="IOINHI;IOINORM" D ENDR^%ZISS
S WORK=0
W !
S IEN776=$$ASKMON QUIT:IEN776'>0 ;->
S WORK=1
S IENDATE=$$ASKDATE(IEN776) QUIT:IENDATE'>0 ;->
CTRLMON1 ; Reask entry point...
S IENONE=$$ASKONE(IEN776,IENDATE) I IENONE'>0 D QUIT ;->
. W !!!!,IOINHI,"Returning to display of daily map views...",IOINORM
. W !!
D SHOW^HLEVREP2(+IENONE)
I $P(IENONE,U,2)>1 D G CTRLMON1 ;->
. D TELL^HLEVMST0("","0^0^999","Press RETURN to continue... ")
G CTRLMON ;->
;
ASKMON() ; Ask user for a monitor to show...
N DIC,X,Y
S DIC=776.1,DIC(0)="AEMQ",DIC("A")="Select monitor to view, or RETURN to continue: "
S DIC("S")="I $D(^TMP($J,""HLMAP"",""E"",+Y))"
D ^DIC
Q $S(+Y>0:+Y,1:"")
;
ASKDATE(IEN776) ;
; DATESEL -- req
N DATE,DIR,DIRUT,DTOUT,DUOUT,X,Y
S DIR(0)="DA",DIR("A")="Select monitor RUN DATE: "
S X=$$FMTE^XLFDT($O(^TMP($J,"HLMAP","E",+IEN776,DATESEL-.000001))) I X]"" S DIR("B")=X
ASKDATE1 ;
S DIR("?")="Enter one of the ""run dates"" for this monitor. (Enter ?? to see list of run dates.)"
S DIR("??")="^D ASKDHELP^HLEVREP1"
D ^DIR
QUIT:$D(DIRUT)!($D(DTOUT))!($D(DUOUT)) "" ;->
QUIT:$D(^TMP($J,"HLMAP","E",+IEN776,+Y)) +Y ;->
D ASKDHELP
G ASKDATE1 ;->
;
ASKDHELP ; Help for $$ASKDATE...
W !!,"You must enter one of the following dates. Data exists for... "
W !!
S DATE=0
F S DATE=$O(^TMP($J,"HLMAP","E",IEN776,DATE)) Q:DATE'>0 D
. S DATE(1)=$$FMTE^XLFDT(DATE)
. W:$X>70 !
. W $J(DATE(1),15)
W !
Q
;
ASKONE(IEN776,IENDATE) ;
; Defines and returns LASTONE...
N DATA,DATE,DIR,DIRUT,DTOUT,DUOUT,HOLD,IEN,LAST,NEXT,NO,STAT,X,Y
;
; Find entries and build DIR string...
S NO=0,IEN=0,DIR(0)="SO^"
F S IEN=$O(^TMP($J,"HLMAP","E",+IEN776,+IENDATE,IEN)) Q:'IEN D
. S DATA=$G(^HLEV(776,+IEN,0)) QUIT:DATA']"" ;->
. S NO=NO+1
. S DATE=$P(DATA,U),STAT=$$STAT776^HLEVREP3($P(DATA,U,4))
. S HOLD(NO)=IEN_U_DATE
. S DATE(DATE)=IEN_U_STAT
. S DIR(0)=DIR(0)_$S(DIR(0)'="SO^":";",1:"")_NO_":"_$TR($$FMTE^XLFDT(DATE),":",".")_" ["_$P(STAT,U,2)_"]"
QUIT:NO'>0 "" ;->
QUIT:NO=1 +HOLD(1)_U_1 ;->
;
W !!,"This monitor was run more than once on the date you selected. Please select"
W !,"specific run time now..."
S NEXT=$S($G(LASTONE)'>0:1,1:LASTONE+1),NEXT=$S($D(HOLD(NEXT)):NEXT,1:"")
S DIR("A")="Select RUN TIME"
I NEXT S DIR("B")=NEXT
D ^DIR
;
QUIT:'$D(HOLD(+$G(X))) "" ;-> User answered by entering number...
;
S LASTONE=+X ; Used for DIR("B") later...
;
Q +HOLD(+X)_U_NO
;
EOR ;HLEVREP3 - Event Monitor REPORTS ;5/16/03 14:42
HLEVREP3 ;O-OIFO/LJA - Event Monitor REPORTS ;02/04/2004 14:42
+1 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
+2 ;
REMREQO ; Remote Requestable printout - [HLEV REMOTE REQUESTABLE LIST]
+1 NEW BY,DIC,DIOEND,FLDS,HLEVRRQ
+2 WRITE @IOF,$$CJ^XLFSTR("Remote Requestable Monitors Report",IOM)
+3 WRITE !,$$REPEAT^XLFSTR("=",IOM)
+4 WRITE !,"Some monitors may be activated by remote server request. This option sorts"
+5 WRITE !,"all monitors by whether they are ""remote requestable""."
+6 WRITE !
+7 SET L=""
SET DIC=776.1
SET BY="[HLEV REPORT MONITOR]"
SET DIOEND="D RRQSUMM^HLEVREP3"
+8 SET FLDS="[HLEV REMOTE REQUESTABLE]"
+9 DO EN1^DIP
+10 QUIT
+11 ;
RRQSUMM ; Remote request summary...
+1 ;->
IF '$DATA(HLEVRRQ("[NO]"))
QUIT
+2 WRITE !,"Fields having [NO] in the remote requestable field are not answered YES or"
+3 WRITE !,"NO. But, since the default action is NO, these blank fields are actually"
+4 WRITE !,"an implied NO (no remote requesting allowed.)"
+5 IF '$DATA(ZTQUEUED)
DO TELL^HLEVMST0("","0^0^0")
+6 QUIT
+7 ;
REMREQ() ; Called by [HLEV REMOTE REQUESTABLE] print template
+1 ; Return whether entry is remote requestable
+2 ; HLEVRRQ newed at top of print template run...
+3 SET HLEVRRQ=$SELECT(X=1:"YES",X=0:"NO",1:"[NO]")
+4 SET HLEVRRQ(HLEVRRQ)=$GET(HLEVRRQ(HLEVRRQ))+1
+5 QUIT HLEVRRQ
+6 ;
MONLOAD(HLEVIENJ) ; Load data into ^TMP...
+1 NEW DATA,EXPL,LEN,MIEN,NO,PAGE,REF,SUB,SUM,SUMX,SUMY,TITLE,VAR
+2 ;
+3 KILL ^TMP($JOB,"HLMON",+HLEVIENJ)
+4 ;
+5 ; Zero node
+6 ;->
SET DATA=$GET(^HLEV(776,+$GET(HLEVIENJ),0))
IF DATA']""
QUIT
+7 DO SET("START","Start",$$SDT^HLEVX001($PIECE(DATA,U)))
+8 DO SET("DONE","Finish",$$SDT^HLEVX001($PIECE(DATA,U,2)))
+9 DO SET("MONM","Monitor",$PIECE($GET(^HLEV(776.1,+$PIECE(DATA,U,3),0)),U))
+10 DO SET("STATR","Status",$$STAT776($PIECE(DATA,U,4)))
+11 DO SET("STATA","Appl",$PIECE(DATA,U,5))
+12 DO SET("TIME","T-Stamp",$$SDT^HLEVX001($PIECE(DATA,U,6)))
+13 DO SET("MAIL","Mail",$PIECE(DATA,U,7))
+14 DO SET("ZTSK","Task",$PIECE(DATA,U,8))
+15 DO SET("MST","Master",$PIECE(DATA,U,9))
+16 ;
+17 ; Run Diary and Message Text...
+18 FOR SUB=50,51
Begin DoDot:1
+19 SET TITLE=$SELECT(SUB=50:"RUN",1:"MSG")
+20 SET MIEN=0
+21 FOR
SET MIEN=$ORDER(^HLEV(776,+HLEVIENJ,SUB,MIEN))
IF MIEN'>0
QUIT
Begin DoDot:2
+22 SET NO=$ORDER(^TMP($JOB,"HLMON",+HLEVIENJ,TITLE,":"),-1)+1
+23 SET ^TMP($JOB,"HLMON",+HLEVIENJ,TITLE,+NO)=^HLEV(776,+HLEVIENJ,SUB,MIEN,0)
End DoDot:2
End DoDot:1
+24 ;
+25 ; Variables...
+26 SET MIEN=0
SET SUMX=""
SET SUMY=""
+27 FOR
SET MIEN=$ORDER(^HLEV(776,+HLEVIENJ,52,MIEN))
IF MIEN'>0
QUIT
Begin DoDot:1
+28 ;->
SET REF=$GET(^HLEV(776,+HLEVIENJ,52,+MIEN,0))
IF $PIECE(REF,U)']""
QUIT
+29 SET VAR=$PIECE(REF,U)
SET EXPL=$PIECE(REF,U,2)
SET EXPL=$SELECT(EXPL]"":EXPL,1:REF)
+30 SET DATA=$GET(^HLEV(776,+HLEVIENJ,52,+MIEN,52))
+31 SET ^TMP($JOB,"HLMON",+HLEVIENJ,"VD",VAR,EXPL)=DATA
+32 +33 ; Length of data
SET LEN=$LENGTH(DATA)
+34 ; Length column header
SET LEN(1)=$LENGTH(EXPL)
+35 ; Largest length-data or header
SET LEN(2)=$SELECT(LEN>LEN(1):LEN,1:LEN(1))+2
+36 ; Length - data + header
SET LEN(3)=LEN+LEN(1)+3
+37 +38 SET ^TMP($JOB,"HLMON",+HLEVIENJ,"VX",LEN(2),VAR,EXPL)=""
+39 SET ^TMP($JOB,"HLMON",+HLEVIENJ,"VY",+LEN(3),VAR,EXPL)=""
+40 +41 ; # variables...
SET $PIECE(SUMX,U)=$PIECE(SUMX,U)+1
+42 ; Total columns required...
SET $PIECE(SUMX,U,2)=$PIECE(SUMX,U,2)+LEN(2)+2
+43 ; Largest column
IF $PIECE(SUMX,U,3)<(LEN(2)+1)
SET $PIECE(SUMX,U,3)=LEN(2)
+44 +45 SET $PIECE(SUMY,U)=$PIECE(SUMY,U)+1
+46 SET $PIECE(SUMY,U,2)=$PIECE(SUMY,U,2)+1
+47 IF $PIECE(SUMY,U,3)<(LEN(3)+1)
SET $PIECE(SUMY,U,3)=LEN(3)
End DoDot:1
+48 ;
+49 ; # Var header, Line and Var data "pages"...
+50 SET LEN=0
SET PAGE=0
SET SUM=0
+51 FOR
SET LEN=$ORDER(^TMP($JOB,"HLMON",+HLEVIENJ,"VX",LEN))
IF LEN'>0
QUIT
Begin DoDot:1
+52 IF PAGE=0
SET PAGE=1
+53 IF (SUM+LEN)>80
Begin DoDot:2
+54 SET PAGE=PAGE+1
SET SUM=0
End DoDot:2
+55 SET SUM=SUM+LEN
End DoDot:1
+56 IF PAGE
SET $PIECE(SUMX,U,4)=PAGE
+57 ;
+58 IF SUMX]""
SET ^TMP($JOB,"HLMON",+HLEVIENJ,"VX")=SUMX
+59 IF SUMY]""
SET ^TMP($JOB,"HLMON",+HLEVIENJ,"VY")=SUMY
+60 ;
+61 QUIT
+62 ;
+63 ;
SET(STORE,TAG,VAL) ; Store value to be displayed...
+1 SET ^TMP($JOB,"HLMON",HLEVIENJ,STORE)=$SELECT(VAL]"":1,1:"")_U_TAG_U_VAL
+2 QUIT
+3 ;
STAT776(STAT) ; Return status for use on report...
+1 QUIT STAT_U_$SELECT(STAT="E":"Error",STAT="F":"Finish",STAT="Q":"Que'd",STAT="R":"Running",1:"")
+2 ;
CTRLMON ; Re/ask for monitor to display...
+1 NEW IEN776,IENDATE,IENONE,IOINHI,IOINORM,LASTONE,WORK,X
+2 SET X="IOINHI;IOINORM"
DO ENDR^%ZISS
+3 SET WORK=0
+4 WRITE !
+5 ;->
SET IEN776=$$ASKMON
IF IEN776'>0
QUIT
+6 SET WORK=1
+7 ;->
SET IENDATE=$$ASKDATE(IEN776)
IF IENDATE'>0
QUIT
CTRLMON1 ; Reask entry point...
+1 ;->
SET IENONE=$$ASKONE(IEN776,IENDATE)
IF IENONE'>0
Begin DoDot:1
+2 WRITE !!!!,IOINHI,"Returning to display of daily map views...",IOINORM
+3 WRITE !!
End DoDot:1
QUIT
+4 DO SHOW^HLEVREP2(+IENONE)
+5 ;->
IF $PIECE(IENONE,U,2)>1
Begin DoDot:1
+6 DO TELL^HLEVMST0("","0^0^999","Press RETURN to continue... ")
End DoDot:1
GOTO CTRLMON1
+7 ;->
GOTO CTRLMON
+8 ;
ASKMON() ; Ask user for a monitor to show...
+1 NEW DIC,X,Y
+2 SET DIC=776.1
SET DIC(0)="AEMQ"
SET DIC("A")="Select monitor to view, or RETURN to continue: "
+3 SET DIC("S")="I $D(^TMP($J,""HLMAP"",""E"",+Y))"
+4 DO ^DIC
+5 QUIT $SELECT(+Y>0:+Y,1:"")
+6 ;
ASKDATE(IEN776) ;
+1 ; DATESEL -- req
+2 NEW DATE,DIR,DIRUT,DTOUT,DUOUT,X,Y
+3 SET DIR(0)="DA"
SET DIR("A")="Select monitor RUN DATE: "
+4 SET X=$$FMTE^XLFDT($ORDER(^TMP($JOB,"HLMAP","E",+IEN776,DATESEL-.000001)))
IF X]""
SET DIR("B")=X
ASKDATE1 ;
+1 SET DIR("?")="Enter one of the ""run dates"" for this monitor. (Enter ?? to see list of run dates.)"
+2 SET DIR("??")="^D ASKDHELP^HLEVREP1"
+3 DO ^DIR
+4 ;->
IF $DATA(DIRUT)!($DATA(DTOUT))!($DATA(DUOUT))
QUIT ""
+5 ;->
IF $DATA(^TMP($JOB,"HLMAP","E",+IEN776,+Y))
QUIT +Y
+6 DO ASKDHELP
+7 ;->
GOTO ASKDATE1
+8 ;
ASKDHELP ; Help for $$ASKDATE...
+1 WRITE !!,"You must enter one of the following dates. Data exists for... "
+2 WRITE !!
+3 SET DATE=0
+4 FOR
SET DATE=$ORDER(^TMP($JOB,"HLMAP","E",IEN776,DATE))
IF DATE'>0
QUIT
Begin DoDot:1
+5 SET DATE(1)=$$FMTE^XLFDT(DATE)
+6 IF $X>70
WRITE !
+7 WRITE $JUSTIFY(DATE(1),15)
End DoDot:1
+8 WRITE !
+9 QUIT
+10 ;
ASKONE(IEN776,IENDATE) ;
+1 ; Defines and returns LASTONE...
+2 NEW DATA,DATE,DIR,DIRUT,DTOUT,DUOUT,HOLD,IEN,LAST,NEXT,NO,STAT,X,Y
+3 ;
+4 ; Find entries and build DIR string...
+5 SET NO=0
SET IEN=0
SET DIR(0)="SO^"
+6 FOR
SET IEN=$ORDER(^TMP($JOB,"HLMAP","E",+IEN776,+IENDATE,IEN))
IF 'IEN
QUIT
Begin DoDot:1
+7 ;->
SET DATA=$GET(^HLEV(776,+IEN,0))
IF DATA']""
QUIT
+8 SET NO=NO+1
+9 SET DATE=$PIECE(DATA,U)
SET STAT=$$STAT776^HLEVREP3($PIECE(DATA,U,4))
+10 SET HOLD(NO)=IEN_U_DATE
+11 SET DATE(DATE)=IEN_U_STAT
+12 SET DIR(0)=DIR(0)_$SELECT(DIR(0)'="SO^":";",1:"")_NO_":"_$TRANSLATE($$FMTE^XLFDT(DATE),":",".")_" ["_$PIECE(STAT,U,2)_"]"
End DoDot:1
+13 ;->
IF NO'>0
QUIT ""
+14 ;->
IF NO=1
QUIT +HOLD(1)_U_1
+15 ;
+16 WRITE !!,"This monitor was run more than once on the date you selected. Please select"
+17 WRITE !,"specific run time now..."
+18 SET NEXT=$SELECT($GET(LASTONE)'>0:1,1:LASTONE+1)
SET NEXT=$SELECT($DATA(HOLD(NEXT)):NEXT,1:"")
+19 SET DIR("A")="Select RUN TIME"
+20 IF NEXT
SET DIR("B")=NEXT
+21 DO ^DIR
+22 ;
+23 ;-> User answered by entering number...
IF '$DATA(HOLD(+$GET(X)))
QUIT ""
+24 ;
+25 ; Used for DIR("B") later...
SET LASTONE=+X
+26 ;
+27 QUIT +HOLD(+X)_U_NO
+28 ;
EOR ;HLEVREP3 - Event Monitor REPORTS ;5/16/03 14:42