ESPUCR ;DALISC/CKA - UNIFORM CRIME REPORT- 12/92
;;1.0;POLICE & SECURITY;**17,22,33**;Mar 31, 1994
START ;
I '$D(DUZ(2)) W !,"Site # is not defined!" G EX
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
CREATE ;CREATE A NEW ENTRY IN CRIME DATA FILE
K DD,DO S DIC="^ESP(912.4,",DIC(0)="L",DLAYGO=912.4,X=ESPBD D FILE^DICN G:Y<0 EX S ESPIEN=+Y
L +^ESP(912.4,ESPIEN):1 I '$T W !,"This record is being edited by someone else."
S $P(^ESP(912.4,ESPIEN,0),U,2)=ENDDATE
INST S:'$D(^ESP(912.4,ESPIEN,1,0)) ^(0)="^912.41^"
K DD,DO S DIC="^ESP(912.4,"_ESPIEN_",1,",DIC(0)="L",DLAYGO=912.4,X=$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNIDENTIFIED"),DA(1)=ESPIEN D FILE^DICN G:Y<0 EX S ESPINS=+Y
S $P(^ESP(912.4,ESPIEN,1,ESPINS,0),U,2)=$S($D(^DIC(4,DUZ(2),99)):$P(^DIC(4,DUZ(2),99),U),1:"")
ZERO F ESPX=1:1:188 S ^ESP(912.4,ESPIEN,1,ESPINS,ESPX)=0
F ESPX=133.1,134.1,138.1,139.1 S ^ESP(912.4,ESPIEN,1,ESPINS,ESPX)=0
COUNT ;GO THROUGH "C" X-REF TO COUNT AND GET TOTALS
S ESPDT=ESPBD-.0005
F ESPI=1:1 S ESPDT=$O(^ESP(912,"C",ESPDT)) Q:ESPDT>ESPED!(ESPDT'>0) D
. S ESPOFN=0
. F ESPJ=1:1 S ESPOFN=$O(^ESP(912,"C",ESPDT,ESPOFN)) Q:ESPOFN'>0 D
.. I $D(^ESP(912,ESPOFN,5)) Q:'$P(^ESP(912,ESPOFN,5),U,5)
.. S ESPCN=0
.. F ESPZ=1:1 S ESPCN=$O(^ESP(912,ESPOFN,10,ESPCN)) Q:ESPCN'>0 D SET^ESPUCR1
VIO ;GO THROUGH "C" X-REF VIOLATION FILE TO COUNT AND GET TOTALS
S ESPDT=ESPBD-.0005
F ESPI=1:1 S ESPDT=$O(^ESP(914,"C",ESPDT)) Q:ESPDT>ESPED!(ESPDT'>0) D
. S ESPOFN=0
. F ESPJ=1:1 S ESPOFN=$O(^ESP(914,"C",ESPDT,ESPOFN)) Q:ESPOFN'>0 D
.. S ESPTYPE=$P(^ESP(914,ESPOFN,0),U,3),ESPOFF=$P(^(0),U,4),ESPCL=$P($G(^ESP(915,+ESPOFF,0)),U,4),ESPFN=$P(^ESP(914,ESPOFN,0),U,9),ESPCAT=$P($G(^ESP(910,+ESPFN,0)),U,4)
.. S ^(171)=^ESP(912.4,ESPIEN,1,ESPINS,171)+1
.. I ESPTYPE="C" S ^(172)=^ESP(912.4,ESPIEN,1,ESPINS,172)+1 D
... I ESPCL'="M",ESPCL'="P" S ^(173)=^ESP(912.4,ESPIEN,1,ESPINS,173)+1
... I ESPCL="M" S ^(174)=^ESP(912.4,ESPIEN,1,ESPINS,174)+1
... I ESPCL="P" S ^(175)=^ESP(912.4,ESPIEN,1,ESPINS,175)+1
... I ESPCAT="E"!(ESPCAT="PO") S ^(176)=^ESP(912.4,ESPIEN,1,ESPINS,176)+1
... I ESPCAT="O"!(ESPCAT="") S ^(177)=^ESP(912.4,ESPIEN,1,ESPINS,177)+1
... I ESPCAT="P" S ^(178)=^ESP(912.4,ESPIEN,1,ESPINS,178)+1
... I ESPCAT="V" S ^(179)=^ESP(912.4,ESPIEN,1,ESPINS,179)+1
.. I ESPTYPE="V" S ^(180)=^ESP(912.4,ESPIEN,1,ESPINS,180)+1 D
... I ESPCL'="M",ESPCL'="P" S ^(181)=^ESP(912.4,ESPIEN,1,ESPINS,181)+1
... I ESPCL="M" S ^(182)=^ESP(912.4,ESPIEN,1,ESPINS,182)+1
... I ESPCL="P" S ^(183)=^ESP(912.4,ESPIEN,1,ESPINS,183)+1
... I ESPCAT="E"!(ESPCAT="PO") S ^(184)=^ESP(912.4,ESPIEN,1,ESPINS,184)+1
... I ESPCAT="O"!(ESPCAT="") S ^(185)=^ESP(912.4,ESPIEN,1,ESPINS,185)+1
... I ESPCAT="P" S ^(186)=^ESP(912.4,ESPIEN,1,ESPINS,186)+1
... I ESPCAT="V" S ^(187)=^ESP(912.4,ESPIEN,1,ESPINS,187)+1
L -^ESP(912.4,ESPIEN)
W !!,"Done."
EX W:$D(DTOUT) $C(7)
K %DT,BEGDATE,DA,DD,DIC,DO,DTOUT,ENDDATE,ESPBD,ESPCAT,ESPCC,ESPCL,ESPCN,ESPDOL,ESPDT,ESPED,ESPFN,ESPI,ESPIEN,ESPINS,ESPJ,ESPOF,ESPOFF,ESPOFN,ESPSUB,ESPTYPE,ESPVIC,ESPVICT,ESPX,ESPZ,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[HESPUCR 3472 printed Oct 16, 2024@18:31:31 Page 2
ESPUCR ;DALISC/CKA - UNIFORM CRIME REPORT- 12/92
+1 ;;1.0;POLICE & SECURITY;**17,22,33**;Mar 31, 1994
START ;
+1 IF '$DATA(DUZ(2))
WRITE !,"Site # is not defined!"
GOTO EX
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
CREATE ;CREATE A NEW ENTRY IN CRIME DATA FILE
+1 KILL DD,DO
SET DIC="^ESP(912.4,"
SET DIC(0)="L"
SET DLAYGO=912.4
SET X=ESPBD
DO FILE^DICN
if Y<0
GOTO EX
SET ESPIEN=+Y
+2 LOCK +^ESP(912.4,ESPIEN):1
IF '$TEST
WRITE !,"This record is being edited by someone else."
+3 SET $PIECE(^ESP(912.4,ESPIEN,0),U,2)=ENDDATE
INST if '$DATA(^ESP(912.4,ESPIEN,1,0))
SET ^(0)="^912.41^"
+1 KILL DD,DO
SET DIC="^ESP(912.4,"_ESPIEN_",1,"
SET DIC(0)="L"
SET DLAYGO=912.4
SET X=$SELECT($DATA(^DIC(4,DUZ(2),0)):$PIECE(^(0),U),1:"UNIDENTIFIED")
SET DA(1)=ESPIEN
DO FILE^DICN
if Y<0
GOTO EX
SET ESPINS=+Y
+2 SET $PIECE(^ESP(912.4,ESPIEN,1,ESPINS,0),U,2)=$SELECT($DATA(^DIC(4,DUZ(2),99)):$PIECE(^DIC(4,DUZ(2),99),U),1:"")
ZERO FOR ESPX=1:1:188
SET ^ESP(912.4,ESPIEN,1,ESPINS,ESPX)=0
+1 FOR ESPX=133.1,134.1,138.1,139.1
SET ^ESP(912.4,ESPIEN,1,ESPINS,ESPX)=0
COUNT ;GO THROUGH "C" X-REF TO COUNT AND GET TOTALS
+1 SET ESPDT=ESPBD-.0005
+2 FOR ESPI=1:1
SET ESPDT=$ORDER(^ESP(912,"C",ESPDT))
if ESPDT>ESPED!(ESPDT'>0)
QUIT
Begin DoDot:1
+3 SET ESPOFN=0
+4 FOR ESPJ=1:1
SET ESPOFN=$ORDER(^ESP(912,"C",ESPDT,ESPOFN))
if ESPOFN'>0
QUIT
Begin DoDot:2
+5 IF $DATA(^ESP(912,ESPOFN,5))
if '$PIECE(^ESP(912,ESPOFN,5),U,5)
QUIT
+6 SET ESPCN=0
+7 FOR ESPZ=1:1
SET ESPCN=$ORDER(^ESP(912,ESPOFN,10,ESPCN))
if ESPCN'>0
QUIT
DO SET^ESPUCR1
End DoDot:2
End DoDot:1
VIO ;GO THROUGH "C" X-REF VIOLATION FILE TO COUNT AND GET TOTALS
+1 SET ESPDT=ESPBD-.0005
+2 FOR ESPI=1:1
SET ESPDT=$ORDER(^ESP(914,"C",ESPDT))
if ESPDT>ESPED!(ESPDT'>0)
QUIT
Begin DoDot:1
+3 SET ESPOFN=0
+4 FOR ESPJ=1:1
SET ESPOFN=$ORDER(^ESP(914,"C",ESPDT,ESPOFN))
if ESPOFN'>0
QUIT
Begin DoDot:2
+5 SET ESPTYPE=$PIECE(^ESP(914,ESPOFN,0),U,3)
SET ESPOFF=$PIECE(^(0),U,4)
SET ESPCL=$PIECE($GET(^ESP(915,+ESPOFF,0)),U,4)
SET ESPFN=$PIECE(^ESP(914,ESPOFN,0),U,9)
SET ESPCAT=$PIECE($GET(^ESP(910,+ESPFN,0)),U,4)
+6 SET ^(171)=^ESP(912.4,ESPIEN,1,ESPINS,171)+1
+7 IF ESPTYPE="C"
SET ^(172)=^ESP(912.4,ESPIEN,1,ESPINS,172)+1
Begin DoDot:3
+8 IF ESPCL'="M"
IF ESPCL'="P"
SET ^(173)=^ESP(912.4,ESPIEN,1,ESPINS,173)+1
+9 IF ESPCL="M"
SET ^(174)=^ESP(912.4,ESPIEN,1,ESPINS,174)+1
+10 IF ESPCL="P"
SET ^(175)=^ESP(912.4,ESPIEN,1,ESPINS,175)+1
+11 IF ESPCAT="E"!(ESPCAT="PO")
SET ^(176)=^ESP(912.4,ESPIEN,1,ESPINS,176)+1
+12 IF ESPCAT="O"!(ESPCAT="")
SET ^(177)=^ESP(912.4,ESPIEN,1,ESPINS,177)+1
+13 IF ESPCAT="P"
SET ^(178)=^ESP(912.4,ESPIEN,1,ESPINS,178)+1
+14 IF ESPCAT="V"
SET ^(179)=^ESP(912.4,ESPIEN,1,ESPINS,179)+1
End DoDot:3
+15 IF ESPTYPE="V"
SET ^(180)=^ESP(912.4,ESPIEN,1,ESPINS,180)+1
Begin DoDot:3
+16 IF ESPCL'="M"
IF ESPCL'="P"
SET ^(181)=^ESP(912.4,ESPIEN,1,ESPINS,181)+1
+17 IF ESPCL="M"
SET ^(182)=^ESP(912.4,ESPIEN,1,ESPINS,182)+1
+18 IF ESPCL="P"
SET ^(183)=^ESP(912.4,ESPIEN,1,ESPINS,183)+1
+19 IF ESPCAT="E"!(ESPCAT="PO")
SET ^(184)=^ESP(912.4,ESPIEN,1,ESPINS,184)+1
+20 IF ESPCAT="O"!(ESPCAT="")
SET ^(185)=^ESP(912.4,ESPIEN,1,ESPINS,185)+1
+21 IF ESPCAT="P"
SET ^(186)=^ESP(912.4,ESPIEN,1,ESPINS,186)+1
+22 IF ESPCAT="V"
SET ^(187)=^ESP(912.4,ESPIEN,1,ESPINS,187)+1
End DoDot:3
End DoDot:2
End DoDot:1
+23 LOCK -^ESP(912.4,ESPIEN)
+24 WRITE !!,"Done."
EX if $DATA(DTOUT)
WRITE $CHAR(7)
+1 KILL %DT,BEGDATE,DA,DD,DIC,DO,DTOUT,ENDDATE,ESPBD,ESPCAT,ESPCC,ESPCL,ESPCN,ESPDOL,ESPDT,ESPED,ESPFN,ESPI,ESPIEN,ESPINS,ESPJ,ESPOF,ESPOFF,ESPOFN,ESPSUB,ESPTYPE,ESPVIC,ESPVICT,ESPX,ESPZ,X,Y
+2 QUIT
+3 ;
HELP WRITE "??",!?5,"Ending date must not be before beginning date"
GOTO DATE