dolibarr 25.0.0-alpha
month.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2026 Joachim Kueter <git-jk@bloxera.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27// Load Dolibarr environment
28require '../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
30require_once DOL_DOCUMENT_ROOT.'/reception/class/receptionstats.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
32
41$langs->loadLangs(array('receptions', 'orders'));
42
43$year = GETPOSTINT("year");
44$socid = GETPOSTINT("socid");
45$userid = GETPOSTINT("userid");
46
47// Security check
48if ($user->socid) {
49 $socid = $user->socid;
50}
51$result = restrictedArea($user, 'reception', 0, '');
52
53
54/*
55 * View
56 */
57
58llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-reception page-stats_month');
59
62
63$mesg = '';
64
65print load_fiche_titre($langs->trans("StatisticsOfReceptions").' '.GETPOSTINT("year"), $mesg);
66$stats = new ReceptionStats($db, $socid, '', ($userid > 0 ? $userid : 0));
67$data = $stats->getNbByMonth($year);
68
69dol_mkdir($conf->reception->dir_temp);
70
71$filename = $conf->reception->dir_temp."/reception".$year.".png";
72$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstats&file=reception'.$year.'.png';
73
74$px = new DolGraph();
75$mesg = $px->isGraphKo();
76if (!$mesg) {
77 $px->SetData($data);
78 $px->SetMaxValue($px->GetCeilMaxValue());
79 $px->SetWidth($WIDTH);
80 $px->SetHeight($HEIGHT);
81 $px->SetYLabel($langs->trans("NbOfReceptions"));
82 $px->SetShading(3);
83 $px->SetHorizTickIncrement(1);
84 $px->draw($filename, $fileurl);
85}
86
87print '<table class="border centpercent">';
88print '<tr><td class="center">Nombre d reception par mois</td>';
89print '<td class="center">';
90print $px->show();
91print '</td></tr>';
92print '</table>';
93
94llxFooter();
95
96$db->close();
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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.
Definition wrapper.php:73
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to build graphs.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to manage reception statistics.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.