*** empty log message ***
This commit is contained in:
parent
655cd1d7bc
commit
baf80a0f75
@ -1,8 +1,5 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -18,30 +15,32 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php3");
|
||||
|
||||
|
||||
require("../../tva.class.php3");
|
||||
require("../../chargesociales.class.php3");
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
?>
|
||||
<style type="text/css">
|
||||
td.border { border: 1px solid #000000}
|
||||
</style>
|
||||
|
||||
|
||||
<?PHP
|
||||
$db = new Db();
|
||||
|
||||
|
||||
print_titre("Résultat $year");
|
||||
|
||||
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<TR class="liste_titre">';
|
||||
print "<TD>Numéro</TD>";
|
||||
print "<TD align=\"center\" colspan=\"2\">Montant</TD><td align=\"right\">Solde</td>";
|
||||
print '<td width="10%"> </td><TD>Elément</TD>';
|
||||
print "<TD align=\"center\">Montant</TD><td align=\"right\">Solde</td>";
|
||||
print "</TR>\n";
|
||||
|
||||
$sql = "SELECT s.nom,sum(f.amount) as amount";
|
||||
@ -53,6 +52,8 @@ if ($year > 0) {
|
||||
|
||||
$sql .= " GROUP BY s.nom ASC";
|
||||
|
||||
print '<tr><td colspan="4">Factures</td></tr>';
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
@ -65,10 +66,10 @@ if ($result) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TR $bc[$var]><td> </td>";
|
||||
print "<td>Facture <a href=\"/compta/facture.php3?facid=$objp->facid\">$objp->facnumber</a> $objp->nom</TD>\n";
|
||||
|
||||
print "<TD align=\"right\">".price($objp->amount)."</TD><td> </td>\n";
|
||||
print "<TD align=\"right\">".price($objp->amount)."</TD>\n";
|
||||
|
||||
$total = $total + $objp->amount;
|
||||
print "<TD align=\"right\">".price($total)."</TD>\n";
|
||||
@ -81,15 +82,17 @@ if ($result) {
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
print '<tr><td colspan="3" align="right">'.price($total).'</td></tr>';
|
||||
/*
|
||||
* Charges sociales
|
||||
*
|
||||
*/
|
||||
|
||||
$subtotal = 0;
|
||||
print '<tr><td colspan="4">Prestations déductibles</td></tr>';
|
||||
|
||||
$sql = "SELECT c.libelle as nom, sum(s.amount) as amount";
|
||||
$sql .= " FROM c_chargesociales as c, llx_chargesociales as s";
|
||||
$sql .= " WHERE s.fk_type = c.id";
|
||||
$sql .= " WHERE s.fk_type = c.id AND c.deductible=1";
|
||||
if ($year > 0) {
|
||||
$sql .= " AND date_format(s.periode, '%Y') = $year";
|
||||
}
|
||||
@ -101,20 +104,63 @@ if ( $db->query($sql) ) {
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>'.$obj->nom.'</td>';
|
||||
print '<td> </td><td align="right">'.price($obj->amount).'</td>';
|
||||
$total = $total - $obj->amount;
|
||||
print "<TD align=\"right\">".price($total)."</TD>\n";
|
||||
|
||||
$total = $total - $obj->amount;
|
||||
$subtotal = $subtotal + $obj->amount;
|
||||
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]><td> </td>";
|
||||
print '<td>'.$obj->nom.'</td>';
|
||||
print '<td align="right">'.price($obj->amount).'</td>';
|
||||
print "<TD align=\"right\">".price($total)."</TD>\n";
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
print '<tr><td colspan="3" align="right">'.price($subtotal).'</td></tr>';
|
||||
|
||||
print '<tr><td align="right" colspan="2">Résultat</td><td class="border" align="right">'.price($total).'</td></tr>';
|
||||
/*
|
||||
* Charges sociales non déductibles
|
||||
*
|
||||
*/
|
||||
$subtotal = 0;
|
||||
print '<tr><td colspan="4">Prestations NON déductibles</td></tr>';
|
||||
|
||||
$sql = "SELECT c.libelle as nom, sum(s.amount) as amount";
|
||||
$sql .= " FROM c_chargesociales as c, llx_chargesociales as s";
|
||||
$sql .= " WHERE s.fk_type = c.id AND c.deductible=0";
|
||||
if ($year > 0) {
|
||||
$sql .= " AND date_format(s.periode, '%Y') = $year";
|
||||
}
|
||||
$sql .= " GROUP BY c.libelle DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$total = $total - $obj->amount;
|
||||
$subtotal = $subtotal + $obj->amount;
|
||||
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]><td> </td>";
|
||||
print '<td>'.$obj->nom.'</td>';
|
||||
print '<td align="right">'.price($obj->amount).'</td>';
|
||||
print "<TD align=\"right\">".price($total)."</TD>\n";
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
print '<tr><td colspan="3" align="right">'.price($subtotal).'</td></tr>';
|
||||
|
||||
print '<tr><td align="right" colspan="2">Résultat</td><td class="border" align="right">'.price($total).'</td></tr>';
|
||||
|
||||
|
||||
print "</TABLE>";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user