PSONEW2 ;BIR/DSD - displays new rx information for edit ;Jun 09, 2021@15:21:03
;;7.0;OUTPATIENT PHARMACY;**32,37,46,71,94,124,139,157,143,226,237,239,225,251,375,372,504,441**;DEC 1997;Build 208
;External reference to ^PSDRUG supported by DBIA 221
;External reference to ^DPT supported by DBIA 10035
;External reference to PSOUL^PSSLOCK supported by DBIA 2789
;External reference VADPT supported by DBIA 10061
;External reference to $$DS^PSSDSAPI supported by DBIA 5425
; This routine displays the entered new rx information and
; asks if correct, if not allows editing of the data.
;------------------------------------------------------------
;PSO*237 issue expired error message
;
START ;
S (PSONEW("DFLG"),PSONEW2("QFLG"))=0
D STOP
D DISPLAY ; Displays information
;Copay exemption checks
D SCP^PSORN52D
S PSONEWFF=1,PSOFLAG=1 K PSOANSQ,PSOANSQD S PSOCPZ("DFLG")=0,PSONEW("NEWCOPAY")=0
;can't check PSOSCA for <50 here because of PSOBILL check in PSOCPB
I (PSOSCP<50&($P($G(^PS(53,+$G(PSONEW("PATIENT STATUS")),0)),"^",7)'=1)),$G(DUZ("AG"))="V" D COPAY^PSOCPB W !
I PSOSCA&(PSOSCP>49)!((PSOSCA!(PSOBILL=2))&($P($G(^PS(53,+$G(PSONEW("PATIENT STATUS")),0)),"^",7)=1))!(PSOSCP>49&(PSOBILL=2)) D SC^PSOMLLD2
I $G(PSOCPZ("DFLG")) K PSONEWFF,PSOANSQD,PSOCPZ("DFLG"),PSONEW("NEWCOPAY") S DIRUT="",PSONEW("DFLG")=1 D ASKX G END
;IF MILL BILL, AND COPAY (*******TEST THE COPAY CHECK)
I $$DT^PSOMLLDT D I $G(PSOCPZ("DFLG")) K PSONEWFF,PSOANSQD,PSOANSQ,PSOCPZ("DFLG"),PSONEW("NEWCOPAY") S DIRUT="",PSONEW("DFLG")=1 D ASKX G END
.;New prompts Quit after first '^'
.I $D(PSOIBQS(PSODFN,"CV")) D CV^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("CV"))) K PSONEW("NEWCOPAY")
.I $D(PSOIBQS(PSODFN,"VEH")) D VEH^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("VEH"))) K PSONEW("NEWCOPAY")
.I $D(PSOIBQS(PSODFN,"RAD")) D RAD^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("RAD"))) K PSONEW("NEWCOPAY")
.I $D(PSOIBQS(PSODFN,"PGW")) D PGW^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("PGW"))) K PSONEW("NEWCOPAY")
.I $D(PSOIBQS(PSODFN,"SHAD")) D SHAD^PSOMLLD2 I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("SHAD"))) K PSONEW("NEWCOPAY")
.I $D(PSOIBQS(PSODFN,"MST")) D MST^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("MST"))) K PSONEW("NEWCOPAY")
.I $D(PSOIBQS(PSODFN,"HNC")) D HNC^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("HNC"))) K PSONEW("NEWCOPAY")
K PSOCPZ("DFLG"),PSONEWFF
D ASK K:$G(PSONEW("DFLG")) PSOANSQ G:PSONEW2("QFLG")!PSONEW("DFLG") END
S PSORX("EDIT")=1 D EN^PSOORNE1(.PSONEW),FULL^VALM1 G:$G(PSORX("FN")) END I '$G(PSORX("FN")) S PSONEW("DFLG")=1 K PSOANSQ G END ;D EDIT
G:'$G(PSONEW("DFLG")) START
S PSONEW("QFLG")=1,PSONEW("DFLG")=0
END D EOJ
Q
;------------------------------------------------------------
STOP ; Checks whether the Fill Date is past the Expiration Date
N ISSDT,X K PSEXDT S PSON52("QFLG")=0
S ISSDT=$G(PSONEW("ISSUE DATE")) I 'ISSDT S X=ISSDT D ^%DT S:Y>0 ISSDT=Y I 'ISSDT S ISSDT=DT
I $$FMDIFF^XLFDT($G(PSONEW("FILL DATE")),ISSDT)>$S(+$G(PSONEW("CS")):184,1:366) D
. S PSEXDT=1_"^"_$$FMADD^XLFDT(ISSDT,$S(+$G(PSONEW("CS")):184,1:366))
Q
DISPLAY ;
D:+$$DS^PSSDSAPI&($G(PSOFOERR)) HD3^PSODOSUN()
W !!,"Rx # ",PSONEW("RX #")
I $G(PSONEW("MAIL/WINDOW"))="P" W ?23,"Active/Parked" ;441 PAPI
I $G(PSONEW("MAIL/WINDOW"))'="P" W ?23,$E(PSONEW("FILL DATE"),4,5),"/",$E(PSONEW("FILL DATE"),6,7),"/",$E(PSONEW("FILL DATE"),2,3)
W !,$G(PSORX("NAME")),?30,"#",PSONEW("QTY")
I $G(SIGOK),$O(SIG(0)) D K D G TRN
.F D=0:0 S D=$O(SIG(D)) W !,SIG(D) Q:'$O(SIG(D)) D:+$$DS^PSSDSAPI&($G(PSOFOERR)) HD3^PSODOSUN(7)
E S X=PSONEW("SIG") D SIGONE^PSOHELP W !,$G(INS1) D:+$$DS^PSSDSAPI&($G(PSOFOERR)) HD3^PSODOSUN(7)
TRN ;I $G(PSOPRC) F I=0:0 S I=$O(PRC(I)) Q:'I W !,PRC(I)
W !!,$S($G(PSODRUG("TRADE NAME"))]"":PSODRUG("TRADE NAME"),1:PSODRUG("NAME"))
W !,PSONEW("PROVIDER NAME"),?25,PSORX("CLERK CODE"),!,"# of Refills: ",PSONEW("# OF REFILLS"),! D:+$$DS^PSSDSAPI&($G(PSOFOERR)) HD3^PSODOSUN()
Q
;
ASK ;
K DIR,X,Y S DIR("A")="Is this correct"
S DIR(0)="Y",DIR("B")="YES" D ^DIR K DIR I $D(DIRUT) S PSONEW("DFLG")=1 G ASKX
ASK1 I Y D S PSONEW2("QFLG")=1
.S:$G(PSONEW("MAIL/WINDOW"))["W" BINGCRT=Y,BINGRTE="W"
.D:+$G(PSEXDT)
..S Y=PSONEW("FILL DATE") X ^DD("DD") W !!,$C(7),Y_" fill date is greater than possible expiration date of " S Y=$P(PSEXDT,"^",2) X ^DD("DD") W Y_"."
.D DCORD K RORD,^TMP("PSORXDC",$J)
ASKX I $D(DIRUT) D
.I +$G(PSEXDT) K DIRUT S (PSONEW2("QFLG"),PSONEW2("DFLG"),PSONEW("DFLG"),Y)=1
K X,Y,DIRUT,DTOUT,DUOUT
D:+$G(PSEXDT) PAUSE^VALM1
Q
DCORD ;dc rxs and pending orders after new order is entered
I $G(PSORX("DFLG")) K ^TMP("PSORXDC",$J) Q
F RORD=0:0 S RORD=$O(^TMP("PSORXDC",$J,RORD)) Q:'RORD D @$S($P(^TMP("PSORXDC",$J,RORD,0),"^")="P":"PEN",1:"RX52")
I $G(PSORX("FN")) S VALMBCK="Q",PSOFROM="NEW"
K RORD,PSOTECCK H 2
Q
PEN ;pending ^tmp("psorxdc",$j,rord,0)="p^"_rord_"^"_msg
N PSOR,DNM S PSOR=^PS(52.41,RORD,0) S $P(^PS(52.41,RORD,0),"^",3)="DC",^PS(52.41,RORD,4)=$P(^TMP("PSORXDC",$J,RORD,0),"^",3)
K ^PS(52.41,"AOR",PSODFN,+$P($G(^PS(52.41,RORD,"INI")),"^"),RORD)
S DNM=$S($P(PSOR,"^",9):$P($G(^PSDRUG($P(PSOR,"^",9),0)),"^"),1:$P(^PS(50.7,$P(PSOR,"^",8),0),"^")_" "_$P(^PS(50.606,$P(^PS(50.7,$P(PSOR,"^",8),0),"^",2),0),"^"))
D EN^PSOHLSN($P(^PS(52.41,RORD,0),"^"),"OC",$P(^TMP("PSORXDC",$J,RORD,0),"^",3),"D")
I $G(PSOTECCK),'$D(^XUSEC("PSORPH",DUZ)) G PENX
W $C(7),! K ^UTILITY($J,"W") S DIWL=1,DIWR=75,DIWF=""
S X=" Duplicate "_$S($P(^TMP("PSORXDC",$J,RORD,0),"^",10):"Therapy",1:"Drug")_" Pending Order "_DNM_" has been discontinued..." D ^DIWP
F ZX=0:0 S ZX=$O(^UTILITY($J,"W",1,ZX)) Q:'ZX W !,^UTILITY($J,"W",1,ZX,0)
PENX K ^UTILITY($J,"W"),X,DIWL,DIWR,DIWF W !
D PSOUL^PSSLOCK(RORD_"S") K ^TMP("PSORXDC",$J,RORD,0)
Q
RX52 ;rxs in file 52 ^tmp("psorxdc",$j,rord,0)=52^rord^msg^rea^act^sta^dnm
S PSCAN($P(^PSRX(RORD,0),"^"))=RORD_"^"_$P(^TMP("PSORXDC",$J,RORD,0),"^",4)
S MSG=$P(^TMP("PSORXDC",$J,RORD,0),"^",3),REA=$P(^(0),"^",4),ACT=$P(^(0),"^",5)
N PSONOOR S PSONOOR="D",DUP=1,DA=RORD D CAN^PSOCAN K PSONOOR
I $G(PSOTECCK),'$D(^XUSEC("PSORPH",DUZ)) G RX52X
W $C(7),! K ^UTILITY($J,"W") S DIWL=1,DIWR=75,DIWF=""
S X=" Duplicate "_$S($P(^TMP("PSORXDC",$J,RORD,0),"^",10):"Therapy",1:"Drug")_" Rx #"_$P(^PSRX(RORD,0),"^")_" "_$P(^TMP("PSORXDC",$J,RORD,0),"^",7)_" has been discontinued..." D ^DIWP
F ZX=0:0 S ZX=$O(^UTILITY($J,"W",1,ZX)) Q:'ZX W !,^UTILITY($J,"W",1,ZX,0)
RX52X K ^UTILITY($J,"W"),X,DIWL,DIWR,DIWF W !
K PSOSD($P(^TMP("PSORXDC",$J,RORD,0),"^",6),$P(^TMP("PSORXDC",$J,RORD,0),"^",7))
D PSOUL^PSSLOCK(RORD) K ^TMP("PSORXDC",$J,RORD,0)
Q
;
EDIT ;
S PSORX("EDIT")=1
D ^PSONEW3
S PSONEW("DFLG")=$S($G(PSORX("DFLG")):1,1:0)
Q
;
EOJ ;
K PSONEW2,PSORX("EDIT"),PSORX("DFLG"),PSOEDIT,PSOSCA
Q
;
EN1(PSONEW2) ; Entry point to just display and ask if okay
S PSONEW("DFLG")=0
I $G(^PSRX(PSONEW2("IRXN"),0))']"" S PSONEW("DFLG")=1 G EN1X
S PSOX=^PSRX(PSONEW2("IRXN"),0),PSONEW("TRADE NAME")=$G(^("TN")),PSONEW("FILL DATE")=$P($G(^(2)),"^",2)
S PSONEW("RX #")=$P(PSOX,"^"),PSORX("NAME")=$P(^DPT($P(PSOX,"^",2),0),"^")
S PSONEW("QTY")=$P(PSOX,"^",7),PSODRUG("NAME")=$P(^PSDRUG($P(PSOX,"^",6),0),"^"),PSONEW("# OF REFILLS")=$P(PSOX,"^",9)
S PSORX("CLERK CODE")=$P(^VA(200,$P(PSOX,"^",16),0),"^")
S:$G(PSONEW("PROVIDER NAME"))="" PSONEW("PROVIDER NAME")=$P(^VA(200,$P(PSOX,"^",4),0),"^")
S PSONEW("SIG")=$P($G(^PSRX(PSONEW2("IRXN"),"SIG")),"^")
D DISPLAY
D ASK
I PSONEW("DFLG")=1 S PSONEW2("DFLG")=1
EN1X ;
Q
;
EXPR ;Display Expired error message ;PSO*237
S PSONEW("DFLG")=1
W $C(7)
S VALMSG="Order is older than 365 days and can't be finished"
S XQORM("B")="DC"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSONEW2 7753 printed Dec 13, 2024@02:31:24 Page 2
PSONEW2 ;BIR/DSD - displays new rx information for edit ;Jun 09, 2021@15:21:03
+1 ;;7.0;OUTPATIENT PHARMACY;**32,37,46,71,94,124,139,157,143,226,237,239,225,251,375,372,504,441**;DEC 1997;Build 208
+2 ;External reference to ^PSDRUG supported by DBIA 221
+3 ;External reference to ^DPT supported by DBIA 10035
+4 ;External reference to PSOUL^PSSLOCK supported by DBIA 2789
+5 ;External reference VADPT supported by DBIA 10061
+6 ;External reference to $$DS^PSSDSAPI supported by DBIA 5425
+7 ; This routine displays the entered new rx information and
+8 ; asks if correct, if not allows editing of the data.
+9 ;------------------------------------------------------------
+10 ;PSO*237 issue expired error message
+11 ;
START ;
+1 SET (PSONEW("DFLG"),PSONEW2("QFLG"))=0
+2 DO STOP
+3 ; Displays information
DO DISPLAY
+4 ;Copay exemption checks
+5 DO SCP^PSORN52D
+6 SET PSONEWFF=1
SET PSOFLAG=1
KILL PSOANSQ,PSOANSQD
SET PSOCPZ("DFLG")=0
SET PSONEW("NEWCOPAY")=0
+7 ;can't check PSOSCA for <50 here because of PSOBILL check in PSOCPB
+8 IF (PSOSCP<50&($PIECE($GET(^PS(53,+$GET(PSONEW("PATIENT STATUS")),0)),"^",7)'=1))
IF $GET(DUZ("AG"))="V"
DO COPAY^PSOCPB
WRITE !
+9 IF PSOSCA&(PSOSCP>49)!((PSOSCA!(PSOBILL=2))&($PIECE($GET(^PS(53,+$GET(PSONEW("PATIENT STATUS")),0)),"^",7)=1))!(PSOSCP>49&(PSOBILL=2))
DO SC^PSOMLLD2
+10 IF $GET(PSOCPZ("DFLG"))
KILL PSONEWFF,PSOANSQD,PSOCPZ("DFLG"),PSONEW("NEWCOPAY")
SET DIRUT=""
SET PSONEW("DFLG")=1
DO ASKX
GOTO END
+11 ;IF MILL BILL, AND COPAY (*******TEST THE COPAY CHECK)
+12 IF $$DT^PSOMLLDT
Begin DoDot:1
+13 ;New prompts Quit after first '^'
+14 IF $DATA(PSOIBQS(PSODFN,"CV"))
DO CV^PSOMLLDT
IF $GET(PSOCPZ("DFLG"))!($GET(PSOANSQ("CV")))
KILL PSONEW("NEWCOPAY")
+15 IF $DATA(PSOIBQS(PSODFN,"VEH"))
DO VEH^PSOMLLDT
IF $GET(PSOCPZ("DFLG"))!($GET(PSOANSQ("VEH")))
KILL PSONEW("NEWCOPAY")
+16 IF $DATA(PSOIBQS(PSODFN,"RAD"))
DO RAD^PSOMLLDT
IF $GET(PSOCPZ("DFLG"))!($GET(PSOANSQ("RAD")))
KILL PSONEW("NEWCOPAY")
+17 IF $DATA(PSOIBQS(PSODFN,"PGW"))
DO PGW^PSOMLLDT
IF $GET(PSOCPZ("DFLG"))!($GET(PSOANSQ("PGW")))
KILL PSONEW("NEWCOPAY")
+18 IF $DATA(PSOIBQS(PSODFN,"SHAD"))
DO SHAD^PSOMLLD2
IF $GET(PSOCPZ("DFLG"))!($GET(PSOANSQ("SHAD")))
KILL PSONEW("NEWCOPAY")
+19 IF $DATA(PSOIBQS(PSODFN,"MST"))
DO MST^PSOMLLDT
IF $GET(PSOCPZ("DFLG"))!($GET(PSOANSQ("MST")))
KILL PSONEW("NEWCOPAY")
+20 IF $DATA(PSOIBQS(PSODFN,"HNC"))
DO HNC^PSOMLLDT
IF $GET(PSOCPZ("DFLG"))!($GET(PSOANSQ("HNC")))
KILL PSONEW("NEWCOPAY")
End DoDot:1
IF $GET(PSOCPZ("DFLG"))
KILL PSONEWFF,PSOANSQD,PSOANSQ,PSOCPZ("DFLG"),PSONEW("NEWCOPAY")
SET DIRUT=""
SET PSONEW("DFLG")=1
DO ASKX
GOTO END
+21 KILL PSOCPZ("DFLG"),PSONEWFF
+22 DO ASK
if $GET(PSONEW("DFLG"))
KILL PSOANSQ
if PSONEW2("QFLG")!PSONEW("DFLG")
GOTO END
+23 ;D EDIT
SET PSORX("EDIT")=1
DO EN^PSOORNE1(.PSONEW)
DO FULL^VALM1
if $GET(PSORX("FN"))
GOTO END
IF '$GET(PSORX("FN"))
SET PSONEW("DFLG")=1
KILL PSOANSQ
GOTO END
+24 if '$GET(PSONEW("DFLG"))
GOTO START
+25 SET PSONEW("QFLG")=1
SET PSONEW("DFLG")=0
END DO EOJ
+1 QUIT
+2 ;------------------------------------------------------------
STOP ; Checks whether the Fill Date is past the Expiration Date
+1 NEW ISSDT,X
KILL PSEXDT
SET PSON52("QFLG")=0
+2 SET ISSDT=$GET(PSONEW("ISSUE DATE"))
IF 'ISSDT
SET X=ISSDT
DO ^%DT
if Y>0
SET ISSDT=Y
IF 'ISSDT
SET ISSDT=DT
+3 IF $$FMDIFF^XLFDT($GET(PSONEW("FILL DATE")),ISSDT)>$SELECT(+$GET(PSONEW("CS")):184,1:366)
Begin DoDot:1
+4 SET PSEXDT=1_"^"_$$FMADD^XLFDT(ISSDT,$SELECT(+$GET(PSONEW("CS")):184,1:366))
End DoDot:1
+5 QUIT
DISPLAY ;
+1 if +$$DS^PSSDSAPI&($GET(PSOFOERR))
DO HD3^PSODOSUN()
+2 WRITE !!,"Rx # ",PSONEW("RX #")
+3 ;441 PAPI
IF $GET(PSONEW("MAIL/WINDOW"))="P"
WRITE ?23,"Active/Parked"
+4 IF $GET(PSONEW("MAIL/WINDOW"))'="P"
WRITE ?23,$EXTRACT(PSONEW("FILL DATE"),4,5),"/",$EXTRACT(PSONEW("FILL DATE"),6,7),"/",$EXTRACT(PSONEW("FILL DATE"),2,3)
+5 WRITE !,$GET(PSORX("NAME")),?30,"#",PSONEW("QTY")
+6 IF $GET(SIGOK)
IF $ORDER(SIG(0))
Begin DoDot:1
+7 FOR D=0:0
SET D=$ORDER(SIG(D))
WRITE !,SIG(D)
if '$ORDER(SIG(D))
QUIT
if +$$DS^PSSDSAPI&($GET(PSOFOERR))
DO HD3^PSODOSUN(7)
End DoDot:1
KILL D
GOTO TRN
+8 IF '$TEST
SET X=PSONEW("SIG")
DO SIGONE^PSOHELP
WRITE !,$GET(INS1)
if +$$DS^PSSDSAPI&($GET(PSOFOERR))
DO HD3^PSODOSUN(7)
TRN ;I $G(PSOPRC) F I=0:0 S I=$O(PRC(I)) Q:'I W !,PRC(I)
+1 WRITE !!,$SELECT($GET(PSODRUG("TRADE NAME"))]"":PSODRUG("TRADE NAME"),1:PSODRUG("NAME"))
+2 WRITE !,PSONEW("PROVIDER NAME"),?25,PSORX("CLERK CODE"),!,"# of Refills: ",PSONEW("# OF REFILLS"),!
if +$$DS^PSSDSAPI&($GET(PSOFOERR))
DO HD3^PSODOSUN()
+3 QUIT
+4 ;
ASK ;
+1 KILL DIR,X,Y
SET DIR("A")="Is this correct"
+2 SET DIR(0)="Y"
SET DIR("B")="YES"
DO ^DIR
KILL DIR
IF $DATA(DIRUT)
SET PSONEW("DFLG")=1
GOTO ASKX
ASK1 IF Y
Begin DoDot:1
+1 if $GET(PSONEW("MAIL/WINDOW"))["W"
SET BINGCRT=Y
SET BINGRTE="W"
+2 if +$GET(PSEXDT)
Begin DoDot:2
+3 SET Y=PSONEW("FILL DATE")
XECUTE ^DD("DD")
WRITE !!,$CHAR(7),Y_" fill date is greater than possible expiration date of "
SET Y=$PIECE(PSEXDT,"^",2)
XECUTE ^DD("DD")
WRITE Y_"."
End DoDot:2
+4 DO DCORD
KILL RORD,^TMP("PSORXDC",$JOB)
End DoDot:1
SET PSONEW2("QFLG")=1
ASKX IF $DATA(DIRUT)
Begin DoDot:1
+1 IF +$GET(PSEXDT)
KILL DIRUT
SET (PSONEW2("QFLG"),PSONEW2("DFLG"),PSONEW("DFLG"),Y)=1
End DoDot:1
+2 KILL X,Y,DIRUT,DTOUT,DUOUT
+3 if +$GET(PSEXDT)
DO PAUSE^VALM1
+4 QUIT
DCORD ;dc rxs and pending orders after new order is entered
+1 IF $GET(PSORX("DFLG"))
KILL ^TMP("PSORXDC",$JOB)
QUIT
+2 FOR RORD=0:0
SET RORD=$ORDER(^TMP("PSORXDC",$JOB,RORD))
if 'RORD
QUIT
DO @$SELECT($PIECE(^TMP("PSORXDC",$JOB,RORD,0),"^")="P":"PEN",1:"RX52")
+3 IF $GET(PSORX("FN"))
SET VALMBCK="Q"
SET PSOFROM="NEW"
+4 KILL RORD,PSOTECCK
HANG 2
+5 QUIT
PEN ;pending ^tmp("psorxdc",$j,rord,0)="p^"_rord_"^"_msg
+1 NEW PSOR,DNM
SET PSOR=^PS(52.41,RORD,0)
SET $PIECE(^PS(52.41,RORD,0),"^",3)="DC"
SET ^PS(52.41,RORD,4)=$PIECE(^TMP("PSORXDC",$JOB,RORD,0),"^",3)
+2 KILL ^PS(52.41,"AOR",PSODFN,+$PIECE($GET(^PS(52.41,RORD,"INI")),"^"),RORD)
+3 SET DNM=$SELECT($PIECE(PSOR,"^",9):$PIECE($GET(^PSDRUG($PIECE(PSOR,"^",9),0)),"^"),1:$PIECE(^PS(50.7,$PIECE(PSOR,"^",8),0),"^")_" "_$PIECE(^PS(50.606,$PIECE(^PS(50.7,$PIECE(PSOR,"^",8),0),"^",2),0),"^"))
+4 DO EN^PSOHLSN($PIECE(^PS(52.41,RORD,0),"^"),"OC",$PIECE(^TMP("PSORXDC",$JOB,RORD,0),"^",3),"D")
+5 IF $GET(PSOTECCK)
IF '$DATA(^XUSEC("PSORPH",DUZ))
GOTO PENX
+6 WRITE $CHAR(7),!
KILL ^UTILITY($JOB,"W")
SET DIWL=1
SET DIWR=75
SET DIWF=""
+7 SET X=" Duplicate "_$SELECT($PIECE(^TMP("PSORXDC",$JOB,RORD,0),"^",10):"Therapy",1:"Drug")_" Pending Order "_DNM_" has been discontinued..."
DO ^DIWP
+8 FOR ZX=0:0
SET ZX=$ORDER(^UTILITY($JOB,"W",1,ZX))
if 'ZX
QUIT
WRITE !,^UTILITY($JOB,"W",1,ZX,0)
PENX KILL ^UTILITY($JOB,"W"),X,DIWL,DIWR,DIWF
WRITE !
+1 DO PSOUL^PSSLOCK(RORD_"S")
KILL ^TMP("PSORXDC",$JOB,RORD,0)
+2 QUIT
RX52 ;rxs in file 52 ^tmp("psorxdc",$j,rord,0)=52^rord^msg^rea^act^sta^dnm
+1 SET PSCAN($PIECE(^PSRX(RORD,0),"^"))=RORD_"^"_$PIECE(^TMP("PSORXDC",$JOB,RORD,0),"^",4)
+2 SET MSG=$PIECE(^TMP("PSORXDC",$JOB,RORD,0),"^",3)
SET REA=$PIECE(^(0),"^",4)
SET ACT=$PIECE(^(0),"^",5)
+3 NEW PSONOOR
SET PSONOOR="D"
SET DUP=1
SET DA=RORD
DO CAN^PSOCAN
KILL PSONOOR
+4 IF $GET(PSOTECCK)
IF '$DATA(^XUSEC("PSORPH",DUZ))
GOTO RX52X
+5 WRITE $CHAR(7),!
KILL ^UTILITY($JOB,"W")
SET DIWL=1
SET DIWR=75
SET DIWF=""
+6 SET X=" Duplicate "_$SELECT($PIECE(^TMP("PSORXDC",$JOB,RORD,0),"^",10):"Therapy",1:"Drug")_" Rx #"_$PIECE(^PSRX(RORD,0),"^")_" "_$PIECE(^TMP("PSORXDC",$JOB,RORD,0),"^",7)_" has been discontinued..."
DO ^DIWP
+7 FOR ZX=0:0
SET ZX=$ORDER(^UTILITY($JOB,"W",1,ZX))
if 'ZX
QUIT
WRITE !,^UTILITY($JOB,"W",1,ZX,0)
RX52X KILL ^UTILITY($JOB,"W"),X,DIWL,DIWR,DIWF
WRITE !
+1 KILL PSOSD($PIECE(^TMP("PSORXDC",$JOB,RORD,0),"^",6),$PIECE(^TMP("PSORXDC",$JOB,RORD,0),"^",7))
+2 DO PSOUL^PSSLOCK(RORD)
KILL ^TMP("PSORXDC",$JOB,RORD,0)
+3 QUIT
+4 ;
EDIT ;
+1 SET PSORX("EDIT")=1
+2 DO ^PSONEW3
+3 SET PSONEW("DFLG")=$SELECT($GET(PSORX("DFLG")):1,1:0)
+4 QUIT
+5 ;
EOJ ;
+1 KILL PSONEW2,PSORX("EDIT"),PSORX("DFLG"),PSOEDIT,PSOSCA
+2 QUIT
+3 ;
EN1(PSONEW2) ; Entry point to just display and ask if okay
+1 SET PSONEW("DFLG")=0
+2 IF $GET(^PSRX(PSONEW2("IRXN"),0))']""
SET PSONEW("DFLG")=1
GOTO EN1X
+3 SET PSOX=^PSRX(PSONEW2("IRXN"),0)
SET PSONEW("TRADE NAME")=$GET(^("TN"))
SET PSONEW("FILL DATE")=$PIECE($GET(^(2)),"^",2)
+4 SET PSONEW("RX #")=$PIECE(PSOX,"^")
SET PSORX("NAME")=$PIECE(^DPT($PIECE(PSOX,"^",2),0),"^")
+5 SET PSONEW("QTY")=$PIECE(PSOX,"^",7)
SET PSODRUG("NAME")=$PIECE(^PSDRUG($PIECE(PSOX,"^",6),0),"^")
SET PSONEW("# OF REFILLS")=$PIECE(PSOX,"^",9)
+6 SET PSORX("CLERK CODE")=$PIECE(^VA(200,$PIECE(PSOX,"^",16),0),"^")
+7 if $GET(PSONEW("PROVIDER NAME"))=""
SET PSONEW("PROVIDER NAME")=$PIECE(^VA(200,$PIECE(PSOX,"^",4),0),"^")
+8 SET PSONEW("SIG")=$PIECE($GET(^PSRX(PSONEW2("IRXN"),"SIG")),"^")
+9 DO DISPLAY
+10 DO ASK
+11 IF PSONEW("DFLG")=1
SET PSONEW2("DFLG")=1
EN1X ;
+1 QUIT
+2 ;
EXPR ;Display Expired error message ;PSO*237
+1 SET PSONEW("DFLG")=1
+2 WRITE $CHAR(7)
+3 SET VALMSG="Order is older than 365 days and can't be finished"
+4 SET XQORM("B")="DC"
+5 QUIT