VistA-WorldVistAEHR/r/POLICE_AND_SECURITY-ES/ESPJOU1.m

43 lines
1.4 KiB
Mathematica

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