Skip to content
Snippets Groups Projects
Commit ff21b628 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

New: Affiche les derniers clients sur espace commercial

parent e45fdcaa
Branches
No related tags found
No related merge requests found
...@@ -41,12 +41,13 @@ $user->getrights('fichinter'); ...@@ -41,12 +41,13 @@ $user->getrights('fichinter');
$user->getrights('commande'); $user->getrights('commande');
$user->getrights('projet'); $user->getrights('projet');
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$socidp = $user->societe_id; $socidp = $user->societe_id;
} }
$max=4;
llxHeader(); llxHeader();
...@@ -153,6 +154,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) ...@@ -153,6 +154,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
} }
} }
/* /*
* Commandes valider * Commandes valider
*/ */
...@@ -235,9 +237,52 @@ if ( $db->query($sql) ) ...@@ -235,9 +237,52 @@ if ( $db->query($sql) )
print '</td><td valign="top" width="70%">'; print '</td><td valign="top" width="70%">';
/*
* Derniers clients enregsitrs
*/
$sql = "SELECT s.idp,s.nom,".$db->pdate("datec")." as datec";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE s.client = 1";
if ($user->societe_id > 0)
{
$sql .= " AND s.idp = $user->societe_id";
}
$sql .= " ORDER BY s.datec DESC ";
$sql .= $db->plimit($max, 0);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
if ($num)
{
$langs->load("boxes");
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("BoxTitleLastCustomers",$max).'</td></tr>';
$i = 0;
$var=false;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
print "<tr $bc[$var]>";
print "<td nowrap><a href=\"fiche.php?id=".$objp->idp."\">".img_object($langs->trans("ShowCustomer"),"company")." ".$objp->nom."</a></td>";
print '<td align="right" nowrap>'.dolibarr_print_date($objp->datec)."</td>";
print '</tr>';
$i++;
$var=!$var;
}
print "</table><br>";
$db->free($resql);
}
}
/* /*
* Dernires actions commerciales effectues * Dernires actions commerciales effectues
*
*/ */
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, a.fk_user_author, s.nom as sname, s.idp"; $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, a.fk_user_author, s.nom as sname, s.idp";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment