HLEMST ;ALB/CJM -ListManager Screen for displaying an Event Statistics;12 JUN 1997 10:00 am
;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13,1995
;
EN ;Entry point to viewing a Event Statistics
;Input: EVENT is the ien of an event
;Output: none
;
N IDX,BEGIN
I $G(PROFILE),$D(PROFILE("SITES")),$D(PROFILE("TYPES"))
E N PROFILE S PROFILE=$$PROFILE^HLEMSL() Q:'PROFILE S PROFILE=$$GET^HLEMP(PROFILE,.PROFILE)
S BEGIN=$$ASKBEGIN()
Q:'BEGIN
;
S IDX="^TMP(""HLEM"",$J,""STATISTICS"")"
K @IDX
D WAIT^DICD
D EN^VALM("HLEM DISPLAY STATISTICS")
;
K @IDX
Q
;
;
HDR ;Header code
S VALMHDR(1)="Year Month Day Hour Event Count"
Q
;
INIT ;Init variables and list array
N ARY
S ARY="^TMP($J,""HLSTATS"")"
S VALMSG="USER PROFILE: "_$G(PROFILE("NAME"))_" STARTING: "_$$FMTE^XLFDT(BEGIN)
D SETUP(BEGIN,ARY,.PROFILE)
D DISPLAY(ARY,IDX)
K @ARY
D HDR
S VALMBCK="R"
Q
;
SETUP(START,ARY,PROFILE) ;
;sets up a work array with the required statistics
;START is the starting date
;
N SITE,TYPE,IDX
K @ARY
S SITE=0
S START("YEAR")=1700+(+$E(START,1,3)),START("MONTH")=+$E(START,4,5),START("DAY")=+$E(START,6,7),START("HOUR")=$E($P(START,".",2),1,2)
S IDX="^HLEV(776.4,""AF"")"
F S SITE=$O(@IDX@(SITE)) Q:'SITE D:$G(PROFILE("ALL SITES"))!$D(PROFILE("SITES",SITE))
.S SITE("NAME")=$$STATION^HLEMSU(SITE)
.Q:'$L(SITE("NAME"))
.S $P(SITE("NAME"),"^",3)=SITE
.S TYPE=0
.F S TYPE=$O(@IDX@(SITE,TYPE)) Q:'TYPE D:PROFILE("ALL TYPES")!$D(PROFILE("TYPES",TYPE))
..S TYPE("NAME")=$$CODE^HLEMT(TYPE)
..S:(+TYPE("NAME")=TYPE("NAME")) TYPE("NAME")=$E($P($G(^HLEV(776.3,TYPE,4)),"^"),1,40)
..Q:'$L(TYPE("NAME"))
..N IDX S IDX="^HLEV(776.4,""AF"",SITE,TYPE,""RECEIVED"")"
..D YEAR(.SITE,.TYPE,.START)
Q
;
YEAR(SITE,TYPE,START) ;
N YEAR
S YEAR=START("YEAR")-1
F S YEAR=$O(@IDX@("YEAR",YEAR)) Q:'YEAR D:(YEAR'<START("YEAR"))
.D:(YEAR>START("YEAR"))
..S @ARY@(SITE("NAME"),YEAR)=$G(@ARY@(SITE("NAME"),YEAR))+$G(@IDX@("YEAR",YEAR))
..S @ARY@(SITE("NAME"),YEAR,"TYPE",TYPE("NAME"))=$G(@ARY@(SITE("NAME"),YEAR,"TYPE",TYPE("NAME")))+$G(@IDX@("YEAR",YEAR))
.D MONTH(.SITE,.TYPE,.START,YEAR)
Q
;
MONTH(SITE,TYPE,START,YEAR) ;
N MONTH
S MONTH=START("MONTH")-1
F S MONTH=$O(@IDX@("YEAR",YEAR,"MONTH",MONTH)) Q:'MONTH D:(YEAR>START("YEAR"))!(YEAR=START("YEAR")&(MONTH'<START("MONTH")))
.D:(MONTH>START("MONTH"))!(YEAR>START("YEAR"))
..S @ARY@(SITE("NAME"),YEAR,MONTH)=$G(@ARY@(SITE("NAME"),YEAR,MONTH))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH))
..S @ARY@(SITE("NAME"),YEAR,MONTH,"TYPE",TYPE("NAME"))=$G(@ARY@(SITE("NAME"),YEAR,MONTH,"TYPE",TYPE("NAME")))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH))
.D DAY(.SITE,.TYPE,.START,YEAR,MONTH)
Q
;
DAY(SITE,TYPE,START,YEAR,MONTH) ;
N DAY
S DAY=0
F S DAY=$O(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY)) Q:'DAY Q:START>((YEAR-1700)_$$RJ^XLFSTR(MONTH,2,"0")_$$RJ^XLFSTR(DAY,2,"0")) D
.S @ARY@(SITE("NAME"),YEAR,MONTH,DAY)=$G(@ARY@(SITE("NAME"),YEAR,MONTH,DAY))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY))
.S @ARY@(SITE("NAME"),YEAR,MONTH,DAY,"TYPE",TYPE("NAME"))=$G(@ARY@(SITE("NAME"),YEAR,MONTH,DAY,"TYPE",TYPE("NAME")))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY))
.D HOUR(.SITE,.TYPE,.START,YEAR,MONTH,DAY)
Q
;
HOUR(SITE,TYPE,START,YEAR,MONTH,DAY) ;
N HOUR
S HOUR=""
F S HOUR=$O(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY,"HOUR",HOUR)) Q:(HOUR="") D:(HOUR'<START("HOUR"))
.S @ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR)=$G(@ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY,"HOUR",HOUR))
.S @ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR,"TYPE",TYPE("NAME"))=$G(@ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR,"TYPE",TYPE("NAME")))+$G(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY,"HOUR",HOUR))
Q
;
DISPLAY(ARY,IDX) ;Build event statistics screen
N YEAR,SITE
D CLEAN^VALM10
K @IDX,VALMHDR
S VALMBG=1,VALMCNT=0
;
S SITE=""
I '$O(@ARY@(SITE)),$$SET^HLEMSU(1,"There are no statistics for this profile and date range!",10,"H")
E F S SITE=$O(@ARY@(SITE)) Q:(SITE="") D
.I VALMCNT,$$SET^HLEMSU(VALMCNT,$G(@IDX@(VALMCNT,0)),1,"U")
.S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($P(SITE,"^"),30)_$$LJ^XLFSTR("Station #: "_$P(SITE,"^",2),50),1,"H")
.S @IDX@("SITE",$P(SITE,"^"))=VALMCNT
.S @IDX@("SITE",$P(SITE,"^",3))=VALMCNT
.S YEAR=";"
.F S YEAR=$O(@ARY@(SITE,YEAR),-1) Q:'YEAR D DYEAR(ARY,IDX,SITE,YEAR)
;Build header
D HDR
Q
;
DYEAR(ARY,IDX,SITE,YEAR) ;
N EVENT,MONTH
S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(YEAR,71)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR)),20),1)
S EVENT=""
F S EVENT=$O(@ARY@(SITE,YEAR,"TYPE",EVENT)) Q:EVENT="" D
.S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,"TYPE",EVENT)),20),32)
S MONTH=";"
F S MONTH=$O(@ARY@(SITE,YEAR,MONTH),-1) Q:(MONTH="") D
.D DMONTH(ARY,IDX,SITE,YEAR,MONTH)
Q
;
DMONTH(ARY,IDX,SITE,YEAR,MONTH) ;
N EVENT,DAY
S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($$MONTHTXT(MONTH),64)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH)),20),8)
S EVENT=""
F S EVENT=$O(@ARY@(SITE,YEAR,MONTH,"TYPE",EVENT)) Q:EVENT="" D
.S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH,"TYPE",EVENT)),20),32)
S DAY=";"
F S DAY=$O(@ARY@(SITE,YEAR,MONTH,DAY),-1) D Q:'DAY
.D:DAY DDAY(ARY,IDX,SITE,YEAR,MONTH,DAY)
Q
;
DDAY(ARY,IDX,SITE,YEAR,MONTH,DAY) ;
N EVENT,HOUR
S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($$DAYTXT(DAY),54)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH,DAY)),20),18)
S EVENT=""
F S EVENT=$O(@ARY@(SITE,YEAR,MONTH,DAY,"TYPE",EVENT)) Q:EVENT="" D
.S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH,DAY,"TYPE",EVENT)),20),32)
S HOUR=";"
F S HOUR=$O(@ARY@(SITE,YEAR,MONTH,DAY,HOUR),-1) Q:'HOUR D DHOUR(ARY,IDX,SITE,YEAR,MONTH,DAY,HOUR)
Q
;
DHOUR(ARY,IDX,SITE,YEAR,MONTH,DAY,HOUR) ;
N EVENT
S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($$HOURTXT(HOUR),48)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH,DAY,HOUR)),20),24)
S EVENT=""
F S EVENT=$O(@ARY@(SITE,YEAR,MONTH,DAY,HOUR,"TYPE",EVENT)) Q:EVENT="" D
.S VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($G(@ARY@(SITE,YEAR,MONTH,DAY,HOUR,"TYPE",EVENT)),20),32)
Q
;
HELP ;Help code
S X="?" D DISP^XQORM1 W !!
Q
;
EXIT ;Exit code
D CLEAN^VALM10
D CLEAR^VALM1
K @IDX
Q
;
EXPND ;Expand code
Q
;
X(FIELD,VALUE) ;
;changes a field value in file 774.4 to external form
Q $$EXTERNAL^DILFD(776.4,FIELD,"F",VALUE)
;
ASKBEGIN(DEFAULT) ;
;Description: Asks the user to enter a beginning date.
;Input: DEFAULT - the suggested default dt/time (optional)
;Output: Returns the date as the function value, or 0 if the user does n to select a date
;
N DIR,X,Y
S DIR(0)="D^::TX"
S DIR("A")="Enter the begining date"
S DIR("B")=$$FMTE^XLFDT($S($G(DEFAULT):DEFAULT,1:$$FMADD^XLFDT(DT,-1)))
S DIR("?")="Please enter the earliest date for which you would like to see Event Logging Statistics."
D ^DIR
Q:$D(DIRUT) 0
Q Y
;
MONTHTXT(M) ;
;Given the month as a number 1-12, returns the name
Q $S(M=1:"January",M=2:"February",M=3:"March",M=4:"April",M=5:"May",M=6:"June",M=7:"July",M=8:"August",M=9:"September",M=10:"October",M=11:"November",M=12:"December",1:"Unknown")
;
DAYTXT(D) ;
;Given the day as a number, returns the day also as a number, but with
;a suffix of either "st","nd","rd","th"
I D>9,D<20 Q D_"th"
N DIGIT
S DIGIT=$E(D,$L(D))
Q D_$S(DIGIT=1:"st",DIGIT=2:"nd",DIGIT=3:"rd",1:"th")
;
HOURTXT(H) ;
I H<12 Q H_"am"
I H=12 Q "12N"
I H>12 Q (H-12)_"pm"
Q
;
SELECT ;Allows the user to change profiles, then rebuilds the Event Log Statistics screen
N PROF,ASKBEGIN
D FULL^VALM1
S PROF=$$SELECT^HLEMP1($G(DUZ),20)
I PROF,PROF'=$G(PROFILE) D
.S ASKBEGIN=$$ASKBEGIN($G(BEGIN))
.S:ASKBEGIN BEGIN=ASKBEGIN
.S PROFILE=$$GET^HLEMP(PROF,.PROFILE)
.D INIT^HLEMST
S VALMBCK="R"
Q
;
CHNGDATE ;Allows the user to change the starting date, then rebuilds the Event Log Statistics screen
N ASKBEGIN
S ASKBEGIN=$$ASKBEGIN($G(BEGIN))
I ASKBEGIN D
.S BEGIN=ASKBEGIN
.D INIT^HLEMST
S VALMBCK="R"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHLEMST 8348 printed Oct 16, 2024@17:58:23 Page 2
HLEMST ;ALB/CJM -ListManager Screen for displaying an Event Statistics;12 JUN 1997 10:00 am
+1 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13,1995
+2 ;
EN ;Entry point to viewing a Event Statistics
+1 ;Input: EVENT is the ien of an event
+2 ;Output: none
+3 ;
+4 NEW IDX,BEGIN
+5 IF $GET(PROFILE)
IF $DATA(PROFILE("SITES"))
IF $DATA(PROFILE("TYPES"))
+6 IF '$TEST
NEW PROFILE
SET PROFILE=$$PROFILE^HLEMSL()
if 'PROFILE
QUIT
SET PROFILE=$$GET^HLEMP(PROFILE,.PROFILE)
+7 SET BEGIN=$$ASKBEGIN()
+8 if 'BEGIN
QUIT
+9 ;
+10 SET IDX="^TMP(""HLEM"",$J,""STATISTICS"")"
+11 KILL @IDX
+12 DO WAIT^DICD
+13 DO EN^VALM("HLEM DISPLAY STATISTICS")
+14 ;
+15 KILL @IDX
+16 QUIT
+17 ;
+18 ;
HDR ;Header code
+1 SET VALMHDR(1)="Year Month Day Hour Event Count"
+2 QUIT
+3 ;
INIT ;Init variables and list array
+1 NEW ARY
+2 SET ARY="^TMP($J,""HLSTATS"")"
+3 SET VALMSG="USER PROFILE: "_$GET(PROFILE("NAME"))_" STARTING: "_$$FMTE^XLFDT(BEGIN)
+4 DO SETUP(BEGIN,ARY,.PROFILE)
+5 DO DISPLAY(ARY,IDX)
+6 KILL @ARY
+7 DO HDR
+8 SET VALMBCK="R"
+9 QUIT
+10 ;
SETUP(START,ARY,PROFILE) ;
+1 ;sets up a work array with the required statistics
+2 ;START is the starting date
+3 ;
+4 NEW SITE,TYPE,IDX
+5 KILL @ARY
+6 SET SITE=0
+7 SET START("YEAR")=1700+(+$EXTRACT(START,1,3))
SET START("MONTH")=+$EXTRACT(START,4,5)
SET START("DAY")=+$EXTRACT(START,6,7)
SET START("HOUR")=$EXTRACT($PIECE(START,".",2),1,2)
+8 SET IDX="^HLEV(776.4,""AF"")"
+9 FOR
SET SITE=$ORDER(@IDX@(SITE))
if 'SITE
QUIT
if $GET(PROFILE("ALL SITES"))!$DATA(PROFILE("SITES",SITE))
Begin DoDot:1
+10 SET SITE("NAME")=$$STATION^HLEMSU(SITE)
+11 if '$LENGTH(SITE("NAME"))
QUIT
+12 SET $PIECE(SITE("NAME"),"^",3)=SITE
+13 SET TYPE=0
+14 FOR
SET TYPE=$ORDER(@IDX@(SITE,TYPE))
if 'TYPE
QUIT
if PROFILE("ALL TYPES")!$DATA(PROFILE("TYPES",TYPE))
Begin DoDot:2
+15 SET TYPE("NAME")=$$CODE^HLEMT(TYPE)
+16 if (+TYPE("NAME")=TYPE("NAME"))
SET TYPE("NAME")=$EXTRACT($PIECE($GET(^HLEV(776.3,TYPE,4)),"^"),1,40)
+17 if '$LENGTH(TYPE("NAME"))
QUIT
+18 NEW IDX
SET IDX="^HLEV(776.4,""AF"",SITE,TYPE,""RECEIVED"")"
+19 DO YEAR(.SITE,.TYPE,.START)
End DoDot:2
End DoDot:1
+20 QUIT
+21 ;
YEAR(SITE,TYPE,START) ;
+1 NEW YEAR
+2 SET YEAR=START("YEAR")-1
+3 FOR
SET YEAR=$ORDER(@IDX@("YEAR",YEAR))
if 'YEAR
QUIT
if (YEAR'<START("YEAR"))
Begin DoDot:1
+4 if (YEAR>START("YEAR"))
Begin DoDot:2
+5 SET @ARY@(SITE("NAME"),YEAR)=$GET(@ARY@(SITE("NAME"),YEAR))+$GET(@IDX@("YEAR",YEAR))
+6 SET @ARY@(SITE("NAME"),YEAR,"TYPE",TYPE("NAME"))=$GET(@ARY@(SITE("NAME"),YEAR,"TYPE",TYPE("NAME")))+$GET(@IDX@("YEAR",YEAR))
End DoDot:2
+7 DO MONTH(.SITE,.TYPE,.START,YEAR)
End DoDot:1
+8 QUIT
+9 ;
MONTH(SITE,TYPE,START,YEAR) ;
+1 NEW MONTH
+2 SET MONTH=START("MONTH")-1
+3 FOR
SET MONTH=$ORDER(@IDX@("YEAR",YEAR,"MONTH",MONTH))
if 'MONTH
QUIT
if (YEAR>START("YEAR"))!(YEAR=START("YEAR")&(MONTH'<START("MONTH")))
Begin DoDot:1
+4 if (MONTH>START("MONTH"))!(YEAR>START("YEAR"))
Begin DoDot:2
+5 SET @ARY@(SITE("NAME"),YEAR,MONTH)=$GET(@ARY@(SITE("NAME"),YEAR,MONTH))+$GET(@IDX@("YEAR",YEAR,"MONTH",MONTH))
+6 SET @ARY@(SITE("NAME"),YEAR,MONTH,"TYPE",TYPE("NAME"))=$GET(@ARY@(SITE("NAME"),YEAR,MONTH,"TYPE",TYPE("NAME")))+$GET(@IDX@("YEAR",YEAR,"MONTH",MONTH))
End DoDot:2
+7 DO DAY(.SITE,.TYPE,.START,YEAR,MONTH)
End DoDot:1
+8 QUIT
+9 ;
DAY(SITE,TYPE,START,YEAR,MONTH) ;
+1 NEW DAY
+2 SET DAY=0
+3 FOR
SET DAY=$ORDER(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY))
if 'DAY
QUIT
if START>((YEAR-1700)_$$RJ^XLFSTR(MONTH,2,"0")_$$RJ^XLFSTR(DAY,2,"0"))
QUIT
Begin DoDot:1
+4 SET @ARY@(SITE("NAME"),YEAR,MONTH,DAY)=$GET(@ARY@(SITE("NAME"),YEAR,MONTH,DAY))+$GET(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY))
+5 SET @ARY@(SITE("NAME"),YEAR,MONTH,DAY,"TYPE",TYPE("NAME"))=$GET(@ARY@(SITE("NAME"),YEAR,MONTH,DAY,"TYPE",TYPE("NAME")))+$GET(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY))
+6 DO HOUR(.SITE,.TYPE,.START,YEAR,MONTH,DAY)
End DoDot:1
+7 QUIT
+8 ;
HOUR(SITE,TYPE,START,YEAR,MONTH,DAY) ;
+1 NEW HOUR
+2 SET HOUR=""
+3 FOR
SET HOUR=$ORDER(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY,"HOUR",HOUR))
if (HOUR="")
QUIT
if (HOUR'<START("HOUR"))
Begin DoDot:1
+4 SET @ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR)=$GET(@ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR))+$GET(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY,"HOUR",HOUR))
+5 SET @ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR,"TYPE",TYPE("NAME"))=$GET(@ARY@(SITE("NAME"),YEAR,MONTH,DAY,HOUR,"TYPE",TYPE("NAME")))+$GET(@IDX@("YEAR",YEAR,"MONTH",MONTH,"DAY",DAY,"HOUR",HOUR))
End DoDot:1
+6 QUIT
+7 ;
DISPLAY(ARY,IDX) ;Build event statistics screen
+1 NEW YEAR,SITE
+2 DO CLEAN^VALM10
+3 KILL @IDX,VALMHDR
+4 SET VALMBG=1
SET VALMCNT=0
+5 ;
+6 SET SITE=""
+7 IF '$ORDER(@ARY@(SITE))
IF $$SET^HLEMSU(1,"There are no statistics for this profile and date range!",10,"H")
+8 IF '$TEST
FOR
SET SITE=$ORDER(@ARY@(SITE))
if (SITE="")
QUIT
Begin DoDot:1
+9 IF VALMCNT
IF $$SET^HLEMSU(VALMCNT,$GET(@IDX@(VALMCNT,0)),1,"U")
+10 SET VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($PIECE(SITE,"^"),30)_$$LJ^XLFSTR("Station #: "_$PIECE(SITE,"^",2),50),1,"H")
+11 SET @IDX@("SITE",$PIECE(SITE,"^"))=VALMCNT
+12 SET @IDX@("SITE",$PIECE(SITE,"^",3))=VALMCNT
+13 SET YEAR=";"
+14 FOR
SET YEAR=$ORDER(@ARY@(SITE,YEAR),-1)
if 'YEAR
QUIT
DO DYEAR(ARY,IDX,SITE,YEAR)
End DoDot:1
+15 ;Build header
+16 DO HDR
+17 QUIT
+18 ;
DYEAR(ARY,IDX,SITE,YEAR) ;
+1 NEW EVENT,MONTH
+2 SET VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(YEAR,71)_$$LJ^XLFSTR($GET(@ARY@(SITE,YEAR)),20),1)
+3 SET EVENT=""
+4 FOR
SET EVENT=$ORDER(@ARY@(SITE,YEAR,"TYPE",EVENT))
if EVENT=""
QUIT
Begin DoDot:1
+5 SET VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($GET(@ARY@(SITE,YEAR,"TYPE",EVENT)),20),32)
End DoDot:1
+6 SET MONTH=";"
+7 FOR
SET MONTH=$ORDER(@ARY@(SITE,YEAR,MONTH),-1)
if (MONTH="")
QUIT
Begin DoDot:1
+8 DO DMONTH(ARY,IDX,SITE,YEAR,MONTH)
End DoDot:1
+9 QUIT
+10 ;
DMONTH(ARY,IDX,SITE,YEAR,MONTH) ;
+1 NEW EVENT,DAY
+2 SET VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($$MONTHTXT(MONTH),64)_$$LJ^XLFSTR($GET(@ARY@(SITE,YEAR,MONTH)),20),8)
+3 SET EVENT=""
+4 FOR
SET EVENT=$ORDER(@ARY@(SITE,YEAR,MONTH,"TYPE",EVENT))
if EVENT=""
QUIT
Begin DoDot:1
+5 SET VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($GET(@ARY@(SITE,YEAR,MONTH,"TYPE",EVENT)),20),32)
End DoDot:1
+6 SET DAY=";"
+7 FOR
SET DAY=$ORDER(@ARY@(SITE,YEAR,MONTH,DAY),-1)
Begin DoDot:1
+8 if DAY
DO DDAY(ARY,IDX,SITE,YEAR,MONTH,DAY)
End DoDot:1
if 'DAY
QUIT
+9 QUIT
+10 ;
DDAY(ARY,IDX,SITE,YEAR,MONTH,DAY) ;
+1 NEW EVENT,HOUR
+2 SET VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($$DAYTXT(DAY),54)_$$LJ^XLFSTR($GET(@ARY@(SITE,YEAR,MONTH,DAY)),20),18)
+3 SET EVENT=""
+4 FOR
SET EVENT=$ORDER(@ARY@(SITE,YEAR,MONTH,DAY,"TYPE",EVENT))
if EVENT=""
QUIT
Begin DoDot:1
+5 SET VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($GET(@ARY@(SITE,YEAR,MONTH,DAY,"TYPE",EVENT)),20),32)
End DoDot:1
+6 SET HOUR=";"
+7 FOR
SET HOUR=$ORDER(@ARY@(SITE,YEAR,MONTH,DAY,HOUR),-1)
if 'HOUR
QUIT
DO DHOUR(ARY,IDX,SITE,YEAR,MONTH,DAY,HOUR)
+8 QUIT
+9 ;
DHOUR(ARY,IDX,SITE,YEAR,MONTH,DAY,HOUR) ;
+1 NEW EVENT
+2 SET VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR($$HOURTXT(HOUR),48)_$$LJ^XLFSTR($GET(@ARY@(SITE,YEAR,MONTH,DAY,HOUR)),20),24)
+3 SET EVENT=""
+4 FOR
SET EVENT=$ORDER(@ARY@(SITE,YEAR,MONTH,DAY,HOUR,"TYPE",EVENT))
if EVENT=""
QUIT
Begin DoDot:1
+5 SET VALMCNT=$$SET^HLEMSU($$INC^HLEMU(.VALMCNT),$$LJ^XLFSTR(EVENT,40)_$$LJ^XLFSTR($GET(@ARY@(SITE,YEAR,MONTH,DAY,HOUR,"TYPE",EVENT)),20),32)
End DoDot:1
+6 QUIT
+7 ;
HELP ;Help code
+1 SET X="?"
DO DISP^XQORM1
WRITE !!
+2 QUIT
+3 ;
EXIT ;Exit code
+1 DO CLEAN^VALM10
+2 DO CLEAR^VALM1
+3 KILL @IDX
+4 QUIT
+5 ;
EXPND ;Expand code
+1 QUIT
+2 ;
X(FIELD,VALUE) ;
+1 ;changes a field value in file 774.4 to external form
+2 QUIT $$EXTERNAL^DILFD(776.4,FIELD,"F",VALUE)
+3 ;
ASKBEGIN(DEFAULT) ;
+1 ;Description: Asks the user to enter a beginning date.
+2 ;Input: DEFAULT - the suggested default dt/time (optional)
+3 ;Output: Returns the date as the function value, or 0 if the user does n to select a date
+4 ;
+5 NEW DIR,X,Y
+6 SET DIR(0)="D^::TX"
+7 SET DIR("A")="Enter the begining date"
+8 SET DIR("B")=$$FMTE^XLFDT($SELECT($GET(DEFAULT):DEFAULT,1:$$FMADD^XLFDT(DT,-1)))
+9 SET DIR("?")="Please enter the earliest date for which you would like to see Event Logging Statistics."
+10 DO ^DIR
+11 if $DATA(DIRUT)
QUIT 0
+12 QUIT Y
+13 ;
MONTHTXT(M) ;
+1 ;Given the month as a number 1-12, returns the name
+2 QUIT $SELECT(M=1:"January",M=2:"February",M=3:"March",M=4:"April",M=5:"May",M=6:"June",M=7:"July",M=8:"August",M=9:"September",M=10:"October",M=11:"November",M=12:"December",1:"Unknown")
+3 ;
DAYTXT(D) ;
+1 ;Given the day as a number, returns the day also as a number, but with
+2 ;a suffix of either "st","nd","rd","th"
+3 IF D>9
IF D<20
QUIT D_"th"
+4 NEW DIGIT
+5 SET DIGIT=$EXTRACT(D,$LENGTH(D))
+6 QUIT D_$SELECT(DIGIT=1:"st",DIGIT=2:"nd",DIGIT=3:"rd",1:"th")
+7 ;
HOURTXT(H) ;
+1 IF H<12
QUIT H_"am"
+2 IF H=12
QUIT "12N"
+3 IF H>12
QUIT (H-12)_"pm"
+4 QUIT
+5 ;
SELECT ;Allows the user to change profiles, then rebuilds the Event Log Statistics screen
+1 NEW PROF,ASKBEGIN
+2 DO FULL^VALM1
+3 SET PROF=$$SELECT^HLEMP1($GET(DUZ),20)
+4 IF PROF
IF PROF'=$GET(PROFILE)
Begin DoDot:1
+5 SET ASKBEGIN=$$ASKBEGIN($GET(BEGIN))
+6 if ASKBEGIN
SET BEGIN=ASKBEGIN
+7 SET PROFILE=$$GET^HLEMP(PROF,.PROFILE)
+8 DO INIT^HLEMST
End DoDot:1
+9 SET VALMBCK="R"
+10 QUIT
+11 ;
CHNGDATE ;Allows the user to change the starting date, then rebuilds the Event Log Statistics screen
+1 NEW ASKBEGIN
+2 SET ASKBEGIN=$$ASKBEGIN($GET(BEGIN))
+3 IF ASKBEGIN
Begin DoDot:1
+4 SET BEGIN=ASKBEGIN
+5 DO INIT^HLEMST
End DoDot:1
+6 SET VALMBCK="R"
+7 QUIT