30require
'../../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/reception/class/receptionstats.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
45$hookmanager->initHooks(array(
'receptionstats',
'globalcard'));
55$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
66$langs->loadLangs(array(
"receptions",
"other",
"companies"));
70 $socid = $user->socid;
81$title = $langs->trans(
"Receptions");
83llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-reception page-stats_index');
89$massactionbutton =
'';
91$nbtotalofrecords = $langs->trans(
"Statistics");
97$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/reception/list.php?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'common' ? 2 : 1), array(
'morecss' =>
'reposition'));
98$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', DOL_URL_ROOT.
'/reception/list.php?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
99$newcardbutton .= dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/reception/stats/index.php?mode=statistics'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', 2, array(
'morecss' =>
'reposition'));
100$newcardbutton .= dolGetButtonTitleSeparator();
101$newcardbutton .= dolGetButtonTitle($langs->trans(
'NewSending'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/reception/card.php?action=create',
'', $user->hasRight(
'reception',
'creer'));
103print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
105$dir = (!empty(
$conf->reception->multidir_temp[
$conf->entity]) ?
$conf->reception->multidir_temp[
$conf->entity] :
$conf->service->multidir_temp[
$conf->entity]);
111$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
116if (!$user->hasRight(
'societe',
'client',
'voir')) {
117 $filenamenb = $dir.
'/receptionsnbinyear-'.$user->id.
'-'.$year.
'.png';
119 $filenamenb = $dir.
'/receptionsnbinyear-'.$year.
'.png';
123$mesg = $px1->isGraphKo();
126 $px1->SetData($data);
129 while ($i <= $endyear) {
133 $px1->SetLegend($legend);
134 $px1->SetMaxValue($px1->GetCeilMaxValue());
135 $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
136 $px1->SetWidth($WIDTH);
137 $px1->SetHeight($HEIGHT);
138 $px1->SetYLabel($langs->trans(
"NbOfReceptions"));
140 $px1->SetHorizTickIncrement(1);
141 $px1->mode =
'depth';
142 $px1->SetTitle($langs->trans(
"NumberOfReceptionsByMonth"));
144 $px1->draw($filenamenb, $fileurlnb);
228$data = $stats->getAllByYear();
229$arrayyears = array();
230foreach ($data as $val) {
231 if (!empty($val[
'year'])) {
232 $arrayyears[$val[
'year']] = $val[
'year'];
235if (!count($arrayyears)) {
236 $arrayyears[$nowyear] = $nowyear;
241$head[$h][0] = DOL_URL_ROOT.
'/reception/stats/index.php';
242$head[$h][1] = $langs->trans(
"ByMonthYear");
243$head[$h][2] =
'byyear';
246$type =
'reception_stats';
253print
'<div class="fichecenter"><div class="fichethirdleft">';
257print
'<form name="stats" method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
258print
'<input type="hidden" name="token" value="'.newToken().
'">';
260print
'<table class="noborder centpercent">';
261print
'<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans(
"Filter").
'</td></tr>';
263print
'<tr><td>'.$langs->trans(
"ThirdParty").
'</td><td>';
264print
img_picto(
'',
'company',
'class="pictofixedwidth"');
265print $form->select_company($socid,
'socid',
'', 1, 0, 0, array(), 0,
'widthcentpercentminusx maxwidth300',
'');
268print
'<tr><td>'.$langs->trans(
"CreatedBy").
'</td><td>';
269print
img_picto(
'',
'user',
'class="pictofixedwidth"');
270print $form->select_dolusers($userid,
'userid', 1,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
273print
'<tr><td>'.$langs->trans(
"Year").
'</td><td>';
274if (!in_array($year, $arrayyears)) {
275 $arrayyears[$year] = $year;
277if (!in_array($nowyear, $arrayyears)) {
278 $arrayyears[$nowyear] = $nowyear;
281print
img_picto(
'',
'calendar',
'class="pictofixedwidth"');
282print $form->selectarray(
'year', $arrayyears, $year, 0, 0, 0,
'', 0, 0, 0,
'',
'width75');
284print
'<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans(
"Refresh").
'"></td></tr>';
289print
'<div class="div-table-responsive-no-min">';
290print
'<table class="noborder centpercent">';
291print
'<tr class="liste_titre" height="24">';
292print
'<td class="center">'.$langs->trans(
"Year").
'</td>';
293print
'<td class="right">'.$langs->trans(
"NbOfReceptions").
'</td>';
302foreach ($data as $val) {
303 $year = $val[
'year'];
304 while (!empty($year) && $oldyear > (
int) $year + 1) {
307 if ($nbline > $MAXLINES) {
308 $cssline =
' hidden';
311 print
'<tr class="oddeven'.$cssline.
'" height="24">';
312 print
'<td class="center"><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$oldyear.
'">'.$oldyear.
'</a></td>';
314 print
'<td class="right">0</td>';
320 print
'<tr class="oddeven'.$cssline.
'" height="24">';
321 print
'<td class="center">';
323 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.
'">'.$year.
'</a>';
325 print $langs->trans(
"ValidationDateNotDefinedEvenIfReceptionValidated");
328 print
'<td class="right">'.$val[
'nb'].
'</td>';
334 if ($nbline > $MAXLINES) {
335 $cssline =
' hidden';
339if ($nbline > $MAXLINES) {
340 print
'<tr class="liste_total"><td colspan="4" class="center">';
341 print
'<a href="#" class="showmoreoptions" onclick="javascript:$(\'.hidden\').toggle();$(this).toggle();">'.img_picto(
'',
'chevron-down',
'class="paddingright"').$langs->trans(
"More").
'...</a>';
348print
'</div><div class="fichetwothirdright">';
352print
'<table class="border centpercent"><tr class="pair nohover"><td class="center">';
362print
'</td></tr></table>';
366print
'<div class="clearboth"></div>';
405print
'<i class="opacitymedium">'.$langs->trans(
"StatsOnReceptionsOnlyValidated").
'</i>';
if(! $sortfield) if(! $sortorder) $object
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.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to manage receptions.
Class to manage reception statistics.
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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).
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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.