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

BPSSCRRV.m

Go to the documentation of this file.
  1. 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
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. Q
  1. ;IA 4702
  1. ;
  1. REV ;entry point for "Reverse" menu item
  1. N BPRET,BPSARR59
  1. I '$D(@(VALMAR)) Q
  1. D FULL^VALM1
  1. W !,"Enter the line numbers for the Payable claim(s) to be Reversed."
  1. S BPRET=$$ASKLINES^BPSSCRU4("Select item(s)","C",.BPSARR59,VALMAR)
  1. I BPRET="^" S VALMBCK="R" Q
  1. ;reverse selected lines
  1. ;update the content of the screen and display it
  1. ;only if at least one reversal was submitted successfully
  1. I $$RVLINES(.BPSARR59)>0 D REDRAW^BPSSCRUD("Updating screen for reversed claims...")
  1. E S VALMBCK="R"
  1. Q
  1. ;/**
  1. ;Reverse selected lines
  1. ;input:
  1. ; BP59ARR(BP59)="line# in LM array "
  1. ;output:
  1. ; REVTOTAL - total number of claims for whose the reversal was submitted successfully
  1. RVLINES(BP59ARR) ;*/
  1. N BP59,REVTOTAL,BPRVREAS,BPDFN,BPQ,IBD,BPRXRF
  1. N BPINPROG S BPINPROG=0
  1. N BPIFANY S BPIFANY=0
  1. N BPSTATS
  1. S REVTOTAL=0,BPQ=""
  1. S BP59="" F S BP59=$O(BP59ARR(BP59)) Q:BP59="" D Q:BPQ="^"
  1. . I BPIFANY=0 W @IOF
  1. . S BPIFANY=1,BPQ=""
  1. . ;
  1. . ; don't allow reverse for non-billable entries
  1. . I $$NB^BPSSCR03(BP59) D S BPQ=$$PAUSE() Q
  1. .. W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"Entry is NON BILLABLE. There is no claim to reverse."
  1. .. Q
  1. . ;
  1. . ; can't reverse a closed claim. The user must reopen first.
  1. . I $$CLOSED02^BPSSCR03($P($G(^BPST(BP59,0)),U,4)) D S BPQ=$$PAUSE() Q
  1. . . W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"is Closed and cannot be Reversed. Reopen the claim and try again."
  1. . S BPDFN=+$P($G(^BPST(BP59,0)),U,6)
  1. . S BPSTATS=$P($$CLAIMST^BPSSCRU3(BP59),U)
  1. . I (BPSTATS="IN PROGRESS")!(BPSTATS="SCHEDULED") S BPINPROG=1
  1. . I BPINPROG=0,'$$PAYABLE^BPSOSRX5(BPSTATS) D S BPQ=$$PAUSE() Q
  1. . . W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"is NOT Payable and cannot be Reversed."
  1. . I BPINPROG=0,$P($G(^BPST(BP59,0)),U,14)<2,$$PAYBLSEC^BPSUTIL2(BP59) D S BPQ=$$PAUSE() Q
  1. . . W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"cannot be Reversed if the secondary claim is payable.",!,"Please reverse the secondary claim first."
  1. . I BPINPROG=1 D S BPQ=$$YESNO^BPSSCRRS("Do you want to proceed?(Y/N)") I BPQ<1 S BPQ="^" Q
  1. . . W !,"The claim you've chosen to REVERSE for "_$E($$PATNAME^BPSSCRU2(BPDFN),1,13)
  1. . . W !,$G(@VALMAR@(+$G(BP59ARR(BP59)),0))
  1. . . W !,"is in progress. The reversal request will be scheduled and processed after"
  1. . . W !,"the previous request(s) are completed. Please be aware that the result of "
  1. . . W !,"the reversal depends on the payer's response to the prior incomplete requests."
  1. . I BPINPROG=0 D
  1. . . W !,"You've chosen to REVERSE the following prescription for "_$E($$PATNAME^BPSSCRU2(BPDFN),1,13)
  1. . . W !,$G(@VALMAR@(+$G(BP59ARR(BP59)),0))
  1. . F S BPRVREAS=$$COMMENT^BPSSCRCL("Enter REQUIRED REVERSAL REASON",60) Q:BPRVREAS="^" Q:($L(BPRVREAS)>0)&(BPRVREAS'="^")&('(BPRVREAS?1" "." ")) D
  1. . . W !,"Please provide the reason or enter ^ to abandon the reversal."
  1. . I BPRVREAS["^" W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"was NOT reversed!" S BPQ=$$PAUSE() Q
  1. . S BPQ=$$YESNO^BPSSCRRS("Are you sure?(Y/N)")
  1. . I BPQ=-1 S BPQ="^" Q
  1. . I BPQ'=1 Q
  1. . I $$REVERSIT(BP59,BPRVREAS)=0 S REVTOTAL=REVTOTAL+1
  1. W:BPIFANY=0 !,"No eligible items selected."
  1. W !,REVTOTAL," claim reversal",$S(REVTOTAL'=1:"s",1:"")," submitted.",!
  1. D PAUSE^VALM1
  1. Q REVTOTAL
  1. ;
  1. ;
  1. ;the similar to REVERSE
  1. ;with some information displayed for the user
  1. ;Input:
  1. ; BP59 ptr in file #9002313.59
  1. ; BPRVREAS - reversal reason (free text)
  1. ;Output:
  1. ;-1 Claim is not Payable
  1. ;-2 no reversal, it's irreversible
  1. ;-3 paper claim
  1. ;>0 - IEN of reversal claim if electronic claim submitted for
  1. ; reversal.
  1. REVERSIT(BP59,BPRVREAS) ;
  1. N BPRET
  1. N BPRX
  1. N BPRXRF
  1. S BPRXRF=$$RXREF^BPSSCRU2(BP59)
  1. S BPRET=+$$REVERSE(BP59,BPRVREAS,+BPRXRF,+$P(BPRXRF,U,2))
  1. S BPRX=$$RXNUM^BPSSCRU2(+BPRXRF)
  1. Q BPRET
  1. ;
  1. ;
  1. ;/**
  1. ;Reverse the claim
  1. ;Input:
  1. ; BP59 ptr in file #9002313.59
  1. ; BPRVREAS - reversal reason (free text)
  1. ; BPRX - RX ien (#52)
  1. ; BPFIL - refill number
  1. ;Output:
  1. ; code^message
  1. ; where
  1. ; code :
  1. ; from $$EN^BPSNCPDP
  1. ; 0 Prescription/Fill successfully submitted to ECME for claims processing
  1. ; 1 ECME did not submit prescription/fill
  1. ; 2 IB says prescription/fill is not ECME billable or the data returned from IB is not valid
  1. ; 3 ECME closed the claim but did not submit it to the payer
  1. ; 4 Unable to queue the ECME claim
  1. ; 5 Invalid input
  1. ; and additional
  1. ; 12 Claim has been deleted in Pharmacy.
  1. ; message - whatever $$EN^BPSNCPDP returns
  1. ; for 12 - "Claim has been deleted in Pharmacy."
  1. ;
  1. REVERSE(BP59,BPRVREAS,BPRX,BPFIL) ;*/
  1. N BPDOS,BPNDC,BPRET,BPSARRY,BPSCLOSE,ERROR,BPSTATUS,BPCOBIND,BPQ
  1. S BPSCLOSE("CLOSE AFT REV")=0
  1. S BPDOS=$$DOSDATE^BPSSCRRS(BPRX,BPFIL)
  1. S BPNDC=$$NDC^BPSSCRU2(BPRX,BPFIL)
  1. I $$RXDEL^BPSOS(BPRX,BPFIL) D Q 12_U_"Claim has been deleted in Pharmacy."
  1. . W !,"The claim cannot be reversed since it has been deleted in Pharmacy."
  1. ;Prompt user to mark claim as non-billable and release patient copay
  1. ;if selected claim is for the Primary Insurer - Check COB INDICATOR = 1,
  1. ;or if COB INDICATOR is null for backward compatibility.
  1. I $P($G(^BPST(BP59,0)),U,14)'>1 D BILLCLM(.BPSCLOSE) I BPQ="-1" Q 1
  1. ;Submit claim to ECME
  1. S BPRET=$$EN^BPSNCPDP(BPRX,BPFIL,BPDOS,"EREV",BPNDC,BPRVREAS,"","","","",$$COB59^BPSUTIL2(BP59),"","",.BPSCLOSE)
  1. ;print return value message
  1. W !!
  1. W:+BPRET>0 "Not Processed:",!," ",$P(BPRET,U,2)
  1. I +BPRET=0 S BPSTATUS=$$CLAIMST^BPSSCRU3(BP59) I $P(BPSTATUS,U)="E REVERSAL ACCEPTED" W $P(BPSTATUS,U,3)
  1. ;
  1. ;0 Prescription/Fill successfully submitted to ECME for claims processing
  1. ;1 ECME did not submit prescription/fill
  1. ;2 IB says prescription/fill is not ECME billable or the data returned from IB is not valid
  1. ;3 ECME closed the claim but did not submit it to the payer
  1. ;4 Unable to queue the ECME claim
  1. ;5 Invalid input
  1. N BPSCOB S BPSCOB=$$COB59^BPSUTIL2(BP59) ;get COB for the BPS TRANSACTION IEN
  1. 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))
  1. Q BPRET
  1. ;
  1. ;
  1. ;Mark claim billable (YES/NO) question. If yes, ask for CLAIMS TRACKING
  1. ;NON-BILLABLE REASONS NAME
  1. ;Output:
  1. ;BPSCLOSE("CLOSE AFT REV")=1 or 0 (zero) (1 = YES, 0 = NO)
  1. ;BPSCLOSE("CLOSE AFT REV REASON")=ptr to #356.8 ^ CLOSE REASON NAME ^ ECME FLAG ^ ECME PAPER FLAG
  1. ;BPSCLOSE("CLOSE AFT REV COMMENT")=COMMENT TEXT
  1. BILLCLM(BPSCLOSE) ;
  1. N BPREAZ,BPCMT,BPCLAR
  1. S BPSCLOSE("CLOSE AFT REV")=0,BPSCLOSE("CLOSE AFT REV REASON")="",BPSCLOSE("CLOSE AFT REV COMMENT")=""
  1. W !,"Do you want to mark the claim as non-billable in Claims Tracking and release the Patient Copay (if any)"
  1. S BPQ=$$YESNO^BPSSCRRS("(Yes/No)") I BPQ<1 Q
  1. S BPSCLOSE("CLOSE AFT REV")=BPQ
  1. S BPREAZ=$$REASON^BPSSCRCL() I BPREAZ="^" S BPQ="-1" Q
  1. S BPSCLOSE("CLOSE AFT REV REASON")=+$P(BPREAZ,U)
  1. S BPCMT=$$COMMENT^BPSSCRCL("Comment ",40) I BPCMT="^" S BPQ="-1" Q
  1. S BPSCLOSE("CLOSE AFT REV COMMENT")=BPCMT
  1. S BPQ=$$YESNO^BPSSCRRS("Are you sure?(Y/N)")
  1. I BPQ<1 S BPSCLOSE("CLOSE AFT REV")=0,BPSCLOSE("CLOSE AFT REV REASON")="",BPSCLOSE("CLOSE AFT REV COMMENT")="",BPQ="-1" Q
  1. W !,"If the reversal is approved by the third-party payer, the claim will be marked as non-billable.",!
  1. Q
  1. ;
  1. PAUSE() ;
  1. N X
  1. W ! S DIR(0)="E" D ^DIR K DIR W !
  1. Q X
  1. ;