2 // Copyright (C) 2008 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 feature requires a new list:
11 // INSERT INTO list_options VALUES ('lists','chartloc','Chart Storage Locations',51,0,0);
13 require_once("../interface/globals.php");
14 require_once("$srcdir/acl.inc");
15 require_once("$srcdir/options.inc.php");
17 $form_newid = isset($_POST['form_newid' ]) ?
trim($_POST['form_newid' ]) : '';
18 $form_curpid = isset($_POST['form_curpid' ]) ?
trim($_POST['form_curpid' ]) : '';
19 $form_curid = isset($_POST['form_curid' ]) ?
trim($_POST['form_curid' ]) : '';
20 $form_newloc = isset($_POST['form_newloc' ]) ?
trim($_POST['form_newloc' ]) : '';
21 $form_newuser = isset($_POST['form_newuser']) ?
trim($_POST['form_newuser']) : '';
23 if ($form_newuser) $form_newloc = ''; else $form_newuser = 0;
28 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
29 <title
><?php
xl('Chart Tracker','e'); ?
></title
>
31 <script language
="JavaScript">
33 function locationSelect() {
34 var f
= document
.forms
[0];
35 var i
= f
.form_newloc
.selectedIndex
;
37 f
.form_newuser
.selectedIndex
= 0;
41 function userSelect() {
42 var f
= document
.forms
[0];
43 var i
= f
.form_newuser
.selectedIndex
;
45 f
.form_newloc
.selectedIndex
= 0;
53 <body
class="body_top">
56 echo "<span class='title'>" . xl('Chart Tracker') . "</span>\n";
61 <form method
='post' action
='chart_tracker.php'>
64 // This is the place for status messages.
66 if ($form_newloc ||
$form_newuser) {
67 $query = "INSERT INTO chart_tracker ( " .
68 "ct_pid, ct_when, ct_userid, ct_location " .
71 "'" . date('Y-m-d H:i:s') . "', " .
76 echo "<font color='green'>" . xl('Save Successful for chart ID','','',' ') . "'$form_curid'.</font><br />";
82 // Find out where the chart is now.
83 $query = "SELECT pd.pid, pd.pubpid, pd.fname, pd.mname, pd.lname, " .
84 "pd.ss, pd.DOB, ct.ct_userid, ct.ct_location, ct.ct_when " .
85 "FROM patient_data AS pd " .
86 "LEFT OUTER JOIN chart_tracker AS ct ON ct.ct_pid = pd.pid " .
87 "WHERE pd.pubpid = '$form_newid' " .
88 "ORDER BY pd.pid ASC, ct.ct_when DESC LIMIT 1";
89 $row = sqlQuery($query);
91 echo "<font color='red'>" . xl('Chart ID','','',' ') . "'$form_newid'" . xl('not found','',' ','') . "!</font><br />";
100 $ct_userid = $row['ct_userid'];
101 $ct_location = $row['ct_location'];
102 $current_location = xl('Unassigned');
104 $urow = sqlQuery("SELECT fname, mname, lname FROM users WHERE id = '$ct_userid'");
105 $current_location = $urow['lname'] . ", " . $urow['fname'] . " " . $urow['mname'] .
106 " " . $row['ct_when'];
108 else if ($ct_location) {
109 $current_location = generate_display_field(array('data_type'=>'1','list_id'=>'chartloc'),$ct_location);
113 echo " <td class='bold'>" . xl('Patient ID') . ":</td>\n";
114 echo " <td class='text'>" . $row['pubpid'] .
115 "<input type='hidden' name='form_curpid' value='" . $row['pid'] . "' />" .
116 "<input type='hidden' name='form_curid' value='" . $row['pubpid'] . "' /></td>\n";
120 echo " <td class='bold'>" . xl('Name') . ":</td>\n";
121 echo " <td class='text'>" . $row['lname'] . ", " . $row['fname'] . " " . $row['mname'] . "</td>\n";
125 echo " <td class='bold'>" . xl('DOB') . ":</td>\n";
126 echo " <td class='text'>" . $row['DOB'] . "</td>\n";
130 echo " <td class='bold'>" . xl('SSN') . ":</td>\n";
131 echo " <td class='text'>" . $row['ss'] . "</td>\n";
135 echo " <td class='bold'>" . xl('Current Location') . ":</td>\n";
136 echo " <td class='text'>$current_location</td>\n";
140 echo " <td class='bold'>" . xl('Check In To') . ":</td>\n";
141 echo " <td class='text'>";
142 generate_form_field(array('data_type'=>1,'field_id'=>'newloc','list_id'=>'chartloc','empty_title'=>''), '');
147 echo " <td class='bold'>" . xl('Or Out To') . ":</td>\n";
148 echo " <td class='text'><select name='form_newuser' onchange='userSelect()'>\n";
149 echo " <option value=''></option>";
150 $ures = sqlStatement("SELECT id, fname, mname, lname FROM users " .
151 "WHERE username != '' AND active = 1 ORDER BY lname, fname, mname");
152 while ($urow = sqlFetchArray($ures)) {
153 echo " <option value='" . $urow['id'] . "'";
154 echo ">" . $urow['lname'] . ', ' . $urow['fname'] . ' ' . $urow['mname'] .
157 echo " </select></td>\n";
161 echo " <td> </td>\n";
162 echo " <td class='text'><input type='submit' name='form_save' value=" . xl('Save','','\'','\'') . " /></td>\n";
166 echo " <td class='text' colspan='2'> </td>\n";
173 <?php
xl('New Patient ID','e'); ?
>:  
;
176 <input type
='text' name
='form_newid' size
='10' value
=''
177 class='inputtext' title
='<?php xl("Type or scan the patient identifier here","e") ?>' />
182 <td
class='bold'> 
;</td
>
184 <input type
='submit' class='button' name
='form_lookup' value
='<?php xl("Look Up","e"); ?>' />