[ Index ] |
|
Code source de Dolibarr 2.0.1 |
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: xlsdetail_nodet.modules.php,v 1.2 2005/04/08 08:30:14 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/pdf/xlsdetail_nodet.modules.php,v $ 20 * 21 * 22 */ 23 require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php"); 24 require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php"); 25 26 class xlsdetail_nodet { 27 28 Function xlsdetail_nodet($DB) 29 { 30 $this->db = $DB; 31 } 32 33 Function GenerateFile($ligne, $fac, $factel) 34 { 35 $this->ligne = $ligne; 36 $error = 0; 37 38 $dir = FAC_OUTPUTDIR . "/" . $fac->ref . "/" ; 39 $fname = $dir . $fac->ref . "-".$ligne->numero."-".$ligne->code_analytique."-detail.xls"; 40 41 //dolibarr_syslog("Open file : $fname"); 42 43 $workbook = &new writeexcel_workbook($fname); 44 45 $page = &$workbook->addworksheet($year."/".substr("00".$month,-2)); 46 47 $fnb =& $workbook->addformat(); 48 $fnb->set_align('vcenter'); 49 $fnb->set_align('right'); 50 51 $fp =& $workbook->addformat(); 52 $fp->set_align('vcenter'); 53 $fp->set_align('right'); 54 $fp->set_num_format('0.000'); 55 56 $fdest =& $workbook->addformat(); 57 $fdest->set_align('vcenter'); 58 59 $page->set_column(0,0,12); // A 60 $page->set_column(1,1,20); // B 61 $page->set_column(2,2,15); // C 62 $page->set_column(3,3,30); // D 63 $page->set_column(6,6,7); // G 64 $page->set_column(9,9,7); // J 65 $page->set_column(12,12,7); // M 66 67 $page->write(0, 0, "Ligne", $format_titre_agence1); 68 $page->write(0, 1, "Date", $format_titre); 69 $page->write(0, 2, "Numero", $format_titre); 70 $page->write(0, 3, "Destination", $format_titre); 71 $page->write(0, 4, "Durée", $format_titre); 72 $page->write(0, 5, "Cout HT", $format_titre); 73 74 $sql = "SELECT ligne, date, numero, dest, dureetext, duree, cout_vente"; 75 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; 76 $sql .= " WHERE fk_telephonie_facture = '".$factel->id."'"; 77 $sql .= " ORDER BY date ASC"; 78 79 $resql = $this->db->query($sql); 80 81 if ($resql) 82 { 83 $i = 0; 84 $numsql = $this->db->num_rows($resql); 85 86 //dolibarr_syslog($this->ligne->numero . " : ".$numsql); 87 88 while ($i < $numsql) 89 { 90 $obj = $this->db->fetch_object($resql); 91 92 $xx = $i + 1; 93 94 $page->write_string($xx, 0, $obj->ligne, $fdest); 95 $page->write_string($xx, 1, $obj->date, $fdest); 96 $page->write_string($xx, 2, $obj->numero, $fdest); 97 $page->write_string($xx, 3, $obj->dest, $fdest); 98 $page->write($xx, 4, $obj->duree, $fnb); 99 $page->write($xx, 5, $obj->cout_vente, $fp); 100 101 $i++; 102 } 103 $this->db->free($resql); 104 } 105 else 106 { 107 dolibarr_syslog($this->db->error()); 108 } 109 110 $workbook->close(); 111 //dolibarr_syslog("Close $fname"); 112 113 return $error; 114 } 115 } 116 ?>
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 |
![]() |