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

SROCAN0.m

Go to the documentation of this file.
SROCAN0 ;BIR/MAM - REPORT OF CANCELLATIONS (CONT.) ;08/08/2011
 ;;3.0;Surgery;**14,94,176,182**;24 Jun 93;Build 49
 U IO K ^TMP("SR",$J),SRSPEC S SRD=SRSD-.0001,SRE=SRED+.9999,(SRHDR,SRQ)=0,PAGE=1
 S Y=DT D D^DIQ S SRPRINT=$E(Y,1,12)
 N SRNME,SROPP
 F  S SRD=$O(^SRF("AC",SRD)) Q:SRQ!(SRD>SRE)!('SRD)  S SRTN=0 F  S SRTN=$O(^SRF("AC",SRD,SRTN)) Q:SRQ!('SRTN)  I $D(^SRF(SRTN,0)),$P($G(^SRF(SRTN,30)),"^")'="",$$MANDIV^SROUTL0(SRINSTP,SRTN) D SET
 D HDR S SRSS="" F  S SRSS=$O(^TMP("SR",$J,SRSS)) Q:SRSS=""!(SRQ)  D SRSP S SRNME="" F  S SRNME=$O(^TMP("SR",$J,SRSS,SRNME)) Q:SRNME=""!(SRQ)  D
 .S SROPP="" F  S SROPP=$O(^TMP("SR",$J,SRSS,SRNME,SROPP)) Q:SROPP=""!(SRQ)  S SRTN=0 F  S SRTN=$O(^TMP("SR",$J,SRSS,SRNME,SROPP,SRTN)) Q:'SRTN!(SRQ)  D CASE
 I SRSP S SRSS="" F  S SRSS=$O(SRSP(SRSS)) Q:'SRSS!SRQ  I '$D(^TMP("SR",$J,SRSS)) D SRSP D:$Y+4>IOSL HDR Q:SRQ  W !,"No data for selected date range."
 I 'SRSP,'$D(^TMP("SR",$J)) W !!,"No data for selected date range."
 D END
 Q
SRSP S SRSPEC=$S(SRSS:$P(^SRO(137.45,SRSS,0),"^"),1:"NO SPECIALTY ENTERED"),SRSPEC=">> SURGICAL SPECIALTY: "_SRSPEC_" <<" D SUB
 Q
SET ; set up ^TMP
 Q:$P($G(^SRF(SRTN,"NON")),"^")="Y"  S SRSS=$P(^SRF(SRTN,0),"^",4) S:SRSS="" SRSS="ZZ" I SRSP,'$D(SRSP(SRSS)) Q
 S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT
 S ^TMP("SR",$J,SRSS,VADM(1),$P(^SRF(SRTN,"OP"),"^"),SRTN)=""
 Q
CASE ; print individual case
 I $Y+6>IOSL D HDR Q:SRQ
 S S(0)=^SRF(SRTN,0),DFN=$P(S(0),"^") D DEM^VADPT S SRNM=VADM(1),SRSSN=VA("PID"),Y=$P(S(0),"^",9) D D^DIQ S SROD=$E(Y,1,12)
 S SRCR=$P($G(^SRF(SRTN,31)),"^",8) S:SRCR'="" SRCR=$P(^SRO(135,SRCR,0),"^")
 S Y=$P(^SRF(SRTN,30),"^") D:Y D^DIQ S SRCD=$P(Y,"@")_"  "_$E($P(Y,"@",2),1,5)
 K ABORT S ABORT=$P($G(^SRF(SRTN,.2)),"^",10)
OPS S SROPER=$S(ABORT:"* ",1:"")_$P(^SRF(SRTN,"OP"),"^"),OPER=0 F  S OPER=$O(^SRF(SRTN,13,OPER)) Q:OPER=""  D OTHER
 K SROPS,MM,MMM S:$L(SROPER)<50 SROPS(1)=SROPER I $L(SROPER)>49 S SROPER=SROPER_"  " F M=1:1 D LOOP Q:MMM=""
PRINT ;
 W !!,SROD,?15,$E(SRNM,1,28),?44,SROPS(1),?95,SRCD,!,SRTN,?15,VA("PID") W:$D(SROPS(2)) ?44,SROPS(2) W ?95,SRCR
 I $D(SROPS(3)) W !,?44,SROPS(3) I $D(SROPS(4)) W !,?44,SROPS(4) I $D(SROPS(5)) W !,?44,SROPS(5) I $D(SROPS(6)) W !,?44,SROPS(6)
 Q
END W:$E(IOST)="P" @IOF I $D(ZTQUEUED) K ^TMP("SR",$J) Q:$G(ZTSTOP)  S ZTREQ="@" Q
 I 'SRQ,$E(IOST)'="P" W !!,"Press RETURN to continue  " R X:DTIME
 D ^SRSKILL K SRTN D ^%ZISC W @IOF
 Q
OTHER ; other operations
 S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRTN,13,OPER,0),"^"))>250 S SRLONG=0,OPER=999,SROPERS=" ..."
 I SRLONG S SROPERS=$P(^SRF(SRTN,13,OPER,0),"^")
 S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
 Q
LOOP ; break procedure if greater than 55 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)'<50  S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
 Q
HDR ; print heading
 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRQ=1 Q
 I SRHDR,$E(IOST)'="P" W !!,"Press RETURN to continue, or '^' to quit:  " R X:DTIME I '$T!(X["^") S SRQ=1 Q
 W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,?115,"PAGE: "_PAGE,!,?55,"REPORT OF CANCELLATIONS",?100,"REVIEWED BY:"
 W !,"PRINTED: ",SRPRINT,?53,"FROM ",$E(SRSD,4,5),"/",$E(SRSD,6,7),"/",$E(SRSD,2,3),"  TO ",$E(SRED,4,5),"/",$E(SRED,6,7),"/",$E(SRED,2,3),?100,"DATE REVIEWED:"
 W !!,"DATE",?15,"PATIENT",?44,"OPERATION(S)",?95,"CANCEL DATE",!,"CASE #",?15,"ID#",?95,"PRIMARY REASON",! F I=1:1:IOM W "="
 S (SRHDR,SRPAGE)=1,PAGE=PAGE+1 D:$D(SRSPEC) SUB1
 Q
SUB ; print specialty sub-heading
 I $Y+8>IOSL D HDR I SRQ!('SRPAGE) Q
 I 'SRPAGE W !! F LINE=1:1:132 W "-"
SUB1 W !,?(132-$L(SRSPEC)\2),SRSPEC S SRPAGE=0
 Q