$startDate = date('Y-m-d', strtotime($_POST['search_start']));
$endDate = date('Y-m-d', strtotime($_POST['search_end']));
$query_rs_report_order_detail = "SELECT record.*, register.Emp_Name, department.Dep_Name, leave_type.Leave_Name, SUM(Rec_Day), SUM(Rec_Hour) FROM record inner join register on record.Emp_ID=register.Emp_ID inner join department on register.Dep_ID=department.Dep_ID inner join leave_type on leave_type.Leave_ID=record.Rec_Type where (( Date_start between '".$startDate."' and '".$endDate."') and (Date_end between '".$startDate."' and '".$endDate."' )) GROUP BY emp_id, Rec_Type ORDER BY record.Emp_ID ASC";
$rs_report_order_detail = mysql_query($query_rs_report_order_detail, $connection) or die(mysql_error());