[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/compta/dons/ -> stats.php (source)

   1  <?php
   2  /* Copyright (C) 2003      Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: stats.php,v 1.11 2005/06/11 11:57:29 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/dons/stats.php,v $
  21   *
  22   */
  23  
  24  /**
  25          \file       htdocs/compta/dons/stats.php
  26          \ingroup    don
  27          \brief      Page des statistiques de dons
  28          \version    $Revision: 1.11 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  
  33  $langs->load("donations");
  34  
  35  llxHeader();
  36  
  37  
  38  print_titre($langs->trans("Statistics"));
  39  print '<br>';
  40  
  41  
  42  $sql = "SELECT d.amount";
  43  $sql .= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."don_projet as p";
  44  $sql .= " ON p.rowid = d.fk_don_projet";
  45  
  46  $result = $db->query($sql);
  47  if ($result) 
  48  {
  49      $num = $db->num_rows($result);
  50      
  51      $var=true;
  52      $i=0;
  53      $total=0;
  54      while ($i < $num)
  55      {
  56          $objp = $db->fetch_object($result);
  57          $total += $objp->amount;
  58          $i++;
  59      }
  60      
  61      print '<table class="noborder" width="50%">';
  62      
  63      print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td align="right">'.$langs->trans("Value").'</td></tr>';
  64      
  65      $var=!$var;
  66      print "<tr $bc[$var]>";
  67      print '<td>'.$langs->trans("DonationsNumber").'</td><td align="right">'.$num.'</td></tr>';
  68      $var=!$var;
  69      print "<tr $bc[$var]>".'<td>'.$langs->trans("AmountTotal").'</td><td align="right">'.price($total).'</td>';
  70      $var=!$var;
  71      print "<tr $bc[$var]>".'<td>'.$langs->trans("Average").'</td><td align="right">'.price($total / ($num?$num:1)).'</td>';
  72      print "</tr>";
  73      
  74      print "</table>";
  75  }
  76  else
  77  {
  78      dolibarr_print_error($db);
  79  }
  80  
  81  
  82  $db->close();
  83  
  84  llxFooter('$Date: 2005/06/11 11:57:29 $ - $Revision: 1.11 $');
  85  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics