    <?php
    $thisid =  $_GET["id"];

    include 'DBConnection.php';
    $sql       = 'select * from records where emp_id = '.$thisid;

    $results   = mysqli_query($connection, $sql);


    $row_count = mysqli_num_rows($results);
    $id = 0;
  
    while ($row = mysqli_fetch_array($results)) {
      /*  echo '<tr><td><a href="OBApprove.php?id='.$row['obid'].'">'.$row['emp_number'].'</a></td></tr>';
        echo '<td>'.$row['emp_id'].'</td>';
        echo '<td>'.$row['dept_from'].'</td>';
        echo '<td>'.$row['dept_to'].'</td>';
        echo '<td>'.$row['purpose'].'</td>';
        echo '<td>'.$row['dept_time'].'</td>';
        echo '<td>'.$row['return_time'].'</td>';
        echo '<td>'.$row['status'].'</td>';*/

        $emp_name = $row['lname']." ".$row['fname'];
        $emp_id = $row['emp_id'];
        $joined_date = $row['jdate'];
      

        

    }


    

$temp = 'DAILY';

if (isset($_POST['submit1']))
{

$status = $_POST['duration'];

if ($status == 'daily') {
     $temp = "DAILY";
 }
 else if ($status == 'weekly')
 {
    $temp = "WEEKLY";
 }
  else if ($status == 'monthly')
 {
    $temp = "MONTHLY";
 }
  else if ($status == 'yearly')
 {
    $temp = "YEARLY";
 } else
 {
    $temp = "DAILY";
 } 
 
 }

    $selected_duration = $temp;

    ?>


<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Page Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel='stylesheet prefetch' href='https://use.fontawesome.com/releases/v5.0.10/css/all.css'>
    <link rel="stylesheet" type="text/css" media="screen" href="main.css" />
</head>

<body>

    <div class="logo">
        <img src="logo-banner.png" alt="" srcset="">
    </div>

    <div class="tabs">
        <div class="tabs-nav">
            <ul>
                <li class="is-active">DTR</li>
                <li>Overtime</li>
                <li>OB</li>
                <li>Leave</li>
            </ul>
        </div>
        <div class="tabs-content">
            <div class="is-active">
                <!-- Set of nested tabs -->
                <div class="tabs">  
                    <div class="tabs-nav">
                            <ul>
                                <li class="is-active">My DTR</li>
              
                            </ul>
                    </div>
                    <div class="tabs-content">
                        <div class="tabs-form is-active">

                         

                                 <h1><center>Daily Time Record</center></h1>
                                <table border="1" cellpadding="10px" style="width:100%;">

                                    <tbody>
                                    <tr>
                                    <td style="" colspan="6">Time Record</td>
                                    <td style="">Employee No.:</td>
                                    <td style=""><input type="text" name="try" value="<?php echo $emp_id ?>" disabled></td>
                                    </tr>
                                    <tr>
                                    <td style="" colspan="2" >Employee Name:</td>
                                    <td style="" colspan="4" ><input type="text" name="" value="<?php echo $emp_name ?>" disabled></td>
                                    <td style="">Start Date:</td>
                                    <td style=""><input type="text" name="" value="<?php echo $joined_date ?>" disabled></td>
                                    </tr>
                                    <tr>
                                    <td style="" colspan="2">BU/Department:</td>
                                    <td style="" colspan="4">{{dept}}</td>
                                    <td style="">End Date:</td>
                                    <td style="">{{end_date}}</td>
                                    </tr>
                                    

                              <!-- looping table -->

                                   <?php
