<?php echo $__env->yieldContent('css'); ?>
  <?php echo HTML::script('font-awesome/css/font-awesome.min.css'); ?>

<?php echo $__env->yieldContent('script'); ?>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>

.pagenum:after {}
	/* Margenes del documento PDF en general */
	/*@page  { margin: 0px; }*/

	/* Margenes del contenido */
  body { margin-top: 75px; margin-bottom: 0px; font-family:"Helvetica"; font-size:11px; color: #14213D;  }
	.header { position: fixed; top: 0px; }
  .footer { position: fixed; bottom: 20px;  border-top: 2px solid #E80;}
  .pagenum:before { content: counter(page); }

    h1.top-title { color: #006868; margin: 0px; font-size:1.2em; }
    h2.top-title { color: #640273; margin: 0px; font-size:1.2em;}


    .titulo               { font-size:1.1em;  }
    .titulo .cuadro       { color: #000; font-size:1.2em; text-align: center; }
    .subtitulo            {  font-size:1.0em;  }
    .detalles thead       { background: #E80; color: #FFF; }
    .detalles tbody tr td               { border-bottom:1px solid #DDD; text-align: left; }
    .detalles tbody tr td:nth-child(5) { text-align: right; }
    .detalles tbody tr td:nth-child(1) { text-align: center; }
    .totales                            { border-top:1px solid #E80; font-size:1.1em;}
    .gran-total                         { font-size:1.5em;  }
    .gran-total td,
    .gran-total th                      { border-top:1px solid #E80; }
    
    table.tabla-calificaciones { border-collapse: collapse; font-size:0.9em; }
    table.tabla-calificaciones td,
    table.tabla-calificaciones th { border: 1px solid #000; padding:5px; }
    
    table.tabla-calificaciones tfoot td,
    table.tabla-calificaciones tfoot th { border: none;   }
</style>

<div class="header">
	<table width="100%" cellpadding=0 cellspacing=0 border=0>
		<tr>
			<td align="center">
        <img  width="70px" src="img/logo.png">
			</td>
      <td align="left" width="85%">
        <table width="100%" class="titulo">
          <tr>
            <td valign="bottom"  class="cuadro"><strong>KARDEX DEL ALUMNO</strong></td>
          </tr>
          <tr>
            <td valign="bottom" align="center"  class="subtitulo"><strong><?php echo $alumno->inscripcion->grupo->planEstudios->Nombre; ?></strong></td>
          </tr>
          
        </table>
      </td>
		</tr>
	</table>
</div>
<br>
<br>
<br>



<table width="100%" class="tabla-calificaciones">
  <tr>
    <td width="1%"><strong>ALUMNO:</strong></td>
    <td><?php echo $alumno->Nombre; ?> <?php echo $alumno->Paterno; ?> <?php echo $alumno->Materno; ?></td>
    <td width="1%"><strong>MATRÍCULA:</strong></td>
    <td><?php echo $alumno->Matricula; ?></td>
  </tr>
  <tr>
    <td width="1%"><strong>CURP:</strong></td>
    <td><?php echo $alumno->CURP; ?></td>
    <td width="1%"><strong>FEC. NAC.:</strong></td>
    <td><?php echo $alumno->FechaNacimiento; ?></td>
  </tr>
  <tr>
    <td width="1%"><strong>DOMICILIO:</strong></td>
    <td colspan="3"><?php echo $alumno->Direccion; ?>, <?php echo $alumno->Colonia; ?>,  <?php echo $alumno->municipio->Nombre; ?>,  <?php echo $alumno->estado->Nombre; ?>, C.P. <?php echo $alumno->CP; ?>.</td>
  </tr>
  <tr>
    <td width="1%"><strong>TEL. CASA:</strong></td>
    <td><?php echo $alumno->TelefonoCasa; ?></td>
    <td width="1%"><strong>CELULAR :</strong></td>
    <td><?php echo $alumno->TelefonoCelular; ?></td>
  </tr>
  
</table>

<br><br>
<?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="tabla-calificaciones"  width="100%" >
      <thead>
        <tr >
          <th style="text-align:center"  width="25px">Sem</th><th>Asignatura</th>
          <th  style="text-align:center" width="25px">P1</th><th  style="text-align:center" width="25px">IN1</th>
          <th  style="text-align:center" width="25px">P2</th><th  style="text-align:center" width="25px">IN2</th>
          <th  style="text-align:center" width="25px">P3</th><th  style="text-align:center" width="25px">IN3</th>
          <th  style="text-align:center" width="25px">EF</th><th  style="text-align:center" width="25px">CF</th>
          <th  style="text-align:center" width="25px">INT</th><th  style="text-align:center" width="25px">EX</th>
          <th  style="text-align:center" width="25px">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="tabla-calificaciones">
        <thead>
          <tr >
          <th style="text-align:center"  width="25px">Sem</th><th>Asignatura</th>
          <th  style="text-align:center" width="25px">P1</th><th  style="text-align:center" width="25px">IN1</th>
          <th  style="text-align:center" width="25px">P2</th><th  style="text-align:center" width="25px">IN2</th>
          <th  style="text-align:center" width="25px">P3</th><th  style="text-align:center" width="25px">IN3</th>
          <th  style="text-align:center" width="25px">EF</th><th  style="text-align:center" width="25px">CF</th>
          <th  style="text-align:center" width="25px">INT</th><th  style="text-align:center" width="25px">EX</th>
          <th  style="text-align:center" width="25px">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>
    <br>
    <hr>
    <table width="100%" >
    <tr><th style="text-align:right;padding:5px">Promedio General</th><th width="25px" style="text-align:center;padding:5px"><?php echo number_format($promedio_general_acumulado / $contador_semestres,2); ?></th><th width="105px">&nbsp;</th></tr>
    </table>
    <?php else: ?>            
    <?php foreach($calificaciones as $calificacion): ?>
      <?php if($puntero == null): ?>
      <table class="tabla-calificaciones" width="100%" >
      <thead><tr><th style="text-align:center" width="25px">Sem</th><th>Asignatura</th><th style="text-align:center" width="60px">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="tabla-calificaciones" width="100%" >
        <thead><tr><th style="text-align:center" width="25px">Sem</th><th>Asignatura</th><th style="text-align:center" width="60px">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>
    <br>
    <hr>
    <table  width="100%">
    <tr><th style="text-align:right;padding:5px">Promedio General</th><th width="60px" style="text-align:center;padding:5px"><?php echo number_format($promedio_general_acumulado / $contador_semestres,2); ?></th></tr>
    </table>
    <?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>
  <?php else: ?>
  <div class="panel-body" style="text-align:center">
    No hay Calificaciones
  </div>
  <?php endif; ?>

<br><br><br>
<table width="100%" style="text-align:center;" border="0">
  <tr>
    <td width="30%"></td>
    <td width="40%" height="70px" style="border-bottom:1px solid #000;">&nbsp;</td>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td >Firma del Coordinador Académico</td>
    <td></td>
  </tr>
  

  <tr><td style="height:30px; color:red; " colspan="3"><b>NOTA:</b> La presente será válida solo si cuenta con la firma y sello de la institución.</td></tr>
</table>
