2004-10-19 20:58:50 +02:00
|
|
|
<?php
|
2012-04-15 11:28:21 +02:00
|
|
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
|
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
|
|
|
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 15:13:49 +01:00
|
|
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
2002-12-28 19:12:22 +01:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2002-12-28 19:12:22 +01:00
|
|
|
* (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
|
2011-08-01 00:21:57 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2002-12-28 19:12:22 +01:00
|
|
|
*/
|
2004-08-14 14:37:59 +02:00
|
|
|
|
2005-03-05 19:45:40 +01:00
|
|
|
/**
|
2009-02-02 03:04:26 +01:00
|
|
|
* \file htdocs/adherents/index.php
|
2009-10-10 18:00:35 +02:00
|
|
|
* \ingroup member
|
2009-02-02 03:04:26 +01:00
|
|
|
* \brief Page accueil module adherents
|
|
|
|
|
*/
|
2004-08-14 14:37:59 +02:00
|
|
|
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
2013-06-20 09:18:12 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
|
2006-04-01 04:07:58 +02:00
|
|
|
|
2004-07-31 15:34:32 +02:00
|
|
|
$langs->load("companies");
|
2010-05-02 19:05:07 +02:00
|
|
|
$langs->load("members");
|
2004-07-31 15:34:32 +02:00
|
|
|
|
2013-01-10 08:27:12 +01:00
|
|
|
// Security check
|
|
|
|
|
$result=restrictedArea($user,'adherent');
|
2013-01-02 18:43:59 +01:00
|
|
|
|
2004-07-31 15:34:32 +02:00
|
|
|
|
2009-03-09 12:28:12 +01:00
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
|
|
|
|
|
2009-08-12 14:59:14 +02:00
|
|
|
llxHeader('',$langs->trans("Members"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
2002-12-28 19:12:22 +01:00
|
|
|
|
2006-04-01 04:07:58 +02:00
|
|
|
$staticmember=new Adherent($db);
|
2007-05-09 13:27:45 +02:00
|
|
|
$statictype=new AdherentType($db);
|
2011-10-25 23:48:40 +02:00
|
|
|
$subscriptionstatic=new Cotisation($db);
|
2002-12-28 19:12:22 +01:00
|
|
|
|
2005-08-11 20:24:58 +02:00
|
|
|
print_fiche_titre($langs->trans("MembersArea"));
|
|
|
|
|
|
|
|
|
|
|
2002-12-30 16:13:28 +01:00
|
|
|
$var=True;
|
|
|
|
|
|
2003-05-05 17:27:02 +02:00
|
|
|
$Adherents=array();
|
2004-07-14 21:46:34 +02:00
|
|
|
$AdherentsAValider=array();
|
2009-02-21 16:14:45 +01:00
|
|
|
$MemberUpToDate=array();
|
2004-07-14 21:46:34 +02:00
|
|
|
$AdherentsResilies=array();
|
2009-02-21 16:14:45 +01:00
|
|
|
|
2006-04-29 13:53:08 +02:00
|
|
|
$AdherentType=array();
|
2003-05-05 17:27:02 +02:00
|
|
|
|
2011-09-20 12:30:56 +02:00
|
|
|
// Liste les adherents
|
2007-02-27 22:40:09 +01:00
|
|
|
$sql = "SELECT t.rowid, t.libelle, t.cotisation,";
|
|
|
|
|
$sql.= " d.statut, count(d.rowid) as somme";
|
|
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
|
2012-04-15 11:28:21 +02:00
|
|
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
|
|
|
|
|
$sql.= " ON t.rowid = d.fk_adherent_type";
|
|
|
|
|
$sql.= " AND d.entity IN (".getEntity().")";
|
|
|
|
|
$sql.= " WHERE t.entity IN (".getEntity().")";
|
2007-02-27 22:40:09 +01:00
|
|
|
$sql.= " GROUP BY t.rowid, t.libelle, t.cotisation, d.statut";
|
2004-07-14 21:46:34 +02:00
|
|
|
|
2009-02-21 16:14:45 +01:00
|
|
|
dol_syslog("index.php::select nb of members by type sql=".$sql, LOG_DEBUG);
|
2002-12-28 19:12:22 +01:00
|
|
|
$result = $db->query($sql);
|
2006-04-01 04:07:58 +02:00
|
|
|
if ($result)
|
2002-12-28 19:12:22 +01:00
|
|
|
{
|
2006-04-01 04:07:58 +02:00
|
|
|
$num = $db->num_rows($result);
|
|
|
|
|
$i = 0;
|
|
|
|
|
while ($i < $num)
|
|
|
|
|
{
|
|
|
|
|
$objp = $db->fetch_object($result);
|
|
|
|
|
|
|
|
|
|
$adhtype=new AdherentType($db);
|
|
|
|
|
$adhtype->id=$objp->rowid;
|
|
|
|
|
$adhtype->cotisation=$objp->cotisation;
|
|
|
|
|
$adhtype->libelle=$objp->libelle;
|
|
|
|
|
$AdherentType[$objp->rowid]=$adhtype;
|
|
|
|
|
|
2009-02-21 16:14:45 +01:00
|
|
|
if ($objp->statut == -1) { $MemberToValidate[$objp->rowid]=$objp->somme; }
|
|
|
|
|
if ($objp->statut == 1) { $MembersValidated[$objp->rowid]=$objp->somme; }
|
|
|
|
|
if ($objp->statut == 0) { $MembersResiliated[$objp->rowid]=$objp->somme; }
|
2006-04-01 04:07:58 +02:00
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
$db->free($result);
|
2003-05-05 17:27:02 +02:00
|
|
|
}
|
2002-12-30 16:25:16 +01:00
|
|
|
|
2012-03-23 18:19:50 +01:00
|
|
|
$now=dol_now();
|
2009-02-02 03:04:26 +01:00
|
|
|
|
2009-03-09 11:27:21 +01:00
|
|
|
// List members up to date
|
2009-02-21 16:14:45 +01:00
|
|
|
// current rule: uptodate = the end date is in future whatever is type
|
|
|
|
|
// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
|
2006-04-01 04:07:58 +02:00
|
|
|
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
|
2009-02-21 16:14:45 +01:00
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
2012-04-15 11:28:21 +02:00
|
|
|
$sql.= " WHERE d.entity IN (".getEntity().")";
|
|
|
|
|
//$sql.= " AND d.statut = 1 AND ((t.cotisation = 0 AND d.datefin IS NULL) OR d.datefin >= ".$db->idate($now).')';
|
|
|
|
|
$sql.= " AND d.statut = 1 AND d.datefin >= ".$db->idate($now);
|
2009-02-21 16:14:45 +01:00
|
|
|
$sql.= " AND t.rowid = d.fk_adherent_type";
|
2006-04-01 04:07:58 +02:00
|
|
|
$sql.= " GROUP BY d.fk_adherent_type";
|
2003-05-05 17:27:02 +02:00
|
|
|
|
2009-02-21 16:14:45 +01:00
|
|
|
dol_syslog("index.php::select nb of uptodate members by type sql=".$sql, LOG_DEBUG);
|
2003-05-05 17:27:02 +02:00
|
|
|
$result = $db->query($sql);
|
2009-01-21 16:06:34 +01:00
|
|
|
if ($result)
|
2003-05-05 17:27:02 +02:00
|
|
|
{
|
2009-02-02 03:04:26 +01:00
|
|
|
$num = $db->num_rows($result);
|
|
|
|
|
$i = 0;
|
|
|
|
|
while ($i < $num)
|
|
|
|
|
{
|
|
|
|
|
$objp = $db->fetch_object($result);
|
2009-02-21 16:14:45 +01:00
|
|
|
$MemberUpToDate[$objp->fk_adherent_type]=$objp->somme;
|
2009-02-02 03:04:26 +01:00
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
$db->free();
|
2002-12-28 19:12:22 +01:00
|
|
|
}
|
2009-02-02 03:04:26 +01:00
|
|
|
|
|
|
|
|
|
2013-03-16 14:53:15 +01:00
|
|
|
//print '<tr><td width="30%" class="notopnoleft" valign="top">';
|
|
|
|
|
print '<div class="fichecenter"><div class="fichethirdleft">';
|
2009-02-02 03:04:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// Formulaire recherche adherent
|
|
|
|
|
print '<form action="liste.php" method="post">';
|
2009-05-17 10:01:54 +02:00
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
2009-02-02 03:04:26 +01:00
|
|
|
print '<input type="hidden" name="action" value="search">';
|
2012-09-09 13:13:24 +02:00
|
|
|
print '<table class="noborder nohover" width="100%">';
|
2009-02-02 03:04:26 +01:00
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td colspan="3">'.$langs->trans("SearchAMember").'</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
$var=false;
|
2013-06-20 09:18:12 +02:00
|
|
|
print "<tr ".$bc[$var].">";
|
2009-02-02 03:04:26 +01:00
|
|
|
print '<td>';
|
2012-04-02 10:26:06 +02:00
|
|
|
print $langs->trans("Ref").':</td><td><input type="text" name="search_ref" class="flat" size="16">';
|
|
|
|
|
print '</td><td rowspan="3"><input class="button" type="submit" value="'.$langs->trans("Search").'"></td></tr>';
|
2013-06-20 09:18:12 +02:00
|
|
|
print "<tr ".$bc[$var].">";
|
2012-04-02 10:26:06 +02:00
|
|
|
print '<td>';
|
2013-02-23 11:11:33 +01:00
|
|
|
print $langs->trans("Name").':</td><td><input type="text" name="search_lastname" class="flat" size="16">';
|
2012-04-02 10:26:06 +02:00
|
|
|
print '</td></tr>';
|
2013-06-20 09:18:12 +02:00
|
|
|
print "<tr ".$bc[$var].">";
|
2009-02-02 03:04:26 +01:00
|
|
|
print '<td>';
|
|
|
|
|
print $langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="16">';
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
print "</table></form>";
|
|
|
|
|
|
2011-05-22 00:58:09 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Statistics
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if ($conf->use_javascript_ajax)
|
2011-05-21 15:00:22 +02:00
|
|
|
{
|
2011-05-22 00:58:09 +02:00
|
|
|
print '<br>';
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
|
|
|
|
|
print '<tr><td align="center">';
|
|
|
|
|
|
|
|
|
|
$SommeA=0;
|
|
|
|
|
$SommeB=0;
|
|
|
|
|
$SommeC=0;
|
|
|
|
|
$SommeD=0;
|
|
|
|
|
$dataval=array();
|
|
|
|
|
$datalabels=array();
|
2011-11-20 16:54:41 +01:00
|
|
|
$i=0;
|
2011-05-22 00:58:09 +02:00
|
|
|
foreach ($AdherentType as $key => $adhtype)
|
|
|
|
|
{
|
2011-11-20 16:34:30 +01:00
|
|
|
$datalabels[]=array($i,$adhtype->getNomUrl(0,dol_size(16)));
|
|
|
|
|
$dataval['draft'][]=array($i,isset($MemberToValidate[$key])?$MemberToValidate[$key]:0);
|
2012-11-13 12:32:05 +01:00
|
|
|
$dataval['notuptodate'][]=array($i,isset($MembersValidated[$key])?$MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):0);
|
2011-11-20 16:34:30 +01:00
|
|
|
$dataval['uptodate'][]=array($i,isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0);
|
|
|
|
|
$dataval['resiliated'][]=array($i,isset($MembersResiliated[$key])?$MembersResiliated[$key]:0);
|
2011-05-22 00:58:09 +02:00
|
|
|
$SommeA+=isset($MemberToValidate[$key])?$MemberToValidate[$key]:0;
|
2012-11-13 12:32:05 +01:00
|
|
|
$SommeB+=isset($MembersValidated[$key])?$MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):0;
|
2011-05-22 00:58:09 +02:00
|
|
|
$SommeC+=isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0;
|
|
|
|
|
$SommeD+=isset($MembersResiliated[$key])?$MembersResiliated[$key]:0;
|
2011-11-20 16:54:41 +01:00
|
|
|
$i++;
|
2011-05-22 00:58:09 +02:00
|
|
|
}
|
2011-06-07 00:13:43 +02:00
|
|
|
|
|
|
|
|
$dataseries=array();
|
2011-11-20 15:25:08 +01:00
|
|
|
$dataseries[]=array('label'=>$langs->trans("MenuMembersNotUpToDate"),'data'=>round($SommeB));
|
|
|
|
|
$dataseries[]=array('label'=>$langs->trans("MenuMembersUpToDate"),'data'=>round($SommeC));
|
|
|
|
|
$dataseries[]=array('label'=>$langs->trans("MembersStatusResiliated"),'data'=>round($SommeD));
|
|
|
|
|
$dataseries[]=array('label'=>$langs->trans("MembersStatusToValid"),'data'=>round($SommeA));
|
2011-05-22 00:58:09 +02:00
|
|
|
$data=array('series'=>$dataseries);
|
2011-06-07 00:23:24 +02:00
|
|
|
dol_print_graph('stats',300,180,$data,1,'pie',1);
|
2011-05-22 00:58:09 +02:00
|
|
|
print '</td></tr>';
|
|
|
|
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
|
|
|
|
|
print $SommeA+$SommeB+$SommeC+$SommeD;
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
print '</table>';
|
2011-05-21 15:00:22 +02:00
|
|
|
}
|
|
|
|
|
|
2013-03-16 14:53:15 +01:00
|
|
|
|
|
|
|
|
//print '</td><td class="notopnoleftnoright" valign="top">';
|
2013-03-30 14:27:13 +01:00
|
|
|
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
2011-05-21 15:00:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
$var=true;
|
2003-05-05 17:27:02 +02:00
|
|
|
|
2006-11-19 18:52:51 +01:00
|
|
|
/*
|
2009-03-09 11:27:21 +01:00
|
|
|
* Last modified members
|
2006-11-19 18:52:51 +01:00
|
|
|
*/
|
|
|
|
|
$max=5;
|
|
|
|
|
|
2013-02-23 15:26:39 +01:00
|
|
|
$sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
2010-04-20 21:00:17 +02:00
|
|
|
$sql.= " a.tms as datem, datefin as date_end_subscription,";
|
2007-05-09 13:27:45 +02:00
|
|
|
$sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation";
|
2006-11-19 18:52:51 +01:00
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
2012-04-15 11:28:21 +02:00
|
|
|
$sql.= " WHERE a.entity IN (".getEntity().")";
|
|
|
|
|
$sql.= " AND a.fk_adherent_type = ta.rowid";
|
2010-04-20 21:00:17 +02:00
|
|
|
$sql.= $db->order("a.tms","DESC");
|
2006-11-19 18:52:51 +01:00
|
|
|
$sql.= $db->plimit($max, 0);
|
|
|
|
|
|
|
|
|
|
$resql=$db->query($sql);
|
|
|
|
|
if ($resql)
|
|
|
|
|
{
|
2009-02-02 03:04:26 +01:00
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td colspan="4">'.$langs->trans("LastMembersModified",$max).'</td></tr>';
|
|
|
|
|
|
|
|
|
|
$num = $db->num_rows($resql);
|
|
|
|
|
if ($num)
|
|
|
|
|
{
|
|
|
|
|
$i = 0;
|
|
|
|
|
$var = True;
|
|
|
|
|
while ($i < $num)
|
|
|
|
|
{
|
|
|
|
|
$var=!$var;
|
|
|
|
|
$obj = $db->fetch_object($resql);
|
2011-10-25 23:48:40 +02:00
|
|
|
print "<tr ".$bc[$var].">";
|
2009-02-02 03:04:26 +01:00
|
|
|
$staticmember->id=$obj->rowid;
|
2012-01-30 10:22:50 +01:00
|
|
|
$staticmember->lastname=$obj->lastname;
|
|
|
|
|
$staticmember->firstname=$obj->firstname;
|
2012-09-24 11:01:27 +02:00
|
|
|
if (! empty($obj->fk_soc)) {
|
|
|
|
|
$staticmember->socid = $obj->fk_soc;
|
|
|
|
|
$staticmember->fetch_thirdparty();
|
2012-09-24 12:12:37 +02:00
|
|
|
$staticmember->name=$staticmember->thirdparty->name;
|
2012-09-24 11:01:27 +02:00
|
|
|
} else {
|
|
|
|
|
$staticmember->name=$obj->company;
|
|
|
|
|
}
|
2011-10-25 23:48:40 +02:00
|
|
|
$staticmember->ref=$staticmember->getFullName($langs);
|
2009-02-02 03:04:26 +01:00
|
|
|
$statictype->id=$obj->typeid;
|
|
|
|
|
$statictype->libelle=$obj->libelle;
|
2012-09-24 11:01:27 +02:00
|
|
|
print '<td>'.$staticmember->getNomUrl(1,32).'</td>';
|
|
|
|
|
print '<td>'.$statictype->getNomUrl(1,32).'</td>';
|
2012-08-26 13:09:34 +02:00
|
|
|
print '<td>'.dol_print_date($db->jdate($obj->datem),'dayhour').'</td>';
|
2010-04-20 21:00:17 +02:00
|
|
|
print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
|
2009-02-02 03:04:26 +01:00
|
|
|
print '</tr>';
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
print "</table><br>";
|
2006-11-19 18:52:51 +01:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-02-20 23:53:15 +01:00
|
|
|
dol_print_error($db);
|
2006-11-19 18:52:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-10-25 23:48:40 +02:00
|
|
|
/*
|
|
|
|
|
* Last modified subscriptions
|
|
|
|
|
*/
|
|
|
|
|
$max=5;
|
|
|
|
|
|
2013-02-23 15:26:39 +01:00
|
|
|
$sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
2011-10-25 23:48:40 +02:00
|
|
|
$sql.= " datefin as date_end_subscription,";
|
|
|
|
|
$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.cotisation";
|
|
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c";
|
2012-04-15 11:28:21 +02:00
|
|
|
$sql.= " WHERE a.entity IN (".getEntity().")";
|
|
|
|
|
$sql.= " AND c.fk_adherent = a.rowid";
|
2011-10-25 23:48:40 +02:00
|
|
|
$sql.= $db->order("c.tms","DESC");
|
|
|
|
|
$sql.= $db->plimit($max, 0);
|
|
|
|
|
|
|
|
|
|
$resql=$db->query($sql);
|
|
|
|
|
if ($resql)
|
|
|
|
|
{
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td colspan="5">'.$langs->trans("LastSubscriptionsModified",$max).'</td></tr>';
|
|
|
|
|
|
|
|
|
|
$num = $db->num_rows($resql);
|
|
|
|
|
if ($num)
|
|
|
|
|
{
|
|
|
|
|
$i = 0;
|
|
|
|
|
$var = True;
|
|
|
|
|
while ($i < $num)
|
|
|
|
|
{
|
|
|
|
|
$var=!$var;
|
|
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
|
print "<tr ".$bc[$var].">";
|
|
|
|
|
$subscriptionstatic->id=$obj->cid;
|
|
|
|
|
$subscriptionstatic->ref=$obj->cid;
|
|
|
|
|
$staticmember->id=$obj->rowid;
|
2012-01-30 10:22:50 +01:00
|
|
|
$staticmember->lastname=$obj->lastname;
|
|
|
|
|
$staticmember->firstname=$obj->firstname;
|
2012-09-30 21:26:58 +02:00
|
|
|
if (! empty($obj->fk_soc)) {
|
|
|
|
|
$staticmember->socid = $obj->fk_soc;
|
2012-09-24 12:12:37 +02:00
|
|
|
$staticmember->fetch_thirdparty();
|
2012-09-30 21:26:58 +02:00
|
|
|
$staticmember->name=$staticmember->thirdparty->name;
|
|
|
|
|
} else {
|
|
|
|
|
$staticmember->name=$obj->company;
|
2012-09-24 12:12:37 +02:00
|
|
|
}
|
2011-10-25 23:48:40 +02:00
|
|
|
$staticmember->ref=$staticmember->getFullName($langs);
|
|
|
|
|
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
|
2012-09-24 12:12:37 +02:00
|
|
|
print '<td>'.$staticmember->getNomUrl(1,32,'subscription').'</td>';
|
2011-10-25 23:48:40 +02:00
|
|
|
print '<td>'.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).'</td>';
|
|
|
|
|
print '<td align="right">'.price($obj->cotisation).'</td>';
|
|
|
|
|
//print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
|
|
|
|
|
print '<td align="right">'.dol_print_date($db->jdate($obj->datem?$obj->datem:$obj->datec),'dayhour').'</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
print "</table><br>";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Summary of members by type
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td>'.$langs->trans("MembersTypes").'</td>';
|
|
|
|
|
print '<td align=right>'.$langs->trans("MembersStatusToValid").'</td>';
|
|
|
|
|
print '<td align=right>'.$langs->trans("MenuMembersNotUpToDate").'</td>';
|
|
|
|
|
print '<td align=right>'.$langs->trans("MenuMembersUpToDate").'</td>';
|
|
|
|
|
print '<td align=right>'.$langs->trans("MembersStatusResiliated").'</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
foreach ($AdherentType as $key => $adhtype)
|
|
|
|
|
{
|
|
|
|
|
$var=!$var;
|
2013-06-20 09:18:12 +02:00
|
|
|
print "<tr ".$bc[$var].">";
|
2012-09-24 12:12:37 +02:00
|
|
|
print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
|
2011-10-25 23:48:40 +02:00
|
|
|
print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
|
2012-11-13 12:32:05 +01:00
|
|
|
print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0) > 0) ? $MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
|
2012-03-23 18:19:50 +01:00
|
|
|
print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';
|
2011-10-25 23:48:40 +02:00
|
|
|
print '<td align="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).'</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
print '<tr class="liste_total">';
|
|
|
|
|
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
|
|
|
|
|
print '<td class="liste_total" align="right">'.$SommeA.' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
|
|
|
|
|
print '<td class="liste_total" align="right">'.$SommeB.' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
|
2012-03-23 18:19:50 +01:00
|
|
|
print '<td class="liste_total" align="right">'.$SommeC.' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';
|
2011-10-25 23:48:40 +02:00
|
|
|
print '<td class="liste_total" align="right">'.$SommeD.' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).'</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
print "</table>\n";
|
|
|
|
|
print "<br>\n";
|
|
|
|
|
|
2006-11-19 18:52:51 +01:00
|
|
|
|
2009-02-21 16:14:45 +01:00
|
|
|
// List of subscription by year
|
2006-04-01 04:07:58 +02:00
|
|
|
$Total=array();
|
|
|
|
|
$Number=array();
|
|
|
|
|
$tot=0;
|
|
|
|
|
$numb=0;
|
2005-08-11 20:24:58 +02:00
|
|
|
|
2010-04-20 21:00:17 +02:00
|
|
|
$sql = "SELECT c.cotisation, c.dateadh";
|
2005-08-11 20:24:58 +02:00
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
|
2012-04-15 11:28:21 +02:00
|
|
|
$sql.= " WHERE d.entity IN (".getEntity().")";
|
|
|
|
|
$sql.= " AND d.rowid = c.fk_adherent";
|
2006-04-01 04:07:58 +02:00
|
|
|
if(isset($date_select) && $date_select != '')
|
|
|
|
|
{
|
|
|
|
|
$sql .= " AND dateadh LIKE '$date_select%'";
|
2005-08-11 20:24:58 +02:00
|
|
|
}
|
|
|
|
|
$result = $db->query($sql);
|
2009-01-21 16:06:34 +01:00
|
|
|
if ($result)
|
2005-08-11 20:24:58 +02:00
|
|
|
{
|
2009-02-02 03:04:26 +01:00
|
|
|
$num = $db->num_rows($result);
|
|
|
|
|
$i = 0;
|
|
|
|
|
while ($i < $num)
|
|
|
|
|
{
|
|
|
|
|
$objp = $db->fetch_object($result);
|
2010-04-20 21:00:17 +02:00
|
|
|
$year=dol_print_date($db->jdate($objp->dateadh),"%Y");
|
2009-02-02 03:04:26 +01:00
|
|
|
$Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->cotisation;
|
|
|
|
|
$Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1;
|
|
|
|
|
$tot+=$objp->cotisation;
|
|
|
|
|
$numb+=1;
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
2005-08-11 20:24:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
print '<tr class="liste_titre">';
|
2009-02-21 16:14:45 +01:00
|
|
|
print '<td>'.$langs->trans("Subscriptions").'</td>';
|
2005-08-11 20:24:58 +02:00
|
|
|
print '<td align="right">'.$langs->trans("Number").'</td>';
|
2007-08-28 09:37:32 +02:00
|
|
|
print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
|
2006-11-26 19:24:53 +01:00
|
|
|
print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
2005-08-11 20:24:58 +02:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
$var=true;
|
2006-04-01 04:07:58 +02:00
|
|
|
krsort($Total);
|
2005-08-11 20:24:58 +02:00
|
|
|
foreach ($Total as $key=>$value)
|
|
|
|
|
{
|
2009-02-02 03:04:26 +01:00
|
|
|
$var=!$var;
|
2013-06-20 09:18:12 +02:00
|
|
|
print "<tr ".$bc[$var].">";
|
2007-08-28 09:37:32 +02:00
|
|
|
print "<td><a href=\"cotisations.php?date_select=$key\">$key</a></td>";
|
|
|
|
|
print "<td align=\"right\">".$Number[$key]."</td>";
|
|
|
|
|
print "<td align=\"right\">".price($value)."</td>";
|
|
|
|
|
print "<td align=\"right\">".price(price2num($value/$Number[$key],'MT'))."</td>";
|
|
|
|
|
print "</tr>\n";
|
2005-08-11 20:24:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Total
|
2007-08-28 09:37:32 +02:00
|
|
|
print '<tr class="liste_total">';
|
|
|
|
|
print '<td>'.$langs->trans("Total").'</td>';
|
|
|
|
|
print "<td align=\"right\">".$numb."</td>";
|
|
|
|
|
print '<td align="right">'.price($tot)."</td>";
|
|
|
|
|
print "<td align=\"right\">".price(price2num($numb>0?($tot/$numb):0,'MT'))."</td>";
|
|
|
|
|
print "</tr>\n";
|
2005-08-11 20:24:58 +02:00
|
|
|
print "</table><br>\n";
|
|
|
|
|
|
2013-03-16 14:53:15 +01:00
|
|
|
//print '</td></tr></table>';
|
2013-03-30 19:40:52 +01:00
|
|
|
print '</div></div></div>';
|
2005-08-11 20:24:58 +02:00
|
|
|
|
2006-11-19 18:52:51 +01:00
|
|
|
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-04-15 11:28:21 +02:00
|
|
|
$db->close();
|
2002-12-28 19:12:22 +01:00
|
|
|
?>
|