<?php


	
	session_start();
	if (!isset($_SESSION['user_login_status']) AND $_SESSION['user_login_status'] != 1) {
        header("location: login.php");
		exit;
        }
		require_once ("config/db.php");//Contiene las variables de configuracion para conectar a la base de datos
	require_once ("config/conexion.php");//Contiene funcion que conecta a la base de datos
	
	
	$active_facturas="";
	$active_productos="active";
	$active_clientes="";
	$active_usuarios="";	
	$title="Despachos | FONTUR";
?>
<!DOCTYPE html>
<html lang="en">
<script language="JavaScript">
  function redireccionar() {
    setTimeout("location.href='login.php?logout'", 60000000);
  }
  </script>


  <head>
	<?php include("head.php");?>
  </head>
  <body onLoad="redireccionar()">
	<?php
	include("navbar.php");
	?>  
    <div class="container" style="width:98%">
		<div class="panel panel-info">
		<div class="panel-heading">
		    <div class="btn-group pull-right">
            <?php if($_SESSION['rol']=="supervisor" || $_SESSION['rol']=="gerencia"){ ?>
				<a  href="nuevo_despacho.php" class="btn btn-info"><span class="glyphicon glyphicon-plus" ></span> Nuevo Despacho</a>
			<?php }?>
            </div>
			<h4><i class='glyphicon glyphicon-search'></i> Buscar Despachos</h4>
		</div>
			<div class="panel-body">
            	<form class="form-horizontal" role="form" id="datos_cotizacion">
				
						<div class="form-group row">
							<table class="table">
							<tr  class="info">
							
		       					<th align="right">Tienda Receptora</th>
        			    		<td align="left"><select class="form-control" id="tienda" name="tienda" onchange='load(1);'/>
	 			          			<option value="">---Seleccione una opcion---</option>
						  			<?php 
              						$count_query= mysqli_query($con, "SELECT * FROM `tiendas`");
		     						while($dato= mysqli_fetch_array($count_query))
									{
			 							$tienda=$dato['nombre'];
			  							?>
                  						<option value="<?php echo $tienda; ?>"><?php echo $tienda; ?></option>
                  					<?php 
									}	 
						  			?>
                          			</select> 
								</td>
			            		<th>Desde</th> 
			        <td><input class="form-control" type="date" name="desde" id="bd-desde" placeholder="desde" onchange='load(1);'/></td>
            		<th>Hasta</th>
			        <td><input class="form-control" type="date" name="hasta" id="bd-hasta" placeholder="hasta" onchange='load(1);'/></td>
        					</tr>
                		</table>
							</div>
							
						</div>
				
				
				
			</form>
			<?php
			include("modal/editar_despachos.php");
			?>
			
            	<div id="resultados"></div><!-- Carga los datos ajax -->
				<div class='outer_div'></div><!-- Carga los datos ajax -->
			</div>
		</div>	
		
	</div>
	<hr>
	<?php
	include("footer.php");
	?>
	<script type="text/javascript" src="js/VentanaCentrada.js"></script>
	<script type="text/javascript" src="js/despachos.js"></script>
   
  </body>
</html>