<?php //include('pdf_header_reverse.php');
include('includes/config/config.php');
include_once('includes/functions.php');
$from_date = $_REQUEST['startDate2'];
$to_date = $_REQUEST['endDate2'];


//include('pop_up_top.php');
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<body>
<style>
.tbl2{
 font-size:12px;
 
  border: 1px solid black;
  border-collapse: collapse;

}
.tbl2 td,th{
 font-size:12px;
 
  border: 1px solid black;
  border-collapse: collapse;
 
   padding: 4px;
}

.tbl1 td,th{
   font-size:12px;
   padding: 4px;
}

.btn {
  background-color: #4CAF50;
  border-radius : 5%; /* Green */
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
}
@media print {
  #printPageButton {
    display: none;
  }
}
</style>
<table width="100%" class="tbl1">
<tr><div style="font-size:15px">

<td width="100%" align="center" style="font-size:20px"><strong>FORM 17</strong></td>

</tr>


<tr>
	<td align="center">(Prescribed under Rule 68-T and 102)</td>
</tr>

<tr>
	<td align="center">(as amended vide Notification No.1183-LW-IR-1/91 dated 27th Nov.1991)</td>
</tr>

<tr><div style="font-size:15px">

<td width="100%" align="center" style="font-size:20px"><strong>Health Register</strong></td>

</tr>
<?php
$sql_1="SELECT a.*,b.patient_name,b.gender,b.dob,b.emp_code,b.hazardous_process,b.dangerous_process,b.raw_materials_exposed FROM medical_examination a left join patient_master b on a.patient_id = b.id WHERE  a.checkup_id = '".$_REQUEST['checkup_id']."'";

error_log("FORM17:".$sql_1);

$result_1 = mysqli_query($conn,$sql_1);

$row_1 = mysqli_fetch_array($result_1);

  ?>

<tr>
	<td width="30%">1.Serial No. in the register of adult worker: <?php echo $row_1['emp_code']?></td>
</tr>

<tr>
	<td align="left">2.Name of worker: <?php echo $row_1['patient_name']?></td>
	
</tr>



<tr>
	<td >3.Sex: <?php if($row_1['gender']=='M')

                       echo "Male";

                       elseif ($row_1['gender']=='F')

                       echo "Female";?></td>
	
</tr>

<tr>
	<td align="left">4.Date of Birth: <?php echo date("d-M-Y",strtotime($row_1['dob']))?>
                       	
    </td>
</tr>


</table>

<br>


<table border="1" width="100%" class="tbl2">
<?php 
$sql_17 = "select * from form_17 where checkup_id = '".$_REQUEST['checkup_id']."'";

$result_17 = mysqli_query($conn,$sql_17);

$num = mysqli_num_rows($result_17);

error_log("NUMBER OF ROWS::".$num);

if($num > 0){
  $sql="SELECT a.*,b.*,c.*,b.hazardous_process as hazardous_operation FROM form_17 a left join medical_examination c on a.checkup_id = c.checkup_id left join patient_master b on c.patient_id = b.id WHERE  a.checkup_id = '".$_REQUEST['checkup_id']."'";

  error_log("FORM17::" .$sql);
}

else {

$sql="SELECT b.*,c.*,b.hazardous_process as hazardous_operation from medical_examination c left join patient_master b on c.patient_id = b.id WHERE  c.checkup_id = '".$_REQUEST['checkup_id']."'";

error_log("FORM data::" .$sql);
}


$result = mysqli_query($conn,$sql);

  ?>
<tr>
	<th width="12%" height="12%">Department/works</th>
	<th width="12%">Name of hazardous process</th>
	<th width="12%">Dangerous process/operation</th>
	<th width="12%">Nature of job/occupation</th>
	<th width="12%">Raw materials,products or by-products likely to be exposed to</th>
	<th width="12%">Date of joining</th>
	<th width="12%">Date of leaving/transfer other work</th>
	<th width="12%">Reason for discharge/transfer to other work</th>
	<!-- <th >Signs and symptoms observed during examination</th>
	<th >Nature of tests & thereof</th>
	<th >Result Fit/Unfit</th>
	<th >Period of temporary withdrawal from that work</th>
	<th>Reason for such withdrawal</th>
	<th>Date of declaring him unfit for that work</th>
	<th>Date of issuing fitness certificate</th>
	<th>Signature with data of the Factory Medical Officer/the Certifying Surgeon</th> -->
</tr>

<tr>
	<th>1</th>
	<th>2</th>
	<th>3</th>
	<th>4</th>
	<th>5</th>
	<th>6</th>
	<th>7</th>
	<th>8</th>
	<!-- <th>9</th>
	<th>10</th>
	<th>11</th>
	<th>12</th>
	<th>13</th>
	<th>14</th>
	<th>15</th>
	<th>16</th> -->
</tr>

  
  <?php 
$count=1;
while ($row1= mysqli_fetch_assoc($result)){
 extract($row1);
?> 
	
<tr>
    
   <td><?php echo getFieldfromTable('dept_name','department','dept_id',$row1['dept_id'])?></td>
   <td><?php echo  $row1['hazardous_operation']?></td>
   <td><?php echo  $row1['dangerous_process']?></td>
   <td><?php echo getFieldfromTable('designation_name','designation','designation_id',$row1['designation_id']);?></td>
   <td><?php echo  $row1['raw_materials_exposed']?></td>
   <td><?php echo date("d-M-Y",strtotime($row1['doj']))?></td>
   <td><?php echo  $row1['date_leaving']?></td>
   <td><?php echo  $row1['reason_for_discharge']?></td>
   <!-- <td><?php echo  $row1['signs_symptoms']?></td>
   <td><?php echo  $row1['nature_tests']?></td>
   <td><?php echo  $row1['result']?></td>
   <td><?php echo  $row1['period_temp_withdrawal']?></td>
   <td><?php echo  $row1['reason_withdrawal']?></td>
   <td><?php echo  $row1['date_unfit']?></td>
   <td><?php echo  $row1['date_fitness']?></td>
   <td></td> -->
	
</tr>
	<?php 
$count++;	
}
?>

</table>

<br/>

<table border="1" width="100%" class="tbl2">
  <tr>
    <td align="center">Medical examination and the results there of</td>
  </tr>
  <tr>
    <td align="center">Signs and symptoms observed during examination</td>
  </tr>
  <tr>
    <td align="center">9</td>
  </tr>
  <tr >
    <td rowspan="10" >
      <div>
        <b style="font-weight: 800;text-decoration: underline;">CLINICAL EXAMINATION</b> <b><span style="float: right;">Date:<?php  echo date("d-M-Y",strtotime($row_1['medical_entry_date']))?></span></b>
      </div>
      <br>
      <div style="display: inline;">
        <b>Height: <?php echo $row_1['height']?></b> cm &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Weight: <?php echo $row_1['weight']?></b> Kgs &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>BMI: <?php echo $row_1['bmi']?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Built & Nutrition: <?php echo $row_1['bn_findings']?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Blood Pressure:  <?php echo $row_1['bp']?></b> mmHg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Pulse: <?php echo $row_1['pulse']?> </b> /m 
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b>General Inspection</b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>A: <?php echo $row_1['a']?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>CY: <?php echo $row_1['cy']?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>I: <?php echo $row_1['i']?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Cl: <?php echo $row_1['cl']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>E: <?php echo $row_1['e']?> </b> 
      </div>
       <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">Respiratory System: </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Chest: <?php echo $row_1['chest']?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Chest Inspiration: <?php echo $row_1['chest_in']?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Expiration: <?php echo $row_1['chest_exp']?></b> cm (NA Female Candidate) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b>SKIN: <?php echo $row_1['skin']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Muscular Skeletal: <?php echo $row_1['musculo_skeletal']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">CNS: </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Speech: <?php echo $row_1['speech']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Higher Function: <?php echo $row_1['higher_function']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Motor Function: <?php echo $row_1['motor_function']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Vertigo: <?php echo $row_1['vertigo']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b>Reflexes(Superficial & Deep): <?php echo $row_1['reflexes']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Vibration syndrome: <?php echo $row_1['vibration_syndrome']?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">ENT: </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Conversational Hearing: <?php echo $row_1['conversational_hearing']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>EAC: <?php echo $row_1['eac']?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Nose: <?php echo $row_1['nose']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Throat: <?php echo $row_1['throat']?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">Dental: </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Teeth & Gum: <?php echo $row_1['teeth_n_gum']?>  </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">CVS: </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>S1 & S2: <?php echo $row_1['s1']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Any other sound: <?php echo $row_1['any_other_sound']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">ABDOMEN: </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Liver: <?php echo $row_1['liver']?></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Spleen: <?php echo $row_1['speen']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Tenderness: <?php echo $row_1['tenderness']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b>Any Other Abnormality: <?php echo $row_1['any_other_abnormality']?> </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
    </td>
  </tr>
