2 include_once(dirname(__file__
)."/../globals.php");
4 include_once("$srcdir/forms.inc");
5 include_once("$srcdir/billing.inc");
6 include_once("$srcdir/pnotes.inc");
7 include_once("$srcdir/patient.inc");
8 include_once("$srcdir/report.inc");
9 include_once("$srcdir/classes/Document.class.php");
10 include_once("$srcdir/classes/Note.class.php");
12 $startdate = $enddate = "";
13 if(empty($_POST['start']) ||
empty($_POST['end'])) {
14 // set some default dates
15 $startdate = date('Ymd', (time() - 30*24*60*60));
16 $enddate = date('Ymd', time());
23 <?php
html_header_show();?
>
25 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
29 page
-break-after
: always
;
38 border
: 2px dashed black
;
41 #superbill_description {
44 #superbill_startingdate {
47 #superbill_endingdate {
51 #superbill_patientdata {
53 #superbill_patientdata h1 {
59 background
-color
: #eee;
60 border
: 1px solid black
;
62 #superbill_insurancedata {
65 #superbill_insurancedata h1 {
71 background
-color
: #eee;
72 border
: 1px solid black
;
74 #superbill_insurancedata h2 {
80 background
-color
: #eee;
82 #superbill_billingdata {
85 #superbill_billingdata h1 {
91 background
-color
: #eee;
92 border
: 1px solid black
;
94 #superbill_signature {
102 <body
class="body_top">
104 <?php
if(empty($_POST['start']) ||
empty($_POST['end'])) { ?
>
105 <form method
="post" action
="custom_report_range.php">
106 <div id
="superbill_description">
107 Superbills
, sometimes referred to
as Encounter Forms
or Routing Slips
, are an essential part of most medical practices
.
109 <div id
="superbill_startingdate">
110 <?php
xl('Start Date','e'); ?
>: <input type
="text" name
="start" id
="start" value
="<?php echo $startdate; ?>" size
="10"/>
111 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22' id
='img_from_date' border
='0' alt
='[?]' style
='cursor:pointer' title
='<?php xl('Click here to choose a date
','e
'); ?>'>
114 <div id
="superbill_endingdate">
115 <?php
xl('End Date','e'); ?
>: <input type
="text" name
="end" id
="end" value
="<?php echo $enddate; ?>" size
="10"/>
116 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22' id
='img_to_date' border
='0' alt
='[?]' style
='cursor:pointer' title
='<?php xl('Click here to choose a date
','e
'); ?>'>
119 <input type
="submit" value
="Submit"/>
124 $sql = "select * from facility where billing_location = 1";
125 $db = $GLOBALS['adodb']['db'];
126 $results = $db->Execute($sql);
128 if (!$results->EOF
) {
129 $facility = $results->fields
;
132 <h2
><?php
$facility['name']?
></h2
>
133 <?php
$facility['street']?
><br
>
134 <?php
$facility['city']?
>, <?php
$facility['state']?
> <?php
$facility['postal_code']?
><br
>
140 $res = sqlStatement("select * from forms where " .
141 "form_name = 'New Patient Encounter' and " .
142 "date between '$start' and '$end' " .
143 "order by date DESC");
144 while($result = sqlFetchArray($res)) {
145 if ($result{"form_name"} == "New Patient Encounter") {
146 $newpatient[] = $result{"form_id"}.":".$result{"encounter"};
147 $pids[] = $result{"pid"};
153 function postToGet($newpatient, $pids) {
155 $serialnewpatient = serialize($newpatient);
156 $serialpids = serialize($pids);
157 $getstring = "newpatient=".urlencode($serialnewpatient)."&pids=".urlencode($serialpids);
163 if(empty($newpatient)){ $newpatient = array(); }
164 foreach($newpatient as $patient){
166 $inclookupres = sqlStatement("select distinct formdir from forms where pid='".$pids[$iCounter]."'");
167 while($result = sqlFetchArray($inclookupres)) {
168 include_once("{$GLOBALS['incdir']}/forms/" . $result{"formdir"} . "/report.php");
172 print "<div id='superbill_patientdata'>";
173 print "<h1>".xl('Patient Data').":</h1>";
174 printRecDataOne($patient_data_array, getRecPatientData ($pids[$iCounter]), $N);
177 print "<div id='superbill_insurancedata'>";
178 print "<h1>".xl('Insurance Data').":</h1>";
179 print "<h2>".xl('Primary').":</h2>";
180 printRecDataOne($insurance_data_array, getRecInsuranceData ($pids[$iCounter],"primary"), $N);
181 print "<h2>".xl('Secondary').":</h2>";
182 printRecDataOne($insurance_data_array, getRecInsuranceData ($pids[$iCounter],"secondary"), $N);
183 print "<h2>".xl('Tertiary').":</h2>";
184 printRecDataOne($insurance_data_array, getRecInsuranceData ($pids[$iCounter],"tertiary"), $N);
187 print "<div id='superbill_billingdata'>";
188 print "<h1>".xl('Billing Information').":</h1>";
189 if (count($patient) > 0) {
191 echo "<table width='100%'>";
193 echo "<td class='bold' width='10%'>".xl('Date')."</td>";
194 echo "<td class='bold' width='20%'>".xl('Provider')."</td>";
195 echo "<td class='bold' width='40%'>".xl('Code')."</td>";
196 echo "<td class='bold' width='10%'>".xl('Fee')."</td></tr>\n";
199 //foreach ($patient as $be) {
201 $ta = split(":",$patient);
202 $billing = getPatientBillingEncounter($pids[$iCounter],$ta[1]);
204 $billings[] = $billing;
205 foreach ($billing as $b) {
206 // grab the date to reformat it in the output
207 $bdate = strtotime($b['date']);
210 echo "<td class='text' style='font-size: 0.8em'>" . date("Y-m-d",$bdate)."<BR>".date("h:i a", $bdate) . "</td>";
211 echo "<td class='text'>" . $b['provider_name'] . "</td>";
212 echo "<td class='text'>";
213 echo $b['code_type'] . ":\t" . $b['code'] . " ". $b['modifier'] . " " . $b['code_text'] . " ";
215 echo "<td class='text'>";
220 if ($b['code_type'] == "COPAY") {
221 $copays +
= $b['fee'];
226 echo "<tr><td> </td></tr>";
227 echo "<tr><td class='bold' colspan=3 style='text-align:right'>".xl('Sub-Total')."</td><td class='text'>" . sprintf("%0.2f",$total +
abs($copays)) . "</td></tr>";
228 echo "<tr><td class='bold' colspan=3 style='text-align:right'>".xl('Paid')."</td><td class='text'>" . sprintf("%0.2f",abs($copays)) . "</td></tr>";
229 echo "<tr><td class='bold' colspan=3 style='text-align:right'>".xl('Total')."</td><td class='text'>" . sprintf("%0.2f",$total) . "</td></tr>";
232 //print_r($billings);
238 print "<br/><br/>".xl('Physician Signature').": _______________________________________________";
239 print "<hr class='pagebreak' />";
255 <?php
if(empty($_POST['start']) ||
empty($_POST['end'])) : ?
>
256 <!-- stuff
for the popup calendar
-->
257 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
258 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
259 <script type
="text/javascript" src
="../../library/dynarch_calendar_en.js"></script
>
260 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
261 <script language
="Javascript">
262 Calendar
.setup({inputField
:"start", ifFormat
:"%Y%m%d", button
:"img_from_date"});
263 Calendar
.setup({inputField
:"end", ifFormat
:"%Y%m%d", button
:"img_to_date"});