
<script language="javascript1.2" src="<%=m05bConstantesPaginas.PATH_SCRIPTS%>/m05Funciones.js"></script>
 <script language="javascript1.2" src="<%=m05bConstantesPaginas.PATH_SCRIPTS%>/formateador.js"></script>
 <SCRIPT language=JavaScript>
	var rutaCabecera;	//Camino de migas
	 rutaCabecera = "";
	 detActual = '<%=resCM.getString("cmVehiculos")%>'; 
	
	 //rutaCabecera = "<a style='text-decoration:none; font-size:8pt; color:yellow; font-family:verdana' href='" + "<%=m05bConstantesPaginas.VEH_GESTION_VEHICULOS%>?Matricula=<%=matricula%>" + "'>\\<%= resCM.getString("cmVehiculos")%></a>";

 </SCRIPT>
<%   String rutaRetorno = (String)session.getAttribute("rutaRetorno"); %>
<script>
 function fncRetornar(){
 	   var docu= document.formVehiculos;
	       docu.target="_top";  
               docu.action="<%=rutaRetorno%>";
	       docu.submit();
 			
}
</script>

<%
  String sExisteMatricula="0";
  String habilitar=request.getParameter("Habilitar");
  if  (habilitar==null){
       habilitar="";
  }else{%>
  <script>
   urlIdioma=urlIdioma+"&Habilitar=<%=habilitar%>";
  if( urlCambioVentana.indexOf("?")==-1)   {
      urlCambioVentana=urlCambioVentana+"?Habilitar=<%=habilitar%>";
  }else{
      urlCambioVentana=urlCambioVentana+"&Habilitar=<%=habilitar%>";   
  }
  </script>
<%}%>
 <%@ include file="/mantenimientosJSP/includes/m05Cabecera_c.jsp"%>
<p> 

<table  width="100%" height="100%" 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&nbsp</td>
		<td width="98%">
					<!-- Hojas de Estilo -->
						<%	m05bComun comun = new m05bComun();
							String m05bCalendarEstilo = comun.leerPropiedad("m05bEstilos.Calendario");  %>
						<%=m05bCalendarEstilo%>
					<!-- Calendarios -->
						<%	String m05bCalendarScripts = comun.leerPropiedad("m05bScripts.Calendario");  %>
						<%=m05bCalendarScripts%>
	
