<?php
session_start();
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='index.html'>Sign in </a> First ";
}
else
{
date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");

?>
<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->

<head>
   <?php include("includes/header.php") ?>
</head>

<body>


    <!-- Left Panel -->

   <!-- /#left-panel -->

    <!-- Left Panel -->

    <!-- Right Panel -->

    <div id="right-panel" class="right-panel">

        <!-- Header-->
        
        <!-- Header-->

        

        <div class="content mt-3">
            <div class="animated fadeIn">
                <div class="row">

                    <div class="col-md-14">
                        <div class="card">
						<div class="page-title">
						 <strong class="card-title"> <center> <img src="logo1.jpg" align="middle" /></center></strong>
                        <h2><center><? echo "" . $_SESSION["userid"]; ?></center></h2>
                    </div>
                            <div class="card-header">
							
                                <strong class="card-title"><center>All Teacher Information Report</center> </strong>
                            </div>
                            <div class="card-body">
							<?php

include 'dbc.php';

date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$userid=$_SESSION["userid"];
$cname=$_POST["cname"];
$sql = "SELECT * FROM teacher where status='Active' and  user_id='$userid' order by id";
$result=$conn->query($sql);
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
                                       echo "<tr>";
echo "<th bgcolor=#0099FF>  Joning Date </th>";
echo "<th bgcolor=#0099FF> Teacher Id </th>";
echo "<th bgcolor=#0099FF> Teacher Name </th>";
echo "<th bgcolor=#0099FF> Father Name </th>";
echo "<th bgcolor=#0099FF> Dept </th>";
echo "<th bgcolor=#0099FF> Desg </th>";
echo "<th bgcolor=#0099FF> Nic No </th>";
echo "<th bgcolor=#0099FF> Cell No </th>";
echo "<th bgcolor=#0099FF> Address </th>";
echo "<th bgcolor=#0099FF> E-mail </th>";
echo "<th bgcolor=#0099FF> Master </th>";
echo "<th bgcolor=#0099FF> Batch </th>";
echo "<th bgcolor=#0099FF> F.A </th>";
echo "<th bgcolor=#0099FF> Salary </th>";
echo "<th bgcolor=#0099FF> Loan </th>";
echo "<th bgcolor=#0099FF> Security Deposit </th>";
echo "<th bgcolor=#0099FF> Status </th>";
echo "<th bgcolor=#0099FF> Total Service </th>";
echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
                                       while($row = $result->fetch_assoc())
 
  {
 
 $firstDate = $row['adm_date'];
$secondDate = $today;

$dateDifference = abs(strtotime($secondDate) - strtotime($firstDate));

$years  = floor($dateDifference / (365 * 60 * 60 * 24));
$months = floor(($dateDifference - $years * 365 * 60 * 60 * 24) / (30 * 60 * 60 * 24));
$days   = floor(($dateDifference - $years * 365 * 60 * 60 * 24 - $months * 30 * 60 * 60 *24) / (60 * 60 * 24));



   echo "<tr>";
echo "<td>" .$row['adm_date'] . "</td>";
echo "<td>" .$row['teacher_id'] . "</td>";
 echo "<td>" .$row['tech_name'] .  "</td>";
  echo "<td>" .$row['father_name'] .  "</td>";
  echo "<td>" .$row['marital'] . "</td>";
 echo "<td>" .$row['class_name'] . "</td>";
 echo "<td>" .$row['nic_no'] .  "</td>";
 echo "<td>" .$row['cell_no'] .  "</td>";
  echo "<td>" .$row['home_adress'] .  "</td>";
  echo "<td>" .$row['mat'] .  "</td>";
  echo "<td>" .$row['master_edu'] .  "</td>";
  echo "<td>" .$row['bach_edu'] .  "</td>";
  echo "<td>" .$row['fa_edu'] .  "</td>";
  echo "<td>" .number_format($row['monthly_salary']) .  "</td>";
   echo "<td>" .number_format($row['loan']) .  "</td>";
    echo "<td>" .number_format($row['security']) .  "</td>";
   echo "<td>" .$row['status'] .  "</td>";
   echo "<td>" .$years." year,  ".$months." months and ".$days." days" .  "</td>";
  echo "</tr>";

$trecord=$trecord + 1;

  }
   echo "<tr>";
	echo "<td colspan=12 align=right><b>" ."Total Records::". $trecord ."</b></td>";
	  echo "</tr>";
  ?>
                                       
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>


                </div>
            </div><!-- .animated -->
        </div> <!-- .content -->
    </div><!-- /#right-panel -->

    <!-- Right Panel -->

   <?php include("includes/footermenu.php") ?>

</body>

</html>
<?php
}
?>