<?
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");

$cont=0;

$sql_bpro = "SELECT * FROM vende_zona_antofagasta";

$res_bpro = mysql_query($sql_bpro,$enlace);
 
while (mysql_fetch_object ($res_bpro))
	{
	$ven_codigo = mysql_result($res_bpro, $cont, "Ven_codigo");
	$ven_dia = mysql_result($res_bpro, $cont, "Ven_dia");
	$ven_rutcod = mysql_result($res_bpro, $cont, "Ven_Rutcod");
	$id_bodega = mysql_result($res_bpro, $cont, "id_bodega");
	
//	$id_empresa=1;
	
	
   	
 ///    graba en nombres
 
 	
	$esql = "INSERT INTO vendedor_zona (Ven_codigo, Ven_dia, Ven_Rutcod, id_bodega, id_empresa)
	VALUES ('$ven_codigo', '$ven_dia', $ven_rutcod, $id_bodega, $id_empresa)";
echo $esql;
		$consulta = mysql_query($esql,$enlace);
			

   
  $cont=$cont+1;
  }

	
?>


<script language="javascript" type="text/javascript">
alert ("<?='\nListo Vende Rutas !';?>");
	parent.location.href = 'index.php';
</script>