[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?PHP 2 /* Copyright (C) 2004-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: index.php,v 1.8 2005/09/02 15:13:36 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/ligne/index.php,v $ 20 * 21 */ 22 require ("./pre.inc.php"); 23 24 if (!$user->rights->telephonie->lire) 25 accessforbidden(); 26 27 $page = $_GET["page"]; 28 $sortorder = $_GET["sortorder"]; 29 30 llxHeader('','Telephonie - Lignes'); 31 32 /* 33 * Sécurité accés client 34 */ 35 if ($user->societe_id > 0) 36 { 37 $action = ''; 38 $socidp = $user->societe_id; 39 } 40 41 /* 42 * Mode Liste 43 * 44 * 45 * 46 */ 47 print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php">'; 48 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 49 50 print '<tr><td width="30%" valign="top">'; 51 52 53 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 54 print '<tr class="liste_titre"><td>Recherche ligne</td>'; 55 print "</tr>\n"; 56 print "<tr $bc[1]>"; 57 print '<td>Numéro <input name="search_ligne" size="12"></td></tr>'; 58 print '</table>'; 59 60 print '<br />'; 61 62 63 $sql = "SELECT distinct statut, count(*) as cc"; 64 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; 65 $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; 66 $sql .= " WHERE l.fk_client_comm = sp.fk_soc"; 67 $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; 68 $sql .= " GROUP BY statut"; 69 70 $resql = $db->query($sql); 71 if ($resql) 72 { 73 $num = $db->num_rows($resql); 74 $i = 0; 75 $ligne = new LigneTel($db); 76 77 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 78 print '<tr class="liste_titre"><td>Lignes Statuts</td><td valign="center">Nb</td><td> </td>'; 79 print "</tr>\n"; 80 $var=True; 81 82 while ($i < min($num,$conf->liste_limit)) 83 { 84 $obj = $db->fetch_object($resql); 85 $values[$obj->statut] = $obj->cc; 86 $i++; 87 } 88 89 foreach ($ligne->statuts as $key => $statut) 90 { 91 $var=!$var; 92 print "<tr $bc[$var]>"; 93 print "<td>".$statut."</td>\n"; 94 print "<td>".$values[$key]."</td>\n"; 95 print '<td><a href="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php?statut='.$key.'"><img border="0" src="./graph'.$key.'.png"></a></td>'; 96 print "</tr>\n"; 97 } 98 99 print "</table>"; 100 $db->free(); 101 } 102 else 103 { 104 print $db->error() . ' ' . $sql; 105 } 106 107 108 109 if ($user->rights->telephonie->fournisseur->lire) 110 { 111 print '<br />'; 112 $sql = "SELECT distinct f.nom as fournisseur, f.rowid, count(*) as cc"; 113 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; 114 $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; 115 $sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid"; 116 if ($user->rights->telephonie->ligne->lire_restreint) 117 { 118 $sql .= " AND l.fk_commercial_suiv = ".$user->id; 119 } 120 $sql .= " GROUP BY f.nom"; 121 122 if ($db->query($sql)) 123 { 124 $num = $db->num_rows(); 125 $i = 0; 126 127 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 128 print '<tr class="liste_titre"><td>Fournisseur</td><td valign="center">Nb</td>'; 129 print "</tr>\n"; 130 $var=True; 131 132 while ($i < $num) 133 { 134 $obj = $db->fetch_object($i); 135 $var=!$var; 136 137 print "<tr $bc[$var]>"; 138 print '<td><a href="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php?fournisseur='.$obj->rowid.'">'; 139 print $obj->fournisseur.'</a></td>'; 140 print "<td>".$obj->cc."</td>\n"; 141 print "</tr>\n"; 142 $i++; 143 } 144 print "</table>"; 145 $db->free(); 146 } 147 else 148 { 149 print $db->error() . ' ' . $sql; 150 } 151 } 152 153 print '</td><td valign="top" width="70%">'; 154 155 $sql = "SELECT s.idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; 156 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; 157 $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; 158 $sql .= " , ".MAIN_DB_PREFIX."societe as sf"; 159 $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; 160 161 $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; 162 163 $sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid"; 164 165 $sql .= " AND s.idp = sp.fk_soc"; 166 $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; 167 168 $sql .= " AND l.fk_soc_facture = sf.idp"; 169 170 $sql .= " ORDER BY rowid DESC LIMIT 10"; 171 172 $resql = $db->query($sql); 173 if ($resql) 174 { 175 $num = $db->num_rows($resql); 176 $i = 0; 177 178 179 print"\n<!-- debut table -->\n"; 180 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 181 print '<tr class="liste_titre">'; 182 print '<td>'.min(10,$num).' Dernières lignes</td>'; 183 print '<td>Client (Agence/Filiale)</td>'; 184 print '<td align="center">Statut</td>'; 185 186 if ($user->rights->telephonie->fournisseur->lire) 187 print '<td>Fournisseur</td>'; 188 189 print "</tr>\n"; 190 191 $var=True; 192 193 $ligne = new LigneTel($db); 194 195 while ($i < $num) 196 { 197 $obj = $db->fetch_object(); 198 $var=!$var; 199 200 print "<tr $bc[$var]><td>"; 201 print '<img src="./graph'.$obj->statut.'.png"> '; 202 203 print '<a href="'.DOL_URL_ROOT.'/telephonie/ligne/fiche.php?id='.$obj->rowid.'">'; 204 print img_file(); 205 print '</a> '; 206 207 print '<a href="fiche.php?id='.$obj->rowid.'">'.dolibarr_print_phone($obj->ligne)."</a></td>\n"; 208 209 $nom = stripslashes($obj->nom); 210 if (strlen(stripslashes($obj->nom)) > 20) 211 { 212 $nom = substr(stripslashes($obj->nom),0,20)."..."; 213 } 214 215 print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.$nom.'</a></td>'; 216 217 print '<td align="center">'.$ligne->statuts[$obj->statut]."</td>\n"; 218 219 if ($user->rights->telephonie->fournisseur->lire) 220 print "<td>".$obj->fournisseur."</td>\n"; 221 print "</tr>\n"; 222 $i++; 223 } 224 print "</table><br />"; 225 $db->free(); 226 } 227 else 228 { 229 print $db->error() . ' ' . $sql; 230 } 231 232 233 234 $sql = "SELECT distinct c.nom as concurrent, count(*) as cc"; 235 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_concurrents as c,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; 236 237 $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; 238 $sql .= " WHERE l.fk_client_comm = sp.fk_soc"; 239 $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; 240 $sql .= " AND l.fk_concurrent = c.rowid"; 241 242 $sql .= " GROUP BY c.nom"; 243 244 if ($db->query($sql)) 245 { 246 $num = $db->num_rows(); 247 $i = 0; 248 249 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 250 print '<tr class="liste_titre"><td>Concurrents</td><td valign="center">Nb</td>'; 251 print "</tr>\n"; 252 $var=True; 253 254 while ($i < $num) 255 { 256 $obj = $db->fetch_object($i); 257 $var=!$var; 258 259 print "<tr $bc[$var]>"; 260 print "<td>".$obj->concurrent."</td>\n"; 261 print "<td>".$obj->cc."</td>\n"; 262 print "</tr>\n"; 263 $i++; 264 } 265 print "</table>"; 266 $db->free(); 267 } 268 else 269 { 270 print $db->error() . ' ' . $sql; 271 } 272 273 print "</td></tr>\n"; 274 print "</table>\n</form>\n"; 275 276 $db->close(); 277 278 llxFooter("<em>Dernière modification $Date: 2005/09/02 15:13:36 $ révision $Revision: 1.8 $</em>"); 279 ?>
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 |
![]() |