dolibarr 20.0.0
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 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25// Load Dolibarr environment
26require '../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
28require_once DOL_DOCUMENT_ROOT.'/reception/class/receptionstats.class.php';
29require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
30
31$year = GETPOSTINT("year");
32$socid = GETPOSTINT("socid");
33$userid = GETPOSTINT("userid");
34
35// Security check
36if ($user->socid) {
37 $socid = $user->socid;
38}
39$result = restrictedArea($user, 'reception', 0, '');
40
41
42/*
43 * View
44 */
45
46llxHeader();
47
50
51$mesg = '';
52
53print load_fiche_titre($langs->trans("StatisticsOfReceptions").' '.GETPOSTINT("year"), $mesg);
54$stats = new ReceptionStats($db, $socid, '', ($userid > 0 ? $userid : 0));
55$data = $stats->getNbByMonth($year);
56
57dol_mkdir($conf->reception->dir_temp);
58
59$filename = $conf->reception->dir_temp."/reception".$year.".png";
60$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=receptionstats&file=reception'.$year.'.png';
61
62$px = new DolGraph();
63$mesg = $px->isGraphKo();
64if (!$mesg) {
65 $px->SetData($data);
66 $px->SetMaxValue($px->GetCeilMaxValue());
67 $px->SetWidth($WIDTH);
68 $px->SetHeight($HEIGHT);
69 $px->SetYLabel($langs->trans("NbOfOrders"));
70 $px->SetShading(3);
71 $px->SetHorizTickIncrement(1);
72 $px->draw($filename, $fileurl);
73}
74
75print '<table class="border centpercent">';
76print '<tr><td class="center">Nombre d reception par mois</td>';
77print '<td class="center">';
78print $px->show();
79print '</td></tr>';
80print '</table>';
81
82llxFooter();
83
84$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to build graphs.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to manage reception statistics.
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_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.