dolibarr  16.0.5
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 require '../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
27 require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionstats.class.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
29 
30 $year = GETPOST('year', 'int');
31 
32 // Security check
33 if ($user->socid) {
34  $socid = $user->socid;
35 }
36 restrictedArea($user, 'expedition');
37 
38 
39 /*
40  * View
41  */
42 
43 llxHeader();
44 
46 $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
47 
48 $mesg = '';
49 
50 print load_fiche_titre($langs->trans("StatisticsOfSendings").' '.$year, $mesg);
51 
52 $stats = new ExpeditionStats($db);
53 $data = $stats->getNbExpeditionByMonth($year);
54 
55 dol_mkdir($conf->expedition->dir_temp);
56 
57 $filename = $conf->expedition->dir_temp."/expedition".$year.".png";
58 $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=expeditionstats&file=expedition'.$year.'.png';
59 
60 $px = new DolGraph();
61 $mesg = $px->isGraphKo();
62 if (!$mesg) {
63  $px->SetData($data);
64  $px->SetMaxValue($px->GetCeilMaxValue());
65  $px->SetWidth($WIDTH);
66  $px->SetHeight($HEIGHT);
67  $px->SetYLabel($langs->trans("NbOfSendings"));
68  $px->SetShading(3);
69  $px->SetHorizTickIncrement(1);
70  $px->draw($filename, $fileurl);
71 }
72 
73 print '<table class="border centpercent">';
74 print '<tr><td class="center">'.$langs->trans("NbOfSendingsByMonth").'</td>';
75 print '<td class="center">';
76 print $px->show();
77 print '</td></tr>';
78 print '</table>';
79 
80 // End of page
81 llxFooter();
82 $db->close();
DolGraph\getDefaultGraphSizeForStats
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Definition: dolgraph.class.php:1539
restrictedArea
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.
Definition: security.lib.php:234
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
ExpeditionStats
Class to manage shipment statistics.
Definition: expeditionstats.class.php:35
DolGraph
Class to build graphs.
Definition: dolgraph.class.php:40
dol_mkdir
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
Definition: functions.lib.php:6603
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59