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

IBCC1.m

Go to the documentation of this file.
  1. IBCC1 ;ALB/MJB - CANCEL THIRD PARTY BILL ;10-OCT-94
  1. ;;2.0;INTEGRATED BILLING;**19,95,160,159,320,347,377,399,452,458**;21-MAR-94;Build 4
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. RNB ; -- Add a reason not billable to claims tracking
  1. N X,Y,DIC,DIE,I,J,DA,DR,IBTYP,IBTRE,IB,IBAPPT,IBDT,IBTALK,IBCODE,IBTRED,IBTSAV,FILL,IBRX,IBDATA,IBD,IBDT,IBQUIT,IBPRO,IBDD
  1. N ZT,TCNT,CNT
  1. Q:'$G(IBIFN)
  1. S IB(0)=$G(^DGCR(399,IBIFN,0)),IBTYP=$P(IB(0),"^",5),IBQUIT=0
  1. I '$D(DFN) S DFN=$P(IB(0),"^",2)
  1. KILL ^TMP($J,"IBCC1")
  1. ;
  1. ; -- is inpt find entry in dgpm, then in ibt(356, s da=ibtre then edit
  1. INPT I IBTYP<3 D
  1. .S DATE=$P(IB(0),"^",3),DFN=$P(IB(0),"^",2)
  1. .S DGPM=$O(^DGPM("APTT1",DFN,DATE,0)) ; double check for asih
  1. .I DGPM S (IBTRE,IBTSAV)=$O(^IBT(356,"AD",DGPM,0))
  1. .I $G(IBTRE) D CTSET(IBTRE)
  1. .Q:IBQUIT
  1. .;
  1. .; -- alternate inpt method
  1. .S IBCODE=$O(^IBE(356.6,"ACODE",1,0))
  1. .S DATE=$P(IB(0),"^",3),DFN=$P(IB(0),"^",2)
  1. .S IBDT=(DATE-.25) F S IBDT=$O(^IBT(356,"APTY",DFN,IBCODE,IBDT)) Q:'IBDT!(IBDT>(DATE+.24)) D
  1. ..S IBTRE=0 F S IBTRE=$O(^IBT(356,"APTY",DFN,IBCODE,IBDT,IBTRE)) Q:IBTRE=""!(IBQUIT) D:$G(IBTSAV)'=IBTRE CTSET(IBTRE)
  1. .Q
  1. ;
  1. OPT ; -- is opt-find entries in IBT(356, for opt dates and then edit
  1. I IBTYP>2 S IBCODE=$O(^IBE(356.6,"ACODE",2,0)) D
  1. .S IBAPPT=0 F S IBAPPT=$O(^DGCR(399,IBIFN,"OP",IBAPPT)) Q:'IBAPPT!(IBQUIT) D
  1. ..S IBDT=(IBAPPT-.01) F S IBDT=$O(^IBT(356,"APTY",DFN,IBCODE,IBDT)) Q:'IBDT!(IBDT>(IBAPPT+.24)) D
  1. ...S IBTRE=0 F S IBTRE=$O(^IBT(356,"APTY",DFN,IBCODE,IBDT,IBTRE)) Q:IBTRE=""!(IBQUIT) D CTSET(IBTRE)
  1. .Q
  1. ;
  1. RX ; -- find rx's on bill
  1. S IBDD=0 F S IBDD=$O(^IBA(362.4,"AIFN"_IBIFN,IBDD)) Q:'IBDD S IBD=0 F S IBD=$O(^IBA(362.4,"AIFN"_IBIFN,IBDD,IBD)) Q:'IBD!(IBQUIT) D
  1. .S IBDATA=$G(^IBA(362.4,IBD,0)),IBRX=$P(IBDATA,"^",5),IBDT=$P(IBDATA,"^",3)
  1. .I '$G(IBRX) S DIC=52,DIC(0)="BO",X=$P(IBDATA,"^",1) D DIC^PSODI(52,.DIC,X) S IBRX=+Y K DIC,X,Y Q:IBRX=-1
  1. .S FILL="" F S FILL=$O(^IBT(356,"ARXFL",IBRX,FILL)) Q:FILL=""!(IBQUIT) D
  1. ..S IBTRE=0 F S IBTRE=$O(^IBT(356,"ARXFL",IBRX,FILL,IBTRE)) Q:'IBTRE!(IBQUIT) I $P(^IBT(356,+IBTRE,0),"^",6)=IBDT D CTSET(IBTRE)
  1. ;
  1. PRO ; -- find prosthetics on bill
  1. S IBDD=0 F S IBDD=$O(^IBA(362.5,"AIFN"_IBIFN,IBDD)) Q:'IBDD S IBD=0 F S IBD=$O(^IBA(362.5,"AIFN"_IBIFN,IBDD,IBD)) Q:'IBD!(IBQUIT) D
  1. .S IBDATA=$G(^IBA(362.5,IBD,0)),IBPRO=$P(IBDATA,"^",4)
  1. .Q:'$G(IBPRO)
  1. .S IBTRE=0 F S IBTRE=$O(^IBT(356,"APRO",+IBPRO,IBTRE)) Q:'IBTRE!(IBQUIT) D CTSET(IBTRE)
  1. ;
  1. ; ----- Finished with the gathering of the CT data entries -----
  1. ;
  1. ; count up the total number of CT entries recorded in the scratch global
  1. S ZT="",TCNT=0
  1. F S ZT=$O(^TMP($J,"IBCC1",ZT)) Q:ZT="" S IBTRE=0 F S IBTRE=$O(^TMP($J,"IBCC1",ZT,IBTRE)) Q:'IBTRE S TCNT=TCNT+1
  1. ;
  1. ; loop thru all of the associated CT entries and call the RNBEDIT procedure for each one
  1. S ZT="",CNT=0 I $D(IBNOCANC) S IBNOCANC=TCNT
  1. F S ZT=$O(^TMP($J,"IBCC1",ZT)) Q:ZT=""!IBQUIT D Q:IBQUIT
  1. . S IBTRE=0 F S IBTRE=$O(^TMP($J,"IBCC1",ZT,IBTRE)) Q:'IBTRE!IBQUIT S CNT=CNT+1 D RNBEDIT(IBTRE,ZT,TCNT,CNT)
  1. . Q
  1. ;
  1. ; clean-up the scratch global when completed
  1. KILL ^TMP($J,"IBCC1")
  1. Q
  1. ;
  1. CTSET(IBTRE) ; procedure to store this CT entry in the scratch global
  1. Q:'$G(IBTRE)
  1. S ^TMP($J,"IBCC1",$$TYPE(IBTRE),IBTRE)=""
  1. CTSETX ;
  1. Q
  1. ;
  1. RNBEDIT(IBTRE,CTTYPE,TCNT,CNT) ; CT entry display and capture RNB data and additional comment data
  1. Q:IBQUIT
  1. I '$D(IBTALK) D
  1. . N CTZ
  1. . I '$D(IBNOCANC) D
  1. .. W !!,"Since you have canceled this bill, you may enter a Reason Not Billable and"
  1. .. W !,"an Additional Comment into Claims Tracking."
  1. .. W !,"This will take the care off of the UNBILLED lists."
  1. . I TCNT=1 S CTZ="Note: There is 1 associated Claims Tracking entry."
  1. . E S CTZ="Note: There are "_TCNT_" associated Claims Tracking entries."
  1. . W !!,CTZ
  1. . Q
  1. ;
  1. S IBTALK=1
  1. ;
  1. N %,IBTRED,IBTRED1
  1. ;
  1. S IBTRED=$G(^IBT(356,IBTRE,0))
  1. S IBTRED1=$G(^IBT(356,IBTRE,1))
  1. ;
  1. W !!,"Claims Tracking Entry [",CNT," of ",TCNT,"]"
  1. W !?7,"Entry ID#: ",+IBTRED
  1. W !?12,"Type: ",$$EXPAND^IBTRE(356,.18,$P(IBTRED,U,18))
  1. ;
  1. I CTTYPE=1 D ; inpatient admission or scheduled admission
  1. . W !?2,"Admission Date: ",$$FMTE^XLFDT($P(IBTRED,U,6),"1P")
  1. . Q
  1. ;
  1. I CTTYPE=2 D ; outpatient visit
  1. . N IBOE,IBOE0
  1. . W !?6,"Visit Date: ",$$FMTE^XLFDT($P(IBTRED,U,6),"1P")
  1. . S IBOE=+$P(IBTRED,U,4),IBOE0=$$SCE^IBSDU(IBOE)
  1. . W !?10,"Clinic: ",$$GET1^DIQ(44,+$P(IBOE0,U,4)_",",.01)
  1. . Q
  1. ;
  1. I CTTYPE=3 D ; prescription refill
  1. . N PSONTALK,PSOTMP,X,IBECME
  1. . S PSONTALK=1
  1. . S X=+$P(IBTRED,U,8)_U_+$P(IBTRED,U,10) D EN^PSOCPVW
  1. . ;if refill was deleted and EN^PSOCPVW doesn't return any data use IB API
  1. . I '$D(PSOTMP) D PSOCPVW^IBNCPDPC(+$P(IBTRED,U,2),+$P(IBTRED,U,8),.PSOTMP)
  1. . S IBECME=$P($$CLAIM^BPSBUTL(+$P(IBTRED,U,8),+$P(IBTRED,U,10)),U,6) ; ecme# DBIA 4719
  1. . W !?3,"Prescription#: ",$G(PSOTMP(52,+$P(IBTRED,U,8),.01,"E"))
  1. . I IBECME W !?11,"ECME#: ",IBECME ; IB*2*452
  1. . I '$P(IBTRED,U,10) W !?7,"Fill Date: ",$$FMTE^XLFDT($P(IBTRED,U,6),"1P")
  1. . I $P(IBTRED,U,10) W !?5,"Refill Date: ",$$FMTE^XLFDT($P(IBTRED,U,6),"1P")
  1. . W !?12,"Drug: ",$G(PSOTMP(52,+$P(IBTRED,U,8),6,"E"))
  1. . Q
  1. ;
  1. I CTTYPE=4 D ; prosthetic item
  1. . N IBDA,IBRMPR
  1. . S IBDA=$P(IBTRED,U,9)
  1. . D PRODATA^IBTUTL1(IBDA)
  1. . W !?3,"Delivery Date: ",$$FMTE^XLFDT($P(IBTRED,U,6),"1P")
  1. . W !?12,"Item: ",$G(IBRMPR(660,+IBDA,4,"E"))
  1. . W !?5,"Description: ",$G(IBRMPR(660,+IBDA,24,"E"))
  1. . Q
  1. ;
  1. I $G(IBMCSRNB)'="",$P(IBTRED,U,19) W !," Note: A Reason Not Billable has been previously entered",!?8,"for this Claims Tracking record."
  1. I $G(IBMCSCAC)'="",$P(IBTRED1,U,8)'="" W !," Note: An Additional Comment has been previously entered",!?8,"for this Claims Tracking record."
  1. ;
  1. S DA=IBTRE,DIE="^IBT(356,",DR=".19"
  1. I $G(IBMCSRNB)'="" S DR=".19//"_$P(IBMCSRNB,U,2) ; IB*320 MCS cancel - reason not billable
  1. I $G(IBMCSCAC)'="" S DR=DR_";1.08//^S X=IBMCSCAC" ; IB*377 MCS cancel - additional comment
  1. I $G(IBMCSCAC)="" S DR=DR_";1.08" ; IB*377 additional comment field SRS 3.3.2.1
  1. D ^DIE
  1. ;
  1. ; - if the RNB or additional comment changed, update the user and date/time last edited
  1. I $P(IBTRED,U,19)'=$P($G(^IBT(356,IBTRE,0)),U,19)!($P(IBTRED1,U,8)'=$P($G(^IBT(356,IBTRE,1)),U,8)) D NOW^%DTC S DR="1.03///"_%_";1.04////"_DUZ D ^DIE
  1. ;
  1. ; $D(Y) indicates an up-arrow exit from the DIE call (??)
  1. I $D(Y) S DFN=+$P(^IBT(356,IBTRE,0),"^",2) D FIND^IBOHCT(DFN,IBTRE) S IBQUIT=1
  1. ;
  1. D RNBC(IBTRE)
  1. Q
  1. ;
  1. TYPE(Z) ; function to get the type of claims tracking entry
  1. ; Z is the ien to file 356
  1. Q +$P($G(^IBE(356.6,+$P($G(^IBT(356,+Z,0)),U,18),0)),U,3)
  1. ;
  1. ;
  1. RNBC(IBTRN) ; check comments (#356,1.08), certain RNBs have certain Additional Comments requirements
  1. N IBRNB,IBCOMM,DR,DA,DIE,DIC,DIR,D0,X,Y,DIRUT,DUOUT Q:'$G(IBTRN)
  1. S IBRNB=+$P($G(^IBT(356,+IBTRN,0)),U,19),IBRNB=$P($G(^IBE(356.8,+IBRNB,0)),U,1) Q:IBRNB=""
  1. S IBCOMM=$P($G(^IBT(356,+IBTRN,1)),U,8)
  1. ;
  1. I IBRNB="OTHER",$L(IBCOMM)<15 D ; Require Additional Comments at least 15 characters
  1. . W !!,"The RNB of OTHER requires a Comment of at least 15 characters",!
  1. . S DR="S Y=""@6"";.19;I X'=999 S Y=0;@6;1.08;I $L(X)<15 W !,""Length of 15 characters required"" S Y=""@6"""
  1. . S DA=IBTRN,DIE="^IBT(356," D ^DIE I $G(IBMCSCAC)'="" S IBMCSCAC=$P($G(^IBT(356,IBTRN,1)),U,8)
  1. ;
  1. I IBRNB="GLOBAL SURGERY",IBCOMM'["Global Surgery: " D ; Add Global Surgery Date to Additional Comments
  1. . W !!,"For the RNB of GLOBAL SURGERY, add the related Surgery Date to the CT comments:",!,IBCOMM,!
  1. . S DIR(0)="DAO",DIR("A")="Enter Surgery Date: " D ^DIR Q:Y'?7N W !
  1. . S IBCOMM="Global Surgery: "_$$FMTE^XLFDT(Y,2)_" "_IBCOMM,IBCOMM=$E(IBCOMM,1,80)
  1. . S DA=IBTRN,DIE="^IBT(356,",DR="1.08///^S X=IBCOMM" D ^DIE S DR="S Y=""@6"";.19;@6;1.08" D ^DIE
  1. Q