$dates="and (date(checkup_date) >= '".$start_date_excel."' and date(checkup_date) <= '".$end_date_excel."')";
$sql210="select * from checkup_type where checkup_type_id='".$checkup_type_id."'";
error_log("sql210".$sql210);
$result210=@mysqli_query($conn,$sql210);
while($row210=mysqli_fetch_array($result210)){
$checkup=$row210['checkup_form_section_ids'];
}
$sql='select distinct section_id,section_name,count(*) as count from (select* from checkup_form_section where Status="Active"and section_id in ('.$checkup.') ) as c left JOIN checkup_parameter on checkup_parameter.checkup_form_section_id=c.section_id and enabled="Y" group by section_id order by display_order';
error_log("sql 1st".$sql);
$result=mysqli_query($conn,$sql);
$sql1='select parameter_value,input_type,section_id,column_order,checkup_parameter_id,parameter_name,column_name from (select checkup_form_section_id,column_order,checkup_parameter_id ,parameter_name,input_type,column_name,parameter_value from checkup_parameter WHERE enabled="Y" and checkup_form_section_id in ('.$checkup.')) as c inner JOIN checkup_form_section on checkup_form_section.section_id=c.checkup_form_section_id and Status="Active" order by display_order,column_order';
$result1=mysqli_query($conn,$sql1);
error_log("heading query ".$sql1);
$sql2="select c.*,p.* from checkup_form c left join patient_master p on c.emp_id = p.id where c.checkup_type_id='".$checkup_type_id."' and (c.current_status='DRA') and c.ohc_type_id='".$_SESSION['current_ohcttype']."' $dates";
$query="select c.checkup_form_value as val from checkup_form_key_value c where c.checkup_form_id = '".$row3['checkup_id']."' and c.checkup_form_key='".$param[$count]."' ";