ESPUCR1 ;DALISC/CKA - UNIFORM CRIME REPORT COUNT AND GET TOTALS- 1/92
;;1.0;POLICE & SECURITY;;Mar 31, 1994
EN Q ;CALLED FROM ESPUCR
SET ;CALLED FROM ESPUCR TO ADD CRIME REPORT TOTALS IN CRIME DATA FILE
S ESPCL=^ESP(912,ESPOFN,10,ESPCN,0),ESPCC=$P(ESPCL,U),ESPTYPE=$P(ESPCL,U,2),ESPSUB=$P(ESPCL,U,3)
I ESPCC=1 D ASLT QUIT
I ESPCC=2 D BURG QUIT
I ESPCC=3 D CONT QUIT
I ESPCC=4 D DIST^ESPUCR2 QUIT
I ESPCC=5 D MUR^ESPUCR2 QUIT
I ESPCC=6 D NON^ESPUCR2 QUIT
I ESPCC=7 D OTH^ESPUCR2 QUIT
I ESPCC=8 D RAPE^ESPUCR3 QUIT
I ESPCC=9 D ROBB^ESPUCR3 QUIT
I ESPCC=10 D STOP^ESPUCR4 QUIT
I ESPCC=11 D THEFT^ESPUCR4 QUIT
I ESPCC=12 D VAND^ESPUCR5 QUIT
I ESPCC=13 D VICE^ESPUCR5 QUIT
I ESPCC=14 D VIO^ESPUCR5 QUIT
EXIT QUIT
ASLT ;ASSAULT TOTALS
OF ; COUNT VICTIMS AND OFFENDERS
S ESPVIC=0
F ESPX=1:1 S ESPVIC=$O(^ESP(912,ESPOFN,30,ESPVIC)) Q:ESPVIC'>0 D
. S ESPVICT=$P(^ESP(912,ESPOFN,30,ESPVIC,0),U,5),^(1)=^ESP(912.4,ESPIEN,1,ESPINS,1)+1 D
.. I ESPTYPE=1 S ^(2)=^ESP(912.4,ESPIEN,1,ESPINS,2)+1 QUIT
.. I ESPTYPE=2 S ^(3)=^ESP(912.4,ESPIEN,1,ESPINS,3)+1 QUIT
.. I ESPTYPE=3 S ^(4)=^ESP(912.4,ESPIEN,1,ESPINS,4)+1 QUIT
.. I ESPTYPE=4 S ^(5)=^ESP(912.4,ESPIEN,1,ESPINS,5)+1 QUIT
.. I ESPTYPE=5 S ^(6)=^ESP(912.4,ESPIEN,1,ESPINS,6)+1 QUIT
. I ESPVICT="E" S ^(12)=^ESP(912.4,ESPIEN,1,ESPINS,12)+1 QUIT
. I ESPVICT="PO" S ^(13)=^ESP(912.4,ESPIEN,1,ESPINS,13)+1 QUIT
. I ESPVICT="O" S ^(14)=^ESP(912.4,ESPIEN,1,ESPINS,14)+1 QUIT
. I ESPVICT="P" S ^(15)=^ESP(912.4,ESPIEN,1,ESPINS,15)+1 QUIT
. I ESPVICT="V" S ^(17)=^ESP(912.4,ESPIEN,1,ESPINS,17)+1 QUIT
. S ^(16)=^ESP(912.4,ESPIEN,1,ESPINS,16)+1
I $D(^ESP(912,ESPOFN,30)) D OFFE
QUIT
OFFE ;COUNT OFFENDERS
S ESPOF=0
F ESPX=1:1 S ESPOF=$O(^ESP(912,ESPOFN,40,ESPOF)) Q:ESPOF'>0 D
. S ESPOFF=$P(^ESP(912,ESPOFN,40,ESPOF,0),U,11)
. I ESPOFF="E"!(ESPOFF="PO") S ^(7)=^ESP(912.4,ESPIEN,1,ESPINS,7)+1 QUIT
. I ESPOFF="O" S ^(8)=^ESP(912.4,ESPIEN,1,ESPINS,8)+1 QUIT
. I ESPOFF="P" S ^(9)=^ESP(912.4,ESPIEN,1,ESPINS,9)+1 QUIT
. I ESPOFF="V" S ^(11)=^ESP(912.4,ESPIEN,1,ESPINS,11)+1 QUIT
. S ^(10)=^ESP(912.4,ESPIEN,1,ESPINS,10)+1
QUIT
BURG ;BURGLARY TOTALS
S ^(18)=^ESP(912.4,ESPIEN,1,ESPINS,18)+1
I ESPTYPE=6 S ^(19)=^ESP(912.4,ESPIEN,1,ESPINS,19)+1 D DOL QUIT
I ESPTYPE=7 S ^(20)=^ESP(912.4,ESPIEN,1,ESPINS,20)+1 D DOL QUIT
I ESPTYPE=8 S ^(21)=^ESP(912.4,ESPIEN,1,ESPINS,21)+1 D DOL QUIT
I ESPTYPE=9 S ^(22)=^ESP(912.4,ESPIEN,1,ESPINS,22)+1 D DOL QUIT
I ESPTYPE=10 S ^(23)=^ESP(912.4,ESPIEN,1,ESPINS,23)+1 D DOL QUIT
I ESPTYPE=11 S ^(24)=^ESP(912.4,ESPIEN,1,ESPINS,24)+1 D DOL QUIT
I ESPTYPE=12 S ^(25)=^ESP(912.4,ESPIEN,1,ESPINS,25)+1 D DOL QUIT
QUIT
DOL ;ADD DOLLAR TOTALS
S ESPDOL=0
F ESPX=1:1 S ESPDOL=$O(^ESP(912,ESPOFN,90,ESPDOL)) Q:ESPDOL'>0 D
. S ^ESP(912.4,ESPIEN,1,ESPINS,26)=^ESP(912.4,ESPIEN,1,ESPINS,26)+$P($G(^ESP(912,ESPOFN,90,ESPDOL,0)),U,3)
. S ^ESP(912.4,ESPIEN,1,ESPINS,27)=^ESP(912.4,ESPIEN,1,ESPINS,27)+$P($G(^ESP(912,ESPOFN,90,ESPDOL,0)),U,4)
QUIT
CONT ;CONTRABAND TOTALS
OFC ;CONTRABAND OFFENDER TOTALS
S ESPOF=0
F ESPX=1:1 S ESPOF=$O(^ESP(912,ESPOFN,40,ESPOF)) Q:ESPOF'>0 D
. S ESPOFF=$P(^ESP(912,ESPOFN,40,ESPOF,0),U,11),^(28)=^ESP(912.4,ESPIEN,1,ESPINS,28)+1 D
.. ;ALCOHOL CONTRABAND
.. I ESPTYPE=13 D
... I ESPSUB=1 S ^(34)=^ESP(912.4,ESPIEN,1,ESPINS,34)+1 QUIT
... I ESPSUB=2 S ^(35)=^ESP(912.4,ESPIEN,1,ESPINS,35)+1 QUIT
... I ESPSUB=3 S ^(36)=^ESP(912.4,ESPIEN,1,ESPINS,36)+1
.. ;DRUG CONTRABAND
.. I ESPTYPE=14 D
... I ESPSUB=4 S ^(29)=^ESP(912.4,ESPIEN,1,ESPINS,29)+1 QUIT
... I ESPSUB=5 S ^(30)=^ESP(912.4,ESPIEN,1,ESPINS,30)+1 QUIT
... I ESPSUB=6 S ^(31)=^ESP(912.4,ESPIEN,1,ESPINS,31)+1 QUIT
... I ESPSUB=7 S ^(32)=^ESP(912.4,ESPIEN,1,ESPINS,32)+1 QUIT
... I ESPSUB=8 S ^(33)=^ESP(912.4,ESPIEN,1,ESPINS,33)+1 QUIT
.. ;WEAPON CONTRABAND
.. I ESPTYPE=15 D
... I ESPSUB=35 S ^(37)=^ESP(912.4,ESPIEN,1,ESPINS,37)+1 QUIT
... I ESPSUB=36 S ^(38)=^ESP(912.4,ESPIEN,1,ESPINS,38)+1 QUIT
... I ESPSUB=37 S ^(39)=^ESP(912.4,ESPIEN,1,ESPINS,39)+1 QUIT
... I ESPSUB=38 S ^(40)=^ESP(912.4,ESPIEN,1,ESPINS,40)+1 QUIT
. I ESPOFF="E"!(ESPOFF="PO") S ^(41)=^ESP(912.4,ESPIEN,1,ESPINS,41)+1 QUIT
. I ESPOFF="O" S ^(42)=^ESP(912.4,ESPIEN,1,ESPINS,42)+1 QUIT
. I ESPOFF="P" S ^(43)=^ESP(912.4,ESPIEN,1,ESPINS,43)+1 QUIT
. I ESPOFF="V" S ^(45)=^ESP(912.4,ESPIEN,1,ESPINS,45)+1 QUIT
. S ^(44)=^ESP(912.4,ESPIEN,1,ESPINS,44)+1
QUIT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HESPUCR1 4487 printed Oct 16, 2024@18:31:32 Page 2
ESPUCR1 ;DALISC/CKA - UNIFORM CRIME REPORT COUNT AND GET TOTALS- 1/92
+1 ;;1.0;POLICE & SECURITY;;Mar 31, 1994
EN ;CALLED FROM ESPUCR
QUIT
SET ;CALLED FROM ESPUCR TO ADD CRIME REPORT TOTALS IN CRIME DATA FILE
+1 SET ESPCL=^ESP(912,ESPOFN,10,ESPCN,0)
SET ESPCC=$PIECE(ESPCL,U)
SET ESPTYPE=$PIECE(ESPCL,U,2)
SET ESPSUB=$PIECE(ESPCL,U,3)
+2 IF ESPCC=1
DO ASLT
QUIT
+3 IF ESPCC=2
DO BURG
QUIT
+4 IF ESPCC=3
DO CONT
QUIT
+5 IF ESPCC=4
DO DIST^ESPUCR2
QUIT
+6 IF ESPCC=5
DO MUR^ESPUCR2
QUIT
+7 IF ESPCC=6
DO NON^ESPUCR2
QUIT
+8 IF ESPCC=7
DO OTH^ESPUCR2
QUIT
+9 IF ESPCC=8
DO RAPE^ESPUCR3
QUIT
+10 IF ESPCC=9
DO ROBB^ESPUCR3
QUIT
+11 IF ESPCC=10
DO STOP^ESPUCR4
QUIT
+12 IF ESPCC=11
DO THEFT^ESPUCR4
QUIT
+13 IF ESPCC=12
DO VAND^ESPUCR5
QUIT
+14 IF ESPCC=13
DO VICE^ESPUCR5
QUIT
+15 IF ESPCC=14
DO VIO^ESPUCR5
QUIT
EXIT QUIT
ASLT ;ASSAULT TOTALS
OF ; COUNT VICTIMS AND OFFENDERS
+1 SET ESPVIC=0
+2 FOR ESPX=1:1
SET ESPVIC=$ORDER(^ESP(912,ESPOFN,30,ESPVIC))
if ESPVIC'>0
QUIT
Begin DoDot:1
+3 SET ESPVICT=$PIECE(^ESP(912,ESPOFN,30,ESPVIC,0),U,5)
SET ^(1)=^ESP(912.4,ESPIEN,1,ESPINS,1)+1
Begin DoDot:2
+4 IF ESPTYPE=1
SET ^(2)=^ESP(912.4,ESPIEN,1,ESPINS,2)+1
QUIT
+5 IF ESPTYPE=2
SET ^(3)=^ESP(912.4,ESPIEN,1,ESPINS,3)+1
QUIT
+6 IF ESPTYPE=3
SET ^(4)=^ESP(912.4,ESPIEN,1,ESPINS,4)+1
QUIT
+7 IF ESPTYPE=4
SET ^(5)=^ESP(912.4,ESPIEN,1,ESPINS,5)+1
QUIT
+8 IF ESPTYPE=5
SET ^(6)=^ESP(912.4,ESPIEN,1,ESPINS,6)+1
QUIT
End DoDot:2
+9 IF ESPVICT="E"
SET ^(12)=^ESP(912.4,ESPIEN,1,ESPINS,12)+1
QUIT
+10 IF ESPVICT="PO"
SET ^(13)=^ESP(912.4,ESPIEN,1,ESPINS,13)+1
QUIT
+11 IF ESPVICT="O"
SET ^(14)=^ESP(912.4,ESPIEN,1,ESPINS,14)+1
QUIT
+12 IF ESPVICT="P"
SET ^(15)=^ESP(912.4,ESPIEN,1,ESPINS,15)+1
QUIT
+13 IF ESPVICT="V"
SET ^(17)=^ESP(912.4,ESPIEN,1,ESPINS,17)+1
QUIT
+14 SET ^(16)=^ESP(912.4,ESPIEN,1,ESPINS,16)+1
End DoDot:1
+15 IF $DATA(^ESP(912,ESPOFN,30))
DO OFFE
+16 QUIT
OFFE ;COUNT OFFENDERS
+1 SET ESPOF=0
+2 FOR ESPX=1:1
SET ESPOF=$ORDER(^ESP(912,ESPOFN,40,ESPOF))
if ESPOF'>0
QUIT
Begin DoDot:1
+3 SET ESPOFF=$PIECE(^ESP(912,ESPOFN,40,ESPOF,0),U,11)
+4 IF ESPOFF="E"!(ESPOFF="PO")
SET ^(7)=^ESP(912.4,ESPIEN,1,ESPINS,7)+1
QUIT
+5 IF ESPOFF="O"
SET ^(8)=^ESP(912.4,ESPIEN,1,ESPINS,8)+1
QUIT
+6 IF ESPOFF="P"
SET ^(9)=^ESP(912.4,ESPIEN,1,ESPINS,9)+1
QUIT
+7 IF ESPOFF="V"
SET ^(11)=^ESP(912.4,ESPIEN,1,ESPINS,11)+1
QUIT
+8 SET ^(10)=^ESP(912.4,ESPIEN,1,ESPINS,10)+1
End DoDot:1
+9 QUIT
BURG ;BURGLARY TOTALS
+1 SET ^(18)=^ESP(912.4,ESPIEN,1,ESPINS,18)+1
+2 IF ESPTYPE=6
SET ^(19)=^ESP(912.4,ESPIEN,1,ESPINS,19)+1
DO DOL
QUIT
+3 IF ESPTYPE=7
SET ^(20)=^ESP(912.4,ESPIEN,1,ESPINS,20)+1
DO DOL
QUIT
+4 IF ESPTYPE=8
SET ^(21)=^ESP(912.4,ESPIEN,1,ESPINS,21)+1
DO DOL
QUIT
+5 IF ESPTYPE=9
SET ^(22)=^ESP(912.4,ESPIEN,1,ESPINS,22)+1
DO DOL
QUIT
+6 IF ESPTYPE=10
SET ^(23)=^ESP(912.4,ESPIEN,1,ESPINS,23)+1
DO DOL
QUIT
+7 IF ESPTYPE=11
SET ^(24)=^ESP(912.4,ESPIEN,1,ESPINS,24)+1
DO DOL
QUIT
+8 IF ESPTYPE=12
SET ^(25)=^ESP(912.4,ESPIEN,1,ESPINS,25)+1
DO DOL
QUIT
+9 QUIT
DOL ;ADD DOLLAR TOTALS
+1 SET ESPDOL=0
+2 FOR ESPX=1:1
SET ESPDOL=$ORDER(^ESP(912,ESPOFN,90,ESPDOL))
if ESPDOL'>0
QUIT
Begin DoDot:1
+3 SET ^ESP(912.4,ESPIEN,1,ESPINS,26)=^ESP(912.4,ESPIEN,1,ESPINS,26)+$PIECE($GET(^ESP(912,ESPOFN,90,ESPDOL,0)),U,3)
+4 SET ^ESP(912.4,ESPIEN,1,ESPINS,27)=^ESP(912.4,ESPIEN,1,ESPINS,27)+$PIECE($GET(^ESP(912,ESPOFN,90,ESPDOL,0)),U,4)
End DoDot:1
+5 QUIT
CONT ;CONTRABAND TOTALS
OFC ;CONTRABAND OFFENDER TOTALS
+1 SET ESPOF=0
+2 FOR ESPX=1:1
SET ESPOF=$ORDER(^ESP(912,ESPOFN,40,ESPOF))
if ESPOF'>0
QUIT
Begin DoDot:1
+3 SET ESPOFF=$PIECE(^ESP(912,ESPOFN,40,ESPOF,0),U,11)
SET ^(28)=^ESP(912.4,ESPIEN,1,ESPINS,28)+1
Begin DoDot:2
+4 ;ALCOHOL CONTRABAND
+5 IF ESPTYPE=13
Begin DoDot:3
+6 IF ESPSUB=1
SET ^(34)=^ESP(912.4,ESPIEN,1,ESPINS,34)+1
QUIT
+7 IF ESPSUB=2
SET ^(35)=^ESP(912.4,ESPIEN,1,ESPINS,35)+1
QUIT
+8 IF ESPSUB=3
SET ^(36)=^ESP(912.4,ESPIEN,1,ESPINS,36)+1
End DoDot:3
+9 ;DRUG CONTRABAND
+10 IF ESPTYPE=14
Begin DoDot:3
+11 IF ESPSUB=4
SET ^(29)=^ESP(912.4,ESPIEN,1,ESPINS,29)+1
QUIT
+12 IF ESPSUB=5
SET ^(30)=^ESP(912.4,ESPIEN,1,ESPINS,30)+1
QUIT
+13 IF ESPSUB=6
SET ^(31)=^ESP(912.4,ESPIEN,1,ESPINS,31)+1
QUIT
+14 IF ESPSUB=7
SET ^(32)=^ESP(912.4,ESPIEN,1,ESPINS,32)+1
QUIT
+15 IF ESPSUB=8
SET ^(33)=^ESP(912.4,ESPIEN,1,ESPINS,33)+1
QUIT
End DoDot:3
+16 ;WEAPON CONTRABAND
+17 IF ESPTYPE=15
Begin DoDot:3
+18 IF ESPSUB=35
SET ^(37)=^ESP(912.4,ESPIEN,1,ESPINS,37)+1
QUIT
+19 IF ESPSUB=36
SET ^(38)=^ESP(912.4,ESPIEN,1,ESPINS,38)+1
QUIT
+20 IF ESPSUB=37
SET ^(39)=^ESP(912.4,ESPIEN,1,ESPINS,39)+1
QUIT
+21 IF ESPSUB=38
SET ^(40)=^ESP(912.4,ESPIEN,1,ESPINS,40)+1
QUIT
End DoDot:3
End DoDot:2
+22 IF ESPOFF="E"!(ESPOFF="PO")
SET ^(41)=^ESP(912.4,ESPIEN,1,ESPINS,41)+1
QUIT
+23 IF ESPOFF="O"
SET ^(42)=^ESP(912.4,ESPIEN,1,ESPINS,42)+1
QUIT
+24 IF ESPOFF="P"
SET ^(43)=^ESP(912.4,ESPIEN,1,ESPINS,43)+1
QUIT
+25 IF ESPOFF="V"
SET ^(45)=^ESP(912.4,ESPIEN,1,ESPINS,45)+1
QUIT
+26 SET ^(44)=^ESP(912.4,ESPIEN,1,ESPINS,44)+1
End DoDot:1
+27 QUIT