source: FOIAVistA/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLOUSR2.m@ 812

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

initial load of FOIAVistA 6/30/08 version

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