Compare commits

...

3 Commits

Author SHA1 Message Date
engel e6c1b45d8e correction désinstallation ; suppression fichiers inutile
FossilOrigin-Name: d9802367cba7e6a0b24bada03bc78f4240655ba92d828e0c839f8778b574c25e
2022-03-11 10:04:25 +00:00
engel 8b7ec52306 génération des activités avec template
FossilOrigin-Name: c32cf97328d5a179eef489982b4f1f3e49c8ba056443ed98093e3ca3fd7799e9
2022-03-10 17:23:34 +00:00
engel 7c197abbc8 test génération reçu html avec template
FossilOrigin-Name: 1070052b9c2d7df2121a02c7ad2b9653459d96e66bf58ad02ef88712e45e16e0
2022-03-10 17:12:42 +00:00
6 changed files with 443 additions and 498 deletions

View File

@ -1,259 +0,0 @@
<?php
namespace Garradin\Plugin\RecusFiscaux;
// génération du formulaire
class RecusHTML
{
private $nomAsso;
private $adresseAsso;
private $objetAsso;
private $nomResponsable;
private $fonctionResponsable;
private $articlesCGI;
private $signature;
/**
* initialize global data
*/
function __construct($nomAsso,
$adresseAsso,
$objetAsso,
$nomResponsable,
$fonctionResponsable,
$articlesCGI,
$signature)
{
$this->nomAsso = $nomAsso;
$this->adresseAsso = $adresseAsso;
$this->objetAsso = $objetAsso;
$this->nomResponsable = $nomResponsable;
$this->fonctionResponsable = $fonctionResponsable;
$this->signature = $signature;
$this->articlesCGI = $articlesCGI;
$this->html = $this->entete();
}
function get()
{
return $this->html;
}
// imprimer le reçu
function imprimer_recu($annee_recu,
$numero,
$nom,
$lesMontants,
$adresse,
$code_postal,
$ville)
{
ob_start();
echo <<<FDD
<div id="numRecu">
<p class="important">Reçu numéro {$annee_recu}/{$numero}</p>
</div>
</div>
<div class="cartouche" id="beneficiaire">
<h3 class="rubrique">Bénéficiaire des versements</h3>
<p class="important">Association « {$this->nomAsso} »</p>
<p class="important" >{$this->adresseAsso}</p>
<p><span class="titre">Objet : </span><span class="libelle">{$this->objetAsso}</span></p>
</div>
<div class="cartouche" id="donateur">
<h3 class="rubrique">Donateur</h3>
<p>{$nom}</p>
<p>{$adresse}</p>
<p>{$code_postal} {$ville}</p>
</div>
<div class="cartouche" id="versements">
<p>Le bénéficiaire reconnaît avoir reçu au titre des dons et versements ouvrant droit à réduction d'impôt :</p>
<ul>
FDD;
foreach ($lesMontants as $taux => $montant)
{
$this->imprimer_montant($montant,
Utils::getLigneReduction($taux));
}
echo "</ul>\n";
$this->imprimer_description("Date des versements :",
"année {$annee_recu}");
$this->imprimer_description("Nature du don : ",
"Numéraire");
$this->imprimer_description("Mode de versement : ",
"chèque et/ou virement");
// articles du CGI
$nbArticles = count($this->articlesCGI);
if ($nbArticles == 1)
{
echo "<p>Le bénéficiaire certifie sur lhonneur que les dons et versements quil reçoit ouvrent droit à la réduction d'impôt prévue à larticle ";
printf("%s du code général des impôts</p>\n", $this->articlesCGI[0]);
}
else if ($nbArticles > 1)
{
echo "<p>Le bénéficiaire certifie sur lhonneur que les dons et versements quil reçoit ouvrent droit à la réduction d'impôt prévue aux articles ";
for ($i = 0; $i < $nbArticles; ++$i) {
printf("%s", $this->articlesCGI[$i]);
if ($i < $nbArticles - 2) {
echo ", ";
}
else if ($i == $nbArticles - 2) {
echo " et ";
}
}
echo " du code général des impôts</p>\n";
}
echo "</div>\n";
// cartouche final
$date = date("j/m/Y");
echo <<<FDD
<div class="cartouche" id="final">
<p>Rennes le {$date}</p>
<img id="signature" src="$this->signature" />
<p id="nom">$this->nomResponsable</p>
<p id="fonction">$this->fonctionResponsable</p>
</div>
</body>
</html>
FDD;
$this->html .= ob_get_clean();
}
// imprimer un libellé précédé de son titre en gras
function imprimer_description($titre, $libelle)
{
echo <<<FDD
<p><span class="titre">{$titre}</span><span class="libelle"> {$libelle}</span></p>
FDD;
}
// imprimer le montant du versement et un libellé
function imprimer_montant($montant, $libelle = "")
{
$valeur = number_format($montant, 2, ',', '');
echo "<li>la somme de <b>{$valeur} euros</b>";
if ($libelle != "") {
echo " ({$libelle})";
}
echo "</li>\n";
}
protected function entete()
{
// $styleSheet = \Garradin\PLUGIN_ROOT . "/lib/pdf.css";
// error_log("pdf.css = " . $styleSheet);
ob_start();
echo <<<FDD
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style>
/* organisation spatiale */
@page
{
size: A4 portrait;
margin: 1cm;
}
body
{
font-family: Serif;
font-size: 11pt;
background-color: white;
}
#logoCerfa
{
line-height: 40px;
width: 100px;
background-color: rgb(0, 0, 128);
border-radius : 50%;
text-align : center;
margin : 2mm;
}
.centre
{
display : inline-block;
vertical-align : middle;
line-height: 20px; /* moitié de la hauteur du logo */
color : white;
font-weight: bold;
font-size : 14pt;
}
#numCerfa
{
width: 100px; /* largeur du logo */
text-align: center;
}
#titre
{
margin : 0 4cm 0 4cm;
text-align : center;
font-size : 14pt;
font-weight: bold;
}
#articles
{
margin : 0 4cm 0 4cm; /* idem titre */
text-align : center;
}
#numRecu
{
text-align : right;
}
#final
{
height : 5cm;
}
.rubrique
{
background-color : rgb(200, 200, 250);
padding : 2mm;
}
.cartouche
{
margin : 2mm auto;
padding : 0 2mm;
border : 1px solid rgb(0, 0, 128);
border-radius : 8px;
}
.titre, .important
{
font-weight:bold;
}
#signature
{
display: block;
max-width : 7cm;
max-height : 2cm;
margin: 0 auto;
padding-bottom : 2mm;
}
#fonction, #nom
{
text-align : center;
}
</style>
</head>
<body>
<div class="cartouche" id="entete">
<div id="logoCerfa">
<span class="centre">Cerfa</span>
</div>
<div id="numCerfa">
<span> 11580*4</span>
</div>
<p id="titre">Reçu au titre des dons à certains organismes d'intérêt général</p>
<p id="articles">Articles 200, 238 bis et 978 du code général des impôts</p>
FDD;
return ob_get_clean();
}
}

View File

@ -1,196 +0,0 @@
<?php
namespace Garradin\Plugin\RecusFiscaux;
// class to generate PDF documents
require('tfpdf/tfpdf.php');
class RecusPDF extends tFPDF
{
private $nomAsso;
private $adresseAsso;
private $logoCerfa;
private $signature;
/**
* initialize header fonts
* @param : family (DejaVu, ...)
* @param : style (Sans, Serif, SansCondensed, SansMono, SerifCondensed...)
*/
function __construct($family, $style, $nomAsso, $adresseAsso, $logo, $signature)
{
parent::__construct();
// normal
$this->AddFont($family,
'',
$family.$style.".ttf",
true);
// bold
$this->AddFont($family,
'B',
$family.$style."-Bold.ttf",
true);
$this->nomAsso = $nomAsso;
$this->adresseAsso = $adresseAsso;
$this->logoCerfa = $logo;
$this->signature = $signature;
}
// Header
function Header()
{
parent::Header();
// Logo
$this->Image($this->logoCerfa, 10, 6, 30);
// document title
$this->SetTextColor(0, 0, 0);
$this->SetFont('DejaVu','B',12);
$titre = "Reçu au titre des dons à certains organismes d'intérêt général";
$this->SetXY(50, 10);
// Titre
$this->MultiCell(100,
6,
$titre,
0,
'C');
// numéro de Cerfa
$cerfa = "N° 11580*3";
$this->SetFont('DejaVu', 'B', 10);
$this->SetXY(10, 25);
$this->Cell(100, 0, $cerfa);
// Articles
$this->SetFont('DejaVu', '', 9);
$this->SetXY(50, 25);
$this->Cell(100, 0, 'Article 200, 238 bis et 885-0 V bis A du code général des impôts');
}
// imprimer les informations du bénéficiaire
function imprimer_beneficiaire($nom, $adresse)
{
$this->titre_rubrique("Bénéficiaire des versements");
$this->SetFont('DejaVu', 'B', 11);
$this->Cell(0, 6, 'Association « ' . $nom . ' »', 'LR', 1);
$this->Cell(0, 6, str_replace(array("\r\n", "\n", "\r"), " ", $adresse), 'LR', 1);
$this->imprimer_description("Objet : ",
"célébrer le culte protestant évangélique et pourvoir aux frais et besoins de ce culte.");
$this->Cell(0, 6, "", 'LRB', 1);
}
// imprimer un libellé précédé de son titre en gras
function imprimer_description($titre, $libelle)
{
$this->SetFont('DejaVu', 'B', 11);
$this->Cell($this->GetStringWidth($titre), 6, $titre, 'L', 0);
$this->SetFont('DejaVu', '', 11);
$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);
$largeur_texte = $this->GetStringWidth($texte);
$this->setX(10);
$this->SetFillColor(0, 255, 255);
$this->Cell(0, 6, $texte, 'LTR', 1, 'C', true);
$this->Cell(0, 6, "", 'LR', 1);
}
// imprimer le reçu
function imprimer_recu($annee_recu,
$numero,
$nom,
$lesMontants,
$adresse,
$code_postal,
$ville)
{
$this->AddPage();
// Numéro de reçu
$this->SetFont('DejaVu', 'B', 11);
$this->MultiCell(0, 20, 'Reçu numéro ' . $annee_recu . '/' . $numero);
// bénéficiaire
$this->imprimer_beneficiaire($this->nomAsso, $this->adresseAsso);
// donateur
$this->Ln(10);
$this->titre_rubrique("Donateur");
$this->SetFont('DejaVu', 'B', 11);
$this->Cell(0, 6, $nom, 'LR', 1);
$this->Cell(0, 6, $adresse, 'LR', 1);
$this->Cell(0, 6, $code_postal . " " . $ville, 'LR', 1);
$this->Cell(0, 6, "", 'LRB', 1);
// Montant et autres informations
$this->Ln(10);
$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 :",
'LTR',
1);
foreach ($lesMontants as $taux => $montant)
{
$this->imprimer_montant(" - la somme de ", $montant, Utils::getLigneReduction($taux));
}
$this->Cell(0, 3, "", 'LR', 1);
$this->imprimer_description('Date des versements : ',
'année ' . $annee_recu);
$this->Cell(0, 3, "", 'LR', 1);
$this->MultiCell(0, 6,
"Le bénéficiaire certifie sur lhonneur que les dons et versements quil reçoit ouvrent droit à la réduction
d'impôt prévue à larticle 200 du CGI",
'LR');
$this->Cell(0, 3, "", 'LR', 1);
$this->imprimer_description("Forme du don : ", "Autre");
$this->Cell(0, 3, "", 'LR', 1);
$this->imprimer_description("Nature du don : ", "Numéraire");
$this->Cell(0, 3, "", 'LR', 1);
$this->imprimer_description("Mode de versement : ", "chèque et/ou virement");
$this->Cell(0, 0, "", 'LRB', 1);
// cartouche final
$this->Ln(10);
$this->Cell(0, 6, "", 'LRT', 1);
$this->Cell(0, 6, "Rennes le " . date("j/m/Y"), 'LR', 1, 'R');
$this->Cell(0, 36, "", 'LR', 1);
$this->Cell(0, 0, "", 'LBR', 1);
$this->SetXY(100, 220);
$this->Image($this->signature, null, null, 50);
}
} // class RecusPDF

