BPSPSOU1 ;ALB/CFS - ECME VALIDATIONS FOR REVERSE AND RESUBMIT CALLED FROM OUTPATIENT PHARMACY ;15-OCT-05
;;1.0;E CLAIMS MGMT ENGINE;**20,24**;JUN 2004;Build 43
;;Per VA Directive 6402, this routine should not be modified.
; Reference to $$LSTRFL^PSOBPSU1 supported by IA #4702.
;
Q
;
VAL(RXIEN,FILL,PSOELIG,ACTION,COB,REVREAS,BPSSKIPCON) ;
; Input:
; RXIEN = Prescription ien
; FILL = FILL #
; PSOELIG = TRICARE or CHAMPVA
; ACTION = "REV" - Reverse or "RES" - Resubmit
; BPSSKIPCON = If 1, then skip the confirmation at the end
;
; Output:
; COB = Coordination of Benefits
; REVREAS = Reverse Reason
;
; Function Return Values:
; 0 = Failed validation
; 1 = Passed validation
;
; This functions does validation checks for Reversing and Resubmitting a claim
; called from the Prescription Edit screen hidden actions in Outpatient Pharmacy.
;
N BPINPROG,BPSTATS,BPSTIEN,BPSYN,DFN,PATNAME,VADM
I '$G(RXIEN) Q 0
I '$D(FILL) S FILL=$$LSTRFL^PSOBPSU1(RXIEN) ; Most recent fill. DBIA #4702.
S PSOELIG=$G(PSOELIG)
I ACTION'="REV",ACTION'="RES" Q 0
S BPINPROG=0
S COB=$$GETCOB^BPSBUTL(RXIEN,FILL),BPSTIEN=$P(COB,U,2),COB=$P(COB,U)
I COB="" D D PAUSE^VALM1 Q 0
. W !!,"Claim not found. Cannot "_$S(ACTION="REV":"Reverse.",1:"Resubmit.")
I COB=-1 W !!,"Primary and Secondary claims exist. Please contact OPECC." D PAUSE^VALM1 Q 0
S DFN=$P(^BPST(BPSTIEN,0),U,6)
D DEM^VADPT S PATNAME=VADM(1)
I $$NB^BPSSCR03(BPSTIEN) D D PAUSE^VALM1 Q 0
. W !!,$S(ACTION="REV":"REVERSE",1:"RESUBMIT")_" not allowed for "_PSOELIG_" Non-Billable claim."
I $$CLOSED02^BPSSCR03($P($G(^BPST(BPSTIEN,0)),U,4)) D D PAUSE^VALM1 Q 0
. W !!,"The claim is Closed and cannot be "_$S(ACTION="REV":"Reversed.",1:"Resubmitted.")
. W !," Please reopen the claim and try again."
S BPSTATS=$P($$CLAIMST^BPSSCRU3(BPSTIEN),U)
I (BPSTATS="IN PROGRESS")!(BPSTATS="SCHEDULED") S BPINPROG=1
I BPINPROG=0,ACTION="REV",'$$PAYABLE^BPSOSRX5(BPSTATS) D D PAUSE^VALM1 Q 0
. W !!,"The claim is NOT Payable and cannot be Reversed."
S BPSYN=1
I BPINPROG=1 D S BPSYN=$$YESNO("Do you want to proceed?(Y/N)") I BPSYN<1 Q 0
. W !!,"The claim you've chosen to "_$S(ACTION="REV":"REVERSE",1:"RESUBMIT")_" for "_$E(PATNAME,1,13)_" is in progress."
. W !,"The "_$S(ACTION="REV":"reversal",1:"resubmittal")_" request will be scheduled and processed after the previous"
. W !,"request(s) are completed. Please be aware that the result of the "_$S(ACTION="REV":"reversal",1:"resubmittal")
. W !,"depends on the payer's response to the prior incomplete requests."
I BPINPROG=0!(BPSYN) D
. I ACTION="RES",$G(BPSSKIPCON) Q
. W !!,"You've chosen to "_$S(ACTION="REV":"REVERSE",1:"RESUBMIT")_" the following prescription for "_$E(PATNAME,1,13)_"."
I ACTION="REV" D
. W !,"Please provide the reason or enter ^ to abandon the reversal."
. F S REVREAS=$$COMMENT^BPSSCRCL("Enter REQUIRED REVERSAL REASON",60) Q:REVREAS="^" Q:($L(REVREAS)>0)&(REVREAS'="^")&('(REVREAS?1" "." "))
I $G(REVREAS)["^" W !!,"The claim was NOT reversed!" D PAUSE^VALM1 Q 0
I $G(BPSSKIPCON) Q 1 ; Skip confirmation question if flag is set.
S BPSYN=$$YESNO("Are you sure?(Y/N)")
I BPSYN<1 Q 0
Q 1
;
YESNO(PSOSTR,PSOFL) ; Default - YES
N DIR,Y,DUOUT
S DIR(0)="Y"
S DIR("A")=PSOSTR
S:$L($G(PSOFL)) DIR("B")=PSOFL
D ^DIR
Q $S($G(DUOUT)!$G(DUOUT)!(Y="^"):-1,1:Y)
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSPSOU1 3479 printed Oct 16, 2024@17:53:16 Page 2
BPSPSOU1 ;ALB/CFS - ECME VALIDATIONS FOR REVERSE AND RESUBMIT CALLED FROM OUTPATIENT PHARMACY ;15-OCT-05
+1 ;;1.0;E CLAIMS MGMT ENGINE;**20,24**;JUN 2004;Build 43
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ; Reference to $$LSTRFL^PSOBPSU1 supported by IA #4702.
+4 ;
+5 QUIT
+6 ;
VAL(RXIEN,FILL,PSOELIG,ACTION,COB,REVREAS,BPSSKIPCON) ;
+1 ; Input:
+2 ; RXIEN = Prescription ien
+3 ; FILL = FILL #
+4 ; PSOELIG = TRICARE or CHAMPVA
+5 ; ACTION = "REV" - Reverse or "RES" - Resubmit
+6 ; BPSSKIPCON = If 1, then skip the confirmation at the end
+7 ;
+8 ; Output:
+9 ; COB = Coordination of Benefits
+10 ; REVREAS = Reverse Reason
+11 ;
+12 ; Function Return Values:
+13 ; 0 = Failed validation
+14 ; 1 = Passed validation
+15 ;
+16 ; This functions does validation checks for Reversing and Resubmitting a claim
+17 ; called from the Prescription Edit screen hidden actions in Outpatient Pharmacy.
+18 ;
+19 NEW BPINPROG,BPSTATS,BPSTIEN,BPSYN,DFN,PATNAME,VADM
+20 IF '$GET(RXIEN)
QUIT 0
+21 ; Most recent fill. DBIA #4702.
IF '$DATA(FILL)
SET FILL=$$LSTRFL^PSOBPSU1(RXIEN)
+22 SET PSOELIG=$GET(PSOELIG)
+23 IF ACTION'="REV"
IF ACTION'="RES"
QUIT 0
+24 SET BPINPROG=0
+25 SET COB=$$GETCOB^BPSBUTL(RXIEN,FILL)
SET BPSTIEN=$PIECE(COB,U,2)
SET COB=$PIECE(COB,U)
+26 IF COB=""
Begin DoDot:1
+27 WRITE !!,"Claim not found. Cannot "_$SELECT(ACTION="REV":"Reverse.",1:"Resubmit.")
End DoDot:1
DO PAUSE^VALM1
QUIT 0
+28 IF COB=-1
WRITE !!,"Primary and Secondary claims exist. Please contact OPECC."
DO PAUSE^VALM1
QUIT 0
+29 SET DFN=$PIECE(^BPST(BPSTIEN,0),U,6)
+30 DO DEM^VADPT
SET PATNAME=VADM(1)
+31 IF $$NB^BPSSCR03(BPSTIEN)
Begin DoDot:1
+32 WRITE !!,$SELECT(ACTION="REV":"REVERSE",1:"RESUBMIT")_" not allowed for "_PSOELIG_" Non-Billable claim."
End DoDot:1
DO PAUSE^VALM1
QUIT 0
+33 IF $$CLOSED02^BPSSCR03($PIECE($GET(^BPST(BPSTIEN,0)),U,4))
Begin DoDot:1
+34 WRITE !!,"The claim is Closed and cannot be "_$SELECT(ACTION="REV":"Reversed.",1:"Resubmitted.")
+35 WRITE !," Please reopen the claim and try again."
End DoDot:1
DO PAUSE^VALM1
QUIT 0
+36 SET BPSTATS=$PIECE($$CLAIMST^BPSSCRU3(BPSTIEN),U)
+37 IF (BPSTATS="IN PROGRESS")!(BPSTATS="SCHEDULED")
SET BPINPROG=1
+38 IF BPINPROG=0
IF ACTION="REV"
IF '$$PAYABLE^BPSOSRX5(BPSTATS)
Begin DoDot:1
+39 WRITE !!,"The claim is NOT Payable and cannot be Reversed."
End DoDot:1
DO PAUSE^VALM1
QUIT 0
+40 SET BPSYN=1
+41 IF BPINPROG=1
Begin DoDot:1
+42 WRITE !!,"The claim you've chosen to "_$SELECT(ACTION="REV":"REVERSE",1:"RESUBMIT")_" for "_$EXTRACT(PATNAME,1,13)_" is in progress."
+43 WRITE !,"The "_$SELECT(ACTION="REV":"reversal",1:"resubmittal")_" request will be scheduled and processed after the previous"
+44 WRITE !,"request(s) are completed. Please be aware that the result of the "_$SELECT(ACTION="REV":"reversal",1:"resubmittal")
+45 WRITE !,"depends on the payer's response to the prior incomplete requests."
End DoDot:1
SET BPSYN=$$YESNO("Do you want to proceed?(Y/N)")
IF BPSYN<1
QUIT 0
+46 IF BPINPROG=0!(BPSYN)
Begin DoDot:1
+47 IF ACTION="RES"
IF $GET(BPSSKIPCON)
QUIT
+48 WRITE !!,"You've chosen to "_$SELECT(ACTION="REV":"REVERSE",1:"RESUBMIT")_" the following prescription for "_$EXTRACT(PATNAME,1,13)_"."
End DoDot:1
+49 IF ACTION="REV"
Begin DoDot:1
+50 WRITE !,"Please provide the reason or enter ^ to abandon the reversal."
+51 FOR
SET REVREAS=$$COMMENT^BPSSCRCL("Enter REQUIRED REVERSAL REASON",60)
if REVREAS="^"
QUIT
if ($LENGTH(REVREAS)>0)&(REVREAS'="^")&('(REVREAS?1" "." "))
QUIT
End DoDot:1
+52 IF $GET(REVREAS)["^"
WRITE !!,"The claim was NOT reversed!"
DO PAUSE^VALM1
QUIT 0
+53 ; Skip confirmation question if flag is set.
IF $GET(BPSSKIPCON)
QUIT 1
+54 SET BPSYN=$$YESNO("Are you sure?(Y/N)")
+55 IF BPSYN<1
QUIT 0
+56 QUIT 1
+57 ;
YESNO(PSOSTR,PSOFL) ; Default - YES
+1 NEW DIR,Y,DUOUT
+2 SET DIR(0)="Y"
+3 SET DIR("A")=PSOSTR
+4 if $LENGTH($GET(PSOFL))
SET DIR("B")=PSOFL
+5 DO ^DIR
+6 QUIT $SELECT($GET(DUOUT)!$GET(DUOUT)!(Y="^"):-1,1:Y)
+7 ;