<%@page import="java.util.*,javax.sql.*,java.sql.*,javax.naming.*,java.text.*, m05bClasses.*" %>
<%@include file="/mantenimientosJSP/includes/m05b.inc"%>

<!-- Para poder mostrar carateres especiales en los mensajes javascript -->
<%@page contentType="text/html; charset=UTF-8" %>
<HTML>
	
<!-- Fecha de creacion: (04/04/05) -->

<%	// _______________________________XLNETs______________________________________
	// Evaluar variable de session que indica si esta conectado a XLNets
	if (session.getAttribute("objetoSeguridad") == null)  { 
		// Verificar que no ha transcurrido el tiempo de sesion (web.xml) %>
			<%@ include file="/m05bControlAcceso.inc"%> 
<%	} 
	String persona = (String) session.getAttribute("persona");
%>
<%@ include file="/m05bIdioma.inc"%>
	
<head>
		<title><%= resTit.getString("titCTKTotal")%></title>
		<link rel="stylesheet" href="<%=m05bConstantesPaginas.PATH_ESTILOS%>/m05bestilos.css" type="text/css">
		<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
		<script language="JavaScript" src="<%=m05bConstantesPaginas.PATH_SCRIPTS%>/m05bMenuClic.js"></script>
</head>
<BODY style="cursor: wait" onkeydown="cancelaEnter();" onload="document.body.style.cursor='default';"  onunload="document.body.style.cursor='wait';">
<div id="general" style="POSITION: absolute"> 			
<SCRIPT language=JavaScript>
	var urlIdioma;		//URL recarga en funcion del idioma
	var rutaCabecera;	//Camino de migas
	<% String ruta="/m05bParqueMovilWar/m05bTotalCTKJsp.jsp?Rango=A" ; %>
	detActual='<%= resCM.getString("cmCTKTotal")%>';
	rutaCabecera="";
	//rutaCabecera = "<a style='text-decoration:none; font-size:8pt; color:yellow; font-family:verdana' href='<%=ruta%>'>\\Total CTK</a>";
