SRSWL11 ;B'HAM ISC/MAM - WAITING LIST, EXTENDED-ALL ; 17 OCT 1989 7:35 AM
;;3.0; Surgery ;**34**;24 Jun 93
W ! K %ZIS,POP,IOP,IO("Q") S %ZIS("A")="Print to Device: ",%ZIS="Q" D ^%ZIS Q:POP
I $D(IO("Q")) K IO("Q") S ZTDESC="SURGERY WAITING LIST",ZTRTN="BEG^SRSWL11" D ^%ZTLOAD G END
;
BEG ; entry when queued
K ^TMP("SR",$J)
U IO S (SRSOUT,SRHDR)=0 D NOW^%DTC S Y=% D D^DIQ S SRTIME=$E(Y,1,12)_" at "_$E(Y,14,18)
S SS="",ST="",SR="",SRW="",SRNAME="",SRRECNO="",SRSUB="",DFN="",SRSDPT="",SRHDR=0
;
F S SRW=$O(^SRO(133.8,"AP",SRW)) Q:SRW="" F S SRRECNO=$O(^SRO(133.8,"AP",SRW,SRRECNO)) Q:SRRECNO="" F S SRSUB=$O(^SRO(133.8,"AP",SRW,SRRECNO,SRSUB)) Q:SRSUB="" D MORE
W @IOF D HDR
;
F S SS=$O(^TMP("SR",$J,SS)) Q:SS=""!(SRSOUT) F S SR=$O(^TMP("SR",$J,SS,SR)) Q:SR=""!(SRSOUT) F S ST=$O(^TMP("SR",$J,SS,SR,ST)) Q:ST=""!(SRSOUT) D PRINT
END ;
I $E(IOST)="P" W ! S SRSOUT=1 W @IOF
I $D(ZTQUEUED) K ^TMP("SR",$J) Q:$G(ZTSTOP) S ZTREQ="@" Q
I 'SRSOUT W !!,"Press RETURN to continue " R X:DTIME W @IOF
D ^%ZISC,^SRSKILL K SRTN
Q
PRINT ; print information
S SRSDPT=SS,SRSS=SR,SROFN=ST
I $Y+20>IOSL S SRHDR=0 D PAGE S SRHDR=1 Q:SRSOUT
S SRW=^SRO(133.8,SRSS,1,SROFN,0),DFN=$P(SRW,"^",1),SROPER=$P(SRW,"^",2),(SRDT,Y)=$P(SRW,"^",3) I Y D D^DIQ S SRDT=$E(Y,1,12)_" "_$E(Y,14,18)
D OUT^SRSWL3
Q
LOOP ; break operation if greater than 59 characters
S SROPS(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROPS(M))+$L(MM)'<59 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
Q
PAGE ; end of page
I $E(IOST)'="P" W !!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
D HDR
Q
MORE S SRNAME=$P(^SRO(133.8,SRRECNO,0),"^"),SRNAME=$P(^SRO(137.45,SRNAME,0),"^")
I SRNAME=SRSNM S DFN=SRW D DEM^VADPT S SRSDPT=VADM(1)_" ("_VA("PID")_")",^TMP("SR",$J,SRSDPT,SRRECNO,SRSUB)=""
Q
;
HDR ; print heading
I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
W:$Y @IOF W !,"Surgery Waiting List sorted by Patient",!,"Surgical Specialty is "_SRSNM,!,"Printed "_SRTIME,! F LINE=1:1:80 W "="
S SRHDR=1
Q
SRSWL11 ;B'HAM ISC/MAM - WAITING LIST, EXTENDED-ALL ; 17 OCT 1989 7:35 AM
+1 ;;3.0; Surgery ;**34**;24 Jun 93
+2 WRITE !
KILL %ZIS,POP,IOP,IO("Q")
SET %ZIS("A")="Print to Device: "
SET %ZIS="Q"
DO ^%ZIS
IF POP
QUIT
+3 IF $DATA(IO("Q"))
KILL IO("Q")
SET ZTDESC="SURGERY WAITING LIST"
SET ZTRTN="BEG^SRSWL11"
DO ^%ZTLOAD
GOTO END
+4 ;
BEG ; entry when queued
+1 KILL ^TMP("SR",$JOB)
+2 USE IO
SET (SRSOUT,SRHDR)=0
DO NOW^%DTC
SET Y=%
DO D^DIQ
SET SRTIME=$EXTRACT(Y,1,12)_" at "_$EXTRACT(Y,14,18)
+3 SET SS=""
SET ST=""
SET SR=""
SET SRW=""
SET SRNAME=""
SET SRRECNO=""
SET SRSUB=""
SET DFN=""
SET SRSDPT=""
SET SRHDR=0
+4 ;
+5 FOR
SET SRW=$ORDER(^SRO(133.8,"AP",SRW))
IF SRW=""
QUIT
FOR
SET SRRECNO=$ORDER(^SRO(133.8,"AP",SRW,SRRECNO))
IF SRRECNO=""
QUIT
FOR
SET SRSUB=$ORDER(^SRO(133.8,"AP",SRW,SRRECNO,SRSUB))
IF SRSUB=""
QUIT
DO MORE
+6 WRITE @IOF
DO HDR
+7 ;
+8 FOR
SET SS=$ORDER(^TMP("SR",$JOB,SS))
IF SS=""!(SRSOUT)
QUIT
FOR
SET SR=$ORDER(^TMP("SR",$JOB,SS,SR))
IF SR=""!(SRSOUT)
QUIT
FOR
SET ST=$ORDER(^TMP("SR",$JOB,SS,SR,ST))
IF ST=""!(SRSOUT)
QUIT
DO PRINT
END ;
+1 IF $EXTRACT(IOST)="P"
WRITE !
SET SRSOUT=1
WRITE @IOF
+2 IF $DATA(ZTQUEUED)
KILL ^TMP("SR",$JOB)
IF $GET(ZTSTOP)
QUIT
SET ZTREQ="@"
QUIT
+3 IF 'SRSOUT
WRITE !!,"Press RETURN to continue "
READ X:DTIME
WRITE @IOF
+4 DO ^%ZISC
DO ^SRSKILL
KILL SRTN
+5 QUIT
PRINT ; print information
+1 SET SRSDPT=SS
SET SRSS=SR
SET SROFN=ST
+2 IF $Y+20>IOSL
SET SRHDR=0
DO PAGE
SET SRHDR=1
IF SRSOUT
QUIT
+3 SET SRW=^SRO(133.8,SRSS,1,SROFN,0)
SET DFN=$PIECE(SRW,"^",1)
SET SROPER=$PIECE(SRW,"^",2)
SET (SRDT,Y)=$PIECE(SRW,"^",3)
IF Y
DO D^DIQ
SET SRDT=$EXTRACT(Y,1,12)_" "_$EXTRACT(Y,14,18)
+4 DO OUT^SRSWL3
+5 QUIT
LOOP ; break operation if greater than 59 characters
+1 SET SROPS(M)=""
FOR LOOP=1:1
SET MM=$PIECE(SROPER," ")
SET MMM=$PIECE(SROPER," ",2,200)
IF MMM=""
QUIT
IF $LENGTH(SROPS(M))+$LENGTH(MM)'<59
QUIT
SET SROPS(M)=SROPS(M)_MM_" "
SET SROPER=MMM
+2 QUIT
PAGE ; end of page
+1 IF $EXTRACT(IOST)'="P"
WRITE !!,"Press RETURN to continue, or '^' to quit: "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
QUIT
+2 DO HDR
+3 QUIT
MORE SET SRNAME=$PIECE(^SRO(133.8,SRRECNO,0),"^")
SET SRNAME=$PIECE(^SRO(137.45,SRNAME,0),"^")
+1 IF SRNAME=SRSNM
SET DFN=SRW
DO DEM^VADPT
SET SRSDPT=VADM(1)_" ("_VA("PID")_")"
SET ^TMP("SR",$JOB,SRSDPT,SRRECNO,SRSUB)=""
+2 QUIT
+3 ;
HDR ; print heading
+1 IF $DATA(ZTQUEUED)
DO ^SROSTOP
IF SRHALT
SET SRSOUT=1
QUIT
+2 IF $Y
WRITE @IOF
WRITE !,"Surgery Waiting List sorted by Patient",!,"Surgical Specialty is "_SRSNM,!,"Printed "_SRTIME,!
FOR LINE=1:1:80
WRITE "="
+3 SET SRHDR=1
+4 QUIT