PSOSD3 ;BHAM ISC/RTR - Prints pending orders on action profile ;11/20/95
;;7.0;OUTPATIENT PHARMACY;**2,19,107,110,132,233,258,326,500**;DEC 1997;Build 9
;External reference ^PS(50.7 - 2223
;External reference ^PS(50.606 - 2174
;External reference ^PSDRUG( - 221
;External reference ^PS(59.7 - 694
;External reference to ^PS(55 - 2228
;
START Q:$D(DUOUT)!($D(DTOUT))!('$G(DFN))
N MMM,PNDIS,PNDLINE,PNDREX,PNPOI,PPPP,PSOPRVD,PSCONT,PSOEFF,PSOQTY,PSOREFLS,PZSTAT,WWW
D ELIG^PSOSD1,DEM^VADPT,INP^VADPT,ADD^VADPT,PID^VADPT S PSSN=VA("PID"),ADDRFL=$S(+VAPA(9):"Temporary ",1:"")
S PSNAME=$E(VADM(1),1,28),PSDOB=$P(VADM(3),"^",2)
K ^TMP($J,"PSOPEND") S $P(PNDLINE,"-",33)=""
S PSCONT=1 F MMM=0:0 S MMM=$O(^PS(52.41,"P",DFN,MMM)) Q:'MMM S PZSTAT=$P($G(^PS(52.41,MMM,0)),"^",3) I PZSTAT="NW"!(PZSTAT="HD")!(PZSTAT="RNW") D
.S ^TMP($J,"PSOPEND",PSCONT)=MMM_"^"_$S(+$P($G(^PS(52.41,MMM,0)),"^",9):"DD",1:"OI") S PSCONT=PSCONT+1
I $Y+6>IOSL D HD1 S:$D(DTOUT)!($D(DUOUT)) PSQFLG=1 G:$G(PSQFLG) END
D HD
I PSCONT=1 W !?10,"No pending orders for this patient!",! G END
F WWW=0:0 S WWW=$O(^TMP($J,"PSOPEND",WWW)) Q:'WWW!($G(PSQFLG)) D
.S PNDREX=$P(^TMP($J,"PSOPEND",WWW),"^"),PNDIS=$P($G(^PS(52.41,PNDREX,0)),"^",9),PNPOI=$P($G(^(0)),"^",8),PSOEFF=$P($G(^(0)),"^",6),PSOQTY=$P($G(^(0)),"^",10),PSOREFLS=$P($G(^(0)),"^",11),PSOPRVD=$P($G(^(0)),"^",5)
.W !,"Drug: ",$S($P(^TMP($J,"PSOPEND",WWW),"^",2)="DD":$P($G(^PSDRUG(+PNDIS,0)),"^"),1:$P($G(^PS(50.7,+PNPOI,0)),"^")_" "_$P($G(^PS(50.606,+$P($G(^(0)),"^",2),0)),"^")),!
.W ?1,"Eff. Date: ",$E(PSOEFF,4,5)_"-"_$E(PSOEFF,6,7)_"-"_($E(PSOEFF,1,3)+1700),?22,"Qty: ",PSOQTY,?40,"Refills: ",PSOREFLS,?52,"Prov: ",$E($P($G(^VA(200,+PSOPRVD,0)),"^"),1,21)
.S PSCONT=1 W !?1,"Sig: " F PPPP=0:0 S PPPP=$O(^PS(52.41,PNDREX,"SIG",PPPP)) Q:'PPPP!($G(PSQFLG)) W:PSCONT>1 ! W ?6,$G(^PS(52.41,PNDREX,"SIG",PPPP,0)) S PSCONT=PSCONT+1
.I $E(IOST)'="C" W !
.I $E(IOST)="C" D HD1 S:$D(DUOUT)!($D(DTOUT)) PSQFLG=1 Q:$G(PSQFLG) D HD
.I $E(IOST)'="C" I $Y+9>IOSL D HD1 S:$D(DUOUT)!($D(DTOUT)) PSQFLG=1 Q:$G(PSQFLG) D HD
END K ^TMP($J,"PSOPEND") Q
HD W !,PNDLINE,"PENDING ORDERS",PNDLINE,! Q
;
HD1 S FN=DFN
I $E(IOST)="C" K DIR S DIR(0)="E",DIR("A")="Press Return to Continue or ""^"" to Exit" D ^DIR Q:$D(DUOUT)!($D(DTOUT))
D ELIG^PSOSD1,DEM^VADPT,INP^VADPT,ADD^VADPT,PID^VADPT S PSSN=VA("PID"),ADDRFL=$S(+VAPA(9):"Temporary ",1:"")
S PSNAME=$E(VADM(1),1,28),PSDOB=$P(VADM(3),"^",2)
I $D(IOF) W @IOF
W $S(PSTYPE:"Action",1:"Informational")_" Rx Profile",?47,"Run Date: " S Y=DT D DT^DIO2 W ?71,"Page: "_PAGE
W !,"Sorted by drug classification for Rx's currently active"_$S('PSDAYS:" only.",1:"") W:PSDAYS !,"and for those Rx's that have been inactive less than "_PSDAYS_" days."
S X=$$SITE^VASITE
W @$S(PSORM:"?70",1:"!"),"Site: VAMC "_$P(X,"^",2)_" ("_$P(X,"^",3)_")",!,$E(LINE,1,$S('PSORM:80,1:IOM)-1)
I $P(VAIN(4),"^",2)]"",+$P($G(^PS(59.7,1,40.1)),"^") W !,"Outpatient prescriptions are discontinued 72 hours after admission.",!
I $D(CLINICX) W !?1,"Clinic: "_$E(CLINICX,1,28),?45,"Date/Time: " S Y=CLDT D DT^DIO2
W !?1,"Name : ",PSNAME W:PSTYPE ?58,"Action Date: ________" W !?1,"DOB : "_PSDOB
W:ADDRFL]"" ?30,ADDRFL,! W ?30,"Address :"
I $G(ADDRFL)="" D CHECKBAI^PSOSD1
W ?41,VAPA(1) W:VAPA(2)]"" !?41,VAPA(2) W:VAPA(3)]"" !?41,VAPA(3)
W !?41,VAPA(4)_", "_$P(VAPA(5),"^",2)_" "_$S(VAPA(11)]"":$P(VAPA(11),"^",2),1:VAPA(6)),!?30,"Phone : "_VAPA(8)
I PSOBAR4 S X="S",X2=PSSN W @$S('PSORM:"!?30",1:"?$X+5") S X1=$X W @PSOBAR3,X2,@PSOBAR2,$C(13) S $X=0
W:$G(DOD(DFN))]"" ?1,"**** Date of Death: "_DOD(DFN)_" ****",!
S (WT,HT)="",X="GMRVUTL" X ^%ZOSF("TEST") I $T D
.F GMRVSTR="WT","HT" S VM=GMRVSTR D EN6^GMRVUTL S @VM=X,$P(@VM,"^")=$E($P(@VM,"^"),4,5)_"/"_$E($P(@VM,"^"),6,7)_"/"_($E($P(@VM,"^"),1,3)+1700)
.S X=$P(WT,"^",8),Y=$J(X/2.2046226,0,2),WT=WT_"^"_Y,X=$P(HT,"^",8),Y=$J(2.54*X,0,2),HT=HT_"^"_Y
W !!,"WEIGHT(Kg): " W:+$P(WT,"^",8) $P(WT,"^",9)_" ("_$P(WT,"^")_")" W ?41,"HEIGHT(cm): " W:$P(HT,"^",8) $P(HT,"^",9)_" ("_$P(HT,"^")_")" K VM,WT,HT
S PAGE=PAGE+1 W !,$E(LINE,1,$S('PSORM:80,1:IOM)-1)
Q
NVA ;displays non-va meds
Q:'$O(^PS(55,DFN,"NVA",0))
Q:$D(DUOUT)!($D(DTOUT))!('$G(DFN))
D HD1 S $P(PNDLINE,"-",IOM)="",PSODFN=DFN
W !,PNDLINE,!?25,"Non-VA Meds (Not dispensed by VA)",!,PNDLINE,!
F NVA=0:0 S NVA=$O(^PS(55,DFN,"NVA",NVA)) Q:'NVA D Q:$G(PSQFLG)
.I $Y+6>IOSL D HD1 S:$D(DTOUT)!($D(DUOUT)) PSQFLG=1 Q:$G(PSQFLG)
.Q:'$P(^PS(55,PSODFN,"NVA",NVA,0),"^")
.S DUPRX0=^PS(55,PSODFN,"NVA",NVA,0)
.W !,"Orderable Item: "_$P(^PS(50.7,$P(DUPRX0,"^"),0),"^")_" "_$P(^PS(50.606,$P(^(0),"^",2),0),"^")
.W !,"Drug: "_$S($P(DUPRX0,"^",2):$P(^PSDRUG($P(DUPRX0,"^",2),0),"^"),1:"No Dispense Drug Selected")
.W !,"Status: "_$S($P(DUPRX0,"^",7):"Discontinued ("_$$FMTE^XLFDT($P($P(DUPRX0,"^",7),"."))_")",1:"Active")
.W !,"Dosage: "_$P(DUPRX0,"^",3)
.W !,"Schedule: "_$P(DUPRX0,"^",5),!,"Route: "_$P(DUPRX0,"^",4)
.W !,"Start Date: "_$$FMTE^XLFDT($P(DUPRX0,"^",9)),?40,"CPRS Oder #: "_$P(DUPRX0,"^",8)
.W !,"Documented By: "_$P(^VA(200,$P(DUPRX0,"^",11),0),"^")_" on "_$$FMTE^XLFDT($P(DUPRX0,"^",10))
.S RMLEN=$S('PSORM:75,1:IOM-5)
.F I=0:0 S I=$O(^PS(55,PSODFN,"NVA",NVA,"OCK",I)) Q:'I D W !
..S ORD=$P(^PS(55,PSODFN,"NVA",NVA,"OCK",I,0),"^"),ORP=$P(^(0),"^",2)
..W !,"Order Check #"_I_": "
..K OCK,LEN I $L(ORD)>RMLEN S (LEN,IEN)=1 D
...F SG=1:1:$L(ORD) S:$L($G(OCK(IEN))_" "_$P(ORD," ",SG))>RMLEN&($P(ORD," ",SG)]"") IEN=IEN+1 S:$P(ORD," ",SG)'="" OCK(IEN)=$G(OCK(IEN))_" "_$P(ORD," ",SG)
...F II=0:0 S II=$O(OCK(II)) Q:'II W !?5,OCK(II)
..W:'$G(LEN) ORD K LEN,SG,IEN,II,OCK,ORD
..W !,"Overriding Provider: "_$S($G(ORP):$P(^VA(200,ORP,0),"^"),1:"")
..K ORP,OCK,REA W !,"Reason:" F SS=0:0 S SS=$O(^PS(55,PSODFN,"NVA",NVA,"OCK",I,"OVR",SS)) Q:'SS S REA(SS)=^PS(55,PSODFN,"NVA",NVA,"OCK",I,"OVR",SS,0)
..S IEN=1 F II=0:0 S II=$O(REA(II)) Q:'II D
...F SG=1:1:$L(REA(II)) S:$L($G(OCK(IEN))_" "_$P(REA(II)," ",SG))>RMLEN&($P(REA(II)," ",SG)]"") IEN=IEN+1 S:$P(REA(II)," ",SG)'="" OCK(IEN)=$G(OCK(IEN))_" "_$P(REA(II)," ",SG)
...K REA,IEN,SG F II=0:0 S II=$O(OCK(II)) Q:'II W OCK(II) I $O(OCK(II)) W !?5
.K OCK W !,"Statement/Explanation/Comments:" F SS=0:0 S SS=$O(^PS(55,PSODFN,"NVA",NVA,"DSC",SS)) Q:'SS S DSC(SS)=^PS(55,PSODFN,"NVA",NVA,"DSC",SS,0)
.S IEN=1 F II=0:0 S II=$O(DSC(II)) Q:'II D
..F SG=1:1:$L(DSC(II)) S:$L($G(OCK(IEN))_" "_$P(DSC(II)," ",SG))>RMLEN&($P(DSC(II)," ",SG)]"") IEN=IEN+1 S:$P(DSC(II)," ",SG)'="" OCK(IEN)=$G(OCK(IEN))_" "_$P(DSC(II)," ",SG)
.K IEN,DSC,SG F II=0:0 S II=$O(OCK(II)) Q:'II W !?5,OCK(II)
.W !! I $E(IOST)'="C" W !
K RMLEN
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOSD3 6671 printed Nov 22, 2024@17:44:46 Page 2
PSOSD3 ;BHAM ISC/RTR - Prints pending orders on action profile ;11/20/95
+1 ;;7.0;OUTPATIENT PHARMACY;**2,19,107,110,132,233,258,326,500**;DEC 1997;Build 9
+2 ;External reference ^PS(50.7 - 2223
+3 ;External reference ^PS(50.606 - 2174
+4 ;External reference ^PSDRUG( - 221
+5 ;External reference ^PS(59.7 - 694
+6 ;External reference to ^PS(55 - 2228
+7 ;
START if $DATA(DUOUT)!($DATA(DTOUT))!('$GET(DFN))
QUIT
+1 NEW MMM,PNDIS,PNDLINE,PNDREX,PNPOI,PPPP,PSOPRVD,PSCONT,PSOEFF,PSOQTY,PSOREFLS,PZSTAT,WWW
+2 DO ELIG^PSOSD1
DO DEM^VADPT
DO INP^VADPT
DO ADD^VADPT
DO PID^VADPT
SET PSSN=VA("PID")
SET ADDRFL=$SELECT(+VAPA(9):"Temporary ",1:"")
+3 SET PSNAME=$EXTRACT(VADM(1),1,28)
SET PSDOB=$PIECE(VADM(3),"^",2)
+4 KILL ^TMP($JOB,"PSOPEND")
SET $PIECE(PNDLINE,"-",33)=""
+5 SET PSCONT=1
FOR MMM=0:0
SET MMM=$ORDER(^PS(52.41,"P",DFN,MMM))
if 'MMM
QUIT
SET PZSTAT=$PIECE($GET(^PS(52.41,MMM,0)),"^",3)
IF PZSTAT="NW"!(PZSTAT="HD")!(PZSTAT="RNW")
Begin DoDot:1
+6 SET ^TMP($JOB,"PSOPEND",PSCONT)=MMM_"^"_$SELECT(+$PIECE($GET(^PS(52.41,MMM,0)),"^",9):"DD",1:"OI")
SET PSCONT=PSCONT+1
End DoDot:1
+7 IF $Y+6>IOSL
DO HD1
if $DATA(DTOUT)!($DATA(DUOUT))
SET PSQFLG=1
if $GET(PSQFLG)
GOTO END
+8 DO HD
+9 IF PSCONT=1
WRITE !?10,"No pending orders for this patient!",!
GOTO END
+10 FOR WWW=0:0
SET WWW=$ORDER(^TMP($JOB,"PSOPEND",WWW))
if 'WWW!($GET(PSQFLG))
QUIT
Begin DoDot:1
+11 SET PNDREX=$PIECE(^TMP($JOB,"PSOPEND",WWW),"^")
SET PNDIS=$PIECE($GET(^PS(52.41,PNDREX,0)),"^",9)
SET PNPOI=$PIECE($GET(^(0)),"^",8)
SET PSOEFF=$PIECE($GET(^(0)),"^",6)
SET PSOQTY=$PIECE($GET(^(0)),"^",10)
SET PSOREFLS=$PIECE($GET(^(0)),"^",11)
SET PSOPRVD=$PIECE($GET(^(0)),"^",5)
+12 WRITE !,"Drug: ",$SELECT($PIECE(^TMP($JOB,"PSOPEND",WWW),"^",2)="DD":$PIECE($GET(^PSDRUG(+PNDIS,0)),"^"),1:$PIECE($GET(^PS(50.7,+PNPOI,0)),"^")_" "_$PIECE($GET(^PS(50.606,+$PIECE($GET(^(0)),"^",2),0)),"^")),!
+13 WRITE ?1,"Eff. Date: ",$EXTRACT(PSOEFF,4,5)_"-"_$EXTRACT(PSOEFF,6,7)_"-"_($EXTRACT(PSOEFF,1,3)+1700),?22,"Qty: ",PSOQTY,?40,"Refills: ",PSOREFLS,?52,"Prov: ",$EXTRACT($PIECE($GET(^VA(200,+PSOPRVD,0)),"^"),1,21)
+14 SET PSCONT=1
WRITE !?1,"Sig: "
FOR PPPP=0:0
SET PPPP=$ORDER(^PS(52.41,PNDREX,"SIG",PPPP))
if 'PPPP!($GET(PSQFLG))
QUIT
if PSCONT>1
WRITE !
WRITE ?6,$GET(^PS(52.41,PNDREX,"SIG",PPPP,0))
SET PSCONT=PSCONT+1
+15 IF $EXTRACT(IOST)'="C"
WRITE !
+16 IF $EXTRACT(IOST)="C"
DO HD1
if $DATA(DUOUT)!($DATA(DTOUT))
SET PSQFLG=1
if $GET(PSQFLG)
QUIT
DO HD
+17 IF $EXTRACT(IOST)'="C"
IF $Y+9>IOSL
DO HD1
if $DATA(DUOUT)!($DATA(DTOUT))
SET PSQFLG=1
if $GET(PSQFLG)
QUIT
DO HD
End DoDot:1
END KILL ^TMP($JOB,"PSOPEND")
QUIT
HD WRITE !,PNDLINE,"PENDING ORDERS",PNDLINE,!
QUIT
+1 ;
HD1 SET FN=DFN
+1 IF $EXTRACT(IOST)="C"
KILL DIR
SET DIR(0)="E"
SET DIR("A")="Press Return to Continue or ""^"" to Exit"
DO ^DIR
if $DATA(DUOUT)!($DATA(DTOUT))
QUIT
+2 DO ELIG^PSOSD1
DO DEM^VADPT
DO INP^VADPT
DO ADD^VADPT
DO PID^VADPT
SET PSSN=VA("PID")
SET ADDRFL=$SELECT(+VAPA(9):"Temporary ",1:"")
+3 SET PSNAME=$EXTRACT(VADM(1),1,28)
SET PSDOB=$PIECE(VADM(3),"^",2)
+4 IF $DATA(IOF)
WRITE @IOF
+5 WRITE $SELECT(PSTYPE:"Action",1:"Informational")_" Rx Profile",?47,"Run Date: "
SET Y=DT
DO DT^DIO2
WRITE ?71,"Page: "_PAGE
+6 WRITE !,"Sorted by drug classification for Rx's currently active"_$SELECT('PSDAYS:" only.",1:"")
if PSDAYS
WRITE !,"and for those Rx's that have been inactive less than "_PSDAYS_" days."
+7 SET X=$$SITE^VASITE
+8 WRITE @$SELECT(PSORM:"?70",1:"!"),"Site: VAMC "_$PIECE(X,"^",2)_" ("_$PIECE(X,"^",3)_")",!,$EXTRACT(LINE,1,$SELECT('PSORM:80,1:IOM)-1)
+9 IF $PIECE(VAIN(4),"^",2)]""
IF +$PIECE($GET(^PS(59.7,1,40.1)),"^")
WRITE !,"Outpatient prescriptions are discontinued 72 hours after admission.",!
+10 IF $DATA(CLINICX)
WRITE !?1,"Clinic: "_$EXTRACT(CLINICX,1,28),?45,"Date/Time: "
SET Y=CLDT
DO DT^DIO2
+11 WRITE !?1,"Name : ",PSNAME
if PSTYPE
WRITE ?58,"Action Date: ________"
WRITE !?1,"DOB : "_PSDOB
+12 if ADDRFL]""
WRITE ?30,ADDRFL,!
WRITE ?30,"Address :"
+13 IF $GET(ADDRFL)=""
DO CHECKBAI^PSOSD1
+14 WRITE ?41,VAPA(1)
if VAPA(2)]""
WRITE !?41,VAPA(2)
if VAPA(3)]""
WRITE !?41,VAPA(3)
+15 WRITE !?41,VAPA(4)_", "_$PIECE(VAPA(5),"^",2)_" "_$SELECT(VAPA(11)]"":$PIECE(VAPA(11),"^",2),1:VAPA(6)),!?30,"Phone : "_VAPA(8)
+16 IF PSOBAR4
SET X="S"
SET X2=PSSN
WRITE @$SELECT('PSORM:"!?30",1:"?$X+5")
SET X1=$X
WRITE @PSOBAR3,X2,@PSOBAR2,$CHAR(13)
SET $X=0
+17 if $GET(DOD(DFN))]""
WRITE ?1,"**** Date of Death: "_DOD(DFN)_" ****",!
+18 SET (WT,HT)=""
SET X="GMRVUTL"
XECUTE ^%ZOSF("TEST")
IF $TEST
Begin DoDot:1
+19 FOR GMRVSTR="WT","HT"
SET VM=GMRVSTR
DO EN6^GMRVUTL
SET @VM=X
SET $PIECE(@VM,"^")=$EXTRACT($PIECE(@VM,"^"),4,5)_"/"_$EXTRACT($PIECE(@VM,"^"),6,7)_"/"_($EXTRACT($PIECE(@VM,"^"),1,3)+1700)
+20 SET X=$PIECE(WT,"^",8)
SET Y=$JUSTIFY(X/2.2046226,0,2)
SET WT=WT_"^"_Y
SET X=$PIECE(HT,"^",8)
SET Y=$JUSTIFY(2.54*X,0,2)
SET HT=HT_"^"_Y
End DoDot:1
+21 WRITE !!,"WEIGHT(Kg): "
if +$PIECE(WT,"^",8)
WRITE $PIECE(WT,"^",9)_" ("_$PIECE(WT,"^")_")"
WRITE ?41,"HEIGHT(cm): "
if $PIECE(HT,"^",8)
WRITE $PIECE(HT,"^",9)_" ("_$PIECE(HT,"^")_")"
KILL VM,WT,HT
+22 SET PAGE=PAGE+1
WRITE !,$EXTRACT(LINE,1,$SELECT('PSORM:80,1:IOM)-1)
+23 QUIT
NVA ;displays non-va meds
+1 if '$ORDER(^PS(55,DFN,"NVA",0))
QUIT
+2 if $DATA(DUOUT)!($DATA(DTOUT))!('$GET(DFN))
QUIT
+3 DO HD1
SET $PIECE(PNDLINE,"-",IOM)=""
SET PSODFN=DFN
+4 WRITE !,PNDLINE,!?25,"Non-VA Meds (Not dispensed by VA)",!,PNDLINE,!
+5 FOR NVA=0:0
SET NVA=$ORDER(^PS(55,DFN,"NVA",NVA))
if 'NVA
QUIT
Begin DoDot:1
+6 IF $Y+6>IOSL
DO HD1
if $DATA(DTOUT)!($DATA(DUOUT))
SET PSQFLG=1
if $GET(PSQFLG)
QUIT
+7 if '$PIECE(^PS(55,PSODFN,"NVA",NVA,0),"^")
QUIT
+8 SET DUPRX0=^PS(55,PSODFN,"NVA",NVA,0)
+9 WRITE !,"Orderable Item: "_$PIECE(^PS(50.7,$PIECE(DUPRX0,"^"),0),"^")_" "_$PIECE(^PS(50.606,$PIECE(^(0),"^",2),0),"^")
+10 WRITE !,"Drug: "_$SELECT($PIECE(DUPRX0,"^",2):$PIECE(^PSDRUG($PIECE(DUPRX0,"^",2),0),"^"),1:"No Dispense Drug Selected")
+11 WRITE !,"Status: "_$SELECT($PIECE(DUPRX0,"^",7):"Discontinued ("_$$FMTE^XLFDT($PIECE($PIECE(DUPRX0,"^",7),"."))_")",1:"Active")
+12 WRITE !,"Dosage: "_$PIECE(DUPRX0,"^",3)
+13 WRITE !,"Schedule: "_$PIECE(DUPRX0,"^",5),!,"Route: "_$PIECE(DUPRX0,"^",4)
+14 WRITE !,"Start Date: "_$$FMTE^XLFDT($PIECE(DUPRX0,"^",9)),?40,"CPRS Oder #: "_$PIECE(DUPRX0,"^",8)
+15 WRITE !,"Documented By: "_$PIECE(^VA(200,$PIECE(DUPRX0,"^",11),0),"^")_" on "_$$FMTE^XLFDT($PIECE(DUPRX0,"^",10))
+16 SET RMLEN=$SELECT('PSORM:75,1:IOM-5)
+17 FOR I=0:0
SET I=$ORDER(^PS(55,PSODFN,"NVA",NVA,"OCK",I))
if 'I
QUIT
Begin DoDot:2
+18 SET ORD=$PIECE(^PS(55,PSODFN,"NVA",NVA,"OCK",I,0),"^")
SET ORP=$PIECE(^(0),"^",2)
+19 WRITE !,"Order Check #"_I_": "
+20 KILL OCK,LEN
IF $LENGTH(ORD)>RMLEN
SET (LEN,IEN)=1
Begin DoDot:3
+21 FOR SG=1:1:$LENGTH(ORD)
if $LENGTH($GET(OCK(IEN))_" "_$PIECE(ORD," ",SG))>RMLEN&($PIECE(ORD," ",SG)]"")
SET IEN=IEN+1
if $PIECE(ORD," ",SG)'=""
SET OCK(IEN)=$GET(OCK(IEN))_" "_$PIECE(ORD," ",SG)
+22 FOR II=0:0
SET II=$ORDER(OCK(II))
if 'II
QUIT
WRITE !?5,OCK(II)
End DoDot:3
+23 if '$GET(LEN)
WRITE ORD
KILL LEN,SG,IEN,II,OCK,ORD
+24 WRITE !,"Overriding Provider: "_$SELECT($GET(ORP):$PIECE(^VA(200,ORP,0),"^"),1:"")
+25 KILL ORP,OCK,REA
WRITE !,"Reason:"
FOR SS=0:0
SET SS=$ORDER(^PS(55,PSODFN,"NVA",NVA,"OCK",I,"OVR",SS))
if 'SS
QUIT
SET REA(SS)=^PS(55,PSODFN,"NVA",NVA,"OCK",I,"OVR",SS,0)
+26 SET IEN=1
FOR II=0:0
SET II=$ORDER(REA(II))
if 'II
QUIT
Begin DoDot:3
+27 FOR SG=1:1:$LENGTH(REA(II))
if $LENGTH($GET(OCK(IEN))_" "_$PIECE(REA(II)," ",SG))>RMLEN&($PIECE(REA(II)," ",SG)]"")
SET IEN=IEN+1
if $PIECE(REA(II)," ",SG)'=""
SET OCK(IEN)=$GET(OCK(IEN))_" "_$PIECE(REA(II)," ",SG)
+28 KILL REA,IEN,SG
FOR II=0:0
SET II=$ORDER(OCK(II))
if 'II
QUIT
WRITE OCK(II)
IF $ORDER(OCK(II))
WRITE !?5
End DoDot:3
End DoDot:2
WRITE !
+29 KILL OCK
WRITE !,"Statement/Explanation/Comments:"
FOR SS=0:0
SET SS=$ORDER(^PS(55,PSODFN,"NVA",NVA,"DSC",SS))
if 'SS
QUIT
SET DSC(SS)=^PS(55,PSODFN,"NVA",NVA,"DSC",SS,0)
+30 SET IEN=1
FOR II=0:0
SET II=$ORDER(DSC(II))
if 'II
QUIT
Begin DoDot:2
+31 FOR SG=1:1:$LENGTH(DSC(II))
if $LENGTH($GET(OCK(IEN))_" "_$PIECE(DSC(II)," ",SG))>RMLEN&($PIECE(DSC(II)," ",SG)]"")
SET IEN=IEN+1
if $PIECE(DSC(II)," ",SG)'=""
SET OCK(IEN)=$GET(OCK(IEN))_" "_$PIECE(DSC(II)," ",SG)
End DoDot:2
+32 KILL IEN,DSC,SG
FOR II=0:0
SET II=$ORDER(OCK(II))
if 'II
QUIT
WRITE !?5,OCK(II)
+33 WRITE !!
IF $EXTRACT(IOST)'="C"
WRITE !
End DoDot:1
if $GET(PSQFLG)
QUIT
+34 KILL RMLEN
+35 QUIT