added a line for pt/clinic/date
[openemr.git] / interface / forms / LBF / printable.php
blobac9beb1a9ddc050e8bc35a0b03016784beb5bfe4
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 require_once("../../globals.php");
10 require_once("$srcdir/acl.inc");
11 require_once("$srcdir/options.inc.php");
12 require_once("$srcdir/patient.inc");
14 $CPR = 4; // cells per row
16 // The form name is passed to us as a GET parameter.
17 $formname = formData('formname', 'G');
19 $tmp = sqlQuery("SELECT title FROM list_options WHERE " .
20 "list_id = 'lbfnames' AND option_id = '$formname' LIMIT 1");
21 $formtitle = $tmp['title'];
23 $fres = sqlStatement("SELECT * FROM layout_options " .
24 "WHERE form_id = '$formname' AND uor > 0 " .
25 "ORDER BY group_name, seq");
27 <html>
28 <head>
29 <?php html_header_show();?>
31 <style>
32 body, td {
33 font-family: Arial, Helvetica, sans-serif;
34 font-weight: normal;
35 font-size: 9pt;
38 body {
39 padding: 5pt 5pt 5pt 5pt;
42 div.section {
43 border-style: solid;
44 border-width: 1px;
45 border-color: #000000;
46 margin: 0 0 0 10pt;
47 padding: 5pt;
50 .mainhead {
51 font-weight: bold;
52 font-size: 14pt;
53 text-align: center;
56 .subhead {
57 font-weight: bold;
58 font-size: 8pt;
61 .under {
62 border-style: solid;
63 border-width: 0 0 1px 0;
64 border-color: #999999;
67 .ftitletable {
68 width: 100%;
69 margin: 0 0 8pt 0;
71 .ftitlecell1 {
72 vertical-align: top;
73 text-align: left;
74 font-size: 14pt;
75 font-weight: bold;
77 .ftitlecell2 {
78 vertical-align: top;
79 text-align: right;
80 font-size: 9pt;
82 </style>
83 </head>
85 <body bgcolor='#ffffff'>
86 <form>
88 <?php echo genFacilityTitle($formtitle, -1); ?>
90 <span class='subhead'>
91 <?php xl('Patient','e') ?>: ________________________________________ &nbsp;
92 <?php xl('Clinic','e') ?>: ____________________ &nbsp;
93 <?php xl('Date','e') ?>: ____________________<br />&nbsp;<br />
94 </span>
96 <?php
98 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() {
107 global $cell_count, $CPR;
108 end_cell();
109 if ($cell_count > 0) {
110 for (; $cell_count < $CPR; ++$cell_count) echo "<td></td>";
111 echo "</tr>\n";
112 $cell_count = 0;
116 function end_group() {
117 global $last_group;
118 if (strlen($last_group) > 0) {
119 end_row();
120 echo " </table>\n";
121 echo "</div>\n";
125 $last_group = '';
126 $cell_count = 0;
127 $item_count = 0;
129 while ($frow = sqlFetchArray($fres)) {
130 $this_group = $frow['group_name'];
131 $titlecols = $frow['titlecols'];
132 $datacols = $frow['datacols'];
133 $data_type = $frow['data_type'];
134 $field_id = $frow['field_id'];
135 $list_id = $frow['list_id'];
136 $currvalue = '';
138 // if (isset($result[$field_id])) $currvalue = $result[$field_id];
140 // Handle a data category (group) change.
141 if (strcmp($this_group, $last_group) != 0) {
142 end_group();
143 if (strlen($last_group) > 0) echo "<br />\n";
144 $group_name = substr($this_group, 1);
145 $last_group = $this_group;
146 echo "<b>" . xl_layout_label($group_name) . "</b>\n";
148 echo "<div class='section'>\n";
149 echo " <table border='0' cellpadding='0'>\n";
152 // Handle starting of a new row.
153 if (($titlecols > 0 && $cell_count >= $CPR) || $cell_count == 0) {
154 end_row();
155 echo " <tr style='height:30pt'>";
158 if ($item_count == 0 && $titlecols == 0) $titlecols = 1;
160 // Handle starting of a new label cell.
161 if ($titlecols > 0) {
162 end_cell();
163 echo "<td colspan='$titlecols' width='10%'";
164 echo ($frow['uor'] == 2) ? " class='required'" : " class='bold'";
165 if ($cell_count == 2) echo " style='padding-left:10pt'";
166 echo ">";
167 $cell_count += $titlecols;
169 ++$item_count;
171 echo "<b>";
173 if ($frow['title']) echo (xl_layout_label($frow['title']) . ":"); else echo "&nbsp;";
175 echo "</b>";
177 // Handle starting of a new data cell.
178 if ($datacols > 0) {
179 end_cell();
180 echo "<td colspan='$datacols' width='40%'";
181 if ($data_type < 21 || $data_type > 25) echo " class='under'";
182 if ($cell_count > 0) echo " style='padding-left:5pt;'";
183 echo ">";
184 $cell_count += $datacols;
187 ++$item_count;
188 generate_print_field($frow, $currvalue);
191 end_group();
194 </form>
196 <!-- This should really be in the onload handler but that seems to be unreliable and can crash Firefox 3. -->
197 <script language='JavaScript'>
198 window.print();
199 </script>
201 </body>
202 </html>