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

<HTML>
	
<!-- Fecha de creacion: (11/12/03) -->
<%	// _______________________________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");
	//Agurtzane Feb12: añadir Rango a la búsqueda
	String Grupo=""; 
    //Fin Agurtzane Feb12: añadir Rango a la búsqueda
%>
	<%@ include file="/m05bIdioma.inc"%>
	
<head>
		<title><%= resTit.getString("titOTBusqueda")%></title>
		<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
		<link rel="stylesheet" href="<%=m05bConstantesPaginas.PATH_ESTILOS%>/m05bestilos.css" type="text/css">
		<script language="javascript1.2" src="<%=m05bConstantesPaginas.PATH_SCRIPTS%>/formateador.js"></script>
		<script language="javascript1.2" src="<%=m05bConstantesPaginas.PATH_SCRIPTS%>/m05Funciones.js"></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
			var rutaCabecera;	//Camino de migas
			var detActual;		//Ventana actual			
			urlIdioma = "<%=m05bConstantesPaginas.VEH_OT_BUSQUEDA%>";
			detActual = '<%=resCM.getString("cmOTBusqueda")%>';
			rutaCabecera="";
			//rutaCabecera = "<%=m05bConstantesPaginas.DATOS_CABECERA%>" + urlIdioma + "'>\\"+detActual+"</a>";
		</SCRIPT>
		<%@ include file="/mantenimientosJSP/includes/m05Cabecera_c.jsp"%>
