<?php $__env->startSection('title-page'); ?> Calificaciones <?php $__env->stopSection(); ?>



<?php $__env->startSection('aside'); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="row">
  <div class="col-md-12">
    <div class="panel panel-default " id="datagrid-modulo" data-edit-row="editar">
      <div class="panel-heading"> <h3><i class="fa fa-mortar-board"></i> Calificaciones</h3> </div>
      <?php if($alumno->inscripcion != null): ?>
      <div class="panel-body " style="text-align:center">
        <h4><?php echo $alumno->inscripcion->grupo->planEstudios->Nombre; ?></h4>
      </div>
      <?php else: ?>
      <div class="panel-body " style="text-align:center">
        <h4>No tiene inscripciones disponibles</h4>
      </div>
      <?php endif; ?>
      <?php if(count($calificaciones) > 0): ?>
      <?php
        $puntero = null;
        $promedio_acumulado = 0;
        $contador_materias = 0;
        $promedio_general_acumulado = 0;
        $contador_semestres = 0;
       ?>
       <?php if($alumno->inscripcion->CveNivel == 1 ): ?>
        <?php foreach($calificaciones as $calificacion): ?>
          <?php if($puntero == null): ?>
          <table class="table">
          <thead>
            <tr >
              <th style="text-align:center">Semestre</th><th>Asignatura</th>
              <th  style="text-align:center" width="45px">P1</th><th  style="text-align:center" width="45px">IN1</th>
              <th  style="text-align:center" width="45px">P2</th><th  style="text-align:center" width="45px">IN2</th>
              <th  style="text-align:center" width="45px">P3</th><th  style="text-align:center" width="45px">IN3</th>
              <th  style="text-align:center" width="45px">EF</th><th  style="text-align:center" width="45px">CF</th>
              <th  style="text-align:center" width="45px">INT</th><th  style="text-align:center" width="45px">EX</th>
              <th  style="text-align:center" width="45px">ATS</th>
            </tr>
          </thead>
          <tbody>
          <?php endif; ?>
          <?php if($puntero != $calificacion->Semestre && $puntero != null): ?>
            <?php
              $puntero = $calificacion->Semestre;
              $promedio = $promedio_acumulado / $contador_materias;
              $promedio_acumulado = 0;
              $contador_materias = 0;
              $contador_semestres++;
              $promedio_general_acumulado += $promedio;
              ?>
            <tfoot>
              <tr>
              <th colspan="9" style="text-align:right">Promedio Semestral</th>
              <th><?php echo number_format($promedio,2); ?></th> 
              <th colspan="3"></th>                  
            </tr>
            </tfoot>
            
            </tbody>
            </table>
            <br>
            <table class="table">
            <thead>
              <tr >
              <th style="text-align:center">Semestre</th><th>Asignatura</th>
              <th  style="text-align:center" width="45px">P1</th><th  style="text-align:center" width="45px">IN1</th>
              <th  style="text-align:center" width="45px">P2</th><th  style="text-align:center" width="45px">IN2</th>
              <th  style="text-align:center" width="45px">P3</th><th  style="text-align:center" width="45px">IN3</th>
              <th  style="text-align:center" width="45px">EF</th><th  style="text-align:center" width="45px">CF</th>
              <th  style="text-align:center" width="45px">INT</th><th  style="text-align:center" width="45px">EX</th>
              <th  style="text-align:center" width="45px">ATS</th>
            </tr>
            </thead>
            <tbody>
          <?php endif; ?>
            <?php
              $promedio_acumulado += $calificacion->Calificacion;
              $puntero = $calificacion->Semestre;
              $contador_materias++;
          ?>
          <tr align="center">
            <td><?php echo $calificacion->Semestre; ?></td>
            <td align="left"><?php echo $calificacion->Asignatura; ?></td>
            <td><?php echo $calificacion->ParcialUno; ?></td>
            <td><?php echo $calificacion->InasistenciasUno; ?></td>
            <td><?php echo $calificacion->ParcialDos; ?></td>
            <td><?php echo $calificacion->InasistenciasDos; ?></td>
            <td><?php echo $calificacion->ParcialTres; ?></td>
            <td><?php echo $calificacion->InasistenciasTres; ?></td>
            <td><?php echo $calificacion->ExamenFinal; ?></td>
            <?php if($calificacion->Estatus == 4): ?>
            <td><strong>NP</strong></td>
            <?php else: ?>
            <td><?php echo $calificacion->Calificacion; ?></td>
            <?php endif; ?>
            <td><?php echo $calificacion->InasistenciasUno + $calificacion->InasistenciasDos + $calificacion->InasistenciasTres; ?></td>
            <td><?php echo $calificacion->ExtraOrdinario; ?></td>
            <td><?php echo $calificacion->AtituloDeSuficiencia; ?></td>
          </tr>
        <?php endforeach; ?>
        <?php 
          
          $promedio = $promedio_acumulado / $contador_materias;
          
           $contador_semestres++;
           $promedio_general_acumulado += $promedio; 
          ?>
        <tfoot>
          <tr>
          <th colspan="9" style="text-align:right">Promedio Semestral</th>
          <th><?php echo number_format($promedio,2); ?></th>  
          <th colspan="3"></th>                
        </tr>
        </tfoot></tbody></table>
        <hr>
        <table class="table" style="font-size:1.2em">
        <tr><th style="text-align:right">Promedio General</th><th width="45px" style="text-align:center"><?php echo number_format($promedio_general_acumulado / $contador_semestres,2); ?></th><th width="135px"></th></tr>
        </table>
        <hr>
       <?php else: ?>            
        <?php foreach($calificaciones as $calificacion): ?>
          <?php if($puntero == null): ?>
          <table class="table">
          <thead><tr><th style="text-align:center">Semestre</th><th>Asignatura</th><th style="text-align:center" width="100px">Calificación</th></tr></thead>
          <tbody>
          <?php endif; ?>
          <?php if($puntero != $calificacion->Semestre && $puntero != null): ?>
            <?php
              $puntero = $calificacion->Semestre;
              $promedio = $promedio_acumulado / $contador_materias;
              $promedio_acumulado = 0;
              $contador_materias = 0;
              $contador_semestres++;
              $promedio_general_acumulado += $promedio;
              ?>
            <tfoot>
              <tr>
              <th colspan="2" style="text-align:right">Promedio Semestral</th>
              <th style="text-align:center"><?php echo number_format($promedio,2); ?></th>                  
            </tr>
            </tfoot>
            
            </tbody>
            </table>
            <br>
            <table class="table">
            <thead><tr><th style="text-align:center">Semestre</th><th>Asignatura</th><th style="text-align:center" width="100px">Calificación</th></tr></thead>
            <tbody>
          <?php endif; ?>
            <?php
              $promedio_acumulado += $calificacion->Calificacion;
              $puntero = $calificacion->Semestre;
              $contador_materias++;
          ?>
        <tr align="center">
          <td><?php echo $calificacion->Semestre; ?></td>
          <td align="left"><?php echo $calificacion->Asignatura; ?></td>
          <?php if($calificacion->Estatus == 4): ?>
          <td><strong>NP</strong></td>
          <?php else: ?>
          <td><?php echo $calificacion->Calificacion; ?></td>
          <?php endif; ?>
        </tr>
        <?php endforeach; ?>
        <?php $promedio = $promedio_acumulado / $contador_materias; ?>
        <tfoot>
          <tr>
          <th colspan="2" style="text-align:right">Promedio Semestral</th>
          <th style="text-align:center"  ><?php echo number_format($promedio,2); ?></th>                  
          </tr>
        </tfoot></tbody></table>
        
        <hr>
        <table class="table" style="font-size:1.2em">
        <tr><th style="text-align:right">Promedio General</th><th width="100px" style="text-align:center"><?php echo number_format($promedio_general_acumulado / $contador_semestres,2); ?></th></tr>
        </table>
        <hr>
       <?php endif; ?>
      
      
      <div class="row">
        <div class="col-md-12">
          <div style="text-align:justify; padding:1em;">
            <h5>Nomenclatura:</h5>
            <p>
              <?php if($alumno->inscripcion->CveNivel == 1): ?>
              <strong>P1</strong> 1° Parcial <strong>P2</strong> 2° Parcial <strong>P3</strong> 3° Parcial <strong>IN1</strong> Inasistencias 1° Parcial <strong>IN2</strong> Inasistencias 2° Parcial <strong>IN3</strong> Inasistencias 3° Parcial
  <strong>EF</strong> Examen Final <strong>CF</strong> Calificacion Final <strong>INT</strong> Inasistencias Totales <strong>EX</strong> Extraordinario <strong>ATS</strong> Atitulo de Suficiencia
              <?php endif; ?>
              <strong>NP</strong> No presentó
            </p>
          </div>
        </div>
      </div>
      
      <div class="panel-footer" style="text-align:center" >
        <div class="col-md-12" >
          <a href="<?php echo URL::to('imprimir-calificaciones'); ?>" target="_blank" class="btn btn-primary" > <i class="fa fa-print"></i> Imprimir boleta</a> <br><br>
        </div>
        <small>
          <i class="fa fa-question-circle"></i> Los datos mostrados son de carácter informativo, para cualquier duda o aclaración, contactar directamente en oficinas.
        </small>
      </div>
      <?php else: ?>
      <div class="panel-body" style="text-align:center">
        No hay Calificaciones
      </div>
      <?php endif; ?>
      
    </div>
  </div>
</div>




<?php $__env->stopSection(); ?>


<?php $__env->startSection('modals'); ?>
@parent
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.Modulo', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>