[ Index ] |
|
Code source de Dolibarr 2.0.1 |
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: export-mailing.php,v 1.2 2005/10/18 14:03:06 eldy Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/scripts/export-mailing.php,v $ 20 * 21 * 22 * Export simple des contacts 23 */ 24 25 require_once ("../htdocs/master.inc.php"); 26 require_once(DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); 27 require_once(DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); 28 29 $error = 0; 30 31 32 $fname = '/tmp/export-client.xls'; 33 34 $workbook = &new writeexcel_workbook($fname); 35 36 $page = &$workbook->addworksheet('Export Dolibarr'); 37 38 $page->set_column(0,4,18); // A 39 40 $sql = "SELECT distinct(c.email),c.name, c.firstname, s.nom "; 41 $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; 42 $sql .= ", ".MAIN_DB_PREFIX."societe as s"; 43 $sql .= " WHERE s.idp = c.fk_soc"; 44 $sql .= " AND s.client = 1"; 45 $sql .= " AND c.email IS NOT NULL"; 46 $sql .= " ORDER BY c.email ASC"; 47 48 if ($db->query($sql)) 49 { 50 $num = $db->num_rows(); 51 52 print "Lignes traitées $num\n"; 53 54 $i = 0; 55 $j = 1; 56 57 $page->write_string(0, 0, "Société"); 58 $page->write_string(0, 1, "Prénom"); 59 $page->write_string(0, 2, "Nom"); 60 $page->write_string(0, 3, "Email"); 61 62 $oldemail = ""; 63 64 while ($i < $num) 65 { 66 $obj = $db->fetch_object(); 67 68 if ($obj->email <> $oldemail) 69 { 70 71 $page->write_string($j, 0, $obj->nom); 72 $page->write_string($j, 1, $obj->firstname); 73 $page->write_string($j, 2, $obj->name); 74 $page->write_string($j, 3, $obj->email); 75 $j++; 76 77 $oldemail = $obj->email; 78 } 79 80 $i++; 81 82 } 83 } 84 85 $workbook->close(); 86 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |