Left menu navigations bug fixes:
[openemr.git] / interface / billing / print_billing_report.php
blob99f10219d33f87b934e6412e6327f35273822d14
1 <?php
2 include_once("../globals.php");
4 include_once("$srcdir/patient.inc");
5 include_once("$srcdir/../interface/reports/report.inc.php");
6 include_once("$srcdir/billrep.inc");
7 include_once("$srcdir/forms.inc");
8 include_once("$srcdir/billing.inc");
9 include_once("$srcdir/pnotes.inc");
10 include_once("$srcdir/report.inc");
12 //how many columns to use when displaying information
13 $COLS=6;
16 //global variables:
17 if (!isset($_GET["mode"])) {
18 if (!isset($_GET["from_date"])) {
19 $from_date=date("Y-m-d");
20 } else {
21 $from_date = $_GET["from_date"];
23 if (!isset($_GET["to_date"])) {
24 $to_date = date("Y-m-d");
25 } else {
26 $to_date = $_GET["to_date"];
28 if (!isset($_GET["code_type"])) {
29 $code_type="all";
30 } else {
31 $code_type = $_GET["code_type"];
33 if (!isset($_GET["unbilled"])) {
34 $unbilled = "on";
35 } else {
36 $unbilled = $_GET["unbilled"];
38 if (!isset($_GET["authorized"])) {
39 $my_authorized = "on";
40 } else {
41 $my_authorized = $_GET["authorized"];
43 } else {
44 $from_date = $_GET["from_date"];
45 $to_date = $_GET["to_date"];
46 $code_type = $_GET["code_type"];
47 $unbilled = $_GET["unbilled"];
48 $my_authorized = $_GET["authorized"];
55 <html>
56 <head>
57 <? html_header_show();?>
60 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
62 </head>
63 <body bgcolor="#ffffff" topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
66 <a href="javascript:window.close();" target=Main><font class=title><?php xl('Billing Report','e')?></font></a>
67 <br>
71 <?php
72 if ($my_authorized == "on" ) {
73 $my_authorized = 1;
74 } else {
75 $my_authorized = "%";
77 if ($unbilled == "on") {
78 $unbilled = "0";
79 } else {
80 $unbilled = "%";
82 if ($code_type == "all") {
83 $code_type = "%";
86 $list = getBillsListBetween($code_type);
91 <?php
92 if (!isset($_GET["mode"])) {
93 if (!isset($_GET["from_date"])) {
94 $from_date=date("Y-m-d");
95 } else {
96 $from_date = $_GET["from_date"];
98 if (!isset($_GET["to_date"])) {
99 $to_date = date("Y-m-d");
100 } else {
101 $to_date = $_GET["to_date"];
103 if (!isset($_GET["code_type"])) {
104 $code_type="all";
105 } else {
106 $code_type = $_GET["code_type"];
108 if (!isset($_GET["unbilled"])) {
109 $unbilled = "on";
110 } else {
111 $unbilled = $_GET["unbilled"];
113 if (!isset($_GET["authorized"])) {
114 $my_authorized = "on";
115 } else {
116 $my_authorized = $_GET["authorized"];
118 } else {
119 $from_date = $_GET["from_date"];
120 $to_date = $_GET["to_date"];
121 $code_type = $_GET["code_type"];
122 $unbilled = $_GET["unbilled"];
123 $my_authorized = $_GET["authorized"];
127 <?php
128 if ($my_authorized == "on" ) {
129 $my_authorized = 1;
130 } else {
131 $my_authorized = "%";
133 if ($unbilled == "on") {
134 $unbilled = "0";
135 } else {
136 $unbilled = "%";
138 if ($code_type == "all") {
139 $code_type = "%";
142 $list = getBillsListBetween($code_type);
147 <?php
149 if (isset($_GET["mode"]) && $_GET["mode"] == "bill") {
150 billCodesList($list);
154 $res_count = 0;
155 $N = 1;
157 $itero = array();
158 if ($ret = getBillsBetween($code_type)) {
159 $old_pid = -1;
160 $first_time = 1;
161 $encid = 0;
162 foreach ($ret as $iter) {
163 if ($old_pid != $iter{"pid"}) {
164 $name = getPatientData($iter{"pid"});
165 if (!$first_time) {
166 print "</tr></table>\n";
167 print "</td><td>";
168 print "<table border=0><tr>\n"; // small table
169 } else {
170 print "<table border=0><tr>\n"; // small table
171 $first_time=0;
173 print "<tr><td colspan=5><hr><span class=bold>" . $name{"fname"} . " " . $name{"lname"} . "</span><br><br>\n";
174 //==================================
177 print "<font class=bold>Patient Data:</font><br>";
178 printRecDataOne($patient_data_array, getRecPatientData ($iter{"pid"}), $COLS);
180 print "<font class=bold>Employer Data:</font><br>";
181 printRecDataOne($employer_data_array, getRecEmployerData ($iter{"pid"}), $COLS);
183 print "<font class=bold>Primary Insurance Data:</font><br>";
184 printRecDataOne($insurance_data_array, getRecInsuranceData ($iter{"pid"},"primary"), $COLS);
186 print "<font class=bold>Secondary Insurance Data:</font><br>";
187 printRecDataOne($insurance_data_array, getRecInsuranceData ($iter{"pid"},"secondary"), $COLS);
189 print "<font class=bold>Tertiary Insurance Data:</font><br>";
190 printRecDataOne($insurance_data_array, getRecInsuranceData ($iter{"pid"},"tertiary"), $COLS);
195 //==================================
196 print "</td></tr><tr>\n";
197 $old_pid = $iter{"pid"};
200 print "<td width=100><span class=text>" . $iter{"code_type"} . ": </span></td><td width=100><span class=text>" . $iter{"code"} . "</span></td><td width=100><span class=small>(" . date("Y-m-d",strtotime($iter{"date"})) . ")</span></td>\n";
201 $res_count++;
202 if ($res_count == $N) {
203 print "</tr><tr>\n";
204 $res_count = 0;
206 $itero = $iter;
208 print "</tr></table>\n"; // small table
215 </body>
216 </html>