IBCOPR1 ;WISC/RFJ,BOISE/WRL - print dollar amts for pre-registration ;05 May 97 8:34 AM
;;2.0;INTEGRATED BILLING;**75,345,528,664,668**;21-MAR-94;Build 28
;;Per VA Directive 6402, this routine should not be modified.
Q
;
EXCEL ; Excel print
;
N CTR,IBIOM,SORT
S IBIOM=IOM I IBIOM>200 S IBIOM=200
;
;Summary Report
I IBCNFSUM D G EXCELX
. N CLASS,GLO,LVL,SOI
. D HDR
. I '$D(^TMP($J,"IBCOPR","S")) W !,"NO DATA FOR SELECTED CRITERIA" Q
. F LVL=1,3,"T" D
.. S CLASS=$S(LVL=1:"Inpt",LVL=3:"Outpt ",1:"")
.. I LVL="T" W "Grand Total",!
.. W "Source^"_CLASS_"Bill Cnt^"_CLASS_"Bill Amt^"_CLASS_"Pay Cnt^"_CLASS_"Pay Amt",!
.. S SOI=""
.. F S SOI=$O(^TMP($J,"IBCOPR","S",LVL,SOI)) Q:'SOI D
... S STR=$$GET1^DIQ(355.12,SOI_",",.01)_U_+$G(^TMP($J,"IBCOPR","S",LVL,SOI,"BILLCNT"))_U_+$G(^TMP($J,"IBCOPR","S",LVL,SOI,"BILLAMT"))
... S STR=STR_U_+$G(^TMP($J,"IBCOPR","S",LVL,SOI,"CLMCNT"))_U_+$G(^TMP($J,"IBCOPR","S",LVL,SOI,"CLMAMT"))
... W STR,!
.. S GLO=$S(LVL="T":$NA(^TMP($J,"IBCOPR","T")),1:$NA(^TMP($J,"IBCOPR","T",LVL)))
.. S STR=$S(LVL=5:"Grand ",1:"")_"Total "_CLASS_U_+$G(@GLO@("BILLCNT"))_U_+$G(@GLO@("BILLAMT"))
.. S STR=STR_U_+$G(@GLO@("CLMCNT"))_U_+$G(@GLO@("CLMAMT"))
.. W STR,!!
. Q
;
;Detail Report
D HDR
I '$D(^TMP($J,"IBCOPR","T")) W !,"NO DATA FOR SELECTED CRITERIA" G EXCELX
F LVL=1,3 D
. S SORT="" F S SORT=$O(^TMP($J,"IBCOPR","D",LVL,SORT)) Q:SORT="" D
.. S CTR=0
.. F S CTR=$O(^TMP($J,"IBCOPR","D",LVL,SORT,CTR)) Q:'CTR D
... W ^TMP($J,"IBCOPR","D",LVL,SORT,CTR),!
. W "* Next to bill indicates bill is canceled and not used in totals"
. W !,"F=Full Payment P=Partial Payment N=No Payment Received to date",!
. W !,"TOTAL ",$S(LVL=3:"OUTPATIENT",1:"INPATIENT")," BILLS COUNT:",U
. W $FN($G(^TMP($J,"IBCOPR","T",LVL,"BILLCNT")),","),U,"AMOUNT: ",$FN($G(^TMP($J,"IBCOPR","T",LVL,"BILLAMT")),",",2),!
. W "TOTAL ",$S(LVL=3:"OUTPATIENT",1:"INPATIENT")," COLLECTED COUNT:",U
. W $FN($G(^TMP($J,"IBCOPR","T",LVL,"CLMCNT")),","),U,"AMOUNT: ",$FN($G(^TMP($J,"IBCOPR","T",LVL,"CLMAMT")),",",2),!
W !!,"Total Bill Ct^Total Bill Amt^Total Pymt Count^Total Pymt Amt",!
W $FN($G(^TMP($J,"IBCOPR","T","BILLCNT")),","),U,$FN($G(^TMP($J,"IBCOPR","T","BILLAMT")),",",2),"^"
W $FN($G(^TMP($J,"IBCOPR","T","CLMCNT")),","),U,$FN($G(^TMP($J,"IBCOPR","T",LVL,"CLMAMT")),",",2),!
;
EXCELX ;
Q
;
REPORT ; Print the report to the selected device.
;
N CTR,DATA,IBIOM,LINE,SORT,TAB,Y
;
S IBIOM=IOM I IBIOM>132 S IBIOM=132
;
; Summary Report
I IBCNFSUM D G REPORTX
. N SOI
. S TAB(1)=(IBIOM*.2),TAB(2)=(IBIOM*.4),TAB(3)=(IBIOM*.6),TAB(4)=(IBIOM*.8),$P(LINE,"-",IBIOM)=""
. W @IOF D HDR
. I '$D(^TMP($J,"IBCOPR","S")) W !,"NO DATA FOR SELECTED CRITERIA" Q
. F LVL=1,3,"T" D I IBEX Q
.. S CLASS=$S(LVL=3:"Outpt ",LVL=1:" Inpt ",1:" ")
.. I LVL="T" W "Grand Total",!
.. W "Source",?TAB(1),CLASS,"Bill Cnt",?TAB(2),CLASS,"Bill Amt",?TAB(3),CLASS,"Pay Cnt",?TAB(4),CLASS,"Pay Amt",!
.. S SOI=""
.. S GLO=$NA(^TMP($J,"IBCOPR","S",LVL))
.. F S SOI=$O(@GLO@(SOI)) Q:'SOI D I IBEX Q
... D PAGE Q:IBEX I $Y<6 D
.... I LVL="T" W "Grand Total",!
.... W "Source",?TAB(1),CLASS,"Bill Cnt",?TAB(2),CLASS,"Bill Amt",?TAB(3),CLASS,"Pay Cnt",?TAB(4),CLASS,"Pay Amt",!
... W $E($$GET1^DIQ(355.12,SOI_",",.01),1,TAB(1))
... W ?TAB(1),$J($FN(+$G(@GLO@(SOI,"BILLCNT")),","),10),?TAB(2),$J($FN(+$G(@GLO@(SOI,"BILLAMT")),",",2),14)
... W ?TAB(3),$J($FN(+$G(@GLO@(SOI,"CLMCNT")),","),9),?TAB(4),$J($FN(+$G(@GLO@(SOI,"CLMAMT")),",",2),13),!
.. I IBEX Q
.. S GLO=$S(LVL="T":$NA(^TMP($J,"IBCOPR","T")),1:$NA(^TMP($J,"IBCOPR","T",LVL)))
.. W $S(LVL="T":"Grand ",LVL=3:"Outpt ",1:"Inpt "),"Total"
.. W ?TAB(1),$J($FN(+$G(@GLO@("BILLCNT")),","),10),?TAB(2),$J($FN(+$G(@GLO@("BILLAMT")),",",2),14)
.. W ?TAB(3),$J($FN(+$G(@GLO@("CLMCNT")),","),9),?TAB(4),$J($FN(+$G(@GLO@("CLMAMT")),",",2),13),!
.. W !!
;
; Detail Report
S TAB(1)=18,TAB(2)=24,TAB(3)=36,TAB(4)=58,TAB(5)=70,TAB(6)=84,TAB(7)=96,TAB(8)=110,TAB(9)=116,$P(LINE,"-",IBIOM)=""
I '$D(^TMP($J,"IBCOPR","D")) D HDR W !,"NO DATA FOR SELECTED CRITERIA" G REPORTX
F LVL=1,3 D I IBEX Q
. D HDR
. S SORT="" F S SORT=$O(^TMP($J,"IBCOPR","D",LVL,SORT)) Q:SORT="" D I IBEX Q
.. S CTR=0
.. F S CTR=$O(^TMP($J,"IBCOPR","D",LVL,SORT,CTR)) Q:'CTR D I IBEX Q
... D PAGE Q:IBEX
... S DATA=^TMP($J,"IBCOPR","D",LVL,SORT,CTR)
... W $$FO^IBCNEUT1($P(DATA,U),16,"L") ;Patient Name
... W ?TAB(1),$$FO^IBCNEUT1($P(DATA,U,2),4,"L") ;SSN
... W ?TAB(2),$P(DATA,U,3) ;Bill Number
... W ?TAB(3),$$FO^IBCNEUT1($P(DATA,U,4),21,"L") ;Insurance Co
... W ?TAB(4),$J($FN($P(DATA,U,5),",",2),10) ;Billed Amount
... W ?TAB(5),$$FMTE^XLFDT($P(DATA,U,6)) ;Bill Date
... W ?TAB(6),$J($FN($P(DATA,U,7),",",2),10) ;Collected Amount
... W ?TAB(7),$$FMTE^XLFDT($P(DATA,U,8)) ;Collected Date
... W ?TAB(8),$J($P(DATA,U,9),3) ;F/P/N
... W ?TAB(9),$E($P(DATA,U,10),1,(IBIOM-TAB(9))) ;Source of Information
... W !
. I IBEX Q
. D PAGE Q:IBEX
. W "* Next to bill indicates bill is canceled and not used in totals"
. W !,"F=Full Payment P=Partial Payment" I DATETYPE="B" W " N=No Payments Received"
. W !,LINE,!
. S DATA=$G(^TMP($J,"IBCOPR","S",LVL))
. W ?5,"TOTAL ",$S(LVL=3:"OUTPATIENT",1:"INPATIENT")," BILLS COUNT:",$J($FN($G(^TMP($J,"IBCOPR","T",LVL,"BILLCNT")),","),14)
. W ?65,"AMOUNT: ",$J($FN($G(^TMP($J,"IBCOPR","T",LVL,"BILLAMT")),",",2),15),!
. W ?5,"TOTAL ",$S(LVL=3:"OUTPATIENT",1:"INPATIENT")," COLLECTED COUNT:",$J($FN($G(^TMP($J,"IBCOPR","T",LVL,"CLMCNT")),","),10)
. W ?65,"AMOUNT: ",$J($FN($G(^TMP($J,"IBCOPR","T",LVL,"CLMAMT")),",",2),15),!
. I LVL=1,($E(IOST,1,2)="C-") D PAUSE^VALM1 S:'Y IBEX=1
I IBEX G REPORTX
K LVL D PAGE I IBEX G REPORTX
W !,"Total Bill Ct",?30,"Total Bill Amt",?65,"Total Pymt Count",?95,"Total Pymt Amt",!
W $J($FN(+$G(^TMP($J,"IBCOPR","T","BILLCNT")),","),10),?30,$J($FN(+$G(^TMP($J,"IBCOPR","T","BILLAMT")),",",2),14)
W ?65,$J(+$G(^TMP($J,"IBCOPR","T","CLMCNT")),10),?95,$J($FN(+$G(^TMP($J,"IBCOPR","T","CLMAMT")),",",2),14),!
;
REPORTX ; Report Exit
Q
;
;
PAGE ;
I $Y+5>IOSL D
. I 'IBCNFSUM D
.. W "* Next to bill indicates bill is canceled and not used in totals"
.. W !,"F=Full Payment P=Partial Payment" I DATETYPE="B" W " N=No Payments Received"
. I $E(IOST,1,2)="C-" D PAUSE^VALM1 S:'Y IBEX=1 I IBEX Q
. D HDR
Q
;
HDR ;Print Header
;
N HSTR,LEN
W @IOF
N STR
S STR=RDATE I IBCNOUT'="E" S PAGE=$G(PAGE)+1,STR=STR_" PAGE "_PAGE
W "SOURCE OF INFORMATION REPORT",?IBIOM-($L(STR)+1),STR,!
S STR="TYPE: "_$S(IBCNFSUM:"SUMMARY",1:"DETAILED")
W "FOR THE ",$S(DATETYPE="B":"BILLED ",1:"COLLECTED "),"DATE RANGE: ",$$FMTE^XLFDT(DATESTRT)," TO ",$$FMTE^XLFDT(DATEEND),?IBIOM-($L(STR)+1),STR,!
W "SOURCE OF INFORMATION: ",$S($G(IBCNESOI)="A":"ALL",$G(IBCNESOI)>1:"SELECTED",1:$$GET1^DIQ(355.12,$O(IBCNESOI(""))_",",.01)),!
I IBCNFSUM D G HDRQ
. I (IBCNOUT="E") W ! Q
. W LINE,!!
W "SORT: ",SORTBY,!!
I '$D(LVL) Q
HDR2 ;SUB-HEADER
S HSTR=$S(LVL=1:" Inpatient Bills Entered ",LVL=3:" Outpatient Bills Entered ",1:"")
I IBCNOUT="R" S LEN=$L(HSTR),STR="" S:(LEN#2) LEN=LEN+1 S LEN=((IBIOM-$L(HSTR))/2+1),$P(STR,".",LEN)="",HSTR=STR_HSTR_STR
W HSTR,!
I IBCNOUT="R" D G HDRQ
. W "Patient Name",?TAB(1),"SSN",?TAB(2),"Bill Num",?TAB(3),"Insurance Company",?(TAB(4)+2),"Bill Amt",?TAB(5),"Bill Date",?(TAB(6)+2),"Coll Amt",?TAB(7),"Coll Date",?TAB(8),"F/P",$S(DATETYPE="B":"/N",1:""),?TAB(9),"Source",!!
W !,"Patient Name^SSN^Bill Num^Insurance Company^Bill Amt^Bill Date^Coll Amt^Coll Date^F/P",$S(DATETYPE="B":"/N",1:""),"^Source",!
;
HDRQ ;
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCOPR1 7792 printed Nov 22, 2024@17:28:40 Page 2
IBCOPR1 ;WISC/RFJ,BOISE/WRL - print dollar amts for pre-registration ;05 May 97 8:34 AM
+1 ;;2.0;INTEGRATED BILLING;**75,345,528,664,668**;21-MAR-94;Build 28
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 QUIT
+4 ;
EXCEL ; Excel print
+1 ;
+2 NEW CTR,IBIOM,SORT
+3 SET IBIOM=IOM
IF IBIOM>200
SET IBIOM=200
+4 ;
+5 ;Summary Report
+6 IF IBCNFSUM
Begin DoDot:1
+7 NEW CLASS,GLO,LVL,SOI
+8 DO HDR
+9 IF '$DATA(^TMP($JOB,"IBCOPR","S"))
WRITE !,"NO DATA FOR SELECTED CRITERIA"
QUIT
+10 FOR LVL=1,3,"T"
Begin DoDot:2
+11 SET CLASS=$SELECT(LVL=1:"Inpt",LVL=3:"Outpt ",1:"")
+12 IF LVL="T"
WRITE "Grand Total",!
+13 WRITE "Source^"_CLASS_"Bill Cnt^"_CLASS_"Bill Amt^"_CLASS_"Pay Cnt^"_CLASS_"Pay Amt",!
+14 SET SOI=""
+15 FOR
SET SOI=$ORDER(^TMP($JOB,"IBCOPR","S",LVL,SOI))
if 'SOI
QUIT
Begin DoDot:3
+16 SET STR=$$GET1^DIQ(355.12,SOI_",",.01)_U_+$GET(^TMP($JOB,"IBCOPR","S",LVL,SOI,"BILLCNT"))_U_+$GET(^TMP($JOB,"IBCOPR","S",LVL,SOI,"BILLAMT"))
+17 SET STR=STR_U_+$GET(^TMP($JOB,"IBCOPR","S",LVL,SOI,"CLMCNT"))_U_+$GET(^TMP($JOB,"IBCOPR","S",LVL,SOI,"CLMAMT"))
+18 WRITE STR,!
End DoDot:3
+19 SET GLO=$SELECT(LVL="T":$NAME(^TMP($JOB,"IBCOPR","T")),1:$NAME(^TMP($JOB,"IBCOPR","T",LVL)))
+20 SET STR=$SELECT(LVL=5:"Grand ",1:"")_"Total "_CLASS_U_+$GET(@GLO@("BILLCNT"))_U_+$GET(@GLO@("BILLAMT"))
+21 SET STR=STR_U_+$GET(@GLO@("CLMCNT"))_U_+$GET(@GLO@("CLMAMT"))
+22 WRITE STR,!!
End DoDot:2
+23 QUIT
End DoDot:1
GOTO EXCELX
+24 ;
+25 ;Detail Report
+26 DO HDR
+27 IF '$DATA(^TMP($JOB,"IBCOPR","T"))
WRITE !,"NO DATA FOR SELECTED CRITERIA"
GOTO EXCELX
+28 FOR LVL=1,3
Begin DoDot:1
+29 SET SORT=""
FOR
SET SORT=$ORDER(^TMP($JOB,"IBCOPR","D",LVL,SORT))
if SORT=""
QUIT
Begin DoDot:2
+30 SET CTR=0
+31 FOR
SET CTR=$ORDER(^TMP($JOB,"IBCOPR","D",LVL,SORT,CTR))
if 'CTR
QUIT
Begin DoDot:3
+32 WRITE ^TMP($JOB,"IBCOPR","D",LVL,SORT,CTR),!
End DoDot:3
End DoDot:2
+33 WRITE "* Next to bill indicates bill is canceled and not used in totals"
+34 WRITE !,"F=Full Payment P=Partial Payment N=No Payment Received to date",!
+35 WRITE !,"TOTAL ",$SELECT(LVL=3:"OUTPATIENT",1:"INPATIENT")," BILLS COUNT:",U
+36 WRITE $FNUMBER($GET(^TMP($JOB,"IBCOPR","T",LVL,"BILLCNT")),","),U,"AMOUNT: ",$FNUMBER($GET(^TMP($JOB,"IBCOPR","T",LVL,"BILLAMT")),",",2),!
+37 WRITE "TOTAL ",$SELECT(LVL=3:"OUTPATIENT",1:"INPATIENT")," COLLECTED COUNT:",U
+38 WRITE $FNUMBER($GET(^TMP($JOB,"IBCOPR","T",LVL,"CLMCNT")),","),U,"AMOUNT: ",$FNUMBER($GET(^TMP($JOB,"IBCOPR","T",LVL,"CLMAMT")),",",2),!
End DoDot:1
+39 WRITE !!,"Total Bill Ct^Total Bill Amt^Total Pymt Count^Total Pymt Amt",!
+40 WRITE $FNUMBER($GET(^TMP($JOB,"IBCOPR","T","BILLCNT")),","),U,$FNUMBER($GET(^TMP($JOB,"IBCOPR","T","BILLAMT")),",",2),"^"
+41 WRITE $FNUMBER($GET(^TMP($JOB,"IBCOPR","T","CLMCNT")),","),U,$FNUMBER($GET(^TMP($JOB,"IBCOPR","T",LVL,"CLMAMT")),",",2),!
+42 ;
EXCELX ;
+1 QUIT
+2 ;
REPORT ; Print the report to the selected device.
+1 ;
+2 NEW CTR,DATA,IBIOM,LINE,SORT,TAB,Y
+3 ;
+4 SET IBIOM=IOM
IF IBIOM>132
SET IBIOM=132
+5 ;
+6 ; Summary Report
+7 IF IBCNFSUM
Begin DoDot:1
+8 NEW SOI
+9 SET TAB(1)=(IBIOM*.2)
SET TAB(2)=(IBIOM*.4)
SET TAB(3)=(IBIOM*.6)
SET TAB(4)=(IBIOM*.8)
SET $PIECE(LINE,"-",IBIOM)=""
+10 WRITE @IOF
DO HDR
+11 IF '$DATA(^TMP($JOB,"IBCOPR","S"))
WRITE !,"NO DATA FOR SELECTED CRITERIA"
QUIT
+12 FOR LVL=1,3,"T"
Begin DoDot:2
+13 SET CLASS=$SELECT(LVL=3:"Outpt ",LVL=1:" Inpt ",1:" ")
+14 IF LVL="T"
WRITE "Grand Total",!
+15 WRITE "Source",?TAB(1),CLASS,"Bill Cnt",?TAB(2),CLASS,"Bill Amt",?TAB(3),CLASS,"Pay Cnt",?TAB(4),CLASS,"Pay Amt",!
+16 SET SOI=""
+17 SET GLO=$NAME(^TMP($JOB,"IBCOPR","S",LVL))
+18 FOR
SET SOI=$ORDER(@GLO@(SOI))
if 'SOI
QUIT
Begin DoDot:3
+19 DO PAGE
if IBEX
QUIT
IF $Y<6
Begin DoDot:4
+20 IF LVL="T"
WRITE "Grand Total",!
+21 WRITE "Source",?TAB(1),CLASS,"Bill Cnt",?TAB(2),CLASS,"Bill Amt",?TAB(3),CLASS,"Pay Cnt",?TAB(4),CLASS,"Pay Amt",!
End DoDot:4
+22 WRITE $EXTRACT($$GET1^DIQ(355.12,SOI_",",.01),1,TAB(1))
+23 WRITE ?TAB(1),$JUSTIFY($FNUMBER(+$GET(@GLO@(SOI,"BILLCNT")),","),10),?TAB(2),$JUSTIFY($FNUMBER(+$GET(@GLO@(SOI,"BILLAMT")),",",2),14)
+24 WRITE ?TAB(3),$JUSTIFY($FNUMBER(+$GET(@GLO@(SOI,"CLMCNT")),","),9),?TAB(4),$JUSTIFY($FNUMBER(+$GET(@GLO@(SOI,"CLMAMT")),",",2),13),!
End DoDot:3
IF IBEX
QUIT
+25 IF IBEX
QUIT
+26 SET GLO=$SELECT(LVL="T":$NAME(^TMP($JOB,"IBCOPR","T")),1:$NAME(^TMP($JOB,"IBCOPR","T",LVL)))
+27 WRITE $SELECT(LVL="T":"Grand ",LVL=3:"Outpt ",1:"Inpt "),"Total"
+28 WRITE ?TAB(1),$JUSTIFY($FNUMBER(+$GET(@GLO@("BILLCNT")),","),10),?TAB(2),$JUSTIFY($FNUMBER(+$GET(@GLO@("BILLAMT")),",",2),14)
+29 WRITE ?TAB(3),$JUSTIFY($FNUMBER(+$GET(@GLO@("CLMCNT")),","),9),?TAB(4),$JUSTIFY($FNUMBER(+$GET(@GLO@("CLMAMT")),",",2),13),!
+30 WRITE !!
End DoDot:2
IF IBEX
QUIT
End DoDot:1
GOTO REPORTX
+31 ;
+32 ; Detail Report
+33 SET TAB(1)=18
SET TAB(2)=24
SET TAB(3)=36
SET TAB(4)=58
SET TAB(5)=70
SET TAB(6)=84
SET TAB(7)=96
SET TAB(8)=110
SET TAB(9)=116
SET $PIECE(LINE,"-",IBIOM)=""
+34 IF '$DATA(^TMP($JOB,"IBCOPR","D"))
DO HDR
WRITE !,"NO DATA FOR SELECTED CRITERIA"
GOTO REPORTX
+35 FOR LVL=1,3
Begin DoDot:1
+36 DO HDR
+37 SET SORT=""
FOR
SET SORT=$ORDER(^TMP($JOB,"IBCOPR","D",LVL,SORT))
if SORT=""
QUIT
Begin DoDot:2
+38 SET CTR=0
+39 FOR
SET CTR=$ORDER(^TMP($JOB,"IBCOPR","D",LVL,SORT,CTR))
if 'CTR
QUIT
Begin DoDot:3
+40 DO PAGE
if IBEX
QUIT
+41 SET DATA=^TMP($JOB,"IBCOPR","D",LVL,SORT,CTR)
+42 ;Patient Name
WRITE $$FO^IBCNEUT1($PIECE(DATA,U),16,"L")
+43 ;SSN
WRITE ?TAB(1),$$FO^IBCNEUT1($PIECE(DATA,U,2),4,"L")
+44 ;Bill Number
WRITE ?TAB(2),$PIECE(DATA,U,3)
+45 ;Insurance Co
WRITE ?TAB(3),$$FO^IBCNEUT1($PIECE(DATA,U,4),21,"L")
+46 ;Billed Amount
WRITE ?TAB(4),$JUSTIFY($FNUMBER($PIECE(DATA,U,5),",",2),10)
+47 ;Bill Date
WRITE ?TAB(5),$$FMTE^XLFDT($PIECE(DATA,U,6))
+48 ;Collected Amount
WRITE ?TAB(6),$JUSTIFY($FNUMBER($PIECE(DATA,U,7),",",2),10)
+49 ;Collected Date
WRITE ?TAB(7),$$FMTE^XLFDT($PIECE(DATA,U,8))
+50 ;F/P/N
WRITE ?TAB(8),$JUSTIFY($PIECE(DATA,U,9),3)
+51 ;Source of Information
WRITE ?TAB(9),$EXTRACT($PIECE(DATA,U,10),1,(IBIOM-TAB(9)))
+52 WRITE !
End DoDot:3
IF IBEX
QUIT
End DoDot:2
IF IBEX
QUIT
+53 IF IBEX
QUIT
+54 DO PAGE
if IBEX
QUIT
+55 WRITE "* Next to bill indicates bill is canceled and not used in totals"
+56 WRITE !,"F=Full Payment P=Partial Payment"
IF DATETYPE="B"
WRITE " N=No Payments Received"
+57 WRITE !,LINE,!
+58 SET DATA=$GET(^TMP($JOB,"IBCOPR","S",LVL))
+59 WRITE ?5,"TOTAL ",$SELECT(LVL=3:"OUTPATIENT",1:"INPATIENT")," BILLS COUNT:",$JUSTIFY($FNUMBER($GET(^TMP($JOB,"IBCOPR","T",LVL,"BILLCNT")),","),14)
+60 WRITE ?65,"AMOUNT: ",$JUSTIFY($FNUMBER($GET(^TMP($JOB,"IBCOPR","T",LVL,"BILLAMT")),",",2),15),!
+61 WRITE ?5,"TOTAL ",$SELECT(LVL=3:"OUTPATIENT",1:"INPATIENT")," COLLECTED COUNT:",$JUSTIFY($FNUMBER($GET(^TMP($JOB,"IBCOPR","T",LVL,"CLMCNT")),","),10)
+62 WRITE ?65,"AMOUNT: ",$JUSTIFY($FNUMBER($GET(^TMP($JOB,"IBCOPR","T",LVL,"CLMAMT")),",",2),15),!
+63 IF LVL=1
IF ($EXTRACT(IOST,1,2)="C-")
DO PAUSE^VALM1
if 'Y
SET IBEX=1
End DoDot:1
IF IBEX
QUIT
+64 IF IBEX
GOTO REPORTX
+65 KILL LVL
DO PAGE
IF IBEX
GOTO REPORTX
+66 WRITE !,"Total Bill Ct",?30,"Total Bill Amt",?65,"Total Pymt Count",?95,"Total Pymt Amt",!
+67 WRITE $JUSTIFY($FNUMBER(+$GET(^TMP($JOB,"IBCOPR","T","BILLCNT")),","),10),?30,$JUSTIFY($FNUMBER(+$GET(^TMP($JOB,"IBCOPR","T","BILLAMT")),",",2),14)
+68 WRITE ?65,$JUSTIFY(+$GET(^TMP($JOB,"IBCOPR","T","CLMCNT")),10),?95,$JUSTIFY($FNUMBER(+$GET(^TMP($JOB,"IBCOPR","T","CLMAMT")),",",2),14),!
+69 ;
REPORTX ; Report Exit
+1 QUIT
+2 ;
+3 ;
PAGE ;
+1 IF $Y+5>IOSL
Begin DoDot:1
+2 IF 'IBCNFSUM
Begin DoDot:2
+3 WRITE "* Next to bill indicates bill is canceled and not used in totals"
+4 WRITE !,"F=Full Payment P=Partial Payment"
IF DATETYPE="B"
WRITE " N=No Payments Received"
End DoDot:2
+5 IF $EXTRACT(IOST,1,2)="C-"
DO PAUSE^VALM1
if 'Y
SET IBEX=1
IF IBEX
QUIT
+6 DO HDR
End DoDot:1
+7 QUIT
+8 ;
HDR ;Print Header
+1 ;
+2 NEW HSTR,LEN
+3 WRITE @IOF
+4 NEW STR
+5 SET STR=RDATE
IF IBCNOUT'="E"
SET PAGE=$GET(PAGE)+1
SET STR=STR_" PAGE "_PAGE
+6 WRITE "SOURCE OF INFORMATION REPORT",?IBIOM-($LENGTH(STR)+1),STR,!
+7 SET STR="TYPE: "_$SELECT(IBCNFSUM:"SUMMARY",1:"DETAILED")
+8 WRITE "FOR THE ",$SELECT(DATETYPE="B":"BILLED ",1:"COLLECTED "),"DATE RANGE: ",$$FMTE^XLFDT(DATESTRT)," TO ",$$FMTE^XLFDT(DATEEND),?IBIOM-($LENGTH(STR)+1),STR,!
+9 WRITE "SOURCE OF INFORMATION: ",$SELECT($GET(IBCNESOI)="A":"ALL",$GET(IBCNESOI)>1:"SELECTED",1:$$GET1^DIQ(355.12,$ORDER(IBCNESOI(""))_",",.01)),!
+10 IF IBCNFSUM
Begin DoDot:1
+11 IF (IBCNOUT="E")
WRITE !
QUIT
+12 WRITE LINE,!!
End DoDot:1
GOTO HDRQ
+13 WRITE "SORT: ",SORTBY,!!
+14 IF '$DATA(LVL)
QUIT
HDR2 ;SUB-HEADER
+1 SET HSTR=$SELECT(LVL=1:" Inpatient Bills Entered ",LVL=3:" Outpatient Bills Entered ",1:"")
+2 IF IBCNOUT="R"
SET LEN=$LENGTH(HSTR)
SET STR=""
if (LEN#2)
SET LEN=LEN+1
SET LEN=((IBIOM-$LENGTH(HSTR))/2+1)
SET $PIECE(STR,".",LEN)=""
SET HSTR=STR_HSTR_STR
+3 WRITE HSTR,!
+4 IF IBCNOUT="R"
Begin DoDot:1
+5 WRITE "Patient Name",?TAB(1),"SSN",?TAB(2),"Bill Num",?TAB(3),"Insurance Company",?(TAB(4)+2),"Bill Amt",?TAB(5),"Bill Date",?(TAB(6)+2),"Coll Amt",?TAB(7),"Coll Date",?TAB(8),"F/P",$SELECT(DATETYPE="B":"/N",1:""),?TAB(9),"Source",!!
End DoDot:1
GOTO HDRQ
+6 WRITE !,"Patient Name^SSN^Bill Num^Insurance Company^Bill Amt^Bill Date^Coll Amt^Coll Date^F/P",$SELECT(DATETYPE="B":"/N",1:""),"^Source",!
+7 ;
HDRQ ;
+1 QUIT
+2 ;