Go to the documentation of this file.
27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/reception/class/receptionstats.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
35 $userid =
GETPOST(
'userid',
'int');
36 $socid =
GETPOST(
'socid',
'int');
38 $nowyear = strftime(
"%Y",
dol_now());
40 $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
43 $langs->loadLangs(array(
"reception",
"other",
"companies"));
47 $socid = $user->socid;
60 print
load_fiche_titre($langs->trans(
"StatisticsOfReceptions"),
'',
'dollyrevert');
62 $dir = (!empty($conf->reception->multidir_temp[$conf->entity]) ? $conf->reception->multidir_temp[$conf->entity] : $conf->service->multidir_temp[$conf->entity]);
65 $stats =
new ReceptionStats($db, $socid,
'', ($userid > 0 ? $userid : 0));
68 $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
73 if (empty($user->rights->societe->client->voir) || $user->socid) {
74 $filenamenb = $dir.
'/receptionsnbinyear-'.$user->id.
'-'.$year.
'.png';
76 $filenamenb = $dir.
'/receptionsnbinyear-'.$year.
'.png';
80 $mesg = $px1->isGraphKo();
84 $i = $startyear; $legend = array();
85 while ($i <= $endyear) {
89 $px1->SetLegend($legend);
90 $px1->SetMaxValue($px1->GetCeilMaxValue());
91 $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
92 $px1->SetWidth($WIDTH);
93 $px1->SetHeight($HEIGHT);
94 $px1->SetYLabel($langs->trans(
"NbOfReceptions"));
96 $px1->SetHorizTickIncrement(1);
98 $px1->SetTitle($langs->trans(
"NumberOfReceptionsByMonth"));
100 $px1->draw($filenamenb, $fileurlnb);
184 $data = $stats->getAllByYear();
185 $arrayyears = array();
186 foreach ($data as $val) {
187 if (!empty($val[
'year'])) {
188 $arrayyears[$val[
'year']] = $val[
'year'];
191 if (!count($arrayyears)) {
192 $arrayyears[$nowyear] = $nowyear;
197 $head[$h][0] = DOL_URL_ROOT.
'/reception/stats/index.php';
198 $head[$h][1] = $langs->trans(
"ByMonthYear");
199 $head[$h][2] =
'byyear';
202 $type =
'reception_stats';
209 print
'<div class="fichecenter"><div class="fichethirdleft">';
213 print
'<form name="stats" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
214 print
'<input type="hidden" name="token" value="'.newToken().
'">';
216 print
'<table class="noborder centpercent">';
217 print
'<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans(
"Filter").
'</td></tr>';
219 print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td>';
220 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
221 print
$form->select_company($socid,
'socid',
'', 1, 0, 0, array(), 0,
'widthcentpercentminusx maxwidth300',
'');
224 print
'<tr><td>'.$langs->trans(
"CreatedBy").
'</td><td>';
225 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
226 print
$form->select_dolusers($userid,
'userid', 1,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
229 print
'<tr><td>'.$langs->trans(
"Year").
'</td><td>';
230 if (!in_array($year, $arrayyears)) {
231 $arrayyears[$year] = $year;
233 if (!in_array($nowyear, $arrayyears)) {
234 $arrayyears[$nowyear] = $nowyear;
237 print
$form->selectarray(
'year', $arrayyears, $year, 0, 0, 0,
'', 0, 0, 0,
'',
'width75');
239 print
'<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans(
"Refresh").
'"></td></tr>';
244 print
'<table class="noborder centpercent">';
245 print
'<tr class="liste_titre" height="24">';
246 print
'<td class="center">'.$langs->trans(
"Year").
'</td>';
247 print
'<td class="right">'.$langs->trans(
"NbOfReceptions").
'</td>';
253 foreach ($data as $val) {
254 $year = $val[
'year'];
255 while (!empty($year) && $oldyear > $year + 1) {
259 print
'<tr class="oddeven" height="24">';
260 print
'<td class="center"><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$oldyear.
'">'.$oldyear.
'</a></td>';
262 print
'<td class="right">0</td>';
268 print
'<tr class="oddeven" height="24">';
269 print
'<td class="center">';
271 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.
'">'.$year.
'</a>';
273 print $langs->trans(
"ValidationDateNotDefinedEvenIfReceptionValidated");
276 print
'<td class="right">'.$val[
'nb'].
'</td>';
286 print
'</div><div class="fichetwothirdright">';
290 print
'<table class="border centpercent"><tr valign="top"><td class="center">';
300 print
'</td></tr></table>';
303 print
'</div></div>';
304 print
'<div style="clear:both"></div>';
343 print
'<i class="opacitymedium">'.$langs->trans(
"StatsOnReceptionsOnlyValidated").
'</i>';
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
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.
Class to manage reception statistics.
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add')
Complete or removed entries into a head array (used to build tabs).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
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.
dol_now($mode='auto')
Return date for now.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)