BPSSCRRV ;BHAM ISC/SS - ECME SCREEN REVERSE CLAIM ;05-APR-05
;;1.0;E CLAIMS MGMT ENGINE;**1,5,6,7,8,20**;JUN 2004;Build 27
;;Per VA Directive 6402, this routine should not be modified.
Q
;IA 4702
;
REV ;entry point for "Reverse" menu item
N BPRET,BPSARR59
I '$D(@(VALMAR)) Q
D FULL^VALM1
W !,"Enter the line numbers for the Payable claim(s) to be Reversed."
S BPRET=$$ASKLINES^BPSSCRU4("Select item(s)","C",.BPSARR59,VALMAR)
I BPRET="^" S VALMBCK="R" Q
;reverse selected lines
;update the content of the screen and display it
;only if at least one reversal was submitted successfully
I $$RVLINES(.BPSARR59)>0 D REDRAW^BPSSCRUD("Updating screen for reversed claims...")
E S VALMBCK="R"
Q
;/**
;Reverse selected lines
;input:
; BP59ARR(BP59)="line# in LM array "
;output:
; REVTOTAL - total number of claims for whose the reversal was submitted successfully
RVLINES(BP59ARR) ;*/
N BP59,REVTOTAL,BPRVREAS,BPDFN,BPQ,IBD,BPRXRF
N BPINPROG S BPINPROG=0
N BPIFANY S BPIFANY=0
N BPSTATS
S REVTOTAL=0,BPQ=""
S BP59="" F S BP59=$O(BP59ARR(BP59)) Q:BP59="" D Q:BPQ="^"
. I BPIFANY=0 W @IOF
. S BPIFANY=1,BPQ=""
. ;
. ; don't allow reverse for non-billable entries
. I $$NB^BPSSCR03(BP59) D S BPQ=$$PAUSE() Q
.. W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"Entry is NON BILLABLE. There is no claim to reverse."
.. Q
. ;
. ; can't reverse a closed claim. The user must reopen first.
. I $$CLOSED02^BPSSCR03($P($G(^BPST(BP59,0)),U,4)) D S BPQ=$$PAUSE() Q
. . W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"is Closed and cannot be Reversed. Reopen the claim and try again."
. S BPDFN=+$P($G(^BPST(BP59,0)),U,6)
. S BPSTATS=$P($$CLAIMST^BPSSCRU3(BP59),U)
. I (BPSTATS="IN PROGRESS")!(BPSTATS="SCHEDULED") S BPINPROG=1
. I BPINPROG=0,'$$PAYABLE^BPSOSRX5(BPSTATS) D S BPQ=$$PAUSE() Q
. . W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"is NOT Payable and cannot be Reversed."
. I BPINPROG=0,$P($G(^BPST(BP59,0)),U,14)<2,$$PAYBLSEC^BPSUTIL2(BP59) D S BPQ=$$PAUSE() Q
. . W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"cannot be Reversed if the secondary claim is payable.",!,"Please reverse the secondary claim first."
. I BPINPROG=1 D S BPQ=$$YESNO^BPSSCRRS("Do you want to proceed?(Y/N)") I BPQ<1 S BPQ="^" Q
. . W !,"The claim you've chosen to REVERSE for "_$E($$PATNAME^BPSSCRU2(BPDFN),1,13)
. . W !,$G(@VALMAR@(+$G(BP59ARR(BP59)),0))
. . W !,"is in progress. The reversal request will be scheduled and processed after"
. . W !,"the previous request(s) are completed. Please be aware that the result of "
. . W !,"the reversal depends on the payer's response to the prior incomplete requests."
. I BPINPROG=0 D
. . W !,"You've chosen to REVERSE the following prescription for "_$E($$PATNAME^BPSSCRU2(BPDFN),1,13)
. . W !,$G(@VALMAR@(+$G(BP59ARR(BP59)),0))
. F S BPRVREAS=$$COMMENT^BPSSCRCL("Enter REQUIRED REVERSAL REASON",60) Q:BPRVREAS="^" Q:($L(BPRVREAS)>0)&(BPRVREAS'="^")&('(BPRVREAS?1" "." ")) D
. . W !,"Please provide the reason or enter ^ to abandon the reversal."
. I BPRVREAS["^" W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"was NOT reversed!" S BPQ=$$PAUSE() Q
. S BPQ=$$YESNO^BPSSCRRS("Are you sure?(Y/N)")
. I BPQ=-1 S BPQ="^" Q
. I BPQ'=1 Q
. I $$REVERSIT(BP59,BPRVREAS)=0 S REVTOTAL=REVTOTAL+1
W:BPIFANY=0 !,"No eligible items selected."
W !,REVTOTAL," claim reversal",$S(REVTOTAL'=1:"s",1:"")," submitted.",!
D PAUSE^VALM1
Q REVTOTAL
;
;
;the similar to REVERSE
;with some information displayed for the user
;Input:
; BP59 ptr in file #9002313.59
; BPRVREAS - reversal reason (free text)
;Output:
;-1 Claim is not Payable
;-2 no reversal, it's irreversible
;-3 paper claim
;>0 - IEN of reversal claim if electronic claim submitted for
; reversal.
REVERSIT(BP59,BPRVREAS) ;
N BPRET
N BPRX
N BPRXRF
S BPRXRF=$$RXREF^BPSSCRU2(BP59)
S BPRET=+$$REVERSE(BP59,BPRVREAS,+BPRXRF,+$P(BPRXRF,U,2))
S BPRX=$$RXNUM^BPSSCRU2(+BPRXRF)
Q BPRET
;
;
;/**
;Reverse the claim
;Input:
; BP59 ptr in file #9002313.59
; BPRVREAS - reversal reason (free text)
; BPRX - RX ien (#52)
; BPFIL - refill number
;Output:
; code^message
; where
; code :
; from $$EN^BPSNCPDP
; 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
; and additional
; 12 Claim has been deleted in Pharmacy.
; message - whatever $$EN^BPSNCPDP returns
; for 12 - "Claim has been deleted in Pharmacy."
;
REVERSE(BP59,BPRVREAS,BPRX,BPFIL) ;*/
N BPDOS,BPNDC,BPRET,BPSARRY,BPSCLOSE,ERROR,BPSTATUS,BPCOBIND,BPQ
S BPSCLOSE("CLOSE AFT REV")=0
S BPDOS=$$DOSDATE^BPSSCRRS(BPRX,BPFIL)
S BPNDC=$$NDC^BPSSCRU2(BPRX,BPFIL)
I $$RXDEL^BPSOS(BPRX,BPFIL) D Q 12_U_"Claim has been deleted in Pharmacy."
. W !,"The claim cannot be reversed since it has been deleted in Pharmacy."
;Prompt user to mark claim as non-billable and release patient copay
;if selected claim is for the Primary Insurer - Check COB INDICATOR = 1,
;or if COB INDICATOR is null for backward compatibility.
I $P($G(^BPST(BP59,0)),U,14)'>1 D BILLCLM(.BPSCLOSE) I BPQ="-1" Q 1
;Submit claim to ECME
S BPRET=$$EN^BPSNCPDP(BPRX,BPFIL,BPDOS,"EREV",BPNDC,BPRVREAS,"","","","",$$COB59^BPSUTIL2(BP59),"","",.BPSCLOSE)
;print return value message
W !!
W:+BPRET>0 "Not Processed:",!," ",$P(BPRET,U,2)
I +BPRET=0 S BPSTATUS=$$CLAIMST^BPSSCRU3(BP59) I $P(BPSTATUS,U)="E REVERSAL ACCEPTED" W $P(BPSTATUS,U,3)
;
;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
N BPSCOB S BPSCOB=$$COB59^BPSUTIL2(BP59) ;get COB for the BPS TRANSACTION IEN
I +BPRET=0 D ECMEACT^PSOBPSU1(+BPRX,+BPFIL,"Claim reversal sent to 3rd party payer: ECME USER's SCREEN-"_$S(BPSCOB=1:"p",BPSCOB=2:"s",1:"")_$$INSNAME^BPSSCRU6(BP59))
Q BPRET
;
;
;Mark claim billable (YES/NO) question. If yes, ask for CLAIMS TRACKING
;NON-BILLABLE REASONS NAME
;Output:
;BPSCLOSE("CLOSE AFT REV")=1 or 0 (zero) (1 = YES, 0 = NO)
;BPSCLOSE("CLOSE AFT REV REASON")=ptr to #356.8 ^ CLOSE REASON NAME ^ ECME FLAG ^ ECME PAPER FLAG
;BPSCLOSE("CLOSE AFT REV COMMENT")=COMMENT TEXT
BILLCLM(BPSCLOSE) ;
N BPREAZ,BPCMT,BPCLAR
S BPSCLOSE("CLOSE AFT REV")=0,BPSCLOSE("CLOSE AFT REV REASON")="",BPSCLOSE("CLOSE AFT REV COMMENT")=""
W !,"Do you want to mark the claim as non-billable in Claims Tracking and release the Patient Copay (if any)"
S BPQ=$$YESNO^BPSSCRRS("(Yes/No)") I BPQ<1 Q
S BPSCLOSE("CLOSE AFT REV")=BPQ
S BPREAZ=$$REASON^BPSSCRCL() I BPREAZ="^" S BPQ="-1" Q
S BPSCLOSE("CLOSE AFT REV REASON")=+$P(BPREAZ,U)
S BPCMT=$$COMMENT^BPSSCRCL("Comment ",40) I BPCMT="^" S BPQ="-1" Q
S BPSCLOSE("CLOSE AFT REV COMMENT")=BPCMT
S BPQ=$$YESNO^BPSSCRRS("Are you sure?(Y/N)")
I BPQ<1 S BPSCLOSE("CLOSE AFT REV")=0,BPSCLOSE("CLOSE AFT REV REASON")="",BPSCLOSE("CLOSE AFT REV COMMENT")="",BPQ="-1" Q
W !,"If the reversal is approved by the third-party payer, the claim will be marked as non-billable.",!
Q
;
PAUSE() ;
N X
W ! S DIR(0)="E" D ^DIR K DIR W !
Q X
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSSCRRV 7661 printed Dec 13, 2024@01:53:17 Page 2
BPSSCRRV ;BHAM ISC/SS - ECME SCREEN REVERSE CLAIM ;05-APR-05
+1 ;;1.0;E CLAIMS MGMT ENGINE;**1,5,6,7,8,20**;JUN 2004;Build 27
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 QUIT
+4 ;IA 4702
+5 ;
REV ;entry point for "Reverse" menu item
+1 NEW BPRET,BPSARR59
+2 IF '$DATA(@(VALMAR))
QUIT
+3 DO FULL^VALM1
+4 WRITE !,"Enter the line numbers for the Payable claim(s) to be Reversed."
+5 SET BPRET=$$ASKLINES^BPSSCRU4("Select item(s)","C",.BPSARR59,VALMAR)
+6 IF BPRET="^"
SET VALMBCK="R"
QUIT
+7 ;reverse selected lines
+8 ;update the content of the screen and display it
+9 ;only if at least one reversal was submitted successfully
+10 IF $$RVLINES(.BPSARR59)>0
DO REDRAW^BPSSCRUD("Updating screen for reversed claims...")
+11 IF '$TEST
SET VALMBCK="R"
+12 QUIT
+13 ;/**
+14 ;Reverse selected lines
+15 ;input:
+16 ; BP59ARR(BP59)="line# in LM array "
+17 ;output:
+18 ; REVTOTAL - total number of claims for whose the reversal was submitted successfully
RVLINES(BP59ARR) ;*/
+1 NEW BP59,REVTOTAL,BPRVREAS,BPDFN,BPQ,IBD,BPRXRF
+2 NEW BPINPROG
SET BPINPROG=0
+3 NEW BPIFANY
SET BPIFANY=0
+4 NEW BPSTATS
+5 SET REVTOTAL=0
SET BPQ=""
+6 SET BP59=""
FOR
SET BP59=$ORDER(BP59ARR(BP59))
if BP59=""
QUIT
Begin DoDot:1
+7 IF BPIFANY=0
WRITE @IOF
+8 SET BPIFANY=1
SET BPQ=""
+9 ;
+10 ; don't allow reverse for non-billable entries
+11 IF $$NB^BPSSCR03(BP59)
Begin DoDot:2
+12 WRITE !,"The claim: ",!,$GET(@VALMAR@(+$GET(BP59ARR(BP59)),0)),!,"Entry is NON BILLABLE. There is no claim to reverse."
+13 QUIT
End DoDot:2
SET BPQ=$$PAUSE()
QUIT
+14 ;
+15 ; can't reverse a closed claim. The user must reopen first.
+16 IF $$CLOSED02^BPSSCR03($PIECE($GET(^BPST(BP59,0)),U,4))
Begin DoDot:2
+17 WRITE !,"The claim: ",!,$GET(@VALMAR@(+$GET(BP59ARR(BP59)),0)),!,"is Closed and cannot be Reversed. Reopen the claim and try again."
End DoDot:2
SET BPQ=$$PAUSE()
QUIT
+18 SET BPDFN=+$PIECE($GET(^BPST(BP59,0)),U,6)
+19 SET BPSTATS=$PIECE($$CLAIMST^BPSSCRU3(BP59),U)
+20 IF (BPSTATS="IN PROGRESS")!(BPSTATS="SCHEDULED")
SET BPINPROG=1
+21 IF BPINPROG=0
IF '$$PAYABLE^BPSOSRX5(BPSTATS)
Begin DoDot:2
+22 WRITE !,"The claim: ",!,$GET(@VALMAR@(+$GET(BP59ARR(BP59)),0)),!,"is NOT Payable and cannot be Reversed."
End DoDot:2
SET BPQ=$$PAUSE()
QUIT
+23 IF BPINPROG=0
IF $PIECE($GET(^BPST(BP59,0)),U,14)<2
IF $$PAYBLSEC^BPSUTIL2(BP59)
Begin DoDot:2
+24 WRITE !,"The claim: ",!,$GET(@VALMAR@(+$GET(BP59ARR(BP59)),0)),!,"cannot be Reversed if the secondary claim is payable.",!,"Please reverse the secondary claim first."
End DoDot:2
SET BPQ=$$PAUSE()
QUIT
+25 IF BPINPROG=1
Begin DoDot:2
+26 WRITE !,"The claim you've chosen to REVERSE for "_$EXTRACT($$PATNAME^BPSSCRU2(BPDFN),1,13)
+27 WRITE !,$GET(@VALMAR@(+$GET(BP59ARR(BP59)),0))
+28 WRITE !,"is in progress. The reversal request will be scheduled and processed after"
+29 WRITE !,"the previous request(s) are completed. Please be aware that the result of "
+30 WRITE !,"the reversal depends on the payer's response to the prior incomplete requests."
End DoDot:2
SET BPQ=$$YESNO^BPSSCRRS("Do you want to proceed?(Y/N)")
IF BPQ<1
SET BPQ="^"
QUIT
+31 IF BPINPROG=0
Begin DoDot:2
+32 WRITE !,"You've chosen to REVERSE the following prescription for "_$EXTRACT($$PATNAME^BPSSCRU2(BPDFN),1,13)
+33 WRITE !,$GET(@VALMAR@(+$GET(BP59ARR(BP59)),0))
End DoDot:2
+34 FOR
SET BPRVREAS=$$COMMENT^BPSSCRCL("Enter REQUIRED REVERSAL REASON",60)
if BPRVREAS="^"
QUIT
if ($LENGTH(BPRVREAS)>0)&(BPRVREAS'="^")&('(BPRVREAS?1" "." "))
QUIT
Begin DoDot:2
+35 WRITE !,"Please provide the reason or enter ^ to abandon the reversal."
End DoDot:2
+36 IF BPRVREAS["^"
WRITE !,"The claim: ",!,$GET(@VALMAR@(+$GET(BP59ARR(BP59)),0)),!,"was NOT reversed!"
SET BPQ=$$PAUSE()
QUIT
+37 SET BPQ=$$YESNO^BPSSCRRS("Are you sure?(Y/N)")
+38 IF BPQ=-1
SET BPQ="^"
QUIT
+39 IF BPQ'=1
QUIT
+40 IF $$REVERSIT(BP59,BPRVREAS)=0
SET REVTOTAL=REVTOTAL+1
End DoDot:1
if BPQ="^"
QUIT
+41 if BPIFANY=0
WRITE !,"No eligible items selected."
+42 WRITE !,REVTOTAL," claim reversal",$SELECT(REVTOTAL'=1:"s",1:"")," submitted.",!
+43 DO PAUSE^VALM1
+44 QUIT REVTOTAL
+45 ;
+46 ;
+47 ;the similar to REVERSE
+48 ;with some information displayed for the user
+49 ;Input:
+50 ; BP59 ptr in file #9002313.59
+51 ; BPRVREAS - reversal reason (free text)
+52 ;Output:
+53 ;-1 Claim is not Payable
+54 ;-2 no reversal, it's irreversible
+55 ;-3 paper claim
+56 ;>0 - IEN of reversal claim if electronic claim submitted for
+57 ; reversal.
REVERSIT(BP59,BPRVREAS) ;
+1 NEW BPRET
+2 NEW BPRX
+3 NEW BPRXRF
+4 SET BPRXRF=$$RXREF^BPSSCRU2(BP59)
+5 SET BPRET=+$$REVERSE(BP59,BPRVREAS,+BPRXRF,+$PIECE(BPRXRF,U,2))
+6 SET BPRX=$$RXNUM^BPSSCRU2(+BPRXRF)
+7 QUIT BPRET
+8 ;
+9 ;
+10 ;/**
+11 ;Reverse the claim
+12 ;Input:
+13 ; BP59 ptr in file #9002313.59
+14 ; BPRVREAS - reversal reason (free text)
+15 ; BPRX - RX ien (#52)
+16 ; BPFIL - refill number
+17 ;Output:
+18 ; code^message
+19 ; where
+20 ; code :
+21 ; from $$EN^BPSNCPDP
+22 ; 0 Prescription/Fill successfully submitted to ECME for claims processing
+23 ; 1 ECME did not submit prescription/fill
+24 ; 2 IB says prescription/fill is not ECME billable or the data returned from IB is not valid
+25 ; 3 ECME closed the claim but did not submit it to the payer
+26 ; 4 Unable to queue the ECME claim
+27 ; 5 Invalid input
+28 ; and additional
+29 ; 12 Claim has been deleted in Pharmacy.
+30 ; message - whatever $$EN^BPSNCPDP returns
+31 ; for 12 - "Claim has been deleted in Pharmacy."
+32 ;
REVERSE(BP59,BPRVREAS,BPRX,BPFIL) ;*/
+1 NEW BPDOS,BPNDC,BPRET,BPSARRY,BPSCLOSE,ERROR,BPSTATUS,BPCOBIND,BPQ
+2 SET BPSCLOSE("CLOSE AFT REV")=0
+3 SET BPDOS=$$DOSDATE^BPSSCRRS(BPRX,BPFIL)
+4 SET BPNDC=$$NDC^BPSSCRU2(BPRX,BPFIL)
+5 IF $$RXDEL^BPSOS(BPRX,BPFIL)
Begin DoDot:1
+6 WRITE !,"The claim cannot be reversed since it has been deleted in Pharmacy."
End DoDot:1
QUIT 12_U_"Claim has been deleted in Pharmacy."
+7 ;Prompt user to mark claim as non-billable and release patient copay
+8 ;if selected claim is for the Primary Insurer - Check COB INDICATOR = 1,
+9 ;or if COB INDICATOR is null for backward compatibility.
+10 IF $PIECE($GET(^BPST(BP59,0)),U,14)'>1
DO BILLCLM(.BPSCLOSE)
IF BPQ="-1"
QUIT 1
+11 ;Submit claim to ECME
+12 SET BPRET=$$EN^BPSNCPDP(BPRX,BPFIL,BPDOS,"EREV",BPNDC,BPRVREAS,"","","","",$$COB59^BPSUTIL2(BP59),"","",.BPSCLOSE)
+13 ;print return value message
+14 WRITE !!
+15 if +BPRET>0
WRITE "Not Processed:",!," ",$PIECE(BPRET,U,2)
+16 IF +BPRET=0
SET BPSTATUS=$$CLAIMST^BPSSCRU3(BP59)
IF $PIECE(BPSTATUS,U)="E REVERSAL ACCEPTED"
WRITE $PIECE(BPSTATUS,U,3)
+17 ;
+18 ;0 Prescription/Fill successfully submitted to ECME for claims processing
+19 ;1 ECME did not submit prescription/fill
+20 ;2 IB says prescription/fill is not ECME billable or the data returned from IB is not valid
+21 ;3 ECME closed the claim but did not submit it to the payer
+22 ;4 Unable to queue the ECME claim
+23 ;5 Invalid input
+24 ;get COB for the BPS TRANSACTION IEN
NEW BPSCOB
SET BPSCOB=$$COB59^BPSUTIL2(BP59)
+25 IF +BPRET=0
DO ECMEACT^PSOBPSU1(+BPRX,+BPFIL,"Claim reversal sent to 3rd party payer: ECME USER's SCREEN-"_$SELECT(BPSCOB=1:"p",BPSCOB=2:"s",1:"")_$$INSNAME^BPSSCRU6(BP59))
+26 QUIT BPRET
+27 ;
+28 ;
+29 ;Mark claim billable (YES/NO) question. If yes, ask for CLAIMS TRACKING
+30 ;NON-BILLABLE REASONS NAME
+31 ;Output:
+32 ;BPSCLOSE("CLOSE AFT REV")=1 or 0 (zero) (1 = YES, 0 = NO)
+33 ;BPSCLOSE("CLOSE AFT REV REASON")=ptr to #356.8 ^ CLOSE REASON NAME ^ ECME FLAG ^ ECME PAPER FLAG
+34 ;BPSCLOSE("CLOSE AFT REV COMMENT")=COMMENT TEXT
BILLCLM(BPSCLOSE) ;
+1 NEW BPREAZ,BPCMT,BPCLAR
+2 SET BPSCLOSE("CLOSE AFT REV")=0
SET BPSCLOSE("CLOSE AFT REV REASON")=""
SET BPSCLOSE("CLOSE AFT REV COMMENT")=""
+3 WRITE !,"Do you want to mark the claim as non-billable in Claims Tracking and release the Patient Copay (if any)"
+4 SET BPQ=$$YESNO^BPSSCRRS("(Yes/No)")
IF BPQ<1
QUIT
+5 SET BPSCLOSE("CLOSE AFT REV")=BPQ
+6 SET BPREAZ=$$REASON^BPSSCRCL()
IF BPREAZ="^"
SET BPQ="-1"
QUIT
+7 SET BPSCLOSE("CLOSE AFT REV REASON")=+$PIECE(BPREAZ,U)
+8 SET BPCMT=$$COMMENT^BPSSCRCL("Comment ",40)
IF BPCMT="^"
SET BPQ="-1"
QUIT
+9 SET BPSCLOSE("CLOSE AFT REV COMMENT")=BPCMT
+10 SET BPQ=$$YESNO^BPSSCRRS("Are you sure?(Y/N)")
+11 IF BPQ<1
SET BPSCLOSE("CLOSE AFT REV")=0
SET BPSCLOSE("CLOSE AFT REV REASON")=""
SET BPSCLOSE("CLOSE AFT REV COMMENT")=""
SET BPQ="-1"
QUIT
+12 WRITE !,"If the reversal is approved by the third-party payer, the claim will be marked as non-billable.",!
+13 QUIT
+14 ;
PAUSE() ;
+1 NEW X
+2 WRITE !
SET DIR(0)="E"
DO ^DIR
KILL DIR
WRITE !
+3 QUIT X
+4 ;