ENTIUTL1 ;WOIFO/SAB - Engineering Utilities ;2/4/2008
;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
; this routine contains APIs that create or modify IT assignment data
;
ASGN(ENDA,EN200) ; Assign Equipment Responsibility
; input
; ENDA = equipment ien (file 6914)
; EN200 = owner ien (file 200)
; returns value =
; 0 (already exists) or
; E (error) or
; internal entry number of the created record (positive integer)
N ENERR,ENFDA,ENIEN,ENRET
S ENRET=0
; only create if owner does not have an active assignment for the item
I '$D(^ENG(6916.3,"AOA",EN200,ENDA)) D
. S ENFDA(6916.3,"+1,",.01)=ENDA
. S ENFDA(6916.3,"+1,",1)=EN200
. S ENFDA(6916.3,"+1,",2)=$$NOW^XLFDT()
. S ENFDA(6916.3,"+1,",3)=DUZ
. D UPDATE^DIE("","ENFDA","ENIEN","ENERR")
. S ENRET=$S($D(ENERR):"E",1:ENIEN(1))
;
Q ENRET
;
SIGN(ENDA) ; Sign Equipment Responsibility
; input
; ENDA = assignment ien (file 6916.3)
; returns value = 1 (signed) or 0 (not active) or E (error)
N ENERR,ENFDA,ENHRT,ENRET,ENSTR,ENSTRH,ENY,X,X1,X2
S ENRET=0
; only sign if assignment is active
I $P($G(^ENG(6916.3,ENDA,0)),U,8)="" D
. S ENHRT=$O(^ENG(6916.2," "),-1) ; current hand receipt text ien
. I 'ENHRT S ENRET="E" Q ; required
. ;
. ; if already signed or certified then retain that data in history
. D SAVSIG
. I $D(ENERR) S ENRET="E" Q ; error during DBS call
. ;
. ; build signature block string
. S ENY=$G(^ENG(6916.3,ENDA,0))
. S ENSTR=$$ESBLOCK^XUSESIG1()
. S ENSTR=ENSTR_U_$P(ENY,U) ; equipment ien
. S ENSTR=ENSTR_U_$P(ENY,U,2) ; owner ien
. S ENSTR=ENSTR_U_ENHRT ; hand receipt text ien
. S ENSTR=ENSTR_U_$$GET1^DIQ(6916.2,ENHRT,3) ; hand receipt checksum
. S X=ENSTR,X1=ENDA,X2=1 D EN^XUSHSHP S ENSTRH=X ; hashed string
. ;
. ; set up FDA array for DBS call
. S ENFDA(6916.3,ENDA_",",4)=$P(ENSTR,U,4) ; signed date/time
. S ENFDA(6916.3,ENDA_",",5)=ENHRT ; hand receipt text
. S ENFDA(6916.3,ENDA_",",5.9)="@" ; may be leftover from prior cert
. S ENFDA(6916.3,ENDA_",",6)="@" ; may be leftover from prior cert
. S ENFDA(6916.3,ENDA_",",9)=ENSTRH ; encrypted string
. ;
. D FILE^DIE("","ENFDA","ENERR")
. S ENRET=$S($D(ENERR):"E",1:1)
;
Q ENRET
;
CERT(ENDA,ENDT) ; Certify Signature for Equipment Responsibility
; input
; ENDA = assignment ien (file 6916.3)
; ENDT = date of signature (FileMan internal date)
; returns value = 1 (created) or 0 (not active) or E (error)
N ENERR,ENFDA,ENHRT,ENRET
S ENRET=0
; only certify if assignment is active
I $P($G(^ENG(6916.3,ENDA,0)),U,8)="" D
. I $G(ENDT)'?7N S ENRET="E" Q ; required
. ;
. S ENHRT=$O(^ENG(6916.2," "),-1) ; current hand receipt text ien
. I 'ENHRT S ENRET="E" Q ; required
. ;
. ; if already signed or certified then retain that data in history
. D SAVSIG
. I $D(ENERR) S ENRET="E" Q ; error during DBS call
. ;
. ; set data for a certification
. S ENFDA(6916.3,ENDA_",",4)=ENDT
. S ENFDA(6916.3,ENDA_",",5)=ENHRT
. S ENFDA(6916.3,ENDA_",",5.9)=$$NOW^XLFDT()
. S ENFDA(6916.3,ENDA_",",6)=DUZ
. S ENFDA(6916.3,ENDA_",",9)="@" ; may be leftover from prior e-sig
. ;
. D FILE^DIE("","ENFDA","ENERR")
. S ENRET=$S($D(ENERR):"E",1:1)
;
Q ENRET
;
TERM(ENDA) ; Terminate Equipment Responsibility Assignment
; input
; ENDA = assignment ien (file 6916.3)
; returns value = 1 (created) or 0 (not active) or E (error)
N ENERR,ENFDA,ENRET
S ENRET=0
; only terminate if assignment is active
I $P($G(^ENG(6916.3,ENDA,0)),U,8)="" D
. S ENFDA(6916.3,ENDA_",",7)=$$NOW^XLFDT()
. S ENFDA(6916.3,ENDA_",",8)=DUZ
. D FILE^DIE("","ENFDA","ENERR")
. S ENRET=$S($D(ENERR):"E",1:1)
;
Q ENRET
;
SAVSIG ; Save current signature data (if any) to previous signature multiple
; input ENDA = ien of assignment (file 6916.3)
; result = may create entry in subfile 6916.31
; output ENERR - only defined if there was an error during DBS call
N ENFDA,ENY,ENY1
; if already signed or certified then retain that data in history
S ENY=$G(^ENG(6916.3,ENDA,0))
Q:'$P(ENY,U,5) ; not signed or certified
S ENY1=$G(^ENG(6916.3,ENDA,1))
;
S ENFDA(6916.31,"+1,"_ENDA_",",.01)=$P(ENY,U,5)
I $P(ENY,U,6) S ENFDA(6916.31,"+1,"_ENDA_",",1)=$P(ENY,U,6)
I $P(ENY,U,10) S ENFDA(6916.31,"+1,"_ENDA_",",2)=$P(ENY,U,10)
I $P(ENY,U,7) S ENFDA(6916.31,"+1,"_ENDA_",",3)=$P(ENY,U,7)
I $P(ENY1,U)]"" S ENFDA(6916.31,"+1,"_ENDA_",",4)=$P(ENY1,U)
;
D UPDATE^DIE("","ENFDA","","ENERR")
;
Q
;
;ENTIUTL1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENTIUTL1 4540 printed Dec 13, 2024@01:56:03 Page 2
ENTIUTL1 ;WOIFO/SAB - Engineering Utilities ;2/4/2008
+1 ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
+2 ; this routine contains APIs that create or modify IT assignment data
+3 ;
ASGN(ENDA,EN200) ; Assign Equipment Responsibility
+1 ; input
+2 ; ENDA = equipment ien (file 6914)
+3 ; EN200 = owner ien (file 200)
+4 ; returns value =
+5 ; 0 (already exists) or
+6 ; E (error) or
+7 ; internal entry number of the created record (positive integer)
+8 NEW ENERR,ENFDA,ENIEN,ENRET
+9 SET ENRET=0
+10 ; only create if owner does not have an active assignment for the item
+11 IF '$DATA(^ENG(6916.3,"AOA",EN200,ENDA))
Begin DoDot:1
+12 SET ENFDA(6916.3,"+1,",.01)=ENDA
+13 SET ENFDA(6916.3,"+1,",1)=EN200
+14 SET ENFDA(6916.3,"+1,",2)=$$NOW^XLFDT()
+15 SET ENFDA(6916.3,"+1,",3)=DUZ
+16 DO UPDATE^DIE("","ENFDA","ENIEN","ENERR")
+17 SET ENRET=$SELECT($DATA(ENERR):"E",1:ENIEN(1))
End DoDot:1
+18 ;
+19 QUIT ENRET
+20 ;
SIGN(ENDA) ; Sign Equipment Responsibility
+1 ; input
+2 ; ENDA = assignment ien (file 6916.3)
+3 ; returns value = 1 (signed) or 0 (not active) or E (error)
+4 NEW ENERR,ENFDA,ENHRT,ENRET,ENSTR,ENSTRH,ENY,X,X1,X2
+5 SET ENRET=0
+6 ; only sign if assignment is active
+7 IF $PIECE($GET(^ENG(6916.3,ENDA,0)),U,8)=""
Begin DoDot:1
+8 ; current hand receipt text ien
SET ENHRT=$ORDER(^ENG(6916.2," "),-1)
+9 ; required
IF 'ENHRT
SET ENRET="E"
QUIT
+10 ;
+11 ; if already signed or certified then retain that data in history
+12 DO SAVSIG
+13 ; error during DBS call
IF $DATA(ENERR)
SET ENRET="E"
QUIT
+14 ;
+15 ; build signature block string
+16 SET ENY=$GET(^ENG(6916.3,ENDA,0))
+17 SET ENSTR=$$ESBLOCK^XUSESIG1()
+18 ; equipment ien
SET ENSTR=ENSTR_U_$PIECE(ENY,U)
+19 ; owner ien
SET ENSTR=ENSTR_U_$PIECE(ENY,U,2)
+20 ; hand receipt text ien
SET ENSTR=ENSTR_U_ENHRT
+21 ; hand receipt checksum
SET ENSTR=ENSTR_U_$$GET1^DIQ(6916.2,ENHRT,3)
+22 ; hashed string
SET X=ENSTR
SET X1=ENDA
SET X2=1
DO EN^XUSHSHP
SET ENSTRH=X
+23 ;
+24 ; set up FDA array for DBS call
+25 ; signed date/time
SET ENFDA(6916.3,ENDA_",",4)=$PIECE(ENSTR,U,4)
+26 ; hand receipt text
SET ENFDA(6916.3,ENDA_",",5)=ENHRT
+27 ; may be leftover from prior cert
SET ENFDA(6916.3,ENDA_",",5.9)="@"
+28 ; may be leftover from prior cert
SET ENFDA(6916.3,ENDA_",",6)="@"
+29 ; encrypted string
SET ENFDA(6916.3,ENDA_",",9)=ENSTRH
+30 ;
+31 DO FILE^DIE("","ENFDA","ENERR")
+32 SET ENRET=$SELECT($DATA(ENERR):"E",1:1)
End DoDot:1
+33 ;
+34 QUIT ENRET
+35 ;
CERT(ENDA,ENDT) ; Certify Signature for Equipment Responsibility
+1 ; input
+2 ; ENDA = assignment ien (file 6916.3)
+3 ; ENDT = date of signature (FileMan internal date)
+4 ; returns value = 1 (created) or 0 (not active) or E (error)
+5 NEW ENERR,ENFDA,ENHRT,ENRET
+6 SET ENRET=0
+7 ; only certify if assignment is active
+8 IF $PIECE($GET(^ENG(6916.3,ENDA,0)),U,8)=""
Begin DoDot:1
+9 ; required
IF $GET(ENDT)'?7N
SET ENRET="E"
QUIT
+10 ;
+11 ; current hand receipt text ien
SET ENHRT=$ORDER(^ENG(6916.2," "),-1)
+12 ; required
IF 'ENHRT
SET ENRET="E"
QUIT
+13 ;
+14 ; if already signed or certified then retain that data in history
+15 DO SAVSIG
+16 ; error during DBS call
IF $DATA(ENERR)
SET ENRET="E"
QUIT
+17 ;
+18 ; set data for a certification
+19 SET ENFDA(6916.3,ENDA_",",4)=ENDT
+20 SET ENFDA(6916.3,ENDA_",",5)=ENHRT
+21 SET ENFDA(6916.3,ENDA_",",5.9)=$$NOW^XLFDT()
+22 SET ENFDA(6916.3,ENDA_",",6)=DUZ
+23 ; may be leftover from prior e-sig
SET ENFDA(6916.3,ENDA_",",9)="@"
+24 ;
+25 DO FILE^DIE("","ENFDA","ENERR")
+26 SET ENRET=$SELECT($DATA(ENERR):"E",1:1)
End DoDot:1
+27 ;
+28 QUIT ENRET
+29 ;
TERM(ENDA) ; Terminate Equipment Responsibility Assignment
+1 ; input
+2 ; ENDA = assignment ien (file 6916.3)
+3 ; returns value = 1 (created) or 0 (not active) or E (error)
+4 NEW ENERR,ENFDA,ENRET
+5 SET ENRET=0
+6 ; only terminate if assignment is active
+7 IF $PIECE($GET(^ENG(6916.3,ENDA,0)),U,8)=""
Begin DoDot:1
+8 SET ENFDA(6916.3,ENDA_",",7)=$$NOW^XLFDT()
+9 SET ENFDA(6916.3,ENDA_",",8)=DUZ
+10 DO FILE^DIE("","ENFDA","ENERR")
+11 SET ENRET=$SELECT($DATA(ENERR):"E",1:1)
End DoDot:1
+12 ;
+13 QUIT ENRET
+14 ;
SAVSIG ; Save current signature data (if any) to previous signature multiple
+1 ; input ENDA = ien of assignment (file 6916.3)
+2 ; result = may create entry in subfile 6916.31
+3 ; output ENERR - only defined if there was an error during DBS call
+4 NEW ENFDA,ENY,ENY1
+5 ; if already signed or certified then retain that data in history
+6 SET ENY=$GET(^ENG(6916.3,ENDA,0))
+7 ; not signed or certified
if '$PIECE(ENY,U,5)
QUIT
+8 SET ENY1=$GET(^ENG(6916.3,ENDA,1))
+9 ;
+10 SET ENFDA(6916.31,"+1,"_ENDA_",",.01)=$PIECE(ENY,U,5)
+11 IF $PIECE(ENY,U,6)
SET ENFDA(6916.31,"+1,"_ENDA_",",1)=$PIECE(ENY,U,6)
+12 IF $PIECE(ENY,U,10)
SET ENFDA(6916.31,"+1,"_ENDA_",",2)=$PIECE(ENY,U,10)
+13 IF $PIECE(ENY,U,7)
SET ENFDA(6916.31,"+1,"_ENDA_",",3)=$PIECE(ENY,U,7)
+14 IF $PIECE(ENY1,U)]""
SET ENFDA(6916.31,"+1,"_ENDA_",",4)=$PIECE(ENY1,U)
+15 ;
+16 DO UPDATE^DIE("","ENFDA","","ENERR")
+17 ;
+18 QUIT
+19 ;
+20 ;ENTIUTL1