<p> 	 
<table  width="90%" height="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr><td colspan=3></td></tr>
	<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>
		<td>&nbsp</td>
		<td width="98%">
		 <FORM NAME="formBuscarOT" METHOD="POST">
				<% m05bComun comun = new m05bComun(); 
				   m05bCombo miCombo = new m05bCombo();
				%>
				<!-- Calendarios -->
				<%	String m05bCalendarEstilo = comun.leerPropiedad("m05bEstilos.Calendario");  %>
				<%=m05bCalendarEstilo%>
				<%	String m05bCalendarScripts = comun.leerPropiedad("m05bScripts.Calendario");  %>
				<%=m05bCalendarScripts%>
				<TABLE width="80%" class="general">
					 <tr>
					 	<td align="right" colspan="8">
							<input type="button" class="boton" name="<%= res.getString("etBOT_BUSCAR")%>" value="<%= res.getString("etBOT_BUSCAR")%>" ONCLICK="JavaScript:fncBuscar();return false;" onMouseOver="top.status='<%= res.getString("etBOT_STATUSBUSCAR")%>'; return false" onMouseOut="top.status=''; return false" />
					 		<INPUT TYPE="HIDDEN" name="idAbierta" value="<%=(request.getParameter("idAbierta")==null?"":request.getParameter("idAbierta"))%>"/>
					 	</td>
					 </tr>
				</TABLE> 	 
				 <TABLE width="80%" class="general">
				    <tr>
				       <td class="searchTitle" colspan="8"><%= res.getString("etEstado")%></td>
				    </tr>
					<tr>
					  <td class="grupoAsignacion" align="left" colspan="8">
				          <input type="RADIO" class=inputFieldTitle NAME="Estado" <%if(request.getParameter("Estado")==null || request.getParameter("Estado").equals("") || request.getParameter("Estado").equals("T")){%>CHECKED <%}%> VALUE="T" border='0'/><FONT size=2><%= res.getString("etTodas")%></FONT>
				          <input type="RADIO" class=inputFieldTitle NAME="Estado" <%if(request.getParameter("Estado")!=null && request.getParameter("Estado").equals("A")){%>CHECKED <%}%> VALUE="A" border='0'/><FONT size=2><%= res.getString("etAbiertas")%></FONT>
				          <input type="RADIO" class=inputFieldTitle NAME="Estado" <%if(request.getParameter("Estado")!=null && request.getParameter("Estado").equals("C")){%>CHECKED <%}%> VALUE="C" border='0'/><FONT size=2><%= res.getString("etCerradas")%></FONT>
	  		         </td>
				    </tr>
				    <tr>
					      <td align="left" class="inputFieldTitle" colspan="2"><%= res.getString("etNOrden")%></td>
					      <td align="left" colspan="3" class="inputFieldTitle"><%= res.getString("etFechaEntrada")%></td>
					      <td align="left" colspan="3" class="inputFieldTitle"><%= res.getString("etFechaSalida")%></td>
						  
					</tr>
					<tr>
					      <td align="left" colspan="2"> <INPUT class="inputField" TYPE="TEXT" NAME="NOrden" size="22" maxlength="22" value="<%=(request.getParameter("NOrden")==null?"":request.getParameter("NOrden"))%>"/> </td>
					   	  <td align="left" width="15%" colspan="1"><INPUT class="inputField" TYPE="TEXT" NAME="FEntrada" size="10" maxlength="10" value="<%=(request.getParameter("FEntrada")==null?"":request.getParameter("FEntrada"))%>" onblur="javascript:formatearFecha(this);return false;"/></td>
					   	  <td align="left" width="5%" colspan="1"><a href='#' name='anchorFEntrada'  onClick='JavaScript:showCalendar("anchorFEntrada",idioma,document.all("FEntrada"),true,200,200,2002);return false;' onMouseOver="top.status='Ver Calendario'; return true" onMouseOut="top.status=''; return true" ><img border="0" src='<%=m05bConstantesPaginas.PATH_IMAGENES%>/p01calendario.gif' /></a></td>
					   	  <td align="left" colspan="1"><INPUT class="inputField" TYPE="TEXT" NAME="HEntrada" size="6" maxlength="6" value="<%=(request.getParameter("HEntrada")==null?"":request.getParameter("HEntrada"))%>" onblur="javascript:formatearHora(this);return false;"/></td>
					   	  <td align="left" width="15%" colspan="1"><INPUT class="inputField" TYPE="TEXT" NAME="FSalida" size="10" maxlength="10" value="<%=(request.getParameter("FSalida")==null?"":request.getParameter("FSalida"))%>" onblur="javascript:formatearFecha(this);return false;"/></td>
					   	  <td align="left" width="5%" colspan="1"><a href='#' name='anchorFSalida'  onClick='JavaScript:showCalendar("anchorFSalida",idioma,document.all("FSalida"),true,200,200,2002);return false;' onMouseOver="top.status='Ver Calendario'; return true" onMouseOut="top.status=''; return true" ><img border="0" src='<%=m05bConstantesPaginas.PATH_IMAGENES%>/p01calendario.gif' /></a></td>
					   	  <td align="left" colspan="1"><INPUT class="inputField" TYPE="TEXT" NAME="HSalida" size="6" maxlength="6" value="<%=(request.getParameter("HSalida")==null?"":request.getParameter("HSalida"))%>" onblur="javascript:formatearHora(this);return false;"/></td>

					</tr>
				    <tr>
				       <td class="inputFieldTitle" colspan="2"><%= res.getString("etMatricula")%></td>
				       <td class="inputFieldTitle" colspan="6"><%= res.getString("etConductor")%></td>
				    </tr>
					<tr>
				      <td align="left" colspan="2"><INPUT class="inputField" TYPE="TEXT" NAME="Matricula" value="<%=(request.getParameter("Matricula")==null?"":request.getParameter("Matricula"))%>" size="22" maxlength="10"/> </td>
				      <td align="left" colspan="6"><INPUT class="inputField" TYPE="TEXT" NAME="Conductor" value="<%=(request.getParameter("Conductor")==null?"":request.getParameter("Conductor"))%>" size="86" maxlength="50"/> </td>
				    </tr>
				    <!-- Agurtzane Feb12: añadir Rango a la búsqueda -->
				    <SCRIPT language="javascript">
    						var comboDesc=new Array();
					        <%=miCombo.joinComboArrayGrupos(campoTexto3)%>
					</script>
					<script language="javascript1.2" src="<%=m05bConstantesPaginas.PATH_SCRIPTS%>/m05Pulsado.js"></script>
			    	<tr>
    		            <td  class="inputFieldTitle" colspan="2">Grupo Rango</td>
    		            <td  class="inputFieldTitle" colspan="6">Rango</td>
                     </tr>
		   		     <tr>
				      <td align="left" colspan="2">
						 <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.formBuscarOT.Rango, comboDesc, '');document.formBuscarOT.Rango.disabled=false; document.formBuscarOT.Rango.focus(); return false;" >				        
					          <option value="***"></option>
					                <%=miCombo.GrupoRango(Grupo,campoTexto3)%>
					     </select>			
				      </td>
				      <td align="left" colspan="6" >
 				         <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 align="left"  colspan="2" class="inputFieldTitle"><%= res.getString("etAbiertaPor")%></td>
					</tr>
					<tr>
				      	<td align="left"  colspan="2">
						  	  	<select name="Abierta" class="inputField" onKeypress="buscar_op(this,this)" onblur="borrar_buffer()" onclick="borrar_buffer()" >
								        <option type="submit" size="25"> </option>
								        <%=miCombo.popCombo( m05bConstantes.COL_07_CODIGO, m05bConstantes.COL_07_NOMBRE, m05bConstantes.TAB_EMPTALLER, m05bConstantes.COL_07_ALTA, "'S'", (request.getParameter("idAbierta")==null?"":request.getParameter("idAbierta")))%>
						   		</select>
						  </td>
					
					</tr>
					<input type="hidden" name="GRango" value="">
		            <input type="hidden" name="CodRango" value="">
				    <!-- Fin Agurtzane Feb12: añadir Rango a la búsqueda -->						
				</TABLE>
		</FORM>
		</td>
	</tr>
	<tr>
			<td colspan="3"><%@ include file="/mantenimientosJSP/includes/m05Pie_c.jsp"%></td>
	</tr>