67
templates/recuHTML.tpl Normal file
View File

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
{*
<link rel="stylesheet" type="text/css" href="{$styleSheet}" media="print" />
<link rel="stylesheet" type="text/css" href="{plugin_url file=$styleSheet}?{$version_hash}" media="print" />
*}
<style type="text/css">
{ajouter_style}
</style>
</head>
<body>
<div class="cartouche" id="entete">
<div id="logoCerfa">
<span class="centre">Cerfa</span>
</div>
<div id="numCerfa">
<span>N° 11580*4</span>
</div>
<p id="titre">Reçu au titre des dons à certains organismes d'intérêt général</p>
<p id="articles">Articles 200, 238 bis et 978 du code général des impôts</p>
<div id="numRecu">
<p class="important">Reçu numéro {$anneeRecu}/{$numero}</p>
</div>
</div>
<div class="cartouche" id="beneficiaire">
<h3 class="rubrique">Bénéficiaire des versements</h3>
<p class="important">Association « {$nomAsso} »</p>
<p class="important">{$adresseAsso}</p>
<p><span class="titre">Objet : </span><span class="libelle">{$objetAsso}</span></p>
</div>
<div class="cartouche" id="donateur">
<h3 class="rubrique">Donateur</h3>
<p>{$nom}</p>
<p>{$adresse}</p>
<p>{$codePostal} {$ville}</p>
</div>
<div class="cartouche" id="versements">
<p>Le bénéficiaire reconnaît avoir reçu au titre des dons et versements ouvrant droit à réduction
d'impôt :</p>
<ul>
{foreach from=$lesMontants key=taux item=montant}
{imprimer_montant montant=$montant taux=$taux}
{/foreach}
</ul>
<p><span class="titre">Date des versements : </span><span class="libelle">année {$anneeRecu}</span></p>
<p><span class="titre">Nature du don : </span><span class="libelle">Numéraire</span></p>
<p><span class="titre">Mode de versement : </span><span class="libelle">chèque et/ou virement</span></p>
{imprimer_articles articles=$articlesCGI}
</div>
<div class="cartouche" id="final">
<?php $date = date("j/m/Y"); ?>
<p>Rennes le {$date}</p>
<img id="signature" src="{$signature}" />
<p id="nom">{$nomResponsable}</p>
<p id="fonction">{$fonctionResponsable}</p>
</div>
</body>
</html>

