ACDRL0 ;IHS/ADC/EDE/KML - SCREEN LOGIC;
;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
;
;
Q ;EP
K DIC,DIR
K ^TMP("ACDRL",$J,"QMAN"),^UTILITY("AMQQ TAX",$J)
K DIC,X,Y,DD S X=$P(^ACDTITEM(ACDCRIT,0),U,3),DIC="^AMQQ(5,",DIC(0)="EQXM",DIC("S")="I $P(^(0),U,14)" D ^DIC K DIC,DA,DINUM,DICR I Y=-1 W "OOPS - QMAN NOT CURRENT - QUITTING" Q
S ACDQMAN=+Y
D ^AMQQGTX0(ACDQMAN,"^TMP(""ACDRL"",$J,""QMAN"",")
I '$D(^TMP("ACDRL",$J,"QMAN")) W !!,$C(7),"** No ",$P(^ACDTITEM(ACDCRIT,0),U)," selected, all will be included." Q
I $D(^TMP("ACDRL",$J,"QMAN","*")) K ^TMP("ACDRL",$J,"QMAN")
S ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT,^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
S X="",Y=0 F S X=$O(^TMP("ACDRL",$J,"QMAN",X)) Q:X="" S Y=Y+1,^ACDRPTD(ACDRPT,11,ACDCRIT,11,Y,0)=X,^ACDRPTD(ACDRPT,11,ACDCRIT,11,"B",X,Y)="",^ACDRPTD(ACDRPT,11,ACDCRIT,11,0)="^9002171.8110101A^"_Y_"^"_Y
K X,Y,Z,ACDQMAN,V
K ^TMP("ACDRL",$J,"QMAN")
Q
R ;EP
K DIR,DIRUT,DUOUT,DTOUT,DA
S DIR(0)=$P(^ACDTITEM(ACDCRIT,0),U,4)_"O",DIR("A")="ENTER "_$P(^(0),U) D ^DIR K DIR S:$D(DUOUT) DIRUT=1
Q:$D(DIRUT)
I Y="" Q
S ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT,^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
S ACDCNT=ACDCNT+1,^ACDRPTD(ACDRPT,11,ACDCRIT,11,ACDCNT,0)=$P(Y,U),^ACDRPTD(ACDRPT,11,ACDCRIT,11,"B",$P(Y,U),ACDCNT)="",^ACDRPTD(ACDRPT,11,ACDCRIT,11,0)="^9002171.8110101A^"_ACDCNT_"^"_ACDCNT
G R
Q
D ;DATE RANGE
BD ;get beginning date
W ! S DIR(0)="D^::EP",DIR("A")="Enter beginning "_ACDTEXT_" for Search" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
I $D(DIRUT) Q
S ACDGDB=Y
ED ;get ending date
W ! S DIR(0)="D^"_ACDGDB_"::EP",DIR("A")="Enter ending "_ACDTEXT_" for Search" S Y=ACDGDB D DD^%DT S DIR("B")=Y,Y="" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
I $D(DIRUT) G BD
S ACDGDE=Y
S X1=ACDGDB,X2=-1 D C^%DTC S ACDGDS=X
;
S ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT,^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
S ACDCNT=0,^ACDRPTD(ACDRPT,11,ACDCRIT,11,ACDCNT,0)="^9002171.8110101A^1^1" S ACDCNT=ACDCNT+1,^ACDRPTD(ACDRPT,11,ACDCRIT,11,1,0)=ACDGDB_U_ACDGDE,^ACDRPTD(ACDRPT,11,ACDCRIT,11,"B",ACDGDB,ACDCNT)=""
Q
N ;
K ^ACDRPTD(ACDRPT,11,ACDCRIT),^ACDRPTD(ACDRPT,11,"B",ACDCRIT)
S DIR(0)="FO^1:7",DIR("A")="Enter a Range of numbers (e.g. 5-12,1-1)" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
I Y="" W !!,"No numeric range entered. All numerics will be included." Q
I Y'?1.3N1"-"1.3N W !!,$C(7),$C(7),"Enter a numeric range in the format nnn-nnn. E.g. 0-5, 0-99, 5-20." G N
I $D(^ACDTITEM(ACDCRIT,25)) S X=Y X ^(25) I '$D(X) G N ;if input tx exists and fails G N
I '$D(^ACDTITEM(ACDCRIT,25)),Y'?1.3N1"-"1.3N W !!,$C(7),$C(7),"Enter a numeric range in the format nnn-nnn. E.g. 0-5, 0-99, 5-20." G N
S ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT,^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
S ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT,^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
S ^ACDRPTD(ACDRPT,11,ACDCRIT,11,0)="^9002171.82110101A^1^1" S ^ACDRPTD(ACDRPT,11,ACDCRIT,11,1,0)=$P(Y,"-"),^ACDRPTD(ACDRPT,11,ACDCRIT,11,"B",$P(Y,"-"),1)=""
S $P(^ACDRPTD(ACDRPT,11,ACDCRIT,11,1,0),U,2)=$P(Y,"-",2)
Q
F ;FREE TEXT RANGE
K ^ACDRPTD(ACDRPT,11,ACDCRIT),^ACDRPTD(ACDRPT,11,"B",ACDCRIT)
S DIR(0)="FO^1:20",DIR("A")="Enter a Range of Characters for Search (e.g. A:B) " D ^DIR K DIR S:$D(DUOUT) DIRUT=1
I Y="" W !!,"No range entered. All ",ACDTEXT," will be included." Q
I Y'?1.ANP1":"1.ANP W !!,$C(7),$C(7),"Enter an free text range in the format AAA:AAA. E.g. 94-01:94-200, CA:CZ, A:Z." G F
S ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT,^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
S ACDCNT=0,^ACDRPTD(ACDRPT,11,ACDCRIT,11,ACDCNT,0)="^9002171.8110101A^1^1" S ACDCNT=ACDCNT+1,^ACDRPTD(ACDRPT,11,ACDCRIT,11,1,0)=$P(X,":")_U_$P(X,":",2),^ACDRPTD(ACDRPT,11,ACDCRIT,11,"B",$P(X,":"),ACDCNT)=""
Q
Y ;
D Y^ACDRL01
Q
SPECIAL ;
D SPECIAL^ACDRL01
Q
ACDRL0 ;IHS/ADC/EDE/KML - SCREEN LOGIC;
+1 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
+2 ;
+3 ;
Q ;EP
+1 KILL DIC,DIR
+2 KILL ^TMP("ACDRL",$JOB,"QMAN"),^UTILITY("AMQQ TAX",$JOB)
+3 KILL DIC,X,Y,DD
SET X=$PIECE(^ACDTITEM(ACDCRIT,0),U,3)
SET DIC="^AMQQ(5,"
SET DIC(0)="EQXM"
SET DIC("S")="I $P(^(0),U,14)"
DO ^DIC
KILL DIC,DA,DINUM,DICR
IF Y=-1
WRITE "OOPS - QMAN NOT CURRENT - QUITTING"
QUIT
+4 SET ACDQMAN=+Y
+5 DO ^AMQQGTX0(ACDQMAN,"^TMP(""ACDRL"",$J,""QMAN"",")
+6 IF '$DATA(^TMP("ACDRL",$JOB,"QMAN"))
WRITE !!,$CHAR(7),"** No ",$PIECE(^ACDTITEM(ACDCRIT,0),U)," selected, all will be included."
QUIT
+7 IF $DATA(^TMP("ACDRL",$JOB,"QMAN","*"))
KILL ^TMP("ACDRL",$JOB,"QMAN")
+8 SET ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT
SET ^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
+9 SET X=""
SET Y=0
FOR
SET X=$ORDER(^TMP("ACDRL",$JOB,"QMAN",X))
IF X=""
QUIT
SET Y=Y+1
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,Y,0)=X
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,"B",X,Y)=""
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,0)="^9002171.8110101A^"_Y_"^"_Y
+10 KILL X,Y,Z,ACDQMAN,V
+11 KILL ^TMP("ACDRL",$JOB,"QMAN")
+12 QUIT
R ;EP
+1 KILL DIR,DIRUT,DUOUT,DTOUT,DA
+2 SET DIR(0)=$PIECE(^ACDTITEM(ACDCRIT,0),U,4)_"O"
SET DIR("A")="ENTER "_$PIECE(^(0),U)
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+3 IF $DATA(DIRUT)
QUIT
+4 IF Y=""
QUIT
+5 SET ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT
SET ^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
+6 SET ACDCNT=ACDCNT+1
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,ACDCNT,0)=$PIECE(Y,U)
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,"B",$PIECE(Y,U),ACDCNT)=""
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,0)="^9002171.8110101A^"_ACDCNT_"^"_ACDCNT
+7 GOTO R
+8 QUIT
D ;DATE RANGE
BD ;get beginning date
+1 WRITE !
SET DIR(0)="D^::EP"
SET DIR("A")="Enter beginning "_ACDTEXT_" for Search"
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+2 IF $DATA(DIRUT)
QUIT
+3 SET ACDGDB=Y
ED ;get ending date
+1 WRITE !
SET DIR(0)="D^"_ACDGDB_"::EP"
SET DIR("A")="Enter ending "_ACDTEXT_" for Search"
SET Y=ACDGDB
DO DD^%DT
SET DIR("B")=Y
SET Y=""
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+2 IF $DATA(DIRUT)
GOTO BD
+3 SET ACDGDE=Y
+4 SET X1=ACDGDB
SET X2=-1
DO C^%DTC
SET ACDGDS=X
+5 ;
+6 SET ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT
SET ^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
+7 SET ACDCNT=0
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,ACDCNT,0)="^9002171.8110101A^1^1"
SET ACDCNT=ACDCNT+1
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,1,0)=ACDGDB_U_ACDGDE
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,"B",ACDGDB,ACDCNT)=""
+8 QUIT
N ;
+1 KILL ^ACDRPTD(ACDRPT,11,ACDCRIT),^ACDRPTD(ACDRPT,11,"B",ACDCRIT)
+2 SET DIR(0)="FO^1:7"
SET DIR("A")="Enter a Range of numbers (e.g. 5-12,1-1)"
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+3 IF Y=""
WRITE !!,"No numeric range entered. All numerics will be included."
QUIT
+4 IF Y'?1.3N1"-"1.3N
WRITE !!,$CHAR(7),$CHAR(7),"Enter a numeric range in the format nnn-nnn. E.g. 0-5, 0-99, 5-20."
GOTO N
+5 ;if input tx exists and fails G N
IF $DATA(^ACDTITEM(ACDCRIT,25))
SET X=Y
XECUTE ^(25)
IF '$DATA(X)
GOTO N
+6 IF '$DATA(^ACDTITEM(ACDCRIT,25))
IF Y'?1.3N1"-"1.3N
WRITE !!,$CHAR(7),$CHAR(7),"Enter a numeric range in the format nnn-nnn. E.g. 0-5, 0-99, 5-20."
GOTO N
+7 SET ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT
SET ^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
+8 SET ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT
SET ^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
+9 SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,0)="^9002171.82110101A^1^1"
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,1,0)=$PIECE(Y,"-")
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,"B",$PIECE(Y,"-"),1)=""
+10 SET $PIECE(^ACDRPTD(ACDRPT,11,ACDCRIT,11,1,0),U,2)=$PIECE(Y,"-",2)
+11 QUIT
F ;FREE TEXT RANGE
+1 KILL ^ACDRPTD(ACDRPT,11,ACDCRIT),^ACDRPTD(ACDRPT,11,"B",ACDCRIT)
+2 SET DIR(0)="FO^1:20"
SET DIR("A")="Enter a Range of Characters for Search (e.g. A:B) "
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+3 IF Y=""
WRITE !!,"No range entered. All ",ACDTEXT," will be included."
QUIT
+4 IF Y'?1.ANP1":"1.ANP
WRITE !!,$CHAR(7),$CHAR(7),"Enter an free text range in the format AAA:AAA. E.g. 94-01:94-200, CA:CZ, A:Z."
GOTO F
+5 SET ^ACDRPTD(ACDRPT,11,ACDCRIT,0)=ACDCRIT
SET ^ACDRPTD(ACDRPT,11,"B",ACDCRIT,ACDCRIT)=""
+6 SET ACDCNT=0
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,ACDCNT,0)="^9002171.8110101A^1^1"
SET ACDCNT=ACDCNT+1
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,1,0)=$PIECE(X,":")_U_$PIECE(X,":",2)
SET ^ACDRPTD(ACDRPT,11,ACDCRIT,11,"B",$PIECE(X,":"),ACDCNT)=""
+7 QUIT
Y ;
+1 DO Y^ACDRL01
+2 QUIT
SPECIAL ;
+1 DO SPECIAL^ACDRL01
+2 QUIT