source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENEQ2.m@ 1739

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

initial load of WorldVistAEHR

File size: 5.8 KB
Line 
1ENEQ2 ;WIRMFO/DH,SAB-Edit or Display Equipment Records ;4.15.97
2 ;;7.0;ENGINEERING;**14,25,29,35,39**;Aug 17, 1993
3 ;
4EQED ;Edit Record Entry Point
5 S ENEQ("MODE")="E"
6 S ENEDNX=$D(^XUSEC("ENEDNX",DUZ))
7 S ENEDPM=$D(^XUSEC("ENEDPM",DUZ))
8 G SELEQ
9 ;
10EQDS ;Display Record Entry Point
11 S ENEQ("MODE")="D"
12 G SELEQ
13 ;
14SELEQ ; select (and process) equipment for edit or display
15 ; input
16 ; ENEQ("MODE") - switch: 'E' for edit or 'D" for display
17 ; also when ENEQ("MODE")="E"
18 ; ENEDNX - flag, true if user holds key ENEDNX
19 ; ENEDPM - flag, true if user holds key ENEDPM
20 N IOINLOW,IOINHI D ZIS^ENUTL
21 S ENEQ("LVL")=0
22 S END=0
23 ; select and process equipment
24 F D GETEQ^ENUTL Q:Y<1 S ENDA=+Y D EQP Q:END
25 ; clean up
26 K:ENEQ("MODE")="E" ENEDNX,ENEDPM
27 K DIC,END,ENDA,ENEQ,Y
28 Q
29 ;
30EQP ; process one equipment item (display or edit)
31 ; input
32 ; ENDA - ien of equipment item
33 ; ENEQ("MODE") - switch: 'E' for edit or 'D' for Display
34 ; ENEQ("LVL") - recursion level
35 ; IOINHI - bold escape code
36 ; IOINLOW - unbold escape code
37 ; END - flag, true when entire process should stop
38 ; also when ENEQ("MODE")="E"
39 ; ENEDPM - flag; true if user holds ENEDPM key
40 ; ENEDNX - flag; true if user holds ENEDNX key
41 ; output
42 ; END - flag, true when entire process should stop
43 ;
44 Q:END
45 ; lock equipment
46 L +^ENG(6914,ENDA):3 I '$T D G EQPX
47 . W $C(7),!,"Record being edited by someone else. Try later."
48 . S DIR(0)="E" D ^DIR K DIR S:$D(DTOUT) END=1
49 ; call DJ screen handler
50 I ENEQ("MODE")="D" S DJSC="ENEQ1D",DJDIS=1
51 I ENEQ("MODE")="E" S DJSC=$S($P($G(^ENG(6914,ENDA,0)),U,4)'="NX"!ENEDNX:"ENEQ1",1:"ENEQNX1")
52 S (DJDN,DA)=ENDA
53 D EN^ENJ W IOINLOW
54 ; PM Data edit (edit mode only)
55 I ENEQ("MODE")="E",ENEDPM D
56 . S DIR(0)="Y",DIR("A")="Want to enter/edit PM data",DIR("B")="NO"
57 . D ^DIR K DIR S:$D(DTOUT) END=1 Q:'Y
58 . S DIE="^ENG(6914,",DA=ENDA,ENXP=1 D XNPMSE^ENEQPMP
59 . K ENXP
60 ; display comments & spex (display mode only)
61 I ENEQ("MODE")="D",$O(^ENG(6914,ENDA,5,0))!$O(^ENG(6914,ENDA,10,0)) D
62 . W @IOF," ***ENTRY NUMBER:",ENDA,"***"
63 . ; show COMMENTS (if any)
64 . I $O(^ENG(6914,ENDA,5,0)) D WP(ENDA,"COMMENTS",5)
65 . ; show SPEX (if any)
66 . I '$G(END1),$O(^ENG(6914,ENDA,10,0)) D WP(ENDA,"SPEX",10)
67 . ; pause
68 . I '$G(END1) S DIR(0)="E" D ^DIR K DIR S:$D(DTOUT) END=1
69 . K END1
70 ; unlock equip
71 L -^ENG(6914,ENDA)
72 ; check for components
73 I 'END,$O(^ENG(6914,"AE",ENDA,0)) D
74 . ; ask if components should be listed
75 . S DIR(0)="Y",DIR("B")="NO"
76 . S DIR("A")="Equipment has components. Do you want a list (Y/N)"
77 . D ^DIR K DIR S:$D(DTOUT) END=1 Q:'Y
78 . ; increment recursion level
79 . S ENEQ("LVL")=ENEQ("LVL")+1
80 . ; build list
81 . K ^TMP("ENC",$J,ENEQ("LVL"))
82 . S (ENCDA,ENL)=0
83 . F S ENCDA=$O(^ENG(6914,"AE",ENDA,ENCDA)) Q:'ENCDA D
84 . . S ENL=ENL+1
85 . . S ^TMP("ENC",$J,ENEQ("LVL"),ENCDA)=""
86 . S ^TMP("ENC",$J,ENEQ("LVL"),0)=ENDA_U_ENL
87 . ; display list
88 . D LISTC
89 . ; kill saved list
90 . K ^TMP("ENC",$J,ENEQ("LVL"))
91 . ; decrement recursion level
92 . S ENEQ("LVL")=ENEQ("LVL")-1
93EQPX ; clean up
94 W @IOF
95 K DA,DIE,DIROUT,DIRUT,DR,DTOUT,DUOUT
96 K DJDIS,DJD0,DJDN,DJLG,DJSC,DJSW2
97 K ENCDA,ENL
98 Q
99 ;
100WP(ENDA,ENFIELD,ENNODE) ; display word-processing field
101 ; input
102 ; ENDA - ien of equipment
103 ; ENFIELD - name of field being displayed
104 ; ENNODE - node where field is located in file 6914
105 ; output
106 ; END - (optional) true if user timed-out
107 ; END1 - (optional) true if user entered '^' or timed-out
108 N ENI
109 K ^UTILITY($J,"W") S DIWL=1,DIWR=76,DIWF="W"
110 W !!,IOINHI,ENFIELD_":",IOINLOW
111 S ENI=0 F S ENI=$O(^ENG(6914,ENDA,ENNODE,ENI)) Q:'ENI D Q:$G(END1)
112 . I $Y>19 D Q:$G(END1)
113 . . S DIR(0)="E" D ^DIR K DIR S:$D(DTOUT) END=1 S:'Y END1=1 Q:$G(END1)
114 . . W @IOF," ***ENTRY NUMBER:",ENDA,"***"
115 . . W !!,IOINHI,ENFIELD_" (continued):",IOINLOW
116 . S X=^ENG(6914,ENDA,ENNODE,ENI,0) D ^DIWP
117 I '$G(END1) D ^DIWW
118 K ^UTILITY($J,"W"),DIWL,DIWR,DIWF
119 Q
120 ;
121LISTC ; Show/Select-From Component List
122 ; input
123 ; ENEQ("LVL") - recursion level
124 ; ^TMP("ENC",$J,ENEQ("LVL"),0)=parent ien^number of components
125 ; ^TMP("ENC",$J,ENEQ("LVL"),component ien)=""
126 ; END - flag; true if entire process should stop
127 ; output
128 ; END - flag; true if entire process should stop
129 ;
130 ; build screen array from component list
131 K ^TMP($J,"SCR")
132 S ENCDA=0,ENC=0
133 F S ENCDA=$O(^TMP("ENC",$J,ENEQ("LVL"),ENCDA)) Q:'ENCDA D
134 . S ENC=ENC+1
135 . S ENX=ENCDA_U_$E($$GET1^DIQ(6914,ENCDA,3),1,20)
136 . S ENX=ENX_U_$E($$GET1^DIQ(6914,ENCDA,6),1,20)
137 . S ENX=ENX_U_$E($$GET1^DIQ(6914,ENCDA,24),1,10)
138 . S ^TMP($J,"SCR",ENC)=ENX
139 S ENX=^TMP("ENC",$J,ENEQ("LVL"),0)
140 S ^TMP($J,"SCR")=ENC_U_"Equip. #"_$P(ENX,U)_" Component List"
141 S ENX="6;10;Entry#^18;20;Mfgr. Equip. Name"
142 S ENX=ENX_"^40;20;Category^62;10;Location"
143 S ^TMP($J,"SCR",0)=ENX
144LISTC1 ; call list handler
145 D EN^ENPLS2
146 ; save selected items
147 K ^TMP("ENC",$J,ENEQ("LVL"),"ACL")
148 S ENC=0,ENJ="" F S ENJ=$O(ENACL(ENJ)) Q:ENJ="" D
149 . F ENK=1:1 S ENI=$P(ENACL(ENJ),",",ENK) Q:ENI="" D
150 . . S ENY=^TMP($J,"SCR",ENI)
151 . . S ^TMP("ENC",$J,ENEQ("LVL"),"ACL",$P(ENY,U))=$P(ENY,U,5)
152 . . S ENC=ENC+1
153 S:ENC ^TMP("ENC",$J,ENEQ("LVL"),"ACL",0)=ENC
154 ; process selected items
155 S ENDA=0,END(ENEQ("LVL"))=0
156 F S ENDA=$O(^TMP("ENC",$J,ENEQ("LVL"),"ACL",ENDA)) Q:'ENDA D Q:END(ENEQ("LVL"))
157 . D EQP Q:END
158 . Q:'$O(^TMP("ENC",$J,ENEQ("LVL"),"ACL",ENDA)) ; no more left
159 . ; give user chance to break out of this loop or entire process
160 . S DIR(0)="FO"
161 . S DIR("A")="Press RETURN to continue, '^' to exit, or '^^' to stop"
162 . D ^DIR K DIR
163 . S:$D(DTOUT)!$D(DIROUT) END=1 S:END!$D(DUOUT) END(ENEQ("LVL"))=1
164 K END(ENEQ("LVL"))
165 ; restore ENDA to value of parent
166 S ENDA=$P($G(^TMP("ENC",$J,ENEQ("LVL"),0)),U)
167 ; if items selected then redisplay list
168 I 'END,$G(^TMP("ENC",$J,ENEQ("LVL"),"ACL",0))>0 G LISTC
169LISTCX ; clean up
170 K ^TMP($J,"SCR"),^TMP("ENC",$J,ENEQ("LVL"),"ACL")
171 K ENACL,ENC,ENCDA,ENI,ENJ,ENK,ENY,ENX
172 Q
173 ;ENEQ2
Note: See TracBrowser for help on using the repository browser.