BSDST ; IHS/ANMC/LJF - SCHEDULING TEMPLATES ;
;;5.3;PIMS;;APR 26, 2002
;
ASK ; ask user for action
S Y=$$READ^BDGF("SO^1:Add/Edit Templates;2:List Defined Templates","Select Action")
Q:Y<1 D @Y,ASK Q
;
1 ; call FM to edit templates
S (DIC,DLAYGO)=9009017.3,DIC(0)="AEMQZL" D ^DIC Q:Y<1
S DIE=DIC,DA=+Y,DR="1:9999" D ^DIE,1 Q
;
2 ; call LM to present already defined templates
EN ; -- main entry point for BSDSM SCHED TEMPLATES
NEW VALMCNT D TERM^VALM0,CLEAR^VALM1
D EN^VALM("BSDSM SCHED TEMPLATES")
D CLEAR^VALM1
Q
;
HDR ; -- header code
Q
;
INIT ; -- init variables and list array
NEW NAME,IEN,IEN1,LINE,X
S VALMCNT=0 K ^TMP("BSDST",$J)
; loop in alphabetical order
S NAME=0 F S NAME=$O(^BSDST("B",NAME)) Q:NAME="" D
. S IEN=$O(^BSDST("B",NAME,0)) Q:'IEN
. ; display name of template
. I VALMCNT>0 D SET("",.VALMCNT)
. D SET(" "_NAME,.VALMCNT)
. ;
. ; loop thru times and display
. S IEN1=0 F S IEN1=$O(^BSDST(IEN,1,IEN1)) Q:'IEN1 D
.. S X=$G(^BSDST(IEN,1,IEN1,0)) Q:X=""
.. S LINE=$$PAD($$SP(35)_$P(X,U),55)_$P(X,U,2)
.. D SET(LINE,.VALMCNT)
Q
;
SET(DATA,NUM) ; set data line into display array
S NUM=NUM+1
S ^TMP("BSDST",$J,NUM,0)=DATA
Q
;
HELP ; -- help code
S X="?" D DISP^XQORM1 W !!
Q
;
EXIT ; -- exit code
K ^TMP("BSDST",$J)
Q
;
EXPND ; -- expand code
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)
BSDST ; IHS/ANMC/LJF - SCHEDULING TEMPLATES ;
+1 ;;5.3;PIMS;;APR 26, 2002
+2 ;
ASK ; ask user for action
+1 SET Y=$$READ^BDGF("SO^1:Add/Edit Templates;2:List Defined Templates","Select Action")
+2 IF Y<1
QUIT
DO @Y
DO ASK
QUIT
+3 ;
1 ; call FM to edit templates
+1 SET (DIC,DLAYGO)=9009017.3
SET DIC(0)="AEMQZL"
DO ^DIC
IF Y<1
QUIT
+2 SET DIE=DIC
SET DA=+Y
SET DR="1:9999"
DO ^DIE
DO 1
QUIT
+3 ;
2 ; call LM to present already defined templates
EN ; -- main entry point for BSDSM SCHED TEMPLATES
+1 NEW VALMCNT
DO TERM^VALM0
DO CLEAR^VALM1
+2 DO EN^VALM("BSDSM SCHED TEMPLATES")
+3 DO CLEAR^VALM1
+4 QUIT
+5 ;
HDR ; -- header code
+1 QUIT
+2 ;
INIT ; -- init variables and list array
+1 NEW NAME,IEN,IEN1,LINE,X
+2 SET VALMCNT=0
KILL ^TMP("BSDST",$JOB)
+3 ; loop in alphabetical order
+4 SET NAME=0
FOR
SET NAME=$ORDER(^BSDST("B",NAME))
IF NAME=""
QUIT
Begin DoDot:1
+5 SET IEN=$ORDER(^BSDST("B",NAME,0))
IF 'IEN
QUIT
+6 ; display name of template
+7 IF VALMCNT>0
DO SET("",.VALMCNT)
+8 DO SET(" "_NAME,.VALMCNT)
+9 ;
+10 ; loop thru times and display
+11 SET IEN1=0
FOR
SET IEN1=$ORDER(^BSDST(IEN,1,IEN1))
IF 'IEN1
QUIT
Begin DoDot:2
+12 SET X=$GET(^BSDST(IEN,1,IEN1,0))
IF X=""
QUIT
+13 SET LINE=$$PAD($$SP(35)_$PIECE(X,U),55)_$PIECE(X,U,2)
+14 DO SET(LINE,.VALMCNT)
End DoDot:2
End DoDot:1
+15 QUIT
+16 ;
SET(DATA,NUM) ; set data line into display array
+1 SET NUM=NUM+1
+2 SET ^TMP("BSDST",$JOB,NUM,0)=DATA
+3 QUIT
+4 ;
HELP ; -- help code
+1 SET X="?"
DO DISP^XQORM1
WRITE !!
+2 QUIT
+3 ;
EXIT ; -- exit code
+1 KILL ^TMP("BSDST",$JOB)
+2 QUIT
+3 ;
EXPND ; -- expand code
+1 QUIT
+2 ;
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)