PSORXED ;IHS/DSD/JCM-edit rx utility ;02/18/98 3:14 PM
;;7.0;OUTPATIENT PHARMACY;**2,16,21,26,56,71,125,201**;DEC 1997
;External reference to ^PSXEDIT supported by DBIA 2209
;External reference to ^DD(52 supported by DBIA 999
;External reference to ^PSDRUG supported by DBIA 221
;External reference to ^PS(55 supported by DBIA 2228
START ;this entry point is no longer used.
;D INIT,LKUP G:PSORXED("QFLG") END D PARSE,EOJ G START
END D EOJ
Q
INIT S PSORXED("QFLG")=0 Q
LKUP ; this line of code is no longer used S PSONUM="RX",PSONUM("A")="EDIT",PSOQFLG=0 D EN1^PSONUM I PSOQFLG!($Q(PSOLIST)']"") S PSORXED("QFLG")=1
K PSOQFLG Q
;
PARSE F PSORXED("LIST")=1:1 Q:'$D(PSOLIST(PSORXED("LIST")))!PSORXED("QFLG") F PSORXED("I")=1:1:$L(PSOLIST(PSORXED("LIST"))) S PSORXED("IRXN")=$P(PSOLIST(PSORXED("LIST")),",",PSORXED("I")) D:+PSORXED("IRXN") PROCESS
Q
PROCESS S PSORXED("DFLG")=0 G:$G(^PSRX(PSORXED("IRXN"),0))']"" PROCESSX
S PSORXED("RX0")=^PSRX(PSORXED("IRXN"),0),PSORXED("RX2")=^(2),PSORXED("RX3")=^(3),PSOSIG=$G(^PSRX(PSORXED("IRXN"),"SIG")),PSODAYS=$P(PSORXED("RX0"),"^",8)
S (I,RFED,RFDT)=0 F S I=$O(^PSRX(PSORXED("IRXN"),1,I)) Q:'I S RFED=I,PSORXED("RX1")=^PSRX(PSORXED("IRXN"),1,I,0),RFDT=$P(^(0),"^"),PSODAYS=$P(^(0),"^",10) S:$P(^(0),"^",17) PSONEW("PROVIDER NAME")=$P(^VA(200,$P(^(0),"^",17),0),"^")
S PSORXST=+$P($G(^PS(53,+$P(PSORXED("RX0"),"^",3),0)),"^",7) N DA S DA=PSORXED("IRXN") D EN^PSORXPR
D CHECK G:PSORXED("DFLG") PROCESSX
N X S X="PSXEDIT" X ^%ZOSF("TEST") K X I $T D ^PSXEDIT I $G(PSXOUT) K PSXOUT G L1
D DIE^PSORXED1
L1 D LOG,POST
PROCESSX Q
CHECK Q L +^PSRX(PSORXED("IRXN")):0 I '$T W $C(7),!!,"Rx Number is Locked by Another User!",! S PSORXED("DFLG")=1 H 5 Q
I $G(^PSDRUG($P(PSORXED("RX0"),"^",6),"I"))]"",^("I")
0&('$P($G(PSOPFS),"^",2)) K PSOPFS Q
I +$G(PSOPFS)<1 K PSOPFS
E S PSOPFS="1^"_PSOPFS
CPCK1 N TYPE S PSO=2,PSODA=DA,PSOFLAG=1,PSOPAR7=$G(^PS(59,PSOSITE,"IB")),TYPE=RFD D RXED^PSOCPA K TYPE
Q
NEXT D NEXT^PSOUTIL(.PSORXED) K DIE,DR,DA S DIE="^PSRX(",DA=PSORXED("IRXN")
S DR="101///"_$P(PSORXED("RX3"),"^")_";102///"_$P(PSORXED("RX3"),"^",2) D ^DIE K DIE,DR,DA,X,Y
Q
EOJ K PSOSIG,PSORXED,PSOLIST,END,PSRX0
D EX^PSORXED1
Q
FILL ;
K PSOEDITF,PSOEDITR,PSOERF
F PSOEZ=0:0 S PSOEZ=$O(^PSRX(DA,1,PSOEZ)) Q:'PSOEZ S:$D(^PSRX(DA,1,PSOEZ,0)) PSOERF=PSOEZ
S PSOEDITF=$S($G(PSOERF):+$G(PSOERF),1:0)
I PSOEDITF S PSOEDITR=$S($P($G(^PSRX(DA,1,PSOEDITF,0)),"^",18):1,1:0) G FILLX
S PSOEDITR=$S($P($G(^PSRX(DA,2)),"^",13):1,1:0)
FILLX K PSOERF,PSOEZ
Q
LBL ;
S PSOEDITL=0
I COM["PROV"!(COM["QTY")!(COM["DAYS")!(COM["MAIL")!(COM["UNIT")!(COM["FILL DATE")!(COM["REMARKS") I COM'["STATUS",COM'["CLINIC",COM'["DRUG",COM'["REFILLS",COM'["ISSUE",COM'["SIG",COM'["TRADE" D Q
.I $G(PSOEDITF) S PSOEDITL=1 Q
.I '$G(PSOEDITF),$G(PSOEDITR) S PSOEDITL=2
I '$G(PSOEDITF),$G(PSOEDITR) S PSOEDITL=2 Q
I '$G(PSOEDITF),'$G(PSOEDITR) S PSOEDITL=0 Q
I $G(RXRP(DA)) S PSOEDITL=1 Q
I '$G(RXRP(DA)),$G(PSOEDITR) S PSOEDITL=2 Q
S PSOEDITL=0
Q
ASKL ;
W ! K DIR S DIR("?",1)="You have edited a fill that has already been released. Do you want to",DIR("?",2)="include this prescription as one of the prescriptions to be acted upon",DIR("?",3)="at the label prompt."
S DIR("?")="Enter 'Yes' to generate a reprint label request."
S DIR(0)="Y",DIR("A")="The last fill has been released, do you want a reprint label",DIR("B")="Y" D ^DIR K DIR I Y=1 S PSOEDITL=0 Q
S PSOEDITL=1
Q
SETRP I $P($G(^PSRX(PSORXED("IRXN"),"STA")),"^")'=5,$G(PSOEDITL)=0 S RXRP(PSORXED("IRXN"))="1^^^1",VALMSG="Label will reprint due to Edit"
Q