source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENTIUTL1.m@ 619

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

initial load of WorldVistAEHR

File size: 4.3 KB
Line 
1ENTIUTL1 ;WOIFO/SAB - Engineering Utilities ;2/4/2008
2 ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
3 ; this routine contains APIs that create or modify IT assignment data
4 ;
5ASGN(ENDA,EN200) ; Assign Equipment Responsibility
6 ; input
7 ; ENDA = equipment ien (file 6914)
8 ; EN200 = owner ien (file 200)
9 ; returns value =
10 ; 0 (already exists) or
11 ; E (error) or
12 ; internal entry number of the created record (positive integer)
13 N ENERR,ENFDA,ENIEN,ENRET
14 S ENRET=0
15 ; only create if owner does not have an active assignment for the item
16 I '$D(^ENG(6916.3,"AOA",EN200,ENDA)) D
17 . S ENFDA(6916.3,"+1,",.01)=ENDA
18 . S ENFDA(6916.3,"+1,",1)=EN200
19 . S ENFDA(6916.3,"+1,",2)=$$NOW^XLFDT()
20 . S ENFDA(6916.3,"+1,",3)=DUZ
21 . D UPDATE^DIE("","ENFDA","ENIEN","ENERR")
22 . S ENRET=$S($D(ENERR):"E",1:ENIEN(1))
23 ;
24 Q ENRET
25 ;
26SIGN(ENDA) ; Sign Equipment Responsibility
27 ; input
28 ; ENDA = assignment ien (file 6916.3)
29 ; returns value = 1 (signed) or 0 (not active) or E (error)
30 N ENERR,ENFDA,ENHRT,ENRET,ENSTR,ENSTRH,ENY,X,X1,X2
31 S ENRET=0
32 ; only sign if assignment is active
33 I $P($G(^ENG(6916.3,ENDA,0)),U,8)="" D
34 . S ENHRT=$O(^ENG(6916.2," "),-1) ; current hand receipt text ien
35 . I 'ENHRT S ENRET="E" Q ; required
36 . ;
37 . ; if already signed or certified then retain that data in history
38 . D SAVSIG
39 . I $D(ENERR) S ENRET="E" Q ; error during DBS call
40 . ;
41 . ; build signature block string
42 . S ENY=$G(^ENG(6916.3,ENDA,0))
43 . S ENSTR=$$ESBLOCK^XUSESIG1()
44 . S ENSTR=ENSTR_U_$P(ENY,U) ; equipment ien
45 . S ENSTR=ENSTR_U_$P(ENY,U,2) ; owner ien
46 . S ENSTR=ENSTR_U_ENHRT ; hand receipt text ien
47 . S ENSTR=ENSTR_U_$$GET1^DIQ(6916.2,ENHRT,3) ; hand receipt checksum
48 . S X=ENSTR,X1=ENDA,X2=1 D EN^XUSHSHP S ENSTRH=X ; hashed string
49 . ;
50 . ; set up FDA array for DBS call
51 . S ENFDA(6916.3,ENDA_",",4)=$P(ENSTR,U,4) ; signed date/time
52 . S ENFDA(6916.3,ENDA_",",5)=ENHRT ; hand receipt text
53 . S ENFDA(6916.3,ENDA_",",5.9)="@" ; may be leftover from prior cert
54 . S ENFDA(6916.3,ENDA_",",6)="@" ; may be leftover from prior cert
55 . S ENFDA(6916.3,ENDA_",",9)=ENSTRH ; encrypted string
56 . ;
57 . D FILE^DIE("","ENFDA","ENERR")
58 . S ENRET=$S($D(ENERR):"E",1:1)
59 ;
60 Q ENRET
61 ;
62CERT(ENDA,ENDT) ; Certify Signature for Equipment Responsibility
63 ; input
64 ; ENDA = assignment ien (file 6916.3)
65 ; ENDT = date of signature (FileMan internal date)
66 ; returns value = 1 (created) or 0 (not active) or E (error)
67 N ENERR,ENFDA,ENHRT,ENRET
68 S ENRET=0
69 ; only certify if assignment is active
70 I $P($G(^ENG(6916.3,ENDA,0)),U,8)="" D
71 . I $G(ENDT)'?7N S ENRET="E" Q ; required
72 . ;
73 . S ENHRT=$O(^ENG(6916.2," "),-1) ; current hand receipt text ien
74 . I 'ENHRT S ENRET="E" Q ; required
75 . ;
76 . ; if already signed or certified then retain that data in history
77 . D SAVSIG
78 . I $D(ENERR) S ENRET="E" Q ; error during DBS call
79 . ;
80 . ; set data for a certification
81 . S ENFDA(6916.3,ENDA_",",4)=ENDT
82 . S ENFDA(6916.3,ENDA_",",5)=ENHRT
83 . S ENFDA(6916.3,ENDA_",",5.9)=$$NOW^XLFDT()
84 . S ENFDA(6916.3,ENDA_",",6)=DUZ
85 . S ENFDA(6916.3,ENDA_",",9)="@" ; may be leftover from prior e-sig
86 . ;
87 . D FILE^DIE("","ENFDA","ENERR")
88 . S ENRET=$S($D(ENERR):"E",1:1)
89 ;
90 Q ENRET
91 ;
92TERM(ENDA) ; Terminate Equipment Responsibility Assignment
93 ; input
94 ; ENDA = assignment ien (file 6916.3)
95 ; returns value = 1 (created) or 0 (not active) or E (error)
96 N ENERR,ENFDA,ENRET
97 S ENRET=0
98 ; only terminate if assignment is active
99 I $P($G(^ENG(6916.3,ENDA,0)),U,8)="" D
100 . S ENFDA(6916.3,ENDA_",",7)=$$NOW^XLFDT()
101 . S ENFDA(6916.3,ENDA_",",8)=DUZ
102 . D FILE^DIE("","ENFDA","ENERR")
103 . S ENRET=$S($D(ENERR):"E",1:1)
104 ;
105 Q ENRET
106 ;
107SAVSIG ; Save current signature data (if any) to previous signature multiple
108 ; input ENDA = ien of assignment (file 6916.3)
109 ; result = may create entry in subfile 6916.31
110 ; output ENERR - only defined if there was an error during DBS call
111 N ENFDA,ENY,ENY1
112 ; if already signed or certified then retain that data in history
113 S ENY=$G(^ENG(6916.3,ENDA,0))
114 Q:'$P(ENY,U,5) ; not signed or certified
115 S ENY1=$G(^ENG(6916.3,ENDA,1))
116 ;
117 S ENFDA(6916.31,"+1,"_ENDA_",",.01)=$P(ENY,U,5)
118 I $P(ENY,U,6) S ENFDA(6916.31,"+1,"_ENDA_",",1)=$P(ENY,U,6)
119 I $P(ENY,U,10) S ENFDA(6916.31,"+1,"_ENDA_",",2)=$P(ENY,U,10)
120 I $P(ENY,U,7) S ENFDA(6916.31,"+1,"_ENDA_",",3)=$P(ENY,U,7)
121 I $P(ENY1,U)]"" S ENFDA(6916.31,"+1,"_ENDA_",",4)=$P(ENY1,U)
122 ;
123 D UPDATE^DIE("","ENFDA","","ENERR")
124 ;
125 Q
126 ;
127 ;ENTIUTL1
Note: See TracBrowser for help on using the repository browser.