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

ENTIUTL1.m

Go to the documentation of this file.
  1. ENTIUTL1 ;WOIFO/SAB - Engineering Utilities ;2/4/2008
  1. ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
  1. ; this routine contains APIs that create or modify IT assignment data
  1. ;
  1. ASGN(ENDA,EN200) ; Assign Equipment Responsibility
  1. ; input
  1. ; ENDA = equipment ien (file 6914)
  1. ; EN200 = owner ien (file 200)
  1. ; returns value =
  1. ; 0 (already exists) or
  1. ; E (error) or
  1. ; internal entry number of the created record (positive integer)
  1. N ENERR,ENFDA,ENIEN,ENRET
  1. S ENRET=0
  1. ; only create if owner does not have an active assignment for the item
  1. I '$D(^ENG(6916.3,"AOA",EN200,ENDA)) D
  1. . S ENFDA(6916.3,"+1,",.01)=ENDA
  1. . S ENFDA(6916.3,"+1,",1)=EN200
  1. . S ENFDA(6916.3,"+1,",2)=$$NOW^XLFDT()
  1. . S ENFDA(6916.3,"+1,",3)=DUZ
  1. . D UPDATE^DIE("","ENFDA","ENIEN","ENERR")
  1. . S ENRET=$S($D(ENERR):"E",1:ENIEN(1))
  1. ;
  1. Q ENRET
  1. ;
  1. SIGN(ENDA) ; Sign Equipment Responsibility
  1. ; input
  1. ; ENDA = assignment ien (file 6916.3)
  1. ; returns value = 1 (signed) or 0 (not active) or E (error)
  1. N ENERR,ENFDA,ENHRT,ENRET,ENSTR,ENSTRH,ENY,X,X1,X2
  1. S ENRET=0
  1. ; only sign if assignment is active
  1. I $P($G(^ENG(6916.3,ENDA,0)),U,8)="" D
  1. . S ENHRT=$O(^ENG(6916.2," "),-1) ; current hand receipt text ien
  1. . I 'ENHRT S ENRET="E" Q ; required
  1. . ;
  1. . ; if already signed or certified then retain that data in history
  1. . D SAVSIG
  1. . I $D(ENERR) S ENRET="E" Q ; error during DBS call
  1. . ;
  1. . ; build signature block string
  1. . S ENY=$G(^ENG(6916.3,ENDA,0))
  1. . S ENSTR=$$ESBLOCK^XUSESIG1()
  1. . S ENSTR=ENSTR_U_$P(ENY,U) ; equipment ien
  1. . S ENSTR=ENSTR_U_$P(ENY,U,2) ; owner ien
  1. . S ENSTR=ENSTR_U_ENHRT ; hand receipt text ien
  1. . S ENSTR=ENSTR_U_$$GET1^DIQ(6916.2,ENHRT,3) ; hand receipt checksum
  1. . S X=ENSTR,X1=ENDA,X2=1 D EN^XUSHSHP S ENSTRH=X ; hashed string
  1. . ;
  1. . ; set up FDA array for DBS call
  1. . S ENFDA(6916.3,ENDA_",",4)=$P(ENSTR,U,4) ; signed date/time
  1. . S ENFDA(6916.3,ENDA_",",5)=ENHRT ; hand receipt text
  1. . S ENFDA(6916.3,ENDA_",",5.9)="@" ; may be leftover from prior cert
  1. . S ENFDA(6916.3,ENDA_",",6)="@" ; may be leftover from prior cert
  1. . S ENFDA(6916.3,ENDA_",",9)=ENSTRH ; encrypted string
  1. . ;
  1. . D FILE^DIE("","ENFDA","ENERR")
  1. . S ENRET=$S($D(ENERR):"E",1:1)
  1. ;
  1. Q ENRET
  1. ;
  1. CERT(ENDA,ENDT) ; Certify Signature for Equipment Responsibility
  1. ; input
  1. ; ENDA = assignment ien (file 6916.3)
  1. ; ENDT = date of signature (FileMan internal date)
  1. ; returns value = 1 (created) or 0 (not active) or E (error)
  1. N ENERR,ENFDA,ENHRT,ENRET
  1. S ENRET=0
  1. ; only certify if assignment is active
  1. I $P($G(^ENG(6916.3,ENDA,0)),U,8)="" D
  1. . I $G(ENDT)'?7N S ENRET="E" Q ; required
  1. . ;
  1. . S ENHRT=$O(^ENG(6916.2," "),-1) ; current hand receipt text ien
  1. . I 'ENHRT S ENRET="E" Q ; required
  1. . ;
  1. . ; if already signed or certified then retain that data in history
  1. . D SAVSIG
  1. . I $D(ENERR) S ENRET="E" Q ; error during DBS call
  1. . ;
  1. . ; set data for a certification
  1. . S ENFDA(6916.3,ENDA_",",4)=ENDT
  1. . S ENFDA(6916.3,ENDA_",",5)=ENHRT
  1. . S ENFDA(6916.3,ENDA_",",5.9)=$$NOW^XLFDT()
  1. . S ENFDA(6916.3,ENDA_",",6)=DUZ
  1. . S ENFDA(6916.3,ENDA_",",9)="@" ; may be leftover from prior e-sig
  1. . ;
  1. . D FILE^DIE("","ENFDA","ENERR")
  1. . S ENRET=$S($D(ENERR):"E",1:1)
  1. ;
  1. Q ENRET
  1. ;
  1. TERM(ENDA) ; Terminate Equipment Responsibility Assignment
  1. ; input
  1. ; ENDA = assignment ien (file 6916.3)
  1. ; returns value = 1 (created) or 0 (not active) or E (error)
  1. N ENERR,ENFDA,ENRET
  1. S ENRET=0
  1. ; only terminate if assignment is active
  1. I $P($G(^ENG(6916.3,ENDA,0)),U,8)="" D
  1. . S ENFDA(6916.3,ENDA_",",7)=$$NOW^XLFDT()
  1. . S ENFDA(6916.3,ENDA_",",8)=DUZ
  1. . D FILE^DIE("","ENFDA","ENERR")
  1. . S ENRET=$S($D(ENERR):"E",1:1)
  1. ;
  1. Q ENRET
  1. ;
  1. SAVSIG ; Save current signature data (if any) to previous signature multiple
  1. ; input ENDA = ien of assignment (file 6916.3)
  1. ; result = may create entry in subfile 6916.31
  1. ; output ENERR - only defined if there was an error during DBS call
  1. N ENFDA,ENY,ENY1
  1. ; if already signed or certified then retain that data in history
  1. S ENY=$G(^ENG(6916.3,ENDA,0))
  1. Q:'$P(ENY,U,5) ; not signed or certified
  1. S ENY1=$G(^ENG(6916.3,ENDA,1))
  1. ;
  1. S ENFDA(6916.31,"+1,"_ENDA_",",.01)=$P(ENY,U,5)
  1. I $P(ENY,U,6) S ENFDA(6916.31,"+1,"_ENDA_",",1)=$P(ENY,U,6)
  1. I $P(ENY,U,10) S ENFDA(6916.31,"+1,"_ENDA_",",2)=$P(ENY,U,10)
  1. I $P(ENY,U,7) S ENFDA(6916.31,"+1,"_ENDA_",",3)=$P(ENY,U,7)
  1. I $P(ENY1,U)]"" S ENFDA(6916.31,"+1,"_ENDA_",",4)=$P(ENY1,U)
  1. ;
  1. D UPDATE^DIE("","ENFDA","","ENERR")
  1. ;
  1. Q
  1. ;
  1. ;ENTIUTL1