source: FOIAVistA/trunk/r/ENGINEERING-EN/ENFAEIL.m@ 1801

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

initial load of FOIAVistA 6/30/08 version

File size: 6.5 KB
Line 
1ENFAEIL ;(WIRMFO)/SAB-EDIT CMR AND NATIONAL EIL FILES ;12/17/1998
2 ;;7.0;ENGINEERING;**39,60**;AUG 17, 1993
3 ;
4EIL ; Enter/Edit National EIL file - called by option ENFA EIL
5 W !!,"The National EIL file should only be changed at the direction of"
6 W !,"VACO. If the cost center associated with an EIL code is changed"
7 W !,"then FR Documents will automatically be generated in order to"
8 W !,"update the cost center value in Fixed Assets. A FR Document will"
9 W !,"be sent for each equipment item that belongs to a CMR that starts"
10 W !,"with the EIL code and is currently established in Fixed Assets."
11EILASK ;
12 W !
13 S DLAYGO=6914.9
14 S DIC="^ENG(6914.9,",DIC(0)="AQELMZ"
15 D ^DIC K DLAYGO G:Y'>0 EILX
16 S ENEIL("DA")=+Y,ENEIL=$P(Y,U,2),ENEIL("CC",0)=$P(Y(0),U,3)
17 ;
18 L +^ENG(6914.9,ENEIL("DA")):5 I '$T W $C(7),!,"Another user is editing this EIL. Please try again later." G EILASK
19 ;
20 S DIE=DIC,DR="1;2",DA=ENEIL("DA") D ^DIE
21 ;
22 S ENEIL("CC")=$P($G(^ENG(6914.9,ENEIL("DA"),0)),U,3)
23 I ENEIL("CC")]"",ENEIL("CC")'=ENEIL("CC",0) D
24 . W !,"Since the COST CENTER was changed, FR Documents will be sent"
25 . W !,"for appropriate equipment associated with the EIL."
26 . ; confirm cost center change
27 . S DIR(0)="Y",DIR("A")="Did you really want to change the cost center"
28 . D ^DIR K DIR I 'Y D Q
29 . . W !,"Restoring the EIL's cost center to it's previous value..."
30 . . S DIE="^ENG(6914.9,",DA=ENEIL("DA")
31 . . S DR=$S(ENEIL("CC",0)]"":"2///^S X=ENEIL(""CC"",0)",1:"2///@")
32 . . D ^DIE K DIE,DR,DA
33 . W !,"Generating FR Documents..."
34 . K ^TMP($J)
35 . S X=$$FREIL(ENEIL)
36 . W X," sent."
37 . I $D(^TMP($J)) D FRERR K ^TMP($J)
38 L -^ENG(6914.9,ENEIL("DA"))
39 ;
40 G EILASK
41 ;
42EILX ;
43 K DA,DIC,DIE,DR,DTOUT,X,Y
44 K ENEIL
45 Q
46 ;
47CMR ; Enter/Edit CMR file - called by option ENCMR
48CMRASK ;
49 W !
50 S DLAYGO=6914.1
51 S DIC="^ENG(6914.1,",DIC(0)="AQELMZ"
52 D ^DIC K DLAYGO G:Y'>0 CMRX
53 S ENCMR("DA")=+Y,ENCMR=$P(Y,U,2)
54 S ENCMR("SN",0)=$P($G(^ENG(6914.1,ENCMR("DA"),0)),U,7)
55 ;
56 L +^ENG(6914.1,ENCMR("DA")):5 I '$T W $C(7),!,"Another user is editing this CMR. Please try again later." G CMRASK
57 ;
58 S DIE=DIC,DR=".01:99",DA=ENCMR("DA") D ^DIE
59 ;
60 I $D(^ENG(6914.1,ENCMR("DA"),0)),$E($P(^(0),U),1,5)'=$E(ENCMR,1,5) D
61 . W !!,"The first five digits of the CMR name were changed. This change"
62 . W !,"affects all equipment records which point to this CMR."
63 . W !,"The computer will automatically generate FR Documents for"
64 . W !,"appropriate capitalized equipment on this CMR to update Fixed"
65 . W !,"Assets (FAP) with the new department and cost center.",!
66 . I '$D(^XUSEC("ENFACS",DUZ)) D Q
67 . . W !,"Since you do not hold the security key for sending documents"
68 . . W !,"to FAP ('ENFACS'), the system can't send FR Documents."
69 . . W !,"Therefore, the CMR name can only be changed if none of the"
70 . . W !,"equipment on the CMR is reported to FAP."
71 . . W !!,"Checking equipment..."
72 . . S ENCMR("FAP")=0,ENEQ("DA")=0
73 . . F S ENEQ("DA")=$O(^ENG(6914,"AD",ENCMR("DA"),ENEQ("DA"))) Q:'ENEQ("DA") I +$$CHKFA^ENFAUTL(ENEQ("DA")) S ENCMR("FAP")=1 Q
74 . . I ENCMR("FAP") D
75 . . . W "one or more items are reported to FAP.",$C(7)
76 . . . W !,"Sorry, I must restore this CMR to it's previous name."
77 . . . S DIE="^ENG(6914.1,",DA=ENCMR("DA"),DR=".01///^S X=ENCMR" D ^DIE
78 . . I 'ENCMR("FAP") W "none reported to FAP. Name change accepted."
79 . ; confirm name change
80 . S DIR(0)="Y",DIR("A")="Did you really want to change the CMR name"
81 . D ^DIR K DIR I 'Y D Q
82 . . W !,"Restoring CMR to previous name..."
83 . . S DIE="^ENG(6914.1,",DA=ENCMR("DA"),DR=".01///^S X=ENCMR" D ^DIE
84 . W !,"Generating FR Documents..."
85 . K ^TMP($J)
86 . S X=$$FRCMR(ENCMR("DA"))
87 . W X," sent."
88 . I $D(^TMP($J)) D FRERR K ^TMP($J)
89 ;
90 S ENCMR("SN")=$P($G(^ENG(6914.1,ENCMR("DA"),0)),U,7)
91 I ENCMR("SN")]"",ENCMR("SN")'=ENCMR("SN",0) D
92 . W !!,"Since a new station number was entered, the computer will"
93 . W !,"attempt to update the station numbers of equipment on this CMR."
94 . S DA=ENCMR("DA") D CMRSTA^ENFAUTL
95 ;
96 L -^ENG(6914.1,ENCMR("DA"))
97 ;
98 G CMRASK
99CMRX ;
100 K DA,DIC,DIE,DR,DTOUT,X,Y
101 K ENCMR,ENEQ
102 Q
103 ;
104FREIL(ENEIL) ; Batch Send FR Documents for equipment on EIL
105 ; Input
106 ; ENEIL - EIL code
107 ; Returns number of FR Documents sent
108 ; Output
109 ; (optional) ^TMP($J,"BAD",equipment ien,line#)=validation problem
110 N ENC,ENCMR
111 S ENC=0
112 ; check format of EIL
113 Q:ENEIL'?2E ENC
114 ; loop thru CMRs that begin with the EIL
115 S ENCMR=ENEIL_$C(9) ; force non-numeric
116 F S ENCMR=$O(^ENG(6914.1,"B1",ENCMR)) Q:$E(ENCMR,1,2)'=ENEIL D
117 . S ENCMR("DA")=0
118 . F S ENCMR("DA")=$O(^ENG(6914.1,"B1",ENCMR,ENCMR("DA"))) Q:'ENCMR("DA") S ENC=ENC+$$FRCMR(ENCMR("DA"))
119 Q ENC
120 ;
121FRCMR(ENCMRI) ; Batch Send FR Documents for equipment on CMR
122 ; This code is used to generate FR Documents without user interaction.
123 ; It is called when a batch of FR Documents are being sent due to
124 ; a change of CMR name or EIL cost center.
125 ; Input
126 ; ENCMRI - ien of CMR
127 ; Returns number of FR Documents sent
128 ; Output
129 ; (optional) ^TMP($J,"BAD",equipment ien,line#)=validation problem
130 ;
131 N ENBAT,ENC,ENDO,ENEQ,ENFA,ENFAP,ENFR,ENX
132 ;W !,?5,"CMR: ",$P($G(^ENG(6914.1,ENCMRI,0)),U)
133 S ENC=0,ENBAT("SILENT")=1
134 ; loop thru equipment on cmr
135 S ENEQ("DA")=0
136 F S ENEQ("DA")=$O(^ENG(6914,"AD",ENCMRI,ENEQ("DA"))) Q:'ENEQ("DA") D
137 . S ENX=$$CHKFA^ENFAUTL(ENEQ("DA"))
138 . Q:+ENX=0 ; don't send FR when equipment not reported to FAP
139 . ;W !,?10,"ENTRY #: ",ENEQ("DA")
140 . S ENFA("DA")=$P(ENX,U,4)
141 . F I=1,2,3,8,9 S ENEQ(I)=$G(^ENG(6914,ENEQ("DA"),I))
142 . ; create and send a FR document
143 . S ENDO=1,ENFR("DA")=""
144 . D ADDFR^ENFAXFR
145 . D:ENDO
146 . . ; populate FR Document
147 . . S ENFAP(100)=$G(^ENG(6915.6,ENFR("DA"),100))
148 . . S $P(ENFAP(100),U,2)=$P(ENEQ(9),U,7) ; fund (required)
149 . . S $P(ENFAP(100),U,3)=$P(ENEQ(9),U,8) ; a/o (required)
150 . . S $P(ENFAP(100),U,5)=$P(ENEQ(9),U,6) ; boc (deleted when blank sent)
151 . . S $P(ENFAP(100),U,6)=$P(ENEQ(2),U,9) ; cmr (determines cost ctr)
152 . . S ^ENG(6915.6,ENFR("DA"),100)=ENFAP(100)
153 . D:ENDO CVTDATA^ENFAXFR
154 . D:ENDO
155 . . S ENFAP("DOC")="FR" D ^ENFAVAL
156 . . I $D(^TMP($J,"BAD",ENEQ("DA"))) S ENDO=0
157 . I 'ENDO,$G(ENFR("DA"))]"" D
158 . . S DA=ENFR("DA"),DIK="^ENG(6915.6," D ^DIK K DIK
159 . I ENDO D ^ENFAXMT S ENC=ENC+1
160 . I $G(ENFR("DA"))]"" L -^ENG(6915.6,ENFR("DA"))
161 Q ENC
162 ;
163FRERR ; List equipment whose FR failed validation
164 ; Input
165 ; ^TMP($J,"BAD",equipment ien,line#)=validation problem
166 Q:'$D(^TMP($J,"BAD"))
167 N ENDA,ENI
168 W !!,"FR Documents could not be created for some equipment items."
169 S ENDA=0 F S ENDA=$O(^TMP($J,"BAD",ENDA)) Q:'ENDA D
170 . W !!,?2,"Equipment Entry #",ENDA,"'s FR Document invalid because"
171 . F ENI=1:1 Q:'$D(^TMP($J,"BAD",ENDA,ENI)) W !,?4,^(ENI)
172 Q
173 ;
174 ;ENFAEIL
Note: See TracBrowser for help on using the repository browser.