source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCNSMR0.m@ 823

Last change on this file since 823 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 7.5 KB
Line 
1IBCNSMR0 ;ALB/AAS - MEDICARE BILLS ; 02-SEPT-97
2 ;;2.0; INTEGRATED BILLING ;**92**; 21-MAR-94
3 ;
4% G RPRT^IBCNSMRA
5 Q
6 ;
7PRINT ;
8 N IBQUIT,IBPAG,IBHDT
9 S IBQUIT=0,IBPAG=0,IBHDT=$$HTE^XLFDT($H)
10 I IBPRNT="D" U IO D HDR(0),TOTALS Q:IBQUIT D HDR(1),SORT Q:IBQUIT D HDR(2),DETAIL Q:IBQUIT
11 I IBPRNT="S" U IO D HDR(0),TOTALS Q:IBQUIT D HDR(1),SORT
12 I IBSNDRPT D BULL^IBCNSMR1
13 Q
14 ;
15TOTALS ; -- prepare report
16 W !!," Bills Found for Selected Ins. Co.: "_$J(+$G(CNT),6)_$$FORMAT(+$G(CNT(0)),"2$",17)_$J(+$G(CNT(1)),6)_$$FORMAT(+$G(CNT(2)),"2$",14)
17 W !," Bills for Outpatient Visits: "_$J(+$G(CNT("OP")),6)_$$FORMAT(+$G(CNT("OP",0)),"2$",17)_$J(+$G(CNT("OP",1)),6)_$$FORMAT(+$G(CNT("OP",2)),"2$",14)
18 W !," Bills for Inpatient Visits: "_$J(+$G(CNT("IN")),6)_$$FORMAT(+$G(CNT("IN",0)),"2$",17)_$J(+$G(CNT("IN",1)),6)_$$FORMAT(+$G(CNT("IN",2)),"2$",14)
19 ;
20 W !!," Subtotals by Selected Ins. Co.: "
21 S IBNM=""
22 F S IBNM=$O(CNT(3,IBNM)) Q:IBNM="" D
23 .W !,?(35-$L(IBNM)),IBNM_": "_$J(+$G(CNT(3,IBNM)),6)_$$FORMAT(+$G(CNT(3,IBNM,0)),"2$",17)_$J(+$G(CNT(3,IBNM,1)),6)_$$FORMAT(+$G(CNT(3,IBNM,2)),"2$",14)
24 ;
25 W !!,"Bills with Procedures and Diagnosis: "_$J(+$G(CNT("B")),6)_$$FORMAT(+$G(CNT("B",0)),"2$",17)_$J(+$G(CNT("B",1)),6)_$$FORMAT(+$G(CNT("B",2)),"2$",14)
26 W !," Bills with Diagnosis Codes Only: "_$J(+$G(CNT("D")),6)_$$FORMAT(+$G(CNT("D",0)),"2$",17)_$J(+$G(CNT("D",1)),6)_$$FORMAT(+$G(CNT("D",2)),"2$",14)
27 W !," Bills with Procedure Codes Only: "_$J(+$G(CNT("P")),6)_$$FORMAT(+$G(CNT("P",0)),"2$",17)_$J(+$G(CNT("P",1)),6)_$$FORMAT(+$G(CNT("P",2)),"2$",14)
28 W !," Bills with No Proc. or Diag. Codes: "_$J(+$G(CNT("N")),6)_$$FORMAT(+$G(CNT("N",0)),"2$",17)_$J(+$G(CNT("N",1)),6)_$$FORMAT(+$G(CNT("N",2)),"2$",14)
29 ;
30 W !!," Bills Canceled before Completion: "_$J(+$G(CNT("C")),6)_$$FORMAT(+$G(CNT("C",0)),"2$",17)_$J(+$G(CNT("C",1)),6)_$$FORMAT(+$G(CNT("C",2)),"2$",14)
31 W !," Bills Never Printed: "_$J(+$G(CNT("F")),6)_$$FORMAT(+$G(CNT("F",0)),"2$",17)_$J(+$G(CNT("F",1)),6)_$$FORMAT(+$G(CNT("F",2)),"2$",14)
32 W !," Bills with wrong Rate Type: "_$J(+$G(CNT("R")),6)_$$FORMAT(+$G(CNT("R",0)),"2$",17)_$J(+$G(CNT("R",1)),6)_$$FORMAT(+$G(CNT("R",2)),"2$",14)
33 W !," Bills with wrong Who's Responsible: "_$J(+$G(CNT("W")),6)_$$FORMAT(+$G(CNT("W",0)),"2$",17)_$J(+$G(CNT("W",1)),6)_$$FORMAT(+$G(CNT("W",2)),"2$",14)
34 W !," Bills w/ wrong Bill Classification: "_$J(+$G(CNT("T")),6)_$$FORMAT(+$G(CNT("T",0)),"2$",17)_$J(+$G(CNT("T",1)),6)_$$FORMAT(+$G(CNT("T",2)),"2$",14)
35 W !," Bills for Prescriptions: "_$J(+$G(CNT("X")),6)_$$FORMAT(+$G(CNT("X",0)),"2$",17)_$J(+$G(CNT("X",1)),6)_$$FORMAT(+$G(CNT("X",2)),"2$",14)
36 W !," Bills for Prosthetics: "_$J(+$G(CNT("Z")),6)_$$FORMAT(+$G(CNT("Z",0)),"2$",17)_$J(+$G(CNT("Z",1)),6)_$$FORMAT(+$G(CNT("Z",2)),"2$",14)
37 ;W !," Bills with Patients Not Alive: "_$J(+$G(CNT("A")),6)_$$FORMAT(+$G(CNT("A",0)),"2$",17)_$J(+$G(CNT("A",1)),6)_$$FORMAT(+$G(CNT("A",2)),"2$",14)
38 ;
39 W !!," Bills Meeting Criteria for MRA: "_$J(+$G(CNT("M")),6)_$$FORMAT(+$G(CNT("M",0)),"2$",17)_$J(+$G(CNT("M",1)),6)_$$FORMAT(+$G(CNT("M",2)),"2$",14)
40 W !," Outpatient Bills Meeting Criteria: "_$J(+$G(CNT("M","OP")),6)_$$FORMAT(+$G(CNT("M","OP",0)),"2$",17)_$J(+$G(CNT("M","OP",1)),6)_$$FORMAT(+$G(CNT("M","OP",2)),"2$",14)
41 W !," Inpatient Bills Meeting Criteria: "_$J(+$G(CNT("M","IN")),6)_$$FORMAT(+$G(CNT("M","IN",0)),"2$",17)_$J(+$G(CNT("M","IN",1)),6)_$$FORMAT(+$G(CNT("M","IN",2)),"2$",14)
42 W !," Bill Meeting Criteria and Referred: "_$J(+$G(CNT("M",4)),6)_$$FORMAT(+$G(CNT("M",5)),"2$",17)_$J(+$G(CNT("M",6)),6)_$$FORMAT(+$G(CNT("M",7)),"2$",14)
43 ;
44 Q
45 ;
46SORT ; -- Run through list by insurance company
47 N I,J,K,L,M,N,P,X,Y,Z,ZZ
48 ;
49 I '$D(^TMP("IB-MRA-CNT",$J)) W !!,"There are no summary records to print.",! G SORTQ
50 ;
51 S I=0
52 F S I=$O(^TMP("IB-MRA-CNT",$J,I)) Q:I=""!(IBQUIT) D ;insur. co
53 .S J=0
54 .F S J=$O(^TMP("IB-MRA-CNT",$J,I,J)) Q:J=""!(IBQUIT) D ;year
55 ..S IBQUIT=$$STOP^IBCNSMR Q:IBQUIT
56 ..S K=""
57 ..F S K=$O(^TMP("IB-MRA-CNT",$J,I,J,K)) Q:K=""!(IBQUIT) D ;bill type
58 ...D SUBHDR
59 ...S L=0
60 ...F S L=$O(^TMP("IB-MRA-CNT",$J,I,J,K,L)) Q:L=""!(IBQUIT) D ;proc
61 ....S M=0
62 ....F S M=$O(^TMP("IB-MRA-CNT",$J,I,J,K,L,M)) Q:M=""!(IBQUIT) D ;ar status
63 .....S N=0
64 .....F S N=$O(^TMP("IB-MRA-CNT",$J,I,J,K,L,M,N)) Q:N=""!(IBQUIT) S X=+$G(^(N)),Y=+$G(^(N,0)),Z=+$G(^(1)),ZZ=+$G(^(2)) D LINE ;ibstatus
65 ;
66 ;......;S P=0 ;alive
67 ;......;F S P=$O(^TMP("IB-MRA-CNT",$J,I,J,K,L,M,N,P)) Q:P=""!(IBQUIT) S X=+$G(^(P)),Y=+$G(^(P,0)),Z=+$G(^(1)),ZZ=+$G(^(2)) D LINE
68 ;
69SORTQ I 'IBQUIT,$E(IOST,1,2)="C-",IBPRNT="S" W ! D PAUSE^VALM1 I $D(DIRUT) S IBQUIT=1
70 Q
71 ;
72SUBHDR ; -- print out sub headers
73 Q:$G(K)=""
74 I IOSL<($Y+6) D HDR(1) Q:IBQUIT
75 W !!,?10,"Insurance Company: ",$P($G(^DIC(36,+I,0)),"^")
76 W !,?15,"Calendar Year of Bill: ",J
77 W !,?20,"Type of Bill: ",K
78 Q
79 ;
80LINE ; -- Write one summary line
81 I IOSL<($Y+5) D HDR(1) Q:IBQUIT
82 W !,$E($P(M,"^",2),1,21),?23,$E($$EXTERNAL^DILFD(399,.13,"",N),1,14),?37,$J(+X,6),$$FORMAT(Y,"2$",17),$J(+Z,6),$$FORMAT(ZZ,"2$",14)
83 ;
84 Q
85 ;
86ARSTAT(M) ; convert code to ar status
87 N IEN
88 S IEN=+$O(^PRCA(430.3,"AC",+M,0))
89 Q $P($G(^PRCA(430.3,IEN,0)),"^")
90 ;
91DETAIL ; -- do detail report
92 N I,J,K,L,M,N,P,IBIFN,IBXX
93 ;
94 I '$D(^TMP("IB-MRA",$J)) W !!,"There are no detail records to print.",! G DETQ
95 ;
96 S I=""
97 F S I=$O(^TMP("IB-MRA",$J,I)) Q:I=""!(IBQUIT) D ; ins. co.
98 .S J=""
99 .F S J=$O(^TMP("IB-MRA",$J,I,J)) Q:J=""!(IBQUIT) D ;year
100 ..S K=""
101 ..F S K=$O(^TMP("IB-MRA",$J,I,J,K)) Q:K=""!(IBQUIT) D ;type of bill
102 ...D SUBHDR
103 ...S L=""
104 ...F S L=$O(^TMP("IB-MRA",$J,I,J,K,L)) Q:L=""!(IBQUIT) D ;proc
105 ....S M=0
106 ....F S M=$O(^TMP("IB-MRA",$J,I,J,K,L,M)) Q:M=""!(IBQUIT) D ;ar status
107 .....S N=0
108 .....F S N=$O(^TMP("IB-MRA",$J,I,J,K,L,M,N)) Q:N=""!(IBQUIT) D ;ibstatus
109 ......;S P=0 ;alive
110 ......;F S P=$O(^TMP("IB-MRA",$J,I,J,K,L,M,N,P)) Q:P=""!(IBQUIT) D
111 ......S IBIFN=""
112 ......F S IBIFN=$O(^TMP("IB-MRA",$J,I,J,K,L,M,N,IBIFN)) Q:IBIFN=""!(IBQUIT) S IBXX=^(IBIFN) D DLINE
113 ;
114DETQ I 'IBQUIT,$E(IOST,1,2)="C-" W ! D PAUSE^VALM1 I $D(DIRUT) S IBQUIT=1
115 Q
116 ;
117DLINE ; -- print one detail line
118 N I,J,K,L,M,N,DFN,ORGAMNT,TOTPAID,FROM,TO
119 I IOSL<($Y+5) D HDR(2) Q:IBQUIT
120 S DFN=+$P(IBXX,"^",2)
121 D DEM^VADPT
122 S ORGAMNT=+$G(^DGCR(399,IBIFN,"U1"))
123 S TOTPAID=$$TPR^PRCAFN(IBIFN)
124 W !,$P(IBXX,"^"),?12,$E(VADM(1),1,20),?34,VA("BID"),?42,VADM(4)
125 W ?48,$$FMTE^XLFDT(+$G(^DGCR(399,IBIFN,"U")),2)," - ",$$FMTE^XLFDT($P($G(^("U")),"^",2),2)
126 W ?70,$$FMTE^XLFDT($P($G(^DGCR(399,IBIFN,"S")),"^",12))
127 W ?82,$$FORMAT(ORGAMNT,"2$",17),$$FORMAT(TOTPAID,"2$",17)
128 K VA,VADM,VAERR
129 Q
130 ;
131HDR(L1) ; -- line item header
132 N X,Y,I,J,K,L,M,N,P,DIR,DIRUT,Z,ZZ
133 Q:$G(IBQUIT)
134 I $E(IOST,1,2)="C-",IBPAG D PAUSE^VALM1 I $D(DIRUT) S IBQUIT=1 Q
135 I $E(IOST,1,2)="C-"!(IBPAG) W @IOF
136 S IBPAG=IBPAG+1
137 W !,"Possible Medicare Remittance Advice Claims",?(IOM-33),"Page ",IBPAG," ",IBHDT
138 W !,$S(L1=2:"Detail Report",L1=1:"Summary Report",1:"Totals Report")
139 W:L1=2 !,"Bill No.",?12,"Patient Name",?34,"PT ID",?42,"Age",?48,"Bill From-To",?70,"Date Printed",?85,"Amount Billed",?100,"Amount Collected"
140 W:L1=1 !,?38,"Total",?53,"Amount",?62,"No.",?70,"Amount"
141 W:L1=1 !,"AR Status",?25,"IB Status",?38,"Number",?53,"Billed",?62,"Coll",?70,"Collected"
142 W:'L1 !,?38,"Total Amount No. Amount"
143 W:'L1 !,?38,"Number Billed Coll Collected"
144 W !,$TR($J(" ",IOM)," ","-")
145 Q
146 ;
147FORMAT(X,X2,X3) ; -- convert number to formatted number
148 ; -- input x = number to be converted
149 ; x2 = format characters (see doc for comma^%dtc)
150 ; x3 = lenght of formated output (optional)
151 ; output = formated character string
152 ;
153 D COMMA^%DTC
154 Q X
Note: See TracBrowser for help on using the repository browser.