modifs dans l'affichage des propositions commerciales ouvertes :
* changement du titre (on n'affiche que les validées) * total en fin de tableau
This commit is contained in:
parent
325565b696
commit
ff54a5fc50
@ -107,26 +107,31 @@ if ($conf->propal->enabled) {
|
|||||||
print $langs->trans("Ref").' : <input type="text" name="sf_ref"> <input type="submit" value="'.$langs->trans("Search").'" class="flat"></td></tr>';
|
print $langs->trans("Ref").' : <input type="text" name="sf_ref"> <input type="submit" value="'.$langs->trans("Search").'" class="flat"></td></tr>';
|
||||||
print "</table></form><br>\n";
|
print "</table></form><br>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.rowid, p.ref";
|
$sql = "SELECT p.rowid, p.ref, p.price, s.nom";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= " WHERE p.fk_statut = 0";
|
$sql .= " WHERE p.fk_statut = 0 and p.fk_soc = s.idp";
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
if ( $db->query($sql) )
|
||||||
{
|
{
|
||||||
|
$total = 0;
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num > 0 )
|
if ($num > 0 )
|
||||||
{
|
{
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print "<td colspan=\"2\">Propositions commerciales brouillons</td></tr>";
|
print "<td colspan=\"3\">Propositions commerciales brouillons</td></tr>";
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object();
|
$obj = $db->fetch_object();
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]><td><a href=\"propal.php?propalid=".$obj->rowid."\">".$obj->ref."</a></td></tr>";
|
print "<tr $bc[$var]><td><a href=\"propal.php?propalid=".$obj->rowid."\">".$obj->ref."</a></td><td>".$obj->nom."</td><td align=\"right\">".price($obj->price)."</td></tr>";
|
||||||
$i++;
|
$i++;
|
||||||
|
$total += $obj->price;
|
||||||
|
}
|
||||||
|
if ($total>0) {
|
||||||
|
print "<tr $bc[$var]><td colspan=\"2\" align=\"right\"><i>Total</i></td><td align=\"right\"><i>".price($total)."</i></td></tr>";
|
||||||
}
|
}
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
}
|
}
|
||||||
@ -377,16 +382,17 @@ if ($conf->propal->enabled) {
|
|||||||
$sql .= " AND s.idp = $socidp";
|
$sql .= " AND s.idp = $socidp";
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY p.rowid DESC";
|
$sql .= " ORDER BY p.rowid DESC";
|
||||||
$sql .= $db->plimit(5, 0);
|
// $sql .= $db->plimit(5, 0);
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
if ( $db->query($sql) )
|
||||||
{
|
{
|
||||||
|
$total = 0;
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="4">Les 5 dernières propositions commerciales ouvertes</td></tr>';
|
print '<tr class="liste_titre"><td colspan="4">Propositions commerciales ouvertes et validées</td></tr>';
|
||||||
$var=false;
|
$var=false;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
@ -399,6 +405,10 @@ if ($conf->propal->enabled) {
|
|||||||
print "<td align=\"right\">".price($obj->price)."</td></tr>\n";
|
print "<td align=\"right\">".price($obj->price)."</td></tr>\n";
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$i++;
|
$i++;
|
||||||
|
$total += $obj->price;
|
||||||
|
}
|
||||||
|
if ($total>0) {
|
||||||
|
print "<tr $bc[$var]><td colspan=\"3\" align=\"right\"><i>Total</i></td><td align=\"right\"><i>".price($total)."</i></td></tr>";
|
||||||
}
|
}
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user