IBCRCC ;ALB/ARH - RATES: CALCULATION OF ITEM CHARGE ;22-MAY-1996 ;;2.0;INTEGRATED BILLING;**52,80,106,138,245,223,309,347**;21-MAR-94;Build 24 ;;Per VHA Directive 2004-038, this routine should not be modified. ; ; ITMCHG and RATECHG are basic item/set/rate charge functions, IBCRCI contains more standard callable functions ; ITMCHG(CS,ITEM,EVDT,MOD,ARR) ; get the base unit charges for a specific item, given a charge set, item and date ; this is the primary function to get an item charge and works for all Charge Methods, given an Item ; returns ARR = count of items in array ^ total charge for item ^ total base charge ; ARR(x) = charge item IFN (if any) ^ rev code (if any) ^ $ charge ^ $ base charge ; checks Item effective and inactive dates, modifier match, and only sets array if the charge is non-zero ; each item will be passed back separately in the array, no combination of charges ; N IBCSBR,IBEVDT,IBEFDT,IBXREF,IBITEM,IBDA,IBLN,IBCHRG,IBITMFND K ARR S ARR=0 S CS=+$G(CS),IBEVDT=$S(+$G(EVDT):+EVDT,1:DT),IBITEM=+$G(ITEM),MOD=$G(MOD) I 'CS!'IBITEM Q S IBCSBR=$$CSBR^IBCRU3(CS) ; ; va cost I $P(IBCSBR,U,5)=2 D Q ; va cost . I $P(IBCSBR,U,1)["PROSTHETICS" S IBCHRG=$$PICOST(IBITEM) I +IBCHRG D SETARR(0,0,+IBCHRG,.ARR) Q . I $P(IBCSBR,U,1)["PRESCRIPTION" S IBCHRG=$$RXCOST(IBITEM) I +IBCHRG D SETARR(0,0,+IBCHRG,.ARR) Q ; ; all others - have Charge Item entries ; ; find most recent Charge Item for the item, search until modifiers match (only BI=CPT should have mods defined) S IBXREF="AIVDTS"_CS,IBITMFND=0 S IBEFDT=-(IBEVDT+.01) F S IBEFDT=$O(^IBA(363.2,IBXREF,IBITEM,IBEFDT)) Q:'IBEFDT D Q:IBITMFND . S IBDA=0 F S IBDA=$O(^IBA(363.2,IBXREF,IBITEM,IBEFDT,IBDA)) Q:'IBDA D .. S IBLN=$G(^IBA(363.2,IBDA,0)) .. I +$P(IBLN,U,7)'=+MOD Q ; charge item modifier does not match modifier passed in .. S IBITMFND=1 ; item found .. I +$P(IBLN,U,4),+$P(IBLN,U,4)EVDT!(+IBINADT&(IBINADT79999,ITEM<90000 S (CS,PRV)="" I +$G(CS) S IBSGFN=+$$CSSG^IBCRU6(+CS,"",2,.IBSG) I +$G(PRV),+IBSGFN S IBPC=$$GET^XUA4A72(PRV,EVDT) ; S IBI=0 F S IBI=$O(IBSG(IBI)) Q:'IBI S IBSGFN=+IBSG(IBI) I +IBSGFN D . S IBPDFN=0 F S IBPDFN=$O(^IBE(363.34,"C",+IBSGFN,IBPDFN)) Q:'IBPDFN D Q:IBPDTY'="" .. I '$O(^IBE(363.34,+IBPDFN,11,"B",+IBPC,0)) Q .. S IBPD0=$G(^IBE(363.34,+IBPDFN,0)),IBY=$P(IBPD0,U,3) Q:IBY="" .. S IBY=+IBY/100,IBX=IBY*IBX .. S IBPDTY=U_$P($G(^VA(200,+PRV,0)),U,1)_" - "_$P(IBPD0,U,1)_" "_$P(IBPD0,U,3)_"% of "_$J(CHG,0,2)_U_+IBY Q IBX_IBPDTY ; HRUNIT(HRS) ; returns Hour Units based on the Hours passed in ; Hour Units are the hours rounded to the nearest whole hour (less than 30 minutes is 0 units) N IBX S IBX=0 I +$G(HRS) S IBX=$J(HRS,0,0) Q IBX ; MLUNIT(MLS) ; returns Miles Units based on the Miles passed in ; Mile Units are the miles rounded to the nearest whole mile N IBX S IBX=0 I +$G(MLS) S IBX=$J(MLS,0,0) I 'IBX S IBX=1 Q IBX ; MNUNIT(MNS) ; return Minute Units based on the Minutes passed in ; Minute Units are 15 minute intervals, rounded down for less than 5 minutes N IBX S IBX=0 I +$G(MNS) S IBX=(MNS\15) S:(MNS#15)>4 IBX=IBX+1 I 'IBX S IBX=1 Q IBX