DGODUTL ;ALB/EG - INITIALIZE ARRAYS FOR DGODNP1/DGODOP1 & TOTAL ; JAN-13-1989 @ 0854
;;5.3;Registration;**1015**;Aug 13, 1993;Build 21
;;V 4.5
G0 ;initializes array
S A1=0 F I=1:1 S A1=$O(^DG(40.8,A1)) Q:(A1="")!(A1'?.N) S A(I)=^DG(40.8,A1,0),A2=I,DGDV=$E($P(A(I),U,2)_" ",1,5) S ^UTILITY("DGOD",$J,"AO",I)=A(I) F K1=1:1:DGTN D G1
Q
;
G1 ;zero each cell
S ^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGDV)=0 F DGV="N","V" F DGMT="AN","AS","B","C","N","U","X" F DGEL="*",0:1:8 S ^UTILITY("DGOD",$J,DGJB,K1,DGDV,DGV,DGMT,DGEL)=0
;zero row subtotal
F DGV="N","V" F DGEL="*",0:1:8 S ^UTILITY("DGOD",$J,DGJB,K1,DGDV,DGV,"TOT",DGEL)=0
;zero column subtotal
F DGV="N","V" F DGMT="AN","AS","B","C","N","U","X" S ^UTILITY("DGOD",$J,DGJB,K1,DGDV,DGV,"TOT",DGMT)=0
;zero vet/nonvet subtotal
F DGV="N","V" S ^UTILITY("DGOD",$J,DGJB,K1,DGDV,"TOT",DGV)=0
;zero column total for division
F DGMT="AN","AS","B","C","N","U","X" S (^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGDV,DGMT),^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGMT))=0
;zero division total
S ^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGDV)=0
;zero grand total
S ^UTILITY("DGOD",$J,"TOT",DGJB,K1)=0
Q
;
T0 ;totals the array
F I=1:1:A2 S DGDV=$E($P(A(I),U,2)_" ",1,5) F K1=1:1:DGTN D T1
Q
;
T1 ;row subtotal for vet/non-vet
F DGV="N","V" S DGK=$S(DGV="N":8,1:6) F DGMT="AN","AS","B","C","N","U","X" F DGEL=0:1:DGK,"*" S ^UTILITY("DGOD",$J,DGJB,K1,DGDV,DGV,"TOT",DGEL)=^UTILITY("DGOD",$J,DGJB,K1,DGDV,DGV,"TOT",DGEL)+^UTILITY("DGOD",$J,DGJB,K1,DGDV,DGV,DGMT,DGEL)
;column subtotal for vet/non-vet
F DGV="N","V" S DGK=$S(DGV="N":8,1:6) F DGEL=0:1:DGK,"*" F DGMT="AN","AS","B","C","N","U","X" S ^UTILITY("DGOD",$J,DGJB,K1,DGDV,DGV,"TOT",DGMT)=^UTILITY("DGOD",$J,DGJB,K1,DGDV,DGV,"TOT",DGMT)+^UTILITY("DGOD",$J,DGJB,K1,DGDV,DGV,DGMT,DGEL)
;subtotal vet/non-vet
F DGV="N","V" S DGK=$S(DGV="N":8,1:6) F DGEL=0:1:DGK,"*" S ^UTILITY("DGOD",$J,DGJB,K1,DGDV,"TOT",DGV)=^UTILITY("DGOD",$J,DGJB,K1,DGDV,"TOT",DGV)+^UTILITY("DGOD",$J,DGJB,K1,DGDV,DGV,"TOT",DGEL)
;column total for division
F DGV="N","V" F DGMT="AN","AS","B","C","N","U","X" S ^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGDV,DGMT)=^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGDV,DGMT)+^UTILITY("DGOD",$J,DGJB,K1,DGDV,DGV,"TOT",DGMT)
;division total
F DGV="N","V" S ^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGDV)=^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGDV)+^UTILITY("DGOD",$J,DGJB,K1,DGDV,"TOT",DGV)
;grand total for all columns
F DGMT="AN","AS","B","C","N","U","X" S ^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGMT)=^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGMT)+^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGDV,DGMT)
;grand total
S ^UTILITY("DGOD",$J,"TOT",DGJB,K1)=^UTILITY("DGOD",$J,"TOT",DGJB,K1)+^UTILITY("DGOD",$J,DGJB,K1,"TOT",DGDV)
K DGK Q
;
ET ;elapsed time for run
Q:$D(H1)=0 S H2=$H D ET1
S DGTOUT=$S(DGTOUT<60:$J(DGTOUT,1,2)_" secs",DGTOUT<3600:$J(DGTOUT/60,1,2)_" min",1:$J(DGTOUT/3600,1,2)_" hrs") Q
;
ET1 ;H1-start time,H2-end time,DGTOUT-difference in seconds
S H1(1)=$P(H1,",",1),H1(2)=$P(H1,",",2),H2(1)=$P(H2,",",1),H2(2)=$P(H2,",",2)
I H1(1)=H2(1) S DGTOUT=H2(2)-H1(2) Q
S DGTOUT=86400*(H2(1)-H1(1))+(H2(2)-H1(2)) Q
DGODUTL ;ALB/EG - INITIALIZE ARRAYS FOR DGODNP1/DGODOP1 & TOTAL ; JAN-13-1989 @ 0854
+1 ;;5.3;Registration;**1015**;Aug 13, 1993;Build 21
+2 ;;V 4.5
G0 ;initializes array
+1 SET A1=0
FOR I=1:1
SET A1=$ORDER(^DG(40.8,A1))
IF (A1="")!(A1'?.N)
QUIT
SET A(I)=^DG(40.8,A1,0)
SET A2=I
SET DGDV=$EXTRACT($PIECE(A(I),U,2)_" ",1,5)
SET ^UTILITY("DGOD",$JOB,"AO",I)=A(I)
FOR K1=1:1:DGTN
DO G1
+2 QUIT
+3 ;
G1 ;zero each cell
+1 SET ^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGDV)=0
FOR DGV="N","V"
FOR DGMT="AN","AS","B","C","N","U","X"
FOR DGEL="*",0:1:8
SET ^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,DGV,DGMT,DGEL)=0
+2 ;zero row subtotal
+3 FOR DGV="N","V"
FOR DGEL="*",0:1:8
SET ^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,DGV,"TOT",DGEL)=0
+4 ;zero column subtotal
+5 FOR DGV="N","V"
FOR DGMT="AN","AS","B","C","N","U","X"
SET ^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,DGV,"TOT",DGMT)=0
+6 ;zero vet/nonvet subtotal
+7 FOR DGV="N","V"
SET ^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,"TOT",DGV)=0
+8 ;zero column total for division
+9 FOR DGMT="AN","AS","B","C","N","U","X"
SET (^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGDV,DGMT),^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGMT))=0
+10 ;zero division total
+11 SET ^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGDV)=0
+12 ;zero grand total
+13 SET ^UTILITY("DGOD",$JOB,"TOT",DGJB,K1)=0
+14 QUIT
+15 ;
T0 ;totals the array
+1 FOR I=1:1:A2
SET DGDV=$EXTRACT($PIECE(A(I),U,2)_" ",1,5)
FOR K1=1:1:DGTN
DO T1
+2 QUIT
+3 ;
T1 ;row subtotal for vet/non-vet
+1 FOR DGV="N","V"
SET DGK=$SELECT(DGV="N":8,1:6)
FOR DGMT="AN","AS","B","C","N","U","X"
FOR DGEL=0:1:DGK,"*"
SET ^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,DGV,"TOT",DGEL)=^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,DGV,"TOT",DGEL)+^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,DGV,DGMT,DGEL)
+2 ;column subtotal for vet/non-vet
+3 FOR DGV="N","V"
SET DGK=$SELECT(DGV="N":8,1:6)
FOR DGEL=0:1:DGK,"*"
FOR DGMT="AN","AS","B","C","N","U","X"
SET ^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,DGV,"TOT",DGMT)=^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,DGV,"TOT",DGMT)+^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,DGV,DGMT,DGEL)
+4 ;subtotal vet/non-vet
+5 FOR DGV="N","V"
SET DGK=$SELECT(DGV="N":8,1:6)
FOR DGEL=0:1:DGK,"*"
SET ^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,"TOT",DGV)=^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,"TOT",DGV)+^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,DGV,"TOT",DGEL)
+6 ;column total for division
+7 FOR DGV="N","V"
FOR DGMT="AN","AS","B","C","N","U","X"
SET ^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGDV,DGMT)=^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGDV,DGMT)+^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,DGV,"TOT",DGMT)
+8 ;division total
+9 FOR DGV="N","V"
SET ^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGDV)=^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGDV)+^UTILITY("DGOD",$JOB,DGJB,K1,DGDV,"TOT",DGV)
+10 ;grand total for all columns
+11 FOR DGMT="AN","AS","B","C","N","U","X"
SET ^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGMT)=^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGMT)+^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGDV,DGMT)
+12 ;grand total
+13 SET ^UTILITY("DGOD",$JOB,"TOT",DGJB,K1)=^UTILITY("DGOD",$JOB,"TOT",DGJB,K1)+^UTILITY("DGOD",$JOB,DGJB,K1,"TOT",DGDV)
+14 KILL DGK
QUIT
+15 ;
ET ;elapsed time for run
+1 IF $DATA(H1)=0
QUIT
SET H2=$HOROLOG
DO ET1
+2 SET DGTOUT=$SELECT(DGTOUT<60:$JUSTIFY(DGTOUT,1,2)_" secs",DGTOUT<3600:$JUSTIFY(DGTOUT/60,1,2)_" min",1:$JUSTIFY(DGTOUT/3600,1,2)_" hrs")
QUIT
+3 ;
ET1 ;H1-start time,H2-end time,DGTOUT-difference in seconds
+1 SET H1(1)=$PIECE(H1,",",1)
SET H1(2)=$PIECE(H1,",",2)
SET H2(1)=$PIECE(H2,",",1)
SET H2(2)=$PIECE(H2,",",2)
+2 IF H1(1)=H2(1)
SET DGTOUT=H2(2)-H1(2)
QUIT
+3 SET DGTOUT=86400*(H2(1)-H1(1))+(H2(2)-H1(2))
QUIT