GMRCSTLB ;SLC/JFR,WAT - Totals format for LOCAL CSLT COMPL RATE ;
;;3.0;CONSULT/REQUEST TRACKING;**67**;DEC 27, 1997;Build 1
;;
;875 (file 100.01), 2638 (file 100.01), 3744 (VADPT)
; portions copied from GMRCSTL1 & GMRCSTL2
;
Q ; can't start here
;
PRTTOT(GEN,INDEX,NAME,ARRN) ; totals for printed report
N COUNT,SVCUSG
S COUNT=$O(^TMP("GMRCR",$J,ARRN," "),-1)
I GEN=2 D
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)=""
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)=" GROUPER: "_NAME_" Totals:"
I GEN=1 D
. I ^TMP("GMRCTOT",$J,1,INDEX,"T")=0 D Q ;collect zero servs for summ
.. Q:$P(^GMR(123.5,INDEX,0),U,2)=1
.. S ^TMP("GMRCTOT",$J,0,NAME)=""
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)=" "
. S COUNT=COUNT+1
. S SVCUSG=$P(^GMR(123.5,INDEX,0),U,2),^TMP("GMRCR",$J,ARRN,COUNT,0)="SERVICE: "_NAME_$S($G(SVCUSG)=9:" <disabled>",1:"")
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests To Service:"_$J(^TMP("GMRCTOT",$J,1,INDEX,"T"),30,0)
I GEN=2,^TMP("GMRCTOT",$J,2,INDEX,"T")>0 D
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests To Grouper:"_$J(^TMP("GMRCTOT",$J,2,INDEX,"T"),30,0)
I $G(^TMP("GMRCTOT",$J,GEN,INDEX,"T"))>0 D
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests Pending Resolution: "_$J(^TMP("GMRCTOT",$J,GEN,INDEX,"P"),21,0)
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests Completed: "_$J(^TMP("GMRCTOT",$J,GEN,INDEX,"C"),30,0)
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests Completed with Results: "_$J(^TMP("GMRCTOT",$J,GEN,INDEX,"R"),17,0)
. N GMRCPCT
. I ^TMP("GMRCTOT",$J,GEN,INDEX,"T")=0 S GMRCPCT="N/A"
. I '$D(GMRCPCT) S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"C")/^TMP("GMRCTOT",$J,GEN,INDEX,"T"))*100
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Percentage of Total Requests Completed: "_$S(+GMRCPCT'=GMRCPCT:$J(GMRCPCT,16),1:($J(GMRCPCT,19,2)_"%"))
. K GMRCPCT
. I ^TMP("GMRCTOT",$J,GEN,INDEX,"C")=0 S GMRCPCT="N/A"
. I '$D(GMRCPCT) S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"R")/^TMP("GMRCTOT",$J,GEN,INDEX,"C"))*100
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Percentage of Total Completed Requests with Results: "_$S(+GMRCPCT'=GMRCPCT:GMRCPCT,1:($J(GMRCPCT,6,2)_"%"))
Q
;
DELTOT(GEN,INDEX,NAME,ARRN) ; format for delimited
;
I ^TMP("GMRCTOT",$J,GEN,INDEX,"T")=0 Q
N STRING,COUNT,SVCUSG
S COUNT=$O(^TMP("GMRCR",$J,ARRN," "),-1)
S SVCUSG=$P(^GMR(123.5,INDEX,0),U,2),STRING=$S(GEN=2:"GROUPER: ",1:"")_NAME_$S($G(SVCUSG)=9:" <disabled>",1:"")_";"
S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"T")_";"
S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"P")_";"
S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"C")_";"
S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"R")_";"
D ;get % completed
. N GMRCPCT
. S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"C")/^TMP("GMRCTOT",$J,GEN,INDEX,"T"))*100
. S STRING=STRING_$J(GMRCPCT,0,2)_";"
. Q
D ; get % completed w/results
. I ^TMP("GMRCTOT",$J,GEN,INDEX,"C")=0 S STRING=STRING_"N/A;" Q
. N GMRCPCT
. S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"R")/^TMP("GMRCTOT",$J,GEN,INDEX,"C"))*100
. S STRING=STRING_$J(GMRCPCT,0,2)
. Q
S COUNT=COUNT+1
S ^TMP("GMRCR",$J,ARRN,COUNT,0)=STRING
Q
;
ONESTAT(ARRN,SVCN,STAT,DT1,DT2) ;Process one status
; Input -- ARRN "CP" - to be printed
; "DEL" - in delimited format
; SVCN = node in ^TMP("GMRCLIST,$J
; STAT = status being worked on
; DT1 = starting date
; DT2 = ending date
;
; Output - None
;
N GMRCPT,GMRCXDT,TEMP,GMRCSVC,GMRCSVCG,GMRCSVCP
S GMRCSVC=$P(^TMP("GMRCSLIST",$J,SVCN),"^",1)
S GMRCSVCP=$P(^TMP("GMRCSLIST",$J,SVCN),"^",2)
S GMRCSVCG=$P(^TMP("GMRCSLIST",$J,SVCN),"^",3)
S GMRCXDT=$S(DT1="ALL":0,1:9999999-DT2-.6)
F S GMRCXDT=$O(^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT)) Q:GMRCXDT=""!(GMRCXDT>(9999999-DT1)) D
.S GMRCPT=0
.;Loop for one consult at a time
.F S GMRCPT=$O(^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT,GMRCPT)) Q:GMRCPT="" D
.. N PROS
..; Check for bad "AE" x-ref
..I '$D(^GMR(123,GMRCPT,0)) D Q
...K ^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT,GMRCPT)
.. I $$TESTPAT^VADPT(+$P(^GMR(123,GMRCPT,0),U,2)) Q ; exclude test pats
.. D I $G(PROS) Q
... N SVC S SVC=$P(^GMR(123,GMRCPT,0),U,5)
... I +$G(^GMR(123.5,SVC,"INT")) S PROS=1 ; exclude PROS consults
.. I $P($G(^GMR(123,GMRCPT,12)),U,5)="P" Q ; exclude IFC placer
..; Add to totals
..; for all status for this service
..S ^TMP("GMRCTOT",$J,1,GMRCSVC,"T")=^TMP("GMRCTOT",$J,1,GMRCSVC,"T")+1
..; pending for this service
..S:",3,4,5,6,8,9,11,99,"[(","_STAT_",") ^TMP("GMRCTOT",$J,1,GMRCSVC,"P")=^TMP("GMRCTOT",$J,1,GMRCSVC,"P")+1
.. I STAT=2 D
... S ^TMP("GMRCTOT",$J,1,GMRCSVC,"C")=+$G(^TMP("GMRCTOT",$J,1,GMRCSVC,"C"))+1
... Q:'$O(^GMR(123,+$G(GMRCPT),50,0)) ; Q if no results
... S ^TMP("GMRCTOT",$J,1,GMRCSVC,"R")=+$G(^TMP("GMRCTOT",$J,1,GMRCSVC,"R"))+1
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRCSTLB 4957 printed Oct 16, 2024@17:48:15 Page 2
GMRCSTLB ;SLC/JFR,WAT - Totals format for LOCAL CSLT COMPL RATE ;
+1 ;;3.0;CONSULT/REQUEST TRACKING;**67**;DEC 27, 1997;Build 1
+2 ;;
+3 ;875 (file 100.01), 2638 (file 100.01), 3744 (VADPT)
+4 ; portions copied from GMRCSTL1 & GMRCSTL2
+5 ;
+6 ; can't start here
QUIT
+7 ;
PRTTOT(GEN,INDEX,NAME,ARRN) ; totals for printed report
+1 NEW COUNT,SVCUSG
+2 SET COUNT=$ORDER(^TMP("GMRCR",$JOB,ARRN," "),-1)
+3 IF GEN=2
Begin DoDot:1
+4 SET COUNT=COUNT+1
+5 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=""
+6 SET COUNT=COUNT+1
+7 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=" GROUPER: "_NAME_" Totals:"
End DoDot:1
+8 IF GEN=1
Begin DoDot:1
+9 ;collect zero servs for summ
IF ^TMP("GMRCTOT",$JOB,1,INDEX,"T")=0
Begin DoDot:2
+10 if $PIECE(^GMR(123.5,INDEX,0),U,2)=1
QUIT
+11 SET ^TMP("GMRCTOT",$JOB,0,NAME)=""
End DoDot:2
QUIT
+12 SET COUNT=COUNT+1
+13 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=" "
+14 SET COUNT=COUNT+1
+15 SET SVCUSG=$PIECE(^GMR(123.5,INDEX,0),U,2)
SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)="SERVICE: "_NAME_$SELECT($GET(SVCUSG)=9:" <disabled>",1:"")
+16 SET COUNT=COUNT+1
+17 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)="Total Requests To Service:"_$JUSTIFY(^TMP("GMRCTOT",$JOB,1,INDEX,"T"),30,0)
End DoDot:1
+18 IF GEN=2
IF ^TMP("GMRCTOT",$JOB,2,INDEX,"T")>0
Begin DoDot:1
+19 SET COUNT=COUNT+1
+20 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)="Total Requests To Grouper:"_$JUSTIFY(^TMP("GMRCTOT",$JOB,2,INDEX,"T"),30,0)
End DoDot:1
+21 IF $GET(^TMP("GMRCTOT",$JOB,GEN,INDEX,"T"))>0
Begin DoDot:1
+22 SET COUNT=COUNT+1
+23 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)="Total Requests Pending Resolution: "_$JUSTIFY(^TMP("GMRCTOT",$JOB,GEN,INDEX,"P"),21,0)
+24 SET COUNT=COUNT+1
+25 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)="Total Requests Completed: "_$JUSTIFY(^TMP("GMRCTOT",$JOB,GEN,INDEX,"C"),30,0)
+26 SET COUNT=COUNT+1
+27 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)="Total Requests Completed with Results: "_$JUSTIFY(^TMP("GMRCTOT",$JOB,GEN,INDEX,"R"),17,0)
+28 NEW GMRCPCT
+29 IF ^TMP("GMRCTOT",$JOB,GEN,INDEX,"T")=0
SET GMRCPCT="N/A"
+30 IF '$DATA(GMRCPCT)
SET GMRCPCT=(^TMP("GMRCTOT",$JOB,GEN,INDEX,"C")/^TMP("GMRCTOT",$JOB,GEN,INDEX,"T"))*100
+31 SET COUNT=COUNT+1
+32 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)="Percentage of Total Requests Completed: "_$SELECT(+GMRCPCT'=GMRCPCT:$JUSTIFY(GMRCPCT,16),1:($JUSTIFY(GMRCPCT,19,2)_"%"))
+33 KILL GMRCPCT
+34 IF ^TMP("GMRCTOT",$JOB,GEN,INDEX,"C")=0
SET GMRCPCT="N/A"
+35 IF '$DATA(GMRCPCT)
SET GMRCPCT=(^TMP("GMRCTOT",$JOB,GEN,INDEX,"R")/^TMP("GMRCTOT",$JOB,GEN,INDEX,"C"))*100
+36 SET COUNT=COUNT+1
+37 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)="Percentage of Total Completed Requests with Results: "_$SELECT(+GMRCPCT'=GMRCPCT:GMRCPCT,1:($JUSTIFY(GMRCPCT,6,2)_"%"))
End DoDot:1
+38 QUIT
+39 ;
DELTOT(GEN,INDEX,NAME,ARRN) ; format for delimited
+1 ;
+2 IF ^TMP("GMRCTOT",$JOB,GEN,INDEX,"T")=0
QUIT
+3 NEW STRING,COUNT,SVCUSG
+4 SET COUNT=$ORDER(^TMP("GMRCR",$JOB,ARRN," "),-1)
+5 SET SVCUSG=$PIECE(^GMR(123.5,INDEX,0),U,2)
SET STRING=$SELECT(GEN=2:"GROUPER: ",1:"")_NAME_$SELECT($GET(SVCUSG)=9:" <disabled>",1:"")_";"
+6 SET STRING=STRING_^TMP("GMRCTOT",$JOB,GEN,INDEX,"T")_";"
+7 SET STRING=STRING_^TMP("GMRCTOT",$JOB,GEN,INDEX,"P")_";"
+8 SET STRING=STRING_^TMP("GMRCTOT",$JOB,GEN,INDEX,"C")_";"
+9 SET STRING=STRING_^TMP("GMRCTOT",$JOB,GEN,INDEX,"R")_";"
+10 ;get % completed
Begin DoDot:1
+11 NEW GMRCPCT
+12 SET GMRCPCT=(^TMP("GMRCTOT",$JOB,GEN,INDEX,"C")/^TMP("GMRCTOT",$JOB,GEN,INDEX,"T"))*100
+13 SET STRING=STRING_$JUSTIFY(GMRCPCT,0,2)_";"
+14 QUIT
End DoDot:1
+15 ; get % completed w/results
Begin DoDot:1
+16 IF ^TMP("GMRCTOT",$JOB,GEN,INDEX,"C")=0
SET STRING=STRING_"N/A;"
QUIT
+17 NEW GMRCPCT
+18 SET GMRCPCT=(^TMP("GMRCTOT",$JOB,GEN,INDEX,"R")/^TMP("GMRCTOT",$JOB,GEN,INDEX,"C"))*100
+19 SET STRING=STRING_$JUSTIFY(GMRCPCT,0,2)
+20 QUIT
End DoDot:1
+21 SET COUNT=COUNT+1
+22 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=STRING
+23 QUIT
+24 ;
ONESTAT(ARRN,SVCN,STAT,DT1,DT2) ;Process one status
+1 ; Input -- ARRN "CP" - to be printed
+2 ; "DEL" - in delimited format
+3 ; SVCN = node in ^TMP("GMRCLIST,$J
+4 ; STAT = status being worked on
+5 ; DT1 = starting date
+6 ; DT2 = ending date
+7 ;
+8 ; Output - None
+9 ;
+10 NEW GMRCPT,GMRCXDT,TEMP,GMRCSVC,GMRCSVCG,GMRCSVCP
+11 SET GMRCSVC=$PIECE(^TMP("GMRCSLIST",$JOB,SVCN),"^",1)
+12 SET GMRCSVCP=$PIECE(^TMP("GMRCSLIST",$JOB,SVCN),"^",2)
+13 SET GMRCSVCG=$PIECE(^TMP("GMRCSLIST",$JOB,SVCN),"^",3)
+14 SET GMRCXDT=$SELECT(DT1="ALL":0,1:9999999-DT2-.6)
+15 FOR
SET GMRCXDT=$ORDER(^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT))
if GMRCXDT=""!(GMRCXDT>(9999999-DT1))
QUIT
Begin DoDot:1
+16 SET GMRCPT=0
+17 ;Loop for one consult at a time
+18 FOR
SET GMRCPT=$ORDER(^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT,GMRCPT))
if GMRCPT=""
QUIT
Begin DoDot:2
+19 NEW PROS
+20 ; Check for bad "AE" x-ref
+21 IF '$DATA(^GMR(123,GMRCPT,0))
Begin DoDot:3
+22 KILL ^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT,GMRCPT)
End DoDot:3
QUIT
+23 ; exclude test pats
IF $$TESTPAT^VADPT(+$PIECE(^GMR(123,GMRCPT,0),U,2))
QUIT
+24 Begin DoDot:3
+25 NEW SVC
SET SVC=$PIECE(^GMR(123,GMRCPT,0),U,5)
+26 ; exclude PROS consults
IF +$GET(^GMR(123.5,SVC,"INT"))
SET PROS=1
End DoDot:3
IF $GET(PROS)
QUIT
+27 ; exclude IFC placer
IF $PIECE($GET(^GMR(123,GMRCPT,12)),U,5)="P"
QUIT
+28 ; Add to totals
+29 ; for all status for this service
+30 SET ^TMP("GMRCTOT",$JOB,1,GMRCSVC,"T")=^TMP("GMRCTOT",$JOB,1,GMRCSVC,"T")+1
+31 ; pending for this service
+32 if ",3,4,5,6,8,9,11,99,"[(","_STAT_",")
SET ^TMP("GMRCTOT",$JOB,1,GMRCSVC,"P")=^TMP("GMRCTOT",$JOB,1,GMRCSVC,"P")+1
+33 IF STAT=2
Begin DoDot:3
+34 SET ^TMP("GMRCTOT",$JOB,1,GMRCSVC,"C")=+$GET(^TMP("GMRCTOT",$JOB,1,GMRCSVC,"C"))+1
+35 ; Q if no results
if '$ORDER(^GMR(123,+$GET(GMRCPT),50,0))
QUIT
+36 SET ^TMP("GMRCTOT",$JOB,1,GMRCSVC,"R")=+$GET(^TMP("GMRCTOT",$JOB,1,GMRCSVC,"R"))+1
End DoDot:3
End DoDot:2
End DoDot:1
+37 QUIT
+38 ;