PSXRESUB ;BIR/HTW-Resubmit an Rx to the CMOP ;03/11/99 1:14 PM ;;2.0;CMOP;**3,20,21,41**;11 Apr 97 ;Reference to ^PSRX (File #52) supported by DBIA #1977 ;Reference to routine PSOCMOP supported by DBIA #2476 I '$D(^XUSEC("PSXRESUB",DUZ)) W !,"You are not authorized to use this option." Q W !!,"CMOP Prescription Resubmission Utility",!! TOP S LAST=0 S DIR(0)="FO^1:15",DIR("A")="Enter the Rx # to resubmit" S DIR("?")="Enter the prescription number you want to send back to the CMOP to be dispensed." D ^DIR K DIR I $D(DIRUT) G END S RX=Y K Y S I52=$O(^PSRX("B",RX,"")) I $G(I52)']"" W !,"Rx # "_RX_" either does not exist or is an invalid #." D END G PSXRESUB ; Check for CMOP nodes I '$D(^PSRX(I52,4)) W !,"There have been no CMOP transmissions for this Rx. You can not Resubmit it!",! D END G PSXRESUB ; Get last OP refill I $D(^PSRX(I52,1)) F I=0:0 S I=$O(^PSRX(I52,1,I)) Q:'I S RF=I ; Get last CMOP event entry marked as Not Dispensed F CT=0:0 S CT=$O(^PSRX(I52,4,CT)) Q:'CT D .S NODE=$G(^PSRX(I52,4,CT,0)) .S CHECK=$P($G(NODE),"^",3) Q:$P($G(NODE),"^",4)'=3 .; S PSX(FILL#)=RESUBMIT # .S PSX($P($G(NODE),"^",3))=$P($G(NODE),"^",6)_"^"_CT,LAST=$P($G(NODE),"^",3) ; If the last CMOP '= the last OP Quit I $G(RF)>$G(LAST) W !!,"This Rx cannot be resubmitted. A later fill has already been entered." D END G TOP I $G(CHECK)>$G(LAST) W !!,"This Rx cannot be resubmitted. A later fill has already been transmitted to the CMOP." D END G TOP I $P($G(^PSRX(I52,2)),"^",6)