[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/adherents/cartes/ -> etiquette.php (source)

   1  <?php
   2  /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>

   3   * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>

   4   *

   5   * This program is free software; you can redistribute it and/or modify

   6   * it under the terms of the GNU General Public License as published by

   7   * the Free Software Foundation; either version 2 of the License, or

   8   * (at your option) any later version.

   9   *

  10   * This program is distributed in the hope that it will be useful,

  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of

  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

  13   * GNU General Public License for more details.

  14   *

  15   * You should have received a copy of the GNU General Public License

  16   * along with this program; if not, write to the Free Software

  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

  18   *

  19   * $Id: etiquette.php,v 1.6 2004/10/23 16:55:07 eldy Exp $

  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/adherents/cartes/etiquette.php,v $

  21   *

  22   */
  23  
  24  /*! \file htdocs/adherents/cartes/etiquette.php

  25          \ingroup    adherent

  26          \brief      Page de creation d'etiquettes

  27          \version    $Revision: 1.6 $

  28  */
  29  
  30  require ("./pre.inc.php");
  31  require (DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
  32  
  33  require_once ('PDF_card.class.php');
  34  
  35  /*

  36   *-------------------------------------------------

  37   * Pour créer l'objet on a 2 moyens :

  38   * Soit on donne les valeurs en les passant dans un tableau (sert pour un format personnel)

  39   * Soit on donne le type d'étiquette au format AVERY

  40   *-------------------------------------------------

  41  */
  42  
  43  //$pdf = new PDF_Label(array('name'=>'perso1', 'marginLeft'=>1, 'marginTop'=>1, 'NX'=>2, 'NY'=>7, 'SpaceX'=>0, 'SpaceY'=>0, 'width'=>99.1, 'height'=>'38.1', 'metric'=>'mm', 'font-size'=>14), 1, 2);

  44  //$pdf = new PDF_card('CARD', 1, 1);

  45  if (defined("ADHERENT_ETIQUETTE_TYPE") && ADHERENT_ETIQUETTE_TYPE !=''){
  46    $pdf = new PDF_card(ADHERENT_ETIQUETTE_TYPE, 1, 1);
  47  }else{
  48    $pdf = new PDF_card('L7163', 1, 1);
  49  }
  50  
  51  $pdf->Open();
  52  $pdf->AddPage();
  53  
  54  // Choix de l'annee d'impression ou annee courante.

  55  if (!isset($annee)){
  56    $now = getdate();
  57    $annee=$now['year'];
  58  }
  59  
  60  // requete en prenant que les adherents a jour de cotisation

  61  $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin, adresse,cp,ville,pays, t.libelle as type, d.naiss, d.email, d.photo";
  62  $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
  63  $sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND datefin > now()";
  64  $sql .= " ORDER BY d.rowid ASC ";
  65  
  66  $result = $db->query($sql);
  67  if ($result) 
  68  {
  69    $num = $db->num_rows();
  70    $i = 0;
  71    while ($i < $num)
  72      {
  73        $objp = $db->fetch_object($result);
  74        // imprime le texte specifique sur la carte

  75        $pdf->Add_PDF_card(sprintf("%s\n%s\n%s %s\n%s", ucfirst(strtolower($objp->prenom))." ".strtoupper($objp->nom), ucwords(strtolower($objp->adresse)), $objp->cp, strtoupper($objp->ville), ucfirst(strtolower($objp->pays))),'','');
  76        $i++;
  77      }
  78  
  79    $db->close();
  80    $pdf->Output();
  81  }else{
  82    llxHeader();
  83    print "Erreur de la base de données : ".$db->error();
  84    llxFooter("<em>Derni&egrave;re modification $Date: 2004/10/23 16:55:07 $ r&eacute;vision $Revision: 1.6 $</em>");
  85  }
  86  ?> 


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics