<?php
session_start();
$data = date('Y-m-d');
	require 'script_php/Softcom.php';



?>

<!DOCTYPE html>
<html>
<head>

<?php include_once 'head.html' ?>

<title></title>
</head>

<body>

<?php include_once 'header.php'; ?>

<h5> Filtro de período </h5>

<form action="painelblack.php" method='GET'>

	<?php $data = date('Y-m-d'); ?>

<label> Data inicio </label> <br>
        <input type="date" placeholder='Data inicio' value=<?php echo $data ;?>  name='datainicio' class="form-control form_data form_forn" >
        <br>

        <label> Data Final </label> <br>
        <input type="date" placeholder='Data inicio Final' value=<?php echo $data;?>  name='datafinal' class="form-control form_data form_forn"  >
		
		
		
		<p>* Fabricante <br>
			
	<select name="fabricante" id="cars"   class="form-control form_forn fbc" required>
	<?php
	//nova instancia da classe softcom
	$fabricante = new Softcom();
	//acessando metodo que retorna todos os fabricantes
	$dados = $fabricante->BuscarFabricante();
	//percorrendo todos os fabricantes
	foreach ($dados as $novo)
	{
	?>
	<option value="<?php echo $novo[0]; ?>" > <?php echo $novo[0]; ?></option>
	<?php }?>
	</select>
		

        <br> Empresa <br>
<?php
 $usuario = $_SESSION['usuario'];

$result = "SELECT * FROM usuarios WHERE usuario = '$usuario' ";
$resultado = mysqli_query($conexao, $result);

while($linha = mysqli_fetch_array($resultado)){

$matriz =  $linha['matriz'];
$loja02 =  $linha['loja02'];
$loja03 =  $linha['loja03'];
$loja04 =  $linha['loja04'];
$loja05 =  $linha['loja05'];
$loja06 =  $linha['loja06'];

}?>

        <select class="form-control form_forn" name="loja">
			<?php if($matriz == 'sim'){ ?><option value="MATRIZ"> LOJA 01</option>  <?php } ?>
			<?php if($loja02 == 'sim'){ ?><option value="LOJA 02"> LOJA 02</option> <?php } ?>
			<?php if($loja03 == 'sim'){ ?><option value="LOJA 03"> LOJA 03</option> <?php } ?>
			<?php if($loja04 == 'sim'){ ?><option value="LOJA 04"> LOJA 04</option> <?php } ?>
			<?php if($loja05 == 'sim'){ ?><option value="LOJA 05"> LOJA 05</option> <?php } ?>
			<?php if($loja06 == 'sim'){ ?><option value="LOJA 06"> LOJA 06</option> <?php } ?>
			<option value="TODOS"> TODAS </option>			
		
		</select>

        <input type="submit" value='Buscar' class="form-control form_data form_forn btn btn-warning">
      
</form>

<?php include_once 'footer.php' ?>