TIUHL7 ; SLC/AJB - TIUHL7 Msg Mgr ; 10OCT05
;;1.0;TEXT INTEGRATION UTILITIES;**200,228**;Jun 20, 1997
Q
ACTION(ACT) ;
N TIUMSG,TIUSEL
D FULL^VALM1
I VALMCNT=0 W !,"No documents to select." H 3 Q
S TIUSEL=$P(XQORNOD(0),"=",2)
I TIUSEL="" D Q:'+TIUSEL
. I VALMLST=1 S TIUSEL=1 Q
. N DIR,X,Y
. S DIR("A")=$S(ACT="DELETE":"Select Message(s) to Delete",ACT="VIEW":"Select Message to View")_": (1-"_VALMLST_") "
. S DIR("?")=$S(ACT="DELETE":"Select one or more messages to be deleted",ACT="VIEW":"Select one message to view")
. S DIR(0)=$S(ACT="DELETE":"L",ACT="VIEW":"N")_"OA^1:"_VALMLST
. D ^DIR S TIUSEL=Y
I TIUSEL["," S TIUSEL=$E(TIUSEL,1,($L(TIUSEL)-1))
F X=1:1:$L(TIUSEL,",") S TIUMSG($P(TIUSEL,",",X))=$O(@VALMAR@("IDX",$P(TIUSEL,",",X),""))
I ACT="SELECT" S ACT=$S(+$L(TIUSEL,",")=1:"VIEW",1:"DELETE")
D @ACT
Q
DELETE ;
D FULL^VALM1
W @IOF,"Deleting the following message(s):",!
W !," Receiving Sending Message",!
W IOUON," Message ID Date/Time Processed Application Application Status ",!,IOUOFF
S TIUSEL="" F S TIUSEL=$O(TIUMSG(TIUSEL)) Q:'+TIUSEL W @VALMAR@(TIUSEL,0),! ; TIUSEL," ",TIUMSG(TIUSEL),!
I $$READ^TIUU("Y","Delete message(s)") D
. S TIUSEL="" F S TIUSEL=$O(TIUMSG(TIUSEL)) Q:'+TIUSEL K ^XTMP("TIUHL7",$P(TIUMSG(TIUSEL),U,2),$P(TIUMSG(TIUSEL),U))
. W !!,"Deleting...finished."
W ! I $$READ^TIUU("EA","Press <RETURN> to continue")
D CLEAN^VALM10,INIT,RE^VALM4
S VALMBG=1
Q
REFRESH ;
D CLEAN^VALM10,INIT,RE^VALM4
S VALMBG=1
Q
VIEW ;
D EN^TIUHL7A
D CLEAN^VALM10,INIT,RE^VALM4
S VALMBG=1
Q
EN ; main entry point for TIUHL7 MSG MGR
N POP
D EN^VALM("TIUHL7 MSG MGR")
Q
HDR ; header code
N HDR S HDR="TIUHL7 Received Messages"
S VALMHDR(1)=$$SETSTR^VALM1(HDR,"",(IOM-$L(HDR))/2,$L(HDR))
S VALMHDR(2)=""
S VALMHDR(3)=" Receiving Sending Message"
D XQORM
Q
INIT ; init variables and list array
N TIU,TIUDISP,TIUDT,TIUFS,TIUMID
S TIU("CUOFF")=$C(27)_"[?25l",TIU("CUON")=$C(27)_"[?25h" ; cursor values
W TIU("CUOFF"),!!,"Searching for messages..."
S (TIUDT,VALMCNT)=0,(TIUDISP,TIUMID)=""
F S TIUDT=$O(^XTMP("TIUHL7",TIUDT)) Q:'+TIUDT F S TIUMID=$O(^XTMP("TIUHL7",TIUDT,TIUMID)) Q:'+TIUMID D
. S VALMCNT=VALMCNT+1 W:VALMCNT#3=0 "."
. S TIUFS=$E($G(^XTMP("TIUHL7",TIUDT,TIUMID,"MSGRESULT",1)),4)
. S TIUDISP=$$SETSTR^VALM1(VALMCNT,"",1,8)
. S TIUDISP=$$SETFLD^VALM1($P($G(^XTMP("TIUHL7",TIUDT,TIUMID,"MSGRESULT",1)),TIUFS,3),TIUDISP,"Message ID")
. S TIUDISP=$$SETFLD^VALM1($$FMTE^XLFDT(TIUDT),TIUDISP,"Date/Time Processed")
. S TIUDISP=$$SETFLD^VALM1($P($G(^XTMP("TIUHL7",TIUDT,TIUMID,"MSGRESULT",1)),TIUFS,4),TIUDISP,"RecApp")
. S TIUDISP=$$SETFLD^VALM1($P($G(^XTMP("TIUHL7",TIUDT,TIUMID,"MSGRESULT",1)),TIUFS,5),TIUDISP,"SendApp")
. S TIU=$P($G(^XTMP("TIUHL7",TIUDT,TIUMID,"MSGRESULT",1)),TIUFS,2),TIU=$S(TIU="AR":"Rejected",TIU="AA":"Accepted",1:"Unknown")
. S TIUDISP=$$SETFLD^VALM1(TIU,TIUDISP,"Status")
. D SET^VALM10(VALMCNT,TIUDISP,TIUMID_U_TIUDT)
;
I VALMCNT=0 D
. S TIU="No records found to satisfy search criteria."
. D SET^VALM10(2,$$SETSTR^VALM1(TIU,"",(IOM-$L(TIU))/2,$L(TIU)),0)
Q
HELP ; help code
I X="?" S POP=1
D FULL^VALM1
W !!,"The following actions are available:"
W !!,"View a Message - View a selected message"
W !,"Delete Message(s) - Delete selected message(s)"
W !,"Refresh Message List - Refresh display"
W !!,"If ONE message is selected, default action is VIEW"
W !,"If multiple messages are selected, default action is DELETE",!
I +$G(POP) I $$READ^TIUU("EA","Press <RETURN> to continue")
S VALMBCK="R",POP=0
Q
EXIT ; exit code
D XQORM
Q
EXPND ; expand code
Q
XQORM ; default action for list manager
S XQORM("#")=$O(^ORD(101,"B","TIUHL7 MSG MGR SELECT",0))_U_"1:"_VALMCNT
Q
TIUHL7 ; SLC/AJB - TIUHL7 Msg Mgr ; 10OCT05
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**200,228**;Jun 20, 1997
+2 QUIT
ACTION(ACT) ;
+1 NEW TIUMSG,TIUSEL
+2 DO FULL^VALM1
+3 IF VALMCNT=0
WRITE !,"No documents to select."
HANG 3
QUIT
+4 SET TIUSEL=$PIECE(XQORNOD(0),"=",2)
+5 IF TIUSEL=""
Begin DoDot:1
+6 IF VALMLST=1
SET TIUSEL=1
QUIT
+7 NEW DIR,X,Y
+8 SET DIR("A")=$SELECT(ACT="DELETE":"Select Message(s) to Delete",ACT="VIEW":"Select Message to View")_": (1-"_VALMLST_") "
+9 SET DIR("?")=$SELECT(ACT="DELETE":"Select one or more messages to be deleted",ACT="VIEW":"Select one message to view")
+10 SET DIR(0)=$SELECT(ACT="DELETE":"L",ACT="VIEW":"N")_"OA^1:"_VALMLST
+11 DO ^DIR
SET TIUSEL=Y
End DoDot:1
IF '+TIUSEL
QUIT
+12 IF TIUSEL[","
SET TIUSEL=$EXTRACT(TIUSEL,1,($LENGTH(TIUSEL)-1))
+13 FOR X=1:1:$LENGTH(TIUSEL,",")
SET TIUMSG($PIECE(TIUSEL,",",X))=$ORDER(@VALMAR@("IDX",$PIECE(TIUSEL,",",X),""))
+14 IF ACT="SELECT"
SET ACT=$SELECT(+$LENGTH(TIUSEL,",")=1:"VIEW",1:"DELETE")
+15 DO @ACT
+16 QUIT
DELETE ;
+1 DO FULL^VALM1
+2 WRITE @IOF,"Deleting the following message(s):",!
+3 WRITE !," Receiving Sending Message",!
+4 WRITE IOUON," Message ID Date/Time Processed Application Application Status ",!,IOUOFF
+5 ; TIUSEL," ",TIUMSG(TIUSEL),!
SET TIUSEL=""
FOR
SET TIUSEL=$ORDER(TIUMSG(TIUSEL))
IF '+TIUSEL
QUIT
WRITE @VALMAR@(TIUSEL,0),!
+6 IF $$READ^TIUU("Y","Delete message(s)")
Begin DoDot:1
+7 SET TIUSEL=""
FOR
SET TIUSEL=$ORDER(TIUMSG(TIUSEL))
IF '+TIUSEL
QUIT
KILL ^XTMP("TIUHL7",$PIECE(TIUMSG(TIUSEL),U,2),$PIECE(TIUMSG(TIUSEL),U))
+8 WRITE !!,"Deleting...finished."
End DoDot:1
+9 WRITE !
IF $$READ^TIUU("EA","Press <RETURN> to continue")
+10 DO CLEAN^VALM10
DO INIT
DO RE^VALM4
+11 SET VALMBG=1
+12 QUIT
REFRESH ;
+1 DO CLEAN^VALM10
DO INIT
DO RE^VALM4
+2 SET VALMBG=1
+3 QUIT
VIEW ;
+1 DO EN^TIUHL7A
+2 DO CLEAN^VALM10
DO INIT
DO RE^VALM4
+3 SET VALMBG=1
+4 QUIT
EN ; main entry point for TIUHL7 MSG MGR
+1 NEW POP
+2 DO EN^VALM("TIUHL7 MSG MGR")
+3 QUIT
HDR ; header code
+1 NEW HDR
SET HDR="TIUHL7 Received Messages"
+2 SET VALMHDR(1)=$$SETSTR^VALM1(HDR,"",(IOM-$LENGTH(HDR))/2,$LENGTH(HDR))
+3 SET VALMHDR(2)=""
+4 SET VALMHDR(3)=" Receiving Sending Message"
+5 DO XQORM
+6 QUIT
INIT ; init variables and list array
+1 NEW TIU,TIUDISP,TIUDT,TIUFS,TIUMID
+2 ; cursor values
SET TIU("CUOFF")=$CHAR(27)_"[?25l"
SET TIU("CUON")=$CHAR(27)_"[?25h"
+3 WRITE TIU("CUOFF"),!!,"Searching for messages..."
+4 SET (TIUDT,VALMCNT)=0
SET (TIUDISP,TIUMID)=""
+5 FOR
SET TIUDT=$ORDER(^XTMP("TIUHL7",TIUDT))
IF '+TIUDT
QUIT
FOR
SET TIUMID=$ORDER(^XTMP("TIUHL7",TIUDT,TIUMID))
IF '+TIUMID
QUIT
Begin DoDot:1
+6 SET VALMCNT=VALMCNT+1
IF VALMCNT#3=0
WRITE "."
+7 SET TIUFS=$EXTRACT($GET(^XTMP("TIUHL7",TIUDT,TIUMID,"MSGRESULT",1)),4)
+8 SET TIUDISP=$$SETSTR^VALM1(VALMCNT,"",1,8)
+9 SET TIUDISP=$$SETFLD^VALM1($PIECE($GET(^XTMP("TIUHL7",TIUDT,TIUMID,"MSGRESULT",1)),TIUFS,3),TIUDISP,"Message ID")
+10 SET TIUDISP=$$SETFLD^VALM1($$FMTE^XLFDT(TIUDT),TIUDISP,"Date/Time Processed")
+11 SET TIUDISP=$$SETFLD^VALM1($PIECE($GET(^XTMP("TIUHL7",TIUDT,TIUMID,"MSGRESULT",1)),TIUFS,4),TIUDISP,"RecApp")
+12 SET TIUDISP=$$SETFLD^VALM1($PIECE($GET(^XTMP("TIUHL7",TIUDT,TIUMID,"MSGRESULT",1)),TIUFS,5),TIUDISP,"SendApp")
+13 SET TIU=$PIECE($GET(^XTMP("TIUHL7",TIUDT,TIUMID,"MSGRESULT",1)),TIUFS,2)
SET TIU=$SELECT(TIU="AR":"Rejected",TIU="AA":"Accepted",1:"Unknown")
+14 SET TIUDISP=$$SETFLD^VALM1(TIU,TIUDISP,"Status")
+15 DO SET^VALM10(VALMCNT,TIUDISP,TIUMID_U_TIUDT)
End DoDot:1
+16 ;
+17 IF VALMCNT=0
Begin DoDot:1
+18 SET TIU="No records found to satisfy search criteria."
+19 DO SET^VALM10(2,$$SETSTR^VALM1(TIU,"",(IOM-$LENGTH(TIU))/2,$LENGTH(TIU)),0)
End DoDot:1
+20 QUIT
HELP ; help code
+1 IF X="?"
SET POP=1
+2 DO FULL^VALM1
+3 WRITE !!,"The following actions are available:"
+4 WRITE !!,"View a Message - View a selected message"
+5 WRITE !,"Delete Message(s) - Delete selected message(s)"
+6 WRITE !,"Refresh Message List - Refresh display"
+7 WRITE !!,"If ONE message is selected, default action is VIEW"
+8 WRITE !,"If multiple messages are selected, default action is DELETE",!
+9 IF +$GET(POP)
IF $$READ^TIUU("EA","Press <RETURN> to continue")
+10 SET VALMBCK="R"
SET POP=0
+11 QUIT
EXIT ; exit code
+1 DO XQORM
+2 QUIT
EXPND ; expand code
+1 QUIT
XQORM ; default action for list manager
+1 SET XQORM("#")=$ORDER(^ORD(101,"B","TIUHL7 MSG MGR SELECT",0))_U_"1:"_VALMCNT
+2 QUIT