Remove concurrent_layout and clarify layout and themes selections (#272)
[openemr.git] / interface / forms / LBF / printable.php
blob4aac746e8e91c354c8435b1ca59e6d98643b3caf
1 <?php
2 // Copyright (C) 2009 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 //SANITIZE ALL ESCAPES
10 $sanitize_all_escapes=true;
12 //STOP FAKE REGISTER GLOBALS
13 $fake_register_globals=false;
15 require_once("../../globals.php");
16 require_once("$srcdir/acl.inc");
17 require_once("$srcdir/options.inc.php");
18 require_once("$srcdir/patient.inc");
20 $CPR = 4; // cells per row
22 // The form name is passed to us as a GET parameter.
23 $formname = isset($_GET['formname']) ? $_GET['formname'] : '';
25 $tmp = sqlQuery("SELECT title FROM list_options WHERE " .
26 "list_id = 'lbfnames' AND option_id = ? LIMIT 1", array($formname) );
27 $formtitle = $tmp['title'];
29 $fres = sqlStatement("SELECT * FROM layout_options " .
30 "WHERE form_id = ? AND uor > 0 " .
31 "ORDER BY group_name, seq", array($formname) );
33 <html>
34 <head>
35 <?php html_header_show();?>
37 <style>
38 body, td {
39 font-family: Arial, Helvetica, sans-serif;
40 font-weight: normal;
41 font-size: 9pt;
44 body {
45 padding: 5pt 5pt 5pt 5pt;
48 div.section {
49 border-style: solid;
50 border-width: 1px;
51 border-color: #000000;
52 margin: 0 0 0 10pt;
53 padding: 5pt;
56 .mainhead {
57 font-weight: bold;
58 font-size: 14pt;
59 text-align: center;
62 .subhead {
63 font-weight: bold;
64 font-size: 8pt;
67 .under {
68 border-style: solid;
69 border-width: 0 0 1px 0;
70 border-color: #999999;
73 .ftitletable {
74 width: 100%;
75 margin: 0 0 8pt 0;
77 .ftitlecell1 {
78 vertical-align: top;
79 text-align: left;
80 font-size: 14pt;
81 font-weight: bold;
83 .ftitlecell2 {
84 vertical-align: top;
85 text-align: right;
86 font-size: 9pt;
88 </style>
89 </head>
91 <body bgcolor='#ffffff'>
92 <form>
94 <?php echo genFacilityTitle($formtitle, -1); ?>
96 <span class='subhead'>
97 <?php echo xlt('Patient') ?>: ________________________________________ &nbsp;
98 <?php echo xlt('Clinic') ?>: ____________________ &nbsp;
99 <?php echo xlt('Date') ?>: ____________________<br />&nbsp;<br />
100 </span>
102 <?php
104 function end_cell() {
105 global $item_count, $cell_count;
106 if ($item_count > 0) {
107 echo "</td>";
108 $item_count = 0;
112 function end_row() {
113 global $cell_count, $CPR;
114 end_cell();
115 if ($cell_count > 0) {
116 for (; $cell_count < $CPR; ++$cell_count) echo "<td></td>";
117 echo "</tr>\n";
118 $cell_count = 0;
122 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 (isset($result[$field_id])) $currvalue = $result[$field_id];
146 // Handle a data category (group) change.
147 if (strcmp($this_group, $last_group) != 0) {
148 end_group();
149 if (strlen($last_group) > 0) echo "<br />\n";
150 $group_name = substr($this_group, 1);
151 $last_group = $this_group;
152 echo "<b>" . text(xl_layout_label($group_name)) . "</b>\n";
154 echo "<div class='section'>\n";
155 echo " <table border='0' cellpadding='0'>\n";
158 // Handle starting of a new row.
159 if (($titlecols > 0 && $cell_count >= $CPR) || $cell_count == 0) {
160 end_row();
161 echo " <tr style='height:30pt'>";
164 if ($item_count == 0 && $titlecols == 0) $titlecols = 1;
166 // Handle starting of a new label cell.
167 if ($titlecols > 0) {
168 end_cell();
169 echo "<td colspan='" . attr($titlecols) . "' width='10%'";
170 echo ($frow['uor'] == 2) ? " class='required'" : " class='bold'";
171 if ($cell_count == 2) echo " style='padding-left:10pt'";
172 echo ">";
173 $cell_count += $titlecols;
175 ++$item_count;
177 echo "<b>";
179 if ($frow['title']) echo (text(xl_layout_label($frow['title'])) . ":"); else echo "&nbsp;";
181 echo "</b>";
183 // Handle starting of a new data cell.
184 if ($datacols > 0) {
185 end_cell();
186 echo "<td colspan='" . attr($datacols) . "' width='40%'";
187 if ($data_type < 21 || $data_type > 25) echo " class='under'";
188 if ($cell_count > 0) echo " style='padding-left:5pt;'";
189 echo ">";
190 $cell_count += $datacols;
193 ++$item_count;
194 generate_print_field($frow, $currvalue);
197 end_group();
200 </form>
202 <!-- This should really be in the onload handler but that seems to be unreliable and can crash Firefox 3. -->
203 <script language='JavaScript'>
204 var win = top.printLogPrint ? top : opener.top;
205 win.printLogPrint(window);
206 </script>
208 </body>
209 </html>