Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSODOSU2

PSODOSU2.m

Go to the documentation of this file.
PSODOSU2 ;BIR/RTR - Dose Check Utility routine continued ;11/18/08
 ;;7.0;OUTPATIENT PHARMACY;**251,375,372,436,402,518**;DEC 1997;Build 3
 ;
 ;Called from PSODOSUT.  The variable PSODTYPE is expected to be defined.
 ; PSODTYPE values can be N for dosing for new order, copy, and renews, E for edited and display of individual complex doses, and C for complex orders
 ;
EN ;new order, copy, renew, and verify orders
 N PSODLERW,PSODLERL,PSODLERS,PSODLERH,PSOCPXRR,PSODLWW,PSODOSER,PSONFRNF,PSOWMSG,PSODLQTC,PSOOFL,PSOOCNT
 N PSODMESE,PSODMESX,PSODMESG,PSODMEST,PSODMESH,PSODMESM,PSORLNF
 S (PSODLERF,PSODSEQ,PSODLWW,PSOOFL,PSORLNF)="",PSOOCNT=0
 F  S PSODSEQ=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ)) Q:PSODSEQ=""!($G(PSORX("DFLG")))!($G(PSODLQTC))  S PSODLNN1=""  D  D HD Q:$G(PSODLQTC)
 .S:PSODTYPE'="N" PSODLQT=0 S PSOLASTS=PSODSEQ
 .I PSODTYPE="C" K PSOCPXRR
 .F  S PSODLNN1=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1)) Q:PSODLNN1=""!($G(PSORX("DFLG")))!($G(PSODLQTC))  D
 ..S:PSODTYPE'="E" PSODLECT=0
 ..I PSODTYPE="E" Q:$P(PSODLNN1,";",4)'=PSODLXNT
 ..S PSOOCNT=PSOOCNT+1 I PSOOCNT>1,PSOCPXB=2!(PSOCPXB=3) W !
 ..D EXCEPT^PSODOSUT,SETV
 ..D ERROR Q:$G(PSODLQTC)  I PSODLERZ,'PSODMESX,'PSODMESM W ! I PSODTYPE'="E" W !
 ..D EXCEPT Q:$G(PSODLQTC)  I PSODLERZ,'PSODMESM W ! I PSODTYPE'="E" W !
 ..D MESSAGE Q:$G(PSODLQTC)
 .K PSODLWW
 Q
 ;
ERROR ;format and write dosing error
 I PSODTYPE'="E" S PSODLECT=0
 F PSODLERA=0:0 S PSODLERA=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"ERROR",PSODLERA)) Q:'PSODLERA!($G(PSORX("DFLG")))  D
 .S:PSODTYPE'="E" PSODLECT=PSODLECT+1
 .S:PSODTYPE'="N" PSODLQT=0
 .F PSODLERX="MSG","TEXT" S PSODLERB=$G(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"ERROR",PSODLERA,PSODLERX)) D  K ^UTILITY($J,"W")
 ..S PSODLERZ=0 Q:PSODLERB=""
 ..I PSODTYPE="C"&(PSOCPXB>3) D ERRCOM Q
 ..I PSODTYPE="E" D ERREDIT Q
 ..I PSODTYPE="N"&(PSOCPXB>3) D ERRNEW Q
 ..Q:PSODTYPE="C"&(PSOCPXB<4)
 ..D ERRNEW
 I PSODTYPE="E",PSODMESG W !
 Q
 ;
