<style type="text/css">

    td.this {
        font-size:11px;
        color:black;
        border-left:1px lightsteelblue solid;
        border-top:1px lightsteelblue solid;
        text-align:center;
    }
    td.this2 {
        font-size:11px;
        color:black;
        border-left:1px lightsteelblue solid;
        border-top:1px lightsteelblue solid;
        text-align:left;
    }
    td.this3 {
        font-size:11px;
        color:black;
        border-left:1px lightsteelblue solid;
        border-top:1px lightsteelblue solid;
        text-align:center;
    }
    th.this3 {
        font-size:11px;
        color:black;
        border-left:1px lightsteelblue solid;
        border-top:1px lightsteelblue solid;
        text-align:center;
    }

    table.this {
        border-right:1px lightsteelblue solid;
        border-bottom:1px lightsteelblue solid;
    }
    H2 {
        color:#B92921;
        padding:0px;
        margin:0px;
    }
    H3 {
        color:#B92921;
        padding:0px;
        margin:0px;
    }
    td {
        font-family:arial;
        font-size:13px;
        color:#000000;
    }
    td.summarey {
        font-family:arial;
        font-size:12px;
        color:#000000;
        text-align:center;
    }
    H6 {
        font-family:arial;
        font-size:18px;
        color:#000000;
        margin:0px;
        border:0px;
        padding:0px
    }
    td.left {
        font-family:arial;
        font-size:14px;
        color:#000000;
        text-align:left;
        border-top:1px gray solid;
        border-right:1px gray solid;
    }
    td.noborder {
        font-family:arial;
        font-size:12px;
        color:#000000;
        border-top:0px gray solid;
        border-right:0px gray solid;
    }
    table.noborder {
        border-bottom:0px gray solid;
        border-left:0px gray solid;
    }
</style>
<CENTER><IMG SRC="../image/Transcript_head_1_transparent.png" WIDTH="700" BORDER="0" ALT=""></CENTER>

<!-- <CENTER><IMG SRC="../image/MScTranscript_head_1_transparent.png" WIDTH="700" BORDER="0" ALT=""></CENTER> -->

<BR>
<H6><CENTER>Consolidated Transcript</CENTER></H6>
<BR>
<!-- Student Ref Start  -->
<table border=0 cellspacing=0 cellpadding=1 align=center width=600 class=noborder>
    <tr>
        <td class=noborder width=130>Name of the student
        <td class=noborder width=270><B><?php echo strtoupper($stu_name); ?></B>
<!-- 	<td class=noborder rowspan=6 align=right>
        <IMG SRC="<? echo $photo; ?>" HEIGHT="120" BORDER="0">
            --><?php
            // echo "SELECT a.sub_code, a.grade, b.sub_crdit FROM $reg_file a, curr b where a.stu_roll = '$stu_roll' and a.sub_code = b.sub_code and a.sub_list = b.sub_list and a.sub_flag = 'Y' and a.sem < 9 order by a.sem, b.sub_crdit desc, a.sub_code";

            $query1 = "SELECT a.sub_code, a.grade, b.sub_crdit FROM $reg_file a, curr b where a.stu_roll = '$stu_roll' and a.sub_code = b.sub_code and a.sub_list = b.sub_list and a.sub_flag = 'Y' and a.sem < 9 order by a.sem, b.sub_crdit desc, a.sub_code";
            $ObjDB->sproc_name = $query1;
            $res_query1 = $ObjDB->SelectQuery();

            $tot_credit = 0;
            $tot_cr_val = 0;

            while ($row1 = mysqli_fetch_array($res_query1)) {
                $sub_code = $row1['sub_code'];
                $grade = $row1['grade'];
                $crdit = $row1['sub_crdit'];
                $tot_credit = $tot_credit + $crdit;
                $grade_value = GetGradeValue($reg_file, $grade);
                $cr_val = $crdit * $grade_value;
                $tot_cr_val = $tot_cr_val + $cr_val;
            }
            // echo	$tot_cr_val;
            $cgpa = round(($tot_cr_val / $tot_credit), 1);
            ?>
    <tr><Td class=noborder>Roll Number<td class=noborder><B><?php echo $stu_roll; ?></B>
    <tr><td class=noborder>Year of Joining<td class=noborder><B><?php echo substr($stu_roll, 0, 4); ?></B>
    <tr><td class=noborder>Year of Completion<td class=noborder><B>In progress</B>

</table>

<!-- Student Ref Ends  -->
<BR style="margin:-5px;">
<!-- Main Transcript Start -->
<?php
// $query=@mysql_query("SELECT substring($reg_file.sub_code,4,1) AS substr,$reg_file.sub_code, $reg_file.grade, $reg_file.sem, curr.sub_title, curr.sub_crdit from $reg_file, curr where curr.sub_list = $reg_file.sub_list and $reg_file.sem <= 8 and $reg_file.sub_flag = 'Y' and $reg_file.stu_roll = '$stu_roll' and $reg_file.sub_code = curr.sub_code order by substring($reg_file.sub_code,4,1), $reg_file.sub_code");
// $query=@mysql_query("SELECT substring(a.sub_code,4,1) AS substr, a.sub_code, a.grade, a.sem, b.sub_title, b.sub_crdit from $reg_file a, curr b where a.sub_list = b.sub_list and a.sem <= 8 and a.grade in ('A+', 'A', 'B+', 'B', 'C+', 'C', 'D', 'P', 'i', 'F') and a.sub_flag = 'Y' and a.stu_roll = '$stu_roll' and a.sub_code = b.sub_code order by substring(a.sub_code,4,1), a.sub_code");
// echo $ttt = "SELECT a.b1_sem AS substr, a.sub_code, a.grade, a.sem, b.sub_title, b.sub_crdit from $reg_file a, curr b where a.sub_list = b.sub_list and a.grade in ('A+', 'A', 'B+', 'B', 'C+', 'C', 'D', 'P', 'I', 'F') and a.sub_flag = 'Y' and a.stu_roll = '$stu_roll' and a.sub_code = b.sub_code order by a.b1_sem, a.sub_code";

$query = "SELECT a.b1_sem AS substr, a.sub_code, a.grade, a.sem, b.sub_title, b.sub_crdit from $reg_file a, isr_curriculum_tbl b where a.sub_list = b.sub_list and a.grade in ('A+', 'A', 'B+', 'B', 'C+', 'C', 'D', 'P', 'I', 'F') and a.sub_flag = 'Y' and a.stu_roll = '$stu_roll' and a.sub_code = b.sub_code order by a.b1_sem, a.sub_code";
$ObjDB->sproc_name = $query;
$res_query = $ObjDB->SelectQuery();

$total_rows = mysqli_num_rows($res_query);
$left_rows = ceil($total_rows / 2);
$right_rows = $total_rows - $left_rows;
$row_count = 0;

$leftColumn = "";
$rightColumn = "";
//$col_rows = 0;
$bio_credits = 0;
$chm_credits = 0;
$mth_credits = 0;
$phy_credits = 0;
$hss_credits = 0;
$idc_credits = 0;
$tdc_credits = 0;
$ecs_credits = 0;
$ds_credits = 0;
$se_credits = 0;

$sem_break = 4;
$right_sem = $sem_break + 1;
$old_sem = 1;

while ($row = mysqli_fetch_array($res_query)) {
//$col_rows++;
    $row_count++;
    $sub_code = $row["sub_code"];
    $sub_title = $row["sub_title"];
    $grade = $row["grade"];
    $sem = $row["sem"];
    $substr = $row["substr"];
    if ($row_count == 1) {
        $base_sem = $substr;
    }
    $sem_show = $substr - $base_sem + 1;
    $sub_credit = $row["sub_crdit"];
    if (substr($sub_code, 0, 2) == 'MT' and $grade != '')
        $mth_credits = $mth_credits + $sub_credit;
    if (substr($sub_code, 0, 2) == 'BI' and $grade != '')
        $bio_credits = $bio_credits + $sub_credit;
    if (substr($sub_code, 0, 2) == 'PH' and $grade != '')
        $phy_credits = $phy_credits + $sub_credit;
    if (substr($sub_code, 0, 2) == 'CH' and $grade != '')
        $chm_credits = $chm_credits + $sub_credit;
    if (substr($sub_code, 0, 2) == 'HS' and $grade != '')
        $hss_credits = $hss_credits + $sub_credit;
    if (substr($sub_code, 0, 2) == 'ID' and $grade != '')
        $idc_credits = $idc_credits + $sub_credit;
    if (substr($sub_code, 0, 2) == 'TD' and $grade != '')
        $tdc_credits = $tdc_credits + $sub_credit;
    if (substr($sub_code, 0, 2) == 'EC' and $grade != '')
        $ecs_credits = $ecs_credits + $sub_credit;
    if (substr($sub_code, 0, 2) == 'DS' and $grade != '')
        $ds_credits = $ds_credits + $sub_credit;
    if (substr($sub_code, 0, 2) == 'SE' and $grade != '')
        $se_credits = $se_credits + $sub_credit;

    if ($row_count <= $left_rows) {
        /* */
//echo $sem.", ".$old_sem."<br/>";			
//echo "abs: ".($old_sem % 2)."<br/>";
//if ($sem > $old_sem && $old_sem % 2 == 0) {
//echo "here<br/>";
//$leftColumn	.= "<tr><td colspan=5 class=this3><IMG SRC='gray_line.GIF' height=2 border=0></td></tr>";				
//
//if ($sem != $old_sem) {$old_sem = $sem ;//echo "change<br/>";
//}
        if ($substr != $old_sem) {
            $leftColumn .= "<tr><td colspan=6 class=this3><IMG SRC='gray_line.GIF' height=2 border=0></td></tr>";
            $old_sem = $substr;
        }
        $leftColumn .= "<TR><td class=this2>" . $sem_show . "</td><TD width=50 class=this2>" . $sub_code . "</td><TD width=250 class=this2>" . $sub_title . "</td><TD width=20 class=this2 align=center>" . round($sub_credit) . "</td><TD width=20 class=this2>&nbsp;" . $grade . "</td></tr>";
    } else {
        /*
          if ($sem != $right_sem) {
          } */
//if ($sem != $old_sem) {$old_sem = $sem ;//echo "change<br/>";
//}
        if ($substr != $old_sem) {
            $rightColumn .= "<tr><td colspan=5 class=this3><IMG SRC='gray_line.GIF' height=2 border=0></td></tr>";
            $old_sem = $substr;
        }
        $rightColumn .= "<TR><td class=this2>" . $sem_show . "</td><TD width=50 class=this2>" . $sub_code . "</td><TD width=250 class=this2>" . $sub_title . "</td><TD width=20 class=this2 align=center>" . round($sub_credit) . "</td><TD width=20 class=this2>&nbsp;" . $grade . "</td></tr>";
    }
}
if ($leftColumn != "") {
    $leftColumn = "<table border=0 class=this cellspacing=0 width=350 align=center>
<tr><td class=this2><B>Sem</B></td><td class=this2><B>Code</B></td><td class=this2><B>Course Title</B></td><td class=this2><B>CR</B></td><td class=this2><B>GR</B></td></tr>" . $leftColumn . "</table>";
}
if ($rightColumn != "") {

    $rightColumn = "<table border=0 class=this cellspacing=0 width=350 align=center>
<tr><td class=this2><B>Sem</B></td><td class=this2><B>Code</B></td><td class=this2><B>Course Title</B></td><td class=this2><B>CR</B></td><td class=this2><B>GR</B></td></tr>" . $rightColumn . "</table>";
}
?>

