<?php
include_once '../session/admin-session.php';
include_once '../classes/class_admin.php';
include_once '../classes/validation.php';
include_once '../classes/common.php';
include_once 'read-configration.php';
ob_start();

$ObjDB = new class_db();
$objadm = new class_admin();
$val = new validation();
$semester_num = substr($working_curriculum, 1);
$for_sem = $semb1 = $semester_num - 1;
$objadm->sem_num = $semb1;
$semListArr = $objadm->GetSemList();
$res_semList = mysqli_fetch_array($semListArr);

$for_sem_name = $res_semList["sem_name"];

$Query_Str = "select any_value(sub_code)as sub_code, any_value(fac_roll) as fac_roll, count(stu_roll) as ccc from isr_reg_repeat_tbl where exam_sem = '$semb1' and reg_status in ('P', 'T') group by sub_code";
$ObjDB->sproc_name = $Query_Str;
$res_result = $ObjDB->SelectQuery();
?>
<div class="container-fluid">
    <div class="row">
        <div class="col-xl-12 col-xxl-12 col-sm-12">
            <div class="card">
                <div class="card-header">
                    <h5 class="card-title">Repeat Exam Grades</h5>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th></th>
                                    <th>Code</th>
                                    <th>Title of the Course</th>
                                    <th>Coordinator</th>
                                    <th>F/I</th>
                                    <th>App</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $i = 1;
$totFI = 0;
while ($row = mysqli_fetch_array($res_result)) {
	$sub_code = $row['sub_code'];
	$fac_roll = $row['fac_roll'];
	$sub_list = 'c'.$for_sem;
        
        $objadm->fac_roll = $fac_roll;
        $qf = $objadm->GetFacultyList();
	$fac_name_arr = mysqli_fetch_array($qf);
        $fac_name = $fac_name_arr['name'];
        
        $objadm->res_sem=$sub_list;
        $objadm->res_subject_code=$sub_code;
        
        $qf_curriculum = $objadm->GetcurriculumList();
        $res_curriculum_arr = mysqli_fetch_array($qf_curriculum);
        $sub_title = $res_curriculum_arr['sub_title'];
        
      
	$fi_count = $row['ccc'];
	$totFI += $fi_count;
	?>
    <TR>
	<td align=center><?php echo $i++; ?></td>
	<td align=center>
	<FORM METHOD="POST" ACTION="control-repeat-exam-subject.php">
	<INPUT TYPE="hidden" NAME="for_sem" value="<?php echo $for_sem; ?>">
	<INPUT TYPE="submit" name="sub_code" value="<?php echo $sub_code; ?>" style="padding:3px; border:1px blue solid;">
	</FORM></td>
	<td align=left><?php echo $sub_title; ?></td>
	<td align=left><?php echo $fac_name; ?></td>
	<td align=left><?php echo $fi_count; ?></td>
<TD>
<?php
$qapp = "select app_num from isr_reg_repeat_approved_tbl where sub_code ='$sub_code' order by app_sr desc limit 1";
$ObjDB->sproc_name = $qapp;
$res_qapp = $ObjDB->SelectQuery();
list($app_num)  = mysqli_fetch_row($res_qapp);
echo $app_num;
?>
</td>
	</tr>
	<?php 
}  ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
$pagemaincontent = ob_get_contents();
ob_clean();
$PAGENAME = 'control-repeat-exam';
$HTMLTITLE = '';
$HTMLDESCRIPTION = '';
$HTMLKEYWORDS = '';
include("admin-master.php");
?>