PXRMDLED ;SLC/AGP - DIALOG UTILITIES. ;08/04/2020
;;2.0;CLINICAL REMINDERS;**45,71**;Feb 04, 2005;Build 43
Q
;
DICPROMPT(RESULT,GBL,ZERO,PROMPT,SCREEN,NUM) ;
S DIC=GBL
S DIC(0)=ZERO
S DIC("A")=PROMPT
;Current dialog type only
I SCREEN'="" S DIC("S")=SCREEN
S DIC("??")=U_"D HELP^PXRMDLED("_NUM_")"
W !
D ^DIC
I $D(DIROUT) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
S RESULT=Y
Q
;
DIRPROMPT(RESULT,ZERO,PROMPT,NUM) ;
S DIR(0)=ZERO
S DIR("A")=PROMPT
S DIR("?")=$S(NUM=2:"Enter the name of the template to create.",1:"Enter Y or N. For detailed help type ??")
S DIR("??")=U_"D HELP^PXRMDLED("_NUM_")"
W !
D ^DIR K DIR
I $D(DIROUT) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
S RESULT=Y
Q
;
EN ;
N DIEN,DIC,DIR,DNAME,DR,DIROUT,DIRUT,DTOUT,DUOUT,TEMPNAME,TIEN,TNAME,VALUE,X,Y
FINDDIAL ;find dialog name #801.41
D DICPROMPT(.VALUE,"^PXRMD(801.41,","AEMQ","Select Dialog Definition: ","I $P(^(0),U,4)=""R""",1)
Q:$D(DTOUT)!($D(DUOUT))
I +VALUE=-1 Q
S DIEN=+VALUE
S DNAME=$P(VALUE,U,2)
;
TNAME ;user supply template name #8927.1
D DIRPROMPT(.TEMPNAME,"F^3:60","Enter template name",2)
Q:$D(DTOUT)&($D(DUOUT)) G:$D(DUOUT) FINDDIAL
;
ATTACH ;attach to a note title
K VALUE
D DIRPROMPT(.VALUE,"Y","Link template to Document Title",3)
Q:$D(DTOUT)&($D(DUOUT)) G:$D(DUOUT) TNAME
I VALUE=0 D LINK(DNAME,"",TEMPNAME,1) Q
;
DOC ;find note title 8927.1
K VALUE
D DICPROMPT(.VALUE,"^TIU(8925.1,","AEMQ","Select Document Definition: ","I $P(^(0),U,4)=""DOC""",4)
Q:$D(DTOUT)&($D(DUOUT)) G:$D(DUOUT) ATTACH
I +VALUE=-1 G ATTACH
S TIEN=+VALUE
S TNAME=$P(VALUE,U,2)
I $D(^TIU(8927,"AL",TIEN_";TIU(8925.1,")) D G DOC
.W !,TNAME_" has an existing template link to it."
.W !,"Cannot link to this note title."
D LINK(DNAME,TNAME,TEMPNAME,0)
Q
;
;link dialog to template and attach to a note title
LINK(DNAME,TITLE,TEMPNAME,TEMPONLY) ;
D LINK2TIU^PXRMDUTL(DNAME,TITLE,TEMPNAME,TEMPONLY,"TIU(8925.1,")
H 1
Q
;
HELP(NUM) ; help prompts
N HTEXT
I NUM=1 D
.S HTEXT(1)="Select the Reminder Dialog Definition to link to a Template."
I NUM=2 D
.S HTEXT(1)="Enter the template display name."
I NUM=3 D
.S HTEXT(1)="Select No to add the template to the Shared Folder only."
.S HTEXT(2)="Select Yes to link the tempplate to a document title."
I NUM=4 D
.S HTEXT(1)="Select the document title to link the template to."
D HELP^PXRMEUT(.HTEXT)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXRMDLED 2446 printed Nov 22, 2024@16:54:02 Page 2
PXRMDLED ;SLC/AGP - DIALOG UTILITIES. ;08/04/2020
+1 ;;2.0;CLINICAL REMINDERS;**45,71**;Feb 04, 2005;Build 43
+2 QUIT
+3 ;
DICPROMPT(RESULT,GBL,ZERO,PROMPT,SCREEN,NUM) ;
+1 SET DIC=GBL
+2 SET DIC(0)=ZERO
+3 SET DIC("A")=PROMPT
+4 ;Current dialog type only
+5 IF SCREEN'=""
SET DIC("S")=SCREEN
+6 SET DIC("??")=U_"D HELP^PXRMDLED("_NUM_")"
+7 WRITE !
+8 DO ^DIC
+9 IF $DATA(DIROUT)
SET DTOUT=1
+10 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+11 SET RESULT=Y
+12 QUIT
+13 ;
DIRPROMPT(RESULT,ZERO,PROMPT,NUM) ;
+1 SET DIR(0)=ZERO
+2 SET DIR("A")=PROMPT
+3 SET DIR("?")=$SELECT(NUM=2:"Enter the name of the template to create.",1:"Enter Y or N. For detailed help type ??")
+4 SET DIR("??")=U_"D HELP^PXRMDLED("_NUM_")"
+5 WRITE !
+6 DO ^DIR
KILL DIR
+7 IF $DATA(DIROUT)
SET DTOUT=1
+8 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+9 SET RESULT=Y
+10 QUIT
+11 ;
EN ;
+1 NEW DIEN,DIC,DIR,DNAME,DR,DIROUT,DIRUT,DTOUT,DUOUT,TEMPNAME,TIEN,TNAME,VALUE,X,Y
FINDDIAL ;find dialog name #801.41
+1 DO DICPROMPT(.VALUE,"^PXRMD(801.41,","AEMQ","Select Dialog Definition: ","I $P(^(0),U,4)=""R""",1)
+2 if $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+3 IF +VALUE=-1
QUIT
+4 SET DIEN=+VALUE
+5 SET DNAME=$PIECE(VALUE,U,2)
+6 ;
TNAME ;user supply template name #8927.1
+1 DO DIRPROMPT(.TEMPNAME,"F^3:60","Enter template name",2)
+2 if $DATA(DTOUT)&($DATA(DUOUT))
QUIT
if $DATA(DUOUT)
GOTO FINDDIAL
+3 ;
ATTACH ;attach to a note title
+1 KILL VALUE
+2 DO DIRPROMPT(.VALUE,"Y","Link template to Document Title",3)
+3 if $DATA(DTOUT)&($DATA(DUOUT))
QUIT
if $DATA(DUOUT)
GOTO TNAME
+4 IF VALUE=0
DO LINK(DNAME,"",TEMPNAME,1)
QUIT
+5 ;
DOC ;find note title 8927.1
+1 KILL VALUE
+2 DO DICPROMPT(.VALUE,"^TIU(8925.1,","AEMQ","Select Document Definition: ","I $P(^(0),U,4)=""DOC""",4)
+3 if $DATA(DTOUT)&($DATA(DUOUT))
QUIT
if $DATA(DUOUT)
GOTO ATTACH
+4 IF +VALUE=-1
GOTO ATTACH
+5 SET TIEN=+VALUE
+6 SET TNAME=$PIECE(VALUE,U,2)
+7 IF $DATA(^TIU(8927,"AL",TIEN_";TIU(8925.1,"))
Begin DoDot:1
+8 WRITE !,TNAME_" has an existing template link to it."
+9 WRITE !,"Cannot link to this note title."
End DoDot:1
GOTO DOC
+10 DO LINK(DNAME,TNAME,TEMPNAME,0)
+11 QUIT
+12 ;
+13 ;link dialog to template and attach to a note title
LINK(DNAME,TITLE,TEMPNAME,TEMPONLY) ;
+1 DO LINK2TIU^PXRMDUTL(DNAME,TITLE,TEMPNAME,TEMPONLY,"TIU(8925.1,")
+2 HANG 1
+3 QUIT
+4 ;
HELP(NUM) ; help prompts
+1 NEW HTEXT
+2 IF NUM=1
Begin DoDot:1
+3 SET HTEXT(1)="Select the Reminder Dialog Definition to link to a Template."
End DoDot:1
+4 IF NUM=2
Begin DoDot:1
+5 SET HTEXT(1)="Enter the template display name."
End DoDot:1
+6 IF NUM=3
Begin DoDot:1
+7 SET HTEXT(1)="Select No to add the template to the Shared Folder only."
+8 SET HTEXT(2)="Select Yes to link the tempplate to a document title."
End DoDot:1
+9 IF NUM=4
Begin DoDot:1
+10 SET HTEXT(1)="Select the document title to link the template to."
End DoDot:1
+11 DO HELP^PXRMEUT(.HTEXT)
+12 QUIT