New: Le résumé des charges affiche le nb d'appel de charges, le montant payé en plus du total.
New: Le lien sur un type de charge sociale et clicable et amène sur la page des charges sociales avec filtre sur ce type.
This commit is contained in:
parent
e0d8cf18b4
commit
af6db0b09b
@ -25,37 +25,35 @@ require("./pre.inc.php");
|
|||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$user->getrights('compta');
|
$user->getrights('compta');
|
||||||
|
|
||||||
if (!$user->admin && !$user->rights->compta->charges)
|
if (!$user->admin && !$user->rights->compta->charges)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
function valeur($sql)
|
|
||||||
{
|
$year=$_GET["year"];
|
||||||
global $db;
|
$filtre=$_GET["filtre"];
|
||||||
if ( $db->query($sql) )
|
|
||||||
{
|
|
||||||
if ( $db->num_rows() )
|
print_titre("Charges - Résumé".($year > 0?" $year":""));
|
||||||
{
|
|
||||||
$valeur = $db->result(0,0);
|
print "<br>";
|
||||||
}
|
print '<table class="noborder" cellspacing="0" cellpadding="4" width="100%">';
|
||||||
$db->free();
|
print "<tr class=\"liste_titre\">";
|
||||||
}
|
print "<td>Groupe</td>";
|
||||||
return $valeur;
|
print "<td align=\"right\">Nb</td>";
|
||||||
}
|
print "<td align=\"right\">Montant TTC</td>";
|
||||||
|
print "<td align=\"right\">Montant Payé</td>";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* Charges sociales
|
||||||
*/
|
*/
|
||||||
|
$sql = "SELECT c.libelle as lib, s.fk_type as type, count(s.rowid) as nb, sum(s.amount) as total, sum(IF(paye=1,s.amount,0)) as totalpaye";
|
||||||
print_titre("Charges");
|
|
||||||
|
|
||||||
print '<TABLE border="0" cellspacing="0" cellpadding="4" width="100%">';
|
|
||||||
print "<TR class=\"liste_titre\">";
|
|
||||||
print "<td colspan=\"2\">Factures</td>";
|
|
||||||
print "</TR>\n";
|
|
||||||
|
|
||||||
$sql = "SELECT c.libelle as nom, sum(s.amount) as total";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."chargesociales as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."chargesociales as s";
|
||||||
$sql .= " WHERE s.fk_type = c.id AND s.paye = 1";
|
$sql .= " WHERE s.fk_type = c.id";
|
||||||
|
if ($year > 0)
|
||||||
|
{
|
||||||
|
$sql .= " AND date_format(s.date_ech, '%Y') = $year";
|
||||||
|
}
|
||||||
$sql .= " GROUP BY lower(c.libelle) ASC";
|
$sql .= " GROUP BY lower(c.libelle) ASC";
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
if ( $db->query($sql) )
|
||||||
@ -67,18 +65,26 @@ if ( $db->query($sql) )
|
|||||||
$obj = $db->fetch_object( $i);
|
$obj = $db->fetch_object( $i);
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td>'.$obj->nom.'</td><td align="right">'.price($obj->total).'</td>';
|
print '<td><a href="../sociales/index.php?filtre=s.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
|
||||||
|
print '<td align="right">'.$obj->nb.'</td>';
|
||||||
|
print '<td align="right">'.price($obj->total).'</td>';
|
||||||
|
print '<td align="right">'.price($obj->totalpaye).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print "<tr><td>".$db->error()."</td></tr>";
|
print "<tr><td>".$db->error()."</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Factures fournisseurs
|
* Factures fournisseurs
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT sum(f.amount) as total";
|
$sql = "SELECT count(f.rowid) as nb, sum(total_ttc) as total, sum(IF(paye=1,total_ttc,0)) as totalpaye";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
|
if ($year > 0)
|
||||||
|
{
|
||||||
|
$sql .= " WHERE date_format(f.datef, '%Y') = $year";
|
||||||
|
}
|
||||||
|
|
||||||
if ( $db->query($sql) ) {
|
if ( $db->query($sql) ) {
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
@ -88,7 +94,10 @@ if ( $db->query($sql) ) {
|
|||||||
$obj = $db->fetch_object( $i);
|
$obj = $db->fetch_object( $i);
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td>Factures founisseurs</td><td align="right">'.price($obj->total).'</td>';
|
print '<td>Factures founisseurs</td>';
|
||||||
|
print '<td align="right">'.$obj->nb.'</td>';
|
||||||
|
print '<td align="right">'.price($obj->total).'</td>';
|
||||||
|
print '<td align="right">'.price($obj->totalpaye).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user