29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherentstats.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
56if ($user->socid > 0) {
58 $socid = $user->socid;
70$langs->loadLangs(array(
"companies",
"members"));
80$title = $langs->trans(
"SubscriptionsStatistics");
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');
87$dir =
$conf->adherent->dir_temp;
94$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
99$filenamenb = $dir.
'/subscriptionsnbinyear-'.$year.
'.png';
100$fileurlnb = DOL_URL_ROOT.
'/viewimage.php?modulepart=memberstats&file=subscriptionsnbinyear-'.$year.
'.png';
104$mesg = $px1->isGraphKo();
106 $px1->SetData($data);
109 while ($i <= $endyear) {
113 $px1->SetLegend($legend);
114 $px1->SetMaxValue($px1->GetCeilMaxValue());
115 $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
116 $px1->SetWidth($WIDTH);
117 $px1->SetHeight($HEIGHT);
118 $px1->SetYLabel($langs->trans(
"NbOfSubscriptions"));
120 $px1->SetHorizTickIncrement(1);
121 $px1->mode =
'depth';
122 $px1->SetTitle($langs->trans(
"NbOfSubscriptions"));
124 $px1->draw($filenamenb, $fileurlnb);
128$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
132$filenameamount = $dir.
'/subscriptionsamountinyear-'.$year.
'.png';
133$fileurlamount = DOL_URL_ROOT.
'/viewimage.php?modulepart=memberstats&file=subscriptionsamountinyear-'.$year.
'.png';
136$mesg = $px2->isGraphKo();
138 $px2->SetData($data);
141 while ($i <= $endyear) {
145 $px2->SetLegend($legend);
146 $px2->SetMaxValue($px2->GetCeilMaxValue());
147 $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
148 $px2->SetWidth($WIDTH);
149 $px2->SetHeight($HEIGHT);
150 $px2->SetYLabel($langs->trans(
"AmountOfSubscriptions"));
152 $px2->SetHorizTickIncrement(1);
153 $px2->mode =
'depth';
154 $px2->SetTitle($langs->trans(
"AmountOfSubscriptions"));
156 $px2->draw($filenameamount, $fileurlamount);
165print
'<div class="fichecenter"><div class="fichethirdleft">';
188$data = $stats->getAllByYear();
191print
'<div class="div-table-responsive-no-min">';
192print
'<table class="noborder">';
193print
'<tr class="liste_titre" height="24">';
194print
'<td class="center">'.$langs->trans(
"Year").
'</td>';
195print
'<td class="right">'.$langs->trans(
"NbOfSubscriptions").
'</td>';
196print
'<td class="right">'.$langs->trans(
"AmountTotal").
'</td>';
197print
'<td class="right">'.$langs->trans(
"AmountAverage").
'</td>';
201foreach ($data as $val) {
202 $year = (int) $val[
'year'];
203 while ($oldyear > $year + 1) {
205 print
'<tr class="oddeven" height="24">';
206 print
'<td class="center">';
211 print
'<td class="right">0</td>';
212 print
'<td class="right amount nowraponall">0</td>';
213 print
'<td class="right amount nowraponall">0</td>';
216 print
'<tr class="oddeven" height="24">';
217 print
'<td class="center">';
218 print
'<a href="'.DOL_URL_ROOT.
'/adherents/subscription/list.php?date_select='.((int) $year).
'">'.$year.
'</a>';
220 print
'<td class="right">'.$val[
'nb'].
'</td>';
221 print
'<td class="right amount nowraponall"><span class="amount">'.price(
price2num($val[
'total'],
'MT'), 1).
'</span></td>';
222 print
'<td class="right amount nowraponall"><span class="amount">'.price(
price2num($val[
'avg'],
'MT'), 1).
'</span></td>';
231print
'</div><div class="fichetwothirdright">';
235print
'<table class="border centpercent"><tr class="pair nohover"><td class="center">';
243print
'</td></tr></table>';
247print
'<div class="clearboth"></div>';
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
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
member_stats_prepare_head($object)
Return array head with list of tabs to view object stats information.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.