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

ENTIDD.m

Go to the documentation of this file.
  1. ENTIDD ;WOIFO/SAB - Engineering DD ;2/4/2008
  1. ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
  1. ;
  1. ITTCHK(ENCMR,ENX) ; IT Tracking Check
  1. ; called by input transform on CMR file IT TRACKING field
  1. ; input
  1. ; ENCMR - CMR ien
  1. ; ENX - user input (1 for yes or 0 or no)
  1. ; returns 1 (true) if change should be prevented
  1. ;
  1. N ENRET
  1. S ENRET=0
  1. I ENX'=1,$$AITACMR(ENCMR) D
  1. . S ENRET=1
  1. . D EN^DDIOL("CMR has equipment with an active IT assignment. Can't change IT TRACKING.")
  1. Q ENRET
  1. ;
  1. AITACMR(ENCMR) ; Active IT Assignment CMR
  1. ; input ENCMR = CMR internal entry number
  1. ; returns 1 (if any equipment on CMR has an active assignment) or 0
  1. N ENEQ,ENRET
  1. S ENRET=0
  1. ;
  1. ; loop thru equipment on CMR
  1. S ENEQ=0 F S ENEQ=$O(^ENG(6914,"AD",ENCMR,ENEQ)) Q:'ENEQ D Q:ENRET
  1. . I $D(^ENG(6916.3,"AEA",ENEQ)) S ENRET=1
  1. ;
  1. Q ENRET
  1. ;
  1. CMRCHK(ENDA,ENX) ; CMR Check
  1. ; called by EQUIPMENT INV. file CMR field Input Transform
  1. ; input
  1. ; ENDA - equipment ien
  1. ; ENX - user input, CMR ien
  1. ; returns 1 (true) if change should be prevented
  1. N DA,X ; protect variables used by input transform
  1. N ENA,ENRET,ENY
  1. S ENRET=0
  1. ;
  1. D
  1. . ; perform checks
  1. . Q:'$D(^ENG(6916.3,"AEA",ENDA)) ; no active assignments for equip
  1. . S ENY=$G(^ENG(6914.1,ENX,0)) ; CMR zero node
  1. . Q:$P(ENY,"^",9) ; IT Tracking of new CMR is Yes
  1. . Q:$E($P(ENY,"^"),1,2)="99" ; CMR name starts 99, may be for excess
  1. . ;
  1. . ; must be an inappropriate change
  1. . S ENRET=1
  1. . S ENA(1)="Equipment has an active IT assignment."
  1. . S ENA(2)="New CMR must be excess (99x) or have IT TRACKING = YES."
  1. . D EN^DDIOL(.ENA)
  1. ;
  1. Q ENRET
  1. ;
  1. CMRUPD(ENEQ,ENCMR1,ENCMR2) ; terminate IT responsibilities when CMR changed
  1. ; called by cross-reference on Equipment Inv. file CMR field
  1. ; input
  1. ; ENEQ - equipment ien
  1. ; ENCMR1 - old CMR ien
  1. ; ENCMR2 - new CMR ien (or null if value deleted)
  1. Q:$D(ENDJCMR1) ; edited by DJ screen, change may be backed out so wait
  1. Q:'$D(^ENG(6916.3,"AEA",ENEQ)) ; no active assignments for equip
  1. I ENCMR2,$D(^ENG(6914.1,"AIT",1,ENCMR2)) Q ; new CMR IT TRACKING = yes
  1. ;
  1. ; equipment with active assignments is no longer on a tracked CMR
  1. N ENCMR1N,ENCMR2N,ENDA,ENL,ENTX,ENX
  1. N DIFROM,XMDUZ,XMMG,XMROU,XMSTRIP,XMSUB,XMTEXT,XMY,XMYBLOB,XMZ
  1. ; loop thru assignments
  1. S ENL=5
  1. S ENDA=0 F S ENDA=$O(^ENG(6916.3,"AEA",ENEQ,ENDA)) Q:'ENDA D
  1. . ; terminate assignment
  1. . S ENX=$$TERM^ENTIUTL1(ENDA)
  1. . ; place on message text
  1. . S ENL=ENL+1
  1. . S ENTX(ENL)="Owner: "_$$GET1^DIQ(6916.3,ENDA,1)
  1. ;
  1. ; send message
  1. S ENCMR1N=$S(ENCMR1:$P($G(^ENG(6914.1,ENCMR1,0)),U),1:ENCMR1)
  1. S ENCMR2N=$S(ENCMR2:$P($G(^ENG(6914.1,ENCMR2,0)),U),1:"<deleted>")
  1. S ENTX(1)="The CMR value for Equipment Entry # "_ENEQ_" was changed"
  1. S ENTX(2)="from "_ENCMR1N_" to "_ENCMR2N_" by "_$$GET1^DIQ(200,DUZ,.01)
  1. S ENTX(3)="The following IT assignments were automatically terminated"
  1. S ENTX(4)="since the new CMR value does not have IT TRACKING = Yes."
  1. S ENTX(5)=" "
  1. ;
  1. S XMDUZ="AEMS/MERS"
  1. S XMSUB="IT Assignments Terminated for Entry # "_ENEQ
  1. S XMY("G.EN IT EQUIPMENT")=""
  1. S XMTEXT="ENTX("
  1. D ^XMD
  1. Q
  1. ;
  1. CMRDJPR ; CMR Label Pre-Action for ENEQ1 DJ Edit Screen
  1. I $D(^ENG(6915.2,"B",DA)) S X=$$CHKFA^ENFAUTL(DA) I $P(X,U)=1 D
  1. . W "Capitalized asset. CMR may only be edited via FAP documents."
  1. . W !,"Press <RETURN> to continue..."
  1. . R X:DTIME
  1. . S DJNX=9
  1. ;
  1. ; if CMR field will be edited save current CMR value
  1. ; note: the existence of this variable will prevent the ACMR x-ref from
  1. ; deleting any active IT assignments
  1. I $G(DJNX)'=9 S ENDJCMR1=$P($G(^ENG(6914,DA,2)),U,9)
  1. Q
  1. ;
  1. CMRDJPS ; CMR Label Post-Action for ENEQ1 DJ Edit Screen
  1. ; note that new data has already been filed by this point
  1. ; input ENDJCMR1 - CMR (internal) value prior to the edit
  1. ; note: this variable will be killed
  1. ; DA - equipment ien being edited
  1. ; output
  1. ; may reset value of CMR field, if value was reset the following
  1. ; two DJ screen handler variables will also be modified
  1. ; V(8) - update to reflect the reset CMR value (external)
  1. ; DJNX - update to re-edit the CMR field
  1. ;
  1. Q:'$D(ENDJCMR1)
  1. N ENFDA,ENOLD,ENNEW,ENX,X
  1. S ENOLD=ENDJCMR1 ; old CMR value
  1. S ENNEW=$P($G(^ENG(6914,DA,2)),U,9) ; new CMR value
  1. I ENNEW'=ENOLD D
  1. . ; CMR was changed
  1. . S ENX=$$CMRCHK^ENTIDD(DA,ENNEW) ; may display message
  1. . I ENX D
  1. . . ; change was not appropriate - pause after message
  1. . . W !,"Press <RETURN> to continue..."
  1. . . R X:DTIME
  1. . . ; change back to original value
  1. . . S ENFDA(6914,DA_",",19)=ENOLD
  1. . . D FILE^DIE("","ENFDA")
  1. . . ; fix screen
  1. . . S V(8)=$$GET1^DIQ(6914,DA,19)
  1. . . S DJNX=8
  1. . I 'ENX D
  1. . . ; change was appropriate
  1. . . ; terminate any active IT assignments
  1. . . K ENDJCMR1 ; to prevent following call from quitting
  1. . . D CMRUPD^ENTIDD(DA,ENOLD,ENNEW)
  1. ;
  1. ; clean up symbol table for variable set by the pre-action
  1. K ENDJCMR1
  1. Q
  1. ;
  1. ;ENTIDD