source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGGTSY.m@ 1259

Last change on this file since 1259 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1MAGGTSY ;WOIFO/GEK - Imaging Utilities ; [ 06/20/2001 08:57 ]
2 ;;3.0;IMAGING;;Mar 01, 2002
3 ;; +---------------------------------------------------------------+
4 ;; | Property of the US Government. |
5 ;; | No permission to copy or redistribute this software is given. |
6 ;; | Use of unreleased versions of this software requires the user |
7 ;; | to execute a written test agreement with the VistA Imaging |
8 ;; | Development Office of the Department of Veterans Affairs, |
9 ;; | telephone (301) 734-0100. |
10 ;; | |
11 ;; | The Food and Drug Administration classifies this software as |
12 ;; | a medical device. As such, it may not be changed in any way. |
13 ;; | Modifications to this software may result in an adulterated |
14 ;; | medical device under 21CFR820, the use of which is considered |
15 ;; | to be a violation of US Federal Statutes. |
16 ;; +---------------------------------------------------------------+
17 ;;
18 Q
19WRKS(MAGRY,ZY) ;RPC Call for MAGSYS utility. List of Workstation Information.
20 S ^TMP("MAGGTSY","ZY")=ZY
21 ;
22 N DTFR,DTTO,PACI,ACI,CT,X,Y,Z,MAGX,MAGIEN,MAGTIEN
23 ; $P(ZY,U,1) is the Computer Name running MAGSYS. we need to know this
24 ; in case the same computer is also logged onto Imaging.
25 ;
26 I $L($P(ZY,"^",1)) S MAGTIEN=$O(^MAG(2006.81,"B",$P(ZY,"^",1),""))
27 S DTFR=+$P(ZY,U,2),DTTO=+$P(ZY,U,3)
28 I DTFR>DTTO S X=DTFR,DTFR=DTTO,DTTO=X
29 I DTTO=0 S DTTO=9999999
30 S DTTO=DTTO_".9999"
31 D CHECKCON
32 S MAGRY=$NA(^TMP($J,"MAGWRKS"))
33 K ^TMP($J,"MAGWRKS")
34 K ^TMP($J,"MAGWSES")
35 S I=0,CT=1
36 S ACI="L"_DTTO
37 I ($P(ZY,U,4)="last")!($P(ZY,U,4)="") D
38 . F S ACI=$O(^MAG(2006.81,"AC",ACI),-1) S PACI=$E(ACI,2,99) Q:PACI<DTFR D
39 . . 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
40 I $P(ZY,U,4)="any" D
41 . F S ACI=$O(^MAG(2006.82,"AC",ACI),-1) S PACI=$E(ACI,2,99) Q:PACI<DTFR D
42 . . S I=$O(^MAG(2006.82,"AC",ACI,"")) S J=$P(^MAG(2006.82,I,0),U,5)
43 . . I $D(^MAG(2006.81,J)) S ^TMP($J,"MAGWSES",J)=""
44 ;
45 I $D(^TMP($J,"MAGWSES")) D
46 . S I="" F S I=$O(^TMP($J,"MAGWSES",I)) Q:'I D INFO(I,.Y) S CT=CT+1,@MAGRY@(CT)=Y
47 I CT=1 S @MAGRY@(0)="0^No workstation logons for reqested dates." Q
48 S @MAGRY@(0)=(CT-1)_"^Workstations logged on during requested data range."
49 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 #"
50 ;
51 Q
52INFO(I,Y) ;Returns info for a Workstation in the IMAGING WINDOWS
53 ; WORKSTATION file ^MAG(2006.81
54 ; Y is passed by reference, we create an '^' delimited string
55 ; of workstation info.
56 ;
57 N M,Z,MDUZ
58 S M=^MAG(2006.81,I,0)
59 S Y=$P(M,U,1) ; Computer Name
60 S MDUZ=$P(M,U,2)_","
61 S Y=Y_U_$$OUTDT($P(M,U,3)) ;Date of Last Logon, by a user.
62 ;
63 D GETS^DIQ(200,MDUZ,".01;29","IE","Z","")
64 ;
65 S Y=Y_U_Z(200,MDUZ,".01","E") ;Last User
66 S Y=Y_U_$S($P(M,U,8):"Active",1:"-") ;Active or Not
67 S Y=Y_U_Z(200,MDUZ,"29","E") ;Service/Section
68 ;S Y=Y_U_$P(^VA(200,$P(M,U,2),0),U,1) ; Last User Name
69 S Y=Y_U_$$OUTDT($P(M,U,6)) ;Date of Display exe last used.
70 S Y=Y_U_$$OUTDT($P(M,U,4)) ;Date/Time of Last Logoff.
71 S Y=Y_U_$P(M,U,9) ; Display Version IMGVWP10.EXE
72 S Y=Y_U_$P(M,U,13) ; Capture Version info TELE19N.EXE
73 S Y=Y_U_$$OUTDT($P(M,U,7)) ;Date of MAGSETUP.EXE last run on this wrks.
74 S Y=Y_U_$$OUTDT($P(M,U,5)) ;Date of Capture exe last used.
75 ;S Y=Y_U_$P(M,U,11) ; current session error count.
76 ; COUNT ERRORS FROM IMAGING WINDOWS SESSION FILE MULTIPLE
77 S X=$O(^MAG(2006.82,"C",I,""),-1)
78 S Y=Y_U_$P($G(^MAG(2006.82,X,"ERR",0)),U,3)
79 S Y=Y_U_$E(" ",1,(6-$L($P(M,U,12))))_$P(M,U,12) ;Sess Ct for Wrks
80 S Y=Y_U_I ; WRKS IEN ^MAG(2006,81,I"
81 Q
82OUTDT(Z) ;
83 I 'Z Q Z
84 S X=$$FMTE^XLFDT(Z,4)
85 S MAGTM=$P(X,"@",2)
86 ;
87 ;Q $E(Z,1,3)+1700_" "_$E(Z,4,5)_"/"_$E(Z,6,7)
88 Q $E(Z,2,3)_"/"_$E(Z,4,5)_"/"_$E(Z,6,7)_" "_MAGTM
89 ; Let's use Kernel date/time functions
90 ;;;Q $$FMTE^XLFDT(Z,"2P")
91 Q
92CHECKCON ;
93 S I=0
94 F S I=$O(^MAG(2006.81,I)) Q:'I D
95 . I $G(MAGTIEN)=I Q
96 . L +^MAG(2006.81,"LOCK",I):0 I $T D
97 . . L -^MAG(2006.81,"LOCK",I) S $P(^MAG(2006.81,I,0),U,8)=0
98 Q
99CLEAR ; UTIL TO CLEAR THE WORKSTATION FILE OUT,
100 W !,"This will clear all workstations not currently connected from the Imaging Windows Workstation file ",!," OK To proced ? Y/N Y//"
101 R X:$G(DTIME,300) I '("Yy"[X) W !!,"CANCELED !. BYE" Q
102 S I=0,CT=1
103 F S I=$O(^MAG(2006.81,I)) Q:'I D
104 . W !,I
105 . I $P(^MAG(2006.81,I,0),U,8)=1 W " In use." Q
106 . W " Deleting..."
107 . S DIK="^MAG(2006.81,",DA=I D ^DIK
108 Q
Note: See TracBrowser for help on using the repository browser.