| [ 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: index.php,v 1.9 2005/11/23 10:24:30 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/contrat/index.php,v $ 20 * 21 */ 22 require ("./pre.inc.php"); 23 24 $page = $_GET["page"]; 25 $sortorder = $_GET["sortorder"]; 26 27 if (!$user->rights->telephonie->lire) 28 accessforbidden(); 29 30 llxHeader('','Telephonie - Contrats'); 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 48 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 49 50 print '<tr><td width="30%" valign="top">'; 51 52 print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/contrat/liste.php">'; 53 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 54 print '<tr class="liste_titre"><td>Recherche contrat</td>'; 55 print "</tr>\n"; 56 print "<tr $bc[1]>"; 57 print '<td>Numéro <input name="search_contrat" size="12"></td></tr>'; 58 print '</table></form>'; 59 60 print '<br />'; 61 62 /* Consultations */ 63 64 $sql = "SELECT s.idp as socidp, s.nom, max(sc.datec) as dam, c.ref, c.rowid"; 65 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; 66 $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat as c"; 67 $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_consult as sc"; 68 $sql .= " WHERE s.idp = c.fk_soc"; 69 $sql .= " AND c.rowid = sc.fk_contrat"; 70 $sql .= " AND sc.fk_user = ".$user->id; 71 $sql .= " GROUP BY c.rowid"; 72 $sql .= " ORDER BY dam DESC LIMIT 10"; 73 74 $resql = $db->query($sql); 75 if ($resql) 76 { 77 $num = $db->num_rows($resql); 78 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 79 print '<tr class="liste_titre"><td colspan="2">'.min(10,$num).' dernières fiche contrat consultées</td></tr>'; 80 $var=True; 81 82 while ($obj = $db->fetch_object($resql)) 83 { 84 print "<tr $bc[$var]><td>"; 85 print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'; 86 print img_file(); 87 print '</a> '; 88 $nom = $obj->nom; 89 if (strlen($obj->nom) > 33) 90 $nom = substr($obj->nom,0,30)."..."; 91 92 print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.stripslashes($nom).'</a></td>'; 93 94 print '<td><a href="'.DOL_URL_ROOT.'/telephonie/contrat/fiche.php?id='.$obj->rowid.'">'.$obj->ref.'</a></td>'; 95 96 print "</tr>\n"; 97 $var=!$var; 98 } 99 print "</table>"; 100 $db->free($resql); 101 } 102 else 103 { 104 print $db->error() . ' ' . $sql; 105 } 106 107 /* ===== */ 108 print '<br />'; 109 110 $sql = "SELECT distinct statut, count(*) as cc"; 111 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat as l"; 112 $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; 113 $sql .= " WHERE l.fk_client_comm = sp.fk_soc"; 114 $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; 115 $sql .= " GROUP BY statut"; 116 117 if ($db->query($sql)) 118 { 119 $num = $db->num_rows(); 120 $i = 0; 121 122 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 123 print '<tr class="liste_titre"><td>Contrats</td><td align="center">Nb</td><td> </td>'; 124 print "</tr>\n"; 125 $var=True; 126 127 $contrat = new TelephonieContrat($db); 128 129 while ($i < $num) 130 { 131 $obj = $db->fetch_object(); 132 133 $var=!$var; 134 print "<tr $bc[$var]>"; 135 print "<td>".$contrat->statuts[$obj->statut]."</td>\n"; 136 print '<td align="center">'.$obj->cc."</td>\n"; 137 print '<td><a href="liste.php?statut='.$obj->statut.'">'; 138 print '<img border="0" src="statut'.$obj->statut.'.png"></a></td>'; 139 print "</tr>\n"; 140 141 $values[$obj->statut] = $obj->cc; 142 $i++; 143 } 144 print "</table>"; 145 $db->free(); 146 } 147 else 148 { 149 print $db->error() . ' ' . $sql; 150 } 151 152 153 154 155 print '</td><td valign="top" width="70%">'; 156 157 $sql = "SELECT c.ref, c.rowid, c.statut"; 158 $sql .= " ,s.idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom"; 159 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; 160 $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; 161 $sql .= " , ".MAIN_DB_PREFIX."societe as sf"; 162 $sql .= " , ".MAIN_DB_PREFIX."societe_perms as sp"; 163 164 $sql .= " WHERE c.fk_client_comm = s.idp"; 165 $sql .= " AND c.fk_soc = sf.idp"; 166 167 $sql .= " AND c.fk_client_comm = sp.fk_soc"; 168 $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; 169 170 171 $sql .= " ORDER BY date_creat DESC LIMIT 10;"; 172 173 $result = $db->query($sql); 174 if ($result) 175 { 176 $num = $db->num_rows(); 177 $i = 0; 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 183 print '<td>Référence</td>'; 184 print '<td>Client (Agence/Filiale)</td>'; 185 print '<td>Client facturé</td>'; 186 print "</tr>\n"; 187 188 $var=True; 189 190 while ($i < min($num,$conf->liste_limit)) 191 { 192 $obj = $db->fetch_object($i); 193 $var=!$var; 194 195 print "<tr $bc[$var]><td>"; 196 print '<img src="statut'.$obj->statut.'.png"> '; 197 print '<a href="'.DOL_URL_ROOT.'/telephonie/ligne/fiche.php?id='.$obj->rowid.'">'; 198 print img_file(); 199 print '</a> '; 200 201 print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n"; 202 203 print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.stripslashes($obj->nom).'</a></td>'; 204 print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->sfidp.'">'.stripslashes($obj->nom_facture).'</a></td>'; 205 206 print "</tr>\n"; 207 $i++; 208 } 209 print "</table>"; 210 $db->free(); 211 } 212 else 213 { 214 print $db->error() . ' ' . $sql; 215 } 216 217 218 219 print '</td></tr>'; 220 221 222 print '</table>'; 223 224 225 226 $db->close(); 227 228 llxFooter("<em>Dernière modification $Date: 2005/11/23 10:24:30 $ révision $Revision: 1.9 $</em>"); 229 ?>
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 |
|