ACDWSTA ;IHS/ADC/EDE/KML - GET STATE TO RUN REPORTS FOR 10:14;
;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
;;
;********************************************************
;//^ACDWRQ
;User is running CDMIS reports by state. A futher breakdown is now
;determined. Run ALL or SELECTED or CATEGORY
;This routine will return a ACDSTA(array) that holds the
;six digit code for area service state or "*ALL*"
;*********************************************************
;
EN ;
K ACDSTA,DIR,DIC
S DIR(0)="S^1:Print 'ALL' states;2:Print 'SELECTED' states;3:Print 'CATEGORY' of states",DIR("A")="State Print Criteria" D ^DIR G:Y="^" K D @Y,K Q
1 ;All states
S ACDSTA("*ALL*")=""
S ACDLOC=ACDLOC_" / "_"*ALL STATES*"
Q
2 ;On the fly selected states
S ACDLOC=ACDLOC_" / "_"SELECTED STATES"
F S DIC="^DIC(5,",DIC(0)="AEQZM" D ^DIC G:Y<0 K S ACDSTA($P(Y(0),U,3))=""
Q
3 ;Category
S DIC="^ACDSTA(",DIC(0)="AEQM" D ^DIC G:Y<0 K S ACDSTA("C")=$P(Y,U,3)
S ACDLOC=ACDLOC_" / "_"STATE CATEGORY: "_ACDSTA("C")
I $D(^ACDSTA(+Y,1,0)) F ACDDA=0:0 S ACDDA=$O(^ACDSTA(+Y,1,ACDDA)) Q:'ACDDA I $D(^(ACDDA,0)) S ACDSTAP=^(0),ACDSTAP=$P(^DIC(5,ACDSTAP,0),U,3),ACDSTA(ACDSTAP)=""
Q
K ;
I '$D(ACDSTA) S ACDQUIT=1
K DIC,DIR,ACDSTAP,Y
ACDWSTA ;IHS/ADC/EDE/KML - GET STATE TO RUN REPORTS FOR 10:14;
+1 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
+2 ;;
+3 ;********************************************************
+4 ;//^ACDWRQ
+5 ;User is running CDMIS reports by state. A futher breakdown is now
+6 ;determined. Run ALL or SELECTED or CATEGORY
+7 ;This routine will return a ACDSTA(array) that holds the
+8 ;six digit code for area service state or "*ALL*"
+9 ;*********************************************************
+10 ;
EN ;
+1 KILL ACDSTA,DIR,DIC
+2 SET DIR(0)="S^1:Print 'ALL' states;2:Print 'SELECTED' states;3:Print 'CATEGORY' of states"
SET DIR("A")="State Print Criteria"
DO ^DIR
IF Y="^"
GOTO K
DO @Y
DO K
QUIT
1 ;All states
+1 SET ACDSTA("*ALL*")=""
+2 SET ACDLOC=ACDLOC_" / "_"*ALL STATES*"
+3 QUIT
2 ;On the fly selected states
+1 SET ACDLOC=ACDLOC_" / "_"SELECTED STATES"
+2 FOR
SET DIC="^DIC(5,"
SET DIC(0)="AEQZM"
DO ^DIC
IF Y<0
GOTO K
SET ACDSTA($PIECE(Y(0),U,3))=""
+3 QUIT
3 ;Category
+1 SET DIC="^ACDSTA("
SET DIC(0)="AEQM"
DO ^DIC
IF Y<0
GOTO K
SET ACDSTA("C")=$PIECE(Y,U,3)
+2 SET ACDLOC=ACDLOC_" / "_"STATE CATEGORY: "_ACDSTA("C")
+3 IF $DATA(^ACDSTA(+Y,1,0))
FOR ACDDA=0:0
SET ACDDA=$ORDER(^ACDSTA(+Y,1,ACDDA))
IF 'ACDDA
QUIT
IF $DATA(^(ACDDA,0))
SET ACDSTAP=^(0)
SET ACDSTAP=$PIECE(^DIC(5,ACDSTAP,0),U,3)
SET ACDSTA(ACDSTAP)=""
+4 QUIT
K ;
+1 IF '$DATA(ACDSTA)
SET ACDQUIT=1
+2 KILL DIC,DIR,ACDSTAP,Y