3 * This feature requires a new list:
5 * INSERT INTO list_options VALUES ('lists','chartloc','Chart Storage Locations',51,0,0);
8 * Copyright (C) 2008-2012 Rod Roark <rod@sunsetsystems.com>
10 * LICENSE: This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
22 * @author Rod Roark <rod@sunsetsystems.com>
23 * @author Brady Miller <brady.g.miller@gmail.com>
24 * @link http://www.open-emr.org
27 $fake_register_globals=false;
28 $sanitize_all_escapes=true;
30 require_once("../interface/globals.php");
31 require_once("$srcdir/acl.inc");
32 require_once("$srcdir/options.inc.php");
34 $form_newid = isset($_POST['form_newid' ]) ?
trim($_POST['form_newid' ]) : '';
35 $form_curpid = isset($_POST['form_curpid' ]) ?
trim($_POST['form_curpid' ]) : '';
36 $form_curid = isset($_POST['form_curid' ]) ?
trim($_POST['form_curid' ]) : '';
37 $form_newloc = isset($_POST['form_newloc' ]) ?
trim($_POST['form_newloc' ]) : '';
38 $form_newuser = isset($_POST['form_newuser']) ?
trim($_POST['form_newuser']) : '';
40 if ($form_newuser) $form_newloc = ''; else $form_newuser = 0;
45 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
46 <title
><?php
echo xlt('Chart Tracker'); ?
></title
>
48 <script language
="JavaScript">
50 function locationSelect() {
51 var f
= document
.forms
[0];
52 var i
= f
.form_newloc
.selectedIndex
;
54 f
.form_newuser
.selectedIndex
= 0;
58 function userSelect() {
59 var f
= document
.forms
[0];
60 var i
= f
.form_newuser
.selectedIndex
;
62 f
.form_newloc
.selectedIndex
= 0;
70 <body
class="body_top">
73 echo "<span class='title'>" . xlt('Chart Tracker') . "</span>\n";
78 <form method
='post' action
='chart_tracker.php' onsubmit
='return top.restoreSession()'>
81 // This is the place for status messages.
83 if ($form_newloc ||
$form_newuser) {
84 $query = "INSERT INTO chart_tracker ( " .
85 "ct_pid, ct_when, ct_userid, ct_location " .
92 sqlInsert($query, array($form_curpid,date('Y-m-d H:i:s'),$form_newuser,$form_newloc) );
93 echo "<font color='green'>" . xlt('Save Successful for chart ID') . " " . "'" . text($form_curid) . "'.</font><br />";
99 // Find out where the chart is now.
100 $query = "SELECT pd.pid, pd.pubpid, pd.fname, pd.mname, pd.lname, " .
101 "pd.ss, pd.DOB, ct.ct_userid, ct.ct_location, ct.ct_when " .
102 "FROM patient_data AS pd " .
103 "LEFT OUTER JOIN chart_tracker AS ct ON ct.ct_pid = pd.pid " .
104 "WHERE pd.pubpid = ? " .
105 "ORDER BY pd.pid ASC, ct.ct_when DESC LIMIT 1";
106 $row = sqlQuery($query, array($form_newid) );
108 echo "<font color='red'>" . xlt('Chart ID') . " " . "'" . text($form_newid) . "' " . xlt('not found') . "!</font><br />";
117 $ct_userid = $row['ct_userid'];
118 $ct_location = $row['ct_location'];
119 $current_location = xlt('Unassigned');
121 $urow = sqlQuery("SELECT fname, mname, lname FROM users WHERE id = ?", array($ct_userid) );
122 $current_location = text( $urow['lname'] . ", " . $urow['fname'] . " " . $urow['mname'] . " " . $row['ct_when'] );
124 else if ($ct_location) {
125 $current_location = generate_display_field(array('data_type'=>'1','list_id'=>'chartloc'),$ct_location);
129 echo " <td class='bold'>" . xlt('Patient ID') . ":</td>\n";
130 echo " <td class='text'>" . text($row['pubpid']) .
131 "<input type='hidden' name='form_curpid' value='" . attr($row['pid']) . "' />" .
132 "<input type='hidden' name='form_curid' value='" . attr($row['pubpid']) . "' /></td>\n";
136 echo " <td class='bold'>" . xlt('Name') . ":</td>\n";
137 echo " <td class='text'>" . text( $row['lname'] . ", " . $row['fname'] . " " . $row['mname'] ) . "</td>\n";
141 echo " <td class='bold'>" . xlt('DOB') . ":</td>\n";
142 echo " <td class='text'>" . text($row['DOB']) . "</td>\n";
146 echo " <td class='bold'>" . xlt('SSN') . ":</td>\n";
147 echo " <td class='text'>" . text($row['ss']) . "</td>\n";
151 echo " <td class='bold'>" . xlt('Current Location') . ":</td>\n";
152 // Note that $current_location has already been html escaped
153 echo " <td class='text'>$current_location</td>\n";
157 echo " <td class='bold'>" . xlt('Check In To') . ":</td>\n";
158 echo " <td class='text'>";
159 generate_form_field(array('data_type'=>1,'field_id'=>'newloc','list_id'=>'chartloc','empty_title'=>''), '');
164 echo " <td class='bold'>" . xlt('Or Out To') . ":</td>\n";
165 echo " <td class='text'><select name='form_newuser' onchange='userSelect()'>\n";
166 echo " <option value=''></option>";
167 $ures = sqlStatement("SELECT id, fname, mname, lname FROM users " .
168 "WHERE username != '' AND active = 1 ORDER BY lname, fname, mname");
169 while ($urow = sqlFetchArray($ures)) {
170 echo " <option value='" . attr($urow['id']) . "'";
171 echo ">" . text($urow['lname']) . ', ' . text($urow['fname']) . ' ' . text($urow['mname']) .
174 echo " </select></td>\n";
178 echo " <td> </td>\n";
179 echo " <td class='text'><input type='submit' name='form_save' value='" . xlt('Save') . "' /></td>\n";
183 echo " <td class='text' colspan='2'> </td>\n";
190 <?php
echo xlt('New Patient ID'); ?
>:  
;
193 <input type
='text' name
='form_newid' size
='10' value
=''
194 class='inputtext' title
='<?php echo xla("Type or scan the patient identifier here") ?>' />
199 <td
class='bold'> 
;</td
>
201 <input type
='submit' class='button' name
='form_lookup' value
='<?php echo xla("Look Up"); ?>' />