Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: IBECEA3

IBECEA3.m

Go to the documentation of this file.
  1. IBECEA3 ;ALB/CPM - Cancel/Edit/Add... Add a Charge ;30-MAR-93
  1. ;;2.0;INTEGRATED BILLING;**7,57,52,132,150,153,166,156,167,176,198,188,183,202,240,312,402,454,563,614,618,646,651,656,663,677,678,682,728,716,704,776,784,729**;21-MAR-94;Build 8
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ADD ; Add a Charge protocol
  1. N IBGMT,IBGMTR,IBUSNM,IBUC ;IB*2.0*618 Add IBUSNM IB*2.0*646 Add IBUC
  1. N IBCLDA,IBCLST ; IB*2.0*728
  1. N IBSTCD,IBCDCHK,IBCDEDT,IBCDFLG,IBCDSDT,NUMVSTFL ; IB*2.0*784
  1. N Z ; IB*2.0*729
  1. S (IBCDCHK,NUMVSTFL)="" ; IB*2.0*784
  1. ; Check for IB EDIT key. If not present
  1. I '$$IBEDIT^IBECEA36 Q
  1. S (IBGMT,IBGMTR,IBUC)=0
  1. S IBCOMMIT=0,IBEXSTAT=$$RXST^IBARXEU(DFN,DT),IBCATC=$$BILST^DGMTUB(DFN),IBCVAEL=$$CVA^IBAUTL5(DFN),IBLTCST=$$LTCST^IBAECU(DFN,DT,1)
  1. ; clear screen and begin
  1. D CLOCK^IBAUTL3 I 'IBCLDA S (IBMED,IBCLDAY,IBCLDOL,IBCLDT)=0
  1. D HDR^IBECEAU("A D D")
  1. I IBY<0 D NODED^IBECEAU3 G ADDQ
  1. ; ask for the charge type
  1. D CHTYP^IBECEA33 G:IBY<0 ADDQ
  1. ;
  1. ;***IB*2.0*618 change to add more Action Types to this list...
  1. ; Allow user to add an extra "co-payment" charge if the Action Type
  1. ; selected is an Outpatient FEE BASIS, CHOICE, CC or CCN charge type
  1. N IBAFEE
  1. S IBUSNM=$P($G(^IBE(350.1,+$G(IBATYP),0)),"^",8)
  1. I IBUSNM'="" D
  1. .I IBUSNM="FEE SERVICE/OUTPATIENT" S IBAFEE=IBATYP Q
  1. .I (IBUSNM["CC")!(IBUSNM["CHOICE") D
  1. ..I (IBUSNM["OPT")!(IBUSNM["OUTPATIENT")!(IBUSNM["URGENT") S IBAFEE=IBATYP ;IB*2.0*646 added URGENT
  1. ;*** END IB*2.0*618 ***
  1. ;
  1. ; - process CHAMPVA charges
  1. I IBXA=6 D CHMPVA^IBECEA32 G ADDQ
  1. ;
  1. ; - process TRICARE charges
  1. I IBXA=7 D CUS^IBECEA35 G ADDQ
  1. ;
  1. ; - display MT billing clock data
  1. I IBXA=2,$P($G(^IBE(350.1,+IBATYP,0)),"^",8)'["NHCU",IBCLDAY>90 S IBMED=IBMED/2
  1. I IBXA=1,IBCLDAY>90 D MED^IBECEA34 G:IBY<0 ADDQ
  1. I "^1^2^3^"[("^"_IBXA_"^"),IBCLDA W !!," ** Active Billing Clock ** # Inpt Days: ",IBCLDAY," ",$$INPT^IBECEAU(IBCLDAY)," 90 days: $",+IBCLDOL,!
  1. ;
  1. ; - if LTC OPT (non-institutional) and CD display message of warning
  1. I IBXA=8,$$CDEXMPT^IBAECU(DFN,DT) W !!," ** Patient is currently Catastrophically Disabled",!
  1. ;
  1. ; - ask date, units and maybe tier for rx copay charge
  1. I IBXA=5 D G ADDQ:IBY<0,PROC
  1. .N IBA,IBB,IBC,IBX
  1. .;; IBREBILL array is defined in REBILL^IBECEA4
  1. .S IBLIM=DT D FR^IBECEAU2($S($G(IBREBILL("EVDT"))'="":IBREBILL("EVDT"),1:0)) Q:IBY<0 ; IB*2.0*682
  1. .S (IBTO,IBEFDT)=IBFR
  1. .;
  1. .;PRCA*4.5*338 - if Community Care RX copay, set event date
  1. .S IBEVDA="*",IBEVDT=IBEFDT
  1. .;
  1. .; ask tier if needed
  1. .S IBTIER=$$TIER^IBECEAU2(IBATYP,IBEFDT) Q:IBY<0
  1. .;
  1. .; ask units
  1. .D UNIT^IBECEAU2(0) Q:IBY<0
  1. .;
  1. .; has patient been previously tracked for cap info
  1. .D TRACK^IBARXMN(DFN)
  1. .;
  1. .D CTBB^IBECEAU3
  1. .;
  1. .; check if above cap
  1. .I IBY'<0 D
  1. ..N IBB,IBN,DIR,DIRUT,DUOUT,DTOUT,X,Y
  1. ..D NEW^IBARXMC(1,IBCHG,IBFR,.IBB,.IBN) Q:'IBN
  1. ..;
  1. ..; display message ask to proceed
  1. ..W !!,"This charge will put the patient > $",$J(IBN,0,2)," above their cap amount."
  1. ..S DIR(0)="Y",DIR("A")="Okay to proceed" D ^DIR S:'Y IBY=-1
  1. ..;
  1. S IBLIM=$S(IBXA=4!(IBXA=3):DT,1:$$FMADD^XLFDT(DT,-1))
  1. ;
  1. FR ; - ask 'bill from' date
  1. D FR^IBECEAU2($S($G(IBREBILL("BILLFR"))'="":IBREBILL("BILLFR"),1:0)) ; IB*2.0*682
  1. I IBY<0 G ADDQ ; IB*2.0*729
  1. ;IB*2.0*646/656
  1. ; If Urgent Care copay, skip clock checks, go to prompt for copay amount.
  1. I $G(IBUC),(IBFR<3190606) D G ADDQ
  1. .W !!,"The Urgent Care Copayment/Mission Act legislation went into effect on 6/6/19. "
  1. .W !,"Dates of service prior to this date will need to be billed using other ",!,"outpatient copayment charges."
  1. G:$G(IBUC) UCPAY
  1. ; end IB*2.0*646/656
  1. ;
  1. ;
  1. S IBGMT=$$ISGMTPT^IBAGMT(DFN,IBFR),IBGMTR=0 ;GMT Copayment Status
  1. I IBGMT>0,IBXA>0,IBXA<4 W !,"The patient has GMT Copayment Status."
  1. ; - check the MT billing clock
  1. I IBXA'=8,IBXA'=9 D CLMSG^IBECEA33 G:IBY<0 ADDQ
  1. ;Adjust Deductible for GMT patient
  1. I IBGMT>0,IBXA>0,IBXA<4,$G(IBMED) S IBMED=$$REDUCE^IBAGMT(IBMED) W !,"Medicare Deductible reduced due to GMT Copayment Status ($",$J(IBMED,"",2),")."
  1. ;
  1. ; - check LTC non-institutional (opt) for CD exemption
  1. I IBXA=8,$$CDEXMPT^IBAECU(DFN,IBFR) W !,"Patient is LTC non-institutional exempt, Catastrophically Disabled" G ADDQ
  1. ;
  1. ; - check the LTC billing clock
  1. I IBXA>7,IBXA<10 S Z=$$CHKLTC^IBECEA3A(DFN,IBFR) S:+Z IBCLDA=$P(Z,U,2) I '+Z S IBY=-1 G ADDQ ; IB*2.0*729
  1. ;
  1. ; - calculate the MT inpt copay charge
  1. I IBXA=2 S IBDT=IBFR D COPAY^IBAUTL2 G ADDQ:IBY<0 S:IBGMT>0 IBGMTR=1,IBCHG=$$REDUCE^IBAGMT(IBCHG) I IBCHG+IBCLDOL<IBMED W *7," ($",IBCHG,"/day)" W:IBGMTR " GMT Rate"
  1. ;
  1. ; - find the correct clock from the 'bill from' date (ignore LTC)
  1. I IBXA'=8,IBXA'=9,('IBCLDA!(IBCLDA&(IBFR<IBCLDT))!'$$GET1^DIQ(351,IBCLDA_",",16,"I")) D NOCL^IBECEA33 G:IBY<0 ADDQ
  1. ;
  1. UCPAY ;IB*2.0*646 Added to allow for skip of clock checks - required for Urgent Care Copays
  1. ; - perform outpatient edits
  1. N IBSTOPDA
  1. ;
  1. ;IB*2.0*663 Added changes for Urgent Care Visit Tracking
  1. I IBXA=4,IBUC D UCCHRG2^IBECEA36(DFN,IBFR) G ADDQ:IBY<0
  1. ;end IB*2.0*646
  1. ;
  1. I IBXA=4,'IBUC,$$CHKHRFS^IBAMTS3(DFN,IBFR,IBFR) W !!,"This patient is 'Exempt' from Outpatient Visit charges on that date of service.",! G ADDQ ;IB*2.0*614 (no copayment if HRfS flag)
  1. ;IB*2.0*776 start
  1. ; get the copay amount
  1. I IBXA=4,'IBUC D G ADDQ:IBY<0
  1. .; for visits prior to 12/6/01 or FEE
  1. .I IBFR<3011206!($G(IBAFEE)) D OPT^IBECEA33 Q
  1. .; for visits on or after 12/5/01
  1. .I $G(IBUSNM)["OBSERVATION" D Q
  1. ..S IBCHG=50,IBUNIT=1 ;initial copay amount
  1. ..S IBDESC=IBUSNM,IBTO=IBFR ;ensure that Billed To and Description are defined.
  1. .D OPT^IBEMTSCU
  1. ;IB*2.0*776 end
  1. ;
  1. I IBXA=4,'$$DUP^IBECEA3A(DFN,IBFR,+$G(IBCHG)) D:IBUC&$$VSTCHK() ADDVST^IBECEA36(DFN,IBFR,"",4,5) G ADDQ ; IB*2.0*729
  1. ;
  1. ;IB*2.0*784 - Cleland-Dole Benefit Check
  1. S IBCDSDT=$$GET1^DIQ(350.9,"1,",71.03,"I"),IBCDEDT=$$GET1^DIQ(350.9,"1,",71.04,"I")
  1. I IBFR'<IBCDSDT,IBFR'>IBCDEDT,IBUSNM["CC MH" S IBCDFLG=$$ASKMH^IBECEAMH() G:IBCDFLG=-1 ADDQ G:'IBCDFLG PROC S IBCDCHK=1 ;Cleland Dole Copay Type, definitely eligible. IB*2.0*784
  1. I 'IBCDCHK,$G(IBSTOPDA) D ; Check stop code for Cleland-Dole Eligibility
  1. .S IBSTCD=$$GET1^DIQ(352.5,IBSTOPDA_",",.01,"E")
  1. .S IBCDCHK=$$CDCHK^IBECEAMH(IBSTCD,IBFR)
  1. S NUMVSTFL=$$NUMVSTCK^IBECEAMH(DFN,IBFR)
  1. I IBCDCHK,NUMVSTFL D G ADDQ
  1. .D MESS1^IBECEAMH
  1. .I $$ASKCONT^IBECEAMH()'>0 Q
  1. .D ADDVST^IBECEAMH(DFN,IBFR,"",1)
  1. I IBCDCHK,'NUMVSTFL D MESS2^IBECEAMH ;Alert user that Cleland-Dole max for the year has been reached.
  1. ;end IB*2.0*784
  1. ;
  1. ;If outpatient copay and has passed all other checks, go to PROC
  1. G:IBXA=4 PROC
  1. ;
  1. ;end IB*2.0*678
  1. ;
  1. ; - if LTC outpatient calculate the charge
  1. I IBXA=8 D G:IBY<0 ADDQ S (IBDT,IBTO,IBEVDT)=IBFR,IBDESC=$P(^IBE(350.1,IBATYP,0),"^",8),IBUNIT=1,IBEVDA="*" D COST^IBAUTL2,CALC^IBAECO,CTBB^IBECEAU3 G:'IBCHG ADDQ
  1. .; is this day already a free day
  1. .I $D(^IBA(351.81,IBCLDA,1,"AC",IBFR)) W !!,"This day is already marked as a Free Day." S IBY=-1
  1. ;
  1. I IBXA=8 G:'$$DUP^IBECEA3A(DFN,IBFR,+$G(IBCHG)) ADDQ G PROC ; IB*2.0*729
  1. ;
  1. ; - find per diem charge and description
  1. I IBXA=3 D I 'IBCHG W !!,"Unable to determine the per diem rate. Please check your rate table." G ADDQ
  1. .N IBDT S IBDT=IBFR,IBGMTR=0 D COST^IBAUTL2
  1. .I IBGMT>0 S IBGMTR=1,IBCHG=$$REDUCE^IBAGMT(IBCHG)
  1. .S IBDESC="" X:$D(^IBE(350.1,IBATYP,20)) ^(20)
  1. ;
  1. ; - calculate charge for the inpatient copay
  1. I IBXA=2,IBCHG+IBCLDOL'<IBMED S IBCHG=IBMED-IBCLDOL,IBUNIT=1,IBTO=IBFR D CTBB^IBECEAU3 G EV
  1. ;
  1. TO ; - ask 'bill to' date
  1. D TO^IBECEAU2($S($G(IBREBILL("BILLTO"))'="":IBREBILL("BILLTO"),1:0)) G:IBY<0 ADDQ ; IB*2.0*682
  1. ;
  1. ;Check to see if there is another medical copay (inpatient or outpatient) on that same day for this patient.
  1. ;If there is, print warning message to user and abort copay entry.
  1. I (IBXA<4)!(IBXA=9) G:'$$DUP^IBECEA3A(DFN,IBFR,+$G(IBCHG)) ADDQ ; IB*2.0*729
  1. ;
  1. I IBXA>0,IBXA<4,IBGMT'=$$ISGMTPT^IBAGMT(DFN,IBTO) W !!,"The patient's GMT Copayment status changed within the specified period!",! G ADDQ
  1. ;
  1. ;- IB*2.0*663 - check for Free days used in this billing period
  1. I IBXA=9 D G ADDQ:IBY<0
  1. .F IBFEDT=IBFR:1:IBTO I $D(^IBA(351.81,IBCLDA,1,"AC",IBFEDT)) W !!,"One or more of the days in this period is marked as a Free Day." S IBY=-1 Q
  1. ;end IB*2.0*663
  1. ;
  1. ; - calculate unit charge for LTC inpatient in IBCHG
  1. I IBXA=9 S IBDT=IBFR,IBEVDA=$$EVF^IBECEA31(DFN,IBFR,IBTO,IBNH),IBEVDT=$E(IBFR,1,5)_"01" D:IBEVDA<1 G ADDQ:IBY<0 D COST^IBAUTL2 I $E(IBFR,1,5)'=$E(IBTO,1,5) W !!," LTC Copayment charges cannot go from one month to another." G ADDQ
  1. .D NOEV^IBECEA31 I '$G(IBDG)!(IBY<0) S IBY=-1 Q
  1. .; - build the event record
  1. .N IBNHLTC S IBNHLTC=1 D ADEV^IBECEA31
  1. ;
  1. ; - calculate units and total charge
  1. S IBUNIT=$$FMDIFF^XLFDT(IBTO,IBFR) S:IBXA'=3!(IBFR=IBTO) IBUNIT=IBUNIT+1
  1. I IBXA=1 D:IBGMT>0 D FEPR^IBECEA32 G ADDQ:IBY<0,EV
  1. .S IBGMTR=1
  1. .W !,"The patient has GMT Copayment Status! GMT rate must be applied.",!
  1. S IBCHG=IBCHG*IBUNIT S:IBXA=2 IBCHG=$S(IBCLDOL+IBCHG>IBMED:IBMED-IBCLDOL,1:IBCHG)
  1. ;
  1. ; adjust the LTC charge based on the calculated copay cap
  1. I IBXA=9 D CALC^IBAECI G:IBY<1!('IBCHG) ADDQ S IBDESC="LTC INPATIENT COPAY"
  1. ;
  1. D CTBB^IBECEAU3 W:IBXA=3!(IBXA=9) " (for ",IBUNIT," day",$E("s",IBUNIT>1),")" W:IBGMTR " GMT Rate"
  1. ;
  1. EV ; - find event record, or select admission for linkage
  1. I IBXA'=9 S IBEVDA=$$EVF^IBECEA31(DFN,IBFR,IBTO,IBNH)
  1. I IBEVDA'>0 D NOEV^IBECEA31 G ADDQ:IBY<0,PROC
  1. S IBSL=$P($G(^IB(+IBEVDA,0)),"^",4)
  1. W !!,"Linked charge to ",$$TYP(),"admission on ",$$DAT1^IBOUTL($P(IBEVDA,"^",2))," ("
  1. W $S($P(IBEVDA,"^",3)=9999999:"Still admitted)",1:"Discharged on "_$$DAT1^IBOUTL($P(IBEVDA,"^",3))_$S($P(IBEVDA,"^",3)>DT:" [pseudo])",1:")"))," ..."
  1. S IBEVDA=+IBEVDA
  1. I '$G(IBSIBC) D SPEC^IBECEA32(0,$O(^IBE(351.2,"AD",IBEVDA,0)))
  1. ;
  1. ;
  1. PROC ; - okay to proceed?
  1. N IBRES,IBBILL ; IB*2.0*682
  1. I 'IBUC,IBXA'=9,$$INDCHK^IBINUT1($S($G(IBTO)>0:IBTO,1:IBFR),DFN) D G ADDQ ; IB*2.0*716
  1. .W !!,"The patient is exempt from this copayment due to AI/AN Attestation." ; IB*2.0*729
  1. .W !,"This patient's AI/AN Attestation Benefit Start date is ",$$FMTE^XLFDT($P($$INDGET^IBINUT1(DFN),U,2),"2Z") ; IB*2.0*729
  1. .Q
  1. D PROC^IBECEAU4("add") G:IBY<0 ADDQ
  1. ;
  1. ; - build the event record first if necessary
  1. I $G(IBDG),IBXA'=9 D @("ADEV^IBECEA3"_$S($G(IBFEEV):4,1:1)) G:IBY<0 ADDQ
  1. ;
  1. ; - disposition the special inpatient billing case, if necessary
  1. I $G(IBSIBC) D CEA^IBAMTI1(IBSIBC,IBEVDA)
  1. ;
  1. ; - generate entry in file #354.71 (for VA RX only per IB*2.0*618) and #350
  1. I IBXA=5,(IBUSNM'["CC"),(IBUSNM'["CHOICE") W !!,"Building the new transaction... " S IBAM=$$ADD^IBARXMN(DFN,"^^"_IBEFDT_"^^P^^"_IBUNIT_"^"_IBCHG_"^"_IBDESC_"^^"_IBCHG_"^0^"_IBSITE_"^^^^^^^"_$G(IBTIER)) G:IBAM<0 ADDQ
  1. D ADD^IBECEAU3 G:IBY<0 ADDQ W " done."
  1. ;
  1. ; - pass the charge off to AR on-line
  1. W !,"Passing the charge directly to Accounts Receivable... "
  1. D PASSCH^IBECEA22 W:IBY>0 " done." G:IBY<0 ADDQ ;IB*2.0*663 added space before done to correct display issue.
  1. ;
  1. I IBUC D
  1. .; Handle re-billing IB*2.0*682
  1. .I $G(IBREBILL("UC")) D Q
  1. ..; get bill # or set it to "on hold" if bill status in file 350 = 8 (on hold)
  1. ..S IBBILL=$S($$GET1^DIQ(350,$G(IBN)_",",.05,"I")=8:"ON HOLD",1:$$GET1^DIQ(350,IBEVDA_",",.11,"E"))
  1. ..S IBRES=$$UPDATE^IBECEA38(IBREBILL("UC"),2,IBBILL,"",1,"IBRES")
  1. ..Q
  1. .;
  1. .D ADDVST^IBECEA36(DFN,IBFR,IBEVDA,2)
  1. .Q
  1. ;
  1. ;IB*2.0*784 - Cleland-Dole - Update MH DB with billed entry
  1. I IBCDCHK,'NUMVSTFL D MESS2B^IBECEAMH,ADDVST^IBECEAMH(DFN,IBFR,IBEVDA,2)
  1. ;
  1. ; - review the special inpatient billing case
  1. I $G(IBSIBC1) D CHK^IBAMTI1(IBSIBC1,IBEVDA)
  1. ;
  1. ; - handle updating of clock
  1. I IBXA'=8,IBXA'=9,'IBUC D CLUPD^IBECEA32 ;IB*2.0*646
  1. ;
  1. ADDQ ; - display error, rebuild list, and quit
  1. ; IB*2.0*682 skip list rebuild and killing of some variables if we're coming from ^IBECEA4 - it's done in 'Cancel charge' code
  1. I $G(IBREBILL("EVDT"))="" D
  1. .D ERR^IBECEAU4:IBY<0,PAUSE^IBECEAU S VALMBCK="R"
  1. .I IBCOMMIT S IBBG=VALMBG W !,"Rebuilding list of charges..." D ARRAY^IBECEA0 S VALMBG=IBBG
  1. .K IBCHG,IBDESC,IBIL,IBN,IBND,IBSEQNO,IBTOTL,IBUNIT,IBATYP,IBEVDA,IBXA,IBSL,IBFR,IBTO,IBNOS
  1. .Q
  1. ;
  1. K IBMED,IBCLDA,IBCLDT,IBCLDOL,IBCLDAY,IBDG,IBNH,IBBS,IBLIM,IBRTED,IBSIBC,IBSIBC1,IBBG,IBFEEV,IBAM
  1. K IBX,IBDT,IBEVDT,IBARTYP,IBTRAN,IBAFY,IBCVA,IBCLSF,IBDD,VADM,VA,VAERR,IBADJMED
  1. ADDQ1 K IBEXSTAT,IBCATC,IBCVAEL,IBLTCST,IBTIER,IBEFDT,IBFEDT
  1. K:$G(IBREBILL("EVDT"))="" IBCOMMIT ; IB*2.0*682
  1. Q
  1. ;
  1. ;
  1. TYP() ; Return descriptive admission type.
  1. N X S X=""
  1. I IBNH'=2 G TYPQ
  1. I $G(IBADJMED) S X=$S(IBADJMED=1:"C",1:"H")
  1. E S X=$S($P($G(^IBE(350.1,+IBATYP,0)),"^")["NHCU":"C",1:"H")
  1. S X=$S(X="C":"CNH ",1:"Contract Hospital ")
  1. TYPQ Q X
  1. ;
  1. ;IB*2.0*678
  1. VSTCHK() ; Ask the user to see if they wish to update the UC Visit Tracking DB
  1. ;
  1. N DIR,DIRUT,DUOUT,X,Y,IBY
  1. W !
  1. S IBY=-1 ; Default exit value
  1. S DIR(0)="YA",DIR("A")="Do you want this Urgent Care visit added to the Visit Tracking Database? : "
  1. D ^DIR
  1. W ! ;force a line feed between the messages
  1. Q:$D(DIRUT) IBY
  1. Q:$D(DUOUT) IBY
  1. Q:'Y Y ; user selected No
  1. Q 1 ;Otherwise, the answer was yes