KMPDU7A ;OAK/RAK - CM Tools Routine Utilities ;7/22/04 09:06
;;3.0;KMPD;;Jan 22, 2009;Build 42
;
N DATA,DATE,HR,I,LN
;
ADCL ;- TMG - Average Daily Coversheet Load
; report data
N KMPDPTNP
S KMPDPTNP=$G(KMPDTM)
S KMPDATE(0)=KMPDATE
D DATA^KMPDTP1(.KMPDATE,KMPDPTNP,"")
I '$D(^TMP($J)) S KMPDY(0)="<No Data To Report>" Q
;S KMPDY(0)=$$NOW^XLFDT_"^"_$$FMTE^XLFDT($$NOW^XLFDT)
S (DATE,LN)=0
F S DATE=$O(^TMP($J,DATE)) Q:'DATE D
.S DATA=^TMP($J,DATE),LN=LN+1
.S $P(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
.S $P(KMPDY(LN),U,2)=$FN($P(DATA,U),",",0)
.S $P(KMPDY(LN),U,3)=$FN($P(DATA,U,2),",",0)
.S $P(KMPDY(LN),U,4)=$FN($P(DATA,U,3),",",0)
.S $P(KMPDY(LN),U,5)=$FN($P(DATA,U,4),",",0)
Q
;
AHCR ;- TMG - Average Hourly Coversheet Load
; report data
D DATA^KMPDTP3
I '$D(^TMP($J)) S KMPDY(0)="<No Data to Report>" Q
S (DATE,LN)=0
F S DATE=$O(^TMP($J,DATE)) Q:'DATE S HR=0 D
.F S HR=$O(^TMP($J,DATE,HR)) Q:'HR D
..S DATA=^TMP($J,DATE,HR),LN=LN+1
..S $P(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
..S $P(KMPDY(LN),U,2)=$S($L(HR)=1:"0",1:"")_HR
..S $P(KMPDY(LN),U,3)=$FN($P(DATA,U),",",0)
..S $P(KMPDY(LN),U,4)=$FN($P(DATA,U,2),",",0)
..S $P(KMPDY(LN),U,5)=$FN($P(DATA,U,3),",",0)
..S $P(KMPDY(LN),U,6)=$FN($P(DATA,U,4),",",0)
..S $P(KMPDY(LN),U,7)=$FN($P(DATA,U,5),",",0)
Q
;
CTTLAR ;- TMG - Coversheet TTL Alert Report
I $G(KMPDSRCH)="" S KMPDY(0)="[TTL Search data is missing]" Q
I '$G(KMPDTSEC) S KMPDY(0)="[Threshold Seconds data is missing]" Q
; report data
D DATA^KMPDTP5
I '$D(^TMP($J)) S KMPDY(0)="<No Data to Report>" Q
S (DATE,LN)=0
F S DATE=$O(^TMP($J,DATE)) Q:'DATE S HR="" D
.F S HR=$O(^TMP($J,DATE,HR)) Q:HR="" D
..S DATA=^TMP($J,DATE,HR)
..S $P(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
..S $P(KMPDY(LN),U,2)=HR
..; user name
..S $P(KMPDY(LN),U,3)=$P(DATA,U,5)
..; client name
..S $P(KMPDY(LN),U,4)=$P(DATA,U,6)
..; ip address
..S $P(KMPDY(LN),U,5)=$P(DATA,U,9)
..; time to load
..S $P(KMPDY(LN),U,6)=$FN($P(DATA,U,4),",",0)
..S LN=LN+1
Q
;
DCTTLDR ;- TMG - Daily Coversheet TTL Detailed Report
S KMPDPTNP=KMPDTM
; report data
D DATA^KMPDTP2
I '$D(^TMP($J)) S KMPDY(0)="<No Data to Report>" Q
S (DATE,LN)=0
F S DATE=$O(^TMP($J,DATE)) Q:'DATE D
.S DATA=^TMP($J,DATE),DATA(1)=$G(^TMP($J,DATE,1))
.F I=1:1:10 D
..S $P(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
..I I<10 S $P(KMPDY(LN),U,2)=$J(I-1*10,2)_" to "_(I*10)
..E S $P(KMPDY(LN),U,2)="90 or greater"
..S $P(KMPDY(LN),U,3)=$FN($P(DATA,U,I),",",0)
..S $P(KMPDY(LN),U,4)=$FN($P(DATA(1),U,I),",",1)_"%"
..S LN=LN+1
Q
;
HCTTLDR ;-TMG - Hourly Coversheet TTL Detailed Report
; report data
D DATA^KMPDTP4
I '$D(^TMP($J)) S KMPDY(0)="<No Data to Report>" Q
S (DATE,LN)=0
F S DATE=$O(^TMP($J,DATE)) Q:'DATE S HR=0 D
.F S HR=$O(^TMP($J,DATE,HR)) Q:'HR D
..S DATA=^TMP($J,DATE,HR),DATA(1)=$G(^(HR,1))
..F I=1:1:9 D
...S $P(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
...S $P(KMPDY(LN),U,2)=HR
...S $P(KMPDY(LN),U,3)=$J(I-1*10,2)_" to "_(I*10)
...S $P(KMPDY(LN),U,4)=$FN($P(DATA,U,I),",",0)
...S $P(KMPDY(LN),U,5)=$FN($P(DATA(1),U,I),",",1)
...S LN=LN+1
Q
;
RTAHCL ;- TMG - Real-Time Average Hourly Coversheet Load
; report data
D DATA^KMPDTP7
I '$D(^TMP($J)) S KMPDY(0)="<No Data to Report>" Q
S DATE=$O(^TMP($J,0)) Q:'DATE
S HR="",LN=0
F S HR=$O(^TMP($J,DATE,HR)) Q:HR="" D
.S DATA=^TMP($J,DATE,HR)
.S $P(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
.S $P(KMPDY(LN),U,2)=HR
.; ttl average
.S $P(KMPDY(LN),U,3)=$FN($P(DATA,U),",",0)
.; ttl minimum
.S $P(KMPDY(LN),U,4)=$FN($P(DATA,U,2),",",0)
.; ttl maximum
.S $P(KMPDY(LN),U,5)=$FN($P(DATA,U,3),",",0)
.; # of cv loads
.S $P(KMPDY(LN),U,6)=$FN($P(DATA,U,5),",",0)
.S LN=LN+1 Q
Q
;
RTTA ;- TMG - Real-Time Threshold Alert
S KMPDHOUR=$G(KMPDHOUR)
S KMPDTSEC=$G(KMPDTSEC)
I 'KMPDTSEC S KMPDY(0)="[Seconds data is missing]" Q
I $G(KMPDSRCH)="" S KMPDY(0)="[TTL Search data is missing]" Q
S KMPDSRCH(1)=$P(KMPDSRCH,U),KMPDSRCH(2)=$P(KMPDSRCH,U,2,3)
I 'KMPDSRCH(1) S KMPDY(0)="[TTL Search data invalid]" Q
I (KMPDSRCH(1)<4)&('KMPDSRCH(2)) S KMPDY(0)="[TTL Search data missing]" Q
; report data
D DATA^KMPDTP6
I '$D(^TMP($J)) S KMPDY(0)="<No Data to Report>" Q
S (DATE,LN)=0
F S DATE=$O(^TMP($J,DATE)) Q:'DATE S HR="" D
.F S HR=$O(^TMP($J,DATE,HR)) Q:HR="" D
..S DATA=^TMP($J,DATE,HR)
..; date
..S $P(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
..; hour
..S $P(KMPDY(LN),U,2)=HR
..; user name
..S $P(KMPDY(LN),U,3)=$P(DATA,U,5)
..; client name
..S $P(KMPDY(LN),U,4)=$P(DATA,U,6)
..; ip address
..S $P(KMPDY(LN),U,5)=$P(DATA,U,9)
..; time to load
..S $P(KMPDY(LN),U,6)=$P(DATA,U,4)
..S LN=LN+1
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HKMPDU7A 4736 printed Sep 02, 2024@18:26:27 Page 2
KMPDU7A ;OAK/RAK - CM Tools Routine Utilities ;7/22/04 09:06
+1 ;;3.0;KMPD;;Jan 22, 2009;Build 42
+2 ;
+3 NEW DATA,DATE,HR,I,LN
+4 ;
ADCL ;- TMG - Average Daily Coversheet Load
+1 ; report data
+2 NEW KMPDPTNP
+3 SET KMPDPTNP=$GET(KMPDTM)
+4 SET KMPDATE(0)=KMPDATE
+5 DO DATA^KMPDTP1(.KMPDATE,KMPDPTNP,"")
+6 IF '$DATA(^TMP($JOB))
SET KMPDY(0)="<No Data To Report>"
QUIT
+7 ;S KMPDY(0)=$$NOW^XLFDT_"^"_$$FMTE^XLFDT($$NOW^XLFDT)
+8 SET (DATE,LN)=0
+9 FOR
SET DATE=$ORDER(^TMP($JOB,DATE))
if 'DATE
QUIT
Begin DoDot:1
+10 SET DATA=^TMP($JOB,DATE)
SET LN=LN+1
+11 SET $PIECE(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
+12 SET $PIECE(KMPDY(LN),U,2)=$FNUMBER($PIECE(DATA,U),",",0)
+13 SET $PIECE(KMPDY(LN),U,3)=$FNUMBER($PIECE(DATA,U,2),",",0)
+14 SET $PIECE(KMPDY(LN),U,4)=$FNUMBER($PIECE(DATA,U,3),",",0)
+15 SET $PIECE(KMPDY(LN),U,5)=$FNUMBER($PIECE(DATA,U,4),",",0)
End DoDot:1
+16 QUIT
+17 ;
AHCR ;- TMG - Average Hourly Coversheet Load
+1 ; report data
+2 DO DATA^KMPDTP3
+3 IF '$DATA(^TMP($JOB))
SET KMPDY(0)="<No Data to Report>"
QUIT
+4 SET (DATE,LN)=0
+5 FOR
SET DATE=$ORDER(^TMP($JOB,DATE))
if 'DATE
QUIT
SET HR=0
Begin DoDot:1
+6 FOR
SET HR=$ORDER(^TMP($JOB,DATE,HR))
if 'HR
QUIT
Begin DoDot:2
+7 SET DATA=^TMP($JOB,DATE,HR)
SET LN=LN+1
+8 SET $PIECE(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
+9 SET $PIECE(KMPDY(LN),U,2)=$SELECT($LENGTH(HR)=1:"0",1:"")_HR
+10 SET $PIECE(KMPDY(LN),U,3)=$FNUMBER($PIECE(DATA,U),",",0)
+11 SET $PIECE(KMPDY(LN),U,4)=$FNUMBER($PIECE(DATA,U,2),",",0)
+12 SET $PIECE(KMPDY(LN),U,5)=$FNUMBER($PIECE(DATA,U,3),",",0)
+13 SET $PIECE(KMPDY(LN),U,6)=$FNUMBER($PIECE(DATA,U,4),",",0)
+14 SET $PIECE(KMPDY(LN),U,7)=$FNUMBER($PIECE(DATA,U,5),",",0)
End DoDot:2
End DoDot:1
+15 QUIT
+16 ;
CTTLAR ;- TMG - Coversheet TTL Alert Report
+1 IF $GET(KMPDSRCH)=""
SET KMPDY(0)="[TTL Search data is missing]"
QUIT
+2 IF '$GET(KMPDTSEC)
SET KMPDY(0)="[Threshold Seconds data is missing]"
QUIT
+3 ; report data
+4 DO DATA^KMPDTP5
+5 IF '$DATA(^TMP($JOB))
SET KMPDY(0)="<No Data to Report>"
QUIT
+6 SET (DATE,LN)=0
+7 FOR
SET DATE=$ORDER(^TMP($JOB,DATE))
if 'DATE
QUIT
SET HR=""
Begin DoDot:1
+8 FOR
SET HR=$ORDER(^TMP($JOB,DATE,HR))
if HR=""
QUIT
Begin DoDot:2
+9 SET DATA=^TMP($JOB,DATE,HR)
+10 SET $PIECE(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
+11 SET $PIECE(KMPDY(LN),U,2)=HR
+12 ; user name
+13 SET $PIECE(KMPDY(LN),U,3)=$PIECE(DATA,U,5)
+14 ; client name
+15 SET $PIECE(KMPDY(LN),U,4)=$PIECE(DATA,U,6)
+16 ; ip address
+17 SET $PIECE(KMPDY(LN),U,5)=$PIECE(DATA,U,9)
+18 ; time to load
+19 SET $PIECE(KMPDY(LN),U,6)=$FNUMBER($PIECE(DATA,U,4),",",0)
+20 SET LN=LN+1
End DoDot:2
End DoDot:1
+21 QUIT
+22 ;
DCTTLDR ;- TMG - Daily Coversheet TTL Detailed Report
+1 SET KMPDPTNP=KMPDTM
+2 ; report data
+3 DO DATA^KMPDTP2
+4 IF '$DATA(^TMP($JOB))
SET KMPDY(0)="<No Data to Report>"
QUIT
+5 SET (DATE,LN)=0
+6 FOR
SET DATE=$ORDER(^TMP($JOB,DATE))
if 'DATE
QUIT
Begin DoDot:1
+7 SET DATA=^TMP($JOB,DATE)
SET DATA(1)=$GET(^TMP($JOB,DATE,1))
+8 FOR I=1:1:10
Begin DoDot:2
+9 SET $PIECE(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
+10 IF I<10
SET $PIECE(KMPDY(LN),U,2)=$JUSTIFY(I-1*10,2)_" to "_(I*10)
+11 IF '$TEST
SET $PIECE(KMPDY(LN),U,2)="90 or greater"
+12 SET $PIECE(KMPDY(LN),U,3)=$FNUMBER($PIECE(DATA,U,I),",",0)
+13 SET $PIECE(KMPDY(LN),U,4)=$FNUMBER($PIECE(DATA(1),U,I),",",1)_"%"
+14 SET LN=LN+1
End DoDot:2
End DoDot:1
+15 QUIT
+16 ;
HCTTLDR ;-TMG - Hourly Coversheet TTL Detailed Report
+1 ; report data
+2 DO DATA^KMPDTP4
+3 IF '$DATA(^TMP($JOB))
SET KMPDY(0)="<No Data to Report>"
QUIT
+4 SET (DATE,LN)=0
+5 FOR
SET DATE=$ORDER(^TMP($JOB,DATE))
if 'DATE
QUIT
SET HR=0
Begin DoDot:1
+6 FOR
SET HR=$ORDER(^TMP($JOB,DATE,HR))
if 'HR
QUIT
Begin DoDot:2
+7 SET DATA=^TMP($JOB,DATE,HR)
SET DATA(1)=$GET(^(HR,1))
+8 FOR I=1:1:9
Begin DoDot:3
+9 SET $PIECE(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
+10 SET $PIECE(KMPDY(LN),U,2)=HR
+11 SET $PIECE(KMPDY(LN),U,3)=$JUSTIFY(I-1*10,2)_" to "_(I*10)
+12 SET $PIECE(KMPDY(LN),U,4)=$FNUMBER($PIECE(DATA,U,I),",",0)
+13 SET $PIECE(KMPDY(LN),U,5)=$FNUMBER($PIECE(DATA(1),U,I),",",1)
+14 SET LN=LN+1
End DoDot:3
End DoDot:2
End DoDot:1
+15 QUIT
+16 ;
RTAHCL ;- TMG - Real-Time Average Hourly Coversheet Load
+1 ; report data
+2 DO DATA^KMPDTP7
+3 IF '$DATA(^TMP($JOB))
SET KMPDY(0)="<No Data to Report>"
QUIT
+4 SET DATE=$ORDER(^TMP($JOB,0))
if 'DATE
QUIT
+5 SET HR=""
SET LN=0
+6 FOR
SET HR=$ORDER(^TMP($JOB,DATE,HR))
if HR=""
QUIT
Begin DoDot:1
+7 SET DATA=^TMP($JOB,DATE,HR)
+8 SET $PIECE(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
+9 SET $PIECE(KMPDY(LN),U,2)=HR
+10 ; ttl average
+11 SET $PIECE(KMPDY(LN),U,3)=$FNUMBER($PIECE(DATA,U),",",0)
+12 ; ttl minimum
+13 SET $PIECE(KMPDY(LN),U,4)=$FNUMBER($PIECE(DATA,U,2),",",0)
+14 ; ttl maximum
+15 SET $PIECE(KMPDY(LN),U,5)=$FNUMBER($PIECE(DATA,U,3),",",0)
+16 ; # of cv loads
+17 SET $PIECE(KMPDY(LN),U,6)=$FNUMBER($PIECE(DATA,U,5),",",0)
+18 SET LN=LN+1
QUIT
End DoDot:1
+19 QUIT
+20 ;
RTTA ;- TMG - Real-Time Threshold Alert
+1 SET KMPDHOUR=$GET(KMPDHOUR)
+2 SET KMPDTSEC=$GET(KMPDTSEC)
+3 IF 'KMPDTSEC
SET KMPDY(0)="[Seconds data is missing]"
QUIT
+4 IF $GET(KMPDSRCH)=""
SET KMPDY(0)="[TTL Search data is missing]"
QUIT
+5 SET KMPDSRCH(1)=$PIECE(KMPDSRCH,U)
SET KMPDSRCH(2)=$PIECE(KMPDSRCH,U,2,3)
+6 IF 'KMPDSRCH(1)
SET KMPDY(0)="[TTL Search data invalid]"
QUIT
+7 IF (KMPDSRCH(1)<4)&('KMPDSRCH(2))
SET KMPDY(0)="[TTL Search data missing]"
QUIT
+8 ; report data
+9 DO DATA^KMPDTP6
+10 IF '$DATA(^TMP($JOB))
SET KMPDY(0)="<No Data to Report>"
QUIT
+11 SET (DATE,LN)=0
+12 FOR
SET DATE=$ORDER(^TMP($JOB,DATE))
if 'DATE
QUIT
SET HR=""
Begin DoDot:1
+13 FOR
SET HR=$ORDER(^TMP($JOB,DATE,HR))
if HR=""
QUIT
Begin DoDot:2
+14 SET DATA=^TMP($JOB,DATE,HR)
+15 ; date
+16 SET $PIECE(KMPDY(LN),U)=$$FMTE^XLFDT(DATE)
+17 ; hour
+18 SET $PIECE(KMPDY(LN),U,2)=HR
+19 ; user name
+20 SET $PIECE(KMPDY(LN),U,3)=$PIECE(DATA,U,5)
+21 ; client name
+22 SET $PIECE(KMPDY(LN),U,4)=$PIECE(DATA,U,6)
+23 ; ip address
+24 SET $PIECE(KMPDY(LN),U,5)=$PIECE(DATA,U,9)
+25 ; time to load
+26 SET $PIECE(KMPDY(LN),U,6)=$PIECE(DATA,U,4)
+27 SET LN=LN+1
End DoDot:2
End DoDot:1
+28 ;
+29 QUIT