{# Template For UG Students In MIC  #}
<style>
     td, th { padding: 5px; }
     body{
        font-family: \"Times New Roman\", Times, serif; 
    }
     @media print {
        #printBtnDiv { display : none !important; }
    }
	.primary-table {
		border-collapse: collapse !important;
		page-break-inside: auto;
		width: 100% !important;
	}

	.primary-table th {
		text-align: center;
		background: none !important;
		height: 4mm !important;
		border: 1px solid #000 !important;
		padding: 1mm !important;
	}
	.primary-table td {
		padding: 3px;
		line-height: 20px !important;
		height: 4mm !important;
		border: 1px solid #000;
		text-align: center;
		vertical-align: middle !important;
	}
	#subjectHeader {
		width: 100% !important;
	}
	#subjectHeader td {
		padding: 2mm;
		line-height: 15px !important;
		height: 4mm !important;
		vertical-align: middle !important;
		text-align: center !important;
	}
	.no-border {
		border-left: 1px solid #fff !important;
		border-right: 1px solid #fff !important;
		border-top: 1px solid #fff !important;
        border-bottom: 1px solid #fff !important;
	}
    .college-header {
		height: 35mm;
		width: auto;
		margin: 0 10%;
	}
    .text-left{
        text-align:left!important;
    }
    .text-center{
        text-align:center!important;
    }
    .text-right{
        text-align:right!important;
    }
    .p-t-20{
        padding-top:10px!important;
    }
	.p-t-50{
        padding-top:50px!important;
    }
	
    .p-b-10p-b-10{
        padding-bottom:10px!important;
    }
    .p-20{
        padding:20px!important;
    }
    .outer-border {
        border: 1px solid black;
        border-collapse: collapse;
    }
    .center {
        margin-left: auto;
        margin-right: auto;
    }
    .abbr-table td{
        padding: 2mm 10mm 2mm 10mm;
		line-height: 14px !important;
		margin-top:5mm;
    }
	.tabular-table {
		border-collapse: collapse !important;
		page-break-inside: auto;
		page-break-before:always;
		width: 100% !important;
	}

	.tabular-table th {
		text-align: center;
		background: none !important;
		height: 3mm !important;
		/* border: 1px solid #000 !important; */
		padding: 1mm !important;
		font-size:13px !important;
	}
	.tabular-table-border{
		border: 1px solid #000 !important;
	}
	.tabular-table td {
		padding: 2px;
		line-height: 16px !important;
		height: 4mm !important;
		border: 1px solid #000;
		text-align: center;
		vertical-align: middle !important;
		/* page-break-after:always; */
	}
	.tabular-table tr{
		/* page-break-after:always; */
		height: 6mm !important;
	}
	.small-font{
		font-weight: normal !important;
		font-size: 15px !important;
	}
	.failed{
		background-color:#c0c0c0 !important;
	}
    
</style>
    <div class="page" style="width:100%;">
    
