<?php  
include ('../includes/connection.php');    
if (isset($_POST['add_feb'])){
$student_roll_no = $_POST['student_roll_no']; 
$class_id = $_POST['class_id']; 
$semister = $_POST['semister']; 
$code = $_POST['code']; 
$marks = $_POST['marks'];
$year_of_study = $_POST['year_of_study'];  
$year=date("Y");  
$result_added_by = $_POST['result_added_by'];
$teacher_roll_no = $_POST['teacher_roll_no'];

$student= mysqli_query($conn,"SELECT SUM(course_work) AS T_coursework  FROM `course_work` WHERE code='$code' and student_roll_no='$student_roll_no'")or die(mysqli_error()); 
$course_work = mysqli_fetch_array($student);
$T_coursework=$course_work['T_coursework'];
$grade_total=$T_coursework+$marks;

if ($class_id==6) {
if ($grade_total>= 75) {
        $grade=5; 
      }elseif ($grade_total>= 65) {
        $grade=4; 
      }elseif ($grade_total>= 55) {
        $grade=3; 
      }elseif ($grade_total>= 45) {
        $grade=2; 
      }elseif ($grade_total>= 34) {
        $grade=1; 
      }else{
        $grade=0; 
}  
if ($grade_total>= 75) {
        $average="A"; 
      }elseif ($grade_total>= 65) {
        $average="B"; 
      }elseif ($grade_total>= 55) {
        $average="B+"; 
      }elseif ($grade_total>= 45) {
        $average="C"; 
      }elseif ($grade_total>= 34) {
        $average="D"; 
      }else{
        $average="F"; 
}
 if ($grade_total>= 75) {
        $pass_marks="PASS"; 
      }elseif ($grade_total>= 65) {
        $pass_marks="PASS"; 
      }elseif ($grade_total>= 55) {
        $pass_marks="PASS"; 
      }elseif ($grade_total>= 45) {
        $pass_marks="PASS"; 
      }elseif ($grade_total>= 34) {
        $pass_marks="SUPPLIMENTARY"; 
      }else{
        $pass_marks="SUPPLIMENTARY"; 
}
}else{
if ($grade_total>= 80) {
        $grade=4; 
      }elseif ($grade_total>= 65) {
        $grade=3; 
      }elseif ($grade_total>= 50) {
        $grade=2; 
      }elseif ($grade_total>= 40) {
        $grade=1; 
      }else{
        $grade=0; 
}  
if ($grade_total>= 80) {
        $average="A"; 
      }elseif ($grade_total>= 65) {
        $average="B"; 
      }elseif ($grade_total>= 50) {
        $average="C"; 
      }elseif ($grade_total>= 40) {
        $average="D";  
      }else{
        $average="F"; 
}
 if ($grade_total>= 80) {
        $pass_marks="EXCELLENT"; 
      }elseif ($grade_total>= 65) {
        $pass_marks="GOOD"; 
      }elseif ($grade_total>= 50) {
        $pass_marks="PASS"; 
      }elseif ($grade_total>= 40) {
        $pass_marks="POOR"; 
      }elseif ($grade_total>= 0) {
        $pass_marks="FAIL"; 
      }elseif ($grade_total>= "") {
        $pass_marks="INCOMPLETE"; 
      }else{
        $pass_marks="DISQUALIFICATION"; 
}

}
 
$student= mysqli_query($conn,"SELECT code FROM marks_srms WHERE code='$code' and student_roll_no='$student_roll_no'")or die(mysqli_error());
$row1 = mysqli_fetch_array($student);
$check=$row1['code'];
if ($check!=$code) {
  $query=mysqli_query($conn,"INSERT INTO `marks_srms`(`class_id`,`teacher_roll_no`, `semister`,`average`,`pass_marks`, `code`, `student_roll_no`,`marks`,`course_work`,`grade`, `result_added_by`, `year_of_study`, `Year`) VALUES ('$class_id','$teacher_roll_no', '$semister','$average','$pass_marks','$code','$student_roll_no','$marks','$T_coursework','$grade','$result_added_by','$year_of_study','$year')"); 
  if($query){  
         ?>
         <script type="text/javascript">
             alert("Result Success Fully Added");
         </script>
        <?php  
      }  
      else{
        ?>  
        <script type="text/javascript">
         alert("Sorry Result Failed to add Try Again !!");
        </script>
        <?php
    }
    }else{
      ?>
         <script type="text/javascript">
             alert("Sorry Result Already added");
         </script>
    <?php 
  } 
  
}

if(isset($_POST['update_r']))
{ 
$year_name = $_POST['year_name'];
$id = "1";
$sql =mysqli_query($conn,"update year_srms set year_name='$year_name' WHERE id='$id'");
header('location:admin.php?page=february"');
}

$query1= mysqli_query($conn,"SELECT year_name FROM `year_srms`")or die(mysqli_error());
$update_year = mysqli_fetch_array($query1);
$year_name=$update_year['year_name'];
 
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/jpg" href="../assets/img/mzumbe1.jpg">
  <title>LARMS | Landmark Accademic Result Management System</title> 
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../stp_con/fontawesome-free/css/all.min.css">
  <!-- daterange picker -->
  <link rel="stylesheet" href="../stp_con/daterangepicker/daterangepicker.css">
  <!-- iCheck for checkboxes and radio inputs -->
  <link rel="stylesheet" href="../stp_con/icheck-bootstrap/icheck-bootstrap.min.css">
  <!-- Bootstrap Color Picker -->
  <link rel="stylesheet" href="../stp_con/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css">
  <!-- Tempusdominus Bootstrap 4 -->
  <link rel="stylesheet" href="../stp_con/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="../stp_con/select2/css/select2.min.css">
  <link rel="stylesheet" href="stp_con/select2-bootstrap4-theme/select2-bootstrap4.min.css">
  <!-- Bootstrap4 Duallistbox -->
  <link rel="stylesheet" href="../stp_con/bootstrap4-duallistbox/bootstrap-duallistbox.min.css">
  <!-- BS Stepper -->
  <link rel="stylesheet" href="../stp_con/bs-stepper/css/bs-stepper.min.css">
  <!-- dropzonejs -->
  <link rel="stylesheet" href="../stp_con/dropzone/min/dropzone.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../assets/css/adminlte.min.css">
  <link rel="stylesheet" type="text/css" href="../stp_con/parsley/parsley.css"/>
</head>
<body class="hold-transition sidebar-mini layout-fixed top-nav">
<!-- Site wrapper -->
 
<div class="wrapper"> 
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header" style="background: url('../assets/img/ban.jpg') center center; color: white;">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <a><strong>Level For Examination Result</strong></a>
             <?php if(isset($_SESSION['status']) && $_SESSION['status']== "success"): ?>
              <div class="alert alert-success alert-dismissable">
                  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                  <h5><i class="icon fas fa-check"></i> Alert!</h5>
                  <?= $_SESSION['message'] ?>
                </div> 
                <?php unset($_SESSION['status']);unset($_SESSION['message']) ?>
                <?php endif; ?>
                <?php if(isset($_SESSION['status']) && $_SESSION['status'] == "error"): ?>
              <div class="alert alert-danger alert-dismissible">
                  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                  <h5><i class="icon fas fa-check"></i> Alert!</h5>
                  <?= $_SESSION['message'] ?>
                </div> 
            <?php unset($_SESSION['status']);unset($_SESSION['message']) ?>
            <?php endif; ?>
          </div> 
        </div>
      </div><!-- /.container-fluid -->
    </section>
