Clickmap Graphical API and Pain Form
[openemr.git] / contrib / forms / cricket_injury_audit / report.php
blobc21a5d1da105390a9b4f0b42e78bbf9b66f850a9
1 <?php
3 // Copyright (C) 2006-2007 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 $ci_report_cols = 2;
14 $ci_report_colno = 0;
16 // Helper function used by cricket_injury_audit_report().
17 // Writes a title/value pair to a table cell.
19 function ci_report_item($title, $value) {
20 global $ci_report_cols, $ci_report_colno;
21 if (!$value) return;
22 if (++$ci_report_colno > $ci_report_cols) {
23 $ci_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 cricket_injury_audit_report($pid, $encounter, $cols, $id) {
35 global $ci_report_cols;
37 include('cia.inc.php');
39 $row = sqlQuery ("SELECT form_encounter.onset_date AS occdate, ci.* " .
40 "FROM forms, form_encounter, form_cricket_injury_audit AS ci WHERE " .
41 "forms.formdir = 'cricket_injury_audit' AND " .
42 "forms.form_id = '$id' AND " .
43 "ci.id = '$id' AND ci.activity = '1' AND " .
44 "form_encounter.encounter = forms.encounter AND " .
45 "form_encounter.pid = forms.pid");
47 if (!$row) return;
49 $ci_report_cols = $cols;
51 echo "<table cellpadding='0' cellspacing='0'>\n";
52 echo " <tr>\n";
54 ci_report_item("County" , $arr_county[$row['cicounty']]);
55 ci_report_item("Team" , $arr_team[$row['citeam']]);
56 ci_report_item("Duration" , $arr_duration[$row['ciduration']]);
57 ci_report_item("Role" , $arr_role[$row['cirole']]);
58 ci_report_item("Injured In", $arr_matchtype[$row['cimatchtype']]);
59 ci_report_item("Cause" , $arr_cause[$row['cicause']]);
60 ci_report_item("Activity" , $arr_activity[$row['ciactivity']]);
61 ci_report_item("Bat Side" , $arr_batside[$row['cibatside']]);
62 ci_report_item("Bowl Side" , $arr_bowlside[$row['cibowlside']]);
63 ci_report_item("Bowl Type" , $arr_bowltype[$row['cibowltype']]);
65 echo " </tr>\n";
66 echo "</table>\n";