BPSSCRRS ;BHAM ISC/SS - ECME SCREEN RESUBMIT ;05-APR-05
;;1.0;E CLAIMS MGMT ENGINE;**1,3,5,7,8,10,11,20,26,31,35**;JUN 2004;Build 14
;;Per VA Directive 6402, this routine should not be modified.
; Reference to $$RXRLDT^PSOBPSUT in ICR #4701
; Reference to ECMEACT^PSOBPSU1 in ICR #4702
; Reference to $$WRKLST^PSOREJU4 in ICR #5063
; Reference to $$RXBILL^IBNCPUT3 in ICR #5355
; Reference to $$ECETREJ^PSXRPPL2 in ICR #7352
;
Q
;
RES ;
N BPRET,BPSARR59
I '$D(@(VALMAR)) Q
D FULL^VALM1
W !,"Enter the line numbers for the claim(s) to be resubmitted."
S BPRET=$$ASKLINES^BPSSCRU4("Select item(s)","C",.BPSARR59,VALMAR)
I BPRET="^" S VALMBCK="R" Q
;go thru all selected claims and try to resubmit them separately
;update the content of the screen and display it
;only if at least one claim was submitted successfully
I $$RESUBMIT(.BPSARR59) D REDRAW^BPSSCRUD("Updating screen for resubmitted claims...")
E S VALMBCK="R"
Q
;
RESNRV ; entry point for action protocol for Resubmit Claim Without Reversal (BPS*1*20)
; special variable BPRSNRV=1 when doing a resubmit w/o reversal. The Resubmit will be done without
; regard to current claim status
;
N BPRET,BPSARR59,BPRSNRV
S BPRSNRV=1
I '$D(@(VALMAR)) Q
D FULL^VALM1
W "Resubmit Claim w/o Reversal"
W !!?4,"Note: This action will resubmit claims without performing a reversal."
W !!?10,"This action should be used in instances where the payer shows the"
W !?10,"claim was reversed and VistA shows a payable claim. This action will"
W !?10,"NOT submit a reversal regardless of the current VistA claim status."
W !!,"Enter the line numbers for the claim(s) to be resubmitted w/o reversal."
S BPRET=$$ASKLINES^BPSSCRU4("Select item(s)","C",.BPSARR59,VALMAR)
I BPRET="^" S VALMBCK="R" Q
;go thru all selected claims and try to resubmit them separately
;update the content of the screen and display it
;only if at least one claim was submitted successfully
I $$RESUBMIT(.BPSARR59,BPRSNRV) D REDRAW^BPSSCRUD("Updating screen for resubmitted claims...")
E S VALMBCK="R"
Q
;
;/**
;go thru all selected claims and try to resubmit them separately
;input:
; RXI - array with ptrs to BPS TRANSACTION file (see ASKLINES^BPSSCRU4)
; BPRSNRV - optional flag indicating if resubmit action is a normal resubmit (default) or a resubmit w/o reversal
; - BPRSNRV=0 for normal resubmit (default)
; - BPRSNRV=1 for resubmit without a reversal
;returns
; 0 - if no claims were resubmitted
; 1 - if at least one claim was resubmitted
RESUBMIT(RXI,BPRSNRV) ;*/
N BPRVRSED ;was successfully reversed
N BPRVNEED ;needs reversal
N BPRVWAIT ;cycles of waiting
N BPRVRSNT ;reversal has been sent
;
N BILLNUM,BP59,BPCLTOT,BPCLTOTR,BPDFN,BPPRIOPN,BPQ,BPSCOB,BPSCOM
N BPSCONT,BPSPCLS,BPSRSRRS,BPSRSWHR,BPSTATUS,BPSTC,DIWF,DIWL,DIWR
N DOSDATE,RXIEN,RXR,UPDATFLG,WHERE,X
;
N REVCOUNT S REVCOUNT=0
N BPIFANY S BPIFANY=0
N BPINPROG S BPINPROG=0
;
S BPCLTOT=0 ;total for resubmitted
S BPCLTOTR=0 ;total for reversed, not resubmitted
S UPDATFLG=0
S BPRSNRV=+$G(BPRSNRV) ; resubmit without reversal flag
S BP59="",BPQ=""
F S BP59=$O(RXI(BP59)) Q:BP59="" D Q:BPQ="^"
. I BPIFANY=0 W @IOF
. S BPIFANY=1,BPQ=""
. S BPDFN=+$P($G(^BPST(BP59,0)),U,6)
. I 'BPRSNRV W !,"You've chosen to RESUBMIT the following prescription for "_$E($$PATNAME^BPSSCRU2(BPDFN),1,13)
. I BPRSNRV W !,"You've chosen to RESUBMIT W/O REVERSAL the following Rx for "_$E($$PATNAME^BPSSCRU2(BPDFN),1,13)
. W !,@VALMAR@(+$G(RXI(BP59)),0)
. S (BPRVNEED,BPRVRSED,BPRVWAIT,BPRVRSNT)=0
. S BPQ=$$YESNO("Are you sure?(Y/N)")
. I BPQ=-1 S BPQ="^" Q
. I BPQ'=1 Q
. ;
. ; check for non-billable entry with the RER action (not allowed. need to use regular RES)
. I $$NB^BPSSCR03(BP59),BPRSNRV D Q
. . W !!,">> Cannot Resubmit w/o Reversal ",!,$G(@VALMAR@(+$G(RXI(BP59)),0))
. . W !," because this is a NON BILLABLE entry. Please use the RES action instead.",!
. . Q
. ;
. S RXIEN=$P(BP59,".")
. S RXR=+$E($P(BP59,".",2),1,4)
. I BPRVNEED=1&(BPRVRSED'=1) Q ;cannot be resubmitted
. ;
. I $$RXDEL^BPSOS(+RXIEN,RXR) W !!,">> Cannot Reverse or Resubmit ",!,@VALMAR@(+$G(RXI(BP59)),0),!," because it has been deleted in Pharmacy.",! Q
. ;
. ;can't resubmit a closed claim. The user must reopen first.
. I $$CLOSED^BPSSCRU1(BP59) D Q
. . W !!,">> Cannot Resubmit ",!,$G(@VALMAR@(+$G(RXI(BP59)),0)),!," because the claim is Closed. Reopen the claim and try again.",! Q
. ;
. ; can't resubmit an unreleased, auto reversed claim.
. I '$$RELEASED^BPSRPT1(RXIEN,RXR),$$AUTOREV^BPSRPT1(BP59) D Q
. . W !!,">> Cannot Resubmit ",!,$G(@VALMAR@(+$G(RXI(BP59)),0)),!," because the claim is Unreleased and Auto Reversed.",! Q
. ;
. S BPSTATUS=$P($$CLAIMST^BPSSCRU3(BP59),U)
. S BPSCOB=$$COB59^BPSUTIL2(BP59) ;get COB for the BPS TRANSACTION IEN
. ;
. ; check to see if any non-cancelled K# bills exist when doing a Resubmit w/o Reversal - BPS*1*20
. I BPRSNRV D I 'BPSCONT Q
. . S BPSCONT=1 ; continue flag
. . N BPG,BPSIB,IBIFN,IB
. . S BPG=$$RXBILL^IBNCPUT3(RXIEN,RXR,$S(BPSCOB=1:"P",BPSCOB=2:"S",1:"T"),"",.BPSIB) ; DBIA# 5355
. . S IBIFN=0 F S IBIFN=$O(BPSIB(IBIFN)) Q:'IBIFN D
. . . S IB=$G(BPSIB(IBIFN))
. . . I $P(IB,U,2)="CB"!($P(IB,U,2)="CN") Q ; cancelled bill in AR, these are OK so quit here
. . . S BPSCONT=0 ; can't continue any longer, report on bill(s) found
. . . W !!?4,"Rx# ",$$RXNUM^BPSSCRU2(RXIEN)," was previously billed."
. . . W !?4,"Please review bill# ",$P(IB,U,1)," to determine if it should be cancelled."
. . . W !?4,"The claim cannot be resubmitted without a reversal to ECME unless the"
. . . W !?4,"existing bill is cancelled."
. . . W !!?4,"Cannot submit to ECME using Resubmit Claim w/o Reversal.",!
. . . Q
. . Q
. ;
. I BPSCOB<2,$$PAYABLE^BPSOSRX5(BPSTATUS),BPINPROG=0,$$PAYBLSEC^BPSUTIL2(BP59) D S BPQ=$$PAUSE^BPSSCRRV() Q
. . W !,"The claim: ",!,$G(@VALMAR@(+$G(RXI(BP59)),0)),!,"cannot be Resubmitted if the secondary claim is payable.",!,"Please reverse the secondary claim first."
. ;
. ;If this is a secondary, make sure Primary is either Payable or Closed.
. S BPPRIOPN=0 I BPSCOB=2 D Q:BPPRIOPN=1
. . ;Get Primary claim status
. . S BPSPCLS=$$FINDECLM^BPSPRRX5(RXIEN,RXR,1)
. . I $P(BPSPCLS,U)>1 D
. . . Q:$$CLOSED^BPSSCRU1($P(BPSPCLS,U,2))
. . . W !,"The secondary claim cannot be Resubmitted unless the primary is either payable",!,"or closed. Please resubmit or close the primary claim first."
. . . S BPPRIOPN=1
. ;
. I (BPSTATUS="IN PROGRESS")!(BPSTATUS="SCHEDULED") S BPINPROG=1
. I BPINPROG=1 D I $$YESNO^BPSSCRRS("Do you want to proceed?(Y/N)")=0 S BPQ="^" Q
. . W !,"The claim is in progress. The request will be scheduled and processed after"
. . W !,"the previous request(s) are completed. Please be aware that the result of "
. . W !,"the resubmit depends on the payer's response to the prior incomplete requests."
. ;
. S DOSDATE=$$DOSDATE(RXIEN,RXR)
. ;
. ; set the ECME BWHERE value and the correct reversal reason value
. I BPRSNRV S BPSRSWHR="ERWV",BPSRSRRS=""
. I 'BPRSNRV,$$NB^BPSSCR03(BP59) S BPSRSWHR="ERNB",BPSRSRRS=""
. I 'BPRSNRV,'$$NB^BPSSCR03(BP59) S BPSRSWHR="ERES",BPSRSRRS="ECME RESUBMIT"
. ;
. ; Attempt to resubmit the claim.
. S BILLNUM=$$EN^BPSNCPDP(RXIEN,RXR,DOSDATE,BPSRSWHR,"",BPSRSRRS,,,,,BPSCOB)
. ;
. ;print return value message
. W !!
. W:+BILLNUM>0 $S(+BILLNUM=10:"Reversal but no Resubmit:",1:"Not Processed:"),!," "
. ;Change Return Message for SC/EI
. S:$P(BILLNUM,U,2)="NEEDS SC DETERMINATION" $P(BILLNUM,U,2)="NEEDS SC/EI DETERMINATION"
. ;
. K ^UTILITY($J,"W")
. S X=$P(BILLNUM,U,2)
. S DIWF="W"
. S DIWL=1
. S DIWR=75
. D ^DIWP
. D ^DIWW
. K ^UTILITY($J,"W")
. ;
. ; 0 Prescription/Fill successfully submitted to ECME for claims processing
. ; 1 ECME did not submit prescription/fill
. ; 2 IB says prescription/fill is not ECME billable or the data returned from IB is not valid
. ; 3 ECME closed the claim but did not submit it to the payer
. ; 4 Unable to queue the ECME claim
. ; 5 Invalid input
. ; 10 Reversal but no resubmit
. I +BILLNUM=0 D
. . D ECMEACT^PSOBPSU1(+RXIEN,+RXR,"Claim resubmitted to 3rd party payer: ECME USER's SCREEN-"_$S(BPSCOB=1:"p",BPSCOB=2:"s",1:"")_$$INSNAME^BPSSCRU6(BP59))
. . S UPDATFLG=1,BPCLTOT=BPCLTOT+1
. I +BILLNUM=10 D
. . D ECMEACT^PSOBPSU1(+RXIEN,+RXR,"Claim reversed but not resubmitted: ECME USER's SCREEN-"_$S(BPSCOB=1:"p",BPSCOB=2:"s",1:"")_$$INSNAME^BPSSCRU6(BP59))
. . S UPDATFLG=1,BPCLTOTR=BPCLTOTR+1
. ;
. ; If non-billable, first close any open eT/eC reject, and then
. ; call WRKLST^PSOREJU4 to put a new eT/eC reject on the
. ; prescription. Finally, add an entry to the Activity Log.
. I +BILLNUM=2 D
. . S UPDATFLG=1
. . I $$ECETREJ^PSXRPPL2(RXIEN) D CLSALL^PSOREJUT(RXIEN,RXR,DUZ,1)
. . D WRKLST^PSOREJU4(RXIEN,RXR,"",DUZ,"",1,BPSCOB,BILLNUM)
. . S BPSTC=$P(BILLNUM,U,3)
. . S BPSCOM=$S(BPSTC="T":"TRICARE-",BPSTC="C":"CHAMPVA-",1:"")_"Not ECME Billable: "_$P(BILLNUM,U,2)
. . D RXACT^PSOBPSU2(RXIEN,RXR,BPSCOM,"M",DUZ)
. . Q
. Q
;
W:BPIFANY=0 !,"No eligible items selected."
W !,BPCLTOT," claim",$S(BPCLTOT'=1:"s have",1:" has")," been resubmitted.",!
W:BPCLTOTR>0 !,BPCLTOTR," claim",$S(BPCLTOTR'=1:"s have",1:" has")," been reversed but not resubmitted.",!
D PAUSE^VALM1
Q UPDATFLG
;
; Ask
; Input:
; BPQSTR - question
; BPDFL - default answer
; Output:
; 1 YES
; 0 NO
; -1 if cancelled
YESNO(BPQSTR,BPDFL) ; Default - YES
N DIR,Y,DUOUT
S DIR(0)="Y"
S DIR("A")=BPQSTR
S:$L($G(BPDFL)) DIR("B")=BPDFL
D ^DIR
Q $S($G(DUOUT)!$G(DUOUT)!(Y="^"):-1,1:Y)
;
DOSDATE(RXIEN,RXR) ;
; Function that returns the date of service
; Input
; RXIEN - IEN in file #52
; RXR - refill number
; Returns:
; Date of Service
N BPDOS,BPDT,TODAY
;
; Try release date
S BPDOS=$$RXRLDT^PSOBPSUT($G(RXIEN),$G(RXR))
;
; If there is no release date, use the current day
S TODAY=$$DT^XLFDT
I BPDOS=""!(BPDOS>TODAY) S BPDOS=TODAY
Q BPDOS\1
;
;Function to get the Date of Service formatted for display
; note: functionality replaces FILLDATE() which has been retired.
;input:
; RXIEN - IEN in file #52
; RXR - refill number
;returns:
; date of service or empty date if failure
DOSDT(RXIEN,RXR) ;
N DOSDT
S DOSDT=$$DOSDATE(RXIEN,RXR)
I $L(DOSDT)'=7 Q " / "
Q $E(DOSDT,4,5)_"/"_$E(DOSDT,6,7)
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSSCRRS 10667 printed Dec 13, 2024@01:53:16 Page 2
BPSSCRRS ;BHAM ISC/SS - ECME SCREEN RESUBMIT ;05-APR-05
+1 ;;1.0;E CLAIMS MGMT ENGINE;**1,3,5,7,8,10,11,20,26,31,35**;JUN 2004;Build 14
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ; Reference to $$RXRLDT^PSOBPSUT in ICR #4701
+4 ; Reference to ECMEACT^PSOBPSU1 in ICR #4702
+5 ; Reference to $$WRKLST^PSOREJU4 in ICR #5063
+6 ; Reference to $$RXBILL^IBNCPUT3 in ICR #5355
+7 ; Reference to $$ECETREJ^PSXRPPL2 in ICR #7352
+8 ;
+9 QUIT
+10 ;
RES ;
+1 NEW BPRET,BPSARR59
+2 IF '$DATA(@(VALMAR))
QUIT
+3 DO FULL^VALM1
+4 WRITE !,"Enter the line numbers for the claim(s) to be resubmitted."
+5 SET BPRET=$$ASKLINES^BPSSCRU4("Select item(s)","C",.BPSARR59,VALMAR)
+6 IF BPRET="^"
SET VALMBCK="R"
QUIT
+7 ;go thru all selected claims and try to resubmit them separately
+8 ;update the content of the screen and display it
+9 ;only if at least one claim was submitted successfully
+10 IF $$RESUBMIT(.BPSARR59)
DO REDRAW^BPSSCRUD("Updating screen for resubmitted claims...")
+11 IF '$TEST
SET VALMBCK="R"
+12 QUIT
+13 ;
RESNRV ; entry point for action protocol for Resubmit Claim Without Reversal (BPS*1*20)
+1 ; special variable BPRSNRV=1 when doing a resubmit w/o reversal. The Resubmit will be done without
+2 ; regard to current claim status
+3 ;
+4 NEW BPRET,BPSARR59,BPRSNRV
+5 SET BPRSNRV=1
+6 IF '$DATA(@(VALMAR))
QUIT
+7 DO FULL^VALM1
+8 WRITE "Resubmit Claim w/o Reversal"
+9 WRITE !!?4,"Note: This action will resubmit claims without performing a reversal."
+10 WRITE !!?10,"This action should be used in instances where the payer shows the"
+11 WRITE !?10,"claim was reversed and VistA shows a payable claim. This action will"
+12 WRITE !?10,"NOT submit a reversal regardless of the current VistA claim status."
+13 WRITE !!,"Enter the line numbers for the claim(s) to be resubmitted w/o reversal."
+14 SET BPRET=$$ASKLINES^BPSSCRU4("Select item(s)","C",.BPSARR59,VALMAR)
+15 IF BPRET="^"
SET VALMBCK="R"
QUIT
+16 ;go thru all selected claims and try to resubmit them separately
+17 ;update the content of the screen and display it
+18 ;only if at least one claim was submitted successfully
+19 IF $$RESUBMIT(.BPSARR59,BPRSNRV)
DO REDRAW^BPSSCRUD("Updating screen for resubmitted claims...")
+20 IF '$TEST
SET VALMBCK="R"
+21 QUIT
+22 ;
+23 ;/**
+24 ;go thru all selected claims and try to resubmit them separately
+25 ;input:
+26 ; RXI - array with ptrs to BPS TRANSACTION file (see ASKLINES^BPSSCRU4)
+27 ; BPRSNRV - optional flag indicating if resubmit action is a normal resubmit (default) or a resubmit w/o reversal
+28 ; - BPRSNRV=0 for normal resubmit (default)
+29 ; - BPRSNRV=1 for resubmit without a reversal
+30 ;returns
+31 ; 0 - if no claims were resubmitted
+32 ; 1 - if at least one claim was resubmitted
RESUBMIT(RXI,BPRSNRV) ;*/
+1 ;was successfully reversed
NEW BPRVRSED
+2 ;needs reversal
NEW BPRVNEED
+3 ;cycles of waiting
NEW BPRVWAIT
+4 ;reversal has been sent
NEW BPRVRSNT
+5 ;
+6 NEW BILLNUM,BP59,BPCLTOT,BPCLTOTR,BPDFN,BPPRIOPN,BPQ,BPSCOB,BPSCOM
+7 NEW BPSCONT,BPSPCLS,BPSRSRRS,BPSRSWHR,BPSTATUS,BPSTC,DIWF,DIWL,DIWR
+8 NEW DOSDATE,RXIEN,RXR,UPDATFLG,WHERE,X
+9 ;
+10 NEW REVCOUNT
SET REVCOUNT=0
+11 NEW BPIFANY
SET BPIFANY=0
+12 NEW BPINPROG
SET BPINPROG=0
+13 ;
+14 ;total for resubmitted
SET BPCLTOT=0
+15 ;total for reversed, not resubmitted
SET BPCLTOTR=0
+16 SET UPDATFLG=0
+17 ; resubmit without reversal flag
SET BPRSNRV=+$GET(BPRSNRV)
+18 SET BP59=""
SET BPQ=""
+19 FOR
SET BP59=$ORDER(RXI(BP59))
if BP59=""
QUIT
Begin DoDot:1
+20 IF BPIFANY=0
WRITE @IOF
+21 SET BPIFANY=1
SET BPQ=""
+22 SET BPDFN=+$PIECE($GET(^BPST(BP59,0)),U,6)
+23 IF 'BPRSNRV
WRITE !,"You've chosen to RESUBMIT the following prescription for "_$EXTRACT($$PATNAME^BPSSCRU2(BPDFN),1,13)
+24 IF BPRSNRV
WRITE !,"You've chosen to RESUBMIT W/O REVERSAL the following Rx for "_$EXTRACT($$PATNAME^BPSSCRU2(BPDFN),1,13)
+25 WRITE !,@VALMAR@(+$GET(RXI(BP59)),0)
+26 SET (BPRVNEED,BPRVRSED,BPRVWAIT,BPRVRSNT)=0
+27 SET BPQ=$$YESNO("Are you sure?(Y/N)")
+28 IF BPQ=-1
SET BPQ="^"
QUIT
+29 IF BPQ'=1
QUIT
+30 ;
+31 ; check for non-billable entry with the RER action (not allowed. need to use regular RES)
+32 IF $$NB^BPSSCR03(BP59)
IF BPRSNRV
Begin DoDot:2
+33 WRITE !!,">> Cannot Resubmit w/o Reversal ",!,$GET(@VALMAR@(+$GET(RXI(BP59)),0))
+34 WRITE !," because this is a NON BILLABLE entry. Please use the RES action instead.",!
+35 QUIT
End DoDot:2
QUIT
+36 ;
+37 SET RXIEN=$PIECE(BP59,".")
+38 SET RXR=+$EXTRACT($PIECE(BP59,".",2),1,4)
+39 ;cannot be resubmitted
IF BPRVNEED=1&(BPRVRSED'=1)
QUIT
+40 ;
+41 IF $$RXDEL^BPSOS(+RXIEN,RXR)
WRITE !!,">> Cannot Reverse or Resubmit ",!,@VALMAR@(+$GET(RXI(BP59)),0),!," because it has been deleted in Pharmacy.",!
QUIT
+42 ;
+43 ;can't resubmit a closed claim. The user must reopen first.
+44 IF $$CLOSED^BPSSCRU1(BP59)
Begin DoDot:2
+45 WRITE !!,">> Cannot Resubmit ",!,$GET(@VALMAR@(+$GET(RXI(BP59)),0)),!," because the claim is Closed. Reopen the claim and try again.",!
QUIT
End DoDot:2
QUIT
+46 ;
+47 ; can't resubmit an unreleased, auto reversed claim.
+48 IF '$$RELEASED^BPSRPT1(RXIEN,RXR)
IF $$AUTOREV^BPSRPT1(BP59)
Begin DoDot:2
+49 WRITE !!,">> Cannot Resubmit ",!,$GET(@VALMAR@(+$GET(RXI(BP59)),0)),!," because the claim is Unreleased and Auto Reversed.",!
QUIT
End DoDot:2
QUIT
+50 ;
+51 SET BPSTATUS=$PIECE($$CLAIMST^BPSSCRU3(BP59),U)
+52 ;get COB for the BPS TRANSACTION IEN
SET BPSCOB=$$COB59^BPSUTIL2(BP59)
+53 ;
+54 ; check to see if any non-cancelled K# bills exist when doing a Resubmit w/o Reversal - BPS*1*20
+55 IF BPRSNRV
Begin DoDot:2
+56 ; continue flag
SET BPSCONT=1
+57 NEW BPG,BPSIB,IBIFN,IB
+58 ; DBIA# 5355
SET BPG=$$RXBILL^IBNCPUT3(RXIEN,RXR,$SELECT(BPSCOB=1:"P",BPSCOB=2:"S",1:"T"),"",.BPSIB)
+59 SET IBIFN=0
FOR
SET IBIFN=$ORDER(BPSIB(IBIFN))
if 'IBIFN
QUIT
Begin DoDot:3
+60 SET IB=$GET(BPSIB(IBIFN))
+61 ; cancelled bill in AR, these are OK so quit here
IF $PIECE(IB,U,2)="CB"!($PIECE(IB,U,2)="CN")
QUIT
+62 ; can't continue any longer, report on bill(s) found
SET BPSCONT=0
+63 WRITE !!?4,"Rx# ",$$RXNUM^BPSSCRU2(RXIEN)," was previously billed."
+64 WRITE !?4,"Please review bill# ",$PIECE(IB,U,1)," to determine if it should be cancelled."
+65 WRITE !?4,"The claim cannot be resubmitted without a reversal to ECME unless the"
+66 WRITE !?4,"existing bill is cancelled."
+67 WRITE !!?4,"Cannot submit to ECME using Resubmit Claim w/o Reversal.",!
+68 QUIT
End DoDot:3
+69 QUIT
End DoDot:2
IF 'BPSCONT
QUIT
+70 ;
+71 IF BPSCOB<2
IF $$PAYABLE^BPSOSRX5(BPSTATUS)
IF BPINPROG=0
IF $$PAYBLSEC^BPSUTIL2(BP59)
Begin DoDot:2
+72 WRITE !,"The claim: ",!,$GET(@VALMAR@(+$GET(RXI(BP59)),0)),!,"cannot be Resubmitted if the secondary claim is payable.",!,"Please reverse the secondary claim first."
End DoDot:2
SET BPQ=$$PAUSE^BPSSCRRV()
QUIT
+73 ;
+74 ;If this is a secondary, make sure Primary is either Payable or Closed.
+75 SET BPPRIOPN=0
IF BPSCOB=2
Begin DoDot:2
+76 ;Get Primary claim status
+77 SET BPSPCLS=$$FINDECLM^BPSPRRX5(RXIEN,RXR,1)
+78 IF $PIECE(BPSPCLS,U)>1
Begin DoDot:3
+79 if $$CLOSED^BPSSCRU1($PIECE(BPSPCLS,U,2))
QUIT
+80 WRITE !,"The secondary claim cannot be Resubmitted unless the primary is either payable",!,"or closed. Please resubmit or close the primary claim first."
+81 SET BPPRIOPN=1
End DoDot:3
End DoDot:2
if BPPRIOPN=1
QUIT
+82 ;
+83 IF (BPSTATUS="IN PROGRESS")!(BPSTATUS="SCHEDULED")
SET BPINPROG=1
+84 IF BPINPROG=1
Begin DoDot:2
+85 WRITE !,"The claim is in progress. The request will be scheduled and processed after"
+86 WRITE !,"the previous request(s) are completed. Please be aware that the result of "
+87 WRITE !,"the resubmit depends on the payer's response to the prior incomplete requests."
End DoDot:2
IF $$YESNO^BPSSCRRS("Do you want to proceed?(Y/N)")=0
SET BPQ="^"
QUIT
+88 ;
+89 SET DOSDATE=$$DOSDATE(RXIEN,RXR)
+90 ;
+91 ; set the ECME BWHERE value and the correct reversal reason value
+92 IF BPRSNRV
SET BPSRSWHR="ERWV"
SET BPSRSRRS=""
+93 IF 'BPRSNRV
IF $$NB^BPSSCR03(BP59)
SET BPSRSWHR="ERNB"
SET BPSRSRRS=""
+94 IF 'BPRSNRV
IF '$$NB^BPSSCR03(BP59)
SET BPSRSWHR="ERES"
SET BPSRSRRS="ECME RESUBMIT"
+95 ;
+96 ; Attempt to resubmit the claim.
+97 SET BILLNUM=$$EN^BPSNCPDP(RXIEN,RXR,DOSDATE,BPSRSWHR,"",BPSRSRRS,,,,,BPSCOB)
+98 ;
+99 ;print return value message
+100 WRITE !!
+101 if +BILLNUM>0
WRITE $SELECT(+BILLNUM=10:"Reversal but no Resubmit:",1:"Not Processed:"),!," "
+102 ;Change Return Message for SC/EI
+103 if $PIECE(BILLNUM,U,2)="NEEDS SC DETERMINATION"
SET $PIECE(BILLNUM,U,2)="NEEDS SC/EI DETERMINATION"
+104 ;
+105 KILL ^UTILITY($JOB,"W")
+106 SET X=$PIECE(BILLNUM,U,2)
+107 SET DIWF="W"
+108 SET DIWL=1
+109 SET DIWR=75
+110 DO ^DIWP
+111 DO ^DIWW
+112 KILL ^UTILITY($JOB,"W")
+113 ;
+114 ; 0 Prescription/Fill successfully submitted to ECME for claims processing
+115 ; 1 ECME did not submit prescription/fill
+116 ; 2 IB says prescription/fill is not ECME billable or the data returned from IB is not valid
+117 ; 3 ECME closed the claim but did not submit it to the payer
+118 ; 4 Unable to queue the ECME claim
+119 ; 5 Invalid input
+120 ; 10 Reversal but no resubmit
+121 IF +BILLNUM=0
Begin DoDot:2
+122 DO ECMEACT^PSOBPSU1(+RXIEN,+RXR,"Claim resubmitted to 3rd party payer: ECME USER's SCREEN-"_$SELECT(BPSCOB=1:"p",BPSCOB=2:"s",1:"")_$$INSNAME^BPSSCRU6(BP59))
+123 SET UPDATFLG=1
SET BPCLTOT=BPCLTOT+1
End DoDot:2
+124 IF +BILLNUM=10
Begin DoDot:2
+125 DO ECMEACT^PSOBPSU1(+RXIEN,+RXR,"Claim reversed but not resubmitted: ECME USER's SCREEN-"_$SELECT(BPSCOB=1:"p",BPSCOB=2:"s",1:"")_$$INSNAME^BPSSCRU6(BP59))
+126 SET UPDATFLG=1
SET BPCLTOTR=BPCLTOTR+1
End DoDot:2
+127 ;
+128 ; If non-billable, first close any open eT/eC reject, and then
+129 ; call WRKLST^PSOREJU4 to put a new eT/eC reject on the
+130 ; prescription. Finally, add an entry to the Activity Log.
+131 IF +BILLNUM=2
Begin DoDot:2
+132 SET UPDATFLG=1
+133 IF $$ECETREJ^PSXRPPL2(RXIEN)
DO CLSALL^PSOREJUT(RXIEN,RXR,DUZ,1)
+134 DO WRKLST^PSOREJU4(RXIEN,RXR,"",DUZ,"",1,BPSCOB,BILLNUM)
+135 SET BPSTC=$PIECE(BILLNUM,U,3)
+136 SET BPSCOM=$SELECT(BPSTC="T":"TRICARE-",BPSTC="C":"CHAMPVA-",1:"")_"Not ECME Billable: "_$PIECE(BILLNUM,U,2)
+137 DO RXACT^PSOBPSU2(RXIEN,RXR,BPSCOM,"M",DUZ)
+138 QUIT
End DoDot:2
+139 QUIT
End DoDot:1
if BPQ="^"
QUIT
+140 ;
+141 if BPIFANY=0
WRITE !,"No eligible items selected."
+142 WRITE !,BPCLTOT," claim",$SELECT(BPCLTOT'=1:"s have",1:" has")," been resubmitted.",!
+143 if BPCLTOTR>0
WRITE !,BPCLTOTR," claim",$SELECT(BPCLTOTR'=1:"s have",1:" has")," been reversed but not resubmitted.",!
+144 DO PAUSE^VALM1
+145 QUIT UPDATFLG
+146 ;
+147 ; Ask
+148 ; Input:
+149 ; BPQSTR - question
+150 ; BPDFL - default answer
+151 ; Output:
+152 ; 1 YES
+153 ; 0 NO
+154 ; -1 if cancelled
YESNO(BPQSTR,BPDFL) ; Default - YES
+1 NEW DIR,Y,DUOUT
+2 SET DIR(0)="Y"
+3 SET DIR("A")=BPQSTR
+4 if $LENGTH($GET(BPDFL))
SET DIR("B")=BPDFL
+5 DO ^DIR
+6 QUIT $SELECT($GET(DUOUT)!$GET(DUOUT)!(Y="^"):-1,1:Y)
+7 ;
DOSDATE(RXIEN,RXR) ;
+1 ; Function that returns the date of service
+2 ; Input
+3 ; RXIEN - IEN in file #52
+4 ; RXR - refill number
+5 ; Returns:
+6 ; Date of Service
+7 NEW BPDOS,BPDT,TODAY
+8 ;
+9 ; Try release date
+10 SET BPDOS=$$RXRLDT^PSOBPSUT($GET(RXIEN),$GET(RXR))
+11 ;
+12 ; If there is no release date, use the current day
+13 SET TODAY=$$DT^XLFDT
+14 IF BPDOS=""!(BPDOS>TODAY)
SET BPDOS=TODAY
+15 QUIT BPDOS\1
+16 ;
+17 ;Function to get the Date of Service formatted for display
+18 ; note: functionality replaces FILLDATE() which has been retired.
+19 ;input:
+20 ; RXIEN - IEN in file #52
+21 ; RXR - refill number
+22 ;returns:
+23 ; date of service or empty date if failure
DOSDT(RXIEN,RXR) ;
+1 NEW DOSDT
+2 SET DOSDT=$$DOSDATE(RXIEN,RXR)
+3 IF $LENGTH(DOSDT)'=7
QUIT " / "
+4 QUIT $EXTRACT(DOSDT,4,5)_"/"_$EXTRACT(DOSDT,6,7)
+5 ;