{# Template For PG Students In MES  
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: 297mm;
        color:#000 !important;
        font-family: "Times New Roman", Times, serif;
        background-color: white !important;
    }
    .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 : 325mm;
    }
    .student-marks th{
        padding-top:5px;
        padding-bottom:5px;
    }
    .student-marks  td{
        padding-top:1px;
        padding-bottom:1px;
    }
    .font-weight-bold{
        font-weight:bold !important;
    }

</style>
{% for student in data.studentData %}
    <div>
        <div class="page" style="border:none;">
            <div class="subpage-1" style=''>
                {% if data.isStudentSideExamResult %}
                    <table style = 'text-align:center;width: 100%;font-size:16px;' cellpadding='0' cellspacing='0' border='0' class='collage-header'>
                        <thead>
                            <tr>
                                <td width="100%" style=' padding:0 !important; margin:0 !important'>
                                    <div style = 'width:100%; text-align:center; padding:0 !important'>
                                        <img style = 'width: 85px; height: 115px;' src = '{{data.collegeData.collageLogo}}'>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td width="100%" >
                                    <div style = 'width:100%;line-height:25px;'>
                                        <div  style = 'text-align:center;'>
                                        </div>
                                    </div>	
                                </td>
                            </tr>
                            
                        </thead>
                    </table>
                {% endif %}
                <table id = "printTable"  style="width:100%;"><tr><td style="width:100%;">
                    <tr>
                        <td>
                            <table id="head" style="width: 100%;" cellpadding="0" cellspacing="0" border="0">
                                <tr>
                                    <td colspan="2">
                                      
                                        <table style="width: 102%; margin: 0; padding: 0; margin-top: 25px; " cellpadding="0" cellspacing="0" border="0" class="first-page-start">
                                            <tr>
                                                <td rowspan="2" style="width: 15%;">
                                                    <div style="" id="folio-number">
                                                        Folio No. : &nbsp;<b class = 'fontFamily'>{{student.folioNumber}}</b>
                                                    </div>
                                                </td>
                                                <td rowspan="2" style="width: 60%;">
                                                  
                                                </td>
                                                <td style="width: 30%;text-align:right; "><span style="margin-right:30px;">Dated: {{student.resultPublishDate}}</span></td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td width='66%'>
                                        <div style="display: inline-block; width: 33%">
                                            <span class="caps">Name of Programme </span> <span
                                            style="float: right;">:</span>
                                        </div>
                                        <div style="display: inline-block; width: 65%">&nbsp; <b>
                                            <span class="small"><b>{{student.programName}}</b></span></b>
                                        </div>
                                    </td>
                                    <td width='34%' style='text-align:right;'>
                                        <div style="width: 47%;display: inline-block; text-align:right;">
                                            <span class="caps">Register No&nbsp;</span>
                                            <span style="float: right;">:&nbsp;</span>
                                        </div>
                                        <div style="text-align: right;display: inline-block;" >
                                            <b><span class="caps" id="correctdate" style='white-space: nowrap;'>{{student.regNo}}</span></b>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div style="display: inline-block; width: 33%">
                                            <span class="caps">Name of Candidate</span><span
                                                style="float: right;">:</span>
                                        </div>
                                        <div style="display: inline-block; width: 65%;">
                                            &nbsp;
                                            <b><span class='caps fontFamily'>{{student.name}}</span></b>
                                        </div>
                                    </td>
                                    <td style='text-align:right;'>
                                        <div style="width: 47%;display: inline-block; text-align:right;">
                                            <span class="caps">Month &amp; Year&nbsp;</span>
                                            <span style="float: right;">:&nbsp;</span>
                                        </div>
                                        <div style="text-align: right;display: inline-block;" id="month-year">
                                            <b><span class="caps" id="correctdate" style='white-space: nowrap;'>{{student.examMonthYear}}</span></b>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <div style="width:100%; text-align: center; font-size: 14px; margin-top:10px;margin-bottom:10px;">The following is the cumulative grade awarded to the candidate at the Final Semester {{student.degreeName}} Degree Examination (CBCSS)</div>
                            <table border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse;width: 100%;height:100%;border:2px solid #000;" class="student-marks student-mark-list-content">
                                <col width="7%">
                                <col width="30.5%">
                                <col width="5%">
                                <col width="2.5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="5%">
                                <tr>
                                    <th style="text-align:center;">Course Code </th>
                                    <th style="text-align:center;">Course Title </th>
                                    <th><div>Credit</div> </th>
                                    <th style="text-align:center;">Type</th>
                                    <th>Int Grade</th>
                                    <th>Ext Grade</th>
                                    <th><div>Total Grade</div> </th> 
                                    <th><div>Credit Point</div> </th>
                                    <th><div>R/S/I</div> </th>
                                    <th><div> Session</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%;" class="student-mark-list-content"><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="5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="5%">
                                <col width="5%">
                                {% endif %}
                                <tr>
                                    <td colspan = "10"><b style = "text-align:left;font-size:11px;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' class="student-mark-list-content">
                                        <span style = 'font-size: 10px;text-transform: uppercase;'>{{subject.code |raw}}</span>
                                    </td>
                                    <td style="text-align:left;padding-left:3px;" valign = 'top' class="student-mark-list-content">
                                        <span style = 'font-size: 10px;text-transform: uppercase;'>{{subject.name |raw}}</span>
                                    </td>
                                    <td style="text-align:center; " valign = 'top' class="student-mark-list-content">
                                        <span style = 'font-size: 10px;'>{{subject.hideGrade ? '--' : subject.markDetails.credit}}</span>
                                    </td>
                                    <td style="text-align:center; " valign = 'top' class="student-mark-list-content">
                                        <span style = 'font-size: 10px;'>{{subject.subjectTypeCodeConst}}</span>
                                    </td>

                                   
                                    <td valign = 'top' class="student-mark-list-content">
                                        <span class="subject-grade" style = 'font-size: 10px;'>{{subject.markDetails.isInternal ? subject.markDetails.internalGrade : '--'}}</span>
                                    </td>
                                    <td valign = 'top' class="student-mark-list-content">
                                    {% if subject.markDetails.attendanceStatus == 'PRESENT' %}
                                        <span class="subject-grade" style = 'font-size: 10px;'>{{subject.markDetails.isExternal ? subject.markDetails.externalGrade : '--'}}</span>
                                    {% else %}
                                        <span class="subject-grade" style='color:red;'><span style = 'font-size: 10px;'>
                                            {% if subject.markDetails.attendanceStatus == 'ABSENT' %}
                                            AB
                                            {% elseif subject.markDetails.attendanceStatus == 'MAL' %}
                                            MAL
                                            {% else %}
                                            --
                                            {% endif %}
                                        </span></span>
                                    {% endif %}
                                    </td>
                                    <td valign = 'top' class="student-mark-list-content">
                                        <span class="subject-grade" style = 'font-size: 10px;'>{{subject.failedStatus == 'PASSED' ? subject.grade : '-'}}</span>
                                    </td>
                                    <td style="text-align:center; " valign = 'top' class="student-mark-list-content">
                                        <span style = 'font-size: 10px;'>{{subject.hideGrade ? '--' : subject.creditPoint |number_format(2, '.')}}</span>
                                    </td>
                                    <td style="text-align:center; " valign = 'top' class="student-mark-list-content">
                                        <span style = 'font-size: 10px;'>{{subject.hideGrade ? '--' : subject.RSI}}</span>
                                    </td>
                                    <td style="text-align:center; white-space:nowrap;" valign = 'top' class="student-mark-list-content">
                                        <span style = 'font-size: 10px;'>{{subject.hideGrade ? '--' : subject.examMonthYear}}</span>
                                    </td>
                                </tr>
                                {% endfor %}
                                {% for subject in term.auditCources %}
                                    {% if loop.first %}
                                        <tr class="inner-tr-border-top">
                                    {% else %}
                                        <tr class="inner-tr">
                                    {% endif %}
                                        <td style="text-align:left; " valign = 'top' class="student-mark-list-content" colspan="2">
                                            <span style = 'font-size: 10px;text-transform: uppercase;'>{{subject.name}}</span>
                                        </td>
                                        <td style="text-align:center; " valign = 'top' class="student-mark-list-content">
                                            <span style = 'font-size: 10px;'>{{subject.hideGrade ? '--' : subject.markDetails.credit}}</span>
                                        </td>
                                        <td style="text-align:center; white-space: nowrap; " valign = 'top' class="student-mark-list-content">
                                            <span style = 'font-size: 10px;'>{{subject.subjectTypeCodeConst}}</span>
                                        </td>
                                        <td style="text-align:center; " colspan="6" valign = 'top' class="student-mark-list-content">
                                            <span style = 'font-size: 10px;'><b>{{subject.failedStatus == 'PASSED' ? 'PASSED' : 'FAILED'}}</b></span>
                                        </td>
                                    </tr>
                                {% endfor %}
                                <tr>
                                    <td colspan = "1" style="text-align:center; font-size:10px !important; "><b>Semester- {{term.romanNumber}} </b></td>
                                    <td colspan = "5" style = 'width: 1%;text-align: center; font-size:10px !important;'><b>Total Credits acquired (S{{term.termOrder}}): {{term.markDetails.credit}} (
                                        {% for termSubjectCategory in term.termSubjectCategories %}
                                            {{termSubjectCategory.name}} : {{termSubjectCategory.credit}}
                                            {% if loop.last %}
                                            {% else %}
                                            ,{% endif %}
                                        {% endfor %}
                                    )</b></td>
                                    <td colspan = "3" style = 'width: 1%;text-align: center; font-size:10px !important;'><b>SGPA {{term.romanNumber}} : 
                                        {% if term.failedStatus == 'PASSED' %}
                                            {{term.sgpa|number_format(student.roundOff, '.')}} 
                                        {% else %}
                                            -
                                        {% endif %}
                                    </b></td>
                                    <td colspan = "3" style = 'width: 1%;text-align: center; font-size:10px !important;'><b>Grade : 
                                     {% if term.failedStatus == 'PASSED' %}
                                       {{term.grade}}
                                    {% else %}
                                        -
                                    {% endif %}
                                    <b></td>
                                </tr>
                                {% endfor %}
                                <tr>
                                    <td colspan = '10' align='center' style='font-size:11px;'>
                                        <p style = 'font-size: 10px;margin: 0;'>Total Credits required for the successful completion of the Programme :{{student.markDetails.credit}}</p>
                                        <b style = 'font-size: 10px;'>Programme Total Credits acquired : &nbsp;<span style="text-transform:capitalize;">{{student.markDetails.credit}}&nbsp;
                                        (
                                            {% for markListSubjectCategory in student.markListSubjectCategories %} 
                                                {{markListSubjectCategory.name}} : {{markListSubjectCategory.credit}}
                                                {% if loop.last %}
                                                {% else %}
                                                ,{% endif %}
                                            {% endfor %}
                                        ) 
                                        </span> </b>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan = '10' style="text-align:center;">
                                        <p>
                                            <b style = 'font-size: 14px;'>CUMULATIVE GRADE POINT AVERAGE (CGPA) :&nbsp;
                                                {% if student.failedStatus == 'PASSED' %}
                                                    {{student.cgpa|number_format(student.roundOff, '.')}}
                                                {% else %}
                                                    - 
                                                {% endif %}
                                            </b>
                                        </p>
                                        <p>
                                            <b style = 'font-size: 14px'>GRADE : 
                                                {% if student.failedStatus == 'PASSED' %}
                                                    {{student.grade}}
                                                {% else %}
                                                    - 
                                                {% endif %}
                                            </b>
                                            <b style = 'font-size: 14px; margin-left: 30px;' >PERCENTAGE : 
                                                {% if student.failedStatus == 'PASSED' %}
                                                    {{student.cgpaPercentage|number_format(student.roundOff, '.')}} 
                                                {% else %}
                                                    - 
                                                {% endif %}
                                            </b>
                                        </p>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <div style="width:100%;display:block;float:left;"><br /></div>		
                    <div style="margin: 50px 0 0 0; width: 100%; font-size: 10px">
                        <div style = 'width:20%;margin:16px auto; text-align:center;float:left;'>Seal</div>
                        <div style = 'width:25%;margin:16px auto; text-align:center;float:left;'>Checked by</div>
                        <div style = 'width:25%;margin:0 auto; text-align:center;float:left;' class='small'>
                            <b></b> <br />Controller of Examinations
                        </div>
                        <div style = 'width:23%;margin:0 auto; text-align:center;float:left;' class='small'>
                            <b></b> <br />Principal
                        </div>
                        <table class = "new footer" border="0"  cellpadding="0" cellspacing="0" >
                            <tr>
                                <td style="text-align:center;">
                                    <p style="font-size: 13px;margin-bottom: 2%;">{{footer}}</p>
                                </td>
                                
                            </tr>						
                                            
                        </table>
                    </div>
            </div>
        </div> 
        <div class="page pageBreak second-page-instruction" >
            <div class="subpage-2 "> 
                <p class=""style="text-align: center; font-size: 14px;font-weight: 700;margin-top:20px;">Details of CGPA Grading Scheme are given below</p>
                <table class = ' new' border='1'  cellpadding='0' cellspacing='0' style='width:50%;margin:auto;border:1px solid #000;'>
                    <tr>
                        <th>Total Grade Point (G)</th>
                        <th>Letter Grade</th>
                        <th width="150px">Range of % of Grade</th>
                    </tr>
                    {% for grade in data.gradeDetails %}
                    <tr>
                        <td align='center'><span style='font-size: 14px;'>{{ grade.rangeFrom }} - {{ grade.rangeTo }}</span></td>
                        <td style="text-align: left;"><span style='text-align: left; margin-left: 55px;font-size: 14px;'>{{grade.letterGrade}}</span></td>
                        <td style="text-align: left;"><span style='text-align: left; margin-left: 50px;font-size: 14px;'>{{  ('0' ~ grade.percentageFrom)|slice(-2) }} - {{ grade.percentageTo }}</span></td>
                    </tr>
                    {% endfor %}
                </table>
                <br>
                <table style="width: 60%;">
                    <tr>
                        <td style="text-align:left; width: 20%;"><p style="font-size: 14px;">C : Core</p></td>
                        <td style="text-align:left; width: 20%;"><p style="font-size: 14px;">E : Elective</p></td>
                        <td style="text-align:left; width: 60%;"><p style="font-size: 14px;">A : Audit Course</p></td>
                    </tr>
                </table>
                <br>
                <br>
                <table  border="0" style="width: 102%;">
                    <tr>
                        <td><p style="font-size: 14px;text-align:left;">Pass Minimum for external examination</p></td>
                        <td><p style="font-size: 14px;text-align:left;">:</p></td>
                        <td><p style="font-size: 14px;text-align:left;">{{student.minimumPassGrade}}</p></td>
                    </tr>
                    <tr>
                        <td><p style="font-size: 14px;text-align:left;">No Pass Minimum for internal examination <br> Pass Minimum for a Course</p></td>
                        <td><p style="font-size: 14px;text-align:left;"><br>:</p></td>
                        <td><p style="font-size: 14px;text-align:left;"><br>{{student.minimumPassGrade}}</p></td>
                    </tr>
                    <tr>
                        <td><p style="font-size: 14px;text-align:left;">Semester Grade Point Average (SGPA)</p></td>
                        <td><p style="font-size: 14px;text-align:left;">:</p></td>
                        <td><div class = 'div' style="font-size: 14px;display: inherit;text-align:center;">(Sum of credit points secured in a semester)<hr style="margin: 0;border-color:black;" />(Sum of credits taken in the semester)</div></td>
                    </tr>
                    <tr>
                        <td><p style="font-size: 14px;text-align:left;">Minimum SGPA for the Successful Completion of Semester</p></td>
                        <td><p style="font-size: 14px;text-align:left;">:</p></td>
                        <td><p style="font-size: 14px;text-align:left;">{{student.minimumPass}}</p></td>
                    </tr>
                    <tr>
                        <td><p style="font-size: 14px;text-align:left;">Minimum CGPA for the Successful Completion of a Programme</p></td>
                        <td><p style="font-size: 14px;text-align:left;">:</p></td>
                        <td><p style="font-size: 14px;text-align:left;">{{student.minimumPass}}</p></td>
                    </tr>
                    <tr>
                        <td><p style="font-size: 14px;text-align:left;">Cumulative Grade Point Average (CGPA)</p></td>
                        <td><p style="font-size: 14px;text-align:left;">:</p></td>
                        <td><div class = 'div' style="font-size: 14px;display: inherit;text-align:center;">(SGPA I*S1 + SGPA II*S2 + SGPA III*S3 + SGPA IV*S4)<hr style="margin: 0;border-color:black;" />(S1+S2+S3+S4)</div></td>
                    </tr>
                    <tr>
                        <td><p style="font-size: 14px;text-align:left;">Formula for conversion of Grade into corresponding Percentage</p></td>
                        <td><p style="font-size: 14px;text-align:left;">:</p></td>
                        <td><p style="font-size: 14px;text-align:left;">CGPA*{{student.percentageValue}} </p></td>
                    </tr>
                </table>
                <br>
                <br>
                <table >
                    <tr>
                        <td colspan="3">
                            <p style="font-size: 14px;">Credits of Audit Courses are not added for SGPA/CGPA. Audit courses are mandatory for pass and completion of the programme.</p>
                        </td>
                    </tr>
                </table>
                </div>
                {% if data.isStudentSideExamResult %}
                    <table class = "new footer" border="0"  cellpadding="0" cellspacing="0">
                        <tr>
                            <td style="text-align:justify;">
                                <p style="font-size: 14px;margin-bottom:5%;">Disclaimer: The Office of the Controller of Examinations is not liable for any unintended errors that might be present in this system-generated document. The details published are for the immediate information of the candidate and cannot be treated as the original document. Only the hard copy of the Consolidated Grade Sheet issued by the College with the proper seal and signature should be considered as authentic and final.</p>
                            </td>
                            
                        </tr>						
                    </table>
                {% endif %}
            </div>
            
        </div>
    </div>
{% endfor %}
