Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XQALFWD

XQALFWD.m

Go to the documentation of this file.
  1. XQALFWD ;ISC/JLI,ISD/HGW - FORWARD ALERTS ;06/20/12 13:09
  1. ;;8.0;KERNEL;**6,65,91,111,114,128,129,285,602**;Jul 10, 1995;Build 9
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. Q
  1. FWRD ; ENTRY POINT FOR SELECTION FROM 'VIEW ALERTS' SCREEN
  1. ; USER NEEDS TO SELECT ALERT(S) FOR FORWARDING
  1. ; TYPE (ALERT, MAIL MESSAGE, OR PRINT)
  1. ; AND RECIPIENT(S) OR DEVICE
  1. ; AND COMMENT IF ANY TO BE DISPLAYED WITH ALERT
  1. ;
  1. ; ZEXCEPT: DIC,DIRUT,IOF,X,XQA,XQAARR,XQACOMNT,XQALFWD,XQALFWDL,XQATYP,XQX1,XQXOUT,Y
  1. W !,"Enter RETURN to continue:" R X:DTIME Q:'$T W @IOF,!,"You may now Select the alert or alerts that you want forwarded:",!
  1. N XQI,XQK,XQACNT,XQAREV,DIR
  1. S XQALFWD=1 S XQX1=-1 D DOIT^XQALERT1
  1. K XQALFWDL
  1. S:'$D(XQX1) XQX1=-1 S:'$D(XQXOUT) XQXOUT=0
  1. F Q:XQX1'>0 S XQALFWDL(+XQX1)=$P(^TMP("XQ",$J,"XQA1",+XQX1),U,2),XQX1=$P(XQX1,",",2,200)
  1. G:'$D(XQALFWDL) EXIT
  1. FWDONE K DIR S DIR(0)="S^A:ALERT;M:MAIL MESSAGE;P:PRINT COPY;",DIR("A")="Select the method of forwarding desired",DIR("B")="ALERT" D ^DIR K DIR G:$D(DIRUT) EXIT S XQATYP=Y
  1. I XQATYP="A"!(XQATYP="M") D LOOP1^XQALMAKE G:'$D(XQA) EXIT N XQAI S XQAI="" F S XQAI=$O(XQA(XQAI)) Q:XQAI="" S XQAARR(XQAI)=XQAI K XQA(XQAI)
  1. I XQATYP="P" S DIC=3.5,DIC(0)="AEQM",DIC("A")="Select the DEVICE to print on: " D ^DIC K DIC G:Y'>0 EXIT S XQAARR="`"_(+Y)
  1. S DIR("A",1)="You may enter a comment to be associated with the forwarded alert if you wish",DIR("A")="Comment (optional)",DIR("?")="Free text 1 to 245 characters.",DIR(0)="FO^1:245"
  1. D ^DIR G:$D(DUOUT)!$D(DTOUT)!$D(DIROUT) EXIT S XQACOMNT=X
  1. K XQALFWD,DIR
  1. D FORWARD(.XQALFWDL,.XQAARR,XQATYP,XQACOMNT)
  1. EXIT S XQX1=-1 W !!,"You will now return to PROCESSING ALERTS, enter RETURN to continue:" R X:DTIME
  1. K XQALFWDL,XQAARR,XQATYP,XQACOMNT,DIRUT,XQALFWD
  1. Q
  1. ;
  1. FORWARD1(XQAID,XQARECIP,XQATYPE,XQACOMNT,XQALTYPE) ;
  1. D FORWARD(.XQAID,XQARECIP,XQATYPE,XQACOMNT)
  1. Q
  1. ;
  1. FORWARD(XQALST,XQARECIP,XQATYPE,XQACOMNT) ; SR. ICR #3009 (Supported)
  1. ;D FORWARD^XQALFWD([.]alerts,[.]users,type[,comment])
  1. ; [.]alerts - Alerts to be forwarded by full identifier ($$SETUP1^XQALERT)
  1. ; [.]users - Users to forward alerts to by IEN (file #200), G.MAIL GROUP, or printer (name or `IEN)
  1. ; type - A:alert, M:mailgroup, P:printer
  1. ; comment - Character string comment to accompany the alert
  1. ; ZEXCEPT: IOP
  1. Q:'$D(XQALST) Q:'$D(XQARECIP)
  1. N I,XQAPRNT,XQAVALS,XQALTYPE,%ZIS,ZTDESC,ZTDTH,ZTRTN,ZTSAVE
  1. S XQALTYPE="FWD BY USER"
  1. S XQATYPE=$G(XQATYPE)
  1. I XQATYPE="A" D
  1. . N XQAI S XQAI="" F S XQAI=$O(XQALST(XQAI)) Q:XQAI="" D SETXQA D RESETUP(XQALST(XQAI),.XQAVALS,XQACOMNT)
  1. . I $O(XQALST(""))="",$D(XQALST)=1,XQALST'="" D SETXQA D RESETUP(XQALST,.XQAVALS,XQACOMNT)
  1. I XQATYPE="M" D
  1. . D MAIL1
  1. I XQATYPE="P" D
  1. . S XQAPRNT=$$FIND1^DIC(3.5,,"X",$G(XQARECIP)) Q:XQAPRNT'>0 ;p602
  1. . S IOP="Q;"_$P($G(^%ZIS(1,XQAPRNT,0)),U) ;p602
  1. . S %ZIS="Q" D ^%ZIS Q:POP ;p602
  1. . S ZTRTN="PRNT^XQALFWD",ZTDESC="Forward alerts to printer",ZTDTH=$H,ZTSAVE("XQA*")="" ;p602
  1. . D ^%ZTLOAD D HOME^%ZIS K IO("Q") ;p602
  1. Q
  1. ;
  1. SETXQA ;
  1. ; ZEXCEPT: J,XQARECIP,XQAVALS
  1. I $D(XQARECIP)=1 S XQAVALS(XQARECIP)="" Q
  1. S J="" F S J=$O(XQARECIP(J)) Q:J="" S XQAVALS(XQARECIP(J))=""
  1. Q
  1. ;
  1. SETXMY ;
  1. ; ZEXCEPT: J,XMY,XQARECIP
  1. I $D(XQARECIP)=1 S XMY(XQARECIP)="" Q
  1. S J="" F S J=$O(XQARECIP(J)) Q:J="" S XMY(XQARECIP(J))=""
  1. Q
  1. ;
  1. MAIL1 ;
  1. ; ZEXCEPT: X,XQALST,XQAUSER
  1. N I,XMY,XMSUB,XMTEXT
  1. N XQAI S XQAI="" F S XQAI=$O(XQALST(XQAI)) Q:XQAI="" S X=$O(^XTV(8992,"AXQA",XQALST(XQAI),XQAUSER,0)) I X'="" S X=$G(^XTV(8992,XQAUSER,"XQA",X,0)) I X'="" D SETXMY D MAIL
  1. I $D(XQALST)=1,XQALST]"" S X=$O(^XTV(8992,"AXQA",XQALST,XQAUSER,0)) I X'="" S X=$G(^XTV(8992,XQAUSER,"XQA",X,0)) I X'="" D SETXMY D MAIL
  1. Q
  1. MAIL ;
  1. ; ZEXCEPT: X,XMSUB,XMTEXT,XQACOMNT,XQAUSER
  1. K ^TMP($J,"XQAL") S XMSUB="ALERT: "_$P(X,U,3),XMTEXT="^TMP($J,""XQAL"","
  1. S ^TMP($J,"XQAL",1,0)=$P(X,U,3),^TMP($J,"XQAL",2,0)=" Forwarded by: "_$P(^VA(200,XQAUSER,0),U)_" Generated: "_$$DAT8^XQALERT($P($P(X,U,2),";",3),1) S:$G(XQACOMNT)'="" ^TMP($J,"XQAL",3,0)=XQACOMNT
  1. D ^XMD
  1. Q
  1. ;
  1. PRNT ;
  1. ; ZEXCEPT: X,XQALST,XQAUSER
  1. I $D(XQALST)=1,XQALST>0 S X=$O(^XTV(8992,"AXQA",XQALST,XQAUSER,0)) I X'="" S X=$G(^XTV(8992,XQAUSER,"XQA",X,0)) I X'="" D PRNT1
  1. N XQAI S XQAI="" F S XQAI=$O(XQALST(XQAI)) Q:XQAI="" S X=$O(^XTV(8992,"AXQA",XQALST(XQAI),XQAUSER,0)) I X'="" S X=$G(^XTV(8992,XQAUSER,"XQA",X,0)) I X'="" D PRNT1
  1. Q
  1. PRNT1 ;
  1. ; ZEXCEPT: IOF,X,XQACOMNT,XQAUSER
  1. U IO W @IOF
  1. W !!,"ALERT: "_$P(X,U,3),!!," Forwarded by: ",$P(^VA(200,XQAUSER,0),U)," Generated on: ",$$DAT8^XQALERT($P($P(X,U,2),";",3)),!!,$G(XQACOMNT)
  1. Q
  1. ;
  1. RESETUP(XQAIDVAL,XQA,XQACOMNT) ;
  1. ; ZEXCEPT: XQALTYPE,XQAUSER
  1. N XQAIEN,DA,XQI,XQJ,XQK,XQX,X,X1,X3,XQARESET,XQAID,XQA1,XQADA,XQAOPT1,XQAMSG,XQACTMSG,XQADATA,XQAGUID,RETVAL,XQADA,XQADFN
  1. S:'$D(XQAUSER) XQAUSER=DUZ
  1. S XQARESET=1,XQALTYPE=$G(XQALTYPE,"FWD BY USER")
  1. S XQAIEN=$O(^XTV(8992,"AXQA",XQAIDVAL,XQAUSER,0)) Q:XQAIEN'>0
  1. S X=$G(^XTV(8992,XQAUSER,"XQA",XQAIEN,0)),X1=$G(^(1)),X3=$G(^(3))
  1. Q:X=""
  1. S XQAID=$P(X,U,2),XQA1=$P(XQAID,";"),XQADA=$O(^XTV(8992.1,"B",XQAID,0))
  1. S XQAOPT1=$P(X,U,7,8),XQAMSG=$P(X,U,3),XQACTMSG=$P(X,U,6)
  1. S XQADATA=$S(X1'="":X1,1:$P(X,U,9,100)) S:$P(X3,U)'="" XQAGUID=$P(X3,U) S:$P(X3,U,2)'="" XQADFN=$P(X3,U,2)
  1. S XQX=$$NOW^XLFDT()
  1. S RETVAL=$$REENT^XQALSET()
  1. Q