4 $sanitize_all_escapes=true;
7 //STOP FAKE REGISTER GLOBALS
8 $fake_register_globals=false;
11 include_once("../../globals.php");
12 include_once("$srcdir/lists.inc");
13 include_once("$srcdir/acl.inc");
14 include_once("$srcdir/options.inc.php");
15 include_once("$srcdir/formdata.inc.php");
19 <div id
="patient_stats_summary">
22 $thisauth = acl_check('patients', 'med');
24 $tmp = getPatientData($pid, "squad");
25 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
29 echo "<p>(".htmlspecialchars(xl('Issues not authorized'),ENT_NOQUOTES
).")</p>\n";
30 echo "</body>\n</html>\n";
35 <script type
='text/javascript'>
36 function load_location( location
) {
38 if ( !top
.frames
["RTop"] ) {
39 document
.location
=location
;
41 top
.frames
["RTop"].location
=location
;
46 <table id
="patient_stats_issues">
51 foreach ($ISSUE_TYPES as $key => $arr) {
52 // $result = getListByType($pid, $key, "id,title,begdate,enddate,returndate,extrainfo", "all", "all", 0);
54 $query = "SELECT * FROM lists WHERE pid = ? AND type = ? AND ";
55 $query .= "enddate IS NULL ";
56 $query .= "ORDER BY begdate";
57 $pres = sqlStatement($query, array($pid, $key) );
59 if (sqlNumRows($pres) > 0 ||
$ix == 0) {
61 // output a header for the $ISSUE_TYPE
62 echo " <tr class='issuetitle'>\n";
63 echo " <td colspan='$numcols'>\n";
66 <span
class="text"><b
><?php
echo htmlspecialchars($arr[0],ENT_NOQUOTES
); ?
></b
></span
>
67 <a href
="javascript:;" class="small" onclick
="load_location('stats_full.php?active=all')">
68 (<b
><?php
echo htmlspecialchars(xl('Manage'),ENT_NOQUOTES
); ?
></b
>)
75 while ($row = sqlFetchArray($pres)) {
76 // output each issue for the $ISSUE_TYPE
77 if (!$row['enddate'] && !$row['returndate'])
78 $rowclass="noend_noreturn";
79 else if (!$row['enddate'] && $row['returndate'])
81 else if ($row['enddate'] && !$row['returndate'])
82 $rowclass = "noreturn";
84 echo " <tr class='text $rowclass;'>\n";
86 echo " <td colspan='$numcols'> " . htmlspecialchars($row['title'],ENT_NOQUOTES
) . "</td>\n";
95 </table
> <!-- end patient_stats_issues
-->
97 <table id
="patient_stats_spreadsheets">
100 // Show spreadsheet forms if any are present.
103 foreach (array('treatment_protocols','injury_log') as $formname) {
104 if (sqlNumRows(sqlStatement("SHOW TABLES LIKE ?", array("form_".$formname) )) > 0) {
105 $dres = sqlStatement("SELECT tp.id, tp.value FROM forms, " .
106 "form_" . add_escape_custom($formname) .
107 " AS tp WHERE forms.pid = ? AND " .
108 "forms.formdir = ? AND tp.id = forms.form_id AND " .
109 "tp.rownbr = -1 AND tp.colnbr = -1 AND tp.value LIKE '0%' " .
110 "ORDER BY tp.value DESC", array($pid, $formname) );
111 if (sqlNumRows($dres) > 0 && $need_head) {
114 echo " <td colspan='$numcols' valign='top'>\n";
115 echo " <span class='title'>Injury Log</span>\n";
119 while ($row = sqlFetchArray($dres)) {
120 list($completed, $start_date, $template_name) = explode('|', $row['value'], 3);
122 echo " <td colspan='$numcols'> ";
123 echo "<a class='link' href='javascript:;' ";
124 echo "onclick='load_location(\"../../forms/$formname/new.php?popup=1&id=";
125 echo htmlspecialchars($row['id'],ENT_QUOTES
) . "\")'>" .
126 htmlspecialchars($start_date,ENT_NOQUOTES
) . " " .
127 htmlspecialchars($template_name,ENT_NOQUOTES
) . "</a></td>\n";
133 </table
> <!-- end patient_stats_spreadsheets
-->
135 <?php
if (!$GLOBALS['disable_immunizations'] && !$GLOBALS['weight_loss_clinic']) { ?
>
137 <table id
="patient_stats_imm">
139 <td colspan
='<?php echo $numcols ?>' valign
='top'>
140 <span
class="text"><b
><?php
echo htmlspecialchars(xl('Immunizations', 'e'),ENT_NOQUOTES
); ?
></b
></span
>
141 <a href
="javascript:;" class="small" onclick
="javascript:load_location('immunizations.php')">
142 (<b
><?php
echo htmlspecialchars(xl('Manage'),ENT_NOQUOTES
) ?
></b
>)
148 $sql = "select i1.id as id, i1.immunization_id as immunization_id,".
149 " if (i1.administered_date, concat(i1.administered_date,' - '), substring(i1.note,1,20)) as immunization_data ".
150 " from immunizations i1 ".
151 " where i1.patient_id = ? ".
152 " order by i1.immunization_id, i1.administered_date desc";
154 $result = sqlStatement($sql, array($pid) );
156 while ($row=sqlFetchArray($result)){
158 echo "<a class='link'";
159 echo "' href='javascript:;' onclick='javascript:load_location(\"immunizations.php?mode=edit&id=".htmlspecialchars($row['id'],ENT_QUOTES
) . "\")'>" .
160 htmlspecialchars($row{'immunization_data'},ENT_NOQUOTES
) .
161 generate_display_field(array('data_type'=>'1','list_id'=>'immunizations'), $row['immunization_id']) .
167 </table
> <!-- end patient_stats_imm
-->
171 <?php
if (!$GLOBALS['disable_prescriptions']) { ?
>
173 <table id
="patient_stats_prescriptions">
174 <tr
><td colspan
='<?php echo $numcols ?>' class='issuetitle'>
175 <span
class='text'><b
><?php
echo htmlspecialchars(xl('Prescriptions'),ENT_NOQUOTES
); ?
></b
></span
>
176 <?php
if ($_POST['embeddedScreen']) { ?
>
177 <a href
="rx_frameset.php" class='iframe rx_modal small' onclick
='top.restoreSession()'>
178 (<b
><?php
echo htmlspecialchars(xl('Manage'),ENT_NOQUOTES
); ?
>)</b
></a
>
185 require_once("library/classes/Controller.class.php");
186 $c = new Controller();
187 echo $c->act(array("prescription" => "", "fragment" => "", "patient_id" => $pid));
190 </table
> <!-- end patient_stats_prescriptions
-->
194 </div
> <!-- end patient_stats_summary
-->