Dans le footer ajouter le numéro de TVA intercommunautaire.
Ces modifications ne doivent apparaître que si la facture est éditée à partir du 1er janvier 2024.
diff --git a/sources/Afup/Forum/Facturation.php b/sources/Afup/Forum/Facturation.php
index 801e24e8..3999cad6 100644
--- a/sources/Afup/Forum/Facturation.php
+++ b/sources/Afup/Forum/Facturation.php
@@ -4,6 +4,7 @@ use Afup\Site\Utils\Logs;
use Afup\Site\Utils\Mail;
use Afup\Site\Utils\Pays;
use Afup\Site\Utils\PDF_Facture;
+use Afup\Site\Utils\Utils;
use AppBundle\Compta\BankAccount\BankAccountFactory;
use AppBundle\Email\Mailer\Attachment;
use AppBundle\Email\Mailer\MailUser;
@@ -233,9 +234,12 @@ class Facturation
? \DateTimeImmutable::createFromFormat('U', $facture['date_facture'])
: new \DateTimeImmutable();
+
+ $isSubjectedToVat = Utils::isSubjectedToVat($dateFacture);
+
$bankAccountFactory = new BankAccountFactory($configuration);
// Construction du PDF
- $pdf = new PDF_Facture($configuration, $bankAccountFactory->createApplyableAt($dateFacture));
+ $pdf = new PDF_Facture($configuration, $bankAccountFactory->createApplyableAt($dateFacture), $isSubjectedToVat);
$pdf->AddPage();
$pdf->Cell(130, 5);
@@ -275,8 +279,13 @@ class Facturation
$pdf->Ln(10);
$pdf->SetFillColor(200, 200, 200);
$pdf->Cell(50, 5, 'Type', 1, 0, 'L', 1);
- $pdf->Cell(100, 5, 'Personne inscrite', 1, 0, 'L', 1);
- $pdf->Cell(40, 5, 'Prix', 1, 0, 'L', 1);
+ $pdf->Cell(100 - ($isSubjectedToVat ? 35 : 0), 5, 'Personne inscrite', 1, 0, 'L', 1);
+ $pdf->Cell($isSubjectedToVat ? 30 : 40, 5, 'Prix' . ($isSubjectedToVat ? ' HT' : ''), 1, 0, 'L', 1);
+ if ($isSubjectedToVat) {
+ $pdf->Cell(15, 5, 'TVA', 1, 0, 'L', 1);
+ $pdf->Cell(30, 5, 'Prix TTC', 1, 0, 'L', 1);
+ }
+
$total = 0;
foreach ($inscriptions as $inscription) {
@@ -284,9 +293,16 @@ class Facturation
$pdf->SetFillColor(255, 255, 255);
$pdf->Cell(50, 5, $this->truncate(utf8_decode($inscription['pretty_name']), 27), 1);
- $pdf->Cell(100, 5, utf8_decode($inscription['prenom']) . ' ' . utf8_decode($inscription['nom']), 1);
- $pdf->Cell(40, 5, utf8_decode($inscription['montant']) . utf8_decode(' �'), 1);
- $total += $inscription['montant'];
+ $pdf->Cell(100 - ($isSubjectedToVat ? 35 : 0), 5, utf8_decode($inscription['prenom']) . ' ' . utf8_decode($inscription['nom']), 1);
+ $montant = $inscription['montant'];
+ $montantTtc = $montant * 1.1;
+ $pdf->Cell($isSubjectedToVat ? 30 : 40, 5, utf8_decode($montant) . utf8_decode(' �'), 1);
+ if ($isSubjectedToVat) {
+ $pdf->Cell(15, 5, utf8_decode('10%'), 1);
+ $pdf->Cell(30, 5, utf8_decode($montantTtc) . utf8_decode(' �'), 1);
+ }
+
+ $total += $isSubjectedToVat ? $montantTtc : $montant;
}
if ($facture['type_reglement'] == 1) { // Paiement par chèque
@@ -299,8 +315,8 @@ class Facturation
$pdf->Ln();
$pdf->SetFillColor(225, 225, 225);
- $pdf->Cell(150, 5, 'TOTAL', 1, 0, 'L', 1);
- $pdf->Cell(40, 5, $total . utf8_decode(' �'), 1, 0, 'L', 1);
+ $pdf->Cell($isSubjectedToVat ? 160 : 150, 5, 'TOTAL' . ($isSubjectedToVat ? ' TTC' : ''), 1, 0, 'L', 1);
+ $pdf->Cell($isSubjectedToVat ? 30 : 40, 5, $total . utf8_decode(' �'), 1, 0, 'L', 1);
$pdf->Ln(15);
if ($facture['etat'] == 4) {
@@ -323,10 +339,13 @@ class Facturation
$pdf->SetTextColor(0, 0, 0);
}
$pdf->Ln();
- $pdf->Cell(10, 5, 'TVA non applicable - art. 293B du CGI');
+ if (false === $isSubjectedToVat) {
+ $pdf->Cell(10, 5, 'TVA non applicable - art. 293B du CGI');
+ }
if (is_null($chemin)) {
- $pdf->Output('Facture - ' . ($facture['societe'] ? $facture['societe'] : $facture['nom'] . '_' . $facture['prenom']) . ' - ' . date('Y-m-d_H-i', $facture['date_facture']) . '.pdf', 'D');
+ $pdf->Output('Facture - ' . ($facture['societe'] ? $facture['societe'] : $facture['nom'] . '_' . $facture['prenom']) . ' - ' . date('Y-m-d_H-i', $facture['date_facture']) . '.pdf', 'I');
+ die();
} else {
$pdf->Output($chemin, 'F');
}
diff --git a/sources/Afup/Utils/PDF_Facture.php b/sources/Afup/Utils/PDF_Facture.php
index f38ab5cd..a8613dd0 100644
--- a/sources/Afup/Utils/PDF_Facture.php
+++ b/sources/Afup/Utils/PDF_Facture.php
@@ -20,6 +20,11 @@ class PDF_Facture extends \FPDF
*/
private $bankAccount;
+ /**
+ * @var bool
+ */
+ private $isSubjectedToVat;
+
/**
* Constructor
*
@@ -31,12 +36,13 @@ class PDF_Facture extends \FPDF
* @return void
* @throws \Exception
*/
- function __construct($configuration, BankAccount $bankAccount, $orientation = 'P', $unit = 'mm', $format = 'A4')
+ function __construct($configuration, BankAccount $bankAccount, $isSubjectedToVat = false, $orientation = 'P', $unit = 'mm', $format = 'A4')
{
parent::FPDF($orientation, $unit, $format);
$this->bankAccount = $bankAccount;
$this->setAFUPConfiguration($configuration);
+ $this->isSubjectedToVat = $isSubjectedToVat;
}
/**
@@ -165,6 +171,15 @@ class PDF_Facture extends \FPDF
$this->SetFont('Arial', null, 6);
$this->Cell(-90, 3, $this->bankAccount->getBic(), 0, 0, 'C');
+ if ($this->isSubjectedToVat) {
+ $this->Ln();
+
+ $this->SetFont('Arial', 'B', 6);
+ $this->Cell(145, 3, utf8_decode('Numéro de TVA intercommunautaire'), 0, 0, 'C');
+ $this->SetFont('Arial', null, 6);
+ $this->Cell(-60, 3, 'NUMERO_A_AJOUTER_QUAND_ON_L_AURA', 0, 0, 'C');
+ }
+
$this->Ln();
}
diff --git a/sources/Afup/Utils/Utils.php b/sources/Afup/Utils/Utils.php
index 1df45a9a..c7236144 100644
--- a/sources/Afup/Utils/Utils.php
+++ b/sources/Afup/Utils/Utils.php
@@ -54,6 +54,11 @@ class Utils
}
return $url;
}
+
+ public static function isSubjectedToVat(\DateTimeInterface $date)
+ {
+ return false;
+ }
}
?>
Sur les factures d'événément, ajouter deux colonnes :
Modifier la colonne Prix pour ajouter "HT"
Modifier le titre "Total" pour indiquer "Total TTC".
Dans le footer ajouter le numéro de TVA intercommunautaire.
Ces modifications ne doivent apparaître que si la facture est éditée à partir du 1er janvier 2024.