[ 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/includes/modules/fichinter/ -> pdf_soleil.modules.php (source)

   1  <?php
   2  /* Copyright (C) 2003      Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   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   * or see http://www.gnu.org/
  19   *
  20   * $Id: pdf_soleil.modules.php,v 1.17 2005/11/13 01:47:05 eldy Exp $
  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/modules/fichinter/pdf_soleil.modules.php,v $
  22   *
  23   */
  24  
  25  /**
  26          \file       htdocs/includes/modules/fichinter/pdf_soleil.modules.php
  27          \ingroup    ficheinter
  28          \brief      Fichier de la classe permettant de générer les fiches d'intervention au modèle Soleil
  29          \version    $Revision: 1.17 $
  30  */
  31  
  32  require_once(DOL_DOCUMENT_ROOT ."/includes/modules/fichinter/modules_fichinter.php");
  33  
  34  
  35  /**
  36          \class      pdf_soleil
  37          \brief      Classe permettant de générer les fiches d'intervention au modèle Soleil
  38  */
  39  
  40  class pdf_soleil extends ModelePDFFicheinter
  41  {
  42  
  43      /**
  44              \brief      Constructeur
  45              \param        db        handler accès base de donnée
  46      */
  47      function pdf_soleil($db=0)
  48      {
  49          $this->db = $db;
  50          $this->description = "Modèle de fiche d'intervention stantdard";
  51      }
  52  
  53      /**
  54              \brief      Fonction générant la fiche d'intervention sur le disque
  55              \param        id        id de la fiche intervention à générer
  56              \return        int     1=ok, 0=ko
  57      */
  58      function write_pdf_file($id)
  59      {
  60          global $user,$langs,$conf;
  61  
  62          $fich = new Fichinter($this->db,"",$id);
  63          if ($fich->fetch($id))
  64          {
  65              $fichref = sanitize_string($fich->ref);
  66  
  67              $dir = $conf->fichinter->dir_output . "/" . $fichref;
  68              $file = $dir . "/" . $fichref . ".pdf";
  69  
  70              if (! is_dir($dir))
  71              {
  72                  create_exdir($dir);
  73              }
  74  
  75              if (is_dir($dir))
  76              {
  77                  $pdf=new FPDF('P','mm','A4');
  78                  $pdf->Open();
  79                  $pdf->AddPage();
  80  
  81                  $pdf->SetXY(10,5);
  82                  if (defined("FAC_PDF_INTITULE"))
  83                  {
  84                      $pdf->SetTextColor(0,0,200);
  85                      $pdf->SetFont('Arial','B',14);
  86                      $pdf->MultiCell(60, 8, FAC_PDF_INTITULE, 0, 'L');
  87                  }
  88  
  89                  $pdf->SetTextColor(70,70,170);
  90                  if (defined("FAC_PDF_ADRESSE"))
  91                  {
  92                      $pdf->SetFont('Arial','',12);
  93                      $pdf->MultiCell(40, 5, FAC_PDF_ADRESSE);
  94                  }
  95                  if (defined("FAC_PDF_TEL"))
  96                  {
  97                      $pdf->SetFont('Arial','',10);
  98                      $pdf->MultiCell(40, 5, "Tél : ".FAC_PDF_TEL);
  99                  }
 100                  if (defined("MAIN_INFO_SIREN"))
 101                  {
 102                      $pdf->SetFont('Arial','',10);
 103                      $pdf->MultiCell(40, 5, "SIREN : ".MAIN_INFO_SIREN);
 104                  }
 105  
 106                  if (defined("FAC_PDF_INTITULE2"))
 107                  {
 108                      $pdf->SetXY(100,5);
 109                      $pdf->SetFont('Arial','B',14);
 110                      $pdf->SetTextColor(0,0,200);
 111                      $pdf->MultiCell(100, 10, FAC_PDF_INTITULE2, '' , 'R');
 112                  }
 113                  /*
 114                   * Adresse Client
 115                   */
 116                  $pdf->SetTextColor(0,0,0);
 117                  $pdf->SetFont('Arial','B',12);
 118                  $fich->fetch_client();
 119                  $pdf->SetXY(102,42);
 120                  $pdf->MultiCell(66,5, $fich->client->nom);
 121                  $pdf->SetFont('Arial','B',11);
 122                  $pdf->SetXY(102,47);
 123                  $pdf->MultiCell(66,5, $fich->client->adresse . "\n" . $fich->client->cp . " " . $fich->client->ville);
 124                  $pdf->rect(100, 40, 100, 40);
 125  
 126  
 127                  $pdf->SetTextColor(200,0,0);
 128                  $pdf->SetFont('Arial','B',14);
 129                  $pdf->Text(11, 88, "Date : " . strftime("%d %b %Y", $fich->date));
 130                  $pdf->Text(11, 94, "Fiche d'intervention : ".$fich->ref);
 131  
 132                  $pdf->SetFillColor(220,220,220);
 133                  $pdf->SetTextColor(0,0,0);
 134                  $pdf->SetFont('Arial','',12);
 135  
 136                  $tab_top = 100;
 137                  $tab_height = 110;
 138  
 139                  $pdf->SetXY (10, $tab_top);
 140                  $pdf->MultiCell(190,8,'Désignation',0,'L',0);
 141                  $pdf->line(10, $tab_top + 8, 200, $tab_top + 8 );
 142  
 143                  $pdf->Rect(10, $tab_top, 190, $tab_height);
 144  
 145                  $pdf->SetFont('Arial','', 10);
 146  
 147                  $pdf->SetXY (10, $tab_top + 8 );
 148                  $pdf->MultiCell(190, 5, $fich->note, 0, 'J', 0);
 149  
 150                  $pdf->Close();
 151  
 152                  $pdf->Output($file);
 153  
 154                  return 1;
 155              }
 156              else
 157              {
 158                  $this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
 159                  return 0;
 160              }
 161          }
 162          else
 163          {
 164              $this->error=$langs->trans("ErrorConstantNotDefined","FICHINTER_OUTPUTDIR");
 165              return 0;
 166          }
 167          $this->error=$langs->trans("ErrorUnknown");
 168          return 0;   // Erreur par defaut
 169      }
 170  }
 171  
 172  ?>


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