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

ACDWDRV1.m

Go to the documentation of this file.
ACDWDRV1 ;IHS/ADC/EDE/KML - DRV1 2941117; 
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 F  K ACDQUIT D D I $D(ACDQUIT) D PRHDR^ACD G ^ACDWK
D ;
 S ACDWDRV(1)=1
 D PRHDR^ACD
 ;S:'$D(ACD27) $P(ACD27,"*",27)="*"
 ;W !,ACD27,!,"* INI/INF/FU/REPORTS *",!,ACD27
 F I=1:1:15 W !,I,"  ",$P($T(@I),";",3) I I=15 S DIR(0)="L^1:15^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 - FOR TASKMAN
 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 ;
 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
 .. Q:$P(^ACDVIS(ACDV,0),U,4)=""  ; prevent subscript error
 .. Q:'$D(ACDCRST($P(^ACDVIS(ACDV,0),U,4)))  ;  type not wanted
 .. S ^TMP("ACD",ACDJOB,ACDBT,"HIT",ACDV)=""
 .. S ACD1=0 F  S ACD1=$O(^ACDIIF("C",ACDV,ACD1)) Q:'ACD1  D
 ...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T'S FOR AVE DAYS USED DRUGS WITHIN CONTACT TYPE
 Q:$G(ACDDUD)=999
 S:'ACDDUD ACDDUD=.1 S:'$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDCONTL,ACDDUD)) ^(ACDDUD)="" S ^(ACDDUD)=^(ACDDUD)+1
 Q
10 ;;CT'S FOR AVE DAYS USED ALCOHOL WITHIN CONTACT TYPE
 Q:$G(ACDDUA)=999
 S:'ACDDUA ACDDUA=.1 S:'$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDCONTL,ACDDUA)) ^(ACDDUA)="" S ^(ACDDUA)=^(ACDDUA)+1
 Q
11 ;;CT'S FOR DIFFERENCE REASONS WITHIN CONTACT TYPE
 S:'$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDCONTL,ACDDIF,ACDDFNP)) ^(ACDDFNP)="" S ^(ACDDFNP)=^(ACDDFNP)+1 Q
13 ;;AVE CLIENT STAGE BY COMPONENT
 S ACDADD=0,ACDADD=ACDSUS+ACDPS+ACDES+ACDSS+ACDBS+ACDCS Q:'ACDADD
 S ACDCBO=ACDCOMCL_"/"_ACDCOMT
 S:'$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDCBO,ACDADD)) ^(ACDADD)="" S ^(ACDADD)=^(ACDADD)+6 Q
14 ;;PLACEMENT DIFFERENCE VOLUME
 S ACDCBO=ACDPLAA_"/"_ACDPLAA1,ACDCOMB=ACDPLAR_"/"_ACDPLAR1
 S:'$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDCOMB,ACDCBO,ACDDIF)) ^(ACDDIF)="" S ^(ACDDIF)=^(ACDDIF)+1 Q
12 ;;DRUG TYPE/ AGE RANGE/ SEX/ ARRESTS / UNIQ CLI  (NEW V4) (****)
 Q:$G(ACDAAR)=999
 S ACDDT="" F  S ACDDT=$O(ACDDTA(ACDDT)) Q:ACDDT=""  D
 . S:'$D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