Compare commits

..

16 Commits

Author SHA1 Message Date
61332b2b09 fix change is_tva in tva on Bdd.php 2025-08-24 21:44:44 +03:00
96d117ead5 feat add is_tva group facture 2025-08-24 21:29:34 +03:00
477196fa39 fix remove filigran_pdf in header 2025-08-24 21:23:39 +03:00
64d54fe4f5 feat add is_tva client 2025-08-19 23:02:52 +03:00
020244b4e0 fix delete signature mail 2025-08-19 17:31:18 +03:00
fb94393033 fix gitignore 2025-08-19 17:27:24 +03:00
Tiavina
3a05613b60 add dot in caution text 2025-07-17 12:05:25 +03:00
Tiavina
1f03b91871 update default email cc 2025-07-17 12:05:03 +03:00
Tiavina
760902963b add caution text in attestation email templates 2025-07-17 12:00:53 +03:00
Tiavina
21e8ee8d67 hotfiexs hfc 2025-07-16 15:39:33 +03:00
narindraezway
de0ed31ccb Merge branch 'staging' into production-dv-thanato 2025-07-11 11:03:04 +03:00
narindraezway
39f7cb6247 Refactor email signature handling to include user name in footer content 2025-07-09 16:44:45 +03:00
narindraezway
fd2754c9eb Update admin app ID 2025-07-09 16:44:09 +03:00
narindraezway
69eea552fb Fix signature image dimensions email 2025-07-09 16:43:13 +03:00
narindraezway
4db0935d71 Merge branch 'staging' into production-dv-thanato 2025-07-09 13:52:25 +03:00
Tiavina
9f8c3dc8ec log production dv thanato 2025-06-24 12:03:06 +03:00
7 changed files with 184 additions and 121 deletions

4
.gitignore vendored
View File

