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

IBCNAU2.m

Go to the documentation of this file.
  1. 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
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ; Queued Entry Point for Report.
  1. ; Required variable input: ALLUSERS, ALLINS, PLANS, ALLPLANS, EXCEL
  1. ; ^TMP("IBINC",$J)
  1. ; ^TMP("IBUSER",$J)
  1. ; DATE("START") and DATE("END") required array elements if all dates not selected
  1. ;
  1. ;IB*737/CKB - references to 'eIV Payer' should be changed to 'Payer' in order
  1. ; to include 'IIU Payers'
  1. Q
  1. ;
  1. ;EN(ALLINS,ALLPLANS,PLANS,DATE) ;
  1. ;/vd-IB*2*664 - Changed the above line to the line below.
  1. EN(ALLINS,ALLPLANS,PLANS,ALLPYRS,REPTYP,DATE) ;
  1. N LN
  1. S LN=0
  1. ; - compile report data
  1. K ^TMP("IBPR",$J),^TMP("IBPR2",$J)
  1. K ^TMP("IBPRINS",$J) ; IB*737/DTG to track which DIA(36,"B",INSIENS have been picked up
  1. ;
  1. ; - user wanted all companies, PLANS, and users
  1. ;I PLANS D PLANS(ALLUSERS,.LN,.DATE)
  1. ;E D NOPLANS(ALLUSERS,.LN,.DATE)
  1. ;/vd-IB*2*664 - Replaced the above 3 lines with the following:
  1. ;Beginning of IB*2*664 code
  1. ; - dependent upon Report selection prepare the respective insurance companies,
  1. ; plans, eIV payers, and users
  1. I REPTYP'=2 D ; report for ins cos/plans or both was selected
  1. .I PLANS D PLANS(ALLUSERS,.LN,.DATE)
  1. .E D NOPLANS(ALLUSERS,.LN,.DATE)
  1. I REPTYP'=1 D PAYERS(ALLPLANS,ALLUSERS,.LN,.DATE) ; report for eIV payers or both was selected
  1. ;End of IB*2*664 code
  1. ;
  1. PRINT ; - print report
  1. ;D EN^IBCNAU3(ALLPLANS,PLANS)
  1. ;/vd-IB*2*664 - Replaced the line above with the line below
  1. D EN^IBCNAU3(ALLPLANS,PLANS,ALLPYRS,REPTYP)
  1. ;
  1. I $D(ZTQUEUED) S ZTREQ="@" Q
  1. D ^%ZISC
  1. Q
  1. ;
  1. PLANS(ALLUSERS,LN,DATE) ;
  1. ; report will include edits to files 36 and 355.3
  1. N INSNAME,INSIEN,PLIEN,Z
  1. S INSNAME="" F S INSNAME=$O(^TMP("IBINC",$J,INSNAME)) Q:INSNAME="" D
  1. . S INSIEN=0 F S INSIEN=$O(^TMP("IBINC",$J,INSNAME,INSIEN)) Q:'INSIEN D
  1. . . S PLIEN=0 F S PLIEN=$O(^TMP("IBINC",$J,INSNAME,INSIEN,PLIEN)) Q:'PLIEN D
  1. . . . I ALLUSERS D ALLUSERS(INSNAME,INSIEN,PLIEN,PLANS,.LN,.DATE,.Z) Q
  1. . . . I 'ALLUSERS D SELUSERS(INSNAME,INSIEN,PLIEN,.LN,.DATE,.Z)
  1. Q
  1. ;
  1. NOPLANS(ALLUSERS,LN,DATE) ; only report edits made to INSURANCE COMPANY file (36)
  1. N INSNAME,INSIEN,PLIEN
  1. S PLIEN=0
  1. ;
  1. S INSNAME="" F S INSNAME=$O(^TMP("IBINC",$J,INSNAME)) Q:INSNAME="" D
  1. . S INSIEN=0 F S INSIEN=$O(^TMP("IBINC",$J,INSNAME,INSIEN)) Q:'INSIEN D
  1. . . I ALLUSERS D ALLUSERS(INSNAME,INSIEN,0,0,.LN,.DATE,.Z)
  1. . . I 'ALLUSERS D SELUSERS(INSNAME,INSIEN,PLIEN,.LN,.DATE,.Z)
  1. Q
  1. ;
  1. 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)
  1. ; INSIEN = ien of INSURANCE COMPANY (36) entry
  1. ; PLIEN = ien of GROUP iNSURANCE PLAN (355.3) entry
  1. ; OR equal to 0 if group plans or not to be reported
  1. ; DATE = date range for edits (DATE("START") and DATE("END"))
  1. ; Z = input and output array
  1. K Z
  1. N DIAIEN,SUB,DIA0,FIELD ;LN
  1. S SUB=$S(PLIEN:1,1:0)
  1. S DIAIEN=0
  1. S Z("PLAN")=$S(PLIEN:$P($G(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
  1. S Z("INSNAME")=INSNAME
  1. ; INSURANCE COMPANY AUDITS
  1. F S DIAIEN=$O(^DIA(36,"B",INSIEN,DIAIEN)) Q:'DIAIEN D
  1. . S DIA0=^DIA(36,DIAIEN,0),DATE=$P($P(DIA0,U,2),".")
  1. . Q:DATE<DATE("START") Q:DATE>DATE("END") ; audit record outside date range
  1. . S FIELD=$S($P(DIA0,U,3)=".01":"INSURANCE COMPANY",1:$P(^DD(36,$P(DIA0,U,3),0),U))
  1. . S Z("DATE")=$E($P(DIA0,U,2),1,12),Z("FIELD")=FIELD,Z("USER")=$P(DIA0,U,4)
  1. . S Z("OLDVAL")=$G(^DIA(36,DIAIEN,2)),Z("NEWVAL")=$G(^DIA(36,DIAIEN,3))
  1. . S Z("PLAN")=$S(PLIEN:$P($G(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
  1. . S Z("INSNAME")=INSNAME
  1. . S Z("ISINS")=36 ;IB*737/DTG flag for file 36
  1. . I $G(^TMP("IBPRINS",$J,INSIEN,DIAIEN))=1 Q ; IB*737/DTG do not re-print if already printed
  1. . D ADDLN(SUB,.LN,.Z)
  1. . S ^TMP("IBPRINS",$J,INSIEN,DIAIEN)=1 ; IB*737/DTG track for not re-print if already printed
  1. ;
  1. ; if GROUP PLAN edits are to be reported then proceed with gathering edits from file 355.3, 355.32, 355.4
  1. ; GROUP INSURANCE PLAN AUDITS
  1. I PLANS D
  1. . S DIAIEN=0,Z("ISINS")="" ;IB*737/DTG make sure DIAIEN is zero, clear item for file 36 chk
  1. . F S DIAIEN=$O(^DIA(355.3,"B",PLIEN,DIAIEN)) Q:'DIAIEN D
  1. . . S DIA0=^DIA(355.3,DIAIEN,0),DATE=$P($P(DIA0,U,2),".")
  1. . . Q:DATE<DATE("START") Q:DATE>DATE("END") ; audit record outside date range
  1. . . S FIELD=$P(^DD(355.3,$P(DIA0,U,3),0),U)
  1. . . S Z("DATE")=$E($P(DIA0,U,2),1,12),Z("FIELD")=FIELD,Z("USER")=$P(DIA0,U,4)
  1. . . S Z("OLDVAL")=$G(^DIA(355.3,DIAIEN,2)),Z("NEWVAL")=$G(^DIA(355.3,DIAIEN,3))
  1. . . D ADDLN(SUB,.LN,.Z)
  1. Q
  1. ;
  1. SELUSERS(INSNAME,INSIEN,PLIEN,LN,DATE,Z) ; procedure to gather edits for selected Users for a date range
  1. K Z
  1. N DIAIEN,SUB,DIA0,FIELD,USER
  1. S SUB=$S(PLIEN:1,1:0)
  1. S DIAIEN=0
  1. S Z("PLAN")=$S(PLIEN:$P($G(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
  1. S Z("INSNAME")=INSNAME
  1. ; INSURANCE COMPANY AUDITS
  1. F S DIAIEN=$O(^DIA(36,"B",INSIEN,DIAIEN)) Q:'DIAIEN D
  1. . S DIA0=^DIA(36,DIAIEN,0),DATE=$P($P(DIA0,U,2),"."),USER=$P(DIA0,U,4)
  1. . Q:'$D(^TMP("IBUSER",$J,USER)) ; not a selected user
  1. . Q:DATE<DATE("START") Q:DATE>DATE("END") ; audit record outside date range
  1. . S FIELD=$S($P(DIA0,U,3)=".01":"INSURANCE COMPANY",1:$P(^DD(36,$P(DIA0,U,3),0),U))
  1. . ;IB*737/CKB - display date & time when a specific User(s) is selected
  1. . S Z("DATE")=$E($P(DIA0,U,2),1,12),Z("FIELD")=FIELD,Z("USER")=USER
  1. . S Z("OLDVAL")=$G(^DIA(36,DIAIEN,2)),Z("NEWVAL")=$G(^DIA(36,DIAIEN,3))
  1. . S Z("PLAN")=$S(PLIEN:$P($G(^IBA(355.3,PLIEN,2)),U),1:"NO PLANS SELECTED")
  1. . S Z("INSNAME")=INSNAME
  1. . S Z("ISINS")=36 ;IB*737/DTG flag for file 36
  1. . I $G(^TMP("IBPRINS",$J,INSIEN,DIAIEN))=1 Q ; IB*737/DTG do not re-print if alredy printed
  1. . D ADDLN(SUB,.LN,.Z)
  1. . S ^TMP("IBPRINS",$J,INSIEN,DIAIEN)=1 ; IB*737/DTG track for not re-print if alredy printed
  1. ;
  1. Q:'PLANS ; audits from the GROUP INSURANCE PLAN are not to be reported
  1. ; if GROUP PLAN edits are to be reported then proceed with gathering edits from file 355.3, 355.32, 355.4
  1. ;
  1. ; GROUP INSURANCE PLAN AUDITS
  1. S DIAIEN=0,Z("ISINS")="" ;IB*737/DTG make sure DIAIEN is zero, clear itm for file 36
  1. F S DIAIEN=$O(^DIA(355.3,"B",PLIEN,DIAIEN)) Q:'DIAIEN D
  1. . S DIA0=^DIA(355.3,DIAIEN,0),DATE=$P($P(DIA0,U,2),"."),USER=$P(DIA0,U,4)
  1. . Q:'$D(^TMP("IBUSER",$J,USER)) ; not a selected user
  1. . Q:DATE<DATE("START") Q:DATE>DATE("END") ; audit record outside date range
  1. . S FIELD=$P(^DD(355.3,$P(DIA0,U,3),0),U)
  1. . ;IB*737/CKB - display date & time when a specific User(s) is selected
  1. . S Z("DATE")=$E($P(DIA0,U,2),1,12),Z("FIELD")=FIELD,Z("USER")=USER
  1. . S Z("OLDVAL")=$G(^DIA(355.3,DIAIEN,2)),Z("NEWVAL")=$G(^DIA(355.3,DIAIEN,3))
  1. . D ADDLN(SUB,.LN,.Z)
  1. Q
  1. ;
  1. ;/vd-IB*2*664 - Beginning of new code for eIV Payer selection(s).
  1. ;IB*737/CKB
  1. PAYERS(ALLPLANS,ALLUSERS,LN,DATE) ; PROCESS PAYERS
  1. N BDATE,DIA0,DIAIEN,EDATE,FIELD,PAYERLN,PYRAPP,PYRIEN,PYRNAME,SUB
  1. ;
  1. S SUB=0
  1. S Z("ISINS")="" ;IB*737/DTG clear itm for file 36
  1. S BDATE=DATE("START")-.000001,EDATE=DATE("END")+.999999
  1. F S BDATE=$O(^DIA(365.12,"C",BDATE)) Q:BDATE="" D
  1. . I BDATE>EDATE Q
  1. . S DIAIEN=0,PAYERLN=1
  1. . F S DIAIEN=$O(^DIA(365.12,"C",BDATE,DIAIEN)) Q:DIAIEN="" D
  1. . . N Z
  1. . . S DIA0=^DIA(365.12,DIAIEN,0)
  1. . . S PYRIEN=+$P(DIA0,U,1),PYRAPP=$P($P(DIA0,U,1),",",2) ; Get the internal Payer # and the Application
  1. . . ;IB*737/CKB - only "eIV" and "IIU" Application Modifications.
  1. . . I ($$GET1^DIQ(365.121,PYRAPP_","_PYRIEN_",",.01)'="EIV")&($$GET1^DIQ(365.121,PYRAPP_","_PYRIEN_",",.01)'="IIU") Q
  1. . . S PYRNAME=$$GET1^DIQ(365.12,PYRIEN,.01)
  1. . . I 'ALLPYRS,'$D(^TMP("IBPYR",$J,PYRNAME,PYRIEN)) Q ; Is this a selected payer?
  1. . . ;IB*668/TAZ - Changed Payer Application from IIV to EIV
  1. . . ;IB*737/CKB - allow for eIV and IIU Payers
  1. . . I ('+$$PYRAPP^IBCNEUT5("EIV",PYRIEN))&('+$$PYRAPP^IBCNEUT5("IIU",PYRIEN)) Q
  1. . . S FIELD=$S($P(DIA0,U,3)="1,.03":"LOCALLY ENABLED","1,5.01":"RECEIVE IIU DATA",1:"")
  1. . . I FIELD="" Q ; Not the Locally Enabled or the Receive IIU Data field.
  1. . . S Z("DATE")=$P(DIA0,U,2),Z("FIELD")=FIELD,Z("USER")=$P(DIA0,U,4)
  1. . . S Z("OLDVAL")=$G(^DIA(365.12,DIAIEN,2)),Z("NEWVAL")=$G(^DIA(365.12,DIAIEN,3)),Z("PYRNAME")=PYRNAME
  1. . . I 'ALLUSERS,'$D(^TMP("IBUSER",$J,Z("USER"))) Q
  1. . . D ADDLN(SUB,.LN,.Z,PAYERLN)
  1. Q
  1. ;/IB*2*664 - End of new code.
  1. ;
  1. ;ADDLN(SUB,LN,Z) ;/vd-IB*2*664 - Replaced this line with the following line:
  1. ADDLN(SUB,LN,Z,PAYERLN) ;
  1. ; SUB = 0 if no group plans to be reported
  1. ; = 1 if group plans to be reported
  1. ; LN = passed by reference. Line subscript at ^TMP("IBPR",$J,PLANS,LN)
  1. ; PAYERLN=0 if not generating a payer's line
  1. ; =1 if a payer's line is being generated
  1. S LN=LN+1
  1. ; /vd-IB*2*664 - Replaced the following line with couple of lines below it.
  1. ;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")
  1. ;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
  1. I '+$G(PAYERLN) D Q
  1. . S ^TMP("IBPR",$J,SUB,LN)=Z("INSNAME")_U_Z("PLAN")_U_Z("USER")_U_Z("DATE")
  1. . S ^TMP("IBPR",$J,SUB,LN)=^TMP("IBPR",$J,SUB,LN)_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD")
  1. . S ^TMP("IBPR",$J,SUB,LN)=^TMP("IBPR",$J,SUB,LN)_U_$G(Z("ISINS")) ; IB*737/DTG identify file 36 entry
  1. ;S ^TMP("IBPR2",$J,SUB,LN)=Z("PYRNAME")_U_Z("USER")_U_Z("DATE")_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD")
  1. S ^TMP("IBPR2",$J,SUB,LN)=Z("PYRNAME")_U_Z("USER")_U_Z("DATE")_U_Z("OLDVAL")_U_Z("NEWVAL")_U_Z("FIELD")
  1. S ^TMP("IBPR2",$J,SUB,LN)=^TMP("IBPR2",$J,SUB,LN)_U_$G(Z("ISINS")) ; IB*737/DTG identify file 36 entry
  1. Q