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