LRCAPACC ;SLC/RJS/FHS - LAB WORKLOAD DIVISION REPORT BY CAP CODE ;8/23/91 1039;
;;5.2;LAB SERVICE;**201**;Sep 27, 1994
EN ;
K ^TMP($J),ZTSK
ASK1 S %DT="E" W !!,"Beginning Date: " R X:$S($D(DTIME):DTIME,1:999) E G EXIT
G:(X["^") EXIT D ^%DT G:(Y<0) ASK1 S LRDT1=+Y
ASK2 ;
S %DT="E" W !!,"Ending Date: " R X:$S($D(DTIME):DTIME,1:999) E G EXIT
G:(X["^") EXIT D ^%DT G:(Y<0) ASK2 S LRDT2=+Y I LRDT1>LRDT2 S Y=LRDT1,LRDT1=LRDT2,LRDT2=Y
SEL ;
F S %=2 W !?10,"Would you like a complete report " D YN^DICN Q:%'=0
G:%=-1 EXIT G:%=2 ZIS F S %=2 W !?10,"All WKLD Codes " D YN^DICN Q:%'=0
G:%=-1 EXIT I %=1 S LRCAP("A")="" G ZIS
K DIC S DIC=64,DIC(0)="AZQMEN" F D ^DIC Q:X="^"!('+Y)!(X="") S LRCAP(+$P(Y(0),U,2))=""
I '$O(LRCAP(0)) W !!?10,"Nothing Selected ",! G EXIT
ZIS W !! S %ZIS="NQ" D ^%ZIS G:'$L(IO) EXIT G:IO'=IO(0)!($D(IO("Q"))) QUEUE
DQ ;
I $D(ZTQUEUED) S ZTREQ="@"
S LRPG=0 D LOOP W:TOT !!,?35,"Total for the Report: ",$J(TOT,10,2)
I '$D(^TMP($J)) W !!?10,"No Data for " S X=LRDT1P D DD W " - " S X=LRDT2P D DD W !!
W:IOST["P-" @IOF
EXIT ;
D ^%ZISC K %,TT,I,C,CP,CODE,Y,LRCAP,LRPG,TOT,LRDT,LRDT1,LRDT2,LRDV1,LRDV2,LRLN,^TMP($J),LRTXT,ZTSK,%DT,%ZIS,ZTRTN,ZTDESC,ZTIO,ZTSAVE,LRDT1P,LRDT2P,IO("Q")
Q
QUEUE ;
S ZTRTN="DQ^LRCAPACC",ZTSAVE("LRDT*")="",ZTSAVE("LRCAP*")="",ZTDESC="Lab Workload Division Report",ZTIO=ION K ZTDTH,ZTCPU,ZTUCI D ^%ZTLOAD G EXIT
LOOP ;
S (LRLN,LRDV1,LRDV2,TOT)=0,LRDT1P=LRDT1,LRDT2P=LRDT2,LRDT1=LRDT1-.0001,LRDT2=LRDT2+.00001 D DT^LRX
W !! D WAIT^DICD W:IOST["P-" @IOF F S LRLN=$O(^TMP("WL",LRLN)) Q:'LRLN S LRTXT=^(LRLN) D LOOP1
D HEADER S LRDV1=0 F S LRDV1=$O(^TMP($J,LRDV1)) Q:'LRDV1 D LOOP2 D:IOST["P-"&($Y>(IOSL-10)) HEADER
Q
LOOP1 ;
I $E(LRTXT,1,2)="$$" S LRDV2=+$E(LRTXT,3,99),LRDT=$E(LRTXT,10,16) Q
I $E(LRTXT)="$" S LRDV1=+$E(LRTXT,2,99) Q
Q:'LRDV1!('LRDV2) S CODE=+$E(LRTXT,17,26) Q:LRDT>LRDT2!(LRDT<LRDT1) D:'$D(LRCAP)!($D(LRCAP("A"))#2)!($D(LRCAP(CODE))) DATES
Q
LOOP2 ;
S LRDV2=0 F S LRDV2=$O(^TMP($J,LRDV1,LRDV2)) Q:'LRDV2 D LOOP3
Q
LOOP3 ;
I IOST["P-"&($Y>(IOSL-10)) D HEADER
W !,"Division: ",LRDV2
S X=^TMP($J,LRDV1,LRDV2,"LO DT") W ?20,"From: " D DD S X=^("HI DT") W ?35,"To: " D DD
W ?50,"Total: ",$J(^("TOT WRK"),10,2) S TOT=TOT+^("TOT WRK")
S I=0 F S I=$O(^TMP($J,LRDV1,LRDV2,I)) Q:'I S CP=^(I),C=I D:IOST["P-"&($Y>(IOSL-10)) HEADER D SUB
W ! Q
SUB S:C'["." C=C_".000" S C=$S($L(C)=9:C,1:C_$E("000",($L(C)-5),3)),C=$O(^LAM("E",C,0)) Q:'C
S C=^LAM(C,0) W !?2,$P(C,U,2),?12,$J(CP,10,2)," ",$P(C,U)
Q
S LRPG=LRPG+1 W:IOST["P-"&($Y>(IOSL-10)) @IOF W !!," Lab Workload Division Report for Site: ",LRDV1," Printed: ",LRDT0,!!,?60,"Pg: ",LRPG,!
Q
DD ;
W $$FMTE^XLFDT(X,"1D") Q
DATES ;
I '$D(^TMP($J,LRDV1,LRDV2,"HI DT")) S ^TMP($J,LRDV1,LRDV2,"HI DT")=0,^TMP($J,LRDV1,LRDV2,"LO DT")=9999999,^TMP($J,LRDV1,LRDV2,"TOT WRK")=0
S TT=(+$E(LRTXT,28,99)*(+$E(LRTXT,34,99))),^TMP($J,LRDV1,LRDV2,"TOT WRK")=^TMP($J,LRDV1,LRDV2,"TOT WRK")+TT
I $D(LRCAP("A"))!($D(LRCAP(CODE))) S:'$D(^TMP($J,LRDV1,LRDV2,CODE)) ^(CODE)=0 S ^(CODE)=^(CODE)+TT
S:'(LRDT<^TMP($J,LRDV1,LRDV2,"HI DT")) ^TMP($J,LRDV1,LRDV2,"HI DT")=LRDT
S:'(LRDT>^TMP($J,LRDV1,LRDV2,"LO DT")) ^TMP($J,LRDV1,LRDV2,"LO DT")=LRDT
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLRCAPACC 3252 printed Oct 16, 2024@18:13:19 Page 2
LRCAPACC ;SLC/RJS/FHS - LAB WORKLOAD DIVISION REPORT BY CAP CODE ;8/23/91 1039;
+1 ;;5.2;LAB SERVICE;**201**;Sep 27, 1994
EN ;
+1 KILL ^TMP($JOB),ZTSK
ASK1 SET %DT="E"
WRITE !!,"Beginning Date: "
READ X:$SELECT($DATA(DTIME):DTIME,1:999)
IF '$TEST
GOTO EXIT
+1 if (X["^")
GOTO EXIT
DO ^%DT
if (Y<0)
GOTO ASK1
SET LRDT1=+Y
ASK2 ;
+1 SET %DT="E"
WRITE !!,"Ending Date: "
READ X:$SELECT($DATA(DTIME):DTIME,1:999)
IF '$TEST
GOTO EXIT
+2 if (X["^")
GOTO EXIT
DO ^%DT
if (Y<0)
GOTO ASK2
SET LRDT2=+Y
IF LRDT1>LRDT2
SET Y=LRDT1
SET LRDT1=LRDT2
SET LRDT2=Y
SEL ;
+1 FOR
SET %=2
WRITE !?10,"Would you like a complete report "
DO YN^DICN
if %'=0
QUIT
+2 if %=-1
GOTO EXIT
if %=2
GOTO ZIS
FOR
SET %=2
WRITE !?10,"All WKLD Codes "
DO YN^DICN
if %'=0
QUIT
+3 if %=-1
GOTO EXIT
IF %=1
SET LRCAP("A")=""
GOTO ZIS
+4 KILL DIC
SET DIC=64
SET DIC(0)="AZQMEN"
FOR
DO ^DIC
if X="^"!('+Y)!(X="")
QUIT
SET LRCAP(+$PIECE(Y(0),U,2))=""
+5 IF '$ORDER(LRCAP(0))
WRITE !!?10,"Nothing Selected ",!
GOTO EXIT
ZIS WRITE !!
SET %ZIS="NQ"
DO ^%ZIS
if '$LENGTH(IO)
GOTO EXIT
if IO'=IO(0)!($DATA(IO("Q")))
GOTO QUEUE
DQ ;
+1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 SET LRPG=0
DO LOOP
if TOT
WRITE !!,?35,"Total for the Report: ",$JUSTIFY(TOT,10,2)
+3 IF '$DATA(^TMP($JOB))
WRITE !!?10,"No Data for "
SET X=LRDT1P
DO DD
WRITE " - "
SET X=LRDT2P
DO DD
WRITE !!
+4 if IOST["P-"
WRITE @IOF
EXIT ;
+1 DO ^%ZISC
KILL %,TT,I,C,CP,CODE,Y,LRCAP,LRPG,TOT,LRDT,LRDT1,LRDT2,LRDV1,LRDV2,LRLN,^TMP($JOB),LRTXT,ZTSK,%DT,%ZIS,ZTRTN,ZTDESC,ZTIO,ZTSAVE,LRDT1P,LRDT2P,IO("Q")
+2 QUIT
QUEUE ;
+1 SET ZTRTN="DQ^LRCAPACC"
SET ZTSAVE("LRDT*")=""
SET ZTSAVE("LRCAP*")=""
SET ZTDESC="Lab Workload Division Report"
SET ZTIO=ION
KILL ZTDTH,ZTCPU,ZTUCI
DO ^%ZTLOAD
GOTO EXIT
LOOP ;
+1 SET (LRLN,LRDV1,LRDV2,TOT)=0
SET LRDT1P=LRDT1
SET LRDT2P=LRDT2
SET LRDT1=LRDT1-.0001
SET LRDT2=LRDT2+.00001
DO DT^LRX
+2 WRITE !!
DO WAIT^DICD
if IOST["P-"
WRITE @IOF
FOR
SET LRLN=$ORDER(^TMP("WL",LRLN))
if 'LRLN
QUIT
SET LRTXT=^(LRLN)
DO LOOP1
+3 DO HEADER
SET LRDV1=0
FOR
SET LRDV1=$ORDER(^TMP($JOB,LRDV1))
if 'LRDV1
QUIT
DO LOOP2
if IOST["P-"&($Y>(IOSL-10))
DO HEADER
+4 QUIT
LOOP1 ;
+1 IF $EXTRACT(LRTXT,1,2)="$$"
SET LRDV2=+$EXTRACT(LRTXT,3,99)
SET LRDT=$EXTRACT(LRTXT,10,16)
QUIT
+2 IF $EXTRACT(LRTXT)="$"
SET LRDV1=+$EXTRACT(LRTXT,2,99)
QUIT
+3 if 'LRDV1!('LRDV2)
QUIT
SET CODE=+$EXTRACT(LRTXT,17,26)
if LRDT>LRDT2!(LRDT<LRDT1)
QUIT
if '$DATA(LRCAP)!($DATA(LRCAP("A"))#2)!($DATA(LRCAP(CODE)))
DO DATES
+4 QUIT
LOOP2 ;
+1 SET LRDV2=0
FOR
SET LRDV2=$ORDER(^TMP($JOB,LRDV1,LRDV2))
if 'LRDV2
QUIT
DO LOOP3
+2 QUIT
LOOP3 ;
+1 IF IOST["P-"&($Y>(IOSL-10))
DO HEADER
+2 WRITE !,"Division: ",LRDV2
+3 SET X=^TMP($JOB,LRDV1,LRDV2,"LO DT")
WRITE ?20,"From: "
DO DD
SET X=^("HI DT")
WRITE ?35,"To: "
DO DD
+4 WRITE ?50,"Total: ",$JUSTIFY(^("TOT WRK"),10,2)
SET TOT=TOT+^("TOT WRK")
+5 SET I=0
FOR
SET I=$ORDER(^TMP($JOB,LRDV1,LRDV2,I))
if 'I
QUIT
SET CP=^(I)
SET C=I
if IOST["P-"&($Y>(IOSL-10))
DO HEADER
DO SUB
+6 WRITE !
QUIT
SUB if C'["."
SET C=C_".000"
SET C=$SELECT($LENGTH(C)=9:C,1:C_$EXTRACT("000",($LENGTH(C)-5),3))
SET C=$ORDER(^LAM("E",C,0))
if 'C
QUIT
+1 SET C=^LAM(C,0)
WRITE !?2,$PIECE(C,U,2),?12,$JUSTIFY(CP,10,2)," ",$PIECE(C,U)
+2 QUIT
+1 SET LRPG=LRPG+1
if IOST["P-"&($Y>(IOSL-10))
WRITE @IOF
WRITE !!," Lab Workload Division Report for Site: ",LRDV1," Printed: ",LRDT0,!!,?60,"Pg: ",LRPG,!
+2 QUIT
DD ;
+1 WRITE $$FMTE^XLFDT(X,"1D")
QUIT
DATES ;
+1 IF '$DATA(^TMP($JOB,LRDV1,LRDV2,"HI DT"))
SET ^TMP($JOB,LRDV1,LRDV2,"HI DT")=0
SET ^TMP($JOB,LRDV1,LRDV2,"LO DT")=9999999
SET ^TMP($JOB,LRDV1,LRDV2,"TOT WRK")=0
+2 SET TT=(+$EXTRACT(LRTXT,28,99)*(+$EXTRACT(LRTXT,34,99)))
SET ^TMP($JOB,LRDV1,LRDV2,"TOT WRK")=^TMP($JOB,LRDV1,LRDV2,"TOT WRK")+TT
+3 IF $DATA(LRCAP("A"))!($DATA(LRCAP(CODE)))
if '$DATA(^TMP($JOB,LRDV1,LRDV2,CODE))
SET ^(CODE)=0
SET ^(CODE)=^(CODE)+TT
+4 if '(LRDT<^TMP($JOB,LRDV1,LRDV2,"HI DT"))
SET ^TMP($JOB,LRDV1,LRDV2,"HI DT")=LRDT
+5 if '(LRDT>^TMP($JOB,LRDV1,LRDV2,"LO DT"))
SET ^TMP($JOB,LRDV1,LRDV2,"LO DT")=LRDT
+6 QUIT