</table>

<br>


<table  border="1" width="100%" class="tbl2">
  <tr>
    <td width="100%" align="center">Medical examination and the results thereof</td>
    <td>11</td>
  </tr>
  <tr>
    <td align="center">Nature of tests & results thereof</td>
    <td>Result Fit/Unfit</td>
  </tr>
  <tr>
    <td align="center" >10</td>
  </tr>
  <tr >
    <td   >
      <div>
        <b style="font-weight: 800;text-decoration: underline;">BLOOD ROUTINE EXAMINATION</b> <b><span style="float: right;">Date:<?php  echo date("d-M-Y",strtotime($row_1['medical_entry_date']))?></span></b>
      </div>
      <br>
      <div style="display: inline;">
        <b>Hemoglobin: <?php echo $row_1['hb']?></b> % gm/dl &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Total Leucocyte Count: <?php echo $row_1['tlc']?> </b> cu. /mm &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b>Differential Leucocyte Count</b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Neutrophils: <?php echo $row_1['dlc_n']?></b> % &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b> Lymphocytes: <?php echo $row_1['dlc_l']?></b> % &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Monocytes: <?php echo $row_1['dlc_m']?></b> % &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Eosinophil: <?php echo $row_1['dlc_e']?></b> % &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Basophils: <?php echo $row_1['dlc_b']?> </b> % 
      </div>
       <br>
      <br>
      <div style="display: inline;">
       
        <b>Total Cholesterol: <?php echo $row_1['total_cholestrol']?></b> mg/dl  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>(LDL) Cholesterol: <?php echo $row_1['ldl']?></b> mg/dl  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>(VLDL) Cholesterol : <?php echo $row_1['vldl']?></b> mg/dl &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b>Blood Sugar: </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>RBS: <?php echo $row_1['blood_sugar_rbs']?></b> mg/dl &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>FBS: <?php echo $row_1['blood_sugar_fbs']?> </b> mg/dl &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>PPBS: <?php echo $row_1['blood_sugar_ppbs']?> </b> mg/dl &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="font-weight: 800;text-decoration: underline;">RENAL FUNCTION TEST</b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b style="font-weight: 800;text-decoration: underline;">LIVER FUNCTION TEST</b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b >Uric Acid: </b> <span style="margin-left: 137px"><?php echo $row_1['uric_acid']?> mg/dl</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Total Bilirubin </b> <span style="margin-left: 122px"><?php echo $row_1['total_bilirubin']?> mg/dl</span>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b >Urea: </b><span style="margin-left: 165px"><?php echo $row_1['s_urea']?> mg/dl</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Conj. </b> <span style="margin-left: 175px"><?php echo $row_1['conj']?> mg/dl</span>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b>Creatinine:  </b><span style="margin-left: 131px"><?php echo $row_1['s_creatinine']?> mg/dl</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Unconj.  </b> <span style="margin-left: 160px"><?php echo $row_1['uniconj']?> mg/dl</span>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b>Sodium (Na+): </b> <span style="margin-left: 112px"><?php echo $row_1['sodium']?> mg/dl</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>SGOT </b> <span style="margin-left: 170px"><?php echo $row_1['sgop']?> mg/dl</span>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b >Potassium (K+): </b> <span style="margin-left: 102px"><?php echo $row_1['potassium']?> mg/dl</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>SGPT </b> <span style="margin-left: 170px"><?php echo $row_1['sgpt']?> mg/dl</span>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b >Phosphate: </b> <span style="margin-left: 128px"><?php echo $row_1['rft_phosphate']?> mg/dl</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Alkaline Phosphatase </b> <span style="margin-left: 78px"><?php echo $row_1['alk_phosphatase']?> mg/dl</span>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b>Bi-Carbonate (Hco3): </b> <span style="margin-left: 72px"><?php echo $row_1['hco3']?> mmol/l</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <b>Total Protein: </b> <span style="margin-left: 128px"><?php echo $row_1['total_protein']?> g/dl</span>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        
        <b style="margin-left: 292px">Globulin: </b> <span style="margin-left: 150px"><?php echo $row_1['globulin']?> g/dl</span>
      </div>
      <br>
      <br>
      <div style="display: inline;">
         
        <b style="margin-left: 292px">Albumin: </b> <span style="margin-left: 150px"><?php echo $row_1['albumin']?> g/dl</span>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">URINE RE & ME: </b> <?php echo $row_1['urine_re_me']?>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">Pulmonary Function Test (Spirometry) :  </b> <?php echo $row_1['spirometry_remarks']?>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">Audiometry :   </b> <?php echo $row_1['audio_findings']?>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">Chest X-Ray: </b> <?php echo $row_1['xray_findings']?>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">ECG : </b> <?php echo $row_1['ecg_findings']?>
      </div>
      <br>
      <br>
      <div style="display: inline;">
        <b style="text-decoration: underline;">Others: </b>  <?php echo $row_1['others']?>
      </div>
    </td>
    <td>
      <?php echo $row_1['physical_status']?>
    </td>
  </tr>
