<?php  include_once('../../config/db.php');  //include_once('../config/check.php'); 






$query = "  SELECT  a.*,b.id bid ,b.name bname  FROM adtaxrate a LEFT JOIN coa b ON a.coa = b.id   ";


$statement = $conn->prepare($query);

$statement->execute();

$number_filter_row = $statement->rowCount();

$statement = $conn->prepare($query );

$statement->execute();

$result = $statement->fetchAll();

$data = array();



foreach($result as $row)
{
  
  $actionButton = '<input type="radio" name="myradio" class="myradio" value="' . $row["id"] . '" /> </i></a>';
    
  $sub_array = array();
  $sub_array[] =  $actionButton  ;
  $sub_array[] = $row['date'];
  // $sub_array[] = $row['bname'];
  $sub_array[] = $row['name'];
  $sub_array[] = $row['value'];
 
  $data[] = $sub_array;
     
 

}

function count_all_data($conn,$query)
{
 $statement = $conn->prepare($query);
 $statement->execute();
 return $statement->rowCount();
}

$output = array(
                       "draw"       =>  $number_filter_row ,
                        "recordsTotal"   =>  count_all_data($conn,$query),
                        "recordsFiltered"  =>  $number_filter_row,
                        "data"       =>  $data
);

echo json_encode($output);

?>
