PDF pour CERFA
This commit is contained in:
parent
b4629a5ed9
commit
2e6ba2f866
Binary file not shown.
BIN
data/default_sign.png
Normal file
BIN
data/default_sign.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
namespace Garradin;
|
||||
use Garradin\Entities\Files\File;
|
||||
|
||||
$db = DB::getInstance();
|
||||
|
||||
@ -12,3 +13,6 @@ $plugin->setConfig('footer', "[EXEMPLE]\n".
|
||||
"Association enregistrée en préfecture de XXX au numéro YYY"
|
||||
);
|
||||
$plugin->setConfig('validate_cp', true);
|
||||
|
||||
$path = PLUGIN_ROOT.'/data/default_sign.png';
|
||||
$png = (new File)->createAndStore('skel/plugin/facturation','sign.png', $path, null);
|
@ -72,27 +72,25 @@
|
||||
</p>
|
||||
</form>
|
||||
|
||||
{*
|
||||
|
||||
<form method="post" enctype="multipart/form-data" action="{$self_url|escape}" id="f_upload">
|
||||
<fieldset>
|
||||
<legend>Signature du responsable</legend>
|
||||
|
||||
L'image de la signature doit être au format PNG, d'une taille raisonable et doit être dotée d'un fond transparent.
|
||||
|
||||
<p>
|
||||
Uploadez votre signature dans les documents, onglet Squelettes du site web, sous plugin/facturation/sign.png
|
||||
<br>
|
||||
{* <img src="{$image}" /> * }
|
||||
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="{$max_size|escape}" id="f_maxsize" />
|
||||
<dl>
|
||||
<dd class="help">Taille maximale : {$max_size|format_bytes}</dd>
|
||||
<dd class="fileUpload"><input type="file" name="fichier" id="f_fichier" data-hash-check /></dd>
|
||||
</dl>
|
||||
<p class="submit">
|
||||
{csrf_field key="signature_config"}
|
||||
{button type="submit" name="upload" label="Envoyer le fichier" shape="right" class="main"}
|
||||
Il est préférable d'avoir un fond transparent.
|
||||
</p>
|
||||
<br>
|
||||
|
||||
<p>
|
||||
La signature actuelle :
|
||||
<br>
|
||||
<img src="{$www_url}plugin/facturation/sign.png">
|
||||
</p>
|
||||
|
||||
<p>A cause de l'implémentation de la signature, votre signature est acessible publiquement à l'adresse suivante : {$www_url}plugin/facturation/sign.png !</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
*}
|
||||
|
||||
{include file="admin/_foot.tpl"}
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Garradin;
|
||||
use Garradin\Plugin\Facturation\Facture;
|
||||
use Garradin\Entities\Files\File;
|
||||
|
||||
define('DEVIS', 0);
|
||||
define('FACT', 1);
|
||||
@ -136,5 +137,8 @@ EOT
|
||||
$facture->edit($f->id, $data);
|
||||
unset($contenu);
|
||||
}
|
||||
|
||||
$path = PLUGIN_ROOT.'/data/default_sign.png';
|
||||
$png = (new File)->createAndStore('skel/plugin/facturation','sign.png', $path, null);
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ use Garradin\Plugin\Facturation\Client;
|
||||
$client = new Client;
|
||||
$facture = new Facture;
|
||||
|
||||
$tpl->assign('www_url', WWW_URL);
|
||||
$tpl->assign('f_obj', $facture);
|
||||
$tpl->assign('plugin_url', Utils::plugin_url());
|
||||
|
||||
|
@ -306,94 +306,154 @@ EOF;
|
||||
} // Génération du CERFA
|
||||
elseif ($f->type_facture == CERFA)
|
||||
{
|
||||
// nom prénom ? pas de champs prénoms / champs identité pour membres
|
||||
// date d'émission = date du don
|
||||
// date d'échéance = date d'édition du reçu
|
||||
|
||||
$pdf->AddPage();
|
||||
$pdf->setSourceFile(PLUGIN_ROOT . '/data/11580-03.pdf');
|
||||
$pdf->useTemplate(
|
||||
$pdf->importPage(1)
|
||||
);
|
||||
$doc = 'Reçu de don n°'. $f->numero;
|
||||
$url = WWW_URL;
|
||||
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->WriteText(180, 18, $f->numero);
|
||||
$pdf->WriteText(20, 43, $config->get('nom_asso'));
|
||||
$pdf->WriteText(25, 54, $plugin->getConfig('numero_rue_asso'));
|
||||
$pdf->WriteText(43, 54, $plugin->getConfig('rue_asso'));
|
||||
$pdf->WriteText(39, 59, $plugin->getConfig('cp_asso'));
|
||||
$pdf->WriteText(74, 59, $plugin->getConfig('ville_asso'));
|
||||
$pdf->WriteText(20, 70, $plugin->getConfig('objet_0'));
|
||||
$pdf->WriteText(20, 74, $plugin->getConfig('objet_1'));
|
||||
$pdf->WriteText(20, 78, $plugin->getConfig('objet_2'));
|
||||
$pdf->WriteText(19.9, 136, "X");
|
||||
$t['numero'] = $f->numero;
|
||||
$t['nom_asso'] = $config->get('nom_asso');
|
||||
$t['n_rue_asso'] = $plugin->getConfig('numero_rue_asso');
|
||||
$t['rue_asso'] = $plugin->getConfig('rue_asso');
|
||||
$t['cp_asso'] = $plugin->getConfig('cp_asso');
|
||||
$t['ville_asso'] = $plugin->getConfig('ville_asso');
|
||||
$t['objet0'] = $plugin->getConfig('objet_0');
|
||||
$t['objet1'] = $plugin->getConfig('objet_1');
|
||||
$t['objet2'] = $plugin->getConfig('objet_2');
|
||||
|
||||
$pdf->AddPage();
|
||||
$pdf->useTemplate(
|
||||
$pdf->importPage(2)
|
||||
);
|
||||
$t['nom'] = $c->identite;
|
||||
$t['adresse'] = $c->adresse;
|
||||
$t['cp'] = $c->code_postal;
|
||||
$t['ville'] = $c->ville;
|
||||
$t['total'] = '***'.Utils::money_format($f->total).'***';
|
||||
$t['total_lettre'] = numfmt_create('fr_FR', \NumberFormatter::SPELLOUT)->format($f->total/100). ' euros';
|
||||
|
||||
$pdf->WriteText(80, 26, $c->identite); // Nom + prénoms centrés ?
|
||||
// $pdf->WriteText(22, 26, $c->nom); // Nom
|
||||
// $pdf->WriteText(110, 26, $c->nom); // Prénoms
|
||||
$pdf->WriteText(22, 39, $c->adresse);
|
||||
$pdf->WriteText(41, 45, $c->code_postal);
|
||||
$pdf->WriteText(81, 45, $c->ville);
|
||||
$pdf->WriteText(90, 70, utf8_decode("***".$f->total."***"));
|
||||
// numfmt a l'air de patauger avec des valeurs < 1
|
||||
$pdf->WriteText(62, 80, numfmt_create('fr_FR', \NumberFormatter::SPELLOUT)->format($f->total) . ' euros');
|
||||
|
||||
$pdf->WriteText(73, 89.5, utf8_decode($f->date_emission->format('d')));
|
||||
$pdf->WriteText(84, 89.5, utf8_decode($f->date_emission->format('m')));
|
||||
$pdf->WriteText(100, 89.5, utf8_decode($f->date_emission->format('Y')));
|
||||
$t['d'] = utf8_decode($f->date_emission->format('d'));
|
||||
$t['m'] = utf8_decode($f->date_emission->format('m'));
|
||||
$t['Y'] = utf8_decode($f->date_emission->format('Y'));
|
||||
|
||||
$t['art200'] = $t['art238'] = $t['art885'] = '';
|
||||
if($plugin->getConfig('droit_art200')){
|
||||
$pdf->WriteText(57.5, 103.5, "X");
|
||||
$t['art200'] = 'X';
|
||||
}
|
||||
if($plugin->getConfig('droit_art238bis')){
|
||||
$pdf->WriteText(107.6, 103.5, "X");
|
||||
$t['art238'] = 'X';
|
||||
}
|
||||
if($plugin->getConfig('droit_art885-0VbisA')){
|
||||
$pdf->WriteText(157.7, 103.5, "X");
|
||||
$t['art885'] = 'X';
|
||||
}
|
||||
|
||||
// Forme du don
|
||||
$pdf->WriteText(119.9, 121.2, "X");
|
||||
// Nature du don
|
||||
$pdf->WriteText(20, 143.6, "X");
|
||||
|
||||
switch ($f->moyen_paiement){
|
||||
case 'ES':
|
||||
$pdf->WriteText(19.9, 165.9, "X");
|
||||
$t['pos'] = ' top: 158.2mm; left: 15mm;';
|
||||
break;
|
||||
|
||||
case 'CH':
|
||||
$pdf->WriteText(62.6, 165.9, "X");
|
||||
$t['pos'] = ' top: 158.2mm; left: 57.3mm;';
|
||||
break;
|
||||
|
||||
default:
|
||||
$pdf->WriteText(119.9, 165.9, "X");
|
||||
break;
|
||||
$t['pos'] = ' top: 158.2mm; left: 115.2mm;';
|
||||
}
|
||||
|
||||
// Date d'édition du document
|
||||
$pdf->WriteText(144.4, 246.2, utf8_decode($f->date_echeance->format('d')));
|
||||
$pdf->WriteText(152.2, 246.2, utf8_decode($f->date_echeance->format('m')));
|
||||
$pdf->WriteText(160, 246.2, utf8_decode($f->date_echeance->format('Y')));
|
||||
$t['d2'] = utf8_decode($f->date_echeance->format('d'));
|
||||
$t['m2'] = utf8_decode($f->date_echeance->format('m'));
|
||||
$t['Y2'] = utf8_decode($f->date_echeance->format('Y'));
|
||||
|
||||
// Signature
|
||||
/*
|
||||
$img = new Fichiers($plugin->getConfig('signaturetxt'));
|
||||
$cache_id = 'fichiers.' . $img->id_contenu;
|
||||
if (!Static_Cache::exists($cache_id))
|
||||
{
|
||||
$blob = DB::getInstance()->openBlob('fichiers_contenu', 'contenu', (int)$img->id_contenu);
|
||||
Static_Cache::storeFromPointer($cache_id, $blob);
|
||||
fclose($blob);
|
||||
ob_start();
|
||||
echo <<<EOF
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>${doc}_${emission}</title>
|
||||
<style>
|
||||
@page {
|
||||
size: A4 portrait;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
$uri = Static_Cache::getPath($cache_id);
|
||||
$pdf->Image($uri, 150, 245, 32, 0, 'PNG' ); // Emplacement de la signature avec restriction de largeur pour tenir dans sur la case.
|
||||
*/
|
||||
|
||||
body {
|
||||
font-family: Helvetica, Arial, sans;
|
||||
font-size: 10pt;
|
||||
background: white;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.page div {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.page {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
break-after: always;
|
||||
width: 210mm;
|
||||
height: 297mm;
|
||||
background-size: cover;
|
||||
background-position: -5mm -4.8mm;
|
||||
}
|
||||
|
||||
#p1 {
|
||||
background-image: url('${url}p/facturation/cerfa-1.png');
|
||||
}
|
||||
|
||||
#p2 {
|
||||
background-image: url('${url}p/facturation/cerfa-2.png');
|
||||
position: relative;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page" id="p1">
|
||||
<div style="top: 10mm; left: 170mm;">${t['numero']}</div>
|
||||
|
||||
<div style="top: 35mm; left: 20mm;">${t['nom_asso']}</div>
|
||||
<div style="top: 46mm; left: 20mm;">${t['n_rue_asso']}</div>
|
||||
<div style="top: 46mm; left: 40mm;">${t['rue_asso']}</div>
|
||||
<div style="top: 51.5mm; left: 37mm;">${t['cp_asso']}</div>
|
||||
<div style="top: 51.5mm; left: 75mm;">${t['ville_asso']}</div>
|
||||
|
||||
<div style="top: 62mm; left: 18mm;">${t['objet0']}</div>
|
||||
<div style="top: 66.5mm; left: 18mm;">${t['objet1']}</div>
|
||||
<div style="top: 70.8mm; left: 18mm;">${t['objet2']}</div>
|
||||
|
||||
<div style="top: 128.5mm; left: 15mm;">X</div>
|
||||
</div>
|
||||
<div class="page" id="p2">
|
||||
<div style="top: 18mm; left: 18mm;">${t['nom']}</div>
|
||||
<div style="top: 32mm; left: 18mm;">${t['adresse']}</div>
|
||||
<div style="top: 37mm; left: 40mm;">${t['cp']}</div>
|
||||
<div style="top: 37mm; left: 80mm;">${t['ville']}</div>
|
||||
|
||||
<div style="top: 63mm; left: 87mm;">${t['total']}</div>
|
||||
<div style="top: 73mm; left: 58mm;">${t['total_lettre']}</div>
|
||||
|
||||
<div style="top: 82mm; left: 69mm;">${t['d']}</div>
|
||||
<div style="top: 82mm; left: 82mm;">${t['m']}</div>
|
||||
<div style="top: 82mm; left: 99mm;">${t['Y']}</div>
|
||||
|
||||
<div style="top: 96mm; left: 53mm;">${t['art200']}</div>
|
||||
<div style="top: 96mm; left: 103mm;">${t['art238']}</div>
|
||||
<div style="top: 96mm; left: 153.0mm;">${t['art885']}</div>
|
||||
|
||||
<div style="top: 113mm; left: 115mm;">X</div>
|
||||
<div style="top: 136mm; left: 15mm;">X</div>
|
||||
|
||||
<div style="${t['pos']}">X</div>
|
||||
|
||||
<div style="top: 239mm; left: 139mm;">${t['d2']}</div>
|
||||
<div style="top: 239mm; left: 148mm;">${t['m2']}</div>
|
||||
<div style="top: 239mm; left: 156mm;">${t['Y2']}</div>
|
||||
|
||||
<div style="top: 243mm; left: 137mm;"><img src="${url}plugin/facturation/sign.png" style="width: 50mm;"/></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
EOF;
|
||||
|
||||
$html = ob_get_clean();
|
||||
|
||||
} // End if cerfa
|
||||
|
||||
|
||||
|
BIN
www/public/cerfa-1.png
Normal file
BIN
www/public/cerfa-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 391 KiB |
BIN
www/public/cerfa-2.png
Normal file
BIN
www/public/cerfa-2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 228 KiB |
Loading…
Reference in New Issue
Block a user