ERRCOM ;write dosing errors for complex dose summary after accept of an order
 I PSOCPXC D HD Q:$G(PSODLQTC)  I PSODLERF,PSODLERX="MSG" W:'PSODLQT ! D HD Q:$G(PSODLQTC)
 I 'PSODLERF,PSOCPXB<4 W:'PSODLQT&(PSOCPXC) !
 S PSODLERF=1 D:PSOCPXC HD I PSODLERZ W:'PSODLQT&(PSOCPXC) !
 D:PSOCPXC
 .D HD Q:$G(PSODLQTC)  W:'PSODLQT&(PSODLECT>1) !
 .N X,DIWL,DIWR,DIWF,PSODELXR,PSODELXF
 .D:PSOCPXC HD D:'PSOCPXF&(PSOCPXC) 
 ..Q:$G(PSORENWD)&(PSOCPXB<4)  D SUMM^PSODOSUT
 .D:PSOCPXC HD S PSOCPXG=$P(PSODLNN1,";",4) I PSOCPXC&('$G(PSOCPXRR(PSOCPXG))) D PSOORI,SUB^PSODOSUT W:'PSODLQT&('PSODLERZ) !
 .D:PSOCPXC HD W:'PSODLQT&(PSODLECT'>1)&(PSODLERX="TEXT")&(PSOCPXC) ! S X=PSODLERB,DIWL=1,DIWR=$S(PSODLERX="MSG":76,1:74) K ^UTILITY($J,"W") D ^DIWP
 .S PSODELXF=0 F PSODELXR=0:0 S PSODELXR=$O(^UTILITY($J,"W",DIWL,PSODELXR)) Q:'PSODELXR  D:PSOCPXC HD W:PSODELXF&('PSODLQT) ! D
 ..D:PSOCPXC HD W:'$G(PSODLQT) $S(PSODLERX="MSG":"   ",1:"     ")_$G(^UTILITY($J,"W",DIWL,PSODELXR,0)) S (PSODLERR,PSODOSER,PSODLEXR,PSOERROR)=1 D SFD
 .S PSOLASTD(PSOLASTS)=1,PSONFRNF=1
 Q
 ;
ERREDIT ;write dosing errors for edits or display during complex dose entry
 I 'PSODLERF,PSOCPXB<4 W:'PSODLQT !
 D HD Q:$G(PSODLQTC)  I PSODLERF,PSODLERX="MSG" W:'PSODLQT ! D HD Q:$G(PSODLQTC)  I 'PSODLERF W:'PSODLQT !
 S PSODLERF=1 D HD Q:$G(PSODLQTC)  I PSODLERZ W:'PSODLQT !
 D HD Q:$G(PSODLQTC)  W:'PSODLQT !
 N X,DIWL,DIWR,DIWF,PSODELXR,PSODELXF S X=PSODLERB,DIWL=1,DIWR=$S(PSODLERX="MSG":76,1:74) K ^UTILITY($J,"W") D ^DIWP
 S PSODELXF=0 F PSODELXR=0:0 S PSODELXR=$O(^UTILITY($J,"W",DIWL,PSODELXR)) Q:'PSODELXR  D HD Q:$G(PSODLQTC)  W:PSODELXF&('PSODLQT) ! D HD Q:$G(PSODLQTC)  D
 .W:'PSODLQT $S(PSODLERX="MSG":"   ",1:"     ")_$G(^UTILITY($J,"W",DIWL,PSODELXR,0)) S (PSODLERR,PSODOSER,PSODLEXR,PSOERROR)=1 D SFD
 S PSOLASTD(PSOLASTS)=1,PSONFRNF=1
 Q
 ;
ERRNEW ;write dosing errors for finish, new, copy, renewal and verify
 D HD Q:$G(PSODLQTC)  I PSODLERF,PSODLERX="MSG" W:'PSODLQT ! D HD Q:$G(PSODLQTC)
 I $L(PSODLERB)>76&(PSOCPXB>1)  S PSODLERL=1
 I 'PSODLERF,PSOCPXB<4 W:'PSODLQT !
 S PSODLERF=1 D HD Q:$G(PSODLQTC)  I PSODLERZ W:'PSODLQT !
 D HD Q:$G(PSODLQTC)  W:'PSODLQT&(PSODLECT>1) ! N X,DIWL,DIWR,DIWF,PSODELXR,PSODELXF
 D:PSOCPXC HD D:'PSOCPXF&(PSOCPXC)
 .Q:$G(PSORENWD)&(PSOCPXB<4)  D SUMM^PSODOSUT
 D HD Q:$G(PSODLQTC)  S PSOCPXG=$P(PSODLNN1,";",4) I '$G(PSOCPXRR(PSOCPXG))&(PSOCPXB>1) D PSOORI,SUB^PSODOSUT W:'PSODLQT&('PSODLERZ) !
 D HD Q:$G(PSODLQTC)  W:'PSODLQT&(PSODLECT'>1)&(PSODLERX="TEXT") ! S X=PSODLERB,DIWL=1,DIWR=$S(PSODLERX="MSG":76,1:74) K ^UTILITY($J,"W") D ^DIWP
 S PSODELXF=0 F PSODELXR=0:0 S PSODELXR=$O(^UTILITY($J,"W",DIWL,PSODELXR)) Q:'PSODELXR  D HD Q:$G(PSODLQTC)  W:PSODELXF&('PSODLQT) ! D HD Q:$G(PSODLQTC)  D
 .W:'PSODLQT $S(PSODLERX="MSG":"   ",1:"     ")_$G(^UTILITY($J,"W",DIWL,PSODELXR,0)) S (PSODLERR,PSODOSER,PSODLEXR,PSOERROR)=1 D SFD
 S PSOLASTD(PSOLASTS)=1,PSONFRNF=1
 Q
 ;
