29require
'../../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherentstats.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
55if ($user->socid > 0) {
57 $socid = $user->socid;
69$langs->loadLangs(array(
"companies",
"members"));
80$title = $langs->trans(
"Subscriptions");
81$help_url =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios|DE:Modul_Mitglieder';
83llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-member page-stats');
88$queryforbutton = array();
89$queryforbutton[
'mode'] =
'common';
90$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode',
dolBuildUrl(DOL_URL_ROOT.
'/adherents/subscription/list.php', $queryforbutton),
'', 1, array(
'morecss' =>
'reposition'));
91$queryforbutton[
'mode'] =
'kanban';
92$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode',
dolBuildUrl(DOL_URL_ROOT.
'/adherents/subscription/list.php', $queryforbutton),
'', 1, array(
'morecss' =>
'reposition'));
93$newcardbutton .= dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode',
dol_buildpath(
'/adherents/stats/index.php', 1).
'?objecttype=adherent@adherent'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', 2, array(
'morecss' =>
'reposition'));
94$newcardbutton .= dolGetButtonTitleSeparator();
95$newcardbutton .= dolGetButtonTitle($langs->trans(
'NewSubscription'),
'',
'fa fa-plus-circle',
dolBuildUrl(DOL_URL_ROOT.
'/adherents/list.php', [
'statut' =>
'-1,1']),
'', $user->hasRight(
'adherent',
'creer'));
97print_barre_liste($title, 0, $_SERVER[
"PHP_SELF"], $param,
'',
'',
'', 0, $langs->trans(
"Statistics"), $membershipstatic->picto, 0, $newcardbutton,
'', 0, 0, 0, 1);
99$dir =
$conf->member->dir_temp;
106$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
111$filenamenb = $dir.
'/subscriptionsnbinyear-'.$year.
'.png';
112$fileurlnb = DOL_URL_ROOT.
'/viewimage.php?modulepart=memberstats&file=subscriptionsnbinyear-'.$year.
'.png';
116$mesg = $px1->isGraphKo();
118 $px1->SetData($data);
121 while ($i <= $endyear) {
125 $px1->SetLegend($legend);
126 $px1->SetMaxValue($px1->GetCeilMaxValue());
127 $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
128 $px1->SetWidth($WIDTH);
129 $px1->SetHeight($HEIGHT);
130 $px1->SetYLabel($langs->trans(
"NbOfSubscriptions"));
132 $px1->SetHorizTickIncrement(1);
133 $px1->mode =
'depth';
134 $px1->SetTitle($langs->trans(
"NbOfSubscriptions"));
136 $px1->draw($filenamenb, $fileurlnb);
140$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
144$filenameamount = $dir.
'/subscriptionsamountinyear-'.$year.
'.png';
145$fileurlamount = DOL_URL_ROOT.
'/viewimage.php?modulepart=memberstats&file=subscriptionsamountinyear-'.$year.
'.png';
148$mesg = $px2->isGraphKo();
150 $px2->SetData($data);
153 while ($i <= $endyear) {
157 $px2->SetLegend($legend);
158 $px2->SetMaxValue($px2->GetCeilMaxValue());
159 $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
160 $px2->SetWidth($WIDTH);
161 $px2->SetHeight($HEIGHT);
162 $px2->SetYLabel($langs->trans(
"AmountOfSubscriptions"));
164 $px2->SetHorizTickIncrement(1);
165 $px2->mode =
'depth';
166 $px2->SetTitle($langs->trans(
"AmountOfSubscriptions"));
168 $px2->draw($filenameamount, $fileurlamount);
177print
'<div class="fichecenter"><div class="fichethirdleft">';
200$data = $stats->getAllByYear();
203print
'<div class="div-table-responsive-no-min">';
204print
'<table class="noborder">';
205print
'<tr class="liste_titre" height="24">';
206print
'<td class="center">'.$langs->trans(
"Year").
'</td>';
207print
'<td class="right">'.$langs->trans(
"NbOfSubscriptions").
'</td>';
208print
'<td class="right">'.$langs->trans(
"AmountTotal").
'</td>';
209print
'<td class="right">'.$langs->trans(
"AmountAverage").
'</td>';
216foreach ($data as $val) {
217 $year = (int) $val[
'year'];
218 while ($oldyear > $year + 1) {
221 if ($nbline > $MAXLINES) {
222 $cssline =
' hidden';
224 print
'<tr class="oddeven'.$cssline.
'" height="24">';
225 print
'<td class="center">';
230 print
'<td class="right">0</td>';
231 print
'<td class="right amount nowraponall">0</td>';
232 print
'<td class="right amount nowraponall">0</td>';
235 print
'<tr class="oddeven'.$cssline.
'" height="24">';
236 print
'<td class="center">';
237 print
'<a href="'.DOL_URL_ROOT.
'/adherents/subscription/list.php?date_select='.((int) $year).
'">'.$year.
'</a>';
239 print
'<td class="right">'.$val[
'nb'].
'</td>';
240 print
'<td class="right amount nowraponall"><span class="amount">'.price(
price2num($val[
'total'],
'MT'), 1).
'</span></td>';
241 print
'<td class="right amount nowraponall"><span class="amount">'.price(
price2num($val[
'avg'],
'MT'), 1).
'</span></td>';
245 if ($nbline > $MAXLINES) {
246 $cssline =
' hidden';
250if ($nbline > $MAXLINES) {
251 print
'<tr class="liste_total"><td colspan="4" class="center">';
252 print
'<a href="#" class="showmoreoptions" onclick="javascript:$(\'.hidden\').toggle();$(this).toggle();">'.img_picto(
'',
'chevron-down',
'class="paddingright"').$langs->trans(
"More").
'...</a>';
260print
'</div><div class="fichetwothirdright">';
264print
'<table class="border centpercent"><tr class="pair nohover"><td class="center">';
272print
'</td></tr></table>';
276print
'<div class="clearboth"></div>';
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage statistics of members.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to manage subscriptions of foundation members.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_now($mode='gmt')
Return date for now.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
membership_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.