[ 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/compta/export/modules/ -> compta.export.safran.class.php (source)

   1  <?PHP
   2  /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: compta.export.safran.class.php,v 1.2 2005/07/10 21:00:55 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/export/modules/compta.export.safran.class.php,v $
  20   */
  21  
  22  require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php";
  23  require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php";
  24  
  25  
  26  class ComptaExportTableur extends ComptaExport
  27  {
  28  
  29      function ComptaExportTableur ()
  30      {
  31  
  32      }
  33  
  34      function Create()
  35      {
  36  
  37          $this->date = time();
  38  
  39          $this->datef = "commande-".strftime("%d%b%y-%HH%M", $this->date);
  40  
  41          $fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$this->datef.".xls";
  42  
  43          if (strlen(trim($this->fournisseur->email_commande)) == 0)
  44          {
  45              return -3;
  46          }
  47  
  48          if (file_exists($fname))
  49          {
  50              return 2;
  51          }
  52          else
  53          {
  54              $res = $this->CreateFile($fname);
  55              $res = $res + $this->LogSql();
  56              $res = $res + $this->MailFile($fname);
  57  
  58              return $res;
  59          }
  60      }
  61  
  62      function Export($linec)
  63      {
  64          $fname = "/tmp/toto.xls";
  65  
  66          $workbook = &new writeexcel_workbook($fname);
  67  
  68          $worksheet = &$workbook->addworksheet();
  69  
  70          // Pour les factures
  71  
  72          // Date Opération 040604 pour 4 juin 2004
  73          // VE -> ventilation
  74          // code Compte général
  75          // code client
  76          // Intitul
  77          // Numéro de pièce
  78          // Montant
  79          // Type opération D pour Débit ou C pour Crédit
  80          // Date d'échéance, = à la date d'opération si pas d'échéance
  81          // EUR pour Monnaie en Euros
  82  
  83          // Pour les paiements
  84  
  85          $worksheet->set_column('A:A', 20);
  86          $worksheet->set_column('B:B', 20);
  87          $worksheet->set_column('C:C', 15);
  88          $worksheet->set_column('D:D', 9);
  89          $worksheet->set_column('E:E', 16);
  90          $worksheet->set_column('F:F', 18);
  91          $worksheet->set_column('G:G', 20);
  92  
  93          $i = 0;
  94          $j = 0;
  95          $n = sizeof($linec);
  96  
  97          $oldfacture = 0;
  98  
  99          for ( $i = 0 ; $i < $n ; $i++)
 100          {
 101              if ( $oldfacture <> $linec[$i][1])
 102              {
 103                  $worksheet->write_string($j, 0,  strftime("%d%m%y",$linec[$i][0]));
 104                  $worksheet->write_string($j, 1,  'VE');
 105                  $worksheet->write_string($j, 3,  '411000000');
 106                  $worksheet->write_string($j, 4,  $linec[$i][3]." Facture");
 107  
 108  
 109                  $oldfacture = $linec[$i][1];
 110                  $j++;
 111              }
 112  
 113  
 114  
 115              $worksheet->write_string($j, 0,  strftime("%d%m%y",$linec[$i][0]));
 116              $worksheet->write_string($j, 1,  'VE');
 117              $worksheet->write_string($j, 2,  $linec[$i][4]);
 118              $worksheet->write_string($j, 4,  $linec[$i][3]." Facture");
 119  
 120              $j++;
 121  
 122          }
 123  
 124          $workbook->close();
 125  
 126          return 0;
 127      }
 128  }


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