[ 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/telephonie/script/tools/ -> export-recap-client52.php (source)

   1  <?PHP
   2  /* Copyright (C) 2005 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: export-recap-client52.php,v 1.4 2005/12/19 11:12:22 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/tools/export-recap-client52.php,v $
  20   *
  21   * Vérifie les lignes ayant le statut d'attente
  22   *
  23   */
  24  require  ("../../../master.inc.php");
  25  require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php");
  26  require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php");
  27  /*
  28   *
  29   */
  30  $sql  = "SELECT l.ligne,s.nom,fc.datef, f.cout_vente";
  31  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f";
  32  $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c";
  33  $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
  34  $sql .= " , ".MAIN_DB_PREFIX."societe as s";
  35  $sql .= " , ".MAIN_DB_PREFIX."facture as fc";
  36  
  37  $sql .= " WHERE date_format(f.date,'%Y') = '2005'";
  38  $sql .= " AND l.fk_contrat = c.rowid";
  39  $sql .= " AND c.fk_client_comm = 52";
  40  $sql .= " AND f.ligne = l.ligne";
  41  $sql .= " AND l.fk_soc_facture =s.idp";
  42  $sql .= " AND fc.rowid = f.fk_facture";
  43  $sql .= " ORDER BY f.date ASC, f.fk_ligne ASC";
  44  
  45  $resql = $db->query($sql);
  46  if ( $resql )
  47  {
  48    $fname = "/tmp/export-52.xls";
  49  
  50    $workbook = &new writeexcel_workbook($fname);
  51      
  52    $page = &$workbook->addworksheet("2005");
  53      
  54      
  55    $page->write(0, 0,  "Ligne", $format_titre_agence1);
  56    $page->write(0, 1,  "Client", $format_titre);
  57    $page->write(0, 2,  "Cout", $format_titre);
  58    $page->write(0, 3,  "Date", $format_titre);
  59    
  60    $fnb =& $workbook->addformat();
  61    $fnb->set_align('vcenter');
  62    $fnb->set_align('left');
  63  
  64    $i = 1;
  65    while ($row = $db->fetch_row($resql))
  66      {
  67        print $row[0]. " ".$row[1]." ".$row[3]." ".$row[2]."\n";
  68  
  69        $xx = $i + 1;
  70        
  71        $page->write_string($xx, 0,  $row[0], $fnb);
  72        $page->write_string($xx, 1,  $row[1], $fnb);
  73        $page->write_number($xx, 2,  $row[3], $fnb);
  74        $page->write_string($xx, 3,  $row[2], $fnb);
  75  
  76        $i++;
  77      }
  78  
  79    $workbook->close();
  80  
  81  }
  82  
  83  else
  84  {
  85    print $db->error();
  86  }
  87  
  88  
  89  
  90  $db->close();
  91  ?>


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