source: WorldVistAEHR/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLOUSR2.m@ 1154

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

revised back to 6/30/08 version

File size: 6.8 KB
Line 
1HLOUSR2 ;ALB/CJM -ListManager Screen for viewing messages(continued);12 JUN 1997 10:00 am ;03/19/2007
2 ;;1.6;HEALTH LEVEL SEVEN;**126,134**;Oct 13, 1995;Build 30
3 ;Per VHA Directive 2004-038, this routine should not be modified
4 ;
5EN ;
6 D WAIT^DICD
7 D EN^VALM("HLO MESSAGE VIEWER")
8 Q
9 ;
10SHOWLIST(TYPE) ;
11 ;TYPE= "SE", "AE", "TF"
12 N PARMS,I,ERRCOUNT
13 S (VALMBG,VALMCNT,I,ERRCOUNT)=0
14 D CLEAN^VALM10
15 S VALMBG=1
16 I '$$ASKPARMS(.PARMS) S VALMBCK="" Q
17 I PARMS("ALL") D
18 .N APP
19 .S APP=""
20 .F S APP=$O(^HLB("ERRORS",TYPE,APP)) Q:APP="" D Q:ERRCOUNT>PARMS("MAX")
21 ..N TIME,IEN
22 ..S TIME=PARMS("START")
23 ..Q:($O(^HLB("ERRORS",TYPE,APP,TIME))="")
24 ..S @VALMAR@($$I,0)="Application: "_APP
25 ..D CNTRL^VALM10(VALMCNT,14,$L(APP),IOINHI,IOINORM)
26 ..F S TIME=$O(^HLB("ERRORS",TYPE,APP,TIME)) Q:'TIME Q:ERRCOUNT>PARMS("MAX") S IEN="" F S IEN=$O(^HLB("ERRORS",TYPE,APP,TIME,IEN)) Q:IEN="" D ADDTO(TYPE,IEN,TIME,.ERRCOUNT) Q:ERRCOUNT>PARMS("MAX")
27 E D
28 .N APP
29 .S APP=PARMS("APP")
30 .N TIME,IEN
31 .S TIME=PARMS("START")
32 .Q:$O(^HLB("ERRORS",TYPE,APP,TIME))=""
33 .S @VALMAR@($$I,0)="Application: "_APP
34 .D CNTRL^VALM10(VALMCNT,14,$L(APP),IOINHI,IOINORM)
35 .F S TIME=$O(^HLB("ERRORS",TYPE,APP,TIME)) Q:'TIME Q:ERRCOUNT>PARMS("MAX") S IEN="" F S IEN=$O(^HLB("ERRORS",TYPE,APP,TIME,IEN)) Q:IEN="" D ADDTO(TYPE,IEN,TIME,.ERRCOUNT) Q:ERRCOUNT>PARMS("MAX")
36 ;
37SHOW S VALMBCK="R"
38 ;
39 Q
40ADDTO(LTYPE,IEN,TIME,ERRCOUNT) ;
41 N NODE,MSG
42 Q:'$$GETMSG^HLOMSG(+IEN,.MSG)
43 S ERRCOUNT=ERRCOUNT+1
44 I LTYPE'="AE" D
45 .N TYPE
46 .S TYPE=$S(MSG("BATCH"):"BATCH",1:MSG("MESSAGE TYPE")_"~"_MSG("EVENT"))
47 .S @VALMAR@($$I,0)=" "_$$LJ(MSG("ID"),15)_$$LJ(TYPE,8)_$$LJ($$FMTE^XLFDT(TIME,2),20)_MSG("STATUS","ERROR TEXT")
48 .D CNTRL^VALM10(VALMCNT,3,15,IOINHI,IOINORM)
49 .S:MSG("ID")]"" @VALMAR@("INDEX",MSG("ID"))=IEN
50 E D
51 .;application errors - could be an error to a msg within a batch
52 .;also, need to go to the ack msg to get the error text from the MSA segment
53 .;
54 .N SUBIEN,MSA,ERRTEXT
55 .S (ERRTEXT,MSA)=""
56 .S SUBIEN=$P(IEN,"^",2)
57 .;within batch?
58 .D:SUBIEN GETMSGB^HLOMSG1(.MSG,SUBIEN,.MSG)
59 .S ERRTEXT=MSG("STATUS","ERROR TEXT")
60 .I ERRTEXT="",MSG("ACK BY")]"",($$FINDMSG^HLOMSG1(MSG("ACK BY"),.LIST)=1) D
61 ..N MSG,SEG,FS,AIEN
62 ..S AIEN=+LIST(1),SUBIEN=$P(LIST(1),"^",2)
63 ..Q:'$$GETMSG^HLOMSG(AIEN,.MSG)
64 ..I SUBIEN S MSG("BATCH","CURRENT MESSAGE")=SUBIEN,MSG("LINE COUNT")=0
65 ..F Q:'$$HLNEXT^HLOMSG(.MSG,.SEG) I $E(SEG(1),1,3)="MSA" S MSA=SEG(1),FS=$E(MSA,4),ERRTEXT=$P(MSA,FS,4) Q
66 .S @VALMAR@($$I,0)=" "_$$LJ(MSG("ID"),15)_$$LJ(MSG("MESSAGE TYPE")_"~"_MSG("EVENT"),8)_$$LJ($$FMTE^XLFDT(MSG("DT/TM CREATED"),2),20)_$E(ERRTEXT,1,37)
67 .D CNTRL^VALM10(VALMCNT,3,15,IOINHI,IOINORM)
68 .I $L(ERRTEXT)>37 D
69 ..S @VALMAR@($$I,0)="~"_$E(ERRTEXT,38,112)
70 ..D CNTRL^VALM10(VALMCNT,1,1,IORVON,IORVOFF)
71 .S:MSG("ID")]"" @VALMAR@("INDEX",MSG("ID"))=IEN
72 Q
73 ;
74ASKPARMS(PARMS) ;
75 K PARMS
76 S PARMS("START")=$$ASKBEGIN("T-1")
77 I 'PARMS("START") Q 0
78 S PARMS("MAX")=$$ASKMAX()
79 Q:'(PARMS("MAX")>-1) 0
80 S PARMS("ALL")=$$ASKYESNO("Include ALL applications","YES")
81 I PARMS("ALL") Q 1
82 I PARMS("ALL")="" Q 0
83 S PARMS("APP")=$$ASKAPP
84 I PARMS("APP")="" Q 0
85 Q 1
86 ;
87ASKMAX() ;
88 N DIR
89 S DIR(0)="N^1:30000:0"
90 S DIR("A")="Maximum List Size"
91 S DIR("B")=1000
92 S DIR("?",1)="In case a large number of errors meet your search criteria, what are the"
93 S DIR("?")="maximum number of errors to display? (30,000 maximum)"
94 D ^DIR
95 Q:$D(DTOUT)!$D(DUOUT) -1
96 Q X-1
97ASKAPP() ;
98 D FULL^VALM1
99 S VALMBCK="R"
100 N DIR
101 S DIR(0)="F^3:60"
102 S DIR("A")="Application"
103 S DIR("?")="Enter the full name of the application, or '^' to exit."
104 S DIR("?",1)="For transmission failures, enter the sending application. "
105 S DIR("?",2)="For other errors, enter the name of the receiving application. "
106 D ^DIR
107 I $D(DIRUT)!(Y="") Q ""
108 Q Y
109 ;
110ASKYESNO(PROMPT,DEFAULT) ;
111 ;Description: Displays PROMPT, appending '?'. Expects a YES NO response
112 ;Input:
113 ; PROMPT - text to display as prompt. Appends '?'
114 ; DEFAULT - (optional) YES or NO. If not passed, defaults to YES
115 ;Output:
116 ; Function value: 1 if yes, 0 if no, "" if '^' entered or timeout
117 ;
118 N DIR,Y
119 S DIR(0)="Y"
120 S DIR("A")=PROMPT
121 S DIR("B")=$S($G(DEFAULT)="NO":"NO",1:"YES")
122 D ^DIR
123 Q:$D(DIRUT) ""
124 Q Y
125 ;
126STRTSTPQ ;
127 ;action to start or stop a queue, either incoming or outgoing
128 ;
129 N STOP,INOROUT,QUE
130 S VALMBCK="R"
131 D FULL^VALM1
132 ;ask if stop or start
133 D Q:STOP=""
134 .N DIR
135 .S DIR(0)="S^1:START;2:STOP"
136 .S DIR("A")="Do you want to START or STOP a queue"
137 .S DIR("B")="1"
138 .D ^DIR
139 .S STOP=$S(Y=1:0,Y=2:1,1:"")
140 ;ask if in or out
141 D Q:INOROUT=""
142 .N DIR
143 .S DIR(0)="S^I:INCOMING;O:OUTGOING"
144 .S DIR("A")="Do you want to "_$S(STOP:"stop",1:"start")_" an incoming queue or an outgoing queue"
145 .S DIR("B")="I"
146 .D ^DIR
147 .S INOROUT=$S(Y="I":"IN",Y="O":"OUT",1:"")
148 S QUE=$$ASKQUE(INOROUT)
149 Q:QUE=""
150 I STOP=$$STOPPED^HLOQUE(INOROUT,QUE) D
151 .N C
152 .I STOP D
153 ..W !,"That queue is already stopped!"
154 .E W !,"That queue is not stopped!"
155 .W !,IOINHI,"Hit any key to continue...",IOINORM
156 .R *C:DTIME
157 E D
158 .N C
159 .D:STOP STOPQUE^HLOQUE(INOROUT,QUE)
160 .D:'STOP STARTQUE^HLOQUE(INOROUT,QUE)
161 .W !,"DONE!"
162 .W !,IOINHI,"Hit any key to continue...",IOINORM
163 .R *C:DTIME
164 .D @HLRFRSH
165 Q
166 ;
167ASKQUE(DIR) ;
168 N QUEUE
169AGAIN W !,"Enter the full, exact name of queue:"
170 S QUEUE=""
171 R QUEUE:60 I '$T Q ""
172 I $E(QUEUE)="?" W !,"Each message is placed on a queue that has an arbitrary name up to 20",!,"characters long." I $$ASKYESNO("Would you like to see a list of the queues that currently exist","NO") D G AGAIN
173 .N SUB,QUE,QUIT,COUNT
174 .K ^TMP($J,"HLO QUEUES")
175 .S SUB=""
176 .F S SUB=$O(^HLB("QUEUE",DIR,SUB)) Q:SUB="" D
177 ..S QUE=""
178 ..F S QUE=$O(^HLB("QUEUE",DIR,SUB,QUE)) Q:QUE="" S ^TMP($J,"HLO QUEUES",QUE)=""
179 .S QUE=""
180 .S IOSL=$G(IOSL,20)
181 .S (COUNT,QUIT)=0
182 .W !
183 .F S QUE=$O(^TMP($J,"HLO QUEUES",QUE)) Q:QUE="" Q:QUIT D
184 ..W !,QUE
185 ..S COUNT=COUNT+1
186 ..I COUNT>(IOSL-3) D
187 ...N Y
188 ...D PAUSE^VALM1
189 ...I 'Y S QUIT=1
190 ...S COUNT=0
191 .W !
192 .K ^TMP($J,"HLO QUEUES")
193 Q:$E(QUEUE)="?" ""
194 Q:$E(QUEUE)="^" ""
195 Q QUEUE
196 ;
197ASKBEGIN(DEFAULT) ;
198 ;Description: Asks the user to enter a beginning date.
199 ;Input: DEFAULT - the suggested default dt/time (optional)
200 ;Output: Returns the date as the function value, or 0 if the user does not select a date
201 ;
202 ;
203 N %DT
204 S %DT="AEST"
205 S %DT("A")="Enter the beginning date/time: "
206 S %DT("B")=$$FMTE^XLFDT($S($L($G(DEFAULT)):DEFAULT,1:$$FMADD^XLFDT(DT,-1)))
207 S %DT(0)="-NOW"
208 Q:$D(DTOUT) 0
209 D ^%DT
210 I Y=-1 Q 0
211 Q Y
212 ;
213ASKEND(BEGIN) ;
214 ;Description: Asks the user to enter an ending date/time
215 ;Input: BEGIN - the earliest date/time allowed
216 ;Output: Returns the date as the function value, or 0 if the user does not select a date/time
217 ;
218 N %DT
219 S %DT="AEST"
220 S %DT("A")="Enter the ending date/time: "
221 S %DT("B")="NOW"
222 S %DT(0)=BEGIN
223 Q:$D(DTOUT) 0
224 D ^%DT
225 I Y=-1 Q 0
226 Q Y
227 ;
228LJ(STRING,LEN) ;
229 Q $$LJ^XLFSTR(STRING,LEN)
230 ;
231I() ;
232 S VALMCNT=VALMCNT+1
233 Q VALMCNT
234 ;
235HEADER ;
236 Q
Note: See TracBrowser for help on using the repository browser.