ESPWR ;DALISC/CKA - WORKLOAD REPORT- 3/93
;;1.0;POLICE & SECURITY;**17,33**;Mar 31, 1994
START ;
S ESPALL=0
SELOFF S DIR(0)="FO^3:30",DIR("A")="Select OFFICER",DIR("B")="ALL" D ^DIR
I X="^" G EX
I Y="ALL" S ESPALL=1 G DATE
I $D(DTOUT) W $C(7) G EX
S DIC="^VA(200,",DIC(0)="EMQZ",D="AK.ESP POLICE"
D IX^DIC
I Y=-1 W !,$C(7),"This officer is not a current police officer." G SELOFF
S ESPPO=Y
DATE ;ASK BEGINNING & ENDING DATE
D DT^DICRW K BEGDATE,ENDDATE W !!,"**** Date Range Selection ****",!
S %DT="AE",%DT(0)="-NOW",%DT("A")=" Beginning DATE : " D ^%DT K %DT
G:Y<0 EX
S (BEGDATE,ESPBD)=Y
W ! S %DT="AE",%DT("A")=" Ending DATE: " D ^%DT
G:$D(DTOUT) EX
G:Y<ESPBD HELP W ! S ENDDATE=Y,ESPED=Y+.9
ZERO S ESPI=0 F ESPX=1:1 S ESPI=$O(^ESP(911,ESPI)) Q:ESPI'>0 S ESPC(ESPI)=0,ESPMIN(ESPI)=0
COUNT ;GO THROUGH "B" X-REF TO COUNT AND GET TOTALS
I 'ESPALL G ONE
S ESPDT=ESPBD-.0005
F ESPI=1:1 S ESPDT=$O(^ESP(910.1,"B",ESPDT)) Q:ESPDT>ESPED!(ESPDT'>0) D
. S ESPIEN=0
. F ESPJ=1:1 S ESPIEN=$O(^ESP(910.1,"B",ESPDT,ESPIEN)) Q:ESPIEN'>0 D
.. S ESPOFF=0
.. F ESPZ=1:1 S ESPOFF=$O(^ESP(910.1,ESPIEN,10,ESPOFF)) Q:ESPOFF'>0 D
... ;COUNT AND GET TOTALS
... S ESPACT=0
... F ESPY=1:1 S ESPACT=$O(^ESP(910.1,ESPIEN,10,ESPOFF,10,ESPACT)) Q:ESPACT'>0 D
.... S ESPI=$P(^ESP(910.1,ESPIEN,10,ESPOFF,10,ESPACT,0),U) I $D(ESPC(ESPI)) S ESPC(ESPI)=ESPC(ESPI)+$P(^(0),U,2),ESPMIN(ESPI)=ESPMIN(ESPI)+$P(^(0),U,3)
G PRT
ONE ;ONLY ONE OFFICER
S ESPDT=ESPBD-.0005
F ESPI=1:1 S ESPDT=$O(^ESP(910.1,"B",ESPDT)) Q:ESPDT>ESPED!(ESPDT'>0) D
. S ESPIEN=0
. F ESPJ=1:1 S ESPIEN=$O(^ESP(910.1,"B",ESPDT,ESPIEN)) Q:ESPIEN'>0 D
.. S ESPOFF=0
.. F ESPZ=1:1 S ESPOFF=$O(^ESP(910.1,ESPIEN,10,ESPOFF)) Q:ESPOFF'>0 D:+ESPPO=$P(^ESP(910.1,ESPIEN,10,ESPOFF,0),U)
... ;COUNT AND GET TOTALS
... S ESPACT=0
... F ESPY=1:1 S ESPACT=$O(^ESP(910.1,ESPIEN,10,ESPOFF,10,ESPACT)) Q:ESPACT'>0 D
.... S ESPI=$P(^ESP(910.1,ESPIEN,10,ESPOFF,10,ESPACT,0),U) I $D(ESPC(ESPI)) S ESPC(ESPI)=ESPC(ESPI)+$P(^(0),U,2),ESPMIN(ESPI)=ESPMIN(ESPI)+$P(^(0),U,3)
PRT ;PRINT REPORT
Q S %ZIS="Q" D ^%ZIS G:POP EX I '$D(IO("Q")) U IO D PRT^ESPWR1 G EX
S ZTRTN="PRT^ESPWR1",ZTSAVE("ESP*")="",ZTDESC="WORKLOAD REPORT" D ^%ZTLOAD,HOME^%ZIS G EX
W !!,"Done."
EX D ^%ZISC
W:$D(DTOUT) $C(7)
K %ZIS,%DT,BEGDATE,CODE,DIC,DIR,END,ENDDATE,ESPACT,ESPALL,ESPBD,ESPC,ESPDT,ESPED,ESPI,ESPIEN,ESPJ,ESPMIN,ESPN,ESPPO,ESPOFF,ESPX,ESPY,ESPZ,NAM,OFNAM,PAGE,X,Y
QUIT
;
HELP W "??",!?5,"Ending date must not be before beginning date" G DATE
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HESPWR 2573 printed Nov 22, 2024@17:41:02 Page 2
ESPWR ;DALISC/CKA - WORKLOAD REPORT- 3/93
+1 ;;1.0;POLICE & SECURITY;**17,33**;Mar 31, 1994
START ;
+1 SET ESPALL=0
SELOFF SET DIR(0)="FO^3:30"
SET DIR("A")="Select OFFICER"
SET DIR("B")="ALL"
DO ^DIR
+1 IF X="^"
GOTO EX
+2 IF Y="ALL"
SET ESPALL=1
GOTO DATE
+3 IF $DATA(DTOUT)
WRITE $CHAR(7)
GOTO EX
+4 SET DIC="^VA(200,"
SET DIC(0)="EMQZ"
SET D="AK.ESP POLICE"
+5 DO IX^DIC
+6 IF Y=-1
WRITE !,$CHAR(7),"This officer is not a current police officer."
GOTO SELOFF
+7 SET ESPPO=Y
DATE ;ASK BEGINNING & ENDING DATE
+1 DO DT^DICRW
KILL BEGDATE,ENDDATE
WRITE !!,"**** Date Range Selection ****",!
+2 SET %DT="AE"
SET %DT(0)="-NOW"
SET %DT("A")=" Beginning DATE : "
DO ^%DT
KILL %DT
+3 if Y<0
GOTO EX
+4 SET (BEGDATE,ESPBD)=Y
+5 WRITE !
SET %DT="AE"
SET %DT("A")=" Ending DATE: "
DO ^%DT
+6 if $DATA(DTOUT)
GOTO EX
+7 if Y<ESPBD
GOTO HELP
WRITE !
SET ENDDATE=Y
SET ESPED=Y+.9
ZERO SET ESPI=0
FOR ESPX=1:1
SET ESPI=$ORDER(^ESP(911,ESPI))
if ESPI'>0
QUIT
SET ESPC(ESPI)=0
SET ESPMIN(ESPI)=0
COUNT ;GO THROUGH "B" X-REF TO COUNT AND GET TOTALS
+1 IF 'ESPALL
GOTO ONE
+2 SET ESPDT=ESPBD-.0005
+3 FOR ESPI=1:1
SET ESPDT=$ORDER(^ESP(910.1,"B",ESPDT))
if ESPDT>ESPED!(ESPDT'>0)
QUIT
Begin DoDot:1
+4 SET ESPIEN=0
+5 FOR ESPJ=1:1
SET ESPIEN=$ORDER(^ESP(910.1,"B",ESPDT,ESPIEN))
if ESPIEN'>0
QUIT
Begin DoDot:2
+6 SET ESPOFF=0
+7 FOR ESPZ=1:1
SET ESPOFF=$ORDER(^ESP(910.1,ESPIEN,10,ESPOFF))
if ESPOFF'>0
QUIT
Begin DoDot:3
+8 ;COUNT AND GET TOTALS
+9 SET ESPACT=0
+10 FOR ESPY=1:1
SET ESPACT=$ORDER(^ESP(910.1,ESPIEN,10,ESPOFF,10,ESPACT))
if ESPACT'>0
QUIT
Begin DoDot:4
+11 SET ESPI=$PIECE(^ESP(910.1,ESPIEN,10,ESPOFF,10,ESPACT,0),U)
IF $DATA(ESPC(ESPI))
SET ESPC(ESPI)=ESPC(ESPI)+$PIECE(^(0),U,2)
SET ESPMIN(ESPI)=ESPMIN(ESPI)+$PIECE(^(0),U,3)
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+12 GOTO PRT
ONE ;ONLY ONE OFFICER
+1 SET ESPDT=ESPBD-.0005
+2 FOR ESPI=1:1
SET ESPDT=$ORDER(^ESP(910.1,"B",ESPDT))
if ESPDT>ESPED!(ESPDT'>0)
QUIT
Begin DoDot:1
+3 SET ESPIEN=0
+4 FOR ESPJ=1:1
SET ESPIEN=$ORDER(^ESP(910.1,"B",ESPDT,ESPIEN))
if ESPIEN'>0
QUIT
Begin DoDot:2
+5 SET ESPOFF=0
+6 FOR ESPZ=1:1
SET ESPOFF=$ORDER(^ESP(910.1,ESPIEN,10,ESPOFF))
if ESPOFF'>0
QUIT
if +ESPPO=$PIECE(^ESP(910.1,ESPIEN,10,ESPOFF,0),U)
Begin DoDot:3
+7 ;COUNT AND GET TOTALS
+8 SET ESPACT=0
+9 FOR ESPY=1:1
SET ESPACT=$ORDER(^ESP(910.1,ESPIEN,10,ESPOFF,10,ESPACT))
if ESPACT'>0
QUIT
Begin DoDot:4
+10 SET ESPI=$PIECE(^ESP(910.1,ESPIEN,10,ESPOFF,10,ESPACT,0),U)
IF $DATA(ESPC(ESPI))
SET ESPC(ESPI)=ESPC(ESPI)+$PIECE(^(0),U,2)
SET ESPMIN(ESPI)=ESPMIN(ESPI)+$PIECE(^(0),U,3)
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
PRT ;PRINT REPORT
Q SET %ZIS="Q"
DO ^%ZIS
if POP
GOTO EX
IF '$DATA(IO("Q"))
USE IO
DO PRT^ESPWR1
GOTO EX
+1 SET ZTRTN="PRT^ESPWR1"
SET ZTSAVE("ESP*")=""
SET ZTDESC="WORKLOAD REPORT"
DO ^%ZTLOAD
DO HOME^%ZIS
GOTO EX
+2 WRITE !!,"Done."
EX DO ^%ZISC
+1 if $DATA(DTOUT)
WRITE $CHAR(7)
+2 KILL %ZIS,%DT,BEGDATE,CODE,DIC,DIR,END,ENDDATE,ESPACT,ESPALL,ESPBD,ESPC,ESPDT,ESPED,ESPI,ESPIEN,ESPJ,ESPMIN,ESPN,ESPPO,ESPOFF,ESPX,ESPY,ESPZ,NAM,OFNAM,PAGE,X,Y
+3 QUIT
+4 ;
HELP WRITE "??",!?5,"Ending date must not be before beginning date"
GOTO DATE