PSOORNE6 ;ISC-BHAM/SAB-display orders from backdoor ;29-May-2012 15:00;PLS
;;7.0;OUTPATIENT PHARMACY;**46,103,117,156,210,1015**;DEC 1997;Build 62
;External reference to MAIN^TIUEDIT is supported by DBIA 2410
;PSO*210 add call to WORDWRAP api
; Modified - IHS/CIA/PLS - 05/17/04 - QTY
SIG ;called from psoorne3
I $G(PSOSIGFL)!$G(PSOCOPY)!($O(SIG(0))) G DOSE
I '$P(^PSRX(PSORXED("IRXN"),"SIG"),"^",2) D Q
.S X=$P(^PSRX(PSORXED("IRXN"),"SIG"),"^") D SIGONE^PSOHELP S SIG=$E($G(INS1),2,250)
.F SG=1:1:$L(SIG) S:$L(^TMP("PSOPO",$J,IEN,0)_" "_$P(SIG," ",SG))>80 IEN=IEN+1,$P(^TMP("PSOPO",$J,IEN,0)," ",21)=" " S:$P(SIG," ",SG)'="" ^TMP("PSOPO",$J,IEN,0)=$G(^TMP("PSOPO",$J,IEN,0))_" "_$P(SIG," ",SG)
F I=0:0 S I=$O(^PSRX(PSORXED("IRXN"),"SIG1",I)) Q:'I S MIG=$P(^PSRX(PSORXED("IRXN"),"SIG1",I,0),"^") D
.S SIG(I)=MIG
.F SG=1:1:$L(MIG) S:$L(^TMP("PSOPO",$J,IEN,0)_" "_$P(MIG," ",SG))>80 IEN=IEN+1,$P(^TMP("PSOPO",$J,IEN,0)," ",21)=" " S:$P(MIG," ",SG)'="" ^TMP("PSOPO",$J,IEN,0)=$G(^TMP("PSOPO",$J,IEN,0))_" "_$P(MIG," ",SG)
.S SIGOK=1 K MIG,SG
Q
DOSE ;displays new SIG with dosing
F I=0:0 S I=$O(SIG(I)) Q:'$D(SIG(+I)) D
.F SG=1:1:$L(SIG(I)) S:$L(^TMP("PSOPO",$J,IEN,0)_" "_$P(SIG(I)," ",SG))>75 IEN=IEN+1,$P(^TMP("PSOPO",$J,IEN,0)," ",21)=" " S:$P(SIG(I)," ",SG)'="" ^TMP("PSOPO",$J,IEN,0)=$G(^TMP("PSOPO",$J,IEN,0))_" "_$P(SIG(I)," ",SG)
S SIGOK=1 K MIG,I
Q
K1 ;
K DRET,SIG,RTE,PRC,PHI,PSONOOR,PSOFDR,PSORXED,REF,DIR,DUOUT,DIRUT,SIGOK
Q
K2 ;
K SIG,DRET,RTE,PRC,PHI,DIR,DIRUT,DTOUT,PSOOELSE,DUOUT,PSOFDR,SIGOK,PSORXED,REF,INS1
Q
K3 ;
K PSLST,ORD,IEN,ORN,RPH,ST,REFL,REF,PSOACT,ORSV,CC,CRIT,CT,DAYS,DDER,DEA,DSMSG,HDR,PSOAC,PSOFLAG,RFCNT
K UPMI,RIFN,RX,RXDA,RXOR,RXREF,SEG1,SER,STA,PSOFDR,SIGOK,INCOM,PSONOOR,ACTREF,ACTREN,INS1,RX0,RX2,RX3
Q
ACP1 ;
K REA,DA,MSG S REA="C",DA=PSONEW("OIRXN") S MSG="Renewed"_$S($G(PSOFDR):" from CPRS",1:"")
S PSCAN(PSONEW("ORX #"))=DA_"^C" D CAN^PSOCAN,DCORD^PSONEW2 K REA,DA,MSG,PSCAN,RXXN
S RXXN=$O(^TMP("PSORXN",$J,0)) I RXXN D
.S RXN1=^TMP("PSORXN",$J,RXXN) D EN^PSOHLSN1(RXXN,$P(RXN1,"^"),$P(RXN1,"^",2),"",$P(RXN1,"^",3))
.I $P(^PSRX(RXXN,"STA"),"^")=5 D EN^PSOHLSN1(RXXN,"SC","ZS",$P(RXN1,"^",4))
I $G(PSONOTE) D FULL^VALM1,MAIN^TIUEDIT(3,.TIUDA,PSODFN,"","","","",1) K PSONOTE
K VERB,RTE,DRET,RXXN,RXN1,^TMP("PSORXN",$J)
S BBRN="",BBRN1=$O(^PSRX("B",PSONEW("NRX #"),BBRN)) I $P($G(^PSRX(BBRN1,0)),"^",11)["W" S BINGCRT="Y",BINGRTE="W"
Q
INST ;formats instruction from front door
I $O(^PSRX(RXN,"PI",0)) S PHI=^PSRX(RXN,"PI",0),T=0 D
.F S T=$O(^PSRX(RXN,"PI",T)) Q:'T S PHI(T)=^PSRX(RXN,"PI",T,0)
.S IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Instructions:"
.S T=0 F S T=$O(^PSRX(RXN,"PI",T)) Q:'T D ;PSO*210
.. S MIG=^PSRX(RXN,"PI",T,0)
.. D WORDWRAP^PSOUTLA2(MIG,.IEN,$NA(^TMP("PSOAO",$J)),21)
K T,TY,MIG,SG
Q
PC ;displays provider comments
I $O(^PSRX(RXN,"PRC",0)) S PRC=^PSRX(RXN,"PRC",0),T=0 D
.F S T=$O(^PSRX(RXN,"PRC",T)) Q:'T S PRC(T)=^PSRX(RXN,"PRC",T,0)
.S IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Provider Comments:"
.S T=0 F S T=$O(^PSRX(RXN,"PRC",T)) Q:'T D ;PSO*210
.. S MIG=^PSRX(RXN,"PRC",T,0)
.. D WORDWRAP^PSOUTLA2(MIG,.IEN,$NA(^TMP("PSOAO",$J)),21)
K T,TY,MIG,SG
Q
INST1 ;formats instruction from front door
I $O(^PSRX(RXN,"PI",0)) S PHI=^PSRX(RXN,"PI",0),T=0 D
.F S T=$O(^PSRX(RXN,"PI",T)) Q:'T S PHI(T)=^PSRX(RXN,"PI",T,0)
.S IEN=IEN+1,^TMP("PSOPO",$J,IEN,0)=" Instructions:"
.S T=0 F S T=$O(^PSRX(RXN,"PI",T)) Q:'T D ;PSO*210
.. S MIG=^PSRX(RXN,"PI",T,0)
.. D WORDWRAP^PSOUTLA2(MIG,.IEN,$NA(^TMP("PSOPO",$J)),21)
K T,TY,MIG,SG
Q
PC1 ;displays provider comments
I $O(^PSRX(RXN,"PRC",0)) S PRC=^PSRX(RXN,"PRC",0),T=0 D
.F S T=$O(^PSRX(RXN,"PRC",T)) Q:'T S PRC(T)=^PSRX(RXN,"PRC",T,0)
.S IEN=IEN+1,^TMP("PSOPO",$J,IEN,0)=" Provider Comments:"
.S T=0 F S T=$O(^PSRX(RXN,"PRC",T)) Q:'T D ;PSO*210
.. S MIG=^PSRX(RXN,"PRC",T,0)
.. D WORDWRAP^PSOUTLA2(MIG,.IEN,$NA(^TMP("PSOPO",$J)),21)
K T,TY,MIG,SG
Q
ORCHK ;
S (PSONEW("QFLG"),PSONEW("DFLG"))=0
D FULL^VALM1 W !
I $G(PSODRUG("NAME"))']"" D S:$D(DIRUT)!($G(PSODRUG("NAME"))']"") ACP=0 Q:$G(PSOQFLG)!($D(DIRUT))
.W !,"DRUG NAME REQUIRED" D 2^PSOORNW1,FULL^VALM1 I $G(PSODRUG("NAME"))']"" S VALMSG="No Dispense Drug selected."
S PSOMIS=$S($G(PSONEW("DOSE",1))']"":1,$G(PSONEW("SCHEDULE",1))']"":2,1:0)
D:PSOMIS I PSODIR("DFLG")=1 S (PSONEW("QFLG"),POERR("DFLG"))=1 Q
.W !!,"Incomplete Dosaging Instructions - "_$S(PSOMIS=2:"Schedule",1:"Dosage")_".",! S FDORC=1 D DOSE^PSOORED4(.PSONEW) K FDORC
.I $G(PSONEW("DOSE",1))']""!($G(PSONEW("SCHEDULE",1))']"") S PSODIR("DFLG")=1 Q
.D EN^PSOFSIG(.PSONEW) I PSONEW("ENT")>0,$O(SIG(0)) S (SIGOK,NEWDOSE)=1
.D INS^PSODIR(.PSONEW),EN^PSOFSIG(.PSONEW)
K PSOMIS,PSODOSE,POERR("DFLG"),PSONEW("QFLG") S I=0
F S I=$O(PSONEW("DOSE",I)) Q:'I I $L(PSONEW("DOSE",I))>60 S (PSONEW("QFLG"),POERR("DFLG"))=1,PSODOSE("MSG",I)="Dosage #"_I_" is greater 60 characters in length!",VALMSG="Dosage Greater than 60 Characters, Please Edit!"
I $G(POERR("DFLG"))=1 D K PSODOSE,I Q
.S I=0 F S I=$O(PSODOSE("MSG",I)) Q:'I W !,PSODOSE("MSG",I)
.H 3
Q:$G(PSONEW("QFLG"))
K PSONEW("FLD") F FLD="PATIENT STATUS^5","QTY^9","DAYS SUPPLY^8","# OF REFILLS^10","ISSUE DATE^6","FILL DATE^7","MAIL/WINDOW^11","PROVIDER NAME^13" D I $G(PSONEW($P(FLD,"^")))']"" S VALMBCK="R",PSONEW("FLD")=1
.I $G(PSONEW($P(FLD,"^")))']"" W !,$P(FLD,"^")_" is required data" N RTN S RTN=$P(FLD,"^",2)_"^PSOORNEW" D @RTN K RTN
Q:$G(PSONEW("DFLG"))=1
; IHS/CIA/PLS - 05/17/04 - Fixed issue with QTY<1 and QTY>0
QTY ;I PSONEW("QTY")'=+PSONEW("QTY") W !,"Quantity must be ALL numeric!",! D 9^PSOORNEW Q:$G(PSONEW("DFLG"))=1 G QTY
I PSONEW("QTY")'=+PSONEW("QTY"),PSONEW("QTY")'?1"0.".N W !,"Quantity must be ALL numeric!",! D 9^PSOORNEW Q:$G(PSONEW("DFLG"))=1 G QTY
I $G(PSODRUG("MAXDOSE"))]"",(PSONEW("QTY")/PSONEW("DAYS SUPPLY")>PSODRUG("MAXDOSE")) D Q:$G(PSONEW("DFLG"))=1!($G(PSONEW("QFLG"))) G QTY
.W !,$C(7)," Greater than Maximum dose of "_PSODRUG("MAXDOSE")_" per day"
.D KV^PSOVER1 S DIR(0)="Y",DIR("B")="Yes",DIR("A")="Do You Want to Edit Days Supply and Quantity Fields"
.S DIR("?")="Enter 'Y' for Yes, 'N' for No, '^' to exit."
.D ^DIR I $D(DIRUT) D KV^PSOVER1 K X,Y S PSONEW("DFLG")=1 Q
.D KV^PSOVER1 I 'Y K X,Y Q
.D 8^PSOORNEW Q:$G(PSONEW("DFLG")) D 9^PSOORNEW
I $G(PSONEW("PROVIDER")) D PROV^PSOUTIL(.PSONEW) I $G(PSONEW("DFLG")) S PSODIR("DFLG")=1 Q
S PSONEW("DFLG")=0 K DIC,X,Y
Q
DISP ;
S:$P(RX2,"^",10)&('$G(PSOCOPY)) IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Verified By: "_$P(^VA(200,$P(RX2,"^",10),0),"^")
I $P($G(^PSRX(RXN,"OR1")),"^",5) S IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Finished By: "_$P(^VA(200,$P(^PSRX(RXN,"OR1"),"^",5),0),"^")
I $P($G(^PSRX(RXN,"OR1")),"^",6) D
.S IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Filled By: "_$P(^VA(200,$P(^PSRX(RXN,"OR1"),"^",6),0),"^")
I $P($G(^PSRX(RXN,"OR1")),"^",7) D
.S IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Checked By: "_$P(^VA(200,$P(^PSRX(RXN,"OR1"),"^",7),0),"^")
S $P(RN," ",35)=" ",IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Entry By: "_$P(^VA(200,$P(RX0,"^",16),0),"^")_$E(RN,$L($P(^VA(200,$P(RX0,"^",16),0),"^"))+1,35)
S Y=$P(RX2,"^") X ^DD("DD")
S ^TMP("PSOAO",$J,IEN,0)=^TMP("PSOAO",$J,IEN,0)_"Entry Date: "_$E($P(RX2,"^"),4,5)_"/"_$E($P(RX2,"^"),6,7)_"/"_$E($P(RX2,"^"),2,3)_" "_$P(Y,"@",2) K RN
S (VALMCNT,PSOPF)=IEN S:$P($G(^PSRX(RXN,"PKI")),"^") VALMSG="Digitally Signed Order"
Q
PSOORNE6 ;ISC-BHAM/SAB-display orders from backdoor ;29-May-2012 15:00;PLS
+1 ;;7.0;OUTPATIENT PHARMACY;**46,103,117,156,210,1015**;DEC 1997;Build 62
+2 ;External reference to MAIN^TIUEDIT is supported by DBIA 2410
+3 ;PSO*210 add call to WORDWRAP api
+4 ; Modified - IHS/CIA/PLS - 05/17/04 - QTY
SIG ;called from psoorne3
+1 IF $GET(PSOSIGFL)!$GET(PSOCOPY)!($ORDER(SIG(0)))
GOTO DOSE
+2 IF '$PIECE(^PSRX(PSORXED("IRXN"),"SIG"),"^",2)
Begin DoDot:1
+3 SET X=$PIECE(^PSRX(PSORXED("IRXN"),"SIG"),"^")
DO SIGONE^PSOHELP
SET SIG=$EXTRACT($GET(INS1),2,250)
+4 FOR SG=1:1:$LENGTH(SIG)
IF $LENGTH(^TMP("PSOPO",$JOB,IEN,0)_" "_$PIECE(SIG," ",SG))>80
SET IEN=IEN+1
SET $PIECE(^TMP("PSOPO",$JOB,IEN,0)," ",21)=" "
IF $PIECE(SIG," ",SG)'=""
SET ^TMP("PSOPO",$JOB,IEN,0)=$GET(^TMP("PSOPO",$JOB,IEN,0))_" "_$PIECE(SIG," ",SG)
End DoDot:1
QUIT
+5 FOR I=0:0
SET I=$ORDER(^PSRX(PSORXED("IRXN"),"SIG1",I))
IF 'I
QUIT
SET MIG=$PIECE(^PSRX(PSORXED("IRXN"),"SIG1",I,0),"^")
Begin DoDot:1
+6 SET SIG(I)=MIG
+7 FOR SG=1:1:$LENGTH(MIG)
IF $LENGTH(^TMP("PSOPO",$JOB,IEN,0)_" "_$PIECE(MIG," ",SG))>80
SET IEN=IEN+1
SET $PIECE(^TMP("PSOPO",$JOB,IEN,0)," ",21)=" "
IF $PIECE(MIG," ",SG)'=""
SET ^TMP("PSOPO",$JOB,IEN,0)=$GET(^TMP("PSOPO",$JOB,IEN,0))_" "_$PIECE(MIG," ",SG)
+8 SET SIGOK=1
KILL MIG,SG
End DoDot:1
+9 QUIT
DOSE ;displays new SIG with dosing
+1 FOR I=0:0
SET I=$ORDER(SIG(I))
IF '$DATA(SIG(+I))
QUIT
Begin DoDot:1
+2 FOR SG=1:1:$LENGTH(SIG(I))
IF $LENGTH(^TMP("PSOPO",$JOB,IEN,0)_" "_$PIECE(SIG(I)," ",SG))>75
SET IEN=IEN+1
SET $PIECE(^TMP("PSOPO",$JOB,IEN,0)," ",21)=" "
IF $PIECE(SIG(I)," ",SG)'=""
SET ^TMP("PSOPO",$JOB,IEN,0)=$GET(^TMP("PSOPO",$JOB,IEN,0))_" "_$PIECE(SIG(I)," ",SG)
End DoDot:1
+3 SET SIGOK=1
KILL MIG,I
+4 QUIT
K1 ;
+1 KILL DRET,SIG,RTE,PRC,PHI,PSONOOR,PSOFDR,PSORXED,REF,DIR,DUOUT,DIRUT,SIGOK
+2 QUIT
K2 ;
+1 KILL SIG,DRET,RTE,PRC,PHI,DIR,DIRUT,DTOUT,PSOOELSE,DUOUT,PSOFDR,SIGOK,PSORXED,REF,INS1
+2 QUIT
K3 ;
+1 KILL PSLST,ORD,IEN,ORN,RPH,ST,REFL,REF,PSOACT,ORSV,CC,CRIT,CT,DAYS,DDER,DEA,DSMSG,HDR,PSOAC,PSOFLAG,RFCNT
+2 KILL UPMI,RIFN,RX,RXDA,RXOR,RXREF,SEG1,SER,STA,PSOFDR,SIGOK,INCOM,PSONOOR,ACTREF,ACTREN,INS1,RX0,RX2,RX3
+3 QUIT
ACP1 ;
+1 KILL REA,DA,MSG
SET REA="C"
SET DA=PSONEW("OIRXN")
SET MSG="Renewed"_$SELECT($GET(PSOFDR):" from CPRS",1:"")
+2 SET PSCAN(PSONEW("ORX #"))=DA_"^C"
DO CAN^PSOCAN
DO DCORD^PSONEW2
KILL REA,DA,MSG,PSCAN,RXXN
+3 SET RXXN=$ORDER(^TMP("PSORXN",$JOB,0))
IF RXXN
Begin DoDot:1
+4 SET RXN1=^TMP("PSORXN",$JOB,RXXN)
DO EN^PSOHLSN1(RXXN,$PIECE(RXN1,"^"),$PIECE(RXN1,"^",2),"",$PIECE(RXN1,"^",3))
+5 IF $PIECE(^PSRX(RXXN,"STA"),"^")=5
DO EN^PSOHLSN1(RXXN,"SC","ZS",$PIECE(RXN1,"^",4))
End DoDot:1
+6 IF $GET(PSONOTE)
DO FULL^VALM1
DO MAIN^TIUEDIT(3,.TIUDA,PSODFN,"","","","",1)
KILL PSONOTE
+7 KILL VERB,RTE,DRET,RXXN,RXN1,^TMP("PSORXN",$JOB)
+8 SET BBRN=""
SET BBRN1=$ORDER(^PSRX("B",PSONEW("NRX #"),BBRN))
IF $PIECE($GET(^PSRX(BBRN1,0)),"^",11)["W"
SET BINGCRT="Y"
SET BINGRTE="W"
+9 QUIT
INST ;formats instruction from front door
+1 IF $ORDER(^PSRX(RXN,"PI",0))
SET PHI=^PSRX(RXN,"PI",0)
SET T=0
Begin DoDot:1
+2 FOR
SET T=$ORDER(^PSRX(RXN,"PI",T))
IF 'T
QUIT
SET PHI(T)=^PSRX(RXN,"PI",T,0)
+3 SET IEN=IEN+1
SET ^TMP("PSOAO",$JOB,IEN,0)=" Instructions:"
+4 ;PSO*210
SET T=0
FOR
SET T=$ORDER(^PSRX(RXN,"PI",T))
IF 'T
QUIT
Begin DoDot:2
+5 SET MIG=^PSRX(RXN,"PI",T,0)
+6 DO WORDWRAP^PSOUTLA2(MIG,.IEN,$NAME(^TMP("PSOAO",$JOB)),21)
End DoDot:2
End DoDot:1
+7 KILL T,TY,MIG,SG
+8 QUIT
PC ;displays provider comments
+1 IF $ORDER(^PSRX(RXN,"PRC",0))
SET PRC=^PSRX(RXN,"PRC",0)
SET T=0
Begin DoDot:1
+2 FOR
SET T=$ORDER(^PSRX(RXN,"PRC",T))
IF 'T
QUIT
SET PRC(T)=^PSRX(RXN,"PRC",T,0)
+3 SET IEN=IEN+1
SET ^TMP("PSOAO",$JOB,IEN,0)=" Provider Comments:"
+4 ;PSO*210
SET T=0
FOR
SET T=$ORDER(^PSRX(RXN,"PRC",T))
IF 'T
QUIT
Begin DoDot:2
+5 SET MIG=^PSRX(RXN,"PRC",T,0)
+6 DO WORDWRAP^PSOUTLA2(MIG,.IEN,$NAME(^TMP("PSOAO",$JOB)),21)
End DoDot:2
End DoDot:1
+7 KILL T,TY,MIG,SG
+8 QUIT
INST1 ;formats instruction from front door
+1 IF $ORDER(^PSRX(RXN,"PI",0))
SET PHI=^PSRX(RXN,"PI",0)
SET T=0
Begin DoDot:1
+2 FOR
SET T=$ORDER(^PSRX(RXN,"PI",T))
IF 'T
QUIT
SET PHI(T)=^PSRX(RXN,"PI",T,0)
+3 SET IEN=IEN+1
SET ^TMP("PSOPO",$JOB,IEN,0)=" Instructions:"
+4 ;PSO*210
SET T=0
FOR
SET T=$ORDER(^PSRX(RXN,"PI",T))
IF 'T
QUIT
Begin DoDot:2
+5 SET MIG=^PSRX(RXN,"PI",T,0)
+6 DO WORDWRAP^PSOUTLA2(MIG,.IEN,$NAME(^TMP("PSOPO",$JOB)),21)
End DoDot:2
End DoDot:1
+7 KILL T,TY,MIG,SG
+8 QUIT
PC1 ;displays provider comments
+1 IF $ORDER(^PSRX(RXN,"PRC",0))
SET PRC=^PSRX(RXN,"PRC",0)
SET T=0
Begin DoDot:1
+2 FOR
SET T=$ORDER(^PSRX(RXN,"PRC",T))
IF 'T
QUIT
SET PRC(T)=^PSRX(RXN,"PRC",T,0)
+3 SET IEN=IEN+1
SET ^TMP("PSOPO",$JOB,IEN,0)=" Provider Comments:"
+4 ;PSO*210
SET T=0
FOR
SET T=$ORDER(^PSRX(RXN,"PRC",T))
IF 'T
QUIT
Begin DoDot:2
+5 SET MIG=^PSRX(RXN,"PRC",T,0)
+6 DO WORDWRAP^PSOUTLA2(MIG,.IEN,$NAME(^TMP("PSOPO",$JOB)),21)
End DoDot:2
End DoDot:1
+7 KILL T,TY,MIG,SG
+8 QUIT
ORCHK ;
+1 SET (PSONEW("QFLG"),PSONEW("DFLG"))=0
+2 DO FULL^VALM1
WRITE !
+3 IF $GET(PSODRUG("NAME"))']""
Begin DoDot:1
+4 WRITE !,"DRUG NAME REQUIRED"
DO 2^PSOORNW1
DO FULL^VALM1
IF $GET(PSODRUG("NAME"))']""
SET VALMSG="No Dispense Drug selected."
End DoDot:1
IF $DATA(DIRUT)!($GET(PSODRUG("NAME"))']"")
SET ACP=0
IF $GET(PSOQFLG)!($DATA(DIRUT))
QUIT
+5 SET PSOMIS=$SELECT($GET(PSONEW("DOSE",1))']"":1,$GET(PSONEW("SCHEDULE",1))']"":2,1:0)
+6 IF PSOMIS
Begin DoDot:1
+7 WRITE !!,"Incomplete Dosaging Instructions - "_$SELECT(PSOMIS=2:"Schedule",1:"Dosage")_".",!
SET FDORC=1
DO DOSE^PSOORED4(.PSONEW)
KILL FDORC
+8 IF $GET(PSONEW("DOSE",1))']""!($GET(PSONEW("SCHEDULE",1))']"")
SET PSODIR("DFLG")=1
QUIT
+9 DO EN^PSOFSIG(.PSONEW)
IF PSONEW("ENT")>0
IF $ORDER(SIG(0))
SET (SIGOK,NEWDOSE)=1
+10 DO INS^PSODIR(.PSONEW)
DO EN^PSOFSIG(.PSONEW)
End DoDot:1
IF PSODIR("DFLG")=1
SET (PSONEW("QFLG"),POERR("DFLG"))=1
QUIT
+11 KILL PSOMIS,PSODOSE,POERR("DFLG"),PSONEW("QFLG")
SET I=0
+12 FOR
SET I=$ORDER(PSONEW("DOSE",I))
IF 'I
QUIT
IF $LENGTH(PSONEW("DOSE",I))>60
SET (PSONEW("QFLG"),POERR("DFLG"))=1
SET PSODOSE("MSG",I)="Dosage #"_I_" is greater 60 characters in length!"
SET VALMSG="Dosage Greater than 60 Characters, Please Edit!"
+13 IF $GET(POERR("DFLG"))=1
Begin DoDot:1
+14 SET I=0
FOR
SET I=$ORDER(PSODOSE("MSG",I))
IF 'I
QUIT
WRITE !,PSODOSE("MSG",I)
+15 HANG 3
End DoDot:1
KILL PSODOSE,I
QUIT
+16 IF $GET(PSONEW("QFLG"))
QUIT
+17 KILL PSONEW("FLD")
FOR FLD="PATIENT STATUS^5","QTY^9","DAYS SUPPLY^8","# OF REFILLS^10","ISSUE DATE^6","FILL DATE^7","MAIL/WINDOW^11","PROVIDER NAME^13"
Begin DoDot:1
+18 IF $GET(PSONEW($PIECE(FLD,"^")))']""
WRITE !,$PIECE(FLD,"^")_" is required data"
NEW RTN
SET RTN=$PIECE(FLD,"^",2)_"^PSOORNEW"
DO @RTN
KILL RTN
End DoDot:1
IF $GET(PSONEW($PIECE(FLD,"^")))']""
SET VALMBCK="R"
SET PSONEW("FLD")=1
+19 IF $GET(PSONEW("DFLG"))=1
QUIT
+20 ; IHS/CIA/PLS - 05/17/04 - Fixed issue with QTY<1 and QTY>0
QTY ;I PSONEW("QTY")'=+PSONEW("QTY") W !,"Quantity must be ALL numeric!",! D 9^PSOORNEW Q:$G(PSONEW("DFLG"))=1 G QTY
+1 IF PSONEW("QTY")'=+PSONEW("QTY")
IF PSONEW("QTY")'?1"0.".N
WRITE !,"Quantity must be ALL numeric!",!
DO 9^PSOORNEW
IF $GET(PSONEW("DFLG"))=1
QUIT
GOTO QTY
+2 IF $GET(PSODRUG("MAXDOSE"))]""
IF (PSONEW("QTY")/PSONEW("DAYS SUPPLY")>PSODRUG("MAXDOSE"))
Begin DoDot:1
+3 WRITE !,$CHAR(7)," Greater than Maximum dose of "_PSODRUG("MAXDOSE")_" per day"
+4 DO KV^PSOVER1
SET DIR(0)="Y"
SET DIR("B")="Yes"
SET DIR("A")="Do You Want to Edit Days Supply and Quantity Fields"
+5 SET DIR("?")="Enter 'Y' for Yes, 'N' for No, '^' to exit."
+6 DO ^DIR
IF $DATA(DIRUT)
DO KV^PSOVER1
KILL X,Y
SET PSONEW("DFLG")=1
QUIT
+7 DO KV^PSOVER1
IF 'Y
KILL X,Y
QUIT
+8 DO 8^PSOORNEW
IF $GET(PSONEW("DFLG"))
QUIT
DO 9^PSOORNEW
End DoDot:1
IF $GET(PSONEW("DFLG"))=1!($GET(PSONEW("QFLG")))
QUIT
GOTO QTY
+9 IF $GET(PSONEW("PROVIDER"))
DO PROV^PSOUTIL(.PSONEW)
IF $GET(PSONEW("DFLG"))
SET PSODIR("DFLG")=1
QUIT
+10 SET PSONEW("DFLG")=0
KILL DIC,X,Y
+11 QUIT
DISP ;
+1 IF $PIECE(RX2,"^",10)&('$GET(PSOCOPY))
SET IEN=IEN+1
SET ^TMP("PSOAO",$JOB,IEN,0)=" Verified By: "_$PIECE(^VA(200,$PIECE(RX2,"^",10),0),"^")
+2 IF $PIECE($GET(^PSRX(RXN,"OR1")),"^",5)
SET IEN=IEN+1
SET ^TMP("PSOAO",$JOB,IEN,0)=" Finished By: "_$PIECE(^VA(200,$PIECE(^PSRX(RXN,"OR1"),"^",5),0),"^")
+3 IF $PIECE($GET(^PSRX(RXN,"OR1")),"^",6)
Begin DoDot:1
+4 SET IEN=IEN+1
SET ^TMP("PSOAO",$JOB,IEN,0)=" Filled By: "_$PIECE(^VA(200,$PIECE(^PSRX(RXN,"OR1"),"^",6),0),"^")
End DoDot:1
+5 IF $PIECE($GET(^PSRX(RXN,"OR1")),"^",7)
Begin DoDot:1
+6 SET IEN=IEN+1
SET ^TMP("PSOAO",$JOB,IEN,0)=" Checked By: "_$PIECE(^VA(200,$PIECE(^PSRX(RXN,"OR1"),"^",7),0),"^")
End DoDot:1
+7 SET $PIECE(RN," ",35)=" "
SET IEN=IEN+1
SET ^TMP("PSOAO",$JOB,IEN,0)=" Entry By: "_$PIECE(^VA(200,$PIECE(RX0,"^",16),0),"^")_$EXTRACT(RN,$LENGTH($PIECE(^VA(200,$PIECE(RX0,"^",16),0),"^"))+1,35)
+8 SET Y=$PIECE(RX2,"^")
XECUTE ^DD("DD")
+9 SET ^TMP("PSOAO",$JOB,IEN,0)=^TMP("PSOAO",$JOB,IEN,0)_"Entry Date: "_$EXTRACT($PIECE(RX2,"^"),4,5)_"/"_$EXTRACT($PIECE(RX2,"^"),6,7)_"/"_$EXTRACT($PIECE(RX2,"^"),2,3)_" "_$PIECE(Y,"@",2)
KILL RN
+10 SET (VALMCNT,PSOPF)=IEN
IF $PIECE($GET(^PSRX(RXN,"PKI")),"^")
SET VALMSG="Digitally Signed Order"
+11 QUIT