Merge pull request #1348 from sjpadgett/more-frontpayment-fix
[openemr.git] / portal / get_appointments.php
blob6cd999dc43a8a93f56b9644e9cd6e737c8d31a95
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;
51 if ($row ['pc_hometext'] != "") {
52 $etitle = 'Comments' . ": " . $row ['pc_hometext'] . "\r\n";
53 } else {
54 $etitle = "";
57 echo "<tr><td><p>";
58 echo "<a href='#' onclick='editAppointment(0," . htmlspecialchars($row ['pc_eid'], ENT_QUOTES) . ')' . "' title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
59 echo "<b>" . htmlspecialchars($dayname . ", " . $row ['pc_eventDate'], ENT_NOQUOTES) . "</b><br>";
60 echo htmlspecialchars("$disphour:$dispmin " . $dispampm . " " . $row ['pc_catname'], ENT_NOQUOTES) . "<br>";
61 echo htmlspecialchars($row ['fname'] . " " . $row ['lname'], ENT_NOQUOTES) . "<br>";
62 echo htmlspecialchars("Status: " . $row ['pc_apptstatus'], ENT_NOQUOTES);
63 echo "</a></p></td></tr>";
66 if (isset($res) && $res != null) {
67 if ($count < 1) {
68 echo "&nbsp;&nbsp;" . xlt('None');
71 } else { // if no appts
72 echo xlt('No Appointments');
75 echo '</tbody></table>';
77 <div style='margin: 5px 0 5px'>
78 <a href='#' onclick="editAppointment('add',<?php echo attr($pid); ?>)"><button
79 class='btn btn-primary pull-right'><?php echo xlt('Schedule New Appointment'); ?></button></a>
80 </div>
81 <script>
82 function editAppointment(mode,deid){
83 if(mode == 'add'){
84 var title = '<?php echo xla('Request New Appointment'); ?>';
85 var mdata = {pid:deid};
87 else{
88 var title = '<?php echo xla('Edit Appointment'); ?>';
89 var mdata = {eid:deid};
91 var params = {
92 buttons: [
93 { text: '<?php echo xla('Cancel'); ?>', close: true, style: 'default' },
94 //{ text: 'Print', close: false, style: 'success', click: showCustom }
96 title: title,
97 url: './add_edit_event_user.php',
98 data: mdata
100 return eModal
101 .ajax(params)
102 .then(function () { });
104 </script>