ACDWRP6 ;IHS/ADC/EDE/KML - REPORT GENERATOR;
;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
;Report 1,8,11,12,202
I '$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL")) D ^ACDWK Q
S (ACDGTOT,ACDGTOT1)=0
D C S ACDP1="" F D F Q:$D(DIRUT) S ACDP1=$O(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1)) Q:ACDP1="" W !,$E(ACDP1,1,24) D P1 Q:$D(DIRUT)
I $D(DIRUT) D ^ACDWK Q
;PUT TOTALS HERE
D ^ACDWK Q
P1 ;
S ACDP2="" F S (ACDSTOT,ACDSTOT1)=0 D F Q:$D(DIRUT) S ACDP2=$O(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2)) Q:ACDP2="" W ?26,$E(ACDP2,1,20) D P2 Q:$D(DIRUT)
Q
P2 ;
F ACDP3=0:0 D F Q:$D(DIRUT) S ACDP3=$O(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2,ACDP3)) Q:'ACDP3 S ACDSTOT=ACDSTOT+1,ACDSTOT1=ACDSTOT1+^(ACDP3) Q:$D(DIRUT)
Q:$D(DIURT)
S ACDGTOT=ACDGTOT+ACDSTOT,ACDGTOT1=ACDGTOT1+ACDSTOT1
W ?52,ACDSTOT,?62,ACDSTOT1,?74,$J(ACDSTOT1/ACDSTOT,5,2),!
Q
F ;Form feed
I $Y+4>IOSL D F^ACDWUTL D:'$D(DIRUT) C
Q
C ;Column
W !!,ACDC(1),?26,ACDC(2),?52,ACDC(3),?62,ACDC(4),?72,ACDC(5),!,ACDH(1),!
Q
ACDWRP6 ;IHS/ADC/EDE/KML - REPORT GENERATOR;
+1 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
+2 ;Report 1,8,11,12,202
+3 IF '$DATA(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL"))
DO ^ACDWK
QUIT
+4 SET (ACDGTOT,ACDGTOT1)=0
+5 DO C
SET ACDP1=""
FOR
DO F
IF $DATA(DIRUT)
QUIT
SET ACDP1=$ORDER(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1))
IF ACDP1=""
QUIT
WRITE !,$EXTRACT(ACDP1,1,24)
DO P1
IF $DATA(DIRUT)
QUIT
+6 IF $DATA(DIRUT)
DO ^ACDWK
QUIT
+7 ;PUT TOTALS HERE
+8 DO ^ACDWK
QUIT
P1 ;
+1 SET ACDP2=""
FOR
SET (ACDSTOT,ACDSTOT1)=0
DO F
IF $DATA(DIRUT)
QUIT
SET ACDP2=$ORDER(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2))
IF ACDP2=""
QUIT
WRITE ?26,$EXTRACT(ACDP2,1,20)
DO P2
IF $DATA(DIRUT)
QUIT
+2 QUIT
P2 ;
+1 FOR ACDP3=0:0
DO F
IF $DATA(DIRUT)
QUIT
SET ACDP3=$ORDER(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2,ACDP3))
IF 'ACDP3
QUIT
SET ACDSTOT=ACDSTOT+1
SET ACDSTOT1=ACDSTOT1+^(ACDP3)
IF $DATA(DIRUT)
QUIT
+2 IF $DATA(DIURT)
QUIT
+3 SET ACDGTOT=ACDGTOT+ACDSTOT
SET ACDGTOT1=ACDGTOT1+ACDSTOT1
+4 WRITE ?52,ACDSTOT,?62,ACDSTOT1,?74,$JUSTIFY(ACDSTOT1/ACDSTOT,5,2),!
+5 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),?26,ACDC(2),?52,ACDC(3),?62,ACDC(4),?72,ACDC(5),!,ACDH(1),!
+2 QUIT