26require
'../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
28require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
32$graphheight = round($graphwidth * $mapratio);
38if ($user->socid > 0) {
40 $socid = $user->socid;
49$langs->loadLangs(array(
"companies",
"members"));
58llxHeader(
'', $langs->trans(
"MembersStatisticsByProperties"),
'',
'', 0, 0, array(
'https://www.google.com/jsapi'));
60$title = $langs->trans(
"MembersStatisticsByProperties");
68$sql =
"SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions,";
69$sql .=
" MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate,";
70$sql .=
" d.morphy as code";
71$sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
72$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"subscription as s ON s.fk_adherent = d.rowid";
73$sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
74$sql .=
" AND d.statut <> ".Adherent::STATUS_DRAFT;
75$sql .=
" GROUP BY d.morphy";
76$foundphy = $foundmor = 0;
80$resql = $db->query($sql);
82 $num = $db->num_rows($resql);
85 $obj = $db->fetch_object($resql);
87 if ($obj->code ==
'phy') {
90 if ($obj->code ==
'mor') {
94 $data[$obj->code] = array(
'label' => $obj->code,
'nb' => $obj->nb,
'nbsubscriptions' => $obj->nbsubscriptions,
'lastdate' => $db->jdate($obj->lastdate),
'lastsubscriptiondate' => $db->jdate($obj->lastsubscriptiondate));
103$sql =
"SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions,";
104$sql .=
" MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate,";
105$sql .=
" d.morphy as code";
106$sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
107$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"subscription as s ON s.fk_adherent = d.rowid";
108$sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
109$sql .=
" AND d.statut >= 1";
110$sql .=
" GROUP BY d.morphy";
111$foundphy = $foundmor = 0;
114dol_syslog(
"Count member still active", LOG_DEBUG);
115$resql = $db->query($sql);
117 $num = $db->num_rows($resql);
120 $obj = $db->fetch_object($resql);
122 if ($obj->code ==
'phy') {
125 if ($obj->code ==
'mor') {
129 $data[$obj->code][
'nbactive'] = $obj->nb;
146 print
'<span class="opacitymedium">'.$langs->trans(
"NoValidatedMemberYet").
'</span><br>';
149 print
'<span class="opacitymedium">'.$langs->trans(
"MembersByNature").
'</span><br>';
154print
'<div class="div-table-responsive">';
155print
'<table class="liste centpercent">';
156print
'<tr class="liste_titre">';
157print
'<td>'.$langs->trans(
"MemberNature").
'</td>';
158print
'<td class="right">'.$langs->trans(
"NbOfMembers").
' <span class="opacitymedium">('.$langs->trans(
"AllTime").
')</span></td>';
159print
'<td class="right">'.$langs->trans(
"NbOfActiveMembers").
'</td>';
160print
'<td class="center">'.$langs->trans(
"LastMemberDate").
'</td>';
161print
'<td class="right">'.$langs->trans(
"NbOfSubscriptions").
'</td>';
162print
'<td class="center">'.$langs->trans(
"LatestSubscriptionDate").
'</td>';
166 $data[] = array(
'label' =>
'phy',
'nb' =>
'0',
'nbactive' =>
'0',
'lastdate' =>
'',
'lastsubscriptiondate' =>
'');
169 $data[] = array(
'label' =>
'mor',
'nb' =>
'0',
'nbactive' =>
'0',
'lastdate' =>
'',
'lastsubscriptiondate' =>
'');
172foreach ($data as $val) {
174 $nbsubscriptions = isset($val[
'nbsubscriptions']) ? $val[
'nbsubscriptions'] : 0;
175 $nbactive = $val[
'nbactive'];
177 print
'<tr class="oddeven">';
178 print
'<td>'.$memberstatic->getmorphylib($val[
'label']).
'</td>';
179 print
'<td class="right">'.$nb.
'</td>';
180 print
'<td class="right">'.$nbactive.
'</td>';
181 print
'<td class="center">'.dol_print_date($val[
'lastdate'],
'dayhour').
'</td>';
182 print
'<td class="right">'.$nbsubscriptions.
'</td>';
183 print
'<td class="center">'.dol_print_date($val[
'lastsubscriptiondate'],
'dayhour').
'</td>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage members of a foundation.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
member_stats_prepare_head($object)
Return array head with list of tabs to view object stats information.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.