59 |
|
|
60 |
print '<br />'; |
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"; |
$sql = "SELECT distinct statut, count(*) as cc"; |
111 |
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat as l"; |
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat as l"; |
112 |
$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; |
$sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; |
113 |
$sql .= " WHERE l.fk_client_comm = sp.fk_soc"; |
$sql .= " WHERE l.fk_client_comm = sp.fk_soc"; |
114 |
$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; |
$sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; |
|
|
|
|
|
|
115 |
$sql .= " GROUP BY statut"; |
$sql .= " GROUP BY statut"; |
116 |
|
|
117 |
if ($db->query($sql)) |
if ($db->query($sql)) |