MAGGTSY ;WOIFO/GEK - Imaging Utilities ; [ 06/20/2001 08:57 ]
;;3.0;IMAGING;;Mar 01, 2002
;; +---------------------------------------------------------------+
;; | 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
WRKS(MAGRY,ZY) ;RPC Call for MAGSYS utility. List of Workstation Information.
S ^TMP("MAGGTSY","ZY")=ZY
;
N DTFR,DTTO,PACI,ACI,CT,X,Y,Z,MAGX,MAGIEN,MAGTIEN
; $P(ZY,U,1) is the Computer Name running MAGSYS. we need to know this
; in case the same computer is also logged onto Imaging.
;
I $L($P(ZY,"^",1)) S MAGTIEN=$O(^MAG(2006.81,"B",$P(ZY,"^",1),""))
S DTFR=+$P(ZY,U,2),DTTO=+$P(ZY,U,3)
I DTFR>DTTO S X=DTFR,DTFR=DTTO,DTTO=X
I DTTO=0 S DTTO=9999999
S DTTO=DTTO_".9999"
D CHECKCON
S MAGRY=$NA(^TMP($J,"MAGWRKS"))
K ^TMP($J,"MAGWRKS")
K ^TMP($J,"MAGWSES")
S I=0,CT=1
S ACI="L"_DTTO
I ($P(ZY,U,4)="last")!($P(ZY,U,4)="") D
. F S ACI=$O(^MAG(2006.81,"AC",ACI),-1) S PACI=$E(ACI,2,99) Q:PACI<DTFR D
. . S I="" F S I=$O(^MAG(2006.81,"AC",ACI,I)) Q:'I D INFO(I,.Y) S CT=CT+1,@MAGRY@(CT)=Y
I $P(ZY,U,4)="any" D
. F S ACI=$O(^MAG(2006.82,"AC",ACI),-1) S PACI=$E(ACI,2,99) Q:PACI<DTFR D
. . S I=$O(^MAG(2006.82,"AC",ACI,"")) S J=$P(^MAG(2006.82,I,0),U,5)
. . I $D(^MAG(2006.81,J)) S ^TMP($J,"MAGWSES",J)=""
;
I $D(^TMP($J,"MAGWSES")) D
. S I="" F S I=$O(^TMP($J,"MAGWSES",I)) Q:'I D INFO(I,.Y) S CT=CT+1,@MAGRY@(CT)=Y
I CT=1 S @MAGRY@(0)="0^No workstation logons for reqested dates." Q
S @MAGRY@(0)=(CT-1)_"^Workstations logged on during requested data range."
S @MAGRY@(1)="Computer Name^Last Logon^Last User^Active^Service/Section^IMGVWP10.EXE^Logoff^Display Ver^Capture Ver^MAGSETUP.EXE^TELE19N.EXE^Err^Sess #"
;
Q
INFO(I,Y) ;Returns info for a Workstation in the IMAGING WINDOWS
; WORKSTATION file ^MAG(2006.81
; Y is passed by reference, we create an '^' delimited string
; of workstation info.
;
N M,Z,MDUZ
S M=^MAG(2006.81,I,0)
S Y=$P(M,U,1) ; Computer Name
S MDUZ=$P(M,U,2)_","
S Y=Y_U_$$OUTDT($P(M,U,3)) ;Date of Last Logon, by a user.
;
D GETS^DIQ(200,MDUZ,".01;29","IE","Z","")
;
S Y=Y_U_Z(200,MDUZ,".01","E") ;Last User
S Y=Y_U_$S($P(M,U,8):"Active",1:"-") ;Active or Not
S Y=Y_U_Z(200,MDUZ,"29","E") ;Service/Section
;S Y=Y_U_$P(^VA(200,$P(M,U,2),0),U,1) ; Last User Name
S Y=Y_U_$$OUTDT($P(M,U,6)) ;Date of Display exe last used.
S Y=Y_U_$$OUTDT($P(M,U,4)) ;Date/Time of Last Logoff.
S Y=Y_U_$P(M,U,9) ; Display Version IMGVWP10.EXE
S Y=Y_U_$P(M,U,13) ; Capture Version info TELE19N.EXE
S Y=Y_U_$$OUTDT($P(M,U,7)) ;Date of MAGSETUP.EXE last run on this wrks.
S Y=Y_U_$$OUTDT($P(M,U,5)) ;Date of Capture exe last used.
;S Y=Y_U_$P(M,U,11) ; current session error count.
; COUNT ERRORS FROM IMAGING WINDOWS SESSION FILE MULTIPLE
S X=$O(^MAG(2006.82,"C",I,""),-1)
S Y=Y_U_$P($G(^MAG(2006.82,X,"ERR",0)),U,3)
S Y=Y_U_$E(" ",1,(6-$L($P(M,U,12))))_$P(M,U,12) ;Sess Ct for Wrks
S Y=Y_U_I ; WRKS IEN ^MAG(2006,81,I"
Q
OUTDT(Z) ;
I 'Z Q Z
S X=$$FMTE^XLFDT(Z,4)
S MAGTM=$P(X,"@",2)
;
;Q $E(Z,1,3)+1700_" "_$E(Z,4,5)_"/"_$E(Z,6,7)
Q $E(Z,2,3)_"/"_$E(Z,4,5)_"/"_$E(Z,6,7)_" "_MAGTM
; Let's use Kernel date/time functions
;;;Q $$FMTE^XLFDT(Z,"2P")
Q
CHECKCON ;
S I=0
F S I=$O(^MAG(2006.81,I)) Q:'I D
. I $G(MAGTIEN)=I Q
. L +^MAG(2006.81,"LOCK",I):0 I $T D
. . L -^MAG(2006.81,"LOCK",I) S $P(^MAG(2006.81,I,0),U,8)=0
Q
CLEAR ; UTIL TO CLEAR THE WORKSTATION FILE OUT,
W !,"This will clear all workstations not currently connected from the Imaging Windows Workstation file ",!," OK To proced ? Y/N Y//"
R X:$G(DTIME,300) I '("Yy"[X) W !!,"CANCELED !. BYE" Q
S I=0,CT=1
F S I=$O(^MAG(2006.81,I)) Q:'I D
. W !,I
. I $P(^MAG(2006.81,I,0),U,8)=1 W " In use." Q
. W " Deleting..."
. S DIK="^MAG(2006.81,",DA=I D ^DIK
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGTSY 4760 printed Oct 16, 2024@18:04 Page 2
MAGGTSY ;WOIFO/GEK - Imaging Utilities ; [ 06/20/2001 08:57 ]
+1 ;;3.0;IMAGING;;Mar 01, 2002
+2 ;; +---------------------------------------------------------------+
+3 ;; | Property of the US Government. |
+4 ;; | No permission to copy or redistribute this software is given. |
+5 ;; | Use of unreleased versions of this software requires the user |
+6 ;; | to execute a written test agreement with the VistA Imaging |
+7 ;; | Development Office of the Department of Veterans Affairs, |
+8 ;; | telephone (301) 734-0100. |
+9 ;; | |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
WRKS(MAGRY,ZY) ;RPC Call for MAGSYS utility. List of Workstation Information.
+1 SET ^TMP("MAGGTSY","ZY")=ZY
+2 ;
+3 NEW DTFR,DTTO,PACI,ACI,CT,X,Y,Z,MAGX,MAGIEN,MAGTIEN
+4 ; $P(ZY,U,1) is the Computer Name running MAGSYS. we need to know this
+5 ; in case the same computer is also logged onto Imaging.
+6 ;
+7 IF $LENGTH($PIECE(ZY,"^",1))
SET MAGTIEN=$ORDER(^MAG(2006.81,"B",$PIECE(ZY,"^",1),""))
+8 SET DTFR=+$PIECE(ZY,U,2)
SET DTTO=+$PIECE(ZY,U,3)
+9 IF DTFR>DTTO
SET X=DTFR
SET DTFR=DTTO
SET DTTO=X
+10 IF DTTO=0
SET DTTO=9999999
+11 SET DTTO=DTTO_".9999"
+12 DO CHECKCON
+13 SET MAGRY=$NAME(^TMP($JOB,"MAGWRKS"))
+14 KILL ^TMP($JOB,"MAGWRKS")
+15 KILL ^TMP($JOB,"MAGWSES")
+16 SET I=0
SET CT=1
+17 SET ACI="L"_DTTO
+18 IF ($PIECE(ZY,U,4)="last")!($PIECE(ZY,U,4)="")
Begin DoDot:1
+19 FOR
SET ACI=$ORDER(^MAG(2006.81,"AC",ACI),-1)
SET PACI=$EXTRACT(ACI,2,99)
if PACI<DTFR
QUIT
Begin DoDot:2
+20 SET I=""
FOR
SET I=$ORDER(^MAG(2006.81,"AC",ACI,I))
if 'I
QUIT
DO INFO(I,.Y)
SET CT=CT+1
SET @MAGRY@(CT)=Y
End DoDot:2
End DoDot:1
+21 IF $PIECE(ZY,U,4)="any"
Begin DoDot:1
+22 FOR
SET ACI=$ORDER(^MAG(2006.82,"AC",ACI),-1)
SET PACI=$EXTRACT(ACI,2,99)
if PACI<DTFR
QUIT
Begin DoDot:2
+23 SET I=$ORDER(^MAG(2006.82,"AC",ACI,""))
SET J=$PIECE(^MAG(2006.82,I,0),U,5)
+24 IF $DATA(^MAG(2006.81,J))
SET ^TMP($JOB,"MAGWSES",J)=""
End DoDot:2
End DoDot:1
+25 ;
+26 IF $DATA(^TMP($JOB,"MAGWSES"))
Begin DoDot:1
+27 SET I=""
FOR
SET I=$ORDER(^TMP($JOB,"MAGWSES",I))
if 'I
QUIT
DO INFO(I,.Y)
SET CT=CT+1
SET @MAGRY@(CT)=Y
End DoDot:1
+28 IF CT=1
SET @MAGRY@(0)="0^No workstation logons for reqested dates."
QUIT
+29 SET @MAGRY@(0)=(CT-1)_"^Workstations logged on during requested data range."
+30 SET @MAGRY@(1)="Computer Name^Last Logon^Last User^Active^Service/Section^IMGVWP10.EXE^Logoff^Display Ver^Capture Ver^MAGSETUP.EXE^TELE19N.EXE^Err^Sess #"
+31 ;
+32 QUIT
INFO(I,Y) ;Returns info for a Workstation in the IMAGING WINDOWS
+1 ; WORKSTATION file ^MAG(2006.81
+2 ; Y is passed by reference, we create an '^' delimited string
+3 ; of workstation info.
+4 ;
+5 NEW M,Z,MDUZ
+6 SET M=^MAG(2006.81,I,0)
+7 ; Computer Name
SET Y=$PIECE(M,U,1)
+8 SET MDUZ=$PIECE(M,U,2)_","
+9 ;Date of Last Logon, by a user.
SET Y=Y_U_$$OUTDT($PIECE(M,U,3))
+10 ;
+11 DO GETS^DIQ(200,MDUZ,".01;29","IE","Z","")
+12 ;
+13 ;Last User
SET Y=Y_U_Z(200,MDUZ,".01","E")
+14 ;Active or Not
SET Y=Y_U_$SELECT($PIECE(M,U,8):"Active",1:"-")
+15 ;Service/Section
SET Y=Y_U_Z(200,MDUZ,"29","E")
+16 ;S Y=Y_U_$P(^VA(200,$P(M,U,2),0),U,1) ; Last User Name
+17 ;Date of Display exe last used.
SET Y=Y_U_$$OUTDT($PIECE(M,U,6))
+18 ;Date/Time of Last Logoff.
SET Y=Y_U_$$OUTDT($PIECE(M,U,4))
+19 ; Display Version IMGVWP10.EXE
SET Y=Y_U_$PIECE(M,U,9)
+20 ; Capture Version info TELE19N.EXE
SET Y=Y_U_$PIECE(M,U,13)
+21 ;Date of MAGSETUP.EXE last run on this wrks.
SET Y=Y_U_$$OUTDT($PIECE(M,U,7))
+22 ;Date of Capture exe last used.
SET Y=Y_U_$$OUTDT($PIECE(M,U,5))
+23 ;S Y=Y_U_$P(M,U,11) ; current session error count.
+24 ; COUNT ERRORS FROM IMAGING WINDOWS SESSION FILE MULTIPLE
+25 SET X=$ORDER(^MAG(2006.82,"C",I,""),-1)
+26 SET Y=Y_U_$PIECE($GET(^MAG(2006.82,X,"ERR",0)),U,3)
+27 ;Sess Ct for Wrks
SET Y=Y_U_$EXTRACT(" ",1,(6-$LENGTH($PIECE(M,U,12))))_$PIECE(M,U,12)
+28 ; WRKS IEN ^MAG(2006,81,I"
SET Y=Y_U_I
+29 QUIT
OUTDT(Z) ;
+1 IF 'Z
QUIT Z
+2 SET X=$$FMTE^XLFDT(Z,4)
+3 SET MAGTM=$PIECE(X,"@",2)
+4 ;
+5 ;Q $E(Z,1,3)+1700_" "_$E(Z,4,5)_"/"_$E(Z,6,7)
+6 QUIT $EXTRACT(Z,2,3)_"/"_$EXTRACT(Z,4,5)_"/"_$EXTRACT(Z,6,7)_" "_MAGTM
+7 ; Let's use Kernel date/time functions
+8 ;;;Q $$FMTE^XLFDT(Z,"2P")
+9 QUIT
CHECKCON ;
+1 SET I=0
+2 FOR
SET I=$ORDER(^MAG(2006.81,I))
if 'I
QUIT
Begin DoDot:1
+3 IF $GET(MAGTIEN)=I
QUIT
+4 LOCK +^MAG(2006.81,"LOCK",I):0
IF $TEST
Begin DoDot:2
+5 LOCK -^MAG(2006.81,"LOCK",I)
SET $PIECE(^MAG(2006.81,I,0),U,8)=0
End DoDot:2
End DoDot:1
+6 QUIT
CLEAR ; UTIL TO CLEAR THE WORKSTATION FILE OUT,
+1 WRITE !,"This will clear all workstations not currently connected from the Imaging Windows Workstation file ",!," OK To proced ? Y/N Y//"
+2 READ X:$GET(DTIME,300)
IF '("Yy"[X)
WRITE !!,"CANCELED !. BYE"
QUIT
+3 SET I=0
SET CT=1
+4 FOR
SET I=$ORDER(^MAG(2006.81,I))
if 'I
QUIT
Begin DoDot:1
+5 WRITE !,I
+6 IF $PIECE(^MAG(2006.81,I,0),U,8)=1
WRITE " In use."
QUIT
+7 WRITE " Deleting..."
+8 SET DIK="^MAG(2006.81,"
SET DA=I
DO ^DIK
End DoDot:1
+9 QUIT