Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MAGGTSY

MAGGTSY.m

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