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

PSXRTRA1.m

Go to the documentation of this file.
  1. PSXRTRA1 ;BIR/PDW-RETRANSMISSION REPORT SUBROUTINE ;11 AUG 2002
  1. ;;2.0;CMOP;**41,51**;11 Apr 97
  1. ;Reference to ^PSRX( supported by DBIA #1977
  1. REPORT ;
  1. K ^TMP($J,"PSXRTRPT"),LSSN S CNT=21
  1. S PTNM="" F S PTNM=$O(^PSX(550.2,OLDBAT,15,"C",PTNM)) Q:PTNM="" D
  1. . S DFN=0 F S LSSN="" S DFN=$O(^PSX(550.2,OLDBAT,15,"C",PTNM,DFN)) Q:DFN'>0 D RXS
  1. D MM
  1. K PTNM,RXPTR,XSTAT
  1. Q
  1. RXS ;
  1. S RXPTR=0 F S RXPTR=$O(^PSX(550.2,OLDBAT,15,"C",PTNM,DFN,RXPTR)) Q:RXPTR="" D
  1. . S FILL=$O(^PSX(550.2,OLDBAT,15,"C",PTNM,DFN,RXPTR,""))
  1. . D TXT
  1. Q
  1. MM S XMSUB="CMOP Retransmission Report for "_$G(OLDBATNM),XMDUZ=.5,XMDUN="CMOP Managers"
  1. D XMZ^XMA2 G:$G(XMZ)'>0 MM
  1. S ^XMB(3.9,XMZ,2,1,0)="CMOP Re-Transmission Report"
  1. S ^XMB(3.9,XMZ,2,2,0)=$G(PSXBATNM)_" Re-Transmission of "_$G(OLDBATNM)
  1. S ^XMB(3.9,XMZ,2,3,0)=" "
  1. S ^XMB(3.9,XMZ,2,4,0)="The Original Transmission # "_$G(OLDBATNM)_" contained:"
  1. S ^XMB(3.9,XMZ,2,5,0)="Beginning Message Number: "_$P(^PSX(550.2,OLDBAT,1),"^",5)
  1. S ^XMB(3.9,XMZ,2,6,0)="Ending Message Number : "_$P(^PSX(550.2,OLDBAT,1),"^",6)
  1. S ^XMB(3.9,XMZ,2,7,0)="Total Orders : "_$P(^PSX(550.2,OLDBAT,1),"^",7)
  1. S ^XMB(3.9,XMZ,2,8,0)="Total Rx's : "_$P(^PSX(550.2,OLDBAT,1),"^",8)
  1. S ^XMB(3.9,XMZ,2,9,0)=" "
  1. S ^XMB(3.9,XMZ,2,10,0)="Retransmission # "_$G(PSXBATNM)_" contained:"
  1. S ^XMB(3.9,XMZ,2,11,0)="Beginning Message Number: "_$G(MCT)
  1. S ^XMB(3.9,XMZ,2,12,0)="Ending Message Number : "_$G(LMSG)
  1. S ^XMB(3.9,XMZ,2,13,0)="Total Orders : "_$G(PSXMSGCT)
  1. S ^XMB(3.9,XMZ,2,14,0)="Total Rx's : "_$G(PSXRXCT)
  1. S ^XMB(3.9,XMZ,2,15,0)=" "
  1. S ^XMB(3.9,XMZ,2,16,0)="Following is a list of the original prescription orders and their status."
  1. S ^XMB(3.9,XMZ,2,17,0)="** Prescriptions that have been refilled or released are not sent. **"
  1. I '$D(^TMP($J,"PSXRTRPT")) S ^XMB(3.9,XMZ,17,0)="All prescriptions were transmitted" S CNT=17 G MAIL
  1. F JJ=18,19,20 S ^XMB(3.9,XMZ,2,JJ,0)=" "
  1. S XX="Patient",Y="SSN",XX=$$SETSTR^VALM1("SSN",XX,25,3)
  1. S XX=$$SETSTR^VALM1("RX",XX,40,2),XX=$$SETSTR^VALM1("RELEASE DATE | FILL'=",XX,55,21)
  1. S ^XMB(3.9,XMZ,2,21,0)=XX
  1. M ^XMB(3.9,XMZ,2)=^TMP($J,"PSXRTRPT","MM")
  1. MAIL ;
  1. S ^XMB(3.9,XMZ,2,0)="^3.92A^"_CNT_"^"_CNT_"^"_DT
  1. K XMY
  1. S XMY(DUZ)="" ;****TESTING
  1. D GRP^PSXNOTE ;****TESTING
  1. D ENT1^XMD
  1. Q
  1. TXT ; store PAT & RX info for mail message
  1. D DEM^VADPT S SSN=$P(VADM(2),U,2),PATNM=VADM(1)
  1. S RXNM=$P(^PSRX(RXPTR,0),U)_"-"_FILL
  1. S XSTAT=""
  1. I '$D(^PSX(550.2,PSXBAT,15,"B",RXPTR)) D
  1. .S XSTAT=$$TESTREL^PSXRTRAN(RXPTR,FILL)
  1. .S:XSTAT="SENT" XSTAT="OTHER"
  1. S XX=""
  1. I $G(LSSN)'=SSN D
  1. . S XX=$E(PATNM,1,23)
  1. . S XX=$$SETSTR^VALM1(SSN,XX,25,$L(SSN))
  1. S XX=$$SETSTR^VALM1(RXNM,XX,40,$L(RXNM))
  1. S:$L(XSTAT) XX=$$SETSTR^VALM1(XSTAT,XX,60,$L(XSTAT))
  1. S CNT=$G(CNT)+1,LSSN=SSN
  1. S ^TMP($J,"PSXRTRPT","MM",CNT,0)=XX
  1. Q
  1. CANMSG ; lock on 550.1 not achieved send transmission cancelled message
  1. S PSXCS=+$G(PSXCS)
  1. S XMSUB=$S($G(PSXCS):"",1:"NON-")_"CS Retransmission Cancelled"
  1. S XMTEXT="TXT("
  1. S TXT(1,0)="The "_$S($G(PSXCS):"",1:"NON-")_"CS Manual Transmission was cancelled "_$$GET1^DIQ(550.2,OLDBAT,.01)
  1. S TXT(2,0)="It could not obtain a lock on the RX QUEUE file. #550.1"
  1. S TXT(3,0)="This indicates that a transmission was in progress."
  1. S TXT(6,0)=" "
  1. S TXT(7,0)="If you are getting this message frequently, please contact your IRM Group"
  1. D EN^PSXNOTE ;****TESTING
  1. D ^XMD
  1. Q
  1. SETSTAT ;Set RX CMOP status to re-transmitted
  1. N RXDA,CMPDA
  1. S RXDA=0 F S RXDA=$O(^PSX(550.2,PSXBAT,15,"B",RXDA)) Q:RXDA'>0 D
  1. . S CMPDA=$O(^PSRX(RXDA,4,"B",OLDBAT,0)) Q:'CMPDA
  1. . Q:'CMPDA Q:'$D(^PSRX(RXDA,4,CMPDA,0))
  1. . S $P(^PSRX(RXDA,4,CMPDA,0),U,4)=2
  1. Q