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