<main class="common_margin" id="main">
    <div class="main-inner-content main-wrap">
      <div class="stud-drade-wrap">
      
        <a href="<?php echo base_url().'teacher/teacher_grades'; ?>" style="text-decoration-line: none;color: inherit;">
        <h3 class="common-heading">      <i class="fas fa-long-arrow-alt-left"></i>Student Grades   </h3>  </a>
      </div>
  <?php if (isset($student_results) && $student_results != '') { 
          $total_mark = 0;$total_scored_mark=0;  ?>
      <div class="stud-table-wrap">
        <h4><?php echo $student_results[0]['name']; ?></h4>
        <h6><?php echo $student_results[0]['e_name'] .'   '. $student_results[0]['bs_date'] ?></h6>    
         <?php foreach ($student_results as $key => $value) {

              $total_mark = $total_mark+$value['total_marks'];
              $total_scored_mark =  $total_scored_mark+$value['get_marks'];

           }  ?>
        <table>
          <tr>
            <th>Subject</th>
            <th>Total Marks</th>
            <th>Passing marks</th>
            <th>Scored</th>
            <th>Grade</th>
           
          </tr>
   <?php foreach ($student_results as $key => $value) { ?>       
          <tr>
            <td><?php echo $value['subject_name']; ?></td>
            <td><?php echo $value['total_marks']; ?></td>
            <td><?php echo $value['passing_marks']; ?></td>
            <td><?php echo $value['get_marks']; ?></td>
            <td><?php echo $value['grade_name']; ?></td>
          </tr>
      <?php } ?>    

          <tr class="total-bold">
            <td>Grand Total</td>
            <td><?php echo $total_mark; ?></td>
            <td></td>
            <td><?php echo $total_scored_mark; ?></td>
            <?php 
            $scored_percentage = round((($total_scored_mark*100)/$total_mark), 2); 
            $grade = student_grade_show($scored_percentage);
            ?>
            <td><?php echo $grade['grade_name'] ?></td>
          </tr>
        </table>
      <?php  } ?>
      </div>
    </div>
  </main>
 <style type="text/css">
    table th {
      width: 20%;
      text-align: center;
      background-color: #032DA1;
      padding: 5px 0;
      color: #fff;
      font-size: 14px;
  }
    table tr {
      width: 20%;
      text-align: center;
      height: 45px;
  }
  table {
    width: 100%;
    margin: 3% 0 0 0;
}
table th {
    width: 20%;
    text-align: center;
    background-color: #032DA1;
    padding: 5px 0;
    color: #fff;
    font-size: 14px;
}
table td {
    font-size: 14px;
}
table th:nth-child(1) {
    border-radius: 50px 0 0 50px;
}

table tr:nth-child(8) {
    border-top: 1px solid #000;
}
  </style>