[ 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: index.php,v 1.9 2005/11/23 14:29:35 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/client/index.php,v $ 20 * 21 */ 22 require ("./pre.inc.php"); 23 24 if (!$user->rights->telephonie->lire) 25 accessforbidden(); 26 27 llxHeader('','Telephonie - Clients'); 28 29 /* 30 * Sécurité accés client 31 */ 32 if ($user->societe_id > 0) 33 { 34 $action = ''; 35 $socidp = $user->societe_id; 36 } 37 38 /* 39 * Mode Liste 40 * 41 * 42 * 43 */ 44 45 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 46 47 print '<tr><td width="30%" valign="top">'; 48 49 print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/client/liste.php">'; 50 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 51 print '<tr class="liste_titre"><td>Recherche client</td>'; 52 print "</tr>\n"; 53 print "<tr $bc[1]>"; 54 print '<td>Nom <input name="search_client" size="12"></td></tr>'; 55 print '</table>'; 56 57 print '<br />'; 58 59 $sql = "SELECT distinct s.idp "; 60 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; 61 $sql .= " , ".MAIN_DB_PREFIX."societe as s"; 62 $sql .= " WHERE s.idp = l.fk_client_comm "; 63 $sql .= " AND l.fk_commercial_suiv = ".$user->id; 64 $resql = $db->query($sql); 65 if ($resql) 66 { 67 $num = $db->num_rows($resql); 68 $i = 0; 69 70 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 71 print '<tr class="liste_titre"><td>Clients</td><td valign="center">Nb</td>'; 72 print "</tr>\n"; 73 $var=True; 74 75 $row = $db->fetch_row($resql); 76 77 print "<tr $bc[$var]>"; 78 print '<td><a href="my.php">Mes clients suivis</a></td>'; 79 print "<td>".$num."</td>\n"; 80 print "</tr>\n"; 81 print "</table>"; 82 $db->free(); 83 } 84 else 85 { 86 print $db->error() . ' ' . $sql; 87 } 88 89 print '<br />'; 90 91 /* 92 * Liste 93 * 94 */ 95 $sql = "SELECT s.idp as socidp, s.nom, max(sc.datec) as dam"; 96 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; 97 $sql .= ",".MAIN_DB_PREFIX."societe_consult as sc"; 98 $sql .= " WHERE s.idp = sc.fk_soc"; 99 $sql .= " AND sc.fk_user = ".$user->id; 100 $sql .= " GROUP BY s.idp"; 101 $sql .= " ORDER BY dam DESC LIMIT 10"; 102 103 $resql = $db->query($sql); 104 if ($resql) 105 { 106 $num = $db->num_rows($resql); 107 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 108 print '<tr class="liste_titre"><td>'.min(10,$num).' dernières fiches clients consultées</td></tr>'; 109 $var=True; 110 111 while ($obj = $db->fetch_object($resql)) 112 { 113 print "<tr $bc[$var]><td>"; 114 print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'; 115 print img_file(); 116 print '</a> '; 117 $nom = $obj->nom; 118 if (strlen($obj->nom) > 33) 119 $nom = substr($obj->nom,0,30)."..."; 120 121 print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.stripslashes($nom).'</a></td>'; 122 123 print "</tr>\n"; 124 $var=!$var; 125 } 126 print "</table>"; 127 $db->free($resql); 128 } 129 else 130 { 131 print $db->error() . ' ' . $sql; 132 } 133 134 135 print '</td><td valign="top" width="70%" rowspan="3">'; 136 137 /* 138 * Liste 139 * 140 */ 141 $sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne"; 142 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; 143 $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; 144 145 $sql .= " WHERE l.fk_client_comm = s.idp "; 146 $sql .= " AND s.idp = sp.fk_soc"; 147 $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; 148 $sql .= " GROUP BY s.idp"; 149 $sql .= " ORDER BY s.datec DESC LIMIT 10"; 150 151 $resql = $db->query($sql); 152 if ($resql) 153 { 154 $num = $db->num_rows($resql); 155 $i = 0; 156 157 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 158 print '<tr class="liste_titre"><td>'.min(10,$num).' derniers nouveaux clients</td>'; 159 print '<td width="25%" align="center">Nb Lignes'; 160 print "</td></tr>\n"; 161 162 $var=True; 163 164 $ligne = new LigneTel($db); 165 166 while ($i < $num) 167 { 168 $obj = $db->fetch_object($resql); 169 $var=!$var; 170 171 print "<tr $bc[$var]><td>"; 172 173 print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'; 174 print img_file(); 175 print '</a> '; 176 177 print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.stripslashes($obj->nom).'</a></td>'; 178 print '<td align="center">'.$obj->ligne."</td>\n"; 179 180 print "</tr>\n"; 181 $i++; 182 } 183 print "</table>"; 184 $db->free($resql); 185 } 186 else 187 { 188 print $db->error() . ' ' . $sql; 189 } 190 191 print "<br />"; 192 /* Commentaires */ 193 194 $sql = "SELECT s.idp as socidp, s.nom, c.commentaire"; 195 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_commentaire as c"; 196 $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; 197 198 $sql .= " WHERE c.fk_soc = s.idp "; 199 $sql .= " AND s.idp = sp.fk_soc"; 200 $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; 201 $sql .= " ORDER BY c.datec DESC LIMIT 10"; 202 203 $resql = $db->query($sql); 204 if ($resql) 205 { 206 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 207 print '<tr class="liste_titre"><td colspan="2">'.min(10,$num).' derniers commentaires</td></tr>'; 208 209 while ($obj = $db->fetch_object($resql)) 210 { 211 $var=!$var; 212 print "<tr $bc[$var]><td>"; 213 print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'; 214 print img_file(); 215 print '</a> '; 216 $nom = $obj->nom; 217 if (strlen($obj->nom) > 33) 218 $nom = substr($obj->nom,0,30)."..."; 219 print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.stripslashes($nom).'</a></td>'; 220 print '<td>'.stripslashes($obj->commentaire)."</td>\n"; 221 print "</tr>\n"; 222 } 223 print "</table>"; 224 $db->free($resql); 225 } 226 else 227 { 228 print $db->error() . ' ' . $sql; 229 } 230 231 print '</td></tr>'; 232 print '</table>'; 233 234 $db->close(); 235 236 llxFooter("<em>Dernière modification $Date: 2005/11/23 14:29:35 $ révision $Revision: 1.9 $</em>"); 237 ?>
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 |
![]() |