IBJTBA ;ALB/ARH - TPI BILL CHARGE INFO SCREEN ;01-MAR-1995
;;2.0;INTEGRATED BILLING;**39,80,51,137,135,309,349,389,592**;21-MAR-94;Build 58
;;Per VA Directive 6402, this routine should not be modified.
;
EN ; -- main entry point for IBJ TP BILL CHARGES
D EN^VALM("IBJT BILL CHARGES")
Q
;
HDR ; -- header code
D HDR^IBJTU1(+IBIFN,+DFN,12)
Q
;
INIT ; -- init variables and list array
N IBOK,IBEOBDET
K ^TMP("IBJTBA",$J) N IBFT
I '$G(DFN)!'$G(IBIFN) S VALMQUIT="" G INITQ
S IBFT=+$P($G(^DGCR(399,+IBIFN,0)),U,19),IBOK=1
I $D(^IBM(361.1,"B",IBIFN))!$D(^IBM(361.1,"C",IBIFN)) D G:'IBOK INITQ
. S DIR("A")="DO YOU WANT ALL EEOB DETAILS?: ",DIR("B")="NO",DIR(0)="YA"
. D FULL^VALM1 W ! D ^DIR K DIR
. I $D(DTOUT)!$D(DUOUT) S IBOK=0 Q
. S IBEOBDET=+Y
D BLD
INITQ Q
;
MRA ; -- mra/eob
N IBI,Z,IBSTR,IBSHEOB,IBCT
S IBCT=0
S IBI=0 F S IBI=$O(^IBM(361.1,"B",IBIFN,IBI)) Q:'IBI S Z=+$O(^IBM(361.1,IBI,8,0)) I '$O(^(Z)) S IBCT=IBCT+1,IBSHEOB(IBI)=0 ; Entire EOB belongs to the bill
S IBI=0 F S IBI=$O(^IBM(361.1,"C",IBIFN,IBI)) Q:'IBI S IBCT=IBCT+1,IBSHEOB(IBI)=1 ; EOB has been reapportioned at the site
I 'IBCT D
. S IBSTR=$$SETLN("No EEOB/MRA Information","",1,79)
. S IBLN=$$SET(IBSTR,IBLN)
I IBCT D
. S Z=0
. S IBI=0 F S IBI=$O(IBSHEOB(IBI)) Q:'IBI S Z=Z+1 D SHEOB^IBJTBA1(IBI,+IBSHEOB(IBI),Z,IBCT)
;
Q
;
HELP ; -- help code
S X="?" D DISP^XQORM1 W !!
Q
;
EXIT ; -- exit code
K ^TMP("IBJTBA",$J)
D CLEAR^VALM1
Q
;
BLD ; charges, as they would display on the bill
N IBXDATA,IBXSAVE
;JWS:IB*2.0*592:Dental form#7 as professional
;IA# 3820
I $P($G(^DGCR(399,+IBIFN,0)),U,19)=2!($P($G(^(0)),U,19)=7) D H1500 Q
D UB04
K ^TMP("IBXSAVE",$J)
Q
;
H1500 ; block 24
N X,IBI,IBJ,IBLN,IBX,IBSTR,IBLKLN,IBPFORM,IBLIN
K ^TMP("IBXSAVE",$J)
S IBLIN=$$BOX24D^IBCEF11("",1),IBLKLN=0,IBLN=1
Q:'$G(IBIFN) K ^TMP("IBXDISP",$J)
S IBPFORM=$S($P($G(^IBE(353,2,2)),U,8):$P(^(2),U,8),1:2),IBLN=1
S IBX=$$BILLN^IBCEFG0(1,"1^99",IBLIN,+IBIFN,IBPFORM)
S IBI=$O(^TMP("IBXDISP",$J,""),-1)
S IBJ="" F S IBJ=$O(^TMP("IBXDISP",$J,IBI,IBJ),-1) Q:$S('IBJ:1,1:$TR($G(^(IBJ))," ")'="") K ^TMP("IBXDISP",$J,IBI,IBJ)
I '$O(^TMP("IBXDISP",$J,IBI,0)) S VALMSG="No charges or procedures defined.",VALMQUIT="" G H1500Q
S IBI="" F S IBI=$O(^TMP("IBXDISP",$J,IBI)) Q:'IBI S IBJ=0 F S IBJ=$O(^TMP("IBXDISP",$J,IBI,IBJ)) Q:'IBJ D
. S IBX=$G(^TMP("IBXDISP",$J,IBI,IBJ)),IBLN=$$SET(IBX,IBLN)
K ^TMP("IBXDISP",$J)
D COB,MRA
I $$ISRX^IBCEF1(IBIFN) D RX
I $$ISPROS^IBCEF1(IBIFN) D PROS
S VALMCNT=IBLN-1
H1500Q Q
;
UB04 ;form locator 42-49, IBIFN required
N X,Y,DIR,IBI,IBJ,IBX,IBLN,IBLC,IBLIN,IBPFORM,IBSTATE,IBCBILL,IBINPAT,IBQ,Z,Z0
K ^TMP("IBXSAVE",$J)
S IBLIN=$$RCBOX^IBCEF11()
S IBQ=0,IBLC=9 Q:'$G(IBIFN) K ^TMP("IBXDISP",$J)
S IBPFORM=$S($P($G(^IBE(353,3,2)),U,8):$P(^(2),U,8),1:3)
S IBX=$$BILLN^IBCEFG0(1,"1^99",IBLIN,+IBIFN,IBPFORM)
I '$O(^TMP("IBXDISP",$J,0)) S VALMSG="No charges defined.",VALMQUIT="" G UB04Q
S Z="" F S Z=$O(^TMP("IBXDISP",$J,1,Z),-1) Q:Z="" S Z0=$G(^(Z)) Q:$TR(Z0," ")'="" K ^(Z)
S:Z ^TMP("IBXDISP",$J,1,Z+1)=" "
S IBINPAT=$$INPAT^IBCEF(IBIFN,1)
S IBSTATE=$G(^DGCR(399,IBIFN,"U")),IBCBILL=$G(^DGCR(399,IBIFN,0))
;
S (VALMCNT,IBLN)=1,IBLKLN=0
I +IBINPAT D S IBLN=$$SET(IBSTR,IBLN)
. S IBX=$P(IBSTATE,U,15),IBSTR=+IBX_" DAY"_$S(IBX'=1:"S",1:"")_" INPATIENT CARE"
. S IBX=$$LOS^IBCU64(+IBSTATE,+$P(IBSTATE,U,2),+$P(IBCBILL,U,6)),IBX=IBX-$$LOS1^IBCU64(IBIFN) I IBX>0 S IBSTR=IBSTR_$J("Pass Days: "_IBX,55)
;
S IBI="" F S IBI=$O(^TMP("IBXDISP",$J,IBI)) Q:'IBI S IBJ=0 F S IBJ=$O(^TMP("IBXDISP",$J,IBI,IBJ)) Q:'IBJ D
. S IBX=$G(^TMP("IBXDISP",$J,IBI,IBJ)),IBLN=$$SET(IBX,IBLN)
. I $E(IBX,1,3)="001" D COB
;
K ^TMP("IBXDISP",$J)
;
D MRA
S VALMCNT=IBLN-1
UB04Q Q
;
SETLN(STR,IBX,COL,WD) ;
S IBX=$$SETSTR^VALM1(STR,IBX,COL,WD)
Q IBX
;
SET(STR,LN) ; set up TMP array with screen data (allows 2 blank lines, if not at end of array)
N IBX,IBI I STR?80" " S IBLKLN=IBLKLN+1 G SETQ
F IBI=1:1:IBLKLN D SET^VALM10(LN," ") S LN=LN+1 Q:IBI>1
D SET^VALM10(LN,STR)
S LN=LN+1,IBLKLN=0
SETQ Q LN
;
COB ; if there is an offset or a secondary/tertiary payer add it to the display, with ins co, and prior bill #
; IBIFN and IBLN must exist upon entry, IBLN is updated with new line count
N IBM,IBM1,IBI,IBJ,IBD,IBSTR,IBCU2,IBCU1 Q:'$G(IBIFN)
S IBM=$G(^DGCR(399,IBIFN,"M")),IBM1=$G(^DGCR(399,IBIFN,"M1"))
S IBCU2=$G(^DGCR(399,IBIFN,"U2")),IBCU1=$G(^DGCR(399,IBIFN,"U1"))
S IBJ=$P($G(^DGCR(399,IBIFN,0)),U,21),IBJ=$S(IBJ="P":3,IBJ="S":3,IBJ="T":3,1:0),IBSTR=""
I +$P(IBM,U,2)!(+$P(IBM,U,3)) F IBI=1:1:IBJ I +$P(IBM,U,IBI) D S IBLN=$$SET(IBSTR,IBLN)
. I IBSTR="" S IBLN=$$SET("",IBLN)
. S IBD=$S(IBI=1:"Primary",IBI=2:"Secondary",1:"Tertiary")_": " S IBSTR=$$SETLN(IBD,"",5,11)
. S IBD=$P($G(^DIC(36,+$P(IBM,U,IBI),0)),U,1) S IBSTR=$$SETLN(IBD,IBSTR,17,25)
. I $P(IBCU2,U,(IBI+3))'="" S IBD=$J(+$P(IBCU2,U,(IBI+3)),9,2) S IBSTR=$$SETLN(IBD,IBSTR,44,11)
. I $P(IBM1,U,(IBI+4))'="" S IBD=$$BN1^PRCAFN(+$P(IBM1,U,(IBI+4))) S IBSTR=$$SETLN(IBD,IBSTR,60,11)
I +$P(IBCU1,U,2) D S IBLN=$$SET(IBSTR,IBLN)
. I IBSTR="" S IBLN=$$SET("",IBLN)
. S IBD="Offset: " S IBSTR=$$SETLN(IBD,"",5,11)
. S IBD=$P(IBCU1,U,3) S IBSTR=$$SETLN(IBD,IBSTR,17,25)
. S IBD=$J($P(IBCU1,U,2),9,2) S IBSTR=$$SETLN(IBD,IBSTR,44,11)
. S IBD=$P(IBCU1,U,1)-$P(IBCU1,U,2),IBD="Billed: "_$J(IBD,0,2) S IBSTR=$$SETLN(IBD,IBSTR,60,17)
Q
;
RX ;RX refill info for CMS-1500 TPJI display
N Z,Z0,Z1,IBSPC,IBD,IBI,IBSTR,IBARRAY,IBRXX
S IBLN=IBLN+1
S IBSPC=$J("",5)
D SET^IBCSC5A(IBIFN,.IBARRAY)
I $D(IBARRAY) D
. S (Z,Z0)=0 F S Z0=$O(IBARRAY(Z0)) Q:Z0="" S Z1=0 F S Z1=$O(IBARRAY(Z0,Z1)) Q:'Z1 S Z=Z+1 S IBXDATA(Z)=$$DAT1^IBOUTL(Z1)_U_$G(IBARRAY(Z0,Z1))
S IBD=$$SET("",IBLN)
S IBD="PRESCRIPTION REFILLS: (For TPJI display only)"
S IBSTR=$$SETLN(IBD,"",1,79),IBLN=$$SET(IBSTR,IBLN)
S IBI=0 F S IBI=$O(IBXDATA(IBI)) Q:IBI="" D
. S IBRXX=$G(IBXDATA(IBI))
. D ZERO^IBRXUTL($P(IBRXX,U,3))
. S IBD=$J($P(IBRXX,U,7),9,2)_IBSPC_$P(IBRXX,U)_IBSPC_$G(^TMP($J,"IBDRUG",+$P(IBRXX,U,3),.01))
. K ^TMP($J,"IBDRUG")
. S IBSTR=$$SETLN(IBD,"",1,79),IBLN=$$SET(IBSTR,IBLN)
. S IBD="QTY: "_$P(IBRXX,U,5)_" for "_$P(IBRXX,U,4)_" days supply "_"NDC# "_$P(IBRXX,U,6)
. S IBSTR=$$SETLN(IBD,"",23,79),IBLN=$$SET(IBSTR,IBLN)
Q
;
PROS ;prosthetic info for CMS-1500 TPJI display
N Z,Z0,Z1,IBARRAY,IBSPC,IBD,IBI,IBSTR
S IBSPC=$J("",10),IBLN=IBLN+1
D SET^IBCSC5B(IBIFN,.IBARRAY)
I $D(IBARRAY) D
. S (Z,Z0)=0 F S Z0=$O(IBARRAY(Z0)) Q:Z0="" S Z1=0 F S Z1=$O(IBARRAY(Z0,Z1)) Q:'Z1 S Z=Z+1,IBXDATA(Z)=$$DAT1^IBOUTL(Z0)_U_$E($$PINB^IBCSC5B(+IBARRAY(Z0,Z1)),1,39)
S IBD=$$SET("",IBLN)
S IBD="PROSTHETIC REFILLS: (For TPJI display only)"
S IBSTR=$$SETLN(IBD,"",1,79),IBLN=$$SET(IBSTR,IBLN)
S IBI=0 F S IBI=$O(IBXDATA(IBI)) Q:IBI="" D
. S IBD=$P(IBXDATA(IBI),U)_IBSPC_$P(IBXDATA(IBI),U,2)
. S IBSTR=$$SETLN(IBD,"",1,79),IBLN=$$SET(IBSTR,IBLN)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBJTBA 7059 printed Oct 16, 2024@18:24:24 Page 2
IBJTBA ;ALB/ARH - TPI BILL CHARGE INFO SCREEN ;01-MAR-1995
+1 ;;2.0;INTEGRATED BILLING;**39,80,51,137,135,309,349,389,592**;21-MAR-94;Build 58
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
EN ; -- main entry point for IBJ TP BILL CHARGES
+1 DO EN^VALM("IBJT BILL CHARGES")
+2 QUIT
+3 ;
HDR ; -- header code
+1 DO HDR^IBJTU1(+IBIFN,+DFN,12)
+2 QUIT
+3 ;
INIT ; -- init variables and list array
+1 NEW IBOK,IBEOBDET
+2 KILL ^TMP("IBJTBA",$JOB)
NEW IBFT
+3 IF '$GET(DFN)!'$GET(IBIFN)
SET VALMQUIT=""
GOTO INITQ
+4 SET IBFT=+$PIECE($GET(^DGCR(399,+IBIFN,0)),U,19)
SET IBOK=1
+5 IF $DATA(^IBM(361.1,"B",IBIFN))!$DATA(^IBM(361.1,"C",IBIFN))
Begin DoDot:1
+6 SET DIR("A")="DO YOU WANT ALL EEOB DETAILS?: "
SET DIR("B")="NO"
SET DIR(0)="YA"
+7 DO FULL^VALM1
WRITE !
DO ^DIR
KILL DIR
+8 IF $DATA(DTOUT)!$DATA(DUOUT)
SET IBOK=0
QUIT
+9 SET IBEOBDET=+Y
End DoDot:1
if 'IBOK
GOTO INITQ
+10 DO BLD
INITQ QUIT
+1 ;
MRA ; -- mra/eob
+1 NEW IBI,Z,IBSTR,IBSHEOB,IBCT
+2 SET IBCT=0
+3 ; Entire EOB belongs to the bill
SET IBI=0
FOR
SET IBI=$ORDER(^IBM(361.1,"B",IBIFN,IBI))
if 'IBI
QUIT
SET Z=+$ORDER(^IBM(361.1,IBI,8,0))
IF '$ORDER(^(Z))
SET IBCT=IBCT+1
SET IBSHEOB(IBI)=0
+4 ; EOB has been reapportioned at the site
SET IBI=0
FOR
SET IBI=$ORDER(^IBM(361.1,"C",IBIFN,IBI))
if 'IBI
QUIT
SET IBCT=IBCT+1
SET IBSHEOB(IBI)=1
+5 IF 'IBCT
Begin DoDot:1
+6 SET IBSTR=$$SETLN("No EEOB/MRA Information","",1,79)
+7 SET IBLN=$$SET(IBSTR,IBLN)
End DoDot:1
+8 IF IBCT
Begin DoDot:1
+9 SET Z=0
+10 SET IBI=0
FOR
SET IBI=$ORDER(IBSHEOB(IBI))
if 'IBI
QUIT
SET Z=Z+1
DO SHEOB^IBJTBA1(IBI,+IBSHEOB(IBI),Z,IBCT)
End DoDot:1
+11 ;
+12 QUIT
+13 ;
HELP ; -- help code
+1 SET X="?"
DO DISP^XQORM1
WRITE !!
+2 QUIT
+3 ;
EXIT ; -- exit code
+1 KILL ^TMP("IBJTBA",$JOB)
+2 DO CLEAR^VALM1
+3 QUIT
+4 ;
BLD ; charges, as they would display on the bill
+1 NEW IBXDATA,IBXSAVE
+2 ;JWS:IB*2.0*592:Dental form#7 as professional
+3 ;IA# 3820
+4 IF $PIECE($GET(^DGCR(399,+IBIFN,0)),U,19)=2!($PIECE($GET(^(0)),U,19)=7)
DO H1500
QUIT
+5 DO UB04
+6 KILL ^TMP("IBXSAVE",$JOB)
+7 QUIT
+8 ;
H1500 ; block 24
+1 NEW X,IBI,IBJ,IBLN,IBX,IBSTR,IBLKLN,IBPFORM,IBLIN
+2 KILL ^TMP("IBXSAVE",$JOB)
+3 SET IBLIN=$$BOX24D^IBCEF11("",1)
SET IBLKLN=0
SET IBLN=1
+4 if '$GET(IBIFN)
QUIT
KILL ^TMP("IBXDISP",$JOB)
+5 SET IBPFORM=$SELECT($PIECE($GET(^IBE(353,2,2)),U,8):$PIECE(^(2),U,8),1:2)
SET IBLN=1
+6 SET IBX=$$BILLN^IBCEFG0(1,"1^99",IBLIN,+IBIFN,IBPFORM)
+7 SET IBI=$ORDER(^TMP("IBXDISP",$JOB,""),-1)
+8 SET IBJ=""
FOR
SET IBJ=$ORDER(^TMP("IBXDISP",$JOB,IBI,IBJ),-1)
if $SELECT('IBJ
QUIT
KILL ^TMP("IBXDISP",$JOB,IBI,IBJ)
+9 IF '$ORDER(^TMP("IBXDISP",$JOB,IBI,0))
SET VALMSG="No charges or procedures defined."
SET VALMQUIT=""
GOTO H1500Q
+10 SET IBI=""
FOR
SET IBI=$ORDER(^TMP("IBXDISP",$JOB,IBI))
if 'IBI
QUIT
SET IBJ=0
FOR
SET IBJ=$ORDER(^TMP("IBXDISP",$JOB,IBI,IBJ))
if 'IBJ
QUIT
Begin DoDot:1
+11 SET IBX=$GET(^TMP("IBXDISP",$JOB,IBI,IBJ))
SET IBLN=$$SET(IBX,IBLN)
End DoDot:1
+12 KILL ^TMP("IBXDISP",$JOB)
+13 DO COB
DO MRA
+14 IF $$ISRX^IBCEF1(IBIFN)
DO RX
+15 IF $$ISPROS^IBCEF1(IBIFN)
DO PROS
+16 SET VALMCNT=IBLN-1
H1500Q QUIT
+1 ;
UB04 ;form locator 42-49, IBIFN required
+1 NEW X,Y,DIR,IBI,IBJ,IBX,IBLN,IBLC,IBLIN,IBPFORM,IBSTATE,IBCBILL,IBINPAT,IBQ,Z,Z0
+2 KILL ^TMP("IBXSAVE",$JOB)
+3 SET IBLIN=$$RCBOX^IBCEF11()
+4 SET IBQ=0
SET IBLC=9
if '$GET(IBIFN)
QUIT
KILL ^TMP("IBXDISP",$JOB)
+5 SET IBPFORM=$SELECT($PIECE($GET(^IBE(353,3,2)),U,8):$PIECE(^(2),U,8),1:3)
+6 SET IBX=$$BILLN^IBCEFG0(1,"1^99",IBLIN,+IBIFN,IBPFORM)
+7 IF '$ORDER(^TMP("IBXDISP",$JOB,0))
SET VALMSG="No charges defined."
SET VALMQUIT=""
GOTO UB04Q
+8 SET Z=""
FOR
SET Z=$ORDER(^TMP("IBXDISP",$JOB,1,Z),-1)
if Z=""
QUIT
SET Z0=$GET(^(Z))
if $TRANSLATE(Z0," ")'=""
QUIT
KILL ^(Z)
+9 if Z
SET ^TMP("IBXDISP",$JOB,1,Z+1)=" "
+10 SET IBINPAT=$$INPAT^IBCEF(IBIFN,1)
+11 SET IBSTATE=$GET(^DGCR(399,IBIFN,"U"))
SET IBCBILL=$GET(^DGCR(399,IBIFN,0))
+12 ;
+13 SET (VALMCNT,IBLN)=1
SET IBLKLN=0
+14 IF +IBINPAT
Begin DoDot:1
+15 SET IBX=$PIECE(IBSTATE,U,15)
SET IBSTR=+IBX_" DAY"_$SELECT(IBX'=1:"S",1:"")_" INPATIENT CARE"
+16 SET IBX=$$LOS^IBCU64(+IBSTATE,+$PIECE(IBSTATE,U,2),+$PIECE(IBCBILL,U,6))
SET IBX=IBX-$$LOS1^IBCU64(IBIFN)
IF IBX>0
SET IBSTR=IBSTR_$JUSTIFY("Pass Days: "_IBX,55)
End DoDot:1
SET IBLN=$$SET(IBSTR,IBLN)
+17 ;
+18 SET IBI=""
FOR
SET IBI=$ORDER(^TMP("IBXDISP",$JOB,IBI))
if 'IBI
QUIT
SET IBJ=0
FOR
SET IBJ=$ORDER(^TMP("IBXDISP",$JOB,IBI,IBJ))
if 'IBJ
QUIT
Begin DoDot:1
+19 SET IBX=$GET(^TMP("IBXDISP",$JOB,IBI,IBJ))
SET IBLN=$$SET(IBX,IBLN)
+20 IF $EXTRACT(IBX,1,3)="001"
DO COB
End DoDot:1
+21 ;
+22 KILL ^TMP("IBXDISP",$JOB)
+23 ;
+24 DO MRA
+25 SET VALMCNT=IBLN-1
UB04Q QUIT
+1 ;
SETLN(STR,IBX,COL,WD) ;
+1 SET IBX=$$SETSTR^VALM1(STR,IBX,COL,WD)
+2 QUIT IBX
+3 ;
SET(STR,LN) ; set up TMP array with screen data (allows 2 blank lines, if not at end of array)
+1 NEW IBX,IBI
IF STR?80" "
SET IBLKLN=IBLKLN+1
GOTO SETQ
+2 FOR IBI=1:1:IBLKLN
DO SET^VALM10(LN," ")
SET LN=LN+1
if IBI>1
QUIT
+3 DO SET^VALM10(LN,STR)
+4 SET LN=LN+1
SET IBLKLN=0
SETQ QUIT LN
+1 ;
COB ; if there is an offset or a secondary/tertiary payer add it to the display, with ins co, and prior bill #
+1 ; IBIFN and IBLN must exist upon entry, IBLN is updated with new line count
+2 NEW IBM,IBM1,IBI,IBJ,IBD,IBSTR,IBCU2,IBCU1
if '$GET(IBIFN)
QUIT
+3 SET IBM=$GET(^DGCR(399,IBIFN,"M"))
SET IBM1=$GET(^DGCR(399,IBIFN,"M1"))
+4 SET IBCU2=$GET(^DGCR(399,IBIFN,"U2"))
SET IBCU1=$GET(^DGCR(399,IBIFN,"U1"))
+5 SET IBJ=$PIECE($GET(^DGCR(399,IBIFN,0)),U,21)
SET IBJ=$SELECT(IBJ="P":3,IBJ="S":3,IBJ="T":3,1:0)
SET IBSTR=""
+6 IF +$PIECE(IBM,U,2)!(+$PIECE(IBM,U,3))
FOR IBI=1:1:IBJ
IF +$PIECE(IBM,U,IBI)
Begin DoDot:1
+7 IF IBSTR=""
SET IBLN=$$SET("",IBLN)
+8 SET IBD=$SELECT(IBI=1:"Primary",IBI=2:"Secondary",1:"Tertiary")_": "
SET IBSTR=$$SETLN(IBD,"",5,11)
+9 SET IBD=$PIECE($GET(^DIC(36,+$PIECE(IBM,U,IBI),0)),U,1)
SET IBSTR=$$SETLN(IBD,IBSTR,17,25)
+10 IF $PIECE(IBCU2,U,(IBI+3))'=""
SET IBD=$JUSTIFY(+$PIECE(IBCU2,U,(IBI+3)),9,2)
SET IBSTR=$$SETLN(IBD,IBSTR,44,11)
+11 IF $PIECE(IBM1,U,(IBI+4))'=""
SET IBD=$$BN1^PRCAFN(+$PIECE(IBM1,U,(IBI+4)))
SET IBSTR=$$SETLN(IBD,IBSTR,60,11)
End DoDot:1
SET IBLN=$$SET(IBSTR,IBLN)
+12 IF +$PIECE(IBCU1,U,2)
Begin DoDot:1
+13 IF IBSTR=""
SET IBLN=$$SET("",IBLN)
+14 SET IBD="Offset: "
SET IBSTR=$$SETLN(IBD,"",5,11)
+15 SET IBD=$PIECE(IBCU1,U,3)
SET IBSTR=$$SETLN(IBD,IBSTR,17,25)
+16 SET IBD=$JUSTIFY($PIECE(IBCU1,U,2),9,2)
SET IBSTR=$$SETLN(IBD,IBSTR,44,11)
+17 SET IBD=$PIECE(IBCU1,U,1)-$PIECE(IBCU1,U,2)
SET IBD="Billed: "_$JUSTIFY(IBD,0,2)
SET IBSTR=$$SETLN(IBD,IBSTR,60,17)
End DoDot:1
SET IBLN=$$SET(IBSTR,IBLN)
+18 QUIT
+19 ;
RX ;RX refill info for CMS-1500 TPJI display
+1 NEW Z,Z0,Z1,IBSPC,IBD,IBI,IBSTR,IBARRAY,IBRXX
+2 SET IBLN=IBLN+1
+3 SET IBSPC=$JUSTIFY("",5)
+4 DO SET^IBCSC5A(IBIFN,.IBARRAY)
+5 IF $DATA(IBARRAY)
Begin DoDot:1
+6 SET (Z,Z0)=0
FOR
SET Z0=$ORDER(IBARRAY(Z0))
if Z0=""
QUIT
SET Z1=0
FOR
SET Z1=$ORDER(IBARRAY(Z0,Z1))
if 'Z1
QUIT
SET Z=Z+1
SET IBXDATA(Z)=$$DAT1^IBOUTL(Z1)_U_$GET(IBARRAY(Z0,Z1))
End DoDot:1
+7 SET IBD=$$SET("",IBLN)
+8 SET IBD="PRESCRIPTION REFILLS: (For TPJI display only)"
+9 SET IBSTR=$$SETLN(IBD,"",1,79)
SET IBLN=$$SET(IBSTR,IBLN)
+10 SET IBI=0
FOR
SET IBI=$ORDER(IBXDATA(IBI))
if IBI=""
QUIT
Begin DoDot:1
+11 SET IBRXX=$GET(IBXDATA(IBI))
+12 DO ZERO^IBRXUTL($PIECE(IBRXX,U,3))
+13 SET IBD=$JUSTIFY($PIECE(IBRXX,U,7),9,2)_IBSPC_$PIECE(IBRXX,U)_IBSPC_$GET(^TMP($JOB,"IBDRUG",+$PIECE(IBRXX,U,3),.01))
+14 KILL ^TMP($JOB,"IBDRUG")
+15 SET IBSTR=$$SETLN(IBD,"",1,79)
SET IBLN=$$SET(IBSTR,IBLN)
+16 SET IBD="QTY: "_$PIECE(IBRXX,U,5)_" for "_$PIECE(IBRXX,U,4)_" days supply "_"NDC# "_$PIECE(IBRXX,U,6)
+17 SET IBSTR=$$SETLN(IBD,"",23,79)
SET IBLN=$$SET(IBSTR,IBLN)
End DoDot:1
+18 QUIT
+19 ;
PROS ;prosthetic info for CMS-1500 TPJI display
+1 NEW Z,Z0,Z1,IBARRAY,IBSPC,IBD,IBI,IBSTR
+2 SET IBSPC=$JUSTIFY("",10)
SET IBLN=IBLN+1
+3 DO SET^IBCSC5B(IBIFN,.IBARRAY)
+4 IF $DATA(IBARRAY)
Begin DoDot:1
+5 SET (Z,Z0)=0
FOR
SET Z0=$ORDER(IBARRAY(Z0))
if Z0=""
QUIT
SET Z1=0
FOR
SET Z1=$ORDER(IBARRAY(Z0,Z1))
if 'Z1
QUIT
SET Z=Z+1
SET IBXDATA(Z)=$$DAT1^IBOUTL(Z0)_U_$EXTRACT($$PINB^IBCSC5B(+IBARRAY(Z0,Z1)),1,39)
End DoDot:1
+6 SET IBD=$$SET("",IBLN)
+7 SET IBD="PROSTHETIC REFILLS: (For TPJI display only)"
+8 SET IBSTR=$$SETLN(IBD,"",1,79)
SET IBLN=$$SET(IBSTR,IBLN)
+9 SET IBI=0
FOR
SET IBI=$ORDER(IBXDATA(IBI))
if IBI=""
QUIT
Begin DoDot:1
+10 SET IBD=$PIECE(IBXDATA(IBI),U)_IBSPC_$PIECE(IBXDATA(IBI),U,2)
+11 SET IBSTR=$$SETLN(IBD,"",1,79)
SET IBLN=$$SET(IBSTR,IBLN)
End DoDot:1
+12 QUIT
+13 ;