IBCNERP5 ;DAOU/BHS - IBCNE eIV PAYER REPORT COMPILE ;03-JUN-2002
 ;;2.0;INTEGRATED BILLING;**184,271,300,416,668**;21-MAR-94;Build 28
 ;;Per VHA Directive 6402, this routine should not be modified.
 ;
 ; eIV - Insurance Verification Interface
 ;
 ; Input variables from IBCNERP4:
 ;   IBCNERTN = "IBCNERP4"
 ;   IBCNESPC("BEGDT") = Start Date for date range
 ;   IBCNESPC("ENDDT") = End Date for date range
 ;   IBCNESPC("PYR") = Payer IEN for report, if = "", then include all
 ;   IBCNESPC("SORT") = 1 - Payer OR 2 - Total Inquiries
 ;   IBCNESPC("DTL") = 1 - YES OR 0 - NO - include Rejection Detail?
 ; Output variables passed to IBCNERP6:
 ;   ^TMP($J,IBCNERTN,SORT1,SORT2,SORT3)=InqCreatedCount^InqCancelledCt^
 ;                                       InqQueuedCt^1stTransCount^
 ;                                       RetryTransCt^Non-ErrorRespCt^
 ;                                       ErrorRespCount^TotRespTime-days^
 ;                                       CommFailRespCount^PendRespCount^
 ;                                       eIVDeactivatedDt
 ;        IBCNERTN = "IBCNERP4"
 ;        SORT1 = PayerName (SORT=1) or -InquiryCount(SORT=2)
 ;        SORT2 = PayerIEN (SORT=1) or PayerName (SORT=2)
 ;        SORT3 = "*" (SORT=1) or PayerIEN (SORT=2)
 ;   ^TMP($J,IBCNERTN,SORT1,SORT2,SORT3,ERRCD)=RespCount
 ;        (see above)
 ;        ERRCD = Error Condition code (ptr to 365.018) or Error Text
 ;                from the Eligibility Communicator (4.01)
 ;
 ; Must call at EN tag
 Q
 ;
EN(IBCNERTN,IBCNESPC) ; Entry point
 ;
 ; Initialize variables
 NEW IBCNEDT,IBCNEDT1,IBCNEDT2,IBCNEPY,IBCNEPYR,IBCNEPTR
 NEW IBCNETOT,IBCNESRT,IBCNEDTL,RPTDATA,PYRIEN,INQS,IEN
 NEW IBPNM,IBPIEN,ERR,PC,PYR
 ;
 I '$D(ZTQUEUED),$G(IOST)["C-" W !!,"Compiling report data ..."
 ;
 ; Total responses selected
 S IBCNETOT=0
 ;
 ; Kill scratch globals
 KILL ^TMP($J,IBCNERTN),^TMP($J,IBCNERTN_"X")
 ;
 ; Initialize looping variables
 S IBCNEDT2=$G(IBCNESPC("ENDDT"))
 S IBCNEDT1=$G(IBCNESPC("BEGDT"))
 S IBCNEPY=$G(IBCNESPC("PYR"))
 S IBCNESRT=$G(IBCNESPC("SORT"))
 S IBCNEDTL=$G(IBCNESPC("DTL"))
 ;
 ; Loop through the eIV Transmission Queue File (#365.1) 
 ;  by Date/Time Created Cross-Reference
 S IBCNEDT=$O(^IBCN(365.1,"AE",IBCNEDT1),-1)
 F  S IBCNEDT=$O(^IBCN(365.1,"AE",IBCNEDT)) Q:IBCNEDT=""!($P(IBCNEDT,".",1)>IBCNEDT2)  D  Q:$G(ZTSTOP)
 . S IBCNEPTR=0
 . F  S IBCNEPTR=$O(^IBCN(365.1,"AE",IBCNEDT,IBCNEPTR)) Q:'IBCNEPTR  D  Q:$G(ZTSTOP)
 . . ; Update selected count
 . . S IBCNETOT=IBCNETOT+1
 . . I $D(ZTQUEUED),IBCNETOT#100=0,$$S^%ZTLOAD() S ZTSTOP=1 QUIT
 . . ; Determine Payer name from Payer File (#365.12)
 . . S PYRIEN=$P($G(^IBCN(365.1,IBCNEPTR,0)),U,3)
 . . I 'PYRIEN Q
 . . ; Check payer filter
 . . I IBCNEPY'="",PYRIEN'=IBCNEPY Q
 . . S IBCNEPYR=$P($G(^IBE(365.12,PYRIEN,0)),U)
 . . I IBCNEPYR="" Q
 . . ; Now get the data for the report - build RPTDATA
 . . KILL RPTDATA
 . . D GETDATA(IBCNEPTR,.RPTDATA,IBCNEDTL,IBCNEPYR,PYRIEN,IBCNEPY)
 . . ; Loop through results by Payer Name, Payer IEN
 . . S IBPNM=""
 . . F  S IBPNM=$O(RPTDATA(IBPNM)) Q:IBPNM=""  D
 . . . S IBPIEN=0
 . . . F  S IBPIEN=$O(RPTDATA(IBPNM,IBPIEN)) Q:'IBPIEN  D
 . . . . ; Store totals in global
 . . . . F PC=1:1:10 S $P(^TMP($J,IBCNERTN,IBPNM,IBPIEN,"*"),U,PC)=$P($G(^TMP($J,IBCNERTN,IBPNM,IBPIEN,"*")),U,PC)+$P(RPTDATA(IBPNM,IBPIEN),U,PC)
 . . . . ; Store deactivation date/time
 . . . . S $P(^TMP($J,IBCNERTN,IBPNM,IBPIEN,"*"),U,11)=$P(RPTDATA(IBPNM,IBPIEN),U,11)
 . . . . I 'IBCNEDTL Q
 . . . . ; Store rejection detail
 . . . . S ERR=""
 . . . . F  S ERR=$O(RPTDATA(IBPNM,IBPIEN,ERR)) Q:ERR=""  D
 . . . . .  S ^TMP($J,IBCNERTN,IBPNM,IBPIEN,"*",ERR)=$G(^TMP($J,IBCNERTN,IBPNM,IBPIEN,"*",ERR))+$G(RPTDATA(IBPNM,IBPIEN,ERR))
 . . Q
 . Q
 ;
 ; Call tag to find good/bad/rejection detail data from response file
 D DATA^IBCNERP4
 ;
 I $G(ZTSTOP)!(IBCNESRT=1) G EXIT
 ;
 ; Resort if sorted by Total Inquiries
 M ^TMP($J,IBCNERTN_"X")=^TMP($J,IBCNERTN)
 KILL ^TMP($J,IBCNERTN)
 S PYR=""
 F  S PYR=$O(^TMP($J,IBCNERTN_"X",PYR)) Q:PYR=""  D
 .  S IEN=0
 .  F  S IEN=$O(^TMP($J,IBCNERTN_"X",PYR,IEN)) Q:'IEN  D
 .  .  S INQS=-$G(^TMP($J,IBCNERTN_"X",PYR,IEN,"*"))
 .  .  M ^TMP($J,IBCNERTN,INQS,PYR,IEN)=^TMP($J,IBCNERTN_"X",PYR,IEN,"*")
 .  .  QUIT
 .  QUIT
 ; KILL temporary report global - used to resort
 KILL ^TMP($J,IBCNERTN_"X")
 ;
EXIT ; EN Exit point
 Q
 ;
 ;
GETDATA(IEN,RPTDATA,DTL,PYNM,PYIEN,PYR) ; Retrieve data for this inquiry and response(s)
 ; Output: 
 ;  RPTDATA(PayerName,PayerIEN) = Created(1)^Cancelled(0/1)^Queued(0/1)^
 ;   #1stTrans^#Retries^#Non-ErrorResponses^#ErrorResponses^
 ;   #ofDaysforResponses^#Timeouts^#Pending^DeactivationDTM
 ;  RPTDATA(PayerName,PayerIEN,ErrCond OR ErrText) = #ErrorResps subtotal
 ; Initialize variables
 NEW DEACT,HLIEN,HLID,RIEN,RDATA0,RPYIEN,RPYNM,RDATA1,ERRTXT,X1,X2,FIRST
 ;
 S RPTDATA(PYNM,PYIEN)=1
 ;IB*668/TAZ - Call PYRDEACT to get Payer Deactivated from new file location.
 ; Determine Deactivation DTM for eIV application
 S DEACT=$$PYRDEACT^IBCNINSU(PYIEN)
 I +DEACT S $P(RPTDATA(PYNM,PYIEN),U,11)=$P(DEACT,U,2)
 ; Logic by Transmission Status
 ;  Cancelled (7) - Payer deactivated
 I $P($G(^IBCN(365.1,IEN,0)),U,4)=7 S $P(RPTDATA(PYNM,PYIEN),U,2)=1 Q
 ;  Queued - no HL7 messages (# Transmissions = 0) - no multiples exist
 I '$P($G(^IBCN(365.1,IEN,2,0)),U,3) S $P(RPTDATA(PYNM,PYIEN),U,3)=1 Q
 ;  Sent processing - HL7 messages associated (# Transmissions > 0)
 S HLIEN=0,FIRST=1
 F  S HLIEN=$O(^IBCN(365.1,IEN,2,HLIEN)) Q:'HLIEN  D
 .  I 'FIRST S $P(RPTDATA(PYNM,PYIEN),U,5)=$P(RPTDATA(PYNM,PYIEN),U,5)+1
 .  I FIRST S $P(RPTDATA(PYNM,PYIEN),U,4)=$P(RPTDATA(PYNM,PYIEN),U,4)+1,FIRST=0
 .  ; Process response based on HL7 Message ID
 .  S HLID=$P($G(^IBCN(365.1,IEN,2,HLIEN,0)),U,2) I HLID="" Q
 .  ; Lookup responses by HL7 Message ID
 .  S RIEN=0
 .  F  S RIEN=$O(^IBCN(365,"B",HLID,RIEN)) Q:'RIEN  D
 .  .  S RDATA0=$G(^IBCN(365,RIEN,0))
 .  .  S RPYIEN=$P(RDATA0,U,3) I RPYIEN="" Q
 .  .  S RPYNM=$P($G(^IBE(365.12,RPYIEN,0)),U,1) I RPYNM="" Q
 .  .  ; Apply payer filter here, too!
 .  .  ; If there is a Payer filter, check against the IEN
 .  .  I PYR'="",RPYIEN'=PYR Q
 .  .  ;IB*668/TAZ - Call PYRDEACT to get Payer Deactivated from new file location.
 .  .  ; Determine Deactivation DTM for eIV application
 .  .  S DEACT=$$PYRDEACT^IBCNINSU(RPYIEN)
 .  .  I +DEACT S $P(RPTDATA(RPYNM,RPYIEN),U,11)=$P(DEACT,U,2)
 .  .  S RDATA1=$G(^IBCN(365,RIEN,1))
 .  .  S ERRTXT=$G(^IBCN(365,RIEN,4))
 .  .  ; Transmitted (Pending)
 .  .  I $P(RDATA0,U,6)=2 D  Q
 .  .  . ; Increment for response pending 
 .  .  . S $P(RPTDATA(RPYNM,RPYIEN),U,10)=$P($G(RPTDATA(RPYNM,RPYIEN)),U,10)+1
 .  .  ; Timeout (Communication Failure)
 .  .  I $P(RDATA0,U,6)=5 D  Q
 .  .  . ; Increment for response timeout 
 .  .  . S $P(RPTDATA(RPYNM,RPYIEN),U,9)=$P($G(RPTDATA(RPYNM,RPYIEN)),U,9)+1
 .  .  ; Response Received - gather additional information
 .  .  I $P(RDATA0,U,6)=3 D  Q
 .  .  . ; Determine response time (in days) as difference between 
 .  .  . ;  eIV Response File - Date/Time Response Received and
 .  .  . ;                      Date/Time Response Created (based on HL7)
 .  .  . S X1=$P(RDATA0,U,8)
 .  .  . S X2=$P(RDATA0,U,7)
 .  .  . ; Determine date difference in days
 .  .  . S $P(RPTDATA(RPYNM,RPYIEN),U,8)=$P($G(RPTDATA(RPYNM,RPYIEN)),U,8)+$$FMDIFF^XLFDT(X2,X1,1)
 ;
GETDATX ; GETDATA exit point
 Q
 ;
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCNERP5   7551     printed  Sep 23, 2025@19:51:16                                                                                                                                                                                                    Page 2
IBCNERP5  ;DAOU/BHS - IBCNE eIV PAYER REPORT COMPILE ;03-JUN-2002
 +1       ;;2.0;INTEGRATED BILLING;**184,271,300,416,668**;21-MAR-94;Build 28
 +2       ;;Per VHA Directive 6402, this routine should not be modified.
 +3       ;
 +4       ; eIV - Insurance Verification Interface
 +5       ;
 +6       ; Input variables from IBCNERP4:
 +7       ;   IBCNERTN = "IBCNERP4"
 +8       ;   IBCNESPC("BEGDT") = Start Date for date range
 +9       ;   IBCNESPC("ENDDT") = End Date for date range
 +10      ;   IBCNESPC("PYR") = Payer IEN for report, if = "", then include all
 +11      ;   IBCNESPC("SORT") = 1 - Payer OR 2 - Total Inquiries
 +12      ;   IBCNESPC("DTL") = 1 - YES OR 0 - NO - include Rejection Detail?
 +13      ; Output variables passed to IBCNERP6:
 +14      ;   ^TMP($J,IBCNERTN,SORT1,SORT2,SORT3)=InqCreatedCount^InqCancelledCt^
 +15      ;                                       InqQueuedCt^1stTransCount^
 +16      ;                                       RetryTransCt^Non-ErrorRespCt^
 +17      ;                                       ErrorRespCount^TotRespTime-days^
 +18      ;                                       CommFailRespCount^PendRespCount^
 +19      ;                                       eIVDeactivatedDt
 +20      ;        IBCNERTN = "IBCNERP4"
 +21      ;        SORT1 = PayerName (SORT=1) or -InquiryCount(SORT=2)
 +22      ;        SORT2 = PayerIEN (SORT=1) or PayerName (SORT=2)
 +23      ;        SORT3 = "*" (SORT=1) or PayerIEN (SORT=2)
 +24      ;   ^TMP($J,IBCNERTN,SORT1,SORT2,SORT3,ERRCD)=RespCount
 +25      ;        (see above)
 +26      ;        ERRCD = Error Condition code (ptr to 365.018) or Error Text
 +27      ;                from the Eligibility Communicator (4.01)
 +28      ;
 +29      ; Must call at EN tag
 +30       QUIT 
 +31      ;
EN(IBCNERTN,IBCNESPC) ; Entry point
 +1       ;
 +2       ; Initialize variables
 +3        NEW IBCNEDT,IBCNEDT1,IBCNEDT2,IBCNEPY,IBCNEPYR,IBCNEPTR
 +4        NEW IBCNETOT,IBCNESRT,IBCNEDTL,RPTDATA,PYRIEN,INQS,IEN
 +5        NEW IBPNM,IBPIEN,ERR,PC,PYR
 +6       ;
 +7        IF '$DATA(ZTQUEUED)
               IF $GET(IOST)["C-"
                   WRITE !!,"Compiling report data ..."
 +8       ;
 +9       ; Total responses selected
 +10       SET IBCNETOT=0
 +11      ;
 +12      ; Kill scratch globals
 +13       KILL ^TMP($JOB,IBCNERTN),^TMP($JOB,IBCNERTN_"X")
 +14      ;
 +15      ; Initialize looping variables
 +16       SET IBCNEDT2=$GET(IBCNESPC("ENDDT"))
 +17       SET IBCNEDT1=$GET(IBCNESPC("BEGDT"))
 +18       SET IBCNEPY=$GET(IBCNESPC("PYR"))
 +19       SET IBCNESRT=$GET(IBCNESPC("SORT"))
 +20       SET IBCNEDTL=$GET(IBCNESPC("DTL"))
 +21      ;
 +22      ; Loop through the eIV Transmission Queue File (#365.1) 
 +23      ;  by Date/Time Created Cross-Reference
 +24       SET IBCNEDT=$ORDER(^IBCN(365.1,"AE",IBCNEDT1),-1)
 +25       FOR 
               SET IBCNEDT=$ORDER(^IBCN(365.1,"AE",IBCNEDT))
               if IBCNEDT=""!($PIECE(IBCNEDT,".",1)>IBCNEDT2)
                   QUIT 
               Begin DoDot:1
 +26               SET IBCNEPTR=0
 +27               FOR 
                       SET IBCNEPTR=$ORDER(^IBCN(365.1,"AE",IBCNEDT,IBCNEPTR))
                       if 'IBCNEPTR
                           QUIT 
                       Begin DoDot:2
 +28      ; Update selected count
 +29                       SET IBCNETOT=IBCNETOT+1
 +30                       IF $DATA(ZTQUEUED)
                               IF IBCNETOT#100=0
                                   IF $$S^%ZTLOAD()
                                       SET ZTSTOP=1
                                       QUIT 
 +31      ; Determine Payer name from Payer File (#365.12)
 +32                       SET PYRIEN=$PIECE($GET(^IBCN(365.1,IBCNEPTR,0)),U,3)
 +33                       IF 'PYRIEN
                               QUIT 
 +34      ; Check payer filter
 +35                       IF IBCNEPY'=""
                               IF PYRIEN'=IBCNEPY
                                   QUIT 
 +36                       SET IBCNEPYR=$PIECE($GET(^IBE(365.12,PYRIEN,0)),U)
 +37                       IF IBCNEPYR=""
                               QUIT 
 +38      ; Now get the data for the report - build RPTDATA
 +39                       KILL RPTDATA
 +40                       DO GETDATA(IBCNEPTR,.RPTDATA,IBCNEDTL,IBCNEPYR,PYRIEN,IBCNEPY)
 +41      ; Loop through results by Payer Name, Payer IEN
 +42                       SET IBPNM=""
 +43                       FOR 
                               SET IBPNM=$ORDER(RPTDATA(IBPNM))
                               if IBPNM=""
                                   QUIT 
                               Begin DoDot:3
 +44                               SET IBPIEN=0
 +45                               FOR 
                                       SET IBPIEN=$ORDER(RPTDATA(IBPNM,IBPIEN))
                                       if 'IBPIEN
                                           QUIT 
                                       Begin DoDot:4
 +46      ; Store totals in global
 +47                                       FOR PC=1:1:10
                                               SET $PIECE(^TMP($JOB,IBCNERTN,IBPNM,IBPIEN,"*"),U,PC)=$PIECE($GET(^TMP($JOB,IBCNERTN,IBPNM,IBPIEN,"*")),U,PC)+$PIECE(RPTDATA(IBPNM,IBPIEN),U,PC)
 +48      ; Store deactivation date/time
 +49                                       SET $PIECE(^TMP($JOB,IBCNERTN,IBPNM,IBPIEN,"*"),U,11)=$PIECE(RPTDATA(IBPNM,IBPIEN),U,11)
 +50                                       IF 'IBCNEDTL
                                               QUIT 
 +51      ; Store rejection detail
 +52                                       SET ERR=""
 +53                                       FOR 
                                               SET ERR=$ORDER(RPTDATA(IBPNM,IBPIEN,ERR))
                                               if ERR=""
                                                   QUIT 
                                               Begin DoDot:5
 +54                                               SET ^TMP($JOB,IBCNERTN,IBPNM,IBPIEN,"*",ERR)=$GET(^TMP($JOB,IBCNERTN,IBPNM,IBPIEN,"*",ERR))+$GET(RPTDATA(IBPNM,IBPIEN,ERR))
                                               End DoDot:5
                                       End DoDot:4
                               End DoDot:3
 +55                       QUIT 
                       End DoDot:2
                       if $GET(ZTSTOP)
                           QUIT 
 +56               QUIT 
               End DoDot:1
               if $GET(ZTSTOP)
                   QUIT 
 +57      ;
 +58      ; Call tag to find good/bad/rejection detail data from response file
 +59       DO DATA^IBCNERP4
 +60      ;
 +61       IF $GET(ZTSTOP)!(IBCNESRT=1)
               GOTO EXIT
 +62      ;
 +63      ; Resort if sorted by Total Inquiries
 +64       MERGE ^TMP($JOB,IBCNERTN_"X")=^TMP($JOB,IBCNERTN)
 +65       KILL ^TMP($JOB,IBCNERTN)
 +66       SET PYR=""
 +67       FOR 
               SET PYR=$ORDER(^TMP($JOB,IBCNERTN_"X",PYR))
               if PYR=""
                   QUIT 
               Begin DoDot:1
 +68               SET IEN=0
 +69               FOR 
                       SET IEN=$ORDER(^TMP($JOB,IBCNERTN_"X",PYR,IEN))
                       if 'IEN
                           QUIT 
                       Begin DoDot:2
 +70                       SET INQS=-$GET(^TMP($JOB,IBCNERTN_"X",PYR,IEN,"*"))
 +71                       MERGE ^TMP($JOB,IBCNERTN,INQS,PYR,IEN)=^TMP($JOB,IBCNERTN_"X",PYR,IEN,"*")
 +72                       QUIT 
                       End DoDot:2
 +73               QUIT 
               End DoDot:1
 +74      ; KILL temporary report global - used to resort
 +75       KILL ^TMP($JOB,IBCNERTN_"X")
 +76      ;
EXIT      ; EN Exit point
 +1        QUIT 
 +2       ;
 +3       ;
GETDATA(IEN,RPTDATA,DTL,PYNM,PYIEN,PYR) ; Retrieve data for this inquiry and response(s)
 +1       ; Output: 
 +2       ;  RPTDATA(PayerName,PayerIEN) = Created(1)^Cancelled(0/1)^Queued(0/1)^
 +3       ;   #1stTrans^#Retries^#Non-ErrorResponses^#ErrorResponses^
 +4       ;   #ofDaysforResponses^#Timeouts^#Pending^DeactivationDTM
 +5       ;  RPTDATA(PayerName,PayerIEN,ErrCond OR ErrText) = #ErrorResps subtotal
 +6       ; Initialize variables
 +7        NEW DEACT,HLIEN,HLID,RIEN,RDATA0,RPYIEN,RPYNM,RDATA1,ERRTXT,X1,X2,FIRST
 +8       ;
 +9        SET RPTDATA(PYNM,PYIEN)=1
 +10      ;IB*668/TAZ - Call PYRDEACT to get Payer Deactivated from new file location.
 +11      ; Determine Deactivation DTM for eIV application
 +12       SET DEACT=$$PYRDEACT^IBCNINSU(PYIEN)
 +13       IF +DEACT
               SET $PIECE(RPTDATA(PYNM,PYIEN),U,11)=$PIECE(DEACT,U,2)
 +14      ; Logic by Transmission Status
 +15      ;  Cancelled (7) - Payer deactivated
 +16       IF $PIECE($GET(^IBCN(365.1,IEN,0)),U,4)=7
               SET $PIECE(RPTDATA(PYNM,PYIEN),U,2)=1
               QUIT 
 +17      ;  Queued - no HL7 messages (# Transmissions = 0) - no multiples exist
 +18       IF '$PIECE($GET(^IBCN(365.1,IEN,2,0)),U,3)
               SET $PIECE(RPTDATA(PYNM,PYIEN),U,3)=1
               QUIT 
 +19      ;  Sent processing - HL7 messages associated (# Transmissions > 0)
 +20       SET HLIEN=0
           SET FIRST=1
 +21       FOR 
               SET HLIEN=$ORDER(^IBCN(365.1,IEN,2,HLIEN))
               if 'HLIEN
                   QUIT 
               Begin DoDot:1
 +22               IF 'FIRST
                       SET $PIECE(RPTDATA(PYNM,PYIEN),U,5)=$PIECE(RPTDATA(PYNM,PYIEN),U,5)+1
 +23               IF FIRST
                       SET $PIECE(RPTDATA(PYNM,PYIEN),U,4)=$PIECE(RPTDATA(PYNM,PYIEN),U,4)+1
                       SET FIRST=0
 +24      ; Process response based on HL7 Message ID
 +25               SET HLID=$PIECE($GET(^IBCN(365.1,IEN,2,HLIEN,0)),U,2)
                   IF HLID=""
                       QUIT 
 +26      ; Lookup responses by HL7 Message ID
 +27               SET RIEN=0
 +28               FOR 
                       SET RIEN=$ORDER(^IBCN(365,"B",HLID,RIEN))
                       if 'RIEN
                           QUIT 
                       Begin DoDot:2
 +29                       SET RDATA0=$GET(^IBCN(365,RIEN,0))
 +30                       SET RPYIEN=$PIECE(RDATA0,U,3)
                           IF RPYIEN=""
                               QUIT 
 +31                       SET RPYNM=$PIECE($GET(^IBE(365.12,RPYIEN,0)),U,1)
                           IF RPYNM=""
                               QUIT 
 +32      ; Apply payer filter here, too!
 +33      ; If there is a Payer filter, check against the IEN
 +34                       IF PYR'=""
                               IF RPYIEN'=PYR
                                   QUIT 
 +35      ;IB*668/TAZ - Call PYRDEACT to get Payer Deactivated from new file location.
 +36      ; Determine Deactivation DTM for eIV application
 +37                       SET DEACT=$$PYRDEACT^IBCNINSU(RPYIEN)
 +38                       IF +DEACT
                               SET $PIECE(RPTDATA(RPYNM,RPYIEN),U,11)=$PIECE(DEACT,U,2)
 +39                       SET RDATA1=$GET(^IBCN(365,RIEN,1))
 +40                       SET ERRTXT=$GET(^IBCN(365,RIEN,4))
 +41      ; Transmitted (Pending)
 +42                       IF $PIECE(RDATA0,U,6)=2
                               Begin DoDot:3
 +43      ; Increment for response pending 
 +44                               SET $PIECE(RPTDATA(RPYNM,RPYIEN),U,10)=$PIECE($GET(RPTDATA(RPYNM,RPYIEN)),U,10)+1
                               End DoDot:3
                               QUIT 
 +45      ; Timeout (Communication Failure)
 +46                       IF $PIECE(RDATA0,U,6)=5
                               Begin DoDot:3
 +47      ; Increment for response timeout 
 +48                               SET $PIECE(RPTDATA(RPYNM,RPYIEN),U,9)=$PIECE($GET(RPTDATA(RPYNM,RPYIEN)),U,9)+1
                               End DoDot:3
                               QUIT 
 +49      ; Response Received - gather additional information
 +50                       IF $PIECE(RDATA0,U,6)=3
                               Begin DoDot:3
 +51      ; Determine response time (in days) as difference between 
 +52      ;  eIV Response File - Date/Time Response Received and
 +53      ;                      Date/Time Response Created (based on HL7)
 +54                               SET X1=$PIECE(RDATA0,U,8)
 +55                               SET X2=$PIECE(RDATA0,U,7)
 +56      ; Determine date difference in days
 +57                               SET $PIECE(RPTDATA(RPYNM,RPYIEN),U,8)=$PIECE($GET(RPTDATA(RPYNM,RPYIEN)),U,8)+$$FMDIFF^XLFDT(X2,X1,1)
                               End DoDot:3
                               QUIT 
                       End DoDot:2
               End DoDot:1
 +58      ;
GETDATX   ; GETDATA exit point
 +1        QUIT 
 +2       ;
 +3       ;