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

ESPAJE.m

Go to the documentation of this file.
  1. ESPAJE ;ALB/ABR - ADD JOURNAL ENTRY ; 9/24/96
  1. ;;1.0;POLICE & SECURITY;**17,18,23,24,32,43**;Mar 31, 1994
  1. ;
  1. ; This will enable multiple journal entries to be added for the same
  1. ; time without overwriting one that is in use.
  1. ;
  1. N DIC,DA,X,Y,FIRST,REC,TME
  1. D DATE
  1. S FIRST=1
  1. I Y>0 F D ENTRY Q:$G(Y)<0!$D(DUOUT)!$D(DTOUT)
  1. Q
  1. DATE ; select date
  1. S DIC="^ESP(916,",DIC(0)="AEQMZ"
  1. D ^DIC
  1. I Y S ESPDAT=+Y,DIC=DIC_ESPDAT_",4,",DIC("P")=$P(^DD(916,5,0),U,2)
  1. Q
  1. ;
  1. ENTRY ;add/edit entry in time multiple
  1. S DA(1)=ESPDAT,DIC(0)="QAELMZ"
  1. I FIRST D
  1. .S DIC("B")=$$LAST(ESPDAT),FIRST=0
  1. E K DIC("B")
  1. D ^DIC Q:Y<1
  1. S (REC,DA)=+Y
  1. L +^ESP(916,ESPDAT,4,REC):2 I '$T D Q
  1. . W !!,">>Entry for this time is in use.",!,"To create an additional entry for this time, enter time in quotes."
  1. . W !," E.g. - ""1300"""
  1. . W !,"Try later to edit same entry.",!
  1. EDIT ; edit (add) info to new entry
  1. S DIE=DIC,DA=+Y,DA(1)=ESPDAT,DR=".01;1;2;3" D ^DIE
  1. L -^ESP(916,ESPDAT,4,REC)
  1. Q
  1. ;
  1. LAST(ESPDAT) ; get last time for journal entry
  1. Q:'$G(ESPDAT) ""
  1. N TIME1,TIME2,ESPT,ESPT1,FCX,FC
  1. ;
  1. ; Are start and end times for the journal defined? If so, use them.
  1. ;
  1. S ESPT=$G(^ESP(916,ESPDAT,1)),ESPT1=$P($P(ESPT,"^"),"-",4)
  1. I ESPT S ESPT=$P($P(^ESP(916,ESPDAT,1),"^",2),"-",4)
  1. I ESPT,ESPT?4N,+ESPT>0&+ESPT<2401 D
  1. .S ESPT=+$P($P(^ESP(916,ESPDAT,1),"^",2),"-",4)+1
  1. .S TIME1="",TIME2=""
  1. .F S TIME1=$O(^ESP(916,ESPDAT,4,"B",TIME1)) Q:TIME1="" D
  1. ..S X=$S(TIME1<ESPT1:DT+1,1:DT)_"."_TIME1
  1. ..S:X>TIME2 TIME2=X
  1. .Q:$G(TIME2)=""
  1. .S TIME2=$J($P(TIME2,".",2),4),TIME2=$TR(TIME2," ",0)
  1. ;
  1. ; If start/end times for journal not defined, assume 0001-2400
  1. ;
  1. E D
  1. .S TIME1=$O(^ESP(916,ESPDAT,4,"B",""),-1)
  1. .S TIME2=$O(^ESP(916,ESPDAT,4,"B",9999),-1)
  1. .I (+TIME1)>TIME2 S TIME2=TIME1
  1. ;
  1. Q $G(TIME2)