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

BPSPRRX4.m

Go to the documentation of this file.
  1. BPSPRRX4 ;ALB/SS - ePharmacy secondary billing ;16-DEC-08
  1. ;;1.0;E CLAIMS MGMT ENGINE;**8,9,11,28**;JUN 2004;Build 22
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. PRIMARY(BPSRX,BPSRF,BPSDFN,BPSDOS,BPSECLM,BPRESUB) ;
  1. ;Primary claim processing
  1. ;Input:
  1. ; BPSRX - Prescription IEN
  1. ; BPSRF - Fill Number
  1. ; BPSDFN - Patient IEN
  1. ; BPSDOS - Date of service
  1. ; BPSECLM - Rresult of $$FINDECLM^BPSPRRX5
  1. ; BPRESUB - 1 = the user is resubmitting a new PRIMARY claim
  1. ;Return value
  1. ; Either the response from $$SUBMCLM^BPSPRRX2 or an error condition, such as
  1. ; "-100^Action cancelled"
  1. N BPRATTYP,BPSPLNSL,BPSPLAN,BPSDAT,BPSQ,BPSWHERE,BPY,BP59,BPSPL59,BPSRT59,BPYDEF
  1. S (BP59,BPSPL59,BPSRT59)=""
  1. I BPRESUB=1 D
  1. . S BP59=$$IEN59^BPSOSRX(BPSRX,BPSRF,1)
  1. . ;get an old plan for resubmits
  1. . S BPSPL59=+$P($G(^BPST(BP59,10,1,0)),U,1)
  1. . S BPSRT59=+$P($G(^BPST(BP59,10,1,0)),U,8)
  1. F S BPRATTYP=$$RATETYPE^BPSPRRX2(BPSRT59) Q:BPRATTYP'=""
  1. I BPRATTYP=-1 Q "-100^Action cancelled"
  1. ;
  1. ;check for ePharmacy primary ins policy
  1. S BPYDEF="N"
  1. I '$$PRIINSCK(BPSDFN,BPSDOS) D
  1. . S BPYDEF="Y"
  1. . W !!,"Unable to find a primary insurance policy which is e-Pharmacy billable."
  1. . W !,"You must correct this in order to continue.",!
  1. . Q
  1. ;
  1. ;ask the user if he wants to jump to the BCN PATIENT INSURANCE option
  1. S BPY=$$YESNO^BPSSCRRS("DO YOU WISH TO ADD/EDIT INSURANCE COMPANY DATA FOR THIS PATIENT?(Y/N)","N")
  1. I BPY=1 D EN1^IBNCPDPI(BPSDFN)
  1. I BPY=-1 Q "-100^Action cancelled"
  1. ;
  1. I '$$PRIINSCK(BPSDFN,BPSDOS) Q "-110^No valid group insurance plans"
  1. ;
  1. ;display available e-billable plans and select the primary plan
  1. S BPSQ=0
  1. F D Q:BPSQ'=0
  1. . S BPSPLAN=$$SELECTPL^BPSPRRX1(BPSDFN,BPSDOS,.BPSPLNSL,"PRIMARY INSURANCE POLICY",BPSPL59)
  1. . I +BPSPLAN=0 S BPSQ=-100 Q
  1. . ;if existing rejected/reversed claim
  1. . 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
  1. . S BPSQ=1
  1. Q:BPSQ=-100 "-100^Action cancelled"
  1. Q:BPSQ=-105 "-105^The same group plan selected"
  1. I $$YESNO^BPSSCRRS("SUBMIT CLAIM TO "_$P(BPSPLNSL(1),U,2)_" ?(Y/N)","Y")'=1 Q "-100^Action cancelled"
  1. D ACTDTY^BPSPRRX7(BPSRX,BPSRF,BPSDFN,BPSDOS)
  1. S BPSWHERE="P2"
  1. I BPRESUB=1 S BPSWHERE="P2S"
  1. Q $$SUBMCLM^BPSPRRX2(BPSRX,BPSRF,BPSDOS,BPSWHERE,1,BPSPLAN,.BPSDAT,BPRATTYP)
  1. ;
  1. PRIINSCK(DFN,DOS) ; primary insurance check
  1. ; check to see if patient has primary ePharmacy insurance policy
  1. ; function value = 1 if there is one, 0 otherwise
  1. ;
  1. N OK,BPSRET,BPSINS,BPX
  1. S OK=0
  1. I '$G(DFN)!'$G(DOS) G PRIINX
  1. S BPSRET=$$INSUR^IBBAPI(DFN,DOS,"E",.BPSINS,"1,7,8")
  1. I '$D(BPSINS) G PRIINX
  1. S BPX=0 F S BPX=$O(BPSINS("IBBAPI","INSUR",BPX)) Q:'BPX D Q:OK
  1. . I $P($G(BPSINS("IBBAPI","INSUR",BPX,7)),U,1)=1 S OK=1 Q
  1. . Q
  1. PRIINX ;
  1. Q OK
  1. ;