</SCRIPT>
<%@ include file="/mantenimientosJSP/includes/m05Cabecera_c.jsp"%>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" align="center" valign="top">
	<tr>
		<td width="2%">
			<DIV ID="thessm" style="visibility:hidden;Position : Absolute ;Left : 0 ;Top : 80 ;Z-Index : 20;">
	      		<DIV ID="thessm2" style="Position : Absolute ;Left : (-140) ;Top : 0 ;Z-Index : 20;">
	                <%@ include file="/m05bMenuInicial.inc"%>
	       		</DIV>
			</DIV>
		<td></td>
		<td width="98%">
			<% 		String sql, sqlRango="", fdesde="", fhasta="", porcent="", dias="";
					m05bComun miComun = new m05bComun();
					String rango = request.getParameter("Rango");
					int contTotal = 0;
					sql = "select " + m05bConstantes.COL_97_MATRICULA + ", " + m05bConstantes.COL_97_RANGO +
								", " + m05bConstantes.COL_97_FDESDE + ", " + m05bConstantes.COL_97_FHASTA +
								", " + m05bConstantes.COL_97_PORCENT + ", " + m05bConstantes.COL_97_DIAS +
								" from " + m05bConstantes.TAB_CTK + 
								" where " + m05bConstantes.COL_97_TOTAL + " = 'S'" +
			    				" and " +  m05bConstantes.COL_97_USUARIO + " = '" + persona + "'" ;
		    %>
	<div id="general" style="POSITION: absolute; visibility:visible" >
			<FORM NAME="formTotalCTK" METHOD="POST">
				<!--  BOTONERA -->
					  <TABLE class="general">
					    	<tr align="right">
							    <td>
									<!--INPUT TYPE="IMAGE" style="cursor:hand" VALUE="Retornar" ONCLICK="JavaScript:history.back();return false;" onMouseOver="top.status='Retornar'; return true" onMouseOut="top.status=''; return true" src="<%=m05bConstantesPaginas.PATH_IMAGENES%>/retornar.gif"-->
                                    <input type="button" class="boton" name="<%= res.getString("etBOT_RETORNAR")%>" value="<%= res.getString("etBOT_RETORNAR")%>" ONCLICK="JavaScript:history.back();return false;" onMouseOver="top.status='<%= res.getString("etBOT_STATUSRETORNAR")%>'; return false" onMouseOut="top.status=''; return false" />			       	       									
							  	</td>
							</tr>
					  </TABLE>
					  <TABLE class="general">
					    <tr> 
					      <td class="grupoAsignacion">
					      	  <% if (rango.equals("A")) { 
									  sqlRango = " and " +  m05bConstantes.COL_97_RANGO + 
									  					" IN (" + m05bConstantesInformes.CTK_GRUPO_A + ")";
							  %>
							          <input type="RADIO" NAME="Rango" CHECKED VALUE="A" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>A</FONT>
							          <input type="RADIO" NAME="Rango" VALUE="B" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>B</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="C" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>C</FONT>
							          <input type="RADIO" NAME="Rango" VALUE="D" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>D</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="RA" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RA</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="RB" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RB</FONT>							          
						      <% } else if (rango.equals("B")) { 
									  sqlRango = " and " +  m05bConstantes.COL_97_RANGO + 
									  					" IN (" + m05bConstantesInformes.CTK_GRUPO_B + ")";
						      %>
							          <input type="RADIO" NAME="Rango" VALUE="A" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>A</FONT>
							          <input type="RADIO" NAME="Rango" CHECKED VALUE="B" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>B</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="C" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>C</FONT>
							          <input type="RADIO" NAME="Rango" VALUE="D" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>D</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="RA" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RA</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="RB" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RB</FONT>
					      	  <% } else if (rango.equals("C")) { 
									  sqlRango = " and " +  m05bConstantes.COL_97_RANGO + 
									  					" IN (" + m05bConstantesInformes.CTK_GRUPO_C + ")";
					      	  %>
							          <input type="RADIO" NAME="Rango" VALUE="A" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>A</FONT>
							          <input type="RADIO" NAME="Rango" VALUE="B" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>B</FONT>
							          <input TYPE="RADIO" NAME="Rango" CHECKED VALUE="C" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>C</FONT>
							          <input type="RADIO" NAME="Rango" VALUE="D" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>D</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="RA" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RA</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="RB" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RB</FONT>
					      	  <% } else if (rango.equals("D")) { 
									  sqlRango = " and " +  m05bConstantes.COL_97_RANGO + 
									  					" IN (" + m05bConstantesInformes.CTK_GRUPO_D + ")";
					      	  %>
							          <input type="RADIO" NAME="Rango" VALUE="A" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>A</FONT>
							          <input type="RADIO" NAME="Rango" VALUE="B" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>B</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="C" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>C</FONT>
							          <input type="RADIO" NAME="Rango" CHECKED VALUE="D" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>D</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="RA" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RA</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="RB" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RB</FONT>
					      	  <% } else if (rango.equals("RA")) { 
									  sqlRango = " and " +  m05bConstantes.COL_97_RANGO + 
									  					" IN (" + m05bConstantesInformes.CTK_GRUPO_RA + ")";
					      	  %>
							          <input type="RADIO" NAME="Rango" VALUE="A" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>A</FONT>
							          <input type="RADIO" NAME="Rango" VALUE="B" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>B</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="C" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>C</FONT>
							          <input type="RADIO" NAME="Rango" VALUE="D" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>D</FONT>
							          <input TYPE="RADIO" NAME="Rango" CHECKED VALUE="RA" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RA</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="RB" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RB</FONT>
					      	  <% } else if (rango.equals("RB")) { 
									  sqlRango = " and " +  m05bConstantes.COL_97_RANGO + 
									  					" IN (" + m05bConstantesInformes.CTK_GRUPO_RB + ")";
					      	  %>
							          <input type="RADIO" NAME="Rango" VALUE="A" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>A</FONT>
							          <input type="RADIO" NAME="Rango" VALUE="B" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>B</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="C" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>C</FONT>
							          <input type="RADIO" NAME="Rango" VALUE="D" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>D</FONT>
							          <input TYPE="RADIO" NAME="Rango" VALUE="RA" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RA</FONT>
							          <input TYPE="RADIO" NAME="Rango" CHECKED VALUE="RB" onclick='JavaScript:fncCambiarRango();return false;' border='0'/><FONT size=2>RB</FONT>							          
							  <% }  %>
					      </td>
					    </tr> 
					  </TABLE>
					  <TABLE class="general">
					    <tr> 
					      <td class="searchTitle"><%= res.getString("etMatricula")%></td>
						  <td class="searchTitle"><%= res.getString("etRango")%></td>
						  <td class="searchTitle"><%= res.getString("etFechaDesde")%></td>
						  <td class="searchTitle"><%= res.getString("etFechaHasta")%></td>
					    </tr>
					    	  <%
							try{  
								sql = sql + sqlRango + 	" order by " + m05bConstantes.COL_97_MATRICULA ;
						    	m05bBeginSelect(sql);
								m05bRS = m05bPStmt.executeQuery();
								while (m05bRS.next() == true){
									fdesde = m05bRS.getString(3);
									fdesde= miComun.formatearFecha(fdesde);
									fhasta = m05bRS.getString(4);
									fhasta= miComun.formatearFecha(fhasta);
						      %>
										<tr>
										   <td class="inputFieldTitle"><FONT size="2"><A href="JavaScript:fncVerVehiculo('<%=m05bRS.getString(1)%>')"><%=m05bRS.getString(1)%></A></FONT></td>
								   		   <td class="inputFieldTitle"><FONT size="2"><%=m05bRS.getString(2)%></FONT></td>
										   <td class="inputFieldTitle"><FONT size="2"><%=fdesde%></FONT></td>
								   		   <td class="inputFieldTitle"><FONT size="2"><%=fhasta%></FONT></td>
										</tr>
							  <% ++contTotal;
							  	}
							} catch (Exception SQLException) {
								m05bClasses.m05bFileLog miLog = new m05bClasses.m05bFileLog();
									miLog.addTraza(SQLException);
							} finally {
									m05bEndSelect();
							}%>
						<tr> </tr>
					    <tr align="center">
						      <td class="inputField" colspan="4"><%= res.getString("etTotal")%> <%=contTotal%></td>
					    </tr>
					  </TABLE>
			</FORM>
			</div>
		</td>
	</tr>
	<tr>
			<td colspan="3"><%@ include file="/mantenimientosJSP/includes/m05Pie_c.jsp"%></td>
	</tr>
</table>
<SCRIPT language='javascript'>
	function fncCambiarRango() {
		var rango;
		var docu = document.formTotalCTK;
		if (docu.Rango[0].checked) {
			rango="A";
		} else if (docu.Rango[1].checked) {
			rango="B";
		} else if (docu.Rango[2].checked) {
			rango="C";
		} else if (docu.Rango[3].checked) {
			rango="D";
		} else if (docu.Rango[4].checked) {
			rango="RA";
		} else if (docu.Rango[5].checked) {
			rango="RB";
		}
       	docu.action="m05bTotalCTKJsp.jsp?Rango=" + rango;
		docu.submit();
    }  // Fin funcion fncCambiarRango
	function fncVerVehiculo(matricula) {
            formTotalCTK.action="m05bVehiculosJsp.jsp?Matricula=" + matricula + "&Mensaje=false";
            formTotalCTK.submit();
    }  // Fin funcion fncVerVehiculo
							
    setTimeout('initSlide();', 1);
</SCRIPT>
</div>
</BODY>
</HTML>