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

PSXERR.m

Go to the documentation of this file.
  1. PSXERR ;BIR/BAB,WPB,HTW,PWC-Error Processing Utility ;MAR 1,2002@13:13:34
  1. ;;2.0;CMOP;**1,3,28,30,42,41,52,54,58**;11 Apr 97;Build 2
  1. ; Reference to ^PS(59, supported by DBIA #1976
  1. ; Reference to file #52 supported by DBIA #1977
  1. ; This routine will be used to send mail messages when errors
  1. ; have occurred during the processing of prescription data for
  1. ; the Consolidated Mail Outpatient Pharmacy system.
  1. EN S ERRTXT(1)="An error has been encountered while processing prescription data for the"
  1. S ERRTXT(2)="Consolidated Mail Outpatient Pharmacy system."
  1. S X=PSXJOB,XMSUB="CMOP Error Encountered"
  1. I $G(PSOSITE) S XMSUB=$$GET1^DIQ(59,PSOSITE,.06)_" "_XMSUB
  1. S XY=$S(X=1:"Transmission of Batch Data",X=2:"Re-Transmission of Batch Data",X=3:"Purge of CMOP RX QUEUE file",X=4:"Filing of CMOP Dispense Data",X=5:"Background Auto-transmission of Data",X=6:"Release Data",X=7:"Data Validation",1:"")
  1. D NOW^%DTC S Y=% X ^DD("DD") S DTTM=$P(Y,":",1,2) K Y
  1. S ERRTXT(3)=""
  1. S ERRTXT(4)="Date/Time : "_DTTM
  1. S ERRTXT(5)="Process : "_XY
  1. S ERRTXT(6)="Error Type : "_TYPE
  1. S ERRTXT(7)=""
  1. S ERRTXT(8)="Description : "_$G(DESCRTN)
  1. S ERRTXT(9)=""
  1. S ERRTXT(PSXCT+2)="Action Taken: "_ACTION,ERRTXT(PSXCT+3)=""
  1. S ERRTXT(PSXCT+4)="Recommended action: "_RECM
  1. D MAIL
  1. EXIT K ERRTXT,PSXM,PSXCT,PSXGRP,XMSUB,XMY,XMTEXT,XMDUZ,%,XMDUN,XMZ,ACTION,DESCRTN,DTTM,ERROR,FILL,FLG,MSG,P1,P2,PSXCT,RECM,RXP,TYPE,X,PSXJOB,PSXREF,XY
  1. Q
  1. ER1 ;errors encountered while building the mail message for transmission
  1. Q:$P($G(PSXER),"^",2)=""
  1. S ERRTXT(10)="The following data is missing in the OUTPATIENT SITE file (#59).",ERRTXT(11)=""
  1. S PSXCT=11,PSXCT=PSXCT+1,PSXJOB=1
  1. F XX=2:1 Q:$P(PSXER,"^",XX)="" D
  1. .S ERR=$P(PSXER,"^",XX),PSXCT=PSXCT+1,MSG=$P($T(DERR+ERR),";;",2) S ERRTXT(PSXCT)=MSG
  1. S PSXCT=PSXCT+1,ERRTXT(PSXCT)=""
  1. S PSXERFLG=1,ACTION="No data transmission will occur without this information.",RECM="Correct invalid data.",TYPE="Invalid or missing data"
  1. D EN
  1. Q
  1. ER2 ;errors encountered while building the mail message for retransmission
  1. S P1=$P($G(PSXERR),U,1),P2=$P($G(PSXERR),U,2)
  1. S ERROR=$P($T(DATAERR+10),";;",2)
  1. I P1=2 S PSXCT=PSXCT+1,ERRTXT(PSXCT)=$P($G(ERROR),"^",1)_$P($G(ERROR),"^",P2)
  1. S PSXCT=PSXCT+1,ERRTXT(PSXCT)=""
  1. S PSXCT=PSXCT+1,ERRTXT(PSXCT)=$S(P2=5:"The retransmitted batch will be placed in a hold status. Please release the correct batch when ready.",P2'=5:"The retransmitted batch was not downloaded into the files.",1:"")
  1. K PSXERR
  1. Q
  1. ER4 S PSXCT=11
  1. S RECM="Call IRM to check data and correct"
  1. S TYPE="Missing Data - No match found for return data."
  1. S ACTION="Return data not filed for Rx listed, background release not performed."
  1. S ERRTXT(PSXCT)=" RX# FILL# BATCH# SEQUENCE# "
  1. F I=1:1 S PSXCT=PSXCT+1 Q:$G(PSXER(I))']"" S ERRTXT(PSXCT)=PSXER(I)
  1. D EN
  1. K PSXER,I
  1. Q
  1. ER6 S PSXCT=11
  1. S RECM="Call IRM to check data and correct"
  1. S TYPE="Invalid data "
  1. S DESCRTN="During processing of Vendor return data, CMOP attempted to release the following Rx. This Rx has already been Released locally!. This will invalidate your stock levels for this drug!"
  1. S ACTION="Rx was not released by CMOP."
  1. S ERRTXT(PSXCT)="RX# "_$P(^PSRX(RXP,0),"^")_" FILL# "_$G(PSXREF)
  1. D EN
  1. Q
  1. ER7 ;Set up prescription data for message.
  1. Q:$P($G(PSXRXERR),"^",3)=""
  1. N DFN,RX,VA
  1. S ERRTXT(10)="RX # Fill Data Field SSN NAME"
  1. S ERRTXT(11)=""
  1. S:PSXERFLG=0 PSXCT=11
  1. S RXNM=$P(PSXRXERR,"^",1),FILL=$P(PSXRXERR,"^",2)
  1. S RXF=$S(FILL=0:"Original ",FILL>0:"Refill #"_FILL,1:"")
  1. S PSXCT=PSXCT+1,FLG=0,BLANK=$J(" ",50)
  1. F XX=3:1 Q:$P(PSXRXERR,"^",XX)="" D
  1. .S RX(2,"E")=$$GET1^DIQ(52,RXN,2) ; patient name
  1. .S RX(2,"I")=$$GET1^DIQ(52,RXN,2,"I") ; DFN
  1. .S DFN=RX(2,"I") D PID^VADPT
  1. .S ERR=$P(PSXRXERR,"^",XX),PSXCT=PSXCT+1,CNT=ERR-1
  1. .S MSG=$P($T(DATAERR+CNT),";;",2)
  1. .I FLG=0 S ERRTXT(PSXCT)=RXNM_" "_RXF_" "_$E(MSG_BLANK,1,17)_" "_VA("PID")_" "_(RX(2,"E")),FLG=1 Q
  1. .I FLG=1 S ERRTXT(PSXCT)=" "_MSG,FLG=1 Q
  1. S PSXCT=PSXCT+1,ERRTXT(PSXCT)=""
  1. K PSXRXERR,RXNM,RXF,DAYS,CNT,ERR,DRUG,FDATE,PHAR,PHY,PSTAT,QTY,REF,RXERR,SIG,XX,BLANK
  1. S PSXERFLG=1,ACTION="Rx's not sent to CMOP but still suspended for transmission.",RECM="Correct invalid data.",TYPE="Invalid or missing data"
  1. I '$G(PSXGOOD) S ACTION="Rx's not sent to CMOP. If Bad Address Indicator or foreign address, will remain on suspense for CMOP, but will only show on reject log once." K PSXGOOD
  1. Q
  1. MAIL ;Transmit.
  1. S XMDUZ=.5,XMTEXT="ERRTXT("
  1. K XMY ; get mail group to notify and save in PSXGRP
  1. D GRP^PSXNOTE
  1. D ^XMD
  1. Q
  1. ;
  1. DATAERR ;list of errrors that can occur while checking the rx prior to transmit
  1. ;;Quantity
  1. ;;Prescribing Physician
  1. ;;Days supply
  1. ;;Drug id
  1. ;;SIG
  1. ;;Patient status
  1. ;;Fill date
  1. ;;Clerk not entered
  1. ;;Patient Address
  1. ;;Original batch ^not on file.^is currently processing.^is closed.^is already on hold.
  1. ;;Fill has already been transmitted
  1. ;;Spaces in Rx number
  1. ;;Duplicate Rx
  1. ;;Patient Mail Status Change
  1. ;;Drug Warnings >11 Characters
  1. ;;Patient in the Merging Process
  1. ;;RX OERR/CPRS Locked
  1. ;;Test Patient
  1. ;;Bad Address Indicator no active temporary address
  1. DERR ;list of errors for transmission
  1. ;;State
  1. ;;Site
  1. ;;Name
  1. ;;Street Address
  1. ;;City
  1. ;;Zip Code
  1. ;;Area Code
  1. ;;Phone Number
  1. ;;Refillable Instructions
  1. ;;Nonrefillable Instructions
  1. ;;Station number is missing in the Institution file
  1. ;;Package file entry for Outpatient Pharmacy is bad
  1. Q