| 4 | david | 1 | <?php
 | 
        
           |  |  | 2 | // +----------------------------------------------------------------------------+
 | 
        
           |  |  | 3 | // |pdf_recu_et_mail.php												        |
 | 
        
           |  |  | 4 | // +----------------------------------------------------------------------------+
 | 
        
           |  |  | 5 | // | Copyright (c) 2003 Tela Botanica								            |
 | 
        
           |  |  | 6 | // +----------------------------------------------------------------------------+
 | 
        
           |  |  | 7 | // | Ce fichier génère un fichier PDF                                           |
 | 
        
           |  |  | 8 | // | contenant le recu pour une cotisation à Tela Botanica                      |
 | 
        
           |  |  | 9 | // | Il utilise la librairie FPDF                                               |
 | 
        
           |  |  | 10 | // | http://www.fpdf.org/                                                       |
 | 
        
           |  |  | 11 | // | Il envoie également un email à l'adhérent concerné                         |
 | 
        
           |  |  | 12 | // +----------------------------------------------------------------------------+
 | 
        
           |  |  | 13 | // | Auteur : Alexandre Granier <alexandre@tela-botanica.org> 	            	|
 | 
        
           |  |  | 14 | // +----------------------------------------------------------------------------+
 | 
        
           |  |  | 15 | //
 | 
        
           |  |  | 16 | // $Id: recu_pdf_corps.php,v 1.1.1.1 2005/01/03 17:27:49 alex Exp $
 | 
        
           |  |  | 17 |   | 
        
           |  |  | 18 |   | 
        
           |  |  | 19 | // Recherche des informations sur un utilisateur
 | 
        
           |  |  | 20 |   | 
        
           |  |  | 21 | $requete = "select * from annuaire_COTISATION, annuaire_tela, MODE_COTISATION
 | 
        
           |  |  | 22 |             where IC_ID=$cotisation_id
 | 
        
           |  |  | 23 |             and IC_ANNU_ID=U_ID
 | 
        
           |  |  | 24 |             and IC_MC_ID=MC_ID" ;
 | 
        
           |  |  | 25 | $resultat = $db->query($requete) ;
 | 
        
           |  |  | 26 | if (DB::isError ($resultat)) {
 | 
        
           |  |  | 27 |     die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
 | 
        
           |  |  | 28 | }
 | 
        
           |  |  | 29 | $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
 | 
        
           |  |  | 30 | $resultat->free() ;
 | 
        
           |  |  | 31 |   | 
        
           |  |  | 32 | /*
 | 
        
           |  |  | 33 | // On regarde si le reçu a déjà été envoyé
 | 
        
           |  |  | 34 | $requete = "select IC_RECU from annuaire_COTISATION where IC_ID=$cotisation_id" ;
 | 
        
           |  |  | 35 | $resultat = mysql_query ($requete) or die ($requete."<br>".mysql_error()) ;
 | 
        
           |  |  | 36 | $ligne = mysql_fetch_object($resultat) ;
 | 
        
           |  |  | 37 | mysql_free_result($resultat) ;
 | 
        
           |  |  | 38 | */
 | 
        
           |  |  | 39 |   | 
        
           |  |  | 40 | if ($ligne->IC_RECU != 0) {
 | 
        
           |  |  | 41 |     $num_recu = $ligne->IC_RECU ;
 | 
        
           |  |  | 42 |     // $deja_envoye permettra au programme admin_annu.php de ne pas incrementé
 | 
        
           |  |  | 43 |     // le compteur de recu
 | 
        
           |  |  | 44 |     $deja_envoye = true ;
 | 
        
           |  |  | 45 | } else {
 | 
        
           |  |  | 46 |     $res_compteur = $db->query("select COMPTEUR from COMPTEUR_COTISATION") ;
 | 
        
           |  |  | 47 |     $ligne_compteur = $res_compteur->fetchRow(DB_FETCHMODE_OBJECT) ;
 | 
        
           |  |  | 48 |     $num_recu = $ligne_compteur->COMPTEUR ;
 | 
        
           |  |  | 49 |     $deja_envoye = false ;
 | 
        
           |  |  | 50 | }
 | 
        
           |  |  | 51 |   | 
        
           |  |  | 52 | @include_once "api/fpdf/fpdf.php";
 | 
        
           | 540 | jpm | 53 | @include_once "bibliotheque/Words.php";
 | 
        
           | 4 | david | 54 |   | 
        
           |  |  | 55 | if (!isset($envoie)) $chemin = "client/annuaire/" ;
 | 
        
           |  |  | 56 |   | 
        
           |  |  | 57 | // Constante nécessaire à fpdf.php
 | 
        
           |  |  | 58 | define('FPDF_FONTPATH','font/');
 | 
        
           |  |  | 59 |   | 
        
           |  |  | 60 | // Création de l'objet pdf
 | 
        
           |  |  | 61 |   | 
        
           |  |  | 62 | $pdf = new FPDF();
 | 
        
           |  |  | 63 |   | 
        
           |  |  | 64 | $pdf->Open();
 | 
        
           |  |  | 65 | $pdf->AddPage("P");
 | 
        
           |  |  | 66 | // La ligne du haut
 | 
        
           |  |  | 67 |   | 
        
           |  |  | 68 | $pdf->Line(10, 10, 200, 10) ;
 | 
        
           |  |  | 69 |   | 
        
           |  |  | 70 | // Contenu du document
 | 
        
           |  |  | 71 |   | 
        
           |  |  | 72 | $pdf->SetFont('Arial', '', 8) ;
 | 
        
           |  |  | 73 |   | 
        
           |  |  | 74 | $pdf->Cell(150, 10, "", 0, 0) ;
 | 
        
           |  |  | 75 |   | 
        
           |  |  | 76 | $pdf->MultiCell(40, 10, "Numéro d'ordre : $num_recu", 1,1, "C") ;
 | 
        
           |  |  | 77 |   | 
        
           |  |  | 78 | $pdf->SetY($pdf->GetY() - 10) ;
 | 
        
           |  |  | 79 |   | 
        
           |  |  | 80 | $pdf->SetFont('Arial','B',14);
 | 
        
           |  |  | 81 | $pdf->Cell(0,10,'Reçu dons aux uvres', 0, 1, "C");
 | 
        
           |  |  | 82 | $pdf->SetFont('Arial', '', 10) ;
 | 
        
           | 540 | jpm | 83 | $pdf->Cell(0, 0, 'Articles 200, 238 bis et 885-0 du code général des impôts (CGI)', 0, 1, "C") ;
 | 
        
           | 4 | david | 84 |   | 
        
           | 590 | aurelien | 85 | $pdf->Cell(0, 10, 'REÇU A CONSERVER ET A JOINDRE A VOTRE DECLARATION DE REVENUS 2009', 0, 1, "L") ;
 | 
        
           | 4 | david | 86 |   | 
        
           |  |  | 87 | // On met le logo de Tela
 | 
        
           |  |  | 88 | $pdf->Image($chemin."logotb.png", 12, 35, "29", "", "PNG", "http://www.tela-botanica.org/") ;
 | 
        
           |  |  | 89 |   | 
        
           |  |  | 90 |   | 
        
           |  |  | 91 |   | 
        
           |  |  | 92 | // On écrie Les titres du cadre
 | 
        
           |  |  | 93 |   | 
        
           |  |  | 94 | $pdf->SetFontSize(12) ;
 | 
        
           |  |  | 95 | $pdf->Cell(100, 10, 'Bénéficiaire du don', 0, 0, "C") ;
 | 
        
           |  |  | 96 | $pdf->Cell(100, 10, 'Donateur', 0, 1, "C") ;
 | 
        
           |  |  | 97 |   | 
        
           |  |  | 98 | $pdf->SetFont('Arial', 'B', 10) ;
 | 
        
           |  |  | 99 |   | 
        
           |  |  | 100 | $pdf->Cell(38, 5, '', 0, 0) ;
 | 
        
           |  |  | 101 | $pdf->Cell(62, 5, 'Association Tela Botanica', 0, 0, "L") ;
 | 
        
           |  |  | 102 |   | 
        
           |  |  | 103 | $pdf->SetFont('Arial', 'B', 10) ;
 | 
        
           |  |  | 104 |   | 
        
           |  |  | 105 | $pdf->Cell(100, 5, "$ligne->U_NAME $ligne->U_SURNAME", 0, 1, "L") ;
 | 
        
           |  |  | 106 |   | 
        
           |  |  | 107 | $pdf->SetFont('Arial', '', 10) ;
 | 
        
           |  |  | 108 |   | 
        
           |  |  | 109 | $pdf->Cell(38, 5, '', 0, 0) ;
 | 
        
           |  |  | 110 | $pdf->Cell(62, 5, 'Institut de Botanique', 0, 1, "L") ;
 | 
        
           |  |  | 111 | $pdf->Cell(38, 5, '', 0, 0) ;
 | 
        
           |  |  | 112 | $pdf->Cell(62, 5, '163, rue A. Broussonnet', 0, 0, "L") ;
 | 
        
           |  |  | 113 | $pdf->Cell(100, 5, "$ligne->U_ADDR1", 0, 1, "L") ;
 | 
        
           |  |  | 114 |   | 
        
           |  |  | 115 | $pdf->Cell(38, 5, '', 0, 0) ;
 | 
        
           |  |  | 116 | $pdf->Cell(62, 5, '34090 Montpellier', 0, 0, "L") ;
 | 
        
           |  |  | 117 | $pdf->Cell(100, 8, "$ligne->U_ADDR2", 0, 1, "L") ;
 | 
        
           |  |  | 118 |   | 
        
           |  |  | 119 |   | 
        
           |  |  | 120 | $pdf->Cell(100, 5, 'Objet :', 0,1, "L") ;
 | 
        
           |  |  | 121 | $pdf->SetFontSize(8) ;
 | 
        
           |  |  | 122 | $pdf->MultiCell(100, 4, 'Contribuer au rapprochement de tous les botanistes de langue française. Favoriser l\'échange d\'information'.
 | 
        
           |  |  | 123 |                         ' et animer des projets botaniques grâce aux nouvelles technologies de la communication.', 0, 1, "") ;
 | 
        
           |  |  | 124 |   | 
        
           |  |  | 125 | $pdf->SetFontSize(10) ;
 | 
        
           |  |  | 126 |   | 
        
           |  |  | 127 | $pdf->Text(111, 58 + 8, "$ligne->U_ZIP_CODE $ligne->U_CITY") ;
 | 
        
           |  |  | 128 | $pdf->SetFontSize(8) ;
 | 
        
           |  |  | 129 | $pdf->MultiCell(100,4, 'Organisme d\'intérêt général à caractère scientifique concourant à la diffusion de la langue et des connaissances scientifiques françaises.', 0,1, "R") ;
 | 
        
           |  |  | 130 |   | 
        
           |  |  | 131 |   | 
        
           |  |  | 132 | // On remonte le curseur de 52
 | 
        
           |  |  | 133 | $pdf->SetY($pdf->GetY() - 58) ;
 | 
        
           |  |  | 134 |   | 
        
           |  |  | 135 | // Le cadre central
 | 
        
           |  |  | 136 | $pdf->Cell(100, 60, '', 1) ;
 | 
        
           |  |  | 137 | $pdf->Cell(90, 60, '', 1) ;
 | 
        
           |  |  | 138 | $pdf->Ln() ;
 | 
        
           |  |  | 139 |   | 
        
           |  |  | 140 | $pdf->SetFontSize(10) ;
 | 
        
           | 540 | jpm | 141 | $pdf->Cell(0,10, 'L\'Association reconnaît avoir reçu en numéraire, à titre de don, la somme de :', 0, 1, "L") ;
 | 
        
           | 4 | david | 142 |   | 
        
           | 540 | jpm | 143 | $wordsConverter = new Numbers_Words() ;
 | 
        
           |  |  | 144 | $montantLettres = $wordsConverter->toWords($ligne->IC_MONTANT,'fr') ;
 | 
        
           |  |  | 145 |   | 
        
           | 4 | david | 146 | $pdf->SetFont('Arial', 'B', 11) ;
 | 
        
           |  |  | 147 | $pdf->Cell(0,10,  "*** $ligne->IC_MONTANT euros ***", 0, 1, "C") ;
 | 
        
           | 540 | jpm | 148 | $pdf->Ln() ;
 | 
        
           |  |  | 149 | $pdf->Cell(0,10,  "*** ($montantLettres euros) ***", 0, 1, "C") ;
 | 
        
           | 4 | david | 150 |   | 
        
           |  |  | 151 | $pdf->SetFont('Arial', '', 10) ;
 | 
        
           |  |  | 152 |   | 
        
           |  |  | 153 | $pdf->Ln() ;
 | 
        
           | 264 | alex | 154 | $pdf->Cell(100,10, "Date du paiement : ".date("d/m/Y",strtotime($ligne->IC_DATE)), 0, 0, "L") ;
 | 
        
           | 4 | david | 155 | $pdf->Cell(100, 10, 'Montpellier, le '.date("d/m/Y"), 0, 1, "L") ;
 | 
        
           |  |  | 156 |   | 
        
           |  |  | 157 | // La signature de Daniel
 | 
        
           | 550 | jpm | 158 | $pdf->Image($chemin."signature_Mathez.png", 110, $pdf->GetY(),28.22, "") ;
 | 
        
           | 4 | david | 159 |   | 
        
           |  |  | 160 | $pdf->Ln() ;
 | 
        
           |  |  | 161 | $pdf->Cell(0, 10, "Mode de versement : $ligne->MC_LABEL", 0, 1, "L") ;
 | 
        
           |  |  | 162 |   | 
        
           |  |  | 163 | $pdf->Cell(100, 10, '', 0, 0) ;
 | 
        
           | 550 | jpm | 164 | $pdf->Cell (100, 10, 'Joël Mathez, Trésorier', 0, 1, "L") ;
 | 
        
           | 4 | david | 165 | $pdf->Ln(5) ;
 | 
        
           |  |  | 166 |   | 
        
           |  |  | 167 | $pdf->SetFontSize(10) ;
 | 
        
           | 264 | alex | 168 | $pdf->Cell(0, 7, '66 % de votre don à Tela Botanica est déductible de vos impôts dans la limite de 20 % de votre revenu imposable.', 1, 1, "C") ;
 | 
        
           | 4 | david | 169 |   | 
        
           |  |  | 170 |   | 
        
           |  |  | 171 | ?>
 |