[ 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/ -> index.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2002 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: index.php,v 1.16 2005/08/11 20:28:11 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/dons/index.php,v $
  21   *
  22   */
  23  
  24  /**
  25          \file       htdocs/compta/dons/index.php
  26          \ingroup    don
  27          \brief      Page accueil espace don
  28          \version    $Revision: 1.16 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  
  33  $langs->load("donations");
  34  
  35  
  36  llxHeader();
  37  
  38  $sql = "SELECT count(d.rowid) as nb, sum(d.amount) as somme , d.fk_statut";
  39  $sql.= " FROM ".MAIN_DB_PREFIX."don as d";
  40  $sql.= " GROUP BY d.fk_statut";
  41  $sql.= " ORDER BY d.fk_statut";
  42  
  43  $result = $db->query($sql);
  44  
  45  if ($result) 
  46  {
  47    $num = $db->num_rows();
  48    $i = 0;
  49    while ($i < $num)
  50      {
  51        $objp = $db->fetch_object($result);
  52  
  53        $somme[$objp->fk_statut] = $objp->somme;
  54        $nb[$objp->fk_statut] = $objp->nb;
  55        $i++;
  56      }
  57    $db->free($result);
  58  } else {
  59      dolibarr_print_error($db);   
  60  }
  61  
  62  print_fiche_titre($langs->trans("DonationsArea"));
  63  
  64  
  65  print '<table width="100%" class="notopnoleftnoright">';
  66  
  67  print '<tr><td class="notopnoleft">';
  68  
  69  
  70  print '<table class="noborder" width="50%">';
  71  print '<tr class="liste_titre">';
  72  print '<td>'.$langs->trans("Status").'</td>';
  73  print '<td align="right">'.$langs->trans("Number").'</td>';
  74  print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
  75  print '<td align="right">'.$langs->trans("Average").'</td>';
  76  print "</tr>\n";
  77  
  78  $var=True;
  79  
  80  for ($i = 0 ; $i < 3 ; $i++)
  81  {
  82    $var=!$var;
  83    print "<tr $bc[$var]>";
  84    print '<td><a href="liste.php?statut='.$i.'">'.$libelle[$i].'</a></td>';
  85    print '<td align="right">'.$nb[$i].'</td>';
  86    print '<td align="right">'.($nb[$i]?price($somme[$i]):'&nbsp;').'</td>';
  87    print '<td align="right">'.($nb[$i]?(price($somme[$i])/$nb[$i]):'&nbsp;').'</td>';
  88    $totalnb += $nb[$i];
  89    $total += $somme[$i];
  90    print "</tr>";
  91  }
  92  
  93  print '<tr class="liste_total">';
  94  print '<td>'.$langs->trans("Total").'</td>';
  95  print '<td align="right">'.$totalnb.'</td>';
  96  print '<td align="right">'.price($total).'</td>';
  97  print '<td align="right">'.($totalnb?(price($total)/$totalnb):'&nbsp;').'</td>';
  98  print '</tr>';
  99  print "</table>";
 100  
 101  
 102  print '</td></tr></table>';
 103  
 104  $db->close();
 105  
 106  llxFooter('$Date: 2005/08/11 20:28:11 $ - $Revision: 1.16 $');
 107  ?>


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