internationalized units in vitals form - supports both us and metric units
[openemr.git] / interface / reports / custom_report_range.php
blob6409d368658d9fff0b492eee78d709d420aae138
1 <?
2 include_once(dirname(__file__)."/../globals.php");
5 include_once("$srcdir/forms.inc");
6 include_once("$srcdir/billing.inc");
7 include_once("$srcdir/pnotes.inc");
8 include_once("$srcdir/patient.inc");
9 include_once("$srcdir/report.inc");
10 include_once("$srcdir/classes/Document.class.php");
11 include_once("$srcdir/classes/Note.class.php");
13 <html>
14 <head>
17 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
20 </head>
22 <body <?echo $top_bg_line;?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
27 if(empty($_POST['start']) || empty($_POST['end'])){
29 <form method="post" action="custom_report_range.php">
30 <table>
31 <tr><td>Start Date:</td><td><input type="text" name="start" value="" size="10"/></td><td>YYYYMMDD</td></tr>
32 <tr><td>End Date:</td><td><input type="text" name="end" value="" size="10"/></td><td>YYYYMMDD</td></tr>
33 <tr><td><input type="submit" value="Submit"/></td><td></td></tr>
34 </table>
35 </form>
37 }else{
38 $sql = "select * from facility where billing_location = 1";
39 $db = $GLOBALS['adodb']['db'];
40 $results = $db->Execute($sql);
41 $facility = array();
42 if (!$results->EOF) {
43 $facility = $results->fields;
45 <p>
46 <h2><?=$facility['name']?></h2>
47 <?=$facility['street']?><br>
48 <?=$facility['city']?>, <?=$facility['state']?> <?=$facility['postal_code']?><br>
50 </p>
51 <?
55 $res = sqlStatement("select * from forms where form_name='New Patient Encounter' and date between DATE('$start') and DATE('$end') order by date DESC");
56 while($result = sqlFetchArray($res)) {
57 if ($result{"form_name"} == "New Patient Encounter") {
58 $newpatient[] = $result{"form_id"}.":".$result{"encounter"};
59 $pids[] = $result{"pid"};
62 $N = 6;
63 function postToGet($newpatient, $pids) {
64 $getstring="";
65 $serialnewpatient = serialize($newpatient);
66 $serialpids = serialize($pids);
67 $getstring = "newpatient=".urlencode($serialnewpatient)."&pids=".urlencode($serialpids);
69 return $getstring;
73 $iCounter = 0;
74 if(empty($newpatient)){
75 $newpatient = array();
77 foreach($newpatient as $patient){
78 /*
79 $inclookupres = sqlStatement("select distinct formdir from forms where pid='".$pids[$iCounter]."'");
80 while($result = sqlFetchArray($inclookupres)) {
81 include_once("{$GLOBALS['incdir']}/forms/" . $result{"formdir"} . "/report.php");
85 print "<font class=bold>Patient Data:</font><br>";
86 printRecDataOne($patient_data_array, getRecPatientData ($pids[$iCounter]), $N);
88 print "<font class=bold>Primary Insurance Data:</font><br>";
89 printRecDataOne($insurance_data_array, getRecInsuranceData ($pids[$iCounter],"primary"), $N);
90 print "<font class=bold>Secondary Insurance Data:</font><br>";
91 printRecDataOne($insurance_data_array, getRecInsuranceData ($pids[$iCounter],"secondary"), $N);
93 print "<font class=bold>Tertiary Insurance Data:</font><br>";
94 printRecDataOne($insurance_data_array, getRecInsuranceData ($pids[$iCounter],"tertiary"), $N);
96 print "<font class=bold>Billing Information:</font><br>";
97 if (count($patient) > 0) {
98 $billings = array();
99 echo "<table>";
100 echo "<tr><td class=bold>Date</td><td width=\"200\" class=bold>Provider</td><td width=\"400\" class=bold>Code</td><td class=bold>Fee</td></tr>\n";
101 $total = 0.00;
102 $copays = 0.00;
103 //foreach ($patient as $be) {
105 $ta = split(":",$patient);
106 $billing = getPatientBillingEncounter($pids[$iCounter],$ta[1]);
108 $billings[] = $billing;
109 foreach ($billing as $b) {
110 echo "<tr>\n";
111 echo "<td class=text>" . $b['date'] . "</td>";
112 echo "<td class=text>" . $b['provider_name'] . "</td>";
113 echo "<td class=text>";
114 echo $b['code_type'] . ":\t" . $b['code'] . "&nbsp;". $b['modifier'] . "&nbsp;&nbsp;&nbsp;" . $b['code_text'] . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
115 echo "</td>\n";
116 echo "<td class=text>";
117 echo $b['fee'];
118 echo "</td>\n";
119 echo "</tr>\n";
120 $total += $b['fee'];
121 if ($b['code_type'] == "COPAY") {
122 $copays += $b['fee'];
126 //}
127 echo "<tr><td>&nbsp;</td></tr>";
128 echo "<tr><td class=bold>Sub-Total</td><td class=text>" . sprintf("%0.2f",$total + abs($copays)) . "</td></tr>";
129 echo "<tr><td class=bold>Paid</td><td class=text>" . sprintf("%0.2f",abs($copays)) . "</td></tr>";
130 echo "<tr><td class=bold>Total</td><td class=text>" . sprintf("%0.2f",$total) . "</td></tr>";
131 echo "</table>";
132 echo "<pre>";
133 //print_r($billings);
134 echo "</pre>";
136 ++$iCounter;
137 print "<br/><br/>Physician Signature: _______________________________________________<br/><br/><br/>";
138 print "<hr width=\"100%\" />";
152 </body>
153 </html>