ABSPOSU3 ; IHS/FCS/DRS - copied for POS ; [ 09/12/2002 10:19 AM ]
ABSUD003 ;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
;----------------------------------------------------------------------
;----------------------------------------------------------------------
;Standard SET and YESNO Functions
;----------------------------------------------------------------------
;Standard SET PROMPT:
;
;Parameters:
; PROMPT = Text to be displayed before read
; DFLT = DEFAULT choice (external format)
; OPT = 1 - Answer optional 0 - Answer required
; DISPLAY = V - Vertical display H - Horizontal display
; N - No display
; CHOICES = <code>:<choice><code>:<choice>.....
; TIMEOUT = Number of seconds
;
;Returns:
; <null> = No response <^> - Up-arrow entered
; <-1> = Timeout occurred <^^> - Two up-arrows entered
; <Choice> = Response choice (internal format)
;---------------------------------------------------------------------
SET(PROMPT,DFLT,OPT,DISPLAY,CHOICES,TIMEOUT) ;EP
;
N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
;
Q:$G(PROMPT)="" ""
Q:$G(DISPLAY)="" ""
Q:$G(CHOICES)="" ""
;
S $P(DIR(0),"^",1)="S"_$S(DISPLAY="H":"B",DISPLAY="N":"A",1:"")_$S(OPT=1:"O",1:"")
S $P(DIR(0),"^",2)=CHOICES
S DIR("A")=PROMPT
S:$G(DFLT)'="" DIR("B")=DFLT
S:+$G(TIMEOUT)>0 DIR("T")=TIMEOUT
D ^DIR
Q $S($G(DTOUT)=1:-1,$G(DIROUT)=1:"^^",$G(DUOUT)=1:"^",1:Y)
;---------------------------------------------------------------------
;Standard Yes/No PROMPT:
;
;Parameters:
; PROMPT = Text to be displayed before read
; DFLT = YES, NO or <Null>
; OPT = 1 - Answer optional 0 - Answer required
; TIMEOUT = Number of seconds
;
;Returns:
; <null> = No response <^> - Up-arrow entered
; <-1> = Timeout occurred <^^> - Two up-arrows entered
; <0> = No <1> - Yes
;---------------------------------------------------------------------
YESNO(PROMPT,DFLT,OPT,TIMEOUT) ;EP
;
N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
;
Q:$G(PROMPT)="" ""
;
S $P(DIR(0),"^",1)="Y"_$S(OPT=1:"O",1:"")
S DIR("A")=PROMPT
S:$G(DFLT)'="" DIR("B")=DFLT
S:+$G(TIMEOUT)>0 DIR("T")=TIMEOUT
D ^DIR
Q $S($G(DTOUT)=1:-1,$G(DIROUT)=1:"^^",$G(DUOUT)=1:"^",1:Y)
ABSPOSU3 ; IHS/FCS/DRS - copied for POS ; [ 09/12/2002 10:19 AM ]
ABSUD003 ;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
+1 ;----------------------------------------------------------------------
+2 ;----------------------------------------------------------------------
+3 ;Standard SET and YESNO Functions
+4 ;----------------------------------------------------------------------
+5 ;Standard SET PROMPT:
+6 ;
+7 ;Parameters:
+8 ; PROMPT = Text to be displayed before read
+9 ; DFLT = DEFAULT choice (external format)
+10 ; OPT = 1 - Answer optional 0 - Answer required
+11 ; DISPLAY = V - Vertical display H - Horizontal display
+12 ; N - No display
+13 ; CHOICES = <code>:<choice><code>:<choice>.....
+14 ; TIMEOUT = Number of seconds
+15 ;
+16 ;Returns:
+17 ; <null> = No response <^> - Up-arrow entered
+18 ; <-1> = Timeout occurred <^^> - Two up-arrows entered
+19 ; <Choice> = Response choice (internal format)
+20 ;---------------------------------------------------------------------
SET(PROMPT,DFLT,OPT,DISPLAY,CHOICES,TIMEOUT) ;EP
+1 ;
+2 NEW DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
+3 ;
+4 IF $GET(PROMPT)=""
QUIT ""
+5 IF $GET(DISPLAY)=""
QUIT ""
+6 IF $GET(CHOICES)=""
QUIT ""
+7 ;
+8 SET $PIECE(DIR(0),"^",1)="S"_$SELECT(DISPLAY="H":"B",DISPLAY="N":"A",1:"")_$SELECT(OPT=1:"O",1:"")
+9 SET $PIECE(DIR(0),"^",2)=CHOICES
+10 SET DIR("A")=PROMPT
+11 IF $GET(DFLT)'=""
SET DIR("B")=DFLT
+12 IF +$GET(TIMEOUT)>0
SET DIR("T")=TIMEOUT
+13 DO ^DIR
+14 QUIT $SELECT($GET(DTOUT)=1:-1,$GET(DIROUT)=1:"^^",$GET(DUOUT)=1:"^",1:Y)
+15 ;---------------------------------------------------------------------
+16 ;Standard Yes/No PROMPT:
+17 ;
+18 ;Parameters:
+19 ; PROMPT = Text to be displayed before read
+20 ; DFLT = YES, NO or <Null>
+21 ; OPT = 1 - Answer optional 0 - Answer required
+22 ; TIMEOUT = Number of seconds
+23 ;
+24 ;Returns:
+25 ; <null> = No response <^> - Up-arrow entered
+26 ; <-1> = Timeout occurred <^^> - Two up-arrows entered
+27 ; <0> = No <1> - Yes
+28 ;---------------------------------------------------------------------
YESNO(PROMPT,DFLT,OPT,TIMEOUT) ;EP
+1 ;
+2 NEW DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
+3 ;
+4 IF $GET(PROMPT)=""
QUIT ""
+5 ;
+6 SET $PIECE(DIR(0),"^",1)="Y"_$SELECT(OPT=1:"O",1:"")
+7 SET DIR("A")=PROMPT
+8 IF $GET(DFLT)'=""
SET DIR("B")=DFLT
+9 IF +$GET(TIMEOUT)>0
SET DIR("T")=TIMEOUT
+10 DO ^DIR
+11 QUIT $SELECT($GET(DTOUT)=1:-1,$GET(DIROUT)=1:"^^",$GET(DUOUT)=1:"^",1:Y)