- FBSHUTL ;WCIOFO/SAB-STATE HOME UTILITIES ;2/8/1999
- ;;3.5;FEE BASIS;**13**;JAN 30, 1995
- Q
- DOC(FBFR,FBTO,FBDTP1,FBDTP2) ; Days of Care Extrinsic Function
- ; Return length (days) of authorization. The authorization TO DATE
- ; is not counted unless it is equal to the authorization FROM DATE.
- ; If optional period is specified then only the authorization days
- ; within the period are counted.
- ; input
- ; FBFR - authorization FROM DATE (FileMan format)
- ; FBTO - authorization TO DATE (FileMan format)
- ; FBDTP1 - (optional) start date of period (FileMan format)
- ; FBDTP2 - (optional) end date of period (FileMan format)
- ; returns length of authorization (days) within optional period
- ;
- N FBDTC1,FBDTC2,FBQUIT
- ;
- ; validate input parameters
- I FBFR'?7N!(FBTO'?7N)!(FBFR>FBTO) S FBQUIT=1
- I $G(FBDTP1)'?7N!($G(FBDTP2)'?7N)!(FBDTP1>FBDTP2) S (FBDTP1,FBDTP2)=""
- ;
- ; initialize calculation start and end dates as authorization dates
- S FBDTC1=FBFR,FBDTC2=FBTO
- ;
- ; if period specified then check if auth in period and adjust calc dates
- I '$G(FBQUIT),FBDTP1]"",FBDTP2]"" D
- . I FBFR>FBDTP2 S FBQUIT=1 Q ; not within specified period
- . I FBTO<FBDTP1 S FBQUIT=1 Q ; not within specified period
- . ; if auth FROM DATE before period then set calculation start date
- . ; as 1st day in period
- . I FBFR<FBDTP1 S FBDTC1=FBDTP1
- . ; if auth TO DATE after period then set calculation end date as
- . ; next day after period in order to count through last day in period
- . I FBTO>FBDTP2 S FBDTC2=$$FMADD^XLFDT(FBDTP2,1)
- ;
- ; return days of care (within optional specified period)
- ; count as 1 day when auth FROM DATE = TO DATE (special case)
- Q $S($G(FBQUIT):0,FBFR=FBTO:1,1:$$FMDIFF^XLFDT(FBDTC2,FBDTC1))
- ;
- ;FBSHUTL
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFBSHUTL 1776 printed Jan 18, 2025@03:01:11 Page 2
- FBSHUTL ;WCIOFO/SAB-STATE HOME UTILITIES ;2/8/1999
- +1 ;;3.5;FEE BASIS;**13**;JAN 30, 1995
- +2 QUIT
- DOC(FBFR,FBTO,FBDTP1,FBDTP2) ; Days of Care Extrinsic Function
- +1 ; Return length (days) of authorization. The authorization TO DATE
- +2 ; is not counted unless it is equal to the authorization FROM DATE.
- +3 ; If optional period is specified then only the authorization days
- +4 ; within the period are counted.
- +5 ; input
- +6 ; FBFR - authorization FROM DATE (FileMan format)
- +7 ; FBTO - authorization TO DATE (FileMan format)
- +8 ; FBDTP1 - (optional) start date of period (FileMan format)
- +9 ; FBDTP2 - (optional) end date of period (FileMan format)
- +10 ; returns length of authorization (days) within optional period
- +11 ;
- +12 NEW FBDTC1,FBDTC2,FBQUIT
- +13 ;
- +14 ; validate input parameters
- +15 IF FBFR'?7N!(FBTO'?7N)!(FBFR>FBTO)
- SET FBQUIT=1
- +16 IF $GET(FBDTP1)'?7N!($GET(FBDTP2)'?7N)!(FBDTP1>FBDTP2)
- SET (FBDTP1,FBDTP2)=""
- +17 ;
- +18 ; initialize calculation start and end dates as authorization dates
- +19 SET FBDTC1=FBFR
- SET FBDTC2=FBTO
- +20 ;
- +21 ; if period specified then check if auth in period and adjust calc dates
- +22 IF '$GET(FBQUIT)
- IF FBDTP1]""
- IF FBDTP2]""
- Begin DoDot:1
- +23 ; not within specified period
- IF FBFR>FBDTP2
- SET FBQUIT=1
- QUIT
- +24 ; not within specified period
- IF FBTO<FBDTP1
- SET FBQUIT=1
- QUIT
- +25 ; if auth FROM DATE before period then set calculation start date
- +26 ; as 1st day in period
- +27 IF FBFR<FBDTP1
- SET FBDTC1=FBDTP1
- +28 ; if auth TO DATE after period then set calculation end date as
- +29 ; next day after period in order to count through last day in period
- +30 IF FBTO>FBDTP2
- SET FBDTC2=$$FMADD^XLFDT(FBDTP2,1)
- End DoDot:1
- +31 ;
- +32 ; return days of care (within optional specified period)
- +33 ; count as 1 day when auth FROM DATE = TO DATE (special case)
- +34 QUIT $SELECT($GET(FBQUIT):0,FBFR=FBTO:1,1:$$FMDIFF^XLFDT(FBDTC2,FBDTC1))
- +35 ;
- +36 ;FBSHUTL