ACDWRP27 ;IHS/ADC/EDE/KML - OUTPUT GENERATOR;
;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
;Reports 310
I '$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL")) D ^ACDWK Q
S (ACDNCNT,ACDVCNT)=0
P1 ;
D C S ACDP1="" F S ACDP1=$O(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1)) Q:ACDP1="" W !,$E(ACDP1,1,20) D P2 Q:$D(DIRUT)
W:'$D(DIRUT) !?56,"=====",?64,"=====",!?56,$J(ACDNCNT,5,0),?64,$J(ACDVCNT,5,0)
D ^ACDWK
Q
P2 ;
S ACDP2="" F D F Q:$D(DIRUT) S ACDP2=$O(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2)) Q:ACDP2="" W ?22,$E(ACDP2,1,20) D P3 Q:$D(DIRUT)
Q
P3 ;
S ACDP3="" F D F Q:$D(DIRUT) S ACDP3=$O(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2,ACDP3)) Q:ACDP3="" S ACDN0=^(ACDP3) D P4 Q:$D(DIRUT)
Q
P4 ;
S ACDVIS=$P(ACDN0,U),ACDNUMR=$P(ACDN0,U,2)
D F Q:$D(DIRUT) W ?44,$E(ACDP3,1,15),?56,$J(ACDNUMR,5,0),?64,$J(ACDVIS,5,0),?71,$J(ACDNUMR/ACDVIS,8,2),!
S ACDNCNT=ACDNCNT+ACDNUMR,ACDVCNT=ACDVCNT+ACDVIS
Q
F ;Form feed
I $Y+4>IOSL D F^ACDWUTL D:'$D(DIRUT) C
Q
C ;Column
W !,ACDC(1),?22,ACDC(2),?44,ACDC(3),?53,ACDC(4),?62,ACDC(5),?71,ACDC(6),!,ACDH(1),!
Q
ACDWRP27 ;IHS/ADC/EDE/KML - OUTPUT GENERATOR;
+1 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
+2 ;Reports 310
+3 IF '$DATA(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL"))
DO ^ACDWK
QUIT
+4 SET (ACDNCNT,ACDVCNT)=0
P1 ;
+1 DO C
SET ACDP1=""
FOR
SET ACDP1=$ORDER(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1))
IF ACDP1=""
QUIT
WRITE !,$EXTRACT(ACDP1,1,20)
DO P2
IF $DATA(DIRUT)
QUIT
+2 IF '$DATA(DIRUT)
WRITE !?56,"=====",?64,"=====",!?56,$JUSTIFY(ACDNCNT,5,0),?64,$JUSTIFY(ACDVCNT,5,0)
+3 DO ^ACDWK
+4 QUIT
P2 ;
+1 SET ACDP2=""
FOR
DO F
IF $DATA(DIRUT)
QUIT
SET ACDP2=$ORDER(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2))
IF ACDP2=""
QUIT
WRITE ?22,$EXTRACT(ACDP2,1,20)
DO P3
IF $DATA(DIRUT)
QUIT
+2 QUIT
P3 ;
+1 SET ACDP3=""
FOR
DO F
IF $DATA(DIRUT)
QUIT
SET ACDP3=$ORDER(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDP1,ACDP2,ACDP3))
IF ACDP3=""
QUIT
SET ACDN0=^(ACDP3)
DO P4
IF $DATA(DIRUT)
QUIT
+2 QUIT
P4 ;
+1 SET ACDVIS=$PIECE(ACDN0,U)
SET ACDNUMR=$PIECE(ACDN0,U,2)
+2 DO F
IF $DATA(DIRUT)
QUIT
WRITE ?44,$EXTRACT(ACDP3,1,15),?56,$JUSTIFY(ACDNUMR,5,0),?64,$JUSTIFY(ACDVIS,5,0),?71,$JUSTIFY(ACDNUMR/ACDVIS,8,2),!
+3 SET ACDNCNT=ACDNCNT+ACDNUMR
SET ACDVCNT=ACDVCNT+ACDVIS
+4 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),?22,ACDC(2),?44,ACDC(3),?53,ACDC(4),?62,ACDC(5),?71,ACDC(6),!,ACDH(1),!
+2 QUIT