source: FOIAVistA/tag/r/ENGINEERING-EN/ENTIDD.m@ 1495

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

initial load of FOIAVistA 6/30/08 version

File size: 4.7 KB
Line 
1ENTIDD ;WOIFO/SAB - Engineering DD ;2/4/2008
2 ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
3 ;
4ITTCHK(ENCMR,ENX) ; IT Tracking Check
5 ; called by input transform on CMR file IT TRACKING field
6 ; input
7 ; ENCMR - CMR ien
8 ; ENX - user input (1 for yes or 0 or no)
9 ; returns 1 (true) if change should be prevented
10 ;
11 N ENRET
12 S ENRET=0
13 I ENX'=1,$$AITACMR(ENCMR) D
14 . S ENRET=1
15 . D EN^DDIOL("CMR has equipment with an active IT assignment. Can't change IT TRACKING.")
16 Q ENRET
17 ;
18AITACMR(ENCMR) ; Active IT Assignment CMR
19 ; input ENCMR = CMR internal entry number
20 ; returns 1 (if any equipment on CMR has an active assignment) or 0
21 N ENEQ,ENRET
22 S ENRET=0
23 ;
24 ; loop thru equipment on CMR
25 S ENEQ=0 F S ENEQ=$O(^ENG(6914,"AD",ENCMR,ENEQ)) Q:'ENEQ D Q:ENRET
26 . I $D(^ENG(6916.3,"AEA",ENEQ)) S ENRET=1
27 ;
28 Q ENRET
29 ;
30CMRCHK(ENDA,ENX) ; CMR Check
31 ; called by EQUIPMENT INV. file CMR field Input Transform
32 ; input
33 ; ENDA - equipment ien
34 ; ENX - user input, CMR ien
35 ; returns 1 (true) if change should be prevented
36 N DA,X ; protect variables used by input transform
37 N ENA,ENRET,ENY
38 S ENRET=0
39 ;
40 D
41 . ; perform checks
42 . Q:'$D(^ENG(6916.3,"AEA",ENDA)) ; no active assignments for equip
43 . S ENY=$G(^ENG(6914.1,ENX,0)) ; CMR zero node
44 . Q:$P(ENY,"^",9) ; IT Tracking of new CMR is Yes
45 . Q:$E($P(ENY,"^"),1,2)="99" ; CMR name starts 99, may be for excess
46 . ;
47 . ; must be an inappropriate change
48 . S ENRET=1
49 . S ENA(1)="Equipment has an active IT assignment."
50 . S ENA(2)="New CMR must be excess (99x) or have IT TRACKING = YES."
51 . D EN^DDIOL(.ENA)
52 ;
53 Q ENRET
54 ;
55CMRUPD(ENEQ,ENCMR1,ENCMR2) ; terminate IT responsibilities when CMR changed
56 ; called by cross-reference on Equipment Inv. file CMR field
57 ; input
58 ; ENEQ - equipment ien
59 ; ENCMR1 - old CMR ien
60 ; ENCMR2 - new CMR ien (or null if value deleted)
61 Q:$D(ENDJCMR1) ; edited by DJ screen, change may be backed out so wait
62 Q:'$D(^ENG(6916.3,"AEA",ENEQ)) ; no active assignments for equip
63 I ENCMR2,$D(^ENG(6914.1,"AIT",1,ENCMR2)) Q ; new CMR IT TRACKING = yes
64 ;
65 ; equipment with active assignments is no longer on a tracked CMR
66 N ENCMR1N,ENCMR2N,ENDA,ENL,ENTX,ENX
67 N DIFROM,XMDUZ,XMMG,XMROU,XMSTRIP,XMSUB,XMTEXT,XMY,XMYBLOB,XMZ
68 ; loop thru assignments
69 S ENL=5
70 S ENDA=0 F S ENDA=$O(^ENG(6916.3,"AEA",ENEQ,ENDA)) Q:'ENDA D
71 . ; terminate assignment
72 . S ENX=$$TERM^ENTIUTL1(ENDA)
73 . ; place on message text
74 . S ENL=ENL+1
75 . S ENTX(ENL)="Owner: "_$$GET1^DIQ(6916.3,ENDA,1)
76 ;
77 ; send message
78 S ENCMR1N=$S(ENCMR1:$P($G(^ENG(6914.1,ENCMR1,0)),U),1:ENCMR1)
79 S ENCMR2N=$S(ENCMR2:$P($G(^ENG(6914.1,ENCMR2,0)),U),1:"<deleted>")
80 S ENTX(1)="The CMR value for Equipment Entry # "_ENEQ_" was changed"
81 S ENTX(2)="from "_ENCMR1N_" to "_ENCMR2N_" by "_$$GET1^DIQ(200,DUZ,.01)
82 S ENTX(3)="The following IT assignments were automatically terminated"
83 S ENTX(4)="since the new CMR value does not have IT TRACKING = Yes."
84 S ENTX(5)=" "
85 ;
86 S XMDUZ="AEMS/MERS"
87 S XMSUB="IT Assignments Terminated for Entry # "_ENEQ
88 S XMY("G.EN IT EQUIPMENT")=""
89 S XMTEXT="ENTX("
90 D ^XMD
91 Q
92 ;
93CMRDJPR ; CMR Label Pre-Action for ENEQ1 DJ Edit Screen
94 I $D(^ENG(6915.2,"B",DA)) S X=$$CHKFA^ENFAUTL(DA) I $P(X,U)=1 D
95 . W "Capitalized asset. CMR may only be edited via FAP documents."
96 . W !,"Press <RETURN> to continue..."
97 . R X:DTIME
98 . S DJNX=9
99 ;
100 ; if CMR field will be edited save current CMR value
101 ; note: the existence of this variable will prevent the ACMR x-ref from
102 ; deleting any active IT assignments
103 I $G(DJNX)'=9 S ENDJCMR1=$P($G(^ENG(6914,DA,2)),U,9)
104 Q
105 ;
106CMRDJPS ; CMR Label Post-Action for ENEQ1 DJ Edit Screen
107 ; note that new data has already been filed by this point
108 ; input ENDJCMR1 - CMR (internal) value prior to the edit
109 ; note: this variable will be killed
110 ; DA - equipment ien being edited
111 ; output
112 ; may reset value of CMR field, if value was reset the following
113 ; two DJ screen handler variables will also be modified
114 ; V(8) - update to reflect the reset CMR value (external)
115 ; DJNX - update to re-edit the CMR field
116 ;
117 Q:'$D(ENDJCMR1)
118 N ENFDA,ENOLD,ENNEW,ENX,X
119 S ENOLD=ENDJCMR1 ; old CMR value
120 S ENNEW=$P($G(^ENG(6914,DA,2)),U,9) ; new CMR value
121 I ENNEW'=ENOLD D
122 . ; CMR was changed
123 . S ENX=$$CMRCHK^ENTIDD(DA,ENNEW) ; may display message
124 . I ENX D
125 . . ; change was not appropriate - pause after message
126 . . W !,"Press <RETURN> to continue..."
127 . . R X:DTIME
128 . . ; change back to original value
129 . . S ENFDA(6914,DA_",",19)=ENOLD
130 . . D FILE^DIE("","ENFDA")
131 . . ; fix screen
132 . . S V(8)=$$GET1^DIQ(6914,DA,19)
133 . . S DJNX=8
134 . I 'ENX D
135 . . ; change was appropriate
136 . . ; terminate any active IT assignments
137 . . K ENDJCMR1 ; to prevent following call from quitting
138 . . D CMRUPD^ENTIDD(DA,ENOLD,ENNEW)
139 ;
140 ; clean up symbol table for variable set by the pre-action
141 K ENDJCMR1
142 Q
143 ;
144 ;ENTIDD
Note: See TracBrowser for help on using the repository browser.