| 1 | PSXERR ;BIR/BAB,WPB,HTW,PWC-Error Processing Utility ;MAR 1,2002@13:13:34
 | 
|---|
| 2 |  ;;2.0;CMOP;**1,3,28,30,42,41,52,54,58**;11 Apr 97;Build 2
 | 
|---|
| 3 |  ; Reference to ^PS(59,  supported by DBIA #1976
 | 
|---|
| 4 |  ; Reference to file #52 supported by DBIA #1977
 | 
|---|
| 5 |  ; This routine will be used to send mail messages when errors
 | 
|---|
| 6 |  ; have occurred during the processing of prescription data for
 | 
|---|
| 7 |  ; the Consolidated Mail Outpatient Pharmacy system.
 | 
|---|
| 8 | EN S ERRTXT(1)="An error has been encountered while processing prescription data for the"
 | 
|---|
| 9 |  S ERRTXT(2)="Consolidated Mail Outpatient Pharmacy system."
 | 
|---|
| 10 |  S X=PSXJOB,XMSUB="CMOP Error Encountered"
 | 
|---|
| 11 |  I $G(PSOSITE) S XMSUB=$$GET1^DIQ(59,PSOSITE,.06)_" "_XMSUB
 | 
|---|
| 12 |  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:"")
 | 
|---|
| 13 |  D NOW^%DTC S Y=% X ^DD("DD") S DTTM=$P(Y,":",1,2) K Y
 | 
|---|
| 14 |  S ERRTXT(3)=""
 | 
|---|
| 15 |  S ERRTXT(4)="Date/Time    :  "_DTTM
 | 
|---|
| 16 |  S ERRTXT(5)="Process      :  "_XY
 | 
|---|
| 17 |  S ERRTXT(6)="Error Type   :  "_TYPE
 | 
|---|
| 18 |  S ERRTXT(7)=""
 | 
|---|
| 19 |  S ERRTXT(8)="Description  :  "_$G(DESCRTN)
 | 
|---|
| 20 |  S ERRTXT(9)=""
 | 
|---|
| 21 |  S ERRTXT(PSXCT+2)="Action Taken:  "_ACTION,ERRTXT(PSXCT+3)=""
 | 
|---|
| 22 |  S ERRTXT(PSXCT+4)="Recommended action:  "_RECM
 | 
|---|
| 23 |  D MAIL
 | 
|---|
| 24 | 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
 | 
|---|
| 25 |  Q
 | 
|---|
| 26 | ER1 ;errors encountered while building the mail message for transmission
 | 
|---|
| 27 |  Q:$P($G(PSXER),"^",2)=""
 | 
|---|
| 28 |  S ERRTXT(10)="The following data is missing in the OUTPATIENT SITE file (#59).",ERRTXT(11)=""
 | 
|---|
| 29 |  S PSXCT=11,PSXCT=PSXCT+1,PSXJOB=1
 | 
|---|
| 30 |  F XX=2:1 Q:$P(PSXER,"^",XX)=""  D
 | 
|---|
| 31 |  .S ERR=$P(PSXER,"^",XX),PSXCT=PSXCT+1,MSG=$P($T(DERR+ERR),";;",2) S ERRTXT(PSXCT)=MSG
 | 
|---|
| 32 |  S PSXCT=PSXCT+1,ERRTXT(PSXCT)=""
 | 
|---|
| 33 |  S PSXERFLG=1,ACTION="No data transmission will occur without this information.",RECM="Correct invalid data.",TYPE="Invalid or missing data"
 | 
|---|
| 34 |  D EN
 | 
|---|
| 35 |  Q
 | 
|---|
| 36 | ER2 ;errors encountered while building the mail message for retransmission
 | 
|---|
| 37 |  S P1=$P($G(PSXERR),U,1),P2=$P($G(PSXERR),U,2)
 | 
|---|
| 38 |  S ERROR=$P($T(DATAERR+10),";;",2)
 | 
|---|
| 39 |  I P1=2 S PSXCT=PSXCT+1,ERRTXT(PSXCT)=$P($G(ERROR),"^",1)_$P($G(ERROR),"^",P2)
 | 
|---|
| 40 |  S PSXCT=PSXCT+1,ERRTXT(PSXCT)=""
 | 
|---|
| 41 |  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:"")
 | 
|---|
| 42 |  K PSXERR
 | 
|---|
| 43 |  Q
 | 
|---|
| 44 | ER4 S PSXCT=11
 | 
|---|
| 45 |  S RECM="Call IRM to check data and correct"
 | 
|---|
| 46 |  S TYPE="Missing Data - No match found for return data."
 | 
|---|
| 47 |  S ACTION="Return data not filed for Rx listed, background release not performed."
 | 
|---|
| 48 |  S ERRTXT(PSXCT)=" RX#    FILL#    BATCH#   SEQUENCE#  "
 | 
|---|
| 49 |  F I=1:1 S PSXCT=PSXCT+1 Q:$G(PSXER(I))']""  S ERRTXT(PSXCT)=PSXER(I)
 | 
|---|
| 50 |  D EN
 | 
|---|
| 51 |  K PSXER,I
 | 
|---|
| 52 |  Q
 | 
|---|
| 53 | ER6 S PSXCT=11
 | 
|---|
| 54 |  S RECM="Call IRM to check data and correct"
 | 
|---|
| 55 |  S TYPE="Invalid data "
 | 
|---|
| 56 |  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!"
 | 
|---|
| 57 |  S ACTION="Rx was not released by CMOP."
 | 
