Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ACDWDRV2

ACDWDRV2.m

Go to the documentation of this file.
ACDWDRV2 ; IHS/ADC/EDE/KML - DRV 2 FOR RPTS FROM ^ACDTDC 10:14 NOV 17,1993 ; 
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 ;//[ACDR3MENU]
 ;//[ACDR3MENU]
 F  K ACDQUIT D DIR I $D(ACDQUIT) D PRHDR^ACD G ^ACDWK
DIR ;Menu
 S ACDWDRV(2)=2
 D PRHDR^ACD
 ;S:'$D(ACD20) $P(ACD20,"*",20)="*"
 ;W !,ACD20,!,"* T/ D/ C/ REPORTS *",!,ACD20
 F I=50:1:65 W !,I,"  ",$P($T(@I),";",3) I I=65 S DIR(0)="L^50:65^S ACDRPTS=Y",DIR("A")="RUN REPORT # " W ! D ^DIR S:X["^"!($D(DTOUT)) ACDQUIT=1 Q:$D(ACDQUIT)
 I $D(ACDQUIT) K ACDWDRV Q
 D ^ACDWRQ I $D(ACDQUIT) K ACDQUIT Q
 D ^ACDWQ ;        call to XBDBQUE
 Q
 ;
L ;EP TM entry
 S ACDNW(1)=ACDTO,ACDNW(2)=ACDFR,ACDNW(3)=ACDLOC,ACDNW(4)=ACDRPTS
 S ACDTO=ACDNW(1),ACDFR=ACDNW(2),ACDLOC=ACDNW(3)
 D ACDV
 Q
 ;
ACDV ;Visit
 K ^TMP("ACD",ACDJOB,ACDBT)
 S ACDDO=0
 F ACD=ACDFR-.01:0 S ACD=$O(^ACDVIS("B",ACD)) Q:'ACD!(ACD>ACDTO)  D
 . S ACDV=0
 . F  S ACDV=$O(^ACDVIS("B",ACD,ACDV)) Q:'ACDV  D
 .. S ^TMP("ACD",ACDJOB,ACDBT,"HIT",ACDV)=""
 .. S ACD1=0
 .. F  S ACD1=$O(^ACDTDC("C",ACDV,ACD1)) Q:'ACD1  S ^TMP("ACD",ACDJOB,ACDBT,"HIT",ACDV,ACD1)=""
 .. Q
 . Q
 Q
 ;
P ;EP - PRINT REPORT
 K DIRUT
 S ACDNW(1)=ACDTO,ACDNW(2)=ACDFR,ACDNW(3)=ACDLOC,ACDNW(4)=ACDRPTS
 F ACDNW(0)=1:1:$L(ACDNW(4),",")-1 S ACDTO=ACDNW(1),ACDFR=ACDNW(2),ACDLOC=ACDNW(3),(ACDTG,ACDTGSUB)=$P(ACDNW(4),",",ACDNW(0)) D P2 Q:$D(DIRUT)
 Q
 ;
P2 ;
 S ACDV=0
 F  S ACDV=$O(^TMP("ACD",ACDJOB,ACDBT,"HIT",ACDV)) Q:'ACDV  D  Q:$D(DIRUT)
 . S ACDDA=ACDV D ^ACDWVIS
 . S ACD1=0
 . F  S ACD1=$O(^TMP("ACD",ACDJOB,ACDBT,"HIT",ACDV,ACD1)) Q:'ACD1  D  Q:$D(DIRUT)
 .. S ACDDA=ACD1 D ^ACDWTDC
 .. I ACDOK,ACDDFNP D @ACDTG
 .. Q
 . Q
 Q:$D(DIRUT)
 D HED
 Q
 ;
HED ;H-vars
 S ACDH(0)=$P($T(@ACDTG),";",3)_U_ACDLOC,ACDWDRV(2)=2 D HV^ACDWUTL
 U IO D H S ACDTG="G"_ACDTG D @ACDTG Q
H ;EP
 W @IOF,!,"CDMIS T/ D/ C REPORT # "_$S(ACDTG:ACDTG,1:$E(ACDTG,2,6)),!,$P(ACDH(0),U) S ACDH(3)=ACDH(3)+1 W ?68,"PG ",ACDH(3),!,ACDH(50),$P(ACDH(0),U,2) D ASF^ACDWUTL W !,"DATA CAPTURED FOR: ",ACDH(2),!,ACDH(4),!
 Q
50 ;;CT'S WITH A DISCHARGE/AFTERCARE PLAN
 S:'$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDDAP,ACDDFNP)) ^(ACDDFNP)="" S ^(ACDDFNP)=^(ACDDFNP)+1 Q
51 ;;CT'S BY DRUG TYPE
 D C^ACDWUTL
 S ACDDT="" F  S ACDD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