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

34 lines
1.4 KiB
PHP

<?php
include('includes/config/config.php');
include('log_entry.php');
$id= $_POST['city_id'];
$status= $_POST['status'];
if($status == 'CANCELLED'){
$query_appointment="select *, DATE_FORMAT(date, '%Y-%m-%d') as date from appointment_details where id='$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 = "update appointment_details set status='$status' where id = '$id'";
error_log($query."save_app");
if (!$result = @mysqli_query($conn,$query)) {
exit(mysqli_error($conn));
}
?>