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

KMPUTL1.m

Go to the documentation of this file.
  1. KMPUTL1 ;SF/RAK - Capacity Management Date Range Utility ; 11/19/98
  1. ;;1.0
  1. DATERNG(KMPUY,KMPUSTR,KMPUEND) ;-- date range
  1. ;---------------------------------------------------------------------
  1. ; KMPUY..... Value returned in four pieces:
  1. ; fmstartdate^fmenddate^ouputstartdate^outputenddate
  1. ;
  1. ; Piece one and two are the date ranges in fileman format.
  1. ; Piece three and four are the same dates in output format:
  1. ; dy-Mon-yr
  1. ;
  1. ; ********
  1. ; * NOTE *
  1. ; ********
  1. ; - The first piece will always be the earliest date entered.
  1. ;
  1. ; Optional Parameters:
  1. ;
  1. ; KMPUSTR... If defined, the earliest date that may be selected.
  1. ; (must be in fileman format)
  1. ;
  1. ; KMPUEND... If defined, the latest date that may be selected.
  1. ; (must be in fileman format)
  1. ;-----------------------------------------------------------------------
  1. ;
  1. N DATE1,DATE2,DIR,DIRUT,LINE,X,Y
  1. ;
  1. S KMPUY="",KMPUSTR=$G(KMPUSTR),KMPUEND=$G(KMPUEND)
  1. ;
  1. RANGE ;-- Ask date ranges
  1. S DIR(0)="DOA^"_$S(KMPUSTR:KMPUSTR,1:"")_":"_$S(KMPUEND:KMPUEND,1:"")_":E)"
  1. S DIR("A")="Start with Date: "
  1. S:KMPUSTR DIR("B")=$$FMTE^XLFDT(KMPUSTR,2)
  1. S DIR("?")=" "
  1. S DIR("?",1)="Enter the starting date.",LINE=2
  1. ; if starting date.
  1. I KMPUSTR D
  1. .S DIR("?",LINE)="Date must not precede "_$$FMTE^XLFDT(KMPUSTR)
  1. .S LINE=LINE+1
  1. ; if ending date.
  1. I KMPUEND S DIR("?",LINE)="Date must not follow "_$$FMTE^XLFDT(KMPUEND)
  1. W ! D ^DIR I $D(DIRUT) S KMPUY="" Q
  1. S DATE1=Y
  1. S DIR("A")=" End with Date: "
  1. S:KMPUEND DIR("B")=$$FMTE^XLFDT(KMPUEND,2)
  1. S DIR("?",1)="Enter the ending date."
  1. D ^DIR G:Y="" RANGE I Y="^" S KMPUY="" Q
  1. S DATE2=Y
  1. ; Set earliest date into first piece.
  1. S KMPUY=$S(DATE2<DATE1:DATE2,1:DATE1)_U_$S(DATE2>DATE1:DATE2,1:DATE1)
  1. S $P(KMPUY,U,3)=$$FMTE^XLFDT($P(KMPUY,U))
  1. S $P(KMPUY,U,4)=$$FMTE^XLFDT($P(KMPUY,U,2))
  1. Q