GMRCSTL1 ;SLC/DCM,dee;MA - List Manager Format Routine - Get Active Consults by service - pending,active,scheduled,incomplete,etc. ;11/13/02 08:30
;;3.0;CONSULT/REQUEST TRACKING;**7,21,22,29,63**;DEC 27, 1997;Build 10
; Patch #21 changed array GMRCTOT to ^TMP("GMRCTOT,$J)
; This routine invokes IA #875, #2638
Q
STATNAME(STATUS) ;Return the name for the status number
I STATUS<9 Q $S(STATUS=1:"Discont.",STATUS=2:"Completed",STATUS=3:"On Hold",STATUS=4:"Flagged",STATUS=5:"Pending",STATUS=6:"Active",STATUS=7:"Expired",STATUS=8:"Scheduled",1:"No Status")
E Q $S(STATUS=9:"Incomplete",STATUS=10:"Delayed",STATUS=11:"Unreleased",STATUS=12:"Discont/Ed",STATUS=13:"Cancelled",STATUS=14:"Lapsed",STATUS=15:"Renewed",1:"No Status")
Q
;
STATABBR(STATUS) ;Return the name for the status number
Q ^ORD(100.01,STATUS,.1)
;
LISTTOT(COUNT,GEN,INDEX,NAME,GROUPNAM,CONTROL,ARRN) ;
N LOOP,STATUS,STS,CTRLTEMP,GMRCTOTS,SP
S SP=""
S CTRLTEMP=$S(CONTROL#2:"^",1:"")
I GEN=2 D
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP
. S COUNT=COUNT+1
. S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_" GROUPER: "_NAME_" Totals:"
S GMRCTOTS=0
I $L(GMRCSTAT,",")=16 S GMRCTOTS=1 ;only incl. totals if all status
F LOOP=1:1:$L(GMRCSTAT,",") S STATUS=$P(GMRCSTAT,",",LOOP) I ^TMP("GMRCTOT",$J,GEN,INDEX,STATUS)>0 D
.S COUNT=COUNT+1
.S STS=$$STATNAME(STATUS)
.S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests "_STS_": "_$J(^TMP("GMRCTOT",$J,GEN,INDEX,STATUS),42-$L(STS),0)
;If any printed are pending then print the total that are pending for all pending status.
I ^TMP("GMRCTOT",$J,GEN,INDEX,"P")>0 D
.S COUNT=COUNT+1
.S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests Pending Resolution: "_$J(^TMP("GMRCTOT",$J,GEN,INDEX,"P"),24,0)
; IF Consults
I ARRN="IFC" D
.N IRFN,VALSVC,VALTOT S IRFN=""
.F S IRFN=$O(^TMP("GMRCTOT",$J,GEN,INDEX,"F",IRFN)) Q:IRFN="" D
..I GMRCTOTS D
...S COUNT=COUNT+1
...I GEN=1 S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests To Service @ "_$E(IRFN,1,16)_": "_$J(SP,16-$L($E(IRFN,1,16)))_$J(^TMP("GMRCTOT",$J,1,INDEX,"F",IRFN),13,0)
...E S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests to Grouper @ "_$E(IRFN,1,20)_": "_$J(SP,20-$L($E(IRFN,1,20)))_$J(^TMP("GMRCTOT",$J,2,INDEX,"F",IRFN),9,0)
..I $P($G(GMRCST(GEN,INDEX,IRFN)),"^",2)>0 D
...S COUNT=COUNT+1
...S VALSVC=$P(GMRCST(GEN,INDEX,IRFN),"^")\$P(GMRCST(GEN,INDEX,IRFN),"^",2)
...S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Mean Days Completed To "_$S(GEN=1:"Service ",1:"Grouper ")_"@ "_$E(IRFN,1,16)_": "_$J(SP,16-$L($E(IRFN,1,16)))_$J(VALSVC,8,0)
.I $P($G(GMRCST(GEN,INDEX)),"^",2)>0 D
..S COUNT=COUNT+1
..S VALTOT=$P(GMRCST(GEN,INDEX),"^")\$P(GMRCST(GEN,INDEX),"^",2)
..S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Mean Days Completed To "_$S(GEN=1:"Service",1:"Grouper")_": "_$J(VALTOT,27,0)
I GMRCTOTS D
.S COUNT=COUNT+1
.I GEN=1 S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests To Service: "_$J(^TMP("GMRCTOT",$J,1,INDEX,"T"),32,0)
.E S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests To Grouper: "_$J(^TMP("GMRCTOT",$J,2,INDEX,"T"),32,0)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRCSTL1 3168 printed Oct 16, 2024@17:48:11 Page 2
GMRCSTL1 ;SLC/DCM,dee;MA - List Manager Format Routine - Get Active Consults by service - pending,active,scheduled,incomplete,etc. ;11/13/02 08:30
+1 ;;3.0;CONSULT/REQUEST TRACKING;**7,21,22,29,63**;DEC 27, 1997;Build 10
+2 ; Patch #21 changed array GMRCTOT to ^TMP("GMRCTOT,$J)
+3 ; This routine invokes IA #875, #2638
+4 QUIT
STATNAME(STATUS) ;Return the name for the status number
+1 IF STATUS<9
QUIT $SELECT(STATUS=1:"Discont.",STATUS=2:"Completed",STATUS=3:"On Hold",STATUS=4:"Flagged",STATUS=5:"Pending",STATUS=6:"Active",STATUS=7:"Expired",STATUS=8:"Scheduled",1:"No Status")
+2 IF '$TEST
QUIT $SELECT(STATUS=9:"Incomplete",STATUS=10:"Delayed",STATUS=11:"Unreleased",STATUS=12:"Discont/Ed",STATUS=13:"Cancelled",STATUS=14:"Lapsed",STATUS=15:"Renewed",1:"No Status")
+3 QUIT
+4 ;
STATABBR(STATUS) ;Return the name for the status number
+1 QUIT ^ORD(100.01,STATUS,.1)
+2 ;
LISTTOT(COUNT,GEN,INDEX,NAME,GROUPNAM,CONTROL,ARRN) ;
+1 NEW LOOP,STATUS,STS,CTRLTEMP,GMRCTOTS,SP
+2 SET SP=""
+3 SET CTRLTEMP=$SELECT(CONTROL#2:"^",1:"")
+4 IF GEN=2
Begin DoDot:1
+5 SET COUNT=COUNT+1
+6 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=CTRLTEMP
+7 SET COUNT=COUNT+1
+8 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=CTRLTEMP_" GROUPER: "_NAME_" Totals:"
End DoDot:1
+9 SET GMRCTOTS=0
+10 ;only incl. totals if all status
IF $LENGTH(GMRCSTAT,",")=16
SET GMRCTOTS=1
+11 FOR LOOP=1:1:$LENGTH(GMRCSTAT,",")
SET STATUS=$PIECE(GMRCSTAT,",",LOOP)
IF ^TMP("GMRCTOT",$JOB,GEN,INDEX,STATUS)>0
Begin DoDot:1
+12 SET COUNT=COUNT+1
+13 SET STS=$$STATNAME(STATUS)
+14 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=CTRLTEMP_"Total Requests "_STS_": "_$JUSTIFY(^TMP("GMRCTOT",$JOB,GEN,INDEX,STATUS),42-$LENGTH(STS),0)
End DoDot:1
+15 ;If any printed are pending then print the total that are pending for all pending status.
+16 IF ^TMP("GMRCTOT",$JOB,GEN,INDEX,"P")>0
Begin DoDot:1
+17 SET COUNT=COUNT+1
+18 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=CTRLTEMP_"Total Requests Pending Resolution: "_$JUSTIFY(^TMP("GMRCTOT",$JOB,GEN,INDEX,"P"),24,0)
End DoDot:1
+19 ; IF Consults
+20 IF ARRN="IFC"
Begin DoDot:1
+21 NEW IRFN,VALSVC,VALTOT
SET IRFN=""
+22 FOR
SET IRFN=$ORDER(^TMP("GMRCTOT",$JOB,GEN,INDEX,"F",IRFN))
if IRFN=""
QUIT
Begin DoDot:2
+23 IF GMRCTOTS
Begin DoDot:3
+24 SET COUNT=COUNT+1
+25 IF GEN=1
SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=CTRLTEMP_"Total Requests To Service @ "_$EXTRACT(IRFN,1,16)_": "_$JUSTIFY(SP,16-$LENGTH($EXTRACT(IRFN,1,16)))_$JUSTIFY(^TMP("GMRCTOT",$JOB,1,INDEX,"F",IRFN),13,0)
+26 IF '$TEST
SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=CTRLTEMP_"Total Requests to Grouper @ "_$EXTRACT(IRFN,1,20)_": "_$JUSTIFY(SP,20-$LENGTH($EXTRACT(IRFN,1,20)))_$JUSTIFY(^TMP("GMRCTOT",$JOB,2,INDEX,"F",IRFN),9,0)
End DoDot:3
+27 IF $PIECE($GET(GMRCST(GEN,INDEX,IRFN)),"^",2)>0
Begin DoDot:3
+28 SET COUNT=COUNT+1
+29 SET VALSVC=$PIECE(GMRCST(GEN,INDEX,IRFN),"^")\$PIECE(GMRCST(GEN,INDEX,IRFN),"^",2)
+30 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=CTRLTEMP_"Mean Days Completed To "_$SELECT(GEN=1:"Service ",1:"Grouper ")_"@ "_$EXTRACT(IRFN,1,16)_": "_$JUSTIFY(SP,16-$LENGTH($EXTRACT(IRFN,1,16)))_$JUSTIFY(VALSVC,8,0)
End DoDot:3
End DoDot:2
+31 IF $PIECE($GET(GMRCST(GEN,INDEX)),"^",2)>0
Begin DoDot:2
+32 SET COUNT=COUNT+1
+33 SET VALTOT=$PIECE(GMRCST(GEN,INDEX),"^")\$PIECE(GMRCST(GEN,INDEX),"^",2)
+34 SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=CTRLTEMP_"Mean Days Completed To "_$SELECT(GEN=1:"Service",1:"Grouper")_": "_$JUSTIFY(VALTOT,27,0)
End DoDot:2
End DoDot:1
+35 IF GMRCTOTS
Begin DoDot:1
+36 SET COUNT=COUNT+1
+37 IF GEN=1
SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=CTRLTEMP_"Total Requests To Service: "_$JUSTIFY(^TMP("GMRCTOT",$JOB,1,INDEX,"T"),32,0)
+38 IF '$TEST
SET ^TMP("GMRCR",$JOB,ARRN,COUNT,0)=CTRLTEMP_"Total Requests To Grouper: "_$JUSTIFY(^TMP("GMRCTOT",$JOB,2,INDEX,"T"),32,0)
End DoDot:1
+39 QUIT
+40 ;