2 // Copyright (C) 2008-2010 Rod Roark <rod@sunsetsystems.com>
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 // This reports checkins and checkouts for a specified patient's chart.
10 $fake_register_globals=false;
11 $sanitize_all_escapes=true;
13 require_once("../globals.php");
14 require_once("$srcdir/patient.inc");
15 require_once("$srcdir/options.inc.php");
16 require_once("$srcdir/formatting.inc.php");
18 $form_patient_id = trim($_POST['form_patient_id']);
22 <?php
html_header_show(); ?
>
23 <title
><?php
xl('Chart Location Activity','e'); ?
></title
>
25 <link rel
='stylesheet' href
='<?php echo $css_header ?>' type
='text/css'>
26 <style type
="text/css">
28 /* specifically include & exclude from printing */
34 #report_parameters_daterange {
38 #report_results table {
43 /* specifically exclude some from the screen */
45 #report_parameters_daterange {
53 <script type
="text/javascript" src
="../../library/js/jquery.1.3.2.js"></script
>
57 <body
class="body_top">
59 <span
class='title'><?php
xl('Report','e'); ?
> - <?php
xl('Chart Location Activity','e'); ?
></span
>
64 if (!empty($form_patient_id)) {
65 $query = "SELECT pid, pubpid, fname, mname, lname FROM patient_data WHERE " .
66 "pubpid = ? ORDER BY pid LIMIT 1";
67 $ptrow = sqlQuery($query,array($form_patient_id));
70 echo "<font color='red'>" . xl('Chart ID') . " '" . $form_patient_id . "' " . xl('not found!') . "</font><br /> <br />";
73 $curr_pid = $ptrow['pid'];
76 else if (!empty($curr_pid)) {
77 $query = "SELECT pid, pubpid, fname, mname, lname FROM patient_data WHERE " .
79 $ptrow = sqlQuery($query,array($curr_pid));
80 $form_patient_id = $ptrow['pubpid'];
83 echo '<span class="title">' . xl('for','','',' ');
84 echo $ptrow['lname'] . ', ' . $ptrow['fname'] . ' ' . $ptrow['mname'] . ' ';
85 echo "(" . $ptrow['pubpid'] . ")";
90 <div id
="report_parameters_daterange">
93 <form name
='theform' id
='theform' method
='post' action
='chart_location_activity.php'>
95 <div id
="report_parameters">
97 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>
101 <div style
='float:left'>
106 <?php
xl('Patient ID','e'); ?
>:
109 <input type
='text' name
='form_patient_id' size
='10' maxlength
='31' value
='<?php echo $form_patient_id ?>'
110 title
='<?php xl('Patient ID
','e
'); ?>' />
118 <td align
='left' valign
='middle' height
="100%">
119 <table style
='border-left:1px solid; width:100%; height:100%' >
122 <div style
='margin-left:15px'>
123 <a href
='#' class='css_button' onclick
='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
125 <?php
xl('Submit','e'); ?
>
129 <?php
if ($_POST['form_refresh'] ||
!empty($ptrow) ) { ?
>
130 <a href
='#' class='css_button' onclick
='window.print()'>
132 <?php
xl('Print','e'); ?
>
144 </div
> <!-- end of parameters
-->
147 if ($_POST['form_refresh'] ||
!empty($ptrow) ) {
149 <div id
="report_results">
152 <th
> <?php
xl('Time','e'); ?
> </th
>
153 <th
> <?php
xl('Destination','e'); ?
> </th
>
158 if (!empty($ptrow)) {
159 $query = "SELECT ct.ct_when, ct.ct_userid, ct.ct_location, " .
160 "u.username, u.fname, u.mname, u.lname " .
161 "FROM chart_tracker AS ct " .
162 "LEFT OUTER JOIN users AS u ON u.id = ct.ct_userid " .
163 "WHERE ct.ct_pid = '$curr_pid' " .
164 "ORDER BY ct.ct_when DESC";
165 $res = sqlStatement($query);
167 while ($row = sqlFetchArray($res)) {
171 <?php
echo oeFormatShortDate(substr($row['ct_when'], 0, 10)) . substr($row['ct_when'], 10); ?
>
175 if (!empty($row['ct_location'])) {
176 echo generate_display_field(array('data_type'=>'1','list_id'=>'chartloc'),$row['ct_location']);
178 else if (!empty($row['ct_userid'])) {
179 echo $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname'];
190 </div
> <!-- end of results
-->
193 <?php
echo xl('Please input search criteria above, and click Submit to view results.', 'e' ); ?
>