source: WorldVistAEHR/trunk/r/FEE_BASIS-FB/FBSHUTL.m@ 1578

Last change on this file since 1578 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 1.7 KB
RevLine 
[613]1FBSHUTL ;WCIOFO/SAB-STATE HOME UTILITIES ;2/8/1999
2 ;;3.5;FEE BASIS;**13**;JAN 30, 1995
3 Q
4DOC(FBFR,FBTO,FBDTP1,FBDTP2) ; Days of Care Extrinsic Function
5 ; Return length (days) of authorization. The authorization TO DATE
6 ; is not counted unless it is equal to the authorization FROM DATE.
7 ; If optional period is specified then only the authorization days
8 ; within the period are counted.
9 ; input
10 ; FBFR - authorization FROM DATE (FileMan format)
11 ; FBTO - authorization TO DATE (FileMan format)
12 ; FBDTP1 - (optional) start date of period (FileMan format)
13 ; FBDTP2 - (optional) end date of period (FileMan format)
14 ; returns length of authorization (days) within optional period
15 ;
16 N FBDTC1,FBDTC2,FBQUIT
17 ;
18 ; validate input parameters
19 I FBFR'?7N!(FBTO'?7N)!(FBFR>FBTO) S FBQUIT=1
20 I $G(FBDTP1)'?7N!($G(FBDTP2)'?7N)!(FBDTP1>FBDTP2) S (FBDTP1,FBDTP2)=""
21 ;
22 ; initialize calculation start and end dates as authorization dates
23 S FBDTC1=FBFR,FBDTC2=FBTO
24 ;
25 ; if period specified then check if auth in period and adjust calc dates
26 I '$G(FBQUIT),FBDTP1]"",FBDTP2]"" D
27 . I FBFR>FBDTP2 S FBQUIT=1 Q ; not within specified period
28 . I FBTO<FBDTP1 S FBQUIT=1 Q ; not within specified period
29 . ; if auth FROM DATE before period then set calculation start date
30 . ; as 1st day in period
31 . I FBFR<FBDTP1 S FBDTC1=FBDTP1
32 . ; if auth TO DATE after period then set calculation end date as
33 . ; next day after period in order to count through last day in period
34 . I FBTO>FBDTP2 S FBDTC2=$$FMADD^XLFDT(FBDTP2,1)
35 ;
36 ; return days of care (within optional specified period)
37 ; count as 1 day when auth FROM DATE = TO DATE (special case)
38 Q $S($G(FBQUIT):0,FBFR=FBTO:1,1:$$FMDIFF^XLFDT(FBDTC2,FBDTC1))
39 ;
40 ;FBSHUTL
Note: See TracBrowser for help on using the repository browser.