diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 9b8a2b01a9d..29a63394e58 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -107,26 +107,31 @@ if ($conf->propal->enabled) { print $langs->trans("Ref").' :  '; print "
\n"; - $sql = "SELECT p.rowid, p.ref"; - $sql .= " FROM ".MAIN_DB_PREFIX."propal as p"; - $sql .= " WHERE p.fk_statut = 0"; + $sql = "SELECT p.rowid, p.ref, p.price, s.nom"; + $sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s"; + $sql .= " WHERE p.fk_statut = 0 and p.fk_soc = s.idp"; if ( $db->query($sql) ) { + $total = 0; $num = $db->num_rows(); $i = 0; if ($num > 0 ) { print ''; print ""; - print ""; + print ""; while ($i < $num) { $obj = $db->fetch_object(); $var=!$var; - print ""; + print ""; $i++; + $total += $obj->price; + } + if ($total>0) { + print ""; } print "
Propositions commerciales brouillons
Propositions commerciales brouillons
rowid."\">".$obj->ref."
rowid."\">".$obj->ref."".$obj->nom."".price($obj->price)."
Total".price($total)."

"; } @@ -377,16 +382,17 @@ if ($conf->propal->enabled) { $sql .= " AND s.idp = $socidp"; } $sql .= " ORDER BY p.rowid DESC"; - $sql .= $db->plimit(5, 0); +// $sql .= $db->plimit(5, 0); if ( $db->query($sql) ) { + $total = 0; $num = $db->num_rows(); $i = 0; if ($num > 0) { print ''; - print ''; + print ''; $var=false; while ($i < $num) { @@ -399,7 +405,11 @@ if ($conf->propal->enabled) { print "\n"; $var=!$var; $i++; + $total += $obj->price; } + if ($total>0) { + print ""; + } print "
Les 5 dernières propositions commerciales ouvertes
Propositions commerciales ouvertes et validées
".price($obj->price)."
Total".price($total)."

"; } }