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

PRCHJMSG.m

Go to the documentation of this file.
PRCHJMSG ;BP/VAC - SEND A MAILMAN MESSAGE ;5/13/13  13:29
 ;;5.1;IFCAP;**167,174**;Oct 20, 2000;Build 23
 ;Per VHA Directive 2004-38, this routine should not be modified.
 ;Send a MailMan message
 ;XMDUZ=SENDER OF THE MESSAGE
 ;XMSUB=SUBJECT LINE
 ;XMTEXT="MSG(" - ARRAY OF MESSAGE LINES
 ;XMY(DUZ)="" - Receivers of the message
 ;TO BE PASSED IN
 ;   2237 NUMBER
 ;   TYPE OF MESSAGE
 ;   ACTION DATE AND TIME AS FILEMAN DATE TIME
 ;   COMMENTS - MULTIPLE ARRAY
 ;   eCMS USER NAME
 ;   eCMS USER EMAIL ADDRESS
 ;   eCMS USER PHONE NUMBER
 ;TO BE RETRIEVED FROM 2237 OR PASSED IN
 ;   STATION NUMBER 410  .5
 ;   SUB STATION NUMBER  410 448 POINTER TO 411
 ;   ACCOUNTABLE OFFICER  410  39
 ;   CONTROL POINT OFFICIAL(APPROVING OFFICIAL) 410 42 POINTER TO 200
 ;   REQUESTOR 410 40 POINTER TO 200
 ;
PHMSG(MSG1,MSG2) ;START OF MESSAGE BUILDING
 ;MSG1 array contains (1)-2237 number;(2)msg type;(3)date and time
 ;    (4) eCMS User Name; (5) eCMS User email
 ;    (6) eCMS User phone number (7) Special message to send to OIT
 ;MSG2 array contains error comments from ACK or comments from Cancel/return
 ;
 N XMTEXT,XMSUB,XMY,XMDUZ,OUT,I,J,ZZ
 N PRCHJ22,PRCHJTY,PRCHJDT,PRCHJRR,PRCHJUN,PRCHJEM,PRCHJPH,PRCHJSP
 S PRCHJ22=$G(MSG1(1)) ; 2237 NUMBER
 S PRCHJTY=$G(MSG1(2)) ; MESSAGE TYPE
 S PRCHJDT=$$FMTE^XLFDT($G(MSG1(3))) ;  DATE AND TIME WHEN ACTION TOOK PLACE
 K MSG1(3)
 S PRCHJUN=$G(MSG1(4)) ; ECMS USER NAME
 S PRCHJEM=$G(MSG1(5)) ; ECMS USER EMAIL
 S PRCHJPH=$G(MSG1(6)) ; ECMS USER PHONE
 S PRCHJSP=$G(MSG1(7)) ; Special OIT message
 ;I PRCHJTY=1 MESAGE IS AN ACK REJECT
 ;I PRCHJTY=2 MESSAGE IS A MESSAGE CANCEL
 ;I PRCHJTY=3 MESAGE IS A RETURN TO ACCOUNTABLE OFFICER
 ;I PRCHJTY=4 MESSAGE IS A RETURN TO CONTROL POINT
 ;I PRCHJTY=5 MESSAGE IS RETURN TO AO BECAUSE IT DIDN'T GO TO ECMS
 ;
 ;Put errors/text into MSG1 from MSG2
 S ZZ=0
 F I=1:1 S ZZ=$O(MSG2(ZZ)) Q:ZZ=""  S MSG1(I+6)=MSG2(ZZ)
 S XMTEXT="MSG1("
 ;Get information from 2237
 D FIND^DIC(410,"","@;.5;39I;40I;42I;448","B",PRCHJ22,,,,,"OUT","ERR")
 ;Validate that a good 2237 number was sent in
 ;OUT array contains data from 2237
 ;OUT("DILIST","ID",1,.3))=SPECIAL OIT MESSAGE
 ;OUT("DILIST","ID",1,.5))=STATION NUMBER
 ;OUT('DILIST","ID",1,39)=ACCOUNTABLE OFFICER
 ;OUT("DILIST","ID",1,40)=REQUESTOR
 ;OUT("DILIST","ID",1,42))=CONTROL POINT OFFICIAL
 ;OUT("DILIST","ID",1,448)=SUB STATION
 ;
BLD ;BUILD MESSAGE
 ;
 ;S MSG1(.6)="DATE AND TIME OF ACTION "_PRCHJDT
 K MSG1(2)
 S MSG1(.3)="        "_PRCHJSP
 S MSG1(.4)=" "
 S MSG1(.5)="STATION "_OUT("DILIST","ID",1,.5)
 I $G(OUT("DILIST","ID",1,448))'="" S MSG1(.5)=MSG1(.5)_" SUBSTATION "_OUT("DILIST","ID",1,448)
 I PRCHJTY=1 S XMY(OUT("DILIST","ID",1,39))="",XMSUB="MESSAGE REJECTION FOR 2237 "_PRCHJ22,MSG1(.6)="IFCAP Date/Time received eCMS Rejection of 2237 "_PRCHJDT K MSG1(4)
 I PRCHJTY=2 D
 . N PRCX
 .F J=39,40,42 S:$G(OUT("DILIST","ID",1,J))>0 XMY(OUT("DILIST","ID",1,J))=""
 . S PRCX=$O(^PRCS(410,"B",PRCHJ22,"")) I PRCX>0,$D(^PRC(443,PRCX)) S PRCX=$$GET1^DIQ(443,PRCX_",",2,"I") S:PRCX>0 XMY(PRCX)=""
 .S XMSUB="2237 CANCEL FROM eCMS FOR 2237 "_PRCHJ22
 .S MSG1(.6)="eCMS Date/Time Canceled "_PRCHJDT
 I PRCHJTY=3 D
 .F J=39,40 S:$G(OUT("DILIST","ID",1,J))>0 XMY(OUT("DILIST","ID",1,J))=""
 .S XMSUB="2237 RETURNED TO ACCOUNTABLE OFFICER "_PRCHJ22
 .S MSG1(.6)="eCMS Date/Time Returned to AO "_PRCHJDT
 I PRCHJTY=4 D
 . N PRCX
 .F J=39,40,42 S:$G(OUT("DILIST","ID",1,J))>0 XMY(OUT("DILIST","ID",1,J))=""
 . S PRCX=$O(^PRCS(410,"B",PRCHJ22,"")) I PRCX>0,$D(^PRC(443,PRCX)) S PRCX=$$GET1^DIQ(443,PRCX_",",2,"I") S:PRCX>0 XMY(PRCX)=""
 .S XMSUB="2237 RETURNED TO CONTROL POINT FOR "_PRCHJ22
 .S MSG1(.6)="eCMS Date/Time Returned to CP "_PRCHJDT
 I PRCHJTY=5 D
 .F J=39 S XMY(OUT("DILIST","ID",1,J))=""
 .S XMSUB="TRANSMISSION FAILURE FOR 2237 "_PRCHJ22
 .S MSG1(.6)="2237 Transmission to eCMS failed "_PRCHJDT
 S XMDUZ="IFCAP/eCMS INTERFACE"
 D ^XMD
 Q