</table>

<br>

<table border="1" width="100%" class="tbl2">

<tr>
  <td colspan="4" align="center">If declared unfit for work</td>
  <th width="12%" rowspan="2">Signature with date of the Factory Medical Officer/ the Certifying Surgeon</th>
</tr>

<tr>
  <th width="12%" height="12%">Period of Temporary withdrawal from that work</th>
  <th width="12%">Reason for such withdrawal</th>
  <th width="12%">Date of declaring him unfit for that work</th>
  <th width="12%">Date of issuing fitness Certificate</th>
  
</tr>

<tr>
  <th>12</th>
  <th>13</th>
  <th>14</th>
  <th>15</th>
  <th>16</th>
</tr>

<?php 
$sql_17 = "select * from form_17 where checkup_id = '".$_REQUEST['checkup_id']."'";

$result_17 = mysqli_query($conn,$sql_17);

$num = mysqli_num_rows($result_17);

error_log("NUMBER OF ROWS::".$num);

if($num > 0){

$sql="SELECT a.*,c.* FROM form_17 a left join medical_examination c on a.checkup_id = c.checkup_id WHERE  a.checkup_id = '".$_REQUEST['checkup_id']."'";
}
else{
  $sql="SELECT * from medical_examination WHERE  checkup_id = '".$_REQUEST['checkup_id']."'";

}
error_log("FORM17".$sql);

$result = mysqli_query($conn,$sql);
$count=1;
while ($row1= mysqli_fetch_assoc($result)){
 extract($row1);
?> 
  
<tr>
    
   <td><?php echo  $row1['period_temp_withdrawal']?></td>
   <td><?php echo  $row1['reason_withdrawal']?></td>
   <td><?php echo  $row1['date_unfit']?></td>
   <td><?php echo  $row1['date_fitness']?></td>
   <td><img
                          src="data:<?php echo $row1['doc_sign_image_type']?>;base64,<?php echo base64_encode( $row1['approving_doc_sign_img'])?>"
                          style="width: 200px; height: 61px;" /></td>
  
</tr>
  <?php 
$count++; 
}
?>

</table>

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

<div align="center" >

                      <button align ="center" id="printPageButton"  class="btn btn-success" onClick="window.print();">Print</button>
      </div>

<script>
$(document).ready(function(){      
     window.print();
       
  });
</script>