<?php
|
|
|
|
/**
|
|
* List all vehiculos with a link to edit
|
|
*/
|
|
|
|
require "../config.php";
|
|
require "../common.php";
|
|
|
|
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();
|
|
}
|
|
?>
|
|
<?php require "../templates/header.php"; ?>
|
|
<section id="five" class="main style1">
|
|
<div class="container">
|
|
<section>
|
|
<h2>Actualizar repostajes</h2>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Fecha</th>
|
|
<th>Vehículo</th>
|
|
<th>Kilómetros</th>
|
|
<th>Litros</th>
|
|
<th>Descuento</th>
|
|
<th>Precio/litro</th>
|
|
<th>Importe</th>
|
|
<th>Editar</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($result as $row) : ?>
|
|
<tr>
|
|
<td><?php echo escape($row["identificador"]); ?></td>
|
|
<td><?php echo escape($row["fecha"]); ?></td>
|
|
<td><?php echo escape($row["vehiculo"]); ?></td>
|
|
<td><?php echo escape($row["kms"]); ?></td>
|
|
<td><?php echo escape(str_replace('.', ',',$row["litros"])); ?></td>
|
|
<td><?php echo escape(str_replace('.', ',',$row["descuento"])); ?></td>
|
|
<td><?php echo escape(str_replace('.', ',',$row["precioxlitro"])); ?></td>
|
|
<td><?php echo escape(str_replace('.', ',',$row["importe"])); ?></td>
|
|
<td><a
|
|
href="update-single.php?identificador=<?php echo escape($row["identificador"]); ?>">Edit</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<?php require "../templates/footer.php"; ?>
|