- BSDB0 ; IHS/ANMC/LJF - SCHEDULING TEMPLATES ;
- ;;5.3;PIMS;;APR 26, 2002
- ;
- ASK ;EP; ask user for template when setting up clinic
- ; Called by ^SDB0
- S Y=$$READ^BDGF("FO^1:30","TIME","","^D HELP^BSDB0")
- Q:Y=U Q:Y=""
- I Y="[?" D HELP2,ASK Q
- I $E(Y)="[" D GETTIMES($P(Y,"[",2)),ASK Q
- I Y'?4N1"-"4N D MSG^BDGF("Enter time like 0800-1200",1,0),ASK Q
- S BSDTIME=$G(BSDTIME)_Y_U D SLOTS,ASK Q
- Q
- ;
- GETTIMES(TNAMES) ; find times and slots based on sched template TNAMES
- NEW ONE,IEN,IEN1
- ; separate template names by ;
- F S ONE=$P(TNAMES,";"),TNAMES=$P(TNAMES,";",2,99) Q:ONE="" D
- . ;
- . ; find template in file 9009017.3
- . S IEN=$O(^BSDST("B",ONE,0)) I 'IEN W $C(7),"??" Q
- . ;
- . ; loop thru time multiples to set times and slots
- . S IEN1=0 F S IEN1=$O(^BSDST(IEN,1,IEN1)) Q:'IEN1 D
- .. S BSDTIME=$G(BSDTIME)_$P(^BSDST(IEN,1,IEN1,0),U)_U
- .. S BSDSLOT=$G(BSDSLOT)_$P(^BSDST(IEN,1,IEN1,0),U,2)_U
- Q
- ;
- SLOTS ; ask user for # of slots
- ;PROG NOTE: using Read command to mimic VA user interface where
- ; this question is on same line as TIME prompt
- R " NO. SLOTS: 1// ",Y:DTIME S:Y="" Y=1
- I Y>0 S BSDSLOT=$G(BSDSLOT)_Y_U
- Q
- ;
- HELP ;EP; user help on TIME question
- D MSG^BDGF($$SP(5)_"Enter times using this example: 0800-1200 or enter a",2,0)
- D MSG^BDGF($$SP(5)_"scheduling template name(s): [FMS C1 or [PEDS B3AM;PEDS D1PM.",1,0)
- D MSG^BDGF($$SP(5)_"A template name must be preceeded by a bracket [. If you need",1,0)
- D MSG^BDGF($$SP(5)_"to enter more than one template per day (am and pm), separate",1,0)
- D MSG^BDGF($$SP(5)_"them by a semicolon.",1,0)
- D MSG^BDGF($$SP(5)_"To see a list of current templates, type [? at TIME prompt.",1,0)
- Q
- ;
- HELP2 ; list scheduling templates in file
- NEW DIC,D,DZ,X,Y
- S DIC="^BSDST(",DIC(0)="AMQE",D="B",DZ="??" D DQ^DICQ
- Q
- ;
- PAD(D,L) ;EP -- SUBRTN to pad length of data
- ; -- D=data L=length
- Q $E(D_$$REPEAT^XLFSTR(" ",L),1,L)
- ;
- SP(N) ; -- SUBRTN to pad N number of spaces
- Q $$PAD(" ",N)
- BSDB0 ; IHS/ANMC/LJF - SCHEDULING TEMPLATES ;
- +1 ;;5.3;PIMS;;APR 26, 2002
- +2 ;
- ASK ;EP; ask user for template when setting up clinic
- +1 ; Called by ^SDB0
- +2 SET Y=$$READ^BDGF("FO^1:30","TIME","","^D HELP^BSDB0")
- +3 IF Y=U
- QUIT
- IF Y=""
- QUIT
- +4 IF Y="[?"
- DO HELP2
- DO ASK
- QUIT
- +5 IF $EXTRACT(Y)="["
- DO GETTIMES($PIECE(Y,"[",2))
- DO ASK
- QUIT
- +6 IF Y'?4N1"-"4N
- DO MSG^BDGF("Enter time like 0800-1200",1,0)
- DO ASK
- QUIT
- +7 SET BSDTIME=$GET(BSDTIME)_Y_U
- DO SLOTS
- DO ASK
- QUIT
- +8 QUIT
- +9 ;
- GETTIMES(TNAMES) ; find times and slots based on sched template TNAMES
- +1 NEW ONE,IEN,IEN1
- +2 ; separate template names by ;
- +3 FOR
- SET ONE=$PIECE(TNAMES,";")
- SET TNAMES=$PIECE(TNAMES,";",2,99)
- IF ONE=""
- QUIT
- Begin DoDot:1
- +4 ;
- +5 ; find template in file 9009017.3
- +6 SET IEN=$ORDER(^BSDST("B",ONE,0))
- IF 'IEN
- WRITE $CHAR(7),"??"
- QUIT
- +7 ;
- +8 ; loop thru time multiples to set times and slots
- +9 SET IEN1=0
- FOR
- SET IEN1=$ORDER(^BSDST(IEN,1,IEN1))
- IF 'IEN1
- QUIT
- Begin DoDot:2
- +10 SET BSDTIME=$GET(BSDTIME)_$PIECE(^BSDST(IEN,1,IEN1,0),U)_U
- +11 SET BSDSLOT=$GET(BSDSLOT)_$PIECE(^BSDST(IEN,1,IEN1,0),U,2)_U
- End DoDot:2
- End DoDot:1
- +12 QUIT
- +13 ;
- SLOTS ; ask user for # of slots
- +1 ;PROG NOTE: using Read command to mimic VA user interface where
- +2 ; this question is on same line as TIME prompt
- +3 READ " NO. SLOTS: 1// ",Y:DTIME
- IF Y=""
- SET Y=1
- +4 IF Y>0
- SET BSDSLOT=$GET(BSDSLOT)_Y_U
- +5 QUIT
- +6 ;
- HELP ;EP; user help on TIME question
- +1 DO MSG^BDGF($$SP(5)_"Enter times using this example: 0800-1200 or enter a",2,0)
- +2 DO MSG^BDGF($$SP(5)_"scheduling template name(s): [FMS C1 or [PEDS B3AM;PEDS D1PM.",1,0)
- +3 DO MSG^BDGF($$SP(5)_"A template name must be preceeded by a bracket [. If you need",1,0)
- +4 DO MSG^BDGF($$SP(5)_"to enter more than one template per day (am and pm), separate",1,0)
- +5 DO MSG^BDGF($$SP(5)_"them by a semicolon.",1,0)
- +6 DO MSG^BDGF($$SP(5)_"To see a list of current templates, type [? at TIME prompt.",1,0)
- +7 QUIT
- +8 ;
- HELP2 ; list scheduling templates in file
- +1 NEW DIC,D,DZ,X,Y
- +2 SET DIC="^BSDST("
- SET DIC(0)="AMQE"
- SET D="B"
- SET DZ="??"
- DO DQ^DICQ
- +3 QUIT
- +4 ;
- PAD(D,L) ;EP -- SUBRTN to pad length of data
- +1 ; -- D=data L=length
- +2 QUIT $EXTRACT(D_$$REPEAT^XLFSTR(" ",L),1,L)
- +3 ;
- SP(N) ; -- SUBRTN to pad N number of spaces
- +1 QUIT $$PAD(" ",N)