<br><br>
   <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row"> 
          <!-- /.col -->
          <div class="col-md-12">
            <div class="card">
              <div class="card-header p-2">
                <ul class="nav nav-pills ">
                  <?php  
                   $query1= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error()); 

                   $query= mysqli_query($conn,"SELECT * FROM class_srms where class_id='4' AND  class_status='Enable' ORDER BY class_name ASC")or die(mysqli_error());
                    $class = mysqli_fetch_array($query); 
                    $class_id=4;
                   if ($class['class_id']=="$class_id") {
                    ?>    
                  <li class="nav-item "><a class="nav-link active" href="#class_one" data-toggle="tab"><?php echo $class['class_name']; ?></a></li>  
                  <?php }
                   $q = mysqli_fetch_array($query1); 
                   $categ="Academic Master";    
                    ?> 
                      <?php
                        if ($q['user_type']=="$categ") {
                        ?>      
                        <li class="nav-item "><a class="nav-link " href="#accountancy" data-toggle="tab">ACCOUNTANCY</a></li> 
                        <li class="nav-item "><a class="nav-link " href="#business" data-toggle="tab">BUSINESS ADMINISTRATION</a></li> 
                        <li class="nav-item "><a class="nav-link " href="#education" data-toggle="tab">EDUCATION</a></li> 
                        <li class="nav-item "><a class="nav-link " href="#ict" data-toggle="tab">ICT</a></li> 
                  <?php }?>  

                </ul>
              </div>

              <!-- /.card-header --> 
              <div class="card-body"> 
              <div class="tab-content">
              <!-- /.tab-pane -->
              <div class="active tab-pane" id="class_one">
              <div class="container-fluid">
                <div class="row">
                  <div class="col-sm-12">  
                    <div class="card"> 
                      <div class="card-header">
                      <h3 class="card-title">Class Result List For Level Four</h3>
                      <div class="float-right mb-2">
                        <a data-toggle="modal" href="#class_1" class="btn btn-info btn-xs float-right ml-2" >
                            <i class="fa fa-plus"></i> Add Result Here
                        </a>
                        <?php  
                        $query= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error());
                        $q = mysqli_fetch_array($query); 
                        $categ="Academic Master";    
                        ?> 
                        <?php
                        if ($q['user_type']=="$categ") {
                        ?>    
                        <a data-toggle="modal" href="#update" class="btn btn-info btn-xs float-right ml-2" >
                            <i class="fa fa-edit"></i> Update Result
                        </a>
                        <?php }?>
                        <a data-toggle="modal" href="#csv_1" class="btn btn-secondary btn-xs float-right ml-2" >
                            <i class="fa fa-upload"></i> Upload CSV Result
                        </a>
                        </div>
                  </div> 
                  <div class="modal fade" id="update">
                          <div class="modal-dialog">
                            <form method="post" action="">
                                <div class="modal-content">
                                  <div class="modal-header">
                                      <h4 class="modal-title" id="modal_title">Update The Whole Result</h4>
                                      <button type="button" class="close" data-dismiss="modal">&times;</button>
                                  </div>
                                  <div class="modal-body">
                                    <span id="form_message"></span>
                                      <div class="form-group">
                                        <label>Select Year</label>
                                        <div class="select2-purple">  
                                        <select name="year_name" id="year_name" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option value="2023">2023</option> 
                                            <option value="2024">2024</option> 
                                            <option value="2025">2025</option>
                                            <option value="2026">2026</option>
                                            <option value="2027">2027</option>
                                            <option value="2028">2028</option>    
                                      </select>
                                    </div>
                                      </div>
                                  </div>
                                  <div class="modal-footer"> 
                                      <button type="submit" name="update_r" class="btn btn-secondary">UPDATE</button>
                                      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                  </div>
                                </div>
                            </form>
                            </div>
                       </div><!-- /.modal -->
                 <!-- /.card-header -->
                  <div class="card-body">
                  
                <div class="table-responsive">

                    <table id="example1" class="table table-striped display table-bordered" >
                  <?php  
                        $query= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error());
                        $q = mysqli_fetch_array($query); 
                        $categ="Academic Master";    
                        ?> 
                   <?php
                  if ($q['user_type']=="$categ") {
                  ?>
                      <thead>
                        <tr>
                            <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                            <th>Program</th> 
                            <th>Tatal units</th>
                            <th>Total grade</th>
                            <th>GPA</th>  
                            <th>YEAR</th> 
                            <th>Added By</th> 
                            <th>Download</th>
                            <th>Action</th>
                        </tr>
                        </thead>

                        <tbody>
                          <?php  
                          $i = 1; 
                           $depertment= "Business Administration"; 
                          $query= mysqli_query($conn,"SELECT program,SUM(credit) as T_creadit  FROM `subject` WHERE semister='1' AND  department='$depertment' AND class_id='$class_id'")or die(mysqli_error());
                           $unity = mysqli_fetch_array($query);  

                           $query= mysqli_query($conn,"SELECT *,subject.code,marks_srms.grade,subject.credit,SUM(marks_srms.grade*subject.credit) as grade_total  FROM `marks_srms`,`subject`,student_srms WHERE student_srms.student_roll_no=marks_srms.student_roll_no AND subject.code=marks_srms.code AND marks_srms.semister='1' AND student_srms.student_status ='Enable' AND marks_srms.class_id='$class_id'  AND student_srms.course='$depertment' GROUP BY  student_srms.student_roll_no ASC;")or die(mysqli_error()); 
                         while($grade = mysqli_fetch_array($query)){  
                          $unity_total=$unity['T_creadit']; 
                          $grade_total=$grade['grade_total'];  
                          $Gpa=$grade_total/$unity_total; 
                        ?> 
                        <tr>
                          <td><?php echo $i++ ?></td> 
                          <td><?php echo $grade['student_roll_no']; ?></td>
                          <td><?php echo $grade['student_name']; ?></td> 
                          <td><?php echo $grade['course']; ?></td> 
                          <td style="color: green;"><?php echo $unity_total; ?></td> 
                          <td><?php echo $grade['grade_total']; ?></td>  
                          <td style="color: red;"> <?php echo round($Gpa, 1); ?> </td>
                          <td><?php echo $grade['Year']; ?> SEM <span class="badge bg-success"><?php echo $grade['semister']; ?></span></td>  
                          <td><?php echo $grade['result_added_by']; ?></td>
                         
                          <td>
                            <div class="btn-group">
                            <a  href="views/view_result_pdf.php?id=<?php echo $grade['student_roll_no']; ?>" class="btn btn-info btn-flat"><i class="fa fa-download"></i>
                            </a> 
                          </div>
                          </td> 
                          <td>
                          <div class="btn-group">
                            <a href="admin.php?page=edit_four_1&id=<?php echo $grade['student_roll_no']; ?>" class="btn btn-primary btn-flat manage_class">
                              <i class="fas fa-edit"></i> 
                            </a>
                             <a href="delete_feb.php?del=<?php echo $grade['marks_id']; ?>" onclick="return confirm('Are you sure you want to delete?');" class="btn btn-danger btn-flat delete_student">
                              <i class="fas fa-trash"></i>
                            </a>   
                        </div> </td>
                      </tr> 
                      <?php }?> 
                        </tbody>

                        <tfoot>
                        <tr> 
                             <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                             <th>Program</th> 
                            <th>Tatal units</th>
                            <th>Total grade</th>
                            <th>GPA</th>  
                            <th>YEAR</th> 
                            <th>Added By</th> 
                            <th>Download</th>
                            <th>Action</th>
                        </tr>

                      </tfoot> 
                       <?php }else{ ?>
                         <thead>
                        <tr>
                            <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                            <th>Total Marks</th>
                            <th>VIEW</th>  
                        </tr>
                        </thead>

                        <tbody>
                          <?php 
                           $i = 1; 
                              $query= mysqli_query($conn,"SELECT program,SUM(credit) as T_creadit  FROM `subject` WHERE semister='1' AND class_id='$class_id'")or die(mysqli_error()); 
                               $unity = mysqli_fetch_array($query);  
                               $selected = mysqli_query($conn,"SELECT *, student_srms.student_roll_no,student_srms.student_name,s.marks_id, sum(marks) as total,count(code) as t_code FROM student_srms,marks_srms AS s WHERE s.class_id = '$class_id' AND s.semister='1' AND  student_srms.student_roll_no = s.student_roll_no AND student_srms.student_status ='Enable'  GROUP BY  s.student_roll_no ASC;");
                             while($row = mysqli_fetch_array($selected)){  

                              $unity_total=$unity['T_creadit'];
                              $grade_total=$row['T_GST_04102']+$row['T_GST04103']+$row['T_GST04101']+$row['T_BAT04101'];
                              $Gpa=$grade_total/$unity_total;
                              $GST04101=$row['GST04101'];
                              if ($GST04101>= 80) {
                                  $grade_t="4"; 
                                }elseif ($GST04101>= 70) {
                                  $grade_t="3"; 
                                }elseif ($GST04101>= 60) {
                                  $grade_t="2"; 
                                }elseif ($GST04101>= 50) {
                                  $grade_t="1"; 
                                }elseif ($GST04101>= 40) {
                                  $grade_t="0"; 
                                }else{
                                  $grade_t="0"; 
                              }
                            ?> 
                        <tr>
                          <td><?php echo $i++ ?></td> 
                          <td><?php echo $row['student_roll_no']; ?></td>
                          <td><?php echo $row['student_name']; ?></td> 
                          <td><?php echo $row['total']; ?> -> <span class="badge bg-success"><?php echo $row['t_code']; ?></span></td>   
                            <td>
                          <div class="btn-group">
                            <a href="admin.php?page=view_course&id=<?php echo $row['student_roll_no']; ?>" class="btn btn-primary btn-flat manage_class">
                              <i class="fas fa-eye"></i> 
                            </a>    
                        </div> 
                      </td> 
                      </tr> 
                      <?php }?> 
                        </tbody>

                        <tfoot>
                        <tr> 
                            <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                            <th>Total Marks</th>
                            <th>VIEW</th>  
                        </tr>
                        
                      </tfoot> 
                    <?php }?>
                    </table> 
                   <div class="modal fade" id="csv_1">
                    <div class="modal-dialog">
                      <form action="views/import_csv.php" id="import-form" method="POST" enctype="multipart/form-data">
                          <div class="modal-content">
                            <div class="modal-header">
                                <h4 class="modal-title" id="modal_title">Importing CSV Data</h4>
                                <button type="button" class="close" data-dismiss="modal">&times;</button>
                            </div>
                            <div class="modal-body">
                              <span id="form_message"></span>
                                <div class="form-group">
                                  <label for="fileData" class="form-label">Browse CSV File</label>
                                  <input class="form-control" type="file" accept=".csv" name="fileData" id="fileData" required>
                                </div>
                            </div>
                            <div class="modal-footer"> 
                                <input type="submit" name="submit" class="btn btn-secondary" value="Add" />
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            </div>
                          </div>
                      </form>
                    </div>
                 </div><!-- /.modal -->

                      <!-- /.add class one result -->
                 <div id="class_1" class="modal fade">
                  <div class="modal-dialog">
                    <form method="post" action="" id="login_form">
                        <div class="modal-content">
                          <div class="modal-header">
                              <h4 class="modal-title" id="modal_title">Upload Result</h4>
                              <button type="button" class="close" data-dismiss="modal">&times;</button>
                          </div> 
                          <div class="modal-body"> 
                          <?php  
                            $query = "SELECT * FROM class_srms where class_id='$class_id' AND  class_status='Enable' ORDER BY class_name ASC"; 
                            $result = $conn->query($query);      
                             ?>
                             
                              <div class="form-group">
                                  <label>Class <span style="color: red;">*</span></label>
                                   <?php 
                                    if($result->num_rows > 0){ 
                                        while($row = $result->fetch_assoc()){  
                                            echo '
                                            <input type="hidden" name="class_id" value="'.$row['class_id'].'" class="form-control" required>
                                            <input type="text" value="'.$row['class_name'].'" class="form-control" disabled>'; 
                                        } 
                                    }else{ 
                                        echo '<input type="text" disabled class="form-control" placeholder="Class not available Contuct to admin">'; 
                                    } 
                                  ?>
                                </div> 
                                <div class="form-group">
                                        <label>Select Year</label>
                                        <div class="select2-purple">  
                                        <select name="year_of_study" id="year_of_study" class="form-control select2" data-dropdown-css-class="Select a year" style="width: 100%;" required>
                                            <option value="2020-2021">2020-2021</option> 
                                            <option value="2021-2022">2021-2022</option> 
                                            <option value="2022-2023">2022-2023</option>
                                            <option value="2023-2024">2023-2024</option> 
                                            <option value="2024-2025">2024-2025</option> 
                                            <option value="2025-2026">2025-2026</option>
                                            <option value="2026-2027">2026-2027</option>
                                            <option value="2027-2028">2027-2028</option>
                                            <option value="2028-2029">2028-2029</option> 
                                            <option value="2028-2029">2029-2030</option>   
                                      </select>
                                    </div>
                                  </div>
                                  <div class="form-group">
                                      <label>Student Name<span style="color: red;">*</span></label>
                                      <div class="select2-purple"> 
                                      <?php  
                                        $query = "SELECT * FROM student_srms where class_id= '$class_id' and student_status ='Enable' ORDER BY student_name ASC"; 
                                        $result = $conn->query($query);         
                                         ?> 

                                        <select name="student_roll_no" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option>Select Student</option>
                                            <?php 
                                            if($result->num_rows > 0){
                                             
                                                while($row = $result->fetch_assoc()){  
                                                    echo '<option value="'.$row['student_roll_no'].'">'.$row['student_name'].' | '.$row['student_roll_no'].'</option>';

                                                }
                                               
                                            }else{ 
                                                echo '<option value="">Student not available</option>'; 
                                            } 
                                          ?>
                                      </select>
                                    </div>
                                  </div>  
                                  <div class="form-group">
                                      <label>Program Name<span style="color: red;">*</span></label>
                                      <div class="select2-purple"> 
                                      <?php  
                                        $query = "SELECT * FROM subject where class_id= '$class_id' AND semister=1 AND program_stutus='Enable' ORDER BY program ASC"; 
                                        $result = $conn->query($query);         
                                         ?> 

                                        <select name="code" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option>Select Program</option>
                                            <?php 
                                            if($result->num_rows > 0){
                                             
                                                while($row = $result->fetch_assoc()){  
                                                    echo '<option value="'.$row['code'].'">'.$row['code'].' | '.$row['program'].'</option>';

                                                }
                                               
                                            }else{ 
                                                echo '<option value="">Program not available</option>'; 
                                            } 
                                          ?>
                                      </select>
                                    </div>
                                  </div> 
                                  <?php
                                  $exam= mysqli_query($conn,"SELECT exam_id,semister FROM  exam_srms where  class_id= '$class_id' AND exam_status='Enable' ")or die(mysqli_error());
                                   $exam_1 = mysqli_fetch_array($exam);?> 
                                    <input type="hidden" name="semister" id="semister" value="<?php echo $exam_1['semister'];  ?>">
                                    <?php  
                                   $query= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error());
                                  $q1 = mysqli_fetch_array($query);     
                                  ?>  
                                  <input type="hidden" name="teacher_roll_no" value="<?php echo $q1['teacher_roll_no']; ?>">            
                                  <input type="hidden" name="result_added_by" value="<?php echo $q1['user_name']; ?>">  
                                    <div class="form-group">
                                    <label>SCORE <span style="color: red;">*</span></label>
                                     <input type="text" name="marks" id="marks" class="form-control" required data-parsley-max="40" required data-parsley-type="integer"  data-parsley-trigger="keyup"  placeholder="Hint: Marks <= 40"/>
                                    </div> 
                                </div>
                              <div class="modal-footer">  
                              <button type="submit" name="add_feb" class="btn btn-info">ADD</button>
                              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                          </div>
                        </div> 
                    </form>
                  </div>
              </div>
                

                 </div>
                 </div> 
              </div> <!-- end card body-->
            </div> <!-- end card --> 
            </div>
            <!-- /.card -->
          </div>
          </div>
          <!-- END OF CLASS ONE --->
 
          <div class="tab-pane" id="accountancy">
              <div class="container-fluid">
                <div class="row">
                  <div class="col-sm-12">  
                    <div class="card"> 
                      <div class="card-header">
                      <h3 class="card-title">Class Result List For accountancy Level Four</h3>
                      <div class="float-right mb-2">
                        <a data-toggle="modal" href="#account_1" class="btn btn-info btn-xs float-right ml-2" >
                            <i class="fa fa-plus"></i> Add Result Here
                        </a>
                        <?php  
                        $query= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error());
                        $q = mysqli_fetch_array($query); 
                        $categ="Academic Master";    
                        ?> 
                        <?php
                        if ($q['user_type']=="$categ") {
                        ?>    
                        <a data-toggle="modal" href="#update1" class="btn btn-info btn-xs float-right ml-2" >
                            <i class="fa fa-edit"></i> Update Result
                        </a>
                        <?php }?> 
                        </div>
                  </div> 
                  <div class="modal fade" id="update1">
                          <div class="modal-dialog">
                            <form method="post" action="">
                                <div class="modal-content">
                                  <div class="modal-header">
                                      <h4 class="modal-title" id="modal_title">Update The Whole Result</h4>
                                      <button type="button" class="close" data-dismiss="modal">&times;</button>
                                  </div>
                                  <div class="modal-body">
                                    <span id="form_message"></span>
                                      <div class="form-group">
                                        <label>Select Year</label>
                                        <div class="select2-purple">  
                                        <select name="year_name" id="year_name" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option value="2023">2023</option> 
                                            <option value="2024">2024</option> 
                                            <option value="2025">2025</option>
                                            <option value="2026">2026</option>
                                            <option value="2027">2027</option>
                                            <option value="2028">2028</option>    
                                      </select>
                                    </div>
                                      </div>
                                  </div>
                                  <div class="modal-footer"> 
                                      <button type="submit" name="update_r" class="btn btn-secondary">UPDATE</button>
                                      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                  </div>
                                </div>
                            </form>
                            </div>
                       </div><!-- /.modal -->
                 <!-- /.card-header -->
                  <div class="card-body">
                  
                <div class="table-responsive">

                    <table id="example2" class="table table-striped display table-bordered" > 
                      <thead>
                        <tr>
                            <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                            <th>Program</th> 
                            <th>Tatal units</th>
                            <th>Total grade</th>
                            <th>GPA</th>  
                            <th>YEAR</th> 
                            <th>Added By</th> 
                            <th>Download</th>
                            <th>Action</th>
                        </tr>
                        </thead>

                        <tbody>
                          <?php  
                          $i = 1; 
                          $depertment= "Accountancy"; 
                          $query= mysqli_query($conn,"SELECT program,SUM(credit) as T_creadit  FROM `subject` WHERE semister='1' AND  department='$depertment' AND class_id='$class_id'")or die(mysqli_error());
                           $unity = mysqli_fetch_array($query);  

                           $query= mysqli_query($conn,"SELECT *,subject.code,marks_srms.grade,subject.credit,SUM(marks_srms.grade*subject.credit) as grade_total  FROM `marks_srms`,`subject`,student_srms WHERE student_srms.student_roll_no=marks_srms.student_roll_no AND subject.code=marks_srms.code AND marks_srms.semister='1' AND student_srms.student_status ='Enable' AND marks_srms.class_id='$class_id'  AND student_srms.course='$depertment' GROUP BY  student_srms.student_roll_no ASC;")or die(mysqli_error()); 
                         while($grade = mysqli_fetch_array($query)){  
                          $unity_total=$unity['T_creadit']; 
                          $grade_total=$grade['grade_total'];  
                          $Gpa=$grade_total/$unity_total; 
                        ?> 
                        <tr>
                          <td><?php echo $i++ ?></td> 
                          <td><?php echo $grade['student_roll_no']; ?></td>
                          <td><?php echo $grade['student_name']; ?></td> 
                          <td><?php echo $grade['course']; ?></td> 
                          <td style="color: green;"><?php echo $unity_total; ?></td> 
                          <td><?php echo $grade['grade_total']; ?></td>  
                          <td style="color: red;"> <?php echo round($Gpa, 1); ?> </td>
                          <td><?php echo $grade['Year']; ?> SEM <span class="badge bg-success"><?php echo $grade['semister']; ?></span></td>  
                          <td><?php echo $grade['result_added_by']; ?></td>
                         
                          <td>
                            <div class="btn-group">
                            <a  href="views/view_result_pdf.php?id=<?php echo $grade['student_roll_no']; ?>" class="btn btn-info btn-flat"><i class="fa fa-download"></i>
                            </a> 
                          </div>
                          </td> 
                          <td>
                          <div class="btn-group">
                            <a href="admin.php?page=edit_four_1&id=<?php echo $grade['student_roll_no']; ?>" class="btn btn-primary btn-flat manage_class">
                              <i class="fas fa-edit"></i> 
                            </a>
                             <a href="delete_feb.php?del=<?php echo $grade['marks_id']; ?>" onclick="return confirm('Are you sure you want to delete?');" class="btn btn-danger btn-flat delete_student">
                              <i class="fas fa-trash"></i>
                            </a>   
                        </div> </td>
                      </tr> 
                      <?php }?> 
                        </tbody>

                        <tfoot>
                        <tr> 
                             <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                             <th>Program</th> 
                            <th>Tatal units</th>
                            <th>Total grade</th>
                            <th>GPA</th>  
                            <th>YEAR</th> 
                            <th>Added By</th> 
                            <th>Download</th>
                            <th>Action</th>
                        </tr>

                      </tfoot> 
                    </table> 
                   <div class="modal fade" id="csv_1">
                    <div class="modal-dialog">
                      <form action="views/import_csv.php" id="import-form" method="POST" enctype="multipart/form-data">
                          <div class="modal-content">
                            <div class="modal-header">
                                <h4 class="modal-title" id="modal_title">Importing CSV Data</h4>
                                <button type="button" class="close" data-dismiss="modal">&times;</button>
                            </div>
                            <div class="modal-body">
                              <span id="form_message"></span>
                                <div class="form-group">
                                  <label for="fileData" class="form-label">Browse CSV File</label>
                                  <input class="form-control" type="file" accept=".csv" name="fileData" id="fileData" required>
                                </div>
                            </div>
                            <div class="modal-footer"> 
                                <input type="submit" name="submit" class="btn btn-secondary" value="Add" />
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            </div>
                          </div>
                      </form>
                    </div>
                 </div><!-- /.modal -->

                      <!-- /.add class one result -->
                 <div id="account_1" class="modal fade">
                  <div class="modal-dialog">
                    <form method="post" action="" id="login_form">
                        <div class="modal-content">
                          <div class="modal-header">
                              <h4 class="modal-title" id="modal_title">Upload Result</h4>
                              <button type="button" class="close" data-dismiss="modal">&times;</button>
                          </div> 
                          <div class="modal-body"> 
                          <?php  
                            $query = "SELECT * FROM class_srms where class_id='$class_id' AND  class_status='Enable' ORDER BY class_name ASC"; 
                            $result = $conn->query($query);      
                             ?>
                             
                              <div class="form-group">
                                  <label>Class <span style="color: red;">*</span></label>
                                   <?php 
                                    if($result->num_rows > 0){ 
                                        while($row = $result->fetch_assoc()){  
                                            echo '
                                            <input type="hidden" name="class_id" value="'.$row['class_id'].'" class="form-control" required>
                                            <input type="text" value="'.$row['class_name'].'" class="form-control" disabled>'; 
                                        } 
                                    }else{ 
                                        echo '<input type="text" disabled class="form-control" placeholder="Class not available Contuct to admin">'; 
                                    } 
                                  ?>
                                </div> 
                                <div class="form-group">
                                        <label>Select Year</label>
                                        <div class="select2-purple">  
                                        <select name="year_of_study" id="year_of_study" class="form-control select2" data-dropdown-css-class="Select a year" style="width: 100%;" required>
                                            <option value="2020-2021">2020-2021</option> 
                                            <option value="2021-2022">2021-2022</option> 
                                            <option value="2022-2023">2022-2023</option>
                                            <option value="2023-2024">2023-2024</option> 
                                            <option value="2024-2025">2024-2025</option> 
                                            <option value="2025-2026">2025-2026</option>
                                            <option value="2026-2027">2026-2027</option>
                                            <option value="2027-2028">2027-2028</option>
                                            <option value="2028-2029">2028-2029</option> 
                                            <option value="2028-2029">2029-2030</option>   
                                      </select>
                                    </div>
                                  </div>
                                  <div class="form-group">
                                      <label>Student Name<span style="color: red;">*</span></label>
                                      <div class="select2-purple"> 
                                      <?php  
                                        $depertment= "Accountancy"; 
                                        $query = "SELECT * FROM student_srms where class_id= '$class_id' and student_status ='Enable' and course ='$depertment' ORDER BY student_name ASC"; 
                                        $result = $conn->query($query);         
                                         ?> 

                                        <select name="student_roll_no" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option>Select Student</option>
                                            <?php 
                                            if($result->num_rows > 0){
                                             
                                                while($row = $result->fetch_assoc()){  
                                                    echo '<option value="'.$row['student_roll_no'].'">'.$row['student_name'].' | '.$row['student_roll_no'].'</option>';

                                                }
                                               
                                            }else{ 
                                                echo '<option value="">Student not available</option>'; 
                                            } 
                                          ?>
                                      </select>
                                    </div>
                                  </div>  
                                  <div class="form-group">
                                      <label>Program Name<span style="color: red;">*</span></label>
                                      <div class="select2-purple"> 
                                      <?php  
                                      $depertment= "Accountancy"; 
                                        $query = "SELECT * FROM subject where class_id= '$class_id' AND semister=1 AND department='$depertment' AND program_stutus='Enable' ORDER BY program ASC"; 
                                        $result = $conn->query($query);         
                                         ?> 

                                        <select name="code" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option>Select Program</option>
                                            <?php 
                                            if($result->num_rows > 0){
                                             
                                                while($row = $result->fetch_assoc()){  
                                                    echo '<option value="'.$row['code'].'">'.$row['code'].' | '.$row['program'].'</option>';

                                                }
                                               
                                            }else{ 
                                                echo '<option value="">Program not available</option>'; 
                                            } 
                                          ?>
                                      </select>
                                    </div>
                                  </div> 
                                  <?php
                                  $exam= mysqli_query($conn,"SELECT exam_id,semister FROM  exam_srms where  class_id= '$class_id' AND exam_status='Enable' ")or die(mysqli_error());
                                   $exam_1 = mysqli_fetch_array($exam);?> 
                                    <input type="hidden" name="semister" id="semister" value="<?php echo $exam_1['semister'];  ?>">
                                    <?php  
                                   $query= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error());
                                  $q1 = mysqli_fetch_array($query);     
                                  ?>  
                                   <input type="hidden" name="teacher_roll_no" value="<?php echo $q1['teacher_roll_no']; ?>">            
                                  <input type="hidden" name="result_added_by" value="<?php echo $q1['user_name']; ?>">  
                                    <div class="form-group">
                                    <label>SCORE <span style="color: red;">*</span></label>
                                     <input type="text" name="marks" id="marks" class="form-control" required data-parsley-max="40" required data-parsley-type="integer"  data-parsley-trigger="keyup"  placeholder="Hint: Marks <= 40"/>
                                    </div> 
                                </div>
                              <div class="modal-footer">  
                              <button type="submit" name="add_feb" class="btn btn-info">ADD</button>
                              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                          </div>
                        </div> 
                    </form>
                  </div>
                  </div> 
                 </div>
                 </div> 
              </div> <!-- end card body-->
            </div> <!-- end card --> 
            </div>
            <!-- /.card -->
          </div>
          </div>
          <!-- END OF CLASS ONE --->
             
         <div class="tab-pane" id="business">
              <div class="container-fluid">
                <div class="row">
                  <div class="col-sm-12">  
                    <div class="card"> 
                      <div class="card-header">
                      <h3 class="card-title">Class Result List For Business administration Level Four</h3>
                      <div class="float-right mb-2">
                        <a data-toggle="modal" href="#busines_1" class="btn btn-info btn-xs float-right ml-2" >
                            <i class="fa fa-plus"></i> Add Result Here
                        </a>
                        <?php  
                        $query= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error());
                        $q = mysqli_fetch_array($query); 
                        $categ="Academic Master";    
                        ?> 
                        <?php
                        if ($q['user_type']=="$categ") {
                        ?>    
                        <a data-toggle="modal" href="#update" class="btn btn-info btn-xs float-right ml-2" >
                            <i class="fa fa-edit"></i> Update Result
                        </a>
                        <?php }?> 
                    </div>
                  </div> 
                  <div class="modal fade" id="update">
                          <div class="modal-dialog">
                            <form method="post" action="">
                                <div class="modal-content">
                                  <div class="modal-header">
                                      <h4 class="modal-title" id="modal_title">Update The Whole Result</h4>
                                      <button type="button" class="close" data-dismiss="modal">&times;</button>
                                  </div>
                                  <div class="modal-body">
                                    <span id="form_message"></span>
                                      <div class="form-group">
                                        <label>Select Year</label>
                                        <div class="select2-purple">  
                                        <select name="year_name" id="year_name" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option value="2023">2023</option> 
                                            <option value="2024">2024</option> 
                                            <option value="2025">2025</option>
                                            <option value="2026">2026</option>
                                            <option value="2027">2027</option>
                                            <option value="2028">2028</option>    
                                      </select>
                                    </div>
                                      </div>
                                  </div>
                                  <div class="modal-footer"> 
                                      <button type="submit" name="update_r" class="btn btn-secondary">UPDATE</button>
                                      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                  </div>
                                </div>
                            </form>
                            </div>
                       </div><!-- /.modal -->
                 <!-- /.card-header -->
                  <div class="card-body">
                  
                <div class="table-responsive">

                    <table id="example3" class="table table-striped display table-bordered" > 
                      <thead>
                        <tr>
                            <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                            <th>Program</th> 
                            <th>Tatal units</th>
                            <th>Total grade</th>
                            <th>GPA</th>  
                            <th>YEAR</th> 
                            <th>Added By</th> 
                            <th>Download</th>
                            <th>Action</th>
                        </tr>
                        </thead> 
                        <tbody>
                          <?php  
                          $i = 1; 
                           $depertment= "Business Administration"; 
                          $query= mysqli_query($conn,"SELECT program,SUM(credit) as T_creadit  FROM `subject` WHERE semister='1' AND  department='$depertment' AND class_id='$class_id'")or die(mysqli_error());
                           $unity = mysqli_fetch_array($query);  

                           $query= mysqli_query($conn,"SELECT *,subject.code,marks_srms.grade,subject.credit,SUM(marks_srms.grade*subject.credit) as grade_total  FROM `marks_srms`,`subject`,student_srms WHERE student_srms.student_roll_no=marks_srms.student_roll_no AND subject.code=marks_srms.code AND marks_srms.semister='1' AND student_srms.student_status ='Enable' AND marks_srms.class_id='$class_id'  AND student_srms.course='$depertment' GROUP BY  student_srms.student_roll_no ASC;")or die(mysqli_error()); 
                         while($grade = mysqli_fetch_array($query)){  
                          $unity_total=$unity['T_creadit']; 
                          $grade_total=$grade['grade_total'];  
                          $Gpa=$grade_total/$unity_total; 
                        ?> 
                        <tr>
                          <td><?php echo $i++ ?></td> 
                          <td><?php echo $grade['student_roll_no']; ?></td>
                          <td><?php echo $grade['student_name']; ?></td> 
                          <td><?php echo $grade['course']; ?></td> 
                          <td style="color: green;"><?php echo $unity_total; ?></td> 
                          <td><?php echo $grade['grade_total']; ?></td>  
                          <td style="color: red;"> <?php echo round($Gpa, 1); ?> </td>
                          <td><?php echo $grade['Year']; ?> SEM <span class="badge bg-success"><?php echo $grade['semister']; ?></span></td>  
                          <td><?php echo $grade['result_added_by']; ?></td>
                         
                          <td>
                            <div class="btn-group">
                            <a  href="views/view_result_pdf.php?id=<?php echo $grade['student_roll_no']; ?>" class="btn btn-info btn-flat"><i class="fa fa-download"></i>
                            </a> 
                          </div>
                          </td> 
                          <td>
                          <div class="btn-group">
                            <a href="admin.php?page=edit_four_1&id=<?php echo $grade['student_roll_no']; ?>" class="btn btn-primary btn-flat manage_class">
                              <i class="fas fa-edit"></i> 
                            </a>
                             <a href="delete_feb.php?del=<?php echo $grade['marks_id']; ?>" onclick="return confirm('Are you sure you want to delete?');" class="btn btn-danger btn-flat delete_student">
                              <i class="fas fa-trash"></i>
                            </a>   
                        </div> </td>
                      </tr> 
                      <?php }?> 
                        </tbody>

                        <tfoot>
                        <tr> 
                             <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                             <th>Program</th> 
                            <th>Tatal units</th>
                            <th>Total grade</th>
                            <th>GPA</th>  
                            <th>YEAR</th> 
                            <th>Added By</th> 
                            <th>Download</th>
                            <th>Action</th>
                        </tr>

                      </tfoot>   
                    </table> 
                   <div class="modal fade" id="csv_1">
                    <div class="modal-dialog">
                      <form action="views/import_csv.php" id="import-form" method="POST" enctype="multipart/form-data">
                          <div class="modal-content">
                            <div class="modal-header">
                                <h4 class="modal-title" id="modal_title">Importing CSV Data</h4>
                                <button type="button" class="close" data-dismiss="modal">&times;</button>
                            </div>
                            <div class="modal-body">
                              <span id="form_message"></span>
                                <div class="form-group">
                                  <label for="fileData" class="form-label">Browse CSV File</label>
                                  <input class="form-control" type="file" accept=".csv" name="fileData" id="fileData" required>
                                </div>
                            </div>
                            <div class="modal-footer"> 
                                <input type="submit" name="submit" class="btn btn-secondary" value="Add" />
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            </div>
                          </div>
                      </form>
                    </div>
                 </div><!-- /.modal -->

                      <!-- /.add class one result -->
                 <div id="busines_1" class="modal fade">
                  <div class="modal-dialog">
                    <form method="post" action="" id="login_form">
                        <div class="modal-content">
                          <div class="modal-header">
                              <h4 class="modal-title" id="modal_title">Upload Result</h4>
                              <button type="button" class="close" data-dismiss="modal">&times;</button>
                          </div> 
                          <div class="modal-body"> 
                          <?php  
                            $query = "SELECT * FROM class_srms where class_id='$class_id' AND  class_status='Enable' ORDER BY class_name ASC"; 
                            $result = $conn->query($query);      
                             ?>
                             
                              <div class="form-group">
                                  <label>Class <span style="color: red;">*</span></label>
                                   <?php 
                                    if($result->num_rows > 0){ 
                                        while($row = $result->fetch_assoc()){  
                                            echo '
                                            <input type="hidden" name="class_id" value="'.$row['class_id'].'" class="form-control" required>
                                            <input type="text" value="'.$row['class_name'].'" class="form-control" disabled>'; 
                                        } 
                                    }else{ 
                                        echo '<input type="text" disabled class="form-control" placeholder="Class not available Contuct to admin">'; 
                                    } 
                                  ?>
                                </div> 
                                <div class="form-group">
                                        <label>Select Year</label>
                                        <div class="select2-purple">  
                                        <select name="year_of_study" id="year_of_study" class="form-control select2" data-dropdown-css-class="Select a year" style="width: 100%;" required>
                                            <option value="2020-2021">2020-2021</option> 
                                            <option value="2021-2022">2021-2022</option> 
                                            <option value="2022-2023">2022-2023</option>
                                            <option value="2023-2024">2023-2024</option> 
                                            <option value="2024-2025">2024-2025</option> 
                                            <option value="2025-2026">2025-2026</option>
                                            <option value="2026-2027">2026-2027</option>
                                            <option value="2027-2028">2027-2028</option>
                                            <option value="2028-2029">2028-2029</option> 
                                            <option value="2028-2029">2029-2030</option>   
                                      </select>
                                    </div>
                                  </div>
                                  <div class="form-group">
                                      <label>Student Name<span style="color: red;">*</span></label>
                                      <div class="select2-purple"> 
                                      <?php  
                                        $depertment= "Business Administration"; 
                                        $query = "SELECT * FROM student_srms where class_id= '$class_id' and student_status ='Enable' and course ='$depertment' ORDER BY student_name ASC"; 
                                        $result = $conn->query($query);         
                                         ?> 

                                        <select name="student_roll_no" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option>Select Student</option>
                                            <?php 
                                            if($result->num_rows > 0){
                                             
                                                while($row = $result->fetch_assoc()){  
                                                    echo '<option value="'.$row['student_roll_no'].'">'.$row['student_name'].' | '.$row['student_roll_no'].'</option>';

                                                }
                                               
                                            }else{ 
                                                echo '<option value="">Student not available</option>'; 
                                            } 
                                          ?>
                                      </select>
                                    </div>
                                  </div>  
                                  <div class="form-group">
                                      <label>Program Name<span style="color: red;">*</span></label>
                                      <div class="select2-purple"> 
                                      <?php 
                                       $depertment= "Business Administration";  
                                        $query = "SELECT * FROM subject where class_id= '$class_id' AND semister=1 AND program_stutus='Enable' AND department='$depertment' ORDER BY program ASC"; 
                                        $result = $conn->query($query);         
                                         ?> 

                                        <select name="code" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option>Select Program</option>
                                            <?php 
                                            if($result->num_rows > 0){
                                             
                                                while($row = $result->fetch_assoc()){  
                                                    echo '<option value="'.$row['code'].'">'.$row['code'].' | '.$row['program'].'</option>';

                                                }
                                               
                                            }else{ 
                                                echo '<option value="">Program not available</option>'; 
                                            } 
                                          ?>
                                      </select>
                                    </div>
                                  </div> 
                                  <?php
                                  $exam= mysqli_query($conn,"SELECT exam_id,semister FROM  exam_srms where  class_id= '$class_id' AND exam_status='Enable' ")or die(mysqli_error());
                                   $exam_1 = mysqli_fetch_array($exam);?> 
                                    <input type="hidden" name="semister" id="semister" value="<?php echo $exam_1['semister'];  ?>">
                                    <?php  
                                   $query= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error());
                                  $q1 = mysqli_fetch_array($query);     
                                  ?>  
                                   <input type="hidden" name="teacher_roll_no" value="<?php echo $q1['teacher_roll_no']; ?>">            
                                  <input type="hidden" name="result_added_by" value="<?php echo $q1['user_name']; ?>">  
                                    <div class="form-group">
                                    <label>SCORE <span style="color: red;">*</span></label>
                                     <input type="text" name="marks" id="marks" class="form-control" required data-parsley-max="40" required data-parsley-type="integer"  data-parsley-trigger="keyup"  placeholder="Hint: Marks <= 40"/>
                                    </div> 
                                </div>
                              <div class="modal-footer">  
                              <button type="submit" name="add_feb" class="btn btn-info">ADD</button>
                              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                          </div>
                        </div> 
                    </form>
                  </div>
              </div>
                

                 </div>
                 </div> 
              </div> <!-- end card body-->
            </div> <!-- end card --> 
            </div>
            <!-- /.card -->
          </div>
          </div>
          <!-- END OF business CLASS five --->


   <div class="tab-pane" id="education">
              <div class="container-fluid">
                <div class="row">
                  <div class="col-sm-12">  
                    <div class="card"> 
                      <div class="card-header">
                      <h3 class="card-title">Class Result List For Education Level Four</h3>
                      <div class="float-right mb-2">
                        <a data-toggle="modal" href="#education_1" class="btn btn-info btn-xs float-right ml-2" >
                            <i class="fa fa-plus"></i> Add Result Here
                        </a>
                        <?php  
                        $query= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error());
                        $q = mysqli_fetch_array($query); 
                        $categ="Academic Master";    
                        ?> 
                        <?php
                        if ($q['user_type']=="$categ") {
                        ?>    
                        <a data-toggle="modal" href="#update3" class="btn btn-info btn-xs float-right ml-2" >
                            <i class="fa fa-edit"></i> Update Result
                        </a>
                        <?php }?> 
                    </div>
                  </div> 
                  <div class="modal fade" id="update3">
                          <div class="modal-dialog">
                            <form method="post" action="">
                                <div class="modal-content">
                                  <div class="modal-header">
                                      <h4 class="modal-title" id="modal_title">Update The Whole Result</h4>
                                      <button type="button" class="close" data-dismiss="modal">&times;</button>
                                  </div>
                                  <div class="modal-body">
                                    <span id="form_message"></span>
                                      <div class="form-group">
                                        <label>Select Year</label>
                                        <div class="select2-purple">  
                                        <select name="year_name" id="year_name" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option value="2023">2023</option> 
                                            <option value="2024">2024</option> 
                                            <option value="2025">2025</option>
                                            <option value="2026">2026</option>
                                            <option value="2027">2027</option>
                                            <option value="2028">2028</option>    
                                      </select>
                                    </div>
                                      </div>
                                  </div>
                                  <div class="modal-footer"> 
                                      <button type="submit" name="update_r" class="btn btn-secondary">UPDATE</button>
                                      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                  </div>
                                </div>
                            </form>
                            </div>
                       </div><!-- /.modal -->
                 <!-- /.card-header -->
                  <div class="card-body">
                  
                <div class="table-responsive">

                    <table id="example4" class="table table-striped display table-bordered" > 
                      <thead>
                        <tr>
                            <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                            <th>Program</th> 
                            <th>Tatal units</th>
                            <th>Total grade</th>
                            <th>GPA</th>  
                            <th>YEAR</th> 
                            <th>Added By</th> 
                            <th>Download</th>
                            <th>Action</th>
                        </tr>
                        </thead> 
                        <tbody>
                          <?php  
                          $i = 1; 
                           $depertment= "Education Management and Administration"; 
                          $query= mysqli_query($conn,"SELECT program,SUM(credit) as T_creadit  FROM `subject` WHERE semister='1' AND  department='$depertment' AND class_id='$class_id'")or die(mysqli_error());
                           $unity = mysqli_fetch_array($query);  

                           $query= mysqli_query($conn,"SELECT *,subject.code,marks_srms.grade,subject.credit,SUM(marks_srms.grade*subject.credit) as grade_total  FROM `marks_srms`,`subject`,student_srms WHERE student_srms.student_roll_no=marks_srms.student_roll_no AND subject.code=marks_srms.code AND marks_srms.semister='1' AND student_srms.student_status ='Enable' AND marks_srms.class_id='$class_id'  AND student_srms.course='$depertment' GROUP BY  student_srms.student_roll_no ASC;")or die(mysqli_error()); 
                         while($grade = mysqli_fetch_array($query)){  
                          $unity_total=$unity['T_creadit']; 
                          $grade_total=$grade['grade_total'];  
                          $Gpa=$grade_total/$unity_total; 
                        ?> 
                        <tr>
                          <td><?php echo $i++ ?></td> 
                          <td><?php echo $grade['student_roll_no']; ?></td>
                          <td><?php echo $grade['student_name']; ?></td> 
                          <td><?php echo $grade['course']; ?></td> 
                          <td style="color: green;"><?php echo $unity_total; ?></td> 
                          <td><?php echo $grade['grade_total']; ?></td>  
                          <td style="color: red;"> <?php echo round($Gpa, 1); ?> </td>
                          <td><?php echo $grade['Year']; ?> SEM <span class="badge bg-success"><?php echo $grade['semister']; ?></span></td>  
                          <td><?php echo $grade['result_added_by']; ?></td>
                         
                          <td>
                            <div class="btn-group">
                            <a  href="views/view_result_pdf.php?id=<?php echo $grade['student_roll_no']; ?>" class="btn btn-info btn-flat"><i class="fa fa-download"></i>
                            </a> 
                          </div>
                          </td> 
                          <td>
                          <div class="btn-group">
                            <a href="admin.php?page=edit_four_1&id=<?php echo $grade['student_roll_no']; ?>" class="btn btn-primary btn-flat manage_class">
                              <i class="fas fa-edit"></i> 
                            </a>
                             <a href="delete_feb.php?del=<?php echo $grade['marks_id']; ?>" onclick="return confirm('Are you sure you want to delete?');" class="btn btn-danger btn-flat delete_student">
                              <i class="fas fa-trash"></i>
                            </a>   
                        </div> </td>
                      </tr> 
                      <?php }?> 
                        </tbody>

                        <tfoot>
                        <tr> 
                             <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                             <th>Program</th> 
                            <th>Tatal units</th>
                            <th>Total grade</th>
                            <th>GPA</th>  
                            <th>YEAR</th> 
                            <th>Added By</th> 
                            <th>Download</th>
                            <th>Action</th>
                        </tr>

                      </tfoot>   
                    </table> 
                   <div class="modal fade" id="csv_1">
                    <div class="modal-dialog">
                      <form action="views/import_csv.php" id="import-form" method="POST" enctype="multipart/form-data">
                          <div class="modal-content">
                            <div class="modal-header">
                                <h4 class="modal-title" id="modal_title">Importing CSV Data</h4>
                                <button type="button" class="close" data-dismiss="modal">&times;</button>
                            </div>
                            <div class="modal-body">
                              <span id="form_message"></span>
                                <div class="form-group">
                                  <label for="fileData" class="form-label">Browse CSV File</label>
                                  <input class="form-control" type="file" accept=".csv" name="fileData" id="fileData" required>
                                </div>
                            </div>
                            <div class="modal-footer"> 
                                <input type="submit" name="submit" class="btn btn-secondary" value="Add" />
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            </div>
                          </div>
                      </form>
                    </div>
                 </div><!-- /.modal -->

                      <!-- /.add class one result -->
                 <div id="education_1" class="modal fade">
                  <div class="modal-dialog">
                    <form method="post" action="" id="login_form">
                        <div class="modal-content">
                          <div class="modal-header">
                              <h4 class="modal-title" id="modal_title">Upload Result</h4>
                              <button type="button" class="close" data-dismiss="modal">&times;</button>
                          </div> 
                          <div class="modal-body"> 
                          <?php  
                            $query = "SELECT * FROM class_srms where class_id='$class_id' AND  class_status='Enable' ORDER BY class_name ASC"; 
                            $result = $conn->query($query);      
                             ?>
                             
                              <div class="form-group">
                                  <label>Class <span style="color: red;">*</span></label>
                                   <?php 
                                    if($result->num_rows > 0){ 
                                        while($row = $result->fetch_assoc()){  
                                            echo '
                                            <input type="hidden" name="class_id" value="'.$row['class_id'].'" class="form-control" required>
                                            <input type="text" value="'.$row['class_name'].'" class="form-control" disabled>'; 
                                        } 
                                    }else{ 
                                        echo '<input type="text" disabled class="form-control" placeholder="Class not available Contuct to admin">'; 
                                    } 
                                  ?>
                                </div> 
                                <div class="form-group">
                                        <label>Select Year</label>
                                        <div class="select2-purple">  
                                        <select name="year_of_study" id="year_of_study" class="form-control select2" data-dropdown-css-class="Select a year" style="width: 100%;" required>
                                            <option value="2020-2021">2020-2021</option> 
                                            <option value="2021-2022">2021-2022</option> 
                                            <option value="2022-2023">2022-2023</option>
                                            <option value="2023-2024">2023-2024</option> 
                                            <option value="2024-2025">2024-2025</option> 
                                            <option value="2025-2026">2025-2026</option>
                                            <option value="2026-2027">2026-2027</option>
                                            <option value="2027-2028">2027-2028</option>
                                            <option value="2028-2029">2028-2029</option> 
                                            <option value="2028-2029">2029-2030</option>   
                                      </select>
                                    </div>
                                  </div>
                                  <div class="form-group">
                                      <label>Student Name<span style="color: red;">*</span></label>
                                      <div class="select2-purple"> 
                                      <?php  
                                        $depertment= "Education Management and Administration"; 
                                        $query = "SELECT * FROM student_srms where class_id= '$class_id' and student_status ='Enable' and course ='$depertment' ORDER BY student_name ASC"; 
                                        $result = $conn->query($query);         
                                         ?> 

                                        <select name="student_roll_no" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option>Select Student</option>
                                            <?php 
                                            if($result->num_rows > 0){
                                             
                                                while($row = $result->fetch_assoc()){  
                                                    echo '<option value="'.$row['student_roll_no'].'">'.$row['student_name'].' | '.$row['student_roll_no'].'</option>';

                                                }
                                               
                                            }else{ 
                                                echo '<option value="">Student not available</option>'; 
                                            } 
                                          ?>
                                      </select>
                                    </div>
                                  </div>  
                                  <div class="form-group">
                                      <label>Program Name<span style="color: red;">*</span></label>
                                      <div class="select2-purple"> 
                                      <?php 
                                       $depertment= "Education Management and Administration";  
                                        $query = "SELECT * FROM subject where class_id= '$class_id' AND semister=1 AND program_stutus='Enable' AND department='$depertment' ORDER BY program ASC"; 
                                        $result = $conn->query($query);         
                                         ?>  
                                        <select name="code" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option>Select Program</option>
                                            <?php 
                                            if($result->num_rows > 0){
                                             
                                                while($row = $result->fetch_assoc()){  
                                                    echo '<option value="'.$row['code'].'">'.$row['code'].' | '.$row['program'].'</option>';

                                                }
                                               
                                            }else{ 
                                                echo '<option value="">Program not available</option>'; 
                                            } 
                                          ?>
                                      </select>
                                    </div>
                                  </div> 
                                  <?php
                                  $exam= mysqli_query($conn,"SELECT exam_id,semister FROM  exam_srms where  class_id= '$class_id' AND exam_status='Enable' ")or die(mysqli_error());
                                   $exam_1 = mysqli_fetch_array($exam);?> 
                                    <input type="hidden" name="semister" id="semister" value="<?php echo $exam_1['semister'];  ?>">
                                    <?php  
                                   $query= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error());
                                  $q1 = mysqli_fetch_array($query);     
                                  ?>  
                                               
                                  <input type="hidden" name="result_added_by" value="<?php echo $q1['user_name']; ?>"> 
                                  <input type="hidden" name="teacher_roll_no" value="<?php echo $q1['teacher_roll_no']; ?>"> 
                                    <div class="form-group">
                                    <label>SCORE <span style="color: red;">*</span></label>
                                     <input type="text" name="marks" id="marks" class="form-control" required data-parsley-max="40" required data-parsley-type="integer"  data-parsley-trigger="keyup"  placeholder="Hint: Marks <= 40"/>
                                    </div> 
                                </div>
                              <div class="modal-footer">  
                              <button type="submit" name="add_feb" class="btn btn-info">ADD</button>
                              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                          </div>
                        </div> 
                    </form>
                  </div>
                 </div>
                

                 </div>
                 </div> 
              </div> <!-- end card body-->
            </div> <!-- end card --> 
            </div>
            <!-- /.card -->
          </div>
          </div>
          <!-- END OF business CLASS five --->

          <div class="tab-pane" id="ict">
              <div class="container-fluid">
                <div class="row">
                  <div class="col-sm-12">  
                    <div class="card"> 
                      <div class="card-header">
                      <h3 class="card-title">Class Result List For ICT Level Four</h3>
                      <div class="float-right mb-2">
                        <a data-toggle="modal" href="#ICT_1" class="btn btn-info btn-xs float-right ml-2" >
                            <i class="fa fa-plus"></i> Add Result Here
                        </a>
                        <?php  
                        $query= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error());
                        $q = mysqli_fetch_array($query); 
                        $categ="Academic Master";    
                        ?> 
                        <?php
                        if ($q['user_type']=="$categ") {
                        ?>    
                        <a data-toggle="modal" href="#update3" class="btn btn-info btn-xs float-right ml-2" >
                            <i class="fa fa-edit"></i> Update Result
                        </a>
                        <?php }?> 
                    </div>
                  </div> 
                  <div class="modal fade" id="update3">
                          <div class="modal-dialog">
                            <form method="post" action="">
                                <div class="modal-content">
                                  <div class="modal-header">
                                      <h4 class="modal-title" id="modal_title">Update The Whole Result</h4>
                                      <button type="button" class="close" data-dismiss="modal">&times;</button>
                                  </div>
                                  <div class="modal-body">
                                    <span id="form_message"></span>
                                      <div class="form-group">
                                        <label>Select Year</label>
                                        <div class="select2-purple">  
                                        <select name="year_name" id="year_name" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option value="2023">2023</option> 
                                            <option value="2024">2024</option> 
                                            <option value="2025">2025</option>
                                            <option value="2026">2026</option>
                                            <option value="2027">2027</option>
                                            <option value="2028">2028</option>    
                                      </select>
                                    </div>
                                      </div>
                                  </div>
                                  <div class="modal-footer"> 
                                      <button type="submit" name="update_r" class="btn btn-secondary">UPDATE</button>
                                      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                  </div>
                                </div>
                            </form>
                            </div>
                       </div><!-- /.modal -->
                 <!-- /.card-header -->
                  <div class="card-body">
                  
                <div class="table-responsive">

                    <table id="example5" class="table table-striped display table-bordered" > 
                      <thead>
                        <tr>
                            <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                            <th>Program</th> 
                            <th>Tatal units</th>
                            <th>Total grade</th>
                            <th>GPA</th>  
                            <th>YEAR</th> 
                            <th>Added By</th> 
                            <th>Download</th>
                            <th>Action</th>
                        </tr>
                        </thead> 
                        <tbody>
                          <?php  
                          $i = 1; 
                           $depertment= "Information and communication Technology"; 
                          $query= mysqli_query($conn,"SELECT program,SUM(credit) as T_creadit  FROM `subject` WHERE semister='1' AND  department='$depertment' AND class_id='$class_id'")or die(mysqli_error());
                           $unity = mysqli_fetch_array($query);  

                           $query= mysqli_query($conn,"SELECT *,subject.code,marks_srms.grade,subject.credit,SUM(marks_srms.grade*subject.credit) as grade_total  FROM `marks_srms`,`subject`,student_srms WHERE student_srms.student_roll_no=marks_srms.student_roll_no AND subject.code=marks_srms.code AND marks_srms.semister='1' AND student_srms.student_status ='Enable' AND marks_srms.class_id='$class_id'  AND student_srms.course='$depertment' GROUP BY  student_srms.student_roll_no ASC;")or die(mysqli_error()); 
                         while($grade = mysqli_fetch_array($query)){  
                          $unity_total=$unity['T_creadit']; 
                          $grade_total=$grade['grade_total'];  
                          $Gpa=$grade_total/$unity_total; 
                        ?> 
                        <tr>
                          <td><?php echo $i++ ?></td> 
                          <td><?php echo $grade['student_roll_no']; ?></td>
                          <td><?php echo $grade['student_name']; ?></td> 
                          <td><?php echo $grade['course']; ?></td> 
                          <td style="color: green;"><?php echo $unity_total; ?></td> 
                          <td><?php echo $grade['grade_total']; ?></td>  
                          <td style="color: red;"> <?php echo round($Gpa, 1); ?> </td>
                          <td><?php echo $grade['Year']; ?> SEM <span class="badge bg-success"><?php echo $grade['semister']; ?></span></td>  
                          <td><?php echo $grade['result_added_by']; ?></td>
                         
                          <td>
                            <div class="btn-group">
                            <a  href="views/view_result_pdf.php?id=<?php echo $grade['student_roll_no']; ?>" class="btn btn-info btn-flat"><i class="fa fa-download"></i>
                            </a> 
                          </div>
                          </td> 
                          <td>
                         <div class="btn-group">
                            <a href="admin.php?page=edit_four_1&id=<?php echo $grade['student_roll_no']; ?>" class="btn btn-primary btn-flat manage_class">
                              <i class="fas fa-edit"></i> 
                            </a>
                             <a href="delete_feb.php?del=<?php echo $grade['marks_id']; ?>" onclick="return confirm('Are you sure you want to delete?');" class="btn btn-danger btn-flat delete_student">
                              <i class="fas fa-trash"></i>
                            </a>   
                        </div> </td>
                      </tr> 
                      <?php }?> 
                        </tbody>

                        <tfoot>
                        <tr> 
                             <th>#</th>
                            <th>REG NUMBER</th> 
                            <th>Student Name</th>
                             <th>Program</th> 
                            <th>Tatal units</th>
                            <th>Total grade</th>
                            <th>GPA</th>  
                            <th>YEAR</th> 
                            <th>Added By</th> 
                            <th>Download</th>
                            <th>Action</th>
                        </tr>

                      </tfoot>   
                    </table> 
                   <div class="modal fade" id="csv_1">
                    <div class="modal-dialog">
                      <form action="views/import_csv.php" id="import-form" method="POST" enctype="multipart/form-data">
                          <div class="modal-content">
                            <div class="modal-header">
                                <h4 class="modal-title" id="modal_title">Importing CSV Data</h4>
                                <button type="button" class="close" data-dismiss="modal">&times;</button>
                            </div>
                            <div class="modal-body">
                              <span id="form_message"></span>
                                <div class="form-group">
                                  <label for="fileData" class="form-label">Browse CSV File</label>
                                  <input class="form-control" type="file" accept=".csv" name="fileData" id="fileData" required>
                                </div>
                            </div>
                            <div class="modal-footer"> 
                                <input type="submit" name="submit" class="btn btn-secondary" value="Add" />
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            </div>
                          </div>
                      </form>
                    </div>
                 </div><!-- /.modal -->

                      <!-- /.add class one result -->
                 <div id="ICT_1" class="modal fade">
                  <div class="modal-dialog">
                    <form method="post" action="" id="login_form">
                        <div class="modal-content">
                          <div class="modal-header">
                              <h4 class="modal-title" id="modal_title">Upload Result</h4>
                              <button type="button" class="close" data-dismiss="modal">&times;</button>
                          </div> 
                          <div class="modal-body"> 
                          <?php  
                            $query = "SELECT * FROM class_srms where class_id='$class_id' AND  class_status='Enable' ORDER BY class_name ASC"; 
                            $result = $conn->query($query);      
                             ?>
                             
                              <div class="form-group">
                                  <label>Class <span style="color: red;">*</span></label>
                                   <?php 
                                    if($result->num_rows > 0){ 
                                        while($row = $result->fetch_assoc()){  
                                            echo '
                                            <input type="hidden" name="class_id" value="'.$row['class_id'].'" class="form-control" required>
                                            <input type="text" value="'.$row['class_name'].'" class="form-control" disabled>'; 
                                        } 
                                    }else{ 
                                        echo '<input type="text" disabled class="form-control" placeholder="Class not available Contuct to admin">'; 
                                    } 
                                  ?>
                                </div> 
                                <div class="form-group">
                                        <label>Select Year</label>
                                        <div class="select2-purple">  
                                        <select name="year_of_study" id="year_of_study" class="form-control select2" data-dropdown-css-class="Select a year" style="width: 100%;" required>
                                            <option value="2020-2021">2020-2021</option> 
                                            <option value="2021-2022">2021-2022</option> 
                                            <option value="2022-2023">2022-2023</option>
                                            <option value="2023-2024">2023-2024</option> 
                                            <option value="2024-2025">2024-2025</option> 
                                            <option value="2025-2026">2025-2026</option>
                                            <option value="2026-2027">2026-2027</option>
                                            <option value="2027-2028">2027-2028</option>
                                            <option value="2028-2029">2028-2029</option> 
                                            <option value="2028-2029">2029-2030</option>   
                                      </select>
                                    </div>
                                  </div>
                                  <div class="form-group">
                                      <label>Student Name<span style="color: red;">*</span></label>
                                      <div class="select2-purple"> 
                                      <?php  
                                        $depertment= "Information and communication Technology"; 
                                        $query = "SELECT * FROM student_srms where class_id= '$class_id' and student_status ='Enable' and course ='$depertment' ORDER BY student_name ASC"; 
                                        $result = $conn->query($query);         
                                         ?> 

                                        <select name="student_roll_no" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option>Select Student</option>
                                            <?php 
                                            if($result->num_rows > 0){
                                             
                                                while($row = $result->fetch_assoc()){  
                                                    echo '<option value="'.$row['student_roll_no'].'">'.$row['student_name'].' | '.$row['student_roll_no'].'</option>';

                                                }
                                               
                                            }else{ 
                                                echo '<option value="">Student not available</option>'; 
                                            } 
                                          ?>
                                      </select>
                                    </div>
                                  </div>  
                                  <div class="form-group">
                                      <label>Program Name<span style="color: red;">*</span></label>
                                      <div class="select2-purple"> 
                                      <?php 
                                       $depertment= "Information and communication Technology";  
                                        $query = "SELECT * FROM subject where class_id= '$class_id' AND semister=1 AND program_stutus='Enable' AND department='$depertment' ORDER BY program ASC"; 
                                        $result = $conn->query($query);         
                                         ?>  
                                        <select name="code" class="form-control select2" data-dropdown-css-class="Select a Student" style="width: 100%;" required>
                                            <option>Select Program</option>
                                            <?php 
                                            if($result->num_rows > 0){
                                             
                                                while($row = $result->fetch_assoc()){  
                                                    echo '<option value="'.$row['code'].'">'.$row['code'].' | '.$row['program'].'</option>';

                                                }
                                               
                                            }else{ 
                                                echo '<option value="">Program not available</option>'; 
                                            } 
                                          ?>
                                      </select>
                                    </div>
                                  </div> 
                                  <?php
                                  $exam= mysqli_query($conn,"SELECT exam_id,semister FROM  exam_srms where  class_id= '$class_id' AND exam_status='Enable' ")or die(mysqli_error());
                                   $exam_1 = mysqli_fetch_array($exam);?> 
                                    <input type="hidden" name="semister" id="semister" value="<?php echo $exam_1['semister'];  ?>">
                                    <?php  
                                   $query= mysqli_query($conn,"select * from teacher_srms where user_contact_no = '$session_id'")or die(mysqli_error());
                                  $q1 = mysqli_fetch_array($query);     
                                  ?>  
                                               
                                  <input type="hidden" name="result_added_by" value="<?php echo $q1['user_name']; ?>"> 
                                  <input type="hidden" name="teacher_roll_no" value="<?php echo $q1['teacher_roll_no']; ?>"> 
                                    <div class="form-group">
                                    <label>SCORE <span style="color: red;">*</span></label>
                                     <input type="text" name="marks" id="marks" class="form-control" required data-parsley-max="40" required data-parsley-type="integer"  data-parsley-trigger="keyup"  placeholder="Hint: Marks <= 40"/>
                                    </div> 
                                </div>
                              <div class="modal-footer">  
                              <button type="submit" name="add_feb" class="btn btn-info">ADD</button>
                              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                          </div>
                        </div> 
                    </form>
                  </div>
                 </div>
                

                 </div>
                 </div> 
              </div> <!-- end card body-->
            </div> <!-- end card --> 
            </div>
            <!-- /.card -->
          </div>
          </div>
          <!-- END OF business CLASS five --->

             </div>
                <!-- /.tab-content -->
             </div><!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
   <!-- /.content-wrapper -->
 <script src="../stp_con/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../stp_con/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables  & Plugins -->
<script src="../stp_con/datatables/jquery.dataTables.min.js"></script>
<script src="../stp_con/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../stp_con/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../stp_con/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="../stp_con/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="../stp_con/jszip/jszip.min.js"></script> 
<script src="../stp_con/pdfmake/pdfmake.min.js"></script>
<script src="../stp_con/pdfmake/vfs_fonts.js"></script> 
<script src="../stp_con/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.print.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.colVis.min.js"></script>
 
<script src="../assets/js/adminlte.min.js"></script> 

<!-- Select2 -->
<script src="../stp_con/select2/js/select2.full.min.js"></script>
<!-- Bootstrap4 Duallistbox -->
<script src="../stp_con/bootstrap4-duallistbox/jquery.bootstrap-duallistbox.min.js"></script>
<!-- InputMask -->
<script src="../stp_con/moment/moment.min.js"></script>
<script src="stp_con/inputmask/jquery.inputmask.min.js"></script>
<!-- date-range-picker -->
<script src="../stp_con/daterangepicker/daterangepicker.js"></script>
<!-- bootstrap color picker -->
<script src="../stp_con/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="../stp_con/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- BS-Stepper -->
<script src="../stp_con/bs-stepper/js/bs-stepper.min.js"></script>
<!-- dropzonejs -->
<script src="../stp_con/dropzone/min/dropzone.min.js"></script>
<script type="text/javascript" src="../stp_con/parsley/dist/parsley.min.js"></script>


