<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Reporte Trabajadores</title>
</head>
<body>
    <table>
        <thead>
            <tr>
                <th>RUT</th>        
                <th>Nombre</th>

                <th>Nacionalidad</th>
                <th>Fecha de Nacimiento</th>
                <th>Estado Civil</th>
                <th>Dirección</th>
                <th>Email Personal</th>
                <th>Email Empresa</th>
                <th>Teléfono</th>
                <th>Celular</th>
                <th>Celular Empresa</th>
                <th>Tipo de Cuenta</th>
                <th>Banco</th>
                <th>N° de Cuenta</th>

                <th>Titulo</th>
                <th>Nivel</th>
                <th>Cargo</th>
                <th>Sección</th>
                <th>Tipo Contrato</th>                               
                <th>Centro de Costo</th>
                <th>Fecha de Ingreso</th>
                <th>Fecha de Vencimiento</th>
                <th>Sueldo Base</th>
                <th>AFP</th>
                <th>Seguro de Cesantía</th>
                <th>Salud</th>
                <th>Valor Plan Salud (UF)</th>
                <th>Movilización</th>
                <th>Colación</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach($trabajadores as $dato): ?>
                <tr>
                    <td><?php echo $dato['rutFormato']; ?></td>
                    <td><?php echo $dato['nombreCompleto']; ?></td>

                    <td><?php echo $dato['nacionalidad']['nombre']; ?></td>
                    <td><?php echo $dato['fechaNacimiento']? date("d-m-Y", strtotime($dato['fechaNacimiento'])) : ""; ?></td>
                    <td><?php echo $dato['estadoCivil']['nombre']; ?></td>
                    <td><?php echo $dato['direccion']; ?>, <?php echo $dato['comuna']['comuna']; ?></td>

                    <td><?php echo $dato['email']; ?></td>
                    <td><?php echo $dato['emailEmpresa']; ?></td>

                    <td><?php echo $dato['telefono']; ?></td>
                    <td><?php echo $dato['celular']; ?></td>
                    <td><?php echo $dato['celularEmpresa']; ?></td>

                    <td><?php echo $dato['tipoCuenta']['nombre']; ?></td>
                    <td><?php echo $dato['banco']['nombre']; ?></td>
                    <td><?php echo $dato['numeroCuenta']; ?></td>

                    <td><?php echo $dato['titulo']['nombre']; ?></td>
                    <td><?php echo $dato['nivel']['nivel']; ?></td>
                    <td><?php echo $dato['cargo']['nombre']; ?></td>
                    <td><?php echo $dato['seccion']['nombre']; ?></td>
                    <td><?php echo $dato['tipoContrato']['nombre']; ?></td>
                    <td><?php echo $dato['centroCosto']['nombre']; ?></td>
                    <td><?php echo $dato['fechaIngreso']? date("d-m-Y", strtotime($dato['fechaIngreso'])) : ""; ?></td>
                    <td><?php echo $dato['fechaVencimiento']? date("d-m-Y", strtotime($dato['fechaVencimiento'])) : ""; ?></td>
                    <td><?php echo $dato['sueldoBase']; ?></td>
                    <td><?php echo $dato['afp']['nombre']; ?></td>
                    <td><?php echo $dato['seguroDesempleo'] ? 'Sí' : 'No'; ?></td>
                    <td><?php echo $dato['isapre']['nombre']; ?></td>

                    <td><?php echo ($dato['montoIsapre'] && $dato['cotizacionIsapre']!="%" )? $dato['montoIsapre'] : ''; ?></td>
                    <td><?php echo $dato['montoMovilizacion']; ?></td>
                    <td><?php echo $dato['montoColacion']; ?></td>

                </tr>
            <?php endforeach; ?>
        </tbody>        
    </table>
    
</body>
</html>