<?php
date_default_timezone_set('America/Costa_Rica');

session_start();

 $usu=$_SESSION['username'];
 

		include('../conexion.php'); 
		if($_SESSION['tipo_usu']=='a' or $_SESSION['tipo_usu']=='s'  or $_SESSION['tipo_usu']=='c'  or $_SESSION['tipo_usu']=='v'){
		}else{
			header('location:error.php');
		}
		if($_SESSION['tipo_usu']=='a'){
			$titulo='SUPERVISOR';
		}else{
			$titulo='USUARIO';
		}
		
$consulta = "SELECT * FROM usuarios WHERE usu='$usu'";
$resultado = $mysqli->query($consulta);
$row = $resultado->fetch_array();
 $nomb = $row["usu"];
 $cod  = $row["codusu"];
		
$codaju=$_GET["codaju"];

		
	   $sel_cxc="SELECT * FROM lista_precios WHERE codaju='$codaju'"; 
       $result = $mysqli->query($sel_cxc);
       $row2 = $result->fetch_array();
       $cdgtipaju = $row2["cdgtipaju"];

		
	   $consulta = "SELECT cdgtipaju,accaju FROM tipo_ajuste WHERE cdgtipaju='$cdgtipaju'";
       $resultado = $mysqli->query($consulta);
       $row = $resultado->fetch_array();
       $aplicar = $row["accaju"];


	//************************************************ Anulo en la  tabla Facturas  *********************************


	$sel_act="DELETE FROM lista_precios  WHERE codaju='$codaju'";
	$mysqli->query($sel_act);

	$sel_art="DELETE FROM lista_precios_lineas   WHERE  codajuste='$codaju'";
	$mysqli->query($sel_art);

  	
	//************************************************ Anulo en la  tabla 1001 *********************************
		
		
	$consulta = "SELECT * FROM lista_precios_lineas WHERE codajuste='$codaju' ORDER BY numlinea ASC";
	$contador = 0 ;
	if ($res = $mysqli->query($consulta)) 

    while ($fila2 = $res->fetch_assoc()) {
	
	    $numlinea  = $fila2["numlinea"];
        $codigo    = $fila2["codigo"];
		$cantidad  = $fila2["cantidad"];
		$importe   = $fila2["importe"];
		$impuesto  = $fila2["impuesto"];
		$preivi    = $fila2["preivi"];
		$descuento = $fila2["dcto"];	

		

	}
	



	?>
<html>
	<head>
		<title>Ajuste Nulo</title>
		<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
		<link href="../calendario/calendar-blue.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="../funciones/validar.js"></script>
		<script type="text/JavaScript" language="javascript" src="../calendario/calendar.js"></script>
		<script type="text/JavaScript" language="javascript" src="../calendario/lang/calendar-sp.js"></script>
		<script type="text/JavaScript" language="javascript" src="../calendario/calendar-setup.js"></script>
		<script language="javascript">
		var cursor;
		if (document.all) {
		// Está utilizando EXPLORER
		cursor='hand';
		} else {
		// Está utilizando MOZILLA/NETSCAPE
		cursor='pointer';
		}
		
	
	    function cancelar() {
			location.href="index.php?cadena_busqueda=<? echo $cadena_busqueda?>";
		}
		
	
		function nobackbutton(){	
   window.location.hash="no-back-button";	
   window.location.hash="Again-No-back-button" //chrome	
   window.onhashchange=function(){window.location.hash="no-back-button";}	
}



		</script>








</head>
	<body onLoad="nobackbutton();">
		<div id="">
			<div id="zonaContenido">
         	<div class="contenidoFactura">
			   <div align="center">
				<div id="tituloForm" class="header">
             LIsta Anulada Exitosamente 
			   </div>
			    <br> </br>
				<table width="100%" border="0">
  <tr>
    <td colspan="4">&nbsp;</td>
    </tr>
</table>

				
			    
			  </div>
				<div id="botonBusquedaAWR">					
				
				<div id="" align="center">
					<img src="../img/Symbol-Check_128x128-32.png" width="128" height="128" onClick="cancelar()" border="0" onMouseOver="style.cursor=cursor" title="Salir">
			
			  </div>
				    
			   </div>
			  </div>
		  </div>
		</div>
	</body>
</html>