<!-- Subject Credits table start -->

<table border=0 align=center cellspacing=0 cellpadding=0 width=700 class=this2>

    <tr>
        <td width=340 valign=top><?php include "reports-tpr-consolidated-view2.php"; ?></td>
        <td width=340 valign=top><table border=0 align=center cellspacing=0 cellpadding=1 width=340 class=this2 style="border-right:1px lightsteelblue solid; border-bottom:1px lightsteelblue solid;">

                <tr>
                    <th class=this3 colspan=2>Discipline-wise credit distribution </th>
                </tr>

                <tr>
                    <td class=this2>Biology</td>
                    <td class=this3><?php echo $bio_credits; ?></td>
                </tr>
                <tr>
                    <td class=this2>Chemistry</td>
                    <td class=this3><?php echo $chm_credits; ?></td>
                </tr>
                <tr>
                    <td class=this2>Data Science</td>
                    <td class=this3><?php echo $ds_credits; ?></td>
                </tr>
                <tr>
                    <td class=this2>Earth and Climate Science</td>
                    <td class=this3><?php echo $ecs_credits; ?></td>
                </tr>
                <tr>
                    <td class=this2>Humanities and Social Sciences</td>
                    <td class=this3><?php echo $hss_credits; ?></td>
                </tr>
                <!--
                <tr>
                        <td class=this2>Inter Disciplinary Courses</td>
                        <td class=this3><?echo $idc_credits;?></td>
                </tr>  -->
                <tr>
                    <td class=this2>Mathematics</td>
                    <td class=this3><?php echo $mth_credits; ?></td>
                </tr>
                <tr>
                    <td class=this2>Physics</td>
                    <td class=this3><?php echo $phy_credits; ?></td>
                </tr>
                <tr>
                    <td class=this2>Science Education</td>
                    <td class=this3><?php echo $se_credits; ?></td>
                </tr>
                <tr>
                    <td class=this2>Trans disciplinary</td>
                    <td class=this3><?php echo $tdc_credits; ?></td>
                </tr>
        </td></tr></table>
</table>

<!-- Subject Credits table ends -->

<BR style="margin:-5px;">
<?php if ($add_project == 'Y') { ?>
<table border=0 align=center cellspacing=0 cellpadding=5 class=this width=700 bgcolor="lightpink">
</table>
<?php } ?>

<!-- <BR style="margin:-5px;"> -->



<table border=0 cellspacing=5 width=700 align=center>
    <tr>
        <td valign=top class=noborder><?php echo $leftColumn; ?></td>
        <td valign=top class=noborder><?php echo $rightColumn; ?><BR>
    </tr>
    <tr>
        <td valign=top colspan=2  class=this2 style="text-align:center;">Grade Values: A+ = 10; A = 9, B+ = 8, B = 7; C+ = 6; C = 5; D = 4;<br>
            P = pass, but credits not counted towards GPA; I = incomplete, 0 credits; F = fail, 0 credits.</td>
    </tr>

</table>

<!-- Main Transcript Ends -->



<TABLE width=600 align=center cellpadding=0 cellspacing=0 class=noborder>
    <TR>
        <TD width=200 style="text-align:left" class=noborder><BR><BR><BR><FONT COLOR="red">Date of issue: <?php echo $issuedate; ?></FONT></TD>
        <TD width=200 class=noborder>&nbsp;</TD>
        <TD width=200 style="text-align:right" class=noborder><BR><BR><BR><FONT COLOR="red">Dean, Academics</FONT></TD>
    </TR>
</TABLE>