// real time data
                              $conn = @mysqli_connect('192.168.2.117', 'webster', 'webster');
                              if (!$conn)
                              {
                                die("Database Connection Failed" . mysqli_error($conn));
                              }

                              

                              $select_db = mysqli_select_db($conn,'realtimedata');
                              if (!$select_db)
                              {
                                die("Database Selection Failed" . mysqli_error($conn));
                              }
                              
                              





                              $conn1 = @mysqli_connect('localhost', 'root', '');
                              if (!$conn1)
                              {
                                die("Database Connection Failed" . mysqli_error($conn1));
                              }

                              $select_db1 = mysqli_select_db($conn1,'db');
                              if (!$select_db1)
                              {
                                die("Database Selection Failed" . mysqli_error($conn1));
                              }
                              // OT
                           
                              //session_start();
                                //$emp_id=$_SESSION['emp_id'];//null;
                              //if(isset($_POST['submit']))
                              //{
                                //  $emp_id=$_POST['emp_id'];
                              //}
                              
                              //$emp_id=$_SESSION['emp_id'];//null;
                       
                       
                                 
                        ?>

                                     <tr>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>Date</strong></td>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>Day</strong></td>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>IN</strong></td>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>OUT</strong></td>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>Tardy</strong></td>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>OT Hours (subject to filling &amp; approval)</strong></td>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>Undertime</strong></td>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>Remarks</strong></td>
                                     </tr>

                                    <?php


                                    $connectionrtd = mysqli_connect("192.168.2.117","webster","webster","realtimedata");

                                    $attsql = "SELECT * from attendanceformatted WHERE userid =".$thisid;
                                        $query11=mysqli_query($connectionrtd, $attsql)or die(mysqli_error($connectionrtd));
                      

                                              //die("SELECT * from employee WHERE emp_id=$emp_id");
                                              while($row=mysqli_fetch_array($query11))
                                              {
                                            
                                               $att_in =  $row['att_in'];
                                               $att_out =  $row['att_out'];


                                               

                                               $s = strtotime($att_in);
                                               $s1 = strtotime($att_out);
                                               $set = "09:00:00";
                                               $cset = strtotime($set);

                                               $date =  date('Y-m-d', $s);
                                               $day = date('D', strtotime($att_in));
                                               $diff = $s - $s1;

                                               $timeIn = date('H:i:s', $s);
                                               $timeOut = date('H:i:s', $s1);

                                               $ctimein = strtotime($timeIn);
                                               $ctimeout = strtotime($timeOut);

                                               $hours = $diff / (60 * 60);
                                               $fhours = abs($hours);
                                              

                                             //  if ($ctimein < $cset){
                                               // $finalhours = 0;
                                               //} else {
                                                if($ctimein > $cset) {

                                                  $t =   $cset - $ctimein;
                                                 $t1 = $t / (3600);
                                                 $t2 = round(abs($cset - $ctimein) / 3600,2);
                                                  $finalhours = $t2;

                                                } else {
                                                  $finalhours = 0;
                                                }
                                               
                                               //  $finalhours = number_format((float)strtotime($set), 2, '.', '');


?>
                              
     <tr>
                                             <td align="center"><?php echo $date ?></a></td>
                                             <td align="center"><?php echo $day ?></a></td>
                                             <td align="center"><?php echo $timeIn ?></a></td>
                                             <td align="center"><?php echo $timeOut ?></a></td>
                                            <td align="center"><?php echo $finalhours ?></a></td>




<?php 

                                        $att2 = "SELECT * from ot WHERE `userid`=".$thisid." AND `time_out` = '".$timeOut."'";
                                        
                                        $ut_time =  round(abs($ctimein - $ctimeout) / 3600,2);




                                        $query1=mysqli_query($conn1,$att2)or die(mysqli_error($conn1));
                                

                                         if (mysqli_num_rows($query1)==0) {

                                              $remarks = "None";
                                              $finalut = $ut_time;
                                              $ot_time1 = 0 ; 

                                             if(($ut_time < 8) && ($ut_time >4)){
                                                $finalut = $ut_time;
                                              }            else {
                                                $finalut = "No Undertime Record";
                                              }


                                           
?>
                                               <td align="center"><?php echo $ot_time1 ?></a></td>            
                                              <td align="center"><?php echo $finalut ?></a></td>
                                              <td align="center"><?php echo $remarks ?></a></td>

                                         </tr>
<?php
               
                                         }

                                         else {
 
                                       while($row = mysqli_fetch_array($query1))
                                          {

       
                                              $ot_time_in = $row['time_in'];
                                              $ot_time_out = $row['time_out'];
                                              $ctin = strtotime($ot_time_in);
                                              $ctout = strtotime($ot_time_out); 
                                              $date_from = $row['date_from'];
                                              $userid = $row['userid'];




       
                                            if (($userid == $thisid) && ($timeIn == $ot_time_in) && ($timeOut == $ot_time_out) && ($date_from == $date))
                                            {

                                           
                                            $status = $row['Status'];
                                            $otset = "17:30:00";            
                                            $oset = strtotime($otset);
                                            $otimeout = strtotime($ot_time_out);
                                          
                                            $finalut =  $ut_time;
                                   
                                            $remarks = "Overtime";


                                            $temp1 = round(abs($oset - $ctout) / 3600,2);

                                            if ($status == 1)
                                            { 
                                                $str = " [approved] ";
                                                $ot_time1 = $temp1." ".$str;
                                            } 
                                            else
                                             {
                                                $str = " [reject] ";
                                                $ot_time1 = $temp1." ".$str;
                                             }


                                          }else {
                                           
                                             
                                              $remarks = "None1";
                                              $finalut = $ut_time;
                                              $ot_time1 = 01;
                                                  
                                               
                                            }
                                     ?>

                                      <td align="center"><?php echo $ot_time1 ?></a></td>       
                                      <td align="center"><?php echo $finalut ?></a></td>
                                      <td align="center"><?php echo $remarks ?></a></td>
                                      </tr>

                                        <?php 
                                            } //end of while loop
                                        }//end of else
                                      }//end of another while loop
           
                                        
                                                        
                                  ?>

                                    <tr>
                                    <td style="">Leave Credits:</td>
                                    <td style="">{{leave_credits}}</td>
                                    <td style="" rowspan="2">&nbsp;</td>
                                    <td style="">Noted by:</td>
                                    <td style="" colspan="2">{{noted_by}}</td>
                                    <td style="">Approved by:</td>
                                    <td style="">{{approved_by}}</td>
                                    </tr>
                                    <tr>
                                    <td style="">As of</td>
                                    <td style="">{{date_of_request}}</td>
                                    <td style="" colspan="3">&nbsp;</td>
                                    <td style="" colspan="2">&nbsp;</td>
                                    </tr>
                                    </tbody>

                                </table>
                        </div>
                    </div>
                </div>
                <!-- End nested tabs -->
            </div>

            <!--start of OT-->
            <div>
                <!-- Set of nested tabs -->
                <div class="tabs">  
                    <div class="tabs-nav">
                        <ul>
                            <li class="is-active">Apply for Overtime</li>
                            <li>My Overtime</li>
                        </ul>
                    </div>
                    <div class="tabs-content">
                        <div class="tabs-form is-active">

                            <form action="OTAction.php?id=<?php echo $thisid ?>" method="post">
                                <div class="form-control">
                                <ul class="wrapper">
                                    <h3>Date</h3>
                                    <li class="form-row">
                                        
                                        <input type="date" id="date_from" name="date_from"  required>
                                    </li>
                                </ul>

                                <ul class="wrapper">
                                    <h3>Time (From - To)</h3>
                                    <li class="form-row">
                                        <label for="">From</label>
                                        <input type="time" name="time_in" id="  " >
                                    </li>

                                    <li class="form-row">
                                        <label for="">To</label>
                                        <input type="time" name="time_out" id="time_out">
                                    </li>
                                </ul>

                                <ul class="wrapper">
                                    <h3>Total Hours</h3>
                                    <li class="form-row">
                                    
                                        <input type="number" name="total_hours">
                                    </li>
                                </ul>

                                <ul class="wrapper">
                                    <h3>Purpose</h3>
                                    <li class="form-row">
                                    
                                        <textarea name="ot_comment" id="ot_comment" cols="35" rows="3"></textarea>
                                    </li>
                                </ul>

                                </div>
                                
                                    <input type="submit" value="Apply" class="btn">
                                
                            </form>


                        </div>
                        <div>
                            <table class="table hover" id="resultTable">

                                <thead>
                                    <tr>
                                        <th>Id</th>
                                        <th rowspan="1" style="width:24%"><span class="headerCell">UserId</span></th>
                                        <th rowspan="1" style="width:18%"><span class="headerCell">Date</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">Time in</span></th>
                                        <th rowspan="1" style="width:9%"><span class="headerCell">Time out</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">Total Hours</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">Purpose</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">Status</span></th>
                                 

                                    </tr>
                                </thead>

                                <tbody>
                                    <tr>
                                        <td colspan="8"></td>
                                    </tr>


                                    <?php
