<?php include "conexion.inc" ?>
<?php include "validacion.php" ?>
<?php
	//Crear variables
	$cR01 = $_GET['id'];			// DEVOLUCIONES
	// conexión
	$servername = $svr_servidor;
	$conectioninfo = array("Database"=>$svr_base, "UID"=>$svr_usuario, "PWD"=>$svr_contrasena, "CharacterSet"=>"UTF-8");
	$conexion = sqlsrv_connect($servername, $conectioninfo);
	if ($conexion == false)
	{
		$mensaje = "Existe un error al intentar conectarse con el servidor...";
	}
	else
	{
		/* ACTUALIZO RUTA */
		$sql = "DELETE FROM JOIN_DEVOLUCIONES WHERE (IDDEVOLUCION = '".$cR01."')";
		$params = array();
		$options = array("scrollable" => SQLSRV_CURSOR_KEYSET);
		//Lanzar la consulta
		$resultado = sqlsrv_query($conexion, $sql);
		if ( $resultado )
		{
			 $something = "Submission successful.";
		}
		else
		{
			 $something = "Submission unsuccessful.";
			 die( print_r( sqlsrv_errors(), true));
		}
		sqlsrv_free_stmt($resultado);
		echo "
		<script languaje='javascript' type='text/javascript'>
			self.close();
			windows.location.reload();
		</script>
		";
	}
	sqlsrv_close($conexion);
?>