* Copyright (C) 2004-2006 Laurent Destailleur * * 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 * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * 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$ * */ /** \file htdocs/compta/dons/index.php \ingroup don \brief Page accueil espace don \version $Revision$ */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT ."/don.class.php"); $langs->load("donations"); /* * Affichage */ llxHeader(); $donstatic=new Don($db); $sql = "SELECT count(d.rowid) as nb, sum(d.amount) as somme , d.fk_statut"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " GROUP BY d.fk_statut"; $sql.= " ORDER BY d.fk_statut"; $result = $db->query($sql); if ($result) { $num = $db->num_rows(); $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); $somme[$objp->fk_statut] = $objp->somme; $nb[$objp->fk_statut] = $objp->nb; $i++; } $db->free($result); } else { dolibarr_print_error($db); } print_fiche_titre($langs->trans("DonationsArea")); print ''; print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; $var=True; for ($i = 0 ; $i < 3 ; $i++) { $var=!$var; print ""; print ''; print ''; print ''; print ''; $totalnb += $nb[$i]; $total += $somme[$i]; print ""; } print ''; print ''; print ''; print ''; print ''; print ''; print "
'.$langs->trans("Status").''.$langs->trans("Number").''.$langs->trans("AmountTotal").''.$langs->trans("Average").'
'.$donstatic->LibStatut($i,4).''.$nb[$i].''.($nb[$i]?price($somme[$i]):' ').''.($nb[$i]?(price($somme[$i])/$nb[$i]):' ').'
'.$langs->trans("Total").''.$totalnb.''.price($total).''.($totalnb?(price($total)/$totalnb):' ').'
"; print '
'; $db->close(); llxFooter('$Date$ - $Revision$'); ?>