* * 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"); $page = $_GET["page"]; $sortorder = $_GET["sortorder"]; if (!$user->rights->telephonie->lire) accessforbidden(); llxHeader('','Telephonie - Contrats'); /* * 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 contrat
Numéro
'; print '
'; /* Consultations */ $sql = "SELECT s.idp as socidp, s.nom, max(sc.datec) as dam, c.ref, c.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat as c"; $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_consult as sc"; $sql .= " WHERE s.idp = c.fk_soc"; $sql .= " AND c.rowid = sc.fk_contrat"; $sql .= " AND sc.fk_user = ".$user->id; $sql .= " GROUP BY c.rowid"; $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 ''; print "\n"; $var=!$var; } print "
'.min(10,$num).' dernières fiche contrat consultées
"; print ''; print img_file(); print ' '; $nom = $obj->nom; if (strlen($obj->nom) > 33) $nom = substr($obj->nom,0,30)."..."; print ''.stripslashes($nom).''.$obj->ref.'
"; $db->free($resql); } else { print $db->error() . ' ' . $sql; } /* ===== */ print '
'; $sql = "SELECT distinct statut, count(*) as cc"; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat as l"; $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; $sql .= " WHERE l.fk_client_comm = sp.fk_soc"; $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; $sql .= " GROUP BY statut"; if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; print ''; print ''; print "\n"; $var=True; $contrat = new TelephonieContrat($db); while ($i < $num) { $obj = $db->fetch_object(); $var=!$var; print ""; print "\n"; print '\n"; print ''; print "\n"; $values[$obj->statut] = $obj->cc; $i++; } print "
ContratsNb 
".$contrat->statuts[$obj->statut]."'.$obj->cc."'; print '
"; $db->free(); } else { print $db->error() . ' ' . $sql; } print '
'; $sql = "SELECT c.ref, c.rowid, c.statut"; $sql .= " ,s.idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " , ".MAIN_DB_PREFIX."societe as sf"; $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; $sql .= " , ".MAIN_DB_PREFIX."societe_perms as sp"; $sql .= " WHERE c.fk_soc = s.idp"; $sql .= " AND c.fk_soc_facture = sf.idp"; $sql .= " AND s.idp = sp.fk_soc"; $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; $sql .= " ORDER BY date_creat DESC LIMIT 10;"; $result = $db->query($sql); if ($result) { $num = $db->num_rows(); $i = 0; print"\n\n"; print ''; print ''; print ''; print ''; print ''; print "\n"; $var=True; while ($i < min($num,$conf->liste_limit)) { $obj = $db->fetch_object($i); $var=!$var; print "\n"; print ''; print ''; print "\n"; $i++; } print "
RéférenceClient (Agence/Filiale)Client facturé
"; print ' '; print ''; print img_file(); print ' '; print ''.$obj->ref."'.stripslashes($obj->nom).''.stripslashes($obj->nom_facture).'
"; $db->free(); } else { print $db->error() . ' ' . $sql; } print '
'; $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>