BPSPRRX4 ;ALB/SS - ePharmacy secondary billing ;16-DEC-08
;;1.0;E CLAIMS MGMT ENGINE;**8,9,11,28**;JUN 2004;Build 22
;;Per VA Directive 6402, this routine should not be modified.
;
PRIMARY(BPSRX,BPSRF,BPSDFN,BPSDOS,BPSECLM,BPRESUB) ;
;Primary claim processing
;Input:
; BPSRX - Prescription IEN
; BPSRF - Fill Number
; BPSDFN - Patient IEN
; BPSDOS - Date of service
; BPSECLM - Rresult of $$FINDECLM^BPSPRRX5
; BPRESUB - 1 = the user is resubmitting a new PRIMARY claim
;Return value
; Either the response from $$SUBMCLM^BPSPRRX2 or an error condition, such as
; "-100^Action cancelled"
N BPRATTYP,BPSPLNSL,BPSPLAN,BPSDAT,BPSQ,BPSWHERE,BPY,BP59,BPSPL59,BPSRT59,BPYDEF
S (BP59,BPSPL59,BPSRT59)=""
I BPRESUB=1 D
. S BP59=$$IEN59^BPSOSRX(BPSRX,BPSRF,1)
. ;get an old plan for resubmits
. S BPSPL59=+$P($G(^BPST(BP59,10,1,0)),U,1)
. S BPSRT59=+$P($G(^BPST(BP59,10,1,0)),U,8)
F S BPRATTYP=$$RATETYPE^BPSPRRX2(BPSRT59) Q:BPRATTYP'=""
I BPRATTYP=-1 Q "-100^Action cancelled"
;
;check for ePharmacy primary ins policy
S BPYDEF="N"
I '$$PRIINSCK(BPSDFN,BPSDOS) D
. S BPYDEF="Y"
. W !!,"Unable to find a primary insurance policy which is e-Pharmacy billable."
. W !,"You must correct this in order to continue.",!
. Q
;
;ask the user if he wants to jump to the BCN PATIENT INSURANCE option
S BPY=$$YESNO^BPSSCRRS("DO YOU WISH TO ADD/EDIT INSURANCE COMPANY DATA FOR THIS PATIENT?(Y/N)","N")
I BPY=1 D EN1^IBNCPDPI(BPSDFN)
I BPY=-1 Q "-100^Action cancelled"
;
I '$$PRIINSCK(BPSDFN,BPSDOS) Q "-110^No valid group insurance plans"
;
;display available e-billable plans and select the primary plan
S BPSQ=0
F D Q:BPSQ'=0
. S BPSPLAN=$$SELECTPL^BPSPRRX1(BPSDFN,BPSDOS,.BPSPLNSL,"PRIMARY INSURANCE POLICY",BPSPL59)
. I +BPSPLAN=0 S BPSQ=-100 Q
. ;if existing rejected/reversed claim
. I +BPSECLM=2,BPRESUB=0 I BPSPLAN=$$GETPL59^BPSPRRX5(+$P(BPSECLM,U,2)) W !,"Already submitted to this plan through ECME. Resubmit if necessary.",!! Q
. S BPSQ=1
Q:BPSQ=-100 "-100^Action cancelled"
Q:BPSQ=-105 "-105^The same group plan selected"
I $$YESNO^BPSSCRRS("SUBMIT CLAIM TO "_$P(BPSPLNSL(1),U,2)_" ?(Y/N)","Y")'=1 Q "-100^Action cancelled"
D ACTDTY^BPSPRRX7(BPSRX,BPSRF,BPSDFN,BPSDOS)
S BPSWHERE="P2"
I BPRESUB=1 S BPSWHERE="P2S"
Q $$SUBMCLM^BPSPRRX2(BPSRX,BPSRF,BPSDOS,BPSWHERE,1,BPSPLAN,.BPSDAT,BPRATTYP)
;
PRIINSCK(DFN,DOS) ; primary insurance check
; check to see if patient has primary ePharmacy insurance policy
; function value = 1 if there is one, 0 otherwise
;
N OK,BPSRET,BPSINS,BPX
S OK=0
I '$G(DFN)!'$G(DOS) G PRIINX
S BPSRET=$$INSUR^IBBAPI(DFN,DOS,"E",.BPSINS,"1,7,8")
I '$D(BPSINS) G PRIINX
S BPX=0 F S BPX=$O(BPSINS("IBBAPI","INSUR",BPX)) Q:'BPX D Q:OK
. I $P($G(BPSINS("IBBAPI","INSUR",BPX,7)),U,1)=1 S OK=1 Q
. Q
PRIINX ;
Q OK
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSPRRX4 2877 printed Dec 13, 2024@01:52:24 Page 2
BPSPRRX4 ;ALB/SS - ePharmacy secondary billing ;16-DEC-08
+1 ;;1.0;E CLAIMS MGMT ENGINE;**8,9,11,28**;JUN 2004;Build 22
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
PRIMARY(BPSRX,BPSRF,BPSDFN,BPSDOS,BPSECLM,BPRESUB) ;
+1 ;Primary claim processing
+2 ;Input:
+3 ; BPSRX - Prescription IEN
+4 ; BPSRF - Fill Number
+5 ; BPSDFN - Patient IEN
+6 ; BPSDOS - Date of service
+7 ; BPSECLM - Rresult of $$FINDECLM^BPSPRRX5
+8 ; BPRESUB - 1 = the user is resubmitting a new PRIMARY claim
+9 ;Return value
+10 ; Either the response from $$SUBMCLM^BPSPRRX2 or an error condition, such as
+11 ; "-100^Action cancelled"
+12 NEW BPRATTYP,BPSPLNSL,BPSPLAN,BPSDAT,BPSQ,BPSWHERE,BPY,BP59,BPSPL59,BPSRT59,BPYDEF
+13 SET (BP59,BPSPL59,BPSRT59)=""
+14 IF BPRESUB=1
Begin DoDot:1
+15 SET BP59=$$IEN59^BPSOSRX(BPSRX,BPSRF,1)
+16 ;get an old plan for resubmits
+17 SET BPSPL59=+$PIECE($GET(^BPST(BP59,10,1,0)),U,1)
+18 SET BPSRT59=+$PIECE($GET(^BPST(BP59,10,1,0)),U,8)
End DoDot:1
+19 FOR
SET BPRATTYP=$$RATETYPE^BPSPRRX2(BPSRT59)
if BPRATTYP'=""
QUIT
+20 IF BPRATTYP=-1
QUIT "-100^Action cancelled"
+21 ;
+22 ;check for ePharmacy primary ins policy
+23 SET BPYDEF="N"
+24 IF '$$PRIINSCK(BPSDFN,BPSDOS)
Begin DoDot:1
+25 SET BPYDEF="Y"
+26 WRITE !!,"Unable to find a primary insurance policy which is e-Pharmacy billable."
+27 WRITE !,"You must correct this in order to continue.",!
+28 QUIT
End DoDot:1
+29 ;
+30 ;ask the user if he wants to jump to the BCN PATIENT INSURANCE option
+31 SET BPY=$$YESNO^BPSSCRRS("DO YOU WISH TO ADD/EDIT INSURANCE COMPANY DATA FOR THIS PATIENT?(Y/N)","N")
+32 IF BPY=1
DO EN1^IBNCPDPI(BPSDFN)
+33 IF BPY=-1
QUIT "-100^Action cancelled"
+34 ;
+35 IF '$$PRIINSCK(BPSDFN,BPSDOS)
QUIT "-110^No valid group insurance plans"
+36 ;
+37 ;display available e-billable plans and select the primary plan
+38 SET BPSQ=0
+39 FOR
Begin DoDot:1
+40 SET BPSPLAN=$$SELECTPL^BPSPRRX1(BPSDFN,BPSDOS,.BPSPLNSL,"PRIMARY INSURANCE POLICY",BPSPL59)
+41 IF +BPSPLAN=0
SET BPSQ=-100
QUIT
+42 ;if existing rejected/reversed claim
+43 IF +BPSECLM=2
IF BPRESUB=0
IF BPSPLAN=$$GETPL59^BPSPRRX5(+$PIECE(BPSECLM,U,2))
WRITE !,"Already submitted to this plan through ECME. Resubmit if necessary.",!!
QUIT
+44 SET BPSQ=1
End DoDot:1
if BPSQ'=0
QUIT
+45 if BPSQ=-100
QUIT "-100^Action cancelled"
+46 if BPSQ=-105
QUIT "-105^The same group plan selected"
+47 IF $$YESNO^BPSSCRRS("SUBMIT CLAIM TO "_$PIECE(BPSPLNSL(1),U,2)_" ?(Y/N)","Y")'=1
QUIT "-100^Action cancelled"
+48 DO ACTDTY^BPSPRRX7(BPSRX,BPSRF,BPSDFN,BPSDOS)
+49 SET BPSWHERE="P2"
+50 IF BPRESUB=1
SET BPSWHERE="P2S"
+51 QUIT $$SUBMCLM^BPSPRRX2(BPSRX,BPSRF,BPSDOS,BPSWHERE,1,BPSPLAN,.BPSDAT,BPRATTYP)
+52 ;
PRIINSCK(DFN,DOS) ; primary insurance check
+1 ; check to see if patient has primary ePharmacy insurance policy
+2 ; function value = 1 if there is one, 0 otherwise
+3 ;
+4 NEW OK,BPSRET,BPSINS,BPX
+5 SET OK=0
+6 IF '$GET(DFN)!'$GET(DOS)
GOTO PRIINX
+7 SET BPSRET=$$INSUR^IBBAPI(DFN,DOS,"E",.BPSINS,"1,7,8")
+8 IF '$DATA(BPSINS)
GOTO PRIINX
+9 SET BPX=0
FOR
SET BPX=$ORDER(BPSINS("IBBAPI","INSUR",BPX))
if 'BPX
QUIT
Begin DoDot:1
+10 IF $PIECE($GET(BPSINS("IBBAPI","INSUR",BPX,7)),U,1)=1
SET OK=1
QUIT
+11 QUIT
End DoDot:1
if OK
QUIT
PRIINX ;
+1 QUIT OK
+2 ;