ACDWRP14 ;IHS/ADC/EDE/KML - OUTPUT GENERATOR;
;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
;Runs reports 9,10,57,58
I '$D(^TMP("ACD",$J)) D ^ACDWK Q
;counts clients with 0 days used alc/drug for averaging
D C
S ACDP1=""
F ACDPL=0:0 S (ACDCLI,ACDNUM)=0,ACDP1=$O(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1)) Q:ACDP1="" D
. W !,ACDP1
. F ACDP2=0:0 S ACDP2=$O(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2)) W:'ACDP2 ?65,$J(ACDNUM/ACDCLI,8,2) Q:ACDP2'>0 D SUM
. Q
D ^ACDWK
Q
F ;Form feed
I $Y+4>IOSL D F^ACDWUTL D:'$D(DIRUT) C
Q
C ;Column
W !!,ACDC(1),?50,ACDC(2),!,ACDH(1)
Q
SUM ;
S ACDTIME=ACDP2 S:ACDTIME=.1 ACDTIME=0
S ACDNUM=ACDNUM+(ACDTIME*^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2)),ACDCLI=ACDCLI+^(ACDP2)
ACDWRP14 ;IHS/ADC/EDE/KML - OUTPUT GENERATOR;
+1 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
+2 ;Runs reports 9,10,57,58
+3 IF '$DATA(^TMP("ACD",$JOB))
DO ^ACDWK
QUIT
+4 ;counts clients with 0 days used alc/drug for averaging
+5 DO C
+6 SET ACDP1=""
+7 FOR ACDPL=0:0
SET (ACDCLI,ACDNUM)=0
SET ACDP1=$ORDER(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1))
IF ACDP1=""
QUIT
Begin DoDot:1
+8 WRITE !,ACDP1
+9 FOR ACDP2=0:0
SET ACDP2=$ORDER(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2))
IF 'ACDP2
WRITE ?65,$JUSTIFY(ACDNUM/ACDCLI,8,2)
IF ACDP2'>0
QUIT
DO SUM
+10 QUIT
End DoDot:1
+11 DO ^ACDWK
+12 QUIT
F ;Form feed
+1 IF $Y+4>IOSL
DO F^ACDWUTL
IF '$DATA(DIRUT)
DO C
+2 QUIT
C ;Column
+1 WRITE !!,ACDC(1),?50,ACDC(2),!,ACDH(1)
+2 QUIT
SUM ;
+1 SET ACDTIME=ACDP2
IF ACDTIME=.1
SET ACDTIME=0
+2 SET ACDNUM=ACDNUM+(ACDTIME*^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2))
SET ACDCLI=ACDCLI+^(ACDP2)