diff --git a/data/11580-03.pdf b/data/11580-03.pdf deleted file mode 100644 index 379a186..0000000 Binary files a/data/11580-03.pdf and /dev/null differ diff --git a/data/default_sign.png b/data/default_sign.png new file mode 100644 index 0000000..38aa69f Binary files /dev/null and b/data/default_sign.png differ diff --git a/install.php b/install.php index ffe4490..cf36a03 100644 --- a/install.php +++ b/install.php @@ -1,5 +1,6 @@ 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); \ No newline at end of file diff --git a/templates/config.tpl b/templates/config.tpl index ab44cd2..4ec6e20 100644 --- a/templates/config.tpl +++ b/templates/config.tpl @@ -72,27 +72,25 @@
-{* + -*} {include file="admin/_foot.tpl"} \ No newline at end of file diff --git a/upgrade.php b/upgrade.php index cb67d5a..5b252c6 100644 --- a/upgrade.php +++ b/upgrade.php @@ -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); } } \ No newline at end of file diff --git a/www/admin/_inc.php b/www/admin/_inc.php index 9f27261..463f4bb 100644 --- a/www/admin/_inc.php +++ b/www/admin/_inc.php @@ -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()); diff --git a/www/admin/pdf.php b/www/admin/pdf.php index 79db94f..6d697f6 100644 --- a/www/admin/pdf.php +++ b/www/admin/pdf.php @@ -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')); + + ob_start(); + echo <<