{# Template For PG Students SJCD  Collagees   
Changes : No show percentage in each subject
            Show semester grade and SGPA #}
<link href='https://fonts.googleapis.com/css2?family=Times New Roman:ital,wght@0,400;0,700;1,400;1,700&display=swap' rel='stylesheet'>
<style>
   .bold-text{
    font-weight: bold !important;
    }

    .footer{
        width: 90%;
        position: absolute;
        bottom: 10px;
    }

    .fontFamily {
        font-family: "Times New Roman", Times, serif;
    }

    .page {
        position: relative;
        width: 100%;
        font-weight : normal ;
        min-height: auto;
        color:#000 !important;
        font-family: "Times New Roman", Times, serif;
    }
    .pageBreak{
        page-break-before: always !important;
    }
    .subject-grade {
        padding-left : 50% !important;
    }
    th {
        padding: 1px;
        font:bold 14px "Times new roman" !important;
        text-align:center;
    }
    td {
        padding: 1px;
        font:12px "Times new roman" !important;
    }
    #head td {
        padding: 1px;
        font:14px "Times new roman" !important;
    }
    .inner-tr {
        height:10px;
    }
    .inner-tr td {
        border-top: none;
        border-bottom: none;
        padding: 1px 1px;
    }
    .inner-tr-border-top td {
        border-top: 1px solid #000;
        border-bottom: none;
        padding: 1px 1px;
    }
    .caps {
        text-transform: uppercase;
        font-size: 13px;
    }
    .small {
        font-size: 13px;
    }
    .calculationtable {	
        margin:20px 0 0 0;
        width:90%;
        border:1px solid #000;
        border-collapse:collapse;
    }
    .calculationtable td {
        padding:5px;
        font-size:16px;
        border:1px solid #000;
        border-collapse:collapse;
    }
    .print-footer {
        width: 100%;
    }
    .subpage-2{
        height: auto;
        page-break-before: always !important;
        break-before: page !important;
        padding-left:30px;
        padding-right:30px;
    }
    .no-page-break {
        page-break-inside: avoid !important;
        break-inside: avoid-page !important;
    }
    .student-marks th{
        padding-top:8px;
        padding-bottom:8px;
    }
    .student-marks  td{
        padding-top:1px;
        padding-bottom:1px;

    }.student-marks span{
        font-size: 11px !important;
        line-height: 1.2;
    }
    .bold{
        font-weight:bold;
    }
    .remove-right{
        border-right:1px solid #ffff;
    }
    .title-transcript{
        font-size: 18px !important;
    }
    .header-meta td {
        vertical-align: top;
        padding: 2px 0;
    }
    .header-field {
        width: 100%;
        display: table;
        table-layout: fixed;
        white-space: nowrap;
    }
    .header-label {
        display: table-cell;
        width: 190px;
        min-width: 190px;
        font-weight: bold;
        text-align: left;
        vertical-align: baseline;
    }
    .header-colon {
        display: table-cell;
        width: 12px;
        min-width: 12px;
        text-align: center;
        font-weight: bold;
        vertical-align: baseline;
    }
    .header-value {
        display: table-cell;
        font-weight: bold;
        vertical-align: baseline;
    }
    .header-right {
        text-align: right;
    }
    .header-right .header-field {
        width: 320px;
        margin-left: auto;
    }
    .header-right .header-label {
        width: 170px;
        min-width: 170px;
        text-align: left;
    }
    .first-page {
        page-break-after: always !important;
        break-after: page !important;
        position: relative;
        min-height: 262mm;
        font-family: "Times New Roman", Times, serif;
    }
    .first-page-info-label {
        width: 42%;
        padding: 6px 0;
        font: 16px "Times New Roman", Times, serif !important;
        vertical-align: top;
    }
    .first-page-info-value {
        padding: 6px 0;
        font: bold 16px "Times New Roman", Times, serif !important;
        vertical-align: top;
    }
    .cgpa-details-start {
        page-break-before: always !important;
        padding-top:60px;
        break-before: page !important;
    }
    .formula-layout td {
        font:15px "Times new roman" !important;
    }

    @media print {
        #head {
            width: 88% !important;
            margin: 0 auto !important;
        }
        tr.no-page-break,
        tr.no-page-break td {
            page-break-inside: avoid !important;
            break-inside: avoid-page !important;
        }
        .header-right .header-field {
            width: 320px;
            margin-left: auto;
        }
    }
