[613] | 1 | ESPAJE ;ALB/ABR - ADD JOURNAL ENTRY ; 9/24/96
|
---|
| 2 | ;;1.0;POLICE & SECURITY;**17,18,23,24,32,43**;Mar 31, 1994
|
---|
| 3 | ;
|
---|
| 4 | ; This will enable multiple journal entries to be added for the same
|
---|
| 5 | ; time without overwriting one that is in use.
|
---|
| 6 | ;
|
---|
| 7 | N DIC,DA,X,Y,FIRST,REC,TME
|
---|
| 8 | D DATE
|
---|
| 9 | S FIRST=1
|
---|
| 10 | I Y>0 F D ENTRY Q:$G(Y)<0!$D(DUOUT)!$D(DTOUT)
|
---|
| 11 | Q
|
---|
| 12 | DATE ; select date
|
---|
| 13 | S DIC="^ESP(916,",DIC(0)="AEQMZ"
|
---|
| 14 | D ^DIC
|
---|
| 15 | I Y S ESPDAT=+Y,DIC=DIC_ESPDAT_",4,",DIC("P")=$P(^DD(916,5,0),U,2)
|
---|
| 16 | Q
|
---|
| 17 | ;
|
---|
| 18 | ENTRY ;add/edit entry in time multiple
|
---|
| 19 | S DA(1)=ESPDAT,DIC(0)="QAELMZ"
|
---|
| 20 | I FIRST D
|
---|
| 21 | .S DIC("B")=$$LAST(ESPDAT),FIRST=0
|
---|
| 22 | E K DIC("B")
|
---|
| 23 | D ^DIC Q:Y<1
|
---|
| 24 | S (REC,DA)=+Y
|
---|
| 25 | L +^ESP(916,ESPDAT,4,REC):2 I '$T D Q
|
---|
| 26 | . W !!,">>Entry for this time is in use.",!,"To create an additional entry for this time, enter time in quotes."
|
---|
| 27 | . W !," E.g. - ""1300"""
|
---|
| 28 | . W !,"Try later to edit same entry.",!
|
---|
| 29 | EDIT ; edit (add) info to new entry
|
---|
| 30 | S DIE=DIC,DA=+Y,DA(1)=ESPDAT,DR=".01;1;2;3" D ^DIE
|
---|
| 31 | L -^ESP(916,ESPDAT,4,REC)
|
---|
| 32 | Q
|
---|
| 33 | ;
|
---|
| 34 | LAST(ESPDAT) ; get last time for journal entry
|
---|
| 35 | Q:'$G(ESPDAT) ""
|
---|
| 36 | N TIME1,TIME2,ESPT,ESPT1,FCX,FC
|
---|
| 37 | ;
|
---|
| 38 | ; Are start and end times for the journal defined? If so, use them.
|
---|
| 39 | ;
|
---|
| 40 | S ESPT=$G(^ESP(916,ESPDAT,1)),ESPT1=$P($P(ESPT,"^"),"-",4)
|
---|
| 41 | I ESPT S ESPT=$P($P(^ESP(916,ESPDAT,1),"^",2),"-",4)
|
---|
| 42 | I ESPT,ESPT?4N,+ESPT>0&+ESPT<2401 D
|
---|
| 43 | .S ESPT=+$P($P(^ESP(916,ESPDAT,1),"^",2),"-",4)+1
|
---|
| 44 | .S TIME1="",TIME2=""
|
---|
| 45 | .F S TIME1=$O(^ESP(916,ESPDAT,4,"B",TIME1)) Q:TIME1="" D
|
---|
| 46 | ..S X=$S(TIME1<ESPT1:DT+1,1:DT)_"."_TIME1
|
---|
| 47 | ..S:X>TIME2 TIME2=X
|
---|
| 48 | .Q:$G(TIME2)=""
|
---|
| 49 | .S TIME2=$J($P(TIME2,".",2),4),TIME2=$TR(TIME2," ",0)
|
---|
| 50 | ;
|
---|
| 51 | ; If start/end times for journal not defined, assume 0001-2400
|
---|
| 52 | ;
|
---|
| 53 | E D
|
---|
| 54 | .S TIME1=$O(^ESP(916,ESPDAT,4,"B",""),-1)
|
---|
| 55 | .S TIME2=$O(^ESP(916,ESPDAT,4,"B",9999),-1)
|
---|
| 56 | .I (+TIME1)>TIME2 S TIME2=TIME1
|
---|
| 57 | ;
|
---|
| 58 | Q $G(TIME2)
|
---|