ESH/delete_emp_appointment.php
2024-10-23 18:28:06 +05:30

36 lines
1.4 KiB
PHP

<?php
include('includes/config/config.php');
$query="";
$status= "DELETED";
if(!empty($_REQUEST['flex_city_id'])){
$query_appointment="select *, DATE_FORMAT(date, '%Y-%m-%d') as date from appointment_details where id='".$_REQUEST['flex_city_id']."' ";
//echo $query_appointment;
$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 = '".$_SESSION['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);
}
$query = " delete from appointment_details where id = '".$_REQUEST['flex_city_id']." ' ";
error_log('delet'.$query);
if (!$result = @mysqli_query($conn,$query)) {
exit(mysqli_error($conn));
echo json_encode("FAILURE");
}else{
echo json_encode("SUCCESS");
}
}
?>