Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ESPOFFE

ESPOFFE.m

Go to the documentation of this file.
  1. ESPOFFE ;DALISC/CKA- OFFENSE REPORT EDIT;8/92
  1. ;;1.0;POLICE & SECURITY;**3,12,15,21**;Mar 31, 1994
  1. EN ;The program will check for CHIEF key.
  1. ;If don't have key-Must be completed and unconfidential-OR
  1. ;If have key- can edit any OPEN report ORC
  1. D DT^DICRW S ESPVAR=1
  1. I $D(^XUSEC("ESP CHIEF",DUZ)) G ORC
  1. OR 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,"
  1. D ^DIC
  1. G:$D(DTOUT)!($D(DUOUT))!(X="") EXIT
  1. G:Y<0 OR S ESPDTR=$P(^ESP(912,+Y,0),U,2),(ESPID,ESPOFN)=+Y
  1. G PRT
  1. ORC S DIC(0)="QAEMZ",DIC("A")="UOR#: ",DIC("S")="I $D(^(5)),$P(^(5),U,5),$P(^(0),U,8)=""O""",DIC="^ESP(912,"
  1. 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
  1. PRT ;CALLS ESPORP,ESPORP1,ESPORP2- PRINTS THE REPORT
  1. Q S %ZIS="Q" D ^%ZIS G:POP EXIT I '$D(IO("Q")) U IO D START^ESPORP G OK
  1. S ZTRTN="START^ESPORP",ZTSAVE("ESP*")="",ZTDESC="OFFENSE REPORT" D ^%ZTLOAD,HOME^%ZIS
  1. W !!!!
  1. OK G:ESPVAR=4 CLO
  1. S DIR(0)="Y",DIR("A")="Do you want to edit",DIR("B")="YES" D ^DIR K DIR W !!
  1. I $D(DTOUT) W $C(7) G EXIT
  1. I Y G EDIT
  1. ;if ESPVAR=0, report is incomplete, resume editing own
  1. ;if ESPVAR=1, report could be incomplete or complete, editing own or any if chief
  1. ;if ESPVAR=2, opened a closed report
  1. ;if ESPVAR=3, created a report
  1. ;if ESPVAR=4, reviewing a completed report
  1. I (ESPVAR=0)!(ESPVAR=3) G COMP
  1. I ESPVAR=1,$P($G(^ESP(912,ESPOFN,5)),U,2),$D(^XUSEC("ESP CHIEF",DUZ)) G CLO
  1. I ESPVAR=1,$D(^XUSEC("ESP CHIEF",DUZ)) G COMP
  1. G EXIT
  1. EDIT ;CALL DIE TO EDIT OFFENSE REPORT
  1. S DIE="^ESP(912,",DA=ESPOFN,DR="[ESP OFFENSE REPORT EDIT 1"
  1. L +^ESP(912,DA):1 I '$T W !,"Another user is editing this record!!" G EXIT
  1. D ^DIE
  1. S DIE="^ESP(912,",DA=ESPOFN,DR="[ESP OFFENSE REPORT EDIT 2"
  1. D ^DIE
  1. S DIE="^ESP(912,",DA=ESPOFN,DR="[ESP OFFENSE REPORT EDIT 3"
  1. D ^DIE
  1. S DIE="^ESP(912,",DA=ESPOFN,DR="[ESP OFFENSE REPORT 4"
  1. D ^DIE
  1. S DIE="^ESP(912,",DA=ESPOFN,DR="[ESP OFFENSE REPORT 5"
  1. D ^DIE
  1. I ESPVAR=0!(ESPVAR=3) G COMP
  1. I ESPVAR=1,$P($G(^ESP(912,ESPOFN,5)),U,2),$D(^XUSEC("ESP CHIEF",DUZ)) G CLO
  1. I ESPVAR=2 G CLO
  1. G EXIT
  1. COMP ;ASK IF WANT TO COMPLETE REPORT OR NOT
  1. 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."""
  1. D ^DIR K DIR
  1. I 'Y!($D(DIRUT)) G EXIT
  1. D ^ESPVAL
  1. I $P(^ESP(912,ESPOFN,5),U,2) D SEND
  1. G EXIT
  1. CLO ;ASK IF WANT TO CLOSE THE REPORT
  1. I ('$D(^XUSEC("ESP CHIEF",DUZ))&'$D(^XUSEC("ESP SUPERVISOR",DUZ))) G EXIT
  1. I ESPVAR=4 D SAT I UNSAT G EXIT
  1. G:$D(DTOUT) EXIT
  1. I '$P(^ESP(912,ESPOFN,5),U,2) W !!,$C(7),"The report must be completed before closing!" G EXIT
  1. CLO1 ;entry point from 'close an offense report' option
  1. 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."""
  1. D ^DIR K DIR
  1. I 'Y!($D(DIRUT)) G EXIT
  1. I Y S $P(^ESP(912,ESPOFN,0),U,8)="C" W !!,"The report is now closed."
  1. L -^ESP(912,ESPOFN)
  1. EXIT K %ZIS,DA,DIC,DIE,DIR,DIRUT,DR,DTOUT,DUOUT,ESPDTR,ESPID,ESPN,ESPNO,ESPOFN,ESPVAR,ESPY,POP,UNSAT,Y,ZTDESC,ZTRTN,ZTSAVE Q
  1. SEND 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)
  1. S XMB="ESP UOR COMPLETED" D EN^XMB
  1. QUIT
  1. ASK2 ;CALLED FROM ESPOFFC- COMPLETE A REPORT
  1. S DIR(0)="Y",DIR("A")="Do you want to print the report first",DIR("B")="NO" D ^DIR K DIR
  1. I $D(DTOUT) W $C(7) G EXIT
  1. I 'Y G OK
  1. G PRT
  1. SAT ;ASK IF REPORT IS COMPLETED FULLY AND SEND BULLETIN TO OFFICER
  1. ;IF ADDITIONAL INFO NEEDED
  1. S UNSAT=0
  1. S DIR(0)="Y",DIR("A")="Is the report completed fully",DIR("B")="YES" D ^DIR K DIR
  1. Q:Y!($D(DIRUT))
  1. 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
  1. S UNSAT=1
  1. Q