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

IBCEMSR6.m

Go to the documentation of this file.
  1. IBCEMSR6 ;ALB/VAD - IB PRINTED CLAIMS REPORT - Sort ;09-SEP-2015
  1. ;;2.0;INTEGRATED BILLING;**547,759**;21-MAR-94;Build 24
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. SRCH ; Collect Information
  1. ; Use the existing AP x-ref to narrow down the list of claims by date,
  1. ; then check field 27 to see if it's appropriate to put it on the report (1=LOCAL PRINT)
  1. ;The following line is used to find Bills in the Printed Date Range and the FORCE TO PRINT field
  1. N BILLNO,IBBILZ,IBDV,IBDT,IBIFN,IBFTYP,IBTOP,IBRTN,IBRVCDS,IBSRT,IBTYPE,INSADD,LOCCNT,RCX,TOTCNT
  1. N INSCO,IBSFLD,IBULD,IBINS,X,RTDSC,IBRVCD,IBTOPN,VARRAY,IBRTDS,IBPTYP,IBBLLR
  1. K ^TMP($J,"IBCEMSRP-DATA")
  1. D INIT
  1. S IBDT=IBBDT-.1,IBSRT=$P(IBSORT,U)
  1. S (TOTCNT,LOCCNT)=0
  1. F S IBDT=$O(^DGCR(399,"AP",IBDT)) Q:'IBDT!(IBDT>IBEDT) D ; Identify those claims within the selected date range
  1. . S IBIFN=0 F S IBIFN=$O(^DGCR(399,"AP",IBDT,IBIFN)) Q:'IBIFN D
  1. . . S IBBILZ=$G(^DGCR(399,IBIFN,0)),IBRTN=$P(IBBILZ,U,7),IBDV=+$P(IBBILZ,U,22) ; Get Rate Type and division
  1. . . Q:$P(IBBILZ,U,13)'=4 ; don't include canceled claims
  1. . . Q:'$D(IBDIVS(IBDV)) ; Not one of the selected Divisions
  1. . . S TOTCNT=TOTCNT+1 ; Accumulate Total Printed for selected divisions.
  1. . . I $P($G(^DGCR(399,IBIFN,"TX")),U,8)'=1 Q ; Is the Bill "FORCE LOCAL PRINT"?
  1. . . ; don't include US Labor Dept claims; 5/1/23;IB*2.0*759v2;EBILL-3377;Patient resp claims may have no insurance, Q:IBINS=""
  1. . . S IBINS=$$CURR^IBCEF2(IBIFN) Q:IBINS="" Q:$D(VARRAY("IBULD",IBINS))
  1. . . ; don't count claims where EDI is inactive (user has to print those)
  1. . . Q:$$INSOK^IBCEF4(IBINS)'=1
  1. . . Q:'$D(VARRAY("RTYPES",IBRTN)) ;Is this one of the selected Rate Types?
  1. . . S IBTOP=+$P($G(^IBA(355.3,+$$POLICY^IBCEF(IBIFN,18),0)),U,9) ; Get Plan Type
  1. . . Q:'$D(VARRAY("IBTOP",IBTOP)) ;Is this one of the selected Plan Types?
  1. . . S RCX=0
  1. . . S (IBRVCDS,X)="" F S X=$O(^DGCR(399,IBIFN,"RC","B",X)) Q:X="" D Q:RCX
  1. . . . I $D(VARRAY("XRVCDS",X)) S RCX=1 Q ; Bill contains a Revenue Code Exclusion.
  1. . . . S IBRVCDS=$S(IBRVCDS="":X,1:IBRVCDS_","_X) ; Get Revenue Codes.
  1. . . Q:RCX=1 ; bill contains at least one of the excluded revenue codes
  1. . . S LOCCNT=LOCCNT+1 ; Accumulate Only Locally Printed that could have gone electronically and meet all the search criteria.
  1. . . S IBRTDS=$G(VARRAY("RTYPES",IBRTN)) ; Get the Rate Type Description
  1. . . S IBPTYP=$G(VARRAY("IBTOP",IBTOP)) ; Get Plan Type name
  1. . . S BILLNO=$$BN1^PRCAFN(IBIFN) ; Get external CLAIM # DBIA #380
  1. . . S INSCO=$P($G(^DIC(36,IBINS,0)),U) ; Get Insurance Company Name
  1. . . S INSADD=$$CURRINS^IBCEPTC2(IBIFN) ; Get Insurance Company Address
  1. . . S IBFTYP=$P($G(^IBE(353,+$P(IBBILZ,U,19),0)),U) I IBFTYP="" S IBFTYP="UNKNOWN" ; Get the Bill's Form Type.
  1. . . S IBTYPE=$S($P(IBBILZ,U,5)>2:"O",1:"I")_"/"_$S($P(IBBILZ,U,27)=1:"I",$P(IBBILZ,U,27)=2:"P",1:"") ; Patient Status / Bill Charge Type
  1. . . S IBBLLR=$P($$BILLER^IBCIUT5(IBIFN),U,2) ; Get Biller
  1. . . ; GATHER REPORTABLE DATA AND STORE ACCORDING TO THE VALUE OF IBSORT INTO ^TMP($J,"IBCEMSRP-DATA")!!!
  1. . . S IBSFLD=$S(IBSRT="I":INSCO,IBSRT="R":IBRTDS,IBSRT="F":IBFTYP,IBSRT="P":IBPTYP,1:IBBLLR)
  1. . . ; if sorted by insurance company, add address to subheader
  1. . . S:IBSRT="I" ^TMP($J,"IBCEMSRP-DATA",INSCO)=INSADD
  1. . . S ^TMP($J,"IBCEMSRP-DATA",IBSFLD,BILLNO)=IBTYPE_U_IBRTDS_U_IBPTYP_U_$G(IBDIVS(IBDV))_U_IBBLLR_U_INSCO_U_INSADD
  1. . . S ^TMP($J,"IBCEMSRP-DATA",IBSFLD,BILLNO,"RVCDS")=IBRVCDS
  1. S ^TMP($J,"IBCEMSRP-DATA")=LOCCNT_U_TOTCNT
  1. Q
  1. ;
  1. INIT ; come here to set up search criteria
  1. ; Get ien of US Labor Department payer (cover all possible name variations)
  1. S IBULD=$O(^DIC(36,"B","US LABOR DEPARTMENT","")) S:IBULD'="" VARRAY("IBULD",IBULD)=""
  1. S IBULD=$O(^DIC(36,"B","US DEPT OF LABOR","")) S:IBULD'="" VARRAY("IBULD",IBULD)=""
  1. S IBULD=$O(^DIC(36,"B","US DEPARTMENT OF LABOR","")) S:IBULD'="" VARRAY("IBULD",IBULD)=""
  1. ; handle claims that do not have a type of plan
  1. S VARRAY("IBTOP",0)="UNKNOWN"
  1. ; Claim does not contain excluded revenue codes from IB Site parameters
  1. S IBRVCD="" F S IBRVCD=$O(^IBE(350.9,1,15,"B",IBRVCD)) Q:'IBRVCD S VARRAY("XRVCDS",IBRVCD)=""
  1. ; Tricare Rate Type is one of the following and type of plan is one of the following:
  1. I IBCOT="T" D Q
  1. .F RTDSC="CHAMPVA REIMB. INS.","CHAMPVA","TRICARE REIMB. INS.","TRICARE" S IBRTN=$O(^DGCR(399.3,"B",RTDSC,"")) I IBRTN S VARRAY("RTYPES",IBRTN)=RTDSC
  1. .F IBTOPN="TRICARE","CHAMPVA","TRICARE SUPPLEMENTAL" S IBTOP=$O(^IBE(355.1,"B",IBTOPN,"")) I IBTOP S VARRAY("IBTOP",IBTOP)=IBTOPN
  1. ; CPAC Rate Type is one of the following and type of plan is one of the following:
  1. I IBCOT="C" D Q
  1. .F RTDSC="CRIME VICTIM","NO FAULT INS.","REIMBURSABLE INS.","TORT FEASOR","WORKERS' COMP." S IBRTN=$O(^DGCR(399.3,"B",RTDSC,"")) I IBRTN S VARRAY("RTYPES",IBRTN)=RTDSC
  1. .F IBTOPN="ACCIDENT AND HEALTH INSURANCE","AUTOMOBILE","CARVE-OUT","CATASTROPHIC INSURANCE","COMPREHENSIVE MAJOR MEDICAL" S IBTOP=$O(^IBE(355.1,"B",IBTOPN,"")) I IBTOP S VARRAY("IBTOP",IBTOP)=IBTOPN
  1. .F IBTOPN="HEALTH MAINTENANCE ORGANIZ","INCOME PROTECTION (INDEMNITY)","INDIVIDUAL PRACTICE ASSOCATION (IPA)" S IBTOP=$O(^IBE(355.1,"B",IBTOPN,"")) I IBTOP S VARRAY("IBTOP",IBTOP)=IBTOPN
  1. .F IBTOPN="INPATIENT (BASIC HOSPITAL)","LABS, PROCEDURES, X-RAY, ETC. (ONLY)","MANAGED CARE SYSTEM (MCS)","MEDI-CAL","MEDICAID" S IBTOP=$O(^IBE(355.1,"B",IBTOPN,"")) I IBTOP S VARRAY("IBTOP",IBTOP)=IBTOPN
  1. .F IBTOPN="MEDICAL EXPENSE (OPT/PROF)","MEDICARE SECONDARY (B EXC)","MEDICARE SECONDARY (NO B EXC)","MEDICARE SUPPLEMENTAL" S IBTOP=$O(^IBE(355.1,"B",IBTOPN,"")) I IBTOP S VARRAY("IBTOP",IBTOP)=IBTOPN
  1. .F IBTOPN="MEDICARE/MEDICAID (MEDI-CAL)","MEDIGAP PLAN A","MEDIGAP PLAN B","MEDIGAP PLAN C","MEDIGAP PLAN D","MEDIGAP PLAN F" S IBTOP=$O(^IBE(355.1,"B",IBTOPN,"")) I IBTOP S VARRAY("IBTOP",IBTOP)=IBTOPN
  1. .F IBTOPN="MEDIGAP PLAN G","MEDIGAP PLAN K","MEDIGAP PLAN L","MEDIGAP PLAN M","MEDIGAP PLAN N","MENTAL HEALTH","POINT OF SERVICE" S IBTOP=$O(^IBE(355.1,"B",IBTOPN,"")) I IBTOP S VARRAY("IBTOP",IBTOP)=IBTOPN
  1. .F IBTOPN="PREFERRED PROVIDER ORGANIZATION (PPO)","PREPAID GROUP PRACTICE PLAN","PRESCRIPTION","RETIREE","SPECIAL CLASS INSURANCE" S IBTOP=$O(^IBE(355.1,"B",IBTOPN,"")) I IBTOP S VARRAY("IBTOP",IBTOP)=IBTOPN
  1. .F IBTOPN="SPECIAL RISK INSURANCE","SPECIFIED DISEASE INSURANCE","SURGICAL EXPENSE INSURANCE","WORKERS' COMPENSATION INSURANCE" S IBTOP=$O(^IBE(355.1,"B",IBTOPN,"")) I IBTOP S VARRAY("IBTOP",IBTOP)=IBTOPN
  1. Q
  1. ;