source: WorldVistAEHR/trunk/r/POLICE_AND_SECURITY-ES/ESPOFFE.m@ 1150

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

initial load of WorldVistAEHR

File size: 3.9 KB
Line 
1ESPOFFE ;DALISC/CKA- OFFENSE REPORT EDIT;8/92
2 ;;1.0;POLICE & SECURITY;**3,12,15,21**;Mar 31, 1994
3EN ;The program will check for CHIEF key.
4 ;If don't have key-Must be completed and unconfidential-OR
5 ;If have key- can edit any OPEN report ORC
6 D DT^DICRW S ESPVAR=1
7 I $D(^XUSEC("ESP CHIEF",DUZ)) G ORC
8OR S DIC(0)="QAEMZ",DIC("A")="UOR#: ",DIC("S")="I $D(^(5)),$P(^(5),U,2),'$P(^(5),U,4),$P(^(5),U,5),$P(^(0),U,8)=""O""",DIC="^ESP(912,"
9 D ^DIC
10 G:$D(DTOUT)!($D(DUOUT))!(X="") EXIT
11 G:Y<0 OR S ESPDTR=$P(^ESP(912,+Y,0),U,2),(ESPID,ESPOFN)=+Y
12 G PRT
13ORC S DIC(0)="QAEMZ",DIC("A")="UOR#: ",DIC("S")="I $D(^(5)),$P(^(5),U,5),$P(^(0),U,8)=""O""",DIC="^ESP(912,"
14 D ^DIC G:$D(DTOUT)!($D(DUOUT))!(X="") EXIT G:Y<0 ORC S ESPDTR=$P(^ESP(912,+Y,0),U,2),(ESPID,ESPOFN)=+Y
15PRT ;CALLS ESPORP,ESPORP1,ESPORP2- PRINTS THE REPORT
16Q S %ZIS="Q" D ^%ZIS G:POP EXIT I '$D(IO("Q")) U IO D START^ESPORP G OK
17 S ZTRTN="START^ESPORP",ZTSAVE("ESP*")="",ZTDESC="OFFENSE REPORT" D ^%ZTLOAD,HOME^%ZIS
18 W !!!!
19OK G:ESPVAR=4 CLO
20 S DIR(0)="Y",DIR("A")="Do you want to edit",DIR("B")="YES" D ^DIR K DIR W !!
21 I $D(DTOUT) W $C(7) G EXIT
22 I Y G EDIT
23 ;if ESPVAR=0, report is incomplete, resume editing own
24 ;if ESPVAR=1, report could be incomplete or complete, editing own or any if chief
25 ;if ESPVAR=2, opened a closed report
26 ;if ESPVAR=3, created a report
27 ;if ESPVAR=4, reviewing a completed report
28 I (ESPVAR=0)!(ESPVAR=3) G COMP
29 I ESPVAR=1,$P($G(^ESP(912,ESPOFN,5)),U,2),$D(^XUSEC("ESP CHIEF",DUZ)) G CLO
30 I ESPVAR=1,$D(^XUSEC("ESP CHIEF",DUZ)) G COMP
31 G EXIT
32EDIT ;CALL DIE TO EDIT OFFENSE REPORT
33 S DIE="^ESP(912,",DA=ESPOFN,DR="[ESP OFFENSE REPORT EDIT 1"
34 L +^ESP(912,DA):1 I '$T W !,"Another user is editing this record!!" G EXIT
35 D ^DIE
36 S DIE="^ESP(912,",DA=ESPOFN,DR="[ESP OFFENSE REPORT EDIT 2"
37 D ^DIE
38 S DIE="^ESP(912,",DA=ESPOFN,DR="[ESP OFFENSE REPORT EDIT 3"
39 D ^DIE
40 S DIE="^ESP(912,",DA=ESPOFN,DR="[ESP OFFENSE REPORT 4"
41 D ^DIE
42 S DIE="^ESP(912,",DA=ESPOFN,DR="[ESP OFFENSE REPORT 5"
43 D ^DIE
44 I ESPVAR=0!(ESPVAR=3) G COMP
45 I ESPVAR=1,$P($G(^ESP(912,ESPOFN,5)),U,2),$D(^XUSEC("ESP CHIEF",DUZ)) G CLO
46 I ESPVAR=2 G CLO
47 G EXIT
48COMP ;ASK IF WANT TO COMPLETE REPORT OR NOT
49 W !! S DIR(0)="Y",DIR("A")="Is the report completed",DIR("?")="Answer YES or NO.",DIR("??")="^W !,""Answer NO if you don't wish to complete the report at this time. Answer YES if you do."""
50 D ^DIR K DIR
51 I 'Y!($D(DIRUT)) G EXIT
52 D ^ESPVAL
53 I $P(^ESP(912,ESPOFN,5),U,2) D SEND
54 G EXIT
55CLO ;ASK IF WANT TO CLOSE THE REPORT
56 I ('$D(^XUSEC("ESP CHIEF",DUZ))&'$D(^XUSEC("ESP SUPERVISOR",DUZ))) G EXIT
57 I ESPVAR=4 D SAT I UNSAT G EXIT
58 G:$D(DTOUT) EXIT
59 I '$P(^ESP(912,ESPOFN,5),U,2) W !!,$C(7),"The report must be completed before closing!" G EXIT
60CLO1 ;entry point from 'close an offense report' option
61 S DIR(0)="Y",DIR("A")="Do you want to close the report",DIR("?")="Answer YES or NO.",DIR("??")="^W !,""Answer NO if you don't want to close the report. Answer YES if you do."""
62 D ^DIR K DIR
63 I 'Y!($D(DIRUT)) G EXIT
64 I Y S $P(^ESP(912,ESPOFN,0),U,8)="C" W !!,"The report is now closed."
65 L -^ESP(912,ESPOFN)
66EXIT K %ZIS,DA,DIC,DIE,DIR,DIRUT,DR,DTOUT,DUOUT,ESPDTR,ESPID,ESPN,ESPNO,ESPOFN,ESPVAR,ESPY,POP,UNSAT,Y,ZTDESC,ZTRTN,ZTSAVE Q
67SEND S ESPDTR=$P(^ESP(912,ESPOFN,0),U,2),XMB(1)=$$CONV^ESPUOR(ESPDTR),XMB(2)=$P($G(^VA(200,+$P(^ESP(912,ESPOFN,0),U,6),0)),U),XMB(3)=$P($G(^VA(200,+$P($G(^ESP(912,ESPOFN,5)),U,3),0)),U)
68 S XMB="ESP UOR COMPLETED" D EN^XMB
69 QUIT
70ASK2 ;CALLED FROM ESPOFFC- COMPLETE A REPORT
71 S DIR(0)="Y",DIR("A")="Do you want to print the report first",DIR("B")="NO" D ^DIR K DIR
72 I $D(DTOUT) W $C(7) G EXIT
73 I 'Y G OK
74 G PRT
75SAT ;ASK IF REPORT IS COMPLETED FULLY AND SEND BULLETIN TO OFFICER
76 ;IF ADDITIONAL INFO NEEDED
77 S UNSAT=0
78 S DIR(0)="Y",DIR("A")="Is the report completed fully",DIR("B")="YES" D ^DIR K DIR
79 Q:Y!($D(DIRUT))
80 S ESPDTR=$P(^ESP(912,ESPOFN,0),U,2),XMB(1)=$$CONV^ESPUOR(ESPDTR),XMB="ESP SUPERVISOR REVIEW",XMY($P(^ESP(912,ESPOFN,0),U,6))="" D EN^XMB
81 S UNSAT=1
82 Q
Note: See TracBrowser for help on using the repository browser.