<?php
	session_start();
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Filtro movimiento</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap/css/bootstrap.min.css">
    <script src="css/bootstrap/js/bootstrap.bundle.min.js"></script>
    <link rel="icon" href="../images/icon.png">
    <style type="text/css">
		form{
			width: 80%;
			margin: 10% auto;
		}

		.form-floating{
			margin: 2% 0;
		}
	</style>
</head>
<body>
	<?php
		require 'nav.php';
		require 'conexion.php';
		$user = $_SESSION["user"];
		echo '
	<form action="movimientos.php" method="POST">
		<div class="form-floating">
			<input type="date" name="fecIni" id="fecIni" class="form-control">
			<label for="fecIni">Fecha inicio</label>
		</div>
		<div class="form-floating">
			<input type="date" name="fecFin" id="fecFin" class="form-control">
			<label for="fecFin">Fecha fin</label>
		</div>
		<div class="form-floating">
			<select class="form-select" id="fondo" name="fondo">
				<option></option>
		';
		$fondos = mysqli_query($con, "SELECT * FROM fondos WHERE User='$user'");
		while ($f = mysqli_fetch_assoc($fondos)){
			if ($f["Consec"] == $fondo){
				echo '
				<option value="', $f["Consec"],'" selected>', $f["Nombre"],'</option>
				';
			}
			else{
				echo '
				<option value="', $f["Consec"],'">', $f["Nombre"],'</option>
				';
			}
		}
		echo '
			</select>
			<label for="fondo">Fondo</label>
		</div>
		<div class="form-floating">
			<select class="form-select" id="tipo" name="tipo">
				<option></option>
		';
		$tipos = mysqli_query($con, "SELECT * FROM tipos WHERE User='$user'");
		while ($t = mysqli_fetch_assoc($tipos)){
			if ($t["Consec"] == $tipo){
				echo '
				<option value="', $t["Consec"],'" selected>', $t["Nombre"],'</option>
				';
			}
			else{
				echo '
				<option value="', $t["Consec"],'">', $t["Nombre"],'</option>
				';
			}
		}
		echo '
			</select>
			<label for="tipo">Tipo</label>
		</div>
		<button type="submit" class="btn btn-primary">Ver</button>
	</form>
		';
	?>
</body>
</html>