<FORM NAME="formVehiculos" METHOD="POST" TARGET="_top">
		<%

  java.sql.Connection conexion=null;
	
  PreparedStatement pstmt1 = null, pstmt2 = null;
  ResultSet rs1 = null;
  ResultSet rs2 = null;

  m05bConexion miConexion = new m05bConexion();
	

		String FecAdq="";
		String RegAdq="";
		String Precio="";
		String ViUtil="";
		String ImpBaja="";
		String MovBaja="";
		String DesBaja="";
		String FecBaja="";
                String situacion="";
                String codrango="";

		m05bCombo miCombo2 = new m05bCombo();
		StringBuffer sql2 = new StringBuffer();

		sql2.append("SELECT ").append(m05bConstantes.COL_34_FADQUIS).append(",");
		sql2.append(m05bConstantes.COL_34_REGADQUIS).append(",").append(m05bConstantes.COL_34_VCONTAB);
		sql2.append(",").append(m05bConstantes.COL_34_PRECIO).append(",");
		sql2.append(m05bConstantes.COL_34_VIDAUTIL).append(",").append(m05bConstantes.COL_34_IMPBAJA);
		sql2.append(",").append(m05bConstantes.COL_34_FBAJA).append(",").append(m05bConstantes.COL_34_AMOANUAL);
		sql2.append(",").append(m05bConstantes.COL_34_MOTIVBAJA).append(",").append(m05bConstantes.COL_34_DESTINO);
                sql2.append(",").append(m05bConstantes.COL_34_RANGO).append(",").append(m05bConstantes.COL_34_SITUACION);
		sql2.append(" FROM ").append(m05bConstantes.TAB_VEHICULOS).append(" WHERE ").append(m05bConstantes.COL_34_MATRICULA);
		sql2.append("='").append(matricula).append("'");

		try {
		           if (!matricula.equals("")){
		           //m05bBeginSelect(sql.toString());
		           //m05bRS = m05bPStmt.executeQuery();
                   conexion = miConexion.getConnection();
		           
       	  	      pstmt2 = conexion.prepareStatement(sql2.toString());
		          rs2 = pstmt2.executeQuery();
		           
		           if (rs2.next() == true){
		           	         sExisteMatricula="1";
                               codrango=rs2.getString(m05bConstantes.COL_34_RANGO);
			       situacion=rs2.getString(m05bConstantes.COL_34_SITUACION);

		               FecAdq=rs2.getString(m05bConstantes.COL_34_FADQUIS);
		               if (FecAdq==null || FecAdq.equals(""))
		                   FecAdq="";
		               else
		                   FecAdq=comun.Mes(FecAdq);
		               RegAdq=rs2.getString(m05bConstantes.COL_34_REGADQUIS);
		               if (RegAdq==null)
		               	   RegAdq="";
		               Precio=rs2.getString(m05bConstantes.COL_34_PRECIO);
		               if ((Precio==null)||(Precio.equals(""))||(Precio.equals("0")))
		               	   Precio="";

		               ViUtil=rs2.getString(m05bConstantes.COL_34_VIDAUTIL);
		               if (ViUtil==null)
		               	   ViUtil="";

		               ImpBaja=rs2.getString(m05bConstantes.COL_34_IMPBAJA);
		               if ((ImpBaja==null)||(ImpBaja.equals(""))||(ImpBaja.equals("0")))
		                   ImpBaja="";
		               FecBaja=rs2.getString(m05bConstantes.COL_34_FBAJA);
		               if (FecBaja==null || FecBaja.equals(""))
		                   FecBaja="";
		               else
		                   FecBaja=comun.Mes(FecBaja);
		               MovBaja=rs2.getString(m05bConstantes.COL_34_MOTIVBAJA);
		               if  (MovBaja==null || MovBaja.equals(""))
		                    MovBaja="";
		               DesBaja=rs2.getString(m05bConstantes.COL_34_DESTINO);
		               if (DesBaja==null || DesBaja.equals(""))
		                    DesBaja="";
		           }
		    }
		  } catch (Exception SQLException){
			   SQLException.printStackTrace();
		  } finally {
			    //m05bEndSelect();
				if (rs2 != null)
					rs2.close();
				if (pstmt2 != null)
					pstmt2.close();
				if (conexion != null)
					conexion.close();
			    
		  }
		%>
 <% if  (habilitar.equals("true"))   {%>
          <TABLE class='general'>
               <tr>
                  <td align='right'> <INPUT TYPE='IMAGE' style='cursor:hand' VALUE='Retornar' ONCLICK='JavaScript:fncRetornar();return false;'  src='/parquemovil/images/retornar.gif'/> </td>
               </tr>
           </TABLE>
 <%}%>

		  <TABLE class="buscar">
		    <tr>
		      <td valign="top" align="left"  class="inputFieldTitle"><%= res.getString("etMatricula")%></td>
		      <td valign="top" align="left"  class="inputFieldTitle"><%= res.getString("etSituacion")%></td>
		      <td valign="top" align="left"  class="inputFieldTitle"><%= res.getString("etRango")%></td>
		    </tr>
		    <tr>
		      <td valign="top" align="left" ><INPUT  NAME = "MatriculaS" class="inputFieldOblig" TYPE="TEXT"  VALUE="<%=matricula%>" size="12" maxlength="20" onBlur="javascript:fncCambioMatricula(urlCambioVentana);return false;" onKeyPress="this.style.background=('blue');this.style.color=('white')"/></td>
                     <select  style="visibility:hidden" class=inputField  NAME="Situacion" disabled>
                        <option value=""> </option>
       	                  <%=miCombo2.popCombo( m05bConstantes.COL_99_CODDESC, m05bConstantes.COL_99_DESCRIPCION, m05bConstantes.TAB_DESCRIPCIONES, m05bConstantes.COL_99_CODTABLA, m05bConstantes.DESC_SITUACIONES, situacion )%>
                       </select>
                     <td valign="top" align="left"  class="inputFieldTitleBlank">
                      <script>
                         document.write(document.formVehiculos.Situacion.options[document.formVehiculos.Situacion.selectedIndex].text);
                         document.formVehiculos.Situacion.style.display="none";
                     </script>
                    </td>
                   <select  style="visibility:hidden" class=inputField  NAME="CRango" disabled>
                     <option value=""> </option>	
                       <%=miCombo2.popCombo( m05bConstantes.COL_99_CODDESC, m05bConstantes.COL_99_DESCRIPCION, m05bConstantes.TAB_DESCRIPCIONES, m05bConstantes.COL_99_CODTABLA, m05bConstantes.DESC_RANGOS, codrango )%>
                   </select>
                   <td valign="top" colspan="2" align="left"  class="inputFieldTitleBlank">
                    <script>
                      document.write(document.formVehiculos.CRango.options[document.formVehiculos.CRango.selectedIndex].text);
                      document.formVehiculos.CRango.style.display="none";
                    </script>
                   </td>
		    </tr>
		  </TABLE>
	             <select style="visibility:hidden; height=0" class=inputFieldTitleBlank  NAME="RegAdq" >
		       <option value=""> </option>
		          <%=miCombo2.popCombo( m05bConstantes.COL_99_CODDESC, m05bConstantes.COL_99_DESCRIPCION, m05bConstantes.TAB_DESCRIPCIONES, m05bConstantes.COL_99_CODTABLA, m05bConstantes.DESC_REGADQUISICION, RegAdq )%>
		     </select>
		  <TABLE class="buscar">
		    <tr>
		      <td valign="top" align="left" colspan="8" class="searchTitle">Adquisici&oacute;n</td>
		    </tr>
		  </TABLE>
		  <TABLE class="buscar">
		    <tr>
			  <td  valign="top" align="left" class="inputFieldTitle"><%= res.getString("etFecha")%></td>
		      <td  valign="top" align="left" class="inputFieldTitle" ><%= res.getString("etRegimen")%>
		      <td  valign="top" align="left" class="inputFieldTitle"><%= res.getString("etVidaUtil")%></td>
		      <td  valign="top" align="left" class="inputFieldTitle"><%= res.getString("etPrecio")%></td>
		    </tr>
		    <tr>
		      <td valign="top" align="left"  class="inputFieldTitleBlank" ><%=FecAdq%> </td>
			  <td valign="top" align="left"  class="inputFieldTitleBlank">
                             <script>
                                   document.write(document.formVehiculos.RegAdq.options[document.formVehiculos.RegAdq.selectedIndex].text);
                                   document.formVehiculos.RegAdq.style.display="none";

                             </script>
			  </td>

		    <td valign="top" align="left"  class="inputFieldTitleBlank" ><%=ViUtil%></td>
      <INPUT class="inputField" TYPE="hidden" NAME="Precio"  VALUE="<%=Precio%>"  size="12" maxlength="12" onblur="javascript: formatNumeroDecimal(this,10,2);return false;">
      <script>
         formatNumeroDecimal(parent.document.formVehiculos.Precio,10,2);
      </script>	
       <td valign="top" align="left" class="inputField"><script> document.write(parent.document.formVehiculos.Precio.value);</script></td>
		    </tr>
		  </TABLE>
                    <select style="visibility:hidden"  class=inputField  NAME="DesBaj" >
		      <option value=""> </option>
		       <%=miCombo2.popCombo( m05bConstantes.COL_99_CODDESC, m05bConstantes.COL_99_DESCRIPCION, m05bConstantes.TAB_DESCRIPCIONES, m05bConstantes.COL_99_CODTABLA, m05bConstantes.DESC_DESTINOSBAJA, DesBaja )%>
		    </select>

		  <TABLE class="buscar">
		    <tr>
		      <td valign="top" align="left" colspan="8" class="searchTitle"><%= res.getString("etBaja")%></td>
		    </tr>
		  </TABLE>
		  <TABLE class="buscar">
		    <tr>
		      <td  valign="top" align="left" class="inputFieldTitle"><%= res.getString("etFecha")%></td>
		      <td  valign="top" align="left" class="inputFieldTitle" ><%= res.getString("etDestino")%></td>
		      <td  valign="top" align="left" class="inputFieldTitle"><%= res.getString("etImporte")%></td>
		      <td  valign="top" align="left" class="inputFieldTitle"><%= res.getString("etMotivo")%></td>
		    </tr>
		    <tr>
		      <td valign="top" align="left"  class="inputFieldTitleBlank"><%=FecBaja%></td>
			  <td valign="top" align="left"  class="inputFieldTitleBlank">
                             <script>
                                   document.write(document.formVehiculos.DesBaj.options[document.formVehiculos.DesBaj.selectedIndex].text);
                                   document.formVehiculos.DesBaj.style.display="none";
                             </script>
			  </td>
		      <td valign="top" align="left"  class="inputFieldTitleBlank"><%=ImpBaja%></td>
		      <td valign="top" align="left"  class="inputFieldTitleBlank" ><%=MovBaja%></td>
		     </tr>
		  </TABLE>
		  <br>
	<TABLE class="general">
     <tr>
     		   <td id="tabVarios" bgcolor="#3366CC" onmouseout="fueraPestana(this)" onmouseover="javascript:dentroPestana(this);"><a href="#" onclick="javascript:fncVarios('<%=habilitar%>');return false;"  style='text-decoration:none; font-size:7pt; color:#FFFFFF; font-family:verdana'   ><%= res.getString("etMVARIOS")%></a></td>
               <td id="tabEconomica" bgcolor="#3366CC" onmouseout="fueraPestana(this)" onmouseover="javascript:dentroPestana(this);"><a href="#" onclick="javascript:fncEconomica('<%=habilitar%>');return false;"  style='text-decoration:none; font-size:7pt; color:#FFFFFF; font-family:verdana'   ><%= res.getString("etMECONOMICA")%></a></td>
               <td id="tabTasa" bgcolor="#3366CC" onmouseout="fueraPestana(this)" onmouseover="javascript:dentroPestana(this);"><a href="#" onclick="javascript:fncTasa('<%=habilitar%>');return false;"       style='text-decoration:none; font-size:7pt; color:#FFFFFF; font-family:verdana'   ><%= res.getString("etMTASAS")%></a></td>
               <td id="tabTarjetas" bgcolor="#3366CC" onmouseout="fueraPestana(this)" onmouseover="javascript:dentroPestana(this);"><a href="#" onclick="javascript:fncTarjetas('<%=habilitar%>');return false;"   style='text-decoration:none; font-size:7pt; color:#FFFFFF; font-family:verdana'   ><%= res.getString("etMTARJETAS")%></a></td>
               <td id="tabGastos" bgcolor="#3366CC" onmouseout="fueraPestana(this)" onmouseover="javascript:dentroPestana(this);"><a href="#" onclick="javascript:fncGastos('<%=habilitar%>');return false;"     style='text-decoration:none; font-size:7pt; color:#FFFFFF; font-family:verdana'   ><%= res.getString("etMGASTOS")%></a></td>
               <td id="tabSeguros" bgcolor="#3366CC" onmouseout="fueraPestana(this)" onmouseover="javascript:dentroPestana(this);"><a href="#" onclick="javascript:fncSeguro('<%=habilitar%>');return false;"     style='text-decoration:none; font-size:7pt; color:#FFFFFF; font-family:verdana'   ><%= res.getString("etMSEGUROS")%></a></td>
               <td id="tabSanciones" bgcolor="#3366CC" onmouseout="fueraPestana(this)" onmouseover="javascript:dentroPestana(this);"><a href="#"onclick="javascript:fncSanciones('<%=habilitar%>');return false;"  style='text-decoration:none; font-size:7pt; color:#FFFFFF; font-family:verdana'   ><%= res.getString("etMSANCIONES")%></a></td>
               <td id="tabItv" bgcolor="#3366CC" onmouseout="fueraPestana(this)" onmouseover="javascript:dentroPestana(this);"><a href="#"   onclick="javascript:fncITV('<%=habilitar%>');return false;"        style='text-decoration:none; font-size:7pt; color:#FFFFFF; font-family:verdana'   ><%= res.getString("etMITV")%></a></td>
               <td id="tabSiniestros" bgcolor="#3366CC" onmouseout="fueraPestana(this)" onmouseover="javascript:dentroPestana(this);"><a href="#"  onclick="javascript:fncSiniestros('<%=habilitar%>');return false;" style='text-decoration:none; font-size:7pt; color:#FFFFFF; font-family:verdana'   ><%= res.getString("etMSINIESTROS")%></a></td>
 			   <td id="tabReformas" bgcolor="#3366CC"  onmouseout="fueraPestana(this)" onmouseover="javascript:dentroPestana(this);"><a href="#"    onclick="javascript:fncReformas('<%=habilitar%>');return false;"   style='text-decoration:none; font-size:7pt; color:#FFFFFF; font-family:verdana'   ><%= res.getString("etMREFORMAS")%></a></td>
     </tr>
    </TABLE>
<INPUT class="inputField" TYPE="HIDDEN" NAME="Matricula" VALUE="<%=matricula%>" size="12" maxlength="20" />
<input type="hidden" name="Existe" value="1">
<input type="hidden" name="Habilitar" value="<%=habilitar%>">
<%PrintWriter outMsg= response.getWriter();	  
  if (sExisteMatricula.equals("0")) {
      outMsg.println("<script>alert(dameAlerta(idioma, 108));</script>");
}%>
</form>	
