62 lines
3.1 KiB
Mathematica
62 lines
3.1 KiB
Mathematica
|
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
|
||
|
HEADER ;
|
||
|
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
|