SFD ;
 S PSODELXF=1 S:PSODLERX="TEXT" PSODLERZ=1
 Q
 ;
EXCEPT ;format and write exceptions
 I PSODTYPE="E" S (PSODLERZ)=0
 I $G(PSODOSER),PSODTYPE="N",PSODMESX,PSODMESG W !
 I $G(PSODOSER) K PSODOSER I PSODMESX,'PSODMESG W ! ;line feed between error and exceptions
 I PSODTYPE="N" D HD Q:$G(PSODLQTC)  W:PSODLERF&('PSODLQT)&('PSODMESX)&('PSODMESM) ! S PSODLERZ=0
 I PSODTYPE="C"  D:PSOCPXC HD W:PSODLERF&(PSOCPXC)&('PSODLQT)&('PSODMESX)&('PSODMESM)&('$G(PSODLWW)) ! S (PSODLERZ,PSODLESM)=0
 F PSODLERA=0:0 S PSODLERA=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"EXCEPTIONS",PSODLERA)) Q:'PSODLERA  D
 .S PSODLERB=$G(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"EXCEPTIONS",PSODLERA))
 .I PSODTYPE="N" D SBAD^PSODOSUT
 .I PSODTYPE="E"!(PSODTYPE="C") D SBAD^PSODOSUT:PSODLERB'=""
 .Q:PSODLERB=""  I PSODTYPE'="C" D HD Q:$G(PSODLQTC)
 .S (PSODLERF,PSODLALZ)=1
 .;write exceptions for new, copy, renew, verify
 .I PSODTYPE="N" D  Q
 ..D HD Q:$G(PSODLQTC)  I 'PSOCPXF&(PSOCPXC) D
 ...Q:$G(PSORENWD)&(PSOCPXB<4)  D SUMM^PSODOSUT
 ..I 'PSODLERF W:'PSODLQT&('$G(PSODLWW)) ! D HD Q:$G(PSODLQTC)  S PSODLWW=0
 ..S PSOCPXG=$P(PSODLNN1,";",4)
 ..I '$G(PSOCPXRR(PSOCPXG)),PSOCPXB>1 W:'PSODLQT&(PSODLERZ) ! D PSOORI,SUB^PSODOSUT
 ..D HD Q:$G(PSODLQTC)  W:'PSODLQT&('$G(PSODLWW)) ! S PSODLWW=0
 ..D WRITEXC
 .;write dosing exceptions for edits or display during complex dose entry
 .I PSODTYPE="E" D
 ..I PSODLERB["please complete a manual check for appropriate Dosing" S PSODCONT=1
 ..D HD Q:$G(PSODLQTC)  W:'PSODLQT&('$G(PSODLWW)) ! S PSODLWW=0
 ..D WRITEXC
 .;write exceptions for complex orders
 .I PSODTYPE="C"&(PSOCPXB>3) D
 ..D:PSOCPXC HD I 'PSODLERF&('$G(PSODLWW)) W:'PSODLQT&(PSOCPXC) !
 ..D:PSOCPXC
 ...D HD Q:$G(PSODLQTC)  I 'PSOCPXF&(PSOCPXC) D
 ....Q:$G(PSORENWD)&(PSOCPXB<4)  D SUMM^PSODOSUT
 ...S PSOCPXG=$P(PSODLNN1,";",4) I PSOCPXC&('$G(PSOCPXRR(PSOCPXG))) D HD Q:$G(PSODLQTC)  W:'PSODLQT&(PSOCPXC)&(PSODLESM)&('$G(PSODLWW)) ! D PSOORI,SUB^PSODOSUT
 ...S PSODLESM=1 D HD Q:$G(PSODLQTC)  W:'PSODLQT&('$G(PSODLWW)) !
 ...D:PSOCPXC WRITEXC
 Q
 ;
WRITEXC ;format and write exception messages to the screen
 D WRITEXC^PSODOSU4 Q
 ;
MESSAGE ;format and write messages
 I PSODTYPE="N",$$FEED^PSODOSUT D HD Q:$G(PSODLQTC)  W:'PSODLQT !
 I $G(PSODLERZ)&('PSODLQT)&(PSODTYPE'="N") W !  ;line feed for transition between exceptions to messages
 I PSODTYPE="C" I $$FEED^PSODOSUT&(PSOCPXC) D HD Q:$G(PSODLQTC)  W:'PSODLQT !
 S PSODLPL="" F  S PSODLPL=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE",PSODLPL)) Q:PSODLPL=""  D
 .;Add a line feed if there are just Single and General dosing messages
 .I PSODLPL="3_GENERAL" D
 ..I PSODTYPE="N" D  Q
 ...I PSODLINS,'PSODLINR,'PSODLINX W ! Q
 ...I 'PSODLINS,'PSODLINR,'PSODLINX W !!
 ..W !
 .I PSODLPL=".1_INTRO" D
 ..S PSOINTRO="1^"_$G(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE",".1_INTRO"))
 ..I $P(PSOINTRO,U,2)="" S PSOINTRO=0
 .F PSODLP1=0:0 S PSODLP1=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE",PSODLPL,PSODLP1)) Q:'PSODLP1  D
 ..I PSODTYPE'="C",PSODLPL="3_GENERAL" D GENERAL Q
 ..S PSODLMSG=$G(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE",PSODLPL,PSODLP1))
 ..Q:PSODLMSG=""
 ..I 'PSODLERF W:'PSODLQT&('$G(PSODLWW)) ! D HD Q:$G(PSODLQTC)
 ..S PSODLERF=1
 ..I PSODTYPE'="C" D HD Q:$G(PSODLQTC)  I 'PSODLQT,'$G(PSODLWW),$G(PSODLERR),'PSORLNF W ! S PSORLNF=1
 ..I PSODTYPE="C" D  Q:'PSODLQT&(PSOCPXC)&(PSODLESM)  I PSOCPXF&(PSOCPXC) K PSODAILY
 ...D:PSOCPXC HD I '$G(PSODLFLG) W:'PSODLQT&(PSOCPXC)&(PSOCPXF)&('$G(PSODLWW)) !
 ...S PSODLFLG=1 S PSODLEXR=0
 ..I PSODTYPE'="E" S PSODLEXR=0
 ..S PSODLFLG=1 S:PSODLPL="1_SINGLE" PSODLINS=1 S:PSODLPL="2_RANGE" PSODLINR=1 S:PSODLPL="1_SINGLE_RANGE" PSODLINX=1
 ..I PSODTYPE="N" S PSODLFLG=1 D MSGN
 ..I PSODTYPE="E" S PSODLFLG=1 D WRITMSG
 ..I PSODTYPE="C"&(PSOCPXB>3) D MSGC
 .I PSODLPL="4_TRAIL",PSODTYPE="E"!(PSODTYPE="N") D
 ..S PSODLMSG=$G(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE","4_TRAIL"))
 ..D WRITMSG
 Q
 ;
MSGN ;write dosing message for new, copy, renew, and verify
 I 'PSOCPXF&(PSOCPXC)&($G(PSOCPXB)>3) S PSOCPXG=$P(PSODLNN1,";",4) D  K PSODAILY S:PSOCPXC&(PSOCPXG=PSOCPXB) PSOCPXH=1
 .Q:$G(PSORENWD)&(PSOCPXB<4)  D SUMM^PSODOSUT
 S PSOCPXG=$P(PSODLNN1,";",4) D HD Q:$G(PSODLQTC)  D:'$G(PSOCPXRR(PSOCPXG))&(PSOCPXB>1) PSOORI,SUB^PSODOSUT D
 .I $G(PSOCPXRR(PSOCPXG))&$P(PSODLNN1,";",5)'="" K PSODAILY
 .I PSODLPL="2_RANGE",'$G(PSODAILY) D DAILY^PSODOSUT I PSOCPXG'=PSOCPXB K PSODAILY
 .I PSODLPL="1_SINGLE_RANGE",'$G(PSODAILY) D DAILY^PSODOSUT I PSOCPXG'=PSOCPXB K PSODAILY
 .D HD Q:$G(PSODLQTC)  D WRITMSG,HD Q:$G(PSODLQTC)
 Q
 ;
MSGC ;write dosing message for edits or display during complex dose entry
 Q:'PSODLQT&(PSOCPXC)&(PSODLESM)  I PSOCPXF&(PSOCPXC) K PSODAILY
 D:PSOCPXC HD Q:$G(PSODLQTC)
 I 'PSOCPXF&(PSOCPXC) S PSOCPXG=$P(PSODLNN1,";",4) D  K PSODAILY S:PSOCPXC&(PSOCPXG=PSOCPXB) PSOCPXH=1
 .Q:$G(PSORENWD)&(PSOCPXB<4)  D SUMM^PSODOSUT
 I PSOCPXC S PSOCPXG=$P(PSODLNN1,";",4) D HD Q:$G(PSODLQTC)  D
 .I $G(PSOCPXRR(PSOCPXG))&$P(PSODLNN1,";",5)'="" K PSODAILY
 .I '$G(PSOCPXRR(PSOCPXG))&('$G(PSOCPXH)) D PSOORI,SUB^PSODOSUT I $G(PSOCOPY)!($G(PSORENW)) S:PSOCPXC&(PSOCPXG=PSOCPXB) PSOCPXH=1
 .I PSODLPL="2_RANGE"&PSODLINR&'$G(PSODAILY) D DAILY^PSODOSUT
 .I PSODLPL="1_SINGLE_RANGE"&PSODLINX&'$G(PSODAILY) D DAILY^PSODOSUT
 .D WRITMSG
 Q
 ;
WRITMSG ;
 W:'PSODLQT&('$G(PSODLWW)) ! S PSODLWW=0
 N X,DIWL,DIWR,DIWF
 IF +$G(PSOINTRO),'$G(PSOOFL) D
 .S X=$P(PSOINTRO,U,2),DIWL=1,DIWR=76 K ^UTILITY($J,"W") D ^DIWP
 .D WRITMSG1
 .W !
 .S $P(PSOINTRO,U)=0
 S X=PSODLMSG,DIWL=1,DIWR=76 K ^UTILITY($J,"W") D ^DIWP
 D WRITMSG1
 K ^UTILITY($J,"W") D HD Q:$G(PSODLQTC)
 I PSODTYPE="E",'PSODLQT S PSODELNX=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1)) I '$P($G(PSODELNX),";",5) W !
 I PSODTYPE="C"!(PSODTYPE="N"),'PSODLQT D
 .D HD Q:$G(PSODLQTC)  S PSODELNX=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1)) I '$P($G(PSODELNX),";",5)!($P($G(PSODELNX),";",4)'=PSOCPXG) W ! S PSOLASTD(PSOLASTS)=3
 Q
 ;
WRITMSG1 ;
 N PSODELXR,PSODELXF,PSOSPACE
 S PSODELXF=0
 S PSOSPACE="   "
 I +$G(PSOINTRO),'$G(PSOOFL) S PSOSPACE=""
 F PSODELXR=0:0 S PSODELXR=$O(^UTILITY($J,"W",DIWL,PSODELXR)) Q:'PSODELXR  D
 .D HD Q:$G(PSODLQTC)  W:PSODELXF&('PSODLQT) ! W:'PSODLQT PSOSPACE_$G(^UTILITY($J,"W",DIWL,PSODELXR,0)) S (PSODLFLG,PSODELXF,PSONFRNF,PSOWMSG,PSODLEXR)=1
 I $G(PSODLFLG)&($G(PSOCPXC))&($G(PSOCPXB)>3)!(PSODTYPE="C"&(PSOCPXB>3)) W !
 Q
 ;
WRTINTRO ;
 N PSODELXR
 F PSODELXR=0:0 S PSODELXR=$O(^UTILITY($J,"W",DIWL,PSODELXR)) Q:'PSODELXR!($G(PSODLQTC))  D
 .D HD Q:$G(PSODLQTC)  W $G(^UTILITY($J,"W",DIWL,PSODELXR,0))
 .I PSODLPL'="3_GENERAL" W !
 .S $P(PSOINTRO,U)=0
 Q
 ;
GENERAL ;general dosing range information
 N PSODLERC,PSODLP2
 I +$G(PSOINTRO) D
 .S X=$P(PSOINTRO,U,2),DIWL=4,DIWR=76 K ^UTILITY($J,"W") D ^DIWP
 .D WRTINTRO
 F PSODLP2=0:0 S PSODLP2=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE",PSODLPL,PSODLP1,PSODLP2)) Q:'PSODLP2!($G(PSORX("DFLG")))  D
 .S PSODLERC="",PSODLERC=$G(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE",PSODLPL,PSODLP1,PSODLP2))
 .Q:PSODLERC=""
 .D HD Q:$G(PSODLQTC)
 .;I 'PSODLQT,'$G(PSOEDIT) W !
 .N X,DIWL,DIWR,DIWF,DIWL,PSODELXR,PSODELXF S PSODLEXR=1
 .S DIWL=4,DIWR=76 K ^UTILITY($J,"W")
 .S X=PSODLERC D ^DIWP
 .S PSODELXF=0 F PSODELXR=0:0 S PSODELXR=$O(^UTILITY($J,"W",DIWL,PSODELXR)) Q:'PSODELXR  D HD Q:$G(PSODLQTC)  W:PSODELXF&('PSODLQT) ! D HD Q:$G(PSODLQTC)  W:'PSODLQT "   "_$G(^UTILITY($J,"W",DIWL,PSODELXR,0)) S (PSODELXF,PSODLERZ,PSONFRNF)=1
 .S PSOLASTD(PSOLASTS)=3
 .I '$D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE","1_SINGLE")),'$D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE","2_RANGE")),'$D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE","1_SINGLE_RANGE")) D
 ..I +$G(PSOEXCPT)!(+$G(PSOERROR)) S PSOGENF=1
 .K ^UTILITY($J,"W")
 .W !
 Q
 ;
