| 1 | BPSSCRRV ;BHAM ISC/SS - ECME SCREEN REVERSE CLAIM ;05-APR-05 | 
|---|
| 2 | ;;1.0;E CLAIMS MGMT ENGINE;**1,5**;JUN 2004;Build 45 | 
|---|
| 3 | ;;Per VHA Directive 2004-038, this routine should not be modified. | 
|---|
| 4 | Q | 
|---|
| 5 | ;IA 4702 | 
|---|
| 6 | ; | 
|---|
| 7 | REV ;entry point for "Reverse" menu item | 
|---|
| 8 | N BPRET,BPSARR59 | 
|---|
| 9 | I '$D(@(VALMAR)) Q | 
|---|
| 10 | D FULL^VALM1 | 
|---|
| 11 | W !,"Enter the line numbers for the Payable claim(s) to be Reversed." | 
|---|
| 12 | S BPRET=$$ASKLINES^BPSSCRU4("Select item(s)","C",.BPSARR59,VALMAR) | 
|---|
| 13 | I BPRET="^" S VALMBCK="R" Q | 
|---|
| 14 | ;reverse selected lines | 
|---|
| 15 | ;update the content of the screen and display it | 
|---|
| 16 | ;only if at least one reversal was submitted successfully | 
|---|
| 17 | I $$RVLINES(.BPSARR59)>0 D REDRAW^BPSSCRUD("Updating screen for reversed claims...") | 
|---|
| 18 | E  S VALMBCK="R" | 
|---|
| 19 | Q | 
|---|
| 20 | ;/** | 
|---|
| 21 | ;Reverse selected lines | 
|---|
| 22 | ;input: | 
|---|
| 23 | ; BP59ARR(BP59)="line# in LM array " | 
|---|
| 24 | ;output: | 
|---|
| 25 | ; REVTOTAL - total number of claims for whose the reversal was submitted sucessfully | 
|---|
| 26 | RVLINES(BP59ARR) ;*/ | 
|---|
| 27 | N BP59,REVTOTAL,BPRVREAS,BPDFN,BPQ | 
|---|
| 28 | N BPIFANY S BPIFANY=0 | 
|---|
| 29 | N BPSTATS | 
|---|
| 30 | S REVTOTAL=0,BPQ="" | 
|---|
| 31 | S BP59="" F  S BP59=$O(BP59ARR(BP59)) Q:BP59=""  D  Q:BPQ="^" | 
|---|
| 32 | . I BPIFANY=0 W @IOF | 
|---|
| 33 | . S BPIFANY=1,BPQ="" | 
|---|
| 34 | . S BPDFN=+$P($G(^BPST(BP59,0)),U,6) | 
|---|
| 35 | . S BPSTATS=$P($$CLAIMST^BPSSCRU3(BP59),U) | 
|---|
| 36 | . I BPSTATS'["E DUPLICATE",BPSTATS'["E REVERSAL REJECTED",BPSTATS'["E REVERSAL STRANDED",BPSTATS'["E PAYABLE" D  S BPQ=$$PAUSE() Q | 
|---|
| 37 | . . W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"is NOT Payable and cannot be Reversed." | 
|---|
| 38 | . ; | 
|---|
| 39 | . W !,"You've chosen to REVERSE the following prescription for "_$E($$PATNAME^BPSSCRU2(BPDFN),1,13) | 
|---|
| 40 | . W !,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)) | 
|---|
| 41 | . F  S BPRVREAS=$$COMMENT^BPSSCRCL("Enter REQUIRED REVERSAL REASON",60) Q:BPRVREAS="^"  Q:($L(BPRVREAS)>0)&&(BPRVREAS'="^")&&('(BPRVREAS?1" "." "))  D | 
|---|
| 42 | . . W !,"Please provide the reason or enter ^ to abandon the reversal." | 
|---|
| 43 | . I BPRVREAS["^" W !,"The claim: ",!,$G(@VALMAR@(+$G(BP59ARR(BP59)),0)),!,"was NOT reversed!" S BPQ=$$PAUSE() Q | 
|---|
| 44 | . S BPQ=$$YESNO^BPSSCRRS("Are you sure?(Y/N)") | 
|---|
| 45 | . I BPQ=-1 S BPQ="^" Q | 
|---|
| 46 | . I BPQ'=1 Q | 
|---|
| 47 | . I $$REVERSIT(BP59,BPRVREAS)=0 S REVTOTAL=REVTOTAL+1 | 
|---|
| 48 | W:BPIFANY=0 !,"No eligible items selected." | 
|---|
| 49 | W !,REVTOTAL," claim reversal",$S(REVTOTAL'=1:"s",1:"")," in progress.",! | 
|---|
| 50 | D PAUSE^VALM1 | 
|---|
| 51 | Q REVTOTAL | 
|---|
| 52 | ; | 
|---|
| 53 | ; | 
|---|
| 54 | ;the similar to REVERSE | 
|---|
| 55 | ;with some information displayed for the user | 
|---|
| 56 | ;Input: | 
|---|
| 57 | ; BP59 ptr in file #9002313.59 | 
|---|
| 58 | ; BPRVREAS - reversal reason (free text) | 
|---|
| 59 | ;Output: | 
|---|
| 60 | ;-1 Claim is not Payable | 
|---|
| 61 | ;-2 no reversal, it's unreversable | 
|---|
| 62 | ;-3 paper claim | 
|---|
| 63 | ;>0 - IEN of reversal claim if electronic claim submitted for | 
|---|
| 64 | ;   reversal. | 
|---|
| 65 | REVERSIT(BP59,BPRVREAS) ; | 
|---|
| 66 | N BPRET | 
|---|
| 67 | N BPRX | 
|---|
| 68 | N BPRXRF | 
|---|
| 69 | S BPRXRF=$$RXREF^BPSSCRU2(BP59) | 
|---|
| 70 | S BPRET=+$$REVERSE(BP59,BPRVREAS,+BPRXRF,+$P(BPRXRF,U,2)) | 
|---|
| 71 | S BPRX=$$RXNUM^BPSSCRU2(+BPRXRF) | 
|---|
| 72 | Q BPRET | 
|---|
| 73 | ; | 
|---|
| 74 | ; | 
|---|
| 75 | ;/** | 
|---|
| 76 | ;Reverse the claim | 
|---|
| 77 | ;Input: | 
|---|
| 78 | ; BP59 ptr in file #9002313.59 | 
|---|
| 79 | ; BPRVREAS - reversal reason (free text) | 
|---|
| 80 | ; BPRX - RX ien (#52) | 
|---|
| 81 | ; BPFIL - refill number | 
|---|
| 82 | ;Output: | 
|---|
| 83 | ; code^message | 
|---|
| 84 | ; where | 
|---|
| 85 | ; code : | 
|---|
| 86 | ;  from $$EN^BPSNCPDP | 
|---|
| 87 | ;  0 Prescription/Fill successfully submitted to ECME for claims processing | 
|---|
| 88 | ;  1 ECME did not submit prescription/fill | 
|---|
| 89 | ;  2 IB says prescription/fill is not ECME billable or the data returned from IB is not valid | 
|---|
| 90 | ;  3 ECME closed the claim but did not submit it to the payer | 
|---|
| 91 | ;  4 Unable to queue the ECME claim | 
|---|
| 92 | ;  5 Invalid input | 
|---|
| 93 | ;  and additional | 
|---|
| 94 | ;  12 Claim has been deleted in Pharmacy. | 
|---|
| 95 | ; message - whatever $$EN^BPSNCPDP returns | 
|---|
| 96 | ; for 12 - "Claim has been deleted in Pharmacy." | 
|---|
| 97 | ; | 
|---|
| 98 | REVERSE(BP59,BPRVREAS,BPRX,BPFIL) ;*/ | 
|---|
| 99 | N BPDOS S BPDOS=$$DOSDATE^BPSSCRRS(BPRX,BPFIL) | 
|---|
| 100 | N BPNDC S BPNDC=$$NDC^BPSSCRU2(BPRX,BPFIL) | 
|---|
| 101 | N BPRET | 
|---|
| 102 | I $$RXDEL^BPSOS(BPRX,BPFIL) D  Q 12_U_"Claim has been deleted in Pharmacy." | 
|---|
| 103 | . W !,"The claim cannot be reversed since it has been deleted in Pharmacy." | 
|---|
| 104 | S BPRET=$$EN^BPSNCPDP(BPRX,BPFIL,BPDOS,"EREV",BPNDC,BPRVREAS) | 
|---|
| 105 | ;print return value message | 
|---|
| 106 | W !! | 
|---|
| 107 | W:+BPRET>0 "Not Processed:",!,"  " | 
|---|
| 108 | W $P(BPRET,U,2) | 
|---|
| 109 | ;0 Prescription/Fill successfully submitted to ECME for claims processing | 
|---|
| 110 | ;1 ECME did not submit prescription/fill | 
|---|
| 111 | ;2 IB says prescription/fill is not ECME billable or the data returned from IB is not valid | 
|---|
| 112 | ;3 ECME closed the claim but did not submit it to the payer | 
|---|
| 113 | ;4 Unable to queue the ECME claim | 
|---|
| 114 | ;5 Invalid input | 
|---|
| 115 | I +BPRET=0 D ECMEACT^PSOBPSU1(+BPRX,+BPFIL,"Claim reversal sent to 3rd party payer: ECME USER's SCREEN") | 
|---|
| 116 | Q BPRET | 
|---|
| 117 | ; | 
|---|
| 118 | PAUSE() ; | 
|---|
| 119 | N X | 
|---|
| 120 | W ! S DIR(0)="E" D ^DIR K DIR W ! | 
|---|
| 121 | Q X | 
|---|
| 122 | ; | 
|---|