{# start tabulation register #}
    <table id="subjectHeader" style="page-break-before: always">
         <tr style="padding-top:300px!important">
            <td><img src="{{data.collegeData.collegeHeader}}" class="college-header"></td>
        </tr> 
        <tr>
            <td><b style="font-size: 18px;">Tabulation Sheet</br></td>
        </tr>
        <tr>
            <td><b style="font-size: 18px;">{{data.examRegistrationData.name}}</br></td>
        </tr>
    </table>
    <table style="width:100%!important;">
        <tr>
            <th data-f-bold='true' class="text-left">Semester : {{data.examRegistrationData.semInSemNumber | raw}}</th>
            <th data-f-bold='true' class="text-right">&nbsp;</th>
        </tr>
        <tr>
            <th data-f-bold='true' class="text-left">Programme : {{data.examRegistrationData.programName| raw}}</th>
            <th data-f-bold='true' class="text-right">&nbsp;</th>
        </tr>
        <tr>
            <th data-f-bold='true' class="text-left">Month and Year :  {{data.examRegistrationData.examMonthName}} {{data.examRegistrationData.examYear}} </th>
            <th data-f-bold='true' class="text-right">Date : {{ "now" | date("d.m.Y") }}</th>
        </tr>
        
    </table>
    {% set updatedPaperSubjectIds = [] %}
    {% for subjectGroups in data.examRegistrationData.subjectGroups %}
        {% if loop.last %}
            {% set finalLoop = 1%}
        {%else%}
            {% set finalLoop = 0%}
        {% endif %}
        {% if loop.first %}
            <table class="tabular-table" id="tabulationRegisterReportExcel" style="width:100%!important; page-break-before: avoid !important">
        {%else%}
            <table class="tabular-table" id="tabulationRegisterReportExcel" style="width:100%!important;">
        {% endif %}
            <thead>
                <tr>
                    <th data-f-bold='true' class="tabular-table-border" style="width:2%; font-weight:bold;" rowspan="7">Register No</th>
                    <th data-f-bold='true' class="tabular-table-border" style="width:3%; font-weight:bold;" rowspan="7">Name</th>
                    {% set haslang = 0 %}
                    <!--tag3-->
                    {% for subject in subjectGroups %}
                        <th data-f-bold='true' class="tabular-table-border text-center" colspan="{{subject.isGrouped == true ? 22 : 21}}" style="width:20%; font-weight:bold;">
                        {% if subject.isGrouped == true %}{%else%} {{subject.code | raw}} {% endif %}
                        </th> 
                    {% endfor %}
                    {% if finalLoop == 1 %}
                        <th data-f-bold='true' class="tabular-table-border text-center" style="width:2%; font-weight:bold;" rowspan="7">Total Credit</th>
                        <th data-f-bold='true' class="tabular-table-border text-center" style="width:2%; font-weight:bold;" rowspan="7">Total CP</th>
                        <th data-f-bold='true' class="tabular-table-border text-center" style="width:2%; font-weight:bold;" rowspan="7">SGPA </th>
                        {% if data.displayContentOptions.isShowSemesterGrade %}
                         <th data-f-bold='true' class="tabular-table-border text-center" style="width:2%; font-weight:bold;" rowspan="7">Grade </th>
                        {% endif %}
                        <th data-f-bold='true' class="tabular-table-border text-center" style="width:1%; font-weight:bold;" rowspan="7">Result </th>
                    {% endif %}
                </tr>
                 <tr>
                    {% for subject in subjectGroups %}
                        <th data-f-bold='true' class="tabular-table-border text-center" colspan="{{subject.isGrouped == true ? 22 : 21}}" style="width:20%; font-weight:bold;">
                        {% if subject.isGrouped == true %}{{subject.paperName |raw}}{%else%} {{subject.name | raw}} {% endif %}
                        </th> 
                    {% endfor %}
                </tr>
                 <tr>
                    {% for subject in subjectGroups %}
                        <th data-f-bold='true' class="tabular-table-border text-center" colspan="{{subject.isGrouped == true ? 22 : 21}}" style="width:20%; font-weight:bold;">
                        {{subject.subjectTypeName | raw}} 
                        </th> 
                    {% endfor %}
                </tr>
                <tr>
                    {% for subject in subjectGroups %}
                        {% if subject.isGrouped == true %}  <th data-f-bold='true' class="tabular-table-border text-center" style="width:1%; font-weight:bold;" rowspan="3">Course Code</th> {% endif %}
                        <th data-f-bold='true' class="tabular-table-border text-center" colspan="7" style="width:20%; font-weight:bold;">Theory</th>
                        <th data-f-bold='true' class="tabular-table-border text-center" colspan="7" style="width:20%; font-weight:bold;">Practical</th>
                        <th data-f-bold='true' class="tabular-table-border text-center" colspan="2" style="width:20%; font-weight:bold;">Grand Total</th>
                        <th rowspan="3" data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Grade</text></svg>
                        </th>
                        <th rowspan="3" data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Grade Point</text></svg>
                        </th>
                        <th rowspan="3" data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Accured Credit</text></svg>
                        </th>
                        <th rowspan="3" data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Credit Point</text></svg>
                        </th>
                        <th rowspan="3" data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Result</text></svg>
                        </th>
                    {% endfor %} 
                </tr>
                <tr>
                    {% for subject in subjectGroups %}
                        <th rowspan="2" data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Credit</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center" style="width:1%; font-weight:bold;" colspan="2">CCA</th>
                        <th data-f-bold='true' class="tabular-table-border text-center" style="width:1%; font-weight:bold;" colspan="2">ESE</th>
                        <th data-f-bold='true' class="tabular-table-border text-center" style="width:1%; font-weight:bold;" colspan="2">Total</th>

                        <th rowspan="2" data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Credit</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center" style="width:1%; font-weight:bold;" colspan="2">CCA</th>
                        <th data-f-bold='true' class="tabular-table-border text-center" style="width:1%; font-weight:bold;" colspan="2">ESE</th>
                        <th data-f-bold='true' class="tabular-table-border text-center" style="width:1%; font-weight:bold;" colspan="2">Total</th>

                         <th data-f-bold='true' rowspan='2' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Awarded</text></svg>
                        </th>
                        <th data-f-bold='true' rowspan='2' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Maximum</text></svg>
                        </th>
                    {% endfor %} 
                </tr>
                <tr>
                    {% for subject in subjectGroups %}
                        <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Awarded</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Maximum</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Awarded</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Maximum</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Awarded</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Maximum</text></svg>
                        </th>

                         <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Awarded</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Maximum</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Awarded</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Maximum</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Awarded</text></svg>
                        </th>
                        <th data-f-bold='true' class="tabular-table-border text-center"  data-a-h='center' data-a-v='middle'>
                            <svg width="40" height="120"><text x="20" y="115" transform="rotate(-90, 20, 115)"  text-anchor="start" font-weight="bold">Maximum</text></svg>
                        </th>
                   
                    {% endfor %} 
                </tr>
            <!--tag1-->
            </thead>
            <!--tag1-->
            <!--tag1-->
                {% set slno = 0 %}
                {% for student in data.studentData %}
                    <tr>
                    <!--tag2-->
                        {% set academicTerm = student.academicTerms |first %}
                        {% set slno = slno + 1 %}
                        <td class="text-center tabular-table-border">{{student.registerNo}}</td>
                        <td class="text-left tabular-table-border" style="font-size:13px !important"><div style='width:160px'>{{student.name}}</div></td>
                        {% set langcount = 0 %}
                        {% set displayHeadCount = 0 %}
                        {% set displayHeadTag3Display = displayHeadCount %}
                    <!--tag3-->
                        {% for subject in subjectGroups %}
                            {% set isEntered = false %}
                            {% set isEnteredGroup = false %}
                            {% for studentSubject in academicTerm.subjects %}
                                {% if studentSubject.id in subject.academicPaperSubjectIds and isEnteredGroup == false %}
                                    {% set subjectKey = studentSubject.id ~ '-' ~ student.id %}
                                    {% if subjectKey not in updatedPaperSubjectIds %}
                                        {% set updatedPaperSubjectIds = updatedPaperSubjectIds|merge([subjectKey]) %}
                                        <!--subject_tag-->
                                        {% set displayHeadCount = displayHeadCount + 1 %}
                                            {% if subject.isGrouped == true %} <td class="tabular-table-border text-center">{{studentSubject.parentCode ? studentSubject.parentCode : studentSubject.code}}</td> {% endif %}

                                            {% if studentSubject.subCourse['THEORY'] %}
                                                {% set currentSubject = studentSubject.subCourse['THEORY'] %}
                                                <td class="text-center ">{{ currentSubject.credit}}</td>
                                                {% if studentSubject.isInternal %}
                                                    <td class="text-center ">{{ currentSubject.internalMark}}</td>
                                                    <td class="text-center ">{{ currentSubject.internalMaxMark}}</td>
                                                {% else %}
                                                    <td class="text-center ">-</td>
                                                    <td class="text-center ">-</td>
                                                {% endif %}
                                                {% if studentSubject.isExternal %}
                                                    <td class="text-center  noborder-r-0">
                                                        {% if currentSubject.attendanceStatus == "PRESENT" %}
                                                            {{  currentSubject.externalMark}}
                                                        {% elseif currentSubject.attendanceStatus == "MALPRACTICE" %}
                                                            <span style="color:red;">MP </span> 
                                                        {% elseif currentSubject.attendanceStatus == "ABSENT" %}
                                                            <span style="color:red;"> AB </span> 
                                                        {% else %}
                                                            -
                                                        {% endif %}
                                                    </td>
                                                    <td class="text-center ">{{ currentSubject.externalMaxMark}}</td>
                                                {% else %}
                                                    <td class="text-center ">-</td>
                                                    <td class="text-center ">-</td>
                                                {% endif %}
                                                <td class="text-center {{currentSubject.failedStatus == 'FAILED' ? 'failed' : ''}}">{{  currentSubject.failedStatus == 'FAILED' ? '-' :currentSubject.markObtainedInDecimal}}</td>
                                                <td class="text-center ">{{ currentSubject.totalMarks}}</td>
                                            {% else %}
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                            {% endif %}

                                            {% if studentSubject.subCourse['PRACTICAL'] %}
                                                {% set currentSubject = studentSubject.subCourse['PRACTICAL'] %}
                                                <td class="text-center ">{{ currentSubject.credit}}</td>
                                                {% if studentSubject.isInternal %}
                                                    <td class="text-center ">{{ currentSubject.internalMark}}</td>
                                                    <td class="text-center ">{{ currentSubject.internalMaxMark}}</td>
                                                {% else %}
                                                    <td class="text-center ">-</td>
                                                    <td class="text-center ">-</td>
                                                {% endif %}
                                                {% if studentSubject.isExternal %}
                                                    <td class="text-center  noborder-r-0">
                                                        {% if currentSubject.attendanceStatus == "PRESENT" %}
                                                            {{  currentSubject.externalMark}}
                                                        {% elseif currentSubject.attendanceStatus == "MALPRACTICE" %}
                                                            <span style="color:red;">MP </span> 
                                                        {% elseif currentSubject.attendanceStatus == "ABSENT" %}
                                                            <span style="color:red;"> AB </span> 
                                                        {% else %}
                                                            -
                                                        {% endif %}
                                                    </td>
                                                    <td class="text-center ">{{ currentSubject.externalMaxMark}}</td>
                                                {% else %}
                                                    <td class="text-center ">-</td>
                                                    <td class="text-center ">-</td>
                                                {% endif %}
                                                <td class="text-center {{currentSubject.failedStatus == 'FAILED' ? 'failed' : ''}}">{{ currentSubject.failedStatus == 'FAILED' ? '-' : currentSubject.markObtainedInDecimal}}</td>
                                                <td class="text-center ">{{ currentSubject.totalMarks}}</td>
                                            {% else %}
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                                <td class="text-center ">&#952;</td>
                                            {% endif %}
                                            <td class="tabular-table-border text-center">{{studentSubject.failedStatus == 'FAILED' ? '-' : studentSubject.markObtainedCombined}}</td>
                                            <td class="tabular-table-border text-center">{{studentSubject.totalMarksCombined}}</td>
                                            <td class="tabular-table-border text-center">{{studentSubject.grade}}</td>
                                            <td class="tabular-table-border text-center">{{studentSubject.failedStatus == 'FAILED' ? '-' : studentSubject.gradePoint}}</td>
                                            <td class="tabular-table-border text-center">{{studentSubject.failedStatus == 'FAILED' ? '-' : studentSubject.credit}}</td>
                                            <td class="tabular-table-border text-center">{{studentSubject.failedStatus == 'FAILED' ? '-' : studentSubject.creditGradePoint}}</td>
                                            <td class="tabular-table-border text-center {{studentSubject.failedStatus == 'FAILED' ? 'failed' : ''}}">{{studentSubject.failedStatus == 'FAILED' ? 'Fail' : 'Pass'}}</td>
                                   
                                        {% set isEnteredGroup = true %}
                                        {% set isEntered = true %}
                                    {% endif %}
                                {% endif %}
                            {% endfor %}
                            {% if isEntered == false %}
                                <!--subject_tag-->
                                {% if subject.isGrouped == true %} <td class="tabular-table-border text-center"></td> {% endif %}
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                                <td class="tabular-table-border text-center"></td>
                            {% endif %}
                            {% if displayHeadCount  is divisible by(4) and  displayHeadTag3Display != displayHeadCount %}
                            <!--tag3--> {% set displayHeadTag3Display = displayHeadCount %} 
                            {% endif %}
                        {% endfor %}
                        {% if finalLoop == 1 %}
                            <td class="tabular-table-border text-center">{{academicTerm.semesterCredit}}</td>
                            <td class="tabular-table-border text-center">{{academicTerm.failedStatus == 'PASSED' ? academicTerm.semesterCreditGradePoint : '-'}}</td>
                            <td class="tabular-table-border text-center">{{academicTerm.failedStatus == 'PASSED' ?  academicTerm.semesterSgpa|number_format(student.roundOff, '.') : '-' }}</td>
                            {% if data.displayContentOptions.isShowSemesterGrade %}
                             <td class="tabular-table-border text-center">{{academicTerm.failedStatus == 'PASSED' ?  academicTerm.semesterGrade : '-' }}</td>
                            {% endif %}
                            <td class="tabular-table-border text-center">{{academicTerm.failedStatus == 'PASSED' ?  "PASSED" : "FAILED" }}</td>
                        {% endif %}
                <!--tag2-->
                    </tr>
                {% endfor %} 
            <!--tag1-->
        </table>
    {% endfor %}
    </br></br>
    <table style="width:100%!important; page-break:before: avoid !important">
        <tr>
            <td colspan="100" class="no-border p-t-50" style="font-weight: bold !important; padding-top:85px !important">
                <span style="float:left!important; width:15%">&nbsp;</span>
                <span style="float:left!important; width:25%"></span>
                <span style="float:center!important; width:30%">Controller of Examinations</span>
                <span style="float:right!important; width:30%">Principal</span>
            </td>
        </tr>
    </table>
<!--tag1-->
</div>
