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

PXDATE.m

Go to the documentation of this file.
  1. PXDATE ;SLC/PKR - Routines for dealing with dates. ;12/19/2022
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**211,217,234**;Aug 12, 1996;Build 6
  1. ;;
  1. ;================================
  1. EVENTDT(DEFAULT,HELP) ;Edit Event Date and Time.
  1. N EVENTDT,DIRUT,PROMPT
  1. S PROMPT="Event Date and Time"
  1. S EVENTDT=$$GETDT^PXDATE(-1,-1,-1,DEFAULT,PROMPT,HELP)
  1. I $D(DIRUT),(EVENTDT'="@") S PXCEEND=1 Q ""
  1. Q EVENTDT
  1. ;
  1. ;================================
  1. FUTURE(DATE) ;Return 1 if DATE is in the future.
  1. I DATE>$$NOW^XLFDT Q 1
  1. Q 0
  1. ;
  1. ;================================
  1. GETDT(REQTIME,BEFORE,AFTER,DEFAULT,PROMPT,HELP) ;General date/time entry
  1. ;REQTIME is 1 if time is required,
  1. ; 0 if time is optional
  1. ; -1 if the date can be imprecise
  1. ;BEFORE is the maximum number of days before the visit that the date
  1. ; can be or -1 for no limit.
  1. ;AFTER is the maximum number of days after the visit that the date
  1. ; can be or -1 for no limit, except it cannot be in the future.
  1. ;DEFAULT is the default date/time if there is not one in the file.
  1. ; The possible values are NOW or TODAY.
  1. N AFTERDT,BEFOREDT,DIR,VISITDT,X,Y
  1. S VISITDT=$P(^TMP("PXK",$J,"VST",1,0,"BEFORE"),U,1)
  1. S AFTERDT=$S(AFTER=-1:"NOW",1:$$FMADD^XLFDT(VISITDT,-AFTER,0,0,0))
  1. S BEFOREDT=$S(BEFORE=-1:"",1:$$FMADD^XLFDT(VISITDT,BEFORE,0,0,0))
  1. ;Setup the DIR call.
  1. S DIR(0)="DO^"_BEFOREDT_":"_AFTERDT_":ESP"
  1. S REQTIME=$G(REQTIME)
  1. S DIR(0)=DIR(0)_$S(REQTIME=1:"RX",REQTIME=-1:"T",REQTIME=0:"TX",1:"")
  1. S DIR("A")=PROMPT
  1. S DIR("B")=$$FMTE^XLFDT(DEFAULT,"5Z")
  1. I $G(HELP)'="" S DIR("??")="^"_HELP
  1. D ^DIR
  1. I X="@" S Y="@"
  1. I X="^" S Y=DEFAULT
  1. Q Y
  1. ;
  1. ;================================
  1. ISLEAP(YEAR) ;Given a 3 digit FileMan year return 1 if it is a leap year,
  1. ;0 otherwise.
  1. S YEAR=YEAR+1700
  1. Q (YEAR#4=0)&'(YEAR#100=0)!(YEAR#400=0)
  1. ;
  1. ;================================
  1. VFMDATE(X,%DT) ;Is X a valid FileMan date?
  1. N Y
  1. D ^%DT
  1. Q Y
  1. ;