25 require
'../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
27 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
31 $graphheight = round($graphwidth * $mapratio);
37 if ($user->socid > 0) {
39 $socid = $user->socid;
44 $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
48 $langs->loadLangs(array(
"companies",
"members"));
57 llxHeader(
'', $langs->trans(
"MembersStatisticsByProperties"),
'',
'', 0, 0, array(
'https://www.google.com/jsapi'));
59 $title = $langs->trans(
"MembersStatisticsByProperties");
67 $sql =
"SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions,";
68 $sql .=
" MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate,";
69 $sql .=
" d.morphy as code";
70 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
71 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"subscription as s ON s.fk_adherent = d.rowid";
72 $sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
73 $sql .=
" AND d.statut <> ".Adherent::STATUS_DRAFT;
74 $sql .=
" GROUP BY d.morphy";
75 $foundphy = $foundmor = 0;
81 $num = $db->num_rows(
$resql);
84 $obj = $db->fetch_object(
$resql);
86 if ($obj->code ==
'phy') {
89 if ($obj->code ==
'mor') {
93 $data[$obj->code] = array(
'label'=>$obj->code,
'nb'=>$obj->nb,
'nbsubscriptions'=>$obj->nbsubscriptions,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate));
102 $sql =
"SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions,";
103 $sql .=
" MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate,";
104 $sql .=
" d.morphy as code";
105 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
106 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"subscription as s ON s.fk_adherent = d.rowid";
107 $sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
108 $sql .=
" AND d.statut >= 1";
109 $sql .=
" GROUP BY d.morphy";
110 $foundphy = $foundmor = 0;
113 dol_syslog(
"Count member still active", LOG_DEBUG);
114 $resql = $db->query($sql);
116 $num = $db->num_rows(
$resql);
119 $obj = $db->fetch_object(
$resql);
121 if ($obj->code ==
'phy') {
124 if ($obj->code ==
'mor') {
128 $data[$obj->code][
'nbactive'] = $obj->nb;
145 print
'<span class="opacitymedium">'.$langs->trans(
"NoValidatedMemberYet").
'</span><br>';
148 print
'<span class="opacitymedium">'.$langs->trans(
"MembersByNature").
'</span><br>';
153 print
'<div class="div-table-responsive">';
154 print
'<table class="liste centpercent">';
155 print
'<tr class="liste_titre">';
156 print
'<td>'.$langs->trans(
"MemberNature").
'</td>';
157 print
'<td class="right">'.$langs->trans(
"NbOfMembers").
' <span class="opacitymedium">('.$langs->trans(
"AllTime").
')</span></td>';
158 print
'<td class="right">'.$langs->trans(
"NbOfActiveMembers").
'</td>';
159 print
'<td class="center">'.$langs->trans(
"LastMemberDate").
'</td>';
160 print
'<td class="right">'.$langs->trans(
"NbOfSubscriptions").
'</td>';
161 print
'<td class="center">'.$langs->trans(
"LatestSubscriptionDate").
'</td>';
165 $data[] = array(
'label'=>
'phy',
'nb'=>
'0',
'nbactive'=>
'0',
'lastdate'=>
'',
'lastsubscriptiondate'=>
'');
168 $data[] = array(
'label'=>
'mor',
'nb'=>
'0',
'nbactive'=>
'0',
'lastdate'=>
'',
'lastsubscriptiondate'=>
'');
171 foreach ($data as $val) {
173 $nbsubscriptions = isset($val[
'nbsubscriptions']) ? $val[
'nbsubscriptions'] : 0;
174 $nbactive = $val[
'nbactive'];
176 print
'<tr class="oddeven">';
177 print
'<td>'.$memberstatic->getmorphylib($val[
'label']).
'</td>';
178 print
'<td class="right">'.$nb.
'</td>';
179 print
'<td class="right">'.$nbactive.
'</td>';
180 print
'<td class="center">'.dol_print_date($val[
'lastdate'],
'dayhour').
'</td>';
181 print
'<td class="right">'.$nbsubscriptions.
'</td>';
182 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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("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->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
load_fiche_titre($titre, $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='')
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
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.