38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
error_log("hello");
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
include_once('log_entry.php');
|
|
$doc=$_REQUEST['doc'];
|
|
$date = $_REQUEST['appointment_book_date'];
|
|
// $day= var_dump($date);
|
|
|
|
$sql = "SELECT DISTINCT(d.slot_id),TIME_FORMAT(slot, '%h:%i %p') as slot,d.status from doc_slots d left join appoinment_slots p on d.slot_id=p.slot_id where slot_date=str_to_date('".$date."','%Y-%m-%d') and d.ohc_type_id='".$_SESSION['current_ohcttype']."' and emp_id='".$doc."' ";
|
|
error_log($sql."select_slot");
|
|
|
|
if (!$result = @mysqli_query($conn,$sql)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
$data = array();
|
|
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
|
|
|
|
$sql_app = "SELECT count(*) as booked from appointment_details where date(date)=str_to_date('".$date."','%Y-%m-%d') and ohc_type_id='".$_SESSION['current_ohcttype']."' and time ='".$row['slot_id']."' ";
|
|
error_log($sql_app."select_slot");
|
|
|
|
if (!$result_app = @mysqli_query($conn,$sql_app)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
while ($row_app = mysqli_fetch_assoc($result_app)) {
|
|
$row['slot_available']=getTableFieldValue('appoinment_slots','slot_count','slot_id',$row['slot_id'])-$row_app['booked'];
|
|
}
|
|
|
|
array_push($data, $row);
|
|
}
|
|
$data['count']=mysqli_num_rows($result);
|
|
error_log('data '.print_r($data,true));
|
|
echo json_encode($data);
|
|
?>
|