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 * Copyright (C) 2026 Joachim Kueter <git-jk@bloxera.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 */
25
32// Load Dolibarr environment
33require '../../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
42require_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
43require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
44require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php';
45require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
46require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
47require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
48
51
52$mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
53
54$hookmanager->initHooks(array('orderstats', 'globalcard'));
55
56$usercanreadcustumerstatistic = $user->hasRight('commande', 'lire');
57$usercanreadsupplierstatistic = $user->hasRight('fournisseur', 'commande', 'lire');
58if (getDolGlobalInt('MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS')) {
59 $usercanreadcustumerstatistic = $user->hasRight('commande', 'commande', 'export');
60 $usercanreadsupplierstatistic = $user->hasRight('fournisseur', 'commande', 'export');
61}
62if ($mode == 'customer' && !$usercanreadcustumerstatistic) {
64}
65if ($mode == 'supplier' && !$usercanreadsupplierstatistic) {
67}
68
69$object_status = GETPOST('object_status', 'intcomma');
70if (!empty($object_status)) {
71 $object_status = explode(',', $object_status);
72} else {
73 $object_status = GETPOST('object_status', 'array:int');
74}
75
76
77$typent_id = GETPOSTINT('typent_id');
78$categ_id = GETPOSTINT('categ_id');
79$select_categ_comande_id=GETPOST('select_categ_comande_id', 'array');
80$userid = GETPOSTINT('userid');
81$socid = GETPOSTINT('socid');
82// Security check
83if ($user->socid > 0) {
84 $action = '';
85 $socid = $user->socid;
86}
87
88$parameters = array();
89$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
90if ($reshook < 0) {
91 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
92}
93
94$nowyear = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt');
95$year = GETPOSTINT('year') > 0 ? GETPOSTINT('year') : $nowyear;
96$startyear = $year - (!getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
97$endyear = $year;
98
99// Load translation files required by the page
100$langs->loadLangs(array('orders', 'companies', 'other', 'suppliers'));
101
102
103/*
104 * View
105 */
106
107$form = new Form($db);
108$formorder = new FormOrder($db);
109$formcompany = new FormCompany($db);
110$formother = new FormOther($db);
111
112$picto = 'order';
113$title = $langs->trans("Orders");
114$dir = $conf->order->dir_temp;
115
116if ($mode == 'supplier') {
117 $picto = 'supplier_order';
118 $title = $langs->trans("SuppliersOrders");
119 $dir = $conf->fournisseur->commande->dir_temp;
120}
121
122llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-order page-stats');
123
124$page = 0;
125$param = '';
126$sortfield = '';
127$sortorder = '';
128$massactionbutton = '';
129$num = 0;
130$nbtotalofrecords = $langs->trans("Statistics");
131$limit = 0;
132
133$newcardbutton = '';
134if ($mode == 'supplier') {
135 $urlnew = DOL_URL_ROOT.'/fourn/commande/card.php?action=create';
136 if (!empty($socid)) {
137 $urlnew .= '&socid='.$socid;
138 }
139 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/fourn/commande/list.php?mode=common', '', 1, array('morecss' => 'reposition'));
140 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/fourn/commande/list.php?mode=kanban', '', 1, array('morecss' => 'reposition'));
141 $newcardbutton .= dolGetButtonTitle($langs->trans('Statistics'), '', 'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.'/commande/stats/index.php?mode=supplier', '', 2, array('morecss' => 'reposition'));
142 $newcardbutton .= dolGetButtonTitleSeparator();
143 $newcardbutton .= dolGetButtonTitle($langs->trans('NewSupplierOrderShort'), '', 'fa fa-plus-circle', $urlnew, '', (int) ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')));
144} else {
145 $urlnew = DOL_URL_ROOT.'/commande/card.php?action=create';
146 if (!empty($socid)) {
147 $urlnew .= '&socid='.$socid;
148 }
149 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/commande/list.php?mode=common', '', 1, array('morecss' => 'reposition'));
150 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/commande/list.php?mode=kanban', '', 1, array('morecss' => 'reposition'));
151 $newcardbutton .= dolGetButtonTitle($langs->trans('Statistics'), '', 'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.'/commande/stats/index.php', '', 2, array('morecss' => 'reposition'));
152 $newcardbutton .= dolGetButtonTitleSeparator();
153 $newcardbutton .= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $urlnew, '', $user->hasRight('commande', 'creer'));
154}
155
156print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
157
158dol_mkdir($dir);
159
160$stats = new CommandeStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0));
161if (!empty($object_status)) {
162 $stats->where .= ' AND c.fk_statut IN ('.$db->sanitize(implode(",", $object_status)).')';
163}
164if ($mode == 'customer') {
165 if (is_array($select_categ_comande_id) && !empty($select_categ_comande_id)) {
166 $stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_order as cat ON (c.rowid = cat.fk_order)';
167 $stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $select_categ_comande_id)).')';
168 }
169}
170if ($mode == 'supplier') {
171 if (is_array($select_categ_comande_id) && !empty($select_categ_comande_id)) {
172 $stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_supplier_order as cat ON (c.rowid = cat.fk_supplier_order)';
173 $stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $select_categ_comande_id)).')';
174 }
175}
176
177
178// Build graphic number of object
179$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
180
181// $data = array(array('Lib',val1,val2,val3),...)
182
183
184$fileurlnb = '';
185if (!$user->hasRight('societe', 'client', 'voir')) {
186 $filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png';
187 if ($mode == 'customer') {
188 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
189 }
190 if ($mode == 'supplier') {
191 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
192 }
193} else {
194 $filenamenb = $dir.'/ordersnbinyear-'.$year.'.png';
195 if ($mode == 'customer') {
196 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$year.'.png';
197 }
198 if ($mode == 'supplier') {
199 $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$year.'.png';
200 }
201}
202
203$px1 = new DolGraph();
204$mesg = $px1->isGraphKo();
205if (!$mesg) {
206 $px1->SetData($data);
207 $i = $startyear;
208 $legend = array();
209 while ($i <= $endyear) {
210 $legend[] = $i;
211 $i++;
212 }
213 $px1->SetLegend($legend);
214 $px1->SetMaxValue($px1->GetCeilMaxValue());
215 $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
216 $px1->SetWidth($WIDTH);
217 $px1->SetHeight($HEIGHT);
218 $px1->SetYLabel($langs->trans($mode == 'supplier' ? "NumberOfSupplierOrders" : "NumberOfOrders"));
219 $px1->SetShading(3);
220 $px1->SetHorizTickIncrement(1);
221 $px1->mode = 'depth';
222 $px1->SetTitle($langs->trans($mode == 'supplier' ? "NumberOfSupplierOrdersByMonth" : "NumberOfOrdersByMonth"));
223
224 $px1->draw($filenamenb, $fileurlnb);
225}
226
227// Build graphic amount of object
228$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
229// $data = array(array('Lib',val1,val2,val3),...)
230
231$fileurlamount = '';
232if (!$user->hasRight('societe', 'client', 'voir')) {
233 $filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png';
234 if ($mode == 'customer') {
235 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
236 }
237 if ($mode == 'supplier') {
238 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
239 }
240} else {
241 $filenameamount = $dir.'/ordersamountinyear-'.$year.'.png';
242 if ($mode == 'customer') {
243 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$year.'.png';
244 }
245 if ($mode == 'supplier') {
246 $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$year.'.png';
247 }
248}
249
250$px2 = new DolGraph();
251$mesg = $px2->isGraphKo();
252if (!$mesg) {
253 $px2->SetData($data);
254 $i = $startyear;
255 $legend = array();
256 while ($i <= $endyear) {
257 $legend[] = $i;
258 $i++;
259 }
260 $px2->SetLegend($legend);
261 $px2->SetMaxValue($px2->GetCeilMaxValue());
262 $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
263 $px2->SetWidth($WIDTH);
264 $px2->SetHeight($HEIGHT);
265 $px2->SetYLabel($langs->trans($mode == 'supplier' ? "AmountOfSupplierOrders" : "AmountOfOrders"));
266 $px2->SetShading(3);
267 $px2->SetHorizTickIncrement(1);
268 $px2->mode = 'depth';
269 $px2->SetTitle($langs->trans($mode == 'supplier' ? "AmountOfSupplierOrdersByMonthHT" : "AmountOfOrdersByMonthHT"));
270
271 $px2->draw($filenameamount, $fileurlamount);
272}
273
274
275$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
276
277
278$fileurl_avg = '';
279if (!$user->hasRight('societe', 'client', 'voir')) {
280 $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
281 if ($mode == 'customer') {
282 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
283 }
284 if ($mode == 'supplier') {
285 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png';
286 }
287} else {
288 $filename_avg = $dir.'/ordersaverage-'.$year.'.png';
289 if ($mode == 'customer') {
290 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png';
291 }
292 if ($mode == 'supplier') {
293 $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png';
294 }
295}
296
297$px3 = new DolGraph();
298$mesg = $px3->isGraphKo();
299if (!$mesg) {
300 $px3->SetData($data);
301 $i = $startyear;
302 $legend = array();
303 while ($i <= $endyear) {
304 $legend[] = $i;
305 $i++;
306 }
307 $px3->SetLegend($legend);
308 $px3->SetYLabel($langs->trans("AmountAverage"));
309 $px3->SetMaxValue($px3->GetCeilMaxValue());
310 $px3->SetMinValue((int) $px3->GetFloorMinValue());
311 $px3->SetWidth($WIDTH);
312 $px3->SetHeight($HEIGHT);
313 $px3->SetShading(3);
314 $px3->SetHorizTickIncrement(1);
315 $px3->mode = 'depth';
316 $px3->SetTitle($langs->trans("AmountAverage"));
317
318 $px3->draw($filename_avg, $fileurl_avg);
319}
320
321
322
323// Show array
324$data = $stats->getAllByYear();
325$arrayyears = array();
326foreach ($data as $val) {
327 if (!empty($val['year'])) {
328 $arrayyears[$val['year']] = $val['year'];
329 }
330}
331if (!count($arrayyears)) {
332 $arrayyears[$nowyear] = $nowyear;
333}
334
335$h = 0;
336$head = array();
337$head[$h][0] = DOL_URL_ROOT.'/commande/stats/index.php?mode='.$mode;
338$head[$h][1] = $langs->trans("ByMonthYear");
339$head[$h][2] = 'byyear';
340$h++;
341
342$type = 'order_stats';
343
344if ($mode == 'supplier') {
345 $type = 'supplier_order_stats';
346}
347
348complete_head_from_modules($conf, $langs, null, $head, $h, $type);
349
350print dol_get_fiche_head($head, 'byyear', '', -1);
351
352
353print '<div class="fichecenter"><div class="fichethirdleft">';
354
355
356// Show filter box
357print '<form name="stats" method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
358print '<input type="hidden" name="token" value="'.newToken().'">';
359print '<input type="hidden" name="mode" value="'.$mode.'">';
360
361print '<table class="noborder centpercent">';
362print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
363// Company
364print '<tr><td class="left">'.$langs->trans("ThirdParty").'</td><td class="left">';
365$filter = '';
366if ($mode == 'customer') {
367 $filter = '(s.client:IN:1,2,3)';
368}
369if ($mode == 'supplier') {
370 $filter = '(s.fournisseur:=:1)';
371}
372print img_picto('', 'company', 'class="pictofixedwidth"');
373print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300');
374print '</td></tr>';
375// ThirdParty Type
376print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
377$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.
378print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
379if ($user->admin) {
380 print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
381}
382print '</td></tr>';
383// Category societe
384$cat_type = 0;
385$cat_label = '';
386if ($mode == 'customer') {
387 $cat_type = Categorie::TYPE_CUSTOMER;
388 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer"));
389}
390if ($mode == 'supplier') {
391 $cat_type = Categorie::TYPE_SUPPLIER;
392 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
393}
394print '<tr><td>'.$cat_label.'</td><td>';
395print img_picto('', 'category', 'class="pictofixedwidth"');
396print $formother->select_categories($cat_type, $categ_id, 'categ_id', 0, 1, 'widthcentpercentminusx maxwidth300');
397print '</td></tr>';
398// Category commande
399if (isModEnabled('category')) {
400 $cat_type = '';
401 $cat_label = '';
402 if ($mode == 'customer') {
403 $cat_type = Categorie::TYPE_ORDER;
404 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("CustomersOrders"));
405 }
406 if ($mode == 'supplier') {
407 $cat_type = Categorie::TYPE_SUPPLIER_ORDER;
408 $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("SuppliersOrders"));
409 }
410 print '<tr><td>'.$cat_label.'</td><td>';
411 $cate_arbo = $form->select_all_categories($cat_type, '', 'parent', 0, 0, 1);
412 print img_picto('', 'category', 'class="pictofixedwidth"');
413 print $form->multiselectarray('select_categ_comande_id', $cate_arbo, GETPOST('select_categ_comande_id', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300');
414 //print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);
415 print '</td></tr>';
416}
417// User
418print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
419print img_picto('', 'user', 'class="pictofixedwidth"');
420// Pass -1 (not 0) when no user is selected so the combo keeps its empty entry instead of defaulting to the
421// current user. The statistics query below is not filtered on the current user by default, so preselecting
422// them here wrongly suggests the displayed figures are limited to that user while they are actually global.
423print $form->select_dolusers(($userid > 0 ? $userid : -1), 'userid', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
424// Status
425print '<tr><td>'.$langs->trans("Status").'</td><td>';
426if ($mode == 'customer') {
427 $liststatus = array(
428 Commande::STATUS_DRAFT => $langs->trans("StatusOrderDraft"),
429 Commande::STATUS_VALIDATED => $langs->trans("StatusOrderValidated"),
430 Commande::STATUS_SHIPMENTONPROCESS => $langs->trans("StatusOrderSent"),
431 Commande::STATUS_CLOSED => $langs->trans("StatusOrderDelivered"),
432 Commande::STATUS_CANCELED => $langs->trans("StatusOrderCanceled")
433 );
434 print $form->multiselectarray('object_status', $liststatus, $object_status, 0, 0, 'minwidth300');
435}
436if ($mode == 'supplier') {
437 $formorder->selectSupplierOrderStatus($object_status, 0, 'object_status', 'minwidth300', 1);
438}
439print '</td></tr>';
440// Year
441print '<tr><td class="left">'.$langs->trans("Year").'</td><td class="left">';
442if (!in_array($year, $arrayyears)) {
443 $arrayyears[$year] = $year;
444}
445if (!in_array($nowyear, $arrayyears)) {
446 $arrayyears[$nowyear] = $nowyear;
447}
448arsort($arrayyears);
449print img_picto('', 'calendar', 'class="pictofixedwidth"');
450print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
451print '</td></tr>';
452print '<tr><td align="center" colspan="2"><input type="submit" class="button small" name="submit" value="'.$langs->trans("Refresh").'"></td></tr>';
453print '</table>';
454print '</form>';
455print '<br><br>';
456
457
458print '<div class="div-table-responsive-no-min">';
459print '<table class="noborder centpercent">';
460print '<tr class="liste_titre" height="24">';
461print '<td class="center">'.$langs->trans("Year").'</td>';
462print '<td class="right">'.$langs->trans($mode == 'supplier' ? "NumberOfSupplierOrders" : "NbOfOrders").'</td>';
463print '<td class="right">%</td>';
464print '<td class="right">'.$langs->trans("AmountTotal").'</td>';
465print '<td class="right">%</td>';
466print '<td class="right">'.$langs->trans("AmountAverage").'</td>';
467print '<td class="right">%</td>';
468print '</tr>';
469
470$oldyear = 0;
471foreach ($data as $val) {
472 $year = $val['year'];
473 while (!empty($year) && $oldyear > (int) $year + 1) { // If we have empty year
474 $oldyear--;
475
476 print '<tr class="oddeven" height="24">';
477 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>';
478 // Empty year just after a year with records: delta is -100%
479 $isyearbeforeval = ($oldyear == (int) $year + 1);
480 print '<td class="right">0</td>';
481 print '<td class="right opacitylow" style="color: red;">'.(($isyearbeforeval && $val['nb'] > 0) ? '-100%' : '').'</td>';
482 print '<td class="right">0</td>';
483 print '<td class="right opacitylow" style="color: red;">'.(($isyearbeforeval && $val['total'] > 0) ? '-100%' : '').'</td>';
484 print '<td class="right">0</td>';
485 print '<td class="right opacitylow" style="color: red;">'.(($isyearbeforeval && $val['avg'] > 0) ? '-100%' : '').'</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']) ? ($val['nb_diff'] < 0 ? '' : '+').round($val['nb_diff']).'%' : '').'</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']) ? ($val['total_diff'] < 0 ? '' : '+').round($val['total_diff']).'%' : '').'</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']) ? ($val['avg_diff'] < 0 ? '' : '+').round($val['avg_diff']).'%' : '').'</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
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.
dol_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0, $currencycode='')
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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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)
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:542
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:740
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.