4 * Print billing report.
7 * @link http://www.open-emr.org
8 * @author Julia Longtin
9 * @author Stephen Waite <stephen.waite@cmsvt.com>
10 * @copyright Copyright (c) 2012 Julia Longtin
11 * @copyright Copyright (c) 2018-2020 Stephen Waite <stephen.waite@cmsvt.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/patient.inc.php");
17 require_once("$srcdir/forms.inc.php");
18 require_once("$srcdir/report.inc.php");
20 use OpenEMR\Billing\BillingReport
;
21 use OpenEMR\Core\Header
;
23 //how many columns to use when displaying information
27 if (!isset($_GET["mode"])) {
28 if (!isset($_GET["from_date"])) {
29 $from_date = date("Y-m-d");
31 $from_date = $_GET["from_date"];
34 if (!isset($_GET["to_date"])) {
35 $to_date = date("Y-m-d");
37 $to_date = $_GET["to_date"];
40 if (!isset($_GET["code_type"])) {
43 $code_type = $_GET["code_type"];
46 if (!isset($_GET["unbilled"])) {
49 $unbilled = $_GET["unbilled"];
52 if (!isset($_GET["authorized"])) {
53 $my_authorized = "on";
55 $my_authorized = $_GET["authorized"];
58 $from_date = $_GET["from_date"];
59 $to_date = $_GET["to_date"];
60 $code_type = $_GET["code_type"];
61 $unbilled = $_GET["unbilled"];
62 $my_authorized = $_GET["authorized"];
70 <?php Header
::setupHeader(); ?
>
73 <body bgcolor
="var(--white)" topmargin
="0" rightmargin
="0" leftmargin
="2" bottommargin
="0" marginwidth
="2" marginheight
="0">
75 <a href
="javascript:window.close();" target
="Main"><font
class="title"><?php
echo xlt('Billing Report')?
></font
></a
>
79 if ($my_authorized == "on") {
85 if ($unbilled == "on") {
91 if ($code_type == "all") {
95 $list = BillingReport
::getBillsListBetween($code_type);
97 if (!isset($_GET["mode"])) {
98 if (!isset($_GET["from_date"])) {
99 $from_date = date("Y-m-d");
101 $from_date = $_GET["from_date"];
104 if (!isset($_GET["to_date"])) {
105 $to_date = date("Y-m-d");
107 $to_date = $_GET["to_date"];
110 if (!isset($_GET["code_type"])) {
113 $code_type = $_GET["code_type"];
116 if (!isset($_GET["unbilled"])) {
119 $unbilled = $_GET["unbilled"];
122 if (!isset($_GET["authorized"])) {
123 $my_authorized = "on";
125 $my_authorized = $_GET["authorized"];
128 $from_date = $_GET["from_date"];
129 $to_date = $_GET["to_date"];
130 $code_type = $_GET["code_type"];
131 $unbilled = $_GET["unbilled"];
132 $my_authorized = $_GET["authorized"];
135 if ($my_authorized == "on") {
138 $my_authorized = "%";
141 if ($unbilled == "on") {
147 if ($code_type == "all") {
151 $list = BillingReport
::getBillsListBetween($code_type);
153 if (isset($_GET["mode"]) && $_GET["mode"] == "bill") {
154 BillingReport
::billCodesList($list);
161 if ($ret = BillingReport
::getBillsBetweenReport($code_type)) {
165 foreach ($ret as $iter) {
166 if ($old_pid != $iter["pid"]) {
167 $name = getPatientData($iter["pid"]);
169 print "</tr></table>\n";
171 print "<table border='0'><tr>\n"; // small table
173 print "<table border='0'><tr>\n"; // small table
177 print "<tr><td colspan='5'><hr /><span class='font-weight-bold'>" . text($name["fname"]) . " " . text($name["lname"]) . "</span><br /><br />\n";
178 //==================================
181 print "<font class='font-weight-bold'>" . xlt("Patient Data") . ":</font><br />";
182 printRecDataOne($patient_data_array, getRecPatientData($iter["pid"]), $COLS);
184 print "<font class='font-weight-bold'>" . xlt("Employer Data") . ":</font><br />";
185 printRecDataOne($employer_data_array, getRecEmployerData($iter["pid"]), $COLS);
187 print "<font class='font-weight-bold'>" . xlt("Primary Insurance Data") . ":</font><br />";
188 printRecDataOne($insurance_data_array, getRecInsuranceData($iter["pid"], "primary"), $COLS);
190 print "<font class='font-weight-bold'>" . xlt("Secondary Insurance Data") . ":</font><br />";
191 printRecDataOne($insurance_data_array, getRecInsuranceData($iter["pid"], "secondary"), $COLS);
193 print "<font class='font-weight-bold'>" . xlt("Tertiary Insurance Data") . ":</font><br />";
194 printRecDataOne($insurance_data_array, getRecInsuranceData($iter["pid"], "tertiary"), $COLS);
196 //==================================
197 print "</td></tr><tr>\n";
198 $old_pid = $iter["pid"];
201 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";
203 if ($res_count == $N) {
211 print "</tr></table>\n"; // small table