include 'DBConnection4.php';


$sql       = 'select * from ot';
$results   = mysqli_query($connection, $sql);
$row_count = mysqli_num_rows($results);
$id = 0;

  if (mysqli_num_rows($results)==0) {
 echo '<td>'."0".'</td>';
  echo '<td>'."0".'</td>';
   echo '<td>'."0".'</td>';
    echo '<td>'."0".'</td>';
     echo '<td>'."0".'</td>';
      echo '<td>'."0".'</td>';
       echo '<td>'."0".'</td>';
        echo '<td>'."0".'</td>';
  } 

while ($row = mysqli_fetch_array($results)) {
    echo '<tr><td><a href="OTApprove.php?id='.$row['Id'].'">'.$row['Id'].'</a></td>';
    echo '<td>'.$row['userid'].'</td>';
    echo '<td>'.$row['date_from'].'</td>';
    echo '<td>'.$row['time_in'].'</td>';
     echo '<td>'.$row['time_out'].'</td>';
    echo '<td>'.$row['total_hours'].'</td>';
    echo '<td>'.$row['ot_comment'].'</td>';
    echo '<td>'.$row['Status'].'</td>';
}
?>

                                    
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!-- End nested tabs -->
            </div>
            <!-- end of OT -->
            <!-- start of OB -->
            <div>
                 <div class="tabs">
                    <div class="tabs-nav">
                        <ul>
                            <li class="is-active">Apply for OB</li>
                            <li>My OB</li>
                        </ul>
                    </div>
                    <div class="tabs-content">
                        <div class="is-active">
                            <form action="OBAction.php" method="post">
                                <table border="1" cellpadding="10px" style="width:100%;">
                                    <tbody>
                                    <tr>
                                        <td style=" background-color: rgb(199, 199, 199);" colspan="2"><strong>ITINERARY</strong></td>
                                        <td style=" background-color: rgb(199, 199, 199);" colspan="2" rowspan="2"><strong>PURPOSE(S)</strong></td>
                                        <td style=" background-color: rgb(199, 199, 199);" colspan="2"><strong>TIME OF</strong></td>
                                    </tr>
                                    <tr>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>FROM</strong></td>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>TO</strong></td>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>DEPARTURE</strong></td>
                                        <td style="background-color: rgb(199, 199, 199);"><strong>RETURN</strong></td>
                                    </tr>
                                    <tr> 
                                        <td style=""><input type="text" name ="from_dept"></td>
                                        <td style=""><input type="text" name ="to_dept"></td>
                                        <td style="" colspan="2"><input type="text" name="purpose"></td>
                                        <td style=""> <input type="datetime-local" name="from_time" id=""></td>
                                        <td style=""> <input type="datetime-local" name="to_time" id=""></td>
                                    </tr>
                                    </tbody>
                                </table>

                                <input  type = "submit" name="submit" value="Apply" class="btn">
                            </form>
                        </div>
                        <div>
                            <table class="table hover" id="resultTable">

                                <thead>
                                    <tr>
                                       <center><H1> PENDING REQUESTS </H1></center>  
                                        <th rowspan="1" style="width:24%"><span class="headerCell">OB Form Id</span></th> 
                                        <th rowspan="1" style="width:18%"><span class="headerCell">Employee ID</span></th>
                                        <th rowspan="1" style="width:10%"><span class="headerCell">Depart From</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">Arrive To</span></th>
                                        <th rowspan="1" style="width:9%"><span class="headerCell">Purpose</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">Time From</span></th>
                                        <th rowspan="1" style="width:17%"><span class="headerCell">Time To</span></th>
                                        <th rowspan="1" style="width:10%"><span class="headerCell">Status</span></th>
                                    </tr>
                                </thead>
                                  

                                <tbody>

                                    <tr>
                                        <td colspan="8"></td>


                                    <?php
include 'DBConnection4.php';


$sql       = 'select * from obform where status = "pending"';
$results   = mysqli_query($connection, $sql);
$row_count = mysqli_num_rows($results);
$id = 0;

while ($row = mysqli_fetch_array($results)) {
    echo '<tr><td><a href="OBApprove.php?id='.$row['obid'].'">'.$row['obid'].'</a></td>';
    echo '<td>'.$row['emp_id'].'</td>';
    echo '<td>'.$row['dept_from'].'</td>';
    echo '<td>'.$row['dept_to'].'</td>';
    echo '<td>'.$row['purpose'].'</td>';
    echo '<td>'.$row['dept_time'].'</td>';
    echo '<td>'.$row['return_time'].'</td>';
    echo '<td>'.$row['Status'].'</td></tr>';
}
?>
                                    </tr>
                                </tbody>
                            </table>

                                  <table class="table hover" id="resultTable">

                                <thead>
                                    <tr>
                                      <center><H1> COMPLETED REQUESTS </H1></center>  
                                        <th rowspan="1" style="width:24%"><span class="headerCell">OB Form Id</span></th> 
                                        <th rowspan="1" style="width:18%"><span class="headerCell">Employee ID</span></th>
                                        <th rowspan="1" style="width:10%"><span class="headerCell">Depart From</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">Arrive To</span></th>
                                        <th rowspan="1" style="width:9%"><span class="headerCell">Purpose</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">Time From</span></th>
                                        <th rowspan="1" style="width:17%"><span class="headerCell">Time To</span></th>
                                        <th rowspan="1" style="width:10%"><span class="headerCell">Status</span></th>
                                    </tr>
                                </thead>
                                  

                                <tbody>

                                    <tr>
                                        <td colspan="8"></td>
                                    </tr>

                                                                        <?php
