<?php

$obj_appointment = new Hmgt_appointment();
$appointment_data = $obj_appointment->get_all_appointment();
$appointment_array = array();
if (!empty($appointment_data)) {
    foreach ($appointment_data as $appointment) {
        $patient_data = get_user_detail_byid($appointment->patient_id);
        $patient_name = $patient_data['first_name'] . " " . $patient_data['last_name'] . "(" . $patient_data['patient_id'] . ")";
        $doctor_data = get_user_detail_byid($appointment->doctor_id);
        $doctor_name = $doctor_data['first_name'] . " " . $doctor_data['last_name'];
        $appointment_start_date = date('Y-m-d H:i:s', strtotime($appointment->appointment_time_string));
        //$appointment_date=$appointment->appointment_time_string;
        $appointment_enddate = date('Y-m-d H:i:s', strtotime($appointment_start_date) + 900);
        $i = 1;
        $appointment_array[] = array('title' => 'Detail', 'start' => $appointment_start_date, 'end' => $appointment_enddate, 'patient_name' => $patient_name, 'doctor_name' => $doctor_name);
    }
}
$all_event = "";
$args['post_type'] = 'hmgt_event';
$args['posts_per_page'] = -1;
$args['post_status'] = 'public';
$q = new WP_Query();
$all_event = $q->query($args);
$event_array = array();
if (!empty($all_event)) {
    foreach ($all_event as $event) {
        $event_start_date = get_post_meta($event->ID, 'start_date', true);
        $event_end_date = get_post_meta($event->ID, 'end_date', true);
        $i = 1;
        $event_array[] = array('title' => $event->post_title, 'start' => mysql2date('Y-m-d', $event_start_date), 'end' => date('Y-m-d', strtotime($event_end_date . ' +' . $i . ' days')));
<?php

$obj_appointment = new Hmgt_appointment();
$hospital_obj = new Hospital_Management(get_current_user_id());
?>
<script type="text/javascript">
$(document).ready(function() {
	
	$('#appointment_date').datepicker({
		  changeMonth: true,
	        changeYear: true,
	        dateFormat: 'yy-mm-dd',
	        yearRange:'-65:+0',
	        onChangeMonthYear: function(year, month, inst) {
	            $(this).val(month + "/" + year);
	        }
                    
                }); 
	$('.timepicker').timepicker();
} );
</script>
<?php 
if (isset($_REQUEST['save_appointment'])) {
    if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'insert' || $_REQUEST['action'] == 'edit')) {
        $result = $obj_appointment->hmgt_add_appointment($_POST);
        if ($result) {
            $hmgt_sms_service_enable = 0;
            if (isset($_POST['hmgt_sms_service_enable'])) {
                $hmgt_sms_service_enable = $_POST['hmgt_sms_service_enable'];
            }
            if ($hmgt_sms_service_enable) {
<?php

//Appointment
$obj_appointment = new Hmgt_appointment();
$active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'appointmentlist';
?>
	

<div class="page-inner" style="min-height:1631px !important">
<div class="page-title">
		<h3><img src="<?php 
echo get_option('hmgt_hospital_logo');
?>
" class="img-circle head_logo" width="40" height="40" /><?php 
echo get_option('hmgt_hospital_name');
?>
</h3>
	</div>
	<?php 
if (isset($_REQUEST['save_appointment'])) {
    if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'insert' || $_REQUEST['action'] == 'edit')) {
        $result = $obj_appointment->hmgt_add_appointment($_POST);
        if ($result) {
            $hmgt_sms_service_enable = 0;
            if (isset($_POST['hmgt_sms_service_enable'])) {
                $hmgt_sms_service_enable = $_POST['hmgt_sms_service_enable'];
            }
            if ($hmgt_sms_service_enable) {
                $doctor_number = "+" . hmgt_get_countery_phonecode(get_option('hmgt_contry')) . get_user_meta($_REQUEST['doctor_id'], 'mobile', true);
                $patient_number = "+" . hmgt_get_countery_phonecode(get_option('hmgt_contry')) . get_user_meta($_REQUEST['patient_id'], 'mobile', true);
                $doctor_name = hmgt_get_display_name($_REQUEST['doctor_id']);