IBCU81 ;ALB/ARH - THIRD PARTY BILLING UTILITIES (AUTOMATED BILLER) ;02 JUL 93
;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
;;Per VHA Directive 10-93-142, this routine should not be modified.
;
;
EABD(IBETYP,IBTDT) ; -- compute earliest auto bill date: date entered plus days delay for event type
;the difference betwieen this and EABD^IBTUTL is that the autobill of the event type may be turned off
;and this procedure will still return a date
; -- input IBETYPE = pointer to type of entry file
; IBTDT = episode date, if not passed in uses DT
;
N X,X1,X2,Y,IBETYPD S Y="" I '$G(IBETYP) G EABDQ
S IBETYPD=$G(^IBE(356.6,+IBETYP,0)) I '$G(IBTDT) S IBTDT=DT
S X2=+$P(IBETYPD,"^",6) ;set earliest autobill date to entered date plus days delay
S X1=IBTDT D C^%DTC S Y=X\1
EABDQ Q Y
;
EVBILL(IBTRN) ;check if event is billable, return EABD if it is, the difference between this and BILL^IBTUTL is that
;this procedure will return a date if the auto biller is turned off for this event type
;returns "^error message" if it is not billable
N X,Y,Z,E,IBTRND S (X,Y,E)="" S IBTRND=$G(^IBT(356,+$G(IBTRN),0)) I IBTRND="" G BILLQ
;
; -- billed and bill not cancelled and not inpt interim first or continuous
S Z=$$BILLED^IBCU8(IBTRN),Y=$P(Z,U,2) I +Z,'Y S E="^Event already billed on "_$P($G(^DGCR(399,+Z,0)),U,1)_"." G BILLQ
;
; -- special type (not riem. ins), not billable, inactive
I +$P(IBTRND,U,12) S E="^Bill may not be Reimbursable Insurance, possibly "_$$EXSET^IBEFUNC(+$P(IBTRND,U,12),356,.12)_"." G BILLQ
I +$P(IBTRND,U,19) S E="^Event has a Reason Not Billable: "_$P($G(^IBE(356.8,+$P(IBTRND,U,19),0)),U,1)_"." G BILLQ
I '$P(IBTRND,U,20) S E="^Event is Inactive." G BILLQ
I 'Y S Y=+$G(^IBT(356,+$G(IBTRN),1)) I 'Y S Y=DT
S X=$$EABD(+$P(IBTRND,U,18),Y)
BILLQ Q X_E
;
RXRF(IBTRN) ; returns rx # and refill date for given claims tracking rx entry
N IBX,IBY,IBZ,X S X="" S IBX=$G(^IBT(356,+$G(IBTRN),0)) I IBX'="" S IBY=$P($G(^PSRX(+$P(IBX,U,8),0)),U,1) I IBY'="" S IBZ=+$G(^PSRX(+$P(IBX,U,8),1,+$P(IBX,U,10),0)) I +IBZ S X=IBY_"^"_IBZ
Q X
IBCU81 ;ALB/ARH - THIRD PARTY BILLING UTILITIES (AUTOMATED BILLER) ;02 JUL 93
+1 ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
+2 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+3 ;
+4 ;
EABD(IBETYP,IBTDT) ; -- compute earliest auto bill date: date entered plus days delay for event type
+1 ;the difference betwieen this and EABD^IBTUTL is that the autobill of the event type may be turned off
+2 ;and this procedure will still return a date
+3 ; -- input IBETYPE = pointer to type of entry file
+4 ; IBTDT = episode date, if not passed in uses DT
+5 ;
+6 NEW X,X1,X2,Y,IBETYPD
SET Y=""
IF '$GET(IBETYP)
GOTO EABDQ
+7 SET IBETYPD=$GET(^IBE(356.6,+IBETYP,0))
IF '$GET(IBTDT)
SET IBTDT=DT
+8 ;set earliest autobill date to entered date plus days delay
SET X2=+$PIECE(IBETYPD,"^",6)
+9 SET X1=IBTDT
DO C^%DTC
SET Y=X\1
EABDQ QUIT Y
+1 ;
EVBILL(IBTRN) ;check if event is billable, return EABD if it is, the difference between this and BILL^IBTUTL is that
+1 ;this procedure will return a date if the auto biller is turned off for this event type
+2 ;returns "^error message" if it is not billable
+3 NEW X,Y,Z,E,IBTRND
SET (X,Y,E)=""
SET IBTRND=$GET(^IBT(356,+$GET(IBTRN),0))
IF IBTRND=""
GOTO BILLQ
+4 ;
+5 ; -- billed and bill not cancelled and not inpt interim first or continuous
+6 SET Z=$$BILLED^IBCU8(IBTRN)
SET Y=$PIECE(Z,U,2)
IF +Z
IF 'Y
SET E="^Event already billed on "_$PIECE($GET(^DGCR(399,+Z,0)),U,1)_"."
GOTO BILLQ
+7 ;
+8 ; -- special type (not riem. ins), not billable, inactive
+9 IF +$PIECE(IBTRND,U,12)
SET E="^Bill may not be Reimbursable Insurance, possibly "_$$EXSET^IBEFUNC(+$PIECE(IBTRND,U,12),356,.12)_"."
GOTO BILLQ
+10 IF +$PIECE(IBTRND,U,19)
SET E="^Event has a Reason Not Billable: "_$PIECE($GET(^IBE(356.8,+$PIECE(IBTRND,U,19),0)),U,1)_"."
GOTO BILLQ
+11 IF '$PIECE(IBTRND,U,20)
SET E="^Event is Inactive."
GOTO BILLQ
+12 IF 'Y
SET Y=+$GET(^IBT(356,+$GET(IBTRN),1))
IF 'Y
SET Y=DT
+13 SET X=$$EABD(+$PIECE(IBTRND,U,18),Y)
BILLQ QUIT X_E
+1 ;
RXRF(IBTRN) ; returns rx # and refill date for given claims tracking rx entry
+1 NEW IBX,IBY,IBZ,X
SET X=""
SET IBX=$GET(^IBT(356,+$GET(IBTRN),0))
IF IBX'=""
SET IBY=$PIECE($GET(^PSRX(+$PIECE(IBX,U,8),0)),U,1)
IF IBY'=""
SET IBZ=+$GET(^PSRX(+$PIECE(IBX,U,8),1,+$PIECE(IBX,U,10),0))
IF +IBZ
SET X=IBY_"^"_IBZ
+2 QUIT X