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

FBSHUTL.m

Go to the documentation of this file.
  1. FBSHUTL ;WCIOFO/SAB-STATE HOME UTILITIES ;2/8/1999
  1. ;;3.5;FEE BASIS;**13**;JAN 30, 1995
  1. Q
  1. DOC(FBFR,FBTO,FBDTP1,FBDTP2) ; Days of Care Extrinsic Function
  1. ; Return length (days) of authorization. The authorization TO DATE
  1. ; is not counted unless it is equal to the authorization FROM DATE.
  1. ; If optional period is specified then only the authorization days
  1. ; within the period are counted.
  1. ; input
  1. ; FBFR - authorization FROM DATE (FileMan format)
  1. ; FBTO - authorization TO DATE (FileMan format)
  1. ; FBDTP1 - (optional) start date of period (FileMan format)
  1. ; FBDTP2 - (optional) end date of period (FileMan format)
  1. ; returns length of authorization (days) within optional period
  1. ;
  1. N FBDTC1,FBDTC2,FBQUIT
  1. ;
  1. ; validate input parameters
  1. I FBFR'?7N!(FBTO'?7N)!(FBFR>FBTO) S FBQUIT=1
  1. I $G(FBDTP1)'?7N!($G(FBDTP2)'?7N)!(FBDTP1>FBDTP2) S (FBDTP1,FBDTP2)=""
  1. ;
  1. ; initialize calculation start and end dates as authorization dates
  1. S FBDTC1=FBFR,FBDTC2=FBTO
  1. ;
  1. ; if period specified then check if auth in period and adjust calc dates
  1. I '$G(FBQUIT),FBDTP1]"",FBDTP2]"" D
  1. . I FBFR>FBDTP2 S FBQUIT=1 Q ; not within specified period
  1. . I FBTO<FBDTP1 S FBQUIT=1 Q ; not within specified period
  1. . ; if auth FROM DATE before period then set calculation start date
  1. . ; as 1st day in period
  1. . I FBFR<FBDTP1 S FBDTC1=FBDTP1
  1. . ; if auth TO DATE after period then set calculation end date as
  1. . ; next day after period in order to count through last day in period
  1. . I FBTO>FBDTP2 S FBDTC2=$$FMADD^XLFDT(FBDTP2,1)
  1. ;
  1. ; return days of care (within optional specified period)
  1. ; count as 1 day when auth FROM DATE = TO DATE (special case)
  1. Q $S($G(FBQUIT):0,FBFR=FBTO:1,1:$$FMDIFF^XLFDT(FBDTC2,FBDTC1))
  1. ;
  1. ;FBSHUTL