diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 2c8716873d3..d9fd2154bed 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -199,6 +199,64 @@ else print $db->error(); } +/* + * Dernières propales + * + */ + +$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; +$sql .= " FROM llx_societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND p.fk_statut > 0"; + +if ($socidp) +{ + $sql .= " AND s.idp = $socidp"; +} + +$sql .= " ORDER BY p.rowid DESC"; +$sql .= $db->plimit(5, 0); + +if ( $db->query($sql) ) + { + $num = $db->num_rows(); + + $i = 0; + print '
| Dernières propositions commerciales | ||||||
| propalid\">$objp->ref | \n"; + print "idp\">$objp->nom | \n"; + + $now = time(); + $lim = 3600 * 24 * 15 ; + + if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) + { + print "> 15 jours | "; + } + else + { + print ""; + } + + print " | "; + print strftime("%d %B %Y",$objp->dp)." | \n"; + print "".price($objp->price)." | \n"; + print "$objp->statut | \n"; + print "