Améliorations diverses sur la gestion des adhérents (corrections bug, mise aux normes du look, ajout d'infos sur écran)

This commit is contained in:
Laurent Destailleur 2004-07-14 19:46:34 +00:00
parent 6ca843dacb
commit faef74265d
3 changed files with 90 additions and 60 deletions

View File

@ -1,6 +1,7 @@
<?PHP <?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -24,26 +25,32 @@ require("./pre.inc.php");
llxHeader(); llxHeader();
//$db = new Db();
print_titre("Gestion des adherents"); print_titre("Gestion des adhérents");
print '<br>';
print '<p><TABLE border="0" cellspacing="0" cellpadding="4">'; print '<table class="noborder" cellspacing="0" cellpadding="3">';
print '<TR class="liste_titre">'; print '<tr class="liste_titre">';
print "<td>Type</td>"; print "<td>Type</td>";
print "<td>Nb</td>"; print "<td align=right width=\"80\">A valider</td>";
print "<td>Cotisant</td>"; print "<td align=right width=\"80\">Valides</td>";
print "</TR>\n"; print "<td align=right width=\"80\">Cotisants à jour</td>";
print "<td align=right width=\"80\">Résiliés</td>";
print "</tr>\n";
$var=True; $var=True;
$sql = "SELECT count(*) as somme , t.libelle FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $AdherentsAll=array();
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 GROUP BY t.libelle";
$Adherents=array(); $Adherents=array();
$AdherentsAValider=array();
$AdherentsResilies=array();
$Cotisants=array(); $Cotisants=array();
# Liste les adherents
$sql = "SELECT count(*) as somme , t.libelle, d.statut FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid GROUP BY t.libelle, d.statut";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -53,13 +60,17 @@ if ($result)
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object( $i); $objp = $db->fetch_object( $i);
$Adherents[$objp->libelle]=$objp->somme; $AdherentsAll[$objp->libelle]+=$objp->somme;
if ($objp->statut == -1) { $AdherentsAValider[$objp->libelle]=$objp->somme; }
if ($objp->statut == 1) { $Adherents[$objp->libelle]=$objp->somme; }
if ($objp->statut == 0) { $AdherentsResilies[$objp->libelle]=$objp->somme; }
$i++; $i++;
} }
$db->free(); $db->free();
} }
# Liste les cotisants a jour
$sql = "SELECT count(*) as somme , t.libelle FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql = "SELECT count(*) as somme , t.libelle FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND d.datefin >= now() GROUP BY t.libelle"; $sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND d.datefin >= now() GROUP BY t.libelle";
@ -79,35 +90,45 @@ if ($result)
} }
$SommeA=0; $SommeA=0;
$SommeB=0;
$SommeC=0; $SommeC=0;
$SommeD=0;
foreach ($Adherents as $key=>$value){ foreach ($AdherentsAll as $key=>$value){
$var=!$var; $var=!$var;
print "<TR $bc[$var]>"; print "<tr $bc[$var]>";
print '<TD><a href="liste.php">'.$key.'</a></TD>'; print '<td><a href="liste.php">'.$key.'</a></TD>';
print '<TD align="right">'.$value.'</TD>'; print '<td align="right">'.$AdherentsAValider[$key].'</TD>';
print '<TD align="right">'.$Cotisants[$key].'</TD>'; print '<td align="right">'.$Adherents[$key].'</TD>';
print "</TR>\n"; print '<td align="right">'.$Cotisants[$key].'</TD>';
$SommeA+=$value; print '<td align="right">'.$AdherentsResilies[$key].'</TD>';
print "</tr>\n";
$SommeA+=$AdherentsAValider[$key];
$SommeB+=$Adherents[$key];
$SommeC+=$Cotisants[$key]; $SommeC+=$Cotisants[$key];
$SommeD+=$AdherentsResilies[$key];
} }
$var=!$var; $var=!$var;
print "<TR $bc[$var]>"; print "<tr $bc[$var]>";
print '<TD> <B>Total</B> </TD>'; print '<td> <b>Total</b> </td>';
print '<TD align="right"><B>'.$SommeA.'</B></TD>'; print '<td align="right"><b>'.$SommeA.'</b></td>';
print '<TD align="right"><B>'.$SommeC.'</B></TD>'; print '<td align="right"><b>'.$SommeB.'</b></td>';
print "<TR>\n"; print '<td align="right"><b>'.$SommeC.'</b></td>';
print '<td align="right"><b>'.$SommeD.'</b></td>';
print "<tr>\n";
print "</table>"; print "</table>";
print '<br>';
print '<form action="liste.php" method="post" name="action" value="search">'; print '<form action="liste.php" method="post" name="action" value="search">';
print '<input type="hidden" name="action" value="search">'; print '<input type="hidden" name="action" value="search">';
print '<p><TABLE border="0" cellspacing="0" cellpadding="4">'; print '<table class="noborder" cellspacing="0" cellpadding="3">';
print '<TR class="liste_titre">'; print '<tr class="liste_titre">';
print "<td>Rechercher un adhérent</td>"; print "<td>Rechercher un adhérent</td>";
print "</TR>\n"; print "</tr>\n";
print "<TR $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'; print '<td>';
print 'Nom/Prénom <input type="text" name="search" class="flat" size="20">'; print 'Nom/Prénom <input type="text" name="search" class="flat" size="20">';