|---|
| 58 |  S ERRTXT(PSXCT)="RX#  "_$P(^PSRX(RXP,0),"^")_"     FILL#  "_$G(PSXREF)
 | 
|---|
| 59 |  D EN
 | 
|---|
| 60 |  Q
 | 
|---|
| 61 | ER7 ;Set up prescription data for message.
 | 
|---|
| 62 |  Q:$P($G(PSXRXERR),"^",3)=""
 | 
|---|
| 63 |  N DFN,RX,VA
 | 
|---|
| 64 |  S ERRTXT(10)="RX #       Fill       Data Field         SSN          NAME"
 | 
|---|
| 65 |  S ERRTXT(11)=""
 | 
|---|
| 66 |  S:PSXERFLG=0 PSXCT=11
 | 
|---|
| 67 |  S RXNM=$P(PSXRXERR,"^",1),FILL=$P(PSXRXERR,"^",2)
 | 
|---|
| 68 |  S RXF=$S(FILL=0:"Original ",FILL>0:"Refill #"_FILL,1:"")
 | 
|---|
| 69 |  S PSXCT=PSXCT+1,FLG=0,BLANK=$J(" ",50)
 | 
|---|
| 70 |  F XX=3:1 Q:$P(PSXRXERR,"^",XX)=""  D
 | 
|---|
| 71 |  .S RX(2,"E")=$$GET1^DIQ(52,RXN,2)      ; patient name
 | 
|---|
| 72 |  .S RX(2,"I")=$$GET1^DIQ(52,RXN,2,"I")  ; DFN
 | 
|---|
| 73 |  .S DFN=RX(2,"I") D PID^VADPT
 | 
|---|
| 74 |  .S ERR=$P(PSXRXERR,"^",XX),PSXCT=PSXCT+1,CNT=ERR-1
 | 
|---|
| 75 |  .S MSG=$P($T(DATAERR+CNT),";;",2)
 | 
|---|
| 76 |  .I FLG=0 S ERRTXT(PSXCT)=RXNM_"  "_RXF_"  "_$E(MSG_BLANK,1,17)_"  "_VA("PID")_" "_(RX(2,"E")),FLG=1 Q
 | 
|---|
| 77 |  .I FLG=1 S ERRTXT(PSXCT)="                         "_MSG,FLG=1 Q
 | 
|---|
| 78 |  S PSXCT=PSXCT+1,ERRTXT(PSXCT)=""
 | 
|---|
| 79 |  K PSXRXERR,RXNM,RXF,DAYS,CNT,ERR,DRUG,FDATE,PHAR,PHY,PSTAT,QTY,REF,RXERR,SIG,XX,BLANK
 | 
|---|
| 80 |  S PSXERFLG=1,ACTION="Rx's not sent to CMOP but still suspended for transmission.",RECM="Correct invalid data.",TYPE="Invalid or missing data"
 | 
|---|
| 81 |  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
 | 
|---|
| 82 |  Q
 | 
|---|
| 83 | MAIL ;Transmit.
 | 
|---|
| 84 |  S XMDUZ=.5,XMTEXT="ERRTXT("
 | 
|---|
| 85 |  K XMY ; get mail group to notify and save in PSXGRP
 | 
|---|
| 86 |  D GRP^PSXNOTE
 | 
|---|
| 87 |  D ^XMD
 | 
|---|
| 88 |  Q
 | 
|---|
| 89 |  ;
 | 
|---|
| 90 | DATAERR ;list of errrors that can occur while checking the rx prior to transmit
 | 
|---|
| 91 |  ;;Quantity
 | 
|---|
| 92 |  ;;Prescribing Physician
 | 
|---|
| 93 |  ;;Days supply
 | 
|---|
| 94 |  ;;Drug id
 | 
|---|
| 95 |  ;;SIG
 | 
|---|
| 96 |  ;;Patient status
 | 
|---|
| 97 |  ;;Fill date
 | 
|---|
| 98 |  ;;Clerk not entered
 | 
|---|
| 99 |  ;;Patient Address
 | 
|---|
| 100 |  ;;Original batch ^not on file.^is currently processing.^is closed.^is already on hold.
 | 
|---|
| 101 |  ;;Fill has already been transmitted
 | 
|---|
| 102 |  ;;Spaces in Rx number
 | 
|---|
| 103 |  ;;Duplicate Rx
 | 
|---|
| 104 |  ;;Patient Mail Status Change
 | 
|---|
| 105 |  ;;Drug Warnings >11 Characters
 | 
|---|
| 106 |  ;;Patient in the Merging Process
 | 
|---|
| 107 |  ;;RX OERR/CPRS Locked
 | 
|---|
| 108 |  ;;Test Patient
 | 
|---|
| 109 |  ;;Bad Address Indicator no active temporary address
 | 
|---|
| 110 | DERR ;list of errors for transmission
 | 
|---|
| 111 |  ;;State
 | 
|---|
| 112 |  ;;Site
 | 
|---|
| 113 |  ;;Name
 | 
|---|
| 114 |  ;;Street Address
 | 
|---|
| 115 |  ;;City
 | 
|---|
| 116 |  ;;Zip Code
 | 
|---|
| 117 |  ;;Area Code
 | 
|---|
| 118 |  ;;Phone Number
 | 
|---|
| 119 |  ;;Refillable Instructions
 | 
|---|
| 120 |  ;;Nonrefillable Instructions
 | 
|---|
| 121 |  ;;Station number is missing in the Institution file
 | 
|---|
| 122 |  ;;Package file entry for Outpatient Pharmacy is bad
 | 
|---|
| 123 |  Q
 | 
|---|