diff --git a/htdocs/compta/resultat/index.php3 b/htdocs/compta/resultat/index.php3 index 1173af740a2..1731abdcf56 100644 --- a/htdocs/compta/resultat/index.php3 +++ b/htdocs/compta/resultat/index.php3 @@ -1,8 +1,5 @@ - * - * $Id$ - * $Source$ +/* Copyright (C) 2002 Rodolphe Quiedeville * * 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(); +?> + +"; print ''; -print "Numéro"; -print "MontantSolde"; +print ' Elément'; +print "MontantSolde"; print "\n"; $sql = "SELECT s.nom,sum(f.amount) as amount"; @@ -53,6 +52,8 @@ if ($year > 0) { $sql .= " GROUP BY s.nom ASC"; +print 'Factures'; + $result = $db->query($sql); if ($result) { $num = $db->num_rows(); @@ -65,10 +66,10 @@ if ($result) { $objp = $db->fetch_object( $i); $var=!$var; - print ""; + print " "; print "Facture facid\">$objp->facnumber $objp->nom\n"; - print "".price($objp->amount)." \n"; + print "".price($objp->amount)."\n"; $total = $total + $objp->amount; print "".price($total)."\n"; @@ -81,15 +82,17 @@ if ($result) { } else { print $db->error(); } +print ''.price($total).''; /* * Charges sociales * */ - +$subtotal = 0; +print 'Prestations déductibles'; $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 ""; - print ''.$obj->nom.''; - print ' '.price($obj->amount).''; - $total = $total - $obj->amount; - print "".price($total)."\n"; + $total = $total - $obj->amount; + $subtotal = $subtotal + $obj->amount; + + $var = !$var; + print " "; + print ''.$obj->nom.''; + print ''.price($obj->amount).''; + print "".price($total)."\n"; print ''; $i++; } } else { print $db->error(); } +print ''.price($subtotal).''; +print 'Résultat'.price($total).''; +/* + * Charges sociales non déductibles + * + */ +$subtotal = 0; +print 'Prestations NON déductibles'; + +$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 " "; + print ''.$obj->nom.''; + print ''.price($obj->amount).''; + print "".price($total)."\n"; + print ''; + $i++; + } +} else { + print $db->error(); +} +print ''.price($subtotal).''; + +print 'Résultat'.price($total).''; print "";