<script src="../../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- SweetAlert2 -->
<script src="../../plugins/sweetalert2/sweetalert2.min.js"></script>
<!-- Toastr -->
<script src="../../plugins/toastr/toastr.min.js"></script>
<!-- AdminLTE App -->
<script src="../../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../../dist/js/demo.js"></script>
</body>

</html>

 <script>
  $(function () {
    $("#example1").DataTable({
      "responsive": false, "lengthChange": true, "autoWidth": false,
      "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)'); 
  });
</script>
<script>
  $(function () {
    $("#example2").DataTable({
      "responsive": true, "lengthChange": true, "autoWidth": false,
      "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example2_wrapper .col-md-6:eq(0)'); 
  });
</script>
<script>
  $(function () {
    $("#example3").DataTable({
      "responsive": true, "lengthChange": true, "autoWidth": false,
      "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example3_wrapper .col-md-6:eq(0)'); 
  });
</script>
<script>
  $(function () {
    $("#example4").DataTable({
      "responsive": true, "lengthChange": true, "autoWidth": false,
      "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example4_wrapper .col-md-6:eq(0)'); 
  });
</script>
<script>
  $(function () {
    $("#example5").DataTable({
      "responsive": true, "lengthChange": true, "autoWidth": false,
      "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example5_wrapper .col-md-6:eq(0)'); 
  });
</script>
<script>
  $(function () {
    $("#example6").DataTable({
      "responsive": true, "lengthChange": true, "autoWidth": false,
      "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example6_wrapper .col-md-6:eq(0)'); 
  });
</script> 

 <script>
  $(function () {
    //Initialize Select2 Elements
    $('.select2').select2()

    //Initialize Select2 Elements
    $('.select2bs4').select2({
      theme: 'bootstrap4'
    })

    //Datemask dd/mm/yyyy
    $('#datemask').inputmask('dd/mm/yyyy', { 'placeholder': 'dd/mm/yyyy' })
    //Datemask2 mm/dd/yyyy
    $('#datemask2').inputmask('mm/dd/yyyy', { 'placeholder': 'mm/dd/yyyy' })
    //Money Euro
    $('[data-mask]').inputmask()

    //Date picker
    $('#reservationdate').datetimepicker({
        format: 'L'
    }); 
    //Date range picker
    $('#reservation').daterangepicker()
    //Date range picker with time picker
    $('#reservationtime').daterangepicker({
      timePicker: true,
      timePickerIncrement: 30,
      locale: {
        format: 'MM/DD/YYYY hh:mm A'
      }
    })
    //Date range as a button
    $('#daterange-btn').daterangepicker(
      {
        ranges   : {
          'Today'       : [moment(), moment()],
          'Yesterday'   : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
          'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
          'Last 30 Days': [moment().subtract(29, 'days'), moment()],
          'This Month'  : [moment().startOf('month'), moment().endOf('month')],
          'Last Month'  : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
        },
        startDate: moment().subtract(29, 'days'),
        endDate  : moment()
      },
      function (start, end) {
        $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
      }
    )

    //Timepicker
    $('#timepicker').datetimepicker({
      format: 'LT'
    })

    //Bootstrap Duallistbox
    $('.duallistbox').bootstrapDualListbox()

    //Colorpicker
    $('.my-colorpicker1').colorpicker()
    //color picker with addon
    $('.my-colorpicker2').colorpicker()

    $('.my-colorpicker2').on('colorpickerChange', function(event) {
      $('.my-colorpicker2 .fa-square').css('color', event.color.toString());
    })
  })
  // BS-Stepper Init
  document.addEventListener('DOMContentLoaded', function () {
    window.stepper = new Stepper(document.querySelector('.bs-stepper'))
  })

  // DropzoneJS Demo Code Start
  Dropzone.autoDiscover = false

  // Get the template HTML and remove it from the doumenthe template HTML and remove it from the doument
  var previewNode = document.querySelector("#template")
  previewNode.id = ""
  var previewTemplate = previewNode.parentNode.innerHTML
  previewNode.parentNode.removeChild(previewNode)

  var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone
    url: "/target-url", // Set the url
    thumbnailWidth: 80,
    thumbnailHeight: 80,
    parallelUploads: 20,
    previewTemplate: previewTemplate,
    autoQueue: false, // Make sure the files aren't queued until manually added
    previewsContainer: "#previews", // Define the container to display the previews
    clickable: ".fileinput-button" // Define the element that should be used as click trigger to select files.
  })

  myDropzone.on("addedfile", function(file) {
    // Hookup the start button
    file.previewElement.querySelector(".start").onclick = function() { myDropzone.enqueueFile(file) }
  })

  // Update the total progress bar
  myDropzone.on("totaluploadprogress", function(progress) {
    document.querySelector("#total-progress .progress-bar").style.width = progress + "%"
  })

  myDropzone.on("sending", function(file) {
    // Show the total progress bar when upload starts
    document.querySelector("#total-progress").style.opacity = "1"
    // And disable the start button
    file.previewElement.querySelector(".start").setAttribute("disabled", "disabled")
  })


    $('.toastrDefaultSuccess').click(function() {
      toastr.success('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
    });
    $('.toastrDefaultInfo').click(function() {
      toastr.info('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
    });
    $('.toastrDefaultError').click(function() {
      toastr.error('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
    });
    $('.toastrDefaultWarning').click(function() {
      toastr.warning('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
    });

  // Hide the total progress bar when nothing's uploading anymore
  myDropzone.on("queuecomplete", function(progress) {
    document.querySelector("#total-progress").style.opacity = "0"
  })

  // Setup the buttons for all transfers
  // The "add files" button doesn't need to be setup because the config
  // `clickable` has already been specified.
  document.querySelector("#actions .start").onclick = function() {
    myDropzone.enqueueFiles(myDropzone.getFilesWithStatus(Dropzone.ADDED))
  }
  document.querySelector("#actions .cancel").onclick = function() {
    myDropzone.removeAllFiles(true)
  }
  // DropzoneJS Demo Code End
  </script>
<script>
$(document).ready(function(){
    $('#login_form').parsley();
     $('#login_form2').parsley();
     $('#login_form3').parsley();
     $('#login_form4').parsley();
     $('#login_form5').parsley();
     $('#login_form6').parsley(); 
});

</script>