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

BPSNCPDP.m

Go to the documentation of this file.
BPSNCPDP ;BHAM ISC/LJE/SS - API to submit a claim to ECME ;11/7/07  16:58
 ;;1.0;E CLAIMS MGMT ENGINE;**1,3,4,2,5,6,7,8,10,11,19,20,22,40**;JUN 2004;Build 25
 ;;Per VA Directive 6402, this routine should not be modified.
 ;
 ; Reference to $$PROD^XUPROD in ICR #4440
 ; Reference to $$GETNDC^PSONDCUT in ICR #4705
 ; Reference to Patient file (#2) in ICR #10035
 ;
 ;Input
 ; BRXIEN = Prescription IEN
 ; BFILL  = Fill Number
 ; DOS    = Date of Service
 ; BWHERE (RX Action)
 ;    AREV = Auto-Reversal
 ;    BB   = Back Billing
 ;    CRLB = CMOP/OPAI Release & Rebill
 ;    CRLR = CMOP/OPAI Release & Reverse (successful release)
 ;    CRLX = CMOP/OPAI unsuccessful release & reverse
 ;    CRRL = CMOP/OPAI Release - Original claim not paid, submit
 ;           another claim, no reversal
 ;    DC   = Discontinue - only reverse un-released PAYABLE DC's,
 ;           release date check should be in calling routine.
 ;    DE   = Delete
 ;    ED   = Edit (includes RX release with NDC edit)
 ;    ERES = Resubmit from ECME user screen
 ;    ERWV = Resubmit Without Reversal from ECME user screen
 ;    ERNB = Resubmit of a TRI/CVA non-billable entry from the ECME
 ;           user screen
 ;    EREV = Reversal from ECME user screen
 ;    HLD  = Put prescription on Hold
 ;    OREV = Reversal from Outpatient Pharmacy edit screen
 ;    RSNB = Resubmit Non-Billable TRICARE & CHAMPVA from PSO Reject
 ;           Info Screen
 ;    OF   = Original Fill
 ;    P2   = Original submission from PRO Option, no reversal
 ;    P2S  = Resubmit from PRO Option
 ;    PC   = Pull CMOPs
 ;    PE   = Pull early from suspense
 ;    PL   = Pull local from suspense
 ;    PP   = Pull RX (PP) action from Patient Rx Processing option
 ;    RF   = Refill
 ;    RN   = Renew
 ;    RRL  = Release - Original claim not paid, submit another claim,
 ;           no reversal
 ;    RS   = Return-to-Stock
 ; BILLNDC = Valid NDC# with format 5-4-2
 ; REVREAS = Reversal Reason
 ; DURREC  = String of up to three sets of DUR info. Sets are delimited
 ;           with "~". Each set consists of three "^" pieces:
 ;              Reason for Service Code
 ;              Professional Service Code
 ;              Result of Service Code
 ; BPOVRIEN = Pointer to BPS NCPDP OVERIDE file.  This parameter will 
 ;            only be passed if there are overrides entered by the
 ;            user via the Resubmit with Edits (RED) option in the 
 ;            user screen.
 ; BPSAUTH  = Prior authorization code ^ Prior authorization number
 ; BPSCLARF = Submission Clarification Code (external value from file
 ;            #9002313.25), entered by pharmacist and passed by
 ;            Outpatient Pharmacy to ECME to put into the claim  
 ; BPCOBIND = (optional, default is Primary) for COB indicators - so
 ;            when the API is called for the particular
 ;            COB claim the BPSNCPDP can handle it.
 ; BPJOBFLG = (optional) B - if called by unqueueing logic in background
 ;            F - (default) if called by other (foreground) process
 ; BPREQIEN = (optional) IEN to file #9002313.77, BPS REQUEST, that
 ;            needs to be unqueued 
 ; BPSCLOSE = (optional) local array used with BWHERE="EREV" only, if
 ;            the user had chosen to close the claim after reversal
 ;   If claim needs to be closed then
 ;      BPSCLOSE("CLOSE AFT REV")=1
 ;      BPSCLOSE("CLOSE AFT REV REASON")=<#356.8 ien>
 ;      BPSCLOSE("CLOSE AFT REV COMMENT")=<some text>
 ; BPSPLAN  = (optional) IEN of the entry in file #355.3, GROUP
 ;            INSURANCE PLAN
 ; BPSPRDAT = (optional) local array passed by reference.  Contains
 ;            primary claim data needed to submit a secondary claim.
 ;            Format:  BPSPRDAT(NCPDP field)
 ; BPSRTYPE = (optional) rate type (IEN to file #399.3)
 ; BPSDELAY = Delay Reason Code (IEN to file #9002313.29, BPS NCPDP
 ;            DELAY REASON CODE, entered by user in the Back Billing
 ;            option of Claims Tracking, passed in to be put in claim.
 ; BPSDX    = Diagnosis code (external) to be sent on outgoing claim.
 ; 
 ;Output (RESPONSE^MESSAGE^ELIGIBILITY^CLAIMSTATUS^COB^RXCOB^INSURANCE)
 ; RESPONSE
 ;    0  Submitted through ECME
 ;    1  No submission through ECME
 ;    2  IB not billable
 ;    3  Claim was closed, not submitted (RTS/Deletes)
 ;    4  Unable to queue claim
 ;    5  Incorrect information supplied to ECME
 ;    6  Inactive ECME - Primarily used for TRICARE/CHAMPVA to say
 ;       ok to process rx
 ;    10 Reversal but no resubmit
 ; MESSAGE = Message associated with the response (error/submitted)
 ; ELIGIBILITY = V - Veteran, T - TRICARE, C - CHAMPVA
 ; CLAIMSTATUS = claim status (null or IN PROGRESS/E PAYABLE/etc...)
 ; COB = Coordination Of Benefit indicator of the insurance as it is
 ;       stored in the PATIENT file: 1-primary, 2-secondary, 3-tertiary
 ; RXCOB = the payer sequence indicator of the claim which was sent to
 ;         the payer as a result of this call: 1-primary, 2-secondary)
 ; INSURANCE = Name of the insurance company the claim was sent to
 ;
EN(BRXIEN,BFILL,DOS,BWHERE,BILLNDC,REVREAS,DURREC,BPOVRIEN,BPSCLARF,BPSAUTH,BPCOBIND,BPJOBFLG,BPREQIEN,BPSCLOSE,BPSPLAN,BPSPRDAT,BPSRTYPE,BPSDELAY,BPSDX) ;
 ;
 N BP77NEW,BPACTTYP,BPLCK,BPNEWCLM,BPPAYABL,BPPREVRQ,BPRESLT,BPRET
 N BPRETV,BPSCOB,BPSELIG,BPSQUIT,BPSSTAT,BPSTART,BRX,CLMSTAT,DFN,IEN59
 N OLDRESP,PNAME,RESPONSE,SITE,TODAY,WFLG
 ;
 ; test not ecme active
 I '$$PROD^XUPROD,'$P($G(^BPS(9002313.99,1,0)),"^",3) Q "1^ECME switch is not on for the site"
 ; Set default values and other required vars
 ; default is foreground ("F")
 S BPJOBFLG=$S($G(BPJOBFLG)="":"F",1:$G(BPJOBFLG))
 S RESPONSE="",CLMSTAT="",BP77NEW=0
 S BPLCK=0 ;0 - default for "B" jobs
 S REVREAS=$G(REVREAS),DURREC=$G(DURREC)
 S BPSCLARF=$G(BPSCLARF),BPSAUTH=$G(BPSAUTH)
 S BPOVRIEN=$G(BPOVRIEN),BPSDELAY=$G(BPSDELAY)
 S BPSDX=$G(BPSDX)
 ; BPCOBIND will be used as a flag to indicate the following
 ;    If BPCOBIND>0 then the API is called for the particular COB claim
 ;    if BPCOBIND=0 then the API is called for a whole RX/RF -
 ;         Outpatient Pharmacy doesn't care about COB when the
 ;         pharmacy user enters, deletes or edits RX/refills
 S BPCOBIND=+$G(BPCOBIND)
 ;
 ; BPSCOB variable will be used to store COB value (default is PRIMARY)
 ; in this function only
 S BPSCOB=$S(BPCOBIND>0:BPCOBIND,1:1)
 ;
 ; Remove semi-colons from reversal reason
 S REVREAS=$TR(REVREAS,";","-")
 ;
 ; Default is original fill
 S BRXIEN=$G(BRXIEN)
 I '$G(BFILL) S BFILL=0
 ;
 ; Get prescription number
 S BRX=$$RXAPI1^BPSUTIL1(BRXIEN,.01,"I")
 ;
 ; Make sure fill date is not in the future or empty
 S TODAY=$$DT^XLFDT
 I '$G(DOS)!($G(DOS)>TODAY) S DOS=$$DOSDATE^BPSSCRRS(BRXIEN,BFILL)
 ;
 ; Get the NDC if it was not passed in
 I $G(BILLNDC)="" S BILLNDC=$$GETNDC^PSONDCUT(BRXIEN,BFILL)
 ;
 ; Patient Info
 S DFN=$$RXAPI1^BPSUTIL1(BRXIEN,2,"I"),PNAME=$$GET1^DIQ(2,DFN,.01)
 ;
 ; Check parameters and vars
 S BPRETV=$$CHCKPAR^BPSOSRX8(BRXIEN,BRX,$G(BWHERE),DFN,PNAME)
 I +BPRETV=0 S CLMSTAT=$P(BPRETV,U,2),RESPONSE=5 G END
 ;
 ; Calculate IEN59
 S IEN59=$$IEN59^BPSOSRX(BRXIEN,BFILL,BPSCOB)
 I IEN59="" S CLMSTAT="BPS Transaction IEN could not be calculated",RESPONSE=1 G END
 ;
 ; Populate COB fields from BPS TRANSACTION to resubmit secondary
 ; claims from the User Screen.  If $G(BPSPRDAT("NEW COB DATA"))=1 then
 ; the resubmit requested from the BPS COB PROCESS SECOND TRICARE and
 ; the user can change the data.
 I BPSCOB=2,$$ACTTYPE^BPSOSRX5(BWHERE)="UC",'$G(BPSPRDAT("NEW COB DATA")) N:$D(BPSRTYPE)=0 BPSRTYPE N:$D(BPSPLAN)=0 BPSPLAN N:$D(BPSPRDAT)=0 BPSPRDAT I $$SECDATA^BPSPRRX6(BRXIEN,BFILL,.BPSPLAN,.BPSPRDAT,.BPSRTYPE)=0 D  G END
 . S CLMSTAT="Insufficient data to resubmit the secondary claim, use Process Secondary/TRICARE Rx to ECME option.",RESPONSE=5
 ;
 ; Initialize log
 D LOG^BPSOSL(IEN59,$T(+0)_"-Start of claim","DT")
 D LOG^BPSOSL(IEN59,$T(+0)_"-BWHERE = "_BWHERE)
 D LOG^BPSOSL(IEN59,$T(+0)_"-Job flag = "_BPJOBFLG_$S(BPJOBFLG="B":" BPS REQUEST ien = "_$G(BPREQIEN),1:""))
 ;
 ; Check if we need to print the messages to the screen (WFLG=1 : YES)
 S WFLG=0
 I BPJOBFLG="F" S WFLG=$$PRINTSCR^BPSOSRX8(BWHERE)
 ;
 ; Lock the Rx and Fill while putting it on the queue to prevent two
 ; jobs from being activated at the same time.  This is only for
 ; foreground jobs.  Background jobs are called from REQST99^BPSOSRX5
 ; and the RX/RF should be already locked by this point.
 I BPJOBFLG="F" D  I 'BPLCK G END
 . S BPLCK=$$LOCKRF^BPSOSRX(BRXIEN,BFILL,10,$G(IEN59),$T(+0))
 . I 'BPLCK S RESPONSE=4,CLMSTAT="Unable to acquire the lock needed to put the RX and fill on the queue"
 ;
 ; Determine the action type.  If foreground job, then action can be
 ; C, U, or UC.
 S BPACTTYP=""
 I BPJOBFLG="F" S BPACTTYP=$$ACTTYPE^BPSOSRX5(BWHERE)
 ; If background/unqueueing job, then action can be C or U.
 I BPJOBFLG="B" D  I RESPONSE=5 G END
 . S BPACTTYP=$P($G(^BPS(9002313.77,+$G(BPREQIEN),1)),U,4)
 . I BPACTTYP="" S RESPONSE=5,CLMSTAT="Unknown Action type in BPS REQUEST ien="_BPREQIEN
 ;
 ; Code to handle "general" submit/reversal as opposed to processing a
 ; claim for a specific payer sequence (primary, secondary).  ECME and
 ; IB always know the payer sequence and should always set the proper
 ; BPCOBIND parameter, thus if BPCOBIND=0 then the API is called by
 ; Pharmacy.  If so then the CLAIM action (not reversal) should be done
 ; for primary only.
 ;
 S BPSQUIT=0
 I BPCOBIND=0 D  I BPSQUIT=1 S CLMSTAT="The secondary claim needs to be reversed first.",RESPONSE=5 G END
 . I BPACTTYP=""!(BPACTTYP="C") S BPCOBIND=1 Q
 . ; code to handle "general" reversal
 . N BPSECLM
 . ; Check if there is a secondary claim.
 . S BPSECLM=$$FINDECLM^BPSPRRX5(BRXIEN,BFILL,2)
 . ; Quit if we have a secondary claim and it is payable or in progress,
 . ; since that claim needs to be reversed first.
 . I BPSECLM=1!(BPSECLM=3) S BPSQUIT=1
 . S BPCOBIND=1
 ;
 ; If BPJOBFLG="F", then determine if there are any scheduled, active,
 ; or in process requests for the RX/RF.  CHKREQST^BPSOSRX7 returns
 ; negative number^message : cannot be accepted for some reason 
 ; 0 : can be accepted because there are NO requests for this RX/RF, 
 ;     we will create a new record in BPS REQUEST and ACTIVATE it.
 ; 1 : there are ACTIVATED/IN PROCESS requests already for this RX/RF
 S BPPREVRQ="-10^Background queuing." ;default
 I BPJOBFLG="F" D  I BPPREVRQ'=0 G STATUS:RESPONSE=0,END:RESPONSE>0
 . S BPPREVRQ=$$CHKREQST^BPSOSRX7(BRXIEN,BFILL,.BPRESLT)
 . D LOG^BPSOSL(IEN59,$T(+0)_"-CHKREQ^BPSOSRX7 result: "_BPPREVRQ)
 . ; if error
 . I BPPREVRQ<0 S RESPONSE=4,CLMSTAT=$P(BPPREVRQ,U,2) D LOG^BPSOSL(IEN59,$T(+0)_"- - Cannot be accepted because of issues with already scheduled requests")
 . ; if there are prior requests for the RX/RF in the queue already
 . ; then schedule additional request(s) for the future and quit since
 . ; we do not know the result of prior requests
 . I BPPREVRQ>0 D
 . . D LOG^BPSOSL(IEN59,$T(+0)_"-There are requests in the queue, do not process - schedule additional request(s)")
 . . I BPACTTYP="U" S BPRET=$$SCHREQ^BPSNCPD5(.BP77NEW,BRXIEN,BFILL,DOS,BWHERE,$G(BILLNDC),REVREAS,DURREC,BPOVRIEN,BPSCLARF,BPSAUTH,BPSDELAY,IEN59,BPCOBIND,BPPREVRQ,"U",.BPSCLOSE,$G(BPSRTYPE),$G(BPSPLAN),.BPSPRDAT,BPSDX)
 . . I BPACTTYP="UC" D
 . . . S BPRET=$$SCHREQ^BPSNCPD5(.BP77NEW,BRXIEN,BFILL,DOS,BWHERE,$G(BILLNDC),REVREAS,DURREC,BPOVRIEN,BPSCLARF,BPSAUTH,BPSDELAY,IEN59,BPCOBIND,BPPREVRQ,"U",.BPSCLOSE,$G(BPSRTYPE),$G(BPSPLAN),.BPSPRDAT,BPSDX)
 . . . I +BPRET=0 S BPRET=$$SCHREQ^BPSNCPD5(.BP77NEW,BRXIEN,BFILL,DOS,BWHERE,$G(BILLNDC),REVREAS,DURREC,BPOVRIEN,BPSCLARF,BPSAUTH,BPSDELAY,IEN59,BPCOBIND,BP77NEW,"C",.BPSCLOSE,$G(BPSRTYPE),$G(BPSPLAN),.BPSPRDAT,BPSDX)
 . . I BPACTTYP="C" S BPRET=$$SCHREQ^BPSNCPD5(.BP77NEW,BRXIEN,BFILL,DOS,BWHERE,$G(BILLNDC),REVREAS,DURREC,BPOVRIEN,BPSCLARF,BPSAUTH,BPSDELAY,IEN59,BPCOBIND,BPPREVRQ,"C",.BPSCLOSE,$G(BPSRTYPE),$G(BPSPLAN),.BPSPRDAT,BPSDX)
 . . I +BPRET=0 S RESPONSE=0,CLMSTAT=$P(BPRET,U,2) D LOG^BPSOSL(IEN59,$T(+0)_"-The new request(s) scheduled. The last one for the RX/RF now is: "_(BP77NEW)) Q
 . . I +BPRET>0 S RESPONSE=+BPRET,CLMSTAT=$P(BPRET,U,2) D LOG^BPSOSL(IEN59,$T(+0)_"-Cannot create request(s)")
 ;
 ; We can continue only if either 
 ;   BPJOBFLG="B" 
 ;     or 
 ;   BPJOBFLG="F" and BPPREVRQ=0
 ;
 ; BPNEWCLM flag = 0 if resubmission, 1 if first submission.
 S BPNEWCLM=$S(+$G(^BPST(IEN59,0)):0,1:1)
 ; get pre-existing RX/RFs status
 S OLDRESP=$P($$STATUS^BPSOSRX(BRXIEN,BFILL,0,,BPSCOB),U,1)
 ; check if the payer IS going to PAY according the last response
 S BPPAYABL=$$PAYABLE^BPSOSRX5(OLDRESP)
 ; set starttime
 S BPSTART=$$STTM^BPSNCPD4()
 ;  
 ; if this is a new RX/RF
 I BPNEWCLM D NEWCLAIM^BPSNCPD6 G STATUS:RESPONSE=0,END:RESPONSE>0
 ;
 ; if we do not have a status for the previous claim AND this is not a
 ; reversal request - treat it as a new claim this will be the case
 ; when resubmitting a non-billable entry
 I (OLDRESP=""),(BPACTTYP'="U") D NEWCLAIM^BPSNCPD6 G STATUS:RESPONSE=0,END:RESPONSE>0
 ;
 ; If we do not have a status for the pre-existing claim, and this is
 ; a reversal request, then do not reverse.
 I (OLDRESP=""),(BPACTTYP="U") D RVNEW^BPSNCPD6 G END
 ;
 ; From here on, all claims with some response (i.e. OLDRESP'="")
 ;
 ; if Back Billing - impossible
 I BWHERE="BB" D BB^BPSNCPD6 G END
 ;
 ; If returning to stock or deleting, and the previous claim was not
 ; paid, then no reversal is needed; close the prescription and quit.
 ; Note: this is inherited "fuzzy logic" - it checks only two statuses
 ; to determine that the claim "was not paid".
 I OLDRESP'["E PAYABLE",OLDRESP'["E REVERSAL REJECTED",(",RS,DE,"[(","_BWHERE_",")) D  G END
 . D CLOSE2^BPSBUTL(BRXIEN,BFILL,BWHERE)
 . S RESPONSE=3
 . S CLMSTAT="Claim was not payable so it has been closed.  No ECME claim created."
 . D DISPL^BPSNCPD4(WFLG,RESPONSE_U_CLMSTAT_"^D^2",$G(BPSELIG))
 . D LOG^BPSOSL(IEN59,$T(+0)_"-"_CLMSTAT)
 ;
 ; Reversals for Payable claims 
 ; (Note: BPSCLOSE can be used in this case only)
 I BPPAYABL,BPACTTYP="U" D RVPAID^BPSNCPD6 G STATUS:RESPONSE=0,END:RESPONSE>0
 ;
 ; Resubmission without doing a Reversal
 I BWHERE="ERWV" D RVRSNPD^BPSNCPD6 G STATUS:RESPONSE=0,END:RESPONSE>0
 ;
 ; Reversals and Resubmission for Payable claims
 I BPPAYABL,BPACTTYP="UC" D RVRSPAID^BPSNCPD6 G STATUS:((RESPONSE=0)!(RESPONSE=10)),END:RESPONSE>0
 ;
 ; Resubmission for Payable claims - DO NOT resubmit
 I BPPAYABL,BPACTTYP="C" D RSPAID^BPSNCPD6 G END
 ;
 ; Reversals for Non-Payable claims - DO NOT reverse
 I 'BPPAYABL,BPACTTYP="U" D RVNPAID^BPSNCPD6 G END
 ;
 ; Resubmission and Reversals and Resubmission for Non-Payable claims
 I 'BPPAYABL,((BPACTTYP="C")!(BPACTTYP="UC")) D RVRSNPD^BPSNCPD6 G STATUS:RESPONSE=0,END:RESPONSE>0
 ;
 S RESPONSE=5,CLMSTAT="Unknown error"
 G END
 ;
 ; Display status
STATUS ;
 ;if successful scheduling or/and activation of the request then make sure the background job is running
 I BPJOBFLG="F",BPLCK D UNLCKRF^BPSOSRX(BRXIEN,BFILL,$G(IEN59),$T(+0)) S BPLCK=0 ;to prevent unlocking in END
 I (RESPONSE=0)!(RESPONSE=10) D LOG^BPSOSL(IEN59,$T(+0)_"-Call RUNNING^BPSOSRX") D RUNNING^BPSOSRX()
 I WFLG W !!,"Processing ",$S(BPSCOB=1:"Primary claim...",BPSCOB=2:"Secondary claim...",1:"claim with Unknown Payer Sequence...")
 I BPJOBFLG="F" D
 . ; If the Write Flag is off and this is TRICARE/CHAMPVA, set Write
 . ; Flag to 2.  STATUS^BPSNCPD1 will not display messages but will
 . ; wait the same amount of time as if it were writing messages.  This
 . ; needs to be done so that TRICARE/CHAMPVA claims get a chance to
 . ; complete before continuing.  Otherwise, the claim will be IN
 . ; PROGRESS, which will create the bulletin (code below) and OP/CMOP
 . ; will not process correctly (keep on suspense queue, etc)
 . I 'WFLG,$G(BPSELIG)="T"!($G(BPSELIG)="C") S WFLG=2
 . I 'WFLG H 1
 . E  D STATUS^BPSNCPD1(BRXIEN,BFILL,+$G(BPPAYABL),$S(BPACTTYP="U":1,1:0),BPSTART,BWHERE,$G(BP77NEW),BPSCOB,$G(BPSELIG),IEN59,WFLG)
 ;
 ; Clean up and quit
END ;
 ; BPSELIG and other variables are established by inference in BPSNCPD6.
 I BPJOBFLG="F",BPLCK D UNLCKRF^BPSOSRX(BRXIEN,BFILL,$G(IEN59),$T(+0)) S BPLCK=0
 ; Get Site in case we send a Bulletin
 S SITE=$$GETSITE^BPSOSRX8(BRXIEN,BFILL)
 ; If foreground, and we can't schedule request for any reason, and
 ; this is not OP, then send a bulletin.
 I BPJOBFLG="F",RESPONSE=4,",AREV,BB,ERES,ERWV,ERNB,EREV,P2,P2S,"'[(","_BWHERE_",") D BULL^BPSNCPD1(BRXIEN,BFILL,$G(SITE),$G(DFN),$G(PNAME),"",$G(CLMSTAT),$G(RESPONSE),$G(BPSCOB))
 I $G(BPSELIG)="" S BPSELIG=""
 ; Send bulletin if TRICARE or CHAMPVA is IN PROGRESS and this is not
 ; a release process
 S BPSSTAT=$S($G(BRXIEN):$P($$STATUS^BPSOSRX(BRXIEN,BFILL,,,BPSCOB),U),1:"")
 ;
 I $G(IEN59) D
 . D LOG^BPSOSL(IEN59,$T(+0)_"-Nearing end of first process, BPSELIG="_BPSELIG_", BPSSTAT="_BPSSTAT)
 . I BPSELIG="T"!(BPSELIG="C"),BPSSTAT="IN PROGRESS",$G(REVREAS)'="RX RELEASE-NDC CHANGE",BWHERE="PC" D LOG^BPSOSL(IEN59,$T(+0)_"-Would have sent bulletin")
 ;
 I BPSELIG="T"!(BPSELIG="C"),BPSSTAT="IN PROGRESS",$G(REVREAS)'="RX RELEASE-NDC CHANGE",",CRLB,CRLR,CRLX,CRRL,PC,RRL,"'[(","_BWHERE_",") D BULL^BPSNCPD1(BRXIEN,BFILL,SITE,$G(DFN),$G(PNAME),BPSELIG,"","",$G(BPSCOB))
 ;
 I '$D(RESPONSE) S RESPONSE=1
 K MOREDATA
 I $G(IEN59) D
 . N MSG
 . S MSG="First Process Complete-RESPONSE="_$G(RESPONSE)
 . I $G(RESPONSE)'=0 S MSG=MSG_", CLMSTAT="_$G(CLMSTAT)
 . D LOG^BPSOSL(IEN59,$T(+0)_"-"_MSG)
 ;
 ; The function $$ECMESND returns the following:
 ;   Response ^ Message ^ Eligibility ^ Claim Status ^ COB ^
 ;   RxCOB ^ Insurance
 ; Response =
 ;   0  Submitted through ECME
 ;   1  No submission through ECME
 ;   2  IB not billable
 ;   3  Claim was closed, not submitted (RTS/Deletes)
 ;   4  Unable to queue claim
 ;   5  Incorrect information supplied to ECME
 ;   6  Inactive ECME - Primarily used for TRICARE/CHAMPVA to
 ;      say ok to process Rx
 ;   10 Reversal but no resubmit
 ; Message = Message indicating whether the claim was submitted
 ; Eligibility = V, Veteran;  T, TRICARE; C, CHAMPVA
 ; Claim Status = IN PROGRESS if incomplete; final status (e.g.
 ;   E PAYABLE or E REJECTED) if complete; null if non-billable
 ; COB  = COB indicator as stored in the INSURANCE TYPE sub-file
 ;   of the PATIENT file
 ; RxCOB = COB indicator sent to the payer and stored in the
 ;   BPS TRANSACTIONS file
 ; Insurance = Name of the insurance company that was billed as
 ;   a result of this call
 ;
 Q RESPONSE_U_$G(CLMSTAT)_U_BPSELIG_U_BPSSTAT_U_$$CLMINFO^BPSUTIL2(+$G(IEN59))
 ;
 ;BPSNCPDP