@ -5,10 +5,6 @@
!.gitignore
!Jenkinsfile
# Dossiers à inclure
!calendar/
!gestion/
# Inclure tout le contenu de ces dossiers
!calendar/**
!gestion/**

View File

@ -13,4 +13,7 @@ abstract class BddConstant
const ISLEAVEPROPERTYONVCALENDAR = "ISLEAVE";
const DEFAULT_THANATOS_GROUP_NAME = "Thanatos";
const DEFAULT_ATTESTATION_CC_EMAIL = "attestation@h-f-c.info";
const DEFAULT_INVOICE_CC_EMAIL = "attestation@h-f-c.info";
}

View File

@ -116,10 +116,8 @@ class InvoiceController extends Controller
"<p> Vous trouverez en pièce jointe la facture des soins de " . $factureDate . ".</p>".
$signature
);
$appAdminEmail = $this->gestionRepository->getUserEmailByNextcloudId(BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD);
if ($appAdminEmail) {
$message->setCc([$appAdminEmail]);
}
$appAdminEmail = BddConstant::DEFAULT_INVOICE_CC_EMAIL;
$message->setCc([$appAdminEmail]);
$this->mailer->send($message);
$this->gestionRepository->setFactureSentDate($factureId);

View File

@ -1844,51 +1844,48 @@ class PageController extends Controller
}
public function sendAttachmentToClientByDefunt($defuntId, $ff_pdf, $to, $subject, $body, $addName = false)
{
$devis = $this->myDb->getDevisOfDefunt($defuntId);
if($devis != null) {
// try {
$senderEmailAddress = $this->config->getSystemValue('mail_from_address') ?? null;
$senderEmailDomain = $this->config->getSystemValue('mail_domain') ?? null;
$senderEmail = null;
if($senderEmailAddress && $senderEmailDomain) {
$senderEmail = $senderEmailAddress.'@'.$senderEmailDomain;
}
$client_email = $to;
$client_nom = $devis['client_nom'];
$data = $this->storage->get($ff_pdf)->getContent();
$message = $this->mailer->createMessage();
$message->setTo(recipients: [$client_email => $client_nom]);
// $message->setFrom([$client_email => $client_nom]);
$content = $this->mailer->createAttachment($data, basename($ff_pdf), "application/pdf");
$message->attach($content);
$message->setSubject($subject);
$body_text = $addName ? ($body." de ".$devis['defunt_nom']) : $body;
$signature = $this->mailerService->getFooterContent($this->getUserNameForEmailSignature());
$message->setHtmlBody(
"<p>Bonjour.</p>".
"<p>$body_text</p>".
$signature
);
$appAdminEmail = $this->myDb->getUserEmailByNextcloudId(BddConstant::DEFAULT_ADMIN_APP_ID_NEXTCLOUD);
if ($appAdminEmail) {
$message->setCc([$appAdminEmail]);
}
$this->mailer->send($message);
return new DataResponse("", 200, ['Content-Type' => 'application/json']);
// } catch (Exception $e) {
// return new DataResponse("Is your global mail server configured in Nextcloud ?", 500, ['Content-Type' => 'application/json']);
// }
}
}
public function getUserNameForEmailSignature()
{
$configs = json_decode($this->myDb->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
$currentConfig = $configs[0];
return $currentConfig->nom . " " . $currentConfig->prenom;
}
public function sendAttachmentToClientByDefunt($defuntId, $ff_pdf, $to,$subject, $body, $addName = false){
$devis = $this->myDb->getDevisOfDefunt($defuntId);
if($devis != null){
// try {
$senderEmailAddress = $this->config->getSystemValue('mail_from_address') ?? null;
$senderEmailDomain = $this->config->getSystemValue('mail_domain') ?? null;
$senderEmail = null;
if($senderEmailAddress && $senderEmailDomain){
$senderEmail = $senderEmailAddress.'@'.$senderEmailDomain;
}
$client_email = $to;
$client_nom = $devis['client_nom'];
$data = $this->storage->get($ff_pdf)->getContent();
$message = $this->mailer->createMessage();
$message->setTo(recipients: [$client_email => $client_nom]);
// $message->setFrom([$client_email => $client_nom]);
$content = $this->mailer->createAttachment($data, basename($ff_pdf), "application/pdf");
$message->attach($content);
$message->setSubject($subject);
$body_text = $addName ? ($body." de ".$devis['defunt_nom'] ) : $body;
$cautionText = "MERCI DE NE PAS REPONDRE A CET EMAIL.";
$signature = $this->mailerService->getFooterContent($this->getUserNameForEmailSignature());
$message->setHtmlBody(
"<p>Bonjour.</p>".
"<p>$body_text</p>".
"<p>$cautionText</p>"
);
$appAdminEmail = BddConstant::DEFAULT_ATTESTATION_CC_EMAIL;
$message->setCc([$appAdminEmail]);
$this->mailer->send($message);
return new DataResponse("", 200, ['Content-Type' => 'application/json']);
// } catch (Exception $e) {
// return new DataResponse("Is your global mail server configured in Nextcloud ?", 500, ['Content-Type' => 'application/json']);
// }
}
}
public function getUserNameForEmailSignature (){
$configs = json_decode($this->myDb->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
$currentConfig = $configs[0];
return $currentConfig->nom . " " . $currentConfig->prenom;
}
/**
* @NoAdminRequired

View File

@ -4723,11 +4723,11 @@ COMMENTAIRES: ".$comment;
FROM ".self::DEFAULT_TABLE_PREFIX."users as users
JOIN .".self::DEFAULT_TABLE_PREFIX."group_user group_user ON users.uid = group_user.uid
LEFT JOIN ".$this->tableprefix."thanato as thanato on users.uid = thanato.fk_user_uuid
WHERE group_user.gid = ? AND
WHERE LOWER(group_user.gid) = ? AND
thanato.fk_user_uuid IS NULL;
";
return $this->execSQL($sql, [BddConstant::DEFAULT_THANATOS_GROUP_NAME]);
return $this->execSQL($sql,[strtolower(BddConstant::DEFAULT_THANATOS_GROUP_NAME)]);
}
public function doDevisIdsListIdsBelongsToTheSameClientFacturationGroup(array $devisIds)
@ -5318,7 +5318,7 @@ COMMENTAIRES: ".$comment;
$configuration = $this->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD);
$configuration = json_decode($configuration);
$currentConfig = $configuration[0];
$tvaValue = $currentConfig->tva_default;
$isFactureSingleClient = $facture['fk_client_id'] != null
&& $facture['fk_client_id'] != 0;
@ -5329,6 +5329,21 @@ COMMENTAIRES: ".$comment;
$devis = $this->getDevisByFkFactureId($factureId);
$factureGroupIsRelatedToAnyDevis = $devis != null;
// LOGIQUE TVA SIMPLIFIÉE
$tvaValue = (float)$currentConfig->tva_default;
$isTvaApplicable = true;
// Récupérer le statut TVA du client de cette facture
$clientId = $facture['fk_client_id'];
if ($clientId != null && $clientId != 0) {
$client = $this->getClientById($clientId);
$client = $this->getClientById($clientId);
if (isset($client['tva']) && $client['tva'] == 0) {
$isTvaApplicable = false;
$tvaValue = 0;
}
}
if($isFactureSingleClient) {
$client = $this->getClientById($facture['fk_client_id']);
@ -5337,6 +5352,7 @@ COMMENTAIRES: ".$comment;
$facture['client_address'] = $client["client_address"];
$facture['siret'] = $client["client_legal_one"];
$facture['mail'] = $client["client_mail"];
if (!$factureGroupIsRelatedToAnyDevis) {
$devisList = $this->getDevisDataByClientIdAndMonthYear(
$facture['fk_client_id'],
@ -5344,7 +5360,6 @@ COMMENTAIRES: ".$comment;
$facture['year'],
$devisMentionFilters
);
} else {
$devisList = $this->getDevisDataGroupByFactureId($factureId, $devisMentionFilters);
}
@ -5355,6 +5370,7 @@ COMMENTAIRES: ".$comment;
$facture['client_address'] = $clientGroupFacturation["address"] . ' - ' .$clientGroupFacturation["postal_code"] . ' ' . $clientGroupFacturation['city'];
$facture['siret'] = $clientGroupFacturation["siret_number"];
$facture['mail'] = $clientGroupFacturation["email"];
if (!$factureGroupIsRelatedToAnyDevis) {
$devisList = $this->getDevisDataByClientGroupFacturationIdAndMonthYear(
$facture['fk_client_group_facturation_id'],
@ -5366,22 +5382,36 @@ COMMENTAIRES: ".$comment;
$devisList = $this->getDevisDataGroupByFactureId($factureId, $devisMentionFilters);
}
}
$factureTotalHt = 0;
$factureTotalTva = 0;
$factureTotalTtc = 0;
foreach($devisList as &$currentDevis) {
$totalHt = 0;
$totalTva = 0;
$totalTtc = 0;
$devisProducts = $this->getDevisProduits($currentDevis['devis_id']);
foreach($devisProducts as $currentProduct) {
$valueHt = $currentProduct['produit_price'] * $currentProduct['quantite'];
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt, $tvaValue);
// CALCUL SIMPLE : TVA OU PAS TVA
if ($isTvaApplicable) {
// Client soumis à TVA : utiliser le taux par défaut
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt, $tvaValue);
$tvaAmount = $valueTtc - $valueHt;
} else {
// Client exonéré : TTC = HT
$valueTtc = $valueHt;
$tvaAmount = 0;
}
$totalHt += $valueHt;
$totalTtc += $valueTtc;
$tvaAmount = $valueTtc - $valueHt;
$totalTva += $tvaAmount;
}
$currentDevis["totalHt"] = $totalHt;
$currentDevis["totalTtc"] = $totalTtc;
$currentDevis["totalTva"] = $totalTva;
@ -5390,10 +5420,19 @@ COMMENTAIRES: ".$comment;
$factureTotalTva += $totalTva;
$facture["devisList"][] = $currentDevis;
}
$facture["totalHt"] = $factureTotalHt;
$facture["totalTtc"] = $factureTotalTtc;
$facture["totalTva"] = $factureTotalTva;
$facture["isFactureClientGroup"] = !$isFactureSingleClient;
// INFOS TVA POUR LE TEMPLATE
$facture["tvaInfo"] = [
'is_applicable' => $isTvaApplicable,
'rate' => $tvaValue,
'is_exempt' => !$isTvaApplicable
];
return $facture;
}

View File

@ -27,7 +27,7 @@ declare(strict_types=1);
namespace OCA\Gestion\Service\InvoiceGroupPdfHandler;
use DateTime;
use \FPDF;
use FPDF;
use OCA\Gestion\Helpers\FileExportHelpers;
use OCA\Gestion\Helpers\PriceHelpers;
@ -54,11 +54,11 @@ class InvoiceGroupPdfHandler extends FPDF
public $additionalArticlesLineBasedOnMultiline = 0;
public $interLigneHeader = 5;
function Header()
public function Header()
{
if ($this->logo != "nothing") {
$this->Image($this->logoPath . "logo.png", 4, 2, 50, 35);
$this->AddWatermark();
//$this->AddWatermark();
} else {
$this->Cell(55, 30, '');
}
@ -66,32 +66,32 @@ class InvoiceGroupPdfHandler extends FPDF
$this->DrawInvoiceCompanyAndClientInfo();
$this->DrawInvoiceInfoTable();
}
function AddWatermark()
public function AddWatermark()
{
$this->SetAlpha(0.2);
$imagePath = $this->logoPath . "filigrane_pdf.png";
list($originalWidth, $originalHeight) = getimagesize($imagePath);
// Convertir les dimensions de pixels à mm (1 pixel = 0.264583 mm)
// Convertir les dimensions de pixels à mm (1 pixel = 0.264583 mm)
// Convertir les dimensions de pixels à mm (1 pixel = 0.264583 mm)
// Convertir les dimensions de pixels à mm (1 pixel = 0.264583 mm)
$originalWidth = $originalWidth * 0.264583;
$originalHeight = $originalHeight * 0.264583;
// Augmenter l'échelle, par exemple, 1.5 pour 150% de la taille d'origine
// Augmenter l'échelle, par exemple, 1.5 pour 150% de la taille d'origine
$scale = 1.7;
$width = $originalWidth * $scale;
$height = $originalHeight * $scale;
// Calculer la position pour centrer l'image
$x = (210 - $width) / 2 + 15; // Décalage à droite de 15 mm
$y = ((297 - $height) / 2) + 21; // 297 mm est la hauteur d'une page A4
// Calculer la position pour centrer l'image
$x = (210 - $width) / 2 + 15; // Décalage à droite de 15 mm
$y = ((297 - $height) / 2) + 21; // 297 mm est la hauteur d'une page A4
// Ajouter l'image en filigrane
$this->Image($imagePath, $x, $y, $width, $height); // Chemin, position x, position y, largeur, hauteur
$this->SetAlpha(0.1); // Définir l'opacité
// Ajouter l'image en filigrane
$this->Image($imagePath, $x, $y, $width, $height); // Chemin, position x, position y, largeur, hauteur
$this->SetAlpha(0.1); // Définir l'opacité
}
function SetAlpha($alpha)
public function SetAlpha($alpha)
{
// Appliquer la transparence au document
$this->SetFillColor(255, 255, 255, $alpha * 255);
@ -106,7 +106,7 @@ class InvoiceGroupPdfHandler extends FPDF
}
function Footer()
public function Footer()
{
$this->SetY(-34);
$this->SetFont('ComicSans', '', 7);
@ -325,7 +325,7 @@ class InvoiceGroupPdfHandler extends FPDF
public function DrawArticlesTableValue()
{
// Set espacement avant de continue
// Set espacement avant de continue
$this->SetFont('ComicSans', '', 10);
$devisData = $this->factureData['devis'];
@ -335,7 +335,7 @@ class InvoiceGroupPdfHandler extends FPDF
$totalTva = 0;
$yValue = $this->startingYOfArticlesTable + 13;
// $maxDescriptionWidth = 102;
$maxDescriptionWidth = 104.3;
$maxDescriptionWidth = 104.3;
$currentIndexPosition = $this->currentIndexPosition;
for ($currentIndexPosition; $currentIndexPosition < ($this->initialIndexPosition + $this->devisCountToGet); $currentIndexPosition++) {
$currentDevis = $devisData[$currentIndexPosition];
@ -449,7 +449,7 @@ class InvoiceGroupPdfHandler extends FPDF
$this->DrawBankAndTotalPriceInfo();
}
function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
public function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
{
// Store reset values for (x,y) positions
$x = $this->GetX() + $w;
@ -464,19 +464,22 @@ class InvoiceGroupPdfHandler extends FPDF
}
}
function NbLines($w, $txt)
public function NbLines($w, $txt)
{
// Compute the number of lines a MultiCell of width w will take
if (!isset($this->CurrentFont))
if (!isset($this->CurrentFont)) {
$this->Error('No font has been set');
}
$cw = $this->CurrentFont['cw'];
if ($w == 0)
if ($w == 0) {
$w = $this->w - $this->rMargin - $this->x;
}
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
$s = str_replace("\r", '', (string) $txt);
$nb = strlen($s);
if ($nb > 0 && $s[$nb - 1] == "\n")
if ($nb > 0 && $s[$nb - 1] == "\n") {
$nb--;
}
$sep = -1;
$i = 0;
$j = 0;
@ -492,21 +495,25 @@ class InvoiceGroupPdfHandler extends FPDF
$nl++;
continue;
}
if ($c == ' ')
if ($c == ' ') {
$sep = $i;
}
$l += $cw[$c];
if ($l > $wmax) {
if ($sep == -1) {
if ($i == $j)
if ($i == $j) {
$i++;
} else
}
} else {
$i = $sep + 1;
}
$sep = -1;
$j = $i;
$l = 0;
$nl++;
} else
} else {
$i++;
}
}
return $nl;
}
@ -516,38 +523,42 @@ class InvoiceGroupPdfHandler extends FPDF
{
$k = $this->k;
$hp = $this->h;
if ($style == 'F')
if ($style == 'F') {
$op = 'f';
elseif ($style == 'FD' || $style == 'DF')
} elseif ($style == 'FD' || $style == 'DF') {
$op = 'B';
else
} else {
$op = 'S';
}
$MyArc = 4 / 3 * (sqrt(2) - 1);
$this->_out(sprintf('%.2F %.2F m', ($x + $r) * $k, ($hp - $y) * $k));
$xc = $x + $w - $r;
$yc = $y + $r;
$this->_out(sprintf('%.2F %.2F l', $xc * $k, ($hp - $y) * $k));
if (strpos($corners, '2') === false)
if (strpos($corners, '2') === false) {
$this->_out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $y) * $k));
else
} else {
$this->_Arc($xc + $r * $MyArc, $yc - $r, $xc + $r, $yc - $r * $MyArc, $xc + $r, $yc);
}
$xc = $x + $w - $r;
$yc = $y + $h - $r;
$this->_out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $yc) * $k));
if (strpos($corners, '3') === false)
if (strpos($corners, '3') === false) {
$this->_out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - ($y + $h)) * $k));
else
} else {
$this->_Arc($xc + $r, $yc + $r * $MyArc, $xc + $r * $MyArc, $yc + $r, $xc, $yc + $r);
}
$xc = $x + $r;
$yc = $y + $h - $r;
$this->_out(sprintf('%.2F %.2F l', $xc * $k, ($hp - ($y + $h)) * $k));
if (strpos($corners, '4') === false)
if (strpos($corners, '4') === false) {
$this->_out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - ($y + $h)) * $k));
else
} else {
$this->_Arc($xc - $r * $MyArc, $yc + $r, $xc - $r, $yc + $r * $MyArc, $xc - $r, $yc);
}
$xc = $x + $r;
$yc = $y + $r;
@ -555,8 +566,9 @@ class InvoiceGroupPdfHandler extends FPDF
if (strpos($corners, '1') === false) {
$this->_out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $y) * $k));
$this->_out(sprintf('%.2F %.2F l', ($x + $r) * $k, ($hp - $y) * $k));
} else
} else {
$this->_Arc($xc - $r, $yc - $r * $MyArc, $xc - $r * $MyArc, $yc - $r, $xc, $yc - $r);
}
$this->_out($op);
}

View File

@ -2,16 +2,17 @@
use OC\URLGenerator;
use OCA\Gestion\Helpers\PriceHelpers;
$facture = $_['facture'];
$factureOrderNumber = $facture->facture_order_number == '' ? '-' : $facture->facture_order_number;
$factureCaseNumber = $facture->facture_case_number == '' ? '-' : $facture->facture_case_number;
$isFactureClientGroup = $facture->isFactureClientGroup;
$isFactureClientGroup = $facture->isFactureClientGroup;
$currentConfig = json_decode($_['configuration'])[0];
?>
<div class="bootstrap-iso">
<div id="factureId" data-id="<?php echo $facture->id; ?>"></div>
<div id="factureIdentifier" data-id="<?php echo $facture->id; ?>"></div>
<h2 class="mt-3 mb-3 text-center"> <?php echo ('Facture n° '.$facture->num); ?>
<h2 class="mt-3 mb-3 text-center"> <?php echo('Facture n° '.$facture->num); ?>
</h2>
<hr />
<div class="row">
@ -34,7 +35,7 @@ $currentConfig = json_decode($_['configuration'])[0];
} else {
echo "<span style='font-size:12px' id='Company-logo' data-html2canvas-ignore><b><center>" . $l->t('You can add your company logo here.') . "</center></b><br/><i>" . $l->t('To add a logo, drop the logo.png file in ".gestion" folder at the root of your Nextcloud Files app. Remember to set "Show hidden files".') . "</i><br/><br/><center>" . $l->t('This message will not appear on generated PDF.') . "</center></span>";
}
?>
?>
</div>
<div class="col-5 h-100 m-0" style="min-height:250px;">
<h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('TO')); ?>
@ -42,7 +43,7 @@ $currentConfig = json_decode($_['configuration'])[0];
<p style="min-height:180px;"
class="p-3 m-0 h-100 text-center text-dark text-center border border-top-0 border-2 border-dark">
<span><?php echo $facture->group_name; ?></span><br />
<?php if($isFactureClientGroup == false){
<?php if($isFactureClientGroup == false) {
?>
<span><?php echo $facture->client_name; ?></span><br />
<?php }?>
@ -88,8 +89,8 @@ $currentConfig = json_decode($_['configuration'])[0];
<tbody>
<?php
$devisList = $facture->devisList;
foreach ($devisList as $currentDevis) {
?>
foreach ($devisList as $currentDevis) {
?>
<tr>
<td><?php echo $currentDevis->devis_full_number; ?></td>
<td><?php echo $currentDevis->defunt_nom; ?></td>
@ -113,26 +114,43 @@ $currentConfig = json_decode($_['configuration'])[0];
class="mb-2 btn btn-outline-success sendmail"
><?php p($l->t('Send by email'));?></button>
</div>
<div class="mt-0 table-responsive">
<table id="totalFactureGroupPrice" class="table table-striped table-xl">
<thead class="bg-dark text-white">
<tr>
<th class="text-center"><?php p($l->t('Total without VAT')); ?></th>
<th class="text-center"><?php p($l->t('VAT Rate')); ?></th>
<th class="text-center"><?php p($l->t('Total VAT')); ?></th>
<th class="text-center"><?php p($l->t('Total Price')); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($facture->totalHt).'€'); ?></td>
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($currentConfig->tva_default).'€'); ?></td>
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($facture->totalTva).'€'); ?></td>
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($facture->totalTtc).'€'); ?></td>
</tr>
</tbody>
</table>
</div>
<div class="mt-0 table-responsive">
<table id="totalFactureGroupPrice" class="table table-striped table-xl">
<thead class="bg-dark text-white">
<tr>
<th class="text-center"><?php p($l->t('Total without VAT')); ?></th>
<th class="text-center"><?php p($l->t('VAT Rate')); ?></th>
<th class="text-center"><?php p($l->t('Total VAT')); ?></th>
<th class="text-center"><?php p($l->t('Total Price')); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center"><?php echo PriceHelpers::formatDecimalPrice($facture->totalHt).'€'; ?></td>
<td class="text-center">
<?php
// Affichage simple : Exonéré ou taux par défaut
if (isset($facture->tvaInfo) && $facture->tvaInfo->is_exempt) {
echo 'Exonéré';
} else {
echo PriceHelpers::formatDecimalPrice($facture->tvaInfo->rate).'%';
}
?>
</td>
<td class="text-center">
<?php
if (isset($facture->tvaInfo) && $facture->tvaInfo->is_exempt) {
echo '0,00€';
} else {
echo PriceHelpers::formatDecimalPrice($facture->totalTva).'€';
}
?>
</td>
<td class="text-center"><?php echo PriceHelpers::formatDecimalPrice($facture->totalTtc).'€'; ?></td>
</tr>
</tbody>
</table>
</div>
<div class="col m-0 pb-0 alert alert-info text-center">
<p><span id="mentions_default"><?php p($l->t('Please set in global configuration')); ?></span></p>
</div>