some optimization for IPPF forms
[openemr.git] / interface / billing / print_billing_report.php
blobcbc6c6deb840b63613b2f85a30db2077e709133d
1 <?php
2 include_once("../globals.php");
4 include_once("$srcdir/patient.inc");
5 include_once("$srcdir/billrep.inc");
6 include_once("$srcdir/forms.inc");
7 include_once("$srcdir/billing.inc");
8 include_once("$srcdir/pnotes.inc");
9 include_once("$srcdir/report.inc");
11 //how many columns to use when displaying information
12 $COLS=6;
15 //global variables:
16 if (!isset($_GET["mode"])) {
17 if (!isset($_GET["from_date"])) {
18 $from_date=date("Y-m-d");
19 } else {
20 $from_date = $_GET["from_date"];
22 if (!isset($_GET["to_date"])) {
23 $to_date = date("Y-m-d");
24 } else {
25 $to_date = $_GET["to_date"];
27 if (!isset($_GET["code_type"])) {
28 $code_type="all";
29 } else {
30 $code_type = $_GET["code_type"];
32 if (!isset($_GET["unbilled"])) {
33 $unbilled = "on";
34 } else {
35 $unbilled = $_GET["unbilled"];
37 if (!isset($_GET["authorized"])) {
38 $my_authorized = "on";
39 } else {
40 $my_authorized = $_GET["authorized"];
42 } else {
43 $from_date = $_GET["from_date"];
44 $to_date = $_GET["to_date"];
45 $code_type = $_GET["code_type"];
46 $unbilled = $_GET["unbilled"];
47 $my_authorized = $_GET["authorized"];
54 <html>
55 <head>
56 <? html_header_show();?>
59 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
61 </head>
62 <body bgcolor="#ffffff" topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
65 <a href="javascript:window.close();" target=Main><font class=title><?php xl('Billing Report','e')?></font></a>
66 <br>
70 <?php
71 if ($my_authorized == "on" ) {
72 $my_authorized = 1;
73 } else {
74 $my_authorized = "%";
76 if ($unbilled == "on") {
77 $unbilled = "0";
78 } else {
79 $unbilled = "%";
81 if ($code_type == "all") {
82 $code_type = "%";
85 $list = getBillsListBetween($from_date,$to_date,$my_authorized,$unbilled,$code_type);
90 <?php
91 if (!isset($_GET["mode"])) {
92 if (!isset($_GET["from_date"])) {
93 $from_date=date("Y-m-d");
94 } else {
95 $from_date = $_GET["from_date"];
97 if (!isset($_GET["to_date"])) {
98 $to_date = date("Y-m-d");
99 } else {
100 $to_date = $_GET["to_date"];
102 if (!isset($_GET["code_type"])) {
103 $code_type="all";
104 } else {
105 $code_type = $_GET["code_type"];
107 if (!isset($_GET["unbilled"])) {
108 $unbilled = "on";
109 } else {
110 $unbilled = $_GET["unbilled"];
112 if (!isset($_GET["authorized"])) {
113 $my_authorized = "on";
114 } else {
115 $my_authorized = $_GET["authorized"];
117 } else {
118 $from_date = $_GET["from_date"];
119 $to_date = $_GET["to_date"];
120 $code_type = $_GET["code_type"];
121 $unbilled = $_GET["unbilled"];
122 $my_authorized = $_GET["authorized"];
126 <?php
127 if ($my_authorized == "on" ) {
128 $my_authorized = 1;
129 } else {
130 $my_authorized = "%";
132 if ($unbilled == "on") {
133 $unbilled = "0";
134 } else {
135 $unbilled = "%";
137 if ($code_type == "all") {
138 $code_type = "%";
141 $list = getBillsListBetween($from_date,$to_date,$my_authorized,$unbilled,$code_type);
146 <?php
148 if (isset($_GET["mode"]) && $_GET["mode"] == "bill") {
149 billCodesList($list);
153 $res_count = 0;
154 $N = 1;
156 $itero = array();
157 if ($ret = getBillsBetween($from_date,$to_date,$my_authorized,$unbilled,$code_type)) {
158 $old_pid = -1;
159 $first_time = 1;
160 $encid = 0;
161 foreach ($ret as $iter) {
162 if ($old_pid != $iter{"pid"}) {
163 $name = getPatientData($iter{"pid"});
164 if (!$first_time) {
165 print "</tr></table>\n";
166 print "</td><td>";
167 print "<table border=0><tr>\n"; // small table
168 } else {
169 print "<table border=0><tr>\n"; // small table
170 $first_time=0;
172 print "<tr><td colspan=5><hr><span class=bold>" . $name{"fname"} . " " . $name{"lname"} . "</span><br><br>\n";
173 //==================================
176 print "<font class=bold>Patient Data:</font><br>";
177 printRecDataOne($patient_data_array, getRecPatientData ($iter{"pid"}), $COLS);
179 print "<font class=bold>Employer Data:</font><br>";
180 printRecDataOne($employer_data_array, getRecEmployerData ($iter{"pid"}), $COLS);
182 print "<font class=bold>Primary Insurance Data:</font><br>";
183 printRecDataOne($insurance_data_array, getRecInsuranceData ($iter{"pid"},"primary"), $COLS);
185 print "<font class=bold>Secondary Insurance Data:</font><br>";
186 printRecDataOne($insurance_data_array, getRecInsuranceData ($iter{"pid"},"secondary"), $COLS);
188 print "<font class=bold>Tertiary Insurance Data:</font><br>";
189 printRecDataOne($insurance_data_array, getRecInsuranceData ($iter{"pid"},"tertiary"), $COLS);
194 //==================================
195 print "</td></tr><tr>\n";
196 $old_pid = $iter{"pid"};
199 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";
200 $res_count++;
201 if ($res_count == $N) {
202 print "</tr><tr>\n";
203 $res_count = 0;
205 $itero = $iter;
207 print "</tr></table>\n"; // small table
233 </body>
234 </html>