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

ACDWDRV4.m

Go to the documentation of this file.
ACDWDRV4 ;IHS/ADC/EDE/KML - DRV 4 FOR REPORTS (ACDCS GLOBAL);
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 ;//[ACDR2MENU]
 F  K ACDQUIT D DIR I $D(ACDQUIT) D PRHDR^ACD G ^ACDWK
DIR ;Menu
 S ACDWDRV(4)=4
 D PRHDR^ACD
 ;S:'$D(ACD26) $P(ACD26,"*",26)="*"
 ;W !,ACD26,!,"* CLIENT SERVICE REPORTS *",!,ACD26,!
 F I=200:1:205 W !,I,"  ",$P($T(@I),";",3) I I=205 S DIR(0)="L^200:205^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
 S ACDFR=$E(ACDFR,1,5)_"00" ; CS visits in the B x-ref of the visit file need to be found so date string needs manipulation
 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)'="CS"  ;  type not wanted
 .. S ^TMP("ACD",ACDJOB,ACDBT,"HIT",ACDV)=""
 .. S ACD1=0
 .. F  S ACD1=$O(^ACDCS("C",ACDV,ACD1)) Q:'ACD1  D
 ... S ^TMP("ACD",ACDJOB,ACDBT,"HIT",ACDV,ACD1)=""
 ... Q
 .. 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 ^ACDWCS
 .. I ACDOK,ACDDFNP D @ACDTG
 .. Q
 . Q
 D HED
 Q
 ;
HED ;Set header variables
 S ACDH(0)=$P($T(@ACDTG),";",3)_U_ACDLOC,ACDWDRV(4)=4 D HV^ACDWUTL
 U IO D H S ACDTG="G"_ACDTG D @ACDTG Q
H ;EP
 W @IOF,!,"CDMIS CLIENT SERVICE 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
200 ;;UNIQUE CLIENT COUNT AND TOTAL VISITS
 S:'$D(ACDCNT) ACDCNT=0 S:'$D(ACDUNIQ) ACDUNIQ=0 S ACDCNT=ACDCNT+1 S:'$D(ACDDFNA(ACDDFNP)) ACDDFNA(ACDDFNP)="",ACDUNIQ=ACDUNIQ+1
 Q
 ;
201 ;;HOUR BY COMPONENT TYPE
 S:'$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDCOMTL)) ^(ACDCOMTL)="" S ^(ACDCOMTL)=^(ACDCOMTL)+ACDHOUR Q
202 ;;NUMBER SERVED AND HOUR BY COMPONENT TYPE
 I ACDHOUR S:'$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDCOMTL,ACDHOUR,ACDDFNP)) ^(ACDDFNP)="" S ^(ACDDFNP)=^(ACDDFNP)+1
 Q
203 ;;INPATIENT/OUTPATIENT/OTHER/NONE HOUR
 S:'$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDCOMCL)) ^(ACDCOMCL)="" S ^(ACDCOMCL)=^(ACDCOMCL)+ACDHOUR Q
204 ;;SERVICE/ACTIVITY BREAK-OUT BY COMPONENT
 S:'$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDCOMCL,ACDSVAC,ACDDFNP)) ^(ACDDFNP)="" S ^(ACDDFNP)=^(ACDDFNP)+1 Q
205 ;;COMPONENT CODE & TYPE /HOURS/ UNIQUE CLIENTS/ NUMBER VISITS (NEW V4)
 S:'$D(^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDCOMCL_"/"_ACDCOMT,ACDHOUR,ACDDFNP)) ^(ACDDFNP)="" S ^(ACDDFNP)=^(ACDDFNP)+1 Q
G200 S:$G(ACDUNIQ) ^TMP("ACD",ACDJOB,ACDBT,ACDTGSUB,"VAL",ACDUNIQ)=ACDCNT S ACDC(1)="UNIQUE CLIENT COUNT",ACDC(2)="VISIT COUNT" S ACDWDRV(4)=1 D ^ACDWRP2 Q
G201 S ACDC(1)="COMPONENT TYPE",ACDC(2)="HOUR COUNT" S ACDWDRV(4)=1 D ^ACDWRP2 Q
G202 S ACDC(1)="COMPONENT TYPE",ACDC(2)="HOUR COUNT",ACDC(3)="#CLIENTS",ACDC(4)=ACDH(7),ACDC(5)=ACDH(8) S ACDWDRV(4)=1 D ^ACDWRP6 Q
G203 S ACDC(1)="INP/OUT/OTHER/NONE",ACDC(2)="HOUR COUNT" S ACDWDRV(4)=1 D ^ACDWRP2 Q
G204 ;
 S ACDC(1)=ACDH(54),ACDC(2)="SVC/ACT",ACDC(3)=ACDH(6),ACDC(4)=ACDH(7),ACDC(5)=ACDH(8) D ^ACDWRP3 Q
G205 ;
 S ACDC(1)=ACDH(20),ACDC(2)="HOURS",ACDC(3)=ACDH(59),ACDC(4)=ACDH(7) D ^ACDWRP50 Q
 ;
EOJ ;EP - EOJ FOR XBDBQUE
 K ^TMP("ACD",ACDJOB,ACDBT)
 LOCK -^TMP("ACD",ACDJOB,ACDBT)
 K ACDNW,ACDQ,ACDFAC,ACDAREA,ACDSU,ACDTRB,ACDSTA
 K ACDAGE,ACDBT,ACDFOLL,ACDH,ACDHRS,ACDJOB,ACDOK,ACDOPT,ACDPLAAL,ACDPLARL,ACDPT,ACDSTAT,ACDTG,ACDTGSUB,ACDVET,ACDWDRV
 Q