include 'DBConnection4.php';


$sql       = 'select * from obform where status ="1" or status="0   "';
$results   = mysqli_query($connection, $sql);
$row_count = mysqli_num_rows($results);
$id = 0;

while ($row = mysqli_fetch_array($results)) {
    echo '<tr><td>'.$row['obid'].'</a></td>';
    echo '<td>'.$row['emp_id'].'</td>';
    echo '<td>'.$row['dept_from'].'</td>';
    echo '<td>'.$row['dept_to'].'</td>';
    echo '<td>'.$row['purpose'].'</td>';
    echo '<td>'.$row['dept_time'].'</td>';
    echo '<td>'.$row['return_time'].'</td>';
    echo '<td>'.$row['Status'].'</td></tr>';
}
?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
               
            </div> <!--closing tab -->






<!--- LEAVE TAB ---->
<div>
                 <div class="tabs">
                    <div class="tabs-nav">
                        <ul>
                            <li class="is-active">Apply Leave</li>
                            <li>My Leave</li>
                        </ul>
                    </div>
                    <div class="tabs-content">
                        <div class="is-active">
                            <form action="LeaveAction.php" method="post">
                                <div class="form-control">
                                <ul class="wrapper">
                                            <h3>Leave Type</h3>
                                            <li class="form-row1">
                                            <input type="radio" name="purpose" value="undertime" id=""> Undertime 
                                            </li>
                                            <li class="form-row1">
                                            <input type="radio" name="purpose" value="halftime" id=""> Half-Day 
                                            </li>
                                            <li class="form-row1">
                                            <input type="radio" name="purpose" value="lwp" id=""> Leave w/ Pay
                                            </li>
                                            <li class="form-row1">
                                            <input type="radio" name="purpose" value="lwop" id=""> Leave w/out Pay
                                            </li>
                                            
                                </ul>
                                    
                                    <ul class="wrapper">
                                            <h3>Reason</h3>
                                            <li class="form-row">
                                                <input type="text" id="reason" name="reason"  required>
                                            </li>
                                        </ul>

                                        <ul class="wrapper">
                                            <h3>Date & Time (From - To)</h3>
                                            <li class="form-row">
                                                <label for="">From</label>
                                                <input type="datetime-local" name="date_from" id="date_from" required>
                                            </li>

                                            <li class="form-row">
                                                <label for="">To</label>
                                                <input type="datetime-local" name="date_to" id="date_to" required>
                                            </li>
                                        </ul>

                                        <ul class="wrapper">
                                            <h3>For HR Department Only</h3>
                                            <li class="form-row">
                                                <label for="">Leave Credit Balance-To Date</label>
                                                <input type="text" name="leave_credit">
                                                </li>
                                                <li class="form-row">
                                                <label for="">Less This Application</label>
                                                <input type="text" name="less_application">
                                                </li>
                                                <li class="form-row">
                                                <label for="">Balance</label>
                                                <input type="text" name="leave_balance">
                                                </li>
                                        </ul>
                                </div>
                                

                                    <input type="submit" name="submit" value="Apply" id="button-3" class="btn">
                                </form>
                        </div>
                        <div>
                            <table class="table hover" id="resultTable">

                                <thead>
                                    <tr>
                                       <center><H1> PENDING REQUESTS </H1></center>  
                                        <th rowspan="1" style="width:24%"><span class="headerCell">Leave Id</span></th> 
                                        <th rowspan="1" style="width:18%"><span class="headerCell">Employee ID</span></th>
                                        <th rowspan="1" style="width:10%"><span class="headerCell">Purpose</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">Reason</span></th>
                                        <th rowspan="1" style="width:9%"><span class="headerCell">From Date</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">To Date</span></th>
                                        <th rowspan="1" style="width:17%"><span class="headerCell">Duration</span></th>
                                        <th rowspan="1" style="width:17%"><span class="headerCell">Leave Credit Balance</span></th>
                                        <th rowspan="1" style="width:17%"><span class="headerCell">Leave Balance</span></th>
                                        <th rowspan="1" style="width:10%"><span class="headerCell">Status</span></th>
                                    </tr>
                                </thead>
                                  

                                <tbody>

                                    <tr>
                                        <td colspan="8"></td>






                          <?php
