FSCFORMX ;SLC/STAFF-NOIS Format Statistic - Display ;8/25/94 09:06
;;1.1;NOIS;;Sep 06, 1998
;
STAT ; from FSCFORMS
K ^TMP("FSC STAT FORMAT",$J)
S SECTION=1,VTYPE=$S(TYPE["VIEW":"VVALUES",1:"EVALUES")
S (CNT,TOTAL)=0 F S CNT=$O(^TMP("FSC SELECT",$J,VTYPE,CNT)) Q:CNT<1 S TOTAL=TOTAL+1
I '$D(STYLE("COLLATE")) D
.S (CNT,LINE)=0 F S CNT=$O(STYLE(CNT)) Q:CNT<1 S ABBREV=$P(STYLE(CNT),U,7) I $L(ABBREV) D
..S NUMVALUE=$S($P(STYLE(CNT),U,3)="N":1,1:0)
..S LINE=LINE+1
..S COUNT=+$G(^TMP("FSC STATS",$J,ABBREV))
..S LINE=LINE+1,TEXT=$J($P(STYLE(CNT),U,2)_": ",14)_$J(+COUNT,5) ;_$J(COUNT/TOTAL*100\1_"%",8)
..I COUNT,NUMVALUE D
...S NUMTOT=0,NUM="" F S NUM=$O(^TMP("FSC STATS",$J,ABBREV,NUM)) Q:NUM="" S NUMTOT=NUMTOT+(NUM*^(NUM))
...S TEXT=TEXT_" Total: "_NUMTOT_" Ave: "_$J(NUMTOT/COUNT,0,1)
..D SETTEXT^FSCFORMY(SECTION,LINE,2,TEXT)
..S VALUE="" F S VALUE=$O(^TMP("FSC STATS",$J,ABBREV,VALUE)) Q:VALUE="" S NUM=+^(VALUE) D
...S LINE=LINE+1,TEXT=$J(NUM,5)_$J(NUM/TOTAL*100,8,0)_"% "_$S(NUMVALUE:$J(VALUE,5,1),1:VALUE)
...D SETTEXT^FSCFORMY(SECTION,LINE,16,TEXT)
I $D(STYLE("COLLATE")) D
.S COLLATE=STYLE(STYLE("COLLATE")),CABBREV=$P(COLLATE,U,7) I '$L(CABBREV) Q
.S CNUMVAL=$S($P(COLLATE,U,3)="N":1,1:0)
.S LINE=1
.S CCOUNT=+$G(^TMP("FSC STATS",$J,CABBREV))
.S LINE=LINE+1 D SETTEXT^FSCFORMY(SECTION,LINE,2,"Collated by "_$J($P(COLLATE,U,2)_": ",4)) D SETTEXT^FSCFORMY(SECTION,LINE,65,$J(+CCOUNT,5)_$J(+CCOUNT/TOTAL*100,8,0)_"%")
.I CCOUNT,CNUMVAL D
..S NUMTOT=0,NUM="" F S NUM=$O(^TMP("FSC STATS",$J,CABBREV,NUM)) Q:NUM="" S NUMTOT=NUMTOT+(NUM*^(NUM))
..S TEXT="Total: "_NUMTOT_" Ave: "_$J(NUMTOT/CCOUNT,0,1) D SETTEXT^FSCFORMY(SECTION,LINE,35,TEXT)
.S CVALUE="" F S CVALUE=$O(^TMP("FSC STATS",$J,CABBREV,CVALUE)) Q:CVALUE="" S CNUM=+^(CVALUE) D
..S LINE=LINE+1,TEXT="",$P(TEXT,"-",80)="" D SETTEXT^FSCFORMY(SECTION,LINE,1,TEXT)
..S LINE=LINE+1 D SETTEXT^FSCFORMY(SECTION,LINE,2,$S(CNUMVAL:$J(CVALUE,5,1),1:CVALUE)) D SETTEXT^FSCFORMY(SECTION,LINE,65,$J(CNUM,5)_$J(CNUM/TOTAL*100,8,0)_"%")
..S CNT=0 F S CNT=$O(STYLE(CNT)) Q:CNT<1 I STYLE("COLLATE")'=CNT S ABBREV=$P(STYLE(CNT),U,7) I $L(ABBREV) D
...S NUMVALUE=$S($P(STYLE(CNT),U,3)="N":1,1:0)
...S COUNT=+$G(^TMP("FSC STATS",$J,CABBREV,CVALUE,ABBREV))
...S LINE=LINE+1 D SETTEXT^FSCFORMY(SECTION,LINE,2,$J($P(STYLE(CNT),U,2)_":",18))
...S TEXT="("_+COUNT_")" D SETTEXT^FSCFORMY(SECTION,LINE,45,$J(TEXT,7))
...I COUNT,NUMVALUE D
....S NUMTOT=0,NUM="" F S NUM=$O(^TMP("FSC STATS",$J,CABBREV,CVALUE,ABBREV,NUM)) Q:NUM="" S NUMTOT=NUMTOT+(NUM*^(NUM))
....S TEXT="Total: "_NUMTOT_" Ave: "_$J(NUMTOT/COUNT,0,1) D SETTEXT^FSCFORMY(SECTION,LINE,53,TEXT)
...S VALUE="" F S VALUE=$O(^TMP("FSC STATS",$J,CABBREV,CVALUE,ABBREV,VALUE)) Q:VALUE="" S NUM=+^(VALUE) D
....S LINE=LINE+1 D SETTEXT^FSCFORMY(SECTION,LINE,20,$S(NUMVALUE:$J(VALUE,5,1),1:VALUE))
....S TEXT=$S(COUNT'=CNUM:"("_$J(NUM/COUNT*100,0,0)_"%)",1:"") D SETTEXT^FSCFORMY(SECTION,LINE,45,$J(TEXT,7)_$J(NUM/CNUM*100,8,0)_"%") D SETTEXT^FSCFORMY(SECTION,LINE,65,$J(NUM,5)_$J(NUM/TOTAL*100,8,0)_"%")
I TYPE["VIEW" D VIEW^FSCFORMY(LISTNUM,CALLNUM,STYLE,.LASTLINE,TYPE) Q
D SETUP^FSCFORMY(LISTNUM,CALLNUM,STYLE,.LASTLINE,TYPE)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCFORMX 3249 printed Nov 22, 2024@17:27:54 Page 2
FSCFORMX ;SLC/STAFF-NOIS Format Statistic - Display ;8/25/94 09:06
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
STAT ; from FSCFORMS
+1 KILL ^TMP("FSC STAT FORMAT",$JOB)
+2 SET SECTION=1
SET VTYPE=$SELECT(TYPE["VIEW":"VVALUES",1:"EVALUES")
+3 SET (CNT,TOTAL)=0
FOR
SET CNT=$ORDER(^TMP("FSC SELECT",$JOB,VTYPE,CNT))
if CNT<1
QUIT
SET TOTAL=TOTAL+1
+4 IF '$DATA(STYLE("COLLATE"))
Begin DoDot:1
+5 SET (CNT,LINE)=0
FOR
SET CNT=$ORDER(STYLE(CNT))
if CNT<1
QUIT
SET ABBREV=$PIECE(STYLE(CNT),U,7)
IF $LENGTH(ABBREV)
Begin DoDot:2
+6 SET NUMVALUE=$SELECT($PIECE(STYLE(CNT),U,3)="N":1,1:0)
+7 SET LINE=LINE+1
+8 SET COUNT=+$GET(^TMP("FSC STATS",$JOB,ABBREV))
+9 ;_$J(COUNT/TOTAL*100\1_"%",8)
SET LINE=LINE+1
SET TEXT=$JUSTIFY($PIECE(STYLE(CNT),U,2)_": ",14)_$JUSTIFY(+COUNT,5)
+10 IF COUNT
IF NUMVALUE
Begin DoDot:3
+11 SET NUMTOT=0
SET NUM=""
FOR
SET NUM=$ORDER(^TMP("FSC STATS",$JOB,ABBREV,NUM))
if NUM=""
QUIT
SET NUMTOT=NUMTOT+(NUM*^(NUM))
+12 SET TEXT=TEXT_" Total: "_NUMTOT_" Ave: "_$JUSTIFY(NUMTOT/COUNT,0,1)
End DoDot:3
+13 DO SETTEXT^FSCFORMY(SECTION,LINE,2,TEXT)
+14 SET VALUE=""
FOR
SET VALUE=$ORDER(^TMP("FSC STATS",$JOB,ABBREV,VALUE))
if VALUE=""
QUIT
SET NUM=+^(VALUE)
Begin DoDot:3
+15 SET LINE=LINE+1
SET TEXT=$JUSTIFY(NUM,5)_$JUSTIFY(NUM/TOTAL*100,8,0)_"% "_$SELECT(NUMVALUE:$JUSTIFY(VALUE,5,1),1:VALUE)
+16 DO SETTEXT^FSCFORMY(SECTION,LINE,16,TEXT)
End DoDot:3
End DoDot:2
End DoDot:1
+17 IF $DATA(STYLE("COLLATE"))
Begin DoDot:1
+18 SET COLLATE=STYLE(STYLE("COLLATE"))
SET CABBREV=$PIECE(COLLATE,U,7)
IF '$LENGTH(CABBREV)
QUIT
+19 SET CNUMVAL=$SELECT($PIECE(COLLATE,U,3)="N":1,1:0)
+20 SET LINE=1
+21 SET CCOUNT=+$GET(^TMP("FSC STATS",$JOB,CABBREV))
+22 SET LINE=LINE+1
DO SETTEXT^FSCFORMY(SECTION,LINE,2,"Collated by "_$JUSTIFY($PIECE(COLLATE,U,2)_": ",4))
DO SETTEXT^FSCFORMY(SECTION,LINE,65,$JUSTIFY(+CCOUNT,5)_$JUSTIFY(+CCOUNT/TOTAL*100,8,0)_"%")
+23 IF CCOUNT
IF CNUMVAL
Begin DoDot:2
+24 SET NUMTOT=0
SET NUM=""
FOR
SET NUM=$ORDER(^TMP("FSC STATS",$JOB,CABBREV,NUM))
if NUM=""
QUIT
SET NUMTOT=NUMTOT+(NUM*^(NUM))
+25 SET TEXT="Total: "_NUMTOT_" Ave: "_$JUSTIFY(NUMTOT/CCOUNT,0,1)
DO SETTEXT^FSCFORMY(SECTION,LINE,35,TEXT)
End DoDot:2
+26 SET CVALUE=""
FOR
SET CVALUE=$ORDER(^TMP("FSC STATS",$JOB,CABBREV,CVALUE))
if CVALUE=""
QUIT
SET CNUM=+^(CVALUE)
Begin DoDot:2
+27 SET LINE=LINE+1
SET TEXT=""
SET $PIECE(TEXT,"-",80)=""
DO SETTEXT^FSCFORMY(SECTION,LINE,1,TEXT)
+28 SET LINE=LINE+1
DO SETTEXT^FSCFORMY(SECTION,LINE,2,$SELECT(CNUMVAL:$JUSTIFY(CVALUE,5,1),1:CVALUE))
DO SETTEXT^FSCFORMY(SECTION,LINE,65,$JUSTIFY(CNUM,5)_$JUSTIFY(CNUM/TOTAL*100,8,0)_"%")
+29 SET CNT=0
FOR
SET CNT=$ORDER(STYLE(CNT))
if CNT<1
QUIT
IF STYLE("COLLATE")'=CNT
SET ABBREV=$PIECE(STYLE(CNT),U,7)
IF $LENGTH(ABBREV)
Begin DoDot:3
+30 SET NUMVALUE=$SELECT($PIECE(STYLE(CNT),U,3)="N":1,1:0)
+31 SET COUNT=+$GET(^TMP("FSC STATS",$JOB,CABBREV,CVALUE,ABBREV))
+32 SET LINE=LINE+1
DO SETTEXT^FSCFORMY(SECTION,LINE,2,$JUSTIFY($PIECE(STYLE(CNT),U,2)_":",18))
+33 SET TEXT="("_+COUNT_")"
DO SETTEXT^FSCFORMY(SECTION,LINE,45,$JUSTIFY(TEXT,7))
+34 IF COUNT
IF NUMVALUE
Begin DoDot:4
+35 SET NUMTOT=0
SET NUM=""
FOR
SET NUM=$ORDER(^TMP("FSC STATS",$JOB,CABBREV,CVALUE,ABBREV,NUM))
if NUM=""
QUIT
SET NUMTOT=NUMTOT+(NUM*^(NUM))
+36 SET TEXT="Total: "_NUMTOT_" Ave: "_$JUSTIFY(NUMTOT/COUNT,0,1)
DO SETTEXT^FSCFORMY(SECTION,LINE,53,TEXT)
End DoDot:4
+37 SET VALUE=""
FOR
SET VALUE=$ORDER(^TMP("FSC STATS",$JOB,CABBREV,CVALUE,ABBREV,VALUE))
if VALUE=""
QUIT
SET NUM=+^(VALUE)
Begin DoDot:4
+38 SET LINE=LINE+1
DO SETTEXT^FSCFORMY(SECTION,LINE,20,$SELECT(NUMVALUE:$JUSTIFY(VALUE,5,1),1:VALUE))
+39 SET TEXT=$SELECT(COUNT'=CNUM:"("_$JUSTIFY(NUM/COUNT*100,0,0)_"%)",1:"")
DO SETTEXT^FSCFORMY(SECTION,LINE,45,$JUSTIFY(TEXT,7)_$JUSTIFY(NUM/CNUM*100,8,0)_"%")
DO SETTEXT^FSCFORMY(SECTION,LINE,65,$JUSTIFY(NUM,5)_$JUSTIFY(NUM/TOTAL*100,8,0)_"%")
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+40 IF TYPE["VIEW"
DO VIEW^FSCFORMY(LISTNUM,CALLNUM,STYLE,.LASTLINE,TYPE)
QUIT
+41 DO SETUP^FSCFORMY(LISTNUM,CALLNUM,STYLE,.LASTLINE,TYPE)
+42 QUIT