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