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

ACDWRQ.m

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