<?php
|
|
|
|
/**
|
|
* Use an HTML form to create a new entry in the
|
|
* users table.
|
|
*
|
|
*/
|
|
|
|
require './config.php';
|
|
require './common.php';
|
|
|
|
/**
|
|
* Esto es para comprobar si existe la BD
|
|
* Además, nos permite seleccionar los últimos repostajes y otras cosas que queramos
|
|
*/
|
|
try {
|
|
$connection = new PDO($dsn, $username, $password, $options);
|
|
|
|
$sql = "SELECT * FROM carburante ORDER BY fecha DESC";
|
|
|
|
$statement = $connection->prepare($sql);
|
|
$statement->execute();
|
|
|
|
$result = $statement->fetchAll();
|
|
} catch(PDOException $error) {
|
|
echo $sql . "<br>" . $error->getMessage();
|
|
}
|
|
|
|
require "./cabecera.php";?>
|
|
|
|
<div class="app-wrapper">
|
|
|
|
<div class="app-content pt-3 p-md-3 p-lg-4">
|
|
<div class="container-xl">
|
|
|
|
<div class="row g-3 mb-4 align-items-center justify-content-between">
|
|
<div class="col-auto">
|
|
<h1 class="app-page-title mb-0">Editar repostajes</h1>
|
|
</div>
|
|
</div><!--//row-->
|
|
|
|
|
|
<div class="tab-content" id="orders-table-tab-content">
|
|
<div class="tab-pane fade show active" id="orders-all" role="tabpanel" aria-labelledby="orders-all-tab">
|
|
<div class="app-card app-card-orders-table shadow-sm mb-5">
|
|
<div class="app-card-body">
|
|
<div class="table-responsive">
|
|
<table class="table app-table-hover mb-0 text-left">
|
|
<thead>
|
|
<tr>
|
|
<th class="cell">#</th>
|
|
<th class="cell">Fecha</th>
|
|
<th class="cell">Vehículo</th>
|
|
<th class="cell">Kilómetros</th>
|
|
<th class="cell">Litros</th>
|
|
<th class="cell">Descuento</th>
|
|
<th class="cell">Precio/litro</th>
|
|
<th class="cell">Importe</th>
|
|
<th class="cell">Editar</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($result as $row) : ?>
|
|
<tr>
|
|
<td class="cell"><?php echo escape($row["identificador"]); ?></td>
|
|
<td class="cell"><?php echo escape($row["fecha"]); ?></td>
|
|
<td class="cell"><?php echo escape($row["vehiculo"]); ?></td>
|
|
<td class="cell"><?php echo escape($row["kms"]); ?></td>
|
|
<td class="cell"><?php echo escape(str_replace('.', ',',$row["litros"])); ?></td>
|
|
<td class="cell"><?php echo escape(str_replace('.', ',',$row["descuento"])); ?></td>
|
|
<td class="cell"><?php echo escape(str_replace('.', ',',$row["precioxlitro"])); ?></td>
|
|
<td class="cell"><?php echo escape(str_replace('.', ',',$row["importe"])); ?></td>
|
|
<td class="cell"><a
|
|
href="actualizarepostaje.php?identificador=<?php echo escape($row["identificador"]); ?>">Edit</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div><!--//table-responsive-->
|
|
|
|
</div><!--//app-card-body-->
|
|
</div><!--//app-card-->
|
|
|
|
</div><!--//tab-pane-->
|
|
</div><!--//tab-content-->
|
|
|
|
|
|
|
|
</div><!--//container-fluid-->
|
|
</div><!--//app-content-->
|
|
|
|
<?php require './templates/footer.php';?>
|
|
<!-- Javascript -->
|
|
<script src="assets/plugins/popper.min.js"></script>
|
|
<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
|
|
|
|
|
|
<!-- Page Specific JS -->
|
|
<script src="assets/js/app.js"></script>
|
|
</body>
|
|
</html>
|
|
|