From f7aca7295005fda135e0a68cb3de388988c07fd0 Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 3 Feb 2022 09:35:35 +0000 Subject: [PATCH] =?UTF-8?q?gestion=20affichage=20si=20plusieurs=20r=C3=A9d?= =?UTF-8?q?uctions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 34367b01dc439cf6979ad81ed4735787c167d106a197d3172f5519fdd53fde3f --- config.json | 13 +++++++++++- lib/Personne.php | 6 ++---- lib/RecusPDF.php | 50 ++++++++++++++++++++++++++++++++------------- lib/Utils.php | 5 ++--- templates/index.tpl | 3 ++- 5 files changed, 54 insertions(+), 23 deletions(-) diff --git a/config.json b/config.json index bbc1ecc..c24a1cf 100644 --- a/config.json +++ b/config.json @@ -1,8 +1,19 @@ { - "auteur" : "jce", "articlesCGI" : [ "Article 200", "Article 228 bis", "Article 978" + ], + "reduction" : [ + { + "taux" : "normal", + "ligne" : "UF", + "remarque" : "" + }, + { + "taux" : "majoré", + "ligne" : "UD", + "remarque" : "aide aux personnes en difficulté" + } ] } diff --git a/lib/Personne.php b/lib/Personne.php index d4ebf9e..14a40d7 100644 --- a/lib/Personne.php +++ b/lib/Personne.php @@ -13,7 +13,7 @@ class Personne public $ville; public $codePostal; public $courriel; - public $versements; + public $versements; // tableau des versements totaux par activité/tarif public function __construct( $id, @@ -33,20 +33,18 @@ class Personne } /* - * ajouter un versement + * ajouter un versement pour une activité et un tarif donnés */ public function ajouterVersement( $idActivite, $idTarif, $montant ) { - // var_dump($this); $this->versements[] = new Versement( $idActivite, $idTarif, $montant ); - // var_dump($this); } } diff --git a/lib/RecusPDF.php b/lib/RecusPDF.php index 45984d1..bc4d70e 100644 --- a/lib/RecusPDF.php +++ b/lib/RecusPDF.php @@ -88,6 +88,37 @@ class RecusPDF extends tFPDF $this->Cell(0, 6, $libelle, 'R', 1); } + // imprimer le montant de la réduction et un libellé + function imprimer_montant($texte, $montant, $libelle = "") + { + $this->SetFont('DejaVu'); + $this->Cell($this->GetStringWidth($texte), + 6, + $texte, + 'L', + 0); + $this->SetFont('DejaVu','B'); + $valeur = number_format($montant, 2, "," , "") . " euros"; + $this->Cell($this->GetStringWidth($valeur), + 6, + $valeur, + '', + 0); + $this->SetFont('DejaVu'); + if ($libelle != "") + { + $this->Cell(0, + 6, + " : " . $libelle, + 'R', + 1); + } + else + { + $this->Cell(0, 6, "", 'R', 1); + } + } + function titre_rubrique($texte) { $this->SetFont('DejaVu','B',12); @@ -130,24 +161,15 @@ class RecusPDF extends tFPDF $this->SetFont('DejaVu', '', 11); $this->Cell(0, 6, - "Le bénéficiaire reconnaît avoir reçu au titre des dons et versements ouvrant droit à réduction d'impôt", + "Le bénéficiaire reconnaît avoir reçu au titre des dons et versements ouvrant droit à réduction d'impôt :", 'LTR', 1); - $this->Cell($this->GetStringWidth("la somme de "), - 6, - "la somme de ", - 'L', - 0); - $this->SetFont('DejaVu','B'); - foreach ($lesMontants as $montant) { - $this->Cell(0, - 6, - number_format($montant, 2, "," , "") . " euros.", - 'R', - 1); + foreach ($lesMontants as $montant) + { + $this->imprimer_montant(" - la somme de ", $montant, "aide aux personnes en difficulté"); } $this->Cell(0, 3, "", 'LR', 1); - $this->imprimer_description('Date du versement ou du don : ', + $this->imprimer_description('Date des versements : ', 'année ' . $annee_recu); $this->Cell(0, 3, "", 'LR', 1); $this->MultiCell(0, 6, diff --git a/lib/Utils.php b/lib/Utils.php index 126776d..d392ac7 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -119,10 +119,9 @@ class Utils } /** - * @return versements d'une année pour une activité et un tarif donnés + * @return versements d'une année pour un ensemble de tarifs donnés * @param $annee - * @param $activite - * @param $tarif + * @param array $lesTarifs */ public static function getVersementsActivite($annee, $lesTarifs) { diff --git a/templates/index.tpl b/templates/index.tpl index 7a94ddd..2dbab8f 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -53,9 +53,10 @@ {button type="submit" name="generer_tous" label="Poursuivre" shape="right" class="main"}

+