translation patches from Dr. Bosman and his crew
[openemr.git] / interface / patient_file / summary / stats.php
blobdac07ae5eb95ac2592f1c2a5afb987da08d54dc1
1 <?php
2 include_once("../../globals.php");
3 include_once("$srcdir/lists.inc");
4 include_once("$srcdir/acl.inc");
5 ?>
6 <html>
8 <head>
9 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
10 <style>
11 .link {
12 font-family: sans-serif;
13 text-decoration: none;
14 /* color: #000000; */
15 font-size: 8pt;
17 </style>
18 </head>
20 <body <?echo $bottom_bg_line;?> topmargin='0' rightmargin='0' leftmargin='2'
21 bottommargin='0' marginwidth='2' marginheight='0'>
23 <?php
24 $thisauth = acl_check('patients', 'med');
25 if ($thisauth) {
26 $tmp = getPatientData($pid, "squad");
27 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
28 $thisauth = 0;
30 if (!$thisauth) {
31 echo "<p>(".xl('Issues not authorized').")</p>\n";
32 echo "</body>\n</html>\n";
33 exit();
37 <table cellpadding='0' cellspacing='0'>
39 <?php
40 $numcols = $GLOBALS['athletic_team'] ? '7' : '1';
41 $ix = 0;
42 foreach ($ISSUE_TYPES as $key => $arr) {
43 // $result = getListByType($pid, $key, "id,title,begdate,enddate,returndate,extrainfo", "all", "all", 0);
45 $query = "SELECT * FROM lists WHERE pid = $pid AND type = '$key' AND ";
46 if ($GLOBALS['athletic_team']) {
47 $query .= "( enddate IS NULL OR returndate IS NULL ) ";
48 } else {
49 $query .= "enddate IS NULL ";
51 $query .= "ORDER BY begdate";
52 $pres = sqlStatement($query);
54 if (mysql_num_rows($pres) > 0 || $ix == 0) {
55 echo " <tr>\n";
56 echo " <td colspan='$numcols' valign='top'>\n";
57 echo " <a href='stats_full.php?active=all' target='";
58 echo $GLOBALS['concurrent_layout'] ? "_parent" : "Main";
59 echo "'><font class='title'>" .
60 $arr[0] . "</font><font class='more'>$tmore</font></a>\n";
61 echo " </td>\n";
62 echo " </tr>\n";
64 // Show headers if this is a long line.
65 if ($GLOBALS['athletic_team'] && $arr[3] == 0 && mysql_num_rows($pres) > 0) {
66 echo " <tr>\n";
67 echo " <td class='link'>&nbsp;&nbsp;<b>" .xl('Title'). "</b></td>\n";
68 echo " <td class='link'>&nbsp;<b>" .xl('Diag'). "</b></td>\n";
69 echo " <td class='link'>&nbsp;<b>" .xl('Start'). "</b></td>\n";
70 echo " <td class='link'>&nbsp;<b>" .xl('Return'). "</b></td>\n";
71 echo " <td class='link'>&nbsp;<b>" .xl('Games'). "</b></td>\n";
72 echo " <td class='link' align='right'>&nbsp;<b>" .xl('Days'). "</b></td>\n";
73 echo " <td class='link' align='right'>&nbsp;<b>" .xl('Enc'). "</b></td>\n";
74 echo " </tr>\n";
77 while ($row = sqlFetchArray($pres)) {
78 $rowcolor = '#000000';
79 if (!$row['enddate'] && !$row['returndate'])
80 $rowcolor = '#ee0000';
81 else if (!$row['enddate'] && $row['returndate'])
82 $rowcolor = '#dd5500';
83 else if ($row['enddate'] && !$row['returndate'])
84 $rowcolor = '#0000ff';
86 echo " <tr style='color:$rowcolor;'>\n";
88 if ($GLOBALS['athletic_team'] && $arr[3] == 0) {
89 $endsecs = $row['returndate'] ? strtotime($row['returndate']) : time();
90 $daysmissed = round(($endsecs - strtotime($row['begdate'])) / (60 * 60 * 24));
91 $ierow = sqlQuery("SELECT count(*) AS count FROM issue_encounter " .
92 "WHERE list_id = '" . $row['id'] . "'");
93 // echo " <td><a class='link' target='Main' href='stats_full.php?active=1'>" .
94 // $row['title'] . "</a></td>\n";
95 echo " <td class='link' style='color:$rowcolor;'>&nbsp;&nbsp;" . $row['title'] . "</td>\n";
96 echo " <td class='link' style='color:$rowcolor;'>&nbsp;" . $row['diagnosis'] . "</td>\n";
97 echo " <td class='link' style='color:$rowcolor;'>&nbsp;" . $row['begdate'] . "</td>\n";
98 echo " <td class='link' style='color:$rowcolor;'>&nbsp;" . $row['returndate'] . "</td>\n";
99 echo " <td class='link' style='color:$rowcolor;'>&nbsp;" . $row['extrainfo'] . "</td>\n";
100 echo " <td class='link' style='color:$rowcolor;' align='right'>&nbsp;$daysmissed</td>\n";
101 echo " <td class='link' style='color:$rowcolor;' align='right'>&nbsp;" . $ierow['count'] . "</td>\n";
102 } else {
103 echo " <td colspan='$numcols' class='link'>&nbsp;&nbsp;" . $row['title'] . "</td>\n";
106 echo " </tr>\n";
108 // echo " </td>\n";
109 // echo " </tr>\n";
112 ++$ix;
115 // Show treatments if any are present.
117 if (mysql_num_rows(sqlStatement("SHOW TABLES LIKE 'form_treatment_protocols'")) > 0) {
118 $dres = sqlStatement("SELECT tp.id, tp.value FROM forms, " .
119 "form_treatment_protocols AS tp WHERE forms.pid = $pid AND " .
120 "forms.formdir = 'treatment_protocols' AND tp.id = forms.form_id AND " .
121 "tp.rownbr = -1 AND tp.colnbr = -1 AND tp.value LIKE '0%' " .
122 "ORDER BY tp.value DESC");
123 if (mysql_num_rows($dres) > 0) {
124 echo " <tr>\n";
125 echo " <td colspan='$numcols' valign='top'>\n";
126 echo " <font class='title'>Treatments</font>\n";
127 echo " </td>\n";
128 echo " </tr>\n";
129 while ($row = sqlFetchArray($dres)) {
130 list($completed, $start_date, $template_name) = explode('|', $row['value'], 3);
131 echo " <tr>\n";
132 echo " <td colspan='$numcols'>&nbsp;&nbsp;";
133 echo "<a class='link' target='_blank' ";
134 echo "href='../../forms/treatment_protocols/new.php?popup=1&id=";
135 echo $row['id'] . "'>$start_date $template_name</a></td>\n";
136 echo " </tr>\n";
142 <?php if (!$GLOBALS['weight_loss_clinic']) { ?>
143 <tr>
144 <td colspan='<?php echo $numcols ?>' valign='top'>
145 <a href="immunizations.php"
146 target="<?php echo $GLOBALS['concurrent_layout'] ? "_parent" : "Main"; ?>">
147 <font class="title"><? xl('Immunizations','e'); ?></font>
148 <font class=more><?echo $tmore;?></font></a><br>
150 <?php
151 $sql = "select if(i1.administered_date
152 ,concat(i1.administered_date,' - ',i2.name)
153 ,substring(i1.note,1,20)
154 ) as immunization_data
155 from immunizations i1
156 left join immunization i2
157 on i1.immunization_id = i2.id
158 where i1.patient_id = $pid
159 order by administered_date desc";
161 $result = sqlStatement($sql);
163 while ($row=sqlFetchArray($result)){
164 echo "<a class='link' target='";
165 echo $GLOBALS['concurrent_layout'] ? "_parent" : "Main";
166 echo "' href='immunizations.php'>" . $row{'immunization_data'} . "</a><br>\n";
169 </td>
170 </tr>
171 <?php } ?>
173 <tr>
174 <td colspan='<?php echo $numcols ?>' valign='top'>
175 <?php
176 $cwd= getcwd();
177 chdir("../../../");
178 require_once("library/classes/Controller.class.php");
179 $c = new Controller();
180 echo '<font class="title">'.xl('Prescriptions').'</font>';
181 echo $c->act(array("prescription" => "", "block" => "", "patient_id" => $pid));
183 </td>
184 </tr>
185 </table>
187 </body>
188 </html>