source: WorldVistAEHR/trunk/r/POLICE_AND_SECURITY-ES/ESP122P2.m@ 972

Last change on this file since 972 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 6.0 KB
Line 
1ESP122P2 ;ALB/JAP; POST-INSTALL FOR ES*1*22 cont.;3/98
2 ;;1.0;POLICE & SECURITY;**22**;Mar 31, 1994
3 ;
4MANUAL ;user update of file #912 entries (manual)
5 N X,Y,DIC,DTOUT,DUOUT,ESPOUT,LN,ESIEN,ESN
6 S $P(LN,"=",80)=""
7 ;subtype conversion array - these are the only changes allowed
8 S ESPCNV("ABOVE $100 (GOV'T)",1)="39^ABOVE $1000 (GOV'T)"
9 S ESPCNV("ABOVE $100 (GOV'T)",2)="40^BELOW $1000 (GOV'T)"
10 S ESPCNV("ABOVE $100 (PERSONAL)",1)="41^ABOVE $1000 (PERSONAL)"
11 S ESPCNV("ABOVE $100 (PERSONAL)",2)="42^BELOW $1000 (PERSONAL)"
12 S ESPCNV("ABOVE $1000 (GOV'T)",1)="40^BELOW $1000 (GOV'T)"
13 S ESPCNV("BELOW $1000 (GOV'T)",1)="39^ABOVE $1000 (GOV'T)"
14 S ESPCNV("ABOVE $1000 (PERSONAL)",1)="42^BELOW $1000 (PERSONAL)"
15 S ESPCNV("BELOW $1000 (PERSONAL)",1)="41^ABOVE $1000 (PERSONAL)"
16 ;subtype iens
17 S ESPOLD("ABOVE $100 (GOV'T)")=23
18 S ESPOLD("ABOVE $100 (PERSONAL)")=25
19 S ESPOLD("ABOVE $1000 (GOV'T)")=39
20 S ESPOLD("BELOW $1000 (GOV'T)")=40
21 S ESPOLD("ABOVE $1000 (PERSONAL)")=41
22 S ESPOLD("BELOW $1000 (PERSONAL)")=42
23 ;select a file #912 record eligible for conversion/change
24 F S ESPOUT=0 D Q:$D(DTOUT)!($D(DUOUT))!(ESPOUT)
25 .S DIC="^ESP(912,",DIC(0)="AEMNQ"
26 .S DIC("S")="I $P(^ESP(912,Y,0),U,3)>2970930.235959"
27 .D ^DIC
28 .I X="" S ESPOUT=1 Q
29 .Q:Y=-1
30 .S ESIEN=+Y
31 .I ('$D(^XTMP("ESP","CONV",ESIEN)))&('$D(^XTMP("ESP","USER",ESIEN))) D Q
32 ..W !,"That record doesn't need to be converted. Try again...",!! K ESIEN
33 .D DISPLAY Q:ESPOUT
34 .D UPDATE
35 K ESPCNV,ESPOLD
36 Q
37 ;
38DISPLAY ;display file #912 record data
39 D HOME^%ZIS
40 W @IOF
41 S ESPDTR=$P($G(^ESP(912,ESIEN,0)),U,2) Q:ESPDTR=""
42 W !?20,"Patch ES*1*22 Conversion Utility"
43 W !,"File #912 ien: ",ESIEN
44 W ?45,"UOR# ",$E(ESPDTR,2,3),"-",$E(ESPDTR,4,5),"-",$E(ESPDTR,6,7),"-",$TR($E($P(ESPDTR,".",2)_"ZZZZ",1,4),"Z",0)
45 K ^UTILITY("DIQ1",$J)
46 S DIC="^ESP(912,",DA=ESIEN,DR=".02;.03;.04;.06;.08;5.02;5.05;5.06;6.01;6.02",DIQ(0)="E" D EN^DIQ1 Q:'$D(^UTILITY("DIQ1",$J,912,DA))
47 W !,"DATE/TIME RECEIVED: ",$G(^UTILITY("DIQ1",$J,912,DA,.02,"E"))
48 W !,"DATE/TIME OF OFFENSE: ",$G(^UTILITY("DIQ1",$J,912,DA,.03,"E"))
49 W !,"LOCATION: ",$G(^UTILITY("DIQ1",$J,912,DA,.04,"E"))
50 W !,"INVESTIGATING OFFICER: ",$G(^UTILITY("DIQ1",$J,912,DA,.06,"E"))
51 W !,"CASE STATUS: ",$G(^UTILITY("DIQ1",$J,912,DA,.08,"E"))
52 W ?45,"COMPLETED FLAG: ",$G(^UTILITY("DIQ1",$J,912,DA,5.02,"E"))
53 S FLAG=$G(^UTILITY("DIQ1",$J,912,DA,5.05,"E")) D
54 .Q:FLAG="" Q:FLAG["NONE"
55 .W !,"DELETED/REOPENED FLAG: ",FLAG
56 .I $E(FLAG,1)="D" W ?45,"DATE/TIME: ",$G(^UTILITY("DIQ1",$J,912,DA,5.06,"E"))
57 .I ($E(FLAG,1)="R")&($D(^UTILITY("DIQ1",$J,912,DA,6.02,"E"))) W ?45,"DATE/TIME: ",^UTILITY("DIQ1",$J,912,DA,6.02,"E"),!?45,"PREVIOUS ID#: ",$G(^UTILITY("DIQ1",$J,912,DA,6.01,"E"))
58 W !,"LOST/STOLEN PROPERTY:"
59 I $D(^ESP(912,ESIEN,90)) D
60 .S ESL=0 F S ESL=$O(^ESP(912,ESIEN,90,ESL)) Q:ESL="" D
61 ..S DIC="^ESP(912,"_ESIEN_",90,",DA=ESL,DR=".01;.03",DIQ(0)="E" D EN^DIQ1 Q:'$D(^UTILITY("DIQ1",$J,912.1,DA))
62 ..W !?5,$G(^UTILITY("DIQ1",$J,912.1,DA,.01,"E"))
63 ..W ?45,"LOSS: $",$G(^UTILITY("DIQ1",$J,912.1,DA,.03,"E"))
64 I '$D(^ESP(912,ESIEN,90)) D
65 .W !?5,"(No information available.)"
66 K ESN S ESN=0 F S ESN=$O(^ESP(912,ESIEN,10,ESN)) Q:ESN="" D
67 .S (ESOLD,ESUSER,ESCNVDT)=0,ESOLDNM=""
68 .S ESOLD=$P($G(^XTMP("ESP","CONV",ESIEN,ESN)),U,1)
69 .I ESOLD S ESUSER=$P($G(^XTMP("ESP","CONV",ESIEN,ESN)),U,3),ESCNVDT=$P($G(^XTMP("ESP","CONV",ESIEN,ESN)),U,4)
70 .S DIC="^ESP(912,"_ESIEN_",10,",DA=ESN,DR=".01;.02;.03",DIQ(0)="E" D EN^DIQ1 Q:'$D(^UTILITY("DIQ1",$J,912.01,DA,.01,"E"))
71 .I $D(^XTMP("ESP","CONV",ESIEN,ESN)) S ESN(ESN)=$G(^UTILITY("DIQ1",$J,912.01,DA,.03,"E"))
72 .I $D(^XTMP("ESP","USER",ESIEN,ESN)) S ESN(ESN)=$G(^UTILITY("DIQ1",$J,912.01,DA,.03,"E"))
73 .I ESOLD D
74 ..S NUM="("_ESN_") ",NUML=$L(NUM)
75 ..W !,NUM_"Classification: ",!?5,$G(^UTILITY("DIQ1",$J,912.01,DA,.01,"E"))
76 ..I $G(^UTILITY("DIQ1",$J,912.01,DA,.02,"E"))]"" W "/",^("E")
77 ..I $G(^UTILITY("DIQ1",$J,912.01,DA,.03,"E"))]"" W "/",^("E")
78 ..I ESUSER W !,?NUML,"Converted by: ",$E($P($G(^VA(200,ESUSER,0)),U,1),1,20),?45,"Date/time: ",ESCNVDT
79 .I 'ESOLD D
80 ..S NUM="("_ESN_") ",NUML=$L(NUM)
81 ..W !,NUM_"Classification: ",!?5,$G(^UTILITY("DIQ1",$J,912.01,DA,.01,"E"))
82 ..I $G(^UTILITY("DIQ1",$J,912.01,DA,.02,"E"))]"" W "/",^("E")
83 ..I $G(^UTILITY("DIQ1",$J,912.01,DA,.03,"E"))]"" W "/",^("E")
84 W !,LN,!
85 Q
86 ;
87UPDATE ;allow user to update subtype of subrecord
88 ;variable esien=record, array esn=subrecords which may be converted
89 N DIR,DTOUT,DUOUT,DIRUT,X,Y,SUBTYPE,NUM,NEWSUB,OLDSUB,ESPOUT,ESPPREV
90 D NOW^%DTC S Y=$E(%,1,12),ESCNVDT=$$FMTE^XLFDT(Y,"5")
91 W !!,"You may modify the following sub-record(s) -- ",!
92 W !?5,"Sub-record #",?25,"Current Subtype"
93 S JJ=0,DIR(0)="LA^",DIR("A")="Select sub-record #: "
94 F S JJ=$O(ESN(JJ)) Q:JJ="" D
95 .S DIR(0)=DIR(0)_","_JJ_","
96 .W !,?8,JJ,?25,ESN(JJ)
97 W ! D ^DIR W ! K DIR
98 Q:$D(DTOUT)!($D(DUOUT))!($D(DIRUT))
99 Q:(X["^")!(Y["^")
100 I '$D(ESN(+Y)) G UPDATE
101 S ESN=+Y,SUBTYPE=ESN(+Y),OLDSUB=ESPOLD(SUBTYPE)
102 ;if more than 1 possible subtype to change to
103 S (ESPOUT,NUM,NEWSUB)=0
104 I $D(ESPCNV(SUBTYPE,2)) F D Q:(NUM)!(ESPOUT)
105 .W !!?5,"The subrecord selected may be converted"
106 .W !?5," to one of the following:",!
107 .W !!?10,"(a) "_$P(ESPCNV(SUBTYPE,1),U,2)
108 .W !?10,"(b) "_$P(ESPCNV(SUBTYPE,2),U,2)
109 .S DIR(0)="SA^A:"_$P(ESPCNV(SUBTYPE,1),U,2)_";B:"_$P(ESPCNV(SUBTYPE,2),U,2)
110 .S DIR("A")="Select (a) or (b): "
111 .W !?5 D ^DIR W ! K DIR
112 .I $D(DTOUT)!($D(DUOUT))!($D(DIRUT)) S ESPOUT=1
113 .I (X["^")!(Y["^") S ESPOUT=1
114 .I Y="A" S NUM=1
115 .I Y="B" S NUM=2
116 Q:ESPOUT
117 ;if only 1 possible subtype to change to
118 I '$D(ESPCNV(SUBTYPE,2)) S NUM=1
119 S NEWSUB=$P(ESPCNV(SUBTYPE,NUM),U,1)
120 ;update the subrecord
121 S $P(^ESP(912,ESIEN,10,ESN,0),U,3)=NEWSUB
122 ;keep previous conversion data, if any
123 S ESPPREV=1+$O(^XTMP("ESP","PREV",ESIEN,ESN,""),-1)
124 I $D(^XTMP("ESP","CONV",ESIEN,ESN)) S ^XTMP("ESP","PREV",ESIEN,ESN,ESPPREV)=^XTMP("ESP","CONV",ESIEN,ESN)
125 ;store the conversion data
126 S ^XTMP("ESP","CONV",ESIEN,ESN)=OLDSUB_"^"_NEWSUB_"^"_DUZ_"^"_ESCNVDT
127 ;delete from unreviewed, if necessary
128 K ^XTMP("ESP","USER",ESIEN,ESN)
129 W !!,"...done.",!
130 K X,Y,DIR S DIR(0)="E" D ^DIR K DIR W !!
131 Q
Note: See TracBrowser for help on using the repository browser.