</style>
{% for student in data.studentData %}
    {% set totalAuditCourseCreditSum = 0%}
    <div>
        <div class="first-page">
            <!-- College Header -->
            <img src="{{data.collegeData.collegeHeader}}" style="width: 90%; height: auto; margin: 0 auto; display: block;">
            <hr style="border:0; border-top:2px solid #000; margin:8px 0 12px 0;">

            <div style="text-align:right; font:16px 'Times New Roman', Times, serif; margin-bottom:14px;">Date: {{data.dateOfIssue}}</div>

            <div style="text-align:center; margin:12px 0 20px 0;">
                <span style="font:bold 20px 'Times New Roman', Times, serif; text-decoration:underline; letter-spacing:1px;">OFFICIAL TRANSCRIPT</span>
            </div>

            <!-- Student Details -->
            <table style="width:100%; border-collapse:collapse; margin-bottom:18px;">
                <tr>
                    <td class="first-page-info-label">Name of the Student</td>
                    <td class="first-page-info-value">: {{student.name}}</td>
                </tr>
                <tr>
                    <td class="first-page-info-label">Register Number</td>
                    <td class="first-page-info-value">: {{student.regNo}}</td>
                </tr>
                <tr>
                    <td class="first-page-info-label">Name of the Programme</td>
                    <td class="first-page-info-value">: {{student.programName}}</td>
                </tr>
                <tr>
                    <td class="first-page-info-label">Period of study</td>
                    <td class="first-page-info-value">: {{student.admissionYear}} - {{student.endYear}}</td>
                </tr>
                <tr>
                    <td class="first-page-info-label">Month and Year of passing</td>
                    <td class="first-page-info-value">: {% if student.failedStatus == 'PASSED' %}{{student.examMonthYear | upper}}{% else %}-{% endif %}</td>
                </tr>
                <tr>
                    <td class="first-page-info-label">Name of the Institution</td>
                    <td class="first-page-info-value">: {{data.collegeData.collegeName}}, {{data.collegeData.place}}.</td>
                </tr>
                <tr>
                    <td class="first-page-info-label" style="line-height:1.5;">Name of the University to which the college is affiliated.</td>
                    <td class="first-page-info-value">: University of Calicut, Kerala, India.</td>
                </tr>
                <tr>
                    <td class="first-page-info-label">Nature of the programme</td>
                    <td class="first-page-info-value" style="vertical-align:top;"><span style=" float: left;"> :&nbsp;</span>
                    <span style="    width: 96% !important; float: left;">Regular two year programme consisting of four semesters under the choice based credit semester system.</span></td>
                </tr>
                <tr>
                    <td class="first-page-info-label">Core Course</td>
                    <td class="first-page-info-value">: {{student.deptName}}</td>
                </tr>
                <tr>
                    <td class="first-page-info-label">Medium of Instruction</td>
                    <td class="first-page-info-value">: English</td>
                </tr>
                <tr>
                    <td class="first-page-info-label">Total Credits acquired</td>
                    <td class="first-page-info-value">: {% if student.failedStatus == 'PASSED' %}{{student.markDetails.credit}} (Semester {% for term in student.academicTerms %}{{term.termOrder}}{% if not loop.last %}, {% endif %}{% if loop.index == (student.academicTerms|length - 1) %}&amp; {% endif %}{% endfor %} ){% else %}-{% endif %}</td>
                </tr>
                <tr>
                    <td class="first-page-info-label" style="line-height:1.6;">Semester Grade Point Average (SGPA) <br>scored on a five point scale during first,<br>second, third &amp; fourth semesters.<br>(Regular/Improvement/Supplementary)</td>
                    <td class="first-page-info-value" style="font-weight:normal; padding-top:3px;">
                        : <br>
                        <table border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; width:100%;">
                            <tr>
                                <th style="padding:8px 10px; text-align:center; font:bold 16px 'Times New Roman', Times, serif;">SEMESTER</th>
                                <th style="padding:8px 10px; text-align:center; font:bold 16px 'Times New Roman', Times, serif;">SGPA</th>
                                <th style="padding:8px 10px; text-align:center; font:bold 16px 'Times New Roman', Times, serif;">R/I/S</th>
                                <th style="padding:8px 10px; text-align:center; font:bold 16px 'Times New Roman', Times, serif;">GRADE</th>
                                <th style="padding:8px 10px; text-align:center; font:bold 16px 'Times New Roman', Times, serif;">PERCENTAGE</th>
                            </tr>
                            {% for term in student.academicTerms %}
                            <tr>
                                <td style="padding:8px 10px; font:16px 'Times New Roman', Times, serif; text-align:center;">{{term.romanNumber}}</td>
                                <td style="padding:8px 10px; font:16px 'Times New Roman', Times, serif; text-align:center;">{% if term.failedStatus == 'PASSED' %}{{term.sgpa|number_format(2, '.')}}{% else %}-{% endif %}</td>
                                <td style="padding:8px 10px; font:16px 'Times New Roman', Times, serif; text-align:center;">{{term.failedStatus == 'PASSED' ? term.rsi : '-'}}</td>
                                <td style="padding:8px 10px; font:16px 'Times New Roman', Times, serif; text-align:center;">{{term.grade}}</td>
                                <td style="padding:8px 10px; font:16px 'Times New Roman', Times, serif; text-align:center;">{% if term.failedStatus == 'PASSED' %}{{term.sgpaPercentage|number_format(2, '.')}}{% else %}-{% endif %}</td>
                            </tr>
                            {% endfor %}
                        </table>
                    </td>
                </tr>
            </table>

            <!-- CGPA Summary -->
            <div style="font:16px 'Times New Roman', Times, serif; margin-bottom:10px; line-height:1.8;">
                Cumulative Grade Point Average (CGPA) scored on a five point scale : <b>{% if student.failedStatus == 'PASSED' %}{{student.cgpa|number_format(student.roundOff, '.')}}{% else %}-{% endif %}</b>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Grade : <b>{{student.grade}}</b>
            </div>
            <div style="font:bold 16px 'Times New Roman', Times, serif;">
                CGPA in percentage : {% if student.failedStatus == 'PASSED' %}{{student.cgpaPercentage|number_format(2, '.')}} %{% else %}-{% endif %}
            </div>

            <div style="text-align:right; position:absolute; bottom:0px; left:0; width:100%; font:16px 'Times New Roman', Times, serif;">PTO.</div>
        </div>
        <div class="page" style="border:none;">
            <div style='text-align:center;'>
                <br>
                <div class="bold fontFamily title-transcript" ><span style='border:1px solid #000; padding-left:30px; padding-right:30px; padding-top:5px; padding-bottom:5px'> CONSOLIDATED GRADE CARD </span></div>
                <br>
            </div>
            <div class="subpage-1" style=''>
                <table id = "printTable"  style="width:100%;"><tr><td style="width:100%;">
                    <tr>
                        <td>
                            <table border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse;width: 100%;height:100%;border:2px solid #000;" class="student-marks">
                                <col width="7%">
                                <col width="30.5%">
                                <col width="5%">
                                <col width="2.5%">
                                <col width="2.5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="2.5%">
                                <col width="5%">
                                <tr>
                                    <th style="text-align:center;">Course Code </th>
                                    <th style="text-align:center;">Course Name </th>
                                    <th><div>Credit</div> </th>
                                    <th style="text-align:center;">Type</th>
                                    <th>Int Grade</th>
                                    <th>Ext Grade</th>
                                    <th><div>Grade Point</div> </th> 
                                    <th><div>Letter Grade</div> </th> 
                                    <th><div>Credit Points</div> </th>
                                    <th><div>R</br>S</br>I</div> </th>
                                    <th><div>Date of </br>Exam</div> </th>
                                </tr>
                                {% for term in student.academicTerms if term.termOrder <= data.maximumSemResultInOnePaper %}
                                {% if term.termOrder is divisible by(data.maximumSemResultInOnePaper + 1)  %}
                            </table>
                        </td>
                    </tr>
                </table>
                <table id = "printTable" style="width:100%;"><tr><td style="width:100%;">
                    <tr>
                        <td>
                            <table border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse;width: 100%;height:100%;border:1px solid #000;">
                                <col width="5%">
                                <col width="32.5%">
                                <col width="5%">
                                <col width="2.5%">
                                <col width="2.5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="2.5%">
                                <col width="5%">
                                {% endif %}
                                <tr>
                                    <td colspan = "11"><b style = "text-align:left;font-size:13px;padding: 5px;">Semester {{term.romanNumber}}</b></td>
                                </tr>
                                {% for subject in term.subjects %} 
                                <tr class="inner-tr">
                                    <td style="text-align:left; padding-left:5px" valign = 'top'>
                                        <span style = 'font-size: 12px;text-transform: uppercase;'>{{subject.code |raw}}</span>
                                    </td>
                                    <td style="text-align:left;padding-left:3px;" valign = 'top'>
                                        <span style = 'font-size: 12px;text-transform: uppercase;'>{{subject.name |raw}}</span>
                                    </td>
                                    <td style="text-align:center; " valign = 'top'>
                                        <span style = 'font-size: 12px;'>{{subject.hideGrade ? '--' : subject.markDetails.credit}}</span>
                                    </td>
                                    <td style="text-align:center; " valign = 'top'>
                                        <span style = 'font-size: 12px;'>{{subject.subjectTypeCodeConst}}</span>
                                    </td>

                                   
                                    <td valign = 'top'>
                                        <span class="subject-grade" style = 'font-size: 12px;'>{{subject.markDetails.isInternal ? subject.markDetails.internalGrade : '--'}}</span>
                                    </td>
                                    <td valign = 'top'>
                                    {% if subject.markDetails.attendanceStatus == 'PRESENT' %}
                                        <span class="subject-grade" style = 'font-size: 12px;'>{{subject.markDetails.isExternal ? subject.markDetails.externalGrade : '--'}}</span>
                                    {% else %}
                                        <span class="subject-grade" style='color:red;'><span style = 'font-size: 12px;'>
                                            {% if subject.markDetails.attendanceStatus == 'ABSENT' %}
                                            AB
                                            {% elseif subject.markDetails.attendanceStatus == 'MAL' %}
                                            MAL
                                            {% else %}
                                            --
                                            {% endif %}
                                        </span></span>
                                    {% endif %}
                                    </td>
                                    <td style="text-align:center; " valign = 'top'>
                                        <span style = 'font-size: 12px;'>{{subject.hideGrade ? '--' : subject.markDetails.gradePoint |number_format(2, '.')}}</span>
                                    </td>
                                    <td valign = 'top' style="text-align:center; ">
                                        <span  style = 'font-size: 12px;'>{{subject.failedStatus == 'PASSED' ? subject.grade : '-'}}</span>
                                    </td>
                                    <td style="text-align:center; " valign = 'top'>
                                        <span style = 'font-size: 12px;'>{{subject.hideGrade ? '--' : subject.creditPoint |number_format(2, '.')}}</span>
                                    </td>
                                    <td style="text-align:center; " valign = 'top'>
                                        <span style = 'font-size: 12px;'>{{subject.hideGrade ? '--' : subject.RSI}}</span>
                                    </td>
                                    <td style="text-align:center; white-space:nowrap;" valign = 'top'>
                                        <span style = 'font-size: 12px;'>{{subject.hideGrade ? '--' : subject.examMonthYear}}</span>
                                    </td>
                                </tr>
                                {% endfor %}
                                {% set auditCourseCreditSum = 0 %}
                                {% for subject in term.auditCources %}
                                    {% if loop.first %}
                                        <tr class="inner-tr-border-top">
                                    {% else %}
                                        <tr class="inner-tr">
                                    {% endif %}
                                        {% set auditCourseCreditSum =  auditCourseCreditSum + subject.markDetails.credit %}
                                         <td style="text-align:left; padding-left:5px" valign = 'top' >
                                            <span style = 'font-size: 12px;text-transform: uppercase;'>{{subject.code | raw}}</span>
                                        </td>
                                        <td style="text-align:left; " valign = 'top' >
                                            <span style = 'font-size: 12px;text-transform: uppercase;'>{{subject.name | raw}}</span>
                                        </td>
                                        <td style="text-align:center; " valign = 'top'>
                                            <span style = 'font-size: 12px;'>{{subject.hideGrade ? '--' : subject.markDetails.credit}}</span>
                                        </td>
                                        <td style="text-align:center; white-space: nowrap; " valign = 'top'>
                                            <span style = 'font-size: 12px;'>{{subject.subjectTypeCodeConst}}</span>
                                        </td>
                                        <td style="text-align:center; " colspan="7" valign = 'top'>
                                            <span style = 'font-size: 12px;'><b>{{subject.failedStatus == 'PASSED' ? 'PASSED' : 'FAILED'}}</b></span>
                                        </td>
                                    </tr>
                                {% endfor %}
                                <tr>
                                    {% set totalAuditCourseCreditSum = totalAuditCourseCreditSum + auditCourseCreditSum %}
                                    <td colspan = "6" style="text-align:left;">
                                    <div style="margin-left:10%; width:90%; float:left; font-weight:bold">Total Credits acquired: {{term.markDetails.credit + auditCourseCreditSum}} (
                                        {% for termSubjectCategory in term.termSubjectCategories %}
                                            {{termSubjectCategory.name}} : {{termSubjectCategory.credit}}
                                            {% if loop.last %}
                                            {% else %}
                                            ,{% endif %}
                                        {% endfor %}
                                        {% if auditCourseCreditSum > 0 %}
                                            , Audit*:{{auditCourseCreditSum}}
                                        {% endif %}
                                    )</div>
                                    </td>
                                    <td colspan = "3" style="text-align:center;font-weight:bold!important;padding-left:5px;">
                                        SGPA {{term.romanNumber}} : 
                                        {% if term.failedStatus == 'PASSED' %}
                                            {{term.sgpa|number_format(student.roundOff, '.')}} 
                                        {% else %}
                                            -
                                        {% endif %}
                                    </td>
                                    <td colspan = "2" style="text-align:center;font-weight:bold!important;padding-left:5px;">
                                        Grade : 
                                        {% if term.failedStatus == 'PASSED' %}
                                        {{term.grade}}
                                        {% else %}
                                            -
                                        {% endif %}
                                    </td>
                                </tr>
                                {% endfor %}
                                                                <tr class="no-page-break">
                                    <td colspan = '11' align='center' style='font-size:13px;'>
                                        <b style = 'font-size: 12px;'>
                                         <p style = 'font-size: 12px;margin: 0; font-weight:bold'>Total Credits required for the successful completion of the Programme : {% if student.failedStatus == 'PASSED' %} {{student.markDetails.credit + totalAuditCourseCreditSum}} {% else %} - {% endif %}</p>
                                        Total Credits acquired in the programm : &nbsp;<span style="text-transform:capitalize;">{% if student.failedStatus == 'PASSED' %} {{student.markDetails.credit + totalAuditCourseCreditSum}} {% else %} - {% endif %}&nbsp;
                                            (
                                                {% for markListSubjectCategory in student.markListSubjectCategories %} 
                                                    {{markListSubjectCategory.name}} : {{markListSubjectCategory.credit}}
                                                    {% if loop.last %}
                                                    {% else %}
                                                    ,{% endif %}
                                                {% endfor %}
                                                {% if totalAuditCourseCreditSum > 0 %}
                                                    , Audit*:{{totalAuditCourseCreditSum}}
                                                {% endif %}
                                            ) 
                                            </span> 
                                        <br>
                                        * The credits of Audit course are not considered for the calculation of SGPA and CGPA
                                        </b>
                                    </td>
                                </tr>
                                <tr class="no-page-break">
                                    <td colspan='2' style="text-align:center; font-size:14px; font-weight:bold !important;">
                                        CGPA:
                                        {% if student.failedStatus == 'PASSED' %}
                                            {{student.cgpa|number_format(student.roundOff, '.')}}
                                        {% else %}
                                            -
                                        {% endif %}
                                    </td>
                                    <td colspan='4' style="text-align:center; font-size:14px; font-weight:bold !important;">
                                        CGPA in percentage:
                                        {% if student.failedStatus == 'PASSED' %}
                                            {{student.cgpaPercentage|number_format(student.roundOff, '.')}}%
                                        {% else %}
                                            -
                                        {% endif %}
                                    </td>
                                    <td colspan='5' style="text-align:center; font-size:14px; font-weight:bold !important;">
                                        OVERALL LETTER GRADE:
                                        {% if student.failedStatus == 'PASSED' %}
                                            {{student.grade}}
                                        {% else %}
                                            -
                                        {% endif %}
                                    </td>
                                </tr>
                            </table>
                            {% if not data.isStudentSideExamResult %}
                                <table class='no-border-table' border="0" style='width:100%;margin-top:5mm!important;'>
                                    <tr>
                                        <td style='width:64%; text-align:left;margin-top:5mm!important;font-weight:bold!important;'>
                                            {% if data.collegeData.displayExamControllerLabel %}
                                                <span
                                                style='padding-left:60px;padding-right: 4mm;font-size: 16px;'>Controller of Examinations</span>
                                            {% endif %}
                                        </td>
                                        <td style='width:14%'></td>
                                        <td style='width:22%;font-weight:bold!important;'>
                                            {% if data.collegeData.displayPrincipalLabel %}
                                                <span style='padding-left:6px;padding-right: 2mm;font-size: 16px;'>Principal</span>
                                            {% endif %}
                                        </td>
                                    </tr>
                                </table>
                            {% else %}
                                <table class = "" border="0"  cellpadding="0" cellspacing="0" style="margin-top:10px">
                                    <tr>
                                        <td style="text-align:justify;">
                                            <p style="font-size: 14px;margin-bottom:5%;">Disclaimer: The office of the Controller of Examinations is not responsible for any inadvertent error that may have crept in the information being published in the site. The details published are for immediate information of the candidate and cannot be treated as original documents. The final mark sheets issued by the College should only be treated as authentic and final.</p>
                                        </td>
                                        
                                    </tr>						
                                </table>
                            {% endif %}
                            <div style='width:100%;float:left; text-align:center; padding-top:0px' class="fsize-14 font-2">
                                <div style='width:50%;float:left; font-size:15px !important' ><b>CONTROLLER OF EXAMINATIONS</b></div>
                                <div style='width:50%;float:right;font-size:15px !important' ><b>PRINCIPAL</b></div>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div> 
    </div>
{% endfor %}
