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

PRCPURS2.m

Go to the documentation of this file.
  1. PRCPURS2 ;WISC/RFJ-select dates ;24 May 93
  1. ;;5.1;IFCAP;**84**;Oct 20, 2000
  1. ;Per VHA Directive 10-93-142, this routine should not be modified.
  1. Q
  1. ;
  1. ;
  1. DATESEL(V1) ; select starting and ending dates in days
  1. ; returns datestrt and dateend
  1. N %,%DT,%H,%I,DEFAULT,X,Y
  1. K DATEEND,DATESTRT
  1. START S Y=$E(DT,1,5)_"01" D DD^%DT S DEFAULT=Y
  1. S %DT("A")="Start with "_$S(V1'="":V1_" ",1:"")_"Date: ",%DT("B")=DEFAULT,%DT="AEP",%DT(0)=-DT D ^%DT I Y<0 Q
  1. I $E(Y,6,7)="00" S Y=$E(Y,1,5)_"01"
  1. S DATESTRT=Y
  1. S Y=DT D DD^%DT S DEFAULT=Y
  1. S %DT("A")=" End with "_$S(V1'="":V1_" ",1:"")_"Date: ",%DT("B")=DEFAULT,%DT="AEP",%DT(0)=-DT D ^%DT I Y<0 Q
  1. I $E(Y,6,7)="00" S Y=$E(Y,1,5)_"01"
  1. I Y<DATESTRT W !,"END DATE MUST BE GREATER THAN OR EQUAL TO THE START DATE.",! G START
  1. S DATEEND=Y,Y=DATESTRT D DD^%DT
  1. W !?5,"*** Selected date range from ",Y," to " S Y=DATEEND D DD^%DT W Y," ***"
  1. Q
  1. ;
  1. ;
  1. MONTHSEL ; select starting and ending dates in months
  1. ; returns datestrt and dateend
  1. ; modified 5/27/05 to actually restrict selections to month & year
  1. ; and return DATESTRT as 1st of beginning month and DATEEND as last day of ending month. - T. Holloway
  1. N %,%DT,%H,%I,DEFAULT,PRCLP,PRCMN,X,Y
  1. K DATEEND,DATESTRT
  1. START1 S X1=DT,X2=-90 D C^%DTC S Y=$E(X,1,5)_"00" D DD^%DT S DEFAULT=Y
  1. S %DT("A")="Start with Date: ",%DT("B")=DEFAULT,%DT="AEPM",%DT(0)=-DT D ^%DT I Y<0 Q
  1. S DATESTRT=Y
  1. S Y=$E(DT,1,5)_"00" D DD^%DT S DEFAULT=Y
  1. S %DT("A")=" End with Date: ",%DT("B")=DEFAULT,%DT="AEPM",%DT(0)=-DT D ^%DT I Y<0 Q
  1. I Y<DATESTRT W !,"END DATE MUST BE GREATER THAN OR EQUAL TO THE START DATE.",! G START1
  1. S PRCLP=$$LEAP^DIDTC($E(Y,1,3)),PRCMN=+$E(Y,4,5),DATESTRT=DATESTRT+1
  1. S DATEEND=$E(Y,1,5)_$P("31^28^31^30^31^30^31^31^30^31^30^31","^",PRCMN) ; set end date to last day of month
  1. S:PRCMN=2 DATEEND=DATEEND+PRCLP ; if February and Leap Year, add 1 to get 29th
  1. S:DATEEND>DT DATEEND=DT-1 ; if end month is current month, set DATEEND to yesterday
  1. I $E(DATEEND,6,7)="00" W !," You may not include the current month until at least 1 full day",!," has passed.",! G START1
  1. S Y=DATESTRT D DD^%DT
  1. W !?5,"*** Selected date range from ",Y," to " S Y=DATEEND D DD^%DT W Y," ***"
  1. Q