<style type="text/css">

        @page {
            margin: 20px;

        }

        table.table-bordered{
        border:1px solid blue;
        margin-top:20px;
        font-family: Arial;
    }

.table-bordered > tbody > tr > td,
.table-bordered > tbody > tr > th,
.table-bordered > tfoot > tr > td,
.table-bordered > tfoot > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > thead > tr > th {
    border: 1px solid black;
}


</style>

{{ dump(aprendices[0].dias)}}

{% set columns = aprendices[0]|first %}

<table role="grid">
  <thead>
    <tr>
      <!--th scope="col">#</th>-->
{% for title in columns|keys %}
      <th scope="col">{{ title }}</th>
{% endfor %}
    </tr>
  </thead>
  <tbody>
{% for row in aprendices[0] %}
    <tr>
      <!--<th scope="row">1</th>-->
{% for cell in row %}
      <td>{{ cell }}</td>
{% endfor %}
    </tr>
{% endfor %}
  </tbody>
</table>  

<title>SIRCOnet</title>
<table align="center" width="100%" cellspacing="0" cellpadding="0"  style="font-size: 20px;">
<tr><td  align="center" width="50%" border="0"><img src="{{ constant('URLROOTP') }}/images/hd_inces.jpg" width="150" height="40" alt="" /></td><td  align="center" width="50%"><img src="{{ constant('URLROOTP') }}/images/00123456.jpg" width="250" height="60" /></td></tr>
</table>

<table align="center" width="100%" cellspacing="0" cellpadding="0" style="font-size: 15px;font-family: Arial, Helvetica, sans-serif;font-weight:bold;">
<tr><td align="center">ASISTENCIA DE LOS APRENDICES EN LA EMPRESA:&nbsp;{{ codemp.razon }}<br>MES: {{ codemp.mes }} / A&Ntilde;O: {{ codemp.anho }}<br><br></td></tr>
</table>

<table align="center" style="font-size: 12px;font-family: Arial, Helvetica, sans-serif;" bgcolor="#BDBDBD" width="100%" cellpadding="0" cellspacing="0" border="1" bordercolor="#9393FF">
  <tr>
   <td width='10%' align='center' bgcolor="#FFFF00"><b>LEYENDA</b></td>
   <td width='15%' align='center'><b>A: Asistencia</b></td>
    <td width='15%' align='center'><b>I: Inasistencia</b></td>
    <td width='15%' align='center'><b>J: Inasistencia Justificada</b></td>
    <td width='15%' align='center'><b>R: Retardo</b></td>
    <td width='15%' align='center'><b>P: Permiso</b></td>
    <td width='15%' align='center'><b>O: Reposo</b></td>
  </tr>
</table>

<table style="font-size: 11px;font-family: Arial, Helvetica, sans-serif;" class="table table-bordered" width="100%" cellpadding="0" cellspacing="0" border="1" bordercolor="#9393FF">

<tr  style="background-color: #BBBBBB;color:#000000;">
<th width="2%" align="center">No.</th>
<th width="5%" align="center">C&eacute;dula</th>
<th width="20%" align="center">Aprendices</th>
{% for i in 1..codemp.dias %}
<th width="1.5%" align="center">{{ i }}</th>
{% endfor %}
<th width="5%" align="center">Hrs. Trab.</th>
</tr>

{% set nn=0 %}
{% for educado in aprendices %}
{% set nn=nn+1 %}
    <tr>
      <td align="center">{{ nn }}</td>
      <td align="center">{{ educado.cedula }}</td>
      <td align="center">{{ educado.aprendiz }}
            {% if educado.estatus=='ACTIVO' %}
        <!--    <span style="background-color: #C9E4AF;color:#FFFFFF;">{{ educado.estatus }}</span>     -->
            {% else %}
            <span style="background-color: #FF8A8A;color:#000000;padding:2px;font-weight:bold;"><br>{{ educado.estatus }}&nbsp;{{ educado.f_tag| date('d/m/Y') }}</span>
            {% endif %}
      </td>

<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d1) }}'>{{ educado.dias.d1 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d2) }}'>{{ educado.dias.d2 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d3) }}'>{{ educado.dias.d3 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d4) }}'>{{ educado.dias.d4 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d5) }}'>{{ educado.dias.d5 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d6) }}'>{{ educado.dias.d6 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d7) }}'>{{ educado.dias.d7 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d8) }}'>{{ educado.dias.d8 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d9) }}'>{{ educado.dias.d9 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d10) }}'>{{ educado.dias.d10 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d11) }}'>{{ educado.dias.d11 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d12) }}'>{{ educado.dias.d12 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d13) }}'>{{ educado.dias.d13 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d14) }}'>{{ educado.dias.d14 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d15) }}'>{{ educado.dias.d15 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d16) }}'>{{ educado.dias.d16 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d17) }}'>{{ educado.dias.d17 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d18) }}'>{{ educado.dias.d18 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d19) }}'>{{ educado.dias.d19 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d20) }}'>{{ educado.dias.d20 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d21) }}'>{{ educado.dias.d21 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d22) }}'>{{ educado.dias.d22 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d23) }}'>{{ educado.dias.d23 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d24) }}'>{{ educado.dias.d24 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d25) }}'>{{ educado.dias.d25 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d26) }}'>{{ educado.dias.d26 }}</td>
<td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d27) }}'>{{ educado.dias.d27 }}</td>
<!--<td width="1.5%"  align="center">{{ educado.dias.d28 }}</td>
<td width="1.5%"  align="center">{{ educado.dias.d29 }}</td>
<td width="1.5%"  align="center">{{ educado.dias.d30 }}</td>
<td width="1.5%"  align="center">{{ educado.dias.d31 }}</td>-->
{% for i in 28..codemp.dias %}
        {% if i==28 %}
        <td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d28) }}'>{{ educado.dias.d28 }}</td>
        {% endif %}
        {% if i==29 %}
        <td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d29) }}'>{{ educado.dias.d29 }}</td>
        {% endif %}
        {% if i==30 %}
        <td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d30) }}'>{{ educado.dias.d30 }}</td>
        {% endif %}
        {% if i==31 %}
        <td width="1.5%"  align="center" bgcolor='{{ _self.color(educado.dias.d31) }}'>{{ educado.dias.d31 }}</td>
        {% endif %}
{% endfor %}

{% set hrs=0 %}
{% for i in 1..codemp.dias %}

{% set horas=educado.dias.d~i %}

{% set hrs=hrs+horas %}

{% endfor %}


<td width="5%" align="center"> {{ hrs }} </td>
</tr>

{% endfor %}
    <tr  style="background-color: #BBBBBB;color:#000000;">
    <th align="center">No.</th>
    <th align="center">C&eacute;dula</th>
    <th align="center">Aprendices</th>
{% for i in 1..codemp.dias %}
<th>{{ i }}</th>
{% endfor %}
<th width="5%" align="center">Hrs. Trab.</th>
  </tr>

</table>

    {% macro color(valor) %}
    {% if valor=="F" %}
    {{ '#DDDDDD' }}
    {% elseif valor=="O" %}
    {{ '#FF0000' }}
    {% elseif valor=="I" %}
    {{ '#FF8C8C' }}
    {% elseif valor=="J" %}
    {{ '#FFFF66' }}
    {% elseif valor=="R" %}
    {{ '#A1D0E8' }}
    {% elseif valor=="P" %}
    {{ '#66FF99' }}
    {% elseif valor=="A" %}
    {{ '#FFFFFF' }}
    {% elseif valor=="" %}
    {{ '#FFFFFF' }}
    {% endif %}
    {% endmacro %}
