<%@page import="java.io.*,java.util.*,javax.sql.*,java.sql.*,javax.naming.*,java.text.*, m05bClasses.*" %>
<!-- Para poder mostrar caracteres especiales en los mensajes javascript -->
<%@page contentType="text/html; charset=UTF-8" %>
<HTML>
	
<%	// _______________________________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("titLstKilometrajesYConsumos")%></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="javascript1.2" src="<%//=m05bConstantesPaginas.PATH_SCRIPTS%>/m05Fechas.js"></script-->
		<script language="javascript1.2" src="<%=m05bConstantesPaginas.PATH_SCRIPTS%>/m05Funciones.js"></script>
		<script language="javascript1.2" src="<%=m05bConstantesPaginas.PATH_SCRIPTS%>/formateador.js"></script>
		<SCRIPT language="javascript1.2" src="<%=m05bConstantesPaginas.PATH_SCRIPTS%>/m05Pulsado.js"></script>
		<script language="JavaScript">
			    function fncImprimir() {
					var url="";
					var docu= document.formSolicitud;
                    var cadena="";
                    var car="";
			    	if ((docu.FecDesde.value=="") || (docu.FecHasta.value=="")) {
			    		alert(dameAlerta(idioma, 44));
                    } else if (((docu.FecDesde.value != "") && (docu.FecHasta.value != ""))
		    	        && ((!(comparaFechas(docu.FecDesde.value, docu.FecHasta.value))))){
		                alert(dameAlerta(idioma, 67));
			    	} else { 
						if (docu.Listado.value=="1"){
							url="m05bConsumosPDFVehiculoJsp.jsp";}
						else{
						    url="m05bKilometrosPDFVehiculoJsp.jsp";}
						cadena=docu.Grupo.options[docu.Grupo.selectedIndex].value;
						if (cadena!="***"){
						   car=cadena.charAt(0);
	                    }
					    docu.GRango.value=car;
					    cadena=docu.Rango.options[docu.Rango.selectedIndex].value;
					    if (cadena=="-1"){
					    	cadena="";
					    }
						docu.CodRango.value=cadena;
						
						cadena=docu.Marca.options[docu.Marca.selectedIndex].value;
						car="";
						if (cadena!="***"){
						   car=cadena;
	                    }
					    docu.CodMarca.value=car;
					    //cadena=docu.Modelo.options[docu.Modelo.selectedIndex].value;
					    //if (cadena=="-1"){
					    	//cadena="";
					    //}
						//docu.CodModelo.value=cadena;						

						docu.Matricula.value=docu.CMatricula.options[docu.CMatricula.selectedIndex].value;	
						//if (docu.FecDesde.value != "") {
						//	formatearFecha(docu.FecDesde);
						//}
						//if (docu.FecHasta.value != "") {
						//	formatearFecha(docu.FecHasta);
						//}
				        docu.action=url;
                        document.body.style.cursor='wait';	
              			        
				        docu.submit();
			        }
			    }
		    	
		</SCRIPT>
			
</head>
<BODY style="cursor: wait" onkeydown="cancelaEnter();" onload="document.body.style.cursor='default';InitMenu();" onunload="document.body.style.cursor='wait';">
<div id='p01popUpWindowCalendar' style='position:relative; top:15px left:150px'></div>
 <SCRIPT language=JavaScript>
	var urlIdioma;		//URL recarga en funcion del idioma
   	urlIdioma = "<%=m05bConstantesPaginas.LST_VEH_KMYCONSUMO%>";
	var rutaCabecera;	//Camino de migas
	<% String ruta="/m05bParqueMovilWar/m05bImpKmYConsumoJsp.jsp" ; %>
	rutaCabecera="";
	detActual='<%= resCM.getString("cmLstKilometrajesYConsumos")%>';	
	//rutaCabecera = "<a style='text-decoration:none; font-size:8pt; color:yellow; font-family:verdana' href='" + urlIdioma + "'>\\<%= resCM.getString("cmLstKilometrajesYConsumos")%></a>";
 </SCRIPT>
 <%@ include file="/mantenimientosJSP/includes/m05Cabecera_c.jsp"%>
