source: WorldVistAEHR/trunk/r/CMOP-PSX/PSXNOTE.m@ 1582

Last change on this file since 1582 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 5.6 KB
Line 
1PSXNOTE ;BIR/WPB-Routine to Send Mail Messages ;16 Oct 2001 6:28 AM
2 ;;2.0;CMOP;**1,27,30,38,41,45**;11 Apr 97
3 ;Reference to ^DIC(4.2 supported by DBIA #1966
4 ;Sends messages to users on transmission/receipt of CMOP data
5GRP I '$D(^XUSEC("PSXMAIL")) G GRP1
6 F MDUZ=0:0 S MDUZ=$O(^XUSEC("PSXMAIL",MDUZ)) Q:MDUZ'>0 S XMY(MDUZ)=""
7ZZCONT1 ;
8 K MDUZ
9 G:'$D(XMY) GRP1
10 Q
11GRP1 F XDUZ=0:0 S XDUZ=$O(^XUSEC("PSXCMOPMGR",XDUZ)) Q:XDUZ'>0 S XMY(XDUZ)="",XQA(XDUZ)=""
12 K XDUZ
13 Q
14FROM S FROM=$P(PSXSITE,",",1) Q
15EXIT K XMSUB,SEG,SREC,XR,XMDUZ,XMZ,LCNT,XMDUN,XMFROM,XMY,DTE,FROM,OLDBAT,TDT,MM,XX,ADT,NN,XDUZ,XQA,PSXDUZ
16 Q
17EN ;sets up the notification messages
18 D FROM S XX=PSXFLAG S Y=$S(PSXFLAG=3:ADT,PSXFLAG'=3:PSXTDT,1:0) X ^DD("DD") S TDT=Y K Y
19 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)
20 I $G(PSXDIV)]"" S XMSUB=PSXDIV_" "_XMSUB
21 S LCNT=$S(XX<4:8,XX=4:9,1:"")
22 S XMDUZ=.5 D XMZ^XMA2
23 G:XMZ<1 EN
24TXT ;sets the message in the mailman global
25 S PSXDUZ=DUZ
26 S MM=$S(XX=1:"CONFIRMATION:",(XX=4)!(XX=2):"RECEIVED:",XX=3:"ACKNOWLEDGEMENT:",1:"")
27 S NN=$S(PSXRTRN=1:"RE-TRANSMISSION ",PSXRTRN=0:"TRANSMISSION ",1:"")
28 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:"")
29 S ^XMB(3.9,XMZ,2,2,0)=" Pharmacy Division : "_PSXDIV
30 S ^XMB(3.9,XMZ,2,3,0)=" Batch Number : "_PSXREF
31 S ^XMB(3.9,XMZ,2,4,0)=" Transmitted by : "_PSXSENDR
32 S ^XMB(3.9,XMZ,2,5,0)=" Date/Time : "_TDT
33 S ^XMB(3.9,XMZ,2,6,0)=" Total orders/Rx's : "_PSXMSGCT_"/"_PSXRXCT
34 S ^XMB(3.9,XMZ,2,7,0)=" Beginning order # : "_PSXSTART
35 S ^XMB(3.9,XMZ,2,8,0)=" Ending order # : "_PSXEND
36 I (PSXRTRN=1)&($G(OLDBAT)>0) S ^XMB(3.9,XMZ,2,9,0)=" Original Batch # : "_OLDBAT
37 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."
38 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
39 I (PSXRTRN=1&($G(PSXFLG1)'="")&($G(OLDSDT)'="")) D
40 .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
41 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
42XMIT ;transmits the message
43 S ^XMB(3.9,XMZ,2,0)="^3.92A^"_LCNT_U_LCNT_U_DT,XMDUN="CMOP Manager"
44 I PSXFLAG=1 D TIMER^PSXMISC
45 K XMY S XMDUZ=".5" D GRP,ENT1^XMD
46 K FROM
47 G EXIT
48ACK ;sets up the acknowledgement message that is sent back to the remote
49 N XMZ,XMFROM,XMSER,XQSOP,XQMSG
50 S REC=$G(PSXDA),PSXRTRN=0 S:$G(PSXRECV) REC=$G(OLDDA)
51 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)
52 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)
53 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
54 S XR=$O(^PSX(552,"B",SREC,"")),DOM=$P(^PSX(552,XR,0),"^",4)
55 I $G(PSXFTDT)="" D NOW^%DTC S PSXFTDT=% K %
56 S:$D(^PSX(552.1,REC,2)) PSXRTRN=1
57 Q:$D(^PSX(552,"D",SITE)) ;do not send a MM ack to DoD sites
58 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
59 S SEG=PSXBAT_U_$G(ORSTAT)_U_PSXSTART_U_PSXEND_U_PSXFTDT_"^"_$G(PSXOLD)_"^"_PSXSENDR_"^"_PSXMSGCT_"^"_PSXRXCT_"^"_PSXRTRN_"^"_PSXDIV_"^"_PSXREF
60 D XMZ^XMA2
61 G:XMZ<1 ACK
62 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)
63 S ^XMB(3.9,XMZ,2,2,0)="$$ENDACKN^"
64 S ^XMB(3.9,XMZ,2,0)="^3.92A^"_LCNT_U_LCNT_U_DT,XMDUN="CMOP Manager"
65 S DOMAIN=$$GET1^DIQ(4.2,DOM,.01)
66 K XMY S XMDUZ=.5,XMY($S(DOMAIN="":"S.PSXX CMOP SERVER",DOMAIN'="":"S.PSXX CMOP SERVER@"_DOMAIN,1:""))=""
67 ;S XMY(DUZ)="" H 1 ;****TESTING S.PSXX
68 Q:$D(^PSX(552,"D",SITE))
69 D ENT1^XMD
70 K PSXSYST
71 G EXIT
72ERR ;will send an error message to the CMOP manager at the host if
73 ;there is a problem with the transmission
74 S XMDUZ=.5,XMSUB="CMOP Data Transmission Error, "_XSITE_" "_PSXDIV D XMZ^XMA2
75 G:XMZ<1 ERR
76 S ^XMB(3.9,XMZ,2,1,0)="There was an error in the transmission of batch #"_PSXREF
77 S ^XMB(3.9,XMZ,2,2,0)="Please contact the BIRMINGHAM ISC for assistance as soon as possible."
78 S ^XMB(3.9,XMZ,2,3,0)=" "
79 S ^XMB(3.9,XMZ,2,4,0)="Transmisssion Information"
80 S ^XMB(3.9,XMZ,2,5,0)=" "
81 S ^XMB(3.9,XMZ,2,6,0)="Data collected at sending facility:"
82 S ^XMB(3.9,XMZ,2,7,0)="Beginning msg # "_PSXSTART
83 S ^XMB(3.9,XMZ,2,8,0)="Ending msg # "_PSXEND
84 S ^XMB(3.9,XMZ,2,9,0)="Total Rxs "_PSXRXCT
85 S ^XMB(3.9,XMZ,2,10,0)="Total orders "_PSXMSGCT
86 S ^XMB(3.9,XMZ,2,11,0)=" "
87 S ^XMB(3.9,XMZ,2,12,0)="Data received at host facility:"
88 S ^XMB(3.9,XMZ,2,13,0)="Beginning msg # "_PSXSMSG
89 S ^XMB(3.9,XMZ,2,14,0)="Ending msg # "_PSXLAST
90 S ^XMB(3.9,XMZ,2,15,0)="Total Rxs "_PSXRXS
91 S ^XMB(3.9,XMZ,2,16,0)="Total orders "_PSXORDCT
92 S ^XMB(3.9,XMZ,2,0)="^3.92A^"_"16"_U_"16"_U_DT,XMDUN="CMOP Manager"
93 K XMY S XMDUZ=.5
94 D GRP,ENT1^XMD
95 G EXIT
Note: See TracBrowser for help on using the repository browser.