| 1 | IBCC ;ALB/MJB - CANCEL THIRD PARTY BILL ;14 JUN 88  10:12 | 
|---|
| 2 | ;;2.0;INTEGRATED BILLING;**2,19,77,80,51,142,137,161,199,241,155,276,320,358**;21-MAR-94 | 
|---|
| 3 | ;;Per VHA Directive 10-93-142, this routine should not be modified. | 
|---|
| 4 | ; | 
|---|
| 5 | ;MAP TO DGCRC | 
|---|
| 6 | ; | 
|---|
| 7 | I '$D(IBCAN) S IBCAN=1 | 
|---|
| 8 | ASK ; | 
|---|
| 9 | ;*** | 
|---|
| 10 | ;I $D(XRT0) S:'$D(XRTN) XRTN="IBCC" D T1^%ZOSV ;stop rt clock | 
|---|
| 11 | ;S XRTL=$ZU(0),XRTN="IBCC-1" D T0^%ZOSV ;start rt clock | 
|---|
| 12 | ; | 
|---|
| 13 | ; If called at entry point PROCESS, variable IBNOASK will exist. | 
|---|
| 14 | ; First time through, IBNOASK=1 | 
|---|
| 15 | ; Second time through, IBNOASK=2 and it will quit | 
|---|
| 16 | I $G(IBNOASK)=2 G Q | 
|---|
| 17 | I $G(IBNOASK)=1 S IBNOASK=2 | 
|---|
| 18 | ; | 
|---|
| 19 | G Q:$G(IBCE("EDI")) | 
|---|
| 20 | D Q | 
|---|
| 21 | S IBQUIT=0 | 
|---|
| 22 | N DPTNOFZY S DPTNOFZY=1  ;Suppress PATIENT file fuzzy lookups | 
|---|
| 23 | I '$G(IBNOASK) S DIC="^DGCR(399,",DIC(0)="AEMQZ",DIC("A")="Enter BILL NUMBER or Patient NAME: " W !! D ^DIC I Y<1 S IBQUIT=1 G Q1 | 
|---|
| 24 | K IB364 | 
|---|
| 25 | NOPTF ; Note if IB364 is >0 it will be used as the ien to update in file 364 | 
|---|
| 26 | N DA,I | 
|---|
| 27 | I '$G(IBNOASK) S IBIFN=+$G(Y) | 
|---|
| 28 | I '$G(IBIFN) G ASK | 
|---|
| 29 | I IBCAN>1 D NOPTF^IBCB2 I 'IBAC1 D NOPTF1^IBCB2 G ASK | 
|---|
| 30 | ; Check if bill has been referred to Counsel | 
|---|
| 31 | I $P($G(^PRCA(430,IBIFN,6)),U,4) D  G ASK | 
|---|
| 32 | . W !,"This bill has been referred to Regional Counsel and cannot be 'CANCELLED' in" | 
|---|
| 33 | . W !,"Integrated Billing.  Please use the option 'TP Referred Follow-up'" | 
|---|
| 34 | . W !,"[PRCA RC ACTION MENU] in Accounts Receivable to request that Regional" | 
|---|
| 35 | . W !,"Counsel return the bill to your facility." | 
|---|
| 36 | . Q | 
|---|
| 37 | ; | 
|---|
| 38 | F I=0,"S","U1" S IB(I)=$G(^DGCR(399,IBIFN,I)) | 
|---|
| 39 | S IBSTAT=$P(IB(0),U,13) | 
|---|
| 40 | ; | 
|---|
| 41 | ; Restrict access to this process for REQUEST MRA bills | 
|---|
| 42 | I IBSTAT=2,'$G(IBCE("EDI")),$$MRAWL^IBCEMU2(IBIFN) D  G ASK | 
|---|
| 43 | . W !!?4,"This bill is in a status of REQUEST MRA and it does appear on the" | 
|---|
| 44 | . W !?4,"MRA Management Work List.  Please use the 'MRA Management Menu' options" | 
|---|
| 45 | . W !?4,"for all processing related to this bill." | 
|---|
| 46 | . Q | 
|---|
| 47 | ; | 
|---|
| 48 | ; Warning message if in a REQUEST MRA status with no MRA on file | 
|---|
| 49 | I IBSTAT=2,'$$MRACNT^IBCEMU1(IBIFN) D | 
|---|
| 50 | . N REJ | 
|---|
| 51 | . D TXSTS^IBCEMU2(IBIFN,,.REJ) | 
|---|
| 52 | . W *7,!!?4,"Warning!  This bill is in a status of REQUEST MRA." | 
|---|
| 53 | . W !?4,"No MRAs have been received" | 
|---|
| 54 | . I REJ W ", but the most recent transmission of this",!?4,"MRA request bill was rejected." | 
|---|
| 55 | . I 'REJ W " and there are no rejection messages on file",!?4,"for the most recent transmission of this MRA request bill." | 
|---|
| 56 | . Q | 
|---|
| 57 | ; | 
|---|
| 58 | I IBCAN=2,IB("S")]"",+$P(IB("S"),U,16),$P(IB("S"),U,17)]"" D  G 1 | 
|---|
| 59 | . W !!,"This bill was cancelled on " S Y=$P(IB("S"),U,17) X ^DD("DD") W Y," by ",$S($P(IB("S"),U,18)']"":IBU,$D(^VA(200,$P(IB("S"),U,18),0)):$P(^(0),U,1),1:IBU),"." | 
|---|
| 60 | . S IBQUIT=1 | 
|---|
| 61 | ; Notify if a payment has been posted to this bill before cancel | 
|---|
| 62 | N PRCABILL | 
|---|
| 63 | S PRCABILL=$$TPR^PRCAFN(IBIFN) | 
|---|
| 64 | I PRCABILL=-1 W !!,"Please note: PRCA was unable to determine if a payment has been posted." | 
|---|
| 65 | I PRCABILL>0 W !!,"Please note a PAYMENT of **$"_$$TPR^PRCAFN(IBIFN)_"** has been POSTED to this bill." | 
|---|
| 66 | ; | 
|---|
| 67 | ; If bill was created via Electronic claims process then notify | 
|---|
| 68 | ; user that cancellation should occur using ECME package | 
|---|
| 69 | I $$GET1^DIQ(399,IBIFN_",",460)]"" D  G:'Y ASK | 
|---|
| 70 | . W !!!?5,"This bill was created by the" | 
|---|
| 71 | . W !?5,"Electronic Claims Management Engine (ECME)." | 
|---|
| 72 | . W !?5,"Cancellation needs to occur in the ECME package by" | 
|---|
| 73 | . W !?5,"submitting a REVERSAL to the Payer.",!! | 
|---|
| 74 | . K DIR S DIR("A",1)="Has a REVERSAL for this e-Claim already been",DIR("A")="submitted to the payer via the ECME package (Y/N)",DIR(0)="Y",DIR("B")="NO" D ^DIR | 
|---|
| 75 | . I Y=0 W !!,"<PLEASE SUBMIT A REVERSAL USING THE APPROPRIATE OPTION IN THE ECME PACKAGE>",$C(7) | 
|---|
| 76 | ; | 
|---|
| 77 | CHK S (IBCCCC,IBQUIT)=0 I '$G(IBCEAUTO),'$G(IBMCSCAN) W !!,"ARE YOU SURE YOU WANT TO CANCEL THIS BILL" S %=2 D YN^DICN G:%=0 HELP I %'=1 S IBQUIT=1 G NO | 
|---|
| 78 | ; | 
|---|
| 79 | I '$G(IBCEAUTO) W !!,"LAST CHANCE TO CHANGE YOUR MIND..." | 
|---|
| 80 | S DIE=399,DA=IBIFN,DIE("NO^")="" | 
|---|
| 81 | S DR="16;S:'X Y=0;19;S IBCCCC=1;" | 
|---|
| 82 | I $G(IBCEAUTO) S DR="16////1;19////EDI/MRA TURNED OFF;S IBCCCC=1;" | 
|---|
| 83 | ; | 
|---|
| 84 | ; esg - 8/23/06 - IB*2*358 - fix semi-colon in free text field | 
|---|
| 85 | I $G(IBMCSRSC)'="" S DR="16;S:'X Y=0;19//^S X=IBMCSRSC;S IBCCCC=1;" | 
|---|
| 86 | D ^DIE K DIE,DR | 
|---|
| 87 | ; | 
|---|
| 88 | NO I 'IBCCCC W !!,"<NO ACTION TAKEN>",*7 S IBQUIT=1 G ASK:IBCAN<2,Q | 
|---|
| 89 | S IBCCR=$P($G(^DGCR(399,IBIFN,"S")),U,19) | 
|---|
| 90 | W !!,"...Bill has been cancelled..." D BULL^IBCBULL,BSTAT^IBCDC(IBIFN),PRIOR^IBCCC2(IBIFN) | 
|---|
| 91 | ; | 
|---|
| 92 | ; cancelling in ingenix claimsmanager if ingenix is running | 
|---|
| 93 | ; clean-up of variables is OK if not coming in from ListMan screen | 
|---|
| 94 | I $$CM^IBCIUT1(IBIFN) S IBCISNT=4 D ST2^IBCIST I '$G(IBCICNCL) K IBCISNT,IBCISTAT,IBCIREDT,IBCIERR | 
|---|
| 95 | ; | 
|---|
| 96 | S IBEDI=$G(IB364) | 
|---|
| 97 | I 'IBEDI S IBEDI=+$$LAST364^IBCEF4(IBIFN) | 
|---|
| 98 | I IBEDI D UPDEDI^IBCEM(IBEDI,"C") ;Update EDI files, if needed | 
|---|
| 99 | ; | 
|---|
| 100 | F I="S","U1" S IB(I)=$S($D(^DGCR(399,IBIFN,I)):^(I),1:"") | 
|---|
| 101 | S PRCASV("ARREC")=IBIFN,PRCASV("AMT")=$S(IB("U1")']"":0,1:$P(IB("U1"),"^")),PRCASV("DATE")=$P(IB("S"),"^",17),PRCASV("BY")=$P(IB("S"),"^",18) | 
|---|
| 102 | S PRCASV("COMMENT")=$S($P(IB("S"),U,19)]"":$P(IB("S"),U,19),$P(^IBE(350.9,1,2),"^",7)]"":$P(^(2),"^",7),1:"BILL CANCELLED IN MAS") | 
|---|
| 103 | S PRCASV("BY")=$S($P(IB("S"),U,18)]"":$P(IB("S"),U,18),1:"") | 
|---|
| 104 | S X=$$CANCEL^RCBEIB($G(PRCASV("ARREC")),$G(PRCASV("DATE")),$G(PRCASV("BY")),$G(PRCASV("AMT")),$G(PRCASV("COMMENT"))) | 
|---|
| 105 | W !,$S(X:">> The receivable associated with the claim was cancelled.",1:">> The receivable associated with the claim was not cancelled.") | 
|---|
| 106 | I $P(X,U,2)]"" W !,">>> ",$P(X,U,2) ; The reason why the claim can not be cancelled. | 
|---|
| 107 | I IBCAN<2 D RNB^IBCC1 ;assign a reason not billable | 
|---|
| 108 | G ASK:IBCAN<2,Q | 
|---|
| 109 | ; | 
|---|
| 110 | HELP W !,?3,"Answer 'YES' or 'Y' if you wish to cancel this bill.",!,?3,"Answer 'NO' or 'N' if you want to abort." G CHK | 
|---|
| 111 | Q | 
|---|
| 112 | 1 I $P(IB(0),U,13)=1 W !,"This record was re-opened on " S Y=$P(IB(0),U,14) X ^DD("DD") W Y,"." G CHK | 
|---|
| 113 | G ASK | 
|---|
| 114 | Q1 K:IBCAN=1 IBQUIT K IBCAN | 
|---|
| 115 | Q K %,IBEPAR,IBSTAT,IBARST,IBAC1,IB,DFN,IBX,IBZ,DIC,DIE,DR,PRCASV,PRCASVC,X,Y,IBEDI | 
|---|
| 116 | ;*** | 
|---|
| 117 | ;I $D(XRT0) S:'$D(XRTN) XRTN="IBCC" D T1^%ZOSV ;stop rt clock | 
|---|
| 118 | Q | 
|---|
| 119 | ; | 
|---|
| 120 | PROCESS(IBIFN,IBCAN) ; | 
|---|
| 121 | ; Entry point when the bill number is already known.  Use this when | 
|---|
| 122 | ; you just want to try to cancel this bill and this bill only. | 
|---|
| 123 | ; Input: | 
|---|
| 124 | ;   IBIFN - Internal bill# (Required) | 
|---|
| 125 | ;   IBCAN - Cancel Flag (optional, defaults to 1 if not included) | 
|---|
| 126 | ; | 
|---|
| 127 | NEW IBNOASK | 
|---|
| 128 | S IBNOASK=1 | 
|---|
| 129 | S IBCAN=$G(IBCAN,1) | 
|---|
| 130 | G ASK | 
|---|
| 131 | ; | 
|---|
| 132 | ;IBCC | 
|---|