[ 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: facturation-details-tableur.php,v 1.3 2005/09/07 10:15:10 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/facturation-details-tableur.php,v $ 20 * 21 * 22 * Génération des détails de facture en tableur 23 * 24 */ 25 require ("../../master.inc.php"); 26 27 require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); 28 require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); 29 require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); 30 require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); 31 require_once (DOL_DOCUMENT_ROOT."/facture.class.php"); 32 require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); 33 require_once (DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); 34 require_once (DOL_DOCUMENT_ROOT."/telephonie/script/facture-detail-tableur-one.class.php"); 35 36 $error = 0; 37 38 /* 39 * 40 * 41 */ 42 $sql = "SELECT max(date_format(date,'%Y%m')) "; 43 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details" ; 44 45 $resql = $db->query($sql); 46 47 if ( $resql) 48 { 49 50 $row = $db->fetch_row($resql); 51 52 $year = substr($row[0],0,4); 53 $month = substr($row[0],4,2); 54 } 55 else 56 { 57 $error++; 58 } 59 60 dolibarr_syslog("Mois $month Année $year"); 61 62 /* 63 * Lectures de différentes lignes 64 */ 65 66 if (!$error) 67 { 68 69 $sql = "SELECT fk_contrat as contrat"; 70 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service"; 71 $sql .= " WHERE fk_service = 3"; 72 73 $contrats = array(); 74 75 if ( $db->query($sql) ) 76 { 77 $num = $db->num_rows(); 78 79 $i = 0; 80 81 while ($i < $num) 82 { 83 $objp = $db->fetch_object( $i); 84 85 $contrats[$i] = $objp->contrat; 86 87 $i++; 88 } 89 $db->free(); 90 } 91 else 92 { 93 $error = 1; 94 dolibarr_syslog($db->error()); 95 } 96 } 97 98 /* 99 * Traitements 100 * 101 */ 102 103 if (!$error) 104 { 105 foreach ($contrats as $contrat) 106 { 107 108 $sql = "SELECT rowid as ligne"; 109 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; 110 $sql .= " WHERE fk_contrat = ".$contrat; 111 112 $resql= $db->query($sql) ; 113 114 if ($resql) 115 { 116 $num = $db->num_rows($resql); 117 118 $i = 0; 119 120 while ($i < $num) 121 { 122 $obj = $db->fetch_object($resql); 123 124 $contrats[$i] = $objp->contrat; 125 126 $facdet = new FactureDetailTableurOne($db); 127 $resg = $facdet->GenerateFile ($obj->ligne, $year, $month); 128 129 if ($resg <> 0) 130 { 131 dolibarr_syslog("ERREUR lors de Génération du détail tableur"); 132 $error = 19; 133 } 134 135 $i++; 136 } 137 $db->free(); 138 } 139 else 140 { 141 $error = 1; 142 dolibarr_syslog($db->error()); 143 } 144 } 145 } 146 147 $db->close(); 148 149 dolibarr_syslog("Conso mémoire ".memory_get_usage() ); 150 ?>
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 |
![]() |