33 lines
1.2 KiB
PHP
33 lines
1.2 KiB
PHP
<?php
|
|
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
include_once('log_entry.php');
|
|
$slot=$_REQUEST['slot'];
|
|
$date = $_REQUEST['appointment_book_date'];
|
|
$doc = $_REQUEST['doc'];
|
|
$sql = "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 ='".$slot."' and doctor_id='".$doc."' and app_type='".$_POST['app_type']."'";
|
|
|
|
error_log($sql."select_slot");
|
|
|
|
if (!$result = @mysqli_query($conn,$sql)) {
|
|
die(mysqli_error($conn));
|
|
}
|
|
$data = array();
|
|
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
if($_POST['app_type']=="MED"){
|
|
$total_slot=getTableFieldValue('doc_slots','sum(slot_count)','slot_id',$slot,"slot_date","'".$date."'",'ohc_type_id',"'".$_SESSION['current_ohcttype']."'");
|
|
}else{
|
|
$total_slot=getTableFieldValue('doc_slots','sum(slot_count)','slot_id',$slot,"slot_date","'".$date."'",'ohc_type_id',"'".$_SESSION['current_ohcttype']."'",'emp_id',"'".$_POST['doc']."'");
|
|
}
|
|
|
|
|
|
|
|
$data['slot_available']=$total_slot-$row['booked'];
|
|
}
|
|
$data['count']=mysqli_num_rows($result);
|
|
error_log('data '.print_r($data,true));
|
|
echo json_encode($data);
|
|
?>
|