include 'DBConnection4.php';


$sql       = 'select * from leaveform where status = "pending"';
$results   = mysqli_query($connection, $sql);
$row_count = mysqli_num_rows($results);
$id = 0;

while ($row = mysqli_fetch_array($results)) {
    echo '<tr><td><a href="LeaveApprove.php?id='.$row['leaveid'].'">'.$row['leaveid'].'</a></td>';
    echo '<td>'.$row['emp_id'].'</td>';
    echo '<td>'.$row['purpose'].'</td>';
    echo '<td>'.$row['reason'].'</td>';
    echo '<td>'.$row['from_date'].'</td>';
    echo '<td>'.$row['to_date'].'</td>';
    echo '<td>'.$row['duration'].'</td>';
    echo '<td>'.$row['leave_credit_balance'].'</td>';
      echo '<td>'.$row['leave_balance'].'</td>';
        echo '<td>'.$row['Status'].'</td></tr>';
}
?>
                                    </tr>
                                </tbody>
                            </table>
<center>
                                  <table class="table hover" id="resultTable">
                        
                                <thead>
                                    <tr>
                                      <center><H1> COMPLETED REQUESTS </H1></center>  
                                        <th rowspan="1" style="width:24%"><span class="headerCell">Leave Id</span></th> 
                                        <th rowspan="1" style="width:18%"><span class="headerCell">Employee ID</span></th>
                                        <th rowspan="1" style="width:10%"><span class="headerCell">Purpose</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">Reason</span></th>
                                        <th rowspan="1" style="width:9%"><span class="headerCell">From Date</span></th>
                                        <th rowspan="1" style="width:12%"><span class="headerCell">To Date</span></th>
                                        <th rowspan="1" style="width:17%"><span class="headerCell">Duration</span></th>
                                        <th rowspan="1" style="width:17%"><span class="headerCell">Leave Credit Balance</span></th>
                                        <th rowspan="1" style="width:17%"><span class="headerCell">Leave Balance</span></th>
                                        <th rowspan="1" style="width:10%"><span class="headerCell">Status</span></th>
                                    </tr>
                                </thead>
                                  

                                <tbody>

                                    <tr>
                                        <td colspan="8"></td>
                                    </tr>

                                                                        <?php
include 'DBConnection4.php';


$sql       = 'select * from leaveform where status = "1" or status = "0"';
$results   = mysqli_query($connection, $sql);
$row_count = mysqli_num_rows($results);
$id = 0;

while ($row = mysqli_fetch_array($results)) {
    echo '<tr><td>'.$row['leaveid'].'</a></td>';
   echo '<td>'.$row['emp_id'].'</td>';
    echo '<td>'.$row['purpose'].'</td>';
    echo '<td>'.$row['reason'].'</td>';
    echo '<td>'.$row['from_date'].'</td>';
    echo '<td>'.$row['to_date'].'</td>';
    echo '<td>'.$row['duration'].'</td>';
    echo '<td>'.$row['leave_credit_balance'].'</td>';
      echo '<td>'.$row['leave_balance'].'</td>';
        echo '<td>'.$row['Status'].'</td></tr>';
}

?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
               
            </div> <!--closing tab -->

        </div>
    </div>


                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>


    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="main.js"></script>
</body>

</html>