<?php 
include ('pdf_header_reverse.php');
//include ('includes/config/config.php');
//include ('includes/functions.php');
error_reporting(E_ERROR | E_PARSE);
// include('pop_up_top.php');
?>
<html>

<body>
<table width="100%" >
<tr><div style="font-size:12px">
<td width="25%" align="left"> Run Date : <?php  echo date("d-M-Y"); ?></td>
<td width="50%" align="center" ><b> Work Area Hygiene Level  List<b></td>
<td width="25%" align="left"> User : <?php  echo $username ?></td>
</tr>
</table>
	<table  border="1">
<?php 
 $sql="select * from work_area_sample_level ws left join hygiene_sample h on ws.hyg_sample_id = h.hyg_sample_id ";
//echo  $sql;
$result = mysqli_query($conn,$sql);
// echo $result;
$count = 1;
?><tr bgcolor="#eeeeee">
			<th width=10% align="center">Sr. No</th>
			<th width=10% align="center">Sample Date</th>
			<th width=20% align="center">Sample Name</th>
			<th width=10% align="center">Department</th>
			<th width=20% align="center">Hygiene Parameter</th>
			<th width=10% align="center">Current Value</th>
			<th width=10% align="center">Comments and Recommendation</th>
			<th width=10% align="center">Refrence Range</th>
		
		</tr><?php 
		$count = 0;
while ($rowOfWorkHygiene = mysqli_fetch_array($result)) {
    
   //echo $sqlEmp;
    $sampleId = $rowOfWorkHygiene['sample_id'];
    $hygieneParameter = "select * from work_area_hyg_parameter where work_area_sample_id = '$sampleId'";
    $resultHygieneParameter = mysqli_query($conn,$hygieneParameter);
    $hygieneParameters = null;
    $hygiene_currentValue=null;
    while($rowOfhygieneParameter = mysqli_fetch_array($resultHygieneParameter)){
        $hygiene_id = $rowOfhygieneParameter['hyg_parameter_id'];
        $sqlParameterName = "select * from hygiene where hygiene_id ='$hygiene_id' ";
        $resultParameterName = mysqli_query($conn,$sqlParameterName);
        $rowParameterName = mysqli_fetch_array($resultParameterName);
        $hygieneParameters = $hygieneParameters.$rowParameterName['hygiene_parameter'].'<br>';
        $hygiene_currentValue = $hygiene_currentValue.$rowOfhygieneParameter['hyg_param_val'].'<br>';
        $work_area_min_range=$rowParameterName['work_area_min_range'];
        $work_area_max_range=$rowParameterName['work_area_max_range'];
        $range=$work_area_min_range."-".$work_area_max_range;
        
    }  
    
    $departments =getCommaSeperatedValuesForInClause("select sbu_name from sub_business_unit ","sbu_id",$rowOfWorkHygiene['department_ids']);

  //  echo $rowemp['fname'];

    ?><tr><td align="center"><?php  echo  ++$count ?></td align="center"><td align="center"><?php  echo $rowOfWorkHygiene['sample_date']?></td><td align="center"><?php  echo $rowOfWorkHygiene['sample_name']?></td>
  <td align="center"><?php  echo $departments?></td> <td align="center"><?php  echo $hygieneParameters?></td>  <td align="center"><?php  echo $hygiene_currentValue?></td>
   <td align="center"><?php  echo $rowOfWorkHygiene['commentsAndRecommendations']?></td> <td align="center"><?php  echo $range?></td>
			
		</tr><?php 

}
?>
</table>
<?php 
    include('pdf_footer.php');
?>