IBOMTE1 ;ALB/CPM - ESTIMATE CATEGORY C CHARGES (PRINT) ; 17-DEC-91
;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
;
;***
;S XRTL=$ZU(0),XRTN="IBOMTE1-2" D T0^%ZOSV ;start rt clock
; Set up report header.
S IBLINE="",$P(IBLINE,"-",IOM+1)="",(IBPAG,IBQUIT)=0
S DFN=IBDFN,IBPT=$$PT^IBEFUNC(DFN) D HDR
;
; Check to see if patient will be Category C upon admission.
S IBLASTC=$$BILST^DGMTUB(DFN)
I IBBDT>DT&(IBLASTC<DT)!(IBBDT'>DT&(IBLASTC<IBBDT)) D
. I 'IBLASTC W "** Please note that this patient has never been Category C. **",! Q
. W "Please note that this patient ",$S(IBBDT'<DT:"will not be",1:"was not")," Category C on the admission date."
. W !,"Last date as Category C: ",$$DAT1^IBOUTL(IBLASTC),!
;
; Check to see if the patient has an active billing clock
; from which to base the charges. Print active clock data.
D CLOCK^IBAUTL3
I IBCLDA D
. S X1=IBBDT,X2=IBCLDT D ^%DTC S IBCLCT=X I X>365 S IBCLDA=0 Q
. W "** THIS PATIENT HAS AN ACTIVE BILLING CLOCK **",!?6,"Clock date: ",$$DAT1^IBOUTL(IBCLDT)," Days of inpatient care within clock: ",$J(+IBCLDAY,2)
. W !?6,"Copayments made for current 90 days of inpatient care: ",$J("$"_$J(IBCLDOL,0,2),7),!
I 'IBCLDA S IBCLDT=IBBDT,(IBCLCT,IBCLDAY,IBCLDOL)=0 D DED^IBAUTL3
;
; Build necessary processing variables.
S (IBCHGT,IBTOT)=0 K IBA
S X1=IBEDT,X2=IBBDT D ^%DTC S IBLOS=$S(IBEDT=IBBDT&('IBEVDA):1,1:X)
S X=IBBDT D H^%DTC S IBBDH=%H,IBFCTR=IBBDH-1
S X=IBEDT D H^%DTC S IBEDH=%H-1
S IBNH=$P($G(^DGCR(399.1,IBBS,0)),"^")["NURSING"
;
; If continuous patient, just calculate the per diem.
I $$CONT^IBAUTL5(DFN)>IBEDT D COHDR^IBOMTE2,NOCOP W ?3,"(PATIENT IS CONTINUOUS SINCE 7/1/86)",! G PER
;
; Process each day in the admission for co-payments.
D ^IBOMTE2 G:IBQUIT END
;
PER ; Calculate the total per diem charge and print total.
I $Y>(IOSL-7) D PAUSE^IBOUTL G:IBQUIT END D HDR
W !,"PER DIEM CHARGES for ",$S(IBNH:"NURSING HOME",1:"HOSPITAL")," CARE",!,IBLINE
S IBDIEM=$$DIEM^IBAUTL5,X=IBEDT I IBBDT'=IBEDT S %H=IBEDH D YMD^%DTC S IBEDT=X
I IBEDT<IBDIEM D NOPD G TOT
I IBDIEM>IBBDT S X1=IBEDT,(X2,IBBDT)=IBDIEM D ^%DTC S IBLOS=X+1
I IBLOS<1 D NOPD G TOT
S IBCHG=IBLOS*$S(IBNH:5,1:10),IBTOT=IBTOT+IBCHG
W !,$$DAT1^IBOUTL(IBBDT),?12,$$DAT1^IBOUTL(IBEDT),?26,IBLOS," day",$E("s",IBLOS>1)," @ $",$S(IBNH:"5.00",1:"10.00"),"/day"
S X=IBCHG,X2="2$",X3=12 D COMMA^%DTC W ?61,X
;
TOT W !?62,"----------",!?35,"Total Estimated Charges:" S X=IBTOT,X2="2$",X3=12 D COMMA^%DTC W ?61,X
D PAUSE^IBOUTL
;
END ; Close device and quit
;***
;I $D(XRT0) S:'$D(XRTN) XRTN="IBOMTE1" D T1^%ZOSV ;stop rt clock
Q:$D(ZTQUEUED)
K %H,IBJ,IBDIEM,IBCLDOL,IBTOT,IBH,IBLOS,IBNH,IBFCTR,IBBDH,IBEDH,IBLASTC,IBMED,IBCLDA,IBCLDT,IBCLCT,IBCLDAY,IBQUIT,IBCHG,IBCHGT,IBPAG,IBLINE,IBMAX,IBDT,IBATYP,IBDESC,IBI,IBCHARG,IBPT
D ^%ZISC Q
;
;
HDR ; Print header.
S IBPAG=IBPAG+1,IBH="Estimated Category C Inpatient Charges for "_$P(IBPT,"^")_" "_$P(IBPT,"^",3)_$S(IBPAG>1:" (Con't.)",1:"")
I $E(IOST,1,2)["C-"!(IBPAG>1) W @IOF
W !?IOM-$L(IBH)\2,IBH,!!
I IBEVDA W "Please note that this patient is a current inpatient.",!
W "Charges will be estimated from ",$$DAT1^IBOUTL(IBBDT)," through ",$$DAT1^IBOUTL(IBEDT),"."
I IBBDT=IBEDT,'IBEVDA W " (ONE-DAY ADMISSION)"
W ! Q
;
NOCOP ; Print 'No Copay' message.
W !,"** NO COPAYMENT CHARGES WILL BE APPLIED **",?67,"$0.00",! Q
;
NOPD ; Print 'No Per Diem' message.
W !,"** NO PER DIEM CHARGES WILL BE APPLIED **",?67,"$0.00" Q
IBOMTE1 ;ALB/CPM - ESTIMATE CATEGORY C CHARGES (PRINT) ; 17-DEC-91
+1 ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
+2 ;
+3 ;***
+4 ;S XRTL=$ZU(0),XRTN="IBOMTE1-2" D T0^%ZOSV ;start rt clock
+5 ; Set up report header.
+6 SET IBLINE=""
SET $PIECE(IBLINE,"-",IOM+1)=""
SET (IBPAG,IBQUIT)=0
+7 SET DFN=IBDFN
SET IBPT=$$PT^IBEFUNC(DFN)
DO HDR
+8 ;
+9 ; Check to see if patient will be Category C upon admission.
+10 SET IBLASTC=$$BILST^DGMTUB(DFN)
+11 IF IBBDT>DT&(IBLASTC<DT)!(IBBDT'>DT&(IBLASTC<IBBDT))
Begin DoDot:1
+12 IF 'IBLASTC
WRITE "** Please note that this patient has never been Category C. **",!
QUIT
+13 WRITE "Please note that this patient ",$SELECT(IBBDT'<DT:"will not be",1:"was not")," Category C on the admission date."
+14 WRITE !,"Last date as Category C: ",$$DAT1^IBOUTL(IBLASTC),!
End DoDot:1
+15 ;
+16 ; Check to see if the patient has an active billing clock
+17 ; from which to base the charges. Print active clock data.
+18 DO CLOCK^IBAUTL3
+19 IF IBCLDA
Begin DoDot:1
+20 SET X1=IBBDT
SET X2=IBCLDT
DO ^%DTC
SET IBCLCT=X
IF X>365
SET IBCLDA=0
QUIT
+21 WRITE "** THIS PATIENT HAS AN ACTIVE BILLING CLOCK **",!?6,"Clock date: ",$$DAT1^IBOUTL(IBCLDT)," Days of inpatient care within clock: ",$JUSTIFY(+IBCLDAY,2)
+22 WRITE !?6,"Copayments made for current 90 days of inpatient care: ",$JUSTIFY("$"_$JUSTIFY(IBCLDOL,0,2),7),!
End DoDot:1
+23 IF 'IBCLDA
SET IBCLDT=IBBDT
SET (IBCLCT,IBCLDAY,IBCLDOL)=0
DO DED^IBAUTL3
+24 ;
+25 ; Build necessary processing variables.
+26 SET (IBCHGT,IBTOT)=0
KILL IBA
+27 SET X1=IBEDT
SET X2=IBBDT
DO ^%DTC
SET IBLOS=$SELECT(IBEDT=IBBDT&('IBEVDA):1,1:X)
+28 SET X=IBBDT
DO H^%DTC
SET IBBDH=%H
SET IBFCTR=IBBDH-1
+29 SET X=IBEDT
DO H^%DTC
SET IBEDH=%H-1
+30 SET IBNH=$PIECE($GET(^DGCR(399.1,IBBS,0)),"^")["NURSING"
+31 ;
+32 ; If continuous patient, just calculate the per diem.
+33 IF $$CONT^IBAUTL5(DFN)>IBEDT
DO COHDR^IBOMTE2
DO NOCOP
WRITE ?3,"(PATIENT IS CONTINUOUS SINCE 7/1/86)",!
GOTO PER
+34 ;
+35 ; Process each day in the admission for co-payments.
+36 DO ^IBOMTE2
IF IBQUIT
GOTO END
+37 ;
PER ; Calculate the total per diem charge and print total.
+1 IF $Y>(IOSL-7)
DO PAUSE^IBOUTL
IF IBQUIT
GOTO END
DO HDR
+2 WRITE !,"PER DIEM CHARGES for ",$SELECT(IBNH:"NURSING HOME",1:"HOSPITAL")," CARE",!,IBLINE
+3 SET IBDIEM=$$DIEM^IBAUTL5
SET X=IBEDT
IF IBBDT'=IBEDT
SET %H=IBEDH
DO YMD^%DTC
SET IBEDT=X
+4 IF IBEDT<IBDIEM
DO NOPD
GOTO TOT
+5 IF IBDIEM>IBBDT
SET X1=IBEDT
SET (X2,IBBDT)=IBDIEM
DO ^%DTC
SET IBLOS=X+1
+6 IF IBLOS<1
DO NOPD
GOTO TOT
+7 SET IBCHG=IBLOS*$SELECT(IBNH:5,1:10)
SET IBTOT=IBTOT+IBCHG
+8 WRITE !,$$DAT1^IBOUTL(IBBDT),?12,$$DAT1^IBOUTL(IBEDT),?26,IBLOS," day",$EXTRACT("s",IBLOS>1)," @ $",$SELECT(IBNH:"5.00",1:"10.00"),"/day"
+9 SET X=IBCHG
SET X2="2$"
SET X3=12
DO COMMA^%DTC
WRITE ?61,X
+10 ;
TOT WRITE !?62,"----------",!?35,"Total Estimated Charges:"
SET X=IBTOT
SET X2="2$"
SET X3=12
DO COMMA^%DTC
WRITE ?61,X
+1 DO PAUSE^IBOUTL
+2 ;
END ; Close device and quit
+1 ;***
+2 ;I $D(XRT0) S:'$D(XRTN) XRTN="IBOMTE1" D T1^%ZOSV ;stop rt clock
+3 IF $DATA(ZTQUEUED)
QUIT
+4 KILL %H,IBJ,IBDIEM,IBCLDOL,IBTOT,IBH,IBLOS,IBNH,IBFCTR,IBBDH,IBEDH,IBLASTC,IBMED,IBCLDA,IBCLDT,IBCLCT,IBCLDAY,IBQUIT,IBCHG,IBCHGT,IBPAG,IBLINE,IBMAX,IBDT,IBATYP,IBDESC,IBI,IBCHARG,IBPT
+5 DO ^%ZISC
QUIT
+6 ;
+7 ;
HDR ; Print header.
+1 SET IBPAG=IBPAG+1
SET IBH="Estimated Category C Inpatient Charges for "_$PIECE(IBPT,"^")_" "_$PIECE(IBPT,"^",3)_$SELECT(IBPAG>1:" (Con't.)",1:"")
+2 IF $EXTRACT(IOST,1,2)["C-"!(IBPAG>1)
WRITE @IOF
+3 WRITE !?IOM-$LENGTH(IBH)\2,IBH,!!
+4 IF IBEVDA
WRITE "Please note that this patient is a current inpatient.",!
+5 WRITE "Charges will be estimated from ",$$DAT1^IBOUTL(IBBDT)," through ",$$DAT1^IBOUTL(IBEDT),"."
+6 IF IBBDT=IBEDT
IF 'IBEVDA
WRITE " (ONE-DAY ADMISSION)"
+7 WRITE !
QUIT
+8 ;
NOCOP ; Print 'No Copay' message.
+1 WRITE !,"** NO COPAYMENT CHARGES WILL BE APPLIED **",?67,"$0.00",!
QUIT
+2 ;
NOPD ; Print 'No Per Diem' message.
+1 WRITE !,"** NO PER DIEM CHARGES WILL BE APPLIED **",?67,"$0.00"
QUIT