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

IBOHLD2.m

Go to the documentation of this file.
IBOHLD2	;ALB/CJM  -  REPORT OR HELD CATC CHARGES ;MAR 6,1991
	;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
REPORT	;
	N IBQUIT,IBPAGE,IBNOW,IBLINE,IBCRT,IBBOT,DFN,IBNAME,IBN
	S IBCRT=0,IBBOT=6,IBQUIT=0 I $E(IOST,1,2)="C-" S IBCRT=1,IBBOT=2
	S IBLINE="",$P(IBLINE,"=",86)="||",IBLINE=IBLINE_$E(IBLINE,1,45)
	D NOW^%DTC S Y=X X ^DD("DD") S IBNOW=Y
	I IBCRT W @IOF
LOOP	;
	S IBPAGE=1 D HEADER Q:IBQUIT
	S IBNAME="" F  S IBNAME=$O(^TMP($J,"HOLD",IBNAME)) Q:IBNAME=""!(IBQUIT)  S DFN=0 F  S DFN=$O(^TMP($J,"HOLD",IBNAME,DFN)) Q:'DFN!(IBQUIT)  D PRNTPAT Q:IBQUIT  S IBN=0 F  S IBN=$O(^TMP($J,"HOLD",IBNAME,DFN,IBN)) Q:'IBN!(IBQUIT)  D
	.D PRNTCHG,PRNTBILL:'IBQUIT
	Q
PRNTBILL	; prints bills for a charge
	N IB,IB0,IBSTAT,IBCHG,IBPD,C,Y,I,IBT
	D:$Y-IBBOT+1>IOSL HEADER Q:IBQUIT
	S IB="" F I=1:1 S IB=$O(^TMP($J,"HOLD",IBNAME,DFN,IBN,IB)) W:'IB&(I<2) ?85,"||",! D:$Y+IBBOT>IOSL HEADER Q:'IB!(IBQUIT)  D
	.W ?85,"||"
	.S IB0=$G(^DGCR(399,IB,0)) Q:IB0=""
	.W ?88,$P(IB0,"^",1) ; bill #
	.S IBSTAT=$$STA^PRCAFN(IB)
	.W:+IBSTAT>0 ?97,$E($P(IBSTAT,"^",2),1,14)
	.S IBT=$J((+^DGCR(399,IB,"U1")-$P(^("U1"),"^",2)),9,2)
	.W ?112,IBT ; total charges
	.S IBPD=$$TPR^PRCAFN(IB) S:IBPD<0 IBPD="" S IBPD=$J(IBPD,9,2) W ?123,IBPD,! D:$Y+IBBOT>IOSL HEADER
	Q
PRNTPAT	; prints patient data
	N VAERR,VADM,IBSSN D DEM^VADPT S:'VAERR IBSSN=VA("BID") ; pt id,brief
	D:$Y+IBBOT>IOSL HEADER Q:IBQUIT
	W $E(IBNAME,1,20),?22,IBSSN
	Q
PRNTCHG	; prints a charge
	N IBACT,IBTYPE,IBBILL,IBFR,IBTO,IBCHG,IBND
	S IBND=$G(^IB(IBN,0))
	; action id
	S IBACT=+IBND
	; type
	S IBTYPE=$P(IBND,"^",3),IBTYPE=$E($P($G(^IBE(350.1,IBTYPE,0)),"^",1),4,7)
	; bill #
	S IBBILL=$P($P(IBND,"^",11),"-",2)
	; from date
	S IBFR=$$DAT1^IBOUTL($P(IBND,"^",14))
	; to date
	S IBTO=$$DAT1^IBOUTL($P(IBND,"^",15))
	; charge$
	S IBCHG=$J(+$P(IBND,"^",7),9,2)
	W ?29,IBACT,?39,IBTYPE,?46,IBBILL,?55,IBFR,?66,IBTO,?75,IBCHG
	Q
	Q:IBQUIT
	I IBCRT,$Y>1 D  Q:IBQUIT
	.F  Q:$Y>(IOSL-1)  W !
	.N T R "    Press RETURN to continue",T:DTIME I '$T!(T["^") S IBQUIT=1 Q
	I IBPAGE>1 W !,@IOF
	W ?53,"CATEGORY C CHARGES ON HOLD",?110,IBNOW,"  PAGE ",IBPAGE,!,"HELD CHARGES",?87,"CORRESPONDING THIRD PARTY BILLS",!,IBLINE
	W !,"Name",?22,"Pt.ID",?29,"ActionID",?39,"Type",?46,"Bill#",?55,"From",?66,"To",?78,"Charge",?85,"||",?88,"Bill#",?97,"AR-Status",?115,"Charge",?128,"Paid"
	W !,IBLINE,!
	S IBPAGE=IBPAGE+1
	Q