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

ESPWR.m

Go to the documentation of this file.
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