VistA-WorldVistAEHR/r/POLICE_AND_SECURITY-ES/ESPOFF1.m

53 lines
3.5 KiB
Mathematica
Raw Permalink Normal View History

2009-11-29 13:37:14 -05:00
ESPOFF1 ;DALISC/CKA - OFFENSE REPORT INPUT - PART 2;9/92
;;1.0;POLICE & SECURITY;**39**;Mar 31, 1994
EN ;Q; Requires ^TMP($J) to be defined
W !!!,"Updating."
STUFF K DD,DO S DIC="^ESP(912,",DIC(0)="L",DLAYGO=912 D OFF^ESPOID D FILE^DICN S ESPOFN=+Y
L +^ESP(912,ESPOFN):1 I '$T W !,"Another user is editing this record!!"
S UOR0=^TMP($J,"UOR",0)
S ^ESP(912,ESPOFN,0)=ESPOFN_"^"_$P(UOR0,U,2,12),^ESP(912,ESPOFN,1)=$G(^TMP($J,"UOR",1))
S $P(^ESP(912,ESPOFN,5),U,2)=0,$P(^ESP(912,ESPOFN,5),U,3)=DUZ,$P(^(5),U,5)=1
CL ;STUFF CLASSIFICATION CODES
F ESPN=0:0 S ESPN=$O(^TMP($J,"UOR","CL",ESPN)) Q:ESPN="" S CL=^(ESPN,0) D
. S:'$D(^ESP(912,ESPOFN,10,0)) ^(0)="^912.01P^^"
. K DD,DO S DIC="^ESP(912,"_ESPOFN_",10,",DIC(0)="L",DLAYGO=912,X=+CL,DA(1)=ESPOFN D FILE^DICN
. S ^ESP(912,ESPOFN,10,ESPN,0)=CL
. ;X-REF
. S DIK="^ESP(912,"_ESPOFN_",20,",DA=ESPN D IX1^DIK K DIK,DA
C ;STUFF COMPLAINANT DATA
F ESPN=0:0 S ESPN=$O(^TMP($J,"UOR","C",ESPN)) Q:ESPN="" S ESPFN=^(ESPN) D
. S:'$D(^ESP(912,ESPOFN,20,0)) ^(0)="^912.03^" K DD,DO S DIC="^ESP(912,"_ESPOFN_",20,",DIC(0)="L",DLAYGO=912,X=ESPN,DA(1)=ESPOFN D FILE^DICN
. S COMP0=$G(^ESP(910,ESPFN,0)),^ESP(912,ESPOFN,20,ESPN,0)=ESPN_"^"_ESPFN_"^"_$P(COMP0,U,4),^ESP(912,ESPOFN,20,ESPN,1)=$G(^ESP(910,ESPFN,1)),^ESP(912,ESPOFN,20,ESPN,2)=$G(^ESP(910,ESPFN,2))
. S DIK="^ESP(912,"_ESPOFN_",20,",DA=ESPN D IX1^DIK K DIK,DA
V ;STUFF VICTIM DATA
F ESPN=0:0 S ESPN=$O(^TMP($J,"UOR","V",ESPN)) Q:ESPN="" S ESPFN=^(ESPN) D
. S:'$D(^ESP(912,ESPOFN,30,0)) ^(0)="^912.04^"
. K DD,DO S DIC="^ESP(912,"_ESPOFN_",30,",DIC(0)="L",DLAYGO=912,X=ESPN,DA(1)=ESPOFN D FILE^DICN
. S VIC0=$G(^ESP(910,ESPFN,0)),^ESP(912,ESPOFN,30,ESPN,0)=ESPN_"^"_ESPFN_"^"_$P(VIC0,U,8)_"^"_$P(VIC0,U,9)_"^"_$P(VIC0,U,4)_"^"_$P(VIC0,U,10)_"^"_$P(VIC0,U,11)
. S ^ESP(912,ESPOFN,30,ESPN,1)=$G(^ESP(910,ESPFN,1))
. S ^ESP(912,ESPOFN,30,ESPN,2)=$G(^ESP(910,ESPFN,2))
. ;MEDICAL TREATMENT
. S %X="^TMP("_$J_",""MT"","_ESPN_",",%Y="^ESP(912,"_ESPOFN_",30,"_ESPN_",10," D %XY^%RCR
. ;X REF
. S DIK="^ESP(912,"_ESPOFN_",30,",DA=ESPN D IX1^DIK K DIK,DA
O ;STUFF OFFENDER DATA
F ESPN=0:0 S ESPN=$O(^TMP($J,"UOR","O",ESPN)) Q:ESPN="" S ESPFN=+^(ESPN),TMPN=^(ESPN) D
. S:'$D(^ESP(912,ESPOFN,40,0)) ^(0)="^912.05^"
. K DD,DO S DIC="^ESP(912,"_ESPOFN_",40,",DIC(0)="L",DLAYGO=912,X=ESPN,DA(1)=ESPOFN D FILE^DICN
. I ESPFN>0 D
.. S OFF0=$G(^ESP(910,ESPFN,0)),OFF3=$G(^(3))
.. S ^ESP(912,ESPOFN,40,ESPN,0)=ESPN_"^"_ESPFN_"^"_$P(OFF0,U,8)_"^"_$P(OFF0,U,9)_"^"_$P(OFF3,U,1)_"^"_$P(OFF3,U,2)_"^"_$P(OFF3,U,3)_"^"_$P(OFF3,U,4)_"^"_$P(OFF3,U,5)_"^"_$P(OFF3,U,6)_"^"_$P(OFF0,U,4)_"^"_$P(OFF0,U,10)_"^"_$P(OFF0,U,11)
.. S ^ESP(912,ESPOFN,40,ESPN,1)=$G(^ESP(910,ESPFN,1)),^ESP(912,ESPOFN,40,ESPN,2)=$G(^ESP(910,ESPFN,2)),^ESP(912,ESPOFN,40,ESPN,3)=^TMP($J,"UOR","OPERS",ESPN)
. E D
.. S ^ESP(912,ESPOFN,40,ESPN,0)=ESPN_"^^^"_$P(TMPN,U,4)_"^"_$P(TMPN,U,5)_"^"_$P(TMPN,U,6)_"^"_$P(TMPN,U,7)_"^"_$P(TMPN,U,8)_"^"_$P(TMPN,U,9)_"^"_$P(TMPN,U,10),^ESP(912,ESPOFN,40,ESPN,3)=^TMP($J,"UOR","OPERS",ESPN)
. ;STUFF OFFENSE CHARGED
. F ESPN1=0:0 S ESPN1=$O(^TMP($J,"UOR","O",ESPN,ESPN1)) Q:ESPN1="" S OFF(ESPN1)=^(ESPN1,0) D
.. S:'$D(^ESP(912,ESPOFN,40,ESPN,10,0)) ^(0)="^912.11P^^"
.. K DD,DO S DIC="^ESP(912,"_ESPOFN_",40,"_ESPN_",10,",DIC(0)="L",DLAYGO=912,DA(2)=ESPOFN,DA(1)=ESPN,DA=ESPN1,X=+^TMP($J,"UOR","O",ESPN,ESPN1,0) D FILE^DICN
.. S $P(^ESP(912,ESPOFN,40,ESPN,10,DA,0),U,2,4)=$P(OFF(ESPN1),U,2,4)
. ;X-REF
. S DIK="^ESP(912,"_ESPOFN_",40,",DA(1)=ESPN,DA=ESPOFN D IX1^DIK K DIK,DA
;
;
G ^ESPOFF2