The Third Reminders email bug fix - contributed by arnabnaha
[openemr.git] / interface / billing / print_billing_report.php
bloba04b18e74d8f8bd066c4c8a1072e121221b98bb8
1 <?php
3 $fake_register_globals=false;
4 $sanitize_all_escapes=true;
6 include_once("../globals.php");
8 include_once("$srcdir/patient.inc");
9 include_once("$srcdir/../interface/reports/report.inc.php");
10 include_once("$srcdir/billrep.inc");
11 include_once("$srcdir/forms.inc");
12 include_once("$srcdir/billing.inc");
13 include_once("$srcdir/pnotes.inc");
14 include_once("$srcdir/report.inc");
16 //how many columns to use when displaying information
17 $COLS=6;
20 //global variables:
21 if (!isset($_GET["mode"])) {
22 if (!isset($_GET["from_date"])) {
23 $from_date=date("Y-m-d");
24 } else {
25 $from_date = $_GET["from_date"];
27 if (!isset($_GET["to_date"])) {
28 $to_date = date("Y-m-d");
29 } else {
30 $to_date = $_GET["to_date"];
32 if (!isset($_GET["code_type"])) {
33 $code_type="all";
34 } else {
35 $code_type = $_GET["code_type"];
37 if (!isset($_GET["unbilled"])) {
38 $unbilled = "on";
39 } else {
40 $unbilled = $_GET["unbilled"];
42 if (!isset($_GET["authorized"])) {
43 $my_authorized = "on";
44 } else {
45 $my_authorized = $_GET["authorized"];
47 } else {
48 $from_date = $_GET["from_date"];
49 $to_date = $_GET["to_date"];
50 $code_type = $_GET["code_type"];
51 $unbilled = $_GET["unbilled"];
52 $my_authorized = $_GET["authorized"];
59 <html>
60 <head>
61 <?php html_header_show();?>
64 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
66 </head>
67 <body bgcolor="#ffffff" topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
70 <a href="javascript:window.close();" target=Main><font class=title><?php echo xlt('Billing Report')?></font></a>
71 <br>
75 <?php
76 if ($my_authorized == "on" ) {
77 $my_authorized = 1;
78 } else {
79 $my_authorized = "%";
81 if ($unbilled == "on") {
82 $unbilled = "0";
83 } else {
84 $unbilled = "%";
86 if ($code_type == "all") {
87 $code_type = "%";
90 $list = getBillsListBetween($code_type);
95 <?php
96 if (!isset($_GET["mode"])) {
97 if (!isset($_GET["from_date"])) {
98 $from_date=date("Y-m-d");
99 } else {
100 $from_date = $_GET["from_date"];
102 if (!isset($_GET["to_date"])) {
103 $to_date = date("Y-m-d");
104 } else {
105 $to_date = $_GET["to_date"];
107 if (!isset($_GET["code_type"])) {
108 $code_type="all";
109 } else {
110 $code_type = $_GET["code_type"];
112 if (!isset($_GET["unbilled"])) {
113 $unbilled = "on";
114 } else {
115 $unbilled = $_GET["unbilled"];
117 if (!isset($_GET["authorized"])) {
118 $my_authorized = "on";
119 } else {
120 $my_authorized = $_GET["authorized"];
122 } else {
123 $from_date = $_GET["from_date"];
124 $to_date = $_GET["to_date"];
125 $code_type = $_GET["code_type"];
126 $unbilled = $_GET["unbilled"];
127 $my_authorized = $_GET["authorized"];
131 <?php
132 if ($my_authorized == "on" ) {
133 $my_authorized = 1;
134 } else {
135 $my_authorized = "%";
137 if ($unbilled == "on") {
138 $unbilled = "0";
139 } else {
140 $unbilled = "%";
142 if ($code_type == "all") {
143 $code_type = "%";
146 $list = getBillsListBetween($code_type);
151 <?php
153 if (isset($_GET["mode"]) && $_GET["mode"] == "bill") {
154 billCodesList($list);
158 $res_count = 0;
159 $N = 1;
161 $itero = array();
162 if ($ret = getBillsBetweenReport($code_type)) {
163 $old_pid = -1;
164 $first_time = 1;
165 $encid = 0;
166 foreach ($ret as $iter) {
167 if ($old_pid != $iter{"pid"}) {
168 $name = getPatientData($iter{"pid"});
169 if (!$first_time) {
170 print "</tr></table>\n";
171 print "</td><td>";
172 print "<table border=0><tr>\n"; // small table
173 } else {
174 print "<table border=0><tr>\n"; // small table
175 $first_time=0;
177 print "<tr><td colspan=5><hr><span class=bold>" . text($name{"fname"}) . " " . text($name{"lname"}) . "</span><br><br>\n";
178 //==================================
181 print "<font class=bold>" . xlt("Patient Data") . ":</font><br>";
182 printRecDataOne($patient_data_array, getRecPatientData ($iter{"pid"}), $COLS);
184 print "<font class=bold>" . xlt("Employer Data") . ":</font><br>";
185 printRecDataOne($employer_data_array, getRecEmployerData ($iter{"pid"}), $COLS);
187 print "<font class=bold>" . xlt("Primary Insurance Data") . ":</font><br>";
188 printRecDataOne($insurance_data_array, getRecInsuranceData ($iter{"pid"},"primary"), $COLS);
190 print "<font class=bold>" . xlt("Secondary Insurance Data") . ":</font><br>";
191 printRecDataOne($insurance_data_array, getRecInsuranceData ($iter{"pid"},"secondary"), $COLS);
193 print "<font class=bold>" . xlt("Tertiary Insurance Data") . ":</font><br>";
194 printRecDataOne($insurance_data_array, getRecInsuranceData ($iter{"pid"},"tertiary"), $COLS);
199 //==================================
200 print "</td></tr><tr>\n";
201 $old_pid = $iter{"pid"};
204 print "<td width=100><span class=text>" . text($iter{"code_type"}) . ": </span></td><td width=100><span class=text>" . text($iter{"code"}) . "</span></td><td width=100><span class=small>(" . text(date("Y-m-d",strtotime($iter{"date"}))) . ")</span></td>\n";
205 $res_count++;
206 if ($res_count == $N) {
207 print "</tr><tr>\n";
208 $res_count = 0;
210 $itero = $iter;
212 print "</tr></table>\n"; // small table
219 </body>
220 </html>