106 lines
4.5 KiB
PHP
106 lines
4.5 KiB
PHP
![]() |
<?php
|
||
|
error_reporting(0);
|
||
|
include "../includes/config/config.php";
|
||
|
include "../includes/functions.php";
|
||
|
include 'log_entry.php';
|
||
|
// include "mailend.php";
|
||
|
|
||
|
|
||
|
$status = $_POST['status'];
|
||
|
error_log('fyft' . $id);
|
||
|
|
||
|
$id = $_REQUEST["id"];
|
||
|
|
||
|
|
||
|
|
||
|
if (!empty($id)) {
|
||
|
$query_appointment = "select *, DATE_FORMAT(date, '%Y-%m-%d') as date from appointment_details where id='" . $id . "' ";
|
||
|
|
||
|
$result_stock = @mysqli_query($conn, $query_appointment);
|
||
|
while ($row_app = @mysqli_fetch_array($result_stock)) {
|
||
|
|
||
|
|
||
|
$query_cancelled = "insert into cancelled_appointment_details set status='" . $status . "' , emp_id='" . $row_app['emp_id'] . "' , doctor_id='" . $row_app['doctor_id'] . "' , date=str_to_date('" . $row_app['date'] . "','%Y-%m-%d') , time='" . $row_app['time'] . "', ohc_type_id='" . $row_app['ohc_type_id'] . "',app_type='" . $row_app['app_type'] . "',modified_by = '" . $_REQUEST['user_id'] . "' ";
|
||
|
error_log('slote_cancelled ' . $query_cancelled);
|
||
|
@mysqli_query($conn, $query_cancelled);
|
||
|
|
||
|
|
||
|
$query_slot = "update doc_slots set status='' where emp_id='" . $row_app['doctor_id'] . "' and slot_date=str_to_date('" . $row_app['date'] . "','%Y-%m-%d') and slot_id='" . $row_app['time'] . "' and ohc_type_id='" . $row_app['ohc_type_id'] . "' ";
|
||
|
error_log('slote_update ' . $query_slot);
|
||
|
@mysqli_query($conn, $query_slot);
|
||
|
}
|
||
|
$sql1 = "SELECT * from appointment_details where id = '" . $id . "'";
|
||
|
error_log('apps' . $sql1);
|
||
|
$query1 = mysqli_query($conn, $sql1);
|
||
|
$query = "DELETE FROM `appointment_details` WHERE id='$id'";
|
||
|
$exe = mysqli_query($conn, $query);
|
||
|
$arr = [];
|
||
|
if ($exe) {
|
||
|
$arr["success"] = "true";
|
||
|
// while ($fetch = mysqli_fetch_assoc($query1)) {
|
||
|
// $emailContent = "<p>Dear Sir/Madam, </p>";
|
||
|
// $status = '';
|
||
|
// $sub_status = '';
|
||
|
// if ($fetch['status'] == 'BOOKED') {
|
||
|
// $sub_status = 'confirmed';
|
||
|
// $status = "<font color=green>confirmed</font> ";
|
||
|
// } else if ($fetch['status'] == 'DRP') {
|
||
|
// $sub_status = 'pending';
|
||
|
// $status = "<font color=red>confirmed</font>";
|
||
|
// } else if ($fetch['status'] == 'DRA') {
|
||
|
// $sub_status = 'completed';
|
||
|
// $status = "<font color=green>completed</font> ";
|
||
|
// } else if ($fetch['status'] == 'CANCELLED') {
|
||
|
// $sub_status = 'cancelled';
|
||
|
// $status = " <font color=red>cancelled</font>";
|
||
|
// }
|
||
|
// if ($fetch['app_type'] == 'FIT') {
|
||
|
// $fetch['app_type'] = 'sickness/fitness';
|
||
|
// } else if ($fetch['app_type'] == 'MED') {
|
||
|
// $fetch['app_type'] = 'periodic health checkup';
|
||
|
// }
|
||
|
// $email_list_to = getTableFieldValue('patient_master', 'offiial_email_id', 'id', '"' . $fetch['emp_id'] . '"');
|
||
|
// $email_list_cc = getTableFieldValue('patient_master', 'offiial_email_id', 'id', '"' . $fetch['doctor_id'] . '"');
|
||
|
|
||
|
// $ref_type = $fetch['app_type'] . " Appointment";
|
||
|
|
||
|
// $subject = 'Your appointment got ' . $sub_status . ' in ' . getTableFieldValue('ohc_type', 'ohc_type_name', 'ohc_type_id', '"' . $fetch['ohc_type_id'] . '"') . ' OHC on ' .
|
||
|
// date_format(date_create($fetch['date']), "d-m-Y ") . '.';
|
||
|
// // if ($type != 'del') {
|
||
|
|
||
|
// // emailContent += "<p>Your appointment got " + status + " in " + data.ohc_type + " OHC on " +
|
||
|
// // data.date +
|
||
|
// // " between " +
|
||
|
// // data.slot +
|
||
|
// // " - " +
|
||
|
// // data.slot_end +
|
||
|
// // ".</p>";
|
||
|
// // emailContent +=
|
||
|
// // "<p>Kindly make sure 12 hours fasting is required (You can consume water) before this health checkup. </p><p> Regards,</p><p> Team OHC</p>";
|
||
|
// // } else {
|
||
|
|
||
|
// $emailContent .= "<p>You have Cancelled your health checkup in " . getTableFieldValue('ohc_type', 'ohc_type_name', 'ohc_type_id', '"' . $fetch['ohc_type_id'] . '"') ." OHC got <font color=red>Cancelled</font> .</p>";
|
||
|
// $emailContent .= "<p> Regards,</p><p> Team OHC</p>";
|
||
|
|
||
|
// // }
|
||
|
// // emailContent += "<br><a href=`" + link +
|
||
|
// // "`> Details</a> ";
|
||
|
// $message = $emailContent;
|
||
|
|
||
|
|
||
|
// $id = $appointmentId;
|
||
|
// $message = $emailContent;
|
||
|
// send_mail(
|
||
|
// $email_list_to,
|
||
|
// $subject,
|
||
|
// $message,
|
||
|
// "",
|
||
|
// );
|
||
|
// //send_email($appointmentId, getTableFieldValue('ohc_type', 'ohc_type_name', 'ohc_type_id', '"' . $fetch['ohc_type_id'] . '"'), getTableFieldValue('ohc_type', 'primary_email', 'ohc_type_id', '"' . $fetch['ohc_type_id'] . '"'), date_format(date_create($fetch['date']), "d-m-Y "), getTableFieldValue('patient_master', 'patient_name', 'id', '"' . $fetch['emp_id'] . '"'), $fetch['app_type'], $link, $type);
|
||
|
// }
|
||
|
} else {
|
||
|
$arr["success"] = "false";
|
||
|
}
|
||
|
print(json_encode($arr));
|
||
|
}
|