exportarTodoDocenteZonas.jsp 6.64 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
<%-- 
    Document   : exportarTodoUsuDocente
    Created on : 05/12/2014, 10:07:05 AM
    Author     : sistem16user
--%>

<%@page import="pe.siso.horario.Beans.ZonaDistrito"%>
<%@page import="pe.siso.horario.Services.ZonaDistritoServices"%>
<%@page import="java.util.Calendar"%>
<%@page import="pe.siso.horario.Beans.Usuario"%>
<%@page import="pe.siso.horario.Services.DisponibilidadServices"%>
<%@page import="pe.siso.horario.Beans.Docente"%>
<%@page import="java.util.ArrayList"%>
<%@page import="pe.siso.horario.Services.DocenteServices"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
        DocenteServices servicios = new DocenteServices();
        ArrayList<Docente> lista = null;
        ZonaDistritoServices servicios2 = new ZonaDistritoServices();
        ZonaDistrito zonaDistrito = new ZonaDistrito();
        
        lista=servicios.listarTodoUsuDocente();
        
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
         <%
            HttpSession session_actual = request.getSession(true);
            Usuario usuario=(Usuario)session_actual.getAttribute("usuario");
            
            response.setContentType("application/vnd.ms-excel; ");
            response.setHeader("Content-Disposition","attachment; filename=DocenteZonaTotal.xls");
            
            String border="style='border:solid 0.5pt #000000;vertical-align:middle;'";
            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 = "";
            
            Calendar cal1 = Calendar.getInstance();
           
            int dia = cal1.get(Calendar.DATE);
            int mes = cal1.get(Calendar.MONTH)+1;
            int hora = cal1.get(Calendar.HOUR_OF_DAY);
            int minuto = cal1.get(Calendar.MINUTE);
            int segundo = cal1.get(Calendar.SECOND);
            String diaAc = "";
            String mesAc = "";
            String hrAc = "";
            String minAc = "";
            String secAc = "";

            int horaAc = 0;
            String perDia = "";

            if(dia<10){ diaAc = "0"+dia; }else{ diaAc = ""+dia;}

            if(mes<10){ mesAc = "0"+mes; }else{ mesAc = ""+mes; }

            if(minuto<10){ minAc = "0"+minuto; }else{ minAc = ""+minuto; }

            if(segundo<10){ secAc = "0"+segundo; }else{ secAc = ""+segundo; }

            if(hora<12){ 
             perDia="am."; 
             if(hora<10 && hora>0){
                 hrAc="0"+hora;
                 }else if(hora==0){
                     hrAc="12";
                 }else{
                     hrAc=""+hora; 
                 }  
             }else{
                 if(hora==12){
                     hrAc="12";
                 }else{
                     horaAc=hora-12;
                     if(horaAc<10){
                         hrAc="0"+horaAc;
                     }else{
                         hrAc = ""+horaAc;
                     }
                 }
                 perDia="pm.";
            }
            
        %>
        <table  cellpadding= '0' cellspacing= '0'>
            <tr>
                <td <%=centrado%> colspan='6' align='center'><h3>LISTADO DE TODOS LOS DOCENTES</h3></td>
            </tr> 
            <tr>
               <td colspan='6' height='10'></td>
            </tr> 
            <tr>
               <td colspan='3' ></td>
               <td colspan='3' align='right'>SACO OLIVEROS - SISTEMAS</td>
            </tr> 
            <tr>
               <td colspan='3' >FUENTE: SISTEMA DE HORARIOS</td>
               <td colspan='3' align='right'>RESPONSABLE: <%=usuario!=null?usuario.getNombreTipoUsuario():""%></td>
            </tr> 
            <tr>
               <td colspan='3' >REGISTROS: <%=lista.size()%></td>
               <td colspan='3' align='right'>ACTUALIZACIÓN: <%=diaAc+"-"+mesAc+"-"+cal1.get(Calendar.YEAR)+" "+hrAc+":"+minAc+":"+secAc+" "+perDia%></td>
            </tr> 
            <tr>
              
                <td <%=borderColorTitulo%> align='center'>N°</td>                                        
                <td <%=borderColorTitulo%> align='center'>APELLIDOS Y NOMBRES</td>
                <td <%=borderColorTitulo%> align='center' width="150">DEPARTAMENTO</td>   
                <td <%=borderColorTitulo%> align='center' width="150">PROVINCIA</td>   
                <td <%=borderColorTitulo%> align='center' width="150">DISTRITO</td>   
                <td <%=borderColorTitulo%> align='center' width="150">ZONA</td>   
            </tr>
        <%
            int cont= 1;
            for(int i=0; i< lista.size(); i++) {
                if(cont%2==0){ 
                    estilo=borderColor; 
                }else{
                    estilo=border; 
                }
                String codigoDocente = lista.get(i).getCod_pro();
                zonaDistrito = servicios2.consultarZona(codigoDocente);
                
                String nombreDepartamento = zonaDistrito.getNombreDepartamento();
                String nombreProvincia = zonaDistrito.getNombreProvincia();
                String nombreDistrito = zonaDistrito.getNombreDistrito();
                String nombreZona = zonaDistrito.getNombreZona();
        %>
         <tr>
              
                <td <%=estilo%> align='center'><%=cont%></td>
                <td <%=estilo%>><%=lista.get(i).getApe_pro()%>, <%=lista.get(i).getNom_pro()%></td>
        <%
            if(nombreDepartamento == null && nombreProvincia == null && nombreDistrito == null){  
        %>
                <td <%=estilo%> align='center' colspan="3"><b style='color:red;'>EL DOCENTE AÚN NO HA REGISTRADO SUS DATOS</b></td>

        <%    }else{ %>
                <td <%=estilo%>><%=nombreDepartamento%></td>
                <td <%=estilo%>><%=nombreProvincia%></td>
                <td <%=estilo%>><%=nombreDistrito%></td>
        <%
            } 
            
            if(nombreZona == null){
        %>
                <td <%=estilo%>></td>                
        <%  }else{ %>
                <td <%=estilo%>><%=nombreZona%></td>
        <%
            }
        %>
                
            </tr>
        <%  
            cont++;
            }
        
             if(cont==1){
        %>
            <tr>
                <td  colspan='4' align='center' <%=border%>>No hay Docentes registrados</td>
            </tr>
        <%
            }
        %>
        </table>
        
        
    </body>
</html>