* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ * */ require("./pre.inc.php"); if (!$user->rights->telephonie->lire) accessforbidden(); llxHeader('','Telephonie - Clients'); /* * Sécurité accés client */ if ($user->societe_id > 0) { $action = ''; $socidp = $user->societe_id; } /* * Mode Liste * * * */ print ''; print ''; print '
'; print '
'; print ''; print ''; print "\n"; print ""; print ''; print '
Recherche client
Nom
'; print '
'; $sql = "SELECT distinct s.idp "; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= " , ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.idp = l.fk_client_comm "; $sql .= " AND l.fk_commercial_suiv = ".$user->id; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; print ''; print ''; print "\n"; $var=True; $row = $db->fetch_row($resql); print ""; print ''; print "\n"; print "\n"; print "
ClientsNb
Mes clients suivis".$num."
"; $db->free(); } else { print $db->error() . ' ' . $sql; } print '
'; /* * Liste * */ $sql = "SELECT s.idp as socidp, s.nom, max(sc.datec) as dam"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."societe_consult as sc"; $sql .= " WHERE s.idp = sc.fk_soc"; $sql .= " AND sc.fk_user = ".$user->id; $sql .= " GROUP BY s.idp"; $sql .= " ORDER BY dam DESC LIMIT 10"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); print ''; print ''; $var=True; while ($obj = $db->fetch_object($resql)) { print "'; print "\n"; $var=!$var; } print "
'.min(10,$num).' dernières fiches clients consultées
"; print ''; print img_file(); print ' '; $nom = $obj->nom; if (strlen($obj->nom) > 33) $nom = substr($obj->nom,0,30)."..."; print ''.stripslashes($nom).'
"; $db->free($resql); } else { print $db->error() . ' ' . $sql; } print '
'; /* * Liste * */ $sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; $sql .= " WHERE l.fk_client_comm = s.idp "; $sql .= " AND s.idp = sp.fk_soc"; $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; $sql .= " GROUP BY s.idp"; $sql .= " ORDER BY s.datec DESC LIMIT 10"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; print ''; print ''; print '\n"; $var=True; $ligne = new LigneTel($db); while ($i < $num) { $obj = $db->fetch_object($resql); $var=!$var; print "'; print '\n"; print "\n"; $i++; } print "
'.min(10,$num).' derniers nouveaux clientsNb Lignes'; print "
"; print ''; print img_file(); print ' '; print ''.stripslashes($obj->nom).''.$obj->ligne."
"; $db->free($resql); } else { print $db->error() . ' ' . $sql; } print "
"; /* Commentaires */ $sql = "SELECT s.idp as socidp, s.nom, c.commentaire"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_commentaire as c"; $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; $sql .= " WHERE c.fk_soc = s.idp "; $sql .= " AND s.idp = sp.fk_soc"; $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; $sql .= " ORDER BY c.datec DESC LIMIT 10"; $resql = $db->query($sql); if ($resql) { print ''; print ''; while ($obj = $db->fetch_object($resql)) { $var=!$var; print "'; print '\n"; print "\n"; } print "
'.min(10,$num).' derniers commentaires
"; print ''; print img_file(); print ' '; $nom = $obj->nom; if (strlen($obj->nom) > 33) $nom = substr($obj->nom,0,30)."..."; print ''.stripslashes($nom).''.stripslashes($obj->commentaire)."
"; $db->free($resql); } else { print $db->error() . ' ' . $sql; } print '
'; $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>