</table>
<script>
document.formBuscarOT.NOrden.focus();
</script>
<SCRIPT language="JavaScript">
	function fncBuscar (){
		   var docu=document.formBuscarOT;
		   if(existeCaracter(docu.NOrden.value,"\'")||existeCaracter(docu.NOrden.value,'\"')){
     			alert(dameAlerta(idioma, 1));
     			docu.NOrden.focus();
     			return;
     		}
     	   if(existeCaracter(docu.Matricula.value,"\'")||existeCaracter(docu.Matricula.value,'\"')){
     			alert(dameAlerta(idioma, 1));
     			docu.Matricula.focus();
     			return;
     		}
     	   if(existeCaracter(docu.Conductor.value,"\'")||existeCaracter(docu.Conductor.value,'\"')){
     			alert(dameAlerta(idioma, 1));
     			docu.Conductor.focus();
     			return;
     		}           
           formatearFecha(docu.FEntrada);
           formatearFecha(docu.FSalida);
           	//Agurtzane Feb12: añadir Rango a la búsqueda
           var cadena=document.formBuscarOT.Grupo.options[document.formBuscarOT.Grupo.selectedIndex].value;
	       var car	="";				
			if (cadena!="***"){car=cadena.charAt(0);}
		    document.formBuscarOT.GRango.value=car;
		    cadena=document.formBuscarOT.Rango.options[document.formBuscarOT.Rango.selectedIndex].value;
		    if (cadena=="-1"){cadena="";}
			document.formBuscarOT.CodRango.value=cadena;           
           //Fin Agurtzane Feb12: añadir Rango a la búsqueda
           docu.action="m05bRelOrdenesJsp.jsp";
           docu.idAbierta.value=docu.Abierta.value;
           docu.submit();
    }  // Fin funcion fncBuscar
    setTimeout('initSlide();', 1);
</SCRIPT>
</BODY>
</HTML>