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.
11 require_once("../globals.php");
12 require_once("$srcdir/patient.inc");
13 require_once("$srcdir/options.inc.php");
14 require_once("$srcdir/formatting.inc.php");
16 $form_patient_id = trim($_POST['form_patient_id']);
20 <?php
html_header_show(); ?
>
21 <title
><?php
xl('Chart Location Activity','e'); ?
></title
>
23 <link rel
='stylesheet' href
='<?php echo $css_header ?>' type
='text/css'>
24 <style type
="text/css">
26 /* specifically include & exclude from printing */
32 #report_parameters_daterange {
36 #report_results table {
41 /* specifically exclude some from the screen */
43 #report_parameters_daterange {
51 <script type
="text/javascript" src
="../../library/js/jquery.1.3.2.js"></script
>
55 <body
class="body_top">
57 <span
class='title'><?php
xl('Report','e'); ?
> - <?php
xl('Chart Location Activity','e'); ?
></span
>
62 if (!empty($form_patient_id)) {
63 $query = "SELECT pid, pubpid, fname, mname, lname FROM patient_data WHERE " .
64 "pubpid = '$form_patient_id' ORDER BY pid LIMIT 1";
65 $ptrow = sqlQuery($query);
68 echo "<font color='red'>" . xl('Chart ID') . " '" . $form_patient_id . "' " . xl('not found!') . "</font><br /> <br />";
71 $curr_pid = $ptrow['pid'];
74 else if (!empty($curr_pid)) {
75 $query = "SELECT pid, pubpid, fname, mname, lname FROM patient_data WHERE " .
77 $ptrow = sqlQuery($query);
78 $form_patient_id = $ptrow['pubpid'];
81 echo '<span class="title">' . xl('for','','',' ');
82 echo $ptrow['lname'] . ', ' . $ptrow['fname'] . ' ' . $ptrow['mname'] . ' ';
83 echo "(" . $ptrow['pubpid'] . ")";
88 <div id
="report_parameters_daterange">
91 <form name
='theform' id
='theform' method
='post' action
='chart_location_activity.php'>
93 <div id
="report_parameters">
95 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>
99 <div style
='float:left'>
104 <?php
xl('Patient ID','e'); ?
>:
107 <input type
='text' name
='form_patient_id' size
='10' maxlength
='31' value
='<?php echo $form_patient_id ?>'
108 title
='<?php xl('Patient ID
','e
'); ?>' />
116 <td align
='left' valign
='middle' height
="100%">
117 <table style
='border-left:1px solid; width:100%; height:100%' >
120 <div style
='margin-left:15px'>
121 <a href
='#' class='css_button' onclick
='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
123 <?php
xl('Submit','e'); ?
>
127 <?php
if ($_POST['form_refresh'] ||
!empty($ptrow) ) { ?
>
128 <a href
='#' class='css_button' onclick
='window.print()'>
130 <?php
xl('Print','e'); ?
>
142 </div
> <!-- end of parameters
-->
145 if ($_POST['form_refresh'] ||
!empty($ptrow) ) {
147 <div id
="report_results">
150 <th
> <?php
xl('Time','e'); ?
> </th
>
151 <th
> <?php
xl('Destination','e'); ?
> </th
>
156 if (!empty($ptrow)) {
157 $query = "SELECT ct.ct_when, ct.ct_userid, ct.ct_location, " .
158 "u.username, u.fname, u.mname, u.lname " .
159 "FROM chart_tracker AS ct " .
160 "LEFT OUTER JOIN users AS u ON u.id = ct.ct_userid " .
161 "WHERE ct.ct_pid = '$curr_pid' " .
162 "ORDER BY ct.ct_when DESC";
163 $res = sqlStatement($query);
165 while ($row = sqlFetchArray($res)) {
169 <?php
echo oeFormatShortDate(substr($row['ct_when'], 0, 10)) . substr($row['ct_when'], 10); ?
>
173 if (!empty($row['ct_location'])) {
174 echo generate_display_field(array('data_type'=>'1','list_id'=>'chartloc'),$row['ct_location']);
176 else if (!empty($row['ct_userid'])) {
177 echo $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname'];
188 </div
> <!-- end of results
-->
191 <?php
echo xl('Please input search criteria above, and click Submit to view results.', 'e' ); ?
>