View File

@ -1,6 +1,7 @@
<?PHP <?PHP
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -22,29 +23,24 @@
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
llxHeader(); llxHeader();
//$db = new Db(); $sortorder=$_GET["sortorder"];
$sortfield=$_GET["sortfield"];
$page=$_GET["page"];
if ($sortorder == "") { $sortorder="ASC"; } if ($sortorder == "") { $sortorder="ASC"; }
if ($sortfield == "") { $sortfield="d.nom"; } if ($sortfield == "") { $sortfield="d.nom"; }
if ($page == -1) { $page = 0 ; } if ($page == -1) { $page = 0 ; }
/*
* SIZE_LISTE_LIMIT : constante de taille maximale des listes
*/
if (defined("SIZE_LISTE_LIMIT"))
{
$conf->liste_limit=SIZE_LISTE_LIMIT;
}
$offset = $conf->liste_limit * $page ; $offset = $conf->liste_limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! isset($statut)) if (! isset($_GET["statut"]))
{ {
$statut = 1 ; $statut = 1 ;
} }
@ -67,18 +63,20 @@ if ($result)
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $i = 0;
print_barre_liste("Liste des adhérents", $page, $PHP_SELF, "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield"); $titre="Liste des adhérents";
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">"; if (isset($_GET["statut"]) && $_GET["statut"] == -1) { $titre="Liste des adhérents à valider"; }
if (isset($_GET["statut"]) && $_GET["statut"] == 1) { $titre="Liste des adhérents valides"; }
if (isset($_GET["statut"]) && $_GET["statut"] == 0) { $titre="Liste des adhérents résiliés"; }
print '<TR class="liste_titre">'; print_barre_liste($titre, $page, $PHP_SELF, "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield");
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
print '<tr class="liste_titre">';
// print "<td><a href=\"".$_SERVER['SCRIPT_NAME'] . "?page=$page&statut=$statut&sortorder=ASC&sortfield=d.prenom\">Prenom</a> <a href=\"".$_SERVER['SCRIPT_NAME'] . "?page=$page&statut=$statut&sortorder=ASC&sortfield=d.nom\">Nom</a> / <a href=\"".$_SERVER['SCRIPT_NAME'] . "?page=$page&statut=$statut&sortorder=ASC&sortfield=d.societe\">Société</a></td>\n"; print '<td>';
print '<TD>';
// print_liste_field_titre("Prenom",$PHP_SELF,"d.prenom","&page=$page&statut=$statut"); // print_liste_field_titre("Prenom",$PHP_SELF,"d.prenom","&page=$page&statut=$statut");
print_liste_field_titre("Prenom Nom",$PHP_SELF,"d.nom","&page=$page&statut=$statut"); print_liste_field_titre("Prenom Nom / Société",$PHP_SELF,"d.nom","&page=$page&statut=$statut");
print " / Société"; print "</td>\n";
print "</TD>\n";
print "<td>"; print "<td>";
print_liste_field_titre("Date cotisation",$PHP_SELF,"t.cotisation","&page=$page&statut=$statut"); print_liste_field_titre("Date cotisation",$PHP_SELF,"t.cotisation","&page=$page&statut=$statut");
@ -101,7 +99,7 @@ if ($result)
print "</td>\n"; print "</td>\n";
print "<td>Action</td>\n"; print "<td>Action</td>\n";
print "</TR>\n"; print "</tr>\n";
$var=True; $var=True;
while ($i < $num) while ($i < $num)
@ -131,27 +129,37 @@ if ($result)
print "&nbsp;</td>"; print "&nbsp;</td>";
} }
print "<TD>$objp->email</TD>\n"; print "<td>$objp->email</td>\n";
print "<TD>$objp->type</TD>\n"; print "<td>$objp->type</td>\n";
print "<TD>$objp->morphy</TD>\n"; print "<td>$objp->morphy</td>\n";
print "<td>"; print "<td>";
if ($objp->statut == -1) if ($objp->statut == -1)
{ {
print '<a href="fiche.php?rowid='.$objp->rowid.'">A valider</a>'; print '<a href="fiche.php?rowid='.$objp->rowid.'">A valider</a>';
} }
if ($objp->statut == 0)
{
print 'Résilié';
}
if ($objp->statut == 1)
{
print 'Validé';
}
print "</td>"; print "</td>";
print "<TD><a href=\"edit.php?rowid=$objp->rowid\">Editer</a><br><a href=\"fiche.php?rowid=$objp->rowid&action=resign\">Resilier</a><br><a href=\"fiche.php?rowid=$objp->rowid&action=delete\">Supprimer</a></TD>\n"; print "<td><a href=\"edit.php?rowid=$objp->rowid\">".img_edit()."</a> &nbsp; <a href=\"fiche.php?rowid=$objp->rowid&action=resign\">Resilier</a> &nbsp; <a href=\"fiche.php?rowid=$objp->rowid&action=delete\">".img_delete()."</a></td>\n";
print "</tr>"; print "</tr>";
$i++; $i++;
} }
print "</table><BR>\n"; print "</table><br>\n";
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">"; print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
print '<TR>'; print '<tr>';
print '<TD align="right">'; print '<td align="right">';
print_fleche_navigation($page,$PHP_SELF,"&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",1); print_fleche_navigation($page,$PHP_SELF,"&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",1);
print '</TD>'; print '</td>';
print "</table><BR>\n"; print "</table><br>\n";
} }
else else

View File

@ -1,5 +1,6 @@
<?PHP <?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -34,10 +35,10 @@ function llxHeader($head = "") {
$menu = new Menu(); $menu = new Menu();
$menu->add("index.php","Adherents"); $menu->add("index.php","Adherents");
$menu->add_submenu("liste.php?statut=1","Adhérents à ce jour");
$menu->add_submenu("liste.php?statut=-1","Adhésions à valider"); $menu->add_submenu("liste.php?statut=-1","Adhésions à valider");
$menu->add_submenu("liste.php?statut=1","Adhérents à ce jour");
$menu->add_submenu("liste.php?statut=0","Adhésions résiliées"); $menu->add_submenu("liste.php?statut=0","Adhésions résiliées");
if ($user->admin) if ($user->admin)
{ {
$menu->add("fiche.php?action=create","Nouvel adhérent"); $menu->add("fiche.php?action=create","Nouvel adhérent");