ESPJOU1 ;DALISC/RWW - ENHANCED/MODIFIED PRINT DAILY OPERATIONS JOURNAL ;3/93
;;1.0;POLICE & SECURITY;**1,7,12,14,18,32**;Mar 31, 1994
EN ;
D DT^DICRW
JOU S DIC(0)="QAEMZ",DIC("A")="DATE: ",DIC="^ESP(916,"
D ^DIC
G:$D(DTOUT)!($D(DUOUT))!(X="") EXIT
I Y<0 W !,$C(7),"DATE not found. Please try again." G JOU
S ESPID=+Y
Q S %ZIS="Q" D ^%ZIS G:POP EXIT I '$D(IO("Q")) U IO D START G EXIT
S ZTRTN="START^ESPJOU1",ZTSAVE("ESP*")="",ZTDESC="DAILY JOURNAL" D ^%ZTLOAD,HOME^%ZIS
EXIT Q
START ;BEGINS THE PRINT OF THE DAILY JOURNAL
N ESPJOU1
S ESPJOU1=1
D START^ESPJOU
Q
;
;
SORT ;Sorts Daily Journal in Time Sequence
N ESPTIME,ESPTIME2,ESPT,%T
;
; Are start and end times for the journal defined? If so, use them.
;
S ESPT=$G(^ESP(916,ESPID,1))
I ESPT S ESPT=$P($P(ESPT,"^"),"-",4)
I ESPT,ESPT?4N,+ESPT>0&+ESPT<2401 D
.S ESPTIME=""
.F S ESPTIME=$O(^ESP(916,ESPID,4,"B",ESPTIME)) Q:ESPTIME="" D
..S ESPN=""
..F S ESPN=$O(^ESP(916,ESPID,4,"B",ESPTIME,ESPN)) Q:ESPN="" D
...S ESPTIME2=ESPTIME
...I +ESPTIME2<ESPT S ESPTIME2=ESPTIME2+2400
...I $L(ESPTIME2)<4 S ESPTIME2="0"_ESPTIME2
...S ^TMP($J,"ESP",DT_ESPTIME2_$E("0000",1,4-$L(ESPN))_ESPN)=ESPN
;
; If start/end times for journal not defined, assume 0001-2400
;
E D
.F ESPN=0:0 S ESPN=$O(^ESP(916,ESPID,4,ESPN)) Q:ESPN'>0 D
.. S ESPTIME=$P(^ESP(916,ESPID,4,ESPN,0),U),^TMP($J,"ESP"," "_ESPTIME_ESPN)=ESPN
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HESPJOU1 1434 printed Oct 16, 2024@18:30:26 Page 2
ESPJOU1 ;DALISC/RWW - ENHANCED/MODIFIED PRINT DAILY OPERATIONS JOURNAL ;3/93
+1 ;;1.0;POLICE & SECURITY;**1,7,12,14,18,32**;Mar 31, 1994
EN ;
+1 DO DT^DICRW
JOU SET DIC(0)="QAEMZ"
SET DIC("A")="DATE: "
SET DIC="^ESP(916,"
+1 DO ^DIC
+2 if $DATA(DTOUT)!($DATA(DUOUT))!(X="")
GOTO EXIT
+3 IF Y<0
WRITE !,$CHAR(7),"DATE not found. Please try again."
GOTO JOU
+4 SET ESPID=+Y
Q SET %ZIS="Q"
DO ^%ZIS
if POP
GOTO EXIT
IF '$DATA(IO("Q"))
USE IO
DO START
GOTO EXIT
+1 SET ZTRTN="START^ESPJOU1"
SET ZTSAVE("ESP*")=""
SET ZTDESC="DAILY JOURNAL"
DO ^%ZTLOAD
DO HOME^%ZIS
EXIT QUIT
START ;BEGINS THE PRINT OF THE DAILY JOURNAL
+1 NEW ESPJOU1
+2 SET ESPJOU1=1
+3 DO START^ESPJOU
+4 QUIT
+5 ;
+6 ;
SORT ;Sorts Daily Journal in Time Sequence
+1 NEW ESPTIME,ESPTIME2,ESPT,%T
+2 ;
+3 ; Are start and end times for the journal defined? If so, use them.
+4 ;
+5 SET ESPT=$GET(^ESP(916,ESPID,1))
+6 IF ESPT
SET ESPT=$PIECE($PIECE(ESPT,"^"),"-",4)
+7 IF ESPT
IF ESPT?4N
IF +ESPT>0&+ESPT<2401
Begin DoDot:1
+8 SET ESPTIME=""
+9 FOR
SET ESPTIME=$ORDER(^ESP(916,ESPID,4,"B",ESPTIME))
if ESPTIME=""
QUIT
Begin DoDot:2
+10 SET ESPN=""
+11 FOR
SET ESPN=$ORDER(^ESP(916,ESPID,4,"B",ESPTIME,ESPN))
if ESPN=""
QUIT
Begin DoDot:3
+12 SET ESPTIME2=ESPTIME
+13 IF +ESPTIME2<ESPT
SET ESPTIME2=ESPTIME2+2400
+14 IF $LENGTH(ESPTIME2)<4
SET ESPTIME2="0"_ESPTIME2
+15 SET ^TMP($JOB,"ESP",DT_ESPTIME2_$EXTRACT("0000",1,4-$LENGTH(ESPN))_ESPN)=ESPN
End DoDot:3
End DoDot:2
End DoDot:1
+16 ;
+17 ; If start/end times for journal not defined, assume 0001-2400
+18 ;
+19 IF '$TEST
Begin DoDot:1
+20 FOR ESPN=0:0
SET ESPN=$ORDER(^ESP(916,ESPID,4,ESPN))
if ESPN'>0
QUIT
Begin DoDot:2
+21 SET ESPTIME=$PIECE(^ESP(916,ESPID,4,ESPN,0),U)
SET ^TMP($JOB,"ESP"," "_ESPTIME_ESPN)=ESPN
End DoDot:2
End DoDot:1
+22 QUIT