IBCNSU31 ;ALB/ARH - INSURANCE UTILITY FILING TIME FRAME ; 09-FEB-09
;;2.0;INTEGRATED BILLING;**399**;21-MAR-94;Build 8
;;Per VHA Directive 2004-038, this routine should not be modified.
;
PTFTF(DFN,IBSDT) ; Patient Filing Time Frame: check if service date is within the Filing Time Frame of the patients insurance
; returns true if the date of service is within the FTF of any of the patients active policies
; medicare is included because some secondaries allow their FTF from the MRA submission rather than DOS
N IBDD,IBPOL,IBPLN,IBCOV S IBCOV=0 G:'$G(DFN) PTFTFQ S IBSDT=$G(IBSDT)\1 I IBSDT'?7N S IBSDT=DT
D ALL^IBCNS1(DFN,"IBDD",4,IBSDT) ; all active insurance policies and medicare
;
S IBPOL=0 F S IBPOL=$O(IBDD(IBPOL)) Q:'IBPOL D Q:IBCOV
. S IBPLN=+$P($G(IBDD(IBPOL,0)),U,18) Q:'IBPLN
. I +$$PLFTF(IBPLN,IBSDT) S IBCOV=1
;
PTFTFQ Q IBCOV
;
PLFTF(IBPLN,IBSDT,IBINS) ; Plan/Company Filing Time Frame: check if service date is within Plan or Company Filing Time Frame and Today
; if both the plan and company have a FTF then plan FTF has precedence and is used
; IBPLN - pointer to plan (355.3), will check both the plan and company FTF
; IBSDT - date of service to determine if FTF has expired, ie. FTF plus the service date is before today
; IBINS - optional, if passed only used if there is no plan company
; returns COV ^ DATE where COV is true if the date is covered, DATE of FTF applied, if any
;
N IBPLN0,IBINS0,IBFDT,IBX,IBCOV S IBFDT="",IBCOV=1
S IBPLN0=$G(^IBA(355.3,+$G(IBPLN),0)) I +IBPLN0 S IBINS=+IBPLN0
S IBINS0=$G(^DIC(36,+$G(IBINS),0)) S IBSDT=$G(IBSDT)\1 I IBSDT'?7N S IBSDT=DT
;
I +$P(IBINS0,U,18) S IBX=$$FTF(+$P(IBINS0,U,18),+$P(IBINS0,U,19),IBSDT) S IBFDT=IBX
I +$P(IBPLN0,U,16) S IBX=$$FTF(+$P(IBPLN0,U,16),+$P(IBPLN0,U,17),IBSDT) S IBFDT=IBX
;
I +IBFDT S IBCOV="1^"_IBFDT I DT>IBFDT S IBCOV="0^"_IBFDT
;
Q IBCOV
;
FTF(IBFTF,IBVAL,IBSDT) ; Filing Time Frame: return date at end of Filing Time Frame from Service Date OR null if none/not known
; IBFTF - pointer to standard FTF in 355.13
; IBVAL - value associated with the FTF
; IBSDT - service date
N IBX,IBYR,IBFYR,IBEND S IBFTF=+$G(IBFTF),IBVAL=+$G(IBVAL),IBSDT=$G(IBSDT)\1 I IBSDT'?7N S IBSDT=DT
S IBFYR=$E(IBSDT,1,3)+1,IBEND="" I 'IBVAL,+$$FTFV(IBFTF) S IBFTF=0
;
I IBFTF=1 S IBX=IBVAL,IBEND=$$FMADD^XLFDT(IBSDT,IBX)
I IBFTF=2 S IBX=IBVAL*30,IBEND=$$FMADD^XLFDT(IBSDT,IBX)
I IBFTF=3 S IBX=IBVAL*365,IBEND=$$FMADD^XLFDT(IBSDT,IBX)
I IBFTF=4 S IBX=IBVAL+365,IBEND=$$FMADD^XLFDT(IBSDT,IBX)
I IBFTF=5 S IBX=IBVAL,IBYR=IBFYR_"0101",IBEND=$$FMADD^XLFDT(IBYR,IBX)
I IBFTF=6 S IBX=IBVAL*30,IBYR=IBFYR_"0101",IBEND=$$FMADD^XLFDT(IBYR,IBX)
I IBFTF=7 S IBYR=IBFYR_"1231",IBEND=IBYR
;
Q IBEND
;
FTFN(IBPLN,IBINS) ; Plan/Company Filing Time Frame Name: return plan or companies standard filing time frame for display
N IBX,IBFTF,IBVAL,IBFTFN S (IBFTFN,IBFTF)=""
I +$G(IBINS) S IBX=$G(^DIC(36,+IBINS,0)) I +$P(IBX,U,18) S IBFTF=+$P(IBX,U,18),IBVAL=+$P(IBX,U,19)
I +$G(IBPLN) S IBX=$G(^IBA(355.3,+IBPLN,0)) I +$P(IBX,U,16) S IBFTF=+$P(IBX,U,16),IBVAL=+$P(IBX,U,17)
;
I +IBFTF S IBFTF=$G(^IBE(355.13,+IBFTF,0)) S IBFTFN=$S(+$P(IBFTF,U,2):IBVAL_" ",1:"")_$P(IBFTF,U,1)
Q IBFTFN
;
FTFV(IBFTF) ; return true if a Standard Filing Time Frame requires a Value
Q +$P($G(^IBE(355.13,+$G(IBFTF),0)),U,2)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCNSU31 3380 printed Oct 16, 2024@18:18:40 Page 2
IBCNSU31 ;ALB/ARH - INSURANCE UTILITY FILING TIME FRAME ; 09-FEB-09
+1 ;;2.0;INTEGRATED BILLING;**399**;21-MAR-94;Build 8
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
PTFTF(DFN,IBSDT) ; Patient Filing Time Frame: check if service date is within the Filing Time Frame of the patients insurance
+1 ; returns true if the date of service is within the FTF of any of the patients active policies
+2 ; medicare is included because some secondaries allow their FTF from the MRA submission rather than DOS
+3 NEW IBDD,IBPOL,IBPLN,IBCOV
SET IBCOV=0
if '$GET(DFN)
GOTO PTFTFQ
SET IBSDT=$GET(IBSDT)\1
IF IBSDT'?7N
SET IBSDT=DT
+4 ; all active insurance policies and medicare
DO ALL^IBCNS1(DFN,"IBDD",4,IBSDT)
+5 ;
+6 SET IBPOL=0
FOR
SET IBPOL=$ORDER(IBDD(IBPOL))
if 'IBPOL
QUIT
Begin DoDot:1
+7 SET IBPLN=+$PIECE($GET(IBDD(IBPOL,0)),U,18)
if 'IBPLN
QUIT
+8 IF +$$PLFTF(IBPLN,IBSDT)
SET IBCOV=1
End DoDot:1
if IBCOV
QUIT
+9 ;
PTFTFQ QUIT IBCOV
+1 ;
PLFTF(IBPLN,IBSDT,IBINS) ; Plan/Company Filing Time Frame: check if service date is within Plan or Company Filing Time Frame and Today
+1 ; if both the plan and company have a FTF then plan FTF has precedence and is used
+2 ; IBPLN - pointer to plan (355.3), will check both the plan and company FTF
+3 ; IBSDT - date of service to determine if FTF has expired, ie. FTF plus the service date is before today
+4 ; IBINS - optional, if passed only used if there is no plan company
+5 ; returns COV ^ DATE where COV is true if the date is covered, DATE of FTF applied, if any
+6 ;
+7 NEW IBPLN0,IBINS0,IBFDT,IBX,IBCOV
SET IBFDT=""
SET IBCOV=1
+8 SET IBPLN0=$GET(^IBA(355.3,+$GET(IBPLN),0))
IF +IBPLN0
SET IBINS=+IBPLN0
+9 SET IBINS0=$GET(^DIC(36,+$GET(IBINS),0))
SET IBSDT=$GET(IBSDT)\1
IF IBSDT'?7N
SET IBSDT=DT
+10 ;
+11 IF +$PIECE(IBINS0,U,18)
SET IBX=$$FTF(+$PIECE(IBINS0,U,18),+$PIECE(IBINS0,U,19),IBSDT)
SET IBFDT=IBX
+12 IF +$PIECE(IBPLN0,U,16)
SET IBX=$$FTF(+$PIECE(IBPLN0,U,16),+$PIECE(IBPLN0,U,17),IBSDT)
SET IBFDT=IBX
+13 ;
+14 IF +IBFDT
SET IBCOV="1^"_IBFDT
IF DT>IBFDT
SET IBCOV="0^"_IBFDT
+15 ;
+16 QUIT IBCOV
+17 ;
FTF(IBFTF,IBVAL,IBSDT) ; Filing Time Frame: return date at end of Filing Time Frame from Service Date OR null if none/not known
+1 ; IBFTF - pointer to standard FTF in 355.13
+2 ; IBVAL - value associated with the FTF
+3 ; IBSDT - service date
+4 NEW IBX,IBYR,IBFYR,IBEND
SET IBFTF=+$GET(IBFTF)
SET IBVAL=+$GET(IBVAL)
SET IBSDT=$GET(IBSDT)\1
IF IBSDT'?7N
SET IBSDT=DT
+5 SET IBFYR=$EXTRACT(IBSDT,1,3)+1
SET IBEND=""
IF 'IBVAL
IF +$$FTFV(IBFTF)
SET IBFTF=0
+6 ;
+7 IF IBFTF=1
SET IBX=IBVAL
SET IBEND=$$FMADD^XLFDT(IBSDT,IBX)
+8 IF IBFTF=2
SET IBX=IBVAL*30
SET IBEND=$$FMADD^XLFDT(IBSDT,IBX)
+9 IF IBFTF=3
SET IBX=IBVAL*365
SET IBEND=$$FMADD^XLFDT(IBSDT,IBX)
+10 IF IBFTF=4
SET IBX=IBVAL+365
SET IBEND=$$FMADD^XLFDT(IBSDT,IBX)
+11 IF IBFTF=5
SET IBX=IBVAL
SET IBYR=IBFYR_"0101"
SET IBEND=$$FMADD^XLFDT(IBYR,IBX)
+12 IF IBFTF=6
SET IBX=IBVAL*30
SET IBYR=IBFYR_"0101"
SET IBEND=$$FMADD^XLFDT(IBYR,IBX)
+13 IF IBFTF=7
SET IBYR=IBFYR_"1231"
SET IBEND=IBYR
+14 ;
+15 QUIT IBEND
+16 ;
FTFN(IBPLN,IBINS) ; Plan/Company Filing Time Frame Name: return plan or companies standard filing time frame for display
+1 NEW IBX,IBFTF,IBVAL,IBFTFN
SET (IBFTFN,IBFTF)=""
+2 IF +$GET(IBINS)
SET IBX=$GET(^DIC(36,+IBINS,0))
IF +$PIECE(IBX,U,18)
SET IBFTF=+$PIECE(IBX,U,18)
SET IBVAL=+$PIECE(IBX,U,19)
+3 IF +$GET(IBPLN)
SET IBX=$GET(^IBA(355.3,+IBPLN,0))
IF +$PIECE(IBX,U,16)
SET IBFTF=+$PIECE(IBX,U,16)
SET IBVAL=+$PIECE(IBX,U,17)
+4 ;
+5 IF +IBFTF
SET IBFTF=$GET(^IBE(355.13,+IBFTF,0))
SET IBFTFN=$SELECT(+$PIECE(IBFTF,U,2):IBVAL_" ",1:"")_$PIECE(IBFTF,U,1)
+6 QUIT IBFTFN
+7 ;
FTFV(IBFTF) ; return true if a Standard Filing Time Frame requires a Value
+1 QUIT +$PIECE($GET(^IBE(355.13,+$GET(IBFTF),0)),U,2)