View File

@ -18,3 +18,4 @@ if (null !== $signature) {
$sig_file->delete();
}
}
unset($_SESSION['sig_file']);

View File

@ -17,13 +17,16 @@ foreach ($lesLignes as $ligne) {
// cumuler les versements d'une personne
$totalPersonnes = cumulerVersements($versementsSelectionnes);
// générer les reçus
// informations de l'association
$nomAsso = Utils::getNomAsso();
$adresseAsso = Utils::getAdresseAsso();
$signature =
(null !== $plugin->getConfig('signature')) ?
\Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() :
"";
$objetAsso = $plugin->getConfig('objet_asso');
$nomResponsable = $plugin->getConfig('nom_responsable');
$fonctionResponsable = $plugin->getConfig('fonction_responsable');
// articles du CGI
$articlesCGI = array();
@ -33,19 +36,168 @@ foreach ($plugin->getConfig('articlesCGI') as $article)
$articlesCGI[] = $article->titre;
}
}
/**
* insérer une feuille de style
*/
$tpl->register_function('ajouter_style', function()
{
$out = '
@page
{
size: A4 portrait;
margin: 1cm;
}
body
{
font-family: Serif;
font-size: 11pt;
background-color: white;
}
#logoCerfa
{
line-height: 40px;
width: 100px;
background-color: rgb(0, 0, 128);
border-radius : 50%;
text-align : center;
margin : 2mm;
}
.centre
{
display : inline-block;
vertical-align : middle;
line-height: 20px; /* moitié de la hauteur du logo */
color : white;
font-weight: bold;
font-size : 14pt;
}
#numCerfa
{
width: 100px; /* largeur du logo */
text-align: center;
}
#titre
{
margin : 0 4cm 0 4cm;
text-align : center;
font-size : 14pt;
font-weight: bold;
}
#articles
{
margin : 0 4cm 0 4cm; /* idem titre */
text-align : center;
}
#numRecu
{
text-align : right;
}
#final
{
height : 5cm;
}
.rubrique
{
background-color : rgb(200, 200, 250);
padding : 2mm;
}
.cartouche
{
margin : 2mm auto;
padding : 0 2mm;
border : 1px solid rgb(0, 0, 128);
border-radius : 8px;
}
.titre, .important
{
font-weight:bold;
}
#signature
{
display: block;
max-width : 7cm;
max-height : 2cm;
margin: 0 auto;
padding-bottom : 2mm;
}
#fonction, #nom
{
text-align : center;
}
';
return $out;
});
/**
* imprimer un montant et le taux de réduction associé
* @param montant
* @param taux
*/
$tpl->register_function('imprimer_montant', function ($params)
{
$montant = $params['montant'];
$taux = $params['taux'];
$valeur = number_format($montant, 2, ',', '');
$libelle = Utils::getLigneReduction($taux);
$out = sprintf('
<li>la somme de <b>%s euros</b>',
$valeur);
if ($libelle != "") {
$out .= sprintf(' (%s)', $libelle);
}
$out .= '
</li>
';
return $out;
});
/**
* imprimer les articles du code général des impôts concernés
* @param articles
*/
$tpl->register_function('imprimer_articles', function ($params)
{
$articlesCGI = $params['articles'];
$nbArticles = count($articlesCGI);
$out = "<p>Le bénéficiaire certifie sur lhonneur que les dons et versements quil reçoit ouvrent droit à la réduction d'impôt prévue";
if ($nbArticles == 1)
{
$out .= sprintf(' à larticle %s du code général des impôts</p>', articlesCGI[0]);
}
else if ($nbArticles > 1)
{
$out .= " aux articles ";
for ($i = 0; $i < $nbArticles; ++$i) {
$out .= sprintf("%s", $articlesCGI[$i]);
if ($i < $nbArticles - 2) {
$out .= ", ";
}
else if ($i == $nbArticles - 2) {
$out .= " et ";
}
}
$out .= " du code général des impôts.</p>";
}
return $out;
});
$listeFichiers = array(); // fichiers pdf générés
foreach ($totalPersonnes as $idPersonne => $personne)
{
// générer un fichier par reçu
$html = new RecusHTML(
$nomAsso,
$adresseAsso,
$plugin->getConfig('objet_asso'),
$plugin->getConfig('nom_responsable'),
$plugin->getConfig('fonction_responsable'),
$articlesCGI,
$signature
);
// extraire les montants des versements
$lesMontants = array();
foreach ($personne->versements as $versement)
@ -57,17 +209,30 @@ foreach ($totalPersonnes as $idPersonne => $personne)
$lesMontants[$versement->tauxReduction] = $versement->montant;
}
}
$html->imprimer_recu(
$_SESSION['annee_recu'],
$personne->id,
$personne->nomPrenom,
$lesMontants,
$personne->adresse,
$personne->codePostal,
$personne->ville
);
$tpl->assign(compact('nomAsso',
'adresseAsso',
'objetAsso',
'nomResponsable',
'fonctionResponsable',
'articlesCGI',
'signature'
));
$tpl->assign('anneeRecu', $_SESSION['annee_recu']);
$tpl->assign('numero', $personne->id);
$tpl->assign('nom', $personne->nomPrenom);
$tpl->assign('lesMontants', $lesMontants);
$tpl->assign('adresse', $personne->adresse);
$tpl->assign('codePostal', $personne->codePostal);
$tpl->assign('ville', $personne->ville);
// $tpl->assign('styleSheet', 'pdf.css');
ob_start();
$tpl->display(PLUGIN_ROOT . '/templates/recuHTML.tpl');
$html = ob_get_clean();
// fabriquer le fichier PDF
$nomPDF = \Garradin\Utils::filePDF($html->get());
$nomPDF = \Garradin\Utils::filePDF($html);
// changer le nom du fichier
$nom = str_replace(' ', '_', $personne->nomPrenom);
$nom = str_replace("'", "", $nom);

