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;
|
2022-03-17 15:55:54 +01:00
|
|
|
|
private $villeAsso;
|
2022-02-25 15:51:48 +01:00
|
|
|
|
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">
|
2022-03-17 15:55:54 +01:00
|
|
|
|
<p>{this->villeAsso} le {$date}</p>
|
2022-02-22 10:47:54 +01:00
|
|
|
|
<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()
|
|
|
|
|
{
|
2022-03-04 13:54:53 +01:00
|
|
|
|
// $styleSheet = \Garradin\PLUGIN_ROOT . "/lib/pdf.css";
|
|
|
|
|
// error_log("pdf.css = " . $styleSheet);
|
2022-02-22 11:26:45 +01:00
|
|
|
|
ob_start();
|
|
|
|
|
echo <<<FDD
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8" />
|
2022-03-04 13:54:53 +01:00
|
|
|
|
<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>
|
2022-02-22 11:26:45 +01:00
|
|
|
|
</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
|
|
|
|
}
|