Index: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGJMN1.m
===================================================================
--- WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGJMN1.m	(revision 613)
+++ WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGJMN1.m	(revision 623)
@@ -1,230 +1,230 @@
-MAGJMN1	;WIRMFO/JHC VRad Maint functions ; 29 Jul 2003  4:02 PM
-	;;3.0;IMAGING;**16,9,22,18,65,76**;Jun 22, 2007;Build 19
-	;;Per VHA Directive 2004-038, this routine should not be modified.
-	;; +---------------------------------------------------------------+
-	;; | Property of the US Government.                                |
-	;; | No permission to copy or redistribute this software is given. |
-	;; | Use of unreleased versions of this software requires the user |
-	;; | to execute a written test agreement with the VistA Imaging    |
-	;; | Development Office of the Department of Veterans Affairs,     |
-	;; | telephone (301) 734-0100.                                     |
-	;; |                                                               |
-	;; | The Food and Drug Administration classifies this software as  |
-	;; | a medical device.  As such, it may not be changed in any way. |
-	;; | Modifications to this software may result in an adulterated   |
-	;; | medical device under 21CFR820, the use of which is considered |
-	;; | to be a violation of US Federal Statutes.                     |
-	;; +---------------------------------------------------------------+
-	;;
-	Q
-	;
-SVRLIST	;
-	W @IOF,!!?10,"Enter/Edit VistARad Exams List Definition",!!
-	N MAGIEN
-	K DIC S (DIC,DLAYGO)=2006.631,DIC(0)="ALMEQ"
-	D ^DIC I Y=-1 K DIC,DA,DR,DIE,DLAYGO Q
-	S X=$P(@(DIC_+Y_",0)"),U,2)
-	I X>9000 W !!,$C(7),"You may not edit System-Supplied files!" H 3 G SVRLIST
-	S DIE=2006.631,DA=+Y,DR="[MAGJ LIST EDIT]"
-	S MAGIEN=DA
-	D ^DIE I '$D(DA) G SVRLIST
-	D ENSRCH
-	D BLDDEF(MAGIEN)
-	S $P(^MAG(2006.631,MAGIEN,0),U,5)=$$NOW^XLFDT()
-	W !!,"List Definition complete!" R X:2
-	G SVRLIST
-	Q
-ENSRCH	; Invoke Search for 2006.631 def'n
-	N GREF,GLIN,GO,CT,DIARI,DIC,FNOD,TNOD,NCOND,NODE0
-	; GREF holds indirect ref to store search logic data:
-	; @GREF@(3, ff -- conditional elements (fields/logic)
-	; @GREF@(4, ff -- composite elements (ANDed conditions)
-	; @GREF@(5, ff -- Human-readable search text
-	; GLIN holds indirect ref to retrieve search logic data from ^DIBT
-	; @GLIN@("DC", ff -- conditional elements
-	; @GLIN@("DL", ff -- composite elements
-	; @GLIN@("O", ff -- readable text
-	S GREF=$NA(^MAG(2006.631,MAGIEN,"DEF"))
-	S GO=1 I $D(@GREF@(5,1)) D  ; show current logic
-	. W ! D DISPSRCH(GREF)
-	. S X=$$YN("Do you want to delete or re-enter the search logic?","NO")
-	. I X'="Y" S GO=0 Q
-	. W !!?7,"Re-entering the search logic requires first deleting the current",!?7,"definition, then entering the new definition from scratch."
-	. S X=$$YN("Are you sure you want to continue?","NO")
-	. I X'="Y" S GO=0 Q
-	I 'GO Q
-	W !!?7,"Now enter search logic for this List.  To do this, the program"
-	W !?7,"will prompt you just as if you were going to run a Fileman Search."
-	W !?7,"When prompted STORE RESULTS OF SEARCH IN TEMPLATE:, answer with 'TEMP'"
-	W !?7,"If prompted ... OK TO PURGE? NO// answer 'YES'; don't bother specifying"
-	W !?7,"output print fields, but just RETURN through all the prompts to"
-	W !?7,"complete the process.  The search definition will be saved as part"
-	W !?7,"of this List definition; you will test it out by running it from "
-	W !?7,"the workstation.  If you need to modify the search logic, you will"
-	W !?7,"have to re-enter it in its entirety."
-	W !!?7,"NOTES: EXAM LOCK INDICATOR will not work for search logic;"
-	W !?14,"REMOTE CACHE INDICATOR only works for Null/Not Null logic."
-	S DIC=2006.634 D EN^DIS  ; call Fman Search Logic routine. It will store search logic in ^DIBT
-	; 2006.634 is intentional--don't change this!
-	I '$G(DIARI) W !!," Search logic NOT updated" D  Q
-	. Q:'$D(@GREF@(5,1))  ; if no logic had existed, quit
-	. S X=$$YN("Do you want to DELETE the search logic?","NO")
-	. I X="Y" K @GREF@(3) K ^(4),^(5) W " -- Deleted!"
-	K @GREF@(3) K ^(4),^(5)
-	S GLIN=$NA(^DIBT(DIARI))  ; Copy logic to 2006.631 DEF nodes
-	S FNOD="DC",TNOD=3,CT=0  ; "DC" data--straight copy
-	S T=0 F  S T=$O(@GLIN@(FNOD,T)) Q:T=""  S X=^(T),CT=CT+1,@GREF@(TNOD,T)=X
-	S @GREF@(TNOD,0)=CT
-	S FNOD="DL",TNOD=4,CT=0  ; "DL" data--copy depends on storage scheme in DIBT:
-	;Zero node null -- straight copy
-	; Else 1) either only one condition is defined;
-	; or, 2) the zero-node condition is ANDed with all defined conditions
-	;  Case 2: Var A -- Pre-pend zero node, then dup zero node
-	;            Var B -- Pre-pend zero node
-	S NCOND=+$G(@GLIN@(FNOD))
-	I $G(@GLIN@(FNOD,0))]"" S NODE0=^(0) D
-	. S T=0 F  S T=$O(@GLIN@(FNOD,T)) Q:T=""  S X=^(T) I X]"" S CT=CT+1,@GREF@(TNOD,CT)=NODE0_X
-	. I CT'=NCOND S CT=CT+1,@GREF@(TNOD,CT)=NODE0_$S(CT=1:"",1:"^")
-	E  D
-	. S T=0 F  S T=$O(@GLIN@(FNOD,T)) Q:T=""  S X=^(T) I X]"" S CT=CT+1,@GREF@(TNOD,CT)=X
-	S @GREF@(TNOD,0)=CT
-	; readable text--straight copy
-	S TNOD=5,T=0 F  S T=$O(@GLIN@("O",T)) Q:T=""  S @GREF@(TNOD,T)=^(T,0)
-	Q
-	;
-BLDDEF(LSTID)	; build DEF nodes for Column/Sort defs
-	N QX,SS,STR,LSTHDR,T,T0,T8,T6,HASCASE,XT,HASDATE
-	S SS=0,HASCASE=0,HASDATE=0
-	; columns/hdrs: Order in T array by the Relative Column Order
-	F  S SS=$O(^MAG(2006.631,LSTID,1,SS)) D  Q:'SS
-	. I 'SS D  Q
-	. . I 'HASCASE S X=1 D BLDDEF2(X)  ; FORCE CASE#
-	. . I 'HASDATE S X=7 D BLDDEF2(X)  ; DATE/TIME
-	. E  S X=^MAG(2006.631,LSTID,1,SS,0)
-	. D BLDDEF2(X)
-	; go thru T to build ordered field sequence for output columns
-	S QX="T",STR="",LSTHDR=""
-	F  S QX=$Q(@QX) Q:QX=""  S X=@QX D
-	. S STR=STR_$S(STR="":"",1:U)_$P(X,U)
-	. S LSTHDR=LSTHDR_$S(LSTHDR="":"",1:U)_$P(X,U,2)
-	S ^MAG(2006.631,LSTID,"DEF",.5)=LSTHDR,^(1)=STR
-	; Sort values:
-	S SS=0,STR=""
-	F  S SS=$O(^MAG(2006.631,LSTID,2,SS)) Q:'SS  S X=^(SS,0) D
-	. S X=+X_$S($P(X,U,2):"-",1:"")
-	. S STR=STR_$S(STR="":"",1:U)_X
-	S ^MAG(2006.631,LSTID,"DEF",2)=STR
-	S $P(^MAG(2006.631,LSTID,"DEF",0),U)=$$NOW^XLFDT()
-	Q
-	;
-BLDDEF2(X)	;
-	S X=+X_$S($P(X,U,2):";"_+$P(X,U,2),1:"")
-	I 'HASCASE S HASCASE=(+X=1)
-	I 'HASDATE S HASDATE=(+X=7)
-	S T0=^MAG(2006.63,+X,0),T6=+$P(T0,U,6) S:'T6 T6=99
-	S T8=$P(T0,U,8) I T8]"" S T8="~"_T8
-	S XT=$S($P(T0,U,3)]"":$P(T0,U,3),1:$P(T0,U,2))_T8
-	S $P(XT,"~",3)=+X
-	S T(T6,+X)=X_U_XT
-	Q
-	;
-PRE	; init 2006.63 prior to KIDS install
-	N DIK,DA S DIK="^MAG(2006.63,",DA=0 F  S DA=$O(@(DIK_DA_")")) Q:'DA  D ^DIK
-	Q
-	;
-P18	; Patch 18 inits
-	D BLDALL
-	D POST
-	Q
-	;
-BLDALL	; Create "DEF" nodes, Button labels List Def'ns
-	; Updates all lists after s/w update list defs are installed
-	N SS,LSTDAT,LSTNUM,BUTTON,LSTTYP
-	S SS=0
-	F  S SS=$O(^MAG(2006.631,SS)) Q:'SS  S LSTDAT=$G(^(SS,0)) I LSTDAT]"" D
-	. S LSTNUM=$P(LSTDAT,U,2),BUTTON=$P(LSTDAT,U,7),LSTTYP=$P(LSTDAT,U,3)
-	. I LSTNUM>9900!$P(LSTDAT,U,6) D BLDDEF(SS)  ; build DEF nodes for System Lists & any Enabled lists
-	. I BUTTON="",(LSTTYP]"") D   ; Create Button Labels if needed
-	. . S BUTTON=$S(LSTTYP="U":"Unread #",LSTTYP="R":"Recent #",LSTTYP="A":"All Active #",LSTTYP="P":"Pending #",1:"List #")_LSTNUM
-	. . S $P(^MAG(2006.631,SS,0),U,7)=BUTTON
-	Q
-	;
-POST	; Install msg
-	D INS^MAGQBUT4(XPDNM,DUZ,$$NOW^XLFDT,XPDA)
-	Q
-	;
-YN(MSG,DFLT)	; get Yes/No reply
-	N X I $G(DFLT)="" S DFLT="N"
-	W !
-	S DFLT=$E(DFLT),DFLT=$S(DFLT="N":"NO",1:"YES")
-YN1	W !,MSG_" "_DFLT_"// "
-	R X:DTIME S:X="" X=DFLT S X=$E(X),X=$TR(X,"ynYN","YNYN")
-	I "YN"'[X W "  ??? Enter YES or NO",! G YN1
-	Q X
-	;
-LSTINQ	; Inq/Disp list def'n
-	N GREF,MAGIEN
-	W !!?15,"Display VistARad Exams List Definition",!!
-	N MAGIEN
-	S DIC=2006.631,DIC(0)="AMEQ"
-	D ^DIC I Y=-1 K DIC,DA,DR Q
-	K DR S DA=+Y,MAGIEN=DA
-	S GREF=$NA(^MAG(2006.631,MAGIEN,"DEF"))
-	W ! D EN^DIQ
-	R !,"Enter RETURN to display the Search Logic: ",X:DTIME W !
-	D DISPSRCH(GREF)
-	G LSTINQ
-	Q
-	;
-DISPSRCH(GREF)	; GREF holds indirect ref for global holding search logic data
-	I $D(@GREF@(5,1)) W !,"List Exams where:",! D
-	. F I=1:1 Q:'$D(@GREF@(5,I))  W !?3,^(I)
-	E  W !?3,"NO Search Logic defined!"
-	Q
-	;
-VRSIT	;
-	W @IOF,!!?10,"Enter/Edit VistARad Site Parameters",!!
-	S DIC=2006.69,DIC(0)="ALMEQ"
-	I '$D(^MAG(DIC,1)) S DLAYGO=DIC
-	D ^DIC I Y=-1 K DIC,DA,DR,DIE,DLAYGO Q
-	S DIE=2006.69,DA=+Y,DR=".01:3.99;4.1:20"
-	D ^DIE
-	K DIC,DA,DR,DIE,DLAYGO
-	N PLACE S DA=""
-	S PLACE=$$PLACE^MAGBAPI(+$G(DUZ(2)))
-	S:PLACE DA=PLACE
-	I DA D
-	. W !!,"Editing VistARad Timeout for division #",DUZ(2),!
-	. S DIE=2006.1,DR="123" D ^DIE
-	K DA,DR,DIE
-	Q
-	;
-EEPREF	;
-	W @IOF,!!?10,"Enter/Edit VistARad Prefetch Logic",!!
-	N MAGIEN
-	K DIC S (DIC,DLAYGO)=2006.65,DIC(0)="ALMEQ"
-	D ^DIC I Y=-1 K DIC,DIE,DR,DLAYGO Q
-	S DIE=2006.65,DA=+Y,DR="[MAGJ PRIOR EDIT]"
-	S MAGIEN=DA
-	D ^DIE I '$D(DA) G EEPREF
-	G EEPREF
-	Q
-INPREF	; Inquire VRad PreFetch
-	W @IOF,!!?10,"Inquire VistARad Prefetch Logic",!!
-	N MAGIEN,BY,FR,TO
-	S DIC=2006.65,DIC(0)="AMEQ"
-	D ^DIC I Y=-1 K DIC Q
-	S DA=+Y,(FR,TO)=$P(Y,U,2),MAGIEN=DA,L=0
-	S BY="[MAGJ PRIOR SORT]",DIS(0)="I D0=MAGIEN"
-	D EN^DIP
-	R !,"Enter RETURN to continue: ",X:DTIME W !
-	G INPREF
-	Q
-PRPREF	;Print VRad Prefetch
-	N BY
-	W !! S DIC=2006.65,L=0,BY="[MAGJ PRIOR SORT]"
-	D EN1^DIP
-	R !,"Enter RETURN to continue: ",X:DTIME W !
-	Q
-	;
-END	;
+MAGJMN1 ;WIRMFO/JHC VRad Maint functions ; 29 Jul 2003  4:02 PM
+ ;;3.0;IMAGING;**16,9,22,18,65**;Jul 27, 2006;Build 28
+ ;;Per VHA Directive 2004-038, this routine should not be modified.
+ ;; +---------------------------------------------------------------+
+ ;; | Property of the US Government.                                |
+ ;; | No permission to copy or redistribute this software is given. |
+ ;; | Use of unreleased versions of this software requires the user |
+ ;; | to execute a written test agreement with the VistA Imaging    |
+ ;; | Development Office of the Department of Veterans Affairs,     |
+ ;; | telephone (301) 734-0100.                                     |
+ ;; |                                                               |
+ ;; | The Food and Drug Administration classifies this software as  |
+ ;; | a medical device.  As such, it may not be changed in any way. |
+ ;; | Modifications to this software may result in an adulterated   |
+ ;; | medical device under 21CFR820, the use of which is considered |
+ ;; | to be a violation of US Federal Statutes.                     |
+ ;; +---------------------------------------------------------------+
+ ;;
+ Q
+ ;
+SVRLIST ;
+ W @IOF,!!?10,"Enter/Edit VistARad Exams List Definition",!!
+ N MAGIEN
+ K DIC S (DIC,DLAYGO)=2006.631,DIC(0)="ALMEQ"
+ D ^DIC I Y=-1 K DIC,DA,DR,DIE,DLAYGO Q
+ S X=$P(@(DIC_+Y_",0)"),U,2)
+ I X>9000 W !!,$C(7),"You may not edit System-Supplied files!" H 3 G SVRLIST
+ S DIE=2006.631,DA=+Y,DR="[MAGJ LIST EDIT]"
+ S MAGIEN=DA
+ D ^DIE I '$D(DA) G SVRLIST
+ D ENSRCH
+ D BLDDEF(MAGIEN)
+ D NOW^%DTC S $P(^MAG(2006.631,MAGIEN,0),U,5)=%
+ W !!,"List Definition complete!" R X:2
+ G SVRLIST
+ Q
+ENSRCH ; Invoke Search for 2006.631 def'n
+ N GREF,GLIN,GO,CT,DIARI,DIC,FNOD,TNOD,NCOND,NODE0
+ ; GREF holds indirect ref to store search logic data:
+ ; @GREF@(3, ff -- conditional elements (fields/logic)
+ ; @GREF@(4, ff -- composite elements (ANDed conditions)
+ ; @GREF@(5, ff -- Human-readable search text
+ ; GLIN holds indirect ref to retrieve search logic data from ^DIBT
+ ; @GLIN@("DC", ff -- conditional elements
+ ; @GLIN@("DL", ff -- composite elements
+ ; @GLIN@("O", ff -- readable text
+ S GREF=$NA(^MAG(2006.631,MAGIEN,"DEF"))
+ S GO=1 I $D(@GREF@(5,1)) D  ; show current logic
+ . W ! D DISPSRCH(GREF)
+ . S X=$$YN("Do you want to delete or re-enter the search logic?","NO")
+ . I X'="Y" S GO=0 Q
+ . W !!?7,"Re-entering the search logic requires first deleting the current",!?7,"definition, then entering the new definition from scratch."
+ . S X=$$YN("Are you sure you want to continue?","NO")
+ . I X'="Y" S GO=0 Q
+ I 'GO Q
+ W !!?7,"Now enter search logic for this List.  To do this, the program"
+ W !?7,"will prompt you just as if you were going to run a Fileman Search."
+ W !?7,"When prompted STORE RESULTS OF SEARCH IN TEMPLATE:, answer with 'TEMP'"
+ W !?7,"If prompted ... OK TO PURGE? NO// answer 'YES'; don't bother specifying"
+ W !?7,"output print fields, but just RETURN through all the prompts to"
+ W !?7,"complete the process.  The search definition will be saved as part"
+ W !?7,"of this List definition; you will test it out by running it from "
+ W !?7,"the workstation.  If you need to modify the search logic, you will"
+ W !?7,"have to re-enter it in its entirety."
+ W !!?7,"NOTES: EXAM LOCK INDICATOR will not work for search logic;"
+ W !?14,"REMOTE CACHE INDICATOR only works for Null/Not Null logic."
+ S DIC=2006.634 D EN^DIS  ; call Fman Search Logic routine. It will store search logic in ^DIBT
+ ; 2006.634 is intentional--don't change this!
+ I '$G(DIARI) W !!," Search logic NOT updated" D  Q
+ . Q:'$D(@GREF@(5,1))  ; if no logic had existed, quit
+ . S X=$$YN("Do you want to DELETE the search logic?","NO")
+ . I X="Y" K @GREF@(3) K ^(4),^(5) W " -- Deleted!"
+ K @GREF@(3) K ^(4),^(5)
+ S GLIN=$NA(^DIBT(DIARI))  ; Copy logic to 2006.631 DEF nodes
+ S FNOD="DC",TNOD=3,CT=0  ; "DC" data--straight copy
+ S T=0 F  S T=$O(@GLIN@(FNOD,T)) Q:T=""  S X=^(T),CT=CT+1,@GREF@(TNOD,T)=X
+ S @GREF@(TNOD,0)=CT
+ S FNOD="DL",TNOD=4,CT=0  ; "DL" data--copy depends on storage scheme in DIBT:
+ ;Zero node null -- straight copy
+ ; Else 1) either only one condition is defined;
+ ; or, 2) the zero-node condition is ANDed with all defined conditions
+ ;  Case 2: Var A -- Pre-pend zero node, then dup zero node
+ ;            Var B -- Pre-pend zero node
+ S NCOND=+$G(@GLIN@(FNOD))
+ I $G(@GLIN@(FNOD,0))]"" S NODE0=^(0) D
+ . S T=0 F  S T=$O(@GLIN@(FNOD,T)) Q:T=""  S X=^(T) I X]"" S CT=CT+1,@GREF@(TNOD,CT)=NODE0_X
+ . I CT'=NCOND S CT=CT+1,@GREF@(TNOD,CT)=NODE0_$S(CT=1:"",1:"^")
+ E  D
+ . S T=0 F  S T=$O(@GLIN@(FNOD,T)) Q:T=""  S X=^(T) I X]"" S CT=CT+1,@GREF@(TNOD,CT)=X
+ S @GREF@(TNOD,0)=CT
+ ; readable text--straight copy
+ S TNOD=5,T=0 F  S T=$O(@GLIN@("O",T)) Q:T=""  S @GREF@(TNOD,T)=^(T,0)
+ Q
+ ;
+BLDDEF(LSTID) ; build DEF nodes for Column/Sort defs
+ N QX,SS,STR,LSTHDR,T,T0,T8,T6,HASCASE,XT,HASDATE
+ S SS=0,HASCASE=0,HASDATE=0
+ ; columns/hdrs: Order in T array by the Relative Column Order
+ F  S SS=$O(^MAG(2006.631,LSTID,1,SS)) D  Q:'SS
+ . I 'SS D  Q
+ . . I 'HASCASE S X=1 D BLDDEF2(X)  ; FORCE CASE#
+ . . I 'HASDATE S X=7 D BLDDEF2(X)  ; DATE/TIME
+ . E  S X=^MAG(2006.631,LSTID,1,SS,0)
+ . D BLDDEF2(X)
+ ; go thru T to build ordered field sequence for output columns
+ S QX="T",STR="",LSTHDR=""
+ F  S QX=$Q(@QX) Q:QX=""  S X=@QX D
+ . S STR=STR_$S(STR="":"",1:U)_$P(X,U)
+ . S LSTHDR=LSTHDR_$S(LSTHDR="":"",1:U)_$P(X,U,2)
+ S ^MAG(2006.631,LSTID,"DEF",.5)=LSTHDR,^(1)=STR
+ ; Sort values:
+ S SS=0,STR=""
+ F  S SS=$O(^MAG(2006.631,LSTID,2,SS)) Q:'SS  S X=^(SS,0) D
+ . S X=+X_$S($P(X,U,2):"-",1:"")
+ . S STR=STR_$S(STR="":"",1:U)_X
+ S ^MAG(2006.631,LSTID,"DEF",2)=STR
+ D NOW^%DTC S $P(^MAG(2006.631,LSTID,"DEF",0),U)=%
+ Q
+ ;
+BLDDEF2(X) ;
+ S X=+X_$S($P(X,U,2):";"_+$P(X,U,2),1:"")
+ I 'HASCASE S HASCASE=(+X=1)
+ I 'HASDATE S HASDATE=(+X=7)
+ S T0=^MAG(2006.63,+X,0),T6=+$P(T0,U,6) S:'T6 T6=99
+ S T8=$P(T0,U,8) I T8]"" S T8="~"_T8
+ S XT=$S($P(T0,U,3)]"":$P(T0,U,3),1:$P(T0,U,2))_T8
+ S $P(XT,"~",3)=+X
+ S T(T6,+X)=X_U_XT
+ Q
+ ;
+PRE ; init 2006.63 prior to KIDS install
+ N DIK,DA S DIK="^MAG(2006.63,",DA=0 F  S DA=$O(@(DIK_DA_")")) Q:'DA  D ^DIK
+ Q
+ ;
+P18 ; Patch 18 inits
+ D BLDALL
+ D POST
+ Q
+ ;
+BLDALL ; Create "DEF" nodes, Button labels List Def'ns
+ ; Updates all lists after s/w update list defs are installed
+ N SS,LSTDAT,LSTNUM,BUTTON,LSTTYP
+ S SS=0
+ F  S SS=$O(^MAG(2006.631,SS)) Q:'SS  S LSTDAT=$G(^(SS,0)) I LSTDAT]"" D
+ . S LSTNUM=$P(LSTDAT,U,2),BUTTON=$P(LSTDAT,U,7),LSTTYP=$P(LSTDAT,U,3)
+ . I LSTNUM>9900!$P(LSTDAT,U,6) D BLDDEF(SS)  ; build DEF nodes for System Lists & any Enabled lists
+ . I BUTTON="",(LSTTYP]"") D   ; Create Button Labels if needed
+ . . S BUTTON=$S(LSTTYP="U":"Unread #",LSTTYP="R":"Recent #",LSTTYP="A":"All Active #",LSTTYP="P":"Pending #",1:"List #")_LSTNUM
+ . . S $P(^MAG(2006.631,SS,0),U,7)=BUTTON
+ Q
+ ;
+POST ; Install msg
+ D INS^MAGQBUT4(XPDNM,DUZ,$$NOW^XLFDT,XPDA)
+ Q
+ ;
+YN(MSG,DFLT) ; get Yes/No reply
+ N X I $G(DFLT)="" S DFLT="N"
+ W !
+ S DFLT=$E(DFLT),DFLT=$S(DFLT="N":"NO",1:"YES")
+YN1 W !,MSG_" "_DFLT_"// "
+ R X:DTIME S:X="" X=DFLT S X=$E(X),X=$TR(X,"ynYN","YNYN")
+ I "YN"'[X W "  ??? Enter YES or NO",! G YN1
+ Q X
+ ;
+LSTINQ ; Inq/Disp list def'n
+ N GREF,MAGIEN
+ W !!?15,"Display VistARad Exams List Definition",!!
+ N MAGIEN
+ S DIC=2006.631,DIC(0)="AMEQ"
+ D ^DIC I Y=-1 K DIC,DA,DR Q
+ K DR S DA=+Y,MAGIEN=DA
+ S GREF=$NA(^MAG(2006.631,MAGIEN,"DEF"))
+ W ! D EN^DIQ
+ R !,"Enter RETURN to display the Search Logic: ",X:DTIME W !
+ D DISPSRCH(GREF)
+ G LSTINQ
+ Q
+ ;
+DISPSRCH(GREF) ; GREF holds indirect ref for global holding search logic data
+ I $D(@GREF@(5,1)) W !,"List Exams where:",! D
+ . F I=1:1 Q:'$D(@GREF@(5,I))  W !?3,^(I)
+ E  W !?3,"NO Search Logic defined!"
+ Q
+ ;
+VRSIT ;
+ W @IOF,!!?10,"Enter/Edit VistARad Site Parameters",!!
+ S DIC=2006.69,DIC(0)="ALMEQ"
+ I '$D(^MAG(DIC,1)) S DLAYGO=DIC
+ D ^DIC I Y=-1 K DIC,DA,DR,DIE,DLAYGO Q
+ S DIE=2006.69,DA=+Y,DR=".01:3.99;4.1:20"
+ D ^DIE
+ K DIC,DA,DR,DIE,DLAYGO
+ N PLACE S DA=""
+ S PLACE=$$PLACE^MAGBAPI(+$G(DUZ(2)))
+ S:PLACE DA=PLACE
+ I DA D
+ . W !!,"Editing VistARad Timeout for division #",DUZ(2),!
+ . S DIE=2006.1,DR="123" D ^DIE
+ K DA,DR,DIE
+ Q
+ ;
+EEPREF ;
+ W @IOF,!!?10,"Enter/Edit VistARad Prefetch Logic",!!
+ N MAGIEN
+ K DIC S (DIC,DLAYGO)=2006.65,DIC(0)="ALMEQ"
+ D ^DIC I Y=-1 K DIC,DIE,DR,DLAYGO Q
+ S DIE=2006.65,DA=+Y,DR="[MAGJ PRIOR EDIT]"
+ S MAGIEN=DA
+ D ^DIE I '$D(DA) G EEPREF
+ G EEPREF
+ Q
+INPREF ; Inquire VRad PreFetch
+ W @IOF,!!?10,"Inquire VistARad Prefetch Logic",!!
+ N MAGIEN,BY,FR,TO
+ S DIC=2006.65,DIC(0)="AMEQ"
+ D ^DIC I Y=-1 K DIC Q
+ S DA=+Y,(FR,TO)=$P(Y,U,2),MAGIEN=DA,L=0
+ S BY="[MAGJ PRIOR SORT]",DIS(0)="I D0=MAGIEN"
+ D EN^DIP
+ R !,"Enter RETURN to continue: ",X:DTIME W !
+ G INPREF
+ Q
+PRPREF ;Print VRad Prefetch
+ N BY
+ W !! S DIC=2006.65,L=0,BY="[MAGJ PRIOR SORT]"
+ D EN1^DIP
+ R !,"Enter RETURN to continue: ",X:DTIME W !
+ Q
+ ;
+END ;
