ok
Direktori : /home2/selectio/www/thedentalpark.com/admin/data-tables/ |
Current File : /home2/selectio/www/thedentalpark.com/admin/data-tables/booking_list.php |
<?php include"../config/config.php"; $requestData = $_REQUEST; $columns = array( 0 =>'date', 1 =>'id', 2 =>'id', 3 =>'id', 4 =>'id', 5 =>'id', 6 =>'id', 7 =>'id', 8 =>'id', 9 =>'id' ); $conditions=""; $patient_number1 = $_POST['patient_number1']; $date = $_POST['date']; if($patient_number1!=""){ $conditions.=" and patient_number1=".$patient_number1; } if($date!=""){ $conditions.=" and date="."'$date'"; } $sql_query = "SELECT * from tbl_appointment_booking"; /*Fetch All Data Start*/ $statement = $pdo->prepare("$sql_query WHERE 1=1 ".$conditions." ORDER BY date desc"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $totalFiltered = $totalData; /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql = "$sql_query WHERE 1=1 ".$conditions; if( !empty($_REQUEST['search'])){ $sql.=" AND (patient_name LIKE '%".$_REQUEST['search']."%' OR patient_number1 LIKE '%".$_REQUEST['search']."%' OR patient_number2 LIKE '%".$_REQUEST['search']."%' ) "; } /*Fetch Filter Data End*/ $sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; $statement = $pdo->prepare($sql); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $data = array(); // error_log($sql); $i=1; foreach($query as $row){ $nestedData = array(); if($row['date'] != ""){ $dates=date('d-M-Y',strtotime($row['date'])); } else{ $dates=""; } $action=''; $action.="<a href='booking_appointment.php?id=".$row['id']."' class='btn btn-warning btn-xs mr-2'><i class='fa fa-backward'></i> Update Info</a>"; // $action.=" <a href='call_report.php?id=".$row['id']."' class='btn btn-primary btn-xs mr-2'><i class='fa fa-folder'></i>Call Report</a>"; $nestedData[] = "<div class='text-center'>".$i."</div>"; $nestedData[] = "<div class='text-center'>".$action."</div>"; $nestedData[] = "<div class='text-center'>".$row["patient_name"]."</div>"; $nestedData[] = "<div class='text-center'>".$row["patient_number1"]."</div>"; $nestedData[] = "<div class='text-center'>".$row['patient_number2']."</div>"; $nestedData[] = "<div class='text-center'>".$dates."</div>"; $nestedData[] = "<div class='text-center'>".$row['time']."</div>"; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval($requestData['draw']), "recordsTotal" => intval($totalData), "recordsFiltered" => intval($totalFiltered), "data" => $data ); echo json_encode($json_data); ?>