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

IBEFSMUT.m

Go to the documentation of this file.
  1. IBEFSMUT ;SLC/RM - OTH FSM and PP BILLING STATUS UTILITY ; Sep 29, 2020@3:51 pm
  1. ;;2.0;INTEGRATED BILLING;**688,697**;March 21, 1994;Build 12
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ;Global References Supported by ICR# Type
  1. ;----------------- ----------------- ----------
  1. ; ^TMP($J SACC 2.3.2.5.1
  1. ; ^TMP("IBECEA" SACC 2.3.2.5.1
  1. ; ^TMP("IBRBT" SACC 2.3.2.5.1
  1. ;
  1. ;External References
  1. ;-------------------
  1. ; $$GET1^DIQ 2056 Supported
  1. ; GETS^DIQ 2056 Supported
  1. ; Y^DIQ 2056 Supported
  1. ; RX^PSO52API 4820 Supported
  1. ;
  1. Q ;No direct access
  1. ;
  1. EN(DFN,BEGDT,ENDDT,LIST) ;retrieve the IB STATUS from either File #399 and #350
  1. ;Input :
  1. ; DFN : Internal entry number from the PATIENT file (#2) [required]
  1. ; BEGDT : Date of Service [required]
  1. ; ENDDT : Date of Service [required]
  1. ; LIST : Subscript name used in ^TMP global [REQUIRED]
  1. ;Output :
  1. ; Return the requested data elements from either File #399 and #350
  1. ;
  1. N IBABEG,IBAEND,IBCNT,IBOTHSTAT
  1. S IBCNT=0
  1. K ^TMP("IBECEA",$J) ;contain all date of service for the Visit/Encounter and Rx copayments
  1. S IBOTHSTAT="^TMP($J,"""_LIST_""")" ;contain some IB data elements based on the user specified date range
  1. S IBABEG=BEGDT,IBAEND=ENDDT
  1. ;check file #350 first if patient has a record
  1. ;if patient exist, collect all data and store it temporarily in ^TMP("IBECEA",$J)
  1. I $D(@IBOTHSTAT@(350,DFN,0)) S IBCNT=@IBOTHSTAT@(350,DFN,0)
  1. I $D(^IB("C",DFN)) D
  1. . D APTDT^IBECEA0 ;Rx charges
  1. . I $D(^IB("AFDT",DFN)) D APDT^IBECEA0 ;Means Test and CHAMPVA charges
  1. . I $D(^TMP("IBECEA",$J)) D IB350
  1. S @IBOTHSTAT@(350,DFN,0)=$S(IBCNT>0:IBCNT,1:"-1^NO DATA FOUND")
  1. ;
  1. ;check file #399 if patient also has a record
  1. ;if patient exist, collect all data and store it temporarily in ^TMP("IBECEA",$J)
  1. N SUB1,SUB2,IBDTFRM,IBDTTO,IBTYP399,IBN,IBD,RXRF399,IBNARR399
  1. S (IBCNT,RXRF399,IBTYP399)=0
  1. I $D(@IBOTHSTAT@(399,DFN,0)) S IBCNT=@IBOTHSTAT@(399,DFN,0)
  1. I $D(^DGCR(399,"C",DFN)) D
  1. . K ^TMP("IBRBT",$J),IBNARR399
  1. . D IB399 ;collects all related bill for a patient in file #399
  1. . ;after collecting all the bills for this patient,
  1. . ;determine whether bill is inpatient,outpatient, or rx refill
  1. . ;1 - inpatient (as per business owner, no rx since it is a combined bill)
  1. . ;0 - outpatient
  1. . S SUB1="" F S SUB1=$O(^TMP("IBRBT",$J,SUB1)) Q:SUB1="" D
  1. . . S SUB2="" F S SUB2=$O(^TMP("IBRBT",$J,SUB1,SUB2)) Q:SUB2="" D
  1. . . . ;quit if this IBN already been evaluated
  1. . . . Q:$D(IBNARR399(SUB2))
  1. . . . S (RXRF399,IBTYP399,IBN,IBD)=0
  1. . . . S IBDTFRM=$P(^TMP("IBRBT",$J,SUB1,SUB2),U) ;date billed from (event date or the admission date)
  1. . . . S IBDTTO=$P(^TMP("IBRBT",$J,SUB1,SUB2),U,2) ;date billed to (discharge date for inpatient)
  1. . . . S IBTYP399=$$INPAT^IBCEF(SUB2,1) ;determine if bill is inpatient,outpatient, or rx refill
  1. . . . ;check if the records we are looking is in the date range
  1. . . . I +IBTYP399>0,'$$CHKDATE(IBDTFRM) Q ;IBDTFRM<IBABEG!(IBDTTO>IBAEND) Q ;inpatient date range check
  1. . . . I +IBTYP399<1,'$$CHKDATE(IBDTFRM) Q ;outpatient date range check
  1. . . . I +IBTYP399<1 S:$D(^IBA(362.4,"C",SUB2)) RXRF399=3 ;check if there any Rx refill included for this bill
  1. . . . ;extract other data for this patient's bill to be displayed in the report
  1. . . . S IBN=SUB2,IBD=IBDTFRM D DATA399
  1. . . . S IBNARR399(SUB2)=""
  1. S @IBOTHSTAT@(399,DFN,0)=$S(IBCNT>0:IBCNT,1:"-1^NO DATA FOUND")
  1. K ^TMP("IBRBT",$J),^TMP("IBECEA",$J),IBNARR399
  1. Q
  1. ;
  1. DATA399 ;IB Status in File #399
  1. N I,IBBILLNO,IBRTYPNME,IBRTYPIEN,IBSTAT,IBBLCLS,IBRTYPNME,IBRTYPIEN
  1. N IBSTAT,IBRSLTFRM,IBCHG,IBNDU1,IBLSTUSR,IBDIV,IBND0,IBNDU,IBOEIEN
  1. K IBARR,IBERR
  1. D GETS^DIQ(399,IBN_",",".01;.02;.05;.07;.11;.13;.22;2;42*","IE","IBARR","IBERR")
  1. Q:$D(IBERR)
  1. Q:'$D(IBARR)
  1. S (IBBILLNO,IBRTYPNME,IBRTYPIEN,IBSTAT)=""
  1. S IBBILLNO=IBARR(399,IBN_",",.01,"I") ;bill no
  1. S IBBLCLS=IBARR(399,IBN_",",.05,"I") ;bill classification
  1. S IBRTYPNME=IBARR(399,IBN_",",.07,"E") ;rate type name
  1. S IBRTYPIEN=IBARR(399,IBN_",",.07,"I") ;rate type ien
  1. S IBSTAT=IBARR(399,IBN_",",.13,"E") ;bill status
  1. S IBDIV=$$DIV^IBJDF2(IBN)
  1. S IBOEIEN=$$OE(IBN,IBD)
  1. S IBLSTUSR=IBARR(399,IBN_",",2,"E") ;user entered/edited the bill
  1. F I=0,"U","U1" S @("IBND"_I)=$G(^DGCR(399,IBN,I))
  1. ;if inpatient, disregard whatever in the REVENUE CODE multiple 399,42
  1. ;as per business owner, it is a combined bill
  1. I +IBTYP399>0 D Q
  1. . S IBCNT=IBCNT+1
  1. . S IBRSLTFRM=+IBTYP399_":"_IBARR(399,IBN_",",.05,"E")
  1. . S IBCHG=$P(IBNDU1,"^",1)
  1. . S IBOEIEN=$P(^DGCR(399,IBN,0),U,8)
  1. . S @IBOTHSTAT@(399,IBD,DFN,IBCNT)=IBBLCLS_U_IBRTYPNME_U_IBN_U_IBBILLNO_U_IBRSLTFRM_U_IBCHG_U_IBSTAT_U_IBDIV_U_IBLSTUSR_U_IBOEIEN
  1. ;otherwise, the bill is outpatient and may have RX refill
  1. D RCODE399
  1. K IBARR,IBERR
  1. Q
  1. ;
  1. OE(IBN,EVNTDT) ;extract the Outpatient Encounter ien in file #409.68
  1. ;Note: A single EVENT DATE can have one or more procedure charges but belongs to only ONE IEN in file #409.68
  1. ;If TMPOEIEN remains equal to 0, that means the outpatient charges is not related to any outpatient encounter in file #409.68
  1. N PRD399,PRDCNTR,TMPOEIEN
  1. S TMPOEIEN=0
  1. I $D(^DGCR(399,"ASD",-EVNTDT)) D
  1. . S PRD399="" F S PRD399=$O(^DGCR(399,"ASD",-EVNTDT,PRD399)) Q:PRD399=""!(TMPOEIEN>0) D
  1. . . S PRDCNTR="" F S PRDCNTR=$O(^DGCR(399,"ASD",-EVNTDT,PRD399,IBN,PRDCNTR)) Q:PRDCNTR=""!(TMPOEIEN>0) D
  1. . . . S TMPOEIEN=$P(^DGCR(399,IBN,"CP",PRDCNTR,0),U,20) ; extract the IEN for FILE #409.68
  1. Q TMPOEIEN
  1. ;
  1. RCODE399 ;traverse the RC multiple to determine charges for this event date
  1. N IBRVCD,IBRCCNT,IBCHG,IBBEDSEC,IBAIEN,IBRSLTFRM,IBRCTYP,RXSTATUS,IBARELDT,IBARXNUM,IBARFLDT
  1. N IBARFNUM,IBARXIEN,RXRCCNT,OLDBD,TYP399,RCCHRG
  1. S (RXRCCNT,OLDBD)=0
  1. S IBRVCD=0 F S IBRVCD=$O(^DGCR(399,IBN,"RC","B",IBRVCD)) Q:'IBRVCD D
  1. . S IBRCCNT=0 F S IBRCCNT=$O(^DGCR(399,IBN,"RC","B",IBRVCD,IBRCCNT)) Q:'IBRCCNT D
  1. . . ;check if this is the charge we are looking for this bill
  1. . . S IBCHG=$P(^DGCR(399,IBN,"RC",IBRCCNT,0),U,4) ;total charge for this RC 399.042,.04
  1. . . S IBRCTYP=$P(^DGCR(399,IBN,"RC",IBRCCNT,0),U,10) ;type 399.042, .1 (this could be opt,inpt, etc.)
  1. . . S IBBEDSEC=$P(^DGCR(399,IBN,"RC",IBRCCNT,0),U,5) ;bedsection 399.042,.05
  1. . . S IBBEDSEC=$$GET1^DIQ(399.1,IBBEDSEC_",",.01,"E")
  1. . . I IBBEDSEC["PRESCRIPTION" D Q
  1. . . . Q:RXRCCNT
  1. . . . D IBARX362 S RXRCCNT=1 ;process all RX at once
  1. . . ;otherwise, extract the NON-PRESCRIPTION data
  1. . . ;group together ALL NON-PRESCRIPTION charges regardless of TYPE and BEDSECTION into an array
  1. . . I OLDBD'=IBBEDSEC S RCCHRG=0
  1. . . S RCCHRG=$G(RCCHRG)+IBCHG
  1. . . S OLDBD=IBBEDSEC
  1. . I IBBEDSEC'["PRESCRIPTION" D
  1. . . S IBRSLTFRM=$S(IBBEDSEC'["PRESCRIPTION":2,1:IBRCTYP)_":"_IBBEDSEC_":"_+IBTYP399
  1. . . S TYP399("NONRX")=IBRSLTFRM_U_RCCHRG
  1. I $D(TYP399) D
  1. . Q:$P($P(TYP399("NONRX"),U),":",2)["PRESCRIPTION"
  1. . S IBCNT=IBCNT+1
  1. . S IBRSLTFRM=$P(TYP399("NONRX"),U)
  1. . S IBCHG=$P(TYP399("NONRX"),U,2)
  1. . S @IBOTHSTAT@(399,IBD\1,DFN,IBCNT)=IBBLCLS_U_IBRTYPNME_U_IBN_U_IBBILLNO_U_IBRSLTFRM_U_IBCHG_U_IBSTAT_U_IBDIV_U_IBLSTUSR_U_IBOEIEN
  1. ;some of the RX is not captured in file #399 however it is captured in file#362.4,extract this information as well
  1. I RXRF399=3,'RXRCCNT D
  1. . S IBCHG=0,IBBEDSEC="PRESCRIPTION"
  1. . D IBARX362 S RXRCCNT=1
  1. ;some bill number does not have RC record
  1. I '$D(^DGCR(399,IBN,"RC","B")) D
  1. . F I=0,"U","U1" S @("IBND"_I)=$G(^DGCR(399,IBN,I))
  1. . S IBCNT=IBCNT+1,IBCHG=+$P(IBNDU1,"^",1)
  1. . S IBRSLTFRM=$S(IBBLCLS=3:2,IBBLCLS=4:2,1:+IBTYP399)_":"_IBARR(399,IBN_",",.05,"E")
  1. . S @IBOTHSTAT@(399,IBD\1,DFN,IBCNT)=IBBLCLS_U_IBRTYPNME_U_IBN_U_IBBILLNO_U_IBRSLTFRM_U_IBCHG_U_IBSTAT_U_IBDIV_U_IBLSTUSR_U_IBOEIEN
  1. K TYP399
  1. Q
  1. ;
  1. IBARX362 ;determine what Rx is charged for
  1. N FLDT52,IBARXSUPLY,IBRXPRTLTOT,JJJ,PSO52DYSUP,PRTLRFNUM
  1. S IBARXNUM="" F S IBARXNUM=$O(^IBA(362.4,"AIFN"_IBN,IBARXNUM)) Q:IBARXNUM="" D
  1. . S IBAIEN="" F S IBAIEN=$O(^IBA(362.4,"AIFN"_IBN,IBARXNUM,IBAIEN)) Q:IBAIEN="" D
  1. . . S IBARFLDT=$P(^IBA(362.4,IBAIEN,0),U,3) ;this is the released date, a charge is created when rx is released
  1. . . S IBARFNUM=$P(^IBA(362.4,IBAIEN,0),U,10) ;fill number
  1. . . S IBARXIEN=$P(^IBA(362.4,IBAIEN,0),U,5) ;rxien in file #52
  1. . . S IBARXSUPLY=$P(^IBA(362.4,IBAIEN,0),U,6) ;rx days supply
  1. . . S (IBARELDT,FLDT52,IBRXPRTLTOT,PSO52DYSUP,PRTLRFNUM)=0
  1. . . K ^TMP($J,"IBRX339") D RX^PSO52API(DFN,"IBRX339",,IBARXNUM,"2,R,P",IBABEG,$$FMADD^XLFDT(IBAEND,366))
  1. . . I +^TMP($J,"IBRX339",DFN,0)<1 D RXPSO52 ;invoking this API twice since this API sometimes work, sometimes doesn't.
  1. . . I +^TMP($J,"IBRX339",DFN,0)<1,+IBARXIEN>0 D
  1. . . . K ^TMP($J,"IBRX339") D RX^PSO52API(DFN,"IBRX339",IBARXIEN,,"2,R,P",IBABEG,$$FMADD^XLFDT(IBAEND,366))
  1. . . . I +^TMP($J,"IBRX339",DFN,0)<1 D RXPSO52
  1. . . I +^TMP($J,"IBRX339",DFN,0)>0 D
  1. . . . I +IBARXIEN<1 S IBARXIEN=$O(^TMP($J,"IBRX339","B",IBARXNUM,""))
  1. . . . S RXSTATUS=$P(^TMP($J,"IBRX339",DFN,IBARXIEN,100),U) ;the current status of the RX
  1. . . . I IBARFNUM="" D Q ;check if this CHARGE is for original or partial fill
  1. . . . . D RXORGNAL
  1. . . . . I +^TMP($J,"IBRX339",DFN,IBARXIEN,"P",0)>0 D ;check if there are any Rx partial fill for the same date OR if the rx charge is for Partial fill
  1. . . . . S IBRXPRTLTOT=+^TMP($J,"IBRX339",DFN,IBARXIEN,"P",0)
  1. . . . . F JJJ=1:1:IBRXPRTLTOT D
  1. . . . . . S FLDT52=$P(^TMP($J,"IBRX339",DFN,IBARXIEN,"P",JJJ,.01),U) ;rx partill fill date
  1. . . . . . S IBARELDT=$P(^TMP($J,"IBRX339",DFN,IBARXIEN,"P",JJJ,8),U) ;rx partial released date
  1. . . . . . S PSO52DYSUP=$P(^TMP($J,"IBRX339",DFN,IBARXIEN,"P",JJJ,.041),U) ;file #52 days supply
  1. . . . . . I (+IBARFLDT\1)=(+IBARELDT\1)!((+IBARFLDT\1)=+FLDT52\1) D
  1. . . . . . . I IBARXSUPLY=PSO52DYSUP,$$CHKDATE(+IBARELDT\1) D
  1. . . . . . . . S PRTLRFNUM=JJJ_"P" ;concatenating "P" with the partial fill number in order to distinguished from original, refill and partial fill
  1. . . . . . . . D IBARXREC
  1. . . . I IBARFNUM=0 D RXORGNAL ;this charge is for the rx original fill
  1. . . . I +IBARFNUM>0,+$P(^TMP($J,"IBRX339",DFN,IBARXIEN,"RF",0),U)>0 D ;this charge if for rx refill
  1. . . . . S FLDT52=$P(^TMP($J,"IBRX339",DFN,IBARXIEN,"RF",IBARFNUM,.01),U) ;rx refill fill date
  1. . . . . S IBARELDT=$P(^TMP($J,"IBRX339",DFN,IBARXIEN,"RF",IBARFNUM,17),U) ;rx refill released date
  1. . . . . I (+IBARFLDT\1)=(+IBARELDT\1),$$CHKDATE(+IBARELDT\1) D IBARXREC
  1. . . E I +IBARFLDT,'+FLDT52 D ;this is where the RX # is in text format and does not exist in file #52. Rx status will not be checked since we will not know if it is active or not
  1. . . . Q:'$$CHKDATE(+IBARFLDT\1) ;check if the rx fill date is within the date range
  1. . . . S IBARXSUPLY=$P(^IBA(362.4,IBAIEN,0),U,6)
  1. . . . S IBRSLTFRM=RXRF399_":"_IBBEDSEC_":"_+IBARXIEN_":"_IBARXNUM_"-"_IBARXSUPLY_":"_+IBARFNUM_":"_$S($G(RXSTATUS)'="":RXSTATUS,1:"")
  1. . . . S IBCNT=IBCNT+1
  1. . . . S @IBOTHSTAT@(399,IBARFLDT\1,DFN,IBCNT)=IBBLCLS_U_IBRTYPNME_U_IBN_U_IBBILLNO_U_IBRSLTFRM_U_IBCHG_U_IBSTAT_U_IBDIV_U_IBLSTUSR
  1. . . K ^TMP($J,"IBRX339")
  1. Q
  1. ;
  1. RXPSO52 ;
  1. K ^TMP($J,"IBRX339")
  1. D RX^PSO52API(DFN,"IBRX339",,IBARXNUM,"2,R,P",IBABEG,$$FMADD^XLFDT(IBAEND,366))
  1. Q
  1. ;
  1. RXORGNAL ;
  1. S FLDT52=$P(^TMP($J,"IBRX339",DFN,IBARXIEN,22),U) ;rx original fill date
  1. S IBARELDT=$P(^TMP($J,"IBRX339",DFN,IBARXIEN,31),U) ;rx original fill released date
  1. S PSO52DYSUP=$P(^TMP($J,"IBRX339",DFN,IBARXIEN,8),U) ;file #52 days supply
  1. I (+IBARFLDT\1)=(+IBARELDT\1)!((+IBARFLDT\1)=+FLDT52\1) D
  1. . I IBARXSUPLY=PSO52DYSUP,$$CHKDATE(+IBARELDT\1) S IBARFNUM=0 D IBARXREC ;this is the original fill rx charge
  1. Q
  1. ;
  1. IBARXREC ;capture Rx data
  1. S IBRSLTFRM=RXRF399_":"_IBBEDSEC_":"_IBARXIEN_":"_IBARXNUM_":"_$S(+PRTLRFNUM>0:PRTLRFNUM,1:IBARFNUM)_":"_$S($G(RXSTATUS)'="":RXSTATUS,1:"")
  1. S IBCNT=IBCNT+1
  1. S @IBOTHSTAT@(399,IBARELDT\1,DFN,IBCNT)=IBBLCLS_U_IBRTYPNME_U_IBN_U_IBBILLNO_U_IBRSLTFRM_U_IBCHG_U_IBSTAT_U_IBDIV_U_IBLSTUSR
  1. Q
  1. ;
  1. IB350 ;extract IB status found in File #350
  1. N IBD,IBN,IBND,IBSTAT,IBATYP,IBCHG,IBRSLTFRM,IBBILLNO,BILGROUP,CNT
  1. S IBD="" F S IBD=$O(^TMP("IBECEA",$J,IBD)) Q:'IBD D
  1. . S IBN="" F S IBN=$O(^TMP("IBECEA",$J,IBD,IBN)) Q:'IBN D
  1. . . D IBSTA350
  1. Q
  1. ;
  1. IBSTA350 ;IB status found in File #350
  1. N Y,C,IBDTBILLFR,IBCPTIER,IBDIV,IBSTPCODE,IBLSTUSR,IBCDENME
  1. S IBND=^IB(IBN,0) ;Q:$P(IBND,"^",7)=""
  1. S IBCNT=IBCNT+1,Y=$P(IBND,"^",5),C=$P(^DD(350,.05,0),"^",2) D Y^DIQ S IBSTAT=Y
  1. S IBATYP=$P($G(^IBE(350.1,+$P(IBND,"^",3),0)),"^") S:$E(IBATYP,1,2)="DG" IBATYP=$E(IBATYP,4,99)
  1. S (IBSTPCODE,IBCDENME)=""
  1. ;if outpatient charge and clinic stop, extract it
  1. I $E(IBATYP,1,3)="OPT",$P(IBND,"^",20) D
  1. . S IBSTPCODE=$P($G(^IBE(352.5,+$P(IBND,"^",20),0)),"^") ;stop code number
  1. . I $D(^IBE(352.5,"B",+IBSTPCODE)) S IBCDENME=$O(^IBE(352.5,"B",+IBSTPCODE,"")),IBCDENME=$P(^IBE(352.5,IBCDENME,0),U,4)
  1. . S IBSTPCODE=IBSTPCODE_"-"_IBCDENME
  1. S IBCHG=$S(IBATYP["CANCEL":"(",1:"")_"$"_$S($P(IBND,"^",7)'="":$P(IBND,"^",7),1:0)_$S(IBATYP["CANCEL":")",1:"")
  1. S IBRSLTFRM=$P(IBND,U,4)
  1. S IBBILLNO=$P(IBND,U,11)
  1. S IBCPTIER=$P(IBND,U,22)
  1. S BILGROUP=$$GET1^DIQ(350.1,+$P(IBND,"^",3)_",",.11,"I")
  1. S IBDIV=$P(IBND,U,13)_"-"_$$GET1^DIQ(350,IBN_",",.13,"E")
  1. S IBLSTUSR=$$GET1^DIQ(350,IBN_",",13,"E")
  1. I $P(IBRSLTFRM,":")=350 D
  1. . S IBDTBILLFR=$P(IBND,U,14),IBRSLTFRM=IBRSLTFRM_";"_IBDTBILLFR_":"_IBCPTIER
  1. S @IBOTHSTAT@(350,IBD,DFN,IBCNT)=IBATYP_U_BILGROUP_U_IBN_U_IBBILLNO_U_IBRSLTFRM_U_IBCHG_U_IBSTAT_U_IBDIV_U_IBSTPCODE_U_IBLSTUSR
  1. Q
  1. ;
  1. IB399 ;collects all related bill for a patient in file #399
  1. N IBIFN,IBEVDT,IB0,IBPTF,IBADM,IBDIS,IBOPV,IBPTF1,IBXRF,IBRXN,IBRXDT,IBX
  1. S IBIFN=0 F S IBIFN=$O(^DGCR(399,"C",DFN,IBIFN)) Q:'IBIFN D
  1. . S IB0=$G(^DGCR(399,+IBIFN,0)) Q:IB0="" S IBEVDT=$P(IB0,U,3),IBPTF=$P(IB0,U,8)
  1. . ;check if the event date is within the date range (the time patient become OTH until PE has been VERIFIED to another PE)
  1. . I IBEVDT\1<IBABEG!(IBEVDT\1>IBAEND) Q
  1. . ;otherwise, find all bills with the Event Date (399,.03)
  1. . I +IBEVDT D TPEVDT^IBEFURT(DFN,IBEVDT,IBIFN)
  1. . ;find all bill with PTF number (399,.08)
  1. . ;find any bills with Outpatient Visit Dates within the date range of the admission (PTF)
  1. . ;find all bills that have one or more of the same Opt Visit Dates (399,43)
  1. . ;find any bills for inpatient admissions whose date range includes one or more of the Opt Visit Dates
  1. . ;find all bills that have one or more of the same Prescription: same Rx number and fill date (362.4,.01,.03)
  1. . D IT^IBEFUR
  1. Q
  1. ;
  1. CHKDATE(DATE) ;
  1. ;check if dates fall within the Begin and End dates
  1. Q (IBABEG<=DATE)&(IBAEND>=DATE)
  1. ;