<?php include('parent/callMe.php');?>
<?php include('Sessioncheck.php');?>
<?php   
  
       // getting branch details

        $m->where("branch_id", $_SESSION['branch']);
        $branch1=$m->get("edu_branch_config");

        $m->where("term_id", $_REQUEST['term_id']);
        $TermsData=$m->get("eduportal_exam_terms");

        $m->where("user_id", $_REQUEST['teacher']);
        $teacherName=$m->get("edu_user_config");

        $m->where("session_id", $_REQUEST['session']);
        $sessionData=$m->get("edu_session_config");

$sessionIDs=$_REQUEST['session'];
$termID=$_REQUEST['term_id'];
$teacherID=$_REQUEST['teacher'];
$branchID=$_SESSION['branch'];

 if($_REQUEST['teacher']!=NULL){  
  
       $m->where("branch_id", $_SESSION['branch']);
       $m->where("user_id", $teacherID);
       $teacher_sbjs = $m->get("eduportal_assign_subject_to_teachers");
  }


       


function ordinal($number) {
    $ends = array('th','st','nd','rd','th','th','th','th','th','th');
    if ((($number % 100) >= 11) && (($number%100) <= 13))
        return $number. 'th';
    else
        return $number. $ends[$number % 10];
}
 
     ?>

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Print Subject Wise Teacher Performance</title>
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<script type="text/javascript">
// window.print();
</script>
<style type="text/css">

tr th {border-left:1px solid black;border-top:1px solid black;font-size:14px;}
tr td {border-bottom:1px solid black;border-left:1px solid black;font-size:16px;}
  
.border{border:1px solid black;}

.alignment{padding-left:1%;text-align:left;}

.borderbottom{
  border-bottom:1px solid black;
}



@media print {
    #Header, #Footer { display: none !important; }
}
@media screen
   {
      p.bodyText {font-family:verdana, arial, sans-serif;}
   }

   @media print
   {
      p.bodyText {font-family:georgia, times, serif;}
   }
   @media screen, print
   {
      p.bodyText {font-size:10pt}
   }
   @media print {
  a[href]:after {
    content: none !important;
  }
}
.center{text-align:center;}


<style type="text/css">
  .centertable {
  margin-left: auto;
  margin-right: auto;
}


#customers {
  font-family: Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

#customers td, #customers th {
  border: 1px solid #ddd;
  padding: 8px;
}

#customers tr:nth-child(even){background-color: #f2f2f2;}

#customers tr:hover {background-color: #ddd;}

#customers th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  background-color: #042954;
  color: white;
}
</style>
</style>
</head>

<body style="font-size:12px;padding-right:1%;padding-left:1%;padding-top:3%;padding-bottom:1%;">
<div style="text-align:center;font-size:24px;font-weight:bold;margin:0 auto;"><?php echo $branch1[0]['Branch_Name'];?> 
</div>

<br>

<div style="text-align:center;font-size:18px;font-weight:bold;"> Subject Wise Teacher Performance Sheet

 </div>

<hr style="width:100%;">



<div style="width:30%; float:left;font-size:18px; margin-left:10px; "> <b> Term:</b> <?php echo $TermsData[0]['term_title'];?> </div>

<div style="width:30%; float:left;font-size:18px; margin-left:10px; "> <b> Teacher:</b> <?php echo $teacherName[0]['user_fname'];?> </div>

<div style="text-align:center;width:30%;float:right;font-size:18px;"> <b> Session:</b> <?php echo $sessionData[0]['session_year']; ?> </div>

<br>
   


    <form class="form-style-7" action="" method="get"  onSubmit="return student_check();"  enctype="multipart/form-data">


  
  
  <input type="hidden"  name="branch" value="<?php echo $_SESSION['branch']; ?>" />
  <input type="hidden" id="session"  name="session" value="<?php echo $_GET['session']; ?>" />
  <input type="hidden"  name="month" value="<?php echo $_GET['month']; ?>" />

    <table class="table table-bordered centertable" id="customers"  style="width:100%;font-size:12px;text-align: center;">
          
          <thead>
            <tr>
                
                
                <th width="20%" style="text-align: center;">Grade</th>
                <th width="7%" style="text-align: center;">Number Of Students</th>                
                              
  

            </tr>
        </thead>
        <tbody>
   
     
       
     <?php 
     $count=1;
     $SR=1;
     $new_array = array();

      $sbs_marks="";
      $sbs_tmarks="";
      $sbs_title="";
      $sbs_msg1;

     // getting all the marks of students and other data


      $m->where("branch_id", $_SESSION['branch']);             
      $GradeSettings = $m->get("eduportal_exam_school_grades");
 
      foreach($teacher_sbjs as $teacher_sbjs)
      { 
        $total_marks;
        $total_obt;
          //  echo $teacher_sbjs['subject_id'];
          $m->where("branch_id", $_SESSION['branch']);
          $m->where("subject_id", $teacher_sbjs['subject_id']);         
          $subjectName = $m->get("eduportal_subject_config");

           


  
?>  
  <tr>
    
    
        <td colspan="2" style="text-align: center;font-size: 14px;font-weight: bold; background-color: #6796e5; color: white;"><?php echo $subjectName[0]['subject'];  ?></td>
        <?php foreach ($GradeSettings as $GradeSetting) { 

          $sbjID=$teacher_sbjs['subject_id'];
          $Gtitle=$GradeSetting['grade_title'];
           $qrcount="SELECT count(*) as total FROM eduportal_exam_marksheet WHERE subject_id='$sbjID' and session_id='$sessionIDs' and branch_id='$branch' and term_id='$termID' and grade='$Gtitle'";

           if($_REQUEST['class_id']=="All"){
                $qrcount;
              } else {
              $qrcount .= " AND class_id = '" .$_REQUEST['class_id']. "' ";

              }
           $result=$m->query($qrcount);

          ?>
                 
        <tr>
          
          <td><?php echo $GradeSetting['grade_title'];?></td>
          <td><?php echo $result[0]['total'];?></td>
        </tr>
        <?php } ?> 
        
        <td class="center"> <?php echo $std_data[$i]['last_name'];?> </td>
        <td class="center"> <?php echo $class[0]['Class_Name']." / ".$section[0]['section_name'];?> </td>
        
  </tr>

<?php } ?>

        </tbody>
        
    </table>

</form>

    

</body>
</html>
