Files
pos_heidiver/resources/views/emails/reporte-ventas.blade.php
T
2026-01-06 15:35:59 -05:00

90 lines
2.9 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<style>
table {
width: 100%;
border-collapse: collapse;
font-size: 12px; /* Reduce el tamaño de la fuente */
}
th, td {
border: 1px solid #ddd;
padding: 6px; /* Reduce el padding para que la tabla quede más compacta */
}
th {
background-color: #f2f2f2;
text-align: left;
}
.total {
font-weight: bold;
font-size: 14px; /* Mantén el tamaño de la fuente mayor para los totales */
}
</style>
</head>
<body>
<h2 style="font-size: 16px;">Reporte de Ventas Variedades La revolución de los Precios bajos</h2> <!-- Reduce también el tamaño del título -->
<p style="font-size: 12px;">Desde: {{ $fromDate }} | Hasta: {{ $toDate }}</p>
<table>
<thead>
<tr>
<th>Fecha</th>
<th>Cliente</th>
<th>Total</th>
<th>Detalles</th>
</tr>
</thead>
<tbody>
@php
$totalGeneral = 0;
$ventasPorDia = [];
@endphp
@foreach($ventas as $venta)
@php
$fecha = $venta->created_at->format('Y-m-d');
$ventasPorDia[$fecha][] = $venta;
$totalGeneral += $venta->total;
@endphp
@endforeach
@foreach($ventasPorDia as $fecha => $ventasDelDia)
<tr>
<td colspan="4" class="total">Ventas del día: {{ $fecha }}</td>
</tr>
@php
$totalDia = 0;
@endphp
@foreach($ventasDelDia as $venta)
<tr>
<td>{{ $venta->created_at->format('Y-m-d') }}</td>
<td>{{ $venta->cliente->nombre ?? 'Sin cliente' }}</td>
<td>${{ number_format($venta->total, 2) }}</td>
<td>
@foreach($venta->detalles as $detalle)
{{ $detalle->producto->nombre ?? 'Producto eliminado' }} x {{ $detalle->cantidad }}<br>
@endforeach
</td>
</tr>
@php
$totalDia += $venta->total;
@endphp
@endforeach
<tr>
<td colspan="2" class="total">Total del día</td>
<td class="total">${{ number_format($totalDia, 2) }}</td>
<td></td>
</tr>
@endforeach
<tr>
<td colspan="2" class="total">Total General</td>
<td class="total">${{ number_format($totalGeneral, 2) }}</td>
<td></td>
</tr>
</tbody>
</table>
</body>
</html>