Go to the documentation of this file.
24 require
'../../main.inc.php';
25 require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
26 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
30 $graphheight = round($graphwidth * $mapratio);
36 if ($user->socid > 0) {
38 $socid = $user->socid;
42 $year = strftime(
"%Y", time());
43 $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
47 $langs->loadLangs(array(
"companies",
"members"));
56 llxHeader(
'', $langs->trans(
"MembersStatisticsByProperties"),
'',
'', 0, 0, array(
'https://www.google.com/jsapi'));
58 $title = $langs->trans(
"MembersStatisticsByProperties");
66 $sql =
"SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions,";
67 $sql .=
" MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate,";
68 $sql .=
" d.morphy as code";
69 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
70 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"subscription as s ON s.fk_adherent = d.rowid";
71 $sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
72 $sql .=
" AND d.statut <> ".Adherent::STATUS_DRAFT;
73 $sql .=
" GROUP BY d.morphy";
74 $foundphy = $foundmor = 0;
80 $num = $db->num_rows(
$resql);
83 $obj = $db->fetch_object(
$resql);
85 if ($obj->code ==
'phy') {
88 if ($obj->code ==
'mor') {
92 $data[$obj->code] = array(
'label'=>$obj->code,
'nb'=>$obj->nb,
'nbsubscriptions'=>$obj->nbsubscriptions,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate));
101 $sql =
"SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions,";
102 $sql .=
" MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate,";
103 $sql .=
" d.morphy as code";
104 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
105 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"subscription as s ON s.fk_adherent = d.rowid";
106 $sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
107 $sql .=
" AND d.statut >= 1";
108 $sql .=
" GROUP BY d.morphy";
109 $foundphy = $foundmor = 0;
112 dol_syslog(
"Count member still active", LOG_DEBUG);
113 $resql = $db->query($sql);
115 $num = $db->num_rows(
$resql);
118 $obj = $db->fetch_object(
$resql);
120 if ($obj->code ==
'phy') {
123 if ($obj->code ==
'mor') {
127 $data[$obj->code][
'nbactive'] = $obj->nb;
144 print
'<span class="opacitymedium">'.$langs->trans(
"NoValidatedMemberYet").
'</span><br>';
147 print
'<span class="opacitymedium">'.$langs->trans(
"MembersByNature").
'</span><br>';
152 print
'<div class="div-table-responsive">';
153 print
'<table class="liste centpercent">';
154 print
'<tr class="liste_titre">';
155 print
'<td>'.$langs->trans(
"MemberNature").
'</td>';
156 print
'<td class="right">'.$langs->trans(
"NbOfMembers").
' <span class="opacitymedium">('.$langs->trans(
"AllTime").
')</span></td>';
157 print
'<td class="right">'.$langs->trans(
"NbOfActiveMembers").
'</td>';
158 print
'<td class="center">'.$langs->trans(
"LastMemberDate").
'</td>';
159 print
'<td class="right">'.$langs->trans(
"NbOfSubscriptions").
'</td>';
160 print
'<td class="center">'.$langs->trans(
"LatestSubscriptionDate").
'</td>';
164 $data[] = array(
'label'=>
'phy',
'nb'=>
'0',
'nbactive'=>
'0',
'lastdate'=>
'',
'lastsubscriptiondate'=>
'');
167 $data[] = array(
'label'=>
'mor',
'nb'=>
'0',
'nbactive'=>
'0',
'lastdate'=>
'',
'lastsubscriptiondate'=>
'');
170 foreach ($data as $val) {
172 $nbsubscriptions = isset($val[
'nbsubscriptions']) ? $val[
'nbsubscriptions'] : 0;
173 $nbactive = $val[
'nbactive'];
175 print
'<tr class="oddeven">';
176 print
'<td>'.$memberstatic->getmorphylib($val[
'label']).
'</td>';
177 print
'<td class="right">'.$nb.
'</td>';
178 print
'<td class="right">'.$nbactive.
'</td>';
179 print
'<td class="center">'.dol_print_date($val[
'lastdate'],
'dayhour').
'</td>';
180 print
'<td class="right">'.$nbsubscriptions.
'</td>';
181 print
'<td class="center">'.dol_print_date($val[
'lastsubscriptiondate'],
'dayhour').
'</td>';
restrictedArea($user, $features, $objectid=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.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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 informations.
Class to manage members of a foundation.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.