Permission fixes in fee sheet (#839)
[openemr.git] / portal / get_appointments.php
blobba739bafb62578c9a89872bbdd109a17b53df7e5
1 <?php
2 /**
4 * Copyright (C) 2016-2017 Jerry Padgett <sjpadgett@gmail.com>
5 * Copyright (C) 2011 Cassian LUP <cassi.lup@gmail.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author Cassian LUP <cassi.lup@gmail.com>
20 * @author Jerry Padgett <sjpadgett@gmail.com>
21 * @link http://www.open-emr.org
24 require_once ("verify_session.php");
26 $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, " .
27 "c.pc_catname " . "FROM openemr_postcalendar_events AS e, users AS u, " .
28 "openemr_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";
30 $res = sqlStatement ( $query, array (
31 $pid
32 ) );
34 if (sqlNumRows ( $res ) > 0) {
35 $count = 0;
36 echo '<table id="appttable" style="width:100%;background:#eee;" class="table table-striped fixedtable"><thead>
37 </thead><tbody>';
38 while ( $row = sqlFetchArray ( $res ) ) {
39 $count ++;
40 $dayname = xl ( date ( "l", strtotime ( $row ['pc_eventDate'] ) ) );
41 $dispampm = "am";
42 $disphour = substr ( $row ['pc_startTime'], 0, 2 ) + 0;
43 $dispmin = substr ( $row ['pc_startTime'], 3, 2 );
44 if ($disphour >= 12) {
45 $dispampm = "pm";
46 if ($disphour > 12)
47 $disphour -= 12;
49 if ($row ['pc_hometext'] != "") {
50 $etitle = 'Comments' . ": " . $row ['pc_hometext'] . "\r\n";
51 } else {
52 $etitle = "";
54 echo "<tr><td><p>";
55 echo "<a href='#' onclick='editAppointment(0," . htmlspecialchars ( $row ['pc_eid'], ENT_QUOTES ) . ')' . "' title='" . htmlspecialchars ( $etitle, ENT_QUOTES ) . "'>";
56 echo "<b>" . htmlspecialchars ( $dayname . ", " . $row ['pc_eventDate'], ENT_NOQUOTES ) . "</b><br>";
57 echo htmlspecialchars ( "$disphour:$dispmin " . $dispampm . " " . $row ['pc_catname'], ENT_NOQUOTES ) . "<br>";
58 echo htmlspecialchars ( $row ['fname'] . " " . $row ['lname'], ENT_NOQUOTES ) . "<br>";
59 echo htmlspecialchars ( "Status: " . $row ['pc_apptstatus'] , ENT_NOQUOTES );
60 echo "</a></p></td></tr>";
63 if (isset ( $res ) && $res != null) {
64 if ($count < 1) {
65 echo "&nbsp;&nbsp;" . xlt('None');
68 } else { // if no appts
69 echo xlt('No Appointments');
71 echo '</tbody></table>';
73 <div style='margin: 5px 0 5px'>
74 <a href='#' onclick="editAppointment('add',<?php echo attr($pid); ?>)"><button
75 class='btn btn-primary pull-right'><?php echo xlt('Schedule New Appointment'); ?></button></a>
76 </div>
77 <script>
78 function editAppointment(mode,deid){
79 if(mode == 'add'){
80 var title = '<?php echo xla('Request New Appointment'); ?>';
81 var mdata = {pid:deid};
83 else{
84 var title = '<?php echo xla('Edit Appointment'); ?>';
85 var mdata = {eid:deid};
87 var params = {
88 buttons: [
89 { text: '<?php echo xla('Cancel'); ?>', close: true, style: 'default' },
90 //{ text: 'Print', close: false, style: 'success', click: showCustom }
92 title: title,
93 url: './add_edit_event_user.php',
94 data: mdata
96 return eModal
97 .ajax(params)
98 .then(function () { });
100 </script>