<?
session_start();
if ($_SESSION['estado'] != "ON")
		{
		?>
		<script>
			parent.location.href = 'index.php';
		</script>
		<? 
		exit();
		}
$id_empresa = $_SESSION['ss_empresa'];
$id_user = $_SESSION['ss_user'];

include("../conex.php");


// cabeza 
       $sql_in = "SELECT * FROM pasofactura;";	
		
		$res_in = mysql_query($sql_in,$enlace);	
		$row=0;
		while (mysql_fetch_object ($res_in))
          {
		  $txtndcto=mysql_result($res_in, $row, "numero");
		  $producto=mysql_result($res_in, $row, "producto");
		  $precio=mysql_result($res_in, $row, "precio");
		  $cant=mysql_result($res_in, $row, "cantidad")/100;
		  $sub_total=mysql_result($res_in, $row, "subtotal");
		  
		
		$sql_in_cli = "UPDATE movimiento SET cantidad=$cant, sub_total=$sub_total where numero_dcto=$txtndcto AND precio_unitario=$precio";
		    $res_in_cli = mysql_query($sql_in_cli,$enlace);
			
		
			 $sql_sal = "UPDATE productos SET saldo=(saldo-$cant), u_salida=(u_salida+$cant) WHERE empresa=$id_empresa AND codigo_fabricante = $producto";
				mysql_query($sql_sal,$enlace);
			

		 	  
		  $row+=1;
	  }





	
		?>
<script>
	alert("Traspaso realizado con exito");
	window.top.open('','_parent','');window.top.close();
</script>
		
	
	