HD ;
 S:'$G(PSODLQT) PSODLQT=""
 I PSODLQT!(($Y+3)<IOSL)!($G(PSORX("DFLG"))) Q
 W:$G(PSORENWD) !
HD2 ;
 N DIR,DTOUT,DUOUT,DIRUT,DIROUT,X,Y
 K DIR,Y S DIR(0)="E",DIR("A")="Press Return to continue,'^' to exit" D ^DIR K DIR
 I $G(PSOCPXC)&($D(DIRUT)!($D(DUOUT))) S PSODLQTC=1 W @IOF W ! Q  ;user ^'s
 I 'Y!($D(DTOUT))!($D(DUOUT))!($G(DIRUT)) S PSODLQT=1,PSORX("DFLG")=1 Q
 W @IOF W !
 S PSOOFL="" D:$G(PSODELXR) PSOORI W:$G(PSOOFL) !
 Q
 ;
PSOORI ;**writes per orifice intro text to the screen for dosing check summary**
 I +$G(PSOINTRO),'$G(PSOOFL) D
 .W ?3,$P(PSOINTRO,U,2),!
 .S $P(PSOINTRO,U)=0,PSOOFL=1
 Q
 ;
SETV ; Set variables indicating what messages exist
 S (PSODMESE,PSODMESX,PSODMESG,PSODMEST,PSODMESH,PSODMESM)=0
 I $D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"ERROR")) S PSODMESE=1
 I $D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"EXCEPTIONS")) S PSODMESX=1
 I $D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE")) S PSODMESM=1
 I $D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE","3_GENERAL")) S PSODMESG=1
 I $D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE","4_TRAIL")) S PSODMEST=1
 D
 .I $D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE","1_SINGLE")) S PSODMESH=1 Q
 .I $D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE","2_RANGE")) S PSODMESH=1 Q
 .I $D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE","1_SINGLE_RANGE")) S PSODMESH=1
 Q