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