AWCMCPR2 ;VISN7/THM-CPRS MONITOR HTML CODE [07-07-2003] ; 09 Jan 2004 3:43 PM
;;7.3;TOOLKIT;**84**;Jan 9, 2004
;
PART1 ; HTML section that creates java applet data
; Variables are killed in calling program
;
W "<html><head>",!
W "<META HTTP-EQUIV=""Refresh"""," Content=""300; URL="_$P(^AWC(177100.12,1,0),U,6)_"_"_AWCDIVNM_".htm",""">",!
W "<title>CPRS Response Time Monitor - "_AWCDIVN1_"</title></head>",!
W "<body>",!
S AWCY99=$P(^AWC(177100.12,1,0),U),AWCY99=$P($G(^DIC(4,+AWCY99,0)),U)
W "<center><H2>"_AWCY99_"</H2>"
W "<H4>","CPRS Response Time Monitor for facility -- "_AWCDIVN1,!,"</H4>"
D MENU1
W "<APPLET CODE=linegraph.class HEIGHT=350 WIDTH="_$S(AWCDHRS=5:800,AWCDHRS=6:850,AWCDHRS=7:900,AWCDHRS=8:950,AWCDHRS=9:1000,AWCDHRS=10:1050,AWCDHRS=11:1100,1:1150)_">",!
Q
;
PART2 ;
W "<PARAM NAME=KeyWidth VALUE=80>",!
W "<PARAM NAME=LineColor_R_L1 VALUE="_$P(AWCTIULN,",",1)_">",!
W "<PARAM NAME=LineColor_G_L1 VALUE="_$P(AWCTIULN,",",2)_">",!
W "<PARAM NAME=LineColor_B_L1 VALUE="_$P(AWCTIULN,",",3)_">",!
W "<PARAM NAME=LineColor_R_L2 VALUE="_$P(AWCLABLN,",",1)_">",!
W "<PARAM NAME=LineColor_G_L2 VALUE="_$P(AWCLABLN,",",2)_">",!
W "<PARAM NAME=LineColor_B_L2 VALUE="_$P(AWCLABLN,",",3)_">",!
W "<PARAM NAME=LineColor_R_L3 VALUE="_$P(AWCREMLN,",",1)_">",!
W "<PARAM NAME=LineColor_G_L3 VALUE="_$P(AWCREMLN,",",2)_">",!
W "<PARAM NAME=LineColor_B_L3 VALUE="_$P(AWCREMLN,",",3)_">",!
W "<PARAM NAME=yMax VALUE="_AWCMXSEC_">",!
W "<PARAM NAME=yMin VALUE=0>",!
W "<PARAM NAME=Mode VALUE=0>",!
W "<PARAM NAME=Lines VALUE=3>",!
W "<PARAM NAME=Title VALUE="""">",!
W "<PARAM NAME=Border VALUE=""30"""_">",!
W "<PARAM NAME=Grid VALUE="""_AWCGRDON_""">",!
W "<PARAM NAME=""lines"" VALUE=1>",!
W "<PARAM NAME=""bg_r"" VALUE="_$P(AWCBKGRN,",",1)_">",!
W "<PARAM NAME=""bg_g"" VALUE="_$P(AWCBKGRN,",",2)_">",!
W "<PARAM NAME=""bg_b"" VALUE="_$P(AWCBKGRN,",",3)_">",!
F AWCTYPE=0:0 S AWCTYPE=$O(TMP("AWC",AWCTYPE)) Q:AWCTYPE="" S AWCPCNTR=0 F AWCTIME=-9999:0 S AWCTIME=$O(TMP("AWC",AWCTYPE,AWCTIME)) Q:AWCTIME="" DO
.S AWCPCNTR=AWCPCNTR+1,AWCPARAM="VAL"_AWCPCNTR_"_L"_AWCTYPE
.W "<PARAM NAME="""_AWCPARAM_""" ","VALUE="""
.S AWCDTA=$G(TMP("AWC",AWCTYPE,AWCTIME)),AWCSEC=$P(AWCDTA,U),AWCCNT=$P(AWCDTA,U,2)
.S AWCAVG=$S(AWCCNT>0:$J(AWCSEC/AWCCNT,0,2),1:0)
.I AWCAVG>AWCMXSEC S AWCAVG=AWCMXSEC ;if average is greater than max, set to max
.I AWCAVG<0 S AWCAVG=0 ;no values <0
.W +AWCAVG,""">",! ;finish the HTML line
.; add the time values for the x-axis
S AWCLBCNT=1
F YYY=-99999:0 S YYY=$O(^TMP("AWCTTIM",$J,YYY)) Q:YYY="" DO
.S Y=YYY
.I Y<0 S Y=9999+Y
.; format the time, if necessary
.I $L(Y)=1 S Y="000"_Y
.I $L(Y)=2 S Y="00"_Y
.I $L(Y)=3 S Y="0"_Y
.W "<PARAM NAME=LAB"_AWCLBCNT_" VALUE="""_$S($E(Y,3,4)=10:"*",$E(Y,3,4)=20:"*",$E(Y,3,4)=40:"*",$E(Y,3,4)=50:"*",1:Y)_""">",! S AWCLBCNT=AWCLBCNT+1
; add the remaining values
S (AWCLBCNT,AWCVCNTR)=(AWCLBCNT-1) ;label count and value count
W !,"<PARAM NAME=Key_L1 VALUE="_""" - TIU"">",!
W "<PARAM NAME=Key_L2 VALUE="_""" - Lab"">",!
W "<PARAM NAME=Key_L3 VALUE="_""" - Reminder"">",!!
W "<PARAM NAME=NumberOfVals VALUE="_AWCVCNTR_">",!
W "<PARAM NAME=NumberOfLabs VALUE="_AWCLBCNT_">",!
W "</applet>","<p><h4><center>Response Time In Seconds for the last "_AWCDHRS_" hours </h4>","</center>",!
W "<b><h5>Last updated: " D NOW^%DTC S Y=% X ^DD("DD") W Y,!,"</b></h5></body></html>",!
D CLOSE^%ZISH("AWCCPR1"),^%ZISC
K AWCY99
Q
;
; goes in <body> portion of page
Q:$O(AWCFDIV(0))="" ;only one division at facility
S AWCWEBRT=$P(^AWC(177100.12,1,0),U,15) Q:AWCWEBRT="" ;not set up in param file
S AWCWL=$L(AWCWEBRT) I $E(AWCWEBRT,AWCWL,AWCWL)'="/" S AWCWEBRT=AWCWEBRT_"/"
W "<form name=""jump"">",!
W "<select name=""menu"">",!
W "<option value=""#"">Other Facilities</option>",!
S AWCDVNM="" F S AWCDVNM=$O(AWCFDIV(AWCDVNM)) Q:AWCDVNM="" DO
.S AWCDVDTA=AWCFDIV(AWCDVNM),AWCFDIVN=$P(AWCDVDTA,U),AWCDVNB=$P(AWCDVDTA,U,2)
.W "<option value=""http://"_AWCWEBRT_$P(AWCFILE,"_")_"_"_AWCDVNB_".htm"_""">"_$P(AWCFDIV(AWCDVNM),U)_"</option>",!
W "</select>",!
W "<input type=""button"" onClick=""location=document.jump.menu.options[document.jump.menu.selectedIndex].value;"" value=""GO"">",!
W "</form>",!
Q
AWCMCPR2 ;VISN7/THM-CPRS MONITOR HTML CODE [07-07-2003] ; 09 Jan 2004 3:43 PM
+1 ;;7.3;TOOLKIT;**84**;Jan 9, 2004
+2 ;
PART1 ; HTML section that creates java applet data
+1 ; Variables are killed in calling program
+2 ;
+3 WRITE "<html><head>",!
+4 WRITE "<META HTTP-EQUIV=""Refresh"""," Content=""300; URL="_$PIECE(^AWC(177100.12,1,0),U,6)_"_"_AWCDIVNM_".htm",""">",!
+5 WRITE "<title>CPRS Response Time Monitor - "_AWCDIVN1_"</title></head>",!
+6 WRITE "<body>",!
+7 SET AWCY99=$PIECE(^AWC(177100.12,1,0),U)
SET AWCY99=$PIECE($GET(^DIC(4,+AWCY99,0)),U)
+8 WRITE "<center><H2>"_AWCY99_"</H2>"
+9 WRITE "<H4>","CPRS Response Time Monitor for facility -- "_AWCDIVN1,!,"</H4>"
+10 DO MENU1
+11 WRITE "<APPLET CODE=linegraph.class HEIGHT=350 WIDTH="_$SELECT(AWCDHRS=5:800,AWCDHRS=6:850,AWCDHRS=7:900,AWCDHRS=8:950,AWCDHRS=9:1000,AWCDHRS=10:1050,AWCDHRS=11:1100,1:1150)_">",!
+12 QUIT
+13 ;
PART2 ;
+1 WRITE "<PARAM NAME=KeyWidth VALUE=80>",!
+2 WRITE "<PARAM NAME=LineColor_R_L1 VALUE="_$PIECE(AWCTIULN,",",1)_">",!
+3 WRITE "<PARAM NAME=LineColor_G_L1 VALUE="_$PIECE(AWCTIULN,",",2)_">",!
+4 WRITE "<PARAM NAME=LineColor_B_L1 VALUE="_$PIECE(AWCTIULN,",",3)_">",!
+5 WRITE "<PARAM NAME=LineColor_R_L2 VALUE="_$PIECE(AWCLABLN,",",1)_">",!
+6 WRITE "<PARAM NAME=LineColor_G_L2 VALUE="_$PIECE(AWCLABLN,",",2)_">",!
+7 WRITE "<PARAM NAME=LineColor_B_L2 VALUE="_$PIECE(AWCLABLN,",",3)_">",!
+8 WRITE "<PARAM NAME=LineColor_R_L3 VALUE="_$PIECE(AWCREMLN,",",1)_">",!
+9 WRITE "<PARAM NAME=LineColor_G_L3 VALUE="_$PIECE(AWCREMLN,",",2)_">",!
+10 WRITE "<PARAM NAME=LineColor_B_L3 VALUE="_$PIECE(AWCREMLN,",",3)_">",!
+11 WRITE "<PARAM NAME=yMax VALUE="_AWCMXSEC_">",!
+12 WRITE "<PARAM NAME=yMin VALUE=0>",!
+13 WRITE "<PARAM NAME=Mode VALUE=0>",!
+14 WRITE "<PARAM NAME=Lines VALUE=3>",!
+15 WRITE "<PARAM NAME=Title VALUE="""">",!
+16 WRITE "<PARAM NAME=Border VALUE=""30"""_">",!
+17 WRITE "<PARAM NAME=Grid VALUE="""_AWCGRDON_""">",!
+18 WRITE "<PARAM NAME=""lines"" VALUE=1>",!
+19 WRITE "<PARAM NAME=""bg_r"" VALUE="_$PIECE(AWCBKGRN,",",1)_">",!
+20 WRITE "<PARAM NAME=""bg_g"" VALUE="_$PIECE(AWCBKGRN,",",2)_">",!
+21 WRITE "<PARAM NAME=""bg_b"" VALUE="_$PIECE(AWCBKGRN,",",3)_">",!
+22 FOR AWCTYPE=0:0
SET AWCTYPE=$ORDER(TMP("AWC",AWCTYPE))
IF AWCTYPE=""
QUIT
SET AWCPCNTR=0
FOR AWCTIME=-9999:0
SET AWCTIME=$ORDER(TMP("AWC",AWCTYPE,AWCTIME))
IF AWCTIME=""
QUIT
Begin DoDot:1
+23 SET AWCPCNTR=AWCPCNTR+1
SET AWCPARAM="VAL"_AWCPCNTR_"_L"_AWCTYPE
+24 WRITE "<PARAM NAME="""_AWCPARAM_""" ","VALUE="""
+25 SET AWCDTA=$GET(TMP("AWC",AWCTYPE,AWCTIME))
SET AWCSEC=$PIECE(AWCDTA,U)
SET AWCCNT=$PIECE(AWCDTA,U,2)
+26 SET AWCAVG=$SELECT(AWCCNT>0:$JUSTIFY(AWCSEC/AWCCNT,0,2),1:0)
+27 ;if average is greater than max, set to max
IF AWCAVG>AWCMXSEC
SET AWCAVG=AWCMXSEC
+28 ;no values <0
IF AWCAVG<0
SET AWCAVG=0
+29 ;finish the HTML line
WRITE +AWCAVG,""">",!
+30 ; add the time values for the x-axis
End DoDot:1
+31 SET AWCLBCNT=1
+32 FOR YYY=-99999:0
SET YYY=$ORDER(^TMP("AWCTTIM",$JOB,YYY))
IF YYY=""
QUIT
Begin DoDot:1
+33 SET Y=YYY
+34 IF Y<0
SET Y=9999+Y
+35 ; format the time, if necessary
+36 IF $LENGTH(Y)=1
SET Y="000"_Y
+37 IF $LENGTH(Y)=2
SET Y="00"_Y
+38 IF $LENGTH(Y)=3
SET Y="0"_Y
+39 WRITE "<PARAM NAME=LAB"_AWCLBCNT_" VALUE="""_$SELECT($EXTRACT(Y,3,4)=10:"*",$EXTRACT(Y,3,4)=20:"*",$EXTRACT(Y,3,4)=40:"*",$EXTRACT(Y,3,4)=50:"*",1:Y)_""">",!
SET AWCLBCNT=AWCLBCNT+1
End DoDot:1
+40 ; add the remaining values
+41 ;label count and value count
SET (AWCLBCNT,AWCVCNTR)=(AWCLBCNT-1)
+42 WRITE !,"<PARAM NAME=Key_L1 VALUE="_""" - TIU"">",!
+43 WRITE "<PARAM NAME=Key_L2 VALUE="_""" - Lab"">",!
+44 WRITE "<PARAM NAME=Key_L3 VALUE="_""" - Reminder"">",!!
+45 WRITE "<PARAM NAME=NumberOfVals VALUE="_AWCVCNTR_">",!
+46 WRITE "<PARAM NAME=NumberOfLabs VALUE="_AWCLBCNT_">",!
+47 WRITE "</applet>","<p><h4><center>Response Time In Seconds for the last "_AWCDHRS_" hours </h4>","</center>",!
+48 WRITE "<b><h5>Last updated: "
DO NOW^%DTC
SET Y=%
XECUTE ^DD("DD")
WRITE Y,!,"</b></h5></body></html>",!
+49 DO CLOSE^%ZISH("AWCCPR1")
DO ^%ZISC
+50 KILL AWCY99
+51 QUIT
+52 ;
+1 ; goes in <body> portion of page
+2 ;only one division at facility
IF $ORDER(AWCFDIV(0))=""
QUIT
+3 ;not set up in param file
SET AWCWEBRT=$PIECE(^AWC(177100.12,1,0),U,15)
IF AWCWEBRT=""
QUIT
+4 SET AWCWL=$LENGTH(AWCWEBRT)
IF $EXTRACT(AWCWEBRT,AWCWL,AWCWL)'="/"
SET AWCWEBRT=AWCWEBRT_"/"
+5 WRITE "<form name=""jump"">",!
+6 WRITE "<select name=""menu"">",!
+7 WRITE "<option value=""#"">Other Facilities</option>",!
+8 SET AWCDVNM=""
FOR
SET AWCDVNM=$ORDER(AWCFDIV(AWCDVNM))
IF AWCDVNM=""
QUIT
Begin DoDot:1
+9 SET AWCDVDTA=AWCFDIV(AWCDVNM)
SET AWCFDIVN=$PIECE(AWCDVDTA,U)
SET AWCDVNB=$PIECE(AWCDVDTA,U,2)
+10 WRITE "<option value=""http://"_AWCWEBRT_$PIECE(AWCFILE,"_")_"_"_AWCDVNB_".htm"_""">"_$PIECE(AWCFDIV(AWCDVNM),U)_"</option>",!
End DoDot:1
+11 WRITE "</select>",!
+12 WRITE "<input type=""button"" onClick=""location=document.jump.menu.options[document.jump.menu.selectedIndex].value;"" value=""GO"">",!
+13 WRITE "</form>",!
+14 QUIT