Highway to PSR2
[openemr.git] / interface / patient_file / summary / demographics_print.php
blobf6eef037576991217e54790a7d94cc162f18b36c
1 <?php
2 // Copyright (C) 2009-2015 Rod Roark <rod@sunsetsystems.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // Currently this will print only a blank form, but some code was
10 // preserved here and in options.inc.php to ease future support for
11 // data for a specified patient.
13 require_once("../../globals.php");
14 require_once("$srcdir/acl.inc");
15 require_once("$srcdir/options.inc.php");
16 require_once("$srcdir/patient.inc");
18 $CPR = 4; // cells per row
20 /*********************************************************************
21 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
22 $result2 = getEmployerData($pid);
23 // Check authorization.
24 if ($pid) {
25 if (!acl_check('patients','demo','','write'))
26 die(xl('Demographics not authorized.'));
27 if ($result['squad'] && ! acl_check('squads', $result['squad']))
28 die(xl('You are not authorized to access this squad.'));
30 $insurancei = getInsuranceProviders();
31 *********************************************************************/
33 $fres = sqlStatement("SELECT * FROM layout_options " .
34 "WHERE form_id = 'DEM' AND uor > 0 " .
35 "ORDER BY group_name, seq");
37 <html>
38 <head>
39 <?php html_header_show();?>
41 <style>
42 body, td {
43 font-family: Arial, Helvetica, sans-serif;
44 font-weight: normal;
45 font-size: 9pt;
48 body {
49 padding: 5pt 5pt 5pt 5pt;
52 div.section {
53 border-style: solid;
54 border-width: 1px;
55 border-color: #000000;
56 margin: 0 0 0 10pt;
57 padding: 5pt;
60 .mainhead {
61 font-weight: bold;
62 font-size: 14pt;
63 text-align: center;
66 .under {
67 border-style: solid;
68 border-width: 0 0 1px 0;
69 border-color: #999999;
72 .ftitletable {
73 width: 100%;
74 margin: 0 0 8pt 0;
76 .ftitlecell1 {
77 vertical-align: top;
78 text-align: left;
79 font-size: 14pt;
80 font-weight: bold;
82 .ftitlecell2 {
83 vertical-align: top;
84 text-align: right;
85 font-size: 9pt;
87 </style>
88 </head>
90 <body bgcolor='#ffffff'>
91 <form>
93 <?php echo genFacilityTitle(xl('Registration Form'), -1); ?>
95 <?php
97 function end_cell()
99 global $item_count, $cell_count;
100 if ($item_count > 0) {
101 echo "</td>";
102 $item_count = 0;
106 function end_row()
108 global $cell_count, $CPR;
109 end_cell();
110 if ($cell_count > 0) {
111 for (; $cell_count < $CPR;
112 ++$cell_count) {
113 echo "<td></td>";
116 echo "</tr>\n";
117 $cell_count = 0;
121 function end_group()
123 global $last_group;
124 if (strlen($last_group) > 0) {
125 end_row();
126 echo " </table>\n";
127 echo "</div>\n";
131 $last_group = '';
132 $cell_count = 0;
133 $item_count = 0;
135 while ($frow = sqlFetchArray($fres)) {
136 $this_group = $frow['group_name'];
137 $titlecols = $frow['titlecols'];
138 $datacols = $frow['datacols'];
139 $data_type = $frow['data_type'];
140 $field_id = $frow['field_id'];
141 $list_id = $frow['list_id'];
142 $currvalue = '';
144 if (strpos($field_id, 'em_') === 0) {
145 $tmp = substr($field_id, 3);
146 // if (isset($result2[$tmp])) $currvalue = $result2[$tmp];
147 } else {
148 // if (isset($result[$field_id])) $currvalue = $result[$field_id];
151 // Handle a data category (group) change.
152 if (strcmp($this_group, $last_group) != 0) {
153 end_group();
154 if (strlen($last_group) > 0) {
155 echo "<br />\n";
158 $group_name = substr($this_group, 1);
159 $last_group = $this_group;
160 echo "<b>" . xl_layout_label($group_name) . "</b>\n";
162 echo "<div class='section'>\n";
163 echo " <table border='0' cellpadding='0'>\n";
166 // Handle starting of a new row.
167 if (($titlecols > 0 && $cell_count >= $CPR) || $cell_count == 0) {
168 end_row();
169 echo " <tr style='height:30pt'>";
172 if ($item_count == 0 && $titlecols == 0) {
173 $titlecols = 1;
176 // Handle starting of a new label cell.
177 if ($titlecols > 0) {
178 end_cell();
179 echo "<td colspan='$titlecols' width='10%'";
180 echo ($frow['uor'] == 2) ? " class='required'" : " class='bold'";
181 if ($cell_count == 2) {
182 echo " style='padding-left:10pt'";
185 echo ">";
186 $cell_count += $titlecols;
189 ++$item_count;
191 echo "<b>";
193 if ($frow['title']) {
194 echo (xl_layout_label($frow['title']) . ":");
195 } else {
196 echo "&nbsp;";
199 echo "</b>";
201 // Handle starting of a new data cell.
202 if ($datacols > 0) {
203 end_cell();
204 echo "<td colspan='$datacols' width='40%' class='under'";
205 if ($cell_count > 0) {
206 echo " style='padding-left:5pt;'";
209 echo ">";
210 $cell_count += $datacols;
213 ++$item_count;
214 generate_print_field($frow, $currvalue);
217 end_group();
220 </form>
222 <!-- This should really be in the onload handler but that seems to be unreliable and can crash Firefox 3. -->
223 <script language='JavaScript'>
224 opener.top.printLogPrint(window);
225 </script>
227 </body>
228 </html>