forked from LibreHealthIO/lh-ehr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_appointments.php
110 lines (103 loc) · 4.42 KB
/
get_appointments.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
*
* Patient Portal Appointments
*
* Copyright (C) 2016-2017 Jerry Padgett <[email protected]>
* Copyright (C) 2011 Cassian LUP <[email protected]>
*
* LICENSE: This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http:https://opensource.org/licenses/gpl-license.php>;.
*
* LICENSE: This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0
* See the Mozilla Public License for more details.
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* @package LibreHealth EHR
* @author Cassian LUP <[email protected]>
* @author Jerry Padgett <[email protected]>
* @link http:https://librehealth.io
*
* Please help the overall project by sending changes you make to the authors and to the LibreEHR community.
*
*/
require_once("verify_session.php");
$query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " . "e.pc_startTime, e.pc_hometext, e.pc_apptstatus, u.fname, u.lname, u.mname, " .
"c.pc_catname " . "FROM libreehr_postcalendar_events AS e, users AS u, " .
"libreehr_postcalendar_categories AS c WHERE " . "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " . "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " . "ORDER BY e.pc_eventDate, e.pc_startTime";
$res = sqlStatement ( $query, array (
$pid
) );
if (sqlNumRows ( $res ) > 0) {
$count = 0;
echo '<table id="appttable" style="width:100%;background:#eee;" class="table table-striped fixedtable"><thead>
</thead><tbody>';
while ( $row = sqlFetchArray ( $res ) ) {
$count++;
$dayname = xl(date("l", strtotime($row['pc_eventDate'])));
$dispampm = "am";
$disphour = substr($row['pc_startTime'], 0, 2) + 0;
$dispmin = substr($row['pc_startTime'], 3, 2);
if ($disphour >= 12) {
$dispampm = "pm";
if ($disphour > 12)
$disphour -= 12;
}
if ($row['pc_hometext'] != "") {
$etitle = 'Comments'.": ".$row['pc_hometext']."\r\n";
} else {
$etitle = "";
}
echo "<tr><td><p>";
echo "<a href='#' onclick='editAppointment(0," . htmlspecialchars ( $row ['pc_eid'], ENT_QUOTES ) . ')' . "' title='" . htmlspecialchars ( $etitle, ENT_QUOTES ) . "'>";
echo "<b>" . htmlspecialchars ( $dayname . ", " . $row ['pc_eventDate'], ENT_NOQUOTES ) . "</b><br>";
echo htmlspecialchars ( "$disphour:$dispmin " . $dispampm . " " . $row ['pc_catname'], ENT_NOQUOTES ) . "<br>";
echo htmlspecialchars ( $row ['fname'] . " " . $row ['lname'], ENT_NOQUOTES ) . "<br>";
echo htmlspecialchars ( "Status: " . $row ['pc_apptstatus'] , ENT_NOQUOTES );
echo "</a></p></td></tr>";
}
if (isset ( $res ) && $res != null) {
if ($count < 1) {
echo " " . xlt('None');
}
}
} else { // if no appts
echo xlt('No Appointments');
}
echo '</tbody></table>';
?>
<div style='margin: 5px 0 5px'>
<a href='#' onclick="editAppointment('add',<?php echo attr($pid); ?>)"><button
class='btn btn-primary pull-right'><?php echo xlt('Schedule New Appointment'); ?></button></a>
</div>
<script>
function editAppointment(mode,deid){
if(mode == 'add'){
var title = '<?php echo xla('Request New Appointment'); ?>';
var mdata = {pid:deid};
}else{
var title = '<?php echo xla('Edit Appointment'); ?>';
var mdata = {eid:deid};
}
var params = {
buttons: [
{ text: '<?php echo xla('Cancel'); ?>', close: true, style: 'default' },
//{ text: 'Print', close: false, style: 'success', click: showCustom }
],
title: title,
url: './add_edit_event_user.php',
data: mdata
};
return eModal
.ajax(params)
.then(function () { });
};
</script>