<%@ page language="java"%> 
<%@ page import="java.util.*,javax.sql.*,java.sql.*,javax.naming.*,java.text.*,m05bClasses.m05bConstantesPaginas,m05bClasses.*" %>

<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("titAsigPDFRevocar")%></title>
		<link rel="stylesheet" href="<%=m05bConstantesPaginas.PATH_ESTILOS%>/m05bestilos.css" type="text/css">
		<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
</HEAD>	
<BODY style="cursor: wait" onload="document.body.style.cursor='default';document.all['general'].style.visibility='visible';document.all['general'].style.cursor='default';" onunload="document.body.style.cursor='wait';document.all['general'].style.cursor='wait';">
<div  id="general" style="POSITION: absolute;visibility:hidden;cursor: wait">	
	<form NAME="formPDFRevocar" METHOD="POST">
		<%	
			m05bComun miComun = new m05bComun();
	        m05bFileLog miLog = new m05bFileLog();

			String asignacion = request.getParameter("NSolicitud");
			String matricula = request.getParameter("Matricula");
			String acta = request.getParameter("Acta");
			String entDev = miComun.leerPropiedad("PDF.Revocar");
			String srcPDF = entDev + matricula;
			
			java.sql.Connection conn=null;
			PreparedStatement pstmt = null;
			ResultSet rs = null;
		    try
		      {  //HttpSession session = request.getSession(true);
					m05bConexion miConex = new m05bConexion();
					conn = miConex.getConnection();
		            String sSentencia=" SELECT  1 "+
								" FROM " + 
				                m05bConstantes.TAB_ASIGNACION +
                                " WHERE " + 
                                m05bConstantes.COL_01_CODASIG+"='"+asignacion+"' AND "+
                                m05bConstantes.COL_01_IMPRESO+"='N'";
    	miLog.addTraza(persona , "AsigPDFRevocarServlet" , "sSentencia: " + sSentencia, m05bConstantes.LOG_NIVEL_BAJO);
                    
		            pstmt = conn.prepareStatement(sSentencia);
				    rs = pstmt.executeQuery();
                    
		%>
		<TABLE class="general">
				  <tr>
					    <td width="90%" align="right">
							<input type="button" class="boton" name="<%= res.getString("etBOT_RETORNAR")%>" value="<%= res.getString("etBOT_RETORNAR")%>" ONCLICK="JavaScript:fncRetornar('<%=asignacion%>');" onMouseOver="top.status='<%= res.getString("etBOT_STATUSRETORNAR")%>'; return false" onMouseOut="top.status=''; return false" />
					  	</td>
		    <% if ((acta.equals("true")) && (rs.next() == true)) { %>
    	      <%miLog.addTraza(persona , "AsigPDFRevocarServlet" , "Acta: " + acta.equals("true"), m05bConstantes.LOG_NIVEL_BAJO);%>
		    				
					    <td width="10%" align="right"> 
					    	<input type="button" class="botonL" name="<%= res.getString("etBOT_ACTADEV")%>" value="<%= res.getString("etBOT_ACTADEV")%>" ONCLICK="JavaScript:fncActaDev('<%=asignacion%>','<%=matricula%>');return false;" onMouseOver="top.status='<%= res.getString("etBOT_STATUSACTADEV")%>'; return false" onMouseOut="top.status=''; return false" />
					    </td>
					  </tr>
					  <tr>
					    <td colspan="2">
		    <% } else { %>
					  </tr>
					  <tr>
					    <td>
		    <% } %>
							<embed name='pdfEntDev' src='<%=srcPDF%>' type="application/pdf" width='736' height='500'></embed>
			<%	} catch (Exception SQLException) {
					miLog.addTraza(SQLException);
				} 	finally{
						if (rs != null)
							rs.close();
						if (pstmt != null)
							pstmt.close();
						if (conn != null)
							conn.close();}%>
								
					  	</td>
				  </tr>
		</TABLE>
	</form>
	<script type="text/javascript" src="<%=m05bConstantesPaginas.PATH_SCRIPTS%>/m05bMsControl.js"></script>
 
</div>							
</body>
<SCRIPT language=JavaScript>
	function fncRetornar(asignacion) {
		var docu=document.formPDFRevocar;
		docu.action="/m05bParqueMovilWar/m05bGenerarAsignacionServlet?Codigo=" + asignacion +"&Mensaje=false"
		docu.submit();
	}
	function fncActaDev (asignacion, matricula){
		var docu=document.formPDFRevocar;
        docu.action="m05bAsigPDFActaDevJsp.jsp?NSolicitud=" + asignacion + "&Matricula=" + matricula;
        docu.submit();
    }
</SCRIPT>
</html>