152 |
|
|
153 |
print '</td><td valign="top" width="70%">'; |
print '</td><td valign="top" width="70%">'; |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
$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"; |
158 |
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; |
159 |
|
$sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; |
160 |
|
$sql .= " , ".MAIN_DB_PREFIX."societe as sf"; |
161 |
|
$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; |
162 |
|
$sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid"; |
163 |
|
$sql .= " AND l.fk_soc_facture = sf.idp"; |
164 |
|
|
165 |
|
if ($user->rights->telephonie->ligne->lire_restreint) |
166 |
|
{ |
167 |
|
$sql .= " AND l.fk_commercial_suiv = ".$user->id; |
168 |
|
} |
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>10 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"; |
$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"; |
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_concurrents as c,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; |
236 |
$sql .= " WHERE l.fk_concurrent = c.rowid"; |
$sql .= " WHERE l.fk_concurrent = c.rowid"; |