<%-- 
    Document   : exportarTodoUsuDocente
    Created on : 05/12/2014, 10:07:05 AM
    Author     : sistem16user
--%>


<%@page import="pe.siso.horario.Beans.Docente"%>
<%@page import="pe.siso.horario.Services.DocenteServices"%>
<%@page import="pe.siso.horario.Services.CursoServices"%>
<%@page import="pe.siso.horario.Beans.Horario"%>
<%@page import="java.util.ArrayList"%>
<%@page import="pe.siso.horario.Services.HorarioServices"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%

    HorarioServices servicios = new HorarioServices();
    DocenteServices serviciosDoc = new DocenteServices();
    CursoServices servicios2 = new CursoServices();
    
    String periodo = request.getParameter("periodo");
    String plana = request.getParameter("plana");
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>REPORTE</title>
    </head>
    <body>
         <%
            response.setContentType("application/vnd.ms-excel; ");
            response.setHeader("Content-Disposition","attachment; filename=UsuarioDocente.xls");
            
            String border="style='border:solid 0.5pt #000000;vertical-align:middle;'";
            String borderT="style='border:solid 0.5pt #000000;vertical-align:middle; background-color:#D9D9D9;' ";
            String centrado="style='vertical-align:middle;' ";
            String borderColor="style='border:solid 0.5pt #000000; vertical-align:middle; background-color:#B5E0F5;'";
            String borderColorTitulo="style='border:solid 0.5pt #000000; vertical-align:middle; background-color:#006699; color:#FFFFFF;'";
            String estilo = "";
        %>
        
        
        
            
           
        <table width='100%' cellpadding='0' cellspacing='0'> 
            
        <%
            ArrayList<Docente> codigosDoc = null;
            codigosDoc = serviciosDoc.consultarCodigoDocentesHorario(periodo, plana);
            
            for(int reg=0; reg<codigosDoc.size();reg++){
                String codDocente = codigosDoc.get(reg).getCod_pro();
                System.out.println("Doncente "+reg+" : "+codDocente);
                Docente docente= new Docente();
                Docente docenteDatos= new Docente();
                ArrayList<Horario> lista = null;
                //lista=servicios.horarioDocente(codDocente,periodo);
                lista=servicios.horarioDocenteReducido(codDocente,periodo);

                docente=serviciosDoc.NombreDocente(codDocente);
                String nombreDocente = docente.ape_pro+", "+docente.nom_pro;

                docenteDatos = serviciosDoc.datosDocente(codDocente);
                String telefono = docenteDatos.getTelefono();
                String correo = docenteDatos.getCorreo();
                String zona = docenteDatos.getNombreDDis();
                String direccion=docenteDatos.getDireccion();
                String celular=docenteDatos.getCell();
                String provincia=docenteDatos.getNombrePro();
                String departamento=docenteDatos.getNombreDep();
    

                if(telefono==null || correo==null || zona==null || direccion == null || celular == null || provincia==null || departamento == null){
                    telefono = "";
                    correo = "";
                    zona = "";
                    direccion = "";
                    celular = "";
                    provincia="";
                    departamento="";
                }
        %>
            <tr> 
                <td colspan="7" height='10'> </td>
            </tr> 
            <tr>
                <td colspan="2" <%=borderT%> ><b>DOCENTE:</b></td>
                <td colspan="2" <%=border%> ><%=nombreDocente%></td>
                <td colspan="1" <%=borderT%> ><b>CORREO:</b></td>
                <td colspan="2" <%=border%> ><%=correo%></td>
                <td colspan="3" ></td>
            </tr> 
            <tr>
                 <td colspan="2" <%=borderT%> ><b>TELÉFONO:</b></td>
                <td colspan="2" <%=border%> align='left'> <%=telefono%></td>
                <td colspan="1" <%=borderT%> ><b>CELULAR:</b></td>
                <td colspan="2" <%=border%> align='left'> <%=celular%></td>
                <td colspan="3" ></td>
            </tr> 
            <tr>
                <td colspan="2" <%=borderT%> ><b>PROVINCIA:</b></td>
                <td colspan="2" <%=border%> ><%=provincia%></td>
                <td colspan="1" <%=borderT%> ><b>DEPARTAMENTO:</b></td>
                <td colspan="2" <%=border%> ><%=departamento%></td>
                <td colspan="3" ></td>
            </tr> 
            <tr>
                <td colspan="2" <%=borderT%> ><b>DISTRITO:</b></td>
                <td colspan="2" <%=border%> ><%=zona%></td>
                <td colspan="1" <%=borderT%> ><b>DIRECCIÓN:</b></td>
                <td colspan="2" <%=border%> ><%=direccion%></td>
                <td colspan="3" ></td>
            </tr> 
            <tr> 
                <td height='10'  colspan="7" ></td>
            </tr> 
            <tr>
                <th <%=borderT%> >N°</th> 
                <th <%=borderT%> >LUNES</th> 
                <th <%=borderT%> >MARTES</th> 
                <th <%=borderT%> >MIERCOLES</th> 
                <th <%=borderT%> >JUEVES</th> 
                <th <%=borderT%> >VIERNES</th> 
                <th <%=borderT%> >SÁBADO</th> 
            </tr> 
            
    <%        
    int blo=1;
    int cont=1;
    int cantMayor=0;
    String dia="";
    String cadenaLun = "";
    String cadenaMar = "";
    String cadenaMier = "";
    String cadenaJue = "";
    String cadenaVier = "";
    String cadenaSab = "";
   
         for(int i=0;i<lista.size(); i++){
            dia =lista.get(i).getDia_HorarioCursoDoc();
            /*String[] arrayIni=lista.get(i).getHini_HorarioCursoDoc().split(":");
            String[] arrayFin=lista.get(i).getHfin_HorarioCursoDoc().split(":");*/
            //String DatosAula = "<font face='Calibri' color='black' style='font-size:9px'><b>Nivel:</b>"+lista.get(i).getNombreNivel()+"</font><br><font face='Calibri' style='font-size:9px'>"+lista.get(i).getNombreGrado()+" "+lista.get(i).getNombreSeccion()+" "+lista.get(i).getNombreTipoGrado()+"</font><br><font color='black' face='Calibri'  style='font-size:9px' ><b>Turno:</b>"+lista.get(i).getNombreTurno()+"</font>";
            String DatosAula = "<font face='Calibri' color='black' style='font-size:11px'>"+lista.get(i).getGTS()+"</font>";
            //String Hora=arrayIni[0]+":"+arrayIni[1]+" a "+arrayFin[0]+":"+arrayFin[1];
            
            if(dia.equals("1")){
                if(cadenaLun.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaLun += "<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px;  color:green;'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaLun += "<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaLun += "#<font style='font-size:9px'  face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px;  color:green;'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaLun += "#<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }
            }else if(dia.equals("2")){
                if(cadenaMar.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaMar += "<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px; color:green;'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaMar += "<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaMar += "#<font style='font-size:9px'  face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px; color:green;'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaMar += "#<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }
            }else if(dia.equals("3")){
                if(cadenaMier.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaMier += "<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px; color:green;'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaMier += "<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaMier += "#<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px;  color:green;'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaMier += "#<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }
            }else if(dia.equals("4")){
                if(cadenaJue.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaJue += "<font style='font-size:9px'  face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px;  color:green;'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaJue += "<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaJue += "#<font style='font-size:9px'  face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px;  color:green;'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaJue += "#<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }
            }else if(dia.equals("5")){
                if(cadenaVier.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaVier += "<font style='font-size:9px'  face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px; color:green;'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaVier += "<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaVier += "#<font style='font-size:9px'  face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px; color:green;'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaVier += "#<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }
            }else if(dia.equals("6")){
                if(cadenaSab.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaSab += "<font style='font-size:9px'  face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px;  color:green;' > <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaSab += "<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaSab += "#<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px;  color:green;' > <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }else{
                        cadenaSab += "#<font style='font-size:9px' face='Calibri'> "+lista.get(i).getNombreSede()+" - "+lista.get(i).getNombreNivel()+" - "+lista.get(i).getNombreTurno()+" </font><br><font color='black'  style='font-size:10px'> <b>"+lista.get(i).getNombreCurso()+"</b></font><br>"+DatosAula;
                    }
                }
            }
            
            /*
            if(dia.equals("1")){
                if(cadenaLun.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaLun += "<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaLun += "<font style='font-size:9px' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaLun += "#<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaLun += "#<font style='font-size:9px; ' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }    
                }
            }else if(dia.equals("2")){
                if(cadenaMar.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaMar += "<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaMar += "<font style='font-size:9px' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaMar += "#<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaMar += "#<font style='font-size:9px' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }
                    
                }
            }else if(dia.equals("3")){
                if(cadenaMier.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaMier += "<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaMier += "<font style='font-size:9px' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }
                        
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaMier += "#<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaMier += "#<font style='font-size:9px' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }
                    
                }
            }else if(dia.equals("4")){
                if(cadenaJue.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaJue += "<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaJue += "<font style='font-size:9px' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaJue += "#<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaJue += "#<font style='font-size:9px' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }
                    
                }
            }else if(dia.equals("5")){
                if(cadenaVier.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaVier += "<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaVier += "<font style='font-size:9px' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaVier += "#<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaVier += "#<font style='font-size:9px' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }
                }
            }else if(dia.equals("6")){
                if(cadenaSab.equals("")){
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaSab += "<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaSab += "<font style='font-size:9px' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }
                    
                }else{
                    if(lista.get(i).getCodigoPlana().equals(plana)){
                        cadenaSab += "#<font style='font-size:9px; color:green;' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }else{
                        cadenaSab += "#<font style='font-size:9px' face='Calibri'><b>"+lista.get(i).getNombreCurso()+"</b></font><br><font color='black' style='font-size:9px'><b>Sede:</b>"+lista.get(i).getNombreSede()+"<br> <b>Hora:</b>"+Hora+"</font><br>"+DatosAula;
                    }
                    
                }
            } */
         }
         
         //ARRAY
         
         String[] arrayLun = cadenaLun.split("#");
         String[] arrayMar = cadenaMar.split("#");
         String[] arrayMier = cadenaMier.split("#");
         String[] arrayJue = cadenaJue.split("#");
         String[] arrayVier = cadenaVier.split("#");
         String[] arraySab = cadenaSab.split("#");
         
         
         
         int[] cantDias = {arrayLun.length,arrayMar.length,arrayMier.length,arrayJue.length,arrayVier.length,arraySab.length};
         for(int i=0; i<cantDias.length; i++){
             if(cantDias[i]>cantMayor){
                 cantMayor = cantDias[i];
             }
         }
         
        for(int i=0; i<cantMayor; i++){
        %>
            <tr>
                <td height='50' width='20' align='center' <%=border%> ><%=cont%>°</td>
        <%
                for(int d=1;d<=6;d++){
                if(d==1){
                    if(!cadenaLun.equals("")){
                        if(arrayLun.length>=cont){
        %>
                            <td height='50' width='142' align='center' <%=border%> ><%=arrayLun[i]%></td>
        <%
                        }else{
        %>
                           <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                        }
                    }else{
        %>
                                <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                        }
                }else if(d==2){
                    if(!cadenaMar.equals("")){
                        if(arrayMar.length>=cont){
        %>
                            <td height='50' width='142' align='center' <%=border%> ><%=arrayMar[i]%></td>
        <%
                        }else{
        %>
                            <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                        }
                    }else{
        %>
                                <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                        }
                }else if(d==3){
                    if(!cadenaMier.equals("")){
                        if(arrayMier.length>=cont){
        %>
                            <td height='50' width='142' align='center' <%=border%> ><%=arrayMier[i]%></td>
        <%
                        }else{
        %>
                            <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                        }
                    }else{
        %>
                                <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                        }
                }else if(d==4){
                    if(!cadenaJue.equals("")){
                        if(arrayJue.length>=cont){
        %>
                            <td height='50' width='142' align='center' <%=border%> ><%=arrayJue[i]%></td>
        <%
                        }else{
        %>
                            <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                        } 
                    }else{
        %>
                                <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                        }
                }else if(d==5){
                    if(!cadenaVier.equals("")){
                        if(arrayVier.length>=cont){
        %>
                            <td height='50' width='142' align='center' <%=border%> ><%=arrayVier[i]%></td>
        <%
                        }else{
        %>
                            <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                        } 
                    }else{
        %>
                                <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                        }
                }else if(d==6){
                    //if(!cadenaLun.equals("")){
                    if(!cadenaSab.equals("")){
                        if(arraySab.length>=cont){
        %>
                            <td height='50' width='142' align='center' <%=border%> ><%=arraySab[i]%></td>
        <%
                        }else{
        %>
                            <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                        }
                    }else{
        %>
                        <td height='50' width='142' align='center' <%=border%> ><font size="9"><b>X</b></font></td>
        <%
                    }  
                }
            }
            cont++;
        %>
            </tr>
            
        <%
        }
        %>
            <tr>
                <td colspan="7" height="30"></td>
            </tr>
        <%
        }//CIERRE DEL FOR
        %>
           </table>
        
        
        
        
    </body>
</html>