You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
172 lines
5.0 KiB
172 lines
5.0 KiB
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Reporte de Inventario</title>
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
<style>
|
|
/* Estilos generales */
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background-color: #f4f6f9;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
h1 {
|
|
text-align: center;
|
|
color: #333;
|
|
margin-top: 20px;
|
|
font-size: 2rem; /* Letra más grande */
|
|
}
|
|
|
|
/* Contenedor principal */
|
|
.container {
|
|
width: 80%;
|
|
margin: 0 auto;
|
|
background-color: #fff;
|
|
padding: 20px;
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
border-radius: 8px;
|
|
}
|
|
|
|
/* Estilo para el gráfico */
|
|
#grafico {
|
|
max-width: 600px;
|
|
margin: 20px auto;
|
|
height: 400px; /* Ajusta el tamaño del gráfico */
|
|
}
|
|
|
|
/* Estilos de la tabla */
|
|
table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
th, td {
|
|
border: 1px solid #ddd;
|
|
padding: 10px 15px; /* Celdas más pequeñas */
|
|
text-align: left;
|
|
font-size: 1.2rem; /* Letras un poco más grandes */
|
|
}
|
|
|
|
th {
|
|
background-color: #0066cc; /* Color azul */
|
|
color: white;
|
|
font-weight: bold;
|
|
}
|
|
|
|
td {
|
|
background-color: #f9f9f9;
|
|
}
|
|
|
|
tr:nth-child(even) td {
|
|
background-color: #f1f1f1;
|
|
}
|
|
|
|
tr:hover td {
|
|
background-color: #ddd;
|
|
}
|
|
|
|
/* Estilo de los bordes */
|
|
table, th, td {
|
|
border-radius: 5px;
|
|
border: 1px solid #e0e0e0;
|
|
}
|
|
|
|
/* Estilos para la paginación y detalles si se desean agregar */
|
|
.pagination {
|
|
margin-top: 20px;
|
|
text-align: center;
|
|
}
|
|
.pagination a {
|
|
margin: 0 5px;
|
|
text-decoration: none;
|
|
padding: 10px 15px;
|
|
background-color: #0066cc; /* Color azul */
|
|
color: white;
|
|
border-radius: 4px;
|
|
}
|
|
.pagination a:hover {
|
|
background-color: #005bb5; /* Tono más oscuro de azul */
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container">
|
|
<h1>Reporte de Inventario</h1>
|
|
|
|
<!-- Canvas para el gráfico de pastel -->
|
|
<canvas id="grafico"></canvas>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Bodega</th>
|
|
<th>Artículo</th>
|
|
<th>Cantidad</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for item in inventarios %}
|
|
<tr>
|
|
<td>{{ item.id }}</td>
|
|
<td>{{ item.bodega.nombre_bodega }}</td>
|
|
<td>{{ item.articulo.nombre_articulo }}</td>
|
|
<td>{{ item.cantidad }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<script>
|
|
const ctx = document.getElementById('grafico').getContext('2d');
|
|
|
|
const productos = {{ productos|safe }};
|
|
const cantidades = {{ cantidades|safe }};
|
|
const medidas = {{ medidas|safe }}.map((medida, index) => productos[index] + ' (' + medida + ')');
|
|
|
|
const myChart = new Chart(ctx, {
|
|
type: 'pie', // Tipo de gráfico de pastel
|
|
data: {
|
|
labels: medidas, // Nombres de los productos con medida
|
|
datasets: [{
|
|
label: 'Cantidad de Productos',
|
|
data: cantidades, // Cantidades de productos
|
|
backgroundColor: [
|
|
'rgba(75, 192, 192, 0.6)',
|
|
'rgba(153, 102, 255, 0.6)',
|
|
'rgba(255, 159, 64, 0.6)',
|
|
'rgba(54, 162, 235, 0.6)',
|
|
'rgba(255, 99, 132, 0.6)',
|
|
'rgba(255, 205, 86, 0.6)',
|
|
'rgba(201, 203, 207, 0.6)'
|
|
], // Colores para cada sección del gráfico
|
|
borderColor: 'rgba(255, 255, 255, 0.7)', // Color del borde
|
|
borderWidth: 1
|
|
}]
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
plugins: {
|
|
legend: {
|
|
position: 'top',
|
|
},
|
|
tooltip: {
|
|
callbacks: {
|
|
label: function(tooltipItem) {
|
|
return tooltipItem.label + ': ' + tooltipItem.raw + ' productos';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html> |