<?php
session_start();
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='index.html'>Sign in </a> First ";
}
else
{
include 'dbc.php';

$username=$_SESSION["username"];
$current_file_name = basename($_SERVER['PHP_SELF']);
$sql = "SELECT * FROM adduser where feedisc2 = '$current_file_name' and uname = '$username'";
$result=$conn->query($sql);
$row = $result->fetch_assoc();
$status=$row['feedisc3'] ;

if ($status =="")
{
echo "You are not Authorized This Page <a href='maindashboard.php'>Back </a> ";
}
else
{
include 'dbc.php';
date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		 $my=$month_name . " " . $year;
$userid=$_SESSION["userid"];

$sql3="Select * from addclass where user_id='$userid'";
$result1 = $conn->query($sql3);
//$rows3=$result1 ->fetch_assoc();
?>
<!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 -->

    <?php include("includes/menu.php") ?><!-- /#left-panel -->

    <!-- Left Panel -->

    <!-- Right Panel -->

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

        <!-- Header-->
        <header id="header" class="header">

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

        </header><!-- /header -->
        <!-- Header-->

        <div class="breadcrumbs">
            <div class="col-sm-6">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><? echo "" . $_SESSION["userid"]; ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li class="active"><? echo "" . $_SESSION["username"]; ?></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>

        <div class="content mt-3">

           


          <div class="col-lg-12">
                                                <div class="card">
                                                    <div class="card-header">
                                                        <strong>Leaving Certificate</strong> Form
                                                    </div>
                                                    <div class="card-body card-block">
                                                        <form action="Leaving_Certificate_Save.php" method="post" enctype="multipart/form-data" class="form-horizontal">
                                                              <div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">Date</label></div>
                                                                <div class="col-12 col-md-3"><input type="text" id="date" name="date" placeholder=" Date" class="form-control" value=" <? echo $today ?>"><small class="form-text text-muted"></small></div>
                                                            </div>
															
                                                            <div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">Admission No</label></div>
                                                                <div class="col-12 col-md-3"><input type="text" id="adm_no" name="adm_no" placeholder="Text" class="form-control"><small class="form-text text-muted"></small></div>
                                                            </div>
                                                            
															
                                                            
                                                          
															<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">This is to certify that </label></div>
                                                                <div class="col-12 col-md-6"><input type="text" id="std_name" name="std_name" placeholder="Student Name" class="form-control"><small class="form-text text-muted"></small></div>
                                                            </div>
																
																
																
																<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">Son / Daughter of </label></div>
                                                                <div class="col-12 col-md-6"><input type="text" id="fname" name="fname" placeholder="Father Name" class="form-control"><small class="form-text text-muted"></small></div>
                                                            </div>
																 <div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">was admitted to this school on</label></div>
                                                                <div class="col-12 col-md-3"><input type="text" id="adm_date" name="adm_date" placeholder="Admission Date" class="form-control" value=" <? echo $today ?>"><small class="form-text text-muted"></small></div>
                                                            </div>
															
															<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">and left on</label></div>
                                                                <div class="col-12 col-md-3"><input type="text" id="ldate" name="ldate" placeholder="left date" class="form-control" value=" <? echo $today ?>"><small class="form-text text-muted"></small></div>
                                                            </div>
															
															<div class="row form-group">
                                                                    <div class="col col-md-3"><label for="select" class=" form-control-label">He She was studying in class</label></div>
                                                                    <div class="col-12 col-md-4">
                                                                        <select name="class_name" id="class_name" class="form-control">
                                                                            <?php
  while($user_data3=$result1->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data3['cname']; ?>"><? echo $user_data3["cname"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
                                                                    </div>
                                                                </div>
																
																
																
																
																
																<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">His / Her date of birth in accourdnace with the school record is </label></div>
                                                               <div class="col-12 col-md-3"><input type="text" id="dob" name="dob" placeholder="date of Birh" class="form-control" value=" <? echo $today ?>"><small class="form-text text-muted"></small></div>
															
															<div class="row form-group">
                                                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">He / She has been promoted to class</label></div>
                                                                <div class="col-12 col-md-4"><input type="text" id="pclass" name="pclass" placeholder="" class="form-control"><small class="form-text text-muted"></small></div>
                                                            </div>
															
															
											
                                        </div>
                                                    <div class="card-footer">
                                                        <button type="submit" class="btn btn-primary btn-sm">
                                                            <i class="fa fa-dot-circle-o"></i> Submit
                                                        </button>
                                                        <button type="reset" class="btn btn-danger btn-sm">
                                                            <i class="fa fa-ban"></i> Reset
                                                        </button>
                                                    </div>
													 </form>
                                                </div>
                                                
                                            </div>

            <div class="stat-text"><h2>Leaving Certificate Report</h2></div>
			<div class="card-body">
							<?php

include 'dbc.php';


$userid=$_SESSION["userid"];
$sqlin = "SELECT * FROM leaving where user_id='$userid' order by id";
$resultin=$conn->query($sqlin);
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
                                       echo "<tr>";
echo "<th > S.No </th>";
echo "<th > Date</th>";
echo "<th > Admission # </th>";
echo "<th > Studnet Name </th>";
echo "<th > Father Name </th>";
echo "<th > Admission Date </th>";
echo "<th > Left Date</th>";
echo "<th > Class</th>";
echo "<th > DOB</th>";
echo "<th > Promote Class</th>";



echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
                                       while($rowin = $resultin->fetch_assoc())
 
  {
  $id = $rowin['id'];	
   echo "<tr>";
  echo "<td>" .$rowin['id'] . "</td>";
   echo "<td>" .$rowin['date'] .  "</td>";
  echo "<td>" .$rowin['adm_no'] .  "</td>";
 echo "<td>" .$rowin['std_name'] . "</td>";
 echo "<td>" .$rowin['fname'] .  "</td>";
 echo "<td>" .$rowin['adm_date'] .  "</td>";
 echo "<td>" .$rowin['ldate'] .  "</td>";
 
 echo "<td>" .$rowin['class_name'] .  "</td>";
 echo "<td>" .$rowin['dob'] .  "</td>";
 echo "<td>" .$rowin['pclass'] .  "</td>";
 
		   echo"<th> <a href ='Print_Leaving_Certificate.php?id=$id'>"?><button type="button" class="btn btn-primary">  Print </button><?php "</a>";
		    echo"<th> <a href ='Del_Leaving_Certificate.php?id=$id'>"?><button type="button" class="btn btn-primary">  Del </button><?php "</a>";
	
  echo "</tr>";


  }
  ?>
                                       
                                    </tbody>
                                </table>
                            </div>


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

    <!-- Right Panel -->

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

</body>

</html>
<?php
}
}
?>