166 lines
3.0 KiB
PHP
166 lines
3.0 KiB
PHP
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Cotización</title>
|
|
|
|
<style>
|
|
body{
|
|
font-family: DejaVu Sans, sans-serif;
|
|
font-size: 12px;
|
|
color: #1f2937;
|
|
margin: 30px;
|
|
}
|
|
|
|
/* Encabezado */
|
|
.header{
|
|
border-bottom: 2px solid #22c55e;
|
|
padding-bottom: 10px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.header h1{
|
|
font-size: 20px;
|
|
margin: 0;
|
|
color: #111827;
|
|
}
|
|
|
|
.header p{
|
|
margin: 2px 0;
|
|
color: #4b5563;
|
|
}
|
|
|
|
/* Tabla */
|
|
.table{
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-top: 10px;
|
|
}
|
|
|
|
.table th{
|
|
background: #22c55e;
|
|
color: white;
|
|
padding: 8px;
|
|
font-weight: bold;
|
|
text-align: left;
|
|
font-size: 11px;
|
|
}
|
|
|
|
.table td{
|
|
padding: 7px;
|
|
border-bottom: 1px solid #e5e7eb;
|
|
font-size: 11px;
|
|
}
|
|
|
|
/* Totales */
|
|
.totales{
|
|
margin-top: 25px;
|
|
width: 40%;
|
|
float: right;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
.totales td{
|
|
padding: 6px;
|
|
}
|
|
|
|
.total-final{
|
|
font-size: 14px;
|
|
font-weight: bold;
|
|
border-top: 2px solid #000;
|
|
}
|
|
|
|
/* Footer */
|
|
.footer{
|
|
position: fixed;
|
|
bottom: 20px;
|
|
left: 30px;
|
|
right: 30px;
|
|
font-size: 10px;
|
|
color: #6b7280;
|
|
text-align: center;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="header">
|
|
<h1>COTIZACIÓN #{{ $cotizacion->id }}</h1>
|
|
<p>Fecha: {{ $cotizacion->created_at->format('d/m/Y') }}</p>
|
|
<p>Cliente: {{ $cotizacion->cliente->nombre ?? '' }}</p>
|
|
</div>
|
|
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Producto</th>
|
|
<th>Cant.</th>
|
|
<th>Precio</th>
|
|
<th>Desc %</th>
|
|
<th>Desc $</th>
|
|
<th>Total</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php
|
|
$subtotal = 0;
|
|
$totalDescuento = 0;
|
|
@endphp
|
|
|
|
@foreach($cotizacion->items as $item)
|
|
@php
|
|
$bruto = $item->cantidad * $item->precio_unitario;
|
|
$descMonto = $item->descuento_monto ?? 0;
|
|
$totalLinea = $bruto - $descMonto;
|
|
|
|
$subtotal += $bruto;
|
|
$totalDescuento += $descMonto;
|
|
@endphp
|
|
|
|
<tr>
|
|
<td>{{ $item->producto->nombre }}</td>
|
|
<td>{{ $item->cantidad }}</td>
|
|
<td>${{ number_format($item->precio_unitario,2) }}</td>
|
|
<td>{{ number_format($item->descuento_porcentaje ?? 0,2) }}%</td>
|
|
<td>${{ number_format($descMonto,2) }}</td>
|
|
<td>${{ number_format($totalLinea,2) }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
|
|
@php
|
|
$neto = $subtotal - $totalDescuento;
|
|
$iva = $neto * 0.16;
|
|
$total = $neto + $iva;
|
|
@endphp
|
|
|
|
<table class="totales">
|
|
<tr>
|
|
<td>Subtotal:</td>
|
|
<td>${{ number_format($subtotal,2) }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Descuento:</td>
|
|
<td>- ${{ number_format($totalDescuento,2) }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Subtotal Neto:</td>
|
|
<td>${{ number_format($neto,2) }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>IVA (16%):</td>
|
|
<td>${{ number_format($iva,2) }}</td>
|
|
</tr>
|
|
<tr class="total-final">
|
|
<td>Total:</td>
|
|
<td>${{ number_format($total,2) }}</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<div class="footer">
|
|
Documento generado automáticamente | {{ config('app.name') }}
|
|
</div>
|
|
|
|
</body>
|
|
</html> |