source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGVCHK.m@ 1005

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

initial load of WorldVistAEHR

File size: 4.3 KB
RevLine 
[613]1MAGVCHK ;WOIFO/EdM - Checksums of Imaging Routines ; 08/22/2005 10:58
2 ;;3.0;IMAGING;**51**;26-August-2005
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
19 ;
20 ; The entry below is called from ET-Phone-Home
21 ;
22GATEWAY(ZTSK,MAGDBB) ; RPC = MAG VISTA CHECKSUMS
23 N D0,X,ZTDESC,ZTDTH,ZTRTN,ZTSAVE
24 S ZTSK=0,D0=$O(^MAG(2006.1,0)) Q:'D0
25 Q:$G(MAGDBB)'["@" ; Must be valid e-mail address
26 L +^MAG(2006.1,"CHECKSUM"):10 Q:'$T ; Don't hold up other processing...
27 D:$G(^MAG(2006.1,D0,"LAST CHECKSUM"))<DT
28 . ;
29 . S ZTRTN="CHECK^"_$T(+0)
30 . S ZTDESC="Imaging Checksum Collection"
31 . S ZTDTH=$H ; Now!
32 . S ZTSAVE("MAGDBB")=MAGDBB
33 . D ^%ZTLOAD,HOME^%ZIS
34 . I '$D(ZTSK) S ZTSK=0 Q ; TaskMan did not Accept Request
35 . ; No matter how many sub-sites in the consolidated site,
36 . ; run this program only once per day:
37 . S D0=0 F S D0=$O(^MAG(2006.1,D0)) Q:'D0 S ^MAG(2006.1,D0,"LAST CHECKSUM")=DT
38 . Q
39 L -^MAG(2006.1,"CHECKSUM")
40 Q
41 ;
42CHECK ; Collect checksums for Imaging Routines
43 N CUR,I,MAGFM,R,SITE,X,XMERR,XMID,XMSUB,XMY,XMZ
44 Q:$G(MAGDBB)'["@" ; Must be valid e-mail address
45 D DT^DICRW
46 D
47 . N DATE,I,MAGDATA,MSG,N,PKG,PKT,PV
48 . S CUR=$$VERSION^XPDUTL("IMAGING")
49 . D LIST^DIC(9.7,,".01;2I;51I","K","*","MAG","MAG*","B",,,"MAGDATA","MSG")
50 . S I="" F S I=$O(MAGDATA("DILIST",2,I)) Q:I="" D
51 . . S I(+$G(MAGDATA("DILIST","ID",I,2)),I)=""
52 . . Q
53 . S N=0,DATE="" F S DATE=$O(I(DATE)) Q:DATE="" D
54 . . S I="" F S I=$O(I(DATE,I)) Q:I="" D
55 . . . S X=$G(MAGDATA("DILIST","ID",I,.01)) Q:$P(X,"*",2)'=CUR
56 . . . S PATCH=+$P(X,"*",3) Q:'PATCH
57 . . . K:$G(N(1,PATCH)) N(2,N(1,PATCH))
58 . . . S N=N+1,N(1,PATCH)=N,N(2,N)=PATCH
59 . . . S N(3,N)=$G(MAGDATA("DILIST","ID",I,51))
60 . . . Q
61 . . Q
62 . S CUR=CUR_";IMAGING;",I="**",X=""
63 . S N="" F S N=$O(N(2,N)) Q:N="" S CUR=CUR_I_N(2,N),X=N(3,N),I=","
64 . S:I'="**" CUR=CUR_"**"
65 . S:X'="" CUR=CUR_";"_$$FMDATE(X)
66 . Q
67 S SITE=0 S:$T(INST^XUPARAM)'="" SITE=$$KSP^XUPARAM("INST")
68 D:SITE FIND^DIC(4,"",.01,"A",SITE,"*",,,,"MAGFM")
69 S SITE=$G(MAGFM("DILIST",1,1)) S:SITE'="" SITE=SITE_" "
70 S SITE=SITE_"VistA System"
71 K ^TMP("MAG",$J,"CHECKSUM"),MAGFM
72 S I=0
73 K X D DOMAIN^MAGDRPC1(.X)
74 S I=I+1,^TMP("MAG",$J,"CHECKSUM",I)="SID="_X
75 S I=I+1,^TMP("MAG",$J,"CHECKSUM",I)="DT="_DT
76 S I=I+1,^TMP("MAG",$J,"CHECKSUM",I)="IP=VistA"
77 S I=I+1,^TMP("MAG",$J,"CHECKSUM",I)="BLD="_CUR
78 S I=I+1,^TMP("MAG",$J,"CHECKSUM",I)="TTL="_SITE
79 S I=I+1,^TMP("MAG",$J,"CHECKSUM",I)="PHY=VistA"
80 S R="MAG" F S R=$O(^$R(R)) Q:$E(R,1,3)'="MAG" D
81 . S I=I+1,^TMP("MAG",$J,"CHECKSUM",I)="RTN="_R
82 . S I=I+1,^TMP("MAG",$J,"CHECKSUM",I)="CHK="_$$CHK1(R)_"^"_$$CHK2(R)
83 . Q
84 S I=I+1,^TMP("MAG",$J,"CHECKSUM",I)=""
85 S XMSUB="Daily Report"
86 S XMID=$G(DUZ) S:'XMID XMID=.5
87 S XMY(XMID)=""
88 S XMY(MAGDBB)=""
89 D SENDMSG^XMXAPI(XMID,XMSUB,$NAME(^TMP("MAG",$J,"CHECKSUM")),.XMY,,.XMZ,)
90 I $G(XMERR) M XMERR=^TMP("XMERR",$J) S $EC=",U13-Cannot send MailMan message,"
91 Q
92 ;
93CHK1(R) N K,X,Y
94 S Y=0
95 F K=1:1 S X=$T(+K^@R) Q:X="" S:K'=2 Y=Y+$$C1(X)
96 Q Y
97 ;
98C1(X) N F,I,Y
99 S Y=0
100 S F=$F(X," "),F=$S($E(X,F)'=";":$L(X),$E(X,F+1)=";":$L(X),1:F-2)
101 F I=1:1:F S Y=$A(X,I)*I+Y
102 Q Y
103 ;
104CHK2(R) N K,X,Y
105 S Y=0
106 F K=1:1 S X=$T(+K^@R) Q:X="" S:K'=2 Y=Y+$$C2(X,K)
107 Q Y
108 ;
109C2(X,K) N F,I,Y
110 S Y=0
111 S F=$F(X," "),F=$S($E(X,F)'=";":$L(X),$E(X,F+1)=";":$L(X),1:F-2)
112 F I=1:1:F S Y=$A(X,I)*(I+K)+Y
113 Q Y
114 ;
115FMDATE(X) N D,M,Y
116 S X=X\1,D=X#100,M=X\100#100,Y=X\10000+1700
117 Q D_"-"_$P("January February March April May June July August September October November December"," ",M)_"-"_Y
118 ;
Note: See TracBrowser for help on using the repository browser.