View File

@ -15,13 +15,16 @@ foreach ($lesLignes as $ligne) {
$versementsSelectionnes[] = $_SESSION['lesVersementsTotaux'][$ligne];
}
// générer les reçus
// informations de l'association
$nomAsso = Utils::getNomAsso();
$adresseAsso = Utils::getAdresseAsso();
$signature =
(null !== $plugin->getConfig('signature')) ?
\Garradin\Files\Files::get($plugin->getConfig('signature'))->fullpath() :
"";
$objetAsso = $plugin->getConfig('objet_asso');
$nomResponsable = $plugin->getConfig('nom_responsable');
$fonctionResponsable = $plugin->getConfig('fonction_responsable');
// articles du CGI
$articlesCGI = array();
@ -31,34 +34,198 @@ foreach ($plugin->getConfig('articlesCGI') as $article)
$articlesCGI[] = $article->titre;
}
}
/**
* insérer une feuille de style
*/
$tpl->register_function('ajouter_style', function()
{
$out = '
@page
{
size: A4 portrait;
margin: 1cm;
}
body
{
font-family: Serif;
font-size: 11pt;
background-color: white;
}
#logoCerfa
{
line-height: 40px;
width: 100px;
background-color: rgb(0, 0, 128);
border-radius : 50%;
text-align : center;
margin : 2mm;
}
.centre
{
display : inline-block;
vertical-align : middle;
line-height: 20px; /* moitié de la hauteur du logo */
color : white;
font-weight: bold;
font-size : 14pt;
}
#numCerfa
{
width: 100px; /* largeur du logo */
text-align: center;
}
#titre
{
margin : 0 4cm 0 4cm;
text-align : center;
font-size : 14pt;
font-weight: bold;
}
#articles
{
margin : 0 4cm 0 4cm; /* idem titre */
text-align : center;
}
#numRecu
{
text-align : right;
}
#final
{
height : 5cm;
}
.rubrique
{
background-color : rgb(200, 200, 250);
padding : 2mm;
}
.cartouche
{
margin : 2mm auto;
padding : 0 2mm;
border : 1px solid rgb(0, 0, 128);
border-radius : 8px;
}
.titre, .important
{
font-weight:bold;
}
#signature
{
display: block;
max-width : 7cm;
max-height : 2cm;
margin: 0 auto;
padding-bottom : 2mm;
}
#fonction, #nom
{
text-align : center;
}
';
return $out;
});
/**
* imprimer un montant et le taux de réduction associé
* @param montant
* @param taux
*/
$tpl->register_function('imprimer_montant', function ($params)
{
$montant = $params['montant'];
$taux = $params['taux'];
$valeur = number_format($montant, 2, ',', '');
$libelle = Utils::getLigneReduction($taux);
$out = sprintf('
<li>la somme de <b>%s euros</b>',
$valeur);
if ($libelle != "") {
$out .= sprintf(' (%s)', $libelle);
}
$out .= '
</li>
';
return $out;
});
/**
* imprimer les articles du code général des impôts concernés
* @param articles
*/
$tpl->register_function('imprimer_articles', function ($params)
{
$articlesCGI = $params['articles'];
$nbArticles = count($articlesCGI);
$out = "<p>Le bénéficiaire certifie sur lhonneur que les dons et versements quil reçoit ouvrent droit à la réduction d'impôt prévue";
if ($nbArticles == 1)
{
$out .= sprintf(' à larticle %s du code général des impôts</p>', articlesCGI[0]);
}
else if ($nbArticles > 1)
{
$out .= " aux articles ";
for ($i = 0; $i < $nbArticles; ++$i) {
$out .= sprintf("%s", $articlesCGI[$i]);
if ($i < $nbArticles - 2) {
$out .= ", ";
}
else if ($i == $nbArticles - 2) {
$out .= " et ";
}
}
$out .= " du code général des impôts.</p>";
}
return $out;
});
$listeFichiers = array(); // fichiers pdf générés
foreach ($versementsSelectionnes as $ligne)
{
// générer un fichier par reçu
$html = new RecusHTML(
$nomAsso,
$adresseAsso,
$plugin->getConfig('objet_asso'),
$plugin->getConfig('nom_responsable'),
$plugin->getConfig('fonction_responsable'),
$articlesCGI,
$signature
);
// extraire les montants des versements
$lesMontants[$_SESSION['taux_reduction']] = $ligne->versement/100;
$personne = $_SESSION['membresDonateurs'][$ligne->idUser];
$html->imprimer_recu(
$_SESSION['annee_recu'],
$personne->id,
$personne->nomPrenom,
$lesMontants,
$personne->adresse,
$personne->codePostal,
$personne->ville
);
$tpl->assign(compact('nomAsso',
'adresseAsso',
'objetAsso',
'nomResponsable',
'fonctionResponsable',
'articlesCGI',
'signature'
));
$tpl->assign('anneeRecu', $_SESSION['annee_recu']);
$tpl->assign('numero', $personne->id);
$tpl->assign('nom', $personne->nomPrenom);
$tpl->assign('lesMontants', $lesMontants);
$tpl->assign('adresse', $personne->adresse);
$tpl->assign('codePostal', $personne->codePostal);
$tpl->assign('ville', $personne->ville);
// $tpl->assign('styleSheet', 'pdf.css');
// $tpl->assign('styleSheet', \Garradin\PLUGIN_URL . 'pdf.css');
// $tpl->assign('plugin_css', ['pdf.css']);
ob_start();
$tpl->display(PLUGIN_ROOT . '/templates/recuHTML.tpl');
$html = ob_get_clean();
// fabriquer le fichier PDF
$nomPDF = \Garradin\Utils::filePDF($html->get());
$nomPDF = \Garradin\Utils::filePDF($html);
// changer le nom du fichier
$nom = str_replace(' ', '_', $personne->nomPrenom);
$nom = str_replace("'", "", $nom);