dolibarr 25.0.0-alpha
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
6 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
7 * Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
8 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
9 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 */
24
31// Load Dolibarr environment
32require '../../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
41require_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
42require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
43require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php';
44require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
45require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
46require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
47
50
51$mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
52
53$hookmanager->initHooks(array('orderstats', 'globalcard'));
54
55$usercanreadcustumerstatistic = $user->hasRight('commande', 'lire');
56$usercanreadsupplierstatistic = $user->hasRight('fournisseur', 'commande', 'lire');
57if (getDolGlobalInt('MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS')) {
58 $usercanreadcustumerstatistic = $user->hasRight('commande', 'commande', 'export');
59 $usercanreadsupplierstatistic = $user->hasRight('fournisseur', 'commande', 'export');
60}
61if ($mode == 'customer' && !$usercanreadcustumerstatistic) {
63}
64if ($mode == 'supplier' && !$usercanreadsupplierstatistic) {
66}
67
68if ($mode == 'supplier') {
69 $object_status = GETPOST('object_status', 'array:int');
70 $object_status = implode(',', $object_status);
71} else {
72 $object_status = GETPOST('object_status', 'intcomma');
73}
74
75
76$typent_id = GETPOSTINT('typent_id');
77$categ_id = GETPOSTINT('categ_id');
78$select_categ_comande_id=GETPOST('select_categ_comande_id', 'array');
79$userid = GETPOSTINT('userid');
80$socid = GETPOSTINT('socid');
81// Security check
82if ($user->socid > 0) {
83 $action = '';
84 $socid = $user->socid;
85}
86
87$parameters = array();
88$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
89if ($reshook < 0) {
90 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
91}
92
93$nowyear = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt');
94$year = GETPOSTINT('year') > 0 ? GETPOSTINT('year') : $nowyear;
95$startyear = $year - (!getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
96$endyear = $year;
97
98// Load translation files required by the page
99$langs->loadLangs(array('orders', 'companies', 'other', 'suppliers'));
100
101
102/*
103 * View
104 */
105
106$form = new Form($db);
107$formorder = new FormOrder($db);
108$formcompany = new FormCompany($db);
109$formother = new FormOther($db);
110
111$picto = 'order';
112$title = $langs->trans("Orders");
113$dir = $conf->order->dir_temp;
114
115if ($mode == 'supplier') {
116 $picto = 'supplier_order';
117 $title = $langs->trans("SuppliersOrders");
118 $dir = $conf->fournisseur->commande->dir_temp;
119}
120
121llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-order page-stats');
122
123$page = 0;
124$param = '';
125$sortfield = '';
126$sortorder = '';
127$massactionbutton = '';
128$num = 0;
129$nbtotalofrecords = $langs->trans("Statistics");
130$limit = 0;
131
132$newcardbutton = '';
133if ($mode == 'supplier') {
134 $urlnew = DOL_URL_ROOT.'/fourn/commande/card.php?action=create';
135 if (!empty($socid)) {
136 $urlnew .= '&socid='.$socid;
137 }
138 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/fourn/commande/list.php?mode=common', '', 1, array('morecss' => 'reposition'));
139 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/fourn/commande/list.php?mode=kanban', '', 1, array('morecss' => 'reposition'));
140 $newcardbutton .= dolGetButtonTitle($langs->trans('Statistics'), '', 'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.'/commande/stats/index.php?mode=supplier', '', 2, array('morecss' => 'reposition'));
141 $newcardbutton .= dolGetButtonTitleSeparator();
142 $newcardbutton .= dolGetButtonTitle($langs->trans('NewSupplierOrderShort'), '', 'fa fa-plus-circle', $urlnew, '', (int) ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')));
143} else {
144 $urlnew = DOL_URL_ROOT.'/commande/card.php?action=create';
145 if (!empty($socid)) {
146 $urlnew .= '&socid='.$socid;
147 }
148 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/commande/list.php?mode=common', '', 1, array('morecss' => 'reposition'));
149 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/commande/list.php?mode=kanban', '', 1, array('morecss' => 'reposition'));
150 $newcardbutton .= dolGetButtonTitle($langs->trans('Statistics'), '', 'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.'/commande/stats/index.php', '', 2, array('morecss' => 'reposition'));
151 $newcardbutton .= dolGetButtonTitleSeparator();
152 $newcardbutton .= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $urlnew, '', $user->hasRight('commande', 'creer'));
153}
154
155print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
156
157dol_mkdir($dir);
158
159$stats = new CommandeStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0));
160if ($mode == 'customer') {
161 if ($object_status != '' && $object_status >= -1) {
162 $stats->where .= ' AND c.fk_statut IN ('.$db->sanitize($object_status).')';
163 }
164 if (is_array($select_categ_comande_id) && !empty($select_categ_comande_id)) {
165 $stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_order as cat ON (c.rowid = cat.fk_order)';
166 $stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $select_categ_comande_id)).')';
167 }
168}
169if ($mode == 'supplier') {
170 if ($object_status != '' && $object_status >= 0) {
171 $stats->where .= ' AND c.fk_statut IN ('.$db->sanitize($object_status).')';
172 }
173 if (is_array($select_categ_comande_id) && !empty($select_categ_comande_id)) {
174 $stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_supplier_order as cat ON (c.rowid = cat.fk_supplier_order)';
175 $stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $select_categ_comande_id)).')';
176 }
177}
178
179
180// Build graphic number of object
181$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
182
183// $data = array(array('Lib',val1,val2,val3),...)
184
185
186$fileurlnb = '';
187if (!$user->hasRight('societe', 'client', 'voir')) {
188 $filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png';
189 if ($mode == 'customer') {
190 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
191 }
192 if ($mode == 'supplier') {
193 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
194 }
195} else {
196 $filenamenb = $dir.'/ordersnbinyear-'.$year.'.png';
197 if ($mode == 'customer') {
198 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$year.'.png';
199 }
200 if ($mode == 'supplier') {
201 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$year.'.png';
202 }
203}
204
205$px1 = new DolGraph();
206$mesg = $px1->isGraphKo();
207if (!$mesg) {
208 $px1->SetData($data);
209 $i = $startyear;
210 $legend = array();
211 while ($i <= $endyear) {
212 $legend[] = $i;
213 $i++;
214 }
215 $px1->SetLegend($legend);
216 $px1->SetMaxValue($px1->GetCeilMaxValue());
217 $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
218 $px1->SetWidth($WIDTH);
219 $px1->SetHeight($HEIGHT);
220 $px1->SetYLabel($langs->trans("NbOfOrder"));
221 $px1->SetShading(3);
222 $px1->SetHorizTickIncrement(1);
223 $px1->mode = 'depth';
224 $px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
225
226 $px1->draw($filenamenb, $fileurlnb);
227}
228
229// Build graphic amount of object
230$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
231// $data = array(array('Lib',val1,val2,val3),...)
232
233$fileurlamount = '';
234if (!$user->hasRight('societe', 'client', 'voir')) {
235 $filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png';
236 if ($mode == 'customer') {
237 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
238 }
239 if ($mode == 'supplier') {
240 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
241 }
242} else {
243 $filenameamount = $dir.'/ordersamountinyear-'.$year.'.png';
244 if ($mode == 'customer') {
245 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$year.'.png';
246 }
247 if ($mode == 'supplier') {
248 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$year.'.png';
249 }
250}
251
252$px2 = new DolGraph();
253$mesg = $px2->isGraphKo();
254if (!$mesg) {
255 $px2->SetData($data);
256 $i = $startyear;
257 $legend = array();
258 while ($i <= $endyear) {
259 $legend[] = $i;
260 $i++;
261 }
262 $px2->SetLegend($legend);
263 $px2->SetMaxValue($px2->GetCeilMaxValue());
264 $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
265 $px2->SetWidth($WIDTH);
266 $px2->SetHeight($HEIGHT);
267 $px2->SetYLabel($langs->trans("AmountOfOrders"));
268 $px2->SetShading(3);
269 $px2->SetHorizTickIncrement(1);
270 $px2->mode = 'depth';
271 $px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
272
273 $px2->draw($filenameamount, $fileurlamount);
274}
275
276
277$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
278
279
280$fileurl_avg = '';
281if (!$user->hasRight('societe', 'client', 'voir')) {
282 $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
283 if ($mode == 'customer') {
284 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
285 }
286 if ($mode == 'supplier') {
287 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png';
288 }
289} else {
290 $filename_avg = $dir.'/ordersaverage-'.$year.'.png';
291 if ($mode == 'customer') {
292 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png';
293 }
294 if ($mode == 'supplier') {
295 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png';
296 }
297}
298
299$px3 = new DolGraph();
300$mesg = $px3->isGraphKo();
301if (!$mesg) {
302 $px3->SetData($data);
303 $i = $startyear;
304 $legend = array();
305 while ($i <= $endyear) {
306 $legend[] = $i;
307 $i++;
308 }
309 $px3->SetLegend($legend);
310 $px3->SetYLabel($langs->trans("AmountAverage"));
311 $px3->SetMaxValue($px3->GetCeilMaxValue());
312 $px3->SetMinValue((int) $px3->GetFloorMinValue());
313 $px3->SetWidth($WIDTH);
314 $px3->SetHeight($HEIGHT);
315 $px3->SetShading(3);
316 $px3->SetHorizTickIncrement(1);
317 $px3->mode = 'depth';
318 $px3->SetTitle($langs->trans("AmountAverage"));
319
320 $px3->draw($filename_avg, $fileurl_avg);
321}
322
323
324
325// Show array
326$data = $stats->getAllByYear();
327$arrayyears = array();
328foreach ($data as $val) {
329 if (!empty($val['year'])) {
330 $arrayyears[$val['year']] = $val['year'];
331 }
332}
333if (!count($arrayyears)) {
334 $arrayyears[$nowyear] = $nowyear;
335}
336
337$h = 0;
338$head = array();
339$head[$h][0] = DOL_URL_ROOT.'/commande/stats/index.php?mode='.$mode;
340$head[$h][1] = $langs->trans("ByMonthYear");
341$head[$h][2] = 'byyear';
342$h++;
343
344$type = 'order_stats';
345
346if ($mode == 'supplier') {
347 $type = 'supplier_order_stats';
348}
349
350complete_head_from_modules($conf, $langs, null, $head, $h, $type);
351
352print dol_get_fiche_head($head, 'byyear', '', -1);
353
354
355print '<div class="fichecenter"><div class="fichethirdleft">';
356
357
358// Show filter box
359print '<form name="stats" method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
360print '<input type="hidden" name="token" value="'.newToken().'">';
361print '<input type="hidden" name="mode" value="'.$mode.'">';
362
363print '<table class="noborder centpercent">';
364print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
365// Company
366print '<tr><td class="left">'.$langs->trans("ThirdParty").'</td><td class="left">';
367$filter = '';
368if ($mode == 'customer') {
369 $filter = '(s.client:IN:1,2,3)';
370}
371if ($mode == 'supplier') {
372 $filter = '(s.fournisseur:=:1)';
373}
374print img_picto('', 'company', 'class="pictofixedwidth"');
375print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300');
376print '</td></tr>';
377// ThirdParty Type
378print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
379$sortparam_typent = (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
380print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
381if ($user->admin) {
382 print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
383}
384print '</td></tr>';
385// Category societe
386$cat_type = 0;
387$cat_label = '';
388if ($mode == 'customer') {
389 $cat_type = Categorie::TYPE_CUSTOMER;
390 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer"));
391}
392if ($mode == 'supplier') {
393 $cat_type = Categorie::TYPE_SUPPLIER;
394 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
395}
396print '<tr><td>'.$cat_label.'</td><td>';
397print img_picto('', 'category', 'class="pictofixedwidth"');
398print $formother->select_categories($cat_type, $categ_id, 'categ_id', 0, 1, 'widthcentpercentminusx maxwidth300');
399print '</td></tr>';
400// Category commande
401if (isModEnabled('category')) {
402 $cat_type = '';
403 $cat_label = '';
404 if ($mode == 'customer') {
405 $cat_type = Categorie::TYPE_ORDER;
406 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("CustomersOrders"));
407 }
408 if ($mode == 'supplier') {
409 $cat_type = Categorie::TYPE_SUPPLIER_ORDER;
410 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("SuppliersOrders"));
411 }
412 print '<tr><td>'.$cat_label.'</td><td>';
413 $cate_arbo = $form->select_all_categories($cat_type, '', 'parent', 0, 0, 1);
414 print img_picto('', 'category', 'class="pictofixedwidth"');
415 print $form->multiselectarray('select_categ_comande_id', $cate_arbo, GETPOST('select_categ_comande_id', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300');
416 //print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);
417 print '</td></tr>';
418}
419// User
420print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
421print img_picto('', 'user', 'class="pictofixedwidth"');
422// Pass -1 (not 0) when no user is selected so the combo keeps its empty entry instead of defaulting to the
423// current user. The statistics query below is not filtered on the current user by default, so preselecting
424// them here wrongly suggests the displayed figures are limited to that user while they are actually global.
425print $form->select_dolusers(($userid > 0 ? $userid : -1), 'userid', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
426// Status
427print '<tr><td>'.$langs->trans("Status").'</td><td>';
428if ($mode == 'customer') {
429 $liststatus = array(
430 Commande::STATUS_DRAFT => $langs->trans("StatusOrderDraft"),
431 Commande::STATUS_VALIDATED => $langs->trans("StatusOrderValidated"),
432 Commande::STATUS_SHIPMENTONPROCESS => $langs->trans("StatusOrderSent"),
433 Commande::STATUS_CLOSED => $langs->trans("StatusOrderDelivered"),
434 Commande::STATUS_CANCELED => $langs->trans("StatusOrderCanceled")
435 );
436 print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'intcomma'), -4);
437}
438if ($mode == 'supplier') {
439 $formorder->selectSupplierOrderStatus((strstr($object_status, ',') ? -1 : $object_status), 0, 'object_status');
440}
441print '</td></tr>';
442// Year
443print '<tr><td class="left">'.$langs->trans("Year").'</td><td class="left">';
444if (!in_array($year, $arrayyears)) {
445 $arrayyears[$year] = $year;
446}
447if (!in_array($nowyear, $arrayyears)) {
448 $arrayyears[$nowyear] = $nowyear;
449}
450arsort($arrayyears);
451print img_picto('', 'calendar', 'class="pictofixedwidth"');
452print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
453print '</td></tr>';
454print '<tr><td align="center" colspan="2"><input type="submit" class="button small" name="submit" value="'.$langs->trans("Refresh").'"></td></tr>';
455print '</table>';
456print '</form>';
457print '<br><br>';
458
459
460print '<div class="div-table-responsive-no-min">';
461print '<table class="noborder centpercent">';
462print '<tr class="liste_titre" height="24">';
463print '<td class="center">'.$langs->trans("Year").'</td>';
464print '<td class="right">'.$langs->trans("NbOfOrders").'</td>';
465print '<td class="right">%</td>';
466print '<td class="right">'.$langs->trans("AmountTotal").'</td>';
467print '<td class="right">%</td>';
468print '<td class="right">'.$langs->trans("AmountAverage").'</td>';
469print '<td class="right">%</td>';
470print '</tr>';
471
472$oldyear = 0;
473foreach ($data as $val) {
474 $year = $val['year'];
475 while (!empty($year) && $oldyear > (int) $year + 1) { // If we have empty year
476 $oldyear--;
477
478 print '<tr class="oddeven" height="24">';
479 print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$oldyear.'</a></td>';
480 print '<td class="right">0</td>';
481 print '<td class="right"></td>';
482 print '<td class="right">0</td>';
483 print '<td class="right"></td>';
484 print '<td class="right">0</td>';
485 print '<td class="right"></td>';
486 print '</tr>';
487 }
488
489
490 print '<tr class="oddeven" height="24">';
491 print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>';
492 print '<td class="right">'.$val['nb'].'</td>';
493 print '<td class="right opacitylow" style="'.((!isset($val['nb_diff']) || $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['nb_diff']) ? round($val['nb_diff']) : "0").'%</td>';
494 print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
495 print '<td class="right opacitylow" style="'.((!isset($val['total_diff']) || $val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['total_diff']) ? round($val['total_diff']) : "0").'%</td>';
496 print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>';
497 print '<td class="right opacitylow" style="'.((!isset($val['avg_diff']) || $val['avg_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['avg_diff']) ? round($val['avg_diff']) : "0").'%</td>';
498 print '</tr>';
499 $oldyear = $year;
500}
501
502print '</table>';
503print '</div>';
504
505
506print '</div><div class="fichetwothirdright">';
507
508
509// Show graphs
510print '<table class="border centpercent"><tr class="pair nohover"><td align="center">';
511if ($mesg) {
512 print $mesg;
513} else {
514 print $px1->show();
515 print "<br>\n";
516 print $px2->show();
517 print "<br>\n";
518 print $px3->show();
519}
520print '</td></tr></table>';
521
522
523print '</div></div>';
524print '<div class="clearboth"></div>';
525
526print dol_get_fiche_end();
527
528// End of page
529llxFooter();
530$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
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_CANCELED
Canceled status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class to manage order statistics (customer and supplier)
Class to build graphs.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to build HTML component for third parties management Only common components are here.
Class to manage generation of HTML components Only common components must be here.
Class to manage HTML output components for orders Before adding component here, check they are not in...
Class to help generate other html components Only common components are here.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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)
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.
Definition html.lib.php:519
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition html.lib.php:717
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.