194 lines
9.0 KiB
PHP
194 lines
9.0 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Facture DV Thanato</title>
|
|
<style>
|
|
@page { margin: 20mm 15mm; size: A4; }
|
|
body { font-family: Arial, sans-serif; font-size: 11px; line-height: 1.4; color: #000; margin: 0; padding: 0; }
|
|
.container { width: 100%; }
|
|
|
|
/* LOGO EN HAUT */
|
|
.logo-section { margin-bottom: 20px; }
|
|
.logo { width: 180px; height: auto; }
|
|
|
|
/* HEADER AVEC TABLE POUR ALIGNEMENT */
|
|
.header-table { width: 100%; margin-bottom: 30px; }
|
|
.header-table td { vertical-align: top; padding: 0; }
|
|
.header-left { width: 45%; }
|
|
.header-right { width: 55%; text-align: right; }
|
|
|
|
/* INFORMATIONS GAUCHE */
|
|
.invoice-info { line-height: 1.6; }
|
|
.info-line { margin: 5px 0; }
|
|
.info-line strong { display: inline-block; width: 140px; font-weight: bold; }
|
|
|
|
/* INFORMATIONS CLIENT DROITE */
|
|
.client-info { text-align: right; line-height: 1.5; font-size: 12px; }
|
|
.client-info strong { display: block; margin-bottom: 3px; font-size: 13px; }
|
|
|
|
.invoice-header { margin: 25px 0; }
|
|
.invoice-header h2 { font-size: 14px; margin: 5px 0; font-weight: bold; }
|
|
.invoice-period { font-size: 11px; margin: 5px 0; }
|
|
|
|
/* TABLEAU SERVICES */
|
|
.services-table { width: 100%; border-collapse: collapse; margin: 20px 0; }
|
|
.services-table th { background-color: #f0f0f0; border: 1px solid #ccc; padding: 8px; text-align: left; font-weight: bold; font-size: 11px; }
|
|
.services-table td { border: 1px solid #ccc; padding: 6px 8px; vertical-align: top; font-size: 10px; }
|
|
|
|
.ref-col { width: 12%; }
|
|
.label-col { width: 48%; }
|
|
.price-col { width: 13%; text-align: right; }
|
|
.qty-col { width: 10%; text-align: center; }
|
|
.amount-col { width: 17%; text-align: right; }
|
|
|
|
/* LIGNES SPÉCIALES */
|
|
.date-row { background-color: #f8f8f8; font-weight: bold; }
|
|
.date-row td { padding: 8px; border: none; border-bottom: 1px solid #ddd; text-align: center; }
|
|
|
|
.deceased-row { font-style: italic; background-color: #fafafa; }
|
|
.deceased-row td { padding: 8px; border: none; font-weight: bold; }
|
|
|
|
/* TOTAUX */
|
|
.totals-section { margin-top: 30px; }
|
|
.totals-table { width: 300px; float: right; border-collapse: collapse; }
|
|
.totals-table td { padding: 8px 12px; font-size: 12px; }
|
|
.total-label { text-align: right; font-weight: bold; width: 60%; }
|
|
.total-amount { text-align: right; font-weight: bold; width: 40%; }
|
|
.total-row-ht { border-top: 1px solid #ccc; }
|
|
.total-row-final { border-top: 2px solid #000; font-size: 13px; }
|
|
|
|
/* CLEAR FLOAT */
|
|
.clear { clear: both; }
|
|
|
|
/* MENTIONS LÉGALES */
|
|
.legal-section { margin-top: 40px; padding-top: 20px; border-top: 1px solid #ccc; }
|
|
.legal-text { font-size: 9px; line-height: 1.4; margin-bottom: 20px; text-align: justify; }
|
|
.bank-info { margin: 20px 0; font-size: 10px; line-height: 1.5; }
|
|
.bank-info strong { display: inline-block; width: 150px; }
|
|
.company-footer { margin-top: 30px; padding: 15px; background-color: #f5f5f5; font-size: 10px; line-height: 1.5; }
|
|
.company-footer strong { display: block; margin-bottom: 5px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<!-- Logo en haut à gauche -->
|
|
<div class="logo-section">
|
|
<img src="data:image/png;base64,<?= $logo_base64 ?>" alt="<?= htmlspecialchars($company['name']) ?>" class="logo">
|
|
</div>
|
|
|
|
<!-- Header avec table pour compatibilité dompdf -->
|
|
<table class="header-table">
|
|
<tr>
|
|
<td class="header-left">
|
|
<div class="invoice-info">
|
|
<div class="info-line">
|
|
<strong>Date :</strong><?= htmlspecialchars($facture['date']) ?>
|
|
</div>
|
|
<div class="info-line">
|
|
<strong>Échéance :</strong><?= htmlspecialchars($facture['echeance']) ?>
|
|
</div>
|
|
<div class="info-line">
|
|
<strong>Mode de paiement :</strong>Virement
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td class="header-right">
|
|
<div class="client-info">
|
|
<strong><?= htmlspecialchars($client['name']) ?></strong>
|
|
<?= htmlspecialchars($client['address']) ?><br>
|
|
<?= htmlspecialchars($client['city']) ?><br>
|
|
<?php if (!empty($client['siret'])): ?>
|
|
SIRET: <?= htmlspecialchars($client['siret']) ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<!-- Numéro de facture -->
|
|
<div class="invoice-header">
|
|
<h2>Facture <?= htmlspecialchars($facture['number']) ?></h2>
|
|
<div class="invoice-period">Période : du <?= htmlspecialchars($facture['period_start']) ?> au <?= htmlspecialchars($facture['period_end']) ?></div>
|
|
</div>
|
|
|
|
<!-- Tableau des services -->
|
|
<table class="services-table">
|
|
<thead>
|
|
<tr>
|
|
<th class="ref-col">Référence</th>
|
|
<th class="label-col">Libellé</th>
|
|
<th class="price-col">P.U HT</th>
|
|
<th class="qty-col">Quantité</th>
|
|
<th class="amount-col">Montant HT</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($groupedArticles as $dateGroup): ?>
|
|
<!-- Ligne de date centrée -->
|
|
<tr class="date-row">
|
|
<td colspan="5"><strong><?= htmlspecialchars($dateGroup['date']) ?></strong></td>
|
|
</tr>
|
|
|
|
<?php foreach ($dateGroup['defunts'] as $defunt): ?>
|
|
<!-- Ligne du défunt -->
|
|
<tr class="deceased-row">
|
|
<td colspan="5"><?= htmlspecialchars($defunt['nom']) ?></td>
|
|
</tr>
|
|
|
|
<!-- Services pour ce défunt -->
|
|
<?php foreach ($defunt['services'] as $service): ?>
|
|
<tr>
|
|
<td class="ref-col"><?= htmlspecialchars($service['reference']) ?></td>
|
|
<td class="label-col"><?= htmlspecialchars($service['description']) ?></td>
|
|
<td class="price-col"><?= htmlspecialchars($service['prix_ht']) ?> €</td>
|
|
<td class="qty-col"><?= htmlspecialchars($service['quantite']) ?></td>
|
|
<td class="amount-col"><?= htmlspecialchars($service['prix_ttc']) ?> €</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endforeach; ?>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<!-- Section totaux -->
|
|
<div class="totals-section">
|
|
<table class="totals-table">
|
|
<tr class="total-row-ht">
|
|
<td class="total-label">Total HT</td>
|
|
<td class="total-amount"><?= htmlspecialchars($totals['total_ht']) ?> €</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="total-label"><?= htmlspecialchars($totals['tva_label']) ?></td>
|
|
<td class="total-amount"><?= htmlspecialchars($totals['total_tva']) ?> €</td>
|
|
</tr>
|
|
<tr class="total-row-final">
|
|
<td class="total-label">Montant total</td>
|
|
<td class="total-amount"><?= htmlspecialchars($totals['total_ttc']) ?> €</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="clear"></div>
|
|
|
|
<!-- Mentions légales -->
|
|
<div class="legal-section">
|
|
<div class="legal-text">
|
|
<?= nl2br(htmlspecialchars($legal_text)) ?>
|
|
</div>
|
|
|
|
<div class="bank-info">
|
|
<div><strong>Coordonnées bancaires</strong></div>
|
|
<div><strong>IBAN:</strong> <?= htmlspecialchars($bank['iban']) ?></div>
|
|
<div><strong>BIC:</strong> <?= htmlspecialchars($bank['swift']) ?></div>
|
|
</div>
|
|
|
|
<div class="company-footer">
|
|
<strong><?= htmlspecialchars($company['name']) ?></strong>
|
|
<?= htmlspecialchars($company['address']) ?>, <?= htmlspecialchars($company['city']) ?><br>
|
|
<?= htmlspecialchars($bank['rcs']) ?> - Code NAF 9603Z
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|