Merge branch 'master' of git://github.com/openemr/openemr
[openemr.git] / contrib / forms / football_injury_audit / report.php
blob19fc4ae6c7ac92e4411cdfa2a349426c5ddf8352
1 <?php
3 // Copyright (C) 2006 Rod Roark <rod@sunsetsystems.com>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 include_once("../../globals.php");
11 include_once($GLOBALS["srcdir"] . "/api.inc");
13 $fi_report_cols = 2;
14 $fi_report_colno = 0;
16 // Helper function used by football_injury_audit_report().
17 // Writes a title/value pair to a table cell.
19 function fi_report_item($title, $value) {
20 global $fi_report_cols, $fi_report_colno;
21 if (!$value) return;
22 if (++$fi_report_colno > $fi_report_cols) {
23 $fi_report_colno = 1;
24 echo " </tr>\n <tr>\n";
26 echo " <td valign='top'><span class='bold'>$title: </span>" .
27 "<span class='text'>$value &nbsp;</span></td>\n";
30 // This function is invoked from printPatientForms in report.inc
31 // when viewing a "comprehensive patient report". Also from
32 // interface/patient_file/encounter/forms.php.
34 function football_injury_audit_report($pid, $encounter, $cols, $id) {
35 global $fi_report_cols;
37 include('fia.inc.php');
39 $row = sqlQuery ("SELECT form_encounter.onset_date AS occdate, fi.* " .
40 "FROM forms, form_encounter, form_football_injury_audit AS fi WHERE " .
41 "forms.formdir = 'football_injury_audit' AND " .
42 "forms.form_id = '$id' AND " .
43 "fi.id = '$id' AND fi.activity = '1' AND " .
44 "form_encounter.encounter = forms.encounter AND " .
45 "form_encounter.pid = forms.pid");
47 if (!$row) return;
49 $fi_report_cols = $cols;
51 echo "<table cellpadding='0' cellspacing='0'>\n";
52 echo " <tr>\n";
54 if ($row['fiinjmin'] ) fi_report_item("Min of Injury", $row['fiinjmin']);
55 if ($row['fiinjtime']) fi_report_item("During", $arr_injtime[$row['fiinjtime']]);
56 if ($row['fimatchtype']) fi_report_item("Match Type", $arr_match_type[$row['fimatchtype']]);
57 foreach ($arr_activity as $key => $value) {
58 if ($row["fimech_$key"]) fi_report_item("Mechanism", $value);
60 foreach ($arr_sanction as $key => $value) {
61 if ($row["fimech_$key"]) fi_report_item("Sanction", $value);
63 if ($row["fimech_othercon"]) fi_report_item("Other Contact", $row["fimech_othercon"]);
64 if ($row["fimech_othernon"]) fi_report_item("Other Noncontact", $row["fimech_othernon"]);
65 fi_report_item("Surface" , $arr_surface[$row['fisurface']]);
66 fi_report_item("Position" , $arr_position[$row['fiposition']]);
67 fi_report_item("Footwear" , $arr_footwear[$row['fifootwear']]);
68 fi_report_item("Side" , $arr_side[$row['fiside']]);
69 fi_report_item("Removed" , $arr_removed[$row['firemoved']]);
71 echo " </tr>\n";
72 echo "</table>\n";