<script>
function RecogerSelectMultiple(tipo){	
   if (tipo=="1")		  
    var Obj = document.formSolicitud('Situacion');
   else 
    var Obj = document.formSolicitud('Modelo');
   
    var len = Obj.length
    	
    var i,texto,cont;
        texto="";
        cont=1;
    for (i=1; i<len; i++) {
      if (Obj[i].selected) {
      	   if (cont==1){ 
             texto= Obj[i].value;}
            else{ 
            	texto=texto + "," +Obj[i].value;}
            cont=cont+1;
       }
   }
      if (tipo=="1")		  
         document.formSolicitud.SituacionTexto.value=texto;
      else
         document.formSolicitud.ModeloTexto.value=texto;
          }   
</script> 
	 
<%
	String situacion = "";
	String Grupo="";
%>
<p>
<table  width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr valign="top">
		<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 : (-150) ;Top : 0 ;Z-Index : 20;">
	                <%@ include file="/m05bMenuInicial.inc"%>
	       		</DIV>
			</DIV>
		<td>&nbsp</td>
		<td width="98%">
			<!-- Calendarios -->
       <FORM NAME="formSolicitud" METHOD="POST">
					<!-- Hojas de Estilo -->
						<%	String m05bCalendarEstilo = m05bFicheroProperties.getInstance().getParameter("m05bEstilos.Calendario");  %>
						<%=m05bCalendarEstilo%>
					<!-- Calendarios -->
						<%	String m05bCalendarScripts = m05bFicheroProperties.getInstance().getParameter("m05bScripts.Calendario");  %>
						<%=m05bCalendarScripts%>
       					
	<% 		m05bCombo miCombo = new m05bCombo();
		    m05bCombo miCombo2 = new m05bCombo();%>
		    
					<SCRIPT language="javascript">
    						var comboDesc=new Array();
					        <%=miCombo.joinComboArrayGrupos(campoTexto3)%>
					</script>
	
			       <SCRIPT language="javascript">
    			          var CmbDesc=new Array();
                           <%=miCombo.joinComboArray( m05bConstantes.COL_17_CODMOD, m05bConstantes.COL_17_DESCRIP, m05bConstantes.TAB_MODELOS, m05bConstantes.COL_17_CODMARCA)%>
			      </SCRIPT>					
								
			<TABLE class="general">
			    <tr align="right">
					  <!--td width="100%" align="right"><INPUT TYPE="IMAGE" style="cursor:hand" VALUE="Aceptar" ONCLICK="JavaScript:fncImprimir();return false;" onMouseOver="top.status='Imprimir'; return true" onMouseOut="top.status=''; return true" src="<%=m05bConstantesPaginas.PATH_IMAGENES%>/imprimir.gif"></td-->
                      <td width="100%" align="right"><input type="button" class="boton" name="<%= res.getString("etBOT_PRESENTAR")%>" value="<%= res.getString("etBOT_PRESENTAR")%>" ONCLICK="JavaScript:fncImprimir();return false;" onMouseOver="top.status='<%= res.getString("etBOT_STATUSPRESENTAR")%>'; return false" onMouseOut="top.status=''; return false" /></td>				      					  					  
	
				</tr>
			</TABLE>
					
		  <TABLE class="general">
		  	<tr> 
		      <td width="5%">
		   		  <TABLE  border="0" class="general" >
		   		     <tr>
		   		      <td  width="35%" align="left" colspan="2"  class="inputFieldTitle"><%= res.getString("etEstado")%></td>
    		          <td  width="65%" class="inputFieldTitle" colspan="5"><%= res.getString("etMatricula")%> </td>
                     </tr>
		   		     <tr>
                      <td align="left" >
                       	  <select class=inputField multiple NAME="Situacion" size="6" onblur="javascript:RecogerSelectMultiple(1);return false;" onchange="javascript:document.formSolicitud.CMatricula.disabled=false;">
                       	     <option value=""> </option>
                       	     	 <%=miCombo.popCombo( m05bConstantes.COL_99_CODDESC, "NVL("+ campoTexto+m05bConstantes.COL_99_DESCRIPCION+","+m05bConstantes.COL_99_DESCRIPCION+")", m05bConstantes.TAB_DESCRIPCIONES, m05bConstantes.COL_99_CODTABLA, m05bConstantes.DESC_SITUACIONES, "" )%>
         				  </select>
					  </td>
					  <td width="5%"></td>
				      <td align="left" valign="top" colspan="6">
				        <table>
				         <tr>
				          <td colspan="2">
			  			  <select style="vertical-align=top" class=inputField  NAME="CMatricula"   onKeypress="buscar_op(this,this)" onblur="borrar_buffer()" onclick="borrar_buffer()">
				    	     <option value=""> </option>	
						                <%=miCombo.ComMatricula(m05bConstantes.VEH_TODOS,"")%>
				    	  </select>
				    	  </td>
				    	 </tr>
				    	 <tr>
				    	   <td class="inputFieldTitle"> <%= res.getString("etMarca")%></td>
				    	   <td class="inputFieldTitle"> <%= res.getString("etModelo")%></td>
		                 </tr>
				    	 <tr>
				    	   <td >
				    	     <select class=inputField  NAME="Marca" onchange="JavaScript:blur();" onKeypress="if ((event.keyCode == 13)||(event.keyCode == 21)){blur();} else {buscar_op(this,this);}" onclick="borrar_buffer();" onblur="Pulsado(Marca.options[Marca.selectedIndex].value, document.formSolicitud.Modelo,CmbDesc,'');document.formSolicitud.Modelo.disabled=false; document.formSolicitud.Modelo.focus(); return false;" >
    			                 <option value="***"> </option>							       
    			                   <%=miCombo.popCombo( m05bConstantes.COL_99_CODDESC, m05bConstantes.COL_99_DESCRIPCION, m05bConstantes.TAB_DESCRIPCIONES, m05bConstantes.COL_99_CODTABLA, m05bConstantes.DESC_MARCAS, "" )%>
    			             </select>
				    	   </td>
				    	   <td > 
				    	     <select class=inputField  NAME="Modelo" multiple disabled onKeypress="buscar_op(this,this)" onblur="javascript:borrar_buffer();RecogerSelectMultiple(2);return false;"" onclick="borrar_buffer()">
   				                 <option value=""> </option>
				                   <%=miCombo.popCombo( m05bConstantes.COL_17_CODMOD, m05bConstantes.COL_17_DESCRIP, m05bConstantes.TAB_MODELOS, "", "", "" )%>
				             </select>
				    	   </td>
		                 </tr>		                 
				    	 </table>
				      </td>
					 </tr>
					 
					<tr>
					  <td height="15%" colspan="8">&nbsp;&nbsp;</td>
					</tr>
					 			 
		   		     <tr>
		   		        <td align="left" class="inputFieldTitle" colspan="2" ><%= res.getString("etGrupoRangos")%> </td>
    		            <td align="left" class="inputFieldTitle" colspan="5"  ><%= res.getString("etRango")%> </td>
                     </tr>
		   		     <tr>
				        <td align="left"  >
						 <select class=inputField  NAME="Grupo" onchange="JavaScript:blur();" onKeypress="if ((event.keyCode == 13)||(event.keyCode == 21)){blur();} else {buscar_op(this,this);}" onclick="borrar_buffer();" onblur="Pulsado(Grupo.options[Grupo.selectedIndex].value.split('..')[0], document.formSolicitud.Rango, comboDesc, '');document.formSolicitud.Rango.disabled=false; document.formSolicitud.Rango.focus(); return false;" >				        
					          <option value="***"></option>
					                <%=miCombo.GrupoRango(Grupo,campoTexto3)%>
					     </select>
				    	</td>
					    <td width="5%"></td>
				    	<td align="left"  colspan="7">
				         <select class=inputField  NAME="Rango"  onKeypress="buscar_op(this,this)" onblur="borrar_buffer()" onclick="borrar_buffer()">
				    	     <option value=""> </option>	
				    	       	<%=miCombo.popCombo( m05bConstantes.COL_99_CODDESC,"NVL("+ campoTexto+m05bConstantes.COL_99_DESCRIPCION+","+m05bConstantes.COL_99_DESCRIPCION+")", m05bConstantes.TAB_DESCRIPCIONES, m05bConstantes.COL_99_CODTABLA, m05bConstantes.DESC_RANGOS, "")%>
				    	  </select>
				    	 </td>
					</tr>
					<tr>
					  <td height="15%" colspan="8">&nbsp;&nbsp;</td>
					</tr>
								 
		   		     <tr>
    		            <td width="35%" align="left" colspan="2" class="inputFieldTitle"><%= res.getString("etListado")%></td>
    		            <td width="20%" align="left" colspan="3"class="inputFieldTitle"><%= res.getString("etFechaDesde")%></td>
    		            <td width="45%" align="left" colspan="3" class="inputFieldTitle"><%= res.getString("etFechaHasta")%> </td>
    		         </tr>
    		         <tr>
    		            <td width="30%" style="text-align: left" class="inputField" >
                          <input checked type="Radio" class=inputField onclick="javascript:document.formSolicitud.Listado.value='0'" NAME="Tipo"   VALUE="0" width="40%"  border='0'/><%=res.getString("etKMR") %>
                        </td>
    		         	<td width="5%"></td>
                        <td align="left" width="4%"><INPUT class="inputFieldOblig" TYPE="TEXT" NAME="FecDesde" VALUE="" size="10" maxlength="10" onblur="javascript:formatearFecha(this);return false;"></td>
        				<td align="left" width="10%">    <a href='#' name='anchorFecDesde'  onClick='JavaScript:showCalendar("anchorFecDesde",idioma,document.all("FecDesde"),true,25,10,2002);return false;' onMouseOver="top.status='Ver Calendario'; return true" onMouseOut="top.status=''; return true" ><img border="0" align="bottom" src='<%=m05bConstantesPaginas.PATH_IMAGENES%>/p01calendario.gif' name="calendario1"/></td>
    		         	<td width="6%"></td>
                        <td align="left" width="11%"><INPUT class="inputFieldOblig" TYPE="TEXT" NAME="FecHasta" VALUE="" size="10" maxlength="10" onblur="javascript:formatearFecha(this);return false;"></td>
        			    <td align="left" width="34%">  <a href='#' name='anchorFecHasta'  onClick='JavaScript:showCalendar("anchorFecHasta",idioma,document.all("FecHasta"),true,25,10,2002);return false;' onMouseOver="top.status='Ver Calendario'; return true" onMouseOut="top.status=''; return true" ><img border="0" align="bottom" src='<%=m05bConstantesPaginas.PATH_IMAGENES%>/p01calendario.gif' name="calendario2"/></td>
				     </tr>
				    	
		   		     <tr>
    		            <td width="35%" style="text-align: left" class="inputField" >
                          <input type="Radio" class=inputField onclick="javascript:document.formSolicitud.Listado.value='1';"  NAME="Tipo"  VALUE="1" width="40%" border='0'/><%=res.getString("etCDC") %>	  
                       </td>
                       <td width="65%" colspan="6"></td>
				     </tr>
        		    </table>
    		  </td>
            <tr>
    	</table>
		              <input type="hidden" name="Listado" value='0'>
		              <input type="hidden" name="SituacionTexto" value="">
		              <input type="hidden" name="ModeloTexto" value="">
		              <input type="hidden" name="GRango" value="">
		              <input type="hidden" name="CodRango" value="">
		              <input type="hidden" name="Matricula" value="">
	                  <input type="hidden" name="CodMarca" value="">	
	                  <input type="hidden" name="CodModelo" value="">			              
</FORM>		    		
		</td>
	</tr>
	<tr>
			<td colspan="6"><%@ include file="/mantenimientosJSP/includes/m05Pie_c.jsp"%></td>
	</tr>
</table>
<SCRIPT language='javascript'>
    setTimeout('initSlide();', 1);
    
</SCRIPT>
</BODY>
</HTML>