| 1 | FBUCUTL6 ;ALBISC/TET - UTILITY (continued) ;10/28/93  15:56
 | 
|---|
| 2 |  ;;3.5;FEE BASIS;;JAN 30, 1995
 | 
|---|
| 3 |  ;;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 | AUTH(FBUCP,FBUCA) ;determine if authorization file needs updating, based on
 | 
|---|
| 5 |  ;change in disposition or other info impacting authorization
 | 
|---|
| 6 |  ;INPUT:  FBUCP = zero node of 162.7 prior to enter/edit
 | 
|---|
| 7 |  ;        FBUCA = zero node of 162.7 after enter/edit
 | 
|---|
| 8 |  ;OUTPUT:  0 for deletion/1 for addition/2 for change/NULL for no action
 | 
|---|
| 9 |  ;               (if function follows null update file)
 | 
|---|
| 10 |  N FBAUTH I $P(FBUCA,U,11)=$P(FBUCP,U,11) D  G AUTHQ
 | 
|---|
| 11 |  .;if disposition remained the same do further checking for app/app to stabilization claims
 | 
|---|
| 12 |  .;if either auth from/to dates,program,vendor,patient type changed, update auth
 | 
|---|
| 13 |  .;if dx change auth should also be updated (in 3.5 or 4)
 | 
|---|
| 14 |  .I '($P(FBUCA,U,11)=1!($P(FBUCA,U,11)=4)) Q
 | 
|---|
| 15 |  .S FBAUTH=$S($P(FBUCP,U,13,14)'=$P(FBUCA,U,13,14):2,$P(FBUCP,U,2,3)'=$P(FBUCA,U,2,3):2,$P(FBUCP,U,10)'=$P(FBUCA,U,10):2,1:"")
 | 
|---|
| 16 |  .;include dx in future
 | 
|---|
| 17 |  .Q
 | 
|---|
| 18 |  N FBD1,FBD2
 | 
|---|
| 19 |  S FBD1=$P(FBUCP,U,11),FBD2=$P(FBUCA,U,11)
 | 
|---|
| 20 |  I FBD2=1!(FBD2=4) S FBAUTH=$S('FBD1:1,FBD1=1!(FBD1=4):2,1:1)
 | 
|---|
| 21 |  I FBD2=2!(FBD2=3)!(FBD2=5)!('FBD2) S FBAUTH=$S(FBD1=1!(FBD1=4):0,1:"")
 | 
|---|
| 22 |  ;S FBAUTH=$S(FBAUTH=2&($P(FBUCA,U,13,14)=$P(FBUCP,U,13,14)):"",FBAUTH']""&($P(FBUCA,U,13,14)'=$P(FBUCP,U,13,14)):2,1:FBAUTH)
 | 
|---|
| 23 |  I FBAUTH']""!(FBAUTH=2),FBD2=1!(FBD2=4) S FBAUTH=$S($P(FBUCP,U,2,3)'=$P(FBUCA,U,2,3):2,$P(FBUCP,U,10)'=$P(FBUCA,U,10):2,$P(FBUCP,U,13,14)'=$P(FBUCA,U,13,14):2,1:FBAUTH)
 | 
|---|
| 24 | AUTHQ K FBD1,FBD2 Q $G(FBAUTH)
 | 
|---|
| 25 | CKAUTH(FBUCP,FBUCA,FBDA) ;check authorization dates if auth is approved or approved to stabilization
 | 
|---|
| 26 |  ;called after the AFTER event
 | 
|---|
| 27 |  ;check is necessary as these fields are required in order to set up authorization.
 | 
|---|
| 28 |  ;if not there, disposition is reverted back to previous and message sent.
 | 
|---|
| 29 |  ;INPUT:  FBUCP = prior node
 | 
|---|
| 30 |  ;        FBUCA = after node
 | 
|---|
| 31 |  ;        FBDA  = internal entry of u/c in 162.7
 | 
|---|
| 32 |  ;OUPUT:  message to user if disposition has been reverted back
 | 
|---|
| 33 |  ;VARIABLES: BACK = 1 if reverted to another dispo, otherwise '@'
 | 
|---|
| 34 |  ;           FBAFR & FBATO = auth from/to dates
 | 
|---|
| 35 |  ;           FBD1 & FBD2 = pre and post disposition
 | 
|---|
| 36 |  ;           FBAMT = amount approved
 | 
|---|
| 37 |  N BACK,DR,FBAMT,FBD,FBD1,FBD2,FBFR,FBTO
 | 
|---|
| 38 |  I $S($G(FBUCP)']"":1,$G(FBUCA)']"":1,'+$G(FBDA):1,1:0) G CKAUTHQ
 | 
|---|
| 39 |  S FBD1=$P(FBUCP,U,11),FBD2=$P(FBUCA,U,11)
 | 
|---|
| 40 |  ;if disposition is not approved or approve to stab then quit,
 | 
|---|
| 41 |  ; if disp is approv or approv to stab and auth fr/to dates incomplete then quit
 | 
|---|
| 42 |  I $S('(FBD2=1!(FBD2=4)):1,+$P(FBUCA,U,13)&(+$P(FBUCA,U,14)):1,1:0) G CKAUTHQ
 | 
|---|
| 43 |  S BACK=$S(FBD1:1,1:0),FBD=$S(BACK:+$P(FBUCP,U,11),1:"@"),(FBFR,FBTO,FBAMT)=0
 | 
|---|
| 44 |  I BACK,FBD1=1!(FBD1=4) S FBFR=$P(FBUCP,U,13),FBTO=$P(FBUCP,U,14),FBAMT=$P(FBUCP,U,15)
 | 
|---|
| 45 |  E  S:$P(FBUCA,U,13) FBFR="@" S:$P(FBUCA,U,14) FBTO="@" S:$P(FBUCA,U,15) FBAMT="@"
 | 
|---|
| 46 |  ;reset fbuca
 | 
|---|
| 47 |  I FBD'=0 S $P(FBUCA,U,11)=$S(FBD="@":"",1:FBD)
 | 
|---|
| 48 |  I FBFR'=0 S $P(FBUCA,U,13)=$S(FBFR="@":"",1:FBFR)
 | 
|---|
| 49 |  I FBTO'=0 S $P(FBUCA,U,14)=$S(FBTO="@":"",1:FBTO)
 | 
|---|
| 50 |  I FBAMT'=0 S $P(FBUCA,U,15)=$S(FBAMT="@":"",1:FBAMT)
 | 
|---|
| 51 |  ;set to call die & call
 | 
|---|
| 52 |  S DR="S:FBD=""@"" Y=""@1"";10////^S X=FBD;S Y=""@2"";@1;10///@;@2;S:FBFR=0 Y=""@3"";S:FBFR=""@"" Y=""@30"";12///^S X=FBFR;S Y=""@3"";@30;12///@;@3;S:FBTO=0 Y=""@4"";S:FBTO=""@"" Y=""@40"";13///^S X=FBTO S Y=""@4"";@40;13///@;@4"
 | 
|---|
| 53 |  S DR(162.7,1)="S:FBAMT=0 Y=""@99"";S:FBAMT=""@"" Y=""@50"";14///^S X=FBAMT;S Y=""@99"";@50;14///@;@99"
 | 
|---|
| 54 |  D DIE^FBUCUTL2("^FB583(",FBDA,.DR)
 | 
|---|
| 55 |  ;write message
 | 
|---|
| 56 |  W !,*7,"Authorization From/To dates are missing.",!,"Disposition has not been updated.",!,"When entering in this disposition, please include these dates.",!
 | 
|---|
| 57 | CKAUTHQ Q
 | 
|---|