source: FOIAVistA/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLOUSR1.m@ 632

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

initial load of FOIAVistA 6/30/08 version

File size: 7.8 KB
Line 
1HLOUSR1 ;ALB/CJM -ListManager Screen for viewing messages;12 JUN 1997 10:00 am ;07/25/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 N MSGIEN
7 S MSGIEN=$$PICKMSG
8 I 'MSGIEN S VALMBCK="R" Q
9 D EN^VALM("HLO SINGLE MESSAGE DISPLAY")
10 Q
11 ;
12HDR ;
13 Q
14 ;
15BLANK ;
16 S VALMCNT=0
17 D EXIT
18 Q
19DISPLAY ;
20 K @VALMAR
21 S VALMBCK="R"
22 N MSG
23 S VALMBG=1
24 Q:'MSGIEN
25 D SHOWMSG($P(MSGIEN,"^"),$P(MSGIEN,"^",2))
26 Q
27 ;
28PICKMSG() ;
29 ;ask the user to select a message & return its ien
30 N MSGIEN,DIR,COUNT,LIST
31 D FULL^VALM1
32 S DIR(0)="F3:30"
33 S DIR("A")="Message ID"
34 S DIR("?")="Enter the full Message Control ID or Batch Control ID of the message, or '^' to exit."
35PICK D ^DIR
36 I $D(DIRUT)!(Y="") Q 0
37 I $G(@VALMAR@("INDEX",Y)) Q $G(@VALMAR@("INDEX",Y))
38 S COUNT=$$FINDMSG^HLOMSG1(Y,.LIST)
39 I COUNT="0" W !!,"That message can not be found! Try Again",! G PICK
40 I COUNT=1 Q LIST(1)
41 I COUNT>1 D
42 .N ITEM
43 .W !,"There is more than one message with that ID! You must choose one to display.",1
44 .S ITEM=0
45 .F S ITEM=$O(LIST(ITEM)) Q:'ITEM D
46 ..N MSG
47 ..Q:'$$GETMSG^HLOMSG(+LIST(ITEM),.MSG)
48 ..W !,"[",ITEM,"]"," DT/TM: ",$$FMTE^XLFDT(MSG("DT/TM CREATED"),2)," STATUS: ",MSG("STATUS")
49 .S DIR(0)="NO^1:"_COUNT,DIR("A")="Choose",DIR("?")="Choose one message from the list"
50 .D ^DIR
51 .I Y S Y=LIST(Y)
52 Q Y
53 ;
54HELP ;Help code
55 S X="?" D DISP^XQORM1 W !!
56 Q
57 ;
58EXIT ;Exit code
59 D CLEAN^VALM10
60 D CLEAR^VALM1
61 S VALMBCK="R"
62 ;
63 Q
64 ;
65EXPND ;Expand code
66 Q
67 ;
68CJ(STRING,LEN) ;
69 Q $$CJ^XLFSTR(STRING,LEN)
70LJ(STRING,LEN) ;
71 Q $$LJ^XLFSTR(STRING,LEN)
72SP(LEN,CHAR) ;
73 ;return padding - " " is the default pad character
74 N STR
75 S:$G(CHAR)="" CHAR=" "
76 S $P(STR,CHAR,LEN)=CHAR
77 Q STR
78 ;
79SHOWMSG(MSGIEN,SUBIEN) ;
80 ;Description:
81 ;
82 ;Input:
83 ;Output:
84 ;
85 N MSG,I,TEMP,LINE
86 S VALMCNT=0
87 S SUBIEN=+$G(SUBIEN)
88 I '$$GETMSG^HLOMSG(MSGIEN,.MSG) W !,"UNABLE TO DISPLAY THE MESSAGE",!! Q
89 I SUBIEN D GETMSGB^HLOMSG1(.MSG,SUBIEN,.MSG)
90 ;
91 S I=0
92 ;** administrative information **
93 S @VALMAR@($$I,0)=$$CJ("Administrative Information",80)
94 D CNTRL^VALM10(VALMCNT,26,30,IORVON,IORVOFF)
95 S LINE="MsgID: "_$$LJ(MSG("ID"),18)
96 S LINE=LINE_"Status: "_$$LJ(MSG("STATUS"),5)
97 S:MSG("ACK TO")]"" LINE=LINE_$$LJ(" Ack To:",14)_MSG("ACK TO")
98 S:MSG("ACK BY")]"" LINE=LINE_$$LJ(" Ack'd By:",14)_MSG("ACK BY")
99 S @VALMAR@($$I,0)=LINE
100 I MSG("STATUS","ERROR TEXT")]"" S @VALMAR@($$I,0)="Error: "_"** "_MSG("STATUS","ERROR TEXT")_" **"
101 S @VALMAR@($$I,0)="Dir: "_$$LJ($S(MSG("DIRECTION")="IN":"INCOMING",1:"OUTGOING"),10)_$$LJ(" Trans Dt/Tm: ",12)_$$FMTE^XLFDT(MSG("DT/TM"),2)_$$LJ(" Purge DT/TM: ",8)_$$FMTE^XLFDT(MSG("STATUS","PURGE"),2)
102 S @VALMAR@($$I,0)="Link: "_$$LJ(MSG("STATUS","LINK NAME"),29)_" "_$$LJ("Queue: ",13)_MSG("STATUS","QUEUE")
103 I $L($G(MSG("STATUS","SEQUENCE QUEUE"))) D
104 .S @VALMAR@($$I,0)="Sequence Queue: "_MSG("STATUS","SEQUENCE QUEUE")_" Moved: "_$S(MSG("STATUS","MOVED TO OUT QUEUE"):"YES",1:"NO")
105 I MSG("STATUS","ACCEPT ACK'D") D
106 .S @VALMAR@($$I,0)="Accept Ack: "_$$LJ(MSG("STATUS","ACCEPT ACK ID"),26)_$$LJ(" DT/TM Ack'd: ",14)_$$FMTE^XLFDT(MSG("STATUS","ACCEPT ACK DT/TM"),2)
107 .S @VALMAR@($$I,0)=" "_MSG("STATUS","ACCEPT ACK MSA")
108 I MSG("DIRECTION")="IN" D
109 .S LINE="App Response Rtn: "
110 .I $L($G(MSG("STATUS","APP ACK RESPONSE"))) S LINE=$$LJ(LINE_MSG("STATUS","APP ACK RESPONSE"),38)_" Executed: "_$S(MSG("STATUS","APP HANDOFF"):" YES",1:" NO")
111 .S @VALMAR@($$I,0)=LINE
112 I MSG("DIRECTION")="OUT",(MSG("STATUS","APP ACK'D")!MSG("STATUS","ACCEPT ACK'D")) D
113 .S LINE=""
114 .I MSG("STATUS","ACCEPT ACK'D") D
115 ..I MSG("STATUS","ACCEPT ACK RESPONSE")="" S MSG("STATUS","ACCEPT ACK RESPONSE")="n/a"
116 ..S LINE="Accept Ack Rtn: "_MSG("STATUS","ACCEPT ACK RESPONSE")
117 .S LINE=$$LJ(LINE,39)
118 .I MSG("STATUS","APP ACK'D") D
119 ..I MSG("STATUS","APP ACK RESPONSE")="" S MSG("STATUS","APP ACK RESPONSE")="n/a"
120 ..S LINE=LINE_"App Ack Rtn: "_MSG("STATUS","APP ACK RESPONSE")
121 .S @VALMAR@($$I,0)=LINE
122 ;
123 ;** the message text **
124 S @VALMAR@($$I,0)=""
125 I '$G(SUBIEN) D
126 .S @VALMAR@($$I,0)=$$CJ("Message Text",80)
127 .D CNTRL^VALM10(VALMCNT,33,16,IORVON,IORVOFF)
128 E D
129 .S @VALMAR@($$I,0)=$$CJ("Individual Message Text (Batched)",80)
130 .D CNTRL^VALM10(VALMCNT,23,35,IORVON,IORVOFF)
131 D SHOWBODY(.MSG,$G(SUBIEN))
132 ;
133 ;** display its application acknowledgment **
134 I MSG("ACK BY")]"",$$FINDMSG^HLOMSG1(MSG("ACK BY"),.TEMP)=1 S MSGIEN=TEMP(1) D
135 .N MSG
136 .Q:'$$GETMSG^HLOMSG(+MSGIEN,.MSG)
137 .I $P(MSGIEN,"^",2) D GETMSGB^HLOMSG1(.MSG,$P(MSGIEN,"^",2),.MSG)
138 .S @VALMAR@($$I,0)=""
139 .S @VALMAR@($$I,0)=$$CJ("Application Acknowledgment",80)
140 .D CNTRL^VALM10(VALMCNT,26,30,IORVON,IORVOFF)
141 .D SHOWBODY(.MSG,$P(MSGIEN,"^",2))
142 ;
143 ;** display the original message **
144 I MSG("ACK TO")]"",$$FINDMSG^HLOMSG1(MSG("ACK TO"),.TEMP)=1 S MSGIEN=TEMP(1) D
145 .N MSG
146 .Q:'$$GETMSG^HLOMSG(+MSGIEN,.MSG)
147 .I $P(MSGIEN,"^",2) D GETMSGB^HLOMSG1(.MSG,$P(MSGIEN,"^",2),.MSG)
148 .S @VALMAR@($$I,0)=""
149 .S @VALMAR@($$I,0)=$$CJ("Original Message",80)
150 .D CNTRL^VALM10(VALMCNT,26,30,IORVON,IORVOFF)
151 .D SHOWBODY(.MSG,$P(MSGIEN,"^",2))
152 Q
153 ;
154SHOWBODY(MSG,SUBIEN) ;
155 N NODE,I,SEG,QUIT
156 S QUIT=0
157 M SEG=MSG("HDR")
158 D ADD(.SEG)
159 S MSG("BATCH","CURRENT MESSAGE")=0
160 I MSG("BATCH") D
161 .I $G(SUBIEN) D Q
162 ..S MSG("BATCH","CURRENT MESSAGE")=SUBIEN
163 ..F Q:'$$HLNEXT^HLOMSG(.MSG,.SEG) D ADD(.SEG)
164 .S MSG("BATCH","CURRENT MESSAGE")=0
165 .N LAST S LAST=0
166 .F Q:'$$NEXTMSG^HLOMSG(.MSG,.SEG) D Q:QUIT
167 ..D ADD(.SEG)
168 ..S LAST=MSG("BATCH","CURRENT MESSAGE")
169 ..F Q:'$$HLNEXT^HLOMSG(.MSG,.SEG) D ADD(.SEG)
170 .I MSG("DIRECTION")="OUT" K SEG S SEG(1)="BTS"_$E($G(NODE(1)),4)_LAST D ADD(.SEG)
171 E D
172 .F Q:'$$HLNEXT^HLOMSG(.MSG,.SEG) D Q:QUIT
173 ..D ADD(.SEG)
174 Q
175I() ;
176 S VALMCNT=VALMCNT+1
177 Q VALMCNT
178ADD(SEG) ;
179 N QUIT,I,J,LINE
180 S QUIT=0
181 S (I,J)=1
182 S LINE(1)=$E(SEG(1),1,80),SEG(1)=$E(SEG(1),81,9999)
183 I SEG(1)="" K SEG(1)
184 D SHIFT(.I,.J)
185 S @VALMAR@($$I,0)=LINE(1)
186 S I=1
187 F S I=$O(LINE(I)) Q:'I D
188 .S @VALMAR@($$I,0)=LINE(I)
189 .D CNTRL^VALM10(VALMCNT,1,1,IORVON,IORVOFF)
190 Q
191 ;
192SHIFT(I,J) ;
193 I '$D(SEG(I)) S I=$O(SEG(0)) Q:'I
194 I $L(LINE(J))<80 D
195 .N LEN
196 .S LEN=$L(LINE(J))
197 .S LINE(J)=LINE(J)_$E(SEG(I),1,80-LEN)
198 .S SEG(I)=$E(SEG(I),81-LEN,9999)
199 .I SEG(I)="" K SEG(I)
200 E D
201 .S J=J+1
202 .S LINE(J)="-"
203 D SHIFT(.I,.J)
204 Q
205 ;
206SCRLMODE ;scroll mode
207 Q:'$L(HLRFRSH)
208 N QUIT,IOTM,IOBM,DX,DY,LINE,IOTM,IOBM
209 W !!,IOINHI,"Hit any key to escape scroll mode...",IOINORM
210 S IOTM=3,IOBM=23
211 S QUIT=0
212 S LINE=$S(VALMCNT<17:1,1:17)
213 W @IOSTBM
214 S DX=1,DY=$S(VALMCNT<17:VALMCNT+1,1:17) X IOXY
215 F I=1:1 D Q:QUIT
216 .;every 10 seconds refresh the data
217 .I I>42 D @HLRFRSH S I=0
218 .I LINE+1>VALMCNT D
219 ..S TEMP=$G(@VALMAR@(LINE,0))
220 ..W !,IOUON,TEMP_$$SP(80-$L(TEMP)),IOUOFF
221 .E W !,$G(@VALMAR@(LINE,0))
222 .S LINE=LINE+1
223 .I LINE>VALMCNT S LINE=1
224 .I (I=22)!(I=43) R *C:5 I $T S QUIT=1 Q
225 S VALMBG=LINE-23 I VALMBG<0 S VALMBG=1
226 S VALMBCK="R"
227 Q
228HLP ;
229 Q
230 ;
231IFOPEN(LINK) ;
232 ;returns 1 if the link can be opened, otherwise 0
233 ;
234 ;Inputs:
235 ; LINK - name of the link (required), optionally post-fixed with ":"_<port #>, will default to that defined for link
236 ;
237 N LINKNAME,LINKARY,POP,IO,IOF,IOST,OPEN,PORT
238 S OPEN=0
239 S LINKNAME=$P(LINK,":")
240 S PORT=$P(LINK,":",2)
241 Q:LINKNAME="" 0
242 Q:'$$GETLINK^HLOTLNK(LINKNAME,.LINKARY) 0
243 S:PORT LINKARY("PORT")=PORT
244 Q:'$G(LINKARY("PORT")) 0
245 I LINKARY("IP")="",LINKARY("DOMAIN")="",LINKARY("LLP")="TCP",LINKARY("SERVER") D
246 .N DATA
247 .S LINKARY("DOMAIN")=$P($G(^HLD(779.1,1,0)),"^")
248 .Q:LINKARY("DOMAIN")=""
249 .S DATA(.08)=LINKARY("DOMAIN")
250 .Q:$$UPD^HLOASUB1(870,LINKARY("IEN"),.DATA)
251 D:$G(LINKARY("IP"))'=""
252 .D CALL^%ZISTCP(LINKARY("IP"),LINKARY("PORT"),15)
253 .S OPEN='POP
254 I 'OPEN,LINKARY("DOMAIN")'="",$G(^HLTMP("DNS LAST",LINKARY("IEN")))<$$DT^XLFDT D
255 .N IP
256 .S ^HLTMP("DNS LAST",LINKARY("IEN"))=$$DT^XLFDT
257 .S IP=$$DNS^HLOTCP(LINKARY("DOMAIN"))
258 .I IP'="",IP'=LINKARY("IP") D
259 ..N DATA
260 ..S DATA(400.01)=IP,LINKARY("IP")=IP
261 ..Q:$$UPD^HLOASUB1(870,LINKARY("IEN"),.DATA)
262 ..D CALL^%ZISTCP(LINKARY("IP"),LINKARY("PORT"),15)
263 ..S OPEN='POP
264 C:OPEN IO
265 ;D CLOSE^%ZISTCP
266 Q OPEN
Note: See TracBrowser for help on using the repository browser.