2022-02-22 10:47:54 +01:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Garradin\Plugin\RecusFiscaux;
|
|
|
|
|
|
|
|
|
|
// génération du formulaire
|
|
|
|
|
|
|
|
|
|
class RecusHTML
|
|
|
|
|
{
|
|
|
|
|
private $nomAsso;
|
|
|
|
|
private $adresseAsso;
|
|
|
|
|
private $objetAsso;
|
2022-02-25 15:51:48 +01:00
|
|
|
|
private $nomResponsable;
|
|
|
|
|
private $fonctionResponsable;
|
|
|
|
|
private $articlesCGI;
|
2022-02-22 10:47:54 +01:00
|
|
|
|
private $signature;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* initialize global data
|
|
|
|
|
*/
|
|
|
|
|
function __construct($nomAsso,
|
|
|
|
|
$adresseAsso,
|
|
|
|
|
$objetAsso,
|
2022-02-25 15:51:48 +01:00
|
|
|
|
$nomResponsable,
|
|
|
|
|
$fonctionResponsable,
|
|
|
|
|
$articlesCGI,
|
2022-02-22 10:47:54 +01:00
|
|
|
|
$signature)
|
|
|
|
|
{
|
|
|
|
|
$this->nomAsso = $nomAsso;
|
|
|
|
|
$this->adresseAsso = $adresseAsso;
|
|
|
|
|
$this->objetAsso = $objetAsso;
|
2022-02-25 15:51:48 +01:00
|
|
|
|
$this->nomResponsable = $nomResponsable;
|
|
|
|
|
$this->fonctionResponsable = $fonctionResponsable;
|
2022-02-22 10:47:54 +01:00
|
|
|
|
$this->signature = $signature;
|
2022-02-25 15:51:48 +01:00
|
|
|
|
$this->articlesCGI = $articlesCGI;
|
2022-02-22 10:47:54 +01:00
|
|
|
|
$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)
|
|
|
|
|
{
|
2022-02-25 15:51:48 +01:00
|
|
|
|
$this->imprimer_montant($montant,
|
2022-02-22 10:47:54 +01:00
|
|
|
|
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");
|
2022-02-25 15:51:48 +01:00
|
|
|
|
|
|
|
|
|
// articles du CGI
|
|
|
|
|
$nbArticles = count($this->articlesCGI);
|
|
|
|
|
if ($nbArticles == 1)
|
|
|
|
|
{
|
2022-03-03 12:09:52 +01:00
|
|
|
|
echo "<p>Le bénéficiaire certifie sur l’honneur que les dons et versements qu’il reçoit ouvrent droit à la réduction d'impôt prévue à l’article ";
|
|
|
|
|
printf("%s du code général des impôts</p>\n", $this->articlesCGI[0]);
|
2022-02-25 15:51:48 +01:00
|
|
|
|
}
|
|
|
|
|
else if ($nbArticles > 1)
|
|
|
|
|
{
|
|
|
|
|
echo "<p>Le bénéficiaire certifie sur l’honneur que les dons et versements qu’il 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 ";
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-03 12:09:52 +01:00
|
|
|
|
echo " du code général des impôts</p>\n";
|
2022-02-25 15:51:48 +01:00
|
|
|
|
}
|
2022-02-22 10:47:54 +01:00
|
|
|
|
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" />
|
2022-02-25 15:51:48 +01:00
|
|
|
|
<p id="nom">$this->nomResponsable</p>
|
|
|
|
|
<p id="fonction">$this->fonctionResponsable</p>
|
2022-02-22 10:47:54 +01:00
|
|
|
|
</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;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-25 15:51:48 +01:00
|
|
|
|
// imprimer le montant du versement et un libellé
|
|
|
|
|
function imprimer_montant($montant, $libelle = "")
|
2022-02-22 10:47:54 +01:00
|
|
|
|
{
|
|
|
|
|
$valeur = number_format($montant, 2, ',', '');
|
2022-02-25 15:51:48 +01:00
|
|
|
|
echo "<li>la somme de <b>{$valeur} euros</b>";
|
2022-02-22 10:47:54 +01:00
|
|
|
|
if ($libelle != "") {
|
2022-02-25 15:51:48 +01:00
|
|
|
|
echo " ({$libelle})";
|
2022-02-22 10:47:54 +01:00
|
|
|
|
}
|
|
|
|
|
echo "</li>\n";
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-22 11:26:45 +01:00
|
|
|
|
protected function entete()
|
|
|
|
|
{
|
|
|
|
|
$styleSheet = \Garradin\PLUGIN_ROOT . "/lib/pdf.css";
|
|
|
|
|
ob_start();
|
|
|
|
|
echo <<<FDD
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="{$styleSheet}" />
|
|
|
|
|
</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>
|
2022-02-25 15:51:48 +01:00
|
|
|
|
<p id="articles">Articles 200, 238 bis et 978 du code général des impôts</p>
|
2022-02-22 11:26:45 +01:00
|
|
|
|
|
|
|
|
|
FDD;
|
|
|
|
|
return ob_get_clean();
|
|
|
|
|
}
|
2022-02-22 10:47:54 +01:00
|
|
|
|
}
|