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

PSXNOTE.m

Go to the documentation of this file.
  1. PSXNOTE ;BIR/WPB-Routine to Send Mail Messages ;16 Oct 2001 6:28 AM
  1. ;;2.0;CMOP;**1,27,30,38,41,45**;11 Apr 97
  1. ;Reference to ^DIC(4.2 supported by DBIA #1966
  1. ;Sends messages to users on transmission/receipt of CMOP data
  1. GRP I '$D(^XUSEC("PSXMAIL")) G GRP1
  1. F MDUZ=0:0 S MDUZ=$O(^XUSEC("PSXMAIL",MDUZ)) Q:MDUZ'>0 S XMY(MDUZ)=""
  1. ZZCONT1 ;
  1. K MDUZ
  1. G:'$D(XMY) GRP1
  1. Q
  1. GRP1 F XDUZ=0:0 S XDUZ=$O(^XUSEC("PSXCMOPMGR",XDUZ)) Q:XDUZ'>0 S XMY(XDUZ)="",XQA(XDUZ)=""
  1. K XDUZ
  1. Q
  1. FROM S FROM=$P(PSXSITE,",",1) Q
  1. EXIT K XMSUB,SEG,SREC,XR,XMDUZ,XMZ,LCNT,XMDUN,XMFROM,XMY,DTE,FROM,OLDBAT,TDT,MM,XX,ADT,NN,XDUZ,XQA,PSXDUZ
  1. Q
  1. EN ;sets up the notification messages
  1. D FROM S XX=PSXFLAG S Y=$S(PSXFLAG=3:ADT,PSXFLAG'=3:PSXTDT,1:0) X ^DD("DD") S TDT=Y K Y
  1. S XMSUB=$S(XX=1:"CMOP "_PSXREF_" Transmitted",XX=2:"CMOP "_PSXREF_" from "_FROM_" Received.",XX=3:"CMOP "_PSXREF_" Acknowledged.",XX=4:"CMOP Re-transmission "_PSXREF_" from "_FROM_" Received.",1:0)
  1. I $G(PSXDIV)]"" S XMSUB=PSXDIV_" "_XMSUB
  1. S LCNT=$S(XX<4:8,XX=4:9,1:"")
  1. S XMDUZ=.5 D XMZ^XMA2
  1. G:XMZ<1 EN
  1. TXT ;sets the message in the mailman global
  1. S PSXDUZ=DUZ
  1. S MM=$S(XX=1:"CONFIRMATION:",(XX=4)!(XX=2):"RECEIVED:",XX=3:"ACKNOWLEDGEMENT:",1:"")
  1. S NN=$S(PSXRTRN=1:"RE-TRANSMISSION ",PSXRTRN=0:"TRANSMISSION ",1:"")
  1. S ^XMB(3.9,XMZ,2,1,0)=$S(XX=1:" CMOP "_NN_MM,XX=2:" CMOP "_NN_MM,XX=3:" CMOP "_NN_MM,XX=4:" CMOP RE-TRANSMISSION "_MM,1:"")
  1. S ^XMB(3.9,XMZ,2,2,0)=" Pharmacy Division : "_PSXDIV
  1. S ^XMB(3.9,XMZ,2,3,0)=" Batch Number : "_PSXREF
  1. S ^XMB(3.9,XMZ,2,4,0)=" Transmitted by : "_PSXSENDR
  1. S ^XMB(3.9,XMZ,2,5,0)=" Date/Time : "_TDT
  1. S ^XMB(3.9,XMZ,2,6,0)=" Total orders/Rx's : "_PSXMSGCT_"/"_PSXRXCT
  1. S ^XMB(3.9,XMZ,2,7,0)=" Beginning order # : "_PSXSTART
  1. S ^XMB(3.9,XMZ,2,8,0)=" Ending order # : "_PSXEND
  1. I (PSXRTRN=1)&($G(OLDBAT)>0) S ^XMB(3.9,XMZ,2,9,0)=" Original Batch # : "_OLDBAT
  1. I PSXRTRN=2!(PSXRTRN=1)&($G(PSXFLG1)'="") S ^XMB(3.9,XMZ,2,10,0)="",^XMB(3.9,XMZ,2,11,0)=" ******TRANSMISSION "_PSXREF_" IS ON HOLD."
  1. I PSXRTRN=2&($G(PSXFLG1)'="") S ^XMB(3.9,XMZ,2,12,0)=" Original "_PSXREF_" received "_$$FMTE^XLFDT(OLDTM,"2P")_$S($G(PSXFLG1)=1:" and has been sent to the automated system",$G(PSXFLG1)=0:" and is on hold",1:""),LCNT=12
  1. I (PSXRTRN=1&($G(PSXFLG1)'="")&($G(OLDSDT)'="")) D
  1. .S ^XMB(3.9,XMZ,2,12,0)=" Original "_+SITEN_"-"_$G(OLDBAT)_" transmitted "_$$FMTE^XLFDT($G(OLDSDT),"2P")_$S($G(PSXFLG1)=2:" and has been sent to the automated system",$G(PSXFLG1)=0:" and is on hold",1:""),LCNT=12
  1. I (PSXRTRN>0&($G(PSXFLG1)'="")&($G(OLDSDT)'="")) S ^XMB(3.9,XMZ,2,13,0)="Please review these transmissions and take appropriate action.",LCNT=13
  1. XMIT ;transmits the message
  1. S ^XMB(3.9,XMZ,2,0)="^3.92A^"_LCNT_U_LCNT_U_DT,XMDUN="CMOP Manager"
  1. I PSXFLAG=1 D TIMER^PSXMISC
  1. K XMY S XMDUZ=".5" D GRP,ENT1^XMD
  1. K FROM
  1. G EXIT
  1. ACK ;sets up the acknowledgement message that is sent back to the remote
  1. N XMZ,XMFROM,XMSER,XQSOP,XQMSG
  1. S REC=$G(PSXDA),PSXRTRN=0 S:$G(PSXRECV) REC=$G(OLDDA)
  1. S PSXBAT=$P($P(^PSX(552.1,REC,0),"^"),"-",2),PSXSTART=$P(^PSX(552.1,REC,1),"^"),PSXEND=$P(^PSX(552.1,REC,1),"^",2),PSXFTDT=$P(^PSX(552.1,REC,0),"^",4),PSXSENDR=$P(^PSX(552.1,REC,"P"),"^",3),PSXMSGCT=$P(^PSX(552.1,REC,1),"^",3)
  1. S PSXRXCT=$P(^PSX(552.1,REC,1),"^",4),PSXDIV=$P(^PSX(552.1,REC,"P"),"^"),PSXREF=$P(^PSX(552.1,REC,0),"^"),SITE=$P(PSXREF,"-") S:$G(PSXRECV)=3 PSXFTDT=$P(^PSX(552.1,REC,0),"^",5)
  1. S X=SITE,AGNCY="VASTANUM" S:$D(^PSX(552,"D",X)) X=$E(X,2,99),AGNCY="DMIS" S SREC=$$IEN^XUMF(4,AGNCY,X) K DIC,X,Y,AGNCY ;****DOD L1
  1. S XR=$O(^PSX(552,"B",SREC,"")),DOM=$P(^PSX(552,XR,0),"^",4)
  1. I $G(PSXFTDT)="" D NOW^%DTC S PSXFTDT=% K %
  1. S:$D(^PSX(552.1,REC,2)) PSXRTRN=1
  1. Q:$D(^PSX(552,"D",SITE)) ;do not send a MM ack to DoD sites
  1. S XMSUB=$S($G(PSXRECV)=1:"CMOP Acknowledgement",$G(PSXRECV)=2:"CMOP Close Transmission",$G(PSXRECV)=3:"CMOP Unhold Transmission",1:"CMOP Transmission Processed"),XMDUZ=.5,LCNT=2
  1. S SEG=PSXBAT_U_$G(ORSTAT)_U_PSXSTART_U_PSXEND_U_PSXFTDT_"^"_$G(PSXOLD)_"^"_PSXSENDR_"^"_PSXMSGCT_"^"_PSXRXCT_"^"_PSXRTRN_"^"_PSXDIV_"^"_PSXREF
  1. D XMZ^XMA2
  1. G:XMZ<1 ACK
  1. S ^XMB(3.9,XMZ,2,1,0)=$S($G(PSXRECV)=1:"$$ACKN^",$G(PSXRECV)=2:"$$CACK^",$G(PSXRECV)=3:"$$HACK^",1:"$$VACK^")_$G(SEG)
  1. S ^XMB(3.9,XMZ,2,2,0)="$$ENDACKN^"
  1. S ^XMB(3.9,XMZ,2,0)="^3.92A^"_LCNT_U_LCNT_U_DT,XMDUN="CMOP Manager"
  1. S DOMAIN=$$GET1^DIQ(4.2,DOM,.01)
  1. K XMY S XMDUZ=.5,XMY($S(DOMAIN="":"S.PSXX CMOP SERVER",DOMAIN'="":"S.PSXX CMOP SERVER@"_DOMAIN,1:""))=""
  1. ;S XMY(DUZ)="" H 1 ;****TESTING S.PSXX
  1. Q:$D(^PSX(552,"D",SITE))
  1. D ENT1^XMD
  1. K PSXSYST
  1. G EXIT
  1. ERR ;will send an error message to the CMOP manager at the host if
  1. ;there is a problem with the transmission
  1. S XMDUZ=.5,XMSUB="CMOP Data Transmission Error, "_XSITE_" "_PSXDIV D XMZ^XMA2
  1. G:XMZ<1 ERR
  1. S ^XMB(3.9,XMZ,2,1,0)="There was an error in the transmission of batch #"_PSXREF
  1. S ^XMB(3.9,XMZ,2,2,0)="Please contact the BIRMINGHAM ISC for assistance as soon as possible."
  1. S ^XMB(3.9,XMZ,2,3,0)=" "
  1. S ^XMB(3.9,XMZ,2,4,0)="Transmisssion Information"
  1. S ^XMB(3.9,XMZ,2,5,0)=" "
  1. S ^XMB(3.9,XMZ,2,6,0)="Data collected at sending facility:"
  1. S ^XMB(3.9,XMZ,2,7,0)="Beginning msg # "_PSXSTART
  1. S ^XMB(3.9,XMZ,2,8,0)="Ending msg # "_PSXEND
  1. S ^XMB(3.9,XMZ,2,9,0)="Total Rxs "_PSXRXCT
  1. S ^XMB(3.9,XMZ,2,10,0)="Total orders "_PSXMSGCT
  1. S ^XMB(3.9,XMZ,2,11,0)=" "
  1. S ^XMB(3.9,XMZ,2,12,0)="Data received at host facility:"
  1. S ^XMB(3.9,XMZ,2,13,0)="Beginning msg # "_PSXSMSG
  1. S ^XMB(3.9,XMZ,2,14,0)="Ending msg # "_PSXLAST
  1. S ^XMB(3.9,XMZ,2,15,0)="Total Rxs "_PSXRXS
  1. S ^XMB(3.9,XMZ,2,16,0)="Total orders "_PSXORDCT
  1. S ^XMB(3.9,XMZ,2,0)="^3.92A^"_"16"_U_"16"_U_DT,XMDUN="CMOP Manager"
  1. K XMY S XMDUZ=.5
  1. D GRP,ENT1^XMD
  1. G EXIT