[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> 4 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 20 * $Id: index.php,v 1.31 2005/10/30 14:16:27 eldy Exp $ 21 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/adherents/index.php,v $ 22 */ 23 24 /** 25 \file htdocs/adherents/index.php 26 \ingroup adherent 27 \brief Page accueil module adherents 28 */ 29 30 31 require ("./pre.inc.php"); 32 33 $langs->load("companies"); 34 $langs->load("members"); 35 36 37 llxHeader(); 38 39 40 print_fiche_titre($langs->trans("MembersArea")); 41 42 print '<table border="0" width="100%" class="notopnoleftnoright">'; 43 44 print '<tr><td valign="top" width="100%" colspan="2" class="notopnoleft">'; 45 46 47 48 print '<table class="noborder" width="100%">'; 49 print '<tr class="liste_titre">'; 50 print '<td>'.$langs->trans("Type").'</td>'; 51 print '<td align=right width="80">'.$langs->trans("MembersStatusToValid").'</td>'; 52 print '<td align=right width="80">'.$langs->trans("MembersStatusValidated").'</td>'; 53 print '<td align=right width="80">'.$langs->trans("MembersStatusPayed").'</td>'; 54 print '<td align=right width="80">'.$langs->trans("MembersStatusResiliated").'</td>'; 55 print "</tr>\n"; 56 57 $var=True; 58 59 60 $AdherentsAll=array(); 61 $Adherents=array(); 62 $AdherentsAValider=array(); 63 $AdherentsResilies=array(); 64 $Cotisants=array(); 65 66 # Liste les adherents 67 $sql = "SELECT count(*) as somme , t.rowid, t.libelle, d.statut"; 68 $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; 69 $sql .= " WHERE d.fk_adherent_type = t.rowid"; 70 $sql .= " GROUP BY t.libelle, d.statut"; 71 72 $result = $db->query($sql); 73 if ($result) 74 { 75 $num = $db->num_rows($result); 76 $i = 0; 77 while ($i < $num) 78 { 79 $objp = $db->fetch_object($result); 80 $AdherentsAll[$objp->libelle]=$objp->rowid; 81 if ($objp->statut == -1) { $AdherentsAValider[$objp->libelle]=$objp->somme; } 82 if ($objp->statut == 1) { $Adherents[$objp->libelle]=$objp->somme; } 83 if ($objp->statut == 0) { $AdherentsResilies[$objp->libelle]=$objp->somme; } 84 $i++; 85 } 86 $db->free($result); 87 88 } 89 90 # Liste les cotisants a jour 91 $sql = "SELECT count(*) as somme , t.libelle"; 92 $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; 93 $sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND d.datefin >= now()"; 94 $sql .= " GROUP BY t.libelle"; 95 96 $result = $db->query($sql); 97 98 if ($result) 99 { 100 $num = $db->num_rows($result); 101 $i = 0; 102 while ($i < $num) 103 { 104 $objp = $db->fetch_object($result); 105 $Cotisants[$objp->libelle]=$objp->somme; 106 $i++; 107 } 108 $db->free(); 109 110 } 111 $SommeA=0; 112 $SommeB=0; 113 $SommeC=0; 114 $SommeD=0; 115 116 foreach ($AdherentsAll as $key=>$value){ 117 $var=!$var; 118 print "<tr $bc[$var]>"; 119 print '<td><a href="type.php?rowid='.$AdherentsAll[$key].'">'.img_object($langs->trans("ShowType"),"group").' '.$key.'</a></td>'; 120 print '<td align="right">'.(isset($AdherentsAValider[$key])?$AdherentsAValider[$key]:'').'</td>'; 121 print '<td align="right">'.(isset($Adherents[$key])?$Adherents[$key]:'').'</td>'; 122 print '<td align="right">'.(isset($Cotisants[$key])?$Cotisants[$key]:'').'</td>'; 123 print '<td align="right">'.(isset($AdherentsResilies[$key])?$AdherentsResilies[$key]:'').'</td>'; 124 print "</tr>\n"; 125 $SommeA+=isset($AdherentsAValider[$key])?$AdherentsAValider[$key]:0; 126 $SommeB+=isset($Adherents[$key])?$Adherents[$key]:0; 127 $SommeC+=isset($Cotisants[$key])?$Cotisants[$key]:0; 128 $SommeD+=isset($AdherentsResilies[$key])?$AdherentsResilies[$key]:0; 129 } 130 print '<tr class="liste_total">'; 131 print '<td> <b>'.$langs->trans("Total").'</b> </td>'; 132 print '<td align="right"><b>'.$SommeA.'</b></td>'; 133 print '<td align="right"><b>'.$SommeB.'</b></td>'; 134 print '<td align="right"><b>'.$SommeC.'</b></td>'; 135 print '<td align="right"><b>'.$SommeD.'</b></td>'; 136 print '</tr>'; 137 138 print "</table>\n"; 139 140 print '<br>'; 141 142 print '</td></tr>'; 143 144 145 print '<tr><td width="30%" class="notopnoleft" valign="top">'; 146 147 148 // Formulaire recherche adhérent 149 print '<form action="liste.php" method="post">'; 150 print '<input type="hidden" name="action" value="search">'; 151 print '<table class="noborder" width="100%">'; 152 print '<tr class="liste_titre">'; 153 print '<td colspan="3">'.$langs->trans("SearchAMember").'</td>'; 154 print "</tr>\n"; 155 $var=false; 156 print "<tr $bc[$var]>"; 157 print '<td>'; 158 print $langs->trans("Name").':</td><td><input type="text" name="search" class="flat" size="16">'; 159 print '</td><td rowspan="2"><input class="button" type="submit" value="'.$langs->trans("Search").'"></td></tr>'; 160 print "<tr $bc[$var]>"; 161 print '<td>'; 162 print $langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="16">'; 163 print '</td></tr>'; 164 print "</table></form>"; 165 166 167 print '</td><td class="notopnoleftnoright" valign="top">'; 168 169 170 $sql = "SELECT c.cotisation, ".$db->pdate("c.dateadh")." as dateadh"; 171 $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; 172 $sql.= " WHERE d.rowid = c.fk_adherent"; 173 if(isset($date_select) && $date_select != ''){ 174 $sql .= " AND dateadh LIKE '$date_select%'"; 175 } 176 $result = $db->query($sql); 177 $Total=array(); 178 $Number=array(); 179 $tot=0; 180 $numb=0; 181 if ($result) 182 { 183 $num = $db->num_rows($result); 184 $i = 0; 185 while ($i < $num) 186 { 187 $objp = $db->fetch_object($result); 188 $year=strftime("%Y",$objp->dateadh); 189 $Total[$year]+=$objp->cotisation; 190 $Number[$year]+=1; 191 $tot+=$objp->cotisation; 192 $numb+=1; 193 $i++; 194 } 195 } 196 197 print '<table class="noborder" width="100%">'; 198 print '<tr class="liste_titre">'; 199 print '<td>'.$langs->trans("Year").'</td>'; 200 print '<td align="right">'.$langs->trans("Subscriptions").'</td>'; 201 print '<td align="right">'.$langs->trans("Number").'</td>'; 202 print '<td align="right">'.$langs->trans("Average").'</td>'; 203 print "</tr>\n"; 204 205 $var=true; 206 foreach ($Total as $key=>$value) 207 { 208 $var=!$var; 209 print "<tr $bc[$var]><td><a href=\"cotisations.php?date_select=$key\">$key</a></td><td align=\"right\">".price($value)."</td><td align=\"right\">".$Number[$key]."</td><td align=\"right\">".price($value/$Number[$key])."</td></tr>\n"; 210 } 211 212 // Total 213 print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.price($tot)."</td><td align=\"right\">".$numb."</td><td align=\"right\">".price($numb>0?($tot/$numb):0)."</td></tr>\n"; 214 print "</table><br>\n"; 215 216 print '</td></tr>'; 217 print '</table>'; 218 219 $db->close(); 220 221 llxFooter('$Date: 2005/10/30 14:16:27 $ - $Revision: 1.31 $'); 222 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |