IBCNAU2 ;ALB/KML/AWC - USER EDIT REPORT (COMPILE) ;6-APRIL-2015
;;2.0;INTEGRATED BILLING;**528,664,668,737**;21-MAR-94;Build 19
;;Per VA Directive 6402, this routine should not be modified.
;
; Queued Entry Point for Report.
; Required variable input: ALLUSERS, ALLINS, PLANS, ALLPLANS, EXCEL
; ^TMP("IBINC",$J)
; ^TMP("IBUSER",$J)
; DATE("START") and DATE("END") required array elements if all dates not selected
;
;IB*737/CKB - references to 'eIV Payer' should be changed to 'Payer' in order
; to include 'IIU Payers'
Q
;
;EN(ALLINS,ALLPLANS,PLANS,DATE) ;
;/vd-IB*2*664 - Changed the above line to the line below.
EN(ALLINS,ALLPLANS,PLANS,ALLPYRS,REPTYP,DATE) ;
N LN
S LN=0
; - compile report data
K ^TMP("IBPR",$J),^TMP("IBPR2",$J)
K ^TMP("IBPRINS",$J) ; IB*737/DTG to track which DIA(36,"B",INSIENS have been picked up
;
; - user wanted all companies, PLANS, and users
;I PLANS D PLANS(ALLUSERS,.LN,.DATE)
;E D NOPLANS(ALLUSERS,.LN,.DATE)
;/vd-IB*2*664 - Replaced the above 3 lines with the following:
;Beginning of IB*2*664 code
; - dependent upon Report selection prepare the respective insurance companies,
; plans, eIV payers, and users
I REPTYP'=2 D ; report for ins cos/plans or both was selected
.I PLANS D PLANS(ALLUSERS,.LN,.DATE)
.E D NOPLANS(ALLUSERS,.LN,.DATE)
I REPTYP'=1 D PAYERS(ALLPLANS,ALLUSERS,.LN,.DATE) ; report for eIV payers or both was selected
;End of IB*2*664 code
;
PRINT ; - print report
;D EN^IBCNAU3(ALLPLANS,PLANS)
;/vd-IB*2*664 - Replaced the line above with the line below
D EN^IBCNAU3(ALLPLANS,PLANS,ALLPYRS,REPTYP)
;
I $D(ZTQUEUED) S ZTREQ="@" Q
D ^%ZISC
Q
;
PLANS(ALLUSERS,LN,DATE) ;
; report will include edits to files 36 and 355.3
N INSNAME,INSIEN,PLIEN,Z
S INSNAME="" F S INSNAME=$O(^TMP("IBINC",$J,INSNAME)) Q:INSNAME="" D
. S INSIEN=0 F S INSIEN=$O(^TMP("IBINC",$J,INSNAME,INSIEN)) Q:'INSIEN D
. . S PLIEN=0 F S PLIEN=$O(^TMP("IBINC",$J,INSNAME,INSIEN,PLIEN)) Q:'PLIEN D
. . . I ALLUSERS D ALLUSERS(INSNAME,INSIEN,PLIEN,PLANS,.LN,.DATE,.Z) Q
. . . I 'ALLUSERS D SELUSERS(INSNAME,INSIEN,PLIEN,.LN,.DATE,.Z)
Q
;
NOPLANS(ALLUSERS,LN,DATE) ; only report edits made to INSURANCE COMPANY file (36)
N INSNAME,INSIEN,PLIEN
S PLIEN=0
;
S INSNAME="" F S INSNAME=$O(^TMP("IBINC",$J,INSNAME)) Q:INSNAME="" D
. S INSIEN=0 F S INSIEN=$O(^TMP("IBINC",$J,INSNAME,INSIEN)) Q:'INSIEN D
. . I ALLUSERS D ALLUSERS(INSNAME,INSIEN,0,0,.LN,.DATE,.Z)
. . I 'ALLUSERS D SELUSERS(INSNAME,INSIEN,PLIEN,.LN,.DATE,.Z)
Q
;
ALLUSERS(INSNAME,INSIEN,PLIEN,PLANS,LN,DATE,Z) ; procedure to gather edits for All Users within a date range
; INSNAME = name of insurance company (36, .01)
; INSIEN = ien of INSURANCE COMPANY (36) entry
; PLIEN = ien of GROUP iNSURANCE PLAN (355.3) entry
; OR equal to 0 if group plans or not to be reported
; DATE = date range for edits (DATE("START") and DATE("END"))
; Z = input and output array
K Z
N DIAIEN,SUB,DIA0,FIELD ;LN
S SUB=$S(PLIEN:1,1:0)
S DIAIEN=0
S Z("PLAN")=$S(PLIEN:$P($G(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
S Z("INSNAME")=INSNAME
; INSURANCE COMPANY AUDITS
F S DIAIEN=$O(^DIA(36,"B",INSIEN,DIAIEN)) Q:'DIAIEN D
. S DIA0=^DIA(36,DIAIEN,0),DATE=$P($P(DIA0,U,2),".")
. Q:DATE<DATE("START") Q:DATE>DATE("END") ; audit record outside date range
. S FIELD=$S($P(DIA0,U,3)=".01":"INSURANCE COMPANY",1:$P(^DD(36,$P(DIA0,U,3),0),U))
. S Z("DATE")=$E($P(DIA0,U,2),1,12),Z("FIELD")=FIELD,Z("USER")=$P(DIA0,U,4)
. S Z("OLDVAL")=$G(^DIA(36,DIAIEN,2)),Z("NEWVAL")=$G(^DIA(36,DIAIEN,3))
. S Z("PLAN")=$S(PLIEN:$P($G(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
. S Z("INSNAME")=INSNAME
. S Z("ISINS")=36 ;IB*737/DTG flag for file 36
. I $G(^TMP("IBPRINS",$J,INSIEN,DIAIEN))=1 Q ; IB*737/DTG do not re-print if already printed
. D ADDLN(SUB,.LN,.Z)
. S ^TMP("IBPRINS",$J,INSIEN,DIAIEN)=1 ; IB*737/DTG track for not re-print if already printed
;
; if GROUP PLAN edits are to be reported then proceed with gathering edits from file 355.3, 355.32, 355.4
; GROUP INSURANCE PLAN AUDITS
I PLANS D
. S DIAIEN=0,Z("ISINS")="" ;IB*737/DTG make sure DIAIEN is zero, clear item for file 36 chk
. F S DIAIEN=$O(^DIA(355.3,"B",PLIEN,DIAIEN)) Q:'DIAIEN D
. . S DIA0=^DIA(355.3,DIAIEN,0),DATE=$P($P(DIA0,U,2),".")
. . Q:DATE<DATE("START") Q:DATE>DATE("END") ; audit record outside date range
. . S FIELD=$P(^DD(355.3,$P(DIA0,U,3),0),U)
. . S Z("DATE")=$E($P(DIA0,U,2),1,12),Z("FIELD")=FIELD,Z("USER")=$P(DIA0,U,4)
. . S Z("OLDVAL")=$G(^DIA(355.3,DIAIEN,2)),Z("NEWVAL")=$G(^DIA(355.3,DIAIEN,3))
. . D ADDLN(SUB,.LN,.Z)
Q
;
SELUSERS(INSNAME,INSIEN,PLIEN,LN,DATE,Z) ; procedure to gather edits for selected Users for a date range
K Z
N DIAIEN,SUB,DIA0,FIELD,USER
S SUB=$S(PLIEN:1,1:0)
S DIAIEN=0
S Z("PLAN")=$S(PLIEN:$P($G(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
S Z("INSNAME")=INSNAME
; INSURANCE COMPANY AUDITS
F S DIAIEN=$O(^DIA(36,"B",INSIEN,DIAIEN)) Q:'DIAIEN D
. S DIA0=^DIA(36,DIAIEN,0),DATE=$P($P(DIA0,U,2),"."),USER=$P(DIA0,U,4)
. Q:'$D(^TMP("IBUSER",$J,USER)) ; not a selected user
. Q:DATE<DATE("START") Q:DATE>DATE("END") ; audit record outside date range
. S FIELD=$S($P(DIA0,U,3)=".01":"INSURANCE COMPANY",1:$P(^DD(36,$P(DIA0,U,3),0),U))
. ;IB*737/CKB - display date & time when a specific User(s) is selected
. S Z("DATE")=$E($P(DIA0,U,2),1,12),Z("FIELD")=FIELD,Z("USER")=USER
. S Z("OLDVAL")=$G(^DIA(36,DIAIEN,2)),Z("NEWVAL")=$G(^DIA(36,DIAIEN,3))
. S Z("PLAN")=$S(PLIEN:$P($G(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
. S Z("INSNAME")=INSNAME
. S Z("ISINS")=36 ;IB*737/DTG flag for file 36
. I $G(^TMP("IBPRINS",$J,INSIEN,DIAIEN))=1 Q ; IB*737/DTG do not re-print if alredy printed
. D ADDLN(SUB,.LN,.Z)
. S ^TMP("IBPRINS",$J,INSIEN,DIAIEN)=1 ; IB*737/DTG track for not re-print if alredy printed
;
Q:'PLANS ; audits from the GROUP INSURANCE PLAN are not to be reported
; if GROUP PLAN edits are to be reported then proceed with gathering edits from file 355.3, 355.32, 355.4
;
; GROUP INSURANCE PLAN AUDITS
S DIAIEN=0,Z("ISINS")="" ;IB*737/DTG make sure DIAIEN is zero, clear itm for file 36
F S DIAIEN=$O(^DIA(355.3,"B",PLIEN,DIAIEN)) Q:'DIAIEN D
. S DIA0=^DIA(355.3,DIAIEN,0),DATE=$P($P(DIA0,U,2),"."),USER=$P(DIA0,U,4)
. Q:'$D(^TMP("IBUSER",$J,USER)) ; not a selected user
. Q:DATE<DATE("START") Q:DATE>DATE("END") ; audit record outside date range
. S FIELD=$P(^DD(355.3,$P(DIA0,U,3),0),U)
. ;IB*737/CKB - display date & time when a specific User(s) is selected
. S Z("DATE")=$E($P(DIA0,U,2),1,12),Z("FIELD")=FIELD,Z("USER")=USER
. S Z("OLDVAL")=$G(^DIA(355.3,DIAIEN,2)),Z("NEWVAL")=$G(^DIA(355.3,DIAIEN,3))
. D ADDLN(SUB,.LN,.Z)
Q
;
;/vd-IB*2*664 - Beginning of new code for eIV Payer selection(s).
;IB*737/CKB
PAYERS(ALLPLANS,ALLUSERS,LN,DATE) ; PROCESS PAYERS
N BDATE,DIA0,DIAIEN,EDATE,FIELD,PAYERLN,PYRAPP,PYRIEN,PYRNAME,SUB
;
S SUB=0
S Z("ISINS")="" ;IB*737/DTG clear itm for file 36
S BDATE=DATE("START")-.000001,EDATE=DATE("END")+.999999
F S BDATE=$O(^DIA(365.12,"C",BDATE)) Q:BDATE="" D
. I BDATE>EDATE Q
. S DIAIEN=0,PAYERLN=1
. F S DIAIEN=$O(^DIA(365.12,"C",BDATE,DIAIEN)) Q:DIAIEN="" D
. . N Z
. . S DIA0=^DIA(365.12,DIAIEN,0)
. . S PYRIEN=+$P(DIA0,U,1),PYRAPP=$P($P(DIA0,U,1),",",2) ; Get the internal Payer # and the Application
. . ;IB*737/CKB - only "eIV" and "IIU" Application Modifications.
. . I ($$GET1^DIQ(365.121,PYRAPP_","_PYRIEN_",",.01)'="EIV")&($$GET1^DIQ(365.121,PYRAPP_","_PYRIEN_",",.01)'="IIU") Q
. . S PYRNAME=$$GET1^DIQ(365.12,PYRIEN,.01)
. . I 'ALLPYRS,'$D(^TMP("IBPYR",$J,PYRNAME,PYRIEN)) Q ; Is this a selected payer?
. . ;IB*668/TAZ - Changed Payer Application from IIV to EIV
. . ;IB*737/CKB - allow for eIV and IIU Payers
. . I ('+$$PYRAPP^IBCNEUT5("EIV",PYRIEN))&('+$$PYRAPP^IBCNEUT5("IIU",PYRIEN)) Q
. . S FIELD=$S($P(DIA0,U,3)="1,.03":"LOCALLY ENABLED","1,5.01":"RECEIVE IIU DATA",1:"")
. . I FIELD="" Q ; Not the Locally Enabled or the Receive IIU Data field.
. . S Z("DATE")=$P(DIA0,U,2),Z("FIELD")=FIELD,Z("USER")=$P(DIA0,U,4)
. . S Z("OLDVAL")=$G(^DIA(365.12,DIAIEN,2)),Z("NEWVAL")=$G(^DIA(365.12,DIAIEN,3)),Z("PYRNAME")=PYRNAME
. . I 'ALLUSERS,'$D(^TMP("IBUSER",$J,Z("USER"))) Q
. . D ADDLN(SUB,.LN,.Z,PAYERLN)
Q
;/IB*2*664 - End of new code.
;
;ADDLN(SUB,LN,Z) ;/vd-IB*2*664 - Replaced this line with the following line:
ADDLN(SUB,LN,Z,PAYERLN) ;
; SUB = 0 if no group plans to be reported
; = 1 if group plans to be reported
; LN = passed by reference. Line subscript at ^TMP("IBPR",$J,PLANS,LN)
; PAYERLN=0 if not generating a payer's line
; =1 if a payer's line is being generated
S LN=LN+1
; /vd-IB*2*664 - Replaced the following line with couple of lines below it.
;S ^TMP("IBPR",$J,SUB,LN)=Z("INSNAME")_U_Z("PLAN")_U_Z("USER")_U_Z("DATE")_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD")
;I '+$G(PAYERLN) S ^TMP("IBPR",$J,SUB,LN)=Z("INSNAME")_U_Z("PLAN")_U_Z("USER")_U_Z("DATE")_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD") Q
I '+$G(PAYERLN) D Q
. S ^TMP("IBPR",$J,SUB,LN)=Z("INSNAME")_U_Z("PLAN")_U_Z("USER")_U_Z("DATE")
. S ^TMP("IBPR",$J,SUB,LN)=^TMP("IBPR",$J,SUB,LN)_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD")
. S ^TMP("IBPR",$J,SUB,LN)=^TMP("IBPR",$J,SUB,LN)_U_$G(Z("ISINS")) ; IB*737/DTG identify file 36 entry
;S ^TMP("IBPR2",$J,SUB,LN)=Z("PYRNAME")_U_Z("USER")_U_Z("DATE")_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD")
S ^TMP("IBPR2",$J,SUB,LN)=Z("PYRNAME")_U_Z("USER")_U_Z("DATE")_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD")
S ^TMP("IBPR2",$J,SUB,LN)=^TMP("IBPR2",$J,SUB,LN)_U_$G(Z("ISINS")) ; IB*737/DTG identify file 36 entry
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCNAU2 9815 printed Dec 13, 2024@02:13:42 Page 2
IBCNAU2 ;ALB/KML/AWC - USER EDIT REPORT (COMPILE) ;6-APRIL-2015
+1 ;;2.0;INTEGRATED BILLING;**528,664,668,737**;21-MAR-94;Build 19
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ; Queued Entry Point for Report.
+5 ; Required variable input: ALLUSERS, ALLINS, PLANS, ALLPLANS, EXCEL
+6 ; ^TMP("IBINC",$J)
+7 ; ^TMP("IBUSER",$J)
+8 ; DATE("START") and DATE("END") required array elements if all dates not selected
+9 ;
+10 ;IB*737/CKB - references to 'eIV Payer' should be changed to 'Payer' in order
+11 ; to include 'IIU Payers'
+12 QUIT
+13 ;
+14 ;EN(ALLINS,ALLPLANS,PLANS,DATE) ;
+15 ;/vd-IB*2*664 - Changed the above line to the line below.
EN(ALLINS,ALLPLANS,PLANS,ALLPYRS,REPTYP,DATE) ;
+1 NEW LN
+2 SET LN=0
+3 ; - compile report data
+4 KILL ^TMP("IBPR",$JOB),^TMP("IBPR2",$JOB)
+5 ; IB*737/DTG to track which DIA(36,"B",INSIENS have been picked up
KILL ^TMP("IBPRINS",$JOB)
+6 ;
+7 ; - user wanted all companies, PLANS, and users
+8 ;I PLANS D PLANS(ALLUSERS,.LN,.DATE)
+9 ;E D NOPLANS(ALLUSERS,.LN,.DATE)
+10 ;/vd-IB*2*664 - Replaced the above 3 lines with the following:
+11 ;Beginning of IB*2*664 code
+12 ; - dependent upon Report selection prepare the respective insurance companies,
+13 ; plans, eIV payers, and users
+14 ; report for ins cos/plans or both was selected
IF REPTYP'=2
Begin DoDot:1
+15 IF PLANS
DO PLANS(ALLUSERS,.LN,.DATE)
+16 IF '$TEST
DO NOPLANS(ALLUSERS,.LN,.DATE)
End DoDot:1
+17 ; report for eIV payers or both was selected
IF REPTYP'=1
DO PAYERS(ALLPLANS,ALLUSERS,.LN,.DATE)
+18 ;End of IB*2*664 code
+19 ;
PRINT ; - print report
+1 ;D EN^IBCNAU3(ALLPLANS,PLANS)
+2 ;/vd-IB*2*664 - Replaced the line above with the line below
+3 DO EN^IBCNAU3(ALLPLANS,PLANS,ALLPYRS,REPTYP)
+4 ;
+5 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
QUIT
+6 DO ^%ZISC
+7 QUIT
+8 ;
PLANS(ALLUSERS,LN,DATE) ;
+1 ; report will include edits to files 36 and 355.3
+2 NEW INSNAME,INSIEN,PLIEN,Z
+3 SET INSNAME=""
FOR
SET INSNAME=$ORDER(^TMP("IBINC",$JOB,INSNAME))
if INSNAME=""
QUIT
Begin DoDot:1
+4 SET INSIEN=0
FOR
SET INSIEN=$ORDER(^TMP("IBINC",$JOB,INSNAME,INSIEN))
if 'INSIEN
QUIT
Begin DoDot:2
+5 SET PLIEN=0
FOR
SET PLIEN=$ORDER(^TMP("IBINC",$JOB,INSNAME,INSIEN,PLIEN))
if 'PLIEN
QUIT
Begin DoDot:3
+6 IF ALLUSERS
DO ALLUSERS(INSNAME,INSIEN,PLIEN,PLANS,.LN,.DATE,.Z)
QUIT
+7 IF 'ALLUSERS
DO SELUSERS(INSNAME,INSIEN,PLIEN,.LN,.DATE,.Z)
End DoDot:3
End DoDot:2
End DoDot:1
+8 QUIT
+9 ;
NOPLANS(ALLUSERS,LN,DATE) ; only report edits made to INSURANCE COMPANY file (36)
+1 NEW INSNAME,INSIEN,PLIEN
+2 SET PLIEN=0
+3 ;
+4 SET INSNAME=""
FOR
SET INSNAME=$ORDER(^TMP("IBINC",$JOB,INSNAME))
if INSNAME=""
QUIT
Begin DoDot:1
+5 SET INSIEN=0
FOR
SET INSIEN=$ORDER(^TMP("IBINC",$JOB,INSNAME,INSIEN))
if 'INSIEN
QUIT
Begin DoDot:2
+6 IF ALLUSERS
DO ALLUSERS(INSNAME,INSIEN,0,0,.LN,.DATE,.Z)
+7 IF 'ALLUSERS
DO SELUSERS(INSNAME,INSIEN,PLIEN,.LN,.DATE,.Z)
End DoDot:2
End DoDot:1
+8 QUIT
+9 ;
ALLUSERS(INSNAME,INSIEN,PLIEN,PLANS,LN,DATE,Z) ; procedure to gather edits for All Users within a date range
+1 ; INSNAME = name of insurance company (36, .01)
+2 ; INSIEN = ien of INSURANCE COMPANY (36) entry
+3 ; PLIEN = ien of GROUP iNSURANCE PLAN (355.3) entry
+4 ; OR equal to 0 if group plans or not to be reported
+5 ; DATE = date range for edits (DATE("START") and DATE("END"))
+6 ; Z = input and output array
+7 KILL Z
+8 ;LN
NEW DIAIEN,SUB,DIA0,FIELD
+9 SET SUB=$SELECT(PLIEN:1,1:0)
+10 SET DIAIEN=0
+11 SET Z("PLAN")=$SELECT(PLIEN:$PIECE($GET(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
+12 SET Z("INSNAME")=INSNAME
+13 ; INSURANCE COMPANY AUDITS
+14 FOR
SET DIAIEN=$ORDER(^DIA(36,"B",INSIEN,DIAIEN))
if 'DIAIEN
QUIT
Begin DoDot:1
+15 SET DIA0=^DIA(36,DIAIEN,0)
SET DATE=$PIECE($PIECE(DIA0,U,2),".")
+16 ; audit record outside date range
if DATE<DATE("START")
QUIT
if DATE>DATE("END")
QUIT
+17 SET FIELD=$SELECT($PIECE(DIA0,U,3)=".01":"INSURANCE COMPANY",1:$PIECE(^DD(36,$PIECE(DIA0,U,3),0),U))
+18 SET Z("DATE")=$EXTRACT($PIECE(DIA0,U,2),1,12)
SET Z("FIELD")=FIELD
SET Z("USER")=$PIECE(DIA0,U,4)
+19 SET Z("OLDVAL")=$GET(^DIA(36,DIAIEN,2))
SET Z("NEWVAL")=$GET(^DIA(36,DIAIEN,3))
+20 SET Z("PLAN")=$SELECT(PLIEN:$PIECE($GET(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
+21 SET Z("INSNAME")=INSNAME
+22 ;IB*737/DTG flag for file 36
SET Z("ISINS")=36
+23 ; IB*737/DTG do not re-print if already printed
IF $GET(^TMP("IBPRINS",$JOB,INSIEN,DIAIEN))=1
QUIT
+24 DO ADDLN(SUB,.LN,.Z)
+25 ; IB*737/DTG track for not re-print if already printed
SET ^TMP("IBPRINS",$JOB,INSIEN,DIAIEN)=1
End DoDot:1
+26 ;
+27 ; if GROUP PLAN edits are to be reported then proceed with gathering edits from file 355.3, 355.32, 355.4
+28 ; GROUP INSURANCE PLAN AUDITS
+29 IF PLANS
Begin DoDot:1
+30 ;IB*737/DTG make sure DIAIEN is zero, clear item for file 36 chk
SET DIAIEN=0
SET Z("ISINS")=""
+31 FOR
SET DIAIEN=$ORDER(^DIA(355.3,"B",PLIEN,DIAIEN))
if 'DIAIEN
QUIT
Begin DoDot:2
+32 SET DIA0=^DIA(355.3,DIAIEN,0)
SET DATE=$PIECE($PIECE(DIA0,U,2),".")
+33 ; audit record outside date range
if DATE<DATE("START")
QUIT
if DATE>DATE("END")
QUIT
+34 SET FIELD=$PIECE(^DD(355.3,$PIECE(DIA0,U,3),0),U)
+35 SET Z("DATE")=$EXTRACT($PIECE(DIA0,U,2),1,12)
SET Z("FIELD")=FIELD
SET Z("USER")=$PIECE(DIA0,U,4)
+36 SET Z("OLDVAL")=$GET(^DIA(355.3,DIAIEN,2))
SET Z("NEWVAL")=$GET(^DIA(355.3,DIAIEN,3))
+37 DO ADDLN(SUB,.LN,.Z)
End DoDot:2
End DoDot:1
+38 QUIT
+39 ;
SELUSERS(INSNAME,INSIEN,PLIEN,LN,DATE,Z) ; procedure to gather edits for selected Users for a date range
+1 KILL Z
+2 NEW DIAIEN,SUB,DIA0,FIELD,USER
+3 SET SUB=$SELECT(PLIEN:1,1:0)
+4 SET DIAIEN=0
+5 SET Z("PLAN")=$SELECT(PLIEN:$PIECE($GET(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
+6 SET Z("INSNAME")=INSNAME
+7 ; INSURANCE COMPANY AUDITS
+8 FOR
SET DIAIEN=$ORDER(^DIA(36,"B",INSIEN,DIAIEN))
if 'DIAIEN
QUIT
Begin DoDot:1
+9 SET DIA0=^DIA(36,DIAIEN,0)
SET DATE=$PIECE($PIECE(DIA0,U,2),".")
SET USER=$PIECE(DIA0,U,4)
+10 ; not a selected user
if '$DATA(^TMP("IBUSER",$JOB,USER))
QUIT
+11 ; audit record outside date range
if DATE<DATE("START")
QUIT
if DATE>DATE("END")
QUIT
+12 SET FIELD=$SELECT($PIECE(DIA0,U,3)=".01":"INSURANCE COMPANY",1:$PIECE(^DD(36,$PIECE(DIA0,U,3),0),U))
+13 ;IB*737/CKB - display date & time when a specific User(s) is selected
+14 SET Z("DATE")=$EXTRACT($PIECE(DIA0,U,2),1,12)
SET Z("FIELD")=FIELD
SET Z("USER")=USER
+15 SET Z("OLDVAL")=$GET(^DIA(36,DIAIEN,2))
SET Z("NEWVAL")=$GET(^DIA(36,DIAIEN,3))
+16 SET Z("PLAN")=$SELECT(PLIEN:$PIECE($GET(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
+17 SET Z("INSNAME")=INSNAME
+18 ;IB*737/DTG flag for file 36
SET Z("ISINS")=36
+19 ; IB*737/DTG do not re-print if alredy printed
IF $GET(^TMP("IBPRINS",$JOB,INSIEN,DIAIEN))=1
QUIT
+20 DO ADDLN(SUB,.LN,.Z)
+21 ; IB*737/DTG track for not re-print if alredy printed
SET ^TMP("IBPRINS",$JOB,INSIEN,DIAIEN)=1
End DoDot:1
+22 ;
+23 ; audits from the GROUP INSURANCE PLAN are not to be reported
if 'PLANS
QUIT
+24 ; if GROUP PLAN edits are to be reported then proceed with gathering edits from file 355.3, 355.32, 355.4
+25 ;
+26 ; GROUP INSURANCE PLAN AUDITS
+27 ;IB*737/DTG make sure DIAIEN is zero, clear itm for file 36
SET DIAIEN=0
SET Z("ISINS")=""
+28 FOR
SET DIAIEN=$ORDER(^DIA(355.3,"B",PLIEN,DIAIEN))
if 'DIAIEN
QUIT
Begin DoDot:1
+29 SET DIA0=^DIA(355.3,DIAIEN,0)
SET DATE=$PIECE($PIECE(DIA0,U,2),".")
SET USER=$PIECE(DIA0,U,4)
+30 ; not a selected user
if '$DATA(^TMP("IBUSER",$JOB,USER))
QUIT
+31 ; audit record outside date range
if DATE<DATE("START")
QUIT
if DATE>DATE("END")
QUIT
+32 SET FIELD=$PIECE(^DD(355.3,$PIECE(DIA0,U,3),0),U)
+33 ;IB*737/CKB - display date & time when a specific User(s) is selected
+34 SET Z("DATE")=$EXTRACT($PIECE(DIA0,U,2),1,12)
SET Z("FIELD")=FIELD
SET Z("USER")=USER
+35 SET Z("OLDVAL")=$GET(^DIA(355.3,DIAIEN,2))
SET Z("NEWVAL")=$GET(^DIA(355.3,DIAIEN,3))
+36 DO ADDLN(SUB,.LN,.Z)
End DoDot:1
+37 QUIT
+38 ;
+39 ;/vd-IB*2*664 - Beginning of new code for eIV Payer selection(s).
+40 ;IB*737/CKB
PAYERS(ALLPLANS,ALLUSERS,LN,DATE) ; PROCESS PAYERS
+1 NEW BDATE,DIA0,DIAIEN,EDATE,FIELD,PAYERLN,PYRAPP,PYRIEN,PYRNAME,SUB
+2 ;
+3 SET SUB=0
+4 ;IB*737/DTG clear itm for file 36
SET Z("ISINS")=""
+5 SET BDATE=DATE("START")-.000001
SET EDATE=DATE("END")+.999999
+6 FOR
SET BDATE=$ORDER(^DIA(365.12,"C",BDATE))
if BDATE=""
QUIT
Begin DoDot:1
+7 IF BDATE>EDATE
QUIT
+8 SET DIAIEN=0
SET PAYERLN=1
+9 FOR
SET DIAIEN=$ORDER(^DIA(365.12,"C",BDATE,DIAIEN))
if DIAIEN=""
QUIT
Begin DoDot:2
+10 NEW Z
+11 SET DIA0=^DIA(365.12,DIAIEN,0)
+12 ; Get the internal Payer # and the Application
SET PYRIEN=+$PIECE(DIA0,U,1)
SET PYRAPP=$PIECE($PIECE(DIA0,U,1),",",2)
+13 ;IB*737/CKB - only "eIV" and "IIU" Application Modifications.
+14 IF ($$GET1^DIQ(365.121,PYRAPP_","_PYRIEN_",",.01)'="EIV")&($$GET1^DIQ(365.121,PYRAPP_","_PYRIEN_",",.01)'="IIU")
QUIT
+15 SET PYRNAME=$$GET1^DIQ(365.12,PYRIEN,.01)
+16 ; Is this a selected payer?
IF 'ALLPYRS
IF '$DATA(^TMP("IBPYR",$JOB,PYRNAME,PYRIEN))
QUIT
+17 ;IB*668/TAZ - Changed Payer Application from IIV to EIV
+18 ;IB*737/CKB - allow for eIV and IIU Payers
+19 IF ('+$$PYRAPP^IBCNEUT5("EIV",PYRIEN))&('+$$PYRAPP^IBCNEUT5("IIU",PYRIEN))
QUIT
+20 SET FIELD=$SELECT($PIECE(DIA0,U,3)="1,.03":"LOCALLY ENABLED","1,5.01":"RECEIVE IIU DATA",1:"")
+21 ; Not the Locally Enabled or the Receive IIU Data field.
IF FIELD=""
QUIT
+22 SET Z("DATE")=$PIECE(DIA0,U,2)
SET Z("FIELD")=FIELD
SET Z("USER")=$PIECE(DIA0,U,4)
+23 SET Z("OLDVAL")=$GET(^DIA(365.12,DIAIEN,2))
SET Z("NEWVAL")=$GET(^DIA(365.12,DIAIEN,3))
SET Z("PYRNAME")=PYRNAME
+24 IF 'ALLUSERS
IF '$DATA(^TMP("IBUSER",$JOB,Z("USER")))
QUIT
+25 DO ADDLN(SUB,.LN,.Z,PAYERLN)
End DoDot:2
End DoDot:1
+26 QUIT
+27 ;/IB*2*664 - End of new code.
+28 ;
+29 ;ADDLN(SUB,LN,Z) ;/vd-IB*2*664 - Replaced this line with the following line:
ADDLN(SUB,LN,Z,PAYERLN) ;
+1 ; SUB = 0 if no group plans to be reported
+2 ; = 1 if group plans to be reported
+3 ; LN = passed by reference. Line subscript at ^TMP("IBPR",$J,PLANS,LN)
+4 ; PAYERLN=0 if not generating a payer's line
+5 ; =1 if a payer's line is being generated
+6 SET LN=LN+1
+7 ; /vd-IB*2*664 - Replaced the following line with couple of lines below it.
+8 ;S ^TMP("IBPR",$J,SUB,LN)=Z("INSNAME")_U_Z("PLAN")_U_Z("USER")_U_Z("DATE")_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD")
+9 ;I '+$G(PAYERLN) S ^TMP("IBPR",$J,SUB,LN)=Z("INSNAME")_U_Z("PLAN")_U_Z("USER")_U_Z("DATE")_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD") Q
+10 IF '+$GET(PAYERLN)
Begin DoDot:1
+11 SET ^TMP("IBPR",$JOB,SUB,LN)=Z("INSNAME")_U_Z("PLAN")_U_Z("USER")_U_Z("DATE")
+12 SET ^TMP("IBPR",$JOB,SUB,LN)=^TMP("IBPR",$JOB,SUB,LN)_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD")
+13 ; IB*737/DTG identify file 36 entry
SET ^TMP("IBPR",$JOB,SUB,LN)=^TMP("IBPR",$JOB,SUB,LN)_U_$GET(Z("ISINS"))
End DoDot:1
QUIT
+14 ;S ^TMP("IBPR2",$J,SUB,LN)=Z("PYRNAME")_U_Z("USER")_U_Z("DATE")_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD")
+15 SET ^TMP("IBPR2",$JOB,SUB,LN)=Z("PYRNAME")_U_Z("USER")_U_Z("DATE")_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD")
+16 ; IB*737/DTG identify file 36 entry
SET ^TMP("IBPR2",$JOB,SUB,LN)=^TMP("IBPR2",$JOB,SUB,LN)_U_$GET(Z("ISINS"))
+17 QUIT