ACDWRQ ;IHS/ADC/EDE/KML - PROMPTS FOR RPTS CRITERIA AREA/SU/FAC;
;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
;;
;*********************************************************
;//^ACDWDRV*
;First get dates to run then see if user is facility or area or HQ.
;Ask HQ to print reports by area or service unit or facility.
;Force AREA to run report by facility.
;Force FACILITY to run only for their ONE facility.
;************************************************************
;
K ACDAREA,ACDSU,ACDFAC,ACDPROV,ACDSUB,ACDTRB,ACDSTA,ACDCOMU,ACDCRST
D D Q:$D(ACDQUIT) D LOC Q:$D(ACDQUIT) I $D(ACDFAC) D 2 Q
W !! S DIR(0)="S^1:AREA;2:FACILITY;3:SERVICE UNIT",DIR("A")="Print Reports By:" D ^DIR S:X["^"!($D(DTOUT))!(X="") ACDQUIT=1 Q:$D(ACDQUIT) D @Y Q:$D(ACDQUIT)
Q
1 ;AREA
;User is running reports by area
D ^ACDWAREA Q:$D(ACDQUIT)
D TSC Q
;
2 ;FACILITY
;User is running reports by facility
;If the user is a facility, they are not asked to run reports
;by area, service unit, or facility, so I pre-set the ACDFAC
;array
I '$D(ACDFAC) D ^ACDWFAC Q:$D(ACDQUIT)
D TSC Q
;
3 ;SERVICE UNIT
;User is running reports by service unit
D ^ACDWSU Q:$D(ACDQUIT)
D TSC Q
;
TSC ;
;Ask to further restrict output by tribe, state, community
;This will further restrict the output criteria already
;selected above
;
Q:$D(ACDWDRV(5))
W !!!,"OK, within ",$S($D(ACDAREA):"AREA, ",$D(ACDFAC):"FACILITY, ",$D(ACDSU):"SERVICE UNIT, "),"restrict reports by: "
S DIR(0)="S^4:TRIBE;5:STATE;6:COMMUMITY;7:NO RESTRICTION" D ^DIR S:X["^"!($D(DTOUT))!(X="") ACDQUIT=1 Q:$D(ACDQUIT) D @Y Q:$D(ACDQUIT)
Q
;
4 ;TRIBE
;User is running reports by the area, facility, or service unit
;with a further restriction i.e. being tribe
D ^ACDWTRB Q
;
5 ;STATE
;User is running reports by the area, facility, or service unit
;with a further restriction i.e. being state
D ^ACDWSTA Q
;
6 ;COMMUMITY
;User is running reports by the area, facility, or service unit
;with a futher restriction i.e. being community
;W !!!,"UNAVAILABLE" Q
Q
;
7 ;No restrictions
;User is running reports by area, facility, or service unit and
;does NOT want a further restriction by state, tribe, or community
Q
;
D ;EP
;Select visit start and stop dates
;//^ACDGSAVE
;//^ACDDFAC
;W !!,"*** Do not enter the day in the date string if you wish to get Client Services ***"
S %DT="AE",%DT("A")="Select Start Visit Date: " D ^%DT S:Y<0 ACDQUIT=1
Q:$D(ACDQUIT)
S ACDFR=+Y
S %DT("A")="Select End Visit Date: " D ^%DT S:Y<0 ACDQUIT=1
Q:$D(ACDQUIT)
S ACDTO=+Y
I ACDTO<ACDFR W !!,"** Visit start date must be earlier then Visit end date. **" G D
;
;
CNTACT ;
;Ask user for the contact types to run the initial/info/fu
;reports for i.e. ACDWDRV(1) will be defined
Q:'$D(ACDWDRV(1))
K ACDCRST,DIR
F S DIR(0)="9002172.1,3O",DIR("A")="Select Contact type(s)" D ^DIR Q:X["^"!($D(DTOUT)!(X="")) S ACDCRST(Y)="" I Y="CS"!(Y="TD") W " *** NOT ALLOWED ***",*7 K ACDCRST(Y)
I $O(ACDCRST(""))="" S ACDQUIT=1
Q
;
LOC ;See user is site, area, or HQ
;See if user running client details, if so, force array set and quit
I $D(ACDWDRV(3)) S ACDFAC(ACD6DIG)="",ACDLOC=$P(^DIC(4,DUZ(2),0),U) Q
;
;See if site is HQ
I $E(ACD6DIG)=9 W !!,*7,"HEADQUARTERS..............",! Q
;
;See if user is a site, if so, force array set and quit
I $E(ACD6DIG,3,4)'="00" S ACDFAC(ACD6DIG)="",ACDLOC=$P(^DIC(4,DUZ(2),0),U) Q
;
;User is a area, force user to the facility selection module
W !!,*7,"Area ...................",! D ^ACDWFAC
Q
;
ACDWRQ ;IHS/ADC/EDE/KML - PROMPTS FOR RPTS CRITERIA AREA/SU/FAC;
+1 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
+2 ;;
+3 ;*********************************************************
+4 ;//^ACDWDRV*
+5 ;First get dates to run then see if user is facility or area or HQ.
+6 ;Ask HQ to print reports by area or service unit or facility.
+7 ;Force AREA to run report by facility.
+8 ;Force FACILITY to run only for their ONE facility.
+9 ;************************************************************
+10 ;
+11 KILL ACDAREA,ACDSU,ACDFAC,ACDPROV,ACDSUB,ACDTRB,ACDSTA,ACDCOMU,ACDCRST
+12 DO D
IF $DATA(ACDQUIT)
QUIT
DO LOC
IF $DATA(ACDQUIT)
QUIT
IF $DATA(ACDFAC)
DO 2
QUIT
+13 WRITE !!
SET DIR(0)="S^1:AREA;2:FACILITY;3:SERVICE UNIT"
SET DIR("A")="Print Reports By:"
DO ^DIR
IF X["^"!($DATA(DTOUT))!(X="")
SET ACDQUIT=1
IF $DATA(ACDQUIT)
QUIT
DO @Y
IF $DATA(ACDQUIT)
QUIT
+14 QUIT
1 ;AREA
+1 ;User is running reports by area
+2 DO ^ACDWAREA
IF $DATA(ACDQUIT)
QUIT
+3 DO TSC
QUIT
+4 ;
2 ;FACILITY
+1 ;User is running reports by facility
+2 ;If the user is a facility, they are not asked to run reports
+3 ;by area, service unit, or facility, so I pre-set the ACDFAC
+4 ;array
+5 IF '$DATA(ACDFAC)
DO ^ACDWFAC
IF $DATA(ACDQUIT)
QUIT
+6 DO TSC
QUIT
+7 ;
3 ;SERVICE UNIT
+1 ;User is running reports by service unit
+2 DO ^ACDWSU
IF $DATA(ACDQUIT)
QUIT
+3 DO TSC
QUIT
+4 ;
TSC ;
+1 ;Ask to further restrict output by tribe, state, community
+2 ;This will further restrict the output criteria already
+3 ;selected above
+4 ;
+5 IF $DATA(ACDWDRV(5))
QUIT
+6 WRITE !!!,"OK, within ",$SELECT($DATA(ACDAREA):"AREA, ",$DATA(ACDFAC):"FACILITY, ",$DATA(ACDSU):"SERVICE UNIT, "),"restrict reports by: "
+7 SET DIR(0)="S^4:TRIBE;5:STATE;6:COMMUMITY;7:NO RESTRICTION"
DO ^DIR
IF X["^"!($DATA(DTOUT))!(X="")
SET ACDQUIT=1
IF $DATA(ACDQUIT)
QUIT
DO @Y
IF $DATA(ACDQUIT)
QUIT
+8 QUIT
+9 ;
4 ;TRIBE
+1 ;User is running reports by the area, facility, or service unit
+2 ;with a further restriction i.e. being tribe
+3 DO ^ACDWTRB
QUIT
+4 ;
5 ;STATE
+1 ;User is running reports by the area, facility, or service unit
+2 ;with a further restriction i.e. being state
+3 DO ^ACDWSTA
QUIT
+4 ;
6 ;COMMUMITY
+1 ;User is running reports by the area, facility, or service unit
+2 ;with a futher restriction i.e. being community
+3 ;W !!!,"UNAVAILABLE" Q
+4 QUIT
+5 ;
7 ;No restrictions
+1 ;User is running reports by area, facility, or service unit and
+2 ;does NOT want a further restriction by state, tribe, or community
+3 QUIT
+4 ;
D ;EP
+1 ;Select visit start and stop dates
+2 ;//^ACDGSAVE
+3 ;//^ACDDFAC
+4 ;W !!,"*** Do not enter the day in the date string if you wish to get Client Services ***"
+5 SET %DT="AE"
SET %DT("A")="Select Start Visit Date: "
DO ^%DT
IF Y<0
SET ACDQUIT=1
+6 IF $DATA(ACDQUIT)
QUIT
+7 SET ACDFR=+Y
+8 SET %DT("A")="Select End Visit Date: "
DO ^%DT
IF Y<0
SET ACDQUIT=1
+9 IF $DATA(ACDQUIT)
QUIT
+10 SET ACDTO=+Y
+11 IF ACDTO<ACDFR
WRITE !!,"** Visit start date must be earlier then Visit end date. **"
GOTO D
+12 ;
+13 ;
CNTACT ;
+1 ;Ask user for the contact types to run the initial/info/fu
+2 ;reports for i.e. ACDWDRV(1) will be defined
+3 IF '$DATA(ACDWDRV(1))
QUIT
+4 KILL ACDCRST,DIR
+5 FOR
SET DIR(0)="9002172.1,3O"
SET DIR("A")="Select Contact type(s)"
DO ^DIR
IF X["^"!($DATA(DTOUT)!(X=""))
QUIT
SET ACDCRST(Y)=""
IF Y="CS"!(Y="TD")
WRITE " *** NOT ALLOWED ***",*7
KILL ACDCRST(Y)
+6 IF $ORDER(ACDCRST(""))=""
SET ACDQUIT=1
+7 QUIT
+8 ;
LOC ;See user is site, area, or HQ
+1 ;See if user running client details, if so, force array set and quit
+2 IF $DATA(ACDWDRV(3))
SET ACDFAC(ACD6DIG)=""
SET ACDLOC=$PIECE(^DIC(4,DUZ(2),0),U)
QUIT
+3 ;
+4 ;See if site is HQ
+5 IF $EXTRACT(ACD6DIG)=9
WRITE !!,*7,"HEADQUARTERS..............",!
QUIT
+6 ;
+7 ;See if user is a site, if so, force array set and quit
+8 IF $EXTRACT(ACD6DIG,3,4)'="00"
SET ACDFAC(ACD6DIG)=""
SET ACDLOC=$PIECE(^DIC(4,DUZ(2),0),U)
QUIT
+9 ;
+10 ;User is a area, force user to the facility selection module
+11 WRITE !!,*7,"Area ...................",!
DO ^ACDWFAC
+12 QUIT
+13 ;