preparando el imprimir

This commit is contained in:
2025-10-12 21:42:04 +02:00
parent 6641c1f077
commit 26c2ca543a
41 changed files with 1325 additions and 208 deletions

View File

@ -0,0 +1,195 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="es">
<head>
<meta charset="UTF-8" />
<title th:text="'Presupuesto ' + ${numero}">Presupuesto</title>
<link rel="stylesheet" href="/assets/css/presupuesto.css" />
</head>
<body>
<!-- Header -->
<header class="doc-header">
<div class="brand">
<img src="/img/logo-light.png" alt="ImprimeLibros" class="logo" />
<div class="brand-meta">
<div class="company-name" th:text="${empresa?.nombre} ?: 'ImprimeLibros ERP'">ImprimeLibros ERP</div>
<div class="company-meta">
<span th:text="${empresa?.direccion} ?: 'C/ Dirección 123, 28000 Madrid'">C/ Dirección 123, 28000 Madrid</span><br/>
<span th:text="${empresa?.telefono} ?: '+34 600 000 000'">+34 600 000 000</span> ·
<span th:text="${empresa?.email} ?: 'info@imprimelibros.com'">info@imprimelibros.com</span><br/>
<span th:text="${empresa?.cif} ?: 'B-12345678'">B-12345678</span>
</div>
</div>
</div>
<div class="doc-title">
<div class="title-main">PRESUPUESTO</div>
<table class="doc-info">
<tr>
<td></td>
<td class="right" th:text="${numero}">2025-00123</td>
</tr>
<tr>
<td>Fecha</td>
<td class="right" th:text="${#temporals.format(fecha, 'dd/MM/yyyy')}">12/10/2025</td>
</tr>
<tr th:if="${validezDias != null}">
<td>Validez</td>
<td class="right" th:text="${validezDias} + ' días'">30 días</td>
</tr>
</table>
</div>
</header>
<!-- Datos cliente / proyecto -->
<section class="blocks">
<div class="block">
<div class="block-title">Cliente</div>
<div class="block-body">
<div class="row">
<span class="label">Nombre:</span>
<span class="value" th:text="${cliente?.nombre} ?: '-'">Editorial Ejemplo S.L.</span>
</div>
<div class="row">
<span class="label">CIF/NIF:</span>
<span class="value" th:text="${cliente?.cif} ?: '-'">B-00000000</span>
</div>
<div class="row">
<span class="label">Dirección:</span>
<span class="value" th:text="${cliente?.direccion} ?: '-'">Av. de los Libros, 45</span>
</div>
<div class="row" th:if="${cliente?.cp != null or cliente?.poblacion != null or cliente?.provincia != null}">
<span class="label">Localidad:</span>
<span class="value">
<span th:text="${cliente?.cp} ?: ''"></span>
<span th:text="${cliente?.poblacion} ?: ''"></span>
<span th:text="${cliente?.provincia} ?: ''"></span>
</span>
</div>
<div class="row" th:if="${cliente?.email != null}">
<span class="label">Email:</span>
<span class="value" th:text="${cliente?.email}">comercial@editorial.com</span>
</div>
</div>
</div>
<div class="block">
<div class="block-title">Proyecto</div>
<div class="block-body">
<div class="row" th:if="${titulo != null}">
<span class="label">Título:</span>
<span class="value" th:text="${titulo}">Libro de Ejemplo</span>
</div>
<div class="row" th:if="${autor != null}">
<span class="label">Autor:</span>
<span class="value" th:text="${autor}">Autor/a</span>
</div>
<div class="row" th:if="${isbn != null}">
<span class="label">ISBN:</span>
<span class="value" th:text="${isbn}">978-1-2345-6789-0</span>
</div>
<div class="row" th:if="${ancho != null and alto != null}">
<span class="label">Formato:</span>
<span class="value">
<span th:text="${ancho}">150</span> × <span th:text="${alto}">210</span> mm
<span th:if="${formatoPersonalizado == true}">(personalizado)</span>
</span>
</div>
<div class="row" th:if="${paginasNegro != null or paginasColor != null}">
<span class="label">Páginas:</span>
<span class="value">
<span th:if="${paginasNegro != null}" th:text="'B/N ' + ${paginasNegro}"></span>
<span th:if="${paginasColor != null}" th:text="' · Color ' + ${paginasColor}"></span>
</span>
</div>
<div class="row" th:if="${tiradas != null}">
<span class="label">Tiradas:</span>
<span class="value" th:text="${#strings.arrayJoin(tiradas, ', ')}">300, 500, 1000</span>
</div>
</div>
</div>
</section>
<!-- Conceptos principales -->
<section class="table-section">
<div class="section-title">Detalle del presupuesto</div>
<table class="items">
<thead>
<tr>
<th class="col-desc">Descripción</th>
<th class="col-center">Uds</th>
<th class="col-right">Precio unit.</th>
<th class="col-right">Dto.</th>
<th class="col-right">Importe</th>
</tr>
</thead>
<tbody>
<!-- Línea tipo: interior, cubierta, manipulado, etc. -->
<tr th:each="l : ${lineas}">
<td class="col-desc">
<div class="desc" th:text="${l.descripcion}">Impresión interior B/N 80 g</div>
<div class="meta" th:if="${l.meta != null}" th:text="${l.meta}">
300 páginas · offset 80 g · tinta negra
</div>
</td>
<td class="col-center" th:text="${l.uds}">1000</td>
<td class="col-right" th:text="${#numbers.formatDecimal(l.precio, 1, 'POINT', 2, 'COMMA')}">2,1500</td>
<td class="col-right" th:text="${l.dto != null ? #numbers.formatDecimal(l.dto, 1, 'POINT', 2, 'COMMA') + '%':'-'}">-</td>
<td class="col-right" th:text="${#numbers.formatDecimal(l.importe, 1, 'POINT', 2, 'COMMA')}">2.150,00</td>
</tr>
<!-- Servicios extra (si vienen) -->
<tr class="group-header" th:if="${servicios != null and !#lists.isEmpty(servicios)}">
<td colspan="5">Servicios adicionales</td>
</tr>
<tr th:each="s : ${servicios}">
<td class="col-desc">
<div class="desc" th:text="${s.descripcion}">Transporte</div>
</td>
<td class="col-center" th:text="${s.unidades}">1</td>
<td class="col-right" th:text="${#numbers.formatDecimal(s.precio, 1, 'POINT', 2, 'COMMA')}">90,00</td>
<td class="col-right">-</td>
<td class="col-right" th:text="${#numbers.formatDecimal(s.unidades * s.precio, 1, 'POINT', 2, 'COMMA')}">90,00</td>
</tr>
</tbody>
</table>
</section>
<!-- Totales -->
<section class="totals">
<table class="totals-table">
<tr>
<td>Base imponible</td>
<td class="right" th:text="${#numbers.formatDecimal(baseImponible, 1, 'POINT', 2, 'COMMA')}">2.180,00</td>
</tr>
<tr>
<td th:text="'IVA (' + ${ivaTipo} + '%)'">IVA (21%)</td>
<td class="right" th:text="${#numbers.formatDecimal(ivaImporte, 1, 'POINT', 2, 'COMMA')}">457,80</td>
</tr>
<tr class="total-row">
<td><strong>Total</strong></td>
<td class="right"><strong th:text="${#numbers.formatDecimal(totalConIva, 1, 'POINT', 2, 'COMMA')}">2.637,80</strong></td>
</tr>
<tr th:if="${peso != null}">
<td>Peso estimado</td>
<td class="right" th:text="${#numbers.formatDecimal(peso, 1, 'POINT', 2, 'COMMA')} + ' kg'">120,00 kg</td>
</tr>
</table>
</section>
<!-- Observaciones / condiciones -->
<section class="notes" th:if="${observaciones != null or condiciones != null}">
<div class="section-title">Observaciones</div>
<div class="note-text" th:utext="${observaciones}">Presupuesto válido 30 días.</div>
<div class="section-title" th:if="${condiciones != null}">Condiciones</div>
<div class="note-text" th:utext="${condiciones}">
Entrega estimada 7-10 días laborables tras confirmación de artes finales.
</div>
</section>
<!-- Footer -->
<footer class="doc-footer">
<div class="footer-left" th:text="${empresa?.web} ?: 'www.imprimelibros.com'">www.imprimelibros.com</div>
<div class="footer-right">Página <span class="page-number"></span> / <span class="page-count"></span></div>
</footer>
</body>
</html>