Ajout ligne total
This commit is contained in:
parent
165227635b
commit
b0f8a31e9b
@ -116,37 +116,46 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($conf->propal->enabled)
|
/*
|
||||||
|
* Liste des propal brouillons
|
||||||
|
*/
|
||||||
|
if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||||
{
|
{
|
||||||
$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";
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$var=true;
|
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$resql=$db->query($sql);
|
||||||
$i = 0;
|
if ($resql)
|
||||||
if ($num > 0 )
|
{
|
||||||
{
|
$var=true;
|
||||||
print '<table class="noborder"" width="100%">';
|
|
||||||
print "<tr class=\"liste_titre\">";
|
$total=0;
|
||||||
print "<td colspan=\"2\">".$langs->trans("ProposalsDraft")."</td></tr>";
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
while ($i < $num)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
print '<table class="noborder"" width="100%">';
|
||||||
$var=!$var;
|
print "<tr class=\"liste_titre\">";
|
||||||
print "<tr $bc[$var]><td>";
|
print "<td colspan=\"2\">".$langs->trans("ProposalsDraft")."</td></tr>";
|
||||||
print "<a href=\"propal.php?propalid=".$obj->rowid."\">".img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref."</a>";
|
|
||||||
print "</td></tr>";
|
while ($i < $num)
|
||||||
$i++;
|
{
|
||||||
}
|
$obj = $db->fetch_object($resql);
|
||||||
print "</table><br>";
|
$var=!$var;
|
||||||
}
|
print "<tr $bc[$var]><td>";
|
||||||
$db->free($resql);
|
print "<a href=\"propal.php?propalid=".$obj->rowid."\">".img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref."</a>";
|
||||||
|
print "</td></tr>";
|
||||||
|
$i++;
|
||||||
|
$total += $obj->price;
|
||||||
|
}
|
||||||
|
if ($total>0) {
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td></tr>";
|
||||||
|
}
|
||||||
|
print "</table><br>";
|
||||||
|
}
|
||||||
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,42 +207,51 @@ else
|
|||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
$sql = "SELECT s.nom, s.idp, p.rowid, p.price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
|
* Dernières propales ouvertes
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND p.fk_statut = 1";
|
*
|
||||||
if ($socidp)
|
*/
|
||||||
{
|
if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||||
$sql .= " AND s.idp = $socidp";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= " ORDER BY p.rowid DESC";
|
|
||||||
$sql .= $db->plimit(5, 0);
|
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$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";
|
||||||
$i = 0;
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
|
||||||
if ($num > 0 )
|
$sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND p.fk_statut = 1";
|
||||||
|
if ($socidp) $sql .= " AND s.idp = $socidp";
|
||||||
|
$sql .= " ORDER BY p.rowid DESC";
|
||||||
|
$sql .= $db->plimit(5, 0);
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
{
|
{
|
||||||
$var=true;
|
$total = 0;
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
print '<table class="noborder" width="100%">';
|
$i = 0;
|
||||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProposalsOpened").'</td></tr>';
|
if ($num > 0)
|
||||||
|
{
|
||||||
while ($i < $num)
|
$var=true;
|
||||||
{
|
|
||||||
$obj = $db->fetch_object();
|
print '<table class="noborder" width="100%">';
|
||||||
$var=!$var;
|
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ProposalsOpened").'</td></tr>';
|
||||||
print "<tr $bc[$var]><td width=\"20%\"><a href=\"../propal.php?propalid=".$obj->rowid."\">";
|
|
||||||
print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a></td>';
|
while ($i < $num)
|
||||||
|
{
|
||||||
print "<td width=\"30%\"><a href=\"fiche.php?id=$obj->idp\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom."</a></td>\n";
|
$obj = $db->fetch_object($resql);
|
||||||
print "<td align=\"right\">";
|
$var=!$var;
|
||||||
print dolibarr_print_date($obj->dp)."</td>\n";
|
print "<tr $bc[$var]><td width=\"20%\"><a href=\"../propal.php?propalid=".$obj->rowid."\">";
|
||||||
print "<td align=\"right\">".price($obj->price)."</td></tr>\n";
|
print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a></td>';
|
||||||
$i++;
|
|
||||||
}
|
print "<td width=\"30%\"><a href=\"fiche.php?id=$obj->idp\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom."</a></td>\n";
|
||||||
print "</table><br>";
|
print "<td align=\"right\">";
|
||||||
|
print dolibarr_print_date($obj->dp)."</td>\n";
|
||||||
|
print "<td align=\"right\">".price($obj->price)."</td></tr>\n";
|
||||||
|
$i++;
|
||||||
|
$total += $obj->price;
|
||||||
|
}
|
||||||
|
if ($total>0) {
|
||||||
|
print '<tr class="liste_total"><td colspan="3" align="right">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td></tr>";
|
||||||
|
}
|
||||||
|
print "</table><br>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user