SDPPSEL ;ALB/CAW - Specific selection and Date Range; 5/4/92
;;5.3;Scheduling;**6,20,28,32,79,1015**;Aug 13, 1993;Build 21
;
ASK ; Ask either stop code or clinic depending on DIC
;
W !,"Do you want a specific "_$S(DIC=40.7:"stop code",DIC=44:"clinic",DIC=408.31:"means test")
S %=2 D YN^DICN S:%=-1 SDERR=1 I %=0 D HELP G ASK
Q:%'=1
ASK1 S DIC(0)="AEMQ",DIC("S")=$S(DIC=40.7:"I '$P(^(0),U,3)",DIC=44:"I $P(^(0),U,3)=""C"",'$G(^(""OOS""))",1:"")
I DIC=408.31 D ASK2 S DIC(0)="EMQ",DIC("S")="I $P(^(0),U,2)=DFN"
D ^DIC K DIC S:Y=-1 SDERR=1 S SDY=+Y
Q
HELP ;
W !,"Answer 'Y' for Yes or 'N' for No"
Q
DATE ; Ask date range
N SDBDPRE,SDEDPRE
I $D(SDBD),$D(SDED) S SDBDPRE=SDBD,SDEDPRE=SDED
K SDBD,SDED S SDT00="AEX" D DATE^SDUTL I '$D(SDED) K SDBD,BEGDATE,SDT00 S SDBEG=0,SDEND=9999999
I $D(SDED) K SDBEG,SDEND
I '$D(SDED) S SDBD=SDBDPRE,SDED=SDEDPRE D
. W !,"Date Range has not been changed" H 1
Q
ALL ;Ask whether user wants 'all'
S SDACT=0,SDERR=0,%=2
I SDFLG=4 W !,"Active enrollments only" S %=2 D YN^DICN S SDACT=$S(%=1:1,1:0) I %=0 D HELP G ALL
S SDFLG=0
I %=1 S SDBEG=0,SDEND=9999999,SDHDR=1 K VALMHDR
K % Q
Q
;
ASK2 ;Entry point to look-up a means test for a patient
N X1
W !,"Select ANNUAL MEANS TEST DATE OF TEST: "
R X:DTIME I '$T S DTOUT=1,Y=-1 G Q
S:X["^" DUOUT=1 I X["^"!(X="") S Y=-1 G Q
I X'["?" Q
S X1=X
D FULL^VALM1
S X=X1,D="ADFN"_DFN,DIC(0)="Q" D IX^DIC K D
G ASK2
Q Q
SDPPSEL ;ALB/CAW - Specific selection and Date Range; 5/4/92
+1 ;;5.3;Scheduling;**6,20,28,32,79,1015**;Aug 13, 1993;Build 21
+2 ;
ASK ; Ask either stop code or clinic depending on DIC
+1 ;
+2 WRITE !,"Do you want a specific "_$SELECT(DIC=40.7:"stop code",DIC=44:"clinic",DIC=408.31:"means test")
+3 SET %=2
DO YN^DICN
IF %=-1
SET SDERR=1
IF %=0
DO HELP
GOTO ASK
+4 IF %'=1
QUIT
ASK1 SET DIC(0)="AEMQ"
SET DIC("S")=$SELECT(DIC=40.7:"I '$P(^(0),U,3)",DIC=44:"I $P(^(0),U,3)=""C"",'$G(^(""OOS""))",1:"")
+1 IF DIC=408.31
DO ASK2
SET DIC(0)="EMQ"
SET DIC("S")="I $P(^(0),U,2)=DFN"
+2 DO ^DIC
KILL DIC
IF Y=-1
SET SDERR=1
SET SDY=+Y
+3 QUIT
HELP ;
+1 WRITE !,"Answer 'Y' for Yes or 'N' for No"
+2 QUIT
DATE ; Ask date range
+1 NEW SDBDPRE,SDEDPRE
+2 IF $DATA(SDBD)
IF $DATA(SDED)
SET SDBDPRE=SDBD
SET SDEDPRE=SDED
+3 KILL SDBD,SDED
SET SDT00="AEX"
DO DATE^SDUTL
IF '$DATA(SDED)
KILL SDBD,BEGDATE,SDT00
SET SDBEG=0
SET SDEND=9999999
+4 IF $DATA(SDED)
KILL SDBEG,SDEND
+5 IF '$DATA(SDED)
SET SDBD=SDBDPRE
SET SDED=SDEDPRE
Begin DoDot:1
+6 WRITE !,"Date Range has not been changed"
HANG 1
End DoDot:1
+7 QUIT
ALL ;Ask whether user wants 'all'
+1 SET SDACT=0
SET SDERR=0
SET %=2
+2 IF SDFLG=4
WRITE !,"Active enrollments only"
SET %=2
DO YN^DICN
SET SDACT=$SELECT(%=1:1,1:0)
IF %=0
DO HELP
GOTO ALL
+3 SET SDFLG=0
+4 IF %=1
SET SDBEG=0
SET SDEND=9999999
SET SDHDR=1
KILL VALMHDR
+5 KILL %
QUIT
+6 QUIT
+7 ;
ASK2 ;Entry point to look-up a means test for a patient
+1 NEW X1
+2 WRITE !,"Select ANNUAL MEANS TEST DATE OF TEST: "
+3 READ X:DTIME
IF '$TEST
SET DTOUT=1
SET Y=-1
GOTO Q
+4 IF X["^"
SET DUOUT=1
IF X["^"!(X="")
SET Y=-1
GOTO Q
+5 IF X'["?"
QUIT
+6 SET X1=X
+7 DO FULL^VALM1
+8 SET X=X1
SET D="ADFN"_DFN
SET DIC(0)="Q"
DO IX^DIC
KILL D
+9 GOTO ASK2
Q QUIT