IBCRU3 ;ALB/ARH - RATES: UTILITIES (CS/BR) ;22-MAY-1996 ;;2.0;INTEGRATED BILLING;**52,106,223**;21-MAR-94 ;;Per VHA Directive 10-93-142, this routine should not be modified. ; CSN(N) ; returns the IFN of the Charge Set name passed in N X S X="" I $G(N)'="" S X=$O(^IBE(363.1,"B",N,0)) Q X ; CSBI(CS) ; returns a Charge Set rates Billable Item (363.3,.04): 0 or BI ^ bi name N IBX,IBCS0,IBBI S IBX=0 S IBCS0=$G(^IBE(363.1,+$G(CS),0)),IBBI=$P($G(^IBE(363.3,+$P(IBCS0,U,2),0)),U,4) I +IBBI S IBX=IBBI_U_$$EXPAND^IBCRU1(363.3,.04,IBBI) Q IBX ; CSBR(CS) ; return data on a charge set: billable event ^ BE IFN ^ billing rate IFN ^ billable item ^ charge method N IBBRFN,IBBEVNT,IBLN1,IBLN,IBX S IBX="" S IBLN=$G(^IBE(363.1,+$G(CS),0)),IBBRFN=+$P(IBLN,U,2),IBBEVNT=$$EMUTL^IBCRU1($P(IBLN,U,3)) S IBLN1=$G(^IBE(363.3,IBBRFN,0)) I IBLN'="" S IBX=IBBEVNT_U_$P(IBLN,U,3)_U_IBBRFN_U_$P(IBLN1,U,4)_U_$P(IBLN1,U,5) Q IBX ; CSDV(CS,DIV,DDIV) ; check if the division is covered by this charge set ; "" if - Charge Set has no region defined (ie. covers all divisions) ; div if - division passed in and it is one of the divisions of the region defined for the Charge Set ; - no division but default division is one of the divisions of the region defined for the Set ; -1 - otherwise: division not covered by CS ; N IBX,IBCS0,IBRGFN S IBX=-1,DIV=$G(DIV),DDIV=$G(DDIV) S IBCS0=$G(^IBE(363.1,+$G(CS),0)),IBRGFN=$P(IBCS0,U,7) I IBCS0="" G CSDVQ ; I 'IBRGFN S IBX="" G CSDVQ I +IBRGFN,+DIV,$D(^IBE(363.31,+IBRGFN,11,"B",DIV)) S IBX=DIV G CSDVQ I +IBRGFN,'DIV,+DDIV,$D(^IBE(363.31,+IBRGFN,11,"B",DDIV)) S IBX=DDIV G CSDVQ ; CSDVQ Q IBX ; RT(RT,BT,EFDT,ARR,BE,CT) ; return array of all rate schedules and charge sets for a rate type and bill type and date ; EFDT may be passed as 'begin dt^end dt' to get CSs active within a date range, like a bill's date range ; output ARR = number of rate schedule-charge set combinations found ; ARR(rate sched IFN,charge set IFN) = 1 if charges for set are auto added N IBBEG,IBEND,IBRSFN,IBRS0,IBCSI,IBBE,IBLN,IBAA K ARR S ARR=0,IBBE="" S RT=$G(RT),BT=$G(BT),EFDT=$G(EFDT),CT=$G(CT) I +BT S BT=$S(BT<3:1,1:3) S (IBBEG,IBEND)="" S IBBEG=+EFDT,IBEND=$S(+$P(EFDT,U,2):+$P(EFDT,U,2),1:IBBEG) I $G(BE)'="" S:+BE BE=$$EMUTL^IBCRU1(BE) S IBBE=$$MCCRUTL^IBCRU1(BE,14) I IBBE'=0 S IBRSFN=0 F S IBRSFN=$O(^IBE(363,"ARB",+RT,+BT,IBRSFN)) Q:'IBRSFN D . S IBRS0=$G(^IBE(363,+IBRSFN,0)) I +EFDT I (+$P(IBRS0,U,5)>IBEND)!(+$P(IBRS0,U,6)&(+$P(IBRS0,U,6)