Mise en conformit
This commit is contained in:
parent
ae7517fe44
commit
976b1611b0
@ -35,7 +35,7 @@ llxHeader();
|
||||
|
||||
$db = new Db();
|
||||
|
||||
print_barre_liste("Chiffre d'affaire par société", $page, $PHP_SELF);
|
||||
print_titre("Chiffre d'affaire par société");
|
||||
|
||||
/*
|
||||
* Ca total
|
||||
@ -45,49 +45,57 @@ print_barre_liste("Chiffre d'affaire par soci
|
||||
$sql = "SELECT sum(f.amount) as ca FROM llx_facture as f";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
if ($db->num_rows() > 0) {
|
||||
$objp = $db->fetch_object(0);
|
||||
$catotal = $objp->ca;
|
||||
}
|
||||
if ($result)
|
||||
{
|
||||
if ($db->num_rows() > 0)
|
||||
{
|
||||
$objp = $db->fetch_object(0);
|
||||
$catotal = $objp->ca;
|
||||
}
|
||||
}
|
||||
|
||||
print "<b>Total : ".price($catotal)."</b>";
|
||||
|
||||
if ($catotal == 0) { $catotal = 1; };
|
||||
|
||||
|
||||
$sql = "SELECT s.nom, s.idp, sum(f.amount) as ca";
|
||||
$sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp GROUP BY s.nom, s.idp ORDER BY ca DESC";
|
||||
$sql .= " FROM llx_societe as s,llx_facture as f";
|
||||
$sql .= " WHERE f.fk_soc = s.idp GROUP BY s.nom, s.idp ORDER BY ca DESC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
if ($num > 0) {
|
||||
$i = 0;
|
||||
print "<p><TABLE border=\"0\" width=\"50%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<TR class=\"liste_titre\">";
|
||||
print "<TD>Société</td>";
|
||||
print "<TD align=\"right\">Montant</TD><td> </td>";
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
|
||||
print "<TD><a href=\"fiche.php3?socid=$objp->idp\">$objp->nom</a></TD>\n";
|
||||
print "<TD align=\"right\">".price($objp->ca)."</TD>";
|
||||
print '<td align="right">'.price(100 / $catotal * $objp->ca).'%</td>';
|
||||
|
||||
$total = $total + $objp->ca;
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
print "<p><TABLE border=\"0\" width=\"50%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<TR class=\"liste_titre\">";
|
||||
print "<TD>Société</td>";
|
||||
print '<TD align="right">Montant</TD><td align="right">Pourcentage</td>';
|
||||
print "<td> </td></tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
|
||||
print "<TD><a href=\"fiche.php3?socid=$objp->idp\">$objp->nom</a></TD>\n";
|
||||
print '<TD align="right">'.price($objp->ca).'</td>';
|
||||
print '<td align="right">'.price(100 / $catotal * $objp->ca).'%</td>';
|
||||
print "<td align=\"center\"><a href=\"facture.php3?socidp=$objp->idp\">Voir les factures</a></TD>\n";
|
||||
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
}
|
||||
print "<tr><td colspan=\"2\" align=\"right\"><b>Total : ".price($total)."</b></td><td>euros HT</td></tr>";
|
||||
print "<tr><td colspan=\"2\" align=\"right\">Moyenne : ".price($total/$i)."</td><td>euros HT</td></tr>";
|
||||
print "</TABLE>";